@files-preview-app/preview-file 1.3.9 → 1.3.11
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 +90 -19
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +90 -19
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +90 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -19
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +90 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +90 -19
- package/dist/react.js.map +1 -1
- package/dist/vue.cjs +90 -19
- 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 +90 -19
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2832,13 +2832,28 @@ var MediaPlugin = class {
|
|
|
2832
2832
|
video.src = url;
|
|
2833
2833
|
video.controls = true;
|
|
2834
2834
|
video.playsInline = true;
|
|
2835
|
-
video.style.maxWidth = "90%";
|
|
2836
|
-
video.style.maxHeight = "90%";
|
|
2837
2835
|
video.style.borderRadius = "8px";
|
|
2838
2836
|
video.style.boxShadow = "0 8px 30px rgba(0,0,0,0.3)";
|
|
2839
2837
|
video.style.backgroundColor = "#000000";
|
|
2838
|
+
video.style.objectFit = "contain";
|
|
2839
|
+
video.style.transition = "transform 0.2s ease";
|
|
2840
2840
|
element = video;
|
|
2841
2841
|
mediaElement = video;
|
|
2842
|
+
const onMeta = () => {
|
|
2843
|
+
if (video.videoWidth > 0 && video.videoHeight > 0) {
|
|
2844
|
+
naturalW = video.videoWidth;
|
|
2845
|
+
naturalH = video.videoHeight;
|
|
2846
|
+
}
|
|
2847
|
+
updateBaseDimensions();
|
|
2848
|
+
applyTransform();
|
|
2849
|
+
};
|
|
2850
|
+
if (video.readyState >= 1 && video.videoWidth > 0) {
|
|
2851
|
+
naturalW = video.videoWidth;
|
|
2852
|
+
naturalH = video.videoHeight;
|
|
2853
|
+
} else {
|
|
2854
|
+
video.addEventListener("loadedmetadata", onMeta, { once: true });
|
|
2855
|
+
video.addEventListener("canplay", onMeta, { once: true });
|
|
2856
|
+
}
|
|
2842
2857
|
} else if (isAudio) {
|
|
2843
2858
|
const audio = document.createElement("audio");
|
|
2844
2859
|
audio.src = url;
|
|
@@ -2879,11 +2894,19 @@ var MediaPlugin = class {
|
|
|
2879
2894
|
let fitMode = ctx?.options?.fitMode || "width";
|
|
2880
2895
|
let isUserZoomed = false;
|
|
2881
2896
|
const updateBaseDimensions = () => {
|
|
2882
|
-
if (!isImage) return;
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2897
|
+
if (!isImage && !isVideo) return;
|
|
2898
|
+
if (isImage) {
|
|
2899
|
+
const img = element;
|
|
2900
|
+
if (img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
2901
|
+
naturalW = img.naturalWidth;
|
|
2902
|
+
naturalH = img.naturalHeight;
|
|
2903
|
+
}
|
|
2904
|
+
} else if (isVideo) {
|
|
2905
|
+
const vid = element;
|
|
2906
|
+
if (vid.videoWidth > 0 && vid.videoHeight > 0) {
|
|
2907
|
+
naturalW = vid.videoWidth;
|
|
2908
|
+
naturalH = vid.videoHeight;
|
|
2909
|
+
}
|
|
2887
2910
|
}
|
|
2888
2911
|
const availW = Math.max(100, ctx.container.clientWidth - 32);
|
|
2889
2912
|
const availH = Math.max(100, ctx.container.clientHeight - 32);
|
|
@@ -2897,7 +2920,7 @@ var MediaPlugin = class {
|
|
|
2897
2920
|
baseH = Math.max(1, Math.round(naturalH * fitRatio));
|
|
2898
2921
|
};
|
|
2899
2922
|
const applyTransform = () => {
|
|
2900
|
-
if (isImage) {
|
|
2923
|
+
if (isImage || isVideo) {
|
|
2901
2924
|
if (!isUserZoomed) {
|
|
2902
2925
|
updateBaseDimensions();
|
|
2903
2926
|
}
|
|
@@ -2908,10 +2931,10 @@ var MediaPlugin = class {
|
|
|
2908
2931
|
sizer.style.width = `${boxW}px`;
|
|
2909
2932
|
sizer.style.height = `${boxH}px`;
|
|
2910
2933
|
sizer.style.margin = boxH < availH ? "auto 0" : "0";
|
|
2911
|
-
const
|
|
2912
|
-
const
|
|
2913
|
-
element.style.width = `${
|
|
2914
|
-
element.style.height = `${
|
|
2934
|
+
const elW = isRotated90 ? boxH : boxW;
|
|
2935
|
+
const elH = isRotated90 ? boxW : boxH;
|
|
2936
|
+
element.style.width = `${elW}px`;
|
|
2937
|
+
element.style.height = `${elH}px`;
|
|
2915
2938
|
element.style.maxWidth = "none";
|
|
2916
2939
|
element.style.maxHeight = "none";
|
|
2917
2940
|
element.style.transform = rotation ? `rotate(${rotation}deg)` : "none";
|
|
@@ -2921,6 +2944,8 @@ var MediaPlugin = class {
|
|
|
2921
2944
|
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2922
2945
|
}
|
|
2923
2946
|
};
|
|
2947
|
+
updateBaseDimensions();
|
|
2948
|
+
applyTransform();
|
|
2924
2949
|
if (isImage) {
|
|
2925
2950
|
const img = element;
|
|
2926
2951
|
if (img.complete && img.naturalWidth > 0) {
|
|
@@ -2965,7 +2990,7 @@ var MediaPlugin = class {
|
|
|
2965
2990
|
currentZoom = level;
|
|
2966
2991
|
applyTransform();
|
|
2967
2992
|
} : void 0,
|
|
2968
|
-
fitToPage: isImage ? () => {
|
|
2993
|
+
fitToPage: isImage || isVideo ? () => {
|
|
2969
2994
|
isUserZoomed = false;
|
|
2970
2995
|
fitMode = "page";
|
|
2971
2996
|
currentZoom = 1;
|
|
@@ -2975,7 +3000,7 @@ var MediaPlugin = class {
|
|
|
2975
3000
|
updateBaseDimensions();
|
|
2976
3001
|
applyTransform();
|
|
2977
3002
|
} : void 0,
|
|
2978
|
-
fitToWidth: isImage ? () => {
|
|
3003
|
+
fitToWidth: isImage || isVideo ? () => {
|
|
2979
3004
|
isUserZoomed = false;
|
|
2980
3005
|
fitMode = "width";
|
|
2981
3006
|
currentZoom = 1;
|
|
@@ -2985,7 +3010,7 @@ var MediaPlugin = class {
|
|
|
2985
3010
|
updateBaseDimensions();
|
|
2986
3011
|
applyTransform();
|
|
2987
3012
|
} : void 0,
|
|
2988
|
-
resetZoom: isImage ? () => {
|
|
3013
|
+
resetZoom: isImage || isVideo ? () => {
|
|
2989
3014
|
isUserZoomed = false;
|
|
2990
3015
|
fitMode = ctx?.options?.fitMode || "width";
|
|
2991
3016
|
currentZoom = 1;
|
|
@@ -4888,6 +4913,36 @@ var CodePlugin = class {
|
|
|
4888
4913
|
pre.style.transition = "transform 0.15s ease";
|
|
4889
4914
|
pre.style.flexShrink = "0";
|
|
4890
4915
|
} else {
|
|
4916
|
+
if (typeof document !== "undefined" && !document.getElementById("fp-code-syntax-styles")) {
|
|
4917
|
+
const style = document.createElement("style");
|
|
4918
|
+
style.id = "fp-code-syntax-styles";
|
|
4919
|
+
style.textContent = `
|
|
4920
|
+
.fp-code-scroll-wrapper .hljs-keyword { color: #569cd6; font-weight: normal; }
|
|
4921
|
+
.fp-code-scroll-wrapper .hljs-built_in { color: #4ec9b0; }
|
|
4922
|
+
.fp-code-scroll-wrapper .hljs-type { color: #4ec9b0; }
|
|
4923
|
+
.fp-code-scroll-wrapper .hljs-literal { color: #569cd6; }
|
|
4924
|
+
.fp-code-scroll-wrapper .hljs-number { color: #b5cea8; }
|
|
4925
|
+
.fp-code-scroll-wrapper .hljs-regexp { color: #d16969; }
|
|
4926
|
+
.fp-code-scroll-wrapper .hljs-string { color: #ce9178; }
|
|
4927
|
+
.fp-code-scroll-wrapper .hljs-subst { color: #d4d4d4; }
|
|
4928
|
+
.fp-code-scroll-wrapper .hljs-symbol { color: #569cd6; }
|
|
4929
|
+
.fp-code-scroll-wrapper .hljs-class { color: #4ec9b0; }
|
|
4930
|
+
.fp-code-scroll-wrapper .hljs-function { color: #dcdcaa; }
|
|
4931
|
+
.fp-code-scroll-wrapper .hljs-title { color: #dcdcaa; }
|
|
4932
|
+
.fp-code-scroll-wrapper .hljs-params { color: #9cdcfe; }
|
|
4933
|
+
.fp-code-scroll-wrapper .hljs-comment { color: #6a9955; font-style: italic; }
|
|
4934
|
+
.fp-code-scroll-wrapper .hljs-doctag { color: #608b4e; }
|
|
4935
|
+
.fp-code-scroll-wrapper .hljs-meta { color: #9cdcfe; }
|
|
4936
|
+
.fp-code-scroll-wrapper .hljs-section { color: #569cd6; }
|
|
4937
|
+
.fp-code-scroll-wrapper .hljs-tag { color: #569cd6; }
|
|
4938
|
+
.fp-code-scroll-wrapper .hljs-name { color: #569cd6; }
|
|
4939
|
+
.fp-code-scroll-wrapper .hljs-attr { color: #9cdcfe; }
|
|
4940
|
+
.fp-code-scroll-wrapper .hljs-attribute { color: #9cdcfe; }
|
|
4941
|
+
.fp-code-scroll-wrapper .hljs-variable { color: #9cdcfe; }
|
|
4942
|
+
.fp-code-scroll-wrapper .hljs-punctuation { color: #d4d4d4; }
|
|
4943
|
+
`;
|
|
4944
|
+
document.head.appendChild(style);
|
|
4945
|
+
}
|
|
4891
4946
|
ctx.container.style.backgroundColor = "#1e1e1e";
|
|
4892
4947
|
ctx.container.style.color = "#d4d4d4";
|
|
4893
4948
|
scrollWrapper.className = "fp-code-scroll-wrapper";
|
|
@@ -4897,9 +4952,13 @@ var CodePlugin = class {
|
|
|
4897
4952
|
scrollWrapper.style.height = "max-content";
|
|
4898
4953
|
scrollWrapper.style.display = "flex";
|
|
4899
4954
|
scrollWrapper.style.alignItems = "flex-start";
|
|
4900
|
-
scrollWrapper.style.padding = "16px";
|
|
4955
|
+
scrollWrapper.style.padding = "16px 16px 16px 0";
|
|
4901
4956
|
scrollWrapper.style.boxSizing = "border-box";
|
|
4902
|
-
const
|
|
4957
|
+
const rawLines = fullText.split(/\r?\n/);
|
|
4958
|
+
if (rawLines.length > 1 && rawLines[rawLines.length - 1] === "") {
|
|
4959
|
+
rawLines.pop();
|
|
4960
|
+
}
|
|
4961
|
+
const lineCount = Math.max(1, rawLines.length);
|
|
4903
4962
|
const gutterLines = [];
|
|
4904
4963
|
for (let i = 1; i <= lineCount; i++) {
|
|
4905
4964
|
gutterLines.push(String(i));
|
|
@@ -4907,16 +4966,23 @@ var CodePlugin = class {
|
|
|
4907
4966
|
lineGutter.className = "fp-code-gutter";
|
|
4908
4967
|
lineGutter.style.userSelect = "none";
|
|
4909
4968
|
lineGutter.style.textAlign = "right";
|
|
4910
|
-
lineGutter.style.
|
|
4911
|
-
lineGutter.style.
|
|
4969
|
+
lineGutter.style.padding = "0 16px";
|
|
4970
|
+
lineGutter.style.margin = "0 16px 0 0";
|
|
4912
4971
|
lineGutter.style.borderRight = "1px solid #333333";
|
|
4913
4972
|
lineGutter.style.color = "#858585";
|
|
4914
4973
|
lineGutter.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4915
4974
|
lineGutter.style.fontSize = `${fontSize}px`;
|
|
4916
4975
|
lineGutter.style.lineHeight = "1.6";
|
|
4976
|
+
lineGutter.style.whiteSpace = "pre";
|
|
4917
4977
|
lineGutter.style.flexShrink = "0";
|
|
4978
|
+
lineGutter.style.position = "sticky";
|
|
4979
|
+
lineGutter.style.left = "0";
|
|
4980
|
+
lineGutter.style.backgroundColor = "#1e1e1e";
|
|
4981
|
+
lineGutter.style.zIndex = "2";
|
|
4982
|
+
lineGutter.style.boxSizing = "border-box";
|
|
4918
4983
|
lineGutter.textContent = gutterLines.join("\n");
|
|
4919
4984
|
pre.style.margin = "0";
|
|
4985
|
+
pre.style.padding = "0 16px 0 0";
|
|
4920
4986
|
pre.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4921
4987
|
pre.style.fontSize = `${fontSize}px`;
|
|
4922
4988
|
pre.style.lineHeight = "1.6";
|
|
@@ -4924,6 +4990,11 @@ var CodePlugin = class {
|
|
|
4924
4990
|
pre.style.wordBreak = "normal";
|
|
4925
4991
|
pre.style.overflowWrap = "normal";
|
|
4926
4992
|
pre.style.flex = "1";
|
|
4993
|
+
code.style.display = "block";
|
|
4994
|
+
code.style.fontFamily = "inherit";
|
|
4995
|
+
code.style.fontSize = "inherit";
|
|
4996
|
+
code.style.lineHeight = "inherit";
|
|
4997
|
+
code.style.whiteSpace = "inherit";
|
|
4927
4998
|
}
|
|
4928
4999
|
const ext = (ctx.metadata.extension || "").replace(".", "");
|
|
4929
5000
|
const renderCodePage = (text) => {
|