release: v10.0.2 #7295 and #7297 (#7298)

* fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295)

* fix(generators): Add missing declarations for Order enums

* chore(generators): Remove spurious whitespace

* fix(generators): Make provideFunction_ etc. public

  Remove the protected declaration on provideFunction_ and
  FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator
  functions written in TypeScript.

  Not strictly part of #7283, but closely related and required to
  fixing the related issue google/blockly-samples#1785.

* chore(generators): format

(cherry picked from commit d503fbb409)

* fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297)

* fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors

  Fix the comment / message errors noted in
  https://github.com/google/blockly/pull/7249#issuecomment-1638645810

* chore: Add renamings for HSV_SATURATION, HSV_VALUE

(cherry picked from commit 1bc4f67d78)

* release: Update version number to 10.0.2

---------

Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This commit is contained in:
ericblackmonGoogle
2023-07-17 20:30:19 +00:00
committed by GitHub
parent 20423346b8
commit e06aa02e54
11 changed files with 186 additions and 33 deletions

View File

@@ -49,7 +49,7 @@ export class CodeGenerator {
* legitimately appear in a function definition (or comment), and it must
* not confuse the regular expression parser.
*/
protected FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}';
FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}';
FUNCTION_NAME_PLACEHOLDER_REGEXP_: RegExp;
/**
@@ -471,10 +471,7 @@ export class CodeGenerator {
* @returns The actual name of the new function. This may differ from
* desiredName if the former has already been taken by the user.
*/
protected provideFunction_(
desiredName: string,
code: string[] | string
): string {
provideFunction_(desiredName: string, code: string[] | string): string {
if (!this.definitions_[desiredName]) {
const functionName = this.nameDB_!.getDistinctName(
desiredName,

View File

@@ -32,8 +32,8 @@ Object.defineProperties(Blockly, {
* Must be in the range of 0 (inclusive) to 1 (exclusive).
* @name Blockly.HSV_SATURATION
* @type {number}
* @deprecated Use Blockly.colour.getHsvSaturation() / .setHsvSaturation(
* instead. (July 2023)
* @deprecated Use Blockly.utils.colour.getHsvSaturation() /
* .setHsvSaturation() instead. (July 2023)
* @suppress {checkTypes}
*/
HSV_SATURATION: {
@@ -42,7 +42,7 @@ Object.defineProperties(Blockly, {
'Blockly.HSV_SATURATION',
'version 10',
'version 11',
'Blockly.colour.getHsvSaturation()'
'Blockly.utils.colour.getHsvSaturation()'
);
return colour.getHsvSaturation();
},
@@ -51,7 +51,7 @@ Object.defineProperties(Blockly, {
'Blockly.HSV_SATURATION',
'version 10',
'version 11',
'Blockly.colour.setHsvSaturation()'
'Blockly.utils.colour.setHsvSaturation()'
);
colour.setHsvSaturation(newValue);
},
@@ -61,7 +61,7 @@ Object.defineProperties(Blockly, {
* Must be in the range of 0 (inclusive) to 1 (exclusive).
* @name Blockly.HSV_VALUE
* @type {number}
* @deprecated Use Blockly.colour.getHsvValue() / .setHsvValue instead.
* @deprecated Use Blockly.utils.colour.getHsvValue() / .setHsvValue instead.
* (July 2023)
* @suppress {checkTypes}
*/
@@ -71,7 +71,7 @@ Object.defineProperties(Blockly, {
'Blockly.HSV_VALUE',
'version 10',
'version 11',
'Blockly.colour.getHsvValue()'
'Blockly.utils.colour.getHsvValue()'
);
return colour.getHsvValue();
},
@@ -80,7 +80,7 @@ Object.defineProperties(Blockly, {
'Blockly.HSV_VALUE',
'version 10',
'version 11',
'Blockly.colour.setHsvValue()'
'Blockly.utils.colour.setHsvValue()'
);
colour.setHsvValue(newValue);
},

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "blockly",
"version": "10.0.1",
"version": "10.0.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "blockly",
"version": "10.0.1",
"version": "10.0.2",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "blockly",
"version": "10.0.1",
"version": "10.0.2",
"description": "Blockly is a library for building visual programming editors.",
"keywords": [
"blockly"

View File

@@ -1577,5 +1577,23 @@
},
],
'10.0.1': [
{
oldName: 'Blockly',
exports: {
HSV_SATURATION: {
newModule: 'Blockly.utils.colour',
getMethod: 'getHsvSaturation',
setMethod: 'setHsvSaturation',
},
HSV_VALUE: {
newModule: 'Blockly.utils.colour',
getMethod: 'getHsvValue',
setMethod: 'setHsvValue',
},
},
},
],
'develop': [],
}

21
typings/dart.d.ts vendored
View File

@@ -4,4 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/
export enum Order {
ATOMIC = 0, // 0 "" ...
UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?.
UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr
MULTIPLICATIVE = 3, // * / % ~/
ADDITIVE = 4, // + -
SHIFT = 5, // << >>
BITWISE_AND = 6, // &
BITWISE_XOR = 7, // ^
BITWISE_OR = 8, // |
RELATIONAL = 9, // >= > <= < as is is!
EQUALITY = 10, // == !=
LOGICAL_AND = 11, // &&
LOGICAL_OR = 12, // ||
IF_NULL = 13, // ??
CONDITIONAL = 14, // expr ? expr : expr
CASCADE = 15, // ..
ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |=
NONE = 99, // (...)
}
export declare const dartGenerator: any;

View File

@@ -4,4 +4,42 @@
* SPDX-License-Identifier: Apache-2.0
*/
export enum Order {
ATOMIC = 0, // 0 "" ...
NEW = 1.1, // new
MEMBER = 1.2, // . []
FUNCTION_CALL = 2, // ()
INCREMENT = 3, // ++
DECREMENT = 3, // --
BITWISE_NOT = 4.1, // ~
UNARY_PLUS = 4.2, // +
UNARY_NEGATION = 4.3, // -
LOGICAL_NOT = 4.4, // !
TYPEOF = 4.5, // typeof
VOID = 4.6, // void
DELETE = 4.7, // delete
AWAIT = 4.8, // await
EXPONENTIATION = 5.0, // **
MULTIPLICATION = 5.1, // *
DIVISION = 5.2, // /
MODULUS = 5.3, // %
SUBTRACTION = 6.1, // -
ADDITION = 6.2, // +
BITWISE_SHIFT = 7, // << >> >>>
RELATIONAL = 8, // < <= > >=
IN = 8, // in
INSTANCEOF = 8, // instanceof
EQUALITY = 9, // == != === !==
BITWISE_AND = 10, // &
BITWISE_XOR = 11, // ^
BITWISE_OR = 12, // |
LOGICAL_AND = 13, // &&
LOGICAL_OR = 14, // ||
CONDITIONAL = 15, // ?:
ASSIGNMENT = 16, // = += -= **= *= /= %= <<= >>= ...
YIELD = 17, // yield
COMMA = 18, // ,
NONE = 99, // (...)
}
export declare const javascriptGenerator: any;

15
typings/lua.d.ts vendored
View File

@@ -4,4 +4,19 @@
* SPDX-License-Identifier: Apache-2.0
*/
export enum Order {
ATOMIC = 0, // literals
// The next level was not explicit in documentation and inferred by Ellen.
HIGH = 1, // Function calls, tables[]
EXPONENTIATION = 2, // ^
UNARY = 3, // not # - ~
MULTIPLICATIVE = 4, // * / %
ADDITIVE = 5, // + -
CONCATENATION = 6, // ..
RELATIONAL = 7, // < > <= >= ~= ==
AND = 8, // and
OR = 9, // or
NONE = 99,
}
export declare const luaGenerator: any;

40
typings/php.d.ts vendored
View File

@@ -4,4 +4,44 @@
* SPDX-License-Identifier: Apache-2.0
*/
export enum Order {
ATOMIC = 0, // 0 "" ...
CLONE = 1, // clone
NEW = 1, // new
MEMBER = 2.1, // []
FUNCTION_CALL = 2.2, // ()
POWER = 3, // **
INCREMENT = 4, // ++
DECREMENT = 4, // --
BITWISE_NOT = 4, // ~
CAST = 4, // (int) (float) (string) (array) ...
SUPPRESS_ERROR = 4, // @
INSTANCEOF = 5, // instanceof
LOGICAL_NOT = 6, // !
UNARY_PLUS = 7.1, // +
UNARY_NEGATION = 7.2, // -
MULTIPLICATION = 8.1, // *
DIVISION = 8.2, // /
MODULUS = 8.3, // %
ADDITION = 9.1, // +
SUBTRACTION = 9.2, // -
STRING_CONCAT = 9.3, // .
BITWISE_SHIFT = 10, // << >>
RELATIONAL = 11, // < <= > >=
EQUALITY = 12, // == != === !== <> <=>
REFERENCE = 13, // &
BITWISE_AND = 13, // &
BITWISE_XOR = 14, // ^
BITWISE_OR = 15, // |
LOGICAL_AND = 16, // &&
LOGICAL_OR = 17, // ||
IF_NULL = 18, // ??
CONDITIONAL = 19, // ?:
ASSIGNMENT = 20, // = += -= *= /= %= <<= >>= ...
LOGICAL_AND_WEAK = 21, // and
LOGICAL_XOR = 22, // xor
LOGICAL_OR_WEAK = 23, // or
NONE = 99, // (...)
}
export declare const phpGenerator: any;

24
typings/python.d.ts vendored
View File

@@ -4,4 +4,28 @@
* SPDX-License-Identifier: Apache-2.0
*/
export enum Order {
ATOMIC = 0, // 0 "" ...
COLLECTION = 1, // tuples, lists, dictionaries
STRING_CONVERSION = 1, // `expression...`
MEMBER = 2.1, // . []
FUNCTION_CALL = 2.2, // ()
EXPONENTIATION = 3, // **
UNARY_SIGN = 4, // + -
BITWISE_NOT = 4, // ~
MULTIPLICATIVE = 5, // * / // %
ADDITIVE = 6, // + -
BITWISE_SHIFT = 7, // << >>
BITWISE_AND = 8, // &
BITWISE_XOR = 9, // ^
BITWISE_OR = 10, // |
RELATIONAL = 11, // in, not in, is, is not, >, >=, <>, !=, ==
LOGICAL_NOT = 12, // not
LOGICAL_AND = 13, // and
LOGICAL_OR = 14, // or
CONDITIONAL = 15, // if else
LAMBDA = 16, // lambda
NONE = 99, // (...)
}
export declare const pythonGenerator: any;