diff --git a/packages/node-modules-inspector/src/app/state/filters.ts b/packages/node-modules-inspector/src/app/state/filters.ts index 55b732c..bbb5dd8 100644 --- a/packages/node-modules-inspector/src/app/state/filters.ts +++ b/packages/node-modules-inspector/src/app/state/filters.ts @@ -185,6 +185,18 @@ export function createToggle(key: 'focus' | 'why' | 'excludes') { } } +function createFilterGroup(keys: (keyof FilterOptions)[]) { + return { + reset: () => { + for (const key of keys) { + // @ts-expect-error any + state[key] = structuredClone(toRaw(filtersDefault.value[key])) + } + }, + activated: computed(() => keys.filter(i => !isDeepEqual(state[i], filtersDefault.value[i]))), + } +} + export const filters = reactive({ state, search: { @@ -200,22 +212,6 @@ export const filters = reactive({ excludes: { toggle: createToggle('excludes'), }, - select: { - reset: () => { - for (const key of FILTER_KEYS_SELECT) { - // @ts-expect-error any - state[key] = structuredClone(toRaw(filtersDefault.value[key])) - } - }, - activated: computed(() => FILTER_KEYS_SELECT.filter(i => !isDeepEqual(state[i], filtersDefault.value[i]))), - }, - exclude: { - reset: () => { - for (const key of FILTER_KEYS_EXCLUDES) { - // @ts-expect-error any - state[key] = structuredClone(toRaw(filtersDefault.value[key])) - } - }, - activated: computed(() => FILTER_KEYS_EXCLUDES.filter(i => !isDeepEqual(state[i], filtersDefault.value[i]))), - }, + select: createFilterGroup(FILTER_KEYS_SELECT), + exclude: createFilterGroup(FILTER_KEYS_EXCLUDES), }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bbdcba4..f6aebad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,9 @@ importers: .: configDependencies: {} packageManagerDependencies: + '@pnpm/exe': + specifier: 12.3.4 + version: 12.3.4 pnpm: specifier: 12.3.4 version: 12.3.4 @@ -56,6 +59,11 @@ packages: cpu: [x64] os: [win32] + '@pnpm/exe@12.3.4': + resolution: {integrity: sha512-Rq7JokWAyYF9IFfn8zofB/q2AgnZlmoMuH5fMHB2+Ta61I9aD7sNm+woZpx6iH+5vb38chdSoYRvOtSqlH72YQ==} + engines: {node: '>=18.*'} + hasBin: true + pnpm@12.3.4: resolution: {integrity: sha512-lhqkH7B32joEpEHZ+OFevAyW2o73ELLrZ7+e58sGEOq9SPH9hfUc/+c4RnhfoPh8VqOocqHYk/hEZ0G1zORUVw==} engines: {node: '>=18.*'} @@ -87,6 +95,17 @@ snapshots: '@pnpm/exe.win32-x64@12.3.4': optional: true + '@pnpm/exe@12.3.4': + optionalDependencies: + '@pnpm/exe.darwin-arm64': 12.3.4 + '@pnpm/exe.darwin-x64': 12.3.4 + '@pnpm/exe.linux-arm64': 12.3.4 + '@pnpm/exe.linux-arm64-musl': 12.3.4 + '@pnpm/exe.linux-x64': 12.3.4 + '@pnpm/exe.linux-x64-musl': 12.3.4 + '@pnpm/exe.win32-arm64': 12.3.4 + '@pnpm/exe.win32-x64': 12.3.4 + pnpm@12.3.4: optionalDependencies: '@pnpm/exe.darwin-arm64': 12.3.4