blockly 11.2.0 → 12.0.0-beta.1
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/blockly.min.js +783 -767
- package/blockly.mjs +6 -1
- package/blockly_compressed.js +768 -752
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +15 -15
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +11 -6
- package/core/block_flyout_inflater.d.ts +95 -0
- package/core/block_svg.d.ts +26 -2
- package/core/blockly.d.ts +11 -3
- package/core/bubbles/textinput_bubble.d.ts +9 -0
- package/core/button_flyout_inflater.d.ts +42 -0
- package/core/clipboard.d.ts +2 -2
- package/core/comments/comment_view.d.ts +4 -0
- package/core/comments/rendered_workspace_comment.d.ts +2 -0
- package/core/connection.d.ts +1 -1
- package/core/dropdowndiv.d.ts +1 -1
- package/core/events/events.d.ts +1 -0
- package/core/events/events_var_base.d.ts +2 -2
- package/core/events/events_var_create.d.ts +7 -2
- package/core/events/events_var_delete.d.ts +2 -4
- package/core/events/events_var_rename.d.ts +2 -4
- package/core/events/events_var_type_change.d.ts +55 -0
- package/core/events/type.d.ts +2 -0
- package/core/field.d.ts +0 -13
- package/core/field_checkbox.d.ts +0 -4
- package/core/field_dropdown.d.ts +0 -2
- package/core/field_input.d.ts +0 -2
- package/core/field_number.d.ts +6 -0
- package/core/field_textinput.d.ts +1 -0
- package/core/field_variable.d.ts +9 -2
- package/core/flyout_base.d.ts +45 -181
- package/core/flyout_button.d.ts +25 -6
- package/core/flyout_horizontal.d.ts +4 -4
- package/core/flyout_item.d.ts +32 -0
- package/core/flyout_separator.d.ts +45 -0
- package/core/flyout_vertical.d.ts +5 -5
- package/core/grid.d.ts +4 -1
- package/core/icons/comment_icon.d.ts +15 -0
- package/core/interfaces/i_comment_icon.d.ts +3 -0
- package/core/interfaces/i_flyout.d.ts +1 -1
- package/core/interfaces/i_flyout_inflater.d.ts +48 -0
- package/core/interfaces/i_metrics_manager.d.ts +1 -1
- package/core/interfaces/i_rendered_element.d.ts +1 -4
- package/core/interfaces/i_toolbox.d.ts +8 -1
- package/core/interfaces/i_variable_backed_parameter_model.d.ts +2 -2
- package/core/interfaces/i_variable_map.d.ts +48 -0
- package/core/interfaces/i_variable_model.d.ts +36 -0
- package/core/label_flyout_inflater.d.ts +42 -0
- package/core/menu.d.ts +1 -3
- package/core/menuitem.d.ts +0 -7
- package/core/metrics_manager.d.ts +1 -1
- package/core/names.d.ts +8 -2
- package/core/procedures.d.ts +7 -4
- package/core/registry.d.ts +6 -0
- package/core/renderers/common/constants.d.ts +6 -1
- package/core/renderers/common/i_path_object.d.ts +13 -13
- package/core/renderers/common/renderer.d.ts +13 -18
- package/core/renderers/geras/renderer.d.ts +1 -1
- package/core/renderers/measurables/in_row_spacer.d.ts +1 -0
- package/core/renderers/measurables/jagged_edge.d.ts +1 -0
- package/core/renderers/measurables/next_connection.d.ts +1 -0
- package/core/renderers/measurables/previous_connection.d.ts +1 -0
- package/core/renderers/measurables/round_corner.d.ts +1 -0
- package/core/renderers/measurables/square_corner.d.ts +1 -0
- package/core/renderers/measurables/statement_input.d.ts +1 -0
- package/core/renderers/measurables/types.d.ts +49 -24
- package/core/renderers/zelos/constants.d.ts +8 -2
- package/core/renderers/zelos/renderer.d.ts +0 -7
- package/core/separator_flyout_inflater.d.ts +57 -0
- package/core/serialization/variables.d.ts +3 -10
- package/core/toolbox/toolbox.d.ts +2 -5
- package/core/variable_map.d.ts +27 -29
- package/core/variable_model.d.ts +37 -11
- package/core/variables.d.ts +56 -12
- package/core/variables_dynamic.d.ts +7 -5
- package/core/widgetdiv.d.ts +2 -2
- package/core/workspace.d.ts +21 -19
- package/core/workspace_svg.d.ts +34 -6
- package/core/xml.d.ts +2 -2
- package/index.mjs +6 -1
- package/media/1x1.gif +0 -0
- package/media/click.mp3 +0 -0
- package/media/click.ogg +0 -0
- package/media/click.wav +0 -0
- package/media/delete.mp3 +0 -0
- package/media/delete.ogg +0 -0
- package/media/delete.wav +0 -0
- package/media/disconnect.mp3 +0 -0
- package/media/disconnect.ogg +0 -0
- package/media/disconnect.wav +0 -0
- package/media/handclosed.cur +0 -0
- package/media/handdelete.cur +0 -0
- package/media/handopen.cur +0 -0
- package/media/pilcrow.png +0 -0
- package/media/quote0.png +0 -0
- package/media/quote1.png +0 -0
- package/media/sprites.png +0 -0
- package/package.json +1 -1
- package/php_compressed.js +1 -1
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +1 -1
- package/python_compressed.js.map +1 -1
- package/core/insertion_marker_manager.d.ts +0 -249
|
@@ -10,6 +10,7 @@ import { Measurable } from './base.js';
|
|
|
10
10
|
* during rendering.
|
|
11
11
|
*/
|
|
12
12
|
export declare class RoundCorner extends Measurable {
|
|
13
|
+
private roundCorner;
|
|
13
14
|
/**
|
|
14
15
|
* @param constants The rendering constants provider.
|
|
15
16
|
* @param opt_position The position of this corner.
|
|
@@ -10,6 +10,7 @@ import { Measurable } from './base.js';
|
|
|
10
10
|
* during rendering.
|
|
11
11
|
*/
|
|
12
12
|
export declare class SquareCorner extends Measurable {
|
|
13
|
+
private squareCorner;
|
|
13
14
|
/**
|
|
14
15
|
* @param constants The rendering constants provider.
|
|
15
16
|
* @param opt_position The position of this corner.
|
|
@@ -11,6 +11,7 @@ import { InputConnection } from './input_connection.js';
|
|
|
11
11
|
* during rendering
|
|
12
12
|
*/
|
|
13
13
|
export declare class StatementInput extends InputConnection {
|
|
14
|
+
private statementInput;
|
|
14
15
|
/**
|
|
15
16
|
* @param constants The rendering constants provider.
|
|
16
17
|
* @param input The statement input to measure and store information for.
|
|
@@ -4,7 +4,24 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Measurable } from './base.js';
|
|
7
|
+
import type { BottomRow } from './bottom_row.js';
|
|
8
|
+
import type { ExternalValueInput } from './external_value_input.js';
|
|
9
|
+
import type { Field } from './field.js';
|
|
10
|
+
import type { Hat } from './hat.js';
|
|
11
|
+
import type { Icon } from './icon.js';
|
|
12
|
+
import type { InRowSpacer } from './in_row_spacer.js';
|
|
13
|
+
import type { InlineInput } from './inline_input.js';
|
|
14
|
+
import type { InputConnection } from './input_connection.js';
|
|
15
|
+
import type { InputRow } from './input_row.js';
|
|
16
|
+
import type { JaggedEdge } from './jagged_edge.js';
|
|
17
|
+
import type { NextConnection } from './next_connection.js';
|
|
18
|
+
import type { PreviousConnection } from './previous_connection.js';
|
|
19
|
+
import type { RoundCorner } from './round_corner.js';
|
|
7
20
|
import type { Row } from './row.js';
|
|
21
|
+
import type { SpacerRow } from './spacer_row.js';
|
|
22
|
+
import type { SquareCorner } from './square_corner.js';
|
|
23
|
+
import type { StatementInput } from './statement_input.js';
|
|
24
|
+
import type { TopRow } from './top_row.js';
|
|
8
25
|
/**
|
|
9
26
|
* Types of rendering elements.
|
|
10
27
|
*/
|
|
@@ -63,77 +80,84 @@ declare class TypesContainer {
|
|
|
63
80
|
* @param elem The element to check.
|
|
64
81
|
* @returns 1 if the object stores information about a field.
|
|
65
82
|
*/
|
|
66
|
-
isField(elem: Measurable):
|
|
83
|
+
isField(elem: Measurable): elem is Field;
|
|
67
84
|
/**
|
|
68
85
|
* Whether a measurable stores information about a hat.
|
|
69
86
|
*
|
|
70
87
|
* @param elem The element to check.
|
|
71
88
|
* @returns 1 if the object stores information about a hat.
|
|
72
89
|
*/
|
|
73
|
-
isHat(elem: Measurable):
|
|
90
|
+
isHat(elem: Measurable): elem is Hat;
|
|
74
91
|
/**
|
|
75
92
|
* Whether a measurable stores information about an icon.
|
|
76
93
|
*
|
|
77
94
|
* @param elem The element to check.
|
|
78
95
|
* @returns 1 if the object stores information about an icon.
|
|
79
96
|
*/
|
|
80
|
-
isIcon(elem: Measurable):
|
|
97
|
+
isIcon(elem: Measurable): elem is Icon;
|
|
81
98
|
/**
|
|
82
99
|
* Whether a measurable stores information about a spacer.
|
|
83
100
|
*
|
|
84
101
|
* @param elem The element to check.
|
|
85
102
|
* @returns 1 if the object stores information about a spacer.
|
|
86
103
|
*/
|
|
87
|
-
isSpacer(elem: Measurable | Row):
|
|
104
|
+
isSpacer(elem: Measurable | Row): elem is SpacerRow | InRowSpacer;
|
|
88
105
|
/**
|
|
89
106
|
* Whether a measurable stores information about an in-row spacer.
|
|
90
107
|
*
|
|
91
108
|
* @param elem The element to check.
|
|
92
109
|
* @returns 1 if the object stores information about an in-row spacer.
|
|
93
110
|
*/
|
|
94
|
-
isInRowSpacer(elem: Measurable):
|
|
111
|
+
isInRowSpacer(elem: Measurable): elem is InRowSpacer;
|
|
112
|
+
/**
|
|
113
|
+
* Whether a row is a spacer row.
|
|
114
|
+
*
|
|
115
|
+
* @param row The row to check.
|
|
116
|
+
* @returns True if the row is a spacer row.
|
|
117
|
+
*/
|
|
118
|
+
isSpacerRow(row: Row): row is SpacerRow;
|
|
95
119
|
/**
|
|
96
120
|
* Whether a measurable stores information about an input.
|
|
97
121
|
*
|
|
98
122
|
* @param elem The element to check.
|
|
99
123
|
* @returns 1 if the object stores information about an input.
|
|
100
124
|
*/
|
|
101
|
-
isInput(elem: Measurable):
|
|
125
|
+
isInput(elem: Measurable): elem is InputConnection;
|
|
102
126
|
/**
|
|
103
127
|
* Whether a measurable stores information about an external input.
|
|
104
128
|
*
|
|
105
129
|
* @param elem The element to check.
|
|
106
130
|
* @returns 1 if the object stores information about an external input.
|
|
107
131
|
*/
|
|
108
|
-
isExternalInput(elem: Measurable):
|
|
132
|
+
isExternalInput(elem: Measurable): elem is ExternalValueInput;
|
|
109
133
|
/**
|
|
110
134
|
* Whether a measurable stores information about an inline input.
|
|
111
135
|
*
|
|
112
136
|
* @param elem The element to check.
|
|
113
137
|
* @returns 1 if the object stores information about an inline input.
|
|
114
138
|
*/
|
|
115
|
-
isInlineInput(elem: Measurable):
|
|
139
|
+
isInlineInput(elem: Measurable): elem is InlineInput;
|
|
116
140
|
/**
|
|
117
141
|
* Whether a measurable stores information about a statement input.
|
|
118
142
|
*
|
|
119
143
|
* @param elem The element to check.
|
|
120
144
|
* @returns 1 if the object stores information about a statement input.
|
|
121
145
|
*/
|
|
122
|
-
isStatementInput(elem: Measurable):
|
|
146
|
+
isStatementInput(elem: Measurable): elem is StatementInput;
|
|
123
147
|
/**
|
|
124
148
|
* Whether a measurable stores information about a previous connection.
|
|
125
149
|
*
|
|
126
150
|
* @param elem The element to check.
|
|
127
151
|
* @returns 1 if the object stores information about a previous connection.
|
|
128
152
|
*/
|
|
129
|
-
isPreviousConnection(elem: Measurable):
|
|
153
|
+
isPreviousConnection(elem: Measurable): elem is PreviousConnection;
|
|
130
154
|
/**
|
|
131
155
|
* Whether a measurable stores information about a next connection.
|
|
132
156
|
*
|
|
133
157
|
* @param elem The element to check.
|
|
134
158
|
* @returns 1 if the object stores information about a next connection.
|
|
135
159
|
*/
|
|
136
|
-
isNextConnection(elem: Measurable):
|
|
160
|
+
isNextConnection(elem: Measurable): elem is NextConnection;
|
|
137
161
|
/**
|
|
138
162
|
* Whether a measurable stores information about a previous or next
|
|
139
163
|
* connection.
|
|
@@ -142,91 +166,92 @@ declare class TypesContainer {
|
|
|
142
166
|
* @returns 1 if the object stores information about a previous or next
|
|
143
167
|
* connection.
|
|
144
168
|
*/
|
|
145
|
-
isPreviousOrNextConnection(elem: Measurable):
|
|
169
|
+
isPreviousOrNextConnection(elem: Measurable): elem is PreviousConnection | NextConnection;
|
|
170
|
+
isRoundCorner(elem: Measurable): elem is RoundCorner;
|
|
146
171
|
/**
|
|
147
172
|
* Whether a measurable stores information about a left round corner.
|
|
148
173
|
*
|
|
149
174
|
* @param elem The element to check.
|
|
150
175
|
* @returns 1 if the object stores information about a left round corner.
|
|
151
176
|
*/
|
|
152
|
-
isLeftRoundedCorner(elem: Measurable):
|
|
177
|
+
isLeftRoundedCorner(elem: Measurable): boolean;
|
|
153
178
|
/**
|
|
154
179
|
* Whether a measurable stores information about a right round corner.
|
|
155
180
|
*
|
|
156
181
|
* @param elem The element to check.
|
|
157
182
|
* @returns 1 if the object stores information about a right round corner.
|
|
158
183
|
*/
|
|
159
|
-
isRightRoundedCorner(elem: Measurable):
|
|
184
|
+
isRightRoundedCorner(elem: Measurable): boolean;
|
|
160
185
|
/**
|
|
161
186
|
* Whether a measurable stores information about a left square corner.
|
|
162
187
|
*
|
|
163
188
|
* @param elem The element to check.
|
|
164
189
|
* @returns 1 if the object stores information about a left square corner.
|
|
165
190
|
*/
|
|
166
|
-
isLeftSquareCorner(elem: Measurable):
|
|
191
|
+
isLeftSquareCorner(elem: Measurable): boolean;
|
|
167
192
|
/**
|
|
168
193
|
* Whether a measurable stores information about a right square corner.
|
|
169
194
|
*
|
|
170
195
|
* @param elem The element to check.
|
|
171
196
|
* @returns 1 if the object stores information about a right square corner.
|
|
172
197
|
*/
|
|
173
|
-
isRightSquareCorner(elem: Measurable):
|
|
198
|
+
isRightSquareCorner(elem: Measurable): boolean;
|
|
174
199
|
/**
|
|
175
200
|
* Whether a measurable stores information about a corner.
|
|
176
201
|
*
|
|
177
202
|
* @param elem The element to check.
|
|
178
203
|
* @returns 1 if the object stores information about a corner.
|
|
179
204
|
*/
|
|
180
|
-
isCorner(elem: Measurable):
|
|
205
|
+
isCorner(elem: Measurable): elem is SquareCorner | RoundCorner;
|
|
181
206
|
/**
|
|
182
207
|
* Whether a measurable stores information about a jagged edge.
|
|
183
208
|
*
|
|
184
209
|
* @param elem The element to check.
|
|
185
210
|
* @returns 1 if the object stores information about a jagged edge.
|
|
186
211
|
*/
|
|
187
|
-
isJaggedEdge(elem: Measurable):
|
|
212
|
+
isJaggedEdge(elem: Measurable): elem is JaggedEdge;
|
|
188
213
|
/**
|
|
189
214
|
* Whether a measurable stores information about a row.
|
|
190
215
|
*
|
|
191
216
|
* @param row The row to check.
|
|
192
217
|
* @returns 1 if the object stores information about a row.
|
|
193
218
|
*/
|
|
194
|
-
isRow(row: Row):
|
|
219
|
+
isRow(row: Row): row is Row;
|
|
195
220
|
/**
|
|
196
221
|
* Whether a measurable stores information about a between-row spacer.
|
|
197
222
|
*
|
|
198
223
|
* @param row The row to check.
|
|
199
224
|
* @returns 1 if the object stores information about a between-row spacer.
|
|
200
225
|
*/
|
|
201
|
-
isBetweenRowSpacer(row: Row):
|
|
226
|
+
isBetweenRowSpacer(row: Row): row is SpacerRow;
|
|
202
227
|
/**
|
|
203
228
|
* Whether a measurable stores information about a top row.
|
|
204
229
|
*
|
|
205
230
|
* @param row The row to check.
|
|
206
231
|
* @returns 1 if the object stores information about a top row.
|
|
207
232
|
*/
|
|
208
|
-
isTopRow(row: Row):
|
|
233
|
+
isTopRow(row: Row): row is TopRow;
|
|
209
234
|
/**
|
|
210
235
|
* Whether a measurable stores information about a bottom row.
|
|
211
236
|
*
|
|
212
237
|
* @param row The row to check.
|
|
213
238
|
* @returns 1 if the object stores information about a bottom row.
|
|
214
239
|
*/
|
|
215
|
-
isBottomRow(row: Row):
|
|
240
|
+
isBottomRow(row: Row): row is BottomRow;
|
|
216
241
|
/**
|
|
217
242
|
* Whether a measurable stores information about a top or bottom row.
|
|
218
243
|
*
|
|
219
244
|
* @param row The row to check.
|
|
220
245
|
* @returns 1 if the object stores information about a top or bottom row.
|
|
221
246
|
*/
|
|
222
|
-
isTopOrBottomRow(row: Row):
|
|
247
|
+
isTopOrBottomRow(row: Row): row is TopRow | BottomRow;
|
|
223
248
|
/**
|
|
224
249
|
* Whether a measurable stores information about an input row.
|
|
225
250
|
*
|
|
226
251
|
* @param row The row to check.
|
|
227
252
|
* @returns 1 if the object stores information about an input row.
|
|
228
253
|
*/
|
|
229
|
-
isInputRow(row: Row):
|
|
254
|
+
isInputRow(row: Row): row is InputRow;
|
|
230
255
|
}
|
|
231
256
|
export declare const Types: TypesContainer;
|
|
232
257
|
export {};
|
|
@@ -102,7 +102,13 @@ export declare class ConstantProvider extends BaseConstantProvider {
|
|
|
102
102
|
* rectangular reporter block. Null before init is called.
|
|
103
103
|
*/
|
|
104
104
|
SQUARED: Shape | null;
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new ConstantProvider.
|
|
107
|
+
*
|
|
108
|
+
* @param gridUnit If set, defines the base unit used to calculate other
|
|
109
|
+
* constants.
|
|
110
|
+
*/
|
|
111
|
+
constructor(gridUnit?: number);
|
|
106
112
|
setFontConstants_(theme: Theme): void;
|
|
107
113
|
init(): void;
|
|
108
114
|
setDynamicProperties_(theme: Theme): void;
|
|
@@ -153,7 +159,7 @@ export declare class ConstantProvider extends BaseConstantProvider {
|
|
|
153
159
|
};
|
|
154
160
|
generateSecondaryColour_(colour: string): string;
|
|
155
161
|
generateTertiaryColour_(colour: string): string;
|
|
156
|
-
createDom(svg: SVGElement, tagName: string, selector: string): void;
|
|
162
|
+
createDom(svg: SVGElement, tagName: string, selector: string, injectionDivIfIsParent?: HTMLElement): void;
|
|
157
163
|
getCSS_(selector: string): string[];
|
|
158
164
|
}
|
|
159
165
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
7
|
-
import { InsertionMarkerManager } from '../../insertion_marker_manager.js';
|
|
8
7
|
import type { Marker } from '../../keyboard_nav/marker.js';
|
|
9
|
-
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
10
8
|
import type { BlockStyle } from '../../theme.js';
|
|
11
9
|
import type { WorkspaceSvg } from '../../workspace_svg.js';
|
|
12
10
|
import type { RenderInfo as BaseRenderInfo } from '../common/info.js';
|
|
@@ -73,10 +71,5 @@ export declare class Renderer extends BaseRenderer {
|
|
|
73
71
|
* @returns The constant provider.
|
|
74
72
|
*/
|
|
75
73
|
getConstants(): ConstantProvider;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated v10 - This function is no longer respected. A custom
|
|
78
|
-
* IConnectionPreviewer may be able to fulfill the functionality.
|
|
79
|
-
*/
|
|
80
|
-
getConnectionPreviewMethod(closest: RenderedConnection, local: RenderedConnection, topBlock: BlockSvg): InsertionMarkerManager.PREVIEW_TYPE;
|
|
81
74
|
}
|
|
82
75
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FlyoutItem } from './flyout_item.js';
|
|
7
|
+
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
8
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const SEPARATOR_TYPE = "sep";
|
|
13
|
+
/**
|
|
14
|
+
* Class responsible for creating separators for flyouts.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SeparatorFlyoutInflater implements IFlyoutInflater {
|
|
17
|
+
/**
|
|
18
|
+
* Inflates a dummy flyout separator.
|
|
19
|
+
*
|
|
20
|
+
* The flyout automatically creates separators between every element with a
|
|
21
|
+
* size determined by calling gapForElement on the relevant inflater.
|
|
22
|
+
* Additionally, users can explicitly add separators in the flyout definition.
|
|
23
|
+
* When separators (implicitly or explicitly created) follow one another, the
|
|
24
|
+
* gap of the last one propagates backwards and flattens to one separator.
|
|
25
|
+
* This flattening is not additive; if there are initially separators of 2, 3,
|
|
26
|
+
* and 4 pixels, after normalization there will be one separator of 4 pixels.
|
|
27
|
+
* Therefore, this method returns a zero-width separator, which will be
|
|
28
|
+
* replaced by the one implicitly created by the flyout based on the value
|
|
29
|
+
* returned by gapForElement, which knows the default gap, unlike this method.
|
|
30
|
+
*
|
|
31
|
+
* @param _state A JSON representation of a flyout separator.
|
|
32
|
+
* @param flyoutWorkspace The workspace the separator belongs to.
|
|
33
|
+
* @returns A newly created FlyoutSeparator.
|
|
34
|
+
*/
|
|
35
|
+
load(_state: object, flyoutWorkspace: WorkspaceSvg): FlyoutItem;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the size of the separator. See `load` for more details.
|
|
38
|
+
*
|
|
39
|
+
* @param state A JSON representation of a flyout separator.
|
|
40
|
+
* @param defaultGap The default spacing for flyout items.
|
|
41
|
+
* @returns The desired size of the separator.
|
|
42
|
+
*/
|
|
43
|
+
gapForItem(state: object, defaultGap: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* Disposes of the given separator. Intentional no-op.
|
|
46
|
+
*
|
|
47
|
+
* @param _item The flyout separator to dispose of.
|
|
48
|
+
*/
|
|
49
|
+
disposeItem(_item: FlyoutItem): void;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the type of items this inflater is responsible for creating.
|
|
52
|
+
*
|
|
53
|
+
* @returns An identifier for the type of items this inflater creates.
|
|
54
|
+
*/
|
|
55
|
+
getType(): string;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=separator_flyout_inflater.d.ts.map
|
|
@@ -4,15 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { ISerializer } from '../interfaces/i_serializer.js';
|
|
7
|
+
import type { IVariableState } from '../interfaces/i_variable_model.js';
|
|
7
8
|
import type { Workspace } from '../workspace.js';
|
|
8
|
-
/**
|
|
9
|
-
* Represents the state of a given variable.
|
|
10
|
-
*/
|
|
11
|
-
export interface State {
|
|
12
|
-
name: string;
|
|
13
|
-
id: string;
|
|
14
|
-
type: string | undefined;
|
|
15
|
-
}
|
|
16
9
|
/**
|
|
17
10
|
* Serializer for saving and loading variable state.
|
|
18
11
|
*/
|
|
@@ -26,7 +19,7 @@ export declare class VariableSerializer implements ISerializer {
|
|
|
26
19
|
* @returns The state of the workspace's variables, or null if there are no
|
|
27
20
|
* variables.
|
|
28
21
|
*/
|
|
29
|
-
save(workspace: Workspace):
|
|
22
|
+
save(workspace: Workspace): IVariableState[] | null;
|
|
30
23
|
/**
|
|
31
24
|
* Deserializes the variable defined by the given state into the given
|
|
32
25
|
* workspace.
|
|
@@ -34,7 +27,7 @@ export declare class VariableSerializer implements ISerializer {
|
|
|
34
27
|
* @param state The state of the variables to deserialize.
|
|
35
28
|
* @param workspace The workspace to deserialize into.
|
|
36
29
|
*/
|
|
37
|
-
load(state:
|
|
30
|
+
load(state: IVariableState[], workspace: Workspace): void;
|
|
38
31
|
/**
|
|
39
32
|
* Disposes of any variables that exist on the workspace.
|
|
40
33
|
*
|
|
@@ -36,8 +36,6 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
36
36
|
protected contentsDiv_: HTMLDivElement | null;
|
|
37
37
|
/** Whether the Toolbox is visible. */
|
|
38
38
|
protected isVisible_: boolean;
|
|
39
|
-
/** The list of items in the toolbox. */
|
|
40
|
-
protected contents_: IToolboxItem[];
|
|
41
39
|
/** The width of the toolbox. */
|
|
42
40
|
protected width_: number;
|
|
43
41
|
/** The height of the toolbox. */
|
|
@@ -45,9 +43,8 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
45
43
|
RTL: boolean;
|
|
46
44
|
/** The flyout for the toolbox. */
|
|
47
45
|
private flyout;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
46
|
+
/** Map from ID to the corresponding toolbox item. */
|
|
47
|
+
protected contents: Map<string, IToolboxItem>;
|
|
51
48
|
toolboxPosition: toolbox.Position;
|
|
52
49
|
/** The currently selected item. */
|
|
53
50
|
protected selectedItem_: ISelectableToolboxItem | null;
|
package/core/variable_map.d.ts
CHANGED
|
@@ -11,17 +11,18 @@
|
|
|
11
11
|
import './events/events_var_delete.js';
|
|
12
12
|
import './events/events_var_rename.js';
|
|
13
13
|
import type { Block } from './block.js';
|
|
14
|
-
import {
|
|
14
|
+
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
15
|
+
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
15
16
|
import type { Workspace } from './workspace.js';
|
|
16
17
|
/**
|
|
17
18
|
* Class for a variable map. This contains a dictionary data structure with
|
|
18
19
|
* variable types as keys and lists of variables as values. The list of
|
|
19
20
|
* variables are the type indicated by the key.
|
|
20
21
|
*/
|
|
21
|
-
export declare class VariableMap {
|
|
22
|
+
export declare class VariableMap implements IVariableMap<IVariableModel<IVariableState>> {
|
|
22
23
|
workspace: Workspace;
|
|
23
24
|
/**
|
|
24
|
-
* A map from variable type to
|
|
25
|
+
* A map from variable type to map of IDs to variables. The maps contain
|
|
25
26
|
* all of the named variables in the workspace, including variables that are
|
|
26
27
|
* not currently in use.
|
|
27
28
|
*/
|
|
@@ -35,13 +36,15 @@ export declare class VariableMap {
|
|
|
35
36
|
*
|
|
36
37
|
* @param variable Variable to rename.
|
|
37
38
|
* @param newName New variable name.
|
|
38
|
-
* @
|
|
39
|
+
* @returns The newly renamed variable.
|
|
39
40
|
*/
|
|
40
|
-
renameVariable(variable:
|
|
41
|
+
renameVariable(variable: IVariableModel<IVariableState>, newName: string): IVariableModel<IVariableState>;
|
|
42
|
+
changeVariableType(variable: IVariableModel<IVariableState>, newType: string): IVariableModel<IVariableState>;
|
|
41
43
|
/**
|
|
42
44
|
* Rename a variable by updating its name in the variable map. Identify the
|
|
43
45
|
* variable to rename with the given ID.
|
|
44
46
|
*
|
|
47
|
+
* @deprecated v12, use VariableMap.renameVariable.
|
|
45
48
|
* @param id ID of the variable to rename.
|
|
46
49
|
* @param newName New variable name.
|
|
47
50
|
*/
|
|
@@ -78,29 +81,27 @@ export declare class VariableMap {
|
|
|
78
81
|
* @param opt_id The unique ID of the variable. This will default to a UUID.
|
|
79
82
|
* @returns The newly created variable.
|
|
80
83
|
*/
|
|
81
|
-
createVariable(name: string, opt_type?: string
|
|
84
|
+
createVariable(name: string, opt_type?: string, opt_id?: string): IVariableModel<IVariableState>;
|
|
82
85
|
/**
|
|
83
|
-
*
|
|
86
|
+
* Adds the given variable to this variable map.
|
|
87
|
+
*
|
|
88
|
+
* @param variable The variable to add.
|
|
89
|
+
*/
|
|
90
|
+
addVariable(variable: IVariableModel<IVariableState>): void;
|
|
91
|
+
/**
|
|
92
|
+
* Delete a variable and all of its uses without confirmation.
|
|
84
93
|
*
|
|
85
94
|
* @param variable Variable to delete.
|
|
86
95
|
*/
|
|
87
|
-
deleteVariable(variable:
|
|
96
|
+
deleteVariable(variable: IVariableModel<IVariableState>): void;
|
|
88
97
|
/**
|
|
89
98
|
* Delete a variables by the passed in ID and all of its uses from this
|
|
90
99
|
* workspace. May prompt the user for confirmation.
|
|
91
100
|
*
|
|
101
|
+
* @deprecated v12, use Blockly.Variables.deleteVariable.
|
|
92
102
|
* @param id ID of variable to delete.
|
|
93
103
|
*/
|
|
94
104
|
deleteVariableById(id: string): void;
|
|
95
|
-
/**
|
|
96
|
-
* Deletes a variable and all of its uses from this workspace without asking
|
|
97
|
-
* the user for confirmation.
|
|
98
|
-
*
|
|
99
|
-
* @param variable Variable to delete.
|
|
100
|
-
* @param uses An array of uses of the variable.
|
|
101
|
-
* @internal
|
|
102
|
-
*/
|
|
103
|
-
deleteVariableInternal(variable: VariableModel, uses: Block[]): void;
|
|
104
105
|
/**
|
|
105
106
|
* Find the variable by the given name and type and return it. Return null if
|
|
106
107
|
* it is not found.
|
|
@@ -110,14 +111,14 @@ export declare class VariableMap {
|
|
|
110
111
|
* the empty string, which is a specific type.
|
|
111
112
|
* @returns The variable with the given name, or null if it was not found.
|
|
112
113
|
*/
|
|
113
|
-
getVariable(name: string, opt_type?: string
|
|
114
|
+
getVariable(name: string, opt_type?: string): IVariableModel<IVariableState> | null;
|
|
114
115
|
/**
|
|
115
116
|
* Find the variable by the given ID and return it. Return null if not found.
|
|
116
117
|
*
|
|
117
118
|
* @param id The ID to check for.
|
|
118
119
|
* @returns The variable with the given ID.
|
|
119
120
|
*/
|
|
120
|
-
getVariableById(id: string):
|
|
121
|
+
getVariableById(id: string): IVariableModel<IVariableState> | null;
|
|
121
122
|
/**
|
|
122
123
|
* Get a list containing all of the variables of a specified type. If type is
|
|
123
124
|
* null, return list of variables with empty string type.
|
|
@@ -126,33 +127,30 @@ export declare class VariableMap {
|
|
|
126
127
|
* @returns The sought after variables of the passed in type. An empty array
|
|
127
128
|
* if none are found.
|
|
128
129
|
*/
|
|
129
|
-
getVariablesOfType(type: string | null):
|
|
130
|
+
getVariablesOfType(type: string | null): IVariableModel<IVariableState>[];
|
|
130
131
|
/**
|
|
131
|
-
*
|
|
132
|
-
* contains the empty string.
|
|
132
|
+
* Returns a list of unique types of variables in this variable map.
|
|
133
133
|
*
|
|
134
|
-
* @
|
|
135
|
-
* different than the workspace stored on this object if the passed in ws
|
|
136
|
-
* is a flyout workspace.
|
|
137
|
-
* @returns List of variable types.
|
|
138
|
-
* @internal
|
|
134
|
+
* @returns A list of unique types of variables in this variable map.
|
|
139
135
|
*/
|
|
140
|
-
|
|
136
|
+
getTypes(): string[];
|
|
141
137
|
/**
|
|
142
138
|
* Return all variables of all types.
|
|
143
139
|
*
|
|
144
140
|
* @returns List of variable models.
|
|
145
141
|
*/
|
|
146
|
-
getAllVariables():
|
|
142
|
+
getAllVariables(): IVariableModel<IVariableState>[];
|
|
147
143
|
/**
|
|
148
144
|
* Returns all of the variable names of all types.
|
|
149
145
|
*
|
|
146
|
+
* @deprecated v12, use Blockly.Variables.getAllVariables.
|
|
150
147
|
* @returns All of the variable names of all types.
|
|
151
148
|
*/
|
|
152
149
|
getAllVariableNames(): string[];
|
|
153
150
|
/**
|
|
154
151
|
* Find all the uses of a named variable.
|
|
155
152
|
*
|
|
153
|
+
* @deprecated v12, use Blockly.Variables.getVariableUsesById.
|
|
156
154
|
* @param id ID of the variable to find.
|
|
157
155
|
* @returns Array of block usages.
|
|
158
156
|
*/
|
package/core/variable_model.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
11
|
import './events/events_var_create.js';
|
|
12
|
+
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
12
13
|
import type { Workspace } from './workspace.js';
|
|
13
14
|
/**
|
|
14
15
|
* Class for a variable model.
|
|
@@ -16,10 +17,10 @@ import type { Workspace } from './workspace.js';
|
|
|
16
17
|
*
|
|
17
18
|
* @see {Blockly.FieldVariable}
|
|
18
19
|
*/
|
|
19
|
-
export declare class VariableModel {
|
|
20
|
-
workspace
|
|
21
|
-
name
|
|
22
|
-
type
|
|
20
|
+
export declare class VariableModel implements IVariableModel<IVariableState> {
|
|
21
|
+
private readonly workspace;
|
|
22
|
+
private name;
|
|
23
|
+
private type;
|
|
23
24
|
private readonly id;
|
|
24
25
|
/**
|
|
25
26
|
* @param workspace The variable's workspace.
|
|
@@ -33,15 +34,40 @@ export declare class VariableModel {
|
|
|
33
34
|
constructor(workspace: Workspace, name: string, opt_type?: string, opt_id?: string);
|
|
34
35
|
/** @returns The ID for the variable. */
|
|
35
36
|
getId(): string;
|
|
37
|
+
/** @returns The name of this variable. */
|
|
38
|
+
getName(): string;
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* Updates the user-visible name of this variable.
|
|
38
41
|
*
|
|
39
|
-
* @
|
|
40
|
-
* @param var2 Second variable to compare.
|
|
41
|
-
* @returns -1 if name of var1 is less than name of var2, 0 if equal, and 1 if
|
|
42
|
-
* greater.
|
|
43
|
-
* @internal
|
|
42
|
+
* @returns The newly-updated variable.
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
setName(newName: string): this;
|
|
45
|
+
/** @returns The type of this variable. */
|
|
46
|
+
getType(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Updates the type of this variable.
|
|
49
|
+
*
|
|
50
|
+
* @returns The newly-updated variable.
|
|
51
|
+
*/
|
|
52
|
+
setType(newType: string): this;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the workspace this VariableModel belongs to.
|
|
55
|
+
*
|
|
56
|
+
* @returns The workspace this VariableModel belongs to.
|
|
57
|
+
*/
|
|
58
|
+
getWorkspace(): Workspace;
|
|
59
|
+
/**
|
|
60
|
+
* Serializes this VariableModel.
|
|
61
|
+
*
|
|
62
|
+
* @returns a JSON representation of this VariableModel.
|
|
63
|
+
*/
|
|
64
|
+
save(): IVariableState;
|
|
65
|
+
/**
|
|
66
|
+
* Loads the persisted state into a new variable in the given workspace.
|
|
67
|
+
*
|
|
68
|
+
* @param state The serialized state of a variable model from save().
|
|
69
|
+
* @param workspace The workspace to create the new variable in.
|
|
70
|
+
*/
|
|
71
|
+
static load(state: IVariableState, workspace: Workspace): void;
|
|
46
72
|
}
|
|
47
73
|
//# sourceMappingURL=variable_model.d.ts.map
|