@baleada/logic 0.22.4 → 0.22.6

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/lib/index.d.ts CHANGED
@@ -156,10 +156,13 @@ type RecognizeableEffectApi<Type extends ListenableSupportedType, Metadata exten
156
156
  setMetadata: (metadata: Metadata) => void;
157
157
  recognized: () => void;
158
158
  denied: () => void;
159
+ recognizedUntilReady: () => void;
160
+ deniedUntilReady: () => void;
161
+ ready: () => void;
159
162
  getSequence: () => ListenEffectParam<Type>[];
160
163
  onRecognized: (sequenceItem: ListenEffectParam<Type>) => any;
161
- } & ListenEffectApi<Type>;
162
- type RecognizeableStatus = 'recognized' | 'recognizing' | 'denied' | 'ready';
164
+ };
165
+ type RecognizeableStatus = 'recognized' | 'recognizing' | 'denied' | 'ready' | 'recognized until ready' | 'denied until ready';
163
166
  type RecognizeOptions<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
164
167
  onRecognized?: (sequenceItem: ListenEffectParam<Type>) => any;
165
168
  };
@@ -172,6 +175,8 @@ declare class Recognizeable<Type extends ListenableSupportedType, Metadata exten
172
175
  private resetComputedMetadata;
173
176
  private recognized;
174
177
  private denied;
178
+ private recognizedUntilReady;
179
+ private deniedUntilReady;
175
180
  private computedStatus;
176
181
  private ready;
177
182
  get sequence(): ListenEffectParam<Type>[];
@@ -180,14 +185,14 @@ declare class Recognizeable<Type extends ListenableSupportedType, Metadata exten
180
185
  get metadata(): Metadata;
181
186
  private computedSequence;
182
187
  setSequence(sequence: ListenEffectParam<Type>[]): this;
183
- recognize(sequenceItem: ListenEffectParam<Type>, api: ListenEffectApi<Type>, { onRecognized }?: RecognizeOptions<Type, Metadata>): this;
188
+ recognize(sequenceItem: ListenEffectParam<Type>, { onRecognized }?: RecognizeOptions<Type, Metadata>): this;
184
189
  private recognizing;
185
190
  private toType;
186
191
  }
187
192
 
188
193
  type ListenableSupportedType = 'recognizeable' | 'intersect' | 'mutate' | 'resize' | 'idle' | 'message' | 'messageerror' | ListenableMediaQuery | keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
189
194
  type ListenableMediaQuery = `(${string})`;
190
- type ListenableClickcombo = `${string}+${ListenableLeftClick | ListenableRightClick}`;
195
+ type ListenableMousecombo = `${string}+${ListenableLeftClick | ListenableRightClick}`;
191
196
  type ListenableLeftClick = 'click' | 'dblclick' | `mouse${string}`;
192
197
  type ListenableRightClick = 'rightclick' | 'contextmenu';
193
198
  type ListenablePointercombo = `${string}+${ListenablePointer}`;
@@ -197,18 +202,8 @@ type ListenableSupportedEventType = keyof Omit<HTMLElementEventMap, 'resize'> |
197
202
  type ListenableOptions<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = {
198
203
  recognizeable?: RecognizeableOptions<Type, RecognizeableMetadata>;
199
204
  };
