@files-preview-app/preview-file 1.3.10 → 1.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.cjs +63 -18
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +63 -18
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +63 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -18
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +63 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +63 -18
- package/dist/react.js.map +1 -1
- package/dist/vue.cjs +63 -18
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +63 -18
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/vue.d.cts
CHANGED
|
@@ -34,10 +34,10 @@ declare const FilePreview: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
34
34
|
onLoading?: ((...args: any[]) => any) | undefined;
|
|
35
35
|
onLoaded?: ((...args: any[]) => any) | undefined;
|
|
36
36
|
onError?: ((...args: any[]) => any) | undefined;
|
|
37
|
-
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
38
|
-
"onZoom-change"?: ((...args: any[]) => any) | undefined;
|
|
39
37
|
onRotate?: ((...args: any[]) => any) | undefined;
|
|
40
38
|
onDestroy?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
40
|
+
"onZoom-change"?: ((...args: any[]) => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
42
|
plugins: PreviewPlugin[];
|
|
43
43
|
options: PreviewViewerOptions;
|
package/dist/vue.d.ts
CHANGED
|
@@ -34,10 +34,10 @@ declare const FilePreview: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
34
34
|
onLoading?: ((...args: any[]) => any) | undefined;
|
|
35
35
|
onLoaded?: ((...args: any[]) => any) | undefined;
|
|
36
36
|
onError?: ((...args: any[]) => any) | undefined;
|
|
37
|
-
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
38
|
-
"onZoom-change"?: ((...args: any[]) => any) | undefined;
|
|
39
37
|
onRotate?: ((...args: any[]) => any) | undefined;
|
|
40
38
|
onDestroy?: ((...args: any[]) => any) | undefined;
|
|
39
|
+
"onPage-change"?: ((...args: any[]) => any) | undefined;
|
|
40
|
+
"onZoom-change"?: ((...args: any[]) => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
42
|
plugins: PreviewPlugin[];
|
|
43
43
|
options: PreviewViewerOptions;
|
package/dist/vue.js
CHANGED
|
@@ -2717,13 +2717,28 @@ var MediaPlugin = class {
|
|
|
2717
2717
|
video.src = url;
|
|
2718
2718
|
video.controls = true;
|
|
2719
2719
|
video.playsInline = true;
|
|
2720
|
-
video.style.maxWidth = "90%";
|
|
2721
|
-
video.style.maxHeight = "90%";
|
|
2722
2720
|
video.style.borderRadius = "8px";
|
|
2723
2721
|
video.style.boxShadow = "0 8px 30px rgba(0,0,0,0.3)";
|
|
2724
2722
|
video.style.backgroundColor = "#000000";
|
|
2723
|
+
video.style.objectFit = "contain";
|
|
2724
|
+
video.style.transition = "transform 0.2s ease";
|
|
2725
2725
|
element = video;
|
|
2726
2726
|
mediaElement = video;
|
|
2727
|
+
const onMeta = () => {
|
|
2728
|
+
if (video.videoWidth > 0 && video.videoHeight > 0) {
|
|
2729
|
+
naturalW = video.videoWidth;
|
|
2730
|
+
naturalH = video.videoHeight;
|
|
2731
|
+
}
|
|
2732
|
+
updateBaseDimensions();
|
|
2733
|
+
applyTransform();
|
|
2734
|
+
};
|
|
2735
|
+
if (video.readyState >= 1 && video.videoWidth > 0) {
|
|
2736
|
+
naturalW = video.videoWidth;
|
|
2737
|
+
naturalH = video.videoHeight;
|
|
2738
|
+
} else {
|
|
2739
|
+
video.addEventListener("loadedmetadata", onMeta, { once: true });
|
|
2740
|
+
video.addEventListener("canplay", onMeta, { once: true });
|
|
2741
|
+
}
|
|
2727
2742
|
} else if (isAudio) {
|
|
2728
2743
|
const audio = document.createElement("audio");
|
|
2729
2744
|
audio.src = url;
|
|
@@ -2764,11 +2779,19 @@ var MediaPlugin = class {
|
|
|
2764
2779
|
let fitMode = ctx?.options?.fitMode || "width";
|
|
2765
2780
|
let isUserZoomed = false;
|
|
2766
2781
|
const updateBaseDimensions = () => {
|
|
2767
|
-
if (!isImage) return;
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2782
|
+
if (!isImage && !isVideo) return;
|
|
2783
|
+
if (isImage) {
|
|
2784
|
+
const img = element;
|
|
2785
|
+
if (img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
2786
|
+
naturalW = img.naturalWidth;
|
|
2787
|
+
naturalH = img.naturalHeight;
|
|
2788
|
+
}
|
|
2789
|
+
} else if (isVideo) {
|
|
2790
|
+
const vid = element;
|
|
2791
|
+
if (vid.videoWidth > 0 && vid.videoHeight > 0) {
|
|
2792
|
+
naturalW = vid.videoWidth;
|
|
2793
|
+
naturalH = vid.videoHeight;
|
|
2794
|
+
}
|
|
2772
2795
|
}
|
|
2773
2796
|
const availW = Math.max(100, ctx.container.clientWidth - 32);
|
|
2774
2797
|
const availH = Math.max(100, ctx.container.clientHeight - 32);
|
|
@@ -2782,7 +2805,7 @@ var MediaPlugin = class {
|
|
|
2782
2805
|
baseH = Math.max(1, Math.round(naturalH * fitRatio));
|
|
2783
2806
|
};
|
|
2784
2807
|
const applyTransform = () => {
|
|
2785
|
-
if (isImage) {
|
|
2808
|
+
if (isImage || isVideo) {
|
|
2786
2809
|
if (!isUserZoomed) {
|
|
2787
2810
|
updateBaseDimensions();
|
|
2788
2811
|
}
|
|
@@ -2793,10 +2816,10 @@ var MediaPlugin = class {
|
|
|
2793
2816
|
sizer.style.width = `${boxW}px`;
|
|
2794
2817
|
sizer.style.height = `${boxH}px`;
|
|
2795
2818
|
sizer.style.margin = boxH < availH ? "auto 0" : "0";
|
|
2796
|
-
const
|
|
2797
|
-
const
|
|
2798
|
-
element.style.width = `${
|
|
2799
|
-
element.style.height = `${
|
|
2819
|
+
const elW = isRotated90 ? boxH : boxW;
|
|
2820
|
+
const elH = isRotated90 ? boxW : boxH;
|
|
2821
|
+
element.style.width = `${elW}px`;
|
|
2822
|
+
element.style.height = `${elH}px`;
|
|
2800
2823
|
element.style.maxWidth = "none";
|
|
2801
2824
|
element.style.maxHeight = "none";
|
|
2802
2825
|
element.style.transform = rotation ? `rotate(${rotation}deg)` : "none";
|
|
@@ -2806,6 +2829,8 @@ var MediaPlugin = class {
|
|
|
2806
2829
|
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2807
2830
|
}
|
|
2808
2831
|
};
|
|
2832
|
+
updateBaseDimensions();
|
|
2833
|
+
applyTransform();
|
|
2809
2834
|
if (isImage) {
|
|
2810
2835
|
const img = element;
|
|
2811
2836
|
if (img.complete && img.naturalWidth > 0) {
|
|
@@ -2850,7 +2875,7 @@ var MediaPlugin = class {
|
|
|
2850
2875
|
currentZoom = level;
|
|
2851
2876
|
applyTransform();
|
|
2852
2877
|
} : void 0,
|
|
2853
|
-
fitToPage: isImage ? () => {
|
|
2878
|
+
fitToPage: isImage || isVideo ? () => {
|
|
2854
2879
|
isUserZoomed = false;
|
|
2855
2880
|
fitMode = "page";
|
|
2856
2881
|
currentZoom = 1;
|
|
@@ -2860,7 +2885,7 @@ var MediaPlugin = class {
|
|
|
2860
2885
|
updateBaseDimensions();
|
|
2861
2886
|
applyTransform();
|
|
2862
2887
|
} : void 0,
|
|
2863
|
-
fitToWidth: isImage ? () => {
|
|
2888
|
+
fitToWidth: isImage || isVideo ? () => {
|
|
2864
2889
|
isUserZoomed = false;
|
|
2865
2890
|
fitMode = "width";
|
|
2866
2891
|
currentZoom = 1;
|
|
@@ -2870,7 +2895,7 @@ var MediaPlugin = class {
|
|
|
2870
2895
|
updateBaseDimensions();
|
|
2871
2896
|
applyTransform();
|
|
2872
2897
|
} : void 0,
|
|
2873
|
-
resetZoom: isImage ? () => {
|
|
2898
|
+
resetZoom: isImage || isVideo ? () => {
|
|
2874
2899
|
isUserZoomed = false;
|
|
2875
2900
|
fitMode = ctx?.options?.fitMode || "width";
|
|
2876
2901
|
currentZoom = 1;
|
|
@@ -6009,6 +6034,16 @@ var ThreeDPlugin = class {
|
|
|
6009
6034
|
type: "button",
|
|
6010
6035
|
group: "actions",
|
|
6011
6036
|
execute: () => instance.download?.()
|
|
6037
|
+
},
|
|
6038
|
+
{
|
|
6039
|
+
id: "open-window",
|
|
6040
|
+
icon: "open-window",
|
|
6041
|
+
label: "Open in Separate Full Window",
|
|
6042
|
+
type: "button",
|
|
6043
|
+
group: "actions",
|
|
6044
|
+
execute: () => {
|
|
6045
|
+
instance.openInSeparateWindow?.();
|
|
6046
|
+
}
|
|
6012
6047
|
}
|
|
6013
6048
|
];
|
|
6014
6049
|
}
|
|
@@ -6079,12 +6114,21 @@ var ThreeDPlugin = class {
|
|
|
6079
6114
|
});
|
|
6080
6115
|
meshGroup.add(obj);
|
|
6081
6116
|
}
|
|
6117
|
+
const initialBox = new THREE.Box3().setFromObject(meshGroup);
|
|
6118
|
+
const center = initialBox.getCenter(new THREE.Vector3());
|
|
6119
|
+
meshGroup.position.sub(center);
|
|
6082
6120
|
scene.add(meshGroup);
|
|
6083
6121
|
const box = new THREE.Box3().setFromObject(meshGroup);
|
|
6084
|
-
const
|
|
6085
|
-
const
|
|
6122
|
+
const size = box.getSize(new THREE.Vector3());
|
|
6123
|
+
const maxDim = Math.max(size.x, size.y, size.z) || 10;
|
|
6124
|
+
grid.position.y = -size.y / 2;
|
|
6125
|
+
const gridScale = Math.max(0.1, maxDim / 50);
|
|
6126
|
+
grid.scale.set(gridScale, 1, gridScale);
|
|
6127
|
+
const fovRad = camera.fov * (Math.PI / 180);
|
|
6128
|
+
let cameraDistance = maxDim / 2 / Math.tan(fovRad / 2);
|
|
6129
|
+
cameraDistance = Math.max(cameraDistance * 1.5, 2);
|
|
6086
6130
|
const fitCamera = () => {
|
|
6087
|
-
camera.position.set(
|
|
6131
|
+
camera.position.set(cameraDistance * 0.8, cameraDistance * 0.6, cameraDistance);
|
|
6088
6132
|
camera.lookAt(0, 0, 0);
|
|
6089
6133
|
controls.target.set(0, 0, 0);
|
|
6090
6134
|
controls.update();
|
|
@@ -6130,6 +6174,7 @@ var ThreeDPlugin = class {
|
|
|
6130
6174
|
controls.update();
|
|
6131
6175
|
},
|
|
6132
6176
|
fitToPage: fitCamera,
|
|
6177
|
+
fitToWidth: fitCamera,
|
|
6133
6178
|
resetZoom: fitCamera,
|
|
6134
6179
|
rotateCW: () => {
|
|
6135
6180
|
isWireframe = !isWireframe;
|