@opensumi/ide-core-browser 2.21.13 → 2.22.0
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/lib/application/application-state-service.d.ts +1 -1
- package/lib/application/application-state-service.d.ts.map +1 -1
- package/lib/application/application-state-service.js.map +1 -1
- package/lib/application/application.service.js.map +1 -1
- package/lib/authentication/authentication.contribution.js.map +1 -1
- package/lib/authentication/authentication.service.js.map +1 -1
- package/lib/bootstrap/app.d.ts +2 -35
- package/lib/bootstrap/app.d.ts.map +1 -1
- package/lib/bootstrap/app.interface.d.ts +39 -0
- package/lib/bootstrap/app.interface.d.ts.map +1 -0
- package/lib/bootstrap/app.interface.js +3 -0
- package/lib/bootstrap/app.interface.js.map +1 -0
- package/lib/bootstrap/app.js +8 -8
- package/lib/bootstrap/app.js.map +1 -1
- package/lib/bootstrap/app.view.d.ts +1 -1
- package/lib/bootstrap/app.view.d.ts.map +1 -1
- package/lib/bootstrap/connection.d.ts +1 -1
- package/lib/bootstrap/connection.d.ts.map +1 -1
- package/lib/bootstrap/connection.js +4 -4
- package/lib/bootstrap/connection.js.map +1 -1
- package/lib/bootstrap/index.d.ts +1 -1
- package/lib/bootstrap/index.d.ts.map +1 -1
- package/lib/bootstrap/index.js +1 -1
- package/lib/bootstrap/index.js.map +1 -1
- package/lib/bootstrap/inner-providers.js +1 -1
- package/lib/bootstrap/inner-providers.js.map +1 -1
- package/lib/bootstrap/lifecycle.service.js.map +1 -1
- package/lib/browser-module.js.map +1 -1
- package/lib/common/common.command.d.ts +24 -1
- package/lib/common/common.command.d.ts.map +1 -1
- package/lib/common/common.command.js +42 -6
- package/lib/common/common.command.js.map +1 -1
- package/lib/common/common.contribution.js.map +1 -1
- package/lib/common/common.module.js.map +1 -1
- package/lib/common/common.storage.js.map +1 -1
- package/lib/components/actions/index.d.ts +2 -2
- package/lib/components/actions/index.d.ts.map +1 -1
- package/lib/components/actions/index.js +2 -22
- package/lib/components/actions/index.js.map +1 -1
- package/lib/components/index.d.ts +0 -4
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +0 -4
- package/lib/components/index.js.map +1 -1
- package/lib/components/layout/box-panel.d.ts +1 -1
- package/lib/components/layout/box-panel.d.ts.map +1 -1
- package/lib/components/layout/split-panel.d.ts +17 -1
- package/lib/components/layout/split-panel.d.ts.map +1 -1
- package/lib/components/layout/split-panel.js +16 -16
- package/lib/components/layout/split-panel.js.map +1 -1
- package/lib/components/layout/split-panel.service.js.map +1 -1
- package/lib/components/progressbar/index.d.ts +2 -2
- package/lib/components/progressbar/index.d.ts.map +1 -1
- package/lib/components/progressbar/index.js +2 -10
- package/lib/components/progressbar/index.js.map +1 -1
- package/lib/contextkey/resource.d.ts +1 -1
- package/lib/contextkey/resource.d.ts.map +1 -1
- package/lib/contextkey/search.d.ts +24 -0
- package/lib/contextkey/search.d.ts.map +1 -0
- package/lib/contextkey/search.js +29 -0
- package/lib/contextkey/search.js.map +1 -0
- package/lib/contextkey/testing.d.ts +1 -0
- package/lib/contextkey/testing.d.ts.map +1 -1
- package/lib/contextkey/testing.js +2 -1
- package/lib/contextkey/testing.js.map +1 -1
- package/lib/core-preferences.d.ts +4 -3
- package/lib/core-preferences.d.ts.map +1 -1
- package/lib/core-preferences.js +2 -2
- package/lib/core-preferences.js.map +1 -1
- package/lib/dom/index.d.ts +1 -1
- package/lib/dom/index.d.ts.map +1 -1
- package/lib/encoding-registry.js.map +1 -1
- package/lib/extensions/extensions-point.service.js.map +1 -1
- package/lib/file-decoration.d.ts +10 -0
- package/lib/file-decoration.d.ts.map +1 -0
- package/lib/file-decoration.js +3 -0
- package/lib/file-decoration.js.map +1 -0
- package/lib/hash-calculate/hash-calculate.contribution.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/keybinding/keybinding.js.map +1 -1
- package/lib/keyboard/keyboard-layout-provider.d.ts +2 -2
- package/lib/keyboard/keyboard-layout-provider.d.ts.map +1 -1
- package/lib/keyboard/keyboard-layout-provider.js +13 -13
- package/lib/keyboard/keyboard-layout-provider.js.map +1 -1
- package/lib/keyboard/keyboard-layout-service.js.map +1 -1
- package/lib/keyboard/keys.d.ts +2 -2
- package/lib/keyboard/keys.d.ts.map +1 -1
- package/lib/keyboard/layouts/_.contribution.js +3 -3
- package/lib/keyboard/layouts/_.contribution.js.map +1 -1
- package/lib/layout/accordion/tab-bar-toolbar.js.map +1 -1
- package/lib/layout/accordion/view-context-key.registry.js.map +1 -1
- package/lib/layout/layout-hooks.d.ts +1 -1
- package/lib/layout/layout-hooks.d.ts.map +1 -1
- package/lib/layout/layout-state.js.map +1 -1
- package/lib/layout/layout.interface.d.ts +1 -1
- package/lib/layout/layout.interface.d.ts.map +1 -1
- package/lib/layout/layout.js.map +1 -1
- package/lib/logger/browser-logger.js.map +1 -1
- package/lib/markdown/index.d.ts +1 -1
- package/lib/markdown/index.d.ts.map +1 -1
- package/lib/markdown/index.js +4 -31
- package/lib/markdown/index.js.map +1 -1
- package/lib/menu/next/base.d.ts +4 -4
- package/lib/menu/next/base.d.ts.map +1 -1
- package/lib/menu/next/base.js.map +1 -1
- package/lib/menu/next/ctxmenu-service.js +10 -10
- package/lib/menu/next/ctxmenu-service.js.map +1 -1
- package/lib/menu/next/menu-service.js +6 -6
- package/lib/menu/next/menu-service.js.map +1 -1
- package/lib/menu/next/menu.contrib.interface.d.ts +16 -15
- package/lib/menu/next/menu.contrib.interface.d.ts.map +1 -1
- package/lib/menu/next/menu.contrib.interface.js.map +1 -1
- package/lib/menu/next/menu.interface.d.ts +2 -2
- package/lib/menu/next/menu.interface.d.ts.map +1 -1
- package/lib/menu/next/menu.interface.js.map +1 -1
- package/lib/menu/next/menubar-service.js +10 -10
- package/lib/menu/next/menubar-service.js.map +1 -1
- package/lib/menu/next/renderer/ctxmenu/browser.js.map +1 -1
- package/lib/menu/next/renderer/ctxmenu/electron.js.map +1 -1
- package/lib/menu/next/toolbar-action.service.d.ts +1 -1
- package/lib/menu/next/toolbar-action.service.d.ts.map +1 -1
- package/lib/menu/next/toolbar-action.service.js.map +1 -1
- package/lib/monaco/index.d.ts +7 -3
- package/lib/monaco/index.d.ts.map +1 -1
- package/lib/monaco/index.js.map +1 -1
- package/lib/monaco/merge-editor-widget.d.ts +53 -0
- package/lib/monaco/merge-editor-widget.d.ts.map +1 -0
- package/lib/monaco/merge-editor-widget.js +107 -0
- package/lib/monaco/merge-editor-widget.js.map +1 -0
- package/lib/opener/command-opener.js.map +1 -1
- package/lib/opener/default-opener.js.map +1 -1
- package/lib/opener/http-opener.js.map +1 -1
- package/lib/opener/opener.contribution.js.map +1 -1
- package/lib/opener/opener.service.js.map +1 -1
- package/lib/preferences/early-preferences.js +4 -4
- package/lib/preferences/early-preferences.js.map +1 -1
- package/lib/preferences/preference-configurations.js +1 -1
- package/lib/preferences/preference-configurations.js.map +1 -1
- package/lib/preferences/preference-contribution.d.ts +1 -2
- package/lib/preferences/preference-contribution.d.ts.map +1 -1
- package/lib/preferences/preference-contribution.js +26 -22
- package/lib/preferences/preference-contribution.js.map +1 -1
- package/lib/preferences/preference-provider.js.map +1 -1
- package/lib/preferences/preference-proxy.d.ts +2 -3
- package/lib/preferences/preference-proxy.d.ts.map +1 -1
- package/lib/preferences/preference-proxy.js.map +1 -1
- package/lib/preferences/preference-service.d.ts +1 -0
- package/lib/preferences/preference-service.d.ts.map +1 -1
- package/lib/preferences/preference-service.js +48 -3
- package/lib/preferences/preference-service.js.map +1 -1
- package/lib/preferences/settings.d.ts +44 -5
- package/lib/preferences/settings.d.ts.map +1 -1
- package/lib/preferences/settings.js.map +1 -1
- package/lib/preferences/types.d.ts +8 -1
- package/lib/preferences/types.d.ts.map +1 -1
- package/lib/preferences/types.js.map +1 -1
- package/lib/progress/progress-bar.d.ts +4 -1
- package/lib/progress/progress-bar.d.ts.map +1 -1
- package/lib/progress/progress-bar.js +11 -4
- package/lib/progress/progress-bar.js.map +1 -1
- package/lib/progress/progress-indicator.js.map +1 -1
- package/lib/progress/progress.service.js +6 -6
- package/lib/progress/progress.service.js.map +1 -1
- package/lib/quick-open/index.d.ts +1 -1
- package/lib/quick-open/index.d.ts.map +1 -1
- package/lib/quick-open/index.js.map +1 -1
- package/lib/quick-open/recent-files.js.map +1 -1
- package/lib/raw-context-key.d.ts +1 -1
- package/lib/raw-context-key.d.ts.map +1 -1
- package/lib/raw-context-key.js +4 -4
- package/lib/raw-context-key.js.map +1 -1
- package/lib/react-hooks/useThrottleFn/index.d.ts +13 -0
- package/lib/react-hooks/useThrottleFn/index.d.ts.map +1 -0
- package/lib/react-hooks/useThrottleFn/index.js +20 -0
- package/lib/react-hooks/useThrottleFn/index.js.map +1 -0
- package/lib/react-providers/config-provider.d.ts +6 -0
- package/lib/react-providers/config-provider.d.ts.map +1 -1
- package/lib/react-providers/config-provider.js.map +1 -1
- package/lib/react-providers/slot.d.ts +2 -2
- package/lib/react-providers/slot.d.ts.map +1 -1
- package/lib/services/clipboard.service.d.ts +1 -0
- package/lib/services/clipboard.service.d.ts.map +1 -1
- package/lib/services/clipboard.service.js +17 -30
- package/lib/services/clipboard.service.js.map +1 -1
- package/lib/services/credentials-service.js.map +1 -1
- package/lib/services/crypto-service.js.map +1 -1
- package/lib/services/external-uri.service.js.map +1 -1
- package/lib/services/label-service.js.map +1 -1
- package/lib/services/storage-service.d.ts +1 -0
- package/lib/services/storage-service.d.ts.map +1 -1
- package/lib/services/storage-service.js +13 -2
- package/lib/services/storage-service.js.map +1 -1
- package/lib/style/icon/icon.d.ts +3 -2
- package/lib/style/icon/icon.d.ts.map +1 -1
- package/lib/style/icon/icon.js +5 -1
- package/lib/style/icon/icon.js.map +1 -1
- package/lib/style/icon/ide-iconfont.d.ts +1 -1
- package/lib/style/icon/ide-iconfont.d.ts.map +1 -1
- package/lib/style/icon/ide-iconfont.js +1 -1
- package/lib/style/icon/ide-iconfont.js.map +1 -1
- package/lib/style/icon/index.less +13 -0
- package/lib/toolbar/components/button.js +12 -12
- package/lib/toolbar/components/button.js.map +1 -1
- package/lib/toolbar/toolbar.popover.registry.js.map +1 -1
- package/lib/toolbar/toolbar.registry.d.ts +1 -1
- package/lib/toolbar/toolbar.registry.d.ts.map +1 -1
- package/lib/toolbar/toolbar.registry.js.map +1 -1
- package/lib/toolbar/types.d.ts +1 -1
- package/lib/toolbar/types.d.ts.map +1 -1
- package/lib/utils/json.d.ts +5 -5
- package/lib/utils/json.d.ts.map +1 -1
- package/lib/utils/label.d.ts.map +1 -1
- package/lib/utils/label.js +16 -9
- package/lib/utils/label.js.map +1 -1
- package/lib/utils/parse.d.ts +2 -1
- package/lib/utils/parse.d.ts.map +1 -1
- package/lib/utils/parse.js +10 -1
- package/lib/utils/parse.js.map +1 -1
- package/lib/variable/variable.d.ts +1 -1
- package/lib/variable/variable.d.ts.map +1 -1
- package/lib/variable/variable.js.map +1 -1
- package/lib/window/window.service.js.map +1 -1
- package/package.json +9 -11
- package/src/application/application-state-service.ts +54 -0
- package/src/application/application.service.ts +51 -0
- package/src/application/index.ts +2 -0
- package/src/authentication/authentication.contribution.ts +35 -0
- package/src/authentication/authentication.service.ts +517 -0
- package/src/bootstrap/app.interface.ts +46 -0
- package/src/bootstrap/app.ts +710 -0
- package/src/bootstrap/app.view.tsx +88 -0
- package/src/bootstrap/connection.ts +116 -0
- package/src/bootstrap/index.ts +3 -0
- package/src/bootstrap/inner-providers.ts +297 -0
- package/src/bootstrap/lifecycle.service.ts +19 -0
- package/src/browser-module.ts +24 -0
- package/src/common/common.command.ts +1018 -0
- package/src/common/common.contribution.ts +343 -0
- package/src/common/common.define.ts +55 -0
- package/src/common/common.module.ts +33 -0
- package/src/common/common.storage.ts +22 -0
- package/src/common/container-id.ts +12 -0
- package/src/common/index.ts +4 -0
- package/src/components/actions/index.tsx +486 -0
- package/src/components/actions/placements.ts +47 -0
- package/src/components/actions/styles.module.less +144 -0
- package/src/components/badge/index.tsx +1 -0
- package/src/components/index.ts +22 -0
- package/src/components/layout/box-panel.tsx +88 -0
- package/src/components/layout/default-layout.tsx +61 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/layout/layout.ts +80 -0
- package/src/components/layout/split-panel.service.ts +56 -0
- package/src/components/layout/split-panel.tsx +315 -0
- package/src/components/layout/styles.module.less +21 -0
- package/src/components/loading/index.ts +1 -0
- package/src/components/loading/loading.less +14 -0
- package/src/components/loading/loading.view.tsx +7 -0
- package/src/components/loading/media/loading-dark.svg +52 -0
- package/src/components/loading/media/loading-hc.svg +52 -0
- package/src/components/loading/media/loading.svg +52 -0
- package/src/components/popover/styles.module.less +81 -0
- package/src/components/portal/index.tsx +13 -0
- package/src/components/progressbar/index.tsx +3 -0
- package/src/components/resize/resize.module.less +78 -0
- package/src/components/resize/resize.tsx +663 -0
- package/src/components/select/index.tsx +12 -0
- package/src/components/select/styles.less +6 -0
- package/src/context-key.ts +48 -0
- package/src/contextkey/dialog.ts +3 -0
- package/src/contextkey/explorer.ts +26 -0
- package/src/contextkey/index.ts +6 -0
- package/src/contextkey/outline.ts +4 -0
- package/src/contextkey/resource.ts +61 -0
- package/src/contextkey/search.ts +30 -0
- package/src/contextkey/terminal.ts +7 -0
- package/src/contextkey/testing.ts +9 -0
- package/src/contextkey/workspace.ts +7 -0
- package/src/core-preferences.ts +318 -0
- package/src/dom/index.ts +176 -0
- package/src/encoding-registry.ts +83 -0
- package/src/extensions/extensions-point.service.ts +78 -0
- package/src/extensions/index.ts +3 -0
- package/src/extensions/schema/browserViews.ts +96 -0
- package/src/extensions/schema/menu.ts +245 -0
- package/src/extensions/schema/opensumiExtensionPackageSchema.ts +12 -0
- package/src/extensions/schema/toolbar.ts +338 -0
- package/src/extensions/schema/vscodeExtensionPackageSchema.ts +330 -0
- package/src/file-decoration.ts +10 -0
- package/src/fs/index.ts +12 -0
- package/src/hash-calculate/hash-calculate.contribution.ts +19 -0
- package/src/index.ts +42 -0
- package/src/keybinding/index.ts +1 -0
- package/src/keybinding/keybinding.ts +908 -0
- package/src/keyboard/index.ts +3 -0
- package/src/keyboard/keyboard-layout-provider.ts +412 -0
- package/src/keyboard/keyboard-layout-service.ts +449 -0
- package/src/keyboard/keys.ts +748 -0
- package/src/keyboard/layouts/_.contribution.ts +24 -0
- package/src/keyboard/layouts/cz.win.ts +168 -0
- package/src/keyboard/layouts/de-swiss.win.ts +168 -0
- package/src/keyboard/layouts/de.darwin.ts +131 -0
- package/src/keyboard/layouts/de.linux.ts +186 -0
- package/src/keyboard/layouts/de.win.ts +168 -0
- package/src/keyboard/layouts/dk.win.ts +168 -0
- package/src/keyboard/layouts/dvorak.darwin.ts +131 -0
- package/src/keyboard/layouts/en-belgian.win.ts +168 -0
- package/src/keyboard/layouts/en-ext.darwin.ts +131 -0
- package/src/keyboard/layouts/en-in.win.ts +168 -0
- package/src/keyboard/layouts/en-intl.darwin.ts +131 -0
- package/src/keyboard/layouts/en-intl.win.ts +168 -0
- package/src/keyboard/layouts/en-uk.darwin.ts +131 -0
- package/src/keyboard/layouts/en-uk.win.ts +168 -0
- package/src/keyboard/layouts/en.darwin.ts +139 -0
- package/src/keyboard/layouts/en.linux.ts +186 -0
- package/src/keyboard/layouts/en.win.ts +173 -0
- package/src/keyboard/layouts/es-latin.win.ts +168 -0
- package/src/keyboard/layouts/es.darwin.ts +131 -0
- package/src/keyboard/layouts/es.linux.ts +186 -0
- package/src/keyboard/layouts/es.win.ts +168 -0
- package/src/keyboard/layouts/fr.darwin.ts +131 -0
- package/src/keyboard/layouts/fr.linux.ts +186 -0
- package/src/keyboard/layouts/fr.win.ts +168 -0
- package/src/keyboard/layouts/hu.win.ts +168 -0
- package/src/keyboard/layouts/it.darwin.ts +131 -0
- package/src/keyboard/layouts/it.win.ts +168 -0
- package/src/keyboard/layouts/jp-roman.darwin.ts +131 -0
- package/src/keyboard/layouts/jp.darwin.ts +131 -0
- package/src/keyboard/layouts/ko.darwin.ts +131 -0
- package/src/keyboard/layouts/layout.contribution.darwin.ts +23 -0
- package/src/keyboard/layouts/layout.contribution.linux.ts +12 -0
- package/src/keyboard/layouts/layout.contribution.ts +9 -0
- package/src/keyboard/layouts/layout.contribution.win.ts +29 -0
- package/src/keyboard/layouts/no.win.ts +168 -0
- package/src/keyboard/layouts/pl.darwin.ts +131 -0
- package/src/keyboard/layouts/pl.win.ts +168 -0
- package/src/keyboard/layouts/pt-br.win.ts +169 -0
- package/src/keyboard/layouts/pt.darwin.ts +131 -0
- package/src/keyboard/layouts/pt.win.ts +168 -0
- package/src/keyboard/layouts/ru.darwin.ts +131 -0
- package/src/keyboard/layouts/ru.linux.ts +186 -0
- package/src/keyboard/layouts/ru.win.ts +168 -0
- package/src/keyboard/layouts/sv.darwin.ts +131 -0
- package/src/keyboard/layouts/sv.win.ts +168 -0
- package/src/keyboard/layouts/thai.win.ts +168 -0
- package/src/keyboard/layouts/tr.win.ts +168 -0
- package/src/keyboard/layouts/zh-hans.darwin.ts +131 -0
- package/src/layout/accordion/tab-bar-toolbar.tsx +59 -0
- package/src/layout/accordion/view-context-key.registry.ts +34 -0
- package/src/layout/constants.ts +7 -0
- package/src/layout/index.ts +5 -0
- package/src/layout/layout-hooks.ts +70 -0
- package/src/layout/layout-state.ts +107 -0
- package/src/layout/layout.interface.ts +101 -0
- package/src/layout/layout.ts +80 -0
- package/src/layout/view-id.ts +18 -0
- package/src/logger/browser-logger.ts +51 -0
- package/src/logger/index.ts +1 -0
- package/src/markdown/index.tsx +30 -0
- package/src/menu/next/base.ts +513 -0
- package/src/menu/next/ctxmenu-service.ts +188 -0
- package/src/menu/next/index.ts +10 -0
- package/src/menu/next/menu-id.ts +86 -0
- package/src/menu/next/menu-service.ts +252 -0
- package/src/menu/next/menu-util.ts +77 -0
- package/src/menu/next/menu.contrib.interface.ts +79 -0
- package/src/menu/next/menu.interface.ts +253 -0
- package/src/menu/next/menubar-service.ts +211 -0
- package/src/menu/next/renderer/ctxmenu/base.ts +18 -0
- package/src/menu/next/renderer/ctxmenu/browser.ts +45 -0
- package/src/menu/next/renderer/ctxmenu/electron.ts +207 -0
- package/src/menu/next/toolbar-action.service.ts +132 -0
- package/src/monaco/index.ts +136 -0
- package/src/monaco/merge-editor-widget.ts +159 -0
- package/src/opener/command-opener.ts +42 -0
- package/src/opener/default-opener.ts +31 -0
- package/src/opener/http-opener.ts +25 -0
- package/src/opener/index.ts +19 -0
- package/src/opener/opener.contribution.ts +57 -0
- package/src/opener/opener.service.ts +66 -0
- package/src/preferences/early-preferences.ts +117 -0
- package/src/preferences/index.ts +9 -0
- package/src/preferences/preference-configurations.ts +77 -0
- package/src/preferences/preference-contribution.ts +397 -0
- package/src/preferences/preference-provider.ts +414 -0
- package/src/preferences/preference-proxy.ts +291 -0
- package/src/preferences/preference-scope.ts +3 -0
- package/src/preferences/preference-service.ts +621 -0
- package/src/preferences/settings.ts +90 -0
- package/src/preferences/types.ts +119 -0
- package/src/progress/index.ts +58 -0
- package/src/progress/progress-bar.tsx +34 -0
- package/src/progress/progress-indicator.ts +90 -0
- package/src/progress/progress.module.less +46 -0
- package/src/progress/progress.service.tsx +429 -0
- package/src/quick-open/index.ts +655 -0
- package/src/quick-open/recent-files.ts +68 -0
- package/src/raw-context-key.ts +116 -0
- package/src/react-hooks/event.tsx +80 -0
- package/src/react-hooks/hot-key.tsx +58 -0
- package/src/react-hooks/index.ts +3 -0
- package/src/react-hooks/injectable-hooks.tsx +35 -0
- package/src/react-hooks/portal-hooks.tsx +38 -0
- package/src/react-hooks/useThrottleFn/index.ts +34 -0
- package/src/react-providers/config-provider.tsx +269 -0
- package/src/react-providers/index.tsx +2 -0
- package/src/react-providers/slot.module.less +19 -0
- package/src/react-providers/slot.tsx +242 -0
- package/src/services/clipboard.service.ts +92 -0
- package/src/services/credentials-service.ts +91 -0
- package/src/services/crypto-service.ts +23 -0
- package/src/services/external-uri.service.ts +68 -0
- package/src/services/index.ts +7 -0
- package/src/services/label-service.ts +386 -0
- package/src/services/status-bar-service.ts +108 -0
- package/src/services/storage-service.ts +201 -0
- package/src/style/codicons/README.md +22 -0
- package/src/style/codicons/codicon-animations.css +15 -0
- package/src/style/codicons/generator.js +15 -0
- package/src/style/entry.less +25 -0
- package/src/style/icon/fileicons/file-default.svg +1 -0
- package/src/style/icon/fileicons/folder-default.svg +1 -0
- package/src/style/icon/fileicons.less +20 -0
- package/src/style/icon/icon.ts +547 -0
- package/src/style/icon/ide-iconfont.ts +13 -0
- package/src/style/icon/index.less +67 -0
- package/src/style/icon/seti.woff +0 -0
- package/src/style/icon/symbol-icons/boolean-dark.svg +3 -0
- package/src/style/icon/symbol-icons/boolean-light.svg +3 -0
- package/src/style/icon/symbol-icons/class-dark.svg +3 -0
- package/src/style/icon/symbol-icons/class-light.svg +3 -0
- package/src/style/icon/symbol-icons/constant-dark.svg +4 -0
- package/src/style/icon/symbol-icons/constant-light.svg +4 -0
- package/src/style/icon/symbol-icons/enumerator-dark.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-item-dark.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-item-light.svg +3 -0
- package/src/style/icon/symbol-icons/enumerator-light.svg +3 -0
- package/src/style/icon/symbol-icons/event-dark.svg +3 -0
- package/src/style/icon/symbol-icons/event-light.svg +3 -0
- package/src/style/icon/symbol-icons/field-dark.svg +3 -0
- package/src/style/icon/symbol-icons/field-light.svg +3 -0
- package/src/style/icon/symbol-icons/file-dark.svg +3 -0
- package/src/style/icon/symbol-icons/file-light.svg +3 -0
- package/src/style/icon/symbol-icons/indexer-dark.svg +3 -0
- package/src/style/icon/symbol-icons/indexer-light.svg +3 -0
- package/src/style/icon/symbol-icons/interface-dark.svg +3 -0
- package/src/style/icon/symbol-icons/interface-light.svg +3 -0
- package/src/style/icon/symbol-icons/keyword-dark.svg +3 -0
- package/src/style/icon/symbol-icons/keyword-light.svg +3 -0
- package/src/style/icon/symbol-icons/method-dark.svg +3 -0
- package/src/style/icon/symbol-icons/method-light.svg +3 -0
- package/src/style/icon/symbol-icons/namespace-dark.svg +3 -0
- package/src/style/icon/symbol-icons/namespace-light.svg +3 -0
- package/src/style/icon/symbol-icons/numeric-dark.svg +3 -0
- package/src/style/icon/symbol-icons/numeric-light.svg +3 -0
- package/src/style/icon/symbol-icons/operator-dark.svg +3 -0
- package/src/style/icon/symbol-icons/operator-light.svg +3 -0
- package/src/style/icon/symbol-icons/property-dark.svg +3 -0
- package/src/style/icon/symbol-icons/property-light.svg +3 -0
- package/src/style/icon/symbol-icons/snippet-dark.svg +3 -0
- package/src/style/icon/symbol-icons/snippet-light.svg +3 -0
- package/src/style/icon/symbol-icons/string-dark.svg +3 -0
- package/src/style/icon/symbol-icons/string-light.svg +3 -0
- package/src/style/icon/symbol-icons/structure-dark.svg +3 -0
- package/src/style/icon/symbol-icons/structure-light.svg +3 -0
- package/src/style/icon/symbol-icons/symbol-icons.css +284 -0
- package/src/style/icon/symbol-icons/template-dark.svg +3 -0
- package/src/style/icon/symbol-icons/template-light.svg +3 -0
- package/src/style/icon/symbol-icons/variable-dark.svg +3 -0
- package/src/style/icon/symbol-icons/variable-light.svg +3 -0
- package/src/style/icon.less +8 -0
- package/src/style/index.less +14 -0
- package/src/style/monaco-override.less +116 -0
- package/src/style/normalize.less +92 -0
- package/src/style/octicons/octicons-cdn.css +720 -0
- package/src/style/octicons/octicons.css +714 -0
- package/src/style/octicons/octicons.html +1882 -0
- package/src/style/octicons/octicons.svg +582 -0
- package/src/style/octicons/octicons.ttf +0 -0
- package/src/style/override.less +97 -0
- package/src/style/toolbar.less +199 -0
- package/src/style/utilities.less +8 -0
- package/src/style/variable.less +8 -0
- package/src/terminal/index.ts +7 -0
- package/src/toolbar/components/auto-complete.tsx +0 -0
- package/src/toolbar/components/button.tsx +440 -0
- package/src/toolbar/components/index.ts +2 -0
- package/src/toolbar/components/select.tsx +189 -0
- package/src/toolbar/index.ts +3 -0
- package/src/toolbar/toolbar.popover.registry.ts +32 -0
- package/src/toolbar/toolbar.registry.ts +352 -0
- package/src/toolbar/toolbar.tsx +710 -0
- package/src/toolbar/types.ts +383 -0
- package/src/utils/create-overlay.tsx +53 -0
- package/src/utils/electron.ts +92 -0
- package/src/utils/env.ts +26 -0
- package/src/utils/icon.ts +13 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/json.ts +251 -0
- package/src/utils/label.tsx +36 -0
- package/src/utils/parse.ts +82 -0
- package/src/utils/react-hooks.ts +118 -0
- package/src/variable/index.ts +1 -0
- package/src/variable/variable.ts +84 -0
- package/src/window/index.ts +34 -0
- package/src/window/window.service.ts +100 -0
- package/lib/components/progressbar/styles.module.less +0 -31
- package/lib/components/recycle-tree/index.d.ts +0 -2
- package/lib/components/recycle-tree/index.d.ts.map +0 -1
- package/lib/components/recycle-tree/index.js +0 -5
- package/lib/components/recycle-tree/index.js.map +0 -1
- package/lib/components/recycle-tree/recycle-tree.view.d.ts +0 -82
- package/lib/components/recycle-tree/recycle-tree.view.d.ts.map +0 -1
- package/lib/components/recycle-tree/recycle-tree.view.js +0 -188
- package/lib/components/recycle-tree/recycle-tree.view.js.map +0 -1
- package/lib/components/scroll/index.d.ts +0 -68
- package/lib/components/scroll/index.d.ts.map +0 -1
- package/lib/components/scroll/index.js +0 -279
- package/lib/components/scroll/index.js.map +0 -1
- package/lib/components/scroll/scroll.module.less +0 -108
- package/lib/components/scrollbar/index.d.ts +0 -2
- package/lib/components/scrollbar/index.d.ts.map +0 -1
- package/lib/components/scrollbar/index.js +0 -5
- package/lib/components/scrollbar/index.js.map +0 -1
- package/lib/components/scrollbar/scrollbar.less +0 -36
- package/lib/components/scrollbar/scrollbar.view.d.ts +0 -7
- package/lib/components/scrollbar/scrollbar.view.d.ts.map +0 -1
- package/lib/components/scrollbar/scrollbar.view.js +0 -11
- package/lib/components/scrollbar/scrollbar.view.js.map +0 -1
- package/lib/components/tree/index.d.ts +0 -4
- package/lib/components/tree/index.d.ts.map +0 -1
- package/lib/components/tree/index.js +0 -7
- package/lib/components/tree/index.js.map +0 -1
- package/lib/components/tree/tree-node.view.d.ts +0 -26
- package/lib/components/tree/tree-node.view.d.ts.map +0 -1
- package/lib/components/tree/tree-node.view.js +0 -350
- package/lib/components/tree/tree-node.view.js.map +0 -1
- package/lib/components/tree/tree.module.less +0 -296
- package/lib/components/tree/tree.view.d.ts +0 -132
- package/lib/components/tree/tree.view.d.ts.map +0 -1
- package/lib/components/tree/tree.view.js +0 -238
- package/lib/components/tree/tree.view.js.map +0 -1
- package/lib/tree/index.d.ts +0 -4
- package/lib/tree/index.d.ts.map +0 -1
- package/lib/tree/index.js +0 -7
- package/lib/tree/index.js.map +0 -1
- package/lib/tree/tree-expansion.d.ts +0 -16
- package/lib/tree/tree-expansion.d.ts.map +0 -1
- package/lib/tree/tree-expansion.js +0 -20
- package/lib/tree/tree-expansion.js.map +0 -1
- package/lib/tree/tree-selection.d.ts +0 -48
- package/lib/tree/tree-selection.d.ts.map +0 -1
- package/lib/tree/tree-selection.js +0 -64
- package/lib/tree/tree-selection.js.map +0 -1
- package/lib/tree/tree.d.ts +0 -195
- package/lib/tree/tree.d.ts.map +0 -1
- package/lib/tree/tree.js +0 -108
- package/lib/tree/tree.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import clsx from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { Layout } from './layout';
|
|
5
|
+
import styles from './styles.module.less';
|
|
6
|
+
|
|
7
|
+
export interface IChildComponentProps {
|
|
8
|
+
/**
|
|
9
|
+
* 创建的 div 标签样式中要使用的 flex 属性
|
|
10
|
+
*/
|
|
11
|
+
flex?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 创建的 div 标签样式中要使用的默认宽度
|
|
14
|
+
*/
|
|
15
|
+
defaultSize?: number;
|
|
16
|
+
id: string;
|
|
17
|
+
overflow: string;
|
|
18
|
+
/**
|
|
19
|
+
* 创建的 div 标签样式中要使用的 zIndex 属性
|
|
20
|
+
*/
|
|
21
|
+
zIndex?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 创建的 div 标签样式中要使用的 z-index 属性
|
|
24
|
+
*/
|
|
25
|
+
'z-index'?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 创建的 div 标签样式中要使用的 backgroundColor 属性
|
|
28
|
+
*/
|
|
29
|
+
backgroundColor?: string;
|
|
30
|
+
|
|
31
|
+
// 以上都是老代码,直接取 props 的相关属性太直接了
|
|
32
|
+
// 优雅一些的做法是使用 data- 标签
|
|
33
|
+
/**
|
|
34
|
+
* 创建的 div 标签要使用的 id
|
|
35
|
+
*/
|
|
36
|
+
'data-wrapper-id'?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 创建的 div 标签要使用的 className
|
|
39
|
+
*/
|
|
40
|
+
'data-wrapper-class'?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ChildComponent = React.ReactElement<IChildComponentProps>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 包裹放入其中的元素,并为每个元素创建一个 div
|
|
47
|
+
*
|
|
48
|
+
* 可以通过修改传入的 children 的 props 来定义一些属性,props 的定义可见:{ @link ChildComponent }
|
|
49
|
+
*/
|
|
50
|
+
export const BoxPanel: React.FC<{
|
|
51
|
+
children?: ChildComponent | ChildComponent[];
|
|
52
|
+
className?: string;
|
|
53
|
+
direction?: Layout.direction;
|
|
54
|
+
flex?: number;
|
|
55
|
+
zIndex?: number;
|
|
56
|
+
}> = ({ className, children = [], direction = 'left-to-right', ...restProps }) => {
|
|
57
|
+
// convert children to list
|
|
58
|
+
const arrayChildren = React.Children.toArray(children) as ChildComponent[];
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
{...restProps}
|
|
63
|
+
className={clsx(styles['box-panel'], className)}
|
|
64
|
+
style={{ flexDirection: Layout.getFlexDirection(direction), zIndex: restProps['z-index'] }}
|
|
65
|
+
>
|
|
66
|
+
{arrayChildren.map((child, index) => (
|
|
67
|
+
<div
|
|
68
|
+
key={index}
|
|
69
|
+
id={child['props']?.['data-wrapper-id']}
|
|
70
|
+
className={clsx(styles.wrapper, child['props']?.['data-wrapper-class'])}
|
|
71
|
+
style={
|
|
72
|
+
child['props']
|
|
73
|
+
? {
|
|
74
|
+
flex: child['props'].flex,
|
|
75
|
+
overflow: child['props'].overflow,
|
|
76
|
+
zIndex: child['props'].zIndex || child['props']['z-index'],
|
|
77
|
+
[Layout.getMinSizeProperty(direction)]: child['props'].defaultSize,
|
|
78
|
+
backgroundColor: child['props'].backgroundColor,
|
|
79
|
+
}
|
|
80
|
+
: {}
|
|
81
|
+
}
|
|
82
|
+
>
|
|
83
|
+
{child}
|
|
84
|
+
</div>
|
|
85
|
+
))}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { SlotRenderer } from '../../react-providers/slot';
|
|
4
|
+
|
|
5
|
+
import { BoxPanel } from './box-panel';
|
|
6
|
+
import { SplitPanel } from './split-panel';
|
|
7
|
+
|
|
8
|
+
export const getStorageValue = () => {
|
|
9
|
+
// 启动时渲染的颜色和尺寸,弱依赖
|
|
10
|
+
let savedLayout: { [key: string]: { size: number; currentId: string } } = {};
|
|
11
|
+
let savedColors: { [colorKey: string]: string } = {};
|
|
12
|
+
try {
|
|
13
|
+
savedLayout = JSON.parse(localStorage.getItem('layout') || '{}');
|
|
14
|
+
savedColors = JSON.parse(localStorage.getItem('theme') || '{}');
|
|
15
|
+
} catch (err) {}
|
|
16
|
+
return {
|
|
17
|
+
layout: savedLayout,
|
|
18
|
+
colors: savedColors,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const DefaultLayout = ToolbarActionBasedLayout;
|
|
23
|
+
|
|
24
|
+
export function ToolbarActionBasedLayout() {
|
|
25
|
+
const { colors, layout } = getStorageValue();
|
|
26
|
+
return (
|
|
27
|
+
<BoxPanel direction='top-to-bottom'>
|
|
28
|
+
<SlotRenderer backgroundColor={colors.menuBarBackground} defaultSize={0} slot='top' z-index={2} />
|
|
29
|
+
<SplitPanel id='main-horizontal' flex={1}>
|
|
30
|
+
<SlotRenderer
|
|
31
|
+
backgroundColor={colors.sideBarBackground}
|
|
32
|
+
slot='left'
|
|
33
|
+
isTabbar={true}
|
|
34
|
+
defaultSize={layout.left?.currentId ? layout.left?.size || 310 : 49}
|
|
35
|
+
minResize={204}
|
|
36
|
+
minSize={49}
|
|
37
|
+
/>
|
|
38
|
+
<SplitPanel id='main-vertical' minResize={300} flexGrow={1} direction='top-to-bottom'>
|
|
39
|
+
<SlotRenderer backgroundColor={colors.editorBackground} flex={2} flexGrow={1} minResize={200} slot='main' />
|
|
40
|
+
<SlotRenderer
|
|
41
|
+
backgroundColor={colors.panelBackground}
|
|
42
|
+
flex={1}
|
|
43
|
+
defaultSize={layout.bottom?.size}
|
|
44
|
+
minResize={160}
|
|
45
|
+
slot='bottom'
|
|
46
|
+
isTabbar={true}
|
|
47
|
+
/>
|
|
48
|
+
</SplitPanel>
|
|
49
|
+
<SlotRenderer
|
|
50
|
+
backgroundColor={colors.sideBarBackground}
|
|
51
|
+
slot='right'
|
|
52
|
+
isTabbar={true}
|
|
53
|
+
defaultSize={layout.right?.currentId ? layout.right?.size || 310 : 0}
|
|
54
|
+
minResize={200}
|
|
55
|
+
minSize={0}
|
|
56
|
+
/>
|
|
57
|
+
</SplitPanel>
|
|
58
|
+
<SlotRenderer backgroundColor={colors.statusBarBackground} defaultSize={24} slot='statusBar' />
|
|
59
|
+
</BoxPanel>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ResizeHandleVertical, ResizeHandleHorizontal } from '../resize/resize';
|
|
2
|
+
|
|
3
|
+
const flexDirectionMap: {
|
|
4
|
+
[index: string]: {
|
|
5
|
+
direction: any;
|
|
6
|
+
size: 'width' | 'height';
|
|
7
|
+
domSize: 'clientWidth' | 'clientHeight';
|
|
8
|
+
minSize: 'minWidth' | 'minHeight';
|
|
9
|
+
maxSize: 'maxWidth' | 'maxHeight';
|
|
10
|
+
};
|
|
11
|
+
} = {
|
|
12
|
+
'left-to-right': {
|
|
13
|
+
direction: 'row',
|
|
14
|
+
size: 'width',
|
|
15
|
+
domSize: 'clientHeight',
|
|
16
|
+
minSize: 'minWidth',
|
|
17
|
+
maxSize: 'maxWidth',
|
|
18
|
+
},
|
|
19
|
+
'right-to-left': {
|
|
20
|
+
direction: 'row-reverse',
|
|
21
|
+
size: 'width',
|
|
22
|
+
domSize: 'clientHeight',
|
|
23
|
+
minSize: 'minWidth',
|
|
24
|
+
maxSize: 'maxWidth',
|
|
25
|
+
},
|
|
26
|
+
'top-to-bottom': {
|
|
27
|
+
direction: 'column',
|
|
28
|
+
size: 'height',
|
|
29
|
+
domSize: 'clientWidth',
|
|
30
|
+
minSize: 'minHeight',
|
|
31
|
+
maxSize: 'maxHeight',
|
|
32
|
+
},
|
|
33
|
+
'bottom-to-top': {
|
|
34
|
+
direction: 'column-reverse',
|
|
35
|
+
size: 'height',
|
|
36
|
+
domSize: 'clientWidth',
|
|
37
|
+
minSize: 'minHeight',
|
|
38
|
+
maxSize: 'maxHeight',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export namespace Layout {
|
|
43
|
+
export type direction = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top';
|
|
44
|
+
|
|
45
|
+
export type alignment = 'horizontal' | 'vertical';
|
|
46
|
+
|
|
47
|
+
export function getFlexDirection(direction: Layout.direction) {
|
|
48
|
+
return flexDirectionMap[direction].direction;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getSizeProperty(direction: Layout.direction) {
|
|
52
|
+
return flexDirectionMap[direction].size;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getDomSizeProperty(direction: Layout.direction) {
|
|
56
|
+
return flexDirectionMap[direction].domSize;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function getMinSizeProperty(direction: Layout.direction) {
|
|
60
|
+
return flexDirectionMap[direction].minSize;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function getMaxSizeProperty(direction: Layout.direction) {
|
|
64
|
+
return flexDirectionMap[direction].maxSize;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getResizeHandle(direction: Layout.direction) {
|
|
68
|
+
if (direction === 'bottom-to-top' || direction === 'top-to-bottom') {
|
|
69
|
+
return ResizeHandleVertical;
|
|
70
|
+
}
|
|
71
|
+
return ResizeHandleHorizontal;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getTabbarDirection(direction: Layout.direction) {
|
|
75
|
+
if (direction === 'bottom-to-top' || direction === 'top-to-bottom') {
|
|
76
|
+
return 'row';
|
|
77
|
+
}
|
|
78
|
+
return 'column';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Injectable, INJECTOR_TOKEN, Injector, Autowired } from '@opensumi/di';
|
|
2
|
+
|
|
3
|
+
@Injectable({ multiple: true })
|
|
4
|
+
export class SplitPanelService {
|
|
5
|
+
private static MIN_SIZE = 120;
|
|
6
|
+
constructor(public panelId: string) {}
|
|
7
|
+
|
|
8
|
+
panels: HTMLElement[] = [];
|
|
9
|
+
|
|
10
|
+
rootNode: HTMLElement | undefined;
|
|
11
|
+
|
|
12
|
+
get isVisible(): boolean {
|
|
13
|
+
return (this.rootNode && this.rootNode.clientHeight > 0) || false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getFirstResizablePanel(index: number, direction: boolean, isPrev?: boolean): HTMLElement | undefined {
|
|
17
|
+
if (isPrev) {
|
|
18
|
+
if (direction) {
|
|
19
|
+
return this.panels[index];
|
|
20
|
+
} else {
|
|
21
|
+
for (let i = index; i >= 0; i--) {
|
|
22
|
+
if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
|
|
23
|
+
return this.panels[i];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
if (!direction) {
|
|
29
|
+
return this.panels[index + 1];
|
|
30
|
+
} else {
|
|
31
|
+
for (let i = index + 1; i < this.panels.length; i++) {
|
|
32
|
+
if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
|
|
33
|
+
return this.panels[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Injectable()
|
|
42
|
+
export class SplitPanelManager {
|
|
43
|
+
@Autowired(INJECTOR_TOKEN)
|
|
44
|
+
injector: Injector;
|
|
45
|
+
|
|
46
|
+
services: Map<string, SplitPanelService> = new Map();
|
|
47
|
+
|
|
48
|
+
getService(panelId: string) {
|
|
49
|
+
let service = this.services.get(panelId);
|
|
50
|
+
if (!service) {
|
|
51
|
+
service = this.injector.get(SplitPanelService, [panelId]);
|
|
52
|
+
this.services.set(panelId, service);
|
|
53
|
+
}
|
|
54
|
+
return service;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import clsx from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { IEventBus } from '@opensumi/ide-core-common';
|
|
5
|
+
|
|
6
|
+
import { ResizeEvent } from '../../layout';
|
|
7
|
+
import { useInjectable } from '../../react-hooks';
|
|
8
|
+
import { IResizeHandleDelegate, ResizeFlexMode } from '../resize/resize';
|
|
9
|
+
|
|
10
|
+
import { Layout } from './layout';
|
|
11
|
+
import { SplitPanelManager } from './split-panel.service';
|
|
12
|
+
import styles from './styles.module.less';
|
|
13
|
+
|
|
14
|
+
export interface ResizeHandle {
|
|
15
|
+
setSize: (targetSize?: number, isLatter?: boolean) => void;
|
|
16
|
+
setRelativeSize: (prev: number, next: number, isLatter: boolean) => void;
|
|
17
|
+
getSize: (isLatter: boolean) => number;
|
|
18
|
+
getRelativeSize: (isLatter: boolean) => number[];
|
|
19
|
+
lockSize: (lock: boolean | undefined, isLatter: boolean) => void;
|
|
20
|
+
setMaxSize: (lock: boolean | undefined, isLatter: boolean) => void;
|
|
21
|
+
hidePanel: (show?: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const PanelContext = React.createContext<ResizeHandle>({
|
|
25
|
+
setSize: (targetSize: number, isLatter: boolean) => {},
|
|
26
|
+
setRelativeSize: (prev, next, isLatter) => {},
|
|
27
|
+
getSize: (isLatter: boolean) => 0,
|
|
28
|
+
getRelativeSize: (isLatter: boolean) => [0, 0],
|
|
29
|
+
lockSize: (lock: boolean | undefined, isLatter: boolean) => {},
|
|
30
|
+
setMaxSize: (lock: boolean | undefined, isLatter: boolean) => {},
|
|
31
|
+
hidePanel: (show?: boolean) => {},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
type ChildComponent = React.ReactElement<SplitChildProps>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 推荐使用 `data-sp-` 方式来传递这些参数。
|
|
38
|
+
*
|
|
39
|
+
* 如:
|
|
40
|
+
*
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <SplitPanel>
|
|
43
|
+
* <div data-sp-id="div1" data-sp-minResize={100}></div>
|
|
44
|
+
* <div></div>
|
|
45
|
+
* </SplitPanel>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
interface SplitChildProps {
|
|
49
|
+
id: string;
|
|
50
|
+
minSize?: number;
|
|
51
|
+
maxSize?: number;
|
|
52
|
+
minResize?: number;
|
|
53
|
+
flex?: number;
|
|
54
|
+
overflow?: string;
|
|
55
|
+
flexGrow?: number;
|
|
56
|
+
slot?: string;
|
|
57
|
+
noResize?: boolean;
|
|
58
|
+
savedSize?: number;
|
|
59
|
+
defaultSize?: number;
|
|
60
|
+
children?: ChildComponent | ChildComponent[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SplitPanelProps extends SplitChildProps {
|
|
64
|
+
className?: string;
|
|
65
|
+
style?: React.CSSProperties;
|
|
66
|
+
direction?: Layout.direction;
|
|
67
|
+
id: string;
|
|
68
|
+
// setAbsoluteSize 时保证相邻节点总宽度不变
|
|
69
|
+
resizeKeep?: boolean;
|
|
70
|
+
dynamicTarget?: boolean;
|
|
71
|
+
// 控制使用传入尺寸之和作为总尺寸或使用dom尺寸
|
|
72
|
+
useDomSize?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* ResizeHandle 的 className,用以展示分割线等
|
|
75
|
+
*/
|
|
76
|
+
resizeHandleClassName?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const getProp = (child: React.ReactNode, prop: string) =>
|
|
80
|
+
child && child['props'] && (child['props'][prop] ?? child['props'][`data-sp-${prop}`]);
|
|
81
|
+
|
|
82
|
+
export const SplitPanel: React.FC<SplitPanelProps> = ({
|
|
83
|
+
id,
|
|
84
|
+
className,
|
|
85
|
+
resizeHandleClassName,
|
|
86
|
+
style,
|
|
87
|
+
children = [],
|
|
88
|
+
direction = 'left-to-right',
|
|
89
|
+
resizeKeep = true,
|
|
90
|
+
flexGrow,
|
|
91
|
+
dynamicTarget,
|
|
92
|
+
minResize,
|
|
93
|
+
useDomSize,
|
|
94
|
+
...restProps
|
|
95
|
+
}) => {
|
|
96
|
+
const ResizeHandle = Layout.getResizeHandle(direction);
|
|
97
|
+
// convert children to list
|
|
98
|
+
const childList = React.Children.toArray(children);
|
|
99
|
+
const totalFlexNum = childList.reduce(
|
|
100
|
+
(accumulator, item) => accumulator + (getProp(item, 'flex') !== undefined ? getProp(item, 'flex') : 1),
|
|
101
|
+
0,
|
|
102
|
+
);
|
|
103
|
+
const elements: React.ReactNodeArray = [];
|
|
104
|
+
const resizeDelegates = React.useRef<IResizeHandleDelegate[]>([]);
|
|
105
|
+
const eventBus = useInjectable<IEventBus>(IEventBus);
|
|
106
|
+
const rootRef = React.useRef<HTMLElement>();
|
|
107
|
+
|
|
108
|
+
const splitPanelService = useInjectable<SplitPanelManager>(SplitPanelManager).getService(id);
|
|
109
|
+
const maxLockState = React.useRef(childList.map(() => false));
|
|
110
|
+
const hideState = React.useRef(childList.map(() => false));
|
|
111
|
+
const resizeLockState = React.useRef(maxLockState.current.slice(0, childList.length - 1));
|
|
112
|
+
const [locks, setLocks] = React.useState<boolean[]>(resizeLockState.current);
|
|
113
|
+
const [hides, setHides] = React.useState<boolean[]>(hideState.current);
|
|
114
|
+
const [maxLocks, setMaxLocks] = React.useState<boolean[]>(maxLockState.current);
|
|
115
|
+
splitPanelService.panels = [];
|
|
116
|
+
|
|
117
|
+
// 获取setSize的handle,对于最右端或最底部的视图,取上一个位置的handle
|
|
118
|
+
const setSizeHandle = (index) => (size?: number, isLatter?: boolean) => {
|
|
119
|
+
const targetIndex = isLatter ? index - 1 : index;
|
|
120
|
+
const delegate = resizeDelegates.current[targetIndex];
|
|
121
|
+
if (delegate) {
|
|
122
|
+
delegate.setAbsoluteSize(
|
|
123
|
+
size !== undefined ? size : getProp(childList[index], 'defaultSize'),
|
|
124
|
+
isLatter,
|
|
125
|
+
resizeKeep,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const setRelativeSizeHandle = (index) => (prev: number, next: number, isLatter?: boolean) => {
|
|
131
|
+
const targetIndex = isLatter ? index - 1 : index;
|
|
132
|
+
const delegate = resizeDelegates.current[targetIndex];
|
|
133
|
+
if (delegate) {
|
|
134
|
+
delegate.setRelativeSize(prev, next);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const getSizeHandle = (index) => (isLatter?: boolean) => {
|
|
139
|
+
const targetIndex = isLatter ? index - 1 : index;
|
|
140
|
+
const delegate = resizeDelegates.current[targetIndex];
|
|
141
|
+
if (delegate) {
|
|
142
|
+
return delegate.getAbsoluteSize(isLatter);
|
|
143
|
+
}
|
|
144
|
+
return 0;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const getRelativeSizeHandle = (index) => (isLatter?: boolean) => {
|
|
148
|
+
const targetIndex = isLatter ? index - 1 : index;
|
|
149
|
+
const delegate = resizeDelegates.current[targetIndex];
|
|
150
|
+
if (delegate) {
|
|
151
|
+
return delegate.getRelativeSize();
|
|
152
|
+
}
|
|
153
|
+
return [0, 0];
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const lockResizeHandle = (index) => (lock: boolean | undefined, isLatter?: boolean) => {
|
|
157
|
+
const targetIndex = isLatter ? index - 1 : index;
|
|
158
|
+
const newResizeState = resizeLockState.current.map((state, idx) =>
|
|
159
|
+
idx === targetIndex ? (lock !== undefined ? lock : !state) : state,
|
|
160
|
+
);
|
|
161
|
+
resizeLockState.current = newResizeState;
|
|
162
|
+
setLocks(newResizeState);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const setMaxSizeHandle = (index) => (lock: boolean | undefined, isLatter?: boolean) => {
|
|
166
|
+
const newMaxState = maxLockState.current.map((state, idx) =>
|
|
167
|
+
idx === index ? (lock !== undefined ? lock : !state) : state,
|
|
168
|
+
);
|
|
169
|
+
maxLockState.current = newMaxState;
|
|
170
|
+
setMaxLocks(newMaxState);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const hidePanelHandle = (index: number) => (show?: boolean) => {
|
|
174
|
+
const newHideState = hideState.current.map((state, idx) =>
|
|
175
|
+
idx === index ? (show !== undefined ? !show : !state) : state,
|
|
176
|
+
);
|
|
177
|
+
hideState.current = newHideState;
|
|
178
|
+
const location = getProp(childList[index], 'slot') || getProp(childList[index], 'id');
|
|
179
|
+
if (location) {
|
|
180
|
+
fireResizeEvent(location);
|
|
181
|
+
}
|
|
182
|
+
setHides(newHideState);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const fireResizeEvent = (location?: string) => {
|
|
186
|
+
if (location) {
|
|
187
|
+
eventBus.fire(new ResizeEvent({ slotLocation: location }));
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
childList.forEach((element, index) => {
|
|
192
|
+
if (index !== 0) {
|
|
193
|
+
const targetElement = index === 1 ? childList[index - 1] : childList[index];
|
|
194
|
+
let flexMode: ResizeFlexMode | undefined;
|
|
195
|
+
if (getProp(element, 'flexGrow')) {
|
|
196
|
+
flexMode = ResizeFlexMode.Prev;
|
|
197
|
+
} else if (getProp(childList[index - 1], 'flexGrow')) {
|
|
198
|
+
flexMode = ResizeFlexMode.Next;
|
|
199
|
+
}
|
|
200
|
+
const noResize = getProp(targetElement, 'noResize') || locks[index - 1];
|
|
201
|
+
if (!noResize) {
|
|
202
|
+
elements.push(
|
|
203
|
+
<ResizeHandle
|
|
204
|
+
className={resizeHandleClassName}
|
|
205
|
+
onResize={(prev, next) => {
|
|
206
|
+
const prevLocation = getProp(childList[index - 1], 'slot') || getProp(childList[index - 1], 'id');
|
|
207
|
+
const nextLocation = getProp(childList[index], 'slot') || getProp(childList[index], 'id');
|
|
208
|
+
fireResizeEvent(prevLocation!);
|
|
209
|
+
fireResizeEvent(nextLocation!);
|
|
210
|
+
}}
|
|
211
|
+
noColor={true}
|
|
212
|
+
findNextElement={
|
|
213
|
+
dynamicTarget
|
|
214
|
+
? (direction: boolean) => splitPanelService.getFirstResizablePanel(index - 1, direction)
|
|
215
|
+
: undefined
|
|
216
|
+
}
|
|
217
|
+
findPrevElement={
|
|
218
|
+
dynamicTarget
|
|
219
|
+
? (direction: boolean) => splitPanelService.getFirstResizablePanel(index - 1, direction, true)
|
|
220
|
+
: undefined
|
|
221
|
+
}
|
|
222
|
+
key={`split-handle-${index}`}
|
|
223
|
+
delegate={(delegate) => {
|
|
224
|
+
resizeDelegates.current.push(delegate);
|
|
225
|
+
}}
|
|
226
|
+
flexMode={flexMode}
|
|
227
|
+
/>,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
elements.push(
|
|
232
|
+
<PanelContext.Provider
|
|
233
|
+
key={index}
|
|
234
|
+
value={{
|
|
235
|
+
setSize: setSizeHandle(index),
|
|
236
|
+
getSize: getSizeHandle(index),
|
|
237
|
+
setRelativeSize: setRelativeSizeHandle(index),
|
|
238
|
+
getRelativeSize: getRelativeSizeHandle(index),
|
|
239
|
+
lockSize: lockResizeHandle(index),
|
|
240
|
+
setMaxSize: setMaxSizeHandle(index),
|
|
241
|
+
hidePanel: hidePanelHandle(index),
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
<div
|
|
245
|
+
data-min-resize={getProp(element, 'minResize')}
|
|
246
|
+
ref={(ele) => {
|
|
247
|
+
if (ele && splitPanelService.panels.indexOf(ele) === -1) {
|
|
248
|
+
splitPanelService.panels.push(ele);
|
|
249
|
+
}
|
|
250
|
+
}}
|
|
251
|
+
id={getProp(element, 'id') /* @deprecated: query by data-view-id */}
|
|
252
|
+
style={{
|
|
253
|
+
// 手风琴场景,固定尺寸和flex尺寸混合布局;需要在resize flex模式下禁用
|
|
254
|
+
...(getProp(element, 'flex') &&
|
|
255
|
+
!getProp(element, 'savedSize') &&
|
|
256
|
+
!childList.find((item) => getProp(item, 'flexGrow'))
|
|
257
|
+
? { flex: getProp(element, 'flex') }
|
|
258
|
+
: { [Layout.getSizeProperty(direction)]: getElementSize(element) }),
|
|
259
|
+
// 相对尺寸带来的问题,必须限制最小最大尺寸
|
|
260
|
+
[Layout.getMinSizeProperty(direction)]: getProp(element, 'minSize')
|
|
261
|
+
? getProp(element, 'minSize') + 'px'
|
|
262
|
+
: '-1px',
|
|
263
|
+
[Layout.getMaxSizeProperty(direction)]:
|
|
264
|
+
maxLocks[index] && getProp(element, 'maxSize') ? getProp(element, 'maxSize') + 'px' : 'unset',
|
|
265
|
+
// resize flex模式下应用flexGrow
|
|
266
|
+
...(getProp(element, 'flexGrow') !== undefined ? { flexGrow: getProp(element, 'flexGrow') } : {}),
|
|
267
|
+
display: hides[index] ? 'none' : 'block',
|
|
268
|
+
backgroundColor: getProp(element, 'backgroundColor'),
|
|
269
|
+
}}
|
|
270
|
+
>
|
|
271
|
+
{element}
|
|
272
|
+
</div>
|
|
273
|
+
</PanelContext.Provider>,
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
function getElementSize(element: any) {
|
|
278
|
+
if (getProp(element, 'savedSize')) {
|
|
279
|
+
return getProp(element, 'savedSize') + 'px';
|
|
280
|
+
} else if (getProp(element, 'defaultSize') !== undefined) {
|
|
281
|
+
return getProp(element, 'defaultSize') + 'px';
|
|
282
|
+
} else if (getProp(element, 'flex')) {
|
|
283
|
+
return (getProp(element, 'flex') / totalFlexNum) * 100 + '%';
|
|
284
|
+
} else {
|
|
285
|
+
return (1 / totalFlexNum) * 100 + '%';
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
React.useEffect(() => {
|
|
290
|
+
if (rootRef.current) {
|
|
291
|
+
splitPanelService.rootNode = rootRef.current;
|
|
292
|
+
}
|
|
293
|
+
const disposer = eventBus.on(ResizeEvent, (e) => {
|
|
294
|
+
if (e.payload.slotLocation === id) {
|
|
295
|
+
childList.forEach((c) => {
|
|
296
|
+
fireResizeEvent(getProp(c, 'slot') || getProp(c, 'id'));
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return () => {
|
|
301
|
+
disposer.dispose();
|
|
302
|
+
};
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<div
|
|
307
|
+
ref={(ele) => (rootRef.current = ele!)}
|
|
308
|
+
{...restProps}
|
|
309
|
+
className={clsx(styles['split-panel'], className)}
|
|
310
|
+
style={{ flexDirection: Layout.getFlexDirection(direction), ...style }}
|
|
311
|
+
>
|
|
312
|
+
{elements}
|
|
313
|
+
</div>
|
|
314
|
+
);
|
|
315
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.split-panel {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.box-panel {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ease {
|
|
15
|
+
transition: height 0.1s ease-out, width 0.1s ease-out;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wrapper {
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: 2;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './loading.view';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.loading_indicator {
|
|
2
|
+
width: 20px;
|
|
3
|
+
height: 20px;
|
|
4
|
+
background-image: url('./media/loading.svg');
|
|
5
|
+
background-size: cover;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.vs-dark .loading_indicator {
|
|
9
|
+
background-image: url('./media/loading-dark.svg');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.hc-black .loading_indicator {
|
|
13
|
+
background-image: url('./media/loading-hc.svg');
|
|
14
|
+
}
|