@usememos/editor 26.10.22 → 26.10.23

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/style.css CHANGED
@@ -727,6 +727,7 @@
727
727
  monospace;
728
728
  --mbe-font-size: 16px;
729
729
  --mbe-line-height: 24px;
730
+ --mbe-leading: calc(var(--mbe-line-height) - var(--mbe-font-size));
730
731
  --mbe-radius: 8px;
731
732
  --mbe-text: light-dark(var(--mbe-text-light, oklch(0.2438 0.0269 95.7226)), var(--mbe-text-dark, oklch(0.9 0.006 255)));
732
733
  --mbe-muted: light-dark(var(--mbe-muted-light, oklch(0.5559 0.0075 97.4233)), var(--mbe-muted-dark, oklch(0.72 0.007 255)));
@@ -739,6 +740,7 @@
739
740
  --mbe-popup-border: light-dark( var(--mbe-popup-border-light, var(--mbe-border-light, oklch(0.8847 0.0069 97.3627))), var(--mbe-popup-border-dark, var(--mbe-border-dark, oklch(0.38 0.01 255))) );
740
741
  --mbe-hover: light-dark(var(--mbe-hover-light, oklch(0.9245 0.0138 92.9892)), var(--mbe-hover-dark, oklch(0.39 0.018 250)));
741
742
  --mbe-danger: light-dark(var(--mbe-danger-light, oklch(0.5 0.12 25)), var(--mbe-danger-dark, oklch(0.64 0.18 24)));
743
+ --mbe-highlight: light-dark(var(--mbe-highlight-light, #facc15), var(--mbe-highlight-dark, #facc15));
742
744
  --mbe-popup-shadow:
743
745
  0 4px 12px light-dark(transparent, rgb(0 0 0 / 0.35)),
744
746
  0 4px 6px -1px light-dark(rgb(0 0 0 / 0.1), transparent),
@@ -751,14 +753,12 @@
751
753
  --mbe-callout-warning: light-dark(var(--mbe-callout-warning-light, oklch(0.55 0.12 75)), var(--mbe-callout-warning-dark, oklch(0.74 0.14 80)));
752
754
  --mbe-callout-caution: light-dark(var(--mbe-callout-caution-light, oklch(0.55 0.2 25)), var(--mbe-callout-caution-dark, oklch(0.68 0.19 25)));
753
755
  }
754
- :where([data-theme=light]) :is(.mbe-root, .mbe-ui),
755
- .mbe-root[data-theme=light],
756
- .mbe-ui[data-theme=light] {
756
+ :where([data-theme=light], .light) :is(.mbe-root, .mbe-ui),
757
+ :is(.mbe-root, .mbe-ui):is([data-theme=light], .light) {
757
758
  color-scheme: light;
758
759
  }
759
- :where([data-theme=dark]) :is(.mbe-root, .mbe-ui),
760
- .mbe-root[data-theme=dark],
761
- .mbe-ui[data-theme=dark] {
760
+ :where([data-theme=dark], .dark) :is(.mbe-root, .mbe-ui),
761
+ :is(.mbe-root, .mbe-ui):is([data-theme=dark], .dark) {
762
762
  color-scheme: dark;
763
763
  }
764
764
  .mbe-root {
@@ -770,22 +770,19 @@
770
770
  }
771
771
  :is(.mbe-root, .mbe-flow) > :is(h1, h2, h3, h4, h5, h6) {
772
772
  font-weight: 600;
773
+ line-height: calc(1em + var(--mbe-leading));
773
774
  }
774
775
  :is(.mbe-root, .mbe-flow) > h1 {
775
- font-size: 24px;
776
- line-height: 32px;
776
+ font-size: calc(var(--mbe-font-size) * 1.5);
777
777
  }
778
778
  :is(.mbe-root, .mbe-flow) > h2 {
779
- font-size: 20px;
780
- line-height: 28px;
779
+ font-size: calc(var(--mbe-font-size) * 1.25);
781
780
  }
782
781
  :is(.mbe-root, .mbe-flow) > h3 {
783
- font-size: 18px;
784
- line-height: 26px;
782
+ font-size: calc(var(--mbe-font-size) * 1.125);
785
783
  }
786
784
  :is(.mbe-root, .mbe-flow) > :is(h4, h5, h6) {
787
- font-size: 16px;
788
- line-height: 24px;
785
+ font-size: var(--mbe-font-size);
789
786
  }
790
787
  :is(.mbe-root, .mbe-flow) > h6 {
791
788
  color: var(--mbe-muted);
@@ -827,7 +824,7 @@
827
824
  background: var(--mbe-block-code-bg);
828
825
  color: var(--mbe-muted);
829
826
  font-size: 0.875em;
830
- line-height: 20px;
827
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
831
828
  }
832
829
  .mbe-root .mbe-footnote-ref {
833
830
  font-size: 0.75em;
@@ -924,8 +921,8 @@
924
921
  padding: 6px 12px 0;
925
922
  }
926
923
  .mbe-root .mbe-code-lang {
927
- font-size: 12px;
928
- line-height: 16px;
924
+ font-size: calc(var(--mbe-font-size) * 0.75);
925
+ line-height: calc(1em + var(--mbe-leading) / 2);
929
926
  font-family: var(--mbe-font);
930
927
  color: var(--mbe-muted);
931
928
  }
@@ -946,8 +943,8 @@
946
943
  }
947
944
  :is(.mbe-root, .mbe-flow) > .mbe-code pre,
948
945
  :is(.mbe-root, .mbe-flow) > pre.mbe-raw {
949
- font-size: 14px;
950
- line-height: 22px;
946
+ font-size: calc(var(--mbe-font-size) * 0.875);
947
+ line-height: calc(1em + var(--mbe-leading));
951
948
  font-family: var(--mbe-mono);
952
949
  }
953
950
  :is(.mbe-root, .mbe-flow) > .mbe-code pre {
@@ -959,6 +956,9 @@
959
956
  border-radius: 0;
960
957
  font: inherit;
961
958
  }
959
+ .mbe-root > .mbe-source {
960
+ font-family: var(--mbe-mono);
961
+ }
962
962
  :is(.mbe-root, .mbe-flow) > pre.mbe-raw {
963
963
  color: var(--mbe-muted);
964
964
  }
@@ -971,8 +971,8 @@
971
971
  background: var(--mbe-block-code-bg);
972
972
  border-radius: var(--mbe-radius);
973
973
  padding: 10px 12px;
974
- font-size: 14px;
975
- line-height: 22px;
974
+ font-size: calc(var(--mbe-font-size) * 0.875);
975
+ line-height: calc(1em + var(--mbe-leading));
976
976
  font-family: var(--mbe-mono);
977
977
  }
978
978
  .mbe-root .mbe-view-html pre code:not(.mbe-flow *) {
@@ -983,18 +983,16 @@
983
983
  }
984
984
  .mbe-root .mbe-view-html :is(h1, h2, h3, h4, h5, h6):not(.mbe-flow *) {
985
985
  font-weight: 600;
986
+ line-height: calc(1em + var(--mbe-leading));
986
987
  }
987
988
  .mbe-root .mbe-view-html h1:not(.mbe-flow *) {
988
- font-size: 24px;
989
- line-height: 32px;
989
+ font-size: calc(var(--mbe-font-size) * 1.5);
990
990
  }
991
991
  .mbe-root .mbe-view-html h2:not(.mbe-flow *) {
992
- font-size: 20px;
993
- line-height: 28px;
992
+ font-size: calc(var(--mbe-font-size) * 1.25);
994
993
  }
995
994
  .mbe-root .mbe-view-html h3:not(.mbe-flow *) {
996
- font-size: 18px;
997
- line-height: 26px;
995
+ font-size: calc(var(--mbe-font-size) * 1.125);
998
996
  }
999
997
  .mbe-root .mbe-view-html h6:not(.mbe-flow *) {
1000
998
  color: var(--mbe-muted);
@@ -1010,8 +1008,8 @@
1010
1008
  }
1011
1009
  .mbe-root .mbe-view-html table:not(.mbe-flow *) {
1012
1010
  border-collapse: collapse;
1013
- font-size: 14px;
1014
- line-height: 20px;
1011
+ font-size: calc(var(--mbe-font-size) * 0.875);
1012
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
1015
1013
  }
1016
1014
  .mbe-root .mbe-view-html :is(th, td):not(.mbe-flow *) {
1017
1015
  border: 1px solid var(--mbe-border);
@@ -1034,7 +1032,7 @@
1034
1032
  background: var(--mbe-block-code-bg);
1035
1033
  }
1036
1034
  .mbe-root .mbe-view-html mark {
1037
- background: color-mix(in oklab, #facc15 40%, transparent);
1035
+ background: color-mix(in oklab, var(--mbe-highlight) 40%, transparent);
1038
1036
  color: inherit;
1039
1037
  }
1040
1038
  :is(.mbe-root, .mbe-flow) > .mbe-divider hr {
@@ -1042,8 +1040,8 @@
1042
1040
  border-top: 1px solid var(--mbe-border);
1043
1041
  }
1044
1042
  :is(.mbe-root, .mbe-flow) > .mbe-table table {
1045
- font-size: 14px;
1046
- line-height: 20px;
1043
+ font-size: calc(var(--mbe-font-size) * 0.875);
1044
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
1047
1045
  border: 1px solid var(--mbe-border);
1048
1046
  border-radius: var(--mbe-radius);
1049
1047
  }
package/dist/theme.css CHANGED
@@ -3,10 +3,13 @@
3
3
  * so a document looks the same while editing and when read-only.
4
4
  * Needs base.css, which holds the layout and all spacing between blocks.
5
5
  * Every color, font and size is a custom property; the theme option's
6
- * tokens set them (see theme.ts), or set them on the root in CSS.
7
- * Light and dark follow prefers-color-scheme; set data-theme="light" or
8
- * data-theme="dark" on the root or an ancestor, or the theme option's
9
- * colorScheme, to force one.
6
+ * tokens set them (see theme.ts). In CSS, set --mbe-<name>-light and
7
+ * --mbe-<name>-dark on the root or any ancestor (:root works): the rules
8
+ * below read them with the default palette as fallback.
9
+ * Light and dark follow prefers-color-scheme; data-theme="light" or
10
+ * data-theme="dark", or a `light` or `dark` class (the Tailwind and shadcn
11
+ * convention), on the root or an ancestor forces one, as does the theme
12
+ * option's colorScheme.
10
13
  */
11
14
  .mbe-root,
12
15
  .mbe-ui {
@@ -16,6 +19,10 @@
16
19
  --mbe-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
17
20
  --mbe-font-size: 16px;
18
21
  --mbe-line-height: 24px;
22
+ /* The room a line has around its text. Headings, code and tables size
23
+ their text from --mbe-font-size and add this leading to their lines,
24
+ so the rhythm an app sets for the body carries to them. */
25
+ --mbe-leading: calc(var(--mbe-line-height) - var(--mbe-font-size));
19
26
  --mbe-radius: 8px;
20
27
  /* Colors: light-dark() picks by the element's color-scheme. The theme
21
28
  option's tokens set --mbe-<name>-light and --mbe-<name>-dark. */
@@ -36,6 +43,8 @@
36
43
  );
37
44
  --mbe-hover: light-dark(var(--mbe-hover-light, oklch(0.9245 0.0138 92.9892)), var(--mbe-hover-dark, oklch(0.39 0.018 250)));
38
45
  --mbe-danger: light-dark(var(--mbe-danger-light, oklch(0.5 0.12 25)), var(--mbe-danger-dark, oklch(0.64 0.18 24)));
46
+ /* Behind <mark> in rendered HTML, as a tint. */
47
+ --mbe-highlight: light-dark(var(--mbe-highlight-light, #facc15), var(--mbe-highlight-dark, #facc15));
39
48
  /* Two soft shadows in light, one darker and wider in dark. */
40
49
  --mbe-popup-shadow: 0 4px 12px light-dark(transparent, rgb(0 0 0 / 0.35)), 0 4px 6px -1px light-dark(rgb(0 0 0 / 0.1), transparent),
41
50
  0 2px 4px -2px light-dark(rgb(0 0 0 / 0.1), transparent);
@@ -48,14 +57,12 @@
48
57
  --mbe-callout-warning: light-dark(var(--mbe-callout-warning-light, oklch(0.55 0.12 75)), var(--mbe-callout-warning-dark, oklch(0.74 0.14 80)));
49
58
  --mbe-callout-caution: light-dark(var(--mbe-callout-caution-light, oklch(0.55 0.2 25)), var(--mbe-callout-caution-dark, oklch(0.68 0.19 25)));
50
59
  }
51
- :where([data-theme='light']) :is(.mbe-root, .mbe-ui),
52
- .mbe-root[data-theme='light'],
53
- .mbe-ui[data-theme='light'] {
60
+ :where([data-theme='light'], .light) :is(.mbe-root, .mbe-ui),
61
+ :is(.mbe-root, .mbe-ui):is([data-theme='light'], .light) {
54
62
  color-scheme: light;
55
63
  }
56
- :where([data-theme='dark']) :is(.mbe-root, .mbe-ui),
57
- .mbe-root[data-theme='dark'],
58
- .mbe-ui[data-theme='dark'] {
64
+ :where([data-theme='dark'], .dark) :is(.mbe-root, .mbe-ui),
65
+ :is(.mbe-root, .mbe-ui):is([data-theme='dark'], .dark) {
59
66
  color-scheme: dark;
60
67
  }
61
68
 
@@ -70,12 +77,12 @@
70
77
  background: var(--mbe-bg);
71
78
  }
72
79
 
73
- /* Headings: close to the body size. */
74
- :is(.mbe-root, .mbe-flow) > :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; }
75
- :is(.mbe-root, .mbe-flow) > h1 { font-size: 24px; line-height: 32px; }
76
- :is(.mbe-root, .mbe-flow) > h2 { font-size: 20px; line-height: 28px; }
77
- :is(.mbe-root, .mbe-flow) > h3 { font-size: 18px; line-height: 26px; }
78
- :is(.mbe-root, .mbe-flow) > :is(h4, h5, h6) { font-size: 16px; line-height: 24px; }
80
+ /* Headings: close to the body size (24, 20, 18 and 16px at the defaults), each with the body's leading. */
81
+ :is(.mbe-root, .mbe-flow) > :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; line-height: calc(1em + var(--mbe-leading)); }
82
+ :is(.mbe-root, .mbe-flow) > h1 { font-size: calc(var(--mbe-font-size) * 1.5); }
83
+ :is(.mbe-root, .mbe-flow) > h2 { font-size: calc(var(--mbe-font-size) * 1.25); }
84
+ :is(.mbe-root, .mbe-flow) > h3 { font-size: calc(var(--mbe-font-size) * 1.125); }
85
+ :is(.mbe-root, .mbe-flow) > :is(h4, h5, h6) { font-size: var(--mbe-font-size); }
79
86
  :is(.mbe-root, .mbe-flow) > h6 { color: var(--mbe-muted); }
80
87
 
81
88
  /* Block selection */
@@ -105,7 +112,7 @@
105
112
  background: var(--mbe-block-code-bg);
106
113
  color: var(--mbe-muted);
107
114
  font-size: 0.875em;
108
- line-height: 20px;
115
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
109
116
  }
110
117
  /* Footnotes, rendered: a reference is a small raised label, a definition a small muted note. */
111
118
  .mbe-root .mbe-footnote-ref { font-size: 0.75em; line-height: 0; color: var(--mbe-link); }
@@ -168,17 +175,30 @@
168
175
  overflow: hidden;
169
176
  }
170
177
  .mbe-root .mbe-code-bar { padding: 6px 12px 0; }
171
- /* Sizes and family apart: a font token of `inherit` leaves the family to inherit, without dropping the size. */
172
- .mbe-root .mbe-code-lang { font-size: 12px; line-height: 16px; font-family: var(--mbe-font); color: var(--mbe-muted); }
178
+ /* Sizes and family apart: a font token of `inherit` leaves the family to inherit, without dropping the size. 12px on 16px lines at the defaults. */
179
+ .mbe-root .mbe-code-lang {
180
+ font-size: calc(var(--mbe-font-size) * 0.75);
181
+ line-height: calc(1em + var(--mbe-leading) / 2);
182
+ font-family: var(--mbe-font);
183
+ color: var(--mbe-muted);
184
+ }
173
185
  .mbe-root .mbe-code-lang::placeholder { color: var(--mbe-muted); opacity: 1; }
174
186
  .mbe-root .mbe-code-copy { color: var(--mbe-muted); border-radius: 4px; }
175
187
  .mbe-root .mbe-code-copy:hover { color: var(--mbe-text); background: var(--mbe-hover); }
176
188
  .mbe-root .mbe-code-copy.mbe-copied { color: var(--mbe-accent); }
177
- /* Block source text: code blocks and raw blocks. */
189
+ /* Block source text: code blocks and raw blocks. 14px on 22px lines at the defaults. */
178
190
  :is(.mbe-root, .mbe-flow) > .mbe-code pre,
