overtype 2.2.0 → 2.3.0

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/overtype.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.2.0
2
+ * OverType v2.3.0
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -882,6 +882,20 @@ var solar = {
882
882
  // Lemon Chiffon - active button background
883
883
  placeholder: "#999999"
884
884
  // Gray - placeholder text
885
+ },
886
+ previewColors: {
887
+ text: "#1a1a1a",
888
+ h1: "#1a1a1a",
889
+ h2: "#2a2a2a",
890
+ h3: "#3a3a3a",
891
+ strong: "inherit",
892
+ em: "inherit",
893
+ link: "#0066cc",
894
+ code: "#1a1a1a",
895
+ codeBg: "rgba(135, 131, 120, 0.15)",
896
+ blockquote: "#555",
897
+ hr: "#ddd",
898
+ bg: "transparent"
885
899
  }
886
900
  };
887
901
  var cave = {
@@ -948,6 +962,20 @@ var cave = {
948
962
  // Even lighter - active button background
949
963
  placeholder: "#6a7a88"
950
964
  // Muted blue-gray - placeholder text
965
+ },
966
+ previewColors: {
967
+ text: "#c5dde8",
968
+ h1: "#e0e0e0",
969
+ h2: "#d0d0d0",
970
+ h3: "#c0c0c0",
971
+ strong: "inherit",
972
+ em: "inherit",
973
+ link: "#6cb6e0",
974
+ code: "#c5dde8",
975
+ codeBg: "rgba(255, 255, 255, 0.08)",
976
+ blockquote: "#9aa8b4",
977
+ hr: "rgba(255, 255, 255, 0.15)",
978
+ bg: "transparent"
951
979
  }
952
980
  };
953
981
  var themes = {
@@ -971,20 +999,30 @@ function resolveAutoTheme(themeName) {
971
999
  const mq = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
972
1000
  return (mq == null ? void 0 : mq.matches) ? "cave" : "solar";
973
1001
  }
974
- function themeToCSSVars(colors) {
1002
+ function themeToCSSVars(colors, previewColors) {
975
1003
  const vars = [];
976
1004
  for (const [key, value] of Object.entries(colors)) {
977
1005
  const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
978
1006
  vars.push(`--${varName}: ${value};`);
979
1007
  }
1008
+ if (previewColors) {
1009
+ for (const [key, value] of Object.entries(previewColors)) {
1010
+ const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
1011
+ vars.push(`--preview-${varName}: ${value};`);
1012
+ }
1013
+ }
980
1014
  return vars.join("\n");
981
1015
  }
982
- function mergeTheme(baseTheme, customColors = {}) {
1016
+ function mergeTheme(baseTheme, customColors = {}, customPreviewColors = {}) {
983
1017
  return {
984
1018
  ...baseTheme,
985
1019
  colors: {
986
1020
  ...baseTheme.colors,
987
1021
  ...customColors
1022
+ },
1023
+ previewColors: {
1024
+ ...baseTheme.previewColors,
1025
+ ...customPreviewColors
988
1026
  }
989
1027
  };
990
1028
  }
@@ -1011,7 +1049,7 @@ function generateStyles(options = {}) {
1011
1049
  }
1012
1050
  }
1013
1051
  ` : "";
1014
- const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors) : "";
1052
+ const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors, theme.previewColors) : "";
1015
1053
  return `
1016
1054
  /* OverType Editor Styles */
1017
1055
 
@@ -1683,27 +1721,29 @@ function generateStyles(options = {}) {
1683
1721
  }
1684
1722
 
1685
1723
  /* Headers - restore proper sizing in preview mode */
1686
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1687
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1724
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1725
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1688
1726
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1689
1727
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
1690
1728
  font-weight: 600 !important;
1691
1729
  margin: 0 !important;
1692
1730
  display: block !important;
1693
- color: inherit !important; /* Use parent text color */
1694
- line-height: 1 !important; /* Tight line height for headings */
1731
+ line-height: 1 !important;
1695
1732
  }
1696
-
1697
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1698
- font-size: 2em !important;
1733
+
1734
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1735
+ font-size: 2em !important;
1736
+ color: var(--preview-h1, #222) !important;
1699
1737
  }
1700
-
1701
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1702
- font-size: 1.5em !important;
1738
+
1739
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1740
+ font-size: 1.5em !important;
1741
+ color: var(--preview-h2, #333) !important;
1703
1742
  }
1704
-
1705
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1706
- font-size: 1.17em !important;
1743
+
1744
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1745
+ font-size: 1.17em !important;
1746
+ color: var(--preview-h3, #444) !important;
1707
1747
  }
1708
1748
 
1709
1749
  /* Lists - restore list styling in preview mode */
@@ -1753,14 +1793,14 @@ function generateStyles(options = {}) {
1753
1793
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview a {
1754
1794
  pointer-events: auto !important;
1755
1795
  cursor: pointer !important;
1756
- color: var(--link, #0066cc) !important;
1796
+ color: var(--preview-link, #0066cc) !important;
1757
1797
  text-decoration: underline !important;
1758
1798
  }
1759
1799
 
1760
1800
  /* Code blocks - proper pre/code styling in preview mode */
1761
1801
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview pre.code-block {
1762
- background: var(--code-bg, rgba(244, 211, 94, 0.4)) !important;
1763
- color: var(--code, #0d3b66) !important;
1802
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1803
+ color: var(--preview-code, #333) !important;
1764
1804
  padding: 1.2em !important;
1765
1805
  border-radius: 3px !important;
1766
1806
  overflow-x: auto !important;
@@ -1789,7 +1829,8 @@ function generateStyles(options = {}) {
1789
1829
  /* Blockquotes - enhanced styling in preview mode */
1790
1830
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .blockquote {
1791
1831
  display: block !important;
1792
- border-left: 4px solid var(--blockquote, #ddd) !important;
1832
+ border-left: 4px solid var(--preview-blockquote, #666) !important;
1833
+ color: var(--preview-blockquote, #666) !important;
1793
1834
  padding-left: 1em !important;
1794
1835
  margin: 1em 0 !important;
1795
1836
  font-style: italic !important;
@@ -1800,14 +1841,16 @@ function generateStyles(options = {}) {
1800
1841
  font-family: Georgia, 'Times New Roman', serif !important;
1801
1842
  font-size: 16px !important;
1802
1843
  line-height: 1.8 !important;
1803
- color: var(--text, #333) !important; /* Consistent text color */
1844
+ color: var(--preview-text, #333) !important;
1845
+ background: var(--preview-bg, transparent) !important;
1804
1846
  }
1805
1847
 
1806
1848
  /* Inline code in preview mode - keep monospace */
1807
1849
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview code {
1808
1850
  font-family: ${fontFamily} !important;
1809
1851
  font-size: 0.9em !important;
1810
- background: rgba(135, 131, 120, 0.15) !important;
1852
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1853
+ color: var(--preview-code, #333) !important;
1811
1854
  padding: 0.2em 0.4em !important;
1812
1855
  border-radius: 3px !important;
1813
1856
  }
@@ -1815,18 +1858,18 @@ function generateStyles(options = {}) {
1815
1858
  /* Strong and em elements in preview mode */
1816
1859
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview strong {
1817
1860
  font-weight: 700 !important;
1818
- color: inherit !important; /* Use parent text color */
1861
+ color: var(--preview-strong, inherit) !important;
1819
1862
  }
1820
1863
 
1821
1864
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview em {
1822
1865
  font-style: italic !important;
1823
- color: inherit !important; /* Use parent text color */
1866
+ color: var(--preview-em, inherit) !important;
1824
1867
  }
1825
1868
 
1826
1869
  /* HR in preview mode */
1827
1870
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .hr-marker {
1828
1871
  display: block !important;
1829
- border-top: 2px solid var(--hr, #ddd) !important;
1872
+ border-top: 2px solid var(--preview-hr, #ddd) !important;
1830
1873
  text-indent: -9999px !important;
1831
1874
  height: 2px !important;
1832
1875
  }
@@ -5488,7 +5531,7 @@ var _OverType = class _OverType {
5488
5531
  this.container.setAttribute("data-theme", themeName);
5489
5532
  }
5490
5533
  if (themeObj && themeObj.colors) {
5491
- const cssVars = themeToCSSVars(themeObj.colors);
5534
+ const cssVars = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5492
5535
  this.container.style.cssText += cssVars;
5493
5536
  }
5494
5537
  this.updatePreview();
@@ -5500,7 +5543,7 @@ var _OverType = class _OverType {
5500
5543
  const themeObj = getTheme(themeName);
5501
5544
  this.container.setAttribute("data-theme", themeName);
5502
5545
  if (themeObj && themeObj.colors) {
5503
- this.container.style.cssText = themeToCSSVars(themeObj.colors);
5546
+ this.container.style.cssText = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5504
5547
  }
5505
5548
  this.updatePreview();
5506
5549
  }