@files-preview-app/preview-file 1.3.9 → 1.3.10

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/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
- onRotate?: ((...args: any[]) => any) | undefined;
38
- onDestroy?: ((...args: any[]) => any) | undefined;
39
37
  "onPage-change"?: ((...args: any[]) => any) | undefined;
40
38
  "onZoom-change"?: ((...args: any[]) => any) | undefined;
39
+ onRotate?: ((...args: any[]) => any) | undefined;
40
+ onDestroy?: ((...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
- onRotate?: ((...args: any[]) => any) | undefined;
38
- onDestroy?: ((...args: any[]) => any) | undefined;
39
37
  "onPage-change"?: ((...args: any[]) => any) | undefined;
40
38
  "onZoom-change"?: ((...args: any[]) => any) | undefined;
39
+ onRotate?: ((...args: any[]) => any) | undefined;
40
+ onDestroy?: ((...args: any[]) => any) | undefined;
41
41
  }>, {
42
42
  plugins: PreviewPlugin[];
43
43
  options: PreviewViewerOptions;
package/dist/vue.js CHANGED
@@ -4773,6 +4773,36 @@ var CodePlugin = class {
4773
4773
  pre.style.transition = "transform 0.15s ease";
4774
4774
  pre.style.flexShrink = "0";
4775
4775
  } else {
4776
+ if (typeof document !== "undefined" && !document.getElementById("fp-code-syntax-styles")) {
4777
+ const style = document.createElement("style");
4778
+ style.id = "fp-code-syntax-styles";
4779
+ style.textContent = `
4780
+ .fp-code-scroll-wrapper .hljs-keyword { color: #569cd6; font-weight: normal; }
4781
+ .fp-code-scroll-wrapper .hljs-built_in { color: #4ec9b0; }
4782
+ .fp-code-scroll-wrapper .hljs-type { color: #4ec9b0; }
4783
+ .fp-code-scroll-wrapper .hljs-literal { color: #569cd6; }
4784
+ .fp-code-scroll-wrapper .hljs-number { color: #b5cea8; }
4785
+ .fp-code-scroll-wrapper .hljs-regexp { color: #d16969; }
4786
+ .fp-code-scroll-wrapper .hljs-string { color: #ce9178; }
4787
+ .fp-code-scroll-wrapper .hljs-subst { color: #d4d4d4; }
4788
+ .fp-code-scroll-wrapper .hljs-symbol { color: #569cd6; }
4789
+ .fp-code-scroll-wrapper .hljs-class { color: #4ec9b0; }
4790
+ .fp-code-scroll-wrapper .hljs-function { color: #dcdcaa; }
4791
+ .fp-code-scroll-wrapper .hljs-title { color: #dcdcaa; }
4792
+ .fp-code-scroll-wrapper .hljs-params { color: #9cdcfe; }
4793
+ .fp-code-scroll-wrapper .hljs-comment { color: #6a9955; font-style: italic; }
4794
+ .fp-code-scroll-wrapper .hljs-doctag { color: #608b4e; }
4795
+ .fp-code-scroll-wrapper .hljs-meta { color: #9cdcfe; }
4796
+ .fp-code-scroll-wrapper .hljs-section { color: #569cd6; }
4797
+ .fp-code-scroll-wrapper .hljs-tag { color: #569cd6; }
4798
+ .fp-code-scroll-wrapper .hljs-name { color: #569cd6; }
4799
+ .fp-code-scroll-wrapper .hljs-attr { color: #9cdcfe; }
4800
+ .fp-code-scroll-wrapper .hljs-attribute { color: #9cdcfe; }
4801
+ .fp-code-scroll-wrapper .hljs-variable { color: #9cdcfe; }
4802
+ .fp-code-scroll-wrapper .hljs-punctuation { color: #d4d4d4; }
4803
+ `;
4804
+ document.head.appendChild(style);
4805
+ }
4776
4806
  ctx.container.style.backgroundColor = "#1e1e1e";
4777
4807
  ctx.container.style.color = "#d4d4d4";
4778
4808
  scrollWrapper.className = "fp-code-scroll-wrapper";
@@ -4782,9 +4812,13 @@ var CodePlugin = class {
4782
4812
  scrollWrapper.style.height = "max-content";
4783
4813
  scrollWrapper.style.display = "flex";
4784
4814
  scrollWrapper.style.alignItems = "flex-start";
4785
- scrollWrapper.style.padding = "16px";
4815
+ scrollWrapper.style.padding = "16px 16px 16px 0";
4786
4816
  scrollWrapper.style.boxSizing = "border-box";
4787
- const lineCount = fullText.split(/\r?\n/).length || 1;
4817
+ const rawLines = fullText.split(/\r?\n/);
4818
+ if (rawLines.length > 1 && rawLines[rawLines.length - 1] === "") {
4819
+ rawLines.pop();
4820
+ }
4821
+ const lineCount = Math.max(1, rawLines.length);
4788
4822
  const gutterLines = [];
4789
4823
  for (let i = 1; i <= lineCount; i++) {
4790
4824
  gutterLines.push(String(i));
@@ -4792,16 +4826,23 @@ var CodePlugin = class {
4792
4826
  lineGutter.className = "fp-code-gutter";
4793
4827
  lineGutter.style.userSelect = "none";
4794
4828
  lineGutter.style.textAlign = "right";
4795
- lineGutter.style.paddingRight = "16px";
4796
- lineGutter.style.marginRight = "16px";
4829
+ lineGutter.style.padding = "0 16px";
4830
+ lineGutter.style.margin = "0 16px 0 0";
4797
4831
  lineGutter.style.borderRight = "1px solid #333333";
4798
4832
  lineGutter.style.color = "#858585";
4799
4833
  lineGutter.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
4800
4834
  lineGutter.style.fontSize = `${fontSize}px`;
4801
4835
  lineGutter.style.lineHeight = "1.6";
4836
+ lineGutter.style.whiteSpace = "pre";
4802
4837
  lineGutter.style.flexShrink = "0";
4838
+ lineGutter.style.position = "sticky";
4839
+ lineGutter.style.left = "0";
4840
+ lineGutter.style.backgroundColor = "#1e1e1e";
4841
+ lineGutter.style.zIndex = "2";
4842
+ lineGutter.style.boxSizing = "border-box";
4803
4843
  lineGutter.textContent = gutterLines.join("\n");
4804
4844
  pre.style.margin = "0";
4845
+ pre.style.padding = "0 16px 0 0";
4805
4846
  pre.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
4806
4847
  pre.style.fontSize = `${fontSize}px`;
4807
4848
  pre.style.lineHeight = "1.6";
@@ -4809,6 +4850,11 @@ var CodePlugin = class {
4809
4850
  pre.style.wordBreak = "normal";
4810
4851
  pre.style.overflowWrap = "normal";
4811
4852
  pre.style.flex = "1";
4853
+ code.style.display = "block";
4854
+ code.style.fontFamily = "inherit";
4855
+ code.style.fontSize = "inherit";
4856
+ code.style.lineHeight = "inherit";
4857
+ code.style.whiteSpace = "inherit";
4812
4858
  }
4813
4859
  const ext = (ctx.metadata.extension || "").replace(".", "");
4814
4860
  const renderCodePage = (text) => {