@difizen/libro-lab 0.1.0 → 0.1.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.
Files changed (107) hide show
  1. package/es/common/icon.d.ts +14 -0
  2. package/es/common/icon.d.ts.map +1 -0
  3. package/es/common/icon.js +368 -0
  4. package/es/common/index.d.ts +2 -0
  5. package/es/common/index.d.ts.map +1 -0
  6. package/es/common/index.js +1 -0
  7. package/es/common/index.less +8 -0
  8. package/es/config/config-contribution.d.ts +7 -0
  9. package/es/config/config-contribution.d.ts.map +1 -0
  10. package/es/config/config-contribution.js +34 -0
  11. package/es/config/index.d.ts +2 -0
  12. package/es/config/index.d.ts.map +1 -0
  13. package/es/config/index.js +1 -0
  14. package/es/github-link/index.d.ts +9 -0
  15. package/es/github-link/index.d.ts.map +1 -0
  16. package/es/index.less +9 -0
  17. package/es/kernel-manager/index.d.ts +8 -0
  18. package/es/kernel-manager/index.d.ts.map +1 -0
  19. package/es/lab-app.d.ts +4 -1
  20. package/es/lab-app.d.ts.map +1 -1
  21. package/es/lab-app.js +26 -5
  22. package/es/layout/brand/index.d.ts +8 -0
  23. package/es/layout/brand/index.d.ts.map +1 -0
  24. package/es/layout/brand/index.js +1 -1
  25. package/es/layout/container.d.ts +8 -0
  26. package/es/layout/container.d.ts.map +1 -0
  27. package/es/layout/content-bottom-tab-view.d.ts +8 -0
  28. package/es/layout/content-bottom-tab-view.d.ts.map +1 -0
  29. package/es/layout/content-bottom-tab-view.js +49 -0
  30. package/es/layout/footer/current-file-footer-view.d.ts +1 -2
  31. package/es/layout/footer/current-file-footer-view.d.ts.map +1 -1
  32. package/es/layout/footer/current-file-footer-view.js +3 -7
  33. package/es/layout/footer/footer-view.d.ts +11 -0
  34. package/es/layout/footer/footer-view.d.ts.map +1 -0
  35. package/es/layout/footer/index.less +10 -7
  36. package/es/layout/footer/status-footer-view.d.ts +10 -0
  37. package/es/layout/footer/status-footer-view.d.ts.map +1 -0
  38. package/es/layout/footer/status-footer-view.js +73 -0
  39. package/es/layout/layout-service.d.ts +15 -0
  40. package/es/layout/layout-service.d.ts.map +1 -0
  41. package/es/layout/layout-service.js +19 -15
  42. package/es/layout/layout.d.ts +12 -0
  43. package/es/layout/layout.d.ts.map +1 -0
  44. package/es/layout/layout.js +43 -6
  45. package/es/layout/main.d.ts.map +1 -1
  46. package/es/layout/main.js +0 -1
  47. package/es/layout/module.d.ts.map +1 -1
  48. package/es/layout/module.js +7 -2
  49. package/es/layout/protocol.d.ts +17 -0
  50. package/es/layout/protocol.d.ts.map +1 -0
  51. package/es/layout/protocol.js +2 -1
  52. package/es/layout/{editor-tab-view.d.ts → saveable-tab-view.d.ts} +2 -2
  53. package/es/layout/saveable-tab-view.d.ts.map +1 -0
  54. package/es/layout/{editor-tab-view.js → saveable-tab-view.js} +9 -10
  55. package/es/menu/menu-bar-view.d.ts +9 -0
  56. package/es/menu/menu-bar-view.d.ts.map +1 -0
  57. package/es/menu/menu-command.d.ts +139 -0
  58. package/es/menu/menu-command.d.ts.map +1 -0
  59. package/es/menu/menu-contribution.d.ts +6 -1
  60. package/es/menu/menu-contribution.d.ts.map +1 -1
  61. package/es/menu/menu-contribution.js +37 -4
  62. package/es/module.d.ts.map +1 -1
  63. package/es/module.js +12 -4
  64. package/es/toc/libro-toc-panel-view.d.ts.map +1 -1
  65. package/es/toc/libro-toc-panel-view.js +2 -1
  66. package/es/welcome/entry-point-view.d.ts +8 -0
  67. package/es/welcome/entry-point-view.d.ts.map +1 -0
  68. package/es/welcome/entry-point-view.js +200 -0
  69. package/es/welcome/index.d.ts +13 -0
  70. package/es/welcome/index.d.ts.map +1 -0
  71. package/es/welcome/index.js +30 -7
  72. package/es/welcome/index.less +99 -0
  73. package/package.json +9 -5
  74. package/src/common/icon.tsx +300 -0
  75. package/src/common/index.less +8 -0
  76. package/src/common/index.tsx +1 -0
  77. package/src/config/config-contribution.ts +12 -0
  78. package/src/config/index.ts +1 -0
  79. package/src/index.less +9 -0
  80. package/src/index.spec.ts +0 -1
  81. package/src/lab-app.ts +16 -1
  82. package/src/layout/brand/index.tsx +1 -1
  83. package/src/layout/content-bottom-tab-view.tsx +18 -0
  84. package/src/layout/footer/current-file-footer-view.tsx +3 -7
  85. package/src/layout/footer/index.less +10 -7
  86. package/src/layout/footer/status-footer-view.tsx +45 -0
  87. package/src/layout/layout-service.ts +9 -8
  88. package/src/layout/layout.tsx +29 -1
  89. package/src/layout/main.tsx +0 -1
  90. package/src/layout/module.ts +10 -2
  91. package/src/layout/protocol.tsx +8 -0
  92. package/src/layout/{editor-tab-view.tsx → saveable-tab-view.tsx} +4 -5
  93. package/src/menu/menu-contribution.ts +24 -1
  94. package/src/module.tsx +15 -2
  95. package/src/toc/libro-toc-panel-view.tsx +2 -1
  96. package/src/welcome/entry-point-view.tsx +169 -0
  97. package/src/welcome/index.less +99 -0
  98. package/src/welcome/index.tsx +40 -7
  99. package/es/layout/brand/logo.js +0 -41
  100. package/es/layout/editor-tab-view.d.ts.map +0 -1
  101. package/es/toc/libro-toc-icons.d.ts +0 -7
  102. package/es/toc/libro-toc-icons.d.ts.map +0 -1
  103. package/es/toc/libro-toc-icons.js +0 -38
  104. package/es/welcome/welcome-icon.js +0 -66
  105. package/src/layout/brand/logo.tsx +0 -39
  106. package/src/toc/libro-toc-icons.tsx +0 -35
  107. package/src/welcome/welcome-icon.tsx +0 -64
