@ngutil/aria 0.0.101 → 0.0.104

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/index.d.ts CHANGED
@@ -1,5 +1,436 @@
1
- export { ActivityEvent, ActivityOrigin, ActivityService } from "./activity";
2
- export { Keystroke, KeystrokeEvent, KeystrokeService } from "./keystroke";
3
- export * from "./focus";
4
- export * from "./gestures";
5
- export * from "./ui-state";
1
+ import * as rxjs from 'rxjs';
2
+ import { Observable, Subject } from 'rxjs';
3
+ import * as i0 from '@angular/core';
4
+ import { Signal } from '@angular/core';
5
+ import { ElementInput, Destructible, ConnectProtocol, DeepReadonly } from '@ngutil/common';
6
+ import * as _angular_cdk_a11y_module_d from '@angular/cdk/a11y-module.d';
7
+ import { FocusableElement } from 'tabbable';
8
+ import * as utility_types from 'utility-types';
9
+ import { FunctionKeys, Mutable } from 'utility-types';
10
+ import { Position } from '@ngutil/style';
11
+
12
+ type ActivityOrigin = "mouse" | "keyboard" | "touch" | "program";
13
+ interface ActivityEvent {
14
+ origin: ActivityOrigin;
15
+ type: keyof typeof EVENT_ORIGIN;
16
+ node?: Node;
17
+ }
18
+ declare const EVENT_ORIGIN: {
19
+ keydown: string;
20
+ mousedown: string;
21
+ mousemove: string;
22
+ touchstart: string;
23
+ };
24
+ declare class ActivityService {
25
+ #private;
26
+ readonly events$: Observable<ActivityEvent>;
27
+ watchActivity(node?: HTMLElement): Observable<ActivityEvent>;
28
+ watchInactvity(timeout: number): Observable<boolean>;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<ActivityService, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<ActivityService>;
31
+ }
32
+
33
+ type FocusOrigin = ActivityOrigin | null;
34
+ interface FocusOriginEvent {
35
+ element: Node;
36
+ origin: FocusOrigin;
37
+ }
38
+ declare class FocusService {
39
+ #private;
40
+ readonly events: Observable<FocusOriginEvent>;
41
+ watch(element: ElementInput): Observable<FocusOriginEvent>;
42
+ focus(node: ElementInput, origin?: ActivityOrigin): void;
43
+ queryFocusable(inside: ElementInput): FocusableElement[];
44
+ getFirstFocusable(inside: ElementInput): FocusableElement | undefined;
45
+ isFocusable(node: ElementInput): boolean;
46
+ focusTrap(inside: ElementInput, deferCaptureElements?: boolean): _angular_cdk_a11y_module_d.FocusTrap;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<FocusService, never>;
48
+ static ɵprov: i0.ɵɵInjectableDeclaration<FocusService>;
49
+ }
50
+
51
+ declare class FocusTrap extends Destructible {
52
+ #private;
53
+ get enabled(): boolean;
54
+ set enabled(val: boolean);
55
+ enable(): void;
56
+ disable(): void;
57
+ }
58
+
59
+ declare class FocusState implements ConnectProtocol {
60
+ #private;
61
+ readonly event$: Observable<FocusOriginEvent>;
62
+ readonly event: i0.Signal<FocusOriginEvent | undefined>;
63
+ readonly self: i0.Signal<FocusOrigin>;
64
+ readonly within: i0.Signal<FocusOrigin>;
65
+ readonly has: i0.Signal<FocusOrigin>;
66
+ constructor();
67
+ connect(value: FocusState | ElementInput): Observable<unknown>;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<FocusState, never>;
69
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FocusState, never, never, {}, {}, never, never, true, never>;
70
+ }
71
+
72
+ declare class Focusable implements ConnectProtocol {
73
+ readonly state: FocusState;
74
+ readonly focusable: i0.InputSignal<number | boolean>;
75
+ readonly tabindex: i0.InputSignalWithTransform<number, any>;
76
+ readonly _tabindex: i0.Signal<number>;
77
+ connect(value: Focusable | FocusState | ElementInput): rxjs.Observable<unknown>;
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<Focusable, never>;
79
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Focusable, "[nuFocusable]", ["nuFocusable"], { "focusable": { "alias": "nuFocusable"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof FocusState; inputs: {}; outputs: {}; }]>;
80
+ }
81
+
82
+ interface Keystroke {
83
+ key: KeyboardEvent["key"];
84
+ shift?: boolean;
85
+ ctrl?: boolean;
86
+ alt?: boolean;
87
+ state: "down" | "up";
88
+ }
89
+ interface KeystrokeEvent {
90
+ original: KeyboardEvent;
91
+ keystroke: Keystroke;
92
+ }
93
+ type KeystrokeActivation = ElementInput | FocusState | Observable<ElementInput | FocusState | boolean>;
94
+ declare class KeystrokeService {
95
+ #private;
96
+ watch(activation: KeystrokeActivation, ...keystrokes: Keystroke[]): Observable<KeystrokeEvent>;
97
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeystrokeService, never>;
98
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeystrokeService>;
99
+ }
100
+
101
+ interface GestureDetail {
102
+ readonly origin: GestureOrigin;
103
+ readonly target: HTMLElement;
104
+ readonly pointerType: GesturePointerType;
105
+ readonly phase: GesturePhase;
106
+ readonly pointers: ReadonlyArray<GesturePointer>;
107
+ readonly timeStamp: number;
108
+ readonly elapsed: number;
109
+ readonly scrollDistance?: Position;
110
+ }
111
+ type PointersPosition = ReadonlyArray<Readonly<Position>>;
112
+ interface GesturePointer {
113
+ readonly start: Position;
114
+ readonly current: Position;
115
+ readonly end?: Position;
116
+ readonly distance: Position;
117
+ readonly direction: {
118
+ x: -1 | 0 | 1;
119
+ y: -1 | 0 | 1;
120
+ };
121
+ }
122
+ type GestureOrigin = MouseEvent | TouchEvent;
123
+ declare enum GesturePointerType {
124
+ Mouse = "mouse",
125
+ Touch = "touch"
126
+ }
127
+ declare enum GesturePhase {
128
+ Start = "start",
129
+ Moving = "moving",
130
+ End = "end"
131
+ }
132
+ interface GestureListenerConfig {
133
+ options?: AddEventListenerOptions;
134
+ pointerType: GesturePointerType;
135
+ phase: GesturePhase;
136
+ }
137
+ declare const Listeners: {
138
+ [key: string]: GestureListenerConfig;
139
+ };
140
+
141
+ declare enum GestureCaptureState {
142
+ Unchecked = 0,
143
+ Pending = 1,
144
+ Skip = 2,
145
+ Maybe = 3,
146
+ Instant = 4
147
+ }
148
+ type _GestureOptions = Partial<Omit<Gesture<any>, "originTypes" | "type" | FunctionKeys<Gesture<any>>>>;
149
+ type GestureOptions<T extends object> = Partial<Omit<T, keyof Gesture<any> | FunctionKeys<T>>> & _GestureOptions;
150
+ type GestureEvent<G extends Gesture> = G extends Gesture<infer E> & {
151
+ type: infer T;
152
+ } ? CustomEvent<E> & {
153
+ type: T;
154
+ } : never;
155
+ declare abstract class Gesture<T extends GestureDetail = GestureDetail> {
156
+ /**
157
+ * The name of the gesture
158
+ */
159
+ abstract readonly type: string;
160
+ /**
161
+ * Gestures that depends on move distance, like drag, use this option
162
+ */
163
+ readonly distanceInclusion: number;
164
+ /**
165
+ * Gestures thet dependnso on time frame, like longtap, use this option
166
+ */
167
+ readonly timeWithin: number;
168
+ /**
169
+ * The priority of the gesture
170
+ */
171
+ readonly priority: number;
172
+ /**
173
+ * Should the gesture include the scroll distance
174
+ */
175
+ readonly includeScrollDistance: boolean;
176
+ /**
177
+ * The pointer types of the gesture
178
+ */
179
+ readonly pointerTypes: Array<GesturePointerType>;
180
+ /**
181
+ * The number of pointers of the gesture can handle
182
+ */
183
+ readonly pointerCount: number;
184
+ /**
185
+ * The mouse buttons of the gesture (1 = left, 2 = middle, 3 = right)
186
+ */
187
+ readonly mouseButtons: Array<number>;
188
+ /**
189
+ * The event types of the gesture can handle
190
+ */
191
+ readonly originTypes: Array<string>;
192
+ constructor(options?: _GestureOptions);
193
+ /**
194
+ * Test if the gesture should be captured.
195
+ * The given events is filterde by {@see Gesture#shouldCapture}
196
+ * ! important, dont rely on this object state, because not always create a new object
197
+ * @param events events to check
198
+ */
199
+ abstract capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
200
+ /**
201
+ * Transform input event, to gesture event.
202
+ * The given events is filterde by {@see Gesture#isRelevantEvent}
203
+ * ! important, dont rely on this object state, because not always create a new object
204
+ * @param events events to transform or filter or leave as is
205
+ */
206
+ handle(events: Observable<GestureDetail>): Observable<Mutable<T>>;
207
+ /**
208
+ * Should this gesture capture the event?
209
+ * @param event event to check
210
+ * @returns true if the gesture should capture the event, false otherwise
211
+ */
212
+ shouldCapture(event: GestureDetail): boolean;
213
+ /**
214
+ * Test if the event is relevant to the gesture.
215
+ * The event is relevant if
216
+ * @param event event to check
217
+ * @returns true if the event is relevant, false otherwise
218
+ */
219
+ isRelevantEvent(event: GestureDetail): boolean;
220
+ }
221
+
222
+ interface GestureDragDetail extends GestureDetail {
223
+ moveBy: Position;
224
+ }
225
+ type GestureDragOptions = GestureOptions<GestureDragImpl>;
226
+ declare class GestureDragImpl<T extends GestureDragDetail = GestureDragDetail> extends Gesture<T> {
227
+ readonly type = "gesture-drag";
228
+ readonly horizontal?: boolean;
229
+ readonly vertical?: boolean;
230
+ constructor(options?: GestureDragOptions);
231
+ capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
232
+ handle(events: Observable<GestureDetail>): Observable<Mutable<T>>;
233
+ }
234
+ declare function gestureDrag(options?: GestureDragOptions): GestureDragImpl<GestureDragDetail>;
235
+ declare const GestureDrag: GestureDragImpl<GestureDragDetail>;
236
+ declare const GestureDragHorizontal: GestureDragImpl<GestureDragDetail>;
237
+ declare const GestureDragVertical: GestureDragImpl<GestureDragDetail>;
238
+
239
+ type GestureLongTapDetail = GestureDetail;
240
+ type GestureLongTapOptions = GestureOptions<GestureLongTapImpl>;
241
+ declare class GestureLongTapImpl<T extends GestureLongTapDetail = GestureLongTapDetail> extends Gesture<T> {
242
+ readonly type = "gesture-longtap";
243
+ constructor(options?: GestureLongTapOptions);
244
+ capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
245
+ handle(events: Observable<GestureDetail>): Observable<utility_types.Mutable<T>>;
246
+ }
247
+ declare function gestureLongTap(options?: GestureLongTapOptions): GestureLongTapImpl<GestureDetail>;
248
+ declare const GestureLongTap: GestureLongTapImpl<GestureDetail>;
249
+
250
+ type GestureTapDetail = GestureDetail;
251
+ type GestureTapOptions = GestureOptions<GestureTapImpl>;
252
+ declare class GestureTapImpl<T extends GestureTapDetail = GestureTapDetail> extends Gesture<T> {
253
+ readonly type = "gesture-tap";
254
+ capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
255
+ handle(events: Observable<GestureDetail>): Observable<utility_types.Mutable<T>>;
256
+ }
257
+ declare function gestureTap(options?: GestureTapOptions): GestureTapImpl<GestureDetail>;
258
+ declare const GestureTap: GestureTapImpl<GestureDetail>;
259
+
260
+ type GesturesToEventsType<T extends Array<Gesture>> = T extends Array<infer G> ? (G extends Gesture ? GestureEvent<G> : never) : never;
261
+ type GestureEventDiscriminator<T> = T extends {
262
+ type: infer N;
263
+ } ? {
264
+ type: N;
265
+ } & T : never;
266
+ type GestureWatchReturns<T extends Array<Gesture>> = Observable<GestureEventDiscriminator<GesturesToEventsType<T>>>;
267
+ type GestureListenReturns<T extends Array<Gesture>> = Observable<GesturesToEventsType<T>>;
268
+ declare class GestureService {
269
+ #private;
270
+ constructor();
271
+ listen<T extends Array<Gesture>>(el: ElementInput, ...gestures: T): GestureListenReturns<T>;
272
+ static ɵfac: i0.ɵɵFactoryDeclaration<GestureService, never>;
273
+ static ɵprov: i0.ɵɵInjectableDeclaration<GestureService>;
274
+ }
275
+ declare function reduceCaptureStates(states: GestureCaptureState[]): GestureCaptureState;
276
+
277
+ /**
278
+ * {
279
+ * busy: {
280
+ * self: true,
281
+ * parent: false,
282
+ * disabled: false
283
+ * }
284
+ * }
285
+ */
286
+ type UiStateDetails = {
287
+ readonly [key: string]: UiStateEntry;
288
+ };
289
+ type UiStateEntry = {
290
+ readonly [key: UiStateSource]: boolean;
291
+ };
292
+ type UiStateValue = {
293
+ readonly [key: string]: boolean;
294
+ };
295
+ type UiStateSource = "parent" | "self" | string;
296
+ type UiStateSelector = string;
297
+ declare class UiState<N extends string = string, S extends UiStateSource = UiStateSource> {
298
+ #private;
299
+ get root(): UiState;
300
+ readonly merged: i0.Signal<UiStateDetails>;
301
+ readonly value: i0.Signal<UiStateValue>;
302
+ readonly inertSelector: i0.WritableSignal<string>;
303
+ set(name: N, value: boolean, source?: S): void;
304
+ is(selector?: UiStateSelector): boolean;
305
+ intercept(name: N, source: S): <S_1>(src: Observable<S_1>) => Observable<S_1>;
306
+ wrap<T>(observable: Observable<T>, name: N, source: S): Observable<T>;
307
+ isInert(): boolean;
308
+ static ɵfac: i0.ɵɵFactoryDeclaration<UiState<any, any>, never>;
309
+ static ɵdir: i0.ɵɵDirectiveDeclaration<UiState<any, any>, never, never, {}, {}, never, never, true, never>;
310
+ }
311
+
312
+ declare const NOTSET: any;
313
+ declare abstract class AbstractUiState<N extends string> {
314
+ readonly name: N;
315
+ readonly state: UiState<N>;
316
+ abstract readonly input: Signal<boolean>;
317
+ abstract readonly when: Signal<string>;
318
+ readonly yes: Signal<boolean>;
319
+ readonly no: Signal<boolean>;
320
+ constructor(name: N);
321
+ set(value: boolean, source: string): void;
322
+ intercept(source: string): <S>(src: Observable<S>) => Observable<S>;
323
+ wrap<T>(observable: Observable<T>, source: string): Observable<T>;
324
+ static ɵfac: i0.ɵɵFactoryDeclaration<AbstractUiState<any>, never>;
325
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractUiState<any>, never, never, {}, {}, never, never, true, never>;
326
+ }
327
+
328
+ declare class BusyDirective extends AbstractUiState<"busy"> {
329
+ readonly input: i0.InputSignal<boolean>;
330
+ readonly when: i0.InputSignal<string>;
331
+ constructor();
332
+ static ɵfac: i0.ɵɵFactoryDeclaration<BusyDirective, never>;
333
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BusyDirective, "[nuBusy], [nuBusyWhen]", ["busy"], { "input": { "alias": "nuBusy"; "required": false; "isSignal": true; }; "when": { "alias": "nuBusyWhen"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
334
+ }
335
+
336
+ declare class DirtyDirective extends AbstractUiState<"dirty"> {
337
+ readonly input: i0.InputSignal<boolean>;
338
+ readonly when: i0.InputSignal<string>;
339
+ constructor();
340
+ static ɵfac: i0.ɵɵFactoryDeclaration<DirtyDirective, never>;
341
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DirtyDirective, "[nuDirty], [nuDirtyWhen]", ["dirty"], { "input": { "alias": "nuDirty"; "required": false; "isSignal": true; }; "when": { "alias": "nuDirtyWhen"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
342
+ }
343
+
344
+ declare class DisabledDirective extends AbstractUiState<"disabled"> {
345
+ readonly input: i0.InputSignal<boolean>;
346
+ readonly when: i0.InputSignal<string>;
347
+ constructor();
348
+ static ɵfac: i0.ɵɵFactoryDeclaration<DisabledDirective, never>;
349
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DisabledDirective, "[nuDisabled], [nuDisabledWhen]", ["disabled"], { "input": { "alias": "nuDisabled"; "required": false; "isSignal": true; }; "when": { "alias": "nuDisabledWhen"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
350
+ }
351
+
352
+ declare class ReadonlyDirective extends AbstractUiState<"readonly"> {
353
+ readonly input: i0.InputSignal<boolean>;
354
+ readonly when: i0.InputSignal<string>;
355
+ constructor();
356
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReadonlyDirective, never>;
357
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ReadonlyDirective, "[nuReadonly], [nuReadonlyWhen]", ["readonly"], { "input": { "alias": "nuReadonly"; "required": false; "isSignal": true; }; "when": { "alias": "nuReadonlyWhen"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
358
+ }
359
+
360
+ interface ProgressCommon {
361
+ readonly message?: string;
362
+ readonly [other: string]: unknown;
363
+ }
364
+ interface ProgressLax {
365
+ readonly type: "lax";
366
+ readonly predictedTime: number;
367
+ }
368
+ interface ProgressFix {
369
+ readonly type: "fix";
370
+ readonly percent: number;
371
+ }
372
+ type Progress = (ProgressLax | ProgressFix) & ProgressCommon;
373
+ interface ProgressSegmentInput {
374
+ readonly name: string;
375
+ readonly distribution?: number;
376
+ readonly progress: DeepReadonly<Progress>;
377
+ }
378
+ interface ProgressSegement extends ProgressSegmentInput {
379
+ ratio: number;
380
+ share: number;
381
+ done: boolean;
382
+ laxBegin?: number;
383
+ }
384
+ type ProgressSegements = {
385
+ [key: string]: ProgressSegement;
386
+ };
387
+ declare class ProgressState {
388
+ #private;
389
+ readonly value$: Observable<DeepReadonly<ProgressSegements>>;
390
+ readonly value: i0.Signal<{
391
+ readonly [x: string]: {
392
+ readonly ratio: number;
393
+ readonly share: number;
394
+ readonly done: boolean;
395
+ readonly laxBegin?: number | undefined;
396
+ readonly name: string;
397
+ readonly distribution?: number | undefined;
398
+ readonly progress: {
399
+ readonly [x: string]: unknown;
400
+ readonly type: "lax";
401
+ readonly predictedTime: number;
402
+ readonly message?: string | undefined;
403
+ } | {
404
+ readonly [x: string]: unknown;
405
+ readonly type: "fix";
406
+ readonly percent: number;
407
+ readonly message?: string | undefined;
408
+ };
409
+ };
410
+ } | undefined>;
411
+ readonly percent$: Observable<number>;
412
+ readonly percent: i0.Signal<number | undefined>;
413
+ segment(name: string, distribution?: number): ProgressSegmentRef;
414
+ connect(state: ProgressState, name: string, distribution?: number): Observable<void>;
415
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProgressState, never>;
416
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ProgressState, never, never, {}, {}, never, never, true, never>;
417
+ }
418
+ declare class ProgressSegmentRef {
419
+ #private;
420
+ readonly name: string;
421
+ set distribution(value: number | undefined);
422
+ get distribution(): number | undefined;
423
+ get value(): Progress | undefined;
424
+ constructor(subject: Subject<ProgressSegmentInput>, name: string, distribution?: number);
425
+ next(progress: Progress): this;
426
+ complete(): this;
427
+ }
428
+
429
+ declare class UiStateModule {
430
+ static ɵfac: i0.ɵɵFactoryDeclaration<UiStateModule, never>;
431
+ static ɵmod: i0.ɵɵNgModuleDeclaration<UiStateModule, never, [typeof BusyDirective, typeof DirtyDirective, typeof DisabledDirective, typeof ReadonlyDirective], [typeof BusyDirective, typeof DirtyDirective, typeof DisabledDirective, typeof ReadonlyDirective]>;
432
+ static ɵinj: i0.ɵɵInjectorDeclaration<UiStateModule>;
433
+ }
434
+
435
+ export { AbstractUiState, ActivityService, BusyDirective, DirtyDirective, DisabledDirective, FocusService, FocusState, FocusTrap, Focusable, Gesture, GestureCaptureState, GestureDrag, GestureDragHorizontal, GestureDragImpl, GestureDragVertical, GestureLongTap, GestureLongTapImpl, GesturePhase, GesturePointerType, GestureService, GestureTap, GestureTapImpl, KeystrokeService, Listeners, NOTSET, ProgressSegmentRef, ProgressState, ReadonlyDirective, UiState, UiStateModule, gestureDrag, gestureLongTap, gestureTap, reduceCaptureStates };
436
+ export type { ActivityEvent, ActivityOrigin, FocusOrigin, FocusOriginEvent, GestureDetail, GestureDragDetail, GestureDragOptions, GestureEvent, GestureListenReturns, GestureListenerConfig, GestureLongTapDetail, GestureLongTapOptions, GestureOptions, GestureOrigin, GesturePointer, GestureTapDetail, GestureTapOptions, GestureWatchReturns, Keystroke, KeystrokeEvent, PointersPosition, Progress, ProgressCommon, ProgressFix, ProgressLax, ProgressSegement, ProgressSegements, ProgressSegmentInput, UiStateDetails, UiStateEntry, UiStateSelector, UiStateSource, UiStateValue };
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@ngutil/aria",
3
- "version": "0.0.101",
3
+ "version": "0.0.104",
4
4
  "peerDependencies": {
5
- "@angular/cdk": "19.2.11",
6
- "@angular/common": "19.2.8",
7
- "@angular/core": "19.2.8",
5
+ "@angular/cdk": "20.2.14",
6
+ "@angular/common": "20.3.13",
7
+ "@angular/core": "20.3.13",
8
8
  "es-toolkit": "^1.35.0",
9
9
  "rxjs": "^7.8.1",
10
10
  "tabbable": "^6.2.0",
11
11
  "utility-types": "^3.11.0",
12
- "@ngutil/common": "0.0.101",
13
- "@ngutil/style": "0.0.101"
12
+ "@ngutil/common": "0.0.104",
13
+ "@ngutil/style": "0.0.104"
14
14
  },
15
15
  "publishConfig": {
16
16
  "access": "public",
@@ -1,23 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import * as i0 from "@angular/core";
3
- export type ActivityOrigin = "mouse" | "keyboard" | "touch" | "program";
4
- export interface ActivityEvent {
5
- origin: ActivityOrigin;
6
- type: keyof typeof EVENT_ORIGIN;
7
- node?: Node;
8
- }
9
- declare const EVENT_ORIGIN: {
10
- keydown: string;
11
- mousedown: string;
12
- mousemove: string;
13
- touchstart: string;
14
- };
15
- export declare class ActivityService {
16
- #private;
17
- readonly events$: Observable<ActivityEvent>;
18
- watchActivity(node?: HTMLElement): Observable<ActivityEvent>;
19
- watchInactvity(timeout: number): Observable<boolean>;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<ActivityService, never>;
21
- static ɵprov: i0.ɵɵInjectableDeclaration<ActivityService>;
22
- }
23
- export {};
@@ -1 +0,0 @@
1
- export * from "./activity.service";
@@ -1,16 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { ConnectProtocol, ElementInput } from "@ngutil/common";
3
- import { FocusOrigin, FocusOriginEvent } from "./focus.service";
4
- import * as i0 from "@angular/core";
5
- export declare class FocusState implements ConnectProtocol {
6
- #private;
7
- readonly event$: Observable<FocusOriginEvent>;
8
- readonly event: import("@angular/core").Signal<FocusOriginEvent | undefined>;
9
- readonly self: import("@angular/core").Signal<FocusOrigin>;
10
- readonly within: import("@angular/core").Signal<FocusOrigin>;
11
- readonly has: import("@angular/core").Signal<FocusOrigin>;
12
- constructor();
13
- connect(value: FocusState | ElementInput): Observable<unknown>;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<FocusState, never>;
15
- static ɵdir: i0.ɵɵDirectiveDeclaration<FocusState, never, never, {}, {}, never, never, true, never>;
16
- }
@@ -1,8 +0,0 @@
1
- import { Destructible } from "@ngutil/common";
2
- export declare class FocusTrap extends Destructible {
3
- #private;
4
- get enabled(): boolean;
5
- set enabled(val: boolean);
6
- enable(): void;
7
- disable(): void;
8
- }
@@ -1,22 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { type FocusableElement } from "tabbable";
3
- import { ElementInput } from "@ngutil/common";
4
- import { ActivityOrigin } from "../activity";
5
- import * as i0 from "@angular/core";
6
- export type FocusOrigin = ActivityOrigin | null;
7
- export interface FocusOriginEvent {
8
- element: Node;
9
- origin: FocusOrigin;
10
- }
11
- export declare class FocusService {
12
- #private;
13
- readonly events: Observable<FocusOriginEvent>;
14
- watch(element: ElementInput): Observable<FocusOriginEvent>;
15
- focus(node: ElementInput, origin?: ActivityOrigin): void;
16
- queryFocusable(inside: ElementInput): FocusableElement[];
17
- getFirstFocusable(inside: ElementInput): FocusableElement | undefined;
18
- isFocusable(node: ElementInput): boolean;
19
- focusTrap(inside: ElementInput, deferCaptureElements?: boolean): import("@angular/cdk/a11y-module.d-DrV0SO0k").FocusTrap;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<FocusService, never>;
21
- static ɵprov: i0.ɵɵInjectableDeclaration<FocusService>;
22
- }
@@ -1,13 +0,0 @@
1
- import { ConnectProtocol, ElementInput } from "@ngutil/common";
2
- import { FocusState } from "./focus-state.directive";
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "./focus-state.directive";
5
- export declare class Focusable implements ConnectProtocol {
6
- readonly state: FocusState;
7
- readonly focusable: import("@angular/core").InputSignal<number | boolean>;
8
- readonly tabindex: import("@angular/core").InputSignalWithTransform<number, any>;
9
- readonly _tabindex: import("@angular/core").Signal<number>;
10
- connect(value: Focusable | FocusState | ElementInput): import("rxjs").Observable<unknown>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<Focusable, never>;
12
- static ɵdir: i0.ɵɵDirectiveDeclaration<Focusable, "[nuFocusable]", ["nuFocusable"], { "focusable": { "alias": "nuFocusable"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.FocusState; inputs: {}; outputs: {}; }]>;
13
- }
package/focus/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./focus.service";
2
- export * from "./focus-trap.directive";
3
- export * from "./focusable.directive";
4
- export * from "./focus-state.directive";
@@ -1,21 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { Mutable } from "utility-types";
3
- import { Position } from "@ngutil/style";
4
- import { Gesture, GestureCaptureState, GestureOptions } from "./gesture";
5
- import { GestureDetail } from "./gesture-event";
6
- export interface GestureDragDetail extends GestureDetail {
7
- moveBy: Position;
8
- }
9
- export type GestureDragOptions = GestureOptions<GestureDragImpl>;
10
- export declare class GestureDragImpl<T extends GestureDragDetail = GestureDragDetail> extends Gesture<T> {
11
- readonly type = "gesture-drag";
12
- readonly horizontal?: boolean;
13
- readonly vertical?: boolean;
14
- constructor(options?: GestureDragOptions);
15
- capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
16
- handle(events: Observable<GestureDetail>): Observable<Mutable<T>>;
17
- }
18
- export declare function gestureDrag(options?: GestureDragOptions): GestureDragImpl<GestureDragDetail>;
19
- export declare const GestureDrag: GestureDragImpl<GestureDragDetail>;
20
- export declare const GestureDragHorizontal: GestureDragImpl<GestureDragDetail>;
21
- export declare const GestureDragVertical: GestureDragImpl<GestureDragDetail>;
@@ -1,40 +0,0 @@
1
- import { Position } from "@ngutil/style";
2
- export interface GestureDetail {
3
- readonly origin: GestureOrigin;
4
- readonly target: HTMLElement;
5
- readonly pointerType: GesturePointerType;
6
- readonly phase: GesturePhase;
7
- readonly pointers: ReadonlyArray<GesturePointer>;
8
- readonly timeStamp: number;
9
- readonly elapsed: number;
10
- readonly scrollDistance?: Position;
11
- }
12
- export type PointersPosition = ReadonlyArray<Readonly<Position>>;
13
- export interface GesturePointer {
14
- readonly start: Position;
15
- readonly current: Position;
16
- readonly end?: Position;
17
- readonly distance: Position;
18
- readonly direction: {
19
- x: -1 | 0 | 1;
20
- y: -1 | 0 | 1;
21
- };
22
- }
23
- export type GestureOrigin = MouseEvent | TouchEvent;
24
- export declare enum GesturePointerType {
25
- Mouse = "mouse",
26
- Touch = "touch"
27
- }
28
- export declare enum GesturePhase {
29
- Start = "start",
30
- Moving = "moving",
31
- End = "end"
32
- }
33
- export interface GestureListenerConfig {
34
- options?: AddEventListenerOptions;
35
- pointerType: GesturePointerType;
36
- phase: GesturePhase;
37
- }
38
- export declare const Listeners: {
39
- [key: string]: GestureListenerConfig;
40
- };
@@ -1,13 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { Gesture, GestureCaptureState, GestureOptions } from "./gesture";
3
- import { GestureDetail } from "./gesture-event";
4
- export type GestureLongTapDetail = GestureDetail;
5
- export type GestureLongTapOptions = GestureOptions<GestureLongTapImpl>;
6
- export declare class GestureLongTapImpl<T extends GestureLongTapDetail = GestureLongTapDetail> extends Gesture<T> {
7
- readonly type = "gesture-longtap";
8
- constructor(options?: GestureLongTapOptions);
9
- capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
10
- handle(events: Observable<GestureDetail>): Observable<import("utility-types").Mutable<T>>;
11
- }
12
- export declare function gestureLongTap(options?: GestureLongTapOptions): GestureLongTapImpl<GestureDetail>;
13
- export declare const GestureLongTap: GestureLongTapImpl<GestureDetail>;
@@ -1,12 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { Gesture, GestureCaptureState, GestureOptions } from "./gesture";
3
- import { GestureDetail } from "./gesture-event";
4
- export type GestureTapDetail = GestureDetail;
5
- export type GestureTapOptions = GestureOptions<GestureTapImpl>;
6
- export declare class GestureTapImpl<T extends GestureTapDetail = GestureTapDetail> extends Gesture<T> {
7
- readonly type = "gesture-tap";
8
- capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
9
- handle(events: Observable<GestureDetail>): Observable<import("utility-types").Mutable<T>>;
10
- }
11
- export declare function gestureTap(options?: GestureTapOptions): GestureTapImpl<GestureDetail>;
12
- export declare const GestureTap: GestureTapImpl<GestureDetail>;