@difizen/libro-lab 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/common/icon.d.ts +6 -0
- package/es/common/icon.d.ts.map +1 -1
- package/es/common/icon.js +326 -0
- package/es/kernel-and-terminal-panel/collapse/collapse-content.d.ts +11 -0
- package/es/kernel-and-terminal-panel/collapse/collapse-content.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/collapse/collapse-content.js +53 -0
- package/es/kernel-and-terminal-panel/collapse/index.d.ts +31 -0
- package/es/kernel-and-terminal-panel/collapse/index.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/collapse/index.js +103 -0
- package/es/kernel-and-terminal-panel/collapse/index.less +89 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.d.ts +8 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.js +79 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.d.ts +9 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/collapse/kernel-collapse-content.js +13 -0
- package/es/kernel-and-terminal-panel/collapse/page-collapse-content.d.ts +3 -0
- package/es/kernel-and-terminal-panel/collapse/page-collapse-content.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/collapse/page-collapse-content.js +38 -0
- package/es/kernel-and-terminal-panel/index.d.ts +2 -0
- package/es/kernel-and-terminal-panel/index.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/index.js +1 -0
- package/es/kernel-and-terminal-panel/index.less +5 -0
- package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.d.ts +24 -0
- package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/kernel-and-terminal-panel-view.js +320 -0
- package/es/kernel-and-terminal-panel/module.d.ts +3 -0
- package/es/kernel-and-terminal-panel/module.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/module.js +13 -0
- package/es/kernel-and-terminal-panel/panel-command.d.ts +18 -0
- package/es/kernel-and-terminal-panel/panel-command.d.ts.map +1 -0
- package/es/kernel-and-terminal-panel/panel-command.js +80 -0
- package/es/layout/layout-service.d.ts +2 -0
- package/es/layout/layout-service.d.ts.map +1 -1
- package/es/layout/layout-service.js +18 -0
- package/es/layout/main.d.ts.map +1 -1
- package/es/layout/main.js +20 -7
- package/es/module.d.ts.map +1 -1
- package/es/module.js +4 -2
- package/package.json +9 -8
- package/src/common/icon.tsx +298 -0
- package/src/kernel-and-terminal-panel/collapse/collapse-content.tsx +72 -0
- package/src/kernel-and-terminal-panel/collapse/index.less +89 -0
- package/src/kernel-and-terminal-panel/collapse/index.tsx +128 -0
- package/src/kernel-and-terminal-panel/collapse/kernel-collapse-content-item.tsx +87 -0
- package/src/kernel-and-terminal-panel/collapse/kernel-collapse-content.tsx +23 -0
- package/src/kernel-and-terminal-panel/collapse/page-collapse-content.tsx +49 -0
- package/src/kernel-and-terminal-panel/index.less +5 -0
- package/src/kernel-and-terminal-panel/index.ts +1 -0
- package/src/kernel-and-terminal-panel/kernel-and-terminal-panel-view.tsx +218 -0
- package/src/kernel-and-terminal-panel/module.ts +20 -0
- package/src/kernel-and-terminal-panel/panel-command.tsx +57 -0
- package/src/layout/layout-service.ts +17 -0
- package/src/layout/main.tsx +13 -1
- package/src/module.tsx +3 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReloadOutlined } from '@ant-design/icons';
|
|
2
|
+
import type { CommandRegistry, ToolbarRegistry } from '@difizen/mana-app';
|
|
3
|
+
import { ViewManager } from '@difizen/mana-app';
|
|
4
|
+
import {
|
|
5
|
+
CommandContribution,
|
|
6
|
+
inject,
|
|
7
|
+
MenuContribution,
|
|
8
|
+
singleton,
|
|
9
|
+
ToolbarContribution,
|
|
10
|
+
} from '@difizen/mana-app';
|
|
11
|
+
|
|
12
|
+
import { KernelAndTerminalPanelView } from './kernel-and-terminal-panel-view.js';
|
|
13
|
+
|
|
14
|
+
export const PanelCommand = {
|
|
15
|
+
REFRESH: {
|
|
16
|
+
id: 'panel.command.refresh',
|
|
17
|
+
label: '刷新',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
@singleton({
|
|
22
|
+
contrib: [CommandContribution, MenuContribution, ToolbarContribution],
|
|
23
|
+
})
|
|
24
|
+
export class PanelCommandContribution
|
|
25
|
+
implements CommandContribution, ToolbarContribution
|
|
26
|
+
{
|
|
27
|
+
protected viewManager: ViewManager;
|
|
28
|
+
|
|
29
|
+
@inject(KernelAndTerminalPanelView)
|
|
30
|
+
kernelAndTerminalPanelView: KernelAndTerminalPanelView;
|
|
31
|
+
|
|
32
|
+
constructor(@inject(ViewManager) viewManager: ViewManager) {
|
|
33
|
+
this.viewManager = viewManager;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
registerCommands(command: CommandRegistry): void {
|
|
37
|
+
command.registerCommand(PanelCommand.REFRESH, {
|
|
38
|
+
execute: async (view) => {
|
|
39
|
+
if (view instanceof KernelAndTerminalPanelView) {
|
|
40
|
+
this.kernelAndTerminalPanelView.refresh();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
isVisible: (view) => {
|
|
44
|
+
return view instanceof KernelAndTerminalPanelView;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
registerToolbarItems(toolbarRegistry: ToolbarRegistry): void {
|
|
50
|
+
toolbarRegistry.registerItem({
|
|
51
|
+
id: PanelCommand.REFRESH.id,
|
|
52
|
+
command: PanelCommand.REFRESH.id,
|
|
53
|
+
icon: <ReloadOutlined />,
|
|
54
|
+
tooltip: '刷新',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LibroNavigatableView, LibroService } from '@difizen/libro-jupyter';
|
|
2
2
|
import type { View, ViewOpenHandlerOptions, ViewOpenOption } from '@difizen/mana-app';
|
|
3
|
+
import { SideTabView } from '@difizen/mana-app';
|
|
3
4
|
import { observable } from '@difizen/mana-app';
|
|
4
5
|
import {
|
|
5
6
|
DefaultSlotView,
|
|
@@ -32,6 +33,7 @@ export class LayoutService {
|
|
|
32
33
|
|
|
33
34
|
@prop()
|
|
34
35
|
serverSatus: StatusType = 'loading';
|
|
36
|
+
|
|
35
37
|
@prop()
|
|
36
38
|
visibilityMap: VisibilityMap = {
|
|
37
39
|
[LibroLabLayoutSlots.header]: true,
|
|
@@ -76,6 +78,10 @@ export class LayoutService {
|
|
|
76
78
|
await this.slotViewManager.addView(view, slot, viewOpenOption);
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
getAllSlotView(slot: LibroLabLayoutSlotsType) {
|
|
82
|
+
return this.slotViewManager.getSlotView(slot);
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
getActiveView(slot: LibroLabLayoutSlotsType) {
|
|
80
86
|
if (this.isAreaVisible(slot)) {
|
|
81
87
|
const slotView = this.slotViewManager.getSlotView(slot);
|
|
@@ -96,6 +102,17 @@ export class LayoutService {
|
|
|
96
102
|
return undefined;
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
shouldRenderNavigatorContent(): boolean {
|
|
106
|
+
if (!this.visibilityMap[LibroLabLayoutSlots.navigator]) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
const slotView = this.slotViewManager.getSlotView(LibroLabLayoutSlots.navigator);
|
|
110
|
+
if (slotView instanceof SideTabView) {
|
|
111
|
+
return !!slotView.showTabContent;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
async onOpenSlotActiveChange() {
|
|
100
117
|
if (this.isAreaVisible(LibroLabLayoutSlots.content)) {
|
|
101
118
|
const slotView = await this.slotViewManager.getOrCreateSlotView(
|
package/src/layout/main.tsx
CHANGED
|
@@ -10,6 +10,18 @@ import { LibroLabLayoutSlots } from './protocol.js';
|
|
|
10
10
|
export const LibroLabLayoutMainComponent = forwardRef(
|
|
11
11
|
function LibroLabLayoutMainComponent() {
|
|
12
12
|
const layoutService = useInject(LayoutService);
|
|
13
|
+
const navigatorSize = layoutService.shouldRenderNavigatorContent()
|
|
14
|
+
? {
|
|
15
|
+
minSize: 40,
|
|
16
|
+
defaultSize: 300,
|
|
17
|
+
maxSize: undefined,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
minSize: 40,
|
|
21
|
+
defaultSize: 40,
|
|
22
|
+
maxSize: 40,
|
|
23
|
+
noResize: true,
|
|
24
|
+
};
|
|
13
25
|
|
|
14
26
|
return (
|
|
15
27
|
<SplitPanel id="libro-lab-content-layout">
|
|
@@ -17,7 +29,7 @@ export const LibroLabLayoutMainComponent = forwardRef(
|
|
|
17
29
|
<SplitPanel.Pane
|
|
18
30
|
id="libro-lab-content-layout-left"
|
|
19
31
|
className="libro-lab-content-layout-left"
|
|
20
|
-
|
|
32
|
+
{...navigatorSize}
|
|
21
33
|
>
|
|
22
34
|
<Slot name={LibroLabLayoutSlots.navigator} />
|
|
23
35
|
</SplitPanel.Pane>
|
package/src/module.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { CodeEditorViewerModule } from './editor-viewer/index.js';
|
|
|
15
15
|
import { GithubLinkView } from './github-link/index.js';
|
|
16
16
|
import { ImageViewerModule } from './image-viewer/index.js';
|
|
17
17
|
// import { KernelManagerView } from './kernel-manager/index.js';
|
|
18
|
+
import { LibroKernelAndTerminalPanelModule } from './kernel-and-terminal-panel/module.js';
|
|
18
19
|
import { LibroLabApp } from './lab-app.js';
|
|
19
20
|
import { ContentBottomTabView } from './layout/content-bottom-tab-view.js';
|
|
20
21
|
import {
|
|
@@ -71,6 +72,7 @@ export const LibroLabModule = ManaModule.create()
|
|
|
71
72
|
slot: LibroLabLayoutSlots.navigator,
|
|
72
73
|
options: {
|
|
73
74
|
sort: true,
|
|
75
|
+
contentToggable: true,
|
|
74
76
|
},
|
|
75
77
|
}),
|
|
76
78
|
createViewPreference({
|
|
@@ -99,6 +101,7 @@ export const LibroLabModule = ManaModule.create()
|
|
|
99
101
|
LibroLabLayoutModule,
|
|
100
102
|
LibroLabHeaderMenuModule,
|
|
101
103
|
LibroLabTocModule,
|
|
104
|
+
LibroKernelAndTerminalPanelModule,
|
|
102
105
|
LibroPromptCellModule,
|
|
103
106
|
TerminalModule,
|
|
104
107
|
ImageViewerModule,
|