vue-codemirror6 1.1.11 → 1.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "vue-codemirror6",
4
- "version": "1.1.11",
4
+ "version": "1.1.12",
5
5
  "license": "MIT",
6
6
  "description": "CodeMirror6 Component for vue2 and vue3.",
7
7
  "keywords": [
@@ -36,12 +36,12 @@
36
36
  },
37
37
  "main": "dist/index.umd.js",
38
38
  "module": "dist/index.es.js",
39
- "types": "dist/index.d.ts",
39
+ "types": "dist/src/index.d.ts",
40
40
  "exports": {
41
41
  ".": {
42
42
  "import": "./dist/index.es.js",
43
43
  "require": "./dist/index.umd.js",
44
- "types": "./dist/index.d.ts"
44
+ "types": "./dist/src/index.d.ts"
45
45
  }
46
46
  },
47
47
  "files": [
@@ -53,21 +53,20 @@
53
53
  "./sfc": "./src/components/CodeMirror.ts"
54
54
  },
55
55
  "engines": {
56
- "node": ">=18.13.0",
57
- "yarn": ">=1.22.10"
56
+ "node": ">=18.15.0",
57
+ "yarn": ">=1.22.19"
58
58
  },
59
- "packageManager": "yarn@3.3.1",
59
+ "packageManager": "yarn@3.4.1",
60
60
  "sideEffects": false,
61
61
  "scripts": {
62
62
  "dev": "vite",
63
63
  "clean": "rimraf node_modules/.vite",
64
64
  "type-check": "tsc --noEmit --composite false",
65
- "build": "run-p type-check build-only build-declaration",
65
+ "build": "run-p type-check build-only",
66
66
  "build:analyze": "vite build --mode=analyze",
67
67
  "build:clean": "rimraf dist docs",
68
68
  "build:docs": "vite build --mode=docs",
69
69
  "build-only": "vite build",
70
- "build-declaration": "tsc -p tsconfig.app.json --composite false",
71
70
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
72
71
  "preview": "vite preview --mode=docs",
73
72
  "prepare": "husky install",
@@ -80,7 +79,7 @@
80
79
  },
81
80
  "peerDependencies": {
82
81
  "@vue/composition-api": "^1.7.1",
83
- "vue": "^2.6.14 || ^3.2.39"
82
+ "vue": "^2.6.14 || ^3.2.47"
84
83
  },
85
84
  "peerDependenciesMeta": {
86
85
  "@vue/composition-api": {
@@ -88,47 +87,48 @@
88
87
  }
89
88
  },
