update(types): Rename FlowStore to Store and ReactiveFlowStore to FlowStore

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-04 15:42:18 +01:00
parent 70b44dbc03
commit 3c9840cc50
9 changed files with 22 additions and 23 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import useStore from './useStore'
import { getHostForElement } from '~/utils'
import { Connection, ConnectionMode, ElementId, HandleType, ReactiveFlowStore, ValidConnectionFunc } from '~/types'
import { Connection, ConnectionMode, ElementId, HandleType, FlowStore, ValidConnectionFunc } from '~/types'
type Result = {
elementBelow: Element | null
@@ -67,7 +67,7 @@ const resetRecentHandle = (hoveredHandle: Element): void => {
hoveredHandle?.classList.remove('vue-flow__handle-connecting')
}
export default (store: ReactiveFlowStore = useStore()) =>
export default (store: FlowStore = useStore()) =>
(
event: MouseEvent,
handleId: ElementId,
+2 -2
View File
@@ -1,4 +1,4 @@
import { EmitFunc, FlowHooks, FlowEvents, FlowStore, ReactiveFlowStore } from '~/types'
import { EmitFunc, FlowHooks, FlowEvents, FlowStore } from '~/types'
// flow event hooks
export const createHooks = (): FlowHooks => ({
@@ -49,4 +49,4 @@ const bind = (emit: EmitFunc, hooks: FlowHooks) => {
}
}
export default (store: ReactiveFlowStore, emit: EmitFunc) => bind(emit, store.hooks)
export default (store: FlowStore, emit: EmitFunc) => bind(emit, store.hooks)
+5 -5
View File
@@ -1,6 +1,6 @@
import { FlowExportObject, FlowOptions, FlowState, ReactiveFlowStore } from '~/types'
import { FlowExportObject, FlowOptions, FlowState, FlowStore } from '~/types'
import { useNewStore } from '~/store'
import { Store } from '~/context'
import { StoreSymbol } from '~/context'
import { onLoadToObject, initialState } from '~/utils'
let id = 0
@@ -35,12 +35,12 @@ export const createStore = (options?: FlowOptions) => {
return store
}
export default (options?: FlowOptions): ReactiveFlowStore => {
let store = options?.id ? createStore(options) : inject(Store, undefined)
export default (options?: FlowOptions): FlowStore => {
let store = options?.id ? createStore(options) : inject(StoreSymbol, undefined)
if (!store) {
store = createStore(options)
}
provide(Store, store)
provide(StoreSymbol, store)
return reactive(store)
}
+2 -2
View File
@@ -1,9 +1,9 @@
import useStore from './useStore'
import useHooks from './useHooks'
import { EmitFunc, ReactiveFlowStore } from '~/types'
import { EmitFunc, FlowStore } from '~/types'
let key = 0
export const initFlow = (emit: EmitFunc, id = `vue-flow-${key++}`): ReactiveFlowStore => {
export const initFlow = (emit: EmitFunc, id = `vue-flow-${key++}`): FlowStore => {
const store = useStore({ id })
useHooks(store, emit)
return store
+2 -2
View File
@@ -1,11 +1,11 @@
import { zoomIdentity } from 'd3-zoom'
import useStore from './useStore'
import { getRectOfNodes, pointToRendererPoint, getTransformForBounds, isGraphNode } from '~/utils'
import { FitViewParams, FlowTransform, GraphNode, ReactiveFlowStore, Rect, UseZoomPanHelper, XYPosition } from '~/types'
import { FitViewParams, FlowTransform, GraphNode, FlowStore, Rect, UseZoomPanHelper, XYPosition } from '~/types'
const DEFAULT_PADDING = 0.1
export default (store: ReactiveFlowStore = useStore()): UseZoomPanHelper => {
export default (store: FlowStore = useStore()): UseZoomPanHelper => {
return {
zoomIn: () => store.d3Selection && store.d3Zoom?.scaleBy(store.d3Selection, 1.2),
zoomOut: () => store.d3Selection && store.d3Zoom?.scaleBy(store.d3Selection, 1 / 1.2),