vue-codemirror6 1.1.22 → 1.1.24

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
@@ -4,11 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [1.1.19](https://github.com/logue/vue-codemirror6/compare/1.1.16...1.1.19)
7
+ #### [1.1.24](https://github.com/logue/vue-codemirror6/compare/1.1.16...1.1.24)
8
8
 
9
- - Fix for #17. [`5a45c9d`](https://github.com/logue/vue-codemirror6/commit/5a45c9d05d7c49ec5f738bc0af5317a6b6405e70)
10
- - Changed diagnostic counting method. Implemented to hook to ViewUpdate. [`cba57dd`](https://github.com/logue/vue-codemirror6/commit/cba57dd00333cbec27849776abd5f4f98cd4720d)
11
- - Fixed a bug that was updating the state twice in the binding process to the parent direction. [`2c303cd`](https://github.com/logue/vue-codemirror6/commit/2c303cd9616ada6d3ac07c038baa30b9de65a9ef)
9
+ - Reduce unnecessary updates [`#22`](https://github.com/logue/vue-codemirror6/pull/22)
10
+ - fix: coalescing-operator [`#20`](https://github.com/logue/vue-codemirror6/pull/20)
11
+ - Fixed merged code formatting. [`823bef0`](https://github.com/logue/vue-codemirror6/commit/823bef056c9137e0d959bb45d77378226a3df083)
12
+ - Update dependencies. [`f896b82`](https://github.com/logue/vue-codemirror6/commit/f896b82667a705b059540fef03c3db240d7be485)
13
+ - Update dependencies. [`e124cad`](https://github.com/logue/vue-codemirror6/commit/e124cad05d665c1149948e546fde17e0d28a3676)
12
14
 
13
15
  #### [1.1.16](https://github.com/logue/vue-codemirror6/compare/1.1.13...1.1.16)
14
16
 
package/dist/index.es.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.1.22
8
+ * @version 1.1.24
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -366,7 +366,9 @@ var CodeMirror = defineComponent({
366
366
  watch(
367
367
  () => props.modelValue,
368
368
  async (value) => {
369
- if (view.value.composing) {
369
+ if (view.value.composing || // IME fix
370
+ view.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
371
+ length.value = view.value.state.doc.length;
370
372
  return;
371
373
  }
372
374
  view.value.dispatch({
@@ -436,11 +438,17 @@ var CodeMirror = defineComponent({
436
438
  const getLine = (number) => view.value.state.doc.line(number + 1).text;
437
439
  const lineCount = () => view.value.state.doc.lines;
438
440
  const getCursor = () => view.value.state.selection.main.head;
439
- const listSelections = () => view.value.state.selection.ranges ?? [];
440
- const getSelection = () => view.value.state.sliceDoc(
441
- view.value.state.selection.main.from,
442
- view.value.state.selection.main.to
443
- ) ?? "";
441
+ const listSelections = () => {
442
+ let _view$value$state$sel;
443
+ return (_view$value$state$sel = view.value.state.selection.ranges) !== null && _view$value$state$sel !== void 0 ? _view$value$state$sel : [];
444
+ };
445
+ const getSelection = () => {
446
+ let _view$value$state$sli;
447
+ return (_view$value$state$sli = view.value.state.sliceDoc(
448
+ view.value.state.selection.main.from,
449
+ view.value.state.selection.main.to
450
+ )) !== null && _view$value$state$sli !== void 0 ? _view$value$state$sli : "";
451
+ };
444
452
  const getSelections = () => {
445
453
  const s = view.value.state;
446
454
  if (!s) {
@@ -517,8 +525,8 @@ var CodeMirror = defineComponent({
517
525
  });
518
526
 
519
527
  const meta = {
520
- version: "1.1.22",
521
- date: "2023-06-15T03:18:58.479Z"
528
+ version: "1.1.24",
529
+ date: "2023-08-01T23:21:42.844Z"
522
530
  };
523
531
  var meta$1 = meta;
524
532
 
@@ -5,7 +5,7 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.1.22
8
+ * @version 1.1.24
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -362,7 +362,9 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
362
362
  vueDemi.watch(
363
363
  () => props.modelValue,
364
364
  async (value) => {
365
- if (view$1.value.composing) {
365
+ if (view$1.value.composing || // IME fix
366
+ view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
367
+ length.value = view$1.value.state.doc.length;
366
368
  return;
367
369
  }
368
370
  view$1.value.dispatch({
@@ -432,11 +434,17 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
432
434
  const getLine = (number) => view$1.value.state.doc.line(number + 1).text;
433
435
  const lineCount = () => view$1.value.state.doc.lines;
434
436
  const getCursor = () => view$1.value.state.selection.main.head;
435
- const listSelections = () => view$1.value.state.selection.ranges ?? [];
436
- const getSelection = () => view$1.value.state.sliceDoc(
437
- view$1.value.state.selection.main.from,
438
- view$1.value.state.selection.main.to
439
- ) ?? "";
437
+ const listSelections = () => {
438
+ let _view$value$state$sel;
439
+ return (_view$value$state$sel = view$1.value.state.selection.ranges) !== null && _view$value$state$sel !== void 0 ? _view$value$state$sel : [];
440
+ };
441
+ const getSelection = () => {
442
+ let _view$value$state$sli;
443
+ return (_view$value$state$sli = view$1.value.state.sliceDoc(
444
+ view$1.value.state.selection.main.from,
445
+ view$1.value.state.selection.main.to
446
+ )) !== null && _view$value$state$sli !== void 0 ? _view$value$state$sli : "";
447
+ };
440
448
  const getSelections = () => {
441
449
  const s = view$1.value.state;
442
450
  if (!s) {
@@ -513,8 +521,8 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
513
521
  });
514
522
 
515
523
  const meta = {
516
- version: "1.1.22",
517
- date: "2023-06-15T03:18:58.479Z"
524
+ version: "1.1.24",
525
+ date: "2023-08-01T23:21:42.844Z"
518
526
  };
519
527
  var meta$1 = meta;
520
528
 
package/dist/index.umd.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @author Logue <logue@hotmail.co.jp>
6
6
  * @copyright 2022-2023 By Masashi Yoshikawa All rights reserved.
7
7
  * @license MIT
8
- * @version 1.1.22
8
+ * @version 1.1.24
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -365,7 +365,9 @@
365
365
  vueDemi.watch(
366
366
  () => props.modelValue,
367
367
  async (value) => {
368
- if (view$1.value.composing) {
368
+ if (view$1.value.composing || // IME fix
369
+ view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
370
+ length.value = view$1.value.state.doc.length;
369
371
  return;
370
372
  }
371
373
  view$1.value.dispatch({
@@ -435,11 +437,17 @@
435
437
  const getLine = (number) => view$1.value.state.doc.line(number + 1).text;
436
438
  const lineCount = () => view$1.value.state.doc.lines;
437
439
  const getCursor = () => view$1.value.state.selection.main.head;
438
- const listSelections = () => view$1.value.state.selection.ranges ?? [];
439
- const getSelection = () => view$1.value.state.sliceDoc(
440
- view$1.value.state.selection.main.from,
441
- view$1.value.state.selection.main.to
442
- ) ?? "";
440
+ const listSelections = () => {
441
+ let _view$value$state$sel;
442
+ return (_view$value$state$sel = view$1.value.state.selection.ranges) !== null && _view$value$state$sel !== void 0 ? _view$value$state$sel : [];
443
+ };
444
+ const getSelection = () => {
445
+ let _view$value$state$sli;
446
+ return (_view$value$state$sli = view$1.value.state.sliceDoc(
447
+ view$1.value.state.selection.main.from,
448
+ view$1.value.state.selection.main.to
449
+ )) !== null && _view$value$state$sli !== void 0 ? _view$value$state$sli : "";
450
+ };
443
451
  const getSelections = () => {
444
452
  const s = view$1.value.state;
445
453
  if (!s) {
@@ -516,8 +524,8 @@
516
524
  });
517
525
 
518
526
  const meta = {
519
- version: "1.1.22",
520
- date: "2023-06-15T03:18:58.479Z"
527
+ version: "1.1.24",
528
+ date: "2023-08-01T23:21:42.844Z"
521
529
  };
522
530
  var meta$1 = meta;
523
531
 
@@ -446,6 +446,8 @@ declare const _default: import("vue-demi").DefineComponent<{
446
446
  default: string;
447
447
  };
448
448
  }>> & {
449
+ onFocus?: ((value: boolean) => any) | undefined;
450
+ onChange?: ((value: EditorState) => any) | undefined;
449
451
  "onUpdate:modelValue"?: ((value: string | Text) => any) | undefined;
450
452
  onUpdate?: ((value: ViewUpdate) => any) | undefined;
451
453
  onReady?: ((value: {
@@ -453,16 +455,15 @@ declare const _default: import("vue-demi").DefineComponent<{
453
455
  state: EditorState;
454
456
  container: HTMLElement;
455
457
  }) => any) | undefined;
456
- onFocus?: ((value: boolean) => any) | undefined;
457
- onChange?: ((value: EditorState) => any) | undefined;
458
458
  onDestroy?: (() => any) | undefined;
459
459
  }, {
460
+ dark: boolean;
461
+ lang: LanguageSupport;
462
+ placeholder: string | HTMLElement;
460
463
  modelValue: string | Text;
461
464
  theme: Record<string, StyleSpec>;
462
- dark: boolean;
463
465
  basic: boolean;
464
466
  minimal: boolean;
465
- placeholder: string | HTMLElement;
466
467
  wrap: boolean;
467
468
  tab: boolean;
468
469
  allowMultipleSelections: boolean;
@@ -472,7 +473,6 @@ declare const _default: import("vue-demi").DefineComponent<{
472
473
  disabled: boolean;
473
474
  extensions: Extension[];
474
475
  phrases: Record<string, string>;
475
- lang: LanguageSupport;
476
476
  linter: LintSource;
477
477
  linterConfig: Record<string, any>;
478
478
  forceLinting: boolean;
File without changes
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.22",
4
+ "version": "1.1.24",
5
5
  "license": "MIT",
6
6
  "description": "CodeMirror6 Component for vue2 and vue3.",
7
7
  "keywords": [
@@ -55,7 +55,7 @@
55
55
  "engines": {
56
56
  "yarn": ">=1.22.19"
57
57
  },
58
- "packageManager": "yarn@3.6.0",
58
+ "packageManager": "yarn@3.6.1",
59
59
  "sideEffects": false,
60
60
  "scripts": {
61
61
  "dev": "vite",
@@ -81,47 +81,47 @@
81
81
  "devDependencies": {
82
82
  "@codemirror/lang-javascript": "^6.1.9",
83
83
  "@codemirror/lang-json": "^6.0.1",
84
- "@codemirror/lang-markdown": "^6.1.1",
84
+ "@codemirror/lang-markdown": "^6.2.0",
85
85
  "@codemirror/lang-vue": "^0.1.2",
86
- "@tsconfig/node-lts": "^18.12.2",
87
- "@types/node": "^20.3.1",
88
- "@typescript-eslint/eslint-plugin": "^5.59.11",
89
- "@typescript-eslint/parser": "^5.59.11",
86
+ "@tsconfig/node-lts": "^18.12.3",
87
+ "@types/node": "^20.4.5",
88
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
89
+ "@typescript-eslint/parser": "^6.2.1",
90
90
  "@vitejs/plugin-vue": "^4.2.3",
91
91
  "@vue/compiler-sfc": "^3.3.4",
92
- "@vue/eslint-config-prettier": "^7.1.0",
92
+ "@vue/eslint-config-prettier": "^8.0.0",
93
93
  "@vue/tsconfig": "^0.4.0",
94
- "@vueuse/core": "^10.1.2",
95
- "bootstrap": "5.3.0",
96
- "eslint": "^8.42.0",
94
+ "@vueuse/core": "^10.3.0",
95
+ "bootstrap": "^5.3.1",
96
+ "eslint": "^8.46.0",
97
97
  "eslint-config-standard-with-typescript": "latest",
98
98
  "eslint-import-resolver-alias": "^1.1.2",
99
99
  "eslint-import-resolver-typescript": "^3.5.5",
100
- "eslint-linter-browserify": "^8.42.0",
100
+ "eslint-linter-browserify": "^8.46.0",
101
101
  "eslint-plugin-html": "^7.1.0",
102
- "eslint-plugin-import": "^2.27.5",
103
- "eslint-plugin-n": "^16.0.0",
102
+ "eslint-plugin-import": "^2.28.0",
103
+ "eslint-plugin-n": "^16.0.1",
104
104
  "eslint-plugin-promise": "^6.1.1",
105
105
  "eslint-plugin-tsdoc": "^0.2.17",
106
106
  "eslint-plugin-vue": "latest",
107
107
  "eslint-plugin-vuejs-accessibility": "^2.1.0",
108
108
  "eslint-plugin-yaml": "^0.5.0",
109
109
  "husky": "^8.0.3",
110
- "lint-staged": "^13.2.2",
110
+ "lint-staged": "^13.2.3",
111
111
  "npm-run-all": "^4.1.5",
112
- "prettier": "^2.8.8",
112
+ "prettier": "^3.0.0",
113
113
  "rimraf": "^5.0.1",
114
114
  "rollup-plugin-visualizer": "^5.9.2",
115
- "sass": "^1.63.4",
116
- "typescript": "^5.1.3",
117
- "vite": "^4.3.9",
115
+ "sass": "^1.64.2",
116
+ "typescript": "^5.1.6",
117
+ "vite": "^4.4.8",
118
118
  "vite-plugin-banner": "^0.7.0",
119
- "vite-plugin-checker": "^0.6.0",
120
- "vite-plugin-dts": "^2.3.0",
119
+ "vite-plugin-checker": "^0.6.1",
120
+ "vite-plugin-dts": "^3.4.0",
121
121
  "vue": "^3.3.4",
122
122
  "vue-eslint-parser": "^9.3.1",
123
123
  "vue-markdown-wasm": "^0.3.9",
124
- "vue-tsc": "^1.7.0"
124
+ "vue-tsc": "^1.8.8"
125
125
  },
126
126
  "husky": {
127
127
  "hooks": {
@@ -135,6 +135,7 @@
135
135
  "resolutions": {
136
136
  "http-cache-semantics": "^4.1.1",
137
137
  "json5": "^2.2.3",
138
+ "semver": "^7.5.2",
138
139
  "yaml": "^2.2.2"
139
140
  }
140
141
  }
@@ -433,8 +433,14 @@ export default defineComponent({
433
433
  watch(
434
434
  () => props.modelValue,
435
435
  async value => {
436
- if (view.value.composing) {
437
- // IME fix
436
+ if (
437
+ view.value.composing || // IME fix
438
+ view.value.state.doc.toJSON().join(props.lineSeparator ?? '\n') ===
439
+ value // don't need to update
440
+ ) {
441
+ // Update count
442
+ length.value = view.value.state.doc.length;
443
+ // Do not commit CodeMirror's store.
438
444
  return;
439
445
  }
440
446
 
@@ -558,14 +564,23 @@ export default defineComponent({
558
564
  /** Retrieve one end of the primary selection. */
559
565
  const getCursor = (): number => view.value.state.selection.main.head;
560
566
  /** Retrieves a list of all current selections. */
561
- const listSelections = (): readonly SelectionRange[] =>
562
- view.value.state.selection.ranges ?? [];
567
+ const listSelections = (): readonly SelectionRange[] => {
568
+ let _view$value$state$sel;
569
+ return (_view$value$state$sel = view.value.state.selection.ranges) !==
570
+ null && _view$value$state$sel !== undefined
571
+ ? _view$value$state$sel
572
+ : [];
573
+ };
563
574
  /** Get the currently selected code. */
564
- const getSelection = (): string =>
565
- view.value.state.sliceDoc(
575
+ const getSelection = (): string => {
576
+ let _view$value$state$sli;
577
+ return (_view$value$state$sli = view.value.state.sliceDoc(
566
578
  view.value.state.selection.main.from,
567
579
  view.value.state.selection.main.to
568
- ) ?? '';
580
+ )) !== null && _view$value$state$sli !== undefined
581
+ ? _view$value$state$sli
582
+ : '';
583
+ };
569
584
  /**
570
585
  * The length of the given array should be the same as the number of active selections.
571
586
  * Replaces the content of the selections with the strings in the array.