blockly 11.2.0-beta.1 → 12.0.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 (87) hide show
  1. package/blockly.min.js +737 -734
  2. package/blockly.mjs +5 -1
  3. package/blockly_compressed.js +719 -717
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks_compressed.js +18 -17
  6. package/blocks_compressed.js.map +1 -1
  7. package/core/block.d.ts +22 -22
  8. package/core/block_flyout_inflater.d.ts +89 -0
  9. package/core/block_svg.d.ts +21 -10
  10. package/core/blockly.d.ts +11 -4
  11. package/core/bubbles/textinput_bubble.d.ts +9 -0
  12. package/core/button_flyout_inflater.d.ts +36 -0
  13. package/core/clipboard.d.ts +2 -2
  14. package/core/comments/comment_view.d.ts +4 -0
  15. package/core/comments/rendered_workspace_comment.d.ts +2 -0
  16. package/core/component_manager.d.ts +1 -1
  17. package/core/contextmenu_registry.d.ts +1 -1
  18. package/core/dragging/block_drag_strategy.d.ts +2 -0
  19. package/core/dropdowndiv.d.ts +1 -1
  20. package/core/events/events.d.ts +1 -0
  21. package/core/events/events_block_move.d.ts +1 -1
  22. package/core/events/events_var_base.d.ts +2 -2
  23. package/core/events/events_var_create.d.ts +7 -2
  24. package/core/events/events_var_delete.d.ts +2 -2
  25. package/core/events/events_var_rename.d.ts +2 -2
  26. package/core/events/events_var_type_change.d.ts +55 -0
  27. package/core/events/type.d.ts +2 -0
  28. package/core/field.d.ts +5 -18
  29. package/core/field_checkbox.d.ts +1 -5
  30. package/core/field_dropdown.d.ts +0 -2
  31. package/core/field_input.d.ts +5 -7
  32. package/core/field_number.d.ts +6 -0
  33. package/core/field_textinput.d.ts +1 -0
  34. package/core/field_variable.d.ts +9 -2
  35. package/core/flyout_base.d.ts +48 -177
  36. package/core/flyout_button.d.ts +25 -6
  37. package/core/flyout_horizontal.d.ts +2 -3
  38. package/core/flyout_metrics_manager.d.ts +1 -1
  39. package/core/flyout_separator.d.ts +45 -0
  40. package/core/flyout_vertical.d.ts +3 -4
  41. package/core/generator.d.ts +1 -1
  42. package/core/gesture.d.ts +1 -1
  43. package/core/grid.d.ts +4 -1
  44. package/core/icons/comment_icon.d.ts +15 -0
  45. package/core/interfaces/i_comment_icon.d.ts +3 -0
  46. package/core/interfaces/i_flyout_inflater.d.ts +39 -0
  47. package/core/interfaces/i_toolbox.d.ts +8 -1
  48. package/core/interfaces/i_variable_backed_parameter_model.d.ts +2 -2
  49. package/core/interfaces/i_variable_map.d.ts +48 -0
  50. package/core/interfaces/i_variable_model.d.ts +36 -0
  51. package/core/label_flyout_inflater.d.ts +36 -0
  52. package/core/marker_manager.d.ts +3 -3
  53. package/core/menuitem.d.ts +0 -7
  54. package/core/names.d.ts +8 -2
  55. package/core/options.d.ts +4 -4
  56. package/core/registry.d.ts +6 -0
  57. package/core/renderers/common/constants.d.ts +6 -1
  58. package/core/renderers/common/i_path_object.d.ts +13 -13
  59. package/core/renderers/common/renderer.d.ts +12 -17
  60. package/core/renderers/geras/renderer.d.ts +1 -1
  61. package/core/renderers/zelos/constants.d.ts +8 -2
  62. package/core/renderers/zelos/renderer.d.ts +0 -7
  63. package/core/scrollbar_pair.d.ts +1 -1
  64. package/core/separator_flyout_inflater.d.ts +47 -0
  65. package/core/serialization/variables.d.ts +3 -10
  66. package/core/shortcut_registry.d.ts +2 -2
  67. package/core/theme_manager.d.ts +1 -1
  68. package/core/toolbox/category.d.ts +2 -2
  69. package/core/toolbox/collapsible_category.d.ts +1 -1
  70. package/core/toolbox/separator.d.ts +1 -1
  71. package/core/toolbox/toolbox.d.ts +10 -13
  72. package/core/variable_map.d.ts +29 -31
  73. package/core/variable_model.d.ts +38 -12
  74. package/core/variables.d.ts +38 -8
  75. package/core/widgetdiv.d.ts +2 -2
  76. package/core/workspace.d.ts +22 -20
  77. package/core/workspace_audio.d.ts +1 -1
  78. package/core/workspace_dragger.d.ts +2 -2
  79. package/core/workspace_svg.d.ts +40 -13
  80. package/core/xml.d.ts +2 -2
  81. package/index.mjs +5 -1
  82. package/package.json +7 -6
  83. package/php_compressed.js +1 -1
  84. package/php_compressed.js.map +1 -1
  85. package/python_compressed.js +1 -1
  86. package/python_compressed.js.map +1 -1
  87. package/core/insertion_marker_manager.d.ts +0 -249
