blockly 9.1.1 → 9.2.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 (120) hide show
  1. package/blockly.min.js +384 -338
  2. package/blockly_compressed.js +381 -335
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +3 -3
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/any_aliases.d.ts +1 -1
  7. package/core/block.d.ts +3 -1
  8. package/core/block_dragger.d.ts +3 -3
  9. package/core/block_svg.d.ts +2 -2
  10. package/core/blockly.d.ts +21 -26
  11. package/core/blockly_options.d.ts +1 -0
  12. package/core/blocks.d.ts +2 -2
  13. package/core/browser_events.d.ts +2 -4
  14. package/core/bubble.d.ts +8 -8
  15. package/core/bubble_dragger.d.ts +3 -3
  16. package/core/component_manager.d.ts +1 -1
  17. package/core/contextmenu_registry.d.ts +5 -5
  18. package/core/dropdowndiv.d.ts +8 -4
  19. package/core/events/events.d.ts +21 -1
  20. package/core/events/events_abstract.d.ts +14 -1
  21. package/core/events/events_block_base.d.ts +12 -1
  22. package/core/events/events_block_change.d.ts +11 -0
  23. package/core/events/events_block_create.d.ts +11 -0
  24. package/core/events/events_block_delete.d.ts +11 -0
  25. package/core/events/events_block_drag.d.ts +11 -0
  26. package/core/events/events_block_move.d.ts +14 -0
  27. package/core/events/events_bubble_open.d.ts +11 -0
  28. package/core/events/events_click.d.ts +11 -0
  29. package/core/events/events_comment_base.d.ts +11 -0
  30. package/core/events/events_comment_change.d.ts +11 -0
  31. package/core/events/events_comment_create.d.ts +11 -0
  32. package/core/events/events_comment_delete.d.ts +21 -1
  33. package/core/events/events_comment_move.d.ts +11 -0
  34. package/core/events/events_marker_move.d.ts +11 -0
  35. package/core/events/events_procedure_base.d.ts +26 -0
  36. package/core/events/events_procedure_change_return.d.ts +40 -0
  37. package/core/events/events_procedure_create.d.ts +34 -0
  38. package/core/events/events_procedure_delete.d.ts +32 -0
  39. package/core/events/events_procedure_enable.d.ts +34 -0
  40. package/core/events/events_procedure_parameter_base.d.ts +26 -0
  41. package/core/events/events_procedure_parameter_create.d.ts +42 -0
  42. package/core/events/events_procedure_parameter_delete.d.ts +41 -0
  43. package/core/events/events_procedure_parameter_rename.d.ts +36 -0
  44. package/core/events/events_procedure_rename.d.ts +35 -0
  45. package/core/events/events_selected.d.ts +11 -0
  46. package/core/events/events_theme_change.d.ts +11 -0
  47. package/core/events/events_toolbox_item_select.d.ts +11 -0
  48. package/core/events/events_trashcan_open.d.ts +11 -0
  49. package/core/events/events_var_base.d.ts +11 -0
  50. package/core/events/events_var_create.d.ts +11 -0
  51. package/core/events/events_var_delete.d.ts +11 -0
  52. package/core/events/events_var_rename.d.ts +11 -0
  53. package/core/events/events_viewport.d.ts +11 -0
  54. package/core/events/utils.d.ts +17 -1
  55. package/core/field.d.ts +20 -9
  56. package/core/field_angle.d.ts +6 -6
  57. package/core/field_checkbox.d.ts +4 -3
  58. package/core/field_colour.d.ts +4 -3
  59. package/core/field_dropdown.d.ts +7 -6
  60. package/core/field_image.d.ts +2 -2
  61. package/core/field_input.d.ts +229 -0
  62. package/core/field_label.d.ts +2 -2
  63. package/core/field_label_serializable.d.ts +1 -1
  64. package/core/field_multilineinput.d.ts +3 -2
  65. package/core/field_number.d.ts +7 -4
  66. package/core/field_registry.d.ts +8 -5
  67. package/core/field_textinput.d.ts +6 -201
  68. package/core/field_variable.d.ts +3 -2
  69. package/core/flyout_base.d.ts +3 -4
  70. package/core/flyout_button.d.ts +1 -1
  71. package/core/gesture.d.ts +127 -50
  72. package/core/icon.d.ts +4 -4
  73. package/core/input.d.ts +8 -7
  74. package/core/insertion_marker_manager.d.ts +80 -63
  75. package/core/interfaces/i_copyable.d.ts +1 -1
  76. package/core/interfaces/i_observable.d.ts +21 -0
  77. package/core/interfaces/i_parameter_model.d.ts +3 -5
  78. package/core/keyboard_nav/ast_node.d.ts +1 -1
  79. package/core/metrics_manager.d.ts +5 -5
  80. package/core/mutator.d.ts +1 -1
  81. package/core/names.d.ts +1 -1
  82. package/core/options.d.ts +5 -4
  83. package/core/procedures/observable_parameter_model.d.ts +17 -0
  84. package/core/procedures/observable_procedure_map.d.ts +1 -1
  85. package/core/procedures/observable_procedure_model.d.ts +13 -0
  86. package/core/procedures.d.ts +1 -1
  87. package/core/registry.d.ts +1 -1
  88. package/core/rendered_connection.d.ts +1 -1
  89. package/core/renderers/common/constants.d.ts +3 -3
  90. package/core/serialization/procedures.d.ts +26 -2
  91. package/core/shortcut_registry.d.ts +1 -1
  92. package/core/theme.d.ts +4 -4
  93. package/core/theme_manager.d.ts +1 -1
  94. package/core/toolbox/category.d.ts +1 -1
  95. package/core/toolbox/collapsible_category.d.ts +1 -1
  96. package/core/toolbox/separator.d.ts +1 -1
  97. package/core/toolbox/toolbox.d.ts +1 -1
  98. package/core/tooltip.d.ts +2 -2
  99. package/core/touch.d.ts +12 -17
  100. package/core/utils/toolbox.d.ts +7 -7
  101. package/core/workspace_comment_svg.d.ts +18 -17
  102. package/core/workspace_svg.d.ts +13 -15
  103. package/core.js +4 -3
  104. package/msg/bs.js +12 -12
  105. package/msg/de.js +6 -6
  106. package/msg/diq.js +6 -6
  107. package/msg/es.js +15 -15
  108. package/msg/fr.js +2 -2
  109. package/msg/he.js +1 -1
  110. package/msg/hy.js +43 -43
  111. package/msg/is.js +17 -17
  112. package/msg/ja.js +1 -1
  113. package/msg/ko.js +3 -3
  114. package/msg/nb.js +1 -1
  115. package/msg/oc.js +2 -2
  116. package/msg/smn.js +24 -24
  117. package/msg/zh-hant.js +10 -10
  118. package/package.json +7 -6
  119. package/core/interfaces/i_registrable_field.d.ts +0 -19
  120. package/core/touch_gesture.d.ts +0 -130
