@difizen/libro-lab 0.2.19 → 0.2.21

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 (34) hide show
  1. package/es/common/icon.d.ts.map +1 -1
  2. package/es/common/icon.js +12 -62
  3. package/es/index.less +29 -23
  4. package/es/kernel-and-terminal-panel/collapse/index.less +3 -3
  5. package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.d.ts.map +1 -1
  6. package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.js +89 -82
  7. package/es/kernel-and-terminal-panel/kernel-color-registry.d.ts +6 -0
  8. package/es/kernel-and-terminal-panel/kernel-color-registry.d.ts.map +1 -0
  9. package/es/kernel-and-terminal-panel/kernel-color-registry.js +96 -0
  10. package/es/kernel-and-terminal-panel/module.d.ts.map +1 -1
  11. package/es/kernel-and-terminal-panel/module.js +2 -1
  12. package/es/lab-color-registry.d.ts +6 -0
  13. package/es/lab-color-registry.d.ts.map +1 -0
  14. package/es/lab-color-registry.js +124 -0
  15. package/es/layout/footer/index.less +1 -1
  16. package/es/layout/index.less +9 -3
  17. package/es/module.d.ts.map +1 -1
  18. package/es/module.js +2 -1
  19. package/es/toc/libro-toc-panel-view.d.ts.map +1 -1
  20. package/es/toc/libro-toc-panel-view.js +16 -10
  21. package/es/welcome/index.less +10 -10
  22. package/package.json +10 -10
  23. package/src/common/icon.tsx +36 -52
  24. package/src/index.less +29 -23
  25. package/src/kernel-and-terminal-panel/collapse/index.less +3 -3
  26. package/src/kernel-and-terminal-panel/kernel-and-terminal-panel-view.tsx +50 -38
  27. package/src/kernel-and-terminal-panel/kernel-color-registry.ts +84 -0
  28. package/src/kernel-and-terminal-panel/module.ts +2 -0
  29. package/src/lab-color-registry.ts +119 -0
  30. package/src/layout/footer/index.less +1 -1
  31. package/src/layout/index.less +9 -3
  32. package/src/module.tsx +2 -0
  33. package/src/toc/libro-toc-panel-view.tsx +23 -12
  34. package/src/welcome/index.less +10 -10
@@ -6,11 +6,13 @@ import {
6
6
  CommandRegistry,
7
7
  inject,
8
8
  singleton,
9
+ ThemeService,
9
10
  useInject,
10
11
  view,
11
12
  ViewInstance,
12
13
  ViewManager,
13
14
  } from '@difizen/mana-app';
15
+ import { ConfigProvider, theme } from 'antd';
14
16
  import { useEffect, useState } from 'react';
15
17
 
16
18
  import { KernelAndTerminal } from '../common/index.js';
