aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorTheme.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-26 20:01:20 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-04-26 20:06:50 +0200
commita854b1acdef27c54fe008d236282386efc44783e (patch)
tree7975abaf876db71030a3268bea3e8acf4b0c58fb /subprojects/frontend/src/editor/EditorTheme.ts
parentchore(deps): bump dependencies (diff)
downloadrefinery-a854b1acdef27c54fe008d236282386efc44783e.tar.gz
refinery-a854b1acdef27c54fe008d236282386efc44783e.tar.zst
refinery-a854b1acdef27c54fe008d236282386efc44783e.zip
fix(web): editor cursor styling
Temporarily remove custom scrollbar and indentation styling, because they interferred with cursor visibility.
Diffstat (limited to 'subprojects/frontend/src/editor/EditorTheme.ts')
-rw-r--r--subprojects/frontend/src/editor/EditorTheme.ts126
1 files changed, 3 insertions, 123 deletions
diff --git a/subprojects/frontend/src/editor/EditorTheme.ts b/subprojects/frontend/src/editor/EditorTheme.ts
index 023a8f73..e057ce18 100644
--- a/subprojects/frontend/src/editor/EditorTheme.ts
+++ b/subprojects/frontend/src/editor/EditorTheme.ts
@@ -14,32 +14,6 @@ function svgURL(svg: string): string {
14 return `url('data:image/svg+xml;utf8,${svg}')`; 14 return `url('data:image/svg+xml;utf8,${svg}')`;
15} 15}
16 16
17function radialShadowTheme(
18 origin: string,
19 scaleX: boolean,
20 scaleY: boolean,
21): CSSObject {
22 function radialGradient(opacity: number, scale: string): string {
23 return `radial-gradient(
24 farthest-side at ${origin},
25 rgba(0, 0, 0, ${opacity}),
26 rgba(0, 0, 0, 0)
27 )
28 ${origin} /
29 ${scaleX ? scale : '100%'}
30 ${scaleY ? scale : '100%'}
31 no-repeat`;
32 }
33
34 return {
35 background: `
36 ${radialGradient(0.2, '40%')},
37 ${radialGradient(0.14, '50%')},
38 ${radialGradient(0.12, '100%')}
39 `,
40 };
41}
42
43export default styled('div', { 17export default styled('div', {
44 name: 'EditorTheme', 18 name: 'EditorTheme',
45 shouldForwardProp: (propName) => 19 shouldForwardProp: (propName) =>
@@ -58,98 +32,13 @@ export default styled('div', {
58 }, 32 },
59 }; 33 };
60 34
61 const scrollerThumbOpacity = theme.palette.mode === 'dark' ? 0.16 : 0.28;
62
63 const generalStyle: CSSObject = { 35 const generalStyle: CSSObject = {
64 background: theme.palette.background.default, 36 background: theme.palette.background.default,
65 '&, .cm-editor': { 37 '&, .cm-editor': {
66 height: '100%', 38 height: '100%',
67 }, 39 },
68 '.cm-scroller-holder': {
69 display: 'flex',
70 position: 'relative',
71 flexDirection: 'column',
72 overflow: 'hidden',
73 flex: '1 1',
74 },
75 '.cm-scroller-spacer': {
76 position: 'sticky',
77 flexShrink: 0,
78 zIndex: 300,
79 width: 1,
80 marginRight: -1,
81 pointerEvents: 'none',
82 },
83 '.cm-scroller': { 40 '.cm-scroller': {
84 color: theme.palette.text.secondary, 41 color: theme.palette.text.secondary,
85 scrollbarWidth: 'none',
86 MsOverflowStyle: 'none',
87 '&::-webkit-scrollbar': {
88 width: 0,
89 height: 0,
90 background: 'transparent',
91 },
92 },
93 '.cm-scroller-track': {
94 position: 'absolute',
95 zIndex: 300,
96 touchAction: 'none',
97 },
98 '.cm-scroller-thumb': {
99 position: 'absolute',
100 background: theme.palette.text.secondary,
101 opacity: scrollerThumbOpacity,
102 transition: theme.transitions.create('opacity', {
103 duration: theme.transitions.duration.shortest,
104 }),
105 touchAction: 'none',
106 WebkitTapHighlightColor: 'transparent',
107 '&:hover': {
108 opacity: 0.75,
109 '@media (hover: none)': {
110 opacity: scrollerThumbOpacity,
111 },
112 },
113 '&.active': {
114 opacity: 1,
115 pointerEvents: 'none',
116 userSelect: 'none',
117 },
118 },
119 '.cm-scroller-track-y, .cm-scroller-thumb-y': {
120 top: 0,
121 right: 0,
122 width: 12,
123 },
124 '.cm-scroller-track-x, .cm-scroller-thumb-x': {
125 left: 0,
126 bottom: 0,
127 height: 12,
128 },
129 '.cm-scroller-track-x': {
130 right: 12,
131 },
132 '.cm-scroller-gutter-decoration': {
133 position: 'absolute',
134 top: 0,
135 bottom: 0,
136 left: 0,
137 width: 0,
138 transition: theme.transitions.create('width', {
139 duration: theme.transitions.duration.shortest,
140 }),
141 ...radialShadowTheme('0 50%', true, false),
142 },
143 '.cm-scroller-top-decoration': {
144 position: 'absolute',
145 top: 0,
146 left: 0,
147 right: 0,
148 height: 0,
149 transition: theme.transitions.create('height', {
150 duration: theme.transitions.duration.shortest,
151 }),
152 ...radialShadowTheme('50% 0', false, true),
153 }, 42 },
154 '.cm-gutters': { 43 '.cm-gutters': {
155 background: theme.palette.background.default, 44 background: theme.palette.background.default,
@@ -168,7 +57,6 @@ export default styled('div', {
168 background: 'transparent', 57 background: 'transparent',
169 }, 58 },
170 '.cm-cursor, .cm-cursor-primary': { 59 '.cm-cursor, .cm-cursor-primary': {
171 marginLeft: -1,
172 borderLeft: `2px solid ${theme.palette.info.main}`, 60 borderLeft: `2px solid ${theme.palette.info.main}`,
173 }, 61 },
174 '.cm-selectionBackground': { 62 '.cm-selectionBackground': {
@@ -181,7 +69,6 @@ export default styled('div', {
181 }, 69 },
182 }, 70 },
183 '.cm-line': { 71 '.cm-line': {
184 position: 'relative', // For indentation highlights
185 padding: '0 12px 0 0px', 72 padding: '0 12px 0 0px',
186 }, 73 },
187 }; 74 };
@@ -271,13 +158,6 @@ export default styled('div', {
271 '.cm-searchMatch-selected': { 158 '.cm-searchMatch-selected': {
272 background: theme.palette.highlight.search.selected, 159 background: theme.palette.highlight.search.selected,
273 }, 160 },
274 '.cm-indentation-marker': {
275 display: 'inline-block',
276 boxShadow: `1px 0 0 ${theme.palette.text.disabled} inset`,
277 '&.active': {
278 boxShadow: `1px 0 0 ${theme.palette.text.primary} inset`,
279 },
280 },
281 '.cm-scroller-selection': { 161 '.cm-scroller-selection': {
282 position: 'absolute', 162 position: 'absolute',
283 right: 0, 163 right: 0,
@@ -458,11 +338,11 @@ export default styled('div', {
458 338
459 const foldStyle = { 339 const foldStyle = {
460 '.cm-foldGutter': { 340 '.cm-foldGutter': {
461 width: 17, 341 width: 16,
462 }, 342 },
463 '.problem-editor-foldMarker': { 343 '.problem-editor-foldMarker': {
464 display: 'block', 344 display: 'block',
465 margin: '4px 1px 4px 0', 345 margin: '4px 0 4px 0',
466 padding: 0, 346 padding: 0,
467 maskImage: svgURL(expandMoreSVG), 347 maskImage: svgURL(expandMoreSVG),
468 maskSize: '16px 16px', 348 maskSize: '16px 16px',
@@ -473,7 +353,7 @@ export default styled('div', {
473 cursor: 'pointer', 353 cursor: 'pointer',
474 WebkitTapHighlightColor: 'transparent', 354 WebkitTapHighlightColor: 'transparent',
475 [theme.breakpoints.down('sm')]: { 355 [theme.breakpoints.down('sm')]: {
476 margin: '2px 1px 2px 0', 356 margin: '2px 0 2px 0',
477 }, 357 },
478 }, 358 },
479 '.problem-editor-foldMarker-open': { 359 '.problem-editor-foldMarker-open': {