@difizen/libro-codemirror 0.0.2-alpha.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.
Files changed (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/es/auto-complete/closebrackets.d.ts +12 -0
  4. package/es/auto-complete/closebrackets.d.ts.map +1 -0
  5. package/es/auto-complete/closebrackets.js +408 -0
  6. package/es/auto-complete/completion.d.ts +57 -0
  7. package/es/auto-complete/completion.d.ts.map +1 -0
  8. package/es/auto-complete/completion.js +265 -0
  9. package/es/auto-complete/config.d.ts +22 -0
  10. package/es/auto-complete/config.d.ts.map +1 -0
  11. package/es/auto-complete/config.js +44 -0
  12. package/es/auto-complete/filter.d.ts +13 -0
  13. package/es/auto-complete/filter.d.ts.map +1 -0
  14. package/es/auto-complete/filter.js +191 -0
  15. package/es/auto-complete/index.d.ts +17 -0
  16. package/es/auto-complete/index.d.ts.map +1 -0
  17. package/es/auto-complete/index.js +107 -0
  18. package/es/auto-complete/snippet.d.ts +14 -0
  19. package/es/auto-complete/snippet.d.ts.map +1 -0
  20. package/es/auto-complete/snippet.js +447 -0
  21. package/es/auto-complete/state.d.ts +63 -0
  22. package/es/auto-complete/state.d.ts.map +1 -0
  23. package/es/auto-complete/state.js +452 -0
  24. package/es/auto-complete/theme.d.ts +6 -0
  25. package/es/auto-complete/theme.d.ts.map +1 -0
  26. package/es/auto-complete/theme.js +151 -0
  27. package/es/auto-complete/tooltip.d.ts +5 -0
  28. package/es/auto-complete/tooltip.d.ts.map +1 -0
  29. package/es/auto-complete/tooltip.js +365 -0
  30. package/es/auto-complete/view.d.ts +43 -0
  31. package/es/auto-complete/view.d.ts.map +1 -0
  32. package/es/auto-complete/view.js +372 -0
  33. package/es/auto-complete/word.d.ts +3 -0
  34. package/es/auto-complete/word.d.ts.map +1 -0
  35. package/es/auto-complete/word.js +119 -0
  36. package/es/completion.d.ts +6 -0
  37. package/es/completion.d.ts.map +1 -0
  38. package/es/completion.js +84 -0
  39. package/es/config.d.ts +184 -0
  40. package/es/config.d.ts.map +1 -0
  41. package/es/config.js +473 -0
  42. package/es/editor.d.ts +361 -0
  43. package/es/editor.d.ts.map +1 -0
  44. package/es/editor.js +1126 -0
  45. package/es/factory.d.ts +3 -0
  46. package/es/factory.d.ts.map +1 -0
  47. package/es/factory.js +12 -0
  48. package/es/hyperlink.d.ts +15 -0
  49. package/es/hyperlink.d.ts.map +1 -0
  50. package/es/hyperlink.js +120 -0
  51. package/es/indent.d.ts +8 -0
  52. package/es/indent.d.ts.map +1 -0
  53. package/es/indent.js +58 -0
  54. package/es/indentation-markers/config.d.ts +17 -0
  55. package/es/indentation-markers/config.d.ts.map +1 -0
  56. package/es/indentation-markers/config.js +10 -0
  57. package/es/indentation-markers/index.d.ts +3 -0
  58. package/es/indentation-markers/index.d.ts.map +1 -0
  59. package/es/indentation-markers/index.js +160 -0
  60. package/es/indentation-markers/map.d.ts +77 -0
  61. package/es/indentation-markers/map.d.ts.map +1 -0
  62. package/es/indentation-markers/map.js +265 -0
  63. package/es/indentation-markers/utils.d.ts +27 -0
  64. package/es/indentation-markers/utils.d.ts.map +1 -0
  65. package/es/indentation-markers/utils.js +91 -0
  66. package/es/index.d.ts +11 -0
  67. package/es/index.d.ts.map +1 -0
  68. package/es/index.js +10 -0
  69. package/es/libro-icon.d.ts +3 -0
  70. package/es/libro-icon.d.ts.map +1 -0
  71. package/es/libro-icon.js +2 -0
  72. package/es/mimetype.d.ts +22 -0
  73. package/es/mimetype.d.ts.map +1 -0
  74. package/es/mimetype.js +59 -0
  75. package/es/mode.d.ts +86 -0
  76. package/es/mode.d.ts.map +1 -0
  77. package/es/mode.js +284 -0
  78. package/es/monitor.d.ts +32 -0
  79. package/es/monitor.d.ts.map +1 -0
  80. package/es/monitor.js +129 -0
  81. package/es/python-lang.d.ts +3 -0
  82. package/es/python-lang.d.ts.map +1 -0
  83. package/es/python-lang.js +7 -0
  84. package/es/style/base.css +131 -0
  85. package/es/style/theme.css +12 -0
  86. package/es/style/variables.css +403 -0
  87. package/es/theme.d.ts +35 -0
  88. package/es/theme.d.ts.map +1 -0
  89. package/es/theme.js +225 -0
  90. package/es/tooltip.d.ts +10 -0
  91. package/es/tooltip.d.ts.map +1 -0
  92. package/es/tooltip.js +170 -0
  93. package/package.json +74 -0
  94. package/src/auto-complete/README.md +71 -0
  95. package/src/auto-complete/closebrackets.ts +423 -0
  96. package/src/auto-complete/completion.ts +345 -0
  97. package/src/auto-complete/config.ts +101 -0
  98. package/src/auto-complete/filter.ts +215 -0
  99. package/src/auto-complete/index.ts +112 -0
  100. package/src/auto-complete/snippet.ts +394 -0
  101. package/src/auto-complete/state.ts +472 -0
  102. package/src/auto-complete/theme.ts +126 -0
  103. package/src/auto-complete/tooltip.ts +386 -0
  104. package/src/auto-complete/view.ts +343 -0
  105. package/src/auto-complete/word.ts +118 -0
  106. package/src/completion.ts +61 -0
  107. package/src/config.ts +689 -0
  108. package/src/editor.ts +1078 -0
  109. package/src/factory.ts +10 -0
  110. package/src/hyperlink.ts +95 -0
  111. package/src/indent.ts +69 -0
  112. package/src/indentation-markers/config.ts +31 -0
  113. package/src/indentation-markers/index.ts +192 -0
  114. package/src/indentation-markers/map.ts +273 -0
  115. package/src/indentation-markers/utils.ts +84 -0
  116. package/src/index.ts +11 -0
  117. package/src/libro-icon.ts +4 -0
  118. package/src/mimetype.ts +49 -0
  119. package/src/mode.ts +269 -0
  120. package/src/monitor.ts +105 -0
  121. package/src/python-lang.ts +7 -0
  122. package/src/style/base.css +129 -0
  123. package/src/style/theme.css +12 -0
  124. package/src/style/variables.css +405 -0
  125. package/src/theme.ts +231 -0
  126. package/src/tooltip.ts +145 -0
@@ -0,0 +1,405 @@
1
+ /* stylelint-disable number-max-precision */
2
+
3
+ /*
4
+ The following CSS variables define the main, public API for styling JupyterLab.
5
+ These variables should be used by all plugins wherever possible. In other
6
+ words, plugins should not define custom colors, sizes, etc unless absolutely
7
+ necessary. This enables users to change the visual theme of JupyterLab
8
+ by changing these variables.
9
+
10
+ Many variables appear in an ordered sequence (0,1,2,3). These sequences
11
+ are designed to work well together, so for example, `--jp-border-color1` should
12
+ be used with `--jp-layout-color1`. The numbers have the following meanings:
13
+
14
+ * 0: super-primary, reserved for special emphasis
15
+ * 1: primary, most important under normal situations
16
+ * 2: secondary, next most important under normal situations
17
+ * 3: tertiary, next most important under normal situations
18
+
19
+ Throughout JupyterLab, we are mostly following principles from Google's
20
+ Material Design when selecting colors. We are not, however, following
21
+ all of MD as it is not optimized for dense, information rich UIs.
22
+ */
23
+
24
+ :root {
25
+ /* Elevation
26
+ *
27
+ * We style box-shadows using Material Design's idea of elevation. These particular numbers are taken from here:
28
+ *
29
+ * https://github.com/material-components/material-components-web
30
+ * https://material-components-web.appspot.com/elevation.html
31
+ */
32
+
33
+ --jp-shadow-base-lightness: 0;
34
+ --jp-shadow-umbra-color: rgba(
35
+ var(--jp-shadow-base-lightness),
36
+ var(--jp-shadow-base-lightness),
37
+ var(--jp-shadow-base-lightness),
38
+ 20%
39
+ );
40
+ --jp-shadow-penumbra-color: rgba(
41
+ var(--jp-shadow-base-lightness),
42
+ var(--jp-shadow-base-lightness),
43
+ var(--jp-shadow-base-lightness),
44
+ 14%
45
+ );
46
+ --jp-shadow-ambient-color: rgba(
47
+ var(--jp-shadow-base-lightness),
48
+ var(--jp-shadow-base-lightness),
49
+ var(--jp-shadow-base-lightness),
50
+ 12%
51
+ );
52
+ --jp-elevation-z0: none;
53
+ --jp-elevation-z1: 0 2px 1px -1px var(--jp-shadow-umbra-color),
54
+ 0 1px 1px 0 var(--jp-shadow-penumbra-color),
55
+ 0 1px 3px 0 var(--jp-shadow-ambient-color);
56
+ --jp-elevation-z2: 0 3px 1px -2px var(--jp-shadow-umbra-color),
57
+ 0 2px 2px 0 var(--jp-shadow-penumbra-color),
58
+ 0 1px 5px 0 var(--jp-shadow-ambient-color);
59
+ --jp-elevation-z4: 0 2px 4px -1px var(--jp-shadow-umbra-color),
60
+ 0 4px 5px 0 var(--jp-shadow-penumbra-color),
61
+ 0 1px 10px 0 var(--jp-shadow-ambient-color);
62
+ --jp-elevation-z6: 0 3px 5px -1px var(--jp-shadow-umbra-color),
63
+ 0 6px 10px 0 var(--jp-shadow-penumbra-color),
64
+ 0 1px 18px 0 var(--jp-shadow-ambient-color);
65
+ --jp-elevation-z8: 0 5px 5px -3px var(--jp-shadow-umbra-color),
66
+ 0 8px 10px 1px var(--jp-shadow-penumbra-color),
67
+ 0 3px 14px 2px var(--jp-shadow-ambient-color);
68
+ --jp-elevation-z12: 0 7px 8px -4px var(--jp-shadow-umbra-color),
69
+ 0 12px 17px 2px var(--jp-shadow-penumbra-color),
70
+ 0 5px 22px 4px var(--jp-shadow-ambient-color);
71
+ --jp-elevation-z16: 0 8px 10px -5px var(--jp-shadow-umbra-color),
72
+ 0 16px 24px 2px var(--jp-shadow-penumbra-color),
73
+ 0 6px 30px 5px var(--jp-shadow-ambient-color);
74
+ --jp-elevation-z20: 0 10px 13px -6px var(--jp-shadow-umbra-color),
75
+ 0 20px 31px 3px var(--jp-shadow-penumbra-color),
76
+ 0 8px 38px 7px var(--jp-shadow-ambient-color);
77
+ --jp-elevation-z24: 0 11px 15px -7px var(--jp-shadow-umbra-color),
78
+ 0 24px 38px 3px var(--jp-shadow-penumbra-color),
79
+ 0 9px 46px 8px var(--jp-shadow-ambient-color);
80
+
81
+ /* Borders
82
+ *
83
+ * The following variables, specify the visual styling of borders in JupyterLab.
84
+ */
85
+
86
+ --jp-border-width: 1px;
87
+ --jp-border-color0: var(--md-grey-400);
88
+ --jp-border-color1: var(--md-grey-400);
89
+ --jp-border-color2: var(--md-grey-300);
90
+ --jp-border-color3: var(--md-grey-200);
91
+ --jp-inverse-border-color: var(--md-grey-600);
92
+ --jp-border-radius: 2px;
93
+
94
+ /* UI Fonts
95
+ *
96
+ * The UI font CSS variables are used for the typography all of the JupyterLab
97
+ * user interface elements that are not directly user generated content.
98
+ *
99
+ * The font sizing here is done assuming that the body font size of --jp-ui-font-size1
100
+ * is applied to a parent element. When children elements, such as headings, are sized
101
+ * in em all things will be computed relative to that body size.
102
+ */
103
+
104
+ --jp-ui-font-scale-factor: 1.2;
105
+ --jp-ui-font-size0: 0.83333em;
106
+ --jp-ui-font-size1: 13px; /* Base font size */
107
+ --jp-ui-font-size2: 1.2em;
108
+ --jp-ui-font-size3: 1.44em;
109
+ --jp-ui-font-family: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI',
110
+ helvetica, arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
111
+ 'Segoe UI Symbol';
112
+
113
+ /*
114
+ * Use these font colors against the corresponding main layout colors.
115
+ * In a light theme, these go from dark to light.
116
+ */
117
+
118
+ /* Defaults use Material Design specification */
119
+ --jp-ui-font-color0: rgba(0, 0, 0, 100%);
120
+ --jp-ui-font-color1: rgba(0, 0, 0, 87%);
121
+ --jp-ui-font-color2: rgba(0, 0, 0, 54%);
122
+ --jp-ui-font-color3: rgba(0, 0, 0, 38%);
123
+
124
+ /*
125
+ * Use these against the brand/accent/warn/error colors.
126
+ * These will typically go from light to darker, in both a dark and light theme.
127
+ */
128
+
129
+ --jp-ui-inverse-font-color0: rgba(255, 255, 255, 100%);
130
+ --jp-ui-inverse-font-color1: rgba(255, 255, 255, 100%);
131
+ --jp-ui-inverse-font-color2: rgba(255, 255, 255, 70%);
132
+ --jp-ui-inverse-font-color3: rgba(255, 255, 255, 50%);
133
+
134
+ /* Content Fonts
135
+ *
136
+ * Content font variables are used for typography of user generated content.
137
+ *
138
+ * The font sizing here is done assuming that the body font size of --jp-content-font-size1
139
+ * is applied to a parent element. When children elements, such as headings, are sized
140
+ * in em all things will be computed relative to that body size.
141
+ */
142
+
143
+ --jp-content-line-height: 1.6;
144
+ --jp-content-font-scale-factor: 1.2;
145
+ --jp-content-font-size0: 0.83333em;
146
+ --jp-content-font-size1: 14px; /* Base font size */
147
+ --jp-content-font-size2: 1.2em;
148
+ --jp-content-font-size3: 1.44em;
149
+ --jp-content-font-size4: 1.728em;
150
+ --jp-content-font-size5: 2.0736em;
151
+
152
+ /* This gives a magnification of about 125% in presentation mode over normal. */
153
+ --jp-content-presentation-font-size1: 17px;
154
+ --jp-content-heading-line-height: 1;
155
+ --jp-content-heading-margin-top: 1.2em;
156
+ --jp-content-heading-margin-bottom: 0.8em;
157
+ --jp-content-heading-font-weight: 500;
158
+
159
+ /* Defaults use Material Design specification */
160
+ --jp-content-font-color0: rgba(0, 0, 0, 100%);
161
+ --jp-content-font-color1: rgba(0, 0, 0, 87%);
162
+ --jp-content-font-color2: rgba(0, 0, 0, 54%);
163
+ --jp-content-font-color3: rgba(0, 0, 0, 38%);
164
+ --jp-content-link-color: var(--md-blue-700);
165
+ --jp-content-font-family: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI',
166
+ helvetica, arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
167
+ 'Segoe UI Symbol';
168
+
169
+ /*
170
+ * Code Fonts
171
+ *
172
+ * Code font variables are used for typography of code and other monospaces content.
173
+ */
174
+
175
+ --jp-code-font-size: 14px;
176
+ --jp-code-line-height: 20px; /* 17px for 13px base */
177
+ --jp-code-padding: 5px; /* 5px for 13px base, codemirror highlighting needs integer px value */
178
+ --jp-code-font-family-default: menlo-regular, consolas, 'DejaVu Sans Mono', monospace;
179
+ --jp-code-font-family: var(--jp-code-font-family-default);
180
+
181
+ /* This gives a magnification of about 125% in presentation mode over normal. */
182
+ --jp-code-presentation-font-size: 16px;
183
+
184
+ /* may need to tweak cursor width if you change font size */
185
+ --jp-code-cursor-width0: 1.4px;
186
+ --jp-code-cursor-width1: 2px;
187
+ --jp-code-cursor-width2: 4px;
188
+
189
+ /* Layout
190
+ *
191
+ * The following are the main layout colors use in JupyterLab. In a light
192
+ * theme these would go from light to dark.
193
+ */
194
+
195
+ --jp-layout-color0: transparent;
196
+ --jp-layout-color1: white;
197
+ --jp-layout-color2: var(--md-grey-200);
198
+ --jp-layout-color3: var(--md-grey-400);
199
+ --jp-layout-color4: var(--md-grey-600);
200
+
201
+ /* Inverse Layout
202
+ *
203
+ * The following are the inverse layout colors use in JupyterLab. In a light
204
+ * theme these would go from dark to light.
205
+ */
206
+
207
+ --jp-inverse-layout-color0: #111;
208
+ --jp-inverse-layout-color1: var(--md-grey-900);
209
+ --jp-inverse-layout-color2: var(--md-grey-800);
210
+ --jp-inverse-layout-color3: var(--md-grey-700);
211
+ --jp-inverse-layout-color4: var(--md-grey-600);
212
+
213
+ /* Brand/accent */
214
+
215
+ --jp-brand-color0: var(--md-blue-900);
216
+ --jp-brand-color1: var(--md-blue-700);
217
+ --jp-brand-color2: var(--md-blue-300);
218
+ --jp-brand-color3: var(--md-blue-100);
219
+ --jp-brand-color4: var(--md-blue-50);
220
+ --jp-accent-color0: var(--md-green-900);
221
+ --jp-accent-color1: var(--md-green-700);
222
+ --jp-accent-color2: var(--md-green-300);
223
+ --jp-accent-color3: var(--md-green-100);
224
+
225
+ /* State colors (warn, error, success, info) */
226
+
227
+ --jp-warn-color0: var(--md-orange-900);
228
+ --jp-warn-color1: var(--md-orange-700);
229
+ --jp-warn-color2: var(--md-orange-300);
230
+ --jp-warn-color3: var(--md-orange-100);
231
+ --jp-error-color0: var(--md-red-900);
232
+ --jp-error-color1: var(--md-red-700);
233
+ --jp-error-color2: var(--md-red-300);
234
+ --jp-error-color3: var(--md-red-100);
235
+ --jp-success-color0: var(--md-green-900);
236
+ --jp-success-color1: var(--md-green-700);
237
+ --jp-success-color2: var(--md-green-300);
238
+ --jp-success-color3: var(--md-green-100);
239
+ --jp-info-color0: var(--md-cyan-900);
240
+ --jp-info-color1: var(--md-cyan-700);
241
+ --jp-info-color2: var(--md-cyan-300);
242
+ --jp-info-color3: var(--md-cyan-100);
243
+
244
+ /* Cell specific styles */
245
+
246
+ --jp-cell-padding: 5px;
247
+ --jp-cell-collapser-width: 8px;
248
+ --jp-cell-collapser-min-height: 20px;
249
+ --jp-cell-collapser-not-active-hover-opacity: 0.6;
250
+ --jp-cell-editor-background: var(--md-grey-100);
251
+ --jp-cell-editor-border-color: var(--md-grey-300);
252
+ --jp-cell-editor-box-shadow: inset 0 0 2px var(--md-blue-300);
253
+ --jp-cell-editor-active-background: var(--jp-layout-color0);
254
+ --jp-cell-editor-active-border-color: var(--jp-brand-color1);
255
+ --jp-cell-prompt-width: 64px;
256
+ --jp-cell-prompt-font-family: var(--jp-code-font-family-default);
257
+ --jp-cell-prompt-letter-spacing: 0;
258
+ --jp-cell-prompt-opacity: 1;
259
+ --jp-cell-prompt-not-active-opacity: 0.5;
260
+ --jp-cell-prompt-not-active-font-color: var(--md-grey-700);
261
+
262
+ /* A custom blend of MD grey and blue 600
263
+ * See https://meyerweb.com/eric/tools/color-blend/#546E7A:1E88E5:5:hex */
264
+ --jp-cell-inprompt-font-color: #307fc1;
265
+
266
+ /* A custom blend of MD grey and orange 600
267
+ * https://meyerweb.com/eric/tools/color-blend/#546E7A:F4511E:5:hex */
268
+ --jp-cell-outprompt-font-color: #bf5b3d;
269
+
270
+ /* Notebook specific styles */
271
+
272
+ --jp-notebook-padding: 10px;
273
+ --jp-notebook-select-background: var(--jp-layout-color1);
274
+ --jp-notebook-multiselected-color: var(--md-blue-50);
275
+
276
+ /* The scroll padding is calculated to fill enough space at the bottom of the
277
+ notebook to show one single-line cell (with appropriate padding) at the top
278
+ when the notebook is scrolled all the way to the bottom. We also subtract one
279
+ pixel so that no scrollbar appears if we have just one single-line cell in the
280
+ notebook. This padding is to enable a 'scroll past end' feature in a notebook.
281
+ */
282
+ --jp-notebook-scroll-padding: calc(
283
+ 100% - var(--jp-code-font-size) * var(--jp-code-line-height) -
284
+ var(--jp-code-padding) - var(--jp-cell-padding) - 1px
285
+ );
286
+
287
+ /* Rendermime styles */
288
+
289
+ --jp-rendermime-error-background: #fdd;
290
+ --jp-rendermime-table-row-background: var(--md-grey-100);
291
+ --jp-rendermime-table-row-hover-background: var(--md-light-blue-50);
292
+
293
+ /* Dialog specific styles */
294
+
295
+ --jp-dialog-background: rgba(0, 0, 0, 25%);
296
+
297
+ /* Console specific styles */
298
+
299
+ --jp-console-padding: 10px;
300
+
301
+ /* Toolbar specific styles */
302
+
303
+ --jp-toolbar-border-color: var(--jp-border-color1);
304
+ --jp-toolbar-micro-height: 8px;
305
+ --jp-toolbar-background: var(--jp-layout-color1);
306
+ --jp-toolbar-box-shadow: 0 0 2px 0 rgba(0, 0, 0, 24%);
307
+ --jp-toolbar-header-margin: 4px 4px 0 4px;
308
+ --jp-toolbar-active-background: var(--md-grey-300);
309
+
310
+ /* Statusbar specific styles */
311
+
312
+ --jp-statusbar-height: 24px;
313
+
314
+ /* Input field styles */
315
+
316
+ --jp-input-box-shadow: inset 0 0 2px var(--md-blue-300);
317
+ --jp-input-active-background: var(--jp-layout-color1);
318
+ --jp-input-hover-background: var(--jp-layout-color1);
319
+ --jp-input-background: var(--md-grey-100);
320
+ --jp-input-border-color: var(--jp-inverse-border-color);
321
+ --jp-input-active-border-color: var(--jp-brand-color1);
322
+ --jp-input-active-box-shadow-color: rgba(19, 124, 189, 30%);
323
+
324
+ /* General editor styles */
325
+
326
+ --jp-editor-selected-background: #b4ceff;
327
+ --jp-editor-selected-focused-background: #b9d1ff;
328
+ --jp-editor-cursor-color: var(--jp-ui-font-color0);
329
+
330
+ /* Code mirror specific styles */
331
+
332
+ --jp-mirror-editor-keyword-color: #0b8658;
333
+ --jp-mirror-editor-atom-color: #88f;
334
+ --jp-mirror-editor-number-color: #0b8658;
335
+ --jp-mirror-editor-def-color: #00f;
336
+ --jp-mirror-editor-variable-color: var(--md-grey-900);
337
+ --jp-mirror-editor-variable-2-color: #2260a0;
338
+ --jp-mirror-editor-variable-3-color: #085;
339
+ --jp-mirror-editor-punctuation-color: #2260a0;
340
+ --jp-mirror-editor-property-color: #2260a0;
341
+ --jp-mirror-editor-operator-color: #c702c7;
342
+ --jp-mirror-editor-comment-color: #408080;
343
+ --jp-mirror-editor-string-color: #ba2121;
344
+ --jp-mirror-editor-string-2-color: #708;
345
+ --jp-mirror-editor-meta-color: #c702c7;
346
+ --jp-mirror-editor-qualifier-color: #555;
347
+ --jp-mirror-editor-builtin-color: #0b8658;
348
+ --jp-mirror-editor-bracket-color: #997;
349
+ --jp-mirror-editor-tag-color: #170;
350
+ --jp-mirror-editor-attribute-color: #00c;
351
+ --jp-mirror-editor-header-color: blue;
352
+ --jp-mirror-editor-quote-color: #090;
353
+ --jp-mirror-editor-link-color: #00c;
354
+ --jp-mirror-editor-error-color: #f00;
355
+ --jp-mirror-editor-hr-color: #999;
356
+
357
+ /*
358
+ RTC user specific colors.
359
+ These colors are used for the cursor, username in the editor,
360
+ and the icon of the user.
361
+ */
362
+
363
+ --jp-collaborator-color1: #ffad8e;
364
+ --jp-collaborator-color2: #dac83d;
365
+ --jp-collaborator-color3: #72dd76;
366
+ --jp-collaborator-color4: #00e4d0;
367
+ --jp-collaborator-color5: #45d4ff;
368
+ --jp-collaborator-color6: #e2b1ff;
369
+ --jp-collaborator-color7: #ff9de6;
370
+
371
+ /* Vega extension styles */
372
+
373
+ --jp-vega-background: white;
374
+
375
+ /* Sidebar-related styles */
376
+
377
+ --jp-sidebar-min-width: 250px;
378
+
379
+ /* Search-related styles */
380
+
381
+ --jp-search-toggle-off-opacity: 0.5;
382
+ --jp-search-toggle-hover-opacity: 0.8;
383
+ --jp-search-toggle-on-opacity: 1;
384
+ --jp-search-selected-match-background-color: rgb(245, 200, 0);
385
+ --jp-search-selected-match-color: black;
386
+ --jp-search-unselected-match-background-color: var(--jp-inverse-layout-color0);
387
+ --jp-search-unselected-match-color: var(--jp-ui-inverse-font-color0);
388
+
389
+ /* Icon colors that work well with light or dark backgrounds */
390
+ --jp-icon-contrast-color0: var(--md-purple-600);
391
+ --jp-icon-contrast-color1: var(--md-green-600);
392
+ --jp-icon-contrast-color2: var(--md-pink-600);
393
+ --jp-icon-contrast-color3: var(--md-blue-600);
394
+
395
+ /* Button colors */
396
+ --jp-accept-color-normal: var(--md-blue-700);
397
+ --jp-accept-color-hover: var(--md-blue-800);
398
+ --jp-accept-color-active: var(--md-blue-900);
399
+ --jp-warn-color-normal: var(--md-red-700);
400
+ --jp-warn-color-hover: var(--md-red-800);
401
+ --jp-warn-color-active: var(--md-red-900);
402
+ --jp-reject-color-normal: var(--md-grey-600);
403
+ --jp-reject-color-hover: var(--md-grey-700);
404
+ --jp-reject-color-active: var(--md-grey-800);
405
+ }
package/src/theme.ts ADDED
@@ -0,0 +1,231 @@
1
+ import {
2
+ defaultHighlightStyle,
3
+ HighlightStyle,
4
+ syntaxHighlighting,
5
+ } from '@codemirror/language';
6
+ import type { Extension } from '@codemirror/state';
7
+ import { EditorView } from '@codemirror/view';
8
+ import { tags as t } from '@lezer/highlight';
9
+
10
+ export const jupyterEditorTheme = EditorView.theme({
11
+ /**
12
+ * CodeMirror themes are handling the background/color in this way. This works
13
+ * fine for CodeMirror editors outside the notebook, but the notebook styles
14
+ * these things differently.
15
+ */
16
+ '&': {
17
+ background: 'var(--jp-layout-color0)',
18
+ color: 'var(--mana-libro-text-default-color)',
19
+ },
20
+
21
+ /* In the notebook, we want this styling to be handled by its container */
22
+ '.jp-CodeConsole &, .jp-Notebook &': {
23
+ background: 'transparent',
24
+ },
25
+
26
+ '.cm-content': {
27
+ caretColor: 'var(--jp-editor-cursor-color)',
28
+ },
29
+
30
+ '.cm-cursor, .cm-dropCursor': {
31
+ borderLeft:
32
+ 'var(--jp-code-cursor-width0) solid var(--mana-libro-editor-cursor-color)',
33
+ },
34
+
35
+ '.cm-selectionBackground, .cm-content ::selection': {
36
+ color: 'unset',
37
+ backgroundColor: 'var(--mana-libro-editor-selection-color) !important',
38
+ },
39
+
40
+ '&.cm-focused .cm-selectionBackground': {
41
+ backgroundColor: 'var(--mana-libro-editor-selection-color) !important',
42
+ },
43
+
44
+ '.cm-gutters': {
45
+ borderRight: 'unset',
46
+ backgroundColor: 'var(--mana-libro-input-background)',
47
+ // paddingBottom: '15px',
48
+ color: 'var(--mana-libro-editor-gutter-number-color)',
49
+ fontFamily: 'var(--jp-code-font-family-default)',
50
+ fontWeight: '400',
51
+ fontSize: '13px',
52
+ lineHeight: '20px',
53
+ },
54
+
55
+ '.cm-foldGutter .cm-gutterElement': {
56
+ width: '20px',
57
+ paddingRight: '8px',
58
+ display: 'flex',
59
+ justifyContent: 'center',
60
+ alignItems: 'center',
61
+ },
62
+ '.cm-line': {
63
+ paddingLeft: '1px',
64
+ },
65
+
66
+ '.cm-activeLineGutter': {
67
+ backgroundColor: 'var(--mana-libro-editor-activeline-color) !important',
68
+ },
69
+
70
+ '.cm-lineNumbers .cm-gutterElement': {
71
+ padding: '0 0 0 16px',
72
+ minWidth: '32px',
73
+ },
74
+
75
+ 'cm-selectionMatch': {
76
+ backgroundColor: 'var(--mana-libro-editor-selectionMatch-color)',
77
+ },
78
+
79
+ '.cm-activeLine': {
80
+ backgroundColor: 'var(--mana-libro-editor-activeline-color)',
81
+ },
82
+
83
+ '.cm-scroller': {
84
+ fontFamily: 'var(--jp-code-font-family-default)',
85
+ fontWeight: '400',
86
+ fontSize: '13px',
87
+ letterSpacing: '0',
88
+ lineHeight: '20px',
89
+ },
90
+
91
+ // '.cm-editor': {
92
+ // paddingTop: '24px',
93
+ // },
94
+
95
+ '.cm-searchMatch': {
96
+ backgroundColor: 'var(--jp-search-unselected-match-background-color)',
97
+ color: 'var(--jp-search-unselected-match-color)',
98
+ },
99
+
100
+ '.cm-searchMatch span': {
101
+ backgroundColor: 'var(--jp-search-unselected-match-background-color)',
102
+ color: 'var(--jp-search-unselected-match-color)',
103
+ },
104
+
105
+ '.cm-searchMatch.cm-searchMatch-selected': {
106
+ backgroundColor: 'var(--jp-search-selected-match-background-color) !important',
107
+ color: 'var(--jp-search-selected-match-color) !important',
108
+ },
109
+
110
+ '.cm-searchMatch.cm-searchMatch-selected span': {
111
+ backgroundColor: 'var(--jp-search-selected-match-background-color) !important',
112
+ color: 'var(--jp-search-selected-match-color) !important',
113
+ },
114
+
115
+ // '.cm-content, .cm-gutter': { minHeight: '30px' },
116
+ });
117
+
118
+ export const jupyterHighlightStyle = HighlightStyle.define([
119
+ // Order matters - a rule will override the previous ones; important for example for in headings styles.
120
+ { tag: t.meta, color: 'var(--jp-mirror-editor-meta-color)' },
121
+ { tag: t.heading, color: 'var(--jp-mirror-editor-header-color)' },
122
+ {
123
+ tag: [t.heading1, t.heading2, t.heading3, t.heading4],
124
+ color: 'var(--jp-mirror-editor-header-color)',
125
+ fontWeight: 'bold',
126
+ },
127
+ {
128
+ tag: t.keyword,
129
+ color: 'var(--mana-libro-editor-keyword-color)',
130
+ fontWeight: 'bold',
131
+ },
132
+ { tag: t.atom, color: 'var(--mana-libro-editor-atom-color)' },
133
+ { tag: t.number, color: 'var(--mana-libro-editor-number-color)' },
134
+ {
135
+ tag: [t.definition(t.name), t.function(t.definition(t.variableName))],
136
+ color: 'var(--mana-libro-editor-def-color)',
137
+ },
138
+ { tag: t.variableName, color: 'var(--mana-libro-editor-variable-color)' },
139
+ {
140
+ tag: [t.special(t.variableName), t.self],
141
+ color: 'var(--mana-libro-editor-variable-2-color)',
142
+ },
143
+ { tag: t.punctuation, color: 'var(--mana-libro-editor-punctuation-color)' },
144
+ { tag: t.propertyName, color: 'var(--mana-libro-editor-property-color)' },
145
+ {
146
+ tag: t.operator,
147
+ color: 'var(--mana-libro-editor-operator-color)',
148
+ fontWeight: 'bold',
149
+ },
150
+ {
151
+ tag: t.comment,
152
+ color: 'var(--mana-libro-editor-comment-color)',
153
+ fontStyle: 'italic',
154
+ },
155
+ { tag: t.string, color: 'var(--mana-libro-editor-string-color)' },
156
+ {
157
+ tag: [t.labelName, t.monospace, t.special(t.string)],
158
+ color: 'var(--jp-mirror-editor-string-2-color)',
159
+ },
160
+ { tag: t.bracket, color: 'var(--jp-mirror-editor-bracket-color)' },
161
+ { tag: t.tagName, color: 'var(--jp-mirror-editor-tag-color)' },
162
+ { tag: t.attributeName, color: 'var(--jp-mirror-editor-attribute-color)' },
163
+ { tag: t.quote, color: 'var(--jp-mirror-editor-quote-color)' },
164
+ {
165
+ tag: t.link,
166
+ color: 'var(--jp-mirror-editor-link-color)',
167
+ textDecoration: 'underline',
168
+ },
169
+ { tag: [t.separator, t.derefOperator, t.paren], color: '' },
170
+ { tag: t.strong, fontWeight: 'bold' },
171
+ { tag: t.emphasis, fontStyle: 'italic' },
172
+ { tag: t.strikethrough, textDecoration: 'line-through' },
173
+ ]);
174
+
175
+ /**
176
+ * JupyterLab CodeMirror 6 theme
177
+ */
178
+ export const jupyterTheme: Extension = [
179
+ jupyterEditorTheme,
180
+ syntaxHighlighting(jupyterHighlightStyle),
181
+ ];
182
+
183
+ /**
184
+ * A namespace to handle CodeMirror 6 theme
185
+ *
186
+ * @alpha
187
+ */
188
+ /**
189
+ * CodeMirror 6 themes
190
+ */
191
+ const themeMap: Map<string, Extension> = new Map([
192
+ ['codemirror', [EditorView.baseTheme({}), syntaxHighlighting(defaultHighlightStyle)]],
193
+ ['jupyter', jupyterTheme],
194
+ ]);
195
+
196
+ /**
197
+ * Get the default CodeMirror 6 theme for JupyterLab
198
+ *
199
+ * @alpha
200
+ * @returns Default theme
201
+ */
202
+ export function defaultTheme(): Extension {
203
+ return themeMap.get('jupyter')!;
204
+ }
205
+
206
+ /**
207
+ * Register a new theme.
208
+ *
209
+ * @alpha
210
+ * @param name Theme name
211
+ * @param theme Codemirror 6 theme extension
212
+ */
213
+ export function registerTheme(name: string, theme: Extension) {
214
+ themeMap.set(name, theme);
215
+ }
216
+
217
+ /**
218
+ * Get a theme.
219
+ *
220
+ * #### Notes
221
+ * It falls back to the default theme
222
+ *
223
+ * @alpha
224
+ * @param name Theme name
225
+ * @returns Theme extension
226
+ */
227
+ export function getTheme(name: string): Extension {
228
+ const ext = themeMap.get(name);
229
+
230
+ return ext ?? defaultTheme();
231
+ }