@kubed/diff-viewer 0.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # @kubed/diff-view
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e1cff67`](https://github.com/kubesphere/kube-design/commit/e1cff678e7534068bdd9b330d040c5d2c0288d2e) Thanks [@chenz24](https://github.com/chenz24)! - rename DiffView to DiffViewer.
8
+
9
+ ## 0.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8415db6`](https://github.com/kubesphere/kube-design/commit/8415db61f675499d4787c526c42ffd7984e6c2f2) Thanks [@chenz24](https://github.com/chenz24)! - 1. fix: CodeEditor yaml worker error
14
+ 2. feat: Add DiffView component
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),diff=require("diff"),diff2html=require("diff2html"),icons=require("@kubed/icons"),styles=require("./styles.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e};const getDiffHtml=(e,t,r={})=>{const n=diff.createPatch("yaml",e,t,"","",{context:-1}),i=diff2html.parse(n);return diff2html.html(i,__spreadValues({drawFileList:!1},r))},DiffViewer=({title:e,description:t,mode:r="line-by-line",oldValue:n,newValue:i})=>{const[l,f]=React.useState(r),[c,a]=React.useState(getDiffHtml(n,i,{outputFormat:r})),o=s=>{f(s),a(getDiffHtml(n,i,{outputFormat:s}))};return React.useEffect(()=>{a(getDiffHtml(n,i,{outputFormat:l}))},[n,i]),React__default.createElement(styles.DiffWrapper,null,React__default.createElement(styles.Header,null,React__default.createElement(icons.Terminal,{size:20}),React__default.createElement(styles.Title,null,e),React__default.createElement(icons.ChevronDown,{size:20,className:"switch-mode",onClick:()=>{o("line-by-line")}}),React__default.createElement(icons.ChevronRight,{size:20,className:"switch-mode",onClick:()=>{o("side-by-side")}}),React__default.createElement(styles.Description,null,t)),React__default.createElement("div",{dangerouslySetInnerHTML:{__html:c}}))};exports.DiffViewer=DiffViewer;
2
+ //# sourceMappingURL=DiffViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffViewer.js","sources":["../src/DiffViewer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { createPatch } from 'diff';\nimport { parse, html } from 'diff2html';\nimport { Terminal, ChevronDown, ChevronRight } from '@kubed/icons';\nimport { DiffWrapper, Header, Title, Description } from './styles';\n\nconst getDiffHtml = (oldValue, newValue, options = {}) => {\n const diffStr = createPatch('yaml', oldValue, newValue, '', '', {\n context: -1,\n });\n const diffJson = parse(diffStr);\n return html(diffJson, {\n drawFileList: false,\n ...options,\n });\n};\n\nexport interface DiffViewerProps {\n title?: string | React.ReactNode;\n description?: string | React.ReactNode;\n mode?: 'line-by-line' | 'side-by-side';\n oldValue: string;\n newValue: string;\n}\n\nexport const DiffViewer = ({\n title,\n description,\n mode = 'line-by-line',\n oldValue,\n newValue,\n}: DiffViewerProps) => {\n const [_mode, setMode] = useState(mode);\n const [diffHtml, setDiffHtml] = useState(getDiffHtml(oldValue, newValue, { outputFormat: mode }));\n\n const handleModeChange = (m) => {\n setMode(m);\n setDiffHtml(getDiffHtml(oldValue, newValue, { outputFormat: m }));\n };\n\n useEffect(() => {\n setDiffHtml(getDiffHtml(oldValue, newValue, { outputFormat: _mode }));\n }, [oldValue, newValue]);\n\n return (\n <DiffWrapper>\n <Header>\n <Terminal size={20} />\n <Title>{title}</Title>\n <ChevronDown\n size={20}\n className=\"switch-mode\"\n onClick={() => {\n handleModeChange('line-by-line');\n }}\n />\n <ChevronRight\n size={20}\n className=\"switch-mode\"\n onClick={() => {\n handleModeChange('side-by-side');\n }}\n />\n <Description>{description}</Description>\n </Header>\n <div\n dangerouslySetInnerHTML={{\n __html: diffHtml,\n }}\n />\n </DiffWrapper>\n );\n};\n"],"names":["createPatch","parse","html","useState","useEffect","React","DiffWrapper","Header","Terminal","Title","ChevronDown","ChevronRight","Description"],"mappings":";;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK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;AACN;;;;"}
package/cjs/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DiffViewer=require("./DiffViewer.js");exports.DiffViewer=DiffViewer.DiffViewer;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
package/cjs/styles.js ADDED
@@ -0,0 +1,411 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var styled=require("styled-components");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var styled__default=_interopDefaultLegacy(styled);const DiffWrapper=styled__default.div`
2
+ border-radius: 4px 4px 0 0;
3
+ //border: 1px solid #ccd3db;
4
+
5
+ .d2h-wrapper {
6
+ text-align: left;
7
+ }
8
+
9
+ .d2h-file-header {
10
+ display: none;
11
+ }
12
+
13
+ .d2h-file-header.d2h-sticky-header {
14
+ position: sticky;
15
+ top: 0;
16
+ z-index: 1;
17
+ }
18
+
19
+ .d2h-file-stats {
20
+ display: -webkit-box;
21
+ display: -ms-flexbox;
22
+ display: flex;
23
+ font-size: 14px;
24
+ margin-left: auto;
25
+ }
26
+
27
+ .d2h-lines-added {
28
+ border: 1px solid #b4e2b4;
29
+ border-radius: 5px 0 0 5px;
30
+ color: #399839;
31
+ padding: 2px;
32
+ text-align: right;
33
+ vertical-align: middle;
34
+ }
35
+
36
+ .d2h-lines-deleted {
37
+ border: 1px solid #e9aeae;
38
+ border-radius: 0 5px 5px 0;
39
+ color: #c33;
40
+ margin-left: 1px;
41
+ padding: 2px;
42
+ text-align: left;
43
+ vertical-align: middle;
44
+ }
45
+
46
+ .d2h-file-name-wrapper {
47
+ -webkit-box-align: center;
48
+ -ms-flex-align: center;
49
+ align-items: center;
50
+ display: -webkit-box;
51
+ display: -ms-flexbox;
52
+ display: flex;
53
+ font-size: 15px;
54
+ width: 100%;
55
+ }
56
+
57
+ .d2h-file-name {
58
+ overflow-x: hidden;
59
+ text-overflow: ellipsis;
60
+ white-space: nowrap;
61
+ }
62
+
63
+ .d2h-file-wrapper {
64
+ border: 1px solid #ccd3db;
65
+ border-radius: 0 0 4px 4px;
66
+ border-top-width: 0;
67
+ background-color: #fff;
68
+ }
69
+
70
+ .d2h-file-collapse {
71
+ -webkit-box-pack: end;
72
+ -ms-flex-pack: end;
73
+ -webkit-box-align: center;
74
+ -ms-flex-align: center;
75
+ align-items: center;
76
+ border: 1px solid #ddd;
77
+ border-radius: 3px;
78
+ cursor: pointer;
79
+ display: none;
80
+ font-size: 12px;
81
+ justify-content: flex-end;
82
+ padding: 4px 8px;
83
+ }
84
+
85
+ .d2h-file-collapse.d2h-selected {
86
+ background-color: #c8e1ff;
87
+ }
88
+
89
+ .d2h-file-collapse-input {
90
+ margin: 0 4px 0 0;
91
+ }
92
+
93
+ .d2h-diff-table {
94
+ border-collapse: collapse;
95
+ font-family: Menlo, Consolas, monospace;
96
+ font-size: 13px;
97
+ width: 100%;
98
+ }
99
+
100
+ .d2h-files-diff {
101
+ display: -webkit-box;
102
+ display: -ms-flexbox;
103
+ display: flex;
104
+ width: 100%;
105
+ }
106
+
107
+ .d2h-file-diff {
108
+ overflow-y: hidden;
109
+ }
110
+
111
+ .d2h-file-diff.d2h-d-none,
112
+ .d2h-files-diff.d2h-d-none {
113
+ display: none;
114
+ }
115
+
116
+ .d2h-file-side-diff {
117
+ display: inline-block;
118
+ overflow-x: scroll;
119
+ overflow-y: hidden;
120
+ width: 50%;
121
+ }
122
+
123
+ .d2h-code-line {
124
+ padding: 0 8em;
125
+ }
126
+
127
+ .d2h-code-line,
128
+ .d2h-code-side-line {
129
+ display: inline-block;
130
+ -webkit-user-select: none;
131
+ -moz-user-select: none;
132
+ -ms-user-select: none;
133
+ user-select: none;
134
+ white-space: nowrap;
135
+ width: 100%;
136
+ background-color: transparent !important;
137
+ }
138
+
139
+ .d2h-code-side-line {
140
+ padding: 0 4.5em;
141
+ }
142
+
143
+ .d2h-code-line-ctn {
144
+ word-wrap: normal;
145
+ background: none;
146
+ display: inline-block;
147
+ padding: 0;
148
+ -webkit-user-select: text;
149
+ -moz-user-select: text;
150
+ -ms-user-select: text;
151
+ user-select: text;
152
+ vertical-align: middle;
153
+ white-space: pre;
154
+ width: 100%;
155
+ }
156
+
157
+ .d2h-code-line del,
158
+ .d2h-code-side-line del {
159
+ background-color: rgba(234, 133, 115, 0.7);
160
+ }
161
+
162
+ .d2h-code-line del,
163
+ .d2h-code-line ins,
164
+ .d2h-code-side-line del,
165
+ .d2h-code-side-line ins {
166
+ border-radius: 0.2em;
167
+ display: inline-block;
168
+ margin-top: -1px;
169
+ text-decoration: none;
170
+ vertical-align: middle;
171
+ }
172
+
173
+ .d2h-code-line ins,
174
+ .d2h-code-side-line ins {
175
+ background-color: rgba(85, 188, 138, 0.7);
176
+ text-align: left;
177
+ }
178
+
179
+ .d2h-code-line-prefix {
180
+ word-wrap: normal;
181
+ background: none;
182
+ display: inline;
183
+ padding: 0;
184
+ white-space: pre;
185
+ }
186
+
187
+ .line-num1 {
188
+ float: left;
189
+ }
190
+
191
+ .line-num1,
192
+ .line-num2 {
193
+ -webkit-box-sizing: border-box;
194
+ box-sizing: border-box;
195
+ overflow: hidden;
196
+ padding: 0 0.5em;
197
+ text-overflow: ellipsis;
198
+ width: 3.5em;
199
+ }
200
+
201
+ .line-num2 {
202
+ float: right;
203
+ }
204
+
205
+ .d2h-code-linenumber {
206
+ background-color: rgba(239, 244, 249, 0.8);
207
+ border: solid #eee;
208
+ border-width: 0 1px;
209
+ -webkit-box-sizing: border-box;
210
+ box-sizing: border-box;
211
+ color: rgba(0, 0, 0, 0.3);
212
+ cursor: pointer;
213
+ display: inline-block;
214
+ position: absolute;
215
+ text-align: right;
216
+ width: 7.5em;
217
+ }
218
+
219
+ .d2h-code-linenumber:after {
220
+ content: '\\200b';
221
+ }
222
+
223
+ .d2h-code-side-linenumber {
224
+ background-color: #fff;
225
+ border: solid #eee;
226
+ border-width: 0 1px;
227
+ -webkit-box-sizing: border-box;
228
+ box-sizing: border-box;
229
+ color: rgba(0, 0, 0, 0.3);
230
+ cursor: pointer;
231
+ display: inline-block;
232
+ overflow: hidden;
233
+ padding: 0 0.5em;
234
+ position: absolute;
235
+ text-align: right;
236
+ text-overflow: ellipsis;
237
+ width: 4em;
238
+ }
239
+
240
+ .d2h-code-side-linenumber:after {
241
+ content: '\\200b';
242
+ }
243
+
244
+ .d2h-code-side-emptyplaceholder,
245
+ .d2h-emptyplaceholder {
246
+ background-color: #f1f1f1;
247
+ border-color: #e1e1e1;
248
+ }
249
+
250
+ .d2h-code-line-prefix,
251
+ .d2h-code-linenumber,
252
+ .d2h-code-side-linenumber,
253
+ .d2h-emptyplaceholder {
254
+ -webkit-user-select: none;
255
+ -moz-user-select: none;
256
+ -ms-user-select: none;
257
+ user-select: none;
258
+ }
259
+
260
+ .d2h-code-linenumber,
261
+ .d2h-code-side-linenumber {
262
+ direction: rtl;
263
+ }
264
+
265
+ .d2h-del {
266
+ background-color: #fee8e9;
267
+ border-color: #e9aeae;
268
+ }
269
+
270
+ .d2h-ins {
271
+ background-color: rgba(162, 216, 187, 0.7);
272
+ border-color: #b4e2b4;
273
+ }
274
+
275
+ .d2h-info {
276
+ background-color: #f8fafd;
277
+ border-color: #d5e4f2;
278
+ color: rgba(0, 0, 0, 0.3);
279
+ }
280
+
281
+ .d2h-file-diff .d2h-del.d2h-change {
282
+ background-color: rgba(250, 231, 229, 0.7);
283
+ }
284
+
285
+ .d2h-file-diff .d2h-ins.d2h-change {
286
+ background-color: rgba(196, 230, 212, 0.7);
287
+ }
288
+
289
+ .d2h-file-list-wrapper {
290
+ margin-bottom: 10px;
291
+ }
292
+
293
+ .d2h-file-list-wrapper a {
294
+ color: #3572b0;
295
+ text-decoration: none;
296
+ }
297
+
298
+ .d2h-file-list-wrapper a:visited {
299
+ color: #3572b0;
300
+ }
301
+
302
+ .d2h-file-list-header {
303
+ text-align: left;
304
+ }
305
+
306
+ .d2h-file-list-title {
307
+ font-weight: 700;
308
+ }
309
+
310
+ .d2h-file-list-line {
311
+ display: -webkit-box;
312
+ display: -ms-flexbox;
313
+ display: flex;
314
+ text-align: left;
315
+ }
316
+
317
+ .d2h-file-list {
318
+ display: block;
319
+ list-style: none;
320
+ margin: 0;
321
+ padding: 0;
322
+ }
323
+
324
+ .d2h-file-list > li {
325
+ border-bottom: 1px solid #ddd;
326
+ margin: 0;
327
+ padding: 5px 10px;
328
+ }
329
+
330
+ .d2h-file-list > li:last-child {
331
+ border-bottom: none;
332
+ }
333
+
334
+ .d2h-file-switch {
335
+ cursor: pointer;
336
+ display: none;
337
+ font-size: 10px;
338
+ }
339
+
340
+ .d2h-icon {
341
+ fill: currentColor;
342
+ margin-right: 10px;
343
+ vertical-align: middle;
344
+ }
345
+
346
+ .d2h-deleted {
347
+ color: #c33;
348
+ }
349
+
350
+ .d2h-added {
351
+ color: #399839;
352
+ }
353
+
354
+ .d2h-changed {
355
+ color: #d0b44c;
356
+ }
357
+
358
+ .d2h-moved {
359
+ color: #3572b0;
360
+ }
361
+
362
+ .d2h-tag {
363
+ background-color: #fff;
364
+ display: -webkit-box;
365
+ display: -ms-flexbox;
366
+ display: flex;
367
+ font-size: 10px;
368
+ margin-left: 5px;
369
+ padding: 0 2px;
370
+ }
371
+
372
+ .d2h-deleted-tag {
373
+ border: 1px solid #c33;
374
+ }
375
+
376
+ .d2h-added-tag {
377
+ border: 1px solid #399839;
378
+ }
379
+
380
+ .d2h-changed-tag {
381
+ border: 1px solid #d0b44c;
382
+ }
383
+
384
+ .d2h-moved-tag {
385
+ border: 1px solid #3572b0;
386
+ }
387
+ `,Header=styled__default.div`
388
+ display: flex;
389
+ align-items: center;
390
+ padding: 12px;
391
+ border-radius: 4px 4px 0 0;
392
+ border: 1px solid #ccd3db;
393
+ background-color: #eff4f9;
394
+
395
+ .kubed-icon {
396
+ margin-right: 4px;
397
+ }
398
+
399
+ .switch-mode {
400
+ cursor: pointer;
401
+ }
402
+ `,Title=styled__default.span`
403
+ margin-right: 4px;
404
+ font-weight: 600;
405
+ color: #36435c;
406
+ `,Description=styled__default.span`
407
+ margin-left: auto;
408
+ font-weight: 600;
409
+ color: #36435c;
410
+ `;exports.Description=Description,exports.DiffWrapper=DiffWrapper,exports.Header=Header,exports.Title=Title;
411
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../src/styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const DiffWrapper = styled.div`\n border-radius: 4px 4px 0 0;\n //border: 1px solid #ccd3db;\n\n .d2h-wrapper {\n text-align: left;\n }\n\n .d2h-file-header {\n display: none;\n }\n\n .d2h-file-header.d2h-sticky-header {\n position: sticky;\n top: 0;\n z-index: 1;\n }\n\n .d2h-file-stats {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 14px;\n margin-left: auto;\n }\n\n .d2h-lines-added {\n border: 1px solid #b4e2b4;\n border-radius: 5px 0 0 5px;\n color: #399839;\n padding: 2px;\n text-align: right;\n vertical-align: middle;\n }\n\n .d2h-lines-deleted {\n border: 1px solid #e9aeae;\n border-radius: 0 5px 5px 0;\n color: #c33;\n margin-left: 1px;\n padding: 2px;\n text-align: left;\n vertical-align: middle;\n }\n\n .d2h-file-name-wrapper {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 15px;\n width: 100%;\n }\n\n .d2h-file-name {\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .d2h-file-wrapper {\n border: 1px solid #ccd3db;\n border-radius: 0 0 4px 4px;\n border-top-width: 0;\n background-color: #fff;\n }\n\n .d2h-file-collapse {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n border: 1px solid #ddd;\n border-radius: 3px;\n cursor: pointer;\n display: none;\n font-size: 12px;\n justify-content: flex-end;\n padding: 4px 8px;\n }\n\n .d2h-file-collapse.d2h-selected {\n background-color: #c8e1ff;\n }\n\n .d2h-file-collapse-input {\n margin: 0 4px 0 0;\n }\n\n .d2h-diff-table {\n border-collapse: collapse;\n font-family: Menlo, Consolas, monospace;\n font-size: 13px;\n width: 100%;\n }\n\n .d2h-files-diff {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n }\n\n .d2h-file-diff {\n overflow-y: hidden;\n }\n\n .d2h-file-diff.d2h-d-none,\n .d2h-files-diff.d2h-d-none {\n display: none;\n }\n\n .d2h-file-side-diff {\n display: inline-block;\n overflow-x: scroll;\n overflow-y: hidden;\n width: 50%;\n }\n\n .d2h-code-line {\n padding: 0 8em;\n }\n\n .d2h-code-line,\n .d2h-code-side-line {\n display: inline-block;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n background-color: transparent !important;\n }\n\n .d2h-code-side-line {\n padding: 0 4.5em;\n }\n\n .d2h-code-line-ctn {\n word-wrap: normal;\n background: none;\n display: inline-block;\n padding: 0;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n vertical-align: middle;\n white-space: pre;\n width: 100%;\n }\n\n .d2h-code-line del,\n .d2h-code-side-line del {\n background-color: rgba(234, 133, 115, 0.7);\n }\n\n .d2h-code-line del,\n .d2h-code-line ins,\n .d2h-code-side-line del,\n .d2h-code-side-line ins {\n border-radius: 0.2em;\n display: inline-block;\n margin-top: -1px;\n text-decoration: none;\n vertical-align: middle;\n }\n\n .d2h-code-line ins,\n .d2h-code-side-line ins {\n background-color: rgba(85, 188, 138, 0.7);\n text-align: left;\n }\n\n .d2h-code-line-prefix {\n word-wrap: normal;\n background: none;\n display: inline;\n padding: 0;\n white-space: pre;\n }\n\n .line-num1 {\n float: left;\n }\n\n .line-num1,\n .line-num2 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n overflow: hidden;\n padding: 0 0.5em;\n text-overflow: ellipsis;\n width: 3.5em;\n }\n\n .line-num2 {\n float: right;\n }\n\n .d2h-code-linenumber {\n background-color: rgba(239, 244, 249, 0.8);\n border: solid #eee;\n border-width: 0 1px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.3);\n cursor: pointer;\n display: inline-block;\n position: absolute;\n text-align: right;\n width: 7.5em;\n }\n\n .d2h-code-linenumber:after {\n content: '\\\\200b';\n }\n\n .d2h-code-side-linenumber {\n background-color: #fff;\n border: solid #eee;\n border-width: 0 1px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.3);\n cursor: pointer;\n display: inline-block;\n overflow: hidden;\n padding: 0 0.5em;\n position: absolute;\n text-align: right;\n text-overflow: ellipsis;\n width: 4em;\n }\n\n .d2h-code-side-linenumber:after {\n content: '\\\\200b';\n }\n\n .d2h-code-side-emptyplaceholder,\n .d2h-emptyplaceholder {\n background-color: #f1f1f1;\n border-color: #e1e1e1;\n }\n\n .d2h-code-line-prefix,\n .d2h-code-linenumber,\n .d2h-code-side-linenumber,\n .d2h-emptyplaceholder {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .d2h-code-linenumber,\n .d2h-code-side-linenumber {\n direction: rtl;\n }\n\n .d2h-del {\n background-color: #fee8e9;\n border-color: #e9aeae;\n }\n\n .d2h-ins {\n background-color: rgba(162, 216, 187, 0.7);\n border-color: #b4e2b4;\n }\n\n .d2h-info {\n background-color: #f8fafd;\n border-color: #d5e4f2;\n color: rgba(0, 0, 0, 0.3);\n }\n\n .d2h-file-diff .d2h-del.d2h-change {\n background-color: rgba(250, 231, 229, 0.7);\n }\n\n .d2h-file-diff .d2h-ins.d2h-change {\n background-color: rgba(196, 230, 212, 0.7);\n }\n\n .d2h-file-list-wrapper {\n margin-bottom: 10px;\n }\n\n .d2h-file-list-wrapper a {\n color: #3572b0;\n text-decoration: none;\n }\n\n .d2h-file-list-wrapper a:visited {\n color: #3572b0;\n }\n\n .d2h-file-list-header {\n text-align: left;\n }\n\n .d2h-file-list-title {\n font-weight: 700;\n }\n\n .d2h-file-list-line {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n text-align: left;\n }\n\n .d2h-file-list {\n display: block;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .d2h-file-list > li {\n border-bottom: 1px solid #ddd;\n margin: 0;\n padding: 5px 10px;\n }\n\n .d2h-file-list > li:last-child {\n border-bottom: none;\n }\n\n .d2h-file-switch {\n cursor: pointer;\n display: none;\n font-size: 10px;\n }\n\n .d2h-icon {\n fill: currentColor;\n margin-right: 10px;\n vertical-align: middle;\n }\n\n .d2h-deleted {\n color: #c33;\n }\n\n .d2h-added {\n color: #399839;\n }\n\n .d2h-changed {\n color: #d0b44c;\n }\n\n .d2h-moved {\n color: #3572b0;\n }\n\n .d2h-tag {\n background-color: #fff;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 10px;\n margin-left: 5px;\n padding: 0 2px;\n }\n\n .d2h-deleted-tag {\n border: 1px solid #c33;\n }\n\n .d2h-added-tag {\n border: 1px solid #399839;\n }\n\n .d2h-changed-tag {\n border: 1px solid #d0b44c;\n }\n\n .d2h-moved-tag {\n border: 1px solid #3572b0;\n }\n`;\n\nexport const Header = styled.div`\n display: flex;\n align-items: center;\n padding: 12px;\n border-radius: 4px 4px 0 0;\n border: 1px solid #ccd3db;\n background-color: #eff4f9;\n\n .kubed-icon {\n margin-right: 4px;\n }\n\n .switch-mode {\n cursor: pointer;\n }\n`;\n\nexport const Title = styled.span`\n margin-right: 4px;\n font-weight: 600;\n color: #36435c;\n`;\n\nexport const Description = styled.span`\n margin-left: auto;\n font-weight: 600;\n color: #36435c;\n`;\n"],"names":["styled"],"mappings":";;;;;;;;;;AACY,MAAC,WAAW,GAAGA,eAAM,CAAC,GAAG,CAAC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACU,MAAC,MAAM,GAAGA,eAAM,CAAC,GAAG,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACU,MAAC,KAAK,GAAGA,eAAM,CAAC,IAAI,CAAC;AACjC;AACA;AACA;AACA,EAAE;AACU,MAAC,WAAW,GAAGA,eAAM,CAAC,IAAI,CAAC;AACvC;AACA;AACA;AACA;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import o,{useState as c,useEffect as h}from"react";import{createPatch as y}from"diff";import{html as E,parse as v}from"diff2html";import{Terminal as O,ChevronDown as P,ChevronRight as g}from"@kubed/icons";import{DiffWrapper as w,Header as b,Title as D,Description as C}from"./styles.js";var H=Object.defineProperty,f=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,p=(r,e,t)=>e in r?H(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,j=(r,e)=>{for(var t in e||(e={}))S.call(e,t)&&p(r,t,e[t]);if(f)for(var t of f(e))F.call(e,t)&&p(r,t,e[t]);return r};const a=(r,e,t={})=>{const n=y("yaml",r,e,"","",{context:-1}),i=v(n);return E(i,j({drawFileList:!1},t))},z=({title:r,description:e,mode:t="line-by-line",oldValue:n,newValue:i})=>{const[d,u]=c(t),[_,l]=c(a(n,i,{outputFormat:t})),s=m=>{u(m),l(a(n,i,{outputFormat:m}))};return h(()=>{l(a(n,i,{outputFormat:d}))},[n,i]),o.createElement(w,null,o.createElement(b,null,o.createElement(O,{size:20}),o.createElement(D,null,r),o.createElement(P,{size:20,className:"switch-mode",onClick:()=>{s("line-by-line")}}),o.createElement(g,{size:20,className:"switch-mode",onClick:()=>{s("side-by-side")}}),o.createElement(C,null,e)),o.createElement("div",{dangerouslySetInnerHTML:{__html:_}}))};export{z as DiffViewer};
2
+ //# sourceMappingURL=DiffViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffViewer.js","sources":["../src/DiffViewer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { createPatch } from 'diff';\nimport { parse, html } from 'diff2html';\nimport { Terminal, ChevronDown, ChevronRight } from '@kubed/icons';\nimport { DiffWrapper, Header, Title, Description } from './styles';\n\nconst getDiffHtml = (oldValue, newValue, options = {}) => {\n const diffStr = createPatch('yaml', oldValue, newValue, '', '', {\n context: -1,\n });\n const diffJson = parse(diffStr);\n return html(diffJson, {\n drawFileList: false,\n ...options,\n });\n};\n\nexport interface DiffViewerProps {\n title?: string | React.ReactNode;\n description?: string | React.ReactNode;\n mode?: 'line-by-line' | 'side-by-side';\n oldValue: string;\n newValue: string;\n}\n\nexport const DiffViewer = ({\n title,\n description,\n mode = 'line-by-line',\n oldValue,\n newValue,\n}: DiffViewerProps) => {\n const [_mode, setMode] = useState(mode);\n const [diffHtml, setDiffHtml] = useState(getDiffHtml(oldValue, newValue, { outputFormat: mode }));\n\n const handleModeChange = (m) => {\n setMode(m);\n setDiffHtml(getDiffHtml(oldValue, newValue, { outputFormat: m }));\n };\n\n useEffect(() => {\n setDiffHtml(getDiffHtml(oldValue, newValue, { outputFormat: _mode }));\n }, [oldValue, newValue]);\n\n return (\n <DiffWrapper>\n <Header>\n <Terminal size={20} />\n <Title>{title}</Title>\n <ChevronDown\n size={20}\n className=\"switch-mode\"\n onClick={() => {\n handleModeChange('line-by-line');\n }}\n />\n <ChevronRight\n size={20}\n className=\"switch-mode\"\n onClick={() => {\n handleModeChange('side-by-side');\n }}\n />\n <Description>{description}</Description>\n </Header>\n <div\n dangerouslySetInnerHTML={{\n __html: diffHtml,\n }}\n />\n </DiffWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAm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;;;;"}
package/esm/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export{DiffViewer}from"./DiffViewer.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/esm/styles.js ADDED
@@ -0,0 +1,411 @@
1
+ import e from"styled-components";const d=e.div`
2
+ border-radius: 4px 4px 0 0;
3
+ //border: 1px solid #ccd3db;
4
+
5
+ .d2h-wrapper {
6
+ text-align: left;
7
+ }
8
+
9
+ .d2h-file-header {
10
+ display: none;
11
+ }
12
+
13
+ .d2h-file-header.d2h-sticky-header {
14
+ position: sticky;
15
+ top: 0;
16
+ z-index: 1;
17
+ }
18
+
19
+ .d2h-file-stats {
20
+ display: -webkit-box;
21
+ display: -ms-flexbox;
22
+ display: flex;
23
+ font-size: 14px;
24
+ margin-left: auto;
25
+ }
26
+
27
+ .d2h-lines-added {
28
+ border: 1px solid #b4e2b4;
29
+ border-radius: 5px 0 0 5px;
30
+ color: #399839;
31
+ padding: 2px;
32
+ text-align: right;
33
+ vertical-align: middle;
34
+ }
35
+
36
+ .d2h-lines-deleted {
37
+ border: 1px solid #e9aeae;
38
+ border-radius: 0 5px 5px 0;
39
+ color: #c33;
40
+ margin-left: 1px;
41
+ padding: 2px;
42
+ text-align: left;
43
+ vertical-align: middle;
44
+ }
45
+
46
+ .d2h-file-name-wrapper {
47
+ -webkit-box-align: center;
48
+ -ms-flex-align: center;
49
+ align-items: center;
50
+ display: -webkit-box;
51
+ display: -ms-flexbox;
52
+ display: flex;
53
+ font-size: 15px;
54
+ width: 100%;
55
+ }
56
+
57
+ .d2h-file-name {
58
+ overflow-x: hidden;
59
+ text-overflow: ellipsis;
60
+ white-space: nowrap;
61
+ }
62
+
63
+ .d2h-file-wrapper {
64
+ border: 1px solid #ccd3db;
65
+ border-radius: 0 0 4px 4px;
66
+ border-top-width: 0;
67
+ background-color: #fff;
68
+ }
69
+
70
+ .d2h-file-collapse {
71
+ -webkit-box-pack: end;
72
+ -ms-flex-pack: end;
73
+ -webkit-box-align: center;
74
+ -ms-flex-align: center;
75
+ align-items: center;
76
+ border: 1px solid #ddd;
77
+ border-radius: 3px;
78
+ cursor: pointer;
79
+ display: none;
80
+ font-size: 12px;
81
+ justify-content: flex-end;
82
+ padding: 4px 8px;
83
+ }
84
+
85
+ .d2h-file-collapse.d2h-selected {
86
+ background-color: #c8e1ff;
87
+ }
88
+
89
+ .d2h-file-collapse-input {
90
+ margin: 0 4px 0 0;
91
+ }
92
+
93
+ .d2h-diff-table {
94
+ border-collapse: collapse;
95
+ font-family: Menlo, Consolas, monospace;
96
+ font-size: 13px;
97
+ width: 100%;
98
+ }
99
+
100
+ .d2h-files-diff {
101
+ display: -webkit-box;
102
+ display: -ms-flexbox;
103
+ display: flex;
104
+ width: 100%;
105
+ }
106
+
107
+ .d2h-file-diff {
108
+ overflow-y: hidden;
109
+ }
110
+
111
+ .d2h-file-diff.d2h-d-none,
112
+ .d2h-files-diff.d2h-d-none {
113
+ display: none;
114
+ }
115
+
116
+ .d2h-file-side-diff {
117
+ display: inline-block;
118
+ overflow-x: scroll;
119
+ overflow-y: hidden;
120
+ width: 50%;
121
+ }
122
+
123
+ .d2h-code-line {
124
+ padding: 0 8em;
125
+ }
126
+
127
+ .d2h-code-line,
128
+ .d2h-code-side-line {
129
+ display: inline-block;
130
+ -webkit-user-select: none;
131
+ -moz-user-select: none;
132
+ -ms-user-select: none;
133
+ user-select: none;
134
+ white-space: nowrap;
135
+ width: 100%;
136
+ background-color: transparent !important;
137
+ }
138
+
139
+ .d2h-code-side-line {
140
+ padding: 0 4.5em;
141
+ }
142
+
143
+ .d2h-code-line-ctn {
144
+ word-wrap: normal;
145
+ background: none;
146
+ display: inline-block;
147
+ padding: 0;
148
+ -webkit-user-select: text;
149
+ -moz-user-select: text;
150
+ -ms-user-select: text;
151
+ user-select: text;
152
+ vertical-align: middle;
153
+ white-space: pre;
154
+ width: 100%;
155
+ }
156
+
157
+ .d2h-code-line del,
158
+ .d2h-code-side-line del {
159
+ background-color: rgba(234, 133, 115, 0.7);
160
+ }
161
+
162
+ .d2h-code-line del,
163
+ .d2h-code-line ins,
164
+ .d2h-code-side-line del,
165
+ .d2h-code-side-line ins {
166
+ border-radius: 0.2em;
167
+ display: inline-block;
168
+ margin-top: -1px;
169
+ text-decoration: none;
170
+ vertical-align: middle;
171
+ }
172
+
173
+ .d2h-code-line ins,
174
+ .d2h-code-side-line ins {
175
+ background-color: rgba(85, 188, 138, 0.7);
176
+ text-align: left;
177
+ }
178
+
179
+ .d2h-code-line-prefix {
180
+ word-wrap: normal;
181
+ background: none;
182
+ display: inline;
183
+ padding: 0;
184
+ white-space: pre;
185
+ }
186
+
187
+ .line-num1 {
188
+ float: left;
189
+ }
190
+
191
+ .line-num1,
192
+ .line-num2 {
193
+ -webkit-box-sizing: border-box;
194
+ box-sizing: border-box;
195
+ overflow: hidden;
196
+ padding: 0 0.5em;
197
+ text-overflow: ellipsis;
198
+ width: 3.5em;
199
+ }
200
+
201
+ .line-num2 {
202
+ float: right;
203
+ }
204
+
205
+ .d2h-code-linenumber {
206
+ background-color: rgba(239, 244, 249, 0.8);
207
+ border: solid #eee;
208
+ border-width: 0 1px;
209
+ -webkit-box-sizing: border-box;
210
+ box-sizing: border-box;
211
+ color: rgba(0, 0, 0, 0.3);
212
+ cursor: pointer;
213
+ display: inline-block;
214
+ position: absolute;
215
+ text-align: right;
216
+ width: 7.5em;
217
+ }
218
+
219
+ .d2h-code-linenumber:after {
220
+ content: '\\200b';
221
+ }
222
+
223
+ .d2h-code-side-linenumber {
224
+ background-color: #fff;
225
+ border: solid #eee;
226
+ border-width: 0 1px;
227
+ -webkit-box-sizing: border-box;
228
+ box-sizing: border-box;
229
+ color: rgba(0, 0, 0, 0.3);
230
+ cursor: pointer;
231
+ display: inline-block;
232
+ overflow: hidden;
233
+ padding: 0 0.5em;
234
+ position: absolute;
235
+ text-align: right;
236
+ text-overflow: ellipsis;
237
+ width: 4em;
238
+ }
239
+
240
+ .d2h-code-side-linenumber:after {
241
+ content: '\\200b';
242
+ }
243
+
244
+ .d2h-code-side-emptyplaceholder,
245
+ .d2h-emptyplaceholder {
246
+ background-color: #f1f1f1;
247
+ border-color: #e1e1e1;
248
+ }
249
+
250
+ .d2h-code-line-prefix,
251
+ .d2h-code-linenumber,
252
+ .d2h-code-side-linenumber,
253
+ .d2h-emptyplaceholder {
254
+ -webkit-user-select: none;
255
+ -moz-user-select: none;
256
+ -ms-user-select: none;
257
+ user-select: none;
258
+ }
259
+
260
+ .d2h-code-linenumber,
261
+ .d2h-code-side-linenumber {
262
+ direction: rtl;
263
+ }
264
+
265
+ .d2h-del {
266
+ background-color: #fee8e9;
267
+ border-color: #e9aeae;
268
+ }
269
+
270
+ .d2h-ins {
271
+ background-color: rgba(162, 216, 187, 0.7);
272
+ border-color: #b4e2b4;
273
+ }
274
+
275
+ .d2h-info {
276
+ background-color: #f8fafd;
277
+ border-color: #d5e4f2;
278
+ color: rgba(0, 0, 0, 0.3);
279
+ }
280
+
281
+ .d2h-file-diff .d2h-del.d2h-change {
282
+ background-color: rgba(250, 231, 229, 0.7);
283
+ }
284
+
285
+ .d2h-file-diff .d2h-ins.d2h-change {
286
+ background-color: rgba(196, 230, 212, 0.7);
287
+ }
288
+
289
+ .d2h-file-list-wrapper {
290
+ margin-bottom: 10px;
291
+ }
292
+
293
+ .d2h-file-list-wrapper a {
294
+ color: #3572b0;
295
+ text-decoration: none;
296
+ }
297
+
298
+ .d2h-file-list-wrapper a:visited {
299
+ color: #3572b0;
300
+ }
301
+
302
+ .d2h-file-list-header {
303
+ text-align: left;
304
+ }
305
+
306
+ .d2h-file-list-title {
307
+ font-weight: 700;
308
+ }
309
+
310
+ .d2h-file-list-line {
311
+ display: -webkit-box;
312
+ display: -ms-flexbox;
313
+ display: flex;
314
+ text-align: left;
315
+ }
316
+
317
+ .d2h-file-list {
318
+ display: block;
319
+ list-style: none;
320
+ margin: 0;
321
+ padding: 0;
322
+ }
323
+
324
+ .d2h-file-list > li {
325
+ border-bottom: 1px solid #ddd;
326
+ margin: 0;
327
+ padding: 5px 10px;
328
+ }
329
+
330
+ .d2h-file-list > li:last-child {
331
+ border-bottom: none;
332
+ }
333
+
334
+ .d2h-file-switch {
335
+ cursor: pointer;
336
+ display: none;
337
+ font-size: 10px;
338
+ }
339
+
340
+ .d2h-icon {
341
+ fill: currentColor;
342
+ margin-right: 10px;
343
+ vertical-align: middle;
344
+ }
345
+
346
+ .d2h-deleted {
347
+ color: #c33;
348
+ }
349
+
350
+ .d2h-added {
351
+ color: #399839;
352
+ }
353
+
354
+ .d2h-changed {
355
+ color: #d0b44c;
356
+ }
357
+
358
+ .d2h-moved {
359
+ color: #3572b0;
360
+ }
361
+
362
+ .d2h-tag {
363
+ background-color: #fff;
364
+ display: -webkit-box;
365
+ display: -ms-flexbox;
366
+ display: flex;
367
+ font-size: 10px;
368
+ margin-left: 5px;
369
+ padding: 0 2px;
370
+ }
371
+
372
+ .d2h-deleted-tag {
373
+ border: 1px solid #c33;
374
+ }
375
+
376
+ .d2h-added-tag {
377
+ border: 1px solid #399839;
378
+ }
379
+
380
+ .d2h-changed-tag {
381
+ border: 1px solid #d0b44c;
382
+ }
383
+
384
+ .d2h-moved-tag {
385
+ border: 1px solid #3572b0;
386
+ }
387
+ `,i=e.div`
388
+ display: flex;
389
+ align-items: center;
390
+ padding: 12px;
391
+ border-radius: 4px 4px 0 0;
392
+ border: 1px solid #ccd3db;
393
+ background-color: #eff4f9;
394
+
395
+ .kubed-icon {
396
+ margin-right: 4px;
397
+ }
398
+
399
+ .switch-mode {
400
+ cursor: pointer;
401
+ }
402
+ `,o=e.span`
403
+ margin-right: 4px;
404
+ font-weight: 600;
405
+ color: #36435c;
406
+ `,l=e.span`
407
+ margin-left: auto;
408
+ font-weight: 600;
409
+ color: #36435c;
410
+ `;export{l as Description,d as DiffWrapper,i as Header,o as Title};
411
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../src/styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const DiffWrapper = styled.div`\n border-radius: 4px 4px 0 0;\n //border: 1px solid #ccd3db;\n\n .d2h-wrapper {\n text-align: left;\n }\n\n .d2h-file-header {\n display: none;\n }\n\n .d2h-file-header.d2h-sticky-header {\n position: sticky;\n top: 0;\n z-index: 1;\n }\n\n .d2h-file-stats {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 14px;\n margin-left: auto;\n }\n\n .d2h-lines-added {\n border: 1px solid #b4e2b4;\n border-radius: 5px 0 0 5px;\n color: #399839;\n padding: 2px;\n text-align: right;\n vertical-align: middle;\n }\n\n .d2h-lines-deleted {\n border: 1px solid #e9aeae;\n border-radius: 0 5px 5px 0;\n color: #c33;\n margin-left: 1px;\n padding: 2px;\n text-align: left;\n vertical-align: middle;\n }\n\n .d2h-file-name-wrapper {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 15px;\n width: 100%;\n }\n\n .d2h-file-name {\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .d2h-file-wrapper {\n border: 1px solid #ccd3db;\n border-radius: 0 0 4px 4px;\n border-top-width: 0;\n background-color: #fff;\n }\n\n .d2h-file-collapse {\n -webkit-box-pack: end;\n -ms-flex-pack: end;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n border: 1px solid #ddd;\n border-radius: 3px;\n cursor: pointer;\n display: none;\n font-size: 12px;\n justify-content: flex-end;\n padding: 4px 8px;\n }\n\n .d2h-file-collapse.d2h-selected {\n background-color: #c8e1ff;\n }\n\n .d2h-file-collapse-input {\n margin: 0 4px 0 0;\n }\n\n .d2h-diff-table {\n border-collapse: collapse;\n font-family: Menlo, Consolas, monospace;\n font-size: 13px;\n width: 100%;\n }\n\n .d2h-files-diff {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n }\n\n .d2h-file-diff {\n overflow-y: hidden;\n }\n\n .d2h-file-diff.d2h-d-none,\n .d2h-files-diff.d2h-d-none {\n display: none;\n }\n\n .d2h-file-side-diff {\n display: inline-block;\n overflow-x: scroll;\n overflow-y: hidden;\n width: 50%;\n }\n\n .d2h-code-line {\n padding: 0 8em;\n }\n\n .d2h-code-line,\n .d2h-code-side-line {\n display: inline-block;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n background-color: transparent !important;\n }\n\n .d2h-code-side-line {\n padding: 0 4.5em;\n }\n\n .d2h-code-line-ctn {\n word-wrap: normal;\n background: none;\n display: inline-block;\n padding: 0;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n vertical-align: middle;\n white-space: pre;\n width: 100%;\n }\n\n .d2h-code-line del,\n .d2h-code-side-line del {\n background-color: rgba(234, 133, 115, 0.7);\n }\n\n .d2h-code-line del,\n .d2h-code-line ins,\n .d2h-code-side-line del,\n .d2h-code-side-line ins {\n border-radius: 0.2em;\n display: inline-block;\n margin-top: -1px;\n text-decoration: none;\n vertical-align: middle;\n }\n\n .d2h-code-line ins,\n .d2h-code-side-line ins {\n background-color: rgba(85, 188, 138, 0.7);\n text-align: left;\n }\n\n .d2h-code-line-prefix {\n word-wrap: normal;\n background: none;\n display: inline;\n padding: 0;\n white-space: pre;\n }\n\n .line-num1 {\n float: left;\n }\n\n .line-num1,\n .line-num2 {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n overflow: hidden;\n padding: 0 0.5em;\n text-overflow: ellipsis;\n width: 3.5em;\n }\n\n .line-num2 {\n float: right;\n }\n\n .d2h-code-linenumber {\n background-color: rgba(239, 244, 249, 0.8);\n border: solid #eee;\n border-width: 0 1px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.3);\n cursor: pointer;\n display: inline-block;\n position: absolute;\n text-align: right;\n width: 7.5em;\n }\n\n .d2h-code-linenumber:after {\n content: '\\\\200b';\n }\n\n .d2h-code-side-linenumber {\n background-color: #fff;\n border: solid #eee;\n border-width: 0 1px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: rgba(0, 0, 0, 0.3);\n cursor: pointer;\n display: inline-block;\n overflow: hidden;\n padding: 0 0.5em;\n position: absolute;\n text-align: right;\n text-overflow: ellipsis;\n width: 4em;\n }\n\n .d2h-code-side-linenumber:after {\n content: '\\\\200b';\n }\n\n .d2h-code-side-emptyplaceholder,\n .d2h-emptyplaceholder {\n background-color: #f1f1f1;\n border-color: #e1e1e1;\n }\n\n .d2h-code-line-prefix,\n .d2h-code-linenumber,\n .d2h-code-side-linenumber,\n .d2h-emptyplaceholder {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .d2h-code-linenumber,\n .d2h-code-side-linenumber {\n direction: rtl;\n }\n\n .d2h-del {\n background-color: #fee8e9;\n border-color: #e9aeae;\n }\n\n .d2h-ins {\n background-color: rgba(162, 216, 187, 0.7);\n border-color: #b4e2b4;\n }\n\n .d2h-info {\n background-color: #f8fafd;\n border-color: #d5e4f2;\n color: rgba(0, 0, 0, 0.3);\n }\n\n .d2h-file-diff .d2h-del.d2h-change {\n background-color: rgba(250, 231, 229, 0.7);\n }\n\n .d2h-file-diff .d2h-ins.d2h-change {\n background-color: rgba(196, 230, 212, 0.7);\n }\n\n .d2h-file-list-wrapper {\n margin-bottom: 10px;\n }\n\n .d2h-file-list-wrapper a {\n color: #3572b0;\n text-decoration: none;\n }\n\n .d2h-file-list-wrapper a:visited {\n color: #3572b0;\n }\n\n .d2h-file-list-header {\n text-align: left;\n }\n\n .d2h-file-list-title {\n font-weight: 700;\n }\n\n .d2h-file-list-line {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n text-align: left;\n }\n\n .d2h-file-list {\n display: block;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .d2h-file-list > li {\n border-bottom: 1px solid #ddd;\n margin: 0;\n padding: 5px 10px;\n }\n\n .d2h-file-list > li:last-child {\n border-bottom: none;\n }\n\n .d2h-file-switch {\n cursor: pointer;\n display: none;\n font-size: 10px;\n }\n\n .d2h-icon {\n fill: currentColor;\n margin-right: 10px;\n vertical-align: middle;\n }\n\n .d2h-deleted {\n color: #c33;\n }\n\n .d2h-added {\n color: #399839;\n }\n\n .d2h-changed {\n color: #d0b44c;\n }\n\n .d2h-moved {\n color: #3572b0;\n }\n\n .d2h-tag {\n background-color: #fff;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: 10px;\n margin-left: 5px;\n padding: 0 2px;\n }\n\n .d2h-deleted-tag {\n border: 1px solid #c33;\n }\n\n .d2h-added-tag {\n border: 1px solid #399839;\n }\n\n .d2h-changed-tag {\n border: 1px solid #d0b44c;\n }\n\n .d2h-moved-tag {\n border: 1px solid #3572b0;\n }\n`;\n\nexport const Header = styled.div`\n display: flex;\n align-items: center;\n padding: 12px;\n border-radius: 4px 4px 0 0;\n border: 1px solid #ccd3db;\n background-color: #eff4f9;\n\n .kubed-icon {\n margin-right: 4px;\n }\n\n .switch-mode {\n cursor: pointer;\n }\n`;\n\nexport const Title = styled.span`\n margin-right: 4px;\n font-weight: 600;\n color: #36435c;\n`;\n\nexport const Description = styled.span`\n margin-left: auto;\n font-weight: 600;\n color: #36435c;\n`;\n"],"names":[],"mappings":";;AACY,MAAC,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACU,MAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACU,MAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;AACjC;AACA;AACA;AACA,EAAE;AACU,MAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;AACvC;AACA;AACA;AACA;;;;"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface DiffViewerProps {
3
+ title?: string | React.ReactNode;
4
+ description?: string | React.ReactNode;
5
+ mode?: 'line-by-line' | 'side-by-side';
6
+ oldValue: string;
7
+ newValue: string;
8
+ }
9
+ export declare const DiffViewer: ({ title, description, mode, oldValue, newValue, }: DiffViewerProps) => JSX.Element;
10
+ //# sourceMappingURL=DiffViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffViewer.d.ts","sourceRoot":"","sources":["../src/DiffViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACvC,IAAI,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,UAAU,sDAMpB,eAAe,gBAyCjB,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './DiffViewer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const DiffWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const Title: import("styled-components").StyledComponent<"span", any, {}, never>;
4
+ export declare const Description: import("styled-components").StyledComponent<"span", any, {}, never>;
5
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,oEAkYvB,CAAC;AAEF,eAAO,MAAM,MAAM,oEAelB,CAAC;AAEF,eAAO,MAAM,KAAK,qEAIjB,CAAC;AAEF,eAAO,MAAM,WAAW,qEAIvB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@kubed/diff-viewer",
3
+ "version": "0.0.2",
4
+ "main": "cjs/index.js",
5
+ "module": "esm/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "license": "MIT",
8
+ "sideEffects": false,
9
+ "homepage": "https://github.com/kubesphere/kube-design",
10
+ "files": [
11
+ "cjs",
12
+ "esm",
13
+ "lib"
14
+ ],
15
+ "repository": {
16
+ "url": "https://github.com/kubesphere/kube-design.git",
17
+ "type": "git",
18
+ "directory": "packages/diff-viewer"
19
+ },
20
+ "peerDependencies": {
21
+ "@kubed/hooks": "0.0.10",
22
+ "@kubed/icons": "0.0.4",
23
+ "react": ">=16.8.0",
24
+ "react-dom": ">=16.8.0",
25
+ "react-is": "^17.0.2"
26
+ },
27
+ "dependencies": {
28
+ "diff": "^5.1.0",
29
+ "diff2html": "^3.4.22",
30
+ "lodash": "^4.17.21",
31
+ "styled-components": "^5.3.0"
32
+ },
33
+ "devDependencies": {}
34
+ }