blockly 12.0.0-beta.4 → 12.0.0-beta.5
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 +552 -494
- package/blockly.mjs +10 -0
- package/blockly_compressed.js +517 -492
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +2 -2
- package/blocks_compressed.js.map +1 -1
- package/core/block_svg.d.ts +36 -20
- package/core/blockly.d.ts +13 -1
- package/core/connection.d.ts +2 -0
- package/core/contextmenu_registry.d.ts +11 -9
- package/core/dialog.d.ts +36 -16
- package/core/field.d.ts +29 -31
- package/core/field_checkbox.d.ts +9 -0
- package/core/field_dropdown.d.ts +19 -2
- package/core/field_image.d.ts +9 -0
- package/core/field_label.d.ts +9 -0
- package/core/field_number.d.ts +9 -0
- package/core/field_textinput.d.ts +9 -0
- package/core/flyout_base.d.ts +23 -1
- package/core/flyout_button.d.ts +30 -7
- package/core/flyout_item.d.ts +3 -9
- package/core/flyout_separator.d.ts +18 -1
- package/core/focus_manager.d.ts +82 -14
- package/core/interfaces/i_ast_node_location_svg.d.ts +0 -12
- package/core/interfaces/i_autohideable.d.ts +2 -0
- package/core/interfaces/i_flyout.d.ts +2 -1
- package/core/interfaces/i_focusable_node.d.ts +31 -2
- package/core/interfaces/i_focusable_tree.d.ts +67 -0
- package/core/interfaces/i_navigable.d.ts +30 -0
- package/core/interfaces/i_navigation_policy.d.ts +42 -0
- package/core/interfaces/i_toolbox.d.ts +2 -1
- package/core/interfaces/i_toolbox_item.d.ts +2 -1
- package/core/keyboard_nav/ast_node.d.ts +1 -113
- package/core/keyboard_nav/block_navigation_policy.d.ts +56 -0
- package/core/keyboard_nav/connection_navigation_policy.d.ts +53 -0
- package/core/keyboard_nav/field_navigation_policy.d.ts +42 -0
- package/core/keyboard_nav/flyout_button_navigation_policy.d.ts +42 -0
- package/core/keyboard_nav/flyout_navigation_policy.d.ts +51 -0
- package/core/keyboard_nav/flyout_separator_navigation_policy.d.ts +19 -0
- package/core/keyboard_nav/line_cursor.d.ts +32 -103
- package/core/keyboard_nav/marker.d.ts +20 -29
- package/core/keyboard_nav/workspace_navigation_policy.d.ts +42 -0
- package/core/marker_manager.d.ts +0 -26
- package/core/navigator.d.ts +65 -0
- package/core/rendered_connection.d.ts +35 -1
- package/core/renderers/common/block_rendering.d.ts +1 -2
- package/core/renderers/common/drawer.d.ts +1 -1
- package/core/renderers/common/i_path_object.d.ts +1 -25
- package/core/renderers/common/path_object.d.ts +1 -26
- package/core/renderers/common/renderer.d.ts +0 -11
- package/core/renderers/zelos/drawer.d.ts +1 -1
- package/core/renderers/zelos/renderer.d.ts +0 -11
- package/core/renderers/zelos/zelos.d.ts +1 -2
- package/core/shortcut_registry.d.ts +7 -2
- package/core/toast.d.ts +74 -0
- package/core/toolbox/toolbox.d.ts +23 -1
- package/core/toolbox/toolbox_item.d.ts +9 -0
- package/core/utils/aria.d.ts +5 -2
- package/core/variable_map.d.ts +4 -4
- package/core/variables.d.ts +3 -1
- package/core/workspace.d.ts +10 -9
- package/core/workspace_svg.d.ts +103 -47
- package/index.mjs +10 -0
- package/msg/ab.js +33 -0
- package/msg/ab.mjs +33 -0
- package/msg/ace.js +33 -0
- package/msg/ace.mjs +33 -0
- package/msg/af.js +33 -0
- package/msg/af.mjs +33 -0
- package/msg/am.js +33 -0
- package/msg/am.mjs +33 -0
- package/msg/ar.js +33 -0
- package/msg/ar.mjs +33 -0
- package/msg/ast.js +33 -0
- package/msg/ast.mjs +33 -0
- package/msg/az.js +33 -0
- package/msg/az.mjs +33 -0
- package/msg/ba.js +33 -0
- package/msg/ba.mjs +33 -0
- package/msg/bcc.js +33 -0
- package/msg/bcc.mjs +33 -0
- package/msg/be-tarask.js +33 -0
- package/msg/be-tarask.mjs +33 -0
- package/msg/be.js +33 -0
- package/msg/be.mjs +33 -0
- package/msg/bg.js +33 -0
- package/msg/bg.mjs +33 -0
- package/msg/bn.js +33 -0
- package/msg/bn.mjs +33 -0
- package/msg/br.js +33 -0
- package/msg/br.mjs +33 -0
- package/msg/bs.js +33 -0
- package/msg/bs.mjs +33 -0
- package/msg/ca.js +33 -0
- package/msg/ca.mjs +33 -0
- package/msg/cdo.js +33 -0
- package/msg/cdo.mjs +33 -0
- package/msg/ce.js +33 -0
- package/msg/ce.mjs +33 -0
- package/msg/cs.js +33 -0
- package/msg/cs.mjs +33 -0
- package/msg/da.js +33 -0
- package/msg/da.mjs +33 -0
- package/msg/de.js +33 -0
- package/msg/de.mjs +33 -0
- package/msg/diq.js +33 -0
- package/msg/diq.mjs +33 -0
- package/msg/dtp.js +33 -0
- package/msg/dtp.mjs +33 -0
- package/msg/dty.js +33 -0
- package/msg/dty.mjs +33 -0
- package/msg/ee.js +33 -0
- package/msg/ee.mjs +33 -0
- package/msg/el.js +33 -0
- package/msg/el.mjs +33 -0
- package/msg/en-gb.js +33 -0
- package/msg/en-gb.mjs +33 -0
- package/msg/en.js +33 -0
- package/msg/en.mjs +33 -0
- package/msg/eo.js +33 -0
- package/msg/eo.mjs +33 -0
- package/msg/es.js +33 -0
- package/msg/es.mjs +33 -0
- package/msg/et.js +33 -0
- package/msg/et.mjs +33 -0
- package/msg/eu.js +33 -0
- package/msg/eu.mjs +33 -0
- package/msg/fa.js +33 -0
- package/msg/fa.mjs +33 -0
- package/msg/fi.js +33 -0
- package/msg/fi.mjs +33 -0
- package/msg/fo.js +33 -0
- package/msg/fo.mjs +33 -0
- package/msg/fr.js +33 -0
- package/msg/fr.mjs +33 -0
- package/msg/frr.js +33 -0
- package/msg/frr.mjs +33 -0
- package/msg/gl.js +33 -0
- package/msg/gl.mjs +33 -0
- package/msg/gn.js +33 -0
- package/msg/gn.mjs +33 -0
- package/msg/gor.js +33 -0
- package/msg/gor.mjs +33 -0
- package/msg/ha.js +33 -0
- package/msg/ha.mjs +33 -0
- package/msg/hak.js +33 -0
- package/msg/hak.mjs +33 -0
- package/msg/he.js +33 -0
- package/msg/he.mjs +33 -0
- package/msg/hi.js +33 -0
- package/msg/hi.mjs +33 -0
- package/msg/hr.js +33 -0
- package/msg/hr.mjs +33 -0
- package/msg/hrx.js +33 -0
- package/msg/hrx.mjs +33 -0
- package/msg/hsb.js +33 -0
- package/msg/hsb.mjs +33 -0
- package/msg/hu.js +33 -0
- package/msg/hu.mjs +33 -0
- package/msg/hy.js +33 -0
- package/msg/hy.mjs +33 -0
- package/msg/ia.js +33 -0
- package/msg/ia.mjs +33 -0
- package/msg/id.js +33 -0
- package/msg/id.mjs +33 -0
- package/msg/ig.js +33 -0
- package/msg/ig.mjs +33 -0
- package/msg/inh.js +33 -0
- package/msg/inh.mjs +33 -0
- package/msg/is.js +33 -0
- package/msg/is.mjs +33 -0
- package/msg/it.js +33 -0
- package/msg/it.mjs +33 -0
- package/msg/ja.js +33 -0
- package/msg/ja.mjs +33 -0
- package/msg/ka.js +33 -0
- package/msg/ka.mjs +33 -0
- package/msg/kab.js +33 -0
- package/msg/kab.mjs +33 -0
- package/msg/kbd-cyrl.js +33 -0
- package/msg/kbd-cyrl.mjs +33 -0
- package/msg/km.js +33 -0
- package/msg/km.mjs +33 -0
- package/msg/kn.js +33 -0
- package/msg/kn.mjs +33 -0
- package/msg/ko.js +33 -0
- package/msg/ko.mjs +33 -0
- package/msg/ksh.js +33 -0
- package/msg/ksh.mjs +33 -0
- package/msg/ku-latn.js +33 -0
- package/msg/ku-latn.mjs +33 -0
- package/msg/ky.js +33 -0
- package/msg/ky.mjs +33 -0
- package/msg/la.js +33 -0
- package/msg/la.mjs +33 -0
- package/msg/lb.js +33 -0
- package/msg/lb.mjs +33 -0
- package/msg/lki.js +33 -0
- package/msg/lki.mjs +33 -0
- package/msg/lo.js +33 -0
- package/msg/lo.mjs +33 -0
- package/msg/lrc.js +33 -0
- package/msg/lrc.mjs +33 -0
- package/msg/lt.js +33 -0
- package/msg/lt.mjs +33 -0
- package/msg/lv.js +33 -0
- package/msg/lv.mjs +33 -0
- package/msg/mg.js +33 -0
- package/msg/mg.mjs +33 -0
- package/msg/mk.js +33 -0
- package/msg/mk.mjs +33 -0
- package/msg/ml.js +33 -0
- package/msg/ml.mjs +33 -0
- package/msg/mnw.js +33 -0
- package/msg/mnw.mjs +33 -0
- package/msg/ms.js +33 -0
- package/msg/ms.mjs +33 -0
- package/msg/my.js +33 -0
- package/msg/my.mjs +33 -0
- package/msg/mzn.js +33 -0
- package/msg/mzn.mjs +33 -0
- package/msg/nb.js +33 -0
- package/msg/nb.mjs +33 -0
- package/msg/ne.js +33 -0
- package/msg/ne.mjs +33 -0
- package/msg/nl.js +33 -0
- package/msg/nl.mjs +33 -0
- package/msg/oc.js +33 -0
- package/msg/oc.mjs +33 -0
- package/msg/olo.js +33 -0
- package/msg/olo.mjs +33 -0
- package/msg/pa.js +33 -0
- package/msg/pa.mjs +33 -0
- package/msg/pl.js +33 -0
- package/msg/pl.mjs +33 -0
- package/msg/pms.js +33 -0
- package/msg/pms.mjs +33 -0
- package/msg/ps.js +33 -0
- package/msg/ps.mjs +33 -0
- package/msg/pt-br.js +33 -0
- package/msg/pt-br.mjs +33 -0
- package/msg/pt.js +33 -0
- package/msg/pt.mjs +33 -0
- package/msg/ro.js +33 -0
- package/msg/ro.mjs +33 -0
- package/msg/ru.js +33 -0
- package/msg/ru.mjs +33 -0
- package/msg/sc.js +33 -0
- package/msg/sc.mjs +33 -0
- package/msg/sco.js +33 -0
- package/msg/sco.mjs +33 -0
- package/msg/sd.js +33 -0
- package/msg/sd.mjs +33 -0
- package/msg/shn.js +33 -0
- package/msg/shn.mjs +33 -0
- package/msg/si.js +33 -0
- package/msg/si.mjs +33 -0
- package/msg/sk.js +33 -0
- package/msg/sk.mjs +33 -0
- package/msg/skr-arab.js +33 -0
- package/msg/skr-arab.mjs +33 -0
- package/msg/sl.js +33 -0
- package/msg/sl.mjs +33 -0
- package/msg/smn.js +33 -0
- package/msg/smn.mjs +33 -0
- package/msg/sq.js +33 -0
- package/msg/sq.mjs +33 -0
- package/msg/sr-latn.js +33 -0
- package/msg/sr-latn.mjs +33 -0
- package/msg/sr.js +33 -0
- package/msg/sr.mjs +33 -0
- package/msg/sv.js +33 -0
- package/msg/sv.mjs +33 -0
- package/msg/sw.js +33 -0
- package/msg/sw.mjs +33 -0
- package/msg/ta.js +33 -0
- package/msg/ta.mjs +33 -0
- package/msg/tcy.js +33 -0
- package/msg/tcy.mjs +33 -0
- package/msg/tdd.js +33 -0
- package/msg/tdd.mjs +33 -0
- package/msg/te.js +33 -0
- package/msg/te.mjs +33 -0
- package/msg/th.js +33 -0
- package/msg/th.mjs +33 -0
- package/msg/ti.js +33 -0
- package/msg/ti.mjs +33 -0
- package/msg/tl.js +33 -0
- package/msg/tl.mjs +33 -0
- package/msg/tlh.js +33 -0
- package/msg/tlh.mjs +33 -0
- package/msg/tr.js +33 -0
- package/msg/tr.mjs +33 -0
- package/msg/ug-arab.js +33 -0
- package/msg/ug-arab.mjs +33 -0
- package/msg/uk.js +33 -0
- package/msg/uk.mjs +33 -0
- package/msg/ur.js +33 -0
- package/msg/ur.mjs +33 -0
- package/msg/uz.js +33 -0
- package/msg/uz.mjs +33 -0
- package/msg/vi.js +33 -0
- package/msg/vi.mjs +33 -0
- package/msg/xmf.js +33 -0
- package/msg/xmf.mjs +33 -0
- package/msg/yo.js +33 -0
- package/msg/yo.mjs +33 -0
- package/msg/zgh.js +33 -0
- package/msg/zgh.mjs +33 -0
- package/msg/zh-hans.js +33 -0
- package/msg/zh-hans.mjs +33 -0
- package/msg/zh-hant.js +33 -0
- package/msg/zh-hant.mjs +33 -0
- package/package.json +4 -4
- package/core/renderers/common/marker_svg.d.ts +0 -256
- package/core/renderers/zelos/marker_svg.d.ts +0 -49
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { INavigable } from './interfaces/i_navigable.js';
|
|
7
|
+
import type { INavigationPolicy } from './interfaces/i_navigation_policy.js';
|
|
8
|
+
/**
|
|
9
|
+
* Class responsible for determining where focus should move in response to
|
|
10
|
+
* keyboard navigation commands.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Navigator {
|
|
13
|
+
/**
|
|
14
|
+
* Map from classes to a corresponding ruleset to handle navigation from
|
|
15
|
+
* instances of that class.
|
|
16
|
+
*/
|
|
17
|
+
private rules;
|
|
18
|
+
/**
|
|
19
|
+
* Associates a navigation ruleset with its corresponding class.
|
|
20
|
+
*
|
|
21
|
+
* @param key The class whose object instances should have their navigation
|
|
22
|
+
* controlled by the associated policy.
|
|
23
|
+
* @param policy A ruleset that determines where focus should move starting
|
|
24
|
+
* from an instance of the given class.
|
|
25
|
+
*/
|
|
26
|
+
set<T extends INavigable<T>>(key: new (...args: any) => T, policy: INavigationPolicy<T>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the navigation ruleset associated with the given object instance's
|
|
29
|
+
* class.
|
|
30
|
+
*
|
|
31
|
+
* @param key An object to retrieve a navigation ruleset for.
|
|
32
|
+
* @returns The navigation ruleset of objects of the given object's class, or
|
|
33
|
+
* undefined if no ruleset has been registered for the object's class.
|
|
34
|
+
*/
|
|
35
|
+
private get;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the first child of the given object instance, if any.
|
|
38
|
+
*
|
|
39
|
+
* @param current The object to retrieve the first child of.
|
|
40
|
+
* @returns The first child node of the given object, if any.
|
|
41
|
+
*/
|
|
42
|
+
getFirstChild<T extends INavigable<T>>(current: T): INavigable<any> | null;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the parent of the given object instance, if any.
|
|
45
|
+
*
|
|
46
|
+
* @param current The object to retrieve the parent of.
|
|
47
|
+
* @returns The parent node of the given object, if any.
|
|
48
|
+
*/
|
|
49
|
+
getParent<T extends INavigable<T>>(current: T): INavigable<any> | null;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the next sibling of the given object instance, if any.
|
|
52
|
+
*
|
|
53
|
+
* @param current The object to retrieve the next sibling node of.
|
|
54
|
+
* @returns The next sibling node of the given object, if any.
|
|
55
|
+
*/
|
|
56
|
+
getNextSibling<T extends INavigable<T>>(current: T): INavigable<any> | null;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the previous sibling of the given object instance, if any.
|
|
59
|
+
*
|
|
60
|
+
* @param current The object to retrieve the previous sibling node of.
|
|
61
|
+
* @returns The previous sibling node of the given object, if any.
|
|
62
|
+
*/
|
|
63
|
+
getPreviousSibling<T extends INavigable<T>>(current: T): INavigable<any> | null;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=navigator.d.ts.map
|
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
import type { Block } from './block.js';
|
|
12
12
|
import type { BlockSvg } from './block_svg.js';
|
|
13
13
|
import { Connection } from './connection.js';
|
|
14
|
+
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
15
|
+
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
16
|
+
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
17
|
+
import type { INavigable } from './interfaces/i_navigable.js';
|
|
14
18
|
import { Coordinate } from './utils/coordinate.js';
|
|
15
19
|
/**
|
|
16
20
|
* Class for a connection between blocks that may be rendered on screen.
|
|
17
21
|
*/
|
|
18
|
-
export declare class RenderedConnection extends Connection {
|
|
22
|
+
export declare class RenderedConnection extends Connection implements IContextMenu, IFocusableNode, INavigable<RenderedConnection> {
|
|
19
23
|
sourceBlock_: BlockSvg;
|
|
20
24
|
private readonly db;
|
|
21
25
|
private readonly dbOpposite;
|
|
@@ -216,6 +220,36 @@ export declare class RenderedConnection extends Connection {
|
|
|
216
220
|
* @returns The connection being modified (to allow chaining).
|
|
217
221
|
*/
|
|
218
222
|
setCheck(check: string | string[] | null): RenderedConnection;
|
|
223
|
+
/**
|
|
224
|
+
* Handles showing the context menu when it is opened on a connection.
|
|
225
|
+
* Note that typically the context menu can't be opened with the mouse
|
|
226
|
+
* on a connection, because you can't select a connection. But keyboard
|
|
227
|
+
* users may open the context menu with a keyboard shortcut.
|
|
228
|
+
*
|
|
229
|
+
* @param e Event that triggered the opening of the context menu.
|
|
230
|
+
*/
|
|
231
|
+
showContextMenu(e: Event): void;
|
|
232
|
+
/** See IFocusableNode.getFocusableElement. */
|
|
233
|
+
getFocusableElement(): HTMLElement | SVGElement;
|
|
234
|
+
/** See IFocusableNode.getFocusableTree. */
|
|
235
|
+
getFocusableTree(): IFocusableTree;
|
|
236
|
+
/** See IFocusableNode.onNodeFocus. */
|
|
237
|
+
onNodeFocus(): void;
|
|
238
|
+
/** See IFocusableNode.onNodeBlur. */
|
|
239
|
+
onNodeBlur(): void;
|
|
240
|
+
private findHighlightSvg;
|
|
241
|
+
/**
|
|
242
|
+
* Returns whether or not this connection is keyboard-navigable.
|
|
243
|
+
*
|
|
244
|
+
* @returns True.
|
|
245
|
+
*/
|
|
246
|
+
isNavigable(): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Returns this connection's class for keyboard navigation.
|
|
249
|
+
*
|
|
250
|
+
* @returns RenderedConnection.
|
|
251
|
+
*/
|
|
252
|
+
getClass(): typeof RenderedConnection;
|
|
219
253
|
}
|
|
220
254
|
export declare namespace RenderedConnection {
|
|
221
255
|
/**
|
|
@@ -29,7 +29,6 @@ import { Types } from '../measurables/types.js';
|
|
|
29
29
|
import { Drawer } from './drawer.js';
|
|
30
30
|
import type { IPathObject } from './i_path_object.js';
|
|
31
31
|
import { RenderInfo } from './info.js';
|
|
32
|
-
import { MarkerSvg } from './marker_svg.js';
|
|
33
32
|
import { PathObject } from './path_object.js';
|
|
34
33
|
import { Renderer } from './renderer.js';
|
|
35
34
|
/**
|
|
@@ -59,6 +58,6 @@ export declare function unregister(name: string): void;
|
|
|
59
58
|
export declare function init(name: string, theme: Theme, opt_rendererOverrides?: {
|
|
60
59
|
[rendererConstant: string]: any;
|
|
61
60
|
}): Renderer;
|
|
62
|
-
export { BottomRow, Connection, Drawer, ExternalValueInput, Field, Hat, Icon, InlineInput, InputConnection, InputRow, InRowSpacer, IPathObject, JaggedEdge,
|
|
61
|
+
export { BottomRow, Connection, Drawer, ExternalValueInput, Field, Hat, Icon, InlineInput, InputConnection, InputRow, InRowSpacer, IPathObject, JaggedEdge, Measurable, NextConnection, OutputConnection, PathObject, PreviousConnection, Renderer, RenderInfo, RoundCorner, Row, SpacerRow, SquareCorner, StatementInput, TopRow, Types, };
|
|
63
62
|
export { BaseShape, ConstantProvider, DynamicShape, InsideCorners, JaggedTeeth, Notch, OutsideCorners, PuzzleTab, StartHat, } from './constants.js';
|
|
64
63
|
//# sourceMappingURL=block_rendering.d.ts.map
|
|
@@ -141,7 +141,7 @@ export declare class Drawer {
|
|
|
141
141
|
*/
|
|
142
142
|
protected updateConnectionHighlights(): void;
|
|
143
143
|
/** Returns a path to highlight the given connection. */
|
|
144
|
-
drawConnectionHighlightPath(measurable: Connection):
|
|
144
|
+
drawConnectionHighlightPath(measurable: Connection): SVGElement | undefined;
|
|
145
145
|
/**
|
|
146
146
|
* Returns a path to highlight the given conneciton, assuming it is an
|
|
147
147
|
* input or output connection.
|
|
@@ -23,16 +23,6 @@ export interface IPathObject {
|
|
|
23
23
|
constants: ConstantProvider;
|
|
24
24
|
/** The primary path of the block. */
|
|
25
25
|
style: BlockStyle;
|
|
26
|
-
/**
|
|
27
|
-
* Holds the cursors SVG element when the cursor is attached to the block.
|
|
28
|
-
* This is null if there is no cursor on the block.
|
|
29
|
-
*/
|
|
30
|
-
cursorSvg: SVGElement | null;
|
|
31
|
-
/**
|
|
32
|
-
* Holds the markers SVG element when the marker is attached to the block.
|
|
33
|
-
* This is null if there is no marker on the block.
|
|
34
|
-
*/
|
|
35
|
-
markerSvg: SVGElement | null;
|
|
36
26
|
/**
|
|
37
27
|
* Set the path generated by the renderer onto the respective SVG element.
|
|
38
28
|
*
|
|
@@ -43,20 +33,6 @@ export interface IPathObject {
|
|
|
43
33
|
* Flip the SVG paths in RTL.
|
|
44
34
|
*/
|
|
45
35
|
flipRTL(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Add the cursor SVG to this block's SVG group.
|
|
48
|
-
*
|
|
49
|
-
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
|
50
|
-
* group.
|
|
51
|
-
*/
|
|
52
|
-
setCursorSvg(cursorSvg: SVGElement): void;
|
|
53
|
-
/**
|
|
54
|
-
* Add the marker SVG to this block's SVG group.
|
|
55
|
-
*
|
|
56
|
-
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
|
57
|
-
* group.
|
|
58
|
-
*/
|
|
59
|
-
setMarkerSvg(markerSvg: SVGElement): void;
|
|
60
36
|
/**
|
|
61
37
|
* Set whether the block shows a highlight or not. Block highlighting is
|
|
62
38
|
* often used to visually mark blocks currently being executed.
|
|
@@ -90,7 +66,7 @@ export interface IPathObject {
|
|
|
90
66
|
*/
|
|
91
67
|
updateMovable(enabled: boolean): void;
|
|
92
68
|
/** Adds the given path as a connection highlight for the given connection. */
|
|
93
|
-
addConnectionHighlight?(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean):
|
|
69
|
+
addConnectionHighlight?(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean): SVGElement;
|
|
94
70
|
/**
|
|
95
71
|
* Apply the stored colours to the block's path, taking into account whether
|
|
96
72
|
* the paths belong to a shadow block.
|
|
@@ -17,16 +17,6 @@ import type { IPathObject } from './i_path_object.js';
|
|
|
17
17
|
export declare class PathObject implements IPathObject {
|
|
18
18
|
svgRoot: SVGElement;
|
|
19
19
|
svgPath: SVGElement;
|
|
20
|
-
/**
|
|
21
|
-
* Holds the cursors svg element when the cursor is attached to the block.
|
|
22
|
-
* This is null if there is no cursor on the block.
|
|
23
|
-
*/
|
|
24
|
-
cursorSvg: SVGElement | null;
|
|
25
|
-
/**
|
|
26
|
-
* Holds the markers svg element when the marker is attached to the block.
|
|
27
|
-
* This is null if there is no marker on the block.
|
|
28
|
-
*/
|
|
29
|
-
markerSvg: SVGElement | null;
|
|
30
20
|
constants: ConstantProvider;
|
|
31
21
|
style: BlockStyle;
|
|
32
22
|
/** Highlight paths associated with connections. */
|
|
@@ -49,20 +39,6 @@ export declare class PathObject implements IPathObject {
|
|
|
49
39
|
* Flip the SVG paths in RTL.
|
|
50
40
|
*/
|
|
51
41
|
flipRTL(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Add the cursor SVG to this block's SVG group.
|
|
54
|
-
*
|
|
55
|
-
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
|
|
56
|
-
* group.
|
|
57
|
-
*/
|
|
58
|
-
setCursorSvg(cursorSvg: SVGElement): void;
|
|
59
|
-
/**
|
|
60
|
-
* Add the marker SVG to this block's SVG group.
|
|
61
|
-
*
|
|
62
|
-
* @param markerSvg The SVG root of the marker to be added to the block SVG
|
|
63
|
-
* group.
|
|
64
|
-
*/
|
|
65
|
-
setMarkerSvg(markerSvg: SVGElement): void;
|
|
66
42
|
/**
|
|
67
43
|
* Apply the stored colours to the block's path, taking into account whether
|
|
68
44
|
* the paths belong to a shadow block.
|
|
@@ -145,8 +121,7 @@ export declare class PathObject implements IPathObject {
|
|
|
145
121
|
*/
|
|
146
122
|
updateShapeForInputHighlight(_conn: Connection, _enable: boolean): void;
|
|
147
123
|
/** Adds the given path as a connection highlight for the given connection. */
|
|
148
|
-
addConnectionHighlight(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean):
|
|
149
|
-
private currentHighlightMatchesNew;
|
|
124
|
+
addConnectionHighlight(connection: RenderedConnection, connectionPath: string, offset: Coordinate, rtl: boolean): SVGElement;
|
|
150
125
|
/**
|
|
151
126
|
* Removes any highlight associated with the given connection, if it exists.
|
|
152
127
|
*/
|
|
@@ -6,14 +6,11 @@
|
|
|
6
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
7
7
|
import { Connection } from '../../connection.js';
|
|
8
8
|
import type { IRegistrable } from '../../interfaces/i_registrable.js';
|
|
9
|
-
import type { Marker } from '../../keyboard_nav/marker.js';
|
|
10
9
|
import type { BlockStyle, Theme } from '../../theme.js';
|
|
11
|
-
import type { WorkspaceSvg } from '../../workspace_svg.js';
|
|
12
10
|
import { ConstantProvider } from './constants.js';
|
|
13
11
|
import { Drawer } from './drawer.js';
|
|
14
12
|
import type { IPathObject } from './i_path_object.js';
|
|
15
13
|
import { RenderInfo } from './info.js';
|
|
16
|
-
import { MarkerSvg } from './marker_svg.js';
|
|
17
14
|
/**
|
|
18
15
|
* The base class for a block renderer.
|
|
19
16
|
*/
|
|
@@ -98,14 +95,6 @@ export declare class Renderer implements IRegistrable {
|
|
|
98
95
|
* @returns The drawer.
|
|
99
96
|
*/
|
|
100
97
|
protected makeDrawer_(block: BlockSvg, info: RenderInfo): Drawer;
|
|
101
|
-
/**
|
|
102
|
-
* Create a new instance of the renderer's marker drawer.
|
|
103
|
-
*
|
|
104
|
-
* @param workspace The workspace the marker belongs to.
|
|
105
|
-
* @param marker The marker.
|
|
106
|
-
* @returns The object in charge of drawing the marker.
|
|
107
|
-
*/
|
|
108
|
-
makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker): MarkerSvg;
|
|
109
98
|
/**
|
|
110
99
|
* Create a new instance of a renderer path object.
|
|
111
100
|
*
|
|
@@ -46,6 +46,6 @@ export declare class Drawer extends BaseDrawer {
|
|
|
46
46
|
private getInlineInputPath;
|
|
47
47
|
drawStatementInput_(row: Row): void;
|
|
48
48
|
/** Returns a path to highlight the given connection. */
|
|
49
|
-
drawConnectionHighlightPath(measurable: Connection):
|
|
49
|
+
drawConnectionHighlightPath(measurable: Connection): SVGElement | undefined;
|
|
50
50
|
}
|
|
51
51
|
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from '../../block_svg.js';
|
|
7
|
-
import type { Marker } from '../../keyboard_nav/marker.js';
|
|
8
7
|
import type { BlockStyle } from '../../theme.js';
|
|
9
|
-
import type { WorkspaceSvg } from '../../workspace_svg.js';
|
|
10
8
|
import type { RenderInfo as BaseRenderInfo } from '../common/info.js';
|
|
11
9
|
import { Renderer as BaseRenderer } from '../common/renderer.js';
|
|
12
10
|
import { ConstantProvider } from './constants.js';
|
|
13
11
|
import { Drawer } from './drawer.js';
|
|
14
12
|
import { RenderInfo } from './info.js';
|
|
15
|
-
import { MarkerSvg } from './marker_svg.js';
|
|
16
13
|
import { PathObject } from './path_object.js';
|
|
17
14
|
/**
|
|
18
15
|
* The zelos renderer. This renderer emulates Scratch-style and MakeCode-style
|
|
@@ -48,14 +45,6 @@ export declare class Renderer extends BaseRenderer {
|
|
|
48
45
|
* @returns The drawer.
|
|
49
46
|
*/
|
|
50
47
|
protected makeDrawer_(block: BlockSvg, info: BaseRenderInfo): Drawer;
|
|
51
|
-
/**
|
|
52
|
-
* Create a new instance of the renderer's cursor drawer.
|
|
53
|
-
*
|
|
54
|
-
* @param workspace The workspace the cursor belongs to.
|
|
55
|
-
* @param marker The marker.
|
|
56
|
-
* @returns The object in charge of drawing the marker.
|
|
57
|
-
*/
|
|
58
|
-
makeMarkerDrawer(workspace: WorkspaceSvg, marker: Marker): MarkerSvg;
|
|
59
48
|
/**
|
|
60
49
|
* Create a new instance of a renderer path object.
|
|
61
50
|
*
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
import { ConstantProvider } from './constants.js';
|
|
8
8
|
import { Drawer } from './drawer.js';
|
|
9
9
|
import { RenderInfo } from './info.js';
|
|
10
|
-
import { MarkerSvg } from './marker_svg.js';
|
|
11
10
|
import { BottomRow } from './measurables/bottom_row.js';
|
|
12
11
|
import { StatementInput } from './measurables/inputs.js';
|
|
13
12
|
import { RightConnectionShape } from './measurables/row_elements.js';
|
|
14
13
|
import { TopRow } from './measurables/top_row.js';
|
|
15
14
|
import { PathObject } from './path_object.js';
|
|
16
15
|
import { Renderer } from './renderer.js';
|
|
17
|
-
export { BottomRow, ConstantProvider, Drawer,
|
|
16
|
+
export { BottomRow, ConstantProvider, Drawer, PathObject, Renderer, RenderInfo, RightConnectionShape, StatementInput, TopRow, };
|
|
18
17
|
//# sourceMappingURL=zelos.d.ts.map
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @class
|
|
11
11
|
*/
|
|
12
|
+
import { Scope } from './contextmenu_registry.js';
|
|
12
13
|
import { KeyCodes } from './utils/keycodes.js';
|
|
13
14
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
14
15
|
/**
|
|
@@ -183,12 +184,14 @@ export declare namespace ShortcutRegistry {
|
|
|
183
184
|
* @param e The event that caused the shortcut to be activated.
|
|
184
185
|
* @param shortcut The `KeyboardShortcut` that was activated
|
|
185
186
|
* (i.e., the one this callback is attached to).
|
|
187
|
+
* @param scope Information about the focused item when the
|
|
188
|
+
* shortcut was invoked.
|
|
186
189
|
* @returns Returning true ends processing of the invoked keycode.
|
|
187
190
|
* Returning false causes processing to continue with the
|
|
188
191
|
* next-most-recently registered shortcut for the invoked
|
|
189
192
|
* keycode.
|
|
190
193
|
*/
|
|
191
|
-
callback?: (workspace: WorkspaceSvg, e: Event, shortcut: KeyboardShortcut) => boolean;
|
|
194
|
+
callback?: (workspace: WorkspaceSvg, e: Event, shortcut: KeyboardShortcut, scope: Scope) => boolean;
|
|
192
195
|
/** The name of the shortcut. Should be unique. */
|
|
193
196
|
name: string;
|
|
194
197
|
/**
|
|
@@ -198,9 +201,11 @@ export declare namespace ShortcutRegistry {
|
|
|
198
201
|
*
|
|
199
202
|
* @param workspace The `WorkspaceSvg` where the shortcut was
|
|
200
203
|
* invoked.
|
|
204
|
+
* @param scope Information about the focused item when the
|
|
205
|
+
* shortcut would be invoked.
|
|
201
206
|
* @returns True iff `callback` function should be called.
|
|
202
207
|
*/
|
|
203
|
-
preconditionFn?: (workspace: WorkspaceSvg) => boolean;
|
|
208
|
+
preconditionFn?: (workspace: WorkspaceSvg, scope: Scope) => boolean;
|
|
204
209
|
/** Optional arbitray extra data attached to the shortcut. */
|
|
205
210
|
metadata?: object;
|
|
206
211
|
/**
|
package/core/toast.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
7
|
+
/**
|
|
8
|
+
* Display/configuration options for a toast notification.
|
|
9
|
+
*/
|
|
10
|
+
export interface ToastOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Toast ID. If set along with `oncePerSession`, will cause subsequent toasts
|
|
13
|
+
* with this ID to not be shown.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Flag to show the toast once per session only.
|
|
18
|
+
* Subsequent calls are ignored.
|
|
19
|
+
*/
|
|
20
|
+
oncePerSession?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Text of the message to display on the toast.
|
|
23
|
+
*/
|
|
24
|
+
message: string;
|
|
25
|
+
/**
|
|
26
|
+
* Duration in seconds before the toast is removed. Defaults to 5.
|
|
27
|
+
*/
|
|
28
|
+
duration?: number;
|
|
29
|
+
/**
|
|
30
|
+
* How prominently/interrupting the readout of the toast should be for
|
|
31
|
+
* screenreaders. Corresponds to aria-live and defaults to polite.
|
|
32
|
+
*/
|
|
33
|
+
assertiveness?: Toast.Assertiveness;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Class that allows for showing and dismissing temporary notifications.
|
|
37
|
+
*/
|
|
38
|
+
export declare class Toast {
|
|
39
|
+
/** IDs of toasts that have previously been shown. */
|
|
40
|
+
private static shownIds;
|
|
41
|
+
/**
|
|
42
|
+
* Shows a toast notification.
|
|
43
|
+
*
|
|
44
|
+
* @param workspace The workspace to show the toast on.
|
|
45
|
+
* @param options Configuration options for the toast message, duration, etc.
|
|
46
|
+
*/
|
|
47
|
+
static show(workspace: WorkspaceSvg, options: ToastOptions): void;
|
|
48
|
+
/**
|
|
49
|
+
* Creates the DOM representation of a toast.
|
|
50
|
+
*
|
|
51
|
+
* @param workspace The workspace to inject the toast notification onto.
|
|
52
|
+
* @param options Configuration options for the toast.
|
|
53
|
+
* @returns The root DOM element of the toast.
|
|
54
|
+
*/
|
|
55
|
+
protected static createDom(workspace: WorkspaceSvg, options: ToastOptions): HTMLDivElement;
|
|
56
|
+
/**
|
|
57
|
+
* Dismiss a toast, e.g. in response to a user action.
|
|
58
|
+
*
|
|
59
|
+
* @param workspace The workspace to dismiss a toast in.
|
|
60
|
+
* @param id The toast ID, or undefined to clear any toast.
|
|
61
|
+
*/
|
|
62
|
+
static hide(workspace: WorkspaceSvg, id?: string): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Options for how aggressively toasts should be read out by screenreaders.
|
|
66
|
+
* Values correspond to those for aria-live.
|
|
67
|
+
*/
|
|
68
|
+
export declare namespace Toast {
|
|
69
|
+
enum Assertiveness {
|
|
70
|
+
ASSERTIVE = "assertive",
|
|
71
|
+
POLITE = "polite"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -9,6 +9,8 @@ import '../events/events_toolbox_item_select.js';
|
|
|
9
9
|
import type { IAutoHideable } from '../interfaces/i_autohideable.js';
|
|
10
10
|
import type { IDraggable } from '../interfaces/i_draggable.js';
|
|
11
11
|
import type { IFlyout } from '../interfaces/i_flyout.js';
|
|
12
|
+
import type { IFocusableNode } from '../interfaces/i_focusable_node.js';
|
|
13
|
+
import type { IFocusableTree } from '../interfaces/i_focusable_tree.js';
|
|
12
14
|
import type { IKeyboardAccessible } from '../interfaces/i_keyboard_accessible.js';
|
|
13
15
|
import type { ISelectableToolboxItem } from '../interfaces/i_selectable_toolbox_item.js';
|
|
14
16
|
import type { IStyleable } from '../interfaces/i_styleable.js';
|
|
@@ -22,7 +24,7 @@ import type { WorkspaceSvg } from '../workspace_svg.js';
|
|
|
22
24
|
* Class for a Toolbox.
|
|
23
25
|
* Creates the toolbox's DOM.
|
|
24
26
|
*/
|
|
25
|
-
export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, IStyleable, IToolbox {
|
|
27
|
+
export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, IStyleable, IToolbox, IFocusableNode {
|
|
26
28
|
/**
|
|
27
29
|
* The unique ID for this component that is used to register with the
|
|
28
30
|
* ComponentManager.
|
|
@@ -389,5 +391,25 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
389
391
|
private selectPrevious;
|
|
390
392
|
/** Disposes of this toolbox. */
|
|
391
393
|
dispose(): void;
|
|
394
|
+
/** See IFocusableNode.getFocusableElement. */
|
|
395
|
+
getFocusableElement(): HTMLElement | SVGElement;
|
|
396
|
+
/** See IFocusableNode.getFocusableTree. */
|
|
397
|
+
getFocusableTree(): IFocusableTree;
|
|
398
|
+
/** See IFocusableNode.onNodeFocus. */
|
|
399
|
+
onNodeFocus(): void;
|
|
400
|
+
/** See IFocusableNode.onNodeBlur. */
|
|
401
|
+
onNodeBlur(): void;
|
|
402
|
+
/** See IFocusableTree.getRootFocusableNode. */
|
|
403
|
+
getRootFocusableNode(): IFocusableNode;
|
|
404
|
+
/** See IFocusableTree.getRestoredFocusableNode. */
|
|
405
|
+
getRestoredFocusableNode(previousNode: IFocusableNode | null): IFocusableNode | null;
|
|
406
|
+
/** See IFocusableTree.getNestedTrees. */
|
|
407
|
+
getNestedTrees(): Array<IFocusableTree>;
|
|
408
|
+
/** See IFocusableTree.lookUpFocusableNode. */
|
|
409
|
+
lookUpFocusableNode(id: string): IFocusableNode | null;
|
|
410
|
+
/** See IFocusableTree.onTreeFocus. */
|
|
411
|
+
onTreeFocus(node: IFocusableNode, _previousTree: IFocusableTree | null): void;
|
|
412
|
+
/** See IFocusableTree.onTreeBlur. */
|
|
413
|
+
onTreeBlur(_nextTree: IFocusableTree | null): void;
|
|
392
414
|
}
|
|
393
415
|
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
11
|
import type { ICollapsibleToolboxItem } from '../interfaces/i_collapsible_toolbox_item.js';
|
|
12
|
+
import type { IFocusableTree } from '../interfaces/i_focusable_tree.js';
|
|
12
13
|
import type { IToolbox } from '../interfaces/i_toolbox.js';
|
|
13
14
|
import type { IToolboxItem } from '../interfaces/i_toolbox_item.js';
|
|
14
15
|
import type * as toolbox from '../utils/toolbox.js';
|
|
@@ -94,5 +95,13 @@ export declare class ToolboxItem implements IToolboxItem {
|
|
|
94
95
|
* @param _isVisible True if category should be visible.
|
|
95
96
|
*/
|
|
96
97
|
setVisible_(_isVisible: boolean): void;
|
|
98
|
+
/** See IFocusableNode.getFocusableElement. */
|
|
99
|
+
getFocusableElement(): HTMLElement | SVGElement;
|
|
100
|
+
/** See IFocusableNode.getFocusableTree. */
|
|
101
|
+
getFocusableTree(): IFocusableTree;
|
|
102
|
+
/** See IFocusableNode.onNodeFocus. */
|
|
103
|
+
onNodeFocus(): void;
|
|
104
|
+
/** See IFocusableNode.onNodeBlur. */
|
|
105
|
+
onNodeBlur(): void;
|
|
97
106
|
}
|
|
98
107
|
//# sourceMappingURL=toolbox_item.d.ts.map
|
package/core/utils/aria.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export declare enum Role {
|
|
|
20
20
|
ROW = "row",
|
|
21
21
|
TREE = "tree",
|
|
22
22
|
TREEITEM = "treeitem",
|
|
23
|
-
SEPARATOR = "separator"
|
|
23
|
+
SEPARATOR = "separator",
|
|
24
|
+
STATUS = "status"
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* ARIA states and properties.
|
|
@@ -41,7 +42,9 @@ export declare enum State {
|
|
|
41
42
|
SELECTED = "selected",
|
|
42
43
|
SETSIZE = "setsize",
|
|
43
44
|
VALUEMAX = "valuemax",
|
|
44
|
-
VALUEMIN = "valuemin"
|
|
45
|
+
VALUEMIN = "valuemin",
|
|
46
|
+
LIVE = "live",
|
|
47
|
+
HIDDEN = "hidden"
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
47
50
|
* Sets the role of an element.
|
package/core/variable_map.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class VariableMap implements IVariableMap<IVariableModel<IVariabl
|
|
|
44
44
|
* Rename a variable by updating its name in the variable map. Identify the
|
|
45
45
|
* variable to rename with the given ID.
|
|
46
46
|
*
|
|
47
|
-
* @deprecated v12
|
|
47
|
+
* @deprecated v12: use VariableMap.renameVariable.
|
|
48
48
|
* @param id ID of the variable to rename.
|
|
49
49
|
* @param newName New variable name.
|
|
50
50
|
*/
|
|
@@ -98,7 +98,7 @@ export declare class VariableMap implements IVariableMap<IVariableModel<IVariabl
|
|
|
98
98
|
* Delete a variables by the passed in ID and all of its uses from this
|
|
99
99
|
* workspace. May prompt the user for confirmation.
|
|
100
100
|
*
|
|
101
|
-
* @deprecated v12
|
|
101
|
+
* @deprecated v12: use Blockly.Variables.deleteVariable.
|
|
102
102
|
* @param id ID of variable to delete.
|
|
103
103
|
*/
|
|
104
104
|
deleteVariableById(id: string): void;
|
|
@@ -143,14 +143,14 @@ export declare class VariableMap implements IVariableMap<IVariableModel<IVariabl
|
|
|
143
143
|
/**
|
|
144
144
|
* Returns all of the variable names of all types.
|
|
145
145
|
*
|
|
146
|
-
* @deprecated v12
|
|
146
|
+
* @deprecated v12: use Blockly.Variables.getAllVariables.
|
|
147
147
|
* @returns All of the variable names of all types.
|
|
148
148
|
*/
|
|
149
149
|
getAllVariableNames(): string[];
|
|
150
150
|
/**
|
|
151
151
|
* Find all the uses of a named variable.
|
|
152
152
|
*
|
|
153
|
-
* @deprecated v12
|
|
153
|
+
* @deprecated v12: use Blockly.Variables.getVariableUsesById.
|
|
154
154
|
* @param id ID of the variable to find.
|
|
155
155
|
* @returns Array of block usages.
|
|
156
156
|
*/
|
package/core/variables.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export declare const CATEGORY_NAME = "VARIABLE";
|
|
|
19
19
|
/**
|
|
20
20
|
* Find all user-created variables that are in use in the workspace.
|
|
21
21
|
* For use by generators.
|
|
22
|
+
*
|
|
22
23
|
* To get a list of all variables on a workspace, including unused variables,
|
|
23
|
-
* call
|
|
24
|
+
* call getAllVariables.
|
|
24
25
|
*
|
|
25
26
|
* @param ws The workspace to search for variables.
|
|
26
27
|
* @returns Array of variable models.
|
|
@@ -28,6 +29,7 @@ export declare const CATEGORY_NAME = "VARIABLE";
|
|
|
28
29
|
export declare function allUsedVarModels(ws: Workspace): IVariableModel<IVariableState>[];
|
|
29
30
|
/**
|
|
30
31
|
* Find all developer variables used by blocks in the workspace.
|
|
32
|
+
*
|
|
31
33
|
* Developer variables are never shown to the user, but are declared as global
|
|
32
34
|
* variables in the generated code.
|
|
33
35
|
* To declare developer variables, define the getDeveloperVariables function on
|
package/core/workspace.d.ts
CHANGED
|
@@ -184,9 +184,10 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
184
184
|
/** Dispose of all blocks and comments in workspace. */
|
|
185
185
|
clear(): void;
|
|
186
186
|
/**
|
|
187
|
-
*
|
|
187
|
+
* Rename a variable by updating its name in the variable
|
|
188
188
|
* map. Identify the variable to rename with the given ID.
|
|
189
189
|
*
|
|
190
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().renameVariable
|
|
190
191
|
* @param id ID of the variable to rename.
|
|
191
192
|
* @param newName New variable name.
|
|
192
193
|
*/
|
|
@@ -194,7 +195,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
194
195
|
/**
|
|
195
196
|
* Create a variable with a given name, optional type, and optional ID.
|
|
196
197
|
*
|
|
197
|
-
* @deprecated v12
|
|
198
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().createVariable.
|
|
198
199
|
* @param name The name of the variable. This must be unique across variables
|
|
199
200
|
* and procedures.
|
|
200
201
|
* @param opt_type The type of the variable like 'int' or 'string'.
|
|
@@ -207,7 +208,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
207
208
|
/**
|
|
208
209
|
* Find all the uses of the given variable, which is identified by ID.
|
|
209
210
|
*
|
|
210
|
-
* @deprecated v12
|
|
211
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getVariableUsesById
|
|
211
212
|
* @param id ID of the variable to find.
|
|
212
213
|
* @returns Array of block usages.
|
|
213
214
|
*/
|
|
@@ -216,7 +217,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
216
217
|
* Delete a variables by the passed in ID and all of its uses from this
|
|
217
218
|
* workspace. May prompt the user for confirmation.
|
|
218
219
|
*
|
|
219
|
-
* @deprecated v12
|
|
220
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().deleteVariable.
|
|
220
221
|
* @param id ID of variable to delete.
|
|
221
222
|
*/
|
|
222
223
|
deleteVariableById(id: string): void;
|
|
@@ -224,7 +225,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
224
225
|
* Find the variable by the given name and return it. Return null if not
|
|
225
226
|
* found.
|
|
226
227
|
*
|
|
227
|
-
* @deprecated v12
|
|
228
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getVariable.
|
|
228
229
|
* @param name The name to check for.
|
|
229
230
|
* @param opt_type The type of the variable. If not provided it defaults to
|
|
230
231
|
* the empty string, which is a specific type.
|
|
@@ -234,7 +235,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
234
235
|
/**
|
|
235
236
|
* Find the variable by the given ID and return it. Return null if not found.
|
|
236
237
|
*
|
|
237
|
-
* @deprecated v12
|
|
238
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getVariableById.
|
|
238
239
|
* @param id The ID to check for.
|
|
239
240
|
* @returns The variable with the given ID.
|
|
240
241
|
*/
|
|
@@ -243,7 +244,7 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
243
244
|
* Find the variable with the specified type. If type is null, return list of
|
|
244
245
|
* variables with empty string type.
|
|
245
246
|
*
|
|
246
|
-
* @deprecated v12
|
|
247
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getVariablesOfType.
|
|
247
248
|
* @param type Type of the variables to find.
|
|
248
249
|
* @returns The sought after variables of the passed in type. An empty array
|
|
249
250
|
* if none are found.
|
|
@@ -252,14 +253,14 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
252
253
|
/**
|
|
253
254
|
* Return all variables of all types.
|
|
254
255
|
*
|
|
255
|
-
* @deprecated v12
|
|
256
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getAllVariables.
|
|
256
257
|
* @returns List of variable models.
|
|
257
258
|
*/
|
|
258
259
|
getAllVariables(): IVariableModel<IVariableState>[];
|
|
259
260
|
/**
|
|
260
261
|
* Returns all variable names of all types.
|
|
261
262
|
*
|
|
262
|
-
* @deprecated v12
|
|
263
|
+
* @deprecated v12: use Blockly.Workspace.getVariableMap().getAllVariables.
|
|
263
264
|
* @returns List of all variable names of all types.
|
|
264
265
|
*/
|
|
265
266
|
getAllVariableNames(): string[];
|