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.
@@ -3,6 +3,21 @@
3
3
  // Definitions generated from themes.js and styles.js
4
4
  // DO NOT EDIT MANUALLY - Run 'npm run generate:types' to regenerate
5
5
 
6
+ export interface PreviewColors {
7
+ bg?: string;
8
+ blockquote?: string;
9
+ code?: string;
10
+ codeBg?: string;
11
+ em?: string;
12
+ h1?: string;
13
+ h2?: string;
14
+ h3?: string;
15
+ hr?: string;
16
+ link?: string;
17
+ strong?: string;
18
+ text?: string;
19
+ }
20
+
6
21
  export interface Theme {
7
22
  name: string;
8
23
  colors: {
@@ -38,6 +53,7 @@ export interface Theme {
38
53
  toolbarHover?: string;
39
54
  toolbarIcon?: string;
40
55
  };
56
+ previewColors?: PreviewColors;
41
57
  }
42
58
 
43
59
  export interface Stats {
@@ -110,6 +126,7 @@ export interface Options {
110
126
  // Theme (deprecated in favor of global theme)
111
127
  theme?: string | Theme;
112
128
  colors?: Partial<Theme['colors']>;
129
+ previewColors?: PreviewColors;
113
130
 
114
131
  // File upload
115
132
  fileUpload?: {
@@ -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
@@ -856,6 +856,20 @@ var solar = {
856
856
  // Lemon Chiffon - active button background
857
857
  placeholder: "#999999"
858
858
  // Gray - placeholder text
859
+ },
860
+ previewColors: {
861
+ text: "#1a1a1a",
862
+ h1: "#1a1a1a",
863
+ h2: "#2a2a2a",
864
+ h3: "#3a3a3a",
865
+ strong: "inherit",
866
+ em: "inherit",
867
+ link: "#0066cc",
868
+ code: "#1a1a1a",
869
+ codeBg: "rgba(135, 131, 120, 0.15)",
870
+ blockquote: "#555",
871
+ hr: "#ddd",
872
+ bg: "transparent"
859
873
  }
860
874
  };
861
875
  var cave = {
@@ -922,6 +936,20 @@ var cave = {
922
936
  // Even lighter - active button background
923
937
  placeholder: "#6a7a88"
924
938
  // Muted blue-gray - placeholder text
939
+ },
940
+ previewColors: {
941
+ text: "#c5dde8",
942
+ h1: "#e0e0e0",
943
+ h2: "#d0d0d0",
944
+ h3: "#c0c0c0",
945
+ strong: "inherit",
946
+ em: "inherit",
947
+ link: "#6cb6e0",
948
+ code: "#c5dde8",
949
+ codeBg: "rgba(255, 255, 255, 0.08)",
950
+ blockquote: "#9aa8b4",
951
+ hr: "rgba(255, 255, 255, 0.15)",
952
+ bg: "transparent"
925
953
  }
926
954
  };
927
955
  var themes = {
@@ -945,20 +973,30 @@ function resolveAutoTheme(themeName) {
945
973
  const mq = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
946
974
  return (mq == null ? void 0 : mq.matches) ? "cave" : "solar";
947
975
  }
948
- function themeToCSSVars(colors) {
976
+ function themeToCSSVars(colors, previewColors) {
949
977
  const vars = [];
950
978
  for (const [key, value] of Object.entries(colors)) {
951
979
  const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
952
980
  vars.push(`--${varName}: ${value};`);
953
981
  }
982
+ if (previewColors) {
983
+ for (const [key, value] of Object.entries(previewColors)) {
984
+ const varName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
985
+ vars.push(`--preview-${varName}: ${value};`);
986
+ }
987
+ }
954
988
  return vars.join("\n");
955
989
  }
956
- function mergeTheme(baseTheme, customColors = {}) {
990
+ function mergeTheme(baseTheme, customColors = {}, customPreviewColors = {}) {
957
991
  return {
958
992
  ...baseTheme,
959
993
  colors: {
960
994
  ...baseTheme.colors,
961
995
  ...customColors
996
+ },
997
+ previewColors: {
998
+ ...baseTheme.previewColors,
999
+ ...customPreviewColors
962
1000
  }
963
1001
  };
964
1002
  }
@@ -985,7 +1023,7 @@ function generateStyles(options = {}) {
985
1023
  }
986
1024
  }
987
1025
  ` : "";
988
- const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors) : "";
1026
+ const themeVars = theme && theme.colors ? themeToCSSVars(theme.colors, theme.previewColors) : "";
989
1027
  return `
990
1028
  /* OverType Editor Styles */
991
1029
 
@@ -1657,27 +1695,29 @@ function generateStyles(options = {}) {
1657
1695
  }
1658
1696
 
1659
1697
  /* Headers - restore proper sizing in preview mode */
1660
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1661
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1698
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1,
1699
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2,
1662
1700
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1663
1701
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
1664
1702
  font-weight: 600 !important;
1665
1703
  margin: 0 !important;
1666
1704
  display: block !important;
1667
- color: inherit !important; /* Use parent text color */
1668
- line-height: 1 !important; /* Tight line height for headings */
1705
+ line-height: 1 !important;
1669
1706
  }
1670
-
1671
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1672
- font-size: 2em !important;
1707
+
1708
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h1 {
1709
+ font-size: 2em !important;
1710
+ color: var(--preview-h1, #222) !important;
1673
1711
  }
1674
-
1675
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1676
- font-size: 1.5em !important;
1712
+
1713
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h2 {
1714
+ font-size: 1.5em !important;
1715
+ color: var(--preview-h2, #333) !important;
1677
1716
  }
1678
-
1679
- .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1680
- font-size: 1.17em !important;
1717
+
1718
+ .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview h3 {
1719
+ font-size: 1.17em !important;
1720
+ color: var(--preview-h3, #444) !important;
1681
1721
  }
1682
1722
 
1683
1723
  /* Lists - restore list styling in preview mode */
@@ -1727,14 +1767,14 @@ function generateStyles(options = {}) {
1727
1767
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview a {
1728
1768
  pointer-events: auto !important;
1729
1769
  cursor: pointer !important;
1730
- color: var(--link, #0066cc) !important;
1770
+ color: var(--preview-link, #0066cc) !important;
1731
1771
  text-decoration: underline !important;
1732
1772
  }
1733
1773
 
1734
1774
  /* Code blocks - proper pre/code styling in preview mode */
1735
1775
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview pre.code-block {
1736
- background: var(--code-bg, rgba(244, 211, 94, 0.4)) !important;
1737
- color: var(--code, #0d3b66) !important;
1776
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1777
+ color: var(--preview-code, #333) !important;
1738
1778
  padding: 1.2em !important;
1739
1779
  border-radius: 3px !important;
1740
1780
  overflow-x: auto !important;
@@ -1763,7 +1803,8 @@ function generateStyles(options = {}) {
1763
1803
  /* Blockquotes - enhanced styling in preview mode */
1764
1804
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .blockquote {
1765
1805
  display: block !important;
1766
- border-left: 4px solid var(--blockquote, #ddd) !important;
1806
+ border-left: 4px solid var(--preview-blockquote, #666) !important;
1807
+ color: var(--preview-blockquote, #666) !important;
1767
1808
  padding-left: 1em !important;
1768
1809
  margin: 1em 0 !important;
1769
1810
  font-style: italic !important;
@@ -1774,14 +1815,16 @@ function generateStyles(options = {}) {
1774
1815
  font-family: Georgia, 'Times New Roman', serif !important;
1775
1816
  font-size: 16px !important;
1776
1817
  line-height: 1.8 !important;
1777
- color: var(--text, #333) !important; /* Consistent text color */
1818
+ color: var(--preview-text, #333) !important;
1819
+ background: var(--preview-bg, transparent) !important;
1778
1820
  }
1779
1821
 
1780
1822
  /* Inline code in preview mode - keep monospace */
1781
1823
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview code {
1782
1824
  font-family: ${fontFamily} !important;
1783
1825
  font-size: 0.9em !important;
1784
- background: rgba(135, 131, 120, 0.15) !important;
1826
+ background: var(--preview-code-bg, rgba(135, 131, 120, 0.15)) !important;
1827
+ color: var(--preview-code, #333) !important;
1785
1828
  padding: 0.2em 0.4em !important;
1786
1829
  border-radius: 3px !important;
1787
1830
  }
@@ -1789,18 +1832,18 @@ function generateStyles(options = {}) {
1789
1832
  /* Strong and em elements in preview mode */
1790
1833
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview strong {
1791
1834
  font-weight: 700 !important;
1792
- color: inherit !important; /* Use parent text color */
1835
+ color: var(--preview-strong, inherit) !important;
1793
1836
  }
1794
1837
 
1795
1838
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview em {
1796
1839
  font-style: italic !important;
1797
- color: inherit !important; /* Use parent text color */
1840
+ color: var(--preview-em, inherit) !important;
1798
1841
  }
1799
1842
 
1800
1843
  /* HR in preview mode */
1801
1844
  .overtype-container[data-mode="preview"] .overtype-wrapper .overtype-preview .hr-marker {
1802
1845
  display: block !important;
1803
- border-top: 2px solid var(--hr, #ddd) !important;
1846
+ border-top: 2px solid var(--preview-hr, #ddd) !important;
1804
1847
  text-indent: -9999px !important;
1805
1848
  height: 2px !important;
1806
1849
  }
@@ -5462,7 +5505,7 @@ var _OverType = class _OverType {
5462
5505
  this.container.setAttribute("data-theme", themeName);
5463
5506
  }
5464
5507
  if (themeObj && themeObj.colors) {
5465
- const cssVars = themeToCSSVars(themeObj.colors);
5508
+ const cssVars = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5466
5509
  this.container.style.cssText += cssVars;
5467
5510
  }
5468
5511
  this.updatePreview();
@@ -5474,7 +5517,7 @@ var _OverType = class _OverType {
5474
5517
  const themeObj = getTheme(themeName);
5475
5518
  this.container.setAttribute("data-theme", themeName);
5476
5519
  if (themeObj && themeObj.colors) {
5477
- this.container.style.cssText = themeToCSSVars(themeObj.colors);
5520
+ this.container.style.cssText = themeToCSSVars(themeObj.colors, themeObj.previewColors);
5478
5521
  }
5479
5522
  this.updatePreview();
5480
5523
  }