ColorStore
Minimal external store for shared color state. The provider owns one store instance; child components subscribe to referentially stable slices via useColorStoreSelector so provider renders stay cheap.
import type { ColorStore } from '@pbroom/color-kit/react';color-store.ts:16interface ColorStore {
get: () => ColorState;
set: (next: ColorState) => void;
subscribe: (listener: () => void) => () => void;
}Properties
- get
() => ColorState - Returns the current state.
- set
(next: ColorState) => void - Replaces the state and notifies listeners; a no-op when
nextis the current state object. - subscribe
(listener: () => void) => () => void - Registers a change listener and returns its unsubscribe function.