blockly 12.5.1 → 13.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +645 -533
- package/blockly.mjs +13 -5
- package/blockly_compressed.js +610 -507
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +16 -16
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +1 -1
- package/core/block_svg.d.ts +39 -16
- package/core/blockly.d.ts +21 -16
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +5 -0
- package/core/bubbles/textinput_bubble.d.ts +5 -0
- package/core/comments/comment_editor.d.ts +2 -2
- package/core/comments/rendered_workspace_comment.d.ts +6 -1
- package/core/common.d.ts +1 -1
- package/core/css.d.ts +2 -1
- package/core/dragging/block_drag_strategy.d.ts +84 -14
- package/core/dragging/bubble_drag_strategy.d.ts +5 -4
- package/core/dragging/comment_drag_strategy.d.ts +4 -4
- package/core/dragging/dragger.d.ts +13 -14
- package/core/events/events_block_create.d.ts +0 -3
- package/core/events/events_block_delete.d.ts +0 -3
- package/core/events/events_comment_create.d.ts +0 -3
- package/core/events/events_comment_delete.d.ts +0 -3
- package/core/field.d.ts +69 -0
- package/core/flyout_base.d.ts +1 -125
- package/core/flyout_button.d.ts +9 -0
- package/core/flyout_horizontal.d.ts +0 -11
- package/core/flyout_vertical.d.ts +0 -11
- package/core/gesture.d.ts +0 -12
- package/core/hints.d.ts +44 -0
- package/core/icons/icon.d.ts +6 -0
- package/core/inputs/input.d.ts +7 -1
- package/core/interfaces/i_bounded_element.d.ts +7 -0
- package/core/interfaces/i_bubble.d.ts +3 -2
- package/core/interfaces/i_collapsible_toolbox_item.d.ts +5 -1
- package/core/interfaces/i_draggable.d.ts +22 -17
- package/core/interfaces/i_dragger.d.ts +19 -10
- package/core/interfaces/i_flyout.d.ts +1 -31
- package/core/interfaces/i_focusable_node.d.ts +6 -0
- package/core/interfaces/i_focusable_tree.d.ts +8 -0
- package/core/interfaces/i_json_block_definition.d.ts +102 -0
- package/core/interfaces/i_navigation_policy.d.ts +12 -0
- package/core/interfaces/i_selectable.d.ts +2 -2
- package/core/interfaces/i_selectable_toolbox_item.d.ts +3 -3
- package/core/interfaces/i_toolbox.d.ts +4 -0
- package/core/interfaces/i_toolbox_item.d.ts +6 -0
- package/core/keyboard_nav/keyboard_mover.d.ts +138 -0
- package/core/keyboard_nav/move_indicator.d.ts +35 -0
- package/core/keyboard_nav/{block_comment_navigation_policy.d.ts → navigation_policies/block_comment_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/{block_navigation_policy.d.ts → navigation_policies/block_navigation_policy.d.ts} +17 -25
- package/core/keyboard_nav/{comment_bar_button_navigation_policy.d.ts → navigation_policies/comment_bar_button_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/{comment_editor_navigation_policy.d.ts → navigation_policies/comment_editor_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/{connection_navigation_policy.d.ts → navigation_policies/connection_navigation_policy.d.ts} +11 -16
- package/core/keyboard_nav/{field_navigation_policy.d.ts → navigation_policies/field_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/{flyout_button_navigation_policy.d.ts → navigation_policies/flyout_button_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/{flyout_separator_navigation_policy.d.ts → navigation_policies/flyout_separator_navigation_policy.d.ts} +9 -3
- package/core/keyboard_nav/{icon_navigation_policy.d.ts → navigation_policies/icon_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/navigation_policies/toolbox_item_navigation_policy.d.ts +64 -0
- package/core/keyboard_nav/{workspace_comment_navigation_policy.d.ts → navigation_policies/workspace_comment_navigation_policy.d.ts} +14 -9
- package/core/keyboard_nav/{workspace_navigation_policy.d.ts → navigation_policies/workspace_navigation_policy.d.ts} +10 -3
- package/core/keyboard_nav/navigators/flyout_navigator.d.ts +63 -0
- package/core/keyboard_nav/navigators/navigator.d.ts +225 -0
- package/core/keyboard_nav/navigators/toolbox_navigator.d.ts +70 -0
- package/core/registry.d.ts +0 -2
- package/core/renderers/common/constants.d.ts +4 -7
- package/core/renderers/common/i_path_object.d.ts +8 -0
- package/core/renderers/common/path_object.d.ts +5 -14
- package/core/renderers/common/renderer.d.ts +3 -3
- package/core/renderers/zelos/constants.d.ts +1 -14
- package/core/renderers/zelos/measurables/bottom_row.d.ts +1 -1
- package/core/renderers/zelos/measurables/top_row.d.ts +1 -1
- package/core/renderers/zelos/path_object.d.ts +0 -3
- package/core/renderers/zelos/renderer.d.ts +8 -0
- package/core/shortcut_items.d.ts +63 -1
- package/core/theme.d.ts +0 -2
- package/core/toast.d.ts +2 -11
- package/core/toolbox/category.d.ts +5 -0
- package/core/toolbox/separator.d.ts +4 -0
- package/core/toolbox/toolbox.d.ts +12 -22
- package/core/toolbox/toolbox_item.d.ts +4 -0
- package/core/utils/aria.d.ts +292 -23
- package/core/utils/shortcut_formatting.d.ts +24 -0
- package/core/utils/useragent.d.ts +1 -0
- package/core/workspace_audio.d.ts +23 -0
- package/core/workspace_svg.d.ts +8 -50
- package/dart_compressed.js +9 -9
- package/dart_compressed.js.map +1 -1
- package/index.mjs +13 -5
- package/javascript_compressed.js +11 -10
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +7 -7
- package/lua_compressed.js.map +1 -1
- package/msg/ab.js +8 -0
- package/msg/ab.mjs +8 -0
- package/msg/ace.js +8 -0
- package/msg/ace.mjs +8 -0
- package/msg/af.js +8 -0
- package/msg/af.mjs +8 -0
- package/msg/am.js +8 -0
- package/msg/am.mjs +8 -0
- package/msg/ar.js +8 -0
- package/msg/ar.mjs +8 -0
- package/msg/ast.js +8 -0
- package/msg/ast.mjs +8 -0
- package/msg/az.js +8 -0
- package/msg/az.mjs +8 -0
- package/msg/ba.js +8 -0
- package/msg/ba.mjs +8 -0
- package/msg/bcc.js +8 -0
- package/msg/bcc.mjs +8 -0
- package/msg/be-tarask.js +8 -0
- package/msg/be-tarask.mjs +8 -0
- package/msg/be.js +8 -0
- package/msg/be.mjs +8 -0
- package/msg/bg.js +8 -0
- package/msg/bg.mjs +8 -0
- package/msg/bn.js +8 -0
- package/msg/bn.mjs +8 -0
- package/msg/br.js +8 -0
- package/msg/br.mjs +8 -0
- package/msg/bs.js +8 -0
- package/msg/bs.mjs +8 -0
- package/msg/ca.js +8 -0
- package/msg/ca.mjs +8 -0
- package/msg/cdo.js +8 -0
- package/msg/cdo.mjs +8 -0
- package/msg/ce.js +8 -0
- package/msg/ce.mjs +8 -0
- package/msg/cs.js +8 -0
- package/msg/cs.mjs +8 -0
- package/msg/da.js +8 -0
- package/msg/da.mjs +8 -0
- package/msg/de.js +8 -0
- package/msg/de.mjs +8 -0
- package/msg/diq.js +8 -0
- package/msg/diq.mjs +8 -0
- package/msg/dtp.js +8 -0
- package/msg/dtp.mjs +8 -0
- package/msg/dty.js +8 -0
- package/msg/dty.mjs +8 -0
- package/msg/ee.js +8 -0
- package/msg/ee.mjs +8 -0
- package/msg/el.js +8 -0
- package/msg/el.mjs +8 -0
- package/msg/en-gb.js +8 -0
- package/msg/en-gb.mjs +8 -0
- package/msg/en.js +8 -0
- package/msg/en.mjs +8 -0
- package/msg/eo.js +8 -0
- package/msg/eo.mjs +8 -0
- package/msg/es.js +8 -0
- package/msg/es.mjs +8 -0
- package/msg/et.js +8 -0
- package/msg/et.mjs +8 -0
- package/msg/eu.js +8 -0
- package/msg/eu.mjs +8 -0
- package/msg/fa.js +8 -0
- package/msg/fa.mjs +8 -0
- package/msg/fi.js +8 -0
- package/msg/fi.mjs +8 -0
- package/msg/fo.js +8 -0
- package/msg/fo.mjs +8 -0
- package/msg/fr.js +8 -0
- package/msg/fr.mjs +8 -0
- package/msg/frr.js +8 -0
- package/msg/frr.mjs +8 -0
- package/msg/gl.js +8 -0
- package/msg/gl.mjs +8 -0
- package/msg/gn.js +8 -0
- package/msg/gn.mjs +8 -0
- package/msg/gor.js +8 -0
- package/msg/gor.mjs +8 -0
- package/msg/ha.js +8 -0
- package/msg/ha.mjs +8 -0
- package/msg/hak.js +8 -0
- package/msg/hak.mjs +8 -0
- package/msg/he.js +8 -0
- package/msg/he.mjs +8 -0
- package/msg/hi.js +8 -0
- package/msg/hi.mjs +8 -0
- package/msg/hr.js +8 -0
- package/msg/hr.mjs +8 -0
- package/msg/hrx.js +8 -0
- package/msg/hrx.mjs +8 -0
- package/msg/hsb.js +8 -0
- package/msg/hsb.mjs +8 -0
- package/msg/hu.js +8 -0
- package/msg/hu.mjs +8 -0
- package/msg/hy.js +8 -0
- package/msg/hy.mjs +8 -0
- package/msg/ia.js +8 -0
- package/msg/ia.mjs +8 -0
- package/msg/id.js +8 -0
- package/msg/id.mjs +8 -0
- package/msg/ig.js +8 -0
- package/msg/ig.mjs +8 -0
- package/msg/inh.js +8 -0
- package/msg/inh.mjs +8 -0
- package/msg/is.js +8 -0
- package/msg/is.mjs +8 -0
- package/msg/it.js +8 -0
- package/msg/it.mjs +8 -0
- package/msg/ja.js +8 -0
- package/msg/ja.mjs +8 -0
- package/msg/ka.js +8 -0
- package/msg/ka.mjs +8 -0
- package/msg/kab.js +8 -0
- package/msg/kab.mjs +8 -0
- package/msg/kbd-cyrl.js +8 -0
- package/msg/kbd-cyrl.mjs +8 -0
- package/msg/km.js +8 -0
- package/msg/km.mjs +8 -0
- package/msg/kn.js +8 -0
- package/msg/kn.mjs +8 -0
- package/msg/ko.js +8 -0
- package/msg/ko.mjs +8 -0
- package/msg/ksh.js +8 -0
- package/msg/ksh.mjs +8 -0
- package/msg/ku-latn.js +8 -0
- package/msg/ku-latn.mjs +8 -0
- package/msg/ky.js +8 -0
- package/msg/ky.mjs +8 -0
- package/msg/la.js +8 -0
- package/msg/la.mjs +8 -0
- package/msg/lb.js +8 -0
- package/msg/lb.mjs +8 -0
- package/msg/lki.js +8 -0
- package/msg/lki.mjs +8 -0
- package/msg/lo.js +8 -0
- package/msg/lo.mjs +8 -0
- package/msg/lrc.js +8 -0
- package/msg/lrc.mjs +8 -0
- package/msg/lt.js +8 -0
- package/msg/lt.mjs +8 -0
- package/msg/lv.js +8 -0
- package/msg/lv.mjs +8 -0
- package/msg/mg.js +8 -0
- package/msg/mg.mjs +8 -0
- package/msg/mk.js +8 -0
- package/msg/mk.mjs +8 -0
- package/msg/ml.js +8 -0
- package/msg/ml.mjs +8 -0
- package/msg/mnw.js +8 -0
- package/msg/mnw.mjs +8 -0
- package/msg/ms.js +8 -0
- package/msg/ms.mjs +8 -0
- package/msg/my.js +8 -0
- package/msg/my.mjs +8 -0
- package/msg/mzn.js +8 -0
- package/msg/mzn.mjs +8 -0
- package/msg/nb.js +8 -0
- package/msg/nb.mjs +8 -0
- package/msg/ne.js +8 -0
- package/msg/ne.mjs +8 -0
- package/msg/nl.js +8 -0
- package/msg/nl.mjs +8 -0
- package/msg/oc.js +8 -0
- package/msg/oc.mjs +8 -0
- package/msg/olo.js +8 -0
- package/msg/olo.mjs +8 -0
- package/msg/pa.js +8 -0
- package/msg/pa.mjs +8 -0
- package/msg/pl.js +8 -0
- package/msg/pl.mjs +8 -0
- package/msg/pms.js +8 -0
- package/msg/pms.mjs +8 -0
- package/msg/ps.js +8 -0
- package/msg/ps.mjs +8 -0
- package/msg/pt-br.js +8 -0
- package/msg/pt-br.mjs +8 -0
- package/msg/pt.js +8 -0
- package/msg/pt.mjs +8 -0
- package/msg/ro.js +8 -0
- package/msg/ro.mjs +8 -0
- package/msg/ru.js +8 -0
- package/msg/ru.mjs +8 -0
- package/msg/sc.js +8 -0
- package/msg/sc.mjs +8 -0
- package/msg/sco.js +8 -0
- package/msg/sco.mjs +8 -0
- package/msg/sd.js +8 -0
- package/msg/sd.mjs +8 -0
- package/msg/shn.js +8 -0
- package/msg/shn.mjs +8 -0
- package/msg/si.js +8 -0
- package/msg/si.mjs +8 -0
- package/msg/sk.js +8 -0
- package/msg/sk.mjs +8 -0
- package/msg/skr-arab.js +8 -0
- package/msg/skr-arab.mjs +8 -0
- package/msg/sl.js +8 -0
- package/msg/sl.mjs +8 -0
- package/msg/smn.js +8 -0
- package/msg/smn.mjs +8 -0
- package/msg/sq.js +8 -0
- package/msg/sq.mjs +8 -0
- package/msg/sr-latn.js +8 -0
- package/msg/sr-latn.mjs +8 -0
- package/msg/sr.js +8 -0
- package/msg/sr.mjs +8 -0
- package/msg/sv.js +8 -0
- package/msg/sv.mjs +8 -0
- package/msg/sw.js +8 -0
- package/msg/sw.mjs +8 -0
- package/msg/ta.js +8 -0
- package/msg/ta.mjs +8 -0
- package/msg/tcy.js +8 -0
- package/msg/tcy.mjs +8 -0
- package/msg/tdd.js +8 -0
- package/msg/tdd.mjs +8 -0
- package/msg/te.js +8 -0
- package/msg/te.mjs +8 -0
- package/msg/th.js +8 -0
- package/msg/th.mjs +8 -0
- package/msg/ti.js +8 -0
- package/msg/ti.mjs +8 -0
- package/msg/tl.js +8 -0
- package/msg/tl.mjs +8 -0
- package/msg/tlh.js +8 -0
- package/msg/tlh.mjs +8 -0
- package/msg/tr.js +8 -0
- package/msg/tr.mjs +8 -0
- package/msg/ug-arab.js +8 -0
- package/msg/ug-arab.mjs +8 -0
- package/msg/uk.js +8 -0
- package/msg/uk.mjs +8 -0
- package/msg/ur.js +8 -0
- package/msg/ur.mjs +8 -0
- package/msg/uz.js +8 -0
- package/msg/uz.mjs +8 -0
- package/msg/vi.js +8 -0
- package/msg/vi.mjs +8 -0
- package/msg/xmf.js +8 -0
- package/msg/xmf.mjs +8 -0
- package/msg/yo.js +8 -0
- package/msg/yo.mjs +8 -0
- package/msg/zgh.js +8 -0
- package/msg/zgh.mjs +8 -0
- package/msg/zh-hans.js +8 -0
- package/msg/zh-hans.mjs +8 -0
- package/msg/zh-hant.js +8 -0
- package/msg/zh-hant.mjs +8 -0
- package/package.json +11 -11
- package/php_compressed.js +2 -2
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +2 -2
- package/python_compressed.js.map +1 -1
- package/core/flyout_navigator.d.ts +0 -11
- package/core/keyboard_nav/flyout_navigation_policy.d.ts +0 -65
- package/core/keyboard_nav/line_cursor.d.ts +0 -187
- package/core/keyboard_nav/marker.d.ts +0 -53
- package/core/marker_manager.d.ts +0 -72
- package/core/navigator.d.ts +0 -65
- package/media/sprites.png +0 -0
package/core/block.d.ts
CHANGED
|
@@ -548,6 +548,7 @@ export declare class Block {
|
|
|
548
548
|
/**
|
|
549
549
|
* Return all variables referenced by this block.
|
|
550
550
|
*
|
|
551
|
+
* @deprecated v13: Use Blockly.Block.getVarModels().map(m => m.getId())
|
|
551
552
|
* @returns List of variable ids.
|
|
552
553
|
*/
|
|
553
554
|
getVars(): string[];
|
|
@@ -555,7 +556,6 @@ export declare class Block {
|
|
|
555
556
|
* Return all variables referenced by this block.
|
|
556
557
|
*
|
|
557
558
|
* @returns List of variable models.
|
|
558
|
-
* @internal
|
|
559
559
|
*/
|
|
560
560
|
getVarModels(): IVariableModel<IVariableState>[];
|
|
561
561
|
/**
|
package/core/block_svg.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
|
21
21
|
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
22
22
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
23
23
|
import { IDeletable } from './interfaces/i_deletable.js';
|
|
24
|
-
import type { IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
|
|
24
|
+
import type { DragDisposition, IDragStrategy, IDraggable } from './interfaces/i_draggable.js';
|
|
25
25
|
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
26
26
|
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
27
27
|
import { IIcon } from './interfaces/i_icon.js';
|
|
@@ -100,9 +100,9 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
100
100
|
readonly rendered = true;
|
|
101
101
|
private visuallyDisabled;
|
|
102
102
|
workspace: WorkspaceSvg;
|
|
103
|
-
outputConnection: RenderedConnection;
|
|
104
|
-
nextConnection: RenderedConnection;
|
|
105
|
-
previousConnection: RenderedConnection;
|
|
103
|
+
outputConnection: RenderedConnection | null;
|
|
104
|
+
nextConnection: RenderedConnection | null;
|
|
105
|
+
previousConnection: RenderedConnection | null;
|
|
106
106
|
private translation;
|
|
107
107
|
/** Whether this block is currently being dragged. */
|
|
108
108
|
private dragging;
|
|
@@ -301,6 +301,10 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
301
301
|
* @internal
|
|
302
302
|
*/
|
|
303
303
|
setDragging(adding: boolean): void;
|
|
304
|
+
/**
|
|
305
|
+
* Returns whether or not this block is currently being dragged.
|
|
306
|
+
*/
|
|
307
|
+
isDragging(): boolean;
|
|
304
308
|
/**
|
|
305
309
|
* Set whether this block is movable or not.
|
|
306
310
|
*
|
|
@@ -688,15 +692,6 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
688
692
|
* @internal
|
|
689
693
|
*/
|
|
690
694
|
fadeForReplacement(add: boolean): void;
|
|
691
|
-
/**
|
|
692
|
-
* Visual effect to show that if the dragging block is dropped it will connect
|
|
693
|
-
* to this input.
|
|
694
|
-
*
|
|
695
|
-
* @param conn The connection on the input to highlight.
|
|
696
|
-
* @param add True if highlighting should be added.
|
|
697
|
-
* @internal
|
|
698
|
-
*/
|
|
699
|
-
highlightShapeForInput(conn: RenderedConnection, add: boolean): void;
|
|
700
695
|
/**
|
|
701
696
|
* Returns the drag strategy currently in use by this block.
|
|
702
697
|
*
|
|
@@ -711,11 +706,11 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
711
706
|
/** Returns whether this block is movable or not. */
|
|
712
707
|
isMovable(): boolean;
|
|
713
708
|
/** Starts a drag on the block. */
|
|
714
|
-
startDrag(e?: PointerEvent):
|
|
709
|
+
startDrag(e?: PointerEvent | KeyboardEvent): IDraggable;
|
|
715
710
|
/** Drags the block to the given location. */
|
|
716
|
-
drag(newLoc: Coordinate, e?: PointerEvent): void;
|
|
711
|
+
drag(newLoc: Coordinate, e?: PointerEvent | KeyboardEvent): void;
|
|
717
712
|
/** Ends the drag on the block. */
|
|
718
|
-
endDrag(e
|
|
713
|
+
endDrag(e: PointerEvent | KeyboardEvent | undefined, disposition: DragDisposition): void;
|
|
719
714
|
/** Moves the block back to where it was at the start of a drag. */
|
|
720
715
|
revertDrag(): void;
|
|
721
716
|
/**
|
|
@@ -733,5 +728,33 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
733
728
|
onNodeBlur(): void;
|
|
734
729
|
/** See IFocusableNode.canBeFocused. */
|
|
735
730
|
canBeFocused(): boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Handles the user acting on this block via keyboard navigation.
|
|
733
|
+
* If this block is in the flyout, a new copy is spawned in move mode on the
|
|
734
|
+
* main workspace. If this block has a single full-block field, that field
|
|
735
|
+
* will be focused. Otherwise, this is a no-op.
|
|
736
|
+
*/
|
|
737
|
+
performAction(): void;
|
|
738
|
+
/**
|
|
739
|
+
* Returns a set of all of the parent blocks of the given block.
|
|
740
|
+
*
|
|
741
|
+
* @internal
|
|
742
|
+
* @returns A set of the parents of the given block.
|
|
743
|
+
*/
|
|
744
|
+
getParents(): Set<BlockSvg>;
|
|
745
|
+
/**
|
|
746
|
+
* Returns a set of all of the parent blocks connected to an output of the
|
|
747
|
+
* given block or one of its parents. Also includes the given block.
|
|
748
|
+
*
|
|
749
|
+
* @internal
|
|
750
|
+
* @returns A set of the output-connected parents of the given block.
|
|
751
|
+
*/
|
|
752
|
+
getOutputParents(): Set<BlockSvg>;
|
|
753
|
+
/**
|
|
754
|
+
* Returns an ID for the visual "row" this block is part of.
|
|
755
|
+
*
|
|
756
|
+
* @internal
|
|
757
|
+
*/
|
|
758
|
+
getRowId(): string;
|
|
736
759
|
}
|
|
737
760
|
//# sourceMappingURL=block_svg.d.ts.map
|
package/core/blockly.d.ts
CHANGED
|
@@ -63,13 +63,15 @@ import * as icons from './icons.js';
|
|
|
63
63
|
import { inject } from './inject.js';
|
|
64
64
|
import * as inputs from './inputs.js';
|
|
65
65
|
import { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
66
|
+
import { Direction, KeyboardMover } from './keyboard_nav/keyboard_mover.js';
|
|
67
|
+
import { MoveIndicator } from './keyboard_nav/move_indicator.js';
|
|
66
68
|
import { LabelFlyoutInflater } from './label_flyout_inflater.js';
|
|
67
69
|
import { SeparatorFlyoutInflater } from './separator_flyout_inflater.js';
|
|
68
70
|
import { FocusableTreeTraverser } from './utils/focusable_tree_traverser.js';
|
|
69
71
|
import { Input } from './inputs/input.js';
|
|
70
72
|
import { InsertionMarkerPreviewer } from './insertion_marker_previewer.js';
|
|
71
73
|
import { IAutoHideable } from './interfaces/i_autohideable.js';
|
|
72
|
-
import { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
74
|
+
import { IBoundedElement, isBoundedElement } from './interfaces/i_bounded_element.js';
|
|
73
75
|
import { IBubble } from './interfaces/i_bubble.js';
|
|
74
76
|
import { ICollapsibleToolboxItem } from './interfaces/i_collapsible_toolbox_item.js';
|
|
75
77
|
import { IComponent } from './interfaces/i_component.js';
|
|
@@ -80,7 +82,7 @@ import { ICopyData, ICopyable, isCopyable } from './interfaces/i_copyable.js';
|
|
|
80
82
|
import { IDeletable, isDeletable } from './interfaces/i_deletable.js';
|
|
81
83
|
import { IDeleteArea } from './interfaces/i_delete_area.js';
|
|
82
84
|
import { IDragTarget } from './interfaces/i_drag_target.js';
|
|
83
|
-
import { IDragStrategy, IDraggable, isDraggable } from './interfaces/i_draggable.js';
|
|
85
|
+
import { DragDisposition, IDragStrategy, IDraggable, isDraggable } from './interfaces/i_draggable.js';
|
|
84
86
|
import { IDragger } from './interfaces/i_dragger.js';
|
|
85
87
|
import { IFlyout } from './interfaces/i_flyout.js';
|
|
86
88
|
import { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
@@ -104,12 +106,10 @@ import { IToolboxItem } from './interfaces/i_toolbox_item.js';
|
|
|
104
106
|
import { IVariableBackedParameterModel, isVariableBackedParameterModel } from './interfaces/i_variable_backed_parameter_model.js';
|
|
105
107
|
import { IVariableMap } from './interfaces/i_variable_map.js';
|
|
106
108
|
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
107
|
-
import {
|
|
108
|
-
import { Marker } from './keyboard_nav/marker.js';
|
|
109
|
+
import { ToolboxNavigator } from './keyboard_nav/navigators/toolbox_navigator.js';
|
|
109
110
|
import { KeyboardNavigationController, keyboardNavigationController } from './keyboard_navigation_controller.js';
|
|
110
111
|
import type { LayerManager } from './layer_manager.js';
|
|
111
112
|
import * as layers from './layers.js';
|
|
112
|
-
import { MarkerManager } from './marker_manager.js';
|
|
113
113
|
import { Menu } from './menu.js';
|
|
114
114
|
import { MenuItem } from './menuitem.js';
|
|
115
115
|
import { MetricsManager } from './metrics_manager.js';
|
|
@@ -269,18 +269,23 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
|
|
|
269
269
|
* procedure blocks.
|
|
270
270
|
*/
|
|
271
271
|
export declare const PROCEDURE_CATEGORY_NAME: string;
|
|
272
|
-
export * from './flyout_navigator.js';
|
|
273
272
|
export * from './interfaces/i_navigation_policy.js';
|
|
274
|
-
export * from './keyboard_nav/
|
|
275
|
-
export * from './keyboard_nav/
|
|
276
|
-
export * from './keyboard_nav/
|
|
277
|
-
export * from './keyboard_nav/
|
|
278
|
-
export * from './keyboard_nav/
|
|
279
|
-
export * from './keyboard_nav/
|
|
280
|
-
export * from './keyboard_nav/
|
|
281
|
-
export * from './
|
|
273
|
+
export * from './keyboard_nav/navigation_policies/block_comment_navigation_policy.js';
|
|
274
|
+
export * from './keyboard_nav/navigation_policies/block_navigation_policy.js';
|
|
275
|
+
export * from './keyboard_nav/navigation_policies/comment_bar_button_navigation_policy.js';
|
|
276
|
+
export * from './keyboard_nav/navigation_policies/comment_editor_navigation_policy.js';
|
|
277
|
+
export * from './keyboard_nav/navigation_policies/connection_navigation_policy.js';
|
|
278
|
+
export * from './keyboard_nav/navigation_policies/field_navigation_policy.js';
|
|
279
|
+
export * from './keyboard_nav/navigation_policies/flyout_button_navigation_policy.js';
|
|
280
|
+
export * from './keyboard_nav/navigation_policies/flyout_separator_navigation_policy.js';
|
|
281
|
+
export * from './keyboard_nav/navigation_policies/icon_navigation_policy.js';
|
|
282
|
+
export * from './keyboard_nav/navigation_policies/toolbox_item_navigation_policy.js';
|
|
283
|
+
export * from './keyboard_nav/navigation_policies/workspace_comment_navigation_policy.js';
|
|
284
|
+
export * from './keyboard_nav/navigation_policies/workspace_navigation_policy.js';
|
|
285
|
+
export * from './keyboard_nav/navigators/flyout_navigator.js';
|
|
286
|
+
export * from './keyboard_nav/navigators/navigator.js';
|
|
282
287
|
export * from './toast.js';
|
|
283
|
-
export { Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, DeleteArea, DragTarget, Events, Extensions,
|
|
288
|
+
export { Block, BlockSvg, BlocklyOptions, Blocks, CollapsibleToolboxCategory, ComponentManager, Connection, ConnectionChecker, ConnectionDB, ConnectionType, ContextMenu, ContextMenuItems, ContextMenuRegistry, Css, DeleteArea, DragTarget, Events, Extensions, Procedures, ShortcutItems, Themes, Tooltip, Touch, Variables, VariablesDynamic, WidgetDiv, Xml, blockAnimations, blockRendering, browserEvents, bubbles, bumpObjects, clipboard, comments, common, constants, dialog, dragging, fieldRegistry, geras, Procedures as procedures, registry, thrasos, uiPosition, utils, zelos, };
|
|
284
289
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
285
|
-
export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, FocusManager, FocusableTreeTraverser, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IFocusableNode, IFocusableTree, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, KeyboardNavigationController, LabelFlyoutInflater, LayerManager,
|
|
290
|
+
export { BlockFlyoutInflater, ButtonFlyoutInflater, CodeGenerator, Direction, DragDisposition, Field, FieldCheckbox, FieldCheckboxConfig, FieldCheckboxFromJsonConfig, FieldCheckboxValidator, FieldConfig, FieldDropdown, FieldDropdownConfig, FieldDropdownFromJsonConfig, FieldDropdownValidator, FieldImage, FieldImageConfig, FieldImageFromJsonConfig, FieldLabel, FieldLabelConfig, FieldLabelFromJsonConfig, FieldLabelSerializable, FieldNumber, FieldNumberConfig, FieldNumberFromJsonConfig, FieldNumberValidator, FieldTextInput, FieldTextInputConfig, FieldTextInputFromJsonConfig, FieldTextInputValidator, FieldValidator, FieldVariable, FieldVariableConfig, FieldVariableFromJsonConfig, FieldVariableValidator, Flyout, FlyoutButton, FlyoutItem, FlyoutMetricsManager, FlyoutSeparator, FocusManager, FocusableTreeTraverser, CodeGenerator as Generator, Gesture, Grid, HorizontalFlyout, IAutoHideable, IBoundedElement, IBubble, ICollapsibleToolboxItem, IComponent, IConnectionChecker, IConnectionPreviewer, IContextMenu, ICopyData, ICopyable, IDeletable, IDeleteArea, IDragStrategy, IDragTarget, IDraggable, IDragger, IFlyout, IFlyoutInflater, IFocusableNode, IFocusableTree, IHasBubble, IIcon, IKeyboardAccessible, IMetricsManager, IMovable, IObservable, IPaster, IPositionable, IRegistrable, IRenderedElement, ISelectable, ISelectableToolboxItem, ISerializable, IStyleable, IToolbox, IToolboxItem, IVariableBackedParameterModel, IVariableMap, IVariableModel, IVariableState, ImageProperties, Input, InsertionMarkerPreviewer, KeyboardMover, KeyboardNavigationController, LabelFlyoutInflater, LayerManager, Menu, MenuGenerator, MenuGeneratorFunction, MenuItem, MenuOption, MetricsManager, MoveIndicator, Msg, Names, Options, RenderedConnection, ReturnEphemeralFocus, Scrollbar, ScrollbarPair, SeparatorFlyoutInflater, ShortcutRegistry, Theme, ThemeManager, Toolbox, ToolboxCategory, ToolboxItem, ToolboxNavigator, ToolboxSeparator, Trashcan, UnattachedFieldError, VariableMap, VariableModel, VerticalFlyout, Workspace, WorkspaceAudio, WorkspaceDragger, WorkspaceSvg, ZoomControls, config, getFocusManager, hasBubble, icons, inject, inputs, isBoundedElement, isCopyable, isDeletable, isDraggable, isIcon, isObservable, isPaster, isRenderedElement, isSelectable, isSerializable, isVariableBackedParameterModel, keyboardNavigationController, layers, renderManagement, serialization, setLocale, };
|
|
286
291
|
//# sourceMappingURL=blockly.d.ts.map
|
package/core/bubbles/bubble.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { IBoundedElement } from '../interfaces/i_bounded_element.js';
|
|
6
7
|
import { IBubble } from '../interfaces/i_bubble.js';
|
|
7
8
|
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
8
9
|
import type { IFocusableTree } from '../interfaces/i_focusable_tree.js';
|
|
@@ -17,7 +18,7 @@ import { WorkspaceSvg } from '../workspace_svg.js';
|
|
|
17
18
|
* bubble, where it has a "tail" that points to the block, and a "head" that
|
|
18
19
|
* displays arbitrary svg elements.
|
|
19
20
|
*/
|
|
20
|
-
export declare abstract class Bubble implements IBubble, ISelectable, IFocusableNode {
|
|
21
|
+
export declare abstract class Bubble implements IBubble, ISelectable, IFocusableNode, IBoundedElement {
|
|
21
22
|
readonly workspace: WorkspaceSvg;
|
|
22
23
|
protected anchor: Coordinate;
|
|
23
24
|
protected ownerRect?: Rect | undefined;
|
|
@@ -126,6 +127,14 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
|
|
|
126
127
|
* @internal
|
|
127
128
|
*/
|
|
128
129
|
moveTo(x: number, y: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Moves the bubble by the given amounts in the x and y directions.
|
|
132
|
+
*
|
|
133
|
+
* @param dx The distance to move along the x axis.
|
|
134
|
+
* @param dy The distance to move along the y axis.
|
|
135
|
+
* @param _reason A description of why this move is happening.
|
|
136
|
+
*/
|
|
137
|
+
moveBy(dx: number, dy: number, _reason?: string[]): void;
|
|
129
138
|
/**
|
|
130
139
|
* Positions the bubble "optimally" so that the most of it is visible and
|
|
131
140
|
* it does not overlap the rect (if provided).
|
|
@@ -182,6 +191,12 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
|
|
|
182
191
|
bringToFront(): boolean;
|
|
183
192
|
/** @internal */
|
|
184
193
|
getRelativeToSurfaceXY(): Coordinate;
|
|
194
|
+
/**
|
|
195
|
+
* Returns the bounds of this bubble.
|
|
196
|
+
*
|
|
197
|
+
* @returns A bounding box for this bubble.
|
|
198
|
+
*/
|
|
199
|
+
getBoundingRectangle(): Rect;
|
|
185
200
|
/** @internal */
|
|
186
201
|
getSvgRoot(): SVGElement;
|
|
187
202
|
/**
|
|
@@ -201,7 +216,7 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
|
|
|
201
216
|
/** Returns whether this bubble is movable or not. */
|
|
202
217
|
isMovable(): boolean;
|
|
203
218
|
/** Starts a drag on the bubble. */
|
|
204
|
-
startDrag():
|
|
219
|
+
startDrag(): IBubble;
|
|
205
220
|
/** Drags the bubble to the given location. */
|
|
206
221
|
drag(newLoc: Coordinate): void;
|
|
207
222
|
/** Ends the drag on the bubble. */
|
|
@@ -80,5 +80,10 @@ export declare class MiniWorkspaceBubble extends Bubble {
|
|
|
80
80
|
moveTo(x: number, y: number): void;
|
|
81
81
|
/** @internal */
|
|
82
82
|
newWorkspaceSvg(options: Options): WorkspaceSvg;
|
|
83
|
+
/**
|
|
84
|
+
* Handles the user acting on this bubble via keyboard navigation by focusing
|
|
85
|
+
* the mutator workspace.
|
|
86
|
+
*/
|
|
87
|
+
performAction(): void;
|
|
83
88
|
}
|
|
84
89
|
//# sourceMappingURL=mini_workspace_bubble.d.ts.map
|
|
@@ -98,5 +98,10 @@ export declare class TextInputBubble extends Bubble {
|
|
|
98
98
|
* @internal
|
|
99
99
|
*/
|
|
100
100
|
getEditor(): CommentEditor;
|
|
101
|
+
/**
|
|
102
|
+
* Handles the user acting on this bubble via keyboard navigation by focusing
|
|
103
|
+
* the comment editor.
|
|
104
|
+
*/
|
|
105
|
+
performAction(): void;
|
|
101
106
|
}
|
|
102
107
|
//# sourceMappingURL=textinput_bubble.d.ts.map
|
|
@@ -16,7 +16,7 @@ export declare const COMMENT_EDITOR_FOCUS_IDENTIFIER = "_comment_textarea_";
|
|
|
16
16
|
export declare class CommentEditor implements IFocusableNode {
|
|
17
17
|
workspace: WorkspaceSvg;
|
|
18
18
|
private onFinishEditing?;
|
|
19
|
-
id
|
|
19
|
+
id: string;
|
|
20
20
|
/** The foreignObject containing the HTML text area. */
|
|
21
21
|
private foreignObject;
|
|
22
22
|
/** The text area where the user can type. */
|
|
@@ -25,7 +25,7 @@ export declare class CommentEditor implements IFocusableNode {
|
|
|
25
25
|
private textChangeListeners;
|
|
26
26
|
/** The current text of the comment. Updates on text area change. */
|
|
27
27
|
private text;
|
|
28
|
-
constructor(workspace: WorkspaceSvg, commentId
|
|
28
|
+
constructor(workspace: WorkspaceSvg, commentId: string, onFinishEditing?: (() => void) | undefined);
|
|
29
29
|
/** Gets the dom structure for this comment editor. */
|
|
30
30
|
getDom(): SVGForeignObjectElement;
|
|
31
31
|
/** Gets the current text of the comment. */
|
|
@@ -83,7 +83,7 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
83
83
|
/** Returns whether this comment is movable or not. */
|
|
84
84
|
isMovable(): boolean;
|
|
85
85
|
/** Starts a drag on the comment. */
|
|
86
|
-
startDrag():
|
|
86
|
+
startDrag(): RenderedWorkspaceComment;
|
|
87
87
|
/** Drags the comment to the given location. */
|
|
88
88
|
drag(newLoc: Coordinate): void;
|
|
89
89
|
/** Ends the drag on the comment. */
|
|
@@ -117,5 +117,10 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
117
117
|
onNodeBlur(): void;
|
|
118
118
|
/** See IFocusableNode.canBeFocused. */
|
|
119
119
|
canBeFocused(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Handles the user acting on this comment via keyboard navigation.
|
|
122
|
+
* Expands the comment and focuses its editor.
|
|
123
|
+
*/
|
|
124
|
+
performAction(): void;
|
|
120
125
|
}
|
|
121
126
|
//# sourceMappingURL=rendered_workspace_comment.d.ts.map
|
package/core/common.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export declare function fireSelectedEvent(newSelection: ISelectable | null): voi
|
|
|
79
79
|
*
|
|
80
80
|
* @returns The parent container.
|
|
81
81
|
*/
|
|
82
|
-
export declare function getParentContainer(): Element | null;
|
|
82
|
+
export declare function getParentContainer(workspace?: Workspace): Element | null;
|
|
83
83
|
/**
|
|
84
84
|
* Set the parent container. This is the container element that the WidgetDiv,
|
|
85
85
|
* DropDownDiv, and Tooltip are rendered into the first time `Blockly.inject`
|
package/core/css.d.ts
CHANGED
|
@@ -17,9 +17,10 @@ export declare function register(cssContent: string): void;
|
|
|
17
17
|
* b) It speeds up loading by not blocking on a separate HTTP transfer.
|
|
18
18
|
* c) The CSS content may be made dynamic depending on init options.
|
|
19
19
|
*
|
|
20
|
+
* @param container The div or other HTML element into which Blockly was injected.
|
|
20
21
|
* @param hasCss If false, don't inject CSS (providing CSS becomes the
|
|
21
22
|
* document's responsibility).
|
|
22
23
|
* @param pathToMedia Path from page to the Blockly media directory.
|
|
23
24
|
*/
|
|
24
|
-
export declare function inject(hasCss: boolean, pathToMedia: string): void;
|
|
25
|
+
export declare function inject(container: HTMLElement, hasCss: boolean, pathToMedia: string): void;
|
|
25
26
|
//# sourceMappingURL=css.d.ts.map
|
|
@@ -3,9 +3,24 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { BlockSvg } from '../block_svg.js';
|
|
7
|
-
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
6
|
+
import type { BlockSvg } from '../block_svg.js';
|
|
7
|
+
import type { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
8
|
+
import { DragDisposition } from '../interfaces/i_draggable.js';
|
|
9
|
+
import { Direction } from '../keyboard_nav/keyboard_mover.js';
|
|
10
|
+
import type { RenderedConnection } from '../rendered_connection.js';
|
|
8
11
|
import { Coordinate } from '../utils.js';
|
|
12
|
+
/** Represents a valid pair of connections between the dragging block and a block on the workspace. */
|
|
13
|
+
interface ConnectionPair {
|
|
14
|
+
/** A connection on the dragging stack that is compatible with neighbour. */
|
|
15
|
+
local: RenderedConnection;
|
|
16
|
+
/** A nearby connection that is compatible with local. */
|
|
17
|
+
neighbour: RenderedConnection;
|
|
18
|
+
}
|
|
19
|
+
/** Represents a nearby valid connection. */
|
|
20
|
+
interface ConnectionCandidate extends ConnectionPair {
|
|
21
|
+
/** The distance between the local connection and the neighbour connection. */
|
|
22
|
+
distance: number;
|
|
23
|
+
}
|
|
9
24
|
export declare class BlockDragStrategy implements IDragStrategy {
|
|
10
25
|
private block;
|
|
11
26
|
private workspace;
|
|
@@ -20,21 +35,38 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
20
35
|
private connectionCandidate;
|
|
21
36
|
private connectionPreviewer;
|
|
22
37
|
private dragging;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
private dragOffset;
|
|
38
|
+
/** List of all connections available on the workspace. */
|
|
39
|
+
private allConnectionPairs;
|
|
40
|
+
/** The current movement mode. */
|
|
41
|
+
private moveMode;
|
|
28
42
|
/** Used to persist an event group when snapping is done async. */
|
|
29
43
|
private originalEventGroup;
|
|
44
|
+
protected readonly BLOCK_CONNECTION_OFFSET = 10;
|
|
30
45
|
constructor(block: BlockSvg);
|
|
31
46
|
/** Returns true if the block is currently movable. False otherwise. */
|
|
32
47
|
isMovable(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Positions a cloned block on its new workspace.
|
|
50
|
+
*
|
|
51
|
+
* @param oldBlock The flyout block that was cloned.
|
|
52
|
+
* @param newBlock The new block to position.
|
|
53
|
+
*/
|
|
54
|
+
private positionNewBlock;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the block to use for the current drag operation. This may create
|
|
57
|
+
* and return a newly instantiated block when e.g. dragging from a flyout.
|
|
58
|
+
*/
|
|
59
|
+
protected getTargetBlock(): BlockSvg;
|
|
60
|
+
/**
|
|
61
|
+
* Handles any setup for starting the drag, including disconnecting the block
|
|
62
|
+
* from any parent blocks.
|
|
63
|
+
*/
|
|
64
|
+
startDrag(e?: PointerEvent | KeyboardEvent): import("../interfaces/i_draggable.js").IDraggable;
|
|
33
65
|
/**
|
|
34
66
|
* Handles any setup for starting the drag, including disconnecting the block
|
|
35
67
|
* from any parent blocks.
|
|
36
68
|
*/
|
|
37
|
-
|
|
69
|
+
private cacheAllConnectionPairs;
|
|
38
70
|
/**
|
|
39
71
|
* Returns an array of visible bubbles attached to the given block or its
|
|
40
72
|
* descendants.
|
|
@@ -47,13 +79,11 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
47
79
|
/**
|
|
48
80
|
* Get whether the drag should act on a single block or a block stack.
|
|
49
81
|
*
|
|
50
|
-
* @param e The instigating pointer event, if any.
|
|
82
|
+
* @param e The instigating pointer or keyboard event, if any.
|
|
51
83
|
* @returns True if just the initial block should be dragged out, false
|
|
52
84
|
* if all following blocks should also be dragged.
|
|
53
85
|
*/
|
|
54
|
-
protected shouldHealStack(e: PointerEvent | undefined): boolean;
|
|
55
|
-
/** Starts a drag on a shadow, recording the drag offset. */
|
|
56
|
-
private startDraggingShadow;
|
|
86
|
+
protected shouldHealStack(e: PointerEvent | KeyboardEvent | undefined): boolean;
|
|
57
87
|
/**
|
|
58
88
|
* Whether or not we should disconnect the block when a drag is started.
|
|
59
89
|
*
|
|
@@ -69,6 +99,12 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
69
99
|
* @param healStack Whether or not to heal the stack after disconnecting.
|
|
70
100
|
*/
|
|
71
101
|
private disconnectBlock;
|
|
102
|
+
/**
|
|
103
|
+
* Stores the dragging block's current parent or child connection before
|
|
104
|
+
* unplugging. This allows us to revert the drag cleanly. In keyboard move mode,
|
|
105
|
+
* the initial connection pair is also used as the first connection candidate.
|
|
106
|
+
*/
|
|
107
|
+
private storeInitialConnections;
|
|
72
108
|
/** Fire a UI event at the start of a block drag. */
|
|
73
109
|
private fireDragStartEvent;
|
|
74
110
|
/** Fire a UI event at the end of a block drag. */
|
|
@@ -76,11 +112,15 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
76
112
|
/** Fire a move event at the end of a block drag. */
|
|
77
113
|
private fireMoveEvent;
|
|
78
114
|
/** Moves the block and updates any connection previews. */
|
|
79
|
-
drag(newLoc: Coordinate): void;
|
|
115
|
+
drag(newLoc: Coordinate, e?: PointerEvent | KeyboardEvent): void;
|
|
80
116
|
/**
|
|
117
|
+
* Renders the connection preview indicator.
|
|
118
|
+
*
|
|
81
119
|
* @param draggingBlock The block being dragged.
|
|
82
120
|
* @param delta How far the pointer has moved from the position
|
|
83
121
|
* at the start of the drag, in workspace units.
|
|
122
|
+
* @returns The neighbouring connection to which the connection preview will
|
|
123
|
+
* be attached.
|
|
84
124
|
*/
|
|
85
125
|
private updateConnectionPreview;
|
|
86
126
|
/**
|
|
@@ -116,7 +156,7 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
116
156
|
* Cleans up any state at the end of the drag. Applies any pending
|
|
117
157
|
* connections.
|
|
118
158
|
*/
|
|
119
|
-
endDrag(
|
|
159
|
+
endDrag(_e: PointerEvent | KeyboardEvent | undefined, disposition: DragDisposition): void;
|
|
120
160
|
/** Disposes of any state at the end of the drag. */
|
|
121
161
|
private disposeStep;
|
|
122
162
|
/** Connects the given candidate connections. */
|
|
@@ -126,5 +166,35 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
126
166
|
* including reconnecting connections.
|
|
127
167
|
*/
|
|
128
168
|
revertDrag(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Get the nearest valid candidate connection in traversal order.
|
|
171
|
+
*
|
|
172
|
+
* @param direction The cardinal direction in which the block is being moved.
|
|
173
|
+
* @returns A candidate connection and radius, or null if none was found.
|
|
174
|
+
*/
|
|
175
|
+
findTraversalCandidate(direction: Direction): ConnectionCandidate | null;
|
|
176
|
+
private pairToCandidate;
|
|
177
|
+
/**
|
|
178
|
+
* Returns the cardinal direction that the block being dragged would have to
|
|
179
|
+
* move in to reach the given location.
|
|
180
|
+
* The given coordinate should differ from the current location on only one
|
|
181
|
+
* axis.
|
|
182
|
+
*
|
|
183
|
+
* @param newLocation The intended destination for the block.
|
|
184
|
+
* @returns The direction the block would need to travel to reach the new
|
|
185
|
+
* location.
|
|
186
|
+
*/
|
|
187
|
+
private getDirectionToNewLocation;
|
|
188
|
+
/**
|
|
189
|
+
* Returns all navigable connections on the given block and its children.
|
|
190
|
+
* Omits connections on shadow blocks, collapsed blocks, or those that are
|
|
191
|
+
* associated with a hidden input.
|
|
192
|
+
*
|
|
193
|
+
* @param block The block to use as a starting point for retrieving
|
|
194
|
+
* connections.
|
|
195
|
+
* @returns All connections on the block and its children.
|
|
196
|
+
*/
|
|
197
|
+
private getAllConnections;
|
|
129
198
|
}
|
|
199
|
+
export {};
|
|
130
200
|
//# sourceMappingURL=block_drag_strategy.d.ts.map
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { IBubble
|
|
7
|
-
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
8
|
-
import { Coordinate } from '../utils.js';
|
|
6
|
+
import type { IBubble } from '../interfaces/i_bubble.js';
|
|
7
|
+
import type { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
8
|
+
import type { Coordinate } from '../utils.js';
|
|
9
|
+
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
9
10
|
export declare class BubbleDragStrategy implements IDragStrategy {
|
|
10
11
|
private bubble;
|
|
11
12
|
private workspace;
|
|
12
13
|
private startLoc;
|
|
13
14
|
constructor(bubble: IBubble, workspace: WorkspaceSvg);
|
|
14
15
|
isMovable(): boolean;
|
|
15
|
-
startDrag():
|
|
16
|
+
startDrag(): IBubble;
|
|
16
17
|
drag(newLoc: Coordinate): void;
|
|
17
18
|
endDrag(): void;
|
|
18
19
|
revertDrag(): void;
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { RenderedWorkspaceComment } from '../comments.js';
|
|
7
|
-
import { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
8
|
-
import { Coordinate } from '../utils.js';
|
|
6
|
+
import type { RenderedWorkspaceComment } from '../comments.js';
|
|
7
|
+
import type { IDragStrategy } from '../interfaces/i_draggable.js';
|
|
8
|
+
import type { Coordinate } from '../utils.js';
|
|
9
9
|
export declare class CommentDragStrategy implements IDragStrategy {
|
|
10
10
|
private comment;
|
|
11
11
|
private startLoc;
|
|
12
12
|
private workspace;
|
|
13
13
|
constructor(comment: RenderedWorkspaceComment);
|
|
14
14
|
isMovable(): boolean;
|
|
15
|
-
startDrag():
|
|
15
|
+
startDrag(): RenderedWorkspaceComment;
|
|
16
16
|
drag(newLoc: Coordinate): void;
|
|
17
17
|
endDrag(): void;
|
|
18
18
|
/** Fire a UI event at the start of a comment drag. */
|
|
@@ -3,29 +3,27 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { IDeletable } from '../interfaces/i_deletable.js';
|
|
7
|
-
import { IDragTarget } from '../interfaces/i_drag_target.js';
|
|
8
|
-
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
9
|
-
import { IDragger } from '../interfaces/i_dragger.js';
|
|
6
|
+
import type { IDeletable } from '../interfaces/i_deletable.js';
|
|
7
|
+
import type { IDragTarget } from '../interfaces/i_drag_target.js';
|
|
8
|
+
import { type IDraggable } from '../interfaces/i_draggable.js';
|
|
9
|
+
import type { IDragger } from '../interfaces/i_dragger.js';
|
|
10
10
|
import { Coordinate } from '../utils/coordinate.js';
|
|
11
|
-
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
12
11
|
export declare class Dragger implements IDragger {
|
|
13
12
|
protected draggable: IDraggable;
|
|
14
|
-
protected workspace: WorkspaceSvg;
|
|
15
13
|
protected startLoc: Coordinate;
|
|
16
14
|
protected dragTarget: IDragTarget | null;
|
|
17
|
-
constructor(draggable: IDraggable
|
|
15
|
+
constructor(draggable: IDraggable);
|
|
18
16
|
/** Handles any drag startup. */
|
|
19
|
-
onDragStart(e
|
|
17
|
+
onDragStart(e?: PointerEvent | KeyboardEvent): IDraggable;
|
|
20
18
|
/**
|
|
21
19
|
* Handles calculating where the element should actually be moved to.
|
|
22
20
|
*
|
|
23
21
|
* @param totalDelta The total amount in pixel coordinates the mouse has moved
|
|
24
22
|
* since the start of the drag.
|
|
25
23
|
*/
|
|
26
|
-
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
24
|
+
onDrag(e: PointerEvent | KeyboardEvent | undefined, totalDelta: Coordinate): void;
|
|
27
25
|
/** Updates the drag target under the pointer (if there is one). */
|
|
28
|
-
protected updateDragTarget(
|
|
26
|
+
protected updateDragTarget(coordinate: Coordinate): void;
|
|
29
27
|
/**
|
|
30
28
|
* Calculates the correct workspace coordinate for the movable and tells
|
|
31
29
|
* the draggable to go to that location.
|
|
@@ -35,15 +33,16 @@ export declare class Dragger implements IDragger {
|
|
|
35
33
|
* Returns true if we would delete the draggable if it was dropped
|
|
36
34
|
* at the current location.
|
|
37
35
|
*/
|
|
38
|
-
protected wouldDeleteDraggable(
|
|
36
|
+
protected wouldDeleteDraggable(coordinate: Coordinate, rootDraggable: IDraggable & IDeletable): boolean;
|
|
39
37
|
/** Handles any drag cleanup. */
|
|
40
|
-
onDragEnd(e
|
|
41
|
-
|
|
38
|
+
onDragEnd(e?: PointerEvent | KeyboardEvent): void;
|
|
39
|
+
/** Handles a drag being reverted. */
|
|
40
|
+
onDragRevert(): void;
|
|
42
41
|
/**
|
|
43
42
|
* Returns true if we should return the draggable to its original location
|
|
44
43
|
* at the end of the drag.
|
|
45
44
|
*/
|
|
46
|
-
protected shouldReturnToStart(
|
|
45
|
+
protected shouldReturnToStart(coordinate: Coordinate, rootDraggable: IDraggable): boolean;
|
|
47
46
|
protected pixelsToWorkspaceUnits(pixelCoord: Coordinate): Coordinate;
|
|
48
47
|
}
|
|
49
48
|
//# sourceMappingURL=dragger.d.ts.map
|
|
@@ -19,8 +19,6 @@ import { EventType } from './type.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class BlockCreate extends BlockBase {
|
|
21
21
|
type: EventType;
|
|
22
|
-
/** The XML representation of the created block(s). */
|
|
23
|
-
xml?: Element | DocumentFragment;
|
|
24
22
|
/** The JSON respresentation of the created block(s). */
|
|
25
23
|
json?: blocks.State;
|
|
26
24
|
/** All of the IDs of created blocks. */
|
|
@@ -51,7 +49,6 @@ export declare class BlockCreate extends BlockBase {
|
|
|
51
49
|
run(forward: boolean): void;
|
|
52
50
|
}
|
|
53
51
|
export interface BlockCreateJson extends BlockBaseJson {
|
|
54
|
-
xml: string;
|
|
55
52
|
ids: string[];
|
|
56
53
|
json: object;
|
|
57
54
|
recordUndo?: boolean;
|
|
@@ -18,8 +18,6 @@ import { EventType } from './type.js';
|
|
|
18
18
|
* deleted.
|
|
19
19
|
*/
|
|
20
20
|
export declare class BlockDelete extends BlockBase {
|
|
21
|
-
/** The XML representation of the deleted block(s). */
|
|
22
|
-
oldXml?: Element | DocumentFragment;
|
|
23
21
|
/** The JSON respresentation of the deleted block(s). */
|
|
24
22
|
oldJson?: blocks.State;
|
|
25
23
|
/** All of the IDs of deleted blocks. */
|
|
@@ -53,7 +51,6 @@ export declare class BlockDelete extends BlockBase {
|
|
|
53
51
|
run(forward: boolean): void;
|
|
54
52
|
}
|
|
55
53
|
export interface BlockDeleteJson extends BlockBaseJson {
|
|
56
|
-
oldXml: string;
|
|
57
54
|
ids: string[];
|
|
58
55
|
wasShadow: boolean;
|
|
59
56
|
oldJson: blocks.State;
|