feat: add useStore and useHooks composables that provide default store/hooks

This commit is contained in:
Braks
2021-10-20 22:39:54 +02:00
parent 61dc9dea33
commit b2b1fe822f
27 changed files with 174 additions and 128 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { ElementId, Position, ValidConnectionFunc } from '~/types'
import { Hooks, Store } from '~/context'
import { useHandle } from '~/composables'
import { Position, ValidConnectionFunc } from '~/types'
import { NodeIdContextKey } from '~/context'
import { useHandle, useHooks, useStore } from '~/composables'
interface HandleProps {
id?: string
@@ -18,9 +18,9 @@ const props = withDefaults(defineProps<HandleProps>(), {
connectable: true,
})
const store = inject(Store)!
const hooks = inject(Hooks)!
const nodeId = inject<ElementId>('NodeIdContext')!
const store = useStore()
const hooks = useHooks()
const nodeId = inject(NodeIdContextKey)!
const handler = useHandle()
const onMouseDownHandler = (event: MouseEvent) =>