90
89
  "devDependencies": {
91
- "@codemirror/lang-javascript": "^6.1.3",
90
+ "@codemirror/lang-javascript": "^6.1.4",
92
91
  "@codemirror/lang-json": "^6.0.1",
93
- "@codemirror/lang-markdown": "^6.0.5",
92
+ "@codemirror/lang-markdown": "^6.1.0",
93
+ "@codemirror/lang-vue": "^0.1.1",
94
94
  "@types/lodash": "^4.14.191",
95
- "@types/node": "^18.11.18",
96
- "@typescript-eslint/eslint-plugin": "^5.50.0",
97
- "@typescript-eslint/parser": "^5.50.0",
95
+ "@types/node": "^18.15.0",
96
+ "@typescript-eslint/eslint-plugin": "^5.54.1",
97
+ "@typescript-eslint/parser": "^5.54.1",
98
98
  "@vitejs/plugin-vue": "^4.0.0",
99
- "@vue/eslint-config-prettier": "^7.0.0",
99
+ "@vue/eslint-config-prettier": "^7.1.0",
100
100
  "@vue/tsconfig": "^0.1.3",
101
- "@vueuse/core": "^9.12.0",
102
- "eslint": "^8.33.0",
101
+ "@vueuse/core": "^9.13.0",
102
+ "eslint": "^8.35.0",
103
103
  "eslint-config-google": "^0.14.0",
104
- "eslint-config-prettier": "^8.6.0",
104
+ "eslint-config-prettier": "^8.7.0",
105
105
  "eslint-import-resolver-alias": "^1.1.2",
106
106
  "eslint-import-resolver-typescript": "^3.5.3",
107
- "eslint-linter-browserify": "^8.33.0",
107
+ "eslint-linter-browserify": "^8.35.0",
108
108
  "eslint-plugin-html": "^7.1.0",
109
109
  "eslint-plugin-import": "^2.27.5",
110
- "eslint-plugin-jsdoc": "^39.8.0",
110
+ "eslint-plugin-jsdoc": "^40.0.1",
111
111
  "eslint-plugin-prettier": "^4.2.1",
112
112
  "eslint-plugin-tsdoc": "^0.2.17",
113
113
  "eslint-plugin-vue": "^9.9.0",
114
114
  "eslint-plugin-vuejs-accessibility": "^2.1.0",
115
115
  "eslint-plugin-yaml": "^0.5.0",
116
116
  "husky": "^8.0.3",
117
- "lint-staged": "^13.1.0",
117
+ "lint-staged": "^13.1.2",
118
118
  "npm-run-all": "^4.1.5",
119
- "prettier": "^2.8.3",
120
- "rimraf": "^4.1.2",
119
+ "prettier": "^2.8.4",
120
+ "rimraf": "^4.4.0",
121
121
  "rollup-plugin-visualizer": "^5.9.0",
122
- "sass": "^1.58.0",
123
- "sass-loader": "^13.2.0",
122
+ "sass": "^1.58.3",
124
123
  "typescript": "^4.9.5",
125
- "vite": "^4.1.1",
124
+ "vite": "^4.1.4",
126
125
  "vite-plugin-banner": "^0.7.0",
127
- "vite-plugin-checker": "^0.5.5",
128
- "vue": "3.2.45",
126
+ "vite-plugin-checker": "^0.5.6",
127
+ "vite-plugin-dts": "^2.1.0",
128
+ "vue": "^3.2.47",
129
129
  "vue-eslint-parser": "^9.1.0",
130
- "vue-markdown-wasm": "^0.3.2",
131
- "vue-tsc": "^1.0.24"
130
+ "vue-markdown-wasm": "^0.3.6",
131
+ "vue-tsc": "^1.2.0"
132
132
  },
