@baleada/logic 0.20.27 → 0.20.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -172,6 +172,15 @@ function createRename({ from, to }) {
172
172
  return createReduce((renamed, key, index) => renamed.set(key, values[index]), new Map())(newKeys);
173
173
  };
174
174
  }
175
+ function createToEntries() {
176
+ return (object) => {
177
+ const entries = [];
178
+ for (const key in object) {
179
+ entries.push([key, object[key]]);
180
+ }
181
+ return entries;
182
+ };
183
+ }
175
184
  class Pipeable {
176
185
  constructor(state) {
177
186
  this.state = state;
@@ -2719,7 +2728,7 @@ class Grantable {
2719
2728
  const defaultOptions$2 = {
2720
2729
  initialLocation: 0
2721
2730
  };
2722
- const defaultNavigateOptions = { allows: "possible" };
2731
+ const defaultNavigateOptions = { allow: "possible" };
2723
2732
  const defaultNextAndPreviousOptions = {
2724
2733
  distance: 1,
2725
2734
  loops: true
@@ -2760,8 +2769,8 @@ class Navigateable {
2760
2769
  return this;
2761
2770
  }
2762
2771
  navigate(location, options = {}) {
2763
- const { allows } = { ...defaultNavigateOptions, ...options };
2764
- this._navigate(location, { allows });
2772
+ const { allow } = { ...defaultNavigateOptions, ...options };
2773
+ this._navigate(location, { allow });
2765
2774
  this.navigated();
2766
2775
  return this;
2767
2776
  }
@@ -2769,10 +2778,10 @@ class Navigateable {
2769
2778
  this.computedStatus = "navigated";
2770
2779
  }
2771
2780
  _navigate(location, options = {}) {
2772
- const { allows } = { ...defaultNavigateOptions, ...options };
2781
+ const { allow } = { ...defaultNavigateOptions, ...options };
2773
2782
  const ensuredLocation = (() => {
2774
- if (allows === "possible") {
2775
- if (location < 0 && allows === "possible") {
2783
+ if (allow === "possible") {
2784
+ if (location < 0 && allow === "possible") {
2776
2785
  return 0;
2777
2786
  }
2778
2787
  if (location > this.array.length - 1) {
@@ -2784,10 +2793,7 @@ class Navigateable {
2784
2793
  this.computedLocation = ensuredLocation;
2785
2794
  }
2786
2795
  next(options = {}) {
2787
- const { distance, loops, allows } = { ...defaultNextAndPreviousOptions, ...defaultNavigateOptions, ...options }, newLocation = (() => {
2788
- if (allows === "any") {
2789
- return this.location + distance;
2790
- }
2796
+ const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
2791
2797
  const lastLocation = this.array.length - 1;
2792
2798
  if (this.location + distance <= lastLocation) {
2793
2799
  return this.location + distance;
@@ -2803,7 +2809,7 @@ class Navigateable {
2803
2809
  return newLocation2;
2804
2810
  })();
2805
2811
  })();
2806
- this._navigate(newLocation, { allows });
2812
+ this._navigate(newLocation);
2807
2813
  this.nexted();
2808
2814
  return this;
2809
2815
  }
@@ -2811,10 +2817,7 @@ class Navigateable {
2811
2817
  this.computedStatus = "navigated to next";
2812
2818
  }
2813
2819
  previous(options = {}) {
2814
- const { distance, loops, allows } = { ...defaultNextAndPreviousOptions, ...defaultNavigateOptions, ...options }, newLocation = (() => {
2815
- if (allows === "any") {
2816
- return this.location - distance;
2817
- }
2820
+ const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
2818
2821
  if (this.location - distance >= 0) {
2819
2822
  return this.location - distance;
2820
2823
  }
@@ -2829,7 +2832,7 @@ class Navigateable {
2829
2832
  return newLocation2;
2830
2833
  })();
2831
2834
  })();
2832
- this._navigate(newLocation, { allows });
2835
+ this._navigate(newLocation);
2833
2836
  this.previoused();
2834
2837
  return this;
2835
2838
  }
@@ -2923,7 +2926,7 @@ class Pickable {
2923
2926
  if (replace === "all") {
2924
2927
  return toUnique(possiblePicks);
2925
2928
  }
2926
- const possibleWithoutDuplicates = createFilter((possiblePick) => !lazyCollections.find((pick) => pick === possiblePick)(this.picks || []))(possiblePicks);
2929
+ const possibleWithoutDuplicates = createFilter((possiblePick) => typeof lazyCollections.find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
2927
2930
  switch (replace) {
2928
2931
  case "none":
2929
2932
  return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
@@ -3218,6 +3221,7 @@ exports.createReverse = createReverse;
3218
3221
  exports.createSlice = createSlice;
3219
3222
  exports.createSlug = createSlug;
3220
3223
  exports.createSwap = createSwap;
3224
+ exports.createToEntries = createToEntries;
3221
3225
  exports.createUnique = createUnique;
3222
3226
  exports.easingsNetInBack = easingsNetInBack;
3223
3227
  exports.easingsNetInCirc = easingsNetInCirc;
package/lib/index.d.ts CHANGED
@@ -705,7 +705,7 @@ declare type NavigateableOptions = {
705
705
  };
706
706
  declare type NavigateableStatus = 'ready' | 'navigated' | 'navigated to next' | 'navigated to previous' | 'navigated to random' | 'navigated to first' | 'navigated to last';
707
707
  declare type NavigateOptions = {
708
- allows?: 'possible' | 'any';
708
+ allow?: 'possible' | 'any';
709
709
  };
710
710
  declare type NextAndPreviousOptions = {
711
711
  distance?: number;
@@ -728,9 +728,9 @@ declare class Navigateable<Item> {
728
728
  navigate(location: number, options?: NavigateOptions): this;
729
729
  private navigated;
730
730
  private _navigate;
731
- next(options?: NextAndPreviousOptions & NavigateOptions): this;
731
+ next(options?: NextAndPreviousOptions): this;
732
732
  private nexted;
733
- previous(options?: NextAndPreviousOptions & NavigateOptions): this;
733
+ previous(options?: NextAndPreviousOptions): this;
734
734
  private previoused;
735
735
  random(): this;
736
736
  private randomed;
@@ -905,6 +905,8 @@ declare function createRename<Key, Value>({ from, to }: {
905
905
  from: Key;
906
906
  to: Key;
907
907
  }): MapFunction<Key, Value, Map<Key, Value>>;
908
+ declare type ObjectFunction<Key extends string | number | symbol, Value, Returned> = (transform: Record<Key, Value>) => Returned;
909
+ declare function createToEntries<Key extends string | number | symbol, Value>(): ObjectFunction<Key, Value, [Key, Value][]>;
908
910
  declare class Pipeable {
909
911
  private state;
910
912
  constructor(state: any);
@@ -912,4 +914,4 @@ declare class Pipeable {
912
914
  pipeAsync(...fns: ((...args: any[]) => Promise<any>)[]): Promise<any>;
913
915
  }
914
916
 
915
- export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, ArrayFunction, ArrayFunctionAsync, CompleteOptions, Completeable, CompleteableOptions, CompleteableStatus, Copyable, CopyableOptions, CopyableStatus, Delayable, DelayableEffect, DelayableOptions, DelayableStatus, DispatchOptions, Dispatchable, DispatchableOptions, DispatchableStatus, Drawable, DrawableOptions, DrawableState, DrawableStatus, FetchOptions, FetchOptionsApi, Fetchable, FetchableOptions, FetchableStatus, Fullscreenable, FullscreenableGetElement, FullscreenableOptions, FullscreenableStatus, Grantable, GrantableOptions, GrantableStatus, ListenEffect, ListenEffectParam, ListenOptions, Listenable, ListenableActive, ListenableClickcombo, ListenableKeycombo, ListenableKeycomboItem, ListenableOptions, ListenablePointercombo, ListenableStatus, ListenableSupportedEventType, ListenableSupportedType, MapFunction, Navigateable, NavigateableOptions, NavigateableStatus, NumberFunction, Pickable, PickableOptions, PickableStatus, Pipeable, RecognizeOptions, Recognizeable, RecognizeableEffectApi, 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, createSwap, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
917
+ export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, ArrayFunction, ArrayFunctionAsync, CompleteOptions, Completeable, CompleteableOptions, CompleteableStatus, Copyable, CopyableOptions, CopyableStatus, Delayable, DelayableEffect, DelayableOptions, DelayableStatus, DispatchOptions, Dispatchable, DispatchableOptions, DispatchableStatus, Drawable, DrawableOptions, DrawableState, DrawableStatus, FetchOptions, FetchOptionsApi, Fetchable, FetchableOptions, FetchableStatus, Fullscreenable, FullscreenableGetElement, FullscreenableOptions, FullscreenableStatus, Grantable, GrantableOptions, GrantableStatus, ListenEffect, ListenEffectParam, ListenOptions, Listenable, ListenableActive, ListenableClickcombo, ListenableKeycombo, ListenableKeycomboItem, ListenableOptions, ListenablePointercombo, ListenableStatus, ListenableSupportedEventType, ListenableSupportedType, MapFunction, Navigateable, NavigateableOptions, NavigateableStatus, NumberFunction, ObjectFunction, Pickable, PickableOptions, PickableStatus, Pipeable, RecognizeOptions, Recognizeable, RecognizeableEffectApi, 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, 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, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
package/lib/index.js CHANGED
@@ -161,6 +161,15 @@ function createRename({ from, to }) {
161
161
  return createReduce((renamed, key, index) => renamed.set(key, values[index]), new Map())(newKeys);
162
162
  };
163
163
  }
164
+ function createToEntries() {
165
+ return (object) => {
166
+ const entries = [];
167
+ for (const key in object) {
168
+ entries.push([key, object[key]]);
169
+ }
170
+ return entries;
171
+ };
172
+ }
164
173
  class Pipeable {
165
174
  constructor(state) {
166
175
  this.state = state;
@@ -2708,7 +2717,7 @@ class Grantable {
2708
2717
  const defaultOptions$2 = {
2709
2718
  initialLocation: 0
2710
2719
  };
2711
- const defaultNavigateOptions = { allows: "possible" };
2720
+ const defaultNavigateOptions = { allow: "possible" };
2712
2721
  const defaultNextAndPreviousOptions = {
2713
2722
  distance: 1,
2714
2723
  loops: true
@@ -2749,8 +2758,8 @@ class Navigateable {
2749
2758
  return this;
2750
2759
  }
2751
2760
  navigate(location, options = {}) {
2752
- const { allows } = { ...defaultNavigateOptions, ...options };
2753
- this._navigate(location, { allows });
2761
+ const { allow } = { ...defaultNavigateOptions, ...options };
2762
+ this._navigate(location, { allow });
2754
2763
  this.navigated();
2755
2764
  return this;
2756
2765
  }
@@ -2758,10 +2767,10 @@ class Navigateable {
2758
2767
  this.computedStatus = "navigated";
2759
2768
  }
2760
2769
  _navigate(location, options = {}) {
2761
- const { allows } = { ...defaultNavigateOptions, ...options };
2770
+ const { allow } = { ...defaultNavigateOptions, ...options };
2762
2771
  const ensuredLocation = (() => {
2763
- if (allows === "possible") {
2764
- if (location < 0 && allows === "possible") {
2772
+ if (allow === "possible") {
2773
+ if (location < 0 && allow === "possible") {
2765
2774
  return 0;
2766
2775
  }
2767
2776
  if (location > this.array.length - 1) {
@@ -2773,10 +2782,7 @@ class Navigateable {
2773
2782
  this.computedLocation = ensuredLocation;
2774
2783
  }
2775
2784
  next(options = {}) {
2776
- const { distance, loops, allows } = { ...defaultNextAndPreviousOptions, ...defaultNavigateOptions, ...options }, newLocation = (() => {
2777
- if (allows === "any") {
2778
- return this.location + distance;
2779
- }
2785
+ const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
2780
2786
  const lastLocation = this.array.length - 1;
2781
2787
  if (this.location + distance <= lastLocation) {
2782
2788
  return this.location + distance;
@@ -2792,7 +2798,7 @@ class Navigateable {
2792
2798
  return newLocation2;
2793
2799
  })();
2794
2800
  })();
2795
- this._navigate(newLocation, { allows });
2801
+ this._navigate(newLocation);
2796
2802
  this.nexted();
2797
2803
  return this;
2798
2804
  }
@@ -2800,10 +2806,7 @@ class Navigateable {
2800
2806
  this.computedStatus = "navigated to next";
2801
2807
  }
2802
2808
  previous(options = {}) {
2803
- const { distance, loops, allows } = { ...defaultNextAndPreviousOptions, ...defaultNavigateOptions, ...options }, newLocation = (() => {
2804
- if (allows === "any") {
2805
- return this.location - distance;
2806
- }
2809
+ const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
2807
2810
  if (this.location - distance >= 0) {
2808
2811
  return this.location - distance;
2809
2812
  }
@@ -2818,7 +2821,7 @@ class Navigateable {
2818
2821
  return newLocation2;
2819
2822
  })();
2820
2823
  })();
2821
- this._navigate(newLocation, { allows });
2824
+ this._navigate(newLocation);
2822
2825
  this.previoused();
2823
2826
  return this;
2824
2827
  }
@@ -2912,7 +2915,7 @@ class Pickable {
2912
2915
  if (replace === "all") {
2913
2916
  return toUnique(possiblePicks);
2914
2917
  }
2915
- const possibleWithoutDuplicates = createFilter((possiblePick) => !find((pick) => pick === possiblePick)(this.picks || []))(possiblePicks);
2918
+ const possibleWithoutDuplicates = createFilter((possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
2916
2919
  switch (replace) {
2917
2920
  case "none":
2918
2921
  return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
@@ -3169,4 +3172,4 @@ class Storeable {
3169
3172
  }
3170
3173
  }
3171
3174
 
3172
- export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSwap, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
3175
+ export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, 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, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baleada/logic",
3
- "version": "0.20.27",
3
+ "version": "0.20.31",
4
4
  "description": "UI logic for the Baleada toolkit",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",