Skip to content

Commit

Permalink
chore(core): update d3 type deps
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Oct 7, 2023
1 parent 9ce29f0 commit e9b50b7
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 185 deletions.
4 changes: 4 additions & 0 deletions docs/components/Repl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default defineComponent({
props: ['example', 'examplesImports', 'dependencies'],
setup(props) {
return () => {
if (typeof navigator === 'undefined') {
return null
}
return h(Suspense, h(DocsRepl, props))
}
},
Expand Down
1 change: 0 additions & 1 deletion docs/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ declare module 'vue' {
Showcase: typeof import('./../components/home/Showcase.vue')['default']
Sidebar: typeof import('./../components/examples/dnd/Sidebar.vue')['default']
SnappableConnectionLine: typeof import('./../components/examples/connection-radius/SnappableConnectionLine.vue')['default']
Team: typeof import('./../components/home/Team.vue')['default']
TeleportableNode: typeof import('./../components/examples/teleport/TeleportableNode.vue')['default']
ToolbarNode: typeof import('./../components/examples/node-toolbar/ToolbarNode.vue')['default']
TransitionEdge: typeof import('./../components/examples/transition/TransitionEdge.vue')['default']
Expand Down
4 changes: 3 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.2",
"@types/d3": "^7.4.0",
"@types/d3-drag": "^3.0.4",
"@types/d3-selection": "^3.0.7",
"@types/d3-zoom": "^3.0.5",
"@tooling/eslint-config": "workspace:*",
"@tooling/tsconfig": "workspace:*",
"@vitejs/plugin-vue": "^4.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/composables/useViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,5 @@ export function useViewport(state: State, getters: ComputedGetters) {
}

function transition(selection: D3Selection, ms = 0, onEnd: () => void) {
return selection.transition().duration(ms).on('end', onEnd)
return (selection as any).transition().duration(ms).on('end', onEnd)
}
2 changes: 1 addition & 1 deletion packages/core/src/container/Viewport/Transform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { id, viewport, d3Zoom, d3Selection, dimensions } = useVueFlow()
const viewportReady = ref(!isClient)
until(() => d3Zoom.value && d3Selection.value && dimensions.value.width > 0 && dimensions.value.height > 0)
until(() => !!(d3Zoom.value && d3Selection.value && dimensions.value.width > 0 && dimensions.value.height > 0))
.toBe(true)
.then(() => {
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ export function useActions(

if (!state.d3Zoom) {
until(() => state.d3Zoom)
.not.toBeUndefined()
.not.toBeNull()
.then(setSkippedOptions)
} else {
setSkippedOptions()
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/types/zoom.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Selection, ZoomBehavior } from 'd3'
import type { Selection } from 'd3-selection'
import type { ZoomBehavior } from 'd3-zoom'
import type { Rect, XYPosition } from './flow'

export type D3Zoom = ZoomBehavior<HTMLDivElement, unknown>
export type D3Selection = Selection<HTMLDivElement, unknown, any, any>
export type D3Selection = Selection<HTMLDivElement, any, any, any>
export type D3ZoomHandler = (this: HTMLDivElement, event: any, d: unknown) => void

export enum PanOnScrollMode {
Expand Down
4 changes: 2 additions & 2 deletions packages/minimap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
"@tooling/eslint-config": "workspace:*",
"@tooling/tsconfig": "workspace:*",
"@tooling/vite-config": "workspace:*",
"@types/d3-selection": "^3.0.3",
"@types/d3-zoom": "^3.0.1",
"@types/d3-selection": "^3.0.7",
"@types/d3-zoom": "^3.0.5",
"@vue-flow/core": "workspace:*",
"vue": "^3.2.25",
"vue-tsc": "^1.6.5"
Expand Down
4 changes: 2 additions & 2 deletions packages/node-resizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"@tooling/eslint-config": "workspace:*",
"@tooling/tsconfig": "workspace:*",
"@tooling/vite-config": "workspace:*",
"@types/d3-drag": "^3.0.2",
"@types/d3-selection": "^3.0.4",
"@types/d3-drag": "^3.0.4",
"@types/d3-selection": "^3.0.7",
"@vue-flow/core": "workspace:*",
"vite-plugin-vue-type-imports": "^0.2.4",
"vue": "^3.2.25",
Expand Down
198 changes: 24 additions & 174 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9b50b7

Please sign in to comment.