Releases: ryupold/vode
Releases · ryupold/vode
1.8.0
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
- add type-safe state context API with Proxy
Replaces the key based state context with a proxy-based
implementation to simplify the API and provide a more
intuitive way to access and manipulate nested state.const state = createState<StateType>({ user: { profile: { settings: { theme: 'dark', lang: 'es' } } } }); const settingsCtx = context(state).user.profile.settings; const settings = settingsCtx.get()!; // { theme: 'dark', lang: 'en' }
- deprecate KeyStateContext (KeyPath) as it lead to a dramatically increased compile time
1.6.8
1.6.7
- allow optional path objects for KeyPaths
this eliminates the need to have non-nullable keys in sub-states that are addressed by KeyStateContextin this example foobar.example1.app, foobar.example2.app and foobar.example3.app are the only valid keysexport type AppExampleState = { foobar: { example1: { app: { counter: number; text: string; }, }, example2?: { app: { counter: number; text: string; }, }, example3?: { app?: { counter: number; text: string; }, }, }, }; const state = createState<AppExampleState>({ foobar: { example1: { app: { counter: 0, text: 'Hello, World!', }, }, } }); const ctx1 = new KeyStateContext<typeof state, { counter: number; text: string; }>(state, "foobar.example1.app"); const ctx2 = new KeyStateContext<typeof state, { counter: number; text: string; }>(state, "foobar.example2.app"); const ctx3 = new KeyStateContext<typeof state, { counter: number; text: string; }>(state, "foobar.example3.app");