@@ -29,6 +31,7 @@ import './index.less';
29
31
  const PanelRender: React.FC = () => {
30
32
  const instance = useInject<KernelAndTerminalPanelView>(ViewInstance);
31
33
  const openedTabView = instance.getAllOpenedTabView();
34
+ const themeService = useInject<ThemeService>(ThemeService);
32
35
 
33
36
  const {
34
37
  libroKernelManager,
@@ -131,46 +134,55 @@ const PanelRender: React.FC = () => {
131
134
  }, [terminalManager.runningModels]);
132
135
 
133
136
  return (
134
- <div className="kernel-and-terminal-panel">
135
- <LibroCollapse
136
- type={LibroPanelCollapseItemType.PAGE}
137
- items={openedTabView.children.map((item) => {
138
- return {
139
- id: item.id + '',
140
- name: item.title.label as string,
141
- };
142
- })}
143
- tabView={openedTabView}
144
- shutdownAll={async () => {
145
- // dispose会影响原始数组,这里使用解构赋值copy一份数组。
146
- for (const item of [...openedTabView.children]) {
147
- if (item.title.closable) {
148
- item.dispose();
137
+ <ConfigProvider
138
+ theme={{
139
+ algorithm:
140
+ themeService.getCurrentTheme().type === 'dark'
141
+ ? theme.darkAlgorithm
142
+ : theme.defaultAlgorithm,
143
+ }}
144
+ >
145
+ <div className="kernel-and-terminal-panel">
146
+ <LibroCollapse
147
+ type={LibroPanelCollapseItemType.PAGE}
148
+ items={openedTabView.children.map((item) => {
149
+ return {
150
+ id: item.id + '',
151
+ name: item.title.label as string,
152
+ };
153
+ })}
154
+ tabView={openedTabView}
155
+ shutdownAll={async () => {
156
+ // dispose会影响原始数组,这里使用解构赋值copy一份数组。
157
+ for (const item of [...openedTabView.children]) {
158
+ if (item.title.closable) {
159
+ item.dispose();
160
+ }
149
161
  }
162
+ }}
163
+ />
164
+ <LibroCollapse
165
+ type={LibroPanelCollapseItemType.KERNEL}
166
+ items={kernelItems}
167
+ shutdownAll={async () => {
168
+ await libroKernelManager.shutdownAll();
169
+ await libroSessionManager.refreshRunning();
170
+ }}
171
+ />
172
+ <LibroCollapse
173
+ type={LibroPanelCollapseItemType.TERMINAL}
174
+ items={terminalItems}
175
+ shutdownAll={async () => await terminalManager.shutdownAll()}
176
+ />
177
+ <LibroCollapse
178
+ type={LibroPanelCollapseItemType.LSP}
179
+ items={lspItems}
180
+ shutdownAll={async () =>
181
+ await libroLanguageClientManager.closeAllLanguageClient()
150
182
  }
151
- }}
152
- />
153
- <LibroCollapse
154
- type={LibroPanelCollapseItemType.KERNEL}
155
- items={kernelItems}
156
- shutdownAll={async () => {
157
- await libroKernelManager.shutdownAll();
158
- await libroSessionManager.refreshRunning();
159
- }}
160
- />
161
- <LibroCollapse
162
- type={LibroPanelCollapseItemType.TERMINAL}
163
- items={terminalItems}
164
- shutdownAll={async () => await terminalManager.shutdownAll()}
165
- />
166
- <LibroCollapse
167
- type={LibroPanelCollapseItemType.LSP}
168
- items={lspItems}
169
- shutdownAll={async () =>
170
- await libroLanguageClientManager.closeAllLanguageClient()
171
- }
172
- />
173
- </div>
183
+ />
184
+ </div>
185
+ </ConfigProvider>
174
186
  );
175
187
  };
176
188
 
@@ -0,0 +1,84 @@
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 KernelPanelColorContribution implements ColorContribution {
7
+ registerColors(colors: ColorRegistry): void {
8
+ // common
9
+ colors.register(
10
+ // #region antd variable
11
+ {
12
+ id: 'libro.lab.kernel.panel.collapse.header.label',
13
+ defaults: { dark: '#F8F8FB', light: Color.rgba(0, 10, 26, 0.68) },
14
+ description: '',
15
+ },
16
+ {
17
+ id: 'libro.lab.kernel.panel.collapse.item.text',
18
+ defaults: { dark: '#E3E4E6', light: Color.rgba(0, 10, 26, 0.65) },
19
+ description: '',
20
+ },
21
+ {
22
+ id: 'libro.lab.server.info.title.text',
23
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.89) },
24
+ description: '',
25
+ },
26
+ {
27
+ id: 'libro.lab.server.info.text',
28
+ defaults: {
29
+ dark: '#e3e4e6',
30
+ light: Color.rgba(0, 10, 26, 0.78),
31
+ },
32
+ description: 'welcome',
33
+ },
34
+ {
35
+ id: 'libro.lab.welcome.h3.text',
36
+ defaults: {
37
+ dark: '#EDEEEF',
38
+ light: Color.rgba(0, 10, 26, 0.89),
39
+ },
40
+ description: 'welcome',
41
+ },
42
+ {
43
+ id: 'libro.lab.welcome.entry.point.text',
44
+ defaults: {
45
+ dark: '#D6D8DA',
46
+ light: Color.rgba(0, 10, 26, 0.68),
47
+ },
48
+ description: 'welcome',
49
+ },
50
+ {
51
+ id: 'libro.lab.welcome.entry.point.text',
52
+ defaults: {
53
+ dark: '#D6D8DA',
54
+ light: Color.rgba(0, 10, 26, 0.68),
55
+ },
56
+ description: 'welcome',
57
+ },
58
+ {
59
+ id: 'libro.lab.welcome.entry.point.background',
60
+ defaults: {
61
+ dark: Color.rgba(255, 255, 255, 0.08),
62
+ light: '#000a1a05',
63
+ },
64
+ description: 'welcome',
65
+ },
66
+ {
67
+ id: 'libro.lab.welcome.service.info.background',
68
+ defaults: {
69
+ dark: Color.rgba(255, 255, 255, 0.08),
70
+ light: Color.rgba(0, 10, 26, 0.02),
71
+ },
72
+ description: 'welcome',
73
+ },
74
+ {
75
+ id: 'libro.lab.welcome.entry.point.hover.background',
76
+ defaults: {
77
+ dark: Color.rgba(255, 255, 255, 0.16),
78
+ light: Color.rgba(0, 10, 26, 0.04),
79
+ },
80
+ description: 'welcome',
81
+ },
82
+ );
83
+ }
84
+ }
@@ -3,11 +3,13 @@ import { createViewPreference, ManaModule } from '@difizen/mana-app';
3
3
  import { LibroLabLayoutSlots } from '../layout/protocol.js';
