blockly 10.0.1 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/block.d.ts CHANGED
@@ -287,14 +287,6 @@ export declare class Block implements IASTNodeLocation, IDeletable {
287
287
  * @returns The previous statement block or null.
288
288
  */
289
289
  getPreviousBlock(): Block | null;
290
- /**
291
- * Return the connection on the first statement input on this block, or null
292
- * if there are none.
293
- *
294
- * @returns The first statement connection or null.
295
- * @internal
296
- */
297
- getFirstStatementConnection(): Connection | null;
298
290
  /**
299
291
  * Return the top-most block in this block's tree.
300
292
  * This will return itself if this block is at the top level.
@@ -188,11 +188,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
188
188
  * @internal
189
189
  */
190
190
  moveDuringDrag(newLoc: Coordinate): void;
191
- /**
192
- * Clear the block of transform="..." attributes.
193
- * Used when the block is switching from 3d to 2d transform or vice versa.
194
- */
195
- private clearTransformAttributes_;
196
191
  /** Snap this block to the nearest grid point. */
197
192
  snapToGrid(): void;
198
193
  /**
@@ -575,11 +570,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
575
570
  * @internal
576
571
  */
577
572
  positionNearConnection(sourceConnection: RenderedConnection, targetConnection: RenderedConnection): void;
578
- /**
579
- * @returns The first statement connection or null.
580
- * @internal
581
- */
582
- getFirstStatementConnection(): RenderedConnection | null;
583
573
  /**
584
574
  * Find all the blocks that are directly nested inside this one.
585
575
  * Includes value and statement inputs, as well as any following statement.
@@ -602,11 +592,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
602
592
  /**
603
593
  * Immediately lays out and reflows a block based on its contents and
604
594
  * settings.
605
- *
606
- * @param opt_bubble If false, just render this block.
607
- * If true, also render block's parent, grandparent, etc. Defaults to true.
608
595
  */
609
- render(opt_bubble?: boolean): void;
596
+ render(): void;
610
597
  /**
611
598
  * Renders this block in a way that's compatible with the more efficient
612
599
  * render management system.
package/core/field.d.ts CHANGED
@@ -188,15 +188,11 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
188
188
  init(): void;
189
189
  /**
190
190
  * Create the block UI for this field.
191
- *
192
- * @internal
193
191
  */
194
- initView(): void;
192
+ protected initView(): void;
195
193
  /**
196
194
  * Initializes the model of the field after it has been installed on a block.
197
195
  * No-op by default.
198
- *
199
- * @internal
200
196
  */
201
197
  initModel(): void;
202
198
  /**
@@ -88,8 +88,6 @@ export declare class FieldAngle extends FieldInput<number> {
88
88
  protected configure_(config: FieldAngleConfig): void;
89
89
  /**
90
90
  * Create the block UI for this field.
91
- *
92
- * @internal
93
91
  */
94
92
  initView(): void;
95
93
  /** Updates the angle when the field rerenders. */
@@ -58,8 +58,6 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
58
58
  saveState(): any;
59
59
  /**
60
60
  * Create the block UI for this checkbox.
61
- *
62
- * @internal
63
61
  */
64
62
  initView(): void;
65
63
  render_(): void;
@@ -84,8 +84,6 @@ export declare class FieldColour extends Field<string> {
84
84
  protected configure_(config: FieldColourConfig): void;
85
85
  /**
86
86
  * Create the block UI for this colour field.
87
- *
88
- * @internal
89
87
  */
90
88
  initView(): void;
91
89
  /**
@@ -89,8 +89,6 @@ export declare class FieldDropdown extends Field<string> {
89
89
  loadState(state: any): void;
90
90
  /**
91
91
  * Create the block UI for this dropdown.
92
- *
93
- * @internal
94
92
  */
95
93
  initView(): void;
96
94
  /**
@@ -15,11 +15,11 @@ export declare class FieldImage extends Field<string> {
15
15
  */
16
16
  private static readonly Y_PADDING;
17
17
  protected size_: Size;
18
- private readonly imageHeight;
18
+ protected readonly imageHeight: number;
19
19
  /** The function to be called when this field is clicked. */
20
20
  private clickHandler;
21
21
  /** The rendered field's image element. */
22
- private imageElement;
22
+ protected imageElement: SVGImageElement | null;
23
23
  /**
24
24
  * Editable fields usually show some sort of UI indicating they are
25
25
  * editable. This field should not.
@@ -60,8 +60,6 @@ export declare class FieldImage extends Field<string> {
60
60
  protected configure_(config: FieldImageConfig): void;
61
61
  /**
62
62
  * Create the block UI for this image.
63
- *
64
- * @internal
65
63
  */
66
64
  initView(): void;
67
65
  updateSize_(): void;
@@ -74,7 +74,6 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
74
74
  */
75
75
  constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldInputValidator<T> | null, config?: FieldInputConfig);
76
76
  protected configure_(config: FieldInputConfig): void;
77
- /** @internal */
78
77
  initView(): void;
79
78
  /**
80
79
  * Called by setValue if the text input is not valid. If the field is
@@ -33,8 +33,6 @@ export declare class FieldLabel extends Field<string> {
33
33
  protected configure_(config: FieldLabelConfig): void;
34
34
  /**
35
35
  * Create block UI for this label.
36
- *
37
- * @internal
38
36
  */
39
37
  initView(): void;
40
38
  /**
@@ -80,8 +80,6 @@ export declare class FieldMultilineInput extends FieldTextInput {
80
80
  loadState(state: any): void;
81
81
  /**
82
82
  * Create the block UI for this field.
83
- *
84
- * @internal
85
83
  */
86
84
  initView(): void;
87
85
  /**
@@ -62,8 +62,6 @@ export declare class FieldVariable extends FieldDropdown {
62
62
  * Initialize the model for this field if it has not already been initialized.
63
63
  * If the value has not been set to a variable by the first render, we make up
64
64
  * a variable rather than let the value be invalid.
65
- *
66
- * @internal
67
65
  */
68
66
  initModel(): void;
69
67
  shouldAddBorderRect_(): boolean;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { Flyout, FlyoutItem } from './flyout_base.js';
7
7
  import type { Options } from './options.js';
8
- import type { Coordinate } from './utils/coordinate.js';
8
+ import { Coordinate } from './utils/coordinate.js';
9
9
  import { Rect } from './utils/rect.js';
10
10
  /**
11
11
  * Class for a flyout.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { Flyout, FlyoutItem } from './flyout_base.js';
7
7
  import type { Options } from './options.js';
8
- import type { Coordinate } from './utils/coordinate.js';
8
+ import { Coordinate } from './utils/coordinate.js';
9
9
  import { Rect } from './utils/rect.js';
10
10
  /**
11
11
  * Class for a flyout.
@@ -32,7 +32,7 @@ export declare class CodeGenerator {
32
32
  * legitimately appear in a function definition (or comment), and it must
33
33
  * not confuse the regular expression parser.
34
34
  */
35
- protected FUNCTION_NAME_PLACEHOLDER_: string;
35
+ FUNCTION_NAME_PLACEHOLDER_: string;
36
36
  FUNCTION_NAME_PLACEHOLDER_REGEXP_: RegExp;
37
37
  /**
38
38
  * Arbitrary code to inject into locations that risk causing infinite loops.
@@ -191,7 +191,7 @@ export declare class CodeGenerator {
191
191
  * @returns The actual name of the new function. This may differ from
192
192
  * desiredName if the former has already been taken by the user.
193
193
  */
194
- protected provideFunction_(desiredName: string, code: string[] | string): string;
194
+ provideFunction_(desiredName: string, code: string[] | string): string;
195
195
  /**
196
196
  * Hook for code to run before code generation starts.
197
197
  * Subclasses may override this, e.g. to initialise the database of variable
@@ -20,4 +20,12 @@ export declare function queueRender(block: BlockSvg): Promise<void>;
20
20
  * been completed.
21
21
  */
22
22
  export declare function finishQueuedRenders(): Promise<void>;
23
+ /**
24
+ * Triggers an immediate render of all queued renders. Should only be used in
25
+ * cases where queueing renders breaks functionality + backwards compatibility
26
+ * (such as rendering icons).
27
+ *
28
+ * @internal
29
+ */
30
+ export declare function triggerQueuedRenders(): void;
23
31
  //# sourceMappingURL=render_management.d.ts.map
@@ -98,7 +98,6 @@ export declare class RenderedConnection extends Connection {
98
98
  * Get the offset of this connection relative to the top left of its block.
99
99
  *
100
100
  * @returns The offset of the connection.
101
- * @internal
102
101
  */
103
102
  getOffsetInBlock(): Coordinate;
104
103
  /**
@@ -202,6 +201,15 @@ export declare class RenderedConnection extends Connection {
202
201
  * Function to be called when this connection's compatible types have changed.
203
202
  */
204
203
  protected onCheckChanged_(): void;
204
+ /**
205
+ * Change a connection's compatibility.
206
+ * Rerender blocks as needed.
207
+ *
208
+ * @param check Compatible value type or list of value types. Null if all
209
+ * types are compatible.
210
+ * @returns The connection being modified (to allow chaining).
211
+ */
212
+ setCheck(check: string | string[] | null): RenderedConnection;
205
213
  }
206
214
  export declare namespace RenderedConnection {
207
215
  /**
@@ -259,6 +259,15 @@ export declare class Scrollbar {
259
259
  * @param visible True if visible.
260
260
  */
261
261
  setVisible(visible: boolean): void;
262
+ /**
263
+ * Set whether the scrollbar is visible. Bypasses checking whether this
264
+ * scrollbar is part of a pair so that it can be toggled by the scrollbar
265
+ * pair.
266
+ *
267
+ * @param visible True if visible.
268
+ * @internal
269
+ */
270
+ setVisibleInternal(visible: boolean): void;
262
271
  /**
263
272
  * Update visibility of scrollbar based on whether it thinks it should
264
273
  * be visible and whether its containing workspace is visible.
@@ -95,6 +95,12 @@ export declare class ScrollbarPair {
95
95
  * @returns True if visible.
96
96
  */
97
97
  isVisible(): boolean;
98
+ /**
99
+ * Sets the visibility of any existing scrollbars.
100
+ *
101
+ * @param visible True if visible.
102
+ */
103
+ setVisible(visible: boolean): void;
98
104
  /**
99
105
  * Recalculates the scrollbars' locations within their path and length.
100
106
  * This should be called when the contents of the workspace have changed.
@@ -47,7 +47,7 @@ export declare class CollapsibleToolboxCategory extends ToolboxCategory implemen
47
47
  */
48
48
  protected createSubCategoriesDom_(subcategories: IToolboxItem[]): HTMLDivElement;
49
49
  /**
50
- * Opens or closes the current category.
50
+ * Opens or closes the current category and the associated flyout.
51
51
  *
52
52
  * @param isExpanded True to expand the category, false to close.
53
53
  */
@@ -48,6 +48,15 @@ export declare function getDocumentScroll(): Coordinate;
48
48
  * @returns The workspace coordinates.
49
49
  */
50
50
  export declare function screenToWsCoordinates(ws: WorkspaceSvg, screenCoordinates: Coordinate): Coordinate;
51
+ /**
52
+ * Converts workspace coordinates to screen coordinates.
53
+ *
54
+ * @param ws The workspace to get the coordinates out of.
55
+ * @param workspaceCoordinates The workspace coordinates to be converted
56
+ * to screen coordinates.
57
+ * @returns The screen coordinates.
58
+ */
59
+ export declare function wsToScreenCoordinates(ws: WorkspaceSvg, workspaceCoordinates: Coordinate): Coordinate;
51
60
  export declare const TEST_ONLY: {
52
61
  XY_REGEX: RegExp;
53
62
  XY_STYLE_REGEX: RegExp;
@@ -18,8 +18,6 @@ export interface BlockInfo {
18
18
  disabled?: string | boolean;
19
19
  enabled?: boolean;
20
20
  id?: string;
21
- x?: number;
22
- y?: number;
23
21
  collapsed?: boolean;
24
22
  inline?: boolean;
25
23
  data?: string;
@@ -329,8 +329,6 @@ export declare class WorkspaceCommentSvg extends WorkspaceComment implements IBo
329
329
  * @param height height of the container
330
330
  */
331
331
  private setSize;
332
- /** Dispose of any rendered comment components. */
333
- private disposeInternal;
334
332
  /**
335
333
  * Set the focus on the text area.
336
334
  *
@@ -537,7 +537,9 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
537
537
  * @param isVisible True if workspace should be visible.
538
538
  */
539
539
  setVisible(isVisible: boolean): void;
540
- /** Render all blocks in workspace. */
540
+ /**
541
+ * Render all blocks in workspace.
542
+ */
541
543
  render(): void;
542
544
  /**
543
545
  * Highlight or unhighlight a block in the workspace. Block highlighting is
package/core/xml.d.ts CHANGED
@@ -91,6 +91,19 @@ export declare function appendDomToWorkspace(xml: Element, workspace: WorkspaceS
91
91
  * @returns The root block created.
92
92
  */
93
93
  export declare function domToBlock(xmlBlock: Element, workspace: Workspace): Block;
94
+ /**
95
+ * Decode an XML block tag and create a block (and possibly sub blocks) on the
96
+ * workspace.
97
+ *
98
+ * This is defined internally so that it doesn't trigger an immediate render,
99
+ * which we do want to happen for external calls.
100
+ *
101
+ * @param xmlBlock XML block element.
102
+ * @param workspace The workspace.
103
+ * @returns The root block created.
104
+ * @internal
105
+ */
106
+ export declare function domToBlockInternal(xmlBlock: Element, workspace: Workspace): Block;
94
107
  /**
95
108
  * Decode an XML list of variables and add the variables to the workspace.
96
109
  *
package/dart.d.ts CHANGED
@@ -4,4 +4,25 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ export enum Order {
8
+ ATOMIC = 0, // 0 "" ...
9
+ UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?.
10
+ UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr
11
+ MULTIPLICATIVE = 3, // * / % ~/
12
+ ADDITIVE = 4, // + -
13
+ SHIFT = 5, // << >>
14
+ BITWISE_AND = 6, // &
15
+ BITWISE_XOR = 7, // ^
16
+ BITWISE_OR = 8, // |
17
+ RELATIONAL = 9, // >= > <= < as is is!
18
+ EQUALITY = 10, // == !=
19
+ LOGICAL_AND = 11, // &&
20
+ LOGICAL_OR = 12, // ||
21
+ IF_NULL = 13, // ??
22
+ CONDITIONAL = 14, // expr ? expr : expr
23
+ CASCADE = 15, // ..
24
+ ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |=
25
+ NONE = 99, // (...)
26
+ }
27
+
7
28
  export declare const dartGenerator: any;
package/javascript.d.ts CHANGED
@@ -4,4 +4,42 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ export enum Order {
8
+ ATOMIC = 0, // 0 "" ...
9
+ NEW = 1.1, // new
10
+ MEMBER = 1.2, // . []
11
+ FUNCTION_CALL = 2, // ()
12
+ INCREMENT = 3, // ++
13
+ DECREMENT = 3, // --
14
+ BITWISE_NOT = 4.1, // ~
15
+ UNARY_PLUS = 4.2, // +
16
+ UNARY_NEGATION = 4.3, // -
17
+ LOGICAL_NOT = 4.4, // !
18
+ TYPEOF = 4.5, // typeof
19
+ VOID = 4.6, // void
20
+ DELETE = 4.7, // delete
21
+ AWAIT = 4.8, // await
22
+ EXPONENTIATION = 5.0, // **
23
+ MULTIPLICATION = 5.1, // *
24
+ DIVISION = 5.2, // /
25
+ MODULUS = 5.3, // %
26
+ SUBTRACTION = 6.1, // -
27
+ ADDITION = 6.2, // +
28
+ BITWISE_SHIFT = 7, // << >> >>>
29
+ RELATIONAL = 8, // < <= > >=
30
+ IN = 8, // in
31
+ INSTANCEOF = 8, // instanceof
32
+ EQUALITY = 9, // == != === !==
33
+ BITWISE_AND = 10, // &
34
+ BITWISE_XOR = 11, // ^
35
+ BITWISE_OR = 12, // |
36
+ LOGICAL_AND = 13, // &&
37
+ LOGICAL_OR = 14, // ||
38
+ CONDITIONAL = 15, // ?:
39
+ ASSIGNMENT = 16, // = += -= **= *= /= %= <<= >>= ...
40
+ YIELD = 17, // yield
41
+ COMMA = 18, // ,
42
+ NONE = 99, // (...)
43
+ }
44
+
7
45
  export declare const javascriptGenerator: any;
package/lua.d.ts CHANGED
@@ -4,4 +4,19 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ export enum Order {
8
+ ATOMIC = 0, // literals
9
+ // The next level was not explicit in documentation and inferred by Ellen.
10
+ HIGH = 1, // Function calls, tables[]
11
+ EXPONENTIATION = 2, // ^
12
+ UNARY = 3, // not # - ~
13
+ MULTIPLICATIVE = 4, // * / %
14
+ ADDITIVE = 5, // + -
15
+ CONCATENATION = 6, // ..
16
+ RELATIONAL = 7, // < > <= >= ~= ==
17
+ AND = 8, // and
18
+ OR = 9, // or
19
+ NONE = 99,
20
+ }
21
+
7
22
  export declare const luaGenerator: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly",
3
- "version": "10.0.1",
3
+ "version": "10.1.0",
4
4
  "description": "Blockly is a library for building visual programming editors.",
5
5
  "keywords": [
6
6
  "blockly"
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "license": "Apache-2.0",
29
29
  "devDependencies": {
30
- "@blockly/block-test": "^3.0.0",
31
- "@blockly/dev-tools": "^5.0.0",
32
- "@blockly/theme-modern": "^3.0.0",
30
+ "@blockly/block-test": "^5.0.0",
31
+ "@blockly/dev-tools": "^7.0.2",
32
+ "@blockly/theme-modern": "^5.0.0",
33
33
  "@hyperjump/json-schema": "^1.5.0",
34
34
  "@microsoft/api-documenter": "^7.22.4",
35
35
  "@microsoft/api-extractor": "^7.29.5",
36
- "@typescript-eslint/eslint-plugin": "^5.33.1",
36
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
37
37
  "@wdio/selenium-standalone-service": "^8.0.2",
38
38
  "async-done": "^2.0.0",
39
39
  "chai": "^4.2.0",
@@ -61,7 +61,7 @@
61
61
  "markdown-tables-to-json": "^0.1.7",
62
62
  "mocha": "^10.0.0",
63
63
  "patch-package": "^7.0.0",
64
- "prettier": "2.8.8",
64
+ "prettier": "3.0.0",
65
65
  "readline-sync": "^1.4.10",
66
66
  "rimraf": "^5.0.0",
67
67
  "selenium-standalone": "^8.0.3",
package/php.d.ts CHANGED
@@ -4,4 +4,44 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ export enum Order {
8
+ ATOMIC = 0, // 0 "" ...
9
+ CLONE = 1, // clone
10
+ NEW = 1, // new
11
+ MEMBER = 2.1, // []
12
+ FUNCTION_CALL = 2.2, // ()
13
+ POWER = 3, // **
14
+ INCREMENT = 4, // ++
15
+ DECREMENT = 4, // --
16
+ BITWISE_NOT = 4, // ~
17
+ CAST = 4, // (int) (float) (string) (array) ...
18
+ SUPPRESS_ERROR = 4, // @
19
+ INSTANCEOF = 5, // instanceof
20
+ LOGICAL_NOT = 6, // !
21
+ UNARY_PLUS = 7.1, // +
22
+ UNARY_NEGATION = 7.2, // -
23
+ MULTIPLICATION = 8.1, // *
24
+ DIVISION = 8.2, // /
25
+ MODULUS = 8.3, // %
26
+ ADDITION = 9.1, // +
27
+ SUBTRACTION = 9.2, // -
28
+ STRING_CONCAT = 9.3, // .
29
+ BITWISE_SHIFT = 10, // << >>
30
+ RELATIONAL = 11, // < <= > >=
31
+ EQUALITY = 12, // == != === !== <> <=>
32
+ REFERENCE = 13, // &
33
+ BITWISE_AND = 13, // &
34
+ BITWISE_XOR = 14, // ^
35
+ BITWISE_OR = 15, // |
36
+ LOGICAL_AND = 16, // &&
37
+ LOGICAL_OR = 17, // ||
38
+ IF_NULL = 18, // ??
39
+ CONDITIONAL = 19, // ?:
40
+ ASSIGNMENT = 20, // = += -= *= /= %= <<= >>= ...
41
+ LOGICAL_AND_WEAK = 21, // and
42
+ LOGICAL_XOR = 22, // xor
43
+ LOGICAL_OR_WEAK = 23, // or
44
+ NONE = 99, // (...)
45
+ }
46
+
7
47
  export declare const phpGenerator: any;
package/python.d.ts CHANGED
@@ -4,4 +4,28 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ export enum Order {
8
+ ATOMIC = 0, // 0 "" ...
9
+ COLLECTION = 1, // tuples, lists, dictionaries
10
+ STRING_CONVERSION = 1, // `expression...`
11
+ MEMBER = 2.1, // . []
12
+ FUNCTION_CALL = 2.2, // ()
13
+ EXPONENTIATION = 3, // **
14
+ UNARY_SIGN = 4, // + -
15
+ BITWISE_NOT = 4, // ~
16
+ MULTIPLICATIVE = 5, // * / // %
17
+ ADDITIVE = 6, // + -
18
+ BITWISE_SHIFT = 7, // << >>
19
+ BITWISE_AND = 8, // &
20
+ BITWISE_XOR = 9, // ^
21
+ BITWISE_OR = 10, // |
22
+ RELATIONAL = 11, // in, not in, is, is not, >, >=, <>, !=, ==
23
+ LOGICAL_NOT = 12, // not
24
+ LOGICAL_AND = 13, // and
25
+ LOGICAL_OR = 14, // or
26
+ CONDITIONAL = 15, // if else
27
+ LAMBDA = 16, // lambda
28
+ NONE = 99, // (...)
29
+ }
30
+
7
31
  export declare const pythonGenerator: any;