@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
package/src/module.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { CodeEditorModule } from '@difizen/libro-code-editor';
|
|
2
|
+
import { ConfigurationModule, ManaAppPreset } from '@difizen/mana-app';
|
|
3
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
4
|
+
|
|
5
|
+
import { LibroCellModule } from './cell/libro-cell-module.js';
|
|
6
|
+
import {
|
|
7
|
+
CollapseService,
|
|
8
|
+
CollapseServiceFactory,
|
|
9
|
+
CollapseServiceOption,
|
|
10
|
+
DefaultCollapseService,
|
|
11
|
+
} from './collapse-service.js';
|
|
12
|
+
import { LibroCommandModule } from './command/index.js';
|
|
13
|
+
import {
|
|
14
|
+
BetweenCellProvider,
|
|
15
|
+
CellExecutionTimeProvider,
|
|
16
|
+
CellInputBottonBlankProvider,
|
|
17
|
+
CellOutputBottomBlankProvider,
|
|
18
|
+
CellOutputVisulizationProvider,
|
|
19
|
+
LibroBetweenCellContent,
|
|
20
|
+
LibroCellExecutionTime,
|
|
21
|
+
LibroCellInputBottonBlank,
|
|
22
|
+
LibroCellOutputBottomBlank,
|
|
23
|
+
LibroCellVisualization,
|
|
24
|
+
} from './components/index.js';
|
|
25
|
+
import { LibroContentModule } from './content/index.js';
|
|
26
|
+
import { LibroFormatterModule } from './formatter/index.js';
|
|
27
|
+
import { LibroContextKey } from './libro-context-key.js';
|
|
28
|
+
import { LibroModel } from './libro-model.js';
|
|
29
|
+
import {
|
|
30
|
+
ModelFactory,
|
|
31
|
+
NotebookOption,
|
|
32
|
+
VirtualizedManagerOption,
|
|
33
|
+
VirtualizedManagerOptionFactory,
|
|
34
|
+
} from './libro-protocol.js';
|
|
35
|
+
import { LibroService } from './libro-service.js';
|
|
36
|
+
import { LibroSettingContribution } from './libro-setting-contribution.js';
|
|
37
|
+
import { LibroViewTracker } from './libro-view-tracker.js';
|
|
38
|
+
import { LibroView } from './libro-view.js';
|
|
39
|
+
import { BaseWorkspaceService } from './libro-workspace-service.js';
|
|
40
|
+
import { OutputModule } from './output/index.js';
|
|
41
|
+
import { LibroSlotModule } from './slot/index.js';
|
|
42
|
+
import { LibroColorRegistry } from './theme/libro-color-registry.js';
|
|
43
|
+
import { VirtualizedManagerHelper } from './virtualized-manager-helper.js';
|
|
44
|
+
import { VirtualizedManager } from './virtualized-manager.js';
|
|
45
|
+
|
|
46
|
+
export const LibroModule = ManaModule.create()
|
|
47
|
+
.register(
|
|
48
|
+
BaseWorkspaceService,
|
|
49
|
+
VirtualizedManager,
|
|
50
|
+
LibroService,
|
|
51
|
+
LibroContextKey,
|
|
52
|
+
LibroModel,
|
|
53
|
+
LibroView,
|
|
54
|
+
LibroSettingContribution,
|
|
55
|
+
LibroColorRegistry,
|
|
56
|
+
LibroViewTracker,
|
|
57
|
+
{
|
|
58
|
+
token: ModelFactory,
|
|
59
|
+
useFactory: (ctx) => {
|
|
60
|
+
return (options: NotebookOption) => {
|
|
61
|
+
const child = ctx.container.createChild();
|
|
62
|
+
child.register({ token: NotebookOption, useValue: options });
|
|
63
|
+
return child.get(LibroModel);
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
DefaultCollapseService,
|
|
68
|
+
{
|
|
69
|
+
token: CollapseServiceFactory,
|
|
70
|
+
useFactory: (ctx) => {
|
|
71
|
+
return (options: CollapseServiceOption) => {
|
|
72
|
+
const child = ctx.container.createChild();
|
|
73
|
+
child.register({ token: CollapseServiceOption, useValue: options });
|
|
74
|
+
return child.get(CollapseService);
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
VirtualizedManagerHelper,
|
|
79
|
+
VirtualizedManager,
|
|
80
|
+
{
|
|
81
|
+
token: VirtualizedManagerOptionFactory,
|
|
82
|
+
useFactory: (ctx) => {
|
|
83
|
+
return (target: VirtualizedManagerOptionFactory) => {
|
|
84
|
+
const child = ctx.container.createChild();
|
|
85
|
+
child.register({ token: VirtualizedManagerOption, useValue: target });
|
|
86
|
+
return child.get(VirtualizedManager);
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
token: CellExecutionTimeProvider,
|
|
92
|
+
useValue: LibroCellExecutionTime,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
token: CellInputBottonBlankProvider,
|
|
96
|
+
useValue: LibroCellInputBottonBlank,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
token: CellOutputBottomBlankProvider,
|
|
100
|
+
useValue: LibroCellOutputBottomBlank,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
token: CellOutputVisulizationProvider,
|
|
104
|
+
useValue: LibroCellVisualization,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
token: BetweenCellProvider,
|
|
108
|
+
useValue: LibroBetweenCellContent,
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
.dependOn(
|
|
112
|
+
ManaAppPreset,
|
|
113
|
+
LibroCellModule,
|
|
114
|
+
LibroSlotModule,
|
|
115
|
+
CodeEditorModule,
|
|
116
|
+
LibroCommandModule,
|
|
117
|
+
ConfigurationModule,
|
|
118
|
+
OutputModule,
|
|
119
|
+
LibroContentModule,
|
|
120
|
+
LibroFormatterModule,
|
|
121
|
+
);
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type { IOutput } from '@difizen/libro-common';
|
|
2
|
+
import { isError, isStream } from '@difizen/libro-common';
|
|
3
|
+
import type { ViewComponent, Contribution } from '@difizen/mana-app';
|
|
4
|
+
import {
|
|
5
|
+
ViewOption,
|
|
6
|
+
getOrigin,
|
|
7
|
+
ViewRender,
|
|
8
|
+
BaseView,
|
|
9
|
+
Priority,
|
|
10
|
+
useInject,
|
|
11
|
+
view,
|
|
12
|
+
ViewInstance,
|
|
13
|
+
} from '@difizen/mana-app';
|
|
14
|
+
import { Emitter, prop, contrib, inject, transient } from '@difizen/mana-app';
|
|
15
|
+
import { useEffect, forwardRef } from 'react';
|
|
16
|
+
import { v4 } from 'uuid';
|
|
17
|
+
|
|
18
|
+
import { ExecutableCellView } from '../cell/index.js';
|
|
19
|
+
import type { CellView } from '../libro-protocol.js';
|
|
20
|
+
|
|
21
|
+
import type {
|
|
22
|
+
BaseOutputArea,
|
|
23
|
+
BaseOutputView,
|
|
24
|
+
IOutputAreaOption,
|
|
25
|
+
} from './output-protocol.js';
|
|
26
|
+
import { OutputContribution } from './output-protocol.js';
|
|
27
|
+
|
|
28
|
+
const LibroOutputAreaRender = forwardRef<HTMLDivElement>(
|
|
29
|
+
function LibroOutputAreaRender(props, ref) {
|
|
30
|
+
const outputArea = useInject<LibroOutputArea>(ViewInstance);
|
|
31
|
+
|
|
32
|
+
// const cellModel = outputArea.cell.model;
|
|
33
|
+
// const executing = ExecutableCellModel.is(cellModel) && cellModel.executing;
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
outputArea.onUpdateEmitter.fire();
|
|
37
|
+
}, [outputArea.onUpdateEmitter, outputArea.outputs]);
|
|
38
|
+
const childrenCannotClear = [];
|
|
39
|
+
const children = [];
|
|
40
|
+
for (const output of outputArea.outputs) {
|
|
41
|
+
if (output.allowClear === false) {
|
|
42
|
+
childrenCannotClear.push(output);
|
|
43
|
+
} else {
|
|
44
|
+
children.push(output);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className="libro-output-area"
|
|
50
|
+
ref={ref}
|
|
51
|
+
//设置最小高度,用于优化长文本输出再次执行时的页面的滚动控制
|
|
52
|
+
// style={{ minHeight: `${executing ? outputArea.lastOutputContainerHeight + 'px' : 'unset'}` }}
|
|
53
|
+
>
|
|
54
|
+
{childrenCannotClear.map((output) => {
|
|
55
|
+
return <ViewRender view={output} key={output.id} />;
|
|
56
|
+
})}
|
|
57
|
+
{children.map((output) => {
|
|
58
|
+
return <ViewRender view={output} key={output.id} />;
|
|
59
|
+
})}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
@transient()
|
|
66
|
+
@view('libro-output-area')
|
|
67
|
+
export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
68
|
+
override view: ViewComponent = LibroOutputAreaRender;
|
|
69
|
+
@contrib(OutputContribution)
|
|
70
|
+
outputProvider: Contribution.Provider<OutputContribution>;
|
|
71
|
+
cell: CellView;
|
|
72
|
+
@prop()
|
|
73
|
+
outputs: BaseOutputView[] = [];
|
|
74
|
+
|
|
75
|
+
// lastOutputContainerHeight?: number;
|
|
76
|
+
|
|
77
|
+
constructor(@inject(ViewOption) option: IOutputAreaOption) {
|
|
78
|
+
super();
|
|
79
|
+
this.cell = option.cell;
|
|
80
|
+
}
|
|
81
|
+
disposed?: boolean | undefined;
|
|
82
|
+
|
|
83
|
+
get length() {
|
|
84
|
+
return this.outputs.length;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected clearNext = false;
|
|
88
|
+
protected lastStream = '';
|
|
89
|
+
|
|
90
|
+
protected lastName?: 'stdout' | 'stderr';
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
onUpdateEmitter = new Emitter<void>();
|
|
96
|
+
|
|
97
|
+
get onUpdate() {
|
|
98
|
+
return this.onUpdateEmitter.event;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
get(index: number): BaseOutputView {
|
|
102
|
+
if (index >= 0 && index < this.outputs.length) {
|
|
103
|
+
return this.outputs[index];
|
|
104
|
+
}
|
|
105
|
+
throw new Error('index out of range');
|
|
106
|
+
}
|
|
107
|
+
protected doCreateOutput(options: IOutput): Promise<BaseOutputView> {
|
|
108
|
+
const provider = this.findProvider(options);
|
|
109
|
+
|
|
110
|
+
return provider.factory({
|
|
111
|
+
output: { _librOutputId: v4(), ...options },
|
|
112
|
+
trusted: this.cell.model.trusted,
|
|
113
|
+
cell: this.cell,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
add = async (output: IOutput): Promise<number> => {
|
|
117
|
+
if (this.clearNext) {
|
|
118
|
+
this.clear();
|
|
119
|
+
this.clearNext = false;
|
|
120
|
+
}
|
|
121
|
+
// Consolidate outputs if they are stream outputs of the same kind.
|
|
122
|
+
if (
|
|
123
|
+
isStream(output) &&
|
|
124
|
+
this.lastStream &&
|
|
125
|
+
output.name === this.lastName &&
|
|
126
|
+
this.shouldCombine({
|
|
127
|
+
output,
|
|
128
|
+
lastModel: this.outputs[this.length - 1],
|
|
129
|
+
})
|
|
130
|
+
) {
|
|
131
|
+
// In order to get a list change event, we add the previous
|
|
132
|
+
// text to the current item and replace the previous item.
|
|
133
|
+
// This also replaces the metadata of the last item.
|
|
134
|
+
this.lastStream += normalize(output.text);
|
|
135
|
+
this.lastStream = removeOverwrittenChars(this.lastStream);
|
|
136
|
+
output.text = this.lastStream;
|
|
137
|
+
const index = this.length - 1;
|
|
138
|
+
this.set(index, output);
|
|
139
|
+
return this.length;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (isStream(output)) {
|
|
143
|
+
output.text = removeOverwrittenChars(normalize(output.text));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const outputModel = this.doCreateOutput(output);
|
|
147
|
+
|
|
148
|
+
// Update the stream information.
|
|
149
|
+
if (isStream(output)) {
|
|
150
|
+
this.lastStream = normalize(output.text);
|
|
151
|
+
this.lastName = output.name;
|
|
152
|
+
} else {
|
|
153
|
+
this.lastStream = '';
|
|
154
|
+
}
|
|
155
|
+
const model = await outputModel;
|
|
156
|
+
model.onDisposed(() => {
|
|
157
|
+
this.remove(model);
|
|
158
|
+
});
|
|
159
|
+
return this.outputs.push(model);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
protected remove(model: BaseOutputView) {
|
|
163
|
+
let outputs = [...this.outputs];
|
|
164
|
+
outputs = outputs.filter((item) => item !== model);
|
|
165
|
+
this.outputs = outputs;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
set = async (index: number, output: IOutput) => {
|
|
169
|
+
const outputModel = this.doCreateOutput(output);
|
|
170
|
+
const current = this.outputs[index];
|
|
171
|
+
current.dispose();
|
|
172
|
+
const model = await outputModel;
|
|
173
|
+
model.onDisposed(() => {
|
|
174
|
+
this.remove(model);
|
|
175
|
+
});
|
|
176
|
+
this.outputs[index] = model;
|
|
177
|
+
};
|
|
178
|
+
clear(wait?: boolean | undefined) {
|
|
179
|
+
this.lastStream = '';
|
|
180
|
+
if (wait) {
|
|
181
|
+
this.clearNext = true;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.outputs.forEach((output) => {
|
|
185
|
+
output.dispose();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
fromJSON = async (values: IOutput[]) => {
|
|
189
|
+
if (!values) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
// this.clear();
|
|
193
|
+
for (const value of values) {
|
|
194
|
+
await this.add(value);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
toJSON = (): IOutput[] => {
|
|
198
|
+
return this.outputs.map((output) => output.toJSON());
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
setupCellView(cell: CellView) {
|
|
202
|
+
this.cell = cell;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
protected findProvider(options: IOutput): OutputContribution {
|
|
206
|
+
const prioritized = Priority.sortSync(
|
|
207
|
+
this.outputProvider.getContributions(),
|
|
208
|
+
(contribution) => contribution.canHandle(options),
|
|
209
|
+
);
|
|
210
|
+
const sorted = prioritized.map((c) => c.value);
|
|
211
|
+
return sorted[0]!;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Whether a new value should be consolidated with the previous output.
|
|
216
|
+
*
|
|
217
|
+
* This will only be called if the minimal criteria of both being stream
|
|
218
|
+
* messages of the same type.
|
|
219
|
+
*/
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
221
|
+
protected shouldCombine(options: {
|
|
222
|
+
output: IOutput;
|
|
223
|
+
lastModel: BaseOutputView;
|
|
224
|
+
}): boolean {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Remove characters that are overridden by backspace characters.
|
|
231
|
+
*/
|
|
232
|
+
function fixBackspace(txt: string): string {
|
|
233
|
+
let tmp = txt;
|
|
234
|
+
do {
|
|
235
|
+
// eslint-disable-next-line no-param-reassign
|
|
236
|
+
txt = tmp;
|
|
237
|
+
// Cancel out anything-but-newline followed by backspace
|
|
238
|
+
tmp = txt.replace(/[^\n]\x08/gm, ''); // eslint-disable-line no-control-regex
|
|
239
|
+
} while (tmp.length < txt.length);
|
|
240
|
+
return txt;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Remove chunks that should be overridden by the effect of
|
|
245
|
+
* carriage return characters.
|
|
246
|
+
*/
|
|
247
|
+
function fixCarriageReturn(txt: string): string {
|
|
248
|
+
// eslint-disable-next-line no-param-reassign
|
|
249
|
+
txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline
|
|
250
|
+
while (txt.search(/\r[^$]/g) > -1) {
|
|
251
|
+
const base = txt.match(/^(.*)\r+/m)![1];
|
|
252
|
+
let insert = txt.match(/\r+(.*)$/m)![1];
|
|
253
|
+
insert = insert + base.slice(insert.length, base.length);
|
|
254
|
+
// eslint-disable-next-line no-param-reassign
|
|
255
|
+
txt = txt.replace(/\r+.*$/m, '\r').replace(/^.*\r/m, insert);
|
|
256
|
+
}
|
|
257
|
+
return txt;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
* Remove characters overridden by backspaces and carriage returns
|
|
262
|
+
*/
|
|
263
|
+
export function removeOverwrittenChars(text: string): string {
|
|
264
|
+
return fixCarriageReturn(fixBackspace(text));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Normalize an output.
|
|
269
|
+
*/
|
|
270
|
+
//TODO: output处理
|
|
271
|
+
export function normalize(value: string[] | string): string {
|
|
272
|
+
if (Array.isArray(value)) {
|
|
273
|
+
return value.join('');
|
|
274
|
+
}
|
|
275
|
+
return value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function hasErrorOutput(cell: CellView): boolean {
|
|
279
|
+
if (!ExecutableCellView.is(cell)) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
if (cell.outputArea && cell.outputArea.length) {
|
|
283
|
+
return !!cell.outputArea.outputs.find((output) => isError(getOrigin(output.raw)));
|
|
284
|
+
}
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { inject, singleton, ViewManager } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { LibroOutputView } from './output-model.js';
|
|
4
|
+
import type { IOutputOptions } from './output-protocol.js';
|
|
5
|
+
import { OutputContribution } from './output-protocol.js';
|
|
6
|
+
|
|
7
|
+
@singleton({ contrib: OutputContribution })
|
|
8
|
+
export class DefaultOutputContribution implements OutputContribution {
|
|
9
|
+
@inject(ViewManager) viewManager: ViewManager;
|
|
10
|
+
canHandle = () => 1;
|
|
11
|
+
factory(output: IOutputOptions) {
|
|
12
|
+
return this.viewManager.getOrCreateView(LibroOutputView, output);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IOutput, JSONObject, PartialJSONObject } from '@difizen/libro-common';
|
|
2
|
+
import { BaseView, prop, view, ViewOption } from '@difizen/mana-app';
|
|
3
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
4
|
+
import type { FC } from 'react';
|
|
5
|
+
import { v4 } from 'uuid';
|
|
6
|
+
|
|
7
|
+
import type { CellView } from '../libro-protocol.js';
|
|
8
|
+
|
|
9
|
+
import type { IOutputOptions } from './output-protocol.js';
|
|
10
|
+
import type { ISetDataOptions, BaseOutputView } from './output-protocol.js';
|
|
11
|
+
|
|
12
|
+
const LibroOutputModelRender: FC<{ output: BaseOutputView }> = (props: {
|
|
13
|
+
output: BaseOutputView;
|
|
14
|
+
}) => {
|
|
15
|
+
const { output } = props;
|
|
16
|
+
return <div>{JSON.stringify(output.toJSON(), null, 2)}</div>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
@transient()
|
|
20
|
+
@view('libro-output-model')
|
|
21
|
+
export class LibroOutputView extends BaseView implements BaseOutputView {
|
|
22
|
+
override id = v4();
|
|
23
|
+
|
|
24
|
+
// 增加cell属性,使得通过output可以找到Cell
|
|
25
|
+
cell: CellView;
|
|
26
|
+
|
|
27
|
+
@prop()
|
|
28
|
+
raw: IOutput;
|
|
29
|
+
|
|
30
|
+
@prop()
|
|
31
|
+
allowClear = true;
|
|
32
|
+
|
|
33
|
+
@prop()
|
|
34
|
+
data: JSONObject;
|
|
35
|
+
@prop()
|
|
36
|
+
metadata: PartialJSONObject;
|
|
37
|
+
type: string;
|
|
38
|
+
trusted: boolean;
|
|
39
|
+
constructor(@inject(ViewOption) options: IOutputOptions) {
|
|
40
|
+
super();
|
|
41
|
+
this.raw = options.output;
|
|
42
|
+
this.trusted = options.trusted;
|
|
43
|
+
this.cell = options.cell;
|
|
44
|
+
this.type = 'libro-default-output';
|
|
45
|
+
this.data = {};
|
|
46
|
+
this.metadata = {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
render: FC<{ output: BaseOutputView }> = LibroOutputModelRender;
|
|
50
|
+
|
|
51
|
+
override dispose() {
|
|
52
|
+
super.dispose();
|
|
53
|
+
}
|
|
54
|
+
toJSON() {
|
|
55
|
+
return this.raw;
|
|
56
|
+
}
|
|
57
|
+
setData(options: ISetDataOptions): void {
|
|
58
|
+
if (options.data) {
|
|
59
|
+
this.data = options.data;
|
|
60
|
+
}
|
|
61
|
+
if (options.metadata) {
|
|
62
|
+
this.metadata = options.metadata;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated use LibroOutputView instead.
|
|
69
|
+
*/
|
|
70
|
+
export const LibroOutputModel = LibroOutputView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { LibroOutputArea } from './output-area.js';
|
|
4
|
+
import { DefaultOutputContribution } from './output-contribution.js';
|
|
5
|
+
import { LibroOutputModel } from './output-model.js';
|
|
6
|
+
import { OutputContribution } from './output-protocol.js';
|
|
7
|
+
|
|
8
|
+
export const OutputModule = ManaModule.create()
|
|
9
|
+
.contribution(OutputContribution)
|
|
10
|
+
.register(LibroOutputArea, LibroOutputModel, DefaultOutputContribution);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IOutput,
|
|
3
|
+
ReadonlyPartialJSONObject,
|
|
4
|
+
JSONObject,
|
|
5
|
+
} from '@difizen/libro-common';
|
|
6
|
+
import type { Event } from '@difizen/mana-app';
|
|
7
|
+
import type { View } from '@difizen/mana-app';
|
|
8
|
+
import { Syringe } from '@difizen/mana-app';
|
|
9
|
+
|
|
10
|
+
import type { CellView } from '../libro-protocol.js';
|
|
11
|
+
|
|
12
|
+
export const CellOption = Symbol('CellOption');
|
|
13
|
+
|
|
14
|
+
export interface IOutputAreaOption {
|
|
15
|
+
cellId: string;
|
|
16
|
+
outputAreaId?: string;
|
|
17
|
+
cell: CellView;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface BaseOutputArea extends View {
|
|
21
|
+
/**
|
|
22
|
+
* The length of the items in the model.
|
|
23
|
+
*/
|
|
24
|
+
readonly length: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether the output area is trusted.
|
|
28
|
+
*/
|
|
29
|
+
// trusted: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get an item at the specified index.
|
|
33
|
+
*/
|
|
34
|
+
get: (index: number) => BaseOutputModel;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Add an output, which may be combined with previous output.
|
|
38
|
+
*
|
|
39
|
+
* @returns The total number of outputs.
|
|
40
|
+
*
|
|
41
|
+
* #### Notes
|
|
42
|
+
* The output bundle is copied.
|
|
43
|
+
* Contiguous stream outputs of the same `name` are combined.
|
|
44
|
+
*/
|
|
45
|
+
add: (output: IOutput) => Promise<number>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Set the value at the specified index.
|
|
49
|
+
*/
|
|
50
|
+
set: (index: number, output: IOutput) => Promise<void>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Clear all of the output.
|
|
54
|
+
*
|
|
55
|
+
* @param wait - Delay clearing the output until the next message is added.
|
|
56
|
+
*/
|
|
57
|
+
clear: (wait?: boolean) => void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Deserialize the model from JSON.
|
|
61
|
+
*
|
|
62
|
+
* #### Notes
|
|
63
|
+
* This will clear any existing data.
|
|
64
|
+
*/
|
|
65
|
+
fromJSON: (values: IOutput[]) => Promise<void>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Serialize the model to JSON.
|
|
69
|
+
*/
|
|
70
|
+
toJSON: () => IOutput[];
|
|
71
|
+
|
|
72
|
+
outputs: BaseOutputModel[];
|
|
73
|
+
|
|
74
|
+
cell: CellView;
|
|
75
|
+
|
|
76
|
+
setupCellView: (cell: CellView) => void;
|
|
77
|
+
|
|
78
|
+
get onUpdate(): Event<void>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The interface for an output model.
|
|
83
|
+
*/
|
|
84
|
+
export interface BaseOutputView extends View {
|
|
85
|
+
id: string;
|
|
86
|
+
|
|
87
|
+
raw: IOutput;
|
|
88
|
+
|
|
89
|
+
cell: CellView;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The output type.
|
|
93
|
+
*/
|
|
94
|
+
readonly type: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Whether the output is trusted.
|
|
98
|
+
*/
|
|
99
|
+
trusted: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The data associated with the model.
|
|
102
|
+
*/
|
|
103
|
+
readonly data: JSONObject;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The metadata associated with the model.
|
|
107
|
+
*
|
|
108
|
+
* Among others, it can include an attribute named `fragment`
|
|
109
|
+
* that stores a URI fragment identifier for the MIME resource.
|
|
110
|
+
*/
|
|
111
|
+
readonly metadata: ReadonlyPartialJSONObject;
|
|
112
|
+
/**
|
|
113
|
+
* Dispose of the resources used by the output model.
|
|
114
|
+
*/
|
|
115
|
+
dispose: () => void;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Serialize the model to JSON.
|
|
119
|
+
*/
|
|
120
|
+
toJSON: () => IOutput;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Set the data associated with the model.
|
|
124
|
+
*
|
|
125
|
+
* #### Notes
|
|
126
|
+
* Depending on the implementation of the mime model,
|
|
127
|
+
*/
|
|
128
|
+
setData(options: ISetDataOptions): void;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* undefined is considered allowed
|
|
132
|
+
*/
|
|
133
|
+
allowClear?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated use BaseOutputView instead
|
|
138
|
+
*/
|
|
139
|
+
export type BaseOutputModel = BaseOutputView;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The options used to update a output model.
|
|
143
|
+
*/
|
|
144
|
+
export interface ISetDataOptions {
|
|
145
|
+
/**
|
|
146
|
+
* The new data object.
|
|
147
|
+
*/
|
|
148
|
+
data?: JSONObject;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The new metadata object.
|
|
152
|
+
*/
|
|
153
|
+
metadata?: JSONObject;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface IOutputOptions {
|
|
157
|
+
output: IOutput;
|
|
158
|
+
trusted: boolean;
|
|
159
|
+
cell: CellView;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type OutputModelFactory = (options: IOutputOptions) => Promise<BaseOutputModel>;
|
|
163
|
+
|
|
164
|
+
export const OutputContribution = Syringe.defineToken('OutputContribution');
|
|
165
|
+
export interface OutputContribution {
|
|
166
|
+
canHandle: (output: IOutput) => number;
|
|
167
|
+
factory: OutputModelFactory;
|
|
168
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { SettingEditorModule } from './setting-editor/index.js';
|
|
4
|
+
import { SettingsContribution } from './settings-contribution.js';
|
|
5
|
+
|
|
6
|
+
export const SettingsModule = ManaModule.create()
|
|
7
|
+
.register(SettingsContribution)
|
|
8
|
+
.dependOn(SettingEditorModule);
|