open-index/open-npm huggingface dataset:
npm package: @mp-components/mp-store
Description: Simple global state container for WeChat Mini Program
Author: pengtikui
Latest version: 0.1.0

# @mp-components/mp-store

简洁的微信小程序全局状态管理

> 在 1.0.0 版本之前，API 不稳定

## 特点

* 类 Redux
* 拥抱 ES6+ (async/await、Promise等)
* 自动处理 loading
* 最小程度入侵小程序
* 无 polyfill

## 使用

#### 定义 model

```js
const counter = {
  state: {
    count: 0,
  },
  actions: {
    increase() {
      this.setState({ count: this.getState().count + 1 });
    },
    async asyncIncrease() {
      await asyncFunc();
      this.setState({ count: this.getState().count + 1 });
    }
  },
};
```

#### 创建 store

```js
import { createStore } from '@mp-components/mp-store';

const store = createStore({ counter });
```

#### 在 app.js 中引用

```js
import { withStore } from '@mp-components/mp-store';

App(withStore(store)({
  onLaunch() {
    // ...
  },
}));
```

#### 在页面中使用

```js
import { connect } from '@mp-components/mp-store';

// couterCount 会被注入到 this.data 中，可以直接在 wxml 中使用
const mapState = state => ({ couterCount: state.counter.count });
// increaseCount 会被挂载到 this 上，可以直接通过 this.increaseCount() 调用
const mapActions = actions => ({ increaseCount: actions.counter.increase });

Page(connect(mapState, mapActions)(
  onLoad() {
    // ...
  }
));
```

## API

### Store

* getState([modelName])

* getActions([modelName])

* subscribe(listener)

  返回 unsubscribe 方法

### withStore

withStore(store)(appOptions)

返回 appOptions

### connect

connect(mapState[, mapActions])(pageOptions)

返回 pageOptions

## 协议

MIT License (c) [pengtikui](https://github.com/pengtikui)
npm package: @mp-components/promisify
Description: Make WeChat Mini Program's API Promisify
Author: pengtikui
Latest version: 1.0.0

# @mp-components/promisify

[![npm](https://img.shields.io/npm/v/@mp-components/promisify?style=flat-square)](https://www.npmjs.com/package/@mp-components/promisify)
[![GitHub issues](https://img.shields.io/github/issues/mp-components/promisify?style=flat-square)](https://github.com/mp-components/promisify/issues)
[![License](https://img.shields.io/github/license/mp-components/promisify?style=flat-square)](https://github.com/mp-components/promisify/blob/master/LICENSE)

使微信小程序的 API Promise 化

## 使用

```js
import promisify from '@mp-components/promisify';

promisify(wx.getSystemInfo)().then(console.log);
```

## 协议

MIT License (c) 2020-preset [pengtikui](https://github.com/pengtikui)
npm package: @mp-consulting/homebridge-ui-kit
Description: Brand design system for @mp-consulting Homebridge plugins
Author: MP Consulting
Latest version: 1.0.0

# @mp-consulting/homebridge-ui-kit

Brand design system for [@mp-consulting](https://github.com/mp-consulting) Homebridge plugins.

Provides shared CSS tokens, Bootstrap 5 overrides, and vanilla JS UI components used across all `@mp-consulting` Homebridge plugin config UIs.

## Contents

| File | Description |
|------|-------------|
| `dist/kit.css` | CSS tokens, Bootstrap overrides, and shared component styles |
| `dist/kit.js` | Vanilla JS helpers exposed as `window.MpKit` |

## Usage

Copy the built assets into your plugin's `homebridge-ui/public/lib/` directory and reference them in `index.html`:

```html
<link rel="stylesheet" href="lib/kit.css">
<!-- after your app scripts: -->
<script src="lib/kit.js"></script>
```

### MpKit API

```js
// Status badges
MpKit.StatusBadge.online()    // → HTML string
MpKit.StatusBadge.offline()
MpKit.StatusBadge.checking()
MpKit.StatusBadge.disabled()

// Empty state
MpKit.EmptyState.render({ iconClass, title, hint })

// Loading placeholder
MpKit.Loading.render('Loading...')

// View switching (.mp-view elements)
MpKit.View.show('viewId')
```

## Development

```bash
npm install
npm run build   # outputs to dist/
```

## License

MIT © MP Consulting