@milkdown/crepe 7.3.3

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.
Files changed (241) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/lib/apl-p0IPP13W.js +76 -0
  4. package/lib/asciiarmor-lJsBxlJJ.js +34 -0
  5. package/lib/asn1-Q9v1zIy5.js +102 -0
  6. package/lib/asterisk-foNkeTjy.js +273 -0
  7. package/lib/brainfuck-0XqyXpNS.js +35 -0
  8. package/lib/clike-ak6Z6Yhe.js +639 -0
  9. package/lib/clojure-iYO8U8Sg.js +810 -0
  10. package/lib/clsx-7d8NmkQq.js +21 -0
  11. package/lib/cmake-SVzjkxV_.js +28 -0
  12. package/lib/cobol-APHEnAOX.js +74 -0
  13. package/lib/coffeescript-KqQa0SYG.js +182 -0
  14. package/lib/commonlisp-bwqNqR5V.js +79 -0
  15. package/lib/core/crepe.d.ts +21 -0
  16. package/lib/core/crepe.d.ts.map +1 -0
  17. package/lib/core/index.d.ts +3 -0
  18. package/lib/core/index.d.ts.map +1 -0
  19. package/lib/core/slice.d.ts +12 -0
  20. package/lib/core/slice.d.ts.map +1 -0
  21. package/lib/crystal-BViWuDpA.js +217 -0
  22. package/lib/css-KHXHXfXg.js +1572 -0
  23. package/lib/cypher-XpTt4zQ3.js +69 -0
  24. package/lib/d-fLig6yqY.js +139 -0
  25. package/lib/diff-WoKGLpy6.js +18 -0
  26. package/lib/dockerfile-u6f6Vw2s.js +194 -0
  27. package/lib/dtd-SIJRUW6K.js +91 -0
  28. package/lib/dylan-4HCLhpWP.js +238 -0
  29. package/lib/ebnf-h_0lged5.js +77 -0
  30. package/lib/ecl-Lf4FF0lf.js +133 -0
  31. package/lib/eiffel-qlw8KUyf.js +112 -0
  32. package/lib/elm-QRnB3zXs.js +108 -0
  33. package/lib/erlang-fyVKb7eK.js +488 -0
  34. package/lib/factor-BEeN4upY.js +65 -0
  35. package/lib/fcl-lRek3hEb.js +106 -0
  36. package/lib/feature/block-edit/handle/component.d.ts +9 -0
  37. package/lib/feature/block-edit/handle/component.d.ts.map +1 -0
  38. package/lib/feature/block-edit/handle/index.d.ts +12 -0
  39. package/lib/feature/block-edit/handle/index.d.ts.map +1 -0
  40. package/lib/feature/block-edit/index.d.ts +3 -0
  41. package/lib/feature/block-edit/index.d.ts.map +1 -0
  42. package/lib/feature/block-edit/menu/component.d.ts +14 -0
  43. package/lib/feature/block-edit/menu/component.d.ts.map +1 -0
  44. package/lib/feature/block-edit/menu/config.d.ts +21 -0
  45. package/lib/feature/block-edit/menu/config.d.ts.map +1 -0
  46. package/lib/feature/block-edit/menu/icons.d.ts +14 -0
  47. package/lib/feature/block-edit/menu/icons.d.ts.map +1 -0
  48. package/lib/feature/block-edit/menu/index.d.ts +9 -0
  49. package/lib/feature/block-edit/menu/index.d.ts.map +1 -0
  50. package/lib/feature/code-mirror/index.d.ts +3 -0
  51. package/lib/feature/code-mirror/index.d.ts.map +1 -0
  52. package/lib/feature/gap-cursor/index.d.ts +3 -0
  53. package/lib/feature/gap-cursor/index.d.ts.map +1 -0
  54. package/lib/feature/image-block/index.d.ts +3 -0
  55. package/lib/feature/image-block/index.d.ts.map +1 -0
  56. package/lib/feature/index.d.ts +18 -0
  57. package/lib/feature/index.d.ts.map +1 -0
  58. package/lib/feature/link-tooltip/consts.d.ts +5 -0
  59. package/lib/feature/link-tooltip/consts.d.ts.map +1 -0
  60. package/lib/feature/link-tooltip/index.d.ts +3 -0
  61. package/lib/feature/link-tooltip/index.d.ts.map +1 -0
  62. package/lib/feature/list-item/consts.d.ts +2 -0
  63. package/lib/feature/list-item/consts.d.ts.map +1 -0
  64. package/lib/feature/list-item/index.d.ts +3 -0
  65. package/lib/feature/list-item/index.d.ts.map +1 -0
  66. package/lib/feature/placeholder/index.d.ts +10 -0
  67. package/lib/feature/placeholder/index.d.ts.map +1 -0
  68. package/lib/feature/shared.d.ts +3 -0
  69. package/lib/feature/shared.d.ts.map +1 -0
  70. package/lib/feature/toolbar/component.d.ts +13 -0
  71. package/lib/feature/toolbar/component.d.ts.map +1 -0
  72. package/lib/feature/toolbar/consts.d.ts +5 -0
  73. package/lib/feature/toolbar/consts.d.ts.map +1 -0
  74. package/lib/feature/toolbar/index.d.ts +3 -0
  75. package/lib/feature/toolbar/index.d.ts.map +1 -0
  76. package/lib/forth-ua2bRd8T.js +60 -0
  77. package/lib/fortran-WnF7znuN.js +443 -0
  78. package/lib/gas-wowve1o7.js +183 -0
  79. package/lib/gherkin-m7GIChu3.js +34 -0
  80. package/lib/go-th443Dhb.js +158 -0
  81. package/lib/groovy-tR4RiZnc.js +161 -0
  82. package/lib/haskell-jxVBofv5.js +375 -0
  83. package/lib/haxe-kWPI2tq3.js +390 -0
  84. package/lib/hooks-82sqkbtE.js +21 -0
  85. package/lib/http-3GIFWUlG.js +45 -0
  86. package/lib/icons-HYkfuR-O.js +50 -0
  87. package/lib/idl-PvpMZg-l.js +947 -0
  88. package/lib/index-0RbcZMbq.js +8 -0
  89. package/lib/index-4afXjFMY.js +517 -0
  90. package/lib/index-7MeyepDG.js +78 -0
  91. package/lib/index-7QgQq3x3.js +551 -0
  92. package/lib/index-7pgP6qYs.js +107 -0
  93. package/lib/index-8DvtgRVa.js +19511 -0
  94. package/lib/index-8Gg-jEP4.js +288 -0
  95. package/lib/index-8S8qcncB.js +507 -0
  96. package/lib/index-9A_GmGh4.js +1039 -0
  97. package/lib/index-EJJfYLzA.js +928 -0
  98. package/lib/index-Eg39w5kL.js +984 -0
  99. package/lib/index-FIk_7oPb.js +168 -0
  100. package/lib/index-LlbrXb_n.js +368 -0
  101. package/lib/index-MovKtgMG.js +121 -0
  102. package/lib/index-N9GtIS4X.js +64 -0
  103. package/lib/index-Pwn25-kf.js +8 -0
  104. package/lib/index-SdFSDosa.js +1295 -0
  105. package/lib/index-W5Th22-Z.js +1744 -0
  106. package/lib/index-XiXSFLmI.js +20975 -0
  107. package/lib/index-bknOViGv.js +47 -0
  108. package/lib/index-bkuIUPFS.js +275 -0
  109. package/lib/index-jPA8J9Eo.js +8 -0
  110. package/lib/index-lsG76a9s.js +552 -0
  111. package/lib/index-oTRzPo3B.js +146 -0
  112. package/lib/index-rrf6_6DC.js +317 -0
  113. package/lib/index-vJbZIHYF.js +81 -0
  114. package/lib/index-vPRh55CO.js +137 -0
  115. package/lib/index-vxy63hib.js +323 -0
  116. package/lib/index-wn1_LgCS.js +99 -0
  117. package/lib/index-xHADmDT3.js +12 -0
  118. package/lib/index-yt2EpMtv.js +141 -0
  119. package/lib/index.d.ts +4 -0
  120. package/lib/index.d.ts.map +1 -0
  121. package/lib/index.es.js +7 -0
  122. package/lib/javascript-8ZHqHagw.js +758 -0
  123. package/lib/jinja2-vsOFe0qD.js +154 -0
  124. package/lib/julia-dlp_pbN1.js +241 -0
  125. package/lib/livescript-Gf5R-LT6.js +273 -0
  126. package/lib/lua-c5Y_JsBp.js +221 -0
  127. package/lib/mathematica-iiGTGmUs.js +35 -0
  128. package/lib/mbox-ZJh86H8B.js +78 -0
  129. package/lib/meta-tAGyVRPE.js +511 -0
  130. package/lib/mirc-i0qkCa0y.js +73 -0
  131. package/lib/mllike-Dy551fZW.js +275 -0
  132. package/lib/modelica-n6tGqUT9.js +94 -0
  133. package/lib/mscgen-aKSbB7D9.js +104 -0
  134. package/lib/mumps-lNiKA6sp.js +25 -0
  135. package/lib/nginx--YmuCfDj.js +93 -0
  136. package/lib/nsis-zhS8iA09.js +62 -0
  137. package/lib/ntriples-E3jQl3MC.js +79 -0
  138. package/lib/octave-EQvkGIeG.js +144 -0
  139. package/lib/oz-W2cpqFf6.js +152 -0
  140. package/lib/pascal-lCh6ouNZ.js +79 -0
  141. package/lib/perl-PxEQBX0B.js +915 -0
  142. package/lib/pig-Y_bNcrzS.js +56 -0
  143. package/lib/powershell-GaQP-TZr.js +249 -0
  144. package/lib/properties-mbRyn54L.js +26 -0
  145. package/lib/prosemirror-noTDkx-k.js +4 -0
  146. package/lib/protobuf-8CJideyJ.js +49 -0
  147. package/lib/puppet-ABBaChNZ.js +45 -0
  148. package/lib/python-sKdHg3Ka.js +321 -0
  149. package/lib/q-_1yG40Nm.js +89 -0
  150. package/lib/r-Ziz56bHT.js +108 -0
  151. package/lib/rpm-ORjGOHaQ.js +57 -0
  152. package/lib/ruby-jlbYq0dT.js +233 -0
  153. package/lib/sas-2n7xeUuO.js +107 -0
  154. package/lib/schema-tKk3m1fu.js +62 -0
  155. package/lib/scheme-XCs-NPeU.js +126 -0
  156. package/lib/shell-0_1Um7Dq.js +184 -0
  157. package/lib/sieve-7uyJD1x1.js +73 -0
  158. package/lib/simple-mode--HIzBxba.js +95 -0
  159. package/lib/smalltalk-PEFzrlQ-.js +48 -0
  160. package/lib/solr-BLBaHahN.js +41 -0
  161. package/lib/sparql-4F9ZWf1b.js +204 -0
  162. package/lib/spreadsheet-SGSo6blj.js +49 -0
  163. package/lib/sql-tebLBzN0.js +291 -0
  164. package/lib/stex-SFJcFGOO.js +130 -0
  165. package/lib/stylus-rwwWYWFm.js +256 -0
  166. package/lib/swift-eorJ0tCv.js +238 -0
  167. package/lib/tcl-IwXMB8U4.js +82 -0
  168. package/lib/textile-ok2VyjwC.js +299 -0
  169. package/lib/theme/classic/index.d.ts +3 -0
  170. package/lib/theme/classic/index.d.ts.map +1 -0
  171. package/lib/theme/classic-dark/index.d.ts +3 -0
  172. package/lib/theme/classic-dark/index.d.ts.map +1 -0
  173. package/lib/theme/headless/index.d.ts +3 -0
  174. package/lib/theme/headless/index.d.ts.map +1 -0
  175. package/lib/theme/index.d.ts +8 -0
  176. package/lib/theme/index.d.ts.map +1 -0
  177. package/lib/theme/shared.d.ts +3 -0
  178. package/lib/theme/shared.d.ts.map +1 -0
  179. package/lib/tiddlywiki-DLhz8_pc.js +156 -0
  180. package/lib/tiki-DFAqFElY.js +183 -0
  181. package/lib/tippy.esm-MZ2vxByW.js +1813 -0
  182. package/lib/toml-ryxpTZEV.js +49 -0
  183. package/lib/tooltip-plugin-gcwyQdiT.js +119 -0
  184. package/lib/troff-ZzZyvNct.js +36 -0
  185. package/lib/ttcn-6gvkqqpW.js +136 -0
  186. package/lib/ttcn-cfg-oSu-Dq5C.js +98 -0
  187. package/lib/turtle-10ofr5au.js +87 -0
  188. package/lib/use-css-light-dom-EKWZDmbJ.js +82 -0
  189. package/lib/utils/index.d.ts +4 -0
  190. package/lib/utils/index.d.ts.map +1 -0
  191. package/lib/vb-a6n6fzrD.js +74 -0
  192. package/lib/vbscript-dgvo8jPt.js +324 -0
  193. package/lib/velocity-CBncCrwO.js +97 -0
  194. package/lib/verilog-KlcACt6C.js +271 -0
  195. package/lib/vhdl-NMd7Gf35.js +117 -0
  196. package/lib/webidl-z1UE5DN_.js +160 -0
  197. package/lib/xquery-hDt5jWTp.js +431 -0
  198. package/lib/yacas-ftgh_qwr.js +74 -0
  199. package/lib/yaml-DnNTfjXK.js +53 -0
  200. package/lib/z80-dA1PqWe1.js +62 -0
  201. package/package.json +87 -0
  202. package/src/core/crepe.ts +98 -0
  203. package/src/core/index.ts +4 -0
  204. package/src/core/slice.ts +44 -0
  205. package/src/feature/block-edit/handle/component.ts +68 -0
  206. package/src/feature/block-edit/handle/index.ts +81 -0
  207. package/src/feature/block-edit/index.ts +17 -0
  208. package/src/feature/block-edit/menu/component.ts +210 -0
  209. package/src/feature/block-edit/menu/config.ts +335 -0
  210. package/src/feature/block-edit/menu/icons.ts +171 -0
  211. package/src/feature/block-edit/menu/index.ts +113 -0
  212. package/src/feature/block-edit/style.css +126 -0
  213. package/src/feature/code-mirror/index.ts +60 -0
  214. package/src/feature/code-mirror/style.css +159 -0
  215. package/src/feature/gap-cursor/index.ts +31 -0
  216. package/src/feature/image-block/index.ts +59 -0
  217. package/src/feature/image-block/style.css +215 -0
  218. package/src/feature/index.ts +66 -0
  219. package/src/feature/link-tooltip/consts.ts +47 -0
  220. package/src/feature/link-tooltip/index.ts +22 -0
  221. package/src/feature/link-tooltip/style.css +107 -0
  222. package/src/feature/list-item/consts.ts +15 -0
  223. package/src/feature/list-item/index.ts +30 -0
  224. package/src/feature/list-item/style.css +23 -0
  225. package/src/feature/placeholder/index.ts +87 -0
  226. package/src/feature/placeholder/style.css +9 -0
  227. package/src/feature/shared.ts +4 -0
  228. package/src/feature/toolbar/component.ts +101 -0
  229. package/src/feature/toolbar/consts.ts +26 -0
  230. package/src/feature/toolbar/index.ts +92 -0
  231. package/src/feature/toolbar/style.css +37 -0
  232. package/src/index.ts +5 -0
  233. package/src/theme/classic/index.ts +12 -0
  234. package/src/theme/classic/style.css +192 -0
  235. package/src/theme/classic-dark/index.ts +12 -0
  236. package/src/theme/classic-dark/style.css +197 -0
  237. package/src/theme/headless/index.ts +9 -0
  238. package/src/theme/index.ts +26 -0
  239. package/src/theme/shared.ts +4 -0
  240. package/src/utils/index.ts +12 -0
  241. package/src/vite-env.d.ts +2 -0
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+
3
+ export { CrepeTheme } from './theme'
4
+ export { CrepeFeature } from './feature'
5
+ export * from './core'
@@ -0,0 +1,12 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import prosemirrorView from '@milkdown/prose/view/style/prosemirror.css?inline'
3
+
4
+ import { injectStyle } from '../../core/slice'
5
+ import type { DefineTheme } from '../shared'
6
+ import style from './style.css?inline'
7
+
8
+ export const defineTheme: DefineTheme = (editor) => {
9
+ editor
10
+ .config(injectStyle(prosemirrorView))
11
+ .config(injectStyle(style))
12
+ }
@@ -0,0 +1,192 @@
1
+ .milkdown {
2
+ --crepe-color-background: #FFFDFB;
3
+ --crepe-color-on-background: #1F1B16;
4
+ --crepe-color-surface: #FFF8F4;
5
+ --crepe-color-surface-low: #FFF1E5;
6
+ --crepe-color-on-surface: #201B13;
7
+ --crepe-color-on-surface-variant: #4F4539;
8
+ --crepe-color-outline: #817567;
9
+ --crepe-color-primary: #805610;
10
+ --crepe-color-secondary: #FBDEBC;
11
+ --crepe-color-on-secondary: #271904;
12
+ --crepe-color-inverse: #362F27;
13
+ --crepe-color-on-inverse: #FCEFE2;
14
+ --crepe-color-inline-code: #BA1A1A;
15
+ --crepe-color-error: #BA1A1A;
16
+ --crepe-color-hover: #F9ECDF;
17
+ --crepe-color-selected: #EDE0D4;
18
+ --crepe-color-inline-area: #E4D8CC;
19
+
20
+ --crepe-font-title: Georgia, Cambria, "Times New Roman", Times, serif;
21
+ --crepe-font-default: "Open Sans", Arial, Helvetica, sans-serif;
22
+ --crepe-font-code: Fira Code, Menlo, Monaco, "Courier New", Courier, monospace;
23
+
24
+ --crepe-shadow-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
25
+ --crepe-shadow-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
26
+
27
+ * {
28
+ margin: 0;
29
+ padding: 0;
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ button,
34
+ input {
35
+ border:none;
36
+ background: none;
37
+ box-shadow: none;
38
+ &:focus {
39
+ outline: none;
40
+ }
41
+ }
42
+
43
+ :focus-visible {
44
+ outline: none;
45
+ }
46
+
47
+ font-family: var(--crepe-font-default);
48
+ color: var(--crepe-color-on-background);
49
+ background: var(--crepe-color-background);
50
+
51
+ .ProseMirror-focused {
52
+ outline: none;
53
+ }
54
+
55
+ .ProseMirror {
56
+ padding: 60px 120px;
57
+
58
+ & > * {
59
+ margin: 20px 0 40px;
60
+ }
61
+
62
+ *::selection {
63
+ background: var(--crepe-color-selected);
64
+ }
65
+
66
+ li.ProseMirror-selectednode {
67
+ outline: 10px solid var(--crepe-color-selected);
68
+ }
69
+ li.ProseMirror-selectednode:after {
70
+ all: unset;
71
+ }
72
+
73
+ .ProseMirror-selectednode {
74
+ background: var(--crepe-color-selected);
75
+ outline: 10px solid var(--crepe-color-selected);
76
+ }
77
+
78
+ img {
79
+ vertical-align: bottom;
80
+ max-width: 100%;
81
+
82
+ &.ProseMirror-selectednode {
83
+ background: none;
84
+ outline: 2px solid var(--crepe-color-primary);
85
+ }
86
+ }
87
+
88
+ h1,
89
+ h2,
90
+ h3,
91
+ h4,
92
+ h5,
93
+ h6 {
94
+ font-family: var(--crepe-font-title);
95
+ font-weight: 400;
96
+ }
97
+
98
+ h1 {
99
+ font-size: 42px;
100
+ line-height: 50px;
101
+ }
102
+
103
+ h2 {
104
+ font-size: 36px;
105
+ line-height: 44px;
106
+ }
107
+
108
+ h3 {
109
+ font-size: 32px;
110
+ line-height: 40px;
111
+ }
112
+
113
+ h4 {
114
+ font-size: 28px;
115
+ line-height: 36px;
116
+ }
117
+
118
+ h5 {
119
+ font-size: 24px;
120
+ line-height: 32px;
121
+ }
122
+
123
+ h6 {
124
+ font-size: 18px;
125
+ font-weight: 700;
126
+ line-height: 28px;
127
+ }
128
+
129
+ p {
130
+ font-size: 16px;
131
+ line-height: 24px;
132
+ }
133
+
134
+ code {
135
+ color: var(--crepe-color-inline-code);
136
+ background: color-mix(in srgb, var(--crepe-color-inline-area), transparent 40%);
137
+ padding: 0 10px;
138
+ border-radius: 4px;
139
+ }
140
+
141
+ a {
142
+ color: var(--crepe-color-primary);
143
+ }
144
+
145
+ pre {
146
+ background: color-mix(in srgb, var(--crepe-color-inline-area), transparent 40%);
147
+ padding: 10px;
148
+ border-radius: 4px;
149
+ code {
150
+ padding: 0;
151
+ background: transparent;
152
+ }
153
+ }
154
+
155
+ blockquote {
156
+ position: relative;
157
+ padding-left: 40px;
158
+ &::before {
159
+ content: "";
160
+ width: 4px;
161
+ height: 100%;
162
+ left: 0;
163
+ position: absolute;
164
+ background: var(--crepe-color-selected);
165
+ border-radius: 100px;
166
+ }
167
+
168
+ hr {
169
+ margin-bottom: 16px;
170
+ }
171
+ }
172
+
173
+ hr {
174
+ border: none;
175
+ border-bottom: 1px solid color-mix(in srgb, var(--crepe-color-outline), transparent 80%);
176
+ height: 16px;
177
+ position: relative;
178
+
179
+ &.ProseMirror-selectednode {
180
+ outline: none;
181
+ background: none;
182
+ border-bottom: 1px solid var(--crepe-color-outline);
183
+ }
184
+ }
185
+
186
+ .ProseMirror-gapcursor:after {
187
+ box-sizing: border-box;
188
+ border-top: 1px solid var(--crepe-color-on-background);
189
+ top: -40px;
190
+ }
191
+ }
192
+ }
@@ -0,0 +1,12 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import prosemirrorView from '@milkdown/prose/view/style/prosemirror.css?inline'
3
+
4
+ import { injectStyle } from '../../core/slice'
5
+ import type { DefineTheme } from '../shared'
6
+ import style from './style.css?inline'
7
+
8
+ export const defineTheme: DefineTheme = (editor) => {
9
+ editor
10
+ .config(injectStyle(prosemirrorView))
11
+ .config(injectStyle(style))
12
+ }
@@ -0,0 +1,197 @@
1
+ .milkdown {
2
+ --crepe-color-background: #1F1B16;
3
+ --crepe-color-on-background: #EAE1D9;
4
+ --crepe-color-surface: #18120B;
5
+ --crepe-color-surface-low: #201B13;
6
+ --crepe-color-on-surface: #EDE0D4;
7
+ --crepe-color-on-surface-variant: #D3C4B4;
8
+ --crepe-color-outline: #9C8F80;
9
+ --crepe-color-primary: #F4BD6F;
10
+ --crepe-color-secondary: #56442A;
11
+ --crepe-color-on-secondary: #FBDEBC;
12
+ --crepe-color-inverse: #EDE0D4;
13
+ --crepe-color-on-inverse: #362F27;
14
+ --crepe-color-inline-code: #FFB4AB;
15
+ --crepe-color-error: #FFB4AB;
16
+ --crepe-color-hover: #251F17;
17
+ --crepe-color-selected: #3B342B;
18
+ --crepe-color-inline-area: #3F3830;
19
+
20
+ --crepe-font-title: Georgia, Cambria, "Times New Roman", Times, serif;
21
+ --crepe-font-default: "Open Sans", Arial, Helvetica, sans-serif;
22
+ --crepe-font-code: Fira Code, Menlo, Monaco, "Courier New", Courier, monospace;
23
+
24
+ --crepe-shadow-1: 0px 1px 2px 0px rgba(0, 0, 0, 0.30), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
25
+ --crepe-shadow-2: 0px 1px 2px 0px rgba(0, 0, 0, 0.30), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
26
+
27
+ * {
28
+ margin: 0;
29
+ padding: 0;
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ button,
34
+ input {
35
+ border:none;
36
+ background: none;
37
+ box-shadow: none;
38
+ &:focus {
39
+ outline: none;
40
+ }
41
+ }
42
+
43
+ :focus-visible {
44
+ outline: none;
45
+ }
46
+
47
+ font-family: var(--crepe-font-default);
48
+ color: var(--crepe-color-on-background);
49
+ background: var(--crepe-color-background);
50
+
51
+ input {
52
+ font-family: var(--crepe-font-default);
53
+ color: var(--crepe-color-on-background);
54
+ }
55
+
56
+ .ProseMirror-focused {
57
+ outline: none;
58
+ }
59
+
60
+ .ProseMirror {
61
+ padding: 60px 120px;
62
+
63
+ & > * {
64
+ margin: 20px 0 40px;
65
+ }
66
+
67
+ *::selection {
68
+ background: var(--crepe-color-selected);
69
+ }
70
+
71
+ li.ProseMirror-selectednode {
72
+ outline: 10px solid var(--crepe-color-selected);
73
+ }
74
+ li.ProseMirror-selectednode:after {
75
+ all: unset;
76
+ }
77
+
78
+ .ProseMirror-selectednode {
79
+ background: var(--crepe-color-selected);
80
+ outline: 10px solid var(--crepe-color-selected);
81
+ }
82
+
83
+ img {
84
+ vertical-align: bottom;
85
+ max-width: 100%;
86
+
87
+ &.ProseMirror-selectednode {
88
+ background: none;
89
+ outline: 2px solid var(--crepe-color-primary);
90
+ }
91
+ }
92
+
93
+ h1,
94
+ h2,
95
+ h3,
96
+ h4,
97
+ h5,
98
+ h6 {
99
+ font-family: var(--crepe-font-title);
100
+ font-weight: 400;
101
+ }
102
+
103
+ h1 {
104
+ font-size: 42px;
105
+ line-height: 50px;
106
+ }
107
+
108
+ h2 {
109
+ font-size: 36px;
110
+ line-height: 44px;
111
+ }
112
+
113
+ h3 {
114
+ font-size: 32px;
115
+ line-height: 40px;
116
+ }
117
+
118
+ h4 {
119
+ font-size: 28px;
120
+ line-height: 36px;
121
+ }
122
+
123
+ h5 {
124
+ font-size: 24px;
125
+ line-height: 32px;
126
+ }
127
+
128
+ h6 {
129
+ font-size: 18px;
130
+ font-weight: 700;
131
+ line-height: 28px;
132
+ }
133
+
134
+ p {
135
+ font-size: 16px;
136
+ line-height: 24px;
137
+ }
138
+
139
+ code {
140
+ color: var(--crepe-color-inline-code);
141
+ background: color-mix(in srgb, var(--crepe-color-inline-area), transparent 40%);
142
+ padding: 0 10px;
143
+ border-radius: 4px;
144
+ }
145
+
146
+ a {
147
+ color: var(--crepe-color-primary);
148
+ }
149
+
150
+ pre {
151
+ background: color-mix(in srgb, var(--crepe-color-inline-area), transparent 40%);
152
+ padding: 10px;
153
+ border-radius: 4px;
154
+ code {
155
+ padding: 0;
156
+ background: transparent;
157
+ }
158
+ }
159
+
160
+ blockquote {
161
+ position: relative;
162
+ padding-left: 40px;
163
+ &::before {
164
+ content: "";
165
+ width: 4px;
166
+ height: 100%;
167
+ left: 0;
168
+ position: absolute;
169
+ background: var(--crepe-color-selected);
170
+ border-radius: 100px;
171
+ }
172
+
173
+ hr {
174
+ margin-bottom: 16px;
175
+ }
176
+ }
177
+
178
+ hr {
179
+ border: none;
180
+ border-bottom: 1px solid color-mix(in srgb, var(--crepe-color-outline), transparent 80%);
181
+ height: 16px;
182
+ position: relative;
183
+
184
+ &.ProseMirror-selectednode {
185
+ outline: none;
186
+ background: none;
187
+ border-bottom: 1px solid var(--crepe-color-outline);
188
+ }
189
+ }
190
+
191
+ .ProseMirror-gapcursor:after {
192
+ box-sizing: border-box;
193
+ border-top: 1px solid var(--crepe-color-on-background);
194
+ top: -40px;
195
+ }
196
+ }
197
+ }
@@ -0,0 +1,9 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import prosemirrorView from '@milkdown/prose/view/style/prosemirror.css?inline'
3
+
4
+ import { injectStyle } from '../../core/slice'
5
+ import type { DefineTheme } from '../shared'
6
+
7
+ export const defineTheme: DefineTheme = (editor) => {
8
+ editor.config(injectStyle(prosemirrorView))
9
+ }
@@ -0,0 +1,26 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+
3
+ import type { Editor } from '@milkdown/core'
4
+
5
+ export enum CrepeTheme {
6
+ Headless = 'headless',
7
+ Classic = 'classic',
8
+ ClassicDark = 'classic-dark',
9
+ }
10
+
11
+ export async function loadTheme(theme: CrepeTheme, editor: Editor) {
12
+ switch (theme) {
13
+ case CrepeTheme.Headless: {
14
+ const { defineTheme } = await import('./headless')
15
+ return defineTheme(editor)
16
+ }
17
+ case CrepeTheme.Classic: {
18
+ const { defineTheme } = await import('./classic')
19
+ return defineTheme(editor)
20
+ }
21
+ case CrepeTheme.ClassicDark: {
22
+ const { defineTheme } = await import('./classic-dark')
23
+ return defineTheme(editor)
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,4 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { Editor } from '@milkdown/core'
3
+
4
+ export type DefineTheme = (editor: Editor) => void
@@ -0,0 +1,12 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ import type { Selection } from '@milkdown/prose/state'
3
+
4
+ export function isInCodeBlock(selection: Selection) {
5
+ const type = selection.$from.parent.type
6
+ return type.name === 'code_block'
7
+ }
8
+
9
+ export function isInList(selection: Selection) {
10
+ const type = selection.$from.node(selection.$from.depth - 1)?.type
11
+ return type?.name === 'list_item'
12
+ }
@@ -0,0 +1,2 @@
1
+ /* Copyright 2021, Milkdown by Mirone. */
2
+ /// <reference types="vite/client" />