@rpcbase/client 0.401.0 → 0.402.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,310 @@
1
+ import { default as WritingDirection } from './WritingDirection';
2
+ export type Direction = "up" | "down" | "left" | "right";
3
+ type DistanceCalculationMethod = "center" | "edges" | "corners";
4
+ type DistanceCalculationFunction = (refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean, distanceCalculationMethod: DistanceCalculationMethod) => number;
5
+ export declare const ROOT_FOCUS_KEY = "SN:ROOT";
6
+ export interface FocusableComponentLayout {
7
+ left: number;
8
+ top: number;
9
+ readonly right: number;
10
+ readonly bottom: number;
11
+ width: number;
12
+ height: number;
13
+ x: number;
14
+ y: number;
15
+ node: HTMLElement | null;
16
+ }
17
+ interface FocusableComponentConfig {
18
+ focusKey: string;
19
+ node: HTMLElement | null;
20
+ parentFocusKey: string | undefined;
21
+ onEnterPress: (details?: KeyPressDetails) => void;
22
+ onEnterRelease: () => void;
23
+ onArrowPress: (direction: string, details: KeyPressDetails) => boolean;
24
+ onArrowRelease: (direction: string) => void;
25
+ onFocus: (layout: FocusableComponentLayout, details: FocusDetails) => void;
26
+ onBlur: (layout: FocusableComponentLayout, details: FocusDetails) => void;
27
+ onUpdateFocus: (focused: boolean) => void;
28
+ onUpdateHasFocusedChild: (hasFocusedChild: boolean) => void;
29
+ saveLastFocusedChild: boolean;
30
+ trackChildren: boolean;
31
+ preferredChildFocusKey?: string;
32
+ focusable: boolean;
33
+ isFocusBoundary: boolean;
34
+ focusBoundaryDirections?: Direction[];
35
+ autoRestoreFocus: boolean;
36
+ forceFocus: boolean;
37
+ }
38
+ interface FocusableComponent extends FocusableComponentConfig {
39
+ lastFocusedChildKey: string | null;
40
+ layout: FocusableComponentLayout;
41
+ layoutUpdated: boolean;
42
+ }
43
+ interface FocusableComponentUpdatePayload {
44
+ node: HTMLElement | null;
45
+ parentFocusKey: string | undefined;
46
+ preferredChildFocusKey?: string;
47
+ saveLastFocusedChild: boolean;
48
+ trackChildren: boolean;
49
+ focusable: boolean;
50
+ isFocusBoundary: boolean;
51
+ focusBoundaryDirections?: Direction[];
52
+ autoRestoreFocus: boolean;
53
+ forceFocus: boolean;
54
+ onEnterPress: (details?: KeyPressDetails) => void;
55
+ onEnterRelease: () => void;
56
+ onArrowPress: (direction: string, details: KeyPressDetails) => boolean;
57
+ onArrowRelease: (direction: string) => void;
58
+ onFocus: (layout: FocusableComponentLayout, details: FocusDetails) => void;
59
+ onBlur: (layout: FocusableComponentLayout, details: FocusDetails) => void;
60
+ }
61
+ interface FocusableComponentRemovePayload {
62
+ focusKey: string;
63
+ skipFocusRestoration?: boolean;
64
+ }
65
+ interface CornerCoordinates {
66
+ x: number;
67
+ y: number;
68
+ }
69
+ interface Corners {
70
+ a: CornerCoordinates;
71
+ b: CornerCoordinates;
72
+ }
73
+ export type PressedKeys = {
74
+ [index: string]: number;
75
+ };
76
+ /**
77
+ * Extra details about pressed keys passed on the key events
78
+ */
79
+ export interface KeyPressDetails {
80
+ pressedKeys: PressedKeys;
81
+ }
82
+ /**
83
+ * Extra details passed from outside to be bounced back on other callbacks
84
+ */
85
+ export interface FocusDetails {
86
+ event?: Event;
87
+ nativeEvent?: Event;
88
+ [key: string]: unknown;
89
+ }
90
+ export type BackwardsCompatibleKeyMap = {
91
+ [index: string]: string | number | (number | string)[];
92
+ };
93
+ export type KeyMap = {
94
+ [index: string]: (string | number)[];
95
+ };
96
+ export interface InitOptions {
97
+ debug?: boolean;
98
+ visualDebug?: boolean;
99
+ nativeMode?: boolean;
100
+ throttle?: number;
101
+ throttleKeypresses?: boolean;
102
+ useGetBoundingClientRect?: boolean;
103
+ shouldFocusDOMNode?: boolean;
104
+ /**
105
+ * Preferred alias for shouldFocusDOMNode. Enabled by default for browser-native focus support.
106
+ */
107
+ nativeFocus?: boolean;
108
+ domNodeFocusOptions?: FocusOptions;
109
+ shouldUseNativeEvents?: boolean;
110
+ rtl?: boolean;
111
+ distanceCalculationMethod?: DistanceCalculationMethod;
112
+ customDistanceCalculationFunction?: DistanceCalculationFunction;
113
+ /**
114
+ * Keep focus state in sync when browser focus changes through Tab/click/programmatic focus.
115
+ */
116
+ trackNativeFocus?: boolean;
117
+ /**
118
+ * When enabled, keyboard navigation is not intercepted while a form control owns focus.
119
+ */
120
+ blockNavigationOutOfFormFields?: boolean;
121
+ }
122
+ declare class SpatialNavigationService {
123
+ private focusableComponents;
124
+ private visualDebugger;
125
+ private visualDebugAnimationFrame;
126
+ private visualDebugEnabled;
127
+ /**
128
+ * Focus key of the currently focused element
129
+ */
130
+ private focusKey;
131
+ private shouldFocusDOMNode;
132
+ private shouldUseNativeEvents;
133
+ private trackNativeFocus;
134
+ private blockNavigationOutOfFormFields;
135
+ /**
136
+ * This collection contains focus keys of the elements that are having a child focused
137
+ * Might be handy for styling of certain parent components if their child is focused.
138
+ */
139
+ private parentsHavingFocusedChild;
140
+ /**
141
+ * When shouldFocusDOMNode is true, this prop specifies the focus options that should be passed to the element being focused.
142
+ */
143
+ private domNodeFocusOptions;
144
+ private enabled;
145
+ /**
146
+ * Used in the React Native environment
147
+ * In this mode, the library works as a "read-only" helper to sync focused
148
+ * states for the components when they are focused by the native focus engine
149
+ */
150
+ private nativeMode;
151
+ /**
152
+ * Throttling delay for key presses in milliseconds
153
+ */
154
+ private throttle;
155
+ /**
156
+ * Enables/disables throttling feature
157
+ */
158
+ private throttleKeypresses;
159
+ /**
160
+ * Storing pressed keys counter by the eventType
161
+ */
162
+ private pressedKeys;
163
+ /**
164
+ * Flag used to block key events from this service
165
+ */
166
+ private paused;
167
+ /**
168
+ * Enables/disables getBoundingClientRect
169
+ */
170
+ private useGetBoundingClientRect;
171
+ private keyDownEventListener;
172
+ private keyDownEventListenerThrottled;
173
+ private keyUpEventListener;
174
+ private focusInEventListener;
175
+ private keyMap;
176
+ private debug;
177
+ private logIndex;
178
+ private setFocusDebounced;
179
+ private writingDirection;
180
+ private distanceCalculationMethod;
181
+ private customDistanceCalculationFunction?;
182
+ /**
183
+ * Used to determine the coordinate that will be used to filter items that are over the "edge"
184
+ */
185
+ static getCutoffCoordinate(isVertical: boolean, isIncremental: boolean, isSibling: boolean, layout: FocusableComponentLayout, writingDirection: WritingDirection): number;
186
+ /**
187
+ * Returns two corners (a and b) coordinates that are used as a reference points
188
+ * Where "a" is always leftmost and topmost corner, and "b" is rightmost bottommost corner
189
+ */
190
+ static getRefCorners(direction: string, isSibling: boolean, layout: FocusableComponentLayout): {
191
+ a: {
192
+ x: number;
193
+ y: number;
194
+ };
195
+ b: {
196
+ x: number;
197
+ y: number;
198
+ };
199
+ };
200
+ /**
201
+ * Calculates if the sibling node is intersecting enough with the ref node by the secondary coordinate
202
+ */
203
+ static getAdjacentSliceMetrics(refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean): {
204
+ refLength: number;
205
+ siblingLength: number;
206
+ intersectionLength: number;
207
+ };
208
+ static isAdjacentSlice(refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean): boolean;
209
+ static getAdjacentSliceWeight(refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean): number;
210
+ static getPrimaryAxisDistance(refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean): number;
211
+ static getSecondaryAxisDistance(refCorners: Corners, siblingCorners: Corners, isVerticalDirection: boolean, distanceCalculationMethod: DistanceCalculationMethod, customDistanceCalculationFunction?: DistanceCalculationFunction): number;
212
+ /**
213
+ * Inspired by: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS_for_TV/TV_remote_control_navigation#Algorithm_design
214
+ * Ref Corners are the 2 corners of the current component in the direction of navigation
215
+ * They are used as a base to measure adjacent slices
216
+ */
217
+ sortSiblingsByPriority(siblings: FocusableComponent[], currentLayout: FocusableComponentLayout, direction: string, focusKey: string): FocusableComponent[];
218
+ constructor();
219
+ init({ debug, visualDebug, nativeMode, throttle: throttleParam, throttleKeypresses, useGetBoundingClientRect, shouldFocusDOMNode, nativeFocus, domNodeFocusOptions, shouldUseNativeEvents, trackNativeFocus, blockNavigationOutOfFormFields, rtl, distanceCalculationMethod, customDistanceCalculationFunction }?: InitOptions): void;
220
+ private startVisualDebugLoop;
221
+ private stopVisualDebugLoop;
222
+ setVisualDebug(visualDebug: boolean): void;
223
+ setThrottle({ throttle: throttleParam, throttleKeypresses }?: {
224
+ throttle?: number | undefined;
225
+ throttleKeypresses?: boolean | undefined;
226
+ }): void;
227
+ destroy(): void;
228
+ getEventType(keyCode: number | string): string | undefined;
229
+ static getKeyCode(event: KeyboardEvent): string | number;
230
+ static isDirectionalEventType(eventType: string): eventType is "right" | "left" | "up" | "down";
231
+ shouldBypassSpatialNavigationForTarget(target: EventTarget | null, eventType: string): boolean;
232
+ makeNodeProgrammaticallyFocusable(component: FocusableComponent): void;
233
+ getLayoutReferenceNode(node: HTMLElement | null): HTMLElement | null;
234
+ findNativeFocusedComponent(target: EventTarget | null): FocusableComponent | null | undefined;
235
+ syncNativeFocus(event: FocusEvent): void;
236
+ bindEventHandlers(): void;
237
+ unbindEventHandlers(): void;
238
+ onEnterPress(keysDetails: KeyPressDetails): void;
239
+ onEnterRelease(): void;
240
+ onArrowPress(direction: string, keysDetails: KeyPressDetails): boolean | undefined;
241
+ onArrowRelease(direction: string): void;
242
+ /**
243
+ * Move focus by direction, if you can't use buttons or focusing by key.
244
+ *
245
+ * @example
246
+ * navigateByDirection('right') // The focus is moved to right
247
+ */
248
+ navigateByDirection(direction: string, focusDetails: FocusDetails): void;
249
+ /**
250
+ * This function navigates between siblings OR goes up by the Tree
251
+ * Based on the Direction
252
+ */
253
+ smartNavigate(direction: string, fromParentFocusKey: string | null, focusDetails: FocusDetails): void;
254
+ saveLastFocusedChildKey(component: FocusableComponent, focusKey: string): void;
255
+ log(functionName: string, debugString: string, ...rest: unknown[]): void;
256
+ /**
257
+ * Returns the current focus key
258
+ */
259
+ getCurrentFocusKey(): string;
260
+ /**
261
+ * Returns the focus key to which focus can be forced if there are force-focusable components.
262
+ * A component closest to the top left viewport corner (0,0) is returned.
263
+ */
264
+ getForcedFocusKey(): string | undefined;
265
+ /**
266
+ * This function tries to determine the next component to Focus
267
+ * It's either the target node OR the one down by the Tree if node has children components
268
+ * Based on "targetFocusKey" which means the "intended component to focus"
269
+ */
270
+ getNextFocusKey(targetFocusKey: string): string;
271
+ addFocusable({ focusKey, node, parentFocusKey, onEnterPress, onEnterRelease, onArrowPress, onArrowRelease, onFocus, onBlur, saveLastFocusedChild, trackChildren, onUpdateFocus, onUpdateHasFocusedChild, preferredChildFocusKey, autoRestoreFocus, forceFocus, focusable, isFocusBoundary, focusBoundaryDirections }: FocusableComponentConfig): void;
272
+ removeFocusable({ focusKey, skipFocusRestoration }: FocusableComponentRemovePayload): void;
273
+ getNodeLayoutByFocusKey(focusKey: string): FocusableComponentLayout | null;
274
+ setCurrentFocusedKey(newFocusKey: string, focusDetails: FocusDetails): void;
275
+ updateParentsHasFocusedChild(focusKey: string, focusDetails: FocusDetails): void;
276
+ updateParentsLastFocusedChild(focusKey: string): void;
277
+ getKeyMap(): KeyMap;
278
+ setKeyMap(keyMap: BackwardsCompatibleKeyMap): void;
279
+ isFocusableComponent(focusKey: string): boolean;
280
+ /**
281
+ * Checks whether the focusableComponent is actually participating in spatial navigation (in other words, is a
282
+ * 'focusable' focusableComponent). Seems less confusing than calling it isFocusableFocusableComponent()
283
+ */
284
+ isParticipatingFocusableComponent(focusKey: string): boolean;
285
+ onIntermediateNodeBecameFocused(focusKey: string, focusDetails: FocusDetails): void;
286
+ onIntermediateNodeBecameBlurred(focusKey: string, focusDetails: FocusDetails): void;
287
+ pause(): void;
288
+ resume(): void;
289
+ setFocus(focusKey: string, focusDetails?: FocusDetails): void;
290
+ updateAllLayouts(): void;
291
+ updateLayout(focusKey: string): void;
292
+ updateFocusable(focusKey: string, { node, parentFocusKey, preferredChildFocusKey, saveLastFocusedChild, trackChildren, focusable, isFocusBoundary, focusBoundaryDirections, autoRestoreFocus, forceFocus, onEnterPress, onEnterRelease, onArrowPress, onArrowRelease, onFocus, onBlur }: FocusableComponentUpdatePayload): void;
293
+ isNativeMode(): boolean;
294
+ doesFocusableExist(focusKey: string): boolean;
295
+ /**
296
+ * This function updates the writing direction
297
+ * @param rtl whether the writing direction is right-to-left
298
+ */
299
+ updateRtl(rtl: boolean): void;
300
+ }
301
+ /**
302
+ * Export singleton
303
+ */
304
+ export declare const SpatialNavigation: SpatialNavigationService;
305
+ export declare const init: ({ debug, visualDebug, nativeMode, throttle: throttleParam, throttleKeypresses, useGetBoundingClientRect, shouldFocusDOMNode, nativeFocus, domNodeFocusOptions, shouldUseNativeEvents, trackNativeFocus, blockNavigationOutOfFormFields, rtl, distanceCalculationMethod, customDistanceCalculationFunction }?: InitOptions) => void, setThrottle: ({ throttle: throttleParam, throttleKeypresses }?: {
306
+ throttle?: number | undefined;
307
+ throttleKeypresses?: boolean | undefined;
308
+ }) => void, setVisualDebug: (visualDebug: boolean) => void, destroy: () => void, setKeyMap: (keyMap: BackwardsCompatibleKeyMap) => void, setFocus: (focusKey: string, focusDetails?: FocusDetails) => void, navigateByDirection: (direction: string, focusDetails: FocusDetails) => void, pause: () => void, resume: () => void, updateAllLayouts: () => void, getCurrentFocusKey: () => string, doesFocusableExist: (focusKey: string) => boolean, updateRtl: (rtl: boolean) => void;
309
+ export {};
310
+ //# sourceMappingURL=SpatialNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpatialNavigation.d.ts","sourceRoot":"","sources":["../../src/spatial-nav/SpatialNavigation.ts"],"names":[],"mappings":"AAYA,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAUjD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD,KAAK,yBAAyB,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,KAAK,2BAA2B,GAAG,CACjC,UAAU,EAAE,OAAO,EACnB,cAAc,EAAE,OAAO,EAC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,EACpB,aAAa,EACb,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,cAAc,EACd,OAAO,EACP,MAAM,EACP,EAAE,+BAA+B;IAmEpC,YAAY;IAIZ,kBAAkB,CAAC,QAAQ,EAAE,MAAM;IAInC;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,OAAO;CAGvB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAAiC,CAAA;AAE/D,eAAO,MACL,IAAI,iTA38CD,WAAW,WA48Cd,WAAW;;;YACX,cAAc,gBA72Cc,OAAO,WA82CnC,OAAO,cACP,SAAS,WAzOS,yBAAyB,WA0O3C,QAAQ,aAlLW,MAAM,iBAAgB,YAAY,WAmLrD,mBAAmB,cA57BY,MAAM,gBAAgB,YAAY,WA67BjE,KAAK,cACL,MAAM,cACN,gBAAgB,cAChB,kBAAkB,QA/qBI,MAAM,EAgrB5B,kBAAkB,aA9BW,MAAM,cA+BnC,SAAS,QAvBM,OAAO,SAwBH,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { default as WritingDirection } from './WritingDirection';
2
+ interface NodeLayout {
3
+ left: number;
4
+ top: number;
5
+ readonly right: number;
6
+ readonly bottom: number;
7
+ width: number;
8
+ height: number;
9
+ }
10
+ declare class VisualDebugger {
11
+ private debugCtx;
12
+ private layoutsCtx;
13
+ private writingDirection;
14
+ private useViewportCoordinates;
15
+ constructor(writingDirection: WritingDirection, useViewportCoordinates?: boolean);
16
+ static getViewportSize(): {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ static getPixelRatio(): number;
21
+ static configureCanvas(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D): void;
22
+ syncCanvasSizes(): void;
23
+ getViewportOffset(): {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ static createCanvas(id: string, zIndex: string, writingDirection: WritingDirection): CanvasRenderingContext2D | null;
28
+ clear(): void;
29
+ clearLayouts(): void;
30
+ drawLayout(layout: NodeLayout, focusKey: string, parentFocusKey?: string): void;
31
+ drawPoint(x: number, y: number, color?: string, size?: number): void;
32
+ }
33
+ export default VisualDebugger;
34
+ //# sourceMappingURL=VisualDebugger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisualDebugger.d.ts","sourceRoot":"","sources":["../../src/spatial-nav/VisualDebugger.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAOjD,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,cAAc;IAClB,OAAO,CAAC,QAAQ,CAAiC;IAEjD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO,CAAC,gBAAgB,CAAkB;IAE1C,OAAO,CAAC,sBAAsB,CAAS;gBAGrC,gBAAgB,EAAE,gBAAgB,EAClC,sBAAsB,UAAQ;IAuBhC,MAAM,CAAC,eAAe;;;;IAOtB,MAAM,CAAC,aAAa;IAKpB,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,wBAAwB;IAsB/B,eAAe;IASf,iBAAiB;;;;IAWjB,MAAM,CAAC,YAAY,CACjB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB;IA+BpC,KAAK;IAUL,YAAY;IAUZ,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IA0CxE,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,IAAI,SAAK;CAmB1D;AAED,eAAe,cAAc,CAAA"}
@@ -0,0 +1,6 @@
1
+ declare enum WritingDirection {
2
+ LTR = 0,
3
+ RTL = 1
4
+ }
5
+ export default WritingDirection;
6
+ //# sourceMappingURL=WritingDirection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WritingDirection.d.ts","sourceRoot":"","sources":["../../src/spatial-nav/WritingDirection.ts"],"names":[],"mappings":"AAAA,aAAK,gBAAgB;IACnB,GAAG,IAAA;IACH,GAAG,IAAA;CACJ;AAED,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './useFocusable';
2
+ export * from './useFocusContext';
3
+ export * from './SpatialNavigation';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spatial-nav/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}