@baleada/logic 0.22.3 → 0.22.5

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.
Files changed (4) hide show
  1. package/lib/index.cjs +524 -232
  2. package/lib/index.d.ts +269 -216
  3. package/lib/index.js +513 -219
  4. package/package.json +21 -21
package/lib/index.d.ts CHANGED
@@ -3,22 +3,22 @@ import createDOMPurify, { Config } from 'dompurify';
3
3
  import { FullOptions, MatchData, Searcher } from 'fast-fuzzy';
4
4
  import { Options } from '@sindresorhus/slugify';
5
5
 
6
- declare type AnimateableKeyframe = {
6
+ type AnimateableKeyframe = {
7
7
  progress: number;
8
8
  properties: {
9
9
  [key: string]: number | string | any[];
10
10
  };
11
11
  timing?: AnimateableTiming;
12
12
  };
13
- declare type AnimateableOptions = {
13
+ type AnimateableOptions = {
14
14
  duration?: number;
15
15
  timing?: AnimateableTiming;
16
16
  iterations?: number | true;
17
17
  alternates?: boolean;
18
18
  };
19
- declare type AnimateableTiming = [number, number, number, number];
20
- declare type AnimateFrameEffect = (frame?: AnimateFrame) => any;
21
- declare type AnimateFrame = {
19
+ type AnimateableTiming = [number, number, number, number];
20
+ type AnimateFrameEffect = (frame?: AnimateFrame) => any;
21
+ type AnimateFrame = {
22
22
  properties: {
23
23
  [key: string]: {
24
24
  progress: {
@@ -30,12 +30,12 @@ declare type AnimateFrame = {
30
30
  };
31
31
  timestamp: number;
32
32
  };
33
- declare type AnimateOptions = {
33
+ type AnimateOptions = {
34
34
  interpolate?: {
35
35
  colorModel?: 'rgb' | 'hsl' | 'lab' | 'lch' | 'xyz';
36
36
  };
37
37
  };
38
- declare type AnimateableStatus = 'ready' | 'playing' | 'played' | 'reversing' | 'reversed' | 'paused' | 'sought' | 'stopped';
38
+ type AnimateableStatus = 'ready' | 'playing' | 'played' | 'reversing' | 'reversed' | 'paused' | 'sought' | 'stopped';
39
39
  declare class Animateable {
40
40
  private initialDuration;
41
41
  private iterationLimit;
@@ -143,7 +143,176 @@ declare const easingsNetInBack: AnimateableKeyframe['timing'];
143
143
  declare const easingsNetOutBack: AnimateableKeyframe['timing'];
144
144
  declare const easingsNetInOutBack: AnimateableKeyframe['timing'];
145
145
 
146
- declare type CompleteableOptions = {
146
+ type RecognizeableOptions<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
147
+ maxSequenceLength?: true | number;
148
+ effects?: {
149
+ [type in Type]?: RecognizeableEffect<type, Metadata>;
150
+ };
151
+ };
152
+ type RecognizeableEffect<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = (sequenceItem: ListenEffectParam<Type>, api: RecognizeableEffectApi<Type, Metadata>) => void;
153
+ type RecognizeableEffectApi<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
154
+ getStatus: () => RecognizeableStatus;
155
+ getMetadata: () => Metadata;
156
+ setMetadata: (metadata: Metadata) => void;
157
+ recognized: () => void;
158
+ denied: () => void;
159
+ getSequence: () => ListenEffectParam<Type>[];
160
+ onRecognized: (sequenceItem: ListenEffectParam<Type>) => any;
161
+ };
162
+ type RecognizeableStatus = 'recognized' | 'recognizing' | 'denied' | 'ready';
163
+ type RecognizeOptions<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
164
+ onRecognized?: (sequenceItem: ListenEffectParam<Type>) => any;
165
+ };
166
+ declare class Recognizeable<Type extends ListenableSupportedType, Metadata extends Record<any, any>> {
167
+ private maxSequenceLength;
168
+ private effects;
169
+ private effectApi;
170
+ constructor(sequence: ListenEffectParam<Type>[], options?: RecognizeableOptions<Type, Metadata>);
171
+ private computedMetadata;
172
+ private resetComputedMetadata;
173
+ private recognized;
174
+ private denied;
175
+ private computedStatus;
176
+ private ready;
177
+ get sequence(): ListenEffectParam<Type>[];
178
+ set sequence(sequence: ListenEffectParam<Type>[]);
179
+ get status(): RecognizeableStatus;
180
+ get metadata(): Metadata;
181
+ private computedSequence;
182
+ setSequence(sequence: ListenEffectParam<Type>[]): this;
183
+ recognize(sequenceItem: ListenEffectParam<Type>, { onRecognized }?: RecognizeOptions<Type, Metadata>): this;
184
+ private recognizing;
185
+ private toType;
186
+ }
187
+
188
+ type ListenableSupportedType = 'recognizeable' | 'intersect' | 'mutate' | 'resize' | 'idle' | 'message' | 'messageerror' | ListenableMediaQuery | keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
189
+ type ListenableMediaQuery = `(${string})`;
190
+ type ListenableMousecombo = `${string}+${ListenableLeftClick | ListenableRightClick}`;
191
+ type ListenableLeftClick = 'click' | 'dblclick' | `mouse${string}`;
192
+ type ListenableRightClick = 'rightclick' | 'contextmenu';
193
+ type ListenablePointercombo = `${string}+${ListenablePointer}`;
194
+ type ListenablePointer = `pointer${string}`;
195
+ type ListenableKeycombo = string;
196
+ type ListenableSupportedEventType = keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
197
+ type ListenableOptions<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = {
198
+ recognizeable?: RecognizeableOptions<Type, RecognizeableMetadata>;
199
+ };
200
+ 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
+ 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 ListenOptions<Type extends ListenableSupportedType> = Type extends 'intersect' ? {
203
+ observer?: IntersectionObserverInit;
204
+ } & ObservationListenOptions : Type extends 'mutate' ? {
205
+ observe?: MutationObserverInit;
206
+ } & ObservationListenOptions : Type extends 'resize' ? {
207
+ observe?: ResizeObserverOptions;
208
+ } & ObservationListenOptions : Type extends 'idle' ? {
209
+ requestIdleCallback?: IdleRequestOptions;
210
+ } : Type extends ('message' | 'messageerror') ? {
211
+ target?: BroadcastChannel;
212
+ } : Type extends ListenableMediaQuery ? {
213
+ instantEffect?: (list: MediaQueryList) => any;
214
+ } : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? EventListenOptions : Type extends keyof Omit<DocumentEventMap, 'resize'> ? EventListenOptions : never;
215
+ type ObservationListenOptions = {
216
+ target?: Element;
217
+ };
218
+ type EventListenOptions = {
219
+ target?: Element | Document | (Window & typeof globalThis);
220
+ addEventListener?: AddEventListenerOptions;
221
+ useCapture?: boolean;
222
+ except?: string[];
223
+ only?: string[];
224
+ };
225
+ type ListenableActive<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = Type extends 'intersect' ? {
226
+ target: Element;
227
+ id: IntersectionObserver;
228
+ } : Type extends 'mutate' ? {
229
+ target: Element;
230
+ id: MutationObserver;
231
+ } : Type extends 'resize' ? {
232
+ target: Element;
233
+ id: ResizeObserver;
234
+ } : Type extends 'idle' ? {
235
+ target: Window & typeof globalThis;
236
+ id: number;
237
+ } : Type extends ('message' | 'messageerror') ? {
238
+ target: BroadcastChannel;
239
+ id: [type: string, effect: (event: MessageEvent) => void];
240
+ } : Type extends ListenableMediaQuery ? {
241
+ target: MediaQueryList;
242
+ id: [type: string, effect: (param: ListenEffectParam<Type>) => void];
243
+ } : Type extends ListenableSupportedEventType ? {
244
+ target: Element | Document;
245
+ id: ListenableActiveEventId<Type>;
246
+ } : {
247
+ id: Listenable<Type, RecognizeableMetadata>;
248
+ };
249
+ type ListenableActiveEventId<Type extends ListenableSupportedEventType> = [
250
+ type: Type,
251
+ exceptAndOnlyEffect: (param: ListenEffectParam<Type>) => void,
252
+ optionsOrUseCapture: AddEventListenerOptions | boolean
253
+ ];
254
+ type ListenableStatus = 'ready' | 'listening' | 'stopped';
255
+ declare class Listenable<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> {
256
+ private computedRecognizeable;
257
+ private recognizeableEffectsKeys;
258
+ private computedActive;
259
+ constructor(type: Type, options?: ListenableOptions<Type, RecognizeableMetadata>);
260
+ private computedStatus;
261
+ private ready;
262
+ get type(): string;
263
+ set type(type: string);
264
+ get status(): ListenableStatus;
265
+ get active(): Set<ListenableActive<Type, RecognizeableMetadata>>;
266
+ get recognizeable(): Recognizeable<Type, RecognizeableMetadata>;
267
+ private computedType;
268
+ private implementation;
269
+ setType(type: string): this;
270
+ listen(effect: ListenEffect<Type>, options?: ListenOptions<Type>): this;
271
+ private intersectionListen;
272
+ private mutationListen;
273
+ private resizeListen;
274
+ private mediaQueryListen;
275
+ private idleListen;
276
+ private messageListen;
277
+ private recognizeableListen;
278
+ private documentEventListen;
279
+ private eventListen;
280
+ private addEventListeners;
281
+ private listening;
282
+ stop(options?: {
283
+ target?: Element | Document | (Window & typeof globalThis);
284
+ }): this;
285
+ private stopped;
286
+ }
287
+
288
+ type BroadcastableOptions = {
289
+ name?: string;
290
+ };
291
+ type BroadcastableStatus = 'ready' | 'broadcasting' | 'broadcasted' | 'errored' | 'stopped';
292
+ declare class Broadcastable<State> {
293
+ private name;
294
+ constructor(state: State, options?: BroadcastableOptions);
295
+ private computedStatus;
296
+ private ready;
297
+ get state(): State;
298
+ set state(state: State);
299
+ get status(): BroadcastableStatus;
300
+ private computedChannel;
301
+ get channel(): BroadcastChannel;
302
+ private computedError;
303
+ get error(): Error;
304
+ private computedState;
305
+ setState(state: State): this;
306
+ broadcast(): this;
307
+ private broadcasting;
308
+ private broadcasted;
309
+ private errored;
310
+ stop(): this;
311
+ private stopped;
312
+ }
313
+ declare function toMessageListenParams<State>(instance: Broadcastable<State>, effect: (event: MessageEvent<State>) => void): Parameters<Listenable<'message'>['listen']>;
314
+
315
+ type CompleteableOptions = {
147
316
  segment?: {
148
317
  from?: 'start' | 'selection' | 'divider';
149
318
  to?: 'end' | 'selection' | 'divider';
@@ -155,8 +324,8 @@ declare type CompleteableOptions = {
155
324
  direction: 'forward' | 'backward' | 'none';
156
325
  };
157
326
  };
158
- declare type CompleteableStatus = 'constructing' | 'ready' | 'completing' | 'completed';
159
- declare type CompleteOptions = {
327
+ type CompleteableStatus = 'constructing' | 'ready' | 'completing' | 'completed';
328
+ type CompleteOptions = {
160
329
  select?: 'completion' | 'completionEnd' | (({ before, completion, after }: {
161
330
  before: string;
162
331
  completion: string;
@@ -210,8 +379,8 @@ declare class Completeable {
210
379
  private completed;
211
380
  }
212
381
 
213
- declare type CopyableOptions = Record<string, never>;
214
- declare type CopyableStatus = 'ready' | 'copying' | 'copied' | 'errored';
382
+ type CopyableOptions = Record<never, never>;
383
+ type CopyableStatus = 'ready' | 'copying' | 'copied' | 'errored';
215
384
  declare class Copyable {
216
385
  private computedIsClipboardText;
217
386
  private copyListenable;
@@ -236,16 +405,16 @@ declare class Copyable {
236
405
  private copying;
237
406
  private copied;
238
407
  private errored;
239
- effectClipboardTextChanges(): void;
408
+ listenForClipboardEvents(): void;
240
409
  stop(): void;
241
410
  }
242
411
 
243
- declare type DelayableOptions = {
412
+ type DelayableOptions = {
244
413
  delay?: number;
245
414
  executions?: number | true;
246
415
  };
247
- declare type DelayableEffect = (timestamp: number) => any;
248
- declare type DelayableStatus = 'ready' | 'delaying' | 'delayed' | 'paused' | 'sought' | 'stopped';
416
+ type DelayableEffect = (timestamp: number) => any;
417
+ type DelayableStatus = 'ready' | 'delaying' | 'delayed' | 'paused' | 'sought' | 'stopped';
249
418
  declare class Delayable {
250
419
  private animateable;
251
420
  constructor(effect: DelayableEffect, options?: DelayableOptions);
@@ -276,11 +445,11 @@ declare class Delayable {
276
445
  private stopped;
277
446
  }
278
447
 
279
- declare type DrawableState = ReturnType<typeof getStroke>;
280
- declare type DrawableOptions = {
448
+ type DrawableState = ReturnType<typeof getStroke>;
449
+ type DrawableOptions = {
281
450
  toD?: (stroke: DrawableState) => string;
282
451
  };
283
- declare type DrawableStatus = 'ready' | 'drawing' | 'drawn';
452
+ type DrawableStatus = 'ready' | 'drawing' | 'drawn';
284
453
  declare class Drawable {
285
454
  private computedD;
286
455
  private toD;
@@ -300,9 +469,9 @@ declare class Drawable {
300
469
  declare function toD(stroke: number[][]): string;
301
470
  declare function toFlattenedD(stroke: number[][]): string;
302
471
 
303
- declare type ResolveableOptions = Record<string, never>;
304
- declare type ResolveableGetPromise<Value> = (...args: any[]) => (Promise<Value> | Promise<Value>[]);
305
- declare type ResolveableStatus = 'ready' | 'resolving' | 'resolved' | 'errored';
472
+ type ResolveableOptions = Record<never, never>;
473
+ type ResolveableGetPromise<Value> = (...args: any[]) => (Promise<Value> | Promise<Value>[]);
474
+ type ResolveableStatus = 'ready' | 'resolving' | 'resolved' | 'errored';
306
475
  declare class Resolveable<Value> {
307
476
  constructor(getPromise: ResolveableGetPromise<Value>, options?: ResolveableOptions);
308
477
  private computedStatus;
@@ -320,9 +489,9 @@ declare class Resolveable<Value> {
320
489
  private errored;
321
490
  }
322
491
 
323
- declare type FetchableOptions = Record<string, never>;
324
- declare type FetchableStatus = 'ready' | 'fetching' | 'fetched' | 'aborted' | 'errored';
325
- declare type FetchOptions = RequestInit | ((api: FetchOptionsApi) => RequestInit);
492
+ type FetchableOptions = Record<never, never>;
493
+ type FetchableStatus = 'ready' | 'fetching' | 'fetched' | 'aborted' | 'errored';
494
+ type FetchOptions = RequestInit | ((api: FetchOptionsApi) => RequestInit);
326
495
  declare class Fetchable {
327
496
  private computedArrayBuffer;
328
497
  private computedBlob;
@@ -339,17 +508,20 @@ declare class Fetchable {
339
508
  get status(): FetchableStatus;
340
509
  get response(): Response;
341
510
  get error(): Error;
342
- get arrayBuffer(): Resolveable<ArrayBuffer> | Promise<Resolveable<ArrayBuffer>>;
343
- get blob(): Resolveable<Blob> | Promise<Resolveable<Blob>>;
344
- get formData(): Resolveable<FormData> | Promise<Resolveable<FormData>>;
345
- get json(): Resolveable<any> | Promise<Resolveable<any>>;
346
- get text(): Resolveable<string> | Promise<Resolveable<string>>;
347
- private getUsedBody;
511
+ get arrayBuffer(): Resolveable<ArrayBuffer>;
512
+ get blob(): Resolveable<Blob>;
513
+ get formData(): Resolveable<FormData>;
514
+ get json(): Resolveable<any>;
515
+ get text(): Resolveable<string>;
348
516
  private computedResource;
349
517
  setResource(resource: string): this;
350
518
  private computedResponse;
351
519
  private computedError;
352
520
  fetch(options?: FetchOptions): Promise<this>;
521
+ private fetching;
522
+ private fetched;
523
+ private aborted;
524
+ private errored;
353
525
  get(options?: FetchOptions): Promise<this>;
354
526
  patch(options?: FetchOptions): Promise<this>;
355
527
  post(options?: FetchOptions): Promise<this>;
@@ -357,7 +529,7 @@ declare class Fetchable {
357
529
  delete(options?: FetchOptions): Promise<this>;
358
530
  abort(): this;
359
531
  }
360
- declare type FetchOptionsApi = {
532
+ type FetchOptionsApi = {
361
533
  withJson: (data: Record<any, any>) => {
362
534
  body: string;
363
535
  headers: {
@@ -367,9 +539,9 @@ declare type FetchOptionsApi = {
367
539
  };
368
540
  };
369
541
 
370
- declare type FullscreenableOptions = Record<string, never>;
371
- declare type FullscreenableGetElement<ElementType> = ((...args: any[]) => ElementType);
372
- declare type FullscreenableStatus = 'ready' | 'fullscreened' | 'errored' | 'exited';
542
+ type FullscreenableOptions = Record<never, never>;
543
+ type FullscreenableGetElement<ElementType> = ((...args: any[]) => ElementType);
544
+ type FullscreenableStatus = 'ready' | 'fullscreened' | 'errored' | 'exited';
373
545
  declare class Fullscreenable<ElementType extends Element> {
374
546
  constructor(getElement: FullscreenableGetElement<ElementType>, options?: FullscreenableOptions);
375
547
  private computedStatus;
@@ -390,8 +562,8 @@ declare class Fullscreenable<ElementType extends Element> {
390
562
  private exited;
391
563
  }
392
564
 
393
- declare type GrantableOptions = Record<string, never>;
394
- declare type GrantableStatus = 'ready' | 'querying' | 'queried' | 'errored';
565
+ type GrantableOptions = Record<never, never>;
566
+ type GrantableStatus = 'ready' | 'querying' | 'queried' | 'errored';
395
567
  declare class Grantable<DescriptorType extends PermissionDescriptor> {
396
568
  constructor(descriptor: DescriptorType, options?: GrantableOptions);
397
569
  private computedStatus;
@@ -409,160 +581,14 @@ declare class Grantable<DescriptorType extends PermissionDescriptor> {
409
581
  private errored;
410
582
  }
411
583
 
412
- declare type RecognizeableOptions<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
413
- maxSequenceLength?: true | number;
414
- effects?: {
415
- [type in Type]?: RecognizeableEffect<type, Metadata>;
416
- };
417
- };
418
- declare type RecognizeableEffect<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = (sequenceItem: ListenEffectParam<Type>, api: RecognizeableEffectApi<Type, Metadata>) => void;
419
- declare type RecognizeableEffectApi<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
420
- getStatus: () => RecognizeableStatus;
421
- getMetadata: () => Metadata;
422
- setMetadata: (metadata: Metadata) => void;
423
- recognized: () => void;
424
- denied: () => void;
425
- getSequence: () => ListenEffectParam<Type>[];
426
- onRecognized: (sequenceItem: ListenEffectParam<Type>) => any;
427
- } & ListenEffectApi<Type>;
428
- declare type RecognizeableStatus = 'recognized' | 'recognizing' | 'denied' | 'ready';
429
- declare type RecognizeOptions<Type extends ListenableSupportedType, Metadata extends Record<any, any>> = {
430
- onRecognized?: (sequenceItem: ListenEffectParam<Type>) => any;
431
- };
432
- declare class Recognizeable<Type extends ListenableSupportedType, Metadata extends Record<any, any>> {
433
- private maxSequenceLength;
434
- private effects;
435
- private effectApi;
436
- constructor(sequence: ListenEffectParam<Type>[], options?: RecognizeableOptions<Type, Metadata>);
437
- private computedMetadata;
438
- private resetComputedMetadata;
439
- private recognized;
440
- private denied;
441
- private computedStatus;
442
- private ready;
443
- get sequence(): ListenEffectParam<Type>[];
444
- set sequence(sequence: ListenEffectParam<Type>[]);
445
- get status(): RecognizeableStatus;
446
- get metadata(): Metadata;
447
- private computedSequence;
448
- setSequence(sequence: ListenEffectParam<Type>[]): this;
449
- recognize(sequenceItem: ListenEffectParam<Type>, api: ListenEffectApi<Type>, { onRecognized }?: RecognizeOptions<Type, Metadata>): this;
450
- private recognizing;
451
- private toType;
452
- }
453
-
454
- declare type ListenableSupportedType = 'recognizeable' | 'intersect' | 'mutate' | 'resize' | 'idle' | ListenableMediaQuery | keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
455
- declare type ListenableMediaQuery = `(${string})`;
456
- declare type ListenableClickcombo = `${string}+${ListenableLeftClick | ListenableRightClick}`;
457
- declare type ListenableLeftClick = 'click' | 'dblclick' | `mouse${string}`;
458
- declare type ListenableRightClick = 'rightclick' | 'contextmenu';
459
- declare type ListenablePointercombo = `${string}+${ListenablePointer}`;
460
- declare type ListenablePointer = `pointer${string}`;
461
- declare type ListenableKeycombo = string;
462
- declare type ListenableSupportedEventType = keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
463
- declare type ListenableOptions<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = {
464
- recognizeable?: RecognizeableOptions<Type, RecognizeableMetadata>;
465
- };
466
- declare 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 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;
467
- declare 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;
468
- declare 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 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;
469
- declare type MouseEventApi = {
470
- is: (clickcombo: ListenableClickcombo) => boolean;
471
- };
472
- declare type PointerEventApi = {
473
- is: (pointercombo: ListenablePointercombo) => boolean;
474
- };
475
- declare type KeyboardEventApi = {
476
- is: (keycombo: ListenableKeycombo) => boolean;
477
- };
478
- declare type ListenOptions<Type extends ListenableSupportedType> = Type extends 'intersect' ? {
479
- observer?: IntersectionObserverInit;
480
- } & ObservationListenOptions : Type extends 'mutate' ? {
481
- observe?: MutationObserverInit;
482
- } & ObservationListenOptions : Type extends 'resize' ? {
483
- observe?: ResizeObserverOptions;
484
- } & ObservationListenOptions : Type extends 'idle' ? {
485
- requestIdleCallback?: IdleRequestOptions;
486
- } : Type extends ListenableMediaQuery ? {
487
- instantEffect?: (list: MediaQueryList) => any;
488
- } : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? EventListenOptions : Type extends keyof Omit<DocumentEventMap, 'resize'> ? EventListenOptions : never;
489
- declare type ObservationListenOptions = {
490
- target?: Element;
491
- };
492
- declare type EventListenOptions = {
493
- target?: Element | Document | (Window & typeof globalThis);
494
- addEventListener?: AddEventListenerOptions;
495
- useCapture?: boolean;
496
- except?: string[];
497
- only?: string[];
498
- };
499
- declare type ListenableActive<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = Type extends 'intersect' ? {
500
- target: Element;
501
- id: IntersectionObserver;
502
- } : Type extends 'mutate' ? {
503
- target: Element;
504
- id: MutationObserver;
505
- } : Type extends 'resize' ? {
506
- target: Element;
507
- id: ResizeObserver;
508
- } : Type extends 'idle' ? {
509
- target: Window & typeof globalThis;
510
- id: number;
511
- } : Type extends ListenableMediaQuery ? {
512
- target: MediaQueryList;
513
- id: [type: string, effect: (param: ListenEffectParam<Type>) => void];
514
- } : Type extends ListenableSupportedEventType ? {
515
- target: Element | Document;
516
- id: ListenableActiveEventId<Type>;
517
- } : {
518
- id: Listenable<Type, RecognizeableMetadata>;
519
- };
520
- declare type ListenableActiveEventId<Type extends ListenableSupportedEventType> = [
521
- type: string,
522
- exceptAndOnlyEffect: (param: ListenEffectParam<Type>) => void,
523
- optionsOrUseCapture: AddEventListenerOptions | boolean
524
- ];
525
- declare type ListenableStatus = 'ready' | 'listening' | 'stopped';
526
- declare class Listenable<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> {
527
- private computedRecognizeable;
528
- private recognizeableEffectsKeys;
529
- private computedActive;
530
- constructor(type: Type, options?: ListenableOptions<Type, RecognizeableMetadata>);
531
- private computedStatus;
532
- private ready;
533
- get type(): string;
534
- set type(type: string);
535
- get status(): ListenableStatus;
536
- get active(): Set<ListenableActive<Type, RecognizeableMetadata>>;
537
- get recognizeable(): Recognizeable<Type, RecognizeableMetadata>;
538
- private computedType;
539
- private implementation;
540
- setType(type: string): this;
541
- listen(effect: ListenEffect<Type>, options?: ListenOptions<Type>): this;
542
- private intersectionListen;
543
- private mutationListen;
544
- private resizeListen;
545
- private mediaQueryListen;
546
- private idleListen;
547
- private recognizeableListen;
548
- private documentEventListen;
549
- private eventListen;
550
- private addEventListeners;
551
- private listening;
552
- stop(options?: {
553
- target?: Element | Document | (Window & typeof globalThis);
554
- }): this;
555
- private stopped;
556
- }
557
-
558
- declare type NavigateableOptions = {
584
+ type NavigateableOptions = {
559
585
  initialLocation?: number;
560
586
  };
561
- declare type NavigateableStatus = 'ready' | 'navigated' | 'navigated to next' | 'navigated to previous' | 'navigated to random' | 'navigated to first' | 'navigated to last';
562
- declare type NavigateOptions = {
587
+ type NavigateableStatus = 'ready' | 'navigated' | 'navigated to next' | 'navigated to previous' | 'navigated to random' | 'navigated to first' | 'navigated to last';
588
+ type NavigateOptions = {
563
589
  allow?: 'possible' | 'any';
564
590
  };
565
- declare type NextAndPreviousOptions = {
591
+ type NextAndPreviousOptions = {
566
592
  distance?: number;
567
593
  loops?: boolean;
568
594
  };
@@ -595,11 +621,11 @@ declare class Navigateable<Item> {
595
621
  private lasted;
596
622
  }
597
623
 
598
- declare type PickableOptions = {
624
+ type PickableOptions = {
599
625
  initialPicks?: number | number[];
600
626
  };
601
- declare type PickableStatus = 'ready' | 'picked' | 'omitted';
602
- declare type PickOptions = {
627
+ type PickableStatus = 'ready' | 'picked' | 'omitted';
628
+ type PickOptions = {
603
629
  replace?: 'none' | 'all' | 'fifo' | 'lifo';
604
630
  allowsDuplicates?: boolean;
605
631
  };
@@ -635,8 +661,8 @@ declare class Pickable<Item> {
635
661
  private omitted;
636
662
  }
637
663
 
638
- declare type SanitizeableOptions = Config;
639
- declare type SanitizeableStatus = 'ready' | 'sanitized';
664
+ type SanitizeableOptions = Config;
665
+ type SanitizeableStatus = 'ready' | 'sanitized';
640
666
  declare class Sanitizeable {
641
667
  private domPurifyConfig;
642
668
  constructor(html: string, options?: Config);
@@ -653,8 +679,8 @@ declare class Sanitizeable {
653
679
  private sanitized;
654
680
  }
655
681
 
656
- declare type SearchableOptions<Item> = FullOptions<Item>;
657
- declare type SearchableStatus = 'ready' | 'searched';
682
+ type SearchableOptions<Item> = FullOptions<Item>;
683
+ type SearchableStatus = 'ready' | 'searched';
658
684
  declare class Searchable<Item extends string | object> {
659
685
  private searcherOptions;
660
686
  private computedResults;
@@ -673,12 +699,33 @@ declare class Searchable<Item extends string | object> {
673
699
  private searched;
674
700
  }
675
701
 
676
- declare type StoreableOptions = {
702
+ type ShareableOptions = Record<never, never>;
703
+ type ShareableStatus = 'ready' | 'sharing' | 'shared' | 'errored';
704
+ declare class Shareable {
705
+ constructor(state: ShareData, options?: ShareableOptions);
706
+ private computedStatus;
707
+ private ready;
708
+ get state(): ShareData;
709
+ set state(state: ShareData);
710
+ get status(): ShareableStatus;
711
+ private computedCan;
712
+ get can(): Resolveable<boolean>;
713
+ private computedError;
714
+ get error(): Error;
715
+ private computedState;
716
+ setState(state: ShareData): this;
717
+ share(): Promise<this>;
718
+ private sharing;
719
+ private shared;
720
+ private errored;
721
+ }
722
+
723
+ type StoreableOptions = {
677
724
  kind?: 'local' | 'session';
678
725
  statusKeySuffix?: string;
679
726
  };
680
- declare type StoreableStatus = 'ready' | 'constructing' | 'stored' | 'errored' | 'removed';
681
- declare class Storeable {
727
+ type StoreableStatus = 'ready' | 'constructing' | 'stored' | 'errored' | 'removed';
728
+ declare class Storeable<String extends string> {
682
729
  private kind;
683
730
  private statusKeySuffix;
684
731
  constructor(key: string, options?: StoreableOptions);
@@ -689,14 +736,14 @@ declare class Storeable {
689
736
  set key(key: string);
690
737
  get status(): StoreableStatus;
691
738
  get storage(): Storage;
692
- get string(): string;
739
+ get string(): String;
693
740
  get error(): Error;
694
741
  private computedKey;
695
742
  private computedStatusKey;
696
743
  setKey(key: string): this;
697
744
  private computedString;
698
745
  private computedError;
699
- store(string: string): this;
746
+ store(string: String): this;
700
747
  private stored;
701
748
  private errored;
702
749
  private storeStatus;
@@ -705,14 +752,14 @@ declare class Storeable {
705
752
  removeStatus(): this;
706
753
  }
707
754
 
708
- declare function createReduceAsync<Item, Accumulator>(accumulate: (accumulator?: Accumulator, item?: Item, index?: number) => Promise<Accumulator>, initialValue?: Accumulator): (array: Item[]) => Promise<Accumulator>;
709
- declare function createReduce<Item, Accumulator>(accumulate: (accumulator?: Accumulator, item?: Item, index?: number) => Accumulator, initialValue?: Accumulator): (array: Item[]) => Accumulator;
710
- declare type ArrayFunctionAsync<Item, Returned> = (array: Item[]) => Promise<Returned>;
711
- declare function createForEachAsync<Item>(forEach: (item?: Item, index?: number) => any): ArrayFunctionAsync<Item, any>;
712
- declare function createMapAsync<Item, Mapped>(transform: (item?: Item, index?: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
713
- declare function createFilterAsync<Item>(condition: (item?: Item, index?: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
714
- declare type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
715
- declare function createDelete<Item>(index: number): ArrayFunction<Item, Item[]>;
755
+ declare function createReduceAsync<Item, Accumulator>(accumulate: (accumulator: Accumulator, item: Item, index: number) => Promise<Accumulator>, initialValue?: Accumulator): (array: Item[]) => Promise<Accumulator>;
756
+ declare function createReduce<Item, Accumulator>(accumulate: (accumulator: Accumulator, item: Item, index: number) => Accumulator, initialValue?: Accumulator): (array: Item[]) => Accumulator;
757
+ type ArrayFunctionAsync<Item, Returned> = (array: Item[]) => Promise<Returned>;
758
+ declare function createForEachAsync<Item>(forEach: (item: Item, index: number) => any): ArrayFunctionAsync<Item, any>;
759
+ declare function createMapAsync<Item, Mapped>(transform: (item: Item, index: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
760
+ declare function createFilterAsync<Item>(condition: (item: Item, index: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
761
+ type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
762
+ declare function createRemove<Item>(index: number): ArrayFunction<Item, Item[]>;
716
763
  declare function createInsert<Item>(item: Item, index: number): ArrayFunction<Item, Item[]>;
717
764
  declare function createReorder<Item>(from: {
718
765
  start: number;
@@ -722,25 +769,31 @@ declare function createSwap<Item>(indices: [number, number]): ArrayFunction<Item
722
769
  declare function createReplace<Item>(index: number, item: Item): ArrayFunction<Item, Item[]>;
723
770
  declare function createUnique<Item>(): ArrayFunction<Item, Item[]>;
724
771
  declare function createSlice<Item>(from: number, to?: number): ArrayFunction<Item, Item[]>;
725
- declare function createFilter<Item>(condition: (item?: Item, index?: number) => boolean): ArrayFunction<Item, Item[]>;
726
- declare function createMap<Item, Transformed = Item>(transform: (item?: Item, index?: number) => Transformed): ArrayFunction<Item, Transformed[]>;
772
+ declare function createFilter<Item>(condition: (item: Item, index: number) => boolean): ArrayFunction<Item, Item[]>;
773
+ declare function createMap<Item, Transformed = Item>(transform: (item: Item, index: number) => Transformed): ArrayFunction<Item, Transformed[]>;
727
774
  declare function createConcat<Item>(...arrays: Item[][]): ArrayFunction<Item, Item[]>;
728
775
  declare function createReverse<Item>(): ArrayFunction<Item, Item[]>;
729
- declare function createSort<Item>(compare: (itemA: Item, itemB: Item) => number): ArrayFunction<Item, Item[]>;
730
- declare type StringFunction<Returned> = (string: string) => Returned;
776
+ declare function createSort<Item>(compare?: (itemA: Item, itemB: Item) => number): ArrayFunction<Item, Item[]>;
777
+ type StringFunction<Returned> = (string: string) => Returned;
731
778
  declare function createSlug(options?: Options): StringFunction<string>;
732
779
  declare function createClip(required: string | RegExp): StringFunction<string>;
733
- declare type NumberFunction<Returned> = (number: number) => Returned;
780
+ type NumberFunction<Returned> = (number: number) => Returned;
734
781
  declare function createClamp(min: number, max: number): NumberFunction<number>;
735
- declare type Potentiality<Outcome> = {
782
+ type Potentiality<Outcome> = {
736
783
  outcome: Outcome;
737
784
  probability: number;
738
785
  };
739
786
  declare function createDetermine<Outcome>(potentialities: Potentiality<Outcome>[]): NumberFunction<Outcome>;
740
- declare type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returned;
787
+ type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returned;
741
788
  declare function createRename<Key, Value>(from: Key, to: Key): MapFunction<Key, Value, Map<Key, Value>>;
742
- declare type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
789
+ type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
743
790
  declare function createToEntries<Key extends string | number | symbol, Value>(): ObjectFunction<Key, Value, [Key, Value][]>;
791
+ type EventFunction<Evt extends Event, Returned> = (event: Evt) => Returned;
792
+ declare function createMatchesKeycombo(keycombo: string): EventFunction<KeyboardEvent, boolean>;
793
+ declare function createMatchesMousecombo(mousecombo: string): EventFunction<MouseEvent, boolean>;
794
+ declare function createMatchesPointercombo(pointercombo: string): EventFunction<PointerEvent, boolean>;
795
+ type ElementFunction<El extends HTMLElement, Returned> = (element: El) => Returned;
796
+ declare function createToFocusable(order: 'first' | 'last', elementIsCandidate?: boolean): ElementFunction<HTMLElement, HTMLElement | undefined>;
744
797
  declare class Pipeable {
745
798
  private state;
746
799
  constructor(state: any);
@@ -748,4 +801,4 @@ declare class Pipeable {
748
801
  pipeAsync(...fns: ((...args: any[]) => Promise<any>)[]): Promise<any>;
749
802
  }
750
803
 
751
- export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, ArrayFunction, ArrayFunctionAsync, 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, 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, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
804
+ 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, 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 };