Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-documenter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-documenter - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

333

dist/vue-documenter.common.js

@@ -90,27 +90,20 @@ module.exports =

/***/ "19a8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
/***/ "230b":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("c2f3");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default.a);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "8bbf":
/***/ (function(module, exports) {
/***/ "e677":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
module.exports = require("vue");
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("230b");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "c2f3":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "f6fd":

@@ -173,5 +166,5 @@ /***/ (function(module, exports) {

var setPublicPath_i
if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = setPublicPath_i[1] // eslint-disable-line
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
}

@@ -183,13 +176,9 @@ }

// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fc4fac74-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=template&id=7edd7376&scoped=true&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticStyle:{"display":"none"}},[_vm._t("default")],2),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-3"},[_c('div',{staticClass:"card card-body"},[_c('h2',{staticClass:"mt-0"},[_vm._v("Components")]),_c('ul',_vm._l((_vm.loadedComponents),function(component){return _c('li',{key:("table-of-contents-" + (component.name))},[_c('a',{attrs:{"href":"#{component.name}"}},[_vm._v(_vm._s(component.name))])])}),0)])]),_c('div',{staticClass:"col-sm-9"},_vm._l((_vm.loadedComponents),function(component){return _c('div',{key:("component-" + (component.name)),staticClass:"card card-body mb-5"},[_c('h1',{attrs:{"id":_vm.getKebabCaseFromCamelCase(component.name)}},[_vm._v("<"+_vm._s(_vm.getKebabCaseFromCamelCase(component.name))+">")]),_c('h2',[_vm._v("Properties")]),_c('div',{staticClass:"table-responsive mb-3"},[_c('table',{staticClass:"table table-striped"},[_vm._m(0,true),_c('tbody',_vm._l((component.properties),function(property){return _c('tr',{key:("property-" + (property.name)),class:{ 'deprecated': property.deprecated }},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v("\n "+_vm._s(property.type !== 'string' ? ':' : '')+_vm._s(property.name)+"\n "),(property.required)?_c('span',{staticClass:"badge badge-danger",attrs:{"title":property.required}},[_vm._v("Required")]):_vm._e(),(property.deprecated)?_c('span',{staticClass:"badge badge-warning",attrs:{"title":property.deprecated,"data-tippy":""}},[_vm._v("Deprecated "),_c('i',{staticClass:"fas fa-question-circle"})]):_vm._e()]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.type))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.defaultValue))]),_c('td',[_c('code',[_vm._v(_vm._s(property.example))])])])}),0)])]),_vm._m(1,true),_c('div',{staticClass:"row mb-3"},[_c('div',{staticClass:"col"},[(component.events)?_c('div',{staticClass:"table-responsive"},[_c('table',{staticClass:"table table-striped"},[_vm._m(2,true),_c('tbody',_vm._l((component.events),function(event){return _c('tr',{key:("event-" + (event.name))},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.name))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.selector))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.on))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.example))])])}),0)])]):_c('h3',[_vm._v("None")])])]),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Minimal Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component, { onlyRequired: true }))}})]),_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Full Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component))}})])])])}),0)]),_vm._m(3)])}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Type")]),_c('th',[_vm._v("Default Value")]),_c('th',[_vm._v("Example")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('h2',[_vm._v("Events ("),_c('a',{attrs:{"href":"https://vuejs.org/v2/api/#vm-emit","target":"_blank"}},[_vm._v("Vue Docs")]),_vm._v(")")])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Selector")]),_c('th',[_vm._v("On")]),_c('th',[_vm._v("Example Value")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"alert alert-info d-flex"},[_c('i',{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),_c('div',[_c('h2',[_vm._v("If you're building a new Vue component and you want it to be auto-documented here")]),_c('div',[_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's properties defined with "),_c('code',[_vm._v("type")]),_vm._v(" and "),_c('code',[_vm._v("default")]),_vm._v(" properties, see "),_c('a',{attrs:{"href":"https://vuejs.org/v2/guide/components-props.html#Prop-Validation","target":"_blank"}},[_vm._v("Prop Validation")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component maybe also include a top level "),_c('code',[_vm._v("meta")]),_vm._v(" property with slot and event availability, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\nslots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n},\nevents: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n}],\n},\n")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component's properties may also include an additional "),_c('code',[_vm._v("meta")]),_vm._v(" property in the property definition, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\nrequired: [true|false],\nexample: 'Example implementation code',\ndeprecated: 'Deprecation note that will appear on hover',\n},\n")])])])])])}]
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"089594fe-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=template&id=64944014&scoped=true&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.getComponents()),function(component){return _c('div',{key:("component-" + (component.name)),staticClass:"card card-body mb-5"},[_c('h1',{attrs:{"id":_vm.getKebabCaseFromCamelCase(component.name)}},[_vm._v("<"+_vm._s(_vm.getKebabCaseFromCamelCase(component.name))+">")]),_c('h2',[_vm._v("Properties")]),_c('div',{staticClass:"table-responsive mb-3"},[_c('table',{staticClass:"table table-striped"},[_vm._m(0,true),_c('tbody',_vm._l((component.properties),function(property){return _c('tr',{key:("property-" + (property.name)),class:{ 'deprecated': property.deprecated }},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v("\n "+_vm._s(property.type !== 'string' ? ':' : '')+_vm._s(property.name)+"\n "),(property.required)?_c('span',{staticClass:"badge badge-danger",attrs:{"title":property.required}},[_vm._v("Required")]):_vm._e(),(property.deprecated)?_c('span',{staticClass:"badge badge-warning",attrs:{"title":property.deprecated,"data-tippy":""}},[_vm._v("Deprecated "),_c('i',{staticClass:"fas fa-question-circle"})]):_vm._e()]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.type))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.defaultValue))]),_c('td',[_c('code',[_vm._v(_vm._s(property.example))])])])}),0)])]),_vm._m(1,true),_c('div',{staticClass:"row mb-3"},[_c('div',{staticClass:"col"},[(component.events)?_c('div',{staticClass:"table-responsive"},[_c('table',{staticClass:"table table-striped"},[_vm._m(2,true),_c('tbody',_vm._l((component.events),function(event){return _c('tr',{key:("event-" + (event.name))},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.name))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.selector))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.on))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.example))])])}),0)])]):_c('h3',[_vm._v("None")])])]),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Minimal Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component, { onlyRequired: true }))}})]),_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Full Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component))}})])])])}),_vm._m(3)],2)}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Type")]),_c('th',[_vm._v("Default Value")]),_c('th',[_vm._v("Example")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('h2',[_vm._v("Events ("),_c('a',{attrs:{"href":"https://vuejs.org/v2/api/#vm-emit","target":"_blank"}},[_vm._v("Vue Docs")]),_vm._v(")")])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Selector")]),_c('th',[_vm._v("On")]),_c('th',[_vm._v("Example Value")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"alert alert-info d-flex"},[_c('i',{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),_c('div',[_c('h2',[_vm._v("If you're building a new Vue component and you want it to be auto-documented here")]),_c('div',[_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's own name property match its registered component name, ex -\n "),_c('br'),_vm._v("\n If you register "),_c('code',[_vm._v("Datatable.vue")]),_vm._v(" with "),_c('code',[_vm._v("Vue.component('sj-datatable', Datatable);")]),_vm._v(", then "),_c('code',[_vm._v("Datatable.vue")]),_c('em',[_vm._v("itself")]),_vm._v(" needs a top-level "),_c('code',[_vm._v("{ name: 'SjDatatable' }")]),_vm._v(" property\n ")]),_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's properties defined with "),_c('code',[_vm._v("type")]),_vm._v(" and "),_c('code',[_vm._v("default")]),_vm._v(" properties, see "),_c('a',{attrs:{"href":"https://vuejs.org/v2/guide/components-props.html#Prop-Validation","target":"_blank"}},[_vm._v("Prop Validation")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component can also add an additional "),_c('code',[_vm._v("meta")]),_vm._v(" property to the property definition, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\n required: [true|false],\n example: 'Example implementation code',\n deprecated: 'Deprecation note that will appear on hover',\n},\n")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component can also add a top level "),_c('code',[_vm._v("meta")]),_vm._v(" property with slot and event availability, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\n slots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n },\n events: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n }],\n},\n")])])])])])}]
// CONCATENATED MODULE: ./src/VueDocumenter.vue?vue&type=template&id=7edd7376&scoped=true&
// CONCATENATED MODULE: ./src/VueDocumenter.vue?vue&type=template&id=64944014&scoped=true&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=script&lang=js&

