vue-codemirror6 1.1.16 → 1.1.19

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.
@@ -1,25 +1,483 @@
1
- import { type ObjectEmitsOptions } from 'vue-demi';
2
- import { EditorState, type Text } from '@codemirror/state';
1
+ import { type PropType, type Ref, type ShallowRef, type WritableComputedRef } from 'vue-demi';
3
2
  import { EditorView, type ViewUpdate } from '@codemirror/view';
4
- /** Emit Interface */
5
- export interface CodeMirrorEmitsOptions extends ObjectEmitsOptions {
3
+ import { EditorSelection, EditorState, type Extension, type SelectionRange, type StateField, type Text } from '@codemirror/state';
4
+ import { type LintSource } from '@codemirror/lint';
5
+ import type { LanguageSupport } from '@codemirror/language';
6
+ import type { StyleSpec } from 'style-mod';
7
+ /** CodeMirror Component */
8
+ declare const _default: import("vue-demi").DefineComponent<{
9
+ /** Model value */
10
+ modelValue: {
11
+ type: PropType<string | Text>;
12
+ default: string;
13
+ };
14
+ /**
15
+ * Theme
16
+ *
17
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
18
+ */
19
+ theme: {
20
+ type: PropType<Record<string, StyleSpec>>;
21
+ default: () => void;
22
+ };
23
+ /** Dark Mode */
24
+ dark: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ /**
29
+ * Use Basic Setup
30
+ *
31
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
32
+ */
33
+ basic: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ /**
38
+ * Use Minimal Setup (The basic setting has priority.)
39
+ *
40
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
41
+ */
42
+ minimal: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ /**
47
+ * Placeholder
48
+ *
49
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
50
+ */
51
+ placeholder: {
52
+ type: PropType<string | HTMLElement>;
53
+ default: undefined;
54
+ };
55
+ /**
56
+ * Line wrapping
57
+ *
58
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
59
+ *
60
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
61
+ */
62
+ wrap: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ /**
67
+ * Allow tab key indent.
68
+ *
69
+ * @see {@link https://codemirror.net/examples/tab/}
70
+ */
71
+ tab: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ /**
76
+ * Allow Multiple Selection.
77
+ *
78
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
79
+ */
80
+ allowMultipleSelections: {
81
+ type: BooleanConstructor;
82
+ default: boolean;
83
+ };
84
+ /**
85
+ * Tab size
86
+ *
87
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
88
+ */
89
+ tabSize: {
90
+ type: NumberConstructor;
91
+ default: undefined;
92
+ };
93
+ /**
94
+ * Set line break (separetor) char.
95
+ *
96
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
97
+ */
98
+ lineSeparator: {
99
+ type: StringConstructor;
100
+ default: undefined;
101
+ };
102
+ /**
103
+ * Readonly
104
+ *
105
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
106
+ */
107
+ readonly: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ /**
112
+ * Disable input.
113
+ *
114
+ * This is the reversed value of the CodeMirror editable.
115
+ * Similar to `readonly`, but setting this value to true disables dragging.
116
+ *
117
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
118
+ */
119
+ disabled: {
120
+ type: BooleanConstructor;
121
+ default: boolean;
122
+ };
123
+ /**
124
+ * Additional Extension
125
+ *
126
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
127
+ */
128
+ extensions: {
129
+ type: PropType<Extension[]>;
130
+ default: () => never[];
131
+ };
132
+ /**
133
+ * Language Phreses
134
+ *
135
+ * @see {@link https://codemirror.net/examples/translate/}
136
+ */
137
+ phrases: {
138
+ type: PropType<Record<string, string>>;
139
+ default: () => undefined;
140
+ };
141
+ /**
142
+ * CodeMirror Language
143
+ *
144
+ * @see {@link https://codemirror.net/docs/ref/#language}
145
+ */
146
+ lang: {
147
+ type: PropType<LanguageSupport>;
148
+ default: () => undefined;
149
+ };
150
+ /**
151
+ * CodeMirror Linter
152
+ *
153
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
154
+ */
155
+ linter: {
156
+ type: PropType<LintSource>;
157
+ default: undefined;
158
+ };
159
+ /**
160
+ * Linter Config
161
+ *
162
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
163
+ */
164
+ linterConfig: {
165
+ type: ObjectConstructor;
166
+ default: () => {
167
+ needsRefresh: boolean;
168
+ };
169
+ };
170
+ /**
171
+ * Forces any linters configured to run when the editor is idle to run right away.
172
+ *
173
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
174
+ */
175
+ forceLinting: {
176
+ type: BooleanConstructor;
177
+ default: boolean;
178
+ };
179
+ /**
180
+ * Show Linter Gutter
181
+ *
182
+ * An area to 🔴 the lines with errors will be displayed.
183
+ * This feature is not enabled if `linter` is not specified.
184
+ *
185
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
186
+ */
187
+ gutter: {
188
+ type: BooleanConstructor;
189
+ defalt: boolean;
190
+ };
191
+ /**
192
+ * Gutter Config
193
+ *
194
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
195
+ */
196
+ gutterConfig: {
197
+ type: ObjectConstructor;
198
+ default: () => undefined;
199
+ };
200
+ /**
201
+ * Using tag
202
+ */
203
+ tag: {
204
+ type: StringConstructor;
205
+ default: string;
206
+ };
207
+ }, {
208
+ editor: Ref<HTMLElement | undefined>;
209
+ view: ShallowRef<EditorView>;
210
+ cursor: WritableComputedRef<number>;
211
+ selection: WritableComputedRef<EditorSelection>;
212
+ focus: WritableComputedRef<boolean>;
213
+ length: Ref<number>;
214
+ json: WritableComputedRef<Record<string, StateField<any>>>;
215
+ diagnosticCount: Ref<number>;
216
+ lint: () => void;
217
+ forceReconfigure: () => void;
218
+ getRange: (from?: number, to?: number) => string | undefined;
219
+ getLine: (number: number) => string;
220
+ lineCount: () => number;
221
+ getCursor: () => number;
222
+ listSelections: () => readonly SelectionRange[];
223
+ getSelection: () => string;
224
+ getSelections: () => string[];
225
+ somethingSelected: () => boolean;
226
+ replaceRange: (replacement: string | Text, from: number, to: number) => void;
227
+ replaceSelection: (replacement: string | Text) => void;
228
+ setCursor: (position: number) => void;
229
+ setSelection: (anchor: number, head?: number) => void;
230
+ setSelections: (ranges: readonly SelectionRange[], primary?: number) => void;
231
+ extendSelectionsBy: (f: any) => void;
232
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
6
233
  /** Model Update */
7
- (e: 'update:modelValue', value: string | Text): void;
234
+ 'update:modelValue': (value: string | Text) => boolean;
8
235
  /** CodeMirror ViewUpdate */
9
- (e: 'update', value: ViewUpdate): void;
10
- /** CodeMirror onFocus */
11
- (e: 'focus', value: boolean): void;
236
+ update: (value: ViewUpdate) => boolean;
12
237
  /** CodeMirror onReady */
13
- (e: 'ready', value: {
238
+ ready: (value: {
14
239
  view: EditorView;
15
240
  state: EditorState;
16
241
  container: HTMLElement;
17
- }): void;
18
- /** CodeMirror onDestroy */
19
- (e: 'destroy'): void;
242
+ }) => boolean;
243
+ /** CodeMirror onFocus */
244
+ focus: (value: boolean) => boolean;
20
245
  /** State Changed */
21
- (e: 'change', value: EditorState): void;
22
- }
23
- /** CodeMirror Component */
24
- declare const _default: import("vue-demi").DefineComponent<unknown, object, {}, import("vue-demi").ComputedOptions, import("vue-demi").MethodOptions, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<unknown>, {}>;
246
+ change: (value: EditorState) => boolean;
247
+ /** CodeMirror onDestroy */
248
+ destroy: () => boolean;
249
+ }, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
250
+ /** Model value */
251
+ modelValue: {
252
+ type: PropType<string | Text>;
253
+ default: string;
254
+ };
255
+ /**
256
+ * Theme
257
+ *
258
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^theme}
259
+ */
260
+ theme: {
261
+ type: PropType<Record<string, StyleSpec>>;
262
+ default: () => void;
263
+ };
264
+ /** Dark Mode */
265
+ dark: {
266
+ type: BooleanConstructor;
267
+ default: boolean;
268
+ };
269
+ /**
270
+ * Use Basic Setup
271
+ *
272
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.basicSetup}
273
+ */
274
+ basic: {
275
+ type: BooleanConstructor;
276
+ default: boolean;
277
+ };
278
+ /**
279
+ * Use Minimal Setup (The basic setting has priority.)
280
+ *
281
+ * @see {@link https://codemirror.net/docs/ref/#codemirror.minimalSetup}
282
+ */
283
+ minimal: {
284
+ type: BooleanConstructor;
285
+ default: boolean;
286
+ };
287
+ /**
288
+ * Placeholder
289
+ *
290
+ * @see {@link https://codemirror.net/docs/ref/#view.placeholder}
291
+ */
292
+ placeholder: {
293
+ type: PropType<string | HTMLElement>;
294
+ default: undefined;
295
+ };
296
+ /**
297
+ * Line wrapping
298
+ *
299
+ * An extension that enables line wrapping in the editor (by setting CSS white-space to pre-wrap in the content).
300
+ *
301
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView%5ElineWrapping}
302
+ */
303
+ wrap: {
304
+ type: BooleanConstructor;
305
+ default: boolean;
306
+ };
307
+ /**
308
+ * Allow tab key indent.
309
+ *
310
+ * @see {@link https://codemirror.net/examples/tab/}
311
+ */
312
+ tab: {
313
+ type: BooleanConstructor;
314
+ default: boolean;
315
+ };
316
+ /**
317
+ * Allow Multiple Selection.
318
+ *
319
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^allowMultipleSelections}
320
+ */
321
+ allowMultipleSelections: {
322
+ type: BooleanConstructor;
323
+ default: boolean;
324
+ };
325
+ /**
326
+ * Tab size
327
+ *
328
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^tabSize}
329
+ */
330
+ tabSize: {
331
+ type: NumberConstructor;
332
+ default: undefined;
333
+ };
334
+ /**
335
+ * Set line break (separetor) char.
336
+ *
337
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^lineSeparator}
338
+ */
339
+ lineSeparator: {
340
+ type: StringConstructor;
341
+ default: undefined;
342
+ };
343
+ /**
344
+ * Readonly
345
+ *
346
+ * @see {@link https://codemirror.net/docs/ref/#state.EditorState^readOnly}
347
+ */
348
+ readonly: {
349
+ type: BooleanConstructor;
350
+ default: boolean;
351
+ };
352
+ /**
353
+ * Disable input.
354
+ *
355
+ * This is the reversed value of the CodeMirror editable.
356
+ * Similar to `readonly`, but setting this value to true disables dragging.
357
+ *
358
+ * @see {@link https://codemirror.net/docs/ref/#view.EditorView^editable}
359
+ */
360
+ disabled: {
361
+ type: BooleanConstructor;
362
+ default: boolean;
363
+ };
364
+ /**
365
+ * Additional Extension
366
+ *
367
+ * @see {@link https://codemirror.net/docs/ref/#state.Extension}
368
+ */
369
+ extensions: {
370
+ type: PropType<Extension[]>;
371
+ default: () => never[];
372
+ };
373
+ /**
374
+ * Language Phreses
375
+ *
376
+ * @see {@link https://codemirror.net/examples/translate/}
377
+ */
378
+ phrases: {
379
+ type: PropType<Record<string, string>>;
380
+ default: () => undefined;
381
+ };
382
+ /**
383
+ * CodeMirror Language
384
+ *
385
+ * @see {@link https://codemirror.net/docs/ref/#language}
386
+ */
387
+ lang: {
388
+ type: PropType<LanguageSupport>;
389
+ default: () => undefined;
390
+ };
391
+ /**
392
+ * CodeMirror Linter
393
+ *
394
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter}
395
+ */
396
+ linter: {
397
+ type: PropType<LintSource>;
398
+ default: undefined;
399
+ };
400
+ /**
401
+ * Linter Config
402
+ *
403
+ * @see {@link https://codemirror.net/docs/ref/#lint.linter^config}
404
+ */
405
+ linterConfig: {
406
+ type: ObjectConstructor;
407
+ default: () => {
408
+ needsRefresh: boolean;
409
+ };
410
+ };
411
+ /**
412
+ * Forces any linters configured to run when the editor is idle to run right away.
413
+ *
414
+ * @see {@link https://codemirror.net/docs/ref/#lint.forceLinting}
415
+ */
416
+ forceLinting: {
417
+ type: BooleanConstructor;
418
+ default: boolean;
419
+ };
420
+ /**
421
+ * Show Linter Gutter
422
+ *
423
+ * An area to 🔴 the lines with errors will be displayed.
424
+ * This feature is not enabled if `linter` is not specified.
425
+ *
426
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter}
427
+ */
428
+ gutter: {
429
+ type: BooleanConstructor;
430
+ defalt: boolean;
431
+ };
432
+ /**
433
+ * Gutter Config
434
+ *
435
+ * @see {@link https://codemirror.net/docs/ref/#lint.lintGutter^config}
436
+ */
437
+ gutterConfig: {
438
+ type: ObjectConstructor;
439
+ default: () => undefined;
440
+ };
441
+ /**
442
+ * Using tag
443
+ */
444
+ tag: {
445
+ type: StringConstructor;
446
+ default: string;
447
+ };
448
+ }>> & {
449
+ "onUpdate:modelValue"?: ((value: string | Text) => any) | undefined;
450
+ onUpdate?: ((value: ViewUpdate) => any) | undefined;
451
+ onReady?: ((value: {
452
+ view: EditorView;
453
+ state: EditorState;
454
+ container: HTMLElement;
455
+ }) => any) | undefined;
456
+ onFocus?: ((value: boolean) => any) | undefined;
457
+ onChange?: ((value: EditorState) => any) | undefined;
458
+ onDestroy?: (() => any) | undefined;
459
+ }, {
460
+ modelValue: string | Text;
461
+ theme: Record<string, StyleSpec>;
462
+ dark: boolean;
463
+ basic: boolean;
464
+ minimal: boolean;
465
+ placeholder: string | HTMLElement;
466
+ wrap: boolean;
467
+ tab: boolean;
468
+ allowMultipleSelections: boolean;
469
+ tabSize: number;
470
+ lineSeparator: string;
471
+ readonly: boolean;
472
+ disabled: boolean;
473
+ extensions: Extension[];
474
+ phrases: Record<string, string>;
475
+ lang: LanguageSupport;
476
+ linter: LintSource;
477
+ linterConfig: Record<string, any>;
478
+ forceLinting: boolean;
479
+ gutter: boolean;
480
+ gutterConfig: Record<string, any>;
481
+ tag: string;
482
+ }>;
25
483
  export default _default;
