@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/react.cjs
CHANGED
|
@@ -2751,13 +2751,28 @@ var MediaPlugin = class {
|
|
|
2751
2751
|
video.src = url;
|
|
2752
2752
|
video.controls = true;
|
|
2753
2753
|
video.playsInline = true;
|
|
2754
|
-
video.style.maxWidth = "90%";
|
|
2755
|
-
video.style.maxHeight = "90%";
|
|
2756
2754
|
video.style.borderRadius = "8px";
|
|
2757
2755
|
video.style.boxShadow = "0 8px 30px rgba(0,0,0,0.3)";
|
|
2758
2756
|
video.style.backgroundColor = "#000000";
|
|
2757
|
+
video.style.objectFit = "contain";
|
|
2758
|
+
video.style.transition = "transform 0.2s ease";
|
|
2759
2759
|
element = video;
|
|
2760
2760
|
mediaElement = video;
|
|
2761
|
+
const onMeta = () => {
|
|
2762
|
+
if (video.videoWidth > 0 && video.videoHeight > 0) {
|
|
2763
|
+
naturalW = video.videoWidth;
|
|
2764
|
+
naturalH = video.videoHeight;
|
|
2765
|
+
}
|
|
2766
|
+
updateBaseDimensions();
|
|
2767
|
+
applyTransform();
|
|
2768
|
+
};
|
|
2769
|
+
if (video.readyState >= 1 && video.videoWidth > 0) {
|
|
2770
|
+
naturalW = video.videoWidth;
|
|
2771
|
+
naturalH = video.videoHeight;
|
|
2772
|
+
} else {
|
|
2773
|
+
video.addEventListener("loadedmetadata", onMeta, { once: true });
|
|
2774
|
+
video.addEventListener("canplay", onMeta, { once: true });
|
|
2775
|
+
}
|
|
2761
2776
|
} else if (isAudio) {
|
|
2762
2777
|
const audio = document.createElement("audio");
|
|
2763
2778
|
audio.src = url;
|
|
@@ -2798,11 +2813,19 @@ var MediaPlugin = class {
|
|
|
2798
2813
|
let fitMode = ctx?.options?.fitMode || "width";
|
|
2799
2814
|
let isUserZoomed = false;
|
|
2800
2815
|
const updateBaseDimensions = () => {
|
|
2801
|
-
if (!isImage) return;
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2816
|
+
if (!isImage && !isVideo) return;
|
|
2817
|
+
if (isImage) {
|
|
2818
|
+
const img = element;
|
|
2819
|
+
if (img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
2820
|
+
naturalW = img.naturalWidth;
|
|
2821
|
+
naturalH = img.naturalHeight;
|
|
2822
|
+
}
|
|
2823
|
+
} else if (isVideo) {
|
|
2824
|
+
const vid = element;
|
|
2825
|
+
if (vid.videoWidth > 0 && vid.videoHeight > 0) {
|
|
2826
|
+
naturalW = vid.videoWidth;
|
|
2827
|
+
naturalH = vid.videoHeight;
|
|
2828
|
+
}
|
|
2806
2829
|
}
|
|
2807
2830
|
const availW = Math.max(100, ctx.container.clientWidth - 32);
|
|
2808
2831
|
const availH = Math.max(100, ctx.container.clientHeight - 32);
|
|
@@ -2816,7 +2839,7 @@ var MediaPlugin = class {
|
|
|
2816
2839
|
baseH = Math.max(1, Math.round(naturalH * fitRatio));
|
|
2817
2840
|
};
|
|
2818
2841
|
const applyTransform = () => {
|
|
2819
|
-
if (isImage) {
|
|
2842
|
+
if (isImage || isVideo) {
|
|
2820
2843
|
if (!isUserZoomed) {
|
|
2821
2844
|
updateBaseDimensions();
|
|
2822
2845
|
}
|
|
@@ -2827,10 +2850,10 @@ var MediaPlugin = class {
|
|
|
2827
2850
|
sizer.style.width = `${boxW}px`;
|
|
2828
2851
|
sizer.style.height = `${boxH}px`;
|
|
2829
2852
|
sizer.style.margin = boxH < availH ? "auto 0" : "0";
|
|
2830
|
-
const
|
|
2831
|
-
const
|
|
2832
|
-
element.style.width = `${
|
|
2833
|
-
element.style.height = `${
|
|
2853
|
+
const elW = isRotated90 ? boxH : boxW;
|
|
2854
|
+
const elH = isRotated90 ? boxW : boxH;
|
|
2855
|
+
element.style.width = `${elW}px`;
|
|
2856
|
+
element.style.height = `${elH}px`;
|
|
2834
2857
|
element.style.maxWidth = "none";
|
|
2835
2858
|
element.style.maxHeight = "none";
|
|
2836
2859
|
element.style.transform = rotation ? `rotate(${rotation}deg)` : "none";
|
|
@@ -2840,6 +2863,8 @@ var MediaPlugin = class {
|
|
|
2840
2863
|
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2841
2864
|
}
|
|
2842
2865
|
};
|
|
2866
|
+
updateBaseDimensions();
|
|
2867
|
+
applyTransform();
|
|
2843
2868
|
if (isImage) {
|
|
2844
2869
|
const img = element;
|
|
2845
2870
|
if (img.complete && img.naturalWidth > 0) {
|
|
@@ -2884,7 +2909,7 @@ var MediaPlugin = class {
|
|
|
2884
2909
|
currentZoom = level;
|
|
2885
2910
|
applyTransform();
|
|
2886
2911
|
} : void 0,
|
|
2887
|
-
fitToPage: isImage ? () => {
|
|
2912
|
+
fitToPage: isImage || isVideo ? () => {
|
|
2888
2913
|
isUserZoomed = false;
|
|
2889
2914
|
fitMode = "page";
|
|
2890
2915
|
currentZoom = 1;
|
|
@@ -2894,7 +2919,7 @@ var MediaPlugin = class {
|
|
|
2894
2919
|
updateBaseDimensions();
|
|
2895
2920
|
applyTransform();
|
|
2896
2921
|
} : void 0,
|
|
2897
|
-
fitToWidth: isImage ? () => {
|
|
2922
|
+
fitToWidth: isImage || isVideo ? () => {
|
|
2898
2923
|
isUserZoomed = false;
|
|
2899
2924
|
fitMode = "width";
|
|
2900
2925
|
currentZoom = 1;
|
|
@@ -2904,7 +2929,7 @@ var MediaPlugin = class {
|
|
|
2904
2929
|
updateBaseDimensions();
|
|
2905
2930
|
applyTransform();
|
|
2906
2931
|
} : void 0,
|
|
2907
|
-
resetZoom: isImage ? () => {
|
|
2932
|
+
resetZoom: isImage || isVideo ? () => {
|
|
2908
2933
|
isUserZoomed = false;
|
|
2909
2934
|
fitMode = ctx?.options?.fitMode || "width";
|
|
2910
2935
|
currentZoom = 1;
|
|
@@ -4807,6 +4832,36 @@ var CodePlugin = class {
|
|
|
4807
4832
|
pre.style.transition = "transform 0.15s ease";
|
|
4808
4833
|
pre.style.flexShrink = "0";
|
|
4809
4834
|
} else {
|
|
4835
|
+
if (typeof document !== "undefined" && !document.getElementById("fp-code-syntax-styles")) {
|
|
4836
|
+
const style = document.createElement("style");
|
|
4837
|
+
style.id = "fp-code-syntax-styles";
|
|
4838
|
+
style.textContent = `
|
|
4839
|
+
.fp-code-scroll-wrapper .hljs-keyword { color: #569cd6; font-weight: normal; }
|
|
4840
|
+
.fp-code-scroll-wrapper .hljs-built_in { color: #4ec9b0; }
|
|
4841
|
+
.fp-code-scroll-wrapper .hljs-type { color: #4ec9b0; }
|
|
4842
|
+
.fp-code-scroll-wrapper .hljs-literal { color: #569cd6; }
|
|
4843
|
+
.fp-code-scroll-wrapper .hljs-number { color: #b5cea8; }
|
|
4844
|
+
.fp-code-scroll-wrapper .hljs-regexp { color: #d16969; }
|
|
4845
|
+
.fp-code-scroll-wrapper .hljs-string { color: #ce9178; }
|
|
4846
|
+
.fp-code-scroll-wrapper .hljs-subst { color: #d4d4d4; }
|
|
4847
|
+
.fp-code-scroll-wrapper .hljs-symbol { color: #569cd6; }
|
|
4848
|
+
.fp-code-scroll-wrapper .hljs-class { color: #4ec9b0; }
|
|
4849
|
+
.fp-code-scroll-wrapper .hljs-function { color: #dcdcaa; }
|
|
4850
|
+
.fp-code-scroll-wrapper .hljs-title { color: #dcdcaa; }
|
|
4851
|
+
.fp-code-scroll-wrapper .hljs-params { color: #9cdcfe; }
|
|
4852
|
+
.fp-code-scroll-wrapper .hljs-comment { color: #6a9955; font-style: italic; }
|
|
4853
|
+
.fp-code-scroll-wrapper .hljs-doctag { color: #608b4e; }
|
|
4854
|
+
.fp-code-scroll-wrapper .hljs-meta { color: #9cdcfe; }
|
|
4855
|
+
.fp-code-scroll-wrapper .hljs-section { color: #569cd6; }
|
|
4856
|
+
.fp-code-scroll-wrapper .hljs-tag { color: #569cd6; }
|
|
4857
|
+
.fp-code-scroll-wrapper .hljs-name { color: #569cd6; }
|
|
4858
|
+
.fp-code-scroll-wrapper .hljs-attr { color: #9cdcfe; }
|
|
4859
|
+
.fp-code-scroll-wrapper .hljs-attribute { color: #9cdcfe; }
|
|
4860
|
+
.fp-code-scroll-wrapper .hljs-variable { color: #9cdcfe; }
|
|
4861
|
+
.fp-code-scroll-wrapper .hljs-punctuation { color: #d4d4d4; }
|
|
4862
|
+
`;
|
|
4863
|
+
document.head.appendChild(style);
|
|
4864
|
+
}
|
|
4810
4865
|
ctx.container.style.backgroundColor = "#1e1e1e";
|
|
4811
4866
|
ctx.container.style.color = "#d4d4d4";
|
|
4812
4867
|
scrollWrapper.className = "fp-code-scroll-wrapper";
|
|
@@ -4816,9 +4871,13 @@ var CodePlugin = class {
|
|
|
4816
4871
|
scrollWrapper.style.height = "max-content";
|
|
4817
4872
|
scrollWrapper.style.display = "flex";
|
|
4818
4873
|
scrollWrapper.style.alignItems = "flex-start";
|
|
4819
|
-
scrollWrapper.style.padding = "16px";
|
|
4874
|
+
scrollWrapper.style.padding = "16px 16px 16px 0";
|
|
4820
4875
|
scrollWrapper.style.boxSizing = "border-box";
|
|
4821
|
-
const
|
|
4876
|
+
const rawLines = fullText.split(/\r?\n/);
|
|
4877
|
+
if (rawLines.length > 1 && rawLines[rawLines.length - 1] === "") {
|
|
4878
|
+
rawLines.pop();
|
|
4879
|
+
}
|
|
4880
|
+
const lineCount = Math.max(1, rawLines.length);
|
|
4822
4881
|
const gutterLines = [];
|
|
4823
4882
|
for (let i = 1; i <= lineCount; i++) {
|
|
4824
4883
|
gutterLines.push(String(i));
|
|
@@ -4826,16 +4885,23 @@ var CodePlugin = class {
|
|
|
4826
4885
|
lineGutter.className = "fp-code-gutter";
|
|
4827
4886
|
lineGutter.style.userSelect = "none";
|
|
4828
4887
|
lineGutter.style.textAlign = "right";
|
|
4829
|
-
lineGutter.style.
|
|
4830
|
-
lineGutter.style.
|
|
4888
|
+
lineGutter.style.padding = "0 16px";
|
|
4889
|
+
lineGutter.style.margin = "0 16px 0 0";
|
|
4831
4890
|
lineGutter.style.borderRight = "1px solid #333333";
|
|
4832
4891
|
lineGutter.style.color = "#858585";
|
|
4833
4892
|
lineGutter.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4834
4893
|
lineGutter.style.fontSize = `${fontSize}px`;
|
|
4835
4894
|
lineGutter.style.lineHeight = "1.6";
|
|
4895
|
+
lineGutter.style.whiteSpace = "pre";
|
|
4836
4896
|
lineGutter.style.flexShrink = "0";
|
|
4897
|
+
lineGutter.style.position = "sticky";
|
|
4898
|
+
lineGutter.style.left = "0";
|
|
4899
|
+
lineGutter.style.backgroundColor = "#1e1e1e";
|
|
4900
|
+
lineGutter.style.zIndex = "2";
|
|
4901
|
+
lineGutter.style.boxSizing = "border-box";
|
|
4837
4902
|
lineGutter.textContent = gutterLines.join("\n");
|
|
4838
4903
|
pre.style.margin = "0";
|
|
4904
|
+
pre.style.padding = "0 16px 0 0";
|
|
4839
4905
|
pre.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4840
4906
|
pre.style.fontSize = `${fontSize}px`;
|
|
4841
4907
|
pre.style.lineHeight = "1.6";
|
|
@@ -4843,6 +4909,11 @@ var CodePlugin = class {
|
|
|
4843
4909
|
pre.style.wordBreak = "normal";
|
|
4844
4910
|
pre.style.overflowWrap = "normal";
|
|
4845
4911
|
pre.style.flex = "1";
|
|
4912
|
+
code.style.display = "block";
|
|
4913
|
+
code.style.fontFamily = "inherit";
|
|
4914
|
+
code.style.fontSize = "inherit";
|
|
4915
|
+
code.style.lineHeight = "inherit";
|
|
4916
|
+
code.style.whiteSpace = "inherit";
|
|
4846
4917
|
}
|
|
4847
4918
|
const ext = (ctx.metadata.extension || "").replace(".", "");
|
|
4848
4919
|
const renderCodePage = (text) => {
|