@dxos/react-ui-editor 0.6.8-staging.77f93a3 → 0.6.8-staging.dec6b33

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.
@@ -22,6 +22,7 @@ export type ThemeStyles = Record<string, StyleSpec>;
22
22
  *
23
23
  * Main layout:
24
24
  * https://codemirror.net/examples/styling
25
+ * https://codemirror.net/docs/guide (DOM Structure).
25
26
  *
26
27
  * <div class="cm-editor [cm-focused] [generated classes]">
27
28
  * <div class="cm-scroller">
@@ -51,13 +52,17 @@ export const defaultTheme: ThemeStyles = {
51
52
  outline: 'none',
52
53
  },
53
54
 
54
- // Scroller.
55
- // NOTE: See https://codemirror.net/docs/guide (DOM Structure).
55
+ /**
56
+ * Scroller
57
+ */
56
58
  '.cm-scroller': {
57
59
  overflowY: 'auto',
58
60
  },
59
61
 
60
- // Content.
62
+ /**
63
+ * Content
64
+ * NOTE: Apply margins to content so that scrollbar is at the edge of the container.
65
+ */
61
66
  '.cm-content': {
62
67
  padding: 'unset',
63
68
  // NOTE: Base font size (otherwise defined by HTML tag, which might be different for storybook).
@@ -72,6 +77,18 @@ export const defaultTheme: ThemeStyles = {
72
77
  color: getToken('extend.semanticColors.base.fg.dark', 'white'),
73
78
  },
74
79
 
80
+ /**
81
+ * Gutters
82
+ * NOTE: Gutters should have the same top margin as the content.
83
+ */
84
+ '.cm-gutters': {
85
+ background: 'transparent',
86
+ },
87
+ '.cm-gutter': {},
88
+ '.cm-gutterElement': {
89
+ lineHeight: 1.5,
90
+ },
91
+
75
92
  //
76
93
  // Cursor
77
94
  //
@@ -197,46 +214,9 @@ export const defaultTheme: ThemeStyles = {
197
214
  opacity: 0.5,
198
215
  },
199
216
 
200
- //
201
- // table
202
- //
203
- '.cm-table *': {
204
- fontFamily: `${getToken('fontFamily.mono')} !important`,
205
- textDecoration: 'none !important',
206
- },
207
- '.cm-table-head': {
208
- padding: '2px 16px 2px 0px',
209
- textAlign: 'left',
210
- borderBottom: `1px solid ${getToken('extend.colors.primary.500')}`,
211
- color: getToken('extend.colors.neutral.500'),
212
- },
213
- '.cm-table-cell': {
214
- padding: '2px 16px 2px 0px',
215
- },
216
-
217
- //
218
- // image
219
- //
220
- '.cm-image': {
221
- display: 'block',
222
- height: '0',
223
- },
224
- '.cm-image.cm-loaded-image': {
225
- height: 'auto',
226
- borderTop: '0.5rem solid transparent',
227
- borderBottom: '0.5rem solid transparent',
228
- },
229
-
230
217
  // TODO(burdon): Override vars --cm-background.
231
218
  // https://www.npmjs.com/package/codemirror-theme-vars
232
219
 
233
- /**
234
- * Gutters
235
- */
236
- '.cm-gutters': {
237
- background: 'transparent',
238
- },
239
-
240
220
  /**
241
221
  * Panels
242
222
  * TODO(burdon): Needs styling attention (esp. dark mode).
@@ -293,4 +273,36 @@ export const defaultTheme: ThemeStyles = {
293
273
  background: getToken('extend.colors.neutral.600'),
294
274
  },
295
275
  },
276
+
277
+ // TODO(burdon): Factor out element specific logic.
278
+
279
+ //
280
+ // table
281
+ //
282
+ '.cm-table *': {
283
+ fontFamily: `${getToken('fontFamily.mono')} !important`,
284
+ textDecoration: 'none !important',
285
+ },
286
+ '.cm-table-head': {
287
+ padding: '2px 16px 2px 0px',
288
+ textAlign: 'left',
289
+ borderBottom: `1px solid ${getToken('extend.colors.primary.500')}`,
290
+ color: getToken('extend.colors.neutral.500'),
291
+ },
292
+ '.cm-table-cell': {
293
+ padding: '2px 16px 2px 0px',
294
+ },
295
+
296
+ //
297
+ // image
298
+ //
299
+ '.cm-image': {
300
+ display: 'block',
301
+ height: '0',
302
+ },
303
+ '.cm-image.cm-loaded-image': {
304
+ height: 'auto',
305
+ borderTop: '0.5rem solid transparent',
306
+ borderBottom: '0.5rem solid transparent',
307
+ },
296
308
  };