@ngutil/aria 0.0.102 → 0.0.105

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.
@@ -1,84 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { FunctionKeys, Mutable } from "utility-types";
3
- import { GestureDetail, GesturePointerType } from "./gesture-event";
4
- export declare enum GestureCaptureState {
5
- Unchecked = 0,
6
- Pending = 1,
7
- Skip = 2,
8
- Maybe = 3,
9
- Instant = 4
10
- }
11
- type _GestureOptions = Partial<Omit<Gesture<any>, "originTypes" | "type" | FunctionKeys<Gesture<any>>>>;
12
- export type GestureOptions<T extends object> = Partial<Omit<T, keyof Gesture<any> | FunctionKeys<T>>> & _GestureOptions;
13
- export type GestureEvent<G extends Gesture> = G extends Gesture<infer E> & {
14
- type: infer T;
15
- } ? CustomEvent<E> & {
16
- type: T;
17
- } : never;
18
- export declare abstract class Gesture<T extends GestureDetail = GestureDetail> {
19
- /**
20
- * The name of the gesture
21
- */
22
- abstract readonly type: string;
23
- /**
24
- * Gestures that depends on move distance, like drag, use this option
25
- */
26
- readonly distanceInclusion: number;
27
- /**
28
- * Gestures thet dependnso on time frame, like longtap, use this option
29
- */
30
- readonly timeWithin: number;
31
- /**
32
- * The priority of the gesture
33
- */
34
- readonly priority: number;
35
- /**
36
- * Should the gesture include the scroll distance
37
- */
38
- readonly includeScrollDistance: boolean;
39
- /**
40
- * The pointer types of the gesture
41
- */
42
- readonly pointerTypes: Array<GesturePointerType>;
43
- /**
44
- * The number of pointers of the gesture can handle
45
- */
46
- readonly pointerCount: number;
47
- /**
48
- * The mouse buttons of the gesture (1 = left, 2 = middle, 3 = right)
49
- */
50
- readonly mouseButtons: Array<number>;
51
- /**
52
- * The event types of the gesture can handle
53
- */
54
- readonly originTypes: Array<string>;
55
- constructor(options?: _GestureOptions);
56
- /**
57
- * Test if the gesture should be captured.
58
- * The given events is filterde by {@see Gesture#shouldCapture}
59
- * ! important, dont rely on this object state, because not always create a new object
60
- * @param events events to check
61
- */
62
- abstract capture(events: Observable<GestureDetail>): Observable<GestureCaptureState>;
63
- /**
64
- * Transform input event, to gesture event.
65
- * The given events is filterde by {@see Gesture#isRelevantEvent}
66
- * ! important, dont rely on this object state, because not always create a new object
67
- * @param events events to transform or filter or leave as is
68
- */
69
- handle(events: Observable<GestureDetail>): Observable<Mutable<T>>;
70
- /**
71
- * Should this gesture capture the event?
72
- * @param event event to check
73
- * @returns true if the gesture should capture the event, false otherwise
74
- */
75
- shouldCapture(event: GestureDetail): boolean;
76
- /**
77
- * Test if the event is relevant to the gesture.
78
- * The event is relevant if
79
- * @param event event to check
80
- * @returns true if the event is relevant, false otherwise
81
- */
82
- isRelevantEvent(event: GestureDetail): boolean;
83
- }
84
- export {};
@@ -1,21 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { ElementInput } from "@ngutil/common";
3
- import { Gesture, GestureCaptureState, GestureEvent } from "./gesture";
4
- import * as i0 from "@angular/core";
5
- type GesturesToEventsType<T extends Array<Gesture>> = T extends Array<infer G> ? (G extends Gesture ? GestureEvent<G> : never) : never;
6
- type GestureEventDiscriminator<T> = T extends {
7
- type: infer N;
8
- } ? {
9
- type: N;
10
- } & T : never;
11
- export type GestureWatchReturns<T extends Array<Gesture>> = Observable<GestureEventDiscriminator<GesturesToEventsType<T>>>;
12
- export type GestureListenReturns<T extends Array<Gesture>> = Observable<GesturesToEventsType<T>>;
13
- export declare class GestureService {
14
- #private;
15
- constructor();
16
- listen<T extends Array<Gesture>>(el: ElementInput, ...gestures: T): GestureListenReturns<T>;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<GestureService, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<GestureService>;
19
- }
20
- export declare function reduceCaptureStates(states: GestureCaptureState[]): GestureCaptureState;
21
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./gesture-drag";
2
- export * from "./gesture-event";
3
- export * from "./gesture-longtap";
4
- export * from "./gesture-tap";
5
- export * from "./gesture.service";
6
- export * from "./gesture";
@@ -1 +0,0 @@
1
- export * from "./keystroke.service";
@@ -1,22 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { ElementInput } from "@ngutil/common";
3
- import { FocusState } from "../focus";
4
- import * as i0 from "@angular/core";
5
- export interface Keystroke {
6
- key: KeyboardEvent["key"];
7
- shift?: boolean;
8
- ctrl?: boolean;
9
- alt?: boolean;
10
- state: "down" | "up";
11
- }
12
- export interface KeystrokeEvent {
13
- original: KeyboardEvent;
14
- keystroke: Keystroke;
15
- }
16
- export type KeystrokeActivation = ElementInput | FocusState | Observable<ElementInput | FocusState | boolean>;
17
- export declare class KeystrokeService {
18
- #private;
19
- watch(activation: KeystrokeActivation, ...keystrokes: Keystroke[]): Observable<KeystrokeEvent>;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<KeystrokeService, never>;
21
- static ɵprov: i0.ɵɵInjectableDeclaration<KeystrokeService>;
22
- }
@@ -1,19 +0,0 @@
1
- import { Signal } from "@angular/core";
2
- import { Observable } from "rxjs";
3
- import { UiState } from "./ui-state";
4
- import * as i0 from "@angular/core";
5
- export declare const NOTSET: any;
6
- export declare abstract class AbstractUiState<N extends string> {
7
- readonly name: N;
8
- readonly state: UiState<N>;
9
- abstract readonly input: Signal<boolean>;
10
- abstract readonly when: Signal<string>;
11
- readonly yes: Signal<boolean>;
12
- readonly no: Signal<boolean>;
13
- constructor(name: N);
14
- set(value: boolean, source: string): void;
15
- intercept(source: string): <S>(src: Observable<S>) => Observable<S>;
16
- wrap<T>(observable: Observable<T>, source: string): Observable<T>;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<AbstractUiState<any>, never>;
18
- static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractUiState<any>, never, never, {}, {}, never, never, true, never>;
19
- }
@@ -1,9 +0,0 @@
1
- import { AbstractUiState } from "./abstract";
2
- import * as i0 from "@angular/core";
3
- export declare class BusyDirective extends AbstractUiState<"busy"> {
4
- readonly input: import("@angular/core").InputSignal<boolean>;
5
- readonly when: import("@angular/core").InputSignal<string>;
6
- constructor();
7
- static ɵfac: i0.ɵɵFactoryDeclaration<BusyDirective, never>;
8
- 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>;
9
- }
@@ -1,9 +0,0 @@
1
- import { AbstractUiState } from "./abstract";
2
- import * as i0 from "@angular/core";
3
- export declare class DirtyDirective extends AbstractUiState<"dirty"> {
4
- readonly input: import("@angular/core").InputSignal<boolean>;
5
- readonly when: import("@angular/core").InputSignal<string>;
6
- constructor();
7
- static ɵfac: i0.ɵɵFactoryDeclaration<DirtyDirective, never>;
8
- 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>;
9
- }
@@ -1,9 +0,0 @@
1
- import { AbstractUiState } from "./abstract";
2
- import * as i0 from "@angular/core";
3
- export declare class DisabledDirective extends AbstractUiState<"disabled"> {
4
- readonly input: import("@angular/core").InputSignal<boolean>;
5
- readonly when: import("@angular/core").InputSignal<string>;
6
- constructor();
7
- static ɵfac: i0.ɵɵFactoryDeclaration<DisabledDirective, never>;
8
- 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>;
9
- }
@@ -1,17 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "./busy.directive";
3
- import * as i2 from "./dirty.directive";
4
- import * as i3 from "./disabled.directive";
5
- import * as i4 from "./readonly.directive";
6
- export * from "./abstract";
7
- export * from "./busy.directive";
8
- export * from "./disabled.directive";
9
- export * from "./progress-state";
10
- export * from "./readonly.directive";
11
- export * from "./dirty.directive";
12
- export * from "./ui-state";
13
- export declare class UiStateModule {
14
- static ɵfac: i0.ɵɵFactoryDeclaration<UiStateModule, never>;
15
- static ɵmod: i0.ɵɵNgModuleDeclaration<UiStateModule, never, [typeof i1.BusyDirective, typeof i2.DirtyDirective, typeof i3.DisabledDirective, typeof i4.ReadonlyDirective], [typeof i1.BusyDirective, typeof i2.DirtyDirective, typeof i3.DisabledDirective, typeof i4.ReadonlyDirective]>;
16
- static ɵinj: i0.ɵɵInjectorDeclaration<UiStateModule>;
17
- }
@@ -1,71 +0,0 @@
1
- import { Observable, Subject } from "rxjs";
2
- import { DeepReadonly } from "@ngutil/common";
3
- import * as i0 from "@angular/core";
4
- export interface ProgressCommon {
5
- readonly message?: string;
6
- readonly [other: string]: unknown;
7
- }
8
- export interface ProgressLax {
9
- readonly type: "lax";
10
- readonly predictedTime: number;
11
- }
12
- export interface ProgressFix {
13
- readonly type: "fix";
14
- readonly percent: number;
15
- }
16
- export type Progress = (ProgressLax | ProgressFix) & ProgressCommon;
17
- export interface ProgressSegmentInput {
18
- readonly name: string;
19
- readonly distribution?: number;
20
- readonly progress: DeepReadonly<Progress>;
21
- }
22
- export interface ProgressSegement extends ProgressSegmentInput {
23
- ratio: number;
24
- share: number;
25
- done: boolean;
26
- laxBegin?: number;
27
- }
28
- export type ProgressSegements = {
29
- [key: string]: ProgressSegement;
30
- };
31
- export declare class ProgressState {
32
- #private;
33
- readonly value$: Observable<DeepReadonly<ProgressSegements>>;
34
- readonly value: import("@angular/core").Signal<{
35
- readonly [x: string]: {
36
- readonly ratio: number;
37
- readonly share: number;
38
- readonly done: boolean;
39
- readonly laxBegin?: number | undefined;
40
- readonly name: string;
41
- readonly distribution?: number | undefined;
42
- readonly progress: {
43
- readonly [x: string]: unknown;
44
- readonly type: "lax";
45
- readonly predictedTime: number;
46
- readonly message?: string | undefined;
47
- } | {
48
- readonly [x: string]: unknown;
49
- readonly type: "fix";
50
- readonly percent: number;
51
- readonly message?: string | undefined;
52
- };
53
- };
54
- } | undefined>;
55
- readonly percent$: Observable<number>;
56
- readonly percent: import("@angular/core").Signal<number | undefined>;
57
- segment(name: string, distribution?: number): ProgressSegmentRef;
58
- connect(state: ProgressState, name: string, distribution?: number): Observable<void>;
59
- static ɵfac: i0.ɵɵFactoryDeclaration<ProgressState, never>;
60
- static ɵdir: i0.ɵɵDirectiveDeclaration<ProgressState, never, never, {}, {}, never, never, true, never>;
61
- }
62
- export declare class ProgressSegmentRef {
63
- #private;
64
- readonly name: string;
65
- set distribution(value: number | undefined);
66
- get distribution(): number | undefined;
67
- get value(): Progress | undefined;
68
- constructor(subject: Subject<ProgressSegmentInput>, name: string, distribution?: number);
69
- next(progress: Progress): this;
70
- complete(): this;
71
- }
@@ -1,9 +0,0 @@
1
- import { AbstractUiState } from "./abstract";
2
- import * as i0 from "@angular/core";
3
- export declare class ReadonlyDirective extends AbstractUiState<"readonly"> {
4
- readonly input: import("@angular/core").InputSignal<boolean>;
5
- readonly when: import("@angular/core").InputSignal<string>;
6
- constructor();
7
- static ɵfac: i0.ɵɵFactoryDeclaration<ReadonlyDirective, never>;
8
- 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>;
9
- }
@@ -1,60 +0,0 @@
1
- import type { UiStateDetails } from "./ui-state";
2
- export type CompiledSelector = (state: UiStateDetails) => boolean;
3
- export declare const enum TokenType {
4
- Any = 1,
5
- Name = 2,
6
- Negate = 3,
7
- Or = 4,
8
- And = 5,
9
- Subscript = 7,
10
- MultiSubscript = 8
11
- }
12
- export interface AstBase {
13
- begin: number;
14
- end: number;
15
- }
16
- export interface AstAny extends AstBase {
17
- type: TokenType.Any;
18
- }
19
- export interface AstName extends AstBase {
20
- type: TokenType.Name;
21
- value: string;
22
- }
23
- export interface AstNegate extends AstBase {
24
- type: TokenType.Negate;
25
- value: SelectorAst;
26
- }
27
- export interface AstOr extends AstBase {
28
- type: TokenType.Or;
29
- left: SelectorAst;
30
- right: SelectorAst;
31
- }
32
- export interface AstAnd extends AstBase {
33
- type: TokenType.And;
34
- left: SelectorAst;
35
- right: SelectorAst;
36
- }
37
- export interface AstSubscript extends AstBase {
38
- type: TokenType.Subscript;
39
- base: AstName;
40
- subscript: AstAny | AstName;
41
- }
42
- export interface AstMultiSubscript extends AstBase {
43
- type: TokenType.MultiSubscript;
44
- base: AstName;
45
- subscripts: AstName[];
46
- }
47
- export type SelectorAst = AstAny | AstName | AstNegate | AstOr | AstAnd | AstSubscript | AstMultiSubscript;
48
- export declare function compile(selector: string): CompiledSelector;
49
- /**
50
- * expression:
51
- * - "*": any
52
- * - "name without dot": top level: eg. "busy" or "disabled", this is equal to "busy.*"
53
- * - "name with dot": nested: eg. "busy.self" or "busy.loading"
54
- * - negate: "!busy", "!busy.*", "!busy.save"
55
- * - OR: "busy.* || !disabled.*"
56
- * - AND: "busy.* && !disabled.*"
57
- * - GROUP: "(busy || disabled) && !readonly"
58
- * - Shorted of multiple source of same base: "busy{load,save}", if one of load or save is true, the result is true
59
- */
60
- export declare function parse(selector: string): SelectorAst;
@@ -1,36 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import * as i0 from "@angular/core";
3
- /**
4
- * {
5
- * busy: {
6
- * self: true,
7
- * parent: false,
8
- * disabled: false
9
- * }
10
- * }
11
- */
12
- export type UiStateDetails = {
13
- readonly [key: string]: UiStateEntry;
14
- };
15
- export type UiStateEntry = {
16
- readonly [key: UiStateSource]: boolean;
17
- };
18
- export type UiStateValue = {
19
- readonly [key: string]: boolean;
20
- };
21
- export type UiStateSource = "parent" | "self" | string;
22
- export type UiStateSelector = string;
23
- export declare class UiState<N extends string = string, S extends UiStateSource = UiStateSource> {
24
- #private;
25
- get root(): UiState;
26
- readonly merged: import("@angular/core").Signal<UiStateDetails>;
27
- readonly value: import("@angular/core").Signal<UiStateValue>;
28
- readonly inertSelector: import("@angular/core").WritableSignal<string>;
29
- set(name: N, value: boolean, source?: S): void;
30
- is(selector?: UiStateSelector): boolean;
31
- intercept(name: N, source: S): <S_1>(src: Observable<S_1>) => Observable<S_1>;
32
- wrap<T>(observable: Observable<T>, name: N, source: S): Observable<T>;
33
- isInert(): boolean;
34
- static ɵfac: i0.ɵɵFactoryDeclaration<UiState<any, any>, never>;
35
- static ɵdir: i0.ɵɵDirectiveDeclaration<UiState<any, any>, never, never, {}, {}, never, never, true, never>;
36
- }