133
133
  "husky": {
134
134
  "hooks": {
@@ -67,6 +67,8 @@ export interface CodeMirrorEmitsOptions extends ObjectEmitsOptions {
67
67
  (e: 'destroy'): void;
68
68
  /** State Changed */
69
69
  (e: 'change', value: EditorState): void;
70
+ /** Diagnostic Count */
71
+ (e: 'diagnosticCount'): number;
70
72
  }
71
73
 
72
74
  /** CodeMirror Component */
@@ -230,7 +232,16 @@ export default defineComponent({
230
232
  */
231
233
  linterConfig: {
232
234
  type: Object,
233
- default: () => {},
235
+ default: () => undefined,
236
+ },
237
+ /**
238
+ * Forces any linters configured to run when the editor is idle to run right away.
239
+ *
240
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
241
+ */
242
+ forceLinting: {
243
+ type: Boolean,
244
+ default: false,
234
245
  },
235
246
  /**
236
247
  * Show Linter Gutter
@@ -251,7 +262,7 @@ export default defineComponent({
251
262
  */
252
263
  gutterConfig: {
253
264
  type: Object,
254
- default: () => {},
265
+ default: () => undefined,
255
266
  },
256
267
  /**
257
268
  * Using tag
@@ -269,6 +280,7 @@ export default defineComponent({
269
280
  * @param props - Props
270
281
  * @param context - Context
271
282
  */
283
+ // @ts-ignore
272
284
  setup(props, context: SetupContext<CodeMirrorEmitsOptions>) {
273
285
  /** Editor DOM */
274
286
  const editor: Ref<HTMLElement | undefined> = ref();
@@ -382,6 +394,11 @@ export default defineComponent({
382
394
  return;
383
395
  }
384
396
 
397
+ // Enable Force Linting
398
+ if (props.linter && props.forceLinting) {
399
+ forceLinting(view.value);
400
+ }
401
+
385
402
  // Update
386
403
  view.value.dispatch({
387
404
  changes: { from: 0, to: view.value.state.doc.length, insert: value },
@@ -393,11 +410,13 @@ export default defineComponent({
393
410
  );
394
411
 
395
412
  // Extension (mostly props) Changed
396
- watch(extensions, exts =>
397
- // TODO: Reduce unchanched value
398
- view.value.dispatch({
399
- effects: StateEffect.reconfigure.of(exts),
400
- })
413
+ watch(
414
+ () => extensions.value,
415
+ exts => {
416
+ view.value.dispatch({
417
+ effects: StateEffect.reconfigure.of(exts),
418
+ });
419
+ }
401
420
  );
402
421
 
403
422
  // focus changed
@@ -433,6 +452,7 @@ export default defineComponent({
433
452
  context.emit('change', view.value.state);
434
453
  },
435
454
  });
455
+
436
456
  await nextTick();
437
457
  context.emit('ready', {
438
458
  view: view,
@@ -620,16 +640,19 @@ export default defineComponent({
620
640
  // </div>
621
641
  // </template>
622
642
  return h(
643
+ // @ts-ignore
623
644
  this.$props.tag,
624
645
  {
625
646
  ref: 'editor',
626
647
  class: 'vue-codemirror',
627
648
  },
649
+ // @ts-ignore
628
650
  this.$slots.default
629
651
  ? // Hide original content
630
652
  h(
631
653
  'aside',
632
654
  { style: 'display: none;', 'aria-hidden': 'true' },
655
+ // @ts-ignore
633
656
  slot(this.$slots.default)
634
657
  )
635
658
  : undefined
package/dist/Meta.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type MetaInterface from '@/interfaces/MetaInterface';
2
- declare const meta: MetaInterface;
3
- export default meta;
package/dist/Meta.js DELETED
@@ -1,6 +0,0 @@
1
- // This file is auto-generated by the build system.
2
- const meta = {
3
- version: '1.1.11',
4
- date: '2023-02-04T13:41:04.676Z',
5
- };
6
- export default meta;
@@ -1,417 +0,0 @@
1
- import { type ObjectEmitsOptions, type PropType, type Ref } from 'vue-demi';
2
- import { EditorState, type Extension, type Text } from '@codemirror/state';
3
- import { EditorView, type ViewUpdate } from '@codemirror/view';
4
- import { type LintSource } from '@codemirror/lint';
5
- import type { LanguageSupport } from '@codemirror/language';
6
- import type { StyleSpec } from 'style-mod';
7
- /** Emit Interface */
8
- export interface CodeMirrorEmitsOptions extends ObjectEmitsOptions {
9
- /** Model Update */
10
- (e: 'update:modelValue', value: string | Text): void;
11
- /** CodeMirror ViewUpdate */
12
- (e: 'update', value: ViewUpdate): void;
13
- /** CodeMirror onFocus */
14
- (e: 'focus', value: boolean): void;
15
- /** CodeMirror onReady */
16
- (e: 'ready', value: {
17
- view: EditorView;
18
- state: EditorState;
19
- container: HTMLElement;
20
- }): void;
21
- /** CodeMirror onDestroy */
22
- (e: 'destroy'): void;
23
- /** State Changed */
24
- (e: 'change', value: EditorState): void;
25
- }
26
- /** CodeMirror Component */
27
- declare const _default: import("vue-demi").DefineComponent<{
28
- /** Model value */
29
- modelValue: {
30
- type: PropType<string | Text>;
31
- default: string;
32
- };
33
- /**
34
- * Theme
35
- *
36
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
37
- */
38
- theme: {
39
- type: PropType<{
40
- [selector: string]: StyleSpec;
41
- }>;
42
- default: () => void;
43
- };
44
- /** Dark Mode */
45
- dark: {
46
- type: BooleanConstructor;
47
- default: boolean;
48
- };
49
- /**
50
- * Use Basic Setup
51
- *
52
- * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
53
- */
54
- basic: {
55
- type: BooleanConstructor;
56
- default: boolean;
57
- };
58
- /**
59
- * Use Minimal Setup (The basic setting has priority.)
60
- *
61
- * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
62
- */
63
- minimal: {
64
- type: BooleanConstructor;
65
- default: boolean;
66
- };
67
- /**
68
- * Placeholder
69
- *
70
- * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
71
- */
72
- placeholder: {
73
- type: PropType<string | HTMLElement>;
74
- default: undefined;
75
- };
76
- /**
77
- * Line wrapping
78
- *
79
- * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
80
- *
81
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
82
- */
83
- wrap: {
84
- type: BooleanConstructor;
85
- default: boolean;
86
- };
87
- /**
88
- * Allow tab key indent.
89
- *
90
- * @see {@link https://codemirror.net/examples/tab/}
91
- */
92
- tab: {
93
- type: BooleanConstructor;
94
- default: boolean;
95
- };
96
- /**
97
- * Tab size
98
- *
99
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
100
- */
101
- tabSize: {
102
- type: NumberConstructor;
103
- default: undefined;
104
- };
105
- /**
106
- * Set line break (separetor) char.
107
- *
108
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
109
- */
110
- lineSeparator: {
111
- type: StringConstructor;
112
- default: undefined;
113
- };
114
- /**
115
- * Readonly
116
- *
117
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
118
- */
119
- readonly: {
120
- type: BooleanConstructor;
121
- default: boolean;
122
- };
123
- /**
124
- * Disable input.
125
- *
126
- * This is the reversed value of the CodeMirror editable.
127
- * Similar to `readonly`, but setting this value to true disables dragging.
128
- *
129
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
130
- */
131
- disabled: {
132
- type: BooleanConstructor;
133
- default: boolean;
134
- };
135
- /**
136
- * Additional Extension
137
- *
138
- * @see {@link https://codemirror.net/docs/ref/#state.Extension}
139
- */
140
- extensions: {
141
- type: PropType<Extension[]>;
142
- default: () => never[];
143
- };
144
- /**
145
- * Language Phreses
146
- *
147
- * @see {@link https://codemirror.net/examples/translate/}
148
- */
149
- phrases: {
150
- type: PropType<Record<string, string>>;
151
- default: () => undefined;
152
- };
153
- /**
154
- * CodeMirror Language
155
- *
156
- * @see {@link https://codemirror.net/docs/ref/#language}
157
- */
158
- lang: {
159
- type: PropType<LanguageSupport>;
160
- default: () => undefined;
161
- };
162
- /**
163
- * CodeMirror Linter
164
- *
165
- * @see {@link https://codemirror.net/docs/ref/#lint.linter}
166
- */
167
- linter: {
168
- type: PropType<LintSource>;
169
- default: undefined;
170
- };
171
- /**
172
- * Linter Config
173
- *
174
- * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
175
- */
176
- linterConfig: {
177
- type: ObjectConstructor;
178
- default: () => void;
179
- };
180
- /**
181
- * Show Linter Gutter
182
- *
183
- * An area to 🔴 the lines with errors will be displayed.
184
- * This feature is not enabled if `linter` is not specified.
185
- *
186
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
187
- */
188
- gutter: {
189
- type: BooleanConstructor;
190
- defalt: boolean;
191
- };
192
- /**
193
- * Gutter Config
194
- *
195
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
196
- */
197
- gutterConfig: {
198
- type: ObjectConstructor;
199
- default: () => void;
200
- };
201
- /**
202
- * Using tag
203
- */
204
- tag: {
205
- type: StringConstructor;
206
- default: string;
207
- };
208
- }, {
209
- editor: Ref<HTMLElement | undefined>;
210
- }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, CodeMirrorEmitsOptions, "update:modelValue" | "update" | "focus" | "ready" | "destroy" | "change", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
211
- /** Model value */
212
- modelValue: {
213
- type: PropType<string | Text>;
214
- default: string;
215
- };
216
- /**
217
- * Theme
218
- *
219
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
220
- */
221
- theme: {
222
- type: PropType<{
223
- [selector: string]: StyleSpec;
224
- }>;
225
- default: () => void;
226
- };
227
- /** Dark Mode */
228
- dark: {
229
- type: BooleanConstructor;
230
- default: boolean;
231
- };
232
- /**
233
- * Use Basic Setup
234
- *
235
- * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
236
- */
237
- basic: {
238
- type: BooleanConstructor;
239
- default: boolean;
240
- };
241
- /**
242
- * Use Minimal Setup (The basic setting has priority.)
243
- *
244
- * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
245
- */
246
- minimal: {
247
- type: BooleanConstructor;
248
- default: boolean;
249
- };
250
- /**
251
- * Placeholder
252
- *
253
- * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
254
- */
255
- placeholder: {
256
- type: PropType<string | HTMLElement>;
257
- default: undefined;
258
- };
259
- /**
260
- * Line wrapping
261
- *
262
- * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
263
- *
264
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
265
- */
266
- wrap: {
267
- type: BooleanConstructor;
268
- default: boolean;
269
- };
270
- /**
271
- * Allow tab key indent.
272
- *
273
- * @see {@link https://codemirror.net/examples/tab/}
274
- */
275
- tab: {
276
- type: BooleanConstructor;
277
- default: boolean;
278
- };
279
- /**
280
- * Tab size
281
- *
282
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
283
- */
284
- tabSize: {
285
- type: NumberConstructor;
286
- default: undefined;
287
- };
288
- /**
289
- * Set line break (separetor) char.
290
- *
291
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
292
- */
293
- lineSeparator: {
294
- type: StringConstructor;
295
- default: undefined;
296
- };
297
- /**
298
- * Readonly
299
- *
300
- * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
301
- */
302
- readonly: {
303
- type: BooleanConstructor;
304
- default: boolean;
305
- };
306
- /**
307
- * Disable input.
308
- *
309
- * This is the reversed value of the CodeMirror editable.
310
- * Similar to `readonly`, but setting this value to true disables dragging.
311
- *
312
- * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
313
- */
314
- disabled: {
315
- type: BooleanConstructor;
316
- default: boolean;
317
- };
318
- /**
319
- * Additional Extension
320
- *
321
- * @see {@link https://codemirror.net/docs/ref/#state.Extension}
322
- */
323
- extensions: {
324
- type: PropType<Extension[]>;
325
- default: () => never[];
326
- };
327
- /**
328
- * Language Phreses
329
- *
330
- * @see {@link https://codemirror.net/examples/translate/}
331
- */
332
- phrases: {
333
- type: PropType<Record<string, string>>;
334
- default: () => undefined;
335
- };
336
- /**
337
- * CodeMirror Language
338
- *
339
- * @see {@link https://codemirror.net/docs/ref/#language}
340
- */
341
- lang: {
342
- type: PropType<LanguageSupport>;
343
- default: () => undefined;
344
- };
345
- /**
346
- * CodeMirror Linter
347
- *
348
- * @see {@link https://codemirror.net/docs/ref/#lint.linter}
349
- */
350
- linter: {
351
- type: PropType<LintSource>;
352
- default: undefined;
353
- };
354
- /**
355
- * Linter Config
356
- *
357
- * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
358
- */
359
- linterConfig: {
360
- type: ObjectConstructor;
361
- default: () => void;
362
- };
363
- /**
364
- * Show Linter Gutter
365
- *
366
- * An area to 🔴 the lines with errors will be displayed.
367
- * This feature is not enabled if `linter` is not specified.
368
- *
369
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
370
- */
371
- gutter: {
372
- type: BooleanConstructor;
373
- defalt: boolean;
374
- };
375
- /**
376
- * Gutter Config
377
- *
378
- * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
379
- */
380
- gutterConfig: {
381
- type: ObjectConstructor;
382
- default: () => void;
383
- };
384
- /**
385
- * Using tag
386
- */
387
- tag: {
388
- type: StringConstructor;
389
- default: string;
390
- };
391
- }>> & {
392
- [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
393
- }, {
394
- modelValue: string | Text;
395
- theme: {
396
- [selector: string]: StyleSpec;
397
- };
398
- dark: boolean;
399
- basic: boolean;
400
- minimal: boolean;
401
- placeholder: string | HTMLElement;
402
- wrap: boolean;
403
- tab: boolean;
404
- tabSize: number;
405
- lineSeparator: string;
406
- readonly: boolean;
407
- disabled: boolean;
408
- extensions: Extension[];
409
- phrases: Record<string, string>;
410
- lang: LanguageSupport;
411
- linter: LintSource;
412
- linterConfig: Record<string, any>;
413
- gutter: boolean;
414
- gutterConfig: Record<string, any>;
415
- tag: string;
416
- }>;
417
- export default _default;