Skip to content

Commit ae22165

Browse files
authored
refactor: Remove INavigable in favor of IFocusableNode. (#9037)
* refactor: Remove INavigable in favor of IFocusableNode. * chore: Fix JSDoc. * chore: Address review feedback.
1 parent e34a969 commit ae22165

29 files changed

+236
-393
lines changed

core/block_svg.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import type {IDragStrategy, IDraggable} from './interfaces/i_draggable.js';
4747
import type {IFocusableNode} from './interfaces/i_focusable_node.js';
4848
import type {IFocusableTree} from './interfaces/i_focusable_tree.js';
4949
import {IIcon} from './interfaces/i_icon.js';
50-
import type {INavigable} from './interfaces/i_navigable.js';
5150
import * as internalConstants from './internal_constants.js';
5251
import {Msg} from './msg.js';
5352
import * as renderManagement from './render_management.js';
@@ -77,8 +76,7 @@ export class BlockSvg
7776
ICopyable<BlockCopyData>,
7877
IDraggable,
7978
IDeletable,
80-
IFocusableNode,
81-
INavigable<BlockSvg>
79+
IFocusableNode
8280
{
8381
/**
8482
* Constant for identifying rows that are to be rendered inline.
@@ -1796,16 +1794,4 @@ export class BlockSvg
17961794
canBeFocused(): boolean {
17971795
return true;
17981796
}
1799-
1800-
/**
1801-
* Returns this block's class.
1802-
*
1803-
* Used by keyboard navigation to look up the rules for navigating from this
1804-
* block.
1805-
*
1806-
* @returns This block's class.
1807-
*/
1808-
getClass() {
1809-
return BlockSvg;
1810-
}
18111797
}

core/blockly.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ import {
171171
import {IVariableMap} from './interfaces/i_variable_map.js';
172172
import {IVariableModel, IVariableState} from './interfaces/i_variable_model.js';
173173
import * as internalConstants from './internal_constants.js';
174-
import {CursorOptions, LineCursor} from './keyboard_nav/line_cursor.js';
174+
import {LineCursor} from './keyboard_nav/line_cursor.js';
175175
import {Marker} from './keyboard_nav/marker.js';
176176
import type {LayerManager} from './layer_manager.js';
177177
import * as layers from './layers.js';
@@ -429,7 +429,7 @@ Names.prototype.populateProcedures = function (
429429
};
430430
// clang-format on
431431

432-
export * from './interfaces/i_navigable.js';
432+
export * from './flyout_navigator.js';
433433
export * from './interfaces/i_navigation_policy.js';
434434
export * from './keyboard_nav/block_navigation_policy.js';
435435
export * from './keyboard_nav/connection_navigation_policy.js';
@@ -457,7 +457,6 @@ export {
457457
ContextMenuItems,
458458
ContextMenuRegistry,
459459
Css,
460-
CursorOptions,
461460
DeleteArea,
462461
DragTarget,
463462
Events,

core/field.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import type {Input} from './inputs/input.js';
2626
import type {IFocusableNode} from './interfaces/i_focusable_node.js';
2727
import type {IFocusableTree} from './interfaces/i_focusable_tree.js';
2828
import type {IKeyboardAccessible} from './interfaces/i_keyboard_accessible.js';
29-
import type {INavigable} from './interfaces/i_navigable.js';
3029
import type {IRegistrable} from './interfaces/i_registrable.js';
3130
import {ISerializable} from './interfaces/i_serializable.js';
3231
import type {ConstantProvider} from './renderers/common/constants.js';
@@ -68,12 +67,7 @@ export type FieldValidator<T = any> = (newValue: T) => T | null | undefined;
6867
* @typeParam T - The value stored on the field.
6968
*/
7069
export abstract class Field<T = any>
71-
implements
72-
IKeyboardAccessible,
73-
IRegistrable,
74-
ISerializable,
75-
IFocusableNode,
76-
INavigable<Field<T>>
70+
implements IKeyboardAccessible, IRegistrable, ISerializable, IFocusableNode
7771
{
7872
/**
7973
* To overwrite the default value which is set in **Field**, directly update
@@ -1410,16 +1404,6 @@ export abstract class Field<T = any>
14101404
`Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.`,
14111405
);
14121406
}
1413-
1414-
/**
1415-
* Returns this field's class.
1416-
*
1417-
* Used by keyboard navigation to look up the rules for navigating from this
1418-
* field. Must be implemented by subclasses.
1419-
*
1420-
* @returns This field's class.
1421-
*/
1422-
abstract getClass(): new (...args: any) => Field<T>;
14231407
}
14241408

14251409
/**

core/field_checkbox.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,6 @@ export class FieldCheckbox extends Field<CheckboxBool> {
228228
// 'override' the static fromJson method.
229229
return new this(options.checked, undefined, options);
230230
}
231-
232-
/**
233-
* Returns this field's class.
234-
*
235-
* Used by keyboard navigation to look up the rules for navigating from this
236-
* field.
237-
*
238-
* @returns This field's class.
239-
*/
240-
getClass() {
241-
return FieldCheckbox;
242-
}
243231
}
244232

245233
fieldRegistry.register('field_checkbox', FieldCheckbox);

core/field_dropdown.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -796,18 +796,6 @@ export class FieldDropdown extends Field<string> {
796796
throw TypeError('Found invalid FieldDropdown options.');
797797
}
798798
}
799-
800-
/**
801-
* Returns this field's class.
802-
*
803-
* Used by keyboard navigation to look up the rules for navigating from this
804-
* field.
805-
*
806-
* @returns This field's class.
807-
*/
808-
getClass() {
809-
return FieldDropdown;
810-
}
811799
}
812800

