vue-codemirror6 1.1.24 → 1.1.27

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.
@@ -0,0 +1,3 @@
1
+ /** CodeMirror Component */
2
+ declare const _default: any;
3
+ export default _default;
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.24
8
+ * @version 1.1.27
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -300,60 +300,59 @@ var CodeMirror = defineComponent({
300
300
  );
301
301
  const length = ref(0);
302
302
  const diagnosticCount$1 = ref(0);
303
- const language = new Compartment();
304
- const tabSize = new Compartment();
305
- const extensions = computed(
306
- () => (
307
- // TODO: Ignore previous prop was not changed.
308
- [
309
- // Toggle basic setup
310
- props.basic ? basicSetup : void 0,
311
- // Toggle minimal setup
312
- props.minimal && !props.basic ? minimalSetup : void 0,
313
- // ViewUpdate event listener
314
- EditorView.updateListener.of((update) => {
315
- if (update.changes.empty || !update.docChanged) {
316
- return;
317
- }
318
- if (props.linter) {
319
- if (props.forceLinting) {
320
- forceLinting(view.value);
321
- }
322
- diagnosticCount$1.value = props.linter(view.value).length;
303
+ const extensions = computed(() => {
304
+ const language = new Compartment();
305
+ const tabSize = new Compartment();
306
+ return [
307
+ // Toggle basic setup
308
+ props.basic ? basicSetup : void 0,
309
+ // Toggle minimal setup
310
+ props.minimal && !props.basic ? minimalSetup : void 0,
311
+ // ViewUpdate event listener
312
+ EditorView.updateListener.of((update) => {
313
+ context.emit("focus", view.value.hasFocus);
314
+ length.value = view.value.state.doc.length;
315
+ if (update.changes.empty || !update.docChanged) {
316
+ return;
317
+ }
318
+ if (props.linter) {
319
+ if (props.forceLinting) {
320
+ forceLinting(view.value);
323
321
  }
324
- context.emit("update", update);
325
- }),
326
- // Toggle light/dark mode.
327
- EditorView.theme(props.theme, { dark: props.dark }),
328
- // Toggle line wrapping
329
- props.wrap ? EditorView.lineWrapping : void 0,
330
- // Indent with tab
331
- props.tab ? keymap.of([indentWithTab]) : void 0,
332
- // Allow Multiple Selections
333
- EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
334
- // Indent tab size
335
- props.tabSize ? tabSize.of(EditorState.tabSize.of(props.tabSize)) : void 0,
336
- // locale settings
337
- props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
338
- // Readonly option
339
- EditorState.readOnly.of(props.readonly),
340
- // Editable option
341
- EditorView.editable.of(!props.disabled),
342
- // Set Line break char
343
- props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
344
- // Lang
345
- props.lang ? language.of(props.lang) : void 0,
346
- // Append Linter settings
347
- props.linter ? linter(props.linter, props.linterConfig) : void 0,
348
- // Show 🔴 to error line when linter enabled.
349
- props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
350
- // Placeholder
351
- props.placeholder ? placeholder(props.placeholder) : void 0,
352
- // Append Extensions
353
- ...props.extensions
354
- ].filter((extension) => !!extension)
355
- )
356
- );
322
+ diagnosticCount$1.value = props.linter(view.value).length;
323
+ }
324
+ context.emit("update", update);
325
+ }),
326
+ // Toggle light/dark mode.
327
+ EditorView.theme(props.theme, { dark: props.dark }),
328
+ // Toggle line wrapping
329
+ props.wrap ? EditorView.lineWrapping : void 0,
330
+ // Indent with tab
331
+ props.tab ? keymap.of([indentWithTab]) : void 0,
332
+ // Allow Multiple Selections
333
+ EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
334
+ // Indent tab size
335
+ props.tabSize ? tabSize.of(EditorState.tabSize.of(props.tabSize)) : void 0,
336
+ // locale settings
337
+ props.phrases ? EditorState.phrases.of(props.phrases) : void 0,
338
+ // Readonly option
339
+ EditorState.readOnly.of(props.readonly),
340
+ // Editable option
341
+ EditorView.editable.of(!props.disabled),
342
+ // Set Line break char
343
+ props.lineSeparator ? EditorState.lineSeparator.of(props.lineSeparator) : void 0,
344
+ // Lang
345
+ props.lang ? language.of(props.lang) : void 0,
346
+ // Append Linter settings
347
+ props.linter ? linter(props.linter, props.linterConfig) : void 0,
348
+ // Show 🔴 to error line when linter enabled.
349
+ props.linter && props.gutter ? lintGutter(props.gutterConfig) : void 0,
350
+ // Placeholder
351
+ props.placeholder ? placeholder(props.placeholder) : void 0,
352
+ // Append Extensions
353
+ ...props.extensions
354
+ ].filter((extension) => !!extension);
355
+ });
357
356
  watch(
358
357
  extensions,
359
358
  (exts) => {
@@ -368,7 +367,6 @@ var CodeMirror = defineComponent({
368
367
  async (value) => {
369
368
  if (view.value.composing || // IME fix
370
369
  view.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
371
- length.value = view.value.state.doc.length;
372
370
  return;
373
371
  }
374
372
  view.value.dispatch({
@@ -376,11 +374,9 @@ var CodeMirror = defineComponent({
376
374
  selection: view.value.state.selection,
377
375
  scrollIntoView: true
378
376
  });
379
- length.value = view.value.state.doc.length;
380
377
  },
381
378
  { immediate: true }
382
379
  );
383
- watch(focus, (isFocus) => context.emit("focus", isFocus));
384
380
  onMounted(async () => {
385
381
  let value = doc.value;
386
382
  if (!editor.value) {
@@ -484,6 +480,7 @@ var CodeMirror = defineComponent({
484
480
  length,
485
481
  json,
486
482
  diagnosticCount: diagnosticCount$1,
483
+ dom: view.value.contentDOM,
487
484
  lint,
488
485
  forceReconfigure,
489
486
  // Bellow is CodeMirror5's function
@@ -525,14 +522,11 @@ var CodeMirror = defineComponent({
525
522
  });
526
523
 
527
524
  const meta = {
528
- version: "1.1.24",
529
- date: "2023-08-01T23:21:42.844Z"
525
+ version: "1.1.27",
526
+ date: "2023-09-01T16:38:44.335Z"
530
527
  };
531
528
  var meta$1 = meta;
532
529
 
533
530
  const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
534
- if (typeof window !== "undefined" && window.Vue) {
535
- window.Vue.use(CodeMirror);
536
- }
537
531
 
538
532
  export { meta$1 as Meta, CodeMirror as default, installCodeMirror as install };
@@ -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.24
8
+ * @version 1.1.27
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -296,60 +296,59 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
296
296
  );
297
297
  const length = vueDemi.ref(0);
298
298
  const diagnosticCount = vueDemi.ref(0);
299
- const language = new state.Compartment();
300
- const tabSize = new state.Compartment();
301
- const extensions = vueDemi.computed(
302
- () => (
303
- // TODO: Ignore previous prop was not changed.
304
- [
305
- // Toggle basic setup
306
- props.basic ? codemirror.basicSetup : void 0,
307
- // Toggle minimal setup
308
- props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
309
- // ViewUpdate event listener
310
- view.EditorView.updateListener.of((update) => {
311
- if (update.changes.empty || !update.docChanged) {
312
- return;
313
- }
314
- if (props.linter) {
315
- if (props.forceLinting) {
316
- lint.forceLinting(view$1.value);
317
- }
318
- diagnosticCount.value = props.linter(view$1.value).length;
299
+ const extensions = vueDemi.computed(() => {
300
+ const language = new state.Compartment();
301
+ const tabSize = new state.Compartment();
302
+ return [
303
+ // Toggle basic setup
304
+ props.basic ? codemirror.basicSetup : void 0,
305
+ // Toggle minimal setup
306
+ props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
307
+ // ViewUpdate event listener
308
+ view.EditorView.updateListener.of((update) => {
309
+ context.emit("focus", view$1.value.hasFocus);
310
+ length.value = view$1.value.state.doc.length;
311
+ if (update.changes.empty || !update.docChanged) {
312
+ return;
313
+ }
314
+ if (props.linter) {
315
+ if (props.forceLinting) {
316
+ lint.forceLinting(view$1.value);
319
317
  }
320
- context.emit("update", update);
321
- }),
322
- // Toggle light/dark mode.
323
- view.EditorView.theme(props.theme, { dark: props.dark }),
324
- // Toggle line wrapping
325
- props.wrap ? view.EditorView.lineWrapping : void 0,
326
- // Indent with tab
327
- props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
328
- // Allow Multiple Selections
329
- state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
330
- // Indent tab size
331
- props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
332
- // locale settings
333
- props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
334
- // Readonly option
335
- state.EditorState.readOnly.of(props.readonly),
336
- // Editable option
337
- view.EditorView.editable.of(!props.disabled),
338
- // Set Line break char
339
- props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
340
- // Lang
341
- props.lang ? language.of(props.lang) : void 0,
342
- // Append Linter settings
343
- props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
344
- // Show 🔴 to error line when linter enabled.
345
- props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
346
- // Placeholder
347
- props.placeholder ? view.placeholder(props.placeholder) : void 0,
348
- // Append Extensions
349
- ...props.extensions
350
- ].filter((extension) => !!extension)
351
- )
352
- );
318
+ diagnosticCount.value = props.linter(view$1.value).length;
319
+ }
320
+ context.emit("update", update);
321
+ }),
322
+ // Toggle light/dark mode.
323
+ view.EditorView.theme(props.theme, { dark: props.dark }),
324
+ // Toggle line wrapping
325
+ props.wrap ? view.EditorView.lineWrapping : void 0,
326
+ // Indent with tab
327
+ props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
328
+ // Allow Multiple Selections
329
+ state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
330
+ // Indent tab size
331
+ props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
332
+ // locale settings
333
+ props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
334
+ // Readonly option
335
+ state.EditorState.readOnly.of(props.readonly),
336
+ // Editable option
337
+ view.EditorView.editable.of(!props.disabled),
338
+ // Set Line break char
339
+ props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
340
+ // Lang
341
+ props.lang ? language.of(props.lang) : void 0,
342
+ // Append Linter settings
343
+ props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
344
+ // Show 🔴 to error line when linter enabled.
345
+ props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
346
+ // Placeholder
347
+ props.placeholder ? view.placeholder(props.placeholder) : void 0,
348
+ // Append Extensions
349
+ ...props.extensions
350
+ ].filter((extension) => !!extension);
351
+ });
353
352
  vueDemi.watch(
354
353
  extensions,
355
354
  (exts) => {
@@ -364,7 +363,6 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
364
363
  async (value) => {
365
364
  if (view$1.value.composing || // IME fix
366
365
  view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
367
- length.value = view$1.value.state.doc.length;
368
366
  return;
369
367
  }
370
368
  view$1.value.dispatch({
@@ -372,11 +370,9 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
372
370
  selection: view$1.value.state.selection,
373
371
  scrollIntoView: true
374
372
  });
375
- length.value = view$1.value.state.doc.length;
376
373
  },
377
374
  { immediate: true }
378
375
  );
379
- vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
380
376
  vueDemi.onMounted(async () => {
381
377
  let value = doc.value;
382
378
  if (!editor.value) {
@@ -480,6 +476,7 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
480
476
  length,
481
477
  json,
482
478
  diagnosticCount,
479
+ dom: view$1.value.contentDOM,
483
480
  lint: lint$1,
484
481
  forceReconfigure,
485
482
  // Bellow is CodeMirror5's function
@@ -521,15 +518,12 @@ var CodeMirror = (function (exports, vueDemi, codemirror, view, state, lint, com
521
518
  });
522
519
 
523
520
  const meta = {
524
- version: "1.1.24",
525
- date: "2023-08-01T23:21:42.844Z"
521
+ version: "1.1.27",
522
+ date: "2023-09-01T16:38:44.335Z"
526
523
  };
527
524
  var meta$1 = meta;
528
525
 
529
526
  const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
530
- if (typeof window !== "undefined" && window.Vue) {
531
- window.Vue.use(CodeMirror);
532
- }
533
527
 
534
528
  exports.Meta = meta$1;
535
529
  exports["default"] = CodeMirror;
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.24
8
+ * @version 1.1.27
9
9
  * @see {@link https://github.com/logue/vue-codemirror6}
10
10
  */
11
11
 
@@ -299,60 +299,59 @@
299
299
  );
300
300
  const length = vueDemi.ref(0);
301
301
  const diagnosticCount = vueDemi.ref(0);
302
- const language = new state.Compartment();
303
- const tabSize = new state.Compartment();
304
- const extensions = vueDemi.computed(
305
- () => (
306
- // TODO: Ignore previous prop was not changed.
307
- [
308
- // Toggle basic setup
309
- props.basic ? codemirror.basicSetup : void 0,
310
- // Toggle minimal setup
311
- props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
312
- // ViewUpdate event listener
313
- view.EditorView.updateListener.of((update) => {
314
- if (update.changes.empty || !update.docChanged) {
315
- return;
316
- }
317
- if (props.linter) {
318
- if (props.forceLinting) {
319
- lint.forceLinting(view$1.value);
320
- }
321
- diagnosticCount.value = props.linter(view$1.value).length;
302
+ const extensions = vueDemi.computed(() => {
303
+ const language = new state.Compartment();
304
+ const tabSize = new state.Compartment();
305
+ return [
306
+ // Toggle basic setup
307
+ props.basic ? codemirror.basicSetup : void 0,
308
+ // Toggle minimal setup
309
+ props.minimal && !props.basic ? codemirror.minimalSetup : void 0,
310
+ // ViewUpdate event listener
311
+ view.EditorView.updateListener.of((update) => {
312
+ context.emit("focus", view$1.value.hasFocus);
313
+ length.value = view$1.value.state.doc.length;
314
+ if (update.changes.empty || !update.docChanged) {
315
+ return;
316
+ }
317
+ if (props.linter) {
318
+ if (props.forceLinting) {
319
+ lint.forceLinting(view$1.value);
322
320
  }
323
- context.emit("update", update);
324
- }),
325
- // Toggle light/dark mode.
326
- view.EditorView.theme(props.theme, { dark: props.dark }),
327
- // Toggle line wrapping
328
- props.wrap ? view.EditorView.lineWrapping : void 0,
329
- // Indent with tab
330
- props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
331
- // Allow Multiple Selections
332
- state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
333
- // Indent tab size
334
- props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
335
- // locale settings
336
- props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
337
- // Readonly option
338
- state.EditorState.readOnly.of(props.readonly),
339
- // Editable option
340
- view.EditorView.editable.of(!props.disabled),
341
- // Set Line break char
342
- props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
343
- // Lang
344
- props.lang ? language.of(props.lang) : void 0,
345
- // Append Linter settings
346
- props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
347
- // Show 🔴 to error line when linter enabled.
348
- props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
349
- // Placeholder
350
- props.placeholder ? view.placeholder(props.placeholder) : void 0,
351
- // Append Extensions
352
- ...props.extensions
353
- ].filter((extension) => !!extension)
354
- )
355
- );
321
+ diagnosticCount.value = props.linter(view$1.value).length;
322
+ }
323
+ context.emit("update", update);
324
+ }),
325
+ // Toggle light/dark mode.
326
+ view.EditorView.theme(props.theme, { dark: props.dark }),
327
+ // Toggle line wrapping
328
+ props.wrap ? view.EditorView.lineWrapping : void 0,
329
+ // Indent with tab
330
+ props.tab ? view.keymap.of([commands.indentWithTab]) : void 0,
331
+ // Allow Multiple Selections
332
+ state.EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
333
+ // Indent tab size
334
+ props.tabSize ? tabSize.of(state.EditorState.tabSize.of(props.tabSize)) : void 0,
335
+ // locale settings
336
+ props.phrases ? state.EditorState.phrases.of(props.phrases) : void 0,
337
+ // Readonly option
338
+ state.EditorState.readOnly.of(props.readonly),
339
+ // Editable option
340
+ view.EditorView.editable.of(!props.disabled),
341
+ // Set Line break char
342
+ props.lineSeparator ? state.EditorState.lineSeparator.of(props.lineSeparator) : void 0,
343
+ // Lang
344
+ props.lang ? language.of(props.lang) : void 0,
345
+ // Append Linter settings
346
+ props.linter ? lint.linter(props.linter, props.linterConfig) : void 0,
347
+ // Show 🔴 to error line when linter enabled.
348
+ props.linter && props.gutter ? lint.lintGutter(props.gutterConfig) : void 0,
349
+ // Placeholder
350
+ props.placeholder ? view.placeholder(props.placeholder) : void 0,
351
+ // Append Extensions
352
+ ...props.extensions
353
+ ].filter((extension) => !!extension);
354
+ });
356
355
  vueDemi.watch(
357
356
  extensions,
358
357
  (exts) => {
@@ -367,7 +366,6 @@
367
366
  async (value) => {
368
367
  if (view$1.value.composing || // IME fix
369
368
  view$1.value.state.doc.toJSON().join(props.lineSeparator ?? "\n") === value) {
370
- length.value = view$1.value.state.doc.length;
371
369
  return;
372
370
  }
373
371
  view$1.value.dispatch({
@@ -375,11 +373,9 @@
375
373
  selection: view$1.value.state.selection,
376
374
  scrollIntoView: true
377
375
  });
378
- length.value = view$1.value.state.doc.length;
379
376
  },
380
377
  { immediate: true }
381
378
  );
382
- vueDemi.watch(focus, (isFocus) => context.emit("focus", isFocus));
383
379
  vueDemi.onMounted(async () => {
384
380
  let value = doc.value;
385
381
  if (!editor.value) {
@@ -483,6 +479,7 @@
483
479
  length,
484
480
  json,
485
481
  diagnosticCount,
482
+ dom: view$1.value.contentDOM,
486
483
  lint: lint$1,
487
484
  forceReconfigure,
488
485
  // Bellow is CodeMirror5's function
@@ -524,15 +521,12 @@
524
521
  });
525
522
 
526
523
  const meta = {
527
- version: "1.1.24",
528
- date: "2023-08-01T23:21:42.844Z"
524
+ version: "1.1.27",
525
+ date: "2023-09-01T16:38:44.335Z"
529
526
  };
530
527
  var meta$1 = meta;
531
528
 
532
529
  const installCodeMirror = (app) => app.component("CodeMirror", CodeMirror);
533
- if (typeof window !== "undefined" && window.Vue) {
534
- window.Vue.use(CodeMirror);
535
- }
536
530
 
537
531
  exports.Meta = meta$1;
538
532
  exports["default"] = CodeMirror;
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.24",
4
+ "version": "1.1.27",
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/src/index.d.ts",
39
+ "types": "dist/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/src/index.d.ts"
44
+ "types": "./dist/index.d.ts"
45
45
  }
46
46
  },
47
47
  "files": [
@@ -55,7 +55,7 @@
55
55
  "engines": {
56
56
  "yarn": ">=1.22.19"
57
57
  },
58
- "packageManager": "yarn@3.6.1",
58
+ "packageManager": "yarn@3.6.3",
59
59
  "sideEffects": false,
60
60
  "scripts": {
61
61
  "dev": "vite",
@@ -79,48 +79,47 @@
79
79
  "vue": "^2.7.14 || ^3.2"
80
80
  },
81
81
  "devDependencies": {
82
- "@codemirror/lang-javascript": "^6.1.9",
82
+ "@codemirror/lang-javascript": "^6.2.1",
83
83
  "@codemirror/lang-json": "^6.0.1",
84
84
  "@codemirror/lang-markdown": "^6.2.0",
85
85
  "@codemirror/lang-vue": "^0.1.2",
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
- "@vitejs/plugin-vue": "^4.2.3",
86
+ "@tsconfig/node-lts": "^18.12.5",
87
+ "@types/node": "^20.5.7",
88
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
89
+ "@vitejs/plugin-vue": "^4.3.4",
91
90
  "@vue/compiler-sfc": "^3.3.4",
92
91
  "@vue/eslint-config-prettier": "^8.0.0",
93
92
  "@vue/tsconfig": "^0.4.0",
94
- "@vueuse/core": "^10.3.0",
93
+ "@vueuse/core": "^10.4.1",
95
94
  "bootstrap": "^5.3.1",
96
- "eslint": "^8.46.0",
97
- "eslint-config-standard-with-typescript": "latest",
95
+ "eslint": "^8.48.0",
96
+ "eslint-config-standard-with-typescript": "^39.0.0",
98
97
  "eslint-import-resolver-alias": "^1.1.2",
99
- "eslint-import-resolver-typescript": "^3.5.5",
100
- "eslint-linter-browserify": "^8.46.0",
98
+ "eslint-import-resolver-typescript": "^3.6.0",
99
+ "eslint-linter-browserify": "^8.48.0",
101
100
  "eslint-plugin-html": "^7.1.0",
102
- "eslint-plugin-import": "^2.28.0",
103
- "eslint-plugin-n": "^16.0.1",
101
+ "eslint-plugin-import": "^2.28.1",
102
+ "eslint-plugin-n": "^16.0.2",
104
103
  "eslint-plugin-promise": "^6.1.1",
105
104
  "eslint-plugin-tsdoc": "^0.2.17",
106
105
  "eslint-plugin-vue": "latest",
107
- "eslint-plugin-vuejs-accessibility": "^2.1.0",
106
+ "eslint-plugin-vuejs-accessibility": "^2.2.0",
108
107
  "eslint-plugin-yaml": "^0.5.0",
109
108
  "husky": "^8.0.3",
110
- "lint-staged": "^13.2.3",
109
+ "lint-staged": "^14.0.1",
111
110
  "npm-run-all": "^4.1.5",
112
- "prettier": "^3.0.0",
111
+ "prettier": "^3.0.3",
113
112
  "rimraf": "^5.0.1",
114
113
  "rollup-plugin-visualizer": "^5.9.2",
115
- "sass": "^1.64.2",
116
- "typescript": "^5.1.6",
117
- "vite": "^4.4.8",
114
+ "sass": "^1.66.1",
115
+ "typescript": "^5.2.2",
116
+ "vite": "^4.4.9",
118
117
  "vite-plugin-banner": "^0.7.0",
119
- "vite-plugin-checker": "^0.6.1",
120
- "vite-plugin-dts": "^3.4.0",
118
+ "vite-plugin-checker": "^0.6.2",
119
+ "vite-plugin-dts": "^3.5.3",
121
120
  "vue": "^3.3.4",
122
121
  "vue-eslint-parser": "^9.3.1",
123
- "vue-markdown-wasm": "^0.3.9",
122
+ "vue-markdown-wasm": "^0.3.12",
124
123
  "vue-tsc": "^1.8.8"
125
124
  },
126
125
  "husky": {
@@ -347,22 +347,26 @@ export default defineComponent({
347
347
  */
348
348
  const diagnosticCount: Ref<number> = ref(0);
349
349
 
350
- // Synamic Reconfiguration
351
- // @see https://codemirror.net/examples/config/
352
-
353
- const language = new Compartment();
354
- const tabSize = new Compartment();
355
-
356
350
  /** Get CodeMirror Extension */
357
- const extensions: ComputedRef<Extension[]> = computed(() =>
351
+ const extensions: ComputedRef<Extension[]> = computed(() => {
352
+ // Synamic Reconfiguration
353
+ // @see https://codemirror.net/examples/config/
354
+ const language = new Compartment();
355
+ const tabSize = new Compartment();
356
+
358
357
  // TODO: Ignore previous prop was not changed.
359
- [
358
+ return [
360
359
  // Toggle basic setup
361
360
  props.basic ? basicSetup : undefined,
362
361
  // Toggle minimal setup
363
362
  props.minimal && !props.basic ? minimalSetup : undefined,
364
363
  // ViewUpdate event listener
365
364
  EditorView.updateListener.of((update: ViewUpdate): void => {
365
+ // Emit focus status
366
+ context.emit('focus', view.value.hasFocus);
367
+ // Update count
368
+ length.value = view.value.state.doc.length;
369
+
366
370
  if (update.changes.empty || !update.docChanged) {
367
371
  // Suppress event firing if no change
368
372
  return;
@@ -378,7 +382,6 @@ export default defineComponent({
378
382
  props.linter(view.value) as readonly Diagnostic[]
379
383
  ).length;
380
384
  }
381
-
382
385
  context.emit('update', update);
383
386
  }),
384
387
  // Toggle light/dark mode.
@@ -415,8 +418,8 @@ export default defineComponent({
415
418
  props.placeholder ? placeholder(props.placeholder) : undefined,
416
419
  // Append Extensions
417
420
  ...props.extensions,
418
- ].filter((extension): extension is Extension => !!extension)
419
- );
421
+ ].filter((extension): extension is Extension => !!extension);
422
+ });
420
423
 
421
424
  // Extension (mostly props) Changed
422
425
  watch(
@@ -438,8 +441,6 @@ export default defineComponent({
438
441
  view.value.state.doc.toJSON().join(props.lineSeparator ?? '\n') ===
439
442
  value // don't need to update
440
443
  ) {
441
- // Update count
442
- length.value = view.value.state.doc.length;
443
444
  // Do not commit CodeMirror's store.
444
445
  return;
445
446
  }
@@ -450,15 +451,10 @@ export default defineComponent({
450
451
  selection: view.value.state.selection,
451
452
  scrollIntoView: true,
452
453
  });
453
- // Update count
454
- length.value = view.value.state.doc.length;
455
454
  },
456
455
  { immediate: true }
457
456
  );
458
457
 
459
- // focus changed
460
- watch(focus, isFocus => context.emit('focus', isFocus));
461
-
462
458
  /** When loaded */
463
459
  onMounted(async () => {
464
460
  /** Initial value */
@@ -673,6 +669,7 @@ export default defineComponent({
673
669
  length,
674
670
  json,
675
671
  diagnosticCount,
672
+ dom: view.value.contentDOM,
676
673
  lint,
677
674
  forceReconfigure,
678
675
  // Bellow is CodeMirror5's function
@@ -1,483 +0,0 @@
1
- import { type PropType, type Ref, type ShallowRef, type WritableComputedRef } from 'vue-demi';
2
- import { EditorView, type ViewUpdate } from '@codemirror/view';
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, {
233
- /** Model Update */
234
- 'update:modelValue': (value: string | Text) => boolean;
235
- /** CodeMirror ViewUpdate */
236
- update: (value: ViewUpdate) => boolean;
237
- /** CodeMirror onReady */
238
- ready: (value: {
239
- view: EditorView;
240
- state: EditorState;
241
- container: HTMLElement;
242
- }) => boolean;
243
- /** CodeMirror onFocus */
244
- focus: (value: boolean) => boolean;
245
- /** State Changed */
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
- onFocus?: ((value: boolean) => any) | undefined;
450
- onChange?: ((value: EditorState) => any) | undefined;
451
- "onUpdate:modelValue"?: ((value: string | Text) => any) | undefined;
452
- onUpdate?: ((value: ViewUpdate) => any) | undefined;
453
- onReady?: ((value: {
454
- view: EditorView;
455
- state: EditorState;
456
- container: HTMLElement;
457
- }) => any) | undefined;
458
- onDestroy?: (() => any) | undefined;
459
- }, {
460
- dark: boolean;
461
- lang: LanguageSupport;
462
- placeholder: string | HTMLElement;
463
- modelValue: string | Text;
464
- theme: Record<string, StyleSpec>;
465
- basic: boolean;
466
- minimal: boolean;
467
- wrap: boolean;
468
- tab: boolean;
469
- allowMultipleSelections: boolean;
470
- tabSize: number;
471
- lineSeparator: string;
472
- readonly: boolean;
473
- disabled: boolean;
474
- extensions: Extension[];
475
- phrases: Record<string, string>;
476
- linter: LintSource;
477
- linterConfig: Record<string, any>;
478
- forceLinting: boolean;
479
- gutter: boolean;
480
- gutterConfig: Record<string, any>;
481
- tag: string;
482
- }, {}>;
483
- export default _default;
@@ -1,20 +0,0 @@
1
- /**
2
- * h-demi - h function for Vue 2 and 3
3
- *
4
- * @see {@link https://github.com/vueuse/vue-demi/issues/65}
5
- */
6
- import { type Slots, type VNode, type VNodeProps } from 'vue-demi';
7
- interface Options extends VNodeProps {
8
- class?: string;
9
- domProps?: VNodeProps;
10
- on?: Record<string, () => void>;
11
- props?: VNodeProps;
12
- style?: string;
13
- 'aria-hidden'?: string;
14
- }
15
- /**
16
- * hDemi function.
17
- */
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 {};
@@ -1,7 +0,0 @@
1
- /** Build information meta data */
2
- export default interface MetaInterface {
3
- /** Version */
4
- version: string;
5
- /** Build date */
6
- date: string;
7
- }
File without changes
File without changes
File without changes