solid-ctrl-flow 2.1.0 → 2.1.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/dist/index.d.ts CHANGED
@@ -155,12 +155,21 @@ export declare namespace Slot {
155
155
  */
156
156
  const remove: <T extends Slot>(list: T[], v: T) => T | undefined;
157
157
  /**
158
- * Removes an element from a slotted list
158
+ * Removes an element from a slotted list.
159
+ * The function returns `undefined` ONLY if the index is out of range (A {@link Slot} can't be `undefined`)
159
160
  * @param list The list from which to remove the element
160
161
  * @param i The index at which to remove the element
161
162
  * @returns The removed element
162
163
  */
163
164
  export function removeAt<T extends Slot>(list: T[], i: number): T | undefined;
165
+ /**
166
+ * Restores the indexes of a slotted list.
167
+ * This function is useful after a sort, filter, or any other operation that changes the order of the elements in the list without taking care of {@link Slot}s
168
+ * @param list The list to restore
169
+ * @param start The index at which to start restoring the indexes
170
+ * @param end The index at which to stop restoring the indexes
171
+ */
172
+ export function restore(list: Slot[], start?: number, end?: number): void;
164
173
  }
165
174
 
166
175
  /**
package/dist/index.mjs CHANGED
@@ -65,6 +65,11 @@ var Slot;
65
65
  return out;
66
66
  }
67
67
  Slot2.removeAt = removeAt;
68
+ function restore(list, start = 0, end = list.length) {
69
+ for (var i = start; i < end; i++)
70
+ list[i].slot = i;
71
+ }
72
+ Slot2.restore = restore;
68
73
  })(Slot || (Slot = {}));
69
74
  function createExtractor(name = "extractor") {
70
75
  const ctx2 = createContext(void 0, {
package/dist/index.umd.js CHANGED
@@ -67,6 +67,11 @@
67
67
  return out;
68
68
  }
69
69
  Slot2.removeAt = removeAt;
70
+ function restore(list, start = 0, end = list.length) {
71
+ for (var i = start; i < end; i++)
72
+ list[i].slot = i;
73
+ }
74
+ Slot2.restore = restore;
70
75
  })(exports2.Slot || (exports2.Slot = {}));
71
76
  function createExtractor(name = "extractor") {
72
77
  const ctx2 = solidJs.createContext(void 0, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-ctrl-flow",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Control flow components for solid-js",
5
5
  "author": "AFatNiBBa",
6
6
  "license": "ISC",