nuxt-codemirror 0.0.10 → 0.0.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![License][license-src]][license-href]
6
6
  [![Nuxt][nuxt-src]][nuxt-href]
7
7
 
8
- Codemirror as a Nuxt module. Demo preview: Coming soon
8
+ Codemirror as a Nuxt module. Demo can be found in below playground
9
9
 
10
10
 
11
11
  - [✨  Release Notes](/CHANGELOG.md)
@@ -22,7 +22,7 @@ Codemirror as a Nuxt module. Demo preview: Coming soon
22
22
 
23
23
  ## Documentation
24
24
 
25
- This module consists of one Component, one Composable and a few types for you to use.
25
+ This module consists of one Component, one Composable and a few types for you to use.
26
26
  Read the CodeMirror Reference guide for more in depth information: [CodeMirror docs](https://codemirror.net/docs/ref/)
27
27
 
28
28
  ### NuxtCodeMirror.vue
@@ -128,7 +128,7 @@ interface CodeMirrorRef {
128
128
  }
129
129
  ```
130
130
 
131
- If you need access to the underlying CodeMirror instance You can do so by adding a ref with the same name as your Template ref.
131
+ If you need access to the underlying CodeMirror instance You can do so by adding a ref with the same name as your Template ref.
132
132
  An example on how to do this can be found here: [🏀 Online playground](https://stackblitz.com/edit/nuxt-starter-ev2hgm?file=app.vue)
133
133
 
134
134
 
package/dist/module.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
- declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions>;
3
+ declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions, _nuxt_schema.ModuleOptions, false>;
4
4
 
5
5
  export { _default as default };
package/dist/module.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
- declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions>;
3
+ declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions, _nuxt_schema.ModuleOptions, false>;
4
4
 
5
5
  export { _default as default };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-codemirror",
3
3
  "configKey": "nuxtCodemirror",
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.1",
6
+ "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
8
8
  }
9
9
  }
@@ -34,7 +34,7 @@ const emit = defineEmits<{
34
34
  onMounted(() => {
35
35
  useNuxtCodeMirror({
36
36
  ...props,
37
- modelValue: modelValue.value,
37
+ modelValue: modelValue,
38
38
  onChange: (value, viewUpdate) => {
39
39
  modelValue.value = value
40
40
  emit('onChange', value, viewUpdate)
@@ -7,7 +7,7 @@ const External = Annotation.define();
7
7
  const emptyExtensions = [];
8
8
  export function useNuxtCodeMirror(props) {
9
9
  const {
10
- modelValue: value = "",
10
+ modelValue: value,
11
11
  selection,
12
12
  onChange,
13
13
  onStatistics,
@@ -78,7 +78,7 @@ export function useNuxtCodeMirror(props) {
78
78
  watchEffect(() => {
79
79
  if (containerRef.value && !stateRef?.value) {
80
80
  const config = {
81
- doc: value,
81
+ doc: value?.value,
82
82
  selection,
83
83
  extensions: getExtensions
84
84
  };
@@ -133,9 +133,9 @@ export function useNuxtCodeMirror(props) {
133
133
  return;
134
134
  }
135
135
  const currentValue = viewRef.value ? viewRef.value.state.doc.toString() : "";
136
- if (viewRef.value && value !== currentValue) {
136
+ if (viewRef.value && value.value !== currentValue) {
137
137
  viewRef.value.dispatch({
138
- changes: { from: 0, to: currentValue.length, insert: value || "" },
138
+ changes: { from: 0, to: currentValue.length, insert: value.value || "" },
139
139
  annotations: [External.of(true)]
140
140
  });
141
141
  }
@@ -1,12 +1,13 @@
1
1
  import type { EditorState, EditorStateConfig, Extension, StateField, EditorSelection, SelectionRange, Line } from '@codemirror/state'
2
2
  import type { EditorView, ViewUpdate } from '@codemirror/view'
3
3
  import type { BasicSetupOptions } from '@uiw/codemirror-extensions-basic-setup'
4
+ import type { ModelRef } from 'vue'
4
5
  import type { Ref } from '#imports'
5
6
 
6
7
  export interface NuxtCodeMirrorProps
7
8
  extends Omit<EditorStateConfig, 'doc' | 'extensions'> {
8
9
  /** value of the auto created model in the editor. Works as underlying logic of a V-Model */
9
- modelValue?: string
10
+ modelValue?: ModelRef<string | undefined, string>
10
11
  /** The height value of the editor. */
11
12
  height?: string
12
13
  /** The minimum height value of the editor. */
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-codemirror",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Nuxt codemirror module",
5
5
  "repository": "https://github.com/ThimoDEV/nuxt-codemirror",
6
+ "homepage": "https://github.com/ThimoDEV/nuxt-codemirror#readme",
6
7
  "license": "MIT",
7
8
  "type": "module",
8
9
  "author": {
@@ -33,32 +34,32 @@
33
34
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
34
35
  },
35
36
  "dependencies": {
36
- "@babel/runtime": "^7.25.0",
37
- "@codemirror/commands": "^6.6.0",
38
- "@codemirror/state": "6.4.1",
39
- "@codemirror/theme-one-dark": "^6.1.1",
40
- "@codemirror/view": "6.30.0",
41
- "@nuxt/kit": "^3.12.4",
42
- "@uiw/codemirror-extensions-basic-setup": "^4.23.0"
37
+ "@babel/runtime": "^7.26.0",
38
+ "@codemirror/commands": "^6.7.1",
39
+ "@codemirror/state": "6.5.0",
40
+ "@codemirror/theme-one-dark": "^6.1.2",
41
+ "@codemirror/view": "6.36.1",
42
+ "@nuxt/kit": "^3.15.0",
43
+ "@uiw/codemirror-extensions-basic-setup": "^4.23.7"
43
44
  },
44
45
  "devDependencies": {
45
- "@nuxt/devtools": "^1.3.9",
46
- "@nuxt/eslint-config": "^0.5.0",
47
- "@nuxt/module-builder": "^0.8.1",
48
- "@nuxt/schema": "^3.12.4",
49
- "@nuxt/test-utils": "^3.13.1",
50
- "@types/node": "^20.14.11",
51
- "changelogen": "^0.5.5",
52
- "eslint": "^9.7.0",
53
- "nuxt": "^3.12.4",
54
- "typescript": "latest",
55
- "vitest": "^2.0.3",
56
- "vue-tsc": "^2.0.26"
46
+ "@nuxt/devtools": "^1.7.0",
47
+ "@nuxt/eslint-config": "^0.7.4",
48
+ "@nuxt/module-builder": "^0.8.4",
49
+ "@nuxt/schema": "^3.15.0",
50
+ "@nuxt/test-utils": "^3.15.1",
51
+ "@types/node": "^22.10.2",
52
+ "changelogen": "^0.5.7",
53
+ "eslint": "^9.17.0",
54
+ "nuxt": "^3.15.0",
55
+ "typescript": "^5.7.2",
56
+ "vitest": "^2.1.8",
57
+ "vue-tsc": "^2.2.0"
57
58
  },
58
59
  "keywords": [
59
60
  "nuxt",
60
61
  "codemirror",
61
62
  "vue"
62
63
  ],
63
- "packageManager": "pnpm@9.7.0"
64
- }
64
+ "packageManager": "pnpm@9.15.1"
65
+ }