@@ -1,2 +1,2 @@
1
- declare type any = any;
1
+ type any = any;
2
2
  //# sourceMappingURL=any_aliases.d.ts.map
package/core/block.d.ts CHANGED
@@ -58,6 +58,8 @@ export declare class Block implements IASTNodeLocation, IDeletable {
58
58
  protected styleName_: string;
59
59
  /** An optional method called during initialization. */
60
60
  init?: (() => any) | null;
61
+ /** An optional method called during disposal. */
62
+ destroy?: (() => void);
61
63
  /**
62
64
  * An optional serialization method for defining how to serialize the
63
65
  * mutation state to XML. This must be coupled with defining
@@ -878,5 +880,5 @@ export declare namespace Block {
878
880
  size: Size;
879
881
  }
880
882
  }
881
- export declare type CommentModel = Block.CommentModel;
883
+ export type CommentModel = Block.CommentModel;
882
884
  //# sourceMappingURL=block.d.ts.map
@@ -72,15 +72,15 @@ export declare class BlockDragger implements IBlockDragger {
72
72
  * @param currentDragDeltaXY How far the pointer has moved from the position
73
73
  * at the start of the drag, in pixel units.
74
74
  */
75
- drag(e: Event, currentDragDeltaXY: Coordinate): void;
75
+ drag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
76
76
  /**
77
77
  * Finish a block drag and put the block back on the workspace.
78
78
  *
79
- * @param e The mouseup/touchend event.
79
+ * @param e The pointerup event.
80
80
  * @param currentDragDeltaXY How far the pointer has moved from the position
81
81
  * at the start of the drag, in pixel units.
82
82
  */
83
- endDrag(e: Event, currentDragDeltaXY: Coordinate): void;
83
+ endDrag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
84
84
  /**
85
85
  * Calculates the drag delta and new location values after a block is dragged.
86
86
  *
@@ -235,9 +235,9 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
235
235
  */
236
236
  tab(start: Field, forward: boolean): void;
237
237
  /**
238
- * Handle a mouse-down on an SVG block.
238
+ * Handle a pointerdown on an SVG block.
239
239
  *
240
- * @param e Mouse down event or touch start event.
240
+ * @param e Pointer down event.
241
241
  */
242
242
  private onMouseDown_;
243
243
  /**
package/core/blockly.d.ts CHANGED
@@ -38,19 +38,19 @@ import { DragTarget } from './drag_target.js';
38
38
  import * as dropDownDiv from './dropdowndiv.js';
39
39
  import * as Events from './events/events.js';
40
40
  import * as Extensions from './extensions.js';
41
- import { Field } from './field.js';
42
- import { FieldAngle } from './field_angle.js';
43
- import { FieldCheckbox } from './field_checkbox.js';
44
- import { FieldColour } from './field_colour.js';
45
- import { FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
41
+ import { Field, FieldValidator } from './field.js';
42
+ import { FieldAngle, FieldAngleValidator } from './field_angle.js';
43
+ import { FieldCheckbox, FieldCheckboxValidator } from './field_checkbox.js';
44
+ import { FieldColour, FieldColourValidator } from './field_colour.js';
45
+ import { FieldDropdown, FieldDropdownValidator, MenuGenerator, MenuGeneratorFunction, MenuOption } from './field_dropdown.js';
46
46
  import { FieldImage } from './field_image.js';
47
47
  import { FieldLabel } from './field_label.js';
48
48
  import { FieldLabelSerializable } from './field_label_serializable.js';
49
- import { FieldMultilineInput } from './field_multilineinput.js';
50
- import { FieldNumber } from './field_number.js';
49
+ import { FieldMultilineInput, FieldMultilineInputValidator } from './field_multilineinput.js';
50
+ import { FieldNumber, FieldNumberValidator } from './field_number.js';
51
51
  import * as fieldRegistry from './field_registry.js';
52
- import { FieldTextInput } from './field_textinput.js';
53
- import { FieldVariable } from './field_variable.js';
52
+ import { FieldTextInput, FieldTextInputValidator } from './field_textinput.js';
53
+ import { FieldVariable, FieldVariableValidator } from './field_variable.js';
54
54
  import { Flyout } from './flyout_base.js';
55
55
  import { FlyoutButton } from './flyout_button.js';
56
56
  import { HorizontalFlyout } from './flyout_horizontal.js';
@@ -86,7 +86,6 @@ import { IMetricsManager } from './interfaces/i_metrics_manager.js';
86
86
  import { IMovable } from './interfaces/i_movable.js';
87
87
  import { IPositionable } from './interfaces/i_positionable.js';
88
88
  import { IRegistrable } from './interfaces/i_registrable.js';
89
- import { IRegistrableField } from './interfaces/i_registrable_field.js';
90
89
  import { ISelectable } from './interfaces/i_selectable.js';
91
90
  import { ISelectableToolboxItem } from './interfaces/i_selectable_toolbox_item.js';
92
91
  import { IStyleable } from './interfaces/i_styleable.js';
@@ -130,7 +129,6 @@ import { Toolbox } from './toolbox/toolbox.js';
130
129
  import { ToolboxItem } from './toolbox/toolbox_item.js';
131
130
  import * as Tooltip from './tooltip.js';
132
131
  import * as Touch from './touch.js';
133
- import { TouchGesture } from './touch_gesture.js';
134
132
  import { Trashcan } from './trashcan.js';
135
133
  import * as utils from './utils.js';
136
134
  import { VariableMap } from './variable_map.js';
@@ -374,15 +372,13 @@ export declare function unbindEvent_(bindData: browserEvents.Data): Function;
374
372
  * @param opt_noCaptureIdentifier True if triggering on this event should not
375
373
  * block execution of other event handlers on this touch or other
376
374
  * simultaneous touches. False by default.
377
- * @param opt_noPreventDefault True if triggering on this event should prevent
378
- * the default handler. False by default. If opt_noPreventDefault is
379
- * provided, opt_noCaptureIdentifier must also be provided.
375
+ * @param _opt_noPreventDefault No-op, deprecated and will be removed in v10.
380
376
  * @returns Opaque data that can be passed to unbindEvent_.
381
377
  * @deprecated Use **Blockly.browserEvents.conditionalBind** instead.
382
378
  * @see browserEvents.conditionalBind
383
379
  * @alias Blockly.bindEventWithChecks_
384
380
  */
385
- export declare function bindEventWithChecks_(node: EventTarget, name: string, thisObject: Object | null, func: Function, opt_noCaptureIdentifier?: boolean, opt_noPreventDefault?: boolean): browserEvents.Data;
381
+ export declare function bindEventWithChecks_(node: EventTarget, name: string, thisObject: Object | null, func: Function, opt_noCaptureIdentifier?: boolean, _opt_noPreventDefault?: boolean): browserEvents.Data;
386
382
  export declare const COLLAPSE_CHARS = 30;
387
383
  export declare const DRAG_STACK = true;
388
384
  export declare const OPPOSITE_TYPE: number[];
@@ -467,24 +463,25 @@ export { Cursor };
467
463
  export { DeleteArea };
468
464
  export { DragTarget };
469
465
  export declare const DropDownDiv: typeof dropDownDiv;
470
- export { Field };
471
- export { FieldAngle };
472
- export { FieldCheckbox };
473
- export { FieldColour };
474
- export { FieldDropdown, MenuGenerator, MenuGeneratorFunction, MenuOption };
466
+ export { Field, FieldValidator };
467
+ export { FieldAngle, FieldAngleValidator };
468
+ export { FieldCheckbox, FieldCheckboxValidator };
469
+ export { FieldColour, FieldColourValidator };
470
+ export { FieldDropdown, FieldDropdownValidator, MenuGenerator, MenuGeneratorFunction, MenuOption, };
475
471
  export { FieldImage };
476
472
  export { FieldLabel };
477
473
  export { FieldLabelSerializable };
478
- export { FieldMultilineInput };
479
- export { FieldNumber };
480
- export { FieldTextInput };
481
- export { FieldVariable };
474
+ export { FieldMultilineInput, FieldMultilineInputValidator };
475
+ export { FieldNumber, FieldNumberValidator };
476
+ export { FieldTextInput, FieldTextInputValidator };
477
+ export { FieldVariable, FieldVariableValidator };
482
478
  export { Flyout };
483
479
  export { FlyoutButton };
484
480
  export { FlyoutMetricsManager };
485
481
  export { CodeGenerator };
486
482
  export { CodeGenerator as Generator };
487
483
  export { Gesture };
484
+ export { Gesture as TouchGesture };
488
485
  export { Grid };
489
486
  export { HorizontalFlyout };
490
487
  export { IASTNodeLocation };
@@ -512,7 +509,6 @@ export { Input };
512
509
  export { InsertionMarkerManager };
513
510
  export { IPositionable };
514
511
  export { IRegistrable };
515
- export { IRegistrableField };
516
512
  export { ISelectable };
517
513
  export { ISelectableToolboxItem };
518
514
  export { IStyleable };
@@ -538,7 +534,6 @@ export { Toolbox };
538
534
  export { ToolboxCategory };
539
535
  export { ToolboxItem };
540
536
  export { ToolboxSeparator };
541
- export { TouchGesture };
542
537
  export { Trashcan };
543
538
  export { VariableMap };
544
539
  export { VariableModel };
@@ -23,6 +23,7 @@ export interface BlocklyOptions {
23
23
  [blockType: string]: number;
24
24
  };
25
25
  media?: string;
26
+ modalInputs?: boolean;
26
27
  move?: MoveOptions;
27
28
  oneBasedIndex?: boolean;
28
29
  readOnly?: boolean;
package/core/blocks.d.ts CHANGED
@@ -4,10 +4,10 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  /**
7
- * A block definition. For now this very lose, but it can potentially
7
+ * A block definition. For now this very loose, but it can potentially
8
8
  * be refined e.g. by replacing this typedef with a class definition.
9
9
  */
10
- export declare type BlockDefinition = any;
10
+ export type BlockDefinition = any;
11
11
  /**
12
12
  * A mapping of block type names to block prototype objects.
13
13
  *
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @alias Blockly.browserEvents.Data
11
11
  */
12
- export declare type Data = [EventTarget, string, (e: Event) => void][];
12
+ export type Data = [EventTarget, string, (e: Event) => void][];
13
13
  /**
14
14
  * Bind an event handler that can be ignored if it is not part of the active
15
15
  * touch stream.
@@ -23,9 +23,7 @@ export declare type Data = [EventTarget, string, (e: Event) => void][];
23
23
  * @param opt_noCaptureIdentifier True if triggering on this event should not
24
24
  * block execution of other event handlers on this touch or other
25
25
  * simultaneous touches. False by default.
26
- * @param opt_noPreventDefault True if triggering on this event should prevent
27
- * the default handler. False by default. If opt_noPreventDefault is
28
- * provided, opt_noCaptureIdentifier must also be provided.
26
+ * @param opt_noPreventDefault No-op, deprecated and will be removed in v10.
29
27
  * @returns Opaque data that can be passed to unbindEvent_.
30
28
  * @alias Blockly.browserEvents.conditionalBind
31
29
  */
package/core/bubble.d.ts CHANGED
@@ -115,9 +115,9 @@ export declare class Bubble implements IBubble {
115
115
  */
116
116
  setSvgId(id: string): void;
117
117
  /**
118
- * Handle a mouse-down on bubble's border.
118
+ * Handle a pointerdown on bubble's border.
119
119
  *
120
- * @param e Mouse down event.
120
+ * @param e Pointer down event.
121
121
  */
122
122
  private bubbleMouseDown;
123
123
  /**
@@ -141,15 +141,15 @@ export declare class Bubble implements IBubble {
141
141
  */
142
142
  setDeleteStyle(_enable: boolean): void;
143
143
  /**
144
- * Handle a mouse-down on bubble's resize corner.
144
+ * Handle a pointerdown on bubble's resize corner.
145
145
  *
146
- * @param e Mouse down event.
146
+ * @param e Pointer down event.
147
147
  */
148
148
  private resizeMouseDown;
149
149
  /**
150
- * Resize this bubble to follow the mouse.
150
+ * Resize this bubble to follow the pointer.
151
151
  *
152
- * @param e Mouse move event.
152
+ * @param e Pointer move event.
153
153
  */
154
154
  private resizeMouseMove;
155
155
  /**
@@ -282,9 +282,9 @@ export declare class Bubble implements IBubble {
282
282
  /** Stop binding to the global mouseup and mousemove events. */
283
283
  private static unbindDragEvents;
284
284
  /**
285
- * Handle a mouse-up event while dragging a bubble's border or resize handle.
285
+ * Handle a pointerup event while dragging a bubble's border or resize handle.
286
286
  *
287
- * @param _e Mouse up event.
287
+ * @param _e Pointer up event.
288
288
  */
289
289
  private static bubbleMouseUp;
290
290
  /**
@@ -42,7 +42,7 @@ export declare class BubbleDragger {
42
42
  * at the start of the drag, in pixel units.
43
43
  * @internal
44
44
  */
45
- dragBubble(e: Event, currentDragDeltaXY: Coordinate): void;
45
+ dragBubble(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
46
46
  /**
47
47
  * Whether ending the drag would delete the bubble.
48
48
  *
@@ -58,12 +58,12 @@ export declare class BubbleDragger {
58
58
  /**
59
59
  * Finish a bubble drag and put the bubble back on the workspace.
60
60
  *
61
- * @param e The mouseup/touchend event.
61
+ * @param e The pointerup event.
62
62
  * @param currentDragDeltaXY How far the pointer has moved from the position
63
63
  * at the start of the drag, in pixel units.
64
64
  * @internal
65
65
  */
66
- endBubbleDrag(e: Event, currentDragDeltaXY: Coordinate): void;
66
+ endBubbleDrag(e: PointerEvent, currentDragDeltaXY: Coordinate): void;
67
67
  /** Fire a move event at the end of a bubble drag. */
68
68
  private fireMoveEvent_;
69
69
  /**
@@ -96,6 +96,6 @@ export declare namespace ComponentManager {
96
96
  weight: number;
97
97
  }
98
98
  }
99
- export declare type ComponentDatum = ComponentManager.ComponentDatum;
99
+ export type ComponentDatum = ComponentManager.ComponentDatum;
100
100
  export {};
101
101
  //# sourceMappingURL=component_manager.d.ts.map
@@ -101,10 +101,10 @@ export declare namespace ContextMenuRegistry {
101
101
  callback: (p1: Scope) => void;
102
102
  }
103
103
  }
104
- export declare type ScopeType = ContextMenuRegistry.ScopeType;
104
+ export type ScopeType = ContextMenuRegistry.ScopeType;
105
105
  export declare const ScopeType: typeof ContextMenuRegistry.ScopeType;
106
- export declare type Scope = ContextMenuRegistry.Scope;
107
- export declare type RegistryItem = ContextMenuRegistry.RegistryItem;
108
- export declare type ContextMenuOption = ContextMenuRegistry.ContextMenuOption;
109
- export declare type LegacyContextMenuOption = ContextMenuRegistry.LegacyContextMenuOption;
106
+ export type Scope = ContextMenuRegistry.Scope;
107
+ export type RegistryItem = ContextMenuRegistry.RegistryItem;
108
+ export type ContextMenuOption = ContextMenuRegistry.ContextMenuOption;
109
+ export type LegacyContextMenuOption = ContextMenuRegistry.LegacyContextMenuOption;
110
110
  //# sourceMappingURL=contextmenu_registry.d.ts.map
@@ -61,6 +61,10 @@ export declare function createDom(): void;
61
61
  * @param boundsElem Element to bind drop-down to.
62
62
  */
63
63
  export declare function setBoundsElement(boundsElem: Element | null): void;
64
+ /**
65
+ * @returns The field that currently owns this, or null.
66
+ */
67
+ export declare function getOwner(): Field | null;
64
68
  /**
65
69
  * Provide the div for inserting content into the drop-down.
66
70
  *
@@ -88,7 +92,7 @@ export declare function setColour(backgroundColour: string, borderColour: string
88
92
  * @param opt_secondaryYOffset Optional Y offset for above-block positioning.
89
93
  * @returns True if the menu rendered below block; false if above.
90
94
  */
91
- export declare function showPositionedByBlock(field: Field, block: BlockSvg, opt_onHide?: Function, opt_secondaryYOffset?: number): boolean;
95
+ export declare function showPositionedByBlock<T>(field: Field<T>, block: BlockSvg, opt_onHide?: Function, opt_secondaryYOffset?: number): boolean;
92
96
  /**
93
97
  * Shortcut to show and place the drop-down with positioning determined
94
98
  * by a particular field. The primary position will be below the field,
@@ -100,7 +104,7 @@ export declare function showPositionedByBlock(field: Field, block: BlockSvg, opt
100
104
  * @param opt_secondaryYOffset Optional Y offset for above-block positioning.
101
105
  * @returns True if the menu rendered below block; false if above.
102
106
  */
103
- export declare function showPositionedByField(field: Field, opt_onHide?: Function, opt_secondaryYOffset?: number): boolean;
107
+ export declare function showPositionedByField<T>(field: Field<T>, opt_onHide?: Function, opt_secondaryYOffset?: number): boolean;
104
108
  /**
105
109
  * Show and place the drop-down.
106
110
  * The drop-down is placed with an absolute "origin point" (x, y) - i.e.,
@@ -120,7 +124,7 @@ export declare function showPositionedByField(field: Field, opt_onHide?: Functio
120
124
  * @returns True if the menu rendered at the primary origin point.
121
125
  * @internal
122
126
  */
123
- export declare function show(newOwner: Field, rtl: boolean, primaryX: number, primaryY: number, secondaryX: number, secondaryY: number, opt_onHide?: Function): boolean;
127
+ export declare function show<T>(newOwner: Field<T>, rtl: boolean, primaryX: number, primaryY: number, secondaryX: number, secondaryY: number, opt_onHide?: Function): boolean;
124
128
  /**
125
129
  * Get the x positions for the left side of the DropDownDiv and the arrow,
126
130
  * accounting for the bounds of the workspace.
@@ -151,7 +155,7 @@ export declare function isVisible(): boolean;
151
155
  * animating.
152
156
  * @returns True if hidden.
153
157
  */
154
- export declare function hideIfOwner(divOwner: Field, opt_withoutAnimation?: boolean): boolean;
158
+ export declare function hideIfOwner<T>(divOwner: Field<T>, opt_withoutAnimation?: boolean): boolean;
155
159
  /** Hide the menu, triggering animation. */
156
160
  export declare function hide(): void;
157
161
  /** Hide the menu, without animation. */
@@ -18,6 +18,16 @@ import { CommentCreate, CommentCreateJson } from './events_comment_create.js';
18
18
  import { CommentDelete } from './events_comment_delete.js';
19
19
  import { CommentMove, CommentMoveJson } from './events_comment_move.js';
20
20
  import { MarkerMove, MarkerMoveJson } from './events_marker_move.js';
21
+ import { ProcedureBase } from './events_procedure_base.js';
22
+ import { ProcedureChangeReturn } from './events_procedure_change_return.js';
23
+ import { ProcedureCreate } from './events_procedure_create.js';
24
+ import { ProcedureDelete } from './events_procedure_delete.js';
25
+ import { ProcedureEnable } from './events_procedure_enable.js';
26
+ import { ProcedureRename } from './events_procedure_rename.js';
27
+ import { ProcedureParameterBase } from './events_procedure_parameter_base.js';
28
+ import { ProcedureParameterCreate } from './events_procedure_parameter_create.js';
29
+ import { ProcedureParameterDelete } from './events_procedure_parameter_delete.js';
30
+ import { ProcedureParameterRename } from './events_procedure_parameter_rename.js';
21
31
  import { Selected, SelectedJson } from './events_selected.js';
22
32
  import { ThemeChange, ThemeChangeJson } from './events_theme_change.js';
23
33
  import { ToolboxItemSelect, ToolboxItemSelectJson } from './events_toolbox_item_select.js';
@@ -64,6 +74,16 @@ export { FinishedLoading };
64
74
  export { FinishedLoadingJson };
65
75
  export { MarkerMove };
66
76
  export { MarkerMoveJson };
77
+ export { ProcedureBase };
78
+ export { ProcedureChangeReturn };
79
+ export { ProcedureCreate };
80
+ export { ProcedureDelete };
81
+ export { ProcedureEnable };
82
+ export { ProcedureRename };
83
+ export { ProcedureParameterBase };
84
+ export { ProcedureParameterCreate };
85
+ export { ProcedureParameterDelete };
86
+ export { ProcedureParameterRename };
67
87
  export { Selected };
68
88
  export { SelectedJson };
69
89
  export { ThemeChange };
@@ -90,7 +110,7 @@ export declare const BLOCK_DELETE = "delete";
90
110
  export declare const BLOCK_DRAG = "drag";
91
111
  export declare const BLOCK_MOVE = "move";
92
112
  export declare const BUBBLE_OPEN = "bubble_open";
93
- export declare type BumpEvent = eventUtils.BumpEvent;
113
+ export type BumpEvent = eventUtils.BumpEvent;
94
114
  export declare const BUMP_EVENTS: string[];
95
115
  export declare const CHANGE = "change";
96
116
  export declare const CLICK = "click";
@@ -10,7 +10,10 @@ import type { Workspace } from '../workspace.js';
10
10
  * @alias Blockly.Events.Abstract
11
11
  */
12
12
  export declare abstract class Abstract {
13
- /** Whether or not the event is blank (to be populated by fromJson). */
13
+ /**
14
+ * Whether or not the event was constructed without necessary parameters
15
+ * (to be populated by fromJson).
16
+ */
14
17
  abstract isBlank: boolean;
15
18
  /** The workspace identifier for this event. */
16
19
  workspaceId?: string;
@@ -34,6 +37,16 @@ export declare abstract class Abstract {
34
37
  * @param json JSON representation.
35
38
  */
36
39
  fromJson(json: AbstractEventJson): void;
40
+ /**
41
+ * Deserializes the JSON event.
42
+ *
43
+ * @param event The event to append new properties to. Should be a subclass
44
+ * of Abstract (like all events), but we can't specify that due to the
45
+ * fact that parameters to static methods in subclasses must be
46
+ * supertypes of parameters to static methods in superclasses.
47
+ * @internal
48
+ */
49
+ static fromJson(json: AbstractEventJson, workspace: Workspace, event: any): Abstract;
37
50
  /**
38
51
  * Does this event record any change of state?
39
52
  *
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Block } from '../block.js';
7
+ import type { Workspace } from '../workspace.js';
7
8
  import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
8
9
  /**
9
10
  * Abstract class for a block event.
@@ -23,13 +24,23 @@ export declare class BlockBase extends AbstractEvent {
23
24
  *
24
25
  * @returns JSON representation.
25
26
  */
26
- toJson(): AbstractEventJson;
27
+ toJson(): BlockBaseJson;
27
28
  /**
28
29
  * Decode the JSON event.
29
30
  *
30
31
  * @param json JSON representation.
31
32
  */
32
33
  fromJson(json: BlockBaseJson): void;
34
+ /**
35
+ * Deserializes the JSON event.
36
+ *
37
+ * @param event The event to append new properties to. Should be a subclass
38
+ * of BlockBase, but we can't specify that due to the fact that parameters
39
+ * to static methods in subclasses must be supertypes of parameters to
40
+ * static methods in superclasses.
41
+ * @internal
42
+ */
43
+ static fromJson(json: BlockBaseJson, workspace: Workspace, event?: any): BlockBase;
33
44
  }
34
45
  export interface BlockBaseJson extends AbstractEventJson {
35
46
  blockId: string;
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { Block } from '../block.js';
7
7
  import type { BlockSvg } from '../block_svg.js';
8
+ import { Workspace } from '../workspace.js';
8
9
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
9
10
  /**
10
11
  * Class for a block change event.
@@ -37,6 +38,16 @@ export declare class BlockChange extends BlockBase {
37
38
  * @param json JSON representation.
38
39
  */
39
40
  fromJson(json: BlockChangeJson): void;
41
+ /**
42
+ * Deserializes the JSON event.
43
+ *
44
+ * @param event The event to append new properties to. Should be a subclass
45
+ * of BlockChange, but we can't specify that due to the fact that
46
+ * parameters to static methods in subclasses must be supertypes of
47
+ * parameters to static methods in superclasses.
48
+ * @internal
49
+ */
50
+ static fromJson(json: BlockChangeJson, workspace: Workspace, event?: any): BlockChange;
40
51
  /**
41
52
  * Does this event record any change of state?
42
53
  *
@@ -6,6 +6,7 @@
6
6
  import type { Block } from '../block.js';
7
7
  import * as blocks from '../serialization/blocks.js';
8
8
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
9
+ import { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a block creation event.
11
12
  *
@@ -30,6 +31,16 @@ export declare class BlockCreate extends BlockBase {
30
31
  * @param json JSON representation.
31
32
  */
32
33
  fromJson(json: BlockCreateJson): void;
34
+ /**
35
+ * Deserializes the JSON event.
36
+ *
37
+ * @param event The event to append new properties to. Should be a subclass
38
+ * of BlockCreate, but we can't specify that due to the fact that
39
+ * parameters to static methods in subclasses must be supertypes of
40
+ * parameters to static methods in superclasses.
41
+ * @internal
42
+ */
43
+ static fromJson(json: BlockCreateJson, workspace: Workspace, event?: any): BlockCreate;
33
44
  /**
34
45
  * Run a creation event.
35
46
  *
@@ -6,6 +6,7 @@
6
6
  import type { Block } from '../block.js';
7
7
  import * as blocks from '../serialization/blocks.js';
8
8
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
9
+ import { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a block deletion event.
11
12
  *
@@ -31,6 +32,16 @@ export declare class BlockDelete extends BlockBase {
31
32
  * @param json JSON representation.
32
33
  */
33
34
  fromJson(json: BlockDeleteJson): void;
35
+ /**
36
+ * Deserializes the JSON event.
37
+ *
38
+ * @param event The event to append new properties to. Should be a subclass
39
+ * of BlockDelete, but we can't specify that due to the fact that
40
+ * parameters to static methods in subclasses must be supertypes of
41
+ * parameters to static methods in superclasses.
42
+ * @internal
43
+ */
44
+ static fromJson(json: BlockDeleteJson, workspace: Workspace, event?: any): BlockDelete;
34
45
  /**
35
46
  * Run a deletion event.
36
47
  *
@@ -6,6 +6,7 @@
6
6
  import type { Block } from '../block.js';
7
7
  import { AbstractEventJson } from './events_abstract.js';
8
8
  import { UiBase } from './events_ui_base.js';
9
+ import { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a block drag event.
11
12
  *
@@ -37,6 +38,16 @@ export declare class BlockDrag extends UiBase {
37
38
  * @param json JSON representation.
38
39
  */
39
40
  fromJson(json: BlockDragJson): void;
41
+ /**
42
+ * Deserializes the JSON event.
43
+ *
44
+ * @param event The event to append new properties to. Should be a subclass
45
+ * of BlockDrag, but we can't specify that due to the fact that parameters
46
+ * to static methods in subclasses must be supertypes of parameters to
47
+ * static methods in superclasses..
48
+ * @internal
49
+ */
50
+ static fromJson(json: BlockDragJson, workspace: Workspace, event?: any): BlockDrag;
40
51
  }
41
52
  export interface BlockDragJson extends AbstractEventJson {
42
53
  isStart: boolean;
@@ -6,6 +6,7 @@
6
6
  import type { Block } from '../block.js';
7
7
  import { Coordinate } from '../utils/coordinate.js';
8
8
  import { BlockBase, BlockBaseJson } from './events_block_base.js';
9
+ import type { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a block move event. Created before the move.
11
12
  *
@@ -33,6 +34,16 @@ export declare class BlockMove extends BlockBase {
33
34
  * @param json JSON representation.
34
35
  */
35
36
  fromJson(json: BlockMoveJson): void;
37
+ /**
38
+ * Deserializes the JSON event.
39
+ *
40
+ * @param event The event to append new properties to. Should be a subclass
41
+ * of BlockMove, but we can't specify that due to the fact that parameters
42
+ * to static methods in subclasses must be supertypes of parameters to
43
+ * static methods in superclasses.
44
+ * @internal
45
+ */
46
+ static fromJson(json: BlockMoveJson, workspace: Workspace, event?: any): BlockMove;
36
47
  /** Record the block's new location. Called after the move. */
37
48
  recordNew(): void;
38
49
  /**
@@ -56,6 +67,9 @@ export declare class BlockMove extends BlockBase {
56
67
  run(forward: boolean): void;
57
68
  }
58
69
  export interface BlockMoveJson extends BlockBaseJson {
70
+ oldParentId?: string;
71
+ oldInputName?: string;
72
+ oldCoordinate?: string;
59
73
  newParentId?: string;
60
74
  newInputName?: string;
61
75
  newCoordinate?: string;
@@ -6,6 +6,7 @@
6
6
  import type { AbstractEventJson } from './events_abstract.js';
7
7
  import type { BlockSvg } from '../block_svg.js';
8
8
  import { UiBase } from './events_ui_base.js';
9
+ import type { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a bubble open event.
11
12
  *
@@ -36,6 +37,16 @@ export declare class BubbleOpen extends UiBase {
36
37
  * @param json JSON representation.
37
38
  */
38
39
  fromJson(json: BubbleOpenJson): void;
40
+ /**
41
+ * Deserializes the JSON event.
42
+ *
43
+ * @param event The event to append new properties to. Should be a subclass
44
+ * of BubbleOpen, but we can't specify that due to the fact that
45
+ * parameters to static methods in subclasses must be supertypes of
46
+ * parameters to static methods in superclasses.
47
+ * @internal
48
+ */
49
+ static fromJson(json: BubbleOpenJson, workspace: Workspace, event?: any): BubbleOpen;
39
50
  }
40
51
  export declare enum BubbleType {
41
52
  MUTATOR = "mutator",
@@ -6,6 +6,7 @@
6
6
  import type { Block } from '../block.js';
7
7
  import { AbstractEventJson } from './events_abstract.js';
8
8
  import { UiBase } from './events_ui_base.js';
9
+ import { Workspace } from '../workspace.js';
9
10
  /**
10
11
  * Class for a click event.
11
12
  *
@@ -37,6 +38,16 @@ export declare class Click extends UiBase {
37
38
  * @param json JSON representation.
38
39
  */
39
40
  fromJson(json: ClickJson): void;
41
+ /**
42
+ * Deserializes the JSON event.
43
+ *
44
+ * @param event The event to append new properties to. Should be a subclass
45
+ * of Click, but we can't specify that due to the fact that parameters to
46
+ * static methods in subclasses must be supertypes of parameters to
47
+ * static methods in superclasses.
48
+ * @internal
49
+ */
50
+ static fromJson(json: ClickJson, workspace: Workspace, event?: any): Click;
40
51
  }
41
52
  export declare enum ClickTarget {
42
53
  BLOCK = "block",