blockly 9.2.0 → 9.3.0-beta.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.
Files changed (76) hide show
  1. package/blockly.min.js +320 -366
  2. package/blockly_compressed.js +320 -366
  3. package/blockly_compressed.js.map +1 -1
  4. package/core/block_dragger.d.ts +1 -1
  5. package/core/block_svg.d.ts +4 -17
  6. package/core/blockly.d.ts +2 -4
  7. package/core/bubble.d.ts +2 -6
  8. package/core/bubble_dragger.d.ts +1 -2
  9. package/core/events/events.d.ts +2 -22
  10. package/core/events/events_abstract.d.ts +7 -0
  11. package/core/events/events_block_base.d.ts +2 -1
  12. package/core/events/events_block_change.d.ts +9 -1
  13. package/core/events/events_block_create.d.ts +6 -2
  14. package/core/events/events_block_delete.d.ts +7 -2
  15. package/core/events/events_block_drag.d.ts +7 -1
  16. package/core/events/events_block_move.d.ts +20 -1
  17. package/core/events/events_bubble_open.d.ts +3 -0
  18. package/core/events/events_click.d.ts +6 -1
  19. package/core/events/events_comment_base.d.ts +1 -0
  20. package/core/events/events_comment_change.d.ts +3 -1
  21. package/core/events/events_comment_create.d.ts +2 -1
  22. package/core/events/events_comment_delete.d.ts +2 -1
  23. package/core/events/events_comment_move.d.ts +4 -2
  24. package/core/events/events_marker_move.d.ts +10 -1
  25. package/core/events/events_selected.d.ts +6 -0
  26. package/core/events/events_theme_change.d.ts +2 -1
  27. package/core/events/events_toolbox_item_select.d.ts +3 -1
  28. package/core/events/events_trashcan_open.d.ts +5 -1
  29. package/core/events/events_var_base.d.ts +1 -0
  30. package/core/events/events_var_create.d.ts +3 -1
  31. package/core/events/events_var_delete.d.ts +4 -2
  32. package/core/events/events_var_rename.d.ts +4 -2
  33. package/core/events/events_viewport.d.ts +14 -1
  34. package/core/events/utils.d.ts +0 -16
  35. package/core/events/workspace_events.d.ts +2 -4
  36. package/core/field.d.ts +42 -9
  37. package/core/field_angle.d.ts +1 -1
  38. package/core/field_checkbox.d.ts +15 -8
  39. package/core/field_colour.d.ts +1 -4
  40. package/core/field_dropdown.d.ts +2 -2
  41. package/core/field_image.d.ts +1 -2
  42. package/core/field_input.d.ts +6 -15
  43. package/core/field_multilineinput.d.ts +2 -2
  44. package/core/field_textinput.d.ts +12 -0
  45. package/core/field_variable.d.ts +2 -2
  46. package/core/gesture.d.ts +1 -1
  47. package/core/interfaces/i_block_dragger.d.ts +1 -1
  48. package/core/interfaces/i_bubble.d.ts +2 -6
  49. package/core/interfaces/i_metrics_manager.d.ts +8 -6
  50. package/core/interfaces/i_procedure_block.d.ts +3 -0
  51. package/core/metrics_manager.d.ts +8 -6
  52. package/core/{procedures/observable_procedure_map.d.ts → observable_procedure_map.d.ts} +4 -5
  53. package/core/procedures.d.ts +6 -4
  54. package/core/serialization/procedures.d.ts +0 -7
  55. package/core/utils/sentinel.d.ts +5 -0
  56. package/core/utils/xml.d.ts +44 -2
  57. package/core/workspace_comment_svg.d.ts +2 -15
  58. package/core/workspace_dragger.d.ts +0 -3
  59. package/core/workspace_svg.d.ts +1 -44
  60. package/core.js +1 -5
  61. package/package.json +6 -6
  62. package/core/block_drag_surface.d.ts +0 -135
  63. package/core/events/events_procedure_base.d.ts +0 -26
  64. package/core/events/events_procedure_change_return.d.ts +0 -40
  65. package/core/events/events_procedure_create.d.ts +0 -34
  66. package/core/events/events_procedure_delete.d.ts +0 -32
  67. package/core/events/events_procedure_enable.d.ts +0 -34
  68. package/core/events/events_procedure_parameter_base.d.ts +0 -26
  69. package/core/events/events_procedure_parameter_create.d.ts +0 -42
  70. package/core/events/events_procedure_parameter_delete.d.ts +0 -41
  71. package/core/events/events_procedure_parameter_rename.d.ts +0 -36
  72. package/core/events/events_procedure_rename.d.ts +0 -35
  73. package/core/procedures/observable_parameter_model.d.ts +0 -62
  74. package/core/procedures/observable_procedure_model.d.ts +0 -75
  75. package/core/procedures/update_procedures.d.ts +0 -13
  76. package/core/workspace_drag_surface_svg.d.ts +0 -74