200
- type ListenEffect<Type extends ListenableSupportedType> = Type extends 'intersect' ? (entries: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends 'mutate' ? (records: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends 'resize' ? (entries: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends 'idle' ? (deadline: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends ('message' | 'messageerror') ? (event: MessageEvent, api: ListenEffectApi<Type>) => any : Type extends ListenableMediaQuery ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends (ListenableLeftClick | ListenableRightClick) ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends (ListenablePointer) ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends ('keydown' | 'keyup') ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : Type extends keyof Omit<DocumentEventMap, 'resize'> ? (event: ListenEffectParam<Type>, api: ListenEffectApi<Type>) => any : never;
205
+ type ListenEffect<Type extends ListenableSupportedType> = Type extends 'intersect' ? (entries: ListenEffectParam<Type>) => any : Type extends 'mutate' ? (records: ListenEffectParam<Type>) => any : Type extends 'resize' ? (entries: ListenEffectParam<Type>) => any : Type extends 'idle' ? (deadline: ListenEffectParam<Type>) => any : Type extends ('message' | 'messageerror') ? (event: MessageEvent) => any : Type extends ListenableMediaQuery ? (event: ListenEffectParam<Type>) => any : Type extends (ListenableLeftClick | ListenableRightClick) ? (event: ListenEffectParam<Type>) => any : Type extends (ListenablePointer) ? (event: ListenEffectParam<Type>) => any : Type extends ('keydown' | 'keyup') ? (event: ListenEffectParam<Type>) => any : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? (event: ListenEffectParam<Type>) => any : Type extends keyof Omit<DocumentEventMap, 'resize'> ? (event: ListenEffectParam<Type>) => any : never;
201
206
  type ListenEffectParam<Type extends ListenableSupportedType> = Type extends 'intersect' ? IntersectionObserverEntry[] : Type extends 'mutate' ? MutationRecord[] : Type extends 'resize' ? ResizeObserverEntry[] : Type extends 'idle' ? IdleDeadline : Type extends ListenableMediaQuery ? MediaQueryListEvent : Type extends ListenableRightClick ? MouseEvent : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? HTMLElementEventMap[Type] : Type extends keyof Omit<DocumentEventMap, 'resize'> ? DocumentEventMap[Type] : never;
202
- type ListenEffectApi<Type extends ListenableSupportedType> = Type extends 'intersect' ? Record<never, never> : Type extends 'mutate' ? Record<never, never> : Type extends 'resize' ? Record<never, never> : Type extends 'idle' ? Record<never, never> : Type extends ('message' | 'messageerror') ? Record<never, never> : Type extends ListenableMediaQuery ? Record<never, never> : Type extends (ListenableLeftClick | ListenableRightClick) ? MouseEventApi : Type extends (ListenablePointer) ? PointerEventApi : Type extends ('keydown' | 'keyup') ? KeyboardEventApi : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? Record<never, never> : Type extends keyof Omit<DocumentEventMap, 'resize'> ? Record<never, never> : never;
203
- type MouseEventApi = {
204
- matches: (clickcombo: ListenableClickcombo) => boolean;
205
- };
206
- type PointerEventApi = {
207
- matches: (pointercombo: ListenablePointercombo) => boolean;
208
- };
209
- type KeyboardEventApi = {
210
- matches: (keycombo: ListenableKeycombo) => boolean;
211
- };
212
207
  type ListenOptions<Type extends ListenableSupportedType> = Type extends 'intersect' ? {
213
208
  observer?: IntersectionObserverInit;
214
209
  } & ObservationListenOptions : Type extends 'mutate' ? {
@@ -320,7 +315,7 @@ declare class Broadcastable<State> {
320
315
  stop(): this;
321
316
  private stopped;
322
317
  }
323
- declare function toMessageListenParams<State>(instance: Broadcastable<State>, effect: (event: MessageEvent<State>, api: Parameters<ListenEffect<'message'>>[1]) => void): Parameters<Listenable<'message'>['listen']>;
318
+ declare function toMessageListenParams<State>(instance: Broadcastable<State>, effect: (event: MessageEvent<State>) => void): Parameters<Listenable<'message'>['listen']>;
324
319
 
325
320
  type CompleteableOptions = {
326
321
  segment?: {
@@ -762,14 +757,14 @@ declare class Storeable<String extends string> {
762
757
  removeStatus(): this;
763
758
  }
764
759
 
765
- declare function createReduceAsync<Item, Accumulator>(accumulate: (accumulator?: Accumulator, item?: Item, index?: number) => Promise<Accumulator>, initialValue?: Accumulator): (array: Item[]) => Promise<Accumulator>;
766
- declare function createReduce<Item, Accumulator>(accumulate: (accumulator?: Accumulator, item?: Item, index?: number) => Accumulator, initialValue?: Accumulator): (array: Item[]) => Accumulator;
760
+ declare function createReduceAsync<Item, Accumulator>(accumulate: (accumulator: Accumulator, item: Item, index: number) => Promise<Accumulator>, initialValue?: Accumulator): (array: Item[]) => Promise<Accumulator>;
761
+ declare function createReduce<Item, Accumulator>(accumulate: (accumulator: Accumulator, item: Item, index: number) => Accumulator, initialValue?: Accumulator): (array: Item[]) => Accumulator;
767
762
  type ArrayFunctionAsync<Item, Returned> = (array: Item[]) => Promise<Returned>;
768
- declare function createForEachAsync<Item>(forEach: (item?: Item, index?: number) => any): ArrayFunctionAsync<Item, any>;
769
- declare function createMapAsync<Item, Mapped>(transform: (item?: Item, index?: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
770
- declare function createFilterAsync<Item>(condition: (item?: Item, index?: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
763
+ declare function createForEachAsync<Item>(forEach: (item: Item, index: number) => any): ArrayFunctionAsync<Item, any>;
764
+ declare function createMapAsync<Item, Mapped>(transform: (item: Item, index: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
765
+ declare function createFilterAsync<Item>(condition: (item: Item, index: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
771
766
  type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
772
- declare function createDelete<Item>(index: number): ArrayFunction<Item, Item[]>;
767
+ declare function createRemove<Item>(index: number): ArrayFunction<Item, Item[]>;
773
768
  declare function createInsert<Item>(item: Item, index: number): ArrayFunction<Item, Item[]>;
774
769
  declare function createReorder<Item>(from: {
775
770
  start: number;
@@ -779,8 +774,8 @@ declare function createSwap<Item>(indices: [number, number]): ArrayFunction<Item
779
774
  declare function createReplace<Item>(index: number, item: Item): ArrayFunction<Item, Item[]>;
780
775
  declare function createUnique<Item>(): ArrayFunction<Item, Item[]>;
781
776
  declare function createSlice<Item>(from: number, to?: number): ArrayFunction<Item, Item[]>;
782
- declare function createFilter<Item>(condition: (item?: Item, index?: number) => boolean): ArrayFunction<Item, Item[]>;
783
- declare function createMap<Item, Transformed = Item>(transform: (item?: Item, index?: number) => Transformed): ArrayFunction<Item, Transformed[]>;
777
+ declare function createFilter<Item>(condition: (item: Item, index: number) => boolean): ArrayFunction<Item, Item[]>;
778
+ declare function createMap<Item, Transformed = Item>(transform: (item: Item, index: number) => Transformed): ArrayFunction<Item, Transformed[]>;
784
779
  declare function createConcat<Item>(...arrays: Item[][]): ArrayFunction<Item, Item[]>;
785
780
  declare function createReverse<Item>(): ArrayFunction<Item, Item[]>;
786
781
  declare function createSort<Item>(compare?: (itemA: Item, itemB: Item) => number): ArrayFunction<Item, Item[]>;
@@ -798,6 +793,13 @@ type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returne
798
793
  declare function createRename<Key, Value>(from: Key, to: Key): MapFunction<Key, Value, Map<Key, Value>>;
799
794
  type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
800
795
  declare function createToEntries<Key extends string | number | symbol, Value>(): ObjectFunction<Key, Value, [Key, Value][]>;
796
+ declare function createToKeys<Key extends string | number | symbol>(): ObjectFunction<Key, any, [Key, any][]>;
797
+ type EventFunction<Evt extends Event, Returned> = (event: Evt) => Returned;
798
+ declare function createMatchesKeycombo(keycombo: string): EventFunction<KeyboardEvent, boolean>;
799
+ declare function createMatchesMousecombo(mousecombo: string): EventFunction<MouseEvent, boolean>;
800
+ declare function createMatchesPointercombo(pointercombo: string): EventFunction<PointerEvent, boolean>;
801
+ type ElementFunction<El extends HTMLElement, Returned> = (element: El) => Returned;
802
+ declare function createToFocusable(order: 'first' | 'last', elementIsCandidate?: boolean): ElementFunction<HTMLElement, HTMLElement | undefined>;
801
803
  declare class Pipeable {
802
804
  private state;
803
805
  constructor(state: any);
@@ -805,4 +807,4 @@ declare class Pipeable {
805
807
  pipeAsync(...fns: ((...args: any[]) => Promise<any>)[]): Promise<any>;
806
808
  }
807
809
 
808
- export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, ArrayFunction, ArrayFunctionAsync, Broadcastable, BroadcastableOptions, BroadcastableStatus, CompleteOptions, Completeable, CompleteableOptions, CompleteableStatus, Copyable, CopyableOptions, CopyableStatus, Delayable, DelayableEffect, DelayableOptions, DelayableStatus, Drawable, DrawableOptions, DrawableState, DrawableStatus, FetchOptions, FetchOptionsApi, Fetchable, FetchableOptions, FetchableStatus, Fullscreenable, FullscreenableGetElement, FullscreenableOptions, FullscreenableStatus, Grantable, GrantableOptions, GrantableStatus, ListenEffect, ListenEffectParam, ListenOptions, Listenable, ListenableActive, ListenableClickcombo, ListenableKeycombo, ListenableOptions, ListenablePointercombo, ListenableStatus, ListenableSupportedEventType, ListenableSupportedType, MapFunction, Navigateable, NavigateableOptions, NavigateableStatus, NumberFunction, ObjectFunction, Pickable, PickableOptions, PickableStatus, Pipeable, RecognizeOptions, Recognizeable, RecognizeableEffect, RecognizeableOptions, RecognizeableStatus, Resolveable, ResolveableGetPromise, ResolveableOptions, ResolveableStatus, Sanitizeable, SanitizeableOptions, SanitizeableStatus, Searchable, SearchableOptions, SearchableStatus, Shareable, ShareableOptions, ShareableStatus, Storeable, StoreableOptions, StoreableStatus, StringFunction, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSort, createSwap, createToEntries, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
810
+ export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, ArrayFunction, ArrayFunctionAsync, Broadcastable, BroadcastableOptions, BroadcastableStatus, CompleteOptions, Completeable, CompleteableOptions, CompleteableStatus, Copyable, CopyableOptions, CopyableStatus, Delayable, DelayableEffect, DelayableOptions, DelayableStatus, Drawable, DrawableOptions, DrawableState, DrawableStatus, ElementFunction, EventFunction, FetchOptions, FetchOptionsApi, Fetchable, FetchableOptions, FetchableStatus, Fullscreenable, FullscreenableGetElement, FullscreenableOptions, FullscreenableStatus, Grantable, GrantableOptions, GrantableStatus, ListenEffect, ListenEffectParam, ListenOptions, Listenable, ListenableActive, ListenableKeycombo, ListenableMousecombo, ListenableOptions, ListenablePointercombo, ListenableStatus, ListenableSupportedEventType, ListenableSupportedType, MapFunction, Navigateable, NavigateableOptions, NavigateableStatus, NumberFunction, ObjectFunction, Pickable, PickableOptions, PickableStatus, Pipeable, RecognizeOptions, Recognizeable, RecognizeableEffect, RecognizeableOptions, RecognizeableStatus, Resolveable, ResolveableGetPromise, ResolveableOptions, ResolveableStatus, Sanitizeable, SanitizeableOptions, SanitizeableStatus, Searchable, SearchableOptions, SearchableStatus, Shareable, ShareableOptions, ShareableStatus, Storeable, StoreableOptions, StoreableStatus, StringFunction, createClamp, createClip, createConcat, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createMatchesKeycombo, createMatchesMousecombo, createMatchesPointercombo, createReduce, createReduceAsync, createRemove, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSort, createSwap, createToEntries, createToFocusable, createToKeys, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };