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