Skip to content

Commit 7f096da

Browse files
committed
Update dependencies.
Add version and build information to index.ts. Update documentation. Upgrade yarn-3.2.4.
1 parent de1bc98 commit 7f096da

File tree

13 files changed

+1269
-1117
lines changed

13 files changed

+1269
-1117
lines changed

.yarn/releases/yarn-3.2.3.cjs

Lines changed: 0 additions & 783 deletions
This file was deleted.

.yarn/releases/yarn-3.2.4.cjs

Lines changed: 801 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
yarnPath: .yarn/releases/yarn-3.2.3.cjs
1+
yarnPath: .yarn/releases/yarn-3.2.4.cjs
22
nodeLinker: node-modules

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,25 @@
55
[![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/vue-codemirror6/file/README.md)
66
[![npm version](https://img.shields.io/npm/v/vue-codemirror6.svg)](https://www.npmjs.com/package/vue-codemirror6)
77
[![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/vue-codemirror6)
8+
[![Twitter Follow](https://img.shields.io/twitter/follow/logue256?style=plastic)](https://twitter.com/logue256)
89

9-
A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unrelated to [surmon-china's vue-codemirror](https://github.com/surmon-china/vue-codemirror), it is for CodeMirror6.
10+
A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. This component works in both Vue2 and Vue3.
1011

1112
## Usage
1213

1314
```sh
1415
yarn add vue-codemirror6 codemirror
1516
```
1617

17-
This component can handle bidirectional binding by `v-model` like a general Vue component.
18-
19-
When using with Vue <2.6, [@vue/composition-api](https://www.npmjs.com/package/@vue/composition-api) is required separately.
18+
For Vue 2.7 or below, [@vue/composition-api](https://www.npmjs.com/package/@vue/composition-api) is required separately.
2019

2120
```sh
2221
yarn add vue-codemirror6 @vue/composition-api
2322
```
2423

25-
For Vue 2.7 or later, import vue directly like Vue3.
24+
This component can handle bidirectional binding by `v-model` like a general Vue component.
2625

27-
### Props
26+
## Props
2827

2928
| Props | Type | Information |
3029
| ---------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -43,7 +42,7 @@ For Vue 2.7 or later, import vue directly like Vue3.
4342
| lintGutter | boolean | Display 🔴 on the line where there was an error when `linter` was specified. It will not work if `linter` is not specified. |
4443
| tag | string | HTML tags used in the component. (Default is `div` tag.) |
4544

46-
Notice: `lang` and `linter` can also be set together in `extensions`. This is defined for usability compatibility with past CodeMirrors.
45+
Notice: `lang` and `linter` can also be set together in `extensions`. These are separated for compatibility with previous versions of CodeMirror settings and for typing props.
4746

4847
### Supported Languages
4948

@@ -152,8 +151,8 @@ import { ref, defineComponent, type Ref } from 'vue';
152151
import CodeMirror from 'vue-codemirror6';
153152
154153
// CodeMirror extensions
155-
import type { LanguageSupport } from '@codemirror/language';
156154
import { markdown as md } from '@codemirror/lang-markdown';
155+
import type { LanguageSupport } from '@codemirror/language';
157156
import type { Extension } from '@codemirror/state';
158157
import type { ViewUpdate } from '@codemirror/view';
159158
@@ -164,6 +163,7 @@ export default defineComponent({
164163
setup() {
165164
/**
166165
* Get Vuetify instance
166+
*
167167
* @see {@link https://github.com/logue/vite-vue2-vuetify-ts-starter | vite-vue2-vuetify-ts-starter}
168168
*/
169169
const vuetify = useVuetify();

dev/App.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</div>
5757
</div>
5858
</nav>
59-
<header class="bg-light">
59+
<header class="header bg-light">
6060
<div class="container py-3">
6161
<h1>Vue CodeMirror6 Demo</h1>
6262
<p class="lead">
@@ -110,20 +110,30 @@ export default defineComponent({
110110
const dark = ref(window.matchMedia('(prefers-color-scheme: dark)').matches);
111111
watch(dark, () => {
112112
const navbar = document.querySelector('.navbar').classList;
113+
const header = document.querySelector('.header').classList;
114+
const demo = document.querySelector('.demo').classList;
113115
const main = document.querySelector('main').classList;
114116
const footer = document.querySelector('.footer').classList;
115117
if (dark.value) {
116118
navbar.remove('navbar-dark', 'bg-dark');
117119
navbar.add('navbar-light', 'bg-light');
120+
header.remove('bg-light', 'text-dark');
121+
header.add('bg-dark', 'text-light');
118122
main.remove('bg-white', 'text-dark');
119123
main.add('bg-black', 'text-light');
124+
demo.remove('bg-light', 'text-dark');
125+
demo.add('bg-dark', 'text-light');
120126
footer.remove('bg-light', 'text-dark');
121127
footer.add('bg-dark', 'text-light');
122128
} else {
123129
navbar.add('navbar-dark', 'bg-dark');
124130
navbar.remove('navbar-light', 'bg-light');
131+
header.remove('bg-dark', 'text-light');
132+
header.add('bg-light', 'text-dark');
125133
main.add('bg-white', 'text-dark');
126134
main.remove('bg-black', 'text-light');
135+
demo.remove('bg-dark', 'text-light');
136+
demo.add('bg-light', 'text-dark');
127137
footer.add('bg-light', 'text-dark');
128138
footer.remove('bg-dark', 'text-light');
129139
}

dev/DemoPage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru
124124
</div>
125125
<div class="col">
126126
<!-- eslint-disable-next-line vue/no-v-html -->
127-
<div class="p-3 bg-light text-dark" v-html="output" />
127+
<div class="demo p-3 bg-light text-dark" v-html="output" />
128128
</div>
129129
</div>
130130
<p>
@@ -285,7 +285,7 @@ export default defineComponent({
285285
v-model="demo2"
286286
aria-label="two way bind test"
287287
rows="3"
288-
class="form-control"
288+
class="demo form-control"
289289
/>
290290
</div>
291291
</div>

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "vue-codemirror6",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"license": "MIT",
66
"description": "CodeMirror6 Component for vue2 and vue3.",
77
"keywords": [
@@ -54,7 +54,7 @@
5454
"node": ">=16.17.1",
5555
"yarn": ">=1.22.10"
5656
},
57-
"packageManager": "[email protected].3",
57+
"packageManager": "[email protected].4",
5858
"sideEffects": false,
5959
"scripts": {
6060
"dev": "vite",
@@ -83,26 +83,26 @@
8383
},
8484
"devDependencies": {
8585
"@codemirror/lang-javascript": "^6.1.0",
86-
"@codemirror/lang-markdown": "^6.0.1",
87-
"@types/lodash": "^4.14.185",
88-
"@types/node": "^18.7.23",
89-
"@typescript-eslint/eslint-plugin": "^5.38.1",
90-
"@typescript-eslint/parser": "^5.38.1",
91-
"@vitejs/plugin-vue": "^3.1.0",
86+
"@codemirror/lang-markdown": "^6.0.2",
87+
"@types/lodash": "^4.14.186",
88+
"@types/node": "^18.8.4",
89+
"@typescript-eslint/eslint-plugin": "^5.40.0",
90+
"@typescript-eslint/parser": "^5.40.0",
91+
"@vitejs/plugin-vue": "^3.1.2",
9292
"@vue/eslint-config-prettier": "^7.0.0",
9393
"@vue/tsconfig": "^0.1.3",
9494
"codemirror": "^6.0.1",
95-
"eslint": "^8.24.0",
95+
"eslint": "^8.25.0",
9696
"eslint-config-google": "^0.14.0",
9797
"eslint-config-prettier": "^8.5.0",
9898
"eslint-import-resolver-alias": "^1.1.2",
9999
"eslint-import-resolver-typescript": "^3.5.1",
100-
"eslint-linter-browserify": "^8.24.0",
100+
"eslint-linter-browserify": "^8.25.0",
101101
"eslint-plugin-html": "^7.1.0",
102102
"eslint-plugin-import": "^2.26.0",
103103
"eslint-plugin-jsdoc": "^39.3.6",
104104
"eslint-plugin-tsdoc": "^0.2.17",
105-
"eslint-plugin-vue": "^9.5.1",
105+
"eslint-plugin-vue": "^9.6.0",
106106
"eslint-plugin-vuejs-accessibility": "^1.2.0",
107107
"eslint-plugin-yaml": "^0.5.0",
108108
"husky": "^8.0.1",
@@ -111,13 +111,13 @@
111111
"prettier": "^2.7.1",
112112
"rimraf": "^3.0.2",
113113
"rollup-plugin-visualizer": "^5.8.2",
114-
"typescript": "^4.8.3",
115-
"vite": "^3.1.3",
114+
"typescript": "^4.8.4",
115+
"vite": "^3.1.7",
116116
"vite-plugin-banner": "^0.5.0",
117117
"vite-plugin-checker": "^0.5.1",
118-
"vue": "^3.2.39",
118+
"vue": "^3.2.40",
119119
"vue-eslint-parser": "^9.1.0",
120-
"vue-tsc": "^0.40.13"
120+
"vue-tsc": "^1.0.5"
121121
},
122122
"husky": {
123123
"hooks": {

src/helpers/h-demi.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
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+
17
import { h as hDemi, isVue2, type VNode, Vue2 } from 'vue-demi';
28

39
interface Options {

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import CodeMirror from './components/CodeMirror';
2+
import Meta from './Meta';
23

34
// TODO: Move phrases props to option.
45
const installCodeMirror = (app: any) => app.component('CodeMirror', CodeMirror);
56

6-
export { CodeMirror as default, installCodeMirror as install };
7+
export { CodeMirror as default, installCodeMirror as install, Meta };
78

89
// For CDN. (Maybe Vue2 only)
910
// @ts-ignore

src/interfaces/MetaInterface.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** Build information meta data */
2+
export default interface MetaInterface {
3+
/** Version */
4+
version: string;
5+
/** Build date */
6+
date: string;
7+
}

0 commit comments

Comments
 (0)