@scalar/use-codemirror 0.14.11 → 0.14.13

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @scalar/use-codemirror
2
2
 
3
+ ## 0.14.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#9710](https://github.com/scalar/scalar/pull/9710): Republish so the updated README (with the Scalar platform overview) reaches npm. Also renames the README generator metadata in package.json from `readme` to `scalarReadme`: npm treats a `readme` field as the readme text itself, so affected packages were published with a literal `[object Object]` readme on the registry instead of README.md.
8
+
9
+ ## 0.14.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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.
14
+
3
15
  ## 0.14.11
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -5,6 +5,20 @@
5
5
  [![License](https://img.shields.io/npm/l/%40scalar%2Fuse-codemirror)](https://www.npmjs.com/package/@scalar/use-codemirror)
6
6
  [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
7
7
 
8
+ ---
9
+
10
+ Scalar is an open-source API platform for teams who want beautiful developer interfaces without vendor lock-in.
11
+
12
+ - **[API References](https://scalar.com/products/api-references/getting-started)** — Interactive API documentation from OpenAPI and AsyncAPI specs.
13
+ - **[Docs](https://scalar.com/products/docs/getting-started)** — Write in Markdown/MDX, generate API references, sync with two-way Git.
14
+ - **[SDKs](https://scalar.com/products/sdks/getting-started)** — Type-safe client libraries in TypeScript, Python, Go, PHP, Java, and Ruby.
15
+ - **[MCP Servers](https://scalar.com/products/agent/getting-started)** — Generate secure MCP servers from your API spec.
16
+ - **[API Client](https://scalar.com/products/api-client/getting-started)** — Open-source, offline-first Postman alternative built on OpenAPI.
17
+
18
+ 20M+ monthly npm installs · 15,500+ GitHub stars · MIT licensed · [scalar.com](https://scalar.com)
19
+
20
+ ---
21
+
8
22
  ## Installation
9
23
 
10
24
  ```bash
@@ -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
- border: '1px solid #f5c6cb',
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: '#ffffff',
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.11",
19
+ "version": "0.14.13",
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.15.2"
65
+ "@scalar/themes": "0.16.3"
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
  }