Skip to content

Commit

Permalink
fix(toolbar): should be built as a single plugin #114
Browse files Browse the repository at this point in the history
also refactor: cleanup plugin exports

closes #114
  • Loading branch information
stasson committed Nov 18, 2017
1 parent 575f526 commit b68b75d
Show file tree
Hide file tree
Showing 31 changed files with 238 additions and 242 deletions.
9 changes: 4 additions & 5 deletions components/button/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import plugin from '../plugin.js'
import VueMDCButton from './mdc-button.vue'

export {VueMDCButton}

export default {
install (vm) {
vm.component('mdc-button', VueMDCButton)
}
}
export default plugin ({
VueMDCButton
})
49 changes: 25 additions & 24 deletions components/card/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import plugin from '../plugin.js'
import VueMDCCard from './mdc-card.vue'
import VueMDCCardMedia from './mdc-card-media.vue'
import VueMDCCardHeader from './mdc-card-header.vue'
Expand All @@ -9,28 +10,28 @@ import VueMDCCardImg from './mdc-card-img.vue'
import VueMDCCardActions from './mdc-card-actions.vue'
import VueMDCCardActionButton from './mdc-card-action-button.vue'

export {VueMDCCard}
export {VueMDCCardMedia}
export {VueMDCCardHeader}
export {VueMDCCardTitle}
export {VueMDCCardSubtitle}
export {VueMDCCardText}
export {VueMDCCardHorizontal}
export {VueMDCCardImg}
export {VueMDCCardActions}
export {VueMDCCardActionButton}

