/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type EastType, type ValueTypeOf } from "@elaraai/east"; /** * A stored value's codec: its type's encoder and decoder, made once. * * @typeParam T - The value's East type */ export interface StoredCodec { /** The value as the store holds it. */ readonly encode: (value: ValueTypeOf) => Uint8Array; /** The store's bytes as the value. */ readonly decode: (bytes: Uint8Array) => ValueTypeOf; } /** * The codec of a stored value's type: made once, beside the type. * * @typeParam T - The value's East type * @param type - The value's East type * @returns Its codec, for {@link useStoredValue} */ export declare function storedCodec(type: T): StoredCodec; /** * The value the UI store holds under a key, and the write that sets it: a * write every reader of the key follows. * * @typeParam T - The value's East type * @param codec - The value's codec ({@link storedCodec}) * @param key - The key the value is kept under * @returns The value held — `undefined` until one is written — and the write */ export declare function useStoredValue(codec: StoredCodec, key: string): [ValueTypeOf | undefined, (next: ValueTypeOf) => void]; //# sourceMappingURL=stored-value.d.ts.map