From e9b50b7998e9357abf268c55ef5754ef1f36fa2d Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 7 Oct 2023 11:15:43 +0200 Subject: [PATCH] chore(core): update d3 type deps --- docs/components/Repl.vue | 4 + docs/src/components.d.ts | 1 - packages/core/package.json | 4 +- packages/core/src/composables/useViewport.ts | 2 +- .../core/src/container/Viewport/Transform.vue | 2 +- packages/core/src/store/actions.ts | 2 +- packages/core/src/types/zoom.ts | 5 +- packages/minimap/package.json | 4 +- packages/node-resizer/package.json | 4 +- pnpm-lock.yaml | 198 +++--------------- 10 files changed, 41 insertions(+), 185 deletions(-) diff --git a/docs/components/Repl.vue b/docs/components/Repl.vue index 29b50ff49..35c35889c 100644 --- a/docs/components/Repl.vue +++ b/docs/components/Repl.vue @@ -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)) } }, diff --git a/docs/src/components.d.ts b/docs/src/components.d.ts index 696cce638..8e90aaf85 100644 --- a/docs/src/components.d.ts +++ b/docs/src/components.d.ts @@ -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'] diff --git a/packages/core/package.json b/packages/core/package.json index 30371b047..060c7b10c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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", diff --git a/packages/core/src/composables/useViewport.ts b/packages/core/src/composables/useViewport.ts index 8a3cbf253..f027aaf42 100644 --- a/packages/core/src/composables/useViewport.ts +++ b/packages/core/src/composables/useViewport.ts @@ -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) } diff --git a/packages/core/src/container/Viewport/Transform.vue b/packages/core/src/container/Viewport/Transform.vue index ea7d9746d..ae99ef893 100644 --- a/packages/core/src/container/Viewport/Transform.vue +++ b/packages/core/src/container/Viewport/Transform.vue @@ -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(() => { diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index a4acc7c8a..56a79395a 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -807,7 +807,7 @@ export function useActions( if (!state.d3Zoom) { until(() => state.d3Zoom) - .not.toBeUndefined() + .not.toBeNull() .then(setSkippedOptions) } else { setSkippedOptions() diff --git a/packages/core/src/types/zoom.ts b/packages/core/src/types/zoom.ts index a72a52040..198baa1e8 100644 --- a/packages/core/src/types/zoom.ts +++ b/packages/core/src/types/zoom.ts @@ -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 -export type D3Selection = Selection +export type D3Selection = Selection export type D3ZoomHandler = (this: HTMLDivElement, event: any, d: unknown) => void export enum PanOnScrollMode { diff --git a/packages/minimap/package.json b/packages/minimap/package.json index 901360384..8a17c775d 100644 --- a/packages/minimap/package.json +++ b/packages/minimap/package.json @@ -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" diff --git a/packages/node-resizer/package.json b/packages/node-resizer/package.json index 65e6196d8..f65a26faa 100644 --- a/packages/node-resizer/package.json +++ b/packages/node-resizer/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b68ca2f5..839277950 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -310,9 +310,15 @@ importers: '@tooling/tsconfig': specifier: workspace:* version: link:../../tooling/tsconfig - '@types/d3': - specifier: ^7.4.0 - version: 7.4.0 + '@types/d3-drag': + specifier: ^3.0.4 + version: 3.0.4 + '@types/d3-selection': + specifier: ^3.0.7 + version: 3.0.7 + '@types/d3-zoom': + specifier: ^3.0.5 + version: 3.0.5 '@vitejs/plugin-vue': specifier: ^4.2.3 version: 4.2.3(vite@4.3.7)(vue@3.2.47) @@ -366,11 +372,11 @@ importers: specifier: workspace:* version: link:../../tooling/vite-config '@types/d3-selection': - specifier: ^3.0.3 - version: 3.0.4 + specifier: ^3.0.7 + version: 3.0.7 '@types/d3-zoom': - specifier: ^3.0.1 - version: 3.0.2 + specifier: ^3.0.5 + version: 3.0.5 '@vue-flow/core': specifier: workspace:* version: link:../core @@ -400,11 +406,11 @@ importers: specifier: workspace:* version: link:../../tooling/vite-config '@types/d3-drag': - specifier: ^3.0.2 - version: 3.0.2 - '@types/d3-selection': specifier: ^3.0.4 version: 3.0.4 + '@types/d3-selection': + specifier: ^3.0.7 + version: 3.0.7 '@vue-flow/core': specifier: workspace:* version: link:../core @@ -2722,81 +2728,14 @@ packages: resolution: {integrity: sha512-rkiiTuf/z2wTd4RxFOb+clE7PF4AEJU0hsczbUdkHHBtkUmpWQpEddynNfJYKYtZFJKbq4F+brfekt1kx85IZA==} dev: true - /@types/d3-array@3.0.4: - resolution: {integrity: sha512-nwvEkG9vYOc0Ic7G7kwgviY4AQlTfYGIZ0fqB7CQHXGyYM6nO7kJh5EguSNA3jfh4rq7Sb7eMVq8isuvg2/miQ==} - dev: true - - /@types/d3-axis@3.0.2: - resolution: {integrity: sha512-uGC7DBh0TZrU/LY43Fd8Qr+2ja1FKmH07q2FoZFHo1eYl8aj87GhfVoY1saJVJiq24rp1+wpI6BvQJMKgQm8oA==} - dependencies: - '@types/d3-selection': 3.0.4 - dev: true - - /@types/d3-brush@3.0.2: - resolution: {integrity: sha512-2TEm8KzUG3N7z0TrSKPmbxByBx54M+S9lHoP2J55QuLU0VSQ9mE96EJSAOVNEqd1bbynMjeTS9VHmz8/bSw8rA==} - dependencies: - '@types/d3-selection': 3.0.4 - dev: true - - /@types/d3-chord@3.0.2: - resolution: {integrity: sha512-abT/iLHD3sGZwqMTX1TYCMEulr+wBd0SzyOQnjYNLp7sngdOHYtNkMRI5v3w5thoN+BWtlHVDx2Osvq6fxhZWw==} - dev: true - /@types/d3-color@3.1.0: resolution: {integrity: sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==} dev: true - /@types/d3-contour@3.0.2: - resolution: {integrity: sha512-k6/bGDoAGJZnZWaKzeB+9glgXCYGvh6YlluxzBREiVo8f/X2vpTEdgPy9DN7Z2i42PZOZ4JDhVdlTSTSkLDPlQ==} + /@types/d3-drag@3.0.4: + resolution: {integrity: sha512-/t53K1erTuUbP7WIX9SE0hlmytpTYRbIthlhbGkBHzCV5vPO++7yrk8OlisWPyIJO5TGowTmqCtGH2tokY5T/g==} dependencies: - '@types/d3-array': 3.0.4 - '@types/geojson': 7946.0.10 - dev: true - - /@types/d3-delaunay@6.0.1: - resolution: {integrity: sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==} - dev: true - - /@types/d3-dispatch@3.0.2: - resolution: {integrity: sha512-rxN6sHUXEZYCKV05MEh4z4WpPSqIw+aP7n9ZN6WYAAvZoEAghEK1WeVZMZcHRBwyaKflU43PCUAJNjFxCzPDjg==} - dev: true - - /@types/d3-drag@3.0.2: - resolution: {integrity: sha512-qmODKEDvyKWVHcWWCOVcuVcOwikLVsyc4q4EBJMREsoQnR2Qoc2cZQUyFUPgO9q4S3qdSqJKBsuefv+h0Qy+tw==} - dependencies: - '@types/d3-selection': 3.0.4 - dev: true - - /@types/d3-dsv@3.0.1: - resolution: {integrity: sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==} - dev: true - - /@types/d3-ease@3.0.0: - resolution: {integrity: sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==} - dev: true - - /@types/d3-fetch@3.0.2: - resolution: {integrity: sha512-gllwYWozWfbep16N9fByNBDTkJW/SyhH6SGRlXloR7WdtAaBui4plTP+gbUgiEot7vGw/ZZop1yDZlgXXSuzjA==} - dependencies: - '@types/d3-dsv': 3.0.1 - dev: true - - /@types/d3-force@3.0.4: - resolution: {integrity: sha512-q7xbVLrWcXvSBBEoadowIUJ7sRpS1yvgMWnzHJggFy5cUZBq2HZL5k/pBSm0GdYWS1vs5/EDwMjSKF55PDY4Aw==} - dev: true - - /@types/d3-format@3.0.1: - resolution: {integrity: sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==} - dev: true - - /@types/d3-geo@3.0.3: - resolution: {integrity: sha512-bK9uZJS3vuDCNeeXQ4z3u0E7OeJZXjUgzFdSOtNtMCJCLvDtWDwfpRVWlyt3y8EvRzI0ccOu9xlMVirawolSCw==} - dependencies: - '@types/geojson': 7946.0.10 - dev: true - - /@types/d3-hierarchy@3.1.2: - resolution: {integrity: sha512-9hjRTVoZjRFR6xo8igAJyNXQyPX6Aq++Nhb5ebrUF414dv4jr2MitM2fWiOY475wa3Za7TOS2Gh9fmqEhLTt0A==} + '@types/d3-selection': 3.0.7 dev: true /@types/d3-interpolate@3.0.1: @@ -2805,100 +2744,15 @@ packages: '@types/d3-color': 3.1.0 dev: true - /@types/d3-path@3.0.0: - resolution: {integrity: sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==} - dev: true - - /@types/d3-polygon@3.0.0: - resolution: {integrity: sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==} - dev: true - - /@types/d3-quadtree@3.0.2: - resolution: {integrity: sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==} - dev: true - - /@types/d3-random@3.0.1: - resolution: {integrity: sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==} - dev: true - - /@types/d3-scale-chromatic@3.0.0: - resolution: {integrity: sha512-dsoJGEIShosKVRBZB0Vo3C8nqSDqVGujJU6tPznsBJxNJNwMF8utmS83nvCBKQYPpjCzaaHcrf66iTRpZosLPw==} - dev: true - - /@types/d3-scale@4.0.3: - resolution: {integrity: sha512-PATBiMCpvHJSMtZAMEhc2WyL+hnzarKzI6wAHYjhsonjWJYGq5BXTzQjv4l8m2jO183/4wZ90rKvSeT7o72xNQ==} - dependencies: - '@types/d3-time': 3.0.0 - dev: true - - /@types/d3-selection@3.0.4: - resolution: {integrity: sha512-ZeykX7286BCyMg9sH5fIAORyCB6hcATPSRQpN47jwBA2bMbAT0s+EvtDP5r1FZYJ95R8QoEE1CKJX+n0/M5Vhg==} - dev: true - - /@types/d3-shape@3.1.1: - resolution: {integrity: sha512-6Uh86YFF7LGg4PQkuO2oG6EMBRLuW9cbavUW46zkIO5kuS2PfTqo2o9SkgtQzguBHbLgNnU90UNsITpsX1My+A==} - dependencies: - '@types/d3-path': 3.0.0 - dev: true - - /@types/d3-time-format@4.0.0: - resolution: {integrity: sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==} - dev: true - - /@types/d3-time@3.0.0: - resolution: {integrity: sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==} - dev: true - - /@types/d3-timer@3.0.0: - resolution: {integrity: sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==} - dev: true - - /@types/d3-transition@3.0.3: - resolution: {integrity: sha512-/S90Od8Id1wgQNvIA8iFv9jRhCiZcGhPd2qX0bKF/PS+y0W5CrXKgIiELd2CvG1mlQrWK/qlYh3VxicqG1ZvgA==} - dependencies: - '@types/d3-selection': 3.0.4 + /@types/d3-selection@3.0.7: + resolution: {integrity: sha512-qoj2O7KjfqCobmtFOth8FMvjwMVPUAAmn6xiUbLl1ld7vQCPgffvyV5BBcEFfqWdilAUm+3zciU/3P3vZrUMlg==} dev: true - /@types/d3-zoom@3.0.2: - resolution: {integrity: sha512-t09DDJVBI6AkM7N8kuPsnq/3d/ehtRKBN1xSiYjjMCgbiw6HM6Ged5VhvswmhprfKyGvzeTEL/4WBaK9llWvlA==} + /@types/d3-zoom@3.0.5: + resolution: {integrity: sha512-mIefdTLtxuWUWTbBupCUXPAXVPmi8/Uwrq41gQpRh0rD25GMU1ku+oTELqNY2NuuiI0F3wXC5e1liBQi7YS7XQ==} dependencies: '@types/d3-interpolate': 3.0.1 - '@types/d3-selection': 3.0.4 - dev: true - - /@types/d3@7.4.0: - resolution: {integrity: sha512-jIfNVK0ZlxcuRDKtRS/SypEyOQ6UHaFQBKv032X45VvxSJ6Yi5G9behy9h6tNTHTDGh5Vq+KbmBjUWLgY4meCA==} - dependencies: - '@types/d3-array': 3.0.4 - '@types/d3-axis': 3.0.2 - '@types/d3-brush': 3.0.2 - '@types/d3-chord': 3.0.2 - '@types/d3-color': 3.1.0 - '@types/d3-contour': 3.0.2 - '@types/d3-delaunay': 6.0.1 - '@types/d3-dispatch': 3.0.2 - '@types/d3-drag': 3.0.2 - '@types/d3-dsv': 3.0.1 - '@types/d3-ease': 3.0.0 - '@types/d3-fetch': 3.0.2 - '@types/d3-force': 3.0.4 - '@types/d3-format': 3.0.1 - '@types/d3-geo': 3.0.3 - '@types/d3-hierarchy': 3.1.2 - '@types/d3-interpolate': 3.0.1 - '@types/d3-path': 3.0.0 - '@types/d3-polygon': 3.0.0 - '@types/d3-quadtree': 3.0.2 - '@types/d3-random': 3.0.1 - '@types/d3-scale': 4.0.3 - '@types/d3-scale-chromatic': 3.0.0 - '@types/d3-selection': 3.0.4 - '@types/d3-shape': 3.1.1 - '@types/d3-time': 3.0.0 - '@types/d3-time-format': 4.0.0 - '@types/d3-timer': 3.0.0 - '@types/d3-transition': 3.0.3 - '@types/d3-zoom': 3.0.2 + '@types/d3-selection': 3.0.7 dev: true /@types/dagre@0.7.48: @@ -2936,10 +2790,6 @@ packages: resolution: {integrity: sha512-BsPXH/irW0ht0Ji6iw/jJaK8Lj3FJemon2gvEqHKpCdDCeemHa+rI3WBGq5z7cDMZgoLjY40oninGxqk+8NzNQ==} dev: true - /@types/geojson@7946.0.10: - resolution: {integrity: sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==} - dev: true - /@types/har-format@1.2.10: resolution: {integrity: sha512-o0J30wqycjF5miWDKYKKzzOU1ZTLuA42HZ4HE7/zqTOc/jTLdQ5NhYWvsRQo45Nfi1KHoRdNhteSI4BAxTF1Pg==} dev: true