@difizen/libro-jupyter 0.0.2-alpha.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.
Files changed (267) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/es/add-between-cell/add-between-cell-command-contribution.d.ts +14 -0
  4. package/es/add-between-cell/add-between-cell-command-contribution.d.ts.map +1 -0
  5. package/es/add-between-cell/add-between-cell-command-contribution.js +97 -0
  6. package/es/add-between-cell/add-between-cell.d.ts +5 -0
  7. package/es/add-between-cell/add-between-cell.d.ts.map +1 -0
  8. package/es/add-between-cell/add-between-cell.js +243 -0
  9. package/es/add-between-cell/index.d.ts +3 -0
  10. package/es/add-between-cell/index.d.ts.map +1 -0
  11. package/es/add-between-cell/index.js +2 -0
  12. package/es/add-between-cell/index.less +103 -0
  13. package/es/add-between-cell/module.d.ts +3 -0
  14. package/es/add-between-cell/module.d.ts.map +1 -0
  15. package/es/add-between-cell/module.js +8 -0
  16. package/es/cell/index.d.ts +3 -0
  17. package/es/cell/index.d.ts.map +1 -0
  18. package/es/cell/index.js +2 -0
  19. package/es/cell/jupyter-code-cell-model.d.ts +12 -0
  20. package/es/cell/jupyter-code-cell-model.d.ts.map +1 -0
  21. package/es/cell/jupyter-code-cell-model.js +56 -0
  22. package/es/cell/jupyter-code-cell-view.d.ts +18 -0
  23. package/es/cell/jupyter-code-cell-view.d.ts.map +1 -0
  24. package/es/cell/jupyter-code-cell-view.js +280 -0
  25. package/es/command/command-contribution.d.ts +10 -0
  26. package/es/command/command-contribution.d.ts.map +1 -0
  27. package/es/command/command-contribution.js +161 -0
  28. package/es/command/index.d.ts +3 -0
  29. package/es/command/index.d.ts.map +1 -0
  30. package/es/command/index.js +2 -0
  31. package/es/command/keybinding-contribution.d.ts +8 -0
  32. package/es/command/keybinding-contribution.d.ts.map +1 -0
  33. package/es/command/keybinding-contribution.js +37 -0
  34. package/es/components/cell-execution-tip.d.ts +6 -0
  35. package/es/components/cell-execution-tip.d.ts.map +1 -0
  36. package/es/components/cell-execution-tip.js +69 -0
  37. package/es/components/cell-input-bottom-blank.d.ts +5 -0
  38. package/es/components/cell-input-bottom-blank.d.ts.map +1 -0
  39. package/es/components/cell-input-bottom-blank.js +21 -0
  40. package/es/components/icons.d.ts +5 -0
  41. package/es/components/icons.d.ts.map +1 -0
  42. package/es/components/icons.js +154 -0
  43. package/es/components/index.d.ts +4 -0
  44. package/es/components/index.d.ts.map +1 -0
  45. package/es/components/index.js +3 -0
  46. package/es/components/index.less +82 -0
  47. package/es/config/config-contribution.d.ts +10 -0
  48. package/es/config/config-contribution.d.ts.map +1 -0
  49. package/es/config/config-contribution.js +50 -0
  50. package/es/config/config.d.ts +3 -0
  51. package/es/config/config.d.ts.map +1 -0
  52. package/es/config/config.js +11 -0
  53. package/es/config/index.d.ts +2 -0
  54. package/es/config/index.d.ts.map +1 -0
  55. package/es/config/index.js +1 -0
  56. package/es/configuration/index.d.ts +3 -0
  57. package/es/configuration/index.d.ts.map +1 -0
  58. package/es/configuration/index.js +2 -0
  59. package/es/configuration/libro-configuration-contribution.d.ts +5 -0
  60. package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
  61. package/es/configuration/libro-configuration-contribution.js +24 -0
  62. package/es/configuration/libro-configuration.d.ts +3 -0
  63. package/es/configuration/libro-configuration.d.ts.map +1 -0
  64. package/es/configuration/libro-configuration.js +12 -0
  65. package/es/contents/content-contribution.d.ts +7 -0
  66. package/es/contents/content-contribution.d.ts.map +1 -0
  67. package/es/contents/content-contribution.js +63 -0
  68. package/es/contents/index.d.ts +2 -0
  69. package/es/contents/index.d.ts.map +1 -0
  70. package/es/contents/index.js +1 -0
  71. package/es/file/file-name-alias.d.ts +7 -0
  72. package/es/file/file-name-alias.d.ts.map +1 -0
  73. package/es/file/file-name-alias.js +26 -0
  74. package/es/file/file-protocol.d.ts +8 -0
  75. package/es/file/file-protocol.d.ts.map +1 -0
  76. package/es/file/file-protocol.js +7 -0
  77. package/es/file/file-service.d.ts +31 -0
  78. package/es/file/file-service.d.ts.map +1 -0
  79. package/es/file/file-service.js +329 -0
  80. package/es/file/file-tree-label-provider.d.ts +13 -0
  81. package/es/file/file-tree-label-provider.d.ts.map +1 -0
  82. package/es/file/file-tree-label-provider.js +62 -0
  83. package/es/file/file-view/index.d.ts +14 -0
  84. package/es/file/file-view/index.d.ts.map +1 -0
  85. package/es/file/file-view/index.js +101 -0
  86. package/es/file/file-view/index.less +5 -0
  87. package/es/file/index.d.ts +7 -0
  88. package/es/file/index.d.ts.map +1 -0
  89. package/es/file/index.js +6 -0
  90. package/es/file/module.d.ts +3 -0
  91. package/es/file/module.d.ts.map +1 -0
  92. package/es/file/module.js +8 -0
  93. package/es/file/navigatable-view.d.ts +24 -0
  94. package/es/file/navigatable-view.d.ts.map +1 -0
  95. package/es/file/navigatable-view.js +151 -0
  96. package/es/file/open-handler-contribution.d.ts +11 -0
  97. package/es/file/open-handler-contribution.d.ts.map +1 -0
  98. package/es/file/open-handler-contribution.js +102 -0
  99. package/es/index.d.ts +32 -0
  100. package/es/index.d.ts.map +1 -0
  101. package/es/index.js +31 -0
  102. package/es/keybind-instructions/index.d.ts +6 -0
  103. package/es/keybind-instructions/index.d.ts.map +1 -0
  104. package/es/keybind-instructions/index.js +5 -0
  105. package/es/keybind-instructions/index.less +177 -0
  106. package/es/keybind-instructions/keybind-instructions-contribution.d.ts +11 -0
  107. package/es/keybind-instructions/keybind-instructions-contribution.d.ts.map +1 -0
  108. package/es/keybind-instructions/keybind-instructions-contribution.js +84 -0
  109. package/es/keybind-instructions/keybind-instructions-icon.d.ts +3 -0
  110. package/es/keybind-instructions/keybind-instructions-icon.d.ts.map +1 -0
  111. package/es/keybind-instructions/keybind-instructions-icon.js +23 -0
  112. package/es/keybind-instructions/keybind-instructions-items.d.ts +14 -0
  113. package/es/keybind-instructions/keybind-instructions-items.d.ts.map +1 -0
  114. package/es/keybind-instructions/keybind-instructions-items.js +589 -0
  115. package/es/keybind-instructions/keybind-instructions-view.d.ts +16 -0
  116. package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -0
  117. package/es/keybind-instructions/keybind-instructions-view.js +224 -0
  118. package/es/keybind-instructions/module.d.ts +3 -0
  119. package/es/keybind-instructions/module.d.ts.map +1 -0
  120. package/es/keybind-instructions/module.js +5 -0
  121. package/es/libro-jupyter-file-service.d.ts +106 -0
  122. package/es/libro-jupyter-file-service.d.ts.map +1 -0
  123. package/es/libro-jupyter-file-service.js +127 -0
  124. package/es/libro-jupyter-model.d.ts +49 -0
  125. package/es/libro-jupyter-model.d.ts.map +1 -0
  126. package/es/libro-jupyter-model.js +505 -0
  127. package/es/libro-jupyter-protocol.d.ts +38 -0
  128. package/es/libro-jupyter-protocol.d.ts.map +1 -0
  129. package/es/libro-jupyter-protocol.js +9 -0
  130. package/es/libro-jupyter-server-launch-manager.d.ts +11 -0
  131. package/es/libro-jupyter-server-launch-manager.d.ts.map +1 -0
  132. package/es/libro-jupyter-server-launch-manager.js +59 -0
  133. package/es/libro-jupyter-view.d.ts +10 -0
  134. package/es/libro-jupyter-view.d.ts.map +1 -0
  135. package/es/libro-jupyter-view.js +42 -0
  136. package/es/module.d.ts +3 -0
  137. package/es/module.d.ts.map +1 -0
  138. package/es/module.js +48 -0
  139. package/es/output/index.d.ts +2 -0
  140. package/es/output/index.d.ts.map +1 -0
  141. package/es/output/index.js +1 -0
  142. package/es/output/libro-jupyter-outputarea.d.ts +8 -0
  143. package/es/output/libro-jupyter-outputarea.d.ts.map +1 -0
  144. package/es/output/libro-jupyter-outputarea.js +77 -0
  145. package/es/rendermime/assets/plotly.svg +31 -0
  146. package/es/rendermime/index.d.ts +5 -0
  147. package/es/rendermime/index.d.ts.map +1 -0
  148. package/es/rendermime/index.js +4 -0
  149. package/es/rendermime/index.less +22 -0
  150. package/es/rendermime/module.d.ts +3 -0
  151. package/es/rendermime/module.d.ts.map +1 -0
  152. package/es/rendermime/module.js +3 -0
  153. package/es/rendermime/plotly-render.d.ts +7 -0
  154. package/es/rendermime/plotly-render.d.ts.map +1 -0
  155. package/es/rendermime/plotly-render.js +30 -0
  156. package/es/rendermime/plotly-renderers.d.ts +58 -0
  157. package/es/rendermime/plotly-renderers.d.ts.map +1 -0
  158. package/es/rendermime/plotly-renderers.js +211 -0
  159. package/es/rendermime/plotly-rendermime-contribution.d.ts +12 -0
  160. package/es/rendermime/plotly-rendermime-contribution.d.ts.map +1 -0
  161. package/es/rendermime/plotly-rendermime-contribution.js +22 -0
  162. package/es/theme/color-registry.d.ts +6 -0
  163. package/es/theme/color-registry.d.ts.map +1 -0
  164. package/es/theme/color-registry.js +393 -0
  165. package/es/theme/index.d.ts +2 -0
  166. package/es/theme/index.d.ts.map +1 -0
  167. package/es/theme/index.js +1 -0
  168. package/es/toolbar/index.d.ts +6 -0
  169. package/es/toolbar/index.d.ts.map +1 -0
  170. package/es/toolbar/index.js +5 -0
  171. package/es/toolbar/index.less +194 -0
  172. package/es/toolbar/kernel-selector-dropdown.d.ts +13 -0
  173. package/es/toolbar/kernel-selector-dropdown.d.ts.map +1 -0
  174. package/es/toolbar/kernel-selector-dropdown.js +165 -0
  175. package/es/toolbar/kernel-status-and-selector.d.ts +18 -0
  176. package/es/toolbar/kernel-status-and-selector.d.ts.map +1 -0
  177. package/es/toolbar/kernel-status-and-selector.js +164 -0
  178. package/es/toolbar/run-selector.d.ts +3 -0
  179. package/es/toolbar/run-selector.d.ts.map +1 -0
  180. package/es/toolbar/run-selector.js +98 -0
  181. package/es/toolbar/save-file-error-contribution.d.ts +5 -0
  182. package/es/toolbar/save-file-error-contribution.d.ts.map +1 -0
  183. package/es/toolbar/save-file-error-contribution.js +23 -0
  184. package/es/toolbar/save-file-error.d.ts +5 -0
  185. package/es/toolbar/save-file-error.d.ts.map +1 -0
  186. package/es/toolbar/save-file-error.js +27 -0
  187. package/es/toolbar/side-toolbar-run-selector.d.ts +3 -0
  188. package/es/toolbar/side-toolbar-run-selector.d.ts.map +1 -0
  189. package/es/toolbar/side-toolbar-run-selector.js +67 -0
  190. package/es/toolbar/toolbar-contribution.d.ts +9 -0
  191. package/es/toolbar/toolbar-contribution.d.ts.map +1 -0
  192. package/es/toolbar/toolbar-contribution.js +67 -0
  193. package/es/typings/index.d.ts +31 -0
  194. package/es/utils/index.d.ts +11 -0
  195. package/es/utils/index.d.ts.map +1 -0
  196. package/es/utils/index.js +47 -0
  197. package/package.json +75 -0
  198. package/src/add-between-cell/add-between-cell-command-contribution.ts +63 -0
  199. package/src/add-between-cell/add-between-cell.tsx +201 -0
  200. package/src/add-between-cell/index.less +103 -0
  201. package/src/add-between-cell/index.ts +2 -0
  202. package/src/add-between-cell/module.ts +13 -0
  203. package/src/cell/index.ts +2 -0
  204. package/src/cell/jupyter-code-cell-model.ts +36 -0
  205. package/src/cell/jupyter-code-cell-view.tsx +221 -0
  206. package/src/command/command-contribution.ts +163 -0
  207. package/src/command/index.ts +2 -0
  208. package/src/command/keybinding-contribution.ts +25 -0
  209. package/src/components/cell-execution-tip.tsx +107 -0
  210. package/src/components/cell-input-bottom-blank.tsx +24 -0
  211. package/src/components/icons.tsx +117 -0
  212. package/src/components/index.less +82 -0
  213. package/src/components/index.ts +3 -0
  214. package/src/config/config-contribution.ts +21 -0
  215. package/src/config/config.ts +14 -0
  216. package/src/config/index.ts +1 -0
  217. package/src/configuration/index.ts +2 -0
  218. package/src/configuration/libro-configuration-contribution.ts +11 -0
  219. package/src/configuration/libro-configuration.ts +14 -0
  220. package/src/contents/content-contribution.ts +32 -0
  221. package/src/contents/index.ts +1 -0
  222. package/src/file/file-name-alias.ts +15 -0
  223. package/src/file/file-protocol.ts +7 -0
  224. package/src/file/file-service.ts +179 -0
  225. package/src/file/file-tree-label-provider.ts +42 -0
  226. package/src/file/file-view/index.less +5 -0
  227. package/src/file/file-view/index.tsx +90 -0
  228. package/src/file/index.ts +6 -0
  229. package/src/file/module.ts +19 -0
  230. package/src/file/navigatable-view.tsx +93 -0
  231. package/src/file/open-handler-contribution.ts +44 -0
  232. package/src/index.ts +32 -0
  233. package/src/keybind-instructions/index.less +177 -0
  234. package/src/keybind-instructions/index.ts +5 -0
  235. package/src/keybind-instructions/keybind-instructions-contribution.ts +47 -0
  236. package/src/keybind-instructions/keybind-instructions-icon.tsx +28 -0
  237. package/src/keybind-instructions/keybind-instructions-items.tsx +597 -0
  238. package/src/keybind-instructions/keybind-instructions-view.tsx +239 -0
  239. package/src/keybind-instructions/module.ts +11 -0
  240. package/src/libro-jupyter-file-service.ts +158 -0
  241. package/src/libro-jupyter-model.ts +289 -0
  242. package/src/libro-jupyter-protocol.ts +59 -0
  243. package/src/libro-jupyter-server-launch-manager.ts +36 -0
  244. package/src/libro-jupyter-view.tsx +24 -0
  245. package/src/module.ts +105 -0
  246. package/src/output/index.ts +1 -0
  247. package/src/output/libro-jupyter-outputarea.tsx +71 -0
  248. package/src/rendermime/assets/plotly.svg +31 -0
  249. package/src/rendermime/index.less +13 -0
  250. package/src/rendermime/index.ts +4 -0
  251. package/src/rendermime/module.ts +7 -0
  252. package/src/rendermime/plotly-render.tsx +35 -0
  253. package/src/rendermime/plotly-renderers.ts +191 -0
  254. package/src/rendermime/plotly-rendermime-contribution.ts +15 -0
  255. package/src/theme/color-registry.ts +301 -0
  256. package/src/theme/index.ts +1 -0
  257. package/src/toolbar/index.less +194 -0
  258. package/src/toolbar/index.ts +5 -0
  259. package/src/toolbar/kernel-selector-dropdown.tsx +204 -0
  260. package/src/toolbar/kernel-status-and-selector.tsx +195 -0
  261. package/src/toolbar/run-selector.tsx +110 -0
  262. package/src/toolbar/save-file-error-contribution.ts +10 -0
  263. package/src/toolbar/save-file-error.tsx +35 -0
  264. package/src/toolbar/side-toolbar-run-selector.tsx +77 -0
  265. package/src/toolbar/toolbar-contribution.tsx +62 -0
  266. package/src/typings/index.d.ts +31 -0
  267. package/src/utils/index.ts +65 -0