@@ -8,20 +8,23 @@ import {
8
8
 
9
9
  import { BrandView } from './brand/index.js';
10
10
  import { LibroLabLayoutContainerView } from './container.js';
11
- import { EditorTabView } from './editor-tab-view.js';
11
+ import { ContentBottomTabView } from './content-bottom-tab-view.js';
12
12
  import { LibroLabCurrentFileFooterView } from './footer/current-file-footer-view.js';
13
13
  import { FooterArea, LibroLabLayoutFooterView } from './footer/footer-view.js';
14
+ import { LibroLabStatusFooterView } from './footer/status-footer-view.js';
14
15
  import { LayoutService } from './layout-service.js';
15
16
  import { LibroLabLayoutView } from './layout.js';
16
17
  import { LibroLabLayoutMainView } from './main.js';
17
18
  import { LibroLabLayoutSlots } from './protocol.js';
19
+ import { SaveableTabView } from './saveable-tab-view.js';
18
20
 
19
21
  export const LibroLabLayoutModule = ManaModule.create('LibroLabLayoutModule').register(
20
22
  LibroLabLayoutView,
21
23
  LibroLabLayoutContainerView,
22
24
  LibroLabLayoutMainView,
23
25
  BrandView,
24
- EditorTabView,
26
+ SaveableTabView,
27
+ ContentBottomTabView,
25
28
  LibroLabLayoutFooterView,
26
29
  LibroLabCurrentFileFooterView,
27
30
  LayoutService,
@@ -59,4 +62,9 @@ export const LibroLabLayoutModule = ManaModule.create('LibroLabLayoutModule').re
59
62
  slot: FooterArea.left,
60
63
  view: LibroLabCurrentFileFooterView,
61
64
  }),
65
+ LibroLabStatusFooterView,
66
+ createSlotPreference({
67
+ slot: FooterArea.right,
68
+ view: LibroLabStatusFooterView,
69
+ }),
62
70
  );
@@ -6,7 +6,15 @@ export const LibroLabLayoutSlots = {
6
6
  navigator: 'libro-lab-navigator',
7
7
  content: 'libro-lab-content',
8
8
  contentBottom: 'libro-lab-content-bottom',
9
+ alert: 'libro-lab-alert',
9
10
  };
10
11
 
12
+ export type StatusType = 'loading' | 'success';
13
+
14
+ export interface StatusItem {
15
+ label: string;
16
+ icon: JSX.Element;
17
+ }
18
+
11
19
  export type LibroLabLayoutSlotsType =
