@baleada/logic 0.22.2 → 0.22.4

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 +392 -148
  2. package/lib/index.d.ts +265 -208
  3. package/lib/index.js +386 -136
  4. package/package.json +20 -20
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,186 @@ 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
+ } & ListenEffectApi<Type>;
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>, api: ListenEffectApi<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 ListenableClickcombo = `${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>, 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;
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 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
+ type ListenOptions<Type extends ListenableSupportedType> = Type extends 'intersect' ? {
213
+ observer?: IntersectionObserverInit;
214
+ } & ObservationListenOptions : Type extends 'mutate' ? {
215
+ observe?: MutationObserverInit;
216
+ } & ObservationListenOptions : Type extends 'resize' ? {
217
+ observe?: ResizeObserverOptions;
218
+ } & ObservationListenOptions : Type extends 'idle' ? {
219
+ requestIdleCallback?: IdleRequestOptions;
220
+ } : Type extends ('message' | 'messageerror') ? {
221
+ target?: BroadcastChannel;
222
+ } : Type extends ListenableMediaQuery ? {
223
+ instantEffect?: (list: MediaQueryList) => any;
224
+ } : Type extends keyof Omit<HTMLElementEventMap, 'resize'> ? EventListenOptions : Type extends keyof Omit<DocumentEventMap, 'resize'> ? EventListenOptions : never;
225
+ type ObservationListenOptions = {
226
+ target?: Element;
227
+ };
228
+ type EventListenOptions = {
229
+ target?: Element | Document | (Window & typeof globalThis);
230
+ addEventListener?: AddEventListenerOptions;
231
+ useCapture?: boolean;
232
+ except?: string[];
233
+ only?: string[];
234
+ };
235
+ type ListenableActive<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = Type extends 'intersect' ? {
236
+ target: Element;
237
+ id: IntersectionObserver;
238
+ } : Type extends 'mutate' ? {
239
+ target: Element;
240
+ id: MutationObserver;
241
+ } : Type extends 'resize' ? {
242
+ target: Element;
243
+ id: ResizeObserver;
244
+ } : Type extends 'idle' ? {
245
+ target: Window & typeof globalThis;
246
+ id: number;
247
+ } : Type extends ('message' | 'messageerror') ? {
248
+ target: BroadcastChannel;
249
+ id: [type: string, effect: (event: MessageEvent) => void];
250
+ } : Type extends ListenableMediaQuery ? {
251
+ target: MediaQueryList;
252
+ id: [type: string, effect: (param: ListenEffectParam<Type>) => void];
253
+ } : Type extends ListenableSupportedEventType ? {
254
+ target: Element | Document;
255
+ id: ListenableActiveEventId<Type>;
256
+ } : {
257
+ id: Listenable<Type, RecognizeableMetadata>;
258
+ };
259
+ type ListenableActiveEventId<Type extends ListenableSupportedEventType> = [
260
+ type: Type,
261
+ exceptAndOnlyEffect: (param: ListenEffectParam<Type>) => void,
262
+ optionsOrUseCapture: AddEventListenerOptions | boolean
263
+ ];
264
+ type ListenableStatus = 'ready' | 'listening' | 'stopped';
265
+ declare class Listenable<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> {
266
+ private computedRecognizeable;
267
+ private recognizeableEffectsKeys;
268
+ private computedActive;
269
+ constructor(type: Type, options?: ListenableOptions<Type, RecognizeableMetadata>);
270
+ private computedStatus;
271
+ private ready;
272
+ get type(): string;
273
+ set type(type: string);
274
+ get status(): ListenableStatus;
275
+ get active(): Set<ListenableActive<Type, RecognizeableMetadata>>;
276
+ get recognizeable(): Recognizeable<Type, RecognizeableMetadata>;
277
+ private computedType;
278
+ private implementation;
279
+ setType(type: string): this;
280
+ listen(effect: ListenEffect<Type>, options?: ListenOptions<Type>): this;
281
+ private intersectionListen;
282
+ private mutationListen;
283
+ private resizeListen;
284
+ private mediaQueryListen;
285
+ private idleListen;
286
+ private messageListen;
287
+ private recognizeableListen;
288
+ private documentEventListen;
289
+ private eventListen;
290
+ private addEventListeners;
291
+ private listening;
292
+ stop(options?: {
293
+ target?: Element | Document | (Window & typeof globalThis);
294
+ }): this;
295
+ private stopped;
296
+ }
297
+
298
+ type BroadcastableOptions = {
299
+ name?: string;
300
+ };
301
+ type BroadcastableStatus = 'ready' | 'broadcasting' | 'broadcasted' | 'errored' | 'stopped';
302
+ declare class Broadcastable<State> {
303
+ private name;
304
+ constructor(state: State, options?: BroadcastableOptions);
305
+ private computedStatus;
306
+ private ready;
307
+ get state(): State;
308
+ set state(state: State);
309
+ get status(): BroadcastableStatus;
310
+ private computedChannel;
311
+ get channel(): BroadcastChannel;
312
+ private computedError;
313
+ get error(): Error;
314
+ private computedState;
315
+ setState(state: State): this;
316
+ broadcast(): this;
317
+ private broadcasting;
318
+ private broadcasted;
319
+ private errored;
320
+ stop(): this;
321
+ private stopped;
322
+ }
323
+ declare function toMessageListenParams<State>(instance: Broadcastable<State>, effect: (event: MessageEvent<State>, api: Parameters<ListenEffect<'message'>>[1]) => void): Parameters<Listenable<'message'>['listen']>;
324
+
325
+ type CompleteableOptions = {
147
326
  segment?: {
148
327
  from?: 'start' | 'selection' | 'divider';
149
328
  to?: 'end' | 'selection' | 'divider';
@@ -155,8 +334,8 @@ declare type CompleteableOptions = {
155
334
  direction: 'forward' | 'backward' | 'none';
156
335
  };
157
336
  };
158
- declare type CompleteableStatus = 'constructing' | 'ready' | 'completing' | 'completed';
159
- declare type CompleteOptions = {
337
+ type CompleteableStatus = 'constructing' | 'ready' | 'completing' | 'completed';
338
+ type CompleteOptions = {
160
339
  select?: 'completion' | 'completionEnd' | (({ before, completion, after }: {
161
340
  before: string;
162
341
  completion: string;
@@ -210,8 +389,8 @@ declare class Completeable {
210
389
  private completed;
211
390
  }
212
391
 
213
- declare type CopyableOptions = Record<string, never>;
214
- declare type CopyableStatus = 'ready' | 'copying' | 'copied' | 'errored';
392
+ type CopyableOptions = Record<never, never>;
393
+ type CopyableStatus = 'ready' | 'copying' | 'copied' | 'errored';
215
394
  declare class Copyable {
216
395
  private computedIsClipboardText;
217
396
  private copyListenable;
@@ -236,16 +415,16 @@ declare class Copyable {
236
415
  private copying;
237
416
  private copied;
238
417
  private errored;
239
- effectClipboardTextChanges(): void;
418
+ listenForClipboardEvents(): void;
240
419
  stop(): void;
241
420
  }
242
421
 
243
- declare type DelayableOptions = {
422
+ type DelayableOptions = {
244
423
  delay?: number;
245
424
  executions?: number | true;
246
425
  };
247
- declare type DelayableEffect = (timestamp: number) => any;
248
- declare type DelayableStatus = 'ready' | 'delaying' | 'delayed' | 'paused' | 'sought' | 'stopped';
426
+ type DelayableEffect = (timestamp: number) => any;
427
+ type DelayableStatus = 'ready' | 'delaying' | 'delayed' | 'paused' | 'sought' | 'stopped';
249
428
  declare class Delayable {
250
429
  private animateable;
251
430
  constructor(effect: DelayableEffect, options?: DelayableOptions);
@@ -276,11 +455,11 @@ declare class Delayable {
276
455
  private stopped;
277
456
  }
278
457
 
279
- declare type DrawableState = ReturnType<typeof getStroke>;
280
- declare type DrawableOptions = {
458
+ type DrawableState = ReturnType<typeof getStroke>;
459
+ type DrawableOptions = {
281
460
  toD?: (stroke: DrawableState) => string;
282
461
  };
283
- declare type DrawableStatus = 'ready' | 'drawing' | 'drawn';
462
+ type DrawableStatus = 'ready' | 'drawing' | 'drawn';
284
463
  declare class Drawable {
285
464
  private computedD;
286
465
  private toD;
@@ -300,9 +479,9 @@ declare class Drawable {
300
479
  declare function toD(stroke: number[][]): string;
301
480
  declare function toFlattenedD(stroke: number[][]): string;
302
481
 
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';
482
+ type ResolveableOptions = Record<never, never>;
483
+ type ResolveableGetPromise<Value> = (...args: any[]) => (Promise<Value> | Promise<Value>[]);
484
+ type ResolveableStatus = 'ready' | 'resolving' | 'resolved' | 'errored';
306
485
  declare class Resolveable<Value> {
307
486
  constructor(getPromise: ResolveableGetPromise<Value>, options?: ResolveableOptions);
308
487
  private computedStatus;
@@ -320,9 +499,9 @@ declare class Resolveable<Value> {
320
499
  private errored;
321
500
  }
322
501
 
323
- declare type FetchableOptions = Record<string, never>;
324
- declare type FetchableStatus = 'ready' | 'fetching' | 'fetched' | 'aborted' | 'errored';
325
- declare type FetchOptions = RequestInit | ((api: FetchOptionsApi) => RequestInit);
502
+ type FetchableOptions = Record<never, never>;
503
+ type FetchableStatus = 'ready' | 'fetching' | 'fetched' | 'aborted' | 'errored';
504
+ type FetchOptions = RequestInit | ((api: FetchOptionsApi) => RequestInit);
326
505
  declare class Fetchable {
327
506
  private computedArrayBuffer;
328
507
  private computedBlob;
@@ -339,17 +518,20 @@ declare class Fetchable {
339
518
  get status(): FetchableStatus;
340
519
  get response(): Response;
341
520
  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;
521
+ get arrayBuffer(): Resolveable<ArrayBuffer>;
522
+ get blob(): Resolveable<Blob>;
523
+ get formData(): Resolveable<FormData>;
524
+ get json(): Resolveable<any>;
525
+ get text(): Resolveable<string>;
348
526
  private computedResource;
349
527
  setResource(resource: string): this;
350
528
  private computedResponse;
351
529
  private computedError;
352
530
  fetch(options?: FetchOptions): Promise<this>;
531
+ private fetching;
532
+ private fetched;
533
+ private aborted;
534
+ private errored;
353
535
  get(options?: FetchOptions): Promise<this>;
354
536
  patch(options?: FetchOptions): Promise<this>;
355
537
  post(options?: FetchOptions): Promise<this>;
@@ -357,7 +539,7 @@ declare class Fetchable {
357
539
  delete(options?: FetchOptions): Promise<this>;
358
540
  abort(): this;
359
541
  }
360
- declare type FetchOptionsApi = {
542
+ type FetchOptionsApi = {
361
543
  withJson: (data: Record<any, any>) => {
362
544
  body: string;
363
545
  headers: {
@@ -367,9 +549,9 @@ declare type FetchOptionsApi = {
367
549
  };
368
550
  };
369
551
 
370
- declare type FullscreenableOptions = Record<string, never>;
371
- declare type FullscreenableGetElement<ElementType> = ((...args: any[]) => ElementType);
372
- declare type FullscreenableStatus = 'ready' | 'fullscreened' | 'errored' | 'exited';
552
+ type FullscreenableOptions = Record<never, never>;
553
+ type FullscreenableGetElement<ElementType> = ((...args: any[]) => ElementType);
554
+ type FullscreenableStatus = 'ready' | 'fullscreened' | 'errored' | 'exited';
373
555
  declare class Fullscreenable<ElementType extends Element> {
374
556
  constructor(getElement: FullscreenableGetElement<ElementType>, options?: FullscreenableOptions);
375
557
  private computedStatus;
@@ -390,8 +572,8 @@ declare class Fullscreenable<ElementType extends Element> {
390
572
  private exited;
391
573
  }
392
574
 
393
- declare type GrantableOptions = Record<string, never>;
394
- declare type GrantableStatus = 'ready' | 'querying' | 'queried' | 'errored';
575
+ type GrantableOptions = Record<never, never>;
576
+ type GrantableStatus = 'ready' | 'querying' | 'queried' | 'errored';
395
577
  declare class Grantable<DescriptorType extends PermissionDescriptor> {
396
578
  constructor(descriptor: DescriptorType, options?: GrantableOptions);
397
579
  private computedStatus;
@@ -409,160 +591,14 @@ declare class Grantable<DescriptorType extends PermissionDescriptor> {
409
591
  private errored;
410
592
  }
411
593
 
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' | 'mousedown' | 'mouseup' | 'dblclick';
458
- declare type ListenableRightClick = 'rightclick' | 'contextmenu';
459
- declare type ListenablePointercombo = `${string}+${ListenablePointer}`;
460
- declare type ListenablePointer = 'pointerdown' | 'pointerup';
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 = {
594
+ type NavigateableOptions = {
559
595
  initialLocation?: number;
560
596
  };
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 = {
597
+ type NavigateableStatus = 'ready' | 'navigated' | 'navigated to next' | 'navigated to previous' | 'navigated to random' | 'navigated to first' | 'navigated to last';
598
+ type NavigateOptions = {
563
599
  allow?: 'possible' | 'any';
564
600
  };
565
- declare type NextAndPreviousOptions = {
601
+ type NextAndPreviousOptions = {
566
602
  distance?: number;
567
603
  loops?: boolean;
568
604
  };
@@ -595,11 +631,11 @@ declare class Navigateable<Item> {
595
631
  private lasted;
596
632
  }
597
633
 
598
- declare type PickableOptions = {
634
+ type PickableOptions = {
599
635
  initialPicks?: number | number[];
600
636
  };
601
- declare type PickableStatus = 'ready' | 'picked' | 'omitted';
602
- declare type PickOptions = {
637
+ type PickableStatus = 'ready' | 'picked' | 'omitted';
638
+ type PickOptions = {
603
639
  replace?: 'none' | 'all' | 'fifo' | 'lifo';
604
640
  allowsDuplicates?: boolean;
605
641
  };
@@ -635,8 +671,8 @@ declare class Pickable<Item> {
635
671
  private omitted;
636
672
  }
637
673
 
638
- declare type SanitizeableOptions = Config;
639
- declare type SanitizeableStatus = 'ready' | 'sanitized';
674
+ type SanitizeableOptions = Config;
675
+ type SanitizeableStatus = 'ready' | 'sanitized';
640
676
  declare class Sanitizeable {
641
677
  private domPurifyConfig;
642
678
  constructor(html: string, options?: Config);
@@ -653,8 +689,8 @@ declare class Sanitizeable {
653
689
  private sanitized;
654
690
  }
655
691
 
656
- declare type SearchableOptions<Item> = FullOptions<Item>;
657
- declare type SearchableStatus = 'ready' | 'searched';
692
+ type SearchableOptions<Item> = FullOptions<Item>;
693
+ type SearchableStatus = 'ready' | 'searched';
658
694
  declare class Searchable<Item extends string | object> {
659
695
  private searcherOptions;
660
696
  private computedResults;
@@ -673,12 +709,33 @@ declare class Searchable<Item extends string | object> {
673
709
  private searched;
674
710
  }
675
711
 
676
- declare type StoreableOptions = {
712
+ type ShareableOptions = Record<never, never>;
713
+ type ShareableStatus = 'ready' | 'sharing' | 'shared' | 'errored';
714
+ declare class Shareable {
715
+ constructor(state: ShareData, options?: ShareableOptions);
716
+ private computedStatus;
717
+ private ready;
718
+ get state(): ShareData;
719
+ set state(state: ShareData);
720
+ get status(): ShareableStatus;
721
+ private computedCan;
722
+ get can(): Resolveable<boolean>;
723
+ private computedError;
724
+ get error(): Error;
725
+ private computedState;
726
+ setState(state: ShareData): this;
727
+ share(): Promise<this>;
728
+ private sharing;
729
+ private shared;
730
+ private errored;
731
+ }
732
+
733
+ type StoreableOptions = {
677
734
  kind?: 'local' | 'session';
678
735
  statusKeySuffix?: string;
679
736
  };
680
- declare type StoreableStatus = 'ready' | 'constructing' | 'stored' | 'errored' | 'removed';
681
- declare class Storeable {
737
+ type StoreableStatus = 'ready' | 'constructing' | 'stored' | 'errored' | 'removed';
738
+ declare class Storeable<String extends string> {
682
739
  private kind;
683
740
  private statusKeySuffix;
684
741
  constructor(key: string, options?: StoreableOptions);
@@ -689,14 +746,14 @@ declare class Storeable {
689
746
  set key(key: string);
690
747
  get status(): StoreableStatus;
691
748
  get storage(): Storage;
692
- get string(): string;
749
+ get string(): String;
693
750
  get error(): Error;
694
751
  private computedKey;
695
752
  private computedStatusKey;
696
753
  setKey(key: string): this;
697
754
  private computedString;
698
755
  private computedError;
699
- store(string: string): this;
756
+ store(string: String): this;
700
757
  private stored;
701
758
  private errored;
702
759
  private storeStatus;
@@ -707,11 +764,11 @@ declare class Storeable {
707
764
 
708
765
  declare function createReduceAsync<Item, Accumulator>(accumulate: (accumulator?: Accumulator, item?: Item, index?: number) => Promise<Accumulator>, initialValue?: Accumulator): (array: Item[]) => Promise<Accumulator>;
709
766
  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>;
767
+ type ArrayFunctionAsync<Item, Returned> = (array: Item[]) => Promise<Returned>;
711
768
  declare function createForEachAsync<Item>(forEach: (item?: Item, index?: number) => any): ArrayFunctionAsync<Item, any>;
712
769
  declare function createMapAsync<Item, Mapped>(transform: (item?: Item, index?: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
713
770
  declare function createFilterAsync<Item>(condition: (item?: Item, index?: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
714
- declare type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
771
+ type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
715
772
  declare function createDelete<Item>(index: number): ArrayFunction<Item, Item[]>;
716
773
  declare function createInsert<Item>(item: Item, index: number): ArrayFunction<Item, Item[]>;
717
774
  declare function createReorder<Item>(from: {
@@ -726,20 +783,20 @@ declare function createFilter<Item>(condition: (item?: Item, index?: number) =>
726
783
  declare function createMap<Item, Transformed = Item>(transform: (item?: Item, index?: number) => Transformed): ArrayFunction<Item, Transformed[]>;
727
784
  declare function createConcat<Item>(...arrays: Item[][]): ArrayFunction<Item, Item[]>;
728
785
  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;
786
+ declare function createSort<Item>(compare?: (itemA: Item, itemB: Item) => number): ArrayFunction<Item, Item[]>;
787
+ type StringFunction<Returned> = (string: string) => Returned;
731
788
  declare function createSlug(options?: Options): StringFunction<string>;
732
789
  declare function createClip(required: string | RegExp): StringFunction<string>;
733
- declare type NumberFunction<Returned> = (number: number) => Returned;
790
+ type NumberFunction<Returned> = (number: number) => Returned;
734
791
  declare function createClamp(min: number, max: number): NumberFunction<number>;
735
- declare type Potentiality<Outcome> = {
792
+ type Potentiality<Outcome> = {
736
793
  outcome: Outcome;
737
794
  probability: number;
738
795
  };
739
796
  declare function createDetermine<Outcome>(potentialities: Potentiality<Outcome>[]): NumberFunction<Outcome>;
740
- declare type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returned;
797
+ type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returned;
741
798
  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;
799
+ type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
743
800
  declare function createToEntries<Key extends string | number | symbol, Value>(): ObjectFunction<Key, Value, [Key, Value][]>;
744
801
  declare class Pipeable {
745
802
  private state;
@@ -748,4 +805,4 @@ declare class Pipeable {
748
805
  pipeAsync(...fns: ((...args: any[]) => Promise<any>)[]): Promise<any>;
749
806
  }
750
807
 
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 };
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 };