blockly 13.0.0-beta.1 → 13.0.0-beta.3
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 +1290 -1233
- package/blockly_compressed.js +1131 -1103
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +71 -71
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +18 -0
- package/core/block_aria_composer.d.ts +1 -1
- package/core/bubbles/bubble.d.ts +39 -0
- package/core/bubbles/textinput_bubble.d.ts +5 -0
- package/core/field_checkbox.d.ts +27 -0
- package/core/field_dropdown.d.ts +51 -1
- package/core/field_image.d.ts +24 -0
- package/core/field_input.d.ts +1 -1
- package/core/field_number.d.ts +10 -0
- package/core/field_textinput.d.ts +10 -0
- package/core/field_variable.d.ts +9 -0
- package/core/flyout_base.d.ts +10 -0
- package/core/icons/comment_icon.d.ts +8 -0
- package/core/icons/icon.d.ts +14 -0
- package/core/icons/mutator_icon.d.ts +8 -0
- package/core/icons/warning_icon.d.ts +8 -0
- package/core/inputs/input.d.ts +28 -0
- package/core/interfaces/i_flyout_inflater.d.ts +9 -0
- package/core/interfaces/i_json_block_definition.d.ts +1 -0
- package/core/menu.d.ts +3 -0
- package/core/menuitem.d.ts +8 -1
- package/core/shortcut_items.d.ts +6 -1
- package/core/tooltip.d.ts +10 -0
- package/core/trashcan.d.ts +23 -38
- package/core/utils/aria.d.ts +7 -1
- package/core/workspace.d.ts +5 -1
- package/core/workspace_svg.d.ts +8 -0
- package/core/zoom_controls.d.ts +43 -50
- package/dart_compressed.js +62 -62
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +55 -55
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +50 -50
- package/lua_compressed.js.map +1 -1
- package/media/drop.mp3 +0 -0
- package/msg/ab.js +32 -3
- package/msg/ab.mjs +30 -1
- package/msg/ace.js +33 -4
- package/msg/ace.mjs +30 -1
- package/msg/af.js +32 -3
- package/msg/af.mjs +30 -1
- package/msg/am.js +33 -4
- package/msg/am.mjs +30 -1
- package/msg/ar.js +55 -26
- package/msg/ar.mjs +30 -1
- package/msg/ast.js +33 -4
- package/msg/ast.mjs +30 -1
- package/msg/az.js +33 -4
- package/msg/az.mjs +30 -1
- package/msg/ba.js +32 -3
- package/msg/ba.mjs +30 -1
- package/msg/bcc.js +32 -3
- package/msg/bcc.mjs +30 -1
- package/msg/be-tarask.js +66 -37
- package/msg/be-tarask.mjs +30 -1
- package/msg/be.js +33 -4
- package/msg/be.mjs +30 -1
- package/msg/bg.js +32 -3
- package/msg/bg.mjs +30 -1
- package/msg/bn.js +33 -4
- package/msg/bn.mjs +30 -1
- package/msg/br.js +33 -4
- package/msg/br.mjs +30 -1
- package/msg/bs.js +32 -3
- package/msg/bs.mjs +30 -1
- package/msg/ca.js +32 -3
- package/msg/ca.mjs +30 -1
- package/msg/ce.js +32 -3
- package/msg/ce.mjs +30 -1
- package/msg/cs.js +40 -11
- package/msg/cs.mjs +30 -1
- package/msg/da.js +56 -27
- package/msg/da.mjs +30 -1
- package/msg/de.js +32 -3
- package/msg/de.mjs +30 -1
- package/msg/diq.js +34 -5
- package/msg/diq.mjs +30 -1
- package/msg/dtp.js +32 -3
- package/msg/dtp.mjs +30 -1
- package/msg/dty.js +32 -3
- package/msg/dty.mjs +30 -1
- package/msg/ee.js +32 -3
- package/msg/ee.mjs +30 -1
- package/msg/el.js +63 -34
- package/msg/el.mjs +30 -1
- package/msg/en-gb.js +32 -3
- package/msg/en-gb.mjs +30 -1
- package/msg/en.js +33 -4
- package/msg/en.mjs +30 -1
- package/msg/eo.js +32 -3
- package/msg/eo.mjs +30 -1
- package/msg/es.js +42 -13
- package/msg/es.mjs +30 -1
- package/msg/et.js +32 -3
- package/msg/et.mjs +30 -1
- package/msg/eu.js +32 -3
- package/msg/eu.mjs +30 -1
- package/msg/fa.js +33 -4
- package/msg/fa.mjs +30 -1
- package/msg/fi.js +51 -22
- package/msg/fi.mjs +30 -1
- package/msg/fo.js +32 -3
- package/msg/fo.mjs +30 -1
- package/msg/fr.js +55 -26
- package/msg/fr.mjs +30 -1
- package/msg/frr.js +33 -4
- package/msg/frr.mjs +30 -1
- package/msg/ga.js +559 -0
- package/msg/{cdo.mjs → ga.mjs} +32 -3
- package/msg/gl.js +55 -26
- package/msg/gl.mjs +30 -1
- package/msg/gn.js +33 -4
- package/msg/gn.mjs +30 -1
- package/msg/gor.js +32 -3
- package/msg/gor.mjs +30 -1
- package/msg/ha.js +32 -3
- package/msg/ha.mjs +30 -1
- package/msg/hak.js +33 -4
- package/msg/hak.mjs +30 -1
- package/msg/he.js +82 -53
- package/msg/he.mjs +30 -1
- package/msg/hi.js +32 -3
- package/msg/hi.mjs +30 -1
- package/msg/hr.js +32 -3
- package/msg/hr.mjs +30 -1
- package/msg/hrx.js +32 -3
- package/msg/hrx.mjs +30 -1
- package/msg/hsb.js +32 -3
- package/msg/hsb.mjs +30 -1
- package/msg/hu.js +34 -5
- package/msg/hu.mjs +30 -1
- package/msg/hy.js +32 -3
- package/msg/hy.mjs +30 -1
- package/msg/ia.js +55 -26
- package/msg/ia.mjs +30 -1
- package/msg/id.js +262 -233
- package/msg/id.mjs +30 -1
- package/msg/ig.js +40 -11
- package/msg/ig.mjs +30 -1
- package/msg/inh.js +32 -3
- package/msg/inh.mjs +30 -1
- package/msg/is.js +32 -3
- package/msg/is.mjs +30 -1
- package/msg/it.js +58 -29
- package/msg/it.mjs +30 -1
- package/msg/ja.js +55 -26
- package/msg/ja.mjs +30 -1
- package/msg/ka.js +34 -5
- package/msg/ka.mjs +30 -1
- package/msg/kab.js +41 -12
- package/msg/kab.mjs +30 -1
- package/msg/kbd-cyrl.js +33 -4
- package/msg/kbd-cyrl.mjs +30 -1
- package/msg/km.js +32 -3
- package/msg/km.mjs +30 -1
- package/msg/kn.js +32 -3
- package/msg/kn.mjs +30 -1
- package/msg/ko.js +57 -28
- package/msg/ko.mjs +30 -1
- package/msg/krc.js +559 -0
- package/msg/krc.mjs +540 -0
- package/msg/ksh.js +33 -4
- package/msg/ksh.mjs +30 -1
- package/msg/ku-latn.js +33 -4
- package/msg/ku-latn.mjs +30 -1
- package/msg/ky.js +34 -5
- package/msg/ky.mjs +30 -1
- package/msg/la.js +33 -4
- package/msg/la.mjs +30 -1
- package/msg/lb.js +43 -14
- package/msg/lb.mjs +30 -1
- package/msg/lki.js +32 -3
- package/msg/lki.mjs +30 -1
- package/msg/lo.js +32 -3
- package/msg/lo.mjs +30 -1
- package/msg/lrc.js +32 -3
- package/msg/lrc.mjs +30 -1
- package/msg/lt.js +33 -4
- package/msg/lt.mjs +30 -1
- package/msg/lv.js +43 -14
- package/msg/lv.mjs +30 -1
- package/msg/mg.js +32 -3
- package/msg/mg.mjs +30 -1
- package/msg/mk.js +32 -3
- package/msg/mk.mjs +30 -1
- package/msg/ml.js +32 -3
- package/msg/ml.mjs +30 -1
- package/msg/mnw.js +32 -3
- package/msg/mnw.mjs +30 -1
- package/msg/ms.js +41 -12
- package/msg/ms.mjs +30 -1
- package/msg/my.js +32 -3
- package/msg/my.mjs +30 -1
- package/msg/mzn.js +33 -4
- package/msg/mzn.mjs +30 -1
- package/msg/nb.js +32 -3
- package/msg/nb.mjs +30 -1
- package/msg/ne.js +41 -12
- package/msg/ne.mjs +30 -1
- package/msg/nl.js +55 -26
- package/msg/nl.mjs +30 -1
- package/msg/oc.js +32 -3
- package/msg/oc.mjs +30 -1
- package/msg/olo.js +33 -4
- package/msg/olo.mjs +30 -1
- package/msg/pa.js +41 -12
- package/msg/pa.mjs +30 -1
- package/msg/pl.js +55 -26
- package/msg/pl.mjs +30 -1
- package/msg/pms.js +55 -26
- package/msg/pms.mjs +30 -1
- package/msg/ps.js +50 -21
- package/msg/ps.mjs +30 -1
- package/msg/pt-br.js +55 -26
- package/msg/pt-br.mjs +30 -1
- package/msg/pt.js +55 -26
- package/msg/pt.mjs +30 -1
- package/msg/ro.js +64 -35
- package/msg/ro.mjs +30 -1
- package/msg/ru.js +55 -26
- package/msg/ru.mjs +30 -1
- package/msg/sc.js +32 -3
- package/msg/sc.mjs +30 -1
- package/msg/sco.js +33 -4
- package/msg/sco.mjs +30 -1
- package/msg/sd.js +32 -3
- package/msg/sd.mjs +30 -1
- package/msg/shn.js +32 -3
- package/msg/shn.mjs +30 -1
- package/msg/si.js +33 -4
- package/msg/si.mjs +30 -1
- package/msg/sk.js +33 -4
- package/msg/sk.mjs +30 -1
- package/msg/skr-arab.js +35 -6
- package/msg/skr-arab.mjs +30 -1
- package/msg/sl.js +56 -27
- package/msg/sl.mjs +30 -1
- package/msg/smn.js +34 -5
- package/msg/smn.mjs +30 -1
- package/msg/sq.js +41 -12
- package/msg/sq.mjs +30 -1
- package/msg/sr-latn.js +32 -3
- package/msg/sr-latn.mjs +30 -1
- package/msg/sr.js +32 -3
- package/msg/sr.mjs +30 -1
- package/msg/sv.js +55 -26
- package/msg/sv.mjs +30 -1
- package/msg/sw.js +33 -4
- package/msg/sw.mjs +30 -1
- package/msg/ta.js +51 -22
- package/msg/ta.mjs +30 -1
- package/msg/tcy.js +102 -73
- package/msg/tcy.mjs +30 -1
- package/msg/tdd.js +32 -3
- package/msg/tdd.mjs +30 -1
- package/msg/te.js +32 -3
- package/msg/te.mjs +30 -1
- package/msg/th.js +33 -4
- package/msg/th.mjs +30 -1
- package/msg/ti.js +32 -3
- package/msg/ti.mjs +30 -1
- package/msg/tl.js +32 -3
- package/msg/tl.mjs +30 -1
- package/msg/tlh.js +32 -3
- package/msg/tlh.mjs +30 -1
- package/msg/tr.js +55 -26
- package/msg/tr.mjs +30 -1
- package/msg/ug-arab.js +32 -3
- package/msg/ug-arab.mjs +30 -1
- package/msg/uk.js +32 -3
- package/msg/uk.mjs +30 -1
- package/msg/ur.js +32 -3
- package/msg/ur.mjs +30 -1
- package/msg/uz.js +47 -18
- package/msg/uz.mjs +30 -1
- package/msg/vi.js +56 -27
- package/msg/vi.mjs +30 -1
- package/msg/xmf.js +32 -3
- package/msg/xmf.mjs +30 -1
- package/msg/yo.js +32 -3
- package/msg/yo.mjs +30 -1
- package/msg/zgh.js +32 -3
- package/msg/zgh.mjs +30 -1
- package/msg/zh-hans.js +55 -26
- package/msg/zh-hans.mjs +30 -1
- package/msg/zh-hant.js +55 -26
- package/msg/zh-hant.mjs +30 -1
- package/package.json +4 -4
- package/php_compressed.js +54 -55
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +57 -57
- package/python_compressed.js.map +1 -1
- package/msg/cdo.js +0 -530
package/core/block.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ export declare class Block {
|
|
|
174
174
|
type: string;
|
|
175
175
|
inputsInlineDefault?: boolean;
|
|
176
176
|
workspace: Workspace;
|
|
177
|
+
/** A custom provider for generating the aria role description for this block. */
|
|
178
|
+
private ariaRoleDescriptionProvider;
|
|
177
179
|
/**
|
|
178
180
|
* @param workspace The block's workspace.
|
|
179
181
|
* @param prototypeName Name of the language object containing type-specific
|
|
@@ -695,6 +697,22 @@ export declare class Block {
|
|
|
695
697
|
* @param collapsed True if collapsed.
|
|
696
698
|
*/
|
|
697
699
|
setCollapsed(collapsed: boolean): void;
|
|
700
|
+
/**
|
|
701
|
+
* Set a custom aria role description provider for this block. If not set,
|
|
702
|
+
* uses a default provider based on the block's properties (e.g. whether it has
|
|
703
|
+
* inputs, outputs, etc.).
|
|
704
|
+
*
|
|
705
|
+
* @param description The description or function to provide the description.
|
|
706
|
+
* If a string, we'll replace message references in the string, e.g.
|
|
707
|
+
* `%{BKY_CUSTOM_MESSAGE}` will be replaced with the value of
|
|
708
|
+
* `Blockly.Msg['CUSTOM_MESSAGE']`.}'
|
|
709
|
+
*/
|
|
710
|
+
setAriaRoleDescriptionProvider(description: string | (() => string)): void;
|
|
711
|
+
/**
|
|
712
|
+
* @returns The custom string to use as the role description for this block,
|
|
713
|
+
* or undefined if no custom description is set.
|
|
714
|
+
*/
|
|
715
|
+
getAriaRoleDescription(): string | undefined;
|
|
698
716
|
/**
|
|
699
717
|
* Create a human-readable text representation of this block and any children.
|
|
700
718
|
*
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from './block_svg.js';
|
|
7
|
-
import { RenderedConnection } from './blockly.js';
|
|
8
7
|
import type { Input } from './inputs/input.js';
|
|
8
|
+
import { RenderedConnection } from './rendered_connection.js';
|
|
9
9
|
import { Verbosity } from './utils/aria.js';
|
|
10
10
|
/**
|
|
11
11
|
* Prepositions to use when describing the relationship between two blocks based
|
package/core/bubbles/bubble.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ import { Coordinate } from '../utils/coordinate.js';
|
|
|
13
13
|
import { Rect } from '../utils/rect.js';
|
|
14
14
|
import { Size } from '../utils/size.js';
|
|
15
15
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
16
|
+
/**
|
|
17
|
+
* Represents a either a string or a function that, when called, can provide a
|
|
18
|
+
* custom ARIA string to represent a bubble, or null if the default fallback
|
|
19
|
+
* should be used. See setAriaLabelProvider for more context.
|
|
20
|
+
*/
|
|
21
|
+
export type AriaLabelProvider = string | ((bubble: Bubble) => string | null);
|
|
16
22
|
/**
|
|
17
23
|
* The abstract pop-up bubble class. This creates a UI that looks like a speech
|
|
18
24
|
* bubble, where it has a "tail" that points to the block, and a "head" that
|
|
@@ -66,6 +72,7 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
|
|
|
66
72
|
private relativeLeft;
|
|
67
73
|
private dragStrategy;
|
|
68
74
|
private focusableElement;
|
|
75
|
+
private ariaLabelProvider;
|
|
69
76
|
/**
|
|
70
77
|
* @param workspace The workspace this bubble belongs to.
|
|
71
78
|
* @param anchor The anchor location of the thing this bubble is attached to.
|
|
@@ -239,5 +246,37 @@ export declare abstract class Bubble implements IBubble, ISelectable, IFocusable
|
|
|
239
246
|
* Returns the object that owns/hosts this bubble, if any.
|
|
240
247
|
*/
|
|
241
248
|
getOwner(): (IHasBubble & IFocusableNode) | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Recomputes the ARIA label and role for this bubble. This is automatically called
|
|
251
|
+
* during initialization, but implementations may find it useful to call this if
|
|
252
|
+
* the bubble's label should be changed.
|
|
253
|
+
*
|
|
254
|
+
* Bubbles use a default non-specific label unless they're customized otherwise
|
|
255
|
+
* which is the responsibility of the bubble's owner rather than bubble
|
|
256
|
+
* implementations. Customization can be done via setAriaLabelProvider.
|
|
257
|
+
*/
|
|
258
|
+
protected recomputeAriaContext(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Sets a custom ARIA label provider for this bubble, or null if it should be reset
|
|
261
|
+
* to use the default method.
|
|
262
|
+
*
|
|
263
|
+
* Bubbles do not compute ARIA labels specifically to their implementation since
|
|
264
|
+
* they can be rather general-purpose. Instead, owners of the specific bubble
|
|
265
|
+
* instance (such as an icon) are responsible for defining custom label providers
|
|
266
|
+
* for their bubbles.
|
|
267
|
+
*
|
|
268
|
+
* Note that calling this isn't sufficient for it to actually be used.
|
|
269
|
+
* recomputeAriaContext will likely also need to be called to actually apply the
|
|
270
|
+
* custom label to the bubble's focusable element.
|
|
271
|
+
*/
|
|
272
|
+
setAriaLabelProvider(provider: AriaLabelProvider | null): void;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the ARIA label to use for this bubble based on the provider set via
|
|
275
|
+
* setAriaLabelProvider. This will return null if the provider is absent or
|
|
276
|
+
* returns null.
|
|
277
|
+
*
|
|
278
|
+
* @returns The ARIA label to use for this bubble, or null if one is not provided.
|
|
279
|
+
*/
|
|
280
|
+
getAriaLabel(): string | null;
|
|
242
281
|
}
|
|
243
282
|
//# sourceMappingURL=bubble.d.ts.map
|
|
@@ -43,6 +43,7 @@ export declare class TextInputBubble extends Bubble {
|
|
|
43
43
|
private editable;
|
|
44
44
|
/** View responsible for supporting text editing. */
|
|
45
45
|
private editor;
|
|
46
|
+
private readonly textChangeListener;
|
|
46
47
|
/**
|
|
47
48
|
* @param workspace The workspace this bubble belongs to.
|
|
48
49
|
* @param anchor The anchor location of the thing this bubble is attached to.
|
|
@@ -103,5 +104,9 @@ export declare class TextInputBubble extends Bubble {
|
|
|
103
104
|
* the comment editor.
|
|
104
105
|
*/
|
|
105
106
|
performAction(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Dispose of this bubble.
|
|
109
|
+
*/
|
|
110
|
+
dispose(): void;
|
|
106
111
|
}
|
|
107
112
|
//# sourceMappingURL=textinput_bubble.d.ts.map
|
package/core/field_checkbox.d.ts
CHANGED
|
@@ -114,6 +114,29 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
|
|
|
114
114
|
* @returns The converted value.
|
|
115
115
|
*/
|
|
116
116
|
private convertValueToBool;
|
|
117
|
+
/**
|
|
118
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
119
|
+
*
|
|
120
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
121
|
+
* version of the ARIA representation of the field's type.
|
|
122
|
+
*
|
|
123
|
+
* @returns An ARIA representation of the field's type or a default if it is
|
|
124
|
+
* unspecified.
|
|
125
|
+
*/
|
|
126
|
+
getAriaTypeName(): string;
|
|
127
|
+
/**
|
|
128
|
+
* Gets an ARIA-friendly label representation of this field's value.
|
|
129
|
+
*
|
|
130
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
131
|
+
* version of the ARIA representation of the field's value.
|
|
132
|
+
*
|
|
133
|
+
* The FieldCheckbox implementation is not used for the actual ARIA label of
|
|
134
|
+
* the field, since the checked state is already included in the ARIA checked
|
|
135
|
+
* state, but it is used for the ARIA label of its source block.
|
|
136
|
+
*
|
|
137
|
+
* @returns An ARIA representation of the field's text.
|
|
138
|
+
*/
|
|
139
|
+
getAriaValue(): string | null;
|
|
117
140
|
/**
|
|
118
141
|
* Construct a FieldCheckbox from a JSON arg object.
|
|
119
142
|
*
|
|
@@ -123,6 +146,10 @@ export declare class FieldCheckbox extends Field<CheckboxBool> {
|
|
|
123
146
|
* @internal
|
|
124
147
|
*/
|
|
125
148
|
static fromJson(options: FieldCheckboxFromJsonConfig): FieldCheckbox;
|
|
149
|
+
/**
|
|
150
|
+
* Recomputes the ARIA role and label for this field.
|
|
151
|
+
*/
|
|
152
|
+
protected recomputeAriaContext(): void;
|
|
126
153
|
}
|
|
127
154
|
/**
|
|
128
155
|
* Config options for the checkbox field.
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -56,6 +56,11 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
56
56
|
protected static IMAGE_Y_OFFSET: number;
|
|
57
57
|
/** The total vertical padding above and below an image. */
|
|
58
58
|
protected static IMAGE_Y_PADDING: number;
|
|
59
|
+
/**
|
|
60
|
+
* True once the field’s DOM has been created and it is safe to run ARIA
|
|
61
|
+
* updates in response to value changes.
|
|
62
|
+
*/
|
|
63
|
+
isInitialized: boolean;
|
|
59
64
|
/**
|
|
60
65
|
* @param menuGenerator A non-empty array of options for a dropdown list, or a
|
|
61
66
|
* function which generates these options. Also accepts Field.SKIP_SETUP
|
|
@@ -238,6 +243,50 @@ export declare class FieldDropdown extends Field<string> {
|
|
|
238
243
|
* @throws {TypeError} If proposed options are incorrectly structured.
|
|
239
244
|
*/
|
|
240
245
|
protected validateOptions(options: MenuOption[]): void;
|
|
246
|
+
/**
|
|
247
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
248
|
+
*
|
|
249
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
250
|
+
* version of the ARIA representation of the field's type.
|
|
251
|
+
*
|
|
252
|
+
* @returns An ARIA representation of the field's type or a default if it is
|
|
253
|
+
* unspecified.
|
|
254
|
+
*/
|
|
255
|
+
getAriaTypeName(): string | null;
|
|
256
|
+
/**
|
|
257
|
+
* Gets an ARIA-friendly label representation of this field's value.
|
|
258
|
+
*
|
|
259
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
260
|
+
* version of the ARIA representation of the field's value.
|
|
261
|
+
*
|
|
262
|
+
* @returns An ARIA representation of the field's text.
|
|
263
|
+
*/
|
|
264
|
+
getAriaValue(): string;
|
|
265
|
+
/**
|
|
266
|
+
* Returns the ARIA label for the currently selected dropdown option.
|
|
267
|
+
*
|
|
268
|
+
* @returns The computed ARIA label for the selected option, or `null` if no
|
|
269
|
+
* option is selected.
|
|
270
|
+
*/
|
|
271
|
+
private getSelectedAriaLabel;
|
|
272
|
+
/**
|
|
273
|
+
* Recomputes the ARIA role and label for this field.
|
|
274
|
+
*/
|
|
275
|
+
protected recomputeAriaContext(): void;
|
|
276
|
+
/**
|
|
277
|
+
* Computes an ARIA-friendly label for a dropdown option.
|
|
278
|
+
*
|
|
279
|
+
* The label is derived using a prioritized set of sources.
|
|
280
|
+
*
|
|
281
|
+
* Returned values are guaranteed to be non-empty strings for all non-separator
|
|
282
|
+
* options. Whitespace-only values are ignored when determining a usable label.
|
|
283
|
+
*
|
|
284
|
+
* @param option The dropdown option for which to compute the ARIA label.
|
|
285
|
+
* @param index The index of the option within the dropdown (0-based).
|
|
286
|
+
* @returns A string suitable for use as an ARIA label. Returns an empty string
|
|
287
|
+
* only if the option is a separator.
|
|
288
|
+
*/
|
|
289
|
+
private computeOptionAriaLabel;
|
|
241
290
|
}
|
|
242
291
|
/**
|
|
243
292
|
* Definition of a human-readable image dropdown option.
|
|
@@ -247,6 +296,7 @@ export interface ImageProperties {
|
|
|
247
296
|
alt: string;
|
|
248
297
|
width: number;
|
|
249
298
|
height: number;
|
|
299
|
+
ariaLabel?: string;
|
|
250
300
|
}
|
|
251
301
|
/**
|
|
252
302
|
* An individual option in the dropdown menu. Can be either the string literal
|
|
@@ -255,7 +305,7 @@ export interface ImageProperties {
|
|
|
255
305
|
* (text, ImageProperties object, or HTML element), and the second element is
|
|
256
306
|
* the language-neutral value.
|
|
257
307
|
*/
|
|
258
|
-
export type MenuOption = [string | ImageProperties | HTMLElement, string] | 'separator';
|
|
308
|
+
export type MenuOption = [string | ImageProperties | HTMLElement, string, string?] | 'separator';
|
|
259
309
|
/**
|
|
260
310
|
* A function that generates an array of menu options for FieldDropdown
|
|
261
311
|
* or its descendants.
|
package/core/field_image.d.ts
CHANGED
|
@@ -129,6 +129,30 @@ export declare class FieldImage extends Field<string> {
|
|
|
129
129
|
* @internal
|
|
130
130
|
*/
|
|
131
131
|
static fromJson(options: FieldImageFromJsonConfig): FieldImage;
|
|
132
|
+
/**
|
|
133
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
134
|
+
*
|
|
135
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
136
|
+
* version of the ARIA representation of the field's type.
|
|
137
|
+
*
|
|
138
|
+
* @returns An ARIA representation of the field's type or a default if it is
|
|
139
|
+
* unspecified.
|
|
140
|
+
*/
|
|
141
|
+
getAriaTypeName(): string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Gets an ARIA-friendly label representation of this field's value.
|
|
144
|
+
*
|
|
145
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
146
|
+
* version of the ARIA representation of the field's value.
|
|
147
|
+
*
|
|
148
|
+
* @returns An ARIA representation of the field's text, or null if no text is
|
|
149
|
+
* currently defined or known for the field.
|
|
150
|
+
*/
|
|
151
|
+
getAriaValue(): string | null;
|
|
152
|
+
/**
|
|
153
|
+
* Recomputes the ARIA role and label for this field.
|
|
154
|
+
*/
|
|
155
|
+
protected recomputeAriaContext(): void;
|
|
132
156
|
}
|
|
133
157
|
/**
|
|
134
158
|
* Config options for the image field.
|
package/core/field_input.d.ts
CHANGED
|
@@ -285,7 +285,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
285
285
|
/**
|
|
286
286
|
* Recomputes the ARIA role and label for this field.
|
|
287
287
|
*/
|
|
288
|
-
|
|
288
|
+
protected recomputeAriaContext(): void;
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Config options for the input field.
|
package/core/field_number.d.ts
CHANGED
|
@@ -160,6 +160,16 @@ export declare class FieldNumber extends FieldInput<number> {
|
|
|
160
160
|
* @internal
|
|
161
161
|
*/
|
|
162
162
|
static fromJson(options: FieldNumberFromJsonConfig): FieldNumber;
|
|
163
|
+
/**
|
|
164
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
165
|
+
*
|
|
166
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
167
|
+
* version of the ARIA representation of the field's type.
|
|
168
|
+
*
|
|
169
|
+
* @returns An ARIA representation of the field's type or a default if it is
|
|
170
|
+
* unspecified.
|
|
171
|
+
*/
|
|
172
|
+
getAriaTypeName(): string | null;
|
|
163
173
|
}
|
|
164
174
|
/**
|
|
165
175
|
* Config options for the number field.
|
|
@@ -48,6 +48,16 @@ export declare class FieldTextInput extends FieldInput<string> {
|
|
|
48
48
|
* @internal
|
|
49
49
|
*/
|
|
50
50
|
static fromJson(options: FieldTextInputFromJsonConfig): FieldTextInput;
|
|
51
|
+
/**
|
|
52
|
+
* Gets an ARIA-friendly label representation of this field's type.
|
|
53
|
+
*
|
|
54
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
55
|
+
* version of the ARIA representation of the field's type.
|
|
56
|
+
*
|
|
57
|
+
* @returns An ARIA representation of the field's type or a default if it is
|
|
58
|
+
* unspecified.
|
|
59
|
+
*/
|
|
60
|
+
getAriaTypeName(): string | null;
|
|
51
61
|
}
|
|
52
62
|
/**
|
|
53
63
|
* Config options for the text input field.
|
package/core/field_variable.d.ts
CHANGED
|
@@ -228,6 +228,15 @@ export declare class FieldVariable extends FieldDropdown {
|
|
|
228
228
|
* @returns Array of variable names/id tuples.
|
|
229
229
|
*/
|
|
230
230
|
static dropdownCreate(this: FieldVariable): MenuOption[];
|
|
231
|
+
/**
|
|
232
|
+
* Gets an ARIA-friendly label representation of this field's value.
|
|
233
|
+
*
|
|
234
|
+
* Implementations are responsible for, and encouraged to, return a localized
|
|
235
|
+
* version of the ARIA representation of the field's value.
|
|
236
|
+
*
|
|
237
|
+
* @returns An ARIA representation of the field's text.
|
|
238
|
+
*/
|
|
239
|
+
getAriaValue(): string;
|
|
231
240
|
}
|
|
232
241
|
/**
|
|
233
242
|
* Config options for the variable field.
|
package/core/flyout_base.d.ts
CHANGED
|
@@ -268,6 +268,16 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
268
268
|
* toolbox definition, or a string with the name of the dynamic category.
|
|
269
269
|
*/
|
|
270
270
|
show(flyoutDef: toolbox.FlyoutDefinition | string): void;
|
|
271
|
+
/**
|
|
272
|
+
* Updates the aria attributes for the entire flyout dom.
|
|
273
|
+
* This needs to do two things:
|
|
274
|
+
* 1. Set aria-owns on the flyout's workspace canvas to include the ids of all
|
|
275
|
+
* focusable elements in the flyout.
|
|
276
|
+
* 2. Update the aria attributes on the flyout's workspace. This can't be done at workspace
|
|
277
|
+
* creation because the workspace may not have all required information until the flyout
|
|
278
|
+
* is fully shown.
|
|
279
|
+
*/
|
|
280
|
+
protected updateAriaContext(): void;
|
|
271
281
|
/**
|
|
272
282
|
* Create the contents array and gaps array necessary to create the layout for
|
|
273
283
|
* the flyout.
|
|
@@ -115,6 +115,14 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
|
|
|
115
115
|
* I.E. the block that owns this icon.
|
|
116
116
|
*/
|
|
117
117
|
private getBubbleOwnerRect;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the ARIA label to use for this icon (defaults to null). Note that this
|
|
120
|
+
* method will only be called during initialization by default, so dynamic changes
|
|
121
|
+
* to the icon's ARIA label need to be applied by calling recomputeAriaContext.
|
|
122
|
+
*
|
|
123
|
+
* @returns The ARIA label to use for this icon, or null to use a default.
|
|
124
|
+
*/
|
|
125
|
+
protected getAriaLabel(): string | null;
|
|
118
126
|
}
|
|
119
127
|
/** The save state format for a comment icon. */
|
|
120
128
|
export interface CommentState {
|
package/core/icons/icon.d.ts
CHANGED
|
@@ -86,5 +86,19 @@ export declare abstract class Icon implements IIcon, IContextMenu {
|
|
|
86
86
|
*/
|
|
87
87
|
getSourceBlock(): Block;
|
|
88
88
|
showContextMenu(e: PointerEvent): void;
|
|
89
|
+
/**
|
|
90
|
+
* Recomputes the ARIA label and role for this icon. This is automatically called
|
|
91
|
+
* during initialization, but implementations may find it useful to call this if
|
|
92
|
+
* the icon's label should be changed.
|
|
93
|
+
*/
|
|
94
|
+
protected recomputeAriaContext(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the ARIA label to use for this icon (defaults to null). Note that this
|
|
97
|
+
* method will only be called during initialization by default, so dynamic changes
|
|
98
|
+
* to the icon's ARIA label need to be applied by calling recomputeAriaContext.
|
|
99
|
+
*
|
|
100
|
+
* @returns The ARIA label to use for this icon, or null to use a default.
|
|
101
|
+
*/
|
|
102
|
+
protected getAriaLabel(): string | null;
|
|
89
103
|
}
|
|
90
104
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -92,5 +92,13 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
|
|
|
92
92
|
* currently open.
|
|
93
93
|
*/
|
|
94
94
|
getWorkspace(): WorkspaceSvg | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Returns the ARIA label to use for this icon (defaults to null). Note that this
|
|
97
|
+
* method will only be called during initialization by default, so dynamic changes
|
|
98
|
+
* to the icon's ARIA label need to be applied by calling recomputeAriaContext.
|
|
99
|
+
*
|
|
100
|
+
* @returns The ARIA label to use for this icon, or null to use a default.
|
|
101
|
+
*/
|
|
102
|
+
protected getAriaLabel(): string | null;
|
|
95
103
|
}
|
|
96
104
|
//# sourceMappingURL=mutator_icon.d.ts.map
|
|
@@ -73,5 +73,13 @@ export declare class WarningIcon extends Icon implements IHasBubble {
|
|
|
73
73
|
* I.E. the block that owns this icon.
|
|
74
74
|
*/
|
|
75
75
|
private getBubbleOwnerRect;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the ARIA label to use for this icon (defaults to null). Note that this
|
|
78
|
+
* method will only be called during initialization by default, so dynamic changes
|
|
79
|
+
* to the icon's ARIA label need to be applied by calling recomputeAriaContext.
|
|
80
|
+
*
|
|
81
|
+
* @returns The ARIA label to use for this icon, or null to use a default.
|
|
82
|
+
*/
|
|
83
|
+
protected getAriaLabel(): string | null;
|
|
76
84
|
}
|
|
77
85
|
//# sourceMappingURL=warning_icon.d.ts.map
|
package/core/inputs/input.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ import type { Field } from '../field.js';
|
|
|
17
17
|
import { Verbosity } from '../utils/aria.js';
|
|
18
18
|
import { Align } from './align.js';
|
|
19
19
|
import { inputTypes } from './input_types.js';
|
|
20
|
+
/**
|
|
21
|
+
* Represents a string or a function that returns a string which can be used as a
|
|
22
|
+
* custom ARIA string to represent an Input, or null if the default fallback should
|
|
23
|
+
* be used. See setAriaLabelProvider for more context.
|
|
24
|
+
*/
|
|
25
|
+
export type AriaLabelProvider = ((input: Input) => string | null) | string;
|
|
20
26
|
/** Class for an input with optional fields. */
|
|
21
27
|
export declare class Input {
|
|
22
28
|
name: string;
|
|
@@ -26,6 +32,8 @@ export declare class Input {
|
|
|
26
32
|
align: Align;
|
|
27
33
|
/** Is the input visible? */
|
|
28
34
|
private visible;
|
|
35
|
+
/** The AriaLabelProvider */
|
|
36
|
+
private ariaLabelProvider;
|
|
29
37
|
readonly type: inputTypes;
|
|
30
38
|
connection: Connection | null;
|
|
31
39
|
/**
|
|
@@ -123,6 +131,26 @@ export declare class Input {
|
|
|
123
131
|
getShadowDom(): Element | null;
|
|
124
132
|
/** Initialize the fields on this input. */
|
|
125
133
|
init(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Sets a custom ARIA label provider for this input, or null if it should be reset
|
|
136
|
+
* to use the default method.
|
|
137
|
+
*
|
|
138
|
+
* Inputs do not compute ARIA contexts directly, so the set provider will be used
|
|
139
|
+
* in select cases when the Input needs to be represented (such as for parts of a
|
|
140
|
+
* block label or for connections). Note that overriding this provider will not
|
|
141
|
+
* recompute any already constructed ARIA labels, and it cannot be assumed that the
|
|
142
|
+
* provider will be called any particular number of times during label
|
|
143
|
+
* recomputation. As such, implementations should make sure to provide a
|
|
144
|
+
* deterministic and idempotent ARIA representation each time the provider is
|
|
145
|
+
* called for a given input. It's also fine to reuse providers across multiple
|
|
146
|
+
* Input implementations.
|
|
147
|
+
*/
|
|
148
|
+
setAriaLabelProvider(provider: AriaLabelProvider | null): void;
|
|
149
|
+
/**
|
|
150
|
+
* Returns the string from the custom ARIA label provider set, or null if the default label (from the field row) should
|
|
151
|
+
* be used. See setAriaLabelProvider for more context.
|
|
152
|
+
*/
|
|
153
|
+
getAriaLabelText(): string | null;
|
|
126
154
|
/**
|
|
127
155
|
* Initializes the fields on this input for a headless block.
|
|
128
156
|
*
|
|
@@ -7,6 +7,15 @@ export interface IFlyoutInflater {
|
|
|
7
7
|
* Note that this method's interface is identical to that in ISerializer, to
|
|
8
8
|
* allow for code reuse.
|
|
9
9
|
*
|
|
10
|
+
* You must ensure that any item created by this method has the appropriate
|
|
11
|
+
* ARIA markup:
|
|
12
|
+
* - The role of the element's focusable element should be set to `listitem`.
|
|
13
|
+
* - The focusable element must have an `id` attribute.
|
|
14
|
+
* - Any DOM parents of the focusable element should set their role to
|
|
15
|
+
* `presentation` to avoid interfering with flyout list navigation.
|
|
16
|
+
* - If the element is not focusable, it must be hidden from the ARIA tree.
|
|
17
|
+
* Only do this if the content should be inaccessible to screenreaders.
|
|
18
|
+
*
|
|
10
19
|
* @param state A JSON representation of an element to inflate on the flyout.
|
|
11
20
|
* @param flyout The flyout on whose workspace the inflated element
|
|
12
21
|
* should be created. If the inflated element is an `IRenderedElement` it
|
package/core/menu.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare class Menu {
|
|
|
41
41
|
private element;
|
|
42
42
|
/** ARIA name for this menu. */
|
|
43
43
|
private roleName;
|
|
44
|
+
/** The menu's ID. */
|
|
45
|
+
private id;
|
|
44
46
|
/** Constructs a new Menu instance. */
|
|
45
47
|
constructor();
|
|
46
48
|
/**
|
|
@@ -166,5 +168,6 @@ export declare class Menu {
|
|
|
166
168
|
* @returns The MenuItem objects displayed in this menu.
|
|
167
169
|
*/
|
|
168
170
|
private getMenuItems;
|
|
171
|
+
getId(): string;
|
|
169
172
|
}
|
|
170
173
|
//# sourceMappingURL=menu.d.ts.map
|
package/core/menuitem.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import * as aria from './utils/aria.js';
|
|
|
15
15
|
export declare class MenuItem {
|
|
16
16
|
private readonly content;
|
|
17
17
|
private readonly opt_value?;
|
|
18
|
+
private readonly ariaLabel?;
|
|
18
19
|
/** Is the menu item clickable, as opposed to greyed-out. */
|
|
19
20
|
private enabled;
|
|
20
21
|
/** The DOM element for the menu item. */
|
|
@@ -31,18 +32,24 @@ export declare class MenuItem {
|
|
|
31
32
|
private highlight;
|
|
32
33
|
/** Bound function to call when this menu item is clicked. */
|
|
33
34
|
private actionHandler;
|
|
35
|
+
/** The unique ID for this menu item. */
|
|
36
|
+
private id;
|
|
34
37
|
/**
|
|
35
38
|
* @param content Text caption to display as the content of the item, or a
|
|
36
39
|
* HTML element to display.
|
|
37
40
|
* @param opt_value Data/model associated with the menu item.
|
|
38
41
|
*/
|
|
39
|
-
constructor(content: string | HTMLElement, opt_value?: string | undefined);
|
|
42
|
+
constructor(content: string | HTMLElement, opt_value?: string | undefined, ariaLabel?: string | undefined);
|
|
40
43
|
/**
|
|
41
44
|
* Creates the menuitem's DOM.
|
|
42
45
|
*
|
|
43
46
|
* @returns Completed DOM.
|
|
44
47
|
*/
|
|
45
48
|
createDom(): Element;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the ARIA label for this menu item.
|
|
51
|
+
*/
|
|
52
|
+
getAriaLabel(): string;
|
|
46
53
|
/** Dispose of this menu item. */
|
|
47
54
|
dispose(): void;
|
|
48
55
|
/**
|
package/core/shortcut_items.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export declare enum names {
|
|
|
35
35
|
INFORMATION = "information",
|
|
36
36
|
PERFORM_ACTION = "perform_action",
|
|
37
37
|
DUPLICATE = "duplicate",
|
|
38
|
-
CLEANUP = "cleanup"
|
|
38
|
+
CLEANUP = "cleanup",
|
|
39
|
+
SHOW_TOOLTIP = "show_tooltip"
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* Keyboard shortcut to hide chaff on escape.
|
|
@@ -112,6 +113,10 @@ export declare function registerDuplicate(): void;
|
|
|
112
113
|
* Registers keyboard shortcut to clean up the workspace.
|
|
113
114
|
*/
|
|
114
115
|
export declare function registerCleanup(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Registers keyboard shortcut to display the tooltip for the focused element.
|
|
118
|
+
*/
|
|
119
|
+
export declare function registerShowTooltip(): void;
|
|
115
120
|
/**
|
|
116
121
|
* Registers all default keyboard shortcut item. This should be called once per
|
|
117
122
|
* instance of KeyboardShortcutRegistry.
|
package/core/tooltip.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Copyright 2011 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
7
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
6
8
|
/**
|
|
7
9
|
* A type which can define a tooltip.
|
|
8
10
|
* Either a string, an object containing a tooltip property, or a function which
|
|
@@ -101,6 +103,14 @@ export declare function dispose(): void;
|
|
|
101
103
|
* Hide the tooltip.
|
|
102
104
|
*/
|
|
103
105
|
export declare function hide(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Display the tooltip for a given target.
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
* @param target The node upon which the tooltip should be displayed.
|
|
111
|
+
* @param workspace The target node's workspace.
|
|
112
|
+
*/
|
|
113
|
+
export declare function display(target: IFocusableNode, workspace?: WorkspaceSvg): void;
|
|
104
114
|
/**
|
|
105
115
|
* Hide any in-progress tooltips and block showing new tooltips until the next
|
|
106
116
|
* call to unblock().
|