nuxt-codemirror 0.0.16 → 0.0.18

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/dist/module.d.mts CHANGED
@@ -5,4 +5,5 @@ interface ModuleOptions {
5
5
  }
6
6
  declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions, _nuxt_schema.ModuleOptions, false>;
7
7
 
8
- export { type ModuleOptions, _default as default };
8
+ export { _default as default };
9
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-codemirror",
3
3
  "configKey": "nuxtCodemirror",
4
- "version": "0.0.16",
4
+ "version": "0.0.18",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.4",
7
- "unbuild": "2.0.0"
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, addComponent, addImports, addTypeTemplate, extendViteConfig } from '@nuxt/kit';
2
2
 
3
- const module = defineNuxtModule({
3
+ const module$1 = defineNuxtModule({
4
4
  meta: {
5
5
  name: "nuxt-codemirror",
6
6
  configKey: "nuxtCodemirror"
@@ -33,4 +33,4 @@ const module = defineNuxtModule({
33
33
  }
34
34
  });
35
35
 
36
- export { module as default };
36
+ export { module$1 as default };
@@ -1,78 +1,82 @@
1
- <script setup lang="ts">
2
- import type { ViewUpdate, EditorView } from '@codemirror/view'
3
- import type { EditorState } from '@codemirror/state'
4
- import { useNuxtCodeMirror } from '../composables/useNuxtCodeMirror'
5
- import type { NuxtCodeMirrorProps, Statistics } from '../types/nuxt-codemirror'
6
- import { onMounted, ref, watch, computed, onBeforeUnmount } from '#imports'
7
-
8
- const editor = ref<HTMLDivElement | null>(null)
9
- const container = ref<HTMLDivElement | null>(null)
10
- const view = ref<EditorView>()
11
- const state = ref<EditorState>()
12
-
13
- const modelValue = defineModel<string>({ default: '' })
14
-
15
- const props = withDefaults(defineProps<Omit<NuxtCodeMirrorProps, 'modelValue'>>(), {
16
- extensions: () => [],
17
- theme: 'light',
18
- })
19
-
20
- defineExpose({
21
- container,
22
- view,
23
- state,
24
- editor,
25
- })
26
-
27
- const emit = defineEmits<{
28
- (event: 'onChange', value: string, viewUpdate: ViewUpdate): void
29
- (event: 'onStatistics', data: Statistics): void
30
- (event: 'onCreateEditor', editor: { view: EditorView, state: EditorState }): void
31
- (event: 'onUpdate' | 'onFocus' | 'onBlur', update: ViewUpdate): void
32
- }>()
33
-
34
- onMounted(() => {
35
- useNuxtCodeMirror({
36
- ...props,
37
- modelValue: modelValue,
38
- onChange: (value, viewUpdate) => {
39
- modelValue.value = value
40
- emit('onChange', value, viewUpdate)
41
- },
42
- onStatistics: data => emit('onStatistics', data),
43
- onCreateEditor: (view, state) => emit('onCreateEditor', { view, state }),
44
- onUpdate: viewUpdate => emit('onUpdate', viewUpdate),
45
- onFocus: viewUpdate => emit('onFocus', viewUpdate),
46
- onBlur: viewUpdate => emit('onBlur', viewUpdate),
47
- container: editor.value,
48
- viewRef: view,
49
- stateRef: state,
50
- containerRef: container,
51
- })
52
- })
53
-
54
- onBeforeUnmount(() => {
55
- if (view.value) {
56
- view.value?.destroy()
57
- view.value = undefined
58
- }
59
- })
60
-
61
- watch(() => modelValue, (newValue) => {
62
- if (typeof newValue !== 'string') {
63
- console.error(`value must be typeof string but got ${typeof newValue}`)
64
- }
65
- })
66
-
67
- const defaultClassNames = computed(() =>
68
- typeof props.theme === 'string' ? `cm-theme-${props.theme}` : 'cm-theme',
69
- )
70
- </script>
71
-
72
- <template>
1
+ <script setup>
2
+ import { useNuxtCodeMirror } from "../composables/useNuxtCodeMirror";
3
+ import { onMounted, ref, watch, computed, onBeforeUnmount } from "#imports";
4
+ const editor = ref(null);
5
+ const container = ref(null);
6
+ const view = ref();
7
+ const state = ref();
8
+ const modelValue = defineModel({ type: String, ...{ default: "" } });
9
+ const props = defineProps({
10
+ height: { type: String, required: false },
11
+ minHeight: { type: String, required: false },
12
+ maxHeight: { type: String, required: false },
13
+ width: { type: String, required: false },
14
+ minWidth: { type: String, required: false },
15
+ maxWidth: { type: String, required: false },
16
+ autoFocus: { type: Boolean, required: false },
17
+ placeholder: { type: null, required: false },
18
+ theme: { type: [String, Object, Array], required: false, default: "light" },
19
+ basicSetup: { type: Boolean, required: false, skipCheck: true },
20
+ editable: { type: Boolean, required: false },
21
+ readOnly: { type: Boolean, required: false },
22
+ indentWithTab: { type: Boolean, required: false },
23
+ onChange: { type: Function, required: false },
24
+ onStatistics: { type: Function, required: false },
25
+ onUpdate: { type: Function, required: false },
26
+ onCreateEditor: { type: Function, required: false },
27
+ onFocus: { type: Function, required: false },
28
+ onBlur: { type: Function, required: false },
29
+ extensions: { type: Array, required: false, default: () => [] },
30
+ root: { type: null, required: false },
31
+ initialState: { type: Object, required: false },
32
+ selection: { type: Object, required: false }
33
+ });
34
+ defineExpose({
35
+ container,
36
+ view,
37
+ state,
38
+ editor
39
+ });
40
+ const emit = defineEmits(["onChange", "onStatistics", "onCreateEditor", "onUpdate", "onFocus", "onBlur"]);
41
+ onMounted(() => {
42
+ useNuxtCodeMirror({
43
+ ...props,
44
+ modelValue,
45
+ onChange: (value, viewUpdate) => {
46
+ modelValue.value = value;
47
+ emit("onChange", value, viewUpdate);
48
+ },
49
+ onStatistics: (data) => emit("onStatistics", data),
50
+ onCreateEditor: (view2, state2) => emit("onCreateEditor", { view: view2, state: state2 }),
51
+ onUpdate: (viewUpdate) => emit("onUpdate", viewUpdate),
52
+ onFocus: (viewUpdate) => emit("onFocus", viewUpdate),
53
+ onBlur: (viewUpdate) => emit("onBlur", viewUpdate),
54
+ container: editor.value,
55
+ viewRef: view,
56
+ stateRef: state,
57
+ containerRef: container
58
+ });
59
+ });
60
+ onBeforeUnmount(() => {
61
+ if (view.value) {
62
+ view.value?.destroy();
63
+ view.value = void 0;
64
+ }
65
+ });
66
+ watch(() => modelValue, (newValue) => {
67
+ if (typeof newValue !== "string") {
68
+ console.error(`value must be typeof string but got ${typeof newValue}`);
69
+ }
70
+ });
71
+ const defaultClassNames = computed(
72
+ () => typeof props.theme === "string" ? `cm-theme-${props.theme}` : "cm-theme"
73
+ );
74
+ </script>
75
+
76
+ <template>
73
77
  <div
74
78
  ref="editor"
75
79
  :class="`${defaultClassNames}${$attrs.class ? ` ${$attrs.class}` : ''}`"
76
80
  v-bind="$attrs"
77
81
  />
78
- </template>
82
+ </template>
package/dist/types.d.mts CHANGED
@@ -1 +1,3 @@
1
- export { type ModuleOptions, default } from './module.js'
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-codemirror",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Nuxt codemirror module",
5
5
  "repository": "https://github.com/ThimoDEV/nuxt-codemirror",
6
6
  "homepage": "https://github.com/ThimoDEV/nuxt-codemirror#readme",
@@ -12,13 +12,11 @@
12
12
  },
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/types.d.ts",
16
- "import": "./dist/module.mjs",
17
- "require": "./dist/module.cjs"
15
+ "types": "./dist/types.d.mts",
16
+ "import": "./dist/module.mjs"
18
17
  }
19
18
  },
20
- "main": "./dist/module.cjs",
21
- "types": "./dist/types.d.ts",
19
+ "main": "./dist/module.mjs",
22
20
  "files": [
23
21
  "dist"
24
22
  ],
@@ -43,31 +41,31 @@
43
41
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
44
42
  },
