blockly 9.2.1 → 9.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +308 -356
- package/blockly_compressed.js +308 -356
- package/blockly_compressed.js.map +1 -1
- package/core/block_dragger.d.ts +1 -1
- package/core/block_svg.d.ts +4 -17
- package/core/blockly.d.ts +2 -4
- package/core/bubble.d.ts +2 -6
- package/core/bubble_dragger.d.ts +1 -2
- package/core/events/events.d.ts +2 -22
- package/core/events/events_abstract.d.ts +7 -0
- package/core/events/events_block_base.d.ts +2 -1
- package/core/events/events_block_change.d.ts +9 -1
- package/core/events/events_block_create.d.ts +6 -2
- package/core/events/events_block_delete.d.ts +7 -2
- package/core/events/events_block_drag.d.ts +7 -1
- package/core/events/events_block_move.d.ts +20 -1
- package/core/events/events_bubble_open.d.ts +3 -0
- package/core/events/events_click.d.ts +6 -1
- package/core/events/events_comment_base.d.ts +1 -0
- package/core/events/events_comment_change.d.ts +3 -1
- package/core/events/events_comment_create.d.ts +2 -1
- package/core/events/events_comment_delete.d.ts +2 -1
- package/core/events/events_comment_move.d.ts +4 -2
- package/core/events/events_marker_move.d.ts +10 -1
- package/core/events/events_selected.d.ts +6 -0
- package/core/events/events_theme_change.d.ts +2 -1
- package/core/events/events_toolbox_item_select.d.ts +3 -1
- package/core/events/events_trashcan_open.d.ts +5 -1
- package/core/events/events_var_base.d.ts +1 -0
- package/core/events/events_var_create.d.ts +3 -1
- package/core/events/events_var_delete.d.ts +4 -2
- package/core/events/events_var_rename.d.ts +4 -2
- package/core/events/events_viewport.d.ts +14 -1
- package/core/events/utils.d.ts +0 -16
- package/core/events/workspace_events.d.ts +2 -4
- package/core/field.d.ts +42 -9
- package/core/field_angle.d.ts +1 -1
- package/core/field_checkbox.d.ts +15 -8
- package/core/field_colour.d.ts +1 -4
- package/core/field_dropdown.d.ts +2 -2
- package/core/field_image.d.ts +1 -2
- package/core/field_input.d.ts +6 -15
- package/core/field_multilineinput.d.ts +2 -2
- package/core/field_textinput.d.ts +12 -0
- package/core/field_variable.d.ts +2 -2
- package/core/gesture.d.ts +1 -1
- package/core/interfaces/i_block_dragger.d.ts +1 -1
- package/core/interfaces/i_bubble.d.ts +2 -6
- package/core/interfaces/i_metrics_manager.d.ts +8 -6
- package/core/interfaces/i_procedure_block.d.ts +3 -0
- package/core/metrics_manager.d.ts +8 -6
- package/core/{procedures/observable_procedure_map.d.ts → observable_procedure_map.d.ts} +4 -5
- package/core/procedures.d.ts +6 -4
- package/core/serialization/procedures.d.ts +0 -7
- package/core/utils/sentinel.d.ts +5 -0
- package/core/workspace_comment_svg.d.ts +2 -15
- package/core/workspace_dragger.d.ts +0 -3
- package/core/workspace_svg.d.ts +1 -44
- package/package.json +6 -6
- package/core/block_drag_surface.d.ts +0 -135
- package/core/events/events_procedure_base.d.ts +0 -26
- package/core/events/events_procedure_change_return.d.ts +0 -40
- package/core/events/events_procedure_create.d.ts +0 -34
- package/core/events/events_procedure_delete.d.ts +0 -32
- package/core/events/events_procedure_enable.d.ts +0 -34
- package/core/events/events_procedure_parameter_base.d.ts +0 -26
- package/core/events/events_procedure_parameter_create.d.ts +0 -42
- package/core/events/events_procedure_parameter_delete.d.ts +0 -41
- package/core/events/events_procedure_parameter_rename.d.ts +0 -36
- package/core/events/events_procedure_rename.d.ts +0 -35
- package/core/procedures/observable_parameter_model.d.ts +0 -62
- package/core/procedures/observable_procedure_model.d.ts +0 -75
- package/core/procedures/update_procedures.d.ts +0 -13
- package/core/workspace_drag_surface_svg.d.ts +0 -74
|
@@ -7,14 +7,27 @@ import { AbstractEventJson } from './events_abstract.js';
|
|
|
7
7
|
import { UiBase } from './events_ui_base.js';
|
|
8
8
|
import type { Workspace } from '../workspace.js';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Notifies listeners that the workspace surface's position or scale has
|
|
11
|
+
* changed.
|
|
12
|
+
*
|
|
13
|
+
* Does not notify when the workspace itself resizes.
|
|
11
14
|
*
|
|
12
15
|
* @alias Blockly.Events.ViewportChange
|
|
13
16
|
*/
|
|
14
17
|
export declare class ViewportChange extends UiBase {
|
|
18
|
+
/**
|
|
19
|
+
* Top edge of the visible portion of the workspace, relative to the
|
|
20
|
+
* workspace origin.
|
|
21
|
+
*/
|
|
15
22
|
viewTop?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The left edge of the visible portion of the workspace, relative to
|
|
25
|
+
* the workspace origin.
|
|
26
|
+
*/
|
|
16
27
|
viewLeft?: number;
|
|
28
|
+
/** The scale of the workpace. */
|
|
17
29
|
scale?: number;
|
|
30
|
+
/** The previous scale of the workspace. */
|
|
18
31
|
oldScale?: number;
|
|
19
32
|
type: string;
|
|
20
33
|
/**
|
package/core/events/utils.d.ts
CHANGED
|
@@ -180,22 +180,6 @@ export declare const COMMENT_MOVE = "comment_move";
|
|
|
180
180
|
* @alias Blockly.Events.utils.FINISHED_LOADING
|
|
181
181
|
*/
|
|
182
182
|
export declare const FINISHED_LOADING = "finished_loading";
|
|
183
|
-
/** Name of event that creates a procedure model. */
|
|
184
|
-
export declare const PROCEDURE_CREATE = "procedure_create";
|
|
185
|
-
/** Name of event that deletes a procedure model. */
|
|
186
|
-
export declare const PROCEDURE_DELETE = "procedure_delete";
|
|
187
|
-
/** Name of event that renames a procedure model. */
|
|
188
|
-
export declare const PROCEDURE_RENAME = "procedure_rename";
|
|
189
|
-
/** Name of event that enables/disables a procedure model. */
|
|
190
|
-
export declare const PROCEDURE_ENABLE = "procedure_enable";
|
|
191
|
-
/** Name of event that changes the returntype of a procedure model. */
|
|
192
|
-
export declare const PROCEDURE_CHANGE_RETURN = "procedure_change_return";
|
|
193
|
-
/** Name of event that creates a procedure parameter. */
|
|
194
|
-
export declare const PROCEDURE_PARAMETER_CREATE = "procedure_parameter_create";
|
|
195
|
-
/** Name of event that deletes a procedure parameter. */
|
|
196
|
-
export declare const PROCEDURE_PARAMETER_DELETE = "procedure_parameter_delete";
|
|
197
|
-
/** Name of event that renames a procedure parameter. */
|
|
198
|
-
export declare const PROCEDURE_PARAMETER_RENAME = "procedure_parameter_rename";
|
|
199
183
|
/**
|
|
200
184
|
* Type of events that cause objects to be bumped back into the visible
|
|
201
185
|
* portion of the workspace.
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
import type { Workspace } from '../workspace.js';
|
|
7
7
|
import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* domToWorkspace).
|
|
12
|
-
* Finished loading events do not record undo or redo.
|
|
9
|
+
* Notifies listeners when the workspace has finished deserializing from
|
|
10
|
+
* JSON/XML.
|
|
13
11
|
*
|
|
14
12
|
* @alias Blockly.Events.FinishedLoading
|
|
15
13
|
*/
|
package/core/field.d.ts
CHANGED
|
@@ -17,11 +17,29 @@ import type { Coordinate } from './utils/coordinate.js';
|
|
|
17
17
|
import { Rect } from './utils/rect.js';
|
|
18
18
|
import { Sentinel } from './utils/sentinel.js';
|
|
19
19
|
import { Size } from './utils/size.js';
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A function that is called to validate changes to the field's value before
|
|
22
|
+
* they are set.
|
|
23
|
+
*
|
|
24
|
+
* **NOTE:** Validation returns one option between `T`, `null`, and `undefined`.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
27
|
+
* @param newValue The value to be validated.
|
|
28
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
29
|
+
* or `undefined`.
|
|
30
|
+
*
|
|
31
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
32
|
+
*
|
|
33
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
34
|
+
*
|
|
35
|
+
* - `undefined` to set `newValue` as is.
|
|
36
|
+
*/
|
|
37
|
+
export type FieldValidator<T = any> = (newValue: T) => T | null | undefined;
|
|
21
38
|
/**
|
|
22
39
|
* Abstract class for an editable field.
|
|
23
40
|
*
|
|
24
41
|
* @alias Blockly.Field
|
|
42
|
+
* @typeParam T - The value stored on the field.
|
|
25
43
|
*/
|
|
26
44
|
export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IASTNodeLocationWithBlock, IKeyboardAccessible, IRegistrable {
|
|
27
45
|
/**
|
|
@@ -42,6 +60,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
42
60
|
* instead.
|
|
43
61
|
*/
|
|
44
62
|
static readonly SKIP_SETUP: Sentinel;
|
|
63
|
+
static isSentinel<T>(value: T | Sentinel): value is Sentinel;
|
|
45
64
|
/**
|
|
46
65
|
* Name of field. Unique within each block.
|
|
47
66
|
* Static labels are usually unnamed.
|
|
@@ -336,7 +355,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
336
355
|
*
|
|
337
356
|
* @returns Validation function, or null.
|
|
338
357
|
*/
|
|
339
|
-
getValidator():
|
|
358
|
+
getValidator(): FieldValidator<T> | null;
|
|
340
359
|
/**
|
|
341
360
|
* Gets the group element for this editable field.
|
|
342
361
|
* Used for measuring the size and for positioning.
|
|
@@ -495,22 +514,36 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
495
514
|
*
|
|
496
515
|
* @returns Current value.
|
|
497
516
|
*/
|
|
498
|
-
getValue():
|
|
517
|
+
getValue(): T | null;
|
|
499
518
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
519
|
+
* Validate the changes to a field's value before they are set. See
|
|
520
|
+
* **FieldDropdown** for an example of subclass implementation.
|
|
521
|
+
*
|
|
522
|
+
* **NOTE:** Validation returns one option between `T`, `null`, and
|
|
523
|
+
* `undefined`. **Field**'s implementation will never return `undefined`, but
|
|
524
|
+
* it is valid for a subclass to return `undefined` if the new value is
|
|
525
|
+
* compatible with `T`.
|
|
526
|
+
*
|
|
527
|
+
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
|
528
|
+
* @param newValue - The value to be validated.
|
|
529
|
+
* @returns One of three instructions for setting the new value: `T`, `null`,
|
|
530
|
+
* or `undefined`.
|
|
531
|
+
*
|
|
532
|
+
* - `T` to set this function's returned value instead of `newValue`.
|
|
533
|
+
*
|
|
534
|
+
* - `null` to invoke `doValueInvalid_` and not set a value.
|
|
502
535
|
*
|
|
503
|
-
*
|
|
504
|
-
* @returns The validated value, same as input by default.
|
|
536
|
+
* - `undefined` to set `newValue` as is.
|
|
505
537
|
*/
|
|
506
|
-
protected doClassValidation_(
|
|
538
|
+
protected doClassValidation_(newValue: T): T | null | undefined;
|
|
539
|
+
protected doClassValidation_(newValue?: any): T | null;
|
|
507
540
|
/**
|
|
508
541
|
* Used to update the value of a field. Can be overridden by subclasses to do
|
|
509
542
|
* custom storage of values/updating of external things.
|
|
510
543
|
*
|
|
511
544
|
* @param newValue The value to be saved.
|
|
512
545
|
*/
|
|
513
|
-
protected doValueUpdate_(newValue:
|
|
546
|
+
protected doValueUpdate_(newValue: T): void;
|
|
514
547
|
/**
|
|
515
548
|
* Used to notify the field an invalid value was input. Can be overridden by
|
|
516
549
|
* subclasses, see FieldTextInput.
|
package/core/field_angle.d.ts
CHANGED
|
@@ -138,7 +138,7 @@ export declare class FieldAngle extends FieldInput<number> {
|
|
|
138
138
|
*
|
|
139
139
|
* @param e Keyboard event.
|
|
140
140
|
*/
|
|
141
|
-
protected onHtmlInputKeyDown_(e:
|
|
141
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
142
142
|
/**
|
|
143
143
|
* Ensure that the input value is a valid angle.
|
|
144
144
|
*
|
package/core/field_checkbox.d.ts
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
import './events/events_block_change.js';
|
|
7
7
|
import { Field, FieldConfig, FieldValidator } from './field.js';
|
|
8
8
|
import type { Sentinel } from './utils/sentinel.js';
|
|
9
|
-
|
|
9
|
+
type BoolString = 'TRUE' | 'FALSE';
|
|
10
|
+
type CheckboxBool = BoolString | boolean;
|
|
11
|
+
export type FieldCheckboxValidator = FieldValidator<CheckboxBool>;
|
|
10
12
|
/**
|
|
11
13
|
* Class for a checkbox field.
|
|
12
14
|
*
|
|
13
15
|
* @alias Blockly.FieldCheckbox
|
|
14
16
|
*/
|
|
15
|
-
export declare class FieldCheckbox extends Field<
|
|
17
|
+
export declare class FieldCheckbox extends Field<CheckboxBool> {
|
|
16
18
|
/** Default character for the checkmark. */
|
|
17
19
|
static readonly CHECK_CHAR = "\u2713";
|
|
18
20
|
private checkChar_;
|
|
@@ -25,7 +27,11 @@ export declare class FieldCheckbox extends Field<boolean> {
|
|
|
25
27
|
* Mouse cursor style when over the hotspot that initiates editability.
|
|
26
28
|
*/
|
|
27
29
|
CURSOR: string;
|
|
28
|
-
|
|
30
|
+
/**
|
|
31
|
+
* NOTE: The default value is set in `Field`, so maintain that value instead
|
|
32
|
+
* of overwriting it here or in the constructor.
|
|
33
|
+
*/
|
|
34
|
+
value_: boolean | null;
|
|
29
35
|
/**
|
|
30
36
|
* @param opt_value The initial value of the field. Should either be 'TRUE',
|
|
31
37
|
* 'FALSE' or a boolean. Defaults to 'FALSE'. Also accepts
|
|
@@ -40,7 +46,7 @@ export declare class FieldCheckbox extends Field<boolean> {
|
|
|
40
46
|
* https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation}
|
|
41
47
|
* for a list of properties this parameter supports.
|
|
42
48
|
*/
|
|
43
|
-
constructor(opt_value?:
|
|
49
|
+
constructor(opt_value?: CheckboxBool | Sentinel, opt_validator?: FieldCheckboxValidator, opt_config?: FieldCheckboxConfig);
|
|
44
50
|
/**
|
|
45
51
|
* Configure the field based on the given map of options.
|
|
46
52
|
*
|
|
@@ -77,26 +83,26 @@ export declare class FieldCheckbox extends Field<boolean> {
|
|
|
77
83
|
* @param opt_newValue The input value.
|
|
78
84
|
* @returns A valid value ('TRUE' or 'FALSE), or null if invalid.
|
|
79
85
|
*/
|
|
80
|
-
protected doClassValidation_(opt_newValue?: any):
|
|
86
|
+
protected doClassValidation_(opt_newValue?: any): BoolString | null;
|
|
81
87
|
/**
|
|
82
88
|
* Update the value of the field, and update the checkElement.
|
|
83
89
|
*
|
|
84
90
|
* @param newValue The value to be saved. The default validator guarantees
|
|
85
91
|
* that this is a either 'TRUE' or 'FALSE'.
|
|
86
92
|
*/
|
|
87
|
-
protected doValueUpdate_(newValue:
|
|
93
|
+
protected doValueUpdate_(newValue: BoolString): void;
|
|
88
94
|
/**
|
|
89
95
|
* Get the value of this field, either 'TRUE' or 'FALSE'.
|
|
90
96
|
*
|
|
91
97
|
* @returns The value of this field.
|
|
92
98
|
*/
|
|
93
|
-
getValue():
|
|
99
|
+
getValue(): BoolString;
|
|
94
100
|
/**
|
|
95
101
|
* Get the boolean value of this field.
|
|
96
102
|
*
|
|
97
103
|
* @returns The boolean value of this field.
|
|
98
104
|
*/
|
|
99
|
-
getValueBoolean(): boolean;
|
|
105
|
+
getValueBoolean(): boolean | null;
|
|
100
106
|
/**
|
|
101
107
|
* Get the text of this field. Used when the block is collapsed.
|
|
102
108
|
*
|
|
@@ -135,4 +141,5 @@ export interface FieldCheckboxConfig extends FieldConfig {
|
|
|
135
141
|
export interface FieldCheckboxFromJsonConfig extends FieldCheckboxConfig {
|
|
136
142
|
checked?: boolean;
|
|
137
143
|
}
|
|
144
|
+
export {};
|
|
138
145
|
//# sourceMappingURL=field_checkbox.d.ts.map
|
package/core/field_colour.d.ts
CHANGED
|
@@ -69,9 +69,6 @@ export declare class FieldColour extends Field<string> {
|
|
|
69
69
|
* setting. By default use the global constants for columns.
|
|
70
70
|
*/
|
|
71
71
|
private columns_;
|
|
72
|
-
size_: any;
|
|
73
|
-
clickTarget_: any;
|
|
74
|
-
value_: any;
|
|
75
72
|
/**
|
|
76
73
|
* @param opt_value The initial value of the field. Should be in '#rrggbb'
|
|
77
74
|
* format. Defaults to the first value in the default colour array. Also
|
|
@@ -113,7 +110,7 @@ export declare class FieldColour extends Field<string> {
|
|
|
113
110
|
* @param newValue The value to be saved. The default validator guarantees
|
|
114
111
|
* that this is a colour in '#rrggbb' format.
|
|
115
112
|
*/
|
|
116
|
-
protected doValueUpdate_(newValue:
|
|
113
|
+
protected doValueUpdate_(newValue: string): void;
|
|
117
114
|
/**
|
|
118
115
|
* Get the text for this field. Used when the block is collapsed.
|
|
119
116
|
*
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -154,14 +154,14 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
154
154
|
* @param opt_newValue The input value.
|
|
155
155
|
* @returns A valid language-neutral option, or null if invalid.
|
|
156
156
|
*/
|
|
157
|
-
protected doClassValidation_(opt_newValue?:
|
|
157
|
+
protected doClassValidation_(opt_newValue?: string): string | null;
|
|
158
158
|
/**
|
|
159
159
|
* Update the value of this dropdown field.
|
|
160
160
|
*
|
|
161
161
|
* @param newValue The value to be saved. The default validator guarantees
|
|
162
162
|
* that this is one of the valid dropdown options.
|
|
163
163
|
*/
|
|
164
|
-
protected doValueUpdate_(newValue:
|
|
164
|
+
protected doValueUpdate_(newValue: string): void;
|
|
165
165
|
/**
|
|
166
166
|
* Updates the dropdown arrow to match the colour/style of the block.
|
|
167
167
|
*
|
package/core/field_image.d.ts
CHANGED
|
@@ -38,7 +38,6 @@ export declare class FieldImage extends Field<string> {
|
|
|
38
38
|
private flipRtl_;
|
|
39
39
|
/** Alt text of this image. */
|
|
40
40
|
private altText_;
|
|
41
|
-
value_: any;
|
|
42
41
|
/**
|
|
43
42
|
* @param src The URL of the image.
|
|
44
43
|
* Also accepts Field.SKIP_SETUP if you wish to skip setup (only used by
|
|
@@ -82,7 +81,7 @@ export declare class FieldImage extends Field<string> {
|
|
|
82
81
|
* @param newValue The value to be saved. The default validator guarantees
|
|
83
82
|
* that this is a string.
|
|
84
83
|
*/
|
|
85
|
-
protected doValueUpdate_(newValue:
|
|
84
|
+
protected doValueUpdate_(newValue: string): void;
|
|
86
85
|
/**
|
|
87
86
|
* Get whether to flip this image in RTL
|
|
88
87
|
*
|
package/core/field_input.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ import { Field, FieldConfig, FieldValidator } from './field.js';
|
|
|
8
8
|
import type { Sentinel } from './utils/sentinel.js';
|
|
9
9
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
10
10
|
export type InputTypes = string | number;
|
|
11
|
-
export type FieldInputValidator<T extends InputTypes> = FieldValidator<T>;
|
|
11
|
+
export type FieldInputValidator<T extends InputTypes> = FieldValidator<string | T>;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Abstract class for an editable input field.
|
|
14
14
|
*
|
|
15
15
|
* @alias Blockly.FieldInput
|
|
16
|
+
* @typeParam T - The value stored on the field.
|
|
16
17
|
*/
|
|
17
|
-
export declare abstract class FieldInput<T extends InputTypes> extends Field<T> {
|
|
18
|
+
export declare abstract class FieldInput<T extends InputTypes> extends Field<string | T> {
|
|
18
19
|
/**
|
|
19
20
|
* Pixel size of input border radius.
|
|
20
21
|
* Should match blocklyText's border-radius in CSS.
|
|
@@ -48,9 +49,6 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
48
49
|
SERIALIZABLE: boolean;
|
|
49
50
|
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
50
51
|
CURSOR: string;
|
|
51
|
-
clickTarget_: any;
|
|
52
|
-
value_: any;
|
|
53
|
-
isDirty_: any;
|
|
54
52
|
/**
|
|
55
53
|
* @param opt_value The initial value of the field. Should cast to a string.
|
|
56
54
|
* Defaults to an empty string if null or undefined. Also accepts
|
|
@@ -69,13 +67,6 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
69
67
|
protected configure_(config: FieldInputConfig): void;
|
|
70
68
|
/** @internal */
|
|
71
69
|
initView(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Ensure that the input value casts to a valid string.
|
|
74
|
-
*
|
|
75
|
-
* @param opt_newValue The input value.
|
|
76
|
-
* @returns A valid string, or null if invalid.
|
|
77
|
-
*/
|
|
78
|
-
protected doClassValidation_(opt_newValue?: any): any;
|
|
79
70
|
/**
|
|
80
71
|
* Called by setValue if the text input is not valid. If the field is
|
|
81
72
|
* currently being edited it reverts value of the field to the previous
|
|
@@ -94,7 +85,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
94
85
|
* @param newValue The value to be saved. The default validator guarantees
|
|
95
86
|
* that this is a string.
|
|
96
87
|
*/
|
|
97
|
-
protected doValueUpdate_(newValue:
|
|
88
|
+
protected doValueUpdate_(newValue: string | T): void;
|
|
98
89
|
/**
|
|
99
90
|
* Updates text field to match the colour/style of the block.
|
|
100
91
|
*
|
|
@@ -166,7 +157,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<T>
|
|
|
166
157
|
*
|
|
167
158
|
* @param e Keyboard event.
|
|
168
159
|
*/
|
|
169
|
-
protected onHtmlInputKeyDown_(e:
|
|
160
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
170
161
|
/**
|
|
171
162
|
* Handle a change to the editor.
|
|
172
163
|
*
|
|
@@ -94,7 +94,7 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
94
94
|
* @param newValue The value to be saved. The default validator guarantees
|
|
95
95
|
* that this is a string.
|
|
96
96
|
*/
|
|
97
|
-
protected doValueUpdate_(newValue:
|
|
97
|
+
protected doValueUpdate_(newValue: string): void;
|
|
98
98
|
/** Updates the text of the textElement. */
|
|
99
99
|
protected render_(): void;
|
|
100
100
|
/** Updates the size of the field based on the text. */
|
|
@@ -135,7 +135,7 @@ export declare class FieldMultilineInput extends FieldTextInput {
|
|
|
135
135
|
*
|
|
136
136
|
* @param e Keyboard event.
|
|
137
137
|
*/
|
|
138
|
-
protected onHtmlInputKeyDown_(e:
|
|
138
|
+
protected onHtmlInputKeyDown_(e: KeyboardEvent): void;
|
|
139
139
|
/**
|
|
140
140
|
* Construct a FieldMultilineInput from a JSON arg object,
|
|
141
141
|
* dereferencing any string table references.
|
|
@@ -7,6 +7,11 @@ import './events/events_block_change.js';
|
|
|
7
7
|
import { FieldInput, FieldInputConfig, FieldInputValidator } from './field_input.js';
|
|
8
8
|
import type { Sentinel } from './utils/sentinel.js';
|
|
9
9
|
export type FieldTextInputValidator = FieldInputValidator<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Class for an editable text field.
|
|
12
|
+
*
|
|
13
|
+
* @alias Blockly.FieldTextInput
|
|
14
|
+
*/
|
|
10
15
|
export declare class FieldTextInput extends FieldInput<string> {
|
|
11
16
|
/**
|
|
12
17
|
* @param opt_value The initial value of the field. Should cast to a string.
|
|
@@ -23,6 +28,13 @@ export declare class FieldTextInput extends FieldInput<string> {
|
|
|
23
28
|
* for a list of properties this parameter supports.
|
|
24
29
|
*/
|
|
25
30
|
constructor(opt_value?: string | Sentinel, opt_validator?: FieldTextInputValidator | null, opt_config?: FieldInputConfig);
|
|
31
|
+
/**
|
|
32
|
+
* Ensure that the input value casts to a valid string.
|
|
33
|
+
*
|
|
34
|
+
* @param opt_newValue The input value.
|
|
35
|
+
* @returns A valid string, or null if invalid.
|
|
36
|
+
*/
|
|
37
|
+
protected doClassValidation_(opt_newValue?: any): string | null;
|
|
26
38
|
/**
|
|
27
39
|
* Construct a FieldTextInput from a JSON arg object,
|
|
28
40
|
* dereferencing any string table references.
|
package/core/field_variable.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
139
139
|
*
|
|
140
140
|
* @returns Validation function, or null.
|
|
141
141
|
*/
|
|
142
|
-
getValidator():
|
|
142
|
+
getValidator(): FieldVariableValidator | null;
|
|
143
143
|
/**
|
|
144
144
|
* Ensure that the ID belongs to a valid variable of an allowed type.
|
|
145
145
|
*
|
|
@@ -155,7 +155,7 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
155
155
|
*
|
|
156
156
|
* @param newId The value to be saved.
|
|
157
157
|
*/
|
|
158
|
-
protected doValueUpdate_(newId:
|
|
158
|
+
protected doValueUpdate_(newId: string): void;
|
|
159
159
|
/**
|
|
160
160
|
* Check whether the given variable type is allowed on this field.
|
|
161
161
|
*
|
package/core/gesture.d.ts
CHANGED
|
@@ -360,7 +360,7 @@ export declare class Gesture {
|
|
|
360
360
|
* @param field The field the gesture started on.
|
|
361
361
|
* @internal
|
|
362
362
|
*/
|
|
363
|
-
setStartField(field: Field): void;
|
|
363
|
+
setStartField<T>(field: Field<T>): void;
|
|
364
364
|
/**
|
|
365
365
|
* Record the bubble that a gesture started on
|
|
366
366
|
*
|
|
@@ -12,7 +12,7 @@ import type { BlockSvg } from '../block_svg.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export interface IBlockDragger {
|
|
14
14
|
/**
|
|
15
|
-
* Start dragging a block.
|
|
15
|
+
* Start dragging a block.
|
|
16
16
|
*
|
|
17
17
|
* @param currentDragDeltaXY How far the pointer has moved from the position
|
|
18
18
|
* at mouse down, in pixel units.
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Coordinate } from '../utils/coordinate.js';
|
|
7
|
-
import type { BlockDragSurfaceSvg } from '../block_drag_surface.js';
|
|
8
7
|
import type { IContextMenu } from './i_contextmenu.js';
|
|
9
8
|
import type { IDraggable } from './i_draggable.js';
|
|
10
9
|
/**
|
|
@@ -41,14 +40,11 @@ export interface IBubble extends IDraggable, IContextMenu {
|
|
|
41
40
|
*/
|
|
42
41
|
setDragging(dragging: boolean): void;
|
|
43
42
|
/**
|
|
44
|
-
* Move this bubble during a drag
|
|
45
|
-
* a drag surface.
|
|
43
|
+
* Move this bubble during a drag.
|
|
46
44
|
*
|
|
47
|
-
* @param dragSurface The surface that carries rendered items during a drag,
|
|
48
|
-
* or null if no drag surface is in use.
|
|
49
45
|
* @param newLoc The location to translate to, in workspace coordinates.
|
|
50
46
|
*/
|
|
51
|
-
moveDuringDrag(
|
|
47
|
+
moveDuringDrag(newLoc: Coordinate): void;
|
|
52
48
|
/**
|
|
53
49
|
* Move the bubble to the specified location in workspace coordinates.
|
|
54
50
|
*
|
|
@@ -34,11 +34,14 @@ export interface IMetricsManager {
|
|
|
34
34
|
*/
|
|
35
35
|
getScrollMetrics(opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion, opt_contentMetrics?: ContainerRegion): ContainerRegion;
|
|
36
36
|
/**
|
|
37
|
-
* Gets the width and the height of the flyout
|
|
38
|
-
* coordinates.
|
|
39
|
-
*
|
|
37
|
+
* Gets the width and the height of the flyout in pixel
|
|
38
|
+
* coordinates. By default, will get metrics for either a simple flyout (owned
|
|
39
|
+
* directly by the workspace) or for the flyout owned by the toolbox. If you
|
|
40
|
+
* pass `opt_own` as `true` then only metrics for the simple flyout will be
|
|
41
|
+
* returned, and it will return 0 for the width and height if the workspace
|
|
42
|
+
* has a category toolbox instead of a simple toolbox.
|
|
40
43
|
*
|
|
41
|
-
* @param opt_own Whether to only return the workspace's own flyout.
|
|
44
|
+
* @param opt_own Whether to only return the workspace's own flyout metrics.
|
|
42
45
|
* @returns The width and height of the flyout.
|
|
43
46
|
*/
|
|
44
47
|
getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics;
|
|
@@ -46,8 +49,7 @@ export interface IMetricsManager {
|
|
|
46
49
|
* Gets the width, height and position of the toolbox on the workspace in
|
|
47
50
|
* pixel coordinates. Returns 0 for the width and height if the workspace has
|
|
48
51
|
* a simple toolbox instead of a category toolbox. To get the width and height
|
|
49
|
-
* of a
|
|
50
|
-
* simple toolbox @see {@link IMetricsManager#getFlyoutMetrics}.
|
|
52
|
+
* of a simple toolbox, see {@link IMetricsManager#getFlyoutMetrics}.
|
|
51
53
|
*
|
|
52
54
|
* @returns The object with the width, height and position of the toolbox.
|
|
53
55
|
*/
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Block } from '../block.js';
|
|
7
|
+
import { IProcedureModel } from './i_procedure_model.js';
|
|
7
8
|
/** The interface for a block which models a procedure. */
|
|
8
9
|
export interface IProcedureBlock {
|
|
10
|
+
getProcedureModel(): IProcedureModel;
|
|
9
11
|
doProcedureUpdate(): void;
|
|
12
|
+
isProcedureDef(): boolean;
|
|
10
13
|
}
|
|
11
14
|
/** A type guard which checks if the given block is a procedure block. */
|
|
12
15
|
export declare function isProcedureBlock(block: Block | IProcedureBlock): block is IProcedureBlock;
|
|
@@ -30,11 +30,14 @@ export declare class MetricsManager implements IMetricsManager {
|
|
|
30
30
|
*/
|
|
31
31
|
protected getDimensionsPx_(elem: IToolbox | null | IFlyout): Size;
|
|
32
32
|
/**
|
|
33
|
-
* Gets the width and the height of the flyout
|
|
34
|
-
* coordinates.
|
|
35
|
-
*
|
|
33
|
+
* Gets the width and the height of the flyout in pixel
|
|
34
|
+
* coordinates. By default, will get metrics for either a simple flyout (owned
|
|
35
|
+
* directly by the workspace) or for the flyout owned by the toolbox. If you
|
|
36
|
+
* pass `opt_own` as `true` then only metrics for the simple flyout will be
|
|
37
|
+
* returned, and it will return 0 for the width and height if the workspace
|
|
38
|
+
* has a category toolbox instead of a simple toolbox.
|
|
36
39
|
*
|
|
37
|
-
* @param opt_own Whether to only return the workspace's own flyout.
|
|
40
|
+
* @param opt_own Whether to only return the workspace's own flyout metrics.
|
|
38
41
|
* @returns The width and height of the flyout.
|
|
39
42
|
*/
|
|
40
43
|
getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics;
|
|
@@ -42,8 +45,7 @@ export declare class MetricsManager implements IMetricsManager {
|
|
|
42
45
|
* Gets the width, height and position of the toolbox on the workspace in
|
|
43
46
|
* pixel coordinates. Returns 0 for the width and height if the workspace has
|
|
44
47
|
* a simple toolbox instead of a category toolbox. To get the width and height
|
|
45
|
-
* of a
|
|
46
|
-
* simple toolbox @see {@link MetricsManager#getFlyoutMetrics}.
|
|
48
|
+
* of a simple toolbox, see {@link MetricsManager#getFlyoutMetrics}.
|
|
47
49
|
*
|
|
48
50
|
* @returns The object with the width, height and position of the toolbox.
|
|
49
51
|
*/
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { IProcedureMap } from '
|
|
7
|
-
import type { IProcedureModel } from '
|
|
8
|
-
import type { Workspace } from '../workspace.js';
|
|
6
|
+
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
7
|
+
import type { IProcedureModel } from './interfaces/i_procedure_model.js';
|
|
9
8
|
export declare class ObservableProcedureMap extends Map<string, IProcedureModel> implements IProcedureMap {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
9
|
+
/** @internal */
|
|
10
|
+
constructor();
|
|
12
11
|
/**
|
|
13
12
|
* Adds the given procedure model to the procedure map.
|
|
14
13
|
*/
|
package/core/procedures.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ import './events/events_block_change.js';
|
|
|
7
7
|
import type { Block } from './block.js';
|
|
8
8
|
import type { Abstract } from './events/events_abstract.js';
|
|
9
9
|
import { Field } from './field.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { IParameterModel } from './interfaces/i_parameter_model.js';
|
|
11
|
+
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
12
|
+
import { IProcedureModel } from './interfaces/i_procedure_model.js';
|
|
13
|
+
import { IProcedureBlock, isProcedureBlock } from './interfaces/i_procedure_block.js';
|
|
14
|
+
import { ObservableProcedureMap } from './observable_procedure_map.js';
|
|
13
15
|
import type { Workspace } from './workspace.js';
|
|
14
16
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
15
17
|
/**
|
|
@@ -125,5 +127,5 @@ export declare function mutateCallers(defBlock: Block): void;
|
|
|
125
127
|
* @alias Blockly.Procedures.getDefinition
|
|
126
128
|
*/
|
|
127
129
|
export declare function getDefinition(name: string, workspace: Workspace): Block | null;
|
|
128
|
-
export { ObservableProcedureMap,
|
|
130
|
+
export { ObservableProcedureMap, IParameterModel, IProcedureBlock, isProcedureBlock, IProcedureMap, IProcedureModel, };
|
|
129
131
|
//# sourceMappingURL=procedures.d.ts.map
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
import { IParameterModel } from '../interfaces/i_parameter_model.js';
|
|
7
7
|
import { IProcedureModel } from '../interfaces/i_procedure_model.js';
|
|
8
8
|
import type { ISerializer } from '../interfaces/i_serializer.js';
|
|
9
|
-
import { ObservableProcedureModel } from '../procedures/observable_procedure_model.js';
|
|
10
|
-
import { ObservableParameterModel } from '../procedures/observable_parameter_model.js';
|
|
11
9
|
import type { Workspace } from '../workspace.js';
|
|
12
10
|
/**
|
|
13
11
|
* Representation of a procedure data model.
|
|
@@ -93,10 +91,5 @@ export declare class ProcedureSerializer<ProcedureModel extends IProcedureModel,
|
|
|
93
91
|
/** Disposes of any procedure models that exist on the workspace. */
|
|
94
92
|
clear(workspace: Workspace): void;
|
|
95
93
|
}
|
|
96
|
-
/**
|
|
97
|
-
* A ProcedureSerializer that deserializes to create the built-in
|
|
98
|
-
* ObservableProcedureModels and ObservableParameterModels.
|
|
99
|
-
*/
|
|
100
|
-
export declare const observableProcedureSerializer: ProcedureSerializer<ObservableProcedureModel, ObservableParameterModel>;
|
|
101
94
|
export {};
|
|
102
95
|
//# sourceMappingURL=procedures.d.ts.map
|
package/core/utils/sentinel.d.ts
CHANGED