4
4
 
5
5
  import { KernelAndTerminalPanelView } from './kernel-and-terminal-panel-view.js';
6
+ import { KernelPanelColorContribution } from './kernel-color-registry.js';
6
7
  import { PanelCommandContribution } from './panel-command.js';
7
8
 
8
9
  export const LibroKernelAndTerminalPanelModule = ManaModule.create().register(
9
10
  PanelCommandContribution,
10
11
  KernelAndTerminalPanelView,
12
+ KernelPanelColorContribution,
11
13
  createViewPreference({
12
14
  view: KernelAndTerminalPanelView,
13
15
  slot: LibroLabLayoutSlots.navigator,
@@ -0,0 +1,119 @@
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 LabColorContribution implements ColorContribution {
7
+ registerColors(colors: ColorRegistry): void {
8
+ // common
9
+ colors.register(
10
+ // #region antd variable
11
+ {
12
+ id: 'libro.lab.welcome.background.color',
13
+ defaults: { dark: '#1f2022', light: '#FFFFFF' },
14
+ description: '',
15
+ },
16
+ {
17
+ id: 'libro.lab.welcome.h1.color',
18
+ defaults: {
19
+ dark: '#edeeef',
20
+ light: '#000A1A',
21
+ },
22
+ description: 'welcome',
23
+ },
24
+ {
25
+ id: 'libro.lab.server.info.title.text',
26
+ defaults: { dark: '#BDC0C4', light: Color.rgba(0, 10, 26, 0.89) },
27
+ description: '',
28
+ },
29
+ {
30
+ id: 'libro.lab.server.info.text',
31
+ defaults: {
32
+ dark: '#e3e4e6',
33
+ light: Color.rgba(0, 10, 26, 0.78),
34
+ },
35
+ description: 'welcome',
36
+ },
37
+ {
38
+ id: 'libro.lab.welcome.h3.text',
39
+ defaults: {
40
+ dark: '#EDEEEF',
41
+ light: Color.rgba(0, 10, 26, 0.89),
42
+ },
43
+ description: 'welcome',
44
+ },
45
+ {
46
+ id: 'libro.lab.welcome.entry.point.text',
47
+ defaults: {
48
+ dark: '#D6D8DA',
49
+ light: Color.rgba(0, 10, 26, 0.68),
50
+ },
51
+ description: 'welcome',
52
+ },
53
+ {
54
+ id: 'libro.lab.welcome.entry.point.text',
55
+ defaults: {
56
+ dark: '#D6D8DA',
57
+ light: Color.rgba(0, 10, 26, 0.68),
58
+ },
59
+ description: 'welcome',
60
+ },
61
+ {
62
+ id: 'libro.lab.welcome.entry.point.background',
63
+ defaults: {
64
+ dark: Color.rgba(255, 255, 255, 0.08),
65
+ light: '#000a1a05',
66
+ },
67
+ description: 'welcome',
68
+ },
69
+ {
70
+ id: 'libro.lab.welcome.service.info.background',
71
+ defaults: {
72
+ dark: Color.rgba(255, 255, 255, 0.08),
73
+ light: Color.rgba(0, 10, 26, 0.02),
74
+ },
75
+ description: 'welcome',
76
+ },
77
+ {
78
+ id: 'libro.lab.welcome.entry.point.hover.background',
79
+ defaults: {
80
+ dark: Color.rgba(255, 255, 255, 0.16),
81
+ light: Color.rgba(0, 10, 26, 0.04),
82
+ },
83
+ description: 'welcome',
84
+ },
85
+ {
86
+ id: 'libro.lab.footer.text',
87
+ defaults: {
88
+ dark: '#E3E4E6',
89
+ light: '#000a1aad',
90
+ },
91
+ description: '',
92
+ },
93
+ {
94
+ id: 'libro.lab.footer.background',
95
+ defaults: {
96
+ dark: '#161b21',
97
+ light: '#fcfcfc',
98
+ },
99
+ description: '',
100
+ },
101
+ {
102
+ id: 'libro.lab.content.tab.nav',
103
+ defaults: {
104
+ dark: '#252526',
105
+ light: '#f8f8fb',
106
+ },
107
+ description: '',
108
+ },
109
+ {
110
+ id: 'libro.lab.content.tab.active.background',
111
+ defaults: {
112
+ dark: '#161b21',
113
+ light: '#ffffff',
114
+ },
115
+ description: '',
116
+ },
117
+ );
118
+ }
119
+ }
@@ -17,7 +17,7 @@
17
17
  align-items: center;
18
18
  font-weight: 400;
19
19
  font-size: 12px;
20
- color: rgba(0, 10, 26, 68%);
20
+ color: var(--mana-libro-lab-footer-text);
21
21
  }
22
22
 
23
23
  .libro-lab-status-footer {
@@ -20,7 +20,7 @@
20
20
  &-footer {
21
21
  height: 28px;
22
22
  min-height: 28px;
23
- background-image: linear-gradient(270deg, #fafafa 0%, #fff 100%);
23
+ background: var(--mana-libro-lab-footer-background);
24
24
  box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 12%);
25
25
  }
26
26
 
@@ -33,13 +33,19 @@
33
33
  flex: unset !important;
34
34
  }
35
35
 
36
+ .mana-header-middle {
37
+ display: flex;
38
+ align-items: center;
39
+ }
40
+
36
41
  .mana-menubar {
37
- height: 100%;
42
+ // height: 100%;
43
+ position: relative;
38
44
  padding: unset;
39
45
  }
40
46
 
41
47
  .mana-menubar-item-text {
42
- color: rgba(0, 10, 26, 89%);
48
+ // color: rgba(0, 10, 26, 89%);
43
49
  font-weight: 400;
44
50
  }
45
51
  }
package/src/module.tsx CHANGED
@@ -18,6 +18,7 @@ import { ImageViewerModule } from './image-viewer/index.js';
18
18
  // import { KernelManagerView } from './kernel-manager/index.js';
19
19
  import { LibroKernelAndTerminalPanelModule } from './kernel-and-terminal-panel/module.js';
20
20
  import { LibroLabApp } from './lab-app.js';
21
+ import { LabColorContribution } from './lab-color-registry.js';
21
22
  import { ContentBottomTabView } from './layout/content-bottom-tab-view.js';
22
23
  import {
23
24
  LibroLabLayoutModule,
@@ -38,6 +39,7 @@ export const LibroLabModule = ManaModule.create()
38
39
  GithubLinkView,
39
40
  LabConfigAppContribution,
40
41
  LibroLabSideTabView,
42
+ LabColorContribution,
41
43
  createViewPreference({
42
44
  view: GithubLinkView,
43
45
  slot: HeaderArea.right,
@@ -5,13 +5,14 @@ import {
5
5
  inject,
6
6
  prop,
7
7
  singleton,
8
+ ThemeService,
8
9
  useInject,
9
10
  view,
10
11
  ViewInstance,
11
12
  ViewManager,
12
13
  ViewRender,
13
14
  } from '@difizen/mana-app';
14
- import { Empty } from 'antd';
15
+ import { ConfigProvider, Empty, theme } from 'antd';
15
16
 
16
17
  import { TocIcon } from '../common/index.js';
17
18
  import { LayoutService } from '../layout/layout-service.js';
@@ -21,18 +22,28 @@ import './index.less';
21
22
 
22
23
  const TocViewRender: React.FC = () => {
23
24
  const tocPanelView = useInject<TocPanelView>(ViewInstance);
25
+ const themeService = useInject<ThemeService>(ThemeService);
24
26
  return (
25
- <div className="libro-lab-toc-panel">
26
- {tocPanelView.libroTocView ? (
27
- <ViewRender view={tocPanelView.libroTocView}></ViewRender>
28
- ) : (
29
- <Empty
30
- image={Empty.PRESENTED_IMAGE_SIMPLE}
31
- description="该文件格式暂不支持大纲"
32
- className="libro-lab-toc-empty"
33
- />
34
- )}
35
- </div>
27
+ <ConfigProvider
28
+ theme={{
29
+ algorithm:
30
+ themeService.getCurrentTheme().type === 'dark'
31
+ ? theme.darkAlgorithm
32
+ : theme.defaultAlgorithm,
33
+ }}
34
+ >
35
+ <div className="libro-lab-toc-panel">
36
+ {tocPanelView.libroTocView ? (
37
+ <ViewRender view={tocPanelView.libroTocView}></ViewRender>
38
+ ) : (
39
+ <Empty
40
+ image={Empty.PRESENTED_IMAGE_SIMPLE}
41
+ description="该文件格式暂不支持大纲"
42
+ className="libro-lab-toc-empty"
43
+ />
44
+ )}
45
+ </div>
46
+ </ConfigProvider>
36
47
  );
37
48
  };
38
49
 
@@ -1,7 +1,7 @@
1
1
  .libro-lab-welcome-page {
2
2
  padding: 32px 54px;
3
3
  height: 100%;
4
- background: white;
4
+ background: var(--mana-libro-lab-welcome-background-color);
5
5
  overflow: auto;
6
6
 
7
7
  .libro-lab-welcome-page-title {
@@ -9,7 +9,7 @@
9
9
  font-family: PingFangSC;
10
10
  font-weight: 600;
11
11
  font-size: 40px;
12
- color: #000a1a;
12
+ color: var(--mana-libro-lab-welcome-h1-color);
13
13
  letter-spacing: 0;
14
14
  line-height: 56px;
15
15
  }
@@ -29,12 +29,12 @@
29
29
  margin-bottom: 24px;
30
30
  height: 100px;
31
31
  width: 100px;
32
- background-color: rgba(0, 10, 26, 2%);
32
+ background-color: var(--mana-libro-lab-welcome-entry-point-background);
33
33
  border-radius: 8px;
34
34
  cursor: pointer;
35
35
 
36
36
  &:hover {
37
- background-color: rgba(0, 10, 26, 4%);
37
+ background-color: var(--mana-libro-lab-welcome-entry-point-hover-background);
38
38
  }
39
39
  }
40
40
 
@@ -42,20 +42,20 @@
42
42
  margin-top: 6px;
43
43
  line-height: 20px;
44
44
  font-size: 14px;
45
- color: rgba(0, 10, 26, 68%);
45
+ color: var(--mana-libro-lab-welcome-entry-point-text);
46
46
  }
47
47
 
48
48
  .libro-lab-entry-point-title {
49
49
  font-weight: 500;
50
50
  font-size: 18px;
51
51
  margin-bottom: 12px;
52
- color: rgba(0, 10, 26, 89%);
52
+ color: var(--mana-libro-lab-welcome-h3-color);
53
53
  }
54
54
 
55
55
  .libro-lab-entry-point-item-title {
56
56
  font-weight: 500;
57
57
  font-size: 16px;
58
- color: rgba(0, 10, 26, 89%);
58
+ color: var(--mana-libro-lab-welcome-h3-color);
59
59
  margin-bottom: 16px;
60
60
  }
61
61
 
@@ -103,7 +103,7 @@
103
103
 
104
104
  .libro-lab-welcome-page-server-info {
105
105
  width: 400px;
106
- background-color: rgba(0, 10, 26, 2%);
106
+ background: var(--mana-libro-lab-welcome-service-info-background);
107
107
  border-radius: 8px;
108
108
  margin-bottom: 24px;
109
109
  padding: 16px 24px;
@@ -112,9 +112,9 @@
112
112
  .libro-lab-welcome-page-server-info-title {
113
113
  font-weight: 500;
114
114
  font-size: 16px;
115
- color: rgba(0, 10, 26, 89%);
115
+ color: var(--mana-libro-lab-server-info-title-text);
116
116
  }
117
117
 
118
118
  .libro-lab-welcome-page-server-info-item {
119
- color: rgba(0, 10, 26, 78%);
119
+ color: var(--mana-libro-lab-server-info-text);
120
120
  }