@@ -3,7 +3,8 @@
3
3
  * Copyright 2012 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { VariableModel } from './variable_model.js';
6
+ import type { Block } from './block.js';
7
+ import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
7
8
  import type { Workspace } from './workspace.js';
8
9
  import type { WorkspaceSvg } from './workspace_svg.js';
9
10
  /**
@@ -23,7 +24,7 @@ export declare const CATEGORY_NAME = "VARIABLE";
23
24
  * @param ws The workspace to search for variables.
24
25
  * @returns Array of variable models.
25
26
  */
26
- export declare function allUsedVarModels(ws: Workspace): VariableModel[];
27
+ export declare function allUsedVarModels(ws: Workspace): IVariableModel<IVariableState>[];
27
28
  /**
28
29
  * Find all developer variables used by blocks in the workspace.
29
30
  * Developer variables are never shown to the user, but are declared as global
@@ -104,7 +105,7 @@ export declare function createVariableButtonHandler(workspace: Workspace, opt_ca
104
105
  * name, or null if change is to be aborted (cancel button), or undefined if
105
106
  * an existing variable was chosen.
106
107
  */
107
- export declare function renameVariable(workspace: Workspace, variable: VariableModel, opt_callback?: (p1?: string | null) => void): void;
108
+ export declare function renameVariable(workspace: Workspace, variable: IVariableModel<IVariableState>, opt_callback?: (p1?: string | null) => void): void;
108
109
  /**
109
110
  * Prompt the user for a new variable name.
110
111
  *
@@ -121,7 +122,7 @@ export declare function promptName(promptText: string, defaultText: string, call
121
122
  * @param workspace The workspace to search for the variable.
122
123
  * @returns The variable with the given name, or null if none was found.
123
124
  */
124
- export declare function nameUsedWithAnyType(name: string, workspace: Workspace): VariableModel | null;
125
+ export declare function nameUsedWithAnyType(name: string, workspace: Workspace): IVariableModel<IVariableState> | null;
125
126
  /**
126
127
  * Returns the name of the procedure with a conflicting parameter name, or null
127
128
  * if one does not exist.
@@ -141,7 +142,7 @@ export declare function nameUsedWithConflictingParam(oldName: string, newName: s
141
142
  * @param variableModel The variable model to represent.
142
143
  * @returns The generated DOM.
143
144
  */
144
- export declare function generateVariableFieldDom(variableModel: VariableModel): Element;
145
+ export declare function generateVariableFieldDom(variableModel: IVariableModel<IVariableState>): Element;
145
146
  /**
146
147
  * Helper function to look up or create a variable on the given workspace.
147
148
  * If no variable exists, creates and returns it.
@@ -154,7 +155,7 @@ export declare function generateVariableFieldDom(variableModel: VariableModel):
154
155
  * @returns The variable corresponding to the given ID or name + type
155
156
  * combination.
156
157
  */