@@ -6,15 +6,15 @@
6
6
  import { type Slots, type VNode, type VNodeProps } from 'vue-demi';
7
7
  interface Options extends VNodeProps {
8
8
  class?: string;
9
- domProps?: Record<any, any>;
10
- on?: Record<any, any>;
11
- props?: Record<any, any>;
9
+ domProps?: VNodeProps;
10
+ on?: Record<string, () => void>;
11
+ props?: VNodeProps;
12
12
  style?: string;
13
13
  'aria-hidden'?: string;
14
14
  }
15
15
  /**
16
16
  * hDemi function.
17
17
  */
18
- declare function h(type: string | Record<any, any>, options?: Options, chidren?: any): VNode;
19
- declare const slot: (defaultSlots: any) => Slots;
20
- export { slot, h as default };
18
+ export default function h(type: string | Record<any, any>, options?: Options, chidren?: any): VNode;
19
+ export declare const slot: (defaultSlots: any) => Slots;
20
+ export {};
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.16",
4
+ "version": "1.1.19",
5
5
  "license": "MIT",
6
6
  "description": "CodeMirror6 Component for vue2 and vue3.",
7
7
  "keywords": [
@@ -53,7 +53,6 @@
53
53
  "./sfc": "./src/components/CodeMirror.ts"
54
54
  },
