# @statewalker/store-ui

> Data Store binding for views and inputs

Latest version **3.0.2** (published 2023-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @statewalker/store-ui
pnpm add @statewalker/store-ui
yarn add @statewalker/store-ui
bun add @statewalker/store-ui
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-03-15 |
| First published | 2022-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mikhail Kotelnikov |
| Maintainers | mkotelnikov |

## Links

- npm: https://www.npmjs.com/package/@statewalker/store-ui
- Repository: git@github.com:statewalker/statewalker-store-ui
- Homepage: https://github.com/statewalker/statewalker-store-ui
- npm.io page: https://npm.io/package/@statewalker/store-ui

## Dependencies (2)

- [@statewalker/utils](https://npm.io/package/@statewalker/utils.md) ^0.4.2
- [@statewalker/utils-dom](https://npm.io/package/@statewalker/utils-dom.md) ^0.4.0

## Recent versions

- 3.0.2 (latest) — 2023-03-15
- 3.0.1 — 2022-11-17
- 3.0.0 — 2022-11-14
- 2.0.3 — 2022-10-11
- 2.0.2 — 2022-09-28
- 2.0.1 — 2022-09-23
- 2.0.0 — 2022-09-22
- 1.0.1 — 2022-09-17
- 1.0.0 — 2022-09-12
- 0.1.0 — 2022-09-12

## README

# @statewalker/store-ui: UI binding for Stores

This module provides binding between Stores ([@statewalker/store](https://github.com/statewalker/statewalker-store)) and
DOM elements.

Methods: 
* `extendInputStore(store)` - the main method of this library; it binds two additional store methods:
  - `store.bindView(view, keys, action)` - binds the given `view` DOM object to store values corresponding to the given `keys`; if the `view` is not defined then a new `div` element is created; it uses internally the `bindStoreView(..)` method described below
  - `store.bindStoreInput(key, configKey, input)` - binds the store values corresponding to the `key` parameter to input instances returned by the `input` function; if the `configKey` parameter is defined then the `input` is called each time when these dependencies are changed
* `bindStoreView(store, view, keys, action)` - bind a `view` (a DOM element) to the `store`; the specified `action` allows to update the `view` each time when some fields (defined by the `keys` parameters) change its value.
* `bindStoreInput(store, key, input)` - synchronizes the given `input` to the `store` field defined by the `key` parameter; an input is a DOM element with the `value` property and rising the "`input`" event when user updates values; see the [ObservableHQ inputs library](https://observablehq.com/@observablehq/inputs) ([GitHub](https://github.com/observablehq/inputs)) for more information.
* `bindConfigurableStoreInput(store, configKey, valueKey, input)` - binds input values  to a specific field of the `store` defined by the `valueKey` parameter; the `input` function should return a new input instance and it is called each time when the `configKey` field of the `store` changes its values

Used libraries in GitHub:
* [@statewalker/store](https://github.com/statewalker/statewalker-store)
* [@statewalker/utils](https://github.com/statewalker/statewalker-utils) 
* [@statewalker/utils-dom](https://github.com/statewalker/statewalker-utils-dom) 

For working examples see this Observable Notebook: 
- https://observablehq.com/@kotelnikov/observable-store-example
- https://observablehq.com/@kotelnikov/observable-store-description
- https://observablehq.com/@kotelnikov/observable-store

---
_Source: https://npm.io/package/@statewalker/store-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
