@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.cjs CHANGED
@@ -4807,6 +4807,36 @@ var CodePlugin = class {
4807
4807
  pre.style.transition = "transform 0.15s ease";
4808
4808
  pre.style.flexShrink = "0";
4809
4809
  } else {
4810
+ if (typeof document !== "undefined" && !document.getElementById("fp-code-syntax-styles")) {
4811
+ const style = document.createElement("style");
4812
+ style.id = "fp-code-syntax-styles";
4813
+ style.textContent = `
4814
+ .fp-code-scroll-wrapper .hljs-keyword { color: #569cd6; font-weight: normal; }
4815
+ .fp-code-scroll-wrapper .hljs-built_in { color: #4ec9b0; }
4816
+ .fp-code-scroll-wrapper .hljs-type { color: #4ec9b0; }
4817
+ .fp-code-scroll-wrapper .hljs-literal { color: #569cd6; }
4818
+ .fp-code-scroll-wrapper .hljs-number { color: #b5cea8; }
4819
+ .fp-code-scroll-wrapper .hljs-regexp { color: #d16969; }
4820
+ .fp-code-scroll-wrapper .hljs-string { color: #ce9178; }
4821
+ .fp-code-scroll-wrapper .hljs-subst { color: #d4d4d4; }
4822
+ .fp-code-scroll-wrapper .hljs-symbol { color: #569cd6; }
4823
+ .fp-code-scroll-wrapper .hljs-class { color: #4ec9b0; }
4824
+ .fp-code-scroll-wrapper .hljs-function { color: #dcdcaa; }
4825
+ .fp-code-scroll-wrapper .hljs-title { color: #dcdcaa; }
4826
+ .fp-code-scroll-wrapper .hljs-params { color: #9cdcfe; }
4827
+ .fp-code-scroll-wrapper .hljs-comment { color: #6a9955; font-style: italic; }
4828
+ .fp-code-scroll-wrapper .hljs-doctag { color: #608b4e; }
4829
+ .fp-code-scroll-wrapper .hljs-meta { color: #9cdcfe; }
4830
+ .fp-code-scroll-wrapper .hljs-section { color: #569cd6; }
4831
+ .fp-code-scroll-wrapper .hljs-tag { color: #569cd6; }
4832
+ .fp-code-scroll-wrapper .hljs-name { color: #569cd6; }
4833
+ .fp-code-scroll-wrapper .hljs-attr { color: #9cdcfe; }
4834
+ .fp-code-scroll-wrapper .hljs-attribute { color: #9cdcfe; }
4835
+ .fp-code-scroll-wrapper .hljs-variable { color: #9cdcfe; }
4836
+ .fp-code-scroll-wrapper .hljs-punctuation { color: #d4d4d4; }
4837
+ `;
4838
+ document.head.appendChild(style);
4839
+ }
4810
4840
  ctx.container.style.backgroundColor = "#1e1e1e";
4811
4841
  ctx.container.style.color = "#d4d4d4";
4812
4842
  scrollWrapper.className = "fp-code-scroll-wrapper";
@@ -4816,9 +4846,13 @@ var CodePlugin = class {
4816
4846
  scrollWrapper.style.height = "max-content";
4817
4847
  scrollWrapper.style.display = "flex";
4818
4848
  scrollWrapper.style.alignItems = "flex-start";
4819
- scrollWrapper.style.padding = "16px";
4849
+ scrollWrapper.style.padding = "16px 16px 16px 0";
4820
4850
  scrollWrapper.style.boxSizing = "border-box";
4821
- const lineCount = fullText.split(/\r?\n/).length || 1;
4851
+ const rawLines = fullText.split(/\r?\n/);
4852
+ if (rawLines.length > 1 && rawLines[rawLines.length - 1] === "") {
4853
+ rawLines.pop();
4854
+ }
4855
+ const lineCount = Math.max(1, rawLines.length);
4822
4856
  const gutterLines = [];
4823
4857
  for (let i = 1; i <= lineCount; i++) {
4824
4858
  gutterLines.push(String(i));
@@ -4826,16 +4860,23 @@ var CodePlugin = class {
4826
4860
  lineGutter.className = "fp-code-gutter";
4827
4861
  lineGutter.style.userSelect = "none";
4828
4862
  lineGutter.style.textAlign = "right";
4829
- lineGutter.style.paddingRight = "16px";
4830
- lineGutter.style.marginRight = "16px";
4863
+ lineGutter.style.padding = "0 16px";
4864
+ lineGutter.style.margin = "0 16px 0 0";
4831
4865
  lineGutter.style.borderRight = "1px solid #333333";
4832
4866
  lineGutter.style.color = "#858585";
4833
4867
  lineGutter.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
4834
4868
  lineGutter.style.fontSize = `${fontSize}px`;
4835
4869
  lineGutter.style.lineHeight = "1.6";
4870
+ lineGutter.style.whiteSpace = "pre";
4836
4871
  lineGutter.style.flexShrink = "0";
4872
+ lineGutter.style.position = "sticky";
4873
+ lineGutter.style.left = "0";
4874
+ lineGutter.style.backgroundColor = "#1e1e1e";
4875
+ lineGutter.style.zIndex = "2";
4876
+ lineGutter.style.boxSizing = "border-box";
4837
4877
  lineGutter.textContent = gutterLines.join("\n");
4838
4878
  pre.style.margin = "0";
4879
+ pre.style.padding = "0 16px 0 0";
4839
4880
  pre.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
4840
4881
  pre.style.fontSize = `${fontSize}px`;
4841
4882
  pre.style.lineHeight = "1.6";
@@ -4843,6 +4884,11 @@ var CodePlugin = class {
4843
4884
  pre.style.wordBreak = "normal";
4844
4885
  pre.style.overflowWrap = "normal";
4845
4886
  pre.style.flex = "1";
4887
+ code.style.display = "block";
4888
+ code.style.fontFamily = "inherit";
4889
+ code.style.fontSize = "inherit";
4890
+ code.style.lineHeight = "inherit";
4891
+ code.style.whiteSpace = "inherit";
4846
4892
  }
4847
4893
  const ext = (ctx.metadata.extension || "").replace(".", "");
4848
4894
  const renderCodePage = (text) => {