55
55
  "engines": {
56
- "node": ">=18.15.0",
57
56
  "yarn": ">=1.22.19"
58
57
  },
59
58
  "packageManager": "yarn@3.5.0",
@@ -74,33 +73,34 @@
74
73
  },
75
74
  "dependencies": {
76
75
  "codemirror": "^6.0.1",
77
- "lodash": "^4.17.21",
78
76
  "vue-demi": "latest"
79
77
  },
80
78
  "peerDependencies": {
81
- "vue": "^2.7.14 || ^3.2.47"
79
+ "vue": "^2.7.14 || ^3.2"
82
80
  },
83
81
  "devDependencies": {
84
- "@codemirror/lang-javascript": "^6.1.4",
82
+ "@codemirror/lang-javascript": "^6.1.5",
85
83
  "@codemirror/lang-json": "^6.0.1",
86
84
  "@codemirror/lang-markdown": "^6.1.0",
87
85
  "@codemirror/lang-vue": "^0.1.1",
88
- "@types/lodash": "^4.14.191",
89
- "@types/node": "^18.15.3",
90
- "@typescript-eslint/eslint-plugin": "^5.55.0",
91
- "@typescript-eslint/parser": "^5.55.0",
86
+ "@types/lodash": "^4.14.192",
87
+ "@types/node": "^18.15.11",
88
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
89
+ "@typescript-eslint/parser": "^5.57.1",
92
90
  "@vitejs/plugin-vue": "^4.1.0",
91
+ "@vue/compiler-sfc": "^3.2.47",
93
92
  "@vue/eslint-config-prettier": "^7.1.0",
94
93
  "@vue/tsconfig": "^0.1.3",
95
94
  "@vueuse/core": "^9.13.0",
96
- "eslint": "^8.36.0",
95
+ "bootstrap": "5.3.0-alpha2",
96
+ "eslint": "^8.37.0",
97
97
  "eslint-config-standard-with-typescript": "latest",
98
98
  "eslint-import-resolver-alias": "^1.1.2",
99
- "eslint-import-resolver-typescript": "^3.5.3",
100
- "eslint-linter-browserify": "^8.36.0",
99
+ "eslint-import-resolver-typescript": "^3.5.4",
100
+ "eslint-linter-browserify": "^8.37.0",
101
101
  "eslint-plugin-html": "^7.1.0",
102
102
  "eslint-plugin-import": "^2.27.5",
103
- "eslint-plugin-n": "^15.6.1",
103
+ "eslint-plugin-n": "^15.7.0",
104
104
  "eslint-plugin-promise": "^6.1.1",
105
105
  "eslint-plugin-tsdoc": "^0.2.17",
106
106
  "eslint-plugin-vue": "latest",
@@ -109,17 +109,17 @@
109
109
  "husky": "^8.0.3",
110
110
  "lint-staged": "^13.2.0",
111
111
  "npm-run-all": "^4.1.5",
112
- "prettier": "^2.8.4",
113
- "rimraf": "^4.4.0",
112
+ "prettier": "^2.8.7",
113
+ "rimraf": "^4.4.1",
114
114
  "rollup-plugin-visualizer": "^5.9.0",
115
- "sass": "^1.59.3",
115
+ "sass": "^1.60.0",
116
116
  "typescript": "^4.9.5",
117
- "vite": "^4.2.0",
117
+ "vite": "^4.2.1",
118
118
  "vite-plugin-banner": "^0.7.0",
119
119
  "vite-plugin-checker": "^0.5.6",
120
- "vite-plugin-dts": "^2.1.0",
120
+ "vite-plugin-dts": "^2.2.0",
121
121
  "vue": "^3.2.47",
122
- "vue-eslint-parser": "^9.1.0",
122
+ "vue-eslint-parser": "^9.1.1",
123
123
  "vue-markdown-wasm": "^0.3.6",
124
124
  "vue-tsc": "^1.2.0"
125
125
  },