mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
24 lines
645 B
TypeScript
24 lines
645 B
TypeScript
import * as lodash from 'lodash-es';
|
|
import { create } from 'zustand';
|
|
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
|
import { createContextualStore } from '../core/zustand/createContextualStore';
|
|
|
|
export type DeltaMode = 'none' | 'percentage' | 'absolute';
|
|
export interface ComparePersistent {
|
|
deltaMode: DeltaMode;
|
|
}
|
|
|
|
export const ComparePersistent = createContextualStore(() =>
|
|
create<ComparePersistent>()(
|
|
persist(
|
|
subscribeWithSelector<ComparePersistent>(() => ({
|
|
deltaMode: 'none',
|
|
})),
|
|
{
|
|
name: 'compare',
|
|
merge: (a, b) => lodash.merge(b, a),
|
|
},
|
|
),
|
|
),
|
|
);
|