179
- :is(.mbe-root, .mbe-flow) > pre.mbe-raw { font-size: 14px; line-height: 22px; font-family: var(--mbe-mono); }
191
+ :is(.mbe-root, .mbe-flow) > pre.mbe-raw {
192
+ font-size: calc(var(--mbe-font-size) * 0.875);
193
+ line-height: calc(1em + var(--mbe-leading));
194
+ font-family: var(--mbe-mono);
195
+ }
180
196
  :is(.mbe-root, .mbe-flow) > .mbe-code pre { padding: 2px 12px 10px; }
181
197
  :is(.mbe-root, .mbe-flow) > .mbe-code pre code { background: none; padding: 0; border-radius: 0; font: inherit; }
198
+ /* Source mode: the whole document as Markdown text, in the mono font at the
199
+ body's size and line height, so markers and indentation line up and a
200
+ switch keeps the text's rhythm. */
201
+ .mbe-root > .mbe-source { font-family: var(--mbe-mono); }
182
202
 
183
203
  /* Raw blocks: Markdown kept as source (HTML, structure the editor cannot hold, extension syntax) */
184
204
  :is(.mbe-root, .mbe-flow) > pre.mbe-raw { color: var(--mbe-muted); }
@@ -193,19 +213,23 @@
193
213
  background: var(--mbe-block-code-bg);
