open-index/open-npm huggingface dataset:
npm package: @peajs/core
Description: ## Installation
Latest version: 0.2.0

# @peajsi/core

## Installation

```sh
npm i @peajs/core
```

## Api

### `bootstrap`

```js
import Pea from '@peajs/core'

Pea.bootstrap()
```

### `updateConfig`

```js
import Pea from '@peajs/core'

Pea.updateConfig({ foo: 'bar' })
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/drawer
Description: Drawer component for peajs
Latest version: 0.6.0


# @peajs/drawer

## Installation

```bash
npm i @peajs/drawer
```

## Quick Start

```js
import React from 'react'
import { Drawers, DrawerConfig, drawerStore } from '@peajs/drawer'

const About = () => (
  <span>
    about
    <button onClick={() => drawerStore.close('about')}>close</button>
  </span>
)

const config: DrawerConfig = [
  {
    name: 'about',
    component: About,
  },
]

export default () => (
  <div>
    <Drawers config={config} />
    <span>Hi, Dahlia</span>
    <button onClick={() => drawerStore.open('about')}>open</button>
  </div>
)
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/form
Description: > React Form base on hooks
Latest version: 0.2.11

# @peajs/form

> React Form base on hooks

English | [简体中文](./README.zh-CN.md)

## Installation

```sh
npm i @peajs/form
```

## Quickstart

```js
import React from 'react'
import { useForm } from '@peajs/form'

class User {
  username = 'foo'
  password = ''
}

export default () => {
  const { handlers, name } = useForm(User, {
    onSubmit(values) {
      console.log('values:', values)
    },
  })

  return (
    <form onSubmit={handlers.handleSubmit}>
      <input {...name('username')} />
      <input {...name('password')} />
      <button type="submit">Submit</button>
    </form>
  )
}
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/form-antd
Description: > Use Ant Design with @peajs/form
Latest version: 0.2.1

# @peajs/form-antd

> Use Ant Design with @peajs/form

## Installation

```sh
npm i @peajs/form-antd
```

## Quickstart

```js
import React from 'react'
import { Input } from 'antd'
import { useForm, Form, Item } from '@peajs/form-antd'

class User {
  username = 'foo'
  password = ''
}

export default () => {
  const result = useForm(User, {
    onSubmit(values) {
      console.log('values:', values)
    },
  })

  return (
    <Form use={result}>
      <Item name="username">
        <Input />
      </Item>
      <Item name="password">
        <Input />
      </Item>
      <button type="submit">Submit</button>
    </Form>
  )
}
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/graphql-client
Description: > A light weight GraphQL GraphQLClient
Author: forsigner
Latest version: 0.6.0

# @peajs/graphql-client

> A light weight GraphQL GraphQLClient

## Installation

```sh
npm i @peajs/graphql-client
```

## Quick start

```js
import { query } from '@peajs/graphql-client'
import gql from 'gql-tag' // editor helper

const GET_PERSONS = gql`
  {
    allPersons {
      id
      name
    }
  }
`

const endpoint = 'https://api.graph.cool/simple/v1/swapi'

const data = await query(endpoint, GET_PERSONS)
```

## Use Client

```js
import { GraphQLClient } from '@peajs/graphql-client'
import { gql } from 'gql-tag' // editor helper

const GET_PERSONS = gql`
  {
    allPersons {
      id
      name
    }
  }
`
const GraphQLClient = new GraphQLClient({
  endpoint: 'https://api.graph.cool/simple/v1/swapi',
})

const data = await GraphQLClient.query(GET_PERSONS)
```

## Variables

```js
const GET_PERSON = gql`
  query getPerson($id: ID) {
    Person(id: $id) {
      id
      name
    }
  }
`

const data = await query(endpoint, GET_PERSON, {
  id: 'cj0nv9peiewhf013011i9a4h2',
})
```

## Typescript

```js
interface Person {
  Person: {
    id: string
    name: string
  }
}

const GET_PERSON = gql`
  query getPerson($id: ID) {
    Person(id: $id) {
      id
      name
    }
  }