@@ -328,76 +317,46 @@ //

//
//
//
//
//
//
//
//
//
//
//
// import ComponentOne from './ComponentOne.vue';
// import ComponentTwo from './ComponentTwo.vue';
/* harmony default export */ var VueDocumentervue_type_script_lang_js_ = ({
props: {
componentToDocument: {
type: Array,
default: () => [],
},
},
data() {
return {
componentsToDocument: [
// ComponentOne,
// ComponentTwo,
],
loadedComponents: [],
};
},
mounted() {
this.loadComponents();
},
methods: {
getComponents() {
loadComponents() {
this.log('loadComponents()');
const components = [];
const vms = [];
const components = this.$slots.default.filter(vnode => vnode.tag !== undefined);
const componentWrapperElement = document.createElement('div');
componentWrapperElement.style.display = 'none';
componentWrapperElement.id = 'temporary-components-wrapper';
document.body.appendChild(componentWrapperElement);
this.log('Components found', components);
for (let i = 0; i < this.componentsToDocument.length; i++) {
const LoadedComponent = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend(this.componentsToDocument[i]);
vms[i] = new LoadedComponent();
const componentHtmlId = `temporary-component-${this.componentsToDocument[i].name.toLowerCase()}`;
const componentElement = document.createElement('div');
componentElement.id = componentHtmlId;
document.querySelector('#temporary-components-wrapper').appendChild(componentElement);
try {
vms[i].$mount(`#${componentHtmlId}`);
if (vms[i]) {
const properties = this.getProperties(vms[i]);
components.push({
name: this.componentsToDocument[i].name,
properties: [...properties],
events: (vms[i].$options.meta && vms[i].$options.meta.events) ? vms[i].$options.meta.events : null,
slots: (vms[i].$options.meta && vms[i].$options.meta.slots) ? vms[i].$options.meta.slots : null,
});
vms[i].$destroy();
}
} catch (e) {
// eslint-disable-next-line
console.log(e);
}
if (!components) {
return [];
}
for (let i = 0; i < components.length; i += 1) {
const properties = this.loadProperties(components[i]);
const component = {
name: components[i].componentOptions.tag,
properties: [...properties],
events: (components[i].componentInstance.$options.meta && components[i].componentInstance.$options.meta.events) ? components[i].componentInstance.$options.meta.events : null,
slots: (components[i].componentInstance.$options.meta && components[i].componentInstance.$options.meta.slots) ? components[i].componentInstance.$options.meta.slots : null,
};
this.loadedComponents.push(component);
}
document.getElementById('temporary-components-wrapper').remove();
return components;
return true;
},

@@ -410,3 +369,3 @@ getComponentExampleHtml(component, minimal = false) {

// Build the properties HTML
const componentProperties = minimal ? component.properties.filter(property => property.required && !property.deprecated) : component.properties.filter(property => !property.deprecated);
const componentProperties = minimal ? component.properties && component.properties.filter(property => property.required && !property.deprecated) : component.properties && component.properties.filter(property => !property.deprecated);

@@ -479,93 +438,78 @@ let properties = componentProperties.map(property => `<span class="property">${property.type === 'string' ? '' : ':'}${property.name}</span>="<span class="value">${property.example}</span>"`).join('<br>');

return html;
},
getProperties(vm) {
loadProperties(vnode) {
this.log('loadProperties()', vnode);
if (!vm) {
if (!vnode) {
return false;
}
const properties = [];
const propertyKeys = Object.keys(vm.$options.props);
const propertyKeys = Object.keys(vnode.componentInstance.$options.props);
propertyKeys.sort();
for (let i = 0; i < propertyKeys.length; i++) {
this.log('Properties found', propertyKeys);
for (let i = 0; i < propertyKeys.length; i += 1) {
const item = propertyKeys[i];
const name = this.getKebabCaseFromCamelCase(item);
const type = this.getPropertyType(vm.$options.props[item].type);
let defaultValue = vm.$options.props[item].default && vm.$options.props[item].default.toString();
const required = vm.$options.props[item].meta && vm.$options.props[item].meta.required;
const deprecated = vm.$options.props[item].meta && vm.$options.props[item].meta.deprecated;
let example = vm.$options.props[item].meta && vm.$options.props[item].meta.example;
const type = this.getPropertyType(vnode.componentInstance.$options.props[item].type);
let defaultValue = vnode.componentInstance.$options.props[item].default && vnode.componentInstance.$options.props[item].default.toString();
const required = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.required;
const deprecated = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.deprecated;
let example = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.example;
switch (type) {
case 'array':
example = example || '[4, 8, 15, 16, 23, 42]';
case 'array':
example = example || '[4, 8, 15, 16, 23, 42]';
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{\s*return\s*(.*);?\s*}/);
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{\s*return\s*(.*);?\s*}/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
break;
}
break;
case 'object':
example = example || '{ key1: value1, key2: value2 }';
case 'object':
example = example || '{ key1: value1, key2: value2 }';
if (defaultValue) {
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/(?:_default|function)\(\)\s*(.*)/);
const cleanedDefaultValue = defaultValue.match(/(?:_default|function)\(\)\s*(.*)/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
break;
}
break;
case 'string':
example = example || 'Some text';
break;
case 'string':
example = example || 'Some text';
break;
case 'function':
example = example || '(value) => { return value.toUpperCase() }';
case 'function':
example = example || '(value) => { return value.toUpperCase() }';
if (defaultValue) {
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{(.*)}/);
const cleanedDefaultValue = defaultValue.match(/{(.*)}/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
}
break;
}
break;
case 'number':
example = example || '14';
break;
case 'number':
example = example || '14';
break;
case 'boolean':
example = example || 'true';
break;
case 'boolean':
example = example || 'true';
break;
default:
example = example || '';
default:
example = example || '';
}

@@ -583,82 +527,36 @@

});
}
properties.sort((a, b) => {
if (properties.length > 0) {
properties.sort((a, b) => {
const aIsRequired = !!a.required;
const bIsRequired = !!b.required;
const aIsRequired = !!a.required;
const bIsRequired = !!b.required;
if (aIsRequired === bIsRequired) {
return a.name > b.name;
}
if (aIsRequired === bIsRequired) {
return a.name > b.name;
}
if (aIsRequired !== bIsRequired) {
if (aIsRequired && !bIsRequired) {
return -1;
if (aIsRequired !== bIsRequired) {
if (aIsRequired && !bIsRequired) {
return -1;
}
return 1;
}
return 1;
});
}
}
this.log(properties);
return 1;
});
return properties;
},
getKebabCaseFromCamelCase(internalName) {
return internalName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
return internalName && internalName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
},
getPropertyType(typeFunctionString) {
const typeFunction = typeFunctionString.toString().split(' ')[1];
return typeFunction.substr(0, typeFunction.length - 2).toLowerCase();
},
getNonDeprecatedProperties(properties) {
const propertiesArray = Object.values(properties);
let nonDeprecatedProperties = [];
if (!propertiesArray.length) {
return [];
}
nonDeprecatedProperties = propertiesArray.filter(property => !property.deprecated);
return nonDeprecatedProperties;
},
getRequiredNonDeprecatedProperties(properties) {
const propertiesArray = Object.values(properties);
let requiredNonDeprecatedProperties = [];
if (!propertiesArray.length) {
return [];
}
requiredNonDeprecatedProperties = propertiesArray.filter(property => property.required && !property.deprecated);
return requiredNonDeprecatedProperties;
},
},
mounted() {
},
});

@@ -668,4 +566,4 @@

/* harmony default export */ var src_VueDocumentervue_type_script_lang_js_ = (VueDocumentervue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/VueDocumenter.vue?vue&type=style&index=0&id=64944014&lang=scss&scoped=true&
var VueDocumentervue_type_style_index_0_id_64944014_lang_scss_scoped_true_ = __webpack_require__("19a8");
// EXTERNAL MODULE: ./src/VueDocumenter.vue?vue&type=style&index=0&id=7edd7376&lang=scss&scoped=true&
var VueDocumentervue_type_style_index_0_id_7edd7376_lang_scss_scoped_true_ = __webpack_require__("e677");

@@ -782,3 +680,3 @@ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js

null,
"64944014",
"7edd7376",
null

@@ -792,5 +690,2 @@

external_commonjs_vue_commonjs2_vue_root_Vue_default.a.component('vue-documenter', VueDocumenter);
/* harmony default export */ var src = (VueDocumenter);

@@ -797,0 +692,0 @@ // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["vue-documenter"] = factory(require("vue"));
exports["vue-documenter"] = factory();
else
root["vue-documenter"] = factory(root["Vue"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__8bbf__) {
root["vue-documenter"] = factory();
})((typeof self !== 'undefined' ? self : this), function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -99,27 +99,20 @@ /******/ // The module cache

/***/ "19a8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
/***/ "230b":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("c2f3");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_64944014_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default.a);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "8bbf":
/***/ (function(module, exports) {
/***/ "e677":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__;
"use strict";
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("230b");
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueDocumenter_vue_vue_type_style_index_0_id_7edd7376_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ "c2f3":
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "f6fd":

@@ -182,5 +175,5 @@ /***/ (function(module, exports) {

var setPublicPath_i
if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = setPublicPath_i[1] // eslint-disable-line
var i
if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
__webpack_require__.p = i[1] // eslint-disable-line
}

@@ -192,13 +185,9 @@ }

// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fc4fac74-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=template&id=7edd7376&scoped=true&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticStyle:{"display":"none"}},[_vm._t("default")],2),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-3"},[_c('div',{staticClass:"card card-body"},[_c('h2',{staticClass:"mt-0"},[_vm._v("Components")]),_c('ul',_vm._l((_vm.loadedComponents),function(component){return _c('li',{key:("table-of-contents-" + (component.name))},[_c('a',{attrs:{"href":"#{component.name}"}},[_vm._v(_vm._s(component.name))])])}),0)])]),_c('div',{staticClass:"col-sm-9"},_vm._l((_vm.loadedComponents),function(component){return _c('div',{key:("component-" + (component.name)),staticClass:"card card-body mb-5"},[_c('h1',{attrs:{"id":_vm.getKebabCaseFromCamelCase(component.name)}},[_vm._v("<"+_vm._s(_vm.getKebabCaseFromCamelCase(component.name))+">")]),_c('h2',[_vm._v("Properties")]),_c('div',{staticClass:"table-responsive mb-3"},[_c('table',{staticClass:"table table-striped"},[_vm._m(0,true),_c('tbody',_vm._l((component.properties),function(property){return _c('tr',{key:("property-" + (property.name)),class:{ 'deprecated': property.deprecated }},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v("\n "+_vm._s(property.type !== 'string' ? ':' : '')+_vm._s(property.name)+"\n "),(property.required)?_c('span',{staticClass:"badge badge-danger",attrs:{"title":property.required}},[_vm._v("Required")]):_vm._e(),(property.deprecated)?_c('span',{staticClass:"badge badge-warning",attrs:{"title":property.deprecated,"data-tippy":""}},[_vm._v("Deprecated "),_c('i',{staticClass:"fas fa-question-circle"})]):_vm._e()]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.type))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.defaultValue))]),_c('td',[_c('code',[_vm._v(_vm._s(property.example))])])])}),0)])]),_vm._m(1,true),_c('div',{staticClass:"row mb-3"},[_c('div',{staticClass:"col"},[(component.events)?_c('div',{staticClass:"table-responsive"},[_c('table',{staticClass:"table table-striped"},[_vm._m(2,true),_c('tbody',_vm._l((component.events),function(event){return _c('tr',{key:("event-" + (event.name))},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.name))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.selector))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.on))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.example))])])}),0)])]):_c('h3',[_vm._v("None")])])]),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Minimal Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component, { onlyRequired: true }))}})]),_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Full Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component))}})])])])}),0)]),_vm._m(3)])}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Type")]),_c('th',[_vm._v("Default Value")]),_c('th',[_vm._v("Example")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('h2',[_vm._v("Events ("),_c('a',{attrs:{"href":"https://vuejs.org/v2/api/#vm-emit","target":"_blank"}},[_vm._v("Vue Docs")]),_vm._v(")")])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Selector")]),_c('th',[_vm._v("On")]),_c('th',[_vm._v("Example Value")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"alert alert-info d-flex"},[_c('i',{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),_c('div',[_c('h2',[_vm._v("If you're building a new Vue component and you want it to be auto-documented here")]),_c('div',[_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's properties defined with "),_c('code',[_vm._v("type")]),_vm._v(" and "),_c('code',[_vm._v("default")]),_vm._v(" properties, see "),_c('a',{attrs:{"href":"https://vuejs.org/v2/guide/components-props.html#Prop-Validation","target":"_blank"}},[_vm._v("Prop Validation")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component maybe also include a top level "),_c('code',[_vm._v("meta")]),_vm._v(" property with slot and event availability, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\nslots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n},\nevents: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n}],\n},\n")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component's properties may also include an additional "),_c('code',[_vm._v("meta")]),_vm._v(" property in the property definition, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\nrequired: [true|false],\nexample: 'Example implementation code',\ndeprecated: 'Deprecation note that will appear on hover',\n},\n")])])])])])}]
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"089594fe-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=template&id=64944014&scoped=true&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.getComponents()),function(component){return _c('div',{key:("component-" + (component.name)),staticClass:"card card-body mb-5"},[_c('h1',{attrs:{"id":_vm.getKebabCaseFromCamelCase(component.name)}},[_vm._v("<"+_vm._s(_vm.getKebabCaseFromCamelCase(component.name))+">")]),_c('h2',[_vm._v("Properties")]),_c('div',{staticClass:"table-responsive mb-3"},[_c('table',{staticClass:"table table-striped"},[_vm._m(0,true),_c('tbody',_vm._l((component.properties),function(property){return _c('tr',{key:("property-" + (property.name)),class:{ 'deprecated': property.deprecated }},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v("\n "+_vm._s(property.type !== 'string' ? ':' : '')+_vm._s(property.name)+"\n "),(property.required)?_c('span',{staticClass:"badge badge-danger",attrs:{"title":property.required}},[_vm._v("Required")]):_vm._e(),(property.deprecated)?_c('span',{staticClass:"badge badge-warning",attrs:{"title":property.deprecated,"data-tippy":""}},[_vm._v("Deprecated "),_c('i',{staticClass:"fas fa-question-circle"})]):_vm._e()]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.type))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(property.defaultValue))]),_c('td',[_c('code',[_vm._v(_vm._s(property.example))])])])}),0)])]),_vm._m(1,true),_c('div',{staticClass:"row mb-3"},[_c('div',{staticClass:"col"},[(component.events)?_c('div',{staticClass:"table-responsive"},[_c('table',{staticClass:"table table-striped"},[_vm._m(2,true),_c('tbody',_vm._l((component.events),function(event){return _c('tr',{key:("event-" + (event.name))},[_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.name))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.selector))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.on))]),_c('td',{staticStyle:{"white-space":"nowrap"}},[_vm._v(_vm._s(event.example))])])}),0)])]):_c('h3',[_vm._v("None")])])]),_c('div',{staticClass:"row"},[_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Minimal Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component, { onlyRequired: true }))}})]),_c('div',{staticClass:"col-sm-6"},[_c('h2',[_vm._v("Full Example")]),_c('div',{staticClass:"code-highlight",domProps:{"innerHTML":_vm._s(_vm.getComponentExampleHtml(component))}})])])])}),_vm._m(3)],2)}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Type")]),_c('th',[_vm._v("Default Value")]),_c('th',[_vm._v("Example")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('h2',[_vm._v("Events ("),_c('a',{attrs:{"href":"https://vuejs.org/v2/api/#vm-emit","target":"_blank"}},[_vm._v("Vue Docs")]),_vm._v(")")])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('thead',[_c('tr',[_c('th',[_vm._v("Name")]),_c('th',[_vm._v("Selector")]),_c('th',[_vm._v("On")]),_c('th',[_vm._v("Example Value")])])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"alert alert-info d-flex"},[_c('i',{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),_c('div',[_c('h2',[_vm._v("If you're building a new Vue component and you want it to be auto-documented here")]),_c('div',[_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's own name property match its registered component name, ex -\n "),_c('br'),_vm._v("\n If you register "),_c('code',[_vm._v("Datatable.vue")]),_vm._v(" with "),_c('code',[_vm._v("Vue.component('sj-datatable', Datatable);")]),_vm._v(", then "),_c('code',[_vm._v("Datatable.vue")]),_c('em',[_vm._v("itself")]),_vm._v(" needs a top-level "),_c('code',[_vm._v("{ name: 'SjDatatable' }")]),_vm._v(" property\n ")]),_c('p',[_c('span',{staticClass:"badge badge-danger"},[_vm._v("Required")]),_vm._v(" The component must have it's properties defined with "),_c('code',[_vm._v("type")]),_vm._v(" and "),_c('code',[_vm._v("default")]),_vm._v(" properties, see "),_c('a',{attrs:{"href":"https://vuejs.org/v2/guide/components-props.html#Prop-Validation","target":"_blank"}},[_vm._v("Prop Validation")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component can also add an additional "),_c('code',[_vm._v("meta")]),_vm._v(" property to the property definition, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\n required: [true|false],\n example: 'Example implementation code',\n deprecated: 'Deprecation note that will appear on hover',\n},\n")])]),_c('p',[_c('span',{staticClass:"badge badge-secondary"},[_vm._v("Optional")]),_vm._v(" The component can also add a top level "),_c('code',[_vm._v("meta")]),_vm._v(" property with slot and event availability, ex.\n"),_c('code',{staticStyle:{"white-space":"pre"}},[_vm._v("\nmeta: {\n slots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n },\n events: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n }],\n},\n")])])])])])}]
// CONCATENATED MODULE: ./src/VueDocumenter.vue?vue&type=template&id=7edd7376&scoped=true&
// CONCATENATED MODULE: ./src/VueDocumenter.vue?vue&type=template&id=64944014&scoped=true&
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueDocumenter.vue?vue&type=script&lang=js&

@@ -337,76 +326,46 @@ //

//
//
//
//
//
//
//
//
//
//
//
// import ComponentOne from './ComponentOne.vue';
// import ComponentTwo from './ComponentTwo.vue';
/* harmony default export */ var VueDocumentervue_type_script_lang_js_ = ({
props: {
componentToDocument: {
type: Array,
default: () => [],
},
},
data() {
return {
componentsToDocument: [
// ComponentOne,
// ComponentTwo,
],
loadedComponents: [],
};
},
mounted() {
this.loadComponents();
},
methods: {
getComponents() {
loadComponents() {
this.log('loadComponents()');
const components = [];
const vms = [];
const components = this.$slots.default.filter(vnode => vnode.tag !== undefined);
const componentWrapperElement = document.createElement('div');
componentWrapperElement.style.display = 'none';
componentWrapperElement.id = 'temporary-components-wrapper';
document.body.appendChild(componentWrapperElement);
this.log('Components found', components);
for (let i = 0; i < this.componentsToDocument.length; i++) {
const LoadedComponent = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend(this.componentsToDocument[i]);
vms[i] = new LoadedComponent();
const componentHtmlId = `temporary-component-${this.componentsToDocument[i].name.toLowerCase()}`;
const componentElement = document.createElement('div');
componentElement.id = componentHtmlId;
document.querySelector('#temporary-components-wrapper').appendChild(componentElement);
try {
vms[i].$mount(`#${componentHtmlId}`);
if (vms[i]) {
const properties = this.getProperties(vms[i]);
components.push({
name: this.componentsToDocument[i].name,
properties: [...properties],
events: (vms[i].$options.meta && vms[i].$options.meta.events) ? vms[i].$options.meta.events : null,
slots: (vms[i].$options.meta && vms[i].$options.meta.slots) ? vms[i].$options.meta.slots : null,
});
vms[i].$destroy();
}
} catch (e) {
// eslint-disable-next-line
console.log(e);
}
if (!components) {
return [];
}
for (let i = 0; i < components.length; i += 1) {
const properties = this.loadProperties(components[i]);
const component = {
name: components[i].componentOptions.tag,
properties: [...properties],
events: (components[i].componentInstance.$options.meta && components[i].componentInstance.$options.meta.events) ? components[i].componentInstance.$options.meta.events : null,
slots: (components[i].componentInstance.$options.meta && components[i].componentInstance.$options.meta.slots) ? components[i].componentInstance.$options.meta.slots : null,
};
this.loadedComponents.push(component);
}
document.getElementById('temporary-components-wrapper').remove();
return components;
return true;
},

@@ -419,3 +378,3 @@ getComponentExampleHtml(component, minimal = false) {

// Build the properties HTML
const componentProperties = minimal ? component.properties.filter(property => property.required && !property.deprecated) : component.properties.filter(property => !property.deprecated);
const componentProperties = minimal ? component.properties && component.properties.filter(property => property.required && !property.deprecated) : component.properties && component.properties.filter(property => !property.deprecated);

@@ -488,93 +447,78 @@ let properties = componentProperties.map(property => `<span class="property">${property.type === 'string' ? '' : ':'}${property.name}</span>="<span class="value">${property.example}</span>"`).join('<br>');

return html;
},
getProperties(vm) {
loadProperties(vnode) {
this.log('loadProperties()', vnode);
if (!vm) {
if (!vnode) {
return false;
}
const properties = [];
const propertyKeys = Object.keys(vm.$options.props);
const propertyKeys = Object.keys(vnode.componentInstance.$options.props);
propertyKeys.sort();
for (let i = 0; i < propertyKeys.length; i++) {
this.log('Properties found', propertyKeys);
for (let i = 0; i < propertyKeys.length; i += 1) {
const item = propertyKeys[i];
const name = this.getKebabCaseFromCamelCase(item);
const type = this.getPropertyType(vm.$options.props[item].type);
let defaultValue = vm.$options.props[item].default && vm.$options.props[item].default.toString();
const required = vm.$options.props[item].meta && vm.$options.props[item].meta.required;
const deprecated = vm.$options.props[item].meta && vm.$options.props[item].meta.deprecated;
let example = vm.$options.props[item].meta && vm.$options.props[item].meta.example;
const type = this.getPropertyType(vnode.componentInstance.$options.props[item].type);
let defaultValue = vnode.componentInstance.$options.props[item].default && vnode.componentInstance.$options.props[item].default.toString();
const required = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.required;
const deprecated = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.deprecated;
let example = vnode.componentInstance.$options.props[item].meta && vnode.componentInstance.$options.props[item].meta.example;
switch (type) {
case 'array':
example = example || '[4, 8, 15, 16, 23, 42]';
case 'array':
example = example || '[4, 8, 15, 16, 23, 42]';
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{\s*return\s*(.*);?\s*}/);
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{\s*return\s*(.*);?\s*}/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
break;
}
break;
case 'object':
example = example || '{ key1: value1, key2: value2 }';
case 'object':
example = example || '{ key1: value1, key2: value2 }';
if (defaultValue) {
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/(?:_default|function)\(\)\s*(.*)/);
const cleanedDefaultValue = defaultValue.match(/(?:_default|function)\(\)\s*(.*)/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
break;
}
break;
case 'string':
example = example || 'Some text';
break;
case 'string':
example = example || 'Some text';
break;
case 'function':
example = example || '(value) => { return value.toUpperCase() }';
case 'function':
example = example || '(value) => { return value.toUpperCase() }';
if (defaultValue) {
if (defaultValue) {
const cleanedDefaultValue = defaultValue.match(/{(.*)}/);
const cleanedDefaultValue = defaultValue.match(/{(.*)}/);
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
if (cleanedDefaultValue && cleanedDefaultValue[1] !== undefined) {
[, defaultValue] = cleanedDefaultValue;
}
}
break;
}
break;
case 'number':
example = example || '14';
break;
case 'number':
example = example || '14';
break;
case 'boolean':
example = example || 'true';
break;
case 'boolean':
example = example || 'true';
break;
default:
example = example || '';
default:
example = example || '';
}

@@ -592,82 +536,36 @@

});
}
properties.sort((a, b) => {
if (properties.length > 0) {
properties.sort((a, b) => {
const aIsRequired = !!a.required;
const bIsRequired = !!b.required;
const aIsRequired = !!a.required;
const bIsRequired = !!b.required;
if (aIsRequired === bIsRequired) {
return a.name > b.name;
}
if (aIsRequired === bIsRequired) {
return a.name > b.name;
}
if (aIsRequired !== bIsRequired) {
if (aIsRequired && !bIsRequired) {
return -1;
if (aIsRequired !== bIsRequired) {
if (aIsRequired && !bIsRequired) {
return -1;
}
return 1;
}
return 1;
});
}
}
this.log(properties);
return 1;
});
return properties;
},
getKebabCaseFromCamelCase(internalName) {
return internalName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
return internalName && internalName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
},
getPropertyType(typeFunctionString) {
const typeFunction = typeFunctionString.toString().split(' ')[1];
return typeFunction.substr(0, typeFunction.length - 2).toLowerCase();
},
getNonDeprecatedProperties(properties) {
const propertiesArray = Object.values(properties);
let nonDeprecatedProperties = [];
if (!propertiesArray.length) {
return [];
}
nonDeprecatedProperties = propertiesArray.filter(property => !property.deprecated);
return nonDeprecatedProperties;
},
getRequiredNonDeprecatedProperties(properties) {
const propertiesArray = Object.values(properties);
let requiredNonDeprecatedProperties = [];
if (!propertiesArray.length) {
return [];
}
requiredNonDeprecatedProperties = propertiesArray.filter(property => property.required && !property.deprecated);
return requiredNonDeprecatedProperties;
},
},
mounted() {
},
});

@@ -677,4 +575,4 @@

/* harmony default export */ var src_VueDocumentervue_type_script_lang_js_ = (VueDocumentervue_type_script_lang_js_);
// EXTERNAL MODULE: ./src/VueDocumenter.vue?vue&type=style&index=0&id=64944014&lang=scss&scoped=true&
var VueDocumentervue_type_style_index_0_id_64944014_lang_scss_scoped_true_ = __webpack_require__("19a8");
// EXTERNAL MODULE: ./src/VueDocumenter.vue?vue&type=style&index=0&id=7edd7376&lang=scss&scoped=true&
var VueDocumentervue_type_style_index_0_id_7edd7376_lang_scss_scoped_true_ = __webpack_require__("e677");

@@ -791,3 +689,3 @@ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js

null,
"64944014",
"7edd7376",
null

@@ -801,5 +699,2 @@

external_commonjs_vue_commonjs2_vue_root_Vue_default.a.component('vue-documenter', VueDocumenter);
/* harmony default export */ var src = (VueDocumenter);

@@ -806,0 +701,0 @@ // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js

@@ -1,2 +0,2 @@

(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-documenter"]=t(require("vue")):e["vue-documenter"]=t(e["Vue"])})("undefined"!==typeof self?self:this,function(e){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(a,o,function(t){return e[t]}.bind(null,o));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"19a8":function(e,t,n){"use strict";var a=n("c2f3"),o=n.n(a);o.a},"8bbf":function(t,n){t.exports=e},c2f3:function(e,t,n){},f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(a){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(a.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fb15:function(e,t,n){"use strict";var a;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(a=window.document.currentScript)&&(a=a.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(n.p=a[1]));var o=n("8bbf"),s=n.n(o),r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[e._l(e.getComponents(),function(t){return n("div",{key:"component-"+t.name,staticClass:"card card-body mb-5"},[n("h1",{attrs:{id:e.getKebabCaseFromCamelCase(t.name)}},[e._v("<"+e._s(e.getKebabCaseFromCamelCase(t.name))+">")]),n("h2",[e._v("Properties")]),n("div",{staticClass:"table-responsive mb-3"},[n("table",{staticClass:"table table-striped"},[e._m(0,!0),n("tbody",e._l(t.properties,function(t){return n("tr",{key:"property-"+t.name,class:{deprecated:t.deprecated}},[n("td",{staticStyle:{"white-space":"nowrap"}},[e._v("\n "+e._s("string"!==t.type?":":"")+e._s(t.name)+"\n "),t.required?n("span",{staticClass:"badge badge-danger",attrs:{title:t.required}},[e._v("Required")]):e._e(),t.deprecated?n("span",{staticClass:"badge badge-warning",attrs:{title:t.deprecated,"data-tippy":""}},[e._v("Deprecated "),n("i",{staticClass:"fas fa-question-circle"})]):e._e()]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.type))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.defaultValue))]),n("td",[n("code",[e._v(e._s(t.example))])])])}),0)])]),e._m(1,!0),n("div",{staticClass:"row mb-3"},[n("div",{staticClass:"col"},[t.events?n("div",{staticClass:"table-responsive"},[n("table",{staticClass:"table table-striped"},[e._m(2,!0),n("tbody",e._l(t.events,function(t){return n("tr",{key:"event-"+t.name},[n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.name))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.selector))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.on))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.example))])])}),0)])]):n("h3",[e._v("None")])])]),n("div",{staticClass:"row"},[n("div",{staticClass:"col-sm-6"},[n("h2",[e._v("Minimal Example")]),n("div",{staticClass:"code-highlight",domProps:{innerHTML:e._s(e.getComponentExampleHtml(t,{onlyRequired:!0}))}})]),n("div",{staticClass:"col-sm-6"},[n("h2",[e._v("Full Example")]),n("div",{staticClass:"code-highlight",domProps:{innerHTML:e._s(e.getComponentExampleHtml(t))}})])])])}),e._m(3)],2)},i=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("thead",[n("tr",[n("th",[e._v("Name")]),n("th",[e._v("Type")]),n("th",[e._v("Default Value")]),n("th",[e._v("Example")])])])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("h2",[e._v("Events ("),n("a",{attrs:{href:"https://vuejs.org/v2/api/#vm-emit",target:"_blank"}},[e._v("Vue Docs")]),e._v(")")])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("thead",[n("tr",[n("th",[e._v("Name")]),n("th",[e._v("Selector")]),n("th",[e._v("On")]),n("th",[e._v("Example Value")])])])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"alert alert-info d-flex"},[n("i",{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),n("div",[n("h2",[e._v("If you're building a new Vue component and you want it to be auto-documented here")]),n("div",[n("p",[n("span",{staticClass:"badge badge-danger"},[e._v("Required")]),e._v(" The component must have it's own name property match its registered component name, ex -\n "),n("br"),e._v("\n If you register "),n("code",[e._v("Datatable.vue")]),e._v(" with "),n("code",[e._v("Vue.component('sj-datatable', Datatable);")]),e._v(", then "),n("code",[e._v("Datatable.vue")]),n("em",[e._v("itself")]),e._v(" needs a top-level "),n("code",[e._v("{ name: 'SjDatatable' }")]),e._v(" property\n ")]),n("p",[n("span",{staticClass:"badge badge-danger"},[e._v("Required")]),e._v(" The component must have it's properties defined with "),n("code",[e._v("type")]),e._v(" and "),n("code",[e._v("default")]),e._v(" properties, see "),n("a",{attrs:{href:"https://vuejs.org/v2/guide/components-props.html#Prop-Validation",target:"_blank"}},[e._v("Prop Validation")])]),n("p",[n("span",{staticClass:"badge badge-secondary"},[e._v("Optional")]),e._v(" The component can also add an additional "),n("code",[e._v("meta")]),e._v(" property to the property definition, ex.\n"),n("code",{staticStyle:{"white-space":"pre"}},[e._v("\nmeta: {\n required: [true|false],\n example: 'Example implementation code',\n deprecated: 'Deprecation note that will appear on hover',\n},\n")])]),n("p",[n("span",{staticClass:"badge badge-secondary"},[e._v("Optional")]),e._v(" The component can also add a top level "),n("code",[e._v("meta")]),e._v(" property with slot and event availability, ex.\n"),n("code",{staticStyle:{"white-space":"pre"}},[e._v("\nmeta: {\n slots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n },\n events: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n }],\n},\n")])])])])])}],p={props:{componentToDocument:{type:Array,default:()=>[]}},data(){return{componentsToDocument:[]}},methods:{getComponents(){const e=[],t=[],n=document.createElement("div");n.style.display="none",n.id="temporary-components-wrapper",document.body.appendChild(n);for(let o=0;o<this.componentsToDocument.length;o++){const n=s.a.extend(this.componentsToDocument[o]);t[o]=new n;const r=`temporary-component-${this.componentsToDocument[o].name.toLowerCase()}`,i=document.createElement("div");i.id=r,document.querySelector("#temporary-components-wrapper").appendChild(i);try{if(t[o].$mount(`#${r}`),t[o]){const n=this.getProperties(t[o]);e.push({name:this.componentsToDocument[o].name,properties:[...n],events:t[o].$options.meta&&t[o].$options.meta.events?t[o].$options.meta.events:null,slots:t[o].$options.meta&&t[o].$options.meta.slots?t[o].$options.meta.slots:null}),t[o].$destroy()}}catch(a){console.log(a)}}return document.getElementById("temporary-components-wrapper").remove(),e},getComponentExampleHtml(e,t=!1){const n=this.getKebabCaseFromCamelCase(e.name),a=t?e.properties.filter(e=>e.required&&!e.deprecated):e.properties.filter(e=>!e.deprecated);let o=a.map(e=>`<span class="property">${"string"===e.type?"":":"}${e.name}</span>="<span class="value">${e.example}</span>"`).join("<br>");o&&(o=`<br>${o}<br>`);let s="";t||(e.slots&&(e.slots.named.length>0&&e.slots.named.forEach(e=>{"component"===e.type&&e.valid.forEach(t=>{const n=this.getKebabCaseFromCamelCase(t);s=`\n ${s}\n <br>\n <div class="slot">\n &lt;template v-slot:${e.name}&gt;\n <br>\n <span class="slot-contents">&lt;${n}&gt;&lt;/${n}&gt;</span>\n <br>\n &lt;/template&gt;\n </div>\n `})}),e.slots.default&&(s=`${s}\n <br>\n <div class="slot">\n &lt;<span class="tag">template</span> <span class="property">v-slot:default</span>&gt;\n `,"component"===e.slots.default.type&&e.slots.default.valid.forEach(e=>{const t=this.getKebabCaseFromCamelCase(e);s=`${s}<br><span class="slot-contents"><a href="#${t}">&lt;<span class="tag">${t}</span>&gt;&lt;/<span class="tag">${t}</span>&gt;</a></span>`}),s=`${s}\n <br>\n &lt;/<span class="tag">template</span>&gt;\n </div>\n `)),s&&(s=`${s}`));const r=`&lt;<span class="tag">${n}</span>${o}&gt;${s}&lt;/<span class="tag">${n}</span>&gt;`;return r},getProperties(e){if(!e)return!1;const t=[],n=Object.keys(e.$options.props);n.sort();for(let a=0;a<n.length;a++){const o=n[a],s=this.getKebabCaseFromCamelCase(o),r=this.getPropertyType(e.$options.props[o].type);let i=e.$options.props[o].default&&e.$options.props[o].default.toString();const p=e.$options.props[o].meta&&e.$options.props[o].meta.required,l=e.$options.props[o].meta&&e.$options.props[o].meta.deprecated;let c=e.$options.props[o].meta&&e.$options.props[o].meta.example;switch(r){case"array":if(c=c||"[4, 8, 15, 16, 23, 42]",i){const e=i.match(/{\s*return\s*(.*);?\s*}/);e&&void 0!==e[1]&&([,i]=e)}break;case"object":if(c=c||"{ key1: value1, key2: value2 }",i){const e=i.match(/(?:_default|function)\(\)\s*(.*)/);e&&void 0!==e[1]&&([,i]=e)}break;case"string":c=c||"Some text";break;case"function":if(c=c||"(value) => { return value.toUpperCase() }",i){const e=i.match(/{(.*)}/);e&&void 0!==e[1]&&([,i]=e)}break;case"number":c=c||"14";break;case"boolean":c=c||"true";break;default:c=c||""}c=c.replace(/"/g,"'"),t.push({name:s,type:r,defaultValue:i,example:c,required:p,deprecated:l})}return t.sort((e,t)=>{const n=!!e.required,a=!!t.required;return n===a?e.name>t.name:n!==a&&n&&!a?-1:1}),t},getKebabCaseFromCamelCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},getPropertyType(e){const t=e.toString().split(" ")[1];return t.substr(0,t.length-2).toLowerCase()},getNonDeprecatedProperties(e){const t=Object.values(e);let n=[];return t.length?(n=t.filter(e=>!e.deprecated),n):[]},getRequiredNonDeprecatedProperties(e){const t=Object.values(e);let n=[];return t.length?(n=t.filter(e=>e.required&&!e.deprecated),n):[]}},mounted(){}},l=p;n("19a8");function c(e,t,n,a,o,s,r,i){var p,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),a&&(l.functional=!0),s&&(l._scopeId="data-v-"+s),r?(p=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},l._ssrRegister=p):o&&(p=i?function(){o.call(this,this.$root.$options.shadowRoot)}:o),p)if(l.functional){l._injectStyles=p;var c=l.render;l.render=function(e,t){return p.call(t),c(e,t)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,p):[p]}return{exports:e,options:l}}var d=c(l,r,i,!1,null,"64944014",null),u=d.exports;s.a.component("vue-documenter",u);var m=u;t["default"]=m}})});
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-documenter"]=t():e["vue-documenter"]=t()})("undefined"!==typeof self?self:this,function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var s=t[a]={i:a,l:!1,exports:{}};return e[a].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(a,s,function(t){return e[t]}.bind(null,s));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"230b":function(e,t,n){},e677:function(e,t,n){"use strict";var a=n("230b"),s=n.n(a);s.a},f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(a){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(a.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fb15:function(e,t,n){"use strict";var a;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(a=window.document.currentScript)&&(a=a.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(n.p=a[1]));var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticStyle:{display:"none"}},[e._t("default")],2),n("div",{staticClass:"row"},[n("div",{staticClass:"col-sm-3"},[n("div",{staticClass:"card card-body"},[n("h2",{staticClass:"mt-0"},[e._v("Components")]),n("ul",e._l(e.loadedComponents,function(t){return n("li",{key:"table-of-contents-"+t.name},[n("a",{attrs:{href:"#{component.name}"}},[e._v(e._s(t.name))])])}),0)])]),n("div",{staticClass:"col-sm-9"},e._l(e.loadedComponents,function(t){return n("div",{key:"component-"+t.name,staticClass:"card card-body mb-5"},[n("h1",{attrs:{id:e.getKebabCaseFromCamelCase(t.name)}},[e._v("<"+e._s(e.getKebabCaseFromCamelCase(t.name))+">")]),n("h2",[e._v("Properties")]),n("div",{staticClass:"table-responsive mb-3"},[n("table",{staticClass:"table table-striped"},[e._m(0,!0),n("tbody",e._l(t.properties,function(t){return n("tr",{key:"property-"+t.name,class:{deprecated:t.deprecated}},[n("td",{staticStyle:{"white-space":"nowrap"}},[e._v("\n "+e._s("string"!==t.type?":":"")+e._s(t.name)+"\n "),t.required?n("span",{staticClass:"badge badge-danger",attrs:{title:t.required}},[e._v("Required")]):e._e(),t.deprecated?n("span",{staticClass:"badge badge-warning",attrs:{title:t.deprecated,"data-tippy":""}},[e._v("Deprecated "),n("i",{staticClass:"fas fa-question-circle"})]):e._e()]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.type))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.defaultValue))]),n("td",[n("code",[e._v(e._s(t.example))])])])}),0)])]),e._m(1,!0),n("div",{staticClass:"row mb-3"},[n("div",{staticClass:"col"},[t.events?n("div",{staticClass:"table-responsive"},[n("table",{staticClass:"table table-striped"},[e._m(2,!0),n("tbody",e._l(t.events,function(t){return n("tr",{key:"event-"+t.name},[n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.name))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.selector))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.on))]),n("td",{staticStyle:{"white-space":"nowrap"}},[e._v(e._s(t.example))])])}),0)])]):n("h3",[e._v("None")])])]),n("div",{staticClass:"row"},[n("div",{staticClass:"col-sm-6"},[n("h2",[e._v("Minimal Example")]),n("div",{staticClass:"code-highlight",domProps:{innerHTML:e._s(e.getComponentExampleHtml(t,{onlyRequired:!0}))}})]),n("div",{staticClass:"col-sm-6"},[n("h2",[e._v("Full Example")]),n("div",{staticClass:"code-highlight",domProps:{innerHTML:e._s(e.getComponentExampleHtml(t))}})])])])}),0)]),e._m(3)])},o=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("thead",[n("tr",[n("th",[e._v("Name")]),n("th",[e._v("Type")]),n("th",[e._v("Default Value")]),n("th",[e._v("Example")])])])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("h2",[e._v("Events ("),n("a",{attrs:{href:"https://vuejs.org/v2/api/#vm-emit",target:"_blank"}},[e._v("Vue Docs")]),e._v(")")])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("thead",[n("tr",[n("th",[e._v("Name")]),n("th",[e._v("Selector")]),n("th",[e._v("On")]),n("th",[e._v("Example Value")])])])},function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"alert alert-info d-flex"},[n("i",{staticClass:"fas fa-exclamation-triangle fa-2x mr-4"}),n("div",[n("h2",[e._v("If you're building a new Vue component and you want it to be auto-documented here")]),n("div",[n("p",[n("span",{staticClass:"badge badge-danger"},[e._v("Required")]),e._v(" The component must have it's properties defined with "),n("code",[e._v("type")]),e._v(" and "),n("code",[e._v("default")]),e._v(" properties, see "),n("a",{attrs:{href:"https://vuejs.org/v2/guide/components-props.html#Prop-Validation",target:"_blank"}},[e._v("Prop Validation")])]),n("p",[n("span",{staticClass:"badge badge-secondary"},[e._v("Optional")]),e._v(" The component maybe also include a top level "),n("code",[e._v("meta")]),e._v(" property with slot and event availability, ex.\n"),n("code",{staticStyle:{"white-space":"pre"}},[e._v("\nmeta: {\nslots: {\n default: {\n type: 'component',\n valid: ['ComponentNameOne', 'ComponentNameTwo'],\n ],\n named: [{\n name: 'filters',\n type: 'component',\n valid: ['OtherComponentName'],\n }],\n},\nevents: [{\n name: 'date-selected',\n selector: '.dates li',\n on: 'click',\n example: '2019-02-11',\n}],\n},\n")])]),n("p",[n("span",{staticClass:"badge badge-secondary"},[e._v("Optional")]),e._v(" The component's properties may also include an additional "),n("code",[e._v("meta")]),e._v(" property in the property definition, ex.\n"),n("code",{staticStyle:{"white-space":"pre"}},[e._v("\nmeta: {\nrequired: [true|false],\nexample: 'Example implementation code',\ndeprecated: 'Deprecation note that will appear on hover',\n},\n")])])])])])}],r={data(){return{loadedComponents:[]}},mounted(){this.loadComponents()},methods:{loadComponents(){this.log("loadComponents()");const e=this.$slots.default.filter(e=>void 0!==e.tag);if(this.log("Components found",e),!e)return[];for(let t=0;t<e.length;t+=1){const n=this.loadProperties(e[t]),a={name:e[t].componentOptions.tag,properties:[...n],events:e[t].componentInstance.$options.meta&&e[t].componentInstance.$options.meta.events?e[t].componentInstance.$options.meta.events:null,slots:e[t].componentInstance.$options.meta&&e[t].componentInstance.$options.meta.slots?e[t].componentInstance.$options.meta.slots:null};this.loadedComponents.push(a)}return!0},getComponentExampleHtml(e,t=!1){const n=this.getKebabCaseFromCamelCase(e.name),a=t?e.properties&&e.properties.filter(e=>e.required&&!e.deprecated):e.properties&&e.properties.filter(e=>!e.deprecated);let s=a.map(e=>`<span class="property">${"string"===e.type?"":":"}${e.name}</span>="<span class="value">${e.example}</span>"`).join("<br>");s&&(s=`<br>${s}<br>`);let o="";t||(e.slots&&(e.slots.named.length>0&&e.slots.named.forEach(e=>{"component"===e.type&&e.valid.forEach(t=>{const n=this.getKebabCaseFromCamelCase(t);o=`\n ${o}\n <br>\n <div class="slot">\n &lt;template v-slot:${e.name}&gt;\n <br>\n <span class="slot-contents">&lt;${n}&gt;&lt;/${n}&gt;</span>\n <br>\n &lt;/template&gt;\n </div>\n `})}),e.slots.default&&(o=`${o}\n <br>\n <div class="slot">\n &lt;<span class="tag">template</span> <span class="property">v-slot:default</span>&gt;\n `,"component"===e.slots.default.type&&e.slots.default.valid.forEach(e=>{const t=this.getKebabCaseFromCamelCase(e);o=`${o}<br><span class="slot-contents"><a href="#${t}">&lt;<span class="tag">${t}</span>&gt;&lt;/<span class="tag">${t}</span>&gt;</a></span>`}),o=`${o}\n <br>\n &lt;/<span class="tag">template</span>&gt;\n </div>\n `)),o&&(o=`${o}`));const r=`&lt;<span class="tag">${n}</span>${s}&gt;${o}&lt;/<span class="tag">${n}</span>&gt;`;return r},loadProperties(e){if(this.log("loadProperties()",e),!e)return!1;const t=[],n=Object.keys(e.componentInstance.$options.props);n.sort(),this.log("Properties found",n);for(let a=0;a<n.length;a+=1){const s=n[a],o=this.getKebabCaseFromCamelCase(s),r=this.getPropertyType(e.componentInstance.$options.props[s].type);let i=e.componentInstance.$options.props[s].default&&e.componentInstance.$options.props[s].default.toString();const l=e.componentInstance.$options.props[s].meta&&e.componentInstance.$options.props[s].meta.required,p=e.componentInstance.$options.props[s].meta&&e.componentInstance.$options.props[s].meta.deprecated;let c=e.componentInstance.$options.props[s].meta&&e.componentInstance.$options.props[s].meta.example;switch(r){case"array":if(c=c||"[4, 8, 15, 16, 23, 42]",i){const e=i.match(/{\s*return\s*(.*);?\s*}/);e&&void 0!==e[1]&&([,i]=e)}break;case"object":if(c=c||"{ key1: value1, key2: value2 }",i){const e=i.match(/(?:_default|function)\(\)\s*(.*)/);e&&void 0!==e[1]&&([,i]=e)}break;case"string":c=c||"Some text";break;case"function":if(c=c||"(value) => { return value.toUpperCase() }",i){const e=i.match(/{(.*)}/);e&&void 0!==e[1]&&([,i]=e)}break;case"number":c=c||"14";break;case"boolean":c=c||"true";break;default:c=c||""}c=c.replace(/"/g,"'"),t.push({name:o,type:r,defaultValue:i,example:c,required:l,deprecated:p})}return t.length>0&&t.sort((e,t)=>{const n=!!e.required,a=!!t.required;return n===a?e.name>t.name:n!==a&&n&&!a?-1:1}),this.log(t),t},getKebabCaseFromCamelCase(e){return e&&e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},getPropertyType(e){const t=e.toString().split(" ")[1];return t.substr(0,t.length-2).toLowerCase()}}},i=r;n("e677");function l(e,t,n,a,s,o,r,i){var l,p="function"===typeof e?e.options:e;if(t&&(p.render=t,p.staticRenderFns=n,p._compiled=!0),a&&(p.functional=!0),o&&(p._scopeId="data-v-"+o),r?(l=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},p._ssrRegister=l):s&&(l=i?function(){s.call(this,this.$root.$options.shadowRoot)}:s),l)if(p.functional){p._injectStyles=l;var c=p.render;p.render=function(e,t){return l.call(t),c(e,t)}}else{var d=p.beforeCreate;p.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:p}}var p=l(i,s,o,!1,null,"7edd7376",null),c=p.exports,d=c;t["default"]=d}})});
//# sourceMappingURL=vue-documenter.umd.min.js.map
{
"name": "vue-documenter",
"version": "0.0.3",
"version": "0.0.4",
"description": "An automatic Vue component documenter - yes - a component that documents components",

@@ -5,0 +5,0 @@ "main": "dist/vue-documenter.common.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc