blockly 11.1.1 → 11.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +551 -525
- package/blockly.mjs +1 -0
- package/blockly_compressed.js +519 -493
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +32 -32
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +20 -14
- package/core/block_svg.d.ts +42 -9
- package/core/blockly.d.ts +11 -147
- package/core/blockly_options.d.ts +2 -2
- package/core/browser_events.d.ts +2 -2
- package/core/bubbles/bubble.d.ts +2 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +3 -3
- package/core/bubbles/text_bubble.d.ts +1 -1
- package/core/bubbles/textinput_bubble.d.ts +6 -1
- package/core/bubbles.d.ts +2 -2
- package/core/clipboard/workspace_comment_paster.d.ts +3 -3
- package/core/clipboard.d.ts +2 -2
- package/core/comments/comment_view.d.ts +10 -3
- package/core/comments/rendered_workspace_comment.d.ts +10 -10
- package/core/comments/workspace_comment.d.ts +2 -2
- package/core/comments.d.ts +1 -1
- package/core/component_manager.d.ts +8 -0
- package/core/connection.d.ts +3 -3
- package/core/dragging/block_drag_strategy.d.ts +3 -1
- package/core/dragging/bubble_drag_strategy.d.ts +3 -1
- package/core/dragging/comment_drag_strategy.d.ts +8 -1
- package/core/dragging/dragger.d.ts +2 -2
- package/core/dragging.d.ts +2 -2
- package/core/dropdowndiv.d.ts +3 -3
- package/core/events/events.d.ts +67 -127
- package/core/events/events_abstract.d.ts +0 -1
- package/core/events/events_block_change.d.ts +2 -1
- package/core/events/events_block_create.d.ts +3 -2
- package/core/events/events_block_delete.d.ts +3 -2
- package/core/events/events_block_drag.d.ts +3 -2
- package/core/events/events_block_field_intermediate_change.d.ts +2 -1
- package/core/events/events_block_move.d.ts +3 -2
- package/core/events/events_bubble_open.d.ts +4 -3
- package/core/events/events_click.d.ts +3 -2
- package/core/events/events_comment_base.d.ts +1 -1
- package/core/events/events_comment_change.d.ts +8 -2
- package/core/events/events_comment_collapse.d.ts +3 -2
- package/core/events/events_comment_create.d.ts +8 -2
- package/core/events/events_comment_delete.d.ts +8 -2
- package/core/events/events_comment_drag.d.ts +51 -0
- package/core/events/events_comment_move.d.ts +9 -3
- package/core/events/events_comment_resize.d.ts +68 -0
- package/core/events/events_marker_move.d.ts +2 -1
- package/core/events/events_selected.d.ts +3 -2
- package/core/events/events_theme_change.d.ts +3 -2
- package/core/events/events_toolbox_item_select.d.ts +3 -2
- package/core/events/events_trashcan_open.d.ts +3 -2
- package/core/events/events_var_base.d.ts +1 -1
- package/core/events/events_var_create.d.ts +3 -2
- package/core/events/events_var_delete.d.ts +3 -2
- package/core/events/events_var_rename.d.ts +3 -2
- package/core/events/events_viewport.d.ts +3 -2
- package/core/events/predicates.d.ts +90 -0
- package/core/events/type.d.ts +79 -0
- package/core/events/utils.d.ts +93 -125
- package/core/events/workspace_events.d.ts +2 -1
- package/core/extensions.d.ts +1 -1
- package/core/field.d.ts +1 -1
- package/core/field_dropdown.d.ts +34 -0
- package/core/field_input.d.ts +1 -1
- package/core/field_label.d.ts +6 -0
- package/core/flyout_base.d.ts +1 -1
- package/core/flyout_button.d.ts +6 -1
- package/core/generator.d.ts +3 -2
- package/core/gesture.d.ts +3 -3
- package/core/grid.d.ts +7 -1
- package/core/icons/comment_icon.d.ts +5 -6
- package/core/icons/icon.d.ts +1 -1
- package/core/icons/mutator_icon.d.ts +3 -3
- package/core/icons/warning_icon.d.ts +2 -2
- package/core/icons.d.ts +5 -5
- package/core/inputs/input.d.ts +1 -1
- package/core/inputs.d.ts +3 -3
- package/core/interfaces/i_ast_node_location_with_block.d.ts +1 -1
- package/core/interfaces/i_comment_icon.d.ts +2 -2
- package/core/interfaces/i_drag_target.d.ts +1 -1
- package/core/interfaces/i_flyout.d.ts +3 -3
- package/core/interfaces/i_legacy_procedure_blocks.d.ts +2 -2
- package/core/interfaces/i_metrics_manager.d.ts +2 -2
- package/core/interfaces/i_positionable.d.ts +1 -1
- package/core/interfaces/i_selectable.d.ts +1 -1
- package/core/interfaces/i_serializer.d.ts +2 -2
- package/core/interfaces/i_toolbox.d.ts +3 -3
- package/core/keyboard_nav/ast_node.d.ts +1 -1
- package/core/layer_manager.d.ts +1 -1
- package/core/layers.d.ts +0 -2
- package/core/procedures.d.ts +3 -3
- package/core/registry.d.ts +6 -6
- package/core/rendered_connection.d.ts +10 -5
- package/core/renderers/common/block_rendering.d.ts +3 -30
- package/core/renderers/common/i_path_object.d.ts +2 -2
- package/core/renderers/common/info.d.ts +1 -1
- package/core/renderers/common/marker_svg.d.ts +5 -5
- package/core/renderers/zelos/constants.d.ts +1 -1
- package/core/serialization/procedures.d.ts +2 -2
- package/core/serialization/workspace_comments.d.ts +1 -1
- package/core/serialization.d.ts +3 -3
- package/core/shortcut_registry.d.ts +70 -10
- package/core/toolbox/toolbox.d.ts +1 -6
- package/core/tooltip.d.ts +1 -1
- package/core/trashcan.d.ts +1 -6
- package/core/utils/drag.d.ts +33 -0
- package/core/utils/rect.d.ts +26 -0
- package/core/utils/size.d.ts +1 -1
- package/core/variables_dynamic.d.ts +1 -1
- package/core/workspace.d.ts +4 -5
- package/core/workspace_svg.d.ts +4 -6
- package/core/xml.d.ts +1 -1
- package/dart_compressed.js.map +1 -1
- package/generators/dart/dart_generator.d.ts +4 -0
- package/generators/dart/lists.d.ts +0 -3
- package/generators/dart/procedures.d.ts +0 -3
- package/generators/dart/text.d.ts +0 -3
- package/generators/javascript/javascript_generator.d.ts +4 -0
- package/generators/javascript/lists.d.ts +0 -3
- package/generators/javascript/procedures.d.ts +0 -3
- package/generators/javascript/text.d.ts +0 -3
- package/generators/lua/lists.d.ts +0 -3
- package/generators/lua/lua_generator.d.ts +6 -0
- package/generators/lua/procedures.d.ts +0 -3
- package/generators/lua/text.d.ts +0 -3
- package/generators/lua.d.ts +0 -4
- package/generators/php/lists.d.ts +1 -1
- package/generators/php/logic.d.ts +1 -1
- package/generators/php/math.d.ts +1 -1
- package/generators/php/php_generator.d.ts +4 -0
- package/generators/php/procedures.d.ts +1 -1
- package/generators/php/text.d.ts +1 -4
- package/generators/php/variables.d.ts +1 -1
- package/generators/php.d.ts +0 -5
- package/generators/python/lists.d.ts +1 -1
- package/generators/python/procedures.d.ts +1 -1
- package/generators/python/python_generator.d.ts +4 -0
- package/generators/python/text.d.ts +1 -1
- package/generators/python.d.ts +0 -5
- package/index.mjs +1 -0
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js.map +1 -1
- package/media/1x1.gif +0 -0
- package/media/click.mp3 +0 -0
- package/media/click.ogg +0 -0
- package/media/click.wav +0 -0
- package/media/delete.mp3 +0 -0
- package/media/delete.ogg +0 -0
- package/media/delete.wav +0 -0
- package/media/disconnect.mp3 +0 -0
- package/media/disconnect.ogg +0 -0
- package/media/disconnect.wav +0 -0
- package/media/handclosed.cur +0 -0
- package/media/handdelete.cur +0 -0
- package/media/handopen.cur +0 -0
- package/media/pilcrow.png +0 -0
- package/media/quote0.png +0 -0
- package/media/quote1.png +0 -0
- package/media/sprites.png +0 -0
- package/package.json +16 -13
- package/php_compressed.js.map +1 -1
- package/python_compressed.js.map +1 -1
|
@@ -23,12 +23,12 @@ export interface LegacyProcedureDefBlock {
|
|
|
23
23
|
getProcedureDef: () => ProcedureTuple;
|
|
24
24
|
}
|
|
25
25
|
/** @internal */
|
|
26
|
-
export declare function isLegacyProcedureDefBlock(block:
|
|
26
|
+
export declare function isLegacyProcedureDefBlock(block: object): block is LegacyProcedureDefBlock;
|
|
27
27
|
/** @internal */
|
|
28
28
|
export interface LegacyProcedureCallBlock {
|
|
29
29
|
getProcedureCall: () => string;
|
|
30
30
|
renameProcedure: (p1: string, p2: string) => void;
|
|
31
31
|
}
|
|
32
32
|
/** @internal */
|
|
33
|
-
export declare function isLegacyProcedureCallBlock(block:
|
|
33
|
+
export declare function isLegacyProcedureCallBlock(block: object): block is LegacyProcedureCallBlock;
|
|
34
34
|
//# sourceMappingURL=i_legacy_procedure_blocks.d.ts.map
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { ContainerRegion, ToolboxMetrics,
|
|
7
|
-
import type { Size } from '../utils/size.js';
|
|
6
|
+
import type { AbsoluteMetrics, ContainerRegion, ToolboxMetrics, UiMetrics } from '../metrics_manager.js';
|
|
8
7
|
import type { Metrics } from '../utils/metrics.js';
|
|
8
|
+
import type { Size } from '../utils/size.js';
|
|
9
9
|
/**
|
|
10
10
|
* Interface for a metrics manager.
|
|
11
11
|
*/
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { Rect } from '../utils/rect.js';
|
|
7
6
|
import type { UiMetrics } from '../metrics_manager.js';
|
|
7
|
+
import type { Rect } from '../utils/rect.js';
|
|
8
8
|
import type { IComponent } from './i_component.js';
|
|
9
9
|
/**
|
|
10
10
|
* Interface for a component that is positioned on top of the workspace.
|
|
@@ -16,5 +16,5 @@ export interface ISelectable {
|
|
|
16
16
|
unselect(): void;
|
|
17
17
|
}
|
|
18
18
|
/** Checks whether the given object is an ISelectable. */
|
|
19
|
-
export declare function isSelectable(obj:
|
|
19
|
+
export declare function isSelectable(obj: object): obj is ISelectable;
|
|
20
20
|
//# sourceMappingURL=i_selectable.d.ts.map
|
|
@@ -24,7 +24,7 @@ export interface ISerializer {
|
|
|
24
24
|
* @returns A JS object containing the system's state, or null if there is no
|
|
25
25
|
* state to record.
|
|
26
26
|
*/
|
|
27
|
-
save(workspace: Workspace):
|
|
27
|
+
save(workspace: Workspace): object | null;
|
|
28
28
|
/**
|
|
29
29
|
* Loads the state of the plugin or system.
|
|
30
30
|
*
|
|
@@ -33,7 +33,7 @@ export interface ISerializer {
|
|
|
33
33
|
* @param workspace The workspace the system to deserialize is associated
|
|
34
34
|
* with.
|
|
35
35
|
*/
|
|
36
|
-
load(state:
|
|
36
|
+
load(state: object, workspace: Workspace): void;
|
|
37
37
|
/**
|
|
38
38
|
* Clears the state of the plugin or system.
|
|
39
39
|
*
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { IRegistrable } from './i_registrable.js';
|
|
7
|
-
import type { IToolboxItem } from './i_toolbox_item.js';
|
|
8
6
|
import type { ToolboxInfo } from '../utils/toolbox.js';
|
|
9
|
-
import type { IFlyout } from './i_flyout.js';
|
|
10
7
|
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
8
|
+
import type { IFlyout } from './i_flyout.js';
|
|
9
|
+
import type { IRegistrable } from './i_registrable.js';
|
|
10
|
+
import type { IToolboxItem } from './i_toolbox_item.js';
|
|
11
11
|
/**
|
|
12
12
|
* Interface for a toolbox.
|
|
13
13
|
*/
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
import { Block } from '../block.js';
|
|
13
13
|
import type { Connection } from '../connection.js';
|
|
14
14
|
import type { Field } from '../field.js';
|
|
15
|
+
import { FlyoutButton } from '../flyout_button.js';
|
|
15
16
|
import type { Input } from '../inputs/input.js';
|
|
16
17
|
import type { IASTNodeLocation } from '../interfaces/i_ast_node_location.js';
|
|
17
18
|
import { Coordinate } from '../utils/coordinate.js';
|
|
18
19
|
import type { Workspace } from '../workspace.js';
|
|
19
|
-
import { FlyoutButton } from '../flyout_button.js';
|
|
20
20
|
/**
|
|
21
21
|
* Class for an AST node.
|
|
22
22
|
* It is recommended that you use one of the createNode methods instead of
|
package/core/layer_manager.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { WorkspaceSvg } from './workspace_svg.js';
|
|
7
6
|
import { IRenderedElement } from './interfaces/i_rendered_element.js';
|
|
8
7
|
import { Coordinate } from './utils/coordinate.js';
|
|
8
|
+
import { WorkspaceSvg } from './workspace_svg.js';
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare class LayerManager {
|
|
11
11
|
private workspace;
|
package/core/layers.d.ts
CHANGED
package/core/procedures.d.ts
CHANGED
|
@@ -7,11 +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 { ProcedureTuple } from './interfaces/i_legacy_procedure_blocks.js';
|
|
10
11
|
import { IParameterModel } from './interfaces/i_parameter_model.js';
|
|
12
|
+
import { IProcedureBlock, isProcedureBlock } from './interfaces/i_procedure_block.js';
|
|
11
13
|
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
12
14
|
import { IProcedureModel } from './interfaces/i_procedure_model.js';
|
|
13
|
-
import { IProcedureBlock, isProcedureBlock } from './interfaces/i_procedure_block.js';
|
|
14
|
-
import { ProcedureTuple } from './interfaces/i_legacy_procedure_blocks.js';
|
|
15
15
|
import { ObservableProcedureMap } from './observable_procedure_map.js';
|
|
16
16
|
import type { Workspace } from './workspace.js';
|
|
17
17
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
@@ -101,5 +101,5 @@ export declare function mutateCallers(defBlock: Block): void;
|
|
|
101
101
|
* @returns The procedure definition block, or null not found.
|
|
102
102
|
*/
|
|
103
103
|
export declare function getDefinition(name: string, workspace: Workspace): Block | null;
|
|
104
|
-
export {
|
|
104
|
+
export { IParameterModel, IProcedureBlock, IProcedureMap, IProcedureModel, isProcedureBlock, ObservableProcedureMap, ProcedureTuple, };
|
|
105
105
|
//# sourceMappingURL=procedures.d.ts.map
|
package/core/registry.d.ts
CHANGED
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Abstract } from './events/events_abstract.js';
|
|
7
7
|
import type { Field } from './field.js';
|
|
8
|
+
import type { Input } from './inputs/input.js';
|
|
8
9
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
10
|
+
import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
11
|
+
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
12
|
+
import type { IDragger } from './interfaces/i_dragger.js';
|
|
9
13
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
10
|
-
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
11
14
|
import type { IIcon } from './interfaces/i_icon.js';
|
|
12
|
-
import type {
|
|
15
|
+
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
16
|
+
import type { IPaster } from './interfaces/i_paster.js';
|
|
13
17
|
import type { ISerializer } from './interfaces/i_serializer.js';
|
|
14
18
|
import type { IToolbox } from './interfaces/i_toolbox.js';
|
|
15
19
|
import type { Cursor } from './keyboard_nav/cursor.js';
|
|
@@ -17,10 +21,6 @@ import type { Options } from './options.js';
|
|
|
17
21
|
import type { Renderer } from './renderers/common/renderer.js';
|
|
18
22
|
import type { Theme } from './theme.js';
|
|
19
23
|
import type { ToolboxItem } from './toolbox/toolbox_item.js';
|
|
20
|
-
import type { IPaster } from './interfaces/i_paster.js';
|
|
21
|
-
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
22
|
-
import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
23
|
-
import type { IDragger } from './interfaces/i_dragger.js';
|
|
24
24
|
export declare const TEST_ONLY: {
|
|
25
25
|
typeMap: {
|
|
26
26
|
[key: string]: {
|
|
@@ -60,10 +60,15 @@ export declare class RenderedConnection extends Connection {
|
|
|
60
60
|
* Move the block(s) belonging to the connection to a point where they don't
|
|
61
61
|
* visually interfere with the specified connection.
|
|
62
62
|
*
|
|
63
|
-
* @param
|
|
63
|
+
* @param superiorConnection The connection to move away from. The provided
|
|
64
|
+
* connection should be the superior connection and should not be
|
|
65
|
+
* connected to this connection.
|
|
66
|
+
* @param initiatedByThis Whether or not the block group that was manipulated
|
|
67
|
+
* recently causing bump checks is associated with the inferior
|
|
68
|
+
* connection. Defaults to false.
|
|
64
69
|
* @internal
|
|
65
70
|
*/
|
|
66
|
-
bumpAwayFrom(
|
|
71
|
+
bumpAwayFrom(superiorConnection: RenderedConnection, initiatedByThis?: boolean): void;
|
|
67
72
|
/**
|
|
68
73
|
* Change the connection's coordinates.
|
|
69
74
|
*
|
|
@@ -162,11 +167,11 @@ export declare class RenderedConnection extends Connection {
|
|
|
162
167
|
* Bumps this connection away from the other connection. Called when an
|
|
163
168
|
* attempted connection fails.
|
|
164
169
|
*
|
|
165
|
-
* @param
|
|
166
|
-
* to.
|
|
170
|
+
* @param superiorConnection Connection that this connection failed to connect
|
|
171
|
+
* to. The provided connection should be the superior connection.
|
|
167
172
|
* @internal
|
|
168
173
|
*/
|
|
169
|
-
onFailedConnect(
|
|
174
|
+
onFailedConnect(superiorConnection: Connection): void;
|
|
170
175
|
/**
|
|
171
176
|
* Disconnect two blocks that are connected by this connection.
|
|
172
177
|
*
|
|
@@ -39,7 +39,7 @@ import { Renderer } from './renderer.js';
|
|
|
39
39
|
* @param rendererClass The new renderer class to register.
|
|
40
40
|
* @throws {Error} if a renderer with the same name has already been registered.
|
|
41
41
|
*/
|
|
42
|
-
export declare function register(name: string, rendererClass:
|
|
42
|
+
export declare function register(name: string, rendererClass: new (name: string) => Renderer): void;
|
|
43
43
|
/**
|
|
44
44
|
* Unregisters the renderer registered with the given name.
|
|
45
45
|
*
|
|
@@ -59,33 +59,6 @@ export declare function unregister(name: string): void;
|
|
|
59
59
|
export declare function init(name: string, theme: Theme, opt_rendererOverrides?: {
|
|
60
60
|
[rendererConstant: string]: any;
|
|
61
61
|
}): Renderer;
|
|
62
|
-
export { BottomRow };
|
|
63
|
-
export {
|
|
64
|
-
export { Drawer };
|
|
65
|
-
export { ExternalValueInput };
|
|
66
|
-
export { Field };
|
|
67
|
-
export { Hat };
|
|
68
|
-
export { Icon };
|
|
69
|
-
export { InRowSpacer };
|
|
70
|
-
export { InlineInput };
|
|
71
|
-
export { InputConnection };
|
|
72
|
-
export { InputRow };
|
|
73
|
-
export { IPathObject };
|
|
74
|
-
export { JaggedEdge };
|
|
75
|
-
export { MarkerSvg };
|
|
76
|
-
export { Measurable };
|
|
77
|
-
export { NextConnection };
|
|
78
|
-
export { OutputConnection };
|
|
79
|
-
export { PathObject };
|
|
80
|
-
export { PreviousConnection };
|
|
81
|
-
export { Renderer };
|
|
82
|
-
export { RenderInfo };
|
|
83
|
-
export { RoundCorner };
|
|
84
|
-
export { Row };
|
|
85
|
-
export { SpacerRow };
|
|
86
|
-
export { SquareCorner };
|
|
87
|
-
export { StatementInput };
|
|
88
|
-
export { TopRow };
|
|
89
|
-
export { Types };
|
|
90
|
-
export { OutsideCorners, InsideCorners, StartHat, Notch, PuzzleTab, JaggedTeeth, BaseShape, DynamicShape, ConstantProvider, } from './constants.js';
|
|
62
|
+
export { BottomRow, Connection, Drawer, ExternalValueInput, Field, Hat, Icon, InlineInput, InputConnection, InputRow, InRowSpacer, IPathObject, JaggedEdge, MarkerSvg, Measurable, NextConnection, OutputConnection, PathObject, PreviousConnection, Renderer, RenderInfo, RoundCorner, Row, SpacerRow, SquareCorner, StatementInput, TopRow, Types, };
|
|
63
|
+
export { BaseShape, ConstantProvider, DynamicShape, InsideCorners, JaggedTeeth, Notch, OutsideCorners, PuzzleTab, StartHat, } from './constants.js';
|
|
91
64
|
//# sourceMappingURL=block_rendering.d.ts.map
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { BlockStyle } from '../../theme.js';
|
|
7
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
8
|
-
import type { ConstantProvider } from './constants.js';
|
|
9
7
|
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
8
|
+
import type { BlockStyle } from '../../theme.js';
|
|
10
9
|
import type { Coordinate } from '../../utils/coordinate.js';
|
|
10
|
+
import type { ConstantProvider } from './constants.js';
|
|
11
11
|
/**
|
|
12
12
|
* An interface for a block's path object.
|
|
13
13
|
*
|
|
@@ -8,6 +8,7 @@ import { Input } from '../../inputs/input.js';
|
|
|
8
8
|
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
9
9
|
import type { Measurable } from '../measurables/base.js';
|
|
10
10
|
import { BottomRow } from '../measurables/bottom_row.js';
|
|
11
|
+
import { Connection } from '../measurables/connection.js';
|
|
11
12
|
import { InputRow } from '../measurables/input_row.js';
|
|
12
13
|
import { OutputConnection } from '../measurables/output_connection.js';
|
|
13
14
|
import type { Row } from '../measurables/row.js';
|
|
@@ -15,7 +16,6 @@ import { SpacerRow } from '../measurables/spacer_row.js';
|
|
|
15
16
|
import { TopRow } from '../measurables/top_row.js';
|
|
16
17
|
import type { ConstantProvider } from './constants.js';
|
|
17
18
|
import type { Renderer } from './renderer.js';
|
|
18
|
-
import { Connection } from '../measurables/connection.js';
|
|
19
19
|
/**
|
|
20
20
|
* An object containing all sizing information needed to draw this block.
|
|
21
21
|
*
|
|
@@ -15,13 +15,13 @@ import type { ConstantProvider, Notch, PuzzleTab } from './constants.js';
|
|
|
15
15
|
* SVG.
|
|
16
16
|
*/
|
|
17
17
|
export declare class MarkerSvg {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
protected readonly workspace: WorkspaceSvg;
|
|
19
|
+
protected readonly marker: Marker;
|
|
20
20
|
/**
|
|
21
21
|
* The workspace, field, or block that the marker SVG element should be
|
|
22
22
|
* attached to.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
protected parent: IASTNodeLocationSvg | null;
|
|
25
25
|
/** The current SVG element for the marker. */
|
|
26
26
|
currentMarkerSvg: SVGElement | null;
|
|
27
27
|
colour_: string;
|
|
@@ -94,7 +94,7 @@ export declare class MarkerSvg {
|
|
|
94
94
|
*
|
|
95
95
|
* @param curNode The node to draw the marker for.
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
protected showWithBlockPrevOutput(curNode: ASTNode): void;
|
|
98
98
|
/**
|
|
99
99
|
* Position and display the marker for a block.
|
|
100
100
|
*
|
|
@@ -229,7 +229,7 @@ export declare class MarkerSvg {
|
|
|
229
229
|
* @param oldNode The old node the marker used to be on.
|
|
230
230
|
* @param curNode The new node the marker is currently on.
|
|
231
231
|
*/
|
|
232
|
-
|
|
232
|
+
protected fireMarkerEvent(oldNode: ASTNode, curNode: ASTNode): void;
|
|
233
233
|
/**
|
|
234
234
|
* Get the properties to make a marker blink.
|
|
235
235
|
*
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { RenderedConnection } from '../../rendered_connection.js';
|
|
7
7
|
import type { Theme } from '../../theme.js';
|
|
8
|
-
import { ConstantProvider as BaseConstantProvider } from '../common/constants.js';
|
|
9
8
|
import type { Shape } from '../common/constants.js';
|
|
9
|
+
import { ConstantProvider as BaseConstantProvider } from '../common/constants.js';
|
|
10
10
|
/** An object containing sizing and path information about inside corners. */
|
|
11
11
|
export interface InsideCorners {
|
|
12
12
|
width: number;
|
|
@@ -38,7 +38,7 @@ interface ProcedureModelConstructor<ProcedureModel extends IProcedureModel> {
|
|
|
38
38
|
* @param workspace The workspace to load the procedure model into.
|
|
39
39
|
* @returns The constructed procedure model.
|
|
40
40
|
*/
|
|
41
|
-
loadState(state:
|
|
41
|
+
loadState(state: object, workspace: Workspace): ProcedureModel;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* A newable signature for an IParameterModel.
|
|
@@ -56,7 +56,7 @@ interface ParameterModelConstructor<ParameterModel extends IParameterModel> {
|
|
|
56
56
|
* @param workspace The workspace to load the parameter model into.
|
|
57
57
|
* @returns The constructed parameter model.
|
|
58
58
|
*/
|
|
59
|
-
loadState(state:
|
|
59
|
+
loadState(state: object, workspace: Workspace): ParameterModel;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Serializes the given IProcedureModel to JSON.
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
6
7
|
import { ISerializer } from '../interfaces/i_serializer.js';
|
|
7
8
|
import { Workspace } from '../workspace.js';
|
|
8
|
-
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
9
9
|
export interface State {
|
|
10
10
|
id?: string;
|
|
11
11
|
text?: string;
|
package/core/serialization.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Serialization methods.
|
|
8
8
|
*/
|
|
9
|
+
import { ISerializer } from './interfaces/i_serializer.js';
|
|
9
10
|
import * as blocks from './serialization/blocks.js';
|
|
10
11
|
import * as exceptions from './serialization/exceptions.js';
|
|
11
12
|
import * as priorities from './serialization/priorities.js';
|
|
12
13
|
import * as procedures from './serialization/procedures.js';
|
|
13
14
|
import * as registry from './serialization/registry.js';
|
|
14
15
|
import * as variables from './serialization/variables.js';
|
|
15
|
-
import * as workspaces from './serialization/workspaces.js';
|
|
16
16
|
import * as workspaceComments from './serialization/workspace_comments.js';
|
|
17
|
-
import
|
|
18
|
-
export { blocks, exceptions, priorities, procedures, registry, variables,
|
|
17
|
+
import * as workspaces from './serialization/workspaces.js';
|
|
18
|
+
export { blocks, exceptions, ISerializer, priorities, procedures, registry, variables, workspaceComments, workspaces, };
|
|
19
19
|
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -30,13 +30,13 @@ export declare class ShortcutRegistry {
|
|
|
30
30
|
* Registers a keyboard shortcut.
|
|
31
31
|
*
|
|
32
32
|
* @param shortcut The shortcut for this key code.
|
|
33
|
-
* @param
|
|
33
|
+
* @param allowOverrides True to prevent a warning when overriding an
|
|
34
34
|
* already registered item.
|
|
35
35
|
* @throws {Error} if a shortcut with the same name already exists.
|
|
36
36
|
*/
|
|
37
|
-
register(shortcut: KeyboardShortcut,
|
|
37
|
+
register(shortcut: KeyboardShortcut, allowOverrides?: boolean): void;
|
|
38
38
|
/**
|
|
39
|
-
* Unregisters a keyboard shortcut registered with the given
|
|
39
|
+
* Unregisters a keyboard shortcut registered with the given name. This
|
|
40
40
|
* will also remove any key mappings that reference this shortcut.
|
|
41
41
|
*
|
|
42
42
|
* @param shortcutName The name of the shortcut to unregister.
|
|
@@ -46,16 +46,23 @@ export declare class ShortcutRegistry {
|
|
|
46
46
|
/**
|
|
47
47
|
* Adds a mapping between a keycode and a keyboard shortcut.
|
|
48
48
|
*
|
|
49
|
+
* Normally only one shortcut can be mapped to any given keycode,
|
|
50
|
+
* but setting allowCollisions to true allows a keyboard to be
|
|
51
|
+
* mapped to multiple shortcuts. In that case, when onKeyDown is
|
|
52
|
+
* called with the given keystroke, it will process the mapped
|
|
53
|
+
* shortcuts in reverse order, from the most- to least-recently
|
|
54
|
+
* mapped).
|
|
55
|
+
*
|
|
49
56
|
* @param keyCode The key code for the keyboard shortcut. If registering a key
|
|
50
57
|
* code with a modifier (ex: ctrl+c) use
|
|
51
58
|
* ShortcutRegistry.registry.createSerializedKey;
|
|
52
59
|
* @param shortcutName The name of the shortcut to execute when the given
|
|
53
60
|
* keycode is pressed.
|
|
54
|
-
* @param
|
|
61
|
+
* @param allowCollision True to prevent an error when adding a shortcut
|
|
55
62
|
* to a key that is already mapped to a shortcut.
|
|
56
63
|
* @throws {Error} if the given key code is already mapped to a shortcut.
|
|
57
64
|
*/
|
|
58
|
-
addKeyMapping(keyCode: string | number | KeyCodes, shortcutName: string,
|
|
65
|
+
addKeyMapping(keyCode: string | number | KeyCodes, shortcutName: string, allowCollision?: boolean): void;
|
|
59
66
|
/**
|
|
60
67
|
* Removes a mapping between a keycode and a keyboard shortcut.
|
|
61
68
|
*
|
|
@@ -64,11 +71,11 @@ export declare class ShortcutRegistry {
|
|
|
64
71
|
* ShortcutRegistry.registry.createSerializedKey;
|
|
65
72
|
* @param shortcutName The name of the shortcut to execute when the given
|
|
66
73
|
* keycode is pressed.
|
|
67
|
-
* @param
|
|
74
|
+
* @param quiet True to not console warn when there is no shortcut to
|
|
68
75
|
* remove.
|
|
69
76
|
* @returns True if a key mapping was removed, false otherwise.
|
|
70
77
|
*/
|
|
71
|
-
removeKeyMapping(keyCode: string, shortcutName: string,
|
|
78
|
+
removeKeyMapping(keyCode: string, shortcutName: string, quiet?: boolean): boolean;
|
|
72
79
|
/**
|
|
73
80
|
* Removes all the key mappings for a shortcut with the given name.
|
|
74
81
|
* Useful when changing the default key mappings and the key codes registered
|
|
@@ -105,6 +112,21 @@ export declare class ShortcutRegistry {
|
|
|
105
112
|
/**
|
|
106
113
|
* Handles key down events.
|
|
107
114
|
*
|
|
115
|
+
* - Any `KeyboardShortcut`(s) mapped to the keycodes that cause
|
|
116
|
+
* event `e` to be fired will be processed, in order from least-
|
|
117
|
+
* to most-recently registered.
|
|
118
|
+
* - If the shortcut's `preconditionFn` exists it will be called.
|
|
119
|
+
* If `preconditionFn` returns false the shortcut's `callback`
|
|
120
|
+
* function will be skipped. Processing will continue with the
|
|
121
|
+
* next shortcut, if any.
|
|
122
|
+
* - The shortcut's `callback` function will then be called. If it
|
|
123
|
+
* returns true, processing will terminate and `onKeyDown` will
|
|
124
|
+
* return true. If it returns false, processing will continue
|
|
125
|
+
* with with the next shortcut, if any.
|
|
126
|
+
* - If all registered shortcuts for the given keycode have been
|
|
127
|
+
* processed without any having returned true, `onKeyDown` will
|
|
128
|
+
* return false.
|
|
129
|
+
*
|
|
108
130
|
* @param workspace The main workspace where the event was captured.
|
|
109
131
|
* @param e The key down event.
|
|
110
132
|
* @returns True if the event was handled, false otherwise.
|
|
@@ -145,18 +167,56 @@ export declare class ShortcutRegistry {
|
|
|
145
167
|
*
|
|
146
168
|
* @param keyCode Number code representing the key.
|
|
147
169
|
* @param modifiers List of modifier key codes to be used with the key. All
|
|
148
|
-
* valid modifiers can be found in the ShortcutRegistry.modifierKeys
|
|
170
|
+
* valid modifiers can be found in the `ShortcutRegistry.modifierKeys`.
|
|
149
171
|
* @returns The serialized key code for the given modifiers and key.
|
|
150
172
|
*/
|
|
151
173
|
createSerializedKey(keyCode: number, modifiers: KeyCodes[] | null): string;
|
|
152
174
|
}
|
|
153
175
|
export declare namespace ShortcutRegistry {
|
|
176
|
+
/** Interface defining a keyboard shortcut. */
|
|
154
177
|
interface KeyboardShortcut {
|
|
155
|
-
|
|
178
|
+
/**
|
|
179
|
+
* The function to be called when the shorctut is invoked.
|
|
180
|
+
*
|
|
181
|
+
* @param workspace The `WorkspaceSvg` when the shortcut was
|
|
182
|
+
* invoked.
|
|
183
|
+
* @param e The event that caused the shortcut to be activated.
|
|
184
|
+
* @param shortcut The `KeyboardShortcut` that was activated
|
|
185
|
+
* (i.e., the one this callback is attached to).
|
|
186
|
+
* @returns Returning true ends processing of the invoked keycode.
|
|
187
|
+
* Returning false causes processing to continue with the
|
|
188
|
+
* next-most-recently registered shortcut for the invoked
|
|
189
|
+
* keycode.
|
|
190
|
+
*/
|
|
191
|
+
callback?: (workspace: WorkspaceSvg, e: Event, shortcut: KeyboardShortcut) => boolean;
|
|
192
|
+
/** The name of the shortcut. Should be unique. */
|
|
156
193
|
name: string;
|
|
157
|
-
|
|
194
|
+
/**
|
|
195
|
+
* A function to be called when the shortcut is invoked, before
|
|
196
|
+
* calling `callback`, to decide if this shortcut is applicable in
|
|
197
|
+
* the current situation.
|
|
198
|
+
*
|
|
199
|
+
* @param workspace The `WorkspaceSvg` where the shortcut was
|
|
200
|
+
* invoked.
|
|
201
|
+
* @returns True iff `callback` function should be called.
|
|
202
|
+
*/
|
|
203
|
+
preconditionFn?: (workspace: WorkspaceSvg) => boolean;
|
|
204
|
+
/** Optional arbitray extra data attached to the shortcut. */
|
|
158
205
|
metadata?: object;
|
|
206
|
+
/**
|
|
207
|
+
* Optional list of key codes to be bound (via
|
|
208
|
+
* ShortcutRegistry.prototype.addKeyMapping) to this shortcut.
|
|
209
|
+
*/
|
|
159
210
|
keyCodes?: (number | string)[];
|
|
211
|
+
/**
|
|
212
|
+
* Value of `allowCollision` to pass to `addKeyMapping` when
|
|
213
|
+
* binding this shortcut's `.keyCodes` (if any).
|
|
214
|
+
*
|
|
215
|
+
* N.B.: this is only used for binding keycodes at the time this
|
|
216
|
+
* shortcut is initially registered, not for any subsequent
|
|
217
|
+
* `addKeyMapping` calls that happen to reference this shortcut's
|
|
218
|
+
* name.
|
|
219
|
+
*/
|
|
160
220
|
allowCollision?: boolean;
|
|
161
221
|
}
|
|
162
222
|
/** Supported modifiers. */
|
|
@@ -3,14 +3,9 @@
|
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Toolbox from whence to create blocks.
|
|
8
|
-
*
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
import '../events/events_toolbox_item_select.js';
|
|
12
6
|
import * as browserEvents from '../browser_events.js';
|
|
13
7
|
import { DeleteArea } from '../delete_area.js';
|
|
8
|
+
import '../events/events_toolbox_item_select.js';
|
|
14
9
|
import type { IAutoHideable } from '../interfaces/i_autohideable.js';
|
|
15
10
|
import type { IDraggable } from '../interfaces/i_draggable.js';
|
|
16
11
|
import type { IFlyout } from '../interfaces/i_flyout.js';
|
package/core/tooltip.d.ts
CHANGED
package/core/trashcan.d.ts
CHANGED
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
* Copyright 2011 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Object representing a trash can icon.
|
|
8
|
-
*
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
import './events/events_trashcan_open.js';
|
|
12
6
|
import { DeleteArea } from './delete_area.js';
|
|
7
|
+
import './events/events_trashcan_open.js';
|
|
13
8
|
import type { IAutoHideable } from './interfaces/i_autohideable.js';
|
|
14
9
|
import type { IDraggable } from './interfaces/i_draggable.js';
|
|
15
10
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
7
|
+
import { Coordinate } from './coordinate.js';
|
|
8
|
+
/**
|
|
9
|
+
* Start tracking a drag of an object on this workspace by recording the offset
|
|
10
|
+
* between the pointer's current location and the object's starting location.
|
|
11
|
+
*
|
|
12
|
+
* Used for resizing block comments and workspace comments.
|
|
13
|
+
*
|
|
14
|
+
* @param workspace The workspace where the drag is occurring.
|
|
15
|
+
* @param e Pointer down event.
|
|
16
|
+
* @param xy Starting location of object.
|
|
17
|
+
*/
|
|
18
|
+
export declare function start(workspace: WorkspaceSvg, e: PointerEvent, xy: Coordinate): void;
|
|
19
|
+
/**
|
|
20
|
+
* Compute the new position of a dragged object in this workspace based on the
|
|
21
|
+
* current pointer position and the offset between the pointer's starting
|
|
22
|
+
* location and the object's starting location.
|
|
23
|
+
*
|
|
24
|
+
* The start function should have be called previously, when the drag started.
|
|
25
|
+
*
|
|
26
|
+
* Used for resizing block comments and workspace comments.
|
|
27
|
+
*
|
|
28
|
+
* @param workspace The workspace where the drag is occurring.
|
|
29
|
+
* @param e Pointer move event.
|
|
30
|
+
* @returns New location of object.
|
|
31
|
+
*/
|
|
32
|
+
export declare function move(workspace: WorkspaceSvg, e: PointerEvent): Coordinate;
|
|
33
|
+
//# sourceMappingURL=drag.d.ts.map
|
package/core/utils/rect.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @class
|
|
12
12
|
*/
|
|
13
|
+
import { Coordinate } from './coordinate.js';
|
|
13
14
|
/**
|
|
14
15
|
* Class for representing rectangular regions.
|
|
15
16
|
*/
|
|
@@ -25,7 +26,15 @@ export declare class Rect {
|
|
|
25
26
|
* @param right Right.
|
|
26
27
|
*/
|
|
27
28
|
constructor(top: number, bottom: number, left: number, right: number);
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new copy of this rectangle.
|
|
31
|
+
*
|
|
32
|
+
* @returns A copy of this Rect.
|
|
33
|
+
*/
|
|
34
|
+
clone(): Rect;
|
|
35
|
+
/** Returns the height of this rectangle. */
|
|
28
36
|
getHeight(): number;
|
|
37
|
+
/** Returns the width of this rectangle. */
|
|
29
38
|
getWidth(): number;
|
|
30
39
|
/**
|
|
31
40
|
* Tests whether this rectangle contains a x/y coordinate.
|
|
@@ -43,5 +52,22 @@ export declare class Rect {
|
|
|
43
52
|
* @returns Whether this rectangle intersects the provided rectangle.
|
|
44
53
|
*/
|
|
45
54
|
intersects(other: Rect): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Compares bounding rectangles for equality.
|
|
57
|
+
*
|
|
58
|
+
* @param a A Rect.
|
|
59
|
+
* @param b A Rect.
|
|
60
|
+
* @returns True iff the bounding rectangles are equal, or if both are null.
|
|
61
|
+
*/
|
|
62
|
+
static equals(a?: Rect | null, b?: Rect | null): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new Rect using a position and supplied dimensions.
|
|
65
|
+
*
|
|
66
|
+
* @param position The upper left coordinate of the new rectangle.
|
|
67
|
+
* @param width The width of the rectangle, in pixels.
|
|
68
|
+
* @param height The height of the rectangle, in pixels.
|
|
69
|
+
* @returns A newly created Rect using the provided Coordinate and dimensions.
|
|
70
|
+
*/
|
|
71
|
+
static createFromPoint(position: Coordinate, width: number, height: number): Rect;
|
|
46
72
|
}
|
|
47
73
|
//# sourceMappingURL=rect.d.ts.map
|