@mmstack/primitives 21.8.3 → 21.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmstack/primitives",
3
- "version": "21.8.3",
3
+ "version": "21.8.4",
4
4
  "keywords": [
5
5
  "angular",
6
6
  "signals",
@@ -1350,7 +1350,9 @@ type DuplicateKeyPolicy = {
1350
1350
  * when the list is reordered.
1351
1351
  *
1352
1352
  * @param source A `Signal<T[]>` or a function returning `T[]`.
1353
- * @param mapFn The mapping function. Receives the item and its index as a Signal.
1353
+ * @param mapFn The mapping function. Receives the item, its index as a Signal, and the
1354
+ * entry's key (the effective ordinal key when `duplicateKeys` is enabled, otherwise
1355
+ * the raw key) — stable for the lifetime of the mapped entry.
1354
1356
  * @param options Optional configuration:
1355
1357
  * - `onDestroy`: A callback invoked when a mapped item is removed from the array.
1356
1358
  * - `key`: A custom key extractor for identity matching (e.g. `(item) => item.id`)
@@ -1380,7 +1382,7 @@ type DuplicateKeyPolicy = {
1380
1382
  * users.set([users()[1], users()[0]]);
1381
1383
  * ```
1382
1384
  */
1383
- declare function keyArray<T, U, K>(source: Signal<T[]> | (() => T[]), mapFn: (v: T, i: Signal<number>) => U, options?: {
1385
+ declare function keyArray<T, U, K>(source: Signal<T[]> | (() => T[]), mapFn: (v: T, i: Signal<number>, key: K | string) => U, options?: {
1384
1386
  onDestroy?: (value: U) => void;
1385
1387
  /**
1386
1388
  * Optional function to use a custom key for item comparison.