@difizen/libro-core 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.
- package/es/add-cell/index.less +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -2
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.js +12 -6
- package/es/add-cell/libro-add-cell-view.d.ts +4 -4
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-view.js +4 -6
- package/es/cell/libro-cell-contribution.d.ts +1 -2
- package/es/cell/libro-cell-contribution.d.ts.map +1 -1
- package/es/cell/libro-cell-contribution.js +14 -8
- package/es/cell/libro-cell-model.d.ts +9 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -1
- package/es/cell/libro-cell-model.js +53 -11
- package/es/cell/libro-cell-protocol.d.ts +2 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -1
- package/es/cell/libro-cell-view.d.ts +39 -3
- package/es/cell/libro-cell-view.d.ts.map +1 -1
- package/es/cell/libro-cell-view.js +54 -24
- package/es/cell/libro-edit-cell-view.d.ts +6 -12
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
- package/es/cell/libro-edit-cell-view.js +9 -4
- package/es/cell/libro-executable-cell-view.d.ts +2 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -1
- package/es/cell/libro-executable-cell-view.js +4 -1
- package/es/collapse-service.d.ts +1 -1
- package/es/collapse-service.d.ts.map +1 -1
- package/es/collapse-service.js +1 -1
- package/es/command/document-commands.d.ts +5 -0
- package/es/command/document-commands.d.ts.map +1 -0
- package/es/command/document-commands.js +3 -2
- package/es/command/kernel-command.d.ts +5 -0
- package/es/command/kernel-command.d.ts.map +1 -0
- package/es/command/kernel-command.js +3 -0
- package/es/command/libro-command-contribution.d.ts +0 -1
- package/es/command/libro-command-contribution.d.ts.map +1 -1
- package/es/command/libro-command-contribution.js +179 -129
- package/es/command/libro-command-register.d.ts +0 -1
- package/es/command/libro-command-register.d.ts.map +1 -1
- package/es/command/libro-command-register.js +13 -7
- package/es/command/notebook-commands.d.ts +6 -0
- package/es/command/notebook-commands.d.ts.map +1 -0
- package/es/command/notebook-commands.js +17 -4
- package/es/components/cell-protocol.d.ts +5 -5
- package/es/components/cell-protocol.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.d.ts +6 -2
- package/es/components/dnd-cell-item-render.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.js +194 -89
- package/es/components/dnd-component/custom-drag-layer.d.ts +1 -1
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -1
- package/es/components/dnd-component/custom-drag-layer.js +3 -4
- package/es/components/dnd-component/default-dnd-content.d.ts +2 -1
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
- package/es/components/dnd-component/default-dnd-content.js +100 -44
- package/es/components/dnd-component/dnd-context.js +1 -1
- package/es/components/dnd-component/dnd-list.d.ts +9 -5
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
- package/es/components/dnd-component/dnd-list.js +93 -26
- package/es/components/dnd-component/index.d.ts +1 -1
- package/es/components/dnd-component/index.d.ts.map +1 -1
- package/es/components/dnd-component/index.js +2 -2
- package/es/components/dnd-component/index.less +8 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts +22 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts.map +1 -0
- package/es/components/dnd-component/overscanIndices-getter.js +58 -0
- package/es/components/dnd-component/virtualized-manager.d.ts +19 -0
- package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -0
- package/es/components/dnd-component/virtualized-manager.js +60 -0
- package/es/components/index.d.ts +2 -2
- package/es/components/index.d.ts.map +1 -1
- package/es/components/index.js +2 -2
- package/es/components/libro-virtualized-render.d.ts +15 -0
- package/es/components/libro-virtualized-render.d.ts.map +1 -0
- package/es/components/libro-virtualized-render.js +174 -0
- package/es/content/index.d.ts +1 -0
- package/es/content/index.d.ts.map +1 -1
- package/es/content/index.js +2 -1
- package/es/content/libro-content-contribution.d.ts +2 -2
- package/es/content/libro-content-contribution.d.ts.map +1 -1
- package/es/content/libro-content-contribution.js +2 -3
- package/es/content/libro-content-module.d.ts.map +1 -1
- package/es/content/libro-content-module.js +3 -2
- package/es/content/libro-content-protocol.d.ts +5 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -1
- package/es/content/libro-content-protocol.js +2 -1
- package/es/content/libro-content-service.d.ts +6 -4
- package/es/content/libro-content-service.d.ts.map +1 -1
- package/es/content/libro-content-service.js +36 -8
- package/es/content/libro-save-content-contribution.d.ts +6 -0
- package/es/content/libro-save-content-contribution.d.ts.map +1 -0
- package/es/content/libro-save-content-contribution.js +27 -0
- package/es/formatter/index.d.ts +6 -0
- package/es/formatter/index.d.ts.map +1 -0
- package/es/formatter/index.js +5 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-json-contribution.js +41 -0
- package/es/formatter/libro-formatter-manager.d.ts +16 -0
- package/es/formatter/libro-formatter-manager.d.ts.map +1 -0
- package/es/formatter/libro-formatter-manager.js +86 -0
- package/es/formatter/libro-formatter-module.d.ts +3 -0
- package/es/formatter/libro-formatter-module.d.ts.map +1 -0
- package/es/formatter/libro-formatter-module.js +7 -0
- package/es/formatter/libro-formatter-protocol.d.ts +37 -0
- package/es/formatter/libro-formatter-protocol.d.ts.map +1 -0
- package/es/formatter/libro-formatter-protocol.js +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-string-contribution.js +41 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts +7 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-trans-default-contribution.js +19 -0
- package/es/index.d.ts +5 -1
- package/es/index.d.ts.map +1 -1
- package/es/index.js +6 -2
- package/es/index.less +135 -58
- package/es/libro-context-key.d.ts.map +1 -1
- package/es/libro-keybind-registry.d.ts +5 -0
- package/es/libro-keybind-registry.d.ts.map +1 -0
- package/es/libro-model.d.ts +13 -2
- package/es/libro-model.d.ts.map +1 -1
- package/es/libro-model.js +149 -70
- package/es/libro-protocol.d.ts +44 -2
- package/es/libro-protocol.d.ts.map +1 -1
- package/es/libro-protocol.js +16 -3
- package/es/libro-service.d.ts +1 -1
- package/es/libro-service.d.ts.map +1 -1
- package/es/libro-service.js +29 -20
- package/es/libro-setting-contribution.d.ts +5 -0
- package/es/libro-setting-contribution.d.ts.map +1 -0
- package/es/{configuration/libro-configuration-contribution.js → libro-setting-contribution.js} +8 -9
- package/es/libro-setting.d.ts +11 -0
- package/es/libro-setting.d.ts.map +1 -0
- package/es/{configuration/libro-configuration.js → libro-setting.js} +17 -7
- package/es/libro-view.d.ts +21 -8
- package/es/libro-view.d.ts.map +1 -1
- package/es/libro-view.js +477 -338
- package/es/material-from-designer.d.ts +30 -0
- package/es/material-from-designer.d.ts.map +1 -0
- package/es/material-from-designer.js +112 -1
- package/es/module.d.ts.map +1 -1
- package/es/module.js +20 -5
- package/es/output/output-area.d.ts +3 -4
- package/es/output/output-area.d.ts.map +1 -1
- package/es/output/output-area.js +23 -16
- package/es/output/output-contribution.d.ts +0 -1
- package/es/output/output-contribution.d.ts.map +1 -1
- package/es/output/output-contribution.js +14 -9
- package/es/output/output-model.d.ts +2 -2
- package/es/output/output-model.d.ts.map +1 -1
- package/es/output/output-model.js +2 -2
- package/es/output/output-protocol.d.ts.map +1 -1
- package/es/output/output-protocol.js +0 -2
- package/es/settings/index.d.ts +5 -0
- package/es/settings/index.d.ts.map +1 -0
- package/es/settings/index.js +4 -0
- package/es/settings/index.less +3 -0
- package/es/settings/module.d.ts +3 -0
- package/es/settings/module.d.ts.map +1 -0
- package/es/settings/module.js +4 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts +13 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-panel-view.js +115 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts +6 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-render-contribution.js +77 -0
- package/es/settings/setting-editor/default-node-render.d.ts +9 -0
- package/es/settings/setting-editor/default-node-render.d.ts.map +1 -0
- package/es/settings/setting-editor/default-node-render.js +79 -0
- package/es/settings/setting-editor/index.d.ts +7 -0
- package/es/settings/setting-editor/index.d.ts.map +1 -0
- package/es/settings/setting-editor/index.js +6 -0
- package/es/settings/setting-editor/index.less +12 -0
- package/es/settings/setting-editor/module.d.ts +3 -0
- package/es/settings/setting-editor/module.d.ts.map +1 -0
- package/es/settings/setting-editor/module.js +7 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts +15 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-editor-view.js +169 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts +9 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-service.js +118 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts +19 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-view.js +88 -0
- package/es/settings/settings-contribution.d.ts +7 -0
- package/es/settings/settings-contribution.d.ts.map +1 -0
- package/es/settings/settings-contribution.js +36 -0
- package/es/settings/settings-modal.d.ts +5 -0
- package/es/settings/settings-modal.d.ts.map +1 -0
- package/es/settings/settings-modal.js +53 -0
- package/es/settings/settings-modal.less +3 -0
- package/es/settings/settings-protocol.d.ts +4 -0
- package/es/settings/settings-protocol.d.ts.map +1 -0
- package/es/settings/settings-protocol.js +5 -0
- package/es/slot/libro-slot-manager.d.ts +2 -2
- package/es/slot/libro-slot-manager.d.ts.map +1 -1
- package/es/slot/libro-slot-manager.js +14 -8
- package/es/slot/libro-slot-view.d.ts +3 -3
- package/es/slot/libro-slot-view.d.ts.map +1 -1
- package/es/slot/libro-slot-view.js +2 -2
- package/es/theme/libro-color-registry.d.ts +6 -0
- package/es/theme/libro-color-registry.d.ts.map +1 -0
- package/es/theme/libro-color-registry.js +7 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts +3 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts.map +1 -0
- package/es/toolbar/all-outputs-scroll-icon.js +10 -0
- package/es/toolbar/libro-toolbar.d.ts +2 -1
- package/es/toolbar/libro-toolbar.d.ts.map +1 -1
- package/es/toolbar/libro-toolbar.js +44 -8
- package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -2
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
- package/es/toolbar/restart-clear-outputs-modal.js +2 -2
- package/es/toolbar/shutdown-modal.d.ts +1 -2
- package/es/toolbar/shutdown-modal.d.ts.map +1 -1
- package/es/toolbar/shutdown-modal.js +2 -2
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -1
- package/es/toolbar/side-toolar-more-select.js +2 -2
- package/es/virtualized-manager-helper.d.ts +11 -0
- package/es/virtualized-manager-helper.d.ts.map +1 -0
- package/es/virtualized-manager-helper.js +51 -0
- package/es/virtualized-manager.d.ts +19 -0
- package/es/virtualized-manager.d.ts.map +1 -0
- package/es/virtualized-manager.js +61 -0
- package/package.json +9 -6
- package/src/add-cell/index.less +1 -1
- package/src/add-cell/libro-add-cell-slot-contribution.ts +1 -4
- package/src/add-cell/libro-add-cell-view.tsx +13 -6
- package/src/cell/libro-cell-contribution.ts +2 -6
- package/src/cell/libro-cell-model.ts +57 -4
- package/src/cell/libro-cell-protocol.ts +2 -0
- package/src/cell/libro-cell-view.tsx +21 -9
- package/src/cell/libro-edit-cell-view.tsx +10 -9
- package/src/cell/libro-executable-cell-view.ts +6 -1
- package/src/collapse-service.ts +1 -1
- package/src/command/document-commands.ts +3 -5
- package/src/command/kernel-command.ts +3 -0
- package/src/command/libro-command-contribution.ts +107 -91
- package/src/command/libro-command-register.ts +1 -4
- package/src/command/notebook-commands.ts +16 -3
- package/src/components/cell-protocol.ts +5 -5
- package/src/components/dnd-cell-item-render.tsx +239 -92
- package/src/components/dnd-component/custom-drag-layer.tsx +5 -6
- package/src/components/dnd-component/default-dnd-content.tsx +113 -42
- package/src/components/dnd-component/dnd-context.tsx +1 -1
- package/src/components/dnd-component/dnd-list.tsx +135 -43
- package/src/components/dnd-component/index.less +8 -0
- package/src/components/dnd-component/index.tsx +1 -1
- package/src/components/dnd-component/overscanIndices-getter.ts +92 -0
- package/src/components/dnd-component/virtualized-manager.ts +34 -0
- package/src/components/index.ts +2 -2
- package/src/components/libro-virtualized-render.tsx +178 -0
- package/src/content/index.ts +1 -0
- package/src/content/libro-content-contribution.ts +2 -3
- package/src/content/libro-content-module.ts +11 -3
- package/src/content/libro-content-protocol.ts +6 -0
- package/src/content/libro-content-service.ts +26 -8
- package/src/content/libro-save-content-contribution.ts +12 -0
- package/src/formatter/index.ts +5 -0
- package/src/formatter/libro-formatter-json-contribution.ts +42 -0
- package/src/formatter/libro-formatter-manager.ts +85 -0
- package/src/formatter/libro-formatter-module.ts +19 -0
- package/src/formatter/libro-formatter-protocol.ts +63 -0
- package/src/formatter/libro-formatter-string-contribution.ts +41 -0
- package/src/formatter/libro-formatter-trans-default-contribution.ts +15 -0
- package/src/index.less +135 -58
- package/src/index.tsx +6 -1
- package/src/libro-context-key.ts +3 -3
- package/src/libro-model.ts +87 -23
- package/src/libro-protocol.ts +81 -4
- package/src/libro-service.ts +4 -13
- package/src/{configuration/libro-configuration-contribution.ts → libro-setting-contribution.ts} +7 -8
- package/src/{configuration/libro-configuration.ts → libro-setting.ts} +18 -7
- package/src/libro-view.tsx +273 -141
- package/src/material-from-designer.tsx +93 -1
- package/src/module.ts +29 -7
- package/src/output/output-area.tsx +18 -12
- package/src/output/output-contribution.ts +2 -6
- package/src/output/output-model.tsx +3 -3
- package/src/output/output-protocol.ts +0 -1
- package/src/settings/index.less +3 -0
- package/src/settings/index.ts +4 -0
- package/src/settings/module.ts +8 -0
- package/src/settings/setting-editor/configuration-panel-view.tsx +89 -0
- package/src/settings/setting-editor/configuration-render-contribution.ts +81 -0
- package/src/settings/setting-editor/default-node-render.tsx +65 -0
- package/src/settings/setting-editor/index.less +12 -0
- package/src/settings/setting-editor/index.ts +6 -0
- package/src/settings/setting-editor/module.ts +17 -0
- package/src/settings/setting-editor/setting-editor-view.tsx +93 -0
- package/src/settings/setting-editor/setting-tree-service.ts +82 -0
- package/src/settings/setting-editor/setting-tree-view.tsx +95 -0
- package/src/settings/settings-contribution.tsx +24 -0
- package/src/settings/settings-modal.less +3 -0
- package/src/settings/settings-modal.tsx +50 -0
- package/src/settings/settings-protocol.ts +7 -0
- package/src/slot/libro-slot-manager.ts +1 -3
- package/src/slot/libro-slot-view.tsx +2 -5
- package/src/theme/libro-color-registry.ts +6 -0
- package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
- package/src/toolbar/libro-toolbar.tsx +30 -5
- package/src/toolbar/restart-clear-outputs-modal.tsx +3 -3
- package/src/toolbar/shutdown-modal.tsx +3 -3
- package/src/toolbar/side-toolar-more-select.tsx +2 -1
- package/src/virtualized-manager-helper.ts +29 -0
- package/src/virtualized-manager.ts +34 -0
package/src/libro-protocol.ts
CHANGED
|
@@ -8,11 +8,12 @@ import type {
|
|
|
8
8
|
INotebookMetadata,
|
|
9
9
|
} from '@difizen/libro-common';
|
|
10
10
|
import type { ISharedNotebook } from '@difizen/libro-shared-model';
|
|
11
|
-
import { View } from '@difizen/mana-app';
|
|
12
11
|
import type { Disposable, Event } from '@difizen/mana-app';
|
|
12
|
+
import type { View } from '@difizen/mana-app';
|
|
13
13
|
|
|
14
14
|
import type { LibroCell } from './cell/index.js';
|
|
15
15
|
import type { LibroView } from './libro-view.js';
|
|
16
|
+
import type { VirtualizedManager } from './virtualized-manager.js';
|
|
16
17
|
|
|
17
18
|
export const LibroContextKeys = {
|
|
18
19
|
active: 'active',
|
|
@@ -38,16 +39,30 @@ export interface NotebookOption extends Options {
|
|
|
38
39
|
[key: string]: any;
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
export const PerformaceStatisticOption = Symbol('PerformaceStatisticOption');
|
|
43
|
+
export type PerformaceStatisticOption = Options;
|
|
44
|
+
|
|
41
45
|
export const ModelFactory = Symbol('ModelFactory');
|
|
42
46
|
export type ModelFactory<T = NotebookOption> = (options: T) => NotebookModel;
|
|
43
47
|
|
|
44
48
|
export const NotebookModel = Symbol('NotebookModel');
|
|
45
49
|
|
|
50
|
+
export enum EditorStatus {
|
|
51
|
+
NOTLOADED = 'not loaded',
|
|
52
|
+
LOADING = 'loading',
|
|
53
|
+
LOADED = 'loaded',
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
export type Options = {
|
|
47
57
|
id?: string;
|
|
48
58
|
[key: string]: any;
|
|
49
59
|
};
|
|
50
60
|
|
|
61
|
+
export interface ScrollParams {
|
|
62
|
+
cellIndex: number;
|
|
63
|
+
lineIndex?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
export type NotebookModel = BaseNotebookModel & DndListModel;
|
|
52
67
|
export interface BaseNotebookModel {
|
|
53
68
|
id: string;
|
|
@@ -85,6 +100,10 @@ export interface BaseNotebookModel {
|
|
|
85
100
|
|
|
86
101
|
onContentChanged: Event<boolean>;
|
|
87
102
|
|
|
103
|
+
onSourceChanged: Event<boolean>;
|
|
104
|
+
|
|
105
|
+
onCellViewChanged: Event<CellViewChange>;
|
|
106
|
+
|
|
88
107
|
getCells: () => CellView[];
|
|
89
108
|
|
|
90
109
|
/**
|
|
@@ -154,6 +173,8 @@ export interface BaseNotebookModel {
|
|
|
154
173
|
|
|
155
174
|
onChange?: () => void;
|
|
156
175
|
|
|
176
|
+
onSourceChange?: () => void;
|
|
177
|
+
|
|
157
178
|
interrupt?: () => void;
|
|
158
179
|
|
|
159
180
|
canRun?: () => boolean;
|
|
@@ -175,6 +196,12 @@ export interface BaseNotebookModel {
|
|
|
175
196
|
setCustomKey: (key: string, val: any) => void;
|
|
176
197
|
|
|
177
198
|
libroViewClass: string;
|
|
199
|
+
|
|
200
|
+
onScrollToCellView: Event<ScrollParams>;
|
|
201
|
+
|
|
202
|
+
scrollToCellView: (params: ScrollParams) => void;
|
|
203
|
+
|
|
204
|
+
disposeScrollToCellViewEmitter: () => void;
|
|
178
205
|
}
|
|
179
206
|
|
|
180
207
|
export const notebookViewFactoryId = 'notebook-view-factory';
|
|
@@ -207,9 +234,38 @@ export interface CellView extends View {
|
|
|
207
234
|
toJSON: () => ICell;
|
|
208
235
|
|
|
209
236
|
toJSONWithoutId: () => ICell;
|
|
237
|
+
|
|
238
|
+
editorAreaHeight?: number;
|
|
239
|
+
|
|
240
|
+
cellViewTopPos?: number;
|
|
241
|
+
|
|
242
|
+
noEditorAreaHeight: number;
|
|
243
|
+
|
|
244
|
+
editorStatus?: EditorStatus;
|
|
245
|
+
|
|
246
|
+
calcEditorAreaHeight?: () => number;
|
|
247
|
+
|
|
248
|
+
calcEditorOffset?: () => number;
|
|
249
|
+
|
|
250
|
+
renderEditorIntoVirtualized?: boolean;
|
|
251
|
+
}
|
|
252
|
+
function isView(data: object): data is View {
|
|
253
|
+
return (
|
|
254
|
+
!!data &&
|
|
255
|
+
typeof data === 'object' &&
|
|
256
|
+
'id' in data &&
|
|
257
|
+
'view' in data &&
|
|
258
|
+
typeof data['view'] === 'function'
|
|
259
|
+
);
|
|
210
260
|
}
|
|
211
261
|
export function isCellView(view: View): view is CellView {
|
|
212
|
-
return
|
|
262
|
+
return (
|
|
263
|
+
isView(view) &&
|
|
264
|
+
'model' in view &&
|
|
265
|
+
'parent' in view &&
|
|
266
|
+
'run' in view &&
|
|
267
|
+
'toJSON' in view
|
|
268
|
+
);
|
|
213
269
|
}
|
|
214
270
|
|
|
215
271
|
export const CellOptions = Symbol('CellOptions');
|
|
@@ -232,12 +288,19 @@ export interface CellViewOptions {
|
|
|
232
288
|
[key: string]: any;
|
|
233
289
|
}
|
|
234
290
|
|
|
291
|
+
export interface CellViewChange {
|
|
292
|
+
insert?: { cells: CellView[]; index: number };
|
|
293
|
+
delete?: { index: number; number: number };
|
|
294
|
+
}
|
|
295
|
+
|
|
235
296
|
export interface CellModel extends IModel, Disposable {
|
|
236
297
|
/**
|
|
237
298
|
* A unique identifier for the cell.
|
|
238
299
|
*/
|
|
239
300
|
id: string;
|
|
240
301
|
|
|
302
|
+
source: string;
|
|
303
|
+
|
|
241
304
|
/**
|
|
242
305
|
* The type of the cell.
|
|
243
306
|
*/
|
|
@@ -268,8 +331,8 @@ export interface CellModel extends IModel, Disposable {
|
|
|
268
331
|
* 输出时的字段顺序也要保持稳定
|
|
269
332
|
*/
|
|
270
333
|
toJSON: () => Omit<ICell, 'outputs'>;
|
|
271
|
-
options: CellOptions;
|
|
272
334
|
|
|
335
|
+
options: CellOptions;
|
|
273
336
|
// run: () => Promise<boolean>;
|
|
274
337
|
}
|
|
275
338
|
|
|
@@ -286,11 +349,12 @@ export interface NotebookService {
|
|
|
286
349
|
export const DragAreaKey = Symbol('DragAreaKey');
|
|
287
350
|
|
|
288
351
|
export type MouseMode = 'multipleSelection' | 'mouseDown' | 'drag';
|
|
352
|
+
|
|
289
353
|
export interface DndListModel {
|
|
290
354
|
mouseMode?: MouseMode;
|
|
291
355
|
active?: CellView | undefined;
|
|
292
356
|
hover?: CellView | undefined;
|
|
293
|
-
selectCell: (cell
|
|
357
|
+
selectCell: (cell?: CellView) => void;
|
|
294
358
|
addCell: (cell: CellView, position?: number, mode?: string) => void;
|
|
295
359
|
insertCells: (cells: CellView[], position?: number, mode?: string) => void;
|
|
296
360
|
invertCell: (toAddcell: CellView, position: number) => void;
|
|
@@ -320,3 +384,16 @@ export interface DndItemProps {
|
|
|
320
384
|
isMouseOverDragArea?: boolean;
|
|
321
385
|
}
|
|
322
386
|
//#endregion
|
|
387
|
+
|
|
388
|
+
export interface VirtualizedManagerOption {
|
|
389
|
+
libroModel: NotebookModel;
|
|
390
|
+
}
|
|
391
|
+
export const VirtualizedManagerOption = Symbol('VirtualizedManagerOption');
|
|
392
|
+
|
|
393
|
+
export const VirtualizedManagerOptionFactory = Symbol(
|
|
394
|
+
'VirtualizedManagerOptionFactory',
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
export type VirtualizedManagerOptionFactory = (
|
|
398
|
+
meta: VirtualizedManagerOption,
|
|
399
|
+
) => VirtualizedManager;
|
package/src/libro-service.ts
CHANGED
|
@@ -13,27 +13,18 @@ import { LibroViewTracker } from './libro-view-tracker.js';
|
|
|
13
13
|
|
|
14
14
|
@singleton({ contrib: NotebookService })
|
|
15
15
|
export class LibroService implements NotebookService {
|
|
16
|
-
protected libroModelFactory: ModelFactory;
|
|
17
|
-
protected viewManager: ViewManager;
|
|
18
|
-
protected libroViewTracker: LibroViewTracker;
|
|
19
|
-
|
|
16
|
+
@inject(ModelFactory) protected libroModelFactory: ModelFactory;
|
|
17
|
+
@inject(ViewManager) protected viewManager: ViewManager;
|
|
18
|
+
@inject(LibroViewTracker) protected libroViewTracker: LibroViewTracker;
|
|
20
19
|
protected themeService: ThemeService;
|
|
21
20
|
@prop()
|
|
22
21
|
themeMode: string;
|
|
23
|
-
constructor(
|
|
24
|
-
@inject(ThemeService) themeService: ThemeService,
|
|
25
|
-
@inject(ModelFactory) libroModelFactory: ModelFactory,
|
|
26
|
-
@inject(ViewManager) viewManager: ViewManager,
|
|
27
|
-
@inject(LibroViewTracker) libroViewTracker: LibroViewTracker,
|
|
28
|
-
) {
|
|
22
|
+
constructor(@inject(ThemeService) themeService: ThemeService) {
|
|
29
23
|
this.themeService = themeService;
|
|
30
24
|
this.themeMode = this.themeService.getCurrentTheme().type;
|
|
31
25
|
this.themeService.onDidColorThemeChange((e) => {
|
|
32
26
|
this.themeMode = e.newTheme.type;
|
|
33
27
|
});
|
|
34
|
-
this.libroModelFactory = libroModelFactory;
|
|
35
|
-
this.viewManager = viewManager;
|
|
36
|
-
this.libroViewTracker = libroViewTracker;
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
@prop() protected _active?: NotebookView;
|
package/src/{configuration/libro-configuration-contribution.ts → libro-setting-contribution.ts}
RENAMED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { ConfigurationContribution } from '@difizen/mana-app';
|
|
2
|
-
import { singleton } from '@difizen/mana-app';
|
|
1
|
+
import { singleton, ConfigurationContribution } from '@difizen/mana-app';
|
|
3
2
|
|
|
4
3
|
import {
|
|
4
|
+
AutoInsertWhenNoCell,
|
|
5
5
|
CellSideToolbarVisible,
|
|
6
6
|
CellTopToolbarSetting,
|
|
7
|
-
|
|
8
|
-
AutoInsertWhenNoCell,
|
|
7
|
+
CollapserClickActive,
|
|
9
8
|
EnterEditModeWhenAddCell,
|
|
10
|
-
|
|
9
|
+
HeaderToolbarVisible,
|
|
11
10
|
MultiSelectionWhenShiftClick,
|
|
12
11
|
RightContentFixed,
|
|
13
|
-
} from './libro-
|
|
12
|
+
} from './libro-setting.js';
|
|
14
13
|
|
|
15
14
|
@singleton({ contrib: ConfigurationContribution })
|
|
16
|
-
export class
|
|
15
|
+
export class LibroSettingContribution implements ConfigurationContribution {
|
|
17
16
|
registerConfigurations() {
|
|
18
17
|
return [
|
|
19
18
|
HeaderToolbarVisible,
|
|
@@ -21,7 +20,7 @@ export class LibroConfigurationContribution implements ConfigurationContribution
|
|
|
21
20
|
CellSideToolbarVisible,
|
|
22
21
|
AutoInsertWhenNoCell,
|
|
23
22
|
EnterEditModeWhenAddCell,
|
|
24
|
-
|
|
23
|
+
CollapserClickActive,
|
|
25
24
|
MultiSelectionWhenShiftClick,
|
|
26
25
|
RightContentFixed,
|
|
27
26
|
];
|
|
@@ -13,7 +13,7 @@ export const HeaderToolbarVisible: ConfigurationNode<boolean> = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const CellTopToolbarSetting: ConfigurationNode<boolean> = {
|
|
16
|
-
id: 'libro.cell.
|
|
16
|
+
id: 'libro.cell.toptoolbar',
|
|
17
17
|
description: l10n.t('是否显示cell顶部工具栏'),
|
|
18
18
|
title: l10n.t('cell顶部工具栏'),
|
|
19
19
|
type: 'checkbox',
|
|
@@ -24,7 +24,7 @@ export const CellTopToolbarSetting: ConfigurationNode<boolean> = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export const CellSideToolbarVisible: ConfigurationNode<boolean> = {
|
|
27
|
-
id: 'libro.cell.
|
|
27
|
+
id: 'libro.cell.sidetoolbar',
|
|
28
28
|
description: l10n.t('是否显示cell侧边工具栏'),
|
|
29
29
|
title: l10n.t('cell侧边工具栏'),
|
|
30
30
|
type: 'checkbox',
|
|
@@ -35,7 +35,7 @@ export const CellSideToolbarVisible: ConfigurationNode<boolean> = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const AutoInsertWhenNoCell: ConfigurationNode<boolean> = {
|
|
38
|
-
id: 'libro.command.
|
|
38
|
+
id: 'libro.command.insertcellbelow',
|
|
39
39
|
description: l10n.t('没有cell时是否默认创建cell'),
|
|
40
40
|
title: l10n.t('默认创建cell'),
|
|
41
41
|
type: 'checkbox',
|
|
@@ -46,7 +46,7 @@ export const AutoInsertWhenNoCell: ConfigurationNode<boolean> = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
export const EnterEditModeWhenAddCell: ConfigurationNode<boolean> = {
|
|
49
|
-
id: 'libro.command.
|
|
49
|
+
id: 'libro.command.entereditmodewhenaddcell',
|
|
50
50
|
description: l10n.t('增加cell操作默认进入编辑态'),
|
|
51
51
|
title: l10n.t('默认进入编辑态'),
|
|
52
52
|
type: 'checkbox',
|
|
@@ -55,8 +55,8 @@ export const EnterEditModeWhenAddCell: ConfigurationNode<boolean> = {
|
|
|
55
55
|
type: 'boolean',
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
|
-
export const
|
|
59
|
-
id: 'libro.command.
|
|
58
|
+
export const CollapserClickActive: ConfigurationNode<boolean> = {
|
|
59
|
+
id: 'libro.command.collapserclickactive',
|
|
60
60
|
description: l10n.t('点击左侧长条是否可以隐藏与显示cell'),
|
|
61
61
|
title: l10n.t('默认点击长条可以隐藏与显示cell'),
|
|
62
62
|
type: 'checkbox',
|
|
@@ -66,7 +66,7 @@ export const CollapserActive: ConfigurationNode<boolean> = {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
export const MultiSelectionWhenShiftClick: ConfigurationNode<boolean> = {
|
|
69
|
-
id: 'libro.command.
|
|
69
|
+
id: 'libro.command.multiselectionwhenshiftclick',
|
|
70
70
|
description: l10n.t('按住shift键并点击拖拽区域可以进行多选'),
|
|
71
71
|
title: l10n.t('默认按住shift键并点击拖拽区域可以进行多选'),
|
|
72
72
|
type: 'checkbox',
|
|
@@ -86,3 +86,14 @@ export const RightContentFixed: ConfigurationNode<boolean> = {
|
|
|
86
86
|
type: 'boolean',
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
|
+
|
|
90
|
+
export const OutputScrollBtnVisiable: ConfigurationNode<boolean> = {
|
|
91
|
+
id: 'libro.cell.output.scroll.button.visiable',
|
|
92
|
+
description: l10n.t('cell输出区域高度固定按钮是否显示'),
|
|
93
|
+
title: l10n.t('cell输出区域高度固定按钮是否显示'),
|
|
94
|
+
type: 'checkbox',
|
|
95
|
+
defaultValue: true,
|
|
96
|
+
schema: {
|
|
97
|
+
type: 'boolean',
|
|
98
|
+
},
|
|
99
|
+
};
|