v-code-diff 1.7.2 → 1.9.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 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
- * [vue-diff](https://github.com/hoiheart/vue-diff)
21
- * [vue-code-diff](https://github.com/ddchef/vue-code-diff)
22
- * Github Code Diff
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
 
@@ -48,7 +48,7 @@ yarn add v-code-diff
48
48
  pnpm add v-code-diff
49
49
  ```
50
50
 
51
- Vue2 developers need install composition-api
51
+ Vue2.6 developers need install composition-api
52
52
 
53
53
  ```shell
54
54
  pnpm add @vue/composition-api
@@ -103,46 +103,57 @@ 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 | 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 |
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
+ | hideHeader | Hide header bar | boolean | - | false |
127
+ | hideStat | Hide statistical part in the header bar | boolean | - | false |
128
+ | theme | Add dark mode | ThemeType | light , dark | light |
129
+ | ignoreMatchingLines | Give a pattern to ignore matching lines eg: '(time\|token)' | string | - | undefined |
125
130
 
126
131
  ## Events
127
- | Name | Description | Type |
128
- |------|------------------------------|---------------------------------------------------------------------------------|
129
- | diff | triggers when diff finished | (result: {stat: { isChanged: boolean, addNum: number, delNum: number}}) => void |
130
132
 
133
+ | Name | Description | Type |
134
+ | ---- | --------------------------- | ------------------------------------------------------------------------------- |
135
+ | diff | triggers when diff finished | (result: {stat: { isChanged: boolean, addNum: number, delNum: number}}) => void |
136
+
137
+ ## Slot
138
+
139
+ | Name | Description |
140
+ | ---- | ----------------------------------------------------------- |
141
+ | stat | Custom statistical content, The scope parameter is { stat } |
131
142
 
132
143
  ## Extend languages
133
144
 
134
145
  In order to reduce the size of the packaged file, the system only supports the following commonly used languages by
135
146
  default.
136
147
 
137
- * plaintext
138
- * xml/html
139
- * javascript
140
- * json
141
- * yaml
142
- * python
143
- * java
144
- * bash
145
- * sql
148
+ - plaintext
149
+ - xml/html
150
+ - javascript
151
+ - json
152
+ - yaml
153
+ - python
154
+ - java
155
+ - bash
156
+ - sql
146
157
 
147
158
  If the language you need is not included, you can manually import the relevant language highlighting module.
148
159
 
@@ -165,16 +176,18 @@ version. And we will try to align the functions with the 0.x version as much as
165
176
 
166
177
  Key points:
167
178
 
168
- * In the 1.x version, language recognition and highlighting will no longer be automatically performed, you need to
179
+ - In the 1.x version, language recognition and highlighting will no longer be automatically performed, you need to
169
180
  manually specify the language type, such as language="python", if not specified, it will default to plaintext
170
181
  and will not be highlighted.
171
- * In the 1.x version, due to the fact that rendering and highlighting are performed at the same time, the component
182
+ - In the 1.x version, due to the fact that rendering and highlighting are performed at the same time, the component
172
183
  events
173
184
  have been removed.
174
- * In the 1.x version, the following component properties (Prop) have been changed:
175
- * highlight - removed
176
- * drawFileList - removed
177
- * fileName - rename to "filename"
185
+ - In the 1.x version, the following component properties (Prop) have been changed:
186
+ - highlight - removed
187
+ - drawFileList - removed
188
+ - fileName - rename to "filename"
189
+ - newFilename - new
190
+ - theme - new
178
191
 
179
192
  Below is a detailed comparison of the two versions, you can refer to it to complete the migration.
180
193
 
@@ -184,27 +197,29 @@ The component events are no longer provided in the 1.x version as rendering and
184
197
  simultaneously.
185
198
 
186
199
  | Event Name | Change Status |
187
- |---------------|--------------------|
200
+ | ------------- | ------------------ |
188
201
  | before-render | No longer provided |
189
202
  | after-render | No longer provided |
190
203
 
191
204
  ### The difference of prop.
192
205
 
193
206
  | Prop | Description | Change Status |
194
- |------------------------|-----------------------------------------------------------------------------|-------------------------------------------------|
195
- | highlight | Control code highlighting | Removed in version 1.x |
207
+ | ---------------------- | --------------------------------------------------------------------------- | ----------------------------------------------- |
208
+ | highlight | Control code highlighting | Removed in version 1.x |
196
209
  | language | Code language | None |
197
210
  | oldString | Old string | None |
198
- | newString | New string | None |
211
+ | newString | New string | None |
199
212
  | context | The number of lines to separate different parts so that they are not hidden | None |
200
213
  | output-format | Display mode | None |
201
214
  | diffStyle | Difference style, word-level differences or letter-level differences | None |
202
- | drawFileList | Display file comparison list | Removed in version 1.x |
203
- | renderNothingWhenEmpty | Do not render when there is no comparison | Removed in version 1.x |
204
- | fileName | File name | To be determined, not under development |
205
- | isShowNoChange | Display source code when there is no comparison | Removed as it became the default in version 1.x |
206
- | trim | Remove blank characters at the beginning and end of the string | None |
215
+ | drawFileList | Display file comparison list | Removed in version 1.x |
216
+ | renderNothingWhenEmpty | Do not render when there is no comparison | Removed in version 1.x |
217
+ | fileName | File name | To be determined, not under development |
218
+ | newFilename | | New in version 1. To be determined, not under development |
219
+ | isShowNoChange | Display source code when there is no comparison | Removed as it became the default in version 1.x |
220
+ | trim | Remove blank characters at the beginning and end of the string | None |
207
221
  | noDiffLineFeed | Don't diff Windows line feed (CRLF) and Linux line feed (LF) | None |
222
+ | theme | Add dark mode | New in version 1 |
208
223
 
209
224
  ## Star History
210
225