├── .gitignore
├── LICENSE
├── README.md
├── packages
├── demo-todo-mvc
│ ├── RemainingCounter.jsx
│ ├── TodoFooter.vue
│ ├── index.html
│ ├── main.js
│ ├── package.json
│ ├── todo.vue
│ └── vite.config.js
└── vue-component-preview
│ ├── README.md
│ ├── index.d.ts
│ ├── index.js
│ ├── index.mjs
│ └── package.json
├── pnpm-lock.yaml
└── pnpm-workspace.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Tao Wen
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 all
13 | 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 THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | render vue component in "preview" mode with mock data.
4 |
5 | ```js
6 | import preview from 'vue-component-preview'
7 | import Todo from './todo.vue';
8 | const TodoPreview = preview(Todo, {
9 | todos: [{
10 | }],
11 | filteredTodos: [{
12 | id: 1,
13 | title: 'hello',
14 | completed: true
15 | }],
16 | // when data used but not provided, will callback this
17 | __get__(p) {
18 | console.log(p);
19 | },
20 | // when child component being rendered, provide its data
21 | __render__({ componentName, componentType, counter }, props) {
22 | return {
23 | todos: [{
24 | // if child render its own child, it will callback again
25 | __render__({ componentName, componentType, counter }, props) {
26 | }
27 | }],
28 | }
29 | }
30 | })
31 | ```
32 |
33 | when render ``, it will render the `` of the `todo.vue` file, but by-passing all `
20 |
21 |
40 |
--------------------------------------------------------------------------------
/packages/demo-todo-mvc/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Vite App
7 |
8 |
9 |