index.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { createStore } from 'vuex'
  2. import { getters } from './getters'
  3. import { actions } from './actions'
  4. import { mutations } from './mutations'
  5. import { MutationTypes, ActionTypes } from './constants'
  6. import { Slide } from '@/types/slides'
  7. import { ToolbarState } from '@/types/toolbar'
  8. import { slides } from '@/mocks/index'
  9. import { FontName } from '@/configs/fontName'
  10. export { MutationTypes, ActionTypes }
  11. export interface State {
  12. activeElementIdList: string[];
  13. handleElementId: string;
  14. canvasPercentage: number;
  15. canvasScale: number;
  16. thumbnailsFocus: boolean;
  17. editorAreaFocus: boolean;
  18. disableHotkeys: boolean;
  19. showGridLines: boolean;
  20. creatingElementType: string;
  21. availableFonts: FontName[];
  22. toolbarState: ToolbarState;
  23. slides: Slide[];
  24. slideIndex: number;
  25. snapshotCursor: number;
  26. snapshotLength: number;
  27. ctrlKeyState: boolean;
  28. shiftKeyState: boolean;
  29. screening: boolean;
  30. }
  31. const state: State = {
  32. activeElementIdList: [],
  33. handleElementId: '',
  34. canvasPercentage: 90,
  35. canvasScale: 1,
  36. thumbnailsFocus: false,
  37. editorAreaFocus: false,
  38. disableHotkeys: false,
  39. showGridLines: false,
  40. creatingElementType: '',
  41. availableFonts: [],
  42. toolbarState: 'slideStyle',
  43. slides: slides,
  44. slideIndex: 0,
  45. snapshotCursor: -1,
  46. snapshotLength: 0,
  47. ctrlKeyState: false,
  48. shiftKeyState: false,
  49. screening: false,
  50. }
  51. export default createStore({
  52. state,
  53. getters,
  54. mutations,
  55. actions,
  56. })