blockly 12.5.1 → 13.0.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 +1541 -700
- package/blockly.mjs +13 -5
- package/blockly_compressed.js +1449 -674
- 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_aria_composer.d.ts +119 -0
- package/core/block_svg.d.ts +59 -16
- package/core/blockly.d.ts +21 -16
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +9 -1
- package/core/bubbles/text_bubble.d.ts +4 -1
- 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 +126 -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 -2
- package/core/field_input.d.ts +23 -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/focus_manager.d.ts +47 -2
- 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 +22 -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 +8 -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 +149 -0
- package/core/keyboard_nav/move_indicator.d.ts +35 -0
- package/core/keyboard_nav/{block_navigation_policy.d.ts → navigation_policies/block_navigation_policy.d.ts} +17 -25
- package/core/keyboard_nav/navigation_policies/bubble_navigation_policy.d.ts +63 -0
- 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} +12 -5
- 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 +73 -1
- package/core/shortcut_registry.d.ts +6 -0
- 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 +17 -33
- package/core/toolbox/toolbox_item.d.ts +4 -0
- package/core/utils/aria.d.ts +245 -28
- package/core/utils/dom.d.ts +1 -1
- package/core/utils/shortcut_formatting.d.ts +22 -0
- package/core/utils/useragent.d.ts +1 -0
- package/core/variables.d.ts +1 -1
- 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 +65 -0
- package/msg/ab.mjs +65 -0
- package/msg/ace.js +65 -0
- package/msg/ace.mjs +65 -0
- package/msg/af.js +65 -0
- package/msg/af.mjs +65 -0
- package/msg/am.js +65 -0
- package/msg/am.mjs +65 -0
- package/msg/ar.js +65 -0
- package/msg/ar.mjs +65 -0
- package/msg/ast.js +65 -0
- package/msg/ast.mjs +65 -0
- package/msg/az.js +65 -0
- package/msg/az.mjs +65 -0
- package/msg/ba.js +65 -0
- package/msg/ba.mjs +65 -0
- package/msg/bcc.js +65 -0
- package/msg/bcc.mjs +65 -0
- package/msg/be-tarask.js +65 -0
- package/msg/be-tarask.mjs +65 -0
- package/msg/be.js +65 -0
- package/msg/be.mjs +65 -0
- package/msg/bg.js +65 -0
- package/msg/bg.mjs +65 -0
- package/msg/bn.js +65 -0
- package/msg/bn.mjs +65 -0
- package/msg/br.js +65 -0
- package/msg/br.mjs +65 -0
- package/msg/bs.js +65 -0
- package/msg/bs.mjs +65 -0
- package/msg/ca.js +65 -0
- package/msg/ca.mjs +65 -0
- package/msg/cdo.js +65 -0
- package/msg/cdo.mjs +65 -0
- package/msg/ce.js +65 -0
- package/msg/ce.mjs +65 -0
- package/msg/cs.js +65 -0
- package/msg/cs.mjs +65 -0
- package/msg/da.js +65 -0
- package/msg/da.mjs +65 -0
- package/msg/de.js +65 -0
- package/msg/de.mjs +65 -0
- package/msg/diq.js +65 -0
- package/msg/diq.mjs +65 -0
- package/msg/dtp.js +65 -0
- package/msg/dtp.mjs +65 -0
- package/msg/dty.js +65 -0
- package/msg/dty.mjs +65 -0
- package/msg/ee.js +65 -0
- package/msg/ee.mjs +65 -0
- package/msg/el.js +65 -0
- package/msg/el.mjs +65 -0
- package/msg/en-gb.js +65 -0
- package/msg/en-gb.mjs +65 -0
- package/msg/en.js +65 -0
- package/msg/en.mjs +65 -0
- package/msg/eo.js +65 -0
- package/msg/eo.mjs +65 -0
- package/msg/es.js +65 -0
- package/msg/es.mjs +65 -0
- package/msg/et.js +65 -0
- package/msg/et.mjs +65 -0
- package/msg/eu.js +65 -0
- package/msg/eu.mjs +65 -0
- package/msg/fa.js +65 -0
- package/msg/fa.mjs +65 -0
- package/msg/fi.js +65 -0
- package/msg/fi.mjs +65 -0
- package/msg/fo.js +65 -0
- package/msg/fo.mjs +65 -0
- package/msg/fr.js +65 -0
- package/msg/fr.mjs +65 -0
- package/msg/frr.js +65 -0
- package/msg/frr.mjs +65 -0
- package/msg/gl.js +65 -0
- package/msg/gl.mjs +65 -0
- package/msg/gn.js +65 -0
- package/msg/gn.mjs +65 -0
- package/msg/gor.js +65 -0
- package/msg/gor.mjs +65 -0
- package/msg/ha.js +65 -0
- package/msg/ha.mjs +65 -0
- package/msg/hak.js +65 -0
- package/msg/hak.mjs +65 -0
- package/msg/he.js +65 -0
- package/msg/he.mjs +65 -0
- package/msg/hi.js +65 -0
- package/msg/hi.mjs +65 -0
- package/msg/hr.js +65 -0
- package/msg/hr.mjs +65 -0
- package/msg/hrx.js +65 -0
- package/msg/hrx.mjs +65 -0
- package/msg/hsb.js +65 -0
- package/msg/hsb.mjs +65 -0
- package/msg/hu.js +65 -0
- package/msg/hu.mjs +65 -0
- package/msg/hy.js +65 -0
- package/msg/hy.mjs +65 -0
- package/msg/ia.js +65 -0
- package/msg/ia.mjs +65 -0
- package/msg/id.js +65 -0
- package/msg/id.mjs +65 -0
- package/msg/ig.js +65 -0
- package/msg/ig.mjs +65 -0
- package/msg/inh.js +65 -0
- package/msg/inh.mjs +65 -0
- package/msg/is.js +65 -0
- package/msg/is.mjs +65 -0
- package/msg/it.js +65 -0
- package/msg/it.mjs +65 -0
- package/msg/ja.js +65 -0
- package/msg/ja.mjs +65 -0
- package/msg/ka.js +65 -0
- package/msg/ka.mjs +65 -0
- package/msg/kab.js +65 -0
- package/msg/kab.mjs +65 -0
- package/msg/kbd-cyrl.js +65 -0
- package/msg/kbd-cyrl.mjs +65 -0
- package/msg/km.js +65 -0
- package/msg/km.mjs +65 -0
- package/msg/kn.js +65 -0
- package/msg/kn.mjs +65 -0
- package/msg/ko.js +65 -0
- package/msg/ko.mjs +65 -0
- package/msg/ksh.js +65 -0
- package/msg/ksh.mjs +65 -0
- package/msg/ku-latn.js +65 -0
- package/msg/ku-latn.mjs +65 -0
- package/msg/ky.js +65 -0
- package/msg/ky.mjs +65 -0
- package/msg/la.js +65 -0
- package/msg/la.mjs +65 -0
- package/msg/lb.js +65 -0
- package/msg/lb.mjs +65 -0
- package/msg/lki.js +65 -0
- package/msg/lki.mjs +65 -0
- package/msg/lo.js +65 -0
- package/msg/lo.mjs +65 -0
- package/msg/lrc.js +65 -0
- package/msg/lrc.mjs +65 -0
- package/msg/lt.js +65 -0
- package/msg/lt.mjs +65 -0
- package/msg/lv.js +65 -0
- package/msg/lv.mjs +65 -0
- package/msg/mg.js +65 -0
- package/msg/mg.mjs +65 -0
- package/msg/mk.js +65 -0
- package/msg/mk.mjs +65 -0
- package/msg/ml.js +65 -0
- package/msg/ml.mjs +65 -0
- package/msg/mnw.js +65 -0
- package/msg/mnw.mjs +65 -0
- package/msg/ms.js +65 -0
- package/msg/ms.mjs +65 -0
- package/msg/my.js +65 -0
- package/msg/my.mjs +65 -0
- package/msg/mzn.js +65 -0
- package/msg/mzn.mjs +65 -0
- package/msg/nb.js +65 -0
- package/msg/nb.mjs +65 -0
- package/msg/ne.js +65 -0
- package/msg/ne.mjs +65 -0
- package/msg/nl.js +65 -0
- package/msg/nl.mjs +65 -0
- package/msg/oc.js +65 -0
- package/msg/oc.mjs +65 -0
- package/msg/olo.js +65 -0
- package/msg/olo.mjs +65 -0
- package/msg/pa.js +65 -0
- package/msg/pa.mjs +65 -0
- package/msg/pl.js +65 -0
- package/msg/pl.mjs +65 -0
- package/msg/pms.js +65 -0
- package/msg/pms.mjs +65 -0
- package/msg/ps.js +65 -0
- package/msg/ps.mjs +65 -0
- package/msg/pt-br.js +65 -0
- package/msg/pt-br.mjs +65 -0
- package/msg/pt.js +65 -0
- package/msg/pt.mjs +65 -0
- package/msg/ro.js +65 -0
- package/msg/ro.mjs +65 -0
- package/msg/ru.js +65 -0
- package/msg/ru.mjs +65 -0
- package/msg/sc.js +65 -0
- package/msg/sc.mjs +65 -0
- package/msg/sco.js +65 -0
- package/msg/sco.mjs +65 -0
- package/msg/sd.js +65 -0
- package/msg/sd.mjs +65 -0
- package/msg/shn.js +65 -0
- package/msg/shn.mjs +65 -0
- package/msg/si.js +65 -0
- package/msg/si.mjs +65 -0
- package/msg/sk.js +65 -0
- package/msg/sk.mjs +65 -0
- package/msg/skr-arab.js +65 -0
- package/msg/skr-arab.mjs +65 -0
- package/msg/sl.js +65 -0
- package/msg/sl.mjs +65 -0
- package/msg/smn.js +65 -0
- package/msg/smn.mjs +65 -0
- package/msg/sq.js +65 -0
- package/msg/sq.mjs +65 -0
- package/msg/sr-latn.js +65 -0
- package/msg/sr-latn.mjs +65 -0
- package/msg/sr.js +65 -0
- package/msg/sr.mjs +65 -0
- package/msg/sv.js +65 -0
- package/msg/sv.mjs +65 -0
- package/msg/sw.js +65 -0
- package/msg/sw.mjs +65 -0
- package/msg/ta.js +65 -0
- package/msg/ta.mjs +65 -0
- package/msg/tcy.js +65 -0
- package/msg/tcy.mjs +65 -0
- package/msg/tdd.js +65 -0
- package/msg/tdd.mjs +65 -0
- package/msg/te.js +65 -0
- package/msg/te.mjs +65 -0
- package/msg/th.js +65 -0
- package/msg/th.mjs +65 -0
- package/msg/ti.js +65 -0
- package/msg/ti.mjs +65 -0
- package/msg/tl.js +65 -0
- package/msg/tl.mjs +65 -0
- package/msg/tlh.js +65 -0
- package/msg/tlh.mjs +65 -0
- package/msg/tr.js +65 -0
- package/msg/tr.mjs +65 -0
- package/msg/ug-arab.js +65 -0
- package/msg/ug-arab.mjs +65 -0
- package/msg/uk.js +65 -0
- package/msg/uk.mjs +65 -0
- package/msg/ur.js +65 -0
- package/msg/ur.mjs +65 -0
- package/msg/uz.js +65 -0
- package/msg/uz.mjs +65 -0
- package/msg/vi.js +65 -0
- package/msg/vi.mjs +65 -0
- package/msg/xmf.js +65 -0
- package/msg/xmf.mjs +65 -0
- package/msg/yo.js +65 -0
- package/msg/yo.mjs +65 -0
- package/msg/zgh.js +65 -0
- package/msg/zgh.mjs +65 -0
- package/msg/zh-hans.js +65 -0
- package/msg/zh-hans.mjs +65 -0
- package/msg/zh-hant.js +65 -0
- package/msg/zh-hant.mjs +65 -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/block_comment_navigation_policy.d.ts +0 -56
- 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/flyout_base.d.ts
CHANGED
|
@@ -3,43 +3,23 @@
|
|
|
3
3
|
* Copyright 2011 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Flyout tray containing blocks which may be created.
|
|
8
|
-
*
|
|
9
|
-
* @class
|
|
10
|
-
*/
|
|
11
|
-
import { BlockSvg } from './block_svg.js';
|
|
12
6
|
import { DeleteArea } from './delete_area.js';
|
|
13
7
|
import { FlyoutItem } from './flyout_item.js';
|
|
14
8
|
import { IAutoHideable } from './interfaces/i_autohideable.js';
|
|
15
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
16
10
|
import type { IFlyoutInflater } from './interfaces/i_flyout_inflater.js';
|
|
17
|
-
import { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
18
|
-
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
19
11
|
import type { Options } from './options.js';
|
|
20
|
-
import * as blocks from './serialization/blocks.js';
|
|
21
|
-
import { Coordinate } from './utils/coordinate.js';
|
|
22
12
|
import { Svg } from './utils/svg.js';
|
|
23
13
|
import * as toolbox from './utils/toolbox.js';
|
|
24
14
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
25
15
|
/**
|
|
26
16
|
* Class for a flyout.
|
|
27
17
|
*/
|
|
28
|
-
export declare abstract class Flyout extends DeleteArea implements IAutoHideable, IFlyout
|
|
18
|
+
export declare abstract class Flyout extends DeleteArea implements IAutoHideable, IFlyout {
|
|
29
19
|
/**
|
|
30
20
|
* Position the flyout.
|
|
31
21
|
*/
|
|
32
22
|
abstract position(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Determine if a drag delta is toward the workspace, based on the position
|
|
35
|
-
* and orientation of the flyout. This is used in determineDragIntention_ to
|
|
36
|
-
* determine if a new block should be created or if the flyout should scroll.
|
|
37
|
-
*
|
|
38
|
-
* @param currentDragDeltaXY How far the pointer has
|
|
39
|
-
* moved from the position at mouse down, in pixel units.
|
|
40
|
-
* @returns True if the drag is toward the workspace.
|
|
41
|
-
*/
|
|
42
|
-
abstract isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
|
|
43
23
|
/**
|
|
44
24
|
* Sets the translation of the flyout to match the scrollbars.
|
|
45
25
|
*
|
|
@@ -151,27 +131,6 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
151
131
|
* Height of flyout.
|
|
152
132
|
*/
|
|
153
133
|
protected height_: number;
|
|
154
|
-
/**
|
|
155
|
-
* Range of a drag angle from a flyout considered "dragging toward
|
|
156
|
-
* workspace". Drags that are within the bounds of this many degrees from
|
|
157
|
-
* the orthogonal line to the flyout edge are considered to be "drags toward
|
|
158
|
-
* the workspace".
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
*
|
|
162
|
-
* ```
|
|
163
|
-
* Flyout Edge Workspace
|
|
164
|
-
* [block] / <-within this angle, drags "toward workspace" |
|
|
165
|
-
* [block] ---- orthogonal to flyout boundary ---- |
|
|
166
|
-
* [block] \ |
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* The angle is given in degrees from the orthogonal.
|
|
170
|
-
*
|
|
171
|
-
* This is used to know when to create a new block and when to scroll the
|
|
172
|
-
* flyout. Setting it to 360 means that all drags create a new block.
|
|
173
|
-
*/
|
|
174
|
-
protected dragAngleRange_: number;
|
|
175
134
|
/**
|
|
176
135
|
* The path around the background of the flyout, which will be filled with a
|
|
177
136
|
* background colour.
|
|
@@ -348,25 +307,6 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
348
307
|
* @param e Pointer down event.
|
|
349
308
|
*/
|
|
350
309
|
private onMouseDown;
|
|
351
|
-
/**
|
|
352
|
-
* Does this flyout allow you to create a new instance of the given block?
|
|
353
|
-
* Used for deciding if a block can be "dragged out of" the flyout.
|
|
354
|
-
*
|
|
355
|
-
* @param block The block to copy from the flyout.
|
|
356
|
-
* @returns True if you can create a new instance of the block, false
|
|
357
|
-
* otherwise.
|
|
358
|
-
* @internal
|
|
359
|
-
*/
|
|
360
|
-
isBlockCreatable(block: BlockSvg): boolean;
|
|
361
|
-
/**
|
|
362
|
-
* Create a copy of this block on the workspace.
|
|
363
|
-
*
|
|
364
|
-
* @param originalBlock The block to copy from the flyout.
|
|
365
|
-
* @returns The newly created block.
|
|
366
|
-
* @throws {Error} if something went wrong with deserialization.
|
|
367
|
-
* @internal
|
|
368
|
-
*/
|
|
369
|
-
createBlock(originalBlock: BlockSvg): BlockSvg;
|
|
370
310
|
/**
|
|
371
311
|
* Reflow flyout contents.
|
|
372
312
|
*/
|
|
@@ -377,20 +317,6 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
377
317
|
* @internal
|
|
378
318
|
*/
|
|
379
319
|
isScrollable(): boolean;
|
|
380
|
-
/**
|
|
381
|
-
* Serialize a block to JSON.
|
|
382
|
-
*
|
|
383
|
-
* @param block The block to serialize.
|
|
384
|
-
* @returns A serialized representation of the block.
|
|
385
|
-
*/
|
|
386
|
-
protected serializeBlock(block: BlockSvg): blocks.State;
|
|
387
|
-
/**
|
|
388
|
-
* Positions a block on the target workspace.
|
|
389
|
-
*
|
|
390
|
-
* @param oldBlock The flyout block being copied.
|
|
391
|
-
* @param block The block to posiiton.
|
|
392
|
-
*/
|
|
393
|
-
private positionNewBlock;
|
|
394
320
|
/**
|
|
395
321
|
* Returns the inflater responsible for constructing items of the given type.
|
|
396
322
|
*
|
|
@@ -399,55 +325,5 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
399
325
|
* is registered for that type.
|
|
400
326
|
*/
|
|
401
327
|
protected getInflaterForType(type: string): IFlyoutInflater | null;
|
|
402
|
-
/**
|
|
403
|
-
* See IFocusableNode.getFocusableElement.
|
|
404
|
-
*
|
|
405
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
406
|
-
*/
|
|
407
|
-
getFocusableElement(): HTMLElement | SVGElement;
|
|
408
|
-
/**
|
|
409
|
-
* See IFocusableNode.getFocusableTree.
|
|
410
|
-
*
|
|
411
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
412
|
-
*/
|
|
413
|
-
getFocusableTree(): IFocusableTree;
|
|
414
|
-
/** See IFocusableNode.onNodeFocus. */
|
|
415
|
-
onNodeFocus(): void;
|
|
416
|
-
/** See IFocusableNode.onNodeBlur. */
|
|
417
|
-
onNodeBlur(): void;
|
|
418
|
-
/** See IFocusableNode.canBeFocused. */
|
|
419
|
-
canBeFocused(): boolean;
|
|
420
|
-
/**
|
|
421
|
-
* See IFocusableNode.getRootFocusableNode.
|
|
422
|
-
*
|
|
423
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
424
|
-
*/
|
|
425
|
-
getRootFocusableNode(): IFocusableNode;
|
|
426
|
-
/**
|
|
427
|
-
* See IFocusableNode.getRestoredFocusableNode.
|
|
428
|
-
*
|
|
429
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
430
|
-
*/
|
|
431
|
-
getRestoredFocusableNode(_previousNode: IFocusableNode | null): IFocusableNode | null;
|
|
432
|
-
/**
|
|
433
|
-
* See IFocusableNode.getNestedTrees.
|
|
434
|
-
*
|
|
435
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
436
|
-
*/
|
|
437
|
-
getNestedTrees(): Array<IFocusableTree>;
|
|
438
|
-
/**
|
|
439
|
-
* See IFocusableNode.lookUpFocusableNode.
|
|
440
|
-
*
|
|
441
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
442
|
-
*/
|
|
443
|
-
lookUpFocusableNode(_id: string): IFocusableNode | null;
|
|
444
|
-
/** See IFocusableTree.onTreeFocus. */
|
|
445
|
-
onTreeFocus(_node: IFocusableNode, _previousTree: IFocusableTree | null): void;
|
|
446
|
-
/**
|
|
447
|
-
* See IFocusableNode.onTreeBlur.
|
|
448
|
-
*
|
|
449
|
-
* @deprecated v12: Use the Flyout's workspace for focus operations, instead.
|
|
450
|
-
*/
|
|
451
|
-
onTreeBlur(_nextTree: IFocusableTree | null): void;
|
|
452
328
|
}
|
|
453
329
|
//# sourceMappingURL=flyout_base.d.ts.map
|
package/core/flyout_button.d.ts
CHANGED
|
@@ -136,5 +136,14 @@ export declare class FlyoutButton implements IBoundedElement, IRenderedElement,
|
|
|
136
136
|
onNodeBlur(): void;
|
|
137
137
|
/** See IFocusableNode.canBeFocused. */
|
|
138
138
|
canBeFocused(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the ID of this FlyoutButton.
|
|
141
|
+
*/
|
|
142
|
+
getId(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Handles the user acting on this button via keyboard navigation.
|
|
145
|
+
* Invokes the click handler callback.
|
|
146
|
+
*/
|
|
147
|
+
performAction(): void;
|
|
139
148
|
}
|
|
140
149
|
//# sourceMappingURL=flyout_button.d.ts.map
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { Flyout } from './flyout_base.js';
|
|
7
7
|
import type { FlyoutItem } from './flyout_item.js';
|
|
8
8
|
import type { Options } from './options.js';
|
|
9
|
-
import type { Coordinate } from './utils/coordinate.js';
|
|
10
9
|
import { Rect } from './utils/rect.js';
|
|
11
10
|
/**
|
|
12
11
|
* Class for a flyout.
|
|
@@ -60,16 +59,6 @@ export declare class HorizontalFlyout extends Flyout {
|
|
|
60
59
|
* @param contents The flyout items to lay out.
|
|
61
60
|
*/
|
|
62
61
|
protected layout_(contents: FlyoutItem[]): void;
|
|
63
|
-
/**
|
|
64
|
-
* Determine if a drag delta is toward the workspace, based on the position
|
|
65
|
-
* and orientation of the flyout. This is used in determineDragIntention_ to
|
|
66
|
-
* determine if a new block should be created or if the flyout should scroll.
|
|
67
|
-
*
|
|
68
|
-
* @param currentDragDeltaXY How far the pointer has moved from the position
|
|
69
|
-
* at mouse down, in pixel units.
|
|
70
|
-
* @returns True if the drag is toward the workspace.
|
|
71
|
-
*/
|
|
72
|
-
isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
|
|
73
62
|
/**
|
|
74
63
|
* Returns the bounding rectangle of the drag target area in pixel units
|
|
75
64
|
* relative to viewport.
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { Flyout } from './flyout_base.js';
|
|
7
7
|
import type { FlyoutItem } from './flyout_item.js';
|
|
8
8
|
import type { Options } from './options.js';
|
|
9
|
-
import type { Coordinate } from './utils/coordinate.js';
|
|
10
9
|
import { Rect } from './utils/rect.js';
|
|
11
10
|
/**
|
|
12
11
|
* Class for a flyout.
|
|
@@ -61,16 +60,6 @@ export declare class VerticalFlyout extends Flyout {
|
|
|
61
60
|
* @param contents The flyout items to lay out.
|
|
62
61
|
*/
|
|
63
62
|
protected layout_(contents: FlyoutItem[]): void;
|
|
64
|
-
/**
|
|
65
|
-
* Determine if a drag delta is toward the workspace, based on the position
|
|
66
|
-
* and orientation of the flyout. This is used in determineDragIntention_ to
|
|
67
|
-
* determine if a new block should be created or if the flyout should scroll.
|
|
68
|
-
*
|
|
69
|
-
* @param currentDragDeltaXY How far the pointer has moved from the position
|
|
70
|
-
* at mouse down, in pixel units.
|
|
71
|
-
* @returns True if the drag is toward the workspace.
|
|
72
|
-
*/
|
|
73
|
-
isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
|
|
74
63
|
/**
|
|
75
64
|
* Returns the bounding rectangle of the drag target area in pixel units
|
|
76
65
|
* relative to viewport.
|
package/core/focus_manager.d.ts
CHANGED
|
@@ -7,11 +7,15 @@ import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
|
7
7
|
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
8
8
|
/**
|
|
9
9
|
* Type declaration for returning focus to FocusManager upon completing an
|
|
10
|
-
* ephemeral UI flow (such as a dialog).
|
|
10
|
+
* ephemeral UI flow (such as a dialog). Normally, the FocusManager will refocus
|
|
11
|
+
* the previously-focused element. If callers do not wish for the FocusManager
|
|
12
|
+
* to do so, they may call this method with `restoreFocus` set to false to
|
|
13
|
+
* prevent automatic refocusing and leave focus where it is.
|
|
14
|
+
*
|
|
11
15
|
*
|
|
12
16
|
* See FocusManager.takeEphemeralFocus for more details.
|
|
13
17
|
*/
|
|
14
|
-
export type ReturnEphemeralFocus = () => void;
|
|
18
|
+
export type ReturnEphemeralFocus = (restoreFocus?: boolean) => void;
|
|
15
19
|
/**
|
|
16
20
|
* A per-page singleton that manages Blockly focus across one or more
|
|
17
21
|
* IFocusableTrees, and bidirectionally synchronizes this focus with the DOM.
|
|
@@ -56,6 +60,20 @@ export declare class FocusManager {
|
|
|
56
60
|
private lockFocusStateChanges;
|
|
57
61
|
private recentlyLostAllFocus;
|
|
58
62
|
private isUpdatingFocusedNode;
|
|
63
|
+
/**
|
|
64
|
+
* Root element in which popovers (WidgetDiv, DropDownDiv) currently live.
|
|
65
|
+
*/
|
|
66
|
+
private popoverFocusRoot?;
|
|
67
|
+
/**
|
|
68
|
+
* Set of callbacks to invoke if the popover focus root loses focus.
|
|
69
|
+
*/
|
|
70
|
+
private popoverFocusLossHandlers;
|
|
71
|
+
/**
|
|
72
|
+
* Handler for focusout in the popover focus root that selectively
|
|
73
|
+
* invokes the popover focus loss handlers if focus has truly transitioned
|
|
74
|
+
* outside of the focus root, and not e.g. to a different popover.
|
|
75
|
+
*/
|
|
76
|
+
private popoverFocusOutHandler;
|
|
59
77
|
constructor(addGlobalEventListener: (type: string, listener: EventListener) => void);
|
|
60
78
|
/**
|
|
61
79
|
* Registers a new IFocusableTree for automatic focus management.
|
|
@@ -260,6 +278,33 @@ export declare class FocusManager {
|
|
|
260
278
|
* but may change across page loads.
|
|
261
279
|
*/
|
|
262
280
|
static getFocusManager(): FocusManager;
|
|
281
|
+
/**
|
|
282
|
+
* Sets the current popover focus root. Generally this is active
|
|
283
|
+
* workspace's injection div or the explicitly specified parent container for
|
|
284
|
+
* the WidgetDiv, DropDownDiv, etc.
|
|
285
|
+
*
|
|
286
|
+
* @internal
|
|
287
|
+
* @param newRoot The new element that contains all popovers.
|
|
288
|
+
*/
|
|
289
|
+
setPopoverFocusRoot(newRoot: HTMLElement): void;
|
|
290
|
+
/**
|
|
291
|
+
* Registers a callback to be invoked if the popover focus root loses
|
|
292
|
+
* focus. This should only be called by popovers that need to react to
|
|
293
|
+
* focus changes by e.g. hiding themselves and resigning ephemeral focus.
|
|
294
|
+
*
|
|
295
|
+
* @internal
|
|
296
|
+
* @param handler A callback function.
|
|
297
|
+
*/
|
|
298
|
+
registerPopoverFocusLossHandler(handler: () => void): void;
|
|
299
|
+
/**
|
|
300
|
+
* Unregisters a previously-registered popover focus loss handler. This
|
|
301
|
+
* should only be invoked by popovers when they no longer need to be
|
|
302
|
+
* notified of focus loss, typically when they are hidden.
|
|
303
|
+
*
|
|
304
|
+
* @internal
|
|
305
|
+
* @param handler A previously-registered callback function.
|
|
306
|
+
*/
|
|
307
|
+
unregisterPopoverFocusLossHandler(handler: () => void): void;
|
|
263
308
|
}
|
|
264
309
|
/** Convenience function for FocusManager.getFocusManager. */
|
|
265
310
|
export declare function getFocusManager(): FocusManager;
|
package/core/gesture.d.ts
CHANGED
|
@@ -149,18 +149,6 @@ export declare class Gesture {
|
|
|
149
149
|
* @returns True if the drag just exceeded the drag radius for the first time.
|
|
150
150
|
*/
|
|
151
151
|
private updateDragDelta;
|
|
152
|
-
/**
|
|
153
|
-
* Update this gesture to record whether a block is being dragged from the
|
|
154
|
-
* flyout.
|
|
155
|
-
* This function should be called on a pointermove event the first time
|
|
156
|
-
* the drag radius is exceeded. It should be called no more than once per
|
|
157
|
-
* gesture. If a block should be dragged from the flyout this function creates
|
|
158
|
-
* the new block on the main workspace and updates targetBlock_ and
|
|
159
|
-
* startWorkspace_.
|
|
160
|
-
*
|
|
161
|
-
* @returns True if a block is being dragged from the flyout.
|
|
162
|
-
*/
|
|
163
|
-
private updateIsDraggingFromFlyout;
|
|
164
152
|
/**
|
|
165
153
|
* Check whether to start a workspace drag. If a workspace is being dragged,
|
|
166
154
|
* create the necessary WorkspaceDragger and start the drag.
|
package/core/hints.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Raspberry Pi Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
7
|
+
/**
|
|
8
|
+
* Nudge the user to use unconstrained movement.
|
|
9
|
+
*
|
|
10
|
+
* @param workspace Workspace.
|
|
11
|
+
* @param force Set to show it even if previously shown.
|
|
12
|
+
*/
|
|
13
|
+
export declare function showUnconstrainedMoveHint(workspace: WorkspaceSvg, force?: boolean): void;
|
|
14
|
+
/**
|
|
15
|
+
* Nudge the user to move a block that's in move mode.
|
|
16
|
+
*
|
|
17
|
+
* @param workspace Workspace.
|
|
18
|
+
*/
|
|
19
|
+
export declare function showConstrainedMovementHint(workspace: WorkspaceSvg): void;
|
|
20
|
+
/**
|
|
21
|
+
* Clear active move-related hints, if any.
|
|
22
|
+
*
|
|
23
|
+
* @param workspace The workspace.
|
|
24
|
+
*/
|
|
25
|
+
export declare function clearMoveHints(workspace: WorkspaceSvg): void;
|
|
26
|
+
/**
|
|
27
|
+
* Nudge the user to open the help.
|
|
28
|
+
*
|
|
29
|
+
* @param workspace The workspace.
|
|
30
|
+
*/
|
|
31
|
+
export declare function showHelpHint(workspace: WorkspaceSvg): void;
|
|
32
|
+
/**
|
|
33
|
+
* Tell the user how to navigate inside blocks.
|
|
34
|
+
*
|
|
35
|
+
* @param workspace The workspace.
|
|
36
|
+
*/
|
|
37
|
+
export declare function showBlockNavigationHint(workspace: WorkspaceSvg): void;
|
|
38
|
+
/**
|
|
39
|
+
* Tell the user how to navigate inside the workspace.
|
|
40
|
+
*
|
|
41
|
+
* @param workspace The workspace.
|
|
42
|
+
*/
|
|
43
|
+
export declare function showWorkspaceNavigationHint(workspace: WorkspaceSvg): void;
|
|
44
|
+
//# sourceMappingURL=hints.d.ts.map
|
package/core/icons/icon.d.ts
CHANGED
|
@@ -73,6 +73,12 @@ export declare abstract class Icon implements IIcon, IContextMenu {
|
|
|
73
73
|
onNodeBlur(): void;
|
|
74
74
|
/** See IFocusableNode.canBeFocused. */
|
|
75
75
|
canBeFocused(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Handles the user acting on this icon via keyboard navigation.
|
|
78
|
+
* Performs the same action as a click would, and focuses this icon's bubble
|
|
79
|
+
* if it has one.
|
|
80
|
+
*/
|
|
81
|
+
performAction(): void;
|
|
76
82
|
/**
|
|
77
83
|
* Returns the block that this icon is attached to.
|
|
78
84
|
*
|
package/core/inputs/input.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ import '../field_label.js';
|
|
|
12
12
|
import type { Block } from '../block.js';
|
|
13
13
|
import type { BlockSvg } from '../block_svg.js';
|
|
14
14
|
import type { Connection } from '../connection.js';
|
|
15
|
-
import
|
|
15
|
+
import { ConnectionType } from '../connection_type.js';
|
|
16
16
|
import type { Field } from '../field.js';
|
|
17
|
+
import { Verbosity } from '../utils/aria.js';
|
|
17
18
|
import { Align } from './align.js';
|
|
18
19
|
import { inputTypes } from './input_types.js';
|
|
19
20
|
/** Class for an input with optional fields. */
|
|
@@ -143,5 +144,25 @@ export declare class Input {
|
|
|
143
144
|
* or rendered connection, based on the type of this input's source block.
|
|
144
145
|
*/
|
|
145
146
|
protected makeConnection(type: ConnectionType): Connection;
|
|
147
|
+
/**
|
|
148
|
+
* Returns an ID for the visual "row" this input is part of.
|
|
149
|
+
*
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
getRowId(): string;
|
|
153
|
+
/**
|
|
154
|
+
* Returns an accessibility label describing this input, including the labels
|
|
155
|
+
* of any fields on the input and the labels of any connected blocks, to help
|
|
156
|
+
* disambiguate this input from others on the same block.
|
|
157
|
+
*
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
getLabel(verbosity?: Verbosity): string;
|
|
161
|
+
/**
|
|
162
|
+
* Returns the index of this input on its source block.
|
|
163
|
+
*
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
getIndex(): number;
|
|
146
167
|
}
|
|
147
168
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -24,4 +24,11 @@ export interface IBoundedElement {
|
|
|
24
24
|
*/
|
|
25
25
|
moveBy(dx: number, dy: number, reason?: string[]): void;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether or not the given object conforms to IBoundedElement.
|
|
29
|
+
*
|
|
30
|
+
* @param object The object to test for conformance.
|
|
31
|
+
* @returns True if the object conforms to IBoundedElement, otherwise false.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isBoundedElement(object: any): object is IBoundedElement;
|
|
27
34
|
//# sourceMappingURL=i_bounded_element.d.ts.map
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Coordinate } from '../utils/coordinate.js';
|
|
7
|
+
import { IBoundedElement } from './i_bounded_element.js';
|
|
7
8
|
import type { IContextMenu } from './i_contextmenu.js';
|
|
8
9
|
import type { IDraggable } from './i_draggable.js';
|
|
9
|
-
import {
|
|
10
|
+
import { ISelectable } from './i_selectable.js';
|
|
10
11
|
/**
|
|
11
12
|
* A bubble interface.
|
|
12
13
|
*/
|
|
13
|
-
export interface IBubble extends IDraggable, IContextMenu,
|
|
14
|
+
export interface IBubble extends IDraggable, IContextMenu, ISelectable, IBoundedElement {
|
|
14
15
|
/**
|
|
15
16
|
* Return the coordinates of the top-left corner of this bubble's body
|
|
16
17
|
* relative to the drawing surface's origin (0,0), in workspace units.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type ISelectableToolboxItem } from './i_selectable_toolbox_item.js';
|
|
7
7
|
import type { IToolboxItem } from './i_toolbox_item.js';
|
|
8
8
|
/**
|
|
9
9
|
* Interface for an item in the toolbox that can be collapsed.
|
|
@@ -25,4 +25,8 @@ export interface ICollapsibleToolboxItem extends ISelectableToolboxItem {
|
|
|
25
25
|
/** Toggles whether or not the toolbox item is expanded. */
|
|
26
26
|
toggleExpanded(): void;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Type guard that checks whether an object is an ICollapsibleToolboxItem.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isCollapsibleToolboxItem(obj: any): obj is ICollapsibleToolboxItem;
|
|
28
32
|
//# sourceMappingURL=i_collapsible_toolbox_item.d.ts.map
|
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Coordinate } from '../utils/coordinate';
|
|
6
|
+
import type { Coordinate } from '../utils/coordinate.js';
|
|
7
|
+
import type { IBoundedElement } from './i_bounded_element.js';
|
|
8
|
+
import type { ISelectable } from './i_selectable.js';
|
|
9
|
+
export declare enum DragDisposition {
|
|
10
|
+
COMMIT = 1,
|
|
11
|
+
DELETE = 2,
|
|
12
|
+
REVERT = 3
|
|
13
|
+
}
|
|
7
14
|
/**
|
|
8
15
|
* Represents an object that can be dragged.
|
|
9
16
|
*/
|
|
10
|
-
export interface IDraggable extends IDragStrategy {
|
|
17
|
+
export interface IDraggable extends IDragStrategy, IBoundedElement, ISelectable {
|
|
11
18
|
/**
|
|
12
|
-
* Returns the current location of the draggable in workspace
|
|
13
|
-
* coordinates.
|
|
19
|
+
* Returns the current location of the draggable in workspace coordinates.
|
|
14
20
|
*
|
|
15
21
|
* @returns Coordinate of current location on workspace.
|
|
16
22
|
*/
|
|
@@ -23,31 +29,30 @@ export interface IDragStrategy {
|
|
|
23
29
|
* Handles any drag startup (e.g moving elements to the front of the
|
|
24
30
|
* workspace).
|
|
25
31
|
*
|
|
26
|
-
* @param e
|
|
27
|
-
*
|
|
28
|
-
*
|
|
32
|
+
* @param e Event that started the drag; can be used to check modifier keys,
|
|
33
|
+
* etc. May be missing when dragging is triggered programmatically rather
|
|
34
|
+
* than by user.
|
|
29
35
|
*/
|
|
30
|
-
startDrag(e?: PointerEvent):
|
|
36
|
+
startDrag(e?: PointerEvent | KeyboardEvent): IDraggable;
|
|
31
37
|
/**
|
|
32
38
|
* Handles moving elements to the new location, and updating any
|
|
33
39
|
* visuals based on that (e.g connection previews for blocks).
|
|
34
40
|
*
|
|
35
41
|
* @param newLoc Workspace coordinate to which the draggable has
|
|
36
42
|
* been dragged.
|
|
37
|
-
* @param e
|
|
38
|
-
*
|
|
43
|
+
* @param e Event that continued the drag. Can be used to check modifier
|
|
44
|
+
* keys, etc.
|
|
39
45
|
*/
|
|
40
|
-
drag(newLoc: Coordinate, e?: PointerEvent): void;
|
|
46
|
+
drag(newLoc: Coordinate, e?: PointerEvent | KeyboardEvent): void;
|
|
41
47
|
/**
|
|
42
|
-
* Handles any drag cleanup, including e.g. connecting or deleting
|
|
43
|
-
* blocks.
|
|
48
|
+
* Handles any drag cleanup, including e.g. connecting or deleting blocks.
|
|
44
49
|
*
|
|
45
50
|
* @param newLoc Workspace coordinate at which the drag finished.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
51
|
+
* @param e Event that finished the drag. Can be used to check modifier keys,
|
|
52
|
+
* etc.
|
|
53
|
+
* @param disposition The end result of the drag.
|
|
49
54
|
*/
|
|
50
|
-
endDrag(e
|
|
55
|
+
endDrag(e: PointerEvent | KeyboardEvent | undefined, disposition: DragDisposition): void;
|
|
51
56
|
/** Moves the draggable back to where it was at the start of the drag. */
|
|
52
57
|
revertDrag(): void;
|
|
53
58
|
}
|
|
@@ -3,30 +3,39 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Coordinate } from '../utils/coordinate';
|
|
6
|
+
import type { Coordinate } from '../utils/coordinate';
|
|
7
|
+
import type { IDraggable } from './i_draggable';
|
|
7
8
|
export interface IDragger {
|
|
8
9
|
/**
|
|
9
10
|
* Handles any drag startup.
|
|
10
11
|
*
|
|
11
|
-
* @param e
|
|
12
|
+
* @param e Event that started the drag.
|
|
12
13
|
*/
|
|
13
|
-
onDragStart(e
|
|
14
|
+
onDragStart(e?: PointerEvent | KeyboardEvent): IDraggable;
|
|
14
15
|
/**
|
|
15
16
|
* Handles dragging, including calculating where the element should
|
|
16
17
|
* actually be moved to.
|
|
17
18
|
*
|
|
18
|
-
* @param e
|
|
19
|
-
* @param totalDelta The total distance, in pixels, that the
|
|
19
|
+
* @param e Event that continued the drag.
|
|
20
|
+
* @param totalDelta The total distance, in pixels, that the draggable
|
|
20
21
|
* has moved since the start of the drag.
|
|
21
22
|
*/
|
|
22
|
-
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
23
|
+
onDrag(e: PointerEvent | KeyboardEvent | undefined, totalDelta: Coordinate): void;
|
|
23
24
|
/**
|
|
24
|
-
* Handles any drag cleanup.
|
|
25
|
+
* Handles any drag cleanup when a drag finishes normally.
|
|
25
26
|
*
|
|
26
|
-
* @param e
|
|
27
|
-
* @param totalDelta The total distance, in pixels, that the
|
|
27
|
+
* @param e Event that finished the drag.
|
|
28
|
+
* @param totalDelta The total distance, in pixels, that the draggable
|
|
28
29
|
* has moved since the start of the drag.
|
|
29
30
|
*/
|
|
30
|
-
onDragEnd(e: PointerEvent, totalDelta: Coordinate): void;
|
|
31
|
+
onDragEnd(e: PointerEvent | KeyboardEvent | undefined, totalDelta: Coordinate): void;
|
|
32
|
+
/**
|
|
33
|
+
* Handles any drag cleanup when a drag is reverted.
|
|
34
|
+
*
|
|
35
|
+
* @param e Event that finished the drag.
|
|
36
|
+
* @param totalDelta The total distance, in pixels, that the draggable
|
|
37
|
+
* has moved since the start of the drag.
|
|
38
|
+
*/
|
|
39
|
+
onDragRevert(e: PointerEvent | KeyboardEvent | undefined, totalDelta: Coordinate): void;
|
|
31
40
|
}
|
|
32
41
|
//# sourceMappingURL=i_dragger.d.ts.map
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { BlockSvg } from '../block_svg.js';
|
|
7
6
|
import type { FlyoutItem } from '../flyout_item.js';
|
|
8
|
-
import type { Coordinate } from '../utils/coordinate.js';
|
|
9
7
|
import type { Svg } from '../utils/svg.js';
|
|
10
8
|
import type { FlyoutDefinition } from '../utils/toolbox.js';
|
|
11
9
|
import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
12
|
-
import { IFocusableTree } from './i_focusable_tree.js';
|
|
13
10
|
import type { IRegistrable } from './i_registrable.js';
|
|
14
11
|
/**
|
|
15
12
|
* Interface for a flyout.
|
|
16
13
|
*/
|
|
17
|
-
export interface IFlyout extends IRegistrable
|
|
14
|
+
export interface IFlyout extends IRegistrable {
|
|
18
15
|
/** Whether the flyout is laid out horizontally or not. */
|
|
19
16
|
horizontalLayout: boolean;
|
|
20
17
|
/** Is RTL vs LTR. */
|
|
@@ -105,14 +102,6 @@ export interface IFlyout extends IRegistrable, IFocusableTree {
|
|
|
105
102
|
* @returns List of flyout items.
|
|
106
103
|
*/
|
|
107
104
|
getContents(): FlyoutItem[];
|
|
108
|
-
/**
|
|
109
|
-
* Create a copy of this block on the workspace.
|
|
110
|
-
*
|
|
111
|
-
* @param originalBlock The block to copy from the flyout.
|
|
112
|
-
* @returns The newly created block.
|
|
113
|
-
* @throws {Error} if something went wrong with deserialization.
|
|
114
|
-
*/
|
|
115
|
-
createBlock(originalBlock: BlockSvg): BlockSvg;
|
|
116
105
|
/** Reflow blocks and their mats. */
|
|
117
106
|
reflow(): void;
|
|
118
107
|
/**
|
|
@@ -134,25 +123,6 @@ export interface IFlyout extends IRegistrable, IFocusableTree {
|
|
|
134
123
|
getY(): number;
|
|
135
124
|
/** Position the flyout. */
|
|
136
125
|
position(): void;
|
|
137
|
-
/**
|
|
138
|
-
* Determine if a drag delta is toward the workspace, based on the position
|
|
139
|
-
* and orientation of the flyout. This is used in determineDragIntention_ to
|
|
140
|
-
* determine if a new block should be created or if the flyout should scroll.
|
|
141
|
-
*
|
|
142
|
-
* @param currentDragDeltaXY How far the pointer has moved from the position
|
|
143
|
-
* at mouse down, in pixel units.
|
|
144
|
-
* @returns True if the drag is toward the workspace.
|
|
145
|
-
*/
|
|
146
|
-
isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Does this flyout allow you to create a new instance of the given block?
|
|
149
|
-
* Used for deciding if a block can be "dragged out of" the flyout.
|
|
150
|
-
*
|
|
151
|
-
* @param block The block to copy from the flyout.
|
|
152
|
-
* @returns True if you can create a new instance of the block, false
|
|
153
|
-
* otherwise.
|
|
154
|
-
*/
|
|
155
|
-
isBlockCreatable(block: BlockSvg): boolean;
|
|
156
126
|
/** Scroll the flyout to the beginning of its contents. */
|
|
157
127
|
scrollToStart(): void;
|
|
158
128
|
}
|
|
@@ -93,6 +93,14 @@ export interface IFocusableNode {
|
|
|
93
93
|
* @returns Whether this node can be focused by FocusManager.
|
|
94
94
|
*/
|
|
95
95
|
canBeFocused(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Optional method invoked when this node has focus and the user acts on it by
|
|
98
|
+
* pressing Enter or Space. Behavior should generally be similar to the node
|
|
99
|
+
* being clicked on.
|
|
100
|
+
*
|
|
101
|
+
* @param e The event that triggered this action, if any.
|
|
102
|
+
*/
|
|
103
|
+
performAction?(e?: Event): void;
|
|
96
104
|
}
|
|
97
105
|
/**
|
|
98
106
|
* Determines whether the provided object fulfills the contract of
|