@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,435 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
2
|
+
import type { IModel, IModelContentChange } from '@difizen/libro-code-editor';
|
|
3
|
+
import type {
|
|
4
|
+
CellType,
|
|
5
|
+
ICell,
|
|
6
|
+
ICellMetadata,
|
|
7
|
+
INotebookContent,
|
|
8
|
+
INotebookMetadata,
|
|
9
|
+
} from '@difizen/libro-common';
|
|
10
|
+
import type { ISharedNotebook } from '@difizen/libro-shared-model';
|
|
11
|
+
import type { Disposable, Event } from '@difizen/mana-app';
|
|
12
|
+
import type { View } from '@difizen/mana-app';
|
|
13
|
+
|
|
14
|
+
import type { LibroCell } from './cell/index.js';
|
|
15
|
+
import type { LibroView } from './libro-view.js';
|
|
16
|
+
import type { VirtualizedManager } from './virtualized-manager.js';
|
|
17
|
+
|
|
18
|
+
export const LibroContextKeys = {
|
|
19
|
+
active: 'active',
|
|
20
|
+
focus: 'focus',
|
|
21
|
+
commandMode: 'commandMode',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const LibroToolbarArea = {
|
|
25
|
+
HeaderLeft: 'header-left',
|
|
26
|
+
HeaderCenter: 'header-center',
|
|
27
|
+
HeaderRight: 'header-right',
|
|
28
|
+
CellTop: 'top',
|
|
29
|
+
CellRight: 'right',
|
|
30
|
+
};
|
|
31
|
+
export const NotebookOption = Symbol('NotebookOption');
|
|
32
|
+
/**
|
|
33
|
+
* Libro 创建参数
|
|
34
|
+
* 默认可 json 序列化
|
|
35
|
+
*/
|
|
36
|
+
export interface NotebookOption extends Options {
|
|
37
|
+
id?: string;
|
|
38
|
+
modelId?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const PerformaceStatisticOption = Symbol('PerformaceStatisticOption');
|
|
43
|
+
export type PerformaceStatisticOption = Options;
|
|
44
|
+
|
|
45
|
+
export const ModelFactory = Symbol('ModelFactory');
|
|
46
|
+
export type ModelFactory<T = NotebookOption> = (options: T) => NotebookModel;
|
|
47
|
+
|
|
48
|
+
export const NotebookModel = Symbol('NotebookModel');
|
|
49
|
+
|
|
50
|
+
export enum EditorStatus {
|
|
51
|
+
NOTLOADED = 'not loaded',
|
|
52
|
+
LOADING = 'loading',
|
|
53
|
+
LOADED = 'loaded',
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type Options = {
|
|
57
|
+
id?: string;
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export interface ScrollParams {
|
|
62
|
+
cellIndex: number;
|
|
63
|
+
cellOffset?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type NotebookModel = BaseNotebookModel & DndListModel;
|
|
67
|
+
|
|
68
|
+
export interface ICellContentChange {
|
|
69
|
+
cell: CellView;
|
|
70
|
+
changes: IModelContentChange[];
|
|
71
|
+
}
|
|
72
|
+
export interface BaseNotebookModel {
|
|
73
|
+
id: string;
|
|
74
|
+
version: number;
|
|
75
|
+
/**
|
|
76
|
+
* The dirty state of the model.
|
|
77
|
+
* #### Notes
|
|
78
|
+
* This should be cleared when the document is loaded from
|
|
79
|
+
* or saved to disk.
|
|
80
|
+
*/
|
|
81
|
+
dirty: boolean;
|
|
82
|
+
executeCount: number;
|
|
83
|
+
lastClipboardInteraction?: string;
|
|
84
|
+
clipboard?: CellView | CellView[];
|
|
85
|
+
active?: CellView | undefined;
|
|
86
|
+
activeIndex: number;
|
|
87
|
+
dndAreaNullEnable: boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Controlling whether the cell input is editable
|
|
91
|
+
*/
|
|
92
|
+
inputEditable: boolean;
|
|
93
|
+
|
|
94
|
+
outputEditable: boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Controlling whether the cells list is editable
|
|
98
|
+
*/
|
|
99
|
+
cellsEditable: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Controlling whether the cells can execute
|
|
102
|
+
*/
|
|
103
|
+
runnable: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Controlling whether the notebook can save
|
|
106
|
+
*/
|
|
107
|
+
savable: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The command mode of the model.
|
|
110
|
+
*/
|
|
111
|
+
commandMode: boolean;
|
|
112
|
+
|
|
113
|
+
trusted: boolean;
|
|
114
|
+
|
|
115
|
+
onCommandModeChanged: Event<boolean>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* all changes
|
|
119
|
+
*/
|
|
120
|
+
onChanged: Event<boolean>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* cell content & type
|
|
124
|
+
*/
|
|
125
|
+
onSourceChanged: Event<boolean>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* cell create & delete
|
|
129
|
+
*/
|
|
130
|
+
onCellViewChanged: Event<CellViewChange>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* cell content change detail
|
|
134
|
+
*/
|
|
135
|
+
onCellContentChanged: Event<ICellContentChange>;
|
|
136
|
+
|
|
137
|
+
getCells: () => CellView[];
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Serialize the model to a string.
|
|
141
|
+
*/
|
|
142
|
+
toString: () => string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Deserialize the model from a string.
|
|
146
|
+
*
|
|
147
|
+
* #### Notes
|
|
148
|
+
* Should emit a [contentChanged] signal.
|
|
149
|
+
*/
|
|
150
|
+
fromString: (value: string) => void;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The list of cells in the notebook.
|
|
154
|
+
*/
|
|
155
|
+
cells: CellView[];
|
|
156
|
+
|
|
157
|
+
selections: CellView[];
|
|
158
|
+
|
|
159
|
+
canUndo?: boolean;
|
|
160
|
+
|
|
161
|
+
canRedo?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The metadata associated with the notebook.
|
|
165
|
+
*/
|
|
166
|
+
readonly metadata: INotebookMetadata;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The array of deleted cells since the notebook was last run.
|
|
170
|
+
*/
|
|
171
|
+
readonly deletedCells: CellView[];
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* If the model is initialized or not.
|
|
175
|
+
*/
|
|
176
|
+
isInitialized: boolean;
|
|
177
|
+
|
|
178
|
+
initialize: () => Promise<CellOptions[]>;
|
|
179
|
+
|
|
180
|
+
options: Options;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* save notebook
|
|
184
|
+
*/
|
|
185
|
+
toJSON: () => INotebookContent;
|
|
186
|
+
|
|
187
|
+
saveNotebookContent: () => Promise<void>;
|
|
188
|
+
|
|
189
|
+
fontSize: number;
|
|
190
|
+
theme: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 聚焦
|
|
194
|
+
*/
|
|
195
|
+
focus?: () => void;
|
|
196
|
+
blur?: () => void;
|
|
197
|
+
/**
|
|
198
|
+
* 进入命令模式
|
|
199
|
+
*/
|
|
200
|
+
enterCommandMode?: () => void;
|
|
201
|
+
|
|
202
|
+
enterEditMode?: () => void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* all changes: cell value\cell type\cell output\ cell executecount\ cell or notebook metadata\cell create & delete
|
|
206
|
+
* @returns
|
|
207
|
+
*/
|
|
208
|
+
onChange?: () => void;
|
|
209
|
+
|
|
210
|
+
onRestart?: Event<void>;
|
|
211
|
+
|
|
212
|
+
onSourceChange?: (cells: CellView[]) => void;
|
|
213
|
+
|
|
214
|
+
onCellContentChange: (changes: ICellContentChange) => void;
|
|
215
|
+
|
|
216
|
+
interrupt?: () => void;
|
|
217
|
+
|
|
218
|
+
canRun?: () => boolean;
|
|
219
|
+
|
|
220
|
+
restart?: () => void;
|
|
221
|
+
|
|
222
|
+
shutdown?: () => void;
|
|
223
|
+
|
|
224
|
+
undo: () => void;
|
|
225
|
+
|
|
226
|
+
redo: () => void;
|
|
227
|
+
|
|
228
|
+
readonly sharedModel: ISharedNotebook;
|
|
229
|
+
|
|
230
|
+
scrollToView: (cell: CellView, cellOffset?: number) => void;
|
|
231
|
+
|
|
232
|
+
customParams: Record<string, any>;
|
|
233
|
+
getCustomKey: (key: string) => any;
|
|
234
|
+
setCustomKey: (key: string, val: any) => void;
|
|
235
|
+
|
|
236
|
+
libroViewClass: string;
|
|
237
|
+
|
|
238
|
+
onScrollToCellView: Event<ScrollParams>;
|
|
239
|
+
|
|
240
|
+
disposeScrollToCellViewEmitter: () => void;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const notebookViewFactoryId = 'notebook-view-factory';
|
|
244
|
+
|
|
245
|
+
export type NotebookView = LibroView;
|
|
246
|
+
|
|
247
|
+
export interface CellView extends View {
|
|
248
|
+
model: CellModel;
|
|
249
|
+
parent: NotebookView;
|
|
250
|
+
wrapperCls?: string;
|
|
251
|
+
|
|
252
|
+
blur: () => void;
|
|
253
|
+
focus: (isEdit: boolean) => void;
|
|
254
|
+
|
|
255
|
+
shouldEnterEditorMode: (e: React.FocusEvent<HTMLElement>) => boolean;
|
|
256
|
+
|
|
257
|
+
hasCellHidden: () => boolean;
|
|
258
|
+
|
|
259
|
+
hasInputHidden: boolean;
|
|
260
|
+
|
|
261
|
+
hasModal: boolean;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 是否被折叠隐藏
|
|
265
|
+
*/
|
|
266
|
+
collapsedHidden: boolean;
|
|
267
|
+
|
|
268
|
+
toJSON: () => ICell;
|
|
269
|
+
|
|
270
|
+
toJSONWithoutId: () => ICell;
|
|
271
|
+
|
|
272
|
+
editorAreaHeight?: number;
|
|
273
|
+
|
|
274
|
+
cellViewTopPos?: number;
|
|
275
|
+
|
|
276
|
+
noEditorAreaHeight: number;
|
|
277
|
+
|
|
278
|
+
editorStatus?: EditorStatus;
|
|
279
|
+
|
|
280
|
+
calcEditorAreaHeight?: () => number;
|
|
281
|
+
|
|
282
|
+
calcEditorOffset?: () => number;
|
|
283
|
+
|
|
284
|
+
renderEditorIntoVirtualized?: boolean;
|
|
285
|
+
}
|
|
286
|
+
function isView(data: object): data is View {
|
|
287
|
+
return (
|
|
288
|
+
!!data &&
|
|
289
|
+
typeof data === 'object' &&
|
|
290
|
+
'id' in data &&
|
|
291
|
+
'view' in data &&
|
|
292
|
+
typeof data['view'] === 'function'
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
export function isCellView(view: View): view is CellView {
|
|
296
|
+
return (
|
|
297
|
+
isView(view) &&
|
|
298
|
+
'model' in view &&
|
|
299
|
+
'parent' in view &&
|
|
300
|
+
'run' in view &&
|
|
301
|
+
'toJSON' in view
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export const CellOptions = Symbol('CellOptions');
|
|
306
|
+
export interface CellOptions {
|
|
307
|
+
// parent?: NotebookView;
|
|
308
|
+
id?: string;
|
|
309
|
+
modelId?: string;
|
|
310
|
+
mimetype?: string;
|
|
311
|
+
cell: LibroCell;
|
|
312
|
+
[key: string]: any;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export const CellViewOptions = Symbol('CellViewOptions');
|
|
316
|
+
export interface CellViewOptions {
|
|
317
|
+
parentId: string;
|
|
318
|
+
id: string;
|
|
319
|
+
modelId: string;
|
|
320
|
+
mimetype?: string;
|
|
321
|
+
cell: ICell;
|
|
322
|
+
[key: string]: any;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface CellViewChange {
|
|
326
|
+
insert?: { cells: CellView[]; index: number };
|
|
327
|
+
delete?: { index: number; number: number; cells: CellView[] };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface CellModel extends IModel, Disposable {
|
|
331
|
+
/**
|
|
332
|
+
* A unique identifier for the cell.
|
|
333
|
+
*/
|
|
334
|
+
id: string;
|
|
335
|
+
|
|
336
|
+
version: number;
|
|
337
|
+
|
|
338
|
+
source: string;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* The type of the cell.
|
|
342
|
+
*/
|
|
343
|
+
type: CellType;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* A signal emitted when the content of the model changes.
|
|
347
|
+
*/
|
|
348
|
+
// readonly contentChanged: Event<void>;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* A signal emitted when a model state changes.
|
|
352
|
+
*/
|
|
353
|
+
// readonly stateChanged: Event<IContentsChangedArgs<any>>;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Whether the cell is trusted.
|
|
357
|
+
*/
|
|
358
|
+
trusted: boolean;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* The metadata associated with the cell.
|
|
362
|
+
*/
|
|
363
|
+
readonly metadata: Partial<ICellMetadata>;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Serialize the model to JSON.
|
|
367
|
+
* 输出时的字段顺序也要保持稳定
|
|
368
|
+
*/
|
|
369
|
+
toJSON: () => Omit<ICell, 'outputs'>;
|
|
370
|
+
|
|
371
|
+
options: CellOptions;
|
|
372
|
+
// run: () => Promise<boolean>;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export const NotebookService = Symbol('NotebookService');
|
|
376
|
+
|
|
377
|
+
export interface NotebookService {
|
|
378
|
+
getOrCreateModel: (options: NotebookOption) => NotebookModel;
|
|
379
|
+
getOrCreateView: (options: NotebookOption) => Promise<NotebookView>;
|
|
380
|
+
setActive: (view: NotebookView | undefined) => void;
|
|
381
|
+
onActiveChanged: Event<NotebookView | undefined>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
//#region Protocol for drag & drop
|
|
385
|
+
export const DragAreaKey = Symbol('DragAreaKey');
|
|
386
|
+
|
|
387
|
+
export type MouseMode = 'multipleSelection' | 'mouseDown' | 'drag';
|
|
388
|
+
|
|
389
|
+
export interface DndListModel {
|
|
390
|
+
mouseMode?: MouseMode;
|
|
391
|
+
active?: CellView | undefined;
|
|
392
|
+
hover?: CellView | undefined;
|
|
393
|
+
selectCell: (cell?: CellView) => void;
|
|
394
|
+
addCell: (cell: CellView, position?: number, mode?: string) => void;
|
|
395
|
+
insertCells: (cells: CellView[], position?: number, mode?: string) => void;
|
|
396
|
+
invertCell: (toAddcell: CellView, position: number) => void;
|
|
397
|
+
splitCell: (newCells: CellView[], position: number) => void;
|
|
398
|
+
deleteCell: {
|
|
399
|
+
(id: string): boolean;
|
|
400
|
+
(index: number): boolean;
|
|
401
|
+
(cell: CellView): boolean;
|
|
402
|
+
};
|
|
403
|
+
exchangeCell: {
|
|
404
|
+
(source: CellView, target: CellView): boolean;
|
|
405
|
+
(sourceIndex: number, targetIndex: number): boolean;
|
|
406
|
+
(sourceId: string, targetId: string): boolean;
|
|
407
|
+
};
|
|
408
|
+
exchangeCells: (source: CellView[], targetIndex: number) => void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface DndContentProps {
|
|
412
|
+
cell: CellView;
|
|
413
|
+
index: number;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export interface DndItemProps {
|
|
417
|
+
isDragOver: boolean;
|
|
418
|
+
isDrag: boolean;
|
|
419
|
+
cell: CellView;
|
|
420
|
+
isMouseOverDragArea?: boolean;
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
|
|
424
|
+
export interface VirtualizedManagerOption {
|
|
425
|
+
libroModel: NotebookModel;
|
|
426
|
+
}
|
|
427
|
+
export const VirtualizedManagerOption = Symbol('VirtualizedManagerOption');
|
|
428
|
+
|
|
429
|
+
export const VirtualizedManagerOptionFactory = Symbol(
|
|
430
|
+
'VirtualizedManagerOptionFactory',
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
export type VirtualizedManagerOptionFactory = (
|
|
434
|
+
meta: VirtualizedManagerOption,
|
|
435
|
+
) => VirtualizedManager;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { Disposable } from '@difizen/mana-app';
|
|
2
|
+
import { DisposableCollection, Emitter } from '@difizen/mana-app';
|
|
3
|
+
import { ThemeService, ViewManager } from '@difizen/mana-app';
|
|
4
|
+
import { inject, singleton } from '@difizen/mana-app';
|
|
5
|
+
import { prop } from '@difizen/mana-app';
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
CellView,
|
|
9
|
+
ICellContentChange,
|
|
10
|
+
NotebookOption,
|
|
11
|
+
NotebookView,
|
|
12
|
+
} from './libro-protocol.js';
|
|
13
|
+
import {
|
|
14
|
+
notebookViewFactoryId,
|
|
15
|
+
ModelFactory,
|
|
16
|
+
NotebookService,
|
|
17
|
+
} from './libro-protocol.js';
|
|
18
|
+
import { LibroViewTracker } from './libro-view-tracker.js';
|
|
19
|
+
|
|
20
|
+
export interface NotebookViewChange {
|
|
21
|
+
libroView: NotebookView;
|
|
22
|
+
contentChanges: Array<{
|
|
23
|
+
range: {
|
|
24
|
+
start: number;
|
|
25
|
+
end: number;
|
|
26
|
+
};
|
|
27
|
+
addedCells: CellView[];
|
|
28
|
+
removedCells: CellView[];
|
|
29
|
+
}>;
|
|
30
|
+
cellChanges: Array<{
|
|
31
|
+
cell: CellView;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@singleton({ contrib: NotebookService })
|
|
36
|
+
export class LibroService implements NotebookService, Disposable {
|
|
37
|
+
protected toDispose = new DisposableCollection();
|
|
38
|
+
@inject(ModelFactory) protected libroModelFactory: ModelFactory;
|
|
39
|
+
@inject(ViewManager) protected viewManager: ViewManager;
|
|
40
|
+
@inject(LibroViewTracker) protected libroViewTracker: LibroViewTracker;
|
|
41
|
+
protected themeService: ThemeService;
|
|
42
|
+
@prop()
|
|
43
|
+
themeMode: string;
|
|
44
|
+
|
|
45
|
+
@prop()
|
|
46
|
+
hasFormatter = false;
|
|
47
|
+
|
|
48
|
+
constructor(@inject(ThemeService) themeService: ThemeService) {
|
|
49
|
+
this.themeService = themeService;
|
|
50
|
+
this.themeMode = this.themeService.getCurrentTheme().type;
|
|
51
|
+
this.themeService.onDidColorThemeChange((e) => {
|
|
52
|
+
this.themeMode = e.newTheme.type;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@prop() protected _active?: NotebookView;
|
|
57
|
+
protected onActiveChangedEmitter: Emitter<NotebookView | undefined> = new Emitter();
|
|
58
|
+
get onActiveChanged() {
|
|
59
|
+
return this.onActiveChangedEmitter.event;
|
|
60
|
+
}
|
|
61
|
+
get active(): NotebookView | undefined {
|
|
62
|
+
return this._active;
|
|
63
|
+
}
|
|
64
|
+
set active(value: NotebookView | undefined) {
|
|
65
|
+
this._active = value;
|
|
66
|
+
this.onActiveChangedEmitter.fire(value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@prop() protected _focus?: NotebookView;
|
|
70
|
+
protected onFocusChangedEmitter: Emitter<NotebookView | undefined> = new Emitter();
|
|
71
|
+
get onFocusChanged() {
|
|
72
|
+
return this.onFocusChangedEmitter.event;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected onNotebookViewCreatedEmitter: Emitter<NotebookView> = new Emitter();
|
|
76
|
+
get onNotebookViewCreated() {
|
|
77
|
+
return this.onNotebookViewCreatedEmitter.event;
|
|
78
|
+
}
|
|
79
|
+
protected onNotebookViewSavedEmitter: Emitter<NotebookView> = new Emitter();
|
|
80
|
+
get onNotebookViewSaved() {
|
|
81
|
+
return this.onNotebookViewSavedEmitter.event;
|
|
82
|
+
}
|
|
83
|
+
protected onNotebookViewChangedEmitter: Emitter<NotebookViewChange> = new Emitter();
|
|
84
|
+
get onNotebookViewChanged() {
|
|
85
|
+
return this.onNotebookViewChangedEmitter.event;
|
|
86
|
+
}
|
|
87
|
+
protected onNotebookViewClosedEmitter: Emitter<NotebookView> = new Emitter();
|
|
88
|
+
get onNotebookViewClosed() {
|
|
89
|
+
return this.onNotebookViewClosedEmitter.event;
|
|
90
|
+
}
|
|
91
|
+
protected onNotebookCellCreatedEmitter: Emitter<CellView[]> = new Emitter();
|
|
92
|
+
get onNotebookCellCreated() {
|
|
93
|
+
return this.onNotebookCellCreatedEmitter.event;
|
|
94
|
+
}
|
|
95
|
+
protected onNotebookCellSavedEmitter: Emitter<CellView[]> = new Emitter();
|
|
96
|
+
get onNotebookCellSaved() {
|
|
97
|
+
return this.onNotebookCellSavedEmitter.event;
|
|
98
|
+
}
|
|
99
|
+
protected onNotebookCellChangedEmitter: Emitter<ICellContentChange> = new Emitter();
|
|
100
|
+
get onNotebookCellChanged() {
|
|
101
|
+
return this.onNotebookCellChangedEmitter.event;
|
|
102
|
+
}
|
|
103
|
+
protected onNotebookCellDeletedEmitter: Emitter<CellView[]> = new Emitter();
|
|
104
|
+
get onNotebookCellDeleted() {
|
|
105
|
+
return this.onNotebookCellDeletedEmitter.event;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get focus(): NotebookView | undefined {
|
|
109
|
+
return this._focus;
|
|
110
|
+
}
|
|
111
|
+
set focus(value: NotebookView | undefined) {
|
|
112
|
+
this._focus = value;
|
|
113
|
+
this.onFocusChangedEmitter.fire(value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get hasFocus(): boolean {
|
|
117
|
+
return this._hasFocus;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
getViewCache(): Map<string, NotebookView> {
|
|
121
|
+
return this.libroViewTracker.viewCache;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
deleteLibroViewFromCache(instance: NotebookView) {
|
|
125
|
+
this.onNotebookViewClosedEmitter.fire(instance);
|
|
126
|
+
this.libroViewTracker.viewCache.delete(instance.id);
|
|
127
|
+
this.libroViewTracker.modelCache.delete(instance.model.id);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@prop()
|
|
131
|
+
protected _hasFocus = false;
|
|
132
|
+
|
|
133
|
+
getOrCreateModel(options: NotebookOption) {
|
|
134
|
+
if (options.modelId) {
|
|
135
|
+
const exist = this.libroViewTracker.modelCache.get(options.modelId);
|
|
136
|
+
if (exist) {
|
|
137
|
+
return exist;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const model = this.libroModelFactory(options);
|
|
141
|
+
this.libroViewTracker.modelCache.set(options.modelId || model.id, model);
|
|
142
|
+
return model;
|
|
143
|
+
}
|
|
144
|
+
async getOrCreateView(options: NotebookOption): Promise<NotebookView> {
|
|
145
|
+
const model = this.getOrCreateModel(options);
|
|
146
|
+
const notebookViewPromise = this.viewManager.getOrCreateView<NotebookView>(
|
|
147
|
+
notebookViewFactoryId,
|
|
148
|
+
{
|
|
149
|
+
...(options || {}),
|
|
150
|
+
modelId: model.id,
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
const notebookView = await notebookViewPromise;
|
|
154
|
+
if (!this.libroViewTracker.viewCache.has(notebookView.id)) {
|
|
155
|
+
this.watchNotebookView(notebookView);
|
|
156
|
+
}
|
|
157
|
+
this.libroViewTracker.viewCache.set(notebookView.id, notebookView);
|
|
158
|
+
|
|
159
|
+
return notebookViewPromise;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
protected watchNotebookView(view: NotebookView) {
|
|
163
|
+
view.initialized
|
|
164
|
+
.then(() => {
|
|
165
|
+
return this.onNotebookViewCreatedEmitter.fire(view);
|
|
166
|
+
})
|
|
167
|
+
.catch(() => {
|
|
168
|
+
//
|
|
169
|
+
});
|
|
170
|
+
this.toDispose.push(
|
|
171
|
+
view.onSave(() => {
|
|
172
|
+
this.onNotebookViewSavedEmitter.fire(view);
|
|
173
|
+
}),
|
|
174
|
+
);
|
|
175
|
+
this.toDispose.push(
|
|
176
|
+
view.model.onCellContentChanged((e) => {
|
|
177
|
+
this.onNotebookCellChangedEmitter.fire(e);
|
|
178
|
+
}),
|
|
179
|
+
);
|
|
180
|
+
this.toDispose.push(
|
|
181
|
+
view.model.onCellViewChanged((e) => {
|
|
182
|
+
const changes: NotebookViewChange = {
|
|
183
|
+
libroView: view,
|
|
184
|
+
cellChanges: [],
|
|
185
|
+
contentChanges: [],
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
if (e.delete) {
|
|
189
|
+
changes.contentChanges.push({
|
|
190
|
+
range: {
|
|
191
|
+
start: e.delete.index,
|
|
192
|
+
end: e.delete.index + e.delete?.number,
|
|
193
|
+
},
|
|
194
|
+
removedCells: e.delete.cells,
|
|
195
|
+
addedCells: [],
|
|
196
|
+
});
|
|
197
|
+
this.onNotebookCellDeletedEmitter.fire(e.delete.cells);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (e.insert) {
|
|
201
|
+
changes.contentChanges.push({
|
|
202
|
+
range: {
|
|
203
|
+
start: e.insert.index,
|
|
204
|
+
end: e.insert.index + e.insert?.cells.length,
|
|
205
|
+
},
|
|
206
|
+
removedCells: [],
|
|
207
|
+
addedCells: e.insert.cells,
|
|
208
|
+
});
|
|
209
|
+
this.onNotebookCellCreatedEmitter.fire(e.insert.cells);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
this.onNotebookViewChangedEmitter.fire(changes);
|
|
213
|
+
}),
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
setActive(view?: NotebookView): void {
|
|
218
|
+
this._active = view;
|
|
219
|
+
this.onActiveChangedEmitter.fire(view);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
setHasFocus(hasFocus: boolean): void {
|
|
223
|
+
this._hasFocus = hasFocus;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
protected isDisposed = false;
|
|
227
|
+
get disposed() {
|
|
228
|
+
return this.isDisposed;
|
|
229
|
+
}
|
|
230
|
+
dispose() {
|
|
231
|
+
this.toDispose.dispose();
|
|
232
|
+
this.isDisposed = true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { singleton, ConfigurationContribution } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AutoInsertWhenNoCell,
|
|
5
|
+
CellSideToolbarVisible,
|
|
6
|
+
CellTopToolbarSetting,
|
|
7
|
+
CollapserClickActive,
|
|
8
|
+
EnterEditModeWhenAddCell,
|
|
9
|
+
HeaderToolbarVisible,
|
|
10
|
+
MultiSelectionWhenShiftClick,
|
|
11
|
+
RightContentFixed,
|
|
12
|
+
} from './libro-setting.js';
|
|
13
|
+
|
|
14
|
+
@singleton({ contrib: ConfigurationContribution })
|
|
15
|
+
export class LibroSettingContribution implements ConfigurationContribution {
|
|
16
|
+
registerConfigurations() {
|
|
17
|
+
return [
|
|
18
|
+
HeaderToolbarVisible,
|
|
19
|
+
CellTopToolbarSetting,
|
|
20
|
+
CellSideToolbarVisible,
|
|
21
|
+
AutoInsertWhenNoCell,
|
|
22
|
+
EnterEditModeWhenAddCell,
|
|
23
|
+
CollapserClickActive,
|
|
24
|
+
MultiSelectionWhenShiftClick,
|
|
25
|
+
RightContentFixed,
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|