blockly 11.0.0-beta.1 → 11.0.0-beta.10
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 +852 -891
- package/blockly_compressed.js +794 -796
- package/blockly_compressed.js.map +1 -1
- package/blocks.js +4 -22
- package/blocks_compressed.js +38 -41
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +58 -10
- package/core/block_svg.d.ts +50 -44
- package/core/blockly.d.ts +22 -56
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
- package/core/bubbles/text_bubble.d.ts +1 -1
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/clipboard/workspace_comment_paster.d.ts +5 -4
- package/core/clipboard.d.ts +0 -19
- package/core/comments/comment_view.d.ts +217 -0
- package/core/comments/rendered_workspace_comment.d.ts +90 -0
- package/core/comments/workspace_comment.d.ts +107 -0
- package/core/comments.d.ts +9 -0
- package/core/connection.d.ts +1 -1
- package/core/constants.d.ts +5 -0
- package/core/contextmenu.d.ts +1 -34
- package/core/contextmenu_items.d.ts +8 -0
- package/core/contextmenu_registry.d.ts +18 -3
- package/core/delete_area.d.ts +1 -2
- package/core/dragging/block_drag_strategy.d.ts +105 -0
- package/core/dragging/bubble_drag_strategy.d.ts +20 -0
- package/core/dragging/comment_drag_strategy.d.ts +21 -0
- package/core/dragging/dragger.d.ts +48 -0
- package/core/dragging.d.ts +11 -0
- package/core/events/events.d.ts +3 -0
- package/core/events/events_block_change.d.ts +15 -0
- package/core/events/events_click.d.ts +1 -1
- package/core/events/events_comment_base.d.ts +6 -1
- package/core/events/events_comment_change.d.ts +1 -1
- package/core/events/events_comment_collapse.d.ts +39 -0
- package/core/events/events_comment_create.d.ts +5 -1
- package/core/events/events_comment_delete.d.ts +5 -1
- package/core/events/events_comment_move.d.ts +17 -1
- package/core/events/utils.d.ts +3 -3
- package/core/field_dropdown.d.ts +1 -0
- package/core/field_image.d.ts +1 -1
- package/core/flyout_base.d.ts +17 -1
- package/core/flyout_button.d.ts +26 -1
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +29 -53
- package/core/grid.d.ts +29 -8
- package/core/icons/comment_icon.d.ts +8 -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/insertion_marker_manager.d.ts +2 -0
- package/core/insertion_marker_previewer.d.ts +56 -0
- package/core/interfaces/i_comment_icon.d.ts +21 -0
- package/core/interfaces/i_connection_previewer.d.ts +39 -0
- package/core/interfaces/i_deletable.d.ts +6 -0
- package/core/interfaces/i_delete_area.d.ts +1 -2
- package/core/interfaces/i_draggable.d.ts +47 -3
- package/core/interfaces/i_dragger.d.ts +32 -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/interfaces/i_selectable.d.ts +5 -3
- package/core/internal_constants.d.ts +0 -7
- package/core/keyboard_nav/ast_node.d.ts +21 -2
- package/core/options.d.ts +1 -0
- package/core/registry.d.ts +10 -4
- package/core/render_management.d.ts +4 -1
- package/core/rendered_connection.d.ts +3 -1
- package/core/renderers/common/constants.d.ts +6 -2
- package/core/renderers/common/drawer.d.ts +18 -7
- package/core/renderers/common/i_path_object.d.ts +6 -15
- package/core/renderers/common/info.d.ts +5 -2
- package/core/renderers/common/marker_svg.d.ts +7 -0
- package/core/renderers/common/path_object.d.ts +13 -0
- package/core/renderers/common/renderer.d.ts +3 -0
- package/core/renderers/measurables/connection.d.ts +1 -0
- package/core/renderers/measurables/icon.d.ts +0 -5
- package/core/renderers/zelos/drawer.d.ts +4 -0
- package/core/renderers/zelos/renderer.d.ts +4 -2
- package/core/serialization/blocks.d.ts +1 -0
- 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/toolbox/toolbox.d.ts +1 -2
- 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/utils/toolbox.d.ts +1 -0
- package/core/workspace.d.ts +9 -1
- package/core/workspace_audio.d.ts +10 -0
- package/core/workspace_svg.d.ts +10 -32
- package/core/xml.d.ts +9 -3
- package/core-node.js +31 -0
- package/core.js +4 -26
- package/dart.js +4 -22
- package/dart_compressed.js +22 -72
- 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.js +4 -23
- package/javascript_compressed.js +19 -54
- package/javascript_compressed.js.map +1 -1
- package/lua.js +4 -22
- package/lua_compressed.js +24 -47
- package/lua_compressed.js.map +1 -1
- package/media/delete-icon.svg +1 -0
- package/media/foldout-icon.svg +1 -0
- package/media/resize-handle.svg +3 -0
- package/msg/ab.js +1 -0
- package/msg/ace.js +1 -0
- package/msg/af.js +1 -0
- package/msg/am.js +1 -0
- package/msg/ar.js +2 -1
- package/msg/ast.js +1 -0
- package/msg/az.js +1 -0
- package/msg/ba.js +1 -0
- package/msg/bcc.js +1 -0
- package/msg/be-tarask.js +9 -8
- package/msg/be.js +1 -0
- package/msg/bg.js +1 -0
- package/msg/bn.js +6 -5
- package/msg/br.js +1 -0
- package/msg/bs.js +1 -0
- package/msg/ca.js +1 -0
- package/msg/cdo.js +1 -0
- package/msg/ce.d.ts +8 -0
- package/msg/ce.js +1 -0
- package/msg/cs.js +1 -0
- package/msg/da.js +5 -4
- package/msg/de.js +1 -0
- package/msg/diq.js +1 -0
- package/msg/dtp.d.ts +8 -0
- package/msg/dtp.js +1 -0
- package/msg/dty.js +1 -0
- package/msg/ee.js +1 -0
- package/msg/el.js +2 -1
- package/msg/en-gb.js +1 -0
- package/msg/en.js +1 -0
- package/msg/eo.js +1 -0
- package/msg/es.js +1 -0
- package/msg/et.js +1 -0
- package/msg/eu.js +1 -0
- package/msg/fa.js +1 -0
- package/msg/fi.js +1 -0
- package/msg/fo.js +1 -0
- package/msg/fr.js +1 -0
- package/msg/frr.js +1 -0
- package/msg/gl.js +1 -0
- package/msg/gn.js +1 -0
- package/msg/gor.js +1 -0
- package/msg/ha.js +1 -0
- package/msg/hak.js +1 -0
- package/msg/he.js +2 -1
- package/msg/hi.js +1 -0
- package/msg/hr.js +1 -0
- package/msg/hrx.js +1 -0
- package/msg/hsb.d.ts +8 -0
- package/msg/hsb.js +1 -0
- package/msg/hu.js +1 -0
- package/msg/hy.js +1 -0
- package/msg/ia.js +1 -0
- package/msg/id.js +7 -6
- package/msg/ig.js +1 -0
- package/msg/inh.js +4 -3
- package/msg/is.js +1 -0
- package/msg/it.js +1 -0
- package/msg/ja.js +2 -1
- package/msg/ka.js +1 -0
- package/msg/kab.js +1 -0
- package/msg/kbd-cyrl.js +1 -0
- package/msg/km.js +1 -0
- package/msg/kn.js +1 -0
- package/msg/ko.js +1 -0
- package/msg/ksh.js +1 -0
- package/msg/ku-latn.js +1 -0
- package/msg/ky.js +1 -0
- package/msg/la.js +1 -0
- package/msg/lb.js +1 -0
- package/msg/lki.js +1 -0
- package/msg/lo.js +1 -0
- package/msg/lrc.js +1 -0
- package/msg/lt.js +1 -0
- package/msg/lv.js +1 -0
- package/msg/mg.js +1 -0
- package/msg/mk.js +1 -0
- package/msg/ml.js +1 -0
- package/msg/mnw.js +1 -0
- package/msg/ms.js +1 -0
- package/msg/my.js +1 -0
- package/msg/mzn.js +1 -0
- package/msg/nb.js +1 -0
- package/msg/ne.js +1 -0
- package/msg/nl.js +4 -3
- package/msg/oc.js +1 -0
- package/msg/olo.js +1 -0
- package/msg/pa.js +1 -0
- package/msg/pl.js +1 -0
- package/msg/pms.js +1 -0
- package/msg/ps.js +1 -0
- package/msg/pt-br.js +1 -0
- package/msg/pt.js +2 -1
- package/msg/ro.js +1 -0
- package/msg/ru.js +1 -0
- package/msg/sc.js +1 -0
- package/msg/sco.js +1 -0
- package/msg/sd.js +1 -0
- package/msg/shn.js +1 -0
- package/msg/si.js +1 -0
- package/msg/sk.js +1 -0
- package/msg/skr-arab.js +1 -0
- package/msg/sl.js +1 -0
- package/msg/smn.js +1 -0
- package/msg/sq.js +1 -0
- package/msg/sr-latn.js +1 -0
- package/msg/sr.js +1 -0
- package/msg/sv.js +1 -0
- package/msg/sw.js +1 -0
- package/msg/ta.js +3 -2
- package/msg/tcy.js +1 -0
- package/msg/tdd.d.ts +8 -0
- package/msg/tdd.js +1 -0
- package/msg/te.js +1 -0
- package/msg/th.js +1 -0
- package/msg/ti.js +1 -0
- package/msg/tl.js +3 -2
- package/msg/tlh.js +1 -0
- package/msg/tr.js +1 -0
- package/msg/ug-arab.js +1 -0
- package/msg/uk.js +1 -0
- package/msg/ur.js +3 -2
- package/msg/uz.js +1 -0
- package/msg/vi.js +1 -0
- package/msg/xmf.js +1 -0
- package/msg/yo.js +1 -0
- package/msg/zgh.js +1 -0
- package/msg/zh-hans.js +1 -0
- package/msg/zh-hant.js +15 -14
- package/package.json +49 -15
- package/php.js +4 -22
- package/php_compressed.js +13 -46
- package/php_compressed.js.map +1 -1
- package/python.js +4 -23
- package/python_compressed.js +21 -40
- package/python_compressed.js.map +1 -1
- package/blockly.js +0 -22
- package/browser.js +0 -30
- package/core/block_dragger.d.ts +0 -162
- package/core/bubble_dragger.d.ts +0 -77
- 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/interfaces/i_block_dragger.d.ts +0 -47
- 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/workspace_comment.d.ts +0 -190
- package/core/workspace_comment_svg.d.ts +0 -361
- package/core-browser.js +0 -26
- 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/msg/constants.d.ts +0 -14
- package/msg/qqq.d.ts +0 -14
- package/msg/synonyms.d.ts +0 -14
- package/msg/yue.js +0 -441
- package/node.js +0 -21
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { BlockSvg } from '../block_svg.js';
|
|
9
|
+
export declare class BlockDragStrategy implements IDragStrategy {
|
|
10
|
+
private block;
|
|
11
|
+
private workspace;
|
|
12
|
+
/** The parent block at the start of the drag. */
|
|
13
|
+
private startParentConn;
|
|
14
|
+
/**
|
|
15
|
+
* The child block at the start of the drag. Only gets set if
|
|
16
|
+
* `healStack` is true.
|
|
17
|
+
*/
|
|
18
|
+
private startChildConn;
|
|
19
|
+
private startLoc;
|
|
20
|
+
private connectionCandidate;
|
|
21
|
+
private connectionPreviewer;
|
|
22
|
+
private dragging;
|
|
23
|
+
/**
|
|
24
|
+
* If this is a shadow block, the offset between this block and the parent
|
|
25
|
+
* block, to add to the drag location. In workspace units.
|
|
26
|
+
*/
|
|
27
|
+
private dragOffset;
|
|
28
|
+
constructor(block: BlockSvg);
|
|
29
|
+
/** Returns true if the block is currently movable. False otherwise. */
|
|
30
|
+
isMovable(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Handles any setup for starting the drag, including disconnecting the block
|
|
33
|
+
* from any parent blocks.
|
|
34
|
+
*/
|
|
35
|
+
startDrag(e?: PointerEvent): void;
|
|
36
|
+
/** Starts a drag on a shadow, recording the drag offset. */
|
|
37
|
+
private startDraggingShadow;
|
|
38
|
+
/**
|
|
39
|
+
* Whether or not we should disconnect the block when a drag is started.
|
|
40
|
+
*
|
|
41
|
+
* @param healStack Whether or not to heal the stack after disconnecting.
|
|
42
|
+
* @returns True to disconnect the block, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
private shouldDisconnect;
|
|
45
|
+
/**
|
|
46
|
+
* Disconnects the block from any parents. If `healStack` is true and this is
|
|
47
|
+
* a stack block, we also disconnect from any next blocks and attempt to
|
|
48
|
+
* attach them to any parent.
|
|
49
|
+
*
|
|
50
|
+
* @param healStack Whether or not to heal the stack after disconnecting.
|
|
51
|
+
*/
|
|
52
|
+
private disconnectBlock;
|
|
53
|
+
/** Fire a UI event at the start of a block drag. */
|
|
54
|
+
private fireDragStartEvent;
|
|
55
|
+
/** Fire a UI event at the end of a block drag. */
|
|
56
|
+
private fireDragEndEvent;
|
|
57
|
+
/** Fire a move event at the end of a block drag. */
|
|
58
|
+
private fireMoveEvent;
|
|
59
|
+
/** Moves the block and updates any connection previews. */
|
|
60
|
+
drag(newLoc: Coordinate): void;
|
|
61
|
+
/**
|
|
62
|
+
* @param draggingBlock The block being dragged.
|
|
63
|
+
* @param delta How far the pointer has moved from the position
|
|
64
|
+
* at the start of the drag, in workspace units.
|
|
65
|
+
*/
|
|
66
|
+
private updateConnectionPreview;
|
|
67
|
+
/**
|
|
68
|
+
* Returns true if the given orphan block can connect at the end of the
|
|
69
|
+
* top block's stack or row, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
private orphanCanConnectAtEnd;
|
|
72
|
+
/**
|
|
73
|
+
* Returns true if the current candidate is better than the new candidate.
|
|
74
|
+
*
|
|
75
|
+
* We slightly prefer the current candidate even if it is farther away.
|
|
76
|
+
*/
|
|
77
|
+
private currCandidateIsBetter;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the closest valid candidate connection, if one can be found.
|
|
80
|
+
*
|
|
81
|
+
* Valid neighbour connections are within the configured start radius, with a
|
|
82
|
+
* compatible type (input, output, etc) and connection check.
|
|
83
|
+
*/
|
|
84
|
+
private getConnectionCandidate;
|
|
85
|
+
/**
|
|
86
|
+
* Returns all of the connections we might connect to blocks on the workspace.
|
|
87
|
+
*
|
|
88
|
+
* Includes any connections on the dragging block, and any last next
|
|
89
|
+
* connection on the stack (if one exists).
|
|
90
|
+
*/
|
|
91
|
+
private getLocalConnections;
|
|
92
|
+
/**
|
|
93
|
+
* Cleans up any state at the end of the drag. Applies any pending
|
|
94
|
+
* connections.
|
|
95
|
+
*/
|
|
96
|
+
endDrag(e?: PointerEvent): void;
|
|
97
|
+
/** Connects the given candidate connections. */
|
|
98
|
+
private applyConnections;
|
|
99
|
+
/**
|
|
100
|
+
* Moves the block back to where it was at the beginning of the drag,
|
|
101
|
+
* including reconnecting connections.
|
|
102
|
+
*/
|
|
103
|
+
revertDrag(): void;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=block_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { IBubble, WorkspaceSvg } from '../blockly.js';
|
|
9
|
+
export declare class BubbleDragStrategy implements IDragStrategy {
|
|
10
|
+
private bubble;
|
|
11
|
+
private workspace;
|
|
12
|
+
private startLoc;
|
|
13
|
+
constructor(bubble: IBubble, workspace: WorkspaceSvg);
|
|
14
|
+
isMovable(): boolean;
|
|
15
|
+
startDrag(): void;
|
|
16
|
+
drag(newLoc: Coordinate): void;
|
|
17
|
+
endDrag(): void;
|
|
18
|
+
revertDrag(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=bubble_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
7
|
+
import { Coordinate } from '../utils.js';
|
|
8
|
+
import { RenderedWorkspaceComment } from '../comments.js';
|
|
9
|
+
export declare class CommentDragStrategy implements IDragStrategy {
|
|
10
|
+
private comment;
|
|
11
|
+
private startLoc;
|
|
12
|
+
private workspace;
|
|
13
|
+
constructor(comment: RenderedWorkspaceComment);
|
|
14
|
+
isMovable(): boolean;
|
|
15
|
+
startDrag(): void;
|
|
16
|
+
drag(newLoc: Coordinate): void;
|
|
17
|
+
endDrag(): void;
|
|
18
|
+
private fireMoveEvent;
|
|
19
|
+
revertDrag(): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=comment_drag_strategy.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { IDragTarget } from '../interfaces/i_drag_target.js';
|
|
7
|
+
import { IDeletable } from '../interfaces/i_deletable.js';
|
|
8
|
+
import { IDragger } from '../interfaces/i_dragger.js';
|
|
9
|
+
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
10
|
+
import { Coordinate } from '../utils/coordinate.js';
|
|
11
|
+
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
12
|
+
export declare class Dragger implements IDragger {
|
|
13
|
+
protected draggable: IDraggable;
|
|
14
|
+
protected workspace: WorkspaceSvg;
|
|
15
|
+
protected startLoc: Coordinate;
|
|
16
|
+
protected dragTarget: IDragTarget | null;
|
|
17
|
+
constructor(draggable: IDraggable, workspace: WorkspaceSvg);
|
|
18
|
+
/** Handles any drag startup. */
|
|
19
|
+
onDragStart(e: PointerEvent): void;
|
|
20
|
+
/**
|
|
21
|
+
* Handles calculating where the element should actually be moved to.
|
|
22
|
+
*
|
|
23
|
+
* @param totalDelta The total amount in pixel coordinates the mouse has moved
|
|
24
|
+
* since the start of the drag.
|
|
25
|
+
*/
|
|
26
|
+
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
27
|
+
/** Updates the drag target under the pointer (if there is one). */
|
|
28
|
+
protected updateDragTarget(e: PointerEvent): void;
|
|
29
|
+
/**
|
|
30
|
+
* Calculates the correct workspace coordinate for the movable and tells
|
|
31
|
+
* the draggable to go to that location.
|
|
32
|
+
*/
|
|
33
|
+
private moveDraggable;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true if we would delete the draggable if it was dropped
|
|
36
|
+
* at the current location.
|
|
37
|
+
*/
|
|
38
|
+
protected wouldDeleteDraggable(e: PointerEvent, draggable: IDraggable & IDeletable): boolean;
|
|
39
|
+
/** Handles any drag cleanup. */
|
|
40
|
+
onDragEnd(e: PointerEvent): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if we should return the draggable to its original location
|
|
43
|
+
* at the end of the drag.
|
|
44
|
+
*/
|
|
45
|
+
protected shouldReturnToStart(e: PointerEvent, draggable: IDraggable): boolean;
|
|
46
|
+
protected pixelsToWorkspaceUnits(pixelCoord: Coordinate): Coordinate;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=dragger.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Dragger } from './dragging/dragger.js';
|
|
7
|
+
import { BlockDragStrategy } from './dragging/block_drag_strategy.js';
|
|
8
|
+
import { BubbleDragStrategy } from './dragging/bubble_drag_strategy.js';
|
|
9
|
+
import { CommentDragStrategy } from './dragging/comment_drag_strategy.js';
|
|
10
|
+
export { Dragger, BlockDragStrategy, BubbleDragStrategy, CommentDragStrategy };
|
|
11
|
+
//# sourceMappingURL=dragging.d.ts.map
|
package/core/events/events.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { CommentChange, CommentChangeJson } from './events_comment_change.js';
|
|
|
18
18
|
import { CommentCreate, CommentCreateJson } from './events_comment_create.js';
|
|
19
19
|
import { CommentDelete } from './events_comment_delete.js';
|
|
20
20
|
import { CommentMove, CommentMoveJson } from './events_comment_move.js';
|
|
21
|
+
import { CommentCollapse, CommentCollapseJson } from './events_comment_collapse.js';
|
|
21
22
|
import { MarkerMove, MarkerMoveJson } from './events_marker_move.js';
|
|
22
23
|
import { Selected, SelectedJson } from './events_selected.js';
|
|
23
24
|
import { ThemeChange, ThemeChangeJson } from './events_theme_change.js';
|
|
@@ -62,6 +63,8 @@ export { CommentCreateJson };
|
|
|
62
63
|
export { CommentDelete };
|
|
63
64
|
export { CommentMove };
|
|
64
65
|
export { CommentMoveJson };
|
|
66
|
+
export { CommentCollapse };
|
|
67
|
+
export { CommentCollapseJson };
|
|
65
68
|
export { FinishedLoading };
|
|
66
69
|
export { MarkerMove };
|
|
67
70
|
export { MarkerMoveJson };
|
|
@@ -29,6 +29,11 @@ export declare class BlockChange extends BlockBase {
|
|
|
29
29
|
oldValue: unknown;
|
|
30
30
|
/** The new value of the element. */
|
|
31
31
|
newValue: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* If element is 'disabled', this is the language-neutral identifier of the
|
|
34
|
+
* reason why the block was or was not disabled.
|
|
35
|
+
*/
|
|
36
|
+
private disabledReason?;
|
|
32
37
|
/**
|
|
33
38
|
* @param opt_block The changed block. Undefined for a blank event.
|
|
34
39
|
* @param opt_element One of 'field', 'comment', 'disabled', etc.
|
|
@@ -53,6 +58,15 @@ export declare class BlockChange extends BlockBase {
|
|
|
53
58
|
* @internal
|
|
54
59
|
*/
|
|
55
60
|
static fromJson(json: BlockChangeJson, workspace: Workspace, event?: any): BlockChange;
|
|
61
|
+
/**
|
|
62
|
+
* Set the language-neutral identifier for the reason why the block was or was
|
|
63
|
+
* not disabled. This is only valid for events where element is 'disabled'.
|
|
64
|
+
* Defaults to 'MANUALLY_DISABLED'.
|
|
65
|
+
*
|
|
66
|
+
* @param disabledReason The identifier of the reason why the block was or was
|
|
67
|
+
* not disabled.
|
|
68
|
+
*/
|
|
69
|
+
setDisabledReason(disabledReason: string): void;
|
|
56
70
|
/**
|
|
57
71
|
* Does this event record any change of state?
|
|
58
72
|
*
|
|
@@ -80,5 +94,6 @@ export interface BlockChangeJson extends BlockBaseJson {
|
|
|
80
94
|
name?: string;
|
|
81
95
|
newValue: unknown;
|
|
82
96
|
oldValue: unknown;
|
|
97
|
+
disabledReason?: string;
|
|
83
98
|
}
|
|
84
99
|
//# sourceMappingURL=events_block_change.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. */
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Base class for comment events.
|
|
8
|
+
*
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
12
|
import { Abstract as AbstractEvent, AbstractEventJson } from './events_abstract.js';
|
|
8
13
|
import type { CommentCreate } from './events_comment_create.js';
|
|
9
14
|
import type { CommentDelete } from './events_comment_delete.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
7
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
8
|
import type { Workspace } from '../workspace.js';
|
|
9
9
|
/**
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
|
+
import type { Workspace } from '../workspace.js';
|
|
9
|
+
export declare class CommentCollapse extends CommentBase {
|
|
10
|
+
newCollapsed?: boolean | undefined;
|
|
11
|
+
type: string;
|
|
12
|
+
constructor(comment?: WorkspaceComment, newCollapsed?: boolean | undefined);
|
|
13
|
+
/**
|
|
14
|
+
* Encode the event as JSON.
|
|
15
|
+
*
|
|
16
|
+
* @returns JSON representation.
|
|
17
|
+
*/
|
|
18
|
+
toJson(): CommentCollapseJson;
|
|
19
|
+
/**
|
|
20
|
+
* Deserializes the JSON event.
|
|
21
|
+
*
|
|
22
|
+
* @param event The event to append new properties to. Should be a subclass
|
|
23
|
+
* of CommentCollapse, but we can't specify that due to the fact that
|
|
24
|
+
* parameters to static methods in subclasses must be supertypes of
|
|
25
|
+
* parameters to static methods in superclasses.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
static fromJson(json: CommentCollapseJson, workspace: Workspace, event?: any): CommentCollapse;
|
|
29
|
+
/**
|
|
30
|
+
* Run a collapse event.
|
|
31
|
+
*
|
|
32
|
+
* @param forward True if run forward, false if run backward (undo).
|
|
33
|
+
*/
|
|
34
|
+
run(forward: boolean): void;
|
|
35
|
+
}
|
|
36
|
+
export interface CommentCollapseJson extends CommentBaseJson {
|
|
37
|
+
newCollapsed: boolean;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=events_comment_collapse.d.ts.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import * as comments from '../serialization/workspace_comments.js';
|
|
7
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
9
|
import type { Workspace } from '../workspace.js';
|
|
9
10
|
/**
|
|
@@ -13,6 +14,8 @@ export declare class CommentCreate extends CommentBase {
|
|
|
13
14
|
type: string;
|
|
14
15
|
/** The XML representation of the created workspace comment. */
|
|
15
16
|
xml?: Element | DocumentFragment;
|
|
17
|
+
/** The JSON representation of the created workspace comment. */
|
|
18
|
+
json?: comments.State;
|
|
16
19
|
/**
|
|
17
20
|
* @param opt_comment The created comment.
|
|
18
21
|
* Undefined for a blank event.
|
|
@@ -43,5 +46,6 @@ export declare class CommentCreate extends CommentBase {
|
|
|
43
46
|
}
|
|
44
47
|
export interface CommentCreateJson extends CommentBaseJson {
|
|
45
48
|
xml: string;
|
|
49
|
+
json: object;
|
|
46
50
|
}
|
|
47
51
|
//# sourceMappingURL=events_comment_create.d.ts.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright 2018 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
6
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
+
import * as comments from '../serialization/workspace_comments.js';
|
|
7
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
8
9
|
import type { Workspace } from '../workspace.js';
|
|
9
10
|
/**
|
|
@@ -13,6 +14,8 @@ export declare class CommentDelete extends CommentBase {
|
|
|
13
14
|
type: string;
|
|
14
15
|
/** The XML representation of the deleted workspace comment. */
|
|
15
16
|
xml?: Element;
|
|
17
|
+
/** The JSON representation of the created workspace comment. */
|
|
18
|
+
json?: comments.State;
|
|
16
19
|
/**
|
|
17
20
|
* @param opt_comment The deleted comment.
|
|
18
21
|
* Undefined for a blank event.
|
|
@@ -43,5 +46,6 @@ export declare class CommentDelete extends CommentBase {
|
|
|
43
46
|
}
|
|
44
47
|
export interface CommentDeleteJson extends CommentBaseJson {
|
|
45
48
|
xml: string;
|
|
49
|
+
json: object;
|
|
46
50
|
}
|
|
47
51
|
//# sourceMappingURL=events_comment_delete.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Coordinate } from '../utils/coordinate.js';
|
|
7
|
-
import type { WorkspaceComment } from '../workspace_comment.js';
|
|
7
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
8
8
|
import { CommentBase, CommentBaseJson } from './events_comment_base.js';
|
|
9
9
|
import type { Workspace } from '../workspace.js';
|
|
10
10
|
/**
|
|
@@ -18,6 +18,16 @@ export declare class CommentMove extends CommentBase {
|
|
|
18
18
|
oldCoordinate_?: Coordinate;
|
|
19
19
|
/** The location of the comment after the move, in workspace coordinates. */
|
|
20
20
|
newCoordinate_?: Coordinate;
|
|
21
|
+
/**
|
|
22
|
+
* An explanation of what this move is for. Known values include:
|
|
23
|
+
* 'drag' -- A drag operation completed.
|
|
24
|
+
* 'snap' -- Comment got shifted to line up with the grid.
|
|
25
|
+
* 'inbounds' -- Block got pushed back into a non-scrolling workspace.
|
|
26
|
+
* 'create' -- Block created via deserialization.
|
|
27
|
+
* 'cleanup' -- Workspace aligned top-level blocks.
|
|
28
|
+
* Event merging may create multiple reasons: ['drag', 'inbounds', 'snap'].
|
|
29
|
+
*/
|
|
30
|
+
reason?: string[];
|
|
21
31
|
/**
|
|
22
32
|
* @param opt_comment The comment that is being moved. Undefined for a blank
|
|
23
33
|
* event.
|
|
@@ -28,6 +38,12 @@ export declare class CommentMove extends CommentBase {
|
|
|
28
38
|
* called once.
|
|
29
39
|
*/
|
|
30
40
|
recordNew(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the reason for a move event.
|
|
43
|
+
*
|
|
44
|
+
* @param reason Why is this move happening? 'drag', 'bump', 'snap', ...
|
|
45
|
+
*/
|
|
46
|
+
setReason(reason: string[]): void;
|
|
31
47
|
/**
|
|
32
48
|
* Override the location before the move. Use this if you don't create the
|
|
33
49
|
* event until the end of the move, but you know the original location.
|
package/core/events/utils.d.ts
CHANGED
|
@@ -127,6 +127,8 @@ export declare const COMMENT_CHANGE = "comment_change";
|
|
|
127
127
|
* Name of event that moves a comment.
|
|
128
128
|
*/
|
|
129
129
|
export declare const COMMENT_MOVE = "comment_move";
|
|
130
|
+
/** Type of event that moves a comment. */
|
|
131
|
+
export declare const COMMENT_COLLAPSE = "comment_collapse";
|
|
130
132
|
/**
|
|
131
133
|
* Name of event that records a workspace load.
|
|
132
134
|
*/
|
|
@@ -229,10 +231,8 @@ export declare function fromJson(json: any, workspace: Workspace): Abstract;
|
|
|
229
231
|
*/
|
|
230
232
|
export declare function get(eventType: string): new (...p1: any[]) => Abstract;
|
|
231
233
|
/**
|
|
232
|
-
*
|
|
234
|
+
* Set if a block is disabled depending on whether it is properly connected.
|
|
233
235
|
* Use this on applications where all blocks should be connected to a top block.
|
|
234
|
-
* Recommend setting the 'disable' option to 'false' in the config so that
|
|
235
|
-
* users don't try to re-enable disabled orphan blocks.
|
|
236
236
|
*
|
|
237
237
|
* @param event Custom data for event.
|
|
238
238
|
*/
|
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/flyout_base.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2011 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { BlockSvg } from './block_svg.js';
|
|
7
7
|
import { DeleteArea } from './delete_area.js';
|
|
8
8
|
import { FlyoutButton } from './flyout_button.js';
|
|
9
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
@@ -119,6 +119,10 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
119
119
|
* List of visible buttons.
|
|
120
120
|
*/
|
|
121
121
|
protected buttons_: FlyoutButton[];
|
|
122
|
+
/**
|
|
123
|
+
* List of visible buttons and blocks.
|
|
124
|
+
*/
|
|
125
|
+
protected contents: FlyoutItem[];
|
|
122
126
|
/**
|
|
123
127
|
* List of event listeners.
|
|
124
128
|
*/
|
|
@@ -279,6 +283,18 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
279
283
|
* @param visible Whether the container is visible.
|
|
280
284
|
*/
|
|
281
285
|
setContainerVisible(visible: boolean): void;
|
|
286
|
+
/**
|
|
287
|
+
* Get the list of buttons and blocks of the current flyout.
|
|
288
|
+
*
|
|
289
|
+
* @returns The array of flyout buttons and blocks.
|
|
290
|
+
*/
|
|
291
|
+
getContents(): FlyoutItem[];
|
|
292
|
+
/**
|
|
293
|
+
* Store the list of buttons and blocks on the flyout.
|
|
294
|
+
*
|
|
295
|
+
* @param contents - The array of items for the flyout.
|
|
296
|
+
*/
|
|
297
|
+
setContents(contents: FlyoutItem[]): void;
|
|
282
298
|
/**
|
|
283
299
|
* Update the display property of the flyout based whether it thinks it should
|
|
284
300
|
* be visible and whether its containing workspace is visible.
|
package/core/flyout_button.d.ts
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
import { Coordinate } from './utils/coordinate.js';
|
|
7
7
|
import type * as toolbox from './utils/toolbox.js';
|
|
8
8
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
9
|
+
import type { IASTNodeLocationSvg } from './blockly.js';
|
|
9
10
|
/**
|
|
10
11
|
* Class for a button or label in the flyout.
|
|
11
12
|
*/
|
|
12
|
-
export declare class FlyoutButton {
|
|
13
|
+
export declare class FlyoutButton implements IASTNodeLocationSvg {
|
|
13
14
|
private readonly workspace;
|
|
14
15
|
private readonly targetWorkspace;
|
|
15
16
|
private readonly isLabel_;
|
|
@@ -34,6 +35,11 @@ export declare class FlyoutButton {
|
|
|
34
35
|
private svgGroup;
|
|
35
36
|
/** The SVG element with the text of the label or button. */
|
|
36
37
|
private svgText;
|
|
38
|
+
/**
|
|
39
|
+
* Holds the cursors svg element when the cursor is attached to the button.
|
|
40
|
+
* This is null if there is no cursor on the button.
|
|
41
|
+
*/
|
|
42
|
+
cursorSvg: SVGElement | null;
|
|
37
43
|
/**
|
|
38
44
|
* @param workspace The workspace in which to place this button.
|
|
39
45
|
* @param targetWorkspace The flyout's target workspace.
|
|
@@ -76,8 +82,27 @@ export declare class FlyoutButton {
|
|
|
76
82
|
* @returns The target workspace of the flyout where this button resides.
|
|
77
83
|
*/
|
|
78
84
|
getTargetWorkspace(): WorkspaceSvg;
|
|
85
|
+
/**
|
|
86
|
+
* Get the button's workspace.
|
|
87
|
+
*
|
|
88
|
+
* @returns The workspace in which to place this button.
|
|
89
|
+
*/
|
|
90
|
+
getWorkspace(): WorkspaceSvg;
|
|
79
91
|
/** Dispose of this button. */
|
|
80
92
|
dispose(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Add the cursor SVG to this buttons's SVG group.
|
|
95
|
+
*
|
|
96
|
+
* @param cursorSvg The SVG root of the cursor to be added to the button SVG
|
|
97
|
+
* group.
|
|
98
|
+
*/
|
|
99
|
+
setCursorSvg(cursorSvg: SVGElement): void;
|
|
100
|
+
/**
|
|
101
|
+
* Required by IASTNodeLocationSvg, but not used. A marker cannot be set on a
|
|
102
|
+
* button. If the 'mark' shortcut is used on a button, its associated callback
|
|
103
|
+
* function is triggered.
|
|
104
|
+
*/
|
|
105
|
+
setMarkerSvg(): void;
|
|
81
106
|
/**
|
|
82
107
|
* Do something when the button is clicked.
|
|
83
108
|
*
|
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
|