12
20
  (typeof LibroLabLayoutSlots)[keyof typeof LibroLabLayoutSlots];
@@ -1,5 +1,4 @@
1
1
  import { CloseOutlined } from '@ant-design/icons';
2
- import { EditorView } from '@difizen/libro-jupyter';
3
2
  import type { View } from '@difizen/mana-app';
4
3
  import {
5
4
  CardTabView,
@@ -7,14 +6,15 @@ import {
7
6
  transient,
8
7
  view,
9
8
  ViewContext,
9
+ Saveable,
10
10
  } from '@difizen/mana-app';
11
11
  import { Dropdown } from '@difizen/mana-react';
12
12
  import { Badge } from 'antd';
13
13
  import classnames from 'classnames';
14
14
 
15
15
  @transient()
16
- @view('LibroLabEditorTab')
17
- export class EditorTabView extends CardTabView {
16
+ @view('libro-lab-saveable-tab')
17
+ export class SaveableTabView extends CardTabView {
18
18
  protected override renderTab(item: View) {
19
19
  return (
20
20
  <ViewContext view={item}>
@@ -38,9 +38,8 @@ export class EditorTabView extends CardTabView {
38
38
  </ViewContext>
39
39
  );
40
40
  }
41
-
42
41
  protected renderTail(item: View) {
43
- const isDirty = EditorView.is(item) && item.dirty;
42
+ const isDirty = Saveable.is(item) && Saveable.isDirty(item);
44
43
  return (
45
44
  <div className="libro-lab-editor-tab-tail">
46
45
  {isDirty ? (
@@ -4,6 +4,7 @@ import {
4
4
  LibroService,
5
5
  NotebookCommands,
6
6
  } from '@difizen/libro-jupyter';
7
+ import { LibroTerminalView, TerminalManager } from '@difizen/libro-terminal';
7
8
  import type { MenuRegistry } from '@difizen/mana-app';
8
9
  import {
9
10
  CommandContribution,
@@ -12,7 +13,12 @@ import {
12
13
  MAIN_MENU_BAR,
13
14
  MenuContribution,
14
15
  singleton,
16
+ ViewManager,
15
17
  } from '@difizen/mana-app';
18
+ import { v4 } from 'uuid';
19
+
20
+ import { LayoutService } from '../layout/layout-service.js';
21
+ import { LibroLabLayoutSlots } from '../layout/protocol.js';
16
22
 
17
23
  import { MenuCommands } from './menu-command.js';
18
24
 
@@ -29,6 +35,9 @@ export namespace HeaderMenus {
29
35
  export class HeaderMenu implements MenuContribution, CommandContribution {
30
36
  @inject(CommandRegistry) protected commandRegistry: CommandRegistry;
31
37
  @inject(LibroService) protected libroService: LibroService;
38
+ @inject(LayoutService) protected layoutService: LayoutService;
39
+ @inject(TerminalManager) terminalManager: TerminalManager;
40
+ @inject(ViewManager) viewManager: ViewManager;
32
41
 
33
42
  registerMenus(menu: MenuRegistry) {
34
43
  menu.registerSubmenu(HeaderMenus.FILE, { label: '文件' });
@@ -211,7 +220,21 @@ export class HeaderMenu implements MenuContribution, CommandContribution {
211
220
  registerCommands(commands: CommandRegistry) {
212
221
  commands.registerCommand(MenuCommands.OpenTerminal, {
213
222
  execute: () => {
214
- //TODO: 增加终端
223
+ this.viewManager
224
+ .getOrCreateView<LibroTerminalView>(LibroTerminalView, {
225
+ id: v4(),
226
+ })
227
+ .then((terminalView) => {
228
+ this.layoutService.setAreaVisible(LibroLabLayoutSlots.contentBottom, true);
229
+ this.layoutService.addView(terminalView, {
230
+ slot: LibroLabLayoutSlots.contentBottom,
231
+ reveal: true,
232
+ });
233
+ return;
234
+ })
235
+ .catch(() => {
236
+ //
237
+ });
215
238
  },
216
239
  });
217
240
  commands.registerCommand(MenuCommands.About, {
package/src/module.tsx CHANGED
@@ -1,4 +1,6 @@
1
1
  import { FileView, LibroJupyterModule } from '@difizen/libro-jupyter';
2
+ import { LibroPromptCellModule } from '@difizen/libro-prompt-cell';
3
+ import { TerminalModule } from '@difizen/libro-terminal';
2
4
  import {
3
5
  ManaModule,
4
6
  createSlotPreference,
@@ -8,18 +10,21 @@ import {
8
10
  HeaderArea,
9
11
  } from '@difizen/mana-app';
10
12
 
13
+ import { LabConfigAppContribution } from './config/config-contribution.js';
11
14
  import { GithubLinkView } from './github-link/index.js';
12
15
  import { KernelManagerView } from './kernel-manager/index.js';
13
16
  import { LibroLabApp } from './lab-app.js';
14
- import { EditorTabView } from './layout/editor-tab-view.js';
17
+ import { ContentBottomTabView } from './layout/content-bottom-tab-view.js';
15
18
  import {
16
19
  LibroLabLayoutModule,
17
20
  LibroLabLayoutSlots,
18
21
  LibroLabLayoutView,
19
22
  } from './layout/index.js';
23
+ import { SaveableTabView } from './layout/saveable-tab-view.js';
20
24
  import './index.less';
21
25
  import { LibroLabHeaderMenuModule } from './menu/module.js';
22
26
  import { LibroLabTocModule } from './toc/module.js';
27
+ import { EntryPointView } from './welcome/entry-point-view.js';
23
28
  import { WelcomeView } from './welcome/index.js';
24
29
 
25
30
  export const LibroLabModule = ManaModule.create()
@@ -27,6 +32,7 @@ export const LibroLabModule = ManaModule.create()
27
32
  LibroLabApp,
28
33
  LibroLabLayoutView,
29
34
  GithubLinkView,
35
+ LabConfigAppContribution,
30
36
  createViewPreference({
31
37
  view: GithubLinkView,
32
38
  slot: HeaderArea.right,
@@ -50,9 +56,13 @@ export const LibroLabModule = ManaModule.create()
50
56
  slot: RootSlotId,
51
57
  }),
52
58
  createSlotPreference({
53
- view: EditorTabView,
59
+ view: SaveableTabView,
54
60
  slot: LibroLabLayoutSlots.content,
55
61
  }),
62
+ createSlotPreference({
63
+ view: ContentBottomTabView,
64
+ slot: LibroLabLayoutSlots.contentBottom,
65
+ }),
56
66
  createSlotPreference({
57
67
  view: SideTabView,
58
68
  slot: LibroLabLayoutSlots.navigator,
@@ -79,10 +89,13 @@ export const LibroLabModule = ManaModule.create()
79
89
  order: 'welcome',
80
90
  },
81
91
  }),
92
+ EntryPointView,
82
93
  )
83
94
  .dependOn(
84
95
  LibroJupyterModule,
85
96
  LibroLabLayoutModule,
86
97
  LibroLabHeaderMenuModule,
87
98
  LibroLabTocModule,
99
+ LibroPromptCellModule,
100
+ TerminalModule,
88
101
  );
@@ -13,10 +13,10 @@ import {
13
13
  } from '@difizen/mana-app';
14
14
  import { Empty } from 'antd';
15
15
 
16
+ import { TocIcon } from '../common/index.js';
16
17
  import { LayoutService } from '../layout/layout-service.js';
17
18
  import { LibroLabLayoutSlots } from '../layout/protocol.js';
18
19
 
19
- import { TocIcon } from './libro-toc-icons.js';
20
20
  import './index.less';
21
21
 
22
22
  const TocViewRender: React.FC = () => {
@@ -69,6 +69,7 @@ export class TocPanelView extends BaseView {
69
69
 
70
70
  handleEditTabChange = () => {
71
71
  if (!this.libroNavigatableView) {
72
+ this.libroTocView = undefined;
72
73
  return;
73
74
  }
74
75
  this.viewManager
@@ -0,0 +1,169 @@
1
+ import {
2
+ NotebookIcon,
3
+ PythonIcon,
4
+ JSONIcon,
5
+ MoreIcon,
6
+ FileCreateModal,
7
+ FileView,
8
+ } from '@difizen/libro-jupyter';
9
+ import {
10
+ ModalService,
11
+ singleton,
12
+ useInject,
13
+ view,
14
+ ViewManager,
15
+ } from '@difizen/mana-app';
16
+ import { BaseView } from '@difizen/mana-app';
17
+ import { Col, Row } from 'antd';
18
+ import { forwardRef, useEffect, useState } from 'react';
19
+
20
+ import { KeybindIcon, PreferenceIcon, TerminalIcon } from '../common/icon.js';
21
+
22
+ import './index.less';
23
+
24
+ export const EntryPointComponent = forwardRef(function EntryPointComponent() {
25
+ const modalService = useInject(ModalService);
26
+ const viewManager = useInject(ViewManager);
27
+ const [fileView, setFileView] = useState<FileView>();
28
+
29
+ useEffect(() => {
30
+ viewManager
31
+ .getOrCreateView(FileView)
32
+ .then((curfileView) => {
33
+ setFileView(curfileView);
34
+ return;
35
+ })
36
+ .catch(() => {
37
+ //
38
+ });
39
+ }, [viewManager]);
40
+
41
+ return (
42
+ <div className="libro-lab-entry-point">
43
+ <div className="libro-lab-entry-point-title">请选择你要创建的文件类型:</div>
44
+ <div className="libro-lab-entry-point-item-title">文件</div>
45
+ <Row>
46
+ <Col
47
+ className="gutter-row"
48
+ style={{ paddingLeft: 'unset', paddingRight: '32px' }}
49
+ >
50
+ <div
51
+ className="libro-lab-entry-point-item"
52
+ onClick={() => {
53
+ modalService.openModal(FileCreateModal, {
54
+ path: fileView?.model.location?.path.toString() || '/',
55
+ fileType: '.ipynb',
56
+ });
57
+ }}
58
+ >
59
+ <NotebookIcon />
60
+ <span className="libro-lab-entry-point-item-text">Notebook</span>
61
+ </div>
62
+ </Col>
63
+ <Col
64
+ className="gutter-row"
65
+ style={{ paddingLeft: 'unset', paddingRight: '32px' }}
66
+ >
67
+ <div
68
+ className="libro-lab-entry-point-item"
69
+ onClick={() => {
70
+ modalService.openModal(FileCreateModal, {
71
+ path: fileView?.model.location?.path.toString() || '/',
72
+ fileType: '.py',
73
+ });
74
+ }}
75
+ >
76
+ <PythonIcon />
77
+ <span className="libro-lab-entry-point-item-text">Python</span>
78
+ </div>
79
+ </Col>
80
+ <Col
81
+ className="gutter-row"
82
+ style={{ paddingLeft: 'unset', paddingRight: '32px' }}
83
+ >
84
+ <div
85
+ className="libro-lab-entry-point-item"
86
+ onClick={() => {
87
+ modalService.openModal(FileCreateModal, {
88
+ path: fileView?.model.location?.path.toString() || '/',
89
+ fileType: '.json',
90
+ });
91
+ }}
92
+ >
93
+ <JSONIcon />
94
+ <span className="libro-lab-entry-point-item-text">JSON</span>
95
+ </div>
96
+ </Col>
97
+ <Col
98
+ className="gutter-row"
99
+ style={{ paddingLeft: 'unset', paddingRight: '32px' }}
100
+ >
101
+ <div
102
+ className="libro-lab-entry-point-item"
103
+ onClick={() => {
104
+ modalService.openModal(FileCreateModal, {
105
+ path: fileView?.model.location?.path.toString() || '/',
106
+ });
107
+ }}
108
+ >
109
+ <MoreIcon />
110
+ <span className="libro-lab-entry-point-item-text">其他</span>
111
+ </div>
112
+ </Col>
113
+ </Row>
114
+ <div className="libro-lab-entry-point-item-title">其他</div>
115
+ <Row>
116
+ <Col
117
+ className="gutter-row"
118
+ style={{ paddingLeft: 'unset', paddingRight: '32px' }}
119
+ >
120
+ <div className="libro-lab-entry-point-item">
121
+ <TerminalIcon />
122
+ <span className="libro-lab-entry-point-item-text">Terminal</span>
123
+ </div>
124
+ </Col>
125
+ </Row>
126
+ {/* <div className="libro-lab-entry-point-item-title">最近使用</div>
127
+ <Row>
128
+ <Col
129
+ className="gutter-row"
130
+ style={{ paddingLeft: 'unset', paddingRight: '24px' }}
131
+ >
132
+ <div className="libro-lab-entry-point-item-recent">
133
+ <span className="libro-lab-entry-point-item-recent-icon">📋 </span>
134
+ <span className="libro-lab-entry-point-item-recent-text">
135
+ 这是一个文件名
136
+ </span>
137
+ </div>
138
+ </Col>
139
+ </Row> */}
140
+ <div className="libro-lab-entry-point-item-title">系统设置</div>
141
+ <Row>
142
+ <Col
143
+ className="gutter-row"
144
+ style={{ paddingLeft: 'unset', paddingRight: '24px' }}
145
+ >
146
+ <div className="libro-lab-entry-point-item-config">
147
+ <PreferenceIcon></PreferenceIcon>
148
+ <span className="libro-lab-entry-point-item-config-text">偏好设置</span>
149
+ </div>
150
+ </Col>
151
+ <Col
152
+ className="gutter-row"
153
+ style={{ paddingLeft: 'unset', paddingRight: '24px' }}
154
+ >
155
+ <div className="libro-lab-entry-point-item-config">
156
+ <KeybindIcon></KeybindIcon>
157
+ <span className="libro-lab-entry-point-item-config-text">快捷键设置</span>
158
+ </div>
159
+ </Col>
160
+ </Row>
161
+ </div>
162
+ );
163
+ });
164
+
165
+ @singleton()
166
+ @view('entry-point-view')
167
+ export class EntryPointView extends BaseView {
168
+ override view = EntryPointComponent;
169
+ }
@@ -2,6 +2,7 @@
2
2
  padding: 32px 54px;
3
3
  height: 100%;
4
4
  background: white;
5
+ overflow: auto;
5
6
 
6
7
  .libro-lab-welcome-page-title {
7
8
  /* stylelint-disable-next-line declaration-property-value-disallowed-list */
@@ -19,3 +20,101 @@
19
20
  color: rgba(0, 10, 26, 78%);
20
21
  }
21
22
  }
23
+
24
+ .libro-lab-entry-point-item {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ flex-direction: column;
29
+ margin-bottom: 24px;
30
+ height: 100px;
31
+ width: 100px;
32
+ background-color: rgba(0, 10, 26, 2%);
33
+ border-radius: 8px;
34
+ cursor: pointer;
35
+
36
+ &:hover {
37
+ background-color: rgba(0, 10, 26, 4%);
38
+ }
39
+ }
40
+
41
+ .libro-lab-entry-point-item-text {
42
+ margin-top: 6px;
43
+ line-height: 20px;
44
+ font-size: 14px;
45
+ color: rgba(0, 10, 26, 68%);
46
+ }
47
+
48
+ .libro-lab-entry-point-title {
49
+ font-weight: 500;
50
+ font-size: 18px;
51
+ margin-bottom: 12px;
52
+ color: rgba(0, 10, 26, 89%);
53
+ }
54
+
55
+ .libro-lab-entry-point-item-title {
56
+ font-weight: 500;
57
+ font-size: 16px;
58
+ color: rgba(0, 10, 26, 89%);
59
+ margin-bottom: 16px;
60
+ }
61
+
62
+ .libro-lab-entry-point-item-recent {
63
+ display: flex;
64
+ align-items: center;
65
+ padding: 0 12px;
66
+ height: 52px;
67
+ width: 180px;
68
+ border: 1px solid rgba(0, 10, 26, 7%);
69
+ border-radius: 8px;
70
+ margin-bottom: 24px;
71
+ cursor: pointer;
72
+
73
+ &:hover {
74
+ border-color: transparent;
75
+ background-color: rgba(0, 10, 26, 4%);
76
+ }
77
+ }
78
+
79
+ .libro-lab-entry-point-item-recent-icon {
80
+ font-size: 24px;
81
+ }
82
+
83
+ .libro-lab-entry-point-item-recent-text {
84
+ margin-left: 8px;
85
+ color: rgba(0, 10, 26, 89%);
86
+ }
87
+
88
+ .libro-lab-entry-point-item-config {
89
+ display: flex;
90
+ align-items: center;
91
+ padding: 0 14px;
92
+ cursor: pointer;
93
+ height: 32px;
94
+ border: 1px solid rgba(0, 0, 0, 15%);
95
+ border-radius: 6px;
96
+ }
97
+
98
+ .libro-lab-entry-point-item-config-text {
99
+ margin-left: 4px;
100
+ color: rgba(0, 0, 0, 88%);
101
+ line-height: 22px;
102
+ }
103
+
104
+ .libro-lab-welcome-page-server-info {
105
+ width: 400px;
106
+ background-color: rgba(0, 10, 26, 2%);
107
+ border-radius: 8px;
108
+ margin-bottom: 24px;
109
+ padding: 16px 24px;
110
+ }
111
+
112
+ .libro-lab-welcome-page-server-info-title {
113
+ font-weight: 500;
114
+ font-size: 16px;
115
+ color: rgba(0, 10, 26, 89%);
116
+ }
117
+
118
+ .libro-lab-welcome-page-server-info-item {
119
+ color: rgba(0, 10, 26, 78%);
120
+ }
@@ -1,18 +1,41 @@
1
- import { singleton, view } from '@difizen/mana-app';
1
+ import { ServerConnection } from '@difizen/libro-jupyter';
2
+ import {
3
+ inject,
4
+ singleton,
5
+ useInject,
6
+ view,
7
+ ViewInstance,
8
+ ViewManager,
9
+ ViewRender,
10
+ } from '@difizen/mana-app';
2
11
  import { BaseView } from '@difizen/mana-app';
3
12
  import { forwardRef } from 'react';
4
13
 
5
- import { WelcomeIcon } from './welcome-icon.js';
14
+ import { LayoutService } from '../layout/layout-service.js';
15
+
16
+ import { EntryPointView } from './entry-point-view.js';
6
17
 
7
18
  import './index.less';
8
19
 
9
20
  export const WelcomeComponent = forwardRef(function WelcomeComponent() {
21
+ const instance = useInject<WelcomeView>(ViewInstance);
22
+ const layoutService = useInject(LayoutService);
23
+ const serverConnection = useInject(ServerConnection);
10
24
  return (
11
25
  <div className="libro-lab-welcome-page">
12
26
  <div className="libro-lab-welcome-page-title">欢迎使用 Notebook 工作台 🎉🎉</div>
13
- <div className="libro-lab-welcome-page-title-tip">
14
- 👋 你好,服务正在加载中,请稍后开启你的研发之旅吧~
27
+ <div className="libro-lab-welcome-page-server-info">
28
+ <div className="libro-lab-welcome-page-server-info-title">服务连接信息</div>
29
+ <div className="libro-lab-welcome-page-server-info-item">
30
+ BaseURL: {`${serverConnection.settings.baseUrl}`}
31
+ </div>
32
+ <div className="libro-lab-welcome-page-server-info-item">
33
+ WsURL: {`${serverConnection.settings.wsUrl}`}
34
+ </div>
15
35
  </div>
36
+ {layoutService.serverSatus === 'success' && (
37
+ <ViewRender view={instance.entryPointView}></ViewRender>
38
+ )}
16
39
  </div>
17
40
  );
18
41
  });
@@ -21,10 +44,20 @@ export const WelcomeComponent = forwardRef(function WelcomeComponent() {
21
44
  @view('welcome-view')
22
45
  export class WelcomeView extends BaseView {
23
46
  override view = WelcomeComponent;
24
-
25
- constructor() {
47
+ viewManager: ViewManager;
48
+ entryPointView: EntryPointView;
49
+ constructor(@inject(ViewManager) viewManager: ViewManager) {
26
50
  super();
27
- this.title.icon = <WelcomeIcon />;
51
+ this.title.icon = '🙌 ';
28
52
  this.title.label = '欢迎使用';
53
+ this.title.closable = false;
54
+ this.viewManager = viewManager;
55
+ this.viewManager
56
+ .getOrCreateView(EntryPointView)
57
+ .then((entryPointView) => {
58
+ this.entryPointView = entryPointView;
59
+ return;
60
+ })
61
+ .catch(console.error);
29
62
  }
30
63
  }
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { jsxs as _jsxs } from "react/jsx-runtime";
3
- export function Logo(props) {
4
- var _props$className = props.className,
5
- className = _props$className === void 0 ? '' : _props$className;
6
- return /*#__PURE__*/_jsx("svg", {
7
- viewBox: "0 0 154 116",
8
- className: className,
9
- version: "1.1",
10
- xmlns: "http://www.w3.org/2000/svg",
11
- xmlnsXlink: "http://www.w3.org/1999/xlink",
12
- children: /*#__PURE__*/_jsx("g", {
13
- id: "\u9875\u9762-1",
14
- stroke: "none",
15
- strokeWidth: "1",
16
- fill: "none",
17
- fillRule: "evenodd",
18
- children: /*#__PURE__*/_jsx("g", {
19
- id: "\u753B\u677F\u5907\u4EFD-6",
20
- transform: "translate(-119.000000, -152.000000)",
21
- children: /*#__PURE__*/_jsxs("g", {
22
- id: "Libro-logo",
23
- transform: "translate(119.000000, 152.000000)",
24
- children: [/*#__PURE__*/_jsx("path", {
25
- d: "M128.970588,66 C142.793951,66 154,77.1926795 154,90.9995493 C154,104.806419 142.793951,115.999099 128.970588,115.999099 C128.473758,115.999099 127.980309,115.98464 127.49064,115.956121 L127.697007,115.999674 L80,115.999099 L93.1090651,98.1074032 L108.158627,77.1069733 C112.649045,70.4093826 120.294268,66 128.970588,66 Z",
26
- id: "\u5F62\u72B6\u7ED3\u5408",
27
- fill: "#155DE2"
28
- }), /*#__PURE__*/_jsx("path", {
29
- d: "M104.481034,0 L147,0 L147,0 L59.3397468,116 L0,116 L78.0248494,13.1382037 C84.3029962,4.8615911 94.0927023,-5.19712172e-15 104.481034,0 Z",
30
- id: "\u77E9\u5F62",
31
- fill: "#155DE2"
32
- }), /*#__PURE__*/_jsx("path", {
33
- d: "M65.667264,51.1430655 C65.667264,84.8453007 91.2203312,112.576275 123.999729,115.999972 L0,115.997535 L75.3014571,17.0042341 C69.1915639,26.9341621 65.667264,38.6268332 65.667264,51.1430655 Z",
34
- id: "\u5F62\u72B6\u7ED3\u5408",
35
- fill: "#12D8C6"
36
- })]
37
- })
38
- })
39
- })
40
- });
41
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-tab-view.d.ts","sourceRoot":"","sources":["../../src/layout/editor-tab-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,WAAW,EAKZ,MAAM,mBAAmB,CAAC;AAK3B,qBAEa,aAAc,SAAQ,WAAW;cACzB,SAAS,CAAC,IAAI,EAAE,IAAI;IAwBvC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI;CAyBhC"}
@@ -1,7 +0,0 @@
1
- export interface IProps {
2
- className?: string;
3
- width?: string;
4
- height?: string;
5
- }
6
- export declare function TocIcon(props: IProps): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=libro-toc-icons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"libro-toc-icons.d.ts","sourceRoot":"","sources":["../../src/toc/libro-toc-icons.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,2CA6BpC"}
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { jsxs as _jsxs } from "react/jsx-runtime";
3
- export function TocIcon(props) {
4
- return /*#__PURE__*/_jsxs("svg", {
5
- width: "12px",
6
- height: "14px",
7
- viewBox: "0 0 12 14",
8
- version: "1.1",
9
- xmlns: "http://www.w3.org/2000/svg",
10
- xmlnsXlink: "http://www.w3.org/1999/xlink",
11
- children: [/*#__PURE__*/_jsx("title", {
12
- children: "source"
13
- }), /*#__PURE__*/_jsx("g", {
14
- id: "\u4EE3\u7801\u7247\u6BB5",
15
- stroke: "none",
16
- strokeWidth: "1",
17
- fill: "none",
18
- fillRule: "evenodd",
19
- children: /*#__PURE__*/_jsx("g", {
20
- id: "1.4\u7F16\u8F91\u72B6\u6001\u5907\u4EFD",
21
- transform: "translate(-14.000000, -215.000000)",
22
- fill: "currentColor",
23
- children: /*#__PURE__*/_jsx("g", {
24
- id: "\u7F16\u7EC4-2",
25
- transform: "translate(0.000000, 56.000000)",
26
- children: /*#__PURE__*/_jsx("g", {
27
- id: "source",
28
- transform: "translate(14.359615, 159.750439)",
29
- children: /*#__PURE__*/_jsx("path", {
30
- d: "M11.3634429,8.03576964 L9.90082151,8.03576964 L9.90082151,5.91521932 C9.90082151,5.85383497 9.85019231,5.80361141 9.78831217,5.80361141 L6.30052278,5.80361141 L6.30052278,4.46431647 L7.81939881,4.46431647 C7.94315907,4.46431647 8.04441748,4.36386935 8.04441748,4.24110065 L8.04441748,0.223215823 C8.04441748,0.100447121 7.94315907,0 7.81939881,0 L3.76906273,0 C3.64530246,0 3.54404406,0.100447121 3.54404406,0.223215823 L3.54404406,4.24110065 C3.54404406,4.36386935 3.64530246,4.46431647 3.76906273,4.46431647 L5.28793876,4.46431647 L5.28793876,5.80361141 L1.80014937,5.80361141 C1.73826923,5.80361141 1.68764003,5.85383497 1.68764003,5.91521932 L1.68764003,8.03576964 L0.225018671,8.03576964 C0.101258402,8.03576964 0,8.13621676 0,8.25898547 L0,12.2768703 C0,12.399639 0.101258402,12.5000861 0.225018671,12.5000861 L4.27535474,12.5000861 C4.39911501,12.5000861 4.50037341,12.399639 4.50037341,12.2768703 L4.50037341,8.25898547 C4.50037341,8.13621676 4.39911501,8.03576964 4.27535474,8.03576964 L2.70022405,8.03576964 L2.70022405,6.80808261 L8.88823749,6.80808261 L8.88823749,8.03576964 L7.3131068,8.03576964 C7.18934653,8.03576964 7.08808813,8.13621676 7.08808813,8.25898547 L7.08808813,12.2768703 C7.08808813,12.399639 7.18934653,12.5000861 7.3131068,12.5000861 L11.3634429,12.5000861 C11.4872031,12.5000861 11.5884615,12.399639 11.5884615,12.2768703 L11.5884615,8.25898547 C11.5884615,8.13621676 11.4872031,8.03576964 11.3634429,8.03576964 Z",
31
- id: "Path"
32
- })
33
- })
34
- })
35
- })
36
- })]
37
- });
38
- }