@ankhorage/state-legend
v0.0.0
Published
Legend State adapter for Ankhorage state contracts.
Maintainers
Readme
@ankhorage/state-legend
Legend State adapter for the provider-neutral StateAdapter contracts from
@ankhorage/contracts.
The package keeps Legend State behind the adapter boundary:
Legend State
-> @ankhorage/state-legend
-> StateAdapter
-> runtime binding resolver
-> plain props
-> ZORA componentsZORA, runtime, Studio, Supabase, React Native, and Expo are intentionally not imported by this package.
Install
bun add @ankhorage/state-legend @ankhorage/contracts @legendapp/state@betaUsage
import { createLegendStateAdapter } from '@ankhorage/state-legend';
const stateAdapter = createLegendStateAdapter({
initialState: {
session: {
user: null,
},
},
});
stateAdapter.set('forms.contact.values.firstname', 'Fabio');
const result = stateAdapter.get('forms.contact.values.firstname');
if (result.ok) {
console.log(result.data);
}API
createLegendStateAdapter(options?: LegendStateAdapterOptions): StateAdapterFeatures:
- path-based
get - path-based
set - path-based
subscribe - optional path-based
delete - deterministic unsubscribe
- no React dependency in the core adapter
Generated documentation
- Interactive documentation app
- Public API reference
- Component registry
- Architecture overview
- Module relationships
- Export graph
Architecture preview
graph TD
package__ankhorage_state_legend["@ankhorage/state-legend"]
entrypoint_src_index_ts["src/index.ts"]
package__ankhorage_state_legend --> entrypoint_src_index_ts
module_src_index_ts["src/index.ts"]