mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: upgrade ComparePersistent
This commit is contained in:
1 parent
c2d625e1ed
commit
ef2a47e756
3 files changed
+54
-72
No files matched your search
@@ -1,23 +1,12 @@
|
||||
import * as lodash from 'lodash-es';
|
||||
import { create } from 'zustand';
|
||||
import { persist, subscribeWithSelector } from 'zustand/middleware';
|
||||
import { createContextualStore } from '../core/zustand/createContextualStore';
|
||||
import { Varuna } from "varuna";
|
||||
|
||||
export type DeltaMode = "none" | "percentage" | "absolute";
|
||||
|
||||
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),
|
||||
},
|
||||
),
|
||||
),
|
||||
export const ComparePersistent = new Varuna<ComparePersistent>(
|
||||
{ deltaMode: "none" },
|
||||
"compare-2"
|
||||
);
|
||||
Reference in new issue
Block a user