@scalar/use-codemirror 0.14.11 → 0.14.12
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/CHANGELOG.md +6 -0
- package/dist/hooks/useCodeMirror.js +52 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @scalar/use-codemirror
|
|
2
2
|
|
|
3
|
+
## 0.14.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#9487](https://github.com/scalar/scalar/pull/9487): Render the code fold gutter chevron icons. The marker SVGs had a `viewBox` but no width/height, so they collapsed to zero size and were invisible. Folding worked but had no visual affordance. The chevrons now render at a fixed size, sit centered in the fold gutter, and use a muted color that brightens on hover — in both light and dark mode.
|
|
8
|
+
|
|
3
9
|
## 0.14.11
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -10,8 +10,8 @@ import { linter } from '@codemirror/lint';
|
|
|
10
10
|
import { StateEffect } from '@codemirror/state';
|
|
11
11
|
import { EditorView, highlightSpecialChars, keymap, lineNumbers as lineNumbersExtension, placeholder as placeholderExtension, } from '@codemirror/view';
|
|
12
12
|
import { computed, onBeforeUnmount, ref, toValue, watch } from 'vue';
|
|
13
|
-
const CHEVRON_DOWN = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m18 10-6 6-6-6" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
14
|
-
const CHEVRON_RIGHT = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m9 18 6-6-6-6" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
13
|
+
const CHEVRON_DOWN = '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m18 10-6 6-6-6" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
14
|
+
const CHEVRON_RIGHT = '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m9 18 6-6-6-6" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
15
15
|
import { customTheme } from '../themes/index.js';
|
|
16
16
|
import { variables } from './variables.js';
|
|
17
17
|
/**
|
|
@@ -169,12 +169,60 @@ function getCodeMirrorExtensions({ onChange, onBlur, onFocus, provider, language
|
|
|
169
169
|
'.cm-gutterElement': {
|
|
170
170
|
lineHeight: '22px',
|
|
171
171
|
},
|
|
172
|
+
// Center the fold chevron within the line and give it a muted, interactive look
|
|
173
|
+
'.cm-foldGutter .cm-gutterElement': {
|
|
174
|
+
display: 'flex',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
// Nudge the chevron off the line numbers so it sits between them and the code
|
|
177
|
+
paddingLeft: '4px',
|
|
178
|
+
},
|
|
179
|
+
'.cm-foldMarker': {
|
|
180
|
+
display: 'flex',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
justifyContent: 'center',
|
|
183
|
+
height: '22px',
|
|
184
|
+
color: 'var(--scalar-color-3)',
|
|
185
|
+
cursor: 'pointer',
|
|
186
|
+
},
|
|
187
|
+
'.cm-foldMarker:hover': {
|
|
188
|
+
color: 'var(--scalar-color-1)',
|
|
189
|
+
},
|
|
190
|
+
'.cm-foldMarker svg': {
|
|
191
|
+
width: '16px',
|
|
192
|
+
height: '16px',
|
|
193
|
+
},
|
|
172
194
|
'.cm-tooltip': {
|
|
173
|
-
|
|
195
|
+
background: 'var(--scalar-background-1)',
|
|
196
|
+
border: '1px solid var(--scalar-border-color)',
|
|
197
|
+
borderRadius: 'var(--scalar-radius)',
|
|
198
|
+
boxShadow: 'var(--scalar-shadow-2)',
|
|
174
199
|
fontSize: '12px',
|
|
200
|
+
overflow: 'hidden',
|
|
201
|
+
},
|
|
202
|
+
'.cm-tooltip-autocomplete ul': {
|
|
203
|
+
padding: '6px',
|
|
204
|
+
},
|
|
205
|
+
'.cm-tooltip-autocomplete ul li': {
|
|
206
|
+
padding: '3px 6px',
|
|
207
|
+
color: 'var(--scalar-color-1)',
|
|
208
|
+
borderRadius: '3px',
|
|
209
|
+
},
|
|
210
|
+
'.cm-tooltip-autocomplete ul li[aria-selected]': {
|
|
211
|
+
background: 'var(--scalar-background-2)',
|
|
212
|
+
color: 'var(--scalar-color-1)',
|
|
213
|
+
},
|
|
214
|
+
'.cm-tooltip-autocomplete ul li:hover': {
|
|
215
|
+
background: 'var(--scalar-background-3)',
|
|
216
|
+
color: 'var(--scalar-color-1)',
|
|
217
|
+
},
|
|
218
|
+
'.cm-completionLabel': {
|
|
219
|
+
color: 'var(--scalar-color-1)',
|
|
220
|
+
},
|
|
221
|
+
'.cm-completionDetail': {
|
|
222
|
+
color: 'var(--scalar-color-3)',
|
|
175
223
|
},
|
|
176
224
|
'.cm-tooltip-lint': {
|
|
177
|
-
backgroundColor: '
|
|
225
|
+
backgroundColor: 'var(--scalar-background-1)',
|
|
178
226
|
},
|
|
179
227
|
'.cm-diagnostic-error': {
|
|
180
228
|
borderLeft: '0',
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"vue",
|
|
17
17
|
"vue3"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.14.
|
|
19
|
+
"version": "0.14.12",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"vitest": "4.1.0",
|
|
63
63
|
"vue": "^3.5.30",
|
|
64
64
|
"vue-tsc": "^3.2.4",
|
|
65
|
-
"@scalar/themes": "0.
|
|
65
|
+
"@scalar/themes": "0.16.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
69
69
|
"dev": "vite .",
|
|
70
|
-
"test": "vitest",
|
|
70
|
+
"test": "vitest --run",
|
|
71
71
|
"types:check": "vue-tsc --noEmit"
|
|
72
72
|
}
|
|
73
73
|
}
|