813801
/**

core/field_image.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,6 @@ export class FieldImage extends Field<string> {
272272
options,
273273
);
274274
}
275-
276-
/**
277-
* Returns this field's class.
278-
*
279-
* Used by keyboard navigation to look up the rules for navigating from this
280-
* field.
281-
*
282-
* @returns This field's class.
283-
*/
284-
getClass() {
285-
return FieldImage;
286-
}
287275
}
288276

289277
fieldRegistry.register('field_image', FieldImage);

core/field_label.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,6 @@ export class FieldLabel extends Field<string> {
126126
// the static fromJson method.
127127
return new this(text, undefined, options);
128128
}
129-
130-
/**
131-
* Returns this field's class.
132-
*
133-
* Used by keyboard navigation to look up the rules for navigating from this
134-
* field.
135-
*
136-
* @returns This field's class.
137-
*/
138-
getClass() {
139-
return FieldLabel;
140-
}
141129
}
142130

143131
fieldRegistry.register('field_label', FieldLabel);

core/field_number.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,6 @@ export class FieldNumber extends FieldInput<number> {
341341
options,
342342
);
343343
}
344-
345-
/**
346-
* Returns this field's class.
347-
*
348-
* Used by keyboard navigation to look up the rules for navigating from this
349-
* field.
350-
*
351-
* @returns This field's class.
352-
*/
353-
getClass() {
354-
return FieldNumber;
355-
}
356344
}
357345

358346
fieldRegistry.register('field_number', FieldNumber);

core/field_textinput.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,6 @@ export class FieldTextInput extends FieldInput<string> {
8989
// override the static fromJson method.
9090
return new this(text, undefined, options);
9191
}
92-
93-
/**
94-
* Returns this field's class.
95-
*
96-
* Used by keyboard navigation to look up the rules for navigating from this
97-
* field.
98-
*
99-
* @returns This field's class.
100-
*/
101-
getClass() {
102-
return FieldTextInput;
103-
}
10492
}
10593

10694
fieldRegistry.register('field_input', FieldTextInput);

core/flyout_base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {EventType} from './events/type.js';
2020
import * as eventUtils from './events/utils.js';
2121
import {FlyoutItem} from './flyout_item.js';
2222
import {FlyoutMetricsManager} from './flyout_metrics_manager.js';
23+
import {FlyoutNavigator} from './flyout_navigator.js';
2324
import {FlyoutSeparator, SeparatorAxis} from './flyout_separator.js';
2425
import {getFocusManager} from './focus_manager.js';
2526
import {IAutoHideable} from './interfaces/i_autohideable.js';
@@ -243,6 +244,7 @@ export abstract class Flyout
243244
this.workspace_.internalIsFlyout = true;
244245
// Keep the workspace visibility consistent with the flyout's visibility.
245246
this.workspace_.setVisible(this.visible);
247+
this.workspace_.setNavigator(new FlyoutNavigator(this));
246248

247249
/**
248250
* The unique id for this component that is used to register with the

0 commit comments

Comments
 (0)