blockly 11.0.0-beta.5 → 11.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +570 -623
- package/blockly_compressed.js +529 -545
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +27 -29
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +10 -3
- package/core/block_dragger.d.ts +10 -10
- package/core/block_svg.d.ts +5 -32
- package/core/blockly.d.ts +3 -38
- package/core/clipboard.d.ts +0 -19
- package/core/comments/comment_view.d.ts +201 -0
- package/core/comments/rendered_workspace_comment.d.ts +42 -0
- package/core/comments/workspace_comment.d.ts +101 -0
- package/core/comments.d.ts +9 -0
- package/core/events/events_click.d.ts +1 -1
- package/core/field_dropdown.d.ts +1 -0
- package/core/field_image.d.ts +1 -1
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +2 -0
- package/core/grid.d.ts +9 -9
- package/core/icons/comment_icon.d.ts +3 -3
- package/core/icons/icon.d.ts +0 -6
- package/core/icons/icon_types.d.ts +2 -2
- package/core/icons/mutator_icon.d.ts +1 -16
- package/core/icons/warning_icon.d.ts +1 -1
- package/core/inputs/input.d.ts +10 -19
- package/core/{connection_previewers/insertion_marker_previewer.d.ts → insertion_marker_previewer.d.ts} +3 -3
- package/core/interfaces/i_comment_icon.d.ts +17 -0
- package/core/interfaces/i_has_bubble.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +7 -0
- package/core/interfaces/i_procedure_model.d.ts +7 -0
- package/core/options.d.ts +1 -0
- package/core/renderers/common/drawer.d.ts +0 -7
- package/core/renderers/measurables/icon.d.ts +0 -5
- package/core/serialization/priorities.d.ts +2 -0
- package/core/serialization/procedures.d.ts +28 -26
- package/core/serialization/workspace_comments.d.ts +45 -0
- package/core/serialization.d.ts +2 -1
- package/core/utils/dom.d.ts +0 -9
- package/core/utils/keycodes.d.ts +32 -32
- package/core/utils/size.d.ts +10 -0
- package/core/utils/string.d.ts +0 -10
- package/core/workspace_svg.d.ts +0 -27
- package/core/xml.d.ts +4 -3
- package/core-node.js +31 -0
- package/dart.d.ts +1 -24
- package/dart_compressed.js +18 -68
- package/dart_compressed.js.map +1 -1
- package/generators/dart/dart_generator.d.ts +17 -17
- package/generators/dart/text.d.ts +0 -1
- package/generators/javascript/javascript_generator.d.ts +34 -35
- package/generators/javascript/text.d.ts +0 -1
- package/generators/lua/lua_generator.d.ts +10 -10
- package/generators/lua/text.d.ts +0 -1
- package/generators/php/php_generator.d.ts +36 -36
- package/generators/php/text.d.ts +0 -1
- package/generators/python/python_generator.d.ts +20 -21
- package/generators/python/text.d.ts +0 -1
- package/index.js +19 -7
- package/javascript.d.ts +1 -41
- package/javascript_compressed.js +14 -49
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +1 -18
- package/lua_compressed.js +18 -40
- package/lua_compressed.js.map +1 -1
- package/media/arrow-dropdown.svg +1 -0
- package/media/resize-handle.svg +3 -0
- package/msg/ce.d.ts +8 -0
- package/msg/dtp.d.ts +8 -0
- package/msg/hsb.d.ts +8 -0
- package/msg/tdd.d.ts +8 -0
- package/package.json +45 -11
- package/php.d.ts +1 -43
- package/php_compressed.js +10 -43
- package/php_compressed.js.map +1 -1
- package/python.d.ts +1 -27
- package/python_compressed.js +18 -37
- package/python_compressed.js.map +1 -1
- package/blockly.js +0 -22
- package/blocks.js +0 -22
- package/browser.js +0 -30
- package/core/field_angle.d.ts +0 -208
- package/core/field_colour.d.ts +0 -243
- package/core/field_multilineinput.d.ts +0 -182
- package/core/renderers/minimalist/constants.d.ts +0 -21
- package/core/renderers/minimalist/drawer.d.ts +0 -26
- package/core/renderers/minimalist/info.d.ts +0 -35
- package/core/renderers/minimalist/minimalist.d.ts +0 -12
- package/core/renderers/minimalist/renderer.d.ts +0 -48
- package/core-browser.js +0 -26
- package/core.js +0 -26
- package/dart.js +0 -22
- package/generators/dart/colour.d.ts +0 -16
- package/generators/javascript/colour.d.ts +0 -16
- package/generators/lua/colour.d.ts +0 -16
- package/generators/php/colour.d.ts +0 -16
- package/generators/python/colour.d.ts +0 -16
- package/javascript.js +0 -23
- package/lua.js +0 -22
- package/msg/constants.d.ts +0 -14
- package/msg/qqq.d.ts +0 -14
- package/msg/synonyms.d.ts +0 -14
- package/node.js +0 -21
- package/php.js +0 -22
- package/python.js +0 -23
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export { CommentView } from './comments/comment_view.js';
|
|
7
|
+
export { WorkspaceComment } from './comments/workspace_comment.js';
|
|
8
|
+
export { RenderedWorkspaceComment } from './comments/rendered_workspace_comment.js';
|
|
9
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -13,7 +13,7 @@ import { AbstractEventJson } from './events_abstract.js';
|
|
|
13
13
|
import { UiBase } from './events_ui_base.js';
|
|
14
14
|
import { Workspace } from '../workspace.js';
|
|
15
15
|
/**
|
|
16
|
-
* Notifies listeners that
|
|
16
|
+
* Notifies listeners that some blockly element was clicked.
|
|
17
17
|
*/
|
|
18
18
|
export declare class Click extends UiBase {
|
|
19
19
|
/** The ID of the block that was clicked, if a block was clicked. */
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
148
148
|
* @param newValue The input value.
|
|
149
149
|
* @returns A valid language-neutral option, or null if invalid.
|
|
150
150
|
*/
|
|
151
|
+
protected doClassValidation_(newValue: string): string | null | undefined;
|
|
151
152
|
protected doClassValidation_(newValue?: string): string | null;
|
|
152
153
|
/**
|
|
153
154
|
* Update the value of this dropdown field.
|
package/core/field_image.d.ts
CHANGED
|
@@ -134,7 +134,7 @@ export interface FieldImageConfig extends FieldConfig {
|
|
|
134
134
|
alt?: string;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* fromJson config options for the
|
|
137
|
+
* fromJson config options for the image field.
|
|
138
138
|
*/
|
|
139
139
|
export interface FieldImageFromJsonConfig extends FieldImageConfig {
|
|
140
140
|
src?: string;
|
package/core/generator.d.ts
CHANGED
|
@@ -254,7 +254,7 @@ export declare class CodeGenerator {
|
|
|
254
254
|
* @param _opt_thisOnly True to generate code for only this statement.
|
|
255
255
|
* @returns Code with comments and subsequent blocks added.
|
|
256
256
|
*/
|
|
257
|
-
|
|
257
|
+
scrub_(_block: Block, code: string, _opt_thisOnly?: boolean): string;
|
|
258
258
|
/**
|
|
259
259
|
* Hook for code to run at end of code generation.
|
|
260
260
|
* Subclasses may override this, e.g. to prepend the generated code with
|
package/core/gesture.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ export declare class Gesture {
|
|
|
86
86
|
* is in progress.
|
|
87
87
|
*/
|
|
88
88
|
private workspaceDragger;
|
|
89
|
+
/** Whether the gesture is dragging or not. */
|
|
90
|
+
private dragging;
|
|
89
91
|
/** The flyout a gesture started in, if any. */
|
|
90
92
|
private flyout;
|
|
91
93
|
/** Boolean for sanity-checking that some code is only called once. */
|
package/core/grid.d.ts
CHANGED
|
@@ -31,8 +31,16 @@ export declare class Grid {
|
|
|
31
31
|
* dropped it will snap to the grid if snapping to the grid is enabled.
|
|
32
32
|
*/
|
|
33
33
|
setSpacing(spacing: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get the spacing of the grid points (in px).
|
|
36
|
+
*
|
|
37
|
+
* @returns The spacing of the grid points.
|
|
38
|
+
*/
|
|
39
|
+
getSpacing(): number;
|
|
34
40
|
/** Sets the length of the grid lines. */
|
|
35
41
|
setLength(length: number): void;
|
|
42
|
+
/** Get the length of the grid lines (in px). */
|
|
43
|
+
getLength(): number;
|
|
36
44
|
/**
|
|
37
45
|
* Sets whether blocks should snap to the grid or not.
|
|
38
46
|
*
|
|
@@ -43,19 +51,11 @@ export declare class Grid {
|
|
|
43
51
|
*/
|
|
44
52
|
setSnapToGrid(snap: boolean): void;
|
|
45
53
|
/**
|
|
46
|
-
* Whether blocks should snap to the grid
|
|
54
|
+
* Whether blocks should snap to the grid.
|
|
47
55
|
*
|
|
48
56
|
* @returns True if blocks should snap, false otherwise.
|
|
49
|
-
* @internal
|
|
50
57
|
*/
|
|
51
58
|
shouldSnap(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get the spacing of the grid points (in px).
|
|
54
|
-
*
|
|
55
|
-
* @returns The spacing of the grid points.
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
getSpacing(): number;
|
|
59
59
|
/**
|
|
60
60
|
* Get the ID of the pattern element, which should be randomized to avoid
|
|
61
61
|
* conflicts with other Blockly instances on the page.
|
|
@@ -16,7 +16,7 @@ import { Size } from '../utils/size.js';
|
|
|
16
16
|
export declare class CommentIcon extends Icon implements IHasBubble, ISerializable {
|
|
17
17
|
protected readonly sourceBlock: Block;
|
|
18
18
|
/** The type string used to identify this icon. */
|
|
19
|
-
static readonly TYPE: IconType<
|
|
19
|
+
static readonly TYPE: IconType<import("../interfaces/i_comment_icon.js").ICommentIcon>;
|
|
20
20
|
/**
|
|
21
21
|
* The weight this icon has relative to other icons. Icons with more positive
|
|
22
22
|
* weight values are rendered farther toward the end of the block.
|
|
@@ -49,7 +49,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
49
49
|
* Updates the state of the bubble (editable / noneditable) to reflect the
|
|
50
50
|
* state of the bubble if the bubble is currently shown.
|
|
51
51
|
*/
|
|
52
|
-
updateEditable(): void
|
|
52
|
+
updateEditable(): Promise<void>;
|
|
53
53
|
onLocationChange(blockOrigin: Coordinate): void;
|
|
54
54
|
/** Sets the text of this comment. Updates any bubbles if they are visible. */
|
|
55
55
|
setText(text: string): void;
|
|
@@ -82,7 +82,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
82
82
|
*/
|
|
83
83
|
onSizeChange(): void;
|
|
84
84
|
bubbleIsVisible(): boolean;
|
|
85
|
-
setBubbleVisible(visible: boolean): void
|
|
85
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
86
86
|
/**
|
|
87
87
|
* Shows the editable text bubble for this comment, and adds change listeners
|
|
88
88
|
* to update the state of this icon in response to changes in the bubble.
|
package/core/icons/icon.d.ts
CHANGED
|
@@ -59,11 +59,5 @@ export declare abstract class Icon implements IIcon {
|
|
|
59
59
|
* @returns Whether the icon should be clickable while the block is in a flyout.
|
|
60
60
|
*/
|
|
61
61
|
isClickableInFlyout(autoClosingFlyout: boolean): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Sets the visibility of the icon's bubble if one exists.
|
|
64
|
-
*
|
|
65
|
-
* @deprecated Use `setBubbleVisible` instead. To be removed in v11.
|
|
66
|
-
*/
|
|
67
|
-
setVisible(visibility: boolean): void;
|
|
68
62
|
}
|
|
69
63
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ICommentIcon } from '../interfaces/i_comment_icon.js';
|
|
6
7
|
import { IIcon } from '../interfaces/i_icon.js';
|
|
7
|
-
import { CommentIcon } from './comment_icon.js';
|
|
8
8
|
import { MutatorIcon } from './mutator_icon.js';
|
|
9
9
|
import { WarningIcon } from './warning_icon.js';
|
|
10
10
|
/**
|
|
@@ -20,6 +20,6 @@ export declare class IconType<_T extends IIcon> {
|
|
|
20
20
|
equals(type: IconType<IIcon>): boolean;
|
|
21
21
|
static MUTATOR: IconType<MutatorIcon>;
|
|
22
22
|
static WARNING: IconType<WarningIcon>;
|
|
23
|
-
static COMMENT: IconType<
|
|
23
|
+
static COMMENT: IconType<ICommentIcon>;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=icon_types.d.ts.map
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Abstract } from '../events/events_abstract.js';
|
|
7
|
-
import type { Block } from '../block.js';
|
|
8
7
|
import type { BlockSvg } from '../block_svg.js';
|
|
9
|
-
import type { Connection } from '../connection.js';
|
|
10
8
|
import { Coordinate } from '../utils/coordinate.js';
|
|
11
9
|
import type { IHasBubble } from '../interfaces/i_has_bubble.js';
|
|
12
10
|
import { Icon } from './icon.js';
|
|
@@ -55,7 +53,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
|
|
|
55
53
|
onClick(): void;
|
|
56
54
|
isClickableInFlyout(): boolean;
|
|
57
55
|
bubbleIsVisible(): boolean;
|
|
58
|
-
setBubbleVisible(visible: boolean): void
|
|
56
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
59
57
|
/** @returns the configuration the mini workspace should have. */
|
|
60
58
|
private getMiniWorkspaceConfig;
|
|
61
59
|
/**
|
|
@@ -91,18 +89,5 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
|
|
|
91
89
|
* currently open.
|
|
92
90
|
*/
|
|
93
91
|
getWorkspace(): WorkspaceSvg | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Reconnects the given connection to the mutated input on the given block.
|
|
96
|
-
*
|
|
97
|
-
* @deprecated Use connection.reconnect instead. To be removed in v11.
|
|
98
|
-
*/
|
|
99
|
-
static reconnect(connectionChild: Connection | null, block: Block, inputName: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the parent workspace of a workspace that is inside a mini workspace
|
|
102
|
-
* bubble, taking into account whether the workspace is a flyout.
|
|
103
|
-
*
|
|
104
|
-
* @deprecated Use workspace.getRootWorkspace. To be removed in v11.
|
|
105
|
-
*/
|
|
106
|
-
static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg | null;
|
|
107
92
|
}
|
|
108
93
|
//# sourceMappingURL=mutator_icon.d.ts.map
|
|
@@ -59,7 +59,7 @@ export declare class WarningIcon extends Icon implements IHasBubble {
|
|
|
59
59
|
onClick(): void;
|
|
60
60
|
isClickableInFlyout(): boolean;
|
|
61
61
|
bubbleIsVisible(): boolean;
|
|
62
|
-
setBubbleVisible(visible: boolean): void
|
|
62
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
63
63
|
/**
|
|
64
64
|
* @returns the location the bubble should be anchored to.
|
|
65
65
|
* I.E. the middle of this icon.
|
package/core/inputs/input.d.ts
CHANGED
|
@@ -15,13 +15,14 @@ import type { Connection } from '../connection.js';
|
|
|
15
15
|
import type { ConnectionType } from '../connection_type.js';
|
|
16
16
|
import type { Field } from '../field.js';
|
|
17
17
|
import { inputTypes } from './input_types.js';
|
|
18
|
+
import { Align } from './align.js';
|
|
18
19
|
/** Class for an input with optional fields. */
|
|
19
20
|
export declare class Input {
|
|
20
21
|
name: string;
|
|
21
22
|
private sourceBlock;
|
|
22
23
|
fieldRow: Field[];
|
|
23
24
|
/** Alignment of input's fields (left, right or centre). */
|
|
24
|
-
align:
|
|
25
|
+
align: Align;
|
|
25
26
|
/** Is the input visible? */
|
|
26
27
|
private visible;
|
|
27
28
|
readonly type: inputTypes;
|
|
@@ -121,6 +122,14 @@ export declare class Input {
|
|
|
121
122
|
getShadowDom(): Element | null;
|
|
122
123
|
/** Initialize the fields on this input. */
|
|
123
124
|
init(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Initializes the fields on this input for a headless block.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
initModel(): void;
|
|
131
|
+
/** Initializes the given field. */
|
|
132
|
+
private initField;
|
|
124
133
|
/**
|
|
125
134
|
* Sever all links to this input.
|
|
126
135
|
*/
|
|
@@ -135,22 +144,4 @@ export declare class Input {
|
|
|
135
144
|
*/
|
|
136
145
|
protected makeConnection(type: ConnectionType): Connection;
|
|
137
146
|
}
|
|
138
|
-
export declare namespace Input {
|
|
139
|
-
/**
|
|
140
|
-
* Enum for alignment of inputs.
|
|
141
|
-
*
|
|
142
|
-
* @deprecated Use Blockly.inputs.Align. To be removed in v11.
|
|
143
|
-
*/
|
|
144
|
-
enum Align {
|
|
145
|
-
LEFT = -1,
|
|
146
|
-
CENTRE = 0,
|
|
147
|
-
RIGHT = 1
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
|
|
151
|
-
/** @suppress {deprecated} */
|
|
152
|
-
export type Align = Input.Align;
|
|
153
|
-
/** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
|
|
154
|
-
/** @suppress {deprecated} */
|
|
155
|
-
export declare const Align: typeof Input.Align;
|
|
156
147
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { BlockSvg } from '
|
|
7
|
-
import { IConnectionPreviewer } from '
|
|
8
|
-
import { RenderedConnection } from '
|
|
6
|
+
import { BlockSvg } from './block_svg.js';
|
|
7
|
+
import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
8
|
+
import { RenderedConnection } from './rendered_connection.js';
|
|
9
9
|
export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
10
10
|
private readonly workspace;
|
|
11
11
|
private fadedBlock;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IIcon } from './i_icon.js';
|
|
7
|
+
import { Size } from '../utils/size.js';
|
|
8
|
+
import { IHasBubble } from './i_has_bubble.js';
|
|
9
|
+
export interface ICommentIcon extends IIcon, IHasBubble {
|
|
10
|
+
setText(text: string): void;
|
|
11
|
+
getText(): string;
|
|
12
|
+
setBubbleSize(size: Size): void;
|
|
13
|
+
getBubbleSize(): Size;
|
|
14
|
+
}
|
|
15
|
+
/** Checks whether the given object is an ICommentIcon. */
|
|
16
|
+
export declare function isCommentIcon(obj: Object): obj is ICommentIcon;
|
|
17
|
+
//# sourceMappingURL=i_comment_icon.d.ts.map
|
|
@@ -7,7 +7,7 @@ export interface IHasBubble {
|
|
|
7
7
|
/** @returns True if the bubble is currently open, false otherwise. */
|
|
8
8
|
bubbleIsVisible(): boolean;
|
|
9
9
|
/** Sets whether the bubble is open or not. */
|
|
10
|
-
setBubbleVisible(visible: boolean): void
|
|
10
|
+
setBubbleVisible(visible: boolean): Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
/** Type guard that checks whether the given object is a IHasBubble. */
|
|
13
13
|
export declare function hasBubble(obj: any): obj is IHasBubble;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ParameterState } from '../serialization/procedures';
|
|
6
7
|
import { IProcedureModel } from './i_procedure_model';
|
|
7
8
|
/**
|
|
8
9
|
* A data model for a procedure.
|
|
@@ -33,5 +34,11 @@ export interface IParameterModel {
|
|
|
33
34
|
getId(): string;
|
|
34
35
|
/** Sets the procedure model this parameter is associated with. */
|
|
35
36
|
setProcedureModel(model: IProcedureModel): this;
|
|
37
|
+
/**
|
|
38
|
+
* Serializes the state of the parameter to JSON.
|
|
39
|
+
*
|
|
40
|
+
* @returns JSON serializable state of the parameter.
|
|
41
|
+
*/
|
|
42
|
+
saveState(): ParameterState;
|
|
36
43
|
}
|
|
37
44
|
//# sourceMappingURL=i_parameter_model.d.ts.map
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { State } from '../serialization/procedures.js';
|
|
6
7
|
import { IParameterModel } from './i_parameter_model.js';
|
|
7
8
|
/**
|
|
8
9
|
* A data model for a procedure.
|
|
@@ -48,5 +49,11 @@ export interface IProcedureModel {
|
|
|
48
49
|
* disabled, all procedure caller blocks should be disabled as well.
|
|
49
50
|
*/
|
|
50
51
|
getEnabled(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Serializes the state of the procedure to JSON.
|
|
54
|
+
*
|
|
55
|
+
* @returns JSON serializable state of the procedure.
|
|
56
|
+
*/
|
|
57
|
+
saveState(): State;
|
|
51
58
|
}
|
|
52
59
|
//# sourceMappingURL=i_procedure_model.d.ts.map
|
package/core/options.d.ts
CHANGED
|
@@ -38,13 +38,6 @@ export declare class Drawer {
|
|
|
38
38
|
* required.
|
|
39
39
|
*/
|
|
40
40
|
draw(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Hide icons that were marked as hidden.
|
|
43
|
-
*
|
|
44
|
-
* @deprecated Manually hiding icons is no longer necessary. To be removed
|
|
45
|
-
* in v11.
|
|
46
|
-
*/
|
|
47
|
-
protected hideHiddenIcons_(): void;
|
|
48
41
|
/**
|
|
49
42
|
* Save sizing information back to the block
|
|
50
43
|
* Most of the rendering information can be thrown away at the end of the
|
|
@@ -12,11 +12,6 @@ import { Measurable } from './base.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class Icon extends Measurable {
|
|
14
14
|
icon: BlocklyIcon;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Will be removed in v11. Create a subclass of the Icon
|
|
17
|
-
* measurable if this data is necessary for you.
|
|
18
|
-
*/
|
|
19
|
-
isVisible: boolean;
|
|
20
15
|
flipRtl: boolean;
|
|
21
16
|
/**
|
|
22
17
|
* An object containing information about the space an icon takes up during
|
|
@@ -15,4 +15,6 @@ export declare const PROCEDURES = 75;
|
|
|
15
15
|
* The priority for deserializing blocks.
|
|
16
16
|
*/
|
|
17
17
|
export declare const BLOCKS = 50;
|
|
18
|
+
/** The priority for deserializing workspace comments. */
|
|
19
|
+
export declare const WORKSPACE_COMMENTS = 25;
|
|
18
20
|
//# sourceMappingURL=priorities.d.ts.map
|
|
@@ -7,63 +7,65 @@ 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
9
|
import type { Workspace } from '../workspace.js';
|
|
10
|
-
/**
|
|
11
|
-
* Representation of a procedure data model.
|
|
12
|
-
*/
|
|
10
|
+
/** Represents the state of a procedure model. */
|
|
13
11
|
export interface State {
|
|
14
12
|
id: string;
|
|
15
13
|
name: string;
|
|
16
14
|
returnTypes: string[] | null;
|
|
17
15
|
parameters?: ParameterState[];
|
|
16
|
+
[key: string]: unknown;
|
|
18
17
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Representation of a parameter data model.
|
|
21
|
-
*/
|
|
18
|
+
/** Represents the state of a parameter model. */
|
|
22
19
|
export interface ParameterState {
|
|
23
20
|
id: string;
|
|
24
21
|
name: string;
|
|
25
22
|
types?: string[];
|
|
23
|
+
[key: string]: unknown;
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* A newable signature for an IProcedureModel.
|
|
29
27
|
*
|
|
30
28
|
* Refer to
|
|
31
|
-
* https://www.typescriptlang.org/docs/handbook/
|
|
29
|
+
* https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
|
|
32
30
|
* for what is going on with this.
|
|
33
31
|
*/
|
|
34
|
-
|
|
32
|
+
interface ProcedureModelConstructor<ProcedureModel extends IProcedureModel> {
|
|
33
|
+
new (workspace: Workspace, name: string, id: string): ProcedureModel;
|
|
34
|
+
/**
|
|
35
|
+
* Deserializes the JSON state and returns a procedure model.
|
|
36
|
+
*
|
|
37
|
+
* @param state The state to deserialize.
|
|
38
|
+
* @param workspace The workspace to load the procedure model into.
|
|
39
|
+
* @returns The constructed procedure model.
|
|
40
|
+
*/
|
|
41
|
+
loadState(state: Object, workspace: Workspace): ProcedureModel;
|
|
42
|
+
}
|
|
35
43
|
/**
|
|
36
44
|
* A newable signature for an IParameterModel.
|
|
37
45
|
*
|
|
38
46
|
* Refer to
|
|
39
|
-
* https://www.typescriptlang.org/docs/handbook/
|
|
47
|
+
* https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
|
|
40
48
|
* for what is going on with this.
|
|
41
49
|
*/
|
|
42
|
-
|
|
50
|
+
interface ParameterModelConstructor<ParameterModel extends IParameterModel> {
|
|
51
|
+
new (workspace: Workspace, name: string, id: string): ParameterModel;
|
|
52
|
+
/**
|
|
53
|
+
* Deserializes the JSON state and returns a parameter model.
|
|
54
|
+
*
|
|
55
|
+
* @param state The state to deserialize.
|
|
56
|
+
* @param workspace The workspace to load the parameter model into.
|
|
57
|
+
* @returns The constructed parameter model.
|
|
58
|
+
*/
|
|
59
|
+
loadState(state: Object, workspace: Workspace): ParameterModel;
|
|
60
|
+
}
|
|
43
61
|
/**
|
|
44
62
|
* Serializes the given IProcedureModel to JSON.
|
|
45
|
-
*
|
|
46
|
-
* @internal
|
|
47
63
|
*/
|
|
48
64
|
export declare function saveProcedure(proc: IProcedureModel): State;
|
|
49
|
-
/**
|
|
50
|
-
* Serializes the given IParameterModel to JSON.
|
|
51
|
-
*
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
export declare function saveParameter(param: IParameterModel): ParameterState;
|
|
55
65
|
/**
|
|
56
66
|
* Deserializes the given procedure model State from JSON.
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
67
|
*/
|
|
60
68
|
export declare function loadProcedure<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel>(procedureModelClass: ProcedureModelConstructor<ProcedureModel>, parameterModelClass: ParameterModelConstructor<ParameterModel>, state: State, workspace: Workspace): ProcedureModel;
|
|
61
|
-
/**
|
|
62
|
-
* Deserializes the given ParameterState from JSON.
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
export declare function loadParameter<ParameterModel extends IParameterModel>(parameterModelClass: ParameterModelConstructor<ParameterModel>, state: ParameterState, workspace: Workspace): ParameterModel;
|
|
67
69
|
/** Serializer for saving and loading procedure state. */
|
|
68
70
|
export declare class ProcedureSerializer<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel> implements ISerializer {
|
|
69
71
|
private readonly procedureModelClass;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ISerializer } from '../interfaces/i_serializer.js';
|
|
7
|
+
import { Workspace } from '../workspace.js';
|
|
8
|
+
import { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
9
|
+
export interface State {
|
|
10
|
+
id?: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
x?: number;
|
|
13
|
+
y?: number;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
collapsed?: boolean;
|
|
17
|
+
editable?: boolean;
|
|
18
|
+
movable?: boolean;
|
|
19
|
+
deletable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Serializes the state of the given comment to JSON. */
|
|
22
|
+
export declare function save(comment: WorkspaceComment, { addCoordinates, saveIds, }?: {
|
|
23
|
+
addCoordinates?: boolean;
|
|
24
|
+
saveIds?: boolean;
|
|
25
|
+
}): State;
|
|
26
|
+
/** Appends the comment defined by the given state to the given workspace. */
|
|
27
|
+
export declare function append(state: State, workspace: Workspace, { recordUndo }?: {
|
|
28
|
+
recordUndo?: boolean;
|
|
29
|
+
}): WorkspaceComment;
|
|
30
|
+
/** Serializer for saving and loading workspace comment state. */
|
|
31
|
+
export declare class WorkspaceCommentSerializer implements ISerializer {
|
|
32
|
+
priority: number;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the state of all workspace comments in the given workspace.
|
|
35
|
+
*/
|
|
36
|
+
save(workspace: Workspace): State[] | null;
|
|
37
|
+
/**
|
|
38
|
+
* Deserializes the comments defined by the given state into the given
|
|
39
|
+
* workspace.
|
|
40
|
+
*/
|
|
41
|
+
load(state: State[], workspace: Workspace): void;
|
|
42
|
+
/** Disposes of any comments that exist on the given workspace. */
|
|
43
|
+
clear(workspace: Workspace): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=workspace_comments.d.ts.map
|
package/core/serialization.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import * as procedures from './serialization/procedures.js';
|
|
|
13
13
|
import * as registry from './serialization/registry.js';
|
|
14
14
|
import * as variables from './serialization/variables.js';
|
|
15
15
|
import * as workspaces from './serialization/workspaces.js';
|
|
16
|
+
import * as workspaceComments from './serialization/workspace_comments.js';
|
|
16
17
|
import { ISerializer } from './interfaces/i_serializer.js';
|
|
17
|
-
export { blocks, exceptions, priorities, procedures, registry, variables, workspaces, ISerializer, };
|
|
18
|
+
export { blocks, exceptions, priorities, procedures, registry, variables, workspaces, workspaceComments, ISerializer, };
|
|
18
19
|
//# sourceMappingURL=serialization.d.ts.map
|
package/core/utils/dom.d.ts
CHANGED
|
@@ -86,15 +86,6 @@ export declare function removeNode(node: Node | null): Node | null;
|
|
|
86
86
|
* @param refNode Existing element to precede new node.
|
|
87
87
|
*/
|
|
88
88
|
export declare function insertAfter(newNode: Element, refNode: Element): void;
|
|
89
|
-
/**
|
|
90
|
-
* Whether a node contains another node.
|
|
91
|
-
*
|
|
92
|
-
* @param parent The node that should contain the other node.
|
|
93
|
-
* @param descendant The node to test presence of.
|
|
94
|
-
* @returns Whether the parent node contains the descendant node.
|
|
95
|
-
* @deprecated Use native 'contains' DOM method.
|
|
96
|
-
*/
|
|
97
|
-
export declare function containsNode(parent: Node, descendant: Node): boolean;
|
|
98
89
|
/**
|
|
99
90
|
* Sets the CSS transform property on an element. This function sets the
|
|
100
91
|
* non-vendor-prefixed and vendor-prefixed versions for backwards compatibility
|
package/core/utils/keycodes.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare enum KeyCodes {
|
|
|
16
16
|
MAC_ENTER = 3,
|
|
17
17
|
BACKSPACE = 8,
|
|
18
18
|
TAB = 9,
|
|
19
|
-
NUM_CENTER = 12
|
|
19
|
+
NUM_CENTER = 12,// NUMLOCK on FF/Safari Mac
|
|
20
20
|
ENTER = 13,
|
|
21
21
|
SHIFT = 16,
|
|
22
22
|
CTRL = 17,
|
|
@@ -25,18 +25,18 @@ export declare enum KeyCodes {
|
|
|
25
25
|
CAPS_LOCK = 20,
|
|
26
26
|
ESC = 27,
|
|
27
27
|
SPACE = 32,
|
|
28
|
-
PAGE_UP = 33
|
|
29
|
-
PAGE_DOWN = 34
|
|
30
|
-
END = 35
|
|
31
|
-
HOME = 36
|
|
32
|
-
LEFT = 37
|
|
33
|
-
UP = 38
|
|
34
|
-
RIGHT = 39
|
|
35
|
-
DOWN = 40
|
|
36
|
-
PLUS_SIGN = 43
|
|
28
|
+
PAGE_UP = 33,// also NUM_NORTH_EAST
|
|
29
|
+
PAGE_DOWN = 34,// also NUM_SOUTH_EAST
|
|
30
|
+
END = 35,// also NUM_SOUTH_WEST
|
|
31
|
+
HOME = 36,// also NUM_NORTH_WEST
|
|
32
|
+
LEFT = 37,// also NUM_WEST
|
|
33
|
+
UP = 38,// also NUM_NORTH
|
|
34
|
+
RIGHT = 39,// also NUM_EAST
|
|
35
|
+
DOWN = 40,// also NUM_SOUTH
|
|
36
|
+
PLUS_SIGN = 43,// NOT numpad plus
|
|
37
37
|
PRINT_SCREEN = 44,
|
|
38
|
-
INSERT = 45
|
|
39
|
-
DELETE = 46
|
|
38
|
+
INSERT = 45,// also NUM_INSERT
|
|
39
|
+
DELETE = 46,// also NUM_DELETE
|
|
40
40
|
ZERO = 48,
|
|
41
41
|
ONE = 49,
|
|
42
42
|
TWO = 50,
|
|
@@ -47,11 +47,11 @@ export declare enum KeyCodes {
|
|
|
47
47
|
SEVEN = 55,
|
|
48
48
|
EIGHT = 56,
|
|
49
49
|
NINE = 57,
|
|
50
|
-
FF_SEMICOLON = 59
|
|
51
|
-
FF_EQUALS = 61
|
|
52
|
-
FF_DASH = 173
|
|
50
|
+
FF_SEMICOLON = 59,// Firefox (Gecko) fires this for semicolon instead of 186
|
|
51
|
+
FF_EQUALS = 61,// Firefox (Gecko) fires this for equals instead of 187
|
|
52
|
+
FF_DASH = 173,// Firefox (Gecko) fires this for dash instead of 189
|
|
53
53
|
FF_HASH = 163,
|
|
54
|
-
QUESTION_MARK = 63
|
|
54
|
+
QUESTION_MARK = 63,// needs localization
|
|
55
55
|
AT_SIGN = 64,
|
|
56
56
|
A = 65,
|
|
57
57
|
B = 66,
|
|
@@ -79,7 +79,7 @@ export declare enum KeyCodes {
|
|
|
79
79
|
X = 88,
|
|
80
80
|
Y = 89,
|
|
81
81
|
Z = 90,
|
|
82
|
-
META = 91
|
|
82
|
+
META = 91,// WIN_KEY_LEFT
|
|
83
83
|
WIN_KEY_RIGHT = 92,
|
|
84
84
|
CONTEXT_MENU = 93,
|
|
85
85
|
NUM_ZERO = 96,
|
|
@@ -113,22 +113,22 @@ export declare enum KeyCodes {
|
|
|
113
113
|
SCROLL_LOCK = 145,
|
|
114
114
|
FIRST_MEDIA_KEY = 166,
|
|
115
115
|
LAST_MEDIA_KEY = 183,
|
|
116
|
-
SEMICOLON = 186
|
|
117
|
-
DASH = 189
|
|
118
|
-
EQUALS = 187
|
|
119
|
-
COMMA = 188
|
|
120
|
-
PERIOD = 190
|
|
121
|
-
SLASH = 191
|
|
122
|
-
APOSTROPHE = 192
|
|
123
|
-
TILDE = 192
|
|
124
|
-
SINGLE_QUOTE = 222
|
|
125
|
-
OPEN_SQUARE_BRACKET = 219
|
|
126
|
-
BACKSLASH = 220
|
|
127
|
-
CLOSE_SQUARE_BRACKET = 221
|
|
116
|
+
SEMICOLON = 186,// needs localization
|
|
117
|
+
DASH = 189,// needs localization
|
|
118
|
+
EQUALS = 187,// needs localization
|
|
119
|
+
COMMA = 188,// needs localization
|
|
120
|
+
PERIOD = 190,// needs localization
|
|
121
|
+
SLASH = 191,// needs localization
|
|
122
|
+
APOSTROPHE = 192,// needs localization
|
|
123
|
+
TILDE = 192,// needs localization
|
|
124
|
+
SINGLE_QUOTE = 222,// needs localization
|
|
125
|
+
OPEN_SQUARE_BRACKET = 219,// needs localization
|
|
126
|
+
BACKSLASH = 220,// needs localization
|
|
127
|
+
CLOSE_SQUARE_BRACKET = 221,// needs localization
|
|
128
128
|
WIN_KEY = 224,
|
|
129
|
-
MAC_FF_META = 224
|
|
130
|
-
MAC_WK_CMD_LEFT = 91,
|
|
131
|
-
MAC_WK_CMD_RIGHT = 93,
|
|
129
|
+
MAC_FF_META = 224,// Firefox (Gecko) fires this for the meta key instead of 91
|
|
130
|
+
MAC_WK_CMD_LEFT = 91,// WebKit Left Command key fired, same as META
|
|
131
|
+
MAC_WK_CMD_RIGHT = 93,// WebKit Right Command key fired, different from META
|
|
132
132
|
WIN_IME = 229,
|
|
133
133
|
VK_NONAME = 252,
|
|
134
134
|
PHANTOM = 255
|