@globalbrain/sefirot 4.1.1 → 4.2.0

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.
@@ -28,12 +28,23 @@ export function computedWhen<T, C, D>(
28
28
 
29
29
  export function computedArray<T = any>(fn: (arr: T[]) => void): ComputedRef<T[]> {
30
30
  return computed(() => {
31
- const arr = [] as T[]
31
+ const arr: T[] = []
32
32
  fn(arr)
33
33
  return arr
34
34
  })
35
35
  }
36
36
 
37
+ export function computedArrayWhen<T = any, C = any>(
38
+ condition: WhenCondition<C>,
39
+ fn: (arr: T[], item: NonNullable<C>) => void
40
+ ): ComputedRef<T[]> {
41
+ return computedWhen<T[], C, T[]>(condition, (c) => {
42
+ const arr: T[] = []
43
+ fn(arr, c)
44
+ return arr
45
+ }, [])
46
+ }
47
+
37
48
  /**
38
49
  * Checks whether the slot has a non empty value.
39
50
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
3
  "type": "module",
4
- "version": "4.1.1",
4
+ "version": "4.2.0",
5
5
  "packageManager": "pnpm@9.6.0",
6
6
  "description": "Vue Components for Global Brain Design System.",
7
7
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",