overtype 2.2.0 → 2.3.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.2.0
2
+ * OverType v2.3.1
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -879,6 +879,20 @@ var OverTypeEditor = (() => {
879
879
  // Lemon Chiffon - active button background
880
880
  placeholder: "#999999"
881
881
  // Gray - placeholder text
882
+ },
883
+ previewColors: {
884
+ text: "#0d3b66",
885
+ h1: "inherit",
886
+ h2: "inherit",
887
+ h3: "inherit",
888
+ strong: "inherit",
889
+ em: "inherit",
890
+ link: "#0d3b66",
891
+ code: "#0d3b66",
892
+ codeBg: "rgba(244, 211, 94, 0.4)",
893
+ blockquote: "#5a7a9b",
894
+ hr: "#5a7a9b",
895
+ bg: "transparent"
882
896
  }
883
897
  };
884
898
  var cave = {
@@ -945,6 +959,20 @@ var OverTypeEditor = (() => {
945
959
  // Even lighter - active button background
946
960
  placeholder: "#6a7a88"
947
961
  // Muted blue-gray - placeholder text
962
+ },
963
+ previewColors: {
964
+ text: "#c5dde8",
965
+ h1: "inherit",
966
+ h2: "inherit",
967
+ h3: "inherit",
968
+ strong: "inherit",
969
+ em: "inherit",
970
+ link: "#9fcfec",
971
+ code: "#c5dde8",
972
+ codeBg: "#1a232b",
973
+ blockquote: "#9fcfec",
974
+ hr: "#c5dde8",
975
+ bg: "transparent"
948
976
  }
949
977
  };
950
978
  var themes = {
@@ -968,20 +996,30 @@ var OverTypeEditor = (() => {
968
996
  const mq = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
969
997
  return (mq == null ? void 0 : mq.matches) ? "cave" : "solar";
970
998
  }
971
- function themeToCSSVars(colors) {
999
+ function themeToCSSVars(colors, previewColors) {
972
1000
  const vars = [];
973
1001
  for (const [key, value] of Object.entries(colors)) {
974
1002
  const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
975
1003
  vars.push(`--${varName}: ${value};`);
976
1004
  }
1005
+ if (previewColors) {
1006
+ for (const [key, value] of Object.entries(previewColors)) {
1007
+ const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
1008
+ vars.push(`--preview-${varName}-default: ${value};`);
1009
+ }
1010
+ }
977
1011
  return vars.join("\n");
978
1012
  }
979
- function mergeTheme(baseTheme, customColors = {}) {
1013
+ function mergeTheme(baseTheme, customColors = {}, customPreviewColors = {}) {
980
1014
  return {
981
1015
  ...baseTheme,
982
1016
  colors: {
983
1017
  ...baseTheme.colors,
984
1018
  ...customColors
1019
+ },
1020
+ previewColors: {
1021
+ ...baseTheme.previewColors,
1022
+ ...customPreviewColors
985
1023
  }
986
1024
  };
987
1025
  }
@@ -1008,7 +1046,7 @@ var OverTypeEditor = (() => {
1008
1046
  }
1009
1047
  }
1010
1048
  ` : "";
1011
- const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors) : "";
1049
+ const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors, theme.previewColors) : "";
1012
1050
  return `
1013
1051
  /* OverType Editor Styles */
1014
1052
 
@@ -1680,27 +1718,29 @@ var OverTypeEditor = (() => {
1680
1718
  }
1681
1719
 
1682
1720
  /* Headers - restore proper sizing in preview mode */
1683
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1684
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1721
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1722
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1685
1723
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1686
1724
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
1687
1725
  font-weight: 600 !important;
1688
1726
  margin: 0 !important;
1689
1727
  display: block !important;
1690
- color: inherit !important; /* Use parent text color */
1691
- line-height: 1 !important; /* Tight line height for headings */
1728
+ line-height: 1 !important;
1692
1729
  }
1693
-
1694
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1695
- font-size: 2em !important;
1730
+
1731
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1732
+ font-size: 2em !important;
1733
+ color: var(--preview-h1, var(--preview-h1-default)) !important;
1696
1734
  }
1697
-
1698
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1699
- font-size: 1.5em !important;
1735
+
1736
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1737
+ font-size: 1.5em !important;
1738
+ color: var(--preview-h2, var(--preview-h2-default)) !important;
1700
1739
  }
1701
-
1702
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1703
- font-size: 1.17em !important;
1740
+
1741
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1742
+ font-size: 1.17em !important;
1743
+ color: var(--preview-h3, var(--preview-h3-default)) !important;
1704
1744
  }
1705
1745
 
1706
1746
  /* Lists - restore list styling in preview mode */
@@ -1750,14 +1790,14 @@ var OverTypeEditor = (() => {
1750
1790
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview a {
1751
1791
  pointer-events: auto !important;
1752
1792
  cursor: pointer !important;
1753
- color: var(--link, #0066cc) !important;
1793
+ color: var(--preview-link, var(--preview-link-default)) !important;
1754
1794
  text-decoration: underline !important;
1755
1795
  }
1756
1796
 
1757
1797
  /* Code blocks - proper pre/code styling in preview mode */
1758
1798
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview pre.code-block {
1759
- background: var(--code-bg, rgba(244, 211, 94, 0.4)) !important;
1760
- color: var(--code, #0d3b66) !important;
1799
+ background: var(--preview-code-bg, var(--preview-code-bg-default)) !important;
1800
+ color: var(--preview-code, var(--preview-code-default)) !important;
1761
1801
  padding: 1.2em !important;
1762
1802
  border-radius: 3px !important;
1763
1803
  overflow-x: auto !important;
@@ -1786,7 +1826,8 @@ var OverTypeEditor = (() => {
1786
1826
  /* Blockquotes - enhanced styling in preview mode */
1787
1827
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .blockquote {
1788
1828
  display: block !important;
1789
- border-left: 4px solid var(--blockquote, #ddd) !important;
1829
+ border-left: 4px solid var(--preview-blockquote, var(--preview-blockquote-default)) !important;
1830
+ color: var(--preview-blockquote, var(--preview-blockquote-default)) !important;
1790
1831
  padding-left: 1em !important;
1791
1832
  margin: 1em 0 !important;
1792
1833
  font-style: italic !important;
@@ -1797,14 +1838,16 @@ var OverTypeEditor = (() => {
1797
1838
  font-family: Georgia, 'Times New Roman', serif !important;
1798
1839
  font-size: 16px !important;
1799
1840
  line-height: 1.8 !important;
1800
- color: var(--text, #333) !important; /* Consistent text color */
1841
+ color: var(--preview-text, var(--preview-text-default)) !important;
1842
+ background: var(--preview-bg, var(--preview-bg-default)) !important;
1801
1843
  }
1802
1844
 
1803
1845
  /* Inline code in preview mode - keep monospace */
1804
1846
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview code {
1805
1847
  font-family: ${fontFamily} !important;
1806
1848
  font-size: 0.9em !important;
1807
- background: rgba(135, 131, 120, 0.15) !important;
1849
+ background: var(--preview-code-bg, var(--preview-code-bg-default)) !important;
1850
+ color: var(--preview-code, var(--preview-code-default)) !important;
1808
1851
  padding: 0.2em 0.4em !important;
1809
1852
  border-radius: 3px !important;
1810
1853
  }
@@ -1812,18 +1855,18 @@ var OverTypeEditor = (() => {
1812
1855
  /* Strong and em elements in preview mode */
1813
1856
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview strong {
1814
1857
  font-weight: 700 !important;
1815
- color: inherit !important; /* Use parent text color */
1858
+ color: var(--preview-strong, var(--preview-strong-default)) !important;
1816
1859
  }
1817
1860
 
1818
1861
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview em {
1819
1862
  font-style: italic !important;
1820
- color: inherit !important; /* Use parent text color */
1863
+ color: var(--preview-em, var(--preview-em-default)) !important;
1821
1864
  }
1822
1865
 
1823
1866
  /* HR in preview mode */
1824
1867
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .hr-marker {
1825
1868
  display: block !important;
1826
- border-top: 2px solid var(--hr, #ddd) !important;
1869
+ border-top: 2px solid var(--preview-hr, var(--preview-hr-default)) !important;
1827
1870
  text-indent: -9999px !important;
1828
1871
  height: 2px !important;
1829
1872
  }
@@ -5485,7 +5528,7 @@ ${blockSuffix}` : suffix;
5485
5528
  this.container.setAttribute("data-theme", themeName);
5486
5529
  }
5487
5530
  if (themeObj && themeObj.colors) {
5488
- const cssVars = themeToCSSVars(themeObj.colors);
5531
+ const cssVars = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5489
5532
  this.container.style.cssText += cssVars;
5490
5533
  }
5491
5534
  this.updatePreview();
@@ -5497,7 +5540,7 @@ ${blockSuffix}` : suffix;
5497
5540
  const themeObj = getTheme(themeName);
5498
5541
  this.container.setAttribute("data-theme", themeName);
5499
5542
  if (themeObj && themeObj.colors) {
5500
- this.container.style.cssText = themeToCSSVars(themeObj.colors);
5543
+ this.container.style.cssText = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5501
5544
  }
5502
5545
  this.updatePreview();
5503
5546
  }