├── .gitignore ├── LICENSE ├── README.md ├── api └── index.js ├── bin └── whiteroom ├── index.js ├── logo.svg ├── package-lock.json ├── package.json ├── src ├── client │ ├── api.js │ ├── app.vue │ ├── index.js │ ├── layouts │ │ ├── centered.vue │ │ ├── fluid.vue │ │ ├── index.js │ │ └── simple.vue │ ├── store.js │ └── types.js ├── connector.js └── server │ ├── app.vue │ ├── components │ ├── agents │ │ ├── agent.vue │ │ ├── boolean.vue │ │ ├── enum.vue │ │ ├── index.js │ │ ├── number.vue │ │ ├── range.vue │ │ ├── text.vue │ │ └── trigger.vue │ ├── group.vue │ └── search.vue │ ├── index.js │ ├── modules │ ├── agents.vue │ ├── devices.vue │ ├── frame.vue │ ├── headline.vue │ ├── layout.vue │ ├── log.vue │ ├── navigation.vue │ ├── panel.vue │ ├── rotate.vue │ ├── scale.vue │ └── settings.vue │ ├── router.js │ ├── store.js │ ├── transitions │ └── expand.vue │ └── vars.styl ├── webpack.config.js └── www ├── index.html └── microscope.html /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Julien Barbay 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 |

2 | 3 | # Vue Whiteroom 4 | 5 | ### white what? 6 | 7 | `vue-whiteroom` is a javascript web-application which aim is to display vue components in a safely sealed environment where they can be manipulated while developing them. 8 | 9 | > I personally think that the "whiteroom" vocabulary is more appropriate, since nowadays not so many people use storybook to display user stories, rather as a safe way to isolate components, as if they were bacterias to observe ; which explains the name of the project. The UI may not look fancy but the main idea behind it is to provide the maximum space available to display your component, as it is the main function of this application. Panels come on overlay and are foldable on purpose ; that said, i'd be more than happy to have some inputs to improve. 10 | 11 | #### features 12 | 13 | - [x] hot reload 14 | - [x] _experiments_ (like "story objects") as plain Vue files 15 | - [x] automatically generated knobs from `props` inspection 16 | - [x] `props` can be extended to enhance knobs easily 17 | - [x] multiple _layouts_ 18 | - [x] multiple _devices_ 19 | - [x] extensible _devices_ and _layouts_ declaration 20 | - [x] multi level navigation 21 | 22 | ### why not reuse? 23 | 24 | while [storybook](https://github.com/storybooks/storybook) is an incredible project, it has been written with React for React. The abstraction layer is great, but doesn't work well with Vue.js (as for now, at the very least). An other project, [vue-play](https://github.com/vue-play/vue-play), was completing the task, but lacked of "knobs", and also doesn't look maintained for a year or so. 25 | 26 | ### under the hood? 27 | 28 | This is a basic "storybook" application, so the architecture is quite similar. The application is split in two parts, one rendered in the main frame, and the second one rendered in an iframe. 29 | 30 | Your components are rendered in the iframe, and fed with property values from the url of the iframe. The main application has some knobs which are serialized and passed to the iframe's url, and voila. 31 | 32 | ### how to run? 33 | 34 | 1. Install it from npm `npm install --save-dev vue-whiteroom` 35 | 2. Add `./node_modules/vue-whiteroom/bin/whiteroom` to your npm scripts 36 | 3. Use the default entrypoint `./experiments` in your project 37 | 38 | A basic entrypoint looks like this : 39 | 40 | ```js 41 | import { inspect } from 'vue-whiteroom/api' 42 | 43 | import Demo1 from './demo1.vue' 44 | inspect(Demo1) 45 | ``` 46 | 47 | ### `vue-whiteroom/api` functions 48 | 49 | - `inspect(VueObject, { path = VueObject.__file__, group = '', name = path, description = null })` : this function registers a new object to be inspected. If you come from other projects such as vue-play or storybook, it's almost similar as `.add(() => VueObject)`. The "group" property provides a simple way to add foldable navigation by categories. 50 | 51 | - `device(name, css)` : this function adds the `name` device in the devices definition. `css` must contain at least `width` and `height` as normal css declaration. 52 | 53 | - `layout(name, VueObject)` : this function adds the `name` layout in the list of available layouts. see next chapter about how to write a proper layout (there's a trick) 54 | 55 | - `log(...parameters)` : this function will pass `parameters` to the cute log box, instead of using `console.log`. It's not overriden by default on purpose, but you can do it so easily it's almost mandatory. 56 | 57 | ``` 58 | import { log } from 'vue-whiteroom/api' 59 | const _log = console.log; 60 | console.log = function() { 61 | log(Array.from(arguments)) 62 | _log.apply(console, arguments) 63 | } 64 | ``` 65 | 66 | - `wrap(VueComponent)` : this function will return an auto-generated Vue file to handle your component. It will pass props along (but can't really guess for enums) ; injections will be passed, events will be _all_ listened to, and public functions (not starting with `_` or `$`) will be automatically registered as trigger. 67 | 68 | ### configure my experiment 69 | 70 | A simple experiment should be a Vue file rendering at least an element. 71 | 72 | ``` 73 | 78 | 79 | 111 | ``` 112 | 113 | - Only the default slot is customizable (for now). It is available as a string. 114 | 115 | - Properties will be automatically parsed and will match type and default value accordingly. If you want to customize the property to limit the values to a limited set, you can use a special `enum` property and your whiteroom will display a `