`

const data = await query<Person>(endpoint, GET_PERSON, {
  id: 'cj0nv9peiewhf013011i9a4h2',
})
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/i18n
Description: ## Installation
Latest version: 0.2.0

# Pea i18n

## Installation

```sh
npm i @peajs/i18n
```

## Quick Start

### locale file

```bash

locales
├── cn.json
├── default.json
└── en.json
```

```json
// en.json
{
  "name": "pea"
}

```

```js


import { i18n } from '@peajs/i18n'

export default () => (
  <div>{i18n.name}</div>
)

// ...
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/modal
Description: ## Installation
Latest version: 0.6.0

# @peajs/modal

## Installation

```bash
npm i @peajs/modal
```

## Quick Start

```js
import React from 'react'
import { Modals, ModalConfig, modalStore } from '@peajs/modal'

const About = () => (
  <span>
    about
    <button onClick={() => modalStore.close('about')}>close</button>
  </span>
)

const config: ModalConfig = [
  {
    name: 'about',
    component: About,
  },
]

export default () => (
  <div>
    <Modals config={config} />
    <span>Hi, Dahlia</span>
    <button onClick={() => modalStore.open('about')}>open</button>
  </div>
)
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/request
Description: > An elegant HTTP client based on [Fetch](https://fetch.spec.whatwg.org/)
Author: forsigner
Latest version: 0.6.0

# Pea request

> An elegant HTTP client based on [Fetch](https://fetch.spec.whatwg.org/)

## Installation

```sh
npm i @peajs/request
```

## Usage

```js
import { request } from '@peajs/request'
;(async () => {
  const data = await request('https://jsonplaceholder.typicode.com/todos/1')
})()
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/rest
Description: ## Installation
Latest version: 0.2.2

# @peajs/rest

## Installation

```sh
npm i @peajs/rest
```

## Usage

```jsx
import React from 'react'
import { useFetch } from '@peajs/rest'

const Todos = () => {
  const { loading, data, error } = useFetch(
    'https://jsonplaceholder.typicode.com/todos',
  )

  if (loading) return <span>loading...</span>
  if (error) return <span>error!</span>

  return (
    <ul>
      {data.map(item => (
        <li key={item.id}>{item.title}</li>
      ))}
    </ul>
  )
}
export defulat Todos
```

demo：

[![Edit fetch-data-with-dahlia](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/lxz0ym7qj9?fontsize=14)

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/router
Description: ## Installation
Latest version: 0.2.4

# @peajs/router

## Installation

```sh
npm i @peajs/router
```

## Usage

```js
import React from 'react'
import ReactDOM from 'react-dom'
import { Router, Link } from '@peajs/router'

const Home = () => (
  <div>
    <Link to="/">Home</Link>
    <Link to="/about">About</Link>
    <h1>Home</h1>
  </div>
)

const About = () => (
  <div>
    <Link to="/">Home</Link>
    <Link to="/about">About</Link>
    <h1>About</h1>
  </div>
)

const NotFound = () => <div>404 not found</div>

const routes = [
  {
    path: '/',
    component: Home,
  },
  {
    path: '/about',
    component: About,
  },
  {
    path: '**',
    component: NotFound,
  },
]

const App = () => <Router routes={routes} />

ReactDOM.render(<App />, document.getElementById('root'))
```

## Interceptor

```ts
import { navigate, intercept } from '@peajs/router'

intercept((ctx, next) => {
  if (ctx.to === '/') {
    navigate('/dashboard')
  } else {
    return next()
  }
})
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)
npm package: @peajs/types
Description: ## Installation
Latest version: 0.2.0

# @pea/types

## Installation

```sh
npm i @peajs/types
```

## Api

### `IPlugin`

```js
import { IPlugin } from '@peajs/types'
import { Configuration } from 'webpack'

export default class MyPlugin implements IPlugin {
  updateWebpackConfig(config: Configuration) {
    // Do something
    const newConfig = handle(config)
    return newConfig
  }
}
```

### `PeaConfig`

```js
import { PeaConfig } from '@peajs/types'
import LessPlugin from 'pea-plugin-less'

const config: PeaConfig = {
  plugins: [new LessPlugin()],
}

export default config
```

## License

[MIT License](https://github.com/pea-team/pea/blob/master/LICENSE)