blockly 11.0.0-beta.5 → 11.0.0-beta.6

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 (105) hide show
  1. package/blockly.min.js +570 -623
  2. package/blockly_compressed.js +529 -545
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +27 -29
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +10 -3
  7. package/core/block_dragger.d.ts +10 -10
  8. package/core/block_svg.d.ts +5 -32
  9. package/core/blockly.d.ts +3 -38
  10. package/core/clipboard.d.ts +0 -19
  11. package/core/comments/comment_view.d.ts +201 -0
  12. package/core/comments/rendered_workspace_comment.d.ts +42 -0
  13. package/core/comments/workspace_comment.d.ts +101 -0
  14. package/core/comments.d.ts +9 -0
  15. package/core/events/events_click.d.ts +1 -1
  16. package/core/field_dropdown.d.ts +1 -0
  17. package/core/field_image.d.ts +1 -1
  18. package/core/generator.d.ts +1 -1
  19. package/core/gesture.d.ts +2 -0
  20. package/core/grid.d.ts +9 -9
  21. package/core/icons/comment_icon.d.ts +3 -3
  22. package/core/icons/icon.d.ts +0 -6
  23. package/core/icons/icon_types.d.ts +2 -2
  24. package/core/icons/mutator_icon.d.ts +1 -16
  25. package/core/icons/warning_icon.d.ts +1 -1
  26. package/core/inputs/input.d.ts +10 -19
  27. package/core/{connection_previewers/insertion_marker_previewer.d.ts → insertion_marker_previewer.d.ts} +3 -3
  28. package/core/interfaces/i_comment_icon.d.ts +17 -0
  29. package/core/interfaces/i_has_bubble.d.ts +1 -1
  30. package/core/interfaces/i_parameter_model.d.ts +7 -0
  31. package/core/interfaces/i_procedure_model.d.ts +7 -0
  32. package/core/options.d.ts +1 -0
  33. package/core/renderers/common/drawer.d.ts +0 -7
  34. package/core/renderers/measurables/icon.d.ts +0 -5
  35. package/core/serialization/priorities.d.ts +2 -0
  36. package/core/serialization/procedures.d.ts +28 -26
  37. package/core/serialization/workspace_comments.d.ts +45 -0
  38. package/core/serialization.d.ts +2 -1
  39. package/core/utils/dom.d.ts +0 -9
  40. package/core/utils/keycodes.d.ts +32 -32
  41. package/core/utils/size.d.ts +10 -0
  42. package/core/utils/string.d.ts +0 -10
  43. package/core/workspace_svg.d.ts +0 -27
  44. package/core/xml.d.ts +4 -3
  45. package/core-node.js +31 -0
  46. package/dart.d.ts +1 -24
  47. package/dart_compressed.js +18 -68
  48. package/dart_compressed.js.map +1 -1
  49. package/generators/dart/dart_generator.d.ts +17 -17
  50. package/generators/dart/text.d.ts +0 -1
  51. package/generators/javascript/javascript_generator.d.ts +34 -35
  52. package/generators/javascript/text.d.ts +0 -1
  53. package/generators/lua/lua_generator.d.ts +10 -10
  54. package/generators/lua/text.d.ts +0 -1
  55. package/generators/php/php_generator.d.ts +36 -36
  56. package/generators/php/text.d.ts +0 -1
  57. package/generators/python/python_generator.d.ts +20 -21
  58. package/generators/python/text.d.ts +0 -1
  59. package/index.js +19 -7
  60. package/javascript.d.ts +1 -41
  61. package/javascript_compressed.js +14 -49
  62. package/javascript_compressed.js.map +1 -1
  63. package/lua.d.ts +1 -18
  64. package/lua_compressed.js +18 -40
  65. package/lua_compressed.js.map +1 -1
  66. package/media/arrow-dropdown.svg +1 -0
  67. package/media/resize-handle.svg +3 -0
  68. package/msg/ce.d.ts +8 -0
  69. package/msg/dtp.d.ts +8 -0
  70. package/msg/hsb.d.ts +8 -0
  71. package/msg/tdd.d.ts +8 -0
  72. package/package.json +45 -11
  73. package/php.d.ts +1 -43
  74. package/php_compressed.js +10 -43
  75. package/php_compressed.js.map +1 -1
  76. package/python.d.ts +1 -27
  77. package/python_compressed.js +18 -37
  78. package/python_compressed.js.map +1 -1
  79. package/blockly.js +0 -22
  80. package/blocks.js +0 -22
  81. package/browser.js +0 -30
  82. package/core/field_angle.d.ts +0 -208
  83. package/core/field_colour.d.ts +0 -243
  84. package/core/field_multilineinput.d.ts +0 -182
  85. package/core/renderers/minimalist/constants.d.ts +0 -21
  86. package/core/renderers/minimalist/drawer.d.ts +0 -26
  87. package/core/renderers/minimalist/info.d.ts +0 -35
  88. package/core/renderers/minimalist/minimalist.d.ts +0 -12
  89. package/core/renderers/minimalist/renderer.d.ts +0 -48
  90. package/core-browser.js +0 -26
  91. package/core.js +0 -26
  92. package/dart.js +0 -22
  93. package/generators/dart/colour.d.ts +0 -16
  94. package/generators/javascript/colour.d.ts +0 -16
  95. package/generators/lua/colour.d.ts +0 -16
  96. package/generators/php/colour.d.ts +0 -16
  97. package/generators/python/colour.d.ts +0 -16
  98. package/javascript.js +0 -23
  99. package/lua.js +0 -22
  100. package/msg/constants.d.ts +0 -14
  101. package/msg/qqq.d.ts +0 -14
  102. package/msg/synonyms.d.ts +0 -14
  103. package/node.js +0 -21
  104. package/php.js +0 -22
  105. package/python.js +0 -23
