@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,245 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _class, _class2, _descriptor;
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
16
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
17
|
+
import { Priority, prop } from '@difizen/mana-app';
|
|
18
|
+
import { ApplicationContribution, ViewManager } from '@difizen/mana-app';
|
|
19
|
+
import { contrib, inject, singleton } from '@difizen/mana-app';
|
|
20
|
+
import { LibroService } from "../libro-service.js";
|
|
21
|
+
import { CellService, getLibroCellType, CellViewContribution, CellModelContribution } from "./libro-cell-protocol.js";
|
|
22
|
+
export var LibroCellService = (_dec = singleton({
|
|
23
|
+
contrib: [CellService, ApplicationContribution]
|
|
24
|
+
}), _dec2 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
25
|
+
function LibroCellService(viewManager, libroService, modelProvider, viewProvider) {
|
|
26
|
+
_classCallCheck(this, LibroCellService);
|
|
27
|
+
_initializerDefineProperty(this, "cellsMeta", _descriptor, this);
|
|
28
|
+
this.modelProvider = void 0;
|
|
29
|
+
this.viewProvider = void 0;
|
|
30
|
+
this.cellTypeToModelContribution = new Map();
|
|
31
|
+
this.viewManager = void 0;
|
|
32
|
+
this.modelCache = new Map();
|
|
33
|
+
this.libroService = void 0;
|
|
34
|
+
this.modelProvider = modelProvider;
|
|
35
|
+
this.viewProvider = viewProvider;
|
|
36
|
+
this.viewManager = viewManager;
|
|
37
|
+
this.libroService = libroService;
|
|
38
|
+
}
|
|
39
|
+
LibroCellService = contrib(CellViewContribution)(LibroCellService, undefined, 3) || LibroCellService;
|
|
40
|
+
LibroCellService = contrib(CellModelContribution)(LibroCellService, undefined, 2) || LibroCellService;
|
|
41
|
+
LibroCellService = inject(LibroService)(LibroCellService, undefined, 1) || LibroCellService;
|
|
42
|
+
LibroCellService = inject(ViewManager)(LibroCellService, undefined, 0) || LibroCellService;
|
|
43
|
+
_createClass(LibroCellService, [{
|
|
44
|
+
key: "getContributionDefaultCellOption",
|
|
45
|
+
value: function getContributionDefaultCellOption(ctb) {
|
|
46
|
+
if (ctb.getDefaultCellOption) {
|
|
47
|
+
return ctb.getDefaultCellOption();
|
|
48
|
+
}
|
|
49
|
+
return this.cellTypeToOption(ctb.cellMeta.type);
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "initialize",
|
|
53
|
+
value: function initialize() {
|
|
54
|
+
var _this = this;
|
|
55
|
+
var prioritized = this.getDefaultOptionModelContributionPrioritized();
|
|
56
|
+
var metas = [];
|
|
57
|
+
prioritized.forEach(function (item) {
|
|
58
|
+
if (!_this.cellTypeToModelContribution.get(item.cellMeta.type)) {
|
|
59
|
+
_this.cellTypeToModelContribution.set(item.cellMeta.type, item);
|
|
60
|
+
metas.push(item.cellMeta);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
metas.sort(function (a, b) {
|
|
64
|
+
return a.order.localeCompare(b.order);
|
|
65
|
+
});
|
|
66
|
+
this.cellsMeta = metas;
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "getDefaultCellOption",
|
|
70
|
+
value: function getDefaultCellOption(cellType) {
|
|
71
|
+
var contribution = this.cellTypeToModelContribution.get(cellType);
|
|
72
|
+
if (!contribution) {
|
|
73
|
+
throw new Error("no cell model contribution found for cell type ".concat(cellType));
|
|
74
|
+
}
|
|
75
|
+
return this.getContributionDefaultCellOption(contribution);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "cellTypeToOption",
|
|
79
|
+
value: function cellTypeToOption(cellType) {
|
|
80
|
+
return {
|
|
81
|
+
cell: {
|
|
82
|
+
cell_type: cellType,
|
|
83
|
+
source: '',
|
|
84
|
+
metadata: {}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "getModelFromCache",
|
|
90
|
+
value: function getModelFromCache(groupId, modelId) {
|
|
91
|
+
var _this$modelCache$get;
|
|
92
|
+
return (_this$modelCache$get = this.modelCache.get(groupId)) === null || _this$modelCache$get === void 0 ? void 0 : _this$modelCache$get.get(modelId);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
96
|
+
}, {
|
|
97
|
+
key: "getOrCreateModel",
|
|
98
|
+
value: function () {
|
|
99
|
+
var _getOrCreateModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
100
|
+
var cacheGroupId,
|
|
101
|
+
cellmodelCache,
|
|
102
|
+
_this$modelCache$get2,
|
|
103
|
+
exist,
|
|
104
|
+
modelProvider,
|
|
105
|
+
model,
|
|
106
|
+
_args = arguments;
|
|
107
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
108
|
+
while (1) switch (_context.prev = _context.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
cacheGroupId = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
|
|
111
|
+
cellmodelCache = this.modelCache.get(cacheGroupId);
|
|
112
|
+
if (!cellmodelCache) {
|
|
113
|
+
cellmodelCache = new Map();
|
|
114
|
+
this.modelCache.set(cacheGroupId, cellmodelCache);
|
|
115
|
+
}
|
|
116
|
+
if (!options.modelId) {
|
|
117
|
+
_context.next = 7;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
exist = (_this$modelCache$get2 = this.modelCache.get(cacheGroupId)) === null || _this$modelCache$get2 === void 0 ? void 0 : _this$modelCache$get2.get(options.modelId);
|
|
121
|
+
if (!exist) {
|
|
122
|
+
_context.next = 7;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
return _context.abrupt("return", exist);
|
|
126
|
+
case 7:
|
|
127
|
+
modelProvider = this.findModelProvider(options);
|
|
128
|
+
if (modelProvider) {
|
|
129
|
+
_context.next = 10;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
throw new Error('no cell model provider found');
|
|
133
|
+
case 10:
|
|
134
|
+
_context.next = 12;
|
|
135
|
+
return modelProvider.createModel(options);
|
|
136
|
+
case 12:
|
|
137
|
+
model = _context.sent;
|
|
138
|
+
cellmodelCache.set(model.id, model);
|
|
139
|
+
return _context.abrupt("return", model);
|
|
140
|
+
case 15:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context.stop();
|
|
143
|
+
}
|
|
144
|
+
}, _callee, this);
|
|
145
|
+
}));
|
|
146
|
+
function getOrCreateModel(_x) {
|
|
147
|
+
return _getOrCreateModel.apply(this, arguments);
|
|
148
|
+
}
|
|
149
|
+
return getOrCreateModel;
|
|
150
|
+
}()
|
|
151
|
+
}, {
|
|
152
|
+
key: "getOrCreateView",
|
|
153
|
+
value: function () {
|
|
154
|
+
var _getOrCreateView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options, parentId) {
|
|
155
|
+
var model, viewProvider, cellViewPromise, cellView, parent;
|
|
156
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
157
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
_context2.next = 2;
|
|
160
|
+
return this.getOrCreateModel(options, parentId);
|
|
161
|
+
case 2:
|
|
162
|
+
model = _context2.sent;
|
|
163
|
+
viewProvider = this.findViewProvider(options);
|
|
164
|
+
if (viewProvider) {
|
|
165
|
+
_context2.next = 6;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
throw new Error('no cell view provider found');
|
|
169
|
+
case 6:
|
|
170
|
+
cellViewPromise = this.viewManager.getOrCreateView(viewProvider.view, _objectSpread(_objectSpread({}, options), {}, {
|
|
171
|
+
modelId: model.id,
|
|
172
|
+
parentId: parentId
|
|
173
|
+
}));
|
|
174
|
+
_context2.next = 9;
|
|
175
|
+
return cellViewPromise;
|
|
176
|
+
case 9:
|
|
177
|
+
cellView = _context2.sent;
|
|
178
|
+
parent = this.libroService.getViewCache().get(parentId);
|
|
179
|
+
if (parent) {
|
|
180
|
+
cellView.parent = parent;
|
|
181
|
+
}
|
|
182
|
+
return _context2.abrupt("return", cellView);
|
|
183
|
+
case 13:
|
|
184
|
+
case "end":
|
|
185
|
+
return _context2.stop();
|
|
186
|
+
}
|
|
187
|
+
}, _callee2, this);
|
|
188
|
+
}));
|
|
189
|
+
function getOrCreateView(_x2, _x3) {
|
|
190
|
+
return _getOrCreateView.apply(this, arguments);
|
|
191
|
+
}
|
|
192
|
+
return getOrCreateView;
|
|
193
|
+
}()
|
|
194
|
+
}, {
|
|
195
|
+
key: "findViewProvider",
|
|
196
|
+
value: function findViewProvider(options) {
|
|
197
|
+
var _this2 = this;
|
|
198
|
+
var prioritized = Priority.sortSync(this.viewProvider.getContributions(), function (contribution) {
|
|
199
|
+
return _this2.canHandleOption(contribution, options);
|
|
200
|
+
});
|
|
201
|
+
var sorted = prioritized.map(function (c) {
|
|
202
|
+
return c.value;
|
|
203
|
+
});
|
|
204
|
+
return sorted[0];
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "findModelProvider",
|
|
208
|
+
value: function findModelProvider(options) {
|
|
209
|
+
var _this3 = this;
|
|
210
|
+
var prioritized = Priority.sortSync(this.modelProvider.getContributions(), function (contribution) {
|
|
211
|
+
return _this3.canHandleOption(contribution, options);
|
|
212
|
+
});
|
|
213
|
+
var sorted = prioritized.map(function (c) {
|
|
214
|
+
return c.value;
|
|
215
|
+
});
|
|
216
|
+
return sorted[0];
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "getDefaultOptionModelContributionPrioritized",
|
|
220
|
+
value: function getDefaultOptionModelContributionPrioritized() {
|
|
221
|
+
var _this4 = this;
|
|
222
|
+
var prioritized = Priority.sortSync(this.modelProvider.getContributions(), function (contribution) {
|
|
223
|
+
var options = _this4.getContributionDefaultCellOption(contribution);
|
|
224
|
+
return _this4.canHandleOption(contribution, options);
|
|
225
|
+
});
|
|
226
|
+
var sorted = prioritized.map(function (c) {
|
|
227
|
+
return c.value;
|
|
228
|
+
});
|
|
229
|
+
return sorted;
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "canHandleOption",
|
|
233
|
+
value: function canHandleOption(ctb, options) {
|
|
234
|
+
return ctb.canHandle(options, getLibroCellType(options));
|
|
235
|
+
}
|
|
236
|
+
}]);
|
|
237
|
+
return LibroCellService;
|
|
238
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "cellsMeta", [_dec2], {
|
|
239
|
+
configurable: true,
|
|
240
|
+
enumerable: true,
|
|
241
|
+
writable: true,
|
|
242
|
+
initializer: function initializer() {
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ViewComponent } from '@difizen/mana-app';
|
|
2
|
+
import { Deferred } from '@difizen/mana-app';
|
|
3
|
+
import { BaseView } from '@difizen/mana-app';
|
|
4
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { CellViewOptions, CellModel } from '../libro-protocol.js';
|
|
7
|
+
import type { CellView, NotebookView } from '../libro-protocol.js';
|
|
8
|
+
import { CellService } from './libro-cell-protocol.js';
|
|
9
|
+
import type { LibroCell } from './libro-cell-protocol.js';
|
|
10
|
+
export declare const LibroCellComponent: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
11
|
+
export declare class LibroCellView extends BaseView implements CellView {
|
|
12
|
+
protected toDispose: DisposableCollection;
|
|
13
|
+
options: CellViewOptions;
|
|
14
|
+
noEditorAreaHeight: number;
|
|
15
|
+
cellViewTopPos: number;
|
|
16
|
+
renderEditorIntoVirtualized: boolean;
|
|
17
|
+
model: CellModel;
|
|
18
|
+
protected cellService: CellService;
|
|
19
|
+
view: ViewComponent;
|
|
20
|
+
protected _parent: NotebookView;
|
|
21
|
+
get parent(): NotebookView;
|
|
22
|
+
set parent(value: NotebookView);
|
|
23
|
+
protected parentDefer: Deferred<import("../libro-view.js").LibroView>;
|
|
24
|
+
get parentReady(): Promise<import("../libro-view.js").LibroView>;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
hasInputHidden: boolean;
|
|
27
|
+
collapsedHidden: boolean;
|
|
28
|
+
hasModal: boolean;
|
|
29
|
+
constructor(options: CellViewOptions, cellService: CellService);
|
|
30
|
+
cellWatch(): void;
|
|
31
|
+
calcEditorOffset(): number;
|
|
32
|
+
hasCellHidden(): boolean;
|
|
33
|
+
run(): Promise<boolean>;
|
|
34
|
+
shouldEnterEditorMode(e: React.FocusEvent<HTMLElement>): boolean;
|
|
35
|
+
blur(): void;
|
|
36
|
+
focus(isEdit: boolean): void;
|
|
37
|
+
disposed: boolean;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
toJSON(): LibroCell;
|
|
40
|
+
toJSONWithoutId: () => {
|
|
41
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
cell_type: "raw";
|
|
44
|
+
metadata: Partial<import("@difizen/libro-common").IRawCellMetadata>;
|
|
45
|
+
attachments?: import("@difizen/libro-common").IAttachments | undefined;
|
|
46
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
47
|
+
} | {
|
|
48
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
49
|
+
cell_type: string;
|
|
50
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
51
|
+
metadata: Partial<import("@difizen/libro-common").ICellMetadata>;
|
|
52
|
+
} | {
|
|
53
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
54
|
+
id?: string | undefined;
|
|
55
|
+
cell_type: "markdown";
|
|
56
|
+
attachments?: import("@difizen/libro-common").IAttachments | undefined;
|
|
57
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
58
|
+
metadata: Partial<import("@difizen/libro-common").ICellMetadata>;
|
|
59
|
+
} | {
|
|
60
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
cell_type: string;
|
|
63
|
+
metadata: Partial<import("@difizen/libro-common").ICodeCellMetadata>;
|
|
64
|
+
outputs: import("@difizen/libro-common").IOutput[];
|
|
65
|
+
execution_count: import("@difizen/libro-common").ExecutionCount;
|
|
66
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
67
|
+
} | {
|
|
68
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
69
|
+
metadata: Partial<import("./libro-cell-protocol.js").LibroCellMetadata>;
|
|
70
|
+
cell_type: string;
|
|
71
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=libro-cell-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/libro-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAkC,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1D,eAAO,MAAM,kBAAkB,+DAG7B,CAAC;AAEH,qBACa,aAAc,SAAQ,QAAS,YAAW,QAAQ;IAC7D,UAAmB,SAAS,uBAA8B;IAC1D,OAAO,EAAE,eAAe,CAAC;IAGzB,kBAAkB,SAAK;IAGvB,cAAc,SAAK;IAGnB,2BAA2B,UAAS;IAGpC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAsB;IAElD,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IAEhC,IAAI,MAAM,IAGQ,YAAY,CAD7B;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,EAG7B;IAED,SAAS,CAAC,WAAW,iDAAgC;IAErD,IAAI,WAAW,kDAEd;IAGQ,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAA+B;IAGtE,cAAc,EAAE,OAAO,CAAC;IAGxB,eAAe,UAAS;IAGxB,QAAQ,UAAS;gBAGK,OAAO,EAAE,eAAe,EACvB,WAAW,EAAE,WAAW;IAe/C,SAAS;IAuBT,gBAAgB;IAIhB,aAAa;IAIP,GAAG;IAKT,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAItD,IAAI;IAIJ,KAAK,CAAC,MAAM,EAAE,OAAO;IAIrB,QAAQ,UAAS;IACR,OAAO;IAIhB,MAAM,IAAI,SAAS;IAUnB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMb;CACH"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
4
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
16
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
17
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
20
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
21
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
25
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
26
|
+
import { Deferred } from '@difizen/mana-app';
|
|
27
|
+
import { useInject, watch } from '@difizen/mana-app';
|
|
28
|
+
import { BaseView, view, ViewInstance, ViewOption } from '@difizen/mana-app';
|
|
29
|
+
import { inject } from '@difizen/mana-app';
|
|
30
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
31
|
+
import { prop } from '@difizen/mana-app';
|
|
32
|
+
import React from 'react';
|
|
33
|
+
import { CellService } from "./libro-cell-protocol.js";
|
|
34
|
+
import { ExecutableCellModel } from "./libro-executable-cell-model.js";
|
|
35
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
36
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
37
|
+
export var LibroCellComponent = /*#__PURE__*/React.forwardRef(function LibroCellComponent() {
|
|
38
|
+
var instance = useInject(ViewInstance);
|
|
39
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
40
|
+
children: instance.model.value
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
export var LibroCellView = (_dec = view('libro-cell-view'), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
44
|
+
_inherits(LibroCellView, _BaseView);
|
|
45
|
+
var _super = _createSuper(LibroCellView);
|
|
46
|
+
function LibroCellView(options, cellService) {
|
|
47
|
+
var _this;
|
|
48
|
+
_classCallCheck(this, LibroCellView);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
_this.toDispose = new DisposableCollection();
|
|
51
|
+
_this.options = void 0;
|
|
52
|
+
_initializerDefineProperty(_this, "noEditorAreaHeight", _descriptor, _assertThisInitialized(_this));
|
|
53
|
+
_initializerDefineProperty(_this, "cellViewTopPos", _descriptor2, _assertThisInitialized(_this));
|
|
54
|
+
_initializerDefineProperty(_this, "renderEditorIntoVirtualized", _descriptor3, _assertThisInitialized(_this));
|
|
55
|
+
_initializerDefineProperty(_this, "model", _descriptor4, _assertThisInitialized(_this));
|
|
56
|
+
_this.cellService = void 0;
|
|
57
|
+
_this.view = LibroCellComponent;
|
|
58
|
+
_this._parent = void 0;
|
|
59
|
+
_this.parentDefer = new Deferred();
|
|
60
|
+
_initializerDefineProperty(_this, "className", _descriptor5, _assertThisInitialized(_this));
|
|
61
|
+
_initializerDefineProperty(_this, "hasInputHidden", _descriptor6, _assertThisInitialized(_this));
|
|
62
|
+
_initializerDefineProperty(_this, "collapsedHidden", _descriptor7, _assertThisInitialized(_this));
|
|
63
|
+
_initializerDefineProperty(_this, "hasModal", _descriptor8, _assertThisInitialized(_this));
|
|
64
|
+
_this.disposed = false;
|
|
65
|
+
_this.toJSONWithoutId = function () {
|
|
66
|
+
var JsonObject = _this.toJSON();
|
|
67
|
+
delete JsonObject.id;
|
|
68
|
+
return _objectSpread({}, JsonObject);
|
|
69
|
+
};
|
|
70
|
+
_this.cellService = cellService;
|
|
71
|
+
_this.options = options;
|
|
72
|
+
_this.hasInputHidden = false;
|
|
73
|
+
var model = cellService.getModelFromCache(options.parentId, options.modelId);
|
|
74
|
+
if (!model) {
|
|
75
|
+
console.warn('cell model does not exist');
|
|
76
|
+
throw new Error('cell model does not exist');
|
|
77
|
+
}
|
|
78
|
+
_this.model = model;
|
|
79
|
+
_this.cellWatch();
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
LibroCellView = inject(CellService)(LibroCellView, undefined, 1) || LibroCellView;
|
|
83
|
+
LibroCellView = inject(ViewOption)(LibroCellView, undefined, 0) || LibroCellView;
|
|
84
|
+
_createClass(LibroCellView, [{
|
|
85
|
+
key: "parent",
|
|
86
|
+
get: function get() {
|
|
87
|
+
return this._parent;
|
|
88
|
+
},
|
|
89
|
+
set: function set(value) {
|
|
90
|
+
this._parent = value;
|
|
91
|
+
this.parentDefer.resolve(this.parent);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "parentReady",
|
|
95
|
+
get: function get() {
|
|
96
|
+
return this.parentDefer.promise;
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "cellWatch",
|
|
100
|
+
value: function cellWatch() {
|
|
101
|
+
var _this2 = this;
|
|
102
|
+
this.toDispose.push(watch(this.model, 'value', function () {
|
|
103
|
+
var _this2$parent$model$o, _this2$parent$model, _this2$parent$model$o2, _this2$parent$model2;
|
|
104
|
+
(_this2$parent$model$o = (_this2$parent$model = _this2.parent.model).onChange) === null || _this2$parent$model$o === void 0 || _this2$parent$model$o.call(_this2$parent$model);
|
|
105
|
+
(_this2$parent$model$o2 = (_this2$parent$model2 = _this2.parent.model).onSourceChange) === null || _this2$parent$model$o2 === void 0 || _this2$parent$model$o2.call(_this2$parent$model2, [_this2]);
|
|
106
|
+
}));
|
|
107
|
+
this.toDispose.push(watch(this.model, 'type', function () {
|
|
108
|
+
var _this2$parent$model$o3, _this2$parent$model3, _this2$parent$model$o4, _this2$parent$model4;
|
|
109
|
+
(_this2$parent$model$o3 = (_this2$parent$model3 = _this2.parent.model).onChange) === null || _this2$parent$model$o3 === void 0 || _this2$parent$model$o3.call(_this2$parent$model3);
|
|
110
|
+
(_this2$parent$model$o4 = (_this2$parent$model4 = _this2.parent.model).onSourceChange) === null || _this2$parent$model$o4 === void 0 || _this2$parent$model$o4.call(_this2$parent$model4, [_this2]);
|
|
111
|
+
}));
|
|
112
|
+
if (ExecutableCellModel.is(this.model)) {
|
|
113
|
+
this.toDispose.push(watch(this.model, 'executeCount', function () {
|
|
114
|
+
var _this2$parent$model$o5, _this2$parent$model5;
|
|
115
|
+
(_this2$parent$model$o5 = (_this2$parent$model5 = _this2.parent.model).onChange) === null || _this2$parent$model$o5 === void 0 || _this2$parent$model$o5.call(_this2$parent$model5);
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 计算编辑器区相对于编辑器区垂直方向的偏移量
|
|
121
|
+
}, {
|
|
122
|
+
key: "calcEditorOffset",
|
|
123
|
+
value: function calcEditorOffset() {
|
|
124
|
+
return 16 + 1;
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "hasCellHidden",
|
|
128
|
+
value: function hasCellHidden() {
|
|
129
|
+
return this.hasInputHidden;
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "run",
|
|
133
|
+
value: function () {
|
|
134
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
135
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
136
|
+
while (1) switch (_context.prev = _context.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
return _context.abrupt("return", Promise.resolve(true));
|
|
139
|
+
case 1:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee);
|
|
144
|
+
}));
|
|
145
|
+
function run() {
|
|
146
|
+
return _run.apply(this, arguments);
|
|
147
|
+
}
|
|
148
|
+
return run;
|
|
149
|
+
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
150
|
+
}, {
|
|
151
|
+
key: "shouldEnterEditorMode",
|
|
152
|
+
value: function shouldEnterEditorMode(e) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "blur",
|
|
157
|
+
value: function blur() {
|
|
158
|
+
//
|
|
159
|
+
}
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
161
|
+
}, {
|
|
162
|
+
key: "focus",
|
|
163
|
+
value: function focus(isEdit) {
|
|
164
|
+
//
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: "dispose",
|
|
168
|
+
value: function dispose() {
|
|
169
|
+
this.toDispose.dispose();
|
|
170
|
+
_get(_getPrototypeOf(LibroCellView.prototype), "dispose", this).call(this);
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "toJSON",
|
|
174
|
+
value: function toJSON() {
|
|
175
|
+
var meta = _objectSpread(_objectSpread({}, this.model.toJSON()), {}, {
|
|
176
|
+
outputs: []
|
|
177
|
+
});
|
|
178
|
+
var modelContribution = this.cellService.findModelProvider(this.model.options);
|
|
179
|
+
if (modelContribution !== null && modelContribution !== void 0 && modelContribution.cellMeta.nbformatType) {
|
|
180
|
+
meta.metadata.libroCellType = modelContribution === null || modelContribution === void 0 ? void 0 : modelContribution.cellMeta.type;
|
|
181
|
+
meta.cell_type = modelContribution === null || modelContribution === void 0 ? void 0 : modelContribution.cellMeta.nbformatType;
|
|
182
|
+
}
|
|
183
|
+
return meta;
|
|
184
|
+
}
|
|
185
|
+
}]);
|
|
186
|
+
return LibroCellView;
|
|
187
|
+
}(BaseView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "noEditorAreaHeight", [_dec2], {
|
|
188
|
+
configurable: true,
|
|
189
|
+
enumerable: true,
|
|
190
|
+
writable: true,
|
|
191
|
+
initializer: function initializer() {
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "cellViewTopPos", [_dec3], {
|
|
195
|
+
configurable: true,
|
|
196
|
+
enumerable: true,
|
|
197
|
+
writable: true,
|
|
198
|
+
initializer: function initializer() {
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "renderEditorIntoVirtualized", [_dec4], {
|
|
202
|
+
configurable: true,
|
|
203
|
+
enumerable: true,
|
|
204
|
+
writable: true,
|
|
205
|
+
initializer: function initializer() {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "model", [_dec5], {
|
|
209
|
+
configurable: true,
|
|
210
|
+
enumerable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
initializer: null
|
|
213
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "className", [_dec6], {
|
|
214
|
+
configurable: true,
|
|
215
|
+
enumerable: true,
|
|
216
|
+
writable: true,
|
|
217
|
+
initializer: function initializer() {
|
|
218
|
+
return 'libro-cell-view-container';
|
|
219
|
+
}
|
|
220
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "hasInputHidden", [_dec7], {
|
|
221
|
+
configurable: true,
|
|
222
|
+
enumerable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
initializer: null
|
|
225
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "collapsedHidden", [_dec8], {
|
|
226
|
+
configurable: true,
|
|
227
|
+
enumerable: true,
|
|
228
|
+
writable: true,
|
|
229
|
+
initializer: function initializer() {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "hasModal", [_dec9], {
|
|
233
|
+
configurable: true,
|
|
234
|
+
enumerable: true,
|
|
235
|
+
writable: true,
|
|
236
|
+
initializer: function initializer() {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CodeEditorView, CodeEditorViewOptions, IEditor } from '@difizen/libro-code-editor';
|
|
2
|
+
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
3
|
+
import { DisposableCollection } from '@difizen/mana-app';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import { LibroContextKey } from '../libro-context-key.js';
|
|
6
|
+
import type { CellView, CellViewOptions } from '../libro-protocol.js';
|
|
7
|
+
import { EditorStatus } from '../libro-protocol.js';
|
|
8
|
+
import { CellService } from './libro-cell-protocol.js';
|
|
9
|
+
import { LibroCellView } from './libro-cell-view.js';
|
|
10
|
+
export interface EditorCellView extends CellView {
|
|
11
|
+
editor: IEditor | undefined;
|
|
12
|
+
redo: () => void;
|
|
13
|
+
undo: () => void;
|
|
14
|
+
renderEditor: () => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const EditorCellView: {
|
|
17
|
+
is: (arg: Record<any, any> | undefined) => arg is EditorCellView;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 带有编辑器能力的cell view,例如raw、markdown、python、sql等
|
|
21
|
+
* 超出编辑器的相关能力放在其他的更高抽象中
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class LibroEditorCellView extends LibroCellView implements EditorCellView {
|
|
24
|
+
protected toDisposeOnEditor: DisposableCollection;
|
|
25
|
+
editor: IEditor | undefined;
|
|
26
|
+
protected readonly libroContextKey: LibroContextKey;
|
|
27
|
+
codeEditorManager: CodeEditorManager;
|
|
28
|
+
editorView?: CodeEditorView;
|
|
29
|
+
constructor(options: CellViewOptions, cellService: CellService);
|
|
30
|
+
protected getEditorOption(): CodeEditorViewOptions;
|
|
31
|
+
protected afterEditorReady(): Promise<void>;
|
|
32
|
+
createEditor(): Promise<void>;
|
|
33
|
+
editorStatus: EditorStatus;
|
|
34
|
+
renderEditor: () => import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
+
onViewMount(): void;
|
|
36
|
+
shouldEnterEditorMode(e: React.FocusEvent<HTMLElement>): boolean;
|
|
37
|
+
protected focusEditor(): void;
|
|
38
|
+
focus: (toEdit: boolean) => void;
|
|
39
|
+
blur: () => void;
|
|
40
|
+
get wrapperCls(): string;
|
|
41
|
+
redo(): void;
|
|
42
|
+
undo(): void;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=libro-edit-cell-view.d.ts.map
|