Permalink
Browse files

perf: move repetitive plugin code to plugin.js (#1285)

* [plugins.js] Move repetitive Plugin code to plugin.js

* Update index.js

* Update index.js

* Update index.js

* Update plugins.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* docs: Use shorter plugin import path

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update index.js

* Update meta.json

* Update README.md
  • Loading branch information...
tmorehouse committed Nov 5, 2017
1 parent e1e701b commit 6ba8c46da4b8abca145970bc506718c8a73b14b8
Showing with 181 additions and 309 deletions.
  1. +2 −2 docs/components/importdoc.vue
  2. +5 −4 docs/markdown/intro/README.md
  3. +1 −1 docs/markdown/intro/meta.json
  4. +3 −7 src/components/alert/index.js
  5. +3 −7 src/components/badge/index.js
  6. +3 −7 src/components/breadcrumb/index.js
  7. +3 −7 src/components/button-group/index.js
  8. +3 −7 src/components/button-toolbar/index.js
  9. +3 −7 src/components/button/index.js
  10. +3 −7 src/components/card/index.js
  11. +3 −7 src/components/carousel/index.js
  12. +3 −7 src/components/collapse/index.js
  13. +3 −7 src/components/dropdown/index.js
  14. +3 −7 src/components/embed/index.js
  15. +3 −7 src/components/form-checkbox/index.js
  16. +3 −7 src/components/form-file/index.js
  17. +3 −7 src/components/form-group/index.js
  18. +3 −7 src/components/form-input/index.js
  19. +3 −7 src/components/form-radio/index.js
  20. +3 −7 src/components/form-select/index.js
  21. +3 −7 src/components/form-textarea/index.js
  22. +3 −7 src/components/form/index.js
  23. +3 −7 src/components/image/index.js
  24. +3 −7 src/components/input-group/index.js
  25. +3 −7 src/components/jumbotron/index.js
  26. +3 −7 src/components/layout/index.js
  27. +3 −7 src/components/link/index.js
  28. +3 −7 src/components/list-group/index.js
  29. +3 −7 src/components/media/index.js
  30. +3 −7 src/components/modal/index.js
  31. +3 −7 src/components/nav/index.js
  32. +3 −7 src/components/navbar/index.js
  33. +3 −7 src/components/pagination-nav/index.js
  34. +3 −7 src/components/pagination/index.js
  35. +3 −7 src/components/popover/index.js
  36. +3 −7 src/components/progress/index.js
  37. +3 −7 src/components/table/index.js
  38. +3 −7 src/components/tabs/index.js
  39. +3 −7 src/components/tooltip/index.js
  40. +3 −7 src/directives/modal/index.js
  41. +3 −7 src/directives/popover/index.js
  42. +3 −7 src/directives/scrollspy/index.js
  43. +3 −7 src/directives/toggle/index.js
  44. +3 −7 src/directives/tooltip/index.js
  45. +8 −9 src/index.js
  46. +4 −1 src/utils/index.js
  47. +38 −5 src/utils/plugins.js
@@ -37,10 +37,10 @@
</p>
<p class="mb-0">
<code v-if="$route.name === 'docs-components-slug'">
import {{pluginName}} from 'bootstrap-vue/es/components/{{$route.params.slug}};
import { {{pluginName}} } from 'bootstrap-vue/es/components;
</code>
<code v-else>
import {{pluginName}} from 'bootstrap-vue/es/directives/{{$route.params.slug}};
import { {{pluginName}} } from 'bootstrap-vue/es/directives;
</code>
</p>
<p>
@@ -110,29 +110,30 @@ Vue.directive('b-modal', bModalDirective);
Vue and ES2015 allow for various syntaxes here, so feel free to utilize kebab-casing (shown),
camel-casing, pascal-casing, and/or object property shorthand.
### Components and Directives as Vue plugins
### Component groups and Directives as Vue plugins
You can also import component groups and directives as Vue plugins by importing
the component group or directive directory:
```js
// This imports <b-modal> as well as the v-b-modal directive as a plugin:
import Modal from 'bootstrap-vue/es/components/modal';
import { Modal } from 'bootstrap-vue/es/components';
Vue.use(Modal);
// This imports <b-card> along with all the <b-card-*> sub-components as a plugin:
import Card from 'bootstrap-vue/es/components/card';
import { Card } from 'bootstrap-vue/es/components';
Vue.use(Card);
// This imports directive v-b-scrollspy as a plugin:
import Scrollspy from 'bootstrap-vue/es/directives/scrollspy';
import { Scrollspy } from 'bootstrap-vue/es/directives';
Vue.use(Scrollspy);
```
When importing as plugins, all subcomponents and related directives are imported in most cases.
i.e. When importing `<b-nav>`, all the `<nav-*>` sub components are also included, as well all
dropdown sub components.
Reffer to the component and directive documentation for details.
### Webpack + Babel
@@ -1,3 +1,3 @@
{
"name": "intro"
"name": "Intro"
}
@@ -1,5 +1,5 @@
import bAlert from './alert';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -9,14 +9,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,5 +1,5 @@
import bBadge from './badge';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -9,14 +9,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,7 +1,7 @@
import bBreadcrumb from './breadcrumb';
import bBreadcrumbItem from './breadcrumb-item';
import bBreadcrumbLink from './breadcrumb-link';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -13,14 +13,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,5 +1,5 @@
import bButtonGroup from './button-group';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -10,14 +10,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,5 +1,5 @@
import bButtonToolbar from './button-toolbar';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -10,14 +10,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,7 +1,7 @@
import bButton from './button';
import bButtonClose from './button-close';
import bLink from './link';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -15,14 +15,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -4,7 +4,7 @@ import bCardBody from './card-body';
import bCardFooter from './card-footer';
import bCardImg from './card-img';
import bCardGroup from './card-group';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -19,14 +19,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin
@@ -1,6 +1,6 @@
import bCarousel from './carousel';
import bCarouselSlide from './carousel-slide';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -11,14 +11,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,6 +1,6 @@
import bCollapse from './collapse';
import togglePlugin from '../../directives/toggle';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -10,15 +10,11 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
Vue.use(togglePlugin);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -3,7 +3,7 @@ import bDropdownItem from './dropdown-item';
import bDropdownItemButton from './dropdown-item-button';
import bDropdownHeader from './dropdown-header';
import bDropdownDivider from './dropdown-divider';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -24,14 +24,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,5 +1,5 @@
import bEmbed from './embed';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -9,14 +9,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,6 +1,6 @@
import bFormCheckbox from './form-checkbox';
import bFormCheckboxGroup from './form-checkbox-group';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -15,14 +15,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
@@ -1,5 +1,5 @@
import bFormFile from './form-file';
import { registerComponent } from '../../utils';
import { registerComponents, vueUse } from '../../utils';
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
@@ -10,14 +10,10 @@ const components = {
const VuePlugin = {
install(Vue) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
registerComponents(Vue, components);
}
};
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
};
vueUse(VuePlugin);
export default VuePlugin;
Oops, something went wrong.

0 comments on commit 6ba8c46

Please sign in to comment.