blockly 13.0.0-beta.1 → 13.0.0-beta.2
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 +1260 -1215
- package/blockly_compressed.js +1110 -1085
- 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/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/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 +23 -3
- package/msg/ab.mjs +21 -1
- package/msg/ace.js +24 -4
- package/msg/ace.mjs +21 -1
- package/msg/af.js +23 -3
- package/msg/af.mjs +21 -1
- package/msg/am.js +24 -4
- package/msg/am.mjs +21 -1
- package/msg/ar.js +46 -26
- package/msg/ar.mjs +21 -1
- package/msg/ast.js +24 -4
- package/msg/ast.mjs +21 -1
- package/msg/az.js +24 -4
- package/msg/az.mjs +21 -1
- package/msg/ba.js +23 -3
- package/msg/ba.mjs +21 -1
- package/msg/bcc.js +23 -3
- package/msg/bcc.mjs +21 -1
- package/msg/be-tarask.js +57 -37
- package/msg/be-tarask.mjs +21 -1
- package/msg/be.js +24 -4
- package/msg/be.mjs +21 -1
- package/msg/bg.js +23 -3
- package/msg/bg.mjs +21 -1
- package/msg/bn.js +24 -4
- package/msg/bn.mjs +21 -1
- package/msg/br.js +24 -4
- package/msg/br.mjs +21 -1
- package/msg/bs.js +23 -3
- package/msg/bs.mjs +21 -1
- package/msg/ca.js +23 -3
- package/msg/ca.mjs +21 -1
- package/msg/ce.js +23 -3
- package/msg/ce.mjs +21 -1
- package/msg/cs.js +31 -11
- package/msg/cs.mjs +21 -1
- package/msg/da.js +47 -27
- package/msg/da.mjs +21 -1
- package/msg/de.js +23 -3
- package/msg/de.mjs +21 -1
- package/msg/diq.js +25 -5
- package/msg/diq.mjs +21 -1
- package/msg/dtp.js +23 -3
- package/msg/dtp.mjs +21 -1
- package/msg/dty.js +23 -3
- package/msg/dty.mjs +21 -1
- package/msg/ee.js +23 -3
- package/msg/ee.mjs +21 -1
- package/msg/el.js +54 -34
- package/msg/el.mjs +21 -1
- package/msg/en-gb.js +23 -3
- package/msg/en-gb.mjs +21 -1
- package/msg/en.js +24 -4
- package/msg/en.mjs +21 -1
- package/msg/eo.js +23 -3
- package/msg/eo.mjs +21 -1
- package/msg/es.js +33 -13
- package/msg/es.mjs +21 -1
- package/msg/et.js +23 -3
- package/msg/et.mjs +21 -1
- package/msg/eu.js +23 -3
- package/msg/eu.mjs +21 -1
- package/msg/fa.js +24 -4
- package/msg/fa.mjs +21 -1
- package/msg/fi.js +42 -22
- package/msg/fi.mjs +21 -1
- package/msg/fo.js +23 -3
- package/msg/fo.mjs +21 -1
- package/msg/fr.js +46 -26
- package/msg/fr.mjs +21 -1
- package/msg/frr.js +24 -4
- package/msg/frr.mjs +21 -1
- package/msg/ga.js +550 -0
- package/msg/{cdo.mjs → ga.mjs} +23 -3
- package/msg/gl.js +46 -26
- package/msg/gl.mjs +21 -1
- package/msg/gn.js +24 -4
- package/msg/gn.mjs +21 -1
- package/msg/gor.js +23 -3
- package/msg/gor.mjs +21 -1
- package/msg/ha.js +23 -3
- package/msg/ha.mjs +21 -1
- package/msg/hak.js +24 -4
- package/msg/hak.mjs +21 -1
- package/msg/he.js +73 -53
- package/msg/he.mjs +21 -1
- package/msg/hi.js +23 -3
- package/msg/hi.mjs +21 -1
- package/msg/hr.js +23 -3
- package/msg/hr.mjs +21 -1
- package/msg/hrx.js +23 -3
- package/msg/hrx.mjs +21 -1
- package/msg/hsb.js +23 -3
- package/msg/hsb.mjs +21 -1
- package/msg/hu.js +25 -5
- package/msg/hu.mjs +21 -1
- package/msg/hy.js +23 -3
- package/msg/hy.mjs +21 -1
- package/msg/ia.js +46 -26
- package/msg/ia.mjs +21 -1
- package/msg/id.js +253 -233
- package/msg/id.mjs +21 -1
- package/msg/ig.js +31 -11
- package/msg/ig.mjs +21 -1
- package/msg/inh.js +23 -3
- package/msg/inh.mjs +21 -1
- package/msg/is.js +23 -3
- package/msg/is.mjs +21 -1
- package/msg/it.js +49 -29
- package/msg/it.mjs +21 -1
- package/msg/ja.js +46 -26
- package/msg/ja.mjs +21 -1
- package/msg/ka.js +25 -5
- package/msg/ka.mjs +21 -1
- package/msg/kab.js +32 -12
- package/msg/kab.mjs +21 -1
- package/msg/kbd-cyrl.js +24 -4
- package/msg/kbd-cyrl.mjs +21 -1
- package/msg/km.js +23 -3
- package/msg/km.mjs +21 -1
- package/msg/kn.js +23 -3
- package/msg/kn.mjs +21 -1
- package/msg/ko.js +48 -28
- package/msg/ko.mjs +21 -1
- package/msg/krc.js +550 -0
- package/msg/krc.mjs +531 -0
- package/msg/ksh.js +24 -4
- package/msg/ksh.mjs +21 -1
- package/msg/ku-latn.js +24 -4
- package/msg/ku-latn.mjs +21 -1
- package/msg/ky.js +25 -5
- package/msg/ky.mjs +21 -1
- package/msg/la.js +24 -4
- package/msg/la.mjs +21 -1
- package/msg/lb.js +34 -14
- package/msg/lb.mjs +21 -1
- package/msg/lki.js +23 -3
- package/msg/lki.mjs +21 -1
- package/msg/lo.js +23 -3
- package/msg/lo.mjs +21 -1
- package/msg/lrc.js +23 -3
- package/msg/lrc.mjs +21 -1
- package/msg/lt.js +24 -4
- package/msg/lt.mjs +21 -1
- package/msg/lv.js +34 -14
- package/msg/lv.mjs +21 -1
- package/msg/mg.js +23 -3
- package/msg/mg.mjs +21 -1
- package/msg/mk.js +23 -3
- package/msg/mk.mjs +21 -1
- package/msg/ml.js +23 -3
- package/msg/ml.mjs +21 -1
- package/msg/mnw.js +23 -3
- package/msg/mnw.mjs +21 -1
- package/msg/ms.js +32 -12
- package/msg/ms.mjs +21 -1
- package/msg/my.js +23 -3
- package/msg/my.mjs +21 -1
- package/msg/mzn.js +24 -4
- package/msg/mzn.mjs +21 -1
- package/msg/nb.js +23 -3
- package/msg/nb.mjs +21 -1
- package/msg/ne.js +32 -12
- package/msg/ne.mjs +21 -1
- package/msg/nl.js +46 -26
- package/msg/nl.mjs +21 -1
- package/msg/oc.js +23 -3
- package/msg/oc.mjs +21 -1
- package/msg/olo.js +24 -4
- package/msg/olo.mjs +21 -1
- package/msg/pa.js +32 -12
- package/msg/pa.mjs +21 -1
- package/msg/pl.js +46 -26
- package/msg/pl.mjs +21 -1
- package/msg/pms.js +46 -26
- package/msg/pms.mjs +21 -1
- package/msg/ps.js +41 -21
- package/msg/ps.mjs +21 -1
- package/msg/pt-br.js +46 -26
- package/msg/pt-br.mjs +21 -1
- package/msg/pt.js +46 -26
- package/msg/pt.mjs +21 -1
- package/msg/ro.js +55 -35
- package/msg/ro.mjs +21 -1
- package/msg/ru.js +46 -26
- package/msg/ru.mjs +21 -1
- package/msg/sc.js +23 -3
- package/msg/sc.mjs +21 -1
- package/msg/sco.js +24 -4
- package/msg/sco.mjs +21 -1
- package/msg/sd.js +23 -3
- package/msg/sd.mjs +21 -1
- package/msg/shn.js +23 -3
- package/msg/shn.mjs +21 -1
- package/msg/si.js +24 -4
- package/msg/si.mjs +21 -1
- package/msg/sk.js +24 -4
- package/msg/sk.mjs +21 -1
- package/msg/skr-arab.js +26 -6
- package/msg/skr-arab.mjs +21 -1
- package/msg/sl.js +47 -27
- package/msg/sl.mjs +21 -1
- package/msg/smn.js +25 -5
- package/msg/smn.mjs +21 -1
- package/msg/sq.js +32 -12
- package/msg/sq.mjs +21 -1
- package/msg/sr-latn.js +23 -3
- package/msg/sr-latn.mjs +21 -1
- package/msg/sr.js +23 -3
- package/msg/sr.mjs +21 -1
- package/msg/sv.js +46 -26
- package/msg/sv.mjs +21 -1
- package/msg/sw.js +24 -4
- package/msg/sw.mjs +21 -1
- package/msg/ta.js +42 -22
- package/msg/ta.mjs +21 -1
- package/msg/tcy.js +93 -73
- package/msg/tcy.mjs +21 -1
- package/msg/tdd.js +23 -3
- package/msg/tdd.mjs +21 -1
- package/msg/te.js +23 -3
- package/msg/te.mjs +21 -1
- package/msg/th.js +24 -4
- package/msg/th.mjs +21 -1
- package/msg/ti.js +23 -3
- package/msg/ti.mjs +21 -1
- package/msg/tl.js +23 -3
- package/msg/tl.mjs +21 -1
- package/msg/tlh.js +23 -3
- package/msg/tlh.mjs +21 -1
- package/msg/tr.js +46 -26
- package/msg/tr.mjs +21 -1
- package/msg/ug-arab.js +23 -3
- package/msg/ug-arab.mjs +21 -1
- package/msg/uk.js +23 -3
- package/msg/uk.mjs +21 -1
- package/msg/ur.js +23 -3
- package/msg/ur.mjs +21 -1
- package/msg/uz.js +38 -18
- package/msg/uz.mjs +21 -1
- package/msg/vi.js +47 -27
- package/msg/vi.mjs +21 -1
- package/msg/xmf.js +23 -3
- package/msg/xmf.mjs +21 -1
- package/msg/yo.js +23 -3
- package/msg/yo.mjs +21 -1
- package/msg/zgh.js +23 -3
- package/msg/zgh.mjs +21 -1
- package/msg/zh-hans.js +46 -26
- package/msg/zh-hans.mjs +21 -1
- package/msg/zh-hant.js +46 -26
- package/msg/zh-hant.mjs +21 -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
|
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.
|
|
@@ -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().
|
package/core/trashcan.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import './events/events_trashcan_open.js';
|
|
|
8
8
|
import type { IAutoHideable } from './interfaces/i_autohideable.js';
|
|
9
9
|
import type { IDraggable } from './interfaces/i_draggable.js';
|
|
10
10
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
11
|
+
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
11
12
|
import type { IPositionable } from './interfaces/i_positionable.js';
|
|
12
13
|
import type { UiMetrics } from './metrics_manager.js';
|
|
13
14
|
import { Rect } from './utils/rect.js';
|
|
@@ -15,13 +16,20 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
15
16
|
/**
|
|
16
17
|
* Class for a trash can.
|
|
17
18
|
*/
|
|
18
|
-
export declare class Trashcan extends DeleteArea implements IAutoHideable, IPositionable {
|
|
19
|
+
export declare class Trashcan extends DeleteArea implements IAutoHideable, IPositionable, IFocusableNode {
|
|
19
20
|
private workspace;
|
|
20
21
|
/**
|
|
21
|
-
* The
|
|
22
|
+
* The id for this component that is used to register with the
|
|
22
23
|
* ComponentManager.
|
|
23
24
|
*/
|
|
24
25
|
id: string;
|
|
26
|
+
/**
|
|
27
|
+
* A globally unique ID for this particular trashcan. Component Manager IDs
|
|
28
|
+
* (the ID above) are 1:1 with classes, but if there are multiple workspaces
|
|
29
|
+
* with trashcans on a page, each actual trashcan DOM element needs a unique
|
|
30
|
+
* ID to support focusable node resolution. This ID is for that purpose.
|
|
31
|
+
*/
|
|
32
|
+
private uniqueId;
|
|
25
33
|
/**
|
|
26
34
|
* A list of JSON (stored as strings) representing blocks in the trashcan.
|
|
27
35
|
*/
|
|
@@ -34,19 +42,8 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
|
|
|
34
42
|
flyout: IFlyout | null;
|
|
35
43
|
/** Current open/close state of the lid. */
|
|
36
44
|
isLidOpen: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* The minimum openness of the lid. Used to indicate if the trashcan
|
|
39
|
-
* contains blocks.
|
|
40
|
-
*/
|
|
41
|
-
private minOpenness;
|
|
42
45
|
/** The SVG group containing the trash can. */
|
|
43
46
|
private svgGroup;
|
|
44
|
-
/** The SVG image element of the trash can lid. */
|
|
45
|
-
private svgLid;
|
|
46
|
-
/** Task ID of opening/closing animation. */
|
|
47
|
-
private lidTask;
|
|
48
|
-
/** Current state of lid opening (0.0 = closed, 1.0 = open). */
|
|
49
|
-
private lidOpen;
|
|
50
47
|
/** Left coordinate of the trash can. */
|
|
51
48
|
private left;
|
|
52
49
|
/** Top coordinate of the trash can. */
|
|
@@ -148,22 +145,6 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
|
|
|
148
145
|
* @internal
|
|
149
146
|
*/
|
|
150
147
|
setLidOpen(state: boolean): void;
|
|
151
|
-
/** Rotate the lid open or closed by one step. Then wait and recurse. */
|
|
152
|
-
private animateLid;
|
|
153
|
-
/**
|
|
154
|
-
* Set the angle of the trashcan's lid.
|
|
155
|
-
*
|
|
156
|
-
* @param lidAngle The angle at which to set the lid.
|
|
157
|
-
*/
|
|
158
|
-
private setLidAngle;
|
|
159
|
-
/**
|
|
160
|
-
* Sets the minimum openness of the trashcan lid. If the lid is currently
|
|
161
|
-
* closed, this will update lid's position.
|
|
162
|
-
*
|
|
163
|
-
* @param newMin The new minimum openness of the lid. Should be between 0
|
|
164
|
-
* and 1.
|
|
165
|
-
*/
|
|
166
|
-
private setMinOpenness;
|
|
167
148
|
/**
|
|
168
149
|
* Flip the lid shut.
|
|
169
150
|
* Called externally after a drag.
|
|
@@ -183,15 +164,6 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
|
|
|
183
164
|
* @param e A mouse down event.
|
|
184
165
|
*/
|
|
185
166
|
private blockMouseDownWhenOpenable;
|
|
186
|
-
/**
|
|
187
|
-
* Indicate that the trashcan can be clicked (by opening it) if it has blocks.
|
|
188
|
-
*/
|
|
189
|
-
private mouseOver;
|
|
190
|
-
/**
|
|
191
|
-
* Close the lid of the trashcan if it was open (Vis. it was indicating it had
|
|
192
|
-
* blocks).
|
|
193
|
-
*/
|
|
194
|
-
private mouseOut;
|
|
195
167
|
/**
|
|
196
168
|
* Handle a BLOCK_DELETE event. Adds deleted blocks oldXml to the content
|
|
197
169
|
* array.
|
|
@@ -208,5 +180,18 @@ export declare class Trashcan extends DeleteArea implements IAutoHideable, IPosi
|
|
|
208
180
|
* unnecessary attributes.
|
|
209
181
|
*/
|
|
210
182
|
private cleanBlockJson;
|
|
183
|
+
getFocusableElement(): SVGElement;
|
|
184
|
+
getFocusableTree(): WorkspaceSvg;
|
|
185
|
+
onNodeFocus(): void;
|
|
186
|
+
onNodeBlur(): void;
|
|
187
|
+
canBeFocused(): boolean;
|
|
188
|
+
performAction(): void;
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves the globally unique ID of this Trashcan instance. Used for focus
|
|
191
|
+
* management.
|
|
192
|
+
*
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
getGloballyUniqueId(): string;
|
|
211
196
|
}
|
|
212
197
|
//# sourceMappingURL=trashcan.d.ts.map
|
package/core/utils/aria.d.ts
CHANGED
|
@@ -187,7 +187,13 @@ export declare enum State {
|
|
|
187
187
|
*
|
|
188
188
|
* Value: a number representing the minimum allowed value for a range widget.
|
|
189
189
|
*/
|
|
190
|
-
VALUEMIN = "valuemin"
|
|
190
|
+
VALUEMIN = "valuemin",
|
|
191
|
+
/**
|
|
192
|
+
* See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-owns
|
|
193
|
+
*
|
|
194
|
+
* Value: a space-separated list of element IDs that are owned by the current element.
|
|
195
|
+
*/
|
|
196
|
+
OWNS = "owns"
|
|
191
197
|
}
|
|
192
198
|
/**
|
|
193
199
|
* Used to control how verbose generated a11y labels are.
|
package/core/workspace.d.ts
CHANGED
|
@@ -353,7 +353,11 @@ export declare class Workspace {
|
|
|
353
353
|
*
|
|
354
354
|
* @param redo False if undo, true if redo.
|
|
355
355
|
*/
|
|
356
|
-
undo(redo
|
|
356
|
+
undo(redo?: boolean): void;
|
|
357
|
+
/**
|
|
358
|
+
* Redoes the previous action.
|
|
359
|
+
*/
|
|
360
|
+
redo(): void;
|
|
357
361
|
/** Clear the undo/redo stacks. */
|
|
358
362
|
clearUndo(): void;
|
|
359
363
|
/**
|
package/core/workspace_svg.d.ts
CHANGED
|
@@ -377,6 +377,14 @@ export declare class WorkspaceSvg extends Workspace implements IContextMenu, IFo
|
|
|
377
377
|
* @param handler Data that can be passed to eventHandling.unbind.
|
|
378
378
|
*/
|
|
379
379
|
setResizeHandlerWrapper(handler: browserEvents.Data): void;
|
|
380
|
+
/**
|
|
381
|
+
* Sets Aria labels, roles, etc. for the workspace depending on the type of workspace it is.
|
|
382
|
+
*/
|
|
383
|
+
setInitialAriaContext(): void;
|
|
384
|
+
/**
|
|
385
|
+
* Updates the label on the workspace to reflect the number of top-level stacks in the workspace.
|
|
386
|
+
*/
|
|
387
|
+
private updateAriaLabel;
|
|
380
388
|
/**
|
|
381
389
|
* Create the workspace DOM elements.
|
|
382
390
|
*
|