@@ -0,0 +1,301 @@
1
+ import type { ColorRegistry } from '@difizen/mana-app';
2
+ import { Color, ColorContribution } from '@difizen/mana-app';
3
+ import { singleton } from '@difizen/mana-app';
4
+
5
+ @singleton({ contrib: ColorContribution })
6
+ export class LibroJupyterColorContribution implements ColorContribution {
7
+ registerColors(colors: ColorRegistry): void {
8
+ // common
9
+ colors.register(
10
+ // #region antd variable
11
+ {
12
+ id: 'libro.add.between.divider.color',
13
+ defaults: { dark: '#467DB0', light: '#BFE0FF' },
14
+ description: '',
15
+ },
16
+ {
17
+ id: 'libro.add.between.icon.color',
18
+ defaults: { dark: '#467DB0', light: '#6982A9' },
19
+ description: '',
20
+ },
21
+ {
22
+ id: 'libro.add.between.icon.hover.color',
23
+ defaults: { dark: '#588DBE', light: '#1890ff' },
24
+ description: '',
25
+ },
26
+ {
27
+ id: 'libro.add.between.popover.background.color',
28
+ defaults: { dark: '#2f3032', light: '#ffffff' },
29
+ description: '',
30
+ },
31
+ {
32
+ id: 'libro.add.between.menu.label.color',
33
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 0, 0, 0.65) },
34
+ description: '',
35
+ },
36
+ {
37
+ id: 'libro.add.between.hover.color',
38
+ defaults: { dark: '#515359', light: '#EBF6FF' },
39
+ description: '',
40
+ },
41
+ {
42
+ id: 'libro.drawer.close.color',
43
+ defaults: {
44
+ dark: Color.rgba(255, 255, 255, 0.45),
45
+ light: Color.rgba(0, 0, 0, 0.45),
46
+ },
47
+ description: '',
48
+ },
49
+ {
50
+ id: 'libro.drawer.title.color',
51
+ defaults: { dark: '#EDEEEF', light: Color.rgba(0, 0, 0, 0.85) },
52
+ description: '',
53
+ },
54
+ {
55
+ id: 'libro.table.title.color',
56
+ defaults: { dark: '#E3E4E6', light: Color.rgba(0, 10, 26, 0.89) },
57
+ description: '',
58
+ },
59
+ {
60
+ id: 'libro.filtered.background.color',
61
+ defaults: {
62
+ dark: Color.rgba(255, 255, 255, 0.1),
63
+ light: Color.rgba(0, 10, 26, 0.04),
64
+ },
65
+ description: '',
66
+ },
67
+ {
68
+ id: 'libro.filtered.text.color',
69
+ defaults: { dark: '#878C93', light: Color.rgba(0, 10, 26, 0.26) },
70
+ description: '',
71
+ },
72
+ {
73
+ id: 'libro.filtered.border.color',
74
+ defaults: { dark: '#2F3032', light: '#f0f0f0' },
75
+ description: '',
76
+ },
77
+ {
78
+ id: 'libro.table.border.color',
79
+ defaults: { dark: Color.rgba(255, 255, 255, 0.04), light: '#f0f0f0' },
80
+ description: '',
81
+ },
82
+ {
83
+ id: 'libro.btn.hover.color',
84
+ defaults: { dark: '#515359', light: '#fff' },
85
+ description: '',
86
+ },
87
+ {
88
+ id: 'libro.keybind.tag.background.color',
89
+ defaults: { dark: Color.rgba(245, 245, 245, 0.2), light: '#f5f5f5' },
90
+ description: '',
91
+ },
92
+ {
93
+ id: 'libro.keybind.tag.text.color',
94
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 0, 0, 0.65) },
95
+ description: '',
96
+ },
97
+ {
98
+ id: 'libro.search.match.background.color',
99
+ defaults: { dark: '#BCCEFF', light: '#B9D1FF' },
100
+ description: '',
101
+ },
102
+ {
103
+ id: 'libro.vis.button.border',
104
+ defaults: { dark: '#505559', light: Color.rgba(0, 10, 26, 0.1) },
105
+ description: '',
106
+ },
107
+ {
108
+ id: 'libro.vis.button.background',
109
+ defaults: { dark: '#2F3032', light: '#FFFFFF' },
110
+ description: '',
111
+ },
112
+ {
113
+ id: 'libro.vis.button.text.color',
114
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.68) },
115
+ description: '',
116
+ },
117
+ {
118
+ id: 'libro.llm.response.output.text.color',
119
+ defaults: { dark: '#878C93', light: Color.rgba(0, 10, 26, 0.68) },
120
+ description: '',
121
+ },
122
+ );
123
+
124
+ //
125
+ colors.register(
126
+ {
127
+ id: 'libro.kernel.text',
128
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.89) },
129
+ description: '',
130
+ },
131
+ {
132
+ id: 'libro.kernel.select.text',
133
+ defaults: { dark: '#E3E4E6', light: Color.rgba(0, 10, 26, 0.68) },
134
+ description: '',
135
+ },
136
+ {
137
+ id: 'libro.kernel.status.text',
138
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.47) },
139
+ description: '',
140
+ },
141
+ {
142
+ id: 'libro.kernel.badge.border.color',
143
+ defaults: { dark: '#E3E4E6', light: '#ffffff' },
144
+ description: '',
145
+ },
146
+ {
147
+ id: 'libro.jupyter.kernel.status.background.color',
148
+ defaults: { dark: '#2F3032', light: '#ffffff' },
149
+ description: '',
150
+ },
151
+ {
152
+ id: 'libro.jupyter.kernel.status.active.step.title.color',
153
+ defaults: { dark: '#E3E4E6', light: Color.rgba(0, 0, 0, 0.85) },
154
+ description: '',
155
+ },
156
+ {
157
+ id: 'libro.jupyter.kernel.status.title.color',
158
+ defaults: { dark: '#878C93', light: Color.rgba(0, 0, 0, 0.45) },
159
+ description: '',
160
+ },
161
+ {
162
+ id: 'libro.jupyter.kernel.status.menu.color',
163
+ defaults: { dark: '#e3e4e6', light: Color.rgba(0, 0, 0, 0.65) },
164
+ description: '',
165
+ },
166
+ {
167
+ id: 'libro.jupyter.kernel.status.step.description.color',
168
+ defaults: { dark: '#D6D8DA', light: Color.rgba(0, 10, 26, 0.68) },
169
+ description: '',
170
+ },
171
+ {
172
+ id: 'libro.jupyter.kernel.status.step.active.background.color',
173
+ defaults: { dark: '#2A97FD', light: '#1890FF' },
174
+ description: '',
175
+ },
176
+ {
177
+ id: 'libro.jupyter.kernel.status.step.active.secondary.color',
178
+ defaults: { dark: '#FFFFFF', light: '#ffffff' },
179
+ description: '',
180
+ },
181
+ {
182
+ id: 'libro.diff.cell.header.execution.color',
183
+ defaults: { dark: '#6A83AA', light: '#6A83AA' },
184
+ description: '',
185
+ },
186
+ {
187
+ id: 'libro.diff.unchanged.cell.header.color',
188
+ defaults: { dark: Color.rgba(255, 255, 255, 0.06), light: '#EAECF2' },
189
+ description: '',
190
+ },
191
+ {
192
+ id: 'libro.diff.container.color',
193
+ defaults: { dark: '#1f2022', light: '#ffffff' },
194
+ description: '',
195
+ },
196
+ {
197
+ id: 'libro.diff.input.background.color',
198
+ defaults: { dark: '#19191B', light: '#F4F6FB' },
199
+ description: '',
200
+ },
201
+ {
202
+ id: 'libro.diff.editor.background.color',
203
+ defaults: { dark: '#1F2022', light: '#ffffff' },
204
+ description: '',
205
+ },
206
+ {
207
+ id: 'libro.diff.cell.border.color',
208
+ defaults: { dark: '#3B3C42', light: '#D7DBE7' },
209
+ description: '',
210
+ },
211
+ {
212
+ id: 'libro.diff.editor.removed.color',
213
+ defaults: { dark: '#4F2726', light: '#FAF0F0' },
214
+ description: '',
215
+ },
216
+ {
217
+ id: 'libro.diff.editor.added.color',
218
+ defaults: { dark: '#334126', light: '#ECF4E3' },
219
+ description: '',
220
+ },
221
+ {
222
+ id: 'libro.diff.editor.line.insert.color',
223
+ defaults: {
224
+ dark: Color.rgba(83, 104, 48, 0.45),
225
+ light: Color.rgba(189, 214, 151, 0.25),
226
+ },
227
+ description: '',
228
+ },
229
+ {
230
+ id: 'libro.diff.editor.line.delete.color',
231
+ defaults: {
232
+ dark: Color.rgba(126, 50, 45, 0.45),
233
+ light: Color.rgba(241, 212, 216, 0.35),
234
+ },
235
+ description: '',
236
+ },
237
+ {
238
+ id: 'libro.diff.editor.char.insert.color',
239
+ defaults: {
240
+ dark: Color.rgba(16, 22, 3, 0.7),
241
+ light: Color.rgba(67, 151, 36, 0.25),
242
+ },
243
+ description: '',
244
+ },
245
+ {
246
+ id: 'libro.diff.editor.char.delete.color',
247
+ defaults: {
248
+ dark: Color.rgba(53, 15, 14, 0.7),
249
+ light: Color.rgba(255, 0, 0, 0.2),
250
+ },
251
+ description: '',
252
+ },
253
+ {
254
+ id: 'libro.diff.fold.background.color',
255
+ defaults: {
256
+ dark: Color.rgba(255, 255, 255, 0.08),
257
+ light: Color.rgba(0, 10, 26, 0.02),
258
+ },
259
+ description: '',
260
+ },
261
+ {
262
+ id: 'libro.diff.fold.hover.background.color',
263
+ defaults: {
264
+ dark: Color.rgba(255, 255, 255, 0.1),
265
+ light: Color.rgba(0, 10, 26, 0.04),
266
+ },
267
+ description: '',
268
+ },
269
+ {
270
+ id: 'libro.diff.fold.text.color',
271
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.47) },
272
+ description: '',
273
+ },
274
+ {
275
+ id: 'libro.diff.content.same.text.color',
276
+ defaults: { dark: '#E3E4E6', light: Color.rgba(0, 10, 26, 0.68) },
277
+ description: '',
278
+ },
279
+ {
280
+ id: 'libro.diff.select.background.color',
281
+ defaults: { dark: '#BCCEFF', light: '#e5ebf1' },
282
+ description: '',
283
+ },
284
+ {
285
+ id: 'libro.diff.select.highlight.background.color',
286
+ defaults: { dark: '#C8D1E7', light: '#DDE6FF' },
287
+ description: '',
288
+ },
289
+ {
290
+ id: 'libro.diff.editor.gutter.number.color',
291
+ defaults: { dark: '#a8aebf', light: '#A4AECB' },
292
+ description: '',
293
+ },
294
+ {
295
+ id: 'libro.copilot.editor.placeholder.color',
296
+ defaults: { dark: '#878C93', light: Color.rgba(0, 10, 26, 0.26) },
297
+ description: '',
298
+ },
299
+ );
300
+ }
301
+ }
@@ -0,0 +1 @@
1
+ export * from './color-registry.js';
@@ -0,0 +1,194 @@
1
+ /* stylelint-disable declaration-property-value-disallowed-list */
2
+ /* stylelint-disable color-function-notation */
3
+ // The prefix to use on all css classes from ant.
4
+ @ant-prefix: ant;
5
+
6
+ .kernel-status {
7
+ width: 140px;
8
+
9
+ .ant-badge-status-dot {
10
+ width: 10px;
11
+ height: 10px;
12
+ }
13
+ }
14
+
15
+ .container-and-service-status-step {
16
+ > div:first-child {
17
+ height: 70px;
18
+ }
19
+
20
+ .libro-kernel-badge :first-child {
21
+ width: 9px;
22
+ height: 9px;
23
+ border: 1px solid var(--mana-libro-kernel-badge-border-color);
24
+ }
25
+ }
26
+
27
+ .libro-tooltip-placement-bottom,
28
+ .libro-tooltip-placement-right {
29
+ opacity: 0.9;
30
+
31
+ > div {
32
+ > div:nth-child(2) {
33
+ padding: 8px 10px;
34
+ color: #fff;
35
+ text-align: left;
36
+ text-decoration: none;
37
+ background-color: #373737;
38
+ border-radius: 6px;
39
+ box-shadow: 0 0 4px rgb(0 0 0 / 17%);
40
+ min-height: 34px;
41
+ }
42
+ }
43
+ }
44
+
45
+ .libro-kernel-and-container-status {
46
+ font-family: PingFangSC, 'Helvetica Neue', helvetica, arial, sans-serif;
47
+
48
+ .libro-kernel-status-and-selector {
49
+ .kernel {
50
+ color: var(--mana-libro-kernel-text);
51
+ }
52
+
53
+ .@{ant-prefix}-space-item {
54
+ color: var(--mana-libro-kernel-select-text);
55
+
56
+ > span {
57
+ transform: translate(-5px, 2px);
58
+ color: var(--mana-libro-dropdown-icon-color);
59
+ }
60
+ }
61
+
62
+ .libro-kernel-badge {
63
+ :first-child {
64
+ width: 9px;
65
+ height: 9px;
66
+ border: 1px solid var(--mana-libro-kernel-badge-border-color);
67
+ }
68
+
69
+ padding-left: 8px;
70
+
71
+ :nth-child(2) {
72
+ color: var(--mana-libro-kernel-status-text);
73
+ opacity: var(--mana-libro-kernel-text-opacity);
74
+ }
75
+ }
76
+ }
77
+
78
+ .libro-container-and-service-status {
79
+ .loading-icon {
80
+ color: rgba(24, 144, 255, 100%);
81
+ }
82
+
83
+ .failed-icon {
84
+ color: rgba(255, 77, 79, 100%);
85
+ }
86
+
87
+ .kernel-prepare-failed {
88
+ padding: 0 16px 0 10px;
89
+ }
90
+
91
+ .container-log-view-slot {
92
+ display: inline;
93
+
94
+ > div:first-child {
95
+ display: inline;
96
+ }
97
+ }
98
+
99
+ .no-kernel {
100
+ padding: 0 16px 0 10px;
101
+ color: var(--mana-libro-kernel-text);
102
+ }
103
+
104
+ .status-category {
105
+ padding-right: 8px;
106
+ }
107
+ }
108
+ }
109
+
110
+ .libro-popover-kernel-status {
111
+ .@{ant-prefix}-popover-inner {
112
+ background-color: var(--mana-libro-jupyter-kernel-status-background-color);
113
+ }
114
+ .@{ant-prefix}-popover-arrow-content::before {
115
+ background: var(--mana-libro-jupyter-kernel-status-background-color);
116
+ }
117
+ .@{ant-prefix}-steps-item-title {
118
+ color: var(--mana-libro-jupyter-kernel-status-title-color) !important;
119
+ }
120
+ .@{ant-prefix}-steps-item-icon {
121
+ background-color: transparent !important;
122
+ }
123
+ .@{ant-prefix}-steps-item-description {
124
+ .@{ant-prefix}-badge-status-text {
125
+ color: var(--mana-libro-jupyter-kernel-status-step-description-color) !important;
126
+ }
127
+ }
128
+
129
+ .@{ant-prefix}-steps-item-active {
130
+ .@{ant-prefix}-steps-item-title {
131
+ color: var(--mana-libro-jupyter-kernel-status-active-step-title-color) !important;
132
+ }
133
+ .@{ant-prefix}-steps-item-icon {
134
+ background-color: var(
135
+ --mana-libro-jupyter-kernel-status-step-active-background-color
136
+ ) !important;
137
+
138
+ span {
139
+ color: white !important;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ .libro-run-menu-container {
146
+ width: 220px;
147
+ background-color: var(--mana-libro-popover-background-color) !important;
148
+ .@{ant-prefix}-dropdown-menu-item:hover {
149
+ background-color: var(--mana-libro-menu-hover-color) !important;
150
+ }
151
+
152
+ > li {
153
+ > span {
154
+ display: flex;
155
+ justify-content: space-between;
156
+ align-items: center;
157
+
158
+ .libro-run-menu-label {
159
+ font-family: PingFangSC;
160
+ font-weight: 400;
161
+ font-size: 14px;
162
+ color: var(--mana-libro-toolbar-menu-label-color);
163
+ }
164
+
165
+ .libro-run-menu-keybind {
166
+ margin-left: auto;
167
+ font-family: PingFangSC;
168
+ font-weight: 400;
169
+ font-size: 12px;
170
+ color: var(--mana-libro-toolbar-menu-keybind-color);
171
+ text-align: right;
172
+ line-height: 18px;
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ .libro-kernel-dropdown {
179
+ .@{ant-prefix}-dropdown-menu {
180
+ background-color: var(--mana-libro-popover-background-color);
181
+ }
182
+
183
+ .@{ant-prefix}-dropdown-menu-item-group-title {
184
+ color: var(--mana-libro-jupyter-kernel-status-title-color) !important;
185
+ }
186
+
187
+ .@{ant-prefix}-dropdown-menu-title-content {
188
+ color: var(--mana-libro-jupyter-kernel-status-menu-color);
189
+ }
190
+
191
+ .@{ant-prefix}-dropdown-menu-item:hover {
192
+ background-color: var(--mana-libro-menu-hover-color);
193
+ }
194
+ }
@@ -0,0 +1,5 @@
1
+ export * from './toolbar-contribution.js';
2
+ export * from './save-file-error-contribution.js';
3
+ export * from './kernel-selector-dropdown.js';
4
+ export * from './kernel-status-and-selector.js';
5
+ export * from './save-file-error.js';
@@ -0,0 +1,204 @@
1
+ import { CaretDownOutlined } from '@ant-design/icons';
2
+ import type { LibroView } from '@difizen/libro-core';
3
+ import { LibroKernelConnectionManager, KernelSpecManager } from '@difizen/libro-kernel';
4
+ import { useInject, ViewInstance } from '@difizen/mana-app';
5
+ import { Dropdown, Space } from 'antd';
6
+ import { useCallback } from 'react';
7
+
8
+ import { LibroJupyterModel } from '../libro-jupyter-model.js';
9
+ import './index.less';
10
+
11
+ export interface PreferredSessionKernelListElem {
12
+ name: string;
13
+ id: string;
14
+ fileName: string;
15
+ }
16
+
17
+ export interface OtherKernelListElem {
18
+ name: string;
19
+ display_name: string;
20
+ }
21
+
22
+ function getKernelList(
23
+ kernelConnectionManager: LibroKernelConnectionManager,
24
+ kernelSpecManager: KernelSpecManager,
25
+ ): [PreferredSessionKernelListElem[], OtherKernelListElem[]] {
26
+ const preferredSessionKernelList = [];
27
+ for (const [fileName, kc] of kernelConnectionManager.getAllKernelConnections()) {
28
+ preferredSessionKernelList.push({
29
+ fileName: fileName,
30
+ name: kc.name,
31
+ id: kc.id,
32
+ });
33
+ }
34
+
35
+ const otherKernelList = [];
36
+ if (
37
+ kernelSpecManager.specs &&
38
+ kernelSpecManager.specs.kernelspecs &&
39
+ !(Object.keys(kernelSpecManager.specs.kernelspecs).length === 0)
40
+ ) {
41
+ const kernelspecs = kernelSpecManager.specs.kernelspecs;
42
+
43
+ for (const key in kernelspecs) {
44
+ otherKernelList.push({
45
+ name: kernelspecs[key]?.name ?? '',
46
+ display_name: kernelspecs[key]?.display_name ?? '',
47
+ });
48
+ }
49
+ }
50
+
51
+ return [preferredSessionKernelList, otherKernelList];
52
+ }
53
+
54
+ function getKernelListItems(
55
+ preferredSessionKernelList: PreferredSessionKernelListElem[],
56
+ otherKernelList: OtherKernelListElem[],
57
+ ) {
58
+ return [
59
+ {
60
+ key: 'StartPreferredKernel',
61
+ type: 'group',
62
+ label: 'Start Preferred Kernel',
63
+ children: otherKernelList.map((item) => {
64
+ return {
65
+ key: item.name,
66
+ label: item.display_name,
67
+ };
68
+ }),
69
+ },
70
+ {
71
+ key: 'UseNoKernel',
72
+ type: 'group',
73
+ label: 'Use No Kernel',
74
+ children: [
75
+ {
76
+ key: 'No Kernel',
77
+ label: 'No Kernel',
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ key: 'UseKernelFromPreferredSession',
83
+ type: 'group',
84
+ label: 'Use Kernel from Preferred Session',
85
+ children: preferredSessionKernelList.map((item) => {
86
+ return {
87
+ key: item.fileName,
88
+ label: item.fileName,
89
+ };
90
+ }),
91
+ },
92
+ {
93
+ key: 'divider1',
94
+ type: 'divider', // Must have
95
+ },
96
+ {
97
+ key: 'ShutDownKernel',
98
+ label: 'Shut Down the Kernel',
99
+ },
100
+ ];
101
+ }
102
+
103
+ export const KernelSelector: React.FC = () => {
104
+ const libroView = useInject<LibroView>(ViewInstance);
105
+
106
+ const libroModel = libroView ? libroView.model : undefined;
107
+
108
+ const kernelConnectionManager = useInject(LibroKernelConnectionManager);
109
+ const kernelSpecManager = useInject(KernelSpecManager);
110
+
111
+ const [preferredSessionKernelList, otherKernelList] = getKernelList(
112
+ kernelConnectionManager,
113
+ kernelSpecManager,
114
+ );
115
+
116
+ // 处理change kernel
117
+ const handleChange = useCallback(
118
+ (key: string) => {
119
+ const selectValue = key;
120
+ if (!libroView || !(libroView.model instanceof LibroJupyterModel)) {
121
+ return null;
122
+ }
123
+
124
+ libroView.model.kernelConnecting = true;
125
+
126
+ if (selectValue === 'No Kernel' || selectValue === 'ShutDownKernel') {
127
+ libroView.model.kernelConnecting = false;
128
+ if (libroView.model.shutdown) {
129
+ libroView.model.shutdown();
130
+ }
131
+ }
132
+
133
+ const kernelInfoFromOtherKernelList = otherKernelList.filter(
134
+ (k) => k.name === selectValue,
135
+ );
136
+
137
+ if (kernelInfoFromOtherKernelList.length !== 0) {
138
+ libroView.model.currentFileContents.content.metadata.kernelspec =
139
+ kernelInfoFromOtherKernelList[0];
140
+
141
+ kernelConnectionManager
142
+ .changeKernel(libroView.model.currentFileContents, {
143
+ name: kernelInfoFromOtherKernelList[0].name,
144
+ })
145
+ .then((kernelConnection) => {
146
+ if (!kernelConnection) {
147
+ return;
148
+ }
149
+ (libroView.model as LibroJupyterModel).kernelConnection = kernelConnection;
150
+ (libroView.model as LibroJupyterModel).kernelConnecting = false;
151
+ return;
152
+ })
153
+ .catch(() => {
154
+ //
155
+ });
156
+
157
+ return;
158
+ }
159
+
160
+ const kernelInfoFromPreferredSessionKernelList =
161
+ preferredSessionKernelList.filter((k) => k.fileName === selectValue);
162
+ if (kernelInfoFromPreferredSessionKernelList.length !== 0) {
163
+ kernelConnectionManager
164
+ .changeKernel(libroView.model.currentFileContents, {
165
+ id: kernelInfoFromPreferredSessionKernelList[0].id,
166
+ name: kernelInfoFromPreferredSessionKernelList[0].name,
167
+ })
168
+ .then((kernelConnection) => {
169
+ if (!kernelConnection) {
170
+ return;
171
+ }
172
+ (libroView.model as LibroJupyterModel).kernelConnection = kernelConnection;
173
+ (libroView.model as LibroJupyterModel).kernelConnecting = false;
174
+ return;
175
+ })
176
+ .catch(() => {
177
+ //
178
+ });
179
+ }
180
+
181
+ libroView.model.kernelConnecting = false;
182
+ return;
183
+ },
184
+ [libroView, otherKernelList, preferredSessionKernelList, kernelConnectionManager],
185
+ );
186
+
187
+ return (
188
+ <Dropdown
189
+ overlayClassName="libro-kernel-dropdown"
190
+ menu={{
191
+ items: getKernelListItems(preferredSessionKernelList, otherKernelList),
192
+ onClick: ({ key }) => handleChange(key),
193
+ }}
194
+ trigger={['click']}
195
+ >
196
+ <Space>
197
+ {(libroModel as LibroJupyterModel)?.kernelConnection?.isDisposed
198
+ ? 'no kernel'
199
+ : (libroModel as LibroJupyterModel)?.kernelConnection?.name || 'no kernel'}
200
+ <CaretDownOutlined />
201
+ </Space>
202
+ </Dropdown>
203
+ );
204
+ };