export default {
install (vm) {
vm.component('mdc-card', VueMDCCard)
vm.component('mdc-card-media', VueMDCCardMedia)
vm.component('mdc-card-header', VueMDCCardHeader)
vm.component('mdc-card-title', VueMDCCardTitle)
vm.component('mdc-card-subtitle', VueMDCCardSubtitle)
vm.component('mdc-card-text', VueMDCCardText)
vm.component('mdc-card-horizontal', VueMDCCardHorizontal)
vm.component('mdc-card-img', VueMDCCardImg)
vm.component('mdc-card-actions', VueMDCCardActions)
vm.component('mdc-card-action-button', VueMDCCardActionButton)
}
export {
VueMDCCard,
VueMDCCardMedia,
VueMDCCardHeader,
VueMDCCardTitle,
VueMDCCardSubtitle,
VueMDCCardText,
VueMDCCardHorizontal,
VueMDCCardImg,
VueMDCCardActions,
VueMDCCardActionButton
}

export default plugin ({
VueMDCCard,
VueMDCCardMedia,
VueMDCCardHeader,
VueMDCCardTitle,
VueMDCCardSubtitle,
VueMDCCardText,
VueMDCCardHorizontal,
VueMDCCardImg,
VueMDCCardActions,
VueMDCCardActionButton
})
2 changes: 1 addition & 1 deletion components/card/mdc-card-text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

<script>
export default {
name: 'mdc-text'
name: 'mdc-card-text'
}
</script>
13 changes: 7 additions & 6 deletions components/checkbox/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCCheckbox from './mdc-checkbox.vue'

export {VueMDCCheckbox}

export default {
install (vm) {
vm.component('mdc-checkbox', VueMDCCheckbox)
}
export {
VueMDCCheckbox
}

export default plugin ({
VueMDCCheckbox
})
13 changes: 7 additions & 6 deletions components/dialog/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCDialog from './mdc-dialog.vue'

export {VueMDCDialog}

export default {
install (vm) {
vm.component('mdc-dialog', VueMDCDialog)
}
export {
VueMDCDialog
}

export default plugin ({
VueMDCDialog
})
19 changes: 9 additions & 10 deletions components/drawer/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import plugin from '../plugin.js'
import VueMDCDrawer from './mdc-drawer.vue'
import VueMDCDrawerLayout from './mdc-drawer-layout.vue'
import VueMDCDrawerHeader from './mdc-drawer-header.vue'
Expand All @@ -14,13 +15,11 @@ export {
VueMDCDrawerDivider
}

export default {
install (vm) {
vm.component('mdc-drawer', VueMDCDrawer)
vm.component('mdc-drawer-layout', VueMDCDrawerLayout)
vm.component('mdc-drawer-header', VueMDCDrawerHeader)
vm.component('mdc-drawer-list', VueMDCDrawerList)
vm.component('mdc-drawer-item', VueMDCDrawerItem)
vm.component('mdc-drawer-divider', VueMDCDrawerDivider)
}
}
export default plugin ({
VueMDCDrawer,
VueMDCDrawerLayout,
VueMDCDrawerHeader,
VueMDCDrawerList,
VueMDCDrawerItem,
VueMDCDrawerDivider
})
13 changes: 7 additions & 6 deletions components/fab/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCFAB from './mdc-fab.vue'

export {VueMDCFAB}

export default {
install (vm) {
vm.component('mdc-fab', VueMDCFAB)
}
export {
VueMDCFAB
}

export default plugin ({
VueMDCFAB
})
16 changes: 9 additions & 7 deletions components/grid-list/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import plugin from '../plugin.js'
import VueMDCGridList from './mdc-grid-list.vue'
import VueMDCGridTile from './mdc-grid-tile.vue'

export {VueMDCGridList, VueMDCGridTile}

export default {
install (vm) {
vm.component('mdc-grid-list', VueMDCGridList)
vm.component('mdc-grid-tile', VueMDCGridTile)
}
export {
VueMDCGridList,
VueMDCGridTile
}

export default plugin ({
VueMDCGridList,
VueMDCGridTile
})
13 changes: 7 additions & 6 deletions components/icon-toggle/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCIConToggle from './mdc-icon-toggle.vue'

export {VueMDCIConToggle}

export default {
install (vm) {
vm.component('mdc-icon-toggle', VueMDCIConToggle)
}
export {
VueMDCIConToggle
}

export default plugin ({
VueMDCIConToggle
})
13 changes: 7 additions & 6 deletions components/icon/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCICon from './mdc-icon.vue'

export {VueMDCICon}

export default {
install (vm) {
vm.component('mdc-icon', VueMDCICon)
}
export {
VueMDCICon
}

export default plugin({
VueMDCICon
})
13 changes: 7 additions & 6 deletions components/layout-app/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCLayoutApp from './mdc-layout-app.vue'

export {VueMDCLayoutApp}

export default {
install (vm) {
vm.component('mdc-layout-app', VueMDCLayoutApp)
}
export {
VueMDCLayoutApp
}

export default plugin({
VueMDCLayoutApp
})
21 changes: 11 additions & 10 deletions components/layout-grid/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import plugin from '../plugin.js'
import VueMDCLayoutGrid from './mdc-layout-grid.vue'
import VueMDCLayoutCell from './mdc-layout-cell.vue'
import VueMDCLayoutInnerGrid from './mdc-layout-inner-grid.vue'

export {VueMDCLayoutGrid}
export {VueMDCLayoutCell}
export {VueMDCLayoutInnerGrid}

export default {
install (vm) {
vm.component('mdc-layout-grid', VueMDCLayoutGrid)
vm.component('mdc-layout-cell', VueMDCLayoutCell)
vm.component('mdc-layout-inner-grid', VueMDCLayoutInnerGrid)
}
export {
VueMDCLayoutGrid,
VueMDCLayoutCell,
VueMDCLayoutInnerGrid
}

export default plugin ({
VueMDCLayoutGrid,
VueMDCLayoutCell,
VueMDCLayoutInnerGrid
})
9 changes: 4 additions & 5 deletions components/linear-progress/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import plugin from '../plugin.js'
import VueMDCLinearProgress from './mdc-linear-progress.vue'

export {
VueMDCLinearProgress
}

export default {
install (vm) {
vm.component('mdc-linear-progress', VueMDCLinearProgress)
}
}
export default plugin ({
VueMDCLinearProgress
})
19 changes: 9 additions & 10 deletions components/list/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import plugin from '../plugin.js'
import VueMDCList from './mdc-list.vue'
import VueMDCListItem from './mdc-list-item.vue'
import VueMDCListDivider from './mdc-list-divider.vue'
Expand All @@ -14,13 +15,11 @@ export {
VueMDCListGroupDivider
}

export default {
install (vm) {
vm.component('mdc-list', VueMDCList)
vm.component('mdc-list-item', VueMDCListItem)
vm.component('mdc-list-divider', VueMDCListDivider)
vm.component('mdc-list-group', VueMDCListGroup)
vm.component('mdc-list-group-header', VueMDCListGroupHeader)
vm.component('mdc-list-group-divider', VueMDCListGroupDivider)
}
}
export default plugin ({
VueMDCList,
VueMDCListItem,
VueMDCListDivider,
VueMDCListGroup,
VueMDCListGroupHeader,
VueMDCListGroupDivider
})
15 changes: 7 additions & 8 deletions components/menu/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import plugin from '../plugin.js'
import VueMDCMenu from './mdc-menu.vue'
import VueMDCMenuItem from './mdc-menu-item.vue'
import VueMDCMenuDivider from './mdc-menu-divider.vue'
Expand All @@ -10,11 +11,9 @@ export {
VueMDCMenuAnchor
}

export default {
install (vm) {
vm.component('mdc-menu', VueMDCMenu)
vm.component('mdc-menu-item', VueMDCMenuItem)
vm.component('mdc-menu-divider', VueMDCMenuDivider)
vm.component('mdc-menu-anchor', VueMDCMenuAnchor)
}
}
export default plugin ({
VueMDCMenu,
VueMDCMenuItem,
VueMDCMenuDivider,
VueMDCMenuAnchor
})
12 changes: 12 additions & 0 deletions components/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function (components) {
return {
install: (vm) => {
for (let key in components) {
let component = components[key]
let name = component.name
vm.component(name, component)
}
},
components
}
}
13 changes: 7 additions & 6 deletions components/radio/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../plugin.js'
import VueMDCRadio from './mdc-radio.vue'

export {VueMDCRadio}

export default {
install (vm) {
vm.component('mdc-radio', VueMDCRadio)
}
export {
VueMDCRadio
}

export default plugin ({
VueMDCRadio
})
33 changes: 6 additions & 27 deletions components/select/index.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
import plugin from '../plugin.js'
import VueMDCSelect from './mdc-select.vue'
import VueMDCOption from './mdc-option.vue'
import VueMDCMenuSelect from './mdc-menu-select.vue'
import VueMDCMenuOption from './mdc-menu-option.vue'
import VueMDCMultiSelect from './mdc-multi-select.vue'
import VueMDCMultiOption from './mdc-multi-option.vue'
import VueMDCNativeSelect from './mdc-native-select.vue'
import VueMDCNativeOption from './mdc-native-option.vue'
import VueMDCMenuPlugin from '../menu'


export {
VueMDCSelect,
VueMDCOption,
VueMDCMenuSelect,
VueMDCMenuOption,
VueMDCMultiSelect,
VueMDCMultiOption,
VueMDCNativeSelect,
VueMDCNativeOption,
VueMDCMenuPlugin
}

export default {
install (vm) {
vm.use(VueMDCMenuPlugin)
vm.component('mdc-select', VueMDCSelect)
vm.component('mdc-option', VueMDCOption)
vm.component('mdc-menu-select', VueMDCMenuSelect)
vm.component('mdc-menu-option', VueMDCMenuOption)
vm.component('mdc-native-select', VueMDCNativeSelect)
vm.component('mdc-native-option', VueMDCNativeOption)
vm.component('mdc-multi-select', VueMDCMultiSelect)
vm.component('mdc-multi-option', VueMDCMultiOption)
}
}
export default plugin ({
VueMDCSelect,
VueMDCOption,
})
Loading

0 comments on commit b68b75d

Please sign in to comment.