@difizen/libro-core 0.0.0-snapshot-20241017072317
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/LICENSE +21 -0
- package/README.md +280 -0
- package/es/add-cell/index.d.ts +4 -0
- package/es/add-cell/index.d.ts.map +1 -0
- package/es/add-cell/index.js +3 -0
- package/es/add-cell/index.less +38 -0
- package/es/add-cell/libro-add-cell-module.d.ts +3 -0
- package/es/add-cell/libro-add-cell-module.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-module.js +4 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +11 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-slot-contribution.js +59 -0
- package/es/add-cell/libro-add-cell-view.d.ts +21 -0
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-view.js +121 -0
- package/es/cell/index.d.ts +10 -0
- package/es/cell/index.d.ts.map +1 -0
- package/es/cell/index.js +9 -0
- package/es/cell/libro-cell-contribution.d.ts +12 -0
- package/es/cell/libro-cell-contribution.d.ts.map +1 -0
- package/es/cell/libro-cell-contribution.js +47 -0
- package/es/cell/libro-cell-model.d.ts +29 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -0
- package/es/cell/libro-cell-model.js +130 -0
- package/es/cell/libro-cell-module.d.ts +10 -0
- package/es/cell/libro-cell-module.d.ts.map +1 -0
- package/es/cell/libro-cell-module.js +30 -0
- package/es/cell/libro-cell-protocol.d.ts +44 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -0
- package/es/cell/libro-cell-protocol.js +11 -0
- package/es/cell/libro-cell-service.d.ts +28 -0
- package/es/cell/libro-cell-service.d.ts.map +1 -0
- package/es/cell/libro-cell-service.js +245 -0
- package/es/cell/libro-cell-view.d.ts +74 -0
- package/es/cell/libro-cell-view.d.ts.map +1 -0
- package/es/cell/libro-cell-view.js +239 -0
- package/es/cell/libro-edit-cell-view.d.ts +44 -0
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
- package/es/cell/libro-edit-cell-view.js +256 -0
- package/es/cell/libro-executable-cell-model.d.ts +14 -0
- package/es/cell/libro-executable-cell-model.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-model.js +7 -0
- package/es/cell/libro-executable-cell-view.d.ts +34 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-view.js +74 -0
- package/es/cell/libro-markdown-cell-model.d.ts +9 -0
- package/es/cell/libro-markdown-cell-model.d.ts.map +1 -0
- package/es/cell/libro-markdown-cell-model.js +7 -0
- package/es/collapse-service.d.ts +36 -0
- package/es/collapse-service.d.ts.map +1 -0
- package/es/collapse-service.js +55 -0
- 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 +21 -0
- package/es/command/index.d.ts +7 -0
- package/es/command/index.d.ts.map +1 -0
- package/es/command/index.js +6 -0
- 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 +40 -0
- package/es/command/libro-command-contribution.d.ts +13 -0
- package/es/command/libro-command-contribution.d.ts.map +1 -0
- package/es/command/libro-command-contribution.js +1842 -0
- package/es/command/libro-command-register.d.ts +21 -0
- package/es/command/libro-command-register.d.ts.map +1 -0
- package/es/command/libro-command-register.js +111 -0
- package/es/command/module.d.ts +3 -0
- package/es/command/module.d.ts.map +1 -0
- package/es/command/module.js +4 -0
- 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 +472 -0
- package/es/components/cell-protocol.d.ts +20 -0
- package/es/components/cell-protocol.d.ts.map +1 -0
- package/es/components/cell-protocol.js +4 -0
- package/es/components/dnd-cell-item-render.d.ts +16 -0
- package/es/components/dnd-cell-item-render.d.ts.map +1 -0
- package/es/components/dnd-cell-item-render.js +364 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts +9 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -0
- package/es/components/dnd-component/custom-drag-layer.js +140 -0
- package/es/components/dnd-component/default-dnd-content.d.ts +11 -0
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -0
- package/es/components/dnd-component/default-dnd-content.js +292 -0
- package/es/components/dnd-component/dnd-context.d.ts +3 -0
- package/es/components/dnd-component/dnd-context.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-context.js +20 -0
- package/es/components/dnd-component/dnd-list.d.ts +14 -0
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-list.js +182 -0
- package/es/components/dnd-component/index.d.ts +5 -0
- package/es/components/dnd-component/index.d.ts.map +1 -0
- package/es/components/dnd-component/index.js +4 -0
- 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 +6 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +5 -0
- package/es/components/libro-component.d.ts +5 -0
- package/es/components/libro-component.d.ts.map +1 -0
- package/es/components/libro-component.js +35 -0
- package/es/components/libro-side-toolbar-menu.d.ts +21 -0
- package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
- package/es/components/libro-side-toolbar-menu.js +58 -0
- package/es/components/libro-view-header.d.ts +3 -0
- package/es/components/libro-view-header.d.ts.map +1 -0
- package/es/components/libro-view-header.js +37 -0
- 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 +6 -0
- package/es/content/index.d.ts.map +1 -0
- package/es/content/index.js +5 -0
- package/es/content/libro-content-contribution.d.ts +11 -0
- package/es/content/libro-content-contribution.d.ts.map +1 -0
- package/es/content/libro-content-contribution.js +31 -0
- package/es/content/libro-content-module.d.ts +3 -0
- package/es/content/libro-content-module.d.ts.map +1 -0
- package/es/content/libro-content-module.js +6 -0
- package/es/content/libro-content-protocol.d.ts +13 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -0
- package/es/content/libro-content-protocol.js +3 -0
- package/es/content/libro-content-service.d.ts +11 -0
- package/es/content/libro-content-service.d.ts.map +1 -0
- package/es/content/libro-content-service.js +63 -0
- 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 +26 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +25 -0
- package/es/index.less +781 -0
- package/es/libro-context-key.d.ts +26 -0
- package/es/libro-context-key.d.ts.map +1 -0
- package/es/libro-context-key.js +84 -0
- package/es/libro-keybind-registry.d.ts +5 -0
- package/es/libro-keybind-registry.d.ts.map +1 -0
- package/es/libro-keybind-registry.js +68 -0
- package/es/libro-model.d.ts +145 -0
- package/es/libro-model.d.ts.map +1 -0
- package/es/libro-model.js +921 -0
- package/es/libro-protocol.d.ts +315 -0
- package/es/libro-protocol.d.ts.map +1 -0
- package/es/libro-protocol.js +47 -0
- package/es/libro-service.d.ts +69 -0
- package/es/libro-service.d.ts.map +1 -0
- package/es/libro-service.js +303 -0
- package/es/libro-setting-contribution.d.ts +5 -0
- package/es/libro-setting-contribution.d.ts.map +1 -0
- package/es/libro-setting-contribution.js +23 -0
- package/es/libro-setting.d.ts +12 -0
- package/es/libro-setting.d.ts.map +1 -0
- package/es/libro-setting.js +101 -0
- package/es/libro-view-tracker.d.ts +6 -0
- package/es/libro-view-tracker.d.ts.map +1 -0
- package/es/libro-view-tracker.js +13 -0
- package/es/libro-view.d.ts +170 -0
- package/es/libro-view.d.ts.map +1 -0
- package/es/libro-view.js +2077 -0
- package/es/libro-workspace-service.d.ts +17 -0
- package/es/libro-workspace-service.d.ts.map +1 -0
- package/es/libro-workspace-service.js +36 -0
- package/es/material-from-designer.d.ts +31 -0
- package/es/material-from-designer.d.ts.map +1 -0
- package/es/material-from-designer.js +697 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +71 -0
- package/es/output/index.d.ts +6 -0
- package/es/output/index.d.ts.map +1 -0
- package/es/output/index.js +5 -0
- package/es/output/output-area.d.ts +51 -0
- package/es/output/output-area.d.ts.map +1 -0
- package/es/output/output-area.js +399 -0
- package/es/output/output-contribution.d.ts +10 -0
- package/es/output/output-contribution.d.ts.map +1 -0
- package/es/output/output-contribution.js +36 -0
- package/es/output/output-model.d.ts +28 -0
- package/es/output/output-model.d.ts.map +1 -0
- package/es/output/output-model.js +105 -0
- package/es/output/output-module.d.ts +3 -0
- package/es/output/output-module.d.ts.map +1 -0
- package/es/output/output-module.js +6 -0
- package/es/output/output-protocol.d.ts +134 -0
- package/es/output/output-protocol.d.ts.map +1 -0
- package/es/output/output-protocol.js +16 -0
- 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 +11 -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 +87 -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/index.d.ts +5 -0
- package/es/slot/index.d.ts.map +1 -0
- package/es/slot/index.js +4 -0
- package/es/slot/libro-slot-manager.d.ts +13 -0
- package/es/slot/libro-slot-manager.d.ts.map +1 -0
- package/es/slot/libro-slot-manager.js +66 -0
- package/es/slot/libro-slot-protocol.d.ts +19 -0
- package/es/slot/libro-slot-protocol.d.ts.map +1 -0
- package/es/slot/libro-slot-protocol.js +5 -0
- package/es/slot/libro-slot-view.d.ts +9 -0
- package/es/slot/libro-slot-view.d.ts.map +1 -0
- package/es/slot/libro-slot-view.js +81 -0
- package/es/slot/module.d.ts +3 -0
- package/es/slot/module.d.ts.map +1 -0
- package/es/slot/module.js +5 -0
- 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 +515 -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/change-cell-to-selector.d.ts +5 -0
- package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
- package/es/toolbar/change-cell-to-selector.js +51 -0
- package/es/toolbar/hide-all-selector.d.ts +5 -0
- package/es/toolbar/hide-all-selector.d.ts.map +1 -0
- package/es/toolbar/hide-all-selector.js +99 -0
- package/es/toolbar/index.d.ts +4 -0
- package/es/toolbar/index.d.ts.map +1 -0
- package/es/toolbar/index.js +3 -0
- package/es/toolbar/index.less +59 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar-protocol.js +1 -0
- package/es/toolbar/libro-toolbar.d.ts +9 -0
- package/es/toolbar/libro-toolbar.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar.js +275 -0
- package/es/toolbar/module.d.ts +3 -0
- package/es/toolbar/module.d.ts.map +1 -0
- package/es/toolbar/module.js +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts +5 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-modal.js +30 -0
- package/es/toolbar/save-icon.d.ts +3 -0
- package/es/toolbar/save-icon.d.ts.map +1 -0
- package/es/toolbar/save-icon.js +54 -0
- package/es/toolbar/shutdown-contribution.d.ts +5 -0
- package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
- package/es/toolbar/shutdown-contribution.js +23 -0
- package/es/toolbar/shutdown-modal.d.ts +5 -0
- package/es/toolbar/shutdown-modal.d.ts.map +1 -0
- package/es/toolbar/shutdown-modal.js +30 -0
- package/es/toolbar/side-toolar-more-select.d.ts +4 -0
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
- package/es/toolbar/side-toolar-more-select.js +161 -0
- package/es/typings/index.d.ts +1 -0
- 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 +23 -0
- package/es/virtualized-manager.d.ts.map +1 -0
- package/es/virtualized-manager.js +65 -0
- package/package.json +73 -0
- package/src/add-cell/index.less +38 -0
- package/src/add-cell/index.ts +3 -0
- package/src/add-cell/libro-add-cell-module.ts +9 -0
- package/src/add-cell/libro-add-cell-slot-contribution.ts +28 -0
- package/src/add-cell/libro-add-cell-view.tsx +99 -0
- package/src/cell/README.md +14 -0
- package/src/cell/index.ts +9 -0
- package/src/cell/libro-cell-contribution.ts +34 -0
- package/src/cell/libro-cell-model.ts +119 -0
- package/src/cell/libro-cell-module.ts +40 -0
- package/src/cell/libro-cell-protocol.ts +55 -0
- package/src/cell/libro-cell-service.ts +158 -0
- package/src/cell/libro-cell-view.tsx +156 -0
- package/src/cell/libro-edit-cell-view.tsx +205 -0
- package/src/cell/libro-executable-cell-model.ts +32 -0
- package/src/cell/libro-executable-cell-view.ts +86 -0
- package/src/cell/libro-markdown-cell-model.ts +20 -0
- package/src/collapse-service.ts +69 -0
- package/src/command/document-commands.ts +24 -0
- package/src/command/index.ts +6 -0
- package/src/command/kernel-command.ts +42 -0
- package/src/command/libro-command-contribution.ts +1346 -0
- package/src/command/libro-command-register.ts +168 -0
- package/src/command/module.ts +9 -0
- package/src/command/notebook-commands.ts +502 -0
- package/src/components/cell-protocol.ts +26 -0
- package/src/components/dnd-cell-item-render.tsx +465 -0
- package/src/components/dnd-component/custom-drag-layer.tsx +144 -0
- package/src/components/dnd-component/default-dnd-content.tsx +330 -0
- package/src/components/dnd-component/dnd-context.tsx +28 -0
- package/src/components/dnd-component/dnd-list.tsx +211 -0
- package/src/components/dnd-component/index.less +12 -0
- package/src/components/dnd-component/index.tsx +4 -0
- 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 +5 -0
- package/src/components/libro-component.tsx +30 -0
- package/src/components/libro-side-toolbar-menu.tsx +82 -0
- package/src/components/libro-view-header.tsx +33 -0
- package/src/components/libro-virtualized-render.tsx +178 -0
- package/src/content/index.ts +5 -0
- package/src/content/libro-content-contribution.ts +16 -0
- package/src/content/libro-content-module.ts +17 -0
- package/src/content/libro-content-protocol.ts +14 -0
- package/src/content/libro-content-service.ts +48 -0
- 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 +789 -0
- package/src/index.spec.ts +12 -0
- package/src/index.tsx +25 -0
- package/src/libro-context-key.ts +84 -0
- package/src/libro-keybind-registry.ts +43 -0
- package/src/libro-model.ts +710 -0
- package/src/libro-protocol.ts +435 -0
- package/src/libro-service.ts +234 -0
- package/src/libro-setting-contribution.ts +28 -0
- package/src/libro-setting.ts +110 -0
- package/src/libro-view-tracker.ts +9 -0
- package/src/libro-view.tsx +1532 -0
- package/src/libro-workspace-service.ts +28 -0
- package/src/material-from-designer.tsx +579 -0
- package/src/module.ts +121 -0
- package/src/output/index.ts +5 -0
- package/src/output/output-area.tsx +286 -0
- package/src/output/output-contribution.ts +14 -0
- package/src/output/output-model.tsx +70 -0
- package/src/output/output-module.ts +10 -0
- package/src/output/output-protocol.ts +168 -0
- 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 +51 -0
- package/src/settings/settings-protocol.ts +7 -0
- package/src/slot/index.ts +4 -0
- package/src/slot/libro-slot-manager.ts +38 -0
- package/src/slot/libro-slot-protocol.ts +28 -0
- package/src/slot/libro-slot-view.tsx +48 -0
- package/src/slot/module.ts +9 -0
- package/src/theme/libro-color-registry.ts +386 -0
- package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
- package/src/toolbar/change-cell-to-selector.tsx +67 -0
- package/src/toolbar/hide-all-selector.tsx +126 -0
- package/src/toolbar/index.less +59 -0
- package/src/toolbar/index.ts +3 -0
- package/src/toolbar/libro-toolbar-protocol.ts +4 -0
- package/src/toolbar/libro-toolbar.tsx +231 -0
- package/src/toolbar/module.ts +11 -0
- package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
- package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
- package/src/toolbar/save-icon.tsx +47 -0
- package/src/toolbar/shutdown-contribution.tsx +10 -0
- package/src/toolbar/shutdown-modal.tsx +37 -0
- package/src/toolbar/side-toolar-more-select.tsx +177 -0
- package/src/typings/index.d.ts +1 -0
- package/src/virtualized-manager-helper.ts +29 -0
- package/src/virtualized-manager.ts +47 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The prefix to use on all css classes from ant.
|
|
2
|
+
@ant-prefix: ant;
|
|
3
|
+
|
|
4
|
+
.libro-hide-selector-menu {
|
|
5
|
+
.@{ant-prefix}-dropdown-menu {
|
|
6
|
+
background-color: var(--mana-libro-popover-background-color);
|
|
7
|
+
}
|
|
8
|
+
.@{ant-prefix}-dropdown-menu-item {
|
|
9
|
+
color: var(--mana-libro-toolbar-menu-label-color);
|
|
10
|
+
}
|
|
11
|
+
.@{ant-prefix}-dropdown-menu-item-disabled {
|
|
12
|
+
color: var(--mana-libro-toolbar-menu-disabled-label-color) !important;
|
|
13
|
+
}
|
|
14
|
+
.@{ant-prefix}-dropdown-menu-item.@{ant-prefix}-dropdown-menu-item-disabled:hover,
|
|
15
|
+
.@{ant-prefix}-dropdown-menu-item:hover {
|
|
16
|
+
background-color: var(--mana-libro-menu-hover-color);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.libro-cell-selector {
|
|
21
|
+
background-color: var(--mana-libro-popover-background-color) !important;
|
|
22
|
+
.@{ant-prefix}-select-item-option-selected:not(
|
|
23
|
+
.@{ant-prefix}-select-item-option-disabled
|
|
24
|
+
),
|
|
25
|
+
.@{ant-prefix}-select-item-option-active:not(
|
|
26
|
+
.@{ant-prefix}-select-item-option-disabled
|
|
27
|
+
) {
|
|
28
|
+
background-color: var(--mana-libro-menu-hover-color) !important;
|
|
29
|
+
}
|
|
30
|
+
.@{ant-prefix}-select-item-option-content {
|
|
31
|
+
color: var(--mana-libro-toolbar-menu-label-color);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.libro-restart-kernel-modal,
|
|
36
|
+
.libro-shut-down-kernel-modal {
|
|
37
|
+
.@{ant-prefix}-modal-content {
|
|
38
|
+
background-color: var(--mana-libro-popover-background-color) !important;
|
|
39
|
+
}
|
|
40
|
+
.@{ant-prefix}-modal-header {
|
|
41
|
+
background: var(--mana-libro-popover-background-color);
|
|
42
|
+
border-color: var(--mana-libro-table-bottom-border-color);
|
|
43
|
+
}
|
|
44
|
+
.@{ant-prefix}-modal-title {
|
|
45
|
+
color: var(--mana-libro-modal-title-color);
|
|
46
|
+
}
|
|
47
|
+
.@{ant-prefix}-modal-body {
|
|
48
|
+
color: var(--mana-libro-modal-content-color);
|
|
49
|
+
}
|
|
50
|
+
.@{ant-prefix}-modal-footer {
|
|
51
|
+
border-color: var(--mana-libro-table-bottom-border-color);
|
|
52
|
+
}
|
|
53
|
+
.@{ant-prefix}-btn-primary {
|
|
54
|
+
background: var(--mana-libro-btn-primary-background-color);
|
|
55
|
+
}
|
|
56
|
+
.@{ant-prefix}-modal-close {
|
|
57
|
+
color: var(--mana-libro-close-color);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { ToolbarRegistry } from '@difizen/mana-app';
|
|
2
|
+
import { isMacintosh } from '@difizen/mana-app';
|
|
3
|
+
import {
|
|
4
|
+
inject,
|
|
5
|
+
ModalService,
|
|
6
|
+
singleton,
|
|
7
|
+
ToolbarContribution,
|
|
8
|
+
useObserve,
|
|
9
|
+
} from '@difizen/mana-app';
|
|
10
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
11
|
+
|
|
12
|
+
import { DocumentCommands, NotebookCommands } from '../command/index.js';
|
|
13
|
+
import { LibroService } from '../libro-service.js';
|
|
14
|
+
|
|
15
|
+
import { AllOutputsScrollIcon } from './all-outputs-scroll-icon.js';
|
|
16
|
+
import { ToolItemSelect } from './change-cell-to-selector.js';
|
|
17
|
+
import { HideAllSelect } from './hide-all-selector.js';
|
|
18
|
+
// import { RunSelect } from './run-selector';
|
|
19
|
+
import { SaveIcon } from './save-icon.js';
|
|
20
|
+
import { SideToolbarMoreSelect } from './side-toolar-more-select.js';
|
|
21
|
+
// import { SideToolbarRunSelect } from './side-toolbar-run-select';
|
|
22
|
+
|
|
23
|
+
function OutputsScorllTooltip({ libroService }: { libroService: LibroService }) {
|
|
24
|
+
const service = useObserve(libroService);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="libro-tooltip">
|
|
28
|
+
<span className="libro-tooltip-text">
|
|
29
|
+
{l10n.t(
|
|
30
|
+
service.active?.outputsScroll
|
|
31
|
+
? '取消固定 Output 展示高度'
|
|
32
|
+
: '固定 Output 展示高度',
|
|
33
|
+
)}
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@singleton({ contrib: [ToolbarContribution] })
|
|
40
|
+
export class LibroToolbarContribution implements ToolbarContribution {
|
|
41
|
+
@inject(ModalService) protected readonly modalService: ModalService;
|
|
42
|
+
@inject(LibroService) protected readonly libroService: LibroService;
|
|
43
|
+
|
|
44
|
+
registerToolbarItems(registry: ToolbarRegistry): void {
|
|
45
|
+
registry.registerItem({
|
|
46
|
+
id: DocumentCommands['Save'].id,
|
|
47
|
+
command: DocumentCommands['Save'].id,
|
|
48
|
+
icon: SaveIcon,
|
|
49
|
+
tooltip: () => (
|
|
50
|
+
<div className="libro-tooltip">
|
|
51
|
+
<span className="libro-tooltip-text">{l10n.t('保存')}</span>
|
|
52
|
+
<span className="libro-tooltip-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + S`}</span>
|
|
53
|
+
</div>
|
|
54
|
+
),
|
|
55
|
+
|
|
56
|
+
group: ['group1'],
|
|
57
|
+
order: '1',
|
|
58
|
+
});
|
|
59
|
+
registry.registerItem({
|
|
60
|
+
id: NotebookCommands['Interrupt'].id,
|
|
61
|
+
command: NotebookCommands['Interrupt'].id,
|
|
62
|
+
tooltip: () => (
|
|
63
|
+
<div className="libro-tooltip">
|
|
64
|
+
<span className="libro-tooltip-text">{l10n.t('中断')}</span>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
|
|
68
|
+
showLabelInline: true,
|
|
69
|
+
group: ['group2'],
|
|
70
|
+
order: 'b-all',
|
|
71
|
+
});
|
|
72
|
+
registry.registerItem({
|
|
73
|
+
id: NotebookCommands['CloseAndShutdown'].id,
|
|
74
|
+
command: NotebookCommands['CloseAndShutdown'].id,
|
|
75
|
+
tooltip: () => (
|
|
76
|
+
<div className="libro-tooltip">
|
|
77
|
+
<span className="libro-tooltip-text">{l10n.t('关闭内核')}</span>
|
|
78
|
+
</div>
|
|
79
|
+
),
|
|
80
|
+
|
|
81
|
+
showLabelInline: true,
|
|
82
|
+
group: ['group2'],
|
|
83
|
+
order: 'b-all',
|
|
84
|
+
});
|
|
85
|
+
registry.registerItem({
|
|
86
|
+
id: NotebookCommands['RestartClearOutput'].id,
|
|
87
|
+
command: NotebookCommands['RestartClearOutput'].id,
|
|
88
|
+
tooltip: () => (
|
|
89
|
+
<div className="libro-tooltip">
|
|
90
|
+
<span className="libro-tooltip-text">{l10n.t('重启并清空输出')}</span>
|
|
91
|
+
</div>
|
|
92
|
+
),
|
|
93
|
+
|
|
94
|
+
showLabelInline: true,
|
|
95
|
+
group: ['group2'],
|
|
96
|
+
order: 'c-all',
|
|
97
|
+
});
|
|
98
|
+
registry.registerItem({
|
|
99
|
+
id: DocumentCommands['FormatCell'].id,
|
|
100
|
+
command: DocumentCommands['FormatCell'].id,
|
|
101
|
+
tooltip: () => (
|
|
102
|
+
<div className="libro-side-tooltip">
|
|
103
|
+
<span className="libro-tooltip-text">{l10n.t('格式化代码')}</span>
|
|
104
|
+
<span className="libro-tooltip-keybind">{`Shift+${isMacintosh ? 'Option' : 'Alt'}+F`}</span>
|
|
105
|
+
</div>
|
|
106
|
+
),
|
|
107
|
+
|
|
108
|
+
group: ['sidetoolbar1'],
|
|
109
|
+
order: 'd',
|
|
110
|
+
});
|
|
111
|
+
registry.registerItem({
|
|
112
|
+
id: NotebookCommands['MoveCellUp'].id,
|
|
113
|
+
command: NotebookCommands['MoveCellUp'].id,
|
|
114
|
+
tooltip: () => (
|
|
115
|
+
<div className="libro-side-tooltip">
|
|
116
|
+
<span className="libro-tooltip-text">{l10n.t('上移')}</span>
|
|
117
|
+
<span className="libro-tooltip-keybind">Up</span>
|
|
118
|
+
</div>
|
|
119
|
+
),
|
|
120
|
+
|
|
121
|
+
group: ['sidetoolbar1'],
|
|
122
|
+
order: 'e',
|
|
123
|
+
});
|
|
124
|
+
registry.registerItem({
|
|
125
|
+
id: NotebookCommands['MoveCellDown'].id,
|
|
126
|
+
command: NotebookCommands['MoveCellDown'].id,
|
|
127
|
+
tooltip: () => (
|
|
128
|
+
<div className="libro-side-tooltip">
|
|
129
|
+
<span className="libro-tooltip-text">{l10n.t('下移')}</span>
|
|
130
|
+
<span className="libro-tooltip-keybind">Down</span>
|
|
131
|
+
</div>
|
|
132
|
+
),
|
|
133
|
+
|
|
134
|
+
group: ['sidetoolbar1'],
|
|
135
|
+
order: 'f',
|
|
136
|
+
});
|
|
137
|
+
registry.registerItem({
|
|
138
|
+
id: NotebookCommands['InsertCellBelow'].id,
|
|
139
|
+
command: NotebookCommands['InsertCellBelow'].id,
|
|
140
|
+
tooltip: () => (
|
|
141
|
+
<div className="libro-side-tooltip">
|
|
142
|
+
<span className="libro-tooltip-text">{l10n.t('增加')}</span>
|
|
143
|
+
<span className="libro-tooltip-keybind">B</span>
|
|
144
|
+
</div>
|
|
145
|
+
),
|
|
146
|
+
|
|
147
|
+
group: ['sidetoolbar2'],
|
|
148
|
+
order: 'g1',
|
|
149
|
+
});
|
|
150
|
+
registry.registerItem({
|
|
151
|
+
id: NotebookCommands['DeleteCell'].id,
|
|
152
|
+
command: NotebookCommands['DeleteCell'].id,
|
|
153
|
+
tooltip: () => (
|
|
154
|
+
<div className="libro-side-tooltip">
|
|
155
|
+
<span className="libro-tooltip-text">{l10n.t('删除')}</span>
|
|
156
|
+
<span className="libro-tooltip-keybind">D D</span>
|
|
157
|
+
</div>
|
|
158
|
+
),
|
|
159
|
+
|
|
160
|
+
group: ['sidetoolbar2'],
|
|
161
|
+
order: 'g2',
|
|
162
|
+
});
|
|
163
|
+
registry.registerItem({
|
|
164
|
+
id: NotebookCommands['UndoCellAction'].id,
|
|
165
|
+
command: NotebookCommands['UndoCellAction'].id,
|
|
166
|
+
tooltip: () => (
|
|
167
|
+
<div className="libro-tooltip">
|
|
168
|
+
<span className="libro-tooltip-text">{l10n.t('撤销')}</span>
|
|
169
|
+
<span className="libro-tooltip-keybind">Z</span>
|
|
170
|
+
</div>
|
|
171
|
+
),
|
|
172
|
+
|
|
173
|
+
group: ['group3'],
|
|
174
|
+
order: 'h1',
|
|
175
|
+
});
|
|
176
|
+
registry.registerItem({
|
|
177
|
+
id: NotebookCommands['RedoCellAction'].id,
|
|
178
|
+
command: NotebookCommands['RedoCellAction'].id,
|
|
179
|
+
tooltip: () => (
|
|
180
|
+
<div className="libro-tooltip">
|
|
181
|
+
<span className="libro-tooltip-text">{l10n.t('重做')}</span>
|
|
182
|
+
<span className="libro-tooltip-keybind">Shift + Z</span>
|
|
183
|
+
</div>
|
|
184
|
+
),
|
|
185
|
+
|
|
186
|
+
group: ['group3'],
|
|
187
|
+
order: 'h2',
|
|
188
|
+
});
|
|
189
|
+
registry.registerItem({
|
|
190
|
+
id: NotebookCommands['EnableOrDisableAllOutputScrolling'].id,
|
|
191
|
+
command: NotebookCommands['EnableOrDisableAllOutputScrolling'].id,
|
|
192
|
+
tooltip: <OutputsScorllTooltip libroService={this.libroService} />,
|
|
193
|
+
group: ['group3'],
|
|
194
|
+
order: 'h2',
|
|
195
|
+
icon: AllOutputsScrollIcon,
|
|
196
|
+
});
|
|
197
|
+
registry.registerItem({
|
|
198
|
+
id: NotebookCommands['HideAllCell'].id,
|
|
199
|
+
command: NotebookCommands['HideAllCell'].id,
|
|
200
|
+
icon: HideAllSelect,
|
|
201
|
+
group: ['group3'],
|
|
202
|
+
order: 'i',
|
|
203
|
+
});
|
|
204
|
+
registry.registerItem({
|
|
205
|
+
id: NotebookCommands['ClearAllCellOutput'].id,
|
|
206
|
+
command: NotebookCommands['ClearAllCellOutput'].id,
|
|
207
|
+
tooltip: () => (
|
|
208
|
+
<div className="libro-tooltip">
|
|
209
|
+
<span className="libro-tooltip-text">{l10n.t('清空输出')}</span>
|
|
210
|
+
</div>
|
|
211
|
+
),
|
|
212
|
+
|
|
213
|
+
group: ['group3'],
|
|
214
|
+
order: 'j',
|
|
215
|
+
});
|
|
216
|
+
registry.registerItem({
|
|
217
|
+
id: NotebookCommands['ChangeCellTo'].id,
|
|
218
|
+
icon: ToolItemSelect,
|
|
219
|
+
command: NotebookCommands['ChangeCellTo'].id,
|
|
220
|
+
group: ['group4'],
|
|
221
|
+
order: 'k',
|
|
222
|
+
});
|
|
223
|
+
registry.registerItem({
|
|
224
|
+
id: NotebookCommands['More'].id,
|
|
225
|
+
icon: SideToolbarMoreSelect,
|
|
226
|
+
command: NotebookCommands['More'].id,
|
|
227
|
+
group: ['sidetoolbar3'],
|
|
228
|
+
order: 'm',
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { LibroToolbarContribution } from './libro-toolbar.js';
|
|
4
|
+
import { RestartClearOutputsContribution } from './restart-clear-outputs-contribution.js';
|
|
5
|
+
import { ShutdownContribution } from './shutdown-contribution.js';
|
|
6
|
+
|
|
7
|
+
export const LibroToolbarModule = ManaModule.create().register(
|
|
8
|
+
LibroToolbarContribution,
|
|
9
|
+
RestartClearOutputsContribution,
|
|
10
|
+
ShutdownContribution,
|
|
11
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModalContribution, singleton } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { RestartClearOutputModal } from './restart-clear-outputs-modal.js';
|
|
4
|
+
|
|
5
|
+
@singleton({ contrib: ModalContribution })
|
|
6
|
+
export class RestartClearOutputsContribution implements ModalContribution {
|
|
7
|
+
registerModal() {
|
|
8
|
+
return RestartClearOutputModal;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ModalItemProps, ModalItem } from '@difizen/mana-app';
|
|
2
|
+
import { Modal } from 'antd';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
import { NotebookCommands } from '../command/index.js';
|
|
6
|
+
import type { LibroView } from '../libro-view.js';
|
|
7
|
+
|
|
8
|
+
export function RestartClearOutputModalComponent({
|
|
9
|
+
visible,
|
|
10
|
+
close,
|
|
11
|
+
data,
|
|
12
|
+
}: ModalItemProps<LibroView>) {
|
|
13
|
+
const handleRestart = useCallback(() => {
|
|
14
|
+
data?.restartClearOutput();
|
|
15
|
+
close();
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
}, [data]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Modal
|
|
21
|
+
title="Restart Kernel?"
|
|
22
|
+
open={visible}
|
|
23
|
+
onOk={handleRestart}
|
|
24
|
+
onCancel={() => close()}
|
|
25
|
+
width={'400px'}
|
|
26
|
+
centered={true}
|
|
27
|
+
className="libro-restart-kernel-modal"
|
|
28
|
+
>
|
|
29
|
+
Do you want to restart the current kernel? All variables will be lost.
|
|
30
|
+
</Modal>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const RestartClearOutputModal: ModalItem<LibroView> = {
|
|
35
|
+
id: NotebookCommands['RestartClearOutput'].id,
|
|
36
|
+
component: RestartClearOutputModalComponent,
|
|
37
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SaveOutlined,
|
|
3
|
+
CheckOutlined,
|
|
4
|
+
CloseOutlined,
|
|
5
|
+
LoadingOutlined,
|
|
6
|
+
} from '@ant-design/icons';
|
|
7
|
+
import { useInject, ViewInstance } from '@difizen/mana-app';
|
|
8
|
+
import type { Disposable } from '@difizen/mana-app';
|
|
9
|
+
import type { FC } from 'react';
|
|
10
|
+
import { useEffect, useCallback, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import type { LibroView } from '../libro-view.js';
|
|
13
|
+
|
|
14
|
+
export const SaveIcon: FC = () => {
|
|
15
|
+
const [saved, setSaved] = useState<boolean | undefined>(undefined);
|
|
16
|
+
const libroView = useInject<LibroView>(ViewInstance);
|
|
17
|
+
|
|
18
|
+
const handleSave = useCallback((result: boolean) => {
|
|
19
|
+
setSaved(result);
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
setSaved(undefined);
|
|
22
|
+
}, 500);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
let toDispose: Disposable;
|
|
27
|
+
if (libroView) {
|
|
28
|
+
toDispose = libroView.onSave((result) => {
|
|
29
|
+
handleSave(result);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
toDispose?.dispose();
|
|
34
|
+
};
|
|
35
|
+
}, [handleSave, libroView]);
|
|
36
|
+
if (saved !== undefined) {
|
|
37
|
+
if (saved) {
|
|
38
|
+
return <CheckOutlined style={{ color: 'green' }} />;
|
|
39
|
+
} else {
|
|
40
|
+
return <CloseOutlined style={{ color: 'red' }} />;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (libroView?.saving) {
|
|
44
|
+
return <LoadingOutlined />;
|
|
45
|
+
}
|
|
46
|
+
return <SaveOutlined />;
|
|
47
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModalContribution, singleton } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { ShutdownModal } from './shutdown-modal.js';
|
|
4
|
+
|
|
5
|
+
@singleton({ contrib: ModalContribution })
|
|
6
|
+
export class ShutdownContribution implements ModalContribution {
|
|
7
|
+
registerModal() {
|
|
8
|
+
return ShutdownModal;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ModalItemProps, ModalItem } from '@difizen/mana-app';
|
|
2
|
+
import { Modal } from 'antd';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
import { NotebookCommands } from '../command/index.js';
|
|
6
|
+
import type { LibroView } from '../libro-view.js';
|
|
7
|
+
|
|
8
|
+
export function ShutdownModalComponent({
|
|
9
|
+
visible,
|
|
10
|
+
close,
|
|
11
|
+
data,
|
|
12
|
+
}: ModalItemProps<LibroView>) {
|
|
13
|
+
const handleShutdown = useCallback(() => {
|
|
14
|
+
data?.closeAndShutdown();
|
|
15
|
+
close();
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
}, [data]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Modal
|
|
21
|
+
title="Shutdown Kernel?"
|
|
22
|
+
open={visible}
|
|
23
|
+
onOk={handleShutdown}
|
|
24
|
+
onCancel={() => close()}
|
|
25
|
+
width={'400px'}
|
|
26
|
+
centered={true}
|
|
27
|
+
className="libro-shut-down-kernel-modal"
|
|
28
|
+
>
|
|
29
|
+
Do you want to shutdown the current kernel?.
|
|
30
|
+
</Modal>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const ShutdownModal: ModalItem<LibroView> = {
|
|
35
|
+
id: NotebookCommands['CloseAndShutdown'].id,
|
|
36
|
+
component: ShutdownModalComponent,
|
|
37
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { Toolbar } from '@difizen/mana-app';
|
|
2
|
+
import { isMacintosh } from '@difizen/mana-app';
|
|
3
|
+
import {
|
|
4
|
+
CommandRegistry,
|
|
5
|
+
getOrigin,
|
|
6
|
+
ToolbarInstance,
|
|
7
|
+
useInject,
|
|
8
|
+
useObserve,
|
|
9
|
+
} from '@difizen/mana-app';
|
|
10
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
11
|
+
import { Menu, MenuContext } from '@difizen/mana-react';
|
|
12
|
+
import { Popover } from 'antd';
|
|
13
|
+
|
|
14
|
+
import { ExecutableCellModel, ExecutableCellView } from '../cell/index.js';
|
|
15
|
+
import { NotebookCommands } from '../command/index.js';
|
|
16
|
+
import type { LibroSideToolbarMenuItemType } from '../components/libro-side-toolbar-menu.js';
|
|
17
|
+
import { MoreOutlined } from '../material-from-designer.js';
|
|
18
|
+
|
|
19
|
+
import type { LibroToolbarArags } from './libro-toolbar-protocol.js';
|
|
20
|
+
|
|
21
|
+
export const LibroSideToolbarMoreMenu: React.FC = () => {
|
|
22
|
+
const command = useInject(CommandRegistry);
|
|
23
|
+
const toolbar = useInject<Toolbar>(ToolbarInstance);
|
|
24
|
+
const data = toolbar.currentArgs as LibroToolbarArags;
|
|
25
|
+
const args = getOrigin(data) || [];
|
|
26
|
+
const cell = useObserve(args[0]);
|
|
27
|
+
const codeItems: LibroSideToolbarMenuItemType[] = [
|
|
28
|
+
{
|
|
29
|
+
id: NotebookCommands['HideCellCode'].id,
|
|
30
|
+
label: (
|
|
31
|
+
<>
|
|
32
|
+
<span className="libro-menu-item-label">{l10n.t('隐藏 Code')}</span>
|
|
33
|
+
<span className="libro-menu-item-keybind">
|
|
34
|
+
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
35
|
+
</span>
|
|
36
|
+
</>
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: NotebookCommands['ShowCellCode'].id,
|
|
41
|
+
label: (
|
|
42
|
+
<>
|
|
43
|
+
<span className="libro-menu-item-label">{l10n.t('显示 Code')}</span>
|
|
44
|
+
<span className="libro-menu-item-keybind">
|
|
45
|
+
{`${isMacintosh ? 'Cmd' : 'Ctrl'} + `}'
|
|
46
|
+
</span>
|
|
47
|
+
</>
|
|
48
|
+
),
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const outputItems: LibroSideToolbarMenuItemType[] = [
|
|
53
|
+
{
|
|
54
|
+
id: NotebookCommands['HideCellOutputs'].id,
|
|
55
|
+
label: (
|
|
56
|
+
<>
|
|
57
|
+
<span className="libro-menu-item-label">{l10n.t('隐藏 Output')}</span>
|
|
58
|
+
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
59
|
+
</>
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: NotebookCommands['ShowCellOutputs'].id,
|
|
64
|
+
label: (
|
|
65
|
+
<>
|
|
66
|
+
<span className="libro-menu-item-label">{l10n.t('显示 Output')}</span>
|
|
67
|
+
<span className="libro-menu-item-keybind">{`${isMacintosh ? 'Cmd' : 'Ctrl'} + O`}</span>
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const moreItems: LibroSideToolbarMenuItemType[] = [
|
|
74
|
+
{
|
|
75
|
+
id: NotebookCommands['CopyCell'].id,
|
|
76
|
+
label: (
|
|
77
|
+
<>
|
|
78
|
+
<span className="libro-menu-item-label">{l10n.t('复制')}</span>
|
|
79
|
+
<span className="libro-menu-item-keybind">C</span>
|
|
80
|
+
</>
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: NotebookCommands['CutCell'].id,
|
|
85
|
+
label: (
|
|
86
|
+
<>
|
|
87
|
+
<span className="libro-menu-item-label">{l10n.t('剪切')}</span>
|
|
88
|
+
<span className="libro-menu-item-keybind">X</span>
|
|
89
|
+
</>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: NotebookCommands['PasteCellBelow'].id,
|
|
94
|
+
label: (
|
|
95
|
+
<>
|
|
96
|
+
<span className="libro-menu-item-label">{l10n.t('粘贴')}</span>
|
|
97
|
+
<span className="libro-menu-item-keybind">V</span>
|
|
98
|
+
</>
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
if (!cell) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const hasOutput =
|
|
106
|
+
ExecutableCellView.is(cell) && cell.outputArea?.length && cell.outputArea.length > 0
|
|
107
|
+
? true
|
|
108
|
+
: false;
|
|
109
|
+
const nodes: React.ReactNode[] = [];
|
|
110
|
+
const baseCls = 'mana-menu';
|
|
111
|
+
const contextValue: MenuContext.Context = {
|
|
112
|
+
prefixCls: baseCls,
|
|
113
|
+
};
|
|
114
|
+
const codeMenuItem = cell.hasInputHidden ? 1 : 0;
|
|
115
|
+
nodes.push(
|
|
116
|
+
<Menu.Item
|
|
117
|
+
key={codeItems[codeMenuItem].id}
|
|
118
|
+
onClick={() => {
|
|
119
|
+
command.executeCommand(codeItems[codeMenuItem].id, ...args);
|
|
120
|
+
cell.hasInputHidden = !cell.hasInputHidden;
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
{codeItems[codeMenuItem].label}
|
|
124
|
+
</Menu.Item>,
|
|
125
|
+
);
|
|
126
|
+
const outputMenuItem =
|
|
127
|
+
ExecutableCellModel.is(cell.model) && cell.model.hasOutputHidden ? 1 : 0;
|
|
128
|
+
nodes.push(
|
|
129
|
+
<Menu.Item
|
|
130
|
+
key={outputItems[outputMenuItem].id}
|
|
131
|
+
onClick={() => {
|
|
132
|
+
if (hasOutput) {
|
|
133
|
+
command.executeCommand(outputItems[outputMenuItem].id, ...args);
|
|
134
|
+
if (ExecutableCellModel.is(cell.model)) {
|
|
135
|
+
cell.model.hasOutputHidden = !cell.model.hasOutputHidden;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
disabled={!hasOutput}
|
|
140
|
+
>
|
|
141
|
+
{outputItems[outputMenuItem].label}
|
|
142
|
+
</Menu.Item>,
|
|
143
|
+
);
|
|
144
|
+
nodes.push(<Menu.Divider key="libro-menu-divider" />);
|
|
145
|
+
moreItems.forEach((item) => {
|
|
146
|
+
nodes.push(
|
|
147
|
+
<Menu.Item
|
|
148
|
+
key={item.id}
|
|
149
|
+
onClick={() => {
|
|
150
|
+
command.executeCommand(item.id, ...args);
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{item.label}
|
|
154
|
+
</Menu.Item>,
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
return (
|
|
158
|
+
<div className="libro-side-toolbar-menu">
|
|
159
|
+
<MenuContext.Provider value={contextValue}>{nodes} </MenuContext.Provider>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const SideToolbarMoreSelect: React.FC = () => {
|
|
165
|
+
return (
|
|
166
|
+
<Popover
|
|
167
|
+
placement="leftTop"
|
|
168
|
+
content={<LibroSideToolbarMoreMenu />}
|
|
169
|
+
trigger="click"
|
|
170
|
+
overlayClassName="libro-popover-side-toolbar-menu libro-side-toolbar-more-select-menu"
|
|
171
|
+
>
|
|
172
|
+
<span>
|
|
173
|
+
<MoreOutlined />
|
|
174
|
+
</span>
|
|
175
|
+
</Popover>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.less';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { inject, prop, singleton } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import type { NotebookModel } from './libro-protocol.js';
|
|
4
|
+
import { VirtualizedManagerOptionFactory } from './libro-protocol.js';
|
|
5
|
+
import type { VirtualizedManager } from './virtualized-manager.js';
|
|
6
|
+
|
|
7
|
+
@singleton()
|
|
8
|
+
export class VirtualizedManagerHelper {
|
|
9
|
+
@inject(VirtualizedManagerOptionFactory) factory: VirtualizedManagerOptionFactory;
|
|
10
|
+
|
|
11
|
+
@prop()
|
|
12
|
+
current?: VirtualizedManager;
|
|
13
|
+
protected virtualizedManagerHelperMap = new Map<string, VirtualizedManager>();
|
|
14
|
+
|
|
15
|
+
setCurrent(libroModel: NotebookModel) {
|
|
16
|
+
const virtualizedManagerHelper = this.getOrCreate(libroModel);
|
|
17
|
+
this.current = virtualizedManagerHelper;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getOrCreate(libroModel: NotebookModel): VirtualizedManager {
|
|
21
|
+
const exist = this.virtualizedManagerHelperMap.get(libroModel.id);
|
|
22
|
+
if (exist) {
|
|
23
|
+
return exist;
|
|
24
|
+
}
|
|
25
|
+
const virtualizedManagerHelper = this.factory({ libroModel: libroModel });
|
|
26
|
+
this.virtualizedManagerHelperMap.set(libroModel.id, virtualizedManagerHelper);
|
|
27
|
+
return virtualizedManagerHelper;
|
|
28
|
+
}
|
|
29
|
+
}
|