@baleada/logic 0.22.5 → 0.22.7
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/README.md +1 -1
- package/lib/index.cjs +66 -10
- package/lib/index.d.ts +12 -4
- package/lib/index.js +64 -11
- package/package.json +4 -4
package/README.md
CHANGED
package/lib/index.cjs
CHANGED
|
@@ -41,9 +41,9 @@ function createMapAsync(transform) {
|
|
|
41
41
|
)(array);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function createFilterAsync(
|
|
44
|
+
function createFilterAsync(predicate) {
|
|
45
45
|
return async (array) => {
|
|
46
|
-
const transformedAsync = await createMapAsync(
|
|
46
|
+
const transformedAsync = await createMapAsync(predicate)(array);
|
|
47
47
|
return createFilter((_, index) => transformedAsync[index])(array);
|
|
48
48
|
};
|
|
49
49
|
}
|
|
@@ -141,9 +141,9 @@ function createSlice(from, to) {
|
|
|
141
141
|
)(array);
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function createFilter(
|
|
144
|
+
function createFilter(predicate) {
|
|
145
145
|
return (array) => lazyCollections.pipe(
|
|
146
|
-
lazyCollections.filter(
|
|
146
|
+
lazyCollections.filter(predicate),
|
|
147
147
|
lazyCollections.toArray()
|
|
148
148
|
)(array);
|
|
149
149
|
}
|
|
@@ -220,6 +220,35 @@ function createToEntries() {
|
|
|
220
220
|
return entries;
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
+
function createToKeys() {
|
|
224
|
+
return (object) => {
|
|
225
|
+
const keys = [];
|
|
226
|
+
for (const key in object) {
|
|
227
|
+
keys.push(key);
|
|
228
|
+
}
|
|
229
|
+
return keys;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function createToSome(predicate) {
|
|
233
|
+
return (object) => {
|
|
234
|
+
for (const key in object) {
|
|
235
|
+
if (predicate(key, object[key])) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function createToEvery(predicate) {
|
|
243
|
+
return (object) => {
|
|
244
|
+
for (const key in object) {
|
|
245
|
+
if (!predicate(key, object[key])) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return true;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
223
252
|
function createMatchesKeycombo(keycombo) {
|
|
224
253
|
return (event) => eventMatchesKeycombo(event, narrowKeycombo(keycombo));
|
|
225
254
|
}
|
|
@@ -500,7 +529,10 @@ class Recognizeable {
|
|
|
500
529
|
getMetadata: () => this.metadata,
|
|
501
530
|
setMetadata: (metadata) => this.computedMetadata = metadata,
|
|
502
531
|
recognized: () => this.recognized(),
|
|
503
|
-
denied: () => this.denied()
|
|
532
|
+
denied: () => this.denied(),
|
|
533
|
+
recognizedUntilReady: () => this.recognizedUntilReady(),
|
|
534
|
+
deniedUntilReady: () => this.deniedUntilReady(),
|
|
535
|
+
ready: () => this.ready()
|
|
504
536
|
};
|
|
505
537
|
this.ready();
|
|
506
538
|
}
|
|
@@ -514,6 +546,12 @@ class Recognizeable {
|
|
|
514
546
|
denied() {
|
|
515
547
|
this.computedStatus = "denied";
|
|
516
548
|
}
|
|
549
|
+
recognizedUntilReady() {
|
|
550
|
+
this.computedStatus = "recognized until ready";
|
|
551
|
+
}
|
|
552
|
+
deniedUntilReady() {
|
|
553
|
+
this.computedStatus = "denied until ready";
|
|
554
|
+
}
|
|
517
555
|
computedStatus;
|
|
518
556
|
ready() {
|
|
519
557
|
this.computedStatus = "ready";
|
|
@@ -536,7 +574,8 @@ class Recognizeable {
|
|
|
536
574
|
return this;
|
|
537
575
|
}
|
|
538
576
|
recognize(sequenceItem, { onRecognized } = {}) {
|
|
539
|
-
this.
|
|
577
|
+
if (!this.status.includes("until ready"))
|
|
578
|
+
this.recognizing();
|
|
540
579
|
const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
|
|
541
580
|
createSlice(excess)(this.sequence),
|
|
542
581
|
[sequenceItem]
|
|
@@ -546,7 +585,9 @@ class Recognizeable {
|
|
|
546
585
|
});
|
|
547
586
|
this.effects.get(type)?.(sequenceItem, { ...this.effectApi });
|
|
548
587
|
switch (this.status) {
|
|
588
|
+
case "ready":
|
|
549
589
|
case "denied":
|
|
590
|
+
case "denied until ready":
|
|
550
591
|
this.resetComputedMetadata();
|
|
551
592
|
this.setSequence([]);
|
|
552
593
|
break;
|
|
@@ -690,10 +731,23 @@ class Listenable {
|
|
|
690
731
|
this.active.add({ target, id: [this.type, effect] });
|
|
691
732
|
}
|
|
692
733
|
recognizeableListen(effect, options) {
|
|
734
|
+
let effectStatus = "ready";
|
|
693
735
|
const guardedEffect = (sequenceItem) => {
|
|
694
736
|
this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
|
|
695
|
-
|
|
696
|
-
|
|
737
|
+
switch (this.recognizeable.status) {
|
|
738
|
+
case "recognized until ready":
|
|
739
|
+
if (effectStatus === "ready") {
|
|
740
|
+
effect(sequenceItem);
|
|
741
|
+
effectStatus = "performed";
|
|
742
|
+
}
|
|
743
|
+
break;
|
|
744
|
+
case "recognized":
|
|
745
|
+
effect(sequenceItem);
|
|
746
|
+
effectStatus = "ready";
|
|
747
|
+
break;
|
|
748
|
+
default:
|
|
749
|
+
effectStatus = "ready";
|
|
750
|
+
break;
|
|
697
751
|
}
|
|
698
752
|
};
|
|
699
753
|
for (const type of this.recognizeableEffectsKeys) {
|
|
@@ -834,9 +888,8 @@ function eventMatchesKeycombo(event, keycombo) {
|
|
|
834
888
|
return lazyCollections.every(({ name, type }, index) => {
|
|
835
889
|
switch (type) {
|
|
836
890
|
case "singleCharacter":
|
|
837
|
-
if (name === "!")
|
|
891
|
+
if (name === "!")
|
|
838
892
|
return event.key === "!";
|
|
839
|
-
}
|
|
840
893
|
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
841
894
|
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
842
895
|
case "other":
|
|
@@ -3288,7 +3341,10 @@ exports.createSlug = createSlug;
|
|
|
3288
3341
|
exports.createSort = createSort;
|
|
3289
3342
|
exports.createSwap = createSwap;
|
|
3290
3343
|
exports.createToEntries = createToEntries;
|
|
3344
|
+
exports.createToEvery = createToEvery;
|
|
3291
3345
|
exports.createToFocusable = createToFocusable;
|
|
3346
|
+
exports.createToKeys = createToKeys;
|
|
3347
|
+
exports.createToSome = createToSome;
|
|
3292
3348
|
exports.createUnique = createUnique;
|
|
3293
3349
|
exports.easingsNetInBack = easingsNetInBack;
|
|
3294
3350
|
exports.easingsNetInCirc = easingsNetInCirc;
|
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
164
|
};
|
|
162
|
-
type RecognizeableStatus = 'recognized' | 'recognizing' | 'denied' | 'ready';
|
|
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>[];
|
|
@@ -757,7 +762,7 @@ declare function createReduce<Item, Accumulator>(accumulate: (accumulator: Accum
|
|
|
757
762
|
type ArrayFunctionAsync<Item, Returned> = (array: Item[]) => Promise<Returned>;
|
|
758
763
|
declare function createForEachAsync<Item>(forEach: (item: Item, index: number) => any): ArrayFunctionAsync<Item, any>;
|
|
759
764
|
declare function createMapAsync<Item, Mapped>(transform: (item: Item, index: number) => Promise<Mapped>): ArrayFunctionAsync<Item, Mapped[]>;
|
|
760
|
-
declare function createFilterAsync<Item>(
|
|
765
|
+
declare function createFilterAsync<Item>(predicate: (item: Item, index: number) => Promise<boolean>): ArrayFunctionAsync<Item, Item[]>;
|
|
761
766
|
type ArrayFunction<Item, Returned> = (array: Item[]) => Returned;
|
|
762
767
|
declare function createRemove<Item>(index: number): ArrayFunction<Item, Item[]>;
|
|
763
768
|
declare function createInsert<Item>(item: Item, index: number): ArrayFunction<Item, Item[]>;
|
|
@@ -769,7 +774,7 @@ declare function createSwap<Item>(indices: [number, number]): ArrayFunction<Item
|
|
|
769
774
|
declare function createReplace<Item>(index: number, item: Item): ArrayFunction<Item, Item[]>;
|
|
770
775
|
declare function createUnique<Item>(): ArrayFunction<Item, Item[]>;
|
|
771
776
|
declare function createSlice<Item>(from: number, to?: number): ArrayFunction<Item, Item[]>;
|
|
772
|
-
declare function createFilter<Item>(
|
|
777
|
+
declare function createFilter<Item>(predicate: (item: Item, index: number) => boolean): ArrayFunction<Item, Item[]>;
|
|
773
778
|
declare function createMap<Item, Transformed = Item>(transform: (item: Item, index: number) => Transformed): ArrayFunction<Item, Transformed[]>;
|
|
774
779
|
declare function createConcat<Item>(...arrays: Item[][]): ArrayFunction<Item, Item[]>;
|
|
775
780
|
declare function createReverse<Item>(): ArrayFunction<Item, Item[]>;
|
|
@@ -788,6 +793,9 @@ type MapFunction<Key, Value, Returned> = (transform: Map<Key, Value>) => Returne
|
|
|
788
793
|
declare function createRename<Key, Value>(from: Key, to: Key): MapFunction<Key, Value, Map<Key, Value>>;
|
|
789
794
|
type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
|
|
790
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
|
+
declare function createToSome<Key extends string | number | symbol, Value>(predicate: (key: Key, value: Value) => unknown): ObjectFunction<Key, Value, boolean>;
|
|
798
|
+
declare function createToEvery<Key extends string | number | symbol, Value>(predicate: (key: Key, value: Value) => unknown): ObjectFunction<Key, Value, boolean>;
|
|
791
799
|
type EventFunction<Evt extends Event, Returned> = (event: Evt) => Returned;
|
|
792
800
|
declare function createMatchesKeycombo(keycombo: string): EventFunction<KeyboardEvent, boolean>;
|
|
793
801
|
declare function createMatchesMousecombo(mousecombo: string): EventFunction<MouseEvent, boolean>;
|
|
@@ -801,4 +809,4 @@ declare class Pipeable {
|
|
|
801
809
|
pipeAsync(...fns: ((...args: any[]) => Promise<any>)[]): Promise<any>;
|
|
802
810
|
}
|
|
803
811
|
|
|
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 };
|
|
812
|
+
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, createToEvery, createToFocusable, createToKeys, createToSome, 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 };
|
package/lib/index.js
CHANGED
|
@@ -39,9 +39,9 @@ function createMapAsync(transform) {
|
|
|
39
39
|
)(array);
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function createFilterAsync(
|
|
42
|
+
function createFilterAsync(predicate) {
|
|
43
43
|
return async (array) => {
|
|
44
|
-
const transformedAsync = await createMapAsync(
|
|
44
|
+
const transformedAsync = await createMapAsync(predicate)(array);
|
|
45
45
|
return createFilter((_, index) => transformedAsync[index])(array);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -139,9 +139,9 @@ function createSlice(from, to) {
|
|
|
139
139
|
)(array);
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function createFilter(
|
|
142
|
+
function createFilter(predicate) {
|
|
143
143
|
return (array) => pipe(
|
|
144
|
-
filter(
|
|
144
|
+
filter(predicate),
|
|
145
145
|
toArray()
|
|
146
146
|
)(array);
|
|
147
147
|
}
|
|
@@ -218,6 +218,35 @@ function createToEntries() {
|
|
|
218
218
|
return entries;
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
+
function createToKeys() {
|
|
222
|
+
return (object) => {
|
|
223
|
+
const keys = [];
|
|
224
|
+
for (const key in object) {
|
|
225
|
+
keys.push(key);
|
|
226
|
+
}
|
|
227
|
+
return keys;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function createToSome(predicate) {
|
|
231
|
+
return (object) => {
|
|
232
|
+
for (const key in object) {
|
|
233
|
+
if (predicate(key, object[key])) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return false;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function createToEvery(predicate) {
|
|
241
|
+
return (object) => {
|
|
242
|
+
for (const key in object) {
|
|
243
|
+
if (!predicate(key, object[key])) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
221
250
|
function createMatchesKeycombo(keycombo) {
|
|
222
251
|
return (event) => eventMatchesKeycombo(event, narrowKeycombo(keycombo));
|
|
223
252
|
}
|
|
@@ -498,7 +527,10 @@ class Recognizeable {
|
|
|
498
527
|
getMetadata: () => this.metadata,
|
|
499
528
|
setMetadata: (metadata) => this.computedMetadata = metadata,
|
|
500
529
|
recognized: () => this.recognized(),
|
|
501
|
-
denied: () => this.denied()
|
|
530
|
+
denied: () => this.denied(),
|
|
531
|
+
recognizedUntilReady: () => this.recognizedUntilReady(),
|
|
532
|
+
deniedUntilReady: () => this.deniedUntilReady(),
|
|
533
|
+
ready: () => this.ready()
|
|
502
534
|
};
|
|
503
535
|
this.ready();
|
|
504
536
|
}
|
|
@@ -512,6 +544,12 @@ class Recognizeable {
|
|
|
512
544
|
denied() {
|
|
513
545
|
this.computedStatus = "denied";
|
|
514
546
|
}
|
|
547
|
+
recognizedUntilReady() {
|
|
548
|
+
this.computedStatus = "recognized until ready";
|
|
549
|
+
}
|
|
550
|
+
deniedUntilReady() {
|
|
551
|
+
this.computedStatus = "denied until ready";
|
|
552
|
+
}
|
|
515
553
|
computedStatus;
|
|
516
554
|
ready() {
|
|
517
555
|
this.computedStatus = "ready";
|
|
@@ -534,7 +572,8 @@ class Recognizeable {
|
|
|
534
572
|
return this;
|
|
535
573
|
}
|
|
536
574
|
recognize(sequenceItem, { onRecognized } = {}) {
|
|
537
|
-
this.
|
|
575
|
+
if (!this.status.includes("until ready"))
|
|
576
|
+
this.recognizing();
|
|
538
577
|
const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
|
|
539
578
|
createSlice(excess)(this.sequence),
|
|
540
579
|
[sequenceItem]
|
|
@@ -544,7 +583,9 @@ class Recognizeable {
|
|
|
544
583
|
});
|
|
545
584
|
this.effects.get(type)?.(sequenceItem, { ...this.effectApi });
|
|
546
585
|
switch (this.status) {
|
|
586
|
+
case "ready":
|
|
547
587
|
case "denied":
|
|
588
|
+
case "denied until ready":
|
|
548
589
|
this.resetComputedMetadata();
|
|
549
590
|
this.setSequence([]);
|
|
550
591
|
break;
|
|
@@ -688,10 +729,23 @@ class Listenable {
|
|
|
688
729
|
this.active.add({ target, id: [this.type, effect] });
|
|
689
730
|
}
|
|
690
731
|
recognizeableListen(effect, options) {
|
|
732
|
+
let effectStatus = "ready";
|
|
691
733
|
const guardedEffect = (sequenceItem) => {
|
|
692
734
|
this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
|
|
693
|
-
|
|
694
|
-
|
|
735
|
+
switch (this.recognizeable.status) {
|
|
736
|
+
case "recognized until ready":
|
|
737
|
+
if (effectStatus === "ready") {
|
|
738
|
+
effect(sequenceItem);
|
|
739
|
+
effectStatus = "performed";
|
|
740
|
+
}
|
|
741
|
+
break;
|
|
742
|
+
case "recognized":
|
|
743
|
+
effect(sequenceItem);
|
|
744
|
+
effectStatus = "ready";
|
|
745
|
+
break;
|
|
746
|
+
default:
|
|
747
|
+
effectStatus = "ready";
|
|
748
|
+
break;
|
|
695
749
|
}
|
|
696
750
|
};
|
|
697
751
|
for (const type of this.recognizeableEffectsKeys) {
|
|
@@ -832,9 +886,8 @@ function eventMatchesKeycombo(event, keycombo) {
|
|
|
832
886
|
return every(({ name, type }, index) => {
|
|
833
887
|
switch (type) {
|
|
834
888
|
case "singleCharacter":
|
|
835
|
-
if (name === "!")
|
|
889
|
+
if (name === "!")
|
|
836
890
|
return event.key === "!";
|
|
837
|
-
}
|
|
838
891
|
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
839
892
|
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
840
893
|
case "other":
|
|
@@ -3242,4 +3295,4 @@ class Storeable {
|
|
|
3242
3295
|
}
|
|
3243
3296
|
}
|
|
3244
3297
|
|
|
3245
|
-
export { Animateable, Broadcastable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Shareable, Storeable, 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 };
|
|
3298
|
+
export { Animateable, Broadcastable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Shareable, Storeable, 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, createToEvery, createToFocusable, createToKeys, createToSome, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baleada/logic",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.7",
|
|
4
4
|
"description": "UI logic for the Baleada toolkit",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"bugs": {
|
|
42
42
|
"url": "https://github.com/baleada/logic/issues"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://baleada.
|
|
44
|
+
"homepage": "https://baleada.dev",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@baleada/prepare": "^0.5.
|
|
46
|
+
"@baleada/prepare": "^0.5.30",
|
|
47
47
|
"@types/node": "^14.14.41",
|
|
48
48
|
"@vitejs/plugin-vue": "^3.2.0",
|
|
49
49
|
"esbuild": "^0.15.13",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/runtime": "^7.20.6",
|
|
61
|
-
"@sindresorhus/slugify": "^2.
|
|
61
|
+
"@sindresorhus/slugify": "^2.2.0",
|
|
62
62
|
"@snigo.dev/color": "^0.0.6",
|
|
63
63
|
"@types/dompurify": "^2.4.0",
|
|
64
64
|
"@types/requestidlecallback": "^0.3.5",
|