45
43
  "dependencies": {
46
- "@babel/runtime": "^7.26.10",
47
- "@codemirror/autocomplete": "^6.18.6",
48
- "@codemirror/commands": "^6.8.0",
49
- "@codemirror/language": "^6.10.8",
50
- "@codemirror/lint": "^6.8.4",
51
- "@codemirror/search": "^6.5.10",
52
- "@codemirror/state": "6.5.2",
53
- "@codemirror/theme-one-dark": "^6.1.2",
54
- "@codemirror/view": "6.36.4",
55
- "@nuxt/kit": "^3.16.1"
44
+ "@babel/runtime": "^7.28.6",
45
+ "@codemirror/autocomplete": "^6.20.0",
46
+ "@codemirror/commands": "^6.10.2",
47
+ "@codemirror/language": "^6.12.2",
48
+ "@codemirror/lint": "^6.9.4",
49
+ "@codemirror/search": "^6.6.0",
50
+ "@codemirror/state": "6.5.4",
51
+ "@codemirror/theme-one-dark": "^6.1.3",
52
+ "@codemirror/view": "6.39.15",
53
+ "@nuxt/kit": "^4.3.1"
56
54
  },
57
55
  "devDependencies": {
58
- "@nuxt/devtools": "^2.2.1",
59
- "@nuxt/devtools-ui-kit": "^1.6.4",
60
- "@nuxt/eslint-config": "^1.2.0",
61
- "@nuxt/module-builder": "^0.8.4",
62
- "@nuxt/schema": "^3.16.0",
63
- "@nuxt/test-utils": "^3.17.2",
64
- "@types/node": "^22.13.10",
65
- "changelogen": "^0.6.1",
66
- "eslint": "^9.22.0",
67
- "nuxt": "^3.16.0",
68
- "typescript": "5.3.2",
69
- "vitest": "^3.0.8",
70
- "vue-tsc": "2.0.29"
56
+ "@nuxt/devtools": "^3.2.2",
57
+ "@nuxt/devtools-ui-kit": "^3.2.2",
58
+ "@nuxt/eslint-config": "^1.15.2",
59
+ "@nuxt/module-builder": "^1.0.2",
60
+ "@nuxt/schema": "^4.3.1",
61
+ "@nuxt/test-utils": "^4.0.0",
62
+ "@types/node": "^25.3.2",
63
+ "changelogen": "^0.6.2",
64
+ "eslint": "^10.0.2",
65
+ "nuxt": "^4.3.1",
66
+ "typescript": "5.9.3",
67
+ "vitest": "^4.0.18",
68
+ "vue-tsc": "3.2.5"
71
69
  },
72
70
  "resolutions": {
73
71
  "vue-tsc": "2.2.2"
@@ -78,4 +76,4 @@
78
76
  "vue"
79
77
  ],
80
78
  "packageManager": "pnpm@10.6.5"
81
- }
79
+ }
package/dist/module.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
package/dist/module.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- interface ModuleOptions {
4
- devtools?: boolean;
5
- }
6
- declare const _default: _nuxt_schema.NuxtModule<_nuxt_schema.ModuleOptions, _nuxt_schema.ModuleOptions, false>;
7
-
8
- export { type ModuleOptions, _default as default };
package/dist/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export { type ModuleOptions, default } from './module'