157
- export declare function getOrCreateVariablePackage(workspace: Workspace, id: string | null, opt_name?: string, opt_type?: string): VariableModel;
158
+ export declare function getOrCreateVariablePackage(workspace: Workspace, id: string | null, opt_name?: string, opt_type?: string): IVariableModel<IVariableState>;
158
159
  /**
159
160
  * Look up a variable on the given workspace.
160
161
  * Always looks in the main workspace before looking in the flyout workspace.
@@ -170,7 +171,7 @@ export declare function getOrCreateVariablePackage(workspace: Workspace, id: str
170
171
  * @returns The variable corresponding to the given ID or name + type
171
172
  * combination, or null if not found.
172
173
  */
173
- export declare function getVariable(workspace: Workspace, id: string | null, opt_name?: string, opt_type?: string): VariableModel | null;
174
+ export declare function getVariable(workspace: Workspace, id: string | null, opt_name?: string, opt_type?: string): IVariableModel<IVariableState> | null;
174
175
  /**
175
176
  * Helper function to get the list of variables that have been added to the
176
177
  * workspace after adding a new block, using the given list of variables that
@@ -184,7 +185,36 @@ export declare function getVariable(workspace: Workspace, id: string | null, opt
184
185
  * workspace.
185
186
  * @internal
186
187
  */
187
- export declare function getAddedVariables(workspace: Workspace, originalVariables: VariableModel[]): VariableModel[];
188
+ export declare function getAddedVariables(workspace: Workspace, originalVariables: IVariableModel<IVariableState>[]): IVariableModel<IVariableState>[];
189
+ /**
190
+ * A custom compare function for the VariableModel objects.
191
+ *
192
+ * @param var1 First variable to compare.
193
+ * @param var2 Second variable to compare.
194
+ * @returns -1 if name of var1 is less than name of var2, 0 if equal, and 1 if
195
+ * greater.
196
+ * @internal
197
+ */
198
+ export declare function compareByName(var1: IVariableModel<IVariableState>, var2: IVariableModel<IVariableState>): number;
199
+ /**
200
+ * Find all the uses of a named variable.
201
+ *
202
+ * @param workspace The workspace to search for the variable.
203
+ * @param id ID of the variable to find.
204
+ * @returns Array of block usages.
205
+ */
206
+ export declare function getVariableUsesById(workspace: Workspace, id: string): Block[];
207
+ /**
208
+ * Delete a variable and all of its uses from the given workspace. May prompt
209
+ * the user for confirmation.
210
+ *
211
+ * @param workspace The workspace from which to delete the variable.
212
+ * @param variable The variable to delete.
213
+ * @param triggeringBlock The block from which this deletion was triggered, if
214
+ * any. Used to exclude it from checking and warning about blocks
215
+ * referencing the variable being deleted.
216
+ */
217
+ export declare function deleteVariable(workspace: Workspace, variable: IVariableModel<IVariableState>, triggeringBlock?: Block): void;
188
218
  export declare const TEST_ONLY: {
189
219
  generateUniqueNameInternal: typeof generateUniqueNameInternal;
190
220
  };
@@ -54,9 +54,9 @@ export declare function hideIfOwner(oldOwner: unknown): void;
54
54
  * Destroy the widget and hide the div if it is being used by an object in the
55
55
  * specified workspace, or if it is used by an unknown workspace.
56
56
  *
57
- * @param oldOwnerWorkspace The workspace that was using this container.
57
+ * @param workspace The workspace that was using this container.
58
58
  */