@@ -1,41 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
- import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
- import type { Workspace } from '../workspace.js';
9
- import { ProcedureParameterBase, ProcedureParameterBaseJson } from './events_procedure_parameter_base.js';
10
- /**
11
- * Represents a parameter being removed from a procedure.
12
- */
13
- export declare class ProcedureParameterDelete extends ProcedureParameterBase {
14
- readonly index: number;
15
- /** A string used to check the type of the event. */
16
- type: string;
17
- /**
18
- * @param parameter The parameter model that was just removed from the
19
- * procedure.
20
- * @param index The index the parameter was at before it was removed.
21
- */
22
- constructor(workspace: Workspace, procedure: IProcedureModel, parameter: IParameterModel, index: number);
23
- run(forward: boolean): void;
24
- parameterMatches(param: IParameterModel): boolean;
25
- /**
26
- * Encode the event as JSON.
27
- *
28
- * @returns JSON representation.
29
- */
30
- toJson(): ProcedureParameterDeleteJson;
31
- /**
32
- * Deserializes the JSON event.
33
- *
34
- * @internal
35
- */
36
- static fromJson(json: ProcedureParameterDeleteJson, workspace: Workspace): ProcedureParameterDelete;
37
- }
38
- export interface ProcedureParameterDeleteJson extends ProcedureParameterBaseJson {
39
- index: number;
40
- }
41
- //# sourceMappingURL=events_procedure_parameter_delete.d.ts.map
@@ -1,36 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
- import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
- import type { Workspace } from '../workspace.js';
9
- import { ProcedureParameterBase, ProcedureParameterBaseJson } from './events_procedure_parameter_base.js';
10
- /**
11
- * Represents a parameter of a procedure being renamed.
12
- */
13
- export declare class ProcedureParameterRename extends ProcedureParameterBase {
14
- readonly oldName: string;
15
- /** A string used to check the type of the event. */
16
- type: string;
17
- private readonly newName;
18
- constructor(workspace: Workspace, procedure: IProcedureModel, parameter: IParameterModel, oldName: string);
19
- run(forward: boolean): void;
20
- /**
21
- * Encode the event as JSON.
22
- *
23
- * @returns JSON representation.
24
- */
25
- toJson(): ProcedureParameterRenameJson;
26
- /**
27
- * Deserializes the JSON event.
28
- *
29
- * @internal
30
- */
31
- static fromJson(json: ProcedureParameterRenameJson, workspace: Workspace): ProcedureParameterRename;
32
- }
33
- export interface ProcedureParameterRenameJson extends ProcedureParameterBaseJson {
34
- oldName: string;
35
- }
36
- //# sourceMappingURL=events_procedure_parameter_rename.d.ts.map
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
7
- import type { Workspace } from '../workspace.js';
8
- import { ProcedureBase, ProcedureBaseJson } from './events_procedure_base.js';
9
- /**
10
- * Represents a procedure being renamed.
11
- */
12
- export declare class ProcedureRename extends ProcedureBase {
13
- readonly oldName: string;
14
- /** A string used to check the type of the event. */
15
- type: string;
16
- private newName;
17
- constructor(workspace: Workspace, model: IProcedureModel, oldName: string);
18
- run(forward: boolean): void;
19
- /**
20
- * Encode the event as JSON.
21
- *
22
- * @returns JSON representation.
23
- */
24
- toJson(): ProcedureRenameJson;
25
- /**
26
- * Deserializes the JSON event.
27
- *
28
- * @internal
29
- */
30
- static fromJson(json: ProcedureRenameJson, workspace: Workspace): ProcedureRename;
31
- }
32
- export interface ProcedureRenameJson extends ProcedureBaseJson {
33
- oldName: string;
34
- }
35
- //# sourceMappingURL=events_procedure_rename.d.ts.map
@@ -1,62 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
- import type { IProcedureModel } from '../interfaces/i_procedure_model';
8
- import type { VariableModel } from '../variable_model.js';
9
- import type { Workspace } from '../workspace.js';
10
- export declare class ObservableParameterModel implements IParameterModel {
11
- private readonly workspace;
12
- private id;
13
- private variable;
14
- private shouldFireEvents;
15
- private procedureModel;
16
- constructor(workspace: Workspace, name: string, id?: string);
17
- /**
18
- * Sets the name of this parameter to the given name.
19
- */
20
- setName(name: string): this;
21
- /**
22
- * Unimplemented. The built-in ParameterModel does not support typing.
23
- * If you want your procedure blocks to have typed parameters, you need to
24
- * implement your own ParameterModel.
25
- *
26
- * @throws Throws for the ObservableParameterModel specifically because this
27
- * method is unimplemented.
28
- */
29
- setTypes(_types: string[]): this;
30
- /**
31
- * Returns the name of this parameter.
32
- */
33
- getName(): string;
34
- /**
35
- * Returns the types of this parameter.
36
- */
37
- getTypes(): string[];
38
- /**
39
- * Returns the unique language-neutral ID for the parameter.
40
- *
41
- * This represents the identify of the variable model which does not change
42
- * over time.
43
- */
44
- getId(): string;
45
- /** Returns the variable model associated with the parameter model. */
46
- getVariableModel(): VariableModel;
47
- /**
48
- * Tells the parameter model it should fire events.
49
- *
50
- * @internal
51
- */
52
- startPublishing(): void;
53
- /**
54
- * Tells the parameter model it should not fire events.
55
- *
56
- * @internal
57
- */
58
- stopPublishing(): void;
59
- /** Sets the procedure model this parameter is a part of. */
60
- setProcedureModel(model: IProcedureModel): this;
61
- }
62
- //# sourceMappingURL=observable_parameter_model.d.ts.map
@@ -1,75 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
- import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
- import type { Workspace } from '../workspace.js';
9
- export declare class ObservableProcedureModel implements IProcedureModel {
10
- private readonly workspace;
11
- private id;
12
- private name;
13
- private parameters;
14
- private returnTypes;
15
- private enabled;
16
- private shouldFireEvents;
17
- constructor(workspace: Workspace, name: string, id?: string);
18
- /** Sets the human-readable name of the procedure. */
19
- setName(name: string): this;
20
- /**
21
- * Inserts a parameter into the list of parameters.
22
- *
23
- * To move a parameter, first delete it, and then re-insert.
24
- */
25
- insertParameter(parameterModel: IParameterModel, index: number): this;
26
- /** Removes the parameter at the given index from the parameter list. */
27
- deleteParameter(index: number): this;
28
- /**
29
- * Sets whether the procedure has a return value (empty array) or no return
30
- * value (null).
31
- *
32
- * The built-in procedure model does not support procedures that have actual
33
- * return types (i.e. non-empty arrays, e.g. ['number']). If you want your
34
- * procedure block to have return types, you need to implement your own
35
- * procedure model.
36
- */
37
- setReturnTypes(types: string[] | null): this;
38
- /**
39
- * Sets whether this procedure is enabled/disabled. If a procedure is disabled
40
- * all procedure caller blocks should be disabled as well.
41
- */
42
- setEnabled(enabled: boolean): this;
43
- /** Returns the unique language-neutral ID for the procedure. */
44
- getId(): string;
45
- /** Returns the human-readable name of the procedure. */
46
- getName(): string;
47
- /** Returns the parameter at the given index in the parameter list. */
48
- getParameter(index: number): IParameterModel;
49
- /** Returns an array of all of the parameters in the parameter list. */
50
- getParameters(): IParameterModel[];
51
- /**
52
- * Returns the return type of the procedure.
53
- *
54
- * Null represents a procedure that does not return a value.
55
- */
56
- getReturnTypes(): string[] | null;
57
- /**
58
- * Returns whether the procedure is enabled/disabled. If a procedure is
59
- * disabled, all procedure caller blocks should be disabled as well.
60
- */
61
- getEnabled(): boolean;
62
- /**
63
- * Tells the procedure model it should fire events.
64
- *
65
- * @internal
66
- */
67
- startPublishing(): void;
68
- /**
69
- * Tells the procedure model it should not fire events.
70
- *
71
- * @internal
72
- */
73
- stopPublishing(): void;
74
- }
75
- //# sourceMappingURL=observable_procedure_model.d.ts.map
@@ -1,13 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2022 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { Workspace } from '../workspace.js';
7
- /**
8
- * Calls the `doProcedureUpdate` method on all blocks which implement it.
9
- *
10
- * @internal
11
- */
12
- export declare function triggerProceduresUpdate(workspace: Workspace): void;
13
- //# sourceMappingURL=update_procedures.d.ts.map
@@ -1,74 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Coordinate } from './utils/coordinate.js';
7
- /**
8
- * Blocks are moved into this SVG during a drag, improving performance.
9
- * The entire SVG is translated using CSS transforms instead of SVG so the
10
- * blocks are never repainted during drag improving performance.
11
- *
12
- * @alias Blockly.WorkspaceDragSurfaceSvg
13
- */
14
- export declare class WorkspaceDragSurfaceSvg {
15
- private readonly container;
16
- /**
17
- * The SVG drag surface. Set once by WorkspaceDragSurfaceSvg.createDom.
18
- */
19
- private SVG;
20
- /**
21
- * The element to insert the block canvas and bubble canvas after when it
22
- * goes back in the DOM at the end of a drag.
23
- */
24
- private previousSibling;
25
- /** @param container Containing element. */
26
- constructor(container: Element);
27
- /** Create the drag surface and inject it into the container. */
28
- createDom(): void;
29
- /**
30
- * Translate the entire drag surface during a drag.
31
- * We translate the drag surface instead of the blocks inside the surface
32
- * so that the browser avoids repainting the SVG.
33
- * Because of this, the drag coordinates must be adjusted by scale.
34
- *
35
- * @param x X translation for the entire surface
36
- * @param y Y translation for the entire surface
37
- * @internal
38
- */
39
- translateSurface(x: number, y: number): void;
40
- /**
41
- * Reports the surface translation in scaled workspace coordinates.
42
- * Use this when finishing a drag to return blocks to the correct position.
43
- *
44
- * @returns Current translation of the surface
45
- * @internal
46
- */
47
- getSurfaceTranslation(): Coordinate;
48
- /**
49
- * Move the blockCanvas and bubbleCanvas out of the surface SVG and on to
50
- * newSurface.
51
- *
52
- * @param newSurface The element to put the drag surface contents into.
53
- * @internal
54
- */
55
- clearAndHide(newSurface: SVGElement): void;
56
- /**
57
- * Set the SVG to have the block canvas and bubble canvas in it and then
58
- * show the surface.
59
- *
60
- * @param blockCanvas The block canvas <g> element from the
61
- * workspace.
62
- * @param bubbleCanvas The <g> element that contains the
63
- bubbles.
64
- * @param previousSibling The element to insert the block canvas and
65
- bubble canvas after when it goes back in the DOM at the end of a
66
- drag.
67
- * @param width The width of the workspace SVG element.
68
- * @param height The height of the workspace SVG element.
69
- * @param scale The scale of the workspace being dragged.
70
- * @internal
71
- */
72
- setContentsAndShow(blockCanvas: SVGElement, bubbleCanvas: SVGElement, previousSibling: Element, width: number, height: number, scale: number): void;
73
- }
74
- //# sourceMappingURL=workspace_drag_surface_svg.d.ts.map