From c54e23cc5c2e0a3f6df74d8c4e63090e94db95e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:39:17 -0800 Subject: [PATCH 001/141] chore(deps): bump @typescript-eslint/eslint-plugin from 5.46.0 to 5.46.1 (#6716) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.46.0 to 5.46.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.46.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 | 232 +++++++++++++++++++++++----------------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf1184897..6f64d336b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1175,14 +1175,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.0.tgz", - "integrity": "sha512-QrZqaIOzJAjv0sfjY4EjbXUi3ZOFpKfzntx22gPGr9pmFcTjcFw/1sS1LJhEubfAGwuLjNrPV0rH+D1/XZFy7Q==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz", + "integrity": "sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.46.0", - "@typescript-eslint/type-utils": "5.46.0", - "@typescript-eslint/utils": "5.46.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/type-utils": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -1208,13 +1208,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.0.tgz", - "integrity": "sha512-7wWBq9d/GbPiIM6SqPK9tfynNxVbfpihoY5cSFMer19OYUA3l4powA2uv0AV2eAZV6KoAh6lkzxv4PoxOLh1oA==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", + "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1225,9 +1225,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1238,12 +1238,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1301,13 +1301,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.0.tgz", - "integrity": "sha512-dwv4nimVIAsVS2dTA0MekkWaRnoYNXY26dKz8AN5W3cBFYwYGFQEqm/cG+TOoooKlncJS4RTbFKgcFY/pOiBCg==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz", + "integrity": "sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.46.0", - "@typescript-eslint/utils": "5.46.0", + "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1328,9 +1328,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1341,13 +1341,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.0.tgz", - "integrity": "sha512-kDLNn/tQP+Yp8Ro2dUpyyVV0Ksn2rmpPpB0/3MO874RNmXtypMwSeazjEN/Q6CTp8D7ExXAAekPEcCEB/vtJkw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", + "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1368,12 +1368,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1427,16 +1427,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.0.tgz", - "integrity": "sha512-4O+Ps1CRDw+D+R40JYh5GlKLQERXRKW5yIQoNDpmXPJ+C7kaPF9R7GWl+PxGgXjB3PQCqsaaZUpZ9dG4U6DO7g==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.1.tgz", + "integrity": "sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.46.0", - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/typescript-estree": "5.46.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/typescript-estree": "5.46.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1453,13 +1453,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.0.tgz", - "integrity": "sha512-7wWBq9d/GbPiIM6SqPK9tfynNxVbfpihoY5cSFMer19OYUA3l4powA2uv0AV2eAZV6KoAh6lkzxv4PoxOLh1oA==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", + "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1470,9 +1470,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1483,13 +1483,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.0.tgz", - "integrity": "sha512-kDLNn/tQP+Yp8Ro2dUpyyVV0Ksn2rmpPpB0/3MO874RNmXtypMwSeazjEN/Q6CTp8D7ExXAAekPEcCEB/vtJkw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", + "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1510,12 +1510,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -15257,14 +15257,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.0.tgz", - "integrity": "sha512-QrZqaIOzJAjv0sfjY4EjbXUi3ZOFpKfzntx22gPGr9pmFcTjcFw/1sS1LJhEubfAGwuLjNrPV0rH+D1/XZFy7Q==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz", + "integrity": "sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.46.0", - "@typescript-eslint/type-utils": "5.46.0", - "@typescript-eslint/utils": "5.46.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/type-utils": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -15274,28 +15274,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.0.tgz", - "integrity": "sha512-7wWBq9d/GbPiIM6SqPK9tfynNxVbfpihoY5cSFMer19OYUA3l4powA2uv0AV2eAZV6KoAh6lkzxv4PoxOLh1oA==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", + "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1" } }, "@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" } } @@ -15326,31 +15326,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.0.tgz", - "integrity": "sha512-dwv4nimVIAsVS2dTA0MekkWaRnoYNXY26dKz8AN5W3cBFYwYGFQEqm/cG+TOoooKlncJS4RTbFKgcFY/pOiBCg==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz", + "integrity": "sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.46.0", - "@typescript-eslint/utils": "5.46.0", + "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/utils": "5.46.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.0.tgz", - "integrity": "sha512-kDLNn/tQP+Yp8Ro2dUpyyVV0Ksn2rmpPpB0/3MO874RNmXtypMwSeazjEN/Q6CTp8D7ExXAAekPEcCEB/vtJkw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", + "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -15359,12 +15359,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" } } @@ -15394,45 +15394,45 @@ } }, "@typescript-eslint/utils": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.0.tgz", - "integrity": "sha512-4O+Ps1CRDw+D+R40JYh5GlKLQERXRKW5yIQoNDpmXPJ+C7kaPF9R7GWl+PxGgXjB3PQCqsaaZUpZ9dG4U6DO7g==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.1.tgz", + "integrity": "sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.46.0", - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/typescript-estree": "5.46.0", + "@typescript-eslint/scope-manager": "5.46.1", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/typescript-estree": "5.46.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.0.tgz", - "integrity": "sha512-7wWBq9d/GbPiIM6SqPK9tfynNxVbfpihoY5cSFMer19OYUA3l4powA2uv0AV2eAZV6KoAh6lkzxv4PoxOLh1oA==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", + "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0" + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1" } }, "@typescript-eslint/types": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.0.tgz", - "integrity": "sha512-wHWgQHFB+qh6bu0IAPAJCdeCdI0wwzZnnWThlmHNY01XJ9Z97oKqKOzWYpR2I83QmshhQJl6LDM9TqMiMwJBTw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", + "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.0.tgz", - "integrity": "sha512-kDLNn/tQP+Yp8Ro2dUpyyVV0Ksn2rmpPpB0/3MO874RNmXtypMwSeazjEN/Q6CTp8D7ExXAAekPEcCEB/vtJkw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", + "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", - "@typescript-eslint/visitor-keys": "5.46.0", + "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/visitor-keys": "5.46.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -15441,12 +15441,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.46.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.0.tgz", - "integrity": "sha512-E13gBoIXmaNhwjipuvQg1ByqSAu/GbEpP/qzFihugJ+MomtoJtFAJG/+2DRPByf57B863m0/q7Zt16V9ohhANw==", + "version": "5.46.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", + "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.0", + "@typescript-eslint/types": "5.46.1", "eslint-visitor-keys": "^3.3.0" } }, From fdbd307971ed4070ad361e20dc8a8a248bf0217f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:39:40 -0800 Subject: [PATCH 002/141] chore(deps): bump gulp-replace from 1.1.3 to 1.1.4 (#6715) Bumps [gulp-replace](https://github.com/lazd/gulp-replace) from 1.1.3 to 1.1.4. - [Release notes](https://github.com/lazd/gulp-replace/releases) - [Commits](https://github.com/lazd/gulp-replace/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: gulp-replace 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 | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6f64d336b..57bf0dc1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6822,12 +6822,12 @@ } }, "node_modules/gulp-replace": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.3.tgz", - "integrity": "sha512-HcPHpWY4XdF8zxYkDODHnG2+7a3nD/Y8Mfu3aBgMiCFDW3X2GiOKXllsAmILcxe3KZT2BXoN18WrpEFm48KfLQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.4.tgz", + "integrity": "sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==", "dev": true, "dependencies": { - "@types/node": "^14.14.41", + "@types/node": "*", "@types/vinyl": "^2.0.4", "istextorbinary": "^3.0.0", "replacestream": "^4.0.3", @@ -6837,12 +6837,6 @@ "node": ">=10" } }, - "node_modules/gulp-replace/node_modules/@types/node": { - "version": "14.18.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.0.tgz", - "integrity": "sha512-0GeIl2kmVMXEnx8tg1SlG6Gg8vkqirrW752KqolYo1PHevhhZN3bhJ67qHj+bQaINhX0Ra3TlWwRvMCd9iEfNQ==", - "dev": true - }, "node_modules/gulp-series": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/gulp-series/-/gulp-series-1.0.2.tgz", @@ -19631,24 +19625,16 @@ "dev": true }, "gulp-replace": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.3.tgz", - "integrity": "sha512-HcPHpWY4XdF8zxYkDODHnG2+7a3nD/Y8Mfu3aBgMiCFDW3X2GiOKXllsAmILcxe3KZT2BXoN18WrpEFm48KfLQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.4.tgz", + "integrity": "sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==", "dev": true, "requires": { - "@types/node": "^14.14.41", + "@types/node": "*", "@types/vinyl": "^2.0.4", "istextorbinary": "^3.0.0", "replacestream": "^4.0.3", "yargs-parser": ">=5.0.0-security.0" - }, - "dependencies": { - "@types/node": { - "version": "14.18.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.0.tgz", - "integrity": "sha512-0GeIl2kmVMXEnx8tg1SlG6Gg8vkqirrW752KqolYo1PHevhhZN3bhJ67qHj+bQaINhX0Ra3TlWwRvMCd9iEfNQ==", - "dev": true - } } }, "gulp-series": { From c96aacbce8c810493e8bdb37ca35aa4ccd5eaa3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:40:47 -0800 Subject: [PATCH 003/141] chore(deps): bump json5 from 2.2.1 to 2.2.2 (#6713) Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.2) --- updated-dependencies: - dependency-name: json5 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 57bf0dc1f..697c7f0aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8215,9 +8215,9 @@ "peer": true }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", + "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==", "dev": true, "bin": { "json5": "lib/cli.js" @@ -20716,9 +20716,9 @@ "peer": true }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", + "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==", "dev": true }, "jsonfile": { From 0642a98c22d14836b6fc7b15e9d7b62eaddd8f28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:41:12 -0800 Subject: [PATCH 004/141] chore(deps): bump @blockly/block-test from 3.0.1 to 3.0.2 (#6712) Bumps [@blockly/block-test](https://github.com/google/blockly-samples/tree/HEAD/plugins/block-test) from 3.0.1 to 3.0.2. - [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.2/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 | 1528 +-------------------------------------------- 1 file changed, 15 insertions(+), 1513 deletions(-) diff --git a/package-lock.json b/package-lock.json index 697c7f0aa..76e174865 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,15 +165,15 @@ } }, "node_modules/@blockly/block-test": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.1.tgz", - "integrity": "sha512-lXHwyAFiLNAmDS3BvBscy7S4YfKt8U8yMghop/j5G3nUz5gKWQGMtUJDq7Wm5ZpIFHghYDPxnhdpwhdCkuRchA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.2.tgz", + "integrity": "sha512-YxlOKO3fNvQJZsnmqBjQwQLTezhoB9xzZkwg8Os92c3MhYHQhOyP8cX/W6IwRcY2X9blDJ/Ft2uJcUrOfEhT1g==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^9.2.0" } }, "node_modules/@blockly/dev-tools": { @@ -2158,13 +2158,6 @@ "node": ">=0.10.0" } }, - "node_modules/array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha512-H3LU5RLiSsGXPhN+Nipar0iR0IofH+8r89G2y1tBKxQ/agagKyAjhkAFDRBfodP2caPrNKHpAWNIM/c9yeL7uA==", - "dev": true, - "peer": true - }, "node_modules/array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -2276,26 +2269,6 @@ "node": ">=0.10.0" } }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "dev": true, - "peer": true, - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.8" - } - }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -2384,23 +2357,6 @@ "node": ">= 4.5.0" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "dev": true, - "peer": true, - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", - "dev": true, - "peer": true - }, "node_modules/bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -2504,16 +2460,6 @@ "node": ">= 0.8" } }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dev": true, - "peer": true, - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, "node_modules/beeper": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", @@ -2580,358 +2526,15 @@ } }, "node_modules/blockly": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.0.0.tgz", - "integrity": "sha512-V8rAT3N4QJ5r2emMGAf8D/yhwmAEfMnu/JVXmcvmS6dFcWR8g8aVlYpjTjW3CH8FyAPTrav2JalLqSfdc8TPpg==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", + "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", "dev": true, "peer": true, "dependencies": { - "jsdom": "15.2.1" + "jsdom": "20.0.3" } }, - "node_modules/blockly/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/blockly/node_modules/acorn-globals": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", - "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", - "dev": true, - "peer": true, - "dependencies": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - } - }, - "node_modules/blockly/node_modules/acorn-globals/node_modules/acorn": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", - "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", - "dev": true, - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/blockly/node_modules/acorn-walk": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", - "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/blockly/node_modules/cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true, - "peer": true - }, - "node_modules/blockly/node_modules/data-urls": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", - "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", - "dev": true, - "peer": true, - "dependencies": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - } - }, - "node_modules/blockly/node_modules/domexception": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", - "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", - "dev": true, - "peer": true, - "dependencies": { - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/blockly/node_modules/escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "dev": true, - "peer": true, - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=4.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/blockly/node_modules/html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "peer": true, - "dependencies": { - "whatwg-encoding": "^1.0.1" - } - }, - "node_modules/blockly/node_modules/jsdom": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", - "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", - "dev": true, - "peer": true, - "dependencies": { - "abab": "^2.0.0", - "acorn": "^7.1.0", - "acorn-globals": "^4.3.2", - "array-equal": "^1.0.0", - "cssom": "^0.4.1", - "cssstyle": "^2.0.0", - "data-urls": "^1.1.0", - "domexception": "^1.0.1", - "escodegen": "^1.11.1", - "html-encoding-sniffer": "^1.0.2", - "nwsapi": "^2.2.0", - "parse5": "5.1.0", - "pn": "^1.1.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.7", - "saxes": "^3.1.9", - "symbol-tree": "^3.2.2", - "tough-cookie": "^3.0.1", - "w3c-hr-time": "^1.0.1", - "w3c-xmlserializer": "^1.1.2", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^7.0.0", - "ws": "^7.0.0", - "xml-name-validator": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } - } - }, - "node_modules/blockly/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/blockly/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "peer": true, - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/blockly/node_modules/parse5": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", - "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true, - "peer": true - }, - "node_modules/blockly/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/blockly/node_modules/saxes": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", - "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", - "dev": true, - "peer": true, - "dependencies": { - "xmlchars": "^2.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/blockly/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/blockly/node_modules/tough-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", - "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", - "dev": true, - "peer": true, - "dependencies": { - "ip-regex": "^2.1.0", - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/blockly/node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "peer": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/blockly/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/blockly/node_modules/w3c-xmlserializer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", - "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", - "dev": true, - "peer": true, - "dependencies": { - "domexception": "^1.0.1", - "webidl-conversions": "^4.0.2", - "xml-name-validator": "^3.0.0" - } - }, - "node_modules/blockly/node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true, - "peer": true - }, - "node_modules/blockly/node_modules/whatwg-encoding": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", - "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, - "peer": true, - "dependencies": { - "iconv-lite": "0.4.24" - } - }, - "node_modules/blockly/node_modules/whatwg-mimetype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true, - "peer": true - }, - "node_modules/blockly/node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "peer": true, - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/blockly/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/blockly/node_modules/xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true, - "peer": true - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2954,13 +2557,6 @@ "node": ">=8" } }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true, - "peer": true - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -3134,13 +2730,6 @@ "node": ">=8" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true, - "peer": true - }, "node_modules/chai": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", @@ -3862,19 +3451,6 @@ "type": "^1.0.1" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dev": true, - "peer": true, - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/dat.gui": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/dat.gui/-/dat.gui-0.7.7.tgz", @@ -4543,17 +4119,6 @@ "node": ">=0.10.0" } }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dev": true, - "peer": true, - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "node_modules/edge-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-2.2.1.tgz", @@ -5326,16 +4891,6 @@ "@types/yauzl": "^2.9.1" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "peer": true - }, "node_modules/fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", @@ -5621,16 +5176,6 @@ "node": ">=0.10.0" } }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "dev": true, - "peer": true, - "engines": { - "node": "*" - } - }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -5812,16 +5357,6 @@ "node": ">=0.10.0" } }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dev": true, - "peer": true, - "dependencies": { - "assert-plus": "^1.0.0" - } - }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -7129,31 +6664,6 @@ "node": ">= 0.10" } }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dev": true, - "peer": true, - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -7363,22 +6873,6 @@ "node": ">=12" } }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "dev": true, - "peer": true, - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, "node_modules/http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", @@ -7404,19 +6898,6 @@ "node": ">= 6" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "peer": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -7539,16 +7020,6 @@ "node": ">=0.10.0" } }, - "node_modules/ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, "node_modules/is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -7848,13 +7319,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true, - "peer": true - }, "node_modules/is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", @@ -7936,13 +7400,6 @@ "node": ">=0.10.0" } }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "dev": true, - "peer": true - }, "node_modules/istextorbinary": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-3.3.0.tgz", @@ -8116,13 +7573,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true, - "peer": true - }, "node_modules/jsdoc-type-pratt-parser": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-3.1.0.tgz", @@ -8188,13 +7638,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true, - "peer": true - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -8207,13 +7650,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true, - "peer": true - }, "node_modules/json5": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", @@ -8238,22 +7674,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dev": true, - "peer": true, - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/just-curry-it": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-5.2.1.tgz", @@ -8636,13 +8056,6 @@ "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "dev": true }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true, - "peer": true - }, "node_modules/lodash.template": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", @@ -9537,16 +8950,6 @@ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", "integrity": "sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw==" }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true, - "peer": true, - "engines": { - "node": "*" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -10390,13 +9793,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true, - "peer": true - }, "node_modules/picocolors": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", @@ -10472,13 +9868,6 @@ "node": ">=0.10.0" } }, - "node_modules/pn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true, - "peer": true - }, "node_modules/portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -11188,117 +10577,6 @@ "node": ">=0.8.0" } }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", - "dev": true, - "peer": true, - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "peer": true, - "dependencies": { - "lodash": "^4.17.19" - }, - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", - "dev": true, - "peer": true, - "dependencies": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "engines": { - "node": ">=0.12.0" - }, - "peerDependencies": { - "request": "^2.34" - } - }, - "node_modules/request-promise-native/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "peer": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/request/node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "peer": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/request/node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "peer": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -12055,32 +11333,6 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "node_modules/sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", - "dev": true, - "peer": true, - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -12200,16 +11452,6 @@ "node": ">=0.10.0" } }, - "node_modules/stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==", - "dev": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/stream-combiner": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", @@ -12774,26 +12016,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "peer": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true, - "peer": true - }, "node_modules/type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -13097,17 +12319,6 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "dev": true, - "peer": true, - "bin": { - "uuid": "bin/uuid" - } - }, "node_modules/v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -13157,28 +12368,6 @@ "node": ">= 0.10" } }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "engines": [ - "node >=0.6.0" - ], - "peer": true, - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/verror/node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true, - "peer": true - }, "node_modules/vinyl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", @@ -13282,17 +12471,6 @@ "node": ">= 0.10" } }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", - "dev": true, - "peer": true, - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } - }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -14394,9 +13572,9 @@ } }, "@blockly/block-test": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.1.tgz", - "integrity": "sha512-lXHwyAFiLNAmDS3BvBscy7S4YfKt8U8yMghop/j5G3nUz5gKWQGMtUJDq7Wm5ZpIFHghYDPxnhdpwhdCkuRchA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.2.tgz", + "integrity": "sha512-YxlOKO3fNvQJZsnmqBjQwQLTezhoB9xzZkwg8Os92c3MhYHQhOyP8cX/W6IwRcY2X9blDJ/Ft2uJcUrOfEhT1g==", "dev": true, "requires": {} }, @@ -15909,13 +15087,6 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha512-H3LU5RLiSsGXPhN+Nipar0iR0IofH+8r89G2y1tBKxQ/agagKyAjhkAFDRBfodP2caPrNKHpAWNIM/c9yeL7uA==", - "dev": true, - "peer": true - }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -15998,23 +15169,6 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, - "asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", - "dev": true, - "peer": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true, - "peer": true - }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -16084,20 +15238,6 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", - "dev": true, - "peer": true - }, - "aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", - "dev": true, - "peer": true - }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -16176,16 +15316,6 @@ "safe-buffer": "5.1.2" } }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dev": true, - "peer": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "beeper": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", @@ -16239,290 +15369,13 @@ } }, "blockly": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.0.0.tgz", - "integrity": "sha512-V8rAT3N4QJ5r2emMGAf8D/yhwmAEfMnu/JVXmcvmS6dFcWR8g8aVlYpjTjW3CH8FyAPTrav2JalLqSfdc8TPpg==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", + "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", "dev": true, "peer": true, "requires": { - "jsdom": "15.2.1" - }, - "dependencies": { - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "peer": true - }, - "acorn-globals": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", - "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", - "dev": true, - "peer": true, - "requires": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - }, - "dependencies": { - "acorn": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", - "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", - "dev": true, - "peer": true - } - } - }, - "acorn-walk": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", - "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", - "dev": true, - "peer": true - }, - "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true, - "peer": true - }, - "data-urls": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", - "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", - "dev": true, - "peer": true, - "requires": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - } - }, - "domexception": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", - "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", - "dev": true, - "peer": true, - "requires": { - "webidl-conversions": "^4.0.2" - } - }, - "escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "dev": true, - "peer": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - } - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "peer": true, - "requires": { - "whatwg-encoding": "^1.0.1" - } - }, - "jsdom": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", - "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", - "dev": true, - "peer": true, - "requires": { - "abab": "^2.0.0", - "acorn": "^7.1.0", - "acorn-globals": "^4.3.2", - "array-equal": "^1.0.0", - "cssom": "^0.4.1", - "cssstyle": "^2.0.0", - "data-urls": "^1.1.0", - "domexception": "^1.0.1", - "escodegen": "^1.11.1", - "html-encoding-sniffer": "^1.0.2", - "nwsapi": "^2.2.0", - "parse5": "5.1.0", - "pn": "^1.1.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.7", - "saxes": "^3.1.9", - "symbol-tree": "^3.2.2", - "tough-cookie": "^3.0.1", - "w3c-hr-time": "^1.0.1", - "w3c-xmlserializer": "^1.1.2", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^7.0.0", - "ws": "^7.0.0", - "xml-name-validator": "^3.0.0" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "peer": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "parse5": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", - "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true, - "peer": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "peer": true - }, - "saxes": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", - "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", - "dev": true, - "peer": true, - "requires": { - "xmlchars": "^2.1.1" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true, - "peer": true - }, - "tough-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", - "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", - "dev": true, - "peer": true, - "requires": { - "ip-regex": "^2.1.0", - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "peer": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "w3c-xmlserializer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", - "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", - "dev": true, - "peer": true, - "requires": { - "domexception": "^1.0.1", - "webidl-conversions": "^4.0.2", - "xml-name-validator": "^3.0.0" - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true, - "peer": true - }, - "whatwg-encoding": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", - "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, - "peer": true, - "requires": { - "iconv-lite": "0.4.24" - } - }, - "whatwg-mimetype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true, - "peer": true - }, - "whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "peer": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, - "peer": true, - "requires": {} - }, - "xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true, - "peer": true - } + "jsdom": "20.0.3" } }, "brace-expansion": { @@ -16544,13 +15397,6 @@ "fill-range": "^7.0.1" } }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true, - "peer": true - }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -16676,13 +15522,6 @@ } } }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", - "dev": true, - "peer": true - }, "chai": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", @@ -17266,16 +16105,6 @@ "type": "^1.0.1" } }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dev": true, - "peer": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "dat.gui": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/dat.gui/-/dat.gui-0.7.7.tgz", @@ -17781,17 +16610,6 @@ } } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dev": true, - "peer": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "edge-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-2.2.1.tgz", @@ -18402,13 +17220,6 @@ "yauzl": "^2.10.0" } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "dev": true, - "peer": true - }, "fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", @@ -18638,13 +17449,6 @@ "for-in": "^1.0.1" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "dev": true, - "peer": true - }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -18785,16 +17589,6 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dev": true, - "peer": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -19888,24 +18682,6 @@ "glogg": "^1.0.0" } }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "dev": true, - "peer": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "peer": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -20063,18 +18839,6 @@ "url-join": "^4.0.1" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", - "dev": true, - "peer": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", @@ -20094,16 +18858,6 @@ "debug": "4" } }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "peer": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -20184,13 +18938,6 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, - "ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==", - "dev": true, - "peer": true - }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -20416,13 +19163,6 @@ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true, - "peer": true - }, "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", @@ -20483,13 +19223,6 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", - "dev": true, - "peer": true - }, "istextorbinary": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-3.3.0.tgz", @@ -20631,13 +19364,6 @@ "argparse": "^2.0.1" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", - "dev": true, - "peer": true - }, "jsdoc-type-pratt-parser": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-3.1.0.tgz", @@ -20689,13 +19415,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true, - "peer": true - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -20708,13 +19427,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true, - "peer": true - }, "json5": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", @@ -20731,19 +19443,6 @@ "universalify": "^2.0.0" } }, - "jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", - "dev": true, - "peer": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - } - }, "just-curry-it": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-5.2.1.tgz", @@ -21090,13 +19789,6 @@ "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "dev": true }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true, - "peer": true - }, "lodash.template": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", @@ -21813,13 +20505,6 @@ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", "integrity": "sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw==" }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true, - "peer": true - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -22472,13 +21157,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", - "dev": true, - "peer": true - }, "picocolors": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", @@ -22535,13 +21213,6 @@ } } }, - "pn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true, - "peer": true - }, "portfinder": { "version": "1.0.28", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", @@ -23095,95 +21766,6 @@ } } }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dev": true, - "peer": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "peer": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "peer": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } - } - }, - "request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "peer": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "dev": true, - "peer": true, - "requires": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "dependencies": { - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "peer": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -23807,24 +22389,6 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", - "dev": true, - "peer": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", @@ -23922,13 +22486,6 @@ } } }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==", - "dev": true, - "peer": true - }, "stream-combiner": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", @@ -24407,23 +22964,6 @@ "tslib": "^1.8.1" } }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "peer": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", - "dev": true, - "peer": true - }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -24659,13 +23199,6 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true, - "peer": true - }, "v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -24706,27 +23239,6 @@ "integrity": "sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM=", "dev": true }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "dev": true, - "peer": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - }, - "dependencies": { - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true, - "peer": true - } - } - }, "vinyl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", @@ -24821,16 +23333,6 @@ "source-map": "^0.5.1" } }, - "w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "peer": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } - }, "w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", From 915de93314069813fd2bd442bd0ac07a2595970e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:54:32 -0800 Subject: [PATCH 005/141] chore(deps): bump google-github-actions/deploy-appengine (#6717) Bumps [google-github-actions/deploy-appengine](https://github.com/google-github-actions/deploy-appengine) from 1.0.0 to 1.1.0. - [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/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: google-github-actions/deploy-appengine 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/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 a72ddecd3..3af1c8e06 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@v1.0.0 + uses: google-github-actions/deploy-appengine@v1.1.0 # For parameters see: # https://github.com/google-github-actions/deploy-appengine#inputs with: From 545664021628ede4c1612905915fc087c527c3d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:54:53 -0800 Subject: [PATCH 006/141] chore(deps): bump @microsoft/api-documenter from 7.19.25 to 7.19.26 (#6714) Bumps [@microsoft/api-documenter](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-documenter) from 7.19.25 to 7.19.26. - [Release notes](https://github.com/microsoft/rushstack/releases) - [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md) - [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-documenter_v7.19.26/apps/api-documenter) --- updated-dependencies: - dependency-name: "@microsoft/api-documenter" 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 | 164 ++++++---------------------------------------- 1 file changed, 20 insertions(+), 144 deletions(-) diff --git a/package-lock.json b/package-lock.json index 76e174865..bd241da93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -541,14 +541,14 @@ } }, "node_modules/@microsoft/api-documenter": { - "version": "7.19.25", - "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.19.25.tgz", - "integrity": "sha512-/yC6cG7QpjkDqHvoXt5SJJdB0Mdj0oYpaWgxdOV8uHRniZ9kZwxAEResswdS6QDCYoyqDD6jlh008HwXIcmXjA==", + "version": "7.19.26", + "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.19.26.tgz", + "integrity": "sha512-sFhYmO8k6CMFJ20D/LP1B7GdH+JfwmSKO/xTXnm63WA3+AX7g94G4TlKlc1FXdHFS2qhHnlm4qZUD3fgfs1vqg==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.25.2", + "@microsoft/api-extractor-model": "7.25.3", "@microsoft/tsdoc": "0.14.2", - "@rushstack/node-core-library": "3.53.2", + "@rushstack/node-core-library": "3.53.3", "@rushstack/ts-command-line": "4.13.1", "colors": "~1.2.1", "js-yaml": "~3.13.1", @@ -616,17 +616,6 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.2.tgz", - "integrity": "sha512-+h1uCrLQXFAKMUdghhdDcnniDB+6UA/lS9ArlB4QZQ34UbLuXNy2oQ6fafFK8cKXU4mUPTF/yGRjv7JKD5L7eg==", - "dev": true, - "dependencies": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.53.2" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@microsoft/api-extractor-model": { "version": "7.25.3", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.3.tgz", "integrity": "sha512-WWxBUq77p2iZ+5VF7Nmrm3y/UtqCh5bYV8ii3khwq3w99+fXWpvfsAhgSLsC7k8XDQc6De4ssMxH6He/qe1pzg==", @@ -637,51 +626,6 @@ "@rushstack/node-core-library": "3.53.3" } }, - "node_modules/@microsoft/api-extractor/node_modules/@rushstack/node-core-library": { - "version": "3.53.3", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.3.tgz", - "integrity": "sha512-H0+T5koi5MFhJUd5ND3dI3bwLhvlABetARl78L3lWftJVQEPyzcgTStvTTRiIM5mCltyTM8VYm6BuCtNUuxD0Q==", - "dev": true, - "dependencies": { - "@types/node": "12.20.24", - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@types/node": { - "version": "12.20.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.24.tgz", - "integrity": "sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==", - "dev": true - }, - "node_modules/@microsoft/api-extractor/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", @@ -716,15 +660,6 @@ "node": ">=4.2.0" } }, - "node_modules/@microsoft/api-extractor/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/@microsoft/tsdoc": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", @@ -792,9 +727,9 @@ } }, "node_modules/@rushstack/node-core-library": { - "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==", + "version": "3.53.3", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.3.tgz", + "integrity": "sha512-H0+T5koi5MFhJUd5ND3dI3bwLhvlABetARl78L3lWftJVQEPyzcgTStvTTRiIM5mCltyTM8VYm6BuCtNUuxD0Q==", "dev": true, "dependencies": { "@types/node": "12.20.24", @@ -13848,14 +13783,14 @@ } }, "@microsoft/api-documenter": { - "version": "7.19.25", - "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.19.25.tgz", - "integrity": "sha512-/yC6cG7QpjkDqHvoXt5SJJdB0Mdj0oYpaWgxdOV8uHRniZ9kZwxAEResswdS6QDCYoyqDD6jlh008HwXIcmXjA==", + "version": "7.19.26", + "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.19.26.tgz", + "integrity": "sha512-sFhYmO8k6CMFJ20D/LP1B7GdH+JfwmSKO/xTXnm63WA3+AX7g94G4TlKlc1FXdHFS2qhHnlm4qZUD3fgfs1vqg==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.25.2", + "@microsoft/api-extractor-model": "7.25.3", "@microsoft/tsdoc": "0.14.2", - "@rushstack/node-core-library": "3.53.2", + "@rushstack/node-core-library": "3.53.3", "@rushstack/ts-command-line": "4.13.1", "colors": "~1.2.1", "js-yaml": "~3.13.1", @@ -13912,59 +13847,6 @@ "typescript": "~4.8.4" }, "dependencies": { - "@microsoft/api-extractor-model": { - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.3.tgz", - "integrity": "sha512-WWxBUq77p2iZ+5VF7Nmrm3y/UtqCh5bYV8ii3khwq3w99+fXWpvfsAhgSLsC7k8XDQc6De4ssMxH6He/qe1pzg==", - "dev": true, - "requires": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.53.3" - } - }, - "@rushstack/node-core-library": { - "version": "3.53.3", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.3.tgz", - "integrity": "sha512-H0+T5koi5MFhJUd5ND3dI3bwLhvlABetARl78L3lWftJVQEPyzcgTStvTTRiIM5mCltyTM8VYm6BuCtNUuxD0Q==", - "dev": true, - "requires": { - "@types/node": "12.20.24", - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.17.0", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - } - }, - "@types/node": { - "version": "12.20.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.24.tgz", - "integrity": "sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==", - "dev": true - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, "resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", @@ -13985,24 +13867,18 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true } } }, "@microsoft/api-extractor-model": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.2.tgz", - "integrity": "sha512-+h1uCrLQXFAKMUdghhdDcnniDB+6UA/lS9ArlB4QZQ34UbLuXNy2oQ6fafFK8cKXU4mUPTF/yGRjv7JKD5L7eg==", + "version": "7.25.3", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.25.3.tgz", + "integrity": "sha512-WWxBUq77p2iZ+5VF7Nmrm3y/UtqCh5bYV8ii3khwq3w99+fXWpvfsAhgSLsC7k8XDQc6De4ssMxH6He/qe1pzg==", "dev": true, "requires": { "@microsoft/tsdoc": "0.14.2", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.53.2" + "@rushstack/node-core-library": "3.53.3" } }, "@microsoft/tsdoc": { @@ -14062,9 +13938,9 @@ } }, "@rushstack/node-core-library": { - "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==", + "version": "3.53.3", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.53.3.tgz", + "integrity": "sha512-H0+T5koi5MFhJUd5ND3dI3bwLhvlABetARl78L3lWftJVQEPyzcgTStvTTRiIM5mCltyTM8VYm6BuCtNUuxD0Q==", "dev": true, "requires": { "@types/node": "12.20.24", From 863c98592889ed961f7907bc731c0f157c9ccf3f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 19 Dec 2022 23:18:55 +0000 Subject: [PATCH 007/141] chore(tests): procedure blocks (#6670) * chore: sketch out necessary test cases * chore: add tests for updating the data models * chore: outline more response tests * chore: add tests for updating procedure def blocks based on models * chore: add tests for updating procedure callers based on procedure model updates * chore: add tests for renaming procedures * chore: add tests for adding procedure parameters * chore: add tests for renaming procedure parameters * chore: add tests for reordering procedure parameters * chore: add tests for enabling and disabling procedures * chore: add tests for deleting procedure def * chore: fixup tests that we accidentally broke * chore: format --- core/mutator.ts | 4 +- tests/mocha/blocks/procedures_test.js | 1032 ++++++++++++++++++++---- tests/mocha/test_helpers/procedures.js | 18 +- 3 files changed, 880 insertions(+), 174 deletions(-) diff --git a/core/mutator.ts b/core/mutator.ts index 6153009b0..de9da6eb2 100644 --- a/core/mutator.ts +++ b/core/mutator.ts @@ -317,8 +317,6 @@ export class Mutator extends Icon { return; } const block = this.getBlock(); - eventUtils.fire(new (eventUtils.get(eventUtils.BUBBLE_OPEN))( - block, visible, 'mutator')); if (visible) { // Create the bubble. this.bubble_ = new Bubble( @@ -390,6 +388,8 @@ export class Mutator extends Icon { this.sourceListener = null; } } + eventUtils.fire(new (eventUtils.get(eventUtils.BUBBLE_OPEN))( + block, visible, 'mutator')); } /** diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 0e5e944c3..5f046402d 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -7,7 +7,9 @@ goog.declareModuleId('Blockly.test.procedures'); import * as Blockly from '../../../build/src/core/blockly.js'; +import {ObservableParameterModel} from '../../../build/src/core/procedures.js'; import {assertCallBlockStructure, assertDefBlockStructure, createProcDefBlock, createProcCallBlock} from '../test_helpers/procedures.js'; +import {assertEventNotFired, createChangeListenerSpy} from '../test_helpers/events.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from '../test_helpers/setup_teardown.js'; @@ -15,20 +17,839 @@ import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, worksp suite('Procedures', function() { setup(function() { sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); + this.workspace = Blockly.inject('blocklyDiv', {}); this.workspace.createVariable('preCreatedVar', '', 'preCreatedVarId'); this.workspace.createVariable( 'preCreatedTypedVar', 'type', 'preCreatedTypedVarId'); }); + teardown(function() { sharedTestTeardown.call(this); }); + suite.skip('updating data models', function() { + test( + 'renaming a procedure def block updates the procedure model', + function() { + const defBlock = createProcDefBlock(this.workspace); + + defBlock.setFieldValue('new name', 'NAME'); + + chai.assert.equal( + defBlock.getProcedureModel().getName(), + 'new name', + 'Expected the procedure model name to be updated'); + }); + + test( + 'disabling a procedure def block updates the procedure model', + function() { + const defBlock = createProcDefBlock(this.workspace); + + defBlock.setEnabled(false); + + chai.assert.isFalse( + defBlock.getProcedureModel().getEnabled(), + 'Expected the procedure model to be disabled'); + }); + + test( + 'adding a parameter to a procedure def updates the procedure model', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const containerBlock = + this.workspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + + defBlock.compose(containerBlock); + + chai.assert.equal( + defBlock.getProcedureModel().getParameter(0).getName(), + 'param name', + 'Expected the procedure model to have a matching parameter'); + }); + + test('adding a parameter adds a variable to the variable map', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const containerBlock = + this.workspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + + defBlock.compose(containerBlock); + + chai.assert.isTrue( + this.workspace.getVariableMap().getVariables('') + .some((variable) => variable.name === 'param name'), + 'Expected the variable map to have a matching variable'); + }); + + + test( + 'moving a parameter in the procedure def updates the procedure model', + function() { + // Create a stack of container, param1, param2. + const defBlock = createProcDefBlock(this.workspace); + const containerBlock = + this.workspace.newBlock('procedures_mutatorcontainer'); + const paramBlock1 = this.workspace.newBlock('procedures_mutatorarg'); + paramBlock1.setFieldValue('param name1', 'NAME'); + const paramBlock2 = this.workspace.newBlock('procedures_mutatorarg'); + paramBlock2.setFieldValue('param name2', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock1.previousConnection); + paramBlock1.nextConnection.connect(paramBlock2.previousConnection); + defBlock.compose(containerBlock); + + // Reconfigure the stack to be container, param2, param1. + paramBlock2.previousConnection.disconnect(); + paramBlock1.previousConnection.disconnect(); + containerBlock.getInput('STACK').connection + .connect(paramBlock2.previousConnection); + paramBlock2.nextConnection.connect(paramBlock1.previousConnection); + defBlock.compose(containerBlock); + + chai.assert.equal( + defBlock.getProcedureModel().getParameter(0).getName(), + 'param name2', + 'Expected the first parameter of the procedure to be param 2'); + chai.assert.equal( + defBlock.getProcedureModel().getParameter(1).getName(), + 'param name2', + 'Expected the second parameter of the procedure to be param 1'); + }); + + test( + 'deleting a parameter from a procedure def updates the procedure model', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const containerBlock = + this.workspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + + containerBlock.getInput('STACK').connection.disconnect(); + defBlock.compose(containerBlock); + + chai.assert.isEmpty( + defBlock.getProcedureModel().getParameters(), + 'Expected the procedure model to have no parameters'); + }); + + test('renaming a procedure parameter updates the parameter model', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const containerBlock = + this.workspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + + paramBlock.setFieldValue('new param name', 'NAME'); + defBlock.compose(containerBlock); + + chai.assert.isEmpty( + defBlock.getProcedureModel().getParameters(), + 'Expected the procedure model to have no parameters'); + }); + + test('deleting a procedure deletes the procedure model', function() { + const defBlock = createProcDefBlock(this.workspace); + const model = defBlock.getProcedureModel(); + defBlock.dispose(); + + chai.assert.isUndefined( + this.workspace.getProcedureMap().get(model.getId()), + 'Expected the model to be removed from the procedure map'); + }); + }); + + suite.skip('responding to data model updates', function() { + suite('def blocks', function() { + test('renaming the procedure data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.setName('new name'); + + chai.assert.equal( + defBlock.getFieldValue('NAME'), + 'new name', + 'Expected the procedure block to be renamed'); + }); + + test('disabling a procedure data model disables blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.setEnabled(false); + + chai.assert.isFalse( + defBlock.getEnabled(), + 'Expected the procedure block to be disabled'); + }); + + test('adding a parameter to a data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.insertParameter( + new ObservableParameterModel(this.workspace, 'param1', 'id'), 0); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('param1'), + 'Expected the params field to contain the name of the new param'); + }); + + test('moving a parameter in the data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + const param2 = + new ObservableParameterModel(this.workspace, 'param2', 'id2'); + procModel.insertParameter(param1, 0); + procModel.insertParameter(param2, 1); + + procModel.deleteParameter(1); + procModel.insertParameter(param2, 0); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('param2, param1'), + 'Expected the params field order to match the parameter order'); + }); + + test( + 'deleting a parameter from the data model updates blocks', + function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + const param2 = + new ObservableParameterModel(this.workspace, 'param2', 'id2'); + procModel.insertParameter(param1, 0); + procModel.insertParameter(param2, 1); + + procModel.deleteParameter(0); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('param2'), + 'Expected the params field order to contain one parameter'); + chai.assert.isFalse( + defBlock.getFieldValue('PARAMS').includes('param1'), + 'Expected the params field to not contain the deleted parameter'); + }); + + test( + 'renaming a procedure parameter in the data model updates blocks', + function() { + const defBlock = createProcDefBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + procModel.insertParameter(param1, 0); + + param1.setName('new name'); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('new name'), + 'Expected the params field to contain the new param name'); + }); + }); + + suite('caller blocks', function() { + test('renaming the procedure data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.setName('new name'); + + chai.assert.equal( + callBlock.getFieldValue('NAME'), + 'new name', + 'Expected the procedure block to be renamed'); + }); + + test('disabling a procedure data model disables blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.setEnabled(false); + + chai.assert.isFalse( + callBlock.getEnabled(), + 'Expected the procedure block to be disabled'); + }); + + test('adding a parameter to a data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + + procModel.insertParameter( + new ObservableParameterModel(this.workspace, 'param1', 'id'), 0); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'param1', + 'Expected the params field to match the name of the new param'); + }); + + test('moving a parameter in the data model updates blocks', function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + const param2 = + new ObservableParameterModel(this.workspace, 'param2', 'id2'); + procModel.insertParameter(param1, 0); + procModel.insertParameter(param2, 1); + + procModel.deleteParameter(1); + procModel.insertParameter(param2, 0); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the first param input to exist'); + chai.assert.isNotNull( + callBlock.getInput('ARG1'), + 'Expected the second param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'param1', + 'Expected the first params field to match the name of the param'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME1'), + 'param2', + 'Expected the second params field to match the name of the param'); + }); + + test( + 'deleting a parameter from the data model updates blocks', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + const param2 = + new ObservableParameterModel(this.workspace, 'param2', 'id2'); + procModel.insertParameter(param1, 0); + procModel.insertParameter(param2, 1); + + procModel.deleteParameter(0); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the first param input to exist'); + chai.assert.isNull( + callBlock.getInput('ARG1'), + 'Expected the second param input to not exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'param2', + 'Expected the first params field to match the name of the param'); + }); + + test( + 'renaming a procedure parameter in the data model updates blocks', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + procModel.insertParameter(param1, 0); + + param1.setName('new name'); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'new name', + 'Expected the params field to match the new name of the param'); + }); + }); + }); + + suite('Renaming procedures', function() { + test('callers are updated to have the new name', function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + + defBlock.setFieldValue('new name', 'NAME'); + + chai.assert.equal( + callBlock.getFieldValue('NAME'), + 'new name', + 'Expected the procedure block to be renamed'); + }); + + test( + 'setting an illegal name results in both the ' + + 'procedure and the caller getting the legal name', + function() { + createProcDefBlock(this.workspace, undefined, undefined, 'procA'); + const defBlockB = + createProcDefBlock(this.workspace, undefined, undefined, 'procB'); + const callBlockB = + createProcCallBlock(this.workspace, undefined, 'procB'); + + defBlockB.setFieldValue('procA', 'NAME'); + + chai.assert.notEqual( + defBlockB.getFieldValue('NAME'), + 'procA', + 'Expected the procedure def block to have a legal name'); + chai.assert.notEqual( + callBlockB.getFieldValue('NAME'), + 'procA', + 'Expected the procedure call block to have a legal name'); + }); + }); + + suite('Adding procedure parameters', function() { + test('no variable create event is fired', function() { + const eventSpy = createChangeListenerSpy(this.workspace); + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + + eventSpy.resetHistory(); + defBlock.compose(containerBlock); + + assertEventNotFired( + eventSpy, Blockly.Events.VarCreate, {}, this.workspace.id); + }); + + test( + 'the mutator flyout updates to avoid parameter name conflicts', + function() { + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const origFlyoutParamName = + mutatorWorkspace.getFlyout().getWorkspace().getTopBlocks(true)[0] + .getFieldValue('NAME'); + Blockly.serialization.blocks.append( + { + 'type': 'procedures_mutatorarg', + 'fields': { + 'NAME': origFlyoutParamName, + }, + }, + mutatorWorkspace); + + const newFlyoutParamName = + mutatorWorkspace.getFlyout().getWorkspace().getTopBlocks(true)[0] + .getFieldValue('NAME'); + chai.assert.notEqual( + newFlyoutParamName, + origFlyoutParamName, + 'Expected the flyout param to have updated to not conflict'); + }); + + test('adding a parameter to the procedure updates procedure defs', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('param1'), + 'Expected the params field to contain the name of the new param'); + }); + + test('adding a parameter to the procedure updates procedure callers', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'param1', + 'Expected the params field to match the name of the new param'); + }); + }); + + suite('Renaming procedure parameters', function() { + test('defs are updated for parameter renames', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + + paramBlock.setFieldValue('new name', 'NAME'); + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('new name'), + 'Expected the params field to contain the new name of the param'); + }); + + test('callers are updated for parameter renames', function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + + paramBlock.setFieldValue('new name', 'NAME'); + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'new name', + 'Expected the params field to match the name of the new param'); + }); + + test( + 'variables associated with procedure parameters are not renamed', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + + paramBlock.setFieldValue('param2', 'NAME'); + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + this.workspace.getVariable('param1', ''), + 'Expected the old variable to continue to exist'); + }); + + test( + 'renaming a variable associated with a parameter updates procedure defs', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + defBlock.mutator.setVisible(false); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'new name'); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('new name'), + 'Expected the params field to contain the new name of the param'); + }); + + test( + 'renaming a variable associated with a parameter updates procedure callers', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + defBlock.mutator.setVisible(false); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'new name'); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'new name', + 'Expected the params field to match the name of the new param'); + }); + + test.skip( + 'renaming a variable such that you get a parameter ' + + 'conflict does... something!', + function() { + + }); + }); + + suite('Reordering procedure parameters', function() { + test('reordering procedure parameters updates procedure blocks', function() { + // Create a stack of container, parameter, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock1.setFieldValue('param1', 'NAME'); + const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock2.setFieldValue('param2', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock1.previousConnection); + paramBlock1.nextConnection.connect(paramBlock2.previousConnection); + defBlock.compose(containerBlock); + + // Reorder the parameters. + paramBlock2.previousConnection.disconnect(); + paramBlock1.previousConnection.disconnect(); + containerBlock.getInput('STACK').connection.connect(paramBlock2.previousConnection); + paramBlock2.nextConnection.connect(paramBlock1.previousConnection); + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('param2, param1'), + 'Expected the params field order to match the parameter order'); + }); + + test('reordering procedure parameters updates caller blocks', function() { + // Create a stack of container, parameter, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock1.setFieldValue('param1', 'NAME'); + const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock2.setFieldValue('param2', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock1.previousConnection); + paramBlock1.nextConnection.connect(paramBlock2.previousConnection); + defBlock.compose(containerBlock); + + // Reorder the parameters. + paramBlock2.previousConnection.disconnect(); + paramBlock1.previousConnection.disconnect(); + containerBlock.getInput('STACK').connection.connect(paramBlock2.previousConnection); + paramBlock2.nextConnection.connect(paramBlock1.previousConnection); + defBlock.compose(containerBlock); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'param2', + 'Expected the params field to match the name of the second param'); + chai.assert.isNotNull( + callBlock.getInput('ARG1'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME1'), + 'param1', + 'Expected the params field to match the name of the first param'); + }); + + test( + 'reordering procedure parameters reorders the blocks ' + + 'attached to caller inputs', + function() { + // Create a stack of container, parameter, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock1.setFieldValue('param1', 'NAME'); + const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock2.setFieldValue('param2', 'NAME'); + containerBlock.getInput('STACK').connection.connect(paramBlock1.previousConnection); + paramBlock1.nextConnection.connect(paramBlock2.previousConnection); + defBlock.compose(containerBlock); + + // Add args to the parameter inputs on the caller. + const block1 = this.workspace.newBlock('text'); + const block2 = this.workspace.newBlock('text'); + callBlock.getInput('ARG0').connection + .connect(block1.outputConnection); + callBlock.getInput('ARG1').connection + .connect(block2.outputConnection); + + // Reorder the parameters. + paramBlock2.previousConnection.disconnect(); + paramBlock1.previousConnection.disconnect(); + containerBlock.getInput('STACK').connection.connect(paramBlock2.previousConnection); + paramBlock2.nextConnection.connect(paramBlock1.previousConnection); + defBlock.compose(containerBlock); + + chai.assert.equal( + callBlock.getInputTargetBlock('ARG0'), + block2, + 'Expected the second block to be in the first slot'); + chai.assert.equal( + callBlock.getInputTargetBlock('ARG1'), + block1, + 'Expected the first block to be in the second slot'); + }); + }); + + suite('Enabling and disabling procedure blocks', function() { + test( + 'if a procedure definition is disabled, the procedure caller ' + + 'is also disabled', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + + defBlock.setEnabled(false); + + chai.assert.isFalse( + callBlock.isEnabled(), + 'Expected the caller block to be disabled'); + }); + + test( + 'if a procedure definition is enabled, the procedure caller ' + + 'is also enabled', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.setEnabled(false); + + defBlock.setEnabled(true); + + chai.assert.isTrue( + callBlock.isEnabled(), + 'Expected the caller block to be enabled'); + }); + + test( + 'if a procedure caller block was already disabled before ' + + 'its definition was disabled, it is not reenabled', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + callBlock.setEnabled(false); + defBlock.setEnabled(false); + + defBlock.setEnabled(true); + + chai.assert.isFalse( + callBlock.isEnabled(), + 'Expected the caller block to continue to be disabled'); + }); + }); + + suite('Deleting procedure blocks', function() { + // Currently fails because of event ordering. + test.skip( + 'when the procedure definition block is deleted, all of its ' + + 'associated callers are deleted as well', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock1 = createProcCallBlock(this.workspace); + const callBlock2 = createProcCallBlock(this.workspace); + + this.clock.runAll(); + chai.assert.isTrue( + callBlock1.disposed, 'Expected the first caller to be disposed'); + chai.assert.isTrue( + callBlock2.disposed, 'Expected the second caller to be disposed'); + }); + }); + suite('allProcedures', function() { test('Only Procedures', function() { - const noReturnBlock = new Blockly.Block(this.workspace, 'procedures_defnoreturn'); + const noReturnBlock = this.workspace.newBlock('procedures_defnoreturn'); noReturnBlock.setFieldValue('no return', 'NAME'); - const returnBlock = new Blockly.Block(this.workspace, 'procedures_defreturn'); + const returnBlock = this.workspace.newBlock('procedures_defreturn'); returnBlock.setFieldValue('return', 'NAME'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); @@ -40,14 +861,15 @@ suite('Procedures', function() { chai.assert.lengthOf(allProcedures[1], 1); chai.assert.equal(allProcedures[1][0][0], 'return'); }); + test('Multiple Blocks', function() { - const noReturnBlock = new Blockly.Block(this.workspace, 'procedures_defnoreturn'); + const noReturnBlock = this.workspace.newBlock('procedures_defnoreturn'); noReturnBlock.setFieldValue('no return', 'NAME'); - const returnBlock = new Blockly.Block(this.workspace, 'procedures_defreturn'); + const returnBlock = this.workspace.newBlock('procedures_defreturn'); returnBlock.setFieldValue('return', 'NAME'); - const returnBlock2 = new Blockly.Block(this.workspace, 'procedures_defreturn'); + const returnBlock2 = this.workspace.newBlock('procedures_defreturn'); returnBlock2.setFieldValue('return2', 'NAME'); - const _ = new Blockly.Block(this.workspace, 'controls_if'); + const _ = this.workspace.newBlock('controls_if'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); chai.assert.lengthOf(allProcedures, 2); @@ -59,8 +881,9 @@ suite('Procedures', function() { chai.assert.equal(allProcedures[1][0][0], 'return'); chai.assert.equal(allProcedures[1][1][0], 'return2'); }); + test('No Procedures', function() { - const _ = new Blockly.Block(this.workspace, 'controls_if'); + const _ = this.workspace.newBlock('controls_if'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); chai.assert.lengthOf(allProcedures, 2); chai.assert.lengthOf(allProcedures[0], 0, 'No procedures_defnoreturn blocks expected'); @@ -76,128 +899,6 @@ suite('Procedures', function() { }); }); - suite('Enable/Disable', function() { - setup(function() { - const toolbox = document.getElementById('toolbox-categories'); - this.workspaceSvg = Blockly.inject('blocklyDiv', {toolbox: toolbox}); - }); - teardown(function() { - workspaceTeardown.call(this, this.workspaceSvg); - sinon.restore(); - }); - suite('Inherited disabled', function() { - setup(function() { - const dom = Blockly.Xml.textToDom( - '' + - '' + - 'bar' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - 'foo' + - '' + - '' + - 'baz' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''); - Blockly.Events.disable(); - Blockly.Xml.appendDomToWorkspace(dom, this.workspaceSvg); - Blockly.Events.enable(); - - this.barDef = this.workspaceSvg.getBlockById('bar-def'); - this.fooDef = this.workspaceSvg.getBlockById('foo-def'); - this.bazDef = this.workspaceSvg.getBlockById('baz-def'); - - this.barCalls = [ - this.workspaceSvg.getBlockById('bar-c1'), - this.workspaceSvg.getBlockById('bar-c2')]; - this.fooCalls = [ - this.workspaceSvg.getBlockById('foo-c1'), - this.workspaceSvg.getBlockById('foo-c2')]; - this.bazCall = this.workspaceSvg.getBlockById('baz-c1'); - }); - test('Nested caller', function() { - this.barDef.setEnabled(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isFalse(this.barCalls[i].isEnabled(), - 'Callers are disabled when their definition is disabled ' + - '(bar call ' + i + ')'); - } - chai.assert.isTrue(this.fooCalls[0].isEnabled(), - 'Callers in definitions are disabled by inheritance'); - chai.assert.isTrue(this.fooCalls[0].getInheritedDisabled(), - 'Callers in definitions are disabled by inheritance'); - - this.fooDef.setEnabled(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isFalse(this.fooCalls[i].isEnabled(), - 'Callers are disabled when their definition is disabled ' + - '(foo call ' + i + ')'); - } - - this.barDef.setEnabled(true); - - for (let i = 0; i < 2; i++) { - chai.assert.isTrue(this.barCalls[i].isEnabled(), - 'Callers are reenabled with their definition ' + - '(bar call ' + i + ')'); - } - chai.assert.isFalse(this.fooCalls[0].isEnabled(), - 'Nested disabled callers remain disabled'); - chai.assert.isFalse(this.fooCalls[0].getInheritedDisabled(), - 'Nested disabled callers remain disabled, not by inheritance'); - }); - test('Caller in return', function() { - this.bazDef.setEnabled(false); - - chai.assert.isFalse(this.bazCall.isEnabled(), - 'Caller is disabled with its definition'); - - chai.assert.isTrue(this.barCalls[1].isEnabled(), - 'Caller in the return is disabled by inheritance'); - chai.assert.isTrue(this.barCalls[1].getInheritedDisabled(), - 'Caller in the return is disabled by inheritance'); - - this.barDef.setEnabled(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isFalse(this.barCalls[i].isEnabled(), - 'Callers are disabled when their definition is disabled ' + - '(bar call ' + i + ')'); - } - - this.bazDef.setEnabled(true); - - chai.assert.isFalse(this.barCalls[1].isEnabled(), - 'Caller in return remains disabled'); - chai.assert.isFalse(this.barCalls[1].getInheritedDisabled(), - 'Caller in return remains disabled, not by inheritance'); - }); - }); - }); - suite('Multiple block serialization', function() { function assertDefAndCallBlocks(workspace, noReturnNames, returnNames, hasCallers) { const allProcedures = Blockly.Procedures.allProcedures(workspace); @@ -232,6 +933,7 @@ suite('Procedures', function() { const blocks = workspace.getAllBlocks(false); chai.assert.lengthOf(blocks, expectedCount); } + suite('no name renamed to unnamed', function() { test('defnoreturn and defreturn', function() { const xml = Blockly.Xml.textToDom(` @@ -243,6 +945,7 @@ suite('Procedures', function() { assertDefAndCallBlocks( this.workspace, ['unnamed'], ['unnamed2'], false); }); + test('defreturn and defnoreturn', function() { const xml = Blockly.Xml.textToDom(` @@ -253,6 +956,7 @@ suite('Procedures', function() { assertDefAndCallBlocks( this.workspace, ['unnamed2'], ['unnamed'], false); }); + test('callnoreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` @@ -262,6 +966,7 @@ suite('Procedures', function() { assertDefAndCallBlocks( this.workspace, ['unnamed'], [], true); }); + test('callreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` @@ -271,6 +976,7 @@ suite('Procedures', function() { assertDefAndCallBlocks( this.workspace, [], ['unnamed'], true); }); + test('callnoreturn and callreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` @@ -281,6 +987,7 @@ suite('Procedures', function() { assertDefAndCallBlocks( this.workspace, ['unnamed'], ['unnamed2'], true); }); + test('callreturn and callnoreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` @@ -292,6 +999,7 @@ suite('Procedures', function() { this.workspace, ['unnamed2'], ['unnamed'], true); }); }); + suite('caller param mismatch', function() { setup(function() { this.TEST_VAR_ID = 'test-id'; @@ -315,6 +1023,7 @@ suite('Procedures', function() { assertDefBlockStructure(defBlock, true, ['x'], ['arg']); assertCallBlockStructure(callBlock, [], [], 'do something2'); }); + test('callreturn with bad args', function() { const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` @@ -335,6 +1044,7 @@ suite('Procedures', function() { assertCallBlockStructure( callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); }); + test('callnoreturn with missing args', function() { const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` @@ -352,6 +1062,7 @@ suite('Procedures', function() { assertDefBlockStructure(defBlock, false, ['x'], ['arg']); assertCallBlockStructure(callBlock, [], [], 'do something2'); }); + test('callnoreturn with bad args', function() { const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` @@ -404,14 +1115,14 @@ suite('Procedures', function() { test('Custom procedure block', function() { // Do not require procedures to be the built-in procedures. - const defBlock = new Blockly.Block(this.workspace, 'new_proc'); + const defBlock = this.workspace.newBlock('new_proc'); const def = Blockly.Procedures.getDefinition('test', this.workspace); chai.assert.equal(def, defBlock); }); test('Stacked procedures', function() { - const blockA = new Blockly.Block(this.workspace, 'nested_proc'); - const blockB = new Blockly.Block(this.workspace, 'nested_proc'); + const blockA = this.workspace.newBlock('nested_proc'); + const blockB = this.workspace.newBlock('nested_proc'); blockA.name = 'a'; blockB.name = 'b'; blockA.nextConnection.connect(blockB.previousConnection); @@ -431,7 +1142,7 @@ suite('Procedures', function() { suite(testSuite.title, function() { suite('Structure', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); }); test('Definition block', function() { @@ -439,18 +1150,16 @@ suite('Procedures', function() { }); test('Call block', function() { - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); assertCallBlockStructure(this.callBlock); }); }); suite('isNameUsed', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); }); test('True', function() { @@ -464,10 +1173,9 @@ suite('Procedures', function() { }); suite('rename', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); sinon.stub(this.defBlock.getField('NAME'), 'resizeEditor_'); }); @@ -566,7 +1274,7 @@ suite('Procedures', function() { defInput.htmlInput_.value = ''; defInput.onHtmlInputChange_(null); - const newDefBlock = new Blockly.Block(this.workspace, testSuite.defType); + const newDefBlock = this.workspace.newBlock(testSuite.defType); newDefBlock.setFieldValue('new name', 'NAME'); chai.assert.equal( this.defBlock.getFieldValue('NAME'), @@ -578,10 +1286,9 @@ suite('Procedures', function() { }); suite('getCallers', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); }); test('Simple', function() { @@ -591,9 +1298,9 @@ suite('Procedures', function() { chai.assert.equal(callers[0], this.callBlock); }); test('Multiple Callers', function() { - const caller2 = new Blockly.Block(this.workspace, testSuite.callType); + const caller2 = this.workspace.newBlock(testSuite.callType); caller2.setFieldValue('proc name', 'NAME'); - const caller3 = new Blockly.Block(this.workspace, testSuite.callType); + const caller3 = this.workspace.newBlock(testSuite.callType); caller3.setFieldValue('proc name', 'NAME'); const callers = @@ -604,9 +1311,9 @@ suite('Procedures', function() { chai.assert.equal(callers[2], caller3); }); test('Multiple Procedures', function() { - const def2 = new Blockly.Block(this.workspace, testSuite.defType); + const def2 = this.workspace.newBlock(testSuite.defType); def2.setFieldValue('proc name2', 'NAME'); - const caller2 = new Blockly.Block(this.workspace, testSuite.callType); + const caller2 = this.workspace.newBlock(testSuite.callType); caller2.setFieldValue('proc name2', 'NAME'); const callers = @@ -632,9 +1339,9 @@ suite('Procedures', function() { test('Multiple Workspaces', function() { const workspace = new Blockly.Workspace(); try { - const def2 = new Blockly.Block(workspace, testSuite.defType); + const def2 = workspace.newBlock(testSuite.defType); def2.setFieldValue('proc name', 'NAME'); - const caller2 = new Blockly.Block(workspace, testSuite.callType); + const caller2 = workspace.newBlock(testSuite.callType); caller2.setFieldValue('proc name', 'NAME'); let callers = @@ -652,10 +1359,9 @@ suite('Procedures', function() { }); suite('getDefinition', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); }); test('Simple', function() { @@ -664,9 +1370,9 @@ suite('Procedures', function() { chai.assert.equal(def, this.defBlock); }); test('Multiple Procedures', function() { - const def2 = new Blockly.Block(this.workspace, testSuite.defType); + const def2 = this.workspace.newBlock(testSuite.defType); def2.setFieldValue('proc name2', 'NAME'); - const caller2 = new Blockly.Block(this.workspace, testSuite.callType); + const caller2 = this.workspace.newBlock(testSuite.callType); caller2.setFieldValue('proc name2', 'NAME'); const def = @@ -676,9 +1382,9 @@ suite('Procedures', function() { test('Multiple Workspaces', function() { const workspace = new Blockly.Workspace(); try { - const def2 = new Blockly.Block(workspace, testSuite.defType); + const def2 = workspace.newBlock(testSuite.defType); def2.setFieldValue('proc name', 'NAME'); - const caller2 = new Blockly.Block(workspace, testSuite.callType); + const caller2 = workspace.newBlock(testSuite.callType); caller2.setFieldValue('proc name', 'NAME'); let def = @@ -812,10 +1518,9 @@ suite('Procedures', function() { }); suite('Mutation', function() { setup(function() { - this.defBlock = new Blockly.Block(this.workspace, testSuite.defType); + this.defBlock = this.workspace.newBlock(testSuite.defType); this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = new Blockly.Block( - this.workspace, testSuite.callType); + this.callBlock = this.workspace.newBlock(testSuite.callType); this.callBlock.setFieldValue('proc name', 'NAME'); this.findParentStub = sinon.stub(Blockly.Mutator, 'findParentWs') .returns(this.workspace); @@ -875,8 +1580,7 @@ suite('Procedures', function() { this.containerBlock = this.defBlock.decompose(this.mutatorWorkspace); this.connection = this.containerBlock.getInput('STACK').connection; for (let i = 0; i < argArray.length; i++) { - this.argBlock = new Blockly.Block( - this.mutatorWorkspace, 'procedures_mutatorarg'); + this.argBlock = this.mutatorWorkspace.newBlock('procedures_mutatorarg'); this.argBlock.setFieldValue(argArray[i], 'NAME'); this.connection.connect(this.argBlock.previousConnection); this.connection = this.argBlock.nextConnection; diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index 9358ade73..b409c5c2f 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -112,19 +112,20 @@ export function assertCallBlockStructure( * @param {boolean=} hasReturn Whether the procedure definition should have * return. * @param {Array=} args An array of argument names. + * @param {string=} name The name of the def block (defaults to 'proc name'). * @return {Blockly.Block} The created block. */ export function createProcDefBlock( - workspace, hasReturn = false, args = []) { + workspace, hasReturn = false, args = [], name = 'proc name') { const type = hasReturn ? 'procedures_defreturn' : 'procedures_defnoreturn'; - let xml = ''; + let xml = ``; for (let i = 0; i < args.length; i ++) { xml += - ' \n'; + ` \n`; } xml += - ' proc name' + + ` ${name}` + ''; return Blockly.Xml.domToBlock(Blockly.Xml.textToDom(xml), workspace); } @@ -134,15 +135,16 @@ export function createProcDefBlock( * @param {!Blockly.Workspace} workspace The Blockly workspace. * @param {boolean=} hasReturn Whether the corresponding procedure definition * has return. + * @param {string=} name The name of the caller block (defaults to 'proc name'). * @return {Blockly.Block} The created block. */ export function createProcCallBlock( - workspace, hasReturn = false) { + workspace, hasReturn = false, name = 'proc name') { const type = hasReturn ? 'procedures_callreturn' : 'procedures_callnoreturn'; return Blockly.Xml.domToBlock(Blockly.Xml.textToDom( - '' + - ' ' + - '' + `` + + ` ` + + `` ), workspace); } From 8bcc5c4683305b385038a5fef65445cab0166dc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 08:47:33 -0800 Subject: [PATCH 008/141] chore(deps): bump google-closure-compiler (#6729) Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20221004.0.0 to 20221102.0.1. - [Release notes](https://github.com/google/closure-compiler-npm/releases) - [Commits](https://github.com/google/closure-compiler-npm/compare/v20221004.0.0...v20221102.0.1) --- 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 bd241da93..41a8d1b58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20221004.0.0", + "google-closure-compiler": "^20221102.0.1", "google-closure-deps": "^20221102.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", @@ -5693,13 +5693,13 @@ } }, "node_modules/google-closure-compiler": { - "version": "20221004.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221004.0.0.tgz", - "integrity": "sha512-OKENLrZFF2o3FZ/E4zdTc9NeuAUh1fdwbQxT0sibI19aR62sgNUBo2mLU6sc4Gcm0cQ2gwfB7qX1xnapOIkbaA==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221102.0.1.tgz", + "integrity": "sha512-edAlsyJEsy2I983xWBlBfdSme16uyY007HM2OwPOoWPEFgmR100ggUabJbIegXZgbSLH51kyeJMQKuWhiHgzcA==", "dev": true, "dependencies": { "chalk": "4.x", - "google-closure-compiler-java": "^20221004.0.0", + "google-closure-compiler-java": "^20221102.0.1", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" @@ -5711,21 +5711,21 @@ "node": ">=10" }, "optionalDependencies": { - "google-closure-compiler-linux": "^20221004.0.0", - "google-closure-compiler-osx": "^20221004.0.0", - "google-closure-compiler-windows": "^20221004.0.0" + "google-closure-compiler-linux": "^20221102.0.1", + "google-closure-compiler-osx": "^20221102.0.1", + "google-closure-compiler-windows": "^20221102.0.1" } }, "node_modules/google-closure-compiler-java": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221102.0.1.tgz", + "integrity": "sha512-rMKLEma3uSe/6MGHtivDezTv4u5iaDEyxoy9No+1WruPSZ5h1gBZLONcfCA8JaoGojFPdHZI1qbwT0EveEWnAg==", "dev": true }, "node_modules/google-closure-compiler-linux": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221102.0.1.tgz", + "integrity": "sha512-rj1E1whT4j/giidQ44v4RoO8GcvU81VU9YB5RlRM0hWDvCGWjQasDABGnF/YLWLl5PXAAfJpa/hy8ckv5/r97g==", "cpu": [ "x32", "x64" @@ -5737,9 +5737,9 @@ ] }, "node_modules/google-closure-compiler-osx": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221102.0.1.tgz", + "integrity": "sha512-Cv993yr9a2DLFgYnsv4m6dNUk5jousd6W6la12x2fDbhxTLewYrw7CrCaVEVw1SU3XErVmdHOZQjFsVMhcZjCw==", "cpu": [ "x32", "x64", @@ -5752,9 +5752,9 @@ ] }, "node_modules/google-closure-compiler-windows": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221102.0.1.tgz", + "integrity": "sha512-jRwHGekG/oDihHdKAEiYN5z0cBF+brL0bYtuEOXx4fAmq5tHe4OxKtSEEprCnVZZL0aG/boGprACPvsDRsXT7Q==", "cpu": [ "x32", "x64" @@ -17786,45 +17786,45 @@ } }, "google-closure-compiler": { - "version": "20221004.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221004.0.0.tgz", - "integrity": "sha512-OKENLrZFF2o3FZ/E4zdTc9NeuAUh1fdwbQxT0sibI19aR62sgNUBo2mLU6sc4Gcm0cQ2gwfB7qX1xnapOIkbaA==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221102.0.1.tgz", + "integrity": "sha512-edAlsyJEsy2I983xWBlBfdSme16uyY007HM2OwPOoWPEFgmR100ggUabJbIegXZgbSLH51kyeJMQKuWhiHgzcA==", "dev": true, "requires": { "chalk": "4.x", - "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", + "google-closure-compiler-java": "^20221102.0.1", + "google-closure-compiler-linux": "^20221102.0.1", + "google-closure-compiler-osx": "^20221102.0.1", + "google-closure-compiler-windows": "^20221102.0.1", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" } }, "google-closure-compiler-java": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221102.0.1.tgz", + "integrity": "sha512-rMKLEma3uSe/6MGHtivDezTv4u5iaDEyxoy9No+1WruPSZ5h1gBZLONcfCA8JaoGojFPdHZI1qbwT0EveEWnAg==", "dev": true }, "google-closure-compiler-linux": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221102.0.1.tgz", + "integrity": "sha512-rj1E1whT4j/giidQ44v4RoO8GcvU81VU9YB5RlRM0hWDvCGWjQasDABGnF/YLWLl5PXAAfJpa/hy8ckv5/r97g==", "dev": true, "optional": true }, "google-closure-compiler-osx": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221102.0.1.tgz", + "integrity": "sha512-Cv993yr9a2DLFgYnsv4m6dNUk5jousd6W6la12x2fDbhxTLewYrw7CrCaVEVw1SU3XErVmdHOZQjFsVMhcZjCw==", "dev": true, "optional": true }, "google-closure-compiler-windows": { - "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==", + "version": "20221102.0.1", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221102.0.1.tgz", + "integrity": "sha512-jRwHGekG/oDihHdKAEiYN5z0cBF+brL0bYtuEOXx4fAmq5tHe4OxKtSEEprCnVZZL0aG/boGprACPvsDRsXT7Q==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index aabe95be4..9dadaf9a5 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20221004.0.0", + "google-closure-compiler": "^20221102.0.1", "google-closure-deps": "^20221102.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", From 79a58460ee7b568b2204ddd59c2d6cfeea06ef7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 08:48:33 -0800 Subject: [PATCH 009/141] chore(deps): bump webdriverio from 8.0.12 to 8.0.15 (#6734) Bumps [webdriverio](https://github.com/webdriverio/webdriverio/tree/HEAD/packages/webdriverio) from 8.0.12 to 8.0.15. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Changelog](https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md) - [Commits](https://github.com/webdriverio/webdriverio/commits/v8.0.15/packages/webdriverio) --- 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 | 1856 +++++++++++++++++---------------------------- 1 file changed, 686 insertions(+), 1170 deletions(-) diff --git a/package-lock.json b/package-lock.json index 41a8d1b58..6ccf5d970 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1074,18 +1074,18 @@ "dev": true }, "node_modules/@types/ws": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", - "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/yargs": { - "version": "17.0.17", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.17.tgz", - "integrity": "sha512-72bWxFKTK6uwWJAVT+3rF6Jo6RTojiJ27FQo8Rf60AL+VZbzoVPnMFhKsUnbjR8A3BTCYQ7Mv3hnl8T0A+CX9g==", + "version": "17.0.18", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.18.tgz", + "integrity": "sha512-eIJR1UER6ur3EpKM3d+2Pgd+ET+k6Kn9B4ZItX0oPjjVI5PrfaRjKyLT5UYendDpLuoiJMNJvovLQbEXqhsPaw==", "dev": true, "optional": true, "dependencies": { @@ -1492,17 +1492,232 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@wdio/config": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.14.tgz", + "integrity": "sha512-gm6SWN4+ncW2tNxr3MiOyivwgqgazmnB6Db0XBrONJYk+vQvMRV6F2ow2yPRoCoQRT5pLtlXs2mc9u791Oit1w==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.0.14", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", + "decamelize": "^6.0.0", + "deepmerge-ts": "^4.2.2", + "glob": "^8.0.3", + "import-meta-resolve": "^2.1.0", + "read-pkg-up": "^9.1.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/config/node_modules/@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", + "dev": true, + "dependencies": { + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/config/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@wdio/config/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@wdio/config/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@wdio/config/node_modules/locate-path": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", + "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", + "dev": true, + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@wdio/config/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/@wdio/config/node_modules/read-pkg": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", + "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^3.0.2", + "parse-json": "^5.2.0", + "type-fest": "^2.0.0" + }, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/read-pkg-up": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", + "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", + "dev": true, + "dependencies": { + "find-up": "^6.3.0", + "read-pkg": "^7.1.0", + "type-fest": "^2.5.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@wdio/config/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@wdio/globals": { - "version": "8.0.12", - "resolved": "https://registry.npmjs.org/@wdio/globals/-/globals-8.0.12.tgz", - "integrity": "sha512-6D/ZXBxHbANOfs1OKtk9g4O6xeGhAMvzvZnwtfkXQ+ywozfdv1oOzqZ/01wQwrRbmVlfLfIoMy9/kcXjtKP13A==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/@wdio/globals/-/globals-8.0.15.tgz", + "integrity": "sha512-0Nju3u8wnZMhYWvHzVqhjSL0ABUboE5taCiPXxkfw3gRYsfFTnjcg9WG3RGg+pEQAvLsbk2Rk+/tLWidZtvlug==", "dev": true, "engines": { "node": "^16.13 || >=18" }, "optionalDependencies": { "expect-webdriverio": "^4.0.1", - "webdriverio": "8.0.12" + "webdriverio": "8.0.15" } }, "node_modules/@wdio/logger": { @@ -1533,15 +1748,15 @@ } }, "node_modules/@wdio/protocols": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.0.0.tgz", - "integrity": "sha512-iTfYOcli/98ubeTqxyP9+OBPQxfbB5cPK6Zv61C9Rr4qQkzx4GPQjn/AlK0r6Bn0dRy/9lGyb2Q3UBRCx85RSQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.0.15.tgz", + "integrity": "sha512-3Ezw7MoJrdbIzR5s9dtPJT6pTbxrVWuOn1S/t1PYjKF1D+BH5ibSUwIPJzwat0J1qx9NOtOBbs8AUmFDTF8I0w==", "dev": true }, "node_modules/@wdio/repl": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-8.0.0.tgz", - "integrity": "sha512-Qys/t/NioO+LlcDcD+4Agn0JJjIiO6fkqOJJDxv3QulGPCmQ5SaYX+BQyz1o9sGscfr8s/435d+3dkBSO1+3tQ==", + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-8.0.14.tgz", + "integrity": "sha512-emyokvVhIvlX7h7oq8Nf1MxpTNvtV7ZUr+FeTcZvpOca2R6LTG1dMqQoKQNxgsx5oPHIFWS8rnlCC7xptp2ErA==", "dev": true, "engines": { "node": "^16.13 || >=18" @@ -1778,6 +1993,60 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@wdio/types": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.14.tgz", + "integrity": "sha512-W1JKVEDd0JmOlE+p6WsqAkQODnXpDwBwObqP7B9w5/cdPbjGzRS5EcQdNtwATh13E8mJe9Qy8jh8zH3WaR41Qg==", + "dev": true, + "dependencies": { + "@types/node": "^18.0.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/utils": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.14.tgz", + "integrity": "sha512-m49uLAV9szzGvvkDQG4CaP+afASBZnombUCZjuWJBHIdsGV2GnPZ9DiyfJqLW/CIvu6E/pjrihi0N3z0EVp+kA==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.0.14", + "@wdio/types": "8.0.14", + "import-meta-resolve": "^2.2.0", + "p-iteration": "^1.1.8" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/utils/node_modules/@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", + "dev": true, + "dependencies": { + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/@wdio/utils/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", @@ -3652,21 +3921,21 @@ } }, "node_modules/devtools": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.0.11.tgz", - "integrity": "sha512-qDe9RBgbDQNhVCE2GgNFUYeOQ9BDrTz3HxMVhv/1djyILkBd/dRoYUVgPsiIIWwtsoe/8gAh05sbYkwL1uTJvQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.0.15.tgz", + "integrity": "sha512-rQPnqzXqEUCJwnvNe4iAydFgMNEU0LqqKrY5L85fb7oBYEYuw9Nh7LhNHrk1kaqOjivmXtABcPXBrqo8U3SZlQ==", "dev": true, "dependencies": { "@types/ua-parser-js": "^0.7.33", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "chrome-launcher": "^0.15.0", "edge-paths": "^2.1.0", "import-meta-resolve": "^2.1.0", - "puppeteer-core": "19.4.0", + "puppeteer-core": "19.4.1", "query-selector-shadow-dom": "^1.0.0", "ua-parser-js": "^1.0.1", "uuid": "^9.0.0", @@ -3677,221 +3946,36 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1078443", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1078443.tgz", - "integrity": "sha512-a/rOMs0PrCtcJ6RKPSK5JdFqQoitF5ZeKr+YscKYpuwkzPoFr470CU8+jrej0hpVgRpqg+K0wfAkWiGB7MkhHg==", + "version": "0.0.1085790", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1085790.tgz", + "integrity": "sha512-f5kfwdOTxPqX5v8ZfAAl9xBgoEVazBYtIONDWIRqYbb7yjOIcnk6vpzCgBCQvav5AuBRLzyUGG0V74OAx93LoA==", "dev": true }, - "node_modules/devtools/node_modules/@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "node_modules/devtools/node_modules/@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" }, "engines": { "node": "^16.13 || >=18" } }, - "node_modules/devtools/node_modules/@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "dependencies": { - "@types/node": "^18.0.0" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/devtools/node_modules/@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/devtools/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/devtools/node_modules/decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "node_modules/devtools/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/devtools/node_modules/locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/devtools/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/devtools/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/devtools/node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/devtools/node_modules/which": { @@ -3909,18 +3993,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/devtools/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/diff-sequences": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", @@ -4703,9 +4775,9 @@ } }, "node_modules/expect-webdriverio": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/expect-webdriverio/-/expect-webdriverio-4.0.1.tgz", - "integrity": "sha512-+FhdO0w/HI0ur4OnVphuGPU/E3rXlLqfSjiABfMgd1jw+X2tQxGU63bCUA2GlocWl5/ZuVmV/ulEd8pYgniWYg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/expect-webdriverio/-/expect-webdriverio-4.1.0.tgz", + "integrity": "sha512-yBi8mLtvJYzPSAYln95OOwg55WrQ0E3DYRhPApMHtM6JpUQWLPtMlaVeTNzs1Y73Zi4iHLtrzyKVSFlxVQJA4Q==", "dev": true, "optional": true, "dependencies": { @@ -4716,8 +4788,8 @@ "node": ">=16 || >=18 || >=20" }, "optionalDependencies": { - "@wdio/globals": "^8.0.0-alpha.505", - "webdriverio": "^8.0.0-alpha.505" + "@wdio/globals": "^8.0.13", + "webdriverio": "^8.0.13" } }, "node_modules/ext": { @@ -7655,9 +7727,9 @@ } }, "node_modules/ky": { - "version": "0.32.2", - "resolved": "https://registry.npmjs.org/ky/-/ky-0.32.2.tgz", - "integrity": "sha512-eBJeF6IXNwX5rksdwBrE2rIJrU2d84GoTvdM7OmmTIwUVXEMd72wIwvT+nyhrqtv7AzbSNsWz7yRsHgVhj1uog==", + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.33.1.tgz", + "integrity": "sha512-zZ9OlhgM4UEunvgJBH1bBl7+a7vas1HnCLSezu2CJawc4Ka+yJculRAVKbakUece4gW7kC5Dz+UGvbXIlpDt1w==", "dev": true, "engines": { "node": ">=14.16" @@ -10021,9 +10093,9 @@ } }, "node_modules/puppeteer-core": { - "version": "19.4.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.4.0.tgz", - "integrity": "sha512-gG/jxseleZStinBn86x8r7trjcE4jcjx1hIQWOpACQhquHYMuKnrWxkzg+EDn8sN3wUtF/Ry9mtJgjM49oUOFQ==", + "version": "19.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.4.1.tgz", + "integrity": "sha512-JHIuqtqrUAx4jGOTxXu4ilapV2jabxtVMA/e4wwFUMvtSsqK4nVBSI+Z1SKDoz7gRy/JUIc8WzmfocCa6SIZ1w==", "dev": true, "dependencies": { "cross-fetch": "3.1.5", @@ -10035,7 +10107,7 @@ "rimraf": "3.0.2", "tar-fs": "2.1.1", "unbzip2-stream": "1.4.3", - "ws": "8.10.0" + "ws": "8.11.0" }, "engines": { "node": ">=14.1.0" @@ -10047,27 +10119,6 @@ "integrity": "sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ==", "dev": true }, - "node_modules/puppeteer-core/node_modules/ws": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.10.0.tgz", - "integrity": "sha512-+s49uSmZpvtAsd2h37vIPy1RBusaLawVe8of+GyEPsaJTCMpj/2v8NpeK1SHXjBlQ95lQTmQofOJnFiLoaN3yw==", - "dev": true, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/qs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", @@ -12254,6 +12305,15 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -12418,21 +12478,21 @@ } }, "node_modules/webdriver": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.0.11.tgz", - "integrity": "sha512-UK1iLpNltIzOEScd45GOQ4qFTVFMmUwMYDNtVMhX6ASB9yl4Ir3Do66BZ7fyk5+NBvn2VnIx7qrap6FutSbxhQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.0.15.tgz", + "integrity": "sha512-pD/+9Xgsen1eizwF671oTu7mJQDs6Kjv2tR3tK/8eXqIis+ocPtgbDBAS2+pDwPGp/D7gQTDUCYGfmsgK9eyZg==", "dev": true, "dependencies": { "@types/node": "^18.0.0", "@types/ws": "^8.5.3", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "deepmerge-ts": "^4.2.2", "got": "^12.1.0", - "ky": "^0.32.1", + "ky": "^0.33.0", "ws": "^8.8.0" }, "engines": { @@ -12463,61 +12523,21 @@ "node": ">=14.16" } }, - "node_modules/webdriver/node_modules/@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "node_modules/webdriver/node_modules/@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" }, "engines": { "node": "^16.13 || >=18" } }, - "node_modules/webdriver/node_modules/@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "dependencies": { - "@types/node": "^18.0.0" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/webdriver/node_modules/@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/webdriver/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/webdriver/node_modules/cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -12528,12 +12548,11 @@ } }, "node_modules/webdriver/node_modules/cacheable-request": { - "version": "10.2.3", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.3.tgz", - "integrity": "sha512-6BehRBOs7iurNjAYN9iPazTwFDaMQavJO8W1MEm3s2pH8q/tkPTtLDRUZaweWK87WFGf2Y5wLAlaCJlR5kOz3w==", + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.4.tgz", + "integrity": "sha512-IWIea8ei1Ht4dBqvlvh7Gs7EYlMyBhlJybLDUB9sadEqHqftmdNieMLIR5ia3vs8gbjj9t8hXLBpUVg3vcQNbg==", "dev": true, "dependencies": { - "@types/http-cache-semantics": "^4.0.1", "get-stream": "^6.0.1", "http-cache-semantics": "^4.1.0", "keyv": "^4.5.2", @@ -12545,32 +12564,16 @@ "node": ">=14.16" } }, - "node_modules/webdriver/node_modules/decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "node_modules/webdriver/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriver/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/webdriver/node_modules/get-stream": { @@ -12585,25 +12588,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/webdriver/node_modules/glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/webdriver/node_modules/got": { "version": "12.5.3", "resolved": "https://registry.npmjs.org/got/-/got-12.5.3.tgz", @@ -12642,21 +12626,6 @@ "node": ">=10.19.0" } }, - "node_modules/webdriver/node_modules/locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webdriver/node_modules/lowercase-keys": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", @@ -12681,18 +12650,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/webdriver/node_modules/minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/webdriver/node_modules/normalize-url": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", @@ -12714,80 +12671,6 @@ "node": ">=12.20" } }, - "node_modules/webdriver/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriver/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriver/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/webdriver/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriver/node_modules/read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webdriver/node_modules/responselike": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", @@ -12803,97 +12686,54 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/webdriver/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webdriverio": { - "version": "8.0.12", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.0.12.tgz", - "integrity": "sha512-KCQ+ePhbNTvKP635bz11ADuq9oMjU99tUCgst6difwFPYUg43HYyx5b5CTGl9LrTMqwoJ5UWoIBxjtyS216n6w==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.0.15.tgz", + "integrity": "sha512-cEK/U4dt3+H9wds3EpUqYQ504X5ztCp7XPeOdkNJKhJXlVnfc7myHFSg6YzGftyHzlhJKxP+yWs2yqaWuIY6iQ==", "dev": true, "dependencies": { "@types/aria-query": "^5.0.0", "@types/node": "^18.0.0", - "@wdio/config": "8.0.11", - "@wdio/globals": "8.0.12", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/repl": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/globals": "8.0.15", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/repl": "8.0.14", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "8.0.11", - "devtools-protocol": "^0.0.1078443", + "devtools": "8.0.15", + "devtools-protocol": "^0.0.1085790", "grapheme-splitter": "^1.0.2", "import-meta-resolve": "^2.1.0", "is-plain-obj": "^4.1.0", "lodash.clonedeep": "^4.5.0", "lodash.zip": "^4.2.0", "minimatch": "^5.0.0", - "puppeteer-core": "19.4.0", + "puppeteer-core": "19.4.1", "query-selector-shadow-dom": "^1.0.0", "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "8.0.11" + "webdriver": "8.0.15" }, "engines": { "node": "^16.13 || >=18" } }, - "node_modules/webdriverio/node_modules/@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "node_modules/webdriverio/node_modules/@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/webdriverio/node_modules/@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "dependencies": { - "@types/node": "^18.0.0" - }, - "engines": { - "node": "^16.13 || >=18" - } - }, - "node_modules/webdriverio/node_modules/@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" }, "engines": { "node": "^16.13 || >=18" @@ -12908,51 +12748,16 @@ "balanced-match": "^1.0.0" } }, - "node_modules/webdriverio/node_modules/decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "node_modules/webdriverio/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/webdriverio/node_modules/is-plain-obj": { @@ -12967,25 +12772,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/webdriverio/node_modules/locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webdriverio/node_modules/minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -12994,92 +12784,6 @@ "node": ">=10" } }, - "node_modules/webdriverio/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/webdriverio/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webdriverio/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", @@ -14269,18 +13973,18 @@ "dev": true }, "@types/ws": { - "version": "8.5.3", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", - "integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", "dev": true, "requires": { "@types/node": "*" } }, "@types/yargs": { - "version": "17.0.17", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.17.tgz", - "integrity": "sha512-72bWxFKTK6uwWJAVT+3rF6Jo6RTojiJ27FQo8Rf60AL+VZbzoVPnMFhKsUnbjR8A3BTCYQ7Mv3hnl8T0A+CX9g==", + "version": "17.0.18", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.18.tgz", + "integrity": "sha512-eIJR1UER6ur3EpKM3d+2Pgd+ET+k6Kn9B4ZItX0oPjjVI5PrfaRjKyLT5UYendDpLuoiJMNJvovLQbEXqhsPaw==", "dev": true, "optional": true, "requires": { @@ -14521,14 +14225,159 @@ "eslint-visitor-keys": "^3.3.0" } }, + "@wdio/config": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.14.tgz", + "integrity": "sha512-gm6SWN4+ncW2tNxr3MiOyivwgqgazmnB6Db0XBrONJYk+vQvMRV6F2ow2yPRoCoQRT5pLtlXs2mc9u791Oit1w==", + "dev": true, + "requires": { + "@wdio/logger": "8.0.14", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", + "decamelize": "^6.0.0", + "deepmerge-ts": "^4.2.2", + "glob": "^8.0.3", + "import-meta-resolve": "^2.1.0", + "read-pkg-up": "^9.1.0" + }, + "dependencies": { + "@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", + "dev": true, + "requires": { + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + }, + "decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true + }, + "find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "requires": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "locate-path": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", + "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", + "dev": true, + "requires": { + "p-locate": "^6.0.0" + } + }, + "minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "requires": { + "yocto-queue": "^1.0.0" + } + }, + "p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "requires": { + "p-limit": "^4.0.0" + } + }, + "path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true + }, + "read-pkg": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", + "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^3.0.2", + "parse-json": "^5.2.0", + "type-fest": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", + "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", + "dev": true, + "requires": { + "find-up": "^6.3.0", + "read-pkg": "^7.1.0", + "type-fest": "^2.5.0" + } + }, + "yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true + } + } + }, "@wdio/globals": { - "version": "8.0.12", - "resolved": "https://registry.npmjs.org/@wdio/globals/-/globals-8.0.12.tgz", - "integrity": "sha512-6D/ZXBxHbANOfs1OKtk9g4O6xeGhAMvzvZnwtfkXQ+ywozfdv1oOzqZ/01wQwrRbmVlfLfIoMy9/kcXjtKP13A==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/@wdio/globals/-/globals-8.0.15.tgz", + "integrity": "sha512-0Nju3u8wnZMhYWvHzVqhjSL0ABUboE5taCiPXxkfw3gRYsfFTnjcg9WG3RGg+pEQAvLsbk2Rk+/tLWidZtvlug==", "dev": true, "requires": { "expect-webdriverio": "^4.0.1", - "webdriverio": "8.0.12" + "webdriverio": "8.0.15" } }, "@wdio/logger": { @@ -14552,15 +14401,15 @@ } }, "@wdio/protocols": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.0.0.tgz", - "integrity": "sha512-iTfYOcli/98ubeTqxyP9+OBPQxfbB5cPK6Zv61C9Rr4qQkzx4GPQjn/AlK0r6Bn0dRy/9lGyb2Q3UBRCx85RSQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.0.15.tgz", + "integrity": "sha512-3Ezw7MoJrdbIzR5s9dtPJT6pTbxrVWuOn1S/t1PYjKF1D+BH5ibSUwIPJzwat0J1qx9NOtOBbs8AUmFDTF8I0w==", "dev": true }, "@wdio/repl": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-8.0.0.tgz", - "integrity": "sha512-Qys/t/NioO+LlcDcD+4Agn0JJjIiO6fkqOJJDxv3QulGPCmQ5SaYX+BQyz1o9sGscfr8s/435d+3dkBSO1+3tQ==", + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-8.0.14.tgz", + "integrity": "sha512-emyokvVhIvlX7h7oq8Nf1MxpTNvtV7ZUr+FeTcZvpOca2R6LTG1dMqQoKQNxgsx5oPHIFWS8rnlCC7xptp2ErA==", "dev": true }, "@wdio/selenium-standalone-service": { @@ -14724,6 +14573,47 @@ } } }, + "@wdio/types": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.14.tgz", + "integrity": "sha512-W1JKVEDd0JmOlE+p6WsqAkQODnXpDwBwObqP7B9w5/cdPbjGzRS5EcQdNtwATh13E8mJe9Qy8jh8zH3WaR41Qg==", + "dev": true, + "requires": { + "@types/node": "^18.0.0" + } + }, + "@wdio/utils": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.14.tgz", + "integrity": "sha512-m49uLAV9szzGvvkDQG4CaP+afASBZnombUCZjuWJBHIdsGV2GnPZ9DiyfJqLW/CIvu6E/pjrihi0N3z0EVp+kA==", + "dev": true, + "requires": { + "@wdio/logger": "8.0.14", + "@wdio/types": "8.0.14", + "import-meta-resolve": "^2.2.0", + "p-iteration": "^1.1.8" + }, + "dependencies": { + "@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", + "dev": true, + "requires": { + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" + } + }, + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + } + } + }, "@yarnpkg/lockfile": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", @@ -16175,171 +16065,43 @@ "dev": true }, "devtools": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.0.11.tgz", - "integrity": "sha512-qDe9RBgbDQNhVCE2GgNFUYeOQ9BDrTz3HxMVhv/1djyILkBd/dRoYUVgPsiIIWwtsoe/8gAh05sbYkwL1uTJvQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.0.15.tgz", + "integrity": "sha512-rQPnqzXqEUCJwnvNe4iAydFgMNEU0LqqKrY5L85fb7oBYEYuw9Nh7LhNHrk1kaqOjivmXtABcPXBrqo8U3SZlQ==", "dev": true, "requires": { "@types/ua-parser-js": "^0.7.33", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "chrome-launcher": "^0.15.0", "edge-paths": "^2.1.0", "import-meta-resolve": "^2.1.0", - "puppeteer-core": "19.4.0", + "puppeteer-core": "19.4.1", "query-selector-shadow-dom": "^1.0.0", "ua-parser-js": "^1.0.1", "uuid": "^9.0.0", "which": "^3.0.0" }, "dependencies": { - "@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" } }, - "@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "requires": { - "@types/node": "^18.0.0" - } - }, - "@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" - } - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", - "dev": true - }, - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, - "glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, - "locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, - "minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "requires": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - } - }, - "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true }, "which": { @@ -16350,19 +16112,13 @@ "requires": { "isexe": "^2.0.0" } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true } } }, "devtools-protocol": { - "version": "0.0.1078443", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1078443.tgz", - "integrity": "sha512-a/rOMs0PrCtcJ6RKPSK5JdFqQoitF5ZeKr+YscKYpuwkzPoFr470CU8+jrej0hpVgRpqg+K0wfAkWiGB7MkhHg==", + "version": "0.0.1085790", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1085790.tgz", + "integrity": "sha512-f5kfwdOTxPqX5v8ZfAAl9xBgoEVazBYtIONDWIRqYbb7yjOIcnk6vpzCgBCQvav5AuBRLzyUGG0V74OAx93LoA==", "dev": true }, "diff-sequences": { @@ -16997,16 +16753,16 @@ } }, "expect-webdriverio": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/expect-webdriverio/-/expect-webdriverio-4.0.1.tgz", - "integrity": "sha512-+FhdO0w/HI0ur4OnVphuGPU/E3rXlLqfSjiABfMgd1jw+X2tQxGU63bCUA2GlocWl5/ZuVmV/ulEd8pYgniWYg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/expect-webdriverio/-/expect-webdriverio-4.1.0.tgz", + "integrity": "sha512-yBi8mLtvJYzPSAYln95OOwg55WrQ0E3DYRhPApMHtM6JpUQWLPtMlaVeTNzs1Y73Zi4iHLtrzyKVSFlxVQJA4Q==", "dev": true, "optional": true, "requires": { - "@wdio/globals": "^8.0.0-alpha.505", + "@wdio/globals": "^8.0.13", "expect": "^29.3.1", "jest-matcher-utils": "^29.3.1", - "webdriverio": "^8.0.0-alpha.505" + "webdriverio": "^8.0.13" } }, "ext": { @@ -19362,9 +19118,9 @@ } }, "ky": { - "version": "0.32.2", - "resolved": "https://registry.npmjs.org/ky/-/ky-0.32.2.tgz", - "integrity": "sha512-eBJeF6IXNwX5rksdwBrE2rIJrU2d84GoTvdM7OmmTIwUVXEMd72wIwvT+nyhrqtv7AzbSNsWz7yRsHgVhj1uog==", + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.33.1.tgz", + "integrity": "sha512-zZ9OlhgM4UEunvgJBH1bBl7+a7vas1HnCLSezu2CJawc4Ka+yJculRAVKbakUece4gW7kC5Dz+UGvbXIlpDt1w==", "dev": true }, "last-run": { @@ -21266,9 +21022,9 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "puppeteer-core": { - "version": "19.4.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.4.0.tgz", - "integrity": "sha512-gG/jxseleZStinBn86x8r7trjcE4jcjx1hIQWOpACQhquHYMuKnrWxkzg+EDn8sN3wUtF/Ry9mtJgjM49oUOFQ==", + "version": "19.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.4.1.tgz", + "integrity": "sha512-JHIuqtqrUAx4jGOTxXu4ilapV2jabxtVMA/e4wwFUMvtSsqK4nVBSI+Z1SKDoz7gRy/JUIc8WzmfocCa6SIZ1w==", "dev": true, "requires": { "cross-fetch": "3.1.5", @@ -21280,7 +21036,7 @@ "rimraf": "3.0.2", "tar-fs": "2.1.1", "unbzip2-stream": "1.4.3", - "ws": "8.10.0" + "ws": "8.11.0" }, "dependencies": { "devtools-protocol": { @@ -21288,13 +21044,6 @@ "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1068969.tgz", "integrity": "sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ==", "dev": true - }, - "ws": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.10.0.tgz", - "integrity": "sha512-+s49uSmZpvtAsd2h37vIPy1RBusaLawVe8of+GyEPsaJTCMpj/2v8NpeK1SHXjBlQ95lQTmQofOJnFiLoaN3yw==", - "dev": true, - "requires": {} } } }, @@ -23075,6 +22824,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true + }, "v8flags": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", @@ -23218,21 +22973,21 @@ } }, "webdriver": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.0.11.tgz", - "integrity": "sha512-UK1iLpNltIzOEScd45GOQ4qFTVFMmUwMYDNtVMhX6ASB9yl4Ir3Do66BZ7fyk5+NBvn2VnIx7qrap6FutSbxhQ==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.0.15.tgz", + "integrity": "sha512-pD/+9Xgsen1eizwF671oTu7mJQDs6Kjv2tR3tK/8eXqIis+ocPtgbDBAS2+pDwPGp/D7gQTDUCYGfmsgK9eyZg==", "dev": true, "requires": { "@types/node": "^18.0.0", "@types/ws": "^8.5.3", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "deepmerge-ts": "^4.2.2", "got": "^12.1.0", - "ky": "^0.32.1", + "ky": "^0.33.0", "ws": "^8.8.0" }, "dependencies": { @@ -23251,50 +23006,16 @@ "defer-to-connect": "^2.0.1" } }, - "@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" - } - }, - "@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "requires": { - "@types/node": "^18.0.0" - } - }, - "@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" - } - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" } }, "cacheable-lookup": { @@ -23304,12 +23025,11 @@ "dev": true }, "cacheable-request": { - "version": "10.2.3", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.3.tgz", - "integrity": "sha512-6BehRBOs7iurNjAYN9iPazTwFDaMQavJO8W1MEm3s2pH8q/tkPTtLDRUZaweWK87WFGf2Y5wLAlaCJlR5kOz3w==", + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.4.tgz", + "integrity": "sha512-IWIea8ei1Ht4dBqvlvh7Gs7EYlMyBhlJybLDUB9sadEqHqftmdNieMLIR5ia3vs8gbjj9t8hXLBpUVg3vcQNbg==", "dev": true, "requires": { - "@types/http-cache-semantics": "^4.0.1", "get-stream": "^6.0.1", "http-cache-semantics": "^4.1.0", "keyv": "^4.5.2", @@ -23318,41 +23038,18 @@ "responselike": "^3.0.0" } }, - "decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true }, - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, - "glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, "got": { "version": "12.5.3", "resolved": "https://registry.npmjs.org/got/-/got-12.5.3.tgz", @@ -23382,15 +23079,6 @@ "resolve-alpn": "^1.2.0" } }, - "locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, "lowercase-keys": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", @@ -23403,15 +23091,6 @@ "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", "dev": true }, - "minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, "normalize-url": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", @@ -23424,53 +23103,6 @@ "integrity": "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", "dev": true }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "requires": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - } - }, "responselike": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", @@ -23479,85 +23111,54 @@ "requires": { "lowercase-keys": "^3.0.0" } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true } } }, "webdriverio": { - "version": "8.0.12", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.0.12.tgz", - "integrity": "sha512-KCQ+ePhbNTvKP635bz11ADuq9oMjU99tUCgst6difwFPYUg43HYyx5b5CTGl9LrTMqwoJ5UWoIBxjtyS216n6w==", + "version": "8.0.15", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.0.15.tgz", + "integrity": "sha512-cEK/U4dt3+H9wds3EpUqYQ504X5ztCp7XPeOdkNJKhJXlVnfc7myHFSg6YzGftyHzlhJKxP+yWs2yqaWuIY6iQ==", "dev": true, "requires": { "@types/aria-query": "^5.0.0", "@types/node": "^18.0.0", - "@wdio/config": "8.0.11", - "@wdio/globals": "8.0.12", - "@wdio/logger": "8.0.0", - "@wdio/protocols": "8.0.0", - "@wdio/repl": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/config": "8.0.14", + "@wdio/globals": "8.0.15", + "@wdio/logger": "8.0.14", + "@wdio/protocols": "8.0.15", + "@wdio/repl": "8.0.14", + "@wdio/types": "8.0.14", + "@wdio/utils": "8.0.14", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "8.0.11", - "devtools-protocol": "^0.0.1078443", + "devtools": "8.0.15", + "devtools-protocol": "^0.0.1085790", "grapheme-splitter": "^1.0.2", "import-meta-resolve": "^2.1.0", "is-plain-obj": "^4.1.0", "lodash.clonedeep": "^4.5.0", "lodash.zip": "^4.2.0", "minimatch": "^5.0.0", - "puppeteer-core": "19.4.0", + "puppeteer-core": "19.4.1", "query-selector-shadow-dom": "^1.0.0", "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "8.0.11" + "webdriver": "8.0.15" }, "dependencies": { - "@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "@wdio/logger": { + "version": "8.0.14", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.14.tgz", + "integrity": "sha512-EeWxksSASb04WnDLhc5CM8awXdNI2BLXUckOc+8E33kRVuyglzOh4HvlY5HGMr1WeAYEtLpXox5FAb66Od59qg==", "dev": true, "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", - "decamelize": "^6.0.0", - "deepmerge-ts": "^4.2.2", - "glob": "^8.0.3", - "import-meta-resolve": "^2.1.0", - "read-pkg-up": "^9.1.0" - } - }, - "@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", - "dev": true, - "requires": { - "@types/node": "^18.0.0" - } - }, - "@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", - "dev": true, - "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "import-meta-resolve": "^2.2.0", - "p-iteration": "^1.1.8" + "chalk": "^5.1.2", + "loglevel": "^1.6.0", + "loglevel-plugin-prefix": "^0.8.4", + "strip-ansi": "^6.0.0" } }, "brace-expansion": { @@ -23569,111 +23170,26 @@ "balanced-match": "^1.0.0" } }, - "decamelize": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", - "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true }, - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, - "glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, "is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", "dev": true }, - "locate-path": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz", - "integrity": "sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, "minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "dev": true, "requires": { "brace-expansion": "^2.0.1" } - }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "requires": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true } } }, From 2a5765edcc535763c72fda609c3ab597b7fb3ab3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 17:37:08 +0000 Subject: [PATCH 010/141] chore(deps): bump eslint from 8.29.0 to 8.31.0 (#6732) Bumps [eslint](https://github.com/eslint/eslint) from 8.29.0 to 8.31.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.29.0...v8.31.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 | 76 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ccf5d970..7855df91c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -276,15 +276,15 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^9.4.0", - "globals": "^13.15.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -381,9 +381,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", - "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -4322,13 +4322,13 @@ } }, "node_modules/eslint": { - "version": "8.29.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", - "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.11.6", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", @@ -4347,7 +4347,7 @@ "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.15.0", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", @@ -4481,9 +4481,9 @@ } }, "node_modules/espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "dependencies": { "acorn": "^8.8.0", @@ -5706,9 +5706,9 @@ } }, "node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -13283,15 +13283,15 @@ } }, "@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^9.4.0", - "globals": "^13.15.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -13368,9 +13368,9 @@ } }, "@humanwhocodes/config-array": { - "version": "0.11.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", - "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -16398,13 +16398,13 @@ } }, "eslint": { - "version": "8.29.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", - "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.11.6", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", @@ -16423,7 +16423,7 @@ "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.15.0", + "globals": "^13.19.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", @@ -16519,9 +16519,9 @@ "dev": true }, "espree": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.0.tgz", - "integrity": "sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "requires": { "acorn": "^8.8.0", @@ -17502,9 +17502,9 @@ } }, "globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "requires": { "type-fest": "^0.20.2" From 9b18f2c15f6c448e63ae3535a34b67955b260dcf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 17:46:10 +0000 Subject: [PATCH 011/141] chore(deps): bump @typescript-eslint/eslint-plugin from 5.46.1 to 5.47.1 (#6733) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.46.1 to 5.47.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.47.1/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 7855df91c..e7b232ae8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1110,14 +1110,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz", - "integrity": "sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz", + "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.46.1", - "@typescript-eslint/type-utils": "5.46.1", - "@typescript-eslint/utils": "5.46.1", + "@typescript-eslint/scope-manager": "5.47.1", + "@typescript-eslint/type-utils": "5.47.1", + "@typescript-eslint/utils": "5.47.1", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -1143,13 +1143,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", - "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", + "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1" + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1160,9 +1160,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1173,12 +1173,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1236,13 +1236,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz", - "integrity": "sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz", + "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.46.1", - "@typescript-eslint/utils": "5.46.1", + "@typescript-eslint/typescript-estree": "5.47.1", + "@typescript-eslint/utils": "5.47.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1263,9 +1263,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1276,13 +1276,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", - "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", + "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1303,12 +1303,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1362,16 +1362,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.1.tgz", - "integrity": "sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz", + "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.46.1", - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/scope-manager": "5.47.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/typescript-estree": "5.47.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1388,13 +1388,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", - "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", + "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1" + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1405,9 +1405,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1418,13 +1418,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", - "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", + "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1445,12 +1445,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -14009,14 +14009,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz", - "integrity": "sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz", + "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.46.1", - "@typescript-eslint/type-utils": "5.46.1", - "@typescript-eslint/utils": "5.46.1", + "@typescript-eslint/scope-manager": "5.47.1", + "@typescript-eslint/type-utils": "5.47.1", + "@typescript-eslint/utils": "5.47.1", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -14026,28 +14026,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", - "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", + "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1" + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1" } }, "@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" } } @@ -14078,31 +14078,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz", - "integrity": "sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz", + "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.46.1", - "@typescript-eslint/utils": "5.46.1", + "@typescript-eslint/typescript-estree": "5.47.1", + "@typescript-eslint/utils": "5.47.1", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", - "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", + "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14111,12 +14111,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" } } @@ -14146,45 +14146,45 @@ } }, "@typescript-eslint/utils": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.46.1.tgz", - "integrity": "sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz", + "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.46.1", - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/typescript-estree": "5.46.1", + "@typescript-eslint/scope-manager": "5.47.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/typescript-estree": "5.47.1", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz", - "integrity": "sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", + "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1" + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1" } }, "@typescript-eslint/types": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.46.1.tgz", - "integrity": "sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", + "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz", - "integrity": "sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", + "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", - "@typescript-eslint/visitor-keys": "5.46.1", + "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/visitor-keys": "5.47.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14193,12 +14193,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.46.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz", - "integrity": "sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg==", + "version": "5.47.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", + "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", "dev": true, "requires": { - "@typescript-eslint/types": "5.46.1", + "@typescript-eslint/types": "5.47.1", "eslint-visitor-keys": "^3.3.0" } }, From 56bd3d6dd6d1ebea9710e1b3b525ad22bad0a625 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 11:17:05 -0800 Subject: [PATCH 012/141] chore(deps): bump @wdio/selenium-standalone-service from 8.0.11 to 8.1.0 (#6735) Bumps [@wdio/selenium-standalone-service](https://github.com/webdriverio/webdriverio/tree/HEAD/packages/wdio-seleniun-standalone-service) from 8.0.11 to 8.1.0. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Commits](https://github.com/webdriverio/webdriverio/commits/v8.1.0/packages/wdio-seleniun-standalone-service) --- updated-dependencies: - dependency-name: "@wdio/selenium-standalone-service" 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 | 138 ++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7b232ae8..ecd42fc3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1029,15 +1029,6 @@ "@types/node": "*" } }, - "node_modules/@types/selenium-standalone": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@types/selenium-standalone/-/selenium-standalone-7.0.1.tgz", - "integrity": "sha512-zbKenL0fAXzPyiOaaFMrvFdMNhj5BgNJQq8bxiZfwQD9ID2J8bUG5xbcS3tQtlzIX/62z9nG5Vo45oaHWTbvbw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -1721,9 +1712,9 @@ } }, "node_modules/@wdio/logger": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.0.tgz", - "integrity": "sha512-QEBPZoFQhWqqIYmhp8Wa+HhvMrH2Yy0xbD3MPOibkFwp9Tn8Si7oDxbnWqzcPiukLWcb4E/QlgE5f3IM5BrAPQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.1.0.tgz", + "integrity": "sha512-QRC5b7FF4JIYUCqggnVA0sZ80TwIUFN9JyBSbuGuMxaSLSLujSo7WfuSrnQXVvsRbnJ16wWwJWYigfLkxOW86Q==", "dev": true, "dependencies": { "chalk": "^5.1.2", @@ -1736,9 +1727,9 @@ } }, "node_modules/@wdio/logger/node_modules/chalk": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.1.2.tgz", - "integrity": "sha512-E5CkT4jWURs1Vy5qGJye+XwCkNj7Od3Af7CP6SujMetSMkLs8Do2RWJK5yx1wamHV/op8Rz+9rltjaTQWDnEFQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" @@ -1763,15 +1754,15 @@ } }, "node_modules/@wdio/selenium-standalone-service": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-8.0.11.tgz", - "integrity": "sha512-k2dT4AEmqVjYv1UmqoQHdQHqHJq+qkZfXyCKo7MeyG4XZ423ioo+otztATu0NiNT7UNSmBbunBis9nUBGWaoUg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-8.1.0.tgz", + "integrity": "sha512-SU6u50O2zdqhj9PK53iZrIJoBrqUJT8tnHeEF00hsRD/53CfjPZcwVKqY8tVOcNOjVRiSkReNuI0MhlsX8gK7Q==", "dev": true, "dependencies": { - "@types/selenium-standalone": "^7.0.0", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", + "@types/node": "^18.0.0", + "@wdio/config": "8.1.0", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", "selenium-standalone": "^8.2.1" }, "engines": { @@ -1779,14 +1770,14 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.1.0.tgz", + "integrity": "sha512-xIEa5VZx7AfyUb/3ayJcBLRBm/eV/j2sNgt+UDGhtrQwRIt4xIu+xK3FzSd/B9UF+4V4h/HtiQPq3jVeEcEkIA==", "dev": true, "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", + "@wdio/utils": "8.1.0", "decamelize": "^6.0.0", "deepmerge-ts": "^4.2.2", "glob": "^8.0.3", @@ -1798,9 +1789,9 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.1.0.tgz", + "integrity": "sha512-nim2kMe62lYcTcrQxiwEyCWgrM15D4VSjrsVuSgr4+kI53X6jCWtujra+DNxHxIjNvZ/WC+ZNBaPBD5OjLt2SQ==", "dev": true, "dependencies": { "@types/node": "^18.0.0" @@ -1810,13 +1801,13 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.1.0.tgz", + "integrity": "sha512-crI7otm4ODkn4QSTTXtDzQ7HuxDl/yDryIDJoZvFdeC0jVLJGQs8kGj3vcyN2o8N0UO/L6BI/Logf+WDnzp3sQ==", "dev": true, "dependencies": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", "import-meta-resolve": "^2.2.0", "p-iteration": "^1.1.8" }, @@ -1896,9 +1887,9 @@ } }, "node_modules/@wdio/selenium-standalone-service/node_modules/minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -13928,15 +13919,6 @@ "@types/node": "*" } }, - "@types/selenium-standalone": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@types/selenium-standalone/-/selenium-standalone-7.0.1.tgz", - "integrity": "sha512-zbKenL0fAXzPyiOaaFMrvFdMNhj5BgNJQq8bxiZfwQD9ID2J8bUG5xbcS3tQtlzIX/62z9nG5Vo45oaHWTbvbw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -14381,9 +14363,9 @@ } }, "@wdio/logger": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.0.0.tgz", - "integrity": "sha512-QEBPZoFQhWqqIYmhp8Wa+HhvMrH2Yy0xbD3MPOibkFwp9Tn8Si7oDxbnWqzcPiukLWcb4E/QlgE5f3IM5BrAPQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.1.0.tgz", + "integrity": "sha512-QRC5b7FF4JIYUCqggnVA0sZ80TwIUFN9JyBSbuGuMxaSLSLujSo7WfuSrnQXVvsRbnJ16wWwJWYigfLkxOW86Q==", "dev": true, "requires": { "chalk": "^5.1.2", @@ -14393,9 +14375,9 @@ }, "dependencies": { "chalk": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.1.2.tgz", - "integrity": "sha512-E5CkT4jWURs1Vy5qGJye+XwCkNj7Od3Af7CP6SujMetSMkLs8Do2RWJK5yx1wamHV/op8Rz+9rltjaTQWDnEFQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true } } @@ -14413,27 +14395,27 @@ "dev": true }, "@wdio/selenium-standalone-service": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-8.0.11.tgz", - "integrity": "sha512-k2dT4AEmqVjYv1UmqoQHdQHqHJq+qkZfXyCKo7MeyG4XZ423ioo+otztATu0NiNT7UNSmBbunBis9nUBGWaoUg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/selenium-standalone-service/-/selenium-standalone-service-8.1.0.tgz", + "integrity": "sha512-SU6u50O2zdqhj9PK53iZrIJoBrqUJT8tnHeEF00hsRD/53CfjPZcwVKqY8tVOcNOjVRiSkReNuI0MhlsX8gK7Q==", "dev": true, "requires": { - "@types/selenium-standalone": "^7.0.0", - "@wdio/config": "8.0.11", - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", + "@types/node": "^18.0.0", + "@wdio/config": "8.1.0", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", "selenium-standalone": "^8.2.1" }, "dependencies": { "@wdio/config": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.0.11.tgz", - "integrity": "sha512-LR8n6TJfDzVtDmuge4EjOHiJKae73ZyvEwTQq3tokovRIbIMaVkfsRV9iqEZiRgohy14ehAREwNgn67j77ucYA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.1.0.tgz", + "integrity": "sha512-xIEa5VZx7AfyUb/3ayJcBLRBm/eV/j2sNgt+UDGhtrQwRIt4xIu+xK3FzSd/B9UF+4V4h/HtiQPq3jVeEcEkIA==", "dev": true, "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", - "@wdio/utils": "8.0.11", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", + "@wdio/utils": "8.1.0", "decamelize": "^6.0.0", "deepmerge-ts": "^4.2.2", "glob": "^8.0.3", @@ -14442,22 +14424,22 @@ } }, "@wdio/types": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.0.11.tgz", - "integrity": "sha512-54xbajB7tqWmYPXFI0ALupPauwLyVtPSZSG/R/DPlY25p+Ygw4jwH64s+Jh1V3TZYnktfv4cIt1Bw/M35cBgOQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.1.0.tgz", + "integrity": "sha512-nim2kMe62lYcTcrQxiwEyCWgrM15D4VSjrsVuSgr4+kI53X6jCWtujra+DNxHxIjNvZ/WC+ZNBaPBD5OjLt2SQ==", "dev": true, "requires": { "@types/node": "^18.0.0" } }, "@wdio/utils": { - "version": "8.0.11", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.0.11.tgz", - "integrity": "sha512-4nIYt1KP4IVIYfnld+Kbh/l85o7VK4roAEIfiHV374utPpspzV+eli4ANX2fEOGVUVJMVNBCN/sCsL8u3DsPpw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.1.0.tgz", + "integrity": "sha512-crI7otm4ODkn4QSTTXtDzQ7HuxDl/yDryIDJoZvFdeC0jVLJGQs8kGj3vcyN2o8N0UO/L6BI/Logf+WDnzp3sQ==", "dev": true, "requires": { - "@wdio/logger": "8.0.0", - "@wdio/types": "8.0.11", + "@wdio/logger": "8.1.0", + "@wdio/types": "8.1.0", "import-meta-resolve": "^2.2.0", "p-iteration": "^1.1.8" } @@ -14510,9 +14492,9 @@ } }, "minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "dev": true, "requires": { "brace-expansion": "^2.0.1" From 37ad8eed836e9823210cee7ceeffb51d79d08ee0 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 4 Jan 2023 00:41:18 +0000 Subject: [PATCH 013/141] chore: reorganize block defs (#6671) --- blocks/procedures.js | 963 +++++++++++++++++++++++++++---------------- 1 file changed, 597 insertions(+), 366 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index c7a5d7fc3..eb0b4fe54 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -16,6 +16,7 @@ goog.module('Blockly.libraryBlocks.procedures'); const AbstractEvent = goog.requireType('Blockly.Events.Abstract'); const ContextMenu = goog.require('Blockly.ContextMenu'); const Events = goog.require('Blockly.Events'); +const Extensions = goog.require('Blockly.Extensions'); const Procedures = goog.require('Blockly.Procedures'); const Variables = goog.require('Blockly.Variables'); const Xml = goog.require('Blockly.Xml'); @@ -29,9 +30,7 @@ const {Block} = goog.requireType('Blockly.Block'); const BlockDefinition = Object; const {config} = goog.require('Blockly.config'); /* eslint-disable-next-line no-unused-vars */ -const {FieldCheckbox} = goog.require('Blockly.FieldCheckbox'); const {FieldLabel} = goog.require('Blockly.FieldLabel'); -const {FieldTextInput} = goog.require('Blockly.FieldTextInput'); const {Msg} = goog.require('Blockly.Msg'); const {Mutator} = goog.require('Blockly.Mutator'); const {Names} = goog.require('Blockly.Names'); @@ -39,7 +38,7 @@ const {Names} = goog.require('Blockly.Names'); const {VariableModel} = goog.requireType('Blockly.VariableModel'); /* eslint-disable-next-line no-unused-vars */ const {Workspace} = goog.requireType('Blockly.Workspace'); -const {defineBlocks} = goog.require('Blockly.common'); +const {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common'); /** @suppress {extraRequire} */ goog.require('Blockly.Comment'); /** @suppress {extraRequire} */ @@ -50,14 +49,324 @@ goog.require('Blockly.Warning'); * A dictionary of the block definitions provided by this module. * @type {!Object} */ -const blocks = {}; +const blocks = createBlockDefinitionsFromJsonArray([ + { + 'type': 'procedures_defnoreturn', + 'message0': '%{BKY_PROCEDURES_DEFNORETURN_TITLE} %1 %2 %3', + 'message1': '%{BKY_PROCEDURES_DEFNORETURN_DO} %1', + 'args0': [ + { + 'type': 'field_input', + 'name': 'NAME', + 'text': '', + 'spellcheck': false, + }, + { + 'type': 'field_label', + 'name': 'PARAMS', + 'text': '', + }, + { + 'type': 'input_dummy', + 'name': 'TOP', + }, + ], + 'args1': [ + { + 'type': 'input_statement', + 'name': 'STACK', + }, + ], + 'style': 'procedure_blocks', + 'helpUrl': '%{BKY_PROCEDURES_DEFNORETURN_HELPURL}', + 'tooltip': '%{BKY_PROCEDURES_DEFNORETURN_TOOLTIP}', + 'extensions': [ + 'procedure_def_get_def_mixin', + 'procedure_def_var_mixin', + 'procedure_def_update_shape_mixin', + 'procedure_def_context_menu_mixin', + 'procedure_def_get_legal_name_helper', + 'procedure_defnoreturn_get_caller_block_mixin', + 'procedure_defnoreturn_set_comment_helper', + ], + 'mutator': 'procedure_def_mutator', + }, + { + 'type': 'procedures_callnoreturn', + 'message0': '%1 %2', + 'args0': [ + { + 'type': 'field_label', + 'name': 'NAME', + }, + { + 'type': 'input_dummy', + 'name': 'TOPROW', + }, + ], + 'nextStatement': null, + 'previousStatement': null, + 'style': 'procedure_blocks', + 'helpUrl': '%{BKY_PROCEDURES_CALLNORETURN_HELPURL}', + 'extensions': [ + 'procedure_caller_get_def_mixin', + 'procedure_caller_update_shape_mixin', + 'procedure_caller_onchange_mixin', + 'procedure_caller_context_menu_mixin', + 'procedure_callernoreturn_get_def_block_mixin', + ], + 'mutator': 'procedure_caller_mutator', + }, + { + 'type': 'procedures_defreturn', + 'message0': '%{BKY_PROCEDURES_DEFRETURN_TITLE} %1 %2 %3', + 'message1': '%{BKY_PROCEDURES_DEFRETURN_DO} %1', + 'message2': '%{BKY_PROCEDURES_DEFRETURN_RETURN} %1', + 'args0': [ + { + 'type': 'field_input', + 'name': 'NAME', + 'text': '', + 'spellcheck': false, + }, + { + 'type': 'field_label', + 'name': 'PARAMS', + 'text': '', + }, + { + 'type': 'input_dummy', + 'name': 'TOP', + }, + ], + 'args1': [ + { + 'type': 'input_statement', + 'name': 'STACK', + }, + ], + 'args2': [ + { + 'type': 'input_value', + 'align': 'right', + 'name': 'RETURN', + }, + ], + 'style': 'procedure_blocks', + 'helpUrl': '%{BKY_PROCEDURES_DEFRETURN_HELPURL}', + 'tooltip': '%{BKY_PROCEDURES_DEFRETURN_TOOLTIP}', + 'extensions': [ + 'procedure_def_get_def_mixin', + 'procedure_def_var_mixin', + 'procedure_def_update_shape_mixin', + 'procedure_def_context_menu_mixin', + 'procedure_def_get_legal_name_helper', + 'procedure_defreturn_get_caller_block_mixin', + 'procedure_defreturn_set_comment_helper', + ], + 'mutator': 'procedure_def_mutator', + }, + { + 'type': 'procedures_callreturn', + 'message0': '%1 %2', + 'args0': [ + { + 'type': 'field_label', + 'name': 'NAME', + }, + { + 'type': 'input_dummy', + 'name': 'TOPROW', + }, + ], + 'output': null, + 'style': 'procedure_blocks', + 'helpUrl': '%{BKY_PROCEDURES_CALLRETURN_HELPURL}', + 'extensions': [ + 'procedure_caller_get_def_mixin', + 'procedure_caller_update_shape_mixin', + 'procedure_caller_onchange_mixin', + 'procedure_caller_context_menu_mixin', + 'procedure_callerreturn_get_def_block_mixin', + ], + 'mutator': 'procedure_caller_mutator', + }, + { + 'type': 'procedures_mutatorcontainer', + 'message0': '%{BKY_PROCEDURES_MUTATORCONTAINER_TITLE} %1 %2', + 'message1': '%{BKY_PROCEDURES_ALLOW_STATEMENTS} %1 %2', + 'args0': [ + { + 'type': 'input_dummy', + }, + { + 'type': 'input_statement', + 'name': 'STACK', + }, + ], + 'args1': [ + { + 'type': 'field_checkbox', + 'checked': true, + 'name': 'STATEMENTS', + }, + { + 'type': 'input_dummy', + 'name': 'STATEMENT_INPUT', + }, + ], + 'style': 'procedure_blocks', + 'tooltip': '%{BKY_PROCEDURES_MUTATORCONTAINER_TOOLTIP}', + 'enableContextMenu': false, + }, + { + 'type': 'procedures_mutatorarg', + 'message0': '%{BKY_PROCEDURES_MUTATORARG_TITLE} %1', + 'args0': [ + { + 'type': 'field_input', + 'name': 'NAME', + }, + ], + 'nextStatement': null, + 'previousStatement': null, + 'style': 'procedure_blocks', + 'tooltip': '%{BKY_PROCEDURES_MUTATORARG_TOOLTIP}', + 'enableContextMenu': false, + 'extensions': [ + 'procedure_mutatorarg_validate_mixin', + 'procedure_mutatorarg_add_validator_helper', + ], + }, + { + 'type': 'procedures_ifreturn', + 'message0': '%{BKY_CONTROLS_IF_MSG_IF} %1', + 'message1': '%{BKY_PROCEDURES_DEFRETURN_RETURN} %1', + 'args0': [ + { + 'type': 'input_value', + 'name': 'CONDITION', + 'check': 'Boolean', + }, + ], + 'args1': [ + { + 'type': 'input_value', + 'name': 'VALUE', + }, + ], + 'inputsInline': true, + 'nextStatement': null, + 'previousStatement': null, + 'style': 'procedure_blocks', + 'tooltip': '%{BKY_PROCEDURES_IFRETURN_TOOLTIP}', + 'helpUrl': '%{BKY_PROCEDURES_IFRETURN_HELPURL}', + 'extensions': [ + 'procedure_ifreturn_onchange_mixin', + 'procedure_ifreturn_function_types_mixin', + ], + 'mutator': 'procedure_ifreturn_mutator', + }, +]); exports.blocks = blocks; -/** - * Common properties for the procedure_defnoreturn and - * procedure_defreturn blocks. - */ -const PROCEDURE_DEF_COMMON = { + +/** @this {Block} */ +const procedureDefGetDefMixin = function() { + const mixin = { + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Block} + */ + getVars: function() { + return this.arguments_; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Block} + */ + getVarModels: function() { + return this.argumentVarModels_; + }, + }; + + this.mixin(mixin, true); +}; +// Using register instead of registerMixin to avoid triggering warnings about +// overriding built-ins. +Extensions.register('procedure_def_get_def_mixin', procedureDefGetDefMixin); + +/** @this {Block} */ +const procedureDefVarMixin = function() { + const mixin = { + /** + * Notification that a variable is renaming. + * If the ID matches one of this block's variables, rename it. + * @param {string} oldId ID of variable to rename. + * @param {string} newId ID of new variable. May be the same as oldId, but + * with an updated name. Guaranteed to be the same type as the old + * variable. + * @override + * @this {Block} + */ + renameVarById: function(oldId, newId) { + const oldVariable = this.workspace.getVariableById(oldId); + if (oldVariable.type !== '') { + // Procedure arguments always have the empty type. + return; + } + const oldName = oldVariable.name; + const newVar = this.workspace.getVariableById(newId); + + let change = false; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() === oldId) { + this.arguments_[i] = newVar.name; + this.argumentVarModels_[i] = newVar; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newVar.name); + Procedures.mutateCallers(this); + } + }, + + /** + * Notification that a variable is renaming but keeping the same ID. If the + * variable is in use on this block, rerender to show the new name. + * @param {!VariableModel} variable The variable being renamed. + * @package + * @override + * @this {Block} + */ + updateVarName: function(variable) { + const newName = variable.name; + let change = false; + let oldName; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() === variable.getId()) { + oldName = this.arguments_[i]; + this.arguments_[i] = newName; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newName); + Procedures.mutateCallers(this); + } + }, + }; + + this.mixin(mixin, true); +}; +// Using register instead of registerMixin to avoid triggering warnings about +// overriding built-ins. +Extensions.register('procedure_def_var_mixin', procedureDefVarMixin); + +const procedureDefUpdateShapeMixin = { /** * Add or remove the statement block from this function definition. * @param {boolean} hasStatements True if a statement block is needed. @@ -78,6 +387,7 @@ const PROCEDURE_DEF_COMMON = { } this.hasStatements_ = hasStatements; }, + /** * Update the display of parameters for this procedure definition block. * @private @@ -99,6 +409,47 @@ const PROCEDURE_DEF_COMMON = { Events.enable(); } }, + + /** + * Update the display to reflect a newly renamed argument. + * @param {string} oldName The old display name of the argument. + * @param {string} newName The new display name of the argument. + * @private + * @this {Block} + */ + displayRenamedVar_: function(oldName, newName) { + this.updateParams_(); + // Update the mutator's variables if the mutator is open. + if (this.mutator && this.mutator.isVisible()) { + const blocks = this.mutator.workspace_.getAllBlocks(false); + for (let i = 0, block; (block = blocks[i]); i++) { + if (block.type === 'procedures_mutatorarg' && + Names.equals(oldName, block.getFieldValue('NAME'))) { + block.setFieldValue(newName, 'NAME'); + } + } + } + }, +}; +Extensions.registerMixin( + 'procedure_def_update_shape_mixin', procedureDefUpdateShapeMixin); + +/** @this {Block} */ +const procedureDefGetLegalNameHelper = function() { + const nameField = this.getField('NAME'); + nameField.setValue(Procedures.findLegalName('', this)); + nameField.setValidator(Procedures.rename); +}; +Extensions.register( + 'procedure_def_get_legal_name_helper', procedureDefGetLegalNameHelper); + +const procedureDefMutator = { + arguments_: [], + + argumentVarModels_: [], + + hasStatements_: true, + /** * Create XML to represent the argument inputs. * Backwards compatible serialization implementation. @@ -129,6 +480,7 @@ const PROCEDURE_DEF_COMMON = { } return container; }, + /** * Parse XML to restore the argument inputs. * Backwards compatible serialization implementation. @@ -160,6 +512,7 @@ const PROCEDURE_DEF_COMMON = { // Show or hide the statement input. this.setStatements_(xmlElement.getAttribute('statements') !== 'false'); }, + /** * Returns the state of this block as a JSON serializable object. * @return {?{params: (!Array<{name: string, id: string}>|undefined), @@ -187,6 +540,7 @@ const PROCEDURE_DEF_COMMON = { } return state; }, + /** * Applies the given state to this block. * @param {*} state The state to apply to this block, eg the parameters and @@ -208,6 +562,7 @@ const PROCEDURE_DEF_COMMON = { Procedures.mutateCallers(this); this.setStatements_(state['hasStatements'] === false ? false : true); }, + /** * Populate the mutator's dialog with this block's components. * @param {!Workspace} workspace Mutator's workspace. @@ -261,6 +616,7 @@ const PROCEDURE_DEF_COMMON = { Procedures.mutateCallers(this); return containerBlock; }, + /** * Reconfigure this block based on the mutator dialog's components. * @param {!Block} containerBlock Root block in mutator. @@ -309,98 +665,12 @@ const PROCEDURE_DEF_COMMON = { } } }, - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable names. - * @this {Block} - */ - getVars: function() { - return this.arguments_; - }, - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable models. - * @this {Block} - */ - getVarModels: function() { - return this.argumentVarModels_; - }, - /** - * Notification that a variable is renaming. - * If the ID matches one of this block's variables, rename it. - * @param {string} oldId ID of variable to rename. - * @param {string} newId ID of new variable. May be the same as oldId, but - * with an updated name. Guaranteed to be the same type as the old - * variable. - * @override - * @this {Block} - */ - renameVarById: function(oldId, newId) { - const oldVariable = this.workspace.getVariableById(oldId); - if (oldVariable.type !== '') { - // Procedure arguments always have the empty type. - return; - } - const oldName = oldVariable.name; - const newVar = this.workspace.getVariableById(newId); +}; +Extensions.registerMutator( + 'procedure_def_mutator', procedureDefMutator, undefined, + ['procedures_mutatorarg']); - let change = false; - for (let i = 0; i < this.argumentVarModels_.length; i++) { - if (this.argumentVarModels_[i].getId() === oldId) { - this.arguments_[i] = newVar.name; - this.argumentVarModels_[i] = newVar; - change = true; - } - } - if (change) { - this.displayRenamedVar_(oldName, newVar.name); - Procedures.mutateCallers(this); - } - }, - /** - * Notification that a variable is renaming but keeping the same ID. If the - * variable is in use on this block, rerender to show the new name. - * @param {!VariableModel} variable The variable being renamed. - * @package - * @override - * @this {Block} - */ - updateVarName: function(variable) { - const newName = variable.name; - let change = false; - let oldName; - for (let i = 0; i < this.argumentVarModels_.length; i++) { - if (this.argumentVarModels_[i].getId() === variable.getId()) { - oldName = this.arguments_[i]; - this.arguments_[i] = newName; - change = true; - } - } - if (change) { - this.displayRenamedVar_(oldName, newName); - Procedures.mutateCallers(this); - } - }, - /** - * Update the display to reflect a newly renamed argument. - * @param {string} oldName The old display name of the argument. - * @param {string} newName The new display name of the argument. - * @private - * @this {Block} - */ - displayRenamedVar_: function(oldName, newName) { - this.updateParams_(); - // Update the mutator's variables if the mutator is open. - if (this.mutator && this.mutator.isVisible()) { - const blocks = this.mutator.workspace_.getAllBlocks(false); - for (let i = 0, block; (block = blocks[i]); i++) { - if (block.type === 'procedures_mutatorarg' && - Names.equals(oldName, block.getFieldValue('NAME'))) { - block.setFieldValue(newName, 'NAME'); - } - } - } - }, +const procedureDefContextMenuMixin = { /** * Add custom menu options to this block's context menu. * @param {!Array} options List of menu options to add to. @@ -445,36 +715,36 @@ const PROCEDURE_DEF_COMMON = { } }, }; +Extensions.registerMixin( + 'procedure_def_context_menu_mixin', procedureDefContextMenuMixin); -blocks['procedures_defnoreturn'] = { - ...PROCEDURE_DEF_COMMON, - /** - * Block for defining a procedure with no return value. - * @this {Block} - */ - init: function() { - const initName = Procedures.findLegalName('', this); - const nameField = new FieldTextInput(initName, Procedures.rename); - nameField.setSpellcheck(false); - this.appendDummyInput() - .appendField(Msg['PROCEDURES_DEFNORETURN_TITLE']) - .appendField(nameField, 'NAME') - .appendField('', 'PARAMS'); - this.setMutator(new Mutator(['procedures_mutatorarg'], this)); - if ((this.workspace.options.comments || - (this.workspace.options.parentWorkspace && - this.workspace.options.parentWorkspace.options.comments)) && - Msg['PROCEDURES_DEFNORETURN_COMMENT']) { - this.setCommentText(Msg['PROCEDURES_DEFNORETURN_COMMENT']); - } - this.setStyle('procedure_blocks'); - this.setTooltip(Msg['PROCEDURES_DEFNORETURN_TOOLTIP']); - this.setHelpUrl(Msg['PROCEDURES_DEFNORETURN_HELPURL']); - this.arguments_ = []; - this.argumentVarModels_ = []; - this.setStatements_(true); - this.statementConnection_ = null; - }, +/** @this {Block} */ +const procedureDefNoReturnSetCommentHelper = function() { + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Msg['PROCEDURES_DEFNORETURN_COMMENT']) { + this.setCommentText(Msg['PROCEDURES_DEFNORETURN_COMMENT']); + } +}; +Extensions.register( + 'procedure_defnoreturn_set_comment_helper', + procedureDefNoReturnSetCommentHelper); + +/** @this {Block} */ +const procedureDefReturnSetCommentHelper = function() { + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Msg['PROCEDURES_DEFRETURN_COMMENT']) { + this.setCommentText(Msg['PROCEDURES_DEFRETURN_COMMENT']); + } +}; +Extensions.register( + 'procedure_defreturn_set_comment_helper', + procedureDefReturnSetCommentHelper); + +const procedureDefNoReturnGetCallerBlockMixin = { /** * Return the signature of this procedure definition. * @return {!Array} Tuple containing three elements: @@ -486,41 +756,14 @@ blocks['procedures_defnoreturn'] = { getProcedureDef: function() { return [this.getFieldValue('NAME'), this.arguments_, false]; }, + callType_: 'procedures_callnoreturn', }; +Extensions.registerMixin( + 'procedure_defnoreturn_get_caller_block_mixin', + procedureDefNoReturnGetCallerBlockMixin); -blocks['procedures_defreturn'] = { - ...PROCEDURE_DEF_COMMON, - /** - * Block for defining a procedure with a return value. - * @this {Block} - */ - init: function() { - const initName = Procedures.findLegalName('', this); - const nameField = new FieldTextInput(initName, Procedures.rename); - nameField.setSpellcheck(false); - this.appendDummyInput() - .appendField(Msg['PROCEDURES_DEFRETURN_TITLE']) - .appendField(nameField, 'NAME') - .appendField('', 'PARAMS'); - this.appendValueInput('RETURN') - .setAlign(Align.RIGHT) - .appendField(Msg['PROCEDURES_DEFRETURN_RETURN']); - this.setMutator(new Mutator(['procedures_mutatorarg'], this)); - if ((this.workspace.options.comments || - (this.workspace.options.parentWorkspace && - this.workspace.options.parentWorkspace.options.comments)) && - Msg['PROCEDURES_DEFRETURN_COMMENT']) { - this.setCommentText(Msg['PROCEDURES_DEFRETURN_COMMENT']); - } - this.setStyle('procedure_blocks'); - this.setTooltip(Msg['PROCEDURES_DEFRETURN_TOOLTIP']); - this.setHelpUrl(Msg['PROCEDURES_DEFRETURN_HELPURL']); - this.arguments_ = []; - this.argumentVarModels_ = []; - this.setStatements_(true); - this.statementConnection_ = null; - }, +const procedureDefReturnGetCallerBlockMixin = { /** * Return the signature of this procedure definition. * @return {!Array} Tuple containing three elements: @@ -532,64 +775,14 @@ blocks['procedures_defreturn'] = { getProcedureDef: function() { return [this.getFieldValue('NAME'), this.arguments_, true]; }, + callType_: 'procedures_callreturn', }; +Extensions.registerMixin( + 'procedure_defreturn_get_caller_block_mixin', + procedureDefReturnGetCallerBlockMixin); -blocks['procedures_mutatorcontainer'] = { - /** - * Mutator block for procedure container. - * @this {Block} - */ - init: function() { - this.appendDummyInput().appendField( - Msg['PROCEDURES_MUTATORCONTAINER_TITLE']); - this.appendStatementInput('STACK'); - this.appendDummyInput('STATEMENT_INPUT') - .appendField(Msg['PROCEDURES_ALLOW_STATEMENTS']) - .appendField(new FieldCheckbox('TRUE'), 'STATEMENTS'); - this.setStyle('procedure_blocks'); - this.setTooltip(Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']); - this.contextMenu = false; - }, -}; - -blocks['procedures_mutatorarg'] = { - /** - * Mutator block for procedure argument. - * @this {Block} - */ - init: function() { - const field = new FieldTextInput(Procedures.DEFAULT_ARG, this.validator_); - // Hack: override showEditor to do just a little bit more work. - // We don't have a good place to hook into the start of a text edit. - field.oldShowEditorFn_ = field.showEditor_; - /** - * @this {FieldTextInput} - */ - const newShowEditorFn = function() { - this.createdVariables_ = []; - this.oldShowEditorFn_(); - }; - field.showEditor_ = newShowEditorFn; - - this.appendDummyInput() - .appendField(Msg['PROCEDURES_MUTATORARG_TITLE']) - .appendField(field, 'NAME'); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setStyle('procedure_blocks'); - this.setTooltip(Msg['PROCEDURES_MUTATORARG_TOOLTIP']); - this.contextMenu = false; - - // Create the default variable when we drag the block in from the flyout. - // Have to do this after installing the field on the block. - field.onFinishEditing_ = this.deleteIntermediateVars_; - // Create an empty list so onFinishEditing_ has something to look at, even - // though the editor was never opened. - field.createdVariables_ = []; - field.onFinishEditing_('x'); - }, - +const validateProcedureParamMixin = { /** * Obtain a valid name for the procedure argument. Create a variable if * necessary. @@ -648,9 +841,8 @@ blocks['procedures_mutatorarg'] = { * Called when focusing away from the text field. * Deletes all variables that were created as the user typed their intended * variable name. - * @param {string} newText The new variable name. - * @private * @this {FieldTextInput} + * @param {string} newText The new variable name. */ deleteIntermediateVars_: function(newText) { const outerWs = Mutator.findParentWs(this.getSourceBlock().workspace); @@ -665,21 +857,156 @@ blocks['procedures_mutatorarg'] = { } }, }; +Extensions.registerMixin( + 'procedure_mutatorarg_validate_mixin', validateProcedureParamMixin); + +/** @this {Block} */ +const addValidatorToParamFieldHelper = function() { + const nameField = this.getField('NAME'); + + nameField.setValidator(this.validator_); + + // TODO: We can probably just handle this in onFinishedEditing_. + // Hack: override showEditor to do just a little bit more work. + // We don't have a good place to hook into the start of a text edit. + nameField.oldShowEditorFn_ = nameField.showEditor_; + /** @this {FieldTextInput} */ + const newShowEditorFn = function() { + this.createdVariables_ = []; + this.oldShowEditorFn_(); + }; + nameField.showEditor_ = newShowEditorFn; + + nameField.onFinishEditing_ = this.deleteIntermediateVars_; + // Create an empty list so onFinishEditing_ has something to look at, even + // though the editor was never opened. + nameField.createdVariables_ = []; + nameField.onFinishEditing_('x'); +}; +Extensions.register( + 'procedure_mutatorarg_add_validator_helper', + addValidatorToParamFieldHelper); + +/** @this {Block} */ +const procedureCallerGetDefMixin = function() { + const mixin = { + /** + * Returns the name of the procedure this block calls. + * @return {string} Procedure name. + * @this {Block} + */ + getProcedureCall: function() { + // The NAME field is guaranteed to exist, null will never be returned. + return /** @type {string} */ (this.getFieldValue('NAME')); + }, + + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Block} + */ + getVars: function() { + return this.arguments_; + }, + + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Block} + */ + getVarModels: function() { + return this.argumentVarModels_; + }, + }; + + this.mixin(mixin, true); +}; +// Using register instead of registerMixin to avoid triggering warnings about +// overriding built-ins. +Extensions.register( + 'procedure_caller_get_def_mixin', procedureCallerGetDefMixin); + +const procedureCallerMutator = { + arguments_: [], + + argumentVarModels_: [], + + quarkConnections_: {}, + + quarkIds_: null, + + previousEnabledState_: true, -/** - * Common properties for the procedure_callnoreturn and - * procedure_callreturn blocks. - */ -const PROCEDURE_CALL_COMMON = { /** - * Returns the name of the procedure this block calls. - * @return {string} Procedure name. + * Create XML to represent the (non-editable) name and arguments. + * Backwards compatible serialization implementation. + * @return {!Element} XML storage element. * @this {Block} */ - getProcedureCall: function() { - // The NAME field is guaranteed to exist, null will never be returned. - return /** @type {string} */ (this.getFieldValue('NAME')); + mutationToDom: function() { + const container = xmlUtils.createElement('mutation'); + container.setAttribute('name', this.getProcedureCall()); + for (let i = 0; i < this.arguments_.length; i++) { + const parameter = xmlUtils.createElement('arg'); + parameter.setAttribute('name', this.arguments_[i]); + container.appendChild(parameter); + } + return container; }, + + /** + * Parse XML to restore the (non-editable) name and parameters. + * Backwards compatible serialization implementation. + * @param {!Element} xmlElement XML storage element. + * @this {Block} + */ + domToMutation: function(xmlElement) { + const name = xmlElement.getAttribute('name'); + this.renameProcedure(this.getProcedureCall(), name); + const args = []; + const paramIds = []; + for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { + if (childNode.nodeName.toLowerCase() === 'arg') { + args.push(childNode.getAttribute('name')); + paramIds.push(childNode.getAttribute('paramId')); + } + } + this.setProcedureParameters_(args, paramIds); + }, + + /** + * Returns the state of this block as a JSON serializable object. + * @return {{name: string, params:(!Array|undefined)}} The state of + * this block, ie the params and procedure name. + */ + saveExtraState: function() { + const state = Object.create(null); + state['name'] = this.getProcedureCall(); + if (this.arguments_.length) { + state['params'] = this.arguments_; + } + return state; + }, + + /** + * Applies the given state to this block. + * @param {*} state The state to apply to this block, ie the params and + * procedure name. + */ + loadExtraState: function(state) { + this.renameProcedure(this.getProcedureCall(), state['name']); + const params = state['params']; + if (params) { + const ids = []; + ids.length = params.length; + ids.fill(null); + this.setProcedureParameters_(params, ids); + } + }, +}; +Extensions.registerMutator('procedure_caller_mutator', procedureCallerMutator); + +const procedureCallerUpdateShapeMixin = { /** * Notification that a procedure is renaming. * If the name matches this block's procedure, rename it. @@ -696,6 +1023,7 @@ const PROCEDURE_CALL_COMMON = { this.setTooltip(baseMsg.replace('%1', newName)); } }, + /** * Notification that the procedure's parameters have changed. * @param {!Array} paramNames New param names, e.g. ['x', 'y', 'z']. @@ -790,6 +1118,7 @@ const PROCEDURE_CALL_COMMON = { this.render(); } }, + /** * Modify this block to have the correct number of arguments. * @private @@ -836,85 +1165,11 @@ const PROCEDURE_CALL_COMMON = { } } }, - /** - * Create XML to represent the (non-editable) name and arguments. - * Backwards compatible serialization implementation. - * @return {!Element} XML storage element. - * @this {Block} - */ - mutationToDom: function() { - const container = xmlUtils.createElement('mutation'); - container.setAttribute('name', this.getProcedureCall()); - for (let i = 0; i < this.arguments_.length; i++) { - const parameter = xmlUtils.createElement('arg'); - parameter.setAttribute('name', this.arguments_[i]); - container.appendChild(parameter); - } - return container; - }, - /** - * Parse XML to restore the (non-editable) name and parameters. - * Backwards compatible serialization implementation. - * @param {!Element} xmlElement XML storage element. - * @this {Block} - */ - domToMutation: function(xmlElement) { - const name = xmlElement.getAttribute('name'); - this.renameProcedure(this.getProcedureCall(), name); - const args = []; - const paramIds = []; - for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { - if (childNode.nodeName.toLowerCase() === 'arg') { - args.push(childNode.getAttribute('name')); - paramIds.push(childNode.getAttribute('paramId')); - } - } - this.setProcedureParameters_(args, paramIds); - }, - /** - * Returns the state of this block as a JSON serializable object. - * @return {{name: string, params:(!Array|undefined)}} The state of - * this block, ie the params and procedure name. - */ - saveExtraState: function() { - const state = Object.create(null); - state['name'] = this.getProcedureCall(); - if (this.arguments_.length) { - state['params'] = this.arguments_; - } - return state; - }, - /** - * Applies the given state to this block. - * @param {*} state The state to apply to this block, ie the params and - * procedure name. - */ - loadExtraState: function(state) { - this.renameProcedure(this.getProcedureCall(), state['name']); - const params = state['params']; - if (params) { - const ids = []; - ids.length = params.length; - ids.fill(null); - this.setProcedureParameters_(params, ids); - } - }, - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable names. - * @this {Block} - */ - getVars: function() { - return this.arguments_; - }, - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable models. - * @this {Block} - */ - getVarModels: function() { - return this.argumentVarModels_; - }, +}; +Extensions.registerMixin( + 'procedure_caller_update_shape_mixin', procedureCallerUpdateShapeMixin); + +const procedureCallerOnChangeMixin = { /** * Procedure calls cannot exist without the corresponding procedure * definition. Enforce this link whenever an event is fired. @@ -979,7 +1234,7 @@ const PROCEDURE_CALL_COMMON = { Xml.domToWorkspace(xml, this.workspace); Events.setGroup(false); } - } else if (event.type === Events.BLOCK_DELETE) { + } else if (event.type === Events.BLOCK_DELETE && event.blockId != this.id) { // Look for the case where a procedure definition has been deleted, // leaving this block (a procedure call) orphaned. In this case, delete // the orphan. @@ -1015,6 +1270,11 @@ const PROCEDURE_CALL_COMMON = { } } }, +}; +Extensions.registerMixin( + 'procedure_caller_onchange_mixin', procedureCallerOnChangeMixin); + +const procedureCallerContextMenuMixin = { /** * Add menu option to find the definition block for this call. * @param {!Array} options List of menu options to add to. @@ -1041,71 +1301,26 @@ const PROCEDURE_CALL_COMMON = { options.push(option); }, }; +Extensions.registerMixin( + 'procedure_caller_context_menu_mixin', procedureCallerContextMenuMixin); -blocks['procedures_callnoreturn'] = { - ...PROCEDURE_CALL_COMMON, - /** - * Block for calling a procedure with no return value. - * @this {Block} - */ - init: function() { - this.appendDummyInput('TOPROW').appendField('', 'NAME'); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setStyle('procedure_blocks'); - // Tooltip is set in renameProcedure. - this.setHelpUrl(Msg['PROCEDURES_CALLNORETURN_HELPURL']); - this.arguments_ = []; - this.argumentVarModels_ = []; - this.quarkConnections_ = {}; - this.quarkIds_ = null; - this.previousEnabledState_ = true; - }, - +const procedureCallerNoReturnGetDefBlockMixin = { defType_: 'procedures_defnoreturn', }; +Extensions.registerMixin( + 'procedure_callernoreturn_get_def_block_mixin', + procedureCallerNoReturnGetDefBlockMixin); -blocks['procedures_callreturn'] = { - ...PROCEDURE_CALL_COMMON, - /** - * Block for calling a procedure with a return value. - * @this {Block} - */ - init: function() { - this.appendDummyInput('TOPROW').appendField('', 'NAME'); - this.setOutput(true); - this.setStyle('procedure_blocks'); - // Tooltip is set in domToMutation. - this.setHelpUrl(Msg['PROCEDURES_CALLRETURN_HELPURL']); - this.arguments_ = []; - this.argumentVarModels_ = []; - this.quarkConnections_ = {}; - this.quarkIds_ = null; - this.previousEnabledState_ = true; - }, - +const procedureCallerReturnGetDefBlockMixin = { defType_: 'procedures_defreturn', }; +Extensions.registerMixin( + 'procedure_callerreturn_get_def_block_mixin', + procedureCallerReturnGetDefBlockMixin); + +const procedureIfReturnMutator = { + hasReturnValue_: true, -blocks['procedures_ifreturn'] = { - /** - * Block for conditionally returning a value from a procedure. - * @this {Block} - */ - init: function() { - this.appendValueInput('CONDITION') - .setCheck('Boolean') - .appendField(Msg['CONTROLS_IF_MSG_IF']); - this.appendValueInput('VALUE').appendField( - Msg['PROCEDURES_DEFRETURN_RETURN']); - this.setInputsInline(true); - this.setPreviousStatement(true); - this.setNextStatement(true); - this.setStyle('procedure_blocks'); - this.setTooltip(Msg['PROCEDURES_IFRETURN_TOOLTIP']); - this.setHelpUrl(Msg['PROCEDURES_IFRETURN_HELPURL']); - this.hasReturnValue_ = true; - }, /** * Create XML to represent whether this block has a return value. * @return {!Element} XML storage element. @@ -1116,6 +1331,7 @@ blocks['procedures_ifreturn'] = { container.setAttribute('value', Number(this.hasReturnValue_)); return container; }, + /** * Parse XML to restore whether this block has a return value. * @param {!Element} xmlElement XML storage element. @@ -1135,7 +1351,12 @@ blocks['procedures_ifreturn'] = { // loadExtraState) because the state of this block is already encoded in the // block's position in the workspace. // XML hooks are kept for backwards compatibility. +}; +Extensions.registerMutator( + 'procedure_ifreturn_mutator', procedureIfReturnMutator); + +const procedureIfReturnOnChangeMixin = { /** * Called whenever anything on the workspace changes. * Add warning if this flow block is not nested inside a loop. @@ -1183,6 +1404,12 @@ blocks['procedures_ifreturn'] = { Events.setGroup(group); } }, +}; + +Extensions.registerMixin( + 'procedure_ifreturn_onchange_mixin', procedureIfReturnOnChangeMixin); + +const procedureIfReturnFunctionTypesMixin = { /** * List of block types that are functions and thus do not need warnings. * To add a new function type add this to your code: @@ -1191,5 +1418,9 @@ blocks['procedures_ifreturn'] = { FUNCTION_TYPES: ['procedures_defnoreturn', 'procedures_defreturn'], }; +Extensions.registerMixin( + 'procedure_ifreturn_function_types_mixin', + procedureIfReturnFunctionTypesMixin); + // Register provided blocks. defineBlocks(blocks); From 5d20b6233949d3d65aeac30de8a6536b913916fb Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 5 Jan 2023 22:31:20 +0000 Subject: [PATCH 014/141] feat: procedure blocks update models (#6672) * feat: procedure blocks have models * feat: add updating the name of the model * feat: add procedure defs updating the model enabled state * feat: add procedure blocks updating parameters in the model * fix: add disposing of the procedure model * chore: updates test to check for identity of parameters * chore: move statement handling into setStatement * fix: make parameter IDs consistent * chore: un-only tests * chore: fixup tests * chore: revert validator to use Procedures.rename * chore: cleanup typo --- blocks/procedures.js | 153 +++++++----- core/interfaces/i_procedure_block.ts | 2 + core/procedures.ts | 2 + core/procedures/observable_parameter_model.ts | 2 + core/procedures/observable_procedure_model.ts | 2 + tests/mocha/blocks/procedures_test.js | 228 +++++------------- 6 files changed, 167 insertions(+), 222 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index eb0b4fe54..5b089d9e0 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -28,12 +28,15 @@ const {Block} = goog.requireType('Blockly.Block'); // TODO (6248): Properly import the BlockDefinition type. /* eslint-disable-next-line no-unused-vars */ const BlockDefinition = Object; +const {ObservableProcedureModel} = goog.require('Blockly.procedures.ObservableProcedureModel'); +const {ObservableParameterModel} = goog.require('Blockly.procedures.ObservableParameterModel'); const {config} = goog.require('Blockly.config'); /* eslint-disable-next-line no-unused-vars */ const {FieldLabel} = goog.require('Blockly.FieldLabel'); const {Msg} = goog.require('Blockly.Msg'); const {Mutator} = goog.require('Blockly.Mutator'); const {Names} = goog.require('Blockly.Names'); +const serialization = goog.require('Blockly.serialization'); /* eslint-disable-next-line no-unused-vars */ const {VariableModel} = goog.requireType('Blockly.VariableModel'); /* eslint-disable-next-line no-unused-vars */ @@ -85,7 +88,8 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'procedure_def_var_mixin', 'procedure_def_update_shape_mixin', 'procedure_def_context_menu_mixin', - 'procedure_def_get_legal_name_helper', + 'procedure_def_onchange_mixin', + 'procedure_def_validator_helper', 'procedure_defnoreturn_get_caller_block_mixin', 'procedure_defnoreturn_set_comment_helper', ], @@ -160,7 +164,8 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'procedure_def_var_mixin', 'procedure_def_update_shape_mixin', 'procedure_def_context_menu_mixin', - 'procedure_def_get_legal_name_helper', + 'procedure_def_onchange_mixin', + 'procedure_def_validator_helper', 'procedure_defreturn_get_caller_block_mixin', 'procedure_defreturn_set_comment_helper', ], @@ -274,6 +279,12 @@ exports.blocks = blocks; /** @this {Block} */ const procedureDefGetDefMixin = function() { const mixin = { + model: null, + + getProcedureModel() { + return this.model; + }, + /** * Return all variables referenced by this block. * @return {!Array} List of variable names. @@ -282,6 +293,7 @@ const procedureDefGetDefMixin = function() { getVars: function() { return this.arguments_; }, + /** * Return all variables referenced by this block. * @return {!Array} List of variable models. @@ -290,8 +302,20 @@ const procedureDefGetDefMixin = function() { getVarModels: function() { return this.argumentVarModels_; }, + + /** + * Disposes of the data model for this procedure block when the block is + * disposed. + */ + destroy: function() { + this.workspace.getProcedureMap().delete(this.getProcedureModel().getId()); + }, }; + mixin.model = new ObservableProcedureModel( + this.workspace, this.getFieldValue('NAME')); + this.workspace.getProcedureMap().add(mixin.model); + this.mixin(mixin, true); }; // Using register instead of registerMixin to avoid triggering warnings about @@ -382,7 +406,18 @@ const procedureDefUpdateShapeMixin = { if (this.getInput('RETURN')) { this.moveInputBefore('STACK', 'RETURN'); } + // Restore the stack, if one was saved. + Mutator.reconnect(this.statementConnection_, this, 'STACK'); + this.statementConnection_ = null; } else { + // Save the stack, then disconnect it. + const stackConnection = this.getInput('STACK').connection; + this.statementConnection_ = stackConnection.targetConnection; + if (this.statementConnection_) { + const stackBlock = stackConnection.targetBlock(); + stackBlock.unplug(); + stackBlock.bumpNeighbours(); + } this.removeInput('STACK', true); } this.hasStatements_ = hasStatements; @@ -435,13 +470,13 @@ Extensions.registerMixin( 'procedure_def_update_shape_mixin', procedureDefUpdateShapeMixin); /** @this {Block} */ -const procedureDefGetLegalNameHelper = function() { +const procedureDefValidatorHelper = function() { const nameField = this.getField('NAME'); nameField.setValue(Procedures.findLegalName('', this)); nameField.setValidator(Procedures.rename); }; Extensions.register( - 'procedure_def_get_legal_name_helper', procedureDefGetLegalNameHelper); + 'procedure_def_validator_helper', procedureDefValidatorHelper); const procedureDefMutator = { arguments_: [], @@ -570,41 +605,29 @@ const procedureDefMutator = { * @this {Block} */ decompose: function(workspace) { - /* - * Creates the following XML: - * - * - * - * arg1_name - * etc... - * - * - * - */ + const containerBlockDef = { + 'type': 'procedures_mutatorcontainer', + 'inputs': { + 'STACK': {}, + }, + }; - const containerBlockNode = xmlUtils.createElement('block'); - containerBlockNode.setAttribute('type', 'procedures_mutatorcontainer'); - const statementNode = xmlUtils.createElement('statement'); - statementNode.setAttribute('name', 'STACK'); - containerBlockNode.appendChild(statementNode); - - let node = statementNode; - for (let i = 0; i < this.arguments_.length; i++) { - const argBlockNode = xmlUtils.createElement('block'); - argBlockNode.setAttribute('type', 'procedures_mutatorarg'); - const fieldNode = xmlUtils.createElement('field'); - fieldNode.setAttribute('name', 'NAME'); - const argumentName = xmlUtils.createTextNode(this.arguments_[i]); - fieldNode.appendChild(argumentName); - argBlockNode.appendChild(fieldNode); - const nextNode = xmlUtils.createElement('next'); - argBlockNode.appendChild(nextNode); - - node.appendChild(argBlockNode); - node = nextNode; + let connDef = containerBlockDef['inputs']['STACK']; + for (const param of this.getProcedureModel().getParameters()) { + connDef['block'] = { + 'type': 'procedures_mutatorarg', + 'id': param.getId(), + 'fields': { + 'NAME': param.getName(), + }, + 'next': {}, + }; + connDef = connDef['block']['next']; } - - const containerBlock = Xml.domToBlock(containerBlockNode, workspace); + + const containerBlock = + serialization.blocks.append( + containerBlockDef, workspace, {recordUndo: false}); if (this.type === 'procedures_defreturn') { containerBlock.setFieldValue(this.hasStatements_, 'STATEMENTS'); @@ -612,8 +635,9 @@ const procedureDefMutator = { containerBlock.removeInput('STATEMENT_INPUT'); } - // Initialize procedure's callers with blank IDs. + // Update callers (called for backwards compatibility). Procedures.mutateCallers(this); + return containerBlock; }, @@ -627,11 +651,14 @@ const procedureDefMutator = { this.arguments_ = []; this.paramIds_ = []; this.argumentVarModels_ = []; + + // TODO: Remove old data handling logic? let paramBlock = containerBlock.getInputTargetBlock('STACK'); while (paramBlock && !paramBlock.isInsertionMarker()) { const varName = paramBlock.getFieldValue('NAME'); this.arguments_.push(varName); - const variable = this.workspace.getVariable(varName, ''); + const variable = Variables.getOrCreateVariablePackage( + this.workspace, null, varName, ''); this.argumentVarModels_.push(variable); this.paramIds_.push(paramBlock.id); @@ -640,29 +667,25 @@ const procedureDefMutator = { } this.updateParams_(); Procedures.mutateCallers(this); + for (let i = this.model.getParameters().length; i >= 0; i--) { + this.model.deleteParameter(i); + } - // Show/hide the statement input. - let hasStatements = containerBlock.getFieldValue('STATEMENTS'); + let i = 0; + paramBlock = containerBlock.getInputTargetBlock('STACK'); + while (paramBlock && !paramBlock.isInsertionMarker()) { + this.model.insertParameter( + new ObservableParameterModel( + this.workspace, paramBlock.getFieldValue('NAME'), paramBlock.id), + i); + paramBlock = + paramBlock.nextConnection && paramBlock.nextConnection.targetBlock(); + i++; + } + + const hasStatements = containerBlock.getFieldValue('STATEMENTS'); if (hasStatements !== null) { - hasStatements = hasStatements === 'TRUE'; - if (this.hasStatements_ !== hasStatements) { - if (hasStatements) { - this.setStatements_(true); - // Restore the stack, if one was saved. - Mutator.reconnect(this.statementConnection_, this, 'STACK'); - this.statementConnection_ = null; - } else { - // Save the stack, then disconnect it. - const stackConnection = this.getInput('STACK').connection; - this.statementConnection_ = stackConnection.targetConnection; - if (this.statementConnection_) { - const stackBlock = stackConnection.targetBlock(); - stackBlock.unplug(); - stackBlock.bumpNeighbours(); - } - this.setStatements_(false); - } - } + this.setStatements_(hasStatements === 'TRUE'); } }, }; @@ -718,6 +741,16 @@ const procedureDefContextMenuMixin = { Extensions.registerMixin( 'procedure_def_context_menu_mixin', procedureDefContextMenuMixin); +const procedureDefOnChangeMixin = { + onchange: function(e) { + if (e.type === Events.BLOCK_CHANGE && e.element == 'disabled') { + this.model.setEnabled(!e.newValue); + } + }, +}; +Extensions.registerMixin( + 'procedure_def_onchange_mixin', procedureDefOnChangeMixin); + /** @this {Block} */ const procedureDefNoReturnSetCommentHelper = function() { if ((this.workspace.options.comments || diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts index 57318ba85..bddabee6d 100644 --- a/core/interfaces/i_procedure_block.ts +++ b/core/interfaces/i_procedure_block.ts @@ -5,11 +5,13 @@ */ import type {Block} from '../block.js'; +import {IProcedureModel} from './i_procedure_model.js'; /** The interface for a block which models a procedure. */ export interface IProcedureBlock { doProcedureUpdate(): void; + getProcedureModel(): IProcedureModel; } /** A type guard which checks if the given block is a procedure block. */ diff --git a/core/procedures.ts b/core/procedures.ts index e31d77d31..ef7e32062 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -23,6 +23,7 @@ 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 {Field, UnattachedFieldError} from './field.js'; +import {isProcedureBlock} from './interfaces/i_procedure_block.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; import {ObservableProcedureMap} from './procedures/observable_procedure_map.js'; @@ -192,6 +193,7 @@ export function rename(this: Field, name: string): string { name = name.trim(); const legalName = findLegalName(name, block); + if (isProcedureBlock(block)) block.getProcedureModel().setName(legalName); const oldName = this.getValue(); if (oldName !== name && oldName !== legalName) { // Rename any callers. diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 95261d748..8b0fd5309 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -11,6 +11,8 @@ import type {IProcedureModel} from '../interfaces/i_procedure_model'; import {triggerProceduresUpdate} from './update_procedures.js'; import type {VariableModel} from '../variable_model.js'; import type {Workspace} from '../workspace.js'; +import * as goog from '../../closure/goog/goog.js'; +goog.declareModuleId('Blockly.procedures.ObservableParameterModel'); export class ObservableParameterModel implements IParameterModel { diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index 9b44496ea..d7b4f1ad9 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -11,6 +11,8 @@ import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; import {isObservable} from '../interfaces/i_observable.js'; import {triggerProceduresUpdate} from './update_procedures.js'; import type {Workspace} from '../workspace.js'; +import * as goog from '../../closure/goog/goog.js'; +goog.declareModuleId('Blockly.procedures.ObservableProcedureModel'); export class ObservableProcedureModel implements IProcedureModel { diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 5f046402d..9921bb3cc 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -27,8 +27,8 @@ suite('Procedures', function() { sharedTestTeardown.call(this); }); - suite.skip('updating data models', function() { - test( + suite('updating data models', function() { + test.skip( 'renaming a procedure def block updates the procedure model', function() { const defBlock = createProcDefBlock(this.workspace); @@ -58,9 +58,11 @@ suite('Procedures', function() { function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); const containerBlock = - this.workspace.newBlock('procedures_mutatorcontainer'); - const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock.setFieldValue('param name', 'NAME'); containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); @@ -75,9 +77,11 @@ suite('Procedures', function() { test('adding a parameter adds a variable to the variable map', function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); const containerBlock = - this.workspace.newBlock('procedures_mutatorcontainer'); - const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock.setFieldValue('param name', 'NAME'); containerBlock.getInput('STACK').connection .connect(paramBlock.previousConnection); @@ -85,7 +89,7 @@ suite('Procedures', function() { defBlock.compose(containerBlock); chai.assert.isTrue( - this.workspace.getVariableMap().getVariables('') + this.workspace.getVariableMap().getVariablesOfType('') .some((variable) => variable.name === 'param name'), 'Expected the variable map to have a matching variable'); }); @@ -96,16 +100,20 @@ suite('Procedures', function() { function() { // Create a stack of container, param1, param2. const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); const containerBlock = - this.workspace.newBlock('procedures_mutatorcontainer'); - const paramBlock1 = this.workspace.newBlock('procedures_mutatorarg'); + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock1.setFieldValue('param name1', 'NAME'); - const paramBlock2 = this.workspace.newBlock('procedures_mutatorarg'); + const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock2.setFieldValue('param name2', 'NAME'); containerBlock.getInput('STACK').connection .connect(paramBlock1.previousConnection); paramBlock1.nextConnection.connect(paramBlock2.previousConnection); defBlock.compose(containerBlock); + const id1 = defBlock.getProcedureModel().getParameter(0).getId(); + const id2 = defBlock.getProcedureModel().getParameter(1).getId(); // Reconfigure the stack to be container, param2, param1. paramBlock2.previousConnection.disconnect(); @@ -119,20 +127,57 @@ suite('Procedures', function() { defBlock.getProcedureModel().getParameter(0).getName(), 'param name2', 'Expected the first parameter of the procedure to be param 2'); + chai.assert.equal( + defBlock.getProcedureModel().getParameter(0).getId(), + id2, + 'Expected the first parameter of the procedure to be param 2'); chai.assert.equal( defBlock.getProcedureModel().getParameter(1).getName(), - 'param name2', + 'param name1', + 'Expected the second parameter of the procedure to be param 1'); + chai.assert.equal( + defBlock.getProcedureModel().getParameter(1).getId(), + id1, 'Expected the second parameter of the procedure to be param 1'); }); + test('decomposing and recomposing maintains parameter IDs', function() { + // Create a stack of container, param. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + defBlock.compose(containerBlock); + const paramBlockId = defBlock.getProcedureModel().getParameter(0).getId(); + + Blockly.Events.disable(); + mutatorWorkspace.clear(); + Blockly.Events.enable(); + const container = defBlock.decompose(mutatorWorkspace); + defBlock.compose(container); + + chai.assert.equal( + defBlock.getProcedureModel().getParameter(0).getId(), + paramBlockId, + 'Expected the parameter ID to be maintained'); + }); + test( 'deleting a parameter from a procedure def updates the procedure model', function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); const containerBlock = - this.workspace.newBlock('procedures_mutatorcontainer'); - const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param name', 'NAME'); containerBlock.getInput('STACK').connection .connect(paramBlock.previousConnection); defBlock.compose(containerBlock); @@ -148,9 +193,11 @@ suite('Procedures', function() { test('renaming a procedure parameter updates the parameter model', function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); const containerBlock = - this.workspace.newBlock('procedures_mutatorcontainer'); - const paramBlock = this.workspace.newBlock('procedures_mutatorarg'); + mutatorWorkspace.newBlock('procedures_mutatorcontainer'); + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock.setFieldValue('param name', 'NAME'); containerBlock.getInput('STACK').connection .connect(paramBlock.previousConnection); @@ -159,9 +206,10 @@ suite('Procedures', function() { paramBlock.setFieldValue('new param name', 'NAME'); defBlock.compose(containerBlock); - chai.assert.isEmpty( - defBlock.getProcedureModel().getParameters(), - 'Expected the procedure model to have no parameters'); + chai.assert.equal( + defBlock.getProcedureModel().getParameter(0).getName(), + 'new param name', + 'Expected the procedure model to have a matching parameter'); }); test('deleting a procedure deletes the procedure model', function() { @@ -1399,123 +1447,6 @@ suite('Procedures', function() { }); }); - suite('Enable/Disable', function() { - setup(function() { - const toolbox = document.getElementById('toolbox-categories'); - this.workspaceSvg = Blockly.inject('blocklyDiv', {toolbox: toolbox}); - }); - teardown(function() { - workspaceTeardown.call(this, this.workspaceSvg); - }); - const domText = (testSuite.defType === 'procedures_defreturn') ? - ('' + - '' + - 'bar' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '') : - ('' + - '' + - 'bar' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - ''); - setup(function() { - const dom = Blockly.Xml.textToDom(domText); - - Blockly.Xml.appendDomToWorkspace(dom, this.workspaceSvg); - this.barDef = this.workspaceSvg.getBlockById('bar-def'); - this.barCalls = [ - this.workspaceSvg.getBlockById('bar-c1'), - this.workspaceSvg.getBlockById('bar-c2'), - ]; - }); - - test('Set disabled updates callers', function() { - this.workspaceSvg.clearUndo(); - Blockly.Events.setGroup('g1'); - this.barDef.setEnabled(false); - Blockly.Events.setGroup(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isFalse(this.barCalls[i].isEnabled(), - 'Callers are disabled when their definition is disabled (call ' + - i + ')'); - } - const firedEvents = this.workspaceSvg.undoStack_; - chai.assert.equal(firedEvents.length, 3, - 'An event was fired for the definition and each caller'); - for (let i = 0; i < 3; i++) { - chai.assert.equal(firedEvents[i].group, 'g1', - 'Disable events are in the same group (event ' + i + ')'); - } - - this.workspaceSvg.clearUndo(); - Blockly.Events.setGroup('g2'); - this.barDef.setEnabled(true); - Blockly.Events.setGroup(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isTrue(this.barCalls[i].isEnabled(), - 'Callers are enabled when their definition is enabled (call ' + - i + ')'); - } - chai.assert.equal(firedEvents.length, 3, - 'An event was fired for the definition and each caller'); - for (let i = 0; i < 3; i++) { - chai.assert.equal(firedEvents[i].group, 'g2', - 'Enable events are in the same group (event ' + i + ')'); - } - }); - test('Set disabled updates callers while remembering old caller state', function() { - this.barCalls[0].setEnabled(false); - this.workspaceSvg.clearUndo(); - Blockly.Events.setGroup('g1'); - this.barDef.setEnabled(false); - Blockly.Events.setGroup(false); - - for (let i = 0; i < 2; i++) { - chai.assert.isFalse(this.barCalls[i].isEnabled(), - 'Callers are disabled when their definition is disabled (call ' + - i + ')'); - } - const firedEvents = this.workspaceSvg.undoStack_; - chai.assert.equal(firedEvents.length, 2, - 'An event was fired for the definition and the enabled caller'); - for (let i = 0; i < 2; i++) { - chai.assert.equal(firedEvents[i].group, 'g1', - 'Disable events are in the same group (event ' + i + ')'); - } - - this.workspaceSvg.clearUndo(); - Blockly.Events.setGroup('g2'); - this.barDef.setEnabled(true); - Blockly.Events.setGroup(false); - - chai.assert.isFalse(this.barCalls[0].isEnabled(), - 'Caller remains in disabled state when the definition is enabled'); - chai.assert.isTrue(this.barCalls[1].isEnabled(), - 'Caller returns to previous enabled state when the definition is enabled'); - chai.assert.equal(firedEvents.length, 2, - 'An event was fired for the definition and the enabled caller'); - for (let i = 0; i < 2; i++) { - chai.assert.equal(firedEvents[i].group, 'g2', - 'Enable events are in the same group (event ' + i + ')'); - } - }); - }); suite('Mutation', function() { setup(function() { this.defBlock = this.workspace.newBlock(testSuite.defType); @@ -1701,33 +1632,6 @@ suite('Procedures', function() { }); } }); - suite('Untyped Arguments', function() { - function assertArguments(argumentsArray) { - this.defBlock.arguments_ = argumentsArray; - const mutatorWorkspace = new Blockly.Workspace( - new Blockly.Options({ - parentWorkspace: this.workspace, - })); - this.defBlock.decompose(mutatorWorkspace); - const argBlocks = mutatorWorkspace.getBlocksByType('procedures_mutatorarg'); - chai.assert.equal(argBlocks.length, argumentsArray.length); - - for (let i = 0; i < argumentsArray.length; i++) { - const argString = argumentsArray[i]; - const argBlockValue = argBlocks[i].getFieldValue('NAME'); - chai.assert.equal(argBlockValue, argString); - } - } - test('Simple Single Arg', function() { - assertArguments.call(this, ['arg']); - }); - test('Multiple Args', function() { - assertArguments.call(this, ['arg1', 'arg2']); - }); - test('<>', function() { - assertArguments.call(this, ['<>']); - }); - }); }); }); /** From faf5a08c906705410f8f05bae559a5b5bd533d4d Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 5 Jan 2023 23:11:37 +0000 Subject: [PATCH 015/141] feat: procedure def blocks respond to models (#6673) * feat: make procedure def blocks respond to model updates * chore: format * chore: unskip tests --- blocks/procedures.js | 42 ++++++++++++++++++++++----- tests/mocha/blocks/procedures_test.js | 13 +++++---- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 5b089d9e0..5bc876b7f 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -312,8 +312,8 @@ const procedureDefGetDefMixin = function() { }, }; - mixin.model = new ObservableProcedureModel( - this.workspace, this.getFieldValue('NAME')); + mixin.model = + new ObservableProcedureModel(this.workspace, this.getFieldValue('NAME')); this.workspace.getProcedureMap().add(mixin.model); this.mixin(mixin, true); @@ -391,6 +391,34 @@ const procedureDefVarMixin = function() { Extensions.register('procedure_def_var_mixin', procedureDefVarMixin); const procedureDefUpdateShapeMixin = { + /** + * Updates the block to reflect the state of the procedure model. + */ + doProcedureUpdate: function() { + this.setFieldValue(this.model.getName(), 'NAME'); + this.setEnabled(this.model.getEnabled()); + this.updateParameters_(); + }, + + /** + * Updates the parameters field to reflect the parameters in the procedure + * model. + */ + updateParameters_: function() { + const params = this.model.getParameters().map((p) => p.getName()); + const paramString = params.length ? + `${Msg['PROCEDURES_BEFORE_PARAMS']} ${params.join(', ')}` : + ''; + + // The field is deterministic based on other events, no need to fire. + Events.disable(); + try { + this.setFieldValue(paramString, 'PARAMS'); + } finally { + Events.enable(); + } + }, + /** * Add or remove the statement block from this function definition. * @param {boolean} hasStatements True if a statement block is needed. @@ -624,10 +652,9 @@ const procedureDefMutator = { }; connDef = connDef['block']['next']; } - - const containerBlock = - serialization.blocks.append( - containerBlockDef, workspace, {recordUndo: false}); + + const containerBlock = serialization.blocks.append( + containerBlockDef, workspace, {recordUndo: false}); if (this.type === 'procedures_defreturn') { containerBlock.setFieldValue(this.hasStatements_, 'STATEMENTS'); @@ -743,7 +770,8 @@ Extensions.registerMixin( const procedureDefOnChangeMixin = { onchange: function(e) { - if (e.type === Events.BLOCK_CHANGE && e.element == 'disabled') { + if (e.type === Events.BLOCK_CHANGE && e.blockId === this.id && + e.element == 'disabled') { this.model.setEnabled(!e.newValue); } }, diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 9921bb3cc..a967e7e24 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -28,7 +28,7 @@ suite('Procedures', function() { }); suite('updating data models', function() { - test.skip( + test( 'renaming a procedure def block updates the procedure model', function() { const defBlock = createProcDefBlock(this.workspace); @@ -223,7 +223,7 @@ suite('Procedures', function() { }); }); - suite.skip('responding to data model updates', function() { + suite('responding to data model updates', function() { suite('def blocks', function() { test('renaming the procedure data model updates blocks', function() { const defBlock = createProcDefBlock(this.workspace); @@ -244,7 +244,7 @@ suite('Procedures', function() { procModel.setEnabled(false); chai.assert.isFalse( - defBlock.getEnabled(), + defBlock.isEnabled(), 'Expected the procedure block to be disabled'); }); @@ -329,7 +329,7 @@ suite('Procedures', function() { }); }); - suite('caller blocks', function() { + suite.skip('caller blocks', function() { test('renaming the procedure data model updates blocks', function() { const defBlock = createProcDefBlock(this.workspace); const callBlock = createProcCallBlock(this.workspace); @@ -947,7 +947,7 @@ suite('Procedures', function() { }); }); - suite('Multiple block serialization', function() { + suite.skip('Multiple block serialization', function() { function assertDefAndCallBlocks(workspace, noReturnNames, returnNames, hasCallers) { const allProcedures = Blockly.Procedures.allProcedures(workspace); const defNoReturnBlocks = allProcedures[0]; @@ -1670,6 +1670,7 @@ suite('Procedures', function() { }, { title: 'With vars definition', + skip: true, xml: '\n' + ' \n' + @@ -1695,6 +1696,7 @@ suite('Procedures', function() { }, { title: 'With pre-created vars definition', + skip: true, xml: '\n' + ' \n' + @@ -1718,6 +1720,7 @@ suite('Procedures', function() { }, { title: 'With pre-created typed vars definition', + skip: true, xml: '\n' + ' \n' + From dee3951541cb099777be16df5243b6f5e27c4b9b Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 5 Jan 2023 23:19:17 +0000 Subject: [PATCH 016/141] feat: procedure defs deserialize models (#6706) * feat: add procedure defs deserializing models * chore: rename model to model_ * chore: cleanup * chore: fix tests failures * fix: PR comments --- blocks/procedures.js | 69 ++++- core/procedures/observable_parameter_model.ts | 4 +- tests/mocha/blocks/procedures_test.js | 250 ++++++++++++++++++ 3 files changed, 309 insertions(+), 14 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 5bc876b7f..565bdf058 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -92,6 +92,7 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'procedure_def_validator_helper', 'procedure_defnoreturn_get_caller_block_mixin', 'procedure_defnoreturn_set_comment_helper', + 'procedure_def_set_no_return_helper', ], 'mutator': 'procedure_def_mutator', }, @@ -168,6 +169,7 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'procedure_def_validator_helper', 'procedure_defreturn_get_caller_block_mixin', 'procedure_defreturn_set_comment_helper', + 'procedure_def_set_return_helper', ], 'mutator': 'procedure_def_mutator', }, @@ -279,10 +281,15 @@ exports.blocks = blocks; /** @this {Block} */ const procedureDefGetDefMixin = function() { const mixin = { - model: null, + model_: null, + /** + * Returns the data model for this procedure block. + * @return {!IProcedureModel} The data model for this procedure + * block. + */ getProcedureModel() { - return this.model; + return this.model_; }, /** @@ -312,9 +319,9 @@ const procedureDefGetDefMixin = function() { }, }; - mixin.model = + mixin.model_ = new ObservableProcedureModel(this.workspace, this.getFieldValue('NAME')); - this.workspace.getProcedureMap().add(mixin.model); + this.workspace.getProcedureMap().add(mixin.getProcedureModel()); this.mixin(mixin, true); }; @@ -395,8 +402,8 @@ const procedureDefUpdateShapeMixin = { * Updates the block to reflect the state of the procedure model. */ doProcedureUpdate: function() { - this.setFieldValue(this.model.getName(), 'NAME'); - this.setEnabled(this.model.getEnabled()); + this.setFieldValue(this.getProcedureModel().getName(), 'NAME'); + this.setEnabled(this.getProcedureModel().getEnabled()); this.updateParameters_(); }, @@ -405,7 +412,8 @@ const procedureDefUpdateShapeMixin = { * model. */ updateParameters_: function() { - const params = this.model.getParameters().map((p) => p.getName()); + const params = + this.getProcedureModel().getParameters().map((p) => p.getName()); const paramString = params.length ? `${Msg['PROCEDURES_BEFORE_PARAMS']} ${params.join(', ')}` : ''; @@ -551,6 +559,17 @@ const procedureDefMutator = { * @this {Block} */ domToMutation: function(xmlElement) { + for (let i = 0; i < xmlElement.childNodes.length; i++) { + const node = xmlElement.childNodes[i]; + if (node.nodeName.toLowerCase() !== 'arg') continue; + this.getProcedureModel().insertParameter( + new ObservableParameterModel( + this.workspace, node.getAttribute('name'), + node.getAttribute('varid')), + i); + } + + // TODO: Remove this data update code. this.arguments_ = []; this.argumentVarModels_ = []; for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { @@ -610,6 +629,16 @@ const procedureDefMutator = { * statements. */ loadExtraState: function(state) { + if (state['params']) { + for (let i = 0; i < state['params'].length; i++) { + const param = state['params'][i]; + this.getProcedureModel().insertParameter( + new ObservableParameterModel(this.workspace, param.name, param.id), + i); + } + } + + // TODO: Remove this data update code. this.arguments_ = []; this.argumentVarModels_ = []; if (state['params']) { @@ -694,14 +723,16 @@ const procedureDefMutator = { } this.updateParams_(); Procedures.mutateCallers(this); - for (let i = this.model.getParameters().length; i >= 0; i--) { - this.model.deleteParameter(i); + + const model = this.getProcedureModel(); + for (let i = model.getParameters().length; i >= 0; i--) { + model.deleteParameter(i); } let i = 0; paramBlock = containerBlock.getInputTargetBlock('STACK'); while (paramBlock && !paramBlock.isInsertionMarker()) { - this.model.insertParameter( + model.insertParameter( new ObservableParameterModel( this.workspace, paramBlock.getFieldValue('NAME'), paramBlock.id), i); @@ -771,8 +802,8 @@ Extensions.registerMixin( const procedureDefOnChangeMixin = { onchange: function(e) { if (e.type === Events.BLOCK_CHANGE && e.blockId === this.id && - e.element == 'disabled') { - this.model.setEnabled(!e.newValue); + e.element === 'disabled') { + this.getProcedureModel().setEnabled(!e.newValue); } }, }; @@ -843,6 +874,20 @@ Extensions.registerMixin( 'procedure_defreturn_get_caller_block_mixin', procedureDefReturnGetCallerBlockMixin); +/** @this {Block} */ +const procedureDefSetNoReturnHelper = function() { + this.getProcedureModel().setReturnTypes(null); +}; +Extensions.register( + 'procedure_def_set_no_return_helper', procedureDefSetNoReturnHelper); + +/** @this {Block} */ +const procedureDefSetReturnHelper = function() { + this.getProcedureModel().setReturnTypes([]); +}; +Extensions.register( + 'procedure_def_set_return_helper', procedureDefSetReturnHelper); + const validateProcedureParamMixin = { /** * Obtain a valid name for the procedure argument. Create a variable if diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 8b0fd5309..91f624f95 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -24,8 +24,8 @@ 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 = this.workspace.getVariable(name) ?? + workspace.createVariable(name, '', id); } /** diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index a967e7e24..ae137689a 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -452,6 +452,256 @@ suite('Procedures', function() { }); }); + suite('deserializing data models', function() { + suite('return types', function() { + test('procedure defs without returns have null return types', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defnoreturn', + 'fields': { + 'NAME': 'test name', + }, + }, + ], + }, + }; + Blockly.serialization.workspaces.load(json, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.isNull( + procedureModel.getReturnTypes(), + 'Expected the return types to be null'); + }); + + test('procedure defs with returns have array return types', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defreturn', + 'fields': { + 'NAME': 'test name', + }, + }, + ], + }, + }; + Blockly.serialization.workspaces.load(json, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.isArray( + procedureModel.getReturnTypes(), + 'Expected the return types to be an array'); + }); + }); + + suite('json', function() { + test('procedure names get deserialized', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defnoreturn', + 'fields': { + 'NAME': 'test name', + }, + }, + ], + }, + }; + Blockly.serialization.workspaces.load(json, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.name, + 'test name', + 'Expected the name of the procedure model to equal the name ' + + 'being deserialized.'); + }); + + test('procedure parameter names get deserialized', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defnoreturn', + 'fields': { + 'NAME': 'test name', + }, + 'extraState': { + 'params': [ + { + 'id': 'test id 1', + 'name': 'test name 1', + }, + { + 'id': 'test id 2', + 'name': 'test name 2', + }, + ], + }, + }, + ], + }, + }; + Blockly.serialization.workspaces.load(json, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.getParameter(0).getName(), + 'test name 1', + 'Expected the name of the first parameter to equal the name ' + + 'being deserialized.'); + chai.assert.equal( + procedureModel.getParameter(1).getName(), + 'test name 2', + 'Expected the name of the second parameter to equal the name ' + + 'being deserialized.'); + }); + + test('procedure variables get matching IDs', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defnoreturn', + 'extraState': { + 'params': [ + { + 'name': 'test param name', + 'id': 'test param id', + }, + ], + }, + 'fields': { + 'NAME': 'test proc name', + }, + }, + ], + }, + 'variables': [ + { + 'name': 'test param name', + 'id': 'test param id', + }, + ], + }; + Blockly.serialization.workspaces.load(json, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.getParameter(0).getVariableModel().getId(), + 'test param id', + 'Expected the variable id to match the serialized param id'); + }); + }); + + suite('xml', function() { + test('procedure names get deserialized', function() { + const xml = Blockly.Xml.textToDom( + `` + + ` test name` + + ``); + Blockly.Xml.domToBlock(xml, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.name, + 'test name', + 'Expected the name of the procedure model to equal the name ' + + 'being deserialized.'); + }); + + test('procedure parameter names get deserialized', function() { + const xml = Blockly.Xml.textToDom( + `` + + ` ` + + ` ` + + ` ` + + ` ` + + ` test name` + + ``); + Blockly.Xml.domToBlock(xml, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.getParameter(0).getName(), + 'test name 1', + 'Expected the name of the first parameter to equal the name ' + + 'being deserialized.'); + chai.assert.equal( + procedureModel.getParameter(1).getName(), + 'test name 2', + 'Expected the name of the second parameter to equal the name ' + + 'being deserialized.'); + }); + + test('procedure variables get matching IDs', function() { + const json = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_defnoreturn', + 'extraState': { + 'params': [ + { + 'name': 'test param name', + 'id': 'test param id', + }, + ], + }, + 'fields': { + 'NAME': 'test proc name', + }, + }, + ], + }, + 'variables': [ + { + 'name': 'test param name', + 'id': 'test param id', + }, + ], + }; + const xml = Blockly.Xml.textToDom( + `` + + ` ` + + ` test param name` + + ` ` + + ` ` + + ` ` + + ` ` + + ` ` + + ` test name` + + ` ` + + ``); + Blockly.Xml.domToWorkspace(xml, this.workspace); + const procedureModel = + this.workspace.getProcedureMap().getProcedures()[0]; + + chai.assert.equal( + procedureModel.getParameter(0).getVariableModel().getId(), + 'test param id', + 'Expected the variable id to match the serialized param id'); + }); + }); + }); + suite('Renaming procedures', function() { test('callers are updated to have the new name', function() { const defBlock = createProcDefBlock(this.workspace); From e1995ae3b04d8fc8bf93eb709b4d908465fe0a23 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 6 Jan 2023 17:55:36 +0000 Subject: [PATCH 017/141] feat: procedure callers respond to models (#6718) * chore: add test for reconnecting procedure input blocks * feat: add caller blocks responding to updates * chore: format * chore: add test for deserializing callers before defs * chore: format --- blocks/procedures.js | 340 +++++++++++++----- core/procedures/update_procedures.ts | 1 + tests/mocha/blocks/procedures_test.js | 417 ++++++++++++++++------ tests/mocha/test_helpers/procedures.js | 2 +- tests/mocha/test_helpers/serialization.js | 1 + 5 files changed, 551 insertions(+), 210 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 565bdf058..c91364f81 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -19,7 +19,6 @@ const Events = goog.require('Blockly.Events'); const Extensions = goog.require('Blockly.Extensions'); const Procedures = goog.require('Blockly.Procedures'); const Variables = goog.require('Blockly.Variables'); -const Xml = goog.require('Blockly.Xml'); const xmlUtils = goog.require('Blockly.utils.xml'); const {Align} = goog.require('Blockly.Input'); /* eslint-disable-next-line no-unused-vars */ @@ -100,10 +99,7 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'type': 'procedures_callnoreturn', 'message0': '%1 %2', 'args0': [ - { - 'type': 'field_label', - 'name': 'NAME', - }, + {'type': 'field_label', 'name': 'NAME', 'text': '%{BKY_UNNAMED_KEY}'}, { 'type': 'input_dummy', 'name': 'TOPROW', @@ -177,10 +173,7 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'type': 'procedures_callreturn', 'message0': '%1 %2', 'args0': [ - { - 'type': 'field_label', - 'name': 'NAME', - }, + {'type': 'field_label', 'name': 'NAME', 'text': '%{BKY_UNNAMED_KEY}'}, { 'type': 'input_dummy', 'name': 'TOPROW', @@ -319,8 +312,9 @@ const procedureDefGetDefMixin = function() { }, }; - mixin.model_ = - new ObservableProcedureModel(this.workspace, this.getFieldValue('NAME')); + mixin.model_ = new ObservableProcedureModel( + this.workspace, + Procedures.findLegalName(this.getFieldValue('NAME'), this)); this.workspace.getProcedureMap().add(mixin.getProcedureModel()); this.mixin(mixin, true); @@ -725,7 +719,8 @@ const procedureDefMutator = { Procedures.mutateCallers(this); const model = this.getProcedureModel(); - for (let i = model.getParameters().length; i >= 0; i--) { + const count = this.getProcedureModel().getParameters().length; + for (let i = count - 1; i >= 0; i--) { model.deleteParameter(i); } @@ -996,6 +991,72 @@ Extensions.register( /** @this {Block} */ const procedureCallerGetDefMixin = function() { const mixin = { + model_: null, + + prevParams_: [], + + argsMap_: new Map(), + + /** + * @return {IProcedureModel} The procedure model associated with this + * block. + */ + getProcedureModel() { + return this.model_; + }, + + /** + * @param {string} name The name of the procedure model to find. + * @param {string[]} params The param names of the procedure model to find. + * @return {IProcedureModel} The procedure model that was found. + */ + findProcedureModel_(name, params = []) { + const workspace = this.getTargetWorkspace_(); + const model = workspace.getProcedureMap().getProcedures().find( + (proc) => proc.getName() === name); + if (!model) return null; + + const hasMatchingParams = + model.getParameters().every((p, i) => p.getName() === params[i]); + if (!hasMatchingParams) return null; + + return model; + }, + + /** + * Creates a procedure definition block with the given name and params, + * and returns the procedure model associated with it. + * @param {string} name The name of the procedure to create. + * @param {string[]} params The names of the parameters to create. + * @return {IProcedureModel} The procedure model associated with the new + * procedure definition block. + */ + createDef_(name, params = []) { + const xy = this.getRelativeToSurfaceXY(); + const newName = Procedures.findLegalName(name, this); + + const blockDef = { + 'type': this.defType_, + 'x': xy.x + config.snapRadius * (this.RTL ? -1 : 1), + 'y': xy.y + config.snapRadius * 2, + 'extraState': { + 'params': params.map((p) => ({'name': p})), + }, + 'fields': {'NAME': newName}, + }; + return serialization.blocks.append(blockDef, this.getTargetWorkspace_()) + .getProcedureModel(); + }, + + /** + * @return {Workspace} The main workspace (i.e. not the flyout workspace) + * associated with this block. + */ + getTargetWorkspace_() { + return this.workspace.isFlyout ? this.workspace.targetWorkspace : + this.workspace; + }, + /** * Returns the name of the procedure this block calls. * @return {string} Procedure name. @@ -1012,7 +1073,8 @@ const procedureCallerGetDefMixin = function() { * @this {Block} */ getVars: function() { - return this.arguments_; + return this.getProcedureModel().getParameters().map( + (p) => p.getVariableModel().name); }, /** @@ -1021,7 +1083,8 @@ const procedureCallerGetDefMixin = function() { * @this {Block} */ getVarModels: function() { - return this.argumentVarModels_; + return this.getProcedureModel().getParameters().map( + (p) => p.getVariableModel()); }, }; @@ -1043,6 +1106,8 @@ const procedureCallerMutator = { previousEnabledState_: true, + paramsFromSerializedState_: [], + /** * Create XML to represent the (non-editable) name and arguments. * Backwards compatible serialization implementation. @@ -1068,16 +1133,13 @@ const procedureCallerMutator = { */ domToMutation: function(xmlElement) { const name = xmlElement.getAttribute('name'); - this.renameProcedure(this.getProcedureCall(), name); - const args = []; - const paramIds = []; - for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { - if (childNode.nodeName.toLowerCase() === 'arg') { - args.push(childNode.getAttribute('name')); - paramIds.push(childNode.getAttribute('paramId')); + const params = []; + for (const n of xmlElement.childNodes) { + if (n.nodeName.toLowerCase() === 'arg') { + params.push(n.getAttribute('name')); } } - this.setProcedureParameters_(args, paramIds); + this.deserialize_(name, params); }, /** @@ -1100,19 +1162,160 @@ const procedureCallerMutator = { * procedure name. */ loadExtraState: function(state) { - this.renameProcedure(this.getProcedureCall(), state['name']); - const params = state['params']; - if (params) { - const ids = []; - ids.length = params.length; - ids.fill(null); - this.setProcedureParameters_(params, ids); + this.deserialize_(state['name'], state['params'] || []); + }, + + /** + * Applies the given name and params from the serialized state to the block. + * @param {string} name The name to apply to the block. + * @param {!Array} params The parameters to apply to the block. + */ + deserialize_: function(name, params) { + this.setFieldValue(name, 'NAME'); + if (!this.model_) this.model_ = this.findProcedureModel_(name, params); + if (this.getProcedureModel()) { + this.initBlockWithProcedureModel_(); + } else { + // We need to create/find our procedure def in our change listener. + this.paramsFromSerializedState_ = params; + // Create inputs based on the mutation so that children can be connected. + this.createArgInputs_(params); } + + // Temporarily maintained for logic that relies on arguments_ + this.arguments_ = params; }, }; Extensions.registerMutator('procedure_caller_mutator', procedureCallerMutator); const procedureCallerUpdateShapeMixin = { + /** + * Renders the block for the first time based on the procedure model. + */ + initBlockWithProcedureModel_() { + this.prevParams_ = [...this.getProcedureModel().getParameters()]; + this.doProcedureUpdate(); + }, + + /** + * Updates the shape of this block to reflect the state of the data model. + */ + doProcedureUpdate: function() { + if (!this.getProcedureModel()) return; + const id = this.getProcedureModel().getId(); + if (!this.getTargetWorkspace_().getProcedureMap().has(id)) { + this.dispose(); + return; + } + this.updateName_(); + this.updateEnabled_(); + this.updateParameters_(); + }, + + /** + * Updates the name field of this block to match the state of the data model. + */ + updateName_: function() { + const name = this.getProcedureModel().getName(); + this.setFieldValue(name, 'NAME'); + const baseMsg = this.outputConnection ? + Msg['PROCEDURES_CALLRETURN_TOOLTIP'] : + Msg['PROCEDURES_CALLNORETURN_TOOLTIP']; + this.setTooltip(baseMsg.replace('%1', name)); + }, + + /** + * Updates the enabled state of this block to match the state of the data + * model. + */ + updateEnabled_: function() { + if (!this.getProcedureModel().getEnabled()) { + this.previousEnabledState_ = this.isEnabled(); + this.setEnabled(false); + } else { + this.setEnabled(this.previousEnabledState_); + } + }, + + /** + * Updates the parameter fields/inputs of this block to match the state of the + * data model. + */ + updateParameters_: function() { + this.updateArgsMap_(); + this.deleteAllArgInputs_(); + this.addParametersLabel__(); + this.createArgInputs_(); + this.reattachBlocks_(); + this.prevParams_ = [...this.getProcedureModel().getParameters()]; + }, + + /** + * Saves a map of parameter IDs to target blocks attached to the inputs + * of this caller block. + */ + updateArgsMap_: function() { + for (const [i, p] of this.prevParams_.entries()) { + const target = this.getInputTargetBlock(`ARG${i}`); + if (target) this.argsMap_.set(p.getId(), target); + } + }, + + /** + * Deletes all the parameter inputs on this block. + */ + deleteAllArgInputs_: function() { + let i = 0; + while (this.getInput(`ARG${i}`)) { + this.removeInput(`ARG${i}`); + i++; + } + }, + + /** + * Adds or removes the parameter label to match the state of the data model. + */ + addParametersLabel__: function() { + const topRow = this.getInput('TOPROW'); + if (this.getProcedureModel().getParameters().length) { + if (!this.getField('WITH')) { + topRow.appendField(Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH'); + topRow.init(); + } + } else if (this.getField('WITH')) { + topRow.removeField('WITH'); + } + }, + + /** + * Creates all of the parameter inputs to match the state of the data model. + * @param {Array} params The params to add to the block, or null to + * use the params defined in the procedure model. + */ + createArgInputs_: function(params = null) { + if (!params) { + params = this.getProcedureModel().getParameters().map((p) => p.getName()); + } + for (const [i, p] of params.entries()) { + this.appendValueInput(`ARG${i}`) + .appendField(new FieldLabel(p), `ARGNAME${i}`) + .setAlign(Align.RIGHT); + } + }, + + /** + * Reattaches blocks to this blocks' inputs based on the data saved in the + * argsMap_. + */ + reattachBlocks_: function() { + const params = this.getProcedureModel().getParameters(); + for (const [i, p] of params.entries()) { + if (!this.argsMap_.has(p.getId())) continue; + this.getInput(`ARG${i}`).connection.connect( + this.argsMap_.get(p.getId()).outputConnection); + } + }, + /** * Notification that a procedure is renaming. * If the name matches this block's procedure, rename it. @@ -1291,55 +1494,28 @@ const procedureCallerOnChangeMixin = { // Events not generated by user. Skip handling. return; } + // TODO: Clean this up to call createDef_. if (event.type === Events.BLOCK_CREATE && - event.ids.indexOf(this.id) !== -1) { + (event.blockId === this.id || event.ids.indexOf(this.id) !== -1)) { // Look for the case where a procedure call was created (usually through // paste) and there is no matching definition. In this case, create // an empty definition block with the correct signature. const name = this.getProcedureCall(); let def = Procedures.getDefinition(name, this.workspace); - if (def && - (def.type !== this.defType_ || - JSON.stringify(def.getVars()) !== JSON.stringify(this.arguments_))) { - // The signatures don't match. - def = null; - } + if (!this.defMatches_(def)) def = null; if (!def) { + // We have no def nor procedure model. Events.setGroup(event.group); - /** - * Create matching definition block. - * - * - * - * - * - * test - * - * - */ - const xml = xmlUtils.createElement('xml'); - const block = xmlUtils.createElement('block'); - block.setAttribute('type', this.defType_); - const xy = this.getRelativeToSurfaceXY(); - const x = xy.x + config.snapRadius * (this.RTL ? -1 : 1); - const y = xy.y + config.snapRadius * 2; - block.setAttribute('x', x); - block.setAttribute('y', y); - const mutation = this.mutationToDom(); - block.appendChild(mutation); - const field = xmlUtils.createElement('field'); - field.setAttribute('name', 'NAME'); - const callName = this.getProcedureCall(); - const newName = Procedures.findLegalName(callName, this); - if (callName !== newName) { - this.renameProcedure(callName, newName); - } - field.appendChild(xmlUtils.createTextNode(callName)); - block.appendChild(field); - xml.appendChild(block); - Xml.domToWorkspace(xml, this.workspace); + this.model_ = this.createDef_( + this.getFieldValue('NAME'), this.paramsFromSerializedState_); Events.setGroup(false); } + if (!this.getProcedureModel()) { + // We have a def, but no reference to its model. + this.model_ = this.findProcedureModel_( + this.getFieldValue('NAME'), this.paramsFromSerializedState_); + } + this.initBlockWithProcedureModel_(); } else if (event.type === Events.BLOCK_DELETE && event.blockId != this.id) { // Look for the case where a procedure definition has been deleted, // leaving this block (a procedure call) orphaned. In this case, delete @@ -1351,31 +1527,13 @@ const procedureCallerOnChangeMixin = { this.dispose(true); Events.setGroup(false); } - } else if (event.type === Events.CHANGE && event.element === 'disabled') { - const name = this.getProcedureCall(); - const def = Procedures.getDefinition(name, this.workspace); - if (def && def.id === event.blockId) { - // in most cases the old group should be '' - const oldGroup = Events.getGroup(); - if (oldGroup) { - // This should only be possible programmatically and may indicate a - // problem with event grouping. If you see this message please - // investigate. If the use ends up being valid we may need to reorder - // events in the undo stack. - console.log( - 'Saw an existing group while responding to a definition change'); - } - Events.setGroup(event.group); - if (event.newValue) { - this.previousEnabledState_ = this.isEnabled(); - this.setEnabled(false); - } else { - this.setEnabled(this.previousEnabledState_); - } - Events.setGroup(oldGroup); - } } }, + + defMatches_(defBlock) { + return defBlock && defBlock.type === this.defType_ && + JSON.stringify(defBlock.getVars()) === JSON.stringify(this.arguments_); + }, }; Extensions.registerMixin( 'procedure_caller_onchange_mixin', procedureCallerOnChangeMixin); diff --git a/core/procedures/update_procedures.ts b/core/procedures/update_procedures.ts index 53d06caa5..b355a9c56 100644 --- a/core/procedures/update_procedures.ts +++ b/core/procedures/update_procedures.ts @@ -14,6 +14,7 @@ import {Workspace} from '../workspace.js'; * @internal */ export function triggerProceduresUpdate(workspace: Workspace) { + if (workspace.isClearing) return; for (const block of workspace.getAllBlocks(false)) { if (isProcedureBlock(block)) { block.doProcedureUpdate(); diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index ae137689a..f9b96c61b 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -12,15 +12,17 @@ import {assertCallBlockStructure, assertDefBlockStructure, createProcDefBlock, c import {assertEventNotFired, createChangeListenerSpy} from '../test_helpers/events.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from '../test_helpers/setup_teardown.js'; +import {defineRowBlock} from '../test_helpers/block_definitions.js'; suite('Procedures', function() { setup(function() { - sharedTestSetup.call(this); + sharedTestSetup.call(this, {fireEventsNow: false}); this.workspace = Blockly.inject('blocklyDiv', {}); this.workspace.createVariable('preCreatedVar', '', 'preCreatedVarId'); this.workspace.createVariable( 'preCreatedTypedVar', 'type', 'preCreatedTypedVarId'); + defineRowBlock(); }); teardown(function() { @@ -47,6 +49,7 @@ suite('Procedures', function() { const defBlock = createProcDefBlock(this.workspace); defBlock.setEnabled(false); + this.clock.runAll(); chai.assert.isFalse( defBlock.getProcedureModel().getEnabled(), @@ -329,7 +332,7 @@ suite('Procedures', function() { }); }); - suite.skip('caller blocks', function() { + suite('caller blocks', function() { test('renaming the procedure data model updates blocks', function() { const defBlock = createProcDefBlock(this.workspace); const callBlock = createProcCallBlock(this.workspace); @@ -351,7 +354,7 @@ suite('Procedures', function() { procModel.setEnabled(false); chai.assert.isFalse( - callBlock.getEnabled(), + callBlock.isEnabled(), 'Expected the procedure block to be disabled'); }); @@ -387,20 +390,58 @@ suite('Procedures', function() { procModel.insertParameter(param2, 0); chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the first param input to exist'); + callBlock.getInput('ARG0'), + 'Expected the first param input to exist'); chai.assert.isNotNull( - callBlock.getInput('ARG1'), - 'Expected the second param input to exist'); + callBlock.getInput('ARG1'), + 'Expected the second param input to exist'); chai.assert.equal( - callBlock.getFieldValue('ARGNAME0'), - 'param1', - 'Expected the first params field to match the name of the param'); + callBlock.getFieldValue('ARGNAME0'), + 'param2', + 'Expected the first params field to match the name of the param'); chai.assert.equal( - callBlock.getFieldValue('ARGNAME1'), - 'param2', - 'Expected the second params field to match the name of the param'); + callBlock.getFieldValue('ARGNAME1'), + 'param1', + 'Expected the second params field to match the name of the param'); }); + + test( + 'moving a parameter in the data model moves input blocks', + function() { + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + const procModel = defBlock.getProcedureModel(); + const param1 = + new ObservableParameterModel(this.workspace, 'param1', 'id1'); + const param2 = + new ObservableParameterModel(this.workspace, 'param2', 'id2'); + procModel.insertParameter(param1, 0); + procModel.insertParameter(param2, 1); + const rowBlock1 = this.workspace.newBlock('row_block'); + const rowBlock2 = this.workspace.newBlock('row_block'); + callBlock.getInput('ARG0').connection + .connect(rowBlock1.outputConnection); + callBlock.getInput('ARG1').connection + .connect(rowBlock2.outputConnection); + + procModel.deleteParameter(1); + procModel.insertParameter(param2, 0); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the first param input to exist'); + chai.assert.equal( + callBlock.getInputTargetBlock('ARG0'), + rowBlock2, + 'Expected the second row block to be attached to the first input'); + chai.assert.isNotNull( + callBlock.getInput('ARG1'), + 'Expected the second param input to exist'); + chai.assert.equal( + callBlock.getInputTargetBlock('ARG1'), + rowBlock1, + 'Expected the first row block to be attached to the second input'); + }); test( 'deleting a parameter from the data model updates blocks', @@ -702,7 +743,7 @@ suite('Procedures', function() { }); }); - suite('Renaming procedures', function() { + suite('renaming procedures', function() { test('callers are updated to have the new name', function() { const defBlock = createProcDefBlock(this.workspace); const callBlock = createProcCallBlock(this.workspace); @@ -738,7 +779,7 @@ suite('Procedures', function() { }); }); - suite('Adding procedure parameters', function() { + suite('adding procedure parameters', function() { test('no variable create event is fired', function() { const eventSpy = createChangeListenerSpy(this.workspace); const defBlock = createProcDefBlock(this.workspace); @@ -774,6 +815,7 @@ suite('Procedures', function() { }, }, mutatorWorkspace); + this.clock.runAll(); const newFlyoutParamName = mutatorWorkspace.getFlyout().getWorkspace().getTopBlocks(true)[0] @@ -829,7 +871,7 @@ suite('Procedures', function() { }); }); - suite('Renaming procedure parameters', function() { + suite('renaming procedure parameters', function() { test('defs are updated for parameter renames', function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); @@ -963,7 +1005,7 @@ suite('Procedures', function() { }); }); - suite('Reordering procedure parameters', function() { + suite('reordering procedure parameters', function() { test('reordering procedure parameters updates procedure blocks', function() { // Create a stack of container, parameter, parameter. const defBlock = createProcDefBlock(this.workspace); @@ -1078,7 +1120,7 @@ suite('Procedures', function() { }); }); - suite('Enabling and disabling procedure blocks', function() { + suite('enabling and disabling procedure blocks', function() { test( 'if a procedure definition is disabled, the procedure caller ' + 'is also disabled', @@ -1087,6 +1129,7 @@ suite('Procedures', function() { const callBlock = createProcCallBlock(this.workspace); defBlock.setEnabled(false); + this.clock.runAll(); chai.assert.isFalse( callBlock.isEnabled(), @@ -1125,9 +1168,8 @@ suite('Procedures', function() { }); }); - suite('Deleting procedure blocks', function() { - // Currently fails because of event ordering. - test.skip( + suite('deleting procedure blocks', function() { + test( 'when the procedure definition block is deleted, all of its ' + 'associated callers are deleted as well', function() { @@ -1135,6 +1177,8 @@ suite('Procedures', function() { const callBlock1 = createProcCallBlock(this.workspace); const callBlock2 = createProcCallBlock(this.workspace); + defBlock.dispose(); + this.clock.runAll(); chai.assert.isTrue( callBlock1.disposed, 'Expected the first caller to be disposed'); @@ -1143,6 +1187,232 @@ suite('Procedures', function() { }); }); + suite('caller blocks creating new def blocks', function() { + setup(function() { + this.TEST_VAR_ID = 'test-id'; + this.genUidStub = createGenUidStubWithReturns(this.TEST_VAR_ID); + }); + + suite('xml', function() { + test('callers without defs create new defs', function() { + const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( + '' + + '' + + '' + ), this.workspace); + this.clock.runAll(); + assertDefBlockStructure( + this.workspace.getBlocksByType('procedures_defreturn')[0], true); + assertCallBlockStructure(callBlock, [], [], 'do something'); + }); + + test('callers without mutations create unamed defs', function() { + const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( + '' + ), this.workspace); + this.clock.runAll(); + assertDefBlockStructure( + this.workspace.getBlocksByType('procedures_defreturn')[0], true); + assertCallBlockStructure(callBlock, [], [], 'unnamed'); + }); + + test('callers with missing args create new defs', function() { + const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` + + do something + + + + + `), this.workspace); + const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( + '' + + ' ' + + '' + ), this.workspace); + this.clock.runAll(); + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure(callBlock, [], [], 'do something2'); + }); + + test('callers with mismatched args create new defs', function() { + const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` + + do something + + + + + `), this.workspace); + const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` + + + + + + `), this.workspace); + this.clock.runAll(); + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure( + callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); + }); + + test( + 'callers whose defs are deserialized later do not create defs', + function() { + Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(` + + + + + + + + do something + + + + + + `), this.workspace); + this.clock.runAll(); + const defBlock = + this.workspace.getBlocksByType('procedures_defreturn')[0]; + const callBlock = + this.workspace.getBlocksByType('procedures_callreturn')[0]; + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure(callBlock, ['x'], ['arg'], 'do something'); + chai.assert.equal( + defBlock.getProcedureModel(), + callBlock.getProcedureModel(), + 'Expected the blocks to have the same procedure model'); + }); + }); + + suite('json', function() { + test('callers without defs create new defs', function() { + const callBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_callreturn', + 'extraState': { + 'name': 'do something', + }, + }, this.workspace, {recordUndo: true}); + this.clock.runAll(); + assertDefBlockStructure( + this.workspace.getBlocksByType('procedures_defreturn')[0], true); + assertCallBlockStructure(callBlock, [], [], 'do something'); + }); + + test('callers without extra state create unamed defs', function() { + // recordUndo must be true to trigger change listener. + const callBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_callreturn', + }, this.workspace, {recordUndo: true}); + this.clock.runAll(); + assertDefBlockStructure( + this.workspace.getBlocksByType('procedures_defreturn')[0], true); + assertCallBlockStructure(callBlock, [], [], 'unnamed'); + }); + + test('callers with missing args create new defs', function() { + const defBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_defreturn', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'params': [ + { + 'name': 'x', + 'id': 'arg', + }, + ], + }, + }, this.workspace); + const callBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_callreturn', + 'extraState': { + 'name': 'do something', + }, + }, this.workspace, {recordUndo: true}); + this.clock.runAll(); + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure(callBlock, [], [], 'do something2'); + }); + + test('callers with mismatched args create new defs', function() { + const defBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_defreturn', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'params': [ + { + 'name': 'x', + 'id': 'arg', + }, + ], + }, + }, this.workspace); + const callBlock = Blockly.serialization.blocks.append({ + 'type': 'procedures_callreturn', + 'extraState': { + 'name': 'do something', + 'params': ['y'], + }, + }, this.workspace, {recordUndo: true}); + this.clock.runAll(); + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure( + callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); + }); + + test( + 'callers whose defs are deserialized later do not create defs', + function() { + Blockly.serialization.workspaces.load({ + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'procedures_callreturn', + 'extraState': { + 'params': ['x'], + }, + }, + { + 'type': 'procedures_defreturn', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'params': [ + { + 'name': 'x', + 'id': 'arg', + }, + ], + }, + }, + ], + }, + }, this.workspace); + this.clock.runAll(); + const defBlock = + this.workspace.getBlocksByType('procedures_defreturn')[0]; + const callBlock = + this.workspace.getBlocksByType('procedures_callreturn')[0]; + assertDefBlockStructure(defBlock, true, ['x'], ['arg']); + assertCallBlockStructure(callBlock, ['x'], ['arg'], 'do something'); + chai.assert.equal( + defBlock.getProcedureModel(), + callBlock.getProcedureModel(), + 'Expected the blocks to have the same procedure model'); + }); + }); + }); + suite('allProcedures', function() { test('Only Procedures', function() { const noReturnBlock = this.workspace.newBlock('procedures_defnoreturn'); @@ -1197,7 +1467,7 @@ suite('Procedures', function() { }); }); - suite.skip('Multiple block serialization', function() { + suite('Multiple block serialization', function() { function assertDefAndCallBlocks(workspace, noReturnNames, returnNames, hasCallers) { const allProcedures = Blockly.Procedures.allProcedures(workspace); const defNoReturnBlocks = allProcedures[0]; @@ -1255,22 +1525,13 @@ suite('Procedures', function() { this.workspace, ['unnamed2'], ['unnamed'], false); }); - test('callnoreturn (no def in xml)', function() { - const xml = Blockly.Xml.textToDom(` - - - `); - Blockly.Xml.domToWorkspace(xml, this.workspace); - assertDefAndCallBlocks( - this.workspace, ['unnamed'], [], true); - }); - test('callreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` `); Blockly.Xml.domToWorkspace(xml, this.workspace); + this.clock.runAll(); assertDefAndCallBlocks( this.workspace, [], ['unnamed'], true); }); @@ -1282,6 +1543,7 @@ suite('Procedures', function() { `); Blockly.Xml.domToWorkspace(xml, this.workspace); + this.clock.runAll(); assertDefAndCallBlocks( this.workspace, ['unnamed'], ['unnamed2'], true); }); @@ -1293,95 +1555,11 @@ suite('Procedures', function() { `); Blockly.Xml.domToWorkspace(xml, this.workspace); + this.clock.runAll(); assertDefAndCallBlocks( this.workspace, ['unnamed2'], ['unnamed'], true); }); }); - - suite('caller param mismatch', function() { - setup(function() { - this.TEST_VAR_ID = 'test-id'; - this.genUidStub = createGenUidStubWithReturns(this.TEST_VAR_ID); - }); - - test('callreturn with missing args', function() { - const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - do something - - - - - `), this.workspace); - const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( - '' + - ' ' + - '' - ), this.workspace); - assertDefBlockStructure(defBlock, true, ['x'], ['arg']); - assertCallBlockStructure(callBlock, [], [], 'do something2'); - }); - - test('callreturn with bad args', function() { - const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - do something - - - - - `), this.workspace); - const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - - - - - `), this.workspace); - assertDefBlockStructure(defBlock, true, ['x'], ['arg']); - assertCallBlockStructure( - callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); - }); - - test('callnoreturn with missing args', function() { - const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - do something - - - - - `), this.workspace); - const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( - '' + - ' ' + - '' - ), this.workspace); - assertDefBlockStructure(defBlock, false, ['x'], ['arg']); - assertCallBlockStructure(callBlock, [], [], 'do something2'); - }); - - test('callnoreturn with bad args', function() { - const defBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - do something - - - - - `), this.workspace); - const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` - - - - - - `), this.workspace); - assertDefBlockStructure(defBlock, false, ['x'], ['arg']); - assertCallBlockStructure( - callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); - }); - }); }); suite('getDefinition - Modified cases', function() { @@ -1448,8 +1626,11 @@ suite('Procedures', function() { }); test('Call block', function() { - this.callBlock = this.workspace.newBlock(testSuite.callType); + this.callBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.callType, + }, this.workspace, {recordUndo: true}); this.callBlock.setFieldValue('proc name', 'NAME'); + this.clock.runAll(); assertCallBlockStructure(this.callBlock); }); }); diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index b409c5c2f..74c8a7fd2 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -102,7 +102,7 @@ export function assertCallBlockStructure( assertCallBlockArgsStructure(callBlock, args); assertBlockVarModels(callBlock, varIds); if (name !== undefined) { - chai.assert(callBlock.getFieldValue('NAME'), name); + chai.assert.equal(callBlock.getFieldValue('NAME'), name); } } diff --git a/tests/mocha/test_helpers/serialization.js b/tests/mocha/test_helpers/serialization.js index cc076bfc0..ebc6deb5d 100644 --- a/tests/mocha/test_helpers/serialization.js +++ b/tests/mocha/test_helpers/serialization.js @@ -66,6 +66,7 @@ export const runSerializationTestSuite = (testCases) => { block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( testCase.xml), this.workspace); } + this.clock.runAll(); testCase.assertBlockStructure(block); }; }; From 23fb76b9f21987c849b92973f2ea002ccb9f4c1c Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 6 Jan 2023 23:32:04 +0000 Subject: [PATCH 018/141] fix: undoing and redoing parameter events (#6721) * fix: undoing and redoing parameters creating dupe parameters * chore: add tests for undoing and redoing adding parameters * fix: undoing and redoing renaming parameters * chore: change tests to tick clock * chore: format * chore: add tests for deleting procedure parameters * chore: fix tests * chore: unskip tests * chore: fix return type of saveExtraState * chore: increase mocha timeout --- blocks/procedures.js | 52 +-- core/procedures/observable_parameter_model.ts | 5 +- core/serialization/procedures.ts | 4 +- tests/mocha/blocks/procedures_test.js | 384 +++++++++++++----- tests/mocha/jso_serialization_test.js | 2 +- tests/mocha/webdriver.js | 2 +- 6 files changed, 316 insertions(+), 133 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index c91364f81..419631d52 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -528,11 +528,13 @@ const procedureDefMutator = { if (opt_paramIds) { container.setAttribute('name', this.getFieldValue('NAME')); } - for (let i = 0; i < this.argumentVarModels_.length; i++) { + + const params = this.getProcedureModel().getParameters(); + for (let i = 0; i < params.length; i++) { const parameter = xmlUtils.createElement('arg'); - const argModel = this.argumentVarModels_[i]; - parameter.setAttribute('name', argModel.name); - parameter.setAttribute('varid', argModel.getId()); + const varModel = params[i].getVariableModel(); + parameter.setAttribute('name', varModel.name); + parameter.setAttribute('varid', varModel.getId()); if (opt_paramIds && this.paramIds_) { parameter.setAttribute('paramId', this.paramIds_[i]); } @@ -556,10 +558,10 @@ const procedureDefMutator = { for (let i = 0; i < xmlElement.childNodes.length; i++) { const node = xmlElement.childNodes[i]; if (node.nodeName.toLowerCase() !== 'arg') continue; + const varId = node.getAttribute('varid'); this.getProcedureModel().insertParameter( new ObservableParameterModel( - this.workspace, node.getAttribute('name'), - node.getAttribute('varid')), + this.workspace, node.getAttribute('name'), undefined, varId), i); } @@ -596,20 +598,20 @@ const procedureDefMutator = { * parameters and statements. */ saveExtraState: function() { - if (!this.argumentVarModels_.length && this.hasStatements_) { - return null; - } + const params = this.getProcedureModel().getParameters(); + if (!params.length && this.hasStatements_) return null; + const state = Object.create(null); - if (this.argumentVarModels_.length) { - state['params'] = []; - for (let i = 0; i < this.argumentVarModels_.length; i++) { - state['params'].push({ - // We don't need to serialize the name, but just in case we decide - // to separate params from variables. - 'name': this.argumentVarModels_[i].name, - 'id': this.argumentVarModels_[i].getId(), - }); - } + if (params.length) { + state['params'] = params.map((p) => { + return { + 'name': p.getName(), + 'id': p.getVariableModel().getId(), + // Ideally this would be id, and the other would be varId, + // but backwards compatibility :/ + 'paramId': p.getId(), + }; + }); } if (!this.hasStatements_) { state['hasStatements'] = false; @@ -625,10 +627,9 @@ const procedureDefMutator = { loadExtraState: function(state) { if (state['params']) { for (let i = 0; i < state['params'].length; i++) { - const param = state['params'][i]; + const {name, id, paramId} = state['params'][i]; this.getProcedureModel().insertParameter( - new ObservableParameterModel(this.workspace, param.name, param.id), - i); + new ObservableParameterModel(this.workspace, name, paramId, id), i); } } @@ -719,7 +720,7 @@ const procedureDefMutator = { Procedures.mutateCallers(this); const model = this.getProcedureModel(); - const count = this.getProcedureModel().getParameters().length; + const count = model.getParameters().length; for (let i = count - 1; i >= 0; i--) { model.deleteParameter(i); } @@ -935,6 +936,7 @@ const validateProcedureParamMixin = { this.createdVariables_.push(model); } } + return varName; }, @@ -1210,6 +1212,10 @@ const procedureCallerUpdateShapeMixin = { this.updateName_(); this.updateEnabled_(); this.updateParameters_(); + + // Temporarily maintained for code that relies on arguments_ + this.arguments_ = + this.getProcedureModel().getParameters().map((p) => p.getName()); }, /** diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 91f624f95..e5adb53ba 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -22,10 +22,11 @@ export class ObservableParameterModel implements IParameterModel { private procedureModel: IProcedureModel|null = null; constructor( - private readonly workspace: Workspace, name: string, id?: string) { + private readonly workspace: Workspace, name: string, id?: string, + varId?: string) { this.id = id ?? genUid(); this.variable = this.workspace.getVariable(name) ?? - workspace.createVariable(name, '', id); + workspace.createVariable(name, '', varId); } /** diff --git a/core/serialization/procedures.ts b/core/serialization/procedures.ts index 05f70b03b..8e18dda66 100644 --- a/core/serialization/procedures.ts +++ b/core/serialization/procedures.ts @@ -10,7 +10,7 @@ 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 * as serializationRegistry from './registry.js'; import type {Workspace} from '../workspace.js'; @@ -171,4 +171,4 @@ export class ProcedureSerializer `); Blockly.Xml.domToWorkspace(xml, this.workspace); + this.clock.runAll(); + assertDefAndCallBlocks( this.workspace, ['unnamed'], ['unnamed2'], false); }); @@ -1521,6 +1688,8 @@ suite('Procedures', function() { `); Blockly.Xml.domToWorkspace(xml, this.workspace); + this.clock.runAll(); + assertDefAndCallBlocks( this.workspace, ['unnamed2'], ['unnamed'], false); }); @@ -1539,8 +1708,8 @@ suite('Procedures', function() { test('callnoreturn and callreturn (no def in xml)', function() { const xml = Blockly.Xml.textToDom(` - - + + `); Blockly.Xml.domToWorkspace(xml, this.workspace); this.clock.runAll(); @@ -1880,15 +2049,18 @@ suite('Procedures', function() { suite('Mutation', function() { setup(function() { - this.defBlock = this.workspace.newBlock(testSuite.defType); - this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = this.workspace.newBlock(testSuite.callType); - this.callBlock.setFieldValue('proc name', 'NAME'); - this.findParentStub = sinon.stub(Blockly.Mutator, 'findParentWs') - .returns(this.workspace); - }); - teardown(function() { - this.findParentStub.restore(); + this.defBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.defType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); + this.callBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.callType, + 'extraState': { + 'name': 'proc name', + }, + }, this.workspace); }); suite('Composition', function() { suite('Statements', function() { @@ -1935,11 +2107,9 @@ suite('Procedures', function() { }); suite('Untyped Arguments', function() { function createMutator(argArray) { - this.mutatorWorkspace = new Blockly.Workspace( - new Blockly.Options({ - parentWorkspace: this.workspace, - })); - this.containerBlock = this.defBlock.decompose(this.mutatorWorkspace); + this.defBlock.mutator.setVisible(true); + this.mutatorWorkspace = this.defBlock.mutator.getWorkspace(); + this.containerBlock = this.mutatorWorkspace.getTopBlocks()[0]; this.connection = this.containerBlock.getInput('STACK').connection; for (let i = 0; i < argArray.length; i++) { this.argBlock = this.mutatorWorkspace.newBlock('procedures_mutatorarg'); @@ -1947,14 +2117,20 @@ suite('Procedures', function() { this.connection.connect(this.argBlock.previousConnection); this.connection = this.argBlock.nextConnection; } - this.defBlock.compose(this.containerBlock); + this.clock.runAll(); } function assertArgs(argArray) { - chai.assert.equal(this.defBlock.arguments_.length, argArray.length); + chai.assert.equal( + this.defBlock.arguments_.length, + argArray.length, + 'Expected the def to have the right number of arguments'); for (let i = 0; i < argArray.length; i++) { chai.assert.equal(this.defBlock.arguments_[i], argArray[i]); } - chai.assert.equal(this.callBlock.arguments_.length, argArray.length); + chai.assert.equal( + this.callBlock.arguments_.length, + argArray.length, + 'Expected the call to have the right number of arguments'); for (let i = 0; i < argArray.length; i++) { chai.assert.equal(this.callBlock.arguments_[i], argArray[i]); } diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index 10d15560b..1dd86ab59 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -795,7 +795,7 @@ suite('JSO Serialization', function() { }); }); - suite.skip('Procedures', function() { + suite('Procedures', function() { class MockProcedureModel { constructor() { this.id = Blockly.utils.idGenerator.genUid(); diff --git a/tests/mocha/webdriver.js b/tests/mocha/webdriver.js index e7eb99bc7..e46921234 100644 --- a/tests/mocha/webdriver.js +++ b/tests/mocha/webdriver.js @@ -53,7 +53,7 @@ async function runMochaTestsInBrowser() { const text = await elem.getAttribute('tests_failed'); return text !== 'unset'; }, { - timeout: 50000, + timeout: 100000, }); const elem = await browser.$('#failureCount'); From d27f7c81b45a0597385307dfb5aefa4437d8d3e2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Sat, 7 Jan 2023 00:02:45 +0000 Subject: [PATCH 019/141] fix: undoing and redoing deleting procedures (#6722) * fix: undoing and redoing deleting procedure defs * chore: added tests for undoing and redoing procedure def deletes * fix: dragging blocks from flyout * chore: PR comments * chore: fixup from rebase --- blocks/procedures.js | 19 +++++++++++++++--- core/procedures.ts | 4 +++- tests/mocha/blocks/procedures_test.js | 29 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 419631d52..97141471a 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -308,6 +308,7 @@ const procedureDefGetDefMixin = function() { * disposed. */ destroy: function() { + if (this.isInsertionMarker()) return; this.workspace.getProcedureMap().delete(this.getProcedureModel().getId()); }, }; @@ -598,10 +599,12 @@ const procedureDefMutator = { * parameters and statements. */ saveExtraState: function() { - const params = this.getProcedureModel().getParameters(); - if (!params.length && this.hasStatements_) return null; - const state = Object.create(null); + state['procedureId'] = this.getProcedureModel().getId(); + + const params = this.getProcedureModel().getParameters(); + if (!params.length && this.hasStatements_) return state; + if (params.length) { state['params'] = params.map((p) => { return { @@ -625,6 +628,16 @@ const procedureDefMutator = { * statements. */ loadExtraState: function(state) { + const map = this.workspace.getProcedureMap(); + const procedureId = state['procedureId']; + if (procedureId && procedureId != this.model_.getId() && + map.has(procedureId)) { + if (map.has(this.model_.getId())) { + map.delete(this.model_.getId()); + } + this.model_ = map.get(procedureId); + } + if (state['params']) { for (let i = 0; i < state['params'].length; i++) { const {name, id, paramId} = state['params'][i]; diff --git a/core/procedures.ts b/core/procedures.ts index ef7e32062..5369b61bd 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -193,7 +193,9 @@ export function rename(this: Field, name: string): string { name = name.trim(); const legalName = findLegalName(name, block); - if (isProcedureBlock(block)) block.getProcedureModel().setName(legalName); + if (isProcedureBlock(block) && !block.isInsertionMarker()) { + block.getProcedureModel().setName(legalName); + } const oldName = this.getValue(); if (oldName !== name && oldName !== legalName) { // Rename any callers. diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 7e4f9a3fa..b2ccdfa4a 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -1338,6 +1338,35 @@ suite('Procedures', function() { chai.assert.isTrue( callBlock2.disposed, 'Expected the second caller to be disposed'); }); + + test('undoing and redoing a procedure delete will still associate ' + + 'procedure and caller with the same model', + function() { + const defBlock = createProcDefBlock(this.workspace); + createProcCallBlock(this.workspace); + // TODO: Apparently we need to call checkAndDelete to handle event + // grouping, this seems like possibly a bug. + const oldModel = defBlock.getProcedureModel(); + defBlock.checkAndDelete(); + this.clock.runAll(); + + this.workspace.undo(); + this.clock.runAll(); + + const newDefBlock = + this.workspace.getBlocksByType('procedures_defnoreturn')[0]; + const newCallBlock = + this.workspace.getBlocksByType('procedures_callnoreturn')[0]; + + chai.assert.equal( + newDefBlock.getProcedureModel(), + newCallBlock.getProcedureModel(), + 'Expected both new blocks to be associated with the same model'); + chai.assert.equal( + oldModel.getId(), + newDefBlock.getProcedureModel().getId(), + 'Expected the new model to have the same ID as the old model'); + }); }); suite('caller blocks creating new def blocks', function() { From 4ff3604da70f4b96134d0ff89e8037605205555f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 09:49:39 +0000 Subject: [PATCH 020/141] chore(deps): bump selenium-standalone from 8.2.4 to 8.2.5 (#6741) Bumps [selenium-standalone](https://github.com/webdriverio/selenium-standalone) from 8.2.4 to 8.2.5. - [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.4...v8.2.5) --- 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 ecd42fc3f..30627d8fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10774,9 +10774,9 @@ "dev": true }, "node_modules/selenium-standalone": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.4.tgz", - "integrity": "sha512-VXkiQFAmXGlcE6X5A9dakXbXuxJONqG/t39Cw4ylk7J+hxIYBk/yfJ0Tkh2P0X9QGRpcUfr0hgE0PHDil0nFiA==", + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.5.tgz", + "integrity": "sha512-HdBQXNIc1G7zUWaQUMfilFRiHJ2d9G3WGYpJyPMXVWQro/dJfrAD1kexH1o7nEk/Ua9FTJ9SoKcYYpYhuSVcfA==", "dev": true, "dependencies": { "commander": "^9.0.0", @@ -21551,9 +21551,9 @@ "dev": true }, "selenium-standalone": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.4.tgz", - "integrity": "sha512-VXkiQFAmXGlcE6X5A9dakXbXuxJONqG/t39Cw4ylk7J+hxIYBk/yfJ0Tkh2P0X9QGRpcUfr0hgE0PHDil0nFiA==", + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.5.tgz", + "integrity": "sha512-HdBQXNIc1G7zUWaQUMfilFRiHJ2d9G3WGYpJyPMXVWQro/dJfrAD1kexH1o7nEk/Ua9FTJ9SoKcYYpYhuSVcfA==", "dev": true, "requires": { "commander": "^9.0.0", From f1e5f224231fbc517590f49a432e9d95489a1cbf Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 9 Jan 2023 09:57:12 +0000 Subject: [PATCH 021/141] chore(tests): Enable testing on node.js v18.x on GitHub CI (#6619) * chore(tests): Enable testing on node.js v18.x on GitHub CI * chore(tests): Remove outdated calls to test:prepare npm script The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh` should have been removed along with that npm script in PR #4906. * chore(deps): Fix alphabetisation in package.json --- .github/workflows/build.yml | 5 +++-- package.json | 2 +- tests/scripts/setup_linux_env.sh | 1 - tests/scripts/setup_osx_env.sh | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 754aa4c11..2414a9984 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,9 @@ jobs: # TODO (#2114): re-enable osx build. # os: [ubuntu-latest, macos-latest] os: [ubuntu-latest] - node-version: [14.x, 16.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + node-version: [14.x, 16.x, 18.x] + # See supported Node.js release schedule at + # https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v3 diff --git a/package.json b/package.json index 9dadaf9a5..0f3750183 100644 --- a/package.json +++ b/package.json @@ -89,8 +89,8 @@ "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", "gulp-concat": "^2.6.1", - "gulp-header": "^2.0.9", "gulp-gzip": "^1.4.2", + "gulp-header": "^2.0.9", "gulp-insert": "^0.5.0", "gulp-rename": "^2.0.0", "gulp-replace": "^1.0.0", diff --git a/tests/scripts/setup_linux_env.sh b/tests/scripts/setup_linux_env.sh index 3a24ac784..a27c53c77 100755 --- a/tests/scripts/setup_linux_env.sh +++ b/tests/scripts/setup_linux_env.sh @@ -4,5 +4,4 @@ if [ "${RUNNER_OS}" == "Linux" ] then Xvfb :99 & export DISPLAY=:99 & - npm run test:prepare > /dev/null & fi diff --git a/tests/scripts/setup_osx_env.sh b/tests/scripts/setup_osx_env.sh index 9b32d5564..76c3461f9 100755 --- a/tests/scripts/setup_osx_env.sh +++ b/tests/scripts/setup_osx_env.sh @@ -3,5 +3,4 @@ if [ "${RUNNER_OS}" == "macOS" ] then export CHROME_BIN="/Applications/Google Chrome.app" - npm run test:prepare > /dev/null & fi From 5dbcaeb4e2cddb57e8fe62ce0a667b7e26ea5af1 Mon Sep 17 00:00:00 2001 From: Samriddhi Date: Mon, 9 Jan 2023 23:21:13 +0530 Subject: [PATCH 022/141] fix: change assertFieldValue in test helpers to use deepEqual (#6739) --- tests/mocha/field_angle_test.js | 4 ++-- tests/mocha/field_number_test.js | 6 +++--- tests/mocha/test_helpers/fields.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index d23acd80e..30af8340d 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -126,7 +126,7 @@ suite('Angle Fields', function() { function() { return null; }, - value: 2, expectedValue: 1}, + value: 2, expectedValue: '1'}, {title: 'Force Mult of 30 Validator', validator: function(newValue) { @@ -150,7 +150,7 @@ suite('Angle Fields', function() { }); test('When Not Editing', function() { this.field.setValue(suiteInfo.value); - assertFieldValue(this.field, suiteInfo.expectedValue); + assertFieldValue(this.field, +suiteInfo.expectedValue); }); }); }); diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index 23b112c81..93ece7a1c 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -202,11 +202,11 @@ suite('Number Fields', function() { function() { return null; }, - value: 2, expectedValue: 1}, + value: 2, expectedValue: '1'}, {title: 'Force End with 6 Validator', validator: function(newValue) { - return String(newValue).replace(/.$/, '6'); + return +String(newValue).replace(/.$/, '6'); }, value: 25, expectedValue: 26}, {title: 'Returns Undefined Validator', validator: function() {}, value: 2, @@ -226,7 +226,7 @@ suite('Number Fields', function() { }); test('When Not Editing', function() { this.field.setValue(suiteInfo.value); - assertFieldValue(this.field, suiteInfo.expectedValue); + assertFieldValue(this.field, +suiteInfo.expectedValue); }); }); }); diff --git a/tests/mocha/test_helpers/fields.js b/tests/mocha/test_helpers/fields.js index 8d796d4a6..f3f6b7315 100644 --- a/tests/mocha/test_helpers/fields.js +++ b/tests/mocha/test_helpers/fields.js @@ -73,8 +73,8 @@ export function assertFieldValue(field, expectedValue, expectedText = undefined) if (expectedText === undefined) { expectedText = String(expectedValue); } - chai.assert.equal(actualValue, expectedValue, 'Value'); - chai.assert.equal(actualText, expectedText, 'Text'); + chai.assert.deepEqual(actualValue, expectedValue); + chai.assert.deepEqual(actualText, expectedText); } /** From 8978f573d31cb72362d28599a6698c8217d87d94 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 10 Jan 2023 00:22:24 +0000 Subject: [PATCH 023/141] chore: delete old proc data code (#6736) * chore: refactor getVars and getVarModels * chore: cleanup renaming procedures * fix: updating params in mutator * chore: remove dead visual update code * chore: fix test assertions * chore: move context menu to use procedure model * fix: renaming early parameters not applying * chore: remove data update code * chore: remove references to argumnets from caller serialization * chore: remove extraneous visual update code * chore: remove delete event listener * chore: remove last unused data attributes * fix: creating procedure defs with params from callers * chore: format * chore: cleanup from rebase * chore: format * chore: remove logs * chore: fix PR comments * chore: cleanup * chore: make hasReturn_ private --- blocks/procedures.js | 438 ++++-------------- core/procedures/observable_procedure_model.ts | 32 +- core/procedures/update_procedures.ts | 3 + tests/mocha/blocks/procedures_test.js | 250 +++++++++- tests/mocha/test_helpers/serialization.js | 4 +- 5 files changed, 356 insertions(+), 371 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 97141471a..523003f7e 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -36,6 +36,7 @@ const {Msg} = goog.require('Blockly.Msg'); const {Mutator} = goog.require('Blockly.Mutator'); const {Names} = goog.require('Blockly.Names'); const serialization = goog.require('Blockly.serialization'); +const {triggerProceduresUpdate} = goog.require('Blockly.procedures.updateProcedures'); /* eslint-disable-next-line no-unused-vars */ const {VariableModel} = goog.requireType('Blockly.VariableModel'); /* eslint-disable-next-line no-unused-vars */ @@ -112,8 +113,8 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'extensions': [ 'procedure_caller_get_def_mixin', 'procedure_caller_update_shape_mixin', - 'procedure_caller_onchange_mixin', 'procedure_caller_context_menu_mixin', + 'procedure_caller_onchange_mixin', 'procedure_callernoreturn_get_def_block_mixin', ], 'mutator': 'procedure_caller_mutator', @@ -185,8 +186,8 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'extensions': [ 'procedure_caller_get_def_mixin', 'procedure_caller_update_shape_mixin', - 'procedure_caller_onchange_mixin', 'procedure_caller_context_menu_mixin', + 'procedure_caller_onchange_mixin', 'procedure_callerreturn_get_def_block_mixin', ], 'mutator': 'procedure_caller_mutator', @@ -291,7 +292,8 @@ const procedureDefGetDefMixin = function() { * @this {Block} */ getVars: function() { - return this.arguments_; + return this.getProcedureModel().getParameters().map( + (p) => p.getVariableModel().name); }, /** @@ -300,7 +302,8 @@ const procedureDefGetDefMixin = function() { * @this {Block} */ getVarModels: function() { - return this.argumentVarModels_; + return this.getProcedureModel().getParameters().map( + (p) => p.getVariableModel()); }, /** @@ -338,26 +341,18 @@ const procedureDefVarMixin = function() { * @this {Block} */ renameVarById: function(oldId, newId) { - const oldVariable = this.workspace.getVariableById(oldId); - if (oldVariable.type !== '') { - // Procedure arguments always have the empty type. - return; - } - const oldName = oldVariable.name; + const oldVar = this.workspace.getVariableById(oldId); + const model = this.getProcedureModel(); + const index = model.getParameters().findIndex( + (p) => p.getVariableModel() === oldVar); + if (index === -1) return; // Not found. const newVar = this.workspace.getVariableById(newId); - - let change = false; - for (let i = 0; i < this.argumentVarModels_.length; i++) { - if (this.argumentVarModels_[i].getId() === oldId) { - this.arguments_[i] = newVar.name; - this.argumentVarModels_[i] = newVar; - change = true; - } - } - if (change) { - this.displayRenamedVar_(oldName, newVar.name); - Procedures.mutateCallers(this); - } + const oldParam = model.getParameter(index); + model.deleteParameter(index); + model.insertParameter( + new ObservableParameterModel( + this.workspace, newVar.name, oldParam.getId()), + index); }, /** @@ -369,19 +364,10 @@ const procedureDefVarMixin = function() { * @this {Block} */ updateVarName: function(variable) { - const newName = variable.name; - let change = false; - let oldName; - for (let i = 0; i < this.argumentVarModels_.length; i++) { - if (this.argumentVarModels_[i].getId() === variable.getId()) { - oldName = this.arguments_[i]; - this.arguments_[i] = newName; - change = true; - } - } - if (change) { - this.displayRenamedVar_(oldName, newName); - Procedures.mutateCallers(this); + const containsVar = this.getProcedureModel().getParameters().some( + (p) => p.getVariableModel() === variable); + if (containsVar) { + triggerProceduresUpdate(this.workspace); } }, }; @@ -400,6 +386,7 @@ const procedureDefUpdateShapeMixin = { this.setFieldValue(this.getProcedureModel().getName(), 'NAME'); this.setEnabled(this.getProcedureModel().getEnabled()); this.updateParameters_(); + this.updateMutator_(); }, /** @@ -422,6 +409,23 @@ const procedureDefUpdateShapeMixin = { } }, + /** + * Updates the parameter blocks in the mutator (if it is open) to reflect + * the state of the procedure model. + */ + updateMutator_: function() { + if (!this.mutator?.isVisible()) return; + + const mutatorWorkspace = this.mutator.getWorkspace(); + for (const p of this.getProcedureModel().getParameters()) { + const block = mutatorWorkspace.getBlockById(p.getId()); + if (!block) continue; // Should not happen. + if (block.getFieldValue('NAME') !== p.getName()) { + block.setFieldValue(p.getName(), 'NAME'); + } + } + }, + /** * Add or remove the statement block from this function definition. * @param {boolean} hasStatements True if a statement block is needed. @@ -453,49 +457,6 @@ const procedureDefUpdateShapeMixin = { } this.hasStatements_ = hasStatements; }, - - /** - * Update the display of parameters for this procedure definition block. - * @private - * @this {Block} - */ - updateParams_: function() { - // Merge the arguments into a human-readable list. - let paramString = ''; - if (this.arguments_.length) { - paramString = - Msg['PROCEDURES_BEFORE_PARAMS'] + ' ' + this.arguments_.join(', '); - } - // The params field is deterministic based on the mutation, - // no need to fire a change event. - Events.disable(); - try { - this.setFieldValue(paramString, 'PARAMS'); - } finally { - Events.enable(); - } - }, - - /** - * Update the display to reflect a newly renamed argument. - * @param {string} oldName The old display name of the argument. - * @param {string} newName The new display name of the argument. - * @private - * @this {Block} - */ - displayRenamedVar_: function(oldName, newName) { - this.updateParams_(); - // Update the mutator's variables if the mutator is open. - if (this.mutator && this.mutator.isVisible()) { - const blocks = this.mutator.workspace_.getAllBlocks(false); - for (let i = 0, block; (block = blocks[i]); i++) { - if (block.type === 'procedures_mutatorarg' && - Names.equals(oldName, block.getFieldValue('NAME'))) { - block.setFieldValue(newName, 'NAME'); - } - } - } - }, }; Extensions.registerMixin( 'procedure_def_update_shape_mixin', procedureDefUpdateShapeMixin); @@ -510,10 +471,6 @@ Extensions.register( 'procedure_def_validator_helper', procedureDefValidatorHelper); const procedureDefMutator = { - arguments_: [], - - argumentVarModels_: [], - hasStatements_: true, /** @@ -536,8 +493,8 @@ const procedureDefMutator = { const varModel = params[i].getVariableModel(); parameter.setAttribute('name', varModel.name); parameter.setAttribute('varid', varModel.getId()); - if (opt_paramIds && this.paramIds_) { - parameter.setAttribute('paramId', this.paramIds_[i]); + if (opt_paramIds) { + parameter.setAttribute('paramId', params[i].getId()); } container.appendChild(parameter); } @@ -565,31 +522,10 @@ const procedureDefMutator = { this.workspace, node.getAttribute('name'), undefined, varId), i); } - - // TODO: Remove this data update code. - this.arguments_ = []; - this.argumentVarModels_ = []; - for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { - if (childNode.nodeName.toLowerCase() === 'arg') { - const varName = childNode.getAttribute('name'); - const varId = - childNode.getAttribute('varid') || childNode.getAttribute('varId'); - this.arguments_.push(varName); - const variable = Variables.getOrCreateVariablePackage( - this.workspace, varId, varName, ''); - if (variable !== null) { - this.argumentVarModels_.push(variable); - } else { - console.log( - `Failed to create a variable named "${varName}", ignoring.`); - } - } - } - this.updateParams_(); - Procedures.mutateCallers(this); - - // Show or hide the statement input. this.setStatements_(xmlElement.getAttribute('statements') !== 'false'); + + // Call mutate callers for backwards compatibility. + Procedures.mutateCallers(this); }, /** @@ -646,21 +582,10 @@ const procedureDefMutator = { } } - // TODO: Remove this data update code. - this.arguments_ = []; - this.argumentVarModels_ = []; - if (state['params']) { - for (let i = 0; i < state['params'].length; i++) { - const param = state['params'][i]; - const variable = Variables.getOrCreateVariablePackage( - this.workspace, param['id'], param['name'], ''); - this.arguments_.push(variable.name); - this.argumentVarModels_.push(variable); - } - } - this.updateParams_(); - Procedures.mutateCallers(this); this.setStatements_(state['hasStatements'] === false ? false : true); + + // Call mutate callers for backwards compatibility. + Procedures.mutateCallers(this); }, /** @@ -711,35 +636,15 @@ const procedureDefMutator = { * @this {Block} */ compose: function(containerBlock) { - // Parameter list. - this.arguments_ = []; - this.paramIds_ = []; - this.argumentVarModels_ = []; - - // TODO: Remove old data handling logic? - let paramBlock = containerBlock.getInputTargetBlock('STACK'); - while (paramBlock && !paramBlock.isInsertionMarker()) { - const varName = paramBlock.getFieldValue('NAME'); - this.arguments_.push(varName); - const variable = Variables.getOrCreateVariablePackage( - this.workspace, null, varName, ''); - this.argumentVarModels_.push(variable); - - this.paramIds_.push(paramBlock.id); - paramBlock = - paramBlock.nextConnection && paramBlock.nextConnection.targetBlock(); - } - this.updateParams_(); - Procedures.mutateCallers(this); - const model = this.getProcedureModel(); const count = model.getParameters().length; + model.startBulkUpdate(); for (let i = count - 1; i >= 0; i--) { model.deleteParameter(i); } let i = 0; - paramBlock = containerBlock.getInputTargetBlock('STACK'); + let paramBlock = containerBlock.getInputTargetBlock('STACK'); while (paramBlock && !paramBlock.isInsertionMarker()) { model.insertParameter( new ObservableParameterModel( @@ -749,11 +654,15 @@ const procedureDefMutator = { paramBlock.nextConnection && paramBlock.nextConnection.targetBlock(); i++; } + model.endBulkUpdate(); const hasStatements = containerBlock.getFieldValue('STATEMENTS'); if (hasStatements !== null) { this.setStatements_(hasStatements === 'TRUE'); } + + // Call mutate callers for backwards compatibility. + Procedures.mutateCallers(this); }, }; Extensions.registerMutator( @@ -776,9 +685,10 @@ const procedureDefContextMenuMixin = { option.text = Msg['PROCEDURES_CREATE_DO'].replace('%1', name); const xmlMutation = xmlUtils.createElement('mutation'); xmlMutation.setAttribute('name', name); - for (let i = 0; i < this.arguments_.length; i++) { + const params = this.getProcedureModel().getParameters(); + for (const param of params) { const xmlArg = xmlUtils.createElement('arg'); - xmlArg.setAttribute('name', this.arguments_[i]); + xmlArg.setAttribute('name', param.getName()); xmlMutation.appendChild(xmlArg); } const xmlBlock = xmlUtils.createElement('block'); @@ -788,20 +698,20 @@ const procedureDefContextMenuMixin = { options.push(option); // Add options to create getters for each parameter. - if (!this.isCollapsed()) { - for (let i = 0; i < this.argumentVarModels_.length; i++) { - const argOption = {enabled: true}; - const argVar = this.argumentVarModels_[i]; - argOption.text = - Msg['VARIABLES_SET_CREATE_GET'].replace('%1', argVar.name); + if (this.isCollapsed()) return; - const argXmlField = Variables.generateVariableFieldDom(argVar); - const argXmlBlock = xmlUtils.createElement('block'); - argXmlBlock.setAttribute('type', 'variables_get'); - argXmlBlock.appendChild(argXmlField); - argOption.callback = ContextMenu.callbackFactory(this, argXmlBlock); - options.push(argOption); - } + for (const param of params) { + const argOption = {enabled: true}; + const argVar = param.getVariableModel(); + argOption.text = + Msg['VARIABLES_SET_CREATE_GET'].replace('%1', argVar.name); + + const argXmlField = Variables.generateVariableFieldDom(argVar); + const argXmlBlock = xmlUtils.createElement('block'); + argXmlBlock.setAttribute('type', 'variables_get'); + argXmlBlock.appendChild(argXmlField); + argOption.callback = ContextMenu.callbackFactory(this, argXmlBlock); + options.push(argOption); } }, }; @@ -855,7 +765,7 @@ const procedureDefNoReturnGetCallerBlockMixin = { * @this {Block} */ getProcedureDef: function() { - return [this.getFieldValue('NAME'), this.arguments_, false]; + return [this.getFieldValue('NAME'), this.getVars(), false]; }, callType_: 'procedures_callnoreturn', @@ -874,7 +784,7 @@ const procedureDefReturnGetCallerBlockMixin = { * @this {Block} */ getProcedureDef: function() { - return [this.getFieldValue('NAME'), this.arguments_, true]; + return [this.getFieldValue('NAME'), this.getVars(), true]; }, callType_: 'procedures_callreturn', @@ -1031,6 +941,10 @@ const procedureCallerGetDefMixin = function() { (proc) => proc.getName() === name); if (!model) return null; + const returnTypes = model.getReturnTypes(); + const hasMatchingReturn = this.hasReturn_ ? returnTypes : !returnTypes; + if (!hasMatchingReturn) return null; + const hasMatchingParams = model.getParameters().every((p, i) => p.getName() === params[i]); if (!hasMatchingParams) return null; @@ -1049,6 +963,7 @@ const procedureCallerGetDefMixin = function() { createDef_(name, params = []) { const xy = this.getRelativeToSurfaceXY(); const newName = Procedures.findLegalName(name, this); + this.renameProcedure(name, newName); const blockDef = { 'type': this.defType_, @@ -1060,7 +975,7 @@ const procedureCallerGetDefMixin = function() { 'fields': {'NAME': newName}, }; return serialization.blocks.append(blockDef, this.getTargetWorkspace_()) - .getProcedureModel(); + .getProcedureModel(); }, /** @@ -1111,14 +1026,6 @@ Extensions.register( 'procedure_caller_get_def_mixin', procedureCallerGetDefMixin); const procedureCallerMutator = { - arguments_: [], - - argumentVarModels_: [], - - quarkConnections_: {}, - - quarkIds_: null, - previousEnabledState_: true, paramsFromSerializedState_: [], @@ -1131,11 +1038,14 @@ const procedureCallerMutator = { */ mutationToDom: function() { const container = xmlUtils.createElement('mutation'); - container.setAttribute('name', this.getProcedureCall()); - for (let i = 0; i < this.arguments_.length; i++) { - const parameter = xmlUtils.createElement('arg'); - parameter.setAttribute('name', this.arguments_[i]); - container.appendChild(parameter); + const model = this.getProcedureModel(); + if (!model) return container; + + container.setAttribute('name', model.getName()); + for (const param of model.getParameters()) { + const arg = xmlUtils.createElement('arg'); + arg.setAttribute('name', param.getName()); + container.appendChild(arg); } return container; }, @@ -1164,9 +1074,11 @@ const procedureCallerMutator = { */ saveExtraState: function() { const state = Object.create(null); - state['name'] = this.getProcedureCall(); - if (this.arguments_.length) { - state['params'] = this.arguments_; + const model = this.getProcedureModel(); + if (!model) return state; + state['name'] = model.getName(); + if (model.getParameters().length) { + state['params'] = model.getParameters().map((p) => p.getName()); } return state; }, @@ -1191,14 +1103,10 @@ const procedureCallerMutator = { if (this.getProcedureModel()) { this.initBlockWithProcedureModel_(); } else { - // We need to create/find our procedure def in our change listener. - this.paramsFromSerializedState_ = params; // Create inputs based on the mutation so that children can be connected. this.createArgInputs_(params); } - - // Temporarily maintained for logic that relies on arguments_ - this.arguments_ = params; + this.paramsFromSerializedState_ = params; }, }; Extensions.registerMutator('procedure_caller_mutator', procedureCallerMutator); @@ -1225,10 +1133,6 @@ const procedureCallerUpdateShapeMixin = { this.updateName_(); this.updateEnabled_(); this.updateParameters_(); - - // Temporarily maintained for code that relies on arguments_ - this.arguments_ = - this.getProcedureModel().getParameters().map((p) => p.getName()); }, /** @@ -1351,148 +1255,6 @@ const procedureCallerUpdateShapeMixin = { this.setTooltip(baseMsg.replace('%1', newName)); } }, - - /** - * Notification that the procedure's parameters have changed. - * @param {!Array} paramNames New param names, e.g. ['x', 'y', 'z']. - * @param {!Array} paramIds IDs of params (consistent for each - * parameter through the life of a mutator, regardless of param renaming), - * e.g. ['piua', 'f8b_', 'oi.o']. - * @private - * @this {Block} - */ - setProcedureParameters_: function(paramNames, paramIds) { - // Data structures: - // this.arguments = ['x', 'y'] - // Existing param names. - // this.quarkConnections_ {piua: null, f8b_: Connection} - // Look-up of paramIds to connections plugged into the call block. - // this.quarkIds_ = ['piua', 'f8b_'] - // Existing param IDs. - // Note that quarkConnections_ may include IDs that no longer exist, but - // which might reappear if a param is reattached in the mutator. - const defBlock = - Procedures.getDefinition(this.getProcedureCall(), this.workspace); - const mutatorOpen = - defBlock && defBlock.mutator && defBlock.mutator.isVisible(); - if (!mutatorOpen) { - this.quarkConnections_ = {}; - this.quarkIds_ = null; - } else { - // fix #6091 - this call could cause an error when outside if-else - // expanding block while mutating prevents another error (ancient fix) - this.setCollapsed(false); - } - // Test arguments (arrays of strings) for changes. '\n' is not a valid - // argument name character, so it is a valid delimiter here. - if (paramNames.join('\n') === this.arguments_.join('\n')) { - // No change. - this.quarkIds_ = paramIds; - return; - } - if (paramIds.length !== paramNames.length) { - throw RangeError('paramNames and paramIds must be the same length.'); - } - if (!this.quarkIds_) { - // Initialize tracking for this block. - this.quarkConnections_ = {}; - this.quarkIds_ = []; - } - // Switch off rendering while the block is rebuilt. - const savedRendered = this.rendered; - this.rendered = false; - // Update the quarkConnections_ with existing connections. - for (let i = 0; i < this.arguments_.length; i++) { - const input = this.getInput('ARG' + i); - if (input) { - const connection = input.connection.targetConnection; - this.quarkConnections_[this.quarkIds_[i]] = connection; - if (mutatorOpen && connection && - paramIds.indexOf(this.quarkIds_[i]) === -1) { - // This connection should no longer be attached to this block. - connection.disconnect(); - connection.getSourceBlock().bumpNeighbours(); - } - } - } - // Rebuild the block's arguments. - this.arguments_ = [].concat(paramNames); - // And rebuild the argument model list. - this.argumentVarModels_ = []; - for (let i = 0; i < this.arguments_.length; i++) { - const variable = Variables.getOrCreateVariablePackage( - this.workspace, null, this.arguments_[i], ''); - this.argumentVarModels_.push(variable); - } - - this.updateShape_(); - this.quarkIds_ = paramIds; - // Reconnect any child blocks. - if (this.quarkIds_) { - for (let i = 0; i < this.arguments_.length; i++) { - const quarkId = this.quarkIds_[i]; - if (quarkId in this.quarkConnections_) { - const connection = this.quarkConnections_[quarkId]; - if (!Mutator.reconnect(connection, this, 'ARG' + i)) { - // Block no longer exists or has been attached elsewhere. - delete this.quarkConnections_[quarkId]; - } - } - } - } - // Restore rendering and show the changes. - this.rendered = savedRendered; - if (this.rendered) { - this.render(); - } - }, - - /** - * Modify this block to have the correct number of arguments. - * @private - * @this {Block} - */ - updateShape_: function() { - for (let i = 0; i < this.arguments_.length; i++) { - const argField = this.getField('ARGNAME' + i); - if (argField) { - // Ensure argument name is up to date. - // The argument name field is deterministic based on the mutation, - // no need to fire a change event. - Events.disable(); - try { - argField.setValue(this.arguments_[i]); - } finally { - Events.enable(); - } - } else { - // Add new input. - const newField = new FieldLabel(this.arguments_[i]); - const input = this.appendValueInput('ARG' + i) - .setAlign(Align.RIGHT) - .appendField(newField, 'ARGNAME' + i); - input.init(); - } - } - // Remove deleted inputs. - for (let i = this.arguments_.length; this.getInput('ARG' + i); i++) { - this.removeInput('ARG' + i); - } - // Add 'with:' if there are parameters, remove otherwise. - const topRow = this.getInput('TOPROW'); - if (topRow) { - if (this.arguments_.length) { - if (!this.getField('WITH')) { - topRow.appendField(Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH'); - topRow.init(); - } - } else { - if (this.getField('WITH')) { - topRow.removeField('WITH'); - } - } - } - }, }; Extensions.registerMixin( 'procedure_caller_update_shape_mixin', procedureCallerUpdateShapeMixin); @@ -1535,23 +1297,13 @@ const procedureCallerOnChangeMixin = { this.getFieldValue('NAME'), this.paramsFromSerializedState_); } this.initBlockWithProcedureModel_(); - } else if (event.type === Events.BLOCK_DELETE && event.blockId != this.id) { - // Look for the case where a procedure definition has been deleted, - // leaving this block (a procedure call) orphaned. In this case, delete - // the orphan. - const name = this.getProcedureCall(); - const def = Procedures.getDefinition(name, this.workspace); - if (!def) { - Events.setGroup(event.group); - this.dispose(true); - Events.setGroup(false); - } } }, defMatches_(defBlock) { return defBlock && defBlock.type === this.defType_ && - JSON.stringify(defBlock.getVars()) === JSON.stringify(this.arguments_); + JSON.stringify(defBlock.getVars()) === + JSON.stringify(this.paramsFromSerializedState_); }, }; Extensions.registerMixin( @@ -1588,6 +1340,7 @@ Extensions.registerMixin( 'procedure_caller_context_menu_mixin', procedureCallerContextMenuMixin); const procedureCallerNoReturnGetDefBlockMixin = { + hasReturn_: false, defType_: 'procedures_defnoreturn', }; Extensions.registerMixin( @@ -1595,6 +1348,7 @@ Extensions.registerMixin( procedureCallerNoReturnGetDefBlockMixin); const procedureCallerReturnGetDefBlockMixin = { + hasReturn_: true, defType_: 'procedures_defreturn', }; Extensions.registerMixin( diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index d7b4f1ad9..588f771e3 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -22,6 +22,7 @@ export class ObservableProcedureModel implements IProcedureModel { private returnTypes: string[]|null = null; private enabled = true; private shouldFireEvents = false; + private shouldTriggerUpdates = true; constructor( private readonly workspace: Workspace, name: string, id?: string) { @@ -34,7 +35,7 @@ export class ObservableProcedureModel implements IProcedureModel { if (name === this.name) return this; const prevName = this.name; this.name = name; - triggerProceduresUpdate(this.workspace); + if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); if (this.shouldFireEvents) { eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_RENAME))( this.workspace, this, prevName)); @@ -63,7 +64,7 @@ export class ObservableProcedureModel implements IProcedureModel { } } - triggerProceduresUpdate(this.workspace); + if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); if (this.shouldFireEvents) { eventUtils.fire( new (eventUtils.get(eventUtils.PROCEDURE_PARAMETER_CREATE))( @@ -78,7 +79,7 @@ export class ObservableProcedureModel implements IProcedureModel { const oldParam = this.parameters[index]; this.parameters.splice(index, 1); - triggerProceduresUpdate(this.workspace); + if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); if (isObservable(oldParam)) { oldParam.stopPublishing(); } @@ -110,7 +111,7 @@ export class ObservableProcedureModel implements IProcedureModel { if (!!types === !!this.returnTypes) return this; const oldReturnTypes = this.returnTypes; this.returnTypes = types; - triggerProceduresUpdate(this.workspace); + if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); if (this.shouldFireEvents) { eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_CHANGE_RETURN))( this.workspace, this, oldReturnTypes)); @@ -125,7 +126,7 @@ export class ObservableProcedureModel implements IProcedureModel { setEnabled(enabled: boolean): this { if (enabled === this.enabled) return this; this.enabled = enabled; - triggerProceduresUpdate(this.workspace); + if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); if (this.shouldFireEvents) { eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_ENABLE))( this.workspace, this)); @@ -133,6 +134,27 @@ export class ObservableProcedureModel implements IProcedureModel { return this; } + /** + * Disables triggering updates to procedure blocks until the endBulkUpdate + * is called. + * + * @internal + */ + startBulkUpdate() { + this.shouldTriggerUpdates = false; + } + + /** + * Triggers an update to procedure blocks. Should be used with + * startBulkUpdate. + * + * @internal + */ + endBulkUpdate() { + this.shouldTriggerUpdates = true; + triggerProceduresUpdate(this.workspace); + } + /** Returns the unique language-neutral ID for the procedure. */ getId(): string { return this.id; diff --git a/core/procedures/update_procedures.ts b/core/procedures/update_procedures.ts index b355a9c56..fae2ed4c4 100644 --- a/core/procedures/update_procedures.ts +++ b/core/procedures/update_procedures.ts @@ -4,9 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +import * as goog from '../../closure/goog/goog.js'; import {isProcedureBlock} from '../interfaces/i_procedure_block.js'; import {Workspace} from '../workspace.js'; +goog.declareModuleId('Blockly.procedures.updateProcedures'); + /** * Calls the `doProcedureUpdate` method on all blocks which implement it. diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index b2ccdfa4a..ae8a5ba2c 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -992,6 +992,33 @@ suite('Procedures', function() { 'Expected the params field to contain the new name of the param'); }); + test('defs are updated for parameter renames when two params exist', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = mutatorWorkspace.getTopBlocks()[0]; + const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock1.setFieldValue('param1', 'NAME'); + const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock2.setFieldValue('param2', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock1.previousConnection); + paramBlock1.nextConnection.connect(paramBlock2.previousConnection); + this.clock.runAll(); + + paramBlock1.setFieldValue('new name', 'NAME'); + this.clock.runAll(); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('new name'), + 'Expected the params field to contain the new name of the param'); + }); + test('callers are updated for parameter renames', function() { // Create a stack of container, parameter. const defBlock = createProcDefBlock(this.workspace); @@ -1048,7 +1075,8 @@ suite('Procedures', function() { const containerBlock = mutatorWorkspace.getTopBlocks()[0]; const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock.setFieldValue('param1', 'NAME'); - containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); @@ -1063,6 +1091,29 @@ suite('Procedures', function() { 'Expected the params field to contain the new name of the param'); }); + test( + 'renaming a variable associated with a parameter updates mutator parameters', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = mutatorWorkspace.getTopBlocks()[0]; + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + this.clock.runAll(); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'new name'); + + chai.assert.equal( + paramBlock.getFieldValue('NAME'), + 'new name', + 'Expected the params field to contain the new name of the param'); + }); + test( 'renaming a variable associated with a parameter updates procedure callers', function() { @@ -1074,7 +1125,8 @@ suite('Procedures', function() { const containerBlock = mutatorWorkspace.getTopBlocks()[0]; const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); paramBlock.setFieldValue('param1', 'NAME'); - containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); @@ -1090,6 +1142,83 @@ suite('Procedures', function() { 'Expected the params field to match the name of the new param'); }); + test( + 'coalescing a variable associated with a parameter updates procedure defs', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = mutatorWorkspace.getTopBlocks()[0]; + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + this.clock.runAll(); + defBlock.mutator.setVisible(false); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); + + chai.assert.isNotNull( + defBlock.getField('PARAMS'), + 'Expected the params field to exist'); + chai.assert.isTrue( + defBlock.getFieldValue('PARAMS').includes('preCreatedVar'), + 'Expected the params field to contain the new name of the param'); + }); + + test( + 'coalescing a variable associated with a parameter updates mutator parameters', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = mutatorWorkspace.getTopBlocks()[0]; + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + this.clock.runAll(); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); + + chai.assert.equal( + paramBlock.getFieldValue('NAME'), + 'preCreatedVar', + 'Expected the params field to contain the new name of the param'); + }); + + test( + 'coalescing a variable associated with a parameter updates procedure callers', + function() { + // Create a stack of container, parameter. + const defBlock = createProcDefBlock(this.workspace); + const callBlock = createProcCallBlock(this.workspace); + defBlock.mutator.setVisible(true); + const mutatorWorkspace = defBlock.mutator.getWorkspace(); + const containerBlock = mutatorWorkspace.getTopBlocks()[0]; + const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); + paramBlock.setFieldValue('param1', 'NAME'); + containerBlock.getInput('STACK').connection + .connect(paramBlock.previousConnection); + this.clock.runAll(); + defBlock.mutator.setVisible(false); + + const variable = this.workspace.getVariable('param1', ''); + this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); + + chai.assert.isNotNull( + callBlock.getInput('ARG0'), + 'Expected the param input to exist'); + chai.assert.equal( + callBlock.getFieldValue('ARGNAME0'), + 'preCreatedVar', + 'Expected the params field to match the name of the new param'); + }); + test.skip( 'renaming a variable such that you get a parameter ' + 'conflict does... something!', @@ -1377,10 +1506,10 @@ suite('Procedures', function() { suite('xml', function() { test('callers without defs create new defs', function() { - const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( - '' + - '' + - '' + const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom(` + + + ` ), this.workspace); this.clock.runAll(); assertDefBlockStructure( @@ -1388,7 +1517,7 @@ suite('Procedures', function() { assertCallBlockStructure(callBlock, [], [], 'do something'); }); - test('callers without mutations create unamed defs', function() { + test('callers without mutations create unnamed defs', function() { const callBlock = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( '' ), this.workspace); @@ -1595,6 +1724,57 @@ suite('Procedures', function() { }); }); + suite('definition block context menu', function() { + test('the context menu includes an option for creating the caller', function() { + const def = Blockly.serialization.blocks.append({ + 'type': 'procedures_defnoreturn', + 'fields': { + 'NAME': 'test name', + }, + }, this.workspace); + + const options = []; + def.customContextMenu(options); + + chai.assert.isTrue( + options[0].text.includes('test name'), + 'Expected the context menu to have an option to create the caller'); + }); + + test('the context menu includes an option for each parameter', function() { + const def = Blockly.serialization.blocks.append({ + 'type': 'procedures_defnoreturn', + 'fields': { + 'NAME': 'test name', + }, + 'extraState': { + 'params': [ + { + 'name': 'testParam1', + 'id': 'varId1', + 'paramId': 'paramId1', + }, + { + 'name': 'testParam2', + 'id': 'varId2', + 'paramId': 'paramId2', + }, + ], + }, + }, this.workspace); + + const options = []; + def.customContextMenu(options); + + chai.assert.isTrue( + options[1].text.includes('testParam1'), + 'Expected the context menu to have an option to create the first param'); + chai.assert.isTrue( + options[2].text.includes('testParam2'), + 'Expected the context menu to have an option to create the second param'); + }); + }); + suite('allProcedures', function() { test('Only Procedures', function() { const noReturnBlock = this.workspace.newBlock('procedures_defnoreturn'); @@ -1850,10 +2030,18 @@ suite('Procedures', function() { }); suite('rename', function() { setup(function() { - this.defBlock = this.workspace.newBlock(testSuite.defType); - this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = this.workspace.newBlock(testSuite.callType); - this.callBlock.setFieldValue('proc name', 'NAME'); + this.defBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.defType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); + this.callBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.callType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); sinon.stub(this.defBlock.getField('NAME'), 'resizeEditor_'); }); test('Simple, Programmatic', function() { @@ -1963,10 +2151,18 @@ suite('Procedures', function() { }); suite('getCallers', function() { setup(function() { - this.defBlock = this.workspace.newBlock(testSuite.defType); - this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = this.workspace.newBlock(testSuite.callType); - this.callBlock.setFieldValue('proc name', 'NAME'); + this.defBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.defType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); + this.callBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.callType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); }); test('Simple', function() { const callers = @@ -2036,10 +2232,18 @@ suite('Procedures', function() { }); suite('getDefinition', function() { setup(function() { - this.defBlock = this.workspace.newBlock(testSuite.defType); - this.defBlock.setFieldValue('proc name', 'NAME'); - this.callBlock = this.workspace.newBlock(testSuite.callType); - this.callBlock.setFieldValue('proc name', 'NAME'); + this.defBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.defType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); + this.callBlock = Blockly.serialization.blocks.append({ + 'type': testSuite.callType, + 'fields': { + 'NAME': 'proc name', + }, + }, this.workspace); }); test('Simple', function() { const def = @@ -2150,18 +2354,18 @@ suite('Procedures', function() { } function assertArgs(argArray) { chai.assert.equal( - this.defBlock.arguments_.length, + this.defBlock.getVars().length, argArray.length, 'Expected the def to have the right number of arguments'); for (let i = 0; i < argArray.length; i++) { - chai.assert.equal(this.defBlock.arguments_[i], argArray[i]); + chai.assert.equal(this.defBlock.getVars()[i], argArray[i]); } chai.assert.equal( - this.callBlock.arguments_.length, + this.callBlock.getVars().length, argArray.length, 'Expected the call to have the right number of arguments'); for (let i = 0; i < argArray.length; i++) { - chai.assert.equal(this.callBlock.arguments_[i], argArray[i]); + chai.assert.equal(this.callBlock.getVars()[i], argArray[i]); } } test('Simple Add Arg', function() { diff --git a/tests/mocha/test_helpers/serialization.js b/tests/mocha/test_helpers/serialization.js index ebc6deb5d..94fc511d5 100644 --- a/tests/mocha/test_helpers/serialization.js +++ b/tests/mocha/test_helpers/serialization.js @@ -61,7 +61,7 @@ export const runSerializationTestSuite = (testCases) => { let block; if (testCase.json) { block = Blockly.serialization.blocks.append( - testCase.json, this.workspace); + testCase.json, this.workspace, {recordUndo: true}); } else { block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( testCase.xml), this.workspace); @@ -80,12 +80,14 @@ export const runSerializationTestSuite = (testCases) => { if (testCase.json) { const block = Blockly.serialization.blocks.append( testCase.json, this.workspace); + this.clock.runAll(); const generatedJson = Blockly.serialization.blocks.save(block); const expectedJson = testCase.expectedJson || testCase.json; chai.assert.deepEqual(generatedJson, expectedJson); } else { const block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( testCase.xml), this.workspace); + this.clock.runAll(); const generatedXml = Blockly.Xml.domToPrettyText( Blockly.Xml.blockToDom(block)); From 25d9acb418dd9bc906d57a276656155b5ba18aa4 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Tue, 10 Jan 2023 13:54:51 -0800 Subject: [PATCH 024/141] fix: correct docs for flyout metrics (#6751) --- blocks/procedures.js | 2 +- core/interfaces/i_metrics_manager.ts | 14 ++++++++------ core/metrics_manager.ts | 14 ++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 523003f7e..785b0bba2 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -975,7 +975,7 @@ const procedureCallerGetDefMixin = function() { 'fields': {'NAME': newName}, }; return serialization.blocks.append(blockDef, this.getTargetWorkspace_()) - .getProcedureModel(); + .getProcedureModel(); }, /** diff --git a/core/interfaces/i_metrics_manager.ts b/core/interfaces/i_metrics_manager.ts index 923ad8035..be82b4991 100644 --- a/core/interfaces/i_metrics_manager.ts +++ b/core/interfaces/i_metrics_manager.ts @@ -47,11 +47,14 @@ export interface IMetricsManager { opt_contentMetrics?: ContainerRegion): ContainerRegion; /** - * Gets the width and the height of the flyout on the workspace in pixel - * coordinates. Returns 0 for the width and height if the workspace has a - * category toolbox instead of a simple toolbox. + * Gets the width and the height of the flyout in pixel + * coordinates. By default, will get metrics for either a simple flyout (owned + * directly by the workspace) or for the flyout owned by the toolbox. If you + * pass `opt_own` as `true` then only metrics for the simple flyout will be + * returned, and it will return 0 for the width and height if the workspace + * has a category toolbox instead of a simple toolbox. * - * @param opt_own Whether to only return the workspace's own flyout. + * @param opt_own Whether to only return the workspace's own flyout metrics. * @returns The width and height of the flyout. */ getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics; @@ -60,8 +63,7 @@ export interface IMetricsManager { * Gets the width, height and position of the toolbox on the workspace in * pixel coordinates. Returns 0 for the width and height if the workspace has * a simple toolbox instead of a category toolbox. To get the width and height - * of a - * simple toolbox @see {@link IMetricsManager#getFlyoutMetrics}. + * of a simple toolbox, see {@link IMetricsManager#getFlyoutMetrics}. * * @returns The object with the width, height and position of the toolbox. */ diff --git a/core/metrics_manager.ts b/core/metrics_manager.ts index 7d8ba5cf9..082a8c3a9 100644 --- a/core/metrics_manager.ts +++ b/core/metrics_manager.ts @@ -55,11 +55,14 @@ export class MetricsManager implements IMetricsManager { } /** - * Gets the width and the height of the flyout on the workspace in pixel - * coordinates. Returns 0 for the width and height if the workspace has a - * category toolbox instead of a simple toolbox. + * Gets the width and the height of the flyout in pixel + * coordinates. By default, will get metrics for either a simple flyout (owned + * directly by the workspace) or for the flyout owned by the toolbox. If you + * pass `opt_own` as `true` then only metrics for the simple flyout will be + * returned, and it will return 0 for the width and height if the workspace + * has a category toolbox instead of a simple toolbox. * - * @param opt_own Whether to only return the workspace's own flyout. + * @param opt_own Whether to only return the workspace's own flyout metrics. * @returns The width and height of the flyout. */ getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics { @@ -76,8 +79,7 @@ export class MetricsManager implements IMetricsManager { * Gets the width, height and position of the toolbox on the workspace in * pixel coordinates. Returns 0 for the width and height if the workspace has * a simple toolbox instead of a category toolbox. To get the width and height - * of a - * simple toolbox @see {@link MetricsManager#getFlyoutMetrics}. + * of a simple toolbox, see {@link MetricsManager#getFlyoutMetrics}. * * @returns The object with the width, height and position of the toolbox. */ From 0fb64a6772bfa3a57c0736f551d96a99fced98ec Mon Sep 17 00:00:00 2001 From: Blake Thomas Williams <49404493+btw17@users.noreply.github.com> Date: Tue, 10 Jan 2023 16:13:49 -0600 Subject: [PATCH 025/141] fix: replace 'AnyDuringMigration' for `core/field.ts` value functions (#6639) * chore: replace `AnyDuringMigration` for field value functions * chore: removed unnecessary `KeyboardEvent` comments and `AnyDuringMigration` casts * chore: cleaned up `doValueUpdate_` and `doClassValidation_` in `Field` subclasses * fix: updated `FieldValidator` to allow returning `undefined` and restructured `setValue` * fix: implemented initial `core/field_checkbox.ts` feedback * fix: updated `Field` to accept `U` and `undefined` and reverted subclass constructor handling of the input value * fix: reverted `getVars` to returning `string[]` and added related comment * chore: removed unnecessary comment * fix: updated `processValidation_` to no longer allow returning `undefined` * fix: removed `Un` type alias for `undefined` * chore: removed unnecessary string cast in `core/field_colour.ts` * fix: updated `doClassValidation_` not to expect `null` since it will never come up in `setValue` * fix: updated `doClassValidation_` to only allow `undefined` when the new value exists * Updated `FieldValidator` type to expect `newValue` to exist * cleanup: updated `picker` from type `Element` to type `HTMLElement` * fix: updated `doValueInvalid_` type info in `core/field_input.ts` to handle `string` and `undefined` * fix: reverted `getValue` in `core/field_checkbox.ts` to previous logic * fix: updated the `Field` constructor to allow `value` to be optional * chore: consolidated `Validation` with `FieldValidator` and `doClassValidation_` * fix: reverted generic param `U` while handling diverging user input is being discussed * fix: updated `doClassValidation_` return comment to work for TSDoc * fix: misc keyboard event function tweaks --- core/block.ts | 5 +- core/field.ts | 113 ++++++++++++++++++++++------------- core/field_angle.ts | 15 ++--- core/field_checkbox.ts | 39 ++++++------ core/field_colour.ts | 30 +++------- core/field_dropdown.ts | 9 ++- core/field_image.ts | 3 +- core/field_input.ts | 53 ++++------------ core/field_label.ts | 4 +- core/field_multilineinput.ts | 20 +++---- core/field_number.ts | 5 +- core/field_textinput.ts | 19 ++++++ core/field_variable.ts | 4 +- core/gesture.ts | 4 +- core/utils/sentinel.ts | 8 ++- 15 files changed, 169 insertions(+), 162 deletions(-) diff --git a/core/block.ts b/core/block.ts index de8f16680..14b34972e 100644 --- a/core/block.ts +++ b/core/block.ts @@ -1066,11 +1066,12 @@ export class Block implements IASTNodeLocation, IDeletable { * @returns List of variable ids. */ getVars(): string[] { - const vars = []; + const vars: string[] = []; for (let i = 0, input; input = this.inputList[i]; i++) { for (let j = 0, field; field = input.fieldRow[j]; j++) { if (field.referencesVariables()) { - vars.push(field.getValue()); + // NOTE: This only applies to `FieldVariable`, a `Field` + vars.push(field.getValue() as string); } } } diff --git a/core/field.ts b/core/field.ts index cf9148e1c..0bcf99119 100644 --- a/core/field.ts +++ b/core/field.ts @@ -45,12 +45,30 @@ import * as WidgetDiv from './widgetdiv.js'; import type {WorkspaceSvg} from './workspace_svg.js'; import * as Xml from './xml.js'; -export type FieldValidator = (value?: T) => T|null|undefined; +/** + * A function that is called to validate changes to the field's value before + * they are set. + * + * **NOTE:** Validation returns one option between `T`, `null`, and `undefined`. + * + * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values} + * @param newValue The value to be validated. + * @returns One of three instructions for setting the new value: `T`, `null`, + * or `undefined`. + * + * - `T` to set this function's returned value instead of `newValue`. + * + * - `null` to invoke `doValueInvalid_` and not set a value. + * + * - `undefined` to set `newValue` as is. + */ +export type FieldValidator = (newValue: T) => T|null|undefined; /** * Abstract class for an editable field. * * @alias Blockly.Field + * @typeParam T - The value stored on the field. */ export abstract class Field implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, @@ -76,6 +94,9 @@ export abstract class Field implements IASTNodeLocationSvg, * instead. */ static readonly SKIP_SETUP = new Sentinel(); + static isSentinel(value: T|Sentinel): value is Sentinel { + return value === Field.SKIP_SETUP; + } /** * Name of field. Unique within each block. @@ -207,9 +228,7 @@ export abstract class Field implements IASTNodeLocationSvg, /** The size of the area rendered by the field. */ this.size_ = new Size(0, 0); - if (value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(value)) return; if (opt_config) { this.configure_(opt_config); } @@ -372,7 +391,8 @@ export abstract class Field implements IASTNodeLocationSvg, * @internal */ fromXml(fieldElement: Element) { - this.setValue(fieldElement.textContent); + // Any because gremlins live here. No touchie! + this.setValue(fieldElement.textContent as any); } /** @@ -384,7 +404,8 @@ export abstract class Field implements IASTNodeLocationSvg, * @internal */ toXml(fieldElement: Element): Element { - fieldElement.textContent = this.getValue(); + // Any because gremlins live here. No touchie! + fieldElement.textContent = this.getValue() as any; return fieldElement; } @@ -619,7 +640,7 @@ export abstract class Field implements IASTNodeLocationSvg, * * @returns Validation function, or null. */ - getValidator(): Function|null { + getValidator(): FieldValidator|null { return this.validator_; } @@ -965,41 +986,37 @@ export abstract class Field implements IASTNodeLocationSvg, return; } - let validatedValue = this.doClassValidation_(newValue); - // Class validators might accidentally forget to return, we'll ignore that. - newValue = this.processValidation_(newValue, validatedValue); - if (newValue instanceof Error) { + const classValidation = this.doClassValidation_(newValue); + const classValue = this.processValidation_(newValue, classValidation); + if (classValue instanceof Error) { doLogging && console.log('invalid class validation, return'); return; } - const localValidator = this.getValidator(); - if (localValidator) { - validatedValue = localValidator.call(this, newValue); - // Local validators might accidentally forget to return, we'll ignore - // that. - newValue = this.processValidation_(newValue, validatedValue); - if (newValue instanceof Error) { - doLogging && console.log('invalid local validation, return'); - return; - } + const localValidation = this.getValidator()?.call(this, classValue); + const localValue = this.processValidation_(classValue, localValidation); + if (localValue instanceof Error) { + doLogging && console.log('invalid local validation, return'); + return; } + const source = this.sourceBlock_; if (source && source.disposed) { doLogging && console.log('source disposed, return'); return; } + const oldValue = this.getValue(); - if (oldValue === newValue) { + if (oldValue === localValue) { doLogging && console.log('same, doValueUpdate_, return'); - this.doValueUpdate_(newValue); + this.doValueUpdate_(localValue); return; } - this.doValueUpdate_(newValue); + this.doValueUpdate_(localValue); if (source && eventUtils.isEnabled()) { eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CHANGE))( - source, 'field', this.name || null, oldValue, newValue)); + source, 'field', this.name || null, oldValue, localValue)); } if (this.isDirty_) { this.forceRerender(); @@ -1015,8 +1032,7 @@ export abstract class Field implements IASTNodeLocationSvg, * @returns New value, or an Error object. */ private processValidation_( - newValue: AnyDuringMigration, - validatedValue: AnyDuringMigration): AnyDuringMigration { + newValue: AnyDuringMigration, validatedValue: T|null|undefined): T|Error { if (validatedValue === null) { this.doValueInvalid_(newValue); if (this.isDirty_) { @@ -1024,10 +1040,7 @@ export abstract class Field implements IASTNodeLocationSvg, } return Error(); } - if (validatedValue !== undefined) { - newValue = validatedValue; - } - return newValue; + return validatedValue === undefined ? newValue as T : validatedValue; } /** @@ -1035,23 +1048,39 @@ export abstract class Field implements IASTNodeLocationSvg, * * @returns Current value. */ - getValue(): AnyDuringMigration { + getValue(): T|null { return this.value_; } /** - * Used to validate a value. Returns input by default. Can be overridden by - * subclasses, see FieldDropdown. + * Validate the changes to a field's value before they are set. See + * **FieldDropdown** for an example of subclass implementation. * - * @param opt_newValue The value to be validated. - * @returns The validated value, same as input by default. + * **NOTE:** Validation returns one option between `T`, `null`, and + * `undefined`. **Field**'s implementation will never return `undefined`, but + * it is valid for a subclass to return `undefined` if the new value is + * compatible with `T`. + * + * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values} + * @param newValue - The value to be validated. + * @returns One of three instructions for setting the new value: `T`, `null`, + * or `undefined`. + * + * - `T` to set this function's returned value instead of `newValue`. + * + * - `null` to invoke `doValueInvalid_` and not set a value. + * + * - `undefined` to set `newValue` as is. */ - protected doClassValidation_(opt_newValue?: AnyDuringMigration): - AnyDuringMigration { - if (opt_newValue === null || opt_newValue === undefined) { + protected doClassValidation_(newValue: T): T|null|undefined; + protected doClassValidation_(newValue?: AnyDuringMigration): T|null; + protected doClassValidation_(newValue?: T|AnyDuringMigration): T|null + |undefined { + if (newValue === null || newValue === undefined) { return null; } - return opt_newValue; + + return newValue as T; } /** @@ -1060,7 +1089,7 @@ export abstract class Field implements IASTNodeLocationSvg, * * @param newValue The value to be saved. */ - protected doValueUpdate_(newValue: AnyDuringMigration) { + protected doValueUpdate_(newValue: T) { this.value_ = newValue; this.isDirty_ = true; } @@ -1086,7 +1115,7 @@ export abstract class Field implements IASTNodeLocationSvg, } const gesture = (this.sourceBlock_.workspace as WorkspaceSvg).getGesture(e); if (gesture) { - gesture.setStartField(this as Field); + gesture.setStartField(this); } } diff --git a/core/field_angle.ts b/core/field_angle.ts index 448147c65..70cce0f4e 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -137,9 +137,7 @@ export class FieldAngle extends FieldInput { opt_config?: FieldAngleConfig) { super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } @@ -404,25 +402,24 @@ export class FieldAngle extends FieldInput { * * @param e Keyboard event. */ - protected override onHtmlInputKeyDown_(e: Event) { + protected override onHtmlInputKeyDown_(e: KeyboardEvent) { super.onHtmlInputKeyDown_(e); const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); } - const keyboardEvent = e as KeyboardEvent; let multiplier; - if (keyboardEvent.keyCode === KeyCodes.LEFT) { + if (e.keyCode === KeyCodes.LEFT) { // decrement (increment in RTL) multiplier = block.RTL ? 1 : -1; - } else if (keyboardEvent.keyCode === KeyCodes.RIGHT) { + } else if (e.keyCode === KeyCodes.RIGHT) { // increment (decrement in RTL) multiplier = block.RTL ? -1 : 1; - } else if (keyboardEvent.keyCode === KeyCodes.DOWN) { + } else if (e.keyCode === KeyCodes.DOWN) { // decrement multiplier = -1; - } else if (keyboardEvent.keyCode === KeyCodes.UP) { + } else if (e.keyCode === KeyCodes.UP) { // increment multiplier = 1; } diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index 1007e1884..3b8c08a92 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -20,14 +20,16 @@ import {Field, FieldConfig, FieldValidator} from './field.js'; import * as fieldRegistry from './field_registry.js'; import type {Sentinel} from './utils/sentinel.js'; -export type FieldCheckboxValidator = FieldValidator; +type BoolString = 'TRUE'|'FALSE'; +type CheckboxBool = BoolString|boolean; +export type FieldCheckboxValidator = FieldValidator; /** * Class for a checkbox field. * * @alias Blockly.FieldCheckbox */ -export class FieldCheckbox extends Field { +export class FieldCheckbox extends Field { /** Default character for the checkmark. */ static readonly CHECK_CHAR = '✓'; private checkChar_: string; @@ -42,7 +44,12 @@ export class FieldCheckbox extends Field { * Mouse cursor style when over the hotspot that initiates editability. */ override CURSOR = 'default'; - override value_: AnyDuringMigration; + + /** + * NOTE: The default value is set in `Field`, so maintain that value instead + * of overwriting it here or in the constructor. + */ + override value_: boolean|null = this.value_; /** * @param opt_value The initial value of the field. Should either be 'TRUE', @@ -59,8 +66,7 @@ export class FieldCheckbox extends Field { * for a list of properties this parameter supports. */ constructor( - opt_value?: string|boolean|Sentinel, - opt_validator?: FieldCheckboxValidator, + opt_value?: CheckboxBool|Sentinel, opt_validator?: FieldCheckboxValidator, opt_config?: FieldCheckboxConfig) { super(Field.SKIP_SETUP); @@ -70,9 +76,7 @@ export class FieldCheckbox extends Field { */ this.checkChar_ = FieldCheckbox.CHECK_CHAR; - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } @@ -153,7 +157,7 @@ export class FieldCheckbox extends Field { * @returns A valid value ('TRUE' or 'FALSE), or null if invalid. */ protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { + BoolString|null { if (opt_newValue === true || opt_newValue === 'TRUE') { return 'TRUE'; } @@ -169,7 +173,7 @@ export class FieldCheckbox extends Field { * @param newValue The value to be saved. The default validator guarantees * that this is a either 'TRUE' or 'FALSE'. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: BoolString) { this.value_ = this.convertValueToBool_(newValue); // Update visual. if (this.textElement_) { @@ -182,7 +186,7 @@ export class FieldCheckbox extends Field { * * @returns The value of this field. */ - override getValue(): string { + override getValue(): BoolString { return this.value_ ? 'TRUE' : 'FALSE'; } @@ -191,8 +195,8 @@ export class FieldCheckbox extends Field { * * @returns The boolean value of this field. */ - getValueBoolean(): boolean { - return this.value_ as boolean; + getValueBoolean(): boolean|null { + return this.value_; } /** @@ -213,12 +217,9 @@ export class FieldCheckbox extends Field { * @param value The value to convert. * @returns The converted value. */ - private convertValueToBool_(value: AnyDuringMigration): boolean { - if (typeof value === 'string') { - return value === 'TRUE'; - } else { - return !!value; - } + private convertValueToBool_(value: CheckboxBool|null): boolean { + if (typeof value === 'string') return value === 'TRUE'; + return !!value; } /** diff --git a/core/field_colour.ts b/core/field_colour.ts index 729ebe54f..db56acf53 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -80,7 +80,7 @@ export class FieldColour extends Field { static COLUMNS = 7; /** The field's colour picker element. */ - private picker_: Element|null = null; + private picker_: HTMLElement|null = null; /** Index of the currently highlighted element. */ private highlightedIndex_: number|null = null; @@ -134,9 +134,6 @@ export class FieldColour extends Field { * setting. By default use the global constants for columns. */ private columns_ = 0; - override size_: AnyDuringMigration; - override clickTarget_: AnyDuringMigration; - override value_: AnyDuringMigration; /** * @param opt_value The initial value of the field. Should be in '#rrggbb' @@ -157,9 +154,7 @@ export class FieldColour extends Field { opt_config?: FieldColourConfig) { super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } @@ -230,15 +225,14 @@ export class FieldColour extends Field { * @param newValue The value to be saved. The default validator guarantees * that this is a colour in '#rrggbb' format. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: string) { this.value_ = newValue; if (this.borderRect_) { - this.borderRect_.style.fill = newValue as string; + this.borderRect_.style.fill = newValue; } else if ( this.sourceBlock_ && this.sourceBlock_.rendered && this.sourceBlock_ instanceof BlockSvg) { - this.sourceBlock_.pathObject.svgPath.setAttribute( - 'fill', newValue as string); + this.sourceBlock_.pathObject.svgPath.setAttribute('fill', newValue); this.sourceBlock_.pathObject.svgPath.setAttribute('stroke', '#fff'); } } @@ -289,16 +283,12 @@ export class FieldColour extends Field { /** Create and show the colour field's editor. */ protected override showEditor_() { this.dropdownCreate_(); - // AnyDuringMigration because: Argument of type 'Element | null' is not - // assignable to parameter of type 'Node'. - dropDownDiv.getContentDiv().appendChild(this.picker_ as AnyDuringMigration); + dropDownDiv.getContentDiv().appendChild(this.picker_!); dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this)); // Focus so we can start receiving keyboard events. - // AnyDuringMigration because: Property 'focus' does not exist on type - // 'Element'. - (this.picker_ as AnyDuringMigration)!.focus({preventScroll: true}); + this.picker_!.focus({preventScroll: true}); } /** @@ -519,9 +509,7 @@ export class FieldColour extends Field { cell.setAttribute('data-colour', colours[i]); cell.title = titles[i] || colours[i]; cell.id = idGenerator.getNextUniqueId(); - // AnyDuringMigration because: Argument of type 'number' is not - // assignable to parameter of type 'string'. - cell.setAttribute('data-index', i as AnyDuringMigration); + cell.setAttribute('data-index', String(i)); aria.setRole(cell, aria.Role.GRIDCELL); aria.setState(cell, aria.State.LABEL, colours[i]); aria.setState(cell, aria.State.SELECTED, colours[i] === selectedColour); @@ -584,7 +572,7 @@ export class FieldColour extends Field { static fromJson(options: FieldColourFromJsonConfig): FieldColour { // `this` might be a subclass of FieldColour if that class doesn't override // the static fromJson method. - return new this(options['colour'], undefined, options); + return new this(options.colour, undefined, options); } } diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index eb14d766f..ced3a4bfe 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -92,7 +92,7 @@ export class FieldDropdown extends Field { */ override suffixField: string|null = null; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. - private selectedOption_!: Array; + private selectedOption_!: MenuOption; override clickTarget_: SVGElement|null = null; /** @@ -398,8 +398,7 @@ 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?: MenuOption[1]): string - |null { + protected override doClassValidation_(opt_newValue?: string): string|null { const options = this.getOptions(true); const isValueValid = options.some((option) => option[1] === opt_newValue); @@ -421,7 +420,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: MenuOption[1]) { + protected override doValueUpdate_(newValue: string) { super.doValueUpdate_(newValue); const options = this.getOptions(true); for (let i = 0, option; option = options[i]; i++) { @@ -465,7 +464,7 @@ export class FieldDropdown extends Field { // Show correct element. const option = this.selectedOption_ && this.selectedOption_[0]; if (option && typeof option === 'object') { - this.renderSelectedImage_((option)); + this.renderSelectedImage_(option); } else { this.renderSelectedText_(); } diff --git a/core/field_image.ts b/core/field_image.ts index 728be7e94..ab0a6bb37 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -60,7 +60,6 @@ export class FieldImage extends Field { /** Alt text of this image. */ private altText_ = ''; - override value_: AnyDuringMigration; /** * @param src The URL of the image. @@ -179,7 +178,7 @@ export class FieldImage extends Field { * @param newValue The value to be saved. The default validator guarantees * that this is a string. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: string) { this.value_ = newValue; if (this.imageElement_) { this.imageElement_.setAttributeNS( diff --git a/core/field_input.ts b/core/field_input.ts index b7e36d05b..88946b47a 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -32,14 +32,16 @@ import * as WidgetDiv from './widgetdiv.js'; import type {WorkspaceSvg} from './workspace_svg.js'; export type InputTypes = string|number; -export type FieldInputValidator = FieldValidator; +export type FieldInputValidator = + FieldValidator; /** - * Class for an editable text field. + * Abstract class for an editable input field. * * @alias Blockly.FieldInput + * @typeParam T - The value stored on the field. */ -export abstract class FieldInput extends Field { +export abstract class FieldInput extends Field { /** * Pixel size of input border radius. * Should match blocklyText's border-radius in CSS. @@ -83,9 +85,6 @@ export abstract class FieldInput extends Field { /** Mouse cursor style when over the hotspot that initiates the editor. */ override CURSOR = 'text'; - override clickTarget_: AnyDuringMigration; - override value_: AnyDuringMigration; - override isDirty_: AnyDuringMigration; /** * @param opt_value The initial value of the field. Should cast to a string. @@ -106,9 +105,7 @@ export abstract class FieldInput extends Field { opt_config?: FieldInputConfig) { super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } @@ -161,20 +158,6 @@ export abstract class FieldInput extends Field { this.createTextElement_(); } - /** - * Ensure that the input value casts to a valid string. - * - * @param opt_newValue The input value. - * @returns A valid string, or null if invalid. - */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - AnyDuringMigration { - if (opt_newValue === null || opt_newValue === undefined) { - return null; - } - return String(opt_newValue); - } - /** * Called by setValue if the text input is not valid. If the field is * currently being edited it reverts value of the field to the previous @@ -207,7 +190,7 @@ export abstract class FieldInput extends Field { * @param newValue The value to be saved. The default validator guarantees * that this is a string. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: string|T) { this.isDirty_ = true; this.isTextValid_ = true; this.value_ = newValue; @@ -380,7 +363,7 @@ export abstract class FieldInput extends Field { div!.appendChild(htmlInput); htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_); - htmlInput.setAttribute('data-untyped-default-value', this.value_); + htmlInput.setAttribute('data-untyped-default-value', String(this.value_)); this.resizeEditor_(); @@ -457,29 +440,19 @@ export abstract class FieldInput extends Field { * * @param e Keyboard event. */ - protected onHtmlInputKeyDown_(e: Event) { - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - if ((e as AnyDuringMigration).keyCode === KeyCodes.ENTER) { + protected onHtmlInputKeyDown_(e: KeyboardEvent) { + if (e.keyCode === KeyCodes.ENTER) { WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - } else if ((e as AnyDuringMigration).keyCode === KeyCodes.ESC) { + } else if (e.keyCode === KeyCodes.ESC) { this.setValue( this.htmlInput_!.getAttribute('data-untyped-default-value')); WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - } else if ((e as AnyDuringMigration).keyCode === KeyCodes.TAB) { + } else if (e.keyCode === KeyCodes.TAB) { WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - // AnyDuringMigration because: Property 'shiftKey' does not exist on type - // 'Event'. AnyDuringMigration because: Argument of type 'this' is not - // assignable to parameter of type 'Field'. - (this.sourceBlock_ as BlockSvg) - .tab(this as AnyDuringMigration, !(e as AnyDuringMigration).shiftKey); + (this.sourceBlock_ as BlockSvg).tab(this, !e.shiftKey); e.preventDefault(); } } diff --git a/core/field_label.ts b/core/field_label.ts index 2a4730ff2..22a55a3b7 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -51,9 +51,7 @@ export class FieldLabel extends Field { opt_config?: FieldLabelConfig) { super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } else { diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index abd53193a..e6473811b 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -70,9 +70,7 @@ export class FieldMultilineInput extends FieldTextInput { opt_config?: FieldMultilineInputConfig) { super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } @@ -210,9 +208,11 @@ export class FieldMultilineInput extends FieldTextInput { * @param newValue The value to be saved. The default validator guarantees * that this is a string. */ - protected override doValueUpdate_(newValue: AnyDuringMigration) { + protected override doValueUpdate_(newValue: string) { super.doValueUpdate_(newValue); - this.isOverflowedY_ = this.value_.split('\n').length > this.maxLines_; + if (this.value_ !== null) { + this.isOverflowedY_ = this.value_.split('\n').length > this.maxLines_; + } } /** Updates the text of the textElement. */ @@ -300,7 +300,7 @@ export class FieldMultilineInput extends FieldTextInput { // absolute longest line, even if it would be truncated after editing. // Otherwise we would get wrong editor width when there are more // lines than this.maxLines_. - const actualEditorLines = this.value_.split('\n'); + const actualEditorLines = String(this.value_).split('\n'); const dummyTextElement = dom.createSvgElement( Svg.TEXT, {'class': 'blocklyText blocklyMultilineText'}); @@ -385,7 +385,7 @@ export class FieldMultilineInput extends FieldTextInput { div!.appendChild(htmlInput); htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_); - htmlInput.setAttribute('data-untyped-default-value', this.value_); + htmlInput.setAttribute('data-untyped-default-value', String(this.value_)); htmlInput.setAttribute('data-old-value', ''); if (userAgent.GECKO) { // In FF, ensure the browser reflows before resizing to avoid issue #2777. @@ -428,10 +428,8 @@ export class FieldMultilineInput extends FieldTextInput { * * @param e Keyboard event. */ - protected override onHtmlInputKeyDown_(e: Event) { - // AnyDuringMigration because: Property 'keyCode' does not exist on type - // 'Event'. - if ((e as AnyDuringMigration).keyCode !== KeyCodes.ENTER) { + protected override onHtmlInputKeyDown_(e: KeyboardEvent) { + if (e.keyCode !== KeyCodes.ENTER) { super.onHtmlInputKeyDown_(e); } } diff --git a/core/field_number.ts b/core/field_number.ts index a891f1c58..20b799555 100644 --- a/core/field_number.ts +++ b/core/field_number.ts @@ -77,9 +77,7 @@ export class FieldNumber extends FieldInput { // Pass SENTINEL so that we can define properties before value validation. super(Field.SKIP_SETUP); - if (opt_value === Field.SKIP_SETUP) { - return; - } + if (Field.isSentinel(opt_value)) return; if (opt_config) { this.configure_(opt_config); } else { @@ -260,6 +258,7 @@ export class FieldNumber extends FieldInput { if (opt_newValue === null) { return null; } + // Clean up text. let newValue = String(opt_newValue); // TODO: Handle cases like 'ten', '1.203,14', etc. diff --git a/core/field_textinput.ts b/core/field_textinput.ts index 2a2f1c6db..5ef633dc4 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -22,6 +22,11 @@ import type {Sentinel} from './utils/sentinel.js'; export type FieldTextInputValidator = FieldInputValidator; +/** + * Class for an editable text field. + * + * @alias Blockly.FieldTextInput + */ export class FieldTextInput extends FieldInput { /** * @param opt_value The initial value of the field. Should cast to a string. @@ -43,6 +48,20 @@ export class FieldTextInput extends FieldInput { super(opt_value, opt_validator, opt_config); } + /** + * Ensure that the input value casts to a valid string. + * + * @param opt_newValue The input value. + * @returns A valid string, or null if invalid. + */ + protected override doClassValidation_(opt_newValue?: AnyDuringMigration): + string|null { + if (opt_newValue === undefined) { + return null; + } + return String(opt_newValue); + } + /** * Construct a FieldTextInput from a JSON arg object, * dereferencing any string table references. diff --git a/core/field_variable.ts b/core/field_variable.ts index e3b98f4fe..8d2fd276c 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -306,7 +306,7 @@ export class FieldVariable extends FieldDropdown { * * @returns Validation function, or null. */ - override getValidator(): Function|null { + override getValidator(): FieldVariableValidator|null { // Validators shouldn't operate on the initial setValue call. // Normally this is achieved by calling setValidator after setValue, but // this is not a possibility with variable fields. @@ -357,7 +357,7 @@ export class FieldVariable extends FieldDropdown { * * @param newId The value to be saved. */ - protected override doValueUpdate_(newId: AnyDuringMigration) { + protected override doValueUpdate_(newId: string) { const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); diff --git a/core/gesture.ts b/core/gesture.ts index 935aa37d8..065434097 100644 --- a/core/gesture.ts +++ b/core/gesture.ts @@ -969,14 +969,14 @@ export class Gesture { * @param field The field the gesture started on. * @internal */ - setStartField(field: Field) { + setStartField(field: Field) { if (this.hasStarted_) { throw Error( 'Tried to call gesture.setStartField, ' + 'but the gesture had already been started.'); } if (!this.startField_) { - this.startField_ = field; + this.startField_ = field as Field; } } diff --git a/core/utils/sentinel.ts b/core/utils/sentinel.ts index f6b8da26d..723c29986 100644 --- a/core/utils/sentinel.ts +++ b/core/utils/sentinel.ts @@ -18,4 +18,10 @@ goog.declareModuleId('Blockly.utils.Sentinel'); * * @alias Blockly.utils.Sentinel */ -export class Sentinel {} +export class Sentinel { + /** + * Provide a unique key so that type guarding properly excludes values like + * string. + */ + UNIQUE_KEY?: never; +} From 76c55754c25ba055d8741ea3c42d8afd12eaa495 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Tue, 10 Jan 2023 15:50:12 -0800 Subject: [PATCH 026/141] fix: export Abstract event class directly (#6752) --- core/events/events.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/events/events.ts b/core/events/events.ts index c6ffe276e..6e712bb9c 100644 --- a/core/events/events.ts +++ b/core/events/events.ts @@ -13,7 +13,7 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events'); -import {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js'; +import {Abstract, AbstractEventJson} from './events_abstract.js'; import {BlockBase, BlockBaseJson} from './events_block_base.js'; import {BlockChange, BlockChangeJson} from './events_block_change.js'; import {BlockCreate, BlockCreateJson} from './events_block_create.js'; @@ -54,7 +54,7 @@ import {FinishedLoading, FinishedLoadingJson} from './workspace_events.js'; // Events. -export const Abstract = AbstractEvent; +export {Abstract}; export {AbstractEventJson}; export {BubbleOpen}; export {BubbleOpenJson}; From 154b456d1e212ad2dd7ca56b92d11d4d20233bd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 18:56:23 -0800 Subject: [PATCH 027/141] chore(deps): bump @typescript-eslint/eslint-plugin from 5.47.1 to 5.48.0 (#6744) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.47.1 to 5.48.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.48.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 30627d8fa..f43362afe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1101,14 +1101,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz", - "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.0.tgz", + "integrity": "sha512-SVLafp0NXpoJY7ut6VFVUU9I+YeFsDzeQwtK0WZ+xbRN3mtxJ08je+6Oi2N89qDn087COdO0u3blKZNv9VetRQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.47.1", - "@typescript-eslint/type-utils": "5.47.1", - "@typescript-eslint/utils": "5.47.1", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/type-utils": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -1134,13 +1134,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", - "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1151,9 +1151,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1164,12 +1164,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1227,13 +1227,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz", - "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.0.tgz", + "integrity": "sha512-vbtPO5sJyFjtHkGlGK4Sthmta0Bbls4Onv0bEqOGm7hP9h8UpRsHJwsrCiWtCUndTRNQO/qe6Ijz9rnT/DB+7g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.47.1", - "@typescript-eslint/utils": "5.47.1", + "@typescript-eslint/typescript-estree": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1254,9 +1254,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1267,13 +1267,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", - "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1294,12 +1294,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1353,16 +1353,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz", - "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.0.tgz", + "integrity": "sha512-x2jrMcPaMfsHRRIkL+x96++xdzvrdBCnYRd5QiW5Wgo1OB4kDYPbC1XjWP/TNqlfK93K/lUL92erq5zPLgFScQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.47.1", - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/typescript-estree": "5.47.1", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1379,13 +1379,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", - "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1396,9 +1396,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1409,13 +1409,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", - "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1436,12 +1436,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -13991,14 +13991,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz", - "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.0.tgz", + "integrity": "sha512-SVLafp0NXpoJY7ut6VFVUU9I+YeFsDzeQwtK0WZ+xbRN3mtxJ08je+6Oi2N89qDn087COdO0u3blKZNv9VetRQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.47.1", - "@typescript-eslint/type-utils": "5.47.1", - "@typescript-eslint/utils": "5.47.1", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/type-utils": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -14008,28 +14008,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", - "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" } }, "@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14060,31 +14060,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz", - "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.0.tgz", + "integrity": "sha512-vbtPO5sJyFjtHkGlGK4Sthmta0Bbls4Onv0bEqOGm7hP9h8UpRsHJwsrCiWtCUndTRNQO/qe6Ijz9rnT/DB+7g==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.47.1", - "@typescript-eslint/utils": "5.47.1", + "@typescript-eslint/typescript-estree": "5.48.0", + "@typescript-eslint/utils": "5.48.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", - "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14093,12 +14093,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" } } @@ -14128,45 +14128,45 @@ } }, "@typescript-eslint/utils": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz", - "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.0.tgz", + "integrity": "sha512-x2jrMcPaMfsHRRIkL+x96++xdzvrdBCnYRd5QiW5Wgo1OB4kDYPbC1XjWP/TNqlfK93K/lUL92erq5zPLgFScQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.47.1", - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/typescript-estree": "5.47.1", + "@typescript-eslint/scope-manager": "5.48.0", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/typescript-estree": "5.48.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz", - "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.0.tgz", + "integrity": "sha512-0AA4LviDtVtZqlyUQnZMVHydDATpD9SAX/RC5qh6cBd3xmyWvmXYF+WT1oOmxkeMnWDlUVTwdODeucUnjz3gow==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1" + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0" } }, "@typescript-eslint/types": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz", - "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.0.tgz", + "integrity": "sha512-UTe67B0Ypius0fnEE518NB2N8gGutIlTojeTg4nt0GQvikReVkurqxd2LvYa9q9M5MQ6rtpNyWTBxdscw40Xhw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz", - "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.0.tgz", + "integrity": "sha512-7pjd94vvIjI1zTz6aq/5wwE/YrfIyEPLtGJmRfyNR9NYIW+rOvzzUv3Cmq2hRKpvt6e9vpvPUQ7puzX7VSmsEw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", - "@typescript-eslint/visitor-keys": "5.47.1", + "@typescript-eslint/types": "5.48.0", + "@typescript-eslint/visitor-keys": "5.48.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -14175,12 +14175,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.47.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz", - "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==", + "version": "5.48.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.0.tgz", + "integrity": "sha512-5motVPz5EgxQ0bHjut3chzBkJ3Z3sheYVcSwS5BpHZpLqSptSmELNtGixmgj65+rIfhvtQTz5i9OP2vtzdDH7Q==", "dev": true, "requires": { - "@typescript-eslint/types": "5.47.1", + "@typescript-eslint/types": "5.48.0", "eslint-visitor-keys": "^3.3.0" } }, From 902c30948add9b015f061141418420cf665680e8 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 11 Jan 2023 15:45:14 +0000 Subject: [PATCH 028/141] chore: refactor procedures namespace (#6745) * chore: refactor procedures namespace * fix: getCallers * chore: add inline docs --- blocks/procedures.js | 18 ++++ core/interfaces/i_procedure_block.ts | 7 +- core/procedures.ts | 130 +++++++++++++++++---------- tests/mocha/procedure_map_test.js | 2 + 4 files changed, 109 insertions(+), 48 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 785b0bba2..ee4e0958e 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -286,6 +286,15 @@ const procedureDefGetDefMixin = function() { return this.model_; }, + /** + * True if this is a procedure definition block, false otherwise (i.e. + * it is a caller). + * @return {boolean} True because this is a procedure definition block. + */ + isProcedureDef() { + return true; + }, + /** * Return all variables referenced by this block. * @return {!Array} List of variable names. @@ -997,6 +1006,15 @@ const procedureCallerGetDefMixin = function() { return /** @type {string} */ (this.getFieldValue('NAME')); }, + /** + * True if this is a procedure definition block, false otherwise (i.e. + * it is a caller). + * @return {boolean} False because this is not a procedure definition block. + */ + isProcedureDef() { + return false; + }, + /** * Return all variables referenced by this block. * @return {!Array} List of variable names. diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts index bddabee6d..b2ab39629 100644 --- a/core/interfaces/i_procedure_block.ts +++ b/core/interfaces/i_procedure_block.ts @@ -10,12 +10,15 @@ import {IProcedureModel} from './i_procedure_model.js'; /** The interface for a block which models a procedure. */ export interface IProcedureBlock { - doProcedureUpdate(): void; getProcedureModel(): IProcedureModel; + doProcedureUpdate(): void; + isProcedureDef(): boolean; } /** 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; + return (block as IProcedureBlock).getProcedureModel !== undefined && + (block as IProcedureBlock).doProcedureUpdate !== undefined && + (block as IProcedureBlock).isProcedureDef !== undefined; } diff --git a/core/procedures.ts b/core/procedures.ts index 5369b61bd..1ebe76b7e 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -67,6 +67,26 @@ export interface ProcedureBlock { getProcedureDef: () => ProcedureTuple; } +interface LegacyProcedureDefBlock { + getProcedureDef: () => ProcedureTuple +} + +function isLegacyProcedureDefBlock(block: Object): + block is LegacyProcedureDefBlock { + return (block as any).getProcedureDef !== undefined; +} + +interface LegacyProcedureCallBlock { + getProcedureCall: () => string; + renameProcedure: (p1: string, p2: string) => void; +} + +function isLegacyProcedureCallBlock(block: Object): + block is LegacyProcedureCallBlock { + return (block as any).getProcedureCall !== undefined && + (block as any).renameProcedure !== undefined; +} + /** * Find all user-created procedure definitions in a workspace. * @@ -78,15 +98,37 @@ export interface ProcedureBlock { */ export function allProcedures(root: Workspace): [ProcedureTuple[], ProcedureTuple[]] { - const proceduresNoReturn = - root.getBlocksByType('procedures_defnoreturn', false) - .map(function(block) { - return (block as unknown as ProcedureBlock).getProcedureDef(); - }); - const proceduresReturn = - root.getBlocksByType('procedures_defreturn', false).map(function(block) { - return (block as unknown as ProcedureBlock).getProcedureDef(); - }); + const proceduresNoReturn: ProcedureTuple[] = + root.getProcedureMap() + .getProcedures() + .filter((p) => !p.getReturnTypes()) + .map( + (p) => + [p.getName(), + p.getParameters().map((pa) => pa.getName()), + false, + ]); + root.getBlocksByType('procedures_defnoreturn', false).forEach((b) => { + if (!isProcedureBlock(b) && isLegacyProcedureDefBlock(b)) { + proceduresNoReturn.push(b.getProcedureDef()); + } + }); + + const proceduresReturn: ProcedureTuple[] = + root.getProcedureMap() + .getProcedures() + .filter((p) => !!p.getReturnTypes()) + .map( + (p) => + [p.getName(), + p.getParameters().map((pa) => pa.getName()), + true, + ]); + root.getBlocksByType('procedures_defreturn', false).forEach((b) => { + if (!isProcedureBlock(b) && isLegacyProcedureDefBlock(b)) { + proceduresReturn.push(b.getProcedureDef()); + } + }); proceduresNoReturn.sort(procTupleComparator); proceduresReturn.sort(procTupleComparator); return [proceduresNoReturn, proceduresReturn]; @@ -158,19 +200,16 @@ function isLegalName( */ export function isNameUsed( name: string, workspace: Workspace, opt_exclude?: Block): boolean { - const blocks = workspace.getAllBlocks(false); - // Iterate through every block and check the name. - for (let i = 0; i < blocks.length; i++) { - if (blocks[i] === opt_exclude) { - continue; + for (const block of workspace.getAllBlocks(false)) { + if (block === opt_exclude) continue; + + if (isProcedureBlock(block) && block.isProcedureDef() && + Names.equals(block.getProcedureModel().getName(), name)) { + return true; } - // Assume it is a procedure block so we can check. - const procedureBlock = blocks[i] as unknown as ProcedureBlock; - if (procedureBlock.getProcedureDef) { - const procName = procedureBlock.getProcedureDef(); - if (Names.equals(procName[0], name)) { - return true; - } + if (isLegacyProcedureDefBlock(block) && + Names.equals(block.getProcedureDef()[0], name)) { + return true; } } return false; @@ -382,21 +421,21 @@ function mutatorChangeListener(e: Abstract) { * @alias Blockly.Procedures.getCallers */ export function getCallers(name: string, workspace: Workspace): Block[] { - const callers = []; - const blocks = workspace.getAllBlocks(false); - // Iterate through every block and check the name. - for (let i = 0; i < blocks.length; i++) { - // Assume it is a procedure block so we can check. - const procedureBlock = blocks[i] as unknown as ProcedureBlock; - if (procedureBlock.getProcedureCall) { - const procName = procedureBlock.getProcedureCall(); - // Procedure name may be null if the block is only half-built. - if (procName && Names.equals(procName, name)) { - callers.push(blocks[i]); - } - } - } - return callers; + return workspace.getAllBlocks(false).filter((block) => { + return blockIsModernCallerFor(block, name) || + (isLegacyProcedureCallBlock(block) && + Names.equals(block.getProcedureCall(), name)); + }); +} + +/** + * @returns True if the given block is a modern-style caller block of the given + * procedure name. + */ +function blockIsModernCallerFor(block: Block, procName: string): boolean { + return isProcedureBlock(block) && !block.isProcedureDef() && + block.getProcedureModel() && + Names.equals(block.getProcedureModel().getName(), procName); } /** @@ -443,16 +482,15 @@ export function mutateCallers(defBlock: Block) { export function getDefinition(name: string, workspace: Workspace): Block|null { // Do not assume procedure is a top block. Some languages allow nested // procedures. Also do not assume it is one of the built-in blocks. Only - // rely on getProcedureDef. - const blocks = workspace.getAllBlocks(false); - for (let i = 0; i < blocks.length; i++) { - // Assume it is a procedure block so we can check. - const procedureBlock = blocks[i] as unknown as ProcedureBlock; - if (procedureBlock.getProcedureDef) { - const tuple = procedureBlock.getProcedureDef(); - if (tuple && Names.equals(tuple[0], name)) { - return blocks[i]; // Can't use procedureBlock var due to type check. - } + // rely on isProcedureDef and getProcedureDef. + for (const block of workspace.getAllBlocks(false)) { + if (isProcedureBlock(block) && block.isProcedureDef() && + Names.equals(block.getProcedureModel().getName(), name)) { + return block; + } + if (isLegacyProcedureDefBlock(block) && + Names.equals(block.getProcedureDef()[0], name)) { + return block; } } return null; diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index 80e3a37f1..a1542fad9 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -25,6 +25,8 @@ suite('Procedure Map', function() { Blockly.Blocks['procedure_mock'] = { init: function() { }, doProcedureUpdate: function() { }, + getProcedureModel: function() { }, + isProcedureDef: function() { }, }; this.procedureBlock = this.workspace.newBlock('procedure_mock'); From 9f7318480353aa0a33abf9ed9e7435cf62c77752 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 12 Jan 2023 00:41:11 +0000 Subject: [PATCH 029/141] fix: undoing pasting procedure callers that create defs (#6750) * fix: undoing pasting procedure callers that create defs * chore: move createDefs_ to the mixin that calls it This reverts commit 6f4eab2f0884fa108a9ba15ee2db7a3414517a23. --- blocks/procedures.js | 60 ++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index ee4e0958e..49ce8a046 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -961,32 +961,6 @@ const procedureCallerGetDefMixin = function() { return model; }, - /** - * Creates a procedure definition block with the given name and params, - * and returns the procedure model associated with it. - * @param {string} name The name of the procedure to create. - * @param {string[]} params The names of the parameters to create. - * @return {IProcedureModel} The procedure model associated with the new - * procedure definition block. - */ - createDef_(name, params = []) { - const xy = this.getRelativeToSurfaceXY(); - const newName = Procedures.findLegalName(name, this); - this.renameProcedure(name, newName); - - const blockDef = { - 'type': this.defType_, - 'x': xy.x + config.snapRadius * (this.RTL ? -1 : 1), - 'y': xy.y + config.snapRadius * 2, - 'extraState': { - 'params': params.map((p) => ({'name': p})), - }, - 'fields': {'NAME': newName}, - }; - return serialization.blocks.append(blockDef, this.getTargetWorkspace_()) - .getProcedureModel(); - }, - /** * @return {Workspace} The main workspace (i.e. not the flyout workspace) * associated with this block. @@ -1293,7 +1267,6 @@ const procedureCallerOnChangeMixin = { // Events not generated by user. Skip handling. return; } - // TODO: Clean this up to call createDef_. if (event.type === Events.BLOCK_CREATE && (event.blockId === this.id || event.ids.indexOf(this.id) !== -1)) { // Look for the case where a procedure call was created (usually through @@ -1318,11 +1291,44 @@ const procedureCallerOnChangeMixin = { } }, + /** + * Returns true if the given def block matches the definition of this caller + * block. + * @param {Block} defBlock The definition block to check against. + * @return {boolean} Whether the def block matches or not. + */ defMatches_(defBlock) { return defBlock && defBlock.type === this.defType_ && JSON.stringify(defBlock.getVars()) === JSON.stringify(this.paramsFromSerializedState_); }, + + /** + * Creates a procedure definition block with the given name and params, + * and returns the procedure model associated with it. + * @param {string} name The name of the procedure to create. + * @param {string[]} params The names of the parameters to create. + * @return {IProcedureModel} The procedure model associated with the new + * procedure definition block. + */ + createDef_(name, params = []) { + const xy = this.getRelativeToSurfaceXY(); + const newName = Procedures.findLegalName(name, this); + this.renameProcedure(name, newName); + + const blockDef = { + 'type': this.defType_, + 'x': xy.x + config.snapRadius * (this.RTL ? -1 : 1), + 'y': xy.y + config.snapRadius * 2, + 'extraState': { + 'params': params.map((p) => ({'name': p})), + }, + 'fields': {'NAME': newName}, + }; + return serialization.blocks + .append(blockDef, this.getTargetWorkspace_(), {recordUndo: true}) + .getProcedureModel(); + }, }; Extensions.registerMixin( 'procedure_caller_onchange_mixin', procedureCallerOnChangeMixin); From 32c7585cd742c69db7dd54fddb4a9b9c3e3c1964 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 12 Jan 2023 00:55:06 +0000 Subject: [PATCH 030/141] fix: proc json serialization (#6746) * fix: params not being rendered when loading from JSON * chore: fix tests --- blocks/procedures.js | 1 + tests/mocha/blocks/procedures_test.js | 311 +++++++++++++++++++--- tests/mocha/test_helpers/serialization.js | 2 +- 3 files changed, 279 insertions(+), 35 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 49ce8a046..c5b7a6307 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -591,6 +591,7 @@ const procedureDefMutator = { } } + this.doProcedureUpdate(); this.setStatements_(state['hasStatements'] === false ? false : true); // Call mutate callers for backwards compatibility. diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index ae8a5ba2c..ed293a5b1 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -1985,6 +1985,55 @@ suite('Procedures', function() { }); }); + suite('extra serialization test cases', function() { + test('definitions with parameters are properly rendered', function() { + Blockly.serialization.workspaces.load({ + "blocks": { + "languageVersion": 0, + "blocks": [ + { + "type": "procedures_defnoreturn", + "extraState": { + "procedureId": "procId", + "params": [ + { + "name": "x", + "id": "varId", + "paramId": "paramId", + }, + ], + }, + "fields": { + "NAME": "do something", + }, + }, + ], + }, + "procedures": [ + { + "id": "procId", + "name": "do something", + "returnTypes": null, + "parameters": [ + { + "id": "paramId", + "name": "x", + }, + ], + }, + ], + "variables": [ + { + "name": "x", + "id": "varId", + }, + ], + }, this.workspace); + assertDefBlockStructure( + this.workspace.getTopBlocks(false)[0], false, ['x'], ['varId']); + }); + }); + const testSuites = [ {title: 'procedures_defreturn', hasReturn: true, defType: 'procedures_defreturn', callType: 'procedures_callreturn'}, @@ -2480,7 +2529,7 @@ suite('Procedures', function() { */ const testCases = [ { - title: 'Minimal definition', + title: 'XML - Minimal definition', xml: '', expectedXml: '' + ' do something' + @@ -2509,8 +2558,7 @@ suite('Procedures', function() { }, }, { - title: 'With vars definition', - skip: true, + title: 'XML - With vars definition', xml: '\n' + ' \n' + @@ -2535,8 +2583,7 @@ suite('Procedures', function() { }, }, { - title: 'With pre-created vars definition', - skip: true, + title: 'XML - With pre-created vars definition', xml: '\n' + ' \n' + @@ -2559,31 +2606,7 @@ suite('Procedures', function() { }, }, { - title: 'With pre-created typed vars definition', - skip: true, - xml: - '\n' + - ' \n' + - ' \n' + - ' \n' + - ' do something\n' + - '', - expectedXml: - '\n' + - ' \n' + - ' \n' + - ' \n' + - ' do something\n' + - '', - assertBlockStructure: - (block) => { - assertDefBlockStructure(block, testSuite.hasReturn, - ['preCreatedTypedVar'], ['preCreatedTypedVarId']); - }, - }, - { - title: 'No statements definition', + title: 'XML - No statements definition', xml: '\n' + ' \n' + @@ -2601,7 +2624,7 @@ suite('Procedures', function() { }, }, { - title: 'Minimal caller', + title: 'XML - Minimal caller', xml: '', expectedXml: '\n' + ' \n' + @@ -2630,7 +2653,7 @@ suite('Procedures', function() { }, }, { - title: 'With pre-created vars caller', + title: 'XML - With pre-created vars caller', xml: '\n' + ' \n' + @@ -2649,6 +2672,226 @@ suite('Procedures', function() { assertCallBlockStructure(block, ['preCreatedVar'], ['preCreatedVarId']); }, }, + { + title: 'JSON - Minimal definition', + json: { + 'type': testSuite.defType, + }, + expectedJson: { + 'type': testSuite.defType, + 'id': '1', + 'fields': { + 'NAME': 'unnamed', + }, + 'extraState': { + 'procedureId': '1', + }, + }, + assertBlockStructure: + (block) => { + assertDefBlockStructure(block, testSuite.hasReturn); + }, + }, + { + title: 'JSON - Common definition', + json: { + 'type': testSuite.defType, + 'fields': { + 'NAME': 'do something', + }, + }, + expectedJson: { + 'type': testSuite.defType, + 'id': '1', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'procedureId': '1', + }, + }, + assertBlockStructure: + (block) => { + assertDefBlockStructure(block, testSuite.hasReturn); + }, + }, + { + title: 'JSON - With vars definition', + json: { + 'type': testSuite.defType, + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'params': [ + { + 'name': 'x', + 'id': 'arg1', + }, + { + 'name': 'y', + 'id': 'arg2', + }, + ], + }, + }, + expectedJson: { + 'type': testSuite.defType, + 'id': '1', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'procedureId': '1', + 'params': [ + { + 'name': 'x', + 'id': 'arg1', + 'paramId': '1', + }, + { + 'name': 'y', + 'id': 'arg2', + 'paramId': '1', + }, + ], + }, + }, + assertBlockStructure: + (block) => { + assertDefBlockStructure( + block, testSuite.hasReturn, ['x', 'y'], ['arg1', 'arg2']); + }, + }, + { + title: 'JSON - With pre-created vars definition', + json: { + 'type': testSuite.defType, + 'extraState': { + 'params': [ + { + 'name': 'preCreatedVar', + 'id': 'preCreatedVarId', + }, + ], + }, + 'fields': { + 'NAME': 'do something', + }, + }, + expectedJson: { + 'type': testSuite.defType, + 'id': '1', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'procedureId': '1', + 'params': [ + { + 'name': 'preCreatedVar', + 'id': 'preCreatedVarId', + 'paramId': '1', + }, + ], + }, + }, + assertBlockStructure: + (block) => { + assertDefBlockStructure(block, testSuite.hasReturn, + ['preCreatedVar'], ['preCreatedVarId']); + }, + }, + { + title: 'JSON - No statements definition', + json: { + 'type': 'procedures_defreturn', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'hasStatements': false, + }, + }, + expectedJson: { + 'type': 'procedures_defreturn', + 'id': '1', + 'fields': { + 'NAME': 'do something', + }, + 'extraState': { + 'procedureId': '1', + 'hasStatements': false, + }, + }, + assertBlockStructure: + (block) => { + assertDefBlockStructure(block, true, [], [], false); + }, + }, + { + title: 'JSON - Minimal caller', + json: { + 'type': testSuite.callType, + }, + expectedJson: { + 'type': testSuite.callType, + 'id': '1', + 'extraState': { + 'name': 'unnamed', + }, + }, + assertBlockStructure: + (block) => { + assertCallBlockStructure(block); + }, + }, + { + title: 'JSON - Common caller', + json: { + 'type': testSuite.callType, + 'extraState': { + 'name': 'do something', + }, + }, + expectedJson: { + 'type': testSuite.callType, + 'id': '1', + 'extraState': { + 'name': 'do something', + }, + }, + assertBlockStructure: + (block) => { + assertCallBlockStructure(block); + }, + }, + { + title: 'JSON - With pre-created vars caller', + json: { + 'type': testSuite.callType, + 'extraState': { + 'name': 'do something', + 'params': [ + 'preCreatedVar', + ], + }, + }, + expectedJson: { + 'type': testSuite.callType, + 'id': '1', + 'extraState': { + 'name': 'do something', + 'params': [ + 'preCreatedVar', + ], + }, + }, + assertBlockStructure: + (block) => { + assertCallBlockStructure(block, ['preCreatedVar'], ['preCreatedVarId']); + }, + }, ]; runSerializationTestSuite(testCases); }); diff --git a/tests/mocha/test_helpers/serialization.js b/tests/mocha/test_helpers/serialization.js index 94fc511d5..09c340921 100644 --- a/tests/mocha/test_helpers/serialization.js +++ b/tests/mocha/test_helpers/serialization.js @@ -79,7 +79,7 @@ export const runSerializationTestSuite = (testCases) => { return function() { if (testCase.json) { const block = Blockly.serialization.blocks.append( - testCase.json, this.workspace); + testCase.json, this.workspace, {recordUndo: true}); this.clock.runAll(); const generatedJson = Blockly.serialization.blocks.save(block); const expectedJson = testCase.expectedJson || testCase.json; From d1d60c4629af71ee0da727069df866d8fb6e2203 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 12 Jan 2023 12:52:14 -0800 Subject: [PATCH 031/141] fix: CI exits properly after failure (#6763) * fix: CI exits properly after failure * fix: remove useless async --- scripts/gulpfiles/test_tasks.js | 252 +++++++++++++++++--------------- 1 file changed, 132 insertions(+), 120 deletions(-) diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js index 68fb63963..c4e19d606 100644 --- a/scripts/gulpfiles/test_tasks.js +++ b/scripts/gulpfiles/test_tasks.js @@ -31,84 +31,77 @@ const BOLD_GREEN = '\x1b[1;32m'; const BOLD_RED = '\x1b[1;31m'; const ANSI_RESET = '\x1b[0m'; -class Tester { - constructor(tasks = []) { - this.successCount = 0; - this.failCount = 0; - this.tasks = tasks; - } +let successCount = 0; +let failCount = 0; +let firstErr; - /** - * Run all tests in sequence. - */ - async runAll() { - for (const task of this.tasks) { - await this.runTestTask(task) - } - this.reportTestResult(); - } - - /** - * Create a Gulp task to run all tests. - */ - asTask() { - return this.runAll.bind(this); - } - - /** - * Run an arbitrary Gulp task as a test. - * @param {function} task Any Gulp task. - * @return {Promise} Asynchronous result. - */ - async runTestTask(task) { - const id = task.name; +/** + * Run an arbitrary Gulp task as a test. + * @param {function} task Any Gulp task. + * @return {Promise} Asynchronous result. + */ +function runTestTask(id, task) { + return new Promise((resolve) => { console.log('======================================='); console.log(`== ${id}`); + + // Turn any task into a Promise! + const asyncTask = new Promise((resolve, reject) => { + asyncDone(task, (error, result) => { + if (error) reject(error); + resolve(result); + }); + }); + if (process.env.CI) console.log('::group::'); - - try { - try { - await new Promise((resolve, reject) => { - asyncDone(task, (error, result) => { - if (error) reject(error); - resolve(result); - }); - }); - } finally { + asyncTask + .then((result) => { + successCount++; if (process.env.CI) console.log('::endgroup::'); - } - this.successCount++; - console.log(`${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${id}`); - } catch (error) { - this.failCount++; - console.error(error.message); - console.log(`${BOLD_RED}FAILED:${ANSI_RESET} ${id}`); - } - } + console.log(`${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${id}`); + resolve(result); + }) + .catch((err) => { + failCount++; + if (!firstErr) { + // Save the first error so we can use it in the stack trace later. + firstErr = err; + } + console.error(err.message); + if (process.env.CI) console.log('::endgroup::'); + console.log(`${BOLD_RED}FAILED:${ANSI_RESET} ${id}`); + // Always continue. + resolve(err); + }); + }); +} - /** - * Print test results. - */ - reportTestResult() { - console.log('======================================='); - // Check result. - if (this.failCount === 0) { - console.log( - `${BOLD_GREEN}All ${this.successCount} tests passed.${ANSI_RESET}`); - } else { - console.log( - `${BOLD_RED}Failures in ${this.failCount} test groups.${ANSI_RESET}`); - } +/** + * Print test results and fail the task if needed. + */ +function reportTestResult() { + console.log('======================================='); + // Check result. + if (failCount === 0) { + console.log( + `${BOLD_GREEN}All ${successCount} tests passed.${ANSI_RESET}`); + return Promise.resolve(); } -}; + console.log( + `${BOLD_RED}Failures in ${failCount} test groups.${ANSI_RESET}`); + return Promise.reject(firstErr || + 'Unspecified test failures, see above. The following stack trace is unlikely to be useful.'); +} /** * Helper method for running test command. * @param {string} command Command line to run. * @return {Promise} Asynchronous result. */ -async function runTestCommand(command) { - execSync(command, {stdio: 'inherit'}); +async function runTestCommand(id, command) { + return runTestTask(id, async() => { + return execSync(command, {stdio: 'inherit'}); + }); } /** @@ -121,7 +114,7 @@ function eslint() { console.log('Skip linting.'); return Promise.resolve(); } - return runTestCommand('eslint .'); + return runTestCommand('eslint', 'eslint .'); } /** @@ -130,7 +123,7 @@ function eslint() { * @return {Promise} Asynchronous result. */ function build() { - return runTestCommand('npm run package -- --verbose --debug'); + return runTestCommand('build', 'npm run package -- --verbose --debug'); } /** @@ -138,7 +131,7 @@ function build() { * @return {Promise} Asynchronous result. */ function renamings() { - return runTestCommand('node tests/migration/validate-renamings.js'); + return runTestCommand('renamings', 'node tests/migration/validate-renamings.js'); } /** @@ -203,31 +196,33 @@ function zippingFiles() { * @return {Promise} Asynchronous result. */ async function metadata() { - // 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; - } + return runTestTask('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.'); - } + // 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.'); + } + }); } /** @@ -235,13 +230,15 @@ async function metadata() { * @return {Promise} Asynchronous result. */ async function mocha() { - const result = await runMochaTestsInBrowser().catch(e => { - throw e; + return runTestTask('mocha', async () => { + const result = await runMochaTestsInBrowser().catch(e => { + throw e; + }); + if (result) { + throw new Error('Mocha tests failed'); + } + console.log('Mocha tests passed'); }); - if (result) { - throw new Error('Mocha tests failed'); - } - console.log('Mocha tests passed'); } /** @@ -297,25 +294,27 @@ function checkResult(suffix) { * @return {Promise} Asynchronous result. */ async function generators() { - // Clean up. - rimraf.sync(OUTPUT_DIR); - fs.mkdirSync(OUTPUT_DIR); + return runTestTask('generators', async () => { + // Clean up. + rimraf.sync(OUTPUT_DIR); + fs.mkdirSync(OUTPUT_DIR); - await runGeneratorsInBrowser(OUTPUT_DIR).catch(() => {}); + await runGeneratorsInBrowser(OUTPUT_DIR).catch(() => {}); - const generatorSuffixes = ['js', 'py', 'dart', 'lua', 'php']; - let failed = 0; - generatorSuffixes.forEach((suffix) => { - failed += checkResult(suffix); + 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.'); + } }); - - 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.'); - } } /** @@ -323,29 +322,42 @@ async function generators() { * @return {Promise} Asynchronous result. */ function node() { - return runTestCommand('mocha tests/node --config tests/node/.mocharc.js'); + return runTestCommand('node', 'mocha tests/node --config tests/node/.mocharc.js'); } /** * Attempt advanced compilation of a Blockly app. - * @return {Promise} Asynchronous result. + * @returns {Promise} Async result. */ function advancedCompile() { - const compilePromise = runTestCommand('npm run test:compile:advanced'); - return compilePromise.then(runCompileCheckInBrowser); + return runTestCommand('advanced_compile', 'npm run test:compile:advanced'); +} + +/** + * Attempt advanced compilation of a Blockly app and make sure it runs in the browser. + * Should be run after the `advancedCompile` test. + * @return {Promise} Asynchronous result. + */ +function advancedCompileInBrowser() { + return runTestTask('advanced_compile_in_browser', runCompileCheckInBrowser); } // Run all tests in sequence. -const test = new Tester([ +const tasks = [ eslint, + // Build must run before the remaining tasks build, renamings, metadata, mocha, generators, node, + // Make sure these two are in series with each other advancedCompile, -]).asTask(); + advancedCompileInBrowser +]; + +const test = gulp.series(...tasks, reportTestResult); module.exports = { From 954899f4c79845eb1dd7fc1d26f8013df16ee2f7 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 12 Jan 2023 20:53:41 +0000 Subject: [PATCH 032/141] chore: fix closure type errors (#6766) --- blocks/procedures.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index c5b7a6307..e2d4147af 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -942,7 +942,8 @@ const procedureCallerGetDefMixin = function() { /** * @param {string} name The name of the procedure model to find. - * @param {string[]} params The param names of the procedure model to find. + * @param {Array} params The param names of the procedure model + * to find. * @return {IProcedureModel} The procedure model that was found. */ findProcedureModel_(name, params = []) { @@ -1308,7 +1309,7 @@ const procedureCallerOnChangeMixin = { * Creates a procedure definition block with the given name and params, * and returns the procedure model associated with it. * @param {string} name The name of the procedure to create. - * @param {string[]} params The names of the parameters to create. + * @param {Array} params The names of the parameters to create. * @return {IProcedureModel} The procedure model associated with the new * procedure definition block. */ From a9d6c7b9cc7e8ef0abb724cd63ee81efd3e6e8b1 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 12 Jan 2023 20:53:53 +0000 Subject: [PATCH 033/141] chore: add docs link to generator error (#6765) * chore: add docs link to generator error * chore: add scheme to URL --- core/generator.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/generator.ts b/core/generator.ts index e78bd4b41..351aee41e 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -278,7 +278,10 @@ export class CodeGenerator { // Value blocks must return code and order of operations info. // Statement blocks must only return code. if (!Array.isArray(tuple)) { - throw TypeError('Expecting tuple from value block: ' + targetBlock.type); + throw TypeError( + `Expecting tuple from value block: ${targetBlock.type} See ` + + `https://developers.google.com/blockly/guides/create-custom-blocks/generating-code` + + `for more information`); } let code = tuple[0]; const innerOrder = tuple[1]; From 3cf0663847e9f45a86454b509728268097611991 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 12 Jan 2023 20:54:51 +0000 Subject: [PATCH 034/141] fix: copying and pasting procedure definitions (#6747) * fix: copy-pasting procedure definitions * chore: add test for loading two procedure defs --- blocks/procedures.js | 20 +++++++++- core/interfaces/i_procedure_block.ts | 2 + tests/mocha/blocks/procedures_test.js | 54 ++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index e2d4147af..31e652a3f 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -27,6 +27,7 @@ const {Block} = goog.requireType('Blockly.Block'); // TODO (6248): Properly import the BlockDefinition type. /* eslint-disable-next-line no-unused-vars */ const BlockDefinition = Object; +const {isProcedureBlock} = goog.require('Blockly.procedures.IProcedureModel'); const {ObservableProcedureModel} = goog.require('Blockly.procedures.ObservableProcedureModel'); const {ObservableParameterModel} = goog.require('Blockly.procedures.ObservableParameterModel'); const {config} = goog.require('Blockly.config'); @@ -576,7 +577,9 @@ const procedureDefMutator = { const map = this.workspace.getProcedureMap(); const procedureId = state['procedureId']; if (procedureId && procedureId != this.model_.getId() && - map.has(procedureId)) { + map.has(procedureId) && + (this.isInsertionMarker() || + this.noBlockHasClaimedModel_(procedureId))) { if (map.has(this.model_.getId())) { map.delete(this.model_.getId()); } @@ -598,6 +601,21 @@ const procedureDefMutator = { Procedures.mutateCallers(this); }, + /** + * Returns true if there is no definition block currently associated with the + * given procedure ID. False otherwise. + * @param {string} procedureId The ID of the procedure to check for a claiming + * block. + * @return {boolean} True if there is no definition block currently associated + * with the given procedure ID. False otherwise. + */ + noBlockHasClaimedModel_(procedureId) { + const model = this.workspace.getProcedureMap().get(procedureId); + return this.workspace.getAllBlocks(false).every( + (b) => !isProcedureBlock(b) || !b.isProcedureDef() || + b.getProcedureModel() !== model); + }, + /** * Populate the mutator's dialog with this block's components. * @param {!Workspace} workspace Mutator's workspace. diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts index b2ab39629..59ca26b23 100644 --- a/core/interfaces/i_procedure_block.ts +++ b/core/interfaces/i_procedure_block.ts @@ -6,6 +6,8 @@ import type {Block} from '../block.js'; import {IProcedureModel} from './i_procedure_model.js'; +import * as goog from '../../closure/goog/goog.js'; +goog.declareModuleId('Blockly.procedures.IProcedureModel'); /** The interface for a block which models a procedure. */ diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index ed293a5b1..24a908a45 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -1985,7 +1985,7 @@ suite('Procedures', function() { }); }); - suite('extra serialization test cases', function() { + suite('full workspace serialization test cases', function() { test('definitions with parameters are properly rendered', function() { Blockly.serialization.workspaces.load({ "blocks": { @@ -2032,6 +2032,58 @@ suite('Procedures', function() { assertDefBlockStructure( this.workspace.getTopBlocks(false)[0], false, ['x'], ['varId']); }); + test( + 'multiple definitions pointing to the same model end up with ' + + 'different models', + function() { + Blockly.serialization.workspaces.load({ + "blocks": { + "languageVersion": 0, + "blocks": [ + { + "type": "procedures_defnoreturn", + "extraState": { + "procedureId": "procId", + }, + "fields": { + "NAME": "do something", + }, + }, + { + "type": "procedures_defnoreturn", + "y": 10, + "extraState": { + "procedureId": "procId", + }, + "fields": { + "NAME": "do something", + }, + }, + ], + }, + "procedures": [ + { + "id": "procId", + "name": "do something", + "returnTypes": null, + }, + ], + }, this.workspace); + const def1 = this.workspace.getTopBlocks(true)[0]; + const def2 = this.workspace.getTopBlocks(true)[1]; + chai.assert.equal( + def1.getProcedureModel().getName(), + 'do something', + 'Expected the first procedure definition to have the name in XML'); + chai.assert.equal( + def2.getProcedureModel().getName(), + 'do something2', + 'Expected the second procedure definition to be renamed'); + chai.assert.notEqual( + def1.getProcedureModel(), + def2.getProcedureModel(), + 'Expected the procedures to have different models'); + }); }); const testSuites = [ From cd57e74d1ac434ec3ca3b5b611eac673591fb317 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 12 Jan 2023 23:31:53 +0000 Subject: [PATCH 035/141] fix(deps): Don't use global variables for jsdom injection in `scripts/package/node/core.js` and `core/utils/xml.ts` (#6764) * fix(node): Don't use global variables for jsdom injection Introduce a (hopefully generally applicable) mechanism for injecting dependencies into modules, specifically in this case to inject required bits of JSDOM's Window and Document implementations into core/utils/xml.js when running in node.js or other environments lacking a DOM. The injectDependencies function uses an options object to facilitate optionally injecting multiple named dependencies at the same time. Rename the xmlDocument local variable back to document (was renamed in #5461) so that the name used in this module corresponds to the usual global variable it replaces. Change the injection in scripts/package/node/core.js to use injectDependencies instead of setXmlDocument + global variables; also eliminate apparently-unnecessary creation of a special Document instance, using the default one supplied by jsdom instead. Fixes #6725. * deprecate(xml): Deprecate getXmlDocument and setXmlDocument Mark getXmlDocument and setXmlDocument as @deprecated, with suitable calls to deprecation.warn(). There are no remaining callers to either function within core - setXmlDocument was only used by the node.js wrapper, and and apparently getXmlDocument was never used AFAICT - and we do not anticipate that either were used by external developers. * fix: Corrections for comments on PR #6764. --- core/utils/xml.ts | 68 ++++++++++++++++++++++++++++-------- scripts/package/node/core.js | 6 +--- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/core/utils/xml.ts b/core/utils/xml.ts index 7e701d12e..c33712992 100644 --- a/core/utils/xml.ts +++ b/core/utils/xml.ts @@ -14,6 +14,50 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.xml'); +import * as deprecation from './deprecation.js'; + + +/** + * Injected dependencies. By default these are just (and have the + * same types as) the corresponding DOM Window properties, but the + * Node.js wrapper for Blockly (see scripts/package/node/core.js) + * calls injectDependencies to supply implementations from the jsdom + * package instead. + */ +let {document, DOMParser, XMLSerializer} = globalThis; + +/** + * Inject implementations of document, DOMParser and/or XMLSerializer + * to use instead of the default ones. + * + * Used by the Node.js wrapper for Blockly (see + * scripts/package/node/core.js) to supply implementations from the + * jsdom package instead. + * + * While they may be set individually, it is normally the case that + * all three will be sourced from the same JSDOM instance. They MUST + * at least come from the same copy of the jsdom package. (Typically + * this is hard to avoid satsifying this requirement, but it can be + * inadvertently violated by using webpack to build multiple bundles + * containing Blockly and jsdom, and then loading more than one into + * the same JavaScript runtime. See + * https://github.com/google/blockly-samples/pull/1452#issuecomment-1364442135 + * for an example of how this happened.) + * + * @param dependencies Options object containing dependencies to set. + */ +export function injectDependencies(dependencies: { + document?: Document, + DOMParser?: typeof DOMParser, + XMLSerializer?: typeof XMLSerializer, +}) { + ({ + // Default to existing value if option not supplied. + document = document, + DOMParser = DOMParser, + XMLSerializer = XMLSerializer, + } = dependencies); +} /** * Namespace for Blockly's XML. @@ -22,32 +66,28 @@ goog.declareModuleId('Blockly.utils.xml'); */ export const NAME_SPACE = 'https://developers.google.com/blockly/xml'; -/** - * The Document object to use. By default this is just document, but - * the Node.js build of Blockly (see scripts/package/node/core.js) - * calls setDocument to supply a Document implementation from the - * jsdom package instead. - */ -let xmlDocument: Document = globalThis['document']; - /** * Get the document object to use for XML serialization. * * @returns The document object. + * @deprecated No longer provided by Blockly. * @alias Blockly.utils.xml.getDocument */ export function getDocument(): Document { - return xmlDocument; + deprecation.warn('Blockly.utils.xml.getDocument', 'version 9', 'version 10'); + return document; } /** * Get the document object to use for XML serialization. * - * @param document The document object to use. + * @param xmlDocument The document object to use. + * @deprecated No longer provided by Blockly. * @alias Blockly.utils.xml.setDocument */ -export function setDocument(document: Document) { - xmlDocument = document; +export function setDocument(xmlDocument: Document) { + deprecation.warn('Blockly.utils.xml.setDocument', 'version 9', 'version 10'); + document = xmlDocument; } /** @@ -58,7 +98,7 @@ export function setDocument(document: Document) { * @alias Blockly.utils.xml.createElement */ export function createElement(tagName: string): Element { - return xmlDocument.createElementNS(NAME_SPACE, tagName); + return document.createElementNS(NAME_SPACE, tagName); } /** @@ -69,7 +109,7 @@ export function createElement(tagName: string): Element { * @alias Blockly.utils.xml.createTextNode */ export function createTextNode(text: string): Text { - return xmlDocument.createTextNode(text); + return document.createTextNode(text); } /** diff --git a/scripts/package/node/core.js b/scripts/package/node/core.js index 28c1b3c90..aead71a03 100644 --- a/scripts/package/node/core.js +++ b/scripts/package/node/core.js @@ -18,9 +18,5 @@ if (typeof globalThis.document !== 'object') { const {JSDOM} = require('jsdom'); const {window} = new JSDOM(``); - globalThis.DOMParser = window.DOMParser; - globalThis.XMLSerializer = window.XMLSerializer; - const xmlDocument = Blockly.utils.xml.textToDomDocument( - ``); - Blockly.utils.xml.setDocument(xmlDocument); + Blockly.utils.xml.injectDependencies(window); } From c0d89bcaf4bd22fd1aec48be837530d7a025ba14 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 13 Jan 2023 18:36:00 +0000 Subject: [PATCH 036/141] fix(tests): Have npm start run a full build (#6770) Doing npm start in a clean checkout loads a broken playground, because the deps script does not run buildLangfiles. To fix this (and also to ensure that compressed playground loading also works, even though uncompressed is the default), have the start script run the build script rather than just deps. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f3750183..bd144b0ba 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "publish:beta": "npm ci && gulp publishBeta", "recompile": "gulp recompile", "release": "gulp gitCreateRC", - "start": "npm run deps && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", + "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "tsc": "gulp tsc", "test": "gulp test", "test:generators": "gulp testGenerators", From 65834a0f01b0fdb86de1d9290324201044c8dfc7 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 13 Jan 2023 20:09:27 +0000 Subject: [PATCH 037/141] chore: make inline docs for events informative (#6755) * chore: make inline docs for events informative * Notifies the developer -> Notifies listeners * chore: cleanup from PR comments * chore: final PR fixes * chore: format --- core/events/events_abstract.ts | 16 ++++++---- core/events/events_block_base.ts | 7 ++-- core/events/events_block_change.ts | 13 +++++++- core/events/events_block_create.ts | 12 +++++-- core/events/events_block_delete.ts | 19 +++++++---- core/events/events_block_drag.ts | 15 ++++++--- core/events/events_block_move.ts | 26 ++++++++++++++- core/events/events_bubble_open.ts | 10 +++--- core/events/events_click.ts | 10 ++++-- core/events/events_comment_base.ts | 13 ++------ core/events/events_comment_change.ts | 7 +++- core/events/events_comment_create.ts | 3 +- core/events/events_comment_delete.ts | 4 ++- core/events/events_comment_move.ts | 15 +++++---- core/events/events_marker_move.ts | 22 ++++++++----- core/events/events_procedure_base.ts | 4 +++ core/events/events_procedure_change_return.ts | 2 +- core/events/events_procedure_create.ts | 2 +- core/events/events_procedure_delete.ts | 2 +- core/events/events_procedure_enable.ts | 3 +- .../events/events_procedure_parameter_base.ts | 5 +++ .../events_procedure_parameter_create.ts | 2 +- .../events_procedure_parameter_delete.ts | 2 +- .../events_procedure_parameter_rename.ts | 5 ++- core/events/events_procedure_rename.ts | 6 ++-- core/events/events_selected.ts | 11 +++++-- core/events/events_theme_change.ts | 6 ++-- core/events/events_toolbox_item_select.ts | 10 +++--- core/events/events_trashcan_open.ts | 8 +++-- core/events/events_var_base.ts | 4 +-- core/events/events_var_create.ts | 6 +++- core/events/events_var_delete.ts | 11 +++---- core/events/events_var_rename.ts | 13 ++++---- core/events/events_viewport.ts | 32 +++++++++++-------- core/events/workspace_events.ts | 8 ++--- 35 files changed, 208 insertions(+), 126 deletions(-) diff --git a/core/events/events_abstract.ts b/core/events/events_abstract.ts index 39d01c040..f22c9c3b8 100644 --- a/core/events/events_abstract.ts +++ b/core/events/events_abstract.ts @@ -34,7 +34,16 @@ export abstract class Abstract { /** The workspace identifier for this event. */ workspaceId?: string = undefined; + + /** + * An ID for the group of events this block is associated with. + * + * Groups define events that should be treated as an single action from the + * user's perspective, and should be undone together. + */ group: string; + + /** Whether this event is undoable or not. */ recordUndo: boolean; /** Whether or not the event is a UI event. */ @@ -45,14 +54,7 @@ export abstract class Abstract { /** @alias Blockly.Events.Abstract */ constructor() { - /** - * The event group ID for the group this event belongs to. Groups define - * events that should be treated as an single action from the user's - * perspective, and should be undone together. - */ this.group = eventUtils.getGroup(); - - /** Sets whether the event should be added to the undo stack. */ this.recordUndo = eventUtils.getRecordUndo(); } diff --git a/core/events/events_block_base.ts b/core/events/events_block_base.ts index cd134c516..8d2c79665 100644 --- a/core/events/events_block_base.ts +++ b/core/events/events_block_base.ts @@ -20,12 +20,14 @@ import {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js /** - * Abstract class for a block event. + * Abstract class for any event related to blocks. * * @alias Blockly.Events.BlockBase */ export class BlockBase extends AbstractEvent { override isBlank = true; + + /** The ID of the block associated with this event. */ blockId?: string; /** @@ -38,10 +40,7 @@ export class BlockBase extends AbstractEvent { if (!opt_block) return; - /** The block ID for the block this event pertains to */ this.blockId = opt_block.id; - - /** The workspace identifier for this event. */ this.workspaceId = opt_block.workspace.id; } diff --git a/core/events/events_block_change.ts b/core/events/events_block_change.ts index e9c34013c..288fe0e46 100644 --- a/core/events/events_block_change.ts +++ b/core/events/events_block_change.ts @@ -24,15 +24,26 @@ import * as eventUtils from './utils.js'; /** - * Class for a block change event. + * Notifies listeners when some element of a block has changed (e.g. + * field values, comments, etc). * * @alias Blockly.Events.BlockChange */ export class BlockChange extends BlockBase { override type = eventUtils.BLOCK_CHANGE; + /** + * The element that changed; one of 'field', 'comment', 'collapsed', + * 'disabled', 'inline', or 'mutation' + */ element?: string; + + /** The name of the field that changed, if this is a change to a field. */ name?: string; + + /** The original value of the element. */ oldValue: unknown; + + /** The new value of the element. */ newValue: unknown; /** diff --git a/core/events/events_block_create.ts b/core/events/events_block_create.ts index 4a6ad8232..d88f84388 100644 --- a/core/events/events_block_create.ts +++ b/core/events/events_block_create.ts @@ -24,16 +24,23 @@ import {Workspace} from '../workspace.js'; /** - * Class for a block creation event. + * Notifies listeners when a block (or connected stack of blocks) is + * created. * * @alias Blockly.Events.BlockCreate */ export class BlockCreate extends BlockBase { override type = eventUtils.BLOCK_CREATE; + + /** The XML representation of the created block(s). */ xml?: Element|DocumentFragment; - ids?: string[]; + + /** The JSON respresentation of the created block(s). */ json?: blocks.State; + /** All of the IDs of created blocks. */ + ids?: string[]; + /** @param opt_block The created block. Undefined for a blank event. */ constructor(opt_block?: Block) { super(opt_block); @@ -50,7 +57,6 @@ export class BlockCreate extends BlockBase { this.xml = Xml.blockToDomWithXY(opt_block); this.ids = eventUtils.getDescendantIds(opt_block); - /** JSON representation of the block that was just created. */ this.json = blocks.save(opt_block, {addCoordinates: true}) as blocks.State; } diff --git a/core/events/events_block_delete.ts b/core/events/events_block_delete.ts index 0f5cf56e8..77071b95d 100644 --- a/core/events/events_block_delete.ts +++ b/core/events/events_block_delete.ts @@ -24,15 +24,24 @@ import {Workspace} from '../workspace.js'; /** - * Class for a block deletion event. + * Notifies listeners when a block (or connected stack of blocks) is + * deleted. * * @alias Blockly.Events.BlockDelete */ export class BlockDelete extends BlockBase { + /** The XML representation of the deleted block(s). */ oldXml?: Element|DocumentFragment; - ids?: string[]; - wasShadow?: boolean; + + /** The JSON respresentation of the deleted block(s). */ oldJson?: blocks.State; + + /** All of the IDs of deleted blocks. */ + ids?: string[]; + + /** True if the deleted block was a shadow block, false otherwise. */ + wasShadow?: boolean; + override type = eventUtils.BLOCK_DELETE; /** @param opt_block The deleted block. Undefined for a blank event. */ @@ -53,11 +62,7 @@ export class BlockDelete extends BlockBase { this.oldXml = Xml.blockToDomWithXY(opt_block); this.ids = eventUtils.getDescendantIds(opt_block); - - /** Was the block that was just deleted a shadow? */ this.wasShadow = opt_block.isShadow(); - - /** JSON representation of the block that was just deleted. */ this.oldJson = blocks.save(opt_block, {addCoordinates: true}) as blocks.State; } diff --git a/core/events/events_block_drag.ts b/core/events/events_block_drag.ts index 822e5dfce..bf928d713 100644 --- a/core/events/events_block_drag.ts +++ b/core/events/events_block_drag.ts @@ -22,14 +22,23 @@ import {Workspace} from '../workspace.js'; /** - * Class for a block drag event. + * Notifies listeners when a block is being manually dragged/dropped. * * @alias Blockly.Events.BlockDrag */ export class BlockDrag extends UiBase { + /** The ID of the top-level block being dragged. */ blockId?: string; + + /** True if this is the start of a drag, false if this is the end of one. */ isStart?: boolean; + + /** + * A list of all of the blocks (i.e. all descendants of the block associated + * with the block ID) being dragged. + */ blocks?: Block[]; + override type = eventUtils.BLOCK_DRAG; /** @@ -46,11 +55,7 @@ export class BlockDrag extends UiBase { if (!opt_block) return; this.blockId = opt_block.id; - - /** Whether this is the start of a block drag. */ this.isStart = opt_isStart; - - /** The blocks affected by this drag event. */ this.blocks = opt_blocks; } diff --git a/core/events/events_block_move.ts b/core/events/events_block_move.ts index 2aaffa524..a0bb9bbd5 100644 --- a/core/events/events_block_move.ts +++ b/core/events/events_block_move.ts @@ -30,18 +30,42 @@ interface BlockLocation { } /** - * Class for a block move event. Created before the move. + * Notifies listeners when a block is moved. This could be from one + * connection to another, or from one location on the workspace to another. * * @alias Blockly.Events.BlockMove */ export class BlockMove extends BlockBase { override type = eventUtils.BLOCK_MOVE; + + /** The ID of the old parent block. Undefined if it was a top-level block. */ oldParentId?: string; + + /** + * The name of the old input. Undefined if it was a top-level block or the + * parent's next block. + */ oldInputName?: string; + + /** + * The old X and Y workspace coordinates of the block if it was a top level + * block. Undefined if it was not a top level block. + */ oldCoordinate?: Coordinate; + /** The ID of the new parent block. Undefined if it is a top-level block. */ newParentId?: string; + + /** + * The name of the new input. Undefined if it is a top-level block or the + * parent's next block. + */ newInputName?: string; + + /** + * The new X and Y workspace coordinates of the block if it is a top level + * block. Undefined if it is not a top level block. + */ newCoordinate?: Coordinate; /** @param opt_block The moved block. Undefined for a blank event. */ diff --git a/core/events/events_bubble_open.ts b/core/events/events_bubble_open.ts index 6e6c26934..8ea2f967e 100644 --- a/core/events/events_bubble_open.ts +++ b/core/events/events_bubble_open.ts @@ -27,9 +27,15 @@ import type {Workspace} from '../workspace.js'; * @alias Blockly.Events.BubbleOpen */ export class BubbleOpen extends UiBase { + /** The ID of the block the bubble is attached to. */ blockId?: string; + + /** True if the bubble is opening, false if closing. */ isOpen?: boolean; + + /** The type of bubble; one of 'mutator', 'comment', or 'warning'. */ bubbleType?: BubbleType; + override type = eventUtils.BUBBLE_OPEN; /** @@ -46,11 +52,7 @@ export class BubbleOpen extends UiBase { if (!opt_block) return; this.blockId = opt_block.id; - - /** Whether the bubble is opening (false if closing). */ this.isOpen = opt_isOpen; - - /** The type of bubble. One of 'mutator', 'comment', or 'warning'. */ this.bubbleType = opt_bubbleType; } diff --git a/core/events/events_click.ts b/core/events/events_click.ts index a5cafd718..f9ac79817 100644 --- a/core/events/events_click.ts +++ b/core/events/events_click.ts @@ -23,12 +23,18 @@ import {Workspace} from '../workspace.js'; /** - * Class for a click event. + * Notifies listeners that ome blockly element was clicked. * * @alias Blockly.Events.Click */ export class Click extends UiBase { + /** The ID of the block that was clicked, if a block was clicked. */ blockId?: string; + + /** + * The type of element that was clicked; one of 'block', 'workspace', + * or 'zoom_controls'. + */ targetType?: ClickTarget; override type = eventUtils.CLICK; @@ -51,8 +57,6 @@ export class Click extends UiBase { super(workspaceId); this.blockId = opt_block ? opt_block.id : undefined; - - /** The type of element targeted by this click event. */ this.targetType = opt_targetType; } diff --git a/core/events/events_comment_base.ts b/core/events/events_comment_base.ts index dd681a79d..cfbb333c0 100644 --- a/core/events/events_comment_base.ts +++ b/core/events/events_comment_base.ts @@ -31,6 +31,8 @@ import type {Workspace} from '../workspace.js'; */ export class CommentBase extends AbstractEvent { override isBlank = true; + + /** The ID of the comment that this event references. */ commentId?: string; /** @@ -44,20 +46,9 @@ export class CommentBase extends AbstractEvent { if (!opt_comment) return; - /** The ID of the comment this event pertains to. */ this.commentId = opt_comment.id; - - /** The workspace identifier for this event. */ this.workspaceId = opt_comment.workspace.id; - - /** - * The event group ID for the group this event belongs to. Groups define - * events that should be treated as an single action from the user's - * perspective, and should be undone together. - */ this.group = eventUtils.getGroup(); - - /** Sets whether the event should be added to the undo stack. */ this.recordUndo = eventUtils.getRecordUndo(); } diff --git a/core/events/events_comment_change.ts b/core/events/events_comment_change.ts index f1007ed6c..afecc21ca 100644 --- a/core/events/events_comment_change.ts +++ b/core/events/events_comment_change.ts @@ -22,13 +22,18 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a comment change event. + * Notifies listeners that the contents of a workspace comment has changed. * * @alias Blockly.Events.CommentChange */ export class CommentChange extends CommentBase { override type = eventUtils.COMMENT_CHANGE; + + // TODO(#6774): We should remove underscores. + /** The previous contents of the comment. */ oldContents_?: string; + + /** The new contents of the comment. */ newContents_?: string; /** diff --git a/core/events/events_comment_create.ts b/core/events/events_comment_create.ts index fa54b0e96..712c7248c 100644 --- a/core/events/events_comment_create.ts +++ b/core/events/events_comment_create.ts @@ -23,13 +23,14 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a comment creation event. + * Notifies listeners that a workspace comment was created. * * @alias Blockly.Events.CommentCreate */ export class CommentCreate extends CommentBase { override type = eventUtils.COMMENT_CREATE; + /** The XML representation of the created workspace comment. */ xml?: Element|DocumentFragment; /** diff --git a/core/events/events_comment_delete.ts b/core/events/events_comment_delete.ts index 8ec7b5913..fdc513b23 100644 --- a/core/events/events_comment_delete.ts +++ b/core/events/events_comment_delete.ts @@ -22,12 +22,14 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a comment deletion event. + * Notifies listeners that a workspace comment has been deleted. * * @alias Blockly.Events.CommentDelete */ export class CommentDelete extends CommentBase { override type = eventUtils.COMMENT_DELETE; + + /** The XML representation of the deleted workspace comment. */ xml?: Element; /** diff --git a/core/events/events_comment_move.ts b/core/events/events_comment_move.ts index e40c48569..fa05de2a8 100644 --- a/core/events/events_comment_move.ts +++ b/core/events/events_comment_move.ts @@ -23,15 +23,21 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a comment move event. Created before the move. + * Notifies listeners that a workspace comment has moved. * * @alias Blockly.Events.CommentMove */ export class CommentMove extends CommentBase { override type = eventUtils.COMMENT_MOVE; + + /** The comment that is being moved. */ comment_?: WorkspaceComment; + + // TODO(#6774): We should remove underscores. + /** The location of the comment before the move, in workspace coordinates. */ oldCoordinate_?: Coordinate; - /** The location after the move, in workspace coordinates. */ + + /** The location of the comment after the move, in workspace coordinates. */ newCoordinate_?: Coordinate; /** @@ -45,12 +51,7 @@ export class CommentMove extends CommentBase { return; // Blank event to be populated by fromJson. } - /** - * The comment that is being moved. - */ this.comment_ = opt_comment; - - /** The location before the move, in workspace coordinates. */ this.oldCoordinate_ = opt_comment.getXY(); } diff --git a/core/events/events_marker_move.ts b/core/events/events_marker_move.ts index 3639c738b..9ba2fdc8b 100644 --- a/core/events/events_marker_move.ts +++ b/core/events/events_marker_move.ts @@ -24,15 +24,28 @@ import * as eventUtils from './utils.js'; /** - * Class for a marker move event. + * Notifies listeners that a marker (used for keyboard navigation) has + * moved. * * @alias Blockly.Events.MarkerMove */ export class MarkerMove extends UiBase { + /** The ID of the block the marker is now on, if any. */ blockId?: string; + + /** The old node the marker used to be on, if any. */ oldNode?: ASTNode; + + /** The new node the marker is now on. */ newNode?: ASTNode; + + /** + * True if this is a cursor event, false otherwise. + * For information about cursors vs markers see {@link + * https://blocklycodelabs.dev/codelabs/keyboard-navigation/index.html?index=..%2F..index#1}. + */ isCursor?: boolean; + override type = eventUtils.MARKER_MOVE; /** @@ -54,16 +67,9 @@ export class MarkerMove extends UiBase { } super(workspaceId); - /** The block identifier for this event. */ this.blockId = opt_block?.id; - - /** The old node the marker used to be on. */ this.oldNode = opt_oldNode || undefined; - - /** The new node the marker is now on. */ this.newNode = opt_newNode; - - /** Whether this is a cursor event. */ this.isCursor = isCursor; } diff --git a/core/events/events_procedure_base.ts b/core/events/events_procedure_base.ts index 1c17db24a..f775a30a2 100644 --- a/core/events/events_procedure_base.ts +++ b/core/events/events_procedure_base.ts @@ -15,6 +15,10 @@ import type {Workspace} from '../workspace.js'; export abstract class ProcedureBase extends AbstractEvent { isBlank = false; + /** + * @param workspace The workspace the procedure model exists in. + * @param model The procedure model associated with this event. + */ constructor(workspace: Workspace, public readonly model: IProcedureModel) { super(); this.workspaceId = workspace.id; diff --git a/core/events/events_procedure_change_return.ts b/core/events/events_procedure_change_return.ts index a6e3c6be7..974049cb9 100644 --- a/core/events/events_procedure_change_return.ts +++ b/core/events/events_procedure_change_return.ts @@ -14,7 +14,7 @@ import * as eventUtils from './utils.js'; /** - * Represents a procedure's return type/status changing. + * Notifies listeners that a procedure's return type/status has changed. */ export class ProcedureChangeReturn extends ProcedureBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_create.ts b/core/events/events_procedure_create.ts index ddccfb983..d294dc6c1 100644 --- a/core/events/events_procedure_create.ts +++ b/core/events/events_procedure_create.ts @@ -15,7 +15,7 @@ import * as eventUtils from './utils.js'; /** - * Represents a procedure data model being created. + * Notifies listeners that a procedure data model has been created. */ export class ProcedureCreate extends ProcedureBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_delete.ts b/core/events/events_procedure_delete.ts index e7555aeba..3a841c2e8 100644 --- a/core/events/events_procedure_delete.ts +++ b/core/events/events_procedure_delete.ts @@ -15,7 +15,7 @@ import * as eventUtils from './utils.js'; /** - * Represents a procedure data model being deleted. + * Notifies listeners that a procedure data model has been deleted. */ export class ProcedureDelete extends ProcedureBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_enable.ts b/core/events/events_procedure_enable.ts index 3ae52e93f..8ec32f3d6 100644 --- a/core/events/events_procedure_enable.ts +++ b/core/events/events_procedure_enable.ts @@ -13,7 +13,8 @@ import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; import * as eventUtils from './utils.js'; /** - * Represents a procedure data model being enabled or disabled. + * Notifies listeners that the procedure data model has been enabled or + * disabled. */ export class ProcedureEnable extends ProcedureBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_parameter_base.ts b/core/events/events_procedure_parameter_base.ts index 1bbfb2429..f03094d25 100644 --- a/core/events/events_procedure_parameter_base.ts +++ b/core/events/events_procedure_parameter_base.ts @@ -16,6 +16,11 @@ import type {Workspace} from '../workspace.js'; * The base event for an event associated with a procedure parameter. */ export abstract class ProcedureParameterBase extends ProcedureBase { + /** + * @param workspace The workspace the parameter model exists in. + * @param model The procedure model the parameter model belongs to. + * @param parameter The parameter model associated with this event. + */ constructor( workspace: Workspace, model: IProcedureModel, public readonly parameter: IParameterModel) { diff --git a/core/events/events_procedure_parameter_create.ts b/core/events/events_procedure_parameter_create.ts index 1271effc3..8fae7b9ae 100644 --- a/core/events/events_procedure_parameter_create.ts +++ b/core/events/events_procedure_parameter_create.ts @@ -16,7 +16,7 @@ import * as eventUtils from './utils.js'; /** - * Represents a parameter being added to a procedure. + * Notifies listeners that a parameter has been added to a procedure model. */ export class ProcedureParameterCreate extends ProcedureParameterBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_parameter_delete.ts b/core/events/events_procedure_parameter_delete.ts index 4ee43bb0b..aa479a37d 100644 --- a/core/events/events_procedure_parameter_delete.ts +++ b/core/events/events_procedure_parameter_delete.ts @@ -14,7 +14,7 @@ import {ProcedureParameterBase, ProcedureParameterBaseJson} from './events_proce import * as eventUtils from './utils.js'; /** - * Represents a parameter being removed from a procedure. + * Notifies listeners that a parameter has been removed from a procedure. */ export class ProcedureParameterDelete extends ProcedureParameterBase { /** A string used to check the type of the event. */ diff --git a/core/events/events_procedure_parameter_rename.ts b/core/events/events_procedure_parameter_rename.ts index 9baafc11b..3b0aa71f6 100644 --- a/core/events/events_procedure_parameter_rename.ts +++ b/core/events/events_procedure_parameter_rename.ts @@ -13,13 +13,16 @@ import {ProcedureParameterBase, ProcedureParameterBaseJson} from './events_proce import * as eventUtils from './utils.js'; /** - * Represents a parameter of a procedure being renamed. + * Notifies listeners that a procedure parameter was renamed. */ export class ProcedureParameterRename extends ProcedureParameterBase { /** A string used to check the type of the event. */ type = eventUtils.PROCEDURE_PARAMETER_RENAME; + + /** The new name of the procedure parameter. */ private readonly newName: string; + /** @param oldName The old name of the procedure parameter. */ constructor( workspace: Workspace, procedure: IProcedureModel, parameter: IParameterModel, public readonly oldName: string) { diff --git a/core/events/events_procedure_rename.ts b/core/events/events_procedure_rename.ts index 0b849d771..80217d10b 100644 --- a/core/events/events_procedure_rename.ts +++ b/core/events/events_procedure_rename.ts @@ -11,14 +11,14 @@ import type {Workspace} from '../workspace.js'; import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; import * as eventUtils from './utils.js'; -/** - * Represents a procedure being renamed. - */ +/** Notifies listeners that a procedure model has been renamed. */ export class ProcedureRename extends ProcedureBase { /** A string used to check the type of the event. */ type = eventUtils.PROCEDURE_RENAME; + private newName: string; + /** @param oldName The old name of the procedure model. */ constructor( workspace: Workspace, model: IProcedureModel, public readonly oldName: string) { diff --git a/core/events/events_selected.ts b/core/events/events_selected.ts index 347bdb22a..03fcfd9d9 100644 --- a/core/events/events_selected.ts +++ b/core/events/events_selected.ts @@ -23,12 +23,20 @@ import type {Workspace} from '../workspace.js'; /** * Class for a selected event. + * Notifies listeners that a new element has been selected. * * @alias Blockly.Events.Selected */ export class Selected extends UiBase { + /** The id of the last selected selectable element. */ oldElementId?: string; + + /** + * The id of the newly selected selectable element, + * or undefined if unselected. + */ newElementId?: string; + override type = eventUtils.SELECTED; /** @@ -44,10 +52,7 @@ export class Selected extends UiBase { opt_workspaceId?: string) { super(opt_workspaceId); - /** The id of the last selected element. */ this.oldElementId = opt_oldElementId ?? undefined; - - /** The id of the selected element. */ this.newElementId = opt_newElementId ?? undefined; } diff --git a/core/events/events_theme_change.ts b/core/events/events_theme_change.ts index 75c5641e2..9f5a58464 100644 --- a/core/events/events_theme_change.ts +++ b/core/events/events_theme_change.ts @@ -21,12 +21,14 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a theme change event. + * Notifies listeners that the workspace theme has changed. * * @alias Blockly.Events.ThemeChange */ export class ThemeChange extends UiBase { + /** The name of the new theme that has been set. */ themeName?: string; + override type = eventUtils.THEME_CHANGE; /** @@ -36,8 +38,6 @@ export class ThemeChange extends UiBase { */ constructor(opt_themeName?: string, opt_workspaceId?: string) { super(opt_workspaceId); - - /** The theme name. */ this.themeName = opt_themeName; } diff --git a/core/events/events_toolbox_item_select.ts b/core/events/events_toolbox_item_select.ts index 81e8a7eda..2f47eb9d8 100644 --- a/core/events/events_toolbox_item_select.ts +++ b/core/events/events_toolbox_item_select.ts @@ -21,13 +21,17 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a toolbox item select event. + * Notifies listeners that a toolbox item has been selected. * * @alias Blockly.Events.ToolboxItemSelect */ export class ToolboxItemSelect extends UiBase { + /** The previously selected toolbox item. */ oldItem?: string; + + /** The newly selected toolbox item. */ newItem?: string; + override type = eventUtils.TOOLBOX_ITEM_SELECT; /** @@ -42,11 +46,7 @@ export class ToolboxItemSelect extends UiBase { opt_oldItem?: string|null, opt_newItem?: string|null, opt_workspaceId?: string) { super(opt_workspaceId); - - /** The previously selected toolbox item. */ this.oldItem = opt_oldItem ?? undefined; - - /** The newly selected toolbox item. */ this.newItem = opt_newItem ?? undefined; } diff --git a/core/events/events_trashcan_open.ts b/core/events/events_trashcan_open.ts index fd6001dfd..95876dfd8 100644 --- a/core/events/events_trashcan_open.ts +++ b/core/events/events_trashcan_open.ts @@ -22,11 +22,15 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a trashcan open event. + * Notifies listeners when the trashcan is opening or closing. * * @alias Blockly.Events.TrashcanOpen */ export class TrashcanOpen extends UiBase { + /** + * True if the trashcan is currently opening (previously closed). + * False if it is currently closing (previously open). + */ isOpen?: boolean; override type = eventUtils.TRASHCAN_OPEN; @@ -38,8 +42,6 @@ export class TrashcanOpen extends UiBase { */ constructor(opt_isOpen?: boolean, opt_workspaceId?: string) { super(opt_workspaceId); - - /** Whether the trashcan flyout is opening (false if closing). */ this.isOpen = opt_isOpen; } diff --git a/core/events/events_var_base.ts b/core/events/events_var_base.ts index 41370702d..0bbd48fcf 100644 --- a/core/events/events_var_base.ts +++ b/core/events/events_var_base.ts @@ -26,6 +26,7 @@ import type {Workspace} from '../workspace.js'; */ export class VarBase extends AbstractEvent { override isBlank = true; + /** The ID of the variable this event references. */ varId?: string; /** @@ -37,10 +38,7 @@ export class VarBase extends AbstractEvent { this.isBlank = typeof opt_variable === 'undefined'; if (!opt_variable) return; - /** The variable id for the variable this event pertains to. */ this.varId = opt_variable.getId(); - - /** The workspace identifier for this event. */ this.workspaceId = opt_variable.workspace.id; } diff --git a/core/events/events_var_create.ts b/core/events/events_var_create.ts index 925071c59..c30fb8463 100644 --- a/core/events/events_var_create.ts +++ b/core/events/events_var_create.ts @@ -22,13 +22,17 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a variable creation event. + * Notifies listeners that a variable model has been created. * * @alias Blockly.Events.VarCreate */ export class VarCreate extends VarBase { override type = eventUtils.VAR_CREATE; + + /** The type of the variable that was created. */ varType?: string; + + /** The name of the variable that was created. */ varName?: string; /** diff --git a/core/events/events_var_delete.ts b/core/events/events_var_delete.ts index ca9e2de97..d3f6c6f4f 100644 --- a/core/events/events_var_delete.ts +++ b/core/events/events_var_delete.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Classes for all types of variable events. - * - * @class - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events.VarDelete'); @@ -22,13 +17,15 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a variable deletion event. + * Notifies listeners that a variable model has been deleted. * - * @alias Blockly.Events.VarDelete + * @class */ export class VarDelete extends VarBase { override type = eventUtils.VAR_DELETE; + /** The type of the variable that was deleted. */ varType?: string; + /** The name of the variable that was deleted. */ varName?: string; /** diff --git a/core/events/events_var_rename.ts b/core/events/events_var_rename.ts index 278a1510d..bed95cf62 100644 --- a/core/events/events_var_rename.ts +++ b/core/events/events_var_rename.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Class for a variable rename event. - * - * @class - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events.VarRename'); @@ -22,13 +17,17 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a variable rename event. + * Notifies listeners that a variable model was renamed. * - * @alias Blockly.Events.VarRename + * @class */ export class VarRename extends VarBase { override type = eventUtils.VAR_RENAME; + + /** The previous name of the variable. */ oldName?: string; + + /** The new name of the variable. */ newName?: string; /** diff --git a/core/events/events_viewport.ts b/core/events/events_viewport.ts index 3367e35f8..7f853fae2 100644 --- a/core/events/events_viewport.ts +++ b/core/events/events_viewport.ts @@ -21,15 +21,32 @@ import type {Workspace} from '../workspace.js'; /** - * Class for a viewport change event. + * Notifies listeners that the workspace surface's position or scale has + * changed. + * + * Does not notify when the workspace itself resizes. * * @alias Blockly.Events.ViewportChange */ export class ViewportChange extends UiBase { + /** + * Top edge of the visible portion of the workspace, relative to the + * workspace origin. + */ viewTop?: number; + + /** + * The left edge of the visible portion of the workspace, relative to + * the workspace origin. + */ viewLeft?: number; + + /** The scale of the workpace. */ scale?: number; + + /** The previous scale of the workspace. */ oldScale?: number; + override type = eventUtils.VIEWPORT_CHANGE; /** @@ -48,22 +65,9 @@ export class ViewportChange extends UiBase { opt_workspaceId?: string, opt_oldScale?: number) { super(opt_workspaceId); - /** - * Top-edge of the visible portion of the workspace, relative to the - * workspace origin. - */ this.viewTop = opt_top; - - /** - * Left-edge of the visible portion of the workspace, relative to the - * workspace origin. - */ this.viewLeft = opt_left; - - /** The scale of the workspace. */ this.scale = opt_scale; - - /** The old scale of the workspace. */ this.oldScale = opt_oldScale; } diff --git a/core/events/workspace_events.ts b/core/events/workspace_events.ts index 95b533d54..6f6fc7e8e 100644 --- a/core/events/workspace_events.ts +++ b/core/events/workspace_events.ts @@ -19,10 +19,8 @@ import * as eventUtils from './utils.js'; /** - * Class for a finished loading event. - * Used to notify the developer when the workspace has finished loading (i.e - * domToWorkspace). - * Finished loading events do not record undo or redo. + * Notifies listeners when the workspace has finished deserializing from + * JSON/XML. * * @alias Blockly.Events.FinishedLoading */ @@ -37,12 +35,10 @@ export class FinishedLoading extends AbstractEvent { */ constructor(opt_workspace?: Workspace) { super(); - /** Whether or not the event is blank (to be populated by fromJson). */ this.isBlank = !!opt_workspace; if (!opt_workspace) return; - /** The workspace identifier for this event. */ this.workspaceId = opt_workspace.id; } From 59c7cb941bc47c4098872f216a307a99e9f68838 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Tue, 17 Jan 2023 08:17:46 -0800 Subject: [PATCH 038/141] fix: Increase generator test timeout (#6776) --- scripts/gulpfiles/test_tasks.js | 2 +- tests/generators/webdriver.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js index c4e19d606..b26e23084 100644 --- a/scripts/gulpfiles/test_tasks.js +++ b/scripts/gulpfiles/test_tasks.js @@ -299,7 +299,7 @@ async function generators() { rimraf.sync(OUTPUT_DIR); fs.mkdirSync(OUTPUT_DIR); - await runGeneratorsInBrowser(OUTPUT_DIR).catch(() => {}); + await runGeneratorsInBrowser(OUTPUT_DIR); const generatorSuffixes = ['js', 'py', 'dart', 'lua', 'php']; let failed = 0; diff --git a/tests/generators/webdriver.js b/tests/generators/webdriver.js index 202850746..a422323ec 100644 --- a/tests/generators/webdriver.js +++ b/tests/generators/webdriver.js @@ -66,6 +66,10 @@ async function runGeneratorsInBrowser(outputDir) { console.log('Starting webdriverio...'); const browser = await webdriverio.remote(options); + + // Increase the script timeouts to 2 minutes to allow the generators to finish. + await browser.setTimeout({ 'script': 120000 }) + console.log('Loading url: ' + url); await browser.url(url); From e89fcea02c18993150ef04539bd2fe6b70fef29f Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 17 Jan 2023 08:32:05 -0800 Subject: [PATCH 039/141] fix: Make metadata tests more resilient. (#6771) * fix: Make metadata tests more resilient. * fix: improve control flow and clarify xargs purpose. --- scripts/gulpfiles/test_tasks.js | 16 +++++++++++----- tests/scripts/check_metadata.sh | 8 ++++---- tests/scripts/update_metadata.sh | 10 ++++++---- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js index b26e23084..f13168670 100644 --- a/scripts/gulpfiles/test_tasks.js +++ b/scripts/gulpfiles/test_tasks.js @@ -165,17 +165,23 @@ function compareSize(file, expected) { const stat = fs.statSync(name); const size = stat.size; + if (!compare) { + const message = `Failed: Previous size of ${name} is undefined.`; + console.log(`${BOLD_RED}${message}${ANSI_RESET}`); + return 1; + } + 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; } + + const message = + `Size of ${name} at ${size} compared to previous ${expected}`; + console.log(`${BOLD_GREEN}${message}${ANSI_RESET}`); + return 0; } /** diff --git a/tests/scripts/check_metadata.sh b/tests/scripts/check_metadata.sh index 35dd8232e..7df0b1b8d 100755 --- a/tests/scripts/check_metadata.sh +++ b/tests/scripts/check_metadata.sh @@ -33,7 +33,7 @@ readonly RELEASE_DIR='dist' # Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion) # Q4 2022 8.0.0 870104 # Q4 2022 9.1.1 903357 -readonly BLOCKLY_SIZE_EXPECTED= 903357 +readonly BLOCKLY_SIZE_EXPECTED=903357 # Size of blocks_compressed.js # Q2 2019 2.20190722.0 75618 @@ -52,7 +52,7 @@ readonly BLOCKLY_SIZE_EXPECTED= 903357 # Q3 2022 8.0.0 102176 (mid-quarter typescript conversion) # Q4 2022 8.0.0 102213 # Q4 2022 9.1.1 102190 -readonly BLOCKS_SIZE_EXPECTED= 102190 +readonly BLOCKS_SIZE_EXPECTED=102190 # Size of blockly_compressed.js.gz # Q2 2019 2.20190722.0 180925 @@ -72,7 +72,7 @@ readonly BLOCKS_SIZE_EXPECTED= 102190 # Q3 2022 8.0.0 185766 (mid-quarter typescript conversion) # Q4 2022 8.0.0 175140 # Q4 2022 9.1.1 179306 -readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306 +readonly BLOCKLY_GZ_SIZE_EXPECTED=179306 # Size of blocks_compressed.js.gz # Q2 2019 2.20190722.0 14552 @@ -91,7 +91,7 @@ readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306 # Q3 2022 8.0.0 17016 (mid-quarter typescript conversion) # Q4 2022 8.0.0 17188 # Q4 2022 9.1.1 17182 -readonly BLOCKS_GZ_SIZE_EXPECTED= 17182 +readonly BLOCKS_GZ_SIZE_EXPECTED=17182 # ANSI colors readonly BOLD_GREEN='\033[1;32m' diff --git a/tests/scripts/update_metadata.sh b/tests/scripts/update_metadata.sh index 516409a54..e923b664f 100755 --- a/tests/scripts/update_metadata.sh +++ b/tests/scripts/update_metadata.sh @@ -12,10 +12,12 @@ readonly RELEASE_DIR='dist' gzip -k "${RELEASE_DIR}/blockly_compressed.js" gzip -k "${RELEASE_DIR}/blocks_compressed.js" -blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js") -blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js") -blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz") -blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz") +# wc prefixes the file size with whitespace; xargs strips that and the -n flag to +# echo removes the newline. +blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js" | xargs echo -n) +blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js" | xargs echo -n) +blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz" | xargs echo -n) +blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz" | xargs echo -n) quarters=(1 1 1 2 2 2 3 3 3 4 4 4) month=$(date +%-m) quarter=$(echo Q${quarters[$month - 1]} $(date +%Y)) From ee51c0f41c6c52d118b8e6b6d406b5b303c7e101 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 13:16:40 +0000 Subject: [PATCH 040/141] chore(deps): bump rimraf from 3.0.2 to 4.0.7 (#6778) * chore(deps): bump rimraf from 3.0.2 to 4.0.7 Bumps [rimraf](https://github.com/isaacs/rimraf) from 3.0.2 to 4.0.7. - [Release notes](https://github.com/isaacs/rimraf/releases) - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/rimraf/compare/v3.0.2...v4.0.7) --- updated-dependencies: - dependency-name: rimraf dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: fix use of rimraf Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Beka Westberg --- package-lock.json | 77 ++++++++++++++++++++++++------ package.json | 2 +- scripts/gulpfiles/build_tasks.js | 8 ++-- scripts/gulpfiles/package_tasks.js | 8 ++-- 4 files changed, 71 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index f43362afe..fc72e0952 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "mocha": "^10.0.0", "patch-package": "^6.4.7", "readline-sync": "^1.4.10", - "rimraf": "^3.0.2", + "rimraf": "^4.0.7", "selenium-standalone": "^8.0.3", "through2": "^4.0.2", "typescript": "^4.3.2", @@ -5117,6 +5117,21 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/flatted": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", @@ -10110,6 +10125,21 @@ "integrity": "sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ==", "dev": true }, + "node_modules/puppeteer-core/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/qs": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", @@ -10684,15 +10714,15 @@ "dev": true }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.0.7.tgz", + "integrity": "sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w==", "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, "bin": { - "rimraf": "bin.js" + "rimraf": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -17024,6 +17054,17 @@ "requires": { "flatted": "^3.1.0", "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } } }, "flatted": { @@ -21026,6 +21067,15 @@ "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1068969.tgz", "integrity": "sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ==", "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } } } }, @@ -21482,13 +21532,10 @@ "dev": true }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.0.7.tgz", + "integrity": "sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w==", + "dev": true }, "run-parallel": { "version": "1.2.0", diff --git a/package.json b/package.json index bd144b0ba..99a261ba8 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "mocha": "^10.0.0", "patch-package": "^6.4.7", "readline-sync": "^1.4.10", - "rimraf": "^3.0.2", + "rimraf": "^4.0.7", "selenium-standalone": "^8.0.3", "through2": "^4.0.2", "typescript": "^4.3.2", diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 5538abc92..9aaa7dc1d 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -23,7 +23,7 @@ const clangFormatter = require('gulp-clang-format'); const closureCompiler = require('google-closure-compiler').gulp(); const closureDeps = require('google-closure-deps'); const argv = require('yargs').argv; -const rimraf = require('rimraf'); +const {rimraf} = require('rimraf'); const {BUILD_DIR, DEPS_FILE, RELEASE_DIR, TEST_DEPS_FILE, TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} = require('./config'); const {getPackageJson} = require('./helper_tasks'); @@ -712,12 +712,12 @@ function buildAdvancedCompilationTest() { /** * This task cleans the build directory (by deleting it). */ -function cleanBuildDir(done) { +function cleanBuildDir() { // Sanity check. if (BUILD_DIR === '.' || BUILD_DIR === '/') { - throw new Error(`Refusing to rm -rf ${BUILD_DIR}`); + return Promise.reject(`Refusing to rm -rf ${BUILD_DIR}`); } - rimraf(BUILD_DIR, done); + return rimraf(BUILD_DIR); } /** diff --git a/scripts/gulpfiles/package_tasks.js b/scripts/gulpfiles/package_tasks.js index d5fba6258..d71bae493 100644 --- a/scripts/gulpfiles/package_tasks.js +++ b/scripts/gulpfiles/package_tasks.js @@ -18,7 +18,7 @@ gulp.replace = require('gulp-replace'); const path = require('path'); const fs = require('fs'); -const rimraf = require('rimraf'); +const {rimraf} = require('rimraf'); const build = require('./build_tasks'); const {getPackageJson} = require('./helper_tasks'); const {BUILD_DIR, RELEASE_DIR, TYPINGS_BUILD_DIR} = require('./config'); @@ -354,12 +354,12 @@ function packageDTS() { /** * This task cleans the release directory (by deleting it). */ -function cleanReleaseDir(done) { +function cleanReleaseDir() { // Sanity check. if (RELEASE_DIR === '.' || RELEASE_DIR === '/') { - throw new Error(`Refusing to rm -rf ${RELEASE_DIR}`); + return Promise.reject(`Refusing to rm -rf ${RELEASE_DIR}`); } - rimraf(RELEASE_DIR, done); + return rimraf(RELEASE_DIR); } /** From 856285c6ff91e4a658a55a5ded4305b3d3affb58 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 18 Jan 2023 09:29:00 -0800 Subject: [PATCH 041/141] chore: reorganize CI tests and add timeout (#6779) * chore: move clang formatter action into the build workflow * chore: add timeouts to CI tests --- .github/workflows/build.yml | 17 ++++++++++++++ .github/workflows/check_clang_format.yml | 28 ------------------------ 2 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/check_clang_format.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2414a9984..8dd45b064 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ permissions: jobs: build: + timeout-minutes: 10 runs-on: ${{ matrix.os }} strategy: @@ -54,6 +55,7 @@ jobs: CI: true lint: + timeout-minutes: 5 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -68,3 +70,18 @@ jobs: - name: Lint run: npm run lint + + clang-formatter: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: DoozyX/clang-format-lint-action@v0.15 + with: + source: 'core' + extensions: 'js,ts' + # This should be as close as possible to the version that the npm + # package supports. This can be found by running: + # npx clang-format --version. + clangFormatVersion: 15 diff --git a/.github/workflows/check_clang_format.yml b/.github/workflows/check_clang_format.yml deleted file mode 100644 index 94dc3461f..000000000 --- a/.github/workflows/check_clang_format.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Check clang format - -# N.B.: Runs with a read-only repo token. Safe(ish) to check out the -# submitted branch. -on: [pull_request] - -permissions: - contents: read - -jobs: - clang-formatter: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: DoozyX/clang-format-lint-action@v0.15 - with: - source: 'core' - extensions: 'js,ts' - # This should be as close as possible to the version that the npm - # package supports. This can be found by running: - # npx clang-format --version. - clangFormatVersion: 15 - - # The Report clang format workflow (report_clang_format.yml) will - # run (if required) after this one to post a comment to the PR. - # (Note that the version of that workflow run will be the one on - # the master (default) branch, not the PR target branch.) From 86f3fde69cab0913f78617255cc44dbf56cc335f Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Wed, 18 Jan 2023 10:31:56 -0800 Subject: [PATCH 042/141] chore: add a pretty summary to CI (#6780) --- scripts/gulpfiles/test_tasks.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js index f13168670..4ba23b683 100644 --- a/scripts/gulpfiles/test_tasks.js +++ b/scripts/gulpfiles/test_tasks.js @@ -34,6 +34,7 @@ const ANSI_RESET = '\x1b[0m'; let successCount = 0; let failCount = 0; let firstErr; +const results = {}; /** * Run an arbitrary Gulp task as a test. @@ -59,6 +60,7 @@ function runTestTask(id, task) { successCount++; if (process.env.CI) console.log('::endgroup::'); console.log(`${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${id}`); + results[id] = {success: true}; resolve(result); }) .catch((err) => { @@ -70,17 +72,38 @@ function runTestTask(id, task) { console.error(err.message); if (process.env.CI) console.log('::endgroup::'); console.log(`${BOLD_RED}FAILED:${ANSI_RESET} ${id}`); + results[id] = {success: false, message: err.message}; // Always continue. resolve(err); }); }); } +function createSummary() { + let summary = '# Test Summary\n\n'; + summary += '|Test Name|Passed?|Error message|\n'; + summary += '|---------|-------|-------------|\n'; + for (const test in results) { + summary += `|${test}|${results[test].success + ? ':white_check_mark:' : ':x:'}|${results[test].message ?? ''}|\n`; + } + summary += `\n\n## Total: ${successCount} passed. ${failCount} failed.`; + return summary; +} + /** * Print test results and fail the task if needed. */ function reportTestResult() { console.log('======================================='); + if (process.env.CI && process.env.GITHUB_STEP_SUMMARY) { + try { + fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY, createSummary()); + } catch(e) { + // Don't fail CI just because we couldn't write the summary. + console.log('Failed to write job summary', e); + } + } // Check result. if (failCount === 0) { console.log( From e20bf2c5bc150f6dd8d1883d9749f8a94a9dc0eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:56:03 -0800 Subject: [PATCH 043/141] chore(deps): bump got and js-green-licenses (#6772) Bumps [got](https://github.com/sindresorhus/got) to 11.8.6 and updates ancestor dependency [js-green-licenses](https://github.com/google/js-green-licenses). These dependencies need to be updated together. Updates `got` from 11.8.3 to 11.8.6 - [Release notes](https://github.com/sindresorhus/got/releases) - [Commits](https://github.com/sindresorhus/got/compare/v11.8.3...v11.8.6) Updates `js-green-licenses` from 3.0.1 to 4.0.0 - [Release notes](https://github.com/google/js-green-licenses/releases) - [Changelog](https://github.com/google/js-green-licenses/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/js-green-licenses/compare/v3.0.1...v4.0.0) --- updated-dependencies: - dependency-name: got dependency-type: indirect - dependency-name: js-green-licenses dependency-type: direct:development ... 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 | 491 +++++----------------------------------------- package.json | 2 +- 2 files changed, 51 insertions(+), 442 deletions(-) diff --git a/package-lock.json b/package-lock.json index fc72e0952..ab98ed040 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "gulp-sourcemaps": "^3.0.0", "gulp-umd": "^2.0.0", "http-server": "^14.0.0", - "js-green-licenses": "^3.0.0", + "js-green-licenses": "^4.0.0", "json5": "^2.2.0", "markdown-tables-to-json": "^0.1.7", "mocha": "^10.0.0", @@ -2049,18 +2049,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, "node_modules/acorn": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", @@ -4077,12 +4065,6 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, - "node_modules/duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, "node_modules/duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -4584,15 +4566,6 @@ "through": "^2.3.8" } }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -5299,19 +5272,18 @@ "dev": true }, "node_modules/gaxios": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.3.2.tgz", - "integrity": "sha512-T+ap6GM6UZ0c4E6yb1y/hy2UB6hTrqhglp3XfmU9qbLCGRYhLVV5aRPpC4EmoG8N8zOnkYCgoBz+ScvGAARY6Q==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.0.2.tgz", + "integrity": "sha512-TjtV2AJOZoMQqRYoy5eM8cCQogYwazWNYLQ72QB0kwa6vHHruYkGmhhyrlzbmgNHK1dNnuP2WSH81urfzyN2Og==", "dev": true, "dependencies": { - "abort-controller": "^3.0.0", "extend": "^3.0.2", "https-proxy-agent": "^5.0.0", "is-stream": "^2.0.0", - "node-fetch": "^2.6.1" + "node-fetch": "^2.6.7" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/get-caller-file": { @@ -5885,9 +5857,9 @@ } }, "node_modules/got": { - "version": "11.8.3", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", - "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "dev": true, "dependencies": { "@sindresorhus/is": "^4.0.0", @@ -7541,15 +7513,15 @@ "dev": true }, "node_modules/js-green-licenses": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-3.0.1.tgz", - "integrity": "sha512-dKyO14U6LaDzJ5gNlvP/v1vkTW7TTXEKNxMHnkxqdYStcYVEJlfubfqbEageVzV41PWu7felyNbwawoEJ/RpYQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-4.0.0.tgz", + "integrity": "sha512-kcgTOaZmpDpINcRAOKKhjHtBN6zibMVTC8qfPUOpowQtI/6fUgdmwJLJ0ycCb0pUO3ZYKn++56sy8IlG60p5mg==", "dev": true, "dependencies": { - "gaxios": "^4.0.0", + "gaxios": "^5.0.0", "meow": "^9.0.0", "npm-package-arg": "^8.0.0", - "package-json": "^6.0.0", + "package-json": "^7.0.0", "semver": "^7.3.2", "spdx-correct": "^3.0.0", "spdx-satisfies": "^5.0.0", @@ -7559,7 +7531,7 @@ "jsgl": "build/src/cli.js" }, "engines": { - "node": ">= 10.x" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, "node_modules/js-sdsl": { @@ -9288,178 +9260,21 @@ } }, "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-7.0.0.tgz", + "integrity": "sha512-CHJqc94AA8YfSLHGQT3DbvSIuE12NLFekpM4n7LRrAd3dOJtA911+4xe9q6nC3/jcKraq7nNS9VxgtT0KC+diA==", "dev": true, "dependencies": { - "got": "^9.6.0", + "got": "^11.8.2", "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", - "semver": "^6.2.0" + "semver": "^7.3.5" }, "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "dependencies": { - "defer-to-connect": "^1.0.1" + "node": ">=12" }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/package-json/node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "node_modules/package-json/node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "node_modules/package-json/node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.0" - } - }, - "node_modules/package-json/node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, - "node_modules/package-json/node_modules/responselike/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/parent-module": { @@ -9969,15 +9784,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/pretty-format": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.3.1.tgz", @@ -10219,7 +10025,7 @@ "node_modules/rc/node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -10457,12 +10263,12 @@ } }, "node_modules/registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.2.tgz", + "integrity": "sha512-PC5ZysNb42zpFME6D/XlIgtNGdTl8bBOCw90xQLVMpzuuubJKYDWFAEuUNc+Cn8Z8724tg2SDhDRrkVEsqfDMg==", "dev": true, "dependencies": { - "rc": "^1.2.8" + "rc": "1.2.8" }, "engines": { "node": ">=6.0.0" @@ -11884,15 +11690,6 @@ "node": ">=0.10.0" } }, - "node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -12299,18 +12096,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -14637,15 +14422,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, - "abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "requires": { - "event-target-shim": "^5.0.0" - } - }, "acorn": { "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", @@ -16215,12 +15991,6 @@ } } }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", - "dev": true - }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -16616,12 +16386,6 @@ "through": "^2.3.8" } }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true - }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -17194,16 +16958,15 @@ "dev": true }, "gaxios": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-4.3.2.tgz", - "integrity": "sha512-T+ap6GM6UZ0c4E6yb1y/hy2UB6hTrqhglp3XfmU9qbLCGRYhLVV5aRPpC4EmoG8N8zOnkYCgoBz+ScvGAARY6Q==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.0.2.tgz", + "integrity": "sha512-TjtV2AJOZoMQqRYoy5eM8cCQogYwazWNYLQ72QB0kwa6vHHruYkGmhhyrlzbmgNHK1dNnuP2WSH81urfzyN2Og==", "dev": true, "requires": { - "abort-controller": "^3.0.0", "extend": "^3.0.2", "https-proxy-agent": "^5.0.0", "is-stream": "^2.0.0", - "node-fetch": "^2.6.1" + "node-fetch": "^2.6.7" } }, "get-caller-file": { @@ -17641,9 +17404,9 @@ } }, "got": { - "version": "11.8.3", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", - "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "dev": true, "requires": { "@sindresorhus/is": "^4.0.0", @@ -18983,15 +18746,15 @@ "dev": true }, "js-green-licenses": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-3.0.1.tgz", - "integrity": "sha512-dKyO14U6LaDzJ5gNlvP/v1vkTW7TTXEKNxMHnkxqdYStcYVEJlfubfqbEageVzV41PWu7felyNbwawoEJ/RpYQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-4.0.0.tgz", + "integrity": "sha512-kcgTOaZmpDpINcRAOKKhjHtBN6zibMVTC8qfPUOpowQtI/6fUgdmwJLJ0ycCb0pUO3ZYKn++56sy8IlG60p5mg==", "dev": true, "requires": { - "gaxios": "^4.0.0", + "gaxios": "^5.0.0", "meow": "^9.0.0", "npm-package-arg": "^8.0.0", - "package-json": "^6.0.0", + "package-json": "^7.0.0", "semver": "^7.3.2", "spdx-correct": "^3.0.0", "spdx-satisfies": "^5.0.0", @@ -20402,148 +20165,15 @@ "dev": true }, "package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-7.0.0.tgz", + "integrity": "sha512-CHJqc94AA8YfSLHGQT3DbvSIuE12NLFekpM4n7LRrAd3dOJtA911+4xe9q6nC3/jcKraq7nNS9VxgtT0KC+diA==", "dev": true, "requires": { - "got": "^9.6.0", + "got": "^11.8.2", "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "dependencies": { - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "requires": { - "defer-to-connect": "^1.0.1" - } - }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - } - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - } - } - }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "requires": { - "json-buffer": "3.0.0" - } - }, - "normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true - }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true - }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" - }, - "dependencies": { - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - } - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } + "semver": "^7.3.5" } }, "parent-module": { @@ -20938,12 +20568,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, "pretty-format": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.3.1.tgz", @@ -21132,7 +20756,7 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true } } @@ -21319,12 +20943,12 @@ "dev": true }, "registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.2.tgz", + "integrity": "sha512-PC5ZysNb42zpFME6D/XlIgtNGdTl8bBOCw90xQLVMpzuuubJKYDWFAEuUNc+Cn8Z8724tg2SDhDRrkVEsqfDMg==", "dev": true, "requires": { - "rc": "^1.2.8" + "rc": "1.2.8" } }, "registry-url": { @@ -22509,12 +22133,6 @@ } } }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true - }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -22832,15 +22450,6 @@ "requires-port": "^1.0.0" } }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "requires": { - "prepend-http": "^2.0.0" - } - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/package.json b/package.json index 99a261ba8..26b3a1fb4 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "gulp-sourcemaps": "^3.0.0", "gulp-umd": "^2.0.0", "http-server": "^14.0.0", - "js-green-licenses": "^3.0.0", + "js-green-licenses": "^4.0.0", "json5": "^2.2.0", "markdown-tables-to-json": "^0.1.7", "mocha": "^10.0.0", From 6cb2f7229c4aa7013ad650604dee532f382ab57e Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Wed, 18 Jan 2023 15:05:10 -0800 Subject: [PATCH 044/141] refactor: Don't use skew_ and translate_ attributes on SVGs to animate blocks. (#6782) * refactor: Remove unused translate_ and skew_ attributes from workspace_comment_svg.ts. * refactor: Stop setting skew_ and translate_ attributes on SVGs. * chore: Run format. * refactor: Return early if no wobbling block is present. --- core/block_animations.ts | 37 ++++++++++++++++------------------- core/block_svg.ts | 29 +++++++++++++++------------ core/workspace_comment_svg.ts | 17 ++++------------ 3 files changed, 37 insertions(+), 46 deletions(-) diff --git a/core/block_animations.ts b/core/block_animations.ts index 47ee63581..9b2d6d0bd 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -28,8 +28,8 @@ interface CloneRect { /** PID of disconnect UI animation. There can only be one at a time. */ let disconnectPid: ReturnType|null = null; -/** SVG group of wobbling block. There can only be one at a time. */ -let disconnectGroup: SVGElement|null = null; +/** The wobbling block. There can only be one at a time. */ +let wobblingBlock: BlockSvg|null = null; /** @@ -163,18 +163,18 @@ export function disconnectUiEffect(block: BlockSvg) { magnitude *= -1; } // Start the animation. - disconnectGroup = block.getSvgRoot(); - disconnectUiStep(disconnectGroup, magnitude, new Date()); + wobblingBlock = block; + disconnectUiStep(block, magnitude, new Date()); } /** * Animate a brief wiggle of a disconnected block. * - * @param group SVG element to animate. + * @param block Block to animate. * @param magnitude Maximum degrees skew (reversed for RTL). * @param start Date of animation's start. */ -function disconnectUiStep(group: SVGElement, magnitude: number, start: Date) { +function disconnectUiStep(block: BlockSvg, magnitude: number, start: Date) { const DURATION = 200; // Milliseconds. const WIGGLES = 3; // Half oscillations. @@ -186,13 +186,11 @@ function disconnectUiStep(group: SVGElement, magnitude: number, start: Date) { const val = Math.round( Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude); skew = `skewX(${val})`; - disconnectPid = setTimeout(disconnectUiStep, 10, group, magnitude, start); + disconnectPid = setTimeout(disconnectUiStep, 10, block, magnitude, start); } - (group as AnyDuringMigration).skew_ = skew; - group.setAttribute( - 'transform', - (group as AnyDuringMigration).translate_ + - (group as AnyDuringMigration).skew_); + + block.getSvgRoot().setAttribute( + 'transform', `${block.getTranslation()} ${skew}`); } /** @@ -202,13 +200,12 @@ function disconnectUiStep(group: SVGElement, magnitude: number, start: Date) { * @internal */ export function disconnectUiStop() { - if (disconnectGroup) { - if (disconnectPid) { - clearTimeout(disconnectPid); - } - const group = disconnectGroup; - (group as AnyDuringMigration).skew_ = ''; - group.setAttribute('transform', (group as AnyDuringMigration).translate_); - disconnectGroup = null; + if (!wobblingBlock) return; + if (disconnectPid) { + clearTimeout(disconnectPid); + disconnectPid = null; } + wobblingBlock.getSvgRoot().setAttribute( + 'transform', wobblingBlock.getTranslation()); + wobblingBlock = null; } diff --git a/core/block_svg.ts b/core/block_svg.ts index 02e2f0d0a..0bd43a843 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -144,6 +144,8 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, override previousConnection!: RenderedConnection; private readonly useDragSurface_: boolean; + private translation = ''; + /** * @param workspace The block's workspace. * @param prototypeName Name of the language object containing type-specific @@ -183,7 +185,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, /** An optional method for defining custom block context menu items. */ this.customContextMenu = this.customContextMenu; this.svgGroup_ = dom.createSvgElement(Svg.G, {}); - (this.svgGroup_ as AnyDuringMigration).translate_ = ''; /** A block style object. */ this.style = workspace.getRenderer().getConstants().getBlockStyle(null); @@ -435,8 +436,17 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, * @param y The y coordinate of the translation in workspace units. */ translate(x: number, y: number) { - this.getSvgRoot().setAttribute( - 'transform', 'translate(' + x + ',' + y + ')'); + this.translation = `translate(${x}, ${y})`; + this.getSvgRoot().setAttribute('transform', this.getTranslation()); + } + + /** + * Returns the SVG translation of this block. + * + * @internal + */ + getTranslation(): string { + return this.translation; } /** @@ -506,13 +516,8 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, this.workspace.getBlockDragSurface()!.translateSurface( newLoc.x, newLoc.y); } else { - (this.svgGroup_ as AnyDuringMigration).translate_ = - 'translate(' + newLoc.x + ',' + newLoc.y + ')'; - (this.svgGroup_ as AnyDuringMigration) - .setAttribute( - 'transform', - (this.svgGroup_ as AnyDuringMigration).translate_ + - (this.svgGroup_ as AnyDuringMigration).skew_); + this.translate(newLoc.x, newLoc.y); + this.getSvgRoot().setAttribute('transform', this.getTranslation()); } } @@ -775,9 +780,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, */ setDragging(adding: boolean) { if (adding) { - const group = this.getSvgRoot(); - (group as AnyDuringMigration).translate_ = ''; - (group as AnyDuringMigration).skew_ = ''; + this.translation = ''; common.draggingConnections.push(...this.getConnections_(true)); dom.addClass(this.svgGroup_, 'blocklyDragging'); } else { diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 9e5e96b0d..1c3e30d01 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -108,7 +108,6 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements opt_id?: string) { super(workspace, content, height, width, opt_id); this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': 'blocklyComment'}); - (this.svgGroup_ as AnyDuringMigration).translate_ = ''; this.workspace = workspace; this.svgRect_ = dom.createSvgElement(Svg.RECT, { @@ -408,13 +407,8 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements if (dragSurface) { dragSurface.translateSurface(newLoc.x, newLoc.y); } else { - (this.svgGroup_ as AnyDuringMigration).translate_ = - 'translate(' + newLoc.x + ',' + newLoc.y + ')'; - (this.svgGroup_ as AnyDuringMigration) - .setAttribute( - 'transform', - (this.svgGroup_ as AnyDuringMigration).translate_ + - (this.svgGroup_ as AnyDuringMigration).skew_); + const translation = `translate(${newLoc.x}, ${newLoc.y})`; + this.getSvgRoot().setAttribute('transform', translation); } } @@ -511,12 +505,9 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements */ setDragging(adding: boolean) { if (adding) { - const group = this.getSvgRoot(); - (group as AnyDuringMigration).translate_ = ''; - (group as AnyDuringMigration).skew_ = ''; - dom.addClass(this.svgGroup_, 'blocklyDragging'); + dom.addClass(this.getSvgRoot(), 'blocklyDragging'); } else { - dom.removeClass(this.svgGroup_, 'blocklyDragging'); + dom.removeClass(this.getSvgRoot(), 'blocklyDragging'); } } From b4ae803471800ac9aaeacf83639bad9144069e18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 18:17:42 -0800 Subject: [PATCH 045/141] chore(deps): bump @blockly/block-test from 3.0.2 to 3.0.3 (#6777) Bumps [@blockly/block-test](https://github.com/google/blockly-samples/tree/HEAD/plugins/block-test) from 3.0.2 to 3.0.3. - [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.3/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 e86d1327a..2b0249607 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,9 +165,9 @@ } }, "node_modules/@blockly/block-test": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.2.tgz", - "integrity": "sha512-YxlOKO3fNvQJZsnmqBjQwQLTezhoB9xzZkwg8Os92c3MhYHQhOyP8cX/W6IwRcY2X9blDJ/Ft2uJcUrOfEhT1g==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.3.tgz", + "integrity": "sha512-xFAy1sGLtGXwlNx5TgxKVmzI6l9Q0XJ7rZlyaC91ulZ7srrd3GOfFgbFaF+OwQ+oXfZCU/sGQSumrVksTaq6yw==", "dev": true, "engines": { "node": ">=8.17.0" @@ -13017,9 +13017,9 @@ } }, "@blockly/block-test": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.2.tgz", - "integrity": "sha512-YxlOKO3fNvQJZsnmqBjQwQLTezhoB9xzZkwg8Os92c3MhYHQhOyP8cX/W6IwRcY2X9blDJ/Ft2uJcUrOfEhT1g==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.3.tgz", + "integrity": "sha512-xFAy1sGLtGXwlNx5TgxKVmzI6l9Q0XJ7rZlyaC91ulZ7srrd3GOfFgbFaF+OwQ+oXfZCU/sGQSumrVksTaq6yw==", "dev": true, "requires": {} }, From 3eb7031f145493dd777a64f0b750928675418ff2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 20 Jan 2023 10:29:58 -0800 Subject: [PATCH 046/141] chore: reexport procedure related symbols (#6769) * chore: reexport triggerProcedureUpdate * chore: export interfaces * fix: incorrect module ID in IProcedureBlock --- blocks/procedures.js | 2 +- core/interfaces/i_procedure_block.ts | 2 +- core/procedures.ts | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index 31e652a3f..a2bf4606a 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -27,7 +27,7 @@ const {Block} = goog.requireType('Blockly.Block'); // TODO (6248): Properly import the BlockDefinition type. /* eslint-disable-next-line no-unused-vars */ const BlockDefinition = Object; -const {isProcedureBlock} = goog.require('Blockly.procedures.IProcedureModel'); +const {isProcedureBlock} = goog.require('Blockly.procedures.IProcedureBlock'); const {ObservableProcedureModel} = goog.require('Blockly.procedures.ObservableProcedureModel'); const {ObservableParameterModel} = goog.require('Blockly.procedures.ObservableParameterModel'); const {config} = goog.require('Blockly.config'); diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts index 59ca26b23..133441013 100644 --- a/core/interfaces/i_procedure_block.ts +++ b/core/interfaces/i_procedure_block.ts @@ -7,7 +7,7 @@ import type {Block} from '../block.js'; import {IProcedureModel} from './i_procedure_model.js'; import * as goog from '../../closure/goog/goog.js'; -goog.declareModuleId('Blockly.procedures.IProcedureModel'); +goog.declareModuleId('Blockly.procedures.IProcedureBlock'); /** The interface for a block which models a procedure. */ diff --git a/core/procedures.ts b/core/procedures.ts index 1ebe76b7e..3adcee5a6 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -23,12 +23,16 @@ 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 {Field, UnattachedFieldError} from './field.js'; -import {isProcedureBlock} from './interfaces/i_procedure_block.js'; import {Msg} from './msg.js'; import {Names} from './names.js'; +import {IParameterModel} from './interfaces/i_parameter_model.js'; +import {IProcedureMap} from './interfaces/i_procedure_map.js'; +import {IProcedureModel} from './interfaces/i_procedure_model.js'; +import {IProcedureBlock, isProcedureBlock} from './interfaces/i_procedure_block.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 {triggerProceduresUpdate} from './procedures/update_procedures.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; @@ -500,4 +504,10 @@ export { ObservableProcedureMap, ObservableProcedureModel, ObservableParameterModel, + triggerProceduresUpdate, + IParameterModel, + IProcedureBlock, + isProcedureBlock, + IProcedureMap, + IProcedureModel, }; From 5ee2c49da922ee52ca7f29a5dfc8b81cd6b94d90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 11:31:58 -0800 Subject: [PATCH 047/141] chore(deps): bump jsdom from 20.0.3 to 21.0.0 (#6742) Bumps [jsdom](https://github.com/jsdom/jsdom) from 20.0.3 to 21.0.0. - [Release notes](https://github.com/jsdom/jsdom/releases) - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md) - [Commits](https://github.com/jsdom/jsdom/compare/20.0.3...21.0.0) --- updated-dependencies: - dependency-name: jsdom dependency-type: direct:production 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 | 97 +++++++++++++++++++++++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 91 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b0249607..5746788c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "jsdom": "20.0.3" + "jsdom": "21.0.0" }, "devDependencies": { "@blockly/block-test": "^3.0.0", @@ -2718,6 +2718,52 @@ "jsdom": "20.0.3" } }, + "node_modules/blockly/node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "peer": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -7568,9 +7614,9 @@ } }, "node_modules/jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.0.0.tgz", + "integrity": "sha512-AIw+3ZakSUtDYvhwPwWHiZsUi3zHugpMEKlNPaurviseYoBqo0zBd3zqoUi3LPCNtPFlEP8FiW9MqCZdjb2IYA==", "dependencies": { "abab": "^2.0.6", "acorn": "^8.8.1", @@ -14930,6 +14976,43 @@ "peer": true, "requires": { "jsdom": "20.0.3" + }, + "dependencies": { + "jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "peer": true, + "requires": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + } + } } }, "brace-expansion": { @@ -18789,9 +18872,9 @@ "dev": true }, "jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.0.0.tgz", + "integrity": "sha512-AIw+3ZakSUtDYvhwPwWHiZsUi3zHugpMEKlNPaurviseYoBqo0zBd3zqoUi3LPCNtPFlEP8FiW9MqCZdjb2IYA==", "requires": { "abab": "^2.0.6", "acorn": "^8.8.1", diff --git a/package.json b/package.json index a130fcac8..6b149e511 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,6 @@ "yargs": "^17.2.1" }, "dependencies": { - "jsdom": "20.0.3" + "jsdom": "21.0.0" } } From 332c0fd2f2685f2f0690692f8a21c76693571568 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Fri, 20 Jan 2023 11:55:28 -0800 Subject: [PATCH 048/141] refactor: Remove block and workspace drag surfaces (#6758) * refactor: Remove BlockDragSurface. * refactor: Remove WorkspaceDragSurfaceSvg. * chore: Remove drag surface-related CSS. * chore: Removed unused variable in block_dragger.ts. * chore: Remove references to drag surfaces in comments. * refactor: Only track icons with visible bubbles for position updates during a drag. * fix: Remove rendundant condition. * fix: Remove arg inadvertently reintroduced in merge --- core/block_drag_surface.ts | 245 ----------------------------- core/block_dragger.ts | 15 +- core/block_svg.ts | 80 +--------- core/blockly.ts | 4 - core/bubble.ts | 14 +- core/bubble_dragger.ts | 21 +-- core/css.ts | 38 +---- core/inject.ts | 20 +-- core/interfaces/i_block_dragger.ts | 2 +- core/interfaces/i_bubble.ts | 9 +- core/scrollbar.ts | 7 - core/workspace_comment_svg.ts | 61 +------ core/workspace_drag_surface_svg.ts | 176 --------------------- core/workspace_dragger.ts | 5 - core/workspace_svg.ts | 123 +-------------- 15 files changed, 30 insertions(+), 790 deletions(-) delete mode 100644 core/block_drag_surface.ts delete mode 100644 core/workspace_drag_surface_svg.ts diff --git a/core/block_drag_surface.ts b/core/block_drag_surface.ts deleted file mode 100644 index 909aa76bf..000000000 --- a/core/block_drag_surface.ts +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * A class that manages a surface for dragging blocks. When a - * block drag is started, we move the block (and children) to a separate DOM - * element that we move around using translate3d. At the end of the drag, the - * blocks are put back in into the SVG they came from. This helps - * performance by avoiding repainting the entire SVG on every mouse move - * while dragging blocks. - * - * @class - */ -import * as goog from '../closure/goog/goog.js'; -goog.declareModuleId('Blockly.BlockDragSurfaceSvg'); - -import {Coordinate} from './utils/coordinate.js'; -import * as deprecation from './utils/deprecation.js'; -import * as dom from './utils/dom.js'; -import {Svg} from './utils/svg.js'; -import * as svgMath from './utils/svg_math.js'; - - -/** - * Class for a drag surface for the currently dragged block. This is a separate - * SVG that contains only the currently moving block, or nothing. - * - * @alias Blockly.BlockDragSurfaceSvg - */ -export class BlockDragSurfaceSvg { - /** - * 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; - - /** - * Cached value for the scale of the drag surface. - * Used to set/get the correct translation during and after a drag. - */ - 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 = 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) { - this.svg = dom.createSvgElement( - Svg.SVG, { - 'xmlns': dom.SVG_NS, - 'xmlns:html': dom.HTML_NS, - 'xmlns:xlink': dom.XLINK_NS, - 'version': '1.1', - 'class': 'blocklyBlockDragSurface', - }, - this.container); - - this.dragGroup = dom.createSvgElement(Svg.G, {}, this.svg); - } - - /** - * Create the drag surface and inject it into the container. - * - * @deprecated The DOM is automatically created by the constructor. - */ - createDom() { - // No alternative provided, because now the dom is just automatically - // created in the constructor now. - deprecation.warn('BlockDragSurfaceSvg createDom', 'June 2022', 'June 2023'); - } - - /** - * Set the SVG blocks on the drag surface's group and show the surface. - * Only one block group should be on the drag surface at a time. - * - * @param blocks Block or group of blocks to place on the drag surface. - */ - setBlocksAndShow(blocks: SVGElement) { - 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); - } - - /** - * Translate and scale the entire drag surface group to the given position, to - * keep in sync with the workspace. - * - * @param x X translation in pixel coordinates. - * @param y Y translation in pixel coordinates. - * @param scale Scale of the group. - */ - translateAndScaleGroup(x: number, y: number, scale: number) { - 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( - 'transform', - 'translate(' + roundX + ',' + roundY + ') scale(' + scale + ')'); - } - - /** - * Translate the drag surface's SVG based on its internal state. - * - * @internal - */ - translateSurfaceInternal_() { - // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - 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)'); - } - - /** - * Translates the entire surface by a relative offset. - * - * @param deltaX Horizontal offset in pixel units. - * @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); - this.translateSurfaceInternal_(); - } - - /** - * Translate the entire drag surface during a drag. - * We translate the drag surface instead of the blocks inside the surface - * so that the browser avoids repainting the SVG. - * Because of this, the drag coordinates must be adjusted by scale. - * - * @param x X translation for the entire surface. - * @param y Y translation for the entire surface. - */ - translateSurface(x: number, y: number) { - this.surfaceXY = new Coordinate(x * this.scale, y * this.scale); - this.translateSurfaceInternal_(); - } - - /** - * Reports the surface translation in scaled workspace coordinates. - * Use this when finishing a drag to return blocks to the correct position. - * - * @returns Current translation of the surface. - */ - getSurfaceTranslation(): Coordinate { - const xy = svgMath.getRelativeXY(this.svg); - return new Coordinate(xy.x / this.scale, xy.y / this.scale); - } - - /** - * Provide a reference to the drag group (primarily for - * BlockSvg.getRelativeToSurfaceXY). - * - * @returns Drag surface group element. - */ - getGroup(): SVGElement { - return this.dragGroup; - } - - /** - * Returns the SVG drag surface. - * - * @returns The SVG drag surface. - */ - getSvgRoot(): SVGElement { - return this.svg; - } - - /** - * Get the current blocks on the drag surface, if any (primarily - * for BlockSvg.getRelativeToSurfaceXY). - * - * @returns Drag surface block DOM element, or null if no blocks exist. - */ - getCurrentBlock(): Element|null { - return this.dragGroup.firstChild as Element; - } - - /** - * Gets the translation of the child block surface - * This surface is in charge of keeping track of how much the workspace has - * moved. - * - * @returns The amount the workspace has been moved. - */ - getWsTranslation(): Coordinate { - // Returning a copy so the coordinate can not be changed outside this class. - return this.childSurfaceXY.clone(); - } - - /** - * Clear the group and hide the surface; move the blocks off onto the provided - * element. - * If the block is being deleted it doesn't need to go back to the original - * surface, since it would be removed immediately during dispose. - * - * @param opt_newSurface Surface the dragging blocks should be moved to, or - * null if the blocks should be removed from this surface without being - * moved to a different surface. - */ - clearAndHide(opt_newSurface?: Element) { - const currentBlockElement = this.getCurrentBlock(); - if (currentBlockElement) { - if (opt_newSurface) { - // appendChild removes the node from this.dragGroup - opt_newSurface.appendChild(currentBlockElement); - } else { - this.dragGroup.removeChild(currentBlockElement); - } - } - this.svg.style.display = 'none'; - if (this.dragGroup.childNodes.length) { - throw Error('Drag group was not cleared.'); - } - this.surfaceXY = new Coordinate(0, 0); - } -} diff --git a/core/block_dragger.ts b/core/block_dragger.ts index c977f5c53..7673baf8b 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -94,7 +94,7 @@ export class BlockDragger implements IBlockDragger { } /** - * Start dragging a block. This includes moving it to the drag surface. + * Start dragging a block. * * @param currentDragDeltaXY How far the pointer has moved from the position * at mouse down, in pixel units. @@ -124,10 +124,6 @@ export class BlockDragger implements IBlockDragger { this.disconnectBlock_(healStack, currentDragDeltaXY); } this.draggingBlock_.setDragging(true); - // For future consideration: we may be able to put moveToDragSurface inside - // the block dragger, which would also let the block not track the block - // drag surface. - this.draggingBlock_.moveToDragSurface(); } /** @@ -221,16 +217,11 @@ export class BlockDragger implements IBlockDragger { const preventMove = !!this.dragTarget_ && this.dragTarget_.shouldPreventMove(this.draggingBlock_); - let newLoc: Coordinate; let delta: Coordinate|null = null; - if (preventMove) { - newLoc = this.startXY_; - } else { + if (!preventMove) { const newValues = this.getNewLocationAfterDrag_(currentDragDeltaXY); delta = newValues.delta; - newLoc = newValues.newLocation; } - this.draggingBlock_.moveOffDragSurface(newLoc); if (this.dragTarget_) { this.dragTarget_.onDrop(this.draggingBlock_); @@ -442,6 +433,8 @@ function initIconData(block: BlockSvg): IconPositionData[] { for (let i = 0, descendant; descendant = descendants[i]; i++) { const icons = descendant.getIcons(); for (let j = 0; j < icons.length; j++) { + // Only bother to track icons whose bubble is visible. + if (!icons[j].isVisible()) continue; const data = { // Coordinate with x and y properties (workspace // coordinates). diff --git a/core/block_svg.ts b/core/block_svg.ts index 0bd43a843..789a76177 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -142,7 +142,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, override nextConnection!: RenderedConnection; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. override previousConnection!: RenderedConnection; - private readonly useDragSurface_: boolean; private translation = ''; @@ -193,12 +192,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, this.pathObject = workspace.getRenderer().makePathObject(this.svgGroup_, this.style); - /** - * Whether to move the block to the drag surface when it is dragged. - * True if it should move, false if it should be translated directly. - */ - this.useDragSurface_ = !!workspace.getBlockDragSurface(); - const svgPath = this.pathObject.svgPath; (svgPath as AnyDuringMigration).tooltip = this; Tooltip.bindMouseEvents(svgPath); @@ -375,10 +368,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, let x = 0; let y = 0; - const dragSurfaceGroup = this.useDragSurface_ ? - this.workspace.getBlockDragSurface()!.getGroup() : - null; - let element: SVGElement = this.getSvgRoot(); if (element) { do { @@ -386,19 +375,8 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, const xy = svgMath.getRelativeXY(element); x += xy.x; y += xy.y; - // If this element is the current element on the drag surface, include - // the translation of the drag surface itself. - if (this.useDragSurface_ && - this.workspace.getBlockDragSurface()!.getCurrentBlock() === - element) { - const surfaceTranslation = - this.workspace.getBlockDragSurface()!.getSurfaceTranslation(); - x += surfaceTranslation.x; - y += surfaceTranslation.y; - } element = element.parentNode as SVGElement; - } while (element && element !== this.workspace.getCanvas() && - element !== dragSurfaceGroup); + } while (element && element !== this.workspace.getCanvas()); } return new Coordinate(x, y); } @@ -449,31 +427,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, return this.translation; } - /** - * Move this block to its workspace's drag surface, accounting for - * positioning. Generally should be called at the same time as - * setDragging_(true). Does nothing if useDragSurface_ is false. - * - * @internal - */ - moveToDragSurface() { - if (!this.useDragSurface_) { - return; - } - // The translation for drag surface blocks, - // is equal to the current relative-to-surface position, - // to keep the position in sync as it move on/off the surface. - // This is in workspace coordinates. - const xy = this.getRelativeToSurfaceXY(); - this.clearTransformAttributes_(); - this.workspace.getBlockDragSurface()!.translateSurface(xy.x, xy.y); - // Execute the move on the top-level SVG component - const svg = this.getSvgRoot(); - if (svg) { - this.workspace.getBlockDragSurface()!.setBlocksAndShow(svg); - } - } - /** * Move a block to a position. * @@ -485,40 +438,15 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, } /** - * Move this block back to the workspace block canvas. - * Generally should be called at the same time as setDragging_(false). - * Does nothing if useDragSurface_ is false. - * - * @param newXY The position the block should take on on the workspace canvas, - * in workspace coordinates. - * @internal - */ - moveOffDragSurface(newXY: Coordinate) { - if (!this.useDragSurface_) { - return; - } - // Translate to current position, turning off 3d. - this.translate(newXY.x, newXY.y); - this.workspace.getBlockDragSurface()!.clearAndHide( - this.workspace.getCanvas()); - } - - /** - * Move this block during a drag, taking into account whether we are using a - * drag surface to translate blocks. + * Move this block during a drag. * This block must be a top-level block. * * @param newLoc The location to translate to, in workspace coordinates. * @internal */ moveDuringDrag(newLoc: Coordinate) { - if (this.useDragSurface_) { - this.workspace.getBlockDragSurface()!.translateSurface( - newLoc.x, newLoc.y); - } else { - this.translate(newLoc.x, newLoc.y); - this.getSvgRoot().setAttribute('transform', this.getTranslation()); - } + this.translate(newLoc.x, newLoc.y); + this.getSvgRoot().setAttribute('transform', this.getTranslation()); } /** diff --git a/core/blockly.ts b/core/blockly.ts index 0537827a9..81064ede5 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -25,7 +25,6 @@ import './events/events_var_create.js'; import {Block} from './block.js'; import * as blockAnimations from './block_animations.js'; -import {BlockDragSurfaceSvg} from './block_drag_surface.js'; import {BlockDragger} from './block_dragger.js'; import {BlockSvg} from './block_svg.js'; import {BlocklyOptions} from './blockly_options.js'; @@ -160,7 +159,6 @@ import {Workspace} from './workspace.js'; import {WorkspaceAudio} from './workspace_audio.js'; import {WorkspaceComment} from './workspace_comment.js'; import {WorkspaceCommentSvg} from './workspace_comment_svg.js'; -import {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js'; import {WorkspaceDragger} from './workspace_dragger.js'; import {resizeSvgContents as realResizeSvgContents, WorkspaceSvg} from './workspace_svg.js'; import * as Xml from './xml.js'; @@ -626,7 +624,6 @@ export {BasicCursor}; export {Block}; export {BlocklyOptions}; export {BlockDragger}; -export {BlockDragSurfaceSvg}; export {BlockSvg}; export {Blocks}; export {Bubble}; @@ -729,7 +726,6 @@ export {Workspace}; export {WorkspaceAudio}; export {WorkspaceComment}; export {WorkspaceCommentSvg}; -export {WorkspaceDragSurfaceSvg}; export {WorkspaceDragger}; export {WorkspaceSvg}; export {ZoomControls}; diff --git a/core/bubble.ts b/core/bubble.ts index 054043c2e..7f8a1eb3b 100644 --- a/core/bubble.ts +++ b/core/bubble.ts @@ -12,7 +12,6 @@ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Bubble'); -import type {BlockDragSurfaceSvg} from './block_drag_surface.js'; import type {BlockSvg} from './block_svg.js'; import * as browserEvents from './browser_events.js'; import type {IBubble} from './interfaces/i_bubble.js'; @@ -785,20 +784,13 @@ export class Bubble implements IBubble { } /** - * Move this bubble during a drag, taking into account whether or not there is - * a drag surface. + * Move this bubble during a drag. * - * @param dragSurface The surface that carries rendered items during a drag, - * or null if no drag surface is in use. * @param newLoc The location to translate to, in workspace coordinates. * @internal */ - moveDuringDrag(dragSurface: BlockDragSurfaceSvg, newLoc: Coordinate) { - if (dragSurface) { - dragSurface.translateSurface(newLoc.x, newLoc.y); - } else { - this.moveTo(newLoc.x, newLoc.y); - } + moveDuringDrag(newLoc: Coordinate) { + this.moveTo(newLoc.x, newLoc.y); if (this.workspace_.RTL) { this.relativeLeft = this.anchorXY.x - newLoc.x - this.width; } else { diff --git a/core/bubble_dragger.ts b/core/bubble_dragger.ts index edd67655b..083faf734 100644 --- a/core/bubble_dragger.ts +++ b/core/bubble_dragger.ts @@ -12,7 +12,6 @@ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.BubbleDragger'); -import type {BlockDragSurfaceSvg} from './block_drag_surface.js'; import {ComponentManager} from './component_manager.js'; import type {CommentMove} from './events/events_comment_move.js'; import * as eventUtils from './events/utils.js'; @@ -38,7 +37,6 @@ export class BubbleDragger { /** Whether the bubble would be deleted if dropped immediately. */ private wouldDeleteBubble_ = false; private readonly startXY_: Coordinate; - private dragSurface_: BlockDragSurfaceSvg|null; /** * @param bubble The item on the bubble canvas to drag. @@ -50,16 +48,10 @@ export class BubbleDragger { * beginning of the drag, in workspace coordinates. */ this.startXY_ = this.bubble.getRelativeToSurfaceXY(); - - /** - * The drag surface to move bubbles to during a drag, or null if none should - * be used. Block dragging and bubble dragging use the same surface. - */ - this.dragSurface_ = workspace.getBlockDragSurface(); } /** - * Start dragging a bubble. This includes moving it to the drag surface. + * Start dragging a bubble. * * @internal */ @@ -70,12 +62,6 @@ export class BubbleDragger { this.workspace.setResizesEnabled(false); this.bubble.setAutoLayout(false); - if (this.dragSurface_) { - this.bubble.moveTo(0, 0); - this.dragSurface_.translateSurface(this.startXY_.x, this.startXY_.y); - // Execute the move on the top-level SVG component. - this.dragSurface_.setBlocksAndShow(this.bubble.getSvgRoot()); - } this.bubble.setDragging && this.bubble.setDragging(true); } @@ -92,7 +78,7 @@ export class BubbleDragger { dragBubble(e: PointerEvent, currentDragDeltaXY: Coordinate) { const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY); const newLoc = Coordinate.sum(this.startXY_, delta); - this.bubble.moveDuringDrag(this.dragSurface_, newLoc); + this.bubble.moveDuringDrag(newLoc); const oldDragTarget = this.dragTarget_; this.dragTarget_ = this.workspace.getDragTarget(e); @@ -172,9 +158,6 @@ export class BubbleDragger { this.bubble.dispose(); } else { // Put everything back onto the bubble canvas. - if (this.dragSurface_) { - this.dragSurface_.clearAndHide(this.workspace.getBubbleCanvas()); - } if (this.bubble.setDragging) { this.bubble.setDragging(false); } diff --git a/core/css.ts b/core/css.ts index 81b2e15a9..1582b783f 100644 --- a/core/css.ts +++ b/core/css.ts @@ -98,31 +98,6 @@ let content = ` -webkit-user-select: none; } -.blocklyWsDragSurface { - display: none; - position: absolute; - top: 0; - left: 0; -} - -/* Added as a separate rule with multiple classes to make it more specific - than a bootstrap rule that selects svg:root. See issue #1275 for context. -*/ -.blocklyWsDragSurface.blocklyOverflowVisible { - overflow: visible; -} - -.blocklyBlockDragSurface { - display: none; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - overflow: visible !important; - z-index: 50; /* Display below toolbox, but above everything else. */ -} - .blocklyBlockCanvas.blocklyCanvasTransitioning, .blocklyBubbleCanvas.blocklyCanvasTransitioning { transition: transform .5s; @@ -258,16 +233,6 @@ let content = ` cursor: -webkit-grabbing; } -/* Change the cursor on the whole drag surface in case the mouse gets - ahead of block during a drag. This way the cursor is still a closed hand. - */ -.blocklyBlockDragSurface .blocklyDraggable { - /* backup for browsers (e.g. IE11) that don't support grabbing */ - cursor: url("<<>>/handclosed.cur"), auto; - cursor: grabbing; - cursor: -webkit-grabbing; -} - .blocklyDragging.blocklyDraggingDelete { cursor: url("<<>>/handdelete.cur"), auto; } @@ -320,8 +285,7 @@ let content = ` Don't allow users to select text. It gets annoying when trying to drag a block and selected text moves instead. */ -.blocklySvg text, -.blocklyBlockDragSurface text { +.blocklySvg text { user-select: none; -ms-user-select: none; -webkit-user-select: none; diff --git a/core/inject.ts b/core/inject.ts index 71a359edb..d2f561865 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -12,7 +12,6 @@ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.inject'); -import {BlockDragSurfaceSvg} from './block_drag_surface.js'; import type {BlocklyOptions} from './blockly_options.js'; import * as browserEvents from './browser_events.js'; import * as bumpObjects from './bump_objects.js'; @@ -31,7 +30,6 @@ import * as dom from './utils/dom.js'; import {Svg} from './utils/svg.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; -import {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js'; import {WorkspaceSvg} from './workspace_svg.js'; @@ -69,14 +67,7 @@ export function inject( (container as AnyDuringMigration).appendChild(subContainer); const svg = createDom(subContainer, options); - // Create surfaces for dragging things. These are optimizations - // so that the browser does not repaint during the drag. - const blockDragSurface = new BlockDragSurfaceSvg(subContainer); - - const workspaceDragSurface = new WorkspaceDragSurfaceSvg(subContainer); - - const workspace = - createMainWorkspace(svg, options, blockDragSurface, workspaceDragSurface); + const workspace = createMainWorkspace(svg, options); init(workspace); @@ -154,16 +145,11 @@ function createDom(container: Element, options: Options): Element { * * @param svg SVG element with pattern defined. * @param options Dictionary of options. - * @param blockDragSurface Drag surface SVG for the blocks. - * @param workspaceDragSurface Drag surface SVG for the workspace. * @returns Newly created main workspace. */ -function createMainWorkspace( - svg: Element, options: Options, blockDragSurface: BlockDragSurfaceSvg, - workspaceDragSurface: WorkspaceDragSurfaceSvg): WorkspaceSvg { +function createMainWorkspace(svg: Element, options: Options): WorkspaceSvg { options.parentWorkspace = null; - const mainWorkspace = - new WorkspaceSvg(options, blockDragSurface, workspaceDragSurface); + const mainWorkspace = new WorkspaceSvg(options); const wsOptions = mainWorkspace.options; mainWorkspace.scale = wsOptions.zoomOptions.startScale; svg.appendChild(mainWorkspace.createDom('blocklyMainBackground')); diff --git a/core/interfaces/i_block_dragger.ts b/core/interfaces/i_block_dragger.ts index 8fa4b9dda..e977369ea 100644 --- a/core/interfaces/i_block_dragger.ts +++ b/core/interfaces/i_block_dragger.ts @@ -21,7 +21,7 @@ goog.declareModuleId('Blockly.IBlockDragger'); */ export interface IBlockDragger { /** - * Start dragging a block. This includes moving it to the drag surface. + * Start dragging a block. * * @param currentDragDeltaXY How far the pointer has moved from the position * at mouse down, in pixel units. diff --git a/core/interfaces/i_bubble.ts b/core/interfaces/i_bubble.ts index f424af334..af9450430 100644 --- a/core/interfaces/i_bubble.ts +++ b/core/interfaces/i_bubble.ts @@ -11,7 +11,6 @@ */ import * as goog from '../../closure/goog/goog.js'; import type {Coordinate} from '../utils/coordinate.js'; -import type {BlockDragSurfaceSvg} from '../block_drag_surface.js'; goog.declareModuleId('Blockly.IBubble'); import type {IContextMenu} from './i_contextmenu.js'; @@ -56,15 +55,11 @@ export interface IBubble extends IDraggable, IContextMenu { setDragging(dragging: boolean): void; /** - * Move this bubble during a drag, taking into account whether or not there is - * a drag surface. + * Move this bubble during a drag. * - * @param dragSurface The surface that carries rendered items during a drag, - * or null if no drag surface is in use. * @param newLoc The location to translate to, in workspace coordinates. */ - moveDuringDrag(dragSurface: BlockDragSurfaceSvg|null, newLoc: Coordinate): - void; + moveDuringDrag(newLoc: Coordinate): void; /** * Move the bubble to the specified location in workspace coordinates. diff --git a/core/scrollbar.ts b/core/scrollbar.ts index 652d5ae2d..1ddf4cf56 100644 --- a/core/scrollbar.ts +++ b/core/scrollbar.ts @@ -715,11 +715,6 @@ export class Scrollbar { // Look up the current translation and record it. this.startDragHandle = this.handlePosition; - // Tell the workspace to setup its drag surface since it is about to move. - // onMouseMoveHandle will call onScroll which actually tells the workspace - // to move. - this.workspace.setupDragSurface(); - // Record the current mouse position. this.startDragMouse = this.horizontal ? e.clientX : e.clientY; this.onMouseUpWrapper_ = browserEvents.conditionalBind( @@ -746,8 +741,6 @@ export class Scrollbar { /** Release the scrollbar handle and reset state accordingly. */ private onMouseUpHandle() { - // Tell the workspace to clean up now that the workspace is done moving. - this.workspace.resetDragSurface(); Touch.clearTouchIdentifier(); this.cleanUp(); } diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 1c3e30d01..329d37ceb 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -15,7 +15,6 @@ goog.declareModuleId('Blockly.WorkspaceCommentSvg'); // Unused import preserved for side-effects. Remove if unneeded. import './events/events_selected.js'; -import type {BlockDragSurfaceSvg} from './block_drag_surface.js'; import * as browserEvents from './browser_events.js'; import * as common from './common.js'; // import * as ContextMenu from './contextmenu.js'; @@ -93,7 +92,6 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements /** Whether the comment is rendered onscreen and is a part of the DOM. */ private rendered_ = false; - private readonly useDragSurface_: boolean; /** * @param workspace The block's workspace. @@ -119,12 +117,6 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements }); this.svgGroup_.appendChild(this.svgRect_); - /** - * Whether to move the comment to the drag surface when it is dragged. - * True if it should move, false if it should be translated directly. - */ - this.useDragSurface_ = !!workspace.getBlockDragSurface(); - this.render(); } @@ -308,10 +300,6 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements let x = 0; let y = 0; - const dragSurfaceGroup = this.useDragSurface_ ? - this.workspace.getBlockDragSurface()!.getGroup() : - null; - let element = this.getSvgRoot(); if (element) { do { @@ -319,21 +307,11 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements const xy = svgMath.getRelativeXY(element as Element); x += xy.x; y += xy.y; - // If this element is the current element on the drag surface, include - // the translation of the drag surface itself. - if (this.useDragSurface_ && - this.workspace.getBlockDragSurface()!.getCurrentBlock() === - element) { - const surfaceTranslation = - this.workspace.getBlockDragSurface()!.getSurfaceTranslation(); - x += surfaceTranslation.x; - y += surfaceTranslation.y; - } // AnyDuringMigration because: Type 'ParentNode | null' is not // assignable to type 'SVGElement'. element = element.parentNode as AnyDuringMigration; } while (element && element !== this.workspace.getBubbleCanvas() && - element !== dragSurfaceGroup); + element !== null); } this.xy_ = new Coordinate(x, y); return this.xy_; @@ -373,43 +351,14 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements } /** - * Move this comment to its workspace's drag surface, accounting for - * positioning. Generally should be called at the same time as - * setDragging(true). Does nothing if useDragSurface_ is false. + * Move this comment during a drag. * - * @internal - */ - moveToDragSurface() { - if (!this.useDragSurface_) { - return; - } - // The translation for drag surface blocks, - // is equal to the current relative-to-surface position, - // to keep the position in sync as it move on/off the surface. - // This is in workspace coordinates. - const xy = this.getRelativeToSurfaceXY(); - this.clearTransformAttributes_(); - this.workspace.getBlockDragSurface()!.translateSurface(xy.x, xy.y); - // Execute the move on the top-level SVG component - this.workspace.getBlockDragSurface()!.setBlocksAndShow(this.getSvgRoot()); - } - - /** - * Move this comment during a drag, taking into account whether we are using a - * drag surface to translate blocks. - * - * @param dragSurface The surface that carries rendered items during a drag, - * or null if no drag surface is in use. * @param newLoc The location to translate to, in workspace coordinates. * @internal */ - moveDuringDrag(dragSurface: BlockDragSurfaceSvg, newLoc: Coordinate) { - if (dragSurface) { - dragSurface.translateSurface(newLoc.x, newLoc.y); - } else { - const translation = `translate(${newLoc.x}, ${newLoc.y})`; - this.getSvgRoot().setAttribute('transform', translation); - } + moveDuringDrag(newLoc: Coordinate) { + const translation = `translate(${newLoc.x}, ${newLoc.y})`; + this.getSvgRoot().setAttribute('transform', translation); } /** diff --git a/core/workspace_drag_surface_svg.ts b/core/workspace_drag_surface_svg.ts deleted file mode 100644 index c20678609..000000000 --- a/core/workspace_drag_surface_svg.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * An SVG that floats on top of the workspace. - * Blocks are moved into this SVG during a drag, improving performance. - * The entire SVG is translated using CSS translation instead of SVG so the - * blocks are never repainted during drag improving performance. - * - * @class - */ -import * as goog from '../closure/goog/goog.js'; -goog.declareModuleId('Blockly.WorkspaceDragSurfaceSvg'); - -import type {Coordinate} from './utils/coordinate.js'; -import * as dom from './utils/dom.js'; -import {Svg} from './utils/svg.js'; -import * as svgMath from './utils/svg_math.js'; - - -/** - * Blocks are moved into this SVG during a drag, improving performance. - * The entire SVG is translated using CSS transforms instead of SVG so the - * blocks are never repainted during drag improving performance. - * - * @alias Blockly.WorkspaceDragSurfaceSvg - */ -export class WorkspaceDragSurfaceSvg { - /** - * The SVG drag surface. Set once by WorkspaceDragSurfaceSvg.createDom. - */ - private SVG!: SVGElement; - - /** - * The element to insert the block canvas and bubble canvas after when it - * goes back in the DOM at the end of a drag. - */ - private previousSibling: Element|null = null; - - /** @param container Containing element. */ - constructor(private readonly container: Element) { - this.createDom(); - } - - /** Create the drag surface and inject it into the container. */ - createDom() { - if (this.SVG) { - return; // Already created. - } - /** - * Dom structure when the workspace is being dragged. If there is no drag in - * progress, the SVG is empty and display: none. - * - * - * /g> - * - */ - this.SVG = dom.createSvgElement(Svg.SVG, { - 'xmlns': dom.SVG_NS, - 'xmlns:html': dom.HTML_NS, - 'xmlns:xlink': dom.XLINK_NS, - 'version': '1.1', - 'class': 'blocklyWsDragSurface blocklyOverflowVisible', - }); - this.container.appendChild(this.SVG); - } - - /** - * Translate the entire drag surface during a drag. - * We translate the drag surface instead of the blocks inside the surface - * so that the browser avoids repainting the SVG. - * Because of this, the drag coordinates must be adjusted by scale. - * - * @param x X translation for the entire surface - * @param y Y translation for the entire surface - * @internal - */ - translateSurface(x: number, y: number) { - // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - const fixedX = Math.round(x); - const fixedY = Math.round(y); - - this.SVG.style.display = 'block'; - dom.setCssTransform( - this.SVG, 'translate3d(' + fixedX + 'px, ' + fixedY + 'px, 0)'); - } - - /** - * Reports the surface translation in scaled workspace coordinates. - * Use this when finishing a drag to return blocks to the correct position. - * - * @returns Current translation of the surface - * @internal - */ - getSurfaceTranslation(): Coordinate { - return svgMath.getRelativeXY((this.SVG)); - } - - /** - * Move the blockCanvas and bubbleCanvas out of the surface SVG and on to - * newSurface. - * - * @param newSurface The element to put the drag surface contents into. - * @internal - */ - clearAndHide(newSurface: SVGElement) { - if (!newSurface) { - throw Error( - 'Couldn\'t clear and hide the drag surface: missing new surface.'); - } - const blockCanvas = this.SVG.childNodes[0] as Element; - const bubbleCanvas = this.SVG.childNodes[1] as Element; - if (!blockCanvas || !bubbleCanvas || - !(blockCanvas.classList.contains('blocklyBlockCanvas') || - !bubbleCanvas.classList.contains('blocklyBubbleCanvas'))) { - throw Error( - 'Couldn\'t clear and hide the drag surface. A node was missing.'); - } - - // If there is a previous sibling, put the blockCanvas back right - // afterwards, otherwise insert it as the first child node in newSurface. - if (this.previousSibling !== null) { - dom.insertAfter(blockCanvas, this.previousSibling); - } else { - newSurface.insertBefore(blockCanvas, newSurface.firstChild); - } - - // Reattach the bubble canvas after the blockCanvas. - dom.insertAfter(bubbleCanvas, blockCanvas); - // Hide the drag surface. - this.SVG.style.display = 'none'; - if (this.SVG.childNodes.length) { - throw Error('Drag surface was not cleared.'); - } - dom.setCssTransform(this.SVG, ''); - this.previousSibling = null; - } - - /** - * Set the SVG to have the block canvas and bubble canvas in it and then - * show the surface. - * - * @param blockCanvas The block canvas element from the - * workspace. - * @param bubbleCanvas The element that contains the - bubbles. - * @param previousSibling The element to insert the block canvas and - bubble canvas after when it goes back in the DOM at the end of a - drag. - * @param width The width of the workspace SVG element. - * @param height The height of the workspace SVG element. - * @param scale The scale of the workspace being dragged. - * @internal - */ - setContentsAndShow( - blockCanvas: SVGElement, bubbleCanvas: SVGElement, - previousSibling: Element, width: number, height: number, scale: number) { - if (this.SVG.childNodes.length) { - throw Error('Already dragging a block.'); - } - this.previousSibling = previousSibling; - // Make sure the blocks and bubble canvas are scaled appropriately. - blockCanvas.setAttribute( - 'transform', 'translate(0, 0) scale(' + scale + ')'); - bubbleCanvas.setAttribute( - 'transform', 'translate(0, 0) scale(' + scale + ')'); - this.SVG.setAttribute('width', String(width)); - this.SVG.setAttribute('height', String(height)); - this.SVG.appendChild(blockCanvas); - this.SVG.appendChild(bubbleCanvas); - this.SVG.style.display = 'block'; - } -} diff --git a/core/workspace_dragger.ts b/core/workspace_dragger.ts index 686807e39..939c73ab6 100644 --- a/core/workspace_dragger.ts +++ b/core/workspace_dragger.ts @@ -20,9 +20,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a workspace dragger. It moves the workspace around when it is * being dragged by a mouse or touch. - * Note that the workspace itself manages whether or not it has a drag surface - * and how to do translations based on that. This simply passes the right - * commands based on events. * * @alias Blockly.WorkspaceDragger */ @@ -67,7 +64,6 @@ export class WorkspaceDragger { if (common.getSelected()) { common.getSelected()!.unselect(); } - this.workspace.setupDragSurface(); } /** @@ -80,7 +76,6 @@ export class WorkspaceDragger { endDrag(currentDragDeltaXY: Coordinate) { // Make sure everything is up to date. this.drag(currentDragDeltaXY); - this.workspace.resetDragSurface(); } /** diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 06c43d682..f0cd6c43d 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -20,7 +20,6 @@ import './events/events_theme_change.js'; import './events/events_viewport.js'; import type {Block} from './block.js'; -import type {BlockDragSurfaceSvg} from './block_drag_surface.js'; import type {BlockSvg} from './block_svg.js'; import type {BlocklyOptions} from './blockly_options.js'; import * as browserEvents from './browser_events.js'; @@ -75,7 +74,6 @@ import {Workspace} from './workspace.js'; import {WorkspaceAudio} from './workspace_audio.js'; import {WorkspaceComment} from './workspace_comment.js'; import {WorkspaceCommentSvg} from './workspace_comment_svg.js'; -import type {WorkspaceDragSurfaceSvg} from './workspace_drag_surface_svg.js'; import * as Xml from './xml.js'; import {ZoomControls} from './zoom_controls.js'; import {ContextMenuOption} from './contextmenu_registry.js'; @@ -225,26 +223,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ currentGesture_: Gesture|null = null; - /** This workspace's surface for dragging blocks, if it exists. */ - private readonly blockDragSurface: BlockDragSurfaceSvg|null = null; - - /** This workspace's drag surface, if it exists. */ - 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; - - /** - * Whether the drag surface is actively in use. When true, calls to - * translate will translate the drag surface instead of the translating the - * workspace directly. - * This is set to true in setupDragSurface and to false in resetDragSurface. - */ - private isDragSurfaceActive = false; - /** * The first parent div with 'injectionDiv' in the name, or null if not set. * Access this with getInjectionDiv. @@ -338,12 +316,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** * @param options Dictionary of options. - * @param opt_blockDragSurface Drag surface for blocks. - * @param opt_wsDragSurface Drag surface for the workspace. */ - constructor( - options: Options, opt_blockDragSurface?: BlockDragSurfaceSvg, - opt_wsDragSurface?: WorkspaceDragSurfaceSvg) { + constructor(options: Options) { super(options); const MetricsManagerClass = registry.getClassFromOptions( @@ -363,16 +337,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.connectionDBList = ConnectionDB.init(this.connectionChecker); - if (opt_blockDragSurface) { - this.blockDragSurface = opt_blockDragSurface; - } - - if (opt_wsDragSurface) { - this.workspaceDragSurface = opt_wsDragSurface; - } - - this.useWorkspaceDragSurface = !!this.workspaceDragSurface; - /** * Object in charge of loading, storing, and playing audio for a workspace. */ @@ -1152,18 +1116,10 @@ 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); - } else { - const translation = 'translate(' + x + ',' + y + ') ' + - 'scale(' + this.scale + ')'; - this.svgBlockCanvas_.setAttribute('transform', translation); - 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); - } + const translation = 'translate(' + x + ',' + y + ') ' + + 'scale(' + this.scale + ')'; + this.svgBlockCanvas_.setAttribute('transform', translation); + this.svgBubbleCanvas_.setAttribute('transform', translation); // And update the grid if we're using one. if (this.grid) { this.grid.moveTo(x, y); @@ -1172,75 +1128,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.maybeFireViewportChangeEvent(); } - /** - * Called at the end of a workspace drag to take the contents - * out of the drag surface and put them back into the workspace SVG. - * Does nothing if the workspace drag surface is not enabled. - * - * @internal - */ - resetDragSurface() { - // Don't do anything if we aren't using a drag surface. - if (!this.useWorkspaceDragSurface) { - return; - } - - this.isDragSurfaceActive = false; - - 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); - this.svgBubbleCanvas_.setAttribute('transform', translation); - } - - /** - * Called at the beginning of a workspace drag to move contents of - * the workspace to the drag surface. - * Does nothing if the drag surface is not enabled. - * - * @internal - */ - setupDragSurface() { - // Don't do anything if we aren't using a drag surface. - if (!this.useWorkspaceDragSurface) { - return; - } - - // This can happen if the user starts a drag, mouses up outside of the - // document where the mouseup listener is registered (e.g. outside of an - // 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) { - return; - } - - this.isDragSurfaceActive = true; - - // Figure out where we want to put the canvas back. The order - // in the is important because things are layered. - const previousElement = this.svgBlockCanvas_.previousSibling as Element; - 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.getCanvas(), this.getBubbleCanvas(), previousElement, width, - height, this.scale); - this.workspaceDragSurface!.translateSurface(coord.x, coord.y); - } - - /** - * Gets the drag surface blocks are moved to when a drag is started. - * - * @returns This workspace's block drag surface, if one is in use. - * @internal - */ - getBlockDragSurface(): BlockDragSurfaceSvg|null { - return this.blockDragSurface; - } - /** * Returns the horizontal offset of the workspace. * Intended for LTR/RTL compatibility in XML. From 4dc4d887f1dbf7b7402fe54a80e04dda17472c6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:39:35 -0800 Subject: [PATCH 049/141] chore(deps): bump jsdom from 21.0.0 to 21.1.0 (#6788) Bumps [jsdom](https://github.com/jsdom/jsdom) from 21.0.0 to 21.1.0. - [Release notes](https://github.com/jsdom/jsdom/releases) - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md) - [Commits](https://github.com/jsdom/jsdom/compare/21.0.0...21.1.0) --- updated-dependencies: - dependency-name: jsdom 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> --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5746788c1..bb0bbb1bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "jsdom": "21.0.0" + "jsdom": "21.1.0" }, "devDependencies": { "@blockly/block-test": "^3.0.0", @@ -7614,9 +7614,9 @@ } }, "node_modules/jsdom": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.0.0.tgz", - "integrity": "sha512-AIw+3ZakSUtDYvhwPwWHiZsUi3zHugpMEKlNPaurviseYoBqo0zBd3zqoUi3LPCNtPFlEP8FiW9MqCZdjb2IYA==", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", + "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", "dependencies": { "abab": "^2.0.6", "acorn": "^8.8.1", @@ -18872,9 +18872,9 @@ "dev": true }, "jsdom": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.0.0.tgz", - "integrity": "sha512-AIw+3ZakSUtDYvhwPwWHiZsUi3zHugpMEKlNPaurviseYoBqo0zBd3zqoUi3LPCNtPFlEP8FiW9MqCZdjb2IYA==", + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", + "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", "requires": { "abab": "^2.0.6", "acorn": "^8.8.1", diff --git a/package.json b/package.json index 6b149e511..dc89e5a83 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,6 @@ "yargs": "^17.2.1" }, "dependencies": { - "jsdom": "21.0.0" + "jsdom": "21.1.0" } } From 85282c02e63a789b0adad6c67720e149be997030 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:40:13 -0800 Subject: [PATCH 050/141] chore(deps): bump json5 from 2.2.2 to 2.2.3 (#6740) Bumps [json5](https://github.com/json5/json5) from 2.2.2 to 2.2.3. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v2.2.2...v2.2.3) --- updated-dependencies: - dependency-name: json5 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 bb0bbb1bc..79af98fda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7682,9 +7682,9 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", - "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "bin": { "json5": "lib/cli.js" @@ -18929,9 +18929,9 @@ "dev": true }, "json5": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", - "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, "jsonfile": { From bd23d223e6dfb3b113c01796b4730c5eea011c37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 10:32:11 -0800 Subject: [PATCH 051/141] chore(deps): bump rimraf from 4.0.7 to 4.1.1 (#6787) Bumps [rimraf](https://github.com/isaacs/rimraf) from 4.0.7 to 4.1.1. - [Release notes](https://github.com/isaacs/rimraf/releases) - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/rimraf/compare/v4.0.7...v4.1.1) --- updated-dependencies: - dependency-name: rimraf 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 79af98fda..123bc26f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10566,9 +10566,9 @@ "dev": true }, "node_modules/rimraf": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.0.7.tgz", - "integrity": "sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.1.tgz", + "integrity": "sha512-Z4Y81w8atcvaJuJuBB88VpADRH66okZAuEm+Jtaufa+s7rZmIz+Hik2G53kGaNytE7lsfXyWktTmfVz0H9xuDg==", "dev": true, "bin": { "rimraf": "dist/cjs/src/bin.js" @@ -21239,9 +21239,9 @@ "dev": true }, "rimraf": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.0.7.tgz", - "integrity": "sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.1.tgz", + "integrity": "sha512-Z4Y81w8atcvaJuJuBB88VpADRH66okZAuEm+Jtaufa+s7rZmIz+Hik2G53kGaNytE7lsfXyWktTmfVz0H9xuDg==", "dev": true }, "run-parallel": { From e4d7c381bc394de168486a9f809babcde3c67244 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 26 Jan 2023 09:21:54 -0800 Subject: [PATCH 052/141] chore: revert changes to procedure blocks (#6794) * chore: revert procedure blocks * chore: fix tests --- blocks/procedures.js | 1768 ++++++++++--------------- tests/mocha/blocks/procedures_test.js | 866 +----------- 2 files changed, 735 insertions(+), 1899 deletions(-) diff --git a/blocks/procedures.js b/blocks/procedures.js index a2bf4606a..c7a5d7fc3 100644 --- a/blocks/procedures.js +++ b/blocks/procedures.js @@ -16,9 +16,9 @@ goog.module('Blockly.libraryBlocks.procedures'); const AbstractEvent = goog.requireType('Blockly.Events.Abstract'); const ContextMenu = goog.require('Blockly.ContextMenu'); const Events = goog.require('Blockly.Events'); -const Extensions = goog.require('Blockly.Extensions'); const Procedures = goog.require('Blockly.Procedures'); const Variables = goog.require('Blockly.Variables'); +const Xml = goog.require('Blockly.Xml'); const xmlUtils = goog.require('Blockly.utils.xml'); const {Align} = goog.require('Blockly.Input'); /* eslint-disable-next-line no-unused-vars */ @@ -27,22 +27,19 @@ const {Block} = goog.requireType('Blockly.Block'); // TODO (6248): Properly import the BlockDefinition type. /* eslint-disable-next-line no-unused-vars */ const BlockDefinition = Object; -const {isProcedureBlock} = goog.require('Blockly.procedures.IProcedureBlock'); -const {ObservableProcedureModel} = goog.require('Blockly.procedures.ObservableProcedureModel'); -const {ObservableParameterModel} = goog.require('Blockly.procedures.ObservableParameterModel'); const {config} = goog.require('Blockly.config'); /* eslint-disable-next-line no-unused-vars */ +const {FieldCheckbox} = goog.require('Blockly.FieldCheckbox'); const {FieldLabel} = goog.require('Blockly.FieldLabel'); +const {FieldTextInput} = goog.require('Blockly.FieldTextInput'); const {Msg} = goog.require('Blockly.Msg'); const {Mutator} = goog.require('Blockly.Mutator'); const {Names} = goog.require('Blockly.Names'); -const serialization = goog.require('Blockly.serialization'); -const {triggerProceduresUpdate} = goog.require('Blockly.procedures.updateProcedures'); /* eslint-disable-next-line no-unused-vars */ const {VariableModel} = goog.requireType('Blockly.VariableModel'); /* eslint-disable-next-line no-unused-vars */ const {Workspace} = goog.requireType('Blockly.Workspace'); -const {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common'); +const {defineBlocks} = goog.require('Blockly.common'); /** @suppress {extraRequire} */ goog.require('Blockly.Comment'); /** @suppress {extraRequire} */ @@ -53,389 +50,14 @@ goog.require('Blockly.Warning'); * A dictionary of the block definitions provided by this module. * @type {!Object} */ -const blocks = createBlockDefinitionsFromJsonArray([ - { - 'type': 'procedures_defnoreturn', - 'message0': '%{BKY_PROCEDURES_DEFNORETURN_TITLE} %1 %2 %3', - 'message1': '%{BKY_PROCEDURES_DEFNORETURN_DO} %1', - 'args0': [ - { - 'type': 'field_input', - 'name': 'NAME', - 'text': '', - 'spellcheck': false, - }, - { - 'type': 'field_label', - 'name': 'PARAMS', - 'text': '', - }, - { - 'type': 'input_dummy', - 'name': 'TOP', - }, - ], - 'args1': [ - { - 'type': 'input_statement', - 'name': 'STACK', - }, - ], - 'style': 'procedure_blocks', - 'helpUrl': '%{BKY_PROCEDURES_DEFNORETURN_HELPURL}', - 'tooltip': '%{BKY_PROCEDURES_DEFNORETURN_TOOLTIP}', - 'extensions': [ - 'procedure_def_get_def_mixin', - 'procedure_def_var_mixin', - 'procedure_def_update_shape_mixin', - 'procedure_def_context_menu_mixin', - 'procedure_def_onchange_mixin', - 'procedure_def_validator_helper', - 'procedure_defnoreturn_get_caller_block_mixin', - 'procedure_defnoreturn_set_comment_helper', - 'procedure_def_set_no_return_helper', - ], - 'mutator': 'procedure_def_mutator', - }, - { - 'type': 'procedures_callnoreturn', - 'message0': '%1 %2', - 'args0': [ - {'type': 'field_label', 'name': 'NAME', 'text': '%{BKY_UNNAMED_KEY}'}, - { - 'type': 'input_dummy', - 'name': 'TOPROW', - }, - ], - 'nextStatement': null, - 'previousStatement': null, - 'style': 'procedure_blocks', - 'helpUrl': '%{BKY_PROCEDURES_CALLNORETURN_HELPURL}', - 'extensions': [ - 'procedure_caller_get_def_mixin', - 'procedure_caller_update_shape_mixin', - 'procedure_caller_context_menu_mixin', - 'procedure_caller_onchange_mixin', - 'procedure_callernoreturn_get_def_block_mixin', - ], - 'mutator': 'procedure_caller_mutator', - }, - { - 'type': 'procedures_defreturn', - 'message0': '%{BKY_PROCEDURES_DEFRETURN_TITLE} %1 %2 %3', - 'message1': '%{BKY_PROCEDURES_DEFRETURN_DO} %1', - 'message2': '%{BKY_PROCEDURES_DEFRETURN_RETURN} %1', - 'args0': [ - { - 'type': 'field_input', - 'name': 'NAME', - 'text': '', - 'spellcheck': false, - }, - { - 'type': 'field_label', - 'name': 'PARAMS', - 'text': '', - }, - { - 'type': 'input_dummy', - 'name': 'TOP', - }, - ], - 'args1': [ - { - 'type': 'input_statement', - 'name': 'STACK', - }, - ], - 'args2': [ - { - 'type': 'input_value', - 'align': 'right', - 'name': 'RETURN', - }, - ], - 'style': 'procedure_blocks', - 'helpUrl': '%{BKY_PROCEDURES_DEFRETURN_HELPURL}', - 'tooltip': '%{BKY_PROCEDURES_DEFRETURN_TOOLTIP}', - 'extensions': [ - 'procedure_def_get_def_mixin', - 'procedure_def_var_mixin', - 'procedure_def_update_shape_mixin', - 'procedure_def_context_menu_mixin', - 'procedure_def_onchange_mixin', - 'procedure_def_validator_helper', - 'procedure_defreturn_get_caller_block_mixin', - 'procedure_defreturn_set_comment_helper', - 'procedure_def_set_return_helper', - ], - 'mutator': 'procedure_def_mutator', - }, - { - 'type': 'procedures_callreturn', - 'message0': '%1 %2', - 'args0': [ - {'type': 'field_label', 'name': 'NAME', 'text': '%{BKY_UNNAMED_KEY}'}, - { - 'type': 'input_dummy', - 'name': 'TOPROW', - }, - ], - 'output': null, - 'style': 'procedure_blocks', - 'helpUrl': '%{BKY_PROCEDURES_CALLRETURN_HELPURL}', - 'extensions': [ - 'procedure_caller_get_def_mixin', - 'procedure_caller_update_shape_mixin', - 'procedure_caller_context_menu_mixin', - 'procedure_caller_onchange_mixin', - 'procedure_callerreturn_get_def_block_mixin', - ], - 'mutator': 'procedure_caller_mutator', - }, - { - 'type': 'procedures_mutatorcontainer', - 'message0': '%{BKY_PROCEDURES_MUTATORCONTAINER_TITLE} %1 %2', - 'message1': '%{BKY_PROCEDURES_ALLOW_STATEMENTS} %1 %2', - 'args0': [ - { - 'type': 'input_dummy', - }, - { - 'type': 'input_statement', - 'name': 'STACK', - }, - ], - 'args1': [ - { - 'type': 'field_checkbox', - 'checked': true, - 'name': 'STATEMENTS', - }, - { - 'type': 'input_dummy', - 'name': 'STATEMENT_INPUT', - }, - ], - 'style': 'procedure_blocks', - 'tooltip': '%{BKY_PROCEDURES_MUTATORCONTAINER_TOOLTIP}', - 'enableContextMenu': false, - }, - { - 'type': 'procedures_mutatorarg', - 'message0': '%{BKY_PROCEDURES_MUTATORARG_TITLE} %1', - 'args0': [ - { - 'type': 'field_input', - 'name': 'NAME', - }, - ], - 'nextStatement': null, - 'previousStatement': null, - 'style': 'procedure_blocks', - 'tooltip': '%{BKY_PROCEDURES_MUTATORARG_TOOLTIP}', - 'enableContextMenu': false, - 'extensions': [ - 'procedure_mutatorarg_validate_mixin', - 'procedure_mutatorarg_add_validator_helper', - ], - }, - { - 'type': 'procedures_ifreturn', - 'message0': '%{BKY_CONTROLS_IF_MSG_IF} %1', - 'message1': '%{BKY_PROCEDURES_DEFRETURN_RETURN} %1', - 'args0': [ - { - 'type': 'input_value', - 'name': 'CONDITION', - 'check': 'Boolean', - }, - ], - 'args1': [ - { - 'type': 'input_value', - 'name': 'VALUE', - }, - ], - 'inputsInline': true, - 'nextStatement': null, - 'previousStatement': null, - 'style': 'procedure_blocks', - 'tooltip': '%{BKY_PROCEDURES_IFRETURN_TOOLTIP}', - 'helpUrl': '%{BKY_PROCEDURES_IFRETURN_HELPURL}', - 'extensions': [ - 'procedure_ifreturn_onchange_mixin', - 'procedure_ifreturn_function_types_mixin', - ], - 'mutator': 'procedure_ifreturn_mutator', - }, -]); +const blocks = {}; exports.blocks = blocks; - -/** @this {Block} */ -const procedureDefGetDefMixin = function() { - const mixin = { - model_: null, - - /** - * Returns the data model for this procedure block. - * @return {!IProcedureModel} The data model for this procedure - * block. - */ - getProcedureModel() { - return this.model_; - }, - - /** - * True if this is a procedure definition block, false otherwise (i.e. - * it is a caller). - * @return {boolean} True because this is a procedure definition block. - */ - isProcedureDef() { - return true; - }, - - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable names. - * @this {Block} - */ - getVars: function() { - return this.getProcedureModel().getParameters().map( - (p) => p.getVariableModel().name); - }, - - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable models. - * @this {Block} - */ - getVarModels: function() { - return this.getProcedureModel().getParameters().map( - (p) => p.getVariableModel()); - }, - - /** - * Disposes of the data model for this procedure block when the block is - * disposed. - */ - destroy: function() { - if (this.isInsertionMarker()) return; - this.workspace.getProcedureMap().delete(this.getProcedureModel().getId()); - }, - }; - - mixin.model_ = new ObservableProcedureModel( - this.workspace, - Procedures.findLegalName(this.getFieldValue('NAME'), this)); - this.workspace.getProcedureMap().add(mixin.getProcedureModel()); - - this.mixin(mixin, true); -}; -// Using register instead of registerMixin to avoid triggering warnings about -// overriding built-ins. -Extensions.register('procedure_def_get_def_mixin', procedureDefGetDefMixin); - -/** @this {Block} */ -const procedureDefVarMixin = function() { - const mixin = { - /** - * Notification that a variable is renaming. - * If the ID matches one of this block's variables, rename it. - * @param {string} oldId ID of variable to rename. - * @param {string} newId ID of new variable. May be the same as oldId, but - * with an updated name. Guaranteed to be the same type as the old - * variable. - * @override - * @this {Block} - */ - renameVarById: function(oldId, newId) { - const oldVar = this.workspace.getVariableById(oldId); - const model = this.getProcedureModel(); - const index = model.getParameters().findIndex( - (p) => p.getVariableModel() === oldVar); - if (index === -1) return; // Not found. - const newVar = this.workspace.getVariableById(newId); - const oldParam = model.getParameter(index); - model.deleteParameter(index); - model.insertParameter( - new ObservableParameterModel( - this.workspace, newVar.name, oldParam.getId()), - index); - }, - - /** - * Notification that a variable is renaming but keeping the same ID. If the - * variable is in use on this block, rerender to show the new name. - * @param {!VariableModel} variable The variable being renamed. - * @package - * @override - * @this {Block} - */ - updateVarName: function(variable) { - const containsVar = this.getProcedureModel().getParameters().some( - (p) => p.getVariableModel() === variable); - if (containsVar) { - triggerProceduresUpdate(this.workspace); - } - }, - }; - - this.mixin(mixin, true); -}; -// Using register instead of registerMixin to avoid triggering warnings about -// overriding built-ins. -Extensions.register('procedure_def_var_mixin', procedureDefVarMixin); - -const procedureDefUpdateShapeMixin = { - /** - * Updates the block to reflect the state of the procedure model. - */ - doProcedureUpdate: function() { - this.setFieldValue(this.getProcedureModel().getName(), 'NAME'); - this.setEnabled(this.getProcedureModel().getEnabled()); - this.updateParameters_(); - this.updateMutator_(); - }, - - /** - * Updates the parameters field to reflect the parameters in the procedure - * model. - */ - updateParameters_: function() { - const params = - this.getProcedureModel().getParameters().map((p) => p.getName()); - const paramString = params.length ? - `${Msg['PROCEDURES_BEFORE_PARAMS']} ${params.join(', ')}` : - ''; - - // The field is deterministic based on other events, no need to fire. - Events.disable(); - try { - this.setFieldValue(paramString, 'PARAMS'); - } finally { - Events.enable(); - } - }, - - /** - * Updates the parameter blocks in the mutator (if it is open) to reflect - * the state of the procedure model. - */ - updateMutator_: function() { - if (!this.mutator?.isVisible()) return; - - const mutatorWorkspace = this.mutator.getWorkspace(); - for (const p of this.getProcedureModel().getParameters()) { - const block = mutatorWorkspace.getBlockById(p.getId()); - if (!block) continue; // Should not happen. - if (block.getFieldValue('NAME') !== p.getName()) { - block.setFieldValue(p.getName(), 'NAME'); - } - } - }, - +/** + * Common properties for the procedure_defnoreturn and + * procedure_defreturn blocks. + */ +const PROCEDURE_DEF_COMMON = { /** * Add or remove the statement block from this function definition. * @param {boolean} hasStatements True if a statement block is needed. @@ -451,38 +73,32 @@ const procedureDefUpdateShapeMixin = { if (this.getInput('RETURN')) { this.moveInputBefore('STACK', 'RETURN'); } - // Restore the stack, if one was saved. - Mutator.reconnect(this.statementConnection_, this, 'STACK'); - this.statementConnection_ = null; } else { - // Save the stack, then disconnect it. - const stackConnection = this.getInput('STACK').connection; - this.statementConnection_ = stackConnection.targetConnection; - if (this.statementConnection_) { - const stackBlock = stackConnection.targetBlock(); - stackBlock.unplug(); - stackBlock.bumpNeighbours(); - } this.removeInput('STACK', true); } this.hasStatements_ = hasStatements; }, -}; -Extensions.registerMixin( - 'procedure_def_update_shape_mixin', procedureDefUpdateShapeMixin); - -/** @this {Block} */ -const procedureDefValidatorHelper = function() { - const nameField = this.getField('NAME'); - nameField.setValue(Procedures.findLegalName('', this)); - nameField.setValidator(Procedures.rename); -}; -Extensions.register( - 'procedure_def_validator_helper', procedureDefValidatorHelper); - -const procedureDefMutator = { - hasStatements_: true, - + /** + * Update the display of parameters for this procedure definition block. + * @private + * @this {Block} + */ + updateParams_: function() { + // Merge the arguments into a human-readable list. + let paramString = ''; + if (this.arguments_.length) { + paramString = + Msg['PROCEDURES_BEFORE_PARAMS'] + ' ' + this.arguments_.join(', '); + } + // The params field is deterministic based on the mutation, + // no need to fire a change event. + Events.disable(); + try { + this.setFieldValue(paramString, 'PARAMS'); + } finally { + Events.enable(); + } + }, /** * Create XML to represent the argument inputs. * Backwards compatible serialization implementation. @@ -496,15 +112,13 @@ const procedureDefMutator = { if (opt_paramIds) { container.setAttribute('name', this.getFieldValue('NAME')); } - - const params = this.getProcedureModel().getParameters(); - for (let i = 0; i < params.length; i++) { + for (let i = 0; i < this.argumentVarModels_.length; i++) { const parameter = xmlUtils.createElement('arg'); - const varModel = params[i].getVariableModel(); - parameter.setAttribute('name', varModel.name); - parameter.setAttribute('varid', varModel.getId()); - if (opt_paramIds) { - parameter.setAttribute('paramId', params[i].getId()); + const argModel = this.argumentVarModels_[i]; + parameter.setAttribute('name', argModel.name); + parameter.setAttribute('varid', argModel.getId()); + if (opt_paramIds && this.paramIds_) { + parameter.setAttribute('paramId', this.paramIds_[i]); } container.appendChild(parameter); } @@ -515,7 +129,6 @@ const procedureDefMutator = { } return container; }, - /** * Parse XML to restore the argument inputs. * Backwards compatible serialization implementation. @@ -523,21 +136,30 @@ const procedureDefMutator = { * @this {Block} */ domToMutation: function(xmlElement) { - for (let i = 0; i < xmlElement.childNodes.length; i++) { - const node = xmlElement.childNodes[i]; - if (node.nodeName.toLowerCase() !== 'arg') continue; - const varId = node.getAttribute('varid'); - this.getProcedureModel().insertParameter( - new ObservableParameterModel( - this.workspace, node.getAttribute('name'), undefined, varId), - i); + this.arguments_ = []; + this.argumentVarModels_ = []; + for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { + if (childNode.nodeName.toLowerCase() === 'arg') { + const varName = childNode.getAttribute('name'); + const varId = + childNode.getAttribute('varid') || childNode.getAttribute('varId'); + this.arguments_.push(varName); + const variable = Variables.getOrCreateVariablePackage( + this.workspace, varId, varName, ''); + if (variable !== null) { + this.argumentVarModels_.push(variable); + } else { + console.log( + `Failed to create a variable named "${varName}", ignoring.`); + } + } } - this.setStatements_(xmlElement.getAttribute('statements') !== 'false'); - - // Call mutate callers for backwards compatibility. + this.updateParams_(); Procedures.mutateCallers(this); - }, + // Show or hide the statement input. + this.setStatements_(xmlElement.getAttribute('statements') !== 'false'); + }, /** * Returns the state of this block as a JSON serializable object. * @return {?{params: (!Array<{name: string, id: string}>|undefined), @@ -545,77 +167,47 @@ const procedureDefMutator = { * parameters and statements. */ saveExtraState: function() { + if (!this.argumentVarModels_.length && this.hasStatements_) { + return null; + } const state = Object.create(null); - state['procedureId'] = this.getProcedureModel().getId(); - - const params = this.getProcedureModel().getParameters(); - if (!params.length && this.hasStatements_) return state; - - if (params.length) { - state['params'] = params.map((p) => { - return { - 'name': p.getName(), - 'id': p.getVariableModel().getId(), - // Ideally this would be id, and the other would be varId, - // but backwards compatibility :/ - 'paramId': p.getId(), - }; - }); + if (this.argumentVarModels_.length) { + state['params'] = []; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + state['params'].push({ + // We don't need to serialize the name, but just in case we decide + // to separate params from variables. + 'name': this.argumentVarModels_[i].name, + 'id': this.argumentVarModels_[i].getId(), + }); + } } if (!this.hasStatements_) { state['hasStatements'] = false; } return state; }, - /** * Applies the given state to this block. * @param {*} state The state to apply to this block, eg the parameters and * statements. */ loadExtraState: function(state) { - const map = this.workspace.getProcedureMap(); - const procedureId = state['procedureId']; - if (procedureId && procedureId != this.model_.getId() && - map.has(procedureId) && - (this.isInsertionMarker() || - this.noBlockHasClaimedModel_(procedureId))) { - if (map.has(this.model_.getId())) { - map.delete(this.model_.getId()); - } - this.model_ = map.get(procedureId); - } - + this.arguments_ = []; + this.argumentVarModels_ = []; if (state['params']) { for (let i = 0; i < state['params'].length; i++) { - const {name, id, paramId} = state['params'][i]; - this.getProcedureModel().insertParameter( - new ObservableParameterModel(this.workspace, name, paramId, id), i); + const param = state['params'][i]; + const variable = Variables.getOrCreateVariablePackage( + this.workspace, param['id'], param['name'], ''); + this.arguments_.push(variable.name); + this.argumentVarModels_.push(variable); } } - - this.doProcedureUpdate(); - this.setStatements_(state['hasStatements'] === false ? false : true); - - // Call mutate callers for backwards compatibility. + this.updateParams_(); Procedures.mutateCallers(this); + this.setStatements_(state['hasStatements'] === false ? false : true); }, - - /** - * Returns true if there is no definition block currently associated with the - * given procedure ID. False otherwise. - * @param {string} procedureId The ID of the procedure to check for a claiming - * block. - * @return {boolean} True if there is no definition block currently associated - * with the given procedure ID. False otherwise. - */ - noBlockHasClaimedModel_(procedureId) { - const model = this.workspace.getProcedureMap().get(procedureId); - return this.workspace.getAllBlocks(false).every( - (b) => !isProcedureBlock(b) || !b.isProcedureDef() || - b.getProcedureModel() !== model); - }, - /** * Populate the mutator's dialog with this block's components. * @param {!Workspace} workspace Mutator's workspace. @@ -623,28 +215,41 @@ const procedureDefMutator = { * @this {Block} */ decompose: function(workspace) { - const containerBlockDef = { - 'type': 'procedures_mutatorcontainer', - 'inputs': { - 'STACK': {}, - }, - }; + /* + * Creates the following XML: + * + * + * + * arg1_name + * etc... + * + * + * + */ - let connDef = containerBlockDef['inputs']['STACK']; - for (const param of this.getProcedureModel().getParameters()) { - connDef['block'] = { - 'type': 'procedures_mutatorarg', - 'id': param.getId(), - 'fields': { - 'NAME': param.getName(), - }, - 'next': {}, - }; - connDef = connDef['block']['next']; + const containerBlockNode = xmlUtils.createElement('block'); + containerBlockNode.setAttribute('type', 'procedures_mutatorcontainer'); + const statementNode = xmlUtils.createElement('statement'); + statementNode.setAttribute('name', 'STACK'); + containerBlockNode.appendChild(statementNode); + + let node = statementNode; + for (let i = 0; i < this.arguments_.length; i++) { + const argBlockNode = xmlUtils.createElement('block'); + argBlockNode.setAttribute('type', 'procedures_mutatorarg'); + const fieldNode = xmlUtils.createElement('field'); + fieldNode.setAttribute('name', 'NAME'); + const argumentName = xmlUtils.createTextNode(this.arguments_[i]); + fieldNode.appendChild(argumentName); + argBlockNode.appendChild(fieldNode); + const nextNode = xmlUtils.createElement('next'); + argBlockNode.appendChild(nextNode); + + node.appendChild(argBlockNode); + node = nextNode; } - const containerBlock = serialization.blocks.append( - containerBlockDef, workspace, {recordUndo: false}); + const containerBlock = Xml.domToBlock(containerBlockNode, workspace); if (this.type === 'procedures_defreturn') { containerBlock.setFieldValue(this.hasStatements_, 'STATEMENTS'); @@ -652,52 +257,150 @@ const procedureDefMutator = { containerBlock.removeInput('STATEMENT_INPUT'); } - // Update callers (called for backwards compatibility). + // Initialize procedure's callers with blank IDs. Procedures.mutateCallers(this); - return containerBlock; }, - /** * Reconfigure this block based on the mutator dialog's components. * @param {!Block} containerBlock Root block in mutator. * @this {Block} */ compose: function(containerBlock) { - const model = this.getProcedureModel(); - const count = model.getParameters().length; - model.startBulkUpdate(); - for (let i = count - 1; i >= 0; i--) { - model.deleteParameter(i); - } - - let i = 0; + // Parameter list. + this.arguments_ = []; + this.paramIds_ = []; + this.argumentVarModels_ = []; let paramBlock = containerBlock.getInputTargetBlock('STACK'); while (paramBlock && !paramBlock.isInsertionMarker()) { - model.insertParameter( - new ObservableParameterModel( - this.workspace, paramBlock.getFieldValue('NAME'), paramBlock.id), - i); + const varName = paramBlock.getFieldValue('NAME'); + this.arguments_.push(varName); + const variable = this.workspace.getVariable(varName, ''); + this.argumentVarModels_.push(variable); + + this.paramIds_.push(paramBlock.id); paramBlock = paramBlock.nextConnection && paramBlock.nextConnection.targetBlock(); - i++; } - model.endBulkUpdate(); - - const hasStatements = containerBlock.getFieldValue('STATEMENTS'); - if (hasStatements !== null) { - this.setStatements_(hasStatements === 'TRUE'); - } - - // Call mutate callers for backwards compatibility. + this.updateParams_(); Procedures.mutateCallers(this); - }, -}; -Extensions.registerMutator( - 'procedure_def_mutator', procedureDefMutator, undefined, - ['procedures_mutatorarg']); -const procedureDefContextMenuMixin = { + // Show/hide the statement input. + let hasStatements = containerBlock.getFieldValue('STATEMENTS'); + if (hasStatements !== null) { + hasStatements = hasStatements === 'TRUE'; + if (this.hasStatements_ !== hasStatements) { + if (hasStatements) { + this.setStatements_(true); + // Restore the stack, if one was saved. + Mutator.reconnect(this.statementConnection_, this, 'STACK'); + this.statementConnection_ = null; + } else { + // Save the stack, then disconnect it. + const stackConnection = this.getInput('STACK').connection; + this.statementConnection_ = stackConnection.targetConnection; + if (this.statementConnection_) { + const stackBlock = stackConnection.targetBlock(); + stackBlock.unplug(); + stackBlock.bumpNeighbours(); + } + this.setStatements_(false); + } + } + } + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Block} + */ + getVars: function() { + return this.arguments_; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Block} + */ + getVarModels: function() { + return this.argumentVarModels_; + }, + /** + * Notification that a variable is renaming. + * If the ID matches one of this block's variables, rename it. + * @param {string} oldId ID of variable to rename. + * @param {string} newId ID of new variable. May be the same as oldId, but + * with an updated name. Guaranteed to be the same type as the old + * variable. + * @override + * @this {Block} + */ + renameVarById: function(oldId, newId) { + const oldVariable = this.workspace.getVariableById(oldId); + if (oldVariable.type !== '') { + // Procedure arguments always have the empty type. + return; + } + const oldName = oldVariable.name; + const newVar = this.workspace.getVariableById(newId); + + let change = false; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() === oldId) { + this.arguments_[i] = newVar.name; + this.argumentVarModels_[i] = newVar; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newVar.name); + Procedures.mutateCallers(this); + } + }, + /** + * Notification that a variable is renaming but keeping the same ID. If the + * variable is in use on this block, rerender to show the new name. + * @param {!VariableModel} variable The variable being renamed. + * @package + * @override + * @this {Block} + */ + updateVarName: function(variable) { + const newName = variable.name; + let change = false; + let oldName; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() === variable.getId()) { + oldName = this.arguments_[i]; + this.arguments_[i] = newName; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newName); + Procedures.mutateCallers(this); + } + }, + /** + * Update the display to reflect a newly renamed argument. + * @param {string} oldName The old display name of the argument. + * @param {string} newName The new display name of the argument. + * @private + * @this {Block} + */ + displayRenamedVar_: function(oldName, newName) { + this.updateParams_(); + // Update the mutator's variables if the mutator is open. + if (this.mutator && this.mutator.isVisible()) { + const blocks = this.mutator.workspace_.getAllBlocks(false); + for (let i = 0, block; (block = blocks[i]); i++) { + if (block.type === 'procedures_mutatorarg' && + Names.equals(oldName, block.getFieldValue('NAME'))) { + block.setFieldValue(newName, 'NAME'); + } + } + } + }, /** * Add custom menu options to this block's context menu. * @param {!Array} options List of menu options to add to. @@ -713,10 +416,9 @@ const procedureDefContextMenuMixin = { option.text = Msg['PROCEDURES_CREATE_DO'].replace('%1', name); const xmlMutation = xmlUtils.createElement('mutation'); xmlMutation.setAttribute('name', name); - const params = this.getProcedureModel().getParameters(); - for (const param of params) { + for (let i = 0; i < this.arguments_.length; i++) { const xmlArg = xmlUtils.createElement('arg'); - xmlArg.setAttribute('name', param.getName()); + xmlArg.setAttribute('name', this.arguments_[i]); xmlMutation.appendChild(xmlArg); } const xmlBlock = xmlUtils.createElement('block'); @@ -726,64 +428,53 @@ const procedureDefContextMenuMixin = { options.push(option); // Add options to create getters for each parameter. - if (this.isCollapsed()) return; + if (!this.isCollapsed()) { + for (let i = 0; i < this.argumentVarModels_.length; i++) { + const argOption = {enabled: true}; + const argVar = this.argumentVarModels_[i]; + argOption.text = + Msg['VARIABLES_SET_CREATE_GET'].replace('%1', argVar.name); - for (const param of params) { - const argOption = {enabled: true}; - const argVar = param.getVariableModel(); - argOption.text = - Msg['VARIABLES_SET_CREATE_GET'].replace('%1', argVar.name); - - const argXmlField = Variables.generateVariableFieldDom(argVar); - const argXmlBlock = xmlUtils.createElement('block'); - argXmlBlock.setAttribute('type', 'variables_get'); - argXmlBlock.appendChild(argXmlField); - argOption.callback = ContextMenu.callbackFactory(this, argXmlBlock); - options.push(argOption); + const argXmlField = Variables.generateVariableFieldDom(argVar); + const argXmlBlock = xmlUtils.createElement('block'); + argXmlBlock.setAttribute('type', 'variables_get'); + argXmlBlock.appendChild(argXmlField); + argOption.callback = ContextMenu.callbackFactory(this, argXmlBlock); + options.push(argOption); + } } }, }; -Extensions.registerMixin( - 'procedure_def_context_menu_mixin', procedureDefContextMenuMixin); -const procedureDefOnChangeMixin = { - onchange: function(e) { - if (e.type === Events.BLOCK_CHANGE && e.blockId === this.id && - e.element === 'disabled') { - this.getProcedureModel().setEnabled(!e.newValue); +blocks['procedures_defnoreturn'] = { + ...PROCEDURE_DEF_COMMON, + /** + * Block for defining a procedure with no return value. + * @this {Block} + */ + init: function() { + const initName = Procedures.findLegalName('', this); + const nameField = new FieldTextInput(initName, Procedures.rename); + nameField.setSpellcheck(false); + this.appendDummyInput() + .appendField(Msg['PROCEDURES_DEFNORETURN_TITLE']) + .appendField(nameField, 'NAME') + .appendField('', 'PARAMS'); + this.setMutator(new Mutator(['procedures_mutatorarg'], this)); + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Msg['PROCEDURES_DEFNORETURN_COMMENT']) { + this.setCommentText(Msg['PROCEDURES_DEFNORETURN_COMMENT']); } + this.setStyle('procedure_blocks'); + this.setTooltip(Msg['PROCEDURES_DEFNORETURN_TOOLTIP']); + this.setHelpUrl(Msg['PROCEDURES_DEFNORETURN_HELPURL']); + this.arguments_ = []; + this.argumentVarModels_ = []; + this.setStatements_(true); + this.statementConnection_ = null; }, -}; -Extensions.registerMixin( - 'procedure_def_onchange_mixin', procedureDefOnChangeMixin); - -/** @this {Block} */ -const procedureDefNoReturnSetCommentHelper = function() { - if ((this.workspace.options.comments || - (this.workspace.options.parentWorkspace && - this.workspace.options.parentWorkspace.options.comments)) && - Msg['PROCEDURES_DEFNORETURN_COMMENT']) { - this.setCommentText(Msg['PROCEDURES_DEFNORETURN_COMMENT']); - } -}; -Extensions.register( - 'procedure_defnoreturn_set_comment_helper', - procedureDefNoReturnSetCommentHelper); - -/** @this {Block} */ -const procedureDefReturnSetCommentHelper = function() { - if ((this.workspace.options.comments || - (this.workspace.options.parentWorkspace && - this.workspace.options.parentWorkspace.options.comments)) && - Msg['PROCEDURES_DEFRETURN_COMMENT']) { - this.setCommentText(Msg['PROCEDURES_DEFRETURN_COMMENT']); - } -}; -Extensions.register( - 'procedure_defreturn_set_comment_helper', - procedureDefReturnSetCommentHelper); - -const procedureDefNoReturnGetCallerBlockMixin = { /** * Return the signature of this procedure definition. * @return {!Array} Tuple containing three elements: @@ -793,16 +484,43 @@ const procedureDefNoReturnGetCallerBlockMixin = { * @this {Block} */ getProcedureDef: function() { - return [this.getFieldValue('NAME'), this.getVars(), false]; + return [this.getFieldValue('NAME'), this.arguments_, false]; }, - callType_: 'procedures_callnoreturn', }; -Extensions.registerMixin( - 'procedure_defnoreturn_get_caller_block_mixin', - procedureDefNoReturnGetCallerBlockMixin); -const procedureDefReturnGetCallerBlockMixin = { +blocks['procedures_defreturn'] = { + ...PROCEDURE_DEF_COMMON, + /** + * Block for defining a procedure with a return value. + * @this {Block} + */ + init: function() { + const initName = Procedures.findLegalName('', this); + const nameField = new FieldTextInput(initName, Procedures.rename); + nameField.setSpellcheck(false); + this.appendDummyInput() + .appendField(Msg['PROCEDURES_DEFRETURN_TITLE']) + .appendField(nameField, 'NAME') + .appendField('', 'PARAMS'); + this.appendValueInput('RETURN') + .setAlign(Align.RIGHT) + .appendField(Msg['PROCEDURES_DEFRETURN_RETURN']); + this.setMutator(new Mutator(['procedures_mutatorarg'], this)); + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Msg['PROCEDURES_DEFRETURN_COMMENT']) { + this.setCommentText(Msg['PROCEDURES_DEFRETURN_COMMENT']); + } + this.setStyle('procedure_blocks'); + this.setTooltip(Msg['PROCEDURES_DEFRETURN_TOOLTIP']); + this.setHelpUrl(Msg['PROCEDURES_DEFRETURN_HELPURL']); + this.arguments_ = []; + this.argumentVarModels_ = []; + this.setStatements_(true); + this.statementConnection_ = null; + }, /** * Return the signature of this procedure definition. * @return {!Array} Tuple containing three elements: @@ -812,30 +530,66 @@ const procedureDefReturnGetCallerBlockMixin = { * @this {Block} */ getProcedureDef: function() { - return [this.getFieldValue('NAME'), this.getVars(), true]; + return [this.getFieldValue('NAME'), this.arguments_, true]; }, - callType_: 'procedures_callreturn', }; -Extensions.registerMixin( - 'procedure_defreturn_get_caller_block_mixin', - procedureDefReturnGetCallerBlockMixin); -/** @this {Block} */ -const procedureDefSetNoReturnHelper = function() { - this.getProcedureModel().setReturnTypes(null); +blocks['procedures_mutatorcontainer'] = { + /** + * Mutator block for procedure container. + * @this {Block} + */ + init: function() { + this.appendDummyInput().appendField( + Msg['PROCEDURES_MUTATORCONTAINER_TITLE']); + this.appendStatementInput('STACK'); + this.appendDummyInput('STATEMENT_INPUT') + .appendField(Msg['PROCEDURES_ALLOW_STATEMENTS']) + .appendField(new FieldCheckbox('TRUE'), 'STATEMENTS'); + this.setStyle('procedure_blocks'); + this.setTooltip(Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']); + this.contextMenu = false; + }, }; -Extensions.register( - 'procedure_def_set_no_return_helper', procedureDefSetNoReturnHelper); -/** @this {Block} */ -const procedureDefSetReturnHelper = function() { - this.getProcedureModel().setReturnTypes([]); -}; -Extensions.register( - 'procedure_def_set_return_helper', procedureDefSetReturnHelper); +blocks['procedures_mutatorarg'] = { + /** + * Mutator block for procedure argument. + * @this {Block} + */ + init: function() { + const field = new FieldTextInput(Procedures.DEFAULT_ARG, this.validator_); + // Hack: override showEditor to do just a little bit more work. + // We don't have a good place to hook into the start of a text edit. + field.oldShowEditorFn_ = field.showEditor_; + /** + * @this {FieldTextInput} + */ + const newShowEditorFn = function() { + this.createdVariables_ = []; + this.oldShowEditorFn_(); + }; + field.showEditor_ = newShowEditorFn; + + this.appendDummyInput() + .appendField(Msg['PROCEDURES_MUTATORARG_TITLE']) + .appendField(field, 'NAME'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setStyle('procedure_blocks'); + this.setTooltip(Msg['PROCEDURES_MUTATORARG_TOOLTIP']); + this.contextMenu = false; + + // Create the default variable when we drag the block in from the flyout. + // Have to do this after installing the field on the block. + field.onFinishEditing_ = this.deleteIntermediateVars_; + // Create an empty list so onFinishEditing_ has something to look at, even + // though the editor was never opened. + field.createdVariables_ = []; + field.onFinishEditing_('x'); + }, -const validateProcedureParamMixin = { /** * Obtain a valid name for the procedure argument. Create a variable if * necessary. @@ -887,7 +641,6 @@ const validateProcedureParamMixin = { this.createdVariables_.push(model); } } - return varName; }, @@ -895,8 +648,9 @@ const validateProcedureParamMixin = { * Called when focusing away from the text field. * Deletes all variables that were created as the user typed their intended * variable name. - * @this {FieldTextInput} * @param {string} newText The new variable name. + * @private + * @this {FieldTextInput} */ deleteIntermediateVars_: function(newText) { const outerWs = Mutator.findParentWs(this.getSourceBlock().workspace); @@ -911,346 +665,21 @@ const validateProcedureParamMixin = { } }, }; -Extensions.registerMixin( - 'procedure_mutatorarg_validate_mixin', validateProcedureParamMixin); - -/** @this {Block} */ -const addValidatorToParamFieldHelper = function() { - const nameField = this.getField('NAME'); - - nameField.setValidator(this.validator_); - - // TODO: We can probably just handle this in onFinishedEditing_. - // Hack: override showEditor to do just a little bit more work. - // We don't have a good place to hook into the start of a text edit. - nameField.oldShowEditorFn_ = nameField.showEditor_; - /** @this {FieldTextInput} */ - const newShowEditorFn = function() { - this.createdVariables_ = []; - this.oldShowEditorFn_(); - }; - nameField.showEditor_ = newShowEditorFn; - - nameField.onFinishEditing_ = this.deleteIntermediateVars_; - // Create an empty list so onFinishEditing_ has something to look at, even - // though the editor was never opened. - nameField.createdVariables_ = []; - nameField.onFinishEditing_('x'); -}; -Extensions.register( - 'procedure_mutatorarg_add_validator_helper', - addValidatorToParamFieldHelper); - -/** @this {Block} */ -const procedureCallerGetDefMixin = function() { - const mixin = { - model_: null, - - prevParams_: [], - - argsMap_: new Map(), - - /** - * @return {IProcedureModel} The procedure model associated with this - * block. - */ - getProcedureModel() { - return this.model_; - }, - - /** - * @param {string} name The name of the procedure model to find. - * @param {Array} params The param names of the procedure model - * to find. - * @return {IProcedureModel} The procedure model that was found. - */ - findProcedureModel_(name, params = []) { - const workspace = this.getTargetWorkspace_(); - const model = workspace.getProcedureMap().getProcedures().find( - (proc) => proc.getName() === name); - if (!model) return null; - - const returnTypes = model.getReturnTypes(); - const hasMatchingReturn = this.hasReturn_ ? returnTypes : !returnTypes; - if (!hasMatchingReturn) return null; - - const hasMatchingParams = - model.getParameters().every((p, i) => p.getName() === params[i]); - if (!hasMatchingParams) return null; - - return model; - }, - - /** - * @return {Workspace} The main workspace (i.e. not the flyout workspace) - * associated with this block. - */ - getTargetWorkspace_() { - return this.workspace.isFlyout ? this.workspace.targetWorkspace : - this.workspace; - }, - - /** - * Returns the name of the procedure this block calls. - * @return {string} Procedure name. - * @this {Block} - */ - getProcedureCall: function() { - // The NAME field is guaranteed to exist, null will never be returned. - return /** @type {string} */ (this.getFieldValue('NAME')); - }, - - /** - * True if this is a procedure definition block, false otherwise (i.e. - * it is a caller). - * @return {boolean} False because this is not a procedure definition block. - */ - isProcedureDef() { - return false; - }, - - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable names. - * @this {Block} - */ - getVars: function() { - return this.getProcedureModel().getParameters().map( - (p) => p.getVariableModel().name); - }, - - /** - * Return all variables referenced by this block. - * @return {!Array} List of variable models. - * @this {Block} - */ - getVarModels: function() { - return this.getProcedureModel().getParameters().map( - (p) => p.getVariableModel()); - }, - }; - - this.mixin(mixin, true); -}; -// Using register instead of registerMixin to avoid triggering warnings about -// overriding built-ins. -Extensions.register( - 'procedure_caller_get_def_mixin', procedureCallerGetDefMixin); - -const procedureCallerMutator = { - previousEnabledState_: true, - - paramsFromSerializedState_: [], +/** + * Common properties for the procedure_callnoreturn and + * procedure_callreturn blocks. + */ +const PROCEDURE_CALL_COMMON = { /** - * Create XML to represent the (non-editable) name and arguments. - * Backwards compatible serialization implementation. - * @return {!Element} XML storage element. + * Returns the name of the procedure this block calls. + * @return {string} Procedure name. * @this {Block} */ - mutationToDom: function() { - const container = xmlUtils.createElement('mutation'); - const model = this.getProcedureModel(); - if (!model) return container; - - container.setAttribute('name', model.getName()); - for (const param of model.getParameters()) { - const arg = xmlUtils.createElement('arg'); - arg.setAttribute('name', param.getName()); - container.appendChild(arg); - } - return container; + getProcedureCall: function() { + // The NAME field is guaranteed to exist, null will never be returned. + return /** @type {string} */ (this.getFieldValue('NAME')); }, - - /** - * Parse XML to restore the (non-editable) name and parameters. - * Backwards compatible serialization implementation. - * @param {!Element} xmlElement XML storage element. - * @this {Block} - */ - domToMutation: function(xmlElement) { - const name = xmlElement.getAttribute('name'); - const params = []; - for (const n of xmlElement.childNodes) { - if (n.nodeName.toLowerCase() === 'arg') { - params.push(n.getAttribute('name')); - } - } - this.deserialize_(name, params); - }, - - /** - * Returns the state of this block as a JSON serializable object. - * @return {{name: string, params:(!Array|undefined)}} The state of - * this block, ie the params and procedure name. - */ - saveExtraState: function() { - const state = Object.create(null); - const model = this.getProcedureModel(); - if (!model) return state; - state['name'] = model.getName(); - if (model.getParameters().length) { - state['params'] = model.getParameters().map((p) => p.getName()); - } - return state; - }, - - /** - * Applies the given state to this block. - * @param {*} state The state to apply to this block, ie the params and - * procedure name. - */ - loadExtraState: function(state) { - this.deserialize_(state['name'], state['params'] || []); - }, - - /** - * Applies the given name and params from the serialized state to the block. - * @param {string} name The name to apply to the block. - * @param {!Array} params The parameters to apply to the block. - */ - deserialize_: function(name, params) { - this.setFieldValue(name, 'NAME'); - if (!this.model_) this.model_ = this.findProcedureModel_(name, params); - if (this.getProcedureModel()) { - this.initBlockWithProcedureModel_(); - } else { - // Create inputs based on the mutation so that children can be connected. - this.createArgInputs_(params); - } - this.paramsFromSerializedState_ = params; - }, -}; -Extensions.registerMutator('procedure_caller_mutator', procedureCallerMutator); - -const procedureCallerUpdateShapeMixin = { - /** - * Renders the block for the first time based on the procedure model. - */ - initBlockWithProcedureModel_() { - this.prevParams_ = [...this.getProcedureModel().getParameters()]; - this.doProcedureUpdate(); - }, - - /** - * Updates the shape of this block to reflect the state of the data model. - */ - doProcedureUpdate: function() { - if (!this.getProcedureModel()) return; - const id = this.getProcedureModel().getId(); - if (!this.getTargetWorkspace_().getProcedureMap().has(id)) { - this.dispose(); - return; - } - this.updateName_(); - this.updateEnabled_(); - this.updateParameters_(); - }, - - /** - * Updates the name field of this block to match the state of the data model. - */ - updateName_: function() { - const name = this.getProcedureModel().getName(); - this.setFieldValue(name, 'NAME'); - const baseMsg = this.outputConnection ? - Msg['PROCEDURES_CALLRETURN_TOOLTIP'] : - Msg['PROCEDURES_CALLNORETURN_TOOLTIP']; - this.setTooltip(baseMsg.replace('%1', name)); - }, - - /** - * Updates the enabled state of this block to match the state of the data - * model. - */ - updateEnabled_: function() { - if (!this.getProcedureModel().getEnabled()) { - this.previousEnabledState_ = this.isEnabled(); - this.setEnabled(false); - } else { - this.setEnabled(this.previousEnabledState_); - } - }, - - /** - * Updates the parameter fields/inputs of this block to match the state of the - * data model. - */ - updateParameters_: function() { - this.updateArgsMap_(); - this.deleteAllArgInputs_(); - this.addParametersLabel__(); - this.createArgInputs_(); - this.reattachBlocks_(); - this.prevParams_ = [...this.getProcedureModel().getParameters()]; - }, - - /** - * Saves a map of parameter IDs to target blocks attached to the inputs - * of this caller block. - */ - updateArgsMap_: function() { - for (const [i, p] of this.prevParams_.entries()) { - const target = this.getInputTargetBlock(`ARG${i}`); - if (target) this.argsMap_.set(p.getId(), target); - } - }, - - /** - * Deletes all the parameter inputs on this block. - */ - deleteAllArgInputs_: function() { - let i = 0; - while (this.getInput(`ARG${i}`)) { - this.removeInput(`ARG${i}`); - i++; - } - }, - - /** - * Adds or removes the parameter label to match the state of the data model. - */ - addParametersLabel__: function() { - const topRow = this.getInput('TOPROW'); - if (this.getProcedureModel().getParameters().length) { - if (!this.getField('WITH')) { - topRow.appendField(Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH'); - topRow.init(); - } - } else if (this.getField('WITH')) { - topRow.removeField('WITH'); - } - }, - - /** - * Creates all of the parameter inputs to match the state of the data model. - * @param {Array} params The params to add to the block, or null to - * use the params defined in the procedure model. - */ - createArgInputs_: function(params = null) { - if (!params) { - params = this.getProcedureModel().getParameters().map((p) => p.getName()); - } - for (const [i, p] of params.entries()) { - this.appendValueInput(`ARG${i}`) - .appendField(new FieldLabel(p), `ARGNAME${i}`) - .setAlign(Align.RIGHT); - } - }, - - /** - * Reattaches blocks to this blocks' inputs based on the data saved in the - * argsMap_. - */ - reattachBlocks_: function() { - const params = this.getProcedureModel().getParameters(); - for (const [i, p] of params.entries()) { - if (!this.argsMap_.has(p.getId())) continue; - this.getInput(`ARG${i}`).connection.connect( - this.argsMap_.get(p.getId()).outputConnection); - } - }, - /** * Notification that a procedure is renaming. * If the name matches this block's procedure, rename it. @@ -1267,11 +696,225 @@ const procedureCallerUpdateShapeMixin = { this.setTooltip(baseMsg.replace('%1', newName)); } }, -}; -Extensions.registerMixin( - 'procedure_caller_update_shape_mixin', procedureCallerUpdateShapeMixin); + /** + * Notification that the procedure's parameters have changed. + * @param {!Array} paramNames New param names, e.g. ['x', 'y', 'z']. + * @param {!Array} paramIds IDs of params (consistent for each + * parameter through the life of a mutator, regardless of param renaming), + * e.g. ['piua', 'f8b_', 'oi.o']. + * @private + * @this {Block} + */ + setProcedureParameters_: function(paramNames, paramIds) { + // Data structures: + // this.arguments = ['x', 'y'] + // Existing param names. + // this.quarkConnections_ {piua: null, f8b_: Connection} + // Look-up of paramIds to connections plugged into the call block. + // this.quarkIds_ = ['piua', 'f8b_'] + // Existing param IDs. + // Note that quarkConnections_ may include IDs that no longer exist, but + // which might reappear if a param is reattached in the mutator. + const defBlock = + Procedures.getDefinition(this.getProcedureCall(), this.workspace); + const mutatorOpen = + defBlock && defBlock.mutator && defBlock.mutator.isVisible(); + if (!mutatorOpen) { + this.quarkConnections_ = {}; + this.quarkIds_ = null; + } else { + // fix #6091 - this call could cause an error when outside if-else + // expanding block while mutating prevents another error (ancient fix) + this.setCollapsed(false); + } + // Test arguments (arrays of strings) for changes. '\n' is not a valid + // argument name character, so it is a valid delimiter here. + if (paramNames.join('\n') === this.arguments_.join('\n')) { + // No change. + this.quarkIds_ = paramIds; + return; + } + if (paramIds.length !== paramNames.length) { + throw RangeError('paramNames and paramIds must be the same length.'); + } + if (!this.quarkIds_) { + // Initialize tracking for this block. + this.quarkConnections_ = {}; + this.quarkIds_ = []; + } + // Switch off rendering while the block is rebuilt. + const savedRendered = this.rendered; + this.rendered = false; + // Update the quarkConnections_ with existing connections. + for (let i = 0; i < this.arguments_.length; i++) { + const input = this.getInput('ARG' + i); + if (input) { + const connection = input.connection.targetConnection; + this.quarkConnections_[this.quarkIds_[i]] = connection; + if (mutatorOpen && connection && + paramIds.indexOf(this.quarkIds_[i]) === -1) { + // This connection should no longer be attached to this block. + connection.disconnect(); + connection.getSourceBlock().bumpNeighbours(); + } + } + } + // Rebuild the block's arguments. + this.arguments_ = [].concat(paramNames); + // And rebuild the argument model list. + this.argumentVarModels_ = []; + for (let i = 0; i < this.arguments_.length; i++) { + const variable = Variables.getOrCreateVariablePackage( + this.workspace, null, this.arguments_[i], ''); + this.argumentVarModels_.push(variable); + } -const procedureCallerOnChangeMixin = { + this.updateShape_(); + this.quarkIds_ = paramIds; + // Reconnect any child blocks. + if (this.quarkIds_) { + for (let i = 0; i < this.arguments_.length; i++) { + const quarkId = this.quarkIds_[i]; + if (quarkId in this.quarkConnections_) { + const connection = this.quarkConnections_[quarkId]; + if (!Mutator.reconnect(connection, this, 'ARG' + i)) { + // Block no longer exists or has been attached elsewhere. + delete this.quarkConnections_[quarkId]; + } + } + } + } + // Restore rendering and show the changes. + this.rendered = savedRendered; + if (this.rendered) { + this.render(); + } + }, + /** + * Modify this block to have the correct number of arguments. + * @private + * @this {Block} + */ + updateShape_: function() { + for (let i = 0; i < this.arguments_.length; i++) { + const argField = this.getField('ARGNAME' + i); + if (argField) { + // Ensure argument name is up to date. + // The argument name field is deterministic based on the mutation, + // no need to fire a change event. + Events.disable(); + try { + argField.setValue(this.arguments_[i]); + } finally { + Events.enable(); + } + } else { + // Add new input. + const newField = new FieldLabel(this.arguments_[i]); + const input = this.appendValueInput('ARG' + i) + .setAlign(Align.RIGHT) + .appendField(newField, 'ARGNAME' + i); + input.init(); + } + } + // Remove deleted inputs. + for (let i = this.arguments_.length; this.getInput('ARG' + i); i++) { + this.removeInput('ARG' + i); + } + // Add 'with:' if there are parameters, remove otherwise. + const topRow = this.getInput('TOPROW'); + if (topRow) { + if (this.arguments_.length) { + if (!this.getField('WITH')) { + topRow.appendField(Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH'); + topRow.init(); + } + } else { + if (this.getField('WITH')) { + topRow.removeField('WITH'); + } + } + } + }, + /** + * Create XML to represent the (non-editable) name and arguments. + * Backwards compatible serialization implementation. + * @return {!Element} XML storage element. + * @this {Block} + */ + mutationToDom: function() { + const container = xmlUtils.createElement('mutation'); + container.setAttribute('name', this.getProcedureCall()); + for (let i = 0; i < this.arguments_.length; i++) { + const parameter = xmlUtils.createElement('arg'); + parameter.setAttribute('name', this.arguments_[i]); + container.appendChild(parameter); + } + return container; + }, + /** + * Parse XML to restore the (non-editable) name and parameters. + * Backwards compatible serialization implementation. + * @param {!Element} xmlElement XML storage element. + * @this {Block} + */ + domToMutation: function(xmlElement) { + const name = xmlElement.getAttribute('name'); + this.renameProcedure(this.getProcedureCall(), name); + const args = []; + const paramIds = []; + for (let i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { + if (childNode.nodeName.toLowerCase() === 'arg') { + args.push(childNode.getAttribute('name')); + paramIds.push(childNode.getAttribute('paramId')); + } + } + this.setProcedureParameters_(args, paramIds); + }, + /** + * Returns the state of this block as a JSON serializable object. + * @return {{name: string, params:(!Array|undefined)}} The state of + * this block, ie the params and procedure name. + */ + saveExtraState: function() { + const state = Object.create(null); + state['name'] = this.getProcedureCall(); + if (this.arguments_.length) { + state['params'] = this.arguments_; + } + return state; + }, + /** + * Applies the given state to this block. + * @param {*} state The state to apply to this block, ie the params and + * procedure name. + */ + loadExtraState: function(state) { + this.renameProcedure(this.getProcedureCall(), state['name']); + const params = state['params']; + if (params) { + const ids = []; + ids.length = params.length; + ids.fill(null); + this.setProcedureParameters_(params, ids); + } + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Block} + */ + getVars: function() { + return this.arguments_; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Block} + */ + getVarModels: function() { + return this.argumentVarModels_; + }, /** * Procedure calls cannot exist without the corresponding procedure * definition. Enforce this link whenever an event is fired. @@ -1288,72 +931,90 @@ const procedureCallerOnChangeMixin = { return; } if (event.type === Events.BLOCK_CREATE && - (event.blockId === this.id || event.ids.indexOf(this.id) !== -1)) { + event.ids.indexOf(this.id) !== -1) { // Look for the case where a procedure call was created (usually through // paste) and there is no matching definition. In this case, create // an empty definition block with the correct signature. const name = this.getProcedureCall(); let def = Procedures.getDefinition(name, this.workspace); - if (!this.defMatches_(def)) def = null; + if (def && + (def.type !== this.defType_ || + JSON.stringify(def.getVars()) !== JSON.stringify(this.arguments_))) { + // The signatures don't match. + def = null; + } if (!def) { - // We have no def nor procedure model. Events.setGroup(event.group); - this.model_ = this.createDef_( - this.getFieldValue('NAME'), this.paramsFromSerializedState_); + /** + * Create matching definition block. + * + * + * + * + * + * test + * + * + */ + const xml = xmlUtils.createElement('xml'); + const block = xmlUtils.createElement('block'); + block.setAttribute('type', this.defType_); + const xy = this.getRelativeToSurfaceXY(); + const x = xy.x + config.snapRadius * (this.RTL ? -1 : 1); + const y = xy.y + config.snapRadius * 2; + block.setAttribute('x', x); + block.setAttribute('y', y); + const mutation = this.mutationToDom(); + block.appendChild(mutation); + const field = xmlUtils.createElement('field'); + field.setAttribute('name', 'NAME'); + const callName = this.getProcedureCall(); + const newName = Procedures.findLegalName(callName, this); + if (callName !== newName) { + this.renameProcedure(callName, newName); + } + field.appendChild(xmlUtils.createTextNode(callName)); + block.appendChild(field); + xml.appendChild(block); + Xml.domToWorkspace(xml, this.workspace); Events.setGroup(false); } - if (!this.getProcedureModel()) { - // We have a def, but no reference to its model. - this.model_ = this.findProcedureModel_( - this.getFieldValue('NAME'), this.paramsFromSerializedState_); + } else if (event.type === Events.BLOCK_DELETE) { + // Look for the case where a procedure definition has been deleted, + // leaving this block (a procedure call) orphaned. In this case, delete + // the orphan. + const name = this.getProcedureCall(); + const def = Procedures.getDefinition(name, this.workspace); + if (!def) { + Events.setGroup(event.group); + this.dispose(true); + Events.setGroup(false); + } + } else if (event.type === Events.CHANGE && event.element === 'disabled') { + const name = this.getProcedureCall(); + const def = Procedures.getDefinition(name, this.workspace); + if (def && def.id === event.blockId) { + // in most cases the old group should be '' + const oldGroup = Events.getGroup(); + if (oldGroup) { + // This should only be possible programmatically and may indicate a + // problem with event grouping. If you see this message please + // investigate. If the use ends up being valid we may need to reorder + // events in the undo stack. + console.log( + 'Saw an existing group while responding to a definition change'); + } + Events.setGroup(event.group); + if (event.newValue) { + this.previousEnabledState_ = this.isEnabled(); + this.setEnabled(false); + } else { + this.setEnabled(this.previousEnabledState_); + } + Events.setGroup(oldGroup); } - this.initBlockWithProcedureModel_(); } }, - - /** - * Returns true if the given def block matches the definition of this caller - * block. - * @param {Block} defBlock The definition block to check against. - * @return {boolean} Whether the def block matches or not. - */ - defMatches_(defBlock) { - return defBlock && defBlock.type === this.defType_ && - JSON.stringify(defBlock.getVars()) === - JSON.stringify(this.paramsFromSerializedState_); - }, - - /** - * Creates a procedure definition block with the given name and params, - * and returns the procedure model associated with it. - * @param {string} name The name of the procedure to create. - * @param {Array} params The names of the parameters to create. - * @return {IProcedureModel} The procedure model associated with the new - * procedure definition block. - */ - createDef_(name, params = []) { - const xy = this.getRelativeToSurfaceXY(); - const newName = Procedures.findLegalName(name, this); - this.renameProcedure(name, newName); - - const blockDef = { - 'type': this.defType_, - 'x': xy.x + config.snapRadius * (this.RTL ? -1 : 1), - 'y': xy.y + config.snapRadius * 2, - 'extraState': { - 'params': params.map((p) => ({'name': p})), - }, - 'fields': {'NAME': newName}, - }; - return serialization.blocks - .append(blockDef, this.getTargetWorkspace_(), {recordUndo: true}) - .getProcedureModel(); - }, -}; -Extensions.registerMixin( - 'procedure_caller_onchange_mixin', procedureCallerOnChangeMixin); - -const procedureCallerContextMenuMixin = { /** * Add menu option to find the definition block for this call. * @param {!Array} options List of menu options to add to. @@ -1380,28 +1041,71 @@ const procedureCallerContextMenuMixin = { options.push(option); }, }; -Extensions.registerMixin( - 'procedure_caller_context_menu_mixin', procedureCallerContextMenuMixin); -const procedureCallerNoReturnGetDefBlockMixin = { - hasReturn_: false, +blocks['procedures_callnoreturn'] = { + ...PROCEDURE_CALL_COMMON, + /** + * Block for calling a procedure with no return value. + * @this {Block} + */ + init: function() { + this.appendDummyInput('TOPROW').appendField('', 'NAME'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setStyle('procedure_blocks'); + // Tooltip is set in renameProcedure. + this.setHelpUrl(Msg['PROCEDURES_CALLNORETURN_HELPURL']); + this.arguments_ = []; + this.argumentVarModels_ = []; + this.quarkConnections_ = {}; + this.quarkIds_ = null; + this.previousEnabledState_ = true; + }, + defType_: 'procedures_defnoreturn', }; -Extensions.registerMixin( - 'procedure_callernoreturn_get_def_block_mixin', - procedureCallerNoReturnGetDefBlockMixin); -const procedureCallerReturnGetDefBlockMixin = { - hasReturn_: true, +blocks['procedures_callreturn'] = { + ...PROCEDURE_CALL_COMMON, + /** + * Block for calling a procedure with a return value. + * @this {Block} + */ + init: function() { + this.appendDummyInput('TOPROW').appendField('', 'NAME'); + this.setOutput(true); + this.setStyle('procedure_blocks'); + // Tooltip is set in domToMutation. + this.setHelpUrl(Msg['PROCEDURES_CALLRETURN_HELPURL']); + this.arguments_ = []; + this.argumentVarModels_ = []; + this.quarkConnections_ = {}; + this.quarkIds_ = null; + this.previousEnabledState_ = true; + }, + defType_: 'procedures_defreturn', }; -Extensions.registerMixin( - 'procedure_callerreturn_get_def_block_mixin', - procedureCallerReturnGetDefBlockMixin); - -const procedureIfReturnMutator = { - hasReturnValue_: true, +blocks['procedures_ifreturn'] = { + /** + * Block for conditionally returning a value from a procedure. + * @this {Block} + */ + init: function() { + this.appendValueInput('CONDITION') + .setCheck('Boolean') + .appendField(Msg['CONTROLS_IF_MSG_IF']); + this.appendValueInput('VALUE').appendField( + Msg['PROCEDURES_DEFRETURN_RETURN']); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setStyle('procedure_blocks'); + this.setTooltip(Msg['PROCEDURES_IFRETURN_TOOLTIP']); + this.setHelpUrl(Msg['PROCEDURES_IFRETURN_HELPURL']); + this.hasReturnValue_ = true; + }, /** * Create XML to represent whether this block has a return value. * @return {!Element} XML storage element. @@ -1412,7 +1116,6 @@ const procedureIfReturnMutator = { container.setAttribute('value', Number(this.hasReturnValue_)); return container; }, - /** * Parse XML to restore whether this block has a return value. * @param {!Element} xmlElement XML storage element. @@ -1432,12 +1135,7 @@ const procedureIfReturnMutator = { // loadExtraState) because the state of this block is already encoded in the // block's position in the workspace. // XML hooks are kept for backwards compatibility. -}; -Extensions.registerMutator( - 'procedure_ifreturn_mutator', procedureIfReturnMutator); - -const procedureIfReturnOnChangeMixin = { /** * Called whenever anything on the workspace changes. * Add warning if this flow block is not nested inside a loop. @@ -1485,12 +1183,6 @@ const procedureIfReturnOnChangeMixin = { Events.setGroup(group); } }, -}; - -Extensions.registerMixin( - 'procedure_ifreturn_onchange_mixin', procedureIfReturnOnChangeMixin); - -const procedureIfReturnFunctionTypesMixin = { /** * List of block types that are functions and thus do not need warnings. * To add a new function type add this to your code: @@ -1499,9 +1191,5 @@ const procedureIfReturnFunctionTypesMixin = { FUNCTION_TYPES: ['procedures_defnoreturn', 'procedures_defreturn'], }; -Extensions.registerMixin( - 'procedure_ifreturn_function_types_mixin', - procedureIfReturnFunctionTypesMixin); - // Register provided blocks. defineBlocks(blocks); diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 24a908a45..42c486042 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -7,7 +7,6 @@ goog.declareModuleId('Blockly.test.procedures'); import * as Blockly from '../../../build/src/core/blockly.js'; -import {ObservableParameterModel} from '../../../build/src/core/procedures.js'; import {assertCallBlockStructure, assertDefBlockStructure, createProcDefBlock, createProcCallBlock} from '../test_helpers/procedures.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from '../test_helpers/setup_teardown.js'; @@ -28,712 +27,6 @@ suite('Procedures', function() { sharedTestTeardown.call(this); }); - suite('updating data models', function() { - test( - 'renaming a procedure def block updates the procedure model', - function() { - const defBlock = createProcDefBlock(this.workspace); - - defBlock.setFieldValue('new name', 'NAME'); - - chai.assert.equal( - defBlock.getProcedureModel().getName(), - 'new name', - 'Expected the procedure model name to be updated'); - }); - - test( - 'disabling a procedure def block updates the procedure model', - function() { - const defBlock = createProcDefBlock(this.workspace); - - defBlock.setEnabled(false); - this.clock.runAll(); - - chai.assert.isFalse( - defBlock.getProcedureModel().getEnabled(), - 'Expected the procedure model to be disabled'); - }); - - test( - 'adding a parameter to a procedure def updates the procedure model', - function() { - // Create a stack of container, parameter. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock.setFieldValue('param name', 'NAME'); - containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); - this.clock.runAll(); - - chai.assert.equal( - defBlock.getProcedureModel().getParameter(0).getName(), - 'param name', - 'Expected the procedure model to have a matching parameter'); - }); - - test('adding a parameter adds a variable to the variable map', function() { - // Create a stack of container, parameter. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock.setFieldValue('param name', 'NAME'); - containerBlock.getInput('STACK').connection - .connect(paramBlock.previousConnection); - this.clock.runAll(); - - chai.assert.isTrue( - this.workspace.getVariableMap().getVariablesOfType('') - .some((variable) => variable.name === 'param name'), - 'Expected the variable map to have a matching variable'); - }); - - - test( - 'moving a parameter in the procedure def updates the procedure model', - function() { - // Create a stack of container, param1, param2. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock1 = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock1.setFieldValue('param name1', 'NAME'); - const paramBlock2 = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock2.setFieldValue('param name2', 'NAME'); - containerBlock.getInput('STACK').connection - .connect(paramBlock1.previousConnection); - paramBlock1.nextConnection.connect(paramBlock2.previousConnection); - this.clock.runAll(); - const id1 = defBlock.getProcedureModel().getParameter(0).getId(); - const id2 = defBlock.getProcedureModel().getParameter(1).getId(); - - // Reconfigure the stack to be container, param2, param1. - paramBlock2.previousConnection.disconnect(); - paramBlock1.previousConnection.disconnect(); - containerBlock.getInput('STACK').connection - .connect(paramBlock2.previousConnection); - paramBlock2.nextConnection.connect(paramBlock1.previousConnection); - this.clock.runAll(); - - chai.assert.equal( - defBlock.getProcedureModel().getParameter(0).getName(), - 'param name2', - 'Expected the first parameter of the procedure to be param 2'); - chai.assert.equal( - defBlock.getProcedureModel().getParameter(0).getId(), - id2, - 'Expected the first parameter of the procedure to be param 2'); - chai.assert.equal( - defBlock.getProcedureModel().getParameter(1).getName(), - 'param name1', - 'Expected the second parameter of the procedure to be param 1'); - chai.assert.equal( - defBlock.getProcedureModel().getParameter(1).getId(), - id1, - 'Expected the second parameter of the procedure to be param 1'); - }); - - test('decomposing and recomposing maintains parameter IDs', function() { - // Create a stack of container, param. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock.setFieldValue('param name', 'NAME'); - containerBlock.getInput('STACK').connection - .connect(paramBlock.previousConnection); - this.clock.runAll(); - const paramBlockId = defBlock.getProcedureModel().getParameter(0).getId(); - - Blockly.Events.disable(); - mutatorWorkspace.clear(); - Blockly.Events.enable(); - const container = defBlock.decompose(mutatorWorkspace); - defBlock.compose(container); - - chai.assert.equal( - defBlock.getProcedureModel().getParameter(0).getId(), - paramBlockId, - 'Expected the parameter ID to be maintained'); - }); - - test( - 'deleting a parameter from a procedure def updates the procedure model', - function() { - // Create a stack of container, parameter. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock.setFieldValue('param name', 'NAME'); - containerBlock.getInput('STACK').connection - .connect(paramBlock.previousConnection); - this.clock.runAll(); - - containerBlock.getInput('STACK').connection.disconnect(); - this.clock.runAll(); - - chai.assert.isEmpty( - defBlock.getProcedureModel().getParameters(), - 'Expected the procedure model to have no parameters'); - }); - - test('renaming a procedure parameter updates the parameter model', function() { - // Create a stack of container, parameter. - const defBlock = createProcDefBlock(this.workspace); - defBlock.mutator.setVisible(true); - const mutatorWorkspace = defBlock.mutator.getWorkspace(); - const containerBlock = mutatorWorkspace.getTopBlocks()[0]; - const paramBlock = mutatorWorkspace.newBlock('procedures_mutatorarg'); - paramBlock.setFieldValue('param name', 'NAME'); - containerBlock.getInput('STACK').connection - .connect(paramBlock.previousConnection); - this.clock.runAll(); - - paramBlock.setFieldValue('new param name', 'NAME'); - this.clock.runAll(); - - chai.assert.equal( - defBlock.getProcedureModel().getParameter(0).getName(), - 'new param name', - 'Expected the procedure model to have a matching parameter'); - }); - - test('deleting a procedure deletes the procedure model', function() { - const defBlock = createProcDefBlock(this.workspace); - const model = defBlock.getProcedureModel(); - defBlock.dispose(); - - chai.assert.isUndefined( - this.workspace.getProcedureMap().get(model.getId()), - 'Expected the model to be removed from the procedure map'); - }); - }); - - suite('responding to data model updates', function() { - suite('def blocks', function() { - test('renaming the procedure data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.setName('new name'); - - chai.assert.equal( - defBlock.getFieldValue('NAME'), - 'new name', - 'Expected the procedure block to be renamed'); - }); - - test('disabling a procedure data model disables blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.setEnabled(false); - - chai.assert.isFalse( - defBlock.isEnabled(), - 'Expected the procedure block to be disabled'); - }); - - test('adding a parameter to a data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.insertParameter( - new ObservableParameterModel(this.workspace, 'param1', 'id'), 0); - - chai.assert.isNotNull( - defBlock.getField('PARAMS'), - 'Expected the params field to exist'); - chai.assert.isTrue( - defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to contain the name of the new param'); - }); - - test('moving a parameter in the data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - const param2 = - new ObservableParameterModel(this.workspace, 'param2', 'id2'); - procModel.insertParameter(param1, 0); - procModel.insertParameter(param2, 1); - - procModel.deleteParameter(1); - procModel.insertParameter(param2, 0); - - chai.assert.isNotNull( - defBlock.getField('PARAMS'), - 'Expected the params field to exist'); - chai.assert.isTrue( - defBlock.getFieldValue('PARAMS').includes('param2, param1'), - 'Expected the params field order to match the parameter order'); - }); - - test( - 'deleting a parameter from the data model updates blocks', - function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - const param2 = - new ObservableParameterModel(this.workspace, 'param2', 'id2'); - procModel.insertParameter(param1, 0); - procModel.insertParameter(param2, 1); - - procModel.deleteParameter(0); - - chai.assert.isNotNull( - defBlock.getField('PARAMS'), - 'Expected the params field to exist'); - chai.assert.isTrue( - defBlock.getFieldValue('PARAMS').includes('param2'), - 'Expected the params field order to contain one parameter'); - chai.assert.isFalse( - defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to not contain the deleted parameter'); - }); - - test( - 'renaming a procedure parameter in the data model updates blocks', - function() { - const defBlock = createProcDefBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - procModel.insertParameter(param1, 0); - - param1.setName('new name'); - - chai.assert.isNotNull( - defBlock.getField('PARAMS'), - 'Expected the params field to exist'); - chai.assert.isTrue( - defBlock.getFieldValue('PARAMS').includes('new name'), - 'Expected the params field to contain the new param name'); - }); - }); - - suite('caller blocks', function() { - test('renaming the procedure data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.setName('new name'); - - chai.assert.equal( - callBlock.getFieldValue('NAME'), - 'new name', - 'Expected the procedure block to be renamed'); - }); - - test('disabling a procedure data model disables blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.setEnabled(false); - - chai.assert.isFalse( - callBlock.isEnabled(), - 'Expected the procedure block to be disabled'); - }); - - test('adding a parameter to a data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - - procModel.insertParameter( - new ObservableParameterModel(this.workspace, 'param1', 'id'), 0); - - chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the param input to exist'); - chai.assert.equal( - callBlock.getFieldValue('ARGNAME0'), - 'param1', - 'Expected the params field to match the name of the new param'); - }); - - test('moving a parameter in the data model updates blocks', function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - const param2 = - new ObservableParameterModel(this.workspace, 'param2', 'id2'); - procModel.insertParameter(param1, 0); - procModel.insertParameter(param2, 1); - - procModel.deleteParameter(1); - procModel.insertParameter(param2, 0); - - chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the first param input to exist'); - chai.assert.isNotNull( - callBlock.getInput('ARG1'), - 'Expected the second param input to exist'); - chai.assert.equal( - callBlock.getFieldValue('ARGNAME0'), - 'param2', - 'Expected the first params field to match the name of the param'); - chai.assert.equal( - callBlock.getFieldValue('ARGNAME1'), - 'param1', - 'Expected the second params field to match the name of the param'); - }); - - test( - 'moving a parameter in the data model moves input blocks', - function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - const param2 = - new ObservableParameterModel(this.workspace, 'param2', 'id2'); - procModel.insertParameter(param1, 0); - procModel.insertParameter(param2, 1); - const rowBlock1 = this.workspace.newBlock('row_block'); - const rowBlock2 = this.workspace.newBlock('row_block'); - callBlock.getInput('ARG0').connection - .connect(rowBlock1.outputConnection); - callBlock.getInput('ARG1').connection - .connect(rowBlock2.outputConnection); - - procModel.deleteParameter(1); - procModel.insertParameter(param2, 0); - - chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the first param input to exist'); - chai.assert.equal( - callBlock.getInputTargetBlock('ARG0'), - rowBlock2, - 'Expected the second row block to be attached to the first input'); - chai.assert.isNotNull( - callBlock.getInput('ARG1'), - 'Expected the second param input to exist'); - chai.assert.equal( - callBlock.getInputTargetBlock('ARG1'), - rowBlock1, - 'Expected the first row block to be attached to the second input'); - }); - - test( - 'deleting a parameter from the data model updates blocks', - function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - const param2 = - new ObservableParameterModel(this.workspace, 'param2', 'id2'); - procModel.insertParameter(param1, 0); - procModel.insertParameter(param2, 1); - - procModel.deleteParameter(0); - - chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the first param input to exist'); - chai.assert.isNull( - callBlock.getInput('ARG1'), - 'Expected the second param input to not exist'); - chai.assert.equal( - callBlock.getFieldValue('ARGNAME0'), - 'param2', - 'Expected the first params field to match the name of the param'); - }); - - test( - 'renaming a procedure parameter in the data model updates blocks', - function() { - const defBlock = createProcDefBlock(this.workspace); - const callBlock = createProcCallBlock(this.workspace); - const procModel = defBlock.getProcedureModel(); - const param1 = - new ObservableParameterModel(this.workspace, 'param1', 'id1'); - procModel.insertParameter(param1, 0); - - param1.setName('new name'); - - chai.assert.isNotNull( - callBlock.getInput('ARG0'), - 'Expected the param input to exist'); - chai.assert.equal( - callBlock.getFieldValue('ARGNAME0'), - 'new name', - 'Expected the params field to match the new name of the param'); - }); - }); - }); - - suite('deserializing data models', function() { - suite('return types', function() { - test('procedure defs without returns have null return types', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defnoreturn', - 'fields': { - 'NAME': 'test name', - }, - }, - ], - }, - }; - Blockly.serialization.workspaces.load(json, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.isNull( - procedureModel.getReturnTypes(), - 'Expected the return types to be null'); - }); - - test('procedure defs with returns have array return types', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defreturn', - 'fields': { - 'NAME': 'test name', - }, - }, - ], - }, - }; - Blockly.serialization.workspaces.load(json, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.isArray( - procedureModel.getReturnTypes(), - 'Expected the return types to be an array'); - }); - }); - - suite('json', function() { - test('procedure names get deserialized', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defnoreturn', - 'fields': { - 'NAME': 'test name', - }, - }, - ], - }, - }; - Blockly.serialization.workspaces.load(json, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.name, - 'test name', - 'Expected the name of the procedure model to equal the name ' + - 'being deserialized.'); - }); - - test('procedure parameter names get deserialized', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defnoreturn', - 'fields': { - 'NAME': 'test name', - }, - 'extraState': { - 'params': [ - { - 'id': 'test id 1', - 'name': 'test name 1', - }, - { - 'id': 'test id 2', - 'name': 'test name 2', - }, - ], - }, - }, - ], - }, - }; - Blockly.serialization.workspaces.load(json, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.getParameter(0).getName(), - 'test name 1', - 'Expected the name of the first parameter to equal the name ' + - 'being deserialized.'); - chai.assert.equal( - procedureModel.getParameter(1).getName(), - 'test name 2', - 'Expected the name of the second parameter to equal the name ' + - 'being deserialized.'); - }); - - test('procedure variables get matching IDs', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defnoreturn', - 'extraState': { - 'params': [ - { - 'name': 'test param name', - 'id': 'test param id', - }, - ], - }, - 'fields': { - 'NAME': 'test proc name', - }, - }, - ], - }, - 'variables': [ - { - 'name': 'test param name', - 'id': 'test param id', - }, - ], - }; - Blockly.serialization.workspaces.load(json, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.getParameter(0).getVariableModel().getId(), - 'test param id', - 'Expected the variable id to match the serialized param id'); - }); - }); - - suite('xml', function() { - test('procedure names get deserialized', function() { - const xml = Blockly.Xml.textToDom( - `` + - ` test name` + - ``); - Blockly.Xml.domToBlock(xml, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.name, - 'test name', - 'Expected the name of the procedure model to equal the name ' + - 'being deserialized.'); - }); - - test('procedure parameter names get deserialized', function() { - const xml = Blockly.Xml.textToDom( - `` + - ` ` + - ` ` + - ` ` + - ` ` + - ` test name` + - ``); - Blockly.Xml.domToBlock(xml, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.getParameter(0).getName(), - 'test name 1', - 'Expected the name of the first parameter to equal the name ' + - 'being deserialized.'); - chai.assert.equal( - procedureModel.getParameter(1).getName(), - 'test name 2', - 'Expected the name of the second parameter to equal the name ' + - 'being deserialized.'); - }); - - test('procedure variables get matching IDs', function() { - const json = { - 'blocks': { - 'languageVersion': 0, - 'blocks': [ - { - 'type': 'procedures_defnoreturn', - 'extraState': { - 'params': [ - { - 'name': 'test param name', - 'id': 'test param id', - }, - ], - }, - 'fields': { - 'NAME': 'test proc name', - }, - }, - ], - }, - 'variables': [ - { - 'name': 'test param name', - 'id': 'test param id', - }, - ], - }; - const xml = Blockly.Xml.textToDom( - `` + - ` ` + - ` test param name` + - ` ` + - ` ` + - ` ` + - ` ` + - ` ` + - ` test name` + - ` ` + - ``); - Blockly.Xml.domToWorkspace(xml, this.workspace); - const procedureModel = - this.workspace.getProcedureMap().getProcedures()[0]; - - chai.assert.equal( - procedureModel.getParameter(0).getVariableModel().getId(), - 'test param id', - 'Expected the variable id to match the serialized param id'); - }); - }); - }); - suite('renaming procedures', function() { test('callers are updated to have the new name', function() { const defBlock = createProcDefBlock(this.workspace); @@ -1459,6 +752,7 @@ suite('Procedures', function() { const callBlock1 = createProcCallBlock(this.workspace); const callBlock2 = createProcCallBlock(this.workspace); + this.clock.runAll(); defBlock.dispose(); this.clock.runAll(); @@ -1467,35 +761,6 @@ suite('Procedures', function() { chai.assert.isTrue( callBlock2.disposed, 'Expected the second caller to be disposed'); }); - - test('undoing and redoing a procedure delete will still associate ' + - 'procedure and caller with the same model', - function() { - const defBlock = createProcDefBlock(this.workspace); - createProcCallBlock(this.workspace); - // TODO: Apparently we need to call checkAndDelete to handle event - // grouping, this seems like possibly a bug. - const oldModel = defBlock.getProcedureModel(); - defBlock.checkAndDelete(); - this.clock.runAll(); - - this.workspace.undo(); - this.clock.runAll(); - - const newDefBlock = - this.workspace.getBlocksByType('procedures_defnoreturn')[0]; - const newCallBlock = - this.workspace.getBlocksByType('procedures_callnoreturn')[0]; - - chai.assert.equal( - newDefBlock.getProcedureModel(), - newCallBlock.getProcedureModel(), - 'Expected both new blocks to be associated with the same model'); - chai.assert.equal( - oldModel.getId(), - newDefBlock.getProcedureModel().getId(), - 'Expected the new model to have the same ID as the old model'); - }); }); suite('caller blocks creating new def blocks', function() { @@ -1568,7 +833,7 @@ suite('Procedures', function() { callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); }); - test( + test.skip( 'callers whose defs are deserialized later do not create defs', function() { Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(` @@ -1591,12 +856,10 @@ suite('Procedures', function() { this.workspace.getBlocksByType('procedures_defreturn')[0]; const callBlock = this.workspace.getBlocksByType('procedures_callreturn')[0]; + // TODO: Currently the callers are creating variables with different + // IDs than those serialized to XML, so these assertions fail. assertDefBlockStructure(defBlock, true, ['x'], ['arg']); assertCallBlockStructure(callBlock, ['x'], ['arg'], 'do something'); - chai.assert.equal( - defBlock.getProcedureModel(), - callBlock.getProcedureModel(), - 'Expected the blocks to have the same procedure model'); }); }); @@ -1679,7 +942,7 @@ suite('Procedures', function() { callBlock, ['y'], [this.TEST_VAR_ID], 'do something2'); }); - test( + test.skip( 'callers whose defs are deserialized later do not create defs', function() { Blockly.serialization.workspaces.load({ @@ -1714,12 +977,10 @@ suite('Procedures', function() { this.workspace.getBlocksByType('procedures_defreturn')[0]; const callBlock = this.workspace.getBlocksByType('procedures_callreturn')[0]; + // TODO: Currently the callers are creating variables with different + // IDs than those serialized to JSON, so these assertions fail. assertDefBlockStructure(defBlock, true, ['x'], ['arg']); assertCallBlockStructure(callBlock, ['x'], ['arg'], 'do something'); - chai.assert.equal( - defBlock.getProcedureModel(), - callBlock.getProcedureModel(), - 'Expected the blocks to have the same procedure model'); }); }); }); @@ -1985,107 +1246,6 @@ suite('Procedures', function() { }); }); - suite('full workspace serialization test cases', function() { - test('definitions with parameters are properly rendered', function() { - Blockly.serialization.workspaces.load({ - "blocks": { - "languageVersion": 0, - "blocks": [ - { - "type": "procedures_defnoreturn", - "extraState": { - "procedureId": "procId", - "params": [ - { - "name": "x", - "id": "varId", - "paramId": "paramId", - }, - ], - }, - "fields": { - "NAME": "do something", - }, - }, - ], - }, - "procedures": [ - { - "id": "procId", - "name": "do something", - "returnTypes": null, - "parameters": [ - { - "id": "paramId", - "name": "x", - }, - ], - }, - ], - "variables": [ - { - "name": "x", - "id": "varId", - }, - ], - }, this.workspace); - assertDefBlockStructure( - this.workspace.getTopBlocks(false)[0], false, ['x'], ['varId']); - }); - test( - 'multiple definitions pointing to the same model end up with ' + - 'different models', - function() { - Blockly.serialization.workspaces.load({ - "blocks": { - "languageVersion": 0, - "blocks": [ - { - "type": "procedures_defnoreturn", - "extraState": { - "procedureId": "procId", - }, - "fields": { - "NAME": "do something", - }, - }, - { - "type": "procedures_defnoreturn", - "y": 10, - "extraState": { - "procedureId": "procId", - }, - "fields": { - "NAME": "do something", - }, - }, - ], - }, - "procedures": [ - { - "id": "procId", - "name": "do something", - "returnTypes": null, - }, - ], - }, this.workspace); - const def1 = this.workspace.getTopBlocks(true)[0]; - const def2 = this.workspace.getTopBlocks(true)[1]; - chai.assert.equal( - def1.getProcedureModel().getName(), - 'do something', - 'Expected the first procedure definition to have the name in XML'); - chai.assert.equal( - def2.getProcedureModel().getName(), - 'do something2', - 'Expected the second procedure definition to be renamed'); - chai.assert.notEqual( - def1.getProcedureModel(), - def2.getProcedureModel(), - 'Expected the procedures to have different models'); - }); - }); - const testSuites = [ {title: 'procedures_defreturn', hasReturn: true, defType: 'procedures_defreturn', callType: 'procedures_callreturn'}, @@ -2735,9 +1895,6 @@ suite('Procedures', function() { 'fields': { 'NAME': 'unnamed', }, - 'extraState': { - 'procedureId': '1', - }, }, assertBlockStructure: (block) => { @@ -2758,9 +1915,6 @@ suite('Procedures', function() { 'fields': { 'NAME': 'do something', }, - 'extraState': { - 'procedureId': '1', - }, }, assertBlockStructure: (block) => { @@ -2794,17 +1948,14 @@ suite('Procedures', function() { 'NAME': 'do something', }, 'extraState': { - 'procedureId': '1', 'params': [ { 'name': 'x', 'id': 'arg1', - 'paramId': '1', }, { 'name': 'y', 'id': 'arg2', - 'paramId': '1', }, ], }, @@ -2838,12 +1989,10 @@ suite('Procedures', function() { 'NAME': 'do something', }, 'extraState': { - 'procedureId': '1', 'params': [ { 'name': 'preCreatedVar', 'id': 'preCreatedVarId', - 'paramId': '1', }, ], }, @@ -2872,7 +2021,6 @@ suite('Procedures', function() { 'NAME': 'do something', }, 'extraState': { - 'procedureId': '1', 'hasStatements': false, }, }, From da9ae8f472fda145c7db94df154ca9a8c5cfb78a Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 26 Jan 2023 09:25:42 -0800 Subject: [PATCH 053/141] chore: revert procedure events (#6795) * chore: delete procedure events * chore: delete event related tests --- core/events/events.ts | 20 - core/events/events_procedure_base.ts | 41 -- core/events/events_procedure_change_return.ts | 87 --- core/events/events_procedure_create.ts | 74 --- core/events/events_procedure_delete.ts | 71 --- core/events/events_procedure_enable.ts | 77 --- .../events/events_procedure_parameter_base.ts | 44 -- .../events_procedure_parameter_create.ts | 101 ---- .../events_procedure_parameter_delete.ts | 97 ---- .../events_procedure_parameter_rename.ts | 105 ---- core/events/events_procedure_rename.ts | 78 --- core/events/utils.ts | 24 - core/procedures/observable_parameter_model.ts | 5 - core/procedures/observable_procedure_map.ts | 6 - core/procedures/observable_procedure_model.ts | 23 - .../event_procedure_change_return_test.js | 198 ------- tests/mocha/event_procedure_create_test.js | 161 ------ tests/mocha/event_procedure_delete_test.js | 162 ------ tests/mocha/event_procedure_enable_test.js | 188 ------ .../event_procedure_parameter_create_test.js | 217 ------- .../event_procedure_parameter_delete_test.js | 218 ------- .../event_procedure_parameter_rename_test.js | 225 -------- tests/mocha/event_procedure_rename_test.js | 186 ------ tests/mocha/index.html | 8 - tests/mocha/procedure_map_test.js | 544 ------------------ 25 files changed, 2960 deletions(-) delete mode 100644 core/events/events_procedure_base.ts delete mode 100644 core/events/events_procedure_change_return.ts delete mode 100644 core/events/events_procedure_create.ts delete mode 100644 core/events/events_procedure_delete.ts delete mode 100644 core/events/events_procedure_enable.ts delete mode 100644 core/events/events_procedure_parameter_base.ts delete mode 100644 core/events/events_procedure_parameter_create.ts delete mode 100644 core/events/events_procedure_parameter_delete.ts delete mode 100644 core/events/events_procedure_parameter_rename.ts delete mode 100644 core/events/events_procedure_rename.ts delete mode 100644 tests/mocha/event_procedure_change_return_test.js delete mode 100644 tests/mocha/event_procedure_create_test.js delete mode 100644 tests/mocha/event_procedure_delete_test.js delete mode 100644 tests/mocha/event_procedure_enable_test.js delete mode 100644 tests/mocha/event_procedure_parameter_create_test.js delete mode 100644 tests/mocha/event_procedure_parameter_delete_test.js delete mode 100644 tests/mocha/event_procedure_parameter_rename_test.js delete mode 100644 tests/mocha/event_procedure_rename_test.js diff --git a/core/events/events.ts b/core/events/events.ts index 6e712bb9c..06bede7b7 100644 --- a/core/events/events.ts +++ b/core/events/events.ts @@ -28,16 +28,6 @@ import {CommentCreate, CommentCreateJson} from './events_comment_create.js'; import {CommentDelete} from './events_comment_delete.js'; import {CommentMove, CommentMoveJson} from './events_comment_move.js'; import {MarkerMove, MarkerMoveJson} from './events_marker_move.js'; -import {ProcedureBase} from './events_procedure_base.js'; -import {ProcedureChangeReturn} from './events_procedure_change_return.js'; -import {ProcedureCreate} from './events_procedure_create.js'; -import {ProcedureDelete} from './events_procedure_delete.js'; -import {ProcedureEnable} from './events_procedure_enable.js'; -import {ProcedureRename} from './events_procedure_rename.js'; -import {ProcedureParameterBase} from './events_procedure_parameter_base.js'; -import {ProcedureParameterCreate} from './events_procedure_parameter_create.js'; -import {ProcedureParameterDelete} from './events_procedure_parameter_delete.js'; -import {ProcedureParameterRename} from './events_procedure_parameter_rename.js'; import {Selected, SelectedJson} from './events_selected.js'; import {ThemeChange, ThemeChangeJson} from './events_theme_change.js'; import {ToolboxItemSelect, ToolboxItemSelectJson} from './events_toolbox_item_select.js'; @@ -87,16 +77,6 @@ export {FinishedLoading}; export {FinishedLoadingJson}; export {MarkerMove}; export {MarkerMoveJson}; -export {ProcedureBase}; -export {ProcedureChangeReturn}; -export {ProcedureCreate}; -export {ProcedureDelete}; -export {ProcedureEnable}; -export {ProcedureRename}; -export {ProcedureParameterBase}; -export {ProcedureParameterCreate}; -export {ProcedureParameterDelete}; -export {ProcedureParameterRename}; export {Selected}; export {SelectedJson}; export {ThemeChange}; diff --git a/core/events/events_procedure_base.ts b/core/events/events_procedure_base.ts deleted file mode 100644 index f775a30a2..000000000 --- a/core/events/events_procedure_base.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js'; -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import type {Workspace} from '../workspace.js'; - - -/** - * The base event for an event associated with a procedure. - */ -export abstract class ProcedureBase extends AbstractEvent { - isBlank = false; - - /** - * @param workspace The workspace the procedure model exists in. - * @param model The procedure model associated with this event. - */ - constructor(workspace: Workspace, public readonly model: IProcedureModel) { - super(); - this.workspaceId = workspace.id; - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureBaseJson { - const json = super.toJson() as ProcedureBaseJson; - json['procedureId'] = this.model.getId(); - return json; - } -} - -export interface ProcedureBaseJson extends AbstractEventJson { - procedureId: string; -} diff --git a/core/events/events_procedure_change_return.ts b/core/events/events_procedure_change_return.ts deleted file mode 100644 index 974049cb9..000000000 --- a/core/events/events_procedure_change_return.ts +++ /dev/null @@ -1,87 +0,0 @@ - -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; -import * as eventUtils from './utils.js'; - - -/** - * Notifies listeners that a procedure's return type/status has changed. - */ -export class ProcedureChangeReturn extends ProcedureBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_CHANGE_RETURN; - - /** The new type(s) the procedure's return has been set to. */ - private newTypes: string[]|null; - - /** - * @param oldTypes The type(s) the procedure's return was set to before it - * changed. - */ - constructor( - workpace: Workspace, model: IProcedureModel, - public readonly oldTypes: string[]|null) { - super(workpace, model); - - this.newTypes = model.getReturnTypes(); - } - - run(forward: boolean) { - const procedureModel = - this.getEventWorkspace_().getProcedureMap().get(this.model.getId()); - if (!procedureModel) { - throw new Error( - 'Cannot change the type of a procedure that does not exist ' + - 'in the procedure map'); - } - if (forward) { - procedureModel.setReturnTypes(this.newTypes); - } else { - procedureModel.setReturnTypes(this.oldTypes); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureChangeReturnJson { - const json = super.toJson() as ProcedureChangeReturnJson; - json['oldTypes'] = this.oldTypes; - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureChangeReturnJson, workspace: Workspace): - ProcedureChangeReturn { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure change return event because the ' + - 'target procedure does not exist'); - } - return new ProcedureChangeReturn(workspace, model, json['oldTypes']); - } -} - -export interface ProcedureChangeReturnJson extends ProcedureBaseJson { - oldTypes: string[]|null; -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_CHANGE_RETURN, - ProcedureChangeReturn); diff --git a/core/events/events_procedure_create.ts b/core/events/events_procedure_create.ts deleted file mode 100644 index d294dc6c1..000000000 --- a/core/events/events_procedure_create.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import {ObservableParameterModel, ObservableProcedureModel} from '../procedures.js'; -import * as registry from '../registry.js'; -import {loadProcedure, saveProcedure, State as ProcedureState} from '../serialization/procedures.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; -import * as eventUtils from './utils.js'; - - -/** - * Notifies listeners that a procedure data model has been created. - */ -export class ProcedureCreate extends ProcedureBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_CREATE; - - constructor(workspace: Workspace, model: IProcedureModel) { - super(workspace, model); - } - - run(forward: boolean) { - const workspace = this.getEventWorkspace_(); - const procedureMap = workspace.getProcedureMap(); - const procedureModel = procedureMap.get(this.model.getId()); - if (forward) { - if (procedureModel) return; - // TODO: This should add the model to the map instead of creating a dupe. - procedureMap.add(new ObservableProcedureModel( - workspace, this.model.getName(), this.model.getId())); - } else { - if (!procedureModel) return; - procedureMap.delete(this.model.getId()); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureCreateJson { - const json = super.toJson() as ProcedureCreateJson; - json['model'] = saveProcedure(this.model); - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureCreateJson, workspace: Workspace): - ProcedureCreate { - return new ProcedureCreate( - workspace, - loadProcedure( - ObservableProcedureModel, ObservableParameterModel, json['model'], - workspace)); - } -} - -export interface ProcedureCreateJson extends ProcedureBaseJson { - model: ProcedureState, -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_CREATE, ProcedureCreate); diff --git a/core/events/events_procedure_delete.ts b/core/events/events_procedure_delete.ts deleted file mode 100644 index 3a841c2e8..000000000 --- a/core/events/events_procedure_delete.ts +++ /dev/null @@ -1,71 +0,0 @@ - -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import {ObservableProcedureModel} from '../procedures.js'; -import * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; -import * as eventUtils from './utils.js'; - - -/** - * Notifies listeners that a procedure data model has been deleted. - */ -export class ProcedureDelete extends ProcedureBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_DELETE; - - constructor(workspace: Workspace, model: IProcedureModel) { - super(workspace, model); - } - - run(forward: boolean) { - const workspace = this.getEventWorkspace_(); - const procedureMap = workspace.getProcedureMap(); - const procedureModel = procedureMap.get(this.model.getId()); - if (forward) { - if (!procedureModel) return; - procedureMap.delete(this.model.getId()); - } else { - if (procedureModel) return; - procedureMap.add(new ObservableProcedureModel( - workspace, this.model.getName(), this.model.getId())); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureDeleteJson { - return super.toJson() as ProcedureDeleteJson; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureDeleteJson, workspace: Workspace): - ProcedureDelete { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure delete event because the ' + - 'target procedure does not exist'); - } - return new ProcedureDelete(workspace, model); - } -} - -export interface ProcedureDeleteJson extends ProcedureBaseJson {} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_DELETE, ProcedureDelete); diff --git a/core/events/events_procedure_enable.ts b/core/events/events_procedure_enable.ts deleted file mode 100644 index 8ec32f3d6..000000000 --- a/core/events/events_procedure_enable.ts +++ /dev/null @@ -1,77 +0,0 @@ - -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; -import * as eventUtils from './utils.js'; - -/** - * Notifies listeners that the procedure data model has been enabled or - * disabled. - */ -export class ProcedureEnable extends ProcedureBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_ENABLE; - - private oldState: boolean; - private newState: boolean; - - constructor(workspace: Workspace, model: IProcedureModel) { - super(workspace, model); - - this.oldState = !model.getEnabled(); - this.newState = model.getEnabled(); - } - - run(forward: boolean) { - const procedureModel = - this.getEventWorkspace_().getProcedureMap().get(this.model.getId()); - if (!procedureModel) { - throw new Error( - 'Cannot change the enabled state of a procedure that does not ' + - 'exist in the procedure map'); - } - if (forward) { - procedureModel.setEnabled(this.newState); - } else { - procedureModel.setEnabled(this.oldState); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureEnableJson { - return super.toJson() as ProcedureEnableJson; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureEnableJson, workspace: Workspace): - ProcedureEnable { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure enable event because the ' + - 'target procedure does not exist'); - } - return new ProcedureEnable(workspace, model); - } -} - -export interface ProcedureEnableJson extends ProcedureBaseJson {} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_ENABLE, ProcedureEnable); diff --git a/core/events/events_procedure_parameter_base.ts b/core/events/events_procedure_parameter_base.ts deleted file mode 100644 index f03094d25..000000000 --- a/core/events/events_procedure_parameter_base.ts +++ /dev/null @@ -1,44 +0,0 @@ - -/** - * @license - * Copyright 2022 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 {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; - -import type {Workspace} from '../workspace.js'; - -/** - * The base event for an event associated with a procedure parameter. - */ -export abstract class ProcedureParameterBase extends ProcedureBase { - /** - * @param workspace The workspace the parameter model exists in. - * @param model The procedure model the parameter model belongs to. - * @param parameter The parameter model associated with this event. - */ - constructor( - workspace: Workspace, model: IProcedureModel, - public readonly parameter: IParameterModel) { - super(workspace, model); - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureParameterBaseJson { - const json = super.toJson() as ProcedureParameterBaseJson; - json['parameterId'] = this.model.getId(); - return json; - } -} - -export interface ProcedureParameterBaseJson extends ProcedureBaseJson { - parameterId: string, -} diff --git a/core/events/events_procedure_parameter_create.ts b/core/events/events_procedure_parameter_create.ts deleted file mode 100644 index 8fae7b9ae..000000000 --- a/core/events/events_procedure_parameter_create.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @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 {ObservableParameterModel} from '../procedures/observable_parameter_model.js'; -import * as registry from '../registry.js'; -import {loadParameter, ParameterState, saveParameter} from '../serialization/procedures.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureParameterBase, ProcedureParameterBaseJson} from './events_procedure_parameter_base.js'; -import * as eventUtils from './utils.js'; - - -/** - * Notifies listeners that a parameter has been added to a procedure model. - */ -export class ProcedureParameterCreate extends ProcedureParameterBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_PARAMETER_CREATE; - - /** - * @param parameter The parameter model that was just added to the procedure. - * @param index The index the parameter was inserted at. - */ - constructor( - workspace: Workspace, procedure: IProcedureModel, - parameter: IParameterModel, public readonly index: number) { - super(workspace, procedure, parameter); - } - - run(forward: boolean) { - const workspace = this.getEventWorkspace_(); - const procedureMap = workspace.getProcedureMap(); - const procedureModel = procedureMap.get(this.model.getId()); - if (!procedureModel) { - throw new Error( - 'Cannot add a parameter to a procedure that does not exist ' + - 'in the procedure map'); - } - const parameterModel = procedureModel.getParameter(this.index); - if (forward) { - if (this.parameterMatches(parameterModel)) return; - // TODO: This should just add the parameter instead of creating a dupe. - procedureModel.insertParameter( - new ObservableParameterModel( - workspace, this.parameter.getName(), this.parameter.getId()), - this.index); - } else { - if (!this.parameterMatches(parameterModel)) return; - procedureModel.deleteParameter(this.index); - } - } - - parameterMatches(param: IParameterModel) { - return param && param.getId() === this.parameter.getId(); - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureParameterCreateJson { - const json = super.toJson() as ProcedureParameterCreateJson; - json['parameter'] = saveParameter(this.parameter); - json['index'] = this.index; - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureParameterCreateJson, workspace: Workspace): - ProcedureParameterCreate { - const procedure = workspace.getProcedureMap().get(json['procedureId']); - if (!procedure) { - throw new Error( - 'Cannot deserialize parameter create event because the ' + - 'target procedure does not exist'); - } - return new ProcedureParameterCreate( - workspace, procedure, - loadParameter(ObservableParameterModel, json['parameter'], workspace), - json['index']); - } -} - -export interface ProcedureParameterCreateJson extends - ProcedureParameterBaseJson { - parameter: ParameterState, index: number, -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_PARAMETER_CREATE, - ProcedureParameterCreate); diff --git a/core/events/events_procedure_parameter_delete.ts b/core/events/events_procedure_parameter_delete.ts deleted file mode 100644 index aa479a37d..000000000 --- a/core/events/events_procedure_parameter_delete.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @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 {ObservableParameterModel} from '../procedures/observable_parameter_model.js'; -import * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureParameterBase, ProcedureParameterBaseJson} from './events_procedure_parameter_base.js'; -import * as eventUtils from './utils.js'; - -/** - * Notifies listeners that a parameter has been removed from a procedure. - */ -export class ProcedureParameterDelete extends ProcedureParameterBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_PARAMETER_DELETE; - - /** - * @param parameter The parameter model that was just removed from the - * procedure. - * @param index The index the parameter was at before it was removed. - */ - constructor( - workspace: Workspace, procedure: IProcedureModel, - parameter: IParameterModel, public readonly index: number) { - super(workspace, procedure, parameter); - } - - run(forward: boolean) { - const workspace = this.getEventWorkspace_(); - const procedureMap = workspace.getProcedureMap(); - const procedureModel = procedureMap.get(this.model.getId()); - if (!procedureModel) { - throw new Error( - 'Cannot add a parameter to a procedure that does not exist ' + - 'in the procedure map'); - } - const parameterModel = procedureModel.getParameter(this.index); - if (forward) { - if (!this.parameterMatches(parameterModel)) return; - procedureModel.deleteParameter(this.index); - } else { - if (this.parameterMatches(parameterModel)) return; - // TODO: this should just insert the model instead of creating a dupe. - procedureModel.insertParameter( - new ObservableParameterModel( - workspace, this.parameter.getName(), this.parameter.getId()), - this.index); - } - } - - parameterMatches(param: IParameterModel) { - return param && param.getId() === this.parameter.getId(); - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureParameterDeleteJson { - const json = super.toJson() as ProcedureParameterDeleteJson; - json['index'] = this.index; - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureParameterDeleteJson, workspace: Workspace): - ProcedureParameterDelete { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure delete event because the ' + - 'target procedure does not exist'); - } - const param = model.getParameter(json['index']); - return new ProcedureParameterDelete(workspace, model, param, json['index']); - } -} - -export interface ProcedureParameterDeleteJson extends - ProcedureParameterBaseJson { - index: number; -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_PARAMETER_DELETE, - ProcedureParameterDelete); diff --git a/core/events/events_procedure_parameter_rename.ts b/core/events/events_procedure_parameter_rename.ts deleted file mode 100644 index 3b0aa71f6..000000000 --- a/core/events/events_procedure_parameter_rename.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @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 * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureParameterBase, ProcedureParameterBaseJson} from './events_procedure_parameter_base.js'; -import * as eventUtils from './utils.js'; - -/** - * Notifies listeners that a procedure parameter was renamed. - */ -export class ProcedureParameterRename extends ProcedureParameterBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_PARAMETER_RENAME; - - /** The new name of the procedure parameter. */ - private readonly newName: string; - - /** @param oldName The old name of the procedure parameter. */ - constructor( - workspace: Workspace, procedure: IProcedureModel, - parameter: IParameterModel, public readonly oldName: string) { - super(workspace, procedure, parameter); - - this.newName = parameter.getName(); - } - - run(forward: boolean) { - const parameterModel = findMatchingParameter( - this.getEventWorkspace_(), this.model.getId(), this.parameter.getId()); - if (!parameterModel) { - throw new Error( - 'Cannot rename a parameter that does not exist ' + - 'in the procedure map'); - } - if (forward) { - parameterModel.setName(this.newName); - } else { - parameterModel.setName(this.oldName); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureParameterRenameJson { - const json = super.toJson() as ProcedureParameterRenameJson; - json['oldName'] = this.oldName; - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureParameterRenameJson, workspace: Workspace): - ProcedureParameterRename { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure delete event because the ' + - 'target procedure does not exist'); - } - const param = findMatchingParameter( - workspace, json['procedureId'], json['parameterId']); - if (!param) { - throw new Error( - 'Cannot deserialize parameter rename event because the ' + - 'target parameter does not exist'); - } - return new ProcedureParameterRename( - workspace, model, param, json['oldName']); - } -} - -function findMatchingParameter( - workspace: Workspace, modelId: string, paramId: string): IParameterModel| - undefined { - const procedureModel = workspace.getProcedureMap().get(modelId); - if (!procedureModel) { - throw new Error( - 'Cannot rename the parameter of a procedure that does not exist ' + - 'in the procedure map'); - } - return procedureModel.getParameters().find((p) => p.getId() === paramId); -} - - -export interface ProcedureParameterRenameJson extends - ProcedureParameterBaseJson { - oldName: string; -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_PARAMETER_RENAME, - ProcedureParameterRename); diff --git a/core/events/events_procedure_rename.ts b/core/events/events_procedure_rename.ts deleted file mode 100644 index 80217d10b..000000000 --- a/core/events/events_procedure_rename.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import * as registry from '../registry.js'; -import type {Workspace} from '../workspace.js'; - -import {ProcedureBase, ProcedureBaseJson} from './events_procedure_base.js'; -import * as eventUtils from './utils.js'; - -/** Notifies listeners that a procedure model has been renamed. */ -export class ProcedureRename extends ProcedureBase { - /** A string used to check the type of the event. */ - type = eventUtils.PROCEDURE_RENAME; - - private newName: string; - - /** @param oldName The old name of the procedure model. */ - constructor( - workspace: Workspace, model: IProcedureModel, - public readonly oldName: string) { - super(workspace, model); - - this.newName = model.getName(); - } - - run(forward: boolean) { - const procedureModel = - this.getEventWorkspace_().getProcedureMap().get(this.model.getId()); - if (!procedureModel) { - throw new Error( - 'Cannot change the type of a procedure that does not exist ' + - 'in the procedure map'); - } - if (forward) { - procedureModel.setName(this.newName); - } else { - procedureModel.setName(this.oldName); - } - } - - /** - * Encode the event as JSON. - * - * @returns JSON representation. - */ - toJson(): ProcedureRenameJson { - const json = super.toJson() as ProcedureRenameJson; - json['oldName'] = this.oldName; - return json; - } - - /** - * Deserializes the JSON event. - * - * @internal - */ - static fromJson(json: ProcedureRenameJson, workspace: Workspace): - ProcedureRename { - const model = workspace.getProcedureMap().get(json['procedureId']); - if (!model) { - throw new Error( - 'Cannot deserialize procedure rename event because the ' + - 'target procedure does not exist'); - } - return new ProcedureRename(workspace, model, json['oldName']); - } -} - -export interface ProcedureRenameJson extends ProcedureBaseJson { - oldName: string; -} - -registry.register( - registry.Type.EVENT, eventUtils.PROCEDURE_RENAME, ProcedureRename); diff --git a/core/events/utils.ts b/core/events/utils.ts index 9ac08b9fc..60b9c155f 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -240,30 +240,6 @@ export const COMMENT_MOVE = 'comment_move'; */ export const FINISHED_LOADING = 'finished_loading'; -/** Name of event that creates a procedure model. */ -export const PROCEDURE_CREATE = 'procedure_create'; - -/** Name of event that deletes a procedure model. */ -export const PROCEDURE_DELETE = 'procedure_delete'; - -/** Name of event that renames a procedure model. */ -export const PROCEDURE_RENAME = 'procedure_rename'; - -/** Name of event that enables/disables a procedure model. */ -export const PROCEDURE_ENABLE = 'procedure_enable'; - -/** Name of event that changes the returntype of a procedure model. */ -export const PROCEDURE_CHANGE_RETURN = 'procedure_change_return'; - -/** Name of event that creates a procedure parameter. */ -export const PROCEDURE_PARAMETER_CREATE = 'procedure_parameter_create'; - -/** Name of event that deletes a procedure parameter. */ -export const PROCEDURE_PARAMETER_DELETE = 'procedure_parameter_delete'; - -/** Name of event that renames a procedure parameter. */ -export const PROCEDURE_PARAMETER_RENAME = 'procedure_parameter_rename'; - /** * Type of events that cause objects to be bumped back into the visible * portion of the workspace. diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index e5adb53ba..1f973b007 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -38,11 +38,6 @@ export class ObservableParameterModel implements IParameterModel { this.variable = this.workspace.getVariable(name) ?? this.workspace.createVariable(name); triggerProceduresUpdate(this.workspace); - if (this.shouldFireEvents) { - eventUtils.fire( - new (eventUtils.get(eventUtils.PROCEDURE_PARAMETER_RENAME))( - this.workspace, this.procedureModel, this, oldName)); - } return this; } diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index 2f0b0f0a6..5bffb8bbf 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -24,8 +24,6 @@ export class ObservableProcedureMap extends override set(id: string, proc: IProcedureModel): this { if (this.get(id) === proc) return this; super.set(id, proc); - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_CREATE))( - this.workspace, proc)); if (isObservable(proc)) proc.startPublishing(); return this; } @@ -39,8 +37,6 @@ export class ObservableProcedureMap extends const existed = super.delete(id); if (!existed) return existed; triggerProceduresUpdate(this.workspace); - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_DELETE))( - this.workspace, proc)); if (isObservable(proc)) proc.stopPublishing(); return existed; } @@ -53,8 +49,6 @@ export class ObservableProcedureMap extends for (const id of this.keys()) { const proc = this.get(id); super.delete(id); - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_DELETE))( - this.workspace, proc)); } triggerProceduresUpdate(this.workspace); } diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts index 588f771e3..fbbce53bf 100644 --- a/core/procedures/observable_procedure_model.ts +++ b/core/procedures/observable_procedure_model.ts @@ -36,10 +36,6 @@ export class ObservableProcedureModel implements IProcedureModel { const prevName = this.name; this.name = name; if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - if (this.shouldFireEvents) { - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_RENAME))( - this.workspace, this, prevName)); - } return this; } @@ -65,11 +61,6 @@ export class ObservableProcedureModel implements IProcedureModel { } if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - if (this.shouldFireEvents) { - eventUtils.fire( - new (eventUtils.get(eventUtils.PROCEDURE_PARAMETER_CREATE))( - this.workspace, this, parameterModel, index)); - } return this; } @@ -83,12 +74,6 @@ export class ObservableProcedureModel implements IProcedureModel { if (isObservable(oldParam)) { oldParam.stopPublishing(); } - - if (this.shouldFireEvents) { - eventUtils.fire( - new (eventUtils.get(eventUtils.PROCEDURE_PARAMETER_DELETE))( - this.workspace, this, oldParam, index)); - } return this; } @@ -112,10 +97,6 @@ export class ObservableProcedureModel implements IProcedureModel { const oldReturnTypes = this.returnTypes; this.returnTypes = types; if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - if (this.shouldFireEvents) { - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_CHANGE_RETURN))( - this.workspace, this, oldReturnTypes)); - } return this; } @@ -127,10 +108,6 @@ export class ObservableProcedureModel implements IProcedureModel { if (enabled === this.enabled) return this; this.enabled = enabled; if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - if (this.shouldFireEvents) { - eventUtils.fire(new (eventUtils.get(eventUtils.PROCEDURE_ENABLE))( - this.workspace, this)); - } return this; } diff --git a/tests/mocha/event_procedure_change_return_test.js b/tests/mocha/event_procedure_change_return_test.js deleted file mode 100644 index 5ec80cdda..000000000 --- a/tests/mocha/event_procedure_change_return_test.js +++ /dev/null @@ -1,198 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureChangeReturn'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Change Return Event', function() { - const DEFAULT_TYPES = null; - const NON_DEFAULT_TYPES = []; - - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', id); - }; - - this.createEventToState = (procedureModel) => { - const event = new Blockly.Events.ProcedureChangeReturn( - this.workspace, - procedureModel, - procedureModel.getReturnTypes() === DEFAULT_TYPES ? - NON_DEFAULT_TYPES : - DEFAULT_TYPES); - return event; - }; - }); - - suite('forward (redo)', function() { - test('the procedure with the matching ID has its return set', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - event.run(/* forward= */ true); - - chai.assert.equal( - initial.getReturnTypes(), - final.getReturnTypes(), - "Expected the procedure's return type to be toggled"); - }); - - test('changing the return fires a change return event', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - { - model: initial, - oldTypes: DEFAULT_TYPES, - }, - this.workspace.id); - }); - - test('noop return changes do not fire change return events', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - {}, - this.workspace.id); - }); - - test( - 'attempting to change the return of a procedure that ' + - 'does not exist in the map throws', - function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - const event = this.createEventToState(final); - - chai.assert.throws(() => { - event.run(/* forward= */ true); - }); - }); - }); - - suite('backward (undo)', function() { - test('the procedure with the matching ID has its return set', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setReturnTypes(NON_DEFAULT_TYPES); - undoable.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - event.run(/* forward= */ false); - - chai.assert.equal( - initial.getReturnTypes(), - DEFAULT_TYPES, - "Expected the procedure's return type to be toggled"); - }); - - test('changing the return fires a change return event', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setReturnTypes(NON_DEFAULT_TYPES); - undoable.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - { - model: initial, - oldTypes: NON_DEFAULT_TYPES, - }, - this.workspace.id); - }); - - test('noop return changes do not fire change return events', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - undoable.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - {}, - this.workspace.id); - }); - - test( - 'attempting to change the return of a procedure that ' + - 'does not exist throws', - function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setReturnTypes(NON_DEFAULT_TYPES); - undoable.setReturnTypes(NON_DEFAULT_TYPES); - const event = this.createEventToState(undoable); - - chai.assert.throws(() => { - event.run(/* forward= */ false); - }); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const model = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureChangeReturn( - this.workspace, model, NON_DEFAULT_TYPES); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_create_test.js b/tests/mocha/event_procedure_create_test.js deleted file mode 100644 index 1432ae3bc..000000000 --- a/tests/mocha/event_procedure_create_test.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureCreate'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Create Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (name, id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, name, id); - }; - - this.createEventToState = (procedureModel) => { - return new Blockly.Events.ProcedureCreate(this.workspace, procedureModel); - }; - }); - - suite('forward', function() { - test('a procedure model is created if it does not exist', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - event.run(/* forward= */ true); - - const createdProc = this.procedureMap.get('test id'); - chai.assert.isDefined(createdProc, 'Expected the procedure to exist'); - chai.assert.equal( - createdProc.getName(), - model.getName(), - "Expected the procedure's name to match the model"); - chai.assert.equal( - createdProc.getId(), - model.getId(), - "Expected the procedure's id to match the model"); - }); - - test('creating a procedure model fires a create event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {model: this.procedureMap.get('test id')}, - this.workspace.id); - }); - - test( - 'a procedure model is not created if a model with a ' + - 'matching ID exists', - function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - event.run(/* forward= */ true); - - chai.assert.equal( - this.procedureMap.get('test id'), - model, - 'Expected the model in the procedure map to be the same ' + - 'as the original model'); - }); - - test('not creating a model does not fire a create event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {}, - this.workspace.id); - }); - }); - - suite('backward', function() { - test( - 'a procedure model is deleted if a model with a matching ID exists', - function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - event.run(/* forward= */ false); - - chai.assert.isUndefined( - this.procedureMap.get('test id'), - 'Expected the procedure to be deleted'); - }); - - test('deleting a model fires a delete event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model}, - this.workspace.id); - }); - - test('not deleting a model does not fire a delete event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {}, - this.workspace.id); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const model = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - const origEvent = new Blockly.Events.ProcedureCreate(this.workspace, model); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_delete_test.js b/tests/mocha/event_procedure_delete_test.js deleted file mode 100644 index aa45b3e7f..000000000 --- a/tests/mocha/event_procedure_delete_test.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureDelete'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Delete Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (name, id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, name, id); - }; - - this.createEventToState = (procedureModel) => { - return new Blockly.Events.ProcedureDelete(this.workspace, procedureModel); - }; - }); - - suite('forward', function() { - test( - 'a procedure model is deleted if a model with a matching ID exists', - function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - event.run(/* forward= */ true); - - chai.assert.isUndefined( - this.procedureMap.get('test id'), - 'Expected the procedure to be deleted'); - }); - - test('deleting a model fires a delete event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model}, - this.workspace.id); - }); - - test('not deleting a model does not fire a delete event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {}, - this.workspace.id); - }); - }); - - suite('backward', function() { - test('a procedure model is created if it does not exist', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - event.run(/* forward= */ false); - - const createdProc = this.procedureMap.get('test id'); - chai.assert.isDefined(createdProc, 'Expected the procedure to exist'); - chai.assert.equal( - createdProc.getName(), - model.getName(), - "Expected the procedure's name to match the model"); - chai.assert.equal( - createdProc.getId(), - model.getId(), - "Expected the procedure's id to match the model"); - }); - - test('creating a procedure model fires a create event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {model: this.procedureMap.get('test id')}, - this.workspace.id); - }); - - test( - 'a procedure model is not created if a model with a ' + - 'matching ID exists', - function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - event.run(/* forward= */ false); - - chai.assert.equal( - this.procedureMap.get('test id'), - model, - 'Expected the model in the procedure map to be the same ' + - 'as the original model'); - }); - - test('not creating a model does not fire a create event', function() { - const model = this.createProcedureModel('test name', 'test id'); - const event = this.createEventToState(model); - this.procedureMap.add(model); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {}, - this.workspace.id); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const model = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureDelete(this.workspace, model); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_enable_test.js b/tests/mocha/event_procedure_enable_test.js deleted file mode 100644 index 8e34565c8..000000000 --- a/tests/mocha/event_procedure_enable_test.js +++ /dev/null @@ -1,188 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureEnable'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Enable Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', id); - }; - - this.createEventToState = (procedureModel) => { - return new Blockly.Events.ProcedureEnable(this.workspace, procedureModel); - }; - }); - - suite('forward', function() { - test('the procedure with the matching ID is toggled', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setEnabled(!final.getEnabled()); // Set it to the non-default. - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - event.run(/* forward= */ true); - - chai.assert.equal( - initial.getEnabled(), - final.getEnabled(), - "Expected the procedure's enabled state to be flipped"); - }); - - test('toggling a procedure fires an enable event', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setEnabled(!final.getEnabled()); // Set it to the non-default. - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {model: initial}, - this.workspace.id); - }); - - test('noop toggles do not fire enable events', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureEnable, - this.workspace.id); - }); - - test( - 'attempting to toggle a procedure that does not exist throws', - function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setEnabled(!final.getEnabled()); // Set it to the non-default. - const event = this.createEventToState(final); - - chai.assert.throws(() => { - event.run(/* forward= */ true); - }); - }); - }); - - suite('backward', function() { - test('the procedure with the matching ID is toggled', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - // Set them to be non-default. - const defaultEnabled = initial.getEnabled(); - initial.setEnabled(!defaultEnabled); - undoable.setEnabled(!defaultEnabled); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - event.run(/* forward= */ false); - - chai.assert.equal( - initial.getEnabled(), - defaultEnabled, - "Expected the procedure's enabled state to be flipped"); - }); - - test('toggling a procedure fires an enable event', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - // Set them to be non-default. - const defaultEnabled = initial.getEnabled(); - initial.setEnabled(!defaultEnabled); - undoable.setEnabled(!defaultEnabled); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {model: initial}, - this.workspace.id); - }); - - test('noop toggles do not fire enable events', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - // Set them to be non-default. - const defaultEnabled = initial.getEnabled(); - undoable.setEnabled(!defaultEnabled); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {}, - this.workspace.id); - }); - - test( - 'attempting to toggle a procedure that does not exist throws', - function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - // Set them to be non-default. - const defaultEnabled = initial.getEnabled(); - initial.setEnabled(!defaultEnabled); - undoable.setEnabled(!defaultEnabled); - const event = this.createEventToState(undoable); - - chai.assert.throws(() => { - event.run(/* forward= */ false); - }); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const model = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureEnable(this.workspace, model); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_parameter_create_test.js b/tests/mocha/event_procedure_parameter_create_test.js deleted file mode 100644 index 2be5c7dcb..000000000 --- a/tests/mocha/event_procedure_parameter_create_test.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureParameterCreate'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Parameter Create Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (name, id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, name, id); - }; - - this.createProcedureAndParameter = - (procName, procId, paramName, paramId) => { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, paramName, paramId); - const proc = new Blockly.procedures.ObservableProcedureModel( - this.workspace, procName, procId) - .insertParameter(param, 0); - return {param, proc}; - }; - - this.createEventToState = (procedureModel, parameterModel) => { - return new Blockly.Events.ProcedureParameterCreate( - this.workspace, procedureModel, parameterModel, 0); - }; - }); - - suite('forward', function() { - test('a parameter is inserted if it does not exist', function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - const actualProc = this.createProcedureModel('test name', 'test id'); - this.procedureMap.add(actualProc); - - event.run(/* forward= */ true); - - const createdParam = actualProc.getParameter(0); - chai.assert.isDefined(createdParam, 'Expected the parameter to exist'); - chai.assert.equal( - createdParam.getName(), - modelParam.getName(), - "Expected the parameter's name to match the model"); - chai.assert.equal( - createdParam.getId(), - modelParam.getId(), - "Expected the parameter's id to match the model"); - }); - - test('inserting a parameter fires a create event', function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - const actualProc = this.createProcedureModel('test name', 'test id'); - this.procedureMap.add(actualProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - { - model: actualProc, - parameter: actualProc.getParameter(0), - index: 0, - }, - this.workspace.id); - }); - - test( - 'a parameter is not created if a parameter with a ' + - 'matching ID and index already exists', - function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - this.procedureMap.add(modelProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - const actualProc = this.procedureMap.get('test id'); - chai.assert.equal( - actualProc, - modelProc, - 'Expected the procedure in the procedure map to not have changed'); - chai.assert.equal( - actualProc.getParameter(0), - modelParam, - 'Expected the parameter to not have changed'); - }); - - test( - 'not creating a parameter model does not fire a create event', - function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - this.procedureMap.add(modelProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - {}, - this.workspace.id); - }); - }); - - suite('backward', function() { - test('a parameter is removed if it exists', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - - event.run(/* forward= */ false); - - chai.assert.isUndefined( - proc.getParameter(0), - 'Expected the parameter to be deleted'); - }); - - test('removing a parameter fires a delete event', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - { - model: proc, - parameter: param, - index: 0, - }, - this.workspace.id); - }); - - test( - 'a parameter is not deleted if a parameter with a ' + - 'matching ID and index does not exist', - function() { - // TODO: Figure out what we want to do in this case. - }); - - test('not removing a parameter does not fire a delete event', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - proc.deleteParameter(0); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - {}, - this.workspace.id); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test param name', 'test param id'); - const model = - new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureParameterCreate( - this.workspace, model, param, 0); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_parameter_delete_test.js b/tests/mocha/event_procedure_parameter_delete_test.js deleted file mode 100644 index e98850dfc..000000000 --- a/tests/mocha/event_procedure_parameter_delete_test.js +++ /dev/null @@ -1,218 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureParameterDelete'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Parameter Delete Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (name, id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, name, id); - }; - - this.createProcedureAndParameter = - (procName, procId, paramName, paramId) => { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, procName, paramId); - const proc = new Blockly.procedures.ObservableProcedureModel( - this.workspace, paramName, procId) - .insertParameter(param, 0); - return {param, proc}; - }; - - this.createEventToState = (procedureModel, parameterModel) => { - return new Blockly.Events.ProcedureParameterDelete( - this.workspace, procedureModel, parameterModel, 0); - }; - }); - - suite('forward', function() { - test('a parameter is removed if it exists', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - - event.run(/* forward= */ true); - - chai.assert.isUndefined( - proc.getParameter(0), - 'Expected the parameter to be deleted'); - }); - - test('removing a parameter fires a delete event', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - { - model: proc, - parameter: param, - index: 0, - }, - this.workspace.id); - }); - - test( - 'a parameter is not deleted if a parameter with a ' + - 'matching ID and index does not exist', - function() { - // TODO: Figure out what we want to do in this case. - }); - - test('not removing a parameter does not fire a delete event', function() { - const {param, proc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(proc, param); - this.procedureMap.add(proc); - proc.deleteParameter(0); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - {}, - this.workspace.id); - }); - }); - - suite('backward', function() { - test('a parameter is inserted if it does not exist', function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - const actualProc = this.createProcedureModel('test name', 'test id'); - this.procedureMap.add(actualProc); - - event.run(/* forward= */ false); - - const createdParam = actualProc.getParameter(0); - chai.assert.isDefined(createdParam, 'Expected the parameter to exist'); - chai.assert.equal( - createdParam.getName(), - modelParam.getName(), - "Expected the parameter's name to match the model"); - chai.assert.equal( - createdParam.getId(), - modelParam.getId(), - "Expected the parameter's id to match the model"); - }); - - test('inserting a parameter fires a create event', function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - const actualProc = this.createProcedureModel('test name', 'test id'); - this.procedureMap.add(actualProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - { - model: actualProc, - parameter: actualProc.getParameter(0), - index: 0, - }, - this.workspace.id); - }); - - test( - 'a parameter is not created if a parameter with a ' + - 'matching ID and index already exists', - function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - this.procedureMap.add(modelProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - const actualProc = this.procedureMap.get('test id'); - chai.assert.equal( - actualProc, - modelProc, - 'Expected the procedure in the procedure map to not have changed'); - chai.assert.equal( - actualProc.getParameter(0), - modelParam, - 'Expected the parameter to not have changed'); - }); - - test( - 'not creating a parameter model does not fire a create event', - function() { - const {param: modelParam, proc: modelProc} = - this.createProcedureAndParameter( - 'test name', 'test id', 'test param name', 'test param id'); - const event = this.createEventToState(modelProc, modelParam); - this.procedureMap.add(modelProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - {}, - this.workspace.id); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test param name', 'test param id'); - const model = - new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id') - .insertParameter(param, 0); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureParameterDelete( - this.workspace, model); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_parameter_rename_test.js b/tests/mocha/event_procedure_parameter_rename_test.js deleted file mode 100644 index c88da7fb9..000000000 --- a/tests/mocha/event_procedure_parameter_rename_test.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureParameterRename'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Parameter Rename Event', function() { - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - const DEFAULT_NAME = 'default'; - const NON_DEFAULT_NAME = 'non-default'; - - setup(function() { - this.createProcedureAndParameter = (procId, paramId) => { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, DEFAULT_NAME, paramId); - const proc = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', procId) - .insertParameter(param, 0); - return {param, proc}; - }; - - this.createEventToState = (procedureModel, parameterModel) => { - return new Blockly.Events.ProcedureParameterRename( - this.workspace, - procedureModel, - parameterModel, - parameterModel.getName() === DEFAULT_NAME ? - NON_DEFAULT_NAME : - DEFAULT_NAME); - }; - }); - - suite('forward', function() { - test('the parameter with the matching ID and index is renamed', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: finalParam, proc: finalProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - finalParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(finalProc, finalParam); - this.procedureMap.add(initialProc); - - event.run(/* forward= */ true); - - chai.assert.equal( - initialParam.getName(), - finalParam.getName(), - "Expected the procedure parameter's name to be changed"); - }); - - test('renaming a parameter fires a rename event', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: finalParam, proc: finalProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - finalParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(finalProc, finalParam); - this.procedureMap.add(initialProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - { - model: initialProc, - parameter: initialParam, - oldName: DEFAULT_NAME, - }, - this.workspace.id); - }); - - test('noop renames do not fire rename events', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: finalParam, proc: finalProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const event = this.createEventToState(finalProc, finalParam); - this.procedureMap.add(initialProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - {}, - this.workspace.id); - }); - - test( - 'attempting to rename a parameter that does not exist throws', - function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: finalParam, proc: finalProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - finalParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(finalProc, finalParam); - - chai.assert.throws(() => { - event.run(/* forward= */ true); - }); - }); - }); - - suite('backward', function() { - test('the parameter with the matching ID and index is renamed', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: undoableParam, proc: undoableProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - initialParam.setName(NON_DEFAULT_NAME); - undoableParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoableProc, undoableParam); - this.procedureMap.add(initialProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - chai.assert.equal( - initialParam.getName(), - DEFAULT_NAME, - "Expected the procedure parameter's name to be changed"); - }); - - test('renaming a parameter fires a rename event', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: undoableParam, proc: undoableProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - initialParam.setName(NON_DEFAULT_NAME); - undoableParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoableProc, undoableParam); - this.procedureMap.add(initialProc); - - this.eventSpy.resetHistory(); - event.run(/* forward= */ false); - - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - { - model: initialProc, - parameter: initialParam, - oldName: NON_DEFAULT_NAME, - }, - this.workspace.id); - }); - - test('noop renames do not fire rename events', function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: undoableParam, proc: undoableProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - undoableParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoableProc, undoableParam); - this.procedureMap.add(initialProc); - - event.run(/* forward= */ false); - - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - {}, - this.workspace.id); - }); - - test( - 'attempting to rename a parameter that does not exist throws', - function() { - const {param: initialParam, proc: initialProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - const {param: undoableParam, proc: undoableProc} = - this.createProcedureAndParameter('test procId', 'test paramId'); - initialParam.setName(NON_DEFAULT_NAME); - undoableParam.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoableProc, undoableParam); - - chai.assert.throws(() => { - event.run(/* forward= */ false); - }); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const param = new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test param name', 'test param id'); - const model = - new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id') - .insertParameter(param, 0); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureParameterDelete( - this.workspace, model); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/event_procedure_rename_test.js b/tests/mocha/event_procedure_rename_test.js deleted file mode 100644 index 9514cb443..000000000 --- a/tests/mocha/event_procedure_rename_test.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -goog.declareModuleId('Blockly.test.eventProcedureRename'); - -import {assertEventFiredShallow, assertEventNotFired, createChangeListenerSpy} from './test_helpers/events.js'; -import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; - - -suite('Procedure Rename Event', function() { - const DEFAULT_NAME = 'default'; - const NON_DEFAULT_NAME = 'non-default'; - - setup(function() { - sharedTestSetup.call(this); - this.workspace = new Blockly.Workspace(); - this.procedureMap = this.workspace.getProcedureMap(); - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - sharedTestTeardown.call(this); - }); - - suite('running', function() { - setup(function() { - this.createProcedureModel = (id) => { - return new Blockly.procedures.ObservableProcedureModel( - this.workspace, DEFAULT_NAME, id); - }; - - this.createEventToState = (procedureModel) => { - return new Blockly.Events.ProcedureRename( - this.workspace, - procedureModel, - procedureModel.getName() === DEFAULT_NAME ? - NON_DEFAULT_NAME : - DEFAULT_NAME); - }; - }); - - suite('forward', function() { - test('the procedure with the matching ID is renamed', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - event.run(/* forward= */ true); - - chai.assert.equal( - initial.getName(), - final.getName(), - "Expected the procedure's name to be changed"); - }); - - test('renaming a procedure fires a rename event', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - event.run(/* forward= */ true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureRename, - {model: initial, oldName: DEFAULT_NAME}, - this.workspace.id); - }); - - test('noop renames do not fire rename events', function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - const event = this.createEventToState(final); - this.procedureMap.add(initial); - - event.run(/* forward= */ true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureRename, - {}, - this.workspace.id); - }); - - test( - 'attempting to rename a procedure that does not exist throws', - function() { - const initial = this.createProcedureModel('test id'); - const final = this.createProcedureModel('test id'); - final.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(final); - - chai.assert.throws(() => { - event.run(/* forward= */ true); - }); - }); - }); - - suite('backward', function() { - test('the procedure with the matching ID is renamed', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setName(NON_DEFAULT_NAME); - undoable.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - event.run(/* forward= */ false); - - chai.assert.equal( - initial.getName(), - DEFAULT_NAME, - "Expected the procedure's name to be changed"); - }); - - test('renaming a procedure fires a rename event', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setName(NON_DEFAULT_NAME); - undoable.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - event.run(/* forward= */ false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureRename, - {model: initial, oldName: NON_DEFAULT_NAME}, - this.workspace.id); - }); - - test('noop renames do not fire rename events', function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoable); - this.procedureMap.add(initial); - - event.run(/* forward= */ false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureRename, - {}, - this.workspace.id); - }); - - test( - 'attempting to rename a procedure that does not exist throws', - function() { - const initial = this.createProcedureModel('test id'); - const undoable = this.createProcedureModel('test id'); - initial.setName(NON_DEFAULT_NAME); - undoable.setName(NON_DEFAULT_NAME); - const event = this.createEventToState(undoable); - - chai.assert.throws(() => { - event.run(/* forward= */ false); - }); - }); - }); - }); - - suite('serialization', function() { - test('events round-trip through JSON', function() { - const model = new Blockly.procedures.ObservableProcedureModel( - this.workspace, 'test name', 'test id'); - this.procedureMap.add(model); - const origEvent = new Blockly.Events.ProcedureRename( - this.workspace, model, NON_DEFAULT_NAME); - - const json = origEvent.toJson(); - const newEvent = new Blockly.Events.fromJson(json, this.workspace); - - chai.assert.deepEqual(newEvent, origEvent); - }); - }); -}); diff --git a/tests/mocha/index.html b/tests/mocha/index.html index 7dcc92e42..d1359e907 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -73,14 +73,6 @@ 'Blockly.test.eventCommentDelete', 'Blockly.test.eventCommentMove', 'Blockly.test.eventMarkerMove', - 'Blockly.test.eventProcedureCreate', - 'Blockly.test.eventProcedureDelete', - 'Blockly.test.eventProcedureRename', - 'Blockly.test.eventProcedureEnable', - 'Blockly.test.eventProcedureChangeReturn', - 'Blockly.test.eventProcedureParameterCreate', - 'Blockly.test.eventProcedureParameterDelete', - 'Blockly.test.eventProcedureParameterRename', 'Blockly.test.eventSelected', 'Blockly.test.eventThemeChange', 'Blockly.test.eventToolboxItemSelect', diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index a1542fad9..ea36f4896 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -203,550 +203,6 @@ suite('Procedure Map', function() { }); }); - suite('event firing', function() { - setup(function() { - this.eventSpy = createChangeListenerSpy(this.workspace); - }); - - teardown(function() { - this.workspace.removeChangeListener(this.eventSpy); - }); - - suite('procedure create', function() { - test('create events are fired when a procedure is inserted', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.set(procedureModel.getId(), procedureModel); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {model: procedureModel}, - this.workspace.id); - }); - - test( - 'create events are not fired if a procedure is already inserted', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.set(procedureModel.getId(), procedureModel); - - this.eventSpy.resetHistory(); - this.procedureMap.set(procedureModel.getId(), procedureModel); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {}, - this.workspace.id); - }); - - test('create events are fired when a procedure is added', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {model: procedureModel}, - this.workspace.id); - }); - - test( - 'create events are not fired if a procedure is already added', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - - this.eventSpy.resetHistory(); - this.procedureMap.add(procedureModel); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureCreate, - {}, - this.workspace.id); - }); - }); - - suite('procedure delete', function() { - test('delete events are fired when a procedure is deleted', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - this.procedureMap.delete(procedureModel.getId()); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model: procedureModel}, - this.workspace.id); - }); - - test( - 'delete events are not fired if a procedure does not exist', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.delete(procedureModel.getId()); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {}, - this.workspace.id); - }); - - test( - 'delete events are fired when the procedure map is cleared', - function() { - const procedureModel1 = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - const procedureModel2 = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - const procedureModel3 = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel1); - this.procedureMap.add(procedureModel2); - this.procedureMap.add(procedureModel3); - this.procedureMap.clear(); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model: procedureModel1}, - this.workspace.id); - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model: procedureModel2}, - this.workspace.id); - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureDelete, - {model: procedureModel3}, - this.workspace.id); - }); - }); - - suite('procedure rename', function() { - test('rename events are fired when a procedure is renamed', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setName('test name'); - this.procedureMap.add(procedureModel); - procedureModel.setName('new name'); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureRename, - { - model: procedureModel, - oldName: 'test name', - }, - this.workspace.id); - }); - - test('rename events are not fired if the rename is noop', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setName('test name'); - this.procedureMap.add(procedureModel); - procedureModel.setName('test name'); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureRename, - {}, - this.workspace.id); - }); - - test( - 'rename events are not fired if the procedure is not in the map', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setName('test name'); - procedureModel.setName('new name'); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureRename, - {}, - this.workspace.id); - }); - }); - - suite('procedure enable', function() { - test('enable events are fired when a procedure is enabled', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setEnabled(false); - this.procedureMap.add(procedureModel); - procedureModel.setEnabled(true); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {model: procedureModel}, - this.workspace.id); - }); - - test('enable events are fired when a procedure is disabled', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - procedureModel.setEnabled(false); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {model: procedureModel}, - this.workspace.id); - }); - - test('enable events are not fired if enabling is noop', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - procedureModel.setEnabled(true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {}, - this.workspace.id); - }); - - test('enable events are not fired if disabling is noop', function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setEnabled(false); - this.procedureMap.add(procedureModel); - procedureModel.setEnabled(false); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {}, - this.workspace.id); - }); - - test( - 'enable events are not fired if the procedure is not in the map', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setEnabled(false); - procedureModel.setEnabled(true); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureEnable, - {}, - this.workspace.id); - }); - }); - - suite('parameter create', function() { - test( - 'parameter create events are fired when a parameter is inserted', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - procedureModel.insertParameter(parameterModel, 0); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - { - model: procedureModel, - parameter: parameterModel, - index: 0, - }, - this.workspace.id); - }); - - test( - 'parameter create events are not fired if the parameter is ' + - 'already inserted', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - procedureModel.insertParameter(parameterModel, 0); - - this.eventSpy.resetHistory(); - procedureModel.insertParameter(parameterModel, 0); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - {}, - this.workspace.id); - }); - - test( - 'parameter create events are not fired if the procedure is ' + - 'not in the map', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - procedureModel.insertParameter( - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'), - 0); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterCreate, - {}, - this.workspace.id); - }); - }); - - suite('parameter delete', function() { - test( - 'parameter delete events are fired when a parameter is deleted', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - procedureModel.insertParameter(parameterModel, 0); - procedureModel.deleteParameter(0); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - { - model: procedureModel, - parameter: parameterModel, - index: 0, - }, - this.workspace.id); - }); - - test( - 'parameter delete events are not fired if the parameter does not exist', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - procedureModel.deleteParameter(0); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - {}, - this.workspace.id); - }); - - test( - 'parameter delete events are not fired if the procedure is ' + - 'not in the map', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .insertParameter( - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'), - 0); - procedureModel.deleteParameter(0); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterDelete, - {}, - this.workspace.id); - }); - }); - - suite('parameter rename', function() { - test( - 'parameter rename events are fired when a parameter is renamed', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - procedureModel.insertParameter(parameterModel, 0); - - parameterModel.setName('new name'); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - { - model: procedureModel, - parameter: parameterModel, - oldName: 'test name', - }, - this.workspace.id); - }); - - test( - 'parameter rename events are not fired if the rename is noop', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace); - this.procedureMap.add(procedureModel); - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - procedureModel.insertParameter(parameterModel, 0); - - parameterModel.setName('test name'); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - {}, - this.workspace.id); - }); - - test( - 'parameter rename events are not fired if the procedure is ' + - 'not in the map', - function() { - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .insertParameter(parameterModel, 0); - - parameterModel.setName('new name'); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - {}, - this.workspace.id); - }); - - test( - 'parameter rename events are not fired if the parameter is ' + - 'not in a procedure', - function() { - const parameterModel = - new Blockly.procedures.ObservableParameterModel( - this.workspace, 'test name'); - - parameterModel.setName('new name'); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureParameterRename, - {}, - this.workspace.id); - }); - }); - - suite('procedure change return', function() { - test( - 'return type change events are fired when the return is added', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(null); - this.procedureMap.add(procedureModel); - procedureModel.setReturnTypes([]); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - { - model: procedureModel, - oldTypes: null, - }, - this.workspace.id); - }); - - test( - 'return type change events are fired when the return is removed', - function() { - const types = []; - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(types); - this.procedureMap.add(procedureModel); - procedureModel.setReturnTypes(null); - - assertEventFiredShallow( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - { - model: procedureModel, - oldTypes: types, - }, - this.workspace.id); - }); - - test( - 'return type change events are not fired if adding is noop', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes([]); - this.procedureMap.add(procedureModel); - procedureModel.setReturnTypes([]); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - {}, - this.workspace.id); - }); - - test( - 'return type change events are not fired if removing is noop', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(null); - this.procedureMap.add(procedureModel); - procedureModel.setReturnTypes(null); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - {}, - this.workspace.id); - }); - - test( - 'return type change events are not fired if the procedure is ' + - 'not in the map', - function() { - const procedureModel = - new Blockly.procedures.ObservableProcedureModel(this.workspace) - .setReturnTypes(null); - - procedureModel.setReturnTypes([]); - - assertEventNotFired( - this.eventSpy, - Blockly.Events.ProcedureChangeReturn, - {}, - this.workspace.id); - }); - }); - }); - suite('backing variable to parameters', function() { test( 'construction references an existing variable if available', From 5bbb39972ab1ac73886bec32a7a44e2018146507 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 26 Jan 2023 09:35:08 -0800 Subject: [PATCH 054/141] chore: delete procedure data models (#6796) * chore: delete procedure data models * chore: remove and fix procedure model related tests --- core/procedures.ts | 4 - core/procedures/observable_parameter_model.ts | 113 ---------- core/procedures/observable_procedure_model.ts | 195 ----------------- core/serialization/procedures.ts | 12 - tests/mocha/jso_serialization_test.js | 134 +++--------- tests/mocha/procedure_map_test.js | 205 +----------------- tests/mocha/test_helpers/procedures.js | 89 ++++++++ 7 files changed, 118 insertions(+), 634 deletions(-) delete mode 100644 core/procedures/observable_parameter_model.ts delete mode 100644 core/procedures/observable_procedure_model.ts diff --git a/core/procedures.ts b/core/procedures.ts index 3adcee5a6..8a976016f 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -30,8 +30,6 @@ import {IProcedureMap} from './interfaces/i_procedure_map.js'; import {IProcedureModel} from './interfaces/i_procedure_model.js'; import {IProcedureBlock, isProcedureBlock} from './interfaces/i_procedure_block.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 {triggerProceduresUpdate} from './procedures/update_procedures.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; @@ -502,8 +500,6 @@ export function getDefinition(name: string, workspace: Workspace): Block|null { export { ObservableProcedureMap, - ObservableProcedureModel, - ObservableParameterModel, triggerProceduresUpdate, IParameterModel, IProcedureBlock, diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts deleted file mode 100644 index 1f973b007..000000000 --- a/core/procedures/observable_parameter_model.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import * as eventUtils from '../events/utils.js'; -import {genUid} from '../utils/idgenerator.js'; -import type {IParameterModel} from '../interfaces/i_parameter_model.js'; -import type {IProcedureModel} from '../interfaces/i_procedure_model'; -import {triggerProceduresUpdate} from './update_procedures.js'; -import type {VariableModel} from '../variable_model.js'; -import type {Workspace} from '../workspace.js'; -import * as goog from '../../closure/goog/goog.js'; -goog.declareModuleId('Blockly.procedures.ObservableParameterModel'); - - -export class ObservableParameterModel implements IParameterModel { - private id: string; - private variable: VariableModel; - private shouldFireEvents = false; - private procedureModel: IProcedureModel|null = null; - - constructor( - private readonly workspace: Workspace, name: string, id?: string, - varId?: string) { - this.id = id ?? genUid(); - this.variable = this.workspace.getVariable(name) ?? - workspace.createVariable(name, '', varId); - } - - /** - * Sets the name of this parameter to the given name. - */ - setName(name: string): this { - if (name === this.variable.name) return this; - const oldName = this.variable.name; - this.variable = - this.workspace.getVariable(name) ?? this.workspace.createVariable(name); - triggerProceduresUpdate(this.workspace); - 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. - * - * @throws Throws for the ObservableParameterModel specifically because this - * method is unimplemented. - */ - setTypes(_types: string[]): this { - throw new Error( - 'The built-in ParameterModel does not support typing. You need to ' + - '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. - * - * 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; - } - - /** - * Tells the parameter model it should fire events. - * - * @internal - */ - startPublishing() { - this.shouldFireEvents = true; - } - - /** - * Tells the parameter model it should not fire events. - * - * @internal - */ - stopPublishing() { - this.shouldFireEvents = false; - } - - /** Sets the procedure model this parameter is a part of. */ - setProcedureModel(model: IProcedureModel): this { - // TODO: Not sure if we want to do this, or accept it via the constructor. - // That means it could be non-null, but it would also break the fluent - // API. - this.procedureModel = model; - return this; - } -} diff --git a/core/procedures/observable_procedure_model.ts b/core/procedures/observable_procedure_model.ts deleted file mode 100644 index fbbce53bf..000000000 --- a/core/procedures/observable_procedure_model.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import * as eventUtils from '../events/utils.js'; -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 {isObservable} from '../interfaces/i_observable.js'; -import {triggerProceduresUpdate} from './update_procedures.js'; -import type {Workspace} from '../workspace.js'; -import * as goog from '../../closure/goog/goog.js'; -goog.declareModuleId('Blockly.procedures.ObservableProcedureModel'); - - -export class ObservableProcedureModel implements IProcedureModel { - private id: string; - private name: string; - private parameters: IParameterModel[] = []; - private returnTypes: string[]|null = null; - private enabled = true; - private shouldFireEvents = false; - private shouldTriggerUpdates = true; - - constructor( - private readonly workspace: Workspace, name: string, id?: string) { - this.id = id ?? genUid(); - this.name = name; - } - - /** Sets the human-readable name of the procedure. */ - setName(name: string): this { - if (name === this.name) return this; - const prevName = this.name; - this.name = name; - if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - 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 { - if (this.parameters[index] && - this.parameters[index].getId() === parameterModel.getId()) { - return this; - } - - this.parameters.splice(index, 0, parameterModel); - parameterModel.setProcedureModel(this); - if (isObservable(parameterModel)) { - if (this.shouldFireEvents) { - parameterModel.startPublishing(); - } else { - parameterModel.stopPublishing(); - } - } - - if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - return this; - } - - /** Removes the parameter at the given index from the parameter list. */ - deleteParameter(index: number): this { - if (!this.parameters[index]) return this; - const oldParam = this.parameters[index]; - - this.parameters.splice(index, 1); - if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - if (isObservable(oldParam)) { - oldParam.stopPublishing(); - } - return this; - } - - /** - * Sets whether the procedure has a return value (empty array) or no return - * value (null). - * - * 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 { - if (types && types.length) { - throw new Error( - 'The built-in ProcedureModel does not support typing. You need to ' + - 'implement your own custom ProcedureModel.'); - } - // Either they're both an empty array, or both null. Noop either way. - if (!!types === !!this.returnTypes) return this; - const oldReturnTypes = this.returnTypes; - this.returnTypes = types; - if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - 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 { - if (enabled === this.enabled) return this; - this.enabled = enabled; - if (this.shouldTriggerUpdates) triggerProceduresUpdate(this.workspace); - return this; - } - - /** - * Disables triggering updates to procedure blocks until the endBulkUpdate - * is called. - * - * @internal - */ - startBulkUpdate() { - this.shouldTriggerUpdates = false; - } - - /** - * Triggers an update to procedure blocks. Should be used with - * startBulkUpdate. - * - * @internal - */ - endBulkUpdate() { - this.shouldTriggerUpdates = true; - triggerProceduresUpdate(this.workspace); - } - - /** 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; - } - - /** - * Tells the procedure model it should fire events. - * - * @internal - */ - startPublishing() { - this.shouldFireEvents = true; - for (const param of this.parameters) { - if (isObservable(param)) param.startPublishing(); - } - } - - /** - * Tells the procedure model it should not fire events. - * - * @internal - */ - stopPublishing() { - this.shouldFireEvents = false; - for (const param of this.parameters) { - if (isObservable(param)) param.stopPublishing(); - } - } -} diff --git a/core/serialization/procedures.ts b/core/serialization/procedures.ts index 8e18dda66..b29cd571d 100644 --- a/core/serialization/procedures.ts +++ b/core/serialization/procedures.ts @@ -7,10 +7,7 @@ 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'; @@ -163,12 +160,3 @@ export class ProcedureSerializer { - param.setTypes(['some', 'types']); - }, - 'The built-in ParameterModel does not support typing'); - }); }); }); diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index 74c8a7fd2..ec33e1aeb 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -148,3 +148,92 @@ export function createProcCallBlock( `` ), workspace); } + +export 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; + } +} + +export 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; + } +} From 75963ea58e65c6ef63eebeedfee99b59c14a3e0e Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 26 Jan 2023 09:54:49 -0800 Subject: [PATCH 055/141] chore: clean up leftover procedure-related things in core (#6797) * chore: remove triggering updates * chore: export isObservable * chore: move the observable procedure model out of its own directory --- core/blockly.ts | 2 + .../observable_procedure_map.ts | 18 ++---- core/procedures.ts | 4 +- core/procedures/update_procedures.ts | 26 --------- core/workspace.ts | 4 +- tests/mocha/procedure_map_test.js | 57 +++++++------------ tests/mocha/test_helpers/procedures.js | 4 ++ 7 files changed, 36 insertions(+), 79 deletions(-) rename core/{procedures => }/observable_procedure_map.ts (67%) delete mode 100644 core/procedures/update_procedures.ts diff --git a/core/blockly.ts b/core/blockly.ts index 81064ede5..c91d23294 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -98,6 +98,7 @@ import {IFlyout} from './interfaces/i_flyout.js'; import {IKeyboardAccessible} from './interfaces/i_keyboard_accessible.js'; import {IMetricsManager} from './interfaces/i_metrics_manager.js'; import {IMovable} from './interfaces/i_movable.js'; +import {IObservable, isObservable} from './interfaces/i_observable.js'; import {IPositionable} from './interfaces/i_positionable.js'; import {IRegistrable} from './interfaces/i_registrable.js'; import {ISelectable} from './interfaces/i_selectable.js'; @@ -690,6 +691,7 @@ export {IMetricsManager}; export {IMovable}; export {Input}; export {InsertionMarkerManager}; +export {IObservable, isObservable}; export {IPositionable}; export {IRegistrable}; export {ISelectable}; diff --git a/core/procedures/observable_procedure_map.ts b/core/observable_procedure_map.ts similarity index 67% rename from core/procedures/observable_procedure_map.ts rename to core/observable_procedure_map.ts index 5bffb8bbf..8105c905e 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/observable_procedure_map.ts @@ -4,17 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as eventUtils from '../events/utils.js'; -import {IProcedureMap} from '../interfaces/i_procedure_map.js'; -import type {IProcedureModel} from '../interfaces/i_procedure_model.js'; -import {isObservable} from '../interfaces/i_observable.js'; -import {triggerProceduresUpdate} from './update_procedures.js'; -import type {Workspace} from '../workspace.js'; +import {IProcedureMap} from './interfaces/i_procedure_map.js'; +import type {IProcedureModel} from './interfaces/i_procedure_model.js'; +import {isObservable} from './interfaces/i_observable.js'; export class ObservableProcedureMap extends Map implements IProcedureMap { - constructor(private readonly workspace: Workspace) { + /** @internal */ + constructor() { super(); } @@ -36,7 +34,6 @@ export class ObservableProcedureMap extends const proc = this.get(id); const existed = super.delete(id); if (!existed) return existed; - triggerProceduresUpdate(this.workspace); if (isObservable(proc)) proc.stopPublishing(); return existed; } @@ -47,10 +44,8 @@ export class ObservableProcedureMap extends override clear() { if (!this.size) return; for (const id of this.keys()) { - const proc = this.get(id); - super.delete(id); + this.delete(id); } - triggerProceduresUpdate(this.workspace); } /** @@ -58,7 +53,6 @@ export class ObservableProcedureMap extends * blocks can find it. */ add(proc: IProcedureModel): this { - // TODO(#6526): See if this method is actually useful. return this.set(proc.getId(), proc); } diff --git a/core/procedures.ts b/core/procedures.ts index 8a976016f..cd36b660b 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -29,8 +29,7 @@ import {IParameterModel} from './interfaces/i_parameter_model.js'; import {IProcedureMap} from './interfaces/i_procedure_map.js'; import {IProcedureModel} from './interfaces/i_procedure_model.js'; import {IProcedureBlock, isProcedureBlock} from './interfaces/i_procedure_block.js'; -import {ObservableProcedureMap} from './procedures/observable_procedure_map.js'; -import {triggerProceduresUpdate} from './procedures/update_procedures.js'; +import {ObservableProcedureMap} from './observable_procedure_map.js'; import * as utilsXml from './utils/xml.js'; import * as Variables from './variables.js'; import type {Workspace} from './workspace.js'; @@ -500,7 +499,6 @@ export function getDefinition(name: string, workspace: Workspace): Block|null { export { ObservableProcedureMap, - triggerProceduresUpdate, IParameterModel, IProcedureBlock, isProcedureBlock, diff --git a/core/procedures/update_procedures.ts b/core/procedures/update_procedures.ts deleted file mode 100644 index fae2ed4c4..000000000 --- a/core/procedures/update_procedures.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import * as goog from '../../closure/goog/goog.js'; -import {isProcedureBlock} from '../interfaces/i_procedure_block.js'; -import {Workspace} from '../workspace.js'; - -goog.declareModuleId('Blockly.procedures.updateProcedures'); - - -/** - * Calls the `doProcedureUpdate` method on all blocks which implement it. - * - * @internal - */ -export function triggerProceduresUpdate(workspace: Workspace) { - if (workspace.isClearing) return; - for (const block of workspace.getAllBlocks(false)) { - if (isProcedureBlock(block)) { - block.doProcedureUpdate(); - } - } -} diff --git a/core/workspace.ts b/core/workspace.ts index 0602fa834..4db632f96 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -33,7 +33,7 @@ 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'; +import {ObservableProcedureMap} from './observable_procedure_map.js'; /** @@ -112,7 +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); + private procedureMap: IProcedureMap = new ObservableProcedureMap(); /** * Blocks in the flyout can refer to variables that don't exist in the main diff --git a/tests/mocha/procedure_map_test.js b/tests/mocha/procedure_map_test.js index b38564545..3117cb6a2 100644 --- a/tests/mocha/procedure_map_test.js +++ b/tests/mocha/procedure_map_test.js @@ -21,49 +21,34 @@ suite('Procedure Map', function() { sharedTestTeardown.call(this); }); - suite('triggering block updates', function() { - setup(function() { - Blockly.Blocks['procedure_mock'] = { - init: function() { }, - doProcedureUpdate: function() { }, - getProcedureModel: function() { }, - isProcedureDef: function() { }, - }; + suite('publishing', function() { + test('inserting a procedure tells it to start publishing', function() { + const procedureModel = new MockProcedureModel(); + const spy = sinon.spy(procedureModel, 'startPublishing'); + this.procedureMap.set(procedureModel.getId(), procedureModel); - this.procedureBlock = this.workspace.newBlock('procedure_mock'); - - this.updateSpy = sinon.spy(this.procedureBlock, 'doProcedureUpdate'); + chai.assert.isTrue( + spy.called, 'Expected the model to start publishing'); }); - teardown(function() { - delete Blockly.Blocks['procedure_mock']; + test('adding a procedure tells it to start publishing', function() { + const procedureModel = new MockProcedureModel(); + const spy = sinon.spy(procedureModel, 'startPublishing'); + this.procedureMap.add(procedureModel); + + chai.assert.isTrue( + spy.called, 'Expected the model to start publishing'); }); - suite('procedure map updates', function() { - test('inserting a procedure does not trigger an update', function() { - const procedureModel = new MockProcedureModel(); - this.procedureMap.set(procedureModel.getId(), procedureModel); + test('deleting a procedure tells it to stop publishing', function() { + const procedureModel = new MockProcedureModel(); + const spy = sinon.spy(procedureModel, 'stopPublishing'); + this.procedureMap.add(procedureModel); - chai.assert.isFalse( - this.updateSpy.called, 'Expected no update to be triggered'); - }); + this.procedureMap.delete(procedureModel.getId()); - test('adding a procedure does not trigger an update', function() { - this.procedureMap.add(new MockProcedureModel()); - - chai.assert.isFalse( - this.updateSpy.called, 'Expected no update to be triggered'); - }); - - test('deleting a procedure triggers an update', function() { - const procedureModel = new MockProcedureModel(); - this.procedureMap.add(procedureModel); - - this.procedureMap.delete(procedureModel.getId()); - - chai.assert.isTrue( - this.updateSpy.calledOnce, 'Expected an update to be triggered'); - }); + chai.assert.isTrue( + spy.calledOnce, 'Expected the model stop publishing'); }); }); }); diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index ec33e1aeb..78dd839f4 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -206,6 +206,10 @@ export class MockProcedureModel { getEnabled() { return this.enabled; } + + startPublishing() { } + + stopPublishing() { } } export class MockParameterModel { From a7f498a6a02ae795aad1dd6f4f3dfb74a703ffa4 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 26 Jan 2023 20:09:19 +0000 Subject: [PATCH 056/141] fix(build): Fix event tests, improve `buildDeps` (#6773) * fix(tests): Fix errors in event tests - Fix actual syntax errors in imports in event_marker_move_test.js and event_selected.test.js, which were preventing those tests from being run. - Remove suite.only directives in those tests that would prevent all the other tests from running. * refactor(build): Improve buildDeps - Run closure-make-deps only once, instead of separately for core/ and tests/. - Specify a larger exec maxBuffer size, to ensure output and diagnostics are not truncated. - Change stderr filtering in buildDeps to filter out bounded generics messages and blank lines. - Attempt to suppress warnings in stderr output when closure-make-deps returns a non-zero exit code. Unfortunately, there seems to be a race condition which usually the stderr argument to the exec callback not to contain the complete output, so in that case print a helpful message. - Have buildDeps just return a Promise instead of using a callback. * fix(docs): Typo fix in JSDoc for log helper --- scripts/gulpfiles/build_tasks.js | 87 +++++++++++++++------------ tests/mocha/event_marker_move_test.js | 4 +- tests/mocha/event_selected_test.js | 4 +- 3 files changed, 51 insertions(+), 44 deletions(-) diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 9aaa7dc1d..eacbc2c88 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -309,71 +309,78 @@ function buildJavaScript(done) { * * Prerequisite: buildJavaScript. */ -function buildDeps(done) { +function buildDeps() { const roots = [ path.join(TSC_OUTPUT_DIR, 'closure', 'goog', 'base.js'), TSC_OUTPUT_DIR, 'blocks', 'generators', + 'tests/mocha', ]; - const testRoots = [ - ...roots, - 'tests/mocha' - ]; + /** Maximum buffer size, in bytes for child process stdout/stderr. */ + const MAX_BUFFER_SIZE = 10 * 1024 * 1024; /** - * Extracts lines that contain the specified keyword. - * @param {string} text output text - * @param {string} keyword extract lines with this keyword - * @returns {string} modified text + * Filter a string to extract lines containing (or not containing) the + * specified target string. + * + * @param {string} text Text to filter. + * @param {string} target String to search for. + * @param {boolean?} exclude If true, extract only non-matching lines. + * @returns {string} Filtered text. */ - function extractOutputs(text, keyword) { + function filter(text, target, exclude) { return text.split('\n') - .filter((line) => line.includes(keyword)) + .filter((line) => Boolean(line.match(target)) !== Boolean(exclude)) .join('\n'); } - function filterErrors(text) { - return text.split('\n') - .filter( - (line) => !/^WARNING /.test(line) || - !(/Missing type declaration./.test(line) || - /illegal use of unknown JSDoc tag/.test(line))) - .join('\n'); + /** + * Log unexpected diagnostics, after removing expected warnings. + * + * @param {string} text Standard error output from closure-make-deps + */ + function log(text) { + for (const line of text.split('\n')) { + if (line && + !/^WARNING .*: Bounded generic semantics are currently/.test(line) && + !/^WARNING .*: Missing type declaration/.test(line) && + !/^WARNING .*: illegal use of unknown JSDoc tag/.test(line)) { + console.error(line); + } + } } - new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const args = roots.map(root => `--root '${root}' `).join(''); exec( - `closure-make-deps ${args}`, + `closure-make-deps ${args}`, {maxBuffer: MAX_BUFFER_SIZE}, (error, stdout, stderr) => { - console.warn(filterErrors(stderr)); if (error) { + // Remove warnings from stack trace to show only errors. + error.stack = filter(error.stack, /^WARNING/, true); + // Due to some race condition, the stderr parameter is + // often badly truncated if an error is non-null, so the + // error message might not actually be shown to the user. + // Print a helpful message to the user to help them find + // out what the problem is. + error.stack += ` + +If you do not see an helpful diagnostic from closure-make-deps in the +error message above, try running: + + npx closure-make-deps ${args} 2>&1 |grep -v WARNING`; reject(error); } else { - fs.writeFileSync(DEPS_FILE, stdout); + log(stderr); + // Anything not about mocha goes in DEPS_FILE. + fs.writeFileSync(DEPS_FILE, filter(stdout, 'tests/mocha', true)); + // Anything about mocha does in TEST_DEPS_FILE. + fs.writeFileSync(TEST_DEPS_FILE, filter(stdout, 'tests/mocha')); resolve(); } }); - }).then(() => new Promise((resolve, reject) => { - // Filter out the entries that are already in deps.js. - const testArgs = - testRoots.map(root => `--root '${root}' `).join(''); - exec( - `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(); - } - }); - })).then(() => { - done(); }); } diff --git a/tests/mocha/event_marker_move_test.js b/tests/mocha/event_marker_move_test.js index e7ddac2f8..f44ca330a 100644 --- a/tests/mocha/event_marker_move_test.js +++ b/tests/mocha/event_marker_move_test.js @@ -7,7 +7,7 @@ goog.declareModuleId('Blockly.test.eventMarkerMove'); -import {defineRowBlock} from './test_helpers/block_definitions.js;'; +import {defineRowBlock} from './test_helpers/block_definitions.js'; import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; @@ -22,7 +22,7 @@ suite('Marker Move Event', function() { sharedTestTeardown.call(this); }); - suite.only('Serialization', function() { + suite('Serialization', function() { test('events round-trip through JSON', function() { const block1 = this.workspace.newBlock('row_block', 'test_id1'); const block2 = this.workspace.newBlock('row_block', 'test_id2'); diff --git a/tests/mocha/event_selected_test.js b/tests/mocha/event_selected_test.js index 726aba93a..f7be3745d 100644 --- a/tests/mocha/event_selected_test.js +++ b/tests/mocha/event_selected_test.js @@ -7,7 +7,7 @@ goog.declareModuleId('Blockly.test.eventSelected'); -import {defineRowBlock} from './test_helpers/block_definitions.js;'; +import {defineRowBlock} from './test_helpers/block_definitions.js'; import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; @@ -22,7 +22,7 @@ suite('Selected Event', function() { sharedTestTeardown.call(this); }); - suite.only('Serialization', function() { + suite('Serialization', function() { test('events round-trip through JSON', function() { const block1 = this.workspace.newBlock('row_block', 'test_id1'); const block2 = this.workspace.newBlock('row_block', 'test_id2'); From 05f343795edc33859d9af8b9373f0aa491c35d41 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 26 Jan 2023 13:13:25 -0800 Subject: [PATCH 057/141] chore: convert bug issue template to form (#6798) --- .github/ISSUE_TEMPLATE/bug_report.md | 65 -------------------------- .github/ISSUE_TEMPLATE/bug_report.yaml | 58 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 65 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6f2e01b3f..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -name: Bug Report -about: Create a report to help us improve -labels: 'type: bug, issue: triage' -assignees: '' - ---- - - - -**Describe the bug** - - - -**To Reproduce** - - -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** - - - -**Screenshots** - - - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Stack Traces** - - - -``` -Replace with error stack trace. -``` - -**Additional context** - - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 000000000..2c8f03d3f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,58 @@ +name: Bug Report +description: Create a report to help us improve +labels: 'type: bug, issue: triage' +body: + - type: markdown + attributes: + value: > + Thank you for taking the time to fill out a bug report! + If you have a question about how to use Blockly in your application, + please ask on the [forum](https://groups.google.com/forum/#!forum/blockly) instead of filing an issue. + - type: checkboxes + id: duplicates + attributes: + label: Check for Duplicates + options: + - label: I have searched for similar issues before opening a new one. + - type: textarea + id: description + attributes: + label: Description + description: Please provide a clear and concise description of the bug. + placeholder: What happened? What did you expect to happen? + validations: + required: true + - type: textarea + id: repro + attributes: + label: Reproduction Steps + description: What steps should we take to reproduce the issue? + value: | + 1. + 2. + 3. + - type: textarea + id: stack-trace + attributes: + label: Stack Trace + description: If you saw an error message or stack trace, please include it here. + placeholder: The text in this section will be formatted automatically; no need to include backticks. + render: shell + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Screenshots can help us see the behavior you're describing. Please add a screenshot or gif, especially if you are describing a rendering or visual bug. + placeholder: Paste or drag-and-drop an image to upload it. + - type: dropdown + id: browsers + attributes: + label: Browsers + description: Please select all browsers you've observed this behavior on. If the bug isn't browser-specific, you can leave this blank. + multiple: true + options: + - Chrome desktop + - Safari desktop + - Firefox desktop + - Android mobile + - iOS mobile From 4da8749317c259481c1fb046f9159a9b45ce456d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 15:08:00 -0800 Subject: [PATCH 058/141] chore(deps): bump rimraf from 4.1.1 to 4.1.2 (#6802) Bumps [rimraf](https://github.com/isaacs/rimraf) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/isaacs/rimraf/releases) - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/rimraf/compare/v4.1.1...v4.1.2) --- updated-dependencies: - dependency-name: rimraf dependency-type: direct:development update-type: version-update:semver-patch ... 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 123bc26f9..d5c80818b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10566,9 +10566,9 @@ "dev": true }, "node_modules/rimraf": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.1.tgz", - "integrity": "sha512-Z4Y81w8atcvaJuJuBB88VpADRH66okZAuEm+Jtaufa+s7rZmIz+Hik2G53kGaNytE7lsfXyWktTmfVz0H9xuDg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", "dev": true, "bin": { "rimraf": "dist/cjs/src/bin.js" @@ -21239,9 +21239,9 @@ "dev": true }, "rimraf": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.1.tgz", - "integrity": "sha512-Z4Y81w8atcvaJuJuBB88VpADRH66okZAuEm+Jtaufa+s7rZmIz+Hik2G53kGaNytE7lsfXyWktTmfVz0H9xuDg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", "dev": true }, "run-parallel": { From 7cbdf0d87e54fc9bab24e2ca6e9509e23ff1fd58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:17:48 -0800 Subject: [PATCH 059/141] chore(deps): bump google-closure-compiler (#6803) Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20221102.0.1 to 20230103.0.0. - [Release notes](https://github.com/google/closure-compiler-npm/releases) - [Commits](https://github.com/google/closure-compiler-npm/compare/v20221102.0.1...v20230103.0.0) --- updated-dependencies: - dependency-name: google-closure-compiler dependency-type: direct:development update-type: version-update:semver-major ... 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 d5c80818b..80b5f6c8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20221102.0.1", + "google-closure-compiler": "^20230103.0.0", "google-closure-deps": "^20221102.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", @@ -5789,13 +5789,13 @@ } }, "node_modules/google-closure-compiler": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221102.0.1.tgz", - "integrity": "sha512-edAlsyJEsy2I983xWBlBfdSme16uyY007HM2OwPOoWPEFgmR100ggUabJbIegXZgbSLH51kyeJMQKuWhiHgzcA==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230103.0.0.tgz", + "integrity": "sha512-gejhxkvSocXTL83pVxvlGBfny9TIKg9XVzs/Mqc3jVghLoAQUy1s6Tu4AUNMHIgEdJTSmkfvB5QEYVZsABy1QQ==", "dev": true, "dependencies": { "chalk": "4.x", - "google-closure-compiler-java": "^20221102.0.1", + "google-closure-compiler-java": "^20230103.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" @@ -5807,21 +5807,21 @@ "node": ">=10" }, "optionalDependencies": { - "google-closure-compiler-linux": "^20221102.0.1", - "google-closure-compiler-osx": "^20221102.0.1", - "google-closure-compiler-windows": "^20221102.0.1" + "google-closure-compiler-linux": "^20230103.0.0", + "google-closure-compiler-osx": "^20230103.0.0", + "google-closure-compiler-windows": "^20230103.0.0" } }, "node_modules/google-closure-compiler-java": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221102.0.1.tgz", - "integrity": "sha512-rMKLEma3uSe/6MGHtivDezTv4u5iaDEyxoy9No+1WruPSZ5h1gBZLONcfCA8JaoGojFPdHZI1qbwT0EveEWnAg==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230103.0.0.tgz", + "integrity": "sha512-SUNv5HaAiXNjm6BjYMsGvJhizWisHk4sl9Kxq3LnaCCpZJeiJQX23Z391IPqD8lHcUQmmJkxe8+WMwQP6NV1Cg==", "dev": true }, "node_modules/google-closure-compiler-linux": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221102.0.1.tgz", - "integrity": "sha512-rj1E1whT4j/giidQ44v4RoO8GcvU81VU9YB5RlRM0hWDvCGWjQasDABGnF/YLWLl5PXAAfJpa/hy8ckv5/r97g==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230103.0.0.tgz", + "integrity": "sha512-83v+8wHitIbD3fraRuaL8OlTfO1tFvepJbrB3yUCK/HU+3SjY6AFgbeCJ06nNPwzTo9zuQUwhrbCrpvNTkAqZg==", "cpu": [ "x32", "x64" @@ -5833,9 +5833,9 @@ ] }, "node_modules/google-closure-compiler-osx": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221102.0.1.tgz", - "integrity": "sha512-Cv993yr9a2DLFgYnsv4m6dNUk5jousd6W6la12x2fDbhxTLewYrw7CrCaVEVw1SU3XErVmdHOZQjFsVMhcZjCw==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230103.0.0.tgz", + "integrity": "sha512-TBoOUe6ySIepdiYF3S7/IzCNk0TN7Lwp8VfTBYLX+qOUFLLC+HHqXXrl8kVstgH3J202pTDb6XZl9pQD16rEXQ==", "cpu": [ "x32", "x64", @@ -5848,9 +5848,9 @@ ] }, "node_modules/google-closure-compiler-windows": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221102.0.1.tgz", - "integrity": "sha512-jRwHGekG/oDihHdKAEiYN5z0cBF+brL0bYtuEOXx4fAmq5tHe4OxKtSEEprCnVZZL0aG/boGprACPvsDRsXT7Q==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230103.0.0.tgz", + "integrity": "sha512-hMKtPeoFchaz/c4D6xgjWYmumxJwPTSoyELZ3jRI4xz2Zp9WsP4h44kCykZ9A65ynl60PuPfzsD3/IrK9HisyA==", "cpu": [ "x32", "x64" @@ -17411,45 +17411,45 @@ } }, "google-closure-compiler": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20221102.0.1.tgz", - "integrity": "sha512-edAlsyJEsy2I983xWBlBfdSme16uyY007HM2OwPOoWPEFgmR100ggUabJbIegXZgbSLH51kyeJMQKuWhiHgzcA==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230103.0.0.tgz", + "integrity": "sha512-gejhxkvSocXTL83pVxvlGBfny9TIKg9XVzs/Mqc3jVghLoAQUy1s6Tu4AUNMHIgEdJTSmkfvB5QEYVZsABy1QQ==", "dev": true, "requires": { "chalk": "4.x", - "google-closure-compiler-java": "^20221102.0.1", - "google-closure-compiler-linux": "^20221102.0.1", - "google-closure-compiler-osx": "^20221102.0.1", - "google-closure-compiler-windows": "^20221102.0.1", + "google-closure-compiler-java": "^20230103.0.0", + "google-closure-compiler-linux": "^20230103.0.0", + "google-closure-compiler-osx": "^20230103.0.0", + "google-closure-compiler-windows": "^20230103.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" } }, "google-closure-compiler-java": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20221102.0.1.tgz", - "integrity": "sha512-rMKLEma3uSe/6MGHtivDezTv4u5iaDEyxoy9No+1WruPSZ5h1gBZLONcfCA8JaoGojFPdHZI1qbwT0EveEWnAg==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230103.0.0.tgz", + "integrity": "sha512-SUNv5HaAiXNjm6BjYMsGvJhizWisHk4sl9Kxq3LnaCCpZJeiJQX23Z391IPqD8lHcUQmmJkxe8+WMwQP6NV1Cg==", "dev": true }, "google-closure-compiler-linux": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20221102.0.1.tgz", - "integrity": "sha512-rj1E1whT4j/giidQ44v4RoO8GcvU81VU9YB5RlRM0hWDvCGWjQasDABGnF/YLWLl5PXAAfJpa/hy8ckv5/r97g==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230103.0.0.tgz", + "integrity": "sha512-83v+8wHitIbD3fraRuaL8OlTfO1tFvepJbrB3yUCK/HU+3SjY6AFgbeCJ06nNPwzTo9zuQUwhrbCrpvNTkAqZg==", "dev": true, "optional": true }, "google-closure-compiler-osx": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20221102.0.1.tgz", - "integrity": "sha512-Cv993yr9a2DLFgYnsv4m6dNUk5jousd6W6la12x2fDbhxTLewYrw7CrCaVEVw1SU3XErVmdHOZQjFsVMhcZjCw==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230103.0.0.tgz", + "integrity": "sha512-TBoOUe6ySIepdiYF3S7/IzCNk0TN7Lwp8VfTBYLX+qOUFLLC+HHqXXrl8kVstgH3J202pTDb6XZl9pQD16rEXQ==", "dev": true, "optional": true }, "google-closure-compiler-windows": { - "version": "20221102.0.1", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20221102.0.1.tgz", - "integrity": "sha512-jRwHGekG/oDihHdKAEiYN5z0cBF+brL0bYtuEOXx4fAmq5tHe4OxKtSEEprCnVZZL0aG/boGprACPvsDRsXT7Q==", + "version": "20230103.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230103.0.0.tgz", + "integrity": "sha512-hMKtPeoFchaz/c4D6xgjWYmumxJwPTSoyELZ3jRI4xz2Zp9WsP4h44kCykZ9A65ynl60PuPfzsD3/IrK9HisyA==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index dc89e5a83..dcc00e291 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^39.3.6", - "google-closure-compiler": "^20221102.0.1", + "google-closure-compiler": "^20230103.0.0", "google-closure-deps": "^20221102.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", From c1b2ddb96fe1f2544f98340b92a63873c0c872db Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Wed, 1 Feb 2023 14:46:28 -0800 Subject: [PATCH 060/141] feat: Add support for centering on a block itself vs its stack. (#6810) * feat: Add support for centering on a block itself vs its stack. * fix: Make centerOnBlock test actually call it. --- core/workspace_svg.ts | 9 ++++++--- tests/mocha/workspace_svg_test.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index f0cd6c43d..67bdaf814 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -1983,11 +1983,13 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** * Scroll the workspace to center on the given block. If the block has other - * blocks stacked below it, the workspace will be centered on the stack. + * blocks stacked below it, the workspace will be centered on the stack, + * unless blockOnly is true. * * @param id ID of block center on. + * @param blockOnly True to center only on the block itself, not its stack. */ - centerOnBlock(id: string|null) { + centerOnBlock(id: string|null, blockOnly?: boolean) { if (!this.isMovable()) { console.warn( 'Tried to move a non-movable workspace. This could result' + @@ -2003,7 +2005,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { // XY is in workspace coordinates. const xy = block.getRelativeToSurfaceXY(); // Height/width is in workspace units. - const heightWidth = block.getHeightWidth(); + const heightWidth = blockOnly ? {height: block.height, width: block.width} : + block.getHeightWidth(); // Find the enter of the block in workspace units. const blockCenterY = xy.y + heightWidth.height / 2; diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index cea36e100..923106e7f 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -209,7 +209,7 @@ suite('WorkspaceSvg', function() { const block = this.workspace.newBlock('stack_block'); block.initSvg(); block.render(); - runViewportEventTest(() => this.workspace.zoomToFit(block.id), + runViewportEventTest(() => this.workspace.centerOnBlock(block.id), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); From be67829d393567c5ddf2b4369c196432145e13b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Feb 2023 20:15:46 +0000 Subject: [PATCH 061/141] chore(deps): bump ua-parser-js from 1.0.32 to 1.0.33 (#6791) Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 1.0.32 to 1.0.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/1.0.32...1.0.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... 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 80b5f6c8d..f1502a186 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11925,9 +11925,9 @@ } }, "node_modules/ua-parser-js": { - "version": "1.0.32", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.32.tgz", - "integrity": "sha512-dXVsz3M4j+5tTiovFVyVqssXBu5HM47//YSOeZ9fQkdDKkfzv2v3PP1jmH6FUyPW+yCSn7aBVK1fGGKNhowdDA==", + "version": "1.0.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.33.tgz", + "integrity": "sha512-RqshF7TPTE0XLYAqmjlu5cLLuGdKrNu9O1KLA/qp39QtbZwuzwv1dT46DZSopoUMsYgXpB3Cv8a03FI8b74oFQ==", "dev": true, "funding": [ { @@ -22359,9 +22359,9 @@ "dev": true }, "ua-parser-js": { - "version": "1.0.32", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.32.tgz", - "integrity": "sha512-dXVsz3M4j+5tTiovFVyVqssXBu5HM47//YSOeZ9fQkdDKkfzv2v3PP1jmH6FUyPW+yCSn7aBVK1fGGKNhowdDA==", + "version": "1.0.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.33.tgz", + "integrity": "sha512-RqshF7TPTE0XLYAqmjlu5cLLuGdKrNu9O1KLA/qp39QtbZwuzwv1dT46DZSopoUMsYgXpB3Cv8a03FI8b74oFQ==", "dev": true }, "unbzip2-stream": { From 7abc2011f9e1f5e81bb4c95da95a3bcff7840c18 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 2 Feb 2023 20:18:54 +0000 Subject: [PATCH 062/141] chore(deps): Remove calcdeps.py (#6813) This script was only used from build.py, which was removed in PR #4951 (and had not been in use for some considerable time before that). --- closure/bin/calcdeps.py | 325 ---------------------------------------- 1 file changed, 325 deletions(-) delete mode 100644 closure/bin/calcdeps.py diff --git a/closure/bin/calcdeps.py b/closure/bin/calcdeps.py deleted file mode 100644 index 67e5e8d15..000000000 --- a/closure/bin/calcdeps.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006 The Closure Library Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS-IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -"""Calculates JavaScript dependencies without requiring Google's build system. - -It iterates over a number of search paths and builds a dependency tree. With -the inputs provided, it walks the dependency tree and outputs all the files -required for compilation. -""" - - -import logging -import os -import re -import sys - - -_BASE_REGEX_STRING = '^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)' -req_regex = re.compile(_BASE_REGEX_STRING % 'require') -prov_regex = re.compile(_BASE_REGEX_STRING % 'provide') -ns_regex = re.compile('^ns:((\w+\.)*(\w+))$') - - -def IsValidFile(ref): - """Returns true if the provided reference is a file and exists.""" - return os.path.isfile(ref) - - -def IsJsFile(ref): - """Returns true if the provided reference is a JavaScript file.""" - return ref.endswith('.js') - - -def IsNamespace(ref): - """Returns true if the provided reference is a namespace.""" - return re.match(ns_regex, ref) is not None - - -def IsDirectory(ref): - """Returns true if the provided reference is a directory.""" - return os.path.isdir(ref) - - -def ExpandDirectories(refs): - """Expands any directory references into inputs. - - Description: - Looks for any directories in the provided references. Found directories - are recursively searched for .js files, which are then added to the result - list. - - Args: - refs: a list of references such as files, directories, and namespaces - - Returns: - A list of references with directories removed and replaced by any - .js files that are found in them. Also, the paths will be normalized. - """ - result = [] - for ref in refs: - if IsDirectory(ref): - # Disable 'Unused variable' for subdirs - # pylint: disable=unused-variable - for (directory, subdirs, filenames) in os.walk(ref): - for filename in filenames: - if IsJsFile(filename): - result.append(os.path.join(directory, filename)) - else: - result.append(ref) - return map(os.path.normpath, result) - - -class DependencyInfo(object): - """Represents a dependency that is used to build and walk a tree.""" - - def __init__(self, filename): - self.filename = filename - self.provides = [] - self.requires = [] - - def __str__(self): - return '%s Provides: %s Requires: %s' % (self.filename, - repr(self.provides), - repr(self.requires)) - - -def BuildDependenciesFromFiles(files): - """Build a list of dependencies from a list of files. - - Description: - Takes a list of files, extracts their provides and requires, and builds - out a list of dependency objects. - - Args: - files: a list of files to be parsed for goog.provides and goog.requires. - - Returns: - A list of dependency objects, one for each file in the files argument. - """ - result = [] - filenames = set() - for filename in files: - if filename in filenames: - continue - - # Python 3 requires the file encoding to be specified - if (sys.version_info[0] < 3): - file_handle = open(filename, 'r') - else: - file_handle = open(filename, 'r', encoding='utf8') - - try: - dep = CreateDependencyInfo(filename, file_handle) - result.append(dep) - finally: - file_handle.close() - - filenames.add(filename) - - return result - - -def CreateDependencyInfo(filename, source): - """Create dependency info. - - Args: - filename: Filename for source. - source: File-like object containing source. - - Returns: - A DependencyInfo object with provides and requires filled. - """ - dep = DependencyInfo(filename) - for line in source: - if re.match(req_regex, line): - dep.requires.append(re.search(req_regex, line).group(1)) - if re.match(prov_regex, line): - dep.provides.append(re.search(prov_regex, line).group(1)) - return dep - - -def BuildDependencyHashFromDependencies(deps): - """Builds a hash for searching dependencies by the namespaces they provide. - - Description: - Dependency objects can provide multiple namespaces. This method enumerates - the provides of each dependency and adds them to a hash that can be used - to easily resolve a given dependency by a namespace it provides. - - Args: - deps: a list of dependency objects used to build the hash. - - Raises: - Exception: If a multiple files try to provide the same namepace. - - Returns: - A hash table { namespace: dependency } that can be used to resolve a - dependency by a namespace it provides. - """ - dep_hash = {} - for dep in deps: - for provide in dep.provides: - if provide in dep_hash: - raise Exception('Duplicate provide (%s) in (%s, %s)' % ( - provide, - dep_hash[provide].filename, - dep.filename)) - dep_hash[provide] = dep - return dep_hash - - -def CalculateDependencies(paths, inputs): - """Calculates the dependencies for given inputs. - - Description: - This method takes a list of paths (files, directories) and builds a - searchable data structure based on the namespaces that each .js file - provides. It then parses through each input, resolving dependencies - against this data structure. The final output is a list of files, - including the inputs, that represent all of the code that is needed to - compile the given inputs. - - Args: - paths: the references (files, directories) that are used to build the - dependency hash. - inputs: the inputs (files, directories, namespaces) that have dependencies - that need to be calculated. - - Raises: - Exception: if a provided input is invalid. - - Returns: - A list of all files, including inputs, that are needed to compile the given - inputs. - """ - deps = BuildDependenciesFromFiles(paths + inputs) - search_hash = BuildDependencyHashFromDependencies(deps) - result_list = [] - seen_list = [] - for input_file in inputs: - if IsNamespace(input_file): - namespace = re.search(ns_regex, input_file).group(1) - if namespace not in search_hash: - raise Exception('Invalid namespace (%s)' % namespace) - input_file = search_hash[namespace].filename - if not IsValidFile(input_file) or not IsJsFile(input_file): - raise Exception('Invalid file (%s)' % input_file) - seen_list.append(input_file) - file_handle = open(input_file, 'r') - try: - for line in file_handle: - if re.match(req_regex, line): - require = re.search(req_regex, line).group(1) - ResolveDependencies(require, search_hash, result_list, seen_list) - finally: - file_handle.close() - result_list.append(input_file) - - return result_list - - -def FindClosureBasePath(paths): - """Given a list of file paths, return Closure base.js path, if any. - - Args: - paths: A list of paths. - - Returns: - The path to Closure's base.js file including filename, if found. - """ - - for path in paths: - pathname, filename = os.path.split(path) - - if filename == 'base.js': - f = open(path) - - is_base = False - - # Sanity check that this is the Closure base file. Check that this - # is where goog is defined. This is determined by the @provideGoog - # flag. - for line in f: - if '@provideGoog' in line: - is_base = True - break - - f.close() - - if is_base: - return path - -def ResolveDependencies(require, search_hash, result_list, seen_list): - """Takes a given requirement and resolves all of the dependencies for it. - - Description: - A given requirement may require other dependencies. This method - recursively resolves all dependencies for the given requirement. - - Raises: - Exception: when require does not exist in the search_hash. - - Args: - require: the namespace to resolve dependencies for. - search_hash: the data structure used for resolving dependencies. - result_list: a list of filenames that have been calculated as dependencies. - This variable is the output for this function. - seen_list: a list of filenames that have been 'seen'. This is required - for the dependency->dependent ordering. - """ - if require not in search_hash: - raise Exception('Missing provider for (%s)' % require) - - dep = search_hash[require] - if not dep.filename in seen_list: - seen_list.append(dep.filename) - for sub_require in dep.requires: - ResolveDependencies(sub_require, search_hash, result_list, seen_list) - result_list.append(dep.filename) - - -def GetDepsLine(dep, base_path): - """Returns a JS string for a dependency statement in the deps.js file. - - Args: - dep: The dependency that we're printing. - base_path: The path to Closure's base.js including filename. - """ - return 'goog.addDependency("%s", %s, %s);' % ( - GetRelpath(dep.filename, base_path), dep.provides, dep.requires) - - -def GetRelpath(path, start): - """Return a relative path to |path| from |start|.""" - # NOTE: Python 2.6 provides os.path.relpath, which has almost the same - # functionality as this function. Since we want to support 2.4, we have - # to implement it manually. :( - path_list = os.path.abspath(os.path.normpath(path)).split(os.sep) - start_list = os.path.abspath( - os.path.normpath(os.path.dirname(start))).split(os.sep) - - common_prefix_count = 0 - for i in range(0, min(len(path_list), len(start_list))): - if path_list[i] != start_list[i]: - break - common_prefix_count += 1 - - # Always use forward slashes, because this will get expanded to a url, - # not a file path. - return '/'.join(['..'] * (len(start_list) - common_prefix_count) + - path_list[common_prefix_count:]) From 466ca1cf47427d8c7bc560bdca4979e275aee6e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Feb 2023 20:21:45 +0000 Subject: [PATCH 063/141] chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#6815) Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/kornelski/http-cache-semantics/releases) - [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: http-cache-semantics dependency-type: indirect ... 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 f1502a186..762a1ce8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6845,9 +6845,9 @@ } }, "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "node_modules/http-proxy": { @@ -18293,9 +18293,9 @@ } }, "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "http-proxy": { From a73a70b7a8a54ca492d93b5a95093926d652f222 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 2 Feb 2023 15:26:31 -0800 Subject: [PATCH 064/141] chore: update the other issue templates to forms (#6799) --- .github/ISSUE_TEMPLATE/bug_report.yaml | 8 ++-- .github/ISSUE_TEMPLATE/documentation.md | 44 --------------------- .github/ISSUE_TEMPLATE/documentation.yaml | 39 ++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 23 ----------- .github/ISSUE_TEMPLATE/feature_request.yaml | 40 +++++++++++++++++++ 5 files changed, 83 insertions(+), 71 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/documentation.md create mode 100644 .github/ISSUE_TEMPLATE/documentation.yaml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 2c8f03d3f..1b3af57bd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -1,6 +1,6 @@ name: Bug Report description: Create a report to help us improve -labels: 'type: bug, issue: triage' +labels: 'issue: bug, issue: triage' body: - type: markdown attributes: @@ -11,7 +11,7 @@ body: - type: checkboxes id: duplicates attributes: - label: Check for Duplicates + label: Check for duplicates options: - label: I have searched for similar issues before opening a new one. - type: textarea @@ -25,7 +25,7 @@ body: - type: textarea id: repro attributes: - label: Reproduction Steps + label: Reproduction steps description: What steps should we take to reproduce the issue? value: | 1. @@ -34,7 +34,7 @@ body: - type: textarea id: stack-trace attributes: - label: Stack Trace + label: Stack trace description: If you saw an error message or stack trace, please include it here. placeholder: The text in this section will be formatted automatically; no need to include backticks. render: shell diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md deleted file mode 100644 index 343defc12..000000000 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -name: Documentation -about: Report an issue with our documentation -labels: 'type: documentation, issue: triage' -assignees: '' - ---- - - - -**Where** - - - -**What** - - - -- [ ] Text -- [ ] Image or Gif -- [ ] Other - -**Old content** - - - -**Suggested content** - - - -**Additional context** - - diff --git a/.github/ISSUE_TEMPLATE/documentation.yaml b/.github/ISSUE_TEMPLATE/documentation.yaml new file mode 100644 index 000000000..93d7f5011 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.yaml @@ -0,0 +1,39 @@ + +name: Documentation +description: Report an issue with our documentation +labels: 'issue: docs, issue: triage' +body: + - type: markdown + attributes: + value: > + Thanks for helping us improve our developer site documentation! + Use this template to describe issues with the content on our + [developer site](https://developers.google.com/blockly/guides). + - type: input + id: link + attributes: + label: Location + description: > + A link to the page with the documentation you want us to be updated. + If no page exists, describe what the page should be, and where. + - type: checkboxes + id: type + attributes: + label: Type + description: What kind of content is it? + options: + - label: Text + - label: Image or Gif + - label: Other + - type: textarea + id: content + attributes: + label: Suggested content + description: Your suggestion for improved documentation. If it's helpful, also include the old content for comparison. + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context about the problem. If this is related to a specific pull request, link to it. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 668e1adb1..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -labels: 'type: feature request, issue: triage' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** - - - -**Describe the solution you'd like** - - - -**Describe alternatives you've considered** - - - -**Additional context** - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 000000000..b5c17620f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,40 @@ + +name: Feature request +description: Suggest an idea for this project +labels: 'issue: feature request, issue: triage' +body: + - type: markdown + attributes: + value: > + Thank you for taking the time to fill out a feature request! + If you have a question about how to use Blockly in your application, + please ask on the [forum](https://groups.google.com/forum/#!forum/blockly) instead of filing an issue. + - type: checkboxes + id: duplicates + attributes: + label: Check for duplicates + options: + - label: I have searched for similar issues before opening a new one. + - type: textarea + id: problem + attributes: + label: Problem + description: Is your feature request related to a problem? Please describe. + placeholder: I'm always frustrated when... + - type: textarea + id: request + attributes: + label: Request + description: Describe your feature request and how it solves your problem. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Describe any alternative solutions or features you've considered. + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. From 299016e78d8d83e972f1947036c7f7c7dfde6c7b Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Fri, 3 Feb 2023 08:03:31 -0800 Subject: [PATCH 065/141] chore: Remove some more uses of AnyDuringMigration (#6785) * chore: Remove uses of AnyDuringMigration in workspace_comment_svg.ts. * chore: Remove uses of AnyDuringMigration in toolbox.ts. * chore: Remove uses of AnyDuringMigration in field_colour.ts. * chore: Remove uses of AnyDuringMigration from field_image.ts. * chore: Remove uses of AnyDuringMigration from workspace.ts. * Update core/workspace_comment_svg.ts Co-authored-by: Christopher Allen * chore: Remove uses of AnyDuringMigration in collapsible_category.ts. * chore: Revert unary - change to make clang-format happy. * chore: Remove unnecessary quotes in toolbox.ts. * Update core/workspace_comment_svg.ts Co-authored-by: Christopher Allen --------- Co-authored-by: Christopher Allen --- core/events/events_comment_move.ts | 6 +- core/field_colour.ts | 28 ++--- core/field_image.ts | 13 +- core/interfaces/i_copyable.ts | 2 +- core/interfaces/i_selectable_toolbox_item.ts | 8 ++ core/toolbox/collapsible_category.ts | 33 ++---- core/toolbox/toolbox.ts | 48 +++----- core/utils/toolbox.ts | 2 + core/workspace.ts | 69 +++-------- core/workspace_comment.ts | 2 +- core/workspace_comment_svg.ts | 118 ++++++------------- tests/mocha/workspace_comment_test.js | 4 +- 12 files changed, 111 insertions(+), 222 deletions(-) diff --git a/core/events/events_comment_move.ts b/core/events/events_comment_move.ts index fa05de2a8..40f2a0da3 100644 --- a/core/events/events_comment_move.ts +++ b/core/events/events_comment_move.ts @@ -52,7 +52,7 @@ export class CommentMove extends CommentBase { } this.comment_ = opt_comment; - this.oldCoordinate_ = opt_comment.getXY(); + this.oldCoordinate_ = opt_comment.getRelativeToSurfaceXY(); } /** @@ -70,7 +70,7 @@ export class CommentMove extends CommentBase { 'The comment is undefined. Pass a comment to ' + 'the constructor if you want to use the record functionality'); } - this.newCoordinate_ = this.comment_.getXY(); + this.newCoordinate_ = this.comment_.getRelativeToSurfaceXY(); } /** @@ -180,7 +180,7 @@ export class CommentMove extends CommentBase { 'or call fromJson'); } // TODO: Check if the comment is being dragged, and give up if so. - const current = comment.getXY(); + const current = comment.getRelativeToSurfaceXY(); comment.moveBy(target.x - current.x, target.y - current.y); } } diff --git a/core/field_colour.ts b/core/field_colour.ts index db56acf53..73843c0b6 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -117,17 +117,13 @@ export class FieldColour extends Field { protected override isDirty_ = false; /** Array of colours used by this field. If null, use the global list. */ - // AnyDuringMigration because: Type 'null' is not assignable to type - // 'string[]'. - private colours_: string[] = null as AnyDuringMigration; + private colours_: string[]|null = null; /** * Array of colour tooltips used by this field. If null, use the global * list. */ - // AnyDuringMigration because: Type 'null' is not assignable to type - // 'string[]'. - private titles_: string[] = null as AnyDuringMigration; + private titles_: string[]|null = null; /** * Number of colour columns used by this field. If 0, use the global @@ -211,8 +207,7 @@ export class FieldColour extends Field { * @param opt_newValue The input value. * @returns A valid colour, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { + protected override doClassValidation_(opt_newValue?: any): string|null { if (typeof opt_newValue !== 'string') { return null; } @@ -415,9 +410,7 @@ export class FieldColour extends Field { /** Handle a mouse enter event. Focus the picker. */ private onMouseEnter_() { - // AnyDuringMigration because: Property 'focus' does not exist on type - // 'Element'. - (this.picker_ as AnyDuringMigration)!.focus({preventScroll: true}); + this.picker_?.focus({preventScroll: true}); } /** @@ -425,9 +418,7 @@ export class FieldColour extends Field { * the currently highlighted colour. */ private onMouseLeave_() { - // AnyDuringMigration because: Property 'blur' does not exist on type - // 'Element'. - (this.picker_ as AnyDuringMigration)!.blur(); + this.picker_?.blur(); const highlighted = this.getHighlighted_(); if (highlighted) { dom.removeClass(highlighted, 'blocklyColourHighlighted'); @@ -473,11 +464,10 @@ export class FieldColour extends Field { this.highlightedIndex_ = index; // Update accessibility roles. - // AnyDuringMigration because: Argument of type 'string | null' is not - // assignable to parameter of type 'string | number | boolean | string[]'. - aria.setState( - this.picker_ as Element, aria.State.ACTIVEDESCENDANT, - cell.getAttribute('id') as AnyDuringMigration); + const cellId = cell.getAttribute('id'); + if (cellId && this.picker_) { + aria.setState(this.picker_, aria.State.ACTIVEDESCENDANT, cellId); + } } /** Create a colour picker dropdown editor. */ diff --git a/core/field_image.ts b/core/field_image.ts index ab0a6bb37..a265a182b 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -35,12 +35,10 @@ export class FieldImage extends Field { private readonly imageHeight_: number; /** The function to be called when this field is clicked. */ - private clickHandler_: ((p1: FieldImage) => AnyDuringMigration)|null = null; + private clickHandler_: ((p1: FieldImage) => void)|null = null; /** The rendered field's image element. */ - // AnyDuringMigration because: Type 'null' is not assignable to type - // 'SVGImageElement'. - private imageElement_: SVGImageElement = null as AnyDuringMigration; + private imageElement_: SVGImageElement|null = null; /** * Editable fields usually show some sort of UI indicating they are @@ -79,7 +77,7 @@ export class FieldImage extends Field { */ constructor( src: string|Sentinel, width: string|number, height: string|number, - opt_alt?: string, opt_onClick?: (p1: FieldImage) => AnyDuringMigration, + opt_alt?: string, opt_onClick?: (p1: FieldImage) => void, opt_flipRtl?: boolean, opt_config?: FieldImageConfig) { super(Field.SKIP_SETUP); @@ -164,8 +162,7 @@ export class FieldImage extends Field { * @param opt_newValue The input value. * @returns A string, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { + protected override doClassValidation_(opt_newValue?: any): string|null { if (typeof opt_newValue !== 'string') { return null; } @@ -226,7 +223,7 @@ export class FieldImage extends Field { * @param func The function that is called when the image is clicked, or null * to remove. */ - setOnClickHandler(func: ((p1: FieldImage) => AnyDuringMigration)|null) { + setOnClickHandler(func: ((p1: FieldImage) => void)|null) { this.clickHandler_ = func; } diff --git a/core/interfaces/i_copyable.ts b/core/interfaces/i_copyable.ts index 9c780a317..4c6a7a62c 100644 --- a/core/interfaces/i_copyable.ts +++ b/core/interfaces/i_copyable.ts @@ -31,7 +31,7 @@ export namespace ICopyable { export interface CopyData { saveInfo: Object|Element; source: WorkspaceSvg; - typeCounts: Object|null; + typeCounts: {[key: string]: number}|null; } } diff --git a/core/interfaces/i_selectable_toolbox_item.ts b/core/interfaces/i_selectable_toolbox_item.ts index e7fe06f86..765a42c6e 100644 --- a/core/interfaces/i_selectable_toolbox_item.ts +++ b/core/interfaces/i_selectable_toolbox_item.ts @@ -61,3 +61,11 @@ export interface ISelectableToolboxItem extends IToolboxItem { */ onClick(_e: Event): void; } + +/** + * Type guard that checks whether an IToolboxItem is an ISelectableToolboxItem. + */ +export function isSelectableToolboxItem(toolboxItem: IToolboxItem): + toolboxItem is ISelectableToolboxItem { + return toolboxItem.isSelectable(); +} diff --git a/core/toolbox/collapsible_category.ts b/core/toolbox/collapsible_category.ts index 1c6ff27fd..c6f45ebdd 100644 --- a/core/toolbox/collapsible_category.ts +++ b/core/toolbox/collapsible_category.ts @@ -42,8 +42,6 @@ export class CollapsibleToolboxCategory extends ToolboxCategory implements /** The child toolbox items for this category. */ protected toolboxItems_: IToolboxItem[] = []; - override flyoutItems_: AnyDuringMigration; - override isHidden_: AnyDuringMigration; /** * @param categoryDef The information needed to create a category in the @@ -60,25 +58,18 @@ export class CollapsibleToolboxCategory extends ToolboxCategory implements override makeDefaultCssConfig_() { const cssConfig = super.makeDefaultCssConfig_(); - (cssConfig as AnyDuringMigration)['contents'] = 'blocklyToolboxContents'; + cssConfig['contents'] = 'blocklyToolboxContents'; return cssConfig; } override parseContents_(categoryDef: toolbox.CategoryInfo) { - // AnyDuringMigration because: Element implicitly has an 'any' type because - // expression of type '"contents"' can't be used to index type - // 'CategoryInfo'. - const contents = (categoryDef as AnyDuringMigration)['contents']; - let prevIsFlyoutItem = true; - - // AnyDuringMigration because: Element implicitly has an 'any' type because - // expression of type '"custom"' can't be used to index type 'CategoryInfo'. - if ((categoryDef as AnyDuringMigration)['custom']) { - // AnyDuringMigration because: Element implicitly has an 'any' type - // because expression of type '"custom"' can't be used to index type - // 'CategoryInfo'. - this.flyoutItems_ = (categoryDef as AnyDuringMigration)['custom']; - } else if (contents) { + if ('custom' in categoryDef) { + this.flyoutItems_ = categoryDef['custom']; + } else { + const contents = categoryDef['contents']; + if (!contents) return; + this.flyoutItems_ = []; + let prevIsFlyoutItem = true; for (let i = 0; i < contents.length; i++) { const itemDef = contents[i]; // Separators can exist as either a flyout item or a toolbox item so @@ -123,8 +114,8 @@ export class CollapsibleToolboxCategory extends ToolboxCategory implements super.init(); this.setExpanded( - (this.toolboxItemDef_ as AnyDuringMigration)['expanded'] === 'true' || - (this.toolboxItemDef_ as AnyDuringMigration)['expanded']); + this.toolboxItemDef_['expanded'] === 'true' || + !!this.toolboxItemDef_['expanded']); } override createDom_() { @@ -141,7 +132,7 @@ export class CollapsibleToolboxCategory extends ToolboxCategory implements override createIconDom_() { const toolboxIcon = document.createElement('span'); if (!this.parentToolbox_.isHorizontal()) { - const className = (this.cssConfig_ as AnyDuringMigration)['icon']; + const className = this.cssConfig_['icon']; if (className) { dom.addClass(toolboxIcon, className); } @@ -161,7 +152,7 @@ export class CollapsibleToolboxCategory extends ToolboxCategory implements protected createSubCategoriesDom_(subcategories: IToolboxItem[]): HTMLDivElement { const contentsContainer = document.createElement('div'); - const className = (this.cssConfig_ as AnyDuringMigration)['contents']; + const className = this.cssConfig_['contents']; if (className) { dom.addClass(contentsContainer, className); } diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 9b700fcf7..8c1aeb577 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -29,6 +29,7 @@ import type {IDraggable} from '../interfaces/i_draggable.js'; import type {IFlyout} from '../interfaces/i_flyout.js'; import type {IKeyboardAccessible} from '../interfaces/i_keyboard_accessible.js'; import type {ISelectableToolboxItem} from '../interfaces/i_selectable_toolbox_item.js'; +import {isSelectableToolboxItem} from '../interfaces/i_selectable_toolbox_item.js'; import type {IStyleable} from '../interfaces/i_styleable.js'; import type {IToolbox} from '../interfaces/i_toolbox.js'; import type {IToolboxItem} from '../interfaces/i_toolbox_item.js'; @@ -100,7 +101,6 @@ export class Toolbox extends DeleteArea implements IAutoHideable, * Ex: [[node, name, func], [node, name, func]]. */ protected boundEvents_: browserEvents.Data[] = []; - override wouldDelete_: AnyDuringMigration; /** The workspace this toolbox is on. */ protected readonly workspace_: WorkspaceSvg; @@ -112,10 +112,9 @@ export class Toolbox extends DeleteArea implements IAutoHideable, this.workspace_ = workspace; /** The JSON describing the contents of this toolbox. */ - // AnyDuringMigration because: Type 'ToolboxInfo | { contents: never[]; }' - // is not assignable to type 'ToolboxInfo'. - this.toolboxDef_ = (workspace.options.languageTree || {'contents': []}) as - AnyDuringMigration; + this.toolboxDef_ = + (workspace.options.languageTree || + {contents: new Array()}); /** Whether the toolbox should be laid out horizontally. */ this.horizontalLayout_ = workspace.options.horizontalLayout; @@ -299,9 +298,8 @@ export class Toolbox extends DeleteArea implements IAutoHideable, if (!handled && this.selectedItem_) { // TODO(#6097): Figure out who implements onKeyDown and which interface it // should be part of. - const untypedItem = this.selectedItem_ as AnyDuringMigration; - if (untypedItem.onKeyDown) { - handled = untypedItem.onKeyDown(e); + if ((this.selectedItem_ as any).onKeyDown) { + handled = (this.selectedItem_ as any).onKeyDown(e); } } @@ -796,33 +794,20 @@ export class Toolbox extends DeleteArea implements IAutoHideable, setSelectedItem(newItem: IToolboxItem|null) { const oldItem = this.selectedItem_; - if (!newItem && !oldItem || newItem && !newItem.isSelectable()) { + if (!newItem && !oldItem || newItem && !isSelectableToolboxItem(newItem)) { return; } - newItem = newItem as ISelectableToolboxItem; - // AnyDuringMigration because: Argument of type 'IToolboxItem' is not - // assignable to parameter of type 'ISelectableToolboxItem'. - if (this.shouldDeselectItem_(oldItem, newItem as AnyDuringMigration) && - oldItem !== null) { + if (this.shouldDeselectItem_(oldItem, newItem) && oldItem !== null) { this.deselectItem_(oldItem); } - // AnyDuringMigration because: Argument of type 'IToolboxItem' is not - // assignable to parameter of type 'ISelectableToolboxItem'. - if (this.shouldSelectItem_(oldItem, newItem as AnyDuringMigration) && - newItem !== null) { - // AnyDuringMigration because: Argument of type 'IToolboxItem' is not - // assignable to parameter of type 'ISelectableToolboxItem'. - this.selectItem_(oldItem, newItem as AnyDuringMigration); + if (this.shouldSelectItem_(oldItem, newItem) && newItem !== null) { + this.selectItem_(oldItem, newItem); } - // AnyDuringMigration because: Argument of type 'IToolboxItem' is not - // assignable to parameter of type 'ISelectableToolboxItem'. - this.updateFlyout_(oldItem, newItem as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'IToolboxItem' is not - // assignable to parameter of type 'ISelectableToolboxItem'. - this.fireSelectEvent_(oldItem, newItem as AnyDuringMigration); + this.updateFlyout_(oldItem, newItem); + this.fireSelectEvent_(oldItem, newItem); } /** @@ -1044,11 +1029,10 @@ export class Toolbox extends DeleteArea implements IAutoHideable, this.boundEvents_ = []; this.contents_ = []; - // AnyDuringMigration because: Argument of type 'HTMLDivElement | null' is - // not assignable to parameter of type 'Element'. - this.workspace_.getThemeManager().unsubscribe( - this.HtmlDiv as AnyDuringMigration); - dom.removeNode(this.HtmlDiv); + if (this.HtmlDiv) { + this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv); + dom.removeNode(this.HtmlDiv); + } } } diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index 89b2fdbb2..28a64b778 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -99,6 +99,7 @@ export interface StaticCategoryInfo { colour: string|undefined; cssconfig: CategoryCssConfig|undefined; hidden: string|undefined; + expanded?: string|boolean; } /** @@ -114,6 +115,7 @@ export interface DynamicCategoryInfo { colour: string|undefined; cssconfig: CategoryCssConfig|undefined; hidden: string|undefined; + expanded?: string|boolean; } /** diff --git a/core/workspace.ts b/core/workspace.ts index 4db632f96..4018cef9f 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -172,22 +172,11 @@ export class Workspace implements IASTNodeLocation { */ private sortObjects_(a: Block|WorkspaceComment, b: Block|WorkspaceComment): number { - // AnyDuringMigration because: Property 'getRelativeToSurfaceXY' does not - // exist on type 'Block | WorkspaceComment'. - const aXY = (a as AnyDuringMigration).getRelativeToSurfaceXY(); - // AnyDuringMigration because: Property 'getRelativeToSurfaceXY' does not - // exist on type 'Block | WorkspaceComment'. - const bXY = (b as AnyDuringMigration).getRelativeToSurfaceXY(); - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'. - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'. - return aXY.y + - (Workspace.prototype.sortObjects_ as AnyDuringMigration).offset * - aXY.x - - (bXY.y + - (Workspace.prototype.sortObjects_ as AnyDuringMigration).offset * - bXY.x); + const offset = + Math.sin(math.toRadians(Workspace.SCAN_ANGLE)) * (this.RTL ? -1 : 1); + const aXY = a.getRelativeToSurfaceXY(); + const bXY = b.getRelativeToSurfaceXY(); + return aXY.y + offset * aXY.x - (bXY.y + offset * bXY.x); } /** @@ -221,17 +210,7 @@ export class Workspace implements IASTNodeLocation { // 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'. - (this.sortObjects_ as AnyDuringMigration).offset = - Math.sin(math.toRadians(Workspace.SCAN_ANGLE)); - if (this.RTL) { - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => - // number'. - (this.sortObjects_ as AnyDuringMigration).offset *= -1; - } - blocks.sort(this.sortObjects_); + blocks.sort(this.sortObjects_.bind(this)); } return blocks; } @@ -274,20 +253,10 @@ export class Workspace implements IASTNodeLocation { } const blocks = this.typedBlocksDB.get(type)!.slice(0); if (ordered && blocks && blocks.length > 1) { - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => number'. - (this.sortObjects_ as AnyDuringMigration).offset = - Math.sin(math.toRadians(Workspace.SCAN_ANGLE)); - if (this.RTL) { - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => - // number'. - (this.sortObjects_ as AnyDuringMigration).offset *= -1; - } - blocks.sort(this.sortObjects_); + blocks.sort(this.sortObjects_.bind(this)); } - return blocks.filter(function(block: AnyDuringMigration) { + return blocks.filter(function(block: Block) { return !block.isInsertionMarker(); }); } @@ -340,17 +309,7 @@ export class Workspace implements IASTNodeLocation { // 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'. - (this.sortObjects_ as AnyDuringMigration).offset = - Math.sin(math.toRadians(Workspace.SCAN_ANGLE)); - if (this.RTL) { - // AnyDuringMigration because: Property 'offset' does not exist on type - // '(a: Block | WorkspaceComment, b: Block | WorkspaceComment) => - // number'. - (this.sortObjects_ as AnyDuringMigration).offset *= -1; - } - comments.sort(this.sortObjects_); + comments.sort(this.sortObjects_.bind(this)); } return comments; } @@ -363,7 +322,7 @@ export class Workspace implements IASTNodeLocation { * @returns Array of blocks. */ getAllBlocks(ordered: boolean): Block[] { - let blocks: AnyDuringMigration[]; + let blocks: Block[]; if (ordered) { // Slow, but ordered. const topBlocks = this.getTopBlocks(true); @@ -598,7 +557,7 @@ export class Workspace implements IASTNodeLocation { * to be created). * @returns True if there is capacity for the given map, false otherwise. */ - isCapacityAvailable(typeCountsMap: AnyDuringMigration): boolean { + isCapacityAvailable(typeCountsMap: {[key: string]: number}): boolean { if (!this.hasBlockLimits()) { return true; } @@ -661,9 +620,9 @@ export class Workspace implements IASTNodeLocation { // Do another undo/redo if the next one is of the same group. while (inputStack.length && inputEvent.group && inputEvent.group === inputStack[inputStack.length - 1].group) { - // AnyDuringMigration because: Argument of type 'Abstract | undefined' is - // not assignable to parameter of type 'Abstract'. - events.push(inputStack.pop() as AnyDuringMigration); + const event = inputStack.pop(); + if (!event) continue; + events.push(event); } // Push these popped events on the opposite stack. for (let i = 0; i < events.length; i++) { diff --git a/core/workspace_comment.ts b/core/workspace_comment.ts index 6e218c858..8870c6245 100644 --- a/core/workspace_comment.ts +++ b/core/workspace_comment.ts @@ -154,7 +154,7 @@ export class WorkspaceComment { * This is not valid if the comment is currently being dragged. * @internal */ - getXY(): Coordinate { + getRelativeToSurfaceXY(): Coordinate { return new Coordinate(this.xy_.x, this.xy_.y); } diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 329d37ceb..4a86e89f9 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -88,7 +88,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements private autoLayout_ = false; // Create core elements for the block. private readonly svgGroup_: SVGElement; - svgRect_: AnyDuringMigration; + svgRect_: SVGRectElement; /** Whether the comment is rendered onscreen and is a part of the DOM. */ private rendered_ = false; @@ -296,20 +296,18 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements * @returns Object with .x and .y properties in workspace coordinates. * @internal */ - getRelativeToSurfaceXY(): Coordinate { + override getRelativeToSurfaceXY(): Coordinate { let x = 0; let y = 0; - let element = this.getSvgRoot(); + let element: Node|null = this.getSvgRoot(); if (element) { do { // Loop through this comment and every parent. const xy = svgMath.getRelativeXY(element as Element); x += xy.x; y += xy.y; - // AnyDuringMigration because: Type 'ParentNode | null' is not - // assignable to type 'SVGElement'. - element = element.parentNode as AnyDuringMigration; + element = element.parentNode; } while (element && element !== this.workspace.getBubbleCanvas() && element !== null); } @@ -533,21 +531,11 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements } const element = this.toXml(opt_noId); const xy = this.getRelativeToSurfaceXY(); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. element.setAttribute( - 'x', - Math.round(this.workspace.RTL ? width - xy.x : xy.x) as - AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - element.setAttribute('y', Math.round(xy.y) as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - element.setAttribute('h', this.getHeight() as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - element.setAttribute('w', this.getWidth() as AnyDuringMigration); + 'x', String(Math.round(this.workspace.RTL ? width - xy.x : xy.x))); + element.setAttribute('y', String(Math.round(xy.y))); + element.setAttribute('h', String(this.getHeight())); + element.setAttribute('w', String(this.getWidth())); return element; } @@ -588,16 +576,12 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements const size = this.getHeightWidth(); // Add text area - this.createEditor_(); - // AnyDuringMigration because: Argument of type 'SVGForeignObjectElement | - // null' is not assignable to parameter of type 'Node'. - this.svgGroup_.appendChild(this.foreignObject_ as AnyDuringMigration); + const foreignObject = this.createEditor_(); + this.svgGroup_.appendChild(foreignObject); this.svgHandleTarget_ = dom.createSvgElement( Svg.RECT, {'class': 'blocklyCommentHandleTarget', 'x': 0, 'y': 0}); - // AnyDuringMigration because: Argument of type 'SVGRectElement | null' is - // not assignable to parameter of type 'Node'. - this.svgGroup_.appendChild(this.svgHandleTarget_ as AnyDuringMigration); + this.svgGroup_.appendChild(this.svgHandleTarget_); this.svgRectTarget_ = dom.createSvgElement(Svg.RECT, { 'class': 'blocklyCommentTarget', 'x': 0, @@ -605,9 +589,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'rx': BORDER_RADIUS, 'ry': BORDER_RADIUS, }); - // AnyDuringMigration because: Argument of type 'SVGRectElement | null' is - // not assignable to parameter of type 'Node'. - this.svgGroup_.appendChild(this.svgRectTarget_ as AnyDuringMigration); + this.svgGroup_.appendChild(this.svgRectTarget_); // Add the resize icon this.addResizeDom_(); @@ -671,10 +653,10 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements textarea.readOnly = !this.isEditable(); body.appendChild(textarea); this.textarea_ = textarea; - this.foreignObject_!.appendChild(body); + this.foreignObject_.appendChild(body); // Don't zoom with mousewheel. browserEvents.conditionalBind( - textarea, 'wheel', this, function(e: AnyDuringMigration) { + textarea, 'wheel', this, function(e: WheelEvent) { e.stopPropagation(); }); browserEvents.conditionalBind( @@ -682,9 +664,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements function(this: WorkspaceCommentSvg, _e: Event) { this.setContent(textarea.value); }); - // AnyDuringMigration because: Type 'SVGForeignObjectElement | null' is not - // assignable to type 'Element'. - return this.foreignObject_ as AnyDuringMigration; + return this.foreignObject_; } /** Add the resize icon to the DOM */ @@ -692,14 +672,10 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements this.resizeGroup_ = dom.createSvgElement( Svg.G, {'class': this.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE'}, this.svgGroup_); - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. dom.createSvgElement( Svg.POLYGON, {'points': '0,x x,x x,0'.replace(/x/g, RESIZE_SIZE.toString())}, - this.resizeGroup_ as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. + this.resizeGroup_); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', @@ -708,9 +684,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'x2': RESIZE_SIZE - 1, 'y2': RESIZE_SIZE / 3, }, - this.resizeGroup_ as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. + this.resizeGroup_); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', @@ -719,22 +693,18 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'x2': RESIZE_SIZE - 1, 'y2': RESIZE_SIZE * 2 / 3, }, - this.resizeGroup_ as AnyDuringMigration); + this.resizeGroup_); } /** Add the delete icon to the DOM */ private addDeleteDom_() { this.deleteGroup_ = dom.createSvgElement( Svg.G, {'class': 'blocklyCommentDeleteIcon'}, this.svgGroup_); - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. this.deleteIconBorder_ = dom.createSvgElement( Svg.CIRCLE, {'class': 'blocklyDeleteIconShape', 'r': '7', 'cx': '7.5', 'cy': '7.5'}, - this.deleteGroup_ as AnyDuringMigration); + this.deleteGroup_); // x icon. - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. dom.createSvgElement( Svg.LINE, { 'x1': '5', @@ -744,9 +714,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'stroke': '#fff', 'stroke-width': '2', }, - this.deleteGroup_ as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'SVGGElement | null' is not - // assignable to parameter of type 'Element | undefined'. + this.deleteGroup_); dom.createSvgElement( Svg.LINE, { 'x1': '5', @@ -756,7 +724,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'stroke': '#fff', 'stroke-width': '2', }, - this.deleteGroup_ as AnyDuringMigration); + this.deleteGroup_); } /** @@ -867,17 +835,15 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements const topOffset = WorkspaceCommentSvg.TOP_OFFSET; const textOffset = TEXTAREA_OFFSET * 2; - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.foreignObject_!.setAttribute( - 'width', size.width as AnyDuringMigration); - this.foreignObject_!.setAttribute( - 'height', (size.height - topOffset).toString()); + this.foreignObject_?.setAttribute('width', `${size.width}`); + this.foreignObject_?.setAttribute('height', `${size.height - topOffset}`); if (this.RTL) { - this.foreignObject_!.setAttribute('x', (-size.width).toString()); + this.foreignObject_?.setAttribute('x', `${- size.width}`); } - this.textarea_!.style.width = size.width - textOffset + 'px'; - this.textarea_!.style.height = size.height - textOffset - topOffset + 'px'; + + if (!this.textarea_) return; + this.textarea_.style.width = size.width - textOffset + 'px'; + this.textarea_.style.height = size.height - textOffset - topOffset + 'px'; } /** @@ -892,24 +858,16 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements height = Math.max(height, 20 + WorkspaceCommentSvg.TOP_OFFSET); this.width_ = width; this.height_ = height; - this.svgRect_.setAttribute('width', width); - this.svgRect_.setAttribute('height', height); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.svgRectTarget_!.setAttribute('width', width as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.svgRectTarget_!.setAttribute('height', height as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.svgHandleTarget_!.setAttribute('width', width as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not assignable - // to parameter of type 'string'. - this.svgHandleTarget_!.setAttribute( - 'height', WorkspaceCommentSvg.TOP_OFFSET as AnyDuringMigration); + this.svgRect_.setAttribute('width', `${width}`); + this.svgRect_.setAttribute('height', `${height}`); + this.svgRectTarget_?.setAttribute('width', `${width}`); + this.svgRectTarget_?.setAttribute('height', `${height}`); + this.svgHandleTarget_?.setAttribute('width', `${width}`); + this.svgHandleTarget_?.setAttribute( + 'height', `${WorkspaceCommentSvg.TOP_OFFSET}`); if (this.RTL) { this.svgRect_.setAttribute('transform', 'scale(-1 1)'); - this.svgRectTarget_!.setAttribute('transform', 'scale(-1 1)'); + this.svgRectTarget_?.setAttribute('transform', 'scale(-1 1)'); } if (this.resizeGroup_) { @@ -919,7 +877,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'transform', 'translate(' + (-width + RESIZE_SIZE) + ',' + (height - RESIZE_SIZE) + ') scale(-1 1)'); - this.deleteGroup_!.setAttribute( + this.deleteGroup_?.setAttribute( 'transform', 'translate(' + (-width + RESIZE_SIZE) + ',' + -RESIZE_SIZE + ') scale(-1 1)'); @@ -928,7 +886,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements 'transform', 'translate(' + (width - RESIZE_SIZE) + ',' + (height - RESIZE_SIZE) + ')'); - this.deleteGroup_!.setAttribute( + this.deleteGroup_?.setAttribute( 'transform', 'translate(' + (width - RESIZE_SIZE) + ',' + -RESIZE_SIZE + ')'); } diff --git a/tests/mocha/workspace_comment_test.js b/tests/mocha/workspace_comment_test.js index 0ea07b88b..1fe3bfc76 100644 --- a/tests/mocha/workspace_comment_test.js +++ b/tests/mocha/workspace_comment_test.js @@ -152,14 +152,14 @@ suite('Workspace comment', function() { }); test('Initial position', function() { - const xy = this.comment.getXY(); + const xy = this.comment.getRelativeToSurfaceXY(); chai.assert.equal(xy.x, 0, 'Initial X position'); chai.assert.equal(xy.y, 0, 'Initial Y position'); }); test('moveBy', function() { this.comment.moveBy(10, 100); - const xy = this.comment.getXY(); + const xy = this.comment.getRelativeToSurfaceXY(); chai.assert.equal(xy.x, 10, 'New X position'); chai.assert.equal(xy.y, 100, 'New Y position'); }); From a96eec8a70627485562f2619d5b31450ea837b23 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 3 Feb 2023 14:44:53 -0800 Subject: [PATCH 066/141] fix: don't splice into unmovable stacks (#6800) * fix: don't splice into unmovable stacks * chore: fix the tests and comments * chore: format * chore: clean up xml * chore: use test row blocks --- core/connection_checker.ts | 8 +- tests/mocha/connection_checker_test.js | 107 +++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) diff --git a/core/connection_checker.ts b/core/connection_checker.ts index ccb54f539..498245303 100644 --- a/core/connection_checker.ts +++ b/core/connection_checker.ts @@ -203,7 +203,7 @@ export class ConnectionChecker implements IConnectionChecker { /** * Check whether this connection can be made by dragging. * - * @param a Connection to compare. + * @param a Connection to compare (on the block that's being dragged). * @param b Connection to compare against. * @param distance The maximum allowable distance between connections. * @returns True if the connection is allowed during a drag. @@ -250,6 +250,12 @@ export class ConnectionChecker implements IConnectionChecker { !b.targetBlock()!.isShadow() && b.targetBlock()!.nextConnection) { return false; } + + // Don't offer to splice into a stack where the connected block is + // immovable. + if (b.targetBlock() && !b.targetBlock()!.isMovable()) { + return false; + } break; } default: diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js index d86d48bfb..960161316 100644 --- a/tests/mocha/connection_checker_test.js +++ b/tests/mocha/connection_checker_test.js @@ -341,4 +341,111 @@ suite('Connection checker', function() { chai.assert.isFalse(this.checker.doTypeChecks(this.con1, this.con2)); }); }); + suite('Dragging Checks', function() { + suite('Stacks', function() { + setup(function() { + this.workspace = Blockly.inject('blocklyDiv'); + // Load in three blocks: A and B are connected (next/prev); B is unmovable. + Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(` + + + + + + + + `), this.workspace); + [this.blockA, this.blockB, this.blockC] = this.workspace.getAllBlocks(true); + this.checker = this.workspace.connectionChecker; + }); + + test('Connect a stack', function() { + // block C is not connected to block A; both are movable. + chai.assert.isTrue( + this.checker.doDragChecks( + this.blockC.nextConnection, this.blockA.previousConnection, 9000), + 'Should connect two compatible stack blocks'); + }); + + test('Do not splice into unmovable stack', function() { + // Try to connect blockC above blockB. It shouldn't work because B is not movable + // and is already connected to A's nextConnection. + chai.assert.isFalse( + this.checker.doDragChecks( + this.blockC.previousConnection, this.blockA.nextConnection, 9000), + 'Should not splice in a block above an unmovable block'); + }); + + test('Connect to bottom of unmovable stack', function() { + // Try to connect blockC below blockB. + // This is allowed even though B is not movable because it is on B's nextConnection. + chai.assert.isTrue( + this.checker.doDragChecks( + this.blockC.previousConnection, this.blockB.nextConnection, 9000), + 'Should connect below an unmovable stack block'); + }); + + test('Connect to unconnected unmovable block', function() { + // Delete blockA. + this.blockA.dispose(); + + // Try to connect blockC above blockB. + // This is allowed because we're not splicing into a stack. + chai.assert.isTrue( + this.checker.doDragChecks( + this.blockC.nextConnection, this.blockB.previousConnection, 9000), + 'Should connect above an unconnected unmovable block' + ); + }); + }); + suite('Rows', function() { + setup(function() { + this.workspace = Blockly.inject('blocklyDiv'); + // Load 3 blocks: A and B are connected (input/output); B is unmovable. + Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(` + + + + + + + `), this.workspace); + [this.blockA, this.blockB, this.blockC] = this.workspace.getAllBlocks(true); + this.checker = this.workspace.connectionChecker; + }); + + test('Do not splice into unmovable block row', function() { + // Try to connect C's output to A's input. Should fail because + // A is already connected to B, which is unmovable. + const inputConnection = this.blockA.inputList[0].connection; + chai.assert.isFalse( + this.checker.doDragChecks(this.blockC.outputConnection, inputConnection, 9000), + 'Should not splice in a block before an unmovable block' + ); + }); + + test('Connect to end of unmovable block', function() { + // Make blockC unmovable + this.blockC.setMovable(false); + // Try to connect A's output to C's input. This is allowed. + const inputConnection = this.blockC.inputList[0].connection; + chai.assert.isTrue( + this.checker.doDragChecks(this.blockA.outputConnection, inputConnection, 9000), + 'Should connect to end of unmovable block' + ); + }); + + test('Connect to unconnected unmovable block', function() { + // Delete blockA + this.blockA.dispose(); + + // Try to connect C's input to B's output. Allowed because B is now unconnected. + const inputConnection = this.blockC.inputList[0].connection; + chai.assert.isTrue( + this.checker.doDragChecks(inputConnection, this.blockB.outputConnection, 9000), + 'Should connect to unconnected unmovable block' + ); + }); + }); + }); }); From 1d1a927628241f72a464e31f708f4b35ffbd3ab1 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 6 Feb 2023 10:08:55 -0800 Subject: [PATCH 067/141] chore: remove alias comments (#6816) * chore: remove alias comments * chore: format * chore: remove extra newlines * chore: fix bad replaces --- core/block.ts | 2 - core/block_animations.ts | 4 - core/block_dragger.ts | 2 - core/block_svg.ts | 2 - core/blockly.ts | 35 --------- core/blockly_options.ts | 2 - core/blocks.ts | 2 - core/browser_events.ts | 9 --- core/bubble.ts | 2 - core/bubble_dragger.ts | 2 - core/bump_objects.ts | 3 - core/clipboard.ts | 3 - core/comment.ts | 2 - core/common.ts | 12 --- core/component_manager.ts | 2 - core/config.ts | 6 -- core/connection.ts | 2 - core/connection_checker.ts | 2 - core/connection_db.ts | 2 - core/connection_type.ts | 2 - core/constants.ts | 4 - core/contextmenu.ts | 11 --- core/contextmenu_items.ts | 27 ------- core/contextmenu_registry.ts | 2 - core/css.ts | 4 - core/delete_area.ts | 2 - core/dialog.ts | 6 -- core/drag_target.ts | 2 - core/events/events_abstract.ts | 3 - core/events/events_block_base.ts | 2 - core/events/events_block_change.ts | 2 - core/events/events_block_create.ts | 2 - core/events/events_block_delete.ts | 2 - core/events/events_block_drag.ts | 2 - core/events/events_block_move.ts | 2 - core/events/events_bubble_open.ts | 2 - core/events/events_click.ts | 2 - core/events/events_comment_base.ts | 2 - core/events/events_comment_change.ts | 2 - core/events/events_comment_create.ts | 2 - core/events/events_comment_delete.ts | 2 - core/events/events_comment_move.ts | 2 - core/events/events_marker_move.ts | 2 - core/events/events_selected.ts | 2 - core/events/events_theme_change.ts | 2 - core/events/events_toolbox_item_select.ts | 2 - core/events/events_trashcan_open.ts | 2 - core/events/events_ui.ts | 1 - core/events/events_ui_base.ts | 2 - core/events/events_var_base.ts | 2 - core/events/events_var_create.ts | 2 - core/events/events_viewport.ts | 2 - core/events/utils.ts | 73 ------------------- core/events/workspace_events.ts | 2 - core/extensions.ts | 8 -- core/field.ts | 1 - core/field_angle.ts | 2 - core/field_checkbox.ts | 2 - core/field_colour.ts | 2 - core/field_dropdown.ts | 2 - core/field_image.ts | 2 - core/field_input.ts | 1 - core/field_label.ts | 2 - core/field_label_serializable.ts | 2 - core/field_multilineinput.ts | 2 - core/field_number.ts | 2 - core/field_registry.ts | 3 - core/field_textinput.ts | 2 - core/field_variable.ts | 2 - core/flyout_base.ts | 2 - core/flyout_button.ts | 2 - core/flyout_horizontal.ts | 2 - core/flyout_metrics_manager.ts | 2 - core/flyout_vertical.ts | 2 - core/generator.ts | 1 - core/gesture.ts | 2 - core/grid.ts | 2 - core/icon.ts | 2 - core/inject.ts | 1 - core/input.ts | 3 - core/input_types.ts | 2 - core/insertion_marker_manager.ts | 2 - core/interfaces/i_ast_node_location.ts | 2 - core/interfaces/i_ast_node_location_svg.ts | 2 - .../i_ast_node_location_with_block.ts | 2 - core/interfaces/i_autohideable.ts | 2 - core/interfaces/i_block_dragger.ts | 2 - core/interfaces/i_bounded_element.ts | 2 - core/interfaces/i_bubble.ts | 2 - core/interfaces/i_collapsible_toolbox_item.ts | 2 - core/interfaces/i_component.ts | 2 - core/interfaces/i_connection_checker.ts | 2 - core/interfaces/i_contextmenu.ts | 1 - core/interfaces/i_copyable.ts | 1 - core/interfaces/i_deletable.ts | 2 - core/interfaces/i_delete_area.ts | 2 - core/interfaces/i_drag_target.ts | 2 - core/interfaces/i_draggable.ts | 2 - core/interfaces/i_flyout.ts | 2 - core/interfaces/i_keyboard_accessible.ts | 2 - core/interfaces/i_metrics_manager.ts | 2 - core/interfaces/i_movable.ts | 2 - core/interfaces/i_positionable.ts | 2 - core/interfaces/i_registrable.ts | 2 - core/interfaces/i_selectable.ts | 2 - core/interfaces/i_selectable_toolbox_item.ts | 2 - core/interfaces/i_serializer.ts | 2 - core/interfaces/i_styleable.ts | 2 - core/interfaces/i_toolbox.ts | 2 - core/interfaces/i_toolbox_item.ts | 2 - core/internal_constants.ts | 5 -- core/keyboard_nav/ast_node.ts | 3 - core/keyboard_nav/basic_cursor.ts | 3 - core/keyboard_nav/cursor.ts | 3 - core/keyboard_nav/marker.ts | 2 - core/keyboard_nav/tab_navigate_cursor.ts | 2 - core/marker_manager.ts | 2 - core/menu.ts | 2 - core/menuitem.ts | 2 - core/metrics_manager.ts | 2 - core/mutator.ts | 2 - core/names.ts | 3 - core/options.ts | 2 - core/positionable_helpers.ts | 7 -- core/procedures.ts | 15 ---- core/registry.ts | 11 --- core/rendered_connection.ts | 2 - core/renderers/common/block_rendering.ts | 3 - core/renderers/common/constants.ts | 2 - core/renderers/common/debug.ts | 3 - core/renderers/common/debugger.ts | 2 - core/renderers/common/drawer.ts | 2 - core/renderers/common/i_path_object.ts | 1 - core/renderers/common/info.ts | 2 - core/renderers/common/marker_svg.ts | 2 - core/renderers/common/path_object.ts | 2 - core/renderers/common/renderer.ts | 2 - core/renderers/geras/constants.ts | 2 - core/renderers/geras/drawer.ts | 2 - core/renderers/geras/highlight_constants.ts | 2 - core/renderers/geras/highlighter.ts | 2 - core/renderers/geras/info.ts | 2 - .../geras/measurables/inline_input.ts | 2 - .../geras/measurables/statement_input.ts | 2 - core/renderers/geras/path_object.ts | 2 - core/renderers/geras/renderer.ts | 2 - core/renderers/measurables/base.ts | 2 - core/renderers/measurables/bottom_row.ts | 2 - core/renderers/measurables/connection.ts | 2 - .../measurables/external_value_input.ts | 2 - core/renderers/measurables/field.ts | 2 - core/renderers/measurables/hat.ts | 2 - core/renderers/measurables/icon.ts | 2 - core/renderers/measurables/in_row_spacer.ts | 2 - core/renderers/measurables/inline_input.ts | 2 - .../renderers/measurables/input_connection.ts | 2 - core/renderers/measurables/input_row.ts | 2 - core/renderers/measurables/jagged_edge.ts | 2 - core/renderers/measurables/next_connection.ts | 2 - .../measurables/output_connection.ts | 2 - .../measurables/previous_connection.ts | 2 - core/renderers/measurables/round_corner.ts | 2 - core/renderers/measurables/row.ts | 2 - core/renderers/measurables/spacer_row.ts | 2 - core/renderers/measurables/square_corner.ts | 2 - core/renderers/measurables/statement_input.ts | 2 - core/renderers/measurables/top_row.ts | 2 - core/renderers/measurables/types.ts | 2 - core/renderers/minimalist/constants.ts | 2 - core/renderers/minimalist/drawer.ts | 2 - core/renderers/minimalist/info.ts | 2 - core/renderers/minimalist/renderer.ts | 2 - core/renderers/thrasos/info.ts | 2 - core/renderers/thrasos/renderer.ts | 2 - core/renderers/zelos/constants.ts | 2 - core/renderers/zelos/drawer.ts | 2 - core/renderers/zelos/info.ts | 2 - core/renderers/zelos/marker_svg.ts | 2 - .../renderers/zelos/measurables/bottom_row.ts | 2 - core/renderers/zelos/measurables/inputs.ts | 2 - .../zelos/measurables/row_elements.ts | 2 - core/renderers/zelos/measurables/top_row.ts | 2 - core/renderers/zelos/path_object.ts | 2 - core/renderers/zelos/renderer.ts | 2 - core/scrollbar.ts | 2 - core/scrollbar_pair.ts | 2 - core/serialization/blocks.ts | 9 --- core/serialization/exceptions.ts | 8 -- core/serialization/priorities.ts | 4 - core/serialization/registry.ts | 2 - core/serialization/variables.ts | 4 - core/serialization/workspaces.ts | 2 - core/shortcut_items.ts | 17 ----- core/shortcut_registry.ts | 2 - core/sprites.ts | 2 - core/theme.ts | 2 - core/theme/classic.ts | 2 - core/theme/zelos.ts | 2 - core/theme_manager.ts | 2 - core/toolbox/category.ts | 2 - core/toolbox/collapsible_category.ts | 2 - core/toolbox/separator.ts | 2 - core/toolbox/toolbox.ts | 2 - core/toolbox/toolbox_item.ts | 2 - core/tooltip.ts | 29 -------- core/touch.ts | 13 ---- core/trashcan.ts | 2 - core/utils.ts | 12 --- core/utils/aria.ts | 6 -- core/utils/array.ts | 1 - core/utils/colour.ts | 16 ---- core/utils/coordinate.ts | 2 - core/utils/deprecation.ts | 1 - core/utils/dom.ts | 25 ------- core/utils/idgenerator.ts | 2 - core/utils/keycodes.ts | 2 - core/utils/math.ts | 3 - core/utils/metrics.ts | 1 - core/utils/object.ts | 4 - core/utils/parsing.ts | 4 - core/utils/rect.ts | 2 - core/utils/sentinel.ts | 2 - core/utils/size.ts | 2 - core/utils/string.ts | 6 -- core/utils/style.ts | 8 -- core/utils/svg.ts | 2 - core/utils/svg_math.ts | 6 -- core/utils/svg_paths.ts | 8 -- core/utils/toolbox.ts | 35 --------- core/utils/useragent.ts | 8 -- core/utils/xml.ts | 8 -- core/variable_map.ts | 2 - core/variable_model.ts | 1 - core/variables.ts | 17 ----- core/variables_dynamic.ts | 4 - core/warning.ts | 2 - core/widgetdiv.ts | 10 --- core/workspace.ts | 2 - core/workspace_audio.ts | 2 - core/workspace_comment.ts | 2 - core/workspace_comment_svg.ts | 2 - core/workspace_dragger.ts | 2 - core/workspace_svg.ts | 3 - core/xml.ts | 13 ---- core/zoom_controls.ts | 2 - .../block_definition_extractor.js | 1 - .../blockfactory/block_exporter_controller.js | 1 - demos/blockfactory/block_exporter_tools.js | 1 - demos/blockfactory/block_exporter_view.js | 1 - .../blockfactory/block_library_controller.js | 1 - demos/blockfactory/block_library_storage.js | 1 - demos/blockfactory/block_library_view.js | 1 - demos/blockfactory/block_option.js | 1 - demos/blockfactory/factory.js | 1 - demos/blockfactory/standard_categories.js | 1 - .../workspacefactory/wfactory_controller.js | 1 - .../workspacefactory/wfactory_generator.js | 1 - .../workspacefactory/wfactory_init.js | 1 - .../workspacefactory/wfactory_model.js | 1 - tests/bootstrap.js | 1 - 260 files changed, 937 deletions(-) diff --git a/core/block.ts b/core/block.ts index 14b34972e..d9d0455e2 100644 --- a/core/block.ts +++ b/core/block.ts @@ -50,8 +50,6 @@ import type {Workspace} from './workspace.js'; /** * Class for one block. * Not normally called directly, workspace.newBlock() is preferred. - * - * @alias Blockly.Block */ export class Block implements IASTNodeLocation, IDeletable { /** diff --git a/core/block_animations.ts b/core/block_animations.ts index 9b2d6d0bd..d9d0c5bef 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -36,7 +36,6 @@ let wobblingBlock: BlockSvg|null = null; * Play some UI effects (sound, animation) when disposing of a block. * * @param block The block being disposed of. - * @alias Blockly.blockAnimations.disposeUiEffect * @internal */ export function disposeUiEffect(block: BlockSvg) { @@ -88,7 +87,6 @@ function disposeUiStep( * Play some UI effects (sound, ripple) after a connection has been established. * * @param block The block being connected. - * @alias Blockly.blockAnimations.connectionUiEffect * @internal */ export function connectionUiEffect(block: BlockSvg) { @@ -145,7 +143,6 @@ function connectionUiStep(ripple: SVGElement, start: Date, scale: number) { * Play some UI effects (sound, animation) when disconnecting a block. * * @param block The block being disconnected. - * @alias Blockly.blockAnimations.disconnectUiEffect * @internal */ export function disconnectUiEffect(block: BlockSvg) { @@ -196,7 +193,6 @@ function disconnectUiStep(block: BlockSvg, magnitude: number, start: Date) { /** * Stop the disconnect UI animation immediately. * - * @alias Blockly.blockAnimations.disconnectUiStop * @internal */ export function disconnectUiStop() { diff --git a/core/block_dragger.ts b/core/block_dragger.ts index 7673baf8b..4cd3d1b0a 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -34,8 +34,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a block dragger. It moves blocks around the workspace when they * are being dragged by a mouse or touch. - * - * @alias Blockly.BlockDragger */ export class BlockDragger implements IBlockDragger { /** The top block in the stack that is being dragged. */ diff --git a/core/block_svg.ts b/core/block_svg.ts index 789a76177..6d84c6d3f 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -61,8 +61,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a block's SVG representation. * Not normally called directly, workspace.newBlock() is preferred. - * - * @alias Blockly.BlockSvg */ export class BlockSvg extends Block implements IASTNodeLocationSvg, IBoundedElement, ICopyable, diff --git a/core/blockly.ts b/core/blockly.ts index c91d23294..ab81e516e 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -175,7 +175,6 @@ import {ZoomControls} from './zoom_controls.js'; * compiler to override this constant. * * @define {string} - * @alias Blockly.VERSION */ export const VERSION = 'uncompiled'; @@ -193,19 +192,16 @@ export const VERSION = 'uncompiled'; /** * @see Blockly.Input.Align.LEFT - * @alias Blockly.ALIGN_LEFT */ export const ALIGN_LEFT = Align.LEFT; /** * @see Blockly.Input.Align.CENTRE - * @alias Blockly.ALIGN_CENTRE */ export const ALIGN_CENTRE = Align.CENTRE; /** * @see Blockly.Input.Align.RIGHT - * @alias Blockly.ALIGN_RIGHT */ export const ALIGN_RIGHT = Align.RIGHT; /* @@ -214,31 +210,26 @@ export const ALIGN_RIGHT = Align.RIGHT; /** * @see ConnectionType.INPUT_VALUE - * @alias Blockly.INPUT_VALUE */ export const INPUT_VALUE = ConnectionType.INPUT_VALUE; /** * @see ConnectionType.OUTPUT_VALUE - * @alias Blockly.OUTPUT_VALUE */ export const OUTPUT_VALUE = ConnectionType.OUTPUT_VALUE; /** * @see ConnectionType.NEXT_STATEMENT - * @alias Blockly.NEXT_STATEMENT */ export const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT; /** * @see ConnectionType.PREVIOUS_STATEMENT - * @alias Blockly.PREVIOUS_STATEMENT */ export const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT; /** * @see inputTypes.DUMMY_INPUT - * @alias Blockly.DUMMY_INPUT */ export const DUMMY_INPUT = inputTypes.DUMMY; @@ -246,25 +237,21 @@ export const DUMMY_INPUT = inputTypes.DUMMY; /** * @see toolbox.Position.TOP - * @alias Blockly.TOOLBOX_AT_TOP */ export const TOOLBOX_AT_TOP = toolbox.Position.TOP; /** * @see toolbox.Position.BOTTOM - * @alias Blockly.TOOLBOX_AT_BOTTOM */ export const TOOLBOX_AT_BOTTOM = toolbox.Position.BOTTOM; /** * @see toolbox.Position.LEFT - * @alias Blockly.TOOLBOX_AT_LEFT */ export const TOOLBOX_AT_LEFT = toolbox.Position.LEFT; /** * @see toolbox.Position.RIGHT - * @alias Blockly.TOOLBOX_AT_RIGHT */ export const TOOLBOX_AT_RIGHT = toolbox.Position.RIGHT; @@ -281,7 +268,6 @@ export const TOOLBOX_AT_RIGHT = toolbox.Position.RIGHT; * * @param workspace Any workspace in the SVG. * @see Blockly.common.svgResize - * @alias Blockly.svgResize */ export const svgResize = common.svgResize; @@ -290,7 +276,6 @@ export const svgResize = common.svgResize; * * @param opt_onlyClosePopups Whether only popups should be closed. * @see Blockly.WorkspaceSvg.hideChaff - * @alias Blockly.hideChaff */ export function hideChaff(opt_onlyClosePopups?: boolean) { (common.getMainWorkspace() as WorkspaceSvg).hideChaff(opt_onlyClosePopups); @@ -302,14 +287,11 @@ export function hideChaff(opt_onlyClosePopups?: boolean) { * Blockly instances on a page. * * @see Blockly.common.getMainWorkspace - * @alias Blockly.getMainWorkspace */ export const getMainWorkspace = common.getMainWorkspace; /** * Returns the currently selected copyable object. - * - * @alias Blockly.common.getSelected */ export const getSelected = common.getSelected; @@ -319,7 +301,6 @@ export const getSelected = common.getSelected; * * @param jsonArray An array of JSON block definitions. * @see Blockly.common.defineBlocksWithJsonArray - * @alias Blockly.defineBlocksWithJsonArray */ export const defineBlocksWithJsonArray = common.defineBlocksWithJsonArray; @@ -331,7 +312,6 @@ export const defineBlocksWithJsonArray = common.defineBlocksWithJsonArray; * * @param container The container element. * @see Blockly.common.setParentContainer - * @alias Blockly.setParentContainer */ export const setParentContainer = common.setParentContainer; @@ -342,7 +322,6 @@ export const setParentContainer = common.setParentContainer; * @param workspace The workspace to resize. * @deprecated Use **workspace.resizeContents** instead. * @see Blockly.WorkspaceSvg.resizeContents - * @alias Blockly.resizeSvgContents */ function resizeSvgContentsLocal(workspace: WorkspaceSvg) { deprecation.warn( @@ -358,7 +337,6 @@ export const resizeSvgContents = resizeSvgContentsLocal; * @param toCopy Block or Workspace Comment to be copied. * @deprecated Use **Blockly.clipboard.copy** instead. * @see Blockly.clipboard.copy - * @alias Blockly.copy */ export function copy(toCopy: ICopyable) { deprecation.warn( @@ -373,7 +351,6 @@ export function copy(toCopy: ICopyable) { * @returns True if the paste was successful, false otherwise. * @deprecated Use **Blockly.clipboard.paste** instead. * @see Blockly.clipboard.paste - * @alias Blockly.paste */ export function paste(): boolean { deprecation.warn( @@ -388,7 +365,6 @@ export function paste(): boolean { * @param toDuplicate Block or Workspace Comment to be copied. * @deprecated Use **Blockly.clipboard.duplicate** instead. * @see Blockly.clipboard.duplicate - * @alias Blockly.duplicate */ export function duplicate(toDuplicate: ICopyable) { deprecation.warn( @@ -404,7 +380,6 @@ export function duplicate(toDuplicate: ICopyable) { * @returns True if number, false otherwise. * @deprecated Use **Blockly.utils.string.isNumber** instead. * @see Blockly.utils.string.isNumber - * @alias Blockly.isNumber */ export function isNumber(str: string): boolean { deprecation.warn( @@ -420,7 +395,6 @@ export function isNumber(str: string): boolean { * @returns RGB code, e.g. '#5ba65b'. * @deprecated Use **Blockly.utils.colour.hueToHex** instead. * @see Blockly.utils.colour.hueToHex - * @alias Blockly.hueToHex */ export function hueToHex(hue: number): string { deprecation.warn( @@ -442,7 +416,6 @@ export function hueToHex(hue: number): string { * @returns Opaque data that can be passed to unbindEvent_. * @deprecated Use **Blockly.browserEvents.bind** instead. * @see Blockly.browserEvents.bind - * @alias Blockly.bindEvent_ */ export function bindEvent_( node: EventTarget, name: string, thisObject: Object|null, @@ -461,7 +434,6 @@ export function bindEvent_( * @returns The function call. * @deprecated Use **Blockly.browserEvents.unbind** instead. * @see browserEvents.unbind - * @alias Blockly.unbindEvent_ */ export function unbindEvent_(bindData: browserEvents.Data): Function { deprecation.warn( @@ -487,7 +459,6 @@ export function unbindEvent_(bindData: browserEvents.Data): Function { * @returns Opaque data that can be passed to unbindEvent_. * @deprecated Use **Blockly.browserEvents.conditionalBind** instead. * @see browserEvents.conditionalBind - * @alias Blockly.bindEventWithChecks_ */ export function bindEventWithChecks_( node: EventTarget, name: string, thisObject: Object|null, func: Function, @@ -513,8 +484,6 @@ export const COLLAPSED_FIELD_NAME = constants.COLLAPSED_FIELD_NAME; * String for use in the "custom" attribute of a category in toolbox XML. * This string indicates that the category should be dynamically populated with * variable blocks. - * - * @alias Blockly.VARIABLE_CATEGORY_NAME */ export const VARIABLE_CATEGORY_NAME: string = Variables.CATEGORY_NAME; @@ -522,8 +491,6 @@ export const VARIABLE_CATEGORY_NAME: string = Variables.CATEGORY_NAME; * String for use in the "custom" attribute of a category in toolbox XML. * This string indicates that the category should be dynamically populated with * variable blocks. - * - * @alias Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME */ export const VARIABLE_DYNAMIC_CATEGORY_NAME: string = VariablesDynamic.CATEGORY_NAME; @@ -531,8 +498,6 @@ export const VARIABLE_DYNAMIC_CATEGORY_NAME: string = * String for use in the "custom" attribute of a category in toolbox XML. * This string indicates that the category should be dynamically populated with * procedure blocks. - * - * @alias Blockly.PROCEDURE_CATEGORY_NAME */ export const PROCEDURE_CATEGORY_NAME: string = Procedures.CATEGORY_NAME; diff --git a/core/blockly_options.ts b/core/blockly_options.ts index 8933bd637..6741def18 100644 --- a/core/blockly_options.ts +++ b/core/blockly_options.ts @@ -19,8 +19,6 @@ import type {ToolboxDefinition} from './utils/toolbox.js'; /** * Blockly options. - * - * @alias Blockly.BlocklyOptions */ export interface BlocklyOptions { collapse?: boolean; diff --git a/core/blocks.ts b/core/blocks.ts index cb3348c74..9d9466b7e 100644 --- a/core/blocks.ts +++ b/core/blocks.ts @@ -21,7 +21,5 @@ export type BlockDefinition = AnyDuringMigration; /** * A mapping of block type names to block prototype objects. - * - * @alias Blockly.blocks.Blocks */ export const Blocks: {[key: string]: BlockDefinition} = Object.create(null); diff --git a/core/browser_events.ts b/core/browser_events.ts index a36c7e537..c87655bda 100644 --- a/core/browser_events.ts +++ b/core/browser_events.ts @@ -20,8 +20,6 @@ import * as userAgent from './utils/useragent.js'; /** * Blockly opaque event data used to unbind events when using * `bind` and `conditionalBind`. - * - * @alias Blockly.browserEvents.Data */ export type Data = [EventTarget, string, (e: Event) => void][]; @@ -54,7 +52,6 @@ const PAGE_MODE_MULTIPLIER = 125; * simultaneous touches. False by default. * @param opt_noPreventDefault No-op, deprecated and will be removed in v10. * @returns Opaque data that can be passed to unbindEvent_. - * @alias Blockly.browserEvents.conditionalBind */ export function conditionalBind( node: EventTarget, name: string, thisObject: Object|null, func: Function, @@ -105,7 +102,6 @@ export function conditionalBind( * @param thisObject The value of 'this' in the function. * @param func Function to call when event is triggered. * @returns Opaque data that can be passed to unbindEvent_. - * @alias Blockly.browserEvents.bind */ export function bind( node: EventTarget, name: string, thisObject: Object|null, @@ -142,7 +138,6 @@ export function bind( * @param bindData Opaque data from bindEvent_. * This list is emptied during the course of calling this function. * @returns The function call. - * @alias Blockly.browserEvents.unbind */ export function unbind(bindData: Data): (e: Event) => void { // Accessing an element of the last property of the array is unsafe if the @@ -164,7 +159,6 @@ export function unbind(bindData: Data): (e: Event) => void { * * @param e An event. * @returns True if text input. - * @alias Blockly.browserEvents.isTargetInput */ export function isTargetInput(e: Event): boolean { if (e.target instanceof HTMLElement) { @@ -194,7 +188,6 @@ export function isTargetInput(e: Event): boolean { * * @param e Mouse event. * @returns True if right-click. - * @alias Blockly.browserEvents.isRightButton */ export function isRightButton(e: MouseEvent): boolean { if (e.ctrlKey && userAgent.MAC) { @@ -213,7 +206,6 @@ export function isRightButton(e: MouseEvent): boolean { * @param svg SVG element. * @param matrix Inverted screen CTM to use. * @returns Object with .x and .y properties. - * @alias Blockly.browserEvents.mouseToSvg */ export function mouseToSvg( e: MouseEvent, svg: SVGSVGElement, matrix: SVGMatrix|null): SVGPoint { @@ -232,7 +224,6 @@ export function mouseToSvg( * * @param e Mouse event. * @returns Scroll delta object with .x and .y properties. - * @alias Blockly.browserEvents.getScrollDeltaPixels */ export function getScrollDeltaPixels(e: WheelEvent): {x: number, y: number} { switch (e.deltaMode) { diff --git a/core/bubble.ts b/core/bubble.ts index 7f8a1eb3b..3107af725 100644 --- a/core/bubble.ts +++ b/core/bubble.ts @@ -29,8 +29,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for UI bubble. - * - * @alias Blockly.Bubble */ export class Bubble implements IBubble { /** Width of the border around the bubble. */ diff --git a/core/bubble_dragger.ts b/core/bubble_dragger.ts index 083faf734..45a0ba430 100644 --- a/core/bubble_dragger.ts +++ b/core/bubble_dragger.ts @@ -27,8 +27,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * Class for a bubble dragger. It moves things on the bubble canvas around the * workspace when they are being dragged by a mouse or touch. These can be * block comments, mutators, warnings, or workspace comments. - * - * @alias Blockly.BubbleDragger */ export class BubbleDragger { /** Which drag target the mouse pointer is over, if any. */ diff --git a/core/bump_objects.ts b/core/bump_objects.ts index cd2c754a4..301d65a96 100644 --- a/core/bump_objects.ts +++ b/core/bump_objects.ts @@ -35,7 +35,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * in workspace coordinates. * @param object The object to bump. * @returns True if block was bumped. - * @alias Blockly.bumpObjects.bumpIntoBounds */ function bumpObjectIntoBounds( workspace: WorkspaceSvg, scrollMetrics: ContainerRegion, @@ -87,7 +86,6 @@ export const bumpIntoBounds = bumpObjectIntoBounds; * * @param workspace The workspace to handle. * @returns The event handler. - * @alias Blockly.bumpObjects.bumpIntoBoundsHandler */ export function bumpIntoBoundsHandler(workspace: WorkspaceSvg): (p1: Abstract) => void { @@ -167,7 +165,6 @@ function extractObjectFromEvent( * Bumps the top objects in the given workspace into bounds. * * @param workspace The workspace. - * @alias Blockly.bumpObjects.bumpTopObjectsIntoBounds */ export function bumpTopObjectsIntoBounds(workspace: WorkspaceSvg) { const metricsManager = workspace.getMetricsManager(); diff --git a/core/clipboard.ts b/core/clipboard.ts index 4b3bcbb6f..2056e950f 100644 --- a/core/clipboard.ts +++ b/core/clipboard.ts @@ -22,7 +22,6 @@ let copyData: CopyData|null = null; * Copy a block or workspace comment onto the local clipboard. * * @param toCopy Block or Workspace Comment to be copied. - * @alias Blockly.clipboard.copy * @internal */ export function copy(toCopy: ICopyable) { @@ -40,7 +39,6 @@ function copyInternal(toCopy: ICopyable) { * Paste a block or workspace comment on to the main workspace. * * @returns The pasted thing if the paste was successful, null otherwise. - * @alias Blockly.clipboard.paste * @internal */ export function paste(): ICopyable|null { @@ -66,7 +64,6 @@ export function paste(): ICopyable|null { * @param toDuplicate Block or Workspace Comment to be duplicated. * @returns The block or workspace comment that was duplicated, or null if the * duplication failed. - * @alias Blockly.clipboard.duplicate * @internal */ export function duplicate(toDuplicate: ICopyable): ICopyable|null { diff --git a/core/comment.ts b/core/comment.ts index d716aa2f0..3dc4e31ef 100644 --- a/core/comment.ts +++ b/core/comment.ts @@ -32,8 +32,6 @@ import {Svg} from './utils/svg.js'; /** * Class for a comment. - * - * @alias Blockly.Comment */ export class Comment extends Icon { private readonly model: CommentModel; diff --git a/core/common.ts b/core/common.ts index 3181e88e7..a678ceef0 100644 --- a/core/common.ts +++ b/core/common.ts @@ -79,7 +79,6 @@ let mainWorkspace: Workspace; * page. * * @returns The main workspace. - * @alias Blockly.common.getMainWorkspace */ export function getMainWorkspace(): Workspace { return mainWorkspace; @@ -89,7 +88,6 @@ export function getMainWorkspace(): Workspace { * Sets last used main workspace. * * @param workspace The most recently used top level workspace. - * @alias Blockly.common.setMainWorkspace */ export function setMainWorkspace(workspace: Workspace) { mainWorkspace = workspace; @@ -102,8 +100,6 @@ let selected: ICopyable|null = null; /** * Returns the currently selected copyable object. - * - * @alias Blockly.common.getSelected */ export function getSelected(): ICopyable|null { return selected; @@ -115,7 +111,6 @@ export function getSelected(): ICopyable|null { * programmatically select a block, use `BlockSvg#select`. * * @param newSelection The newly selected block. - * @alias Blockly.common.setSelected * @internal */ export function setSelected(newSelection: ICopyable|null) { @@ -132,7 +127,6 @@ let parentContainer: Element|null; * Tooltip. * * @returns The parent container. - * @alias Blockly.common.getParentContainer */ export function getParentContainer(): Element|null { return parentContainer; @@ -145,7 +139,6 @@ export function getParentContainer(): Element|null { * This method is a NOP if called after the first `Blockly.inject`. * * @param newParent The container element. - * @alias Blockly.common.setParentContainer */ export function setParentContainer(newParent: Element) { parentContainer = newParent; @@ -159,7 +152,6 @@ export function setParentContainer(newParent: Element) { * Record the height/width of the SVG image. * * @param workspace Any workspace in the SVG. - * @alias Blockly.common.svgResize */ export function svgResize(workspace: WorkspaceSvg) { let mainWorkspace = workspace; @@ -201,7 +193,6 @@ export const draggingConnections: Connection[] = []; * statements (blocks that are not inside a value or statement input * of the block). * @returns Map of types to type counts for descendants of the bock. - * @alias Blockly.common.getBlockTypeCounts */ export function getBlockTypeCounts( block: Block, opt_stripFollowing?: boolean): {[key: string]: number} { @@ -243,7 +234,6 @@ function jsonInitFactory(jsonDef: AnyDuringMigration): () => void { * by the Blockly Developer Tools. * * @param jsonArray An array of JSON block definitions. - * @alias Blockly.common.defineBlocksWithJsonArray */ export function defineBlocksWithJsonArray(jsonArray: AnyDuringMigration[]) { TEST_ONLY.defineBlocksWithJsonArrayInternal(jsonArray); @@ -263,7 +253,6 @@ function defineBlocksWithJsonArrayInternal(jsonArray: AnyDuringMigration[]) { * @param jsonArray An array of JSON block definitions. * @returns A map of the block * definitions created. - * @alias Blockly.common.defineBlocksWithJsonArray */ export function createBlockDefinitionsFromJsonArray( jsonArray: AnyDuringMigration[]): {[key: string]: BlockDefinition} { @@ -292,7 +281,6 @@ export function createBlockDefinitionsFromJsonArray( * * @param blocks A map of block * type names to block definitions. - * @alias Blockly.common.defineBlocks */ export function defineBlocks(blocks: {[key: string]: BlockDefinition}) { // Iterate over own enumerable properties. diff --git a/core/component_manager.ts b/core/component_manager.ts index 7ba9986e4..426860a74 100644 --- a/core/component_manager.ts +++ b/core/component_manager.ts @@ -43,8 +43,6 @@ class Capability<_T> { /** * Manager for all items registered with the workspace. - * - * @alias Blockly.ComponentManager */ export class ComponentManager { static Capability = Capability; diff --git a/core/config.ts b/core/config.ts index aa8bc9f5e..e2b6c6988 100644 --- a/core/config.ts +++ b/core/config.ts @@ -39,7 +39,6 @@ export const config: Config = { /** * Number of pixels the mouse must move before a drag starts. * - * @alias Blockly.config.dragRadius */ dragRadius: 5, /** @@ -47,20 +46,17 @@ export const config: Config = { * flyout. Because the drag-intention is determined when this is reached, it * is larger than dragRadius so that the drag-direction is clearer. * - * @alias Blockly.config.flyoutDragRadius */ flyoutDragRadius: 10, /** * Maximum misalignment between connections for them to snap together. * - * @alias Blockly.config.snapRadius */ snapRadius: DEFAULT_SNAP_RADIUS, /** * Maximum misalignment between connections for them to snap together. * This should be the same as the snap radius. * - * @alias Blockly.config.connectingSnapRadius */ connectingSnapRadius: DEFAULT_SNAP_RADIUS, /** @@ -69,13 +65,11 @@ export const config: Config = { * this much closer to the matching connection on the block than it actually * is. * - * @alias Blockly.config.currentConnectionPreference */ currentConnectionPreference: 8, /** * Delay in ms between trigger and bumping unconnected block out of alignment. * - * @alias Blockly.config.bumpDelay */ bumpDelay: 250, }; diff --git a/core/connection.ts b/core/connection.ts index e495df85d..f5dc0a6bb 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -25,8 +25,6 @@ import * as Xml from './xml.js'; /** * Class for a connection between blocks. - * - * @alias Blockly.Connection */ export class Connection implements IASTNodeLocationWithBlock { /** Constants for checking whether two connections are compatible. */ diff --git a/core/connection_checker.ts b/core/connection_checker.ts index 498245303..599da547f 100644 --- a/core/connection_checker.ts +++ b/core/connection_checker.ts @@ -24,8 +24,6 @@ import type {RenderedConnection} from './rendered_connection.js'; /** * Class for connection type checking logic. - * - * @alias Blockly.ConnectionChecker */ export class ConnectionChecker implements IConnectionChecker { /** diff --git a/core/connection_db.ts b/core/connection_db.ts index e2a2da999..9320d9f28 100644 --- a/core/connection_db.ts +++ b/core/connection_db.ts @@ -24,8 +24,6 @@ import type {Coordinate} from './utils/coordinate.js'; * Database of connections. * Connections are stored in order of their vertical component. This way * connections in an area may be looked up quickly using a binary search. - * - * @alias Blockly.ConnectionDB */ export class ConnectionDB { /** Array of connections sorted by y position in workspace units. */ diff --git a/core/connection_type.ts b/core/connection_type.ts index 4e2d123f9..990b9a5af 100644 --- a/core/connection_type.ts +++ b/core/connection_type.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.ConnectionType'); /** * Enum for the type of a connection or input. - * - * @alias Blockly.ConnectionType */ export enum ConnectionType { // A right-facing value input. E.g. 'set item to' or 'return'. diff --git a/core/constants.ts b/core/constants.ts index 68e807a21..49ec99b91 100644 --- a/core/constants.ts +++ b/core/constants.ts @@ -15,14 +15,10 @@ goog.declareModuleId('Blockly.constants'); /** * The language-neutral ID given to the collapsed input. - * - * @alias Blockly.constants.COLLAPSED_INPUT_NAME */ export const COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT'; /** * The language-neutral ID given to the collapsed field. - * - * @alias Blockly.constants.COLLAPSED_FIELD_NAME */ export const COLLAPSED_FIELD_NAME = '_TEMP_COLLAPSED_FIELD'; diff --git a/core/contextmenu.ts b/core/contextmenu.ts index c7737a597..ec56d9038 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -44,7 +44,6 @@ const dummyOwner = {}; * Gets the block the context menu is currently attached to. * * @returns The block the context menu is attached to. - * @alias Blockly.ContextMenu.getCurrentBlock */ export function getCurrentBlock(): Block|null { return currentBlock; @@ -54,7 +53,6 @@ export function getCurrentBlock(): Block|null { * Sets the block the context menu is currently attached to. * * @param block The block the context menu is attached to. - * @alias Blockly.ContextMenu.setCurrentBlock */ export function setCurrentBlock(block: Block|null) { currentBlock = block; @@ -71,7 +69,6 @@ let menu_: Menu|null = null; * @param e Mouse event. * @param options Array of menu options. * @param rtl True if RTL, false if LTR. - * @alias Blockly.ContextMenu.show */ export function show( e: Event, options: (ContextMenuOption|LegacyContextMenuOption)[], @@ -200,8 +197,6 @@ function haltPropagation(e: Event) { /** * Hide the context menu. - * - * @alias Blockly.ContextMenu.hide */ export function hide() { WidgetDiv.hideIfOwner(dummyOwner); @@ -210,8 +205,6 @@ export function hide() { /** * Dispose of the menu. - * - * @alias Blockly.ContextMenu.dispose */ export function dispose() { if (menu_) { @@ -227,7 +220,6 @@ export function dispose() { * @param block Original block. * @param xml XML representation of new block. * @returns Function that creates a block. - * @alias Blockly.ContextMenu.callbackFactory */ export function callbackFactory(block: Block, xml: Element): Function { return () => { @@ -263,7 +255,6 @@ export function callbackFactory(block: Block, xml: Element): Function { * right-click originated. * @returns A menu option, * containing text, enabled, and a callback. - * @alias Blockly.ContextMenu.commentDeleteOption * @internal */ export function commentDeleteOption(comment: WorkspaceCommentSvg): @@ -287,7 +278,6 @@ export function commentDeleteOption(comment: WorkspaceCommentSvg): * right-click originated. * @returns A menu option, * containing text, enabled, and a callback. - * @alias Blockly.ContextMenu.commentDuplicateOption * @internal */ export function commentDuplicateOption(comment: WorkspaceCommentSvg): @@ -311,7 +301,6 @@ export function commentDuplicateOption(comment: WorkspaceCommentSvg): * @returns A menu option, containing text, enabled, and a callback. * @suppress {strictModuleDepCheck,checkTypes} Suppress checks while workspace * comments are not bundled in. - * @alias Blockly.ContextMenu.workspaceCommentOption * @internal */ export function workspaceCommentOption( diff --git a/core/contextmenu_items.ts b/core/contextmenu_items.ts index db87b2618..706ba4fbe 100644 --- a/core/contextmenu_items.ts +++ b/core/contextmenu_items.ts @@ -26,8 +26,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Option to undo previous action. - * - * @alias Blockly.ContextMenuItems.registerUndo */ export function registerUndo() { const undoOption: RegistryItem = { @@ -52,8 +50,6 @@ export function registerUndo() { /** * Option to redo previous action. - * - * @alias Blockly.ContextMenuItems.registerRedo */ export function registerRedo() { const redoOption: RegistryItem = { @@ -78,8 +74,6 @@ export function registerRedo() { /** * Option to clean up blocks. - * - * @alias Blockly.ContextMenuItems.registerCleanup */ export function registerCleanup() { const cleanOption: RegistryItem = { @@ -135,8 +129,6 @@ function toggleOption_(shouldCollapse: boolean, topBlocks: BlockSvg[]) { /** * Option to collapse all blocks. - * - * @alias Blockly.ContextMenuItems.registerCollapse */ export function registerCollapse() { const collapseOption: RegistryItem = { @@ -171,8 +163,6 @@ export function registerCollapse() { /** * Option to expand all blocks. - * - * @alias Blockly.ContextMenuItems.registerExpand */ export function registerExpand() { const expandOption: RegistryItem = { @@ -261,8 +251,6 @@ function deleteNext_(deleteList: BlockSvg[], eventGroup: string) { /** * Option to delete all blocks. - * - * @alias Blockly.ContextMenuItems.registerDeleteAll */ export function registerDeleteAll() { const deleteOption: RegistryItem = { @@ -323,8 +311,6 @@ function registerWorkspaceOptions_() { /** * Option to duplicate a block. - * - * @alias Blockly.ContextMenuItems.registerDuplicate */ export function registerDuplicate() { const duplicateOption: RegistryItem = { @@ -355,8 +341,6 @@ export function registerDuplicate() { /** * Option to add or remove block-level comment. - * - * @alias Blockly.ContextMenuItems.registerComment */ export function registerComment() { const commentOption: RegistryItem = { @@ -393,8 +377,6 @@ export function registerComment() { /** * Option to inline variables. - * - * @alias Blockly.ContextMenuItems.registerInline */ export function registerInline() { const inlineOption: RegistryItem = { @@ -428,8 +410,6 @@ export function registerInline() { /** * Option to collapse or expand a block. - * - * @alias Blockly.ContextMenuItems.registerCollapseExpandBlock */ export function registerCollapseExpandBlock() { const collapseExpandOption: RegistryItem = { @@ -457,8 +437,6 @@ export function registerCollapseExpandBlock() { /** * Option to disable or enable a block. - * - * @alias Blockly.ContextMenuItems.registerDisable */ export function registerDisable() { const disableOption: RegistryItem = { @@ -497,8 +475,6 @@ export function registerDisable() { /** * Option to delete a block. - * - * @alias Blockly.ContextMenuItems.registerDelete */ export function registerDelete() { const deleteOption: RegistryItem = { @@ -535,8 +511,6 @@ export function registerDelete() { /** * Option to open help for a block. - * - * @alias Blockly.ContextMenuItems.registerHelp */ export function registerHelp() { const helpOption: RegistryItem = { @@ -577,7 +551,6 @@ function registerBlockOptions_() { * Registers all default context menu items. This should be called once per * instance of ContextMenuRegistry. * - * @alias Blockly.ContextMenuItems.registerDefaultOptions * @internal */ export function registerDefaultOptions() { diff --git a/core/contextmenu_registry.ts b/core/contextmenu_registry.ts index 8f2a297b2..6f3eb5e1c 100644 --- a/core/contextmenu_registry.ts +++ b/core/contextmenu_registry.ts @@ -20,8 +20,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * Class for the registry of context menu items. This is intended to be a * singleton. You should not create a new instance, and only access this class * from ContextMenuRegistry.registry. - * - * @alias Blockly.ContextMenuRegistry */ export class ContextMenuRegistry { static registry: ContextMenuRegistry; diff --git a/core/css.ts b/core/css.ts index 1582b783f..2d024acca 100644 --- a/core/css.ts +++ b/core/css.ts @@ -21,7 +21,6 @@ let injected = false; * components such as fields and the toolbox to store separate CSS. * * @param cssContent Multiline CSS string or an array of single lines of CSS. - * @alias Blockly.Css.register */ export function register(cssContent: string) { if (injected) { @@ -40,7 +39,6 @@ export function register(cssContent: string) { * @param hasCss If false, don't inject CSS (providing CSS becomes the * document's responsibility). * @param pathToMedia Path from page to the Blockly media directory. - * @alias Blockly.Css.inject */ export function inject(hasCss: boolean, pathToMedia: string) { // Only inject the CSS once. @@ -67,8 +65,6 @@ export function inject(hasCss: boolean, pathToMedia: string) { /** * The CSS content for Blockly. - * - * @alias Blockly.Css.content */ let content = ` .blocklySvg { diff --git a/core/delete_area.ts b/core/delete_area.ts index 9bee66742..576d2475a 100644 --- a/core/delete_area.ts +++ b/core/delete_area.ts @@ -22,8 +22,6 @@ import type {IDraggable} from './interfaces/i_draggable.js'; /** * Abstract class for a component that can delete a block or bubble that is * dropped on top of it. - * - * @alias Blockly.DeleteArea */ export class DeleteArea extends DragTarget implements IDeleteArea { /** diff --git a/core/dialog.ts b/core/dialog.ts index c0d99d781..733eab90d 100644 --- a/core/dialog.ts +++ b/core/dialog.ts @@ -37,7 +37,6 @@ let promptImplementation = function( * * @param message The message to display to the user. * @param opt_callback The callback when the alert is dismissed. - * @alias Blockly.dialog.alert */ export function alert(message: string, opt_callback?: () => void) { alertImplementation(message, opt_callback); @@ -48,7 +47,6 @@ export function alert(message: string, opt_callback?: () => void) { * * @param alertFunction The function to be run. * @see Blockly.dialog.alert - * @alias Blockly.dialog.setAlert */ export function setAlert(alertFunction: (p1: string, p2?: () => void) => void) { alertImplementation = alertFunction; @@ -60,7 +58,6 @@ export function setAlert(alertFunction: (p1: string, p2?: () => void) => void) { * * @param message The message to display to the user. * @param callback The callback for handling user response. - * @alias Blockly.dialog.confirm */ export function confirm(message: string, callback: (p1: boolean) => void) { TEST_ONLY.confirmInternal(message, callback); @@ -79,7 +76,6 @@ function confirmInternal(message: string, callback: (p1: boolean) => void) { * * @param confirmFunction The function to be run. * @see Blockly.dialog.confirm - * @alias Blockly.dialog.setConfirm */ export function setConfirm( confirmFunction: (p1: string, p2: (p1: boolean) => void) => void) { @@ -95,7 +91,6 @@ export function setConfirm( * @param message The message to display to the user. * @param defaultValue The value to initialize the prompt with. * @param callback The callback for handling user response. - * @alias Blockly.dialog.prompt */ export function prompt( message: string, defaultValue: string, @@ -108,7 +103,6 @@ export function prompt( * * @param promptFunction The function to be run. * @see Blockly.dialog.prompt - * @alias Blockly.dialog.setPrompt */ export function setPrompt( promptFunction: (p1: string, p2: string, p3: (p1: string|null) => void) => diff --git a/core/drag_target.ts b/core/drag_target.ts index a8977bca2..5ef9d82cc 100644 --- a/core/drag_target.ts +++ b/core/drag_target.ts @@ -21,8 +21,6 @@ import type {Rect} from './utils/rect.js'; /** * Abstract class for a component with custom behaviour when a block or bubble * is dragged over or dropped on top of it. - * - * @alias Blockly.DragTarget */ export class DragTarget implements IDragTarget { /** diff --git a/core/events/events_abstract.ts b/core/events/events_abstract.ts index f22c9c3b8..2da378866 100644 --- a/core/events/events_abstract.ts +++ b/core/events/events_abstract.ts @@ -22,8 +22,6 @@ import * as eventUtils from './utils.js'; /** * Abstract class for an event. - * - * @alias Blockly.Events.Abstract */ export abstract class Abstract { /** @@ -52,7 +50,6 @@ export abstract class Abstract { /** Type of this event. */ type = ''; - /** @alias Blockly.Events.Abstract */ constructor() { this.group = eventUtils.getGroup(); this.recordUndo = eventUtils.getRecordUndo(); diff --git a/core/events/events_block_base.ts b/core/events/events_block_base.ts index 8d2c79665..b279af43b 100644 --- a/core/events/events_block_base.ts +++ b/core/events/events_block_base.ts @@ -21,8 +21,6 @@ import {Abstract as AbstractEvent, AbstractEventJson} from './events_abstract.js /** * Abstract class for any event related to blocks. - * - * @alias Blockly.Events.BlockBase */ export class BlockBase extends AbstractEvent { override isBlank = true; diff --git a/core/events/events_block_change.ts b/core/events/events_block_change.ts index 288fe0e46..a81be70d9 100644 --- a/core/events/events_block_change.ts +++ b/core/events/events_block_change.ts @@ -26,8 +26,6 @@ import * as eventUtils from './utils.js'; /** * Notifies listeners when some element of a block has changed (e.g. * field values, comments, etc). - * - * @alias Blockly.Events.BlockChange */ export class BlockChange extends BlockBase { override type = eventUtils.BLOCK_CHANGE; diff --git a/core/events/events_block_create.ts b/core/events/events_block_create.ts index d88f84388..41fb63988 100644 --- a/core/events/events_block_create.ts +++ b/core/events/events_block_create.ts @@ -26,8 +26,6 @@ import {Workspace} from '../workspace.js'; /** * Notifies listeners when a block (or connected stack of blocks) is * created. - * - * @alias Blockly.Events.BlockCreate */ export class BlockCreate extends BlockBase { override type = eventUtils.BLOCK_CREATE; diff --git a/core/events/events_block_delete.ts b/core/events/events_block_delete.ts index 77071b95d..5a7686edc 100644 --- a/core/events/events_block_delete.ts +++ b/core/events/events_block_delete.ts @@ -26,8 +26,6 @@ import {Workspace} from '../workspace.js'; /** * Notifies listeners when a block (or connected stack of blocks) is * deleted. - * - * @alias Blockly.Events.BlockDelete */ export class BlockDelete extends BlockBase { /** The XML representation of the deleted block(s). */ diff --git a/core/events/events_block_drag.ts b/core/events/events_block_drag.ts index bf928d713..4163da907 100644 --- a/core/events/events_block_drag.ts +++ b/core/events/events_block_drag.ts @@ -23,8 +23,6 @@ import {Workspace} from '../workspace.js'; /** * Notifies listeners when a block is being manually dragged/dropped. - * - * @alias Blockly.Events.BlockDrag */ export class BlockDrag extends UiBase { /** The ID of the top-level block being dragged. */ diff --git a/core/events/events_block_move.ts b/core/events/events_block_move.ts index a0bb9bbd5..0034c2e0b 100644 --- a/core/events/events_block_move.ts +++ b/core/events/events_block_move.ts @@ -32,8 +32,6 @@ interface BlockLocation { /** * Notifies listeners when a block is moved. This could be from one * connection to another, or from one location on the workspace to another. - * - * @alias Blockly.Events.BlockMove */ export class BlockMove extends BlockBase { override type = eventUtils.BLOCK_MOVE; diff --git a/core/events/events_bubble_open.ts b/core/events/events_bubble_open.ts index 8ea2f967e..8697d22c0 100644 --- a/core/events/events_bubble_open.ts +++ b/core/events/events_bubble_open.ts @@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js'; /** * Class for a bubble open event. - * - * @alias Blockly.Events.BubbleOpen */ export class BubbleOpen extends UiBase { /** The ID of the block the bubble is attached to. */ diff --git a/core/events/events_click.ts b/core/events/events_click.ts index f9ac79817..66915762a 100644 --- a/core/events/events_click.ts +++ b/core/events/events_click.ts @@ -24,8 +24,6 @@ import {Workspace} from '../workspace.js'; /** * Notifies listeners that ome blockly element was clicked. - * - * @alias Blockly.Events.Click */ export class Click extends UiBase { /** The ID of the block that was clicked, if a block was clicked. */ diff --git a/core/events/events_comment_base.ts b/core/events/events_comment_base.ts index cfbb333c0..bee960886 100644 --- a/core/events/events_comment_base.ts +++ b/core/events/events_comment_base.ts @@ -26,8 +26,6 @@ import type {Workspace} from '../workspace.js'; /** * Abstract class for a comment event. - * - * @alias Blockly.Events.CommentBase */ export class CommentBase extends AbstractEvent { override isBlank = true; diff --git a/core/events/events_comment_change.ts b/core/events/events_comment_change.ts index afecc21ca..d154f6425 100644 --- a/core/events/events_comment_change.ts +++ b/core/events/events_comment_change.ts @@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that the contents of a workspace comment has changed. - * - * @alias Blockly.Events.CommentChange */ export class CommentChange extends CommentBase { override type = eventUtils.COMMENT_CHANGE; diff --git a/core/events/events_comment_create.ts b/core/events/events_comment_create.ts index 712c7248c..74c9b1737 100644 --- a/core/events/events_comment_create.ts +++ b/core/events/events_comment_create.ts @@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that a workspace comment was created. - * - * @alias Blockly.Events.CommentCreate */ export class CommentCreate extends CommentBase { override type = eventUtils.COMMENT_CREATE; diff --git a/core/events/events_comment_delete.ts b/core/events/events_comment_delete.ts index fdc513b23..f9079fd20 100644 --- a/core/events/events_comment_delete.ts +++ b/core/events/events_comment_delete.ts @@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that a workspace comment has been deleted. - * - * @alias Blockly.Events.CommentDelete */ export class CommentDelete extends CommentBase { override type = eventUtils.COMMENT_DELETE; diff --git a/core/events/events_comment_move.ts b/core/events/events_comment_move.ts index 40f2a0da3..31a893c0a 100644 --- a/core/events/events_comment_move.ts +++ b/core/events/events_comment_move.ts @@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that a workspace comment has moved. - * - * @alias Blockly.Events.CommentMove */ export class CommentMove extends CommentBase { override type = eventUtils.COMMENT_MOVE; diff --git a/core/events/events_marker_move.ts b/core/events/events_marker_move.ts index 9ba2fdc8b..dcb4fe784 100644 --- a/core/events/events_marker_move.ts +++ b/core/events/events_marker_move.ts @@ -26,8 +26,6 @@ import * as eventUtils from './utils.js'; /** * Notifies listeners that a marker (used for keyboard navigation) has * moved. - * - * @alias Blockly.Events.MarkerMove */ export class MarkerMove extends UiBase { /** The ID of the block the marker is now on, if any. */ diff --git a/core/events/events_selected.ts b/core/events/events_selected.ts index 03fcfd9d9..fc1d6ce3f 100644 --- a/core/events/events_selected.ts +++ b/core/events/events_selected.ts @@ -24,8 +24,6 @@ import type {Workspace} from '../workspace.js'; /** * Class for a selected event. * Notifies listeners that a new element has been selected. - * - * @alias Blockly.Events.Selected */ export class Selected extends UiBase { /** The id of the last selected selectable element. */ diff --git a/core/events/events_theme_change.ts b/core/events/events_theme_change.ts index 9f5a58464..d7ebef5bf 100644 --- a/core/events/events_theme_change.ts +++ b/core/events/events_theme_change.ts @@ -22,8 +22,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that the workspace theme has changed. - * - * @alias Blockly.Events.ThemeChange */ export class ThemeChange extends UiBase { /** The name of the new theme that has been set. */ diff --git a/core/events/events_toolbox_item_select.ts b/core/events/events_toolbox_item_select.ts index 2f47eb9d8..4eca80b4d 100644 --- a/core/events/events_toolbox_item_select.ts +++ b/core/events/events_toolbox_item_select.ts @@ -22,8 +22,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that a toolbox item has been selected. - * - * @alias Blockly.Events.ToolboxItemSelect */ export class ToolboxItemSelect extends UiBase { /** The previously selected toolbox item. */ diff --git a/core/events/events_trashcan_open.ts b/core/events/events_trashcan_open.ts index 95876dfd8..fd03b2da6 100644 --- a/core/events/events_trashcan_open.ts +++ b/core/events/events_trashcan_open.ts @@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners when the trashcan is opening or closing. - * - * @alias Blockly.Events.TrashcanOpen */ export class TrashcanOpen extends UiBase { /** diff --git a/core/events/events_ui.ts b/core/events/events_ui.ts index 670d9143d..f743f14d9 100644 --- a/core/events/events_ui.ts +++ b/core/events/events_ui.ts @@ -23,7 +23,6 @@ import * as eventUtils from './utils.js'; * Class for a UI event. * * @deprecated December 2020. Instead use a more specific UI event. - * @alias Blockly.Events.Ui */ export class Ui extends UiBase { blockId: AnyDuringMigration; diff --git a/core/events/events_ui_base.ts b/core/events/events_ui_base.ts index 5f585f079..be5a60d59 100644 --- a/core/events/events_ui_base.ts +++ b/core/events/events_ui_base.ts @@ -22,8 +22,6 @@ import {Abstract as AbstractEvent} from './events_abstract.js'; * editing to work (e.g. scrolling the workspace, zooming, opening toolbox * categories). * UI events do not undo or redo. - * - * @alias Blockly.Events.UiBase */ export class UiBase extends AbstractEvent { override isBlank = true; diff --git a/core/events/events_var_base.ts b/core/events/events_var_base.ts index 0bbd48fcf..f25628888 100644 --- a/core/events/events_var_base.ts +++ b/core/events/events_var_base.ts @@ -21,8 +21,6 @@ import type {Workspace} from '../workspace.js'; /** * Abstract class for a variable event. - * - * @alias Blockly.Events.VarBase */ export class VarBase extends AbstractEvent { override isBlank = true; diff --git a/core/events/events_var_create.ts b/core/events/events_var_create.ts index c30fb8463..63292bc84 100644 --- a/core/events/events_var_create.ts +++ b/core/events/events_var_create.ts @@ -23,8 +23,6 @@ import type {Workspace} from '../workspace.js'; /** * Notifies listeners that a variable model has been created. - * - * @alias Blockly.Events.VarCreate */ export class VarCreate extends VarBase { override type = eventUtils.VAR_CREATE; diff --git a/core/events/events_viewport.ts b/core/events/events_viewport.ts index 7f853fae2..f0287a399 100644 --- a/core/events/events_viewport.ts +++ b/core/events/events_viewport.ts @@ -25,8 +25,6 @@ import type {Workspace} from '../workspace.js'; * changed. * * Does not notify when the workspace itself resizes. - * - * @alias Blockly.Events.ViewportChange */ export class ViewportChange extends UiBase { /** diff --git a/core/events/utils.ts b/core/events/utils.ts index 60b9c155f..970ae695a 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -39,7 +39,6 @@ let recordUndo = true; * Sets whether events should be added to the undo stack. * * @param newValue True if events should be added to the undo stack. - * @alias Blockly.Events.utils.setRecordUndo */ export function setRecordUndo(newValue: boolean) { recordUndo = newValue; @@ -49,7 +48,6 @@ export function setRecordUndo(newValue: boolean) { * Returns whether or not events will be added to the undo stack. * * @returns True if events will be added to the undo stack. - * @alias Blockly.Events.utils.getRecordUndo */ export function getRecordUndo(): boolean { return recordUndo; @@ -60,183 +58,131 @@ let disabled = 0; /** * Name of event that creates a block. Will be deprecated for BLOCK_CREATE. - * - * @alias Blockly.Events.utils.CREATE */ export const CREATE = 'create'; /** * Name of event that creates a block. - * - * @alias Blockly.Events.utils.BLOCK_CREATE */ export const BLOCK_CREATE = CREATE; /** * Name of event that deletes a block. Will be deprecated for BLOCK_DELETE. - * - * @alias Blockly.Events.utils.DELETE */ export const DELETE = 'delete'; /** * Name of event that deletes a block. - * - * @alias Blockly.Events.utils.BLOCK_DELETE */ export const BLOCK_DELETE = DELETE; /** * Name of event that changes a block. Will be deprecated for BLOCK_CHANGE. - * - * @alias Blockly.Events.utils.CHANGE */ export const CHANGE = 'change'; /** * Name of event that changes a block. - * - * @alias Blockly.Events.utils.BLOCK_CHANGE */ export const BLOCK_CHANGE = CHANGE; /** * Name of event that moves a block. Will be deprecated for BLOCK_MOVE. - * - * @alias Blockly.Events.utils.MOVE */ export const MOVE = 'move'; /** * Name of event that moves a block. - * - * @alias Blockly.Events.utils.BLOCK_MOVE */ export const BLOCK_MOVE = MOVE; /** * Name of event that creates a variable. - * - * @alias Blockly.Events.utils.VAR_CREATE */ export const VAR_CREATE = 'var_create'; /** * Name of event that deletes a variable. - * - * @alias Blockly.Events.utils.VAR_DELETE */ export const VAR_DELETE = 'var_delete'; /** * Name of event that renames a variable. - * - * @alias Blockly.Events.utils.VAR_RENAME */ export const VAR_RENAME = 'var_rename'; /** * Name of generic event that records a UI change. - * - * @alias Blockly.Events.utils.UI */ export const UI = 'ui'; /** * Name of event that record a block drags a block. - * - * @alias Blockly.Events.utils.BLOCK_DRAG */ export const BLOCK_DRAG = 'drag'; /** * Name of event that records a change in selected element. - * - * @alias Blockly.Events.utils.SELECTED */ export const SELECTED = 'selected'; /** * Name of event that records a click. - * - * @alias Blockly.Events.utils.CLICK */ export const CLICK = 'click'; /** * Name of event that records a marker move. - * - * @alias Blockly.Events.utils.MARKER_MOVE */ export const MARKER_MOVE = 'marker_move'; /** * Name of event that records a bubble open. - * - * @alias Blockly.Events.utils.BUBBLE_OPEN */ export const BUBBLE_OPEN = 'bubble_open'; /** * Name of event that records a trashcan open. - * - * @alias Blockly.Events.utils.TRASHCAN_OPEN */ export const TRASHCAN_OPEN = 'trashcan_open'; /** * Name of event that records a toolbox item select. - * - * @alias Blockly.Events.utils.TOOLBOX_ITEM_SELECT */ export const TOOLBOX_ITEM_SELECT = 'toolbox_item_select'; /** * Name of event that records a theme change. - * - * @alias Blockly.Events.utils.THEME_CHANGE */ export const THEME_CHANGE = 'theme_change'; /** * Name of event that records a viewport change. - * - * @alias Blockly.Events.utils.VIEWPORT_CHANGE */ export const VIEWPORT_CHANGE = 'viewport_change'; /** * Name of event that creates a comment. - * - * @alias Blockly.Events.utils.COMMENT_CREATE */ export const COMMENT_CREATE = 'comment_create'; /** * Name of event that deletes a comment. - * - * @alias Blockly.Events.utils.COMMENT_DELETE */ export const COMMENT_DELETE = 'comment_delete'; /** * Name of event that changes a comment. - * - * @alias Blockly.Events.utils.COMMENT_CHANGE */ export const COMMENT_CHANGE = 'comment_change'; /** * Name of event that moves a comment. - * - * @alias Blockly.Events.utils.COMMENT_MOVE */ export const COMMENT_MOVE = 'comment_move'; /** * Name of event that records a workspace load. - * - * @alias Blockly.Events.utils.FINISHED_LOADING */ export const FINISHED_LOADING = 'finished_loading'; @@ -246,8 +192,6 @@ export const FINISHED_LOADING = 'finished_loading'; * * Not to be confused with bumping so that disconnected connections do not * appear connected. - * - * @alias Blockly.Events.utils.BumpEvent */ export type BumpEvent = BlockCreate|BlockMove|CommentCreate|CommentMove; @@ -257,8 +201,6 @@ export type BumpEvent = BlockCreate|BlockMove|CommentCreate|CommentMove; * * Not to be confused with bumping so that disconnected connections do not * appear connected. - * - * @alias Blockly.Events.utils.BUMP_EVENTS */ export const BUMP_EVENTS: string[] = [BLOCK_CREATE, BLOCK_MOVE, COMMENT_CREATE, COMMENT_MOVE]; @@ -270,7 +212,6 @@ const FIRE_QUEUE: Abstract[] = []; * Create a custom event and fire it. * * @param event Custom data for event. - * @alias Blockly.Events.utils.fire */ export function fire(event: Abstract) { TEST_ONLY.fireInternal(event); @@ -312,7 +253,6 @@ function fireNow() { * @param queueIn Array of events. * @param forward True if forward (redo), false if backward (undo). * @returns Array of filtered events. - * @alias Blockly.Events.utils.filter */ export function filter(queueIn: Abstract[], forward: boolean): Abstract[] { let queue = queueIn.slice(); @@ -395,8 +335,6 @@ export function filter(queueIn: Abstract[], forward: boolean): Abstract[] { /** * Modify pending undo events so that when they are fired they don't land * in the undo stack. Called by Workspace.clearUndo. - * - * @alias Blockly.Events.utils.clearPendingUndo */ export function clearPendingUndo() { for (let i = 0, event; event = FIRE_QUEUE[i]; i++) { @@ -406,8 +344,6 @@ export function clearPendingUndo() { /** * Stop sending events. Every call to this function MUST also call enable. - * - * @alias Blockly.Events.utils.disable */ export function disable() { disabled++; @@ -416,8 +352,6 @@ export function disable() { /** * Start sending events. Unless events were already disabled when the * corresponding call to disable was made. - * - * @alias Blockly.Events.utils.enable */ export function enable() { disabled--; @@ -427,7 +361,6 @@ export function enable() { * Returns whether events may be fired or not. * * @returns True if enabled. - * @alias Blockly.Events.utils.isEnabled */ export function isEnabled(): boolean { return disabled === 0; @@ -437,7 +370,6 @@ export function isEnabled(): boolean { * Current group. * * @returns ID string. - * @alias Blockly.Events.utils.getGroup */ export function getGroup(): string { return group; @@ -448,7 +380,6 @@ export function getGroup(): string { * * @param state True to start new group, false to end group. * String to set group explicitly. - * @alias Blockly.Events.utils.setGroup */ export function setGroup(state: boolean|string) { TEST_ONLY.setGroupInternal(state); @@ -470,7 +401,6 @@ function setGroupInternal(state: boolean|string) { * * @param block The root block. * @returns List of block IDs. - * @alias Blockly.Events.utils.getDescendantIds * @internal */ export function getDescendantIds(block: Block): string[] { @@ -489,7 +419,6 @@ export function getDescendantIds(block: Block): string[] { * @param workspace Target workspace for event. * @returns The event represented by the JSON. * @throws {Error} if an event type is not found in the registry. - * @alias Blockly.Events.utils.fromJson */ export function fromJson( json: AnyDuringMigration, workspace: Workspace): Abstract { @@ -526,7 +455,6 @@ function eventClassHasStaticFromJson(eventClass: new (...p: any[]) => Abstract): * * @param eventType The type of the event to get. * @returns The event class with the given type. - * @alias Blockly.Events.utils.get */ export function get(eventType: string): (new (...p1: AnyDuringMigration[]) => Abstract) { @@ -544,7 +472,6 @@ export function get(eventType: string): * users don't try to re-enable disabled orphan blocks. * * @param event Custom data for event. - * @alias Blockly.Events.utils.disableOrphans */ export function disableOrphans(event: Abstract) { if (event.type === MOVE || event.type === CREATE) { diff --git a/core/events/workspace_events.ts b/core/events/workspace_events.ts index 6f6fc7e8e..30fab99b7 100644 --- a/core/events/workspace_events.ts +++ b/core/events/workspace_events.ts @@ -21,8 +21,6 @@ import * as eventUtils from './utils.js'; /** * Notifies listeners when the workspace has finished deserializing from * JSON/XML. - * - * @alias Blockly.Events.FinishedLoading */ export class FinishedLoading extends AbstractEvent { override isBlank = true; diff --git a/core/extensions.ts b/core/extensions.ts index c30cb314a..79a21ecb5 100644 --- a/core/extensions.ts +++ b/core/extensions.ts @@ -36,7 +36,6 @@ export const TEST_ONLY = {allExtensions}; * @param initFn The function to initialize an extended block. * @throws {Error} if the extension name is empty, the extension is already * registered, or extensionFn is not a function. - * @alias Blockly.Extensions.register */ export function register(name: string, initFn: Function) { if (typeof name !== 'string' || name.trim() === '') { @@ -58,7 +57,6 @@ export function register(name: string, initFn: Function) { * @param mixinObj The values to mix in. * @throws {Error} if the extension name is empty or the extension is already * registered. - * @alias Blockly.Extensions.registerMixin */ export function registerMixin(name: string, mixinObj: AnyDuringMigration) { if (!mixinObj || typeof mixinObj !== 'object') { @@ -81,7 +79,6 @@ export function registerMixin(name: string, mixinObj: AnyDuringMigration) { * @param opt_blockList A list of blocks to appear in the flyout of the mutator * dialog. * @throws {Error} if the mutation is invalid or can't be applied to the block. - * @alias Blockly.Extensions.registerMutator */ export function registerMutator( name: string, mixinObj: AnyDuringMigration, @@ -113,7 +110,6 @@ export function registerMutator( * Unregisters the extension registered with the given name. * * @param name The name of the extension to unregister. - * @alias Blockly.Extensions.unregister */ export function unregister(name: string) { if (isRegistered(name)) { @@ -129,7 +125,6 @@ export function unregister(name: string) { * * @param name The name of the extension to check for. * @returns True if the extension is registered. False if it is not registered. - * @alias Blockly.Extensions.isRegistered */ export function isRegistered(name: string): boolean { return !!allExtensions[name]; @@ -143,7 +138,6 @@ export function isRegistered(name: string): boolean { * @param block The block to apply the named extension to. * @param isMutator True if this extension defines a mutator. * @throws {Error} if the extension is not found. - * @alias Blockly.Extensions.apply */ export function apply(name: string, block: Block, isMutator: boolean) { const extensionFn = allExtensions[name]; @@ -387,7 +381,6 @@ export function runAfterPageLoad(fn: () => void) { * lookup table. * @param lookupTable The table of field values to tooltip text. * @returns The extension function. - * @alias Blockly.Extensions.buildTooltipForDropdown */ export function buildTooltipForDropdown( dropdownName: string, lookupTable: {[key: string]: string}): Function { @@ -470,7 +463,6 @@ function checkDropdownOptionsInTable( * placeholder. * @param fieldName The field with the replacement text. * @returns The extension function. - * @alias Blockly.Extensions.buildTooltipWithFieldText */ export function buildTooltipWithFieldText( msgTemplate: string, fieldName: string): Function { diff --git a/core/field.ts b/core/field.ts index 0bcf99119..4e7121bb2 100644 --- a/core/field.ts +++ b/core/field.ts @@ -67,7 +67,6 @@ export type FieldValidator = (newValue: T) => T|null|undefined; /** * Abstract class for an editable field. * - * @alias Blockly.Field * @typeParam T - The value stored on the field. */ export abstract class Field implements IASTNodeLocationSvg, diff --git a/core/field_angle.ts b/core/field_angle.ts index 70cce0f4e..be00a958e 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -31,8 +31,6 @@ export type FieldAngleValidator = FieldInputValidator; /** * Class for an editable angle field. - * - * @alias Blockly.FieldAngle */ export class FieldAngle extends FieldInput { /** diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index 3b8c08a92..9f3f107c7 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -26,8 +26,6 @@ export type FieldCheckboxValidator = FieldValidator; /** * Class for a checkbox field. - * - * @alias Blockly.FieldCheckbox */ export class FieldCheckbox extends Field { /** Default character for the checkmark. */ diff --git a/core/field_colour.ts b/core/field_colour.ts index 73843c0b6..8df51ed77 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -33,8 +33,6 @@ export type FieldColourValidator = FieldValidator; /** * Class for a colour input field. - * - * @alias Blockly.FieldColour */ export class FieldColour extends Field { /** diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index ced3a4bfe..54cb0dc6f 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -32,8 +32,6 @@ export type FieldDropdownValidator = FieldValidator; /** * Class for an editable dropdown field. - * - * @alias Blockly.FieldDropdown */ export class FieldDropdown extends Field { /** Horizontal distance that a checkmark overhangs the dropdown. */ diff --git a/core/field_image.ts b/core/field_image.ts index a265a182b..173a3dc63 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -22,8 +22,6 @@ import {Svg} from './utils/svg.js'; /** * Class for an image on a block. - * - * @alias Blockly.FieldImage */ export class FieldImage extends Field { /** diff --git a/core/field_input.ts b/core/field_input.ts index 88946b47a..9eb0b7614 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -38,7 +38,6 @@ export type FieldInputValidator = /** * Abstract class for an editable input field. * - * @alias Blockly.FieldInput * @typeParam T - The value stored on the field. */ export abstract class FieldInput extends Field { diff --git a/core/field_label.ts b/core/field_label.ts index 22a55a3b7..1c6daea50 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -21,8 +21,6 @@ import type {Sentinel} from './utils/sentinel.js'; /** * Class for a non-editable, non-serializable text field. - * - * @alias Blockly.FieldLabel */ export class FieldLabel extends Field { /** The html class name to use for this field. */ diff --git a/core/field_label_serializable.ts b/core/field_label_serializable.ts index ad1a5a06e..79c4c8e06 100644 --- a/core/field_label_serializable.ts +++ b/core/field_label_serializable.ts @@ -20,8 +20,6 @@ import * as parsing from './utils/parsing.js'; /** * Class for a non-editable, serializable text field. - * - * @alias Blockly.FieldLabelSerializable */ export class FieldLabelSerializable extends FieldLabel { /** diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index e6473811b..1d4aac52f 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -29,8 +29,6 @@ export type FieldMultilineInputValidator = FieldTextInputValidator; /** * Class for an editable text area field. - * - * @alias Blockly.FieldMultilineInput */ export class FieldMultilineInput extends FieldTextInput { /** diff --git a/core/field_number.ts b/core/field_number.ts index 20b799555..2e3da1d91 100644 --- a/core/field_number.ts +++ b/core/field_number.ts @@ -22,8 +22,6 @@ export type FieldNumberValidator = FieldInputValidator; /** * Class for an editable number field. - * - * @alias Blockly.FieldNumber */ export class FieldNumber extends FieldInput { /** The minimum value this number field can contain. */ diff --git a/core/field_registry.ts b/core/field_registry.ts index 172e1d8ae..9606dd55a 100644 --- a/core/field_registry.ts +++ b/core/field_registry.ts @@ -32,7 +32,6 @@ interface RegistryOptions { * construct an instance of the field. * @throws {Error} if the type name is empty, the field is already registered, * or the fieldClass is not an object containing a fromJson function. - * @alias Blockly.fieldRegistry.register */ export function register(type: string, fieldClass: FieldProto) { registry.register(registry.Type.FIELD, type, fieldClass); @@ -42,7 +41,6 @@ export function register(type: string, fieldClass: FieldProto) { * Unregisters the field registered with the given type. * * @param type The field type name as used in the JSON definition. - * @alias Blockly.fieldRegistry.unregister */ export function unregister(type: string) { registry.unregister(registry.Type.FIELD, type); @@ -57,7 +55,6 @@ export function unregister(type: string) { * type. * @returns The new field instance or null if a field wasn't found with the * given type name - * @alias Blockly.fieldRegistry.fromJson * @internal */ export function fromJson(options: RegistryOptions): Field|null { diff --git a/core/field_textinput.ts b/core/field_textinput.ts index 5ef633dc4..401984b76 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -24,8 +24,6 @@ export type FieldTextInputValidator = FieldInputValidator; /** * Class for an editable text field. - * - * @alias Blockly.FieldTextInput */ export class FieldTextInput extends FieldInput { /** diff --git a/core/field_variable.ts b/core/field_variable.ts index 8d2fd276c..4a2c1b8f1 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -34,8 +34,6 @@ export type FieldVariableValidator = FieldDropdownValidator; /** * Class for a variable's dropdown field. - * - * @alias Blockly.FieldVariable */ export class FieldVariable extends FieldDropdown { protected override menuGenerator_: MenuGenerator|undefined; diff --git a/core/flyout_base.ts b/core/flyout_base.ts index be6b5da4b..7e5716d25 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -43,8 +43,6 @@ enum FlyoutItemType { /** * Class for a flyout. - * - * @alias Blockly.Flyout */ export abstract class Flyout extends DeleteArea implements IFlyout { /** diff --git a/core/flyout_button.ts b/core/flyout_button.ts index 9faa5671e..63f19e7a0 100644 --- a/core/flyout_button.ts +++ b/core/flyout_button.ts @@ -25,8 +25,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a button or label in the flyout. - * - * @alias Blockly.FlyoutButton */ export class FlyoutButton { /** The horizontal margin around the text in the button. */ diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index 634fd41a4..5a0c96f84 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -27,8 +27,6 @@ import * as WidgetDiv from './widgetdiv.js'; /** * Class for a flyout. - * - * @alias Blockly.HorizontalFlyout */ export class HorizontalFlyout extends Flyout { override horizontalLayout = true; diff --git a/core/flyout_metrics_manager.ts b/core/flyout_metrics_manager.ts index e8f4e0401..48ca9379a 100644 --- a/core/flyout_metrics_manager.ts +++ b/core/flyout_metrics_manager.ts @@ -20,8 +20,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Calculates metrics for a flyout's workspace. * The metrics are mainly used to size scrollbars for the flyout. - * - * @alias Blockly.FlyoutMetricsManager */ export class FlyoutMetricsManager extends MetricsManager { /** The flyout that owns the workspace to calculate metrics for. */ diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index fa9d1ad39..b6c1ae7c2 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -27,8 +27,6 @@ import * as WidgetDiv from './widgetdiv.js'; /** * Class for a flyout. - * - * @alias Blockly.VerticalFlyout */ export class VerticalFlyout extends Flyout { /** The name of the vertical flyout in the registry. */ diff --git a/core/generator.ts b/core/generator.ts index 351aee41e..d51081a6d 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -24,7 +24,6 @@ import type {Workspace} from './workspace.js'; * Class for a code generator that translates the blocks into a language. * * @unrestricted - * @alias Blockly.CodeGenerator */ export class CodeGenerator { name_: string; diff --git a/core/gesture.ts b/core/gesture.ts index 065434097..c3d00ea3f 100644 --- a/core/gesture.ts +++ b/core/gesture.ts @@ -51,8 +51,6 @@ const ZOOM_OUT_MULTIPLIER = 6; /** * Class for one gesture. - * - * @alias Blockly.Gesture */ export class Gesture { /** diff --git a/core/grid.ts b/core/grid.ts index 6a939322b..ca84d90d6 100644 --- a/core/grid.ts +++ b/core/grid.ts @@ -20,8 +20,6 @@ import {GridOptions} from './options.js'; /** * Class for a workspace's grid. - * - * @alias Blockly.Grid */ export class Grid { private readonly spacing: number; diff --git a/core/icon.ts b/core/icon.ts index 83051610a..791f835d2 100644 --- a/core/icon.ts +++ b/core/icon.ts @@ -25,8 +25,6 @@ import * as deprecation from './utils/deprecation.js'; /** * Class for an icon. - * - * @alias Blockly.Icon */ export abstract class Icon { protected block_: BlockSvg|null; diff --git a/core/inject.ts b/core/inject.ts index d2f561865..1f7d81cbf 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -39,7 +39,6 @@ import {WorkspaceSvg} from './workspace_svg.js'; * @param container Containing element, or its ID, or a CSS selector. * @param opt_options Optional dictionary of options. * @returns Newly created main workspace. - * @alias Blockly.inject */ export function inject( container: Element|string, opt_options?: BlocklyOptions): WorkspaceSvg { diff --git a/core/input.ts b/core/input.ts index 5b69e566a..9c0224c8b 100644 --- a/core/input.ts +++ b/core/input.ts @@ -26,8 +26,6 @@ import type {RenderedConnection} from './rendered_connection.js'; /** * Class for an input with an optional field. - * - * @alias Blockly.Input */ export class Input { private sourceBlock: Block; @@ -306,7 +304,6 @@ export namespace Input { /** * Enum for alignment of inputs. * - * @alias Blockly.Input.Align */ export enum Align { LEFT = -1, diff --git a/core/input_types.ts b/core/input_types.ts index 0ea695e89..eab660df9 100644 --- a/core/input_types.ts +++ b/core/input_types.ts @@ -17,8 +17,6 @@ import {ConnectionType} from './connection_type.js'; /** * Enum for the type of a connection or input. - * - * @alias Blockly.inputTypes */ export enum inputTypes { // A right-facing value input. E.g. 'set item to' or 'return'. diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 278809a7d..ec8963df6 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -56,8 +56,6 @@ const DUPLICATE_BLOCK_ERROR = 'The insertion marker ' + * Class that controls updates to connections during drags. It is primarily * responsible for finding the closest eligible connection and highlighting or * unhighlighting it as needed during a drag. - * - * @alias Blockly.InsertionMarkerManager */ export class InsertionMarkerManager { /** diff --git a/core/interfaces/i_ast_node_location.ts b/core/interfaces/i_ast_node_location.ts index 814873852..bb601d260 100644 --- a/core/interfaces/i_ast_node_location.ts +++ b/core/interfaces/i_ast_node_location.ts @@ -15,7 +15,5 @@ goog.declareModuleId('Blockly.IASTNodeLocation'); /** * An AST node location interface. - * - * @alias Blockly.IASTNodeLocation */ export interface IASTNodeLocation {} diff --git a/core/interfaces/i_ast_node_location_svg.ts b/core/interfaces/i_ast_node_location_svg.ts index 8bc51ec26..83eb6585f 100644 --- a/core/interfaces/i_ast_node_location_svg.ts +++ b/core/interfaces/i_ast_node_location_svg.ts @@ -17,8 +17,6 @@ import type {IASTNodeLocation} from './i_ast_node_location.js'; /** * An AST node location SVG interface. - * - * @alias Blockly.IASTNodeLocationSvg */ export interface IASTNodeLocationSvg extends IASTNodeLocation { /** diff --git a/core/interfaces/i_ast_node_location_with_block.ts b/core/interfaces/i_ast_node_location_with_block.ts index cf54ddc41..48eb094d7 100644 --- a/core/interfaces/i_ast_node_location_with_block.ts +++ b/core/interfaces/i_ast_node_location_with_block.ts @@ -19,8 +19,6 @@ import type {Block} from '../block.js'; /** * An AST node location that has an associated block. - * - * @alias Blockly.IASTNodeLocationWithBlock */ export interface IASTNodeLocationWithBlock extends IASTNodeLocation { /** diff --git a/core/interfaces/i_autohideable.ts b/core/interfaces/i_autohideable.ts index 542e3edf7..8b72e33c3 100644 --- a/core/interfaces/i_autohideable.ts +++ b/core/interfaces/i_autohideable.ts @@ -18,8 +18,6 @@ import type {IComponent} from './i_component.js'; /** * Interface for a component that can be automatically hidden. - * - * @alias Blockly.IAutoHideable */ export interface IAutoHideable extends IComponent { /** diff --git a/core/interfaces/i_block_dragger.ts b/core/interfaces/i_block_dragger.ts index e977369ea..db6995c13 100644 --- a/core/interfaces/i_block_dragger.ts +++ b/core/interfaces/i_block_dragger.ts @@ -16,8 +16,6 @@ goog.declareModuleId('Blockly.IBlockDragger'); /** * A block dragger interface. - * - * @alias Blockly.IBlockDragger */ export interface IBlockDragger { /** diff --git a/core/interfaces/i_bounded_element.ts b/core/interfaces/i_bounded_element.ts index 8aae86285..d1edec75d 100644 --- a/core/interfaces/i_bounded_element.ts +++ b/core/interfaces/i_bounded_element.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IBoundedElement'); /** * A bounded element interface. - * - * @alias Blockly.IBoundedElement */ export interface IBoundedElement { /** diff --git a/core/interfaces/i_bubble.ts b/core/interfaces/i_bubble.ts index af9450430..467aae673 100644 --- a/core/interfaces/i_bubble.ts +++ b/core/interfaces/i_bubble.ts @@ -19,8 +19,6 @@ import type {IDraggable} from './i_draggable.js'; /** * A bubble interface. - * - * @alias Blockly.IBubble */ export interface IBubble extends IDraggable, IContextMenu { /** diff --git a/core/interfaces/i_collapsible_toolbox_item.ts b/core/interfaces/i_collapsible_toolbox_item.ts index a7d8e9153..b6eabcf14 100644 --- a/core/interfaces/i_collapsible_toolbox_item.ts +++ b/core/interfaces/i_collapsible_toolbox_item.ts @@ -18,8 +18,6 @@ import type {IToolboxItem} from './i_toolbox_item.js'; /** * Interface for an item in the toolbox that can be collapsed. - * - * @alias Blockly.ICollapsibleToolboxItem */ export interface ICollapsibleToolboxItem extends ISelectableToolboxItem { /** diff --git a/core/interfaces/i_component.ts b/core/interfaces/i_component.ts index f75a6b014..3d61f805b 100644 --- a/core/interfaces/i_component.ts +++ b/core/interfaces/i_component.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.IComponent'); /** * The interface for a workspace component that can be registered with the * ComponentManager. - * - * @alias Blockly.IComponent */ export interface IComponent { /** diff --git a/core/interfaces/i_connection_checker.ts b/core/interfaces/i_connection_checker.ts index deb3c59fa..5472aecd1 100644 --- a/core/interfaces/i_connection_checker.ts +++ b/core/interfaces/i_connection_checker.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.IConnectionChecker'); /** * Class for connection type checking logic. - * - * @alias Blockly.IConnectionChecker */ export interface IConnectionChecker { /** diff --git a/core/interfaces/i_contextmenu.ts b/core/interfaces/i_contextmenu.ts index b0a28630e..f005fdbdd 100644 --- a/core/interfaces/i_contextmenu.ts +++ b/core/interfaces/i_contextmenu.ts @@ -13,7 +13,6 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IContextMenu'); -/** @alias Blockly.IContextMenu */ export interface IContextMenu { /** * Show the context menu for this object. diff --git a/core/interfaces/i_copyable.ts b/core/interfaces/i_copyable.ts index 4c6a7a62c..6204eeacc 100644 --- a/core/interfaces/i_copyable.ts +++ b/core/interfaces/i_copyable.ts @@ -16,7 +16,6 @@ import type {WorkspaceSvg} from '../workspace_svg.js'; import type {ISelectable} from './i_selectable.js'; -/** @alias Blockly.ICopyable */ export interface ICopyable extends ISelectable { /** * Encode for copying. diff --git a/core/interfaces/i_deletable.ts b/core/interfaces/i_deletable.ts index 4a1683574..507cdca33 100644 --- a/core/interfaces/i_deletable.ts +++ b/core/interfaces/i_deletable.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IDeletable'); /** * The interface for an object that can be deleted. - * - * @alias Blockly.IDeletable */ export interface IDeletable { /** diff --git a/core/interfaces/i_delete_area.ts b/core/interfaces/i_delete_area.ts index 1d9752b05..1c9a1d0d0 100644 --- a/core/interfaces/i_delete_area.ts +++ b/core/interfaces/i_delete_area.ts @@ -20,8 +20,6 @@ import type {IDraggable} from './i_draggable.js'; /** * Interface for a component that can delete a block or bubble that is dropped * on top of it. - * - * @alias Blockly.IDeleteArea */ export interface IDeleteArea extends IDragTarget { /** diff --git a/core/interfaces/i_drag_target.ts b/core/interfaces/i_drag_target.ts index f1e1b3c97..eef00dcd9 100644 --- a/core/interfaces/i_drag_target.ts +++ b/core/interfaces/i_drag_target.ts @@ -23,8 +23,6 @@ import type {IComponent} from './i_component.js'; /** * Interface for a component with custom behaviour when a block or bubble is * dragged over or dropped on top of it. - * - * @alias Blockly.IDragTarget */ export interface IDragTarget extends IComponent { /** diff --git a/core/interfaces/i_draggable.ts b/core/interfaces/i_draggable.ts index 313525d5e..f7a080949 100644 --- a/core/interfaces/i_draggable.ts +++ b/core/interfaces/i_draggable.ts @@ -17,7 +17,5 @@ import type {IDeletable} from './i_deletable.js'; /** * The interface for an object that can be dragged. - * - * @alias Blockly.IDraggable */ export interface IDraggable extends IDeletable {} diff --git a/core/interfaces/i_flyout.ts b/core/interfaces/i_flyout.ts index 825660686..a5488c549 100644 --- a/core/interfaces/i_flyout.ts +++ b/core/interfaces/i_flyout.ts @@ -22,8 +22,6 @@ import type {IRegistrable} from './i_registrable.js'; /** * Interface for a flyout. - * - * @alias Blockly.IFlyout */ export interface IFlyout extends IRegistrable { /** Whether the flyout is laid out horizontally or not. */ diff --git a/core/interfaces/i_keyboard_accessible.ts b/core/interfaces/i_keyboard_accessible.ts index d60fb0224..2d48bad9c 100644 --- a/core/interfaces/i_keyboard_accessible.ts +++ b/core/interfaces/i_keyboard_accessible.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IKeyboardAccessible'); /** * An interface for an object that handles keyboard shortcuts. - * - * @alias Blockly.IKeyboardAccessible */ export interface IKeyboardAccessible { /** diff --git a/core/interfaces/i_metrics_manager.ts b/core/interfaces/i_metrics_manager.ts index be82b4991..c60dc7f52 100644 --- a/core/interfaces/i_metrics_manager.ts +++ b/core/interfaces/i_metrics_manager.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.IMetricsManager'); /** * Interface for a metrics manager. - * - * @alias Blockly.IMetricsManager */ export interface IMetricsManager { /** diff --git a/core/interfaces/i_movable.ts b/core/interfaces/i_movable.ts index eed624de9..a0c420a9b 100644 --- a/core/interfaces/i_movable.ts +++ b/core/interfaces/i_movable.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IMovable'); /** * The interface for an object that is movable. - * - * @alias Blockly.IMovable */ export interface IMovable { /** diff --git a/core/interfaces/i_positionable.ts b/core/interfaces/i_positionable.ts index 7edf0c694..73cc299b7 100644 --- a/core/interfaces/i_positionable.ts +++ b/core/interfaces/i_positionable.ts @@ -19,8 +19,6 @@ import type {IComponent} from './i_component.js'; /** * Interface for a component that is positioned on top of the workspace. - * - * @alias Blockly.IPositionable */ export interface IPositionable extends IComponent { /** diff --git a/core/interfaces/i_registrable.ts b/core/interfaces/i_registrable.ts index 9faa55e9a..b43fff5d3 100644 --- a/core/interfaces/i_registrable.ts +++ b/core/interfaces/i_registrable.ts @@ -16,7 +16,5 @@ goog.declareModuleId('Blockly.IRegistrable'); /** * The interface for a Blockly component that can be registered. - * - * @alias Blockly.IRegistrable */ export interface IRegistrable {} diff --git a/core/interfaces/i_selectable.ts b/core/interfaces/i_selectable.ts index a29bdb9cb..f76bdd969 100644 --- a/core/interfaces/i_selectable.ts +++ b/core/interfaces/i_selectable.ts @@ -18,8 +18,6 @@ import type {IMovable} from './i_movable.js'; /** * The interface for an object that is selectable. - * - * @alias Blockly.ISelectable */ export interface ISelectable extends IDeletable, IMovable { id: string; diff --git a/core/interfaces/i_selectable_toolbox_item.ts b/core/interfaces/i_selectable_toolbox_item.ts index 765a42c6e..b43c320b2 100644 --- a/core/interfaces/i_selectable_toolbox_item.ts +++ b/core/interfaces/i_selectable_toolbox_item.ts @@ -18,8 +18,6 @@ import type {IToolboxItem} from './i_toolbox_item.js'; /** * Interface for an item in the toolbox that can be selected. - * - * @alias Blockly.ISelectableToolboxItem */ export interface ISelectableToolboxItem extends IToolboxItem { /** diff --git a/core/interfaces/i_serializer.ts b/core/interfaces/i_serializer.ts index 3bf99fe4c..495be1f1c 100644 --- a/core/interfaces/i_serializer.ts +++ b/core/interfaces/i_serializer.ts @@ -18,8 +18,6 @@ import type {Workspace} from '../workspace.js'; /** * Serializes and deserializes a plugin or system. - * - * @alias Blockly.serialization.ISerializer.ISerializer */ export interface ISerializer { /** diff --git a/core/interfaces/i_styleable.ts b/core/interfaces/i_styleable.ts index 7e98a6dc7..f9554680e 100644 --- a/core/interfaces/i_styleable.ts +++ b/core/interfaces/i_styleable.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IStyleable'); /** * Interface for an object that a style can be added to. - * - * @alias Blockly.IStyleable */ export interface IStyleable { /** diff --git a/core/interfaces/i_toolbox.ts b/core/interfaces/i_toolbox.ts index fdc021f5a..9e936a54a 100644 --- a/core/interfaces/i_toolbox.ts +++ b/core/interfaces/i_toolbox.ts @@ -21,8 +21,6 @@ import type {WorkspaceSvg} from '../workspace_svg.js'; /** * Interface for a toolbox. - * - * @alias Blockly.IToolbox */ export interface IToolbox extends IRegistrable { /** Initializes the toolbox. */ diff --git a/core/interfaces/i_toolbox_item.ts b/core/interfaces/i_toolbox_item.ts index a478cae5c..3c5344725 100644 --- a/core/interfaces/i_toolbox_item.ts +++ b/core/interfaces/i_toolbox_item.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.IToolboxItem'); /** * Interface for an item in the toolbox. - * - * @alias Blockly.IToolboxItem */ export interface IToolboxItem { /** diff --git a/core/internal_constants.ts b/core/internal_constants.ts index d1bd27b48..330d2662e 100644 --- a/core/internal_constants.ts +++ b/core/internal_constants.ts @@ -19,7 +19,6 @@ import {ConnectionType} from './connection_type.js'; /** * Number of characters to truncate a collapsed block to. * - * @alias Blockly.internalConstants.COLLAPSE_CHARS * @internal */ export const COLLAPSE_CHARS = 30; @@ -28,7 +27,6 @@ export const COLLAPSE_CHARS = 30; * When dragging a block out of a stack, split the stack in two (true), or drag * out the block healing the stack (false). * - * @alias Blockly.internalConstants.DRAG_STACK * @internal */ export const DRAG_STACK = true; @@ -36,7 +34,6 @@ export const DRAG_STACK = true; /** * Lookup table for determining the opposite type of a connection. * - * @alias Blockly.internalConstants.OPPOSITE_TYPE * @internal */ export const OPPOSITE_TYPE: number[] = []; @@ -52,7 +49,6 @@ OPPOSITE_TYPE[ConnectionType.PREVIOUS_STATEMENT] = * This string indicates that this option in the dropdown is 'Rename * variable...' and if selected, should trigger the prompt to rename a variable. * - * @alias Blockly.internalConstants.RENAME_VARIABLE_ID * @internal */ export const RENAME_VARIABLE_ID = 'RENAME_VARIABLE_ID'; @@ -62,7 +58,6 @@ export const RENAME_VARIABLE_ID = 'RENAME_VARIABLE_ID'; * This string indicates that this option in the dropdown is 'Delete the "%1" * variable' and if selected, should trigger the prompt to delete a variable. * - * @alias Blockly.internalConstants.DELETE_VARIABLE_ID * @internal */ export const DELETE_VARIABLE_ID = 'DELETE_VARIABLE_ID'; diff --git a/core/keyboard_nav/ast_node.ts b/core/keyboard_nav/ast_node.ts index 27d0a4554..b3e18d299 100644 --- a/core/keyboard_nav/ast_node.ts +++ b/core/keyboard_nav/ast_node.ts @@ -28,8 +28,6 @@ import type {Workspace} from '../workspace.js'; * Class for an AST node. * It is recommended that you use one of the createNode methods instead of * creating a node directly. - * - * @alias Blockly.ASTNode */ export class ASTNode { /** @@ -56,7 +54,6 @@ export class ASTNode { * Must be in ASTNode.types. * @param location The position in the AST. * @param opt_params Optional dictionary of options. - * @alias Blockly.ASTNode */ constructor(type: string, location: IASTNodeLocation, opt_params?: Params) { if (!location) { diff --git a/core/keyboard_nav/basic_cursor.ts b/core/keyboard_nav/basic_cursor.ts index 648158fc6..5f0b4dfa4 100644 --- a/core/keyboard_nav/basic_cursor.ts +++ b/core/keyboard_nav/basic_cursor.ts @@ -23,14 +23,11 @@ import {Cursor} from './cursor.js'; * Class for a basic cursor. * This will allow the user to get to all nodes in the AST by hitting next or * previous. - * - * @alias Blockly.BasicCursor */ export class BasicCursor extends Cursor { /** Name used for registering a basic cursor. */ static readonly registrationName = 'basicCursor'; - /** @alias Blockly.BasicCursor */ constructor() { super(); } diff --git a/core/keyboard_nav/cursor.ts b/core/keyboard_nav/cursor.ts index 7fcf603e5..31ca083d6 100644 --- a/core/keyboard_nav/cursor.ts +++ b/core/keyboard_nav/cursor.ts @@ -22,13 +22,10 @@ import {Marker} from './marker.js'; /** * Class for a cursor. * A cursor controls how a user navigates the Blockly AST. - * - * @alias Blockly.Cursor */ export class Cursor extends Marker { override type = 'cursor'; - /** @alias Blockly.Cursor */ constructor() { super(); } diff --git a/core/keyboard_nav/marker.ts b/core/keyboard_nav/marker.ts index 725bc26e3..d569f3637 100644 --- a/core/keyboard_nav/marker.ts +++ b/core/keyboard_nav/marker.ts @@ -22,8 +22,6 @@ import type {ASTNode} from './ast_node.js'; /** * Class for a marker. * This is used in keyboard navigation to save a location in the Blockly AST. - * - * @alias Blockly.Marker */ export class Marker { /** The colour of the marker. */ diff --git a/core/keyboard_nav/tab_navigate_cursor.ts b/core/keyboard_nav/tab_navigate_cursor.ts index 588ddede5..eb4395969 100644 --- a/core/keyboard_nav/tab_navigate_cursor.ts +++ b/core/keyboard_nav/tab_navigate_cursor.ts @@ -21,8 +21,6 @@ import {BasicCursor} from './basic_cursor.js'; /** * A cursor for navigating between tab navigable fields. - * - * @alias Blockly.TabNavigateCursor */ export class TabNavigateCursor extends BasicCursor { /** diff --git a/core/marker_manager.ts b/core/marker_manager.ts index 6bc928c1b..653e220a9 100644 --- a/core/marker_manager.ts +++ b/core/marker_manager.ts @@ -19,8 +19,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class to manage the multiple markers and the cursor on a workspace. - * - * @alias Blockly.MarkerManager */ export class MarkerManager { /** The name of the local marker. */ diff --git a/core/menu.ts b/core/menu.ts index 85b8070cf..0b800d6ff 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -24,8 +24,6 @@ import * as style from './utils/style.js'; /** * A basic menu class. - * - * @alias Blockly.Menu */ export class Menu { /** diff --git a/core/menuitem.ts b/core/menuitem.ts index ee9b2ad0c..55c623ff8 100644 --- a/core/menuitem.ts +++ b/core/menuitem.ts @@ -19,8 +19,6 @@ import * as idGenerator from './utils/idgenerator.js'; /** * Class representing an item in a menu. - * - * @alias Blockly.MenuItem */ export class MenuItem { /** Is the menu item clickable, as opposed to greyed-out. */ diff --git a/core/metrics_manager.ts b/core/metrics_manager.ts index 082a8c3a9..615d19385 100644 --- a/core/metrics_manager.ts +++ b/core/metrics_manager.ts @@ -24,8 +24,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * The manager for all workspace metrics calculations. - * - * @alias Blockly.MetricsManager */ export class MetricsManager implements IMetricsManager { /** The workspace to calculate metrics for. */ diff --git a/core/mutator.ts b/core/mutator.ts index de9da6eb2..30b613d50 100644 --- a/core/mutator.ts +++ b/core/mutator.ts @@ -38,8 +38,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a mutator dialog. - * - * @alias Blockly.Mutator */ export class Mutator extends Icon { private quarkNames: string[]; diff --git a/core/names.ts b/core/names.ts index b6b026fd3..c6602d825 100644 --- a/core/names.ts +++ b/core/names.ts @@ -21,8 +21,6 @@ import type {Workspace} from './workspace.js'; /** * Class for a database of entity names (variables, procedures, etc). - * - * @alias Blockly.Names */ export class Names { static DEVELOPER_VARIABLE_TYPE: NameType; @@ -251,7 +249,6 @@ export namespace Names { * getName('foo', 'VARIABLE') = 'foo' * getName('foo', 'PROCEDURE') = 'foo2' * - * @alias Blockly.Names.NameType */ export enum NameType { DEVELOPER_VARIABLE = 'DEVELOPER_VARIABLE', diff --git a/core/options.ts b/core/options.ts index 92fd7182e..4f66582bb 100644 --- a/core/options.ts +++ b/core/options.ts @@ -26,8 +26,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Parse the user-specified options, using reasonable defaults where behaviour * is unspecified. - * - * @alias Blockly.Options */ export class Options { RTL: boolean; diff --git a/core/positionable_helpers.ts b/core/positionable_helpers.ts index 035ba91cd..34d1ef97a 100644 --- a/core/positionable_helpers.ts +++ b/core/positionable_helpers.ts @@ -23,7 +23,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Enum for vertical positioning. * - * @alias Blockly.uiPosition.verticalPosition * @internal */ export enum verticalPosition { @@ -34,7 +33,6 @@ export enum verticalPosition { /** * Enum for horizontal positioning. * - * @alias Blockly.uiPosition.horizontalPosition * @internal */ export enum horizontalPosition { @@ -45,7 +43,6 @@ export enum horizontalPosition { /** * An object defining a horizontal and vertical positioning. * - * @alias Blockly.uiPosition.Position * @internal */ export interface Position { @@ -56,7 +53,6 @@ export interface Position { /** * Enum for bump rules to use for dealing with collisions. * - * @alias Blockly.uiPosition.bumpDirection * @internal */ export enum bumpDirection { @@ -77,7 +73,6 @@ export enum bumpDirection { * @param metrics The workspace UI metrics. * @param workspace The workspace. * @returns The suggested start position. - * @alias Blockly.uiPosition.getStartPositionRect * @internal */ export function getStartPositionRect( @@ -124,7 +119,6 @@ export function getStartPositionRect( * @param workspace The workspace. * @param metrics The workspace metrics. * @returns The suggested corner position. - * @alias Blockly.uiPosition.getCornerOppositeToolbox * @internal */ export function getCornerOppositeToolbox( @@ -151,7 +145,6 @@ export function getCornerOppositeToolbox( * @param savedPositions List of rectangles that represent the positions of UI * elements already placed. * @returns The suggested position rectangle. - * @alias Blockly.uiPosition.bumpPositionRect * @internal */ export function bumpPositionRect( diff --git a/core/procedures.ts b/core/procedures.ts index cd36b660b..6213888ec 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -43,15 +43,11 @@ import * as Xml from './xml.js'; * procedure blocks. * See also Blockly.Variables.CATEGORY_NAME and * Blockly.VariablesDynamic.CATEGORY_NAME. - * - * @alias Blockly.Procedures.CATEGORY_NAME */ export const CATEGORY_NAME = 'PROCEDURE'; /** * The default argument for a procedures_mutatorarg block. - * - * @alias Blockly.Procedures.DEFAULT_ARG */ export const DEFAULT_ARG = 'x'; @@ -59,8 +55,6 @@ export type ProcedureTuple = [string, string[], boolean]; /** * Procedure block type. - * - * @alias Blockly.Procedures.ProcedureBlock */ export interface ProcedureBlock { getProcedureCall: () => string; @@ -95,7 +89,6 @@ function isLegacyProcedureCallBlock(block: Object): * @returns Pair of arrays, the first contains procedures without return * variables, the second with. Each procedure is defined by a three-element * list of name, parameter list, and return value boolean. - * @alias Blockly.Procedures.allProcedures */ export function allProcedures(root: Workspace): [ProcedureTuple[], ProcedureTuple[]] { @@ -155,7 +148,6 @@ function procTupleComparator(ta: ProcedureTuple, tb: ProcedureTuple): number { * @param name Proposed procedure name. * @param block Block to disambiguate. * @returns Non-colliding name. - * @alias Blockly.Procedures.findLegalName */ export function findLegalName(name: string, block: Block): string { if (block.isInFlyout) { @@ -197,7 +189,6 @@ function isLegalName( * @param opt_exclude Optional block to exclude from comparisons (one doesn't * want to collide with oneself). * @returns True if the name is used, otherwise return false. - * @alias Blockly.Procedures.isNameUsed */ export function isNameUsed( name: string, workspace: Workspace, opt_exclude?: Block): boolean { @@ -221,7 +212,6 @@ export function isNameUsed( * * @param name The proposed new name. * @returns The accepted name. - * @alias Blockly.Procedures.rename */ export function rename(this: Field, name: string): string { const block = this.getSourceBlock(); @@ -256,7 +246,6 @@ export function rename(this: Field, name: string): string { * * @param workspace The workspace containing procedures. * @returns Array of XML block elements. - * @alias Blockly.Procedures.flyoutCategory */ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { const xmlList = []; @@ -373,7 +362,6 @@ function updateMutatorFlyout(workspace: WorkspaceSvg) { * update and adds a mutator change listener to the mutator workspace. * * @param e The event that triggered this listener. - * @alias Blockly.Procedures.mutatorOpenListener * @internal */ export function mutatorOpenListener(e: Abstract) { @@ -419,7 +407,6 @@ function mutatorChangeListener(e: Abstract) { * @param name Name of procedure. * @param workspace The workspace to find callers in. * @returns Array of caller blocks. - * @alias Blockly.Procedures.getCallers */ export function getCallers(name: string, workspace: Workspace): Block[] { return workspace.getAllBlocks(false).filter((block) => { @@ -444,7 +431,6 @@ function blockIsModernCallerFor(block: Block, procName: string): boolean { * callers. * * @param defBlock Procedure definition block. - * @alias Blockly.Procedures.mutateCallers */ export function mutateCallers(defBlock: Block) { const oldRecordUndo = eventUtils.getRecordUndo(); @@ -478,7 +464,6 @@ export function mutateCallers(defBlock: Block) { * @param name Name of procedure. * @param workspace The workspace to search. * @returns The procedure definition block, or null not found. - * @alias Blockly.Procedures.getDefinition */ export function getDefinition(name: string, workspace: Workspace): Block|null { // Do not assume procedure is a top block. Some languages allow nested diff --git a/core/registry.ts b/core/registry.ts index f032fe362..c3219934b 100644 --- a/core/registry.ts +++ b/core/registry.ts @@ -48,15 +48,11 @@ const nameMap: {[key: string]: {[key: string]: string}} = Object.create(null); /** * The string used to register the default class for a type of plugin. - * - * @alias Blockly.registry.DEFAULT */ export const DEFAULT = 'default'; /** * A name with the type of the element stored in the generic. - * - * @alias Blockly.registry.Type */ export class Type<_T> { /** @param name The name of the registry type. */ @@ -112,7 +108,6 @@ export class Type<_T> { * @throws {Error} if the type or name is empty, a name with the given type has * already been registered, or if the given class or object is not valid for * its type. - * @alias Blockly.registry.register */ export function register( type: string|Type, name: string, @@ -181,7 +176,6 @@ function validate(type: string, registryItem: Function|AnyDuringMigration) { * @param type The type of the plugin. * (e.g. Field, Renderer) * @param name The plugin's name. (Ex. field_angle, geras) - * @alias Blockly.registry.unregister */ export function unregister(type: string|Type, name: string) { type = String(type).toLowerCase(); @@ -237,7 +231,6 @@ function getItem( * @param name The plugin's name. (Ex. field_angle, geras) * @returns True if the registry has an item with the given type and name, false * otherwise. - * @alias Blockly.registry.hasItem */ export function hasItem(type: string|Type, name: string): boolean { type = String(type).toLowerCase(); @@ -258,7 +251,6 @@ export function hasItem(type: string|Type, name: string): boolean { * @param opt_throwIfMissing Whether or not to throw an error if we are unable * to find the plugin. * @returns The class with the given name and type or null if none exists. - * @alias Blockly.registry.getClass */ export function getClass( type: string|Type, name: string, opt_throwIfMissing?: boolean): @@ -277,7 +269,6 @@ export function getClass( * @param opt_throwIfMissing Whether or not to throw an error if we are unable * to find the object. * @returns The object with the given name and type or null if none exists. - * @alias Blockly.registry.getObject */ export function getObject( type: string|Type, name: string, opt_throwIfMissing?: boolean): T|null { @@ -293,7 +284,6 @@ export function getObject( * @param opt_throwIfMissing Whether or not to throw an error if we are unable * to find the object. False by default. * @returns A map of objects with the given type, or null if none exists. - * @alias Blockly.registry.getAllItems */ export function getAllItems( type: string|Type, opt_cased?: boolean, opt_throwIfMissing?: boolean): @@ -331,7 +321,6 @@ export function getAllItems( * @param opt_throwIfMissing Whether or not to throw an error if we are unable * to find the plugin. * @returns The class for the plugin. - * @alias Blockly.registry.getClassFromOptions */ export function getClassFromOptions( type: Type, options: Options, opt_throwIfMissing?: boolean): diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 82af1b1b1..05b98e75c 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -43,8 +43,6 @@ const BUMP_RANDOMNESS = 10; /** * Class for a connection between blocks that may be rendered on screen. - * - * @alias Blockly.RenderedConnection */ export class RenderedConnection extends Connection { // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. diff --git a/core/renderers/common/block_rendering.ts b/core/renderers/common/block_rendering.ts index 3700bfa91..a7b558740 100644 --- a/core/renderers/common/block_rendering.ts +++ b/core/renderers/common/block_rendering.ts @@ -63,7 +63,6 @@ export function register(name: string, rendererClass: Function) { * Unregisters the renderer registered with the given name. * * @param name The name of the renderer. - * @alias Blockly.blockRendering.unregister */ export function unregister(name: string) { registry.unregister(registry.Type.RENDERER, name); @@ -72,7 +71,6 @@ export function unregister(name: string) { /** * Turn off the blocks debugger. * - * @alias Blockly.blockRendering.stopDebugger * @deprecated Use the debug renderer in **\@blockly/dev-tools** (See {@link * https://www.npmjs.com/package/@blockly/dev-tools}.) * @internal @@ -93,7 +91,6 @@ export function stopDebugger() { * @param opt_rendererOverrides Rendering constant overrides. * @returns The new instance of a renderer. * Already initialized. - * @alias Blockly.blockRendering.init * @internal */ export function init( diff --git a/core/renderers/common/constants.ts b/core/renderers/common/constants.ts index 82854abb4..c5e294bc2 100644 --- a/core/renderers/common/constants.ts +++ b/core/renderers/common/constants.ts @@ -105,8 +105,6 @@ export function isDynamicShape(shape: Shape): shape is DynamicShape { /** * An object that provides constants for rendering blocks. - * - * @alias Blockly.blockRendering.ConstantProvider */ export class ConstantProvider { /** The size of an empty spacer. */ diff --git a/core/renderers/common/debug.ts b/core/renderers/common/debug.ts index d54a2866e..6d331cc10 100644 --- a/core/renderers/common/debug.ts +++ b/core/renderers/common/debug.ts @@ -21,7 +21,6 @@ let useDebugger = false; * Returns whether the debugger is turned on. * * @returns Whether the debugger is turned on. - * @alias Blockly.blockRendering.debug.isDebuggerEnabled * @internal */ export function isDebuggerEnabled(): boolean { @@ -31,7 +30,6 @@ export function isDebuggerEnabled(): boolean { /** * Turn on the blocks debugger. * - * @alias Blockly.blockRendering.debug.startDebugger * @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools. * See https://www.npmjs.com/package/@blockly/dev-tools for more information. * @internal @@ -46,7 +44,6 @@ export function startDebugger() { /** * Turn off the blocks debugger. * - * @alias Blockly.blockRendering.debug.stopDebugger * @deprecated March 2022. Use the rendering debugger in @blockly/dev-tools. * See https://www.npmjs.com/package/@blockly/dev-tools for more information. * @internal diff --git a/core/renderers/common/debugger.ts b/core/renderers/common/debugger.ts index 4ec0e2ab6..89689630f 100644 --- a/core/renderers/common/debugger.ts +++ b/core/renderers/common/debugger.ts @@ -32,8 +32,6 @@ import type {RenderInfo} from './info.js'; /** * An object that renders rectangles and dots for debugging rendering code. - * - * @alias Blockly.blockRendering.Debug */ export class Debug { /** diff --git a/core/renderers/common/drawer.ts b/core/renderers/common/drawer.ts index 8751252da..c48397db1 100644 --- a/core/renderers/common/drawer.ts +++ b/core/renderers/common/drawer.ts @@ -32,8 +32,6 @@ import type {RenderInfo} from './info.js'; /** * An object that draws a block based on the given rendering information. - * - * @alias Blockly.blockRendering.Drawer */ export class Drawer { block_: BlockSvg; diff --git a/core/renderers/common/i_path_object.ts b/core/renderers/common/i_path_object.ts index 0d49835ec..661e61c6f 100644 --- a/core/renderers/common/i_path_object.ts +++ b/core/renderers/common/i_path_object.ts @@ -24,7 +24,6 @@ import {RenderedConnection} from '../../rendered_connection.js'; * * @param _root The root SVG element. * @param _constants The renderer's constants. - * @alias Blockly.blockRendering.IPathObject */ export interface IPathObject { /** diff --git a/core/renderers/common/info.ts b/core/renderers/common/info.ts index 1d0a9e0e7..16f2c726a 100644 --- a/core/renderers/common/info.ts +++ b/core/renderers/common/info.ts @@ -47,8 +47,6 @@ import type {Renderer} from './renderer.js'; * This measure pass does not propagate changes to the block (although fields * may choose to rerender when getSize() is called). However, calling it * repeatedly may be expensive. - * - * @alias Blockly.blockRendering.RenderInfo */ export class RenderInfo { block_: BlockSvg; diff --git a/core/renderers/common/marker_svg.ts b/core/renderers/common/marker_svg.ts index 67e4fdb8a..6df65adf8 100644 --- a/core/renderers/common/marker_svg.ts +++ b/core/renderers/common/marker_svg.ts @@ -46,8 +46,6 @@ const HEIGHT_MULTIPLIER = 3 / 4; /** * Class for a marker. - * - * @alias Blockly.blockRendering.MarkerSvg */ export class MarkerSvg { /** diff --git a/core/renderers/common/path_object.ts b/core/renderers/common/path_object.ts index c28a629e4..5d54d929f 100644 --- a/core/renderers/common/path_object.ts +++ b/core/renderers/common/path_object.ts @@ -25,8 +25,6 @@ import type {IPathObject} from './i_path_object.js'; /** * An object that handles creating and setting each of the SVG elements * used by the renderer. - * - * @alias Blockly.blockRendering.PathObject */ export class PathObject implements IPathObject { svgRoot: SVGElement; diff --git a/core/renderers/common/renderer.ts b/core/renderers/common/renderer.ts index ef2ab2146..fa0314cca 100644 --- a/core/renderers/common/renderer.ts +++ b/core/renderers/common/renderer.ts @@ -35,8 +35,6 @@ import {PathObject} from './path_object.js'; /** * The base class for a block renderer. - * - * @alias Blockly.blockRendering.Renderer */ export class Renderer implements IRegistrable { /** The renderer's constant provider. */ diff --git a/core/renderers/geras/constants.ts b/core/renderers/geras/constants.ts index 7eb829d94..b7b9cacb7 100644 --- a/core/renderers/geras/constants.ts +++ b/core/renderers/geras/constants.ts @@ -18,8 +18,6 @@ import {ConstantProvider as BaseConstantProvider} from '../common/constants.js'; /** * An object that provides constants for rendering blocks in Geras mode. - * - * @alias Blockly.geras.ConstantProvider */ export class ConstantProvider extends BaseConstantProvider { override FIELD_TEXT_BASELINE_CENTER = false; diff --git a/core/renderers/geras/drawer.ts b/core/renderers/geras/drawer.ts index b0469e259..f886888df 100644 --- a/core/renderers/geras/drawer.ts +++ b/core/renderers/geras/drawer.ts @@ -27,8 +27,6 @@ import type {PathObject} from './path_object.js'; /** * An object that draws a block based on the given rendering information. - * - * @alias Blockly.geras.Drawer */ export class Drawer extends BaseDrawer { highlighter_: Highlighter; diff --git a/core/renderers/geras/highlight_constants.ts b/core/renderers/geras/highlight_constants.ts index fab2ec9b9..bc8d768c8 100644 --- a/core/renderers/geras/highlight_constants.ts +++ b/core/renderers/geras/highlight_constants.ts @@ -64,8 +64,6 @@ export interface JaggedTeeth { * Some highlights are simple offsets of the parent paths and can be generated * programmatically. Others, especially on curves, are just made out of piles * of constants and are hard to tweak. - * - * @alias Blockly.geras.HighlightConstantProvider */ export class HighlightConstantProvider { constantProvider: ConstantProvider; diff --git a/core/renderers/geras/highlighter.ts b/core/renderers/geras/highlighter.ts index 8a619fa34..097456dfd 100644 --- a/core/renderers/geras/highlighter.ts +++ b/core/renderers/geras/highlighter.ts @@ -36,8 +36,6 @@ import type {InlineInput} from './measurables/inline_input.js'; * position of each part of the block. The resulting paths are not continuous * or closed paths. The highlights for tabs and notches are loosely based on * tab and notch shapes, but are not exactly the same. - * - * @alias Blockly.geras.Highlighter */ export class Highlighter { info_: RenderInfo; diff --git a/core/renderers/geras/info.ts b/core/renderers/geras/info.ts index 305cde369..9dcfcb1ef 100644 --- a/core/renderers/geras/info.ts +++ b/core/renderers/geras/info.ts @@ -39,8 +39,6 @@ import type {Renderer} from './renderer.js'; * This measure pass does not propagate changes to the block (although fields * may choose to rerender when getSize() is called). However, calling it * repeatedly may be expensive. - * - * @alias Blockly.geras.RenderInfo */ export class RenderInfo extends BaseRenderInfo { // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. diff --git a/core/renderers/geras/measurables/inline_input.ts b/core/renderers/geras/measurables/inline_input.ts index be3b6578a..016f1fbd4 100644 --- a/core/renderers/geras/measurables/inline_input.ts +++ b/core/renderers/geras/measurables/inline_input.ts @@ -23,8 +23,6 @@ import type {ConstantProvider as GerasConstantProvider} from '../constants.js'; /** * An object containing information about the space an inline input takes up * during rendering. - * - * @alias Blockly.geras.InlineInput */ export class InlineInput extends BaseInlineInput { override constants_: GerasConstantProvider; diff --git a/core/renderers/geras/measurables/statement_input.ts b/core/renderers/geras/measurables/statement_input.ts index 2fa21fa11..58e35ac5f 100644 --- a/core/renderers/geras/measurables/statement_input.ts +++ b/core/renderers/geras/measurables/statement_input.ts @@ -23,8 +23,6 @@ import type {ConstantProvider as GerasConstantProvider} from '../constants.js'; /** * An object containing information about the space a statement input takes up * during rendering. - * - * @alias Blockly.geras.StatementInput */ export class StatementInput extends BaseStatementInput { override constants_: GerasConstantProvider; diff --git a/core/renderers/geras/path_object.ts b/core/renderers/geras/path_object.ts index 07d2fcbc5..fc11f5a6c 100644 --- a/core/renderers/geras/path_object.ts +++ b/core/renderers/geras/path_object.ts @@ -25,8 +25,6 @@ import type {ConstantProvider} from './constants.js'; /** * An object that handles creating and setting each of the SVG elements * used by the renderer. - * - * @alias Blockly.geras.PathObject */ export class PathObject extends BasePathObject { /** @internal */ diff --git a/core/renderers/geras/renderer.ts b/core/renderers/geras/renderer.ts index bdc4969b2..7f0c50ed8 100644 --- a/core/renderers/geras/renderer.ts +++ b/core/renderers/geras/renderer.ts @@ -27,8 +27,6 @@ import {PathObject} from './path_object.js'; /** * The geras renderer. - * - * @alias Blockly.geras.Renderer */ export class Renderer extends BaseRenderer { /** The renderer's highlight constant provider. */ diff --git a/core/renderers/measurables/base.ts b/core/renderers/measurables/base.ts index 105396b63..48ab5b3b0 100644 --- a/core/renderers/measurables/base.ts +++ b/core/renderers/measurables/base.ts @@ -21,8 +21,6 @@ import {Types} from './types.js'; * The base class to represent a part of a block that takes up space during * rendering. The constructor for each non-spacer Measurable records the size * of the block element (e.g. field, statement input). - * - * @alias Blockly.blockRendering.Measurable */ export class Measurable { width = 0; diff --git a/core/renderers/measurables/bottom_row.ts b/core/renderers/measurables/bottom_row.ts index f72809052..73602c5af 100644 --- a/core/renderers/measurables/bottom_row.ts +++ b/core/renderers/measurables/bottom_row.ts @@ -26,8 +26,6 @@ import {Types} from './types.js'; * a block as well as spacing information for the bottom row. * Elements in a bottom row can consist of corners, spacers and next * connections. - * - * @alias Blockly.blockRendering.BottomRow */ export class BottomRow extends Row { /** diff --git a/core/renderers/measurables/connection.ts b/core/renderers/measurables/connection.ts index ab4dbcd37..3f6080c5f 100644 --- a/core/renderers/measurables/connection.ts +++ b/core/renderers/measurables/connection.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * The base class to represent a connection and the space that it takes up on * the block. - * - * @alias Blockly.blockRendering.Connection */ export class Connection extends Measurable { shape: Shape; diff --git a/core/renderers/measurables/external_value_input.ts b/core/renderers/measurables/external_value_input.ts index 86adebe9d..7e4e57731 100644 --- a/core/renderers/measurables/external_value_input.ts +++ b/core/renderers/measurables/external_value_input.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * An object containing information about the space an external value input * takes up during rendering - * - * @alias Blockly.blockRendering.ExternalValueInput */ export class ExternalValueInput extends InputConnection { override height = 0; diff --git a/core/renderers/measurables/field.ts b/core/renderers/measurables/field.ts index 344f3e636..140011ae4 100644 --- a/core/renderers/measurables/field.ts +++ b/core/renderers/measurables/field.ts @@ -25,8 +25,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a field takes up during * rendering - * - * @alias Blockly.blockRendering.Field */ export class Field extends Measurable { isEditable: boolean; diff --git a/core/renderers/measurables/hat.ts b/core/renderers/measurables/hat.ts index 2d747c834..52eec943f 100644 --- a/core/renderers/measurables/hat.ts +++ b/core/renderers/measurables/hat.ts @@ -22,8 +22,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a hat takes up during * rendering. - * - * @alias Blockly.blockRendering.Hat */ export class Hat extends Measurable { ascenderHeight: number; diff --git a/core/renderers/measurables/icon.ts b/core/renderers/measurables/icon.ts index 3fdfd99fd..1259eaafd 100644 --- a/core/renderers/measurables/icon.ts +++ b/core/renderers/measurables/icon.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * An object containing information about the space an icon takes up during * rendering - * - * @alias Blockly.blockRendering.Icon */ export class Icon extends Measurable { isVisible: boolean; diff --git a/core/renderers/measurables/in_row_spacer.ts b/core/renderers/measurables/in_row_spacer.ts index c3474f403..a28618b10 100644 --- a/core/renderers/measurables/in_row_spacer.ts +++ b/core/renderers/measurables/in_row_spacer.ts @@ -22,8 +22,6 @@ import {Types} from './types.js'; /** * An object containing information about a spacer between two elements on a * row. - * - * @alias Blockly.blockRendering.InRowSpacer */ export class InRowSpacer extends Measurable { /** diff --git a/core/renderers/measurables/inline_input.ts b/core/renderers/measurables/inline_input.ts index a252b5950..564d33227 100644 --- a/core/renderers/measurables/inline_input.ts +++ b/core/renderers/measurables/inline_input.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * An object containing information about the space an inline input takes up * during rendering - * - * @alias Blockly.blockRendering.InlineInput */ export class InlineInput extends InputConnection { connectionHeight: number; diff --git a/core/renderers/measurables/input_connection.ts b/core/renderers/measurables/input_connection.ts index 3a2d23a06..4716dfde9 100644 --- a/core/renderers/measurables/input_connection.ts +++ b/core/renderers/measurables/input_connection.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * The base class to represent an input that takes up space on a block * during rendering - * - * @alias Blockly.blockRendering.InputConnection */ export class InputConnection extends Connection { align: number; diff --git a/core/renderers/measurables/input_row.ts b/core/renderers/measurables/input_row.ts index 40854f958..d43e29be0 100644 --- a/core/renderers/measurables/input_row.ts +++ b/core/renderers/measurables/input_row.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * An object containing information about a row that holds one or more inputs. - * - * @alias Blockly.blockRendering.InputRow */ export class InputRow extends Row { /** diff --git a/core/renderers/measurables/jagged_edge.ts b/core/renderers/measurables/jagged_edge.ts index b9721ffab..c65c24081 100644 --- a/core/renderers/measurables/jagged_edge.ts +++ b/core/renderers/measurables/jagged_edge.ts @@ -22,8 +22,6 @@ import {Types} from './types.js'; /** * An object containing information about the jagged edge of a collapsed block * takes up during rendering - * - * @alias Blockly.blockRendering.JaggedEdge */ export class JaggedEdge extends Measurable { /** diff --git a/core/renderers/measurables/next_connection.ts b/core/renderers/measurables/next_connection.ts index 9be182963..7ef5212e7 100644 --- a/core/renderers/measurables/next_connection.ts +++ b/core/renderers/measurables/next_connection.ts @@ -23,8 +23,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a next connection takes * up during rendering. - * - * @alias Blockly.blockRendering.NextConnection */ export class NextConnection extends Connection { /** diff --git a/core/renderers/measurables/output_connection.ts b/core/renderers/measurables/output_connection.ts index 17a73c1c2..c2d407a96 100644 --- a/core/renderers/measurables/output_connection.ts +++ b/core/renderers/measurables/output_connection.ts @@ -23,8 +23,6 @@ import {Types} from './types.js'; /** * An object containing information about the space an output connection takes * up during rendering. - * - * @alias Blockly.blockRendering.OutputConnection */ export class OutputConnection extends Connection { startX: number; diff --git a/core/renderers/measurables/previous_connection.ts b/core/renderers/measurables/previous_connection.ts index cb65f8746..6d95b02e1 100644 --- a/core/renderers/measurables/previous_connection.ts +++ b/core/renderers/measurables/previous_connection.ts @@ -23,8 +23,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a previous connection takes * up during rendering. - * - * @alias Blockly.blockRendering.PreviousConnection */ export class PreviousConnection extends Connection { /** diff --git a/core/renderers/measurables/round_corner.ts b/core/renderers/measurables/round_corner.ts index 0e0c809bf..7746b7998 100644 --- a/core/renderers/measurables/round_corner.ts +++ b/core/renderers/measurables/round_corner.ts @@ -22,8 +22,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a rounded corner takes up * during rendering. - * - * @alias Blockly.blockRendering.RoundCorner */ export class RoundCorner extends Measurable { /** diff --git a/core/renderers/measurables/row.ts b/core/renderers/measurables/row.ts index 17aed1e07..2063e74d9 100644 --- a/core/renderers/measurables/row.ts +++ b/core/renderers/measurables/row.ts @@ -23,8 +23,6 @@ import {Types} from './types.js'; /** * An object representing a single row on a rendered block and all of its * subcomponents. - * - * @alias Blockly.blockRendering.Row */ export class Row { /** @internal */ diff --git a/core/renderers/measurables/spacer_row.ts b/core/renderers/measurables/spacer_row.ts index 2a9d1be26..1e1fdcfd3 100644 --- a/core/renderers/measurables/spacer_row.ts +++ b/core/renderers/measurables/spacer_row.ts @@ -21,8 +21,6 @@ import {Types} from './types.js'; /** * An object containing information about a spacer between two rows. - * - * @alias Blockly.blockRendering.SpacerRow */ export class SpacerRow extends Row { followsStatement = false; diff --git a/core/renderers/measurables/square_corner.ts b/core/renderers/measurables/square_corner.ts index a37e63d23..9e3e4b226 100644 --- a/core/renderers/measurables/square_corner.ts +++ b/core/renderers/measurables/square_corner.ts @@ -22,8 +22,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a square corner takes up * during rendering. - * - * @alias Blockly.blockRendering.SquareCorner */ export class SquareCorner extends Measurable { /** diff --git a/core/renderers/measurables/statement_input.ts b/core/renderers/measurables/statement_input.ts index 58bbbdabe..f7f0ce137 100644 --- a/core/renderers/measurables/statement_input.ts +++ b/core/renderers/measurables/statement_input.ts @@ -24,8 +24,6 @@ import {Types} from './types.js'; /** * An object containing information about the space a statement input takes up * during rendering - * - * @alias Blockly.blockRendering.StatementInput */ export class StatementInput extends InputConnection { /** diff --git a/core/renderers/measurables/top_row.ts b/core/renderers/measurables/top_row.ts index 8c7c7f084..1ba9301b5 100644 --- a/core/renderers/measurables/top_row.ts +++ b/core/renderers/measurables/top_row.ts @@ -28,8 +28,6 @@ import {Types} from './types.js'; * connections. * After this constructor is called, the row will contain all non-spacer * elements it needs. - * - * @alias Blockly.blockRendering.TopRow */ export class TopRow extends Row { /** diff --git a/core/renderers/measurables/types.ts b/core/renderers/measurables/types.ts index d4be3297a..1667148e5 100644 --- a/core/renderers/measurables/types.ts +++ b/core/renderers/measurables/types.ts @@ -18,8 +18,6 @@ import type {Row} from './row.js'; /** * Types of rendering elements. - * - * @alias Blockly.blockRendering.Types */ class TypesContainer { [index: string]: number|Function; diff --git a/core/renderers/minimalist/constants.ts b/core/renderers/minimalist/constants.ts index f9dc23aee..10b5251b2 100644 --- a/core/renderers/minimalist/constants.ts +++ b/core/renderers/minimalist/constants.ts @@ -18,8 +18,6 @@ import {ConstantProvider as BaseConstantProvider} from '../common/constants.js'; /** * An object that provides constants for rendering blocks in the sample. - * - * @alias Blockly.minimalist.ConstantProvider */ export class ConstantProvider extends BaseConstantProvider { /** @internal */ diff --git a/core/renderers/minimalist/drawer.ts b/core/renderers/minimalist/drawer.ts index 1027a8d9d..0b45cc4da 100644 --- a/core/renderers/minimalist/drawer.ts +++ b/core/renderers/minimalist/drawer.ts @@ -20,8 +20,6 @@ import type {RenderInfo} from './info.js'; /** * An object that draws a block based on the given rendering information. - * - * @alias Blockly.minimalist.Drawer */ export class Drawer extends BaseDrawer { /** diff --git a/core/renderers/minimalist/info.ts b/core/renderers/minimalist/info.ts index aa31270eb..1af3d4e9a 100644 --- a/core/renderers/minimalist/info.ts +++ b/core/renderers/minimalist/info.ts @@ -24,8 +24,6 @@ import type {Renderer} from './renderer.js'; * This measure pass does not propagate changes to the block (although fields * may choose to rerender when getSize() is called). However, calling it * repeatedly may be expensive. - * - * @alias Blockly.minimalist.RenderInfo */ export class RenderInfo extends BaseRenderInfo { // Exclamation is fine b/c this is assigned by the super constructor. diff --git a/core/renderers/minimalist/renderer.ts b/core/renderers/minimalist/renderer.ts index 2a4a509ee..0696f8e14 100644 --- a/core/renderers/minimalist/renderer.ts +++ b/core/renderers/minimalist/renderer.ts @@ -24,8 +24,6 @@ import {RenderInfo} from './info.js'; /** * The minimalist renderer. - * - * @alias Blockly.minimalist.Renderer */ export class Renderer extends BaseRenderer { /** diff --git a/core/renderers/thrasos/info.ts b/core/renderers/thrasos/info.ts index abedc8793..c7e62b612 100644 --- a/core/renderers/thrasos/info.ts +++ b/core/renderers/thrasos/info.ts @@ -32,8 +32,6 @@ import type {Renderer} from './renderer.js'; * This measure pass does not propagate changes to the block (although fields * may choose to rerender when getSize() is called). However, calling it * repeatedly may be expensive. - * - * @alias Blockly.thrasos.RenderInfo */ export class RenderInfo extends BaseRenderInfo { // Exclamation is fine b/c this is assigned by the super constructor. diff --git a/core/renderers/thrasos/renderer.ts b/core/renderers/thrasos/renderer.ts index 88d6732a4..2789a0ba2 100644 --- a/core/renderers/thrasos/renderer.ts +++ b/core/renderers/thrasos/renderer.ts @@ -21,8 +21,6 @@ import {RenderInfo} from './info.js'; /** * The thrasos renderer. - * - * @alias Blockly.thrasos.Renderer */ export class Renderer extends BaseRenderer { /** diff --git a/core/renderers/zelos/constants.ts b/core/renderers/zelos/constants.ts index 4d7832aac..038e45d9f 100644 --- a/core/renderers/zelos/constants.ts +++ b/core/renderers/zelos/constants.ts @@ -38,8 +38,6 @@ export interface InsideCorners { /** * An object that provides constants for rendering blocks in Zelos mode. - * - * @alias Blockly.zelos.ConstantProvider */ export class ConstantProvider extends BaseConstantProvider { GRID_UNIT = 4; diff --git a/core/renderers/zelos/drawer.ts b/core/renderers/zelos/drawer.ts index f081166b1..301fbd004 100644 --- a/core/renderers/zelos/drawer.ts +++ b/core/renderers/zelos/drawer.ts @@ -30,8 +30,6 @@ import type {PathObject} from './path_object.js'; /** * An object that draws a block based on the given rendering information. - * - * @alias Blockly.zelos.Drawer */ export class Drawer extends BaseDrawer { // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. diff --git a/core/renderers/zelos/info.ts b/core/renderers/zelos/info.ts index 9071bb8da..fdaa913b6 100644 --- a/core/renderers/zelos/info.ts +++ b/core/renderers/zelos/info.ts @@ -42,8 +42,6 @@ import type {Renderer} from './renderer.js'; * This measure pass does not propagate changes to the block (although fields * may choose to rerender when getSize() is called). However, calling it * repeatedly may be expensive. - * - * @alias Blockly.zelos.RenderInfo */ export class RenderInfo extends BaseRenderInfo { override topRow: TopRow; diff --git a/core/renderers/zelos/marker_svg.ts b/core/renderers/zelos/marker_svg.ts index 4227c3a9e..27c701d47 100644 --- a/core/renderers/zelos/marker_svg.ts +++ b/core/renderers/zelos/marker_svg.ts @@ -27,8 +27,6 @@ import type {ConstantProvider as ZelosConstantProvider} from './constants.js'; /** * Class to draw a marker. - * - * @alias Blockly.zelos.MarkerSvg */ export class MarkerSvg extends BaseMarkerSvg { // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. diff --git a/core/renderers/zelos/measurables/bottom_row.ts b/core/renderers/zelos/measurables/bottom_row.ts index f4acded33..d0e1d2ba6 100644 --- a/core/renderers/zelos/measurables/bottom_row.ts +++ b/core/renderers/zelos/measurables/bottom_row.ts @@ -22,8 +22,6 @@ import {BottomRow as BaseBottomRow} from '../../../renderers/measurables/bottom_ * a block as well as spacing information for the top row. * Elements in a bottom row can consist of corners, spacers and next * connections. - * - * @alias Blockly.zelos.BottomRow */ export class BottomRow extends BaseBottomRow { /** diff --git a/core/renderers/zelos/measurables/inputs.ts b/core/renderers/zelos/measurables/inputs.ts index b0e629dbe..909d1a314 100644 --- a/core/renderers/zelos/measurables/inputs.ts +++ b/core/renderers/zelos/measurables/inputs.ts @@ -22,8 +22,6 @@ import {StatementInput as BaseStatementInput} from '../../../renderers/measurabl /** * An object containing information about the space a statement input takes up * during rendering. - * - * @alias Blockly.zelos.StatementInput */ export class StatementInput extends BaseStatementInput { connectedBottomNextConnection = false; diff --git a/core/renderers/zelos/measurables/row_elements.ts b/core/renderers/zelos/measurables/row_elements.ts index 0da74d4e5..05f594766 100644 --- a/core/renderers/zelos/measurables/row_elements.ts +++ b/core/renderers/zelos/measurables/row_elements.ts @@ -21,8 +21,6 @@ import {Types} from '../../../renderers/measurables/types.js'; /** * An object containing information about the space a right connection shape * takes up during rendering. - * - * @alias Blockly.zelos.RightConnectionShape */ export class RightConnectionShape extends Measurable { // Size is dynamic diff --git a/core/renderers/zelos/measurables/top_row.ts b/core/renderers/zelos/measurables/top_row.ts index 9c3e207dc..996018ae4 100644 --- a/core/renderers/zelos/measurables/top_row.ts +++ b/core/renderers/zelos/measurables/top_row.ts @@ -24,8 +24,6 @@ import {TopRow as BaseTopRow} from '../../../renderers/measurables/top_row.js'; * connections. * After this constructor is called, the row will contain all non-spacer * elements it needs. - * - * @alias Blockly.zelos.TopRow */ export class TopRow extends BaseTopRow { /** diff --git a/core/renderers/zelos/path_object.ts b/core/renderers/zelos/path_object.ts index fba99877a..352b7dddf 100644 --- a/core/renderers/zelos/path_object.ts +++ b/core/renderers/zelos/path_object.ts @@ -25,8 +25,6 @@ import type {ConstantProvider} from './constants.js'; /** * An object that handles creating and setting each of the SVG elements * used by the renderer. - * - * @alias Blockly.zelos.PathObject */ export class PathObject extends BasePathObject { /** The selected path of the block. */ diff --git a/core/renderers/zelos/renderer.ts b/core/renderers/zelos/renderer.ts index 6fa749104..c4f8ed1ce 100644 --- a/core/renderers/zelos/renderer.ts +++ b/core/renderers/zelos/renderer.ts @@ -33,8 +33,6 @@ import {PathObject} from './path_object.js'; /** * The zelos renderer. - * - * @alias Blockly.zelos.Renderer */ export class Renderer extends BaseRenderer { protected override constants_!: ConstantProvider; diff --git a/core/scrollbar.ts b/core/scrollbar.ts index 1ddf4cf56..17e3d29bd 100644 --- a/core/scrollbar.ts +++ b/core/scrollbar.ts @@ -31,8 +31,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * Class for a pure SVG scrollbar. * This technique offers a scrollbar that is guaranteed to work, but may not * look or behave like the system's scrollbars. - * - * @alias Blockly.Scrollbar */ export class Scrollbar { /** diff --git a/core/scrollbar_pair.ts b/core/scrollbar_pair.ts index 6c29a9648..35e3a0cd3 100644 --- a/core/scrollbar_pair.ts +++ b/core/scrollbar_pair.ts @@ -22,8 +22,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a pair of scrollbars. Horizontal and vertical. - * - * @alias Blockly.ScrollbarPair */ export class ScrollbarPair { hScroll: Scrollbar|null = null; diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index 5c55f04ab..8d3e096db 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -32,8 +32,6 @@ import * as serializationRegistry from './registry.js'; /** * Represents the state of a connection. - * - * @alias Blockly.serialization.blocks.ConnectionState */ export interface ConnectionState { shadow: State|undefined; @@ -42,8 +40,6 @@ export interface ConnectionState { /** * Represents the state of a given block. - * - * @alias Blockly.serialization.blocks.State */ export interface State { type: string; @@ -77,7 +73,6 @@ export interface State { * exist. True by default. * @returns The serialized state of the block, or null if the block could not be * serialied (eg it was an insertion marker). - * @alias Blockly.serialization.blocks.save */ export function save(block: Block, { addCoordinates = false, @@ -317,7 +312,6 @@ function saveConnection(connection: Connection, doFullSerialization: boolean): * @param param1 recordUndo: If true, events triggered by this function will be * undo-able by the user. False by default. * @returns The block that was just loaded. - * @alias Blockly.serialization.blocks.append */ export function append( state: State, workspace: Workspace, @@ -340,7 +334,6 @@ export function append( * it is created. False by default. recordUndo: If true, events triggered by * this function will be undo-able by the user. False by default. * @returns The block that was just appended. - * @alias Blockly.serialization.blocks.appendInternal * @internal */ export function appendInternal( @@ -662,8 +655,6 @@ const saveBlock = save; /** * Serializer for saving and loading block state. - * - * @alias Blockly.serialization.blocks.BlockSerializer */ export class BlockSerializer implements ISerializer { priority: number; diff --git a/core/serialization/exceptions.ts b/core/serialization/exceptions.ts index 440769450..506c83063 100644 --- a/core/serialization/exceptions.ts +++ b/core/serialization/exceptions.ts @@ -16,14 +16,12 @@ import type {Block} from '../block.js'; import type {State} from './blocks.js'; -/** @alias Blockly.serialization.exceptions.DeserializationError */ export class DeserializationError extends Error {} /** * Represents an error where the serialized state is expected to provide a * block type, but it is not provided. * - * @alias Blockly.serialization.exceptions.MissingBlockType */ export class MissingBlockType extends DeserializationError { /** @@ -38,8 +36,6 @@ export class MissingBlockType extends DeserializationError { /** * Represents an error where deserialization encountered a block that did * not have a connection that was defined in the serialized state. - * - * @alias Blockly.serialization.exceptions.MissingConnection */ export class MissingConnection extends DeserializationError { /** @@ -58,8 +54,6 @@ connection`); /** * Represents an error where deserialization tried to connect two connections * that were not compatible. - * - * @alias Blockly.serialization.exceptions.BadConnectionCheck */ export class BadConnectionCheck extends DeserializationError { /** @@ -83,8 +77,6 @@ ${childConnection} to its parent, because: ${reason}`); * was deserializing children of a shadow. * This is an error because it is an invariant of Blockly that shadow blocks * do not have real children. - * - * @alias Blockly.serialization.exceptions.RealChildOfShadow */ export class RealChildOfShadow extends DeserializationError { /** diff --git a/core/serialization/priorities.ts b/core/serialization/priorities.ts index b49c7222d..03d053279 100644 --- a/core/serialization/priorities.ts +++ b/core/serialization/priorities.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.serialization.priorities'); /** * The priority for deserializing variables. - * - * @alias Blockly.serialization.priorities.VARIABLES */ export const VARIABLES = 100; @@ -29,7 +27,5 @@ export const PROCEDURES = 75; /** * The priority for deserializing blocks. - * - * @alias Blockly.serialization.priorities.BLOCKS */ export const BLOCKS = 50; diff --git a/core/serialization/registry.ts b/core/serialization/registry.ts index ab6b2023c..b57030751 100644 --- a/core/serialization/registry.ts +++ b/core/serialization/registry.ts @@ -24,7 +24,6 @@ import * as registry from '../registry.js'; * * @param name The name of the serializer to register. * @param serializer The serializer to register. - * @alias Blockly.serialization.registry.register */ export function register(name: string, serializer: ISerializer) { registry.register(registry.Type.SERIALIZER, name, serializer); @@ -34,7 +33,6 @@ export function register(name: string, serializer: ISerializer) { * Unregisters the serializer associated with the given name. * * @param name The name of the serializer to unregister. - * @alias Blockly.serialization.registry.unregister */ export function unregister(name: string) { registry.unregister(registry.Type.SERIALIZER, name); diff --git a/core/serialization/variables.ts b/core/serialization/variables.ts index dd1eb2d5b..3259763ac 100644 --- a/core/serialization/variables.ts +++ b/core/serialization/variables.ts @@ -22,8 +22,6 @@ import * as serializationRegistry from './registry.js'; /** * Represents the state of a given variable. - * - * @alias Blockly.serialization.variables.State */ export interface State { name: string; @@ -33,8 +31,6 @@ export interface State { /** * Serializer for saving and loading variable state. - * - * @alias Blockly.serialization.variables.VariableSerializer */ export class VariableSerializer implements ISerializer { priority: number; diff --git a/core/serialization/workspaces.ts b/core/serialization/workspaces.ts index 9d8e857ef..378d12a61 100644 --- a/core/serialization/workspaces.ts +++ b/core/serialization/workspaces.ts @@ -27,7 +27,6 @@ import {WorkspaceSvg} from '../workspace_svg.js'; * * @param workspace The workspace to serialize. * @returns The serialized state of the workspace. - * @alias Blockly.serialization.workspaces.save */ export function save(workspace: Workspace): {[key: string]: AnyDuringMigration} { @@ -49,7 +48,6 @@ export function save(workspace: Workspace): * @param workspace The workspace to add the new state to. * @param param1 recordUndo: If true, events triggered by this function will be * undo-able by the user. False by default. - * @alias Blockly.serialization.workspaces.load */ export function load( state: {[key: string]: AnyDuringMigration}, workspace: Workspace, diff --git a/core/shortcut_items.ts b/core/shortcut_items.ts index cf35096e9..936ae4f5c 100644 --- a/core/shortcut_items.ts +++ b/core/shortcut_items.ts @@ -24,8 +24,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Object holding the names of the default shortcut items. - * - * @alias Blockly.ShortcutItems.names */ export enum names { ESCAPE = 'escape', @@ -39,8 +37,6 @@ export enum names { /** * Keyboard shortcut to hide chaff on escape. - * - * @alias Blockly.ShortcutItems.registerEscape */ export function registerEscape() { const escapeAction: KeyboardShortcut = { @@ -61,8 +57,6 @@ export function registerEscape() { /** * Keyboard shortcut to delete a block on delete or backspace - * - * @alias Blockly.ShortcutItems.registerDelete */ export function registerDelete() { const deleteShortcut: KeyboardShortcut = { @@ -92,8 +86,6 @@ export function registerDelete() { /** * Keyboard shortcut to copy a block on ctrl+c, cmd+c, or alt+c. - * - * @alias Blockly.ShortcutItems.registerCopy */ export function registerCopy() { const ctrlC = ShortcutRegistry.registry.createSerializedKey( @@ -127,8 +119,6 @@ export function registerCopy() { /** * Keyboard shortcut to copy and delete a block on ctrl+x, cmd+x, or alt+x. - * - * @alias Blockly.ShortcutItems.registerCut */ export function registerCut() { const ctrlX = ShortcutRegistry.registry.createSerializedKey( @@ -165,8 +155,6 @@ export function registerCut() { /** * Keyboard shortcut to paste a block on ctrl+v, cmd+v, or alt+v. - * - * @alias Blockly.ShortcutItems.registerPaste */ export function registerPaste() { const ctrlV = ShortcutRegistry.registry.createSerializedKey( @@ -192,8 +180,6 @@ export function registerPaste() { /** * Keyboard shortcut to undo the previous action on ctrl+z, cmd+z, or alt+z. - * - * @alias Blockly.ShortcutItems.registerUndo */ export function registerUndo() { const ctrlZ = ShortcutRegistry.registry.createSerializedKey( @@ -222,8 +208,6 @@ export function registerUndo() { /** * Keyboard shortcut to redo the previous action on ctrl+shift+z, cmd+shift+z, * or alt+shift+z. - * - * @alias Blockly.ShortcutItems.registerRedo */ export function registerRedo() { const ctrlShiftZ = ShortcutRegistry.registry.createSerializedKey( @@ -256,7 +240,6 @@ export function registerRedo() { * Registers all default keyboard shortcut item. This should be called once per * instance of KeyboardShortcutRegistry. * - * @alias Blockly.ShortcutItems.registerDefaultShortcuts * @internal */ export function registerDefaultShortcuts() { diff --git a/core/shortcut_registry.ts b/core/shortcut_registry.ts index aba367887..191913941 100644 --- a/core/shortcut_registry.ts +++ b/core/shortcut_registry.ts @@ -22,8 +22,6 @@ import type {Workspace} from './workspace.js'; * Class for the registry of keyboard shortcuts. This is intended to be a * singleton. You should not create a new instance, and only access this class * from ShortcutRegistry.registry. - * - * @alias Blockly.ShortcutRegistry */ export class ShortcutRegistry { static readonly registry = new ShortcutRegistry(); diff --git a/core/sprites.ts b/core/sprites.ts index 223535ca9..41933de3d 100644 --- a/core/sprites.ts +++ b/core/sprites.ts @@ -7,8 +7,6 @@ /** * Contains the path to a single png tat holds the images for the trashcan * as well as the zoom controls. - * - * @alias Blockly.sprite.SPRITE */ export const SPRITE = { width: 96, diff --git a/core/theme.ts b/core/theme.ts index c34600233..c79bc8a33 100644 --- a/core/theme.ts +++ b/core/theme.ts @@ -28,8 +28,6 @@ export interface ITheme { /** * Class for a theme. - * - * @alias Blockly.Theme */ export class Theme implements ITheme { /** @internal */ diff --git a/core/theme/classic.ts b/core/theme/classic.ts index 8989573ab..8c0bd3755 100644 --- a/core/theme/classic.ts +++ b/core/theme/classic.ts @@ -44,8 +44,6 @@ const categoryStyles = { /** * Classic theme. * Contains multi-coloured border to create shadow effect. - * - * @alias Blockly.Themes.Classic */ export const Classic = new Theme( 'classic', defaultBlockStyles as AnyDuringMigration, categoryStyles); diff --git a/core/theme/zelos.ts b/core/theme/zelos.ts index a0583cd69..66c85d9a0 100644 --- a/core/theme/zelos.ts +++ b/core/theme/zelos.ts @@ -83,7 +83,5 @@ const categoryStyles = { /** * Zelos theme. - * - * @alias Blockly.Themes.Zelos */ export const Zelos = new Theme('zelos', defaultBlockStyles, categoryStyles); diff --git a/core/theme_manager.ts b/core/theme_manager.ts index 33fa9f483..2052b7f61 100644 --- a/core/theme_manager.ts +++ b/core/theme_manager.ts @@ -22,8 +22,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for storing and updating a workspace's theme and UI components. - * - * @alias Blockly.ThemeManager */ export class ThemeManager { /** A list of workspaces that are subscribed to this theme. */ diff --git a/core/toolbox/category.ts b/core/toolbox/category.ts index 9a2c125f6..a3a685ec8 100644 --- a/core/toolbox/category.ts +++ b/core/toolbox/category.ts @@ -30,8 +30,6 @@ import {ToolboxItem} from './toolbox_item.js'; /** * Class for a category in a toolbox. - * - * @alias Blockly.ToolboxCategory */ export class ToolboxCategory extends ToolboxItem implements ISelectableToolboxItem { diff --git a/core/toolbox/collapsible_category.ts b/core/toolbox/collapsible_category.ts index c6f45ebdd..0cb3df7b4 100644 --- a/core/toolbox/collapsible_category.ts +++ b/core/toolbox/collapsible_category.ts @@ -26,8 +26,6 @@ import {ToolboxSeparator} from './separator.js'; /** * Class for a category in a toolbox that can be collapsed. - * - * @alias Blockly.CollapsibleToolboxCategory */ export class CollapsibleToolboxCategory extends ToolboxCategory implements ICollapsibleToolboxItem { diff --git a/core/toolbox/separator.ts b/core/toolbox/separator.ts index 26fac7e32..41c600655 100644 --- a/core/toolbox/separator.ts +++ b/core/toolbox/separator.ts @@ -24,8 +24,6 @@ import {ToolboxItem} from './toolbox_item.js'; /** * Class for a toolbox separator. This is the thin visual line that appears on * the toolbox. This item is not interactable. - * - * @alias Blockly.ToolboxSeparator */ export class ToolboxSeparator extends ToolboxItem { /** Name used for registering a toolbox separator. */ diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 8c1aeb577..91cf9d6d9 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -51,8 +51,6 @@ import {CollapsibleToolboxCategory} from './collapsible_category.js'; /** * Class for a Toolbox. * Creates the toolbox's DOM. - * - * @alias Blockly.Toolbox */ export class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, diff --git a/core/toolbox/toolbox_item.ts b/core/toolbox/toolbox_item.ts index 36e0e14ac..3fe7ffb5b 100644 --- a/core/toolbox/toolbox_item.ts +++ b/core/toolbox/toolbox_item.ts @@ -22,8 +22,6 @@ import type {WorkspaceSvg} from '../workspace_svg.js'; /** * Class for an item in the toolbox. - * - * @alias Blockly.ToolboxItem */ export class ToolboxItem implements IToolboxItem { protected id_: string; diff --git a/core/tooltip.ts b/core/tooltip.ts index cdd5bde0d..50a2a1e2a 100644 --- a/core/tooltip.ts +++ b/core/tooltip.ts @@ -27,8 +27,6 @@ import * as blocklyString from './utils/string.js'; * Either a string, an object containing a tooltip property, or a function which * returns either a string, or another arbitrarily nested function which * eventually unwinds to a string. - * - * @alias Blockly.Tooltip.TipInfo */ export type TipInfo = string|{tooltip: AnyDuringMigration}|(() => TipInfo|string|Function); @@ -38,8 +36,6 @@ export type TipInfo = * 1st parameter: the div element to render content into. * 2nd parameter: the element being moused over (i.e., the element for which the * tooltip should be shown). - * - * @alias Blockly.Tooltip.CustomTooltip */ export type CustomTooltip = (p1: Element, p2: Element) => AnyDuringMigration; @@ -55,7 +51,6 @@ let customTooltip: CustomTooltip|undefined = undefined; * tooltip UI. * * @param customFn A custom tooltip used to render an alternate tooltip UI. - * @alias Blockly.Tooltip.setCustomTooltip */ export function setCustomTooltip(customFn: CustomTooltip) { customTooltip = customFn; @@ -77,7 +72,6 @@ let visible = false; * Returns whether or not a tooltip is showing * * @returns True if a tooltip is showing - * @alias Blockly.Tooltip.isVisible */ export function isVisible(): boolean { return visible; @@ -88,8 +82,6 @@ let blocked = false; /** * Maximum width (in characters) of a tooltip. - * - * @alias Blockly.Tooltip.LIMIT */ export const LIMIT = 50; @@ -120,36 +112,26 @@ let poisonedElement: AnyDuringMigration = null; /** * Horizontal offset between mouse cursor and tooltip. - * - * @alias Blockly.Tooltip.OFFSET_X */ export const OFFSET_X = 0; /** * Vertical offset between mouse cursor and tooltip. - * - * @alias Blockly.Tooltip.OFFSET_Y */ export const OFFSET_Y = 10; /** * Radius mouse can move before killing tooltip. - * - * @alias Blockly.Tooltip.RADIUS_OK */ export const RADIUS_OK = 10; /** * Delay before tooltip appears. - * - * @alias Blockly.Tooltip.HOVER_MS */ export const HOVER_MS = 750; /** * Horizontal padding between tooltip and screen edge. - * - * @alias Blockly.Tooltip.MARGINS */ export const MARGINS = 5; @@ -160,7 +142,6 @@ let containerDiv: HTMLDivElement|null = null; * Returns the HTML tooltip container. * * @returns The HTML tooltip container. - * @alias Blockly.Tooltip.getDiv */ export function getDiv(): HTMLDivElement|null { return containerDiv; @@ -171,7 +152,6 @@ export function getDiv(): HTMLDivElement|null { * * @param object The object to get the tooltip text of. * @returns The tooltip text of the element. - * @alias Blockly.Tooltip.getTooltipOfObject */ export function getTooltipOfObject(object: AnyDuringMigration|null): string { const obj = getTargetObject(object); @@ -208,8 +188,6 @@ function getTargetObject(obj: object|null): {tooltip: AnyDuringMigration}|null { /** * Create the tooltip div and inject it onto the page. - * - * @alias Blockly.Tooltip.createDom */ export function createDom() { if (containerDiv) { @@ -226,7 +204,6 @@ export function createDom() { * Binds the required mouse events onto an SVG element. * * @param element SVG element onto which tooltip is to be bound. - * @alias Blockly.Tooltip.bindMouseEvents */ export function bindMouseEvents(element: Element) { // TODO (#6097): Don't stash wrapper info on the DOM. @@ -245,7 +222,6 @@ export function bindMouseEvents(element: Element) { * Unbinds tooltip mouse events from the SVG element. * * @param element SVG element onto which tooltip is bound. - * @alias Blockly.Tooltip.unbindMouseEvents */ export function unbindMouseEvents(element: Element|null) { if (!element) { @@ -346,7 +322,6 @@ function onMouseMove(e: Event) { /** * Dispose of the tooltip. * - * @alias Blockly.Tooltip.dispose * @internal */ export function dispose() { @@ -357,8 +332,6 @@ export function dispose() { /** * Hide the tooltip. - * - * @alias Blockly.Tooltip.hide */ export function hide() { if (visible) { @@ -376,7 +349,6 @@ export function hide() { * Hide any in-progress tooltips and block showing new tooltips until the next * call to unblock(). * - * @alias Blockly.Tooltip.block * @internal */ export function block() { @@ -388,7 +360,6 @@ export function block() { * Unblock tooltips: allow them to be scheduled and shown according to their own * logic. * - * @alias Blockly.Tooltip.unblock * @internal */ export function unblock() { diff --git a/core/touch.ts b/core/touch.ts index 250b162a1..f8be51c60 100644 --- a/core/touch.ts +++ b/core/touch.ts @@ -50,8 +50,6 @@ let touchIdentifier_: string|null = null; /** * The TOUCH_MAP lookup dictionary specifies additional touch events to fire, * in conjunction with mouse events. - * - * @alias Blockly.Touch.TOUCH_MAP */ export const TOUCH_MAP: {[key: string]: string[]} = { 'mousedown': ['pointerdown'], @@ -77,7 +75,6 @@ let longPid_: AnyDuringMigration = 0; * * @param e Touch start event. * @param gesture The gesture that triggered this longStart. - * @alias Blockly.Touch.longStart * @internal */ export function longStart(e: PointerEvent, gesture: Gesture) { @@ -94,7 +91,6 @@ export function longStart(e: PointerEvent, gesture: Gesture) { * Nope, that's not a long-press. Either touchend or touchcancel was fired, * or a drag hath begun. Kill the queued long-press task. * - * @alias Blockly.Touch.longStop * @internal */ export function longStop() { @@ -108,8 +104,6 @@ export function longStop() { * Clear the touch identifier that tracks which touch stream to pay attention * to. This ends the current drag/gesture and allows other pointers to be * captured. - * - * @alias Blockly.Touch.clearTouchIdentifier */ export function clearTouchIdentifier() { touchIdentifier_ = null; @@ -123,7 +117,6 @@ export function clearTouchIdentifier() { * @param e The event to check. * @returns True if this event should be passed through to the registered * handler; false if it should be blocked. - * @alias Blockly.Touch.shouldHandleEvent */ export function shouldHandleEvent(e: Event): boolean { // Do not replace the startsWith with a check for `instanceof PointerEvent`. @@ -139,7 +132,6 @@ export function shouldHandleEvent(e: Event): boolean { * * @param e Pointer event. * @returns The pointerId of the event. - * @alias Blockly.Touch.getTouchIdentifierFromEvent */ export function getTouchIdentifierFromEvent(e: PointerEvent): string { return `${e.pointerId}`; @@ -154,7 +146,6 @@ export function getTouchIdentifierFromEvent(e: PointerEvent): string { * @param e Pointer event. * @returns Whether the identifier on the event matches the current saved * identifier. - * @alias Blockly.Touch.checkTouchIdentifier */ export function checkTouchIdentifier(e: PointerEvent): boolean { const identifier = getTouchIdentifierFromEvent(e); @@ -181,7 +172,6 @@ export function checkTouchIdentifier(e: PointerEvent): boolean { * make a touch event work in a mouse event handler. * * @param e A touch event. - * @alias Blockly.Touch.setClientFromTouch */ export function setClientFromTouch(e: Event|PseudoEvent) { deprecation.warn('setClientFromTouch()', 'version 9', 'version 10'); @@ -206,7 +196,6 @@ export function setClientFromTouch(e: Event|PseudoEvent) { * * @param e An event. * @returns True if it is a mouse, touch, or pointer event; false otherwise. - * @alias Blockly.Touch.isMouseOrTouchEvent */ export function isMouseOrTouchEvent(e: Event|PseudoEvent): boolean { deprecation.warn('isMouseOrTouchEvent()', 'version 9', 'version 10'); @@ -219,7 +208,6 @@ export function isMouseOrTouchEvent(e: Event|PseudoEvent): boolean { * * @param e An event. * @returns True if it is a touch or pointer event; false otherwise. - * @alias Blockly.Touch.isTouchEvent */ export function isTouchEvent(e: Event|PseudoEvent): boolean { deprecation.warn('isTouchEvent()', 'version 9', 'version 10'); @@ -234,7 +222,6 @@ export function isTouchEvent(e: Event|PseudoEvent): boolean { * @returns An array of events or pseudo events. * Each pseudo-touch event will have exactly one changed touch and there * will be no real touch events. - * @alias Blockly.Touch.splitEventByTouches */ export function splitEventByTouches(e: Event): Array { deprecation.warn('splitEventByTouches()', 'version 9', 'version 10'); diff --git a/core/trashcan.ts b/core/trashcan.ts index 04c1196e7..820a0caed 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -43,8 +43,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a trash can. - * - * @alias Blockly.Trashcan */ export class Trashcan extends DeleteArea implements IAutoHideable, IPositionable { diff --git a/core/utils.ts b/core/utils.ts index 3891d0b21..e8eb87fea 100644 --- a/core/utils.ts +++ b/core/utils.ts @@ -75,7 +75,6 @@ export { * @param element SVG element to find the coordinates of. * @returns Object with .x and .y properties. * @deprecated Use **Blockly.utils.svgMath.getRelativeXY** instead. - * @alias Blockly.utils.getRelativeXY */ export function getRelativeXY(element: Element): Coordinate { deprecation.warn( @@ -92,7 +91,6 @@ export function getRelativeXY(element: Element): Coordinate { * of the div Blockly was injected into, the behaviour is undefined. * @returns Object with .x and .y properties. * @deprecated Use **Blockly.utils.svgMath.getInjectionDivXY** instead. - * @alias Blockly.utils.getInjectionDivXY_ */ function getInjectionDivXY(element: Element): Coordinate { deprecation.warn( @@ -113,7 +111,6 @@ export const getInjectionDivXY_ = getInjectionDivXY; * interpolation tokens. * @returns Array of strings and numbers. * @deprecated Use **Blockly.utils.parsing.tokenizeInterpolation** instead. - * @alias Blockly.utils.tokenizeInterpolation */ export function tokenizeInterpolation(message: string): Array { deprecation.warn( @@ -131,7 +128,6 @@ export function tokenizeInterpolation(message: string): Array { * references. * @returns String with message references replaced. * @deprecated Use **Blockly.utils.parsing.replaceMessageReferences** instead. - * @alias Blockly.utils.replaceMessageReferences */ export function replaceMessageReferences(message: string|any): string { deprecation.warn( @@ -148,7 +144,6 @@ export function replaceMessageReferences(message: string|any): string { * @returns True if all message references have matching values. * Otherwise, false. * @deprecated Use **Blockly.utils.parsing.checkMessageReferences** instead. - * @alias Blockly.utils.checkMessageReferences */ export function checkMessageReferences(message: string): boolean { deprecation.warn( @@ -163,7 +158,6 @@ export function checkMessageReferences(message: string): boolean { * * @returns True if 3D transforms are supported. * @deprecated Use **Blockly.utils.svgMath.is3dSupported** instead. - * @alias Blockly.utils.is3dSupported */ export function is3dSupported(): boolean { deprecation.warn( @@ -178,7 +172,6 @@ export function is3dSupported(): boolean { * * @returns An object containing window width, height, and scroll position in * window coordinates. - * @alias Blockly.utils.getViewportBBox * @deprecated Use **Blockly.utils.svgMath.getViewportBBox** instead. * @internal */ @@ -195,7 +188,6 @@ export function getViewportBBox(): Rect { * @param arr Array from which to remove value. * @param value Value to remove. * @returns True if an element was removed. - * @alias Blockly.utils.arrayRemove * @deprecated Use **Blockly.array.removeElem** instead. * @internal */ @@ -212,7 +204,6 @@ export function arrayRemove(arr: Array, value: T): boolean { * * @returns Object with values 'x' and 'y'. * @deprecated Use **Blockly.utils.svgMath.getDocumentScroll** instead. - * @alias Blockly.utils.getDocumentScroll */ export function getDocumentScroll(): Coordinate { deprecation.warn( @@ -230,7 +221,6 @@ export function getDocumentScroll(): Coordinate { * that are not inside a value or statement input of the block). * @returns Map of types to type counts for descendants of the bock. * @deprecated Use **Blockly.common.getBlockTypeCounts** instead. - * @alias Blockly.utils.getBlockTypeCounts */ export function getBlockTypeCounts( block: Block, opt_stripFollowing?: boolean): {[key: string]: number} { @@ -267,7 +257,6 @@ export function screenToWsCoordinates( * the input was an HSV hue value. * @throws {Error} If the colour cannot be parsed. * @deprecated Use **Blockly.utils.parsing.parseBlockColour** instead. - * @alias Blockly.utils.parseBlockColour */ export function parseBlockColour(colour: number| string): {hue: number|null, hex: string} { @@ -283,7 +272,6 @@ export function parseBlockColour(colour: number| * @param fn Function to run. * @throws Error Will throw if no global document can be found (e.g., Node.js). * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.runAfterPageLoad */ export function runAfterPageLoad(fn: () => void) { deprecation.warn( diff --git a/core/utils/aria.ts b/core/utils/aria.ts index fcacf4da7..e31951d8a 100644 --- a/core/utils/aria.ts +++ b/core/utils/aria.ts @@ -24,8 +24,6 @@ const ROLE_ATTRIBUTE = 'role'; /** * ARIA role values. * Copied from Closure's goog.a11y.aria.Role - * - * @alias Blockly.utils.aria.Role */ export enum Role { // ARIA role for an interactive control of tabular data. @@ -64,8 +62,6 @@ export enum Role { /** * ARIA states and properties. * Copied from Closure's goog.a11y.aria.State - * - * @alias Blockly.utils.aria.State */ export enum State { // ARIA property for setting the currently active descendant of an element, @@ -129,7 +125,6 @@ export enum State { * * @param element DOM node to set role of. * @param roleName Role name. - * @alias Blockly.utils.aria.setRole */ export function setRole(element: Element, roleName: Role) { element.setAttribute(ROLE_ATTRIBUTE, roleName); @@ -144,7 +139,6 @@ export function setRole(element: Element, roleName: Role) { * Automatically adds prefix 'aria-' to the state name if the attribute is * not an extra attribute. * @param value Value for the state attribute. - * @alias Blockly.utils.aria.setState */ export function setState( element: Element, stateName: State, value: string|boolean|number|string[]) { diff --git a/core/utils/array.ts b/core/utils/array.ts index 26cda7961..dbf1b6467 100644 --- a/core/utils/array.ts +++ b/core/utils/array.ts @@ -15,7 +15,6 @@ goog.declareModuleId('Blockly.utils.array'); * @param arr Array from which to remove value. * @param value Value to remove. * @returns True if an element was removed. - * @alias Blockly.array.removeElem * @internal */ export function removeElem(arr: Array, value: T): boolean { diff --git a/core/utils/colour.ts b/core/utils/colour.ts index fad93adb8..6f234d308 100644 --- a/core/utils/colour.ts +++ b/core/utils/colour.ts @@ -16,15 +16,12 @@ goog.declareModuleId('Blockly.utils.colour'); /** * The richness of block colours, regardless of the hue. * Must be in the range of 0 (inclusive) to 1 (exclusive). - * - * @alias Blockly.utils.colour.hsvSaturation */ let hsvSaturation = 0.45; /** * Get the richness of block colours, regardless of the hue. * - * @alias Blockly.utils.colour.getHsvSaturation * @returns The current richness. * @internal */ @@ -37,7 +34,6 @@ export function getHsvSaturation(): number { * * @param newSaturation The new richness, in the range of 0 (inclusive) to 1 * (exclusive) - * @alias Blockly.utils.colour.setHsvSaturation * @internal */ export function setHsvSaturation(newSaturation: number) { @@ -47,15 +43,12 @@ export function setHsvSaturation(newSaturation: number) { /** * The intensity of block colours, regardless of the hue. * Must be in the range of 0 (inclusive) to 1 (exclusive). - * - * @alias Blockly.utils.colour.hsvValue */ let hsvValue = 0.65; /** * Get the intensity of block colours, regardless of the hue. * - * @alias Blockly.utils.colour.getHsvValue * @returns The current intensity. * @internal */ @@ -68,7 +61,6 @@ export function getHsvValue(): number { * * @param newValue The new intensity, in the range of 0 (inclusive) to 1 * (exclusive) - * @alias Blockly.utils.colour.setHsvValue * @internal */ export function setHsvValue(newValue: number) { @@ -86,7 +78,6 @@ export function setHsvValue(newValue: number) { * @param str Colour in some CSS format. * @returns A string containing a hex representation of the colour, or null if * can't be parsed. - * @alias Blockly.utils.colour.parse */ export function parse(str: string|number): string|null { str = String(str).toLowerCase().trim(); @@ -125,7 +116,6 @@ export function parse(str: string|number): string|null { * @param g Amount of green, int between 0 and 255. * @param b Amount of blue, int between 0 and 255. * @returns Hex representation of the colour. - * @alias Blockly.utils.colour.rgbToHex */ export function rgbToHex(r: number, g: number, b: number): string { const rgb = r << 16 | g << 8 | b; @@ -141,7 +131,6 @@ export function rgbToHex(r: number, g: number, b: number): string { * @param colour String representing colour in any colour format ('#ff0000', * 'red', '0xff000', etc). * @returns RGB representation of the colour. - * @alias Blockly.utils.colour.hexToRgb */ export function hexToRgb(colour: string): number[] { const hex = parse(colour); @@ -164,7 +153,6 @@ export function hexToRgb(colour: string): number[] { * @param s Saturation value in [0, 1]. * @param v Brightness in [0, 255]. * @returns Hex representation of the colour. - * @alias Blockly.utils.colour.hsvToHex */ export function hsvToHex(h: number, s: number, v: number): string { let red = 0; @@ -226,7 +214,6 @@ export function hsvToHex(h: number, s: number, v: number): string { * @param factor The weight to be given to colour1 over colour2. * Values should be in the range [0, 1]. * @returns Combined colour represented in hex. - * @alias Blockly.utils.colour.blend */ export function blend(colour1: string, colour2: string, factor: number): string| null { @@ -251,8 +238,6 @@ export function blend(colour1: string, colour2: string, factor: number): string| * https://www.w3.org/TR/2018/REC-css-color-3-20180619/#html4 * The keys of this map are the lowercase "readable" names of the colours, * while the values are the "hex" values. - * - * @alias Blockly.utils.colour.names */ export const names: {[key: string]: string} = { 'aqua': '#00ffff', @@ -278,7 +263,6 @@ export const names: {[key: string]: string} = { * * @param hue Hue on a colour wheel (0-360). * @returns RGB code, e.g. '#5ba65b'. - * @alias Blockly.utils.colour.hueToHex */ export function hueToHex(hue: number): string { return hsvToHex(hue, hsvSaturation, hsvValue * 255); diff --git a/core/utils/coordinate.ts b/core/utils/coordinate.ts index 80ef56e00..12d422b70 100644 --- a/core/utils/coordinate.ts +++ b/core/utils/coordinate.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.utils.Coordinate'); /** * Class for representing coordinates and positions. - * - * @alias Blockly.utils.Coordinate */ export class Coordinate { /** diff --git a/core/utils/deprecation.ts b/core/utils/deprecation.ts index af2800fb3..0492c6423 100644 --- a/core/utils/deprecation.ts +++ b/core/utils/deprecation.ts @@ -23,7 +23,6 @@ goog.declareModuleId('Blockly.utils.deprecation'); * @param deletionDate The date of deletion. Prefer 'version n.0.0' * format, and fall back to 'month yyyy' or 'quarter yyyy' format. * @param opt_use The name of a function or property to use instead, if any. - * @alias Blockly.utils.deprecation.warn * @internal */ export function warn( diff --git a/core/utils/dom.ts b/core/utils/dom.ts index c8e799fe2..383934f47 100644 --- a/core/utils/dom.ts +++ b/core/utils/dom.ts @@ -19,30 +19,22 @@ import type {Svg} from './svg.js'; /** * Required name space for SVG elements. - * - * @alias Blockly.utils.dom.SVG_NS */ export const SVG_NS = 'http://www.w3.org/2000/svg'; /** * Required name space for HTML elements. - * - * @alias Blockly.utils.dom.HTML_NS */ export const HTML_NS = 'http://www.w3.org/1999/xhtml'; /** * Required name space for XLINK elements. - * - * @alias Blockly.utils.dom.XLINK_NS */ export const XLINK_NS = 'http://www.w3.org/1999/xlink'; /** * Node type constants. * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - * - * @alias Blockly.utils.dom.NodeType */ export enum NodeType { ELEMENT_NODE = 1, @@ -67,7 +59,6 @@ let canvasContext: CanvasRenderingContext2D|null = null; * @param attrs Dictionary of attribute names and values. * @param opt_parent Optional parent on which to append the element. * @returns if name is a string or a more specific type if it a member of Svg. - * @alias Blockly.utils.dom.createSvgElement */ export function createSvgElement( name: string|Svg, attrs: {[key: string]: string|number}, @@ -90,7 +81,6 @@ export function createSvgElement( * @param element DOM element to add class to. * @param className Name of class to add. * @returns True if class was added, false if already present. - * @alias Blockly.utils.dom.addClass */ export function addClass(element: Element, className: string): boolean { const classNames = className.split(' '); @@ -106,7 +96,6 @@ export function addClass(element: Element, className: string): boolean { * * @param element DOM element to remove classes from. * @param classNames A string of one or multiple class names for an element. - * @alias Blockly.utils.dom.removeClasses */ export function removeClasses(element: Element, classNames: string) { element.classList.remove(...classNames.split(' ')); @@ -120,7 +109,6 @@ export function removeClasses(element: Element, classNames: string) { * @param element DOM element to remove class from. * @param className Name of class to remove. * @returns True if class was removed, false if never present. - * @alias Blockly.utils.dom.removeClass */ export function removeClass(element: Element, className: string): boolean { const classNames = className.split(' '); @@ -137,7 +125,6 @@ export function removeClass(element: Element, className: string): boolean { * @param element DOM element to check. * @param className Name of class to check. * @returns True if class exists, false otherwise. - * @alias Blockly.utils.dom.hasClass */ export function hasClass(element: Element, className: string): boolean { return element.classList.contains(className); @@ -148,7 +135,6 @@ export function hasClass(element: Element, className: string): boolean { * * @param node The node to remove. * @returns The node removed if removed; else, null. - * @alias Blockly.utils.dom.removeNode */ // Copied from Closure goog.dom.removeNode export function removeNode(node: Node|null): Node|null { @@ -161,7 +147,6 @@ export function removeNode(node: Node|null): Node|null { * * @param newNode New element to insert. * @param refNode Existing element to precede new node. - * @alias Blockly.utils.dom.insertAfter */ export function insertAfter(newNode: Element, refNode: Element) { const siblingNode = refNode.nextSibling; @@ -182,7 +167,6 @@ export function insertAfter(newNode: Element, refNode: Element) { * @param parent The node that should contain the other node. * @param descendant The node to test presence of. * @returns Whether the parent node contains the descendant node. - * @alias Blockly.utils.dom.containsNode */ export function containsNode(parent: Node, descendant: Node): boolean { return !!( @@ -197,7 +181,6 @@ export function containsNode(parent: Node, descendant: Node): boolean { * * @param element Element to which the CSS transform will be applied. * @param transform The value of the CSS `transform` property. - * @alias Blockly.utils.dom.setCssTransform */ export function setCssTransform( element: HTMLElement|SVGElement, transform: string) { @@ -208,8 +191,6 @@ export function setCssTransform( /** * Start caching text widths. Every call to this function MUST also call * stopTextWidthCache. Caches must not survive between execution threads. - * - * @alias Blockly.utils.dom.startTextWidthCache */ export function startTextWidthCache() { cacheReference++; @@ -221,8 +202,6 @@ export function startTextWidthCache() { /** * Stop caching field widths. Unless caching was already on when the * corresponding call to startTextWidthCache was made. - * - * @alias Blockly.utils.dom.stopTextWidthCache */ export function stopTextWidthCache() { cacheReference--; @@ -236,7 +215,6 @@ export function stopTextWidthCache() { * * @param textElement An SVG 'text' element. * @returns Width of element. - * @alias Blockly.utils.dom.getTextWidth */ export function getTextWidth(textElement: SVGTextElement): number { const key = textElement.textContent + '\n' + textElement.className.baseVal; @@ -277,7 +255,6 @@ export function getTextWidth(textElement: SVGTextElement): number { * @param fontWeight The font weight to use. * @param fontFamily The font family to use. * @returns Width of element. - * @alias Blockly.utils.dom.getFastTextWidth */ export function getFastTextWidth( textElement: SVGTextElement, fontSize: number, fontWeight: string, @@ -298,7 +275,6 @@ export function getFastTextWidth( * @param fontWeight The font weight to use. * @param fontFamily The font family to use. * @returns Width of element. - * @alias Blockly.utils.dom.getFastTextWidthWithSizeString */ export function getFastTextWidthWithSizeString( textElement: SVGTextElement, fontSize: string, fontWeight: string, @@ -351,7 +327,6 @@ export function getFastTextWidthWithSizeString( * @param fontWeight The font weight to use. * @param fontFamily The font family to use. * @returns Font measurements. - * @alias Blockly.utils.dom.measureFontMetrics */ export function measureFontMetrics( text: string, fontSize: string, fontWeight: string, diff --git a/core/utils/idgenerator.ts b/core/utils/idgenerator.ts index e0b647df1..1e5461292 100644 --- a/core/utils/idgenerator.ts +++ b/core/utils/idgenerator.ts @@ -59,7 +59,6 @@ let nextId = 0; * primarily be used for IDs that end up in the DOM. * * @returns The next unique identifier. - * @alias Blockly.utils.idGenerator.getNextUniqueId */ export function getNextUniqueId(): string { return 'blockly-' + (nextId++).toString(36); @@ -70,7 +69,6 @@ export function getNextUniqueId(): string { * * @see internal.genUid * @returns A globally unique ID string. - * @alias Blockly.utils.idGenerator.genUid */ export function genUid(): string { return internal.genUid(); diff --git a/core/utils/keycodes.ts b/core/utils/keycodes.ts index 49aa8f8d7..d96e72ee5 100644 --- a/core/utils/keycodes.ts +++ b/core/utils/keycodes.ts @@ -22,8 +22,6 @@ goog.declareModuleId('Blockly.utils.KeyCodes'); * * This list is not localized and therefore some of the key codes are not * correct for non US keyboard layouts. See comments below. - * - * @alias Blockly.utils.KeyCodes */ export enum KeyCodes { WIN_KEY_FF_LINUX = 0, diff --git a/core/utils/math.ts b/core/utils/math.ts index c92749aa5..7dbef74e6 100644 --- a/core/utils/math.ts +++ b/core/utils/math.ts @@ -21,7 +21,6 @@ goog.declareModuleId('Blockly.utils.math'); * * @param angleDegrees Angle in degrees. * @returns Angle in radians. - * @alias Blockly.utils.math.toRadians */ export function toRadians(angleDegrees: number): number { return angleDegrees * Math.PI / 180; @@ -33,7 +32,6 @@ export function toRadians(angleDegrees: number): number { * * @param angleRadians Angle in radians. * @returns Angle in degrees. - * @alias Blockly.utils.math.toDegrees */ export function toDegrees(angleRadians: number): number { return angleRadians * 180 / Math.PI; @@ -46,7 +44,6 @@ export function toDegrees(angleRadians: number): number { * @param number The number to clamp. * @param upperBound The desired upper bound. * @returns The clamped number. - * @alias Blockly.utils.math.clamp */ export function clamp( lowerBound: number, number: number, upperBound: number): number { diff --git a/core/utils/metrics.ts b/core/utils/metrics.ts index 495e017b8..04dc9b366 100644 --- a/core/utils/metrics.ts +++ b/core/utils/metrics.ts @@ -13,7 +13,6 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.Metrics'); -/** @alias Blockly.utils.Metrics */ export interface Metrics { /** Height of the visible portion of the workspace. */ viewHeight: number; diff --git a/core/utils/object.ts b/core/utils/object.ts index 708c69905..2467b8abc 100644 --- a/core/utils/object.ts +++ b/core/utils/object.ts @@ -22,7 +22,6 @@ import * as deprecation from './deprecation.js'; * @param parentCtor Parent class. * @suppress {strictMissingProperties} superClass_ is not defined on Function. * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.object.inherits */ export function inherits(childCtor: Function, parentCtor: Function) { deprecation.warn('Blockly.utils.object.inherits', 'version 9', 'version 10'); @@ -50,7 +49,6 @@ export function inherits(childCtor: Function, parentCtor: Function) { * @param target Target. * @param source Source. * @deprecated Use the built-in **Object.assign** instead. - * @alias Blockly.utils.object.mixin */ export function mixin(target: AnyDuringMigration, source: AnyDuringMigration) { deprecation.warn( @@ -66,7 +64,6 @@ export function mixin(target: AnyDuringMigration, source: AnyDuringMigration) { * @param target Target. * @param source Source. * @returns The resulting object. - * @alias Blockly.utils.object.deepMerge */ export function deepMerge( target: AnyDuringMigration, @@ -87,7 +84,6 @@ export function deepMerge( * @param obj Object containing values. * @returns Array of values. * @deprecated Use the built-in **Object.values** instead. - * @alias Blockly.utils.object.values */ export function values(obj: AnyDuringMigration): AnyDuringMigration[] { deprecation.warn( diff --git a/core/utils/parsing.ts b/core/utils/parsing.ts index 3a2fdd611..79c3784fc 100644 --- a/core/utils/parsing.ts +++ b/core/utils/parsing.ts @@ -166,7 +166,6 @@ function tokenizeInterpolationInternal( * @param message Text which might contain string table references and * interpolation tokens. * @returns Array of strings and numbers. - * @alias Blockly.utils.parsing.tokenizeInterpolation */ export function tokenizeInterpolation(message: string): (string|number)[] { return tokenizeInterpolationInternal(message, true); @@ -180,7 +179,6 @@ export function tokenizeInterpolation(message: string): (string|number)[] { * @param message Message, which may be a string that contains * string table references. * @returns String with message references replaced. - * @alias Blockly.utils.parsing.replaceMessageReferences */ export function replaceMessageReferences(message: string|any): string { if (typeof message !== 'string') { @@ -199,7 +197,6 @@ export function replaceMessageReferences(message: string|any): string { * @param message Text which might contain string table references. * @returns True if all message references have matching values. * Otherwise, false. - * @alias Blockly.utils.parsing.checkMessageReferences */ export function checkMessageReferences(message: string): boolean { let validSoFar = true; @@ -230,7 +227,6 @@ export function checkMessageReferences(message: string): boolean { * @returns An object containing the colour as * a #RRGGBB string, and the hue if the input was an HSV hue value. * @throws {Error} If the colour cannot be parsed. - * @alias Blockly.utils.parsing.parseBlockColour */ export function parseBlockColour(colour: number| string): {hue: number|null, hex: string} { diff --git a/core/utils/rect.ts b/core/utils/rect.ts index af97efd1c..a0ed1ca37 100644 --- a/core/utils/rect.ts +++ b/core/utils/rect.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.utils.Rect'); /** * Class for representing rectangular regions. - * - * @alias Blockly.utils.Rect */ export class Rect { /** diff --git a/core/utils/sentinel.ts b/core/utils/sentinel.ts index 723c29986..6f71ee9d5 100644 --- a/core/utils/sentinel.ts +++ b/core/utils/sentinel.ts @@ -15,8 +15,6 @@ goog.declareModuleId('Blockly.utils.Sentinel'); /** * A type used to create flag values. - * - * @alias Blockly.utils.Sentinel */ export class Sentinel { /** diff --git a/core/utils/size.ts b/core/utils/size.ts index 3424c48fa..504b8182f 100644 --- a/core/utils/size.ts +++ b/core/utils/size.ts @@ -17,8 +17,6 @@ goog.declareModuleId('Blockly.utils.Size'); /** * Class for representing sizes consisting of a width and height. - * - * @alias Blockly.utils.Size */ export class Size { /** diff --git a/core/utils/string.ts b/core/utils/string.ts index 35856f354..ece17bf01 100644 --- a/core/utils/string.ts +++ b/core/utils/string.ts @@ -24,7 +24,6 @@ import * as deprecation from './deprecation.js'; * @param str The string to check. * @param prefix A string to look for at the start of `str`. * @returns True if `str` begins with `prefix`. - * @alias Blockly.utils.string.startsWith * @deprecated Use built-in **string.startsWith** instead. */ export function startsWith(str: string, prefix: string): boolean { @@ -39,7 +38,6 @@ export function startsWith(str: string, prefix: string): boolean { * * @param array Array of strings. * @returns Length of shortest string. - * @alias Blockly.utils.string.shortestStringLength */ export function shortestStringLength(array: string[]): number { if (!array.length) { @@ -59,7 +57,6 @@ export function shortestStringLength(array: string[]): number { * @param array Array of strings. * @param opt_shortest Length of shortest string. * @returns Length of common prefix. - * @alias Blockly.utils.string.commonWordPrefix */ export function commonWordPrefix( array: string[], opt_shortest?: number): number { @@ -98,7 +95,6 @@ export function commonWordPrefix( * @param array Array of strings. * @param opt_shortest Length of shortest string. * @returns Length of common suffix. - * @alias Blockly.utils.string.commonWordSuffix */ export function commonWordSuffix( array: string[], opt_shortest?: number): number { @@ -136,7 +132,6 @@ export function commonWordSuffix( * @param text Text to wrap. * @param limit Width to wrap each line. * @returns Wrapped text. - * @alias Blockly.utils.string.wrap */ export function wrap(text: string, limit: number): string { const lines = text.split('\n'); @@ -306,7 +301,6 @@ function wrapToText(words: string[], wordBreaks: boolean[]): string { * * @param str Input string. * @returns True if number, false otherwise. - * @alias Blockly.utils.string.isNumber */ export function isNumber(str: string): boolean { return /^\s*-?\d+(\.\d+)?\s*$/.test(str); diff --git a/core/utils/style.ts b/core/utils/style.ts index dbe6f9020..11c6fa232 100644 --- a/core/utils/style.ts +++ b/core/utils/style.ts @@ -26,7 +26,6 @@ import {Size} from './size.js'; * * @param element Element to get size of. * @returns Object with width/height properties. - * @alias Blockly.utils.style.getSize */ export function getSize(element: Element): Size { return TEST_ONLY.getSizeInternal(element); @@ -84,7 +83,6 @@ function getSizeWithDisplay(element: Element): Size { * @param element Element to get style of. * @param property Property to get (camel-case). * @returns Style value. - * @alias Blockly.utils.style.getComputedStyle */ export function getComputedStyle(element: Element, property: string): string { const styles = window.getComputedStyle(element); @@ -104,7 +102,6 @@ export function getComputedStyle(element: Element, property: string): string { * @param style Property to get (camel-case). * @returns Style value. * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.style.getCascadedStyle */ export function getCascadedStyle(element: Element, style: string): string { deprecation.warn( @@ -123,7 +120,6 @@ export function getCascadedStyle(element: Element, style: string): string { * * @param el Element to get the page offset for. * @returns The page offset. - * @alias Blockly.utils.style.getPageOffset */ export function getPageOffset(el: Element): Coordinate { const pos = new Coordinate(0, 0); @@ -146,7 +142,6 @@ export function getPageOffset(el: Element): Coordinate { * Similar to Closure's goog.style.getViewportPageOffset * * @returns The page offset of the viewport. - * @alias Blockly.utils.style.getViewportPageOffset */ export function getViewportPageOffset(): Coordinate { const body = document.body; @@ -162,7 +157,6 @@ export function getViewportPageOffset(): Coordinate { * * @param element The element to get the border widths for. * @returns The computed border widths. - * @alias Blockly.utils.style.getBorderBox */ export function getBorderBox(element: Element): Rect { const left = parseFloat(getComputedStyle(element, 'borderLeftWidth')); @@ -185,7 +179,6 @@ export function getBorderBox(element: Element): Rect { * scroll element will be used. * @param opt_center Whether to center the element in the container. * Defaults to false. - * @alias Blockly.utils.style.scrollIntoContainerView */ export function scrollIntoContainerView( element: Element, container: Element, opt_center?: boolean) { @@ -207,7 +200,6 @@ export function scrollIntoContainerView( * @param opt_center Whether to center the element in the container. * Defaults to false. * @returns The new scroll position of the container. - * @alias Blockly.utils.style.getContainerOffsetToScrollInto */ export function getContainerOffsetToScrollInto( element: Element, container: Element, opt_center?: boolean): Coordinate { diff --git a/core/utils/svg.ts b/core/utils/svg.ts index 798505351..04904fcb9 100644 --- a/core/utils/svg.ts +++ b/core/utils/svg.ts @@ -16,8 +16,6 @@ goog.declareModuleId('Blockly.utils.Svg'); /** * A name with the type of the SVG element stored in the generic. - * - * @alias Blockly.utils.Svg */ export class Svg<_T> { /** @internal */ diff --git a/core/utils/svg_math.ts b/core/utils/svg_math.ts index 60820c915..8fdb1e393 100644 --- a/core/utils/svg_math.ts +++ b/core/utils/svg_math.ts @@ -43,7 +43,6 @@ const XY_STYLE_REGEX = * * @param element SVG element to find the coordinates of. * @returns Object with .x and .y properties. - * @alias Blockly.utils.svgMath.getRelativeXY */ export function getRelativeXY(element: Element): Coordinate { const xy = new Coordinate(0, 0); @@ -90,7 +89,6 @@ export function getRelativeXY(element: Element): Coordinate { * @param element SVG element to find the coordinates of. If this is not a child * of the div Blockly was injected into, the behaviour is undefined. * @returns Object with .x and .y properties. - * @alias Blockly.utils.svgMath.getInjectionDivXY */ export function getInjectionDivXY(element: Element): Coordinate { let x = 0; @@ -114,7 +112,6 @@ export function getInjectionDivXY(element: Element): Coordinate { * * @returns True if 3D transforms are supported. * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.svgMath.is3dSupported */ export function is3dSupported(): boolean { // All browsers support translate3d in 2022. @@ -129,7 +126,6 @@ export function is3dSupported(): boolean { * * @returns An object containing window width, height, and scroll position in * window coordinates. - * @alias Blockly.utils.svgMath.getViewportBBox * @internal */ export function getViewportBBox(): Rect { @@ -145,7 +141,6 @@ export function getViewportBBox(): Rect { * Copied from Closure's goog.dom.getDocumentScroll. * * @returns Object with values 'x' and 'y'. - * @alias Blockly.utils.svgMath.getDocumentScroll */ export function getDocumentScroll(): Coordinate { const el = document.documentElement; @@ -161,7 +156,6 @@ export function getDocumentScroll(): Coordinate { * @param screenCoordinates The screen coordinates to be converted to workspace * coordinates * @returns The workspace coordinates. - * @alias Blockly.utils.svgMath.screenToWsCoordinates */ export function screenToWsCoordinates( ws: WorkspaceSvg, screenCoordinates: Coordinate): Coordinate { diff --git a/core/utils/svg_paths.ts b/core/utils/svg_paths.ts index d87766604..6c9707c47 100644 --- a/core/utils/svg_paths.ts +++ b/core/utils/svg_paths.ts @@ -22,7 +22,6 @@ goog.declareModuleId('Blockly.utils.svgPaths'); * @param x The x coordinate. * @param y The y coordinate. * @returns A string of the format ' x,y ' - * @alias Blockly.utils.svgPaths.point */ export function point(x: number, y: number): string { return ' ' + x + ',' + y + ' '; @@ -40,7 +39,6 @@ export function point(x: number, y: number): string { * x, y '. * @returns A string defining one or more Bezier curves. See the MDN * documentation for exact format. - * @alias Blockly.utils.svgPaths.curve */ export function curve(command: string, points: string[]): string { return ' ' + command + points.join(''); @@ -55,7 +53,6 @@ export function curve(command: string, points: string[]): string { * @param x The absolute x coordinate. * @param y The absolute y coordinate. * @returns A string of the format ' M x,y ' - * @alias Blockly.utils.svgPaths.moveTo */ export function moveTo(x: number, y: number): string { return ' M ' + x + ',' + y + ' '; @@ -70,7 +67,6 @@ export function moveTo(x: number, y: number): string { * @param dx The relative x coordinate. * @param dy The relative y coordinate. * @returns A string of the format ' m dx,dy ' - * @alias Blockly.utils.svgPaths.moveBy */ export function moveBy(dx: number, dy: number): string { return ' m ' + dx + ',' + dy + ' '; @@ -85,7 +81,6 @@ export function moveBy(dx: number, dy: number): string { * @param dx The relative x coordinate. * @param dy The relative y coordinate. * @returns A string of the format ' l dx,dy ' - * @alias Blockly.utils.svgPaths.lineTo */ export function lineTo(dx: number, dy: number): string { return ' l ' + dx + ',' + dy + ' '; @@ -100,7 +95,6 @@ export function lineTo(dx: number, dy: number): string { * @param points An array containing all of the points to draw lines to, in * order. The points are represented as strings of the format ' dx,dy '. * @returns A string of the format ' l (dx,dy)+ ' - * @alias Blockly.utils.svgPaths.line */ export function line(points: string[]): string { return ' l' + points.join(''); @@ -118,7 +112,6 @@ export function line(points: string[]): string { * @param val The coordinate to pass to the command. It may be absolute or * relative. * @returns A string of the format ' command val ' - * @alias Blockly.utils.svgPaths.lineOnAxis */ export function lineOnAxis(command: string, val: number): string { return ' ' + command + ' ' + val + ' '; @@ -136,7 +129,6 @@ export function lineOnAxis(command: string, val: number): string { * @param point The point to move the cursor to after drawing the arc, specified * either in absolute or relative coordinates depending on the command. * @returns A string of the format 'command radius radius flags point' - * @alias Blockly.utils.svgPaths.arc */ export function arc( command: string, flags: string, radius: number, point: string): string { diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index 28a64b778..e41c35848 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -21,8 +21,6 @@ import * as Xml from '../xml.js'; /** * The information needed to create a block in the toolbox. * Note that disabled has a different type for backwards compatibility. - * - * @alias Blockly.utils.toolbox.BlockInfo */ export interface BlockInfo { kind: string; @@ -46,8 +44,6 @@ export interface BlockInfo { /** * The information needed to create a separator in the toolbox. - * - * @alias Blockly.utils.toolbox.SeparatorInfo */ export interface SeparatorInfo { kind: string; @@ -58,8 +54,6 @@ export interface SeparatorInfo { /** * The information needed to create a button in the toolbox. - * - * @alias Blockly.utils.toolbox.ButtonInfo */ export interface ButtonInfo { kind: string; @@ -69,8 +63,6 @@ export interface ButtonInfo { /** * The information needed to create a label in the toolbox. - * - * @alias Blockly.utils.toolbox.LabelInfo */ export interface LabelInfo { kind: string; @@ -80,15 +72,11 @@ export interface LabelInfo { /** * The information needed to create either a button or a label in the flyout. - * - * @alias Blockly.utils.toolbox.ButtonOrLabelInfo */ export type ButtonOrLabelInfo = ButtonInfo|LabelInfo; /** * The information needed to create a category in the toolbox. - * - * @alias Blockly.utils.toolbox.StaticCategoryInfo */ export interface StaticCategoryInfo { kind: string; @@ -104,8 +92,6 @@ export interface StaticCategoryInfo { /** * The information needed to create a custom category. - * - * @alias Blockly.utils.toolbox.DynamicCategoryInfo */ export interface DynamicCategoryInfo { kind: string; @@ -120,30 +106,22 @@ export interface DynamicCategoryInfo { /** * The information needed to create either a dynamic or static category. - * - * @alias Blockly.utils.toolbox.CategoryInfo */ export type CategoryInfo = StaticCategoryInfo|DynamicCategoryInfo; /** * Any information that can be used to create an item in the toolbox. - * - * @alias Blockly.utils.toolbox.ToolboxItemInfo */ export type ToolboxItemInfo = FlyoutItemInfo|StaticCategoryInfo; /** * All the different types that can be displayed in a flyout. - * - * @alias Blockly.utils.toolbox.FlyoutItemInfo */ export type FlyoutItemInfo = BlockInfo|SeparatorInfo|ButtonInfo|LabelInfo|DynamicCategoryInfo; /** * The JSON definition of a toolbox. - * - * @alias Blockly.utils.toolbox.ToolboxInfo */ export interface ToolboxInfo { kind?: string; @@ -152,22 +130,16 @@ export interface ToolboxInfo { /** * An array holding flyout items. - * - * @alias Blockly.utils.toolbox.FlyoutItemInfoArray */ export type FlyoutItemInfoArray = FlyoutItemInfo[]; /** * All of the different types that can create a toolbox. - * - * @alias Blockly.utils.toolbox.ToolboxDefinition */ export type ToolboxDefinition = Node|ToolboxInfo|string; /** * All of the different types that can be used to show items in a flyout. - * - * @alias Blockly.utils.toolbox.FlyoutDefinition */ export type FlyoutDefinition = FlyoutItemInfoArray|NodeList|ToolboxInfo|Node[]; @@ -187,8 +159,6 @@ const FLYOUT_TOOLBOX_KIND = 'flyoutToolbox'; /** * Position of the toolbox and/or flyout relative to the workspace. - * - * @alias Blockly.utils.toolbox.Position */ export enum Position { TOP, @@ -202,7 +172,6 @@ export enum Position { * * @param toolboxDef The definition of the toolbox in one of its many forms. * @returns Object holding information for creating a toolbox. - * @alias Blockly.utils.toolbox.convertToolboxDefToJson * @internal */ export function convertToolboxDefToJson(toolboxDef: ToolboxDefinition| @@ -252,7 +221,6 @@ function validateToolbox(toolboxJson: ToolboxInfo) { * * @param flyoutDef The definition of the flyout in one of its many forms. * @returns A list of flyout items. - * @alias Blockly.utils.toolbox.convertFlyoutDefToJsonArray * @internal */ export function convertFlyoutDefToJsonArray(flyoutDef: FlyoutDefinition| @@ -284,7 +252,6 @@ export function convertFlyoutDefToJsonArray(flyoutDef: FlyoutDefinition| * * @param toolboxJson Object holding information for creating a toolbox. * @returns True if the toolbox has categories. - * @alias Blockly.utils.toolbox.hasCategories * @internal */ export function hasCategories(toolboxJson: ToolboxInfo|null): boolean { @@ -315,7 +282,6 @@ function hasCategoriesInternal(toolboxJson: ToolboxInfo|null): boolean { * * @param categoryInfo Object holing information for creating a category. * @returns True if the category has subcategories. - * @alias Blockly.utils.toolbox.isCategoryCollapsible * @internal */ export function isCategoryCollapsible(categoryInfo: CategoryInfo): boolean { @@ -415,7 +381,6 @@ function addAttributes(node: Node, obj: AnyDuringMigration) { * * @param toolboxDef DOM tree of blocks, or text representation of same. * @returns DOM tree of blocks, or null. - * @alias Blockly.utils.toolbox.parseToolboxTree */ export function parseToolboxTree(toolboxDef: Element|null|string): Element| null { diff --git a/core/utils/useragent.ts b/core/utils/useragent.ts index d0b7f91e8..59808af1b 100644 --- a/core/utils/useragent.ts +++ b/core/utils/useragent.ts @@ -78,26 +78,18 @@ isTablet = isIPad || isAndroid && !has('Mobile') || has('Silk'); isMobile = !isTablet && (isIPhone || isAndroid); })(globalThis['navigator'] && globalThis['navigator']['userAgent'] || ''); -/** @alias Blockly.utils.userAgent.raw */ export const raw: string = rawUserAgent; -/** @alias Blockly.utils.userAgent.JavaFx */ export const JavaFx: boolean = isJavaFx; -/** @alias Blockly.utils.userAgent.GECKO */ export const GECKO: boolean = isGecko; -/** @alias Blockly.utils.userAgent.ANDROID */ export const ANDROID: boolean = isAndroid; -/** @alias Blockly.utils.userAgent.IPAD */ export const IPAD: boolean = isIPad; -/** @alias Blockly.utils.userAgent.IPHONE */ export const IPHONE: boolean = isIPhone; -/** @alias Blockly.utils.userAgent.MAC */ export const MAC: boolean = isMac; -/** @alias Blockly.utils.userAgent.MOBILE */ export const MOBILE: boolean = isMobile; diff --git a/core/utils/xml.ts b/core/utils/xml.ts index c33712992..b64e85dd4 100644 --- a/core/utils/xml.ts +++ b/core/utils/xml.ts @@ -61,8 +61,6 @@ export function injectDependencies(dependencies: { /** * Namespace for Blockly's XML. - * - * @alias Blockly.utils.xml.NAME_SPACE */ export const NAME_SPACE = 'https://developers.google.com/blockly/xml'; @@ -71,7 +69,6 @@ export const NAME_SPACE = 'https://developers.google.com/blockly/xml'; * * @returns The document object. * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.xml.getDocument */ export function getDocument(): Document { deprecation.warn('Blockly.utils.xml.getDocument', 'version 9', 'version 10'); @@ -83,7 +80,6 @@ export function getDocument(): Document { * * @param xmlDocument The document object to use. * @deprecated No longer provided by Blockly. - * @alias Blockly.utils.xml.setDocument */ export function setDocument(xmlDocument: Document) { deprecation.warn('Blockly.utils.xml.setDocument', 'version 9', 'version 10'); @@ -95,7 +91,6 @@ export function setDocument(xmlDocument: Document) { * * @param tagName Name of DOM element. * @returns New DOM element. - * @alias Blockly.utils.xml.createElement */ export function createElement(tagName: string): Element { return document.createElementNS(NAME_SPACE, tagName); @@ -106,7 +101,6 @@ export function createElement(tagName: string): Element { * * @param text Text content. * @returns New DOM text node. - * @alias Blockly.utils.xml.createTextNode */ export function createTextNode(text: string): Text { return document.createTextNode(text); @@ -118,7 +112,6 @@ export function createTextNode(text: string): Text { * @param text XML string. * @returns The DOM document. * @throws if XML doesn't parse. - * @alias Blockly.utils.xml.textToDomDocument */ export function textToDomDocument(text: string): Document { const oParser = new DOMParser(); @@ -131,7 +124,6 @@ export function textToDomDocument(text: string): Document { * * @param dom A tree of XML nodes. * @returns Text representation. - * @alias Blockly.utils.xml.domToText */ export function domToText(dom: Node): string { const oSerializer = new XMLSerializer(); diff --git a/core/variable_map.ts b/core/variable_map.ts index ecba4b87f..45f562618 100644 --- a/core/variable_map.ts +++ b/core/variable_map.ts @@ -32,8 +32,6 @@ import type {Workspace} from './workspace.js'; * Class for a variable map. This contains a dictionary data structure with * variable types as keys and lists of variables as values. The list of * variables are the type indicated by the key. - * - * @alias Blockly.VariableMap */ export class VariableMap { /** diff --git a/core/variable_model.ts b/core/variable_model.ts index cfd832a90..11c901474 100644 --- a/core/variable_model.ts +++ b/core/variable_model.ts @@ -24,7 +24,6 @@ import type {Workspace} from './workspace.js'; * Holds information for the variable including name, ID, and type. * * @see {Blockly.FieldVariable} - * @alias Blockly.VariableModel */ export class VariableModel { type: string; diff --git a/core/variables.ts b/core/variables.ts index e50327347..f919aca24 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -28,8 +28,6 @@ import * as Xml from './xml.js'; * variable blocks. * See also Blockly.Procedures.CATEGORY_NAME and * Blockly.VariablesDynamic.CATEGORY_NAME. - * - * @alias Blockly.Variables.CATEGORY_NAME */ export const CATEGORY_NAME = 'VARIABLE'; @@ -41,7 +39,6 @@ export const CATEGORY_NAME = 'VARIABLE'; * * @param ws The workspace to search for variables. * @returns Array of variable models. - * @alias Blockly.Variables.allUsedVarModels */ export function allUsedVarModels(ws: Workspace): VariableModel[] { const blocks = ws.getAllBlocks(false); @@ -73,7 +70,6 @@ export function allUsedVarModels(ws: Workspace): VariableModel[] { * * @param workspace The workspace to search. * @returns A list of non-duplicated variable names. - * @alias Blockly.Variables.allDeveloperVariables */ export function allDeveloperVariables(workspace: Workspace): string[] { const blocks = workspace.getAllBlocks(false); @@ -97,7 +93,6 @@ export function allDeveloperVariables(workspace: Workspace): string[] { * * @param workspace The workspace containing variables. * @returns Array of XML elements. - * @alias Blockly.Variables.flyoutCategory */ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { let xmlList = new Array(); @@ -121,7 +116,6 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { * * @param workspace The workspace containing variables. * @returns Array of XML block elements. - * @alias Blockly.Variables.flyoutCategoryBlocks */ export function flyoutCategoryBlocks(workspace: Workspace): Element[] { const variableModelList = workspace.getVariablesOfType(''); @@ -166,7 +160,6 @@ export function flyoutCategoryBlocks(workspace: Workspace): Element[] { return xmlList; } -/** @alias Blockly.Variables.VAR_LETTER_OPTIONS */ export const VAR_LETTER_OPTIONS = 'ijkmnopqrstuvwxyzabcdefgh'; /** @@ -177,7 +170,6 @@ export const VAR_LETTER_OPTIONS = 'ijkmnopqrstuvwxyzabcdefgh'; * * @param workspace The workspace to be unique in. * @returns New variable name. - * @alias Blockly.Variables.generateUniqueName */ export function generateUniqueName(workspace: Workspace): string { return TEST_ONLY.generateUniqueNameInternal(workspace); @@ -199,7 +191,6 @@ function generateUniqueNameInternal(workspace: Workspace): string { * @param startChar The character to start the search at. * @param usedNames A list of all of the used names. * @returns A unique name that is not present in the usedNames array. - * @alias Blockly.Variables.generateUniqueNameFromOptions */ export function generateUniqueNameFromOptions( startChar: string, usedNames: string[]): string { @@ -251,7 +242,6 @@ export function generateUniqueNameFromOptions( * an existing variable was chosen. * @param opt_type The type of the variable like 'int', 'string', or ''. This * will default to '', which is a specific type. - * @alias Blockly.Variables.createVariableButtonHandler */ export function createVariableButtonHandler( workspace: Workspace, opt_callback?: (p1?: string|null) => void, @@ -301,7 +291,6 @@ export function createVariableButtonHandler( * @param opt_callback A callback. It will be passed an acceptable new variable * name, or null if change is to be aborted (cancel button), or undefined if * an existing variable was chosen. - * @alias Blockly.Variables.renameVariable */ export function renameVariable( workspace: Workspace, variable: VariableModel, @@ -345,7 +334,6 @@ export function renameVariable( * @param defaultText The default value to show in the prompt's field. * @param callback A callback. It will be passed the new variable name, or null * if the user picked something illegal. - * @alias Blockly.Variables.promptName */ export function promptName( promptText: string, defaultText: string, @@ -392,7 +380,6 @@ function nameUsedWithOtherType( * @param name The name to search for. * @param workspace The workspace to search for the variable. * @returns The variable with the given name, or null if none was found. - * @alias Blockly.Variables.nameUsedWithAnyType */ export function nameUsedWithAnyType( name: string, workspace: Workspace): VariableModel|null { @@ -412,7 +399,6 @@ export function nameUsedWithAnyType( * * @param variableModel The variable model to represent. * @returns The generated DOM. - * @alias Blockly.Variables.generateVariableFieldDom */ export function generateVariableFieldDom(variableModel: VariableModel): Element { @@ -439,7 +425,6 @@ export function generateVariableFieldDom(variableModel: VariableModel): * @param opt_type The type to use to look up or create the variable. * @returns The variable corresponding to the given ID or name + type * combination. - * @alias Blockly.Variables.getOrCreateVariablePackage */ export function getOrCreateVariablePackage( workspace: Workspace, id: string|null, opt_name?: string, @@ -465,7 +450,6 @@ export function getOrCreateVariablePackage( * Only used if lookup by ID fails. * @returns The variable corresponding to the given ID or name + type * combination, or null if not found. - * @alias Blockly.Variables.getVariable */ export function getVariable( workspace: Workspace, id: string|null, opt_name?: string, @@ -543,7 +527,6 @@ function createVariable( * @returns The new array of variables that were freshly added to the workspace * after creating the new block, or [] if no new variables were added to the * workspace. - * @alias Blockly.Variables.getAddedVariables * @internal */ export function getAddedVariables( diff --git a/core/variables_dynamic.ts b/core/variables_dynamic.ts index 6191b99d2..500cbec41 100644 --- a/core/variables_dynamic.ts +++ b/core/variables_dynamic.ts @@ -28,8 +28,6 @@ import type {FlyoutButton} from './flyout_button.js'; * variable blocks. * See also Blockly.Variables.CATEGORY_NAME and * Blockly.Procedures.CATEGORY_NAME. - * - * @alias Blockly.VariablesDynamic.CATEGORY_NAME */ export const CATEGORY_NAME = 'VARIABLE_DYNAMIC'; @@ -75,7 +73,6 @@ export const onCreateVariableButtonClick_Colour = colourButtonClickHandler; * * @param workspace The workspace containing variables. * @returns Array of XML elements. - * @alias Blockly.VariablesDynamic.flyoutCategory */ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { let xmlList = new Array(); @@ -109,7 +106,6 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { * * @param workspace The workspace containing variables. * @returns Array of XML block elements. - * @alias Blockly.VariablesDynamic.flyoutCategoryBlocks */ export function flyoutCategoryBlocks(workspace: Workspace): Element[] { const variableModelList = workspace.getAllVariables(); diff --git a/core/warning.ts b/core/warning.ts index 76ae9ff00..8e80f9234 100644 --- a/core/warning.ts +++ b/core/warning.ts @@ -26,8 +26,6 @@ import {Svg} from './utils/svg.js'; /** * Class for a warning. - * - * @alias Blockly.Warning */ export class Warning extends Icon { private text: {[key: string]: string}; diff --git a/core/widgetdiv.ts b/core/widgetdiv.ts index 1ca04092f..9a24540ac 100644 --- a/core/widgetdiv.ts +++ b/core/widgetdiv.ts @@ -40,7 +40,6 @@ let containerDiv: HTMLDivElement|null; * Returns the HTML container for editor widgets. * * @returns The editor widget container. - * @alias Blockly.WidgetDiv.getDiv */ export function getDiv(): HTMLDivElement|null { return containerDiv; @@ -50,7 +49,6 @@ export function getDiv(): HTMLDivElement|null { * Allows unit tests to reset the div. Do not use outside of tests. * * @param newDiv The new value for the DIV field. - * @alias Blockly.WidgetDiv.testOnly_setDiv * @internal */ export function testOnly_setDiv(newDiv: HTMLDivElement|null) { @@ -59,8 +57,6 @@ export function testOnly_setDiv(newDiv: HTMLDivElement|null) { /** * Create the widget div and inject it onto the page. - * - * @alias Blockly.WidgetDiv.createDom */ export function createDom() { if (containerDiv) { @@ -80,7 +76,6 @@ export function createDom() { * @param rtl Right-to-left (true) or left-to-right (false). * @param newDispose Optional cleanup function to be run when the widget is * closed. - * @alias Blockly.WidgetDiv.show */ export function show(newOwner: unknown, rtl: boolean, newDispose: () => void) { hide(); @@ -103,8 +98,6 @@ export function show(newOwner: unknown, rtl: boolean, newDispose: () => void) { /** * Destroy the widget and hide the div. - * - * @alias Blockly.WidgetDiv.hide */ export function hide() { if (!isVisible()) { @@ -136,7 +129,6 @@ export function hide() { * Is the container visible? * * @returns True if visible. - * @alias Blockly.WidgetDiv.isVisible */ export function isVisible(): boolean { return !!owner; @@ -147,7 +139,6 @@ export function isVisible(): boolean { * object. * * @param oldOwner The object that was using this container. - * @alias Blockly.WidgetDiv.hideIfOwner */ export function hideIfOwner(oldOwner: unknown) { if (owner === oldOwner) { @@ -182,7 +173,6 @@ function positionInternal(x: number, y: number, height: number) { * window coordinates. * @param rtl Whether the workspace is in RTL mode. This determines horizontal * alignment. - * @alias Blockly.WidgetDiv.positionWithAnchor * @internal */ export function positionWithAnchor( diff --git a/core/workspace.ts b/core/workspace.ts index 4018cef9f..61cbb3fa7 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -39,8 +39,6 @@ import {ObservableProcedureMap} from './observable_procedure_map.js'; /** * Class for a workspace. This is a data structure that contains blocks. * There is no UI, and can be created headlessly. - * - * @alias Blockly.Workspace */ export class Workspace implements IASTNodeLocation { /** diff --git a/core/workspace_audio.ts b/core/workspace_audio.ts index 3c9d443f8..7874161f8 100644 --- a/core/workspace_audio.ts +++ b/core/workspace_audio.ts @@ -25,8 +25,6 @@ const SOUND_LIMIT = 100; /** * Class for loading, storing, and playing audio for a workspace. - * - * @alias Blockly.WorkspaceAudio */ export class WorkspaceAudio { /** Database of pre-loaded sounds. */ diff --git a/core/workspace_comment.ts b/core/workspace_comment.ts index 8870c6245..4a4de35ff 100644 --- a/core/workspace_comment.ts +++ b/core/workspace_comment.ts @@ -22,8 +22,6 @@ import type {Workspace} from './workspace.js'; /** * Class for a workspace comment. - * - * @alias Blockly.WorkspaceComment */ export class WorkspaceComment { id: string; diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 4a86e89f9..318c4ee77 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -45,8 +45,6 @@ const TEXTAREA_OFFSET = 2; /** * Class for a workspace comment's SVG representation. - * - * @alias Blockly.WorkspaceCommentSvg */ export class WorkspaceCommentSvg extends WorkspaceComment implements IBoundedElement, IBubble, ICopyable { diff --git a/core/workspace_dragger.ts b/core/workspace_dragger.ts index 939c73ab6..35f6e97f5 100644 --- a/core/workspace_dragger.ts +++ b/core/workspace_dragger.ts @@ -20,8 +20,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a workspace dragger. It moves the workspace around when it is * being dragged by a mouse or touch. - * - * @alias Blockly.WorkspaceDragger */ export class WorkspaceDragger { private readonly horizontalScrollEnabled_: boolean; diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 67bdaf814..dfc287afa 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -85,8 +85,6 @@ const ZOOM_TO_FIT_MARGIN = 20; /** * Class for a workspace. This is an onscreen area with optional trashcan, * scrollbars, bubbles, and dragging. - * - * @alias Blockly.WorkspaceSvg */ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** @@ -2478,7 +2476,6 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * scrollbars accordingly. * * @param workspace The workspace to resize. - * @alias Blockly.WorkspaceSvg.resizeSvgContents * @internal */ export function resizeSvgContents(workspace: WorkspaceSvg) { diff --git a/core/xml.ts b/core/xml.ts index 4ecde7780..78c5d31b2 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -35,7 +35,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * @param workspace The workspace containing blocks. * @param opt_noId True if the encoder should skip the block IDs. * @returns XML DOM element. - * @alias Blockly.Xml.workspaceToDom */ export function workspaceToDom( workspace: Workspace, opt_noId?: boolean): Element { @@ -63,7 +62,6 @@ export function workspaceToDom( * * @param variableList List of all variable models. * @returns Tree of XML elements. - * @alias Blockly.Xml.variablesToDom */ export function variablesToDom(variableList: VariableModel[]): Element { const variables = utilsXml.createElement('variables'); @@ -87,7 +85,6 @@ export function variablesToDom(variableList: VariableModel[]): Element { * @param opt_noId True if the encoder should skip the block ID. * @returns Tree of XML elements or an empty document fragment if the block was * an insertion marker. - * @alias Blockly.Xml.blockToDomWithXY */ export function blockToDomWithXY(block: Block, opt_noId?: boolean): Element| DocumentFragment { @@ -158,7 +155,6 @@ function allFieldsToDom(block: Block, element: Element) { * @param opt_noId True if the encoder should skip the block ID. * @returns Tree of XML elements or an empty document fragment if the block was * an insertion marker. - * @alias Blockly.Xml.blockToDom */ export function blockToDom(block: Block, opt_noId?: boolean): Element| DocumentFragment { @@ -337,7 +333,6 @@ function cloneShadow(shadow: Element, opt_noId?: boolean): Element { * * @param dom A tree of XML nodes. * @returns Text representation. - * @alias Blockly.Xml.domToText */ export function domToText(dom: Node): string { const text = utilsXml.domToText(dom); @@ -351,7 +346,6 @@ export function domToText(dom: Node): string { * * @param dom A tree of XML elements. * @returns Text representation. - * @alias Blockly.Xml.domToPrettyText */ export function domToPrettyText(dom: Node): string { // This function is not guaranteed to be correct for all XML. @@ -386,7 +380,6 @@ export function domToPrettyText(dom: Node): string { * @returns A DOM object representing the singular child of the document * element. * @throws if the text doesn't parse. - * @alias Blockly.Xml.textToDom */ export function textToDom(text: string): Element { const doc = utilsXml.textToDomDocument(text); @@ -404,7 +397,6 @@ export function textToDom(text: string): Element { * @param xml XML DOM. * @param workspace The workspace. * @returns An array containing new block IDs. - * @alias Blockly.Xml.clearWorkspaceAndLoadFromXml */ export function clearWorkspaceAndLoadFromXml( xml: Element, workspace: WorkspaceSvg): string[] { @@ -425,7 +417,6 @@ export function clearWorkspaceAndLoadFromXml( * @returns An array containing new block IDs. * @suppress {strictModuleDepCheck} Suppress module check while workspace * comments are not bundled in. - * @alias Blockly.Xml.domToWorkspace */ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { let width = 0; // Not used in LTR. @@ -512,7 +503,6 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { * @param xml The XML DOM. * @param workspace The workspace to add to. * @returns An array containing new block IDs. - * @alias Blockly.Xml.appendDomToWorkspace */ export function appendDomToWorkspace( xml: Element, workspace: WorkspaceSvg): string[] { @@ -566,7 +556,6 @@ export function appendDomToWorkspace( * @param xmlBlock XML block element. * @param workspace The workspace. * @returns The root block created. - * @alias Blockly.Xml.domToBlock */ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { // Create top-level block. @@ -630,7 +619,6 @@ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { * * @param xmlVariables List of XML variable elements. * @param workspace The workspace to which the variable should be added. - * @alias Blockly.Xml.domToVariables */ export function domToVariables(xmlVariables: Element, workspace: Workspace) { for (let i = 0; i < xmlVariables.children.length; i++) { @@ -1020,7 +1008,6 @@ function domToField(block: Block, fieldName: string, xml: Element) { * * @param xmlBlock XML block element or an empty DocumentFragment if the block * was an insertion marker. - * @alias Blockly.Xml.deleteNext */ export function deleteNext(xmlBlock: Element|DocumentFragment) { for (let i = 0; i < xmlBlock.childNodes.length; i++) { diff --git a/core/zoom_controls.ts b/core/zoom_controls.ts index b25ff4a85..128ad7fa6 100644 --- a/core/zoom_controls.ts +++ b/core/zoom_controls.ts @@ -33,8 +33,6 @@ import type {WorkspaceSvg} from './workspace_svg.js'; /** * Class for a zoom controls. - * - * @alias Blockly.ZoomControls */ export class ZoomControls implements IPositionable { /** diff --git a/demos/blockfactory/block_definition_extractor.js b/demos/blockfactory/block_definition_extractor.js index ef791a224..35186ac84 100644 --- a/demos/blockfactory/block_definition_extractor.js +++ b/demos/blockfactory/block_definition_extractor.js @@ -17,7 +17,6 @@ * * The exampleBlocklyBlock is usually the block loaded into the * preview workspace after manually entering the block definition. - * */ 'use strict'; diff --git a/demos/blockfactory/block_exporter_controller.js b/demos/blockfactory/block_exporter_controller.js index 66e7c61fe..bd41f2e74 100644 --- a/demos/blockfactory/block_exporter_controller.js +++ b/demos/blockfactory/block_exporter_controller.js @@ -9,7 +9,6 @@ * users to export block definitions and generator stubs of their saved blocks * easily using a visual interface. Depends on Block Exporter View and Block * Exporter Tools classes. Interacts with Export Settings in the index.html. - * */ 'use strict'; diff --git a/demos/blockfactory/block_exporter_tools.js b/demos/blockfactory/block_exporter_tools.js index bec5e86b2..58da9be1a 100644 --- a/demos/blockfactory/block_exporter_tools.js +++ b/demos/blockfactory/block_exporter_tools.js @@ -9,7 +9,6 @@ * block definitions and generator stubs for given block types. Also generates * toolbox XML for the exporter's workspace. Depends on the FactoryUtils for * its code generation functions. - * */ 'use strict'; diff --git a/demos/blockfactory/block_exporter_view.js b/demos/blockfactory/block_exporter_view.js index 6c2562a55..aa840e59d 100644 --- a/demos/blockfactory/block_exporter_view.js +++ b/demos/blockfactory/block_exporter_view.js @@ -7,7 +7,6 @@ /** * @fileoverview Javascript for the Block Exporter View class. Reads from and * manages a block selector through which users select blocks to export. - * */ 'use strict'; diff --git a/demos/blockfactory/block_library_controller.js b/demos/blockfactory/block_library_controller.js index 25d50726e..2192a7bdd 100644 --- a/demos/blockfactory/block_library_controller.js +++ b/demos/blockfactory/block_library_controller.js @@ -13,7 +13,6 @@ * - delete blocks * - clear their block library * Depends on BlockFactory functions defined in factory.js. - * */ 'use strict'; diff --git a/demos/blockfactory/block_library_storage.js b/demos/blockfactory/block_library_storage.js index dc19ce64f..a413a6c73 100644 --- a/demos/blockfactory/block_library_storage.js +++ b/demos/blockfactory/block_library_storage.js @@ -7,7 +7,6 @@ /** * @fileoverview Javascript for Block Library's Storage Class. * Depends on Block Library for its namespace. - * */ 'use strict'; diff --git a/demos/blockfactory/block_library_view.js b/demos/blockfactory/block_library_view.js index 2a47dcd0f..a47980408 100644 --- a/demos/blockfactory/block_library_view.js +++ b/demos/blockfactory/block_library_view.js @@ -7,7 +7,6 @@ /** * @fileoverview Javascript for BlockLibraryView class. It manages the display * of the Block Library dropdown, save, and delete buttons. - * */ 'use strict'; diff --git a/demos/blockfactory/block_option.js b/demos/blockfactory/block_option.js index efc308834..184c3c235 100644 --- a/demos/blockfactory/block_option.js +++ b/demos/blockfactory/block_option.js @@ -9,7 +9,6 @@ * of the various blocks that you may select in the Block Selector. Each block * option has a checkbox, a label, and a preview workspace through which to * view the block. - * */ 'use strict'; diff --git a/demos/blockfactory/factory.js b/demos/blockfactory/factory.js index 6acdbee82..015bcedf5 100644 --- a/demos/blockfactory/factory.js +++ b/demos/blockfactory/factory.js @@ -10,7 +10,6 @@ * generate a preview block and starter code for the block (block definition and * generator stub. Uses the Block Factory namespace. Depends on the FactoryUtils * for its code generation functions. - * */ 'use strict'; diff --git a/demos/blockfactory/standard_categories.js b/demos/blockfactory/standard_categories.js index eefadf2b9..f4289d586 100644 --- a/demos/blockfactory/standard_categories.js +++ b/demos/blockfactory/standard_categories.js @@ -10,7 +10,6 @@ * the lower case name of the category, and contains the Category object for * that particular category. Also has a list of core block types provided * by Blockly. - * */ 'use strict'; diff --git a/demos/blockfactory/workspacefactory/wfactory_controller.js b/demos/blockfactory/workspacefactory/wfactory_controller.js index 73a2a4b41..57afaab65 100644 --- a/demos/blockfactory/workspacefactory/wfactory_controller.js +++ b/demos/blockfactory/workspacefactory/wfactory_controller.js @@ -16,7 +16,6 @@ * - updating the preview workspace * - changing a category name * - moving the position of a category. - * */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_generator.js b/demos/blockfactory/workspacefactory/wfactory_generator.js index 02a1fa43e..ca1a47b09 100644 --- a/demos/blockfactory/workspacefactory/wfactory_generator.js +++ b/demos/blockfactory/workspacefactory/wfactory_generator.js @@ -10,7 +10,6 @@ * Blockly.Xml and depends on information in the model (holds a reference). * Depends on a hidden workspace created in the generator to load saved XML in * order to generate toolbox XML. - * */ diff --git a/demos/blockfactory/workspacefactory/wfactory_init.js b/demos/blockfactory/workspacefactory/wfactory_init.js index c04f451a9..352c1d220 100644 --- a/demos/blockfactory/workspacefactory/wfactory_init.js +++ b/demos/blockfactory/workspacefactory/wfactory_init.js @@ -9,7 +9,6 @@ * Adds click handlers to buttons and dropdowns, adds event listeners for * keydown events and Blockly events, and configures the initial setup of * the page. - * */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_model.js b/demos/blockfactory/workspacefactory/wfactory_model.js index 4b871ccf6..9b9586ea1 100644 --- a/demos/blockfactory/workspacefactory/wfactory_model.js +++ b/demos/blockfactory/workspacefactory/wfactory_model.js @@ -12,7 +12,6 @@ * move categories easily. Keeps track of the currently selected list * element. Also keeps track of all the user-created shadow blocks and * manipulates them as necessary. - * */ /** diff --git a/tests/bootstrap.js b/tests/bootstrap.js index d872ab269..01bae8c2b 100644 --- a/tests/bootstrap.js +++ b/tests/bootstrap.js @@ -35,7 +35,6 @@ * The bootstrap code will consult a BLOCKLY_BOOTSTRAP_OPTIONS * global variable to determine what to load. This must be set * before loading this script. See documentation inline below. - * */ 'use strict'; From d808c068d2110405bbfb64e5f2a70d3e15de070c Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 7 Feb 2023 10:25:13 +0000 Subject: [PATCH 068/141] fix(tests): Use build/msg/en.js instead of msg/messages.js (#6825) This change had already been made (by PR #6475 amongst other) to most of the tests, but there were a couple of stragglers that still mentioned messages.js. Fixes #6824. --- tests/bootstrap_helper.js | 2 +- tests/playgrounds/shared_procedures.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap_helper.js b/tests/bootstrap_helper.js index 4a22dadcb..8809fe79c 100644 --- a/tests/bootstrap_helper.js +++ b/tests/bootstrap_helper.js @@ -10,7 +10,7 @@ * This is loaded, via goog.bootstrap(), after the other top-level * Blockly modules. It simply calls goog.require() for each of them, * to force the debug module loader to finish loading them before any - * non-module scripts (like msg/messages.js) that might have + * non-module scripts (like msg/en.js) that might have * undeclared dependencies on them. */ diff --git a/tests/playgrounds/shared_procedures.html b/tests/playgrounds/shared_procedures.html index 63a1a9054..c1681e540 100644 --- a/tests/playgrounds/shared_procedures.html +++ b/tests/playgrounds/shared_procedures.html @@ -9,7 +9,7 @@ ` From 587f558db85b494c4eeb2375fc329e28e9128552 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 23:09:14 +0000 Subject: [PATCH 111/141] chore(deps): bump jsdom from 21.1.0 to 21.1.1 (#6891) Bumps [jsdom](https://github.com/jsdom/jsdom) from 21.1.0 to 21.1.1. - [Release notes](https://github.com/jsdom/jsdom/releases) - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md) - [Commits](https://github.com/jsdom/jsdom/compare/21.1.0...21.1.1) --- updated-dependencies: - dependency-name: jsdom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 248 ++++++++++++++++++++++++++++++++++++---------- package.json | 2 +- 2 files changed, 198 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 015003c12..0f8254ad7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "jsdom": "21.1.0" + "jsdom": "21.1.1" }, "devDependencies": { "@blockly/block-test": "^3.0.0", @@ -1936,9 +1936,9 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "bin": { "acorn": "bin/acorn" }, @@ -3538,12 +3538,16 @@ "node_modules/cssom": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true, + "peer": true }, "node_modules/cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "peer": true, "dependencies": { "cssom": "~0.3.6" }, @@ -3554,7 +3558,9 @@ "node_modules/cssstyle/node_modules/cssom": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true, + "peer": true }, "node_modules/d": { "version": "1.0.1", @@ -3576,6 +3582,8 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "peer": true, "dependencies": { "abab": "^2.0.6", "whatwg-mimetype": "^3.0.0", @@ -3675,9 +3683,9 @@ } }, "node_modules/decimal.js": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.2.tgz", - "integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA==" + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, "node_modules/decode-uri-component": { "version": "0.2.2", @@ -7329,17 +7337,16 @@ } }, "node_modules/jsdom": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", - "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.1.tgz", + "integrity": "sha512-Jjgdmw48RKcdAIQyUD1UdBh2ecH7VqwaXPN3ehoZN6MqgVbMn+lRm1aAT1AsdJRAJpwfa4IpwgzySn61h2qu3w==", "dependencies": { "abab": "^2.0.6", - "acorn": "^8.8.1", + "acorn": "^8.8.2", "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", + "cssstyle": "^3.0.0", + "data-urls": "^4.0.0", + "decimal.js": "^10.4.3", "domexception": "^4.0.0", "escodegen": "^2.0.0", "form-data": "^4.0.0", @@ -7348,7 +7355,8 @@ "https-proxy-agent": "^5.0.1", "is-potential-custom-element-name": "^1.0.1", "nwsapi": "^2.2.2", - "parse5": "^7.1.1", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", "tough-cookie": "^4.1.2", @@ -7356,8 +7364,8 @@ "webidl-conversions": "^7.0.0", "whatwg-encoding": "^2.0.0", "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", + "whatwg-url": "^12.0.1", + "ws": "^8.13.0", "xml-name-validator": "^4.0.0" }, "engines": { @@ -7372,6 +7380,73 @@ } } }, + "node_modules/jsdom/node_modules/cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "dependencies": { + "rrweb-cssom": "^0.6.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jsdom/node_modules/data-urls": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", + "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "dependencies": { + "punycode": "^2.3.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "dependencies": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jsdom/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -9101,9 +9176,9 @@ } }, "node_modules/parse5": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.1.tgz", - "integrity": "sha512-kwpuwzB+px5WUg9pyK0IcK/shltJN5/OVhQagxhCQNtT9Y9QRZqNY2e1cmbu/paRh5LMnz/oVTVLBpjFmMZhSg==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", "dependencies": { "entities": "^4.4.0" }, @@ -9630,9 +9705,9 @@ } }, "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "engines": { "node": ">=6" } @@ -10276,6 +10351,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -11505,6 +11585,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "peer": true, "dependencies": { "punycode": "^2.1.1" }, @@ -12311,6 +12393,8 @@ "version": "11.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "peer": true, "dependencies": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -12381,6 +12465,7 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "dev": true, "engines": { "node": ">=10.0.0" }, @@ -14006,9 +14091,9 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, "acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==" + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" }, "acorn-globals": { "version": "7.0.1", @@ -15252,12 +15337,16 @@ "cssom": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true, + "peer": true }, "cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "peer": true, "requires": { "cssom": "~0.3.6" }, @@ -15265,7 +15354,9 @@ "cssom": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true, + "peer": true } } }, @@ -15289,6 +15380,8 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "peer": true, "requires": { "abab": "^2.0.6", "whatwg-mimetype": "^3.0.0", @@ -15362,9 +15455,9 @@ } }, "decimal.js": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.2.tgz", - "integrity": "sha512-ic1yEvwT6GuvaYwBLLY6/aFFgjZdySKTE8en/fkU3QICTmRtgtSlFn0u0BXN06InZwtfCelR7j8LRiDI/02iGA==" + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, "decode-uri-component": { "version": "0.2.2", @@ -18269,17 +18362,16 @@ "dev": true }, "jsdom": { - "version": "21.1.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", - "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.1.tgz", + "integrity": "sha512-Jjgdmw48RKcdAIQyUD1UdBh2ecH7VqwaXPN3ehoZN6MqgVbMn+lRm1aAT1AsdJRAJpwfa4IpwgzySn61h2qu3w==", "requires": { "abab": "^2.0.6", - "acorn": "^8.8.1", + "acorn": "^8.8.2", "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", + "cssstyle": "^3.0.0", + "data-urls": "^4.0.0", + "decimal.js": "^10.4.3", "domexception": "^4.0.0", "escodegen": "^2.0.0", "form-data": "^4.0.0", @@ -18288,7 +18380,8 @@ "https-proxy-agent": "^5.0.1", "is-potential-custom-element-name": "^1.0.1", "nwsapi": "^2.2.2", - "parse5": "^7.1.1", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.6.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", "tough-cookie": "^4.1.2", @@ -18296,9 +18389,52 @@ "webidl-conversions": "^7.0.0", "whatwg-encoding": "^2.0.0", "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", + "whatwg-url": "^12.0.1", + "ws": "^8.13.0", "xml-name-validator": "^4.0.0" + }, + "dependencies": { + "cssstyle": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", + "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", + "requires": { + "rrweb-cssom": "^0.6.0" + } + }, + "data-urls": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", + "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", + "requires": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^12.0.0" + } + }, + "tr46": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "requires": { + "punycode": "^2.3.0" + } + }, + "whatwg-url": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", + "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "requires": { + "tr46": "^4.1.1", + "webidl-conversions": "^7.0.0" + } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + } } }, "json-buffer": { @@ -19701,9 +19837,9 @@ "dev": true }, "parse5": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.1.tgz", - "integrity": "sha512-kwpuwzB+px5WUg9pyK0IcK/shltJN5/OVhQagxhCQNtT9Y9QRZqNY2e1cmbu/paRh5LMnz/oVTVLBpjFmMZhSg==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", "requires": { "entities": "^4.4.0" } @@ -20123,9 +20259,9 @@ } }, "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" }, "puppeteer-core": { "version": "19.7.1", @@ -20614,6 +20750,11 @@ "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", "dev": true }, + "rrweb-cssom": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", + "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -21645,6 +21786,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "peer": true, "requires": { "punycode": "^2.1.1" } @@ -22266,6 +22409,8 @@ "version": "11.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "peer": true, "requires": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -22318,6 +22463,7 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "dev": true, "requires": {} }, "xml-name-validator": { diff --git a/package.json b/package.json index 4b698c429..67f1782d2 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,6 @@ "yargs": "^17.2.1" }, "dependencies": { - "jsdom": "21.1.0" + "jsdom": "21.1.1" } } From b17187629a1289c4aaee07adb81967b87fc2a735 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 23:10:44 +0000 Subject: [PATCH 112/141] chore(deps): bump google-closure-compiler (#6882) Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20230103.0.0 to 20230206.0.0. - [Release notes](https://github.com/google/closure-compiler-npm/releases) - [Commits](https://github.com/google/closure-compiler-npm/compare/v20230103.0.0...v20230206.0.0) --- updated-dependencies: - dependency-name: google-closure-compiler dependency-type: direct:development update-type: version-update:semver-major ... 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 0f8254ad7..600629da7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^40.0.0", - "google-closure-compiler": "^20230103.0.0", + "google-closure-compiler": "^20230206.0.0", "google-closure-deps": "^20230206.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", @@ -5617,13 +5617,13 @@ } }, "node_modules/google-closure-compiler": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230103.0.0.tgz", - "integrity": "sha512-gejhxkvSocXTL83pVxvlGBfny9TIKg9XVzs/Mqc3jVghLoAQUy1s6Tu4AUNMHIgEdJTSmkfvB5QEYVZsABy1QQ==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230206.0.0.tgz", + "integrity": "sha512-gGscQOcO/75AlHyw78v87u0nGKJHWqOrQ224Ks91HH1iISgF+xZ8GYosU/8s5VD66x3VD0tJKXM2rIoGOA1ycA==", "dev": true, "dependencies": { "chalk": "4.x", - "google-closure-compiler-java": "^20230103.0.0", + "google-closure-compiler-java": "^20230206.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" @@ -5635,21 +5635,21 @@ "node": ">=10" }, "optionalDependencies": { - "google-closure-compiler-linux": "^20230103.0.0", - "google-closure-compiler-osx": "^20230103.0.0", - "google-closure-compiler-windows": "^20230103.0.0" + "google-closure-compiler-linux": "^20230206.0.0", + "google-closure-compiler-osx": "^20230206.0.0", + "google-closure-compiler-windows": "^20230206.0.0" } }, "node_modules/google-closure-compiler-java": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230103.0.0.tgz", - "integrity": "sha512-SUNv5HaAiXNjm6BjYMsGvJhizWisHk4sl9Kxq3LnaCCpZJeiJQX23Z391IPqD8lHcUQmmJkxe8+WMwQP6NV1Cg==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230206.0.0.tgz", + "integrity": "sha512-OcnDf29yx4JNU13HpptADI2ckl9hEchktSHs2XSLQ/xStUAJQGQOl96to5IYh2VuFgn3Ssaw6M3c6At2pJr7wQ==", "dev": true }, "node_modules/google-closure-compiler-linux": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230103.0.0.tgz", - "integrity": "sha512-83v+8wHitIbD3fraRuaL8OlTfO1tFvepJbrB3yUCK/HU+3SjY6AFgbeCJ06nNPwzTo9zuQUwhrbCrpvNTkAqZg==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230206.0.0.tgz", + "integrity": "sha512-06N6w2elsnZMMA4Gf/vN2A3XzWvu+gUTrBczaw0KQL48GgdLq6OgAXrcopbGdi/K8Gz1WAcG0qf2ccG8dSqYNg==", "cpu": [ "x32", "x64" @@ -5661,9 +5661,9 @@ ] }, "node_modules/google-closure-compiler-osx": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230103.0.0.tgz", - "integrity": "sha512-TBoOUe6ySIepdiYF3S7/IzCNk0TN7Lwp8VfTBYLX+qOUFLLC+HHqXXrl8kVstgH3J202pTDb6XZl9pQD16rEXQ==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230206.0.0.tgz", + "integrity": "sha512-lJ/Y4HTk+KdL6PhLmmalP/3DdzGK0mS0+htuFP6y4t9+QXiUKnpHWx/VDQ3Fwm2fWEzqDxfhX3R+wC9lBvFiAg==", "cpu": [ "x32", "x64", @@ -5676,9 +5676,9 @@ ] }, "node_modules/google-closure-compiler-windows": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230103.0.0.tgz", - "integrity": "sha512-hMKtPeoFchaz/c4D6xgjWYmumxJwPTSoyELZ3jRI4xz2Zp9WsP4h44kCykZ9A65ynl60PuPfzsD3/IrK9HisyA==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230206.0.0.tgz", + "integrity": "sha512-4KPr7XPiOs8g4Ao3T+70egf14avCEne26XF4Mur4Fg5511ym1uEN+NlEyjBOAmfUFfaA7BYDsA8iBzDIetKrnw==", "cpu": [ "x32", "x64" @@ -16989,45 +16989,45 @@ } }, "google-closure-compiler": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230103.0.0.tgz", - "integrity": "sha512-gejhxkvSocXTL83pVxvlGBfny9TIKg9XVzs/Mqc3jVghLoAQUy1s6Tu4AUNMHIgEdJTSmkfvB5QEYVZsABy1QQ==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230206.0.0.tgz", + "integrity": "sha512-gGscQOcO/75AlHyw78v87u0nGKJHWqOrQ224Ks91HH1iISgF+xZ8GYosU/8s5VD66x3VD0tJKXM2rIoGOA1ycA==", "dev": true, "requires": { "chalk": "4.x", - "google-closure-compiler-java": "^20230103.0.0", - "google-closure-compiler-linux": "^20230103.0.0", - "google-closure-compiler-osx": "^20230103.0.0", - "google-closure-compiler-windows": "^20230103.0.0", + "google-closure-compiler-java": "^20230206.0.0", + "google-closure-compiler-linux": "^20230206.0.0", + "google-closure-compiler-osx": "^20230206.0.0", + "google-closure-compiler-windows": "^20230206.0.0", "minimist": "1.x", "vinyl": "2.x", "vinyl-sourcemaps-apply": "^0.2.0" } }, "google-closure-compiler-java": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230103.0.0.tgz", - "integrity": "sha512-SUNv5HaAiXNjm6BjYMsGvJhizWisHk4sl9Kxq3LnaCCpZJeiJQX23Z391IPqD8lHcUQmmJkxe8+WMwQP6NV1Cg==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230206.0.0.tgz", + "integrity": "sha512-OcnDf29yx4JNU13HpptADI2ckl9hEchktSHs2XSLQ/xStUAJQGQOl96to5IYh2VuFgn3Ssaw6M3c6At2pJr7wQ==", "dev": true }, "google-closure-compiler-linux": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230103.0.0.tgz", - "integrity": "sha512-83v+8wHitIbD3fraRuaL8OlTfO1tFvepJbrB3yUCK/HU+3SjY6AFgbeCJ06nNPwzTo9zuQUwhrbCrpvNTkAqZg==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230206.0.0.tgz", + "integrity": "sha512-06N6w2elsnZMMA4Gf/vN2A3XzWvu+gUTrBczaw0KQL48GgdLq6OgAXrcopbGdi/K8Gz1WAcG0qf2ccG8dSqYNg==", "dev": true, "optional": true }, "google-closure-compiler-osx": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230103.0.0.tgz", - "integrity": "sha512-TBoOUe6ySIepdiYF3S7/IzCNk0TN7Lwp8VfTBYLX+qOUFLLC+HHqXXrl8kVstgH3J202pTDb6XZl9pQD16rEXQ==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230206.0.0.tgz", + "integrity": "sha512-lJ/Y4HTk+KdL6PhLmmalP/3DdzGK0mS0+htuFP6y4t9+QXiUKnpHWx/VDQ3Fwm2fWEzqDxfhX3R+wC9lBvFiAg==", "dev": true, "optional": true }, "google-closure-compiler-windows": { - "version": "20230103.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230103.0.0.tgz", - "integrity": "sha512-hMKtPeoFchaz/c4D6xgjWYmumxJwPTSoyELZ3jRI4xz2Zp9WsP4h44kCykZ9A65ynl60PuPfzsD3/IrK9HisyA==", + "version": "20230206.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230206.0.0.tgz", + "integrity": "sha512-4KPr7XPiOs8g4Ao3T+70egf14avCEne26XF4Mur4Fg5511ym1uEN+NlEyjBOAmfUFfaA7BYDsA8iBzDIetKrnw==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index 67f1782d2..b69e45857 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", "eslint-plugin-jsdoc": "^40.0.0", - "google-closure-compiler": "^20230103.0.0", + "google-closure-compiler": "^20230206.0.0", "google-closure-deps": "^20230206.0.0", "gulp": "^4.0.2", "gulp-clang-format": "^1.0.27", From 66fd055a8340cc622a1dc26e6a49ccdef5983fd8 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 15 Mar 2023 13:12:36 -0700 Subject: [PATCH 113/141] fix: toString performance (#6896) * fix: performance of reducing * chore: remove AST from toString * chore: format * chore: fix build * chore: readd comment --- core/block.ts | 140 ++++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 84 deletions(-) diff --git a/core/block.ts b/core/block.ts index 40cf48117..4d22b1886 100644 --- a/core/block.ts +++ b/core/block.ts @@ -35,7 +35,6 @@ import {Align, Input} from './input.js'; import {inputTypes} from './input_types.js'; import type {IASTNodeLocation} from './interfaces/i_ast_node_location.js'; import type {IDeletable} from './interfaces/i_deletable.js'; -import {ASTNode} from './keyboard_nav/ast_node.js'; import type {Mutator} from './mutator.js'; import * as Tooltip from './tooltip.js'; import * as arrayUtils from './utils/array.js'; @@ -1400,21 +1399,52 @@ export class Block implements IASTNodeLocation, IDeletable { * Create a human-readable text representation of this block and any children. * * @param opt_maxLength Truncate the string to this length. - * @param opt_emptyToken The placeholder string used to denote an empty field. + * @param opt_emptyToken The placeholder string used to denote an empty input. * If not specified, '?' is used. * @returns Text of block. */ toString(opt_maxLength?: number, opt_emptyToken?: string): string { + const tokens = this.toTokens(opt_emptyToken); + + // Run through our tokens array and simplify expression to remove + // parentheses around single field blocks. + // E.g. ['repeat', '(', '10', ')', 'times', 'do', '?'] + for (let i = 2; i < tokens.length; i++) { + if (tokens[i - 2] === '(' && tokens[i] === ')') { + tokens[i - 2] = tokens[i - 1]; + tokens.splice(i - 1, 2); + } + } + + // Join the text array, removing the spaces around added parentheses. + let prev = ''; + let text: string = tokens.reduce((acc, curr) => { + const val = acc + ((prev === '(' || curr === ')') ? '' : ' ') + curr; + prev = curr[curr.length - 1]; + return val; + }, ''); + + text = text.trim() || '???'; + if (opt_maxLength) { + // TODO: Improve truncation so that text from this block is given + // priority. E.g. "1+2+3+4+5+6+7+8+9=0" should be "...6+7+8+9=0", not + // "1+2+3+4+5...". E.g. "1+2+3+4+5=6+7+8+9+0" should be "...4+5=6+7...". + if (text.length > opt_maxLength) { + text = text.substring(0, opt_maxLength - 3) + '...'; + } + } + return text; + } + + /** + * Converts this block into string tokens. + * + * @param emptyToken The token to use in place of an empty input. + * Defaults to '?'. + * @returns The array of string tokens representing this block. + */ + private toTokens(emptyToken = '?'): string[] { const tokens = []; - const emptyFieldPlaceholder = opt_emptyToken || '?'; - - // Temporarily set flag to navigate to all fields. - const prevNavigateFields = ASTNode.NAVIGATE_ALL_FIELDS; - ASTNode.NAVIGATE_ALL_FIELDS = true; - - let node = ASTNode.createBlockNode(this); - const rootNode = node; - /** * Whether or not to add parentheses around an input. * @@ -1430,84 +1460,26 @@ export class Block implements IASTNodeLocation, IDeletable { (checks.indexOf('Boolean') !== -1 || checks.indexOf('Number') !== -1); } - /** Check that we haven't circled back to the original root node. */ - function checkRoot() { - if (node && node.getType() === rootNode?.getType() && - node.getLocation() === rootNode?.getLocation()) { - node = null; + for (const input of this.inputList) { + if (input.name == constants.COLLAPSED_INPUT_NAME) { + continue; } - } - - // Traverse the AST building up our text string. - while (node) { - switch (node.getType()) { - case ASTNode.types.INPUT: { - const connection = node.getLocation() as Connection; - if (!node.in()) { - tokens.push(emptyFieldPlaceholder); - } else if (shouldAddParentheses(connection)) { - tokens.push('('); - } - break; - } - case ASTNode.types.FIELD: { - const field = node.getLocation() as Field; - if (field.name !== constants.COLLAPSED_FIELD_NAME) { - tokens.push(field.getText()); - } - break; - } + for (const field of input.fieldRow) { + tokens.push(field.getText()); } - - const current = node; - node = current.in() || current.next(); - if (!node) { - // Can't go in or next, keep going out until we can go next. - node = current.out(); - checkRoot(); - while (node && !node.next()) { - node = node.out(); - checkRoot(); - // If we hit an input on the way up, possibly close out parentheses. - if (node && node.getType() === ASTNode.types.INPUT && - shouldAddParentheses(node.getLocation() as Connection)) { - tokens.push(')'); - } - } - if (node) { - node = node.next(); + if (input.connection) { + const child = input.connection.targetBlock(); + if (child) { + const shouldAddParens = shouldAddParentheses(input.connection); + if (shouldAddParens) tokens.push('('); + tokens.push(...child.toTokens(emptyToken)); + if (shouldAddParens) tokens.push(')'); + } else { + tokens.push(emptyToken); } } } - - // Restore state of NAVIGATE_ALL_FIELDS. - ASTNode.NAVIGATE_ALL_FIELDS = prevNavigateFields; - - // Run through our text array and simplify expression to remove parentheses - // around single field blocks. - // E.g. ['repeat', '(', '10', ')', 'times', 'do', '?'] - for (let i = 2; i < tokens.length; i++) { - if (tokens[i - 2] === '(' && tokens[i] === ')') { - tokens[i - 2] = tokens[i - 1]; - tokens.splice(i - 1, 2); - } - } - - // Join the text array, removing spaces around added parentheses. - let text: string = tokens.reduce(function(acc, value) { - return acc + (acc.substr(-1) === '(' || value === ')' ? '' : ' ') + value; - }, ''); - - text = text.trim() || '???'; - if (opt_maxLength) { - // TODO: Improve truncation so that text from this block is given - // priority. E.g. "1+2+3+4+5+6+7+8+9=0" should be "...6+7+8+9=0", not - // "1+2+3+4+5...". E.g. "1+2+3+4+5=6+7+8+9+0" should be "...4+5=6+7...". - if (text.length > opt_maxLength) { - text = text.substring(0, opt_maxLength - 3) + '...'; - } - } - return text; + return tokens; } /** From 42fde0f81b5d89c989741c6db41726bce7d2d781 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Wed, 15 Mar 2023 21:28:57 +0100 Subject: [PATCH 114/141] chore: Reduce delta on ports to blockly-samples (#6886) * Reduce usage of obsolete .keyCode property. * Rename private properties/methods which violate eslint rules. * Use arrays of bound events rather than individual properties. * Improve typing info. * Also fix O(n^2) recursive performance issue in theme's getComponentStyle function. * And replace String(...) with '${...}' (smaller, faster). * .toString() is considered harmful. --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yaml | 2 +- core/block_animations.ts | 4 +- core/browser_events.ts | 5 +- core/bubble.ts | 28 +- core/comment.ts | 51 +-- core/component_manager.ts | 8 +- core/contextmenu_items.ts | 6 +- core/field.ts | 44 +-- core/field_angle.ts | 264 ++++++++-------- core/field_checkbox.ts | 30 +- core/field_colour.ts | 294 +++++++++--------- core/field_dropdown.ts | 55 ++-- core/field_image.ts | 36 +-- core/field_input.ts | 40 ++- core/field_label.ts | 31 +- core/field_label_serializable.ts | 11 +- core/field_multilineinput.ts | 80 ++--- core/field_number.ts | 49 ++- core/field_textinput.ts | 22 +- core/field_variable.ts | 54 ++-- core/flyout_base.ts | 46 +-- core/flyout_button.ts | 14 +- core/generator.ts | 2 +- core/gesture.ts | 44 +-- core/grid.ts | 18 +- core/keyboard_nav/ast_node.ts | 4 +- core/menu.ts | 19 +- core/registry.ts | 19 +- core/renderers/zelos/marker_svg.ts | 4 +- core/scrollbar.ts | 4 +- core/shortcut_registry.ts | 6 +- core/theme.ts | 12 +- core/toolbox/category.ts | 10 +- core/toolbox/toolbox.ts | 19 +- core/trashcan.ts | 2 +- core/utils/colour.ts | 2 +- core/utils/dom.ts | 2 +- core/utils/parsing.ts | 2 +- core/workspace_comment.ts | 8 +- core/workspace_comment_svg.ts | 17 +- core/workspace_svg.ts | 4 +- core/xml.ts | 10 +- core/zoom_controls.ts | 42 +-- demos/blockfactory/analytics.js | 3 +- generators/javascript/lists.js | 4 +- scripts/gulpfiles/test_tasks.js | 6 +- tests/generators/golden/generated.js | 4 +- tests/mocha/block_test.js | 12 +- tests/mocha/blocks/procedures_test.js | 46 +-- tests/mocha/field_angle_test.js | 46 +-- tests/mocha/field_colour_test.js | 8 +- tests/mocha/toolbox_test.js | 22 +- tests/mocha/variable_map_test.js | 22 +- tests/mocha/webdriver.js | 2 +- .../src/field/different_user_input.ts | 2 +- 56 files changed, 756 insertions(+), 847 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 1b3af57bd..c0097d770 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -5,7 +5,7 @@ body: - type: markdown attributes: value: > - Thank you for taking the time to fill out a bug report! + Thank you for taking the time to fill out a bug report! If you have a question about how to use Blockly in your application, please ask on the [forum](https://groups.google.com/forum/#!forum/blockly) instead of filing an issue. - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index b5c17620f..f64640789 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -6,7 +6,7 @@ body: - type: markdown attributes: value: > - Thank you for taking the time to fill out a feature request! + Thank you for taking the time to fill out a feature request! If you have a question about how to use Blockly in your application, please ask on the [forum](https://groups.google.com/forum/#!forum/blockly) instead of filing an issue. - type: checkboxes diff --git a/core/block_animations.ts b/core/block_animations.ts index d9d0c5bef..9378498a9 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -133,8 +133,8 @@ function connectionUiStep(ripple: SVGElement, start: Date, scale: number) { if (percent > 1) { dom.removeNode(ripple); } else { - ripple.setAttribute('r', (percent * 25 * scale).toString()); - ripple.style.opacity = (1 - percent).toString(); + ripple.setAttribute('r', String(percent * 25 * scale)); + ripple.style.opacity = String(1 - percent); disconnectPid = setTimeout(connectionUiStep, 10, ripple, start, scale); } } diff --git a/core/browser_events.ts b/core/browser_events.ts index c87655bda..2d389415a 100644 --- a/core/browser_events.ts +++ b/core/browser_events.ts @@ -145,10 +145,7 @@ export function unbind(bindData: Data): (e: Event) => void { // should only pass Data from bind or conditionalBind. const callback = bindData[bindData.length - 1][2]; while (bindData.length) { - const bindDatum = bindData.pop(); - const node = bindDatum![0]; - const name = bindDatum![1]; - const func = bindDatum![2]; + const [node, name, func] = bindData.pop()!; node.removeEventListener(name, func, false); } return callback; diff --git a/core/bubble.ts b/core/bubble.ts index 5036b4b25..c8fa2b0f3 100644 --- a/core/bubble.ts +++ b/core/bubble.ts @@ -218,27 +218,26 @@ export class Bubble implements IBubble { 'blocklyResizeSE', }, this.bubbleGroup); - const resizeSize = 2 * Bubble.BORDER_WIDTH; + const size = 2 * Bubble.BORDER_WIDTH; dom.createSvgElement( - Svg.POLYGON, - {'points': '0,x x,x x,0'.replace(/x/g, resizeSize.toString())}, + Svg.POLYGON, {'points': `0,${size} ${size},${size} ${size},0`}, this.resizeGroup); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', - 'x1': resizeSize / 3, - 'y1': resizeSize - 1, - 'x2': resizeSize - 1, - 'y2': resizeSize / 3, + 'x1': size / 3, + 'y1': size - 1, + 'x2': size - 1, + 'y2': size / 3, }, this.resizeGroup); dom.createSvgElement( Svg.LINE, { 'class': 'blocklyResizeLine', - 'x1': resizeSize * 2 / 3, - 'y1': resizeSize - 1, - 'x2': resizeSize - 1, - 'y2': resizeSize * 2 / 3, + 'x1': size * 2 / 3, + 'y1': size - 1, + 'x2': size - 1, + 'y2': size * 2 / 3, }, this.resizeGroup); } else { @@ -660,8 +659,8 @@ export class Bubble implements IBubble { height = Math.max(height, doubleBorderWidth + 20); this.width = width; this.height = height; - this.bubbleBack?.setAttribute('width', width.toString()); - this.bubbleBack?.setAttribute('height', height.toString()); + this.bubbleBack?.setAttribute('width', `${width}`); + this.bubbleBack?.setAttribute('height', `${height}`); if (this.resizeGroup) { if (this.workspace_.RTL) { // Mirror the resize group. @@ -901,8 +900,7 @@ export class Bubble implements IBubble { textElement = paragraphElement.childNodes[i] as SVGTSpanElement; i++) { textElement.setAttribute('text-anchor', 'end'); - textElement.setAttribute( - 'x', (maxWidth + Bubble.BORDER_WIDTH).toString()); + textElement.setAttribute('x', String(maxWidth + Bubble.BORDER_WIDTH)); } } return bubble; diff --git a/core/comment.ts b/core/comment.ts index 3dc4e31ef..b60d7547e 100644 --- a/core/comment.ts +++ b/core/comment.ts @@ -42,17 +42,12 @@ export class Comment extends Icon { */ private cachedText: string|null = ''; - /** Mouse up event data. */ - private onMouseUpWrapper: browserEvents.Data|null = null; - - /** Wheel event data. */ - private onWheelWrapper: browserEvents.Data|null = null; - - /** Change event data. */ - private onChangeWrapper: browserEvents.Data|null = null; - - /** Input event data. */ - private onInputWrapper: browserEvents.Data|null = null; + /** + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. + */ + private boundEvents: browserEvents.Data[] = []; /** * The SVG element that contains the text edit area, or null if not created. @@ -147,14 +142,14 @@ export class Comment extends Icon { body.appendChild(textarea); this.foreignObject!.appendChild(body); - this.onMouseUpWrapper = browserEvents.conditionalBind( - textarea, 'focus', this, this.startEdit, true); + this.boundEvents.push(browserEvents.conditionalBind( + textarea, 'focus', this, this.startEdit, true)); // Don't zoom with mousewheel. - this.onWheelWrapper = browserEvents.conditionalBind( + this.boundEvents.push(browserEvents.conditionalBind( textarea, 'wheel', this, function(e: Event) { e.stopPropagation(); - }); - this.onChangeWrapper = browserEvents.conditionalBind( + })); + this.boundEvents.push(browserEvents.conditionalBind( textarea, 'change', this, /** * @param _e Unused event parameter. @@ -165,15 +160,15 @@ export class Comment extends Icon { this.getBlock(), 'comment', null, this.cachedText, this.model.text)); } - }); - this.onInputWrapper = browserEvents.conditionalBind( + })); + this.boundEvents.push(browserEvents.conditionalBind( textarea, 'input', this, /** * @param _e Unused event parameter. */ function(this: Comment, _e: Event) { this.model.text = textarea.value; - }); + })); setTimeout(textarea.focus.bind(textarea), 0); @@ -277,22 +272,10 @@ export class Comment extends Icon { * Dispose of the bubble. */ private disposeBubble() { - if (this.onMouseUpWrapper) { - browserEvents.unbind(this.onMouseUpWrapper); - this.onMouseUpWrapper = null; - } - if (this.onWheelWrapper) { - browserEvents.unbind(this.onWheelWrapper); - this.onWheelWrapper = null; - } - if (this.onChangeWrapper) { - browserEvents.unbind(this.onChangeWrapper); - this.onChangeWrapper = null; - } - if (this.onInputWrapper) { - browserEvents.unbind(this.onInputWrapper); - this.onInputWrapper = null; + for (const event of this.boundEvents) { + browserEvents.unbind(event); } + this.boundEvents.length = 0; if (this.bubble_) { this.bubble_.dispose(); this.bubble_ = null; diff --git a/core/component_manager.ts b/core/component_manager.ts index 426860a74..6b014baa4 100644 --- a/core/component_manager.ts +++ b/core/component_manager.ts @@ -118,7 +118,7 @@ export class ComponentManager { 'Plugin "' + id + 'already has capability "' + capability + '"'); return; } - capability = String(capability).toLowerCase(); + capability = `${capability}`.toLowerCase(); this.componentData.get(id)?.capabilities.push(capability); this.capabilityToComponentIds.get(capability)?.push(id); } @@ -141,7 +141,7 @@ export class ComponentManager { '" to remove'); return; } - capability = String(capability).toLowerCase(); + capability = `${capability}`.toLowerCase(); arrayUtils.removeElem(this.componentData.get(id)!.capabilities, capability); arrayUtils.removeElem(this.capabilityToComponentIds.get(capability)!, id); } @@ -154,7 +154,7 @@ export class ComponentManager { * @returns Whether the component has the capability. */ hasCapability(id: string, capability: string|Capability): boolean { - capability = String(capability).toLowerCase(); + capability = `${capability}`.toLowerCase(); return this.componentData.has(id) && this.componentData.get(id)!.capabilities.indexOf(capability) !== -1; } @@ -178,7 +178,7 @@ export class ComponentManager { */ getComponents( capability: string|Capability, sorted: boolean): T[] { - capability = String(capability).toLowerCase(); + capability = `${capability}`.toLowerCase(); const componentIds = this.capabilityToComponentIds.get(capability); if (!componentIds) { return []; diff --git a/core/contextmenu_items.ts b/core/contextmenu_items.ts index 706ba4fbe..667e0896f 100644 --- a/core/contextmenu_items.ts +++ b/core/contextmenu_items.ts @@ -261,10 +261,8 @@ export function registerDeleteAll() { const deletableBlocksLength = getDeletableBlocks_(scope.workspace).length; if (deletableBlocksLength === 1) { return Msg['DELETE_BLOCK']; - } else { - return Msg['DELETE_X_BLOCKS'].replace( - '%1', String(deletableBlocksLength)); } + return Msg['DELETE_X_BLOCKS'].replace('%1', `${deletableBlocksLength}`); }, preconditionFn(scope: Scope) { if (!scope.workspace) { @@ -489,7 +487,7 @@ export function registerDelete() { } return descendantCount === 1 ? Msg['DELETE_BLOCK'] : - Msg['DELETE_X_BLOCKS'].replace('%1', String(descendantCount)); + Msg['DELETE_X_BLOCKS'].replace('%1', `${descendantCount}`); }, preconditionFn(scope: Scope) { if (!scope.block!.isInFlyout && scope.block!.isDeletable()) { diff --git a/core/field.ts b/core/field.ts index 209dc59e3..0c163e038 100644 --- a/core/field.ts +++ b/core/field.ts @@ -203,16 +203,16 @@ export abstract class Field implements IASTNodeLocationSvg, * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by * subclasses that want to handle configuration and setting the field value * after their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a value & returns a validated value, or null to * abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * Refer to the individual field's documentation for a list of properties * this parameter supports. */ constructor( - value: T|Sentinel, opt_validator?: FieldValidator|null, - opt_config?: FieldConfig) { + value: T|Sentinel, validator?: FieldValidator|null, + config?: FieldConfig) { /** * A generic value possessed by the field. * Should generally be non-null, only null when the field is created. @@ -225,12 +225,12 @@ export abstract class Field implements IASTNodeLocationSvg, this.size_ = new Size(0, 0); if (Field.isSentinel(value)) return; - if (opt_config) { - this.configure_(opt_config); + if (config) { + this.configure_(config); } this.setValue(value); - if (opt_validator) { - this.setValidator(opt_validator); + if (validator) { + this.setValidator(validator); } } @@ -715,14 +715,14 @@ export abstract class Field implements IASTNodeLocationSvg, * Calls showEditor_ when the field is clicked if the field is clickable. * Do not override. * - * @param opt_e Optional mouse event that triggered the field to open, or + * @param e Optional mouse event that triggered the field to open, or * undefined if triggered programmatically. * @sealed * @internal */ - showEditor(opt_e?: Event) { + showEditor(e?: Event) { if (this.isClickable()) { - this.showEditor_(opt_e); + this.showEditor_(e); } } @@ -739,11 +739,11 @@ export abstract class Field implements IASTNodeLocationSvg, /** * Updates the size of the field based on the text. * - * @param opt_margin margin to use when positioning the text element. + * @param margin margin to use when positioning the text element. */ - protected updateSize_(opt_margin?: number) { + protected updateSize_(margin?: number) { const constants = this.getConstants(); - const xOffset = opt_margin !== undefined ? opt_margin : + const xOffset = margin !== undefined ? margin : this.borderRect_ ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING : 0; let totalWidth = xOffset * 2; @@ -783,17 +783,17 @@ export abstract class Field implements IASTNodeLocationSvg, this.textElement_.setAttribute( 'x', - `${ + String( this.getSourceBlock()?.RTL ? this.size_.width - contentWidth - xOffset : - xOffset}`); + xOffset)); this.textElement_.setAttribute( 'y', - `${ + String( constants!.FIELD_TEXT_BASELINE_CENTER ? halfHeight : halfHeight - constants!.FIELD_TEXT_HEIGHT / 2 + - constants!.FIELD_TEXT_BASELINE}`); + constants!.FIELD_TEXT_BASELINE)); } /** Position a field's border rect after a size change. */ @@ -801,12 +801,12 @@ export abstract class Field implements IASTNodeLocationSvg, if (!this.borderRect_) { return; } - this.borderRect_.setAttribute('width', `${this.size_.width}`); - this.borderRect_.setAttribute('height', `${this.size_.height}`); + this.borderRect_.setAttribute('width', String(this.size_.width)); + this.borderRect_.setAttribute('height', String(this.size_.height)); this.borderRect_.setAttribute( - 'rx', `${this.getConstants()!.FIELD_BORDER_RECT_RADIUS}`); + 'rx', String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS)); this.borderRect_.setAttribute( - 'ry', `${this.getConstants()!.FIELD_BORDER_RECT_RADIUS}`); + 'ry', String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS)); } /** diff --git a/core/field_angle.ts b/core/field_angle.ts index 971126cf9..c2f9318e7 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -20,7 +20,6 @@ import {Field, UnattachedFieldError} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {FieldInput, FieldInputConfig, FieldInputValidator} from './field_input.js'; import * as dom from './utils/dom.js'; -import {KeyCodes} from './utils/keycodes.js'; import * as math from './utils/math.js'; import type {Sentinel} from './utils/sentinel.js'; import {Svg} from './utils/svg.js'; @@ -31,15 +30,15 @@ import * as WidgetDiv from './widgetdiv.js'; * Class for an editable angle field. */ export class FieldAngle extends FieldInput { - /** - * The default amount to round angles to when using a mouse or keyboard nav - * input. Must be a positive integer to support keyboard navigation. - */ - static readonly ROUND = 15; - /** Half the width of protractor image. */ static readonly HALF = 100 / 2; + /** + * Radius of protractor circle. Slightly smaller than protractor size since + * otherwise SVG crops off half the border at the edges. + */ + static readonly RADIUS: number = FieldAngle.HALF - 1; + /** * Default property describing which direction makes an angle field's value * increase. Angle increases clockwise (true) or counterclockwise (false). @@ -60,84 +59,73 @@ export class FieldAngle extends FieldInput { static readonly WRAP = 360; /** - * Radius of protractor circle. Slightly smaller than protractor size since - * otherwise SVG crops off half the border at the edges. + * The default amount to round angles to when using a mouse or keyboard nav + * input. Must be a positive integer to support keyboard navigation. */ - static readonly RADIUS: number = FieldAngle.HALF - 1; + static readonly ROUND = 15; /** * Whether the angle should increase as the angle picker is moved clockwise * (true) or counterclockwise (false). */ - private clockwise_ = FieldAngle.CLOCKWISE; + private clockwise = FieldAngle.CLOCKWISE; /** * The offset of zero degrees (and all other angles). */ - private offset_ = FieldAngle.OFFSET; + private offset = FieldAngle.OFFSET; /** * The maximum angle to allow before wrapping. */ - private wrap_ = FieldAngle.WRAP; + private wrap = FieldAngle.WRAP; /** * The amount to round angles to when using a mouse or keyboard nav input. */ - private round_ = FieldAngle.ROUND; + private round = FieldAngle.ROUND; - /** The angle picker's SVG element. */ - private editor_: SVGSVGElement|null = null; + /** + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. + */ + private boundEvents: browserEvents.Data[] = []; - /** The angle picker's gauge path depending on the value. */ - gauge_: SVGPathElement|null = null; + /** Dynamic red line pointing at the value's angle. */ + private line: SVGLineElement|null = null; - /** The angle picker's line drawn representing the value's angle. */ - line_: SVGLineElement|null = null; + /** Dynamic pink area extending from 0 to the value's angle. */ + private gauge: SVGPathElement|null = null; /** The degree symbol for this field. */ protected symbol_: SVGTSpanElement|null = null; - /** Wrapper click event data. */ - private clickWrapper_: browserEvents.Data|null = null; - - /** Surface click event data. */ - private clickSurfaceWrapper_: browserEvents.Data|null = null; - - /** Surface mouse move event data. */ - private moveSurfaceWrapper_: browserEvents.Data|null = null; - /** - * Serializable fields are saved by the serializer, non-serializable fields - * are not. Editable fields should also be serializable. - */ - override SERIALIZABLE = true; - - /** - * @param opt_value The initial value of the field. Should cast to a number. + * @param value The initial value of the field. Should cast to a number. * Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup * (only used by subclasses that want to handle configuration and setting * the field value after their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a number & returns a validated number, or null * to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/angle#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|number|Sentinel, opt_validator?: FieldAngleValidator, - opt_config?: FieldAngleConfig) { + value?: string|number|Sentinel, validator?: FieldAngleValidator, + config?: FieldAngleConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } @@ -151,22 +139,22 @@ export class FieldAngle extends FieldInput { switch (config.mode) { case Mode.COMPASS: - this.clockwise_ = true; - this.offset_ = 90; + this.clockwise = true; + this.offset = 90; break; case Mode.PROTRACTOR: // This is the default mode, so we could do nothing. But just to // future-proof, we'll set it anyway. - this.clockwise_ = false; - this.offset_ = 0; + this.clockwise = false; + this.offset = 0; break; } // Allow individual settings to override the mode setting. - if (config.clockwise) this.clockwise_ = config.clockwise; - if (config.offset) this.offset_ = config.offset; - if (config.wrap) this.wrap_ = config.wrap; - if (config.round) this.round_ = config.round; + if (config.clockwise) this.clockwise = config.clockwise; + if (config.offset) this.offset = config.offset; + if (config.wrap) this.wrap = config.wrap; + if (config.round) this.round = config.round; } /** @@ -176,32 +164,32 @@ export class FieldAngle extends FieldInput { */ override initView() { super.initView(); - // Add the degree symbol to the left of the number, even in RTL (issue - // #2380) + // Add the degree symbol to the left of the number, + // even in RTL (issue #2380). this.symbol_ = dom.createSvgElement(Svg.TSPAN, {}); this.symbol_.appendChild(document.createTextNode('°')); this.getTextElement().appendChild(this.symbol_); } - /** Updates the graph when the field rerenders. */ + /** Updates the angle when the field rerenders. */ protected override render_() { super.render_(); - this.updateGraph_(); + this.updateGraph(); } /** * Create and show the angle field's editor. * - * @param opt_e Optional mouse event that triggered the field to open, or - * undefined if triggered programmatically. + * @param e Optional mouse event that triggered the field to open, + * or undefined if triggered programmatically. */ - protected override showEditor_(opt_e?: Event) { + protected override showEditor_(e?: Event) { // Mobile browsers have issues with in-line textareas (focus & keyboards). const noFocus = userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD; - super.showEditor_(opt_e, noFocus); + super.showEditor_(e, noFocus); - this.dropdownCreate_(); - dropDownDiv.getContentDiv().appendChild(this.editor_!); + const editor = this.dropdownCreate(); + dropDownDiv.getContentDiv().appendChild(editor); if (this.sourceBlock_ instanceof BlockSvg) { dropDownDiv.setColour( @@ -209,13 +197,17 @@ export class FieldAngle extends FieldInput { this.sourceBlock_.style.colourTertiary); } - dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this)); + dropDownDiv.showPositionedByField(this, this.dropdownDispose.bind(this)); - this.updateGraph_(); + this.updateGraph(); } - /** Create the angle dropdown editor. */ - private dropdownCreate_() { + /** + * Creates the angle dropdown editor. + * + * @returns The newly created slider. + */ + private dropdownCreate(): SVGSVGElement { const svg = dom.createSvgElement(Svg.SVG, { 'xmlns': dom.SVG_NS, 'xmlns:html': dom.HTML_NS, @@ -233,9 +225,9 @@ export class FieldAngle extends FieldInput { 'class': 'blocklyAngleCircle', }, svg); - this.gauge_ = + this.gauge = dom.createSvgElement(Svg.PATH, {'class': 'blocklyAngleGauge'}, svg); - this.line_ = dom.createSvgElement( + this.line = dom.createSvgElement( Svg.LINE, { 'x1': FieldAngle.HALF, 'y1': FieldAngle.HALF, @@ -261,38 +253,30 @@ export class FieldAngle extends FieldInput { // The angle picker is different from other fields in that it updates on // mousemove even if it's not in the middle of a drag. In future we may // change this behaviour. - this.clickWrapper_ = - browserEvents.conditionalBind(svg, 'click', this, this.hide_); + this.boundEvents.push( + browserEvents.conditionalBind(svg, 'click', this, this.hide)); // On touch devices, the picker's value is only updated with a drag. Add // a click handler on the drag surface to update the value if the surface // is clicked. - this.clickSurfaceWrapper_ = browserEvents.conditionalBind( - circle, 'pointerdown', this, this.onMouseMove_, true); - this.moveSurfaceWrapper_ = browserEvents.conditionalBind( - circle, 'pointermove', this, this.onMouseMove_, true); - this.editor_ = svg; + this.boundEvents.push(browserEvents.conditionalBind( + circle, 'pointerdown', this, this.onMouseMove_, true)); + this.boundEvents.push(browserEvents.conditionalBind( + circle, 'pointermove', this, this.onMouseMove_, true)); + return svg; } /** Disposes of events and DOM-references belonging to the angle editor. */ - private dropdownDispose_() { - if (this.clickWrapper_) { - browserEvents.unbind(this.clickWrapper_); - this.clickWrapper_ = null; + private dropdownDispose() { + for (const event of this.boundEvents) { + browserEvents.unbind(event); } - if (this.clickSurfaceWrapper_) { - browserEvents.unbind(this.clickSurfaceWrapper_); - this.clickSurfaceWrapper_ = null; - } - if (this.moveSurfaceWrapper_) { - browserEvents.unbind(this.moveSurfaceWrapper_); - this.moveSurfaceWrapper_ = null; - } - this.gauge_ = null; - this.line_ = null; + this.boundEvents.length = 0; + this.gauge = null; + this.line = null; } /** Hide the editor. */ - private hide_() { + private hide() { dropDownDiv.hideIfOwner(this); WidgetDiv.hide(); } @@ -304,7 +288,7 @@ export class FieldAngle extends FieldInput { */ protected onMouseMove_(e: PointerEvent) { // Calculate angle. - const bBox = this.gauge_!.ownerSVGElement!.getBoundingClientRect(); + const bBox = this.gauge!.ownerSVGElement!.getBoundingClientRect(); const dx = e.clientX - bBox.left - FieldAngle.HALF; const dy = e.clientY - bBox.top - FieldAngle.HALF; let angle = Math.atan(-dy / dx); @@ -321,13 +305,13 @@ export class FieldAngle extends FieldInput { } // Do offsetting. - if (this.clockwise_) { - angle = this.offset_ + 360 - angle; + if (this.clockwise) { + angle = this.offset + 360 - angle; } else { - angle = 360 - (this.offset_ - angle); + angle = 360 - (this.offset - angle); } - this.displayMouseOrKeyboardValue_(angle); + this.displayMouseOrKeyboardValue(angle); } /** @@ -337,31 +321,31 @@ export class FieldAngle extends FieldInput { * * @param angle New angle. */ - private displayMouseOrKeyboardValue_(angle: number) { - if (this.round_) { - angle = Math.round(angle / this.round_) * this.round_; + private displayMouseOrKeyboardValue(angle: number) { + if (this.round) { + angle = Math.round(angle / this.round) * this.round; } - angle = this.wrapValue_(angle); + angle = this.wrapValue(angle); if (angle !== this.value_) { this.setEditorValue_(angle); } } /** Redraw the graph with the current angle. */ - private updateGraph_() { - if (!this.gauge_) { + private updateGraph() { + if (!this.gauge || !this.line) { return; } // Always display the input (i.e. getText) even if it is invalid. - let angleDegrees = Number(this.getText()) + this.offset_; + let angleDegrees = Number(this.getText()) + this.offset; angleDegrees %= 360; let angleRadians = math.toRadians(angleDegrees); const path = ['M ', FieldAngle.HALF, ',', FieldAngle.HALF]; let x2 = FieldAngle.HALF; let y2 = FieldAngle.HALF; if (!isNaN(angleRadians)) { - const clockwiseFlag = Number(this.clockwise_); - const angle1 = math.toRadians(this.offset_); + const clockwiseFlag = Number(this.clockwise); + const angle1 = math.toRadians(this.offset); const x1 = Math.cos(angle1) * FieldAngle.RADIUS; const y1 = Math.sin(angle1) * -FieldAngle.RADIUS; if (clockwiseFlag) { @@ -379,9 +363,9 @@ export class FieldAngle extends FieldInput { ' l ', x1, ',', y1, ' A ', FieldAngle.RADIUS, ',', FieldAngle.RADIUS, ' 0 ', largeFlag, ' ', clockwiseFlag, ' ', x2, ',', y2, ' z'); } - this.gauge_.setAttribute('d', path.join('')); - this.line_?.setAttribute('x2', `${x2}`); - this.line_?.setAttribute('y2', `${y2}`); + this.gauge.setAttribute('d', path.join('')); + this.line.setAttribute('x2', `${x2}`); + this.line.setAttribute('y2', `${y2}`); } /** @@ -396,23 +380,28 @@ export class FieldAngle extends FieldInput { throw new UnattachedFieldError(); } - let multiplier; - if (e.keyCode === KeyCodes.LEFT) { - // decrement (increment in RTL) - multiplier = block.RTL ? 1 : -1; - } else if (e.keyCode === KeyCodes.RIGHT) { - // increment (decrement in RTL) - multiplier = block.RTL ? -1 : 1; - } else if (e.keyCode === KeyCodes.DOWN) { - // decrement - multiplier = -1; - } else if (e.keyCode === KeyCodes.UP) { - // increment - multiplier = 1; + let multiplier = 0; + switch (e.key) { + case 'ArrowLeft': + // decrement (increment in RTL) + multiplier = block.RTL ? 1 : -1; + break; + case 'ArrowRight': + // increment (decrement in RTL) + multiplier = block.RTL ? -1 : 1; + break; + case 'ArrowDown': + // decrement + multiplier = -1; + break; + case 'ArrowUp': + // increment + multiplier = 1; + break; } if (multiplier) { const value = this.getValue() as number; - this.displayMouseOrKeyboardValue_(value + multiplier * this.round_); + this.displayMouseOrKeyboardValue(value + multiplier * this.round); e.preventDefault(); e.stopPropagation(); } @@ -421,15 +410,15 @@ export class FieldAngle extends FieldInput { /** * Ensure that the input value is a valid angle. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid angle, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: any): number|null { - const value = Number(opt_newValue); + protected override doClassValidation_(newValue?: any): number|null { + const value = Number(newValue); if (isNaN(value) || !isFinite(value)) { return null; } - return this.wrapValue_(value); + return this.wrapValue(value); } /** @@ -438,12 +427,12 @@ export class FieldAngle extends FieldInput { * @param value The value to wrap. * @returns The wrapped value. */ - private wrapValue_(value: number): number { + private wrapValue(value: number): number { value %= 360; if (value < 0) { value += 360; } - if (value > this.wrap_) { + if (value > this.wrap) { value -= 360; } return value; @@ -464,13 +453,20 @@ export class FieldAngle extends FieldInput { } } -/** CSS for angle field. See css.js for use. */ +fieldRegistry.register('field_angle', FieldAngle); + +FieldAngle.prototype.DEFAULT_VALUE = 0; + + +/** + * CSS for angle field. + */ Css.register(` .blocklyAngleCircle { stroke: #444; stroke-width: 1; fill: #ddd; - fill-opacity: .8; + fill-opacity: 0.8; } .blocklyAngleMarks { @@ -480,7 +476,7 @@ Css.register(` .blocklyAngleGauge { fill: #f88; - fill-opacity: .8; + fill-opacity: 0.8; pointer-events: none; } @@ -492,10 +488,6 @@ Css.register(` } `); -fieldRegistry.register('field_angle', FieldAngle); - -FieldAngle.prototype.DEFAULT_VALUE = 0; - /** * The two main modes of the angle field. * Compass specifies: diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index f884bc47c..31cc50134 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -49,22 +49,22 @@ export class FieldCheckbox extends Field { override value_: boolean|null = this.value_; /** - * @param opt_value The initial value of the field. Should either be 'TRUE', + * @param value The initial value of the field. Should either be 'TRUE', * 'FALSE' or a boolean. Defaults to 'FALSE'. Also accepts * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses * that want to handle configuration and setting the field value after * their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a value ('TRUE' or 'FALSE') & returns a * validated value ('TRUE' or 'FALSE'), or null to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: CheckboxBool|Sentinel, opt_validator?: FieldCheckboxValidator, - opt_config?: FieldCheckboxConfig) { + value?: CheckboxBool|Sentinel, validator?: FieldCheckboxValidator, + config?: FieldCheckboxConfig) { super(Field.SKIP_SETUP); /** @@ -73,13 +73,13 @@ export class FieldCheckbox extends Field { */ this.checkChar_ = FieldCheckbox.CHECK_CHAR; - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } @@ -150,15 +150,15 @@ export class FieldCheckbox extends Field { /** * Ensure that the input value is valid ('TRUE' or 'FALSE'). * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid value ('TRUE' or 'FALSE), or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): + protected override doClassValidation_(newValue?: AnyDuringMigration): BoolString|null { - if (opt_newValue === true || opt_newValue === 'TRUE') { + if (newValue === true || newValue === 'TRUE') { return 'TRUE'; } - if (opt_newValue === false || opt_newValue === 'FALSE') { + if (newValue === false || newValue === 'FALSE') { return 'FALSE'; } return null; diff --git a/core/field_colour.ts b/core/field_colour.ts index cc703a8ed..63fd1a752 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -25,7 +25,6 @@ import * as fieldRegistry from './field_registry.js'; import * as aria from './utils/aria.js'; import * as colour from './utils/colour.js'; import * as idGenerator from './utils/idgenerator.js'; -import {KeyCodes} from './utils/keycodes.js'; import type {Sentinel} from './utils/sentinel.js'; import {Size} from './utils/size.js'; @@ -76,25 +75,17 @@ export class FieldColour extends Field { static COLUMNS = 7; /** The field's colour picker element. */ - private picker_: HTMLElement|null = null; + private picker: HTMLElement|null = null; /** Index of the currently highlighted element. */ - private highlightedIndex_: number|null = null; + private highlightedIndex: number|null = null; - /** Mouse click event data. */ - private onClickWrapper_: browserEvents.Data|null = null; - - /** Mouse move event data. */ - private onMouseMoveWrapper_: browserEvents.Data|null = null; - - /** Mouse enter event data. */ - private onMouseEnterWrapper_: browserEvents.Data|null = null; - - /** Mouse leave event data. */ - private onMouseLeaveWrapper_: browserEvents.Data|null = null; - - /** Key down event data. */ - private onKeyDownWrapper_: browserEvents.Data|null = null; + /** + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. + */ + private boundEvents: browserEvents.Data[] = []; /** * Serializable fields are saved by the serializer, non-serializable fields @@ -113,46 +104,46 @@ export class FieldColour extends Field { protected override isDirty_ = false; /** Array of colours used by this field. If null, use the global list. */ - private colours_: string[]|null = null; + private colours: string[]|null = null; /** * Array of colour tooltips used by this field. If null, use the global * list. */ - private titles_: string[]|null = null; + private titles: string[]|null = null; /** * Number of colour columns used by this field. If 0, use the global * setting. By default use the global constants for columns. */ - private columns_ = 0; + private columns = 0; /** - * @param opt_value The initial value of the field. Should be in '#rrggbb' + * @param value The initial value of the field. Should be in '#rrggbb' * format. Defaults to the first value in the default colour array. Also * accepts Field.SKIP_SETUP if you wish to skip setup (only used by * subclasses that want to handle configuration and setting the field * value after their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a colour string & returns a validated colour - * string ('#rrggbb' format), or null to abort the change.Blockly. - * @param opt_config A map of options used to configure the field. + * string ('#rrggbb' format), or null to abort the change. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|Sentinel, opt_validator?: FieldColourValidator, - opt_config?: FieldColourConfig) { + value?: string|Sentinel, validator?: FieldColourValidator, + config?: FieldColourConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } @@ -163,9 +154,9 @@ export class FieldColour extends Field { */ protected override configure_(config: FieldColourConfig) { super.configure_(config); - if (config.colourOptions) this.colours_ = config.colourOptions; - if (config.colourTitles) this.titles_ = config.colourTitles; - if (config.columns) this.columns_ = config.columns; + if (config.colourOptions) this.colours = config.colourOptions; + if (config.colourTitles) this.titles = config.colourTitles; + if (config.columns) this.columns = config.columns; } /** @@ -185,6 +176,11 @@ export class FieldColour extends Field { } } + /** + * Updates text field to match the colour/style of the block. + * + * @internal + */ override applyColour() { if (!this.getConstants()!.FIELD_COLOUR_FULL_BLOCK) { if (this.borderRect_) { @@ -200,14 +196,14 @@ export class FieldColour extends Field { /** * Ensure that the input value is a valid colour. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid colour, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: any): string|null { - if (typeof opt_newValue !== 'string') { + protected override doClassValidation_(newValue?: any): string|null { + if (typeof newValue !== 'string') { return null; } - return colour.parse(opt_newValue); + return colour.parse(newValue); } /** @@ -247,14 +243,14 @@ export class FieldColour extends Field { * * @param colours Array of colours for this block, or null to use default * (FieldColour.COLOURS). - * @param opt_titles Optional array of colour tooltips, or null to use default + * @param titles Optional array of colour tooltips, or null to use default * (FieldColour.TITLES). * @returns Returns itself (for method chaining). */ - setColours(colours: string[], opt_titles?: string[]): FieldColour { - this.colours_ = colours; - if (opt_titles) { - this.titles_ = opt_titles; + setColours(colours: string[], titles?: string[]): FieldColour { + this.colours = colours; + if (titles) { + this.titles = titles; } return this; } @@ -267,19 +263,19 @@ export class FieldColour extends Field { * @returns Returns itself (for method chaining). */ setColumns(columns: number): FieldColour { - this.columns_ = columns; + this.columns = columns; return this; } /** Create and show the colour field's editor. */ protected override showEditor_() { - this.dropdownCreate_(); - dropDownDiv.getContentDiv().appendChild(this.picker_!); + this.dropdownCreate(); + dropDownDiv.getContentDiv().appendChild(this.picker!); - dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this)); + dropDownDiv.showPositionedByField(this, this.dropdownDispose.bind(this)); // Focus so we can start receiving keyboard events. - this.picker_!.focus({preventScroll: true}); + this.picker!.focus({preventScroll: true}); } /** @@ -287,7 +283,7 @@ export class FieldColour extends Field { * * @param e Mouse event. */ - private onClick_(e: PointerEvent) { + private onClick(e: PointerEvent) { const cell = e.target as Element; const colour = cell && cell.getAttribute('data-colour'); if (colour !== null) { @@ -302,31 +298,35 @@ export class FieldColour extends Field { * * @param e Keyboard event. */ - private onKeyDown_(e: KeyboardEvent) { - let handled = false; - if (e.keyCode === KeyCodes.UP) { - this.moveHighlightBy_(0, -1); - handled = true; - } else if (e.keyCode === KeyCodes.DOWN) { - this.moveHighlightBy_(0, 1); - handled = true; - } else if (e.keyCode === KeyCodes.LEFT) { - this.moveHighlightBy_(-1, 0); - handled = true; - } else if (e.keyCode === KeyCodes.RIGHT) { - this.moveHighlightBy_(1, 0); - handled = true; - } else if (e.keyCode === KeyCodes.ENTER) { - // Select the highlighted colour. - const highlighted = this.getHighlighted_(); - if (highlighted) { - const colour = highlighted && highlighted.getAttribute('data-colour'); - if (colour !== null) { - this.setValue(colour); + private onKeyDown(e: KeyboardEvent) { + let handled = true; + let highlighted: HTMLElement|null; + switch (e.key) { + case 'ArrowUp': + this.moveHighlightBy(0, -1); + break; + case 'ArrowDown': + this.moveHighlightBy(0, 1); + break; + case 'ArrowLeft': + this.moveHighlightBy(-1, 0); + break; + case 'ArrowRight': + this.moveHighlightBy(1, 0); + break; + case 'Enter': + // Select the highlighted colour. + highlighted = this.getHighlighted(); + if (highlighted) { + const colour = highlighted.getAttribute('data-colour'); + if (colour !== null) { + this.setValue(colour); + } } - } - dropDownDiv.hideWithoutAnimation(); - handled = true; + dropDownDiv.hideWithoutAnimation(); + break; + default: + handled = false; } if (handled) { e.stopPropagation(); @@ -336,22 +336,22 @@ export class FieldColour extends Field { /** * Move the currently highlighted position by dx and dy. * - * @param dx Change of x - * @param dy Change of y + * @param dx Change of x. + * @param dy Change of y. */ - private moveHighlightBy_(dx: number, dy: number) { - if (!this.highlightedIndex_) { + private moveHighlightBy(dx: number, dy: number) { + if (!this.highlightedIndex) { return; } - const colours = this.colours_ || FieldColour.COLOURS; - const columns = this.columns_ || FieldColour.COLUMNS; + const colours = this.colours || FieldColour.COLOURS; + const columns = this.columns || FieldColour.COLUMNS; - // Get the current x and y coordinates - let x = this.highlightedIndex_ % columns; - let y = Math.floor(this.highlightedIndex_ / columns); + // Get the current x and y coordinates. + let x = this.highlightedIndex % columns; + let y = Math.floor(this.highlightedIndex / columns); - // Add the offset + // Add the offset. x += dx; y += dy; @@ -386,9 +386,9 @@ export class FieldColour extends Field { } // Move the highlight to the new coordinates. - const cell = this.picker_!.childNodes[y].childNodes[x] as Element; + const cell = this.picker!.childNodes[y].childNodes[x] as Element; const index = y * columns + x; - this.setHighlightedCell_(cell, index); + this.setHighlightedCell(cell, index); } /** @@ -396,26 +396,26 @@ export class FieldColour extends Field { * * @param e Mouse event. */ - private onMouseMove_(e: PointerEvent) { + private onMouseMove(e: PointerEvent) { const cell = e.target as Element; const index = cell && Number(cell.getAttribute('data-index')); - if (index !== null && index !== this.highlightedIndex_) { - this.setHighlightedCell_(cell, index); + if (index !== null && index !== this.highlightedIndex) { + this.setHighlightedCell(cell, index); } } /** Handle a mouse enter event. Focus the picker. */ - private onMouseEnter_() { - this.picker_?.focus({preventScroll: true}); + private onMouseEnter() { + this.picker?.focus({preventScroll: true}); } /** * Handle a mouse leave event. Blur the picker and unhighlight * the currently highlighted colour. */ - private onMouseLeave_() { - this.picker_?.blur(); - const highlighted = this.getHighlighted_(); + private onMouseLeave() { + this.picker?.blur(); + const highlighted = this.getHighlighted(); if (highlighted) { dom.removeClass(highlighted, 'blocklyColourHighlighted'); } @@ -426,54 +426,53 @@ export class FieldColour extends Field { * * @returns Highlighted item (null if none). */ - private getHighlighted_(): HTMLElement|null { - if (!this.highlightedIndex_) { + private getHighlighted(): HTMLElement|null { + if (!this.highlightedIndex) { return null; } - const columns = this.columns_ || FieldColour.COLUMNS; - const x = this.highlightedIndex_ % columns; - const y = Math.floor(this.highlightedIndex_ / columns); - const row = this.picker_!.childNodes[y]; + const columns = this.columns || FieldColour.COLUMNS; + const x = this.highlightedIndex % columns; + const y = Math.floor(this.highlightedIndex / columns); + const row = this.picker!.childNodes[y]; if (!row) { return null; } - const col = row.childNodes[x] as HTMLElement; - return col; + return row.childNodes[x] as HTMLElement; } /** * Update the currently highlighted cell. * - * @param cell the new cell to highlight - * @param index the index of the new cell + * @param cell The new cell to highlight. + * @param index The index of the new cell. */ - private setHighlightedCell_(cell: Element, index: number) { + private setHighlightedCell(cell: Element, index: number) { // Unhighlight the current item. - const highlighted = this.getHighlighted_(); + const highlighted = this.getHighlighted(); if (highlighted) { dom.removeClass(highlighted, 'blocklyColourHighlighted'); } // Highlight new item. dom.addClass(cell, 'blocklyColourHighlighted'); // Set new highlighted index. - this.highlightedIndex_ = index; + this.highlightedIndex = index; // Update accessibility roles. const cellId = cell.getAttribute('id'); - if (cellId && this.picker_) { - aria.setState(this.picker_, aria.State.ACTIVEDESCENDANT, cellId); + if (cellId && this.picker) { + aria.setState(this.picker, aria.State.ACTIVEDESCENDANT, cellId); } } /** Create a colour picker dropdown editor. */ - private dropdownCreate_() { - const columns = this.columns_ || FieldColour.COLUMNS; - const colours = this.colours_ || FieldColour.COLOURS; - const titles = this.titles_ || FieldColour.TITLES; + private dropdownCreate() { + const columns = this.columns || FieldColour.COLUMNS; + const colours = this.colours || FieldColour.COLOURS; + const titles = this.titles || FieldColour.TITLES; const selectedColour = this.getValue(); // Create the palette. - const table = (document.createElement('table')); + const table = document.createElement('table'); table.className = 'blocklyColourTable'; table.tabIndex = 0; table.dir = 'ltr'; @@ -495,56 +494,40 @@ export class FieldColour extends Field { cell.setAttribute('data-colour', colours[i]); cell.title = titles[i] || colours[i]; cell.id = idGenerator.getNextUniqueId(); - cell.setAttribute('data-index', String(i)); + cell.setAttribute('data-index', `${i}`); aria.setRole(cell, aria.Role.GRIDCELL); aria.setState(cell, aria.State.LABEL, colours[i]); aria.setState(cell, aria.State.SELECTED, colours[i] === selectedColour); cell.style.backgroundColor = colours[i]; if (colours[i] === selectedColour) { cell.className = 'blocklyColourSelected'; - this.highlightedIndex_ = i; + this.highlightedIndex = i; } } // Configure event handler on the table to listen for any event in a cell. - this.onClickWrapper_ = browserEvents.conditionalBind( - table, 'pointerdown', this, this.onClick_, true); - this.onMouseMoveWrapper_ = browserEvents.conditionalBind( - table, 'pointermove', this, this.onMouseMove_, true); - this.onMouseEnterWrapper_ = browserEvents.conditionalBind( - table, 'pointerenter', this, this.onMouseEnter_, true); - this.onMouseLeaveWrapper_ = browserEvents.conditionalBind( - table, 'pointerleave', this, this.onMouseLeave_, true); - this.onKeyDownWrapper_ = - browserEvents.conditionalBind(table, 'keydown', this, this.onKeyDown_); + this.boundEvents.push(browserEvents.conditionalBind( + table, 'pointerdown', this, this.onClick, true)); + this.boundEvents.push(browserEvents.conditionalBind( + table, 'pointermove', this, this.onMouseMove, true)); + this.boundEvents.push(browserEvents.conditionalBind( + table, 'pointerenter', this, this.onMouseEnter, true)); + this.boundEvents.push(browserEvents.conditionalBind( + table, 'pointerleave', this, this.onMouseLeave, true)); + this.boundEvents.push(browserEvents.conditionalBind( + table, 'keydown', this, this.onKeyDown, false)); - this.picker_ = table; + this.picker = table; } /** Disposes of events and DOM-references belonging to the colour editor. */ - private dropdownDispose_() { - if (this.onClickWrapper_) { - browserEvents.unbind(this.onClickWrapper_); - this.onClickWrapper_ = null; + private dropdownDispose() { + for (const event of this.boundEvents) { + browserEvents.unbind(event); } - if (this.onMouseMoveWrapper_) { - browserEvents.unbind(this.onMouseMoveWrapper_); - this.onMouseMoveWrapper_ = null; - } - if (this.onMouseEnterWrapper_) { - browserEvents.unbind(this.onMouseEnterWrapper_); - this.onMouseEnterWrapper_ = null; - } - if (this.onMouseLeaveWrapper_) { - browserEvents.unbind(this.onMouseLeaveWrapper_); - this.onMouseLeaveWrapper_ = null; - } - if (this.onKeyDownWrapper_) { - browserEvents.unbind(this.onKeyDownWrapper_); - this.onKeyDownWrapper_ = null; - } - this.picker_ = null; - this.highlightedIndex_ = null; + this.boundEvents.length = 0; + this.picker = null; + this.highlightedIndex = null; } /** @@ -565,7 +548,12 @@ export class FieldColour extends Field { /** The default value for this field. */ FieldColour.prototype.DEFAULT_VALUE = FieldColour.COLOURS[0]; -/** CSS for colour picker. See css.js for use. */ +fieldRegistry.register('field_colour', FieldColour); + + +/** + * CSS for colour picker. + */ Css.register(` .blocklyColourTable { border-collapse: collapse; @@ -575,7 +563,7 @@ Css.register(` } .blocklyColourTable>tr>td { - border: .5px solid #888; + border: 0.5px solid #888; box-sizing: border-box; cursor: pointer; display: inline-block; @@ -586,7 +574,7 @@ Css.register(` .blocklyColourTable>tr>td.blocklyColourHighlighted { border-color: #eee; - box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3); + box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3); position: relative; } @@ -597,8 +585,6 @@ Css.register(` } `); -fieldRegistry.register('field_colour', FieldColour); - /** * Config options for the colour field. */ diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 04d9d7580..90cd9117a 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -97,11 +97,11 @@ export class FieldDropdown extends Field { * if you wish to skip setup (only used by subclasses that want to handle * configuration and setting the field value after their own constructors * have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a language-neutral dropdown option & returns a * validated language-neutral dropdown option, or null to abort the * change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/dropdown#creation} * for a list of properties this parameter supports. @@ -109,14 +109,14 @@ export class FieldDropdown extends Field { */ constructor( menuGenerator: MenuGenerator, - opt_validator?: FieldDropdownValidator, - opt_config?: FieldDropdownConfig, + validator?: FieldDropdownValidator, + config?: FieldDropdownConfig, ); constructor(menuGenerator: Sentinel); constructor( menuGenerator: MenuGenerator|Sentinel, - opt_validator?: FieldDropdownValidator, - opt_config?: FieldDropdownConfig, + validator?: FieldDropdownValidator, + config?: FieldDropdownConfig, ) { super(Field.SKIP_SETUP); @@ -139,12 +139,12 @@ export class FieldDropdown extends Field { */ this.selectedOption_ = this.getOptions(false)[0]; - if (opt_config) { - this.configure_(opt_config); + if (config) { + this.configure_(config); } this.setValue(this.selectedOption_[1]); - if (opt_validator) { - this.setValidator(opt_validator); + if (validator) { + this.setValidator(validator); } } @@ -244,17 +244,17 @@ export class FieldDropdown extends Field { /** * Create a dropdown menu under the text. * - * @param opt_e Optional mouse event that triggered the field to open, or + * @param e Optional mouse event that triggered the field to open, or * undefined if triggered programmatically. */ - protected override showEditor_(opt_e?: MouseEvent) { + protected override showEditor_(e?: MouseEvent) { const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); } this.dropdownCreate_(); - if (opt_e && typeof opt_e.clientX === 'number') { - this.menu_!.openingCoords = new Coordinate(opt_e.clientX, opt_e.clientY); + if (e && typeof e.clientX === 'number') { + this.menu_!.openingCoords = new Coordinate(e.clientX, e.clientY); } else { this.menu_!.openingCoords = null; } @@ -368,20 +368,20 @@ export class FieldDropdown extends Field { /** * Return a list of the options for this dropdown. * - * @param opt_useCache For dynamic options, whether or not to use the cached + * @param useCache For dynamic options, whether or not to use the cached * options or to re-generate them. * @returns A non-empty array of option tuples: * (human-readable text or image, language-neutral name). * @throws {TypeError} If generated options are incorrectly structured. */ - getOptions(opt_useCache?: boolean): MenuOption[] { + getOptions(useCache?: boolean): MenuOption[] { if (!this.menuGenerator_) { // A subclass improperly skipped setup without defining the menu // generator. throw TypeError('A menu generator was never defined.'); } if (Array.isArray(this.menuGenerator_)) return this.menuGenerator_; - if (opt_useCache && this.generatedOptions_) return this.generatedOptions_; + if (useCache && this.generatedOptions_) return this.generatedOptions_; this.generatedOptions_ = this.menuGenerator_(); validateOptions(this.generatedOptions_); @@ -391,23 +391,23 @@ export class FieldDropdown extends Field { /** * Ensure that the input value is a valid language-neutral option. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid language-neutral option, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: string): string|null { + protected override doClassValidation_(newValue?: string): string|null { const options = this.getOptions(true); - const isValueValid = options.some((option) => option[1] === opt_newValue); + const isValueValid = options.some((option) => option[1] === newValue); if (!isValueValid) { if (this.sourceBlock_) { console.warn( 'Cannot set the dropdown\'s value to an unavailable option.' + ' Block type: ' + this.sourceBlock_.type + - ', Field name: ' + this.name + ', Value: ' + opt_newValue); + ', Field name: ' + this.name + ', Value: ' + newValue); } return null; } - return opt_newValue as string; + return newValue as string; } /** @@ -481,8 +481,8 @@ export class FieldDropdown extends Field { this.imageElement_!.style.display = ''; this.imageElement_!.setAttributeNS( dom.XLINK_NS, 'xlink:href', imageJson.src); - this.imageElement_!.setAttribute('height', `${imageJson.height}`); - this.imageElement_!.setAttribute('width', `${imageJson.width}`); + this.imageElement_!.setAttribute('height', String(imageJson.height)); + this.imageElement_!.setAttribute('width', String(imageJson.width)); const imageHeight = Number(imageJson.height); const imageWidth = Number(imageJson.width); @@ -512,14 +512,13 @@ export class FieldDropdown extends Field { let arrowX = 0; if (block.RTL) { const imageX = xPadding + arrowWidth; - this.imageElement_!.setAttribute('x', imageX.toString()); + this.imageElement_!.setAttribute('x', `${imageX}`); } else { arrowX = imageWidth + arrowWidth; this.getTextElement().setAttribute('text-anchor', 'end'); - this.imageElement_!.setAttribute('x', xPadding.toString()); + this.imageElement_!.setAttribute('x', `${xPadding}`); } - this.imageElement_!.setAttribute( - 'y', (height / 2 - imageHeight / 2).toString()); + this.imageElement_!.setAttribute('y', String(height / 2 - imageHeight / 2)); this.positionTextElement_(arrowX + xPadding, imageWidth + arrowWidth); } diff --git a/core/field_image.ts b/core/field_image.ts index 173a3dc63..60ddac433 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -64,19 +64,19 @@ export class FieldImage extends Field { * after their own constructors have run). * @param width Width of the image. * @param height Height of the image. - * @param opt_alt Optional alt text for when block is collapsed. - * @param opt_onClick Optional function to be called when the image is - * clicked. If opt_onClick is defined, opt_alt must also be defined. - * @param opt_flipRtl Whether to flip the icon in RTL. - * @param opt_config A map of options used to configure the field. + * @param alt Optional alt text for when block is collapsed. + * @param onClick Optional function to be called when the image is + * clicked. If onClick is defined, alt must also be defined. + * @param flipRtl Whether to flip the icon in RTL. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/image#creation} * for a list of properties this parameter supports. */ constructor( src: string|Sentinel, width: string|number, height: string|number, - opt_alt?: string, opt_onClick?: (p1: FieldImage) => void, - opt_flipRtl?: boolean, opt_config?: FieldImageConfig) { + alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, + config?: FieldImageConfig) { super(Field.SKIP_SETUP); const imageHeight = Number(parsing.replaceMessageReferences(height)); @@ -100,19 +100,19 @@ export class FieldImage extends Field { */ this.imageHeight_ = imageHeight; - if (typeof opt_onClick === 'function') { - this.clickHandler_ = opt_onClick; + if (typeof onClick === 'function') { + this.clickHandler_ = onClick; } if (src === Field.SKIP_SETUP) { return; } - if (opt_config) { - this.configure_(opt_config); + if (config) { + this.configure_(config); } else { - this.flipRtl_ = !!opt_flipRtl; - this.altText_ = parsing.replaceMessageReferences(opt_alt) || ''; + this.flipRtl_ = !!flipRtl; + this.altText_ = parsing.replaceMessageReferences(alt) || ''; } this.setValue(parsing.replaceMessageReferences(src)); } @@ -157,14 +157,14 @@ export class FieldImage extends Field { /** * Ensure that the input value (the source URL) is a string. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A string, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: any): string|null { - if (typeof opt_newValue !== 'string') { + protected override doClassValidation_(newValue?: any): string|null { + if (typeof newValue !== 'string') { return null; } - return opt_newValue; + return newValue; } /** @@ -177,7 +177,7 @@ export class FieldImage extends Field { this.value_ = newValue; if (this.imageElement_) { this.imageElement_.setAttributeNS( - dom.XLINK_NS, 'xlink:href', String(this.value_)); + dom.XLINK_NS, 'xlink:href', this.value_); } } diff --git a/core/field_input.ts b/core/field_input.ts index 3d3f4302a..756103d16 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -25,7 +25,6 @@ import {Field, FieldConfig, FieldValidator, UnattachedFieldError} from './field. import {Msg} from './msg.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; -import {KeyCodes} from './utils/keycodes.js'; import type {Sentinel} from './utils/sentinel.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -90,31 +89,31 @@ export abstract class FieldInput extends Field { override CURSOR = 'text'; /** - * @param opt_value The initial value of the field. Should cast to a string. + * @param value The initial value of the field. Should cast to a string. * Defaults to an empty string if null or undefined. Also accepts * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses * that want to handle configuration and setting the field value after * their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a string & returns a validated string, or null * to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|Sentinel, opt_validator?: FieldInputValidator|null, - opt_config?: FieldInputConfig) { + value?: string|Sentinel, validator?: FieldInputValidator|null, + config?: FieldInputConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } @@ -262,14 +261,13 @@ export abstract class FieldInput extends Field { * Shows a prompt editor for mobile browsers if the modalInputs option is * enabled. * - * @param _opt_e Optional mouse event that triggered the field to open, or + * @param _e Optional mouse event that triggered the field to open, or * undefined if triggered programmatically. - * @param opt_quietInput True if editor should be created without focus. + * @param quietInput True if editor should be created without focus. * Defaults to false. */ - protected override showEditor_(_opt_e?: Event, opt_quietInput?: boolean) { + protected override showEditor_(_e?: Event, quietInput = false) { this.workspace_ = (this.sourceBlock_ as BlockSvg).workspace; - const quietInput = opt_quietInput || false; if (!quietInput && this.workspace_.options.modalInputs && (userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD)) { this.showPromptEditor_(); @@ -358,7 +356,7 @@ export abstract class FieldInput extends Field { div!.style.transition = 'box-shadow 0.25s ease 0s'; if (this.getConstants()!.FIELD_TEXTINPUT_BOX_SHADOW) { div!.style.boxShadow = - 'rgba(255, 255, 255, 0.3) 0 0 0 ' + 4 * scale + 'px'; + 'rgba(255, 255, 255, 0.3) 0 0 0 ' + (4 * scale) + 'px'; } } htmlInput.style.borderRadius = borderRadius; @@ -444,15 +442,15 @@ export abstract class FieldInput extends Field { * @param e Keyboard event. */ protected onHtmlInputKeyDown_(e: KeyboardEvent) { - if (e.keyCode === KeyCodes.ENTER) { + if (e.key === 'Enter') { WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - } else if (e.keyCode === KeyCodes.ESC) { + } else if (e.key === 'Esc') { this.setValue( this.htmlInput_!.getAttribute('data-untyped-default-value')); WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - } else if (e.keyCode === KeyCodes.TAB) { + } else if (e.key === 'Tab') { WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); (this.sourceBlock_ as BlockSvg).tab(this, !e.shiftKey); @@ -543,7 +541,7 @@ export abstract class FieldInput extends Field { * @returns The text to show on the HTML input. */ protected getEditorText_(value: AnyDuringMigration): string { - return String(value); + return `${value}`; } /** diff --git a/core/field_label.ts b/core/field_label.ts index 1c6daea50..4cb293ef6 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -23,7 +23,7 @@ import type {Sentinel} from './utils/sentinel.js'; * Class for a non-editable, non-serializable text field. */ export class FieldLabel extends Field { - /** The html class name to use for this field. */ + /** The HTML class name to use for this field. */ private class_: string|null = null; /** @@ -33,29 +33,28 @@ export class FieldLabel extends Field { override EDITABLE = false; /** - * @param opt_value The initial value of the field. Should cast to a string. + * @param value The initial value of the field. Should cast to a string. * Defaults to an empty string if null or undefined. Also accepts * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses * that want to handle configuration and setting the field value after * their own constructors have run). - * @param opt_class Optional CSS class for the field's text. - * @param opt_config A map of options used to configure the field. + * @param textClass Optional CSS class for the field's text. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|Sentinel, opt_class?: string, - opt_config?: FieldLabelConfig) { + value?: string|Sentinel, textClass?: string, config?: FieldLabelConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } else { - this.class_ = opt_class || null; + this.class_ = textClass || null; } - this.setValue(opt_value); + this.setValue(value); } protected override configure_(config: FieldLabelConfig) { @@ -78,15 +77,15 @@ export class FieldLabel extends Field { /** * Ensure that the input value casts to a valid string. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid string, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { - if (opt_newValue === null || opt_newValue === undefined) { + protected override doClassValidation_(newValue?: AnyDuringMigration): string + |null { + if (newValue === null || newValue === undefined) { return null; } - return String(opt_newValue); + return `${newValue}`; } /** diff --git a/core/field_label_serializable.ts b/core/field_label_serializable.ts index 79c4c8e06..55ef8a1fb 100644 --- a/core/field_label_serializable.ts +++ b/core/field_label_serializable.ts @@ -36,17 +36,16 @@ export class FieldLabelSerializable extends FieldLabel { override SERIALIZABLE = true; /** - * @param opt_value The initial value of the field. Should cast to a string. + * @param value The initial value of the field. Should cast to a string. * Defaults to an empty string if null or undefined. - * @param opt_class Optional CSS class for the field's text. - * @param opt_config A map of options used to configure the field. + * @param textClass Optional CSS class for the field's text. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/label-serializable#creation} * for a list of properties this parameter supports. */ - constructor( - opt_value?: string, opt_class?: string, opt_config?: FieldLabelConfig) { - super(String(opt_value ?? ''), opt_class, opt_config); + constructor(value?: string, textClass?: string, config?: FieldLabelConfig) { + super(String(value ?? ''), textClass, config); } /** diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index 467ace17c..40f82de23 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -18,7 +18,6 @@ import * as fieldRegistry from './field_registry.js'; import {FieldTextInput, FieldTextInputConfig, FieldTextInputValidator} from './field_textinput.js'; import * as aria from './utils/aria.js'; import * as dom from './utils/dom.js'; -import {KeyCodes} from './utils/keycodes.js'; import * as parsing from './utils/parsing.js'; import type {Sentinel} from './utils/sentinel.js'; import {Svg} from './utils/svg.js'; @@ -33,9 +32,7 @@ export class FieldMultilineInput extends FieldTextInput { * The SVG group element that will contain a text element for each text row * when initialized. */ - // AnyDuringMigration because: Type 'null' is not assignable to type - // 'SVGGElement'. - textGroup_: SVGGElement = null as AnyDuringMigration; + textGroup: SVGGElement|null = null; /** * Defines the maximum number of lines of field. @@ -47,35 +44,40 @@ export class FieldMultilineInput extends FieldTextInput { protected isOverflowedY_ = false; /** - * @param opt_value The initial content of the field. Should cast to a string. + * @param value The initial content of the field. Should cast to a string. * Defaults to an empty string if null or undefined. Also accepts * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses * that want to handle configuration and setting the field value after * their own constructors have run). - * @param opt_validator An optional function that is called to validate any + * @param validator An optional function that is called to validate any * constraints on what the user entered. Takes the new text as an * argument and returns either the accepted text, a replacement text, or * null to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|Sentinel, opt_validator?: FieldMultilineInputValidator, - opt_config?: FieldMultilineInputConfig) { + value?: string|Sentinel, validator?: FieldMultilineInputValidator, + config?: FieldMultilineInputConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } + /** + * Configure the field based on the given map of options. + * + * @param config A map of options to configure the field based on. + */ protected override configure_(config: FieldMultilineInputConfig) { super.configure_(config); if (config.maxLines) this.setMaxLines(config.maxLines); @@ -112,6 +114,8 @@ export class FieldMultilineInput extends FieldTextInput { /** * Saves this field's value. + * This function only exists for subclasses of FieldMultilineInput which + * predate the load/saveState API and only define to/fromXml. * * @returns The state of this field. * @internal @@ -126,6 +130,8 @@ export class FieldMultilineInput extends FieldTextInput { /** * Sets the field's value based on the given state. + * This function only exists for subclasses of FieldMultilineInput which + * predate the load/saveState API and only define to/fromXml. * * @param state The state of the variable to assign to this variable field. * @internal @@ -144,7 +150,7 @@ export class FieldMultilineInput extends FieldTextInput { */ override initView() { this.createBorderRect_(); - this.textGroup_ = dom.createSvgElement( + this.textGroup = dom.createSvgElement( Svg.G, { 'class': 'blocklyEditableText', }, @@ -219,8 +225,9 @@ export class FieldMultilineInput extends FieldTextInput { } // Remove all text group children. let currentChild; - while (currentChild = this.textGroup_.firstChild) { - this.textGroup_.removeChild(currentChild); + const textGroup = this.textGroup; + while (currentChild = textGroup!.firstChild) { + textGroup!.removeChild(currentChild); } // Add in text elements into the group. @@ -236,7 +243,7 @@ export class FieldMultilineInput extends FieldTextInput { 'y': y + this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING, 'dy': this.getConstants()!.FIELD_TEXT_BASELINE, }, - this.textGroup_); + textGroup); span.appendChild(document.createTextNode(lines[i])); y += lineHeight; } @@ -274,7 +281,7 @@ export class FieldMultilineInput extends FieldTextInput { /** Updates the size of the field based on the text. */ protected override updateSize_() { - const nodes = this.textGroup_.childNodes; + const nodes = (this.textGroup as SVGElement).childNodes; const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE; const fontWeight = this.getConstants()!.FIELD_TEXT_FONTWEIGHT; const fontFamily = this.getConstants()!.FIELD_TEXT_FONTFAMILY; @@ -320,13 +327,8 @@ export class FieldMultilineInput extends FieldTextInput { if (this.borderRect_) { totalHeight += this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING * 2; totalWidth += this.getConstants()!.FIELD_BORDER_RECT_X_PADDING * 2; - // AnyDuringMigration because: Argument of type 'number' is not - // assignable to parameter of type 'string'. - this.borderRect_.setAttribute('width', totalWidth as AnyDuringMigration); - // AnyDuringMigration because: Argument of type 'number' is not - // assignable to parameter of type 'string'. - this.borderRect_.setAttribute( - 'height', totalHeight as AnyDuringMigration); + this.borderRect_.setAttribute('width', `${totalWidth}`); + this.borderRect_.setAttribute('height', `${totalHeight}`); } this.size_.width = totalWidth; this.size_.height = totalHeight; @@ -339,13 +341,13 @@ export class FieldMultilineInput extends FieldTextInput { * Overrides the default behaviour to force rerender in order to * correct block size, based on editor text. * - * @param _opt_e Optional mouse event that triggered the field to open, or + * @param e Optional mouse event that triggered the field to open, or * undefined if triggered programmatically. - * @param opt_quietInput True if editor should be created without focus. + * @param quietInput True if editor should be created without focus. * Defaults to false. */ - override showEditor_(_opt_e?: Event, opt_quietInput?: boolean) { - super.showEditor_(_opt_e, opt_quietInput); + override showEditor_(e?: Event, quietInput?: boolean) { + super.showEditor_(e, quietInput); this.forceRerender(); } @@ -360,10 +362,7 @@ export class FieldMultilineInput extends FieldTextInput { const htmlInput = (document.createElement('textarea')); htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput'; - // AnyDuringMigration because: Argument of type 'boolean' is not assignable - // to parameter of type 'string'. - htmlInput.setAttribute( - 'spellcheck', this.spellcheck_ as AnyDuringMigration); + htmlInput.setAttribute('spellcheck', String(this.spellcheck_)); const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE * scale + 'pt'; div!.style.fontSize = fontSize; htmlInput.style.fontSize = fontSize; @@ -425,7 +424,7 @@ export class FieldMultilineInput extends FieldTextInput { * @param e Keyboard event. */ protected override onHtmlInputKeyDown_(e: KeyboardEvent) { - if (e.keyCode !== KeyCodes.ENTER) { + if (e.key !== 'Enter') { super.onHtmlInputKeyDown_(e); } } @@ -448,7 +447,12 @@ export class FieldMultilineInput extends FieldTextInput { } } -/** CSS for multiline field. See css.js for use. */ +fieldRegistry.register('field_multilinetext', FieldMultilineInput); + + +/** + * CSS for multiline field. + */ Css.register(` .blocklyHtmlTextAreaInput { font-family: monospace; @@ -463,8 +467,6 @@ Css.register(` } `); -fieldRegistry.register('field_multilinetext', FieldMultilineInput); - /** * Config options for the multiline input field. */ diff --git a/core/field_number.ts b/core/field_number.ts index 5be44816d..262373050 100644 --- a/core/field_number.ts +++ b/core/field_number.ts @@ -37,51 +37,44 @@ export class FieldNumber extends FieldInput { */ private decimalPlaces_: number|null = null; - /** - * Serializable fields are saved by the serializer, non-serializable fields - * are not. Editable fields should also be serializable. - */ - override SERIALIZABLE = true; - /** Don't spellcheck numbers. Our validator does a better job. */ protected override spellcheck_ = false; /** - * @param opt_value The initial value of the field. Should cast to a number. + * @param value The initial value of the field. Should cast to a number. * Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup * (only used by subclasses that want to handle configuration and setting * the field value after their own constructors have run). - * @param opt_min Minimum value. Will only be used if opt_config is not + * @param min Minimum value. Will only be used if config is not * provided. - * @param opt_max Maximum value. Will only be used if opt_config is not + * @param max Maximum value. Will only be used if config is not * provided. - * @param opt_precision Precision for value. Will only be used if opt_config + * @param precision Precision for value. Will only be used if config * is not provided. - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a number & returns a validated number, or null * to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/number#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|number|Sentinel, opt_min?: string|number|null, - opt_max?: string|number|null, opt_precision?: string|number|null, - opt_validator?: FieldNumberValidator|null, - opt_config?: FieldNumberConfig) { + value?: string|number|Sentinel, min?: string|number|null, + max?: string|number|null, precision?: string|number|null, + validator?: FieldNumberValidator|null, config?: FieldNumberConfig) { // Pass SENTINEL so that we can define properties before value validation. super(Field.SKIP_SETUP); - if (Field.isSentinel(opt_value)) return; - if (opt_config) { - this.configure_(opt_config); + if (Field.isSentinel(value)) return; + if (config) { + this.configure_(config); } else { - this.setConstraints(opt_min, opt_max, opt_precision); + this.setConstraints(min, max, precision); } - this.setValue(opt_value); - if (opt_validator) { - this.setValidator(opt_validator); + this.setValue(value); + if (validator) { + this.setValidator(validator); } } @@ -246,17 +239,17 @@ export class FieldNumber extends FieldInput { * Ensure that the input value is a valid number (must fulfill the * constraints placed on the field). * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid number, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - number|null { - if (opt_newValue === null) { + protected override doClassValidation_(newValue?: AnyDuringMigration): number + |null { + if (newValue === null) { return null; } // Clean up text. - let newValue = String(opt_newValue); + newValue = `${newValue}`; // TODO: Handle cases like 'ten', '1.203,14', etc. // 'O' is sometimes mistaken for '0' by inexperienced users. newValue = newValue.replace(/O/ig, '0'); diff --git a/core/field_textinput.ts b/core/field_textinput.ts index 5b6a3878e..f519f98bb 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -25,37 +25,37 @@ import type {Sentinel} from './utils/sentinel.js'; */ export class FieldTextInput extends FieldInput { /** - * @param opt_value The initial value of the field. Should cast to a string. + * @param value The initial value of the field. Should cast to a string. * Defaults to an empty string if null or undefined. Also accepts * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses * that want to handle configuration and setting the field value after * their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a string & returns a validated string, or null * to abort the change. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/text-input#creation} * for a list of properties this parameter supports. */ constructor( - opt_value?: string|Sentinel, opt_validator?: FieldTextInputValidator|null, - opt_config?: FieldTextInputConfig) { - super(opt_value, opt_validator, opt_config); + value?: string|Sentinel, validator?: FieldTextInputValidator|null, + config?: FieldTextInputConfig) { + super(value, validator, config); } /** * Ensure that the input value casts to a valid string. * - * @param opt_newValue The input value. + * @param newValue The input value. * @returns A valid string, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { - if (opt_newValue === undefined) { + protected override doClassValidation_(newValue?: AnyDuringMigration): string + |null { + if (newValue === undefined) { return null; } - return String(opt_newValue); + return `${newValue}`; } /** diff --git a/core/field_variable.ts b/core/field_variable.ts index 091a01a4a..61159463e 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -62,23 +62,23 @@ export class FieldVariable extends FieldDropdown { * Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by * subclasses that want to handle configuration and setting the field value * after their own constructors have run). - * @param opt_validator A function that is called to validate changes to the + * @param validator A function that is called to validate changes to the * field's value. Takes in a variable ID & returns a validated variable * ID, or null to abort the change. - * @param opt_variableTypes A list of the types of variables to include in the - * dropdown. Will only be used if opt_config is not provided. - * @param opt_defaultType The type of variable to create if this field's value - * is not explicitly set. Defaults to ''. Will only be used if opt_config + * @param variableTypes A list of the types of variables to include in the + * dropdown. Will only be used if config is not provided. + * @param defaultType The type of variable to create if this field's value + * is not explicitly set. Defaults to ''. Will only be used if config * is not provided. - * @param opt_config A map of options used to configure the field. + * @param config A map of options used to configure the field. * See the [field creation documentation]{@link * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/variable#creation} * for a list of properties this parameter supports. */ constructor( - varName: string|null|Sentinel, opt_validator?: FieldVariableValidator, - opt_variableTypes?: string[], opt_defaultType?: string, - opt_config?: FieldVariableConfig) { + varName: string|null|Sentinel, validator?: FieldVariableValidator, + variableTypes?: string[], defaultType?: string, + config?: FieldVariableConfig) { super(Field.SKIP_SETUP); /** @@ -101,13 +101,13 @@ export class FieldVariable extends FieldDropdown { return; } - if (opt_config) { - this.configure_(opt_config); + if (config) { + this.configure_(config); } else { - this.setTypes_(opt_variableTypes, opt_defaultType); + this.setTypes_(variableTypes, defaultType); } - if (opt_validator) { - this.setValidator(opt_validator); + if (validator) { + this.setValidator(validator); } } @@ -315,19 +315,19 @@ export class FieldVariable extends FieldDropdown { /** * Ensure that the ID belongs to a valid variable of an allowed type. * - * @param opt_newValue The ID of the new variable to set. + * @param newValue The ID of the new variable to set. * @returns The validated ID, or null if invalid. */ - protected override doClassValidation_(opt_newValue?: AnyDuringMigration): - string|null { - if (opt_newValue === null) { + protected override doClassValidation_(newValue?: AnyDuringMigration): string + |null { + if (newValue === null) { return null; } const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); } - const newId = opt_newValue as string; + const newId = newValue as string; const variable = Variables.getVariable(block.workspace, newId); if (!variable) { console.warn( @@ -410,23 +410,19 @@ export class FieldVariable extends FieldDropdown { * Parse the optional arguments representing the allowed variable types and * the default variable type. * - * @param opt_variableTypes A list of the types of variables to include in the + * @param variableTypes A list of the types of variables to include in the * dropdown. If null or undefined, variables of all types will be * displayed in the dropdown. - * @param opt_defaultType The type of the variable to create if this field's + * @param defaultType The type of the variable to create if this field's * value is not explicitly set. Defaults to ''. */ - private setTypes_(opt_variableTypes?: string[], opt_defaultType?: string) { + private setTypes_(variableTypes: string[]|null = null, defaultType = '') { // If you expected that the default type would be the same as the only entry // in the variable types array, tell the Blockly team by commenting on // #1499. - const defaultType = opt_defaultType || ''; - let variableTypes; // Set the allowable variable types. Null means all types on the workspace. - if (opt_variableTypes === null || opt_variableTypes === undefined) { - variableTypes = null; - } else if (Array.isArray(opt_variableTypes)) { - variableTypes = opt_variableTypes; + if (Array.isArray(variableTypes)) { + variableTypes = variableTypes; // Make sure the default type is valid. let isInArray = false; for (let i = 0; i < variableTypes.length; i++) { @@ -439,7 +435,7 @@ export class FieldVariable extends FieldDropdown { 'Invalid default type \'' + defaultType + '\' in ' + 'the definition of a FieldVariable'); } - } else { + } else if (variableTypes !== null) { throw Error( '\'variableTypes\' was not an array in the definition of ' + 'a FieldVariable'); diff --git a/core/flyout_base.ts b/core/flyout_base.ts index f5a59e425..154e32f07 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -74,8 +74,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { /** * Lay out the blocks in the flyout. * - * @param contents The blocks and buttons to lay - * out. + * @param contents The blocks and buttons to lay out. * @param gaps The visible gaps between blocks. */ protected abstract layout_(contents: FlyoutItem[], gaps: number[]): void; @@ -128,9 +127,11 @@ export abstract class Flyout extends DeleteArea implements IFlyout { protected toolboxPosition_: number; /** - * Opaque data that can be passed to Blockly.unbindEvent_. + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. */ - private eventWrappers_: browserEvents.Data = []; + private boundEvents: browserEvents.Data[] = []; /** * Function that will be registered as a change listener on the workspace @@ -357,21 +358,17 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.hide(); - Array.prototype.push.apply( - this.eventWrappers_, - browserEvents.conditionalBind( - (this.svgGroup_ as SVGGElement), 'wheel', this, this.wheel_)); + this.boundEvents.push(browserEvents.conditionalBind( + (this.svgGroup_ as SVGGElement), 'wheel', this, this.wheel_)); if (!this.autoClose) { this.filterWrapper_ = this.filterForCapacity_.bind(this); this.targetWorkspace.addChangeListener(this.filterWrapper_); } // Dragging the flyout up and down. - Array.prototype.push.apply( - this.eventWrappers_, - browserEvents.conditionalBind( - (this.svgBackground_ as SVGPathElement), 'pointerdown', this, - this.onMouseDown_)); + this.boundEvents.push(browserEvents.conditionalBind( + (this.svgBackground_ as SVGPathElement), 'pointerdown', this, + this.onMouseDown_)); // A flyout connected to a workspace doesn't have its own current gesture. this.workspace_.getGesture = @@ -401,7 +398,10 @@ export abstract class Flyout extends DeleteArea implements IFlyout { dispose() { this.hide(); this.workspace_.getComponentManager().removeComponent(this.id); - browserEvents.unbind(this.eventWrappers_); + for (const event of this.boundEvents) { + browserEvents.unbind(event); + } + this.boundEvents.length = 0; if (this.filterWrapper_) { this.targetWorkspace.removeChangeListener(this.filterWrapper_); this.filterWrapper_ = null; @@ -525,8 +525,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout { * @param y The computed y origin of the flyout's SVG group. */ protected positionAt_(width: number, height: number, x: number, y: number) { - this.svgGroup_?.setAttribute('width', width.toString()); - this.svgGroup_?.setAttribute('height', height.toString()); + this.svgGroup_?.setAttribute('width', `${width}`); + this.svgGroup_?.setAttribute('height', `${height}`); this.workspace_.setCachedParentSvgSize(width, height); if (this.svgGroup_) { @@ -562,7 +562,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { } this.setVisible(false); // Delete all the event listeners. - for (let i = 0, listen; listen = this.listeners_[i]; i++) { + for (const listen of this.listeners_) { browserEvents.unbind(listen); } this.listeners_.length = 0; @@ -781,7 +781,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { blockInfo: toolbox.BlockInfo, gaps: number[], defaultGap: number) { let gap; if (blockInfo['gap']) { - gap = parseInt(blockInfo['gap'].toString()); + gap = parseInt(String(blockInfo['gap'])); } else if (blockInfo['blockxml']) { const xml = (typeof blockInfo['blockxml'] === 'string' ? utilsXml.textToDom(blockInfo['blockxml']) : @@ -806,7 +806,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { // // The default gap is 24, can be set larger or smaller. // This overwrites the gap attribute on the previous element. - const newGap = parseInt(sepInfo['gap']!.toString()); + const newGap = parseInt(String(sepInfo['gap'])); // Ignore gaps before the first block. if (!isNaN(newGap) && gaps.length > 0) { gaps[gaps.length - 1] = newGap; @@ -1056,13 +1056,13 @@ export abstract class Flyout extends DeleteArea implements IFlyout { */ protected moveRectToBlock_(rect: SVGElement, block: BlockSvg) { const blockHW = block.getHeightWidth(); - rect.setAttribute('width', blockHW.width.toString()); - rect.setAttribute('height', blockHW.height.toString()); + rect.setAttribute('width', String(blockHW.width)); + rect.setAttribute('height', String(blockHW.height)); const blockXY = block.getRelativeToSurfaceXY(); - rect.setAttribute('y', blockXY.y.toString()); + rect.setAttribute('y', String(blockXY.y)); rect.setAttribute( - 'x', (this.RTL ? blockXY.x - blockHW.width : blockXY.x).toString()); + 'x', String(this.RTL ? blockXY.x - blockHW.width : blockXY.x)); } /** diff --git a/core/flyout_button.ts b/core/flyout_button.ts index c3ad6cdaa..8a91d1c63 100644 --- a/core/flyout_button.ts +++ b/core/flyout_button.ts @@ -155,17 +155,17 @@ export class FlyoutButton { if (!this.isLabel_) { this.width += 2 * FlyoutButton.TEXT_MARGIN_X; this.height += 2 * FlyoutButton.TEXT_MARGIN_Y; - shadow?.setAttribute('width', this.width.toString()); - shadow?.setAttribute('height', this.height.toString()); + shadow?.setAttribute('width', String(this.width)); + shadow?.setAttribute('height', String(this.height)); } - rect.setAttribute('width', this.width.toString()); - rect.setAttribute('height', this.height.toString()); + rect.setAttribute('width', String(this.width)); + rect.setAttribute('height', String(this.height)); - svgText.setAttribute('x', (this.width / 2).toString()); + svgText.setAttribute('x', String(this.width / 2)); svgText.setAttribute( 'y', - (this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline) - .toString()); + String( + this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline)); this.updateTransform_(); diff --git a/core/generator.ts b/core/generator.ts index d51081a6d..e3261dfa5 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -279,7 +279,7 @@ export class CodeGenerator { if (!Array.isArray(tuple)) { throw TypeError( `Expecting tuple from value block: ${targetBlock.type} See ` + - `https://developers.google.com/blockly/guides/create-custom-blocks/generating-code` + + `developers.google.com/blockly/guides/create-custom-blocks/generating-code ` + `for more information`); } let code = tuple[0]; diff --git a/core/gesture.ts b/core/gesture.ts index c3d00ea3f..279d3527c 100644 --- a/core/gesture.ts +++ b/core/gesture.ts @@ -102,16 +102,11 @@ export class Gesture { private hasExceededDragRadius_ = false; /** - * A handle to use to unbind a pointermove listener at the end of a drag. - * Opaque data returned from Blockly.bindEventWithChecks_. + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. */ - protected onMoveWrapper_: browserEvents.Data|null = null; - - /** - * A handle to use to unbind a pointerup listener at the end of a drag. - * Opaque data returned from Blockly.bindEventWithChecks_. - */ - protected onUpWrapper_: browserEvents.Data|null = null; + private boundEvents: browserEvents.Data[] = []; /** The object tracking a bubble drag, or null if none is in progress. */ private bubbleDragger_: BubbleDragger|null = null; @@ -158,13 +153,6 @@ export class Gesture { /** The starting distance between two touch points. */ private startDistance_ = 0; - /** - * A handle to use to unbind the second pointerdown listener - * at the end of a drag. - * Opaque data returned from Blockly.bindEventWithChecks_. - */ - private onStartWrapper_: browserEvents.Data|null = null; - /** Boolean for whether or not the workspace supports pinch-zoom. */ private isPinchZoomEnabled_: boolean|null = null; @@ -209,12 +197,10 @@ export class Gesture { // Clear the owner's reference to this gesture. this.creatorWorkspace.clearGesture(); - if (this.onMoveWrapper_) { - browserEvents.unbind(this.onMoveWrapper_); - } - if (this.onUpWrapper_) { - browserEvents.unbind(this.onUpWrapper_); + for (const event of this.boundEvents) { + browserEvents.unbind(event); } + this.boundEvents.length = 0; if (this.blockDragger_) { this.blockDragger_.dispose(); @@ -222,10 +208,6 @@ export class Gesture { if (this.workspaceDragger_) { this.workspaceDragger_.dispose(); } - - if (this.onStartWrapper_) { - browserEvents.unbind(this.onStartWrapper_); - } } /** @@ -511,15 +493,15 @@ export class Gesture { * @internal */ bindMouseEvents(e: PointerEvent) { - this.onStartWrapper_ = browserEvents.conditionalBind( + this.boundEvents.push(browserEvents.conditionalBind( document, 'pointerdown', null, this.handleStart.bind(this), - /* opt_noCaptureIdentifier */ true); - this.onMoveWrapper_ = browserEvents.conditionalBind( + /* opt_noCaptureIdentifier */ true)); + this.boundEvents.push(browserEvents.conditionalBind( document, 'pointermove', null, this.handleMove.bind(this), - /* opt_noCaptureIdentifier */ true); - this.onUpWrapper_ = browserEvents.conditionalBind( + /* opt_noCaptureIdentifier */ true)); + this.boundEvents.push(browserEvents.conditionalBind( document, 'pointerup', null, this.handleUp.bind(this), - /* opt_noCaptureIdentifier */ true); + /* opt_noCaptureIdentifier */ true)); e.preventDefault(); e.stopPropagation(); diff --git a/core/grid.ts b/core/grid.ts index 8b88fa169..079ae5d19 100644 --- a/core/grid.ts +++ b/core/grid.ts @@ -91,8 +91,8 @@ export class Grid { update(scale: number) { const safeSpacing = this.spacing * scale; - this.pattern.setAttribute('width', safeSpacing.toString()); - this.pattern.setAttribute('height', safeSpacing.toString()); + this.pattern.setAttribute('width', `${safeSpacing}`); + this.pattern.setAttribute('height', `${safeSpacing}`); let half = Math.floor(this.spacing / 2) + 0.5; let start = half - this.length / 2; @@ -121,11 +121,11 @@ export class Grid { line: SVGElement, width: number, x1: number, x2: number, y1: number, y2: number) { if (line) { - line.setAttribute('stroke-width', width.toString()); - line.setAttribute('x1', x1.toString()); - line.setAttribute('y1', y1.toString()); - line.setAttribute('x2', x2.toString()); - line.setAttribute('y2', y2.toString()); + line.setAttribute('stroke-width', `${width}`); + line.setAttribute('x1', `${x1}`); + line.setAttribute('y1', `${y1}`); + line.setAttribute('x2', `${x2}`); + line.setAttribute('y2', `${y2}`); } } @@ -138,8 +138,8 @@ export class Grid { * @internal */ moveTo(x: number, y: number) { - this.pattern.setAttribute('x', x.toString()); - this.pattern.setAttribute('y', y.toString()); + this.pattern.setAttribute('x', `${x}`); + this.pattern.setAttribute('y', `${y}`); } /** diff --git a/core/keyboard_nav/ast_node.ts b/core/keyboard_nav/ast_node.ts index 1319c4b57..624dc6a45 100644 --- a/core/keyboard_nav/ast_node.ts +++ b/core/keyboard_nav/ast_node.ts @@ -177,7 +177,7 @@ export class ASTNode { throw new Error( 'The current AST location is not associated with a block'); } - const curIdx = block.inputList.indexOf((input)); + const curIdx = block.inputList.indexOf(input); let fieldIdx = input.fieldRow.indexOf(location) + 1; for (let i = curIdx; i < block.inputList.length; i++) { const newInput = block.inputList[i]; @@ -240,7 +240,7 @@ export class ASTNode { throw new Error( 'The current AST location is not associated with a block'); } - const curIdx = block.inputList.indexOf((parentInput)); + const curIdx = block.inputList.indexOf(parentInput); let fieldIdx = parentInput.fieldRow.indexOf(location) - 1; for (let i = curIdx; i >= 0; i--) { const input = block.inputList[i]; diff --git a/core/menu.ts b/core/menu.ts index 0b800d6ff..0ad63cf26 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -17,7 +17,6 @@ import type {MenuItem} from './menuitem.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; -import {KeyCodes} from './utils/keycodes.js'; import type {Size} from './utils/size.js'; import * as style from './utils/style.js'; @@ -392,29 +391,29 @@ export class Menu { } const highlighted = this.highlightedItem; - switch (keyboardEvent.keyCode) { - case KeyCodes.ENTER: - case KeyCodes.SPACE: + switch (keyboardEvent.key) { + case 'Enter': + case ' ': if (highlighted) { highlighted.performAction(); } break; - case KeyCodes.UP: + case 'ArrowUp': this.highlightPrevious(); break; - case KeyCodes.DOWN: + case 'ArrowDown': this.highlightNext(); break; - case KeyCodes.PAGE_UP: - case KeyCodes.HOME: + case 'PageUp': + case 'Home': this.highlightFirst(); break; - case KeyCodes.PAGE_DOWN: - case KeyCodes.END: + case 'PageDown': + case 'End': this.highlightLast(); break; diff --git a/core/registry.ts b/core/registry.ts index c3219934b..f99ded7bf 100644 --- a/core/registry.ts +++ b/core/registry.ts @@ -115,12 +115,12 @@ export function register( AnyDuringMigration, opt_allowOverrides?: boolean): void { if (!(type instanceof Type) && typeof type !== 'string' || - String(type).trim() === '') { + `${type}`.trim() === '') { throw Error( 'Invalid type "' + type + '". The type must be a' + ' non-empty string or a Blockly.registry.Type.'); } - type = String(type).toLowerCase(); + type = `${type}`.toLowerCase(); if (typeof name !== 'string' || name.trim() === '') { throw Error( @@ -178,7 +178,7 @@ function validate(type: string, registryItem: Function|AnyDuringMigration) { * @param name The plugin's name. (Ex. field_angle, geras) */ export function unregister(type: string|Type, name: string) { - type = String(type).toLowerCase(); + type = `${type}`.toLowerCase(); name = name.toLowerCase(); const typeRegistry = typeMap[type]; if (!typeRegistry || !typeRegistry[name]) { @@ -206,7 +206,7 @@ export function unregister(type: string|Type, name: string) { function getItem( type: string|Type, name: string, opt_throwIfMissing?: boolean): (new (...p1: AnyDuringMigration[]) => T)|null|AnyDuringMigration { - type = String(type).toLowerCase(); + type = `${type}`.toLowerCase(); name = name.toLowerCase(); const typeRegistry = typeMap[type]; if (!typeRegistry || !typeRegistry[name]) { @@ -233,7 +233,7 @@ function getItem( * otherwise. */ export function hasItem(type: string|Type, name: string): boolean { - type = String(type).toLowerCase(); + type = `${type}`.toLowerCase(); name = name.toLowerCase(); const typeRegistry = typeMap[type]; if (!typeRegistry) { @@ -288,7 +288,7 @@ export function getObject( export function getAllItems( type: string|Type, opt_cased?: boolean, opt_throwIfMissing?: boolean): {[key: string]: T|null|(new (...p1: AnyDuringMigration[]) => T)}|null { - type = String(type).toLowerCase(); + type = `${type}`.toLowerCase(); const typeRegistry = typeMap[type]; if (!typeRegistry) { const msg = `Unable to find [${type}] in the registry.`; @@ -304,9 +304,7 @@ export function getAllItems( } const nameRegistry = nameMap[type]; const casedRegistry = Object.create(null); - const keys = Object.keys(typeRegistry); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; + for (const key of Object.keys(typeRegistry)) { casedRegistry[nameRegistry[key]] = typeRegistry[key]; } return casedRegistry; @@ -325,8 +323,7 @@ export function getAllItems( export function getClassFromOptions( type: Type, options: Options, opt_throwIfMissing?: boolean): (new (...p1: AnyDuringMigration[]) => T)|null { - const typeName = type.toString(); - const plugin = options.plugins[typeName] || DEFAULT; + const plugin = options.plugins[String(type)] || DEFAULT; // If the user passed in a plugin class instead of a registered plugin name. if (typeof plugin === 'function') { diff --git a/core/renderers/zelos/marker_svg.ts b/core/renderers/zelos/marker_svg.ts index 49e35a873..7e8ce2522 100644 --- a/core/renderers/zelos/marker_svg.ts +++ b/core/renderers/zelos/marker_svg.ts @@ -87,8 +87,8 @@ export class MarkerSvg extends BaseMarkerSvg { * @param y The y position of the circle. */ private positionCircle_(x: number, y: number) { - this.markerCircle_?.setAttribute('cx', x.toString()); - this.markerCircle_?.setAttribute('cy', y.toString()); + this.markerCircle_?.setAttribute('cx', `${x}`); + this.markerCircle_?.setAttribute('cy', `${y}`); this.currentMarkerSvg = this.markerCircle_; } diff --git a/core/scrollbar.ts b/core/scrollbar.ts index 707b6d2b3..f01bccf5f 100644 --- a/core/scrollbar.ts +++ b/core/scrollbar.ts @@ -223,12 +223,12 @@ export class Scrollbar { this.svgBackground.setAttribute('height', String(scrollbarThickness)); this.outerSvg.setAttribute('height', String(scrollbarThickness)); this.svgHandle.setAttribute('height', String(scrollbarThickness - 5)); - this.svgHandle.setAttribute('y', String(2.5)); + this.svgHandle.setAttribute('y', '2.5'); } else { this.svgBackground.setAttribute('width', String(scrollbarThickness)); this.outerSvg.setAttribute('width', String(scrollbarThickness)); this.svgHandle.setAttribute('width', String(scrollbarThickness - 5)); - this.svgHandle.setAttribute('x', String(2.5)); + this.svgHandle.setAttribute('x', '2.5'); } } diff --git a/core/shortcut_registry.ts b/core/shortcut_registry.ts index 191913941..8f03c5ca8 100644 --- a/core/shortcut_registry.ts +++ b/core/shortcut_registry.ts @@ -103,7 +103,7 @@ export class ShortcutRegistry { addKeyMapping( keyCode: string|number|KeyCodes, shortcutName: string, opt_allowCollision?: boolean) { - keyCode = String(keyCode); + keyCode = `${keyCode}`; const shortcutNames = this.keyMap.get(keyCode); if (shortcutNames && !opt_allowCollision) { throw new Error(`Shortcut named "${ @@ -280,7 +280,7 @@ export class ShortcutRegistry { if (serializedKey !== '' && e.keyCode) { serializedKey = serializedKey + '+' + e.keyCode; } else if (e.keyCode) { - serializedKey = e.keyCode.toString(); + serializedKey = String(e.keyCode); } return serializedKey; } @@ -327,7 +327,7 @@ export class ShortcutRegistry { if (serializedKey !== '' && keyCode) { serializedKey = serializedKey + '+' + keyCode; } else if (keyCode) { - serializedKey = keyCode.toString(); + serializedKey = `${keyCode}`; } return serializedKey; } diff --git a/core/theme.ts b/core/theme.ts index c79bc8a33..c9fb2981c 100644 --- a/core/theme.ts +++ b/core/theme.ts @@ -116,10 +116,16 @@ export class Theme implements ITheme { */ getComponentStyle(componentName: string): string|null { const style = (this.componentStyles as AnyDuringMigration)[componentName]; - if (style && typeof style === 'string' && this.getComponentStyle((style))) { - return this.getComponentStyle((style)); + if (!style) { + return null; } - return style ? String(style) : null; + if (typeof style === 'string') { + const recursiveStyle = this.getComponentStyle(style); + if (recursiveStyle) { + return recursiveStyle; + } + } + return `${style}`; } /** diff --git a/core/toolbox/category.ts b/core/toolbox/category.ts index a3a685ec8..16f814f26 100644 --- a/core/toolbox/category.ts +++ b/core/toolbox/category.ts @@ -57,19 +57,19 @@ export class ToolboxCategory extends ToolboxItem implements /** The colour of the category. */ protected colour_ = ''; - /** The html container for the category. */ + /** The HTML container for the category. */ protected htmlDiv_: HTMLDivElement|null = null; - /** The html element for the category row. */ + /** The HTML element for the category row. */ protected rowDiv_: HTMLDivElement|null = null; - /** The html element that holds children elements of the category row. */ + /** The HTML element that holds children elements of the category row. */ protected rowContents_: HTMLDivElement|null = null; - /** The html element for the toolbox icon. */ + /** The HTML element for the toolbox icon. */ protected iconDom_: Element|null = null; - /** The html element for the toolbox label. */ + /** The HTML element for the toolbox label. */ protected labelDom_: Element|null = null; protected cssConfig_: CssConfig; diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 91cf9d6d9..469515639 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -39,7 +39,6 @@ import type {KeyboardShortcut} from '../shortcut_registry.js'; import * as Touch from '../touch.js'; import * as aria from '../utils/aria.js'; import * as dom from '../utils/dom.js'; -import {KeyCodes} from '../utils/keycodes.js'; import {Rect} from '../utils/rect.js'; import * as toolbox from '../utils/toolbox.js'; import type {WorkspaceSvg} from '../workspace_svg.js'; @@ -63,10 +62,10 @@ export class Toolbox extends DeleteArea implements IAutoHideable, protected toolboxDef_: toolbox.ToolboxInfo; private readonly horizontalLayout_: boolean; - /** The html container for the toolbox. */ + /** The HTML container for the toolbox. */ HtmlDiv: HTMLDivElement|null = null; - /** The html container for the contents of a toolbox. */ + /** The HTML container for the contents of a toolbox. */ protected contentsDiv_: HTMLDivElement|null = null; /** Whether the Toolbox is visible. */ @@ -268,21 +267,21 @@ export class Toolbox extends DeleteArea implements IAutoHideable, */ protected onKeyDown_(e: KeyboardEvent) { let handled = false; - switch (e.keyCode) { - case KeyCodes.DOWN: + switch (e.key) { + case 'ArrowDown': handled = this.selectNext_(); break; - case KeyCodes.UP: + case 'ArrowUp': handled = this.selectPrevious_(); break; - case KeyCodes.LEFT: + case 'ArrowLeft': handled = this.selectParent_(); break; - case KeyCodes.RIGHT: + case 'ArrowRight': handled = this.selectChild_(); break; - case KeyCodes.ENTER: - case KeyCodes.SPACE: + case 'Enter': + case ' ': if (this.selectedItem_ && this.selectedItem_.isCollapsible()) { const collapsibleItem = this.selectedItem_ as ICollapsibleToolboxItem; collapsibleItem.toggleExpanded(); diff --git a/core/trashcan.ts b/core/trashcan.ts index 820a0caed..5d4d87f58 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -447,7 +447,7 @@ export class Trashcan extends DeleteArea implements IAutoHideable, // Linear interpolation between min and max. const opacity = OPACITY_MIN + this.lidOpen_ * (OPACITY_MAX - OPACITY_MIN); if (this.svgGroup_) { - this.svgGroup_.style.opacity = opacity.toString(); + this.svgGroup_.style.opacity = `${opacity}`; } if (this.lidOpen_ > this.minOpenness_ && this.lidOpen_ < 1) { diff --git a/core/utils/colour.ts b/core/utils/colour.ts index 6f234d308..d98c1fed7 100644 --- a/core/utils/colour.ts +++ b/core/utils/colour.ts @@ -80,7 +80,7 @@ export function setHsvValue(newValue: number) { * can't be parsed. */ export function parse(str: string|number): string|null { - str = String(str).toLowerCase().trim(); + str = `${str}`.toLowerCase().trim(); let hex = names[str]; if (hex) { // e.g. 'red' diff --git a/core/utils/dom.ts b/core/utils/dom.ts index 383934f47..b6ca84eda 100644 --- a/core/utils/dom.ts +++ b/core/utils/dom.ts @@ -63,7 +63,7 @@ let canvasContext: CanvasRenderingContext2D|null = null; export function createSvgElement( name: string|Svg, attrs: {[key: string]: string|number}, opt_parent?: Element|null): T { - const e = document.createElementNS(SVG_NS, String(name)) as T; + const e = document.createElementNS(SVG_NS, `${name}`) as T; for (const key in attrs) { e.setAttribute(key, `${attrs[key]}`); } diff --git a/core/utils/parsing.ts b/core/utils/parsing.ts index 79c3784fc..4badd77ff 100644 --- a/core/utils/parsing.ts +++ b/core/utils/parsing.ts @@ -109,7 +109,7 @@ function tokenizeInterpolationInternal( // When parsing interpolation tokens, numbers are special // placeholders (%1, %2, etc). Make sure all other values are // strings. - tokens.push(String(rawValue)); + tokens.push(`${rawValue}`); } else { tokens.push(rawValue); } diff --git a/core/workspace_comment.ts b/core/workspace_comment.ts index 4a4de35ff..6745a1bb2 100644 --- a/core/workspace_comment.ts +++ b/core/workspace_comment.ts @@ -265,10 +265,10 @@ export class WorkspaceComment { */ toXmlWithXY(opt_noId?: boolean): Element { const element = this.toXml(opt_noId); - element.setAttribute('x', `${Math.round(this.xy_.x)}`); - element.setAttribute('y', `${Math.round(this.xy_.y)}`); - element.setAttribute('h', `${this.height_}`); - element.setAttribute('w', `${this.width_}`); + element.setAttribute('x', String(Math.round(this.xy_.x))); + element.setAttribute('y', String(Math.round(this.xy_.y))); + element.setAttribute('h', String(this.height_)); + element.setAttribute('w', String(this.width_)); return element; } diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 2d45de046..b440b0679 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -723,8 +723,10 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements Svg.G, {'class': this.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE'}, this.svgGroup_); dom.createSvgElement( - Svg.POLYGON, - {'points': '0,x x,x x,0'.replace(/x/g, RESIZE_SIZE.toString())}, + Svg.POLYGON, { + 'points': + `0,${RESIZE_SIZE} ${RESIZE_SIZE},${RESIZE_SIZE} ${RESIZE_SIZE},0`, + }, this.resizeGroup_); dom.createSvgElement( Svg.LINE, { @@ -885,10 +887,11 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements const topOffset = WorkspaceCommentSvg.TOP_OFFSET; const textOffset = TEXTAREA_OFFSET * 2; - this.foreignObject_?.setAttribute('width', `${size.width}`); - this.foreignObject_?.setAttribute('height', `${size.height - topOffset}`); + this.foreignObject_?.setAttribute('width', String(size.width)); + this.foreignObject_?.setAttribute( + 'height', String(size.height - topOffset)); if (this.RTL) { - this.foreignObject_?.setAttribute('x', `${- size.width}`); + this.foreignObject_?.setAttribute('x', String(-size.width)); } if (!this.textarea_) return; @@ -914,7 +917,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements this.svgRectTarget_?.setAttribute('height', `${height}`); this.svgHandleTarget_?.setAttribute('width', `${width}`); this.svgHandleTarget_?.setAttribute( - 'height', `${WorkspaceCommentSvg.TOP_OFFSET}`); + 'height', String(WorkspaceCommentSvg.TOP_OFFSET)); if (this.RTL) { this.svgRect_.setAttribute('transform', 'scale(-1 1)'); this.svgRectTarget_?.setAttribute('transform', 'scale(-1 1)'); @@ -1042,7 +1045,7 @@ export class WorkspaceCommentSvg extends WorkspaceComment implements eventUtils.enable(); } - WorkspaceComment.fireCreateEvent((comment)); + WorkspaceComment.fireCreateEvent(comment); return comment; } } diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 5acdf2235..d186772bc 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -1074,13 +1074,13 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.cachedParentSvgSize.width = width; // This is set to support the public (but deprecated) Blockly.svgSize // method. - svg.setAttribute('data-cached-width', width.toString()); + svg.setAttribute('data-cached-width', `${width}`); } if (height != null) { this.cachedParentSvgSize.height = height; // This is set to support the public (but deprecated) Blockly.svgSize // method. - svg.setAttribute('data-cached-height', height.toString()); + svg.setAttribute('data-cached-height', `${height}`); } } diff --git a/core/xml.ts b/core/xml.ts index 534b32536..473ffdb51 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -106,8 +106,8 @@ export function blockToDomWithXY(block: Block, opt_noId?: boolean): Element| if (isElement(element)) { const xy = block.getRelativeToSurfaceXY(); element.setAttribute( - 'x', `${Math.round(block.workspace.RTL ? width - xy.x : xy.x)}`); - element.setAttribute('y', `${Math.round(xy.y)}`); + 'x', String(Math.round(block.workspace.RTL ? width - xy.x : xy.x))); + element.setAttribute('y', String(Math.round(xy.y))); } return element; } @@ -191,8 +191,8 @@ export function blockToDom(block: Block, opt_noId?: boolean): Element| const commentElement = utilsXml.createElement('comment'); commentElement.appendChild(utilsXml.createTextNode(commentText)); commentElement.setAttribute('pinned', `${pinned}`); - commentElement.setAttribute('h', `${size.height}`); - commentElement.setAttribute('w', `${size.width}`); + commentElement.setAttribute('h', String(size.height)); + commentElement.setAttribute('w', String(size.width)); element.appendChild(commentElement); } @@ -235,7 +235,7 @@ export function blockToDom(block: Block, opt_noId?: boolean): Element| } if (block.inputsInline !== undefined && block.inputsInline !== block.inputsInlineDefault) { - element.setAttribute('inline', block.inputsInline.toString()); + element.setAttribute('inline', String(block.inputsInline)); } if (block.isCollapsed()) { element.setAttribute('collapsed', 'true'); diff --git a/core/zoom_controls.ts b/core/zoom_controls.ts index 128ad7fa6..5ae63f8a5 100644 --- a/core/zoom_controls.ts +++ b/core/zoom_controls.ts @@ -42,22 +42,11 @@ export class ZoomControls implements IPositionable { id = 'zoomControls'; /** - * A handle to use to unbind the mouse down event handler for zoom reset - * button. Opaque data returned from browserEvents.conditionalBind. + * Array holding info needed to unbind events. + * Used for disposing. + * Ex: [[node, name, func], [node, name, func]]. */ - 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; - - /** - * 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 boundEvents: browserEvents.Data[] = []; /** The zoom in svg element. */ private zoomInGroup: SVGGElement|null = null; @@ -144,15 +133,10 @@ export class ZoomControls implements IPositionable { if (this.svgGroup) { dom.removeNode(this.svgGroup); } - if (this.onZoomResetWrapper) { - browserEvents.unbind(this.onZoomResetWrapper); - } - if (this.onZoomInWrapper) { - browserEvents.unbind(this.onZoomInWrapper); - } - if (this.onZoomOutWrapper) { - browserEvents.unbind(this.onZoomOutWrapper); + for (const event of this.boundEvents) { + browserEvents.unbind(event); } + this.boundEvents.length = 0; } /** @@ -273,8 +257,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach listener. - this.onZoomOutWrapper = browserEvents.conditionalBind( - this.zoomOutGroup, 'pointerdown', null, this.zoom.bind(this, -1)); + this.boundEvents.push(browserEvents.conditionalBind( + this.zoomOutGroup, 'pointerdown', null, this.zoom.bind(this, -1))); } /** @@ -319,8 +303,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach listener. - this.onZoomInWrapper = browserEvents.conditionalBind( - this.zoomInGroup, 'pointerdown', null, this.zoom.bind(this, 1)); + this.boundEvents.push(browserEvents.conditionalBind( + this.zoomInGroup, 'pointerdown', null, this.zoom.bind(this, 1))); } /** @@ -377,8 +361,8 @@ export class ZoomControls implements IPositionable { this.workspace.options.pathToMedia + SPRITE.url); // Attach event listeners. - this.onZoomResetWrapper = browserEvents.conditionalBind( - this.zoomResetGroup, 'pointerdown', null, this.resetZoom.bind(this)); + this.boundEvents.push(browserEvents.conditionalBind( + this.zoomResetGroup, 'pointerdown', null, this.resetZoom.bind(this))); } /** diff --git a/demos/blockfactory/analytics.js b/demos/blockfactory/analytics.js index 6febb8858..5611c09a9 100644 --- a/demos/blockfactory/analytics.js +++ b/demos/blockfactory/analytics.js @@ -171,8 +171,7 @@ BlocklyDevTools.Analytics.onExport = function(typeId, optMetadata) { */ BlocklyDevTools.Analytics.onError = function(e) { // stub - this.LOG_TO_CONSOLE_ && - console.log('Analytics.onError("' + e.toString() + '")'); + this.LOG_TO_CONSOLE_ && console.log('Analytics.onError("' + e + '")'); }; /** diff --git a/generators/javascript/lists.js b/generators/javascript/lists.js index a614f2a0c..c2845d439 100644 --- a/generators/javascript/lists.js +++ b/generators/javascript/lists.js @@ -356,9 +356,9 @@ function ${JavaScript.FUNCTION_NAME_PLACEHOLDER_}(type, direction) { 'NUMERIC': function(a, b) { return Number(a) - Number(b); }, 'TEXT': function(a, b) { - return a.toString() > b.toString() ? 1 : -1; }, + return String(a) > String(b) ? 1 : -1; }, 'IGNORE_CASE': function(a, b) { - return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; }, + return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; }, }; var compare = compareFuncs[type]; return function(a, b) { return compare(a, b) * direction; }; diff --git a/scripts/gulpfiles/test_tasks.js b/scripts/gulpfiles/test_tasks.js index 0354977bf..921be874d 100644 --- a/scripts/gulpfiles/test_tasks.js +++ b/scripts/gulpfiles/test_tasks.js @@ -59,7 +59,7 @@ function runTestTask(id, task) { successCount++; if (process.env.CI) console.log('::endgroup::'); console.log(`${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${id}`); - results[id] = {success: true}; + results[id] = {success: true}; resolve(result); }) .catch((err) => { @@ -191,8 +191,8 @@ function compareSize(file, expected) { const message = `Failed: Previous size of ${name} is undefined.`; console.log(`${BOLD_RED}${message}${ANSI_RESET}`); return 1; - } - + } + if (size > compare) { const message = `Failed: ` + `Size of ${name} has grown more than 10%. ${size} vs ${expected}`; diff --git a/tests/generators/golden/generated.js b/tests/generators/golden/generated.js index 2778376c2..f8ac5651a 100644 --- a/tests/generators/golden/generated.js +++ b/tests/generators/golden/generated.js @@ -1338,9 +1338,9 @@ function listsGetSortCompare(type, direction) { 'NUMERIC': function(a, b) { return Number(a) - Number(b); }, 'TEXT': function(a, b) { - return a.toString() > b.toString() ? 1 : -1; }, + return String(a) > String(b) ? 1 : -1; }, 'IGNORE_CASE': function(a, b) { - return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; }, + return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; }, }; var compare = compareFuncs[type]; return function(a, b) { return compare(a, b) * direction; }; diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index b9eadedfa..88ffc5100 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -299,7 +299,7 @@ suite('Blocks', function() { setup(function() { this.blocks = createTestBlocks(this.workspace, true); }); - + test('Don\'t heal', function() { this.blocks.B.dispose(false); assertDisposedNoheal(this.blocks); @@ -313,11 +313,11 @@ suite('Blocks', function() { test('Heal with bad checks', function() { const blocks = this.blocks; - + // A and C can't connect, but both can connect to B. blocks.A.inputList[0].connection.setCheck('type1'); blocks.C.outputConnection.setCheck('type2'); - + // Each block has only one input, but the types don't work. blocks.B.dispose(true); assertDisposedHealFailed(blocks); @@ -362,7 +362,7 @@ suite('Blocks', function() { setup(function() { this.blocks = createTestBlocks(this.workspace, false); }); - + test('Don\'t heal', function() { this.blocks.B.dispose(); assertDisposedNoheal(this.blocks); @@ -378,10 +378,10 @@ suite('Blocks', function() { // A and C can't connect, but both can connect to B. blocks.A.nextConnection.setCheck('type1'); blocks.C.previousConnection.setCheck('type2'); - + // The types don't work. blocks.B.dispose(true); - + assertDisposedHealFailed(blocks); }); diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 0f17772cd..e792e0e81 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -49,9 +49,9 @@ suite('Procedures', function() { createProcDefBlock(this.workspace, undefined, undefined, 'procB'); const callBlockB = createProcCallBlock(this.workspace, undefined, 'procB'); - + defBlockB.setFieldValue('procA', 'NAME'); - + chai.assert.notEqual( defBlockB.getFieldValue('NAME'), 'procA', @@ -82,7 +82,7 @@ suite('Procedures', function() { }, mutatorWorkspace); this.clock.runAll(); - + const newFlyoutParamName = mutatorWorkspace.getFlyout().getWorkspace().getTopBlocks(true)[0] .getFieldValue('NAME'); @@ -167,7 +167,7 @@ suite('Procedures', function() { this.workspace.undo(); this.workspace.undo(/* redo= */ true); - + chai.assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist'); @@ -252,10 +252,10 @@ suite('Procedures', function() { this.clock.runAll(); paramBlock.checkAndDelete(); this.clock.runAll(); - + this.workspace.undo(); this.workspace.undo(/* redo= */ true); - + chai.assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to not contain the name of the new param'); @@ -300,10 +300,10 @@ suite('Procedures', function() { .connect(paramBlock1.previousConnection); paramBlock1.nextConnection.connect(paramBlock2.previousConnection); this.clock.runAll(); - + paramBlock1.setFieldValue('new name', 'NAME'); this.clock.runAll(); - + chai.assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist'); @@ -349,10 +349,10 @@ suite('Procedures', function() { paramBlock.setFieldValue('param1', 'NAME'); containerBlock.getInput('STACK').connection.connect(paramBlock.previousConnection); this.clock.runAll(); - + paramBlock.setFieldValue('param2', 'NAME'); this.clock.runAll(); - + chai.assert.isNotNull( this.workspace.getVariable('param1', ''), 'Expected the old variable to continue to exist'); @@ -372,10 +372,10 @@ suite('Procedures', function() { .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); - + chai.assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist'); @@ -397,10 +397,10 @@ suite('Procedures', function() { containerBlock.getInput('STACK').connection .connect(paramBlock.previousConnection); this.clock.runAll(); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); - + chai.assert.equal( paramBlock.getFieldValue('NAME'), 'new name', @@ -422,7 +422,7 @@ suite('Procedures', function() { .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); @@ -449,10 +449,10 @@ suite('Procedures', function() { .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); - + chai.assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist'); @@ -474,10 +474,10 @@ suite('Procedures', function() { containerBlock.getInput('STACK').connection .connect(paramBlock.previousConnection); this.clock.runAll(); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); - + chai.assert.equal( paramBlock.getFieldValue('NAME'), 'preCreatedVar', @@ -499,7 +499,7 @@ suite('Procedures', function() { .connect(paramBlock.previousConnection); this.clock.runAll(); defBlock.mutator.setVisible(false); - + const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); @@ -571,7 +571,7 @@ suite('Procedures', function() { this.workspace.undo(); this.workspace.undo(/* redo= */ true); - + chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new'), 'Expected the params field to contain the new name of the param'); @@ -671,14 +671,14 @@ suite('Procedures', function() { .connect(block1.outputConnection); callBlock.getInput('ARG1').connection .connect(block2.outputConnection); - + // Reorder the parameters. paramBlock2.previousConnection.disconnect(); paramBlock1.previousConnection.disconnect(); containerBlock.getInput('STACK').connection.connect(paramBlock2.previousConnection); paramBlock2.nextConnection.connect(paramBlock1.previousConnection); this.clock.runAll(); - + chai.assert.equal( callBlock.getInputTargetBlock('ARG0'), block2, diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index 30af8340d..8cdff6de8 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -161,14 +161,14 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { clockwise: true, }); - chai.assert.isTrue(field.clockwise_); + chai.assert.isTrue(field.clockwise); }); test('JSON Definition', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, clockwise: true, }); - chai.assert.isTrue(field.clockwise_); + chai.assert.isTrue(field.clockwise); }); test('Constant', function() { // Note: Generally constants should be set at compile time, not @@ -176,7 +176,7 @@ suite('Angle Fields', function() { // can do this. Blockly.FieldAngle.CLOCKWISE = true; const field = new Blockly.FieldAngle(); - chai.assert.isTrue(field.clockwise_); + chai.assert.isTrue(field.clockwise); }); }); suite('Offset', function() { @@ -184,14 +184,14 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { offset: 90, }); - chai.assert.equal(field.offset_, 90); + chai.assert.equal(field.offset, 90); }); test('JSON Definition', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, offset: 90, }); - chai.assert.equal(field.offset_, 90); + chai.assert.equal(field.offset, 90); }); test('Constant', function() { // Note: Generally constants should be set at compile time, not @@ -199,7 +199,7 @@ suite('Angle Fields', function() { // can do this. Blockly.FieldAngle.OFFSET = 90; const field = new Blockly.FieldAngle(); - chai.assert.equal(field.offset_, 90); + chai.assert.equal(field.offset, 90); }); test('Null', function() { // Note: Generally constants should be set at compile time, not @@ -210,7 +210,7 @@ suite('Angle Fields', function() { value: 0, offset: null, }); - chai.assert.equal(field.offset_, 90); + chai.assert.equal(field.offset, 90); }); }); suite('Wrap', function() { @@ -218,14 +218,14 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { wrap: 180, }); - chai.assert.equal(field.wrap_, 180); + chai.assert.equal(field.wrap, 180); }); test('JSON Definition', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, wrap: 180, }); - chai.assert.equal(field.wrap_, 180); + chai.assert.equal(field.wrap, 180); }); test('Constant', function() { // Note: Generally constants should be set at compile time, not @@ -233,7 +233,7 @@ suite('Angle Fields', function() { // can do this. Blockly.FieldAngle.WRAP = 180; const field = new Blockly.FieldAngle(); - chai.assert.equal(field.wrap_, 180); + chai.assert.equal(field.wrap, 180); }); test('Null', function() { // Note: Generally constants should be set at compile time, not @@ -244,7 +244,7 @@ suite('Angle Fields', function() { value: 0, wrap: null, }); - chai.assert.equal(field.wrap_, 180); + chai.assert.equal(field.wrap, 180); }); }); suite('Round', function() { @@ -252,14 +252,14 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { round: 30, }); - chai.assert.equal(field.round_, 30); + chai.assert.equal(field.round, 30); }); test('JSON Definition', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, round: 30, }); - chai.assert.equal(field.round_, 30); + chai.assert.equal(field.round, 30); }); test('Constant', function() { // Note: Generally constants should be set at compile time, not @@ -267,7 +267,7 @@ suite('Angle Fields', function() { // can do this. Blockly.FieldAngle.ROUND = 30; const field = new Blockly.FieldAngle(); - chai.assert.equal(field.round_, 30); + chai.assert.equal(field.round, 30); }); test('Null', function() { // Note: Generally constants should be set at compile time, not @@ -278,7 +278,7 @@ suite('Angle Fields', function() { value: 0, round: null, }); - chai.assert.equal(field.round_, 30); + chai.assert.equal(field.round, 30); }); }); suite('Mode', function() { @@ -287,16 +287,16 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { mode: 'compass', }); - chai.assert.equal(field.offset_, 90); - chai.assert.isTrue(field.clockwise_); + chai.assert.equal(field.offset, 90); + chai.assert.isTrue(field.clockwise); }); test('JS Configuration', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, mode: 'compass', }); - chai.assert.equal(field.offset_, 90); - chai.assert.isTrue(field.clockwise_); + chai.assert.equal(field.offset, 90); + chai.assert.isTrue(field.clockwise); }); }); suite('Protractor', function() { @@ -304,16 +304,16 @@ suite('Angle Fields', function() { const field = new Blockly.FieldAngle(0, null, { mode: 'protractor', }); - chai.assert.equal(field.offset_, 0); - chai.assert.isFalse(field.clockwise_); + chai.assert.equal(field.offset, 0); + chai.assert.isFalse(field.clockwise); }); test('JS Configuration', function() { const field = Blockly.FieldAngle.fromJson({ value: 0, mode: 'protractor', }); - chai.assert.equal(field.offset_, 0); - chai.assert.isFalse(field.clockwise_); + chai.assert.equal(field.offset, 0); + chai.assert.isFalse(field.clockwise); }); }); }); diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index 65d4a9d2c..f1a37d9e3 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -173,9 +173,9 @@ suite('Colour Fields', function() { suite('Customizations', function() { suite('Colours and Titles', function() { function assertColoursAndTitles(field, colours, titles) { - field.dropdownCreate_(); + field.dropdownCreate(); let index = 0; - let node = field.picker_.firstChild.firstChild; + let node = field.picker.firstChild.firstChild; while (node) { chai.assert.equal(node.getAttribute('title'), titles[index]); chai.assert.equal( @@ -251,8 +251,8 @@ suite('Colour Fields', function() { }); suite('Columns', function() { function assertColumns(field, columns) { - field.dropdownCreate_(); - chai.assert.equal(field.picker_.firstChild.children.length, columns); + field.dropdownCreate(); + chai.assert.equal(field.picker.firstChild.children.length, columns); } test('Constants', function() { const columns = Blockly.FieldColour.COLUMNS; diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index 067ff4275..bc9bd9706 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -189,15 +189,15 @@ suite('Toolbox', function() { this.toolbox.dispose(); }); - function createKeyDownMock(keyCode) { + function createKeyDownMock(key) { return { - 'keyCode': keyCode, + 'key': key, 'preventDefault': function() {}, }; } - function testCorrectFunctionCalled(toolbox, keyCode, funcName) { - const event = createKeyDownMock(keyCode); + function testCorrectFunctionCalled(toolbox, key, funcName) { + const event = createKeyDownMock(key); const preventDefaultEvent = sinon.stub(event, 'preventDefault'); const selectMethodStub = sinon.stub(toolbox, funcName); selectMethodStub.returns(true); @@ -207,21 +207,21 @@ suite('Toolbox', function() { } test('Down button is pushed -> Should call selectNext_', function() { - testCorrectFunctionCalled(this.toolbox, Blockly.utils.KeyCodes.DOWN, 'selectNext_', true); + testCorrectFunctionCalled(this.toolbox, 'ArrowDown', 'selectNext_', true); }); test('Up button is pushed -> Should call selectPrevious_', function() { - testCorrectFunctionCalled(this.toolbox, Blockly.utils.KeyCodes.UP, 'selectPrevious_', true); + testCorrectFunctionCalled(this.toolbox, 'ArrowUp', 'selectPrevious_', true); }); test('Left button is pushed -> Should call selectParent_', function() { - testCorrectFunctionCalled(this.toolbox, Blockly.utils.KeyCodes.LEFT, 'selectParent_', true); + testCorrectFunctionCalled(this.toolbox, 'ArrowLeft', 'selectParent_', true); }); test('Right button is pushed -> Should call selectChild_', function() { - testCorrectFunctionCalled(this.toolbox, Blockly.utils.KeyCodes.RIGHT, 'selectChild_', true); + testCorrectFunctionCalled(this.toolbox, 'ArrowRight', 'selectChild_', true); }); - test('Enter button is pushed -> Should toggle expandedd', function() { + test('Enter button is pushed -> Should toggle expanded', function() { this.toolbox.selectedItem_ = getCollapsibleItem(this.toolbox); const toggleExpandedStub = sinon.stub(this.toolbox.selectedItem_, 'toggleExpanded'); - const event = createKeyDownMock(Blockly.utils.KeyCodes.ENTER); + const event = createKeyDownMock('Enter'); const preventDefaultEvent = sinon.stub(event, 'preventDefault'); this.toolbox.onKeyDown_(event); sinon.assert.called(toggleExpandedStub); @@ -229,7 +229,7 @@ suite('Toolbox', function() { }); test('Enter button is pushed when no item is selected -> Should not call prevent default', function() { this.toolbox.selectedItem_ = null; - const event = createKeyDownMock(Blockly.utils.KeyCodes.ENTER); + const event = createKeyDownMock('Enter'); const preventDefaultEvent = sinon.stub(event, 'preventDefault'); this.toolbox.onKeyDown_(event); sinon.assert.notCalled(preventDefaultEvent); diff --git a/tests/mocha/variable_map_test.js b/tests/mocha/variable_map_test.js index 2efb3afbd..ceef57088 100644 --- a/tests/mocha/variable_map_test.js +++ b/tests/mocha/variable_map_test.js @@ -301,7 +301,7 @@ suite('Variable Map', function() { const variable = this.variableMap.createVariable('test name', 'test type', 'test id'); this.variableMap.deleteVariable(variable); - + assertEventFired( this.eventSpy, Blockly.Events.VarDelete, @@ -320,7 +320,7 @@ suite('Variable Map', function() { new Blockly.VariableModel( this.workspace, 'test name', 'test type', 'test id'); this.variableMap.deleteVariable(variable); - + assertEventNotFired( this.eventSpy, Blockly.Events.VarDelete, @@ -335,7 +335,7 @@ suite('Variable Map', function() { function() { this.variableMap.createVariable('test name', 'test type', 'test id'); this.variableMap.deleteVariableById('test id'); - + assertEventFired( this.eventSpy, Blockly.Events.VarDelete, @@ -351,7 +351,7 @@ suite('Variable Map', function() { 'delete events are not fired when a variable does not exist', function() { this.variableMap.deleteVariableById('test id'); - + assertEventNotFired( this.eventSpy, Blockly.Events.VarDelete, @@ -379,7 +379,7 @@ suite('Variable Map', function() { }, this.workspace.id); }); - + test( 'rename events are not fired if the variable name already matches', function() { @@ -387,14 +387,14 @@ suite('Variable Map', function() { this.variableMap.createVariable( 'test name', 'test type', 'test id'); this.variableMap.renameVariable(variable, 'test name'); - + assertEventNotFired( this.eventSpy, Blockly.Events.VarRename, {}, this.workspace.id); }); - + test( 'rename events are not fired if the variable does not exist', function() { @@ -402,7 +402,7 @@ suite('Variable Map', function() { new Blockly.VariableModel( 'test name', 'test type', 'test id'); this.variableMap.renameVariable(variable, 'test name'); - + assertEventNotFired( this.eventSpy, Blockly.Events.VarRename, @@ -426,21 +426,21 @@ suite('Variable Map', function() { }, this.workspace.id); }); - + test( 'rename events are not fired if the variable name already matches', function() { this.variableMap.createVariable( 'test name', 'test type', 'test id'); this.variableMap.renameVariableById('test id', 'test name'); - + assertEventNotFired( this.eventSpy, Blockly.Events.VarRename, {}, this.workspace.id); }); - + test( 'renaming throws if the variable does not exist', function() { diff --git a/tests/mocha/webdriver.js b/tests/mocha/webdriver.js index e46921234..d64024a9f 100644 --- a/tests/mocha/webdriver.js +++ b/tests/mocha/webdriver.js @@ -30,7 +30,7 @@ async function runMochaTestsInBrowser() { ], logLevel: 'warn', }; - + // Run in headless mode on Github Actions. if (process.env.CI) { options.capabilities['goog:chromeOptions'].args.push( diff --git a/tests/typescript/src/field/different_user_input.ts b/tests/typescript/src/field/different_user_input.ts index f77094ea8..b4fa93731 100644 --- a/tests/typescript/src/field/different_user_input.ts +++ b/tests/typescript/src/field/different_user_input.ts @@ -54,7 +54,7 @@ class FieldMitosis extends Field { doMitosis(): void { const cellGroup = this.getValue(); if (!cellGroup) return; - + const cells = cellGroup.cells.flatMap((cell) => { const leftCell: Cell = {cellId: `${cell.cellId}-left`}; const rightCell: Cell = {cellId: `${cell.cellId}-right`}; From 7c40f6b62e2dad470e1599762b36b1df852597e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Mar 2023 15:13:59 -0700 Subject: [PATCH 115/141] chore(deps): bump selenium-standalone from 8.2.5 to 8.3.0 (#6880) Bumps [selenium-standalone](https://github.com/webdriverio/selenium-standalone) from 8.2.5 to 8.3.0. - [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.5...v8.3.0) --- updated-dependencies: - dependency-name: selenium-standalone dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 284 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 258 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 600629da7..37cda7910 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1935,6 +1935,18 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -2426,6 +2438,12 @@ "node": ">= 4.5.0" } }, + "node_modules/b4a": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.1.tgz", + "integrity": "sha512-AsKjNhz72yxteo/0EtQEiwkMUgk/tGmycXlbG4g3Ard2/ULtNLUykGOkeK0egmN27h0xMAhb76jYccW+XTBExA==", + "dev": true + }, "node_modules/bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -3252,12 +3270,12 @@ } }, "node_modules/commander": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz", - "integrity": "sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", "dev": true, "engines": { - "node": "^12.20.0 || >=14" + "node": ">=14" } }, "node_modules/comment-parser": { @@ -4475,12 +4493,30 @@ "through": "^2.3.8" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/exit-on-epipe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", @@ -4757,6 +4793,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-fifo": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.1.0.tgz", + "integrity": "sha512-Kl29QoNbNvn4nhDsLYjyIAaIqaJB6rBx5p3sL9VjaefJ+eMFBWVZiaoguaoZfzEKr5RhAti0UgM8703akGPJ6g==", + "dev": true + }, "node_modules/fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -8396,15 +8438,18 @@ } }, "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.5.tgz", + "integrity": "sha512-jbjfql+shJtAPrFoKxHOXip4xS+kul9W3OzfzzrqueWK2QMGon2bFH2opl6W9EagBThjEz+iysyi/swOoVfB/w==", "dev": true, "bin": { - "mkdirp": "bin/cmd.js" + "mkdirp": "dist/cjs/src/bin.js" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mkdirp-classic": { @@ -9641,6 +9686,15 @@ "node": ">=0.8" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -9806,6 +9860,12 @@ } ] }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", + "dev": true + }, "node_modules/quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -10432,12 +10492,12 @@ "dev": true }, "node_modules/selenium-standalone": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.5.tgz", - "integrity": "sha512-HdBQXNIc1G7zUWaQUMfilFRiHJ2d9G3WGYpJyPMXVWQro/dJfrAD1kexH1o7nEk/Ua9FTJ9SoKcYYpYhuSVcfA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.3.0.tgz", + "integrity": "sha512-cQVWQGxumvPnyzFNtzFtBfDCbqBsdEnwiOwRyrAzeUqf5ltAp3Z3+2f6asSFbLUQJs2sFuF6PsEyNA+eOzXKxg==", "dev": true, "dependencies": { - "commander": "^9.0.0", + "commander": "^10.0.0", "cross-spawn": "^7.0.3", "debug": "^4.3.1", "fs-extra": "^10.0.0", @@ -10446,9 +10506,9 @@ "lodash.mapvalues": "^4.6.0", "lodash.merge": "^4.6.2", "minimist": "^1.2.5", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.3", "progress": "2.0.3", - "tar-stream": "2.2.0", + "tar-stream": "3.0.0", "which": "^2.0.2", "yauzl": "^2.10.0" }, @@ -10460,6 +10520,67 @@ "npm": ">=6.0.0" } }, + "node_modules/selenium-standalone/node_modules/bl": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-6.0.0.tgz", + "integrity": "sha512-Ik9BVIMdcWzSOCpzDv2XpQ4rJ4oZBuk3ck6MgiOv0EopdgtohN2uSCrrLlkH1Jf0KnpZZMBA3D0bUMbCdj/jgA==", + "dev": true, + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^4.2.0" + } + }, + "node_modules/selenium-standalone/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/selenium-standalone/node_modules/readable-stream": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz", + "integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/selenium-standalone/node_modules/tar-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.0.0.tgz", + "integrity": "sha512-O6OfUKBbQOqAhh6owTWmA730J/yZCYcpmZ1DBj2YX51ZQrt7d7NgzrR+CnO9wP6nt/viWZW2XeXLavX3/ZEbEg==", + "dev": true, + "dependencies": { + "b4a": "^1.6.1", + "bl": "^6.0.0", + "streamx": "^2.12.5" + } + }, "node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -11150,6 +11271,16 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, + "node_modules/streamx": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.13.2.tgz", + "integrity": "sha512-+TWqixPhGDXEG9L/XczSbhfkmwAtGs3BJX5QNU6cvno+pOLKeszByWcnaTu6dg8efsTYqR8ZZuXWHhZfgrxMvA==", + "dev": true, + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -14090,6 +14221,15 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "requires": { + "event-target-shim": "^5.0.0" + } + }, "acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -14460,6 +14600,12 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "b4a": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.1.tgz", + "integrity": "sha512-AsKjNhz72yxteo/0EtQEiwkMUgk/tGmycXlbG4g3Ard2/ULtNLUykGOkeK0egmN27h0xMAhb76jYccW+XTBExA==", + "dev": true + }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -15102,9 +15248,9 @@ } }, "commander": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz", - "integrity": "sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.0.tgz", + "integrity": "sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==", "dev": true }, "comment-parser": { @@ -16074,12 +16220,24 @@ "through": "^2.3.8" } }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true + }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true + }, "exit-on-epipe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", @@ -16307,6 +16465,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "fast-fifo": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.1.0.tgz", + "integrity": "sha512-Kl29QoNbNvn4nhDsLYjyIAaIqaJB6rBx5p3sL9VjaefJ+eMFBWVZiaoguaoZfzEKr5RhAti0UgM8703akGPJ6g==", + "dev": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -19240,9 +19404,9 @@ } }, "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.5.tgz", + "integrity": "sha512-jbjfql+shJtAPrFoKxHOXip4xS+kul9W3OzfzzrqueWK2QMGon2bFH2opl6W9EagBThjEz+iysyi/swOoVfB/w==", "dev": true }, "mkdirp-classic": { @@ -20196,6 +20360,12 @@ "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==", "dev": true }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -20321,6 +20491,12 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", + "dev": true + }, "quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -20816,12 +20992,12 @@ "dev": true }, "selenium-standalone": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.2.5.tgz", - "integrity": "sha512-HdBQXNIc1G7zUWaQUMfilFRiHJ2d9G3WGYpJyPMXVWQro/dJfrAD1kexH1o7nEk/Ua9FTJ9SoKcYYpYhuSVcfA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-8.3.0.tgz", + "integrity": "sha512-cQVWQGxumvPnyzFNtzFtBfDCbqBsdEnwiOwRyrAzeUqf5ltAp3Z3+2f6asSFbLUQJs2sFuF6PsEyNA+eOzXKxg==", "dev": true, "requires": { - "commander": "^9.0.0", + "commander": "^10.0.0", "cross-spawn": "^7.0.3", "debug": "^4.3.1", "fs-extra": "^10.0.0", @@ -20830,11 +21006,57 @@ "lodash.mapvalues": "^4.6.0", "lodash.merge": "^4.6.2", "minimist": "^1.2.5", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.3", "progress": "2.0.3", - "tar-stream": "2.2.0", + "tar-stream": "3.0.0", "which": "^2.0.2", "yauzl": "^2.10.0" + }, + "dependencies": { + "bl": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-6.0.0.tgz", + "integrity": "sha512-Ik9BVIMdcWzSOCpzDv2XpQ4rJ4oZBuk3ck6MgiOv0EopdgtohN2uSCrrLlkH1Jf0KnpZZMBA3D0bUMbCdj/jgA==", + "dev": true, + "requires": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^4.2.0" + } + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "readable-stream": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz", + "integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==", + "dev": true, + "requires": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10" + } + }, + "tar-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.0.0.tgz", + "integrity": "sha512-O6OfUKBbQOqAhh6owTWmA730J/yZCYcpmZ1DBj2YX51ZQrt7d7NgzrR+CnO9wP6nt/viWZW2XeXLavX3/ZEbEg==", + "dev": true, + "requires": { + "b4a": "^1.6.1", + "bl": "^6.0.0", + "streamx": "^2.12.5" + } + } } }, "semver": { @@ -21426,6 +21648,16 @@ } } }, + "streamx": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.13.2.tgz", + "integrity": "sha512-+TWqixPhGDXEG9L/XczSbhfkmwAtGs3BJX5QNU6cvno+pOLKeszByWcnaTu6dg8efsTYqR8ZZuXWHhZfgrxMvA==", + "dev": true, + "requires": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", From 4efd2042f9163d4545f70dbdbb0833c8d974d909 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 16 Mar 2023 16:15:51 +0000 Subject: [PATCH 116/141] chore: Add required @license tag to any_aliases.ts (#6899) Missing licence tag causes presubmit failure when updating Blockly in third_party. --- core/any_aliases.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/any_aliases.ts b/core/any_aliases.ts index 6b3c413cb..b04621726 100644 --- a/core/any_aliases.ts +++ b/core/any_aliases.ts @@ -1,2 +1,8 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + // eslint-disable-next-line type AnyDuringMigration = any; From c2919c51bdcbd3f0cf4a49645058df82575ea6dd Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 16 Mar 2023 13:40:33 -0700 Subject: [PATCH 117/141] fix: improve performance of connecting blocks (#6876) * fix: early return from updateDisabled if it is noop * chore: trigger connect and disconnect before hiding * chore: remove disconnectInternal * fix: skip setting parent when disconnecting before connecting * chore: fixup docs * chore: remove erroneous test * fix: add delay to context menu callback. Improve INP by allowing the browser to do a paint (closing the context menu) before we trigger callbacks. This improves the user experience for expensive callbacks (e.g. collapsing, or updating disabled). * fix: rendering bug When disconnecting the last block in the stack, the block would not be rerendered correctly (the top-start corner would not be reshaped) * fix: connecting bug The order for applying connections was changed so that connections were applied and then the insertion marker was hidden. This caused an error because hiding the insertion marker expected there to be a child block when there was not. * chore: remove setParent param from public API * chore: tsdoc --- core/block_svg.ts | 14 ++--- core/connection.ts | 96 +++++++++++++++++--------------- core/contextmenu.ts | 14 +++-- core/insertion_marker_manager.ts | 43 +++----------- core/rendered_connection.ts | 30 +++++----- tests/mocha/block_test.js | 19 ------- 6 files changed, 92 insertions(+), 124 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index 5f3eab7bb..4f3ec2844 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -123,6 +123,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, /** @internal */ pathObject: IPathObject; override rendered = false; + private visuallyDisabled = false; /** * Is this block currently rendering? Used to stop recursive render calls @@ -961,15 +962,12 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, * @internal */ updateDisabled() { - const children = (this.getChildren(false)); + const disabled = !this.isEnabled() || this.getInheritedDisabled(); + if (this.visuallyDisabled === disabled) return; this.applyColour(); - if (this.isCollapsed()) { - return; - } - for (let i = 0, child; child = children[i]; i++) { - if (child.rendered) { - child.updateDisabled(); - } + this.visuallyDisabled = disabled; + for (const child of this.getChildren(false)) { + child.updateDisabled(); } } diff --git a/core/connection.ts b/core/connection.ts index 76536aa8b..485f3895e 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -93,7 +93,7 @@ export class Connection implements IASTNodeLocationWithBlock { // Make sure the childConnection is available. if (childConnection.isConnected()) { - childConnection.disconnect(); + childConnection.disconnectInternal(false); } // Make sure the parentConnection is available. @@ -104,7 +104,7 @@ export class Connection implements IASTNodeLocationWithBlock { if (target!.isShadow()) { target!.dispose(false); } else { - this.disconnect(); + this.disconnectInternal(); orphan = target; } this.applyShadowState_(shadowState); @@ -243,67 +243,75 @@ export class Connection implements IASTNodeLocationWithBlock { return this.isConnected(); } - /** Disconnect this connection. */ + /** + * Disconnect this connection. + */ disconnect() { - const otherConnection = this.targetConnection; - if (!otherConnection) { - throw Error('Source connection not connected.'); - } - if (otherConnection.targetConnection !== this) { - throw Error('Target connection not connected to source connection.'); - } - let parentBlock; - let childBlock; - let parentConnection; - if (this.isSuperior()) { - // Superior block. - parentBlock = this.sourceBlock_; - childBlock = otherConnection.getSourceBlock(); - /* eslint-disable-next-line @typescript-eslint/no-this-alias */ - parentConnection = this; - } else { - // Inferior block. - parentBlock = otherConnection.getSourceBlock(); - childBlock = this.sourceBlock_; - parentConnection = otherConnection; - } - - const eventGroup = eventUtils.getGroup(); - if (!eventGroup) { - eventUtils.setGroup(true); - } - this.disconnectInternal_(parentBlock, childBlock); - if (!childBlock.isShadow()) { - // If we were disconnecting a shadow, no need to spawn a new one. - parentConnection.respawnShadow_(); - } - if (!eventGroup) { - eventUtils.setGroup(false); - } + this.disconnectInternal(); } /** * Disconnect two blocks that are connected by this connection. * - * @param parentBlock The superior block. - * @param childBlock The inferior block. + * @param setParent Whether to set the parent of the disconnected block or + * not, defaults to true. + * If you do not set the parent, ensure that a subsequent action does, + * otherwise the view and model will be out of sync. */ - protected disconnectInternal_(parentBlock: Block, childBlock: Block) { + protected disconnectInternal(setParent = true) { + const {parentConnection, childConnection} = + this.getParentAndChildConnections(); + if (!parentConnection || !childConnection) { + throw Error('Source connection not connected.'); + } + + const eventGroup = eventUtils.getGroup(); + if (!eventGroup) eventUtils.setGroup(true); + let event; if (eventUtils.isEnabled()) { - event = - new (eventUtils.get(eventUtils.BLOCK_MOVE))(childBlock) as BlockMove; + event = new (eventUtils.get(eventUtils.BLOCK_MOVE))( + childConnection.getSourceBlock()) as BlockMove; } const otherConnection = this.targetConnection; if (otherConnection) { otherConnection.targetConnection = null; } this.targetConnection = null; - childBlock.setParent(null); + if (setParent) childConnection.getSourceBlock().setParent(null); if (event) { event.recordNew(); eventUtils.fire(event); } + + if (!childConnection.getSourceBlock().isShadow()) { + // If we were disconnecting a shadow, no need to spawn a new one. + parentConnection.respawnShadow_(); + } + + if (!eventGroup) eventUtils.setGroup(false); + } + + /** + * Returns the parent connection (superior) and child connection (inferior) + * given this connection and the connection it is connected to. + * + * @returns The parent connection and child connection, given this connection + * and the connection it is connected to. + */ + protected getParentAndChildConnections(): + {parentConnection?: Connection, childConnection?: Connection} { + if (!this.targetConnection) return {}; + if (this.isSuperior()) { + return { + parentConnection: this, + childConnection: this.targetConnection, + }; + } + return { + parentConnection: this.targetConnection, + childConnection: this, + }; } /** diff --git a/core/contextmenu.ts b/core/contextmenu.ts index ec56d9038..8122b1b03 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -117,11 +117,15 @@ function populate_( if (option.enabled) { const actionHandler = function() { hide(); - // If .scope does not exist on the option, then the callback will not - // be expecting a scope parameter, so there should be no problems. Just - // assume it is a ContextMenuOption and we'll pass undefined if it's - // not. - option.callback((option as ContextMenuOption).scope); + requestAnimationFrame(() => { + setTimeout(() => { + // If .scope does not exist on the option, then the callback + // will not be expecting a scope parameter, so there should be + // no problems. Just assume it is a ContextMenuOption and we'll + // pass undefined if it's not. + option.callback((option as ContextMenuOption).scope); + }, 0); + }); }; menuItem.onAction(actionHandler, {}); } diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 8bb130964..6ca80f46f 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -180,19 +180,14 @@ export class InsertionMarkerManager { */ applyConnections() { if (!this.activeCandidate) return; - // Don't fire events for insertion markers. + const {local, closest} = this.activeCandidate; + local.connect(closest); eventUtils.disable(); this.hidePreview(); eventUtils.enable(); - const {local, closest} = this.activeCandidate; - // Connect two blocks together. - local.connect(closest); if (this.topBlock.rendered) { - // Trigger a connection animation. - // Determine which connection is inferior (lower in the source stack). const inferiorConnection = local.isSuperior() ? closest : local; blockAnimations.connectionUiEffect(inferiorConnection.getSourceBlock()); - // Bring the just-edited stack to the front. const rootBlock = this.topBlock.getRootBlock(); // bringToFront is incredibly expensive. Delay by at least a frame. @@ -608,38 +603,16 @@ export class InsertionMarkerManager { const markerConn = this.markerConnection; const imBlock = markerConn.getSourceBlock(); - const markerNext = imBlock.nextConnection; const markerPrev = imBlock.previousConnection; const markerOutput = imBlock.outputConnection; - const isNext = markerConn === markerNext; - - const isFirstInStatementStack = - isNext && !(markerPrev && markerPrev.targetConnection); - - const isFirstInOutputStack = - markerConn.type === ConnectionType.INPUT_VALUE && - !(markerOutput && markerOutput.targetConnection); - // The insertion marker is the first block in a stack. Unplug won't do - // anything in that case. Instead, unplug the following block. - if (isFirstInStatementStack || isFirstInOutputStack) { - markerConn.targetBlock()!.unplug(false); - } else if (markerConn.type === ConnectionType.NEXT_STATEMENT && !isNext) { - // Inside of a C-block, first statement connection. - const innerConnection = markerConn.targetConnection; - if (innerConnection) { - innerConnection.getSourceBlock().unplug(false); - } - - const previousBlockNextConnection = - markerPrev ? markerPrev.targetConnection : null; - - imBlock.unplug(true); - if (previousBlockNextConnection && innerConnection) { - previousBlockNextConnection.connect(innerConnection); - } + if (!markerPrev?.targetConnection && !markerOutput?.targetConnection) { + // If we are the top block, unplugging doesn't do anything. + // The marker connection may not have a target block if we are hiding + // as part of applying connections. + markerConn.targetBlock()?.unplug(false); } else { - imBlock.unplug(/* healStack */ true); + imBlock.unplug(true); } if (markerConn.targetConnection) { diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 42cd94680..6d7a8fc99 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -477,23 +477,27 @@ export class RenderedConnection extends Connection { /** * Disconnect two blocks that are connected by this connection. * - * @param parentBlock The superior block. - * @param childBlock The inferior block. + * @param setParent Whether to set the parent of the disconnected block or + * not, defaults to true. + * If you do not set the parent, ensure that a subsequent action does, + * otherwise the view and model will be out of sync. */ - protected override disconnectInternal_( - parentBlock: Block, childBlock: Block) { - super.disconnectInternal_(parentBlock, childBlock); - const renderedParent = parentBlock as BlockSvg; - const renderedChild = childBlock as BlockSvg; + override disconnectInternal(setParent = true) { + const {parentConnection, childConnection} = + this.getParentAndChildConnections(); + if (!parentConnection || !childConnection) return; + const parent = parentConnection.getSourceBlock() as BlockSvg; + const child = childConnection.getSourceBlock() as BlockSvg; + super.disconnectInternal(setParent); // Rerender the parent so that it may reflow. - if (renderedParent.rendered) { - renderedParent.queueRender(); + if (parent.rendered) { + parent.queueRender(); } - if (renderedChild.rendered) { - renderedChild.updateDisabled(); - renderedChild.queueRender(); + if (child.rendered) { + child.updateDisabled(); + child.queueRender(); // Reset visibility, since the child is now a top block. - renderedChild.getSvgRoot().style.display = 'block'; + child.getSvgRoot().style.display = 'block'; } } diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index 88ffc5100..093c8ebba 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -1828,25 +1828,6 @@ suite('Blocks', function() { chai.assert.isFalse(blockB.disabled); chai.assert.isFalse(blockB.getSvgRoot().classList.contains('blocklyDisabled')); }); - test('Children of Collapsed Block Should Not Update', function() { - const blockA = createRenderedBlock(this.workspace, 'statement_block'); - const blockB = createRenderedBlock(this.workspace, 'stack_block'); - blockA.getInput('STATEMENT').connection - .connect(blockB.previousConnection); - - // Disable the block and collapse it. - blockA.setEnabled(false); - blockA.setCollapsed(true); - - const blockUpdateDisabled = sinon.stub(blockB, 'updateDisabled'); - - // Enable the block before expanding it. - blockA.setEnabled(true); - - // For performance reasons updateDisabled should not be called - // on children of collapsed blocks. - sinon.assert.notCalled(blockUpdateDisabled); - }); test('Disabled Children of Collapsed Blocks Should Stay Disabled', function() { const blockA = createRenderedBlock(this.workspace, 'statement_block'); const blockB = createRenderedBlock(this.workspace, 'stack_block'); From 670f7da8024e446cdb1e10b69bce7a2e8d79a27b Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 16 Mar 2023 15:28:25 -0700 Subject: [PATCH 118/141] fix: dispose performance (#6894) * fix: improve dispose performance * chore: cleanup dispose functions * chore: split dispose into dispose and disposeInternal * chore: remove unnecessary node removal * fix: remove unnecessary unbinding of event listeners * fix: readd skipping event construction * chore: work on fixing tests * chore: fix remaining test failures * chore: format * chore: typo * fix: first pass of PR comments * chore: remove TODO --- core/block.ts | 47 ++++++++++--------- core/block_animations.ts | 3 ++ core/block_svg.ts | 64 ++++++++++---------------- core/connection.ts | 3 +- core/field.ts | 7 +-- core/icon.ts | 6 ++- core/tooltip.ts | 2 + tests/mocha/connection_checker_test.js | 4 +- tests/mocha/event_block_delete_test.js | 20 +++++++- tests/mocha/serializer_test.js | 2 +- 10 files changed, 82 insertions(+), 76 deletions(-) diff --git a/core/block.ts b/core/block.ts index 4d22b1886..c8932277f 100644 --- a/core/block.ts +++ b/core/block.ts @@ -312,44 +312,45 @@ export class Block implements IASTNodeLocation, IDeletable { * @suppress {checkTypes} */ dispose(healStack: boolean) { - if (this.isDeadOrDying()) { - return; - } - // Terminate onchange event calls. + if (this.isDeadOrDying()) return; + + // Dispose of this change listener before unplugging. + // Technically not necessary due to the event firing delay. + // But future-proofing. if (this.onchangeWrapper_) { this.workspace.removeChangeListener(this.onchangeWrapper_); } this.unplug(healStack); if (eventUtils.isEnabled()) { + // Constructing the delete event is costly. Only perform if necessary. eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_DELETE))(this)); } - eventUtils.disable(); + this.workspace.removeTopBlock(this); + this.disposeInternal(); + } + /** + * Disposes of this block without doing things required by the top block. + * E.g. does not fire events, unplug the block, etc. + */ + protected disposeInternal() { + if (this.isDeadOrDying()) return; + + if (this.onchangeWrapper_) { + this.workspace.removeChangeListener(this.onchangeWrapper_); + } + + eventUtils.disable(); try { - // This block is now at the top of the workspace. - // Remove this block from the workspace's list of top-most blocks. - this.workspace.removeTopBlock(this); this.workspace.removeTypedBlock(this); - // Remove from block database. this.workspace.removeBlockById(this.id); this.disposing = true; - // First, dispose of all my children. - for (let i = this.childBlocks_.length - 1; i >= 0; i--) { - this.childBlocks_[i].dispose(false); - } - // Then dispose of myself. - // Dispose of all inputs and their fields. - for (let i = 0, input; input = this.inputList[i]; i++) { - input.dispose(); - } + this.childBlocks_.forEach((c) => c.disposeInternal()); + this.inputList.forEach((i) => i.dispose()); this.inputList.length = 0; - // Dispose of any remaining connections (next/previous/output). - const connections = this.getConnections_(true); - for (let i = 0, connection; connection = connections[i]; i++) { - connection.dispose(); - } + this.getConnections_(true).forEach((c) => c.dispose()); } finally { eventUtils.enable(); if (typeof this.destroy === 'function') { diff --git a/core/block_animations.ts b/core/block_animations.ts index 9378498a9..065b4ee51 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -39,6 +39,9 @@ let wobblingBlock: BlockSvg|null = null; * @internal */ export function disposeUiEffect(block: BlockSvg) { + // Disposing is going to take so long the animation won't play anyway. + if (block.getDescendants(false).length > 100) return; + const workspace = block.workspace; const svgGroup = block.getSvgRoot(); workspace.getAudioManager().play('delete'); diff --git a/core/block_svg.ts b/core/block_svg.ts index 4f3ec2844..b463c64c6 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -841,55 +841,39 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, * @suppress {checkTypes} */ override dispose(healStack?: boolean, animate?: boolean) { - if (this.isDeadOrDying()) { - return; - } + if (this.isDeadOrDying()) return; + Tooltip.dispose(); - Tooltip.unbindMouseEvents(this.pathObject.svgPath); - dom.startTextWidthCache(); - // Save the block's workspace temporarily so we can resize the - // contents once the block is disposed. - const blockWorkspace = this.workspace; - // If this block is being dragged, unlink the mouse events. - if (common.getSelected() === this) { - this.unselect(); - this.workspace.cancelCurrentGesture(); - } - // If this block has a context menu open, close it. - if (ContextMenu.getCurrentBlock() === this) { - ContextMenu.hide(); - } + ContextMenu.hide(); if (animate && this.rendered) { this.unplug(healStack); blockAnimations.disposeUiEffect(this); } - // Stop rerendering. - this.rendered = false; - - // Clear pending warnings. - for (const n of this.warningTextDb.values()) { - clearTimeout(n); - } - this.warningTextDb.clear(); - - const icons = this.getIcons(); - for (let i = 0; i < icons.length; i++) { - icons[i].dispose(); - } - - // Just deleting this block from the DOM would result in a memory leak as - // well as corruption of the connection database. Therefore we must - // methodically step through the blocks and carefully disassemble them. - if (common.getSelected() === this) { - common.setSelected(null); - } super.dispose(!!healStack); - dom.removeNode(this.svgGroup_); - blockWorkspace.resizeContents(); - dom.stopTextWidthCache(); + } + + /** + * Disposes of this block without doing things required by the top block. + * E.g. does trigger UI effects, remove nodes, etc. + */ + override disposeInternal() { + if (this.isDeadOrDying()) return; + super.disposeInternal(); + + this.rendered = false; + + if (common.getSelected() === this) { + this.unselect(); + this.workspace.cancelCurrentGesture(); + } + + [...this.warningTextDb.values()].forEach((n) => clearTimeout(n)); + this.warningTextDb.clear(); + + this.getIcons().forEach((i) => i.dispose()); } /** diff --git a/core/connection.ts b/core/connection.ts index 485f3895e..d6e046b3b 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -150,7 +150,7 @@ export class Connection implements IASTNodeLocationWithBlock { this.setShadowStateInternal_(); const targetBlock = this.targetBlock(); - if (targetBlock) { + if (targetBlock && !targetBlock.isDeadOrDying()) { // Disconnect the attached normal block. targetBlock.unplug(); } @@ -552,6 +552,7 @@ export class Connection implements IASTNodeLocationWithBlock { } } else if (target.isShadow()) { target.dispose(false); + if (this.getSourceBlock().isDeadOrDying()) return; this.respawnShadow_(); if (this.targetBlock() && this.targetBlock()!.isShadow()) { this.serializeShadow_(this.targetBlock()); diff --git a/core/field.ts b/core/field.ts index 0c163e038..ff5663599 100644 --- a/core/field.ts +++ b/core/field.ts @@ -489,14 +489,11 @@ export abstract class Field implements IASTNodeLocationSvg, dispose() { dropDownDiv.hideIfOwner(this); WidgetDiv.hideIfOwner(this); - Tooltip.unbindMouseEvents(this.getClickTarget_()); - if (this.mouseDownWrapper_) { - browserEvents.unbind(this.mouseDownWrapper_); + if (!this.getSourceBlock()?.isDeadOrDying()) { + dom.removeNode(this.fieldGroup_); } - dom.removeNode(this.fieldGroup_); - this.disposed = true; } diff --git a/core/icon.ts b/core/icon.ts index 791f835d2..5d8002165 100644 --- a/core/icon.ts +++ b/core/icon.ts @@ -79,8 +79,10 @@ export abstract class Icon { /** Dispose of this icon. */ dispose() { - dom.removeNode(this.iconGroup_); // Dispose of and unlink the icon. - this.setVisible(false); // Dispose of and unlink the bubble. + if (!this.getBlock().isDeadOrDying()) { + dom.removeNode(this.iconGroup_); + } + this.setVisible(false); // Dispose of and unlink the bubble. } /** Add or remove the UI indicating if this icon may be clicked or not. */ diff --git a/core/tooltip.ts b/core/tooltip.ts index 50a2a1e2a..e907561a4 100644 --- a/core/tooltip.ts +++ b/core/tooltip.ts @@ -276,6 +276,7 @@ function onMouseOut(_e: PointerEvent) { hide(); }, 1); clearTimeout(showPid); + showPid = 0; } /** @@ -342,6 +343,7 @@ export function hide() { } if (showPid) { clearTimeout(showPid); + showPid = 0; } } diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js index 7636d7af3..11b9545c1 100644 --- a/tests/mocha/connection_checker_test.js +++ b/tests/mocha/connection_checker_test.js @@ -386,7 +386,7 @@ suite('Connection checker', function() { }); test('Connect to unconnected unmovable block', function() { - // Delete blockA. + this.blockB.previousConnection.disconnect(); this.blockA.dispose(); // Try to connect blockC above blockB. @@ -436,7 +436,7 @@ suite('Connection checker', function() { }); test('Connect to unconnected unmovable block', function() { - // Delete blockA + this.blockB.outputConnection.disconnect(); this.blockA.dispose(); // Try to connect C's input to B's output. Allowed because B is now unconnected. diff --git a/tests/mocha/event_block_delete_test.js b/tests/mocha/event_block_delete_test.js index e5aed21c5..0a9c9c894 100644 --- a/tests/mocha/event_block_delete_test.js +++ b/tests/mocha/event_block_delete_test.js @@ -6,13 +6,12 @@ goog.declareModuleId('Blockly.test.eventBlockDelete'); -import * as eventUtils from '../../build/src/core/events/utils.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js'; suite('Block Delete Event', function() { setup(function() { - sharedTestSetup.call(this); + this.clock = sharedTestSetup.call(this, {fireEventsNow: false}).clock; defineRowBlock(); this.workspace = new Blockly.Workspace(); }); @@ -21,6 +20,23 @@ suite('Block Delete Event', function() { sharedTestTeardown.call(this); }); + suite('Receiving', function() { + test('blocks do not receive their own delete events', function() { + Blockly.Blocks['test'] = { + onchange: function(e) { }, + }; + // Need to stub the definition, because the property on the definition is + // what gets registered as an event listener. + const spy = sinon.spy(Blockly.Blocks['test'], 'onchange'); + const testBlock = this.workspace.newBlock('test'); + + testBlock.dispose(); + this.clock.runAll(); + + chai.assert.isFalse(spy.called); + }); + }); + suite('Serialization', function() { test('events round-trip through JSON', function() { const block = this.workspace.newBlock('row_block', 'block_id'); diff --git a/tests/mocha/serializer_test.js b/tests/mocha/serializer_test.js index 0a09b1725..d45cd40c3 100644 --- a/tests/mocha/serializer_test.js +++ b/tests/mocha/serializer_test.js @@ -1866,7 +1866,7 @@ const runSerializerTestSuite = (serializer, deserializer, testSuite) => { suiteCall(testSuite.title, function() { setup(function() { - sharedTestSetup.call(this); + sharedTestSetup.call(this, {fireEventsNow: false}); this.workspace = new Blockly.Workspace(); }); From a0b4a214a9802d03fd5e7efe115552ce521bd70f Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 17 Mar 2023 15:36:44 +0000 Subject: [PATCH 119/141] refactor(blocks): Migrate `blocks/colour.js` to TypeScript (#6901) * refactor(blocks): Auto-migration of blocks/colour.js to ts * fix(blocks): Manually migrate types & fix imports in colour.ts --- blocks/{colour.js => colour.ts} | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) rename blocks/{colour.js => colour.ts} (82%) diff --git a/blocks/colour.js b/blocks/colour.ts similarity index 82% rename from blocks/colour.js rename to blocks/colour.ts index 236b97c5c..b01c047b7 100644 --- a/blocks/colour.js +++ b/blocks/colour.ts @@ -7,24 +7,19 @@ /** * @fileoverview Colour blocks for Blockly. */ -'use strict'; -goog.module('Blockly.libraryBlocks.colour'); +import * as goog from '../closure/goog/goog.js'; +goog.declareModuleId('Blockly.libraryBlocks.colour'); -// const {BlockDefinition} = goog.requireType('Blockly.blocks'); -// TODO (6248): Properly import the BlockDefinition type. -/* eslint-disable-next-line no-unused-vars */ -const BlockDefinition = Object; -const {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common'); -/** @suppress {extraRequire} */ -goog.require('Blockly.FieldColour'); +import type {BlockDefinition} from '../core/blocks.js'; +import {createBlockDefinitionsFromJsonArray, defineBlocks} from '../core/common.js'; +import '../core/field_colour.js'; /** * A dictionary of the block definitions provided by this module. - * @type {!Object} */ -const blocks = createBlockDefinitionsFromJsonArray([ +export const blocks = createBlockDefinitionsFromJsonArray([ // Block for colour picker. { 'type': 'colour_picker', @@ -115,7 +110,6 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'tooltip': '%{BKY_COLOUR_BLEND_TOOLTIP}', }, ]); -exports.blocks = blocks; // Register provided blocks. defineBlocks(blocks); From 6f64d1801a3147dcd71b1aca12f54dbbb28e2c76 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Fri, 17 Mar 2023 20:09:51 +0100 Subject: [PATCH 120/141] fix: Don't clober event group when renaming vars (#6829) * fix: Don't clober event group when renaming vars Also audit all existing event group commands and tweak a few of them where I think there's a potential issue. --- core/block.ts | 4 +--- core/bump_objects.ts | 6 ++---- core/connection.ts | 16 ++++++++-------- core/contextmenu_items.ts | 29 +++++++++++++++-------------- core/rendered_connection.ts | 2 +- core/variable_map.ts | 11 ++++++----- core/workspace.ts | 4 +--- core/workspace_comment.ts | 4 +--- core/workspace_svg.ts | 23 ++++++++++++----------- core/xml.ts | 4 +--- 10 files changed, 48 insertions(+), 55 deletions(-) diff --git a/core/block.ts b/core/block.ts index c8932277f..33dc56af3 100644 --- a/core/block.ts +++ b/core/block.ts @@ -289,9 +289,7 @@ export class Block implements IASTNodeLocation, IDeletable { eventUtils.fire(new (eventUtils.get(eventUtils.BLOCK_CREATE))(this)); } } finally { - if (!existingGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); // In case init threw, recordUndo flag should still be reset. eventUtils.setRecordUndo(initialUndoFlag); } diff --git a/core/bump_objects.ts b/core/bump_objects.ts index 301d65a96..873b007aa 100644 --- a/core/bump_objects.ts +++ b/core/bump_objects.ts @@ -105,7 +105,7 @@ export function bumpIntoBoundsHandler(workspace: WorkspaceSvg): return; } // Handle undo. - const oldGroup = eventUtils.getGroup(); + const existingGroup = eventUtils.getGroup() || false; eventUtils.setGroup(e.group); const wasBumped = bumpObjectIntoBounds( @@ -116,9 +116,7 @@ export function bumpIntoBoundsHandler(workspace: WorkspaceSvg): 'Moved object in bounds but there was no' + ' event group. This may break undo.'); } - if (oldGroup !== null) { - eventUtils.setGroup(oldGroup); - } + eventUtils.setGroup(existingGroup); } else if (e.type === eventUtils.VIEWPORT_CHANGE) { const viewportEvent = (e as ViewportChange); if (viewportEvent.scale && viewportEvent.oldScale && diff --git a/core/connection.ts b/core/connection.ts index d6e046b3b..ee7ab8b99 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -223,8 +223,8 @@ export class Connection implements IASTNodeLocationWithBlock { const checker = this.getConnectionChecker(); if (checker.canConnect(this, otherConnection, false)) { - const eventGroup = eventUtils.getGroup(); - if (!eventGroup) { + const existingGroup = eventUtils.getGroup(); + if (!existingGroup) { eventUtils.setGroup(true); } // Determine which block is superior (higher in the source stack). @@ -235,9 +235,7 @@ export class Connection implements IASTNodeLocationWithBlock { // Inferior block. otherConnection.connect_(this); } - if (!eventGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); } return this.isConnected(); @@ -265,8 +263,10 @@ export class Connection implements IASTNodeLocationWithBlock { throw Error('Source connection not connected.'); } - const eventGroup = eventUtils.getGroup(); - if (!eventGroup) eventUtils.setGroup(true); + const existingGroup = eventUtils.getGroup(); + if (!existingGroup) { + eventUtils.setGroup(true); + } let event; if (eventUtils.isEnabled()) { @@ -289,7 +289,7 @@ export class Connection implements IASTNodeLocationWithBlock { parentConnection.respawnShadow_(); } - if (!eventGroup) eventUtils.setGroup(false); + eventUtils.setGroup(existingGroup); } /** diff --git a/core/contextmenu_items.ts b/core/contextmenu_items.ts index 667e0896f..81c1003e0 100644 --- a/core/contextmenu_items.ts +++ b/core/contextmenu_items.ts @@ -20,7 +20,6 @@ import * as Events from './events/events.js'; import * as eventUtils from './events/utils.js'; import {inputTypes} from './input_types.js'; import {Msg} from './msg.js'; -import * as idGenerator from './utils/idgenerator.js'; import type {WorkspaceSvg} from './workspace_svg.js'; @@ -230,13 +229,18 @@ function getDeletableBlocks_(workspace: WorkspaceSvg): BlockSvg[] { /** * Deletes the given blocks. Used to delete all blocks in the workspace. * - * @param deleteList list of blocks to delete. - * @param eventGroup event group ID with which all delete events should be - * associated. + * @param deleteList List of blocks to delete. + * @param eventGroup Event group ID with which all delete events should be + * associated. If not specified, create a new group. */ -function deleteNext_(deleteList: BlockSvg[], eventGroup: string) { +function deleteNext_(deleteList: BlockSvg[], eventGroup?: string) { const DELAY = 10; - eventUtils.setGroup(eventGroup); + if (eventGroup) { + eventUtils.setGroup(eventGroup); + } else { + eventUtils.setGroup(true); + eventGroup = eventUtils.getGroup(); + } const block = deleteList.shift(); if (block) { if (!block.isDeadOrDying()) { @@ -277,16 +281,15 @@ export function registerDeleteAll() { } scope.workspace.cancelCurrentGesture(); const deletableBlocks = getDeletableBlocks_(scope.workspace); - const eventGroup = idGenerator.genUid(); if (deletableBlocks.length < 2) { - deleteNext_(deletableBlocks, eventGroup); + deleteNext_(deletableBlocks); } else { dialog.confirm( Msg['DELETE_ALL_BLOCKS'].replace( '%1', String(deletableBlocks.length)), function(ok) { if (ok) { - deleteNext_(deletableBlocks, eventGroup); + deleteNext_(deletableBlocks); } }); } @@ -455,14 +458,12 @@ export function registerDisable() { }, callback(scope: Scope) { const block = scope.block; - const group = eventUtils.getGroup(); - if (!group) { + const existingGroup = eventUtils.getGroup(); + if (!existingGroup) { eventUtils.setGroup(true); } block!.setEnabled(!block!.isEnabled()); - if (!group) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); }, scopeType: ContextMenuRegistry.ScopeType.BLOCK, id: 'blockDisable', diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 6d7a8fc99..1e91778af 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -452,7 +452,7 @@ export class RenderedConnection extends Connection { } /** - * Behavior after a connection attempt fails. + * Behaviour after a connection attempt fails. * Bumps this connection away from the other connection. Called when an * attempted connection fails. * diff --git a/core/variable_map.ts b/core/variable_map.ts index 7ef809b53..722c51b12 100644 --- a/core/variable_map.ts +++ b/core/variable_map.ts @@ -69,7 +69,10 @@ export class VariableMap { const type = variable.type; const conflictVar = this.getVariable(newName, type); const blocks = this.workspace.getAllBlocks(false); - eventUtils.setGroup(true); + const existingGroup = eventUtils.getGroup(); + if (!existingGroup) { + eventUtils.setGroup(true); + } try { // The IDs may match if the rename is a simple case change (name1 -> // Name1). @@ -80,7 +83,7 @@ export class VariableMap { variable, newName, conflictVar, blocks); } } finally { - eventUtils.setGroup(false); + eventUtils.setGroup(existingGroup); } } @@ -284,9 +287,7 @@ export class VariableMap { } this.deleteVariable(variable); } finally { - if (!existingGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); } } /* End functions for variable deletion. */ diff --git a/core/workspace.ts b/core/workspace.ts index 61cbb3fa7..04a03eb91 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -359,9 +359,7 @@ export class Workspace implements IASTNodeLocation { while (this.topComments.length) { this.topComments[this.topComments.length - 1].dispose(); } - if (!existingGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); this.variableMap.clear(); if (this.potentialVariableMap) { this.potentialVariableMap.clear(); diff --git a/core/workspace_comment.ts b/core/workspace_comment.ts index 6745a1bb2..88418da82 100644 --- a/core/workspace_comment.ts +++ b/core/workspace_comment.ts @@ -307,9 +307,7 @@ export class WorkspaceComment { eventUtils.fire( new (eventUtils.get(eventUtils.COMMENT_CREATE))(comment)); } finally { - if (!existingGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); } } } diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index d186772bc..7ac747c14 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -1366,21 +1366,22 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (!existingGroup) { eventUtils.setGroup(true); } - let pastedThing; - // Checks if this is JSON. JSON has a type property, while elements don't. - if (state['type']) { - pastedThing = this.pasteBlock_(null, state as blocks.State); - } else { - const xmlBlock = state as Element; - if (xmlBlock.tagName.toLowerCase() === 'comment') { - pastedThing = this.pasteWorkspaceComment_(xmlBlock); + try { + // Checks if this is JSON. JSON has a type property, while elements don't. + if (state['type']) { + pastedThing = this.pasteBlock_(null, state as blocks.State); } else { - pastedThing = this.pasteBlock_(xmlBlock, null); + const xmlBlock = state as Element; + if (xmlBlock.tagName.toLowerCase() === 'comment') { + pastedThing = this.pasteWorkspaceComment_(xmlBlock); + } else { + pastedThing = this.pasteBlock_(xmlBlock, null); + } } + } finally { + eventUtils.setGroup(existingGroup); } - - eventUtils.setGroup(existingGroup); return pastedThing; } diff --git a/core/xml.ts b/core/xml.ts index 473ffdb51..bf54caf4a 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -463,9 +463,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { } } } finally { - if (!existingGroup) { - eventUtils.setGroup(false); - } + eventUtils.setGroup(existingGroup); dom.stopTextWidthCache(); } // Re-enable workspace resizing. From a7c342ec29472d538faeba9d1db8b5524d40e096 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 17 Mar 2023 12:36:48 -0700 Subject: [PATCH 121/141] chore: force add the build files when updating gh-pages (#6904) --- scripts/gulpfiles/git_tasks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/gulpfiles/git_tasks.js b/scripts/gulpfiles/git_tasks.js index eb3a825c0..f21180e84 100644 --- a/scripts/gulpfiles/git_tasks.js +++ b/scripts/gulpfiles/git_tasks.js @@ -112,7 +112,8 @@ const updateGithubPages = gulp.series( packageTasks.cleanReleaseDir, buildTasks.build, function(done) { - execSync('git add build/msg/* dist/*_compressed.js*', {stdio: 'inherit'}); + // The build and dist directories are normally gitignored, so we have to force add. + execSync('git add -f build/msg/* dist/*_compressed.js*', {stdio: 'inherit'}); execSync('git commit -am "Rebuild"', {stdio: 'inherit'}); execSync('git push ' + upstream_url + ' gh-pages --force', {stdio: 'inherit'}); From bb9f31853dfb2e148ac655a05420c413d083568a Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 17 Mar 2023 20:24:09 +0000 Subject: [PATCH 122/141] refactor(blocks): Migrate `blocks/math.js` to TypeScript (#6900) * refactor(blocks): Auto-migration of blocks/math.js to ts This is just the result of running js2ts on this file. * fix(blocks): Manually migrate & fix types in math.ts * chore(blocks): clang-format math.ts * fix(blocks): Corrections for comments on PR #6900 * refactor(blocks): Define types for mixin-ed blocks, etc. Define types to represent the union of Block and each of the *_MIXINs, and use these types for the type of this in mixin methods. * refactor(blocks): Misc minor changes Make sure validator functions explicitly return undefined. Field.prototype.setValidator takes a FieldValidator, which must be a non-void function. I'm not sure why tsc was not objecting to the void implementation here, but it does in other very similar situations so for consistency explicitly return undefined to signal the value should be used unchanged. Also undo previous change of !. to ?.: I think it wisest to try to preserve the existing behaviour as exactly as possible for now, and make behaviour changes (i.e., ones that affect the generated code) separately. * fix(blocks): Fix erroneous typing of mixins It turns out that the previous types for these were completely wrong, for two reasons: - They should be intersection types (which have the union of the properties), not union types (which have the interseciton of the properties). - The *_MIXIN types were already declared as having type BlockDefinition, which is ultimately an alias for any. TypeScript doesn't like (some) kinds of circularly defined types, so fixing the above necessitates declaring a few auxiliary types just to make the type checker happy - but the end result is excellent and caught an actual type error in the code. --- blocks/{math.js => math.ts} | 134 +++++++++++++++++------------------- 1 file changed, 63 insertions(+), 71 deletions(-) rename blocks/{math.js => math.ts} (82%) diff --git a/blocks/math.js b/blocks/math.ts similarity index 82% rename from blocks/math.js rename to blocks/math.ts index b6ade7f89..1fdaf3807 100644 --- a/blocks/math.js +++ b/blocks/math.ts @@ -6,37 +6,28 @@ /** * @fileoverview Math blocks for Blockly. - * @suppress {checkTypes} */ -'use strict'; -goog.module('Blockly.libraryBlocks.math'); +import * as goog from '../closure/goog/goog.js'; +goog.declareModuleId('Blockly.libraryBlocks.math'); -const Extensions = goog.require('Blockly.Extensions'); -// N.B.: Blockly.FieldDropdown needed for type AND side-effects. -/* eslint-disable-next-line no-unused-vars */ -const FieldDropdown = goog.require('Blockly.FieldDropdown'); -const xmlUtils = goog.require('Blockly.utils.xml'); -/* eslint-disable-next-line no-unused-vars */ -const {Block} = goog.requireType('Blockly.Block'); -// const {BlockDefinition} = goog.requireType('Blockly.blocks'); -// TODO (6248): Properly import the BlockDefinition type. -/* eslint-disable-next-line no-unused-vars */ -const BlockDefinition = Object; -const {createBlockDefinitionsFromJsonArray, defineBlocks} = goog.require('Blockly.common'); -/** @suppress {extraRequire} */ -goog.require('Blockly.FieldLabel'); -/** @suppress {extraRequire} */ -goog.require('Blockly.FieldNumber'); -/** @suppress {extraRequire} */ -goog.require('Blockly.FieldVariable'); +import * as Extensions from '../core/extensions.js'; +import type {Field} from '../core/field.js'; +import type {FieldDropdown} from '../core/field_dropdown.js'; +import * as xmlUtils from '../core/utils/xml.js'; +import type {Block} from '../core/block.js'; +import type {BlockDefinition} from '../core/blocks.js'; +import {createBlockDefinitionsFromJsonArray, defineBlocks} from '../core/common.js'; +import '../core/field_dropdown.js'; +import '../core/field_label.js'; +import '../core/field_number.js'; +import '../core/field_variable.js'; /** * A dictionary of the block definitions provided by this module. - * @type {!Object} */ -const blocks = createBlockDefinitionsFromJsonArray([ +export const blocks = createBlockDefinitionsFromJsonArray([ // Block for numeric value. { 'type': 'math_number', @@ -391,11 +382,11 @@ const blocks = createBlockDefinitionsFromJsonArray([ 'helpUrl': '%{BKY_MATH_ATAN2_HELPURL}', }, ]); -exports.blocks = blocks; /** * Mapping of math block OP value to tooltip message for blocks * math_arithmetic, math_simple, math_trig, and math_on_lists. + * * @see {Extensions#buildTooltipForDropdown} * @package * @readonly @@ -440,10 +431,15 @@ Extensions.register( 'math_op_tooltip', Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP)); +/** Type of a block that has IS_DIVISBLEBY_MUTATOR_MIXIN */ +type DivisiblebyBlock = Block&DivisiblebyMixin; +interface DivisiblebyMixin extends DivisiblebyMixinType {}; +type DivisiblebyMixinType = typeof IS_DIVISIBLEBY_MUTATOR_MIXIN; /** * Mixin for mutator functions in the 'math_is_divisibleby_mutator' * extension. + * * @mixin * @augments Block * @package @@ -452,22 +448,22 @@ const IS_DIVISIBLEBY_MUTATOR_MIXIN = { /** * Create XML to represent whether the 'divisorInput' should be present. * Backwards compatible serialization implementation. - * @return {!Element} XML storage element. - * @this {Block} + * + * @returns XML storage element. */ - mutationToDom: function() { + mutationToDom: function(this: DivisiblebyBlock): Element { const container = xmlUtils.createElement('mutation'); const divisorInput = (this.getFieldValue('PROPERTY') === 'DIVISIBLE_BY'); - container.setAttribute('divisor_input', divisorInput); + container.setAttribute('divisor_input', String(divisorInput)); return container; }, /** * Parse XML to restore the 'divisorInput'. * Backwards compatible serialization implementation. - * @param {!Element} xmlElement XML storage element. - * @this {Block} + * + * @param xmlElement XML storage element. */ - domToMutation: function(xmlElement) { + domToMutation: function(this: DivisiblebyBlock, xmlElement: Element) { const divisorInput = (xmlElement.getAttribute('divisor_input') === 'true'); this.updateShape_(divisorInput); }, @@ -479,11 +475,10 @@ const IS_DIVISIBLEBY_MUTATOR_MIXIN = { /** * Modify this block to have (or not have) an input for 'is divisible by'. - * @param {boolean} divisorInput True if this block has a divisor input. - * @private - * @this {Block} + * + * @param divisorInput True if this block has a divisor input. */ - updateShape_: function(divisorInput) { + updateShape_: function(this: DivisiblebyBlock, divisorInput: boolean) { // Add or remove a Value Input. const inputExists = this.getInput('DIVISOR'); if (divisorInput) { @@ -500,20 +495,15 @@ const IS_DIVISIBLEBY_MUTATOR_MIXIN = { * 'math_is_divisibleby_mutator' extension to the 'math_property' block that * can update the block shape (add/remove divisor input) based on whether * property is "divisible by". - * @this {Block} - * @package */ -const IS_DIVISIBLE_MUTATOR_EXTENSION = function() { - this.getField('PROPERTY') - .setValidator( - /** - * @this {FieldDropdown} - * @param {*} option The selected dropdown option. - */ - function(option) { - const divisorInput = (option === 'DIVISIBLE_BY'); - this.getSourceBlock().updateShape_(divisorInput); - }); +const IS_DIVISIBLE_MUTATOR_EXTENSION = function(this: DivisiblebyBlock) { + this.getField('PROPERTY')!.setValidator( + /** @param option The selected dropdown option. */ + function(this: FieldDropdown, option: string) { + const divisorInput = (option === 'DIVISIBLE_BY'); + (this.getSourceBlock() as DivisiblebyBlock).updateShape_(divisorInput); + return undefined; // FieldValidators can't be void. Use option as-is. + }); }; Extensions.registerMutator( @@ -525,35 +515,35 @@ Extensions.register( 'math_change_tooltip', Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR')); +/** Type of a block that has LIST_MODES_MUTATOR_MIXIN */ +type ListModesBlock = Block&ListModesMixin; +interface ListModesMixin extends ListModesMixinType {}; +type ListModesMixinType = typeof LIST_MODES_MUTATOR_MIXIN; + /** * Mixin with mutator methods to support alternate output based if the * 'math_on_list' block uses the 'MODE' operation. - * @mixin - * @augments Block - * @package - * @readonly */ const LIST_MODES_MUTATOR_MIXIN = { /** * Modify this block to have the correct output type. - * @param {string} newOp Either 'MODE' or some op than returns a number. - * @private - * @this {Block} + * + * @param newOp Either 'MODE' or some op than returns a number. */ - updateType_: function(newOp) { + updateType_: function(this: ListModesBlock, newOp: string) { if (newOp === 'MODE') { - this.outputConnection.setCheck('Array'); + this.outputConnection!.setCheck('Array'); } else { - this.outputConnection.setCheck('Number'); + this.outputConnection!.setCheck('Number'); } }, /** * Create XML to represent the output type. * Backwards compatible serialization implementation. - * @return {!Element} XML storage element. - * @this {Block} + * + * @returns XML storage element. */ - mutationToDom: function() { + mutationToDom: function(this: ListModesBlock): Element { const container = xmlUtils.createElement('mutation'); container.setAttribute('op', this.getFieldValue('OP')); return container; @@ -561,11 +551,13 @@ const LIST_MODES_MUTATOR_MIXIN = { /** * Parse XML to restore the output type. * Backwards compatible serialization implementation. - * @param {!Element} xmlElement XML storage element. - * @this {Block} + * + * @param xmlElement XML storage element. */ - domToMutation: function(xmlElement) { - this.updateType_(xmlElement.getAttribute('op')); + domToMutation: function(this: ListModesBlock, xmlElement: Element) { + const op = xmlElement.getAttribute('op'); + if (op === null) throw new TypeError('xmlElement had no op attribute'); + this.updateType_(op); }, // This block does not need JSO serialization hooks (saveExtraState and @@ -577,13 +569,13 @@ const LIST_MODES_MUTATOR_MIXIN = { /** * Extension to 'math_on_list' blocks that allows support of * modes operation (outputs a list of numbers). - * @this {Block} - * @package */ -const LIST_MODES_MUTATOR_EXTENSION = function() { - this.getField('OP').setValidator(function(newOp) { - this.updateType_(newOp); - }.bind(this)); +const LIST_MODES_MUTATOR_EXTENSION = function(this: ListModesBlock) { + this.getField('OP')!.setValidator( + function(this: ListModesBlock, newOp: string) { + this.updateType_(newOp); + return undefined; + }.bind(this)); }; Extensions.registerMutator( From 5cdd2bf65f51627bbf00e9bb5637351bd172541d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 09:06:08 -0700 Subject: [PATCH 123/141] chore(deps): bump peter-evans/create-pull-request from 4.2.3 to 4.2.4 (#6910) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.2.3 to 4.2.4. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/2b011faafdcbc9ceb11414d64d0573f37c774b04...38e0b6e68b4c852a5500a94740f0e535e0d7ba54) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-patch ... 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 b6cfdaf0c..33e58a285 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@2b011faafdcbc9ceb11414d64d0573f37c774b04 + uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 with: commit-message: Update build artifact sizes in check_metadata.sh delete-branch: true From ed531ec3135bb26cd5cb44f6ebf33220c262b449 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 20 Mar 2023 09:43:58 -0700 Subject: [PATCH 124/141] chore: remove all namespace comments (#6903) * chore: remove all namespace comments * chore: fix lint --- core/block_animations.ts | 5 ----- core/blockly.ts | 5 ----- core/blockly_options.ts | 5 ----- core/blocks.ts | 5 ----- core/browser_events.ts | 5 ----- core/bump_objects.ts | 5 ----- core/clipboard.ts | 5 ----- core/common.ts | 6 ------ core/config.ts | 7 ------- core/connection_type.ts | 5 ----- core/constants.ts | 5 ----- core/contextmenu.ts | 5 ----- core/contextmenu_items.ts | 5 ----- core/css.ts | 5 ----- core/dialog.ts | 5 ----- core/events/events.ts | 5 ----- core/events/utils.ts | 6 ------ core/extensions.ts | 8 -------- core/field_registry.ts | 7 ------- core/inject.ts | 5 ----- core/input_types.ts | 5 ----- core/insertion_marker_manager.ts | 1 - core/interfaces/i_ast_node_location.ts | 5 ----- core/interfaces/i_ast_node_location_svg.ts | 5 ----- core/interfaces/i_ast_node_location_with_block.ts | 6 ------ core/interfaces/i_autohideable.ts | 6 ------ core/interfaces/i_block_dragger.ts | 5 ----- core/interfaces/i_bounded_element.ts | 5 ----- core/interfaces/i_bubble.ts | 5 ----- core/interfaces/i_collapsible_toolbox_item.ts | 5 ----- core/interfaces/i_component.ts | 6 ------ core/interfaces/i_connection_checker.ts | 6 ------ core/interfaces/i_contextmenu.ts | 5 ----- core/interfaces/i_copyable.ts | 5 ----- core/interfaces/i_deletable.ts | 5 ----- core/interfaces/i_delete_area.ts | 6 ------ core/interfaces/i_drag_target.ts | 6 ------ core/interfaces/i_draggable.ts | 5 ----- core/interfaces/i_flyout.ts | 5 ----- core/interfaces/i_keyboard_accessible.ts | 5 ----- core/interfaces/i_metrics_manager.ts | 5 ----- core/interfaces/i_movable.ts | 5 ----- core/interfaces/i_positionable.ts | 5 ----- core/interfaces/i_procedure_model.ts | 5 ----- core/interfaces/i_registrable.ts | 6 ------ core/interfaces/i_selectable.ts | 5 ----- core/interfaces/i_selectable_toolbox_item.ts | 5 ----- core/interfaces/i_serializer.ts | 6 ------ core/interfaces/i_styleable.ts | 5 ----- core/interfaces/i_toolbox.ts | 5 ----- core/interfaces/i_toolbox_item.ts | 5 ----- core/internal_constants.ts | 6 ------ core/msg.ts | 5 ----- core/positionable_helpers.ts | 5 ----- core/procedures.ts | 5 ----- core/registry.ts | 6 ------ core/serialization/blocks.ts | 5 ----- core/serialization/exceptions.ts | 5 ----- core/serialization/priorities.ts | 7 ------- core/serialization/registry.ts | 6 ------ core/serialization/variables.ts | 6 ------ core/serialization/workspaces.ts | 6 ------ core/shortcut_items.ts | 5 ----- core/theme/classic.ts | 6 ------ core/theme/themes.ts | 5 ----- core/theme/zelos.ts | 5 ----- core/tooltip.ts | 10 ---------- core/touch.ts | 5 ----- core/utils.ts | 5 ----- core/utils/aria.ts | 7 ------- core/utils/array.ts | 1 - core/utils/colour.ts | 5 ----- core/utils/deprecation.ts | 6 ------ core/utils/dom.ts | 7 ------- core/utils/idgenerator.ts | 5 ----- core/utils/keycodes.ts | 7 ------- core/utils/math.ts | 7 ------- core/utils/metrics.ts | 5 ----- core/utils/object.ts | 5 ----- core/utils/parsing.ts | 3 --- core/utils/string.ts | 7 ------- core/utils/style.ts | 7 ------- core/utils/svg_math.ts | 5 ----- core/utils/svg_paths.ts | 5 ----- core/utils/toolbox.ts | 5 ----- core/utils/useragent.ts | 7 ------- core/utils/xml.ts | 7 ------- core/variables.ts | 5 ----- core/variables_dynamic.ts | 5 ----- core/widgetdiv.ts | 7 ------- core/xml.ts | 5 ----- 91 files changed, 494 deletions(-) diff --git a/core/block_animations.ts b/core/block_animations.ts index 065b4ee51..8f72bfa65 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Methods animating a block on connection and disconnection. - * - * @namespace Blockly.blockAnimations - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.blockAnimations'); diff --git a/core/blockly.ts b/core/blockly.ts index da5dc651d..b833924f6 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The top level namespace used to access the Blockly library. - * - * @namespace Blockly - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly'); diff --git a/core/blockly_options.ts b/core/blockly_options.ts index 6741def18..deabe1f96 100644 --- a/core/blockly_options.ts +++ b/core/blockly_options.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Object that defines user-specified options for the workspace. - * - * @namespace Blockly.BlocklyOptions - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.BlocklyOptions'); diff --git a/core/blocks.ts b/core/blocks.ts index 9d9466b7e..0b381fa89 100644 --- a/core/blocks.ts +++ b/core/blocks.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * A mapping of block type names to block prototype objects. - * - * @namespace Blockly.blocks - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.blocks'); diff --git a/core/browser_events.ts b/core/browser_events.ts index 2d389415a..6723aa7e5 100644 --- a/core/browser_events.ts +++ b/core/browser_events.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Browser event handling. - * - * @namespace Blockly.browserEvents - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.browserEvents'); diff --git a/core/bump_objects.ts b/core/bump_objects.ts index 873b007aa..7396b7a0e 100644 --- a/core/bump_objects.ts +++ b/core/bump_objects.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utilities for bumping objects back into worksapce bounds. - * - * @namespace Blockly.bumpObjects - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.bumpObjects'); diff --git a/core/clipboard.ts b/core/clipboard.ts index 2056e950f..6b402a5e9 100644 --- a/core/clipboard.ts +++ b/core/clipboard.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Blockly's internal clipboard for managing copy-paste. - * - * @namespace Blockly.clipboard - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.clipboard'); diff --git a/core/common.ts b/core/common.ts index a678ceef0..b50eb7b68 100644 --- a/core/common.ts +++ b/core/common.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Common functions used both internally and externally, but which - * must not be at the top level to avoid circular dependencies. - * - * @namespace Blockly.common - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.common'); diff --git a/core/config.ts b/core/config.ts index e2b6c6988..549a6aaf7 100644 --- a/core/config.ts +++ b/core/config.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * All the values that we expect developers to be able to change - * before injecting Blockly. Changing these values during run time is not - * generally recommended. - * - * @namespace Blockly.config - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.config'); diff --git a/core/connection_type.ts b/core/connection_type.ts index 990b9a5af..5fe77b12b 100644 --- a/core/connection_type.ts +++ b/core/connection_type.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * An enum for the possible types of connections. - * - * @namespace Blockly.ConnectionType - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.ConnectionType'); diff --git a/core/constants.ts b/core/constants.ts index 49ec99b91..ace571ff1 100644 --- a/core/constants.ts +++ b/core/constants.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Blockly constants. - * - * @namespace Blockly.constants - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.constants'); diff --git a/core/contextmenu.ts b/core/contextmenu.ts index 8122b1b03..f9015a57e 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Functionality for the right-click context menus. - * - * @namespace Blockly.ContextMenu - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.ContextMenu'); diff --git a/core/contextmenu_items.ts b/core/contextmenu_items.ts index 81c1003e0..67d035307 100644 --- a/core/contextmenu_items.ts +++ b/core/contextmenu_items.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Registers default context menu items. - * - * @namespace Blockly.ContextMenuItems - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.ContextMenuItems'); diff --git a/core/css.ts b/core/css.ts index 88284a407..f473aacf7 100644 --- a/core/css.ts +++ b/core/css.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Inject Blockly's CSS synchronously. - * - * @namespace Blockly.Css - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Css'); diff --git a/core/dialog.ts b/core/dialog.ts index 733eab90d..4c5d17852 100644 --- a/core/dialog.ts +++ b/core/dialog.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Wrapper functions around JS functions for showing alert/confirmation dialogs. - * - * @namespace Blockly.dialog - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.dialog'); diff --git a/core/events/events.ts b/core/events/events.ts index 06bede7b7..edea5a6ff 100644 --- a/core/events/events.ts +++ b/core/events/events.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Events fired as a result of actions in Blockly's editor. - * - * @namespace Blockly.Events - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events'); diff --git a/core/events/utils.ts b/core/events/utils.ts index 970ae695a..4c3ca57cd 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Helper methods for events that are fired as a result of - * actions in Blockly's editor. - * - * @namespace Blockly.Events.utils - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Events.utils'); diff --git a/core/extensions.ts b/core/extensions.ts index 79a21ecb5..20e1ed47e 100644 --- a/core/extensions.ts +++ b/core/extensions.ts @@ -4,14 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Extensions are functions that help initialize blocks, usually - * adding dynamic behavior such as onchange handlers and mutators. These - * are applied using Block.applyExtension(), or the JSON "extensions" - * array attribute. - * - * @namespace Blockly.Extensions - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Extensions'); diff --git a/core/field_registry.ts b/core/field_registry.ts index 9606dd55a..25364d448 100644 --- a/core/field_registry.ts +++ b/core/field_registry.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Fields can be created based on a JSON definition. This file - * contains methods for registering those JSON definitions, and building the - * fields based on JSON. - * - * @namespace Blockly.fieldRegistry - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.fieldRegistry'); diff --git a/core/inject.ts b/core/inject.ts index ad4162546..a02ee52b3 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Functions for injecting Blockly into a web page. - * - * @namespace Blockly.inject - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.inject'); diff --git a/core/input_types.ts b/core/input_types.ts index eab660df9..8f50346ad 100644 --- a/core/input_types.ts +++ b/core/input_types.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * An enum for the possible types of inputs. - * - * @namespace Blockly.inputTypes - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.inputTypes'); diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 6ca80f46f..7f53caa0d 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -17,7 +17,6 @@ import type {BlockSvg} from './block_svg.js'; import * as common from './common.js'; import {ComponentManager} from './component_manager.js'; import {config} from './config.js'; -import {ConnectionType} from './connection_type.js'; import * as constants from './constants.js'; import * as eventUtils from './events/utils.js'; import type {IDeleteArea} from './interfaces/i_delete_area.js'; diff --git a/core/interfaces/i_ast_node_location.ts b/core/interfaces/i_ast_node_location.ts index bb601d260..36c5e7eec 100644 --- a/core/interfaces/i_ast_node_location.ts +++ b/core/interfaces/i_ast_node_location.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an AST node location. - * - * @namespace Blockly.IASTNodeLocation - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IASTNodeLocation'); diff --git a/core/interfaces/i_ast_node_location_svg.ts b/core/interfaces/i_ast_node_location_svg.ts index 83eb6585f..0617b5d8e 100644 --- a/core/interfaces/i_ast_node_location_svg.ts +++ b/core/interfaces/i_ast_node_location_svg.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an AST node location SVG. - * - * @namespace Blockly.IASTNodeLocationSvg - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IASTNodeLocationSvg'); diff --git a/core/interfaces/i_ast_node_location_with_block.ts b/core/interfaces/i_ast_node_location_with_block.ts index 48eb094d7..56e12b3ee 100644 --- a/core/interfaces/i_ast_node_location_with_block.ts +++ b/core/interfaces/i_ast_node_location_with_block.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an AST node location that has an associated - * block. - * - * @namespace Blockly.IASTNodeLocationWithBlock - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IASTNodeLocationWithBlock'); diff --git a/core/interfaces/i_autohideable.ts b/core/interfaces/i_autohideable.ts index 8b72e33c3..d7abcad1e 100644 --- a/core/interfaces/i_autohideable.ts +++ b/core/interfaces/i_autohideable.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a component that is automatically hidden - * when WorkspaceSvg.hideChaff is called. - * - * @namespace Blockly.IAutoHideable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IAutoHideable'); diff --git a/core/interfaces/i_block_dragger.ts b/core/interfaces/i_block_dragger.ts index 4bb95b27f..d0418224f 100644 --- a/core/interfaces/i_block_dragger.ts +++ b/core/interfaces/i_block_dragger.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a block dragger. - * - * @namespace Blockly.IBlockDragger - */ import * as goog from '../../closure/goog/goog.js'; import type {Coordinate} from '../utils/coordinate.js'; import type {BlockSvg} from '../block_svg.js'; diff --git a/core/interfaces/i_bounded_element.ts b/core/interfaces/i_bounded_element.ts index d1edec75d..870d7b1e8 100644 --- a/core/interfaces/i_bounded_element.ts +++ b/core/interfaces/i_bounded_element.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a bounded element. - * - * @namespace Blockly.IBoundedElement - */ import * as goog from '../../closure/goog/goog.js'; import type {Rect} from '../utils/rect.js'; goog.declareModuleId('Blockly.IBoundedElement'); diff --git a/core/interfaces/i_bubble.ts b/core/interfaces/i_bubble.ts index eb27fdcc8..d8a1b686a 100644 --- a/core/interfaces/i_bubble.ts +++ b/core/interfaces/i_bubble.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a bubble. - * - * @namespace Blockly.IBubble - */ import * as goog from '../../closure/goog/goog.js'; import type {Coordinate} from '../utils/coordinate.js'; import type {BlockDragSurfaceSvg} from '../block_drag_surface.js'; diff --git a/core/interfaces/i_collapsible_toolbox_item.ts b/core/interfaces/i_collapsible_toolbox_item.ts index b6eabcf14..8e499e276 100644 --- a/core/interfaces/i_collapsible_toolbox_item.ts +++ b/core/interfaces/i_collapsible_toolbox_item.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a collapsible toolbox item. - * - * @namespace Blockly.ICollapsibleToolboxItem - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.ICollapsibleToolboxItem'); diff --git a/core/interfaces/i_component.ts b/core/interfaces/i_component.ts index 3d61f805b..3a55702fd 100644 --- a/core/interfaces/i_component.ts +++ b/core/interfaces/i_component.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Interface for a workspace component that can be registered with - * the ComponentManager. - * - * @namespace Blockly.IComponent - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IComponent'); diff --git a/core/interfaces/i_connection_checker.ts b/core/interfaces/i_connection_checker.ts index 5472aecd1..4384511cc 100644 --- a/core/interfaces/i_connection_checker.ts +++ b/core/interfaces/i_connection_checker.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that encapsulates logic for - * checking whether a potential connection is safe and valid. - * - * @namespace Blockly.IConnectionChecker - */ import * as goog from '../../closure/goog/goog.js'; import type {Connection} from '../connection.js'; import type {RenderedConnection} from '../rendered_connection.js'; diff --git a/core/interfaces/i_contextmenu.ts b/core/interfaces/i_contextmenu.ts index f005fdbdd..f205e9e2e 100644 --- a/core/interfaces/i_contextmenu.ts +++ b/core/interfaces/i_contextmenu.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that supports a right-click. - * - * @namespace Blockly.IContextMenu - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IContextMenu'); diff --git a/core/interfaces/i_copyable.ts b/core/interfaces/i_copyable.ts index 6204eeacc..cd3fe3678 100644 --- a/core/interfaces/i_copyable.ts +++ b/core/interfaces/i_copyable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that is copyable. - * - * @namespace Blockly.ICopyable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.ICopyable'); diff --git a/core/interfaces/i_deletable.ts b/core/interfaces/i_deletable.ts index 507cdca33..3593dd878 100644 --- a/core/interfaces/i_deletable.ts +++ b/core/interfaces/i_deletable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that is deletable. - * - * @namespace Blockly.IDeletable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IDeletable'); diff --git a/core/interfaces/i_delete_area.ts b/core/interfaces/i_delete_area.ts index 1c9a1d0d0..9a72ec779 100644 --- a/core/interfaces/i_delete_area.ts +++ b/core/interfaces/i_delete_area.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a component that can delete a block or bubble - * that is dropped on top of it. - * - * @namespace Blockly.IDeleteArea - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IDeleteArea'); diff --git a/core/interfaces/i_drag_target.ts b/core/interfaces/i_drag_target.ts index eef00dcd9..5d2ba2bb8 100644 --- a/core/interfaces/i_drag_target.ts +++ b/core/interfaces/i_drag_target.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a component that has a handler for when a - * block is dropped on top of it. - * - * @namespace Blockly.IDragTarget - */ import * as goog from '../../closure/goog/goog.js'; import {Rect} from '../utils/rect.js'; diff --git a/core/interfaces/i_draggable.ts b/core/interfaces/i_draggable.ts index f7a080949..49e6976ca 100644 --- a/core/interfaces/i_draggable.ts +++ b/core/interfaces/i_draggable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that is draggable. - * - * @namespace Blockly.IDraggable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IDraggable'); diff --git a/core/interfaces/i_flyout.ts b/core/interfaces/i_flyout.ts index a5488c549..5f8503161 100644 --- a/core/interfaces/i_flyout.ts +++ b/core/interfaces/i_flyout.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a flyout. - * - * @namespace Blockly.IFlyout - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IFlyout'); diff --git a/core/interfaces/i_keyboard_accessible.ts b/core/interfaces/i_keyboard_accessible.ts index 2d48bad9c..aa00c4420 100644 --- a/core/interfaces/i_keyboard_accessible.ts +++ b/core/interfaces/i_keyboard_accessible.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for objects that handle keyboard shortcuts. - * - * @namespace Blockly.IKeyboardAccessible - */ import * as goog from '../../closure/goog/goog.js'; import {KeyboardShortcut} from '../shortcut_registry.js'; goog.declareModuleId('Blockly.IKeyboardAccessible'); diff --git a/core/interfaces/i_metrics_manager.ts b/core/interfaces/i_metrics_manager.ts index c60dc7f52..a3d28d0fa 100644 --- a/core/interfaces/i_metrics_manager.ts +++ b/core/interfaces/i_metrics_manager.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a metrics manager. - * - * @namespace Blockly.IMetricsManager - */ import * as goog from '../../closure/goog/goog.js'; import type {ContainerRegion, ToolboxMetrics, AbsoluteMetrics, UiMetrics} from '../metrics_manager.js'; import type {Size} from '../utils/size.js'; diff --git a/core/interfaces/i_movable.ts b/core/interfaces/i_movable.ts index a0c420a9b..2c249273a 100644 --- a/core/interfaces/i_movable.ts +++ b/core/interfaces/i_movable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that is movable. - * - * @namespace Blockly.IMovable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IMovable'); diff --git a/core/interfaces/i_positionable.ts b/core/interfaces/i_positionable.ts index 73cc299b7..52ad96f90 100644 --- a/core/interfaces/i_positionable.ts +++ b/core/interfaces/i_positionable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a positionable UI element. - * - * @namespace Blockly.IPositionable - */ import * as goog from '../../closure/goog/goog.js'; import type {Rect} from '../utils/rect.js'; import type {UiMetrics} from '../metrics_manager.js'; diff --git a/core/interfaces/i_procedure_model.ts b/core/interfaces/i_procedure_model.ts index 1950fff76..dffdc984e 100644 --- a/core/interfaces/i_procedure_model.ts +++ b/core/interfaces/i_procedure_model.ts @@ -4,11 +4,6 @@ * 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'; diff --git a/core/interfaces/i_registrable.ts b/core/interfaces/i_registrable.ts index b43fff5d3..f95e3c559 100644 --- a/core/interfaces/i_registrable.ts +++ b/core/interfaces/i_registrable.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a Blockly component that can be registered. - * (Ex. Toolbox, Fields, Renderers) - * - * @namespace Blockly.IRegistrable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IRegistrable'); diff --git a/core/interfaces/i_selectable.ts b/core/interfaces/i_selectable.ts index f76bdd969..0e99a5847 100644 --- a/core/interfaces/i_selectable.ts +++ b/core/interfaces/i_selectable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that is selectable. - * - * @namespace Blockly.ISelectable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.ISelectable'); diff --git a/core/interfaces/i_selectable_toolbox_item.ts b/core/interfaces/i_selectable_toolbox_item.ts index b43c320b2..8f454372b 100644 --- a/core/interfaces/i_selectable_toolbox_item.ts +++ b/core/interfaces/i_selectable_toolbox_item.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a selectable toolbox item. - * - * @namespace Blockly.ISelectableToolboxItem - */ import * as goog from '../../closure/goog/goog.js'; import type {FlyoutItemInfoArray} from '../utils/toolbox'; goog.declareModuleId('Blockly.ISelectableToolboxItem'); diff --git a/core/interfaces/i_serializer.ts b/core/interfaces/i_serializer.ts index 495be1f1c..37efa4626 100644 --- a/core/interfaces/i_serializer.ts +++ b/core/interfaces/i_serializer.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The record type for an object containing functions for - * serializing part of the workspace. - * - * @namespace Blockly.serialization.ISerializer - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.ISerializer'); diff --git a/core/interfaces/i_styleable.ts b/core/interfaces/i_styleable.ts index f9554680e..86d9f2c00 100644 --- a/core/interfaces/i_styleable.ts +++ b/core/interfaces/i_styleable.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for an object that a style can be added to. - * - * @namespace Blockly.IStyleable - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IStyleable'); diff --git a/core/interfaces/i_toolbox.ts b/core/interfaces/i_toolbox.ts index 9e936a54a..cb4eeceb4 100644 --- a/core/interfaces/i_toolbox.ts +++ b/core/interfaces/i_toolbox.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a toolbox. - * - * @namespace Blockly.IToolbox - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IToolbox'); diff --git a/core/interfaces/i_toolbox_item.ts b/core/interfaces/i_toolbox_item.ts index 3c5344725..f7398acec 100644 --- a/core/interfaces/i_toolbox_item.ts +++ b/core/interfaces/i_toolbox_item.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The interface for a toolbox item. - * - * @namespace Blockly.IToolboxItem - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.IToolboxItem'); diff --git a/core/internal_constants.ts b/core/internal_constants.ts index 330d2662e..5d6a0340d 100644 --- a/core/internal_constants.ts +++ b/core/internal_constants.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Module that provides constants for use inside Blockly. Do not - * use these constants outside of the core library. - * - * @namespace Blockly.internalConstants - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.internalConstants'); diff --git a/core/msg.ts b/core/msg.ts index 39d05b0c5..50fdf3a8f 100644 --- a/core/msg.ts +++ b/core/msg.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Empty name space for the Message singleton. - * - * @namespace Blockly.Msg - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Msg'); diff --git a/core/positionable_helpers.ts b/core/positionable_helpers.ts index 34d1ef97a..b0967c48d 100644 --- a/core/positionable_helpers.ts +++ b/core/positionable_helpers.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility functions for positioning UI elements. - * - * @namespace Blockly.uiPosition - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.uiPosition'); diff --git a/core/procedures.ts b/core/procedures.ts index 3dfe87601..1bc1d9d80 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility functions for handling procedures. - * - * @namespace Blockly.Procedures - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Procedures'); diff --git a/core/registry.ts b/core/registry.ts index f99ded7bf..32abc14d7 100644 --- a/core/registry.ts +++ b/core/registry.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * This file is a universal registry that provides generic methods - * for registering and unregistering different types of classes. - * - * @namespace Blockly.registry - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.registry'); diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index 2152a12d1..e9bb0bd0c 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Handles serializing blocks to plain JavaScript objects only containing state. - * - * @namespace Blockly.serialization.blocks - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.blocks'); diff --git a/core/serialization/exceptions.ts b/core/serialization/exceptions.ts index 506c83063..ff720f1bd 100644 --- a/core/serialization/exceptions.ts +++ b/core/serialization/exceptions.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Contains custom errors thrown by the serialization system. - * - * @namespace Blockly.serialization.exceptions - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.exceptions'); diff --git a/core/serialization/priorities.ts b/core/serialization/priorities.ts index 03d053279..27eda2e8a 100644 --- a/core/serialization/priorities.ts +++ b/core/serialization/priorities.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * The top level namespace for priorities of plugin serializers. - * Includes constants for the priorities of different plugin serializers. Higher - * priorities are deserialized first. - * - * @namespace Blockly.serialization.priorities - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.priorities'); diff --git a/core/serialization/registry.ts b/core/serialization/registry.ts index b57030751..2d680717e 100644 --- a/core/serialization/registry.ts +++ b/core/serialization/registry.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Contains functions registering serializers (eg blocks, variables, plugins, - * etc). - * - * @namespace Blockly.serialization.registry - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.registry'); diff --git a/core/serialization/variables.ts b/core/serialization/variables.ts index 3259763ac..f50433f36 100644 --- a/core/serialization/variables.ts +++ b/core/serialization/variables.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Handles serializing variables to plain JavaScript objects, only containing - * state. - * - * @namespace Blockly.serialization.variables - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.variables'); diff --git a/core/serialization/workspaces.ts b/core/serialization/workspaces.ts index 378d12a61..a6896e9d3 100644 --- a/core/serialization/workspaces.ts +++ b/core/serialization/workspaces.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Contains top-level functions for serializing workspaces to plain JavaScript - * objects. - * - * @namespace Blockly.serialization.workspaces - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.serialization.workspaces'); diff --git a/core/shortcut_items.ts b/core/shortcut_items.ts index 936ae4f5c..d07d1fbe5 100644 --- a/core/shortcut_items.ts +++ b/core/shortcut_items.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Registers default keyboard shortcuts. - * - * @namespace Blockly.ShortcutItems - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.ShortcutItems'); diff --git a/core/theme/classic.ts b/core/theme/classic.ts index 8c0bd3755..706964f8c 100644 --- a/core/theme/classic.ts +++ b/core/theme/classic.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Classic theme. - * Contains multi-coloured border to create shadow effect. - * - * @namespace Blockly.Themes.Classic - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Themes.Classic'); diff --git a/core/theme/themes.ts b/core/theme/themes.ts index 576b1ad43..157133484 100644 --- a/core/theme/themes.ts +++ b/core/theme/themes.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Namespace for themes. - * - * @namespace Blockly.Themes - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Themes'); diff --git a/core/theme/zelos.ts b/core/theme/zelos.ts index 66c85d9a0..f4bffe64c 100644 --- a/core/theme/zelos.ts +++ b/core/theme/zelos.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Zelos theme. - * - * @namespace Blockly.Themes.Zelos - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.Themes.Zelos'); diff --git a/core/tooltip.ts b/core/tooltip.ts index e907561a4..1eb608a83 100644 --- a/core/tooltip.ts +++ b/core/tooltip.ts @@ -4,16 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Library to create tooltips for Blockly. - * First, call createDom() after onload. - * Second, set the 'tooltip' property on any SVG element that needs a tooltip. - * If the tooltip is a string, or a function that returns a string, that message - * will be displayed. If the tooltip is an SVG element, then that object's - * tooltip will be used. Third, call bindMouseEvents(e) passing the SVG element. - * - * @namespace Blockly.Tooltip - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Tooltip'); diff --git a/core/touch.ts b/core/touch.ts index f8be51c60..9de586c44 100644 --- a/core/touch.ts +++ b/core/touch.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Touch handling for Blockly. - * - * @namespace Blockly.Touch - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Touch'); diff --git a/core/utils.ts b/core/utils.ts index e8eb87fea..cb03341f0 100644 --- a/core/utils.ts +++ b/core/utils.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods. - * - * @namespace Blockly.utils - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils'); diff --git a/core/utils/aria.ts b/core/utils/aria.ts index e31951d8a..e43190709 100644 --- a/core/utils/aria.ts +++ b/core/utils/aria.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * ARIA-related constants and utilities. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.aria - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.aria'); diff --git a/core/utils/array.ts b/core/utils/array.ts index dbf1b6467..faee551e4 100644 --- a/core/utils/array.ts +++ b/core/utils/array.ts @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** @namespace Blockly.utils.array */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.array'); diff --git a/core/utils/colour.ts b/core/utils/colour.ts index d98c1fed7..0e9d91017 100644 --- a/core/utils/colour.ts +++ b/core/utils/colour.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods for colour manipulation. - * - * @namespace Blockly.utils.colour - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.colour'); diff --git a/core/utils/deprecation.ts b/core/utils/deprecation.ts index 0492c6423..b09e5bc6a 100644 --- a/core/utils/deprecation.ts +++ b/core/utils/deprecation.ts @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Helper function for warning developers about deprecations. - * This method is not specific to Blockly. - * - * @namespace Blockly.utils.deprecation - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.deprecation'); diff --git a/core/utils/dom.ts b/core/utils/dom.ts index b6ca84eda..363000480 100644 --- a/core/utils/dom.ts +++ b/core/utils/dom.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods for DOM manipulation. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.dom - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.dom'); diff --git a/core/utils/idgenerator.ts b/core/utils/idgenerator.ts index 1e5461292..3f7d66f5a 100644 --- a/core/utils/idgenerator.ts +++ b/core/utils/idgenerator.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Generators for unique IDs. - * - * @namespace Blockly.utils.idGenerator - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.idGenerator'); diff --git a/core/utils/keycodes.ts b/core/utils/keycodes.ts index d96e72ee5..b6e4baf63 100644 --- a/core/utils/keycodes.ts +++ b/core/utils/keycodes.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Constant declarations for common key codes. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.KeyCodes - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.KeyCodes'); diff --git a/core/utils/math.ts b/core/utils/math.ts index 7dbef74e6..1704c3ae3 100644 --- a/core/utils/math.ts +++ b/core/utils/math.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods for math. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.math - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.math'); diff --git a/core/utils/metrics.ts b/core/utils/metrics.ts index 04dc9b366..d83e2b8a0 100644 --- a/core/utils/metrics.ts +++ b/core/utils/metrics.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Workspace metrics definitions. - * - * @namespace Blockly.utils.Metrics - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.Metrics'); diff --git a/core/utils/object.ts b/core/utils/object.ts index 2467b8abc..a36ea18c2 100644 --- a/core/utils/object.ts +++ b/core/utils/object.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods for objects. - * - * @namespace Blockly.utils.object - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.object'); diff --git a/core/utils/parsing.ts b/core/utils/parsing.ts index 4badd77ff..bd5160cf3 100644 --- a/core/utils/parsing.ts +++ b/core/utils/parsing.ts @@ -4,9 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * @namespace Blockly.utils.parsing - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.parsing'); diff --git a/core/utils/string.ts b/core/utils/string.ts index ece17bf01..f7d8e8540 100644 --- a/core/utils/string.ts +++ b/core/utils/string.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods for string manipulation. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.string - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.string'); diff --git a/core/utils/style.ts b/core/utils/style.ts index 11c6fa232..7c53079bd 100644 --- a/core/utils/style.ts +++ b/core/utils/style.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utilities for element styles. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.style - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.style'); diff --git a/core/utils/svg_math.ts b/core/utils/svg_math.ts index 8fdb1e393..2ab1dca63 100644 --- a/core/utils/svg_math.ts +++ b/core/utils/svg_math.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility methods realted to figuring out positions of SVG elements. - * - * @namespace Blockly.utils.svgMath - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.svgMath'); diff --git a/core/utils/svg_paths.ts b/core/utils/svg_paths.ts index 6c9707c47..ee7dd8d9c 100644 --- a/core/utils/svg_paths.ts +++ b/core/utils/svg_paths.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Methods for creating parts of SVG path strings. See - * - * @namespace Blockly.utils.svgPaths - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.svgPaths'); diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index e8b8283aa..0f6ecddac 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility functions for the toolbox and flyout. - * - * @namespace Blockly.utils.toolbox - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.toolbox'); diff --git a/core/utils/useragent.ts b/core/utils/useragent.ts index 59808af1b..386c99965 100644 --- a/core/utils/useragent.ts +++ b/core/utils/useragent.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Useragent detection. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.userAgent - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.userAgent'); diff --git a/core/utils/xml.ts b/core/utils/xml.ts index 383fc60ea..a02f1a8d6 100644 --- a/core/utils/xml.ts +++ b/core/utils/xml.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * XML element manipulation. - * These methods are not specific to Blockly, and could be factored out into - * a JavaScript framework such as Closure. - * - * @namespace Blockly.utils.xml - */ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.xml'); diff --git a/core/variables.ts b/core/variables.ts index 99a2d7793..901572bb0 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility functions for handling variables. - * - * @namespace Blockly.Variables - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Variables'); diff --git a/core/variables_dynamic.ts b/core/variables_dynamic.ts index 500cbec41..da3b797aa 100644 --- a/core/variables_dynamic.ts +++ b/core/variables_dynamic.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * Utility functions for handling typed variables. - * - * @namespace Blockly.VariablesDynamic - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.VariablesDynamic'); diff --git a/core/widgetdiv.ts b/core/widgetdiv.ts index 9a24540ac..0c5f1615d 100644 --- a/core/widgetdiv.ts +++ b/core/widgetdiv.ts @@ -4,13 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * A div that floats on top of Blockly. This singleton contains - * temporary HTML UI widgets that the user is currently interacting with. - * E.g. text input areas, colour pickers, context menus. - * - * @namespace Blockly.WidgetDiv - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.WidgetDiv'); diff --git a/core/xml.ts b/core/xml.ts index bf54caf4a..ffc2f2bfc 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -4,11 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -/** - * XML reader and writer. - * - * @namespace Blockly.Xml - */ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.Xml'); From 40b454fb2f23071e6f9f3702d7f19fc21e58a212 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 17:43:58 +0000 Subject: [PATCH 125/141] chore(deps): bump @typescript-eslint/eslint-plugin from 5.50.0 to 5.55.0 (#6909) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.50.0 to 5.55.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.55.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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 279 ++++++++++++++++++++++++++-------------------- 1 file changed, 159 insertions(+), 120 deletions(-) diff --git a/package-lock.json b/package-lock.json index 37cda7910..a025f8271 100644 --- a/package-lock.json +++ b/package-lock.json @@ -275,6 +275,30 @@ "node": "^14 || ^16 || ^17 || ^18 || ^19" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", + "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", + "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", @@ -1050,19 +1074,19 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.50.0.tgz", - "integrity": "sha512-vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIwQ==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.55.0.tgz", + "integrity": "sha512-IZGc50rtbjk+xp5YQoJvmMPmJEYoC53SiKPXyqWfv15XoD2Y5Kju6zN0DwlmaGJp1Iw33JsWJcQ7nw0lGCGjVg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/type-utils": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.55.0", + "@typescript-eslint/type-utils": "5.55.0", + "@typescript-eslint/utils": "5.55.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" }, @@ -1084,13 +1108,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", + "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1101,9 +1125,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1114,12 +1138,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1177,13 +1201,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.50.0.tgz", - "integrity": "sha512-dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.55.0.tgz", + "integrity": "sha512-ObqxBgHIXj8rBNm0yh8oORFrICcJuZPZTqtAFh0oZQyr5DnAHZWfyw54RwpEEH+fD8suZaI0YxvWu5tYE/WswA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/typescript-estree": "5.55.0", + "@typescript-eslint/utils": "5.55.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1204,9 +1228,9 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1217,13 +1241,13 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", + "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1244,12 +1268,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1303,18 +1327,18 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.50.0.tgz", - "integrity": "sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.55.0.tgz", + "integrity": "sha512-FkW+i2pQKcpDC3AY6DU54yl8Lfl14FVGYDgBTyGKB75cCwV3KpkpTMFi9d9j2WAJ4271LR2HeC5SEWF/CZmmfw==", "dev": true, "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.55.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/typescript-estree": "5.55.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "engines": { @@ -1329,13 +1353,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", + "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1346,9 +1370,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1359,13 +1383,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", + "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1386,12 +1410,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -12983,6 +13007,21 @@ "jsdoc-type-pratt-parser": "~3.1.0" } }, + "@eslint-community/eslint-utils": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", + "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", + "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "dev": true + }, "@eslint/eslintrc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", @@ -13649,46 +13688,46 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.50.0.tgz", - "integrity": "sha512-vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIwQ==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.55.0.tgz", + "integrity": "sha512-IZGc50rtbjk+xp5YQoJvmMPmJEYoC53SiKPXyqWfv15XoD2Y5Kju6zN0DwlmaGJp1Iw33JsWJcQ7nw0lGCGjVg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/type-utils": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.55.0", + "@typescript-eslint/type-utils": "5.55.0", + "@typescript-eslint/utils": "5.55.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", + "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0" } }, "@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" } } @@ -13719,31 +13758,31 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.50.0.tgz", - "integrity": "sha512-dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.55.0.tgz", + "integrity": "sha512-ObqxBgHIXj8rBNm0yh8oORFrICcJuZPZTqtAFh0oZQyr5DnAHZWfyw54RwpEEH+fD8suZaI0YxvWu5tYE/WswA==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/typescript-estree": "5.55.0", + "@typescript-eslint/utils": "5.55.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", + "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -13752,12 +13791,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" } } @@ -13787,45 +13826,45 @@ } }, "@typescript-eslint/utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.50.0.tgz", - "integrity": "sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.55.0.tgz", + "integrity": "sha512-FkW+i2pQKcpDC3AY6DU54yl8Lfl14FVGYDgBTyGKB75cCwV3KpkpTMFi9d9j2WAJ4271LR2HeC5SEWF/CZmmfw==", "dev": true, "requires": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.55.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/typescript-estree": "5.55.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", + "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0" } }, "@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", + "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", + "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.55.0", + "@typescript-eslint/visitor-keys": "5.55.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -13834,12 +13873,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.55.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", + "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.55.0", "eslint-visitor-keys": "^3.3.0" } }, From cbb382970779ed17288eb97fd574009513457ca2 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 20 Mar 2023 15:27:51 -0700 Subject: [PATCH 126/141] fix: Fix scrolling of menus on mobile. (#6911) --- core/menu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/menu.ts b/core/menu.ts index 0ad63cf26..d2ff7d53c 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -104,7 +104,7 @@ export class Menu { this.mouseOverHandler = browserEvents.conditionalBind( element, 'pointerover', this, this.handleMouseOver, true); this.clickHandler = browserEvents.conditionalBind( - element, 'pointerdown', this, this.handleClick, true); + element, 'pointerup', this, this.handleClick, true); this.mouseEnterHandler = browserEvents.conditionalBind( element, 'pointerenter', this, this.handleMouseEnter, true); this.mouseLeaveHandler = browserEvents.conditionalBind( From 252b204adb4148588eabdd28224c451c6069d68e Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 21 Mar 2023 10:00:40 -0700 Subject: [PATCH 127/141] fix: scrolling dropdown items into view (#6912) * fix: scrolling dropdown items into view * chore: lint --- core/field_dropdown.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 90cd9117a..0650be4c3 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -20,6 +20,7 @@ import {Field, FieldConfig, FieldValidator, UnattachedFieldError} from './field. import * as fieldRegistry from './field_registry.js'; import {Menu} from './menu.js'; import {MenuItem} from './menuitem.js'; +import * as style from './utils/style.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; @@ -283,6 +284,9 @@ export class FieldDropdown extends Field { if (this.selectedMenuItem_) { this.menu_!.setHighlighted(this.selectedMenuItem_); + style.scrollIntoContainerView( + this.selectedMenuItem_.getElement()!, dropDownDiv.getContentDiv(), + true); } this.applyColour(); From a7d250cb784eaf2b643b1b28d3338c74045536c3 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 21 Mar 2023 15:27:04 -0700 Subject: [PATCH 128/141] fix: flyouts resizing for blocks (#6914) * fix: flyouts resizing for blocks * chore: fix node build * chore: actually fix node --- core/events/utils.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/events/utils.ts b/core/events/utils.ts index 4c3ca57cd..e8505f38d 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -220,7 +220,17 @@ function fireInternal(event: Abstract) { } if (!FIRE_QUEUE.length) { // First event added; schedule a firing of the event queue. - setTimeout(fireNow, 0); + try { + // If we are in a browser context, we want to make sure that the event + // fires after blocks have been rerendered this frame. + requestAnimationFrame(() => { + setTimeout(fireNow, 0); + }); + } catch (e) { + // Otherwise we just want to delay so events can be coallesced. + // requestAnimationFrame will error triggering this. + setTimeout(fireNow, 0); + } } FIRE_QUEUE.push(event); } From 00dae595fff07e48723fd786a4bf33fa46de6ea1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Mar 2023 16:36:10 +0000 Subject: [PATCH 129/141] chore(deps): bump typescript from 4.9.5 to 5.0.2 (#6908) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.5 to 5.0.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.5...v5.0.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index a025f8271..a5d0d8020 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "rimraf": "^4.0.7", "selenium-standalone": "^8.0.3", "through2": "^4.0.2", - "typescript": "^4.3.2", + "typescript": "^5.0.2", "webdriverio": "^8.0.5", "yargs": "^17.2.1" } @@ -11834,16 +11834,16 @@ "dev": true }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/ua-parser-js": { @@ -22124,9 +22124,9 @@ "dev": true }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index b69e45857..956162a95 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "rimraf": "^4.0.7", "selenium-standalone": "^8.0.3", "through2": "^4.0.2", - "typescript": "^4.3.2", + "typescript": "^5.0.2", "webdriverio": "^8.0.5", "yargs": "^17.2.1" }, From 01ecf547f4695b75819df489610cf1b47a35d9cc Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 22 Mar 2023 15:25:47 -0700 Subject: [PATCH 130/141] fix: overwriting flyout def with dynamic categories (#6913) * fix: overwriting flyout def with dynamic categories * chore: revert playground testing * fix: change createFlyoutInfo_ to be recursive --- core/flyout_base.ts | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 154e32f07..a517eebe7 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -570,9 +570,9 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.workspace_.removeChangeListener(this.reflowWrapper_); this.reflowWrapper_ = null; } + // Do NOT delete the blocks here. Wait until Flyout.show. + // https://neil.fraser.name/news/2014/08/09/ } - // Do NOT delete the blocks here. Wait until Flyout.show. - // https://neil.fraser.name/news/2014/08/09/ /** * Show and populate the flyout. @@ -630,34 +630,34 @@ export abstract class Flyout extends DeleteArea implements IFlyout { const gaps: number[] = []; this.permanentlyDisabled_.length = 0; const defaultGap = this.horizontalLayout ? this.GAP_X : this.GAP_Y; - for (let i = 0, contentInfo; contentInfo = parsedContent[i]; i++) { - if ('custom' in contentInfo) { - const customInfo = (contentInfo as toolbox.DynamicCategoryInfo); + for (const info of parsedContent) { + if ('custom' in info) { + const customInfo = (info as toolbox.DynamicCategoryInfo); const categoryName = customInfo['custom']; const flyoutDef = this.getDynamicCategoryContents_(categoryName); const parsedDynamicContent = toolbox.convertFlyoutDefToJsonArray(flyoutDef); - // Replace the element at i with the dynamic content it represents. - parsedContent.splice.apply( - parsedContent, [i, 1, ...parsedDynamicContent]); - contentInfo = parsedContent[i]; + const {contents: dynamicContents, gaps: dynamicGaps} = + this.createFlyoutInfo_(parsedDynamicContent); + contents.push(...dynamicContents); + gaps.push(...dynamicGaps); } - switch (contentInfo['kind'].toUpperCase()) { + switch (info['kind'].toUpperCase()) { case 'BLOCK': { - const blockInfo = (contentInfo as toolbox.BlockInfo); + const blockInfo = (info as toolbox.BlockInfo); const block = this.createFlyoutBlock_(blockInfo); contents.push({type: FlyoutItemType.BLOCK, block: block}); this.addBlockGap_(blockInfo, gaps, defaultGap); break; } case 'SEP': { - const sepInfo = (contentInfo as toolbox.SeparatorInfo); + const sepInfo = (info as toolbox.SeparatorInfo); this.addSeparatorGap_(sepInfo, gaps, defaultGap); break; } case 'LABEL': { - const labelInfo = (contentInfo as toolbox.LabelInfo); + const labelInfo = (info as toolbox.LabelInfo); // A label is a button with different styling. const label = this.createButton_(labelInfo, /** isLabel */ true); contents.push({type: FlyoutItemType.BUTTON, button: label}); @@ -665,7 +665,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { break; } case 'BUTTON': { - const buttonInfo = (contentInfo as toolbox.ButtonInfo); + const buttonInfo = (info as toolbox.ButtonInfo); const button = this.createButton_(buttonInfo, /** isLabel */ false); contents.push({type: FlyoutItemType.BUTTON, button: button}); gaps.push(defaultGap); @@ -673,6 +673,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { } } } + return {contents: contents, gaps: gaps}; } From faa95d022d369584402c08291deb082900f18406 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 23 Mar 2023 20:30:48 +0000 Subject: [PATCH 131/141] fix(fields): Make SKIP_SETUP a Symbol; remove Sentinel class (#6919) We introduced the SKIP_SETUP sentinel value when converting Field and its subclasses to ES6 class syntax, because super must be called before any other code in a subclass constructor, breaking the previous mechanism where subclasses would set some properties before calling their superclass constructor. SKIP_SETUP was a singleton value of class Sentinel. Recently, in PR #6639 @btw17 introduced the isSentinel type predicate to improve the typing of Field. Unfortunately, there were some aspects of this change that were not very elegant: - isSentinel was declared as a static method on Field (rather than on Sentinel itself). - It only checks against the specific value SKIP_SETUP, rather than checking if the argument is instanceof Sentinel (though perhaps this is for efficiency?) Additionally - as a result of the migration from ES6 to TS, and predating PR #6639 - The signature for the Field constructor's first argument was typed T|Sentinel, with subclass constructors generally being |Sentinel. This creates a small problem when attempting to port Fields from core to plugins, because Sentinel is not reexported by core/utils.ts (and therefore not from core/blockly.ts either). The latter problem could be solved simply by reexporting Sentinel, or by having plugin constructors not accept SKIP_SETUP (though this potentially makes them more difficult to subclass), but neither is particularly desirable. Instead, this PR proposes that we: - Make Field.SKIP_SETUP a (unique) Symbol. - Change the value argument to the Field constructor to accept T|typeof Field.SKIP_SETUP - where typeof Field.SKIP_SETUP is (like a literal type) a type that accepts just the single value SKIP_SETUP. - Remove the Sentinel class and core/utils/sentinel.ts. Not treating this as a breaking change: - Removes Field.isSentinel - though this addition has not yet been published, so it can only break our own as-yet-unreleased code in samples. - Changes the type of Field.SKIP_SETUP and the first argument of the Field constructor from Sentinel to typeof SKIP_SETUP (a unique Symbol) - but given that Sentinel has never been exported this should not break any actual external code. --- core/field.ts | 10 +++------- core/field_angle.ts | 7 +++---- core/field_checkbox.ts | 7 +++---- core/field_colour.ts | 5 ++--- core/field_dropdown.ts | 16 +++------------- core/field_image.ts | 11 ++++------- core/field_input.ts | 7 +++---- core/field_label.ts | 6 +++--- core/field_multilineinput.ts | 6 +++--- core/field_number.ts | 5 ++--- core/field_textinput.ts | 6 +++--- core/field_variable.ts | 11 ++++------- core/utils/sentinel.ts | 25 ------------------------- 13 files changed, 36 insertions(+), 86 deletions(-) delete mode 100644 core/utils/sentinel.ts diff --git a/core/field.ts b/core/field.ts index ff5663599..eda991fe4 100644 --- a/core/field.ts +++ b/core/field.ts @@ -35,7 +35,6 @@ import type {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; import * as parsing from './utils/parsing.js'; import {Rect} from './utils/rect.js'; -import {Sentinel} from './utils/sentinel.js'; import {Size} from './utils/size.js'; import * as style from './utils/style.js'; import {Svg} from './utils/svg.js'; @@ -89,10 +88,7 @@ export abstract class Field implements IASTNodeLocationSvg, * field's value or run configure_, and should allow a subclass to do that * instead. */ - static readonly SKIP_SETUP = new Sentinel(); - static isSentinel(value: T|Sentinel): value is Sentinel { - return value === Field.SKIP_SETUP; - } + static readonly SKIP_SETUP = Symbol('SKIP_SETUP'); /** * Name of field. Unique within each block. @@ -211,7 +207,7 @@ export abstract class Field implements IASTNodeLocationSvg, * this parameter supports. */ constructor( - value: T|Sentinel, validator?: FieldValidator|null, + value: T|typeof Field.SKIP_SETUP, validator?: FieldValidator|null, config?: FieldConfig) { /** * A generic value possessed by the field. @@ -224,7 +220,7 @@ export abstract class Field implements IASTNodeLocationSvg, /** The size of the area rendered by the field. */ this.size_ = new Size(0, 0); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_angle.ts b/core/field_angle.ts index c2f9318e7..e5fbbf35a 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -21,7 +21,6 @@ import * as fieldRegistry from './field_registry.js'; import {FieldInput, FieldInputConfig, FieldInputValidator} from './field_input.js'; import * as dom from './utils/dom.js'; import * as math from './utils/math.js'; -import type {Sentinel} from './utils/sentinel.js'; import {Svg} from './utils/svg.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -115,11 +114,11 @@ export class FieldAngle extends FieldInput { * for a list of properties this parameter supports. */ constructor( - value?: string|number|Sentinel, validator?: FieldAngleValidator, - config?: FieldAngleConfig) { + value?: string|number|typeof Field.SKIP_SETUP, + validator?: FieldAngleValidator, config?: FieldAngleConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index 31cc50134..3f26d6700 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -18,7 +18,6 @@ import './events/events_block_change.js'; import * as dom from './utils/dom.js'; import {Field, FieldConfig, FieldValidator} from './field.js'; import * as fieldRegistry from './field_registry.js'; -import type {Sentinel} from './utils/sentinel.js'; type BoolString = 'TRUE'|'FALSE'; type CheckboxBool = BoolString|boolean; @@ -63,8 +62,8 @@ export class FieldCheckbox extends Field { * for a list of properties this parameter supports. */ constructor( - value?: CheckboxBool|Sentinel, validator?: FieldCheckboxValidator, - config?: FieldCheckboxConfig) { + value?: CheckboxBool|typeof Field.SKIP_SETUP, + validator?: FieldCheckboxValidator, config?: FieldCheckboxConfig) { super(Field.SKIP_SETUP); /** @@ -73,7 +72,7 @@ export class FieldCheckbox extends Field { */ this.checkChar_ = FieldCheckbox.CHECK_CHAR; - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_colour.ts b/core/field_colour.ts index 63fd1a752..87c34b99d 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -25,7 +25,6 @@ import * as fieldRegistry from './field_registry.js'; import * as aria from './utils/aria.js'; import * as colour from './utils/colour.js'; import * as idGenerator from './utils/idgenerator.js'; -import type {Sentinel} from './utils/sentinel.js'; import {Size} from './utils/size.js'; /** @@ -133,11 +132,11 @@ export class FieldColour extends Field { * for a list of properties this parameter supports. */ constructor( - value?: string|Sentinel, validator?: FieldColourValidator, + value?: string|typeof Field.SKIP_SETUP, validator?: FieldColourValidator, config?: FieldColourConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 0650be4c3..9b1fdf615 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -25,7 +25,6 @@ import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; 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'; @@ -113,16 +112,16 @@ export class FieldDropdown extends Field { validator?: FieldDropdownValidator, config?: FieldDropdownConfig, ); - constructor(menuGenerator: Sentinel); + constructor(menuGenerator: typeof Field.SKIP_SETUP); constructor( - menuGenerator: MenuGenerator|Sentinel, + menuGenerator: MenuGenerator|typeof Field.SKIP_SETUP, validator?: FieldDropdownValidator, config?: FieldDropdownConfig, ) { super(Field.SKIP_SETUP); // If we pass SKIP_SETUP, don't do *anything* with the menu generator. - if (!isMenuGenerator(menuGenerator)) return; + if (menuGenerator === Field.SKIP_SETUP) return; if (Array.isArray(menuGenerator)) { validateOptions(menuGenerator); @@ -690,15 +689,6 @@ const IMAGE_Y_OFFSET = 5; /** The total vertical padding above and below an image. */ const IMAGE_Y_PADDING: number = IMAGE_Y_OFFSET * 2; -/** - * 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. diff --git a/core/field_image.ts b/core/field_image.ts index 60ddac433..ecd702f3f 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -16,7 +16,6 @@ import {Field, FieldConfig} from './field.js'; import * as fieldRegistry from './field_registry.js'; import * as dom from './utils/dom.js'; import * as parsing from './utils/parsing.js'; -import type {Sentinel} from './utils/sentinel.js'; import {Size} from './utils/size.js'; import {Svg} from './utils/svg.js'; @@ -74,9 +73,9 @@ export class FieldImage extends Field { * for a list of properties this parameter supports. */ constructor( - src: string|Sentinel, width: string|number, height: string|number, - alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, - config?: FieldImageConfig) { + src: string|typeof Field.SKIP_SETUP, width: string|number, + height: string|number, alt?: string, onClick?: (p1: FieldImage) => void, + flipRtl?: boolean, config?: FieldImageConfig) { super(Field.SKIP_SETUP); const imageHeight = Number(parsing.replaceMessageReferences(height)); @@ -104,9 +103,7 @@ export class FieldImage extends Field { this.clickHandler_ = onClick; } - if (src === Field.SKIP_SETUP) { - return; - } + if (src === Field.SKIP_SETUP) return; if (config) { this.configure_(config); diff --git a/core/field_input.ts b/core/field_input.ts index 756103d16..0257a345a 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -25,7 +25,6 @@ import {Field, FieldConfig, FieldValidator, UnattachedFieldError} from './field. import {Msg} from './msg.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; -import type {Sentinel} from './utils/sentinel.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; import type {WorkspaceSvg} from './workspace_svg.js'; @@ -103,11 +102,11 @@ export abstract class FieldInput extends Field { * for a list of properties this parameter supports. */ constructor( - value?: string|Sentinel, validator?: FieldInputValidator|null, - config?: FieldInputConfig) { + value?: string|typeof Field.SKIP_SETUP, + validator?: FieldInputValidator|null, config?: FieldInputConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_label.ts b/core/field_label.ts index 4cb293ef6..024646495 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -17,7 +17,6 @@ import * as dom from './utils/dom.js'; import {Field, FieldConfig} from './field.js'; import * as fieldRegistry from './field_registry.js'; import * as parsing from './utils/parsing.js'; -import type {Sentinel} from './utils/sentinel.js'; /** * Class for a non-editable, non-serializable text field. @@ -45,10 +44,11 @@ export class FieldLabel extends Field { * for a list of properties this parameter supports. */ constructor( - value?: string|Sentinel, textClass?: string, config?: FieldLabelConfig) { + value?: string|typeof Field.SKIP_SETUP, textClass?: string, + config?: FieldLabelConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } else { diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index 40f82de23..1472c8996 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -19,7 +19,6 @@ import {FieldTextInput, FieldTextInputConfig, FieldTextInputValidator} from './f import * as aria from './utils/aria.js'; import * as dom from './utils/dom.js'; import * as parsing from './utils/parsing.js'; -import type {Sentinel} from './utils/sentinel.js'; import {Svg} from './utils/svg.js'; import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -59,11 +58,12 @@ export class FieldMultilineInput extends FieldTextInput { * for a list of properties this parameter supports. */ constructor( - value?: string|Sentinel, validator?: FieldMultilineInputValidator, + value?: string|typeof Field.SKIP_SETUP, + validator?: FieldMultilineInputValidator, config?: FieldMultilineInputConfig) { super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } diff --git a/core/field_number.ts b/core/field_number.ts index 262373050..72f383d01 100644 --- a/core/field_number.ts +++ b/core/field_number.ts @@ -16,7 +16,6 @@ import {Field} from './field.js'; import * as fieldRegistry from './field_registry.js'; import {FieldInput, FieldInputConfig, FieldInputValidator} from './field_input.js'; import * as aria from './utils/aria.js'; -import type {Sentinel} from './utils/sentinel.js'; /** * Class for an editable number field. @@ -60,13 +59,13 @@ export class FieldNumber extends FieldInput { * for a list of properties this parameter supports. */ constructor( - value?: string|number|Sentinel, min?: string|number|null, + value?: string|number|typeof Field.SKIP_SETUP, min?: string|number|null, max?: string|number|null, precision?: string|number|null, validator?: FieldNumberValidator|null, config?: FieldNumberConfig) { // Pass SENTINEL so that we can define properties before value validation. super(Field.SKIP_SETUP); - if (Field.isSentinel(value)) return; + if (value === Field.SKIP_SETUP) return; if (config) { this.configure_(config); } else { diff --git a/core/field_textinput.ts b/core/field_textinput.ts index f519f98bb..600e14cb1 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -15,10 +15,10 @@ goog.declareModuleId('Blockly.FieldTextInput'); // Unused import preserved for side-effects. Remove if unneeded. import './events/events_block_change.js'; +import {Field} from './field.js'; import {FieldInput, FieldInputConfig, FieldInputValidator} from './field_input.js'; import * as fieldRegistry from './field_registry.js'; import * as parsing from './utils/parsing.js'; -import type {Sentinel} from './utils/sentinel.js'; /** * Class for an editable text field. @@ -39,8 +39,8 @@ export class FieldTextInput extends FieldInput { * for a list of properties this parameter supports. */ constructor( - value?: string|Sentinel, validator?: FieldTextInputValidator|null, - config?: FieldTextInputConfig) { + value?: string|typeof Field.SKIP_SETUP, + validator?: FieldTextInputValidator|null, config?: FieldTextInputConfig) { super(value, validator, config); } diff --git a/core/field_variable.ts b/core/field_variable.ts index 61159463e..5bde39de1 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -24,7 +24,6 @@ import type {Menu} from './menu.js'; import type {MenuItem} from './menuitem.js'; import {Msg} from './msg.js'; import * as parsing from './utils/parsing.js'; -import type {Sentinel} from './utils/sentinel.js'; import {Size} from './utils/size.js'; import {VariableModel} from './variable_model.js'; import * as Variables from './variables.js'; @@ -76,9 +75,9 @@ export class FieldVariable extends FieldDropdown { * for a list of properties this parameter supports. */ constructor( - varName: string|null|Sentinel, validator?: FieldVariableValidator, - variableTypes?: string[], defaultType?: string, - config?: FieldVariableConfig) { + varName: string|null|typeof Field.SKIP_SETUP, + validator?: FieldVariableValidator, variableTypes?: string[], + defaultType?: string, config?: FieldVariableConfig) { super(Field.SKIP_SETUP); /** @@ -97,9 +96,7 @@ export class FieldVariable extends FieldDropdown { /** The size of the area rendered by the field. */ this.size_ = new Size(0, 0); - if (varName === Field.SKIP_SETUP) { - return; - } + if (varName === Field.SKIP_SETUP) return; if (config) { this.configure_(config); diff --git a/core/utils/sentinel.ts b/core/utils/sentinel.ts deleted file mode 100644 index 6f71ee9d5..000000000 --- a/core/utils/sentinel.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * A type used to create flag values. - * - * @class - */ -import * as goog from '../../closure/goog/goog.js'; -goog.declareModuleId('Blockly.utils.Sentinel'); - - -/** - * A type used to create flag values. - */ -export class Sentinel { - /** - * Provide a unique key so that type guarding properly excludes values like - * string. - */ - UNIQUE_KEY?: never; -} From 0708c97ffe2cdfdf4f576058450788e1b06ac129 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 24 Mar 2023 12:58:33 -0700 Subject: [PATCH 132/141] fix: connection locations not updating (#6921) * fix: connection locations not updating * chore: update TODO --- core/rendered_connection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index 1e91778af..c472867db 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -187,7 +187,9 @@ export class RenderedConnection extends Connection { * was updated. */ moveTo(x: number, y: number): boolean { - const moved = this.x !== x || this.y !== y; + // TODO(#6922): Readd this optimization. + // const moved = this.x !== x || this.y !== y; + const moved = true; let updated = false; if (this.trackedState_ === RenderedConnection.TrackedState.WILL_TRACK) { From d004bd256d89edea6a0ff808dab2380024aa3407 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Fri, 24 Mar 2023 14:56:25 -0700 Subject: [PATCH 133/141] fix: Make Escape cancel changes in text fields. (#6923) --- core/field_input.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/field_input.ts b/core/field_input.ts index 0257a345a..ba86b0449 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -444,7 +444,7 @@ export abstract class FieldInput extends Field { if (e.key === 'Enter') { WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); - } else if (e.key === 'Esc') { + } else if (e.key === 'Escape') { this.setValue( this.htmlInput_!.getAttribute('data-untyped-default-value')); WidgetDiv.hide(); From a83840c28ded20e57deed1c75c915854d027aa67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 08:19:48 -0700 Subject: [PATCH 134/141] chore(deps): bump closure-calculate-chunks from 3.0.3 to 3.1.1 (#6926) Bumps [closure-calculate-chunks](https://github.com/chadkillingsworth/closure-calculate-chunks) from 3.0.3 to 3.1.1. - [Release notes](https://github.com/chadkillingsworth/closure-calculate-chunks/releases) - [Commits](https://github.com/chadkillingsworth/closure-calculate-chunks/compare/v3.0.3...v3.1.1) --- updated-dependencies: - dependency-name: closure-calculate-chunks dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index a5d0d8020..4c4516b9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3162,9 +3162,9 @@ } }, "node_modules/closure-calculate-chunks": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/closure-calculate-chunks/-/closure-calculate-chunks-3.0.3.tgz", - "integrity": "sha512-xtDmQORvSXfgT+6Xkde1RYTHsowCwqyHL92WdG4ZJKJ4bpu+A9yWK32kr4gInZEKRSAS0QrCrkXQJq4bOD5cJA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/closure-calculate-chunks/-/closure-calculate-chunks-3.1.1.tgz", + "integrity": "sha512-Ne/UCDBxiPsco9o+xB0BxFrAdn+G4eljNaj6zLELAbrrGpI2o1l3PPF8yuQ93mLG5Jbm8H73f+n4mbh3S8O8vA==", "dev": true, "dependencies": { "acorn": "8.x", @@ -3172,7 +3172,7 @@ "graphlib": "2.x", "open": "7.x", "resolve": "1.x", - "sigma": "1.x", + "sigma": "1.2.1", "temp": "0.x", "yargs": "16.x" }, @@ -15186,9 +15186,9 @@ } }, "closure-calculate-chunks": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/closure-calculate-chunks/-/closure-calculate-chunks-3.0.3.tgz", - "integrity": "sha512-xtDmQORvSXfgT+6Xkde1RYTHsowCwqyHL92WdG4ZJKJ4bpu+A9yWK32kr4gInZEKRSAS0QrCrkXQJq4bOD5cJA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/closure-calculate-chunks/-/closure-calculate-chunks-3.1.1.tgz", + "integrity": "sha512-Ne/UCDBxiPsco9o+xB0BxFrAdn+G4eljNaj6zLELAbrrGpI2o1l3PPF8yuQ93mLG5Jbm8H73f+n4mbh3S8O8vA==", "dev": true, "requires": { "acorn": "8.x", @@ -15196,7 +15196,7 @@ "graphlib": "2.x", "open": "7.x", "resolve": "1.x", - "sigma": "1.x", + "sigma": "1.2.1", "temp": "0.x", "yargs": "16.x" }, From c1e2956a318f459ffc4272b1fb9e115a2d9bb1a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 08:48:16 -0700 Subject: [PATCH 135/141] chore(deps): bump patch-package from 6.5.0 to 6.5.1 (#6804) Bumps [patch-package](https://github.com/ds300/patch-package) from 6.5.0 to 6.5.1. - [Release notes](https://github.com/ds300/patch-package/releases) - [Changelog](https://github.com/ds300/patch-package/blob/master/CHANGELOG.md) - [Commits](https://github.com/ds300/patch-package/compare/v6.5.0...v6.5.1) --- updated-dependencies: - dependency-name: patch-package dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 92 ++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 54 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c4516b9a..50b8c2ab2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2450,6 +2450,15 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -9265,16 +9274,16 @@ } }, "node_modules/patch-package": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.5.0.tgz", - "integrity": "sha512-tC3EqJmo74yKqfsMzELaFwxOAu6FH6t+FzFOsnWAuARm7/n2xB5AOeOueE221eM9gtMuIKMKpF9tBy/X2mNP0Q==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.5.1.tgz", + "integrity": "sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA==", "dev": true, "dependencies": { "@yarnpkg/lockfile": "^1.1.0", "chalk": "^4.1.2", "cross-spawn": "^6.0.5", "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^7.0.1", + "fs-extra": "^9.0.0", "is-ci": "^2.0.0", "klaw-sync": "^6.0.0", "minimist": "^1.2.6", @@ -9310,26 +9319,18 @@ } }, "node_modules/patch-package/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/patch-package/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "node": ">=10" } }, "node_modules/patch-package/node_modules/path-key": { @@ -9392,15 +9393,6 @@ "node": ">=6" } }, - "node_modules/patch-package/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/patch-package/node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -14633,6 +14625,12 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -20054,16 +20052,16 @@ "dev": true }, "patch-package": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.5.0.tgz", - "integrity": "sha512-tC3EqJmo74yKqfsMzELaFwxOAu6FH6t+FzFOsnWAuARm7/n2xB5AOeOueE221eM9gtMuIKMKpF9tBy/X2mNP0Q==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.5.1.tgz", + "integrity": "sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA==", "dev": true, "requires": { "@yarnpkg/lockfile": "^1.1.0", "chalk": "^4.1.2", "cross-spawn": "^6.0.5", "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^7.0.1", + "fs-extra": "^9.0.0", "is-ci": "^2.0.0", "klaw-sync": "^6.0.0", "minimist": "^1.2.6", @@ -20089,23 +20087,15 @@ } }, "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" } }, "path-key": { @@ -20150,12 +20140,6 @@ "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", From c688c9382b2878473b7072c20bd65ec40e27fe6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:28:04 +0100 Subject: [PATCH 136/141] chore(deps): bump @blockly/dev-tools from 5.0.2 to 5.2.4 (#6927) Bumps [@blockly/dev-tools](https://github.com/google/blockly-samples/tree/HEAD/plugins/dev-tools) from 5.0.2 to 5.2.4. - [Release notes](https://github.com/google/blockly-samples/releases) - [Changelog](https://github.com/google/blockly-samples/blob/master/plugins/dev-tools/CHANGELOG.md) - [Commits](https://github.com/google/blockly-samples/commits/@blockly/dev-tools@5.2.4/plugins/dev-tools) --- updated-dependencies: - dependency-name: "@blockly/dev-tools" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 92 +++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 50b8c2ab2..312e2a9e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -165,9 +165,9 @@ } }, "node_modules/@blockly/block-test": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.3.tgz", - "integrity": "sha512-xFAy1sGLtGXwlNx5TgxKVmzI6l9Q0XJ7rZlyaC91ulZ7srrd3GOfFgbFaF+OwQ+oXfZCU/sGQSumrVksTaq6yw==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.8.tgz", + "integrity": "sha512-foW4fVKCrrmeImXNgVJZ+XjMENpOz3z3P/ob1IxixPnQ3QyO2Yjh0rfPDkSteJjto5k9Q+XhcvlW1w42gyjIKg==", "dev": true, "engines": { "node": ">=8.17.0" @@ -177,16 +177,16 @@ } }, "node_modules/@blockly/dev-tools": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.0.2.tgz", - "integrity": "sha512-3h9nbpbrz8+YCbQlkpIJh1YXmlSmslxzibdPvc6VcgzXA+xzAc2a00Wy5f+ugQRq2394J8Cn/cKXqUKDLjykRA==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.2.4.tgz", + "integrity": "sha512-7FF5PByhq9EhKeYty0GFZp8b7l3qWrEIiqyVTgp/xN7iI/9N6scsDVZfCWVDSmZHgiaTHkEcQW/697IRm69HDA==", "dev": true, "dependencies": { - "@blockly/block-test": "^3.0.1", - "@blockly/theme-dark": "^4.0.1", - "@blockly/theme-deuteranopia": "^3.0.1", - "@blockly/theme-highcontrast": "^3.0.1", - "@blockly/theme-tritanopia": "^3.0.2", + "@blockly/block-test": "^3.0.8", + "@blockly/theme-dark": "^4.0.7", + "@blockly/theme-deuteranopia": "^3.0.7", + "@blockly/theme-highcontrast": "^3.0.7", + "@blockly/theme-tritanopia": "^3.0.8", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", @@ -202,9 +202,9 @@ } }, "node_modules/@blockly/theme-dark": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.1.tgz", - "integrity": "sha512-OIfdnt3kvPnEW/TmfLPUftcekwoQGmxg/12LajYUdW9aOLMQaen16Vw0+BB8Q8zKInpxT6JCBYECilYRLY+RpA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.7.tgz", + "integrity": "sha512-NegmW6DxvDISxonJ8gtp/CGxYZmtNYyjR2t7V5GzwnZhU1QV1aZVJk49f3CbFftQm3W93wHZ9HQn80oTbOCbiQ==", "dev": true, "engines": { "node": ">=8.17.0" @@ -214,9 +214,9 @@ } }, "node_modules/@blockly/theme-deuteranopia": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.1.tgz", - "integrity": "sha512-3zmkD3ERGAuKQjAeFFoNNAhfwmxFncXd3Mw5tHn64MlxguMJCKt7C4Siu6gRXGYpvukkpMUlbgklWyNz2okHng==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.7.tgz", + "integrity": "sha512-51NF9RqqiskCefMPwMO9JS5l+Q1ubyryx5XUwNV7Dl8LljmyaQzBy2xu6MVIG/yZDY1qR7oS2scsyOffb++oFQ==", "dev": true, "engines": { "node": ">=8.17.0" @@ -226,9 +226,9 @@ } }, "node_modules/@blockly/theme-highcontrast": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.1.tgz", - "integrity": "sha512-HuEHKq7n2zTV1gb19SGjyKlCYjZeZSITWPIQeD5wfEVleOOy8z6zjLRZ9D7QoiL4ooFefWkx1kauVsWbaTqN5g==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.7.tgz", + "integrity": "sha512-uwpDXhcXXaXxWT1xkWECUBD0ao1+hzK9iLf5FWktnSqfyj6galLVjB2mxRb3ZTaVuhjvw7/qhjYzVPqzL2NKgg==", "dev": true, "engines": { "node": ">=8.17.0" @@ -250,9 +250,9 @@ } }, "node_modules/@blockly/theme-tritanopia": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.2.tgz", - "integrity": "sha512-soKspGnVLk+EVuWm8HfRSmZoK5NoThpgIS9uvctSNUaEB3Ritvf/feuqu4AFBEjwAUUgkY1SfW70200ZIXRY8g==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.8.tgz", + "integrity": "sha512-17n3LAFwOJHkBeeVUYoRZ+ATSDpmOQuP41n9ZxDb0N3VbnjkFEVRT+saG3wQgcHD6F7KoVHkK2GChbmcYrU+Ig==", "dev": true, "engines": { "node": ">=8.17.0" @@ -12928,23 +12928,23 @@ } }, "@blockly/block-test": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.3.tgz", - "integrity": "sha512-xFAy1sGLtGXwlNx5TgxKVmzI6l9Q0XJ7rZlyaC91ulZ7srrd3GOfFgbFaF+OwQ+oXfZCU/sGQSumrVksTaq6yw==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.0.8.tgz", + "integrity": "sha512-foW4fVKCrrmeImXNgVJZ+XjMENpOz3z3P/ob1IxixPnQ3QyO2Yjh0rfPDkSteJjto5k9Q+XhcvlW1w42gyjIKg==", "dev": true, "requires": {} }, "@blockly/dev-tools": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.0.2.tgz", - "integrity": "sha512-3h9nbpbrz8+YCbQlkpIJh1YXmlSmslxzibdPvc6VcgzXA+xzAc2a00Wy5f+ugQRq2394J8Cn/cKXqUKDLjykRA==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.2.4.tgz", + "integrity": "sha512-7FF5PByhq9EhKeYty0GFZp8b7l3qWrEIiqyVTgp/xN7iI/9N6scsDVZfCWVDSmZHgiaTHkEcQW/697IRm69HDA==", "dev": true, "requires": { - "@blockly/block-test": "^3.0.1", - "@blockly/theme-dark": "^4.0.1", - "@blockly/theme-deuteranopia": "^3.0.1", - "@blockly/theme-highcontrast": "^3.0.1", - "@blockly/theme-tritanopia": "^3.0.2", + "@blockly/block-test": "^3.0.8", + "@blockly/theme-dark": "^4.0.7", + "@blockly/theme-deuteranopia": "^3.0.7", + "@blockly/theme-highcontrast": "^3.0.7", + "@blockly/theme-tritanopia": "^3.0.8", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", @@ -12954,23 +12954,23 @@ } }, "@blockly/theme-dark": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.1.tgz", - "integrity": "sha512-OIfdnt3kvPnEW/TmfLPUftcekwoQGmxg/12LajYUdW9aOLMQaen16Vw0+BB8Q8zKInpxT6JCBYECilYRLY+RpA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.7.tgz", + "integrity": "sha512-NegmW6DxvDISxonJ8gtp/CGxYZmtNYyjR2t7V5GzwnZhU1QV1aZVJk49f3CbFftQm3W93wHZ9HQn80oTbOCbiQ==", "dev": true, "requires": {} }, "@blockly/theme-deuteranopia": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.1.tgz", - "integrity": "sha512-3zmkD3ERGAuKQjAeFFoNNAhfwmxFncXd3Mw5tHn64MlxguMJCKt7C4Siu6gRXGYpvukkpMUlbgklWyNz2okHng==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.7.tgz", + "integrity": "sha512-51NF9RqqiskCefMPwMO9JS5l+Q1ubyryx5XUwNV7Dl8LljmyaQzBy2xu6MVIG/yZDY1qR7oS2scsyOffb++oFQ==", "dev": true, "requires": {} }, "@blockly/theme-highcontrast": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.1.tgz", - "integrity": "sha512-HuEHKq7n2zTV1gb19SGjyKlCYjZeZSITWPIQeD5wfEVleOOy8z6zjLRZ9D7QoiL4ooFefWkx1kauVsWbaTqN5g==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.7.tgz", + "integrity": "sha512-uwpDXhcXXaXxWT1xkWECUBD0ao1+hzK9iLf5FWktnSqfyj6galLVjB2mxRb3ZTaVuhjvw7/qhjYzVPqzL2NKgg==", "dev": true, "requires": {} }, @@ -12982,9 +12982,9 @@ "requires": {} }, "@blockly/theme-tritanopia": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.2.tgz", - "integrity": "sha512-soKspGnVLk+EVuWm8HfRSmZoK5NoThpgIS9uvctSNUaEB3Ritvf/feuqu4AFBEjwAUUgkY1SfW70200ZIXRY8g==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.8.tgz", + "integrity": "sha512-17n3LAFwOJHkBeeVUYoRZ+ATSDpmOQuP41n9ZxDb0N3VbnjkFEVRT+saG3wQgcHD6F7KoVHkK2GChbmcYrU+Ig==", "dev": true, "requires": {} }, From 7291fa04a96d68986ae281631bb3c8e3385d1669 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 28 Mar 2023 12:47:02 -0700 Subject: [PATCH 137/141] fix: mutator not resizing for flyout (#6917) --- core/mutator.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/mutator.ts b/core/mutator.ts index 30b613d50..d5a051f52 100644 --- a/core/mutator.ts +++ b/core/mutator.ts @@ -367,7 +367,9 @@ export class Mutator extends Icon { } this.resizeBubble(); // When the mutator's workspace changes, update the source block. - ws.addChangeListener(this.workspaceChanged.bind(this)); + const boundListener = this.workspaceChanged.bind(this); + ws.addChangeListener(boundListener); + if (flyout) flyout.getWorkspace().addChangeListener(boundListener); // Update the source block immediately after the bubble becomes visible. this.updateWorkspace(); this.applyColour(); From 42e838621d8fff5e7e8616d0a240396c0448d850 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 28 Mar 2023 22:30:08 +0100 Subject: [PATCH 138/141] chore(build): Temporarily exclude blocks and generators .d.ts files (#6930) Temporarily exclude the generated .d.ts files for blocks/* and generators/* from the package. This will in due course replace the (very simplistic) hand-written versions in typings/, but for now they are not referenced anywhere a developer's tooling should be looking, and contain in some cases actually incorrect typings (e.g., in unmigrated blocks files, the blocks export is typed as ObjectConstructor, which is wrong), so do not include them in the package least they cause problems for the unwary. --- scripts/gulpfiles/package_tasks.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/gulpfiles/package_tasks.js b/scripts/gulpfiles/package_tasks.js index d71bae493..38a5b5f9a 100644 --- a/scripts/gulpfiles/package_tasks.js +++ b/scripts/gulpfiles/package_tasks.js @@ -346,7 +346,10 @@ function packageDTS() { 'typings/msg/*.d.ts', ]; return gulp.src(handwrittenSrcs, {base: 'typings'}) - .pipe(gulp.src(`${TYPINGS_BUILD_DIR}/**/*.d.ts`)) + .pipe(gulp.src(`${TYPINGS_BUILD_DIR}/**/*.d.ts`, {ignore: [ + `${TYPINGS_BUILD_DIR}/blocks/**/*`, + `${TYPINGS_BUILD_DIR}/generators/**/*`, + ]})) .pipe(gulp.replace('AnyDuringMigration', 'any')) .pipe(gulp.dest(RELEASE_DIR)); }; From 35729865777636d65d584374606eb85409b949d3 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 29 Mar 2023 10:09:48 -0700 Subject: [PATCH 139/141] chore: Rollup of 2023 Q1 updates from TranslateWiki (#6931) --- msg/json/bn.json | 5 +++-- msg/json/bs.json | 7 +++++++ msg/json/de.json | 2 +- msg/json/fi.json | 2 +- msg/json/fr.json | 6 +++--- msg/json/ia.json | 10 +++++----- msg/json/kn.json | 6 ++++++ msg/json/ko.json | 3 ++- msg/json/lb.json | 27 ++++++++++++++++++++++++--- msg/json/sd.json | 10 ++++++++++ msg/json/skr-arab.json | 3 ++- msg/json/sl.json | 26 ++++++++++++++++++-------- msg/json/sr.json | 1 + msg/json/sw.json | 2 ++ msg/json/zh-hans.json | 7 +++++++ msg/json/zh-hant.json | 4 ++-- 16 files changed, 94 insertions(+), 27 deletions(-) diff --git a/msg/json/bn.json b/msg/json/bn.json index 6590d6f3c..3b5491165 100644 --- a/msg/json/bn.json +++ b/msg/json/bn.json @@ -2,6 +2,7 @@ "@metadata": { "authors": [ "Aftabuzzaman", + "Aishik Rehman", "MasterMinhaz", "Rakibul", "Rasal Lia", @@ -15,8 +16,8 @@ "TODAY": "আজ", "DUPLICATE_BLOCK": "প্রতিলিপি", "ADD_COMMENT": "মন্তব্য যোগ করুন", - "REMOVE_COMMENT": "মন্তব্য সরাও", - "EXTERNAL_INPUTS": "বহি:স্থ ইনপুট", + "REMOVE_COMMENT": "মন্তব্য সরান", + "EXTERNAL_INPUTS": "বহিস্থ ইনপুট", "INLINE_INPUTS": "সারি ইনপুট", "DELETE_BLOCK": "ব্লকটি মুছে ফেল", "DELETE_X_BLOCKS": "%1 ব্লক অপসারণ কর", diff --git a/msg/json/bs.json b/msg/json/bs.json index ba09f5324..f561d647a 100644 --- a/msg/json/bs.json +++ b/msg/json/bs.json @@ -78,15 +78,22 @@ "CONTROLS_IF_MSG_IF": "ako", "CONTROLS_IF_MSG_ELSEIF": "inače ako", "CONTROLS_IF_MSG_ELSE": "inače", + "CONTROLS_IF_IF_TOOLTIP": "Dodaj, ukloni ili promijeni redoslijed sekcija kako bi ponovo konfigurisali ovaj if blok.", "CONTROLS_IF_ELSEIF_TOOLTIP": "Dodajte uslov bloku \"ako\".", + "CONTROLS_IF_ELSE_TOOLTIP": "Dodaj konačni, sveobuhvatni uvjet u if blok.", "LOGIC_COMPARE_HELPURL": "https://bs.wikipedia.org/wiki/Nejednakost", "LOGIC_COMPARE_TOOLTIP_EQ": "Vraća tačno ako su oba ulaza jednaka jedan drugom.", + "LOGIC_COMPARE_TOOLTIP_NEQ": "Vraća tačno ako su oba ulaza jednaka jedan drugom.", "LOGIC_COMPARE_TOOLTIP_LT": "Vraća tačno ako je prvi ulaz manji od drugog ulaza.", + "LOGIC_COMPARE_TOOLTIP_LTE": "Vraća tačno ako je prvi ulaz manji ili jednak drugom ulazu.", "LOGIC_COMPARE_TOOLTIP_GT": "Vraća tačno ako je prvi ulaz veći od drugog ulaza.", + "LOGIC_COMPARE_TOOLTIP_GTE": "Vraća tačno ako je prvi ulaz veći ili jednak drugom ulazu.", "LOGIC_OPERATION_TOOLTIP_AND": "Vraća tačno ako su oba ulaza tačna.", "LOGIC_OPERATION_AND": "i", + "LOGIC_OPERATION_TOOLTIP_OR": "Vrati tačno ako je barem jedan od ulaza istinit.", "LOGIC_OPERATION_OR": "ili", "LOGIC_NEGATE_TITLE": "nije %1", + "LOGIC_NEGATE_TOOLTIP": "Vraća tačno ako je unos netačan. Vraća netačno ako je unos tačan.", "LOGIC_BOOLEAN_TRUE": "tačno", "LOGIC_BOOLEAN_FALSE": "netačno", "LOGIC_BOOLEAN_TOOLTIP": "Vraća ili tačno ili netačno.", diff --git a/msg/json/de.json b/msg/json/de.json index 8d1d0d631..cace0b548 100644 --- a/msg/json/de.json +++ b/msg/json/de.json @@ -55,7 +55,7 @@ "CANNOT_DELETE_VARIABLE_PROCEDURE": "Die Variable „%1“ kann nicht gelöscht werden, da sie Teil der Definition der Funktion „%2“ ist.", "DELETE_VARIABLE": "Die Variable „%1“ löschen", "COLOUR_PICKER_HELPURL": "https://de.wikipedia.org/wiki/Farbe", - "COLOUR_PICKER_TOOLTIP": "Wählt eine Farbe aus der Palette aus.", + "COLOUR_PICKER_TOOLTIP": "Wähle eine Farbe aus der Palette.", "COLOUR_RANDOM_TITLE": "zufällige Farbe", "COLOUR_RANDOM_TOOLTIP": "Erzeugt eine Farbe nach dem Zufallsprinzip.", "COLOUR_RGB_TITLE": "Farbe aus", diff --git a/msg/json/fi.json b/msg/json/fi.json index 6e8dc079e..b77a0265e 100644 --- a/msg/json/fi.json +++ b/msg/json/fi.json @@ -41,7 +41,7 @@ "REDO": "Tee uudelleen", "CHANGE_VALUE_TITLE": "Muuta arvoa:", "RENAME_VARIABLE": "Nimeä uudelleen muuttuja...", - "RENAME_VARIABLE_TITLE": "Nimeä uudelleen kaikki '%1' muuttujaa:", + "RENAME_VARIABLE_TITLE": "Nimeä uudelleen muuttuja '%1' kaikkialla:", "NEW_VARIABLE": "Luo muuttuja...", "NEW_STRING_VARIABLE": "Luo merkkijonomuuttuja...", "NEW_NUMBER_VARIABLE": "Luo numeromuuttuja...", diff --git a/msg/json/fr.json b/msg/json/fr.json index 6cc6a37b6..19225a337 100644 --- a/msg/json/fr.json +++ b/msg/json/fr.json @@ -283,7 +283,7 @@ "LISTS_GET_INDEX_GET_REMOVE": "obtenir et supprimer", "LISTS_GET_INDEX_REMOVE": "retirer", "LISTS_GET_INDEX_FROM_START": "nº", - "LISTS_GET_INDEX_FROM_END": "n° depuis la fin", + "LISTS_GET_INDEX_FROM_END": "nº depuis la fin", "LISTS_GET_INDEX_FIRST": "premier", "LISTS_GET_INDEX_LAST": "dernier", "LISTS_GET_INDEX_RANDOM": "au hasard", @@ -313,9 +313,9 @@ "LISTS_SET_INDEX_TOOLTIP_INSERT_LAST": "Ajoute l’élément à la fin d’une liste.", "LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM": "Insère l’élément au hasard dans une liste.", "LISTS_GET_SUBLIST_START_FROM_START": "obtenir la sous-liste depuis le n°", - "LISTS_GET_SUBLIST_START_FROM_END": "obtenir la sous-liste depuis le n° depuis la fin", + "LISTS_GET_SUBLIST_START_FROM_END": "obtenir la sous-liste depuis le nº depuis la fin", "LISTS_GET_SUBLIST_START_FIRST": "obtenir la sous-liste depuis le début", - "LISTS_GET_SUBLIST_END_FROM_START": "jusqu’au n°", + "LISTS_GET_SUBLIST_END_FROM_START": "jusqu’au nº", "LISTS_GET_SUBLIST_END_FROM_END": "jusqu’au n° depuis la fin", "LISTS_GET_SUBLIST_END_LAST": "jusqu’à la fin", "LISTS_GET_SUBLIST_TOOLTIP": "Crée une copie de la partie spécifiée d’une liste.", diff --git a/msg/json/ia.json b/msg/json/ia.json index 0921c912f..e86fbf44a 100644 --- a/msg/json/ia.json +++ b/msg/json/ia.json @@ -20,10 +20,10 @@ "DELETE_X_BLOCKS": "Deler %1 blocos", "DELETE_ALL_BLOCKS": "Deler tote le %1 blocos?", "CLEAN_UP": "Rangiar le blocos", - "COLLAPSE_BLOCK": "Plicar bloco", - "COLLAPSE_ALL": "Plicar blocos", - "EXPAND_BLOCK": "Displicar bloco", - "EXPAND_ALL": "Displicar blocos", + "COLLAPSE_BLOCK": "Contraher bloco", + "COLLAPSE_ALL": "Contraher blocos", + "EXPAND_BLOCK": "Expander bloco", + "EXPAND_ALL": "Expander blocos", "DISABLE_BLOCK": "Disactivar bloco", "ENABLE_BLOCK": "Activar bloco", "HELP": "Adjuta", @@ -328,7 +328,7 @@ "PROCEDURES_IFRETURN_WARNING": "Attention: Iste bloco pote solmente esser usate in le definition de un function.", "WORKSPACE_COMMENT_DEFAULT_TEXT": "Dice qualcosa...", "WORKSPACE_ARIA_LABEL": "Spatio de travalio de Blockly", - "COLLAPSED_WARNINGS_WARNING": "Blocos plicate contine advertimentos.", + "COLLAPSED_WARNINGS_WARNING": "Il ha blocos contrahite con advertimentos.", "DIALOG_OK": "OK", "DIALOG_CANCEL": "Cancellar" } diff --git a/msg/json/kn.json b/msg/json/kn.json index dd1c68b4b..21c8bc93f 100644 --- a/msg/json/kn.json +++ b/msg/json/kn.json @@ -3,6 +3,7 @@ "authors": [ "Ananth subray", "Anoop rao", + "Ashay vb", "Ksh31", "Ksramwiki1957", "Mahadevaiah Siddaiah", @@ -109,6 +110,10 @@ "LOGIC_TERNARY_IF_FALSE": "ಸುಳ್ಳು ಆಗಿದ್ದರೆ", "LOGIC_TERNARY_TOOLTIP": "'ಪರೀಕ್ಷೆ'ಯಲ್ಲಿನ ಷರತ್ತನ್ನು ಪರಿಶೀಲಿಸಿ. ಷರತ್ತು ಸರಿಯಾಗಿದ್ದರೆ, 'ಸತ್ಯವಾಗಿದ್ದರೆ' ಮೌಲ್ಯವನ್ನು; ಇಲ್ಲದಿದ್ದರೆ 'ಸುಳ್ಳಾಗಿದ್ದರೆ' ಮೌಲ್ಯವನ್ನೂ ಹಿಂತಿರುಗಿಸುವುದು.", "MATH_NUMBER_TOOLTIP": "ಒಂದು ಸಂಖ್ಯೆ.", + "MATH_TRIG_SIN": "ಪಾಪ", + "MATH_TRIG_TAN": "ಕಂದುಬಣ್ಣ", + "MATH_TRIG_ASIN": "ಅಸಿನ್", + "MATH_TRIG_ACOS": "ಅಕೋಸ್", "MATH_ARITHMETIC_TOOLTIP_ADD": "ಎರಡು ಸಂಖ್ಯೆಗಳ ಮೊತ್ತವನ್ನು ಹಿಂತಿರುಗಿಸಿ.", "MATH_ARITHMETIC_TOOLTIP_MINUS": "ಎರಡು ಸಂಖ್ಯೆಗಳ ವ್ಯತ್ಯಾಸವನ್ನು ಹಿಂತಿರುಗಿಸಿ.", "MATH_ARITHMETIC_TOOLTIP_MULTIPLY": "ಎರಡು ಸಂಖ್ಯೆಗಳ ಗುಣಲಬ್ಧವನ್ನು ಹಿಂತಿರುಗಿಸಿ.", @@ -241,6 +246,7 @@ "LISTS_GET_INDEX_GET": "ಪಡೆಯಿರಿ", "LISTS_GET_INDEX_GET_REMOVE": "ಪಡೆಯಿರಿ ಮತ್ತು ತೆಗೆದುಹಾಕಿ", "LISTS_GET_INDEX_REMOVE": "ತೆಗೆ", + "LISTS_GET_INDEX_FROM_START": "#", "LISTS_GET_INDEX_FROM_END": "# ಕೊನೆಯಿಂದ", "LISTS_GET_INDEX_FIRST": "ಮೊದಲ", "LISTS_GET_INDEX_LAST": "ಕೊನೆಯ", diff --git a/msg/json/ko.json b/msg/json/ko.json index 7ac1a8aee..c688b704b 100644 --- a/msg/json/ko.json +++ b/msg/json/ko.json @@ -18,6 +18,7 @@ "Priviet", "Revi", "SeoJeongHo", + "Snddl3", "Ykhwong", "아라" ] @@ -172,7 +173,7 @@ "MATH_IS_NEGATIVE": "가 음(-)수 이면", "MATH_IS_DIVISIBLE_BY": "가 다음 수로 나누어 떨어지면 :", "MATH_IS_TOOLTIP": "어떤 수가 짝 수, 홀 수, 소 수, 정 수, 양 수, 음 수, 나누어 떨어지는 수 인지 검사해 결과값을 돌려줍니다. 참(true) 또는 거짓(false) 값을 돌려줌.", - "MATH_CHANGE_TITLE": "바꾸기 %1 만큼 %2", + "MATH_CHANGE_TITLE": "%1 을 %2 만큼 바꾸기", "MATH_CHANGE_TOOLTIP": "변수 '%1' 에 저장되어있는 값에, 어떤 수를 더해, 변수에 다시 저장합니다.", "MATH_ROUND_HELPURL": "https://ko.wikipedia.org/wiki/반올림", "MATH_ROUND_TOOLTIP": "어떤 수를 반올림/올림/버림한 결과를, 정수값으로 돌려줍니다.", diff --git a/msg/json/lb.json b/msg/json/lb.json index 5e7a386ff..3734add45 100644 --- a/msg/json/lb.json +++ b/msg/json/lb.json @@ -3,7 +3,8 @@ "authors": [ "Les Meloures", "Robby", - "Soued031" + "Soued031", + "Volvox" ] }, "VARIABLES_DEFAULT_NAME": "Element", @@ -15,6 +16,7 @@ "DUPLICATE_COMMENT": "Bemierkung kopéieren", "DELETE_BLOCK": "Block läschen", "DELETE_X_BLOCKS": "%1 Bléck läschen", + "DELETE_ALL_BLOCKS": "All %1 Bléck läschen?", "CLEAN_UP": "Bléck opraumen", "COLLAPSE_BLOCK": "Block zesummeklappen", "COLLAPSE_ALL": "Bléck zesummeklappen", @@ -29,7 +31,15 @@ "RENAME_VARIABLE": "Variabel ëmbenennen...", "RENAME_VARIABLE_TITLE": "All '%1' Variabelen ëmbenennen op:", "NEW_VARIABLE": "Variabel uleeën...", - "NEW_VARIABLE_TITLE": "Neie variabelen Numm:", + "NEW_NUMBER_VARIABLE": "Zuelevariabel uleeën...", + "NEW_COLOUR_VARIABLE": "Faarfvariabel uleeën...", + "NEW_VARIABLE_TYPE_TITLE": "Neie Variabelentyp:", + "NEW_VARIABLE_TITLE": "Neie Variabelennumm:", + "VARIABLE_ALREADY_EXISTS": "Et gëtt schonn eng Variabel mam Numm '%1'.", + "VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE": "Et gëtt schonn eng Variabel mam Numm '%1' fir een aneren Typ: '%2'.", + "DELETE_VARIABLE_CONFIRMATION": "%1 Verwendunge vun der Variabel '%2' läschen?", + "CANNOT_DELETE_VARIABLE_PROCEDURE": "D'Variabel '%1' kann net geläscht ginn, well se Deel vun der Definitioun vun der Funktioun '%2' ass.", + "DELETE_VARIABLE": "D'Variabel '%1' läschen", "COLOUR_PICKER_TOOLTIP": "Sicht eng Faarf an der Palette eraus.", "COLOUR_RANDOM_TITLE": "zoufälleg Faarf", "COLOUR_RANDOM_TOOLTIP": "Eng zoufälleg Faarf eraussichen.", @@ -62,6 +72,12 @@ "LOGIC_TERNARY_IF_TRUE": "wa wouer", "LOGIC_TERNARY_IF_FALSE": "wa falsch", "MATH_NUMBER_TOOLTIP": "Eng Zuel.", + "MATH_TRIG_SIN": "sin", + "MATH_TRIG_COS": "cos", + "MATH_TRIG_TAN": "tan", + "MATH_TRIG_ASIN": "asin", + "MATH_TRIG_ACOS": "acos", + "MATH_TRIG_ATAN": "atan", "MATH_ARITHMETIC_TOOLTIP_ADD": "Den Total vun den zwou Zuelen zréckginn.", "MATH_ARITHMETIC_TOOLTIP_MULTIPLY": "D'Produkt vun den zwou Zuelen zréckginn.", "MATH_SINGLE_HELPURL": "https://lb.wikipedia.org/wiki/Racine carrée", @@ -73,6 +89,7 @@ "MATH_IS_WHOLE": "ass eng ganz Zuel", "MATH_IS_POSITIVE": "ass positiv", "MATH_IS_NEGATIVE": "ass negativ", + "MATH_IS_DIVISIBLE_BY": "ass deelbar duerch", "MATH_CHANGE_TITLE": "änneren %1 ëm %2", "MATH_ROUND_TOOLTIP": "Eng Zuel op- oder ofrënnen.", "MATH_ROUND_OPERATOR_ROUND": "opronnen", @@ -84,6 +101,7 @@ "MATH_ONLIST_OPERATOR_RANDOM": "zoufällegt Element vun enger Lëscht", "MATH_MODULO_TITLE": "Rescht vu(n) %1 ÷ %2", "MATH_RANDOM_INT_TITLE": "zoufälleg ganz Zuel tëscht %1 a(n) %2", + "MATH_ATAN2_TITLE": "atan2 vun X:%1 Y:%2", "TEXT_TEXT_TOOLTIP": "E Buschtaf, e Wuert oder eng Textzeil.", "TEXT_CREATE_JOIN_ITEM_TOOLTIP": "En Element bei den Text derbäisetzen.", "TEXT_LENGTH_TITLE": "Längt vu(n) %1", @@ -95,8 +113,10 @@ "TEXT_GET_SUBSTRING_END_LAST": "bis bei de leschte Buschtaf", "TEXT_PRINT_TITLE": "%1 drécken", "TEXT_PROMPT_TOOLTIP_TEXT": "Frot de Benotzer no engem Text.", + "TEXT_COUNT_MESSAGE0": "ziel %1 an %2", "TEXT_REPLACE_MESSAGE0": "%1 duerch %2 a(n) %3 ersetzen", "TEXT_REPLACE_TOOLTIP": "All Kéiers wou e bestëmmten Text do ass duerch en aneren Text ersetzen.", + "TEXT_REVERSE_MESSAGE0": "%1 ëmdréinen", "TEXT_REVERSE_TOOLTIP": "Dréint d'Reiefolleg vun den Zeechen am Text ëm.", "LISTS_CREATE_WITH_CONTAINER_TITLE_ADD": "Lëscht", "LISTS_CREATE_WITH_ITEM_TOOLTIP": "En Element op d'Lëscht derbäisetzen.", @@ -111,7 +131,7 @@ "LISTS_GET_INDEX_RANDOM": "Zoufall", "LISTS_INDEX_FROM_START_TOOLTIP": "%1 ass dat éischt Element.", "LISTS_INDEX_FROM_END_TOOLTIP": "%1 ass dat éischt Element.", - "LISTS_GET_INDEX_TOOLTIP_GET_RANDOM": "Schéckt en zoufällegt Element aus enger Lëscht zréck.", + "LISTS_GET_INDEX_TOOLTIP_GET_RANDOM": "Gëtt en zoufällegt Element aus enger Lëscht zréck.", "LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST": "Hëlt dat lescht Element aus enger Lëscht eraus.", "LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM": "Hëlt en zoufällegt Element aus enger Lëscht eraus.", "LISTS_SET_INDEX_INSERT": "asetzen op", @@ -129,6 +149,7 @@ "PROCEDURES_DEFNORETURN_COMMENT": "Dës Funktioun beschreiwen...", "PROCEDURES_DEFRETURN_RETURN": "zréck", "PROCEDURES_CREATE_DO": "'%1' uleeën", + "PROCEDURES_IFRETURN_WARNING": "Opgepasst: Dëse Block däerf nëmmen bannent enger Funktiounsdefitioun benotzt ginn.", "WORKSPACE_COMMENT_DEFAULT_TEXT": "Sot eppes...", "DIALOG_OK": "OK", "DIALOG_CANCEL": "Ofbriechen" diff --git a/msg/json/sd.json b/msg/json/sd.json index 308ad1608..f6e7b5f03 100644 --- a/msg/json/sd.json +++ b/msg/json/sd.json @@ -3,12 +3,14 @@ "authors": [ "Aursani", "Charan", + "Charoo", "Indus Asia", "Mehtab ahmed", "Tweety" ] }, "VARIABLES_DEFAULT_NAME": "اسم", + "UNNAMED_KEY": "بينام", "TODAY": "اڄ", "DUPLICATE_BLOCK": "نقل", "ADD_COMMENT": "رايو ڏيو", @@ -31,8 +33,16 @@ "REDO": "ٻيهر ڪريو", "CHANGE_VALUE_TITLE": "قدر بدلايو", "RENAME_VARIABLE": "ڦرڻي کي نئون نالو ڏيو...", + "RENAME_VARIABLE_TITLE": "سڀني '%1' کي تبديل ڪيو:", "NEW_VARIABLE": "نئون ڦرڻو...", + "NEW_STRING_VARIABLE": "اسٽرينگ وري ايبل ٺاھيو...", + "NEW_NUMBER_VARIABLE": "نمبر وري ايبل ٺاھيو...", + "NEW_COLOUR_VARIABLE": "رنگ وري ايبل ٺاھيو...", + "NEW_VARIABLE_TYPE_TITLE": "نئين وري ايبل جو قسم:", "NEW_VARIABLE_TITLE": "ڦرڻي جو نئون نالو:", + "VARIABLE_ALREADY_EXISTS": "'%1' جي نالي سان اڳ ئي وري ايبل موجود آھي.", + "VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE": "'%2' وري ايبل لاءِ '%1' وري اينل اڳ ئي موجود آھي،", + "DELETE_VARIABLE_CONFIRMATION": "'%2' وري ايبل جي استعمال %1 مٽايو؟", "COLOUR_PICKER_TOOLTIP": "رنگ دٻيءَ مان رنگ چونڊيو.", "COLOUR_RANDOM_TITLE": "بنا ترتيب رنگ", "COLOUR_RANDOM_TOOLTIP": "ڪو بہ ‌رنگ چونڊيو.", diff --git a/msg/json/skr-arab.json b/msg/json/skr-arab.json index 187cb3691..39d84d2ee 100644 --- a/msg/json/skr-arab.json +++ b/msg/json/skr-arab.json @@ -31,6 +31,7 @@ "NEW_VARIABLE": "متغیر بݨاؤ۔۔۔", "NEW_VARIABLE_TITLE": "نواں متغیر ناں:", "VARIABLE_ALREADY_EXISTS": "'%1' نامی متغیر پہلے موجود ہے۔", + "COLOUR_PICKER_HELPURL": "https://en.wikipedia.org/wiki/Color", "COLOUR_RANDOM_TITLE": "بنا ترتيب رنگ", "COLOUR_RGB_TITLE": "نال رن٘گ", "COLOUR_RGB_RED": "رتا", @@ -86,7 +87,7 @@ "LISTS_GET_INDEX_FROM_END": "# چھیکڑ کنوں", "LISTS_GET_INDEX_FIRST": "پہلا", "LISTS_GET_INDEX_LAST": "چھیکڑی", - "LISTS_GET_INDEX_RANDOM": "قُݨے نال", + "LISTS_GET_INDEX_RANDOM": "بے ترتیبا", "LISTS_SET_INDEX_SET": "سیٹ", "LISTS_SET_INDEX_INSERT": "تے درج کرو", "LISTS_SET_INDEX_INPUT_TO": "بطور", diff --git a/msg/json/sl.json b/msg/json/sl.json index 8e80cc25c..8e21e4a29 100644 --- a/msg/json/sl.json +++ b/msg/json/sl.json @@ -74,9 +74,9 @@ "CONTROLS_FOREACH_TITLE": "za vsak element %1 v seznamu %2", "CONTROLS_FOREACH_TOOLTIP": "Za vsak element v seznamu nastavi spremenljivko »%1« na ta element. Pri tem se izvedejo določeni stavki.", "CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK": "prekini zanko", - "CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE": "nadaljuj z naslednjo ponovitvijo zanke", + "CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE": "nadaljuj z naslednjo iteracijo zanke", "CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK": "Prekine vsebujočo zanko.", - "CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE": "Preskoči preostanek te zanke in nadaljuje z naslednjo ponovitvijo.", + "CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE": "Preskočite preostanek te zanke in nadaljujte z naslednjo iteracijo.", "CONTROLS_FLOW_STATEMENTS_WARNING": "Pozor: Ta blok lahko uporabite znotraj zanke samo enkrat.", "CONTROLS_IF_TOOLTIP_1": "Če je vrednost resnična, izvedi določene stavke.", "CONTROLS_IF_TOOLTIP_2": "Če je vrednost resnična, izvedi prvo skupino stavkov. Sicer izvedi drugo skupino stavkov.", @@ -188,21 +188,27 @@ "MATH_ATAN2_TOOLTIP": "Vrne arkus tangens točke (X, Y) v stopinjah med −180 in 180.", "TEXT_TEXT_HELPURL": "https://sl.wikipedia.org/wiki/Niz", "TEXT_TEXT_TOOLTIP": "Črka, beseda ali vrstica besedila.", + "TEXT_JOIN_HELPURL": "https://github.com/google/blockly/wiki/Text#text-creation", "TEXT_JOIN_TITLE_CREATEWITH": "ustvari besedilo iz", "TEXT_JOIN_TOOLTIP": "Ustvari besedilo tako, da združi poljubno število elementov.", - "TEXT_CREATE_JOIN_TITLE_JOIN": "združi", + "TEXT_CREATE_JOIN_TITLE_JOIN": "spoji", "TEXT_CREATE_JOIN_TOOLTIP": "Doda, odstrani ali spremeni vrstni red odsekov za ponovno nastavitev tega bloka besedila.", "TEXT_CREATE_JOIN_ITEM_TOOLTIP": "Doda element k besedilu.", - "TEXT_APPEND_TITLE": "k %1 dodaj besedilo %2", - "TEXT_APPEND_TOOLTIP": "Doda besedilo k spremenljivki »%1«.", + "TEXT_APPEND_HELPURL": "https://github.com/google/blockly/wiki/Text#text-modification", + "TEXT_APPEND_TITLE": "k %1 pripni besedilo %2", + "TEXT_APPEND_TOOLTIP": "Pripne neko besedilo spremenljivki »%1«.", + "TEXT_LENGTH_HELPURL": "https://github.com/google/blockly/wiki/Text#text-modification", "TEXT_LENGTH_TITLE": "dolžina %1", "TEXT_LENGTH_TOOLTIP": "Vrne število znakov (vključno s presledki) v določenem besedilu.", + "TEXT_ISEMPTY_HELPURL": "https://github.com/google/blockly/wiki/Text#checking-for-empty-text", "TEXT_ISEMPTY_TITLE": "%1 je prazno", "TEXT_ISEMPTY_TOOLTIP": "Vrne resnično, če je določeno besedilo prazno.", + "TEXT_INDEXOF_HELPURL": "https://github.com/google/blockly/wiki/Text#finding-text", "TEXT_INDEXOF_TOOLTIP": "Vrne mesto (indeks) prve/zadnje pojavitve drugega besedila v prvem besedilu. Če besedila ne najde, vrne %1.", "TEXT_INDEXOF_TITLE": "v besedilu %1 %2 %3", "TEXT_INDEXOF_OPERATOR_FIRST": "najdi prvo pojavitev besedila", "TEXT_INDEXOF_OPERATOR_LAST": "najdi zadnjo pojavitev besedila", + "TEXT_CHARAT_HELPURL": "https://github.com/google/blockly/wiki/Text#extracting-text", "TEXT_CHARAT_TITLE": "v besedilu %1 %2", "TEXT_CHARAT_FROM_START": "vrni črko št.", "TEXT_CHARAT_FROM_END": "vrni črko št. od konca", @@ -218,6 +224,7 @@ "TEXT_GET_SUBSTRING_END_FROM_START": "do črke št.", "TEXT_GET_SUBSTRING_END_FROM_END": "do črke št. od konca", "TEXT_GET_SUBSTRING_END_LAST": "do zadnje črke", + "TEXT_CHANGECASE_HELPURL": "https://github.com/google/blockly/wiki/Text#adjusting-text-case", "TEXT_CHANGECASE_TOOLTIP": "Vrne kopijo besedila v drugi obliki.", "TEXT_CHANGECASE_OPERATOR_UPPERCASE": "v VELIKE ČRKE", "TEXT_CHANGECASE_OPERATOR_LOWERCASE": "v male črke", @@ -226,6 +233,7 @@ "TEXT_TRIM_OPERATOR_BOTH": "odstrani presledke z obeh strani", "TEXT_TRIM_OPERATOR_LEFT": "odstrani presledke z leve strani", "TEXT_TRIM_OPERATOR_RIGHT": "odstrani presledke z desne strani", + "TEXT_PRINT_HELPURL": "https://github.com/google/blockly/wiki/Text#printing-text", "TEXT_PRINT_TITLE": "izpiši %1", "TEXT_PRINT_TOOLTIP": "Izpiše določeno besedilo, številko ali drugo vrednost.", "TEXT_PROMPT_TYPE_TEXT": "vprašaj za besedilo s sporočilom", @@ -237,6 +245,7 @@ "TEXT_REPLACE_MESSAGE0": "zamenjaj %1 z %2 v %3", "TEXT_REPLACE_TOOLTIP": "Zamenja vse pojavitve besedila v drugem besedilu.", "TEXT_REVERSE_MESSAGE0": "obrni %1", + "TEXT_REVERSE_HELPURL": "https://github.com/google/blockly/wiki/Text#reversing-text", "TEXT_REVERSE_TOOLTIP": "Obrne vrstni red znakov v besedilu.", "LISTS_CREATE_EMPTY_TITLE": "ustvari prazen seznam", "LISTS_CREATE_EMPTY_TOOLTIP": "Vrne seznam dolžine 0, ki ne vsebuje nobenih podatkovnih zapisov.", @@ -286,7 +295,7 @@ "LISTS_SET_INDEX_TOOLTIP_SET_RANDOM": "Nastavi naključni element seznama.", "LISTS_SET_INDEX_TOOLTIP_INSERT_FROM": "Vstavi element na določeno mesto v seznamu.", "LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST": "Vstavi element na začetek seznama.", - "LISTS_SET_INDEX_TOOLTIP_INSERT_LAST": "Doda element na konec seznama.", + "LISTS_SET_INDEX_TOOLTIP_INSERT_LAST": "Pripne element na konec seznama.", "LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM": "Vstavi element na naključno mesto v seznamu.", "LISTS_GET_SUBLIST_START_FROM_START": "ustvari podseznam od mesta št.", "LISTS_GET_SUBLIST_START_FROM_END": "ustvari podseznam od mesta št. od konca", @@ -302,11 +311,12 @@ "LISTS_SORT_TYPE_NUMERIC": "številsko", "LISTS_SORT_TYPE_TEXT": "abecedno", "LISTS_SORT_TYPE_IGNORECASE": "abecedno, prezri velikost črk", + "LISTS_SPLIT_HELPURL": "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists", "LISTS_SPLIT_LIST_FROM_TEXT": "ustvari seznam iz besedila", "LISTS_SPLIT_TEXT_FROM_LIST": "ustvari besedilo iz seznama", "LISTS_SPLIT_WITH_DELIMITER": "z ločilom", "LISTS_SPLIT_TOOLTIP_SPLIT": "Razdruži besedilo v seznam besedil s prelomom pri vsakem ločilu.", - "LISTS_SPLIT_TOOLTIP_JOIN": "Združi seznam besedil v eno besedilo z ločilom med besedili.", + "LISTS_SPLIT_TOOLTIP_JOIN": "Spoji seznam besedil v eno besedilo z razmejevalcem med besedili.", "LISTS_REVERSE_MESSAGE0": "obrni %1", "LISTS_REVERSE_TOOLTIP": "Obrne kopijo seznama.", "VARIABLES_GET_TOOLTIP": "Vrne vrednost spremenljivke.", @@ -328,7 +338,7 @@ "PROCEDURES_CALLNORETURN_TOOLTIP": "Izvede uporabniško določeno funkcijo »%1«.", "PROCEDURES_CALLRETURN_HELPURL": "https://sl.wikipedia.org/wiki/Subrutina", "PROCEDURES_CALLRETURN_TOOLTIP": "Izvede uporabniško funkcijo »%1« in uporabi njen izhod.", - "PROCEDURES_MUTATORCONTAINER_TITLE": "vnosi", + "PROCEDURES_MUTATORCONTAINER_TITLE": "vhodi", "PROCEDURES_MUTATORCONTAINER_TOOLTIP": "Doda, odstrani ali spremeni vrstni red vnosov za to funkcijo.", "PROCEDURES_MUTATORARG_TITLE": "ime vnosa:", "PROCEDURES_MUTATORARG_TOOLTIP": "Funkciji doda vnos.", diff --git a/msg/json/sr.json b/msg/json/sr.json index ab6714d5f..088bfa8f1 100644 --- a/msg/json/sr.json +++ b/msg/json/sr.json @@ -8,6 +8,7 @@ "Obsuser", "Perevod16", "Rancher", + "Zenfiric", "Zoranzoki21", "Милан Јелисавчић", "아라" diff --git a/msg/json/sw.json b/msg/json/sw.json index 76095333f..def24c10f 100644 --- a/msg/json/sw.json +++ b/msg/json/sw.json @@ -1,10 +1,12 @@ { "@metadata": { "authors": [ + "Wangombe", "Yasen igra" ] }, "TODAY": "Leo", "HELP": "Msaada", + "UNDO": "Tengua", "DIALOG_OK": "Sawa" } diff --git a/msg/json/zh-hans.json b/msg/json/zh-hans.json index 34019dba1..952dcb024 100644 --- a/msg/json/zh-hans.json +++ b/msg/json/zh-hans.json @@ -14,6 +14,7 @@ "Liuxinyu970226", "Luotiancheng", "Muhaoying", + "Phoenix3145", "Qiyue2001", "Shatteredwind", "Shimamura Sakura", @@ -128,6 +129,12 @@ "LOGIC_TERNARY_TOOLTIP": "检查“断言”里的条件语句。如果条件为真,则返回“如果为真”的值,否则,则返回“如果为假”的值。", "MATH_NUMBER_HELPURL": "https://zh.wikipedia.org/wiki/数", "MATH_NUMBER_TOOLTIP": "一个数值。", + "MATH_TRIG_SIN": "正弦", + "MATH_TRIG_COS": "余弦", + "MATH_TRIG_TAN": "正切", + "MATH_TRIG_ASIN": "反正弦", + "MATH_TRIG_ACOS": "反余玄", + "MATH_TRIG_ATAN": "反正切", "MATH_ARITHMETIC_HELPURL": "https://zh.wikipedia.org/wiki/算术", "MATH_ARITHMETIC_TOOLTIP_ADD": "返回两个数值的和。", "MATH_ARITHMETIC_TOOLTIP_MINUS": "返回两个数值的差。", diff --git a/msg/json/zh-hant.json b/msg/json/zh-hant.json index 2c5326e19..393438f5f 100644 --- a/msg/json/zh-hant.json +++ b/msg/json/zh-hant.json @@ -86,7 +86,7 @@ "CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE": "跳過這個循環的其餘步驟,並繼續下一次的循環。", "CONTROLS_FLOW_STATEMENTS_WARNING": "警告:此區塊僅可用於循環內。", "CONTROLS_IF_TOOLTIP_1": "當值為 true 時,執行一些陳述式。", - "CONTROLS_IF_TOOLTIP_2": "當值為 true 時,執行第一個陳述式。否則,執行第二個陳述式。", + "CONTROLS_IF_TOOLTIP_2": "值為是(true)就執行第一塊陳述式,否則執行第二塊。", "CONTROLS_IF_TOOLTIP_3": "如果第一個值為 true,則執行第一個陳述式。否則,當第二個值為 true 時,則執行第二個陳述式。", "CONTROLS_IF_TOOLTIP_4": "如果第一個值為 true,則執行第一個陳述式。否則當第二個值為 true 時,則執行第二個陳述式。如果前幾個敘述都不為 ture,則執行最後一個陳述式。", "CONTROLS_IF_MSG_IF": "如果", @@ -163,7 +163,7 @@ "MATH_CHANGE_TITLE": "修改 %1 自 %2", "MATH_CHANGE_TOOLTIP": "將數字加到變數「%1」。", "MATH_ROUND_HELPURL": "https://zh.wikipedia.org/wiki/數值簡化", - "MATH_ROUND_TOOLTIP": "將數字無條件進位或無條件捨去。", + "MATH_ROUND_TOOLTIP": "上捨入或下捨入數字", "MATH_ROUND_OPERATOR_ROUND": "四捨五入", "MATH_ROUND_OPERATOR_ROUNDUP": "無條件進位", "MATH_ROUND_OPERATOR_ROUNDDOWN": "無條件捨去", From ba208037c0d6d978802344914344ab5ce2b40cf4 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 29 Mar 2023 10:09:58 -0700 Subject: [PATCH 140/141] chore: update renamings file for 2023 Q1 release (#6932) --- scripts/migration/renamings.json5 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index d2b7433aa..308ea2bce 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1422,12 +1422,14 @@ }, ], - 'develop': [ - // New renamings go here! + '9.2.0': [ { oldName: 'Blockly.TouchGesture', newName: 'Blockly.Gesture', }, + ], + + '9.3.0': [ { oldName: 'Blockly.Xml', exports: { @@ -1437,4 +1439,8 @@ }, } ], + + 'develop': [ + // New renamings go here! + ], } From 9328eebd73704c7cd377a082e60c09f7139f92d4 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 29 Mar 2023 10:10:11 -0700 Subject: [PATCH 141/141] chore: Update metadata for 2023 Q1 release (#6933) --- tests/scripts/check_metadata.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/scripts/check_metadata.sh b/tests/scripts/check_metadata.sh index 7df0b1b8d..3c7823db1 100755 --- a/tests/scripts/check_metadata.sh +++ b/tests/scripts/check_metadata.sh @@ -33,7 +33,8 @@ readonly RELEASE_DIR='dist' # Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion) # Q4 2022 8.0.0 870104 # Q4 2022 9.1.1 903357 -readonly BLOCKLY_SIZE_EXPECTED=903357 +# Q1 2023 9.2.1 909181 +readonly BLOCKLY_SIZE_EXPECTED=909181 # Size of blocks_compressed.js # Q2 2019 2.20190722.0 75618 @@ -52,7 +53,8 @@ readonly BLOCKLY_SIZE_EXPECTED=903357 # Q3 2022 8.0.0 102176 (mid-quarter typescript conversion) # Q4 2022 8.0.0 102213 # Q4 2022 9.1.1 102190 -readonly BLOCKS_SIZE_EXPECTED=102190 +# Q1 2023 9.2.1 101114 +readonly BLOCKS_SIZE_EXPECTED=101114 # Size of blockly_compressed.js.gz # Q2 2019 2.20190722.0 180925 @@ -72,7 +74,8 @@ readonly BLOCKS_SIZE_EXPECTED=102190 # Q3 2022 8.0.0 185766 (mid-quarter typescript conversion) # Q4 2022 8.0.0 175140 # Q4 2022 9.1.1 179306 -readonly BLOCKLY_GZ_SIZE_EXPECTED=179306 +# Q1 2023 9.2.1 179814 +readonly BLOCKLY_GZ_SIZE_EXPECTED=179814 # Size of blocks_compressed.js.gz # Q2 2019 2.20190722.0 14552 @@ -91,7 +94,8 @@ readonly BLOCKLY_GZ_SIZE_EXPECTED=179306 # Q3 2022 8.0.0 17016 (mid-quarter typescript conversion) # Q4 2022 8.0.0 17188 # Q4 2022 9.1.1 17182 -readonly BLOCKS_GZ_SIZE_EXPECTED=17182 +# Q1 2023 9.2.1 17262 +readonly BLOCKS_GZ_SIZE_EXPECTED=17262 # ANSI colors readonly BOLD_GREEN='\033[1;32m'