@e-xi/xion 0.0.6
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/README.md +1 -0
- package/dist/bin/icon-generator.d.ts +22 -0
- package/dist/bin/index.d.ts +5 -0
- package/dist/bin/index.js +92 -0
- package/dist/bin/logo-generator.d.ts +22 -0
- package/dist/chunk-files/chunk-34OODP7M.js +147 -0
- package/dist/chunk-files/chunk-3KBZWBNP.js +51 -0
- package/dist/chunk-files/chunk-3R6EJDYR.js +10 -0
- package/dist/chunk-files/chunk-3RVKOFMP.js +68 -0
- package/dist/chunk-files/chunk-3S5OTD47.js +35 -0
- package/dist/chunk-files/chunk-3XB4IEWO.js +195 -0
- package/dist/chunk-files/chunk-3XOVD6UX.js +8 -0
- package/dist/chunk-files/chunk-4HEDNQUP.js +426 -0
- package/dist/chunk-files/chunk-4SSGMLEE.js +934 -0
- package/dist/chunk-files/chunk-5PKWVAQP.js +92 -0
- package/dist/chunk-files/chunk-6BOPFOZD.js +19 -0
- package/dist/chunk-files/chunk-6FDO72PN.js +25 -0
- package/dist/chunk-files/chunk-6X74EPRM.js +0 -0
- package/dist/chunk-files/chunk-B2FI5WI5.js +67 -0
- package/dist/chunk-files/chunk-B7DTBTWQ.js +74 -0
- package/dist/chunk-files/chunk-BFD2LHLK.js +60 -0
- package/dist/chunk-files/chunk-BJOPQNB2.js +319 -0
- package/dist/chunk-files/chunk-BMOLIJ3W.js +89 -0
- package/dist/chunk-files/chunk-BPTFUGTP.js +97 -0
- package/dist/chunk-files/chunk-CSUNGWAE.js +405 -0
- package/dist/chunk-files/chunk-D5ZV4VMI.js +627 -0
- package/dist/chunk-files/chunk-DD6WZ4NY.js +841 -0
- package/dist/chunk-files/chunk-DEODEAKM.js +19 -0
- package/dist/chunk-files/chunk-DRMV3M5V.js +1970 -0
- package/dist/chunk-files/chunk-EQTU45UO.js +21 -0
- package/dist/chunk-files/chunk-F7YTK2MY.js +154 -0
- package/dist/chunk-files/chunk-FMQTZ3QV.js +17 -0
- package/dist/chunk-files/chunk-FPN7JYR4.js +67 -0
- package/dist/chunk-files/chunk-FULHNQ4O.js +1243 -0
- package/dist/chunk-files/chunk-GN2FNR3Z.js +259 -0
- package/dist/chunk-files/chunk-GROGDGEL.js +177 -0
- package/dist/chunk-files/chunk-GUOSVDXA.js +34 -0
- package/dist/chunk-files/chunk-HT5V5A7S.js +6 -0
- package/dist/chunk-files/chunk-ID3YDA2K.js +19 -0
- package/dist/chunk-files/chunk-IH3R2NDR.js +230 -0
- package/dist/chunk-files/chunk-IMGYTSWY.js +261 -0
- package/dist/chunk-files/chunk-J34MOWJP.js +26 -0
- package/dist/chunk-files/chunk-KFK47PDH.js +77 -0
- package/dist/chunk-files/chunk-KFV4GXVE.js +11 -0
- package/dist/chunk-files/chunk-LFHJJQW3.js +723 -0
- package/dist/chunk-files/chunk-LQ67F6EY.js +32 -0
- package/dist/chunk-files/chunk-MJ6Q3TIX.js +703 -0
- package/dist/chunk-files/chunk-OUFO3LM4.js +135 -0
- package/dist/chunk-files/chunk-P4CX6I4J.js +14 -0
- package/dist/chunk-files/chunk-PL5KNBCY.js +78 -0
- package/dist/chunk-files/chunk-PVWRRUOK.js +11 -0
- package/dist/chunk-files/chunk-Q7LCZIQP.js +15 -0
- package/dist/chunk-files/chunk-Q7YMMN7J.js +220 -0
- package/dist/chunk-files/chunk-RAVPJRBA.js +118 -0
- package/dist/chunk-files/chunk-RN7AI33H.js +26 -0
- package/dist/chunk-files/chunk-RODB64YF.js +148 -0
- package/dist/chunk-files/chunk-SVTZ4T6S.js +10 -0
- package/dist/chunk-files/chunk-T3QCAOCO.js +20 -0
- package/dist/chunk-files/chunk-U4XEWVBH.js +19 -0
- package/dist/chunk-files/chunk-UCMR6V67.js +746 -0
- package/dist/chunk-files/chunk-UFYEZIUE.js +1269 -0
- package/dist/chunk-files/chunk-UIJUY7QZ.js +18 -0
- package/dist/chunk-files/chunk-VGDNICVG.js +67 -0
- package/dist/chunk-files/chunk-W2I3I7U7.js +35 -0
- package/dist/chunk-files/chunk-WGYOMA43.js +33 -0
- package/dist/chunk-files/chunk-WKVLVI6N.js +44 -0
- package/dist/chunk-files/chunk-WOJ2UKI7.js +11 -0
- package/dist/chunk-files/chunk-Y3OEXVQ2.js +59 -0
- package/dist/chunk-files/chunk-YLZRRUY7.js +6 -0
- package/dist/chunk-files/chunk-YTHS2ZV7.js +51 -0
- package/dist/chunk-files/chunk-YXAEUJKJ.js +331 -0
- package/dist/chunk-files/chunk-YZOJOLFL.js +121 -0
- package/dist/main/app/app-lifecycle-abstract.d.ts +190 -0
- package/dist/main/app/app-lifecycle.d.ts +7 -0
- package/dist/main/app/icons/icon.ico +0 -0
- package/dist/main/app/index.d.ts +8 -0
- package/dist/main/app/index.js +1226 -0
- package/dist/main/app/types/app.d.ts +74 -0
- package/dist/main/app/xo-app-abstract.d.ts +464 -0
- package/dist/main/app/xo-app.d.ts +23 -0
- package/dist/main/auth/index.d.ts +8 -0
- package/dist/main/auth/index.js +109 -0
- package/dist/main/auth/jwt-auth-manager.d.ts +302 -0
- package/dist/main/auth/jwt-auth-provider-abstract.d.ts +100 -0
- package/dist/main/auth/jwt-auth-refresh-rejected-error.d.ts +12 -0
- package/dist/main/auth/jwt-auth-session-changed-error.d.ts +12 -0
- package/dist/main/auth/types/jwt-auth-manager.d.ts +13 -0
- package/dist/main/banner/banner-abstract.d.ts +38 -0
- package/dist/main/banner/banner-manager.d.ts +20 -0
- package/dist/main/banner/index.d.ts +6 -0
- package/dist/main/banner/index.js +10 -0
- package/dist/main/banner/types/banner.d.ts +17 -0
- package/dist/main/config/app-config.d.ts +6 -0
- package/dist/main/config/index.d.ts +13 -0
- package/dist/main/config/index.js +33 -0
- package/dist/main/config/logger-config.d.ts +6 -0
- package/dist/main/config/remote-service-config.d.ts +6 -0
- package/dist/main/config/tray-config.d.ts +6 -0
- package/dist/main/config/types/app.d.ts +38 -0
- package/dist/main/config/types/logger.d.ts +82 -0
- package/dist/main/config/types/window.d.ts +35 -0
- package/dist/main/config/updater-config.d.ts +6 -0
- package/dist/main/config/window/main-window-config.d.ts +6 -0
- package/dist/main/config/window/setting-window-config.d.ts +6 -0
- package/dist/main/file-association/file-association-handlers-abstract.d.ts +23 -0
- package/dist/main/file-association/file-association-manager-abstract.d.ts +87 -0
- package/dist/main/file-association/file-association-manager.d.ts +13 -0
- package/dist/main/file-association/handlers/app-file-association-handlers.d.ts +12 -0
- package/dist/main/file-association/index.d.ts +8 -0
- package/dist/main/file-association/index.js +13 -0
- package/dist/main/file-association/types/file-association.d.ts +31 -0
- package/dist/main/ipc/handlers/app-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/auth-handlers.d.ts +12 -0
- package/dist/main/ipc/handlers/clipboard-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/contex-menu-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/dialog-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/file-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/log-handlers.d.ts +45 -0
- package/dist/main/ipc/handlers/remote-service-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/shell-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/theme-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/updater-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/window-handlers.d.ts +13 -0
- package/dist/main/ipc/index.d.ts +20 -0
- package/dist/main/ipc/index.js +60 -0
- package/dist/main/ipc/ipc-handlers-abstract.d.ts +23 -0
- package/dist/main/ipc/ipc-manager-abstract.d.ts +46 -0
- package/dist/main/ipc/ipc-manager.d.ts +13 -0
- package/dist/main/ipc/types/ipc-handler.d.ts +22 -0
- package/dist/main/ipc/utils/ipc-handler-util.d.ts +24 -0
- package/dist/main/logger/index.d.ts +4 -0
- package/dist/main/logger/index.js +13 -0
- package/dist/main/logger/xo-logger.d.ts +113 -0
- package/dist/main/menu/consts/menu-type.d.ts +1 -0
- package/dist/main/menu/index.d.ts +8 -0
- package/dist/main/menu/index.js +28 -0
- package/dist/main/menu/menu-items.d.ts +192 -0
- package/dist/main/menu/menu-manager-abstract.d.ts +273 -0
- package/dist/main/menu/menu-manager.d.ts +12 -0
- package/dist/main/menu/types/menu.d.ts +101 -0
- package/dist/main/mode/app-mode.d.ts +32 -0
- package/dist/main/mode/index.d.ts +5 -0
- package/dist/main/mode/index.js +9 -0
- package/dist/main/mode/types/mode.d.ts +25 -0
- package/dist/main/protocol/consts/protocol-keys.d.ts +10 -0
- package/dist/main/protocol/handlers/app-protocol-handlers.d.ts +12 -0
- package/dist/main/protocol/index.d.ts +9 -0
- package/dist/main/protocol/index.js +15 -0
- package/dist/main/protocol/protocol-handlers-abstract.d.ts +23 -0
- package/dist/main/protocol/protocol-manager-abstract.d.ts +85 -0
- package/dist/main/protocol/protocol-manager.d.ts +13 -0
- package/dist/main/protocol/types/protocol.d.ts +33 -0
- package/dist/main/remote-service/consts/remote-service-methods.d.ts +5 -0
- package/dist/main/remote-service/index.d.ts +7 -0
- package/dist/main/remote-service/index.js +17 -0
- package/dist/main/remote-service/remote-service-manager-abstract.d.ts +303 -0
- package/dist/main/remote-service/remote-service-manager.d.ts +7 -0
- package/dist/main/remote-service/types/remote-service.d.ts +9 -0
- package/dist/main/renderer-protocol/handlers/renderer-remote-service-protocol-handlers.d.ts +130 -0
- package/dist/main/renderer-protocol/handlers/renderer-root-protocol-handlers.d.ts +65 -0
- package/dist/main/renderer-protocol/index.d.ts +9 -0
- package/dist/main/renderer-protocol/index.js +18 -0
- package/dist/main/renderer-protocol/renderer-protocol-handlers-abstract.d.ts +23 -0
- package/dist/main/renderer-protocol/renderer-protocol-manager-abstract.d.ts +78 -0
- package/dist/main/renderer-protocol/renderer-protocol-manager.d.ts +13 -0
- package/dist/main/renderer-protocol/types/renderer-protocol.d.ts +34 -0
- package/dist/main/shortcut/handlers/app-shortcut-handlers.d.ts +11 -0
- package/dist/main/shortcut/handlers/window-shortcut-handlers.d.ts +11 -0
- package/dist/main/shortcut/index.d.ts +9 -0
- package/dist/main/shortcut/index.js +17 -0
- package/dist/main/shortcut/shortcut-handlers-abstract.d.ts +18 -0
- package/dist/main/shortcut/shortcut-manager-abstract.d.ts +121 -0
- package/dist/main/shortcut/shortcut-manager.d.ts +12 -0
- package/dist/main/shortcut/types/shortcut.d.ts +50 -0
- package/dist/main/store/app-store.d.ts +179 -0
- package/dist/main/store/index.d.ts +7 -0
- package/dist/main/store/index.js +13 -0
- package/dist/main/store/jwt-auth-store.d.ts +36 -0
- package/dist/main/store/types/app-store.d.ts +46 -0
- package/dist/main/store/types/jwt-auth-store.d.ts +14 -0
- package/dist/main/theme/consts/theme-sources.d.ts +10 -0
- package/dist/main/theme/index.d.ts +7 -0
- package/dist/main/theme/index.js +16 -0
- package/dist/main/theme/theme-manager-abstract.d.ts +93 -0
- package/dist/main/theme/theme-manager.d.ts +7 -0
- package/dist/main/theme/types/theme.d.ts +38 -0
- package/dist/main/tray/consts/tray-animation-name.d.ts +1 -0
- package/dist/main/tray/consts/tray-icon-name.d.ts +1 -0
- package/dist/main/tray/icons/blur.ico +0 -0
- package/dist/main/tray/icons/error.ico +0 -0
- package/dist/main/tray/icons/focus.ico +0 -0
- package/dist/main/tray/icons/none.ico +0 -0
- package/dist/main/tray/icons/offline.ico +0 -0
- package/dist/main/tray/icons/online.ico +0 -0
- package/dist/main/tray/icons/success.ico +0 -0
- package/dist/main/tray/index.d.ts +11 -0
- package/dist/main/tray/index.js +27 -0
- package/dist/main/tray/tray-animation.d.ts +48 -0
- package/dist/main/tray/tray-icon.d.ts +51 -0
- package/dist/main/tray/tray-lifecycle-abstract.d.ts +154 -0
- package/dist/main/tray/tray-lifecycle.d.ts +7 -0
- package/dist/main/tray/tray-manager.d.ts +173 -0
- package/dist/main/tray/types/tray.d.ts +81 -0
- package/dist/main/updater/dev-app-update.yml +5 -0
- package/dist/main/updater/index.d.ts +6 -0
- package/dist/main/updater/index.js +20 -0
- package/dist/main/updater/types/updater.d.ts +167 -0
- package/dist/main/updater/updater-manager-abstract.d.ts +237 -0
- package/dist/main/updater/updater-manager.d.ts +7 -0
- package/dist/main/utils/file-association-util.d.ts +43 -0
- package/dist/main/utils/index.d.ts +14 -0
- package/dist/main/utils/index.js +105 -0
- package/dist/main/utils/menu-util.d.ts +12 -0
- package/dist/main/utils/protocol-util.d.ts +49 -0
- package/dist/main/utils/runtime-config-util.d.ts +75 -0
- package/dist/main/utils/shortcut-util.d.ts +38 -0
- package/dist/main/utils/tray-util.d.ts +18 -0
- package/dist/main/utils/window-util.d.ts +55 -0
- package/dist/main/utils/xo-app-root-util.d.ts +30 -0
- package/dist/main/utils/xo-app-util.d.ts +24 -0
- package/dist/main/utils/xo-path-util.d.ts +59 -0
- package/dist/main/utils/xo-util.d.ts +17 -0
- package/dist/main/window/index.d.ts +10 -0
- package/dist/main/window/index.js +36 -0
- package/dist/main/window/main/main-window-lifecycle.d.ts +7 -0
- package/dist/main/window/main/main-window-type.d.ts +5 -0
- package/dist/main/window/setting/setting-window-lifecycle.d.ts +7 -0
- package/dist/main/window/setting/setting-window-type.d.ts +5 -0
- package/dist/main/window/types/window.d.ts +86 -0
- package/dist/main/window/window-lifecycle-abstract.d.ts +514 -0
- package/dist/main/window/window-manager.d.ts +422 -0
- package/dist/preload/bridge/bridge-abstract.d.ts +11 -0
- package/dist/preload/bridge/bridge.d.ts +35 -0
- package/dist/preload/bridge/index.d.ts +6 -0
- package/dist/preload/bridge/index.js +117 -0
- package/dist/preload/bridge/preload.cjs +1706 -0
- package/dist/preload/bridge/preload.internal.d.ts +1 -0
- package/dist/preload/bridge/types/bridge.d.ts +19 -0
- package/dist/preload/bridges/app/app-bridge.d.ts +142 -0
- package/dist/preload/bridges/app/types/app.d.ts +65 -0
- package/dist/preload/bridges/auth/auth-bridge.d.ts +36 -0
- package/dist/preload/bridges/auth/types/auth.d.ts +23 -0
- package/dist/preload/bridges/clipboard/clipboard-bridge.d.ts +37 -0
- package/dist/preload/bridges/clipboard/types/clipboard.d.ts +23 -0
- package/dist/preload/bridges/context-menu/context-menu-bridge.d.ts +27 -0
- package/dist/preload/bridges/context-menu/types/context-menu.d.ts +19 -0
- package/dist/preload/bridges/dialog/dialog-bridge.d.ts +30 -0
- package/dist/preload/bridges/dialog/types/dialog.d.ts +41 -0
- package/dist/preload/bridges/file/file-bridge.d.ts +34 -0
- package/dist/preload/bridges/file/types/file.d.ts +21 -0
- package/dist/preload/bridges/index.d.ts +29 -0
- package/dist/preload/bridges/index.js +40 -0
- package/dist/preload/bridges/ipc/ipc-bridge.d.ts +43 -0
- package/dist/preload/bridges/ipc/types/ipc.d.ts +23 -0
- package/dist/preload/bridges/log/log-bridge.d.ts +52 -0
- package/dist/preload/bridges/log/types/log.d.ts +20 -0
- package/dist/preload/bridges/remote-service/remote-service-bridge.d.ts +55 -0
- package/dist/preload/bridges/remote-service/types/remote-service.d.ts +29 -0
- package/dist/preload/bridges/shell/shell-bridge.d.ts +27 -0
- package/dist/preload/bridges/shell/types/shell.d.ts +19 -0
- package/dist/preload/bridges/theme/theme-bridge.d.ts +32 -0
- package/dist/preload/bridges/theme/types/theme.d.ts +21 -0
- package/dist/preload/bridges/updater/types/updater.d.ts +35 -0
- package/dist/preload/bridges/updater/updater-bridge.d.ts +66 -0
- package/dist/preload/bridges/window/internal/route-redirect-buffer.d.ts +36 -0
- package/dist/preload/bridges/window/types/window.d.ts +53 -0
- package/dist/preload/bridges/window/window-bridge.d.ts +118 -0
- package/dist/preload/utils/bridge-util.d.ts +43 -0
- package/dist/preload/utils/index.d.ts +4 -0
- package/dist/preload/utils/index.js +7 -0
- package/dist/renderer/app/bootstrap-renderer.d.ts +6 -0
- package/dist/renderer/app/index.d.ts +5 -0
- package/dist/renderer/app/index.js +164 -0
- package/dist/renderer/app/styles-element-plus.internal.d.ts +2 -0
- package/dist/renderer/app/styles-xion.internal.d.ts +2 -0
- package/dist/renderer/app/types/app.d.ts +51 -0
- package/dist/renderer/components/captcha/internal/captcha-controller.d.ts +280 -0
- package/dist/renderer/components/captcha/internal/captcha-css-property.d.ts +25 -0
- package/dist/renderer/components/captcha/internal/captcha-defaults.d.ts +33 -0
- package/dist/renderer/components/captcha/internal/captcha-errors.d.ts +21 -0
- package/dist/renderer/components/captcha/internal/captcha-helper.d.ts +72 -0
- package/dist/renderer/components/captcha/internal/captcha-injector.d.ts +16 -0
- package/dist/renderer/components/captcha/internal/captcha-runtime-types.d.ts +153 -0
- package/dist/renderer/components/captcha/internal/captcha-service.d.ts +22 -0
- package/dist/renderer/components/captcha/internal/captcha-slide-types.d.ts +62 -0
- package/dist/renderer/components/captcha/internal/captcha-ui-patch.d.ts +43 -0
- package/dist/renderer/components/captcha/internal/captcha-wasm-loader.d.ts +36 -0
- package/dist/renderer/components/captcha/style/index.less +132 -0
- package/dist/renderer/components/captcha/types/captcha.d.ts +132 -0
- package/dist/renderer/components/captcha/xo-captcha-host.vue +151 -0
- package/dist/renderer/components/captcha/xo-captcha.vue +83 -0
- package/dist/renderer/components/captcha.d.ts +40 -0
- package/dist/renderer/components/context-menu/types/context-menu.d.ts +55 -0
- package/dist/renderer/components/context-menu/xo-context-menu-items.vue +112 -0
- package/dist/renderer/components/context-menu/xo-context-menu.vue +356 -0
- package/dist/renderer/components/context-menu.d.ts +32 -0
- package/dist/renderer/components/divider/types/divider.d.ts +31 -0
- package/dist/renderer/components/divider/xo-divider.vue +176 -0
- package/dist/renderer/components/form/types/form-flex-row.d.ts +21 -0
- package/dist/renderer/components/form/types/form-flex.d.ts +49 -0
- package/dist/renderer/components/form/xo-form-flex-row.vue +122 -0
- package/dist/renderer/components/form/xo-form-flex.vue +115 -0
- package/dist/renderer/components/index.d.ts +70 -0
- package/dist/renderer/components/index.js +1282 -0
- package/dist/renderer/components/layouts/types/app-layout.d.ts +29 -0
- package/dist/renderer/components/layouts/types/mini-layout.d.ts +23 -0
- package/dist/renderer/components/layouts/types/simple-layout.d.ts +17 -0
- package/dist/renderer/components/layouts/xo-app-layout.vue +350 -0
- package/dist/renderer/components/layouts/xo-mini-layout.vue +207 -0
- package/dist/renderer/components/layouts/xo-simple-layout.vue +43 -0
- package/dist/renderer/components/pages/types/app-page.d.ts +25 -0
- package/dist/renderer/components/pages/types/bootstrap-page.d.ts +35 -0
- package/dist/renderer/components/pages/types/dynamic-page.d.ts +20 -0
- package/dist/renderer/components/pages/types/settings-page.d.ts +23 -0
- package/dist/renderer/components/pages/xo-app-page.vue +230 -0
- package/dist/renderer/components/pages/xo-bootstrap-page.vue +93 -0
- package/dist/renderer/components/pages/xo-dynamic-page.vue +28 -0
- package/dist/renderer/components/pages/xo-settings-page.vue +143 -0
- package/dist/renderer/components/radio-group/types/radio-group.d.ts +30 -0
- package/dist/renderer/components/radio-group/xo-radio-group.vue +38 -0
- package/dist/renderer/components/service-status-bar/types/service-status-bar.d.ts +65 -0
- package/dist/renderer/components/service-status-bar/xo-service-status-bar.vue +193 -0
- package/dist/renderer/components/settings-components/types/setting-app-opacity.d.ts +19 -0
- package/dist/renderer/components/settings-components/types/setting-log-level.d.ts +23 -0
- package/dist/renderer/components/settings-components/types/setting-shortcut-keys-record-for-form-flex-rows.d.ts +47 -0
- package/dist/renderer/components/settings-components/types/setting-shortcut-keys-record.d.ts +23 -0
- package/dist/renderer/components/settings-components/types/setting-window-material.d.ts +23 -0
- package/dist/renderer/components/settings-components/xo-setting-app-opacity.vue +105 -0
- package/dist/renderer/components/settings-components/xo-setting-log-level.vue +84 -0
- package/dist/renderer/components/settings-components/xo-setting-shortcut-keys-record-for-form-flex-rows.vue +37 -0
- package/dist/renderer/components/settings-components/xo-setting-shortcut-keys-record.vue +74 -0
- package/dist/renderer/components/settings-components/xo-setting-window-material.vue +83 -0
- package/dist/renderer/components/settings-pages/types/setting-page-folder.d.ts +41 -0
- package/dist/renderer/components/settings-pages/types/setting-page-general.d.ts +23 -0
- package/dist/renderer/components/settings-pages/types/setting-page-remote-service.d.ts +19 -0
- package/dist/renderer/components/settings-pages/types/setting-page-updater.d.ts +27 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-folder.vue +137 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-general.vue +255 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-remote-service.vue +183 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-updater.vue +350 -0
- package/dist/renderer/components/shortcut-keys-record/types/shortcut-keys-record.d.ts +25 -0
- package/dist/renderer/components/shortcut-keys-record/xo-shortcut-keys-record.vue +161 -0
- package/dist/renderer/components/side-bar/types/sidebar-logo.d.ts +39 -0
- package/dist/renderer/components/side-bar/xo-sidebar-logo.vue +133 -0
- package/dist/renderer/components/spacing-line/types/spacing-line.d.ts +17 -0
- package/dist/renderer/components/spacing-line/xo-spacing-line.vue +53 -0
- package/dist/renderer/components/theme-switch/types/theme-switch-mini.d.ts +21 -0
- package/dist/renderer/components/theme-switch/types/theme-switch.d.ts +45 -0
- package/dist/renderer/components/theme-switch/xo-theme-switch-mini.vue +93 -0
- package/dist/renderer/components/theme-switch/xo-theme-switch.vue +200 -0
- package/dist/renderer/components/title-bar/types/title-bar.d.ts +58 -0
- package/dist/renderer/components/title-bar/xo-title-bar.vue +364 -0
- package/dist/renderer/components/types/sidebar-menu.d.ts +37 -0
- package/dist/renderer/components/types/vue.d.ts +9 -0
- package/dist/renderer/components/updater/types/updater.d.ts +97 -0
- package/dist/renderer/components/updater/xo-updater.vue +1190 -0
- package/dist/renderer/components/window-control/types/window-control.d.ts +17 -0
- package/dist/renderer/components/window-control/xo-window-control.vue +193 -0
- package/dist/renderer/composables/index.d.ts +7 -0
- package/dist/renderer/composables/index.js +570 -0
- package/dist/renderer/composables/use-xo-boolean.d.ts +14 -0
- package/dist/renderer/composables/use-xo-data-loader.d.ts +73 -0
- package/dist/renderer/composables/use-xo-form-control.d.ts +84 -0
- package/dist/renderer/composables/use-xo-updater-action.d.ts +25 -0
- package/dist/renderer/global/index.d.ts +4 -0
- package/dist/renderer/global/index.js +0 -0
- package/dist/renderer/global/types/window.d.ts +21 -0
- package/dist/renderer/icons/demo.css +539 -0
- package/dist/renderer/icons/iconfont.css +490 -0
- package/dist/renderer/services/index.d.ts +6 -0
- package/dist/renderer/services/index.js +444 -0
- package/dist/renderer/services/orval-axios-mutator.d.ts +9 -0
- package/dist/renderer/services/types/xo-api.d.ts +92 -0
- package/dist/renderer/services/xo-api-requester.d.ts +129 -0
- package/dist/renderer/store/app/app-store.d.ts +68 -0
- package/dist/renderer/store/auth/auth-store.d.ts +43 -0
- package/dist/renderer/store/index.d.ts +9 -0
- package/dist/renderer/store/index.js +595 -0
- package/dist/renderer/store/remote-service/remote-service-store.d.ts +52 -0
- package/dist/renderer/store/theme/theme-store.d.ts +52 -0
- package/dist/renderer/store/updater/updater-store.d.ts +88 -0
- package/dist/renderer/store/window/window-store.d.ts +58 -0
- package/dist/renderer/styles/css/element-plus.less +280 -0
- package/dist/renderer/styles/css/iconfont-patch.less +6 -0
- package/dist/renderer/styles/css/reset.less +83 -0
- package/dist/renderer/styles/css/scrollbar.less +56 -0
- package/dist/renderer/styles/index.less +35 -0
- package/dist/renderer/styles/mixin.less +144 -0
- package/dist/renderer/styles/var/element-plus/dark.less +32 -0
- package/dist/renderer/styles/var/element-plus/root.less +88 -0
- package/dist/renderer/styles/var/global/dark.less +10 -0
- package/dist/renderer/styles/var/global/root.less +46 -0
- package/dist/renderer/styles/var/layout/dark.less +7 -0
- package/dist/renderer/styles/var/layout/root.less +9 -0
- package/dist/renderer/styles/var/scrollbar/dark.less +13 -0
- package/dist/renderer/styles/var/scrollbar/root.less +35 -0
- package/dist/renderer/utils/auth-route-util.d.ts +117 -0
- package/dist/renderer/utils/context-util.d.ts +13 -0
- package/dist/renderer/utils/error-util.d.ts +12 -0
- package/dist/renderer/utils/index.d.ts +14 -0
- package/dist/renderer/utils/index.js +1522 -0
- package/dist/renderer/utils/keyboard-util.d.ts +86 -0
- package/dist/renderer/utils/message-util.d.ts +161 -0
- package/dist/renderer/utils/renderer-log-util.d.ts +44 -0
- package/dist/renderer/utils/renderer-util.d.ts +37 -0
- package/dist/renderer/utils/router-util.d.ts +186 -0
- package/dist/renderer/utils/shortcut-util.d.ts +20 -0
- package/dist/renderer/utils/storage-util.d.ts +85 -0
- package/dist/renderer/utils/types/vue-router.d.ts +17 -0
- package/dist/shared/app/consts/app-launch-mode.d.ts +9 -0
- package/dist/shared/app/consts/update-mode.d.ts +8 -0
- package/dist/shared/app/consts/window-close-behavior.d.ts +8 -0
- package/dist/shared/app/consts/window-material.d.ts +8 -0
- package/dist/shared/app/consts/xion-name.d.ts +5 -0
- package/dist/shared/app/electron-app-config.d.ts +5 -0
- package/dist/shared/app/index.d.ts +16 -0
- package/dist/shared/app/index.js +30 -0
- package/dist/shared/app/types/app-info.d.ts +32 -0
- package/dist/shared/app/types/app-launch-mode.d.ts +13 -0
- package/dist/shared/app/types/app-paths.d.ts +27 -0
- package/dist/shared/app/types/general-settings.d.ts +27 -0
- package/dist/shared/app/types/on-window-close.d.ts +13 -0
- package/dist/shared/app/types/update-mode.d.ts +13 -0
- package/dist/shared/app/types/window-material.d.ts +2 -0
- package/dist/shared/auth/const/auth-status.d.ts +2 -0
- package/dist/shared/auth/index.d.ts +5 -0
- package/dist/shared/auth/index.js +5 -0
- package/dist/shared/auth/types/auth.d.ts +78 -0
- package/dist/shared/color/consts/color.d.ts +5 -0
- package/dist/shared/color/index.d.ts +5 -0
- package/dist/shared/color/index.js +6 -0
- package/dist/shared/color/types/color.d.ts +26 -0
- package/dist/shared/electron-builder/index.d.ts +4 -0
- package/dist/shared/electron-builder/index.js +0 -0
- package/dist/shared/electron-builder/types/electron-builder-options.d.ts +34 -0
- package/dist/shared/errors/index.d.ts +4 -0
- package/dist/shared/errors/index.js +10 -0
- package/dist/shared/errors/ipc-invoke-error.d.ts +32 -0
- package/dist/shared/ipc/channels/app-channels.d.ts +56 -0
- package/dist/shared/ipc/channels/auth-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/clipboard-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/context-menu-channels.d.ts +10 -0
- package/dist/shared/ipc/channels/dialog-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/file-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/log-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/remote-service-channels.d.ts +20 -0
- package/dist/shared/ipc/channels/shell-channels.d.ts +10 -0
- package/dist/shared/ipc/channels/theme-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/updater-channels.d.ts +26 -0
- package/dist/shared/ipc/channels/window-channels.d.ts +44 -0
- package/dist/shared/ipc/consts/ipc-channel.d.ts +1 -0
- package/dist/shared/ipc/index.d.ts +19 -0
- package/dist/shared/ipc/index.js +46 -0
- package/dist/shared/ipc/ipc-result.d.ts +20 -0
- package/dist/shared/ipc/types/ipc-logger.d.ts +27 -0
- package/dist/shared/ipc/types/ipc.d.ts +61 -0
- package/dist/shared/logger/consts/log-levels.d.ts +14 -0
- package/dist/shared/logger/index.d.ts +4 -0
- package/dist/shared/logger/index.js +10 -0
- package/dist/shared/menu/consts/menu-command.d.ts +1 -0
- package/dist/shared/menu/index.d.ts +6 -0
- package/dist/shared/menu/index.js +10 -0
- package/dist/shared/menu/menu-command.d.ts +24 -0
- package/dist/shared/menu/types/menu.d.ts +72 -0
- package/dist/shared/mode/consts/command.d.ts +10 -0
- package/dist/shared/mode/consts/mode.d.ts +22 -0
- package/dist/shared/mode/index.d.ts +5 -0
- package/dist/shared/mode/index.js +18 -0
- package/dist/shared/remote-service/const/remote-service.d.ts +8 -0
- package/dist/shared/remote-service/index.d.ts +5 -0
- package/dist/shared/remote-service/index.js +38 -0
- package/dist/shared/remote-service/types/remote-service.d.ts +146 -0
- package/dist/shared/renderer/index.d.ts +7 -0
- package/dist/shared/renderer/index.js +0 -0
- package/dist/shared/renderer/types/element-plus.d.ts +20 -0
- package/dist/shared/renderer/types/input.d.ts +11 -0
- package/dist/shared/renderer/types/options.d.ts +22 -0
- package/dist/shared/renderer/types/switch.d.ts +11 -0
- package/dist/shared/renderer-protocol/consts/renderer-protocol-keys.d.ts +10 -0
- package/dist/shared/renderer-protocol/index.d.ts +5 -0
- package/dist/shared/renderer-protocol/index.js +6 -0
- package/dist/shared/renderer-protocol/types/renderer-protocol.d.ts +7 -0
- package/dist/shared/runtime/index.d.ts +4 -0
- package/dist/shared/runtime/index.js +0 -0
- package/dist/shared/runtime/types/runtime.d.ts +20 -0
- package/dist/shared/shortcut/consts/shortcut-handler-ids.d.ts +9 -0
- package/dist/shared/shortcut/consts/shortcut-id.d.ts +1 -0
- package/dist/shared/shortcut/index.d.ts +6 -0
- package/dist/shared/shortcut/index.js +10 -0
- package/dist/shared/shortcut/types/shortcut.d.ts +13 -0
- package/dist/shared/utils/bytes-util.d.ts +16 -0
- package/dist/shared/utils/index.d.ts +15 -0
- package/dist/shared/utils/index.js +42 -0
- package/dist/shared/utils/ipc-util.d.ts +12 -0
- package/dist/shared/utils/log-util.d.ts +33 -0
- package/dist/shared/utils/menu-util.d.ts +12 -0
- package/dist/shared/utils/number-util.d.ts +12 -0
- package/dist/shared/utils/object-util.d.ts +88 -0
- package/dist/shared/utils/regexp-util.d.ts +22 -0
- package/dist/shared/utils/shortcut-util.d.ts +12 -0
- package/dist/shared/utils/string-util.d.ts +14 -0
- package/dist/shared/utils/time-util.d.ts +32 -0
- package/dist/shared/utils/validator-util.d.ts +12 -0
- package/dist/shared/utils/window-shared-util.d.ts +26 -0
- package/dist/shared/window/consts/window-record-id.d.ts +2 -0
- package/dist/shared/window/consts/window-type-name.d.ts +1 -0
- package/dist/shared/window/identity/main-window-identity.d.ts +5 -0
- package/dist/shared/window/identity/setting-window-identity.d.ts +5 -0
- package/dist/shared/window/index.d.ts +8 -0
- package/dist/shared/window/index.js +23 -0
- package/dist/shared/window/types/window.d.ts +84 -0
- package/dist/types/index.d.ts +102 -0
- package/dist/types/index.js +0 -0
- package/dist/vite/build/build-chunk.d.ts +53 -0
- package/dist/vite/build/build-csp-update.d.ts +80 -0
- package/dist/vite/build/build-obfuscation.d.ts +33 -0
- package/dist/vite/build/component-map.d.ts +38 -0
- package/dist/vite/build/component-resolver.d.ts +6 -0
- package/dist/vite/build/index.d.ts +9 -0
- package/dist/vite/build/index.js +18 -0
- package/dist/vite/build/types/build.d.ts +13 -0
- package/dist/vite/config/electron-app-config.d.ts +6 -0
- package/dist/vite/config/electron-builder-config.d.ts +8 -0
- package/dist/vite/config/electron-vite-config.d.ts +9 -0
- package/dist/vite/config/index.d.ts +11 -0
- package/dist/vite/config/index.js +2259 -0
- package/dist/vite/config/types/electron-app-options.d.ts +22 -0
- package/dist/vite/config/types/electron-builder-options.d.ts +16 -0
- package/dist/vite/config/types/electron-vite-options.d.ts +43 -0
- package/dist/vite/config/types/vite-obfuscation.d.ts +36 -0
- package/dist/vite/config/vite-obfuscation-config.d.ts +6 -0
- package/dist/vite/mode/index.d.ts +4 -0
- package/dist/vite/mode/index.js +8 -0
- package/dist/vite/mode/vite-mode.d.ts +37 -0
- package/dist/vite/orval/index.d.ts +4 -0
- package/dist/vite/orval/index.js +75 -0
- package/dist/vite/orval/orval-global-types.d.ts +23 -0
- package/dist/vite/utils/file-write-vite-util.d.ts +30 -0
- package/dist/vite/utils/index.d.ts +5 -0
- package/dist/vite/utils/index.js +10 -0
- package/dist/vite/utils/runtime-config-vite-util.d.ts +39 -0
- package/package.json +287 -0
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TrayManager
|
|
3
|
+
} from "../../chunk-files/chunk-D5ZV4VMI.js";
|
|
4
|
+
import {
|
|
5
|
+
UpdaterManager
|
|
6
|
+
} from "../../chunk-files/chunk-LFHJJQW3.js";
|
|
7
|
+
import {
|
|
8
|
+
WindowManager
|
|
9
|
+
} from "../../chunk-files/chunk-DRMV3M5V.js";
|
|
10
|
+
import {
|
|
11
|
+
WindowUtil
|
|
12
|
+
} from "../../chunk-files/chunk-YZOJOLFL.js";
|
|
13
|
+
import {
|
|
14
|
+
MenuManager
|
|
15
|
+
} from "../../chunk-files/chunk-UFYEZIUE.js";
|
|
16
|
+
import "../../chunk-files/chunk-GUOSVDXA.js";
|
|
17
|
+
import "../../chunk-files/chunk-EQTU45UO.js";
|
|
18
|
+
import {
|
|
19
|
+
ProtocolManager
|
|
20
|
+
} from "../../chunk-files/chunk-IMGYTSWY.js";
|
|
21
|
+
import {
|
|
22
|
+
RemoteServiceManager
|
|
23
|
+
} from "../../chunk-files/chunk-DD6WZ4NY.js";
|
|
24
|
+
import {
|
|
25
|
+
RendererProtocolManager
|
|
26
|
+
} from "../../chunk-files/chunk-UCMR6V67.js";
|
|
27
|
+
import "../../chunk-files/chunk-WOJ2UKI7.js";
|
|
28
|
+
import {
|
|
29
|
+
ShortcutManager
|
|
30
|
+
} from "../../chunk-files/chunk-BJOPQNB2.js";
|
|
31
|
+
import "../../chunk-files/chunk-Q7LCZIQP.js";
|
|
32
|
+
import "../../chunk-files/chunk-GROGDGEL.js";
|
|
33
|
+
import {
|
|
34
|
+
AppStore
|
|
35
|
+
} from "../../chunk-files/chunk-4HEDNQUP.js";
|
|
36
|
+
import {
|
|
37
|
+
ThemeManager
|
|
38
|
+
} from "../../chunk-files/chunk-3XB4IEWO.js";
|
|
39
|
+
import "../../chunk-files/chunk-SVTZ4T6S.js";
|
|
40
|
+
import {
|
|
41
|
+
JwtAuthManager
|
|
42
|
+
} from "../../chunk-files/chunk-MJ6Q3TIX.js";
|
|
43
|
+
import "../../chunk-files/chunk-J34MOWJP.js";
|
|
44
|
+
import "../../chunk-files/chunk-B7DTBTWQ.js";
|
|
45
|
+
import {
|
|
46
|
+
BannerManager
|
|
47
|
+
} from "../../chunk-files/chunk-5PKWVAQP.js";
|
|
48
|
+
import "../../chunk-files/chunk-YLZRRUY7.js";
|
|
49
|
+
import {
|
|
50
|
+
defineAppConfig,
|
|
51
|
+
defineRemoteServiceConfig,
|
|
52
|
+
defineUpdaterConfig
|
|
53
|
+
} from "../../chunk-files/chunk-34OODP7M.js";
|
|
54
|
+
import "../../chunk-files/chunk-Q7YMMN7J.js";
|
|
55
|
+
import "../../chunk-files/chunk-F7YTK2MY.js";
|
|
56
|
+
import "../../chunk-files/chunk-3S5OTD47.js";
|
|
57
|
+
import "../../chunk-files/chunk-DEODEAKM.js";
|
|
58
|
+
import "../../chunk-files/chunk-6X74EPRM.js";
|
|
59
|
+
import {
|
|
60
|
+
FileAssociationManager
|
|
61
|
+
} from "../../chunk-files/chunk-IH3R2NDR.js";
|
|
62
|
+
import {
|
|
63
|
+
FileAssociationUtil
|
|
64
|
+
} from "../../chunk-files/chunk-VGDNICVG.js";
|
|
65
|
+
import {
|
|
66
|
+
IpcManager
|
|
67
|
+
} from "../../chunk-files/chunk-4SSGMLEE.js";
|
|
68
|
+
import "../../chunk-files/chunk-W2I3I7U7.js";
|
|
69
|
+
import "../../chunk-files/chunk-BPTFUGTP.js";
|
|
70
|
+
import {
|
|
71
|
+
MainWindowIdentity
|
|
72
|
+
} from "../../chunk-files/chunk-KFV4GXVE.js";
|
|
73
|
+
import "../../chunk-files/chunk-RAVPJRBA.js";
|
|
74
|
+
import "../../chunk-files/chunk-LQ67F6EY.js";
|
|
75
|
+
import "../../chunk-files/chunk-BFD2LHLK.js";
|
|
76
|
+
import {
|
|
77
|
+
SettingWindowIdentity
|
|
78
|
+
} from "../../chunk-files/chunk-PVWRRUOK.js";
|
|
79
|
+
import "../../chunk-files/chunk-OUFO3LM4.js";
|
|
80
|
+
import "../../chunk-files/chunk-6FDO72PN.js";
|
|
81
|
+
import "../../chunk-files/chunk-U4XEWVBH.js";
|
|
82
|
+
import "../../chunk-files/chunk-BMOLIJ3W.js";
|
|
83
|
+
import "../../chunk-files/chunk-RN7AI33H.js";
|
|
84
|
+
import "../../chunk-files/chunk-6BOPFOZD.js";
|
|
85
|
+
import "../../chunk-files/chunk-WKVLVI6N.js";
|
|
86
|
+
import "../../chunk-files/chunk-Y3OEXVQ2.js";
|
|
87
|
+
import "../../chunk-files/chunk-UIJUY7QZ.js";
|
|
88
|
+
import "../../chunk-files/chunk-T3QCAOCO.js";
|
|
89
|
+
import "../../chunk-files/chunk-ID3YDA2K.js";
|
|
90
|
+
import {
|
|
91
|
+
ProtocolUtil
|
|
92
|
+
} from "../../chunk-files/chunk-KFK47PDH.js";
|
|
93
|
+
import {
|
|
94
|
+
XoLogger
|
|
95
|
+
} from "../../chunk-files/chunk-YXAEUJKJ.js";
|
|
96
|
+
import "../../chunk-files/chunk-P4CX6I4J.js";
|
|
97
|
+
import "../../chunk-files/chunk-3KBZWBNP.js";
|
|
98
|
+
import "../../chunk-files/chunk-FPN7JYR4.js";
|
|
99
|
+
import "../../chunk-files/chunk-RODB64YF.js";
|
|
100
|
+
import "../../chunk-files/chunk-GN2FNR3Z.js";
|
|
101
|
+
import "../../chunk-files/chunk-3RVKOFMP.js";
|
|
102
|
+
import "../../chunk-files/chunk-FMQTZ3QV.js";
|
|
103
|
+
|
|
104
|
+
// src/main/app/app-lifecycle-abstract.ts
|
|
105
|
+
import { app, BrowserWindow, dialog, globalShortcut } from "electron";
|
|
106
|
+
var AppLifecycleAbstract = class {
|
|
107
|
+
/**
|
|
108
|
+
* XionApp
|
|
109
|
+
* @type {XoAppAbstract}
|
|
110
|
+
* @protected
|
|
111
|
+
*/
|
|
112
|
+
xoApp;
|
|
113
|
+
/**
|
|
114
|
+
* 构造函数
|
|
115
|
+
*/
|
|
116
|
+
constructor(xoApp) {
|
|
117
|
+
this.xoApp = xoApp;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* XionApp 启动前
|
|
121
|
+
* <p>此阶段通常用于应用启动前的准备工作,如校验配置、注册全局处理器等。</p>
|
|
122
|
+
* @returns {Promise<void>}
|
|
123
|
+
*/
|
|
124
|
+
async xoAppBeforeStart() {
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* XionApp 启动后
|
|
128
|
+
* <p>此阶段通常用于应用启动完成后的补充工作,如主动检查更新、输出启动日志等。</p>
|
|
129
|
+
* @returns {Promise<void>}
|
|
130
|
+
*/
|
|
131
|
+
async xoAppAfterStart() {
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Electron 就绪
|
|
135
|
+
* <p>对应 app.whenReady() 阶段,此时可以安全地创建窗口、初始化菜单等。</p>
|
|
136
|
+
* @returns {Promise<void>}
|
|
137
|
+
*/
|
|
138
|
+
async whenReady() {
|
|
139
|
+
const silentLaunchMode = this.xoApp.isSilentLaunchMode();
|
|
140
|
+
const appConfig = this.xoApp.getAppConfig();
|
|
141
|
+
if (!appConfig?.eletronAppConfig?.appId) {
|
|
142
|
+
await this.dialogAndExit("\u7F3A\u5C11\u914D\u7F6E appConfig.eletronAppConfig.appId");
|
|
143
|
+
}
|
|
144
|
+
if (!appConfig?.eletronAppConfig?.productName) {
|
|
145
|
+
await this.dialogAndExit("\u7F3A\u5C11\u914D\u7F6E appConfig.eletronAppConfig.productName");
|
|
146
|
+
}
|
|
147
|
+
this.setAppUserModelId(appConfig?.eletronAppConfig?.appId);
|
|
148
|
+
this.setAppName(appConfig?.eletronAppConfig?.productName);
|
|
149
|
+
this.setLaunchOnStartup();
|
|
150
|
+
this.xoApp.getProtocolManager().registerClients();
|
|
151
|
+
const protocolManager = this.xoApp.getProtocolManager();
|
|
152
|
+
const fileAssociationManager = this.xoApp.getFileAssociationManager();
|
|
153
|
+
await protocolManager.handleArgv(process.argv);
|
|
154
|
+
await protocolManager.setReady();
|
|
155
|
+
await fileAssociationManager.handleArgv(process.argv);
|
|
156
|
+
await fileAssociationManager.setReady();
|
|
157
|
+
silentLaunchMode && this.xoApp.getTrayManager().setBlur();
|
|
158
|
+
if (BrowserWindow.getAllWindows().length === 0) {
|
|
159
|
+
await this.xoApp.createMainWindow();
|
|
160
|
+
}
|
|
161
|
+
this.hideAllWindowsIfSilentLaunchMode(silentLaunchMode);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 浏览器窗口创建后
|
|
165
|
+
* <p>对应 app.on('browser-window-created') 事件。</p>
|
|
166
|
+
* @param {Electron.Event} event 事件对象
|
|
167
|
+
* @param {Electron.BrowserWindow} window 窗口
|
|
168
|
+
* @returns {Promise<void>}
|
|
169
|
+
*/
|
|
170
|
+
async onBrowserWindowCreated(event, window) {
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 浏览器窗口获得焦点
|
|
174
|
+
* <p>对应 app.on('browser-window-focus') 事件。</p>
|
|
175
|
+
* @param {Electron.Event} event 事件对象
|
|
176
|
+
* @param {Electron.BrowserWindow} window 窗口
|
|
177
|
+
* @returns {Promise<void>}
|
|
178
|
+
*/
|
|
179
|
+
async onBrowserWindowFocus(event, window) {
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 浏览器窗口失去焦点
|
|
183
|
+
* <p>对应 app.on('browser-window-blur') 事件。</p>
|
|
184
|
+
* @param {Electron.Event} event 事件对象
|
|
185
|
+
* @param {Electron.BrowserWindow} window 窗口
|
|
186
|
+
* @returns {Promise<void>}
|
|
187
|
+
*/
|
|
188
|
+
async onBrowserWindowBlur(event, window) {
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 应用激活
|
|
192
|
+
* <p>对应 app.on('activate') 事件,常用于 macOS 下在无窗口时重新创建主窗口。</p>
|
|
193
|
+
* @param {Electron.Event} event 事件对象
|
|
194
|
+
* @param {boolean} hasVisibleWindows 是否存在可见窗口
|
|
195
|
+
* @returns {Promise<void>}
|
|
196
|
+
*/
|
|
197
|
+
async onActivate(event, hasVisibleWindows) {
|
|
198
|
+
if (BrowserWindow.getAllWindows().length === 0) {
|
|
199
|
+
await this.xoApp.showMainWindow();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 第二个实例启动
|
|
204
|
+
* <p>对应 app.on('second-instance') 事件,常用于单实例应用聚焦主窗口。</p>
|
|
205
|
+
* @param {Electron.Event} event 事件对象
|
|
206
|
+
* @param {string[]} argv 第二个实例的命令行参数
|
|
207
|
+
* @param {string} workingDirectory 第二个实例工作目录
|
|
208
|
+
* @param {unknown} additionalData 第二个实例附加数据
|
|
209
|
+
* @returns {Promise<void>}
|
|
210
|
+
*/
|
|
211
|
+
async onSecondInstance(event, argv, workingDirectory, additionalData) {
|
|
212
|
+
const protocolHandled = await this.xoApp.getProtocolManager().handleArgv(argv);
|
|
213
|
+
const fileAssociationHandled = await this.xoApp.getFileAssociationManager().handleArgv(argv);
|
|
214
|
+
if (!protocolHandled && !fileAssociationHandled) {
|
|
215
|
+
const mainWindow = await this.xoApp.getMainWindow();
|
|
216
|
+
this.xoApp.getWindowManager().showByWindow(mainWindow);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* 所有窗口关闭
|
|
221
|
+
* <p>对应 app.on('window-all-closed') 事件,常用于非 macOS 平台退出应用。</p>
|
|
222
|
+
* @returns {Promise<void>}
|
|
223
|
+
*/
|
|
224
|
+
async onWindowAllClosed() {
|
|
225
|
+
this.xoApp.appLog.info("\u6240\u6709\u7A97\u53E3\u5DF2\u5173\u95ED");
|
|
226
|
+
if (process.platform !== "darwin") {
|
|
227
|
+
app.quit();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 应用退出前
|
|
232
|
+
* <p>对应 app.on('before-quit') 事件,适合做退出前的收尾工作。</p>
|
|
233
|
+
* @param {Electron.Event} event 事件对象
|
|
234
|
+
* @returns {Promise<void>}
|
|
235
|
+
*/
|
|
236
|
+
async onBeforeQuit(event) {
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 应用即将退出
|
|
240
|
+
* <p>对应 app.on('will-quit') 事件,适合做最终清理工作。</p>
|
|
241
|
+
* @param {Electron.Event} event 事件对象
|
|
242
|
+
* @returns {Promise<void>}
|
|
243
|
+
*/
|
|
244
|
+
async onWillQuit(event) {
|
|
245
|
+
globalShortcut.unregisterAll();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 应用打开文件
|
|
249
|
+
* <p>对应 app.on('open-file') 事件,主要用于 macOS 文件关联场景。</p>
|
|
250
|
+
* @param {Electron.Event} event 事件对象
|
|
251
|
+
* @param {string} path 文件路径
|
|
252
|
+
* @returns {Promise<void>}
|
|
253
|
+
*/
|
|
254
|
+
async onOpenFile(event, path) {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
await this.xoApp.getFileAssociationManager().handleFile(path);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 应用打开 URL
|
|
260
|
+
* <p>对应 app.on('open-url') 事件,主要用于 macOS 协议唤起场景。</p>
|
|
261
|
+
* @param {Electron.Event} event 事件对象
|
|
262
|
+
* @param {string} url URL 地址
|
|
263
|
+
* @returns {Promise<void>}
|
|
264
|
+
*/
|
|
265
|
+
async onOpenUrl(event, url) {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
await this.xoApp.getProtocolManager().handleUrl(url);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* WebContents 创建后
|
|
271
|
+
* <p>对应 app.on('web-contents-created') 事件。</p>
|
|
272
|
+
* @param {Electron.Event} event 事件对象
|
|
273
|
+
* @param {Electron.WebContents} webContents WebContents
|
|
274
|
+
* @returns {Promise<void>}
|
|
275
|
+
*/
|
|
276
|
+
async onWebContentsCreated(event, webContents) {
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Electron Session 创建后
|
|
280
|
+
* <p>对应 app.on('session-created') 事件。</p>
|
|
281
|
+
* @param {Electron.Session} session Session
|
|
282
|
+
* @returns {Promise<void>}
|
|
283
|
+
*/
|
|
284
|
+
async onSessionCreated(session) {
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* 子进程退出
|
|
288
|
+
* <p>对应 app.on('child-process-gone') 事件。</p>
|
|
289
|
+
* @param {Electron.Event} event 事件对象
|
|
290
|
+
* @param {Electron.Details} details 子进程退出详情
|
|
291
|
+
* @returns {Promise<void>}
|
|
292
|
+
*/
|
|
293
|
+
async onChildProcessGone(event, details) {
|
|
294
|
+
this.xoApp.appLog.error("\u5B50\u8FDB\u7A0B\u5DF2\u9000\u51FA", details);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* GPU 信息更新
|
|
298
|
+
* <p>对应 app.on('gpu-info-update') 事件。</p>
|
|
299
|
+
* @returns {Promise<void>}
|
|
300
|
+
*/
|
|
301
|
+
async onGpuInfoUpdate() {
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 渲染进程崩溃
|
|
305
|
+
* <p>对应 app.on('render-process-gone') 事件。</p>
|
|
306
|
+
* @param {Electron.Event} event 事件对象
|
|
307
|
+
* @param {Electron.WebContents} webContents WebContents
|
|
308
|
+
* @param {Electron.RenderProcessGoneDetails} details 渲染进程崩溃详情
|
|
309
|
+
* @returns {Promise<void>}
|
|
310
|
+
*/
|
|
311
|
+
async onRenderProcessGone(event, webContents, details) {
|
|
312
|
+
this.xoApp.appLog.error("\u6E32\u67D3\u8FDB\u7A0B\u5DF2\u9000\u51FA", details);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* XionApp 运行错误
|
|
316
|
+
* <p>统一处理启动流程中的错误。对于 uncaughtException、unhandledRejection 这类更底层的 Node 事件,
|
|
317
|
+
* 建议在具体实现中按需注册后仍汇总到此方法处理,而不是在生命周期抽象中额外拆出独立钩子。</p>
|
|
318
|
+
* @param {unknown} error 错误对象
|
|
319
|
+
* @returns {Promise<void>}
|
|
320
|
+
*/
|
|
321
|
+
async onError(error) {
|
|
322
|
+
this.xoApp.appLog.error("[Lifecycle]", { source: error.source }, error.error);
|
|
323
|
+
}
|
|
324
|
+
//<editor-fold desc="内部方法">
|
|
325
|
+
/**
|
|
326
|
+
* 设置应用名称
|
|
327
|
+
* @param {string} productName 应用名称
|
|
328
|
+
* @private
|
|
329
|
+
*/
|
|
330
|
+
setAppName(productName) {
|
|
331
|
+
productName && app.setName(productName);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* 设置 APPID
|
|
335
|
+
* @param {string} appId APPID
|
|
336
|
+
* @private
|
|
337
|
+
*/
|
|
338
|
+
setAppUserModelId(appId) {
|
|
339
|
+
if (process.platform !== "win32") return;
|
|
340
|
+
appId && app.setAppUserModelId(appId);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* 如果是静默启动模式,则隐藏所有窗口
|
|
344
|
+
* @param {boolean} silentStartupMode 是否静默启动模式
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
hideAllWindowsIfSilentLaunchMode(silentStartupMode) {
|
|
348
|
+
silentStartupMode && this.xoApp.getWindowManager().hideAll();
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* 设置开机启动
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
setLaunchOnStartup() {
|
|
355
|
+
const isLaunchOnStartup = this.xoApp.isLaunchOnStartup();
|
|
356
|
+
app.setLoginItemSettings({ openAtLogin: isLaunchOnStartup });
|
|
357
|
+
}
|
|
358
|
+
//</editor-fold>
|
|
359
|
+
/**
|
|
360
|
+
* 提示并退出
|
|
361
|
+
* @param {string} message 消息
|
|
362
|
+
* @returns {Promise<void>}
|
|
363
|
+
* @private
|
|
364
|
+
*/
|
|
365
|
+
async dialogAndExit(message) {
|
|
366
|
+
await dialog.showMessageBox({
|
|
367
|
+
type: "error",
|
|
368
|
+
title: "\u9519\u8BEF",
|
|
369
|
+
message: "\u5E94\u7528\u542F\u52A8\u5931\u8D25",
|
|
370
|
+
detail: message,
|
|
371
|
+
buttons: ["\u9000\u51FA"],
|
|
372
|
+
defaultId: 0,
|
|
373
|
+
noLink: true
|
|
374
|
+
});
|
|
375
|
+
this.xoApp.appLog.error("\u5E94\u7528\u542F\u52A8\u5931\u8D25", message);
|
|
376
|
+
app.exit(1);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/main/app/app-lifecycle.ts
|
|
381
|
+
var AppLifecycle = class extends AppLifecycleAbstract {
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// src/main/app/xo-app-abstract.ts
|
|
385
|
+
import { app as app2, BrowserWindow as BrowserWindow2 } from "electron";
|
|
386
|
+
var XoAppAbstract = class {
|
|
387
|
+
//<editor-fold desc="内部属性">
|
|
388
|
+
/**
|
|
389
|
+
* Banner 管理器
|
|
390
|
+
* @type {BannerAbstract}
|
|
391
|
+
* @protected
|
|
392
|
+
*/
|
|
393
|
+
bannerManager;
|
|
394
|
+
/**
|
|
395
|
+
* XionApp 配置
|
|
396
|
+
* @type {XoApp.Config}
|
|
397
|
+
* @protected
|
|
398
|
+
*/
|
|
399
|
+
appConfig;
|
|
400
|
+
/**
|
|
401
|
+
* 更新器配置
|
|
402
|
+
* @type {XoUpdater.Config}
|
|
403
|
+
* @protected
|
|
404
|
+
*/
|
|
405
|
+
updaterConfig;
|
|
406
|
+
/**
|
|
407
|
+
* 远程服务配置
|
|
408
|
+
* @type {XoRemoteService.Config}
|
|
409
|
+
* @protected
|
|
410
|
+
*/
|
|
411
|
+
remoteServiceConfig;
|
|
412
|
+
/**
|
|
413
|
+
* 生命周期
|
|
414
|
+
* @type {AppLifecycleAbstract}
|
|
415
|
+
* @protected
|
|
416
|
+
*/
|
|
417
|
+
lifecycle;
|
|
418
|
+
/**
|
|
419
|
+
* 主窗口
|
|
420
|
+
* @type {Electron.BrowserWindow}
|
|
421
|
+
* @protected
|
|
422
|
+
*/
|
|
423
|
+
mainWindow;
|
|
424
|
+
/**
|
|
425
|
+
* 设置窗口
|
|
426
|
+
* @type {Electron.BrowserWindow}
|
|
427
|
+
* @protected
|
|
428
|
+
*/
|
|
429
|
+
settingWindow;
|
|
430
|
+
/**
|
|
431
|
+
* 设置窗口创建任务
|
|
432
|
+
* @type {Promise<Electron.BrowserWindow>}
|
|
433
|
+
* @protected
|
|
434
|
+
*/
|
|
435
|
+
settingWindowPromise;
|
|
436
|
+
/**
|
|
437
|
+
* 窗口管理器
|
|
438
|
+
* @type {WindowManager}
|
|
439
|
+
* @protected
|
|
440
|
+
*/
|
|
441
|
+
windowManager;
|
|
442
|
+
/**
|
|
443
|
+
* 托盘管理器
|
|
444
|
+
* @type {TrayManager}
|
|
445
|
+
* @protected
|
|
446
|
+
*/
|
|
447
|
+
trayManager;
|
|
448
|
+
/**
|
|
449
|
+
* IPC 管理器
|
|
450
|
+
* @type {IpcManagerAbstract}
|
|
451
|
+
* @protected
|
|
452
|
+
*/
|
|
453
|
+
ipcManager;
|
|
454
|
+
/**
|
|
455
|
+
* 菜单管理器
|
|
456
|
+
* @type {MenuManager}
|
|
457
|
+
* @protected
|
|
458
|
+
*/
|
|
459
|
+
menuManager;
|
|
460
|
+
/**
|
|
461
|
+
* 协议管理器
|
|
462
|
+
* @type {ProtocolManagerAbstract}
|
|
463
|
+
* @protected
|
|
464
|
+
*/
|
|
465
|
+
protocolManager;
|
|
466
|
+
/**
|
|
467
|
+
* 渲染进程协议管理器
|
|
468
|
+
* @type {RendererProtocolManagerAbstract}
|
|
469
|
+
* @protected
|
|
470
|
+
*/
|
|
471
|
+
rendererProtocolManager;
|
|
472
|
+
/**
|
|
473
|
+
* 文件关联管理器
|
|
474
|
+
* @type {FileAssociationManagerAbstract}
|
|
475
|
+
* @protected
|
|
476
|
+
*/
|
|
477
|
+
fileAssociationManager;
|
|
478
|
+
/**
|
|
479
|
+
* 主题管理器
|
|
480
|
+
* @type {ThemeManagerAbstract}
|
|
481
|
+
* @protected
|
|
482
|
+
*/
|
|
483
|
+
themeManager;
|
|
484
|
+
/**
|
|
485
|
+
* 更新器管理器
|
|
486
|
+
* @type {UpdaterManagerAbstract}
|
|
487
|
+
* @protected
|
|
488
|
+
*/
|
|
489
|
+
updaterManager;
|
|
490
|
+
/**
|
|
491
|
+
* 远程服务管理器
|
|
492
|
+
* @type {RemoteServiceManagerAbstract}
|
|
493
|
+
* @protected
|
|
494
|
+
*/
|
|
495
|
+
remoteServiceManager;
|
|
496
|
+
/**
|
|
497
|
+
* JWT 认证管理器
|
|
498
|
+
* @type {JwtAuthManager}
|
|
499
|
+
* @protected
|
|
500
|
+
*/
|
|
501
|
+
authManager;
|
|
502
|
+
/**
|
|
503
|
+
* 快捷键管理器
|
|
504
|
+
* @type {ShortcutManagerAbstract}
|
|
505
|
+
* @protected
|
|
506
|
+
*/
|
|
507
|
+
shortcutManager;
|
|
508
|
+
/**
|
|
509
|
+
* App 设置存储
|
|
510
|
+
* @type {AppStore}
|
|
511
|
+
* @protected
|
|
512
|
+
*/
|
|
513
|
+
appStore;
|
|
514
|
+
/**
|
|
515
|
+
* 主进程日志管理器
|
|
516
|
+
* @type {XoLogger}
|
|
517
|
+
* @protected
|
|
518
|
+
*/
|
|
519
|
+
mainLogger;
|
|
520
|
+
/**
|
|
521
|
+
* 预加载日志管理器
|
|
522
|
+
* @type {XoLogger}
|
|
523
|
+
* @protected
|
|
524
|
+
*/
|
|
525
|
+
preloadLogger;
|
|
526
|
+
/**
|
|
527
|
+
* 渲染进程日志管理器
|
|
528
|
+
* @type {XoLogger}
|
|
529
|
+
* @protected
|
|
530
|
+
*/
|
|
531
|
+
rendererLogger;
|
|
532
|
+
/**
|
|
533
|
+
* XionApp 是否已启动
|
|
534
|
+
* @private
|
|
535
|
+
*/
|
|
536
|
+
started = false;
|
|
537
|
+
/**
|
|
538
|
+
* App 是否正在退出
|
|
539
|
+
* @private
|
|
540
|
+
*/
|
|
541
|
+
quitting = false;
|
|
542
|
+
//</editor-fold>
|
|
543
|
+
//<editor-fold desc="构造函数">
|
|
544
|
+
/**
|
|
545
|
+
* 构造函数
|
|
546
|
+
* @param {XoApp.ConstructorOptions} options 构造选项
|
|
547
|
+
* @protected
|
|
548
|
+
*/
|
|
549
|
+
constructor(options) {
|
|
550
|
+
this.appConfig = defineAppConfig(options?.appConfig);
|
|
551
|
+
this.updaterConfig = defineUpdaterConfig(options?.updaterConfig);
|
|
552
|
+
this.remoteServiceConfig = defineRemoteServiceConfig(options?.remoteServiceConfig);
|
|
553
|
+
this.mainLogger = new XoLogger("main", options?.loggerConfig);
|
|
554
|
+
this.preloadLogger = new XoLogger("preload", options?.loggerConfig);
|
|
555
|
+
this.rendererLogger = new XoLogger("renderer", options?.loggerConfig);
|
|
556
|
+
this.disableConsoleLogsForAppPackaged([
|
|
557
|
+
this.mainLogger,
|
|
558
|
+
this.preloadLogger,
|
|
559
|
+
this.rendererLogger
|
|
560
|
+
]);
|
|
561
|
+
this.appStore = new AppStore();
|
|
562
|
+
this.applyLogLevel(this.appStore.getLogLevel());
|
|
563
|
+
this.lifecycle = new (options?.lifecycle ?? AppLifecycle)(this);
|
|
564
|
+
this.bannerManager = new (options?.bannerManager ?? BannerManager)(this);
|
|
565
|
+
this.menuManager = new (options?.menuManager ?? MenuManager)(this);
|
|
566
|
+
this.protocolManager = new (options?.protocolManager ?? ProtocolManager)(this);
|
|
567
|
+
this.rendererProtocolManager = new (options?.rendererProtocolManager ?? RendererProtocolManager)(this);
|
|
568
|
+
this.fileAssociationManager = new (options?.fileAssociationManager ?? FileAssociationManager)(this);
|
|
569
|
+
this.themeManager = new (options?.themeManager ?? ThemeManager)(this);
|
|
570
|
+
this.updaterManager = new (options?.updaterManager ?? UpdaterManager)(this);
|
|
571
|
+
this.remoteServiceManager = new (options?.remoteServiceManager ?? RemoteServiceManager)(this);
|
|
572
|
+
this.authManager = new JwtAuthManager(this, options?.jwtAuthProvider ? new options.jwtAuthProvider() : void 0);
|
|
573
|
+
this.shortcutManager = new (options?.shortcutManager ?? ShortcutManager)(this);
|
|
574
|
+
this.ipcManager = new (options?.ipcManager ?? IpcManager)(this);
|
|
575
|
+
this.windowManager = new WindowManager(this, options?.windowTypes);
|
|
576
|
+
this.trayManager = new TrayManager(this, options?.trayConfig);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* 生产环境时关闭控制台日志,文件日志保持不变
|
|
580
|
+
* @param {readonly XoLogger[]} loggers 日志管理器数组
|
|
581
|
+
* @returns {void}
|
|
582
|
+
* @private
|
|
583
|
+
*/
|
|
584
|
+
disableConsoleLogsForAppPackaged(loggers) {
|
|
585
|
+
if (!app2.isPackaged) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
for (const logger of loggers) {
|
|
589
|
+
const consoleTransport = logger.log.transports.console;
|
|
590
|
+
if (consoleTransport) {
|
|
591
|
+
consoleTransport.level = false;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
//</editor-fold>
|
|
596
|
+
//<editor-fold desc="日志 Getter">
|
|
597
|
+
/**
|
|
598
|
+
* 主进程日志(无 scope)
|
|
599
|
+
* @returns {Logger}
|
|
600
|
+
*/
|
|
601
|
+
get mainLog() {
|
|
602
|
+
return this.mainLogger.log;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* 主进程 App 日志
|
|
606
|
+
* @returns {LogFunctions}
|
|
607
|
+
*/
|
|
608
|
+
get appLog() {
|
|
609
|
+
return this.mainLogger.log.scope("App");
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* 主进程 更新器 日志
|
|
613
|
+
* @returns {LogFunctions}
|
|
614
|
+
*/
|
|
615
|
+
get updaterLog() {
|
|
616
|
+
return this.mainLogger.log.scope("Updater");
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* 主进程 远程服务 日志
|
|
620
|
+
* @returns {LogFunctions}
|
|
621
|
+
*/
|
|
622
|
+
get remoteServiceLog() {
|
|
623
|
+
return this.mainLogger.log.scope("RemoteService");
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* 主进程 JWT 认证日志
|
|
627
|
+
* @returns {LogFunctions}
|
|
628
|
+
*/
|
|
629
|
+
get authLog() {
|
|
630
|
+
return this.mainLogger.log.scope("Auth");
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* 主进程 窗口 日志
|
|
634
|
+
* @returns {LogFunctions}
|
|
635
|
+
*/
|
|
636
|
+
get windowLog() {
|
|
637
|
+
return this.mainLogger.log.scope("Window");
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* 主进程 托盘 日志
|
|
641
|
+
* @returns {LogFunctions}
|
|
642
|
+
*/
|
|
643
|
+
get trayLog() {
|
|
644
|
+
return this.mainLogger.log.scope("Tray");
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* 预加载日志(无 scope)
|
|
648
|
+
* @returns {Logger}
|
|
649
|
+
*/
|
|
650
|
+
get preloadLog() {
|
|
651
|
+
return this.preloadLogger.log.scope("Preload");
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* 渲染进程日志(无 scope)
|
|
655
|
+
* @returns {Logger}
|
|
656
|
+
*/
|
|
657
|
+
get rendererLog() {
|
|
658
|
+
return this.rendererLogger.log.scope("Renderer");
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* 获取日志等级
|
|
662
|
+
* @returns {XoLogger.Level}
|
|
663
|
+
*/
|
|
664
|
+
getLogLevel() {
|
|
665
|
+
return this.appStore.getLogLevel();
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* 设置并存储日志等级
|
|
669
|
+
* @param {XoLogger.Level} logLevel 日志等级
|
|
670
|
+
* @returns {void}
|
|
671
|
+
*/
|
|
672
|
+
setLogLevel(logLevel) {
|
|
673
|
+
logLevel ??= "info";
|
|
674
|
+
this.appStore.setLogLevel(logLevel);
|
|
675
|
+
this.applyLogLevel(logLevel);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* 应用日志等级
|
|
679
|
+
* @param {XoLogger.Level} logLevel 日志等级
|
|
680
|
+
* @returns {void}
|
|
681
|
+
* @private
|
|
682
|
+
*/
|
|
683
|
+
applyLogLevel(logLevel) {
|
|
684
|
+
if (!logLevel) return;
|
|
685
|
+
for (const logger of [this.mainLogger, this.preloadLogger, this.rendererLogger]) {
|
|
686
|
+
logger.setLevel(logLevel);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
//</editor-fold>
|
|
690
|
+
//<editor-fold desc="配置 Getter">
|
|
691
|
+
/**
|
|
692
|
+
* 获取 App 配置
|
|
693
|
+
* @returns {XoApp.Config | undefined}
|
|
694
|
+
*/
|
|
695
|
+
getAppConfig() {
|
|
696
|
+
return this.appConfig;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* 获取更新器配置
|
|
700
|
+
* @returns {XoUpdater.Config | undefined}
|
|
701
|
+
*/
|
|
702
|
+
getUpdaterConfig() {
|
|
703
|
+
return this.updaterConfig;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* 获取远程服务配置
|
|
707
|
+
* @returns {XoRemoteService.Config | undefined}
|
|
708
|
+
*/
|
|
709
|
+
getRemoteServiceConfig() {
|
|
710
|
+
return this.remoteServiceConfig;
|
|
711
|
+
}
|
|
712
|
+
//</editor-fold>
|
|
713
|
+
//<editor-fold desc="获取管理器">
|
|
714
|
+
/**
|
|
715
|
+
* 获取托盘管理器
|
|
716
|
+
* @returns {TrayManager}
|
|
717
|
+
*/
|
|
718
|
+
getTrayManager() {
|
|
719
|
+
return this.trayManager;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* 获取 IPC 管理器
|
|
723
|
+
* @returns {IpcManagerAbstract}
|
|
724
|
+
*/
|
|
725
|
+
getIpcManager() {
|
|
726
|
+
return this.ipcManager;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* 获取菜单管理器
|
|
730
|
+
* @returns {MenuManager}
|
|
731
|
+
*/
|
|
732
|
+
getMenuManager() {
|
|
733
|
+
return this.menuManager;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* 获取协议管理器
|
|
737
|
+
* @returns {ProtocolManagerAbstract}
|
|
738
|
+
*/
|
|
739
|
+
getProtocolManager() {
|
|
740
|
+
return this.protocolManager;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* 获取渲染进程协议管理器
|
|
744
|
+
* @returns {RendererProtocolManagerAbstract}
|
|
745
|
+
*/
|
|
746
|
+
getRendererProtocolManager() {
|
|
747
|
+
return this.rendererProtocolManager;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* 获取文件关联管理器
|
|
751
|
+
* @returns {FileAssociationManagerAbstract}
|
|
752
|
+
*/
|
|
753
|
+
getFileAssociationManager() {
|
|
754
|
+
return this.fileAssociationManager;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* 获取主题管理器
|
|
758
|
+
* @returns {ThemeManagerAbstract}
|
|
759
|
+
*/
|
|
760
|
+
getThemeManager() {
|
|
761
|
+
return this.themeManager;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* 获取更新器管理器
|
|
765
|
+
* @returns {UpdaterManagerAbstract}
|
|
766
|
+
*/
|
|
767
|
+
getUpdaterManager() {
|
|
768
|
+
return this.updaterManager;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* 获取远程服务管理器
|
|
772
|
+
* @returns {RemoteServiceManagerAbstract}
|
|
773
|
+
*/
|
|
774
|
+
getRemoteServiceManager() {
|
|
775
|
+
return this.remoteServiceManager;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* 获取 JWT 认证管理器
|
|
779
|
+
* @returns {JwtAuthManager}
|
|
780
|
+
*/
|
|
781
|
+
getAuthManager() {
|
|
782
|
+
return this.authManager;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* 获取快捷键管理器
|
|
786
|
+
* @returns {ShortcutManagerAbstract}
|
|
787
|
+
*/
|
|
788
|
+
getShortcutManager() {
|
|
789
|
+
return this.shortcutManager;
|
|
790
|
+
}
|
|
791
|
+
//</editor-fold>
|
|
792
|
+
//<editor-fold desc="应用存储器">
|
|
793
|
+
/**
|
|
794
|
+
* 获取 App 设置存储
|
|
795
|
+
* @returns {AppStore}
|
|
796
|
+
*/
|
|
797
|
+
getAppStore() {
|
|
798
|
+
return this.appStore;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* 是否窗口启动模式
|
|
802
|
+
* @returns {boolean}
|
|
803
|
+
*/
|
|
804
|
+
isWindowLaunchMode() {
|
|
805
|
+
return this.appStore.getAppLaunchMode() === "window";
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* 是否静默启动模式
|
|
809
|
+
* @returns {boolean}
|
|
810
|
+
*/
|
|
811
|
+
isSilentLaunchMode() {
|
|
812
|
+
return this.appStore.getAppLaunchMode() === "silent";
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* 是否外部触发启动模式
|
|
816
|
+
* @returns {boolean}
|
|
817
|
+
* @private
|
|
818
|
+
*/
|
|
819
|
+
isExternalLaunchMode() {
|
|
820
|
+
const appConfig = this.getAppConfig();
|
|
821
|
+
return ProtocolUtil.hasProtocolUrl(process.argv, appConfig?.eletronAppConfig?.protocols) || FileAssociationUtil.hasAssociatedFile(process.argv, appConfig?.eletronAppConfig?.fileAssociationExtensions);
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* 是否开机启动
|
|
825
|
+
* @returns {boolean}
|
|
826
|
+
*/
|
|
827
|
+
isLaunchOnStartup() {
|
|
828
|
+
return this.appStore.getLaunchOnStartup();
|
|
829
|
+
}
|
|
830
|
+
//</editor-fold>
|
|
831
|
+
//<editor-fold desc="主窗口 管理">
|
|
832
|
+
/**
|
|
833
|
+
* 创建主窗口
|
|
834
|
+
* <p>框架统一在此方法中串联主窗口创建前后的生命周期。</p>
|
|
835
|
+
* @returns {Promise<Electron.BrowserWindow>}
|
|
836
|
+
*/
|
|
837
|
+
async createMainWindow() {
|
|
838
|
+
this.mainWindow = await this.windowManager.reuseOrCreate(MainWindowIdentity);
|
|
839
|
+
return this.mainWindow;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* 获取窗口管理器
|
|
843
|
+
* @returns {WindowManager}
|
|
844
|
+
*/
|
|
845
|
+
getWindowManager() {
|
|
846
|
+
return this.windowManager;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* 获取或创建主窗口
|
|
850
|
+
* @returns {Promise<Electron.BrowserWindow | undefined>}
|
|
851
|
+
*/
|
|
852
|
+
async getMainWindow() {
|
|
853
|
+
if (!this.mainWindow || this.mainWindow.isDestroyed()) {
|
|
854
|
+
this.mainWindow = await this.createMainWindow();
|
|
855
|
+
}
|
|
856
|
+
return this.mainWindow;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* 显示主窗口
|
|
860
|
+
* @returns {Promise<void>}
|
|
861
|
+
*/
|
|
862
|
+
async showMainWindow() {
|
|
863
|
+
let window = await this.getMainWindow();
|
|
864
|
+
if (!window || window.isDestroyed()) {
|
|
865
|
+
window = await this.createMainWindow();
|
|
866
|
+
}
|
|
867
|
+
this.getWindowManager().showByWindow(window);
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* 隐藏主窗口
|
|
871
|
+
* @returns {Promise<void>}
|
|
872
|
+
*/
|
|
873
|
+
async hideMainWindow() {
|
|
874
|
+
this.getWindowManager().hideByWindow(await this.getMainWindow());
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* 关闭主窗口
|
|
878
|
+
* @returns {Promise<void>}
|
|
879
|
+
*/
|
|
880
|
+
async closeMainWindow() {
|
|
881
|
+
this.getWindowManager().closeByWindow(await this.getMainWindow());
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* 切换主窗口显示状态
|
|
885
|
+
* @returns {Promise<void>}
|
|
886
|
+
*/
|
|
887
|
+
async toggleMainWindowVisible() {
|
|
888
|
+
const window = await this.getMainWindow();
|
|
889
|
+
if (!window || window?.isDestroyed()) {
|
|
890
|
+
await this.showMainWindow();
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (window.isVisible() && !window.isMinimized()) {
|
|
894
|
+
window.hide();
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
await this.showMainWindow();
|
|
898
|
+
}
|
|
899
|
+
//</editor-fold>
|
|
900
|
+
//<editor-fold desc="所有窗口">
|
|
901
|
+
/**
|
|
902
|
+
* 切换所有窗口显示状态
|
|
903
|
+
* @returns {Promise<void>}
|
|
904
|
+
*/
|
|
905
|
+
async toggleAllWindowVisible() {
|
|
906
|
+
const wins = BrowserWindow2.getAllWindows();
|
|
907
|
+
if (this.mainWindow?.isVisible()) {
|
|
908
|
+
wins.forEach((win) => win.hide());
|
|
909
|
+
} else {
|
|
910
|
+
await this.showMainWindow();
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
//</editor-fold>
|
|
914
|
+
//<editor-fold desc="设置窗口 管理">
|
|
915
|
+
/**
|
|
916
|
+
* 创建设置窗口
|
|
917
|
+
* <p>窗口幂等创建与并发创建任务复用</p>
|
|
918
|
+
* @returns {Promise<Electron.BrowserWindow>}
|
|
919
|
+
*/
|
|
920
|
+
async createSettingWindow() {
|
|
921
|
+
if (this.settingWindow && !this.settingWindow.isDestroyed()) {
|
|
922
|
+
return this.settingWindow;
|
|
923
|
+
}
|
|
924
|
+
if (!this.settingWindowPromise) {
|
|
925
|
+
this.settingWindowPromise = this.windowManager.reuseOrCreate(SettingWindowIdentity).then((window) => {
|
|
926
|
+
this.settingWindow = window;
|
|
927
|
+
return window;
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
const promise = this.settingWindowPromise;
|
|
931
|
+
try {
|
|
932
|
+
return await promise;
|
|
933
|
+
} finally {
|
|
934
|
+
if (this.settingWindowPromise === promise) {
|
|
935
|
+
this.settingWindowPromise = void 0;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* 获取或创建设置窗口
|
|
941
|
+
* @returns {Promise<Electron.BrowserWindow | undefined>}
|
|
942
|
+
*/
|
|
943
|
+
async getSettingWindow() {
|
|
944
|
+
if (!this.settingWindow || this.settingWindow.isDestroyed()) {
|
|
945
|
+
this.settingWindow = await this.createSettingWindow();
|
|
946
|
+
}
|
|
947
|
+
return this.settingWindow;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* 显示设置窗口
|
|
951
|
+
* @returns {Promise<void>}
|
|
952
|
+
*/
|
|
953
|
+
async showSettingWindow() {
|
|
954
|
+
let window = await this.getSettingWindow();
|
|
955
|
+
if (!window || window.isDestroyed()) {
|
|
956
|
+
window = await this.createSettingWindow();
|
|
957
|
+
}
|
|
958
|
+
const mainWindow = await this.getMainWindow();
|
|
959
|
+
if (mainWindow?.isAlwaysOnTop()) {
|
|
960
|
+
window.setAlwaysOnTop(true);
|
|
961
|
+
}
|
|
962
|
+
this.getWindowManager().ensureWindowRectangleVisible(window, mainWindow);
|
|
963
|
+
this.getWindowManager().showByWindow(window);
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* 隐藏设置窗口
|
|
967
|
+
* @returns {Promise<void>}
|
|
968
|
+
*/
|
|
969
|
+
async hideSettingWindow() {
|
|
970
|
+
let window = await this.getSettingWindow();
|
|
971
|
+
this.getWindowManager().hideByWindow(window);
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* 关闭设置窗口
|
|
975
|
+
* @returns {Promise<void>}
|
|
976
|
+
*/
|
|
977
|
+
async closeSettingWindow() {
|
|
978
|
+
let window = await this.getSettingWindow();
|
|
979
|
+
this.getWindowManager().closeByWindow(window);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* 切换设置窗口显示状态
|
|
983
|
+
* @returns {Promise<void>}
|
|
984
|
+
*/
|
|
985
|
+
async toggleSettingWindow() {
|
|
986
|
+
const window = await this.getSettingWindow();
|
|
987
|
+
if (!window || window?.isDestroyed()) {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
if (window.isVisible() && !window.isMinimized()) {
|
|
991
|
+
window.hide();
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
await this.showSettingWindow();
|
|
995
|
+
}
|
|
996
|
+
//</editor-fold>
|
|
997
|
+
//<editor-fold desc="应用管理">
|
|
998
|
+
/**
|
|
999
|
+
* 启动应用
|
|
1000
|
+
* @returns {Promise<void>}
|
|
1001
|
+
*/
|
|
1002
|
+
async run() {
|
|
1003
|
+
if (this.started) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
this.started = true;
|
|
1007
|
+
try {
|
|
1008
|
+
if (!this.singleInstance()) return;
|
|
1009
|
+
this.bannerManager?.printBannerLines(this.appLog.info);
|
|
1010
|
+
this.appLog.info("\u7A0B\u5E8F\u542F\u52A8...");
|
|
1011
|
+
await this.bindElectronLifecycle();
|
|
1012
|
+
this.appLog.info("Electron \u751F\u547D\u5468\u671F\u7ED1\u5B9A\u5B8C\u6210");
|
|
1013
|
+
await this.lifecycle?.xoAppBeforeStart();
|
|
1014
|
+
this.appLog.debug("[\u542F\u52A8\u524D]\u751F\u547D\u5468\u671F\u52A0\u8F7D\u5B8C\u6210");
|
|
1015
|
+
await app2.whenReady();
|
|
1016
|
+
if (this.protocolManager.initialize()) {
|
|
1017
|
+
this.appLog.info("\u534F\u8BAE\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1018
|
+
}
|
|
1019
|
+
if (this.rendererProtocolManager.initialize()) {
|
|
1020
|
+
this.appLog.info("\u6E32\u67D3\u8FDB\u7A0B\u534F\u8BAE\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1021
|
+
}
|
|
1022
|
+
if (this.fileAssociationManager.initialize()) {
|
|
1023
|
+
this.appLog.info("\u6587\u4EF6\u5173\u8054\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1024
|
+
}
|
|
1025
|
+
if (this.themeManager.initialize()) {
|
|
1026
|
+
this.appLog.info("\u4E3B\u9898\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1027
|
+
}
|
|
1028
|
+
if (this.updaterManager.initialize()) {
|
|
1029
|
+
this.appLog.info("\u66F4\u65B0\u5668\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1030
|
+
}
|
|
1031
|
+
if (this.remoteServiceManager.initialize()) {
|
|
1032
|
+
this.appLog.info("\u8FDC\u7A0B\u670D\u52A1\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1033
|
+
}
|
|
1034
|
+
if (this.authManager.initialize()) {
|
|
1035
|
+
this.appLog.info("JWT \u8BA4\u8BC1\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1036
|
+
}
|
|
1037
|
+
this.shortcutManager.initialize();
|
|
1038
|
+
this.appLog.info("\u5FEB\u6377\u952E\u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1039
|
+
this.ipcManager.register();
|
|
1040
|
+
this.appLog.info("IPC \u6A21\u5757\u52A0\u8F7D\u5B8C\u6210");
|
|
1041
|
+
await this.lifecycle?.whenReady();
|
|
1042
|
+
this.appLog.info("Electron \u51C6\u5907\u5C31\u7EEA");
|
|
1043
|
+
this.menuManager.installAppMenu();
|
|
1044
|
+
this.appLog.info("\u5E94\u7528\u83DC\u5355\u52A0\u8F7D\u5B8C\u6210");
|
|
1045
|
+
await this.trayManager.create();
|
|
1046
|
+
this.appLog.info("\u6258\u76D8\u52A0\u8F7D\u5B8C\u6210");
|
|
1047
|
+
await this.lifecycle?.xoAppAfterStart();
|
|
1048
|
+
this.appLog.debug("[\u542F\u52A8\u540E]\u751F\u547D\u5468\u671F\u52A0\u8F7D\u5B8C\u6210");
|
|
1049
|
+
this.appLog.info("\u7A0B\u5E8F\u542F\u52A8\u5B8C\u6210");
|
|
1050
|
+
} catch (error) {
|
|
1051
|
+
await this.lifecycle?.onError({ source: "XionApp.run()", error });
|
|
1052
|
+
throw error;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* 控制单例模式
|
|
1057
|
+
* @returns {boolean}
|
|
1058
|
+
* @private
|
|
1059
|
+
*/
|
|
1060
|
+
singleInstance() {
|
|
1061
|
+
if (this.appConfig?.singleInstance && !app2.requestSingleInstanceLock()) {
|
|
1062
|
+
if (!this.isExternalLaunchMode()) {
|
|
1063
|
+
this.appLog.warn("\u5355\u5B9E\u4F8B\u9501\u5B9A\u5931\u8D25\uFF0C\u5E94\u7528\u7A0B\u5E8F\u5C06\u9000\u51FA");
|
|
1064
|
+
}
|
|
1065
|
+
app2.quit();
|
|
1066
|
+
return false;
|
|
1067
|
+
}
|
|
1068
|
+
return true;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* 退出应用
|
|
1072
|
+
*/
|
|
1073
|
+
quit() {
|
|
1074
|
+
this.quitting = true;
|
|
1075
|
+
app2.quit();
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* 重启应用
|
|
1079
|
+
*/
|
|
1080
|
+
restart() {
|
|
1081
|
+
app2.relaunch();
|
|
1082
|
+
this.quit();
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* App 是否正在退出
|
|
1086
|
+
* @returns {boolean}
|
|
1087
|
+
*/
|
|
1088
|
+
isQuitting() {
|
|
1089
|
+
return this.quitting;
|
|
1090
|
+
}
|
|
1091
|
+
//</editor-fold>
|
|
1092
|
+
//<editor-fold desc="生命周期">
|
|
1093
|
+
/**
|
|
1094
|
+
* 绑定 Electron 生命周期
|
|
1095
|
+
* @private
|
|
1096
|
+
*/
|
|
1097
|
+
async bindElectronLifecycle() {
|
|
1098
|
+
app2.on("browser-window-created", (event, window) => {
|
|
1099
|
+
this.appLog.debug("on:browser-window-created", { browserWindowID: window.id });
|
|
1100
|
+
this.catcher("on:browser-window-created", () => this.lifecycle?.onBrowserWindowCreated(event, window));
|
|
1101
|
+
});
|
|
1102
|
+
app2.on("browser-window-focus", (event, window) => {
|
|
1103
|
+
this.appLog.debug("on:browser-window-focus", WindowUtil.windowToUID(this.windowManager, window));
|
|
1104
|
+
this.catcher("on:browser-window-focus", () => this.lifecycle?.onBrowserWindowFocus(event, window));
|
|
1105
|
+
});
|
|
1106
|
+
app2.on("browser-window-blur", (event, window) => {
|
|
1107
|
+
this.appLog.debug("on:browser-window-blur", WindowUtil.windowToUID(this.windowManager, window));
|
|
1108
|
+
this.catcher("on:browser-window-blur", () => this.lifecycle?.onBrowserWindowBlur(event, window));
|
|
1109
|
+
});
|
|
1110
|
+
app2.on("activate", (event, hasVisibleWindows) => {
|
|
1111
|
+
this.appLog.debug("on:activate");
|
|
1112
|
+
this.catcher("on:activate", () => this.lifecycle?.onActivate(event, hasVisibleWindows));
|
|
1113
|
+
});
|
|
1114
|
+
app2.on("second-instance", (event, argv, workingDirectory, additionalData) => {
|
|
1115
|
+
this.appLog.debug("on:second-instance");
|
|
1116
|
+
this.catcher("on:second-instance", () => this.lifecycle?.onSecondInstance(event, argv, workingDirectory, additionalData));
|
|
1117
|
+
});
|
|
1118
|
+
app2.on("window-all-closed", () => {
|
|
1119
|
+
this.appLog.debug("on:window-all-closed");
|
|
1120
|
+
this.catcher("on:window-all-closed", () => this.lifecycle?.onWindowAllClosed());
|
|
1121
|
+
});
|
|
1122
|
+
app2.on("before-quit", (event) => {
|
|
1123
|
+
this.quitting = true;
|
|
1124
|
+
this.trayManager.destroy();
|
|
1125
|
+
this.appLog.debug("on:before-quit");
|
|
1126
|
+
this.catcher("on:before-quit", () => this.lifecycle?.onBeforeQuit(event));
|
|
1127
|
+
});
|
|
1128
|
+
app2.on("will-quit", (event) => {
|
|
1129
|
+
this.appLog.debug("on:will-quit");
|
|
1130
|
+
this.catcher("on:will-quit", () => this.lifecycle?.onWillQuit(event));
|
|
1131
|
+
});
|
|
1132
|
+
app2.on("open-file", (event, path) => {
|
|
1133
|
+
this.appLog.debug("on:open-file", { path });
|
|
1134
|
+
this.catcher("on:open-file", () => this.lifecycle?.onOpenFile(event, path));
|
|
1135
|
+
});
|
|
1136
|
+
app2.on("open-url", (event, url) => {
|
|
1137
|
+
this.appLog.debug("on:open-url", { url });
|
|
1138
|
+
this.catcher("on:open-url", () => this.lifecycle?.onOpenUrl(event, url));
|
|
1139
|
+
});
|
|
1140
|
+
app2.on("web-contents-created", (event, webContents) => {
|
|
1141
|
+
this.appLog.debug("on:web-contents-created", { webContentsID: webContents.id });
|
|
1142
|
+
this.catcher("on:web-contents-created", () => this.lifecycle?.onWebContentsCreated(event, webContents));
|
|
1143
|
+
});
|
|
1144
|
+
app2.on("session-created", (session) => {
|
|
1145
|
+
this.appLog.debug("on:session-created");
|
|
1146
|
+
this.catcher("on:session-created", async () => {
|
|
1147
|
+
this.rendererProtocolManager.initializeSession(session);
|
|
1148
|
+
await this.lifecycle?.onSessionCreated(session);
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
1151
|
+
app2.on("child-process-gone", (event, details) => {
|
|
1152
|
+
this.appLog.debug("on:child-process-gone", { details });
|
|
1153
|
+
this.catcher("on:child-process-gone", () => this.lifecycle?.onChildProcessGone(event, details));
|
|
1154
|
+
});
|
|
1155
|
+
app2.on("gpu-info-update", () => {
|
|
1156
|
+
this.appLog.debug("on:gpu-info-update");
|
|
1157
|
+
this.catcher("on:gpu-info-update", () => this.lifecycle?.onGpuInfoUpdate());
|
|
1158
|
+
});
|
|
1159
|
+
app2.on("render-process-gone", (event, webContents, details) => {
|
|
1160
|
+
this.appLog.debug("on:render-process-gone", { webContents, details });
|
|
1161
|
+
this.catcher("on:render-process-gone", () => this.lifecycle?.onRenderProcessGone(event, webContents, details));
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
//</editor-fold>
|
|
1165
|
+
//<editor-fold desc="错误管理">
|
|
1166
|
+
/**
|
|
1167
|
+
* 事件错误捕捉器
|
|
1168
|
+
* <p>用于兜底 Electron 事件回调中的同步异常和异步异常,并统一转发给 onError。</p>
|
|
1169
|
+
* @param {string} name 生命周期名称
|
|
1170
|
+
* @param {() => Promise<void> | void} runner 生命周期执行函数
|
|
1171
|
+
* @private
|
|
1172
|
+
*/
|
|
1173
|
+
catcher(name, runner) {
|
|
1174
|
+
try {
|
|
1175
|
+
void Promise.resolve(runner()).catch((error) => {
|
|
1176
|
+
void this.lifecycle?.onError({ source: name, error });
|
|
1177
|
+
});
|
|
1178
|
+
} catch (error) {
|
|
1179
|
+
void this.lifecycle?.onError({ source: name, error });
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* 分发错误到 App 日志
|
|
1184
|
+
* @param {XoApp.LifecycleError} error 错误信息
|
|
1185
|
+
* @returns {Promise<void>}
|
|
1186
|
+
*/
|
|
1187
|
+
async dispatchAppError(error) {
|
|
1188
|
+
await this.lifecycle?.onError(error);
|
|
1189
|
+
}
|
|
1190
|
+
//</editor-fold>
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
// src/main/app/xo-app.ts
|
|
1194
|
+
var XoApp = class _XoApp extends XoAppAbstract {
|
|
1195
|
+
/**
|
|
1196
|
+
* XionApp 单例
|
|
1197
|
+
* @private
|
|
1198
|
+
*/
|
|
1199
|
+
static singleInstance;
|
|
1200
|
+
/**
|
|
1201
|
+
* 构造函数
|
|
1202
|
+
* @param {XoApp.ConstructorOptions} options 选项
|
|
1203
|
+
*/
|
|
1204
|
+
constructor(options) {
|
|
1205
|
+
super(options);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* 启动应用
|
|
1209
|
+
* @param {XoApp.ConstructorOptions} options 选项
|
|
1210
|
+
* @returns {Promise<void>}
|
|
1211
|
+
*/
|
|
1212
|
+
static async start(options) {
|
|
1213
|
+
if (this.singleInstance !== void 0) {
|
|
1214
|
+
this.singleInstance.appLog.warn("XionApp \u4EC5\u652F\u6301\u5355\u5B9E\u4F8B");
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
this.singleInstance = new _XoApp(options);
|
|
1218
|
+
await this.singleInstance?.run();
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
export {
|
|
1222
|
+
AppLifecycle,
|
|
1223
|
+
AppLifecycleAbstract,
|
|
1224
|
+
XoApp,
|
|
1225
|
+
XoAppAbstract
|
|
1226
|
+
};
|