v-code-diff 1.5.0 → 1.6.0
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 +24 -8
- package/dist/v2/index.cjs.js +12 -12
- package/dist/v2/index.es.js +440 -422
- package/dist/v2/index.umd.js +12 -12
- package/dist/v2.7/index.cjs.js +11 -11
- package/dist/v2.7/index.es.js +510 -492
- package/dist/v2.7/index.umd.js +9 -9
- package/dist/v3/index.cjs.js +15 -15
- package/dist/v3/index.es.js +1264 -1248
- package/dist/v3/index.umd.js +15 -15
- package/package.json +13 -20
- package/scripts/postinstall.js +6 -3
- package/scripts/utils.js +2 -2
- package/src/CodeDiff.vue +32 -6
- package/src/global.ts +1 -1
- package/src/index.ts +1 -1
- package/src/split/SplitLine.vue +3 -2
- package/src/types.ts +1 -1
- package/src/unified/UnifiedLine.vue +2 -2
- package/src/utils.ts +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/v-code-diff)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://www.npmjs.com/package/v-code-diff)
|
|
6
6
|
|
|
7
7
|
> A code diff display plugin, available for Vue2 / Vue3.
|
|
8
8
|
|
|
@@ -28,6 +28,8 @@ This project references the following projects, and I would like to express my g
|
|
|
28
28
|
- [Vue3](#Vue3)
|
|
29
29
|
- [Vue2](#Vue2)
|
|
30
30
|
- [Props](#Props)
|
|
31
|
+
- [Events](#Events)
|
|
32
|
+
- [Demo](#Demo)
|
|
31
33
|
- [Extend languages](#extend-languages)
|
|
32
34
|
- [Migrate from 0.x version](#Migrate-from-0x-version)
|
|
33
35
|
|
|
@@ -59,7 +61,7 @@ pnpm add @vue/composition-api
|
|
|
59
61
|
#### Register globally
|
|
60
62
|
|
|
61
63
|
```ts
|
|
62
|
-
import {createApp} from 'vue'
|
|
64
|
+
import { createApp } from 'vue'
|
|
63
65
|
import CodeDiff from 'v-code-diff'
|
|
64
66
|
|
|
65
67
|
app
|
|
@@ -70,12 +72,12 @@ app
|
|
|
70
72
|
then
|
|
71
73
|
|
|
72
74
|
```vue
|
|
73
|
-
|
|
74
75
|
<template>
|
|
75
76
|
<code-diff
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
output-format="side-by-side"
|
|
77
|
+
old-string="12345"
|
|
78
|
+
new-string="3456"
|
|
79
|
+
output-format="side-by-side"
|
|
80
|
+
/>
|
|
79
81
|
</template>
|
|
80
82
|
```
|
|
81
83
|
|
|
@@ -88,16 +90,24 @@ Not recommended, but the relevant capabilities are retained to facilitate migrat
|
|
|
88
90
|
#### Register globally
|
|
89
91
|
|
|
90
92
|
```ts
|
|
91
|
-
import Vue from 'vue'
|
|
93
|
+
import Vue from 'vue'
|
|
92
94
|
import CodeDiff from 'v-code-diff'
|
|
93
95
|
|
|
94
|
-
Vue.use(CodeDiff)
|
|
96
|
+
Vue.use(CodeDiff)
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
#### Register locally
|
|
98
100
|
|
|
99
101
|
Not recommended, but the relevant capabilities are retained to facilitate migration for 0.x users.
|
|
100
102
|
|
|
103
|
+
## Demo
|
|
104
|
+
|
|
105
|
+
| | npm | cdn |
|
|
106
|
+
|--------|-----|--------------------------------------------------------------------------------|
|
|
107
|
+
| vue2 | | [vue2-cdn](https://stackblitz.com/edit/v-code-diff-vue2-cdn?file=index.html) |
|
|
108
|
+
| vue2.7 | | [vue27-cdn](https://stackblitz.com/edit/v-code-diff-vue27-cdn?file=index.html) |
|
|
109
|
+
| vue3 | | [vue3-cdn](https://stackblitz.com/edit/v-code-diff-vue3-cdn?file=index.html) |
|
|
110
|
+
|
|
101
111
|
## Props
|
|
102
112
|
|
|
103
113
|
| Prop | Description | Type | Optional Values | Default Value |
|
|
@@ -113,6 +123,12 @@ Not recommended, but the relevant capabilities are retained to facilitate migrat
|
|
|
113
123
|
| maxHeight | Maximum height of component, for example: 300px | string | - | undefined |
|
|
114
124
|
| filename | Filename | string | - | undefined |
|
|
115
125
|
|
|
126
|
+
## Events
|
|
127
|
+
| Name | Description | Type |
|
|
128
|
+
|------|------------------------------|---------------------------------------------------------------------------------|
|
|
129
|
+
| diff | triggers when diff finished | (result: {stat: { isChanged: boolean, addNum: number, delNum: number}}) => void |
|
|
130
|
+
|
|
131
|
+
|
|
116
132
|
## Extend languages
|
|
117
133
|
|
|
118
134
|
In order to reduce the size of the packaged file, the system only supports the following commonly used languages by
|