@baleada/logic 0.20.34 → 0.21.2

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reduce, pipe, filter, toArray, findIndex, slice, concat, unique, map, find, some, join, every } from 'lazy-collections';
1
+ import { reduce, pipe, filter, toArray, slice, concat, unique, map, find, findIndex, some, join, every } from 'lazy-collections';
2
2
  import slugify from '@sindresorhus/slugify';
3
3
  import BezierEasing from 'bezier-easing';
4
4
  import { mix } from '@snigo.dev/color';
@@ -39,34 +39,30 @@ function createFilterAsync(condition) {
39
39
  return createFilter((_, index) => transformedAsync[index])(array);
40
40
  };
41
41
  }
42
- function createDelete(required) {
42
+ function createDelete(index) {
43
43
  return (array) => {
44
- const deleteIndex = "index" in required ? required.index : findIndex((element) => element === required?.item)(array);
45
- return createConcat(createSlice({ from: 0, to: deleteIndex })(array), createSlice({ from: deleteIndex + 1 })(array))([]);
44
+ return createConcat(createSlice(0, index)(array), createSlice(index + 1)(array))([]);
46
45
  };
47
46
  }
48
- function createInsert(required) {
47
+ function createInsert(item, index) {
49
48
  return (array) => {
50
- const itemsToInsert = "items" in required ? required.items : [required.item], withItems = createConcat(array, itemsToInsert)([]);
51
- return createReorder({
52
- from: { start: array.length, itemCount: itemsToInsert.length },
53
- to: required.index
54
- })(withItems);
49
+ const withItems = createConcat(array, [item])([]);
50
+ return createReorder({ start: array.length, itemCount: 1 }, index)(withItems);
55
51
  };
56
52
  }
57
- function createReorder({ from, to }) {
53
+ function createReorder(from, to) {
58
54
  return (array) => {
59
55
  const [itemsToMoveStartIndex, itemsToMoveCount] = isObject(from) ? [from.start, from.itemCount] : [from, 1], insertIndex = to;
60
56
  if (insertIndex > itemsToMoveStartIndex && insertIndex < itemsToMoveStartIndex + itemsToMoveCount) {
61
57
  return array;
62
58
  }
63
- const itemsToMove = createSlice({ from: itemsToMoveStartIndex, to: itemsToMoveStartIndex + itemsToMoveCount })(array);
59
+ const itemsToMove = createSlice(itemsToMoveStartIndex, itemsToMoveStartIndex + itemsToMoveCount)(array);
64
60
  if (itemsToMoveStartIndex < insertIndex) {
65
- const beforeItemsToMove = itemsToMoveStartIndex === 0 ? [] : createSlice({ from: 0, to: itemsToMoveStartIndex })(array), betweenItemsToMoveAndInsertIndex = createSlice({ from: itemsToMoveStartIndex + itemsToMoveCount, to: insertIndex + 1 })(array), afterInsertIndex = createSlice({ from: insertIndex + 1 })(array);
61
+ const beforeItemsToMove = itemsToMoveStartIndex === 0 ? [] : createSlice(0, itemsToMoveStartIndex)(array), betweenItemsToMoveAndInsertIndex = createSlice(itemsToMoveStartIndex + itemsToMoveCount, insertIndex + 1)(array), afterInsertIndex = createSlice(insertIndex + 1)(array);
66
62
  return createConcat(beforeItemsToMove, betweenItemsToMoveAndInsertIndex, itemsToMove, afterInsertIndex)([]);
67
63
  }
68
64
  if (itemsToMoveStartIndex > insertIndex) {
69
- const beforeInsertion = insertIndex === 0 ? [] : createSlice({ from: 0, to: insertIndex })(array), betweenInsertionAndItemsToMove = createSlice({ from: insertIndex, to: itemsToMoveStartIndex })(array), afterItemsToMove = createSlice({ from: itemsToMoveStartIndex + itemsToMoveCount })(array);
65
+ const beforeInsertion = insertIndex === 0 ? [] : createSlice(0, insertIndex)(array), betweenInsertionAndItemsToMove = createSlice(insertIndex, itemsToMoveStartIndex)(array), afterItemsToMove = createSlice(itemsToMoveStartIndex + itemsToMoveCount)(array);
70
66
  return createConcat(beforeInsertion, itemsToMove, betweenInsertionAndItemsToMove, afterItemsToMove)([]);
71
67
  }
72
68
  return array;
@@ -75,19 +71,19 @@ function createReorder({ from, to }) {
75
71
  function isObject(value) {
76
72
  return typeof value === "object";
77
73
  }
78
- function createSwap({ indices }) {
74
+ function createSwap(indices) {
79
75
  return (array) => {
80
76
  const { 0: from, 1: to } = indices, { reorderFrom, reorderTo } = (() => {
81
77
  if (from < to) {
82
78
  return {
83
- reorderFrom: createReorder({ from, to }),
84
- reorderTo: createReorder({ from: to - 1, to: from })
79
+ reorderFrom: createReorder(from, to),
80
+ reorderTo: createReorder(to - 1, from)
85
81
  };
86
82
  }
87
83
  if (from > to) {
88
84
  return {
89
- reorderFrom: createReorder({ from, to }),
90
- reorderTo: createReorder({ from: to + 1, to: from })
85
+ reorderFrom: createReorder(from, to),
86
+ reorderTo: createReorder(to + 1, from)
91
87
  };
92
88
  }
93
89
  return {
@@ -98,15 +94,15 @@ function createSwap({ indices }) {
98
94
  return new Pipeable(array).pipe(reorderFrom, reorderTo);
99
95
  };
100
96
  }
101
- function createReplace({ index, item }) {
97
+ function createReplace(index, item) {
102
98
  return (array) => {
103
- return createConcat(createSlice({ from: 0, to: index })(array), [item], createSlice({ from: index + 1 })(array))([]);
99
+ return createConcat(createSlice(0, index)(array), [item], createSlice(index + 1)(array))([]);
104
100
  };
105
101
  }
106
102
  function createUnique() {
107
103
  return (array) => pipe(unique(), toArray())(array);
108
104
  }
109
- function createSlice({ from, to }) {
105
+ function createSlice(from, to) {
110
106
  return (array) => {
111
107
  return from === to ? [] : pipe(slice(from, to - 1), toArray())(array);
112
108
  };
@@ -131,7 +127,7 @@ function createReverse() {
131
127
  }
132
128
  function createSort(compare) {
133
129
  return (array) => {
134
- return new Pipeable(array).pipe(createSlice({ from: 0 }), (sliced) => sliced.sort(compare));
130
+ return new Pipeable(array).pipe(createSlice(0), (sliced) => sliced.sort(compare));
135
131
  };
136
132
  }
137
133
  function createSlug(options) {
@@ -144,7 +140,7 @@ function createClip(required) {
144
140
  return string.replace(required, "");
145
141
  };
146
142
  }
147
- function createClamp({ min, max }) {
143
+ function createClamp(min, max) {
148
144
  return (number) => {
149
145
  const maxed = Math.max(number, min);
150
146
  return Math.min(maxed, max);
@@ -160,9 +156,9 @@ function createDetermine(potentialities) {
160
156
  })(potentialities);
161
157
  return (determinant) => find(({ predicate }) => predicate(determinant))(predicates).outcome;
162
158
  }
163
- function createRename({ from, to }) {
159
+ function createRename(from, to) {
164
160
  return (map2) => {
165
- const keys = [...map2.keys()], keyToRenameIndex = findIndex((k) => k === from)(keys), newKeys = createReplace({ index: keyToRenameIndex, item: to })(keys), values = [...map2.values()];
161
+ const keys = [...map2.keys()], keyToRenameIndex = findIndex((k) => k === from)(keys), newKeys = createReplace(keyToRenameIndex, to)(keys), values = [...map2.values()];
166
162
  return createReduce((renamed, key, index) => renamed.set(key, values[index]), /* @__PURE__ */ new Map())(newKeys);
167
163
  };
168
164
  }
@@ -187,239 +183,6 @@ class Pipeable {
187
183
  }
188
184
  }
189
185
 
190
- function toEvent(eventType, options) {
191
- const implementation = toImplementation(eventType);
192
- switch (implementation) {
193
- case "keycombo": {
194
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
195
- return new KeyboardEvent("keyDirection" in options ? `key${options.keyDirection}` : "keydown", {
196
- ...options.init || {},
197
- key: toKey(name),
198
- ...createReduce((flags, alias) => {
199
- flags[toModifierFlag(alias)] = true;
200
- return flags;
201
- }, {})(modifiers)
202
- });
203
- }
204
- case "leftclickcombo":
205
- case "rightclickcombo": {
206
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
207
- return new MouseEvent(name === "rightclick" ? "contextmenu" : name, {
208
- ...options.init || {},
209
- ...createReduce((flags, alias) => {
210
- flags[toModifierFlag(alias)] = true;
211
- return flags;
212
- }, {})(modifiers)
213
- });
214
- }
215
- case "pointercombo": {
216
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
217
- return new PointerEvent(name === "rightclick" ? "contextmenu" : name, {
218
- ...options.init || {},
219
- ...createReduce((flags, alias) => {
220
- flags[toModifierFlag(alias)] = true;
221
- return flags;
222
- }, {})(modifiers)
223
- });
224
- }
225
- case "documentevent":
226
- case "event":
227
- if (eventType === "abort")
228
- return new UIEvent(eventType, options.init);
229
- if (eventType === "animationcancel")
230
- return new AnimationEvent(eventType, options.init);
231
- if (eventType === "animationend")
232
- return new AnimationEvent(eventType, options.init);
233
- if (eventType === "animationiteration")
234
- return new AnimationEvent(eventType, options.init);
235
- if (eventType === "animationstart")
236
- return new AnimationEvent(eventType, options.init);
237
- if (eventType === "auxclick")
238
- return new MouseEvent(eventType, options.init);
239
- if (eventType === "beforeinput")
240
- return new InputEvent(eventType, options.init);
241
- if (eventType === "blur")
242
- return new FocusEvent(eventType, options.init);
243
- if (eventType === "canplay")
244
- return new Event(eventType, options.init);
245
- if (eventType === "canplaythrough")
246
- return new Event(eventType, options.init);
247
- if (eventType === "change")
248
- return new Event(eventType, options.init);
249
- if (eventType === "click")
250
- return new MouseEvent(eventType, options.init);
251
- if (eventType === "close")
252
- return new Event(eventType, options.init);
253
- if (eventType === "compositionend")
254
- return new CompositionEvent(eventType, options.init);
255
- if (eventType === "compositionstart")
256
- return new CompositionEvent(eventType, options.init);
257
- if (eventType === "compositionupdate")
258
- return new CompositionEvent(eventType, options.init);
259
- if (eventType === "contextmenu")
260
- return new MouseEvent(eventType, options.init);
261
- if (eventType === "cuechange")
262
- return new Event(eventType, options.init);
263
- if (eventType === "dblclick")
264
- return new MouseEvent(eventType, options.init);
265
- if (eventType === "drag")
266
- return new DragEvent(eventType, options.init);
267
- if (eventType === "dragend")
268
- return new DragEvent(eventType, options.init);
269
- if (eventType === "dragenter")
270
- return new DragEvent(eventType, options.init);
271
- if (eventType === "dragleave")
272
- return new DragEvent(eventType, options.init);
273
- if (eventType === "dragover")
274
- return new DragEvent(eventType, options.init);
275
- if (eventType === "dragstart")
276
- return new DragEvent(eventType, options.init);
277
- if (eventType === "drop")
278
- return new DragEvent(eventType, options.init);
279
- if (eventType === "durationchange")
280
- return new Event(eventType, options.init);
281
- if (eventType === "emptied")
282
- return new Event(eventType, options.init);
283
- if (eventType === "ended")
284
- return new Event(eventType, options.init);
285
- if (eventType === "error")
286
- return new ErrorEvent(eventType, options.init);
287
- if (eventType === "focus")
288
- return new FocusEvent(eventType, options.init);
289
- if (eventType === "focusin")
290
- return new FocusEvent(eventType, options.init);
291
- if (eventType === "focusout")
292
- return new FocusEvent(eventType, options.init);
293
- if (eventType === "gotpointercapture")
294
- return new PointerEvent(eventType, options.init);
295
- if (eventType === "input")
296
- return new Event(eventType, options.init);
297
- if (eventType === "invalid")
298
- return new Event(eventType, options.init);
299
- if (eventType === "keydown")
300
- return new KeyboardEvent(eventType, options.init);
301
- if (eventType === "keypress")
302
- return new KeyboardEvent(eventType, options.init);
303
- if (eventType === "keyup")
304
- return new KeyboardEvent(eventType, options.init);
305
- if (eventType === "load")
306
- return new Event(eventType, options.init);
307
- if (eventType === "loadeddata")
308
- return new Event(eventType, options.init);
309
- if (eventType === "loadedmetadata")
310
- return new Event(eventType, options.init);
311
- if (eventType === "loadstart")
312
- return new Event(eventType, options.init);
313
- if (eventType === "lostpointercapture")
314
- return new PointerEvent(eventType, options.init);
315
- if (eventType === "mousedown")
316
- return new MouseEvent(eventType, options.init);
317
- if (eventType === "mouseenter")
318
- return new MouseEvent(eventType, options.init);
319
- if (eventType === "mouseleave")
320
- return new MouseEvent(eventType, options.init);
321
- if (eventType === "mousemove")
322
- return new MouseEvent(eventType, options.init);
323
- if (eventType === "mouseout")
324
- return new MouseEvent(eventType, options.init);
325
- if (eventType === "mouseover")
326
- return new MouseEvent(eventType, options.init);
327
- if (eventType === "mouseup")
328
- return new MouseEvent(eventType, options.init);
329
- if (eventType === "pause")
330
- return new Event(eventType, options.init);
331
- if (eventType === "play")
332
- return new Event(eventType, options.init);
333
- if (eventType === "playing")
334
- return new Event(eventType, options.init);
335
- if (eventType === "pointercancel")
336
- return new PointerEvent(eventType, options.init);
337
- if (eventType === "pointerdown")
338
- return new PointerEvent(eventType, options.init);
339
- if (eventType === "pointerenter")
340
- return new PointerEvent(eventType, options.init);
341
- if (eventType === "pointerleave")
342
- return new PointerEvent(eventType, options.init);
343
- if (eventType === "pointermove")
344
- return new PointerEvent(eventType, options.init);
345
- if (eventType === "pointerout")
346
- return new PointerEvent(eventType, options.init);
347
- if (eventType === "pointerover")
348
- return new PointerEvent(eventType, options.init);
349
- if (eventType === "pointerup")
350
- return new PointerEvent(eventType, options.init);
351
- if (eventType === "progress")
352
- return new ProgressEvent(eventType, options.init);
353
- if (eventType === "ratechange")
354
- return new Event(eventType, options.init);
355
- if (eventType === "reset")
356
- return new Event(eventType, options.init);
357
- if (eventType === "scroll")
358
- return new Event(eventType, options.init);
359
- if (eventType === "securitypolicyviolation")
360
- return new SecurityPolicyViolationEvent(eventType, options.init);
361
- if (eventType === "seeked")
362
- return new Event(eventType, options.init);
363
- if (eventType === "seeking")
364
- return new Event(eventType, options.init);
365
- if (eventType === "select")
366
- return new Event(eventType, options.init);
367
- if (eventType === "selectionchange")
368
- return new Event(eventType, options.init);
369
- if (eventType === "selectstart")
370
- return new Event(eventType, options.init);
371
- if (eventType === "stalled")
372
- return new Event(eventType, options.init);
373
- if (eventType === "submit")
374
- return new Event(eventType, options.init);
375
- if (eventType === "suspend")
376
- return new Event(eventType, options.init);
377
- if (eventType === "timeupdate")
378
- return new Event(eventType, options.init);
379
- if (eventType === "toggle")
380
- return new Event(eventType, options.init);
381
- if (eventType === "touchcancel")
382
- return new TouchEvent(eventType, options.init);
383
- if (eventType === "touchend")
384
- return new TouchEvent(eventType, options.init);
385
- if (eventType === "touchmove")
386
- return new TouchEvent(eventType, options.init);
387
- if (eventType === "touchstart")
388
- return new TouchEvent(eventType, options.init);
389
- if (eventType === "transitioncancel")
390
- return new TransitionEvent(eventType, options.init);
391
- if (eventType === "transitionend")
392
- return new TransitionEvent(eventType, options.init);
393
- if (eventType === "transitionrun")
394
- return new TransitionEvent(eventType, options.init);
395
- if (eventType === "transitionstart")
396
- return new TransitionEvent(eventType, options.init);
397
- if (eventType === "volumechange")
398
- return new Event(eventType, options.init);
399
- if (eventType === "waiting")
400
- return new Event(eventType, options.init);
401
- if (eventType === "wheel")
402
- return new WheelEvent(eventType, options.init);
403
- if (eventType === "copy")
404
- return new ClipboardEvent(eventType, options.init);
405
- if (eventType === "cut")
406
- return new ClipboardEvent(eventType, options.init);
407
- if (eventType === "paste")
408
- return new ClipboardEvent(eventType, options.init);
409
- if (eventType === "fullscreenchange")
410
- return new Event(eventType, options.init);
411
- if (eventType === "fullscreenerror")
412
- return new Event(eventType, options.init);
413
- if (eventType === "pointerlockchange")
414
- return new Event(eventType, options.init);
415
- if (eventType === "pointerlockerror")
416
- return new Event(eventType, options.init);
417
- if (eventType === "readystatechange")
418
- return new Event(eventType, options.init);
419
- if (eventType === "visibilitychange")
420
- return new Event(eventType, options.init);
421
- }
422
- }
423
186
  function toKey(name) {
424
187
  return name in keysByName ? keysByName[name] : name;
425
188
  }
@@ -517,20 +280,6 @@ const modifiersByAlias = {
517
280
  opt: "alt",
518
281
  option: "alt"
519
282
  };
520
- function toModifierFlag(modifierOrAlias) {
521
- return flagsByModifierOrAlias[modifierOrAlias];
522
- }
523
- const flagsByModifierOrAlias = {
524
- shift: "shiftKey",
525
- cmd: "metaKey",
526
- command: "metaKey",
527
- meta: "metaKey",
528
- ctrl: "ctrlKey",
529
- control: "ctrlKey",
530
- alt: "altKey",
531
- opt: "altKey",
532
- option: "altKey"
533
- };
534
283
  function createExceptAndOnlyEffect(effect, options) {
535
284
  const { except = [], only = [] } = options;
536
285
  return (event) => {
@@ -646,7 +395,7 @@ class Recognizeable {
646
395
  }
647
396
  recognize(sequenceItem, { onRecognized } = {}) {
648
397
  this.recognizing();
649
- const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(createSlice({ from: excess })(this.sequence), [sequenceItem])([]);
398
+ const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(createSlice(excess)(this.sequence), [sequenceItem])([]);
650
399
  this.effectApi.sequenceItem = sequenceItem;
651
400
  this.effectApi.getSequence = () => newSequence;
652
401
  this.effectApi.onRecognized = onRecognized || (() => {
@@ -1851,7 +1600,7 @@ function toInterpolated({ previous, next, progress }, options = {}) {
1851
1600
  }
1852
1601
  if (isArray(previous) && isArray(next)) {
1853
1602
  const exactSliceEnd = (next.length - previous.length) * progress + previous.length, nextIsLonger = next.length > previous.length, sliceEnd = nextIsLonger ? Math.floor(exactSliceEnd) : Math.ceil(exactSliceEnd), sliceTarget = nextIsLonger ? next : previous;
1854
- return createSlice({ from: 0, to: sliceEnd })(sliceTarget);
1603
+ return createSlice(0, sliceEnd)(sliceTarget);
1855
1604
  }
1856
1605
  }
1857
1606
  const linear = [
@@ -2251,10 +2000,10 @@ class Copyable {
2251
2000
  }
2252
2001
  computedResponse;
2253
2002
  computedError;
2254
- async copy(options = { type: "clipboard" }) {
2003
+ async copy(options = { kind: "clipboard" }) {
2255
2004
  this.copying();
2256
- const { type } = options;
2257
- switch (type) {
2005
+ const { kind } = options;
2006
+ switch (kind) {
2258
2007
  case "clipboard":
2259
2008
  try {
2260
2009
  this.computedResponse = await navigator.clipboard.writeText(this.string);
@@ -2442,44 +2191,6 @@ class Delayable {
2442
2191
  }
2443
2192
  }
2444
2193
 
2445
- class Dispatchable {
2446
- constructor(type, options = {}) {
2447
- this.setType(type);
2448
- this.ready();
2449
- }
2450
- computedStatus;
2451
- ready() {
2452
- this.computedStatus = "ready";
2453
- }
2454
- get type() {
2455
- return this.computedType;
2456
- }
2457
- set type(type) {
2458
- this.setType(type);
2459
- }
2460
- get cancelled() {
2461
- return this.computedCancelled;
2462
- }
2463
- get status() {
2464
- return this.computedStatus;
2465
- }
2466
- computedType;
2467
- setType(type) {
2468
- this.computedType = type;
2469
- return this;
2470
- }
2471
- computedCancelled;
2472
- dispatch(options = {}) {
2473
- const { target = window, ...rest } = options, event = toEvent(this.type, rest);
2474
- this.computedCancelled = !target.dispatchEvent(event);
2475
- this.dispatched();
2476
- return this;
2477
- }
2478
- dispatched() {
2479
- this.computedStatus = "dispatched";
2480
- }
2481
- }
2482
-
2483
2194
  const defaultOptions$3 = {
2484
2195
  toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
2485
2196
  };
@@ -2982,6 +2693,10 @@ class Navigateable {
2982
2693
  const defaultOptions$1 = {
2983
2694
  initialPicks: []
2984
2695
  };
2696
+ const defaultPickOptions = {
2697
+ replace: "none",
2698
+ allowsDuplicates: false
2699
+ };
2985
2700
  class Pickable {
2986
2701
  constructor(array, options = {}) {
2987
2702
  this.setArray(array);
@@ -3040,37 +2755,37 @@ class Pickable {
3040
2755
  return this.pick(indexOrIndices);
3041
2756
  }
3042
2757
  pick(indexOrIndices, options = {}) {
3043
- const { replace = "none" } = options;
2758
+ const { replace, allowsDuplicates } = { ...defaultPickOptions, ...options };
3044
2759
  this.computedPicks = new Pipeable(indexOrIndices).pipe(ensureIndices, this.toPossiblePicks, (possiblePicks) => {
3045
2760
  if (replace === "all") {
3046
- return toUnique(possiblePicks);
2761
+ return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
3047
2762
  }
3048
- const possibleWithoutDuplicates = createFilter((possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
2763
+ const maybeWithoutDuplicates = allowsDuplicates ? possiblePicks : createFilter((possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
3049
2764
  switch (replace) {
3050
2765
  case "none":
3051
- return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
2766
+ return createConcat(this.picks || [], maybeWithoutDuplicates)([]);
3052
2767
  case "fifo":
3053
- if (possibleWithoutDuplicates.length === 0) {
2768
+ if (maybeWithoutDuplicates.length === 0) {
3054
2769
  return this.picks;
3055
2770
  }
3056
- if (possibleWithoutDuplicates.length === this.picks.length) {
3057
- return possibleWithoutDuplicates;
2771
+ if (maybeWithoutDuplicates.length === this.picks.length) {
2772
+ return maybeWithoutDuplicates;
3058
2773
  }
3059
- if (possibleWithoutDuplicates.length > this.picks.length) {
3060
- return createSlice({ from: possibleWithoutDuplicates.length - this.picks.length })(possibleWithoutDuplicates);
2774
+ if (maybeWithoutDuplicates.length > this.picks.length) {
2775
+ return createSlice(maybeWithoutDuplicates.length - this.picks.length)(maybeWithoutDuplicates);
3061
2776
  }
3062
- return new Pipeable(this.picks).pipe(createSlice({ from: possibleWithoutDuplicates.length }), createConcat(possibleWithoutDuplicates));
2777
+ return new Pipeable(this.picks).pipe(createSlice(maybeWithoutDuplicates.length), createConcat(maybeWithoutDuplicates));
3063
2778
  case "lifo":
3064
- if (possibleWithoutDuplicates.length === 0) {
2779
+ if (maybeWithoutDuplicates.length === 0) {
3065
2780
  return this.picks;
3066
2781
  }
3067
- if (possibleWithoutDuplicates.length === this.picks.length) {
3068
- return possibleWithoutDuplicates;
2782
+ if (maybeWithoutDuplicates.length === this.picks.length) {
2783
+ return maybeWithoutDuplicates;
3069
2784
  }
3070
- if (possibleWithoutDuplicates.length > this.picks.length) {
3071
- return createSlice({ from: 0, to: possibleWithoutDuplicates.length - this.picks.length + 1 })(possibleWithoutDuplicates);
2785
+ if (maybeWithoutDuplicates.length > this.picks.length) {
2786
+ return createSlice(0, maybeWithoutDuplicates.length - this.picks.length + 1)(maybeWithoutDuplicates);
3072
2787
  }
3073
- return new Pipeable(this.picks).pipe(createSlice({ from: 0, to: this.picks.length - possibleWithoutDuplicates.length }), createConcat(possibleWithoutDuplicates));
2788
+ return new Pipeable(this.picks).pipe(createSlice(0, this.picks.length - maybeWithoutDuplicates.length), createConcat(maybeWithoutDuplicates));
3074
2789
  }
3075
2790
  });
3076
2791
  this.computedFirst = Math.min(...this.picks);
@@ -3081,7 +2796,7 @@ class Pickable {
3081
2796
  picked() {
3082
2797
  this.computedStatus = "picked";
3083
2798
  }
3084
- omit(indexOrIndices) {
2799
+ omit(indexOrIndices, options = { reference: "array" }) {
3085
2800
  if (isUndefined(indexOrIndices)) {
3086
2801
  this.computedPicks = [];
3087
2802
  this.computedFirst = void 0;
@@ -3090,7 +2805,7 @@ class Pickable {
3090
2805
  return this;
3091
2806
  }
3092
2807
  const omits = ensureIndices(indexOrIndices);
3093
- this.computedPicks = createFilter((pick) => isUndefined(find((omit) => pick === omit)(omits)))(this.computedPicks);
2808
+ this.computedPicks = createFilter((pick, index) => options.reference === "array" ? isUndefined(find((omit) => pick === omit)(omits)) : isUndefined(find((omit) => index === omit)(omits)))(this.computedPicks);
3094
2809
  this.computedFirst = Math.min(...this.picks);
3095
2810
  this.computedLast = Math.max(...this.picks);
3096
2811
  this.omitted();
@@ -3198,15 +2913,15 @@ class Searchable {
3198
2913
  }
3199
2914
 
3200
2915
  const defaultOptions = {
3201
- type: "local",
2916
+ kind: "local",
3202
2917
  statusKeySuffix: " status"
3203
2918
  };
3204
2919
  class Storeable {
3205
- type;
2920
+ kind;
3206
2921
  statusKeySuffix;
3207
2922
  constructor(key, options = {}) {
3208
2923
  this.constructing();
3209
- this.type = options.type ?? defaultOptions.type;
2924
+ this.kind = options.kind ?? defaultOptions.kind;
3210
2925
  this.statusKeySuffix = options.statusKeySuffix ?? defaultOptions.statusKeySuffix;
3211
2926
  this.setKey(key);
3212
2927
  this.ready();
@@ -3239,7 +2954,7 @@ class Storeable {
3239
2954
  return this.computedStatus;
3240
2955
  }
3241
2956
  get storage() {
3242
- switch (this.type) {
2957
+ switch (this.kind) {
3243
2958
  case "local":
3244
2959
  return localStorage;
3245
2960
  case "session":
@@ -3318,4 +3033,4 @@ class Storeable {
3318
3033
  }
3319
3034
  }
3320
3035
 
3321
- 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, 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, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
3036
+ export { Animateable, Completeable, Copyable, Delayable, 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, 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, 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.34",
3
+ "version": "0.21.2",
4
4
  "description": "UI logic for the Baleada toolkit",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",
@@ -43,17 +43,16 @@
43
43
  },
44
44
  "homepage": "https://baleada.netlify.com",
45
45
  "devDependencies": {
46
- "@baleada/animateable-utils": "^0.0.2",
47
46
  "@baleada/prepare": "^0.5.20",
48
47
  "@types/node": "^14.14.41",
49
48
  "@vue/compiler-sfc": "^3.2.9",
50
49
  "esbuild": "^0.9.7",
51
50
  "esbuild-register": "^2.6.0",
52
- "rollup": "^2.56.3",
51
+ "rollup": "^2.70.1",
53
52
  "tailwindcss": "^2.1.1",
54
- "typescript": "^4.5.5",
53
+ "typescript": "^4.6.2",
55
54
  "uvu": "^0.5.1",
56
- "vite": "^2.7.2",
55
+ "vite": "^2.8.6",
57
56
  "vue": "^3.2.12",
58
57
  "vue-router": "^4.0.3"
59
58
  },
@@ -63,7 +62,7 @@
63
62
  "@snigo.dev/color": "^0.0.6",
64
63
  "@types/dompurify": "^2.2.3",
65
64
  "@types/requestidlecallback": "^0.3.1",
66
- "@types/resize-observer-browser": "^0.1.5",
65
+ "@types/resize-observer-browser": "^0.1.7",
67
66
  "bezier-easing": "^2.1.0",
68
67
  "dompurify": "^2.2.6",
69
68
  "fast-fuzzy": "^1.11.1",