194
214
  border-radius: var(--mbe-radius);
195
215
  padding: 10px 12px;
196
- font-size: 14px;
197
- line-height: 22px;
216
+ font-size: calc(var(--mbe-font-size) * 0.875);
217
+ line-height: calc(1em + var(--mbe-leading));
198
218
  font-family: var(--mbe-mono);
199
219
  }
200
220
  .mbe-root .mbe-view-html pre code:not(.mbe-flow *) { background: none; padding: 0; border-radius: 0; font: inherit; }
201
- .mbe-root .mbe-view-html :is(h1, h2, h3, h4, h5, h6):not(.mbe-flow *) { font-weight: 600; }
202
- .mbe-root .mbe-view-html h1:not(.mbe-flow *) { font-size: 24px; line-height: 32px; }
203
- .mbe-root .mbe-view-html h2:not(.mbe-flow *) { font-size: 20px; line-height: 28px; }
204
- .mbe-root .mbe-view-html h3:not(.mbe-flow *) { font-size: 18px; line-height: 26px; }
221
+ .mbe-root .mbe-view-html :is(h1, h2, h3, h4, h5, h6):not(.mbe-flow *) { font-weight: 600; line-height: calc(1em + var(--mbe-leading)); }
222
+ .mbe-root .mbe-view-html h1:not(.mbe-flow *) { font-size: calc(var(--mbe-font-size) * 1.5); }
223
+ .mbe-root .mbe-view-html h2:not(.mbe-flow *) { font-size: calc(var(--mbe-font-size) * 1.25); }
224
+ .mbe-root .mbe-view-html h3:not(.mbe-flow *) { font-size: calc(var(--mbe-font-size) * 1.125); }
205
225
  .mbe-root .mbe-view-html h6:not(.mbe-flow *) { color: var(--mbe-muted); }