package/blockly.js DELETED
@@ -1,22 +0,0 @@
1
- /* eslint-disable */
2
- ;(function(root, factory) {
3
- if (typeof define === 'function' && define.amd) { // AMD
4
- define(['./blockly_compressed'], factory);
5
- } else if (typeof exports === 'object') { // Node.js
6
- module.exports = factory(require('./blockly_compressed'));
7
- } else { // Browser
8
- root.Blockly = factory(root.Blockly);
9
- }
10
- }(this, function(Blockly) {
11
- /**
12
- * @license
13
- * Copyright 2020 Google LLC
14
- * SPDX-License-Identifier: Apache-2.0
15
- */
16
-
17
- /**
18
- * @fileoverview Blockly module; just a wrapper for blockly_compressed.js.
19
- */
20
-
21
- return Blockly;
22
- }));
package/blocks.js DELETED
@@ -1,22 +0,0 @@
1
- /* eslint-disable */
2
- ;(function(root, factory) {
3
- if (typeof define === 'function' && define.amd) { // AMD
4
- define(['./blocks_compressed'], factory);
5
- } else if (typeof exports === 'object') { // Node.js
6
- module.exports = factory(require('./blocks_compressed'));
7
- } else { // Browser
8
- root.BlocklyBlocks = factory(root.BlocklyBlocks);
9
- }
10
- }(this, function(BlocklyBlocks) {
11
- /**
12
- * @license
13
- * Copyright 2020 Google LLC
14
- * SPDX-License-Identifier: Apache-2.0
15
- */
16
-
17
- /**
18
- * @fileoverview Blockly blocks module; just a wrapper for blocks_compressed.js.
19
- */
20
-
21
- return BlocklyBlocks;
22
- }));
package/browser.js DELETED
@@ -1,30 +0,0 @@
1
- /* eslint-disable */
2
- ;(function(root, factory) {
3
- if (typeof define === 'function' && define.amd) { // AMD
4
- define(['./core-browser', './msg/en', './blocks', './javascript'], factory);
5
- } else if (typeof exports === 'object') { // Node.js
6
- module.exports = factory(require('./core-browser'), require('./msg/en'), require('./blocks'), require('./javascript'));
7
- } else { // Browser
8
- root.Blockly = factory(root.Blockly, root.En, root.BlocklyBlocks, root.BlocklyJS);
9
- }
10
- }(this, function(Blockly, En, BlocklyBlocks, BlocklyJS) {
11
- /**
12
- * @license
13
- * Copyright 2019 Google LLC
14
- * SPDX-License-Identifier: Apache-2.0
15
- */
16
-
17
- /**
18
- * @fileoverview Blockly module for the browser. This includes Blockly core
19
- * and built in blocks, the JavaScript code generator and the English block
20
- * localization files.
21
- */
22
-
23
- /* eslint-disable */
24
- 'use strict';
25
-
26
- // Include the EN Locale by default.
27
- Blockly.setLocale(En);
28
-
29
- return Blockly;
30
- }));
@@ -1,208 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2013 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { Field } from './field.js';
7
- import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
8
- /**
9
- * Class for an editable angle field.
10
- */
11
- export declare class FieldAngle extends FieldInput<number> {
12
- /** Half the width of protractor image. */
13
- static readonly HALF: number;
14
- /**
15
- * Radius of protractor circle. Slightly smaller than protractor size since
16
- * otherwise SVG crops off half the border at the edges.
17
- */
18
- static readonly RADIUS: number;
19
- /**
20
- * Default property describing which direction makes an angle field's value
21
- * increase. Angle increases clockwise (true) or counterclockwise (false).
22
- */
23
- static readonly CLOCKWISE = false;
24
- /**
25
- * The default offset of 0 degrees (and all angles). Always offsets in the
26
- * counterclockwise direction, regardless of the field's clockwise property.
27
- * Usually either 0 (0 = right) or 90 (0 = up).
28
- */
29
- static readonly OFFSET = 0;
30
- /**
31
- * The default maximum angle to allow before wrapping.
32
- * Usually either 360 (for 0 to 359.9) or 180 (for -179.9 to 180).
33
- */
34
- static readonly WRAP = 360;
35
- /**
36
- * The default amount to round angles to when using a mouse or keyboard nav
37
- * input. Must be a positive integer to support keyboard navigation.
38
- */
39
- static readonly ROUND = 15;
40
- /**
41
- * Whether the angle should increase as the angle picker is moved clockwise
42
- * (true) or counterclockwise (false).
43
- */
44
- private clockwise;
45
- /**
46
- * The offset of zero degrees (and all other angles).
47
- */
48
- private offset;
49
- /**
50
- * The maximum angle to allow before wrapping.
51
- */
52
- private wrap;
53
- /**
54
- * The amount to round angles to when using a mouse or keyboard nav input.
55
- */
56
- private round;
57
- /**
58
- * Array holding info needed to unbind events.
59
- * Used for disposing.
60
- * Ex: [[node, name, func], [node, name, func]].
61
- */
62
- private boundEvents;
63
- /** Dynamic red line pointing at the value's angle. */
64
- private line;
65
- /** Dynamic pink area extending from 0 to the value's angle. */
66
- private gauge;
67
- /** The degree symbol for this field. */
68
- protected symbol_: SVGTSpanElement | null;
69
- /**
70
- * @param value The initial value of the field. Should cast to a number.
71
- * Defaults to 0. Also accepts Field.SKIP_SETUP if you wish to skip setup
72
- * (only used by subclasses that want to handle configuration and setting
73
- * the field value after their own constructors have run).
74
- * @param validator A function that is called to validate changes to the
75
- * field's value. Takes in a number & returns a validated number, or null
76
- * to abort the change.
77
- * @param config A map of options used to configure the field.
78
- * See the [field creation documentation]{@link
79
- * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/angle#creation}
80
- * for a list of properties this parameter supports.
81
- */
82
- constructor(value?: string | number | typeof Field.SKIP_SETUP, validator?: FieldAngleValidator, config?: FieldAngleConfig);
83
- /**
84
- * Configure the field based on the given map of options.
85
- *
86
- * @param config A map of options to configure the field based on.
87
- */
88
- protected configure_(config: FieldAngleConfig): void;
89
- /**
90
- * Create the block UI for this field.
91
- */
92
- initView(): void;
93
- /** Updates the angle when the field rerenders. */
94
- protected render_(): void;
95
- /**
96
- * Create and show the angle field's editor.
97
- *
98
- * @param e Optional mouse event that triggered the field to open,
99
- * or undefined if triggered programmatically.
100
- */
101
- protected showEditor_(e?: Event): void;
102
- /**
103
- * Creates the angle dropdown editor.
104
- *
105
- * @returns The newly created slider.
106
- */
107
- private dropdownCreate;
108
- /** Disposes of events and DOM-references belonging to the angle editor. */
109
- private dropdownDispose;
110
- /** Hide the editor. */
111
- private hide;
112
- /**
113
- * Set the angle to match the mouse's position.
114
- *
115
- * @param e Mouse move event.
116
- */
117
- protected onMouseMove_(e: PointerEvent): void;
118
- /**
119
- * Handles and displays values that are input via mouse or arrow key input.
120
- * These values need to be rounded and wrapped before being displayed so
121
- * that the text input's value is appropriate.
122
- *
123
- * @param angle New angle.
124
- */
125
- private displayMouseOrKeyboardValue;
126
- /** Redraw the graph with the current angle. */
127
- private updateGraph;
128
- /**
129
- * Handle key down to the editor.
130
- *
131
- * @param e Keyboard event.
132
- */
133
- protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
134
- /**
135
- * Ensure that the input value is a valid angle.
136
- *
137
- * @param newValue The input value.
138
- * @returns A valid angle, or null if invalid.
139
- */
140
- protected doClassValidation_(newValue?: any): number | null;
141
- /**
142
- * Wraps the value so that it is in the range (-360 + wrap, wrap).
143
- *
144
- * @param value The value to wrap.
145
- * @returns The wrapped value.
146
- */
147
- private wrapValue;
148
- /**
149
- * Construct a FieldAngle from a JSON arg object.
150
- *
151
- * @param options A JSON object with options (angle).
152
- * @returns The new field instance.
153
- * @nocollapse
154
- * @internal
155
- */
156
- static fromJson(options: FieldAngleFromJsonConfig): FieldAngle;
157
- }
158
- /**
159
- * The two main modes of the angle field.
160
- * Compass specifies:
161
- * - clockwise: true
162
- * - offset: 90
163
- * - wrap: 0
164
- * - round: 15
165
- *
166
- * Protractor specifies:
167
- * - clockwise: false
168
- * - offset: 0
169
- * - wrap: 0
170
- * - round: 15
171
- */
172
- export declare enum Mode {
173
- COMPASS = "compass",
174
- PROTRACTOR = "protractor"
175
- }
176
- /**
177
- * Extra configuration options for the angle field.
178
- */
179
- export interface FieldAngleConfig extends FieldInputConfig {
180
- mode?: Mode;
181
- clockwise?: boolean;
182
- offset?: number;
183
- wrap?: number;
184
- round?: number;
185
- }
186
- /**
187
- * fromJson configuration options for the angle field.
188
- */
189
- export interface FieldAngleFromJsonConfig extends FieldAngleConfig {
190
- angle?: number;
191
- }
192
- /**
193
- * A function that is called to validate changes to the field's value before
194
- * they are set.
195
- *
196
- * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
197
- * @param newValue The value to be validated.
198
- * @returns One of three instructions for setting the new value: `T`, `null`,
199
- * or `undefined`.
200
- *
201
- * - `T` to set this function's returned value instead of `newValue`.
202
- *
203
- * - `null` to invoke `doValueInvalid_` and not set a value.
204
- *
205
- * - `undefined` to set `newValue` as is.
206
- */
207
- export type FieldAngleValidator = FieldInputValidator<number>;
208
- //# sourceMappingURL=field_angle.d.ts.map
@@ -1,243 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2012 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * Colour input field.
8
- *
9
- * @class
10
- */
11
- import './events/events_block_change.js';
12
- import { Field, FieldConfig, FieldValidator } from './field.js';
13
- import { Size } from './utils/size.js';
14
- /**
15
- * Class for a colour input field.
16
- */
17
- export declare class FieldColour extends Field<string> {
18
- /**
19
- * An array of colour strings for the palette.
20
- * Copied from goog.ui.ColorPicker.SIMPLE_GRID_COLORS
21
- * All colour pickers use this unless overridden with setColours.
22
- */
23
- static COLOURS: string[];
24
- /**
25
- * An array of tooltip strings for the palette. If not the same length as
26
- * COLOURS, the colour's hex code will be used for any missing titles.
27
- * All colour pickers use this unless overridden with setColours.
28
- */
29
- static TITLES: string[];
30
- /**
31
- * Number of columns in the palette.
32
- * All colour pickers use this unless overridden with setColumns.
33
- */
34
- static COLUMNS: number;
35
- /** The field's colour picker element. */
36
- private picker;
37
- /** Index of the currently highlighted element. */
38
- private highlightedIndex;
39
- /**
40
- * Array holding info needed to unbind events.
41
- * Used for disposing.
42
- * Ex: [[node, name, func], [node, name, func]].
43
- */
44
- private boundEvents;
45
- /**
46
- * Serializable fields are saved by the serializer, non-serializable fields
47
- * are not. Editable fields should also be serializable.
48
- */
49
- SERIALIZABLE: boolean;
50
- /** Mouse cursor style when over the hotspot that initiates the editor. */
51
- CURSOR: string;
52
- /**
53
- * Used to tell if the field needs to be rendered the next time the block is
54
- * rendered. Colour fields are statically sized, and only need to be
55
- * rendered at initialization.
56
- */
57
- protected isDirty_: boolean;
58
- /** Array of colours used by this field. If null, use the global list. */
59
- private colours;
60
- /**
61
- * Array of colour tooltips used by this field. If null, use the global
62
- * list.
63
- */
64
- private titles;
65
- /**
66
- * Number of colour columns used by this field. If 0, use the global
67
- * setting. By default use the global constants for columns.
68
- */
69
- private columns;
70
- /**
71
- * @param value The initial value of the field. Should be in '#rrggbb'
72
- * format. Defaults to the first value in the default colour array. Also
73
- * accepts Field.SKIP_SETUP if you wish to skip setup (only used by
74
- * subclasses that want to handle configuration and setting the field
75
- * value after their own constructors have run).
76
- * @param validator A function that is called to validate changes to the
77
- * field's value. Takes in a colour string & returns a validated colour
78
- * string ('#rrggbb' format), or null to abort the change.
79
- * @param config A map of options used to configure the field.
80
- * See the [field creation documentation]{@link
81
- * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/colour}
82
- * for a list of properties this parameter supports.
83
- */
84
- constructor(value?: string | typeof Field.SKIP_SETUP, validator?: FieldColourValidator, config?: FieldColourConfig);
85
- /**
86
- * Configure the field based on the given map of options.
87
- *
88
- * @param config A map of options to configure the field based on.
89
- */
90
- protected configure_(config: FieldColourConfig): void;
91
- /**
92
- * Create the block UI for this colour field.
93
- */
94
- initView(): void;
95
- protected isFullBlockField(): boolean;
96
- /**
97
- * Updates text field to match the colour/style of the block.
98
- */
99
- applyColour(): void;
100
- /**
101
- * Returns the height and width of the field.
102
- *
103
- * This should *in general* be the only place render_ gets called from.
104
- *
105
- * @returns Height and width.
106
- */
107
- getSize(): Size;
108
- /**
109
- * Updates the colour of the block to reflect whether this is a full
110
- * block field or not.
111
- */
112
- protected render_(): void;
113
- /**
114
- * Updates the size of the field based on whether it is a full block field
115
- * or not.
116
- *
117
- * @param margin margin to use when positioning the field.
118
- */
119
- protected updateSize_(margin?: number): void;
120
- /**
121
- * Ensure that the input value is a valid colour.
122
- *
123
- * @param newValue The input value.
124
- * @returns A valid colour, or null if invalid.
125
- */
126
- protected doClassValidation_(newValue?: any): string | null;
127
- /**
128
- * Get the text for this field. Used when the block is collapsed.
129
- *
130
- * @returns Text representing the value of this field.
131
- */
132
- getText(): string;
133
- /**
134
- * Set a custom colour grid for this field.
135
- *
136
- * @param colours Array of colours for this block, or null to use default
137
- * (FieldColour.COLOURS).
138
- * @param titles Optional array of colour tooltips, or null to use default
139
- * (FieldColour.TITLES).
140
- * @returns Returns itself (for method chaining).
141
- */
142
- setColours(colours: string[], titles?: string[]): FieldColour;
143
- /**
144
- * Set a custom grid size for this field.
145
- *
146
- * @param columns Number of columns for this block, or 0 to use default
147
- * (FieldColour.COLUMNS).
148
- * @returns Returns itself (for method chaining).
149
- */
150
- setColumns(columns: number): FieldColour;
151
- /** Create and show the colour field's editor. */
152
- protected showEditor_(): void;
153
- /**
154
- * Handle a click on a colour cell.
155
- *
156
- * @param e Mouse event.
157
- */
158
- private onClick;
159
- /**
160
- * Handle a key down event. Navigate around the grid with the
161
- * arrow keys. Enter selects the highlighted colour.
162
- *
163
- * @param e Keyboard event.
164
- */
165
- private onKeyDown;
166
- /**
167
- * Move the currently highlighted position by dx and dy.
168
- *
169
- * @param dx Change of x.
170
- * @param dy Change of y.
171
- */
172
- private moveHighlightBy;
173
- /**
174
- * Handle a mouse move event. Highlight the hovered colour.
175
- *
176
- * @param e Mouse event.
177
- */
178
- private onMouseMove;
179
- /** Handle a mouse enter event. Focus the picker. */
180
- private onMouseEnter;
181
- /**
182
- * Handle a mouse leave event. Blur the picker and unhighlight
183
- * the currently highlighted colour.
184
- */
185
- private onMouseLeave;
186
- /**
187
- * Returns the currently highlighted item (if any).
188
- *
189
- * @returns Highlighted item (null if none).
190
- */
191
- private getHighlighted;
192
- /**
193
- * Update the currently highlighted cell.
194
- *
195
- * @param cell The new cell to highlight.
196
- * @param index The index of the new cell.
197
- */
198
- private setHighlightedCell;
199
- /** Create a colour picker dropdown editor. */
200
- private dropdownCreate;
201
- /** Disposes of events and DOM-references belonging to the colour editor. */
202
- private dropdownDispose;
203
- /**
204
- * Construct a FieldColour from a JSON arg object.
205
- *
206
- * @param options A JSON object with options (colour).
207
- * @returns The new field instance.
208
- * @nocollapse
209
- * @internal
210
- */
211
- static fromJson(options: FieldColourFromJsonConfig): FieldColour;
212
- }
213
- /**
214
- * Config options for the colour field.
215
- */
216
- export interface FieldColourConfig extends FieldConfig {
217
- colourOptions?: string[];
218
- colourTitles?: string[];
219
- columns?: number;
220
- }
221
- /**
222
- * fromJson config options for the colour field.
223
- */
224
- export interface FieldColourFromJsonConfig extends FieldColourConfig {
225
- colour?: string;
226
- }
227
- /**
228
- * A function that is called to validate changes to the field's value before
229
- * they are set.
230
- *
231
- * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
232
- * @param newValue The value to be validated.
233
- * @returns One of three instructions for setting the new value: `T`, `null`,
234
- * or `undefined`.
235
- *
236
- * - `T` to set this function's returned value instead of `newValue`.
237
- *
238
- * - `null` to invoke `doValueInvalid_` and not set a value.
239
- *
240
- * - `undefined` to set `newValue` as is.
241
- */
242
- export type FieldColourValidator = FieldValidator<string>;
243
- //# sourceMappingURL=field_colour.d.ts.map