config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import deepmerge from 'deepmerge'
  2. import { buildConfig } from '@/functions'
  3. const getMixinConfig = () => import('@/mixins/ExperimentBase/config')
  4. const getGlobalConfig = () => import('@/../experimentConfig/mixins/ExperimentBaseExtracts')
  5. // This will apply to all the scenes
  6. export const defaultConfig = async () => {
  7. // Import parent mixin config
  8. const mixinConfig = await getMixinConfig().then(({ defaultConfig: fn }) => fn())
  9. // Import global config
  10. const globalConfig = (await getGlobalConfig()).defaultConfig
  11. return deepmerge.all([
  12. mixinConfig,
  13. {
  14. showHoverBorder: false,
  15. extractConfig: {
  16. x: 4,
  17. y: 4
  18. }
  19. },
  20. globalConfig
  21. ])
  22. }
  23. // This will overwrite the config for the given scene
  24. export const scenesConfig = async () => {
  25. // Import parent mixin config
  26. const mixinConfig = await getMixinConfig().then(({ scenesConfig: fn }) => fn())
  27. // Import global config
  28. const globalConfig = (await getGlobalConfig()).scenesConfig
  29. return deepmerge.all([
  30. mixinConfig,
  31. {},
  32. globalConfig
  33. ])
  34. }
  35. export default async () => buildConfig(await defaultConfig(), await scenesConfig())