v-code-diff 1.7.2 → 1.8.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 +49 -43
- package/dist/v2/index.cjs.js +12 -12
- package/dist/v2/index.es.js +770 -700
- package/dist/v2/index.umd.js +13 -13
- package/dist/v2.7/index.cjs.js +15 -15
- package/dist/v2.7/index.es.js +1202 -1166
- package/dist/v2.7/index.umd.js +15 -15
- package/dist/v3/index.cjs.js +15 -15
- package/dist/v3/index.es.js +1155 -1094
- package/dist/v3/index.umd.js +15 -15
- package/package.json +3 -2
- package/src/CodeDiff.vue +38 -14
- package/src/style.scss +8 -3
- package/src/var.scss +541 -73
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@ on [vue-code-diff](https://github.com/ddchef/vue-code-diff), is no longer mainta
|
|
|
17
17
|
functionality of 0.x version in 1.x version and minimize migration cost as much as possible).
|
|
18
18
|
This project references the following projects, and I would like to express my gratitude to the original authors!
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
- [vue-diff](https://github.com/hoiheart/vue-diff)
|
|
21
|
+
- [vue-code-diff](https://github.com/ddchef/vue-code-diff)
|
|
22
|
+
- Github Code Diff
|
|
23
23
|
|
|
24
24
|
## Contents
|
|
25
25
|
|
|
@@ -103,46 +103,48 @@ Not recommended, but the relevant capabilities are retained to facilitate migrat
|
|
|
103
103
|
## Demo
|
|
104
104
|
|
|
105
105
|
| | npm | cdn |
|
|
106
|
-
|
|
106
|
+
| ------ | --- | ------------------------------------------------------------------------------ |
|
|
107
107
|
| vue2 | | [vue2-cdn](https://stackblitz.com/edit/v-code-diff-vue2-cdn?file=index.html) |
|
|
108
108
|
| vue2.7 | | [vue27-cdn](https://stackblitz.com/edit/v-code-diff-vue27-cdn?file=index.html) |
|
|
109
109
|
| vue3 | | [vue3-cdn](https://stackblitz.com/edit/v-code-diff-vue3-cdn?file=index.html) |
|
|
110
110
|
|
|
111
111
|
## Props
|
|
112
112
|
|
|
113
|
-
| Prop | Description | Type
|
|
114
|
-
|
|
115
|
-
| language | Code language, such as typescript, defaults to plain text. [View all supported languages](https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md) | string
|
|
116
|
-
| oldString | Old string
|
|
117
|
-
| newString | New string
|
|
118
|
-
| context | The number of lines to separate different parts so that they are not hidden | number
|
|
119
|
-
| outputFormat | Display mode
|
|
120
|
-
| diffStyle | Difference style, word-level differences or letter-level differences | string
|
|
121
|
-
| trim | Remove blank characters at the beginning and end of the string | boolean
|
|
122
|
-
| noDiffLineFeed | Don't diff Windows line feed (CRLF) and Linux line feed (LF) | boolean
|
|
123
|
-
| maxHeight | Maximum height of component, for example: 300px | string
|
|
124
|
-
| filename | Filename | string
|
|
113
|
+
| Prop | Description | Type | Optional Values | Default Value |
|
|
114
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------------------------- | ------------- |
|
|
115
|
+
| language | Code language, such as typescript, defaults to plain text. [View all supported languages](https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md) | string | - | plaintext |
|
|
116
|
+
| oldString | Old string | string | - | - |
|
|
117
|
+
| newString | New string | string | - | - |
|
|
118
|
+
| context | The number of lines to separate different parts so that they are not hidden | number | - | 10 |
|
|
119
|
+
| outputFormat | Display mode | string | line-by-line,side-by-side | line-by-line |
|
|
120
|
+
| diffStyle | Difference style, word-level differences or letter-level differences | string | word, char | word |
|
|
121
|
+
| trim | Remove blank characters at the beginning and end of the string | boolean | - | false |
|
|
122
|
+
| noDiffLineFeed | Don't diff Windows line feed (CRLF) and Linux line feed (LF) | boolean | - | false |
|
|
123
|
+
| maxHeight | Maximum height of component, for example: 300px | string | - | undefined |
|
|
124
|
+
| filename | Filename | string | - | undefined |
|
|
125
|
+
| newFilename | New filename | string | - | undefined |
|
|
126
|
+
| theme | Add dark mode | ThemeType | light , dark | 'light' |
|
|
125
127
|
|
|
126
128
|
## Events
|
|
127
|
-
| Name | Description | Type |
|
|
128
|
-
|------|------------------------------|---------------------------------------------------------------------------------|
|
|
129
|
-
| diff | triggers when diff finished | (result: {stat: { isChanged: boolean, addNum: number, delNum: number}}) => void |
|
|
130
129
|
|
|
130
|
+
| Name | Description | Type |
|
|
131
|
+
| ---- | --------------------------- | ------------------------------------------------------------------------------- |
|
|
132
|
+
| diff | triggers when diff finished | (result: {stat: { isChanged: boolean, addNum: number, delNum: number}}) => void |
|
|
131
133
|
|
|
132
134
|
## Extend languages
|
|
133
135
|
|
|
134
136
|
In order to reduce the size of the packaged file, the system only supports the following commonly used languages by
|
|
135
137
|
default.
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
- plaintext
|
|
140
|
+
- xml/html
|
|
141
|
+
- javascript
|
|
142
|
+
- json
|
|
143
|
+
- yaml
|
|
144
|
+
- python
|
|
145
|
+
- java
|
|
146
|
+
- bash
|
|
147
|
+
- sql
|
|
146
148
|
|
|
147
149
|
If the language you need is not included, you can manually import the relevant language highlighting module.
|
|
148
150
|
|
|
@@ -165,16 +167,18 @@ version. And we will try to align the functions with the 0.x version as much as
|
|
|
165
167
|
|
|
166
168
|
Key points:
|
|
167
169
|
|
|
168
|
-
|
|
170
|
+
- In the 1.x version, language recognition and highlighting will no longer be automatically performed, you need to
|
|
169
171
|
manually specify the language type, such as language="python", if not specified, it will default to plaintext
|
|
170
172
|
and will not be highlighted.
|
|
171
|
-
|
|
173
|
+
- In the 1.x version, due to the fact that rendering and highlighting are performed at the same time, the component
|
|
172
174
|
events
|
|
173
175
|
have been removed.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
- In the 1.x version, the following component properties (Prop) have been changed:
|
|
177
|
+
- highlight - removed
|
|
178
|
+
- drawFileList - removed
|
|
179
|
+
- fileName - rename to "filename"
|
|
180
|
+
- newFilename - new
|
|
181
|
+
- theme - new
|
|
178
182
|
|
|
179
183
|
Below is a detailed comparison of the two versions, you can refer to it to complete the migration.
|
|
180
184
|
|
|
@@ -184,27 +188,29 @@ The component events are no longer provided in the 1.x version as rendering and
|
|
|
184
188
|
simultaneously.
|
|
185
189
|
|
|
186
190
|
| Event Name | Change Status |
|
|
187
|
-
|
|
191
|
+
| ------------- | ------------------ |
|
|
188
192
|
| before-render | No longer provided |
|
|
189
193
|
| after-render | No longer provided |
|
|
190
194
|
|
|
191
195
|
### The difference of prop.
|
|
192
196
|
|
|
193
197
|
| Prop | Description | Change Status |
|
|
194
|
-
|
|
195
|
-
| highlight | Control code highlighting
|
|
198
|
+
| ---------------------- | --------------------------------------------------------------------------- | ----------------------------------------------- |
|
|
199
|
+
| highlight | Control code highlighting | Removed in version 1.x |
|
|
196
200
|
| language | Code language | None |
|
|
197
201
|
| oldString | Old string | None |
|
|
198
|
-
| newString | New string
|
|
202
|
+
| newString | New string | None |
|
|
199
203
|
| context | The number of lines to separate different parts so that they are not hidden | None |
|
|
200
204
|
| output-format | Display mode | None |
|
|
201
205
|
| diffStyle | Difference style, word-level differences or letter-level differences | None |
|
|
202
|
-
| drawFileList | Display file comparison list |
|
|
203
|
-
| renderNothingWhenEmpty | Do not render when there is no comparison |
|
|
204
|
-
| fileName | File name | To be determined, not under development |
|
|
205
|
-
|
|
|
206
|
-
|
|
|
206
|
+
| drawFileList | Display file comparison list | Removed in version 1.x |
|
|
207
|
+
| renderNothingWhenEmpty | Do not render when there is no comparison | Removed in version 1.x |
|
|
208
|
+
| fileName | File name | To be determined, not under development |
|
|
209
|
+
| newFilename | | New in version 1. To be determined, not under development |
|
|
210
|
+
| isShowNoChange | Display source code when there is no comparison | Removed as it became the default in version 1.x |
|
|
211
|
+
| trim | Remove blank characters at the beginning and end of the string | None |
|
|
207
212
|
| noDiffLineFeed | Don't diff Windows line feed (CRLF) and Linux line feed (LF) | None |
|
|
213
|
+
| theme | Add dark mode | New in version 1 |
|
|
208
214
|
|
|
209
215
|
## Star History
|
|
210
216
|
|