@opensumi/ide-notebook 3.7.1-next-1739774311.0 → 3.7.1

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.
Files changed (81) hide show
  1. package/lib/browser/libro/libro-opensumi-content-contribution.d.ts.map +1 -1
  2. package/lib/browser/libro.contribution.d.ts.map +1 -1
  3. package/lib/browser/libro.contribution.js +4 -38
  4. package/lib/browser/libro.contribution.js.map +1 -1
  5. package/lib/browser/libro.protocol.d.ts +1 -3
  6. package/lib/browser/libro.protocol.d.ts.map +1 -1
  7. package/lib/browser/libro.protocol.js +1 -3
  8. package/lib/browser/libro.protocol.js.map +1 -1
  9. package/package.json +14 -20
  10. package/src/browser/libro/libro-opensumi-content-contribution.ts +1 -1
  11. package/src/browser/libro.contribution.tsx +4 -43
  12. package/src/browser/libro.protocol.ts +1 -3
  13. package/lib/browser/libro/diff-view/components/hooks.d.ts +0 -10
  14. package/lib/browser/libro/diff-view/components/hooks.d.ts.map +0 -1
  15. package/lib/browser/libro/diff-view/components/hooks.js +0 -96
  16. package/lib/browser/libro/diff-view/components/hooks.js.map +0 -1
  17. package/lib/browser/libro/diff-view/components/index.less +0 -315
  18. package/lib/browser/libro/diff-view/components/libro-diff-all-cells-same-components.d.ts +0 -3
  19. package/lib/browser/libro/diff-view/components/libro-diff-all-cells-same-components.d.ts.map +0 -1
  20. package/lib/browser/libro/diff-view/components/libro-diff-all-cells-same-components.js +0 -11
  21. package/lib/browser/libro/diff-view/components/libro-diff-all-cells-same-components.js.map +0 -1
  22. package/lib/browser/libro/diff-view/components/libro-diff-changed-cell-components.d.ts +0 -5
  23. package/lib/browser/libro/diff-view/components/libro-diff-changed-cell-components.d.ts.map +0 -1
  24. package/lib/browser/libro/diff-view/components/libro-diff-changed-cell-components.js +0 -59
  25. package/lib/browser/libro/diff-view/components/libro-diff-changed-cell-components.js.map +0 -1
  26. package/lib/browser/libro/diff-view/components/libro-diff-side-cell-components.d.ts +0 -5
  27. package/lib/browser/libro/diff-view/components/libro-diff-side-cell-components.d.ts.map +0 -1
  28. package/lib/browser/libro/diff-view/components/libro-diff-side-cell-components.js +0 -58
  29. package/lib/browser/libro/diff-view/components/libro-diff-side-cell-components.js.map +0 -1
  30. package/lib/browser/libro/diff-view/index.d.ts +0 -5
  31. package/lib/browser/libro/diff-view/index.d.ts.map +0 -1
  32. package/lib/browser/libro/diff-view/index.js +0 -5
  33. package/lib/browser/libro/diff-view/index.js.map +0 -1
  34. package/lib/browser/libro/diff-view/index.less +0 -47
  35. package/lib/browser/libro/diff-view/libro-diff-color-registry.d.ts +0 -6
  36. package/lib/browser/libro/diff-view/libro-diff-color-registry.d.ts.map +0 -1
  37. package/lib/browser/libro/diff-view/libro-diff-color-registry.js +0 -110
  38. package/lib/browser/libro/diff-view/libro-diff-color-registry.js.map +0 -1
  39. package/lib/browser/libro/diff-view/libro-diff-component.d.ts +0 -6
  40. package/lib/browser/libro/diff-view/libro-diff-component.d.ts.map +0 -1
  41. package/lib/browser/libro/diff-view/libro-diff-component.js +0 -21
  42. package/lib/browser/libro/diff-view/libro-diff-component.js.map +0 -1
  43. package/lib/browser/libro/diff-view/libro-diff-protocol.d.ts +0 -58
  44. package/lib/browser/libro/diff-view/libro-diff-protocol.d.ts.map +0 -1
  45. package/lib/browser/libro/diff-view/libro-diff-protocol.js +0 -38
  46. package/lib/browser/libro/diff-view/libro-diff-protocol.js.map +0 -1
  47. package/lib/browser/libro/diff-view/libro-diff-view.d.ts +0 -48
  48. package/lib/browser/libro/diff-view/libro-diff-view.d.ts.map +0 -1
  49. package/lib/browser/libro/diff-view/libro-diff-view.js +0 -297
  50. package/lib/browser/libro/diff-view/libro-diff-view.js.map +0 -1
  51. package/lib/browser/libro/diff-view/libro-version-manager.d.ts +0 -16
  52. package/lib/browser/libro/diff-view/libro-version-manager.d.ts.map +0 -1
  53. package/lib/browser/libro/diff-view/libro-version-manager.js +0 -126
  54. package/lib/browser/libro/diff-view/libro-version-manager.js.map +0 -1
  55. package/lib/browser/libro/diff-view/libro-version-view.d.ts +0 -13
  56. package/lib/browser/libro/diff-view/libro-version-view.d.ts.map +0 -1
  57. package/lib/browser/libro/diff-view/libro-version-view.js +0 -40
  58. package/lib/browser/libro/diff-view/libro-version-view.js.map +0 -1
  59. package/lib/browser/libro/diff-view/module.d.ts +0 -3
  60. package/lib/browser/libro/diff-view/module.d.ts.map +0 -1
  61. package/lib/browser/libro/diff-view/module.js +0 -10
  62. package/lib/browser/libro/diff-view/module.js.map +0 -1
  63. package/lib/browser/libro-preview.view.d.ts +0 -3
  64. package/lib/browser/libro-preview.view.d.ts.map +0 -1
  65. package/lib/browser/libro-preview.view.js +0 -27
  66. package/lib/browser/libro-preview.view.js.map +0 -1
  67. package/src/browser/libro/diff-view/components/hooks.tsx +0 -123
  68. package/src/browser/libro/diff-view/components/index.less +0 -315
  69. package/src/browser/libro/diff-view/components/libro-diff-all-cells-same-components.tsx +0 -43
  70. package/src/browser/libro/diff-view/components/libro-diff-changed-cell-components.tsx +0 -88
  71. package/src/browser/libro/diff-view/components/libro-diff-side-cell-components.tsx +0 -84
  72. package/src/browser/libro/diff-view/index.less +0 -47
  73. package/src/browser/libro/diff-view/index.ts +0 -4
  74. package/src/browser/libro/diff-view/libro-diff-color-registry.ts +0 -132
  75. package/src/browser/libro/diff-view/libro-diff-component.tsx +0 -25
  76. package/src/browser/libro/diff-view/libro-diff-protocol.ts +0 -94
  77. package/src/browser/libro/diff-view/libro-diff-view.tsx +0 -351
  78. package/src/browser/libro/diff-view/libro-version-manager.ts +0 -135
  79. package/src/browser/libro/diff-view/libro-version-view.tsx +0 -41
  80. package/src/browser/libro/diff-view/module.ts +0 -11
  81. package/src/browser/libro-preview.view.tsx +0 -33
