+
-
+
diff --git a/examples/with-vanilla/package.json b/examples/with-vanilla/package.json
index 1b564b41..7a1edd30 100644
--- a/examples/with-vanilla/package.json
+++ b/examples/with-vanilla/package.json
@@ -9,7 +9,7 @@
"@unocss/reset": "^0.54.3",
"typescript": "^5.1.6",
"unocss": "^0.54.3",
- "vite": "^4.4.9"
+ "vite": "^4.5.0"
},
"dependencies": {
"@zoom-image/core": "latest"
diff --git a/examples/with-vanilla/src/main.ts b/examples/with-vanilla/src/main.ts
index 43171c4c..d5d562d3 100644
--- a/examples/with-vanilla/src/main.ts
+++ b/examples/with-vanilla/src/main.ts
@@ -97,9 +97,9 @@ const makeUpdateUIFunc = () => {
cropImgBtn.addEventListener(
"click",
- () => {
+ async () => {
const currentState = result.getState()
- const croppedImage = cropImage({
+ const croppedImage = await cropImage({
image: container.querySelector("img") as HTMLImageElement,
currentZoom: currentState.currentZoom,
positionX: currentState.currentPositionX,
diff --git a/examples/with-vue/package.json b/examples/with-vue/package.json
index f39c8045..08eb6f34 100644
--- a/examples/with-vue/package.json
+++ b/examples/with-vue/package.json
@@ -17,7 +17,7 @@
"npm-run-all": "^4.1.5",
"typescript": "~5.1.6",
"unocss": "^0.54.3",
- "vite": "^4.4.9",
+ "vite": "^4.5.0",
"vue-tsc": "^1.8.8"
}
}
diff --git a/packages/core/package.json b/packages/core/package.json
index 952418a6..118326e3 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -64,7 +64,7 @@
"tsconfig": "workspace:*",
"tsup": "7.2.0",
"typescript": "^5.1.6",
- "vite": "^4.4.9",
+ "vite": "^4.5.0",
"vitest": "^0.34.1",
"vitest-dom": "^0.1.0",
"vue": "^3.3.4"
diff --git a/packages/docs/package.json b/packages/docs/package.json
index ab93ad44..96f93321 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -16,6 +16,7 @@
"@zoom-image/vue": "workspace:*",
"eslint-config-custom": "workspace:*",
"eslint-plugin-vue": "^9.18.1",
+ "vite": "^4.5.0",
"vitepress": "1.0.0-rc.25",
"vue": "^3.3.8"
}
diff --git a/packages/docs/src/.vitepress/config.mts b/packages/docs/src/.vitepress/config.mts
index c9aeb09c..5c704ed2 100644
--- a/packages/docs/src/.vitepress/config.mts
+++ b/packages/docs/src/.vitepress/config.mts
@@ -1,5 +1,6 @@
import { createRequire } from "node:module"
import Unocss from "unocss/vite"
+import { PluginOption } from "vite"
import { defineConfig } from "vitepress"
const require = createRequire(import.meta.url)
const pkg = require("@zoom-image/core/package.json")
@@ -144,6 +145,6 @@ export default defineConfig({
},
},
}),
- ],
+ ] as PluginOption[],
},
})
diff --git a/packages/docs/src/components/HomePageShow.vue b/packages/docs/src/components/HomePageShow.vue
index 42451cf1..1da2afe9 100644
--- a/packages/docs/src/components/HomePageShow.vue
+++ b/packages/docs/src/components/HomePageShow.vue
@@ -3,6 +3,10 @@ import { cropImage } from "@zoom-image/core"
import { useZoomImageClick, useZoomImageHover, useZoomImageMove, useZoomImageWheel } from "@zoom-image/vue"
import { computed, nextTick, ref, watch } from "vue"
+// @ts-ignore
+const BASE_URL = import.meta.env.BASE_URL
+const imageURL = BASE_URL + "sample.avif"
+
const tabs = ref<
{
name: string
@@ -96,7 +100,7 @@ watch(
if (zoomType.value === "hover") {
const isMobile = window.innerWidth < 768
createZoomImageHover(imageHoverContainerRef.value as HTMLDivElement, {
- zoomImageSource: "/sample.avif",
+ zoomImageSource: imageURL,
customZoom: isMobile ? { width: 100, height: 150 } : { width: 300, height: 450 },
zoomTarget: zoomTargetRef.value as HTMLDivElement,
scale: 2,
@@ -109,13 +113,13 @@ watch(
if (zoomType.value === "move") {
createZoomImageMove(imageMoveContainerRef.value as HTMLDivElement, {
- zoomImageSource: "/sample.avif",
+ zoomImageSource: imageURL,
})
}
if (zoomType.value === "click") {
createZoomImageClick(imageClickContainerRef.value as HTMLDivElement, {
- zoomImageSource: "/sample.avif",
+ zoomImageSource: imageURL,
})
}
},
@@ -146,7 +150,7 @@ watch(
-
+
@@ -168,7 +172,7 @@ watch(
ref="imageHoverContainerRef"
class="relative mt-1 flex h-[200px] w-[133.33px] items-start sm:h-[250px] sm:w-[166.66px] lg:h-[300px] lg:w-[200px]"
>
-
+
@@ -176,14 +180,14 @@ watch(