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
|
@@ -18,8 +18,6 @@ import { EventType } from './type.js';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class CommentCreate extends CommentBase {
|
|
20
20
|
type: EventType;
|
|
21
|
-
/** The XML representation of the created workspace comment. */
|
|
22
|
-
xml?: Element | DocumentFragment;
|
|
23
21
|
/** The JSON representation of the created workspace comment. */
|
|
24
22
|
json?: comments.State;
|
|
25
23
|
/**
|
|
@@ -51,7 +49,6 @@ export declare class CommentCreate extends CommentBase {
|
|
|
51
49
|
run(forward: boolean): void;
|
|
52
50
|
}
|
|
53
51
|
export interface CommentCreateJson extends CommentBaseJson {
|
|
54
|
-
xml: string;
|
|
55
52
|
json: object;
|
|
56
53
|
}
|
|
57
54
|
//# sourceMappingURL=events_comment_create.d.ts.map
|
|
@@ -18,8 +18,6 @@ import { EventType } from './type.js';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class CommentDelete extends CommentBase {
|
|
20
20
|
type: EventType;
|
|
21
|
-
/** The XML representation of the deleted workspace comment. */
|
|
22
|
-
xml?: Element;
|
|
23
21
|
/** The JSON representation of the created workspace comment. */
|
|
24
22
|
json?: comments.State;
|
|
25
23
|
/**
|
|
@@ -51,7 +49,6 @@ export declare class CommentDelete extends CommentBase {
|
|
|
51
49
|
static fromJson(json: CommentDeleteJson, workspace: Workspace, event?: any): CommentDelete;
|
|
52
50
|
}
|
|
53
51
|
export interface CommentDeleteJson extends CommentBaseJson {
|
|
54
|
-
xml: string;
|
|
55
52
|
json: object;
|
|
56
53
|
}
|
|
57
54
|
//# sourceMappingURL=events_comment_delete.d.ts.map
|
package/core/field.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
|
|
|
70
70
|
protected value_: T | null;
|
|
71
71
|
/** Validation function called when user edits an editable field. */
|
|
72
72
|
protected validator_: FieldValidator<T> | null;
|
|
73
|
+
/** The ARIA-friendly label representation of this field's type. */
|
|
74
|
+
protected ariaTypeName: string | null;
|
|
73
75
|
/**
|
|
74
76
|
* Used to cache the field's tooltip value if setTooltip is called when the
|
|
75
77
|
* field is not yet initialized. Is *not* guaranteed to be accurate.
|
|
@@ -184,6 +186,67 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
|
|
|
184
186
|
* @throws An error if the source block is not defined.
|
|
185
187
|
*/
|
|
186
188
|
getSourceBlock(): Block | null;
|
|
189
|
+
/**
|
|
190
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
191
|
+
*
|
|
192
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
193
|
+
* version of the ARIA representation of the field's type.
|
|
194
|
+
*
|
|
195
|
+
* @returns An ARIA representation of the field's type or null if it is
|
|
196
|
+
* unspecified.
|
|
197
|
+
*/
|
|
198
|
+
getAriaTypeName(): string | null;
|
|
199
|
+
/**
|
|
200
|
+
* Gets an ARIA-friendly label representation of this field's value.
|
|
201
|
+
*
|
|
202
|
+
* Note that implementations should generally always override this value to
|
|
203
|
+
* ensure a non-null value is returned since the default implementation relies
|
|
204
|
+
* on 'getValue' which may return null, and a null return value for this
|
|
205
|
+
* function will prompt ARIA label generation to skip the field's value
|
|
206
|
+
* entirely when there may be a better contextual placeholder to use, instead,
|
|
207
|
+
* specific to the field.
|
|
208
|
+
*
|
|
209
|
+
* For example, a text input field may have a value of null when empty. To
|
|
210
|
+
* avoid hiding this field from screen reader, implementations should ensure
|
|
211
|
+
* that if the value is null, this function would return an appropriate,
|
|
212
|
+
* localized value such as "empty text".
|
|
213
|
+
*
|
|
214
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
215
|
+
* version of the ARIA representation of the field's value.
|
|
216
|
+
*
|
|
217
|
+
* @returns An ARIA representation of the field's value, or null if no value
|
|
218
|
+
* is currently defined or known for the field.
|
|
219
|
+
*/
|
|
220
|
+
getAriaValue(): string | null;
|
|
221
|
+
/**
|
|
222
|
+
* Computes a descriptive ARIA label to represent this field with configurable
|
|
223
|
+
* verbosity.
|
|
224
|
+
*
|
|
225
|
+
* A 'verbose' label includes type information, if available, whereas a
|
|
226
|
+
* non-verbose label only contains the field's value.
|
|
227
|
+
*
|
|
228
|
+
* Note that this will always return the latest representation of the field's
|
|
229
|
+
* label which may differ from any previously set ARIA label for the field
|
|
230
|
+
* itself. Implementations are largely responsible for ensuring that the
|
|
231
|
+
* field's ARIA label is set correctly at relevant moments in the field's
|
|
232
|
+
* lifecycle (such as when its value changes).
|
|
233
|
+
*
|
|
234
|
+
* Finally, it is never guaranteed that implementations use the label returned
|
|
235
|
+
* by this method for their actual ARIA label. Some implementations may rely
|
|
236
|
+
* on other contexts to convey information like the field's value. Example:
|
|
237
|
+
* checkboxes represent their checked/non-checked status (i.e. value) through
|
|
238
|
+
* a separate ARIA property.
|
|
239
|
+
*
|
|
240
|
+
* It's possible this returns an empty string if the field doesn't supply type
|
|
241
|
+
* or value information for certain cases (such as a null value). This can
|
|
242
|
+
* lead to the field being potentially COMPLETELY HIDDEN for screen reader
|
|
243
|
+
* navigation so it's crucial for implementations to ensure a non-empty value
|
|
244
|
+
* is returned here.
|
|
245
|
+
*
|
|
246
|
+
* @param includeTypeInfo Whether to include the field's type information in
|
|
247
|
+
* the returned label, if available.
|
|
248
|
+
*/
|
|
249
|
+
computeAriaLabel(includeTypeInfo?: boolean): string;
|
|
187
250
|
/**
|
|
188
251
|
* Initialize everything to render this field. Override
|
|
189
252
|
* methods initModel and initView rather than this method.
|
|
@@ -684,6 +747,11 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
|
|
|
684
747
|
onNodeBlur(): void;
|
|
685
748
|
/** See IFocusableNode.canBeFocused. */
|
|
686
749
|
canBeFocused(): boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Handles the user acting on this field via keyboard navigation.
|
|
752
|
+
* Shows and focuses the field editor.
|
|
753
|
+
*/
|
|
754
|
+
performAction(): void;
|
|
687
755
|
/**
|
|
688
756
|
* Subclasses should reimplement this method to construct their Field
|
|
689
757
|
* subclass from a JSON arg object.
|
|
@@ -701,6 +769,7 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
|
|
|
701
769
|
*/
|
|
702
770
|
export interface FieldConfig {
|
|
703
771
|
tooltip?: string;
|
|
772
|
+
ariaTypeName?: string;
|
|
704
773
|
}
|
|
705
774
|
/**
|
|
706
775
|
* Represents an object that has all the prototype properties of the `Field`
|
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/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,7 +12,7 @@ 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
17
|
import { Align } from './align.js';
|
|
18
18
|
import { inputTypes } from './input_types.js';
|
|
@@ -143,5 +143,11 @@ export declare class Input {
|
|
|
143
143
|
* or rendered connection, based on the type of this input's source block.
|
|
144
144
|
*/
|
|
145
145
|
protected makeConnection(type: ConnectionType): Connection;
|
|
146
|
+
/**
|
|
147
|
+
* Returns an ID for the visual "row" this input is part of.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
getRowId(): string;
|
|
146
152
|
}
|
|
147
153
|
//# 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
|