@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,1706 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// src/preload/bridge/bridge-abstract.ts
|
|
4
|
+
var BridgeAbstract = class {
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/shared/errors/ipc-invoke-error.ts
|
|
8
|
+
var IpcInvokeErrorName = "IpcInvokeError";
|
|
9
|
+
var IpcInvokeError = class extends Error {
|
|
10
|
+
/* 错误类型标记 */
|
|
11
|
+
kind = IpcInvokeErrorName;
|
|
12
|
+
/* 错误码 */
|
|
13
|
+
code;
|
|
14
|
+
/* 错误数据 */
|
|
15
|
+
data;
|
|
16
|
+
/**
|
|
17
|
+
* 构造函数
|
|
18
|
+
* @param {XoIpc.Result} result IPC 调用结果
|
|
19
|
+
*/
|
|
20
|
+
constructor(result) {
|
|
21
|
+
super(result.message || "IPC \u8C03\u7528\u5931\u8D25");
|
|
22
|
+
this.name = IpcInvokeErrorName;
|
|
23
|
+
this.code = result.code;
|
|
24
|
+
this.data = result.data;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/preload/utils/bridge-util.ts
|
|
29
|
+
var import_electron = require("electron");
|
|
30
|
+
var BridgeUtil = class _BridgeUtil {
|
|
31
|
+
/**
|
|
32
|
+
* 调用IPC并返回结果
|
|
33
|
+
* @template R 返回值类型
|
|
34
|
+
* @param {XoIpc.Channel} channel 通道
|
|
35
|
+
* @param {any[]} args 参数
|
|
36
|
+
* @returns {Promise<XoIpc.Result<R>>}
|
|
37
|
+
*/
|
|
38
|
+
static async invokeResult(channel, ...args) {
|
|
39
|
+
return await import_electron.ipcRenderer.invoke(channel, ...args);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 调用IPC并返回数据
|
|
43
|
+
* @template R 返回值类型
|
|
44
|
+
* @param {XoIpc.Channel} channel 通道
|
|
45
|
+
* @param {any[]} args 参数
|
|
46
|
+
* @returns {Promise<R | undefined>}
|
|
47
|
+
*/
|
|
48
|
+
static async invoke(channel, ...args) {
|
|
49
|
+
const result = await _BridgeUtil.invokeResult(channel, ...args);
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
const error = new IpcInvokeError(result);
|
|
52
|
+
throw {
|
|
53
|
+
kind: error.kind,
|
|
54
|
+
name: error.name,
|
|
55
|
+
message: error.message,
|
|
56
|
+
code: error.code,
|
|
57
|
+
data: error.data
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return result.data;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 发送IPC消息
|
|
64
|
+
* @param {XoIpc.Channel} channel 通道
|
|
65
|
+
* @param {any[]} args 参数
|
|
66
|
+
*/
|
|
67
|
+
static send(channel, ...args) {
|
|
68
|
+
import_electron.ipcRenderer.send(channel, ...args);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 监听IPC消息
|
|
72
|
+
* @template TArgs 参数类型
|
|
73
|
+
* @param {XoIpc.Channel} channel 通道
|
|
74
|
+
* @param {(...args: TArgs) => void} listener 监听器
|
|
75
|
+
* @returns {() => void}
|
|
76
|
+
*/
|
|
77
|
+
static on(channel, listener) {
|
|
78
|
+
const wrappedListener = (_event, ...args) => {
|
|
79
|
+
listener(...args);
|
|
80
|
+
};
|
|
81
|
+
import_electron.ipcRenderer.on(channel, wrappedListener);
|
|
82
|
+
return () => {
|
|
83
|
+
import_electron.ipcRenderer.removeListener(channel, wrappedListener);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 单次监听IPC消息
|
|
88
|
+
* @template TArgs 参数类型
|
|
89
|
+
* @param {XoIpc.Channel} channel 通道
|
|
90
|
+
* @param {(...args: TArgs) => void} listener 监听器
|
|
91
|
+
*/
|
|
92
|
+
static once(channel, listener) {
|
|
93
|
+
import_electron.ipcRenderer.once(channel, (_event, ...args) => {
|
|
94
|
+
listener(...args);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// src/shared/ipc/consts/ipc-channel.ts
|
|
100
|
+
var IpcChannelPrefix = "Channel_";
|
|
101
|
+
|
|
102
|
+
// src/shared/utils/ipc-util.ts
|
|
103
|
+
var IpcUtil = class {
|
|
104
|
+
/**
|
|
105
|
+
* 创建IPC通道
|
|
106
|
+
* @param {string} name 通道名
|
|
107
|
+
* @returns {XoIpc.Channel}
|
|
108
|
+
*/
|
|
109
|
+
static channel(name) {
|
|
110
|
+
return `${IpcChannelPrefix}${name}`;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/shared/ipc/channels/app-channels.ts
|
|
115
|
+
var AppChannels = class {
|
|
116
|
+
/** 获取应用信息 */
|
|
117
|
+
static getInfo = IpcUtil.channel("BuiltIn:App:getInfo");
|
|
118
|
+
/** 获取应用目录 */
|
|
119
|
+
static getPaths = IpcUtil.channel("BuiltIn:App:getPaths");
|
|
120
|
+
/** 获取通用设置 */
|
|
121
|
+
static getGeneralSettings = IpcUtil.channel("BuiltIn:App:getGeneralSettings");
|
|
122
|
+
/** 获取 APP 透明度 */
|
|
123
|
+
static getOpacity = IpcUtil.channel("BuiltIn:App:getOpacity");
|
|
124
|
+
/** 设置 APP 透明度 */
|
|
125
|
+
static setOpacity = IpcUtil.channel("BuiltIn:App:setOpacity");
|
|
126
|
+
/** 获取快捷窗口材质 */
|
|
127
|
+
static getWindowMaterial = IpcUtil.channel("BuiltIn:App:getWindowMaterial");
|
|
128
|
+
/** 设置快捷窗口材质 */
|
|
129
|
+
static setWindowMaterial = IpcUtil.channel("BuiltIn:App:setWindowMaterial");
|
|
130
|
+
/** 获取应用启动模式 */
|
|
131
|
+
static getAppLaunchMode = IpcUtil.channel("BuiltIn:App:getAppLaunchMode");
|
|
132
|
+
/** 设置应用启动模式 */
|
|
133
|
+
static setAppLaunchMode = IpcUtil.channel("BuiltIn:App:setAppLaunchMode");
|
|
134
|
+
/** 获取是否开机启动 */
|
|
135
|
+
static getLaunchOnStartup = IpcUtil.channel("BuiltIn:App:getLaunchOnStartup");
|
|
136
|
+
/** 设置是否开机启动 */
|
|
137
|
+
static setLaunchOnStartup = IpcUtil.channel("BuiltIn:App:setLaunchOnStartup");
|
|
138
|
+
/** 获取关闭窗口行为 */
|
|
139
|
+
static getWindowCloseBehavior = IpcUtil.channel("BuiltIn:App:getWindowCloseBehavior");
|
|
140
|
+
/** 设置关闭窗口行为 */
|
|
141
|
+
static setWindowCloseBehavior = IpcUtil.channel("BuiltIn:App:setWindowCloseBehavior");
|
|
142
|
+
/** 获取日志等级 */
|
|
143
|
+
static getLogLevel = IpcUtil.channel("BuiltIn:App:getLogLevel");
|
|
144
|
+
/** 设置日志等级 */
|
|
145
|
+
static setLogLevel = IpcUtil.channel("BuiltIn:App:setLogLevel");
|
|
146
|
+
/** 获取快捷键配置 */
|
|
147
|
+
static getShortcuts = IpcUtil.channel("BuiltIn:App:getShortcuts");
|
|
148
|
+
/** 设置快捷键配置 */
|
|
149
|
+
static setShortcuts = IpcUtil.channel("BuiltIn:App:setShortcuts");
|
|
150
|
+
/** 设置单个快捷键配置 */
|
|
151
|
+
static setShortcut = IpcUtil.channel("BuiltIn:App:setShortcut");
|
|
152
|
+
/** 删除快捷键配置 */
|
|
153
|
+
static deleteShortcut = IpcUtil.channel("BuiltIn:App:deleteShortcut");
|
|
154
|
+
/** 重定向指定窗口路由 */
|
|
155
|
+
static redirectWindowRoute = IpcUtil.channel("BuiltIn:App:redirectWindowRoute");
|
|
156
|
+
/** 重定向主窗口路由 */
|
|
157
|
+
static redirectMainWindowRoute = IpcUtil.channel("BuiltIn:App:redirectMainWindowRoute");
|
|
158
|
+
/** 重定向设置窗口路由 */
|
|
159
|
+
static redirectSettingWindowRoute = IpcUtil.channel("BuiltIn:App:redirectSettingWindowRoute");
|
|
160
|
+
/** 显示主窗口 */
|
|
161
|
+
static showMainWindow = IpcUtil.channel("BuiltIn:App:showMainWindow");
|
|
162
|
+
/** 显示设置窗口 */
|
|
163
|
+
static showSettingWindow = IpcUtil.channel("BuiltIn:App:showSettingWindow");
|
|
164
|
+
/** 重启应用 */
|
|
165
|
+
static restart = IpcUtil.channel("BuiltIn:App:restart");
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/preload/bridges/app/app-bridge.ts
|
|
169
|
+
var AppBridge = class extends BridgeAbstract {
|
|
170
|
+
/**
|
|
171
|
+
* 接口映射
|
|
172
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.app}</p>
|
|
173
|
+
* @returns {XoBridge.ApiMap}
|
|
174
|
+
*/
|
|
175
|
+
apiMap() {
|
|
176
|
+
return {
|
|
177
|
+
app: {
|
|
178
|
+
// 获取应用信息
|
|
179
|
+
getInfo: this.getInfo.bind(this),
|
|
180
|
+
// 获取应用目录
|
|
181
|
+
getPaths: this.getPaths.bind(this),
|
|
182
|
+
// 获取通用设置
|
|
183
|
+
getGeneralSettings: this.getGeneralSettings.bind(this),
|
|
184
|
+
// 获取 APP 透明度
|
|
185
|
+
getOpacity: this.getOpacity.bind(this),
|
|
186
|
+
// 设置 APP 透明度
|
|
187
|
+
setOpacity: this.setOpacity.bind(this),
|
|
188
|
+
// 获取快捷窗口材质
|
|
189
|
+
getWindowMaterial: this.getWindowMaterial.bind(this),
|
|
190
|
+
// 设置快捷窗口材质
|
|
191
|
+
setWindowMaterial: this.setWindowMaterial.bind(this),
|
|
192
|
+
// 获取应用启动模式
|
|
193
|
+
getAppLaunchMode: this.getAppLaunchMode.bind(this),
|
|
194
|
+
// 设置应用启动模式
|
|
195
|
+
setAppLaunchMode: this.setAppLaunchMode.bind(this),
|
|
196
|
+
// 获取是否开机启动
|
|
197
|
+
getLaunchOnStartup: this.getLaunchOnStartup.bind(this),
|
|
198
|
+
// 设置是否开机启动
|
|
199
|
+
setLaunchOnStartup: this.setLaunchOnStartup.bind(this),
|
|
200
|
+
// 获取关闭窗口行为
|
|
201
|
+
getWindowCloseBehavior: this.getWindowCloseBehavior.bind(this),
|
|
202
|
+
// 设置关闭窗口行为
|
|
203
|
+
setWindowCloseBehavior: this.setWindowCloseBehavior.bind(this),
|
|
204
|
+
// 获取日志等级
|
|
205
|
+
getLogLevel: this.getLogLevel.bind(this),
|
|
206
|
+
// 设置日志等级
|
|
207
|
+
setLogLevel: this.setLogLevel.bind(this),
|
|
208
|
+
// 获取快捷键配置
|
|
209
|
+
getShortcuts: this.getShortcuts.bind(this),
|
|
210
|
+
// 设置快捷键配置
|
|
211
|
+
setShortcuts: this.setShortcuts.bind(this),
|
|
212
|
+
// 设置单个快捷键配置
|
|
213
|
+
setShortcut: this.setShortcut.bind(this),
|
|
214
|
+
// 删除快捷键配置
|
|
215
|
+
deleteShortcut: this.deleteShortcut.bind(this),
|
|
216
|
+
// 重定向指定窗口路由
|
|
217
|
+
redirectWindowRoute: this.redirectWindowRoute.bind(this),
|
|
218
|
+
// 重定向主窗口路由
|
|
219
|
+
redirectMainWindowRoute: this.redirectMainWindowRoute.bind(this),
|
|
220
|
+
// 重定向设置窗口路由
|
|
221
|
+
redirectSettingWindowRoute: this.redirectSettingWindowRoute.bind(this),
|
|
222
|
+
// 显示主窗口
|
|
223
|
+
showMainWindow: this.showMainWindow.bind(this),
|
|
224
|
+
// 显示设置窗口
|
|
225
|
+
showSettingWindow: this.showSettingWindow.bind(this),
|
|
226
|
+
// 重启应用
|
|
227
|
+
restart: this.restart.bind(this)
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 获取应用信息
|
|
233
|
+
* @returns {Promise<XoApp.Info>}
|
|
234
|
+
*/
|
|
235
|
+
getInfo = async () => {
|
|
236
|
+
const data = await BridgeUtil.invoke(AppChannels.getInfo);
|
|
237
|
+
return data ?? {};
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* 获取应用目录
|
|
241
|
+
* @returns {Promise<XoApp.Paths>}
|
|
242
|
+
*/
|
|
243
|
+
getPaths = async () => {
|
|
244
|
+
const data = await BridgeUtil.invoke(AppChannels.getPaths);
|
|
245
|
+
return data ?? {
|
|
246
|
+
userData: "",
|
|
247
|
+
sessionData: "",
|
|
248
|
+
logs: "",
|
|
249
|
+
crashDumps: "",
|
|
250
|
+
temp: "",
|
|
251
|
+
updaterCacheDir: ""
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* 获取通用设置
|
|
256
|
+
* @returns {Promise<XoApp.GeneralSettings>}
|
|
257
|
+
*/
|
|
258
|
+
getGeneralSettings = async () => {
|
|
259
|
+
const settings = await BridgeUtil.invoke(AppChannels.getGeneralSettings);
|
|
260
|
+
return settings ?? {
|
|
261
|
+
opacity: 1,
|
|
262
|
+
windowMaterial: "none",
|
|
263
|
+
shortcuts: {},
|
|
264
|
+
logLevel: "info",
|
|
265
|
+
launchOnStartup: false,
|
|
266
|
+
appLaunchMode: "window",
|
|
267
|
+
windowCloseBehavior: "minimize"
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* 获取 APP 透明度
|
|
272
|
+
* @returns {Promise<number>}
|
|
273
|
+
*/
|
|
274
|
+
getOpacity = async () => {
|
|
275
|
+
const opacity = await BridgeUtil.invoke(AppChannels.getOpacity);
|
|
276
|
+
return opacity ?? 1;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* 设置 APP 透明度
|
|
280
|
+
* @param {number} opacity APP 透明度
|
|
281
|
+
* @returns {Promise<void>}
|
|
282
|
+
*/
|
|
283
|
+
setOpacity = async (opacity) => {
|
|
284
|
+
await BridgeUtil.invoke(AppChannels.setOpacity, opacity);
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* 获取快捷窗口材质
|
|
288
|
+
* @returns {Promise<XoApp.WindowMaterial | undefined>}
|
|
289
|
+
*/
|
|
290
|
+
getWindowMaterial = async () => {
|
|
291
|
+
return await BridgeUtil.invoke(AppChannels.getWindowMaterial);
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* 设置快捷窗口材质
|
|
295
|
+
* @param {XoApp.WindowMaterial} windowMaterial 窗口材质
|
|
296
|
+
* @returns {Promise<void>}
|
|
297
|
+
*/
|
|
298
|
+
setWindowMaterial = async (windowMaterial) => {
|
|
299
|
+
await BridgeUtil.invoke(AppChannels.setWindowMaterial, windowMaterial);
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* 获取应用启动模式
|
|
303
|
+
* @returns {Promise<XoApp.AppLaunchMode>}
|
|
304
|
+
*/
|
|
305
|
+
getAppLaunchMode = async () => {
|
|
306
|
+
const appLaunchMode = await BridgeUtil.invoke(AppChannels.getAppLaunchMode);
|
|
307
|
+
return appLaunchMode ?? "window";
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* 设置应用启动模式
|
|
311
|
+
* @param {XoApp.AppLaunchMode} appLaunchMode 应用启动模式
|
|
312
|
+
* @returns {Promise<void>}
|
|
313
|
+
*/
|
|
314
|
+
setAppLaunchMode = async (appLaunchMode) => {
|
|
315
|
+
await BridgeUtil.invoke(AppChannels.setAppLaunchMode, appLaunchMode);
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* 获取是否开机启动
|
|
319
|
+
* @returns {Promise<boolean>}
|
|
320
|
+
*/
|
|
321
|
+
getLaunchOnStartup = async () => {
|
|
322
|
+
const launchOnStartup = await BridgeUtil.invoke(AppChannels.getLaunchOnStartup);
|
|
323
|
+
return launchOnStartup ?? false;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* 设置是否开机启动
|
|
327
|
+
* @param {boolean} launchOnStartup 是否开机启动
|
|
328
|
+
* @returns {Promise<void>}
|
|
329
|
+
*/
|
|
330
|
+
setLaunchOnStartup = async (launchOnStartup) => {
|
|
331
|
+
await BridgeUtil.invoke(AppChannels.setLaunchOnStartup, launchOnStartup);
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* 获取关闭窗口行为
|
|
335
|
+
* @returns {Promise<XoApp.WindowCloseBehavior>}
|
|
336
|
+
*/
|
|
337
|
+
getWindowCloseBehavior = async () => {
|
|
338
|
+
const windowCloseBehavior = await BridgeUtil.invoke(AppChannels.getWindowCloseBehavior);
|
|
339
|
+
return windowCloseBehavior ?? "minimize";
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* 设置关闭窗口行为
|
|
343
|
+
* @param {XoApp.WindowCloseBehavior} windowCloseBehavior 关闭窗口行为
|
|
344
|
+
* @returns {Promise<void>}
|
|
345
|
+
*/
|
|
346
|
+
setWindowCloseBehavior = async (windowCloseBehavior) => {
|
|
347
|
+
await BridgeUtil.invoke(AppChannels.setWindowCloseBehavior, windowCloseBehavior);
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* 获取日志等级
|
|
351
|
+
* @returns {Promise<XoLogger.Level>}
|
|
352
|
+
*/
|
|
353
|
+
getLogLevel = async () => {
|
|
354
|
+
const logLevel = await BridgeUtil.invoke(AppChannels.getLogLevel);
|
|
355
|
+
return logLevel ?? "info";
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* 设置日志等级
|
|
359
|
+
* @param {XoLogger.Level} logLevel 日志等级
|
|
360
|
+
* @returns {Promise<void>}
|
|
361
|
+
*/
|
|
362
|
+
setLogLevel = async (logLevel) => {
|
|
363
|
+
await BridgeUtil.invoke(AppChannels.setLogLevel, logLevel ?? "info");
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* 获取快捷键配置
|
|
367
|
+
* @returns {Promise<XoShortcut.KeyMap>}
|
|
368
|
+
*/
|
|
369
|
+
getShortcuts = async () => {
|
|
370
|
+
const shortcuts = await BridgeUtil.invoke(AppChannels.getShortcuts);
|
|
371
|
+
return shortcuts ?? {};
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* 设置快捷键配置
|
|
375
|
+
* @param {XoShortcut.KeyMap} shortcuts 快捷键配置
|
|
376
|
+
* @returns {Promise<void>}
|
|
377
|
+
*/
|
|
378
|
+
setShortcuts = async (shortcuts) => {
|
|
379
|
+
await BridgeUtil.invoke(AppChannels.setShortcuts, shortcuts);
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* 设置单个快捷键配置
|
|
383
|
+
* @param {XoShortcut.Key} shortcut 快捷键配置
|
|
384
|
+
* @returns {Promise<void>}
|
|
385
|
+
*/
|
|
386
|
+
setShortcut = async (shortcut) => {
|
|
387
|
+
await BridgeUtil.invoke(AppChannels.setShortcut, shortcut);
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* 删除快捷键配置
|
|
391
|
+
* @param {XoShortcut.ID} id 快捷键 ID
|
|
392
|
+
* @returns {Promise<void>}
|
|
393
|
+
*/
|
|
394
|
+
deleteShortcut = async (id) => {
|
|
395
|
+
await BridgeUtil.invoke(AppChannels.deleteShortcut, id);
|
|
396
|
+
};
|
|
397
|
+
/** 重定向指定窗口路由 */
|
|
398
|
+
redirectWindowRoute = async (request) => {
|
|
399
|
+
const result = await BridgeUtil.invoke(AppChannels.redirectWindowRoute, request);
|
|
400
|
+
return result ?? false;
|
|
401
|
+
};
|
|
402
|
+
/** 重定向主窗口路由 */
|
|
403
|
+
redirectMainWindowRoute = async (request) => {
|
|
404
|
+
const result = await BridgeUtil.invoke(AppChannels.redirectMainWindowRoute, request);
|
|
405
|
+
return result ?? false;
|
|
406
|
+
};
|
|
407
|
+
/** 重定向设置窗口路由 */
|
|
408
|
+
redirectSettingWindowRoute = async (request) => {
|
|
409
|
+
const result = await BridgeUtil.invoke(AppChannels.redirectSettingWindowRoute, request);
|
|
410
|
+
return result ?? false;
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* 显示主窗口
|
|
414
|
+
* @param {XoWindow.RouteRedirectRequestWithoutWindow} request 路由重定向请求
|
|
415
|
+
* @returns {Promise<void>}
|
|
416
|
+
*/
|
|
417
|
+
showMainWindow = async (request) => {
|
|
418
|
+
await BridgeUtil.invoke(AppChannels.showMainWindow, request);
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* 显示设置窗口
|
|
422
|
+
* @param {XoWindow.RouteRedirectRequestWithoutWindow} request 路由重定向请求
|
|
423
|
+
* @returns {Promise<void>}
|
|
424
|
+
*/
|
|
425
|
+
showSettingWindow = async (request) => {
|
|
426
|
+
await BridgeUtil.invoke(AppChannels.showSettingWindow, request);
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* 重启应用
|
|
430
|
+
* @returns {Promise<void>}
|
|
431
|
+
*/
|
|
432
|
+
restart = async () => {
|
|
433
|
+
await BridgeUtil.invoke(AppChannels.restart);
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// src/shared/ipc/channels/auth-channels.ts
|
|
438
|
+
var AuthChannels = class {
|
|
439
|
+
/** 获取认证状态 */
|
|
440
|
+
static getState = IpcUtil.channel("BuiltIn:Auth:getState");
|
|
441
|
+
/** 登录 */
|
|
442
|
+
static login = IpcUtil.channel("BuiltIn:Auth:login");
|
|
443
|
+
/** 退出登录 */
|
|
444
|
+
static logout = IpcUtil.channel("BuiltIn:Auth:logout");
|
|
445
|
+
/* ------ 监听通道 ------ */
|
|
446
|
+
/** 监听认证状态 */
|
|
447
|
+
static onState = IpcUtil.channel("BuiltIn:Auth:onState");
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
// src/preload/bridges/auth/auth-bridge.ts
|
|
451
|
+
var AuthBridge = class extends BridgeAbstract {
|
|
452
|
+
/**
|
|
453
|
+
* 接口映射
|
|
454
|
+
* @returns {{auth: XoBridgeApi.Map['auth']}}
|
|
455
|
+
*/
|
|
456
|
+
apiMap() {
|
|
457
|
+
return {
|
|
458
|
+
auth: {
|
|
459
|
+
// 获取认证状态
|
|
460
|
+
getState: this.getState.bind(this),
|
|
461
|
+
// 登录
|
|
462
|
+
login: this.login.bind(this),
|
|
463
|
+
// 退出登录
|
|
464
|
+
logout: this.logout.bind(this),
|
|
465
|
+
// 监听认证状态
|
|
466
|
+
onState: this.onState.bind(this)
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* 获取认证状态
|
|
472
|
+
* @returns {Promise<XoAuth.State>}
|
|
473
|
+
*/
|
|
474
|
+
getState = async () => {
|
|
475
|
+
return await BridgeUtil.invoke(AuthChannels.getState) ?? { status: "unauthenticated" };
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* 登录
|
|
479
|
+
* @param {XoAuth.LoginRequest} request 登录请求
|
|
480
|
+
* @returns {Promise<XoAuth.State>}
|
|
481
|
+
*/
|
|
482
|
+
login = async (request) => {
|
|
483
|
+
return await BridgeUtil.invoke(AuthChannels.login, request) ?? { status: "unauthenticated" };
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* 退出登录
|
|
487
|
+
* @returns {Promise<XoAuth.State>}
|
|
488
|
+
*/
|
|
489
|
+
logout = async () => {
|
|
490
|
+
return await BridgeUtil.invoke(AuthChannels.logout) ?? { status: "unauthenticated" };
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* 监听认证状态
|
|
494
|
+
* @param {XoAuth.StateListener} listener 状态监听器
|
|
495
|
+
* @returns {() => void}
|
|
496
|
+
*/
|
|
497
|
+
onState = (listener) => {
|
|
498
|
+
return BridgeUtil.on(AuthChannels.onState, listener);
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
// src/shared/ipc/channels/clipboard-channels.ts
|
|
503
|
+
var ClipboardChannels = class {
|
|
504
|
+
/** 读取文本 */
|
|
505
|
+
static readText = IpcUtil.channel("BuiltIn:Clipboard:readText");
|
|
506
|
+
/** 写入文本 */
|
|
507
|
+
static writeText = IpcUtil.channel("BuiltIn:Clipboard:writeText");
|
|
508
|
+
/** 写入图片 */
|
|
509
|
+
static writeImage = IpcUtil.channel("BuiltIn:Clipboard:writeImage");
|
|
510
|
+
/** 清空剪切板 */
|
|
511
|
+
static clear = IpcUtil.channel("BuiltIn:Clipboard:clear");
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
// src/preload/bridges/clipboard/clipboard-bridge.ts
|
|
515
|
+
var ClipboardBridge = class extends BridgeAbstract {
|
|
516
|
+
/**
|
|
517
|
+
* 接口映射
|
|
518
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.clipboard}</p>
|
|
519
|
+
* @returns {XoBridge.ApiMap}
|
|
520
|
+
*/
|
|
521
|
+
apiMap() {
|
|
522
|
+
return {
|
|
523
|
+
clipboard: {
|
|
524
|
+
// 读取文本
|
|
525
|
+
readText: this.readText.bind(this),
|
|
526
|
+
// 写入文本
|
|
527
|
+
writeText: this.writeText.bind(this),
|
|
528
|
+
// 写入图片
|
|
529
|
+
writeImage: this.writeImage.bind(this),
|
|
530
|
+
// 清空剪切板
|
|
531
|
+
clear: this.clear.bind(this)
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* 读取文本
|
|
537
|
+
* @returns {Promise<string>}
|
|
538
|
+
*/
|
|
539
|
+
readText = async () => {
|
|
540
|
+
const text = await BridgeUtil.invoke(ClipboardChannels.readText);
|
|
541
|
+
return text ?? "";
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
544
|
+
* 写入文本
|
|
545
|
+
* @param {string} text 文本
|
|
546
|
+
* @returns {Promise<void>}
|
|
547
|
+
*/
|
|
548
|
+
writeText = async (text) => {
|
|
549
|
+
await BridgeUtil.invoke(ClipboardChannels.writeText, text);
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* 写入图片
|
|
553
|
+
* @param {string} dataURL 图片 DataURL
|
|
554
|
+
* @returns {Promise<void>}
|
|
555
|
+
*/
|
|
556
|
+
writeImage = async (dataURL) => {
|
|
557
|
+
await BridgeUtil.invoke(ClipboardChannels.writeImage, dataURL);
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* 清空剪切板
|
|
561
|
+
* @returns {Promise<void>}
|
|
562
|
+
*/
|
|
563
|
+
clear = async () => {
|
|
564
|
+
await BridgeUtil.invoke(ClipboardChannels.clear);
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// src/shared/ipc/channels/context-menu-channels.ts
|
|
569
|
+
var ContextMenuChannels = class {
|
|
570
|
+
/** 执行菜单命令 */
|
|
571
|
+
static executeCommand = IpcUtil.channel("BuiltIn:ContextMenu:executeCommand");
|
|
572
|
+
/* ------ 监听通道 ------ */
|
|
573
|
+
/** 监听上下文菜单请求 */
|
|
574
|
+
static onRequested = IpcUtil.channel("BuiltIn:ContextMenu:onRequested");
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
// src/preload/bridges/context-menu/context-menu-bridge.ts
|
|
578
|
+
var ContextMenuBridge = class extends BridgeAbstract {
|
|
579
|
+
/**
|
|
580
|
+
* 接口映射
|
|
581
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.contextMenu}</p>
|
|
582
|
+
* @returns {XoBridge.ApiMap}
|
|
583
|
+
*/
|
|
584
|
+
apiMap() {
|
|
585
|
+
return {
|
|
586
|
+
contextMenu: {
|
|
587
|
+
// 监听上下文菜单请求
|
|
588
|
+
onRequested: this.onRequested.bind(this),
|
|
589
|
+
// 执行菜单命令
|
|
590
|
+
executeCommand: this.executeCommand.bind(this)
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* 监听上下文菜单请求
|
|
596
|
+
* @param {XoMenu.ContextMenuRequestedListener} listener 监听器
|
|
597
|
+
* @returns {() => void}
|
|
598
|
+
*/
|
|
599
|
+
onRequested(listener) {
|
|
600
|
+
return BridgeUtil.on(ContextMenuChannels.onRequested, listener);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* 执行菜单命令
|
|
604
|
+
* @param {XoMenu.ExecuteCommandRequest} request 请求
|
|
605
|
+
* @returns {Promise<boolean>}
|
|
606
|
+
*/
|
|
607
|
+
executeCommand = async (request) => {
|
|
608
|
+
const success = await BridgeUtil.invoke(ContextMenuChannels.executeCommand, request);
|
|
609
|
+
return success ?? false;
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
// src/shared/ipc/channels/dialog-channels.ts
|
|
614
|
+
var DialogChannels = class {
|
|
615
|
+
/** 打开文件 */
|
|
616
|
+
static openFile = IpcUtil.channel("BuiltIn:Dialog:openFile");
|
|
617
|
+
/** 打开目录 */
|
|
618
|
+
static openDir = IpcUtil.channel("BuiltIn:Dialog:openDir");
|
|
619
|
+
/** 保存文件 */
|
|
620
|
+
static saveFile = IpcUtil.channel("BuiltIn:Dialog:saveFile");
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// src/preload/bridges/dialog/dialog-bridge.ts
|
|
624
|
+
var DialogBridge = class extends BridgeAbstract {
|
|
625
|
+
/**
|
|
626
|
+
* 接口映射
|
|
627
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.dialog}</p>
|
|
628
|
+
* @returns {XoBridge.ApiMap}
|
|
629
|
+
*/
|
|
630
|
+
apiMap() {
|
|
631
|
+
return {
|
|
632
|
+
dialog: {
|
|
633
|
+
// 打开文件选择框
|
|
634
|
+
openFile: this.openFile.bind(this),
|
|
635
|
+
// 打开目录选择框
|
|
636
|
+
openDir: this.openDir.bind(this),
|
|
637
|
+
// 打开文件保存框
|
|
638
|
+
saveFile: this.saveFile.bind(this)
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* 打开文件选择框
|
|
644
|
+
* @returns {Promise<XoDialog.OpenResult>}
|
|
645
|
+
*/
|
|
646
|
+
openFile = async () => {
|
|
647
|
+
const openResult = await BridgeUtil.invoke(DialogChannels.openFile);
|
|
648
|
+
return openResult ?? { canceled: true, filePaths: [] };
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* 打开目录选择框
|
|
652
|
+
* @returns {Promise<XoDialog.OpenResult>}
|
|
653
|
+
*/
|
|
654
|
+
openDir = async () => {
|
|
655
|
+
const openResult = await BridgeUtil.invoke(DialogChannels.openDir);
|
|
656
|
+
return openResult ?? { canceled: true, filePaths: [] };
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* 打开文件保存框
|
|
660
|
+
* @returns {Promise<XoDialog.SaveResult>}
|
|
661
|
+
*/
|
|
662
|
+
saveFile = async () => {
|
|
663
|
+
const saveResult = await BridgeUtil.invoke(DialogChannels.saveFile);
|
|
664
|
+
return saveResult ?? { canceled: true, filePath: null };
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// src/shared/ipc/channels/file-channels.ts
|
|
669
|
+
var FileChannels = class {
|
|
670
|
+
/** 读取文本 */
|
|
671
|
+
static readText = IpcUtil.channel("BuiltIn:File:readText");
|
|
672
|
+
/** 写入文本 */
|
|
673
|
+
static writeText = IpcUtil.channel("BuiltIn:File:writeText");
|
|
674
|
+
/** 文件是否存在 */
|
|
675
|
+
static exists = IpcUtil.channel("BuiltIn:File:exists");
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// src/preload/bridges/file/file-bridge.ts
|
|
679
|
+
var FileBridge = class extends BridgeAbstract {
|
|
680
|
+
/**
|
|
681
|
+
* 接口映射
|
|
682
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.file}</p>
|
|
683
|
+
* @returns {XoBridge.ApiMap}
|
|
684
|
+
*/
|
|
685
|
+
apiMap() {
|
|
686
|
+
return {
|
|
687
|
+
file: {
|
|
688
|
+
// 读取文本文件
|
|
689
|
+
readText: this.readText.bind(this),
|
|
690
|
+
// 写入文本文件
|
|
691
|
+
writeText: this.writeText.bind(this),
|
|
692
|
+
// 文件是否存在
|
|
693
|
+
exists: this.exists.bind(this)
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* 读取文本文件
|
|
699
|
+
* @param {string} path 文件路径
|
|
700
|
+
* @returns {Promise<string>}
|
|
701
|
+
*/
|
|
702
|
+
readText = async (path) => {
|
|
703
|
+
const text = await BridgeUtil.invoke(FileChannels.readText, path);
|
|
704
|
+
return text ?? "";
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* 写入文本文件
|
|
708
|
+
* @param {string} path 文件路径
|
|
709
|
+
* @param {string} content 内容
|
|
710
|
+
* @returns {Promise<boolean>}
|
|
711
|
+
*/
|
|
712
|
+
writeText = async (path, content) => {
|
|
713
|
+
const request = { path, content };
|
|
714
|
+
const success = await BridgeUtil.invoke(FileChannels.writeText, request);
|
|
715
|
+
return success ?? false;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* 文件是否存在
|
|
719
|
+
* @param {string} path 文件路径
|
|
720
|
+
* @returns {Promise<boolean>}
|
|
721
|
+
*/
|
|
722
|
+
exists = async (path) => {
|
|
723
|
+
const exists = await BridgeUtil.invoke(FileChannels.exists, path);
|
|
724
|
+
return exists ?? false;
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// src/preload/bridges/ipc/ipc-bridge.ts
|
|
729
|
+
var IpcBridge = class extends BridgeAbstract {
|
|
730
|
+
/**
|
|
731
|
+
* 接口映射
|
|
732
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.ipc}</p>
|
|
733
|
+
* @returns {XoBridge.ApiMap}
|
|
734
|
+
*/
|
|
735
|
+
apiMap() {
|
|
736
|
+
return {
|
|
737
|
+
ipc: {
|
|
738
|
+
// 调用主进程方法
|
|
739
|
+
invoke: this.invoke.bind(this),
|
|
740
|
+
// 给主进程发送消息
|
|
741
|
+
send: this.send.bind(this),
|
|
742
|
+
// 监听主进程消息
|
|
743
|
+
on: this.on.bind(this),
|
|
744
|
+
// 单次监听主进程消息
|
|
745
|
+
once: this.once.bind(this)
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* 调用主进程方法(内置)
|
|
751
|
+
* @param {XoIpc.Channel} channel 通道
|
|
752
|
+
* @param {any} request 参数
|
|
753
|
+
* @returns {Promise<XoIpc.Result>}
|
|
754
|
+
*/
|
|
755
|
+
invoke = async (channel, request) => {
|
|
756
|
+
return await BridgeUtil.invokeResult(channel, request);
|
|
757
|
+
};
|
|
758
|
+
/**
|
|
759
|
+
* 给主进程发送消息(内置)
|
|
760
|
+
* @param {XoIpc.Channel} channel 通道
|
|
761
|
+
* @param {any} request 参数
|
|
762
|
+
*/
|
|
763
|
+
send = (channel, request) => {
|
|
764
|
+
BridgeUtil.send(channel, request);
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* 监听主进程消息(内置)
|
|
768
|
+
* <p>支持主动解除监听</p>
|
|
769
|
+
* <p>const off = window.xion.ipc.on(channel, listener); off()</p>
|
|
770
|
+
* @param {XoIpc.Channel} channel 通道
|
|
771
|
+
* @param {XoIpc.Listener} listener 监听器
|
|
772
|
+
* @returns {() => void}
|
|
773
|
+
*/
|
|
774
|
+
on = (channel, listener) => {
|
|
775
|
+
return BridgeUtil.on(channel, listener);
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* 单次监听主进程消息(内置)
|
|
779
|
+
* @param {XoIpc.Channel} channel 通道
|
|
780
|
+
* @param {XoIpc.Listener} listener 监听器
|
|
781
|
+
*/
|
|
782
|
+
once = (channel, listener) => {
|
|
783
|
+
BridgeUtil.once(channel, listener);
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// src/shared/ipc/channels/log-channels.ts
|
|
788
|
+
var LogChannels = class {
|
|
789
|
+
/** 写入 debug 日志 */
|
|
790
|
+
static debug = IpcUtil.channel("BuiltIn:Log:debug");
|
|
791
|
+
/** 写入 info 日志 */
|
|
792
|
+
static info = IpcUtil.channel("BuiltIn:Log:info");
|
|
793
|
+
/** 写入 warn 日志 */
|
|
794
|
+
static warn = IpcUtil.channel("BuiltIn:Log:warn");
|
|
795
|
+
/** 写入 error 日志 */
|
|
796
|
+
static error = IpcUtil.channel("BuiltIn:Log:error");
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
// src/shared/utils/log-util.ts
|
|
800
|
+
var MaxMessageLength = 16 * 1024;
|
|
801
|
+
var MaxValueLength = 8 * 1024;
|
|
802
|
+
var MaxDataItems = 100;
|
|
803
|
+
var MaxCollectionItems = 100;
|
|
804
|
+
var MaxDepth = 10;
|
|
805
|
+
var MaxNodes = 500;
|
|
806
|
+
var LogUtil = class _LogUtil {
|
|
807
|
+
/**
|
|
808
|
+
* 标准化渲染进程日志请求
|
|
809
|
+
* @param {unknown} message 日志消息
|
|
810
|
+
* @param {unknown} data 附加数据
|
|
811
|
+
* @returns {XoIpcLogger.Request}
|
|
812
|
+
*/
|
|
813
|
+
static normalizeRequest(message, data) {
|
|
814
|
+
const budget = { remaining: MaxNodes };
|
|
815
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
816
|
+
return {
|
|
817
|
+
message: _LogUtil.normalizeText(typeof message === "string" ? message : String(message ?? ""), MaxMessageLength),
|
|
818
|
+
data: (Array.isArray(data) ? data : []).slice(0, MaxDataItems).map((value) => _LogUtil.normalizeValue(value, 0, seen, budget))
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* 标准化日志值
|
|
823
|
+
* @param {unknown} value 原始值
|
|
824
|
+
* @param {number} depth 当前深度
|
|
825
|
+
* @param {WeakSet<object>} seen 已处理对象
|
|
826
|
+
* @param {NormalizeBudget} budget 处理预算
|
|
827
|
+
* @param {boolean} preserveNewlines 是否保留换行
|
|
828
|
+
* @returns {XoIpcLogger.Value}
|
|
829
|
+
* @private
|
|
830
|
+
*/
|
|
831
|
+
static normalizeValue(value, depth, seen, budget, preserveNewlines = false) {
|
|
832
|
+
if (budget.remaining <= 0) return "[Truncated]";
|
|
833
|
+
budget.remaining--;
|
|
834
|
+
if (value === null) return null;
|
|
835
|
+
if (typeof value === "string") return _LogUtil.normalizeText(value, MaxValueLength, preserveNewlines);
|
|
836
|
+
if (typeof value === "boolean") return value;
|
|
837
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
|
|
838
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
839
|
+
if (typeof value === "undefined") return "[undefined]";
|
|
840
|
+
if (typeof value === "symbol") return `[Symbol ${value.description ?? ""}]`;
|
|
841
|
+
if (typeof value === "function") return `[Function ${value.name || "anonymous"}]`;
|
|
842
|
+
if (value instanceof Date) {
|
|
843
|
+
return Number.isNaN(value.getTime()) ? "[Invalid Date]" : value.toISOString();
|
|
844
|
+
}
|
|
845
|
+
if (value instanceof Error) {
|
|
846
|
+
return {
|
|
847
|
+
name: _LogUtil.normalizeText(value.name, MaxValueLength),
|
|
848
|
+
message: _LogUtil.normalizeText(value.message, MaxValueLength),
|
|
849
|
+
stack: _LogUtil.normalizeText(value.stack ?? "", MaxValueLength, true)
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
if (depth >= MaxDepth) return "[Max Depth]";
|
|
853
|
+
if (seen.has(value)) return "[Circular]";
|
|
854
|
+
seen.add(value);
|
|
855
|
+
try {
|
|
856
|
+
if (Array.isArray(value)) {
|
|
857
|
+
return value.slice(0, MaxCollectionItems).map((item) => _LogUtil.normalizeValue(item, depth + 1, seen, budget));
|
|
858
|
+
}
|
|
859
|
+
return Object.fromEntries(
|
|
860
|
+
Object.entries(value).slice(0, MaxCollectionItems).map(([key, item]) => [
|
|
861
|
+
_LogUtil.normalizeText(key, 128),
|
|
862
|
+
_LogUtil.normalizeValue(item, depth + 1, seen, budget, key === "stack")
|
|
863
|
+
])
|
|
864
|
+
);
|
|
865
|
+
} catch {
|
|
866
|
+
return "[Unserializable Object]";
|
|
867
|
+
} finally {
|
|
868
|
+
seen.delete(value);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* 清理日志文本中的控制字符并限制长度
|
|
873
|
+
* @param {string} text 原始文本
|
|
874
|
+
* @param {number} maxLength 最大长度
|
|
875
|
+
* @param {boolean} preserveNewlines 是否保留换行
|
|
876
|
+
* @returns {string}
|
|
877
|
+
* @private
|
|
878
|
+
*/
|
|
879
|
+
static normalizeText(text, maxLength, preserveNewlines = false) {
|
|
880
|
+
const normalized = preserveNewlines ? text.replace(/\r\n?/g, "\n") : text.replace(/\r\n?|\n/g, "\\n");
|
|
881
|
+
return normalized.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, "").slice(0, maxLength);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/preload/bridges/log/log-bridge.ts
|
|
886
|
+
var LogBridge = class extends BridgeAbstract {
|
|
887
|
+
/**
|
|
888
|
+
* 接口映射
|
|
889
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.log}</p>
|
|
890
|
+
* @returns {XoBridge.ApiMap}
|
|
891
|
+
*/
|
|
892
|
+
apiMap() {
|
|
893
|
+
return {
|
|
894
|
+
log: {
|
|
895
|
+
debug: this.debug.bind(this),
|
|
896
|
+
info: this.info.bind(this),
|
|
897
|
+
warn: this.warn.bind(this),
|
|
898
|
+
error: this.error.bind(this)
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* 写入 debug 日志
|
|
904
|
+
* @param message 日志消息
|
|
905
|
+
* @param data 附加数据
|
|
906
|
+
* @returns {Promise<void>}
|
|
907
|
+
*/
|
|
908
|
+
debug = async (message, ...data) => {
|
|
909
|
+
await this.write(LogChannels.debug, message, data);
|
|
910
|
+
};
|
|
911
|
+
/**
|
|
912
|
+
* 写入 info 日志
|
|
913
|
+
* @param message 日志消息
|
|
914
|
+
* @param data 附加数据
|
|
915
|
+
* @returns {Promise<void>}
|
|
916
|
+
*/
|
|
917
|
+
info = async (message, ...data) => {
|
|
918
|
+
await this.write(LogChannels.info, message, data);
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* 写入 warn 日志
|
|
922
|
+
* @param message 日志消息
|
|
923
|
+
* @param data 附加数据
|
|
924
|
+
* @returns {Promise<void>}
|
|
925
|
+
*/
|
|
926
|
+
warn = async (message, ...data) => {
|
|
927
|
+
await this.write(LogChannels.warn, message, data);
|
|
928
|
+
};
|
|
929
|
+
/**
|
|
930
|
+
* 写入 error 日志
|
|
931
|
+
* @param message 日志消息
|
|
932
|
+
* @param data 附加数据
|
|
933
|
+
* @returns {Promise<void>}
|
|
934
|
+
*/
|
|
935
|
+
error = async (message, ...data) => {
|
|
936
|
+
await this.write(LogChannels.error, message, data);
|
|
937
|
+
};
|
|
938
|
+
/**
|
|
939
|
+
* 写入日志
|
|
940
|
+
* @param {XoIpc.Channel} channel 日志通道
|
|
941
|
+
* @param {string} message 日志消息
|
|
942
|
+
* @param {unknown[]} data 附加数据
|
|
943
|
+
* @returns {Promise<void>}
|
|
944
|
+
* @private
|
|
945
|
+
*/
|
|
946
|
+
async write(channel, message, data) {
|
|
947
|
+
try {
|
|
948
|
+
const request = LogUtil.normalizeRequest(message, data);
|
|
949
|
+
await BridgeUtil.invoke(channel, request);
|
|
950
|
+
} catch {
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// src/shared/ipc/channels/remote-service-channels.ts
|
|
956
|
+
var RemoteServiceChannels = class {
|
|
957
|
+
/** 获取远程服务状态 */
|
|
958
|
+
static getState = IpcUtil.channel("BuiltIn:RemoteService:getState");
|
|
959
|
+
/** 获取远程服务设置 */
|
|
960
|
+
static getSettings = IpcUtil.channel("BuiltIn:RemoteService:getSettings");
|
|
961
|
+
/** 设置远程服务用户设置 */
|
|
962
|
+
static setSettings = IpcUtil.channel("BuiltIn:RemoteService:setSettings");
|
|
963
|
+
/** 重置远程服务用户设置 */
|
|
964
|
+
static resetSettings = IpcUtil.channel("BuiltIn:RemoteService:resetSettings");
|
|
965
|
+
/** 请求远程服务 API */
|
|
966
|
+
static request = IpcUtil.channel("BuiltIn:RemoteService:request");
|
|
967
|
+
/* ------ 监听通道 ------ */
|
|
968
|
+
/** 监听远程服务状态 */
|
|
969
|
+
static onState = IpcUtil.channel("BuiltIn:RemoteService:onState");
|
|
970
|
+
/** 监听远程服务设置 */
|
|
971
|
+
static onSettings = IpcUtil.channel("BuiltIn:RemoteService:onSettings");
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
// src/preload/bridges/remote-service/remote-service-bridge.ts
|
|
975
|
+
var RemoteServiceBridge = class extends BridgeAbstract {
|
|
976
|
+
/**
|
|
977
|
+
* 接口映射
|
|
978
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.remoteService}</p>
|
|
979
|
+
* @returns {XoBridge.ApiMap}
|
|
980
|
+
*/
|
|
981
|
+
apiMap() {
|
|
982
|
+
return {
|
|
983
|
+
remoteService: {
|
|
984
|
+
// 获取远程服务状态
|
|
985
|
+
getState: this.getState.bind(this),
|
|
986
|
+
// 获取远程服务设置
|
|
987
|
+
getSettings: this.getSettings.bind(this),
|
|
988
|
+
// 设置远程服务用户设置
|
|
989
|
+
setSettings: this.setSettings.bind(this),
|
|
990
|
+
// 重置远程服务用户设置
|
|
991
|
+
resetSettings: this.resetSettings.bind(this),
|
|
992
|
+
// 请求远程服务 API
|
|
993
|
+
request: this.request.bind(this),
|
|
994
|
+
// 监听远程服务状态
|
|
995
|
+
onState: this.onState.bind(this),
|
|
996
|
+
// 监听远程服务设置
|
|
997
|
+
onSettings: this.onSettings.bind(this)
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* 获取远程服务状态
|
|
1003
|
+
* @returns {Promise<XoRemoteService.State>}
|
|
1004
|
+
*/
|
|
1005
|
+
getState = async () => {
|
|
1006
|
+
const state = await BridgeUtil.invoke(RemoteServiceChannels.getState);
|
|
1007
|
+
return state ?? {
|
|
1008
|
+
status: "idle",
|
|
1009
|
+
reconnectCount: 0
|
|
1010
|
+
};
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* 获取远程服务设置
|
|
1014
|
+
* @returns {Promise<XoRemoteService.EffectiveSettings>}
|
|
1015
|
+
*/
|
|
1016
|
+
getSettings = async () => {
|
|
1017
|
+
const settings = await BridgeUtil.invoke(RemoteServiceChannels.getSettings);
|
|
1018
|
+
return settings;
|
|
1019
|
+
};
|
|
1020
|
+
/**
|
|
1021
|
+
* 设置远程服务用户设置
|
|
1022
|
+
* @param {XoRemoteService.UserSettings} settings 远程服务用户设置
|
|
1023
|
+
* @returns {Promise<void>}
|
|
1024
|
+
*/
|
|
1025
|
+
setSettings = async (settings) => {
|
|
1026
|
+
await BridgeUtil.invoke(RemoteServiceChannels.setSettings, settings);
|
|
1027
|
+
};
|
|
1028
|
+
/**
|
|
1029
|
+
* 重置远程服务用户设置
|
|
1030
|
+
* @returns {Promise<void>}
|
|
1031
|
+
*/
|
|
1032
|
+
resetSettings = async () => {
|
|
1033
|
+
await BridgeUtil.invoke(RemoteServiceChannels.resetSettings);
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* 请求远程服务 API
|
|
1037
|
+
* @template T 响应数据类型
|
|
1038
|
+
* @param {XoRemoteService.Request} request 请求参数
|
|
1039
|
+
* @returns {Promise<XoRemoteService.Response<T>>}
|
|
1040
|
+
*/
|
|
1041
|
+
request = async (request) => {
|
|
1042
|
+
const response = await BridgeUtil.invoke(RemoteServiceChannels.request, request);
|
|
1043
|
+
return response;
|
|
1044
|
+
};
|
|
1045
|
+
/**
|
|
1046
|
+
* 监听远程服务状态
|
|
1047
|
+
* @param {XoRemoteService.StateListener} listener 监听器
|
|
1048
|
+
* @returns {() => void}
|
|
1049
|
+
*/
|
|
1050
|
+
onState = (listener) => {
|
|
1051
|
+
return BridgeUtil.on(RemoteServiceChannels.onState, listener);
|
|
1052
|
+
};
|
|
1053
|
+
/**
|
|
1054
|
+
* 监听远程服务设置
|
|
1055
|
+
* @param {XoRemoteService.SettingsListener} listener 监听器
|
|
1056
|
+
* @returns {() => void}
|
|
1057
|
+
*/
|
|
1058
|
+
onSettings = (listener) => {
|
|
1059
|
+
return BridgeUtil.on(RemoteServiceChannels.onSettings, listener);
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
// src/shared/ipc/channels/shell-channels.ts
|
|
1064
|
+
var ShellChannels = class {
|
|
1065
|
+
/** 使用系统默认程序打开路径 */
|
|
1066
|
+
static openPath = IpcUtil.channel("BuiltIn:Shell:openPath");
|
|
1067
|
+
/** 在文件管理器中显示路径 */
|
|
1068
|
+
static showItemInFolder = IpcUtil.channel("BuiltIn:Shell:showItemInFolder");
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
// src/preload/bridges/shell/shell-bridge.ts
|
|
1072
|
+
var ShellBridge = class extends BridgeAbstract {
|
|
1073
|
+
/**
|
|
1074
|
+
* 接口映射
|
|
1075
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.shell}</p>
|
|
1076
|
+
* @returns {XoBridge.ApiMap}
|
|
1077
|
+
*/
|
|
1078
|
+
apiMap() {
|
|
1079
|
+
return {
|
|
1080
|
+
shell: {
|
|
1081
|
+
// 使用系统默认程序打开路径
|
|
1082
|
+
openPath: this.openPath.bind(this),
|
|
1083
|
+
// 在文件管理器中显示路径
|
|
1084
|
+
showItemInFolder: this.showItemInFolder.bind(this)
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* 使用系统默认程序打开路径
|
|
1090
|
+
* @param {string} path 路径
|
|
1091
|
+
* @returns {Promise<void>}
|
|
1092
|
+
*/
|
|
1093
|
+
openPath = async (path) => {
|
|
1094
|
+
await BridgeUtil.invoke(ShellChannels.openPath, path);
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* 在文件管理器中显示路径
|
|
1098
|
+
* @param {string} path 路径
|
|
1099
|
+
* @returns {Promise<void>}
|
|
1100
|
+
*/
|
|
1101
|
+
showItemInFolder = async (path) => {
|
|
1102
|
+
await BridgeUtil.invoke(ShellChannels.showItemInFolder, path);
|
|
1103
|
+
};
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// src/shared/ipc/channels/theme-channels.ts
|
|
1107
|
+
var ThemeChannels = class {
|
|
1108
|
+
/** 获取主题状态 */
|
|
1109
|
+
static getState = IpcUtil.channel("BuiltIn:Theme:getState");
|
|
1110
|
+
/** 设置主题来源 */
|
|
1111
|
+
static setSource = IpcUtil.channel("BuiltIn:Theme:setSource");
|
|
1112
|
+
/* ------ 监听通道 ------ */
|
|
1113
|
+
/** 监听主题更新 */
|
|
1114
|
+
static onUpdate = IpcUtil.channel("BuiltIn:Theme:onUpdate");
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
// src/preload/bridges/theme/theme-bridge.ts
|
|
1118
|
+
var ThemeBridge = class extends BridgeAbstract {
|
|
1119
|
+
/**
|
|
1120
|
+
* 接口映射
|
|
1121
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.theme}</p>
|
|
1122
|
+
* @returns {XoBridge.ApiMap}
|
|
1123
|
+
*/
|
|
1124
|
+
apiMap() {
|
|
1125
|
+
return {
|
|
1126
|
+
theme: {
|
|
1127
|
+
// 获取主题状态
|
|
1128
|
+
getState: this.getState.bind(this),
|
|
1129
|
+
// 设置主题来源
|
|
1130
|
+
setSource: this.setSource.bind(this),
|
|
1131
|
+
// 监听主题更新
|
|
1132
|
+
onUpdated: this.onUpdated.bind(this)
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* 获取主题状态
|
|
1138
|
+
* @returns {Promise<XoTheme.State>}
|
|
1139
|
+
*/
|
|
1140
|
+
getState = async () => {
|
|
1141
|
+
const state = await BridgeUtil.invoke(ThemeChannels.getState);
|
|
1142
|
+
return state ?? {
|
|
1143
|
+
themeSource: "system",
|
|
1144
|
+
shouldUseDarkColors: false,
|
|
1145
|
+
titleBarOverlayEnabled: false,
|
|
1146
|
+
titleBarOverlay: {},
|
|
1147
|
+
titleBarOverlayBackground: void 0
|
|
1148
|
+
};
|
|
1149
|
+
};
|
|
1150
|
+
/**
|
|
1151
|
+
* 设置主题来源
|
|
1152
|
+
* @param {XoTheme.Source} themeSource 主题来源
|
|
1153
|
+
* @returns {Promise<void>}
|
|
1154
|
+
*/
|
|
1155
|
+
setSource = async (themeSource) => {
|
|
1156
|
+
await BridgeUtil.invoke(ThemeChannels.setSource, themeSource);
|
|
1157
|
+
};
|
|
1158
|
+
/**
|
|
1159
|
+
* 监听主题更新
|
|
1160
|
+
* @param {XoTheme.UpdatedListener} listener 监听器
|
|
1161
|
+
* @returns {() => void}
|
|
1162
|
+
*/
|
|
1163
|
+
onUpdated = (listener) => {
|
|
1164
|
+
return BridgeUtil.on(ThemeChannels.onUpdate, listener);
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
// src/shared/ipc/channels/updater-channels.ts
|
|
1169
|
+
var UpdaterChannels = class {
|
|
1170
|
+
/** 检查更新 */
|
|
1171
|
+
static checkForUpdates = IpcUtil.channel("BuiltIn:Updater:checkForUpdates");
|
|
1172
|
+
/** 下载更新 */
|
|
1173
|
+
static downloadUpdate = IpcUtil.channel("BuiltIn:Updater:downloadUpdate");
|
|
1174
|
+
/** 取消下载 */
|
|
1175
|
+
static cancelDownload = IpcUtil.channel("BuiltIn:Updater:cancelDownload");
|
|
1176
|
+
/** 退出并安装更新 */
|
|
1177
|
+
static quitAndInstall = IpcUtil.channel("BuiltIn:Updater:quitAndInstall");
|
|
1178
|
+
/** 获取更新器状态 */
|
|
1179
|
+
static getState = IpcUtil.channel("BuiltIn:Updater:getState");
|
|
1180
|
+
/** 获取更新器设置 */
|
|
1181
|
+
static getSettings = IpcUtil.channel("BuiltIn:Updater:getSettings");
|
|
1182
|
+
/** 设置更新器用户设置 */
|
|
1183
|
+
static setSettings = IpcUtil.channel("BuiltIn:Updater:setSettings");
|
|
1184
|
+
/** 重置更新器用户设置 */
|
|
1185
|
+
static resetSettings = IpcUtil.channel("BuiltIn:Updater:resetSettings");
|
|
1186
|
+
/* ------ 监听通道 ------ */
|
|
1187
|
+
/** 监听更新器状态 */
|
|
1188
|
+
static onState = IpcUtil.channel("BuiltIn:Updater:onState");
|
|
1189
|
+
/** 监听更新器设置 */
|
|
1190
|
+
static onSettings = IpcUtil.channel("BuiltIn:Updater:onSettings");
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
// src/preload/bridges/updater/updater-bridge.ts
|
|
1194
|
+
var UpdaterBridge = class extends BridgeAbstract {
|
|
1195
|
+
/**
|
|
1196
|
+
* 接口映射
|
|
1197
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.updater}</p>
|
|
1198
|
+
* @returns {XoBridge.ApiMap}
|
|
1199
|
+
*/
|
|
1200
|
+
apiMap() {
|
|
1201
|
+
return {
|
|
1202
|
+
updater: {
|
|
1203
|
+
// 检查更新
|
|
1204
|
+
checkForUpdates: this.checkForUpdates.bind(this),
|
|
1205
|
+
// 下载更新
|
|
1206
|
+
downloadUpdate: this.downloadUpdate.bind(this),
|
|
1207
|
+
// 取消下载
|
|
1208
|
+
cancelDownload: this.cancelDownload.bind(this),
|
|
1209
|
+
// 退出并安装更新
|
|
1210
|
+
quitAndInstall: this.quitAndInstall.bind(this),
|
|
1211
|
+
// 获取更新器状态
|
|
1212
|
+
getState: this.getState.bind(this),
|
|
1213
|
+
// 获取更新器设置
|
|
1214
|
+
getSettings: this.getSettings.bind(this),
|
|
1215
|
+
// 设置更新器用户设置
|
|
1216
|
+
setSettings: this.setSettings.bind(this),
|
|
1217
|
+
// 重置更新器用户设置
|
|
1218
|
+
resetSettings: this.resetSettings.bind(this),
|
|
1219
|
+
// 监听更新器状态
|
|
1220
|
+
onState: this.onState.bind(this),
|
|
1221
|
+
// 监听更新器设置
|
|
1222
|
+
onSettings: this.onSettings.bind(this)
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* 检查更新
|
|
1228
|
+
* @returns {Promise<void>}
|
|
1229
|
+
*/
|
|
1230
|
+
checkForUpdates = async () => {
|
|
1231
|
+
await BridgeUtil.invoke(UpdaterChannels.checkForUpdates);
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* 下载更新
|
|
1235
|
+
* @returns {Promise<void>}
|
|
1236
|
+
*/
|
|
1237
|
+
downloadUpdate = async () => {
|
|
1238
|
+
await BridgeUtil.invoke(UpdaterChannels.downloadUpdate);
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* 取消下载
|
|
1242
|
+
* @returns {Promise<boolean>}
|
|
1243
|
+
*/
|
|
1244
|
+
cancelDownload = async () => {
|
|
1245
|
+
const cancelled = await BridgeUtil.invoke(UpdaterChannels.cancelDownload);
|
|
1246
|
+
return cancelled ?? false;
|
|
1247
|
+
};
|
|
1248
|
+
/**
|
|
1249
|
+
* 退出并安装更新
|
|
1250
|
+
* @returns {Promise<void>}
|
|
1251
|
+
*/
|
|
1252
|
+
quitAndInstall = async () => {
|
|
1253
|
+
await BridgeUtil.invoke(UpdaterChannels.quitAndInstall);
|
|
1254
|
+
};
|
|
1255
|
+
/**
|
|
1256
|
+
* 获取更新器状态
|
|
1257
|
+
* @returns {Promise<XoUpdater.State>}
|
|
1258
|
+
*/
|
|
1259
|
+
getState = async () => {
|
|
1260
|
+
const state = await BridgeUtil.invoke(UpdaterChannels.getState);
|
|
1261
|
+
return state ?? {
|
|
1262
|
+
status: "idle",
|
|
1263
|
+
downloadCancellationCount: 0,
|
|
1264
|
+
disabledUntilRestart: false
|
|
1265
|
+
};
|
|
1266
|
+
};
|
|
1267
|
+
/**
|
|
1268
|
+
* 获取更新器设置
|
|
1269
|
+
* @returns {Promise<XoUpdater.EffectiveSettings>}
|
|
1270
|
+
*/
|
|
1271
|
+
getSettings = async () => {
|
|
1272
|
+
const settings = await BridgeUtil.invoke(UpdaterChannels.getSettings);
|
|
1273
|
+
return settings;
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* 设置更新器用户设置
|
|
1277
|
+
* @param {XoUpdater.UserSettings} settings 更新器用户设置
|
|
1278
|
+
*/
|
|
1279
|
+
setSettings = async (settings) => {
|
|
1280
|
+
await BridgeUtil.invoke(UpdaterChannels.setSettings, settings);
|
|
1281
|
+
};
|
|
1282
|
+
/**
|
|
1283
|
+
* 重置更新器用户设置
|
|
1284
|
+
*/
|
|
1285
|
+
resetSettings = async () => {
|
|
1286
|
+
await BridgeUtil.invoke(UpdaterChannels.resetSettings);
|
|
1287
|
+
};
|
|
1288
|
+
/**
|
|
1289
|
+
* 监听更新器状态
|
|
1290
|
+
* @param {XoUpdater.UpdatedListener} listener 监听器
|
|
1291
|
+
* @returns {() => void}
|
|
1292
|
+
*/
|
|
1293
|
+
onState = (listener) => {
|
|
1294
|
+
return BridgeUtil.on(UpdaterChannels.onState, listener);
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* 监听更新器设置
|
|
1298
|
+
* @param {XoUpdater.SettingsUpdatedListener} listener 监听器
|
|
1299
|
+
* @returns {() => void}
|
|
1300
|
+
*/
|
|
1301
|
+
onSettings = (listener) => {
|
|
1302
|
+
return BridgeUtil.on(UpdaterChannels.onSettings, listener);
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
// src/preload/bridges/window/internal/route-redirect-buffer.ts
|
|
1307
|
+
var RouteRedirectBuffer = class {
|
|
1308
|
+
/** Renderer 是否已完成初始化 */
|
|
1309
|
+
rendererReady = false;
|
|
1310
|
+
/** Renderer 路由重定向监听器 */
|
|
1311
|
+
listener;
|
|
1312
|
+
/** 等待分发的路由重定向请求 */
|
|
1313
|
+
pendingRequests = [];
|
|
1314
|
+
/**
|
|
1315
|
+
* 接收路由重定向请求
|
|
1316
|
+
* @param {XoWindow.RouteRedirectRequest} request 路由重定向请求
|
|
1317
|
+
* @returns {void}
|
|
1318
|
+
*/
|
|
1319
|
+
receive(request) {
|
|
1320
|
+
if (!this.rendererReady || !this.listener) {
|
|
1321
|
+
this.pendingRequests.push(request);
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
this.listener(request);
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* 设置 Renderer 路由重定向监听器
|
|
1328
|
+
* @param {XoWindow.RouteRedirectListener} listener 路由重定向监听器
|
|
1329
|
+
* @returns {() => void}
|
|
1330
|
+
*/
|
|
1331
|
+
setListener(listener) {
|
|
1332
|
+
this.listener = listener;
|
|
1333
|
+
this.flush();
|
|
1334
|
+
return () => {
|
|
1335
|
+
if (this.listener === listener) {
|
|
1336
|
+
this.listener = void 0;
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* 标记 Renderer 已完成初始化
|
|
1342
|
+
* @returns {void}
|
|
1343
|
+
*/
|
|
1344
|
+
setReady() {
|
|
1345
|
+
this.rendererReady = true;
|
|
1346
|
+
this.flush();
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* 分发等待中的路由重定向请求
|
|
1350
|
+
* @returns {void}
|
|
1351
|
+
* @private
|
|
1352
|
+
*/
|
|
1353
|
+
flush() {
|
|
1354
|
+
const listener = this.listener;
|
|
1355
|
+
if (!this.rendererReady || !listener) {
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
for (const request of this.pendingRequests.splice(0)) {
|
|
1359
|
+
listener(request);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
// src/shared/ipc/channels/window-channels.ts
|
|
1365
|
+
var WindowChannels = class {
|
|
1366
|
+
/** 渲染进程首屏渲染完成 */
|
|
1367
|
+
static ready = IpcUtil.channel("BuiltIn:Window:ready");
|
|
1368
|
+
/** 是否等待 Renderer 渲染完成后再显示窗口 */
|
|
1369
|
+
static shouldShowAfterRendererReady = IpcUtil.channel("BuiltIn:Window:shouldShowAfterRendererReady");
|
|
1370
|
+
/** 获取窗口状态 */
|
|
1371
|
+
static getState = IpcUtil.channel("BuiltIn:Window:getState");
|
|
1372
|
+
/** 获取当前已打开窗口标识 */
|
|
1373
|
+
static getOpenedWindowIdentities = IpcUtil.channel("BuiltIn:Window:getOpenedWindowIdentities");
|
|
1374
|
+
/** 最小化窗口 */
|
|
1375
|
+
static minimize = IpcUtil.channel("BuiltIn:Window:minimize");
|
|
1376
|
+
/** 最大化窗口 */
|
|
1377
|
+
static maximize = IpcUtil.channel("BuiltIn:Window:maximize");
|
|
1378
|
+
/** 是否已最大化 */
|
|
1379
|
+
static isMaximized = IpcUtil.channel("BuiltIn:Window:isMaximized");
|
|
1380
|
+
/** 取消最大化窗口 */
|
|
1381
|
+
static unmaximize = IpcUtil.channel("BuiltIn:Window:unmaximize");
|
|
1382
|
+
/** 全屏窗口 */
|
|
1383
|
+
static fullScreen = IpcUtil.channel("BuiltIn:Window:fullScreen");
|
|
1384
|
+
/** 退出全屏窗口 */
|
|
1385
|
+
static exitFullScreen = IpcUtil.channel("BuiltIn:Window:exitFullScreen");
|
|
1386
|
+
/** 重新加载窗口 */
|
|
1387
|
+
static reload = IpcUtil.channel("BuiltIn:Window:reload");
|
|
1388
|
+
/** 居中窗口 */
|
|
1389
|
+
static center = IpcUtil.channel("BuiltIn:Window:center");
|
|
1390
|
+
/** 隐藏窗口 */
|
|
1391
|
+
static hide = IpcUtil.channel("BuiltIn:Window:hide");
|
|
1392
|
+
/** 还原窗口 */
|
|
1393
|
+
static restore = IpcUtil.channel("BuiltIn:Window:restore");
|
|
1394
|
+
/** 切换窗口置顶 */
|
|
1395
|
+
static toggleAlwaysOnTop = IpcUtil.channel("BuiltIn:Window:toggleAlwaysOnTop");
|
|
1396
|
+
/** 切换侧边栏折叠 */
|
|
1397
|
+
static toggleSidebarFold = IpcUtil.channel("BuiltIn:Window:toggleSidebarFold");
|
|
1398
|
+
/** 关闭窗口 */
|
|
1399
|
+
static close = IpcUtil.channel("BuiltIn:Window:close");
|
|
1400
|
+
/* ------ 监听通道 ------ */
|
|
1401
|
+
/** 监听窗口状态 */
|
|
1402
|
+
static onState = IpcUtil.channel("BuiltIn:Window:onState");
|
|
1403
|
+
/** 监听路由重定向 */
|
|
1404
|
+
static onRouteRedirect = IpcUtil.channel("BuiltIn:Window:onRouteRedirect");
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
// src/preload/bridges/window/window-bridge.ts
|
|
1408
|
+
var WindowBridge = class extends BridgeAbstract {
|
|
1409
|
+
/** 路由重定向请求缓冲器 */
|
|
1410
|
+
routeRedirectBuffer = new RouteRedirectBuffer();
|
|
1411
|
+
/**
|
|
1412
|
+
* 构造函数
|
|
1413
|
+
*/
|
|
1414
|
+
constructor() {
|
|
1415
|
+
super();
|
|
1416
|
+
BridgeUtil.on(WindowChannels.onRouteRedirect, (request) => this.routeRedirectBuffer.receive(request));
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* 接口映射
|
|
1420
|
+
* <p>渲染进程声明文件 {@link XoBridgeApi.Map.window}</p>
|
|
1421
|
+
* @returns {XoBridge.ApiMap}
|
|
1422
|
+
*/
|
|
1423
|
+
apiMap() {
|
|
1424
|
+
return {
|
|
1425
|
+
window: {
|
|
1426
|
+
// 通知主进程渲染进程首屏渲染完成
|
|
1427
|
+
ready: this.ready.bind(this),
|
|
1428
|
+
// 是否等待 Renderer 渲染完成后再显示窗口
|
|
1429
|
+
shouldShowAfterRendererReady: this.shouldShowAfterRendererReady.bind(this),
|
|
1430
|
+
// 获取窗口状态
|
|
1431
|
+
getState: this.getState.bind(this),
|
|
1432
|
+
// 获取当前已打开窗口标识
|
|
1433
|
+
getOpenedWindowIdentities: this.getOpenedWindowIdentities.bind(this),
|
|
1434
|
+
// 最小化窗口
|
|
1435
|
+
minimize: this.minimize.bind(this),
|
|
1436
|
+
// 最大化窗口
|
|
1437
|
+
maximize: this.maximize.bind(this),
|
|
1438
|
+
// 是否已最大化
|
|
1439
|
+
isMaximized: this.isMaximized.bind(this),
|
|
1440
|
+
// 取消最大化窗口
|
|
1441
|
+
unmaximize: this.unmaximize.bind(this),
|
|
1442
|
+
// 全屏窗口
|
|
1443
|
+
fullScreen: this.fullScreen.bind(this),
|
|
1444
|
+
// 退出全屏窗口
|
|
1445
|
+
exitFullScreen: this.exitFullScreen.bind(this),
|
|
1446
|
+
// 重新加载窗口
|
|
1447
|
+
reload: this.reload.bind(this),
|
|
1448
|
+
// 居中窗口
|
|
1449
|
+
center: this.center.bind(this),
|
|
1450
|
+
// 隐藏窗口
|
|
1451
|
+
hide: this.hide.bind(this),
|
|
1452
|
+
// 还原窗口
|
|
1453
|
+
restore: this.restore.bind(this),
|
|
1454
|
+
// 切换窗口置顶
|
|
1455
|
+
toggleAlwaysOnTop: this.toggleAlwaysOnTop.bind(this),
|
|
1456
|
+
// 切换侧边栏折叠
|
|
1457
|
+
toggleSidebarFold: this.toggleSidebarFold.bind(this),
|
|
1458
|
+
// 关闭窗口
|
|
1459
|
+
close: this.close.bind(this),
|
|
1460
|
+
// 监听窗口状态
|
|
1461
|
+
onState: this.onState.bind(this),
|
|
1462
|
+
// 监听路由重定向
|
|
1463
|
+
onRouteRedirect: this.onRouteRedirect.bind(this)
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* 通知主进程渲染进程首屏渲染完成
|
|
1469
|
+
* @returns {Promise<void>}
|
|
1470
|
+
*/
|
|
1471
|
+
ready = async () => {
|
|
1472
|
+
this.routeRedirectBuffer.setReady();
|
|
1473
|
+
await BridgeUtil.invoke(WindowChannels.ready);
|
|
1474
|
+
};
|
|
1475
|
+
/**
|
|
1476
|
+
* 是否等待 Renderer 渲染完成后再显示窗口
|
|
1477
|
+
* @returns {Promise<boolean>}
|
|
1478
|
+
*/
|
|
1479
|
+
shouldShowAfterRendererReady = async () => {
|
|
1480
|
+
const enabled = await BridgeUtil.invoke(WindowChannels.shouldShowAfterRendererReady);
|
|
1481
|
+
return enabled ?? true;
|
|
1482
|
+
};
|
|
1483
|
+
/**
|
|
1484
|
+
* 获取窗口状态
|
|
1485
|
+
* @returns {Promise<XoWindow.State>}
|
|
1486
|
+
*/
|
|
1487
|
+
getState = async () => {
|
|
1488
|
+
const state = await BridgeUtil.invoke(WindowChannels.getState);
|
|
1489
|
+
return state ?? {
|
|
1490
|
+
isSidebarFolded: false,
|
|
1491
|
+
isAlwaysOnTop: false,
|
|
1492
|
+
isMaximized: false,
|
|
1493
|
+
isFullScreen: false,
|
|
1494
|
+
isMinimized: false,
|
|
1495
|
+
isFullScreenable: false,
|
|
1496
|
+
isMinimizable: false,
|
|
1497
|
+
isMaximizable: false,
|
|
1498
|
+
isClosable: false
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1501
|
+
/**
|
|
1502
|
+
* 获取当前已打开窗口标识
|
|
1503
|
+
* @returns {Promise<XoWindow.Identity[]>}
|
|
1504
|
+
*/
|
|
1505
|
+
getOpenedWindowIdentities = async () => {
|
|
1506
|
+
return await BridgeUtil.invoke(WindowChannels.getOpenedWindowIdentities) ?? [];
|
|
1507
|
+
};
|
|
1508
|
+
/**
|
|
1509
|
+
* 最小化窗口
|
|
1510
|
+
* @returns {Promise<void>}
|
|
1511
|
+
*/
|
|
1512
|
+
minimize = async () => {
|
|
1513
|
+
await BridgeUtil.invoke(WindowChannels.minimize);
|
|
1514
|
+
};
|
|
1515
|
+
/**
|
|
1516
|
+
* 最大化窗口
|
|
1517
|
+
* @returns {Promise<void>}
|
|
1518
|
+
*/
|
|
1519
|
+
maximize = async () => {
|
|
1520
|
+
await BridgeUtil.invoke(WindowChannels.maximize);
|
|
1521
|
+
};
|
|
1522
|
+
/**
|
|
1523
|
+
* 是否已最大化
|
|
1524
|
+
* @returns {Promise<boolean>}
|
|
1525
|
+
*/
|
|
1526
|
+
isMaximized = async () => {
|
|
1527
|
+
const maximized = await BridgeUtil.invoke(WindowChannels.isMaximized);
|
|
1528
|
+
return maximized ?? false;
|
|
1529
|
+
};
|
|
1530
|
+
/**
|
|
1531
|
+
* 取消最大化窗口
|
|
1532
|
+
* @returns {Promise<void>}
|
|
1533
|
+
*/
|
|
1534
|
+
unmaximize = async () => {
|
|
1535
|
+
await BridgeUtil.invoke(WindowChannels.unmaximize);
|
|
1536
|
+
};
|
|
1537
|
+
/**
|
|
1538
|
+
* 全屏窗口
|
|
1539
|
+
* @returns {Promise<void>}
|
|
1540
|
+
*/
|
|
1541
|
+
fullScreen = async () => {
|
|
1542
|
+
await BridgeUtil.invoke(WindowChannels.fullScreen);
|
|
1543
|
+
};
|
|
1544
|
+
/**
|
|
1545
|
+
* 退出全屏窗口
|
|
1546
|
+
* @returns {Promise<void>}
|
|
1547
|
+
*/
|
|
1548
|
+
exitFullScreen = async () => {
|
|
1549
|
+
await BridgeUtil.invoke(WindowChannels.exitFullScreen);
|
|
1550
|
+
};
|
|
1551
|
+
/**
|
|
1552
|
+
* 重新加载窗口
|
|
1553
|
+
* @returns {Promise<void>}
|
|
1554
|
+
*/
|
|
1555
|
+
reload = async () => {
|
|
1556
|
+
await BridgeUtil.invoke(WindowChannels.reload);
|
|
1557
|
+
};
|
|
1558
|
+
/**
|
|
1559
|
+
* 居中窗口
|
|
1560
|
+
* @returns {Promise<void>}
|
|
1561
|
+
*/
|
|
1562
|
+
center = async () => {
|
|
1563
|
+
await BridgeUtil.invoke(WindowChannels.center);
|
|
1564
|
+
};
|
|
1565
|
+
/**
|
|
1566
|
+
* 隐藏窗口
|
|
1567
|
+
* @returns {Promise<void>}
|
|
1568
|
+
*/
|
|
1569
|
+
hide = async () => {
|
|
1570
|
+
await BridgeUtil.invoke(WindowChannels.hide);
|
|
1571
|
+
};
|
|
1572
|
+
/**
|
|
1573
|
+
* 还原窗口
|
|
1574
|
+
* @returns {Promise<void>}
|
|
1575
|
+
*/
|
|
1576
|
+
restore = async () => {
|
|
1577
|
+
await BridgeUtil.invoke(WindowChannels.restore);
|
|
1578
|
+
};
|
|
1579
|
+
/**
|
|
1580
|
+
* 切换窗口置顶
|
|
1581
|
+
* @returns {Promise<void>}
|
|
1582
|
+
*/
|
|
1583
|
+
toggleAlwaysOnTop = async () => {
|
|
1584
|
+
await BridgeUtil.invoke(WindowChannels.toggleAlwaysOnTop);
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* 切换侧边栏折叠
|
|
1588
|
+
* @returns {Promise<void>}
|
|
1589
|
+
*/
|
|
1590
|
+
toggleSidebarFold = async () => {
|
|
1591
|
+
await BridgeUtil.invoke(WindowChannels.toggleSidebarFold);
|
|
1592
|
+
};
|
|
1593
|
+
/**
|
|
1594
|
+
* 关闭窗口
|
|
1595
|
+
* @returns {Promise<void>}
|
|
1596
|
+
*/
|
|
1597
|
+
close = async () => {
|
|
1598
|
+
await BridgeUtil.invoke(WindowChannels.close);
|
|
1599
|
+
};
|
|
1600
|
+
/**
|
|
1601
|
+
* 监听窗口状态
|
|
1602
|
+
* @param {XoWindow.StateListener} listener 监听器
|
|
1603
|
+
* @returns {() => void}
|
|
1604
|
+
*/
|
|
1605
|
+
onState = (listener) => {
|
|
1606
|
+
return BridgeUtil.on(WindowChannels.onState, listener);
|
|
1607
|
+
};
|
|
1608
|
+
/**
|
|
1609
|
+
* 监听路由重定向
|
|
1610
|
+
* @param {XoWindow.RouteRedirectListener} listener 监听器
|
|
1611
|
+
* @returns {() => void}
|
|
1612
|
+
*/
|
|
1613
|
+
onRouteRedirect = (listener) => {
|
|
1614
|
+
return this.routeRedirectBuffer.setListener(listener);
|
|
1615
|
+
};
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
// src/shared/app/consts/xion-name.ts
|
|
1619
|
+
var XionName = "Xion";
|
|
1620
|
+
|
|
1621
|
+
// src/preload/bridge/bridge.ts
|
|
1622
|
+
var import_electron2 = require("electron");
|
|
1623
|
+
var Bridge = class _Bridge {
|
|
1624
|
+
/**
|
|
1625
|
+
* 是否已安装(window.xion)
|
|
1626
|
+
* @type {boolean}
|
|
1627
|
+
* @private
|
|
1628
|
+
*/
|
|
1629
|
+
static installed = false;
|
|
1630
|
+
/**
|
|
1631
|
+
* 已安装接口名称
|
|
1632
|
+
* @type {Set<string>}
|
|
1633
|
+
* @private
|
|
1634
|
+
*/
|
|
1635
|
+
static installedApiKeys = /* @__PURE__ */ new Set();
|
|
1636
|
+
/**
|
|
1637
|
+
* 安装桥接器(接口挂载到 window.xion 上)
|
|
1638
|
+
* <p>仅允许执行一次</p>
|
|
1639
|
+
* @param {(new () => BridgeAbstract)[]} bridges 桥接器实现列表
|
|
1640
|
+
*/
|
|
1641
|
+
static install(bridges) {
|
|
1642
|
+
if (_Bridge.installed) {
|
|
1643
|
+
throw new Error("Bridge \u91CD\u590D\u5B89\u88C5");
|
|
1644
|
+
}
|
|
1645
|
+
_Bridge.installed = true;
|
|
1646
|
+
_Bridge.customInstall(XionName.toLowerCase(), bridges);
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* 自定义安装(接口挂载到 window.[apiKey] 上)
|
|
1650
|
+
* <p>可以多次执行,但同一 apiKey 仅能安装一次</p>
|
|
1651
|
+
* @param {string} apiKey 接口名称
|
|
1652
|
+
* @param {(new () => BridgeAbstract)[]} bridges 桥接器实现列表
|
|
1653
|
+
*/
|
|
1654
|
+
static customInstall(apiKey, bridges) {
|
|
1655
|
+
if (_Bridge.installedApiKeys.has(apiKey)) {
|
|
1656
|
+
throw new Error(`Bridge \u63A5\u53E3\u91CD\u590D\u5B89\u88C5: ${apiKey}`);
|
|
1657
|
+
}
|
|
1658
|
+
const builtInBridges = apiKey === XionName.toLowerCase() ? [
|
|
1659
|
+
// APP 桥接器
|
|
1660
|
+
AppBridge,
|
|
1661
|
+
// JWT 认证桥接器
|
|
1662
|
+
AuthBridge,
|
|
1663
|
+
// 对话框桥接器
|
|
1664
|
+
DialogBridge,
|
|
1665
|
+
// 剪切板桥接器
|
|
1666
|
+
ClipboardBridge,
|
|
1667
|
+
// 文件桥接器
|
|
1668
|
+
FileBridge,
|
|
1669
|
+
// 主题桥接器
|
|
1670
|
+
ThemeBridge,
|
|
1671
|
+
// Shell 桥接器
|
|
1672
|
+
ShellBridge,
|
|
1673
|
+
// IPC 桥接器
|
|
1674
|
+
IpcBridge,
|
|
1675
|
+
// 日志桥接器
|
|
1676
|
+
LogBridge,
|
|
1677
|
+
// 上下文菜单桥接器
|
|
1678
|
+
ContextMenuBridge,
|
|
1679
|
+
// 窗口桥接器
|
|
1680
|
+
WindowBridge,
|
|
1681
|
+
// 更新器桥接器
|
|
1682
|
+
UpdaterBridge,
|
|
1683
|
+
// 远程服务桥接器
|
|
1684
|
+
RemoteServiceBridge
|
|
1685
|
+
] : [];
|
|
1686
|
+
const bridgeList = [
|
|
1687
|
+
// 内置桥接器
|
|
1688
|
+
...builtInBridges,
|
|
1689
|
+
// 自定义桥接器
|
|
1690
|
+
...bridges ?? []
|
|
1691
|
+
];
|
|
1692
|
+
const apis = {};
|
|
1693
|
+
for (let bridge of bridgeList) {
|
|
1694
|
+
const apiBridge = new bridge();
|
|
1695
|
+
const apiMap = apiBridge.apiMap();
|
|
1696
|
+
for (let key in apiMap) {
|
|
1697
|
+
apis[key] = apiMap[key];
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
import_electron2.contextBridge.exposeInMainWorld(apiKey, apis);
|
|
1701
|
+
_Bridge.installedApiKeys.add(apiKey);
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
|
|
1705
|
+
// src/preload/bridge/preload.internal.ts
|
|
1706
|
+
Bridge.install();
|