@@ -1,315 +0,0 @@
1
- .libro-diff-cell-container {
2
- position: relative;
3
- padding: 8px 0;
4
- }
5
-
6
- .libro-diff-cell-origin-header,
7
- .libro-diff-cell-target-header {
8
- height: 22px;
9
- width: 100%;
10
- border-top-right-radius: 4px;
11
- border-top-left-radius: 4px;
12
- }
13
-
14
- .libro-diff-cell-unchanged-origin-header,
15
- .libro-diff-cell-unchanged-target-header,
16
- .libro-diff-cell-changed-origin-header,
17
- .libro-diff-cell-changed-target-header {
18
- background: var(--mana-libro-diff-unchanged-cell-header-color);
19
- }
20
-
21
- .libro-diff-cell-target-header {
22
- position: relative;
23
- &.changed,
24
- &.unchanged {
25
- float: right;
26
- }
27
- }
28
-
29
- .libro-diff-cell-origin-header {
30
- background: var(--mana-libro-diff-removed-cell-header-color);
31
- }
32
- .libro-diff-cell-target-header {
33
- background: var(--mana-libro-diff-added-cell-header-color);
34
- }
35
-
36
- .libro-diff-cell-header-text {
37
- margin-left: 16px;
38
- font-family: PingFangSC;
39
- font-weight: 400;
40
- font-size: 12px;
41
- color: var(--mana-libro-diff-cell-header-text-color);
42
- line-height: 20px;
43
- }
44
- .libro-diff-cell-header-target-execute-count,
45
- .libro-diff-cell-header-origin-execute-count {
46
- font-family: Menlo-Regular;
47
- font-weight: 400;
48
- font-size: 12px;
49
- color: var(--mana-libro-diff-cell-header-execution-color);
50
- text-align: right;
51
- line-height: 16px;
52
- float: right;
53
- margin-right: 16px;
54
- margin-top: 3px;
55
- }
56
-
57
- .libro-diff-editor-removed {
58
- background: var(--mana-libro-diff-editor-removed-color) !important;
59
- .monaco-editor-background,
60
- .margin {
61
- background: var(--mana-libro-diff-editor-removed-color) !important;
62
- }
63
- }
64
-
65
- .libro-diff-cell-origin-container,
66
- .libro-diff-cell-target-container {
67
- position: absolute;
68
- width: calc(50% - 8px);
69
- &.unchanged {
70
- border: 1px solid var(--mana-libro-diff-cell-border-color) !important;
71
- border-radius: 4px;
72
- }
73
- }
74
- .libro-diff-cell-target-container {
75
- right: 0;
76
- }
77
-
78
- .libro-diff-editor-added {
79
- background: var(--mana-libro-diff-editor-added-color) !important;
80
- .monaco-editor-background,
81
- .margin {
82
- background: var(--mana-libro-diff-editor-added-color) !important;
83
- }
84
- }
85
-
86
- .libro-diff-cell-target-container {
87
- background: var(--mana-libro-diff-editor-added-color) !important;
88
- border-radius: 4px;
89
- }
90
-
91
- .libro-diff-cell-origin-container {
92
- background: var(--mana-libro-diff-editor-removed-color) !important;
93
- border-radius: 4px;
94
- }
95
-
96
- .libro-diff-editor-added,
97
- .libro-diff-editor-removed {
98
- border-bottom-left-radius: 4px;
99
- border-bottom-right-radius: 4px;
100
- .overflow-guard {
101
- border-bottom-left-radius: 4px;
102
- }
103
- }
104
-
105
- .libro-diff-editor-changed,
106
- .libro-diff-editor-unchanged {
107
- .monaco-editor-background {
108
- border-radius: 4px;
109
- }
110
- }
111
-
112
- .libro-diff-cell-changed-origin-header,
113
- .libro-diff-cell-changed-target-header,
114
- .libro-diff-cell-unchanged-origin-header,
115
- .libro-diff-cell-unchanged-target-header {
116
- display: inline-block;
117
- width: calc(50% - 8px);
118
- border-top-left-radius: 4px;
119
- border-top-right-radius: 4px;
120
- }
121
- .libro-diff-cell-changed-target-header,
122
- .libro-diff-cell-unchanged-target-header {
123
- margin-left: 16px;
124
- }
125
-
126
- .libro-diff-cell-changed-content,
127
- .libro-diff-cell-unchanged-content {
128
- .monaco-editor,
129
- .margin {
130
- background-color: var(--mana-libro-diff-input-background-color) !important;
131
- }
132
- .monaco-editor-background {
133
- background-color: var(--mana-libro-diff-editor-background-color) !important;
134
- }
135
- }
136
- .libro-diff-cell-target-content,
137
- .libro-diff-cell-origin-content {
138
- margin-top: 12px;
139
- }
140
-
141
- .libro-diff-cell-target-content,
142
- .libro-diff-cell-origin-content,
143
- .libro-diff-cell-changed-content,
144
- .libro-diff-cell-unchanged-content {
145
- .core-guide-indent,
146
- .core-guide-indent-active {
147
- box-shadow: 0.6px 0 0 0 var(--mana-libro-diff-editor-intent-color) inset !important;
148
- }
149
- }
150
-
151
- .libro-diff-cell-changed-content,
152
- .libro-diff-cell-unchanged-content {
153
- .original,
154
- .modified {
155
- width: calc(50% - 8px) !important;
156
- .margin-view-overlays {
157
- > div:has(.line-delete),
158
- > div:has(.line-insert) {
159
- background-color: var(--mana-libro-diff-editor-background-color) !important;
160
- }
161
- .line-delete {
162
- background-color: var(--mana-libro-diff-editor-line-delete-color) !important;
163
- }
164
- width: 56px !important;
165
- }
166
-
167
- .diagonal-fill {
168
- background-color: var(--mana-libro-diff-input-background-color);
169
- }
170
-
171
- .view-overlays {
172
- div:has(.char-delete):has(.char-insert):has(.line-delete):has(.line-insert) {
173
- background-color: var(--mana-libro-diff-editor-background-color);
174
- }
175
- div:not(:has(.char-delete)):not(:has(.char-insert)):not(:has(.line-delete)):not(:has(.line-insert)) {
176
- background-color: var(--mana-libro-diff-input-background-color);
177
- }
178
- }
179
- .selectionHighlight {
180
- background-color: rgba(173, 214, 255, 0.15) !important;
181
- }
182
- }
183
- .modified {
184
- margin-left: 8px;
185
- box-shadow: unset !important;
186
- .line-insert,
187
- .gutter-insert {
188
- background-color: var(--mana-libro-diff-editor-line-insert-color) !important;
189
- }
190
- .char-insert {
191
- background-color: var(--mana-libro-diff-editor-char-insert-color) !important;
192
- }
193
- }
194
- .original {
195
- .line-delete,
196
- .gutter-delete {
197
- background-color: var(--mana-libro-diff-editor-line-delete-color) !important;
198
- }
199
- .char-delete {
200
- background-color: var(--mana-libro-diff-editor-char-delete-color) !important;
201
- }
202
- }
203
- .monaco-editor,
204
- .overflow-guard {
205
- width: 100% !important;
206
- border-bottom-left-radius: 4px;
207
- border-bottom-right-radius: 4px;
208
- }
209
- .overflow-guard {
210
- padding-top: 12px;
211
- }
212
- .margin {
213
- padding-top: 12px;
214
- }
215
- }
216
-
217
- .libro-diff-cell-changed-container,
218
- .libro-diff-cell-unchanged-container {
219
- position: relative;
220
- .monaco-diff-editor {
221
- background-color: var(--mana-libro-diff-container-color);
222
- }
223
- }
224
-
225
- .libro-diff-cell-container {
226
- .editor-scrollable {
227
- left: 56px !important;
228
- }
229
- .margin,
230
- .current-line-margin {
231
- width: 56px !important;
232
- }
233
- .line-numbers {
234
- color: var(--mana-libro-diff-editor-gutter-number-color) !important;
235
- font-family: Menlo-Regular, consolas, 'DejaVu Sans Mono', monospace !important;
236
- left: 0px !important;
237
- font-weight: 400;
238
- font-size: 13px;
239
- text-align: right !important;
240
- line-height: 20px;
241
- width: 32px !important;
242
- padding-left: 16px;
243
- }
244
-
245
- .cursors-layer .cursor {
246
- background-color: var(--mana-libro-editor-cursor-color);
247
- }
248
-
249
- .selected-text {
250
- background-color: var(--mana-libro-diff-select-background-color) !important;
251
- }
252
-
253
- .selectionHighlight {
254
- background-color: var(--mana-libro-diff-select-highlight-background-color) !important;
255
- }
256
- .focused {
257
- .selected-text {
258
- background-color: var(--mana-libro-diff-select-background-color) !important;
259
- }
260
- }
261
-
262
- .libro-diff-editor-added {
263
- &.monaco-editor {
264
- background-color: var(--mana-version-opensumi-diff-added-color) !important;
265
-
266
- .margin {
267
- background: var(--mana-version-opensumi-diff-added-color) !important;
268
- }
269
- }
270
-
271
- .monaco-editor-background {
272
- background: var(--mana-version-opensumi-diff-added-color) !important;
273
- }
274
- }
275
-
276
- .libro-diff-editor-removed {
277
- &.monaco-editor {
278
- background-color: var(--mana-version-opensumi-diff-removed-color) !important;
279
-
280
- .margin {
281
- background: var(--mana-version-opensumi-diff-removed-color) !important;
282
- }
283
- }
284
-
285
- .monaco-editor-background {
286
- background: var(--mana-version-opensumi-diff-removed-color) !important;
287
- }
288
- }
289
- }
290
- .libro-e2-editor-container {
291
- padding-top: 12px;
292
- }
293
-
294
- .libro-diff-cell-unchanged-origin-border,
295
- .libro-diff-cell-unchanged-target-border,
296
- .libro-diff-cell-changed-origin-border,
297
- .libro-diff-cell-changed-target-border {
298
- height: 100%;
299
- top: 0;
300
- border: 1px solid var(--mana-libro-diff-cell-border-color);
301
- width: calc(50% - 8px);
302
- position: absolute;
303
- border-radius: 4px;
304
- pointer-events: none;
305
- }
306
-
307
- .libro-diff-cell-unchanged-target-border,
308
- .libro-diff-cell-changed-target-border {
309
- right: 0;
310
- }
311
- .libro-version-content {
312
- .libro-view-top {
313
- height: 0;
314
- }
315
- }
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
-
3
- export const ContentSameIcon: React.FC = () => (
4
- <svg
5
- width='58px'
6
- height='70px'
7
- viewBox='0 0 58 70'
8
- version='1.1'
9
- xmlns='http://www.w3.org/2000/svg'
10
- xmlnsXlink='http://www.w3.org/1999/xlink'
11
- className='libro-diff-same'
12
- >
13
- <g id='页面-1' stroke='none' strokeWidth='1' fill='none' fillRule='evenodd'>
14
- <g id='2.2对比内容一致' transform='translate(-866.000000, -433.000000)' fillRule='nonzero'>
15
- <g id='编组-3' transform='translate(863.000000, 433.000000)'>
16
- <g id='编组' transform='translate(3.000000, 0.000000)'>
17
- <path
18
- d='M26.5130303,69.5820437 C15.5132424,65.7888934 11.5393636,62.6913727 11.5323333,62.6913727 C0.101060606,54.8513203 0,44.5577516 0,44.5577516 L0,12.0705345 C0,10.4780239 1.28830303,9.10951475 2.87187879,9.05176436 C10.9918788,8.76301243 22.9425152,2.76134734 27.3197576,0.423331722 C28.3685102,-0.141110574 29.6323686,-0.141110574 30.6811212,0.423331722 C35.0574848,2.76834739 47.0151515,8.76213743 55.1281212,9.05176436 C56.711697,9.10951475 58,10.4780239 58,12.0705345 L58,44.5577516 C58,44.5577516 57.8989394,54.8513203 46.4676667,62.6913727 C46.4676667,62.6913727 42.4937879,65.7888934 31.494,69.5820437 C29.8808432,70.1393188 28.1261871,70.1393188 26.5130303,69.5820437 Z M29,53.3751855 C39.1921818,53.3751855 47.4545455,45.1483805 47.4545455,35.0000627 C47.4545455,24.8517449 39.1921818,16.62494 29,16.62494 C18.8078182,16.62494 10.5454545,24.8517449 10.5454545,35.0000627 C10.5454545,45.1483805 18.8078182,53.3751855 29,53.3751855 Z'
19
- id='形状'
20
- fillOpacity='0.3'
21
- fill='#2196F3'
22
- />
23
- <path
24
- d='M28.5,54 C17.7306818,54 9,45.2693182 9,34.5 C9,23.7306818 17.7306818,15 28.5,15 C39.2693182,15 48,23.7306818 48,34.5 C48,45.2693182 39.2693182,54 28.5,54 Z'
25
- id='路径'
26
- fill='#1989FA'
27
- />
28
- <path
29
- d='M29,51 C37.8364444,51 45,43.8364444 45,35 C45,26.1635556 37.8364444,19 29,19 C20.1635556,19 13,26.1635556 13,35 C13,43.8364444 20.1635556,51 29,51 Z'
30
- id='路径'
31
- fill='#FFFFFF'
32
- />
33
- <path
34
- d='M39.8811584,47.8734755 C41.1971717,46.5565733 43.3307339,46.5565733 44.6467472,47.8734755 L49.012836,52.2420176 C50.3290547,53.5592357 50.3290547,55.6948683 49.0128359,57.0120864 C47.6966172,58.3293045 45.5626049,58.3293045 44.2463861,57.0120864 L39.8811584,52.6435444 C39.2489733,52.0110548 38.8938006,51.1531094 38.8938006,50.2585099 C38.8938006,49.3639104 39.2489733,48.5059651 39.8811584,47.8734755 L39.8811584,47.8734755 Z M27.3916134,36.6109087 L33.5141251,30.4837484 C34.189795,29.8306691 35.2638061,29.8400091 35.9280333,30.5047406 C36.5922605,31.1694721 36.6015933,32.2442987 35.9490095,32.9204816 L28.6434953,40.2324043 C28.4552892,40.4214183 28.2256395,40.5639151 27.9727828,40.648579 C27.3417735,40.8823076 26.6325337,40.7268228 26.1569514,40.2504988 L22.5046247,36.5953991 C22.0695207,36.1601187 21.8995112,35.5256015 22.0586371,34.930864 C22.2177631,34.3361266 22.6818494,33.8715236 23.2760794,33.7120666 C23.8703093,33.5526096 24.5044051,33.7225239 24.9395092,34.1578043 L27.3916134,36.6117704 L27.3916134,36.6109087 Z'
35
- id='形状'
36
- fill='#1989FA'
37
- />
38
- </g>
39
- </g>
40
- </g>
41
- </g>
42
- </svg>
43
- );
@@ -1,88 +0,0 @@
1
- import { useInject } from '@difizen/mana-app';
2
- import React, { memo, useEffect, useRef, useState } from 'react';
3
-
4
- import { IDiffEditor } from '@opensumi/ide-monaco';
5
-
6
- import { getLibroCellType, getSource } from '../libro-diff-protocol';
7
- import { LibroVersionManager } from '../libro-version-manager';
8
-
9
- import { useEditorLayout } from './hooks';
10
-
11
- import type { DiffEditorProps } from '../libro-diff-protocol';
12
-
13
- import './index.less';
14
-
15
- const getEditorLanguage = (libroCellType: string) => {
16
- if (libroCellType === 'sql') {
17
- return 'sql-odps';
18
- } else if (libroCellType === 'markdown' || libroCellType === 'raw') {
19
- return 'markdown';
20
- } else {
21
- return 'python';
22
- }
23
- };
24
-
25
- export const LibroDiffChangedCellComponent: React.FC<DiffEditorProps> = memo(({ diffCellResultItem }) => {
26
- const editorDiffRef = useRef<HTMLDivElement>(null);
27
- const editorContainerRef = useRef<HTMLDivElement>(null);
28
- const [diffEditor, setDiffEditor] = useState<IDiffEditor | undefined>();
29
- const versionManager = useInject(LibroVersionManager);
30
- useEffect(() => {
31
- if (!editorDiffRef.current) {
32
- return;
33
- }
34
- const language = diffCellResultItem.origin.metadata.libroCellType
35
- ? getEditorLanguage(diffCellResultItem.origin.metadata.libroCellType.toString())
36
- : getEditorLanguage(diffCellResultItem.origin.cell_type);
37
- const diffEditor = versionManager.createDiffEditor(
38
- getSource(diffCellResultItem.origin),
39
- getSource(diffCellResultItem.target),
40
- language,
41
- editorDiffRef.current,
42
- );
43
- setDiffEditor(diffEditor);
44
- return () => {
45
- diffEditor?.dispose();
46
- };
47
- }, [editorDiffRef]);
48
-
49
- useEditorLayout(diffEditor, editorDiffRef, editorContainerRef);
50
-
51
- const type = diffCellResultItem.diffType === 'changed' ? 'changed' : 'unchanged';
52
-
53
- return (
54
- <div className='libro-diff-cell-container' ref={editorContainerRef}>
55
- <div className={`libro-diff-cell-${type}-container`}>
56
- <div className={`libro-diff-cell-${type}-origin-header ${diffCellResultItem.diffType}`}>
57
- <span className='libro-diff-cell-header-text'>{getLibroCellType(diffCellResultItem.origin)}</span>
58
- <span
59
- className='libro-diff-cell-header-origin-execute-count'
60
- style={{
61
- display: diffCellResultItem.origin.cell_type !== 'markdown' ? 'block' : 'none',
62
- }}
63
- >
64
- {diffCellResultItem.origin.execution_count
65
- ? '[' + diffCellResultItem.origin.execution_count?.toString() + ']'
66
- : '[ ]'}
67
- </span>
68
- </div>
69
- <div className={`libro-diff-cell-${type}-target-header ${diffCellResultItem.diffType}`}>
70
- <span className='libro-diff-cell-header-text'>{getLibroCellType(diffCellResultItem.target)}</span>
71
- <span
72
- className='libro-diff-cell-header-target-execute-count'
73
- style={{
74
- display: diffCellResultItem.target.cell_type !== 'markdown' ? 'block' : 'none',
75
- }}
76
- >
77
- {diffCellResultItem.target.execution_count
78
- ? '[' + diffCellResultItem.target.execution_count?.toString() + ']'
79
- : '[ ]'}
80
- </span>
81
- </div>
82
- <div className={`libro-diff-cell-${type}-content`} ref={editorDiffRef} />
83
- <div className={`libro-diff-cell-${type}-origin-border`} />
84
- <div className={`libro-diff-cell-${type}-target-border`} />
85
- </div>
86
- </div>
87
- );
88
- });
@@ -1,84 +0,0 @@
1
- import { Container } from '@difizen/mana-app';
2
- import React, { memo, useEffect, useRef, useState } from 'react';
3
-
4
- import { useInjectable } from '@opensumi/ide-core-browser';
5
- import { ICodeEditor } from '@opensumi/ide-monaco';
6
-
7
- import { ManaContainer } from '../../../mana';
8
- import { getLibroCellType } from '../libro-diff-protocol';
9
- import { LibroVersionManager } from '../libro-version-manager';
10
-
11
- import { useEditorLayout } from './hooks';
12
-
13
- import type { DiffEditorProps } from '../libro-diff-protocol';
14
-
15
- import './index.less';
16
-
17
- const getEditorLanguage = (libroCellType: string) => {
18
- if (libroCellType === 'sql') {
19
- return 'sql-odps';
20
- } else if (libroCellType === 'markdown' || libroCellType === 'raw') {
21
- return 'markdown';
22
- } else {
23
- return 'python';
24
- }
25
- };
26
-
27
- export const LibroDiffSideCellComponent: React.FC<DiffEditorProps> = memo(({ diffCellResultItem }) => {
28
- const manaContainer = useInjectable<Container>(ManaContainer);
29
- const libroVersionManager = manaContainer.get(LibroVersionManager);
30
- const editorTargetRef = useRef<HTMLDivElement>(null);
31
- const editorContainerRef = useRef<HTMLDivElement>(null);
32
- const language = diffCellResultItem.origin.metadata.libroCellType
33
- ? getEditorLanguage(diffCellResultItem.origin.metadata.libroCellType.toString())
34
- : getEditorLanguage(diffCellResultItem.origin.cell_type);
35
-
36
- const [editor, setEditor] = useState<ICodeEditor | undefined>();
37
-
38
- const createEditor = () => {
39
- // 这里其实已经拿到content了,但是 opensumi editor 需要uri,理论上有优化空间
40
- const content =
41
- diffCellResultItem.diffType === 'removed' ? diffCellResultItem.origin.source : diffCellResultItem.target.source;
42
- const previewedEditor = libroVersionManager.createPreviewEditor(
43
- content.toString(),
44
- language,
45
- editorTargetRef.current!,
46
- diffCellResultItem.diffType,
47
- );
48
- setEditor(previewedEditor);
49
- return previewedEditor;
50
- };
51
-
52
- useEditorLayout(editor, editorTargetRef, editorContainerRef);
53
-
54
- useEffect(() => {
55
- if (!editorTargetRef.current) {
56
- return;
57
- }
58
- const previewedEditor = createEditor();
59
- return () => {
60
- previewedEditor?.dispose();
61
- };
62
- }, [editorTargetRef.current]);
63
- const type = diffCellResultItem.diffType === 'removed' ? 'origin' : 'target';
64
- return (
65
- <div className='libro-diff-cell-container' ref={editorContainerRef}>
66
- <div className={`libro-diff-cell-${type}-container`}>
67
- <div className={`libro-diff-cell-${type}-header`}>
68
- <span className='libro-diff-cell-header-text'>{getLibroCellType(diffCellResultItem.origin)}</span>
69
- <span
70
- className={`libro-diff-cell-header-${type}-execute-count`}
71
- style={{
72
- display: diffCellResultItem.target.cell_type !== 'markdown' ? 'block' : 'none',
73
- }}
74
- >
75
- {diffCellResultItem.target.execution_count
76
- ? '[' + diffCellResultItem.target.execution_count?.toString() + ']'
77
- : '[ ]'}
78
- </span>
79
- </div>
80
- <div className={`libro-diff-cell-${type}-content`} ref={editorTargetRef} />
81
- </div>
82
- </div>
83
- );
84
- });
@@ -1,47 +0,0 @@
1
- .libro-diff-content-container, .libro-diff-content-loading-container, .libro-diff-content-same-container {
2
- background-color: var(--mana-libro-diff-container-color);
3
- }
4
- .libro-diff-content-container {
5
- height: 100%;
6
- padding: 24px 36px;
7
- }
8
- .libro-diff-content-loading-container {
9
- height: 100%;
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- }
14
- .libro-diff-fold-container {
15
- padding: 8px 0;
16
- }
17
- .libro-diff-fold {
18
- display: flex;
19
- padding: 6px 0;
20
- border-radius: 6px;
21
- justify-content: center;
22
- align-items: center;
23
- height: 32px;
24
- background: var(--mana-libro-diff-fold-background-color);
25
- color: var(--mana-libro-diff-fold-text-color);
26
- &:hover {
27
- cursor: pointer;
28
- background: var(--mana-libro-diff-fold-hover-background-color);
29
- }
30
- .libro-diff-fold-text {
31
- padding-left: 6px;
32
- }
33
- }
34
- .libro-diff-content-same-container {
35
- display: flex;
36
- height: 100%;
37
- flex-direction: column;
38
- justify-content: center;
39
- align-items: center;
40
- }
41
- .libro-diff-content-same-text {
42
- margin-top: 15px;
43
- font-size: 16px;
44
- color: var(--mana-libro-diff-content-same-text-color);
45
- }
46
-
47
-
@@ -1,4 +0,0 @@
1
- export * from './libro-diff-component';
2
- export * from './libro-diff-protocol';
3
- export * from './libro-diff-view';
4
- export * from './module';