59
- export declare function hideIfOwnerIsInWorkspace(oldOwnerWorkspace: WorkspaceSvg): void;
59
+ export declare function hideIfOwnerIsInWorkspace(workspace: WorkspaceSvg): void;
60
60
  /**
61
61
  * Position the widget div based on an anchor rectangle.
62
62
  * The widget should be placed adjacent to but not overlapping the anchor
@@ -16,10 +16,10 @@ import type { Abstract } from './events/events_abstract.js';
16
16
  import type { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
17
17
  import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
18
18
  import { IProcedureMap } from './interfaces/i_procedure_map.js';
19
+ import type { IVariableMap } from './interfaces/i_variable_map.js';
20
+ import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
19
21
  import { Options } from './options.js';
20
22
  import type * as toolbox from './utils/toolbox.js';
21
- import { VariableMap } from './variable_map.js';
22
- import type { VariableModel } from './variable_model.js';
23
23
  /**
24
24
  * Class for a workspace. This is a data structure that contains blocks.
25
25
  * There is no UI, and can be created headlessly.
@@ -107,7 +107,7 @@ export declare class Workspace implements IASTNodeLocation {
107
107
  * @returns The comparison value. This tells Array.sort() how to change object
108
108
  * a's index.
109
109
  */
110
- private sortObjects_;
110
+ private sortObjects;
111
111
  /**
112
112
  * Adds a block to the list of top blocks.
113
113
  *
@@ -183,8 +183,8 @@ export declare class Workspace implements IASTNodeLocation {
183
183
  /** Dispose of all blocks and comments in workspace. */
184
184
  clear(): void;
185
185
  /**
186
- * Rename a variable by updating its name in the variable map. Identify the
187
- * variable to rename with the given ID.
186
+ * @deprecated v12 - Rename a variable by updating its name in the variable
187
+ * map. Identify the variable to rename with the given ID.
188
188
  *
189
189
  * @param id ID of the variable to rename.
190
190
  * @param newName New variable name.
@@ -193,6 +193,7 @@ export declare class Workspace implements IASTNodeLocation {
193
193
  /**
194
194
  * Create a variable with a given name, optional type, and optional ID.
195
195
  *
196
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().createVariable.
196
197
  * @param name The name of the variable. This must be unique across variables
197
198
  * and procedures.
198
199
  * @param opt_type The type of the variable like 'int' or 'string'.
@@ -201,10 +202,11 @@ export declare class Workspace implements IASTNodeLocation {
201
202
  * @param opt_id The unique ID of the variable. This will default to a UUID.
202
203
  * @returns The newly created variable.
203
204
  */
204
- createVariable(name: string, opt_type?: string | null, opt_id?: string | null): VariableModel;
205
+ createVariable(name: string, opt_type?: string | null, opt_id?: string | null): IVariableModel<IVariableState>;
205
206
  /**
206
207
  * Find all the uses of the given variable, which is identified by ID.
207
208
  *
209
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getVariableUsesById
208
210
  * @param id ID of the variable to find.
209
211
  * @returns Array of block usages.
210
212
  */
