Skip to content

Commit c443305

Browse files
committed
update docs
1 parent 30f0595 commit c443305

File tree

4 files changed

+131
-14
lines changed

4 files changed

+131
-14
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Mesut Koca <imesutkoca@gmail.com> (https://mesutkoca.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,122 @@
11
# vue-component-component
22

3-
## Project setup
4-
```
5-
yarn install
6-
```
3+
<p align="center">
74

8-
### Compiles and hot-reloads for development
9-
```
10-
yarn run serve
11-
```
5+
![npm bundle size (minified + gzip)](https://img.shields.io/npm/v/vue-component-component.svg)
6+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/koca/vue-component-component)
7+
[![CircleCI branch](https://circleci.com/gh/egoist/bili/tree/master.svg?style=shield)](https://circleci.com/gh/koca/vue-component-component/tree/master)
8+
![Codecov](https://img.shields.io/codecov/c/github/koca/vue-component-component.svg)
9+
10+
</p>
11+
12+
Vue version of [@Reach/component-component](https://github.com/reach/reach-ui/).
13+
14+
> A dynamic version of Vue.Component, a component component if you will. Useful for inline lifecycles and state. It's also incredibly composable.
15+
16+
![Screenshot of Converty](media/screenshot.jpg)
17+
18+
## Example
1219

13-
### Compiles and minifies for production
20+
A Todo App:
21+
22+
```html
23+
<vue-component :initial-state="{ newTodo: 'work', items:[]}">
24+
<div slot-scope="{ state }">
25+
What to do?:
26+
<input type="text" ref="inp" v-model="state.newTodo">
27+
<button
28+
@click="()=>{
29+
state.items.push(state.newTodo)
30+
state.newTodo = '';
31+
$refs.inp.focus();
32+
}"
33+
>Add</button>
34+
<br>
35+
<ul>
36+
<li :key="item" v-for="item in state.items">{{item}}</li>
37+
</ul>
38+
</div>
39+
</vue-component>
1440
```
15-
yarn run build
41+
42+
More Examples on [Codesandbox](https://codesandbox.io/s/01r8wko0v0).
43+
44+
## Install
45+
46+
```sh
47+
npm install vue-component-component
1648
```
1749

18-
### Lints and fixes files
50+
or
51+
52+
```sh
53+
yarn add vue-component-component
1954
```
20-
yarn run lint
55+
56+
## Usage
57+
58+
Register the component locally and use it (recommended)
59+
60+
```js
61+
import Component from "vue-component-component";
62+
export default {
63+
components: {
64+
// ⚠️ `<component>` tag is reserved by vue
65+
"vue-component": Component
66+
}
67+
};
2168
```
2269

23-
### Run your unit tests
70+
Or register the component globally in `main.js`
71+
72+
```js
73+
import Component from "vue-component-component";
74+
Vue.component("vue-component", Component);
2475
```
25-
yarn run test:unit
76+
77+
Browser usage:
78+
79+
```html
80+
<!-- vue-component-component JavaScript -->
81+
<script src="https://unpkg.com/vue-component-component"></script>
82+
83+
<!-- use -->
84+
<script>
85+
Vue.component('vue-component', VueComponent)
86+
new Vue({
87+
el: '#app'
88+
})
89+
</script>
2690
```
91+
92+
## API
93+
TODO.
94+
95+
All the life cycle hooks and `slot-scope` gets `state` and `setState`.
96+
97+
## Props
98+
99+
| Name | Type | Default | Description |
100+
| -------------------------- | ---------- | ------- | ------------------------------------------------------------------------------------------------------------ |
101+
| initialState | `object` | `{}` | initial state aka `data: ()=> ({})` |
102+
| created | `Function` | - | Called when the component is created. |
103+
| mounted | `Function` | - | Called when the component is mounted. |
104+
| All other Life Cycle Hooks | `Function` | - | "beforeMount", "mounted", "beforeUpdate", "updated", "activated", "deactivated", "beforeDestroy","destroyed" |
105+
106+
107+
108+
## About
109+
110+
Inspired by [@Reach/component-component](https://github.com/reach/reach-ui/).
111+
Thanks [Ryan](https://twitter.com/ryanflorence) 👍
112+
113+
# Todos
114+
115+
- Refs?
116+
117+
## Author
118+
119+
**vue-component-component** © [koca](https://github.com/koca), Released under the [MIT](./LICENSE) License.<br>
120+
Authored and maintained by koca with help from contributors ([list](https://github.com/koca/vue-component-component/contributors)).
121+
122+
> [mesutkoca.com](https://mesutkoca.com) · GitHub [@koca](https://github.com/koca) · Twitter [@imesutkoca](https://twitter.com/imesutkoca)

media/screenshot.jpg

153 KB
Loading

src/assets/logo.png

-6.69 KB
Binary file not shown.

0 commit comments

Comments
 (0)