import Button from './components/Button/Button.vue';
import FileSelect from './components/FileSelect/FileSelect.vue';
import Icon from './components/Icon/Icon.vue';
import Input from './components/Input/Input.vue';
import Range from './components/Range/Range.vue';
import Scroller from './components/Scroller/Scroller.vue';
import Table from './components/Table/Table.vue';
import ToggleGroup from './components/ToggleGroup/ToggleGroup.vue';
import Window from './components/Window/Window.vue';

import Draggable from './directives/Draggable.js';
import Resizable from './directives/Resizable.js';
import Dropbox from './directives/Dropbox.js';

export const directives = {
  Draggable,
  Resizable,
  Dropbox
};

export const components = {
  Button,
  FileSelect,
  Icon,
  Input,
  Range,
  Scroller,
  Table,
  ToggleGroup,
  Window
};

import PlmButton from './components/Button/Button.vue';
import PlmFileSelect from './components/FileSelect/FileSelect.vue';
import PlmIcon from './components/Icon/Icon.vue';
import PlmInput from './components/Input/Input.vue';
import PlmRange from './components/Range/Range.vue';
import PlmScroller from './components/Scroller/Scroller.vue';
import PlmTable from './components/Table/Table.vue';
import PlmToggleGroup from './components/ToggleGroup/ToggleGroup.vue';
import PlmWindow from './components/Window/Window.vue';

import PlmDraggable from './directives/Draggable.js';
import PlmResizable from './directives/Resizable.js';
import PlmDropbox from './directives/Dropbox.js';

export const components = {
  PlmButton,
  PlmFileSelect,
  PlmIcon,
  PlmInput,
  PlmRange,
  PlmScroller,
  PlmTable,
  PlmToggleGroup,
  PlmWindow
};

export const directives = {
  PlmDraggable,
  PlmResizable,
  PlmDropbox
};

export default {
  install (Vue) {
    Object.keys(components).forEach((name) => {
      Vue.component(name, components[name]);
    });
    Object.keys(directives).forEach((name) => {
      Vue.directive(name, directives[name]);
    });
  }
};

export {
  // directives
  PlmDraggable,
  PlmResizable,
  PlmDropbox,
  // components
  PlmButton,
  PlmFileSelect,
  PlmIcon,
  PlmInput,
  PlmRange,
  PlmScroller,
  PlmTable,
  PlmToggleGroup,
  PlmWindow
};

Change exports, add vue plugin installation support