@@ -213,6 +215,7 @@ export declare class Workspace implements IASTNodeLocation {
213
215
  * Delete a variables by the passed in ID and all of its uses from this
214
216
  * workspace. May prompt the user for confirmation.
215
217
  *
218
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().deleteVariable.
216
219
  * @param id ID of variable to delete.
217
220
  */
218
221
  deleteVariableById(id: string): void;
@@ -220,44 +223,42 @@ export declare class Workspace implements IASTNodeLocation {
220
223
  * Find the variable by the given name and return it. Return null if not
221
224
  * found.
222
225
  *
226
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getVariable.
223
227
  * @param name The name to check for.
224
228
  * @param opt_type The type of the variable. If not provided it defaults to
225
229
  * the empty string, which is a specific type.
226
230
  * @returns The variable with the given name.
227
231
  */
228
- getVariable(name: string, opt_type?: string): VariableModel | null;
232
+ getVariable(name: string, opt_type?: string): IVariableModel<IVariableState> | null;
229
233
  /**
230
234
  * Find the variable by the given ID and return it. Return null if not found.
231
235
  *
236
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getVariableById.
232
237
  * @param id The ID to check for.
233
238
  * @returns The variable with the given ID.
234
239
  */
235
- getVariableById(id: string): VariableModel | null;
240
+ getVariableById(id: string): IVariableModel<IVariableState> | null;
236
241
  /**
237
242
  * Find the variable with the specified type. If type is null, return list of
238
243
  * variables with empty string type.
239
244
  *
245
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getVariablesOfType.
240
246
  * @param type Type of the variables to find.
241
247
  * @returns The sought after variables of the passed in type. An empty array
242
248
  * if none are found.
243
249
  */
244
- getVariablesOfType(type: string | null): VariableModel[];
245
- /**
246
- * Return all variable types.
247
- *
248
- * @returns List of variable types.
249
- * @internal
250
- */
251
- getVariableTypes(): string[];
250
+ getVariablesOfType(type: string | null): IVariableModel<IVariableState>[];
252
251
  /**
253
252
  * Return all variables of all types.
254
253
  *
254
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getAllVariables.
255
255
  * @returns List of variable models.
256
256
  */
257
- getAllVariables(): VariableModel[];
257
+ getAllVariables(): IVariableModel<IVariableState>[];
258
258
  /**
259
259
  * Returns all variable names of all types.
260
260
  *
261
+ * @deprecated v12, use Blockly.Workspace.getVariableMap().getAllVariables.
261
262
  * @returns List of all variable names of all types.
262
263
  */
263
264
  getAllVariableNames(): string[];
@@ -411,7 +412,7 @@ export declare class Workspace implements IASTNodeLocation {
411
412
  * @returns The potential variable map.
412
413
  * @internal
413
414
  */
414
- getPotentialVariableMap(): VariableMap | null;
415
+ getPotentialVariableMap(): IVariableMap<IVariableModel<IVariableState>> | null;
415
416
  /**
416
417
  * Create and store the potential variable map for this workspace.
417
418
  *
@@ -423,14 +424,14 @@ export declare class Workspace implements IASTNodeLocation {
423
424
  *
424
425
  * @returns The variable map.
425
426
  */
426
- getVariableMap(): VariableMap;
427
+ getVariableMap(): IVariableMap<IVariableModel<IVariableState>>;
427
428
  /**
428
429
  * Set the map of all variables on the workspace.
429
430
  *
430
431
  * @param variableMap The variable map.
431
432
  * @internal
432
433
  */
433
- setVariableMap(variableMap: VariableMap): void;
434
+ setVariableMap(variableMap: IVariableMap<IVariableModel<IVariableState>>): void;
434
435
  /** Returns the map of all procedures on the workpace. */
435
436
  getProcedureMap(): IProcedureMap;
436
437
  /**
@@ -454,5 +455,6 @@ export declare class Workspace implements IASTNodeLocation {
454
455
  * @returns Array of workspaces.
455
456
  */
456
457
  static getAll(): Workspace[];
458
+ protected getVariableMapClass(): new (...p1: any[]) => IVariableMap<IVariableModel<IVariableState>>;
457
459
  }
458
460
  //# sourceMappingURL=workspace.d.ts.map
@@ -12,7 +12,7 @@ export declare class WorkspaceAudio {
12
12
  /** Database of pre-loaded sounds. */
13
13
  private sounds;
14
14
  /** Time that the last sound was played. */
15
- private lastSound_;
15
+ private lastSound;
16
16
  /** Whether the audio is muted or not. */
17
17
  private muted;
18
18
  /**
@@ -12,8 +12,8 @@ import type { WorkspaceSvg } from './workspace_svg.js';
12
12
  */
13
13
  export declare class WorkspaceDragger {
14
14
  private workspace;
15
- private readonly horizontalScrollEnabled_;
16
- private readonly verticalScrollEnabled_;
15
+ private readonly horizontalScrollEnabled;
16
+ private readonly verticalScrollEnabled;
17
17
  protected startScrollXY_: Coordinate;
18
18
  /** @param workspace The workspace to drag. */
19
19
  constructor(workspace: WorkspaceSvg);
@@ -26,6 +26,7 @@ import type { IDragTarget } from './interfaces/i_drag_target.js';
26
26
  import type { IFlyout } from './interfaces/i_flyout.js';
27
27
  import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
28
28
  import type { IToolbox } from './interfaces/i_toolbox.js';
29
+ import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
29
30
  import type { Cursor } from './keyboard_nav/cursor.js';
30
31
  import type { Marker } from './keyboard_nav/marker.js';
31
32
  import { LayerManager } from './layer_manager.js';
@@ -42,7 +43,6 @@ import { Rect } from './utils/rect.js';
42
43
  import { Size } from './utils/size.js';
43
44
  import { Svg } from './utils/svg.js';
44
45
  import * as toolbox from './utils/toolbox.js';
45
- import type { VariableModel } from './variable_model.js';
46
46
  import { Workspace } from './workspace.js';
47
47
  import { WorkspaceAudio } from './workspace_audio.js';
48
48
  import { ZoomControls } from './zoom_controls.js';
@@ -66,7 +66,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
66
66
  * Whether the workspace is visible. False if the workspace has been hidden
67
67
  * by calling `setVisible(false)`.
68
68
  */
69
- private isVisible_;
69
+ private visible;
70
70
  /**
71
71
  * Whether this workspace has resizes enabled.
72
72
  * Disable during batch operations for a performance improvement.
@@ -158,7 +158,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
158
158
  * Category-based toolbox providing blocks which may be dragged into this
159
159
  * workspace.
160
160
  */
161
- private toolbox_;
161
+ private toolbox;
162
162
  /**
163
163
  * The current gesture in progress on this workspace, if any.
164
164
  *
@@ -340,7 +340,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
340
340
  *
341
341
  * @param blocks List of blocks to update the style on.
342
342
  */
343
- private updateBlockStyles_;
343
+ private updateBlockStyles;
344
344
  /**
345
345
  * Getter for the inverted screen CTM.
346
346
  *
@@ -392,7 +392,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
392
392
  * @returns The first parent div with 'injectionDiv' in the name.
393
393
  * @internal
394
394
  */
395
- getInjectionDiv(): Element;
395
+ getInjectionDiv(): HTMLElement;
396
396
  /**
397
397
  * Returns the SVG group for the workspace.
398
398
  *
@@ -419,7 +419,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
419
419
  * 'blocklyMutatorBackground'.
420
420
  * @returns The workspace's SVG group.
421
421
  */
422
- createDom(opt_backgroundClass?: string, injectionDiv?: Element): Element;
422
+ createDom(opt_backgroundClass?: string, injectionDiv?: HTMLElement): Element;
423
423
  /**
424
424
  * Dispose of this workspace.
425
425
  * Unlink from all DOM elements to prevent memory leaks.
@@ -469,7 +469,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
469
469
  * Update items that use screen coordinate calculations
470
470
  * because something has changed (e.g. scroll position, window size).
471
471
  */
472
- private updateScreenCalculations_;
472
+ private updateScreenCalculations;
473
473
  /**
474
474
  * If enabled, resize the parts of the workspace that change when the
475
475
  * workspace contents (e.g. block positions) change. This will also scroll
@@ -603,7 +603,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
603
603
  * @param opt_id The unique ID of the variable. This will default to a UUID.
604
604
  * @returns The newly created variable.
605
605
  */
606
- createVariable(name: string, opt_type?: string | null, opt_id?: string | null): VariableModel;
606
+ createVariable(name: string, opt_type?: string | null, opt_id?: string | null): IVariableModel<IVariableState>;
607
607
  /** Make a list of all the delete areas for this workspace. */
608
608
  recordDragTargets(): void;
609
609
  /**
@@ -637,7 +637,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
637
637
  *
638
638
  * @param e Pointer down event.
639
639
  */
640
- private onMouseDown_;
640
+ private onMouseDown;
641
641
  /**
642
642
  * Start tracking a drag of an object on this workspace.
643
643
  *
@@ -693,7 +693,7 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
693
693
  *
694
694
  * @param e Mouse wheel event.
695
695
  */
696
- private onMouseWheel_;
696
+ private onMouseWheel;
697
697
  /**
698
698
  * Calculate the bounding box for the blocks on the workspace.
699
699
  * Coordinate system: workspace coordinates.
@@ -773,12 +773,27 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
773
773
  */
774
774
  setScale(newScale: number): void;
775
775
  /**
776
- * Get the workspace's zoom factor. If the workspace has a parent, we call
777
- * into the parent to get the workspace scale.
776
+ * Get the workspace's zoom factor.
778
777
  *
779
778
  * @returns The workspace zoom factor. Units: (pixels / workspaceUnit).
780
779
  */
781
780
  getScale(): number;
781
+ /**
782
+ * Returns the absolute scale of the workspace.
783
+ *
784
+ * Workspace scaling is multiplicative; if a workspace B (e.g. a mutator editor)
785
+ * with scale Y is nested within a root workspace A with scale X, workspace B's
786
+ * effective scale is X * Y, because, as a child of A, it is already transformed
787
+ * by A's scaling factor, and then further transforms itself by its own scaling
788
+ * factor. Normally this Just Works, but for global elements (e.g. field
789
+ * editors) that are visually associated with a particular workspace but live at
790
+ * the top level of the DOM rather than being a child of their associated
791
+ * workspace, the absolute/effective scale may be needed to render
792
+ * appropriately.
793
+ *
794
+ * @returns The absolute/effective scale of the given workspace.
795
+ */
796
+ getAbsoluteScale(): number;
782
797
  /**
783
798
  * Scroll the workspace to a specified offset (in pixels), keeping in the
784
799
  * workspace bounds. See comment on workspaceSvg.scrollX for more detail on
@@ -974,7 +989,19 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
974
989
  * @param xyRatio Contains an x and/or y property which is a float between 0
975
990
  * and 1 specifying the degree of scrolling.
976
991
  */
977
- private static setTopLevelWorkspaceMetrics_;
992
+ private static setTopLevelWorkspaceMetrics;
993
+ /**
994
+ * Adds a CSS class to the workspace.
995
+ *
996
+ * @param className Name of class to add.
997
+ */
998
+ addClass(className: string): void;
999
+ /**
1000
+ * Removes a CSS class from the workspace.
1001
+ *
1002
+ * @param className Name of class to remove.
1003
+ */
1004
+ removeClass(className: string): void;
978
1005
  }
979
1006
  /**
980
1007
  * Size the workspace when the contents change. This also updates
package/core/xml.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Block } from './block.js';
7
7
  import { WorkspaceComment } from './comments/workspace_comment.js';
8
- import type { VariableModel } from './variable_model.js';
8
+ import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
9
9
  import type { Workspace } from './workspace.js';
10
10
  import { WorkspaceSvg } from './workspace_svg.js';
11
11
  /**
@@ -25,7 +25,7 @@ export declare function saveWorkspaceComment(comment: WorkspaceComment, skipId?:
25
25
  * @param variableList List of all variable models.
26
26
  * @returns Tree of XML elements.
27
27
  */
28
- export declare function variablesToDom(variableList: VariableModel[]): Element;
28
+ export declare function variablesToDom(variableList: IVariableModel<IVariableState>[]): Element;
29
29
  /**
30
30
  * Encode a block subtree as XML with XY coordinates.
31
31
  *
package/index.mjs CHANGED
@@ -3,8 +3,10 @@ export const {
3
3
  ASTNode,
4
4
  BasicCursor,
5
5
  Block,
6
+ BlockFlyoutInflater,
6
7
  BlockSvg,
7
8
  Blocks,
9
+ ButtonFlyoutInflater,
8
10
  COLLAPSED_FIELD_NAME,
9
11
  COLLAPSED_INPUT_NAME,
10
12
  COLLAPSE_CHARS,
@@ -38,14 +40,15 @@ export const {
38
40
  Flyout,
39
41
  FlyoutButton,
40
42
  FlyoutMetricsManager,
43
+ FlyoutSeparator,
41
44
  Generator,
42
45
  Gesture,
43
46
  Grid,
44
47
  HorizontalFlyout,
45
48
  INPUT_VALUE,
46
49
  Input,
47
- InsertionMarkerManager,
48
50
  InsertionMarkerPreviewer,
51
+ LabelFlyoutInflater,
49
52
  Marker,
50
53
  MarkerManager,
51
54
  Menu,
@@ -64,6 +67,7 @@ export const {
64
67
  RenderedConnection,
65
68
  Scrollbar,
66
69
  ScrollbarPair,
70
+ SeparatorFlyoutInflater,
67
71
  ShortcutItems,
68
72
  ShortcutRegistry,
69
73
  TOOLBOX_AT_BOTTOM,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly",
3
- "version": "11.2.0-beta.1",
3
+ "version": "12.0.0-beta.0",
4
4
  "description": "Blockly is a library for building visual programming editors.",
5
5
  "keywords": [
6
6
  "blockly"
@@ -74,16 +74,16 @@
74
74
  "@hyperjump/json-schema": "^1.5.0",
75
75
  "@microsoft/api-documenter": "^7.22.4",
76
76
  "@microsoft/api-extractor": "^7.29.5",
77
- "@typescript-eslint/eslint-plugin": "^8.1.0",
78
- "@typescript-eslint/parser": "^8.1.0",
79
77
  "async-done": "^2.0.0",
80
78
  "chai": "^5.1.1",
81
79
  "concurrently": "^9.0.1",
82
- "eslint": "^8.4.1",
80
+ "eslint": "^9.15.0",
83
81
  "eslint-config-google": "^0.14.0",
84
- "eslint-config-prettier": "^9.0.0",
85
- "eslint-plugin-jsdoc": "^50.4.3",
82
+ "eslint-config-prettier": "^9.1.0",
83
+ "eslint-plugin-jsdoc": "^50.5.0",
84
+ "eslint-plugin-prettier": "^5.2.1",
86
85
  "glob": "^10.3.4",
86
+ "globals": "^15.12.0",
87
87
  "google-closure-compiler": "^20240317.0.0",
88
88
  "gulp": "^5.0.0",
89
89
  "gulp-concat": "^2.6.1",
@@ -106,6 +106,7 @@
106
106
  "readline-sync": "^1.4.10",
107
107
  "rimraf": "^5.0.0",
108
108
  "typescript": "^5.3.3",
109
+ "typescript-eslint": "^8.16.0",
109
110
  "webdriverio": "^9.0.7",
110
111
  "yargs": "^17.2.1"
111
112
  },
package/php_compressed.js CHANGED
@@ -200,7 +200,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($a, $b) {
200
200
  return rand($a, $b);
201
201
  }
202
202
  `)+"("+c+", "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},math_random_float$$module$build$src$generators$php$math=function(a,b){return["(float)rand()/(float)getrandmax()",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},math_atan2$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"X",Order$$module$build$src$generators$php$php_generator.NONE)||"0";return["atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$php$php_generator.NONE)||
203
- "0")+", "+c+") / pi() * 180",Order$$module$build$src$generators$php$php_generator.DIVISION]},procedures_defreturn$$module$build$src$generators$php$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(var f of e)e=f.name,a.getVars().includes(e)||c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
203
+ "0")+", "+c+") / pi() * 180",Order$$module$build$src$generators$php$php_generator.DIVISION]},procedures_defreturn$$module$build$src$generators$php$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(var f of e)e=f.getName(),a.getVars().includes(e)||c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
204
204
  d=c.length?b.INDENT+"global "+c.join(", ")+";\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&(f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let g="";a.getInput("STACK")&&(g=b.statementToCode(a,"STACK"));let h="";a.getInput("RETURN")&&(h=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$php$php_generator.NONE)||
205
205
  "");let k="";g&&h&&(k=f);h&&(h=b.INDENT+"return "+h+";\n");const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="function "+c+"("+l.join(", ")+") {\n"+d+f+e+g+k+h+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$php$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$php$php_generator.NONE)||
206
206
  "null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$build$src$generators$php$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$php$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$php$php_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,