206
226
  .mbe-root .mbe-view-html hr:not(.mbe-flow *) { border: none; border-top: 1px solid var(--mbe-border); }
207
227
  .mbe-root .mbe-view-html a:not(.mbe-link) { color: var(--mbe-link); text-decoration: underline; text-underline-offset: 2px; }
208
- .mbe-root .mbe-view-html table:not(.mbe-flow *) { border-collapse: collapse; font-size: 14px; line-height: 20px; }
228
+ .mbe-root .mbe-view-html table:not(.mbe-flow *) {
229
+ border-collapse: collapse;
230
+ font-size: calc(var(--mbe-font-size) * 0.875);
231
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
232
+ }
209
233
  .mbe-root .mbe-view-html :is(th, td):not(.mbe-flow *) { border: 1px solid var(--mbe-border); padding: 6px 10px; text-align: start; vertical-align: top; }
210
234
  .mbe-root .mbe-view-html th:not(.mbe-flow *) { font-weight: 500; background: var(--mbe-block-code-bg); }
211
235
  .mbe-root .mbe-view-html kbd {
@@ -218,16 +242,17 @@
218
242
  border-radius: 4px;
219
243
  background: var(--mbe-block-code-bg);
220
244
  }
221
- .mbe-root .mbe-view-html mark { background: color-mix(in oklab, #facc15 40%, transparent); color: inherit; }
245
+ .mbe-root .mbe-view-html mark { background: color-mix(in oklab, var(--mbe-highlight) 40%, transparent); color: inherit; }
222
246
 
223
247
  /* Divider */
224
248
  :is(.mbe-root, .mbe-flow) > .mbe-divider hr { border: none; border-top: 1px solid var(--mbe-border); }
225
249
 
226
250
  /* Table: a light grid around every cell and a shaded header row, as in
227
- Notion and Outline. Separate borders, so the outer corners can be round. */
251
+ Notion and Outline. Separate borders, so the outer corners can be round.
252
+ 14px on 20px lines at the defaults: tighter rows than the body. */
228
253
  :is(.mbe-root, .mbe-flow) > .mbe-table table {
229
- font-size: 14px;
230
- line-height: 20px;
254
+ font-size: calc(var(--mbe-font-size) * 0.875);
255
+ line-height: calc(1em + var(--mbe-leading) * 0.75);
231
256
  border: 1px solid var(--mbe-border);
232
257
  border-radius: var(--mbe-radius);
233
258
  }
@@ -13,7 +13,7 @@ export type { MarkdownOptions } from './markdown/options.js';
13
13
  export { docToHtml } from './clipboard/toHtml.js';
14
14
  export { htmlToDoc } from './clipboard/fromHtml.js';
15
15
  export type { BlockView, CodeDecorationContext, Extension, ExtensionContext, KeyHandler, SyntaxView } from './extension.js';
16
- export type { ColorScheme, Theme, ThemeClasses, ThemeColors, ThemeTokens } from './theme.js';
16
+ export { shadcnTheme, type ColorScheme, type Theme, type ThemeClasses, type ThemeColors, type ThemeTokens } from './theme.js';
17
17
  export { defaultKeymap } from './extensions/keymap.js';
18
18
  export { math, type MathOptions } from './extensions/math.js';
19
19
  export { footnotes, type FootnotesOptions } from './extensions/footnotes.js';
@@ -54,6 +54,8 @@ export interface ThemeColors {
54
54
  /** Highlighted menu items and toolbar buttons. */
55
55
  readonly hover?: string;
56
56
  readonly danger?: string;
57
+ /** Behind `<mark>` in rendered HTML, as a tint. */
58
+ readonly highlight?: string;
57
59
  /** The icon of each callout type, and a light tint of it behind the text. */
58
60
  readonly calloutNote?: string;
59
61
  readonly calloutTip?: string;
@@ -63,9 +65,14 @@ export interface ThemeColors {
63
65
  }
64
66
  /** Values written as --mbe-* custom properties on the root and on popups. Numbers are pixels. */
65
67
  export interface ThemeTokens {
66
- /** Colors in the light scheme. Missing values keep the default. */
68
+ /**
69
+ * Colors in both schemes, for values that pick their own, such as
70
+ * `var(--primary)`. `light` and `dark` override them per scheme.
71
+ */
72
+ readonly colors?: ThemeColors;
73
+ /** Colors in the light scheme. Missing values keep `colors`, then the default. */
67
74
  readonly light?: ThemeColors;
68
- /** Colors in the dark scheme. Missing values keep the default dark palette. */
75
+ /** Colors in the dark scheme. Missing values keep `colors`, then the default dark palette. */
69
76
  readonly dark?: ThemeColors;
70
77
  readonly font?: string;
71
78
  readonly mono?: string;
@@ -76,8 +83,9 @@ export interface ThemeTokens {
76
83
  }
77
84
  /**
78
85
  * `auto` follows `prefers-color-scheme`, or `data-theme="light"` or
79
- * `data-theme="dark"` on the root or an ancestor. `inherit` follows the
80
- * page's `color-scheme`, for apps that switch it themselves.
86
+ * `data-theme="dark"`, or a `light` or `dark` class, on the root or an
87
+ * ancestor. `inherit` follows the page's `color-scheme`, for apps that
88
+ * switch it themselves.
81
89
  */
82
90
  export type ColorScheme = 'auto' | 'light' | 'dark' | 'inherit';
83
91
  export interface Theme {
@@ -86,12 +94,20 @@ export interface Theme {
86
94
  /** Default `auto`. */
87
95
  readonly colorScheme?: ColorScheme;
88
96
  }
97
+ /**
98
+ * The editor in an app styled with shadcn/ui: colors, font and radius from
99
+ * shadcn's CSS variables (`--foreground`, `--primary`, `--radius`, …), so the
100
+ * editor follows the app's theme, and light or dark from the `dark` class.
101
+ * Spread it to change a part: `{ tokens: { ...shadcnTheme.tokens, radius: 4 } }`.
102
+ */
103
+ export declare const shadcnTheme: Theme;
89
104
  /** Merges class maps; a later map wins for the same key, and `heading` and `token` merge per entry. */
90
105
  export declare function mergeClasses(maps: readonly (ThemeClasses | undefined)[]): ThemeClasses;
91
106
  /** The token properties that change how text measures: a view that laid out text (a diagram) renders again when one changes. */
92
107
  export declare const FONT_PROPERTIES: readonly string[];
93
108
  /**
94
109
  * The custom properties for `tokens`. Colors go in `--mbe-<name>-light` and
95
- * `--mbe-<name>-dark`, which the stylesheet picks between with `light-dark()`.
110
+ * `--mbe-<name>-dark`, which the stylesheet picks between with `light-dark()`;
111
+ * `colors` fills both, and `light` and `dark` win per scheme.
96
112
  */
97
113
  export declare function tokenProperties(tokens: ThemeTokens | undefined): Map<string, string>;
@@ -82,8 +82,9 @@ export declare function splitHtmlSpans(inline: Inline): Inline;
82
82
  /**
83
83
  * Runs of inline raw HTML that render as one piece: an opening tag through
84
84
  * its closing tag, with the text between (`<kbd>Ctrl</kbd>`), or a single tag
85
- * (`<br>`, an unmatched tag, a comment). Runs that would cross a link are
86
- * left out. Offsets are into the container's text.
85
+ * (`<br>`, an unmatched tag, a comment). A run may cross a link, as the tags
86
+ * pass through other renderers verbatim and the browser pairs them. Offsets
87
+ * are into the container's text.
87
88
  */
88
89
  export declare function htmlRuns(inline: Inline): {
89
90
  from: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usememos/editor",
3
- "version": "26.10.22",
3
+ "version": "26.10.23",
4
4
  "description": "A block editor for Markdown. Zero runtime dependencies, with an optional React component.",
5
5
  "keywords": [
6
6
  "markdown",