@quicktvui/ai 1.0.6 → 1.0.7
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/package.json +1 -1
- package/rules/.clinerules +3 -2
- package/rules/.cursorrules +3 -2
- package/rules/.github/copilot-instructions.md +3 -2
- package/rules/.source/ESADPlayer/package.json +24 -0
- package/rules/.source/ESADPlayer/rollup.config.js +33 -0
- package/rules/.source/ESADPlayer/src/component/ESADPlayerViewComponent.ts +466 -0
- package/rules/.source/ESADPlayer/src/core/ESADType.ts +6 -0
- package/rules/.source/ESADPlayer/src/index.ts +18 -0
- package/rules/.source/ESADPlayer/src/index.vue +963 -0
- package/rules/.source/ESADPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESADPlayer/tsconfig.json +34 -0
- package/rules/.source/ESAudioPlayer/package.json +23 -0
- package/rules/.source/ESAudioPlayer/rollup.config.js +33 -0
- package/rules/.source/ESAudioPlayer/src/index.ts +10 -0
- package/rules/.source/ESAudioPlayer/src/index.vue +1441 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayer.ts +169 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.android.ts +134 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.harmony.ts +139 -0
- package/rules/.source/ESAudioPlayer/src/module/ESAudioPlayerModule.ts +44 -0
- package/rules/.source/ESAudioPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESAudioPlayer/src/utils/ESAudioPlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESAudioPlayer/tsconfig.json +34 -0
- package/rules/.source/ESAudioServicePlayer/package.json +23 -0
- package/rules/.source/ESAudioServicePlayer/rollup.config.js +33 -0
- package/rules/.source/ESAudioServicePlayer/src/index.ts +10 -0
- package/rules/.source/ESAudioServicePlayer/src/index.vue +1400 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayer.ts +189 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.android.ts +155 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.harmony.ts +163 -0
- package/rules/.source/ESAudioServicePlayer/src/module/ESAudioServicePlayerModule.ts +50 -0
- package/rules/.source/ESAudioServicePlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESAudioServicePlayer/src/utils/ESAudioServicePlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESAudioServicePlayer/tsconfig.json +34 -0
- package/rules/.source/ESAxios/CHANGELOG.md +1072 -0
- package/rules/.source/ESAxios/LICENSE +7 -0
- package/rules/.source/ESAxios/MIGRATION_GUIDE.md +3 -0
- package/rules/.source/ESAxios/README.md +1673 -0
- package/rules/.source/ESAxios/index.d.cts +549 -0
- package/rules/.source/ESAxios/index.d.ts +766 -0
- package/rules/.source/ESAxios/index.js +43 -0
- package/rules/.source/ESAxios/lib/adapters/README.md +37 -0
- package/rules/.source/ESAxios/lib/adapters/adapters.js +80 -0
- package/rules/.source/ESAxios/lib/adapters/fetch.js +295 -0
- package/rules/.source/ESAxios/lib/axios.js +90 -0
- package/rules/.source/ESAxios/lib/cancel/CancelToken.js +135 -0
- package/rules/.source/ESAxios/lib/cancel/CanceledError.js +31 -0
- package/rules/.source/ESAxios/lib/cancel/isCancel.js +5 -0
- package/rules/.source/ESAxios/lib/core/Axios.js +292 -0
- package/rules/.source/ESAxios/lib/core/AxiosError.js +108 -0
- package/rules/.source/ESAxios/lib/core/AxiosHeaders.js +340 -0
- package/rules/.source/ESAxios/lib/core/InterceptorManager.js +71 -0
- package/rules/.source/ESAxios/lib/core/README.md +8 -0
- package/rules/.source/ESAxios/lib/core/buildFullPath.js +26 -0
- package/rules/.source/ESAxios/lib/core/dispatchRequest.js +81 -0
- package/rules/.source/ESAxios/lib/core/mergeConfig.js +112 -0
- package/rules/.source/ESAxios/lib/core/settle.js +31 -0
- package/rules/.source/ESAxios/lib/core/transformData.js +33 -0
- package/rules/.source/ESAxios/lib/defaults/index.js +182 -0
- package/rules/.source/ESAxios/lib/defaults/transitional.js +7 -0
- package/rules/.source/ESAxios/lib/env/README.md +3 -0
- package/rules/.source/ESAxios/lib/env/classes/FormData.js +2 -0
- package/rules/.source/ESAxios/lib/env/data.js +1 -0
- package/rules/.source/ESAxios/lib/helpers/AxiosTransformStream.js +160 -0
- package/rules/.source/ESAxios/lib/helpers/AxiosURLSearchParams.js +65 -0
- package/rules/.source/ESAxios/lib/helpers/HttpStatusCode.js +71 -0
- package/rules/.source/ESAxios/lib/helpers/README.md +7 -0
- package/rules/.source/ESAxios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
- package/rules/.source/ESAxios/lib/helpers/bind.js +7 -0
- package/rules/.source/ESAxios/lib/helpers/buildURL.js +69 -0
- package/rules/.source/ESAxios/lib/helpers/callbackify.js +18 -0
- package/rules/.source/ESAxios/lib/helpers/combineURLs.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/composeSignals.js +61 -0
- package/rules/.source/ESAxios/lib/helpers/cookies.js +40 -0
- package/rules/.source/ESAxios/lib/helpers/deprecatedMethod.js +31 -0
- package/rules/.source/ESAxios/lib/helpers/formDataToJSON.js +95 -0
- package/rules/.source/ESAxios/lib/helpers/formDataToStream.js +122 -0
- package/rules/.source/ESAxios/lib/helpers/fromDataURI.js +62 -0
- package/rules/.source/ESAxios/lib/helpers/isAbsoluteURL.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/isAxiosError.js +14 -0
- package/rules/.source/ESAxios/lib/helpers/isURLSameOrigin.js +17 -0
- package/rules/.source/ESAxios/lib/helpers/null.js +2 -0
- package/rules/.source/ESAxios/lib/helpers/parseHeaders.js +69 -0
- package/rules/.source/ESAxios/lib/helpers/parseProtocol.js +6 -0
- package/rules/.source/ESAxios/lib/helpers/progressEventReducer.js +51 -0
- package/rules/.source/ESAxios/lib/helpers/readBlob.js +15 -0
- package/rules/.source/ESAxios/lib/helpers/resolveConfig.js +83 -0
- package/rules/.source/ESAxios/lib/helpers/speedometer.js +55 -0
- package/rules/.source/ESAxios/lib/helpers/spread.js +28 -0
- package/rules/.source/ESAxios/lib/helpers/throttle.js +44 -0
- package/rules/.source/ESAxios/lib/helpers/toFormData.js +241 -0
- package/rules/.source/ESAxios/lib/helpers/toURLEncodedForm.js +25 -0
- package/rules/.source/ESAxios/lib/helpers/trackStream.js +89 -0
- package/rules/.source/ESAxios/lib/helpers/validator.js +120 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/Blob.js +3 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/FormData.js +3 -0
- package/rules/.source/ESAxios/lib/platform/browser/classes/URLSearchParams.js +6 -0
- package/rules/.source/ESAxios/lib/platform/browser/index.js +13 -0
- package/rules/.source/ESAxios/lib/platform/common/classes/FormData.js +142 -0
- package/rules/.source/ESAxios/lib/platform/common/index.js +7 -0
- package/rules/.source/ESAxios/lib/platform/common/utils.js +54 -0
- package/rules/.source/ESAxios/lib/platform/index.js +7 -0
- package/rules/.source/ESAxios/lib/platform/node/classes/FormData.js +3 -0
- package/rules/.source/ESAxios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/rules/.source/ESAxios/lib/platform/node/index.js +12 -0
- package/rules/.source/ESAxios/lib/utils.js +820 -0
- package/rules/.source/ESCore/CHANGELOG.md +7 -0
- package/rules/.source/ESCore/package.json +24 -0
- package/rules/.source/ESCore/rollup.config.js +28 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBar.ts +48 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.android.ts +29 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.harmony.ts +31 -0
- package/rules/.source/ESCore/src/actionbar/ESActionBarModule.ts +9 -0
- package/rules/.source/ESCore/src/actionbar/index.ts +2 -0
- package/rules/.source/ESCore/src/app/ESAppInfo.ts +12 -0
- package/rules/.source/ESCore/src/app/ESAppInfoList.ts +9 -0
- package/rules/.source/ESCore/src/app/ESAppList.ts +64 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.android.ts +55 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.harmony.ts +57 -0
- package/rules/.source/ESCore/src/app/ESAppListModule.ts +15 -0
- package/rules/.source/ESCore/src/app/index.ts +4 -0
- package/rules/.source/ESCore/src/application/ESAppContext.ts +99 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.android.ts +86 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.harmony.ts +91 -0
- package/rules/.source/ESCore/src/application/ESAppKeyManager.ts +23 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.android.ts +199 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.harmony.ts +197 -0
- package/rules/.source/ESCore/src/application/ESAppLifecycleManager.ts +36 -0
- package/rules/.source/ESCore/src/application/ESAppModuleManager.ts +294 -0
- package/rules/.source/ESCore/src/application/ESAppParams.ts +14 -0
- package/rules/.source/ESCore/src/application/ESApplication.ts +169 -0
- package/rules/.source/ESCore/src/application/index.ts +38 -0
- package/rules/.source/ESCore/src/audio/ESAudio.ts +190 -0
- package/rules/.source/ESCore/src/audio/ESAudioContentType.ts +7 -0
- package/rules/.source/ESCore/src/audio/ESAudioDirection.ts +5 -0
- package/rules/.source/ESCore/src/audio/ESAudioDurationHint.ts +7 -0
- package/rules/.source/ESCore/src/audio/ESAudioManagerFlag.ts +14 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.android.ts +173 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.harmony.ts +152 -0
- package/rules/.source/ESCore/src/audio/ESAudioModule.ts +63 -0
- package/rules/.source/ESCore/src/audio/ESAudioStreamType.ts +15 -0
- package/rules/.source/ESCore/src/audio/ESAudioUsage.ts +20 -0
- package/rules/.source/ESCore/src/audio/index.ts +9 -0
- package/rules/.source/ESCore/src/brightness/ESBrightness.ts +69 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.android.ts +73 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.harmony.ts +59 -0
- package/rules/.source/ESCore/src/brightness/ESBrightnessModule.ts +15 -0
- package/rules/.source/ESCore/src/brightness/index.ts +2 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcast.ts +107 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.android.ts +42 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.harmony.ts +45 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastModule.ts +10 -0
- package/rules/.source/ESCore/src/broadcast/ESBroadcastReceiver.ts +5 -0
- package/rules/.source/ESCore/src/broadcast/ESIntent.ts +6 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataAuthority.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataPath.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentDataSchemeSpecificPart.ts +4 -0
- package/rules/.source/ESCore/src/broadcast/ESIntentFilter.ts +13 -0
- package/rules/.source/ESCore/src/broadcast/index.ts +8 -0
- package/rules/.source/ESCore/src/core/IESComponent.ts +1 -0
- package/rules/.source/ESCore/src/core/IESManager.ts +7 -0
- package/rules/.source/ESCore/src/core/IESModule.ts +13 -0
- package/rules/.source/ESCore/src/core/NeedToTyped.ts +1 -0
- package/rules/.source/ESCore/src/core/index.ts +4 -0
- package/rules/.source/ESCore/src/database/ESDatabase.ts +63 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.android.ts +49 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.harmony.ts +46 -0
- package/rules/.source/ESCore/src/database/ESDatabaseModule.ts +23 -0
- package/rules/.source/ESCore/src/database/index.ts +2 -0
- package/rules/.source/ESCore/src/develop/ESDevelop.ts +75 -0
- package/rules/.source/ESCore/src/develop/ESDevelopInfo.ts +9 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.android.ts +50 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.harmony.ts +52 -0
- package/rules/.source/ESCore/src/develop/ESDevelopModule.ts +14 -0
- package/rules/.source/ESCore/src/develop/index.ts +3 -0
- package/rules/.source/ESCore/src/device/ESDevice.ts +289 -0
- package/rules/.source/ESCore/src/device/ESDeviceInfo.ts +51 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.android.ts +143 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.harmony.ts +116 -0
- package/rules/.source/ESCore/src/device/ESDeviceModule.ts +42 -0
- package/rules/.source/ESCore/src/device/index.ts +3 -0
- package/rules/.source/ESCore/src/display/ESDisplay.ts +61 -0
- package/rules/.source/ESCore/src/display/index.ts +2 -0
- package/rules/.source/ESCore/src/download/ESDownload.ts +181 -0
- package/rules/.source/ESCore/src/download/ESDownloadInfo.ts +14 -0
- package/rules/.source/ESCore/src/download/ESDownloadListener.ts +21 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.android.ts +57 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.harmony.ts +66 -0
- package/rules/.source/ESCore/src/download/ESDownloadModule.ts +21 -0
- package/rules/.source/ESCore/src/download/ESDownloadParams.ts +4 -0
- package/rules/.source/ESCore/src/download/ESDownloadState.ts +9 -0
- package/rules/.source/ESCore/src/download/ESDownloadStatus.ts +11 -0
- package/rules/.source/ESCore/src/download/index.ts +7 -0
- package/rules/.source/ESCore/src/error/ESError.ts +88 -0
- package/rules/.source/ESCore/src/error/ESErrorListener.ts +9 -0
- package/rules/.source/ESCore/src/error/ErrorOptions.ts +16 -0
- package/rules/.source/ESCore/src/error/index.ts +2 -0
- package/rules/.source/ESCore/src/es/ES.ts +140 -0
- package/rules/.source/ESCore/src/es/ESModule.android.ts +166 -0
- package/rules/.source/ESCore/src/es/ESModule.harmony.ts +167 -0
- package/rules/.source/ESCore/src/es/ESModule.ts +41 -0
- package/rules/.source/ESCore/src/es/ESSDKInfo.ts +17 -0
- package/rules/.source/ESCore/src/es/ESVersion.ts +14 -0
- package/rules/.source/ESCore/src/es/index.ts +4 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBus.ts +135 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusArg.ts +2 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusCallback.ts +4 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusContext.ts +2 -0
- package/rules/.source/ESCore/src/eventbus/ESEventBusEvent.ts +7 -0
- package/rules/.source/ESCore/src/eventbus/index.ts +6 -0
- package/rules/.source/ESCore/src/file/ESFile.ts +381 -0
- package/rules/.source/ESCore/src/file/ESFileModule.android.ts +334 -0
- package/rules/.source/ESCore/src/file/ESFileModule.harmony.ts +343 -0
- package/rules/.source/ESCore/src/file/ESFileModule.ts +101 -0
- package/rules/.source/ESCore/src/file/ESFileStat.ts +19 -0
- package/rules/.source/ESCore/src/file/index.ts +1 -0
- package/rules/.source/ESCore/src/focus/ESFocus.ts +56 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.android.ts +35 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.harmony.ts +35 -0
- package/rules/.source/ESCore/src/focus/ESFocusModule.ts +12 -0
- package/rules/.source/ESCore/src/focus/ESFocusable.ts +1 -0
- package/rules/.source/ESCore/src/focus/index.ts +3 -0
- package/rules/.source/ESCore/src/global.d.ts +37 -0
- package/rules/.source/ESCore/src/hlog/ESHLog.ts +276 -0
- package/rules/.source/ESCore/src/hlog/ESHLogModule.ts +130 -0
- package/rules/.source/ESCore/src/hlog/ESLogListener.ts +959 -0
- package/rules/.source/ESCore/src/hlog/LogPluginHelper.ts +44 -0
- package/rules/.source/ESCore/src/hlog/index.ts +6 -0
- package/rules/.source/ESCore/src/hlog/listener/OnInitListenerBase.ts +24 -0
- package/rules/.source/ESCore/src/hlog/listener/OnUploadListenerBase.ts +39 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveInitListenerBase.ts +17 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveOldUploadListenerBase.ts +21 -0
- package/rules/.source/ESCore/src/hlog/listener/RemoveUploadListenerBase.ts +29 -0
- package/rules/.source/ESCore/src/hlog/listener/SetInitListenerBase.ts +25 -0
- package/rules/.source/ESCore/src/hlog/listener/SetOldUploadListenerBase.ts +33 -0
- package/rules/.source/ESCore/src/hlog/listener/SetUploadListenerBase.ts +47 -0
- package/rules/.source/ESCore/src/iac/ESIAC.ts +150 -0
- package/rules/.source/ESCore/src/iac/ESIACMessage.ts +5 -0
- package/rules/.source/ESCore/src/iac/ESIACMessageFilter.ts +3 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.android.ts +40 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.harmony.ts +63 -0
- package/rules/.source/ESCore/src/iac/ESIACModule.ts +15 -0
- package/rules/.source/ESCore/src/iac/ESIACReceiver.ts +5 -0
- package/rules/.source/ESCore/src/iac/index.ts +5 -0
- package/rules/.source/ESCore/src/index.ts +92 -0
- package/rules/.source/ESCore/src/key/ESKeyAction.ts +5 -0
- package/rules/.source/ESCore/src/key/ESKeyCode.ts +15 -0
- package/rules/.source/ESCore/src/key/ESKeyEvent.ts +8 -0
- package/rules/.source/ESCore/src/key/index.ts +3 -0
- package/rules/.source/ESCore/src/kv/ESKV.ts +104 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.android.ts +60 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.harmony.ts +80 -0
- package/rules/.source/ESCore/src/kv/ESKVModule.ts +28 -0
- package/rules/.source/ESCore/src/kv/index.ts +2 -0
- package/rules/.source/ESCore/src/local/ESLocalStorage.ts +114 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.android.ts +150 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.harmony.ts +119 -0
- package/rules/.source/ESCore/src/local/ESLocalStorageModule.ts +23 -0
- package/rules/.source/ESCore/src/local/index.ts +2 -0
- package/rules/.source/ESCore/src/location/ESLocation.ts +89 -0
- package/rules/.source/ESCore/src/location/ESLocationInfo.ts +9 -0
- package/rules/.source/ESCore/src/location/ESLocationListener.ts +5 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.android.ts +53 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.harmony.ts +23 -0
- package/rules/.source/ESCore/src/location/ESLocationModule.ts +8 -0
- package/rules/.source/ESCore/src/location/index.ts +4 -0
- package/rules/.source/ESCore/src/log/ESLog.ts +163 -0
- package/rules/.source/ESCore/src/log/ESLogModule.android.ts +51 -0
- package/rules/.source/ESCore/src/log/ESLogModule.harmony.ts +52 -0
- package/rules/.source/ESCore/src/log/ESLogModule.ts +18 -0
- package/rules/.source/ESCore/src/log/index.ts +3 -0
- package/rules/.source/ESCore/src/network/ESNetwork.ts +102 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfo.ts +20 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfoState.ts +8 -0
- package/rules/.source/ESCore/src/network/ESNetworkInfoType.ts +6 -0
- package/rules/.source/ESCore/src/network/ESNetworkListener.ts +5 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.android.ts +38 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.harmony.ts +122 -0
- package/rules/.source/ESCore/src/network/ESNetworkModule.ts +13 -0
- package/rules/.source/ESCore/src/network/ESWifiInfo.ts +6 -0
- package/rules/.source/ESCore/src/network/index.ts +9 -0
- package/rules/.source/ESCore/src/page/ESPageParams.ts +14 -0
- package/rules/.source/ESCore/src/page/index.ts +1 -0
- package/rules/.source/ESCore/src/permission/ESPermission.ts +46 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.android.ts +33 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.harmony.ts +33 -0
- package/rules/.source/ESCore/src/permission/ESPermissionModule.ts +12 -0
- package/rules/.source/ESCore/src/permission/ESRequestPermissionsResult.ts +6 -0
- package/rules/.source/ESCore/src/permission/index.ts +3 -0
- package/rules/.source/ESCore/src/platform/ESPlatform.ts +63 -0
- package/rules/.source/ESCore/src/platform/index.ts +1 -0
- package/rules/.source/ESCore/src/plugin/ESPlugin.ts +152 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.android.ts +20 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.harmony.ts +24 -0
- package/rules/.source/ESCore/src/plugin/ESPluginModule.ts +9 -0
- package/rules/.source/ESCore/src/plugin/index.ts +3 -0
- package/rules/.source/ESCore/src/power/ESPower.ts +41 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.android.ts +31 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.harmony.ts +33 -0
- package/rules/.source/ESCore/src/power/ESPowerModule.ts +7 -0
- package/rules/.source/ESCore/src/power/index.ts +2 -0
- package/rules/.source/ESCore/src/provider/ESContentProvider.ts +82 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderInfo.ts +8 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.android.ts +62 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.harmony.ts +62 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderModule.ts +29 -0
- package/rules/.source/ESCore/src/provider/ESContentProviderResult.ts +4 -0
- package/rules/.source/ESCore/src/provider/ESContentValues.ts +3 -0
- package/rules/.source/ESCore/src/provider/index.ts +5 -0
- package/rules/.source/ESCore/src/router/ESData.ts +3 -0
- package/rules/.source/ESCore/src/router/ESParams.ts +3 -0
- package/rules/.source/ESCore/src/router/ESRouter.ts +364 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.android.ts +107 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.harmony.ts +205 -0
- package/rules/.source/ESCore/src/router/ESRouterKeyManager.ts +11 -0
- package/rules/.source/ESCore/src/router/ESRouterLifecycleManager.ts +301 -0
- package/rules/.source/ESCore/src/router/ESRouterManager.ts +221 -0
- package/rules/.source/ESCore/src/router/index.ts +9 -0
- package/rules/.source/ESCore/src/runtime/ESRuntime.ts +164 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.android.ts +76 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.harmony.ts +39 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceModule.ts +14 -0
- package/rules/.source/ESCore/src/runtime/ESRuntimeDeviceType.ts +53 -0
- package/rules/.source/ESCore/src/runtime/index.ts +4 -0
- package/rules/.source/ESCore/src/service/ESService.ts +34 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.android.ts +20 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.harmony.ts +19 -0
- package/rules/.source/ESCore/src/service/ESServiceModule.ts +5 -0
- package/rules/.source/ESCore/src/service/index.ts +2 -0
- package/rules/.source/ESCore/src/share/ESShareData.ts +177 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.android.ts +370 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.harmony.ts +201 -0
- package/rules/.source/ESCore/src/share/ESShareDataModule.ts +83 -0
- package/rules/.source/ESCore/src/share/ESSharedData.ts +9 -0
- package/rules/.source/ESCore/src/share/ESSharedDataMode.ts +5 -0
- package/rules/.source/ESCore/src/share/ESSharedDataParams.ts +4 -0
- package/rules/.source/ESCore/src/share/ESSharedDataType.ts +9 -0
- package/rules/.source/ESCore/src/share/index.ts +7 -0
- package/rules/.source/ESCore/src/slot/ESSlot.ts +75 -0
- package/rules/.source/ESCore/src/slot/ESSlotEvent.ts +4 -0
- package/rules/.source/ESCore/src/slot/ESSlotEventName.ts +3 -0
- package/rules/.source/ESCore/src/slot/ESSlotParams.ts +14 -0
- package/rules/.source/ESCore/src/slot/index.ts +3 -0
- package/rules/.source/ESCore/src/theme/ESTheme.ts +88 -0
- package/rules/.source/ESCore/src/theme/ESThemeListener.ts +3 -0
- package/rules/.source/ESCore/src/theme/index.ts +3 -0
- package/rules/.source/ESCore/src/toast/ESToast.ts +47 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.android.ts +30 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.harmony.ts +30 -0
- package/rules/.source/ESCore/src/toast/ESToastModule.ts +9 -0
- package/rules/.source/ESCore/src/toast/index.ts +2 -0
- package/rules/.source/ESCore/src/upload/ESUpload.ts +226 -0
- package/rules/.source/ESCore/src/upload/ESUploadInfo.ts +13 -0
- package/rules/.source/ESCore/src/upload/ESUploadListener.ts +21 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.android.ts +60 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.harmony.ts +51 -0
- package/rules/.source/ESCore/src/upload/ESUploadModule.ts +19 -0
- package/rules/.source/ESCore/src/upload/ESUploadState.ts +9 -0
- package/rules/.source/ESCore/src/upload/ESUploadStatus.ts +11 -0
- package/rules/.source/ESCore/src/upload/index.ts +6 -0
- package/rules/.source/ESCore/src/usb/ESUsbDevice.ts +112 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceInfo.ts +11 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceListener.ts +7 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.android.ts +62 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.harmony.ts +58 -0
- package/rules/.source/ESCore/src/usb/ESUsbDeviceModule.ts +23 -0
- package/rules/.source/ESCore/src/usb/index.ts +4 -0
- package/rules/.source/ESCore/src/useApi.ts +257 -0
- package/rules/.source/ESCore/src/xlog/ESLogUpload.ts +92 -0
- package/rules/.source/ESCore/src/xlog/ESLogUploadInfo.ts +12 -0
- package/rules/.source/ESCore/src/xlog/ESLogUploadListener.ts +7 -0
- package/rules/.source/ESCore/src/xlog/ESXLog.ts +130 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.android.ts +74 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.harmony.ts +47 -0
- package/rules/.source/ESCore/src/xlog/ESXLogModule.ts +24 -0
- package/rules/.source/ESCore/src/xlog/index.ts +6 -0
- package/rules/.source/ESCore/tsconfig.json +34 -0
- package/rules/.source/ESPlayer/package.json +24 -0
- package/rules/.source/ESPlayer/rollup.config.js +28 -0
- package/rules/.source/ESPlayer/src/cache/ESPlayerCache.ts +14 -0
- package/rules/.source/ESPlayer/src/cache/ESPlayerCacheManager.ts +39 -0
- package/rules/.source/ESPlayer/src/core/ESIPlayer.ts +179 -0
- package/rules/.source/ESPlayer/src/core/ESIPlayerManager.ts +7 -0
- package/rules/.source/ESPlayer/src/core/ESMediaMetadata.ts +8 -0
- package/rules/.source/ESPlayer/src/core/ESMediaSource.ts +13 -0
- package/rules/.source/ESPlayer/src/core/ESMediaSourceList.ts +15 -0
- package/rules/.source/ESPlayer/src/core/ESPlayer.ts +100 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerBufferPercentCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerCDNInfo.ts +5 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerCommand.ts +1 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerComponentInfo.ts +7 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerConfiguration.ts +13 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerControlOptions.ts +8 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerDurationCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerMediaMeta.ts +48 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerPosition.ts +5 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerProgressCallback.ts +3 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerState.ts +44 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerStatus.ts +10 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerTrackInfo.ts +36 -0
- package/rules/.source/ESPlayer/src/core/ESPlayerTrackType.ts +5 -0
- package/rules/.source/ESPlayer/src/core/M3U8DefinitionInfo.ts +38 -0
- package/rules/.source/ESPlayer/src/decode/ESPlayerDecode.ts +12 -0
- package/rules/.source/ESPlayer/src/decode/ESPlayerDecodeManager.ts +81 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinition.ts +21 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinitionManager.ts +93 -0
- package/rules/.source/ESPlayer/src/definition/ESPlayerDefinitionStrategy.ts +12 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDevice.ts +4 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDeviceManager.ts +41 -0
- package/rules/.source/ESPlayer/src/device/ESPlayerDeviceType.ts +53 -0
- package/rules/.source/ESPlayer/src/display/ESPlayerDisplay.ts +4 -0
- package/rules/.source/ESPlayer/src/display/ESPlayerDisplayManager.ts +63 -0
- package/rules/.source/ESPlayer/src/error/ESPlayerError.ts +5 -0
- package/rules/.source/ESPlayer/src/error/ESPlayerErrors.ts +8 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventDefaultListener.ts +127 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventListener.ts +120 -0
- package/rules/.source/ESPlayer/src/event/ESPlayerEventManager.ts +451 -0
- package/rules/.source/ESPlayer/src/index.ts +166 -0
- package/rules/.source/ESPlayer/src/info/ESPlayerInfo.ts +16 -0
- package/rules/.source/ESPlayer/src/injectionSymbols.ts +84 -0
- package/rules/.source/ESPlayer/src/interceptor/ESIPlayerInterceptor.ts +11 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptError.ts +8 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptResult.ts +8 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptorManager.ts +95 -0
- package/rules/.source/ESPlayer/src/interceptor/ESPlayerInterceptorType.ts +17 -0
- package/rules/.source/ESPlayer/src/log/ESPlayerLog.ts +143 -0
- package/rules/.source/ESPlayer/src/log/ESPlayerLogModule.ts +43 -0
- package/rules/.source/ESPlayer/src/mode/ESPlayerPlayMode.ts +8 -0
- package/rules/.source/ESPlayer/src/mode/ESPlayerPlayModeManager.ts +39 -0
- package/rules/.source/ESPlayer/src/option/ESPlayerOption.ts +11 -0
- package/rules/.source/ESPlayer/src/option/ESPlayerOptionType.ts +14 -0
- package/rules/.source/ESPlayer/src/rate/ESPlayerRate.ts +11 -0
- package/rules/.source/ESPlayer/src/rate/ESPlayerRateManager.ts +39 -0
- package/rules/.source/ESPlayer/src/ratio/ESPlayerAspectRatio.ts +9 -0
- package/rules/.source/ESPlayer/src/ratio/ESPlayerAspectRatioManager.ts +39 -0
- package/rules/.source/ESPlayer/src/render/ESPlayerRender.ts +5 -0
- package/rules/.source/ESPlayer/src/render/ESPlayerRenderManager.ts +36 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageManager.ts +97 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.android.ts +111 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.harmony.ts +111 -0
- package/rules/.source/ESPlayer/src/storage/ESPlayerLocalStorageModule.ts +21 -0
- package/rules/.source/ESPlayer/src/type/ESPlayerType.ts +18 -0
- package/rules/.source/ESPlayer/src/type/ESPlayerTypeManager.ts +81 -0
- package/rules/.source/ESPlayer/src/useApi.ts +108 -0
- package/rules/.source/ESPlayer/src/view/ESIPlayerView.ts +120 -0
- package/rules/.source/ESPlayer/src/view/ESPlayerDefaultView.ts +127 -0
- package/rules/.source/ESPlayer/src/view/ESPlayerViewManager.ts +453 -0
- package/rules/.source/ESPlayer/src/volume/ESPlayerVolume.ts +4 -0
- package/rules/.source/ESPlayer/src/volume/ESPlayerVolumeManager.ts +51 -0
- package/rules/.source/ESPlayer/src/window/ESPlayerWindowType.ts +5 -0
- package/rules/.source/ESPlayer/tsconfig.json +34 -0
- package/rules/.source/ESPlayer/yarn.lock +4 -0
- package/rules/.source/ESPlayerManager/package.json +24 -0
- package/rules/.source/ESPlayerManager/rollup.config.js +33 -0
- package/rules/.source/ESPlayerManager/src/core/ESBuiltinADPlayerType.ts +9 -0
- package/rules/.source/ESPlayerManager/src/core/ESBuiltinPlayerType.ts +8 -0
- package/rules/.source/ESPlayerManager/src/core/ESIPlayerManager.ts +71 -0
- package/rules/.source/ESPlayerManager/src/core/ESMediaItem.ts +47 -0
- package/rules/.source/ESPlayerManager/src/core/ESMediaItemList.ts +11 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManager.ts +41 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManagerConfiguration.ts +6 -0
- package/rules/.source/ESPlayerManager/src/core/ESPlayerManagerErrors.ts +6 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventDefaultListener.ts +154 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventListener.ts +37 -0
- package/rules/.source/ESPlayerManager/src/event/ESPlayerManagerEventManager.ts +521 -0
- package/rules/.source/ESPlayerManager/src/index.ts +37 -0
- package/rules/.source/ESPlayerManager/src/index.vue +2676 -0
- package/rules/.source/ESPlayerManager/src/injectionSymbols.ts +16 -0
- package/rules/.source/ESPlayerManager/src/mode/ESPlayerManagerPlayModeManager.ts +27 -0
- package/rules/.source/ESPlayerManager/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESPlayerManager/src/useApi.ts +22 -0
- package/rules/.source/ESPlayerManager/src/utils/SparseArray.ts +103 -0
- package/rules/.source/ESPlayerManager/src/view/ESIPlayerManagerDefaultView.ts +167 -0
- package/rules/.source/ESPlayerManager/src/view/ESIPlayerManagerView.ts +44 -0
- package/rules/.source/ESPlayerManager/src/view/ESPlayerManagerViewManager.ts +517 -0
- package/rules/.source/ESPlayerManager/tsconfig.json +34 -0
- package/rules/.source/ESRouter/CHANGELOGG.md +899 -0
- package/rules/.source/ESRouter/SECURITY.md +20 -0
- package/rules/.source/ESRouter/api-extractor.json +49 -0
- package/rules/.source/ESRouter/index.js +7 -0
- package/rules/.source/ESRouter/nightwatch.conf.js +240 -0
- package/rules/.source/ESRouter/package.json +19 -0
- package/rules/.source/ESRouter/rollup.config.mjs +195 -0
- package/rules/.source/ESRouter/src/RouterLink.ts +358 -0
- package/rules/.source/ESRouter/src/RouterView.ts +794 -0
- package/rules/.source/ESRouter/src/SlotView.ts +477 -0
- package/rules/.source/ESRouter/src/config.ts +6 -0
- package/rules/.source/ESRouter/src/devtools.ts +576 -0
- package/rules/.source/ESRouter/src/encoding.ts +147 -0
- package/rules/.source/ESRouter/src/errors.ts +200 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.android.ts +100 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.harmony.ts +155 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouter.ts +24 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouterLaunchMode.ts +7 -0
- package/rules/.source/ESRouter/src/es/ESNativeRouterSplash.ts +6 -0
- package/rules/.source/ESRouter/src/global.d.ts +15 -0
- package/rules/.source/ESRouter/src/globalExtensions.ts +83 -0
- package/rules/.source/ESRouter/src/history/common.ts +237 -0
- package/rules/.source/ESRouter/src/history/es.ts +278 -0
- package/rules/.source/ESRouter/src/history/hash.ts +46 -0
- package/rules/.source/ESRouter/src/history/html5.ts +354 -0
- package/rules/.source/ESRouter/src/history/index.ts +40 -0
- package/rules/.source/ESRouter/src/history/memory.ts +127 -0
- package/rules/.source/ESRouter/src/index.ts +131 -0
- package/rules/.source/ESRouter/src/injectionSymbols.ts +91 -0
- package/rules/.source/ESRouter/src/location.ts +251 -0
- package/rules/.source/ESRouter/src/log/RouterLog.ts +90 -0
- package/rules/.source/ESRouter/src/log/info.ts +9 -0
- package/rules/.source/ESRouter/src/matcher/index.ts +533 -0
- package/rules/.source/ESRouter/src/matcher/pathMatcher.ts +55 -0
- package/rules/.source/ESRouter/src/matcher/pathParserRanker.ts +369 -0
- package/rules/.source/ESRouter/src/matcher/pathTokenizer.ts +200 -0
- package/rules/.source/ESRouter/src/matcher/types.ts +131 -0
- package/rules/.source/ESRouter/src/navigationGuards.ts +409 -0
- package/rules/.source/ESRouter/src/page/PageRouteView.ts +11 -0
- package/rules/.source/ESRouter/src/page/PageView.ts +12 -0
- package/rules/.source/ESRouter/src/query.ts +149 -0
- package/rules/.source/ESRouter/src/result/RouteResult.ts +11 -0
- package/rules/.source/ESRouter/src/result/RouteResultCallback.ts +5 -0
- package/rules/.source/ESRouter/src/router.ts +1930 -0
- package/rules/.source/ESRouter/src/scrollBehavior.ts +194 -0
- package/rules/.source/ESRouter/src/slot/SlotRootView.ts +11 -0
- package/rules/.source/ESRouter/src/slot/SlotView.ts +11 -0
- package/rules/.source/ESRouter/src/types/index.ts +605 -0
- package/rules/.source/ESRouter/src/types/typeGuards.ts +9 -0
- package/rules/.source/ESRouter/src/types/utils.ts +77 -0
- package/rules/.source/ESRouter/src/useApi.ts +29 -0
- package/rules/.source/ESRouter/src/utils/callbacks.ts +24 -0
- package/rules/.source/ESRouter/src/utils/env.ts +1 -0
- package/rules/.source/ESRouter/src/utils/index.ts +60 -0
- package/rules/.source/ESRouter/src/warning.ts +9 -0
- package/rules/.source/ESRouter/tsconfig.json +37 -0
- package/rules/.source/ESSoundPoolPlayer/package.json +23 -0
- package/rules/.source/ESSoundPoolPlayer/rollup.config.js +33 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolContentType.ts +7 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolStreamType.ts +15 -0
- package/rules/.source/ESSoundPoolPlayer/src/core/ESSoundPoolUsage.ts +19 -0
- package/rules/.source/ESSoundPoolPlayer/src/index.ts +19 -0
- package/rules/.source/ESSoundPoolPlayer/src/index.vue +1564 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModul.android.ts +133 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModul.harmony.ts +119 -0
- package/rules/.source/ESSoundPoolPlayer/src/module/ESSoundPoolPlayerModule.ts +48 -0
- package/rules/.source/ESSoundPoolPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESSoundPoolPlayer/tsconfig.json +34 -0
- package/rules/.source/ESVideoPlayer/package.json +26 -0
- package/rules/.source/ESVideoPlayer/rollup.config.js +33 -0
- package/rules/.source/ESVideoPlayer/src/component/ESVideoPlayerViewComponent.android.ts +948 -0
- package/rules/.source/ESVideoPlayer/src/component/ESVideoPlayerViewComponent.harmony.ts +763 -0
- package/rules/.source/ESVideoPlayer/src/index.ts +18 -0
- package/rules/.source/ESVideoPlayer/src/index.vue +2003 -0
- package/rules/.source/ESVideoPlayer/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/ESVideoPlayer/src/utils/ESVideoPlayerDefinitionUtils.ts +36 -0
- package/rules/.source/ESVideoPlayer/tsconfig.json +34 -0
- package/rules/.source/ESVideoPlayer/tsconfig.json.vite +0 -0
- package/rules/.source/ESVideoPlayer/tsconfig.node.json +0 -0
- package/rules/.source/ESVideoPlayer/vite.config.ts +29 -0
- package/rules/.source/ESVue/CHANGELOG.MD +201 -0
- package/rules/.source/ESVue/api-extractor.json +41 -0
- package/rules/.source/ESVue/package.json +42 -0
- package/rules/.source/ESVue/rollup.config.js +40 -0
- package/rules/.source/ESVue/src/built-in-component.ts +650 -0
- package/rules/.source/ESVue/src/config/index.ts +109 -0
- package/rules/.source/ESVue/src/global.d.ts +636 -0
- package/rules/.source/ESVue/src/hooks/lifecycle.ts +248 -0
- package/rules/.source/ESVue/src/index.ts +365 -0
- package/rules/.source/ESVue/src/modules/attrs.ts +24 -0
- package/rules/.source/ESVue/src/modules/class.ts +31 -0
- package/rules/.source/ESVue/src/modules/events.ts +119 -0
- package/rules/.source/ESVue/src/modules/patch-log.ts +39 -0
- package/rules/.source/ESVue/src/modules/style.ts +68 -0
- package/rules/.source/ESVue/src/node-ops.ts +153 -0
- package/rules/.source/ESVue/src/patch-prop.ts +93 -0
- package/rules/.source/ESVue/src/runtime/component/index.ts +83 -0
- package/rules/.source/ESVue/src/runtime/document/hippy-document.ts +56 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-comment-element.ts +21 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-element.ts +1623 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-input-element.ts +75 -0
- package/rules/.source/ESVue/src/runtime/element/hippy-list-element.ts +306 -0
- package/rules/.source/ESVue/src/runtime/event/event-bus.ts +148 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event-dispatcher.ts +391 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event-target.ts +191 -0
- package/rules/.source/ESVue/src/runtime/event/hippy-event.ts +317 -0
- package/rules/.source/ESVue/src/runtime/native/index.ts +924 -0
- package/rules/.source/ESVue/src/runtime/node/hippy-node.ts +722 -0
- package/rules/.source/ESVue/src/runtime/node/node-log.ts +39 -0
- package/rules/.source/ESVue/src/runtime/render/index.ts +550 -0
- package/rules/.source/ESVue/src/runtime/style/css-map.ts +100 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-auto-style.ts +119 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-percent-style.ts +111 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-rem-style.ts +45 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-scale-style.ts +103 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-style.ts +24 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-variables.ts +209 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-vwvh-style.ts +65 -0
- package/rules/.source/ESVue/src/runtime/style/css-resolve-width-height-style.ts +18 -0
- package/rules/.source/ESVue/src/runtime/style/css-selectors-match.ts +295 -0
- package/rules/.source/ESVue/src/runtime/style/css-selectors.ts +1173 -0
- package/rules/.source/ESVue/src/runtime/style/index.ts +154 -0
- package/rules/.source/ESVue/src/runtime/style/log.ts +39 -0
- package/rules/.source/ESVue/src/runtime/style/parser.ts +291 -0
- package/rules/.source/ESVue/src/runtime/text/hippy-text.ts +41 -0
- package/rules/.source/ESVue/src/runtime/websocket/websocket.ts +282 -0
- package/rules/.source/ESVue/src/types/index.ts +25 -0
- package/rules/.source/ESVue/src/types/native-modules/clip-board-module.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/device-event-module.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/http.ts +57 -0
- package/rules/.source/ESVue/src/types/native-modules/image-loader-module.ts +27 -0
- package/rules/.source/ESVue/src/types/native-modules/net-info.ts +29 -0
- package/rules/.source/ESVue/src/types/native-modules/network.ts +24 -0
- package/rules/.source/ESVue/src/types/native-modules/test-module.ts +23 -0
- package/rules/.source/ESVue/src/types/native-modules/ui-manager-module.ts +44 -0
- package/rules/.source/ESVue/src/types/native-modules/websocket.ts +49 -0
- package/rules/.source/ESVue/src/types/native-modules.ts +41 -0
- package/rules/.source/ESVue/src/types/native-node.ts +48 -0
- package/rules/.source/ESVue/src/util/event.ts +74 -0
- package/rules/.source/ESVue/src/util/i18n.ts +32 -0
- package/rules/.source/ESVue/src/util/index.ts +418 -0
- package/rules/.source/ESVue/src/util/instance.ts +77 -0
- package/rules/.source/ESVue/src/util/log.ts +39 -0
- package/rules/.source/ESVue/src/util/node.ts +152 -0
- package/rules/.source/ESVue/src/util/rem.ts +54 -0
- package/rules/.source/ESVue/src/util/screen.ts +42 -0
- package/rules/.source/ESVue/tsconfig.json +34 -0
- package/rules/.source/ESVue/tsdoc.json +6 -0
- package/rules/.source/ESVue/yarn.lock +4 -0
- package/rules/.source/ESVueCssLoader/package.json +27 -0
- package/rules/.source/ESVueCssLoader/rollup.config.js +20 -0
- package/rules/.source/ESVueCssLoader/src/index.ts +2 -0
- package/rules/.source/ESVueCssLoader/src/log/log.ts +38 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/color-parser.ts +357 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/css-loader.ts +93 -0
- package/rules/.source/ESVueCssLoader/src/style-parser/css-parser.ts +1123 -0
- package/rules/.source/ESVueCssLoader/src/types.ts +5 -0
- package/rules/.source/ESVueCssLoader/src/utils/utils.ts +59 -0
- package/rules/.source/ESVueCssLoader/tsconfig.json +34 -0
- package/rules/.source/ESVueStyleParser/api-extractor.json +38 -0
- package/rules/.source/ESVueStyleParser/package.json +24 -0
- package/rules/.source/ESVueStyleParser/rollup.config.js +28 -0
- package/rules/.source/ESVueStyleParser/src/index.ts +24 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/android-color-parser.ts +143 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/color-parser.ts +256 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/css-parser.ts +1371 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/named-colors.ts +154 -0
- package/rules/.source/ESVueStyleParser/src/style-parser/utils.ts +55 -0
- package/rules/.source/ESVueStyleParser/src/types.ts +5 -0
- package/rules/.source/ESVueStyleParser/tsconfig.json +34 -0
- package/rules/.source/component/package.json +24 -0
- package/rules/.source/component/rollup.config.js +28 -0
- package/rules/.source/component/src/ESAnimationView/ESAnimationViewComponent.ts +51 -0
- package/rules/.source/component/src/ESAppIconView/ESAppIconViewComponent.ts +46 -0
- package/rules/.source/component/src/ESAppIconView/ESIAppIcon.ts +5 -0
- package/rules/.source/component/src/ESCardView/ESCardContainerViewComponent.ts +127 -0
- package/rules/.source/component/src/ESCardView/ESCardEvent.ts +3 -0
- package/rules/.source/component/src/ESCardView/ESCardViewComponent.ts +54 -0
- package/rules/.source/component/src/ESCardView/ESICard.ts +9 -0
- package/rules/.source/component/src/ESCardView/ESICardContainer.ts +25 -0
- package/rules/.source/component/src/ESChartView/ESBarChartViewComponent.ts +35 -0
- package/rules/.source/component/src/ESChartView/ESIChart.ts +3 -0
- package/rules/.source/component/src/ESChartView/ESLineChartViewComponent.ts +35 -0
- package/rules/.source/component/src/ESDialog/ESDialogComponent.ts +15 -0
- package/rules/.source/component/src/ESFastSwiperSlideView/ESFastSwiperSlideViewComponent.ts +46 -0
- package/rules/.source/component/src/ESFlexView/ESFlexViewComponent.ts +22 -0
- package/rules/.source/component/src/ESGradient/ESGradient.ts +14 -0
- package/rules/.source/component/src/ESGradient/ESGradientOrientation.ts +10 -0
- package/rules/.source/component/src/ESGradient/ESGradientShape.ts +6 -0
- package/rules/.source/component/src/ESGradient/ESGradientType.ts +5 -0
- package/rules/.source/component/src/ESItem/ESItemComponent.ts +40 -0
- package/rules/.source/component/src/ESItemStoreView/ESItemStoreViewComponent.ts +23 -0
- package/rules/.source/component/src/ESLargeListView/ESLargeListViewComponent.ts +136 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewComponent.ts +16 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewElement.android.ts +11 -0
- package/rules/.source/component/src/ESLoading/ESLoadingViewElement.harmony.ts +11 -0
- package/rules/.source/component/src/ESLottieView/ESLottieViewComponent.android.ts +29 -0
- package/rules/.source/component/src/ESLottieView/ESLottieViewComponent.harmony.ts +29 -0
- package/rules/.source/component/src/ESMediaSeries/ESIMediaSeries.ts +24 -0
- package/rules/.source/component/src/ESMediaSeries/ESMediaSeries.ts +6 -0
- package/rules/.source/component/src/ESMediaSeries/ESMediaSeriesComponent.ts +142 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESHorizontalSeekBarViewComponent.ts +1305 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESIHorizontalSeekBar.ts +255 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESIVerticalSeekBar.ts +13 -0
- package/rules/.source/component/src/ESOrientationSeekBar/ESVerticalSeekBarViewComponent.ts +1356 -0
- package/rules/.source/component/src/ESPlayMarkView/ESPlayMarkViewComponent.ts +21 -0
- package/rules/.source/component/src/ESPluginView/ESPluginViewComponent.ts +34 -0
- package/rules/.source/component/src/ESProgressBarView/ESProgressBarViewComponent.ts +38 -0
- package/rules/.source/component/src/ESQRCodeView/ESQRCodeViewComponent.ts +11 -0
- package/rules/.source/component/src/ESReplaceChildView/ESReplaceChildViewComponent.ts +151 -0
- package/rules/.source/component/src/ESRippleView/ESRippleViewComponent.ts +45 -0
- package/rules/.source/component/src/ESScrollView/ESIScrollView.ts +7 -0
- package/rules/.source/component/src/ESScrollView/ESScrollViewComponent.ts +49 -0
- package/rules/.source/component/src/ESSeekBarView/ESSeekBarViewElement.android.ts +38 -0
- package/rules/.source/component/src/ESSeekBarView/ESSeekBarViewElement.harmony.ts +38 -0
- package/rules/.source/component/src/ESSurfaceView/ESSurfaceViewComponent.ts +21 -0
- package/rules/.source/component/src/ESSwiftListView/ESSwiftListViewComponent.ts +117 -0
- package/rules/.source/component/src/ESSwiperSlideView/ESSwiperSlideViewComponent.ts +31 -0
- package/rules/.source/component/src/ESSwiperView/ESSwiperViewComponent.ts +82 -0
- package/rules/.source/component/src/ESTVItemView/ESTVItemViewComponent.ts +185 -0
- package/rules/.source/component/src/ESTVListView/ESIListView.ts +184 -0
- package/rules/.source/component/src/ESTVListView/ESListInitPosition.ts +15 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItem.ts +10 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItemDecoration.ts +7 -0
- package/rules/.source/component/src/ESTVListView/ESListViewItemFunctionParams.ts +7 -0
- package/rules/.source/component/src/ESTVListView/ESTVListViewComponent.ts +697 -0
- package/rules/.source/component/src/ESTabsView/ESITab.ts +90 -0
- package/rules/.source/component/src/ESTabsView/ESTab.ts +7 -0
- package/rules/.source/component/src/ESTabsView/ESTabItem.ts +8 -0
- package/rules/.source/component/src/ESTabsView/ESTabsViewComponent.ts +383 -0
- package/rules/.source/component/src/ESTestView/ESITestAView.ts +1 -0
- package/rules/.source/component/src/ESTestView/ESITestGroup.ts +3 -0
- package/rules/.source/component/src/ESTestView/ESITestView.ts +3 -0
- package/rules/.source/component/src/ESTestView/ESTestAViewComponent.ts +34 -0
- package/rules/.source/component/src/ESTestView/ESTestGroupComponent.ts +39 -0
- package/rules/.source/component/src/ESTestView/ESTestViewComponent.ts +51 -0
- package/rules/.source/component/src/ESTextView/ESTextViewComponent.ts +22 -0
- package/rules/.source/component/src/ESTransitionImageView/ESITransitionImage.ts +7 -0
- package/rules/.source/component/src/ESTransitionImageView/ESTransitionImageViewComponent.ts +58 -0
- package/rules/.source/component/src/ESView/ESDirections.ts +7 -0
- package/rules/.source/component/src/ESView/ESIView.ts +6 -0
- package/rules/.source/component/src/ESView/ESViewComponent.ts +24 -0
- package/rules/.source/component/src/ESView/ESViewCoordinate.ts +4 -0
- package/rules/.source/component/src/ESView/ESViewScrollState.ts +5 -0
- package/rules/.source/component/src/ESView/ESViewState.ts +16 -0
- package/rules/.source/component/src/ESView/ESViewStateCallback.ts +5 -0
- package/rules/.source/component/src/ESViewPager/ESIViewPager.ts +8 -0
- package/rules/.source/component/src/ESViewPager/ESPageData.ts +7 -0
- package/rules/.source/component/src/ESViewPager/ESViewPagerComponent.ts +58 -0
- package/rules/.source/component/src/ESWebView/ESWebViewComponent.ts +48 -0
- package/rules/.source/component/src/ESX5WebView/ESX5WebViewElement.android.ts +70 -0
- package/rules/.source/component/src/ESX5WebView/ESX5WebViewElement.harmony.ts +70 -0
- package/rules/.source/component/src/index.ts +180 -0
- package/rules/.source/component/src/tv-div/TVDivComponent.ts +131 -0
- package/rules/.source/component/src/tv-image/TVImageComponent.ts +126 -0
- package/rules/.source/component/src/tv-li/TVLiComponent.ts +10 -0
- package/rules/.source/component/src/tv-swiper/TVSwiperComponent.ts +110 -0
- package/rules/.source/component/src/tv-ul/TVULComponent.ts +82 -0
- package/rules/.source/component/src/typings/index.ts +7 -0
- package/rules/.source/component/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/component/tsconfig.json +34 -0
- package/rules/.source/quicktvui/assets/ic_media_sereis_vip.png +0 -0
- package/rules/.source/quicktvui/package.json +38 -0
- package/rules/.source/quicktvui/rollup.config.js +33 -0
- package/rules/.source/quicktvui/src/animation/QTAnimation.android.ts +1139 -0
- package/rules/.source/quicktvui/src/animation/QTAnimation.harmony.ts +1088 -0
- package/rules/.source/quicktvui/src/animation/QTIAnimation.ts +336 -0
- package/rules/.source/quicktvui/src/animation/QtAnimationAPI.ts +467 -0
- package/rules/.source/quicktvui/src/animation/types.ts +97 -0
- package/rules/.source/quicktvui/src/app/QTAppIcon.ts +41 -0
- package/rules/.source/quicktvui/src/app/QTIAppIcon.ts +5 -0
- package/rules/.source/quicktvui/src/app/QtAppIconAPI.ts +56 -0
- package/rules/.source/quicktvui/src/assets/vip.png +0 -0
- package/rules/.source/quicktvui/src/base/QTIBaseView.ts +95 -0
- package/rules/.source/quicktvui/src/base/QtBaseNativeViewAPI.ts +604 -0
- package/rules/.source/quicktvui/src/base/QtBaseViewAPI.ts +750 -0
- package/rules/.source/quicktvui/src/base/useBaseView.ts +374 -0
- package/rules/.source/quicktvui/src/button/QTIButton.ts +3 -0
- package/rules/.source/quicktvui/src/button/QtButtonAPI.ts +9 -0
- package/rules/.source/quicktvui/src/button/index.vue +223 -0
- package/rules/.source/quicktvui/src/canvas/CanvasGradient.ts +84 -0
- package/rules/.source/quicktvui/src/canvas/QTCanvasView.ts +468 -0
- package/rules/.source/quicktvui/src/canvas/QTICanvasView.ts +141 -0
- package/rules/.source/quicktvui/src/canvas/QtCanvasViewAPI.ts +1140 -0
- package/rules/.source/quicktvui/src/classified-list-view/QtClassifiedListViewAPI.ts +115 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTClassifiedListViewItem.ts +11 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTClassifiedListViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/classified-list-view/core/QTIClassifiedListView.ts +18 -0
- package/rules/.source/quicktvui/src/classified-list-view/index.vue +520 -0
- package/rules/.source/quicktvui/src/collapse/QtCollapseAPI.ts +60 -0
- package/rules/.source/quicktvui/src/collapse/core/QTCollapse.ts +13 -0
- package/rules/.source/quicktvui/src/collapse/core/QTCollapseItem.ts +7 -0
- package/rules/.source/quicktvui/src/collapse/core/QTICollapse.ts +15 -0
- package/rules/.source/quicktvui/src/collapse/core/QTICollapseItem.ts +5 -0
- package/rules/.source/quicktvui/src/collapse/index.vue +337 -0
- package/rules/.source/quicktvui/src/column/QTIColumn.ts +3 -0
- package/rules/.source/quicktvui/src/column/QtColumnAPI.ts +9 -0
- package/rules/.source/quicktvui/src/column/index.vue +29 -0
- package/rules/.source/quicktvui/src/core/QTEventData.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleBackground.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleCoordinate.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleGradientBackground.ts +6 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleMargin.ts +8 -0
- package/rules/.source/quicktvui/src/core/QTFlexStylePadding.ts +8 -0
- package/rules/.source/quicktvui/src/core/QTFlexStylePosition.ts +7 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleSize.ts +6 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleSpacing.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTFlexStyleText.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTFocusable.ts +5 -0
- package/rules/.source/quicktvui/src/core/QTLocation.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTNativeParams.ts +22 -0
- package/rules/.source/quicktvui/src/core/QTPosition.ts +4 -0
- package/rules/.source/quicktvui/src/core/QTVisibility.ts +5 -0
- package/rules/.source/quicktvui/src/dialog/QTDialog.ts +28 -0
- package/rules/.source/quicktvui/src/dialog/QTIDialog.ts +3 -0
- package/rules/.source/quicktvui/src/file-browse/QTFileBrowse.ts +76 -0
- package/rules/.source/quicktvui/src/file-browse/QTIFileBrowse.ts +13 -0
- package/rules/.source/quicktvui/src/focus/QTDescendantFocusability.ts +5 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDescendant.ts +5 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDirection.ts +8 -0
- package/rules/.source/quicktvui/src/focus/QTFocusDirectionName.ts +7 -0
- package/rules/.source/quicktvui/src/gradient/QTGradient.ts +14 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientOrientation.ts +10 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientShape.ts +6 -0
- package/rules/.source/quicktvui/src/gradient/QTGradientType.ts +5 -0
- package/rules/.source/quicktvui/src/grid-view/QtGridViewAPI.ts +121 -0
- package/rules/.source/quicktvui/src/grid-view/README.md +93 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItem.ts +4 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTGridViewItemFunctionParams.ts +7 -0
- package/rules/.source/quicktvui/src/grid-view/core/QTIGridView.ts +23 -0
- package/rules/.source/quicktvui/src/grid-view/index.vue +390 -0
- package/rules/.source/quicktvui/src/image/QTIImage.ts +8 -0
- package/rules/.source/quicktvui/src/image/QTImageResizeMode.ts +7 -0
- package/rules/.source/quicktvui/src/image/QtImageAPI.ts +54 -0
- package/rules/.source/quicktvui/src/image/index.vue +33 -0
- package/rules/.source/quicktvui/src/index.ts +404 -0
- package/rules/.source/quicktvui/src/list/QTIBaseListView.ts +144 -0
- package/rules/.source/quicktvui/src/list/QTListInitPosition.ts +15 -0
- package/rules/.source/quicktvui/src/list/QtBaseListViewAPI.ts +930 -0
- package/rules/.source/quicktvui/src/list/useBaseListView.ts +454 -0
- package/rules/.source/quicktvui/src/list/useListView.ts +294 -0
- package/rules/.source/quicktvui/src/list-indicator/QTIndicatorListViewComponent.ts +553 -0
- package/rules/.source/quicktvui/src/list-indicator/QtIndicatorViewAPI.ts +114 -0
- package/rules/.source/quicktvui/src/list-indicator/core/QTIIndicatorView.ts +21 -0
- package/rules/.source/quicktvui/src/list-item/ESListItemComponent.ts +86 -0
- package/rules/.source/quicktvui/src/list-item/QTIListItem.ts +14 -0
- package/rules/.source/quicktvui/src/list-item/QtListItemAPI.ts +107 -0
- package/rules/.source/quicktvui/src/list-view/QTListViewComponent.ts +389 -0
- package/rules/.source/quicktvui/src/list-view/QtListViewAPI.ts +101 -0
- package/rules/.source/quicktvui/src/list-view/core/QTIListView.ts +19 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItem.ts +12 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemDecoration.ts +7 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemFunctionParams.ts +7 -0
- package/rules/.source/quicktvui/src/list-view/core/QTListViewItemState.ts +8 -0
- package/rules/.source/quicktvui/src/loading/QTILoadingView.ts +3 -0
- package/rules/.source/quicktvui/src/loading/QTLoadingView.ts +25 -0
- package/rules/.source/quicktvui/src/loading/QtLoadingAPI.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/QTILongImage.ts +68 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImage.ts +442 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageEventBean.ts +62 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageOrientation.ts +19 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImagePositionType.ts +5 -0
- package/rules/.source/quicktvui/src/long-image/QTLongImageScaleType.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/QtLongImageAPI.ts +9 -0
- package/rules/.source/quicktvui/src/long-image/index.vue +397 -0
- package/rules/.source/quicktvui/src/lottie/QTILottieView.ts +62 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieAsyncUpdates.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieEvent.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieRenderMode.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieRepeatMode.ts +5 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieView.android.ts +207 -0
- package/rules/.source/quicktvui/src/lottie/QTLottieView.harmony.ts +207 -0
- package/rules/.source/quicktvui/src/lottie/QtLottieViewAPI.ts +586 -0
- package/rules/.source/quicktvui/src/nav-bar/QTINavBar.ts +11 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBar.ts +9 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBarItem.ts +9 -0
- package/rules/.source/quicktvui/src/nav-bar/QTNavBarItemType.ts +3 -0
- package/rules/.source/quicktvui/src/nav-bar/QtNavBarAPI.ts +36 -0
- package/rules/.source/quicktvui/src/nav-bar/index.vue +220 -0
- package/rules/.source/quicktvui/src/plugin/QTIPluginView.ts +11 -0
- package/rules/.source/quicktvui/src/plugin/QTPluginView.ts +49 -0
- package/rules/.source/quicktvui/src/plugin/QtPluginViewAPI.ts +44 -0
- package/rules/.source/quicktvui/src/poster/QtPosterAPI.ts +9 -0
- package/rules/.source/quicktvui/src/poster/core/QTIPoster.ts +3 -0
- package/rules/.source/quicktvui/src/poster/core/QTPoster.ts +32 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterCorner.ts +9 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterElement.ts +8 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterImage.ts +7 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterPlaceholderImg.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterRipple.ts +10 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterScore.ts +14 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterShadow.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterShimmer.ts +4 -0
- package/rules/.source/quicktvui/src/poster/core/QTPosterTitle.ts +17 -0
- package/rules/.source/quicktvui/src/poster/index.vue +279 -0
- package/rules/.source/quicktvui/src/poster/qt-poster-corner-title.vue +69 -0
- package/rules/.source/quicktvui/src/poster/qt-poster-focus-title.vue +113 -0
- package/rules/.source/quicktvui/src/progressbar/QTIProgressBar.ts +264 -0
- package/rules/.source/quicktvui/src/progressbar/QTProgressBar.ts +1284 -0
- package/rules/.source/quicktvui/src/progressbar/QtProgressBarAPI.ts +2637 -0
- package/rules/.source/quicktvui/src/qrcode/QTIQRCode.ts +3 -0
- package/rules/.source/quicktvui/src/qrcode/QTQRCodeView.ts +24 -0
- package/rules/.source/quicktvui/src/qrcode/QtQRCodeAPI.ts +9 -0
- package/rules/.source/quicktvui/src/qt/QtAPI.ts +337 -0
- package/rules/.source/quicktvui/src/qt/QtAPIModule.ts +3 -0
- package/rules/.source/quicktvui/src/qt/warning.ts +9 -0
- package/rules/.source/quicktvui/src/qtListen/README.md +76 -0
- package/rules/.source/quicktvui/src/qtListen/effect.ts +141 -0
- package/rules/.source/quicktvui/src/qtListen/index.ts +11 -0
- package/rules/.source/quicktvui/src/qtListen/qtArray.ts +156 -0
- package/rules/.source/quicktvui/src/qtListen/qtDiff.ts +143 -0
- package/rules/.source/quicktvui/src/qtListen/reactive.ts +205 -0
- package/rules/.source/quicktvui/src/qtListen/ref.ts +98 -0
- package/rules/.source/quicktvui/src/qtListen/types.ts +311 -0
- package/rules/.source/quicktvui/src/qtListen/watch.ts +233 -0
- package/rules/.source/quicktvui/src/replace-child/QTIReplaceChildView.ts +5 -0
- package/rules/.source/quicktvui/src/replace-child/QTReplaceChildView.ts +30 -0
- package/rules/.source/quicktvui/src/replace-child/QtReplaceChildViewAPI.ts +37 -0
- package/rules/.source/quicktvui/src/row/QTIRow.ts +3 -0
- package/rules/.source/quicktvui/src/row/QtRowAPI.ts +9 -0
- package/rules/.source/quicktvui/src/row/index.vue +29 -0
- package/rules/.source/quicktvui/src/scroll-view/QTIScrollView.ts +7 -0
- package/rules/.source/quicktvui/src/scroll-view/QTScrollView.ts +45 -0
- package/rules/.source/quicktvui/src/scroll-view/QtScrollViewAPI.ts +62 -0
- package/rules/.source/quicktvui/src/section/index.vue +40 -0
- package/rules/.source/quicktvui/src/seekbar/QTISeekBar.ts +277 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBar.ts +1380 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarGravity.ts +5 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarIndicatorMode.ts +6 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarMode.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkGravity.ts +5 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkLayoutGravity.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QTSeekBarTickMarkMode.ts +4 -0
- package/rules/.source/quicktvui/src/seekbar/QtSeekBarAPI.ts +2645 -0
- package/rules/.source/quicktvui/src/series/DataAdapter.ts +329 -0
- package/rules/.source/quicktvui/src/series/QTIMediaSeries.ts +33 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeries.ts +9 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesData.ts +9 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesDataStyle.ts +4 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesEvent.ts +7 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesGroup.ts +8 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesGroupStyle.ts +58 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesStyleType.ts +5 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesType.ts +8 -0
- package/rules/.source/quicktvui/src/series/QTMediaSeriesVip.ts +4 -0
- package/rules/.source/quicktvui/src/series/QtMediaSeriesAPI.ts +140 -0
- package/rules/.source/quicktvui/src/series/component/media-series.vue +160 -0
- package/rules/.source/quicktvui/src/series/index.vue +316 -0
- package/rules/.source/quicktvui/src/series/item/media-series-number-item.vue +212 -0
- package/rules/.source/quicktvui/src/series/item/media-series-text-item.vue +239 -0
- package/rules/.source/quicktvui/src/tab/QTITab.ts +163 -0
- package/rules/.source/quicktvui/src/tab/QTTab.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabDataManager.ts +620 -0
- package/rules/.source/quicktvui/src/tab/QTTabEvent.ts +11 -0
- package/rules/.source/quicktvui/src/tab/QTTabEventParams.ts +12 -0
- package/rules/.source/quicktvui/src/tab/QTTabIndex.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabItem.ts +5 -0
- package/rules/.source/quicktvui/src/tab/QTTabItemType.ts +3 -0
- package/rules/.source/quicktvui/src/tab/QTTabPage.ts +5 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageData.ts +11 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageDataState.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QTTabPageState.ts +8 -0
- package/rules/.source/quicktvui/src/tab/QtTabAPI.ts +578 -0
- package/rules/.source/quicktvui/src/tab/index.vue +1561 -0
- package/rules/.source/quicktvui/src/tab/useQtTabWatch.ts +203 -0
- package/rules/.source/quicktvui/src/text/QTIText.ts +12 -0
- package/rules/.source/quicktvui/src/text/QTTextSpan.ts +6 -0
- package/rules/.source/quicktvui/src/text/QTTextSpanAttribute.ts +6 -0
- package/rules/.source/quicktvui/src/text/QTTextSpanAttributeType.ts +4 -0
- package/rules/.source/quicktvui/src/text/QtTextAPI.ts +90 -0
- package/rules/.source/quicktvui/src/text/index.vue +44 -0
- package/rules/.source/quicktvui/src/theme/button.css +195 -0
- package/rules/.source/quicktvui/src/typings/shims-vue.d.ts +6 -0
- package/rules/.source/quicktvui/src/ul/QTIUL.ts +34 -0
- package/rules/.source/quicktvui/src/ul/QTULInitPosition.ts +3 -0
- package/rules/.source/quicktvui/src/ul/QtULAPI.ts +232 -0
- package/rules/.source/quicktvui/src/utils/QtVirtualViewAPI.ts +32 -0
- package/rules/.source/quicktvui/src/utils/VirtualView.ts +124 -0
- package/rules/.source/quicktvui/src/utils/functions.ts +1 -0
- package/rules/.source/quicktvui/src/utils/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/make-installer.ts +16 -0
- package/rules/.source/quicktvui/src/utils/objects.ts +4 -0
- package/rules/.source/quicktvui/src/utils/type.ts +1 -0
- package/rules/.source/quicktvui/src/utils/types.ts +42 -0
- package/rules/.source/quicktvui/src/utils/utils.ts +62 -0
- package/rules/.source/quicktvui/src/utils/vue/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/vue/install.ts +48 -0
- package/rules/.source/quicktvui/src/utils/vue/props/index.ts +3 -0
- package/rules/.source/quicktvui/src/utils/vue/props/runtime.ts +129 -0
- package/rules/.source/quicktvui/src/utils/vue/props/types.ts +165 -0
- package/rules/.source/quicktvui/src/utils/vue/props/util.ts +10 -0
- package/rules/.source/quicktvui/src/utils/vue/typescript.ts +9 -0
- package/rules/.source/quicktvui/src/view/QTIView.ts +3 -0
- package/rules/.source/quicktvui/src/view/QTIViewVisibility.ts +5 -0
- package/rules/.source/quicktvui/src/view/QTViewEvent.ts +3 -0
- package/rules/.source/quicktvui/src/view/QTViewState.ts +12 -0
- package/rules/.source/quicktvui/src/view/QtViewAPI.ts +9 -0
- package/rules/.source/quicktvui/src/view/index.vue +24 -0
- package/rules/.source/quicktvui/src/waterfall/QtWaterfallAPI.ts +219 -0
- package/rules/.source/quicktvui/src/waterfall/README.md +143 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTIWaterfall.ts +49 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTScrollState.ts +5 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfall.ts +13 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardItem.ts +11 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardPlaceHolder.ts +10 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallCardSection.ts +12 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallDataAdapter.ts +195 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallDataManager.ts +305 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallEvent.ts +11 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallFlexStyle.ts +19 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallIndex.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallItem.ts +9 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallItemType.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPlaceholder.ts +5 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPluginItem.ts +9 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallPluginSection.ts +8 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallSection.ts +17 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallSectionType.ts +14 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallTabItem.ts +10 -0
- package/rules/.source/quicktvui/src/waterfall/core/QTWaterfallVisibleType.ts +7 -0
- package/rules/.source/quicktvui/src/waterfall/index.vue +704 -0
- package/rules/.source/quicktvui/src/waterfall/item/card-item.vue +49 -0
- package/rules/.source/quicktvui/src/waterfall/item/plugin-item.vue +52 -0
- package/rules/.source/quicktvui/src/waterfall/section/blank-section.vue +27 -0
- package/rules/.source/quicktvui/src/waterfall/section/card-section.vue +81 -0
- package/rules/.source/quicktvui/src/waterfall/section/end-section.vue +50 -0
- package/rules/.source/quicktvui/src/waterfall/section/flex-section.vue +167 -0
- package/rules/.source/quicktvui/src/waterfall/section/list-section.vue +247 -0
- package/rules/.source/quicktvui/src/waterfall/section/loading-section.vue +34 -0
- package/rules/.source/quicktvui/src/waterfall/section/plugin-section.vue +87 -0
- package/rules/.source/quicktvui/src/waterfall/section/section-title.vue +63 -0
- package/rules/.source/quicktvui/src/waterfall/section/vue-section.vue +44 -0
- package/rules/.source/quicktvui/src/webview/QTIWebView.ts +199 -0
- package/rules/.source/quicktvui/src/webview/QTWebView.ts +957 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewInterceptRule.ts +4 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewLayerType.ts +6 -0
- package/rules/.source/quicktvui/src/webview/QTWebViewSniffingRule.ts +18 -0
- package/rules/.source/quicktvui/src/webview/QtWebViewAPI.ts +1963 -0
- package/rules/.source/quicktvui/src/x5webview/QTIX5WebView.ts +211 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebView.ts +1014 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewInterceptRule.ts +4 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewLayerType.ts +6 -0
- package/rules/.source/quicktvui/src/x5webview/QTX5WebViewSniffingRule.ts +18 -0
- package/rules/.source/quicktvui/src/x5webview/QtX5WebViewAPI.ts +2015 -0
- package/rules/.source/quicktvui/tsconfig.json +34 -0
- package/rules/.source/quicktvui/web-types.json +1 -0
- package/rules/.source/quicktvui/yarn.lock +72 -0
- package/rules/.source/web/audio/index.ts +9 -0
- package/rules/.source/web/audio/src/audio.ts +34 -0
- package/rules/.source/web/audio/src/audio.vue +146 -0
- package/rules/.source/web/audio/src/instance.ts +3 -0
- package/rules/.source/web/audio-service/index.ts +10 -0
- package/rules/.source/web/audio-service/src/audio-service.ts +34 -0
- package/rules/.source/web/audio-service/src/audio-service.vue +115 -0
- package/rules/.source/web/audio-service/src/instance.ts +3 -0
- package/rules/.source/web/base/index.ts +1 -0
- package/rules/.source/web/base/src/base-types.ts +1 -0
- package/rules/.source/web/component.ts +25 -0
- package/rules/.source/web/docs/h.txt +6 -0
- package/rules/.source/web/docs/video.txt +88 -0
- package/rules/.source/web/h1/index.ts +9 -0
- package/rules/.source/web/h1/src/h1.ts +9 -0
- package/rules/.source/web/h1/src/h1.vue +30 -0
- package/rules/.source/web/h1/src/instance.ts +3 -0
- package/rules/.source/web/h2/index.ts +9 -0
- package/rules/.source/web/h2/src/h2.ts +9 -0
- package/rules/.source/web/h2/src/h2.vue +30 -0
- package/rules/.source/web/h2/src/instance.ts +3 -0
- package/rules/.source/web/h3/index.ts +9 -0
- package/rules/.source/web/h3/src/h3.ts +9 -0
- package/rules/.source/web/h3/src/h3.vue +30 -0
- package/rules/.source/web/h3/src/instance.ts +3 -0
- package/rules/.source/web/h4/index.ts +9 -0
- package/rules/.source/web/h4/src/h4.ts +9 -0
- package/rules/.source/web/h4/src/h4.vue +30 -0
- package/rules/.source/web/h4/src/instance.ts +3 -0
- package/rules/.source/web/h5/index.ts +9 -0
- package/rules/.source/web/h5/src/h5.ts +9 -0
- package/rules/.source/web/h5/src/h5.vue +30 -0
- package/rules/.source/web/h5/src/instance.ts +3 -0
- package/rules/.source/web/h6/index.ts +9 -0
- package/rules/.source/web/h6/src/h6.ts +9 -0
- package/rules/.source/web/h6/src/h6.vue +30 -0
- package/rules/.source/web/h6/src/instance.ts +3 -0
- package/rules/.source/web/index.ts +84 -0
- package/rules/.source/web/package.json +24 -0
- package/rules/.source/web/plugin.ts +3 -0
- package/rules/.source/web/rollup.config.js +37 -0
- package/rules/.source/web/shims-vue.d.ts +6 -0
- package/rules/.source/web/source/index.ts +9 -0
- package/rules/.source/web/source/src/instance.ts +3 -0
- package/rules/.source/web/source/src/source.ts +17 -0
- package/rules/.source/web/source/src/source.vue +19 -0
- package/rules/.source/web/tsconfig.json +34 -0
- package/rules/.source/web/utils/functions.ts +1 -0
- package/rules/.source/web/utils/index.ts +3 -0
- package/rules/.source/web/utils/make-installer.ts +16 -0
- package/rules/.source/web/utils/objects.ts +4 -0
- package/rules/.source/web/utils/types.ts +42 -0
- package/rules/.source/web/utils/vue/index.ts +3 -0
- package/rules/.source/web/utils/vue/install.ts +48 -0
- package/rules/.source/web/utils/vue/props/index.ts +3 -0
- package/rules/.source/web/utils/vue/props/runtime.ts +129 -0
- package/rules/.source/web/utils/vue/props/types.ts +165 -0
- package/rules/.source/web/utils/vue/props/util.ts +10 -0
- package/rules/.source/web/utils/vue/typescript.ts +9 -0
- package/rules/.source/web/video/index.ts +9 -0
- package/rules/.source/web/video/src/instance.ts +3 -0
- package/rules/.source/web/video/src/video.ts +34 -0
- package/rules/.source/web/video/src/video.vue +171 -0
- package/rules/.windsurfrules +3 -2
- package/rules/AGENTS.md +3 -2
- package/rules/CLAUDE.md +3 -2
- package/rules/GEMINI.md +3 -2
|
@@ -0,0 +1,1930 @@
|
|
|
1
|
+
import registerPageRouteView from "./page/PageRouteView";
|
|
2
|
+
import registerPageView from "./page/PageView";
|
|
3
|
+
import registerSlotRootView from "./slot/SlotRootView";
|
|
4
|
+
import registerSlotView from "./slot/SlotView";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
isRouteName,
|
|
8
|
+
Lazy,
|
|
9
|
+
MatcherLocationRaw,
|
|
10
|
+
NavigationGuardWithThis,
|
|
11
|
+
NavigationHookAfter,
|
|
12
|
+
RouteLocation,
|
|
13
|
+
RouteLocationMatched,
|
|
14
|
+
RouteLocationNormalized,
|
|
15
|
+
RouteLocationNormalizedLoaded,
|
|
16
|
+
RouteLocationOptions,
|
|
17
|
+
RouteLocationRaw,
|
|
18
|
+
RouteParams,
|
|
19
|
+
RouteRecordName,
|
|
20
|
+
RouteRecordRaw,
|
|
21
|
+
START_LOCATION_NORMALIZED,
|
|
22
|
+
} from "./types";
|
|
23
|
+
import {
|
|
24
|
+
HistoryLocation,
|
|
25
|
+
HistoryState,
|
|
26
|
+
NavigationType,
|
|
27
|
+
RouterHistory,
|
|
28
|
+
} from "./history/common";
|
|
29
|
+
import {
|
|
30
|
+
_ScrollPositionNormalized,
|
|
31
|
+
computeScrollPosition,
|
|
32
|
+
getSavedScrollPosition,
|
|
33
|
+
getScrollKey,
|
|
34
|
+
saveScrollPosition,
|
|
35
|
+
ScrollPosition,
|
|
36
|
+
scrollToPosition,
|
|
37
|
+
} from "./scrollBehavior";
|
|
38
|
+
import { createRouterMatcher, PathParserOptions } from "./matcher";
|
|
39
|
+
import {
|
|
40
|
+
createRouterError,
|
|
41
|
+
ErrorTypes,
|
|
42
|
+
isNavigationFailure,
|
|
43
|
+
NavigationFailure,
|
|
44
|
+
NavigationRedirectError,
|
|
45
|
+
} from "./errors";
|
|
46
|
+
import { applyToParams, assign, isArray, isBrowser, noop } from "./utils";
|
|
47
|
+
import { useCallbacks } from "./utils/callbacks";
|
|
48
|
+
import { decode, encodeHash, encodeParam } from "./encoding";
|
|
49
|
+
import {
|
|
50
|
+
LocationQuery,
|
|
51
|
+
normalizeQuery,
|
|
52
|
+
parseQuery as originalParseQuery,
|
|
53
|
+
stringifyQuery as originalStringifyQuery,
|
|
54
|
+
} from "./query";
|
|
55
|
+
import {
|
|
56
|
+
App,
|
|
57
|
+
ComponentPublicInstance,
|
|
58
|
+
computed,
|
|
59
|
+
ComputedRef,
|
|
60
|
+
nextTick,
|
|
61
|
+
reactive,
|
|
62
|
+
Ref,
|
|
63
|
+
ref,
|
|
64
|
+
shallowRef,
|
|
65
|
+
unref,
|
|
66
|
+
} from "vue";
|
|
67
|
+
import {
|
|
68
|
+
ESRouteLaunchMode,
|
|
69
|
+
ESRouteType,
|
|
70
|
+
LifecycleState,
|
|
71
|
+
RouteRecord,
|
|
72
|
+
RouteRecordNormalized,
|
|
73
|
+
} from "./matcher/types";
|
|
74
|
+
import {
|
|
75
|
+
isSameRouteLocation,
|
|
76
|
+
isSameRouteRecord,
|
|
77
|
+
parseURL,
|
|
78
|
+
stringifyURL,
|
|
79
|
+
} from "./location";
|
|
80
|
+
import { extractComponentsGuards, guardToPromiseFn } from "./navigationGuards";
|
|
81
|
+
import { warn } from "./warning";
|
|
82
|
+
import { RouterLink } from "./RouterLink";
|
|
83
|
+
|
|
84
|
+
import { RouterView } from "./RouterView";
|
|
85
|
+
import { SlotView } from "./SlotView";
|
|
86
|
+
|
|
87
|
+
import { RouteResult } from "./result/RouteResult";
|
|
88
|
+
|
|
89
|
+
import {
|
|
90
|
+
nativeRouterKey,
|
|
91
|
+
navigationTypeKey,
|
|
92
|
+
routeLocationKey,
|
|
93
|
+
routerComponentInstanceKey,
|
|
94
|
+
routerHistoryKey,
|
|
95
|
+
routerKey,
|
|
96
|
+
routerRecordRawKey,
|
|
97
|
+
routerViewLocationKey,
|
|
98
|
+
routerViewNameKey,
|
|
99
|
+
routerViewInstanceKey,
|
|
100
|
+
routeViewInstancesKey,
|
|
101
|
+
} from "./injectionSymbols";
|
|
102
|
+
import { addDevtools } from "./devtools";
|
|
103
|
+
import { createESNativeRouterForAndroid } from "./es/ESNativeRouter.android";
|
|
104
|
+
import { createESNativeRouterForHarmony } from "./es/ESNativeRouter.harmony";
|
|
105
|
+
import { info } from "./log/info";
|
|
106
|
+
import { Native } from "@extscreen/es3-vue";
|
|
107
|
+
import { triggerESLifecycle } from "@extscreen/es3-vue";
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Internal type to define an ErrorHandler
|
|
111
|
+
*
|
|
112
|
+
* @param error - error thrown
|
|
113
|
+
* @param to - location we were navigating to when the error happened
|
|
114
|
+
* @param from - location we were navigating from when the error happened
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
export type _ErrorHandler = (
|
|
118
|
+
error: any,
|
|
119
|
+
to: RouteLocationNormalized,
|
|
120
|
+
from: RouteLocationNormalizedLoaded,
|
|
121
|
+
) => any;
|
|
122
|
+
// resolve, reject arguments of Promise constructor
|
|
123
|
+
type OnReadyCallback = [() => void, (reason?: any) => void];
|
|
124
|
+
|
|
125
|
+
type Awaitable<T> = T | Promise<T>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Type of the `scrollBehavior` option that can be passed to `createRouter`.
|
|
129
|
+
*/
|
|
130
|
+
export interface RouterScrollBehavior {
|
|
131
|
+
/**
|
|
132
|
+
* @param to - Route location where we are navigating to
|
|
133
|
+
* @param from - Route location where we are navigating from
|
|
134
|
+
* @param savedPosition - saved position if it exists, `null` otherwise
|
|
135
|
+
*/
|
|
136
|
+
(
|
|
137
|
+
to: RouteLocationNormalized,
|
|
138
|
+
from: RouteLocationNormalizedLoaded,
|
|
139
|
+
savedPosition: _ScrollPositionNormalized | null,
|
|
140
|
+
): Awaitable<ScrollPosition | false | void>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Options to initialize a {@link Router} instance.
|
|
145
|
+
*/
|
|
146
|
+
export interface RouterOptions extends PathParserOptions {
|
|
147
|
+
/**
|
|
148
|
+
* History implementation used by the router. Most web applications should use
|
|
149
|
+
* `createWebHistory` but it requires the server to be properly configured.
|
|
150
|
+
* You can also use a _hash_ based history with `createWebHashHistory` that
|
|
151
|
+
* does not require any configuration on the server but isn't handled at all
|
|
152
|
+
* by search engines and does poorly on SEO.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```js
|
|
156
|
+
* createRouter({
|
|
157
|
+
* history: createWebHistory(),
|
|
158
|
+
* // other options...
|
|
159
|
+
* })
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
history: RouterHistory;
|
|
163
|
+
/**
|
|
164
|
+
* Initial list of routes that should be added to the router.
|
|
165
|
+
*/
|
|
166
|
+
routes: Readonly<RouteRecordRaw[]>;
|
|
167
|
+
/**
|
|
168
|
+
* Function to control scrolling when navigating between pages. Can return a
|
|
169
|
+
* Promise to delay scrolling. Check {@link ScrollBehavior}.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```js
|
|
173
|
+
* function scrollBehavior(to, from, savedPosition) {
|
|
174
|
+
* // `to` and `from` are both route locations
|
|
175
|
+
* // `savedPosition` can be null if there isn't one
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
scrollBehavior?: RouterScrollBehavior;
|
|
180
|
+
/**
|
|
181
|
+
* Custom implementation to parse a query. See its counterpart,
|
|
182
|
+
* {@link RouterOptions.stringifyQuery}.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* Let's say you want to use the [qs package](https://github.com/ljharb/qs)
|
|
186
|
+
* to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
|
|
187
|
+
* ```js
|
|
188
|
+
* import qs from 'qs'
|
|
189
|
+
*
|
|
190
|
+
* createRouter({
|
|
191
|
+
* // other options...
|
|
192
|
+
* parseQuery: qs.parse,
|
|
193
|
+
* stringifyQuery: qs.stringify,
|
|
194
|
+
* })
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
parseQuery?: typeof originalParseQuery;
|
|
198
|
+
/**
|
|
199
|
+
* Custom implementation to stringify a query object. Should not prepend a leading `?`.
|
|
200
|
+
* {@link RouterOptions.parseQuery | parseQuery} counterpart to handle query parsing.
|
|
201
|
+
*/
|
|
202
|
+
stringifyQuery?: typeof originalStringifyQuery;
|
|
203
|
+
/**
|
|
204
|
+
* Default class applied to active {@link RouterLink}. If none is provided,
|
|
205
|
+
* `router-link-active` will be applied.
|
|
206
|
+
*/
|
|
207
|
+
linkActiveClass?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Default class applied to exact active {@link RouterLink}. If none is provided,
|
|
210
|
+
* `router-link-exact-active` will be applied.
|
|
211
|
+
*/
|
|
212
|
+
linkExactActiveClass?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Default class applied to non-active {@link RouterLink}. If none is provided,
|
|
215
|
+
* `router-link-inactive` will be applied.
|
|
216
|
+
*/
|
|
217
|
+
// linkInactiveClass?: string
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* router history stack limit number
|
|
221
|
+
*/
|
|
222
|
+
limit?: number;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* main router
|
|
226
|
+
*/
|
|
227
|
+
main?: string;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* error router
|
|
231
|
+
*/
|
|
232
|
+
error?: string;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* types
|
|
236
|
+
*/
|
|
237
|
+
types: Array<ESRouteType>;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Router instance.
|
|
242
|
+
*/
|
|
243
|
+
export interface Router {
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
// readonly history: RouterHistory
|
|
248
|
+
/**
|
|
249
|
+
* Current {@link RouteLocationNormalized}
|
|
250
|
+
*/
|
|
251
|
+
readonly currentRoute: Ref<RouteLocationNormalizedLoaded>;
|
|
252
|
+
/**
|
|
253
|
+
* Original options object passed to create the Router
|
|
254
|
+
*/
|
|
255
|
+
readonly options: RouterOptions;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Allows turning off the listening of history events. This is a low level api for micro-frontends.
|
|
259
|
+
*/
|
|
260
|
+
listening: boolean;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
|
|
264
|
+
*
|
|
265
|
+
* @param parentName - Parent Route Record where `route` should be appended at
|
|
266
|
+
* @param route - Route Record to add
|
|
267
|
+
*/
|
|
268
|
+
addRoute(parentName: RouteRecordName, route: RouteRecordRaw): () => void;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Add a new {@link RouteRecordRaw | route record} to the router.
|
|
272
|
+
*
|
|
273
|
+
* @param route - Route Record to add
|
|
274
|
+
*/
|
|
275
|
+
addRoute(route: RouteRecordRaw): () => void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Remove an existing route by its name.
|
|
279
|
+
*
|
|
280
|
+
* @param name - Name of the route to remove
|
|
281
|
+
*/
|
|
282
|
+
removeRoute(name: RouteRecordName): void;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Checks if a route with a given name exists
|
|
286
|
+
*
|
|
287
|
+
* @param name - Name of the route to check
|
|
288
|
+
*/
|
|
289
|
+
hasRoute(name: RouteRecordName): boolean;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Get a full list of all the {@link RouteRecord | route records}.
|
|
293
|
+
*/
|
|
294
|
+
getRoutes(): RouteRecord[];
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
*
|
|
298
|
+
*/
|
|
299
|
+
getRouterHistory(): RouterHistory;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get RouteRecord | route records.
|
|
303
|
+
* @param name - Name of the route to check
|
|
304
|
+
*/
|
|
305
|
+
getRoute(name: RouteRecordName): RouteRecord | undefined;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Returns the {@link RouteLocation | normalized version} of a
|
|
309
|
+
* {@link RouteLocationRaw | route location}. Also includes an `href` property
|
|
310
|
+
* that includes any existing `base`. By default, the `currentLocation` used is
|
|
311
|
+
* `router.currentRoute` and should only be overridden in advanced use cases.
|
|
312
|
+
*
|
|
313
|
+
* @param to - Raw route location to resolve
|
|
314
|
+
* @param currentLocation - Optional current location to resolve against
|
|
315
|
+
*/
|
|
316
|
+
resolve(
|
|
317
|
+
to: RouteLocationRaw,
|
|
318
|
+
currentLocation?: RouteLocationNormalizedLoaded,
|
|
319
|
+
): RouteLocation & { href: string };
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Programmatically navigate to a new URL by pushing an entry in the history
|
|
323
|
+
* stack.
|
|
324
|
+
*
|
|
325
|
+
* @param to - Route location to navigate to
|
|
326
|
+
*/
|
|
327
|
+
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Programmatically navigate to a new URL by replacing the current entry in
|
|
331
|
+
* the history stack.
|
|
332
|
+
*
|
|
333
|
+
* @param to - Route location to navigate to
|
|
334
|
+
*/
|
|
335
|
+
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
*
|
|
339
|
+
* @param to - Route location to navigate to
|
|
340
|
+
*/
|
|
341
|
+
splice(to: RouteLocationRaw): boolean;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
*
|
|
345
|
+
* @param result
|
|
346
|
+
*/
|
|
347
|
+
setResult(result: RouteResult): Promise<any>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Go back in history if possible by calling `history.back()`. Equivalent to
|
|
351
|
+
* `router.go(-1)`.
|
|
352
|
+
*/
|
|
353
|
+
back(): ReturnType<Router["go"]>;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Go forward in history if possible by calling `history.forward()`.
|
|
357
|
+
* Equivalent to `router.go(1)`.
|
|
358
|
+
*/
|
|
359
|
+
forward(): ReturnType<Router["go"]>;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Allows you to move forward or backward through the history. Calls
|
|
363
|
+
* `history.go()`.
|
|
364
|
+
*
|
|
365
|
+
* @param delta - The position in the history to which you want to move,
|
|
366
|
+
* relative to the current page
|
|
367
|
+
*/
|
|
368
|
+
go(delta: number): boolean;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Add a navigation guard that executes before any navigation. Returns a
|
|
372
|
+
* function that removes the registered guard.
|
|
373
|
+
*
|
|
374
|
+
* @param guard - navigation guard to add
|
|
375
|
+
*/
|
|
376
|
+
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Add a navigation guard that executes before navigation is about to be
|
|
380
|
+
* resolved. At this state all component have been fetched and other
|
|
381
|
+
* navigation guards have been successful. Returns a function that removes the
|
|
382
|
+
* registered guard.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```js
|
|
386
|
+
* router.beforeResolve(to => {
|
|
387
|
+
* if (to.meta.requiresAuth && !isAuthenticated) return false
|
|
388
|
+
* })
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* @param guard - navigation guard to add
|
|
392
|
+
*/
|
|
393
|
+
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Add a navigation hook that is executed after every navigation. Returns a
|
|
397
|
+
* function that removes the registered hook.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```js
|
|
401
|
+
* router.afterEach((to, from, failure) => {
|
|
402
|
+
* if (isNavigationFailure(failure)) {
|
|
403
|
+
* console.log('failed navigation', failure)
|
|
404
|
+
* }
|
|
405
|
+
* })
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* @param guard - navigation hook to add
|
|
409
|
+
*/
|
|
410
|
+
afterEach(guard: NavigationHookAfter): () => void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Adds an error handler that is called every time a non caught error happens
|
|
414
|
+
* during navigation. This includes errors thrown synchronously and
|
|
415
|
+
* asynchronously, errors returned or passed to `next` in any navigation
|
|
416
|
+
* guard, and errors occurred when trying to resolve an async component that
|
|
417
|
+
* is required to render a route.
|
|
418
|
+
*
|
|
419
|
+
* @param handler - error handler to register
|
|
420
|
+
*/
|
|
421
|
+
onError(handler: _ErrorHandler): () => void;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Returns a Promise that resolves when the router has completed the initial
|
|
425
|
+
* navigation, which means it has resolved all async enter hooks and async
|
|
426
|
+
* components that are associated with the initial route. If the initial
|
|
427
|
+
* navigation already happened, the promise resolves immediately.
|
|
428
|
+
*
|
|
429
|
+
* This is useful in server-side rendering to ensure consistent output on both
|
|
430
|
+
* the server and the client. Note that on server side, you need to manually
|
|
431
|
+
* push the initial location while on client side, the router automatically
|
|
432
|
+
* picks it up from the URL.
|
|
433
|
+
*/
|
|
434
|
+
isReady(): Promise<void>;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Called automatically by `app.use(router)`. Should not be called manually by
|
|
438
|
+
* the user. This will trigger the initial navigation when on client side.
|
|
439
|
+
*
|
|
440
|
+
* @internal
|
|
441
|
+
* @param app - Application that uses the router
|
|
442
|
+
*/
|
|
443
|
+
install(app: App): void;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 当前是否处于前台
|
|
447
|
+
*/
|
|
448
|
+
readonly active: boolean;
|
|
449
|
+
|
|
450
|
+
setActive(active: boolean): void;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Creates a Router instance that can be used by a Vue app.
|
|
455
|
+
*
|
|
456
|
+
* @param options - {@link RouterOptions}
|
|
457
|
+
*/
|
|
458
|
+
export function createRouter(options: RouterOptions): Router {
|
|
459
|
+
const matcher = createRouterMatcher(options.routes, options);
|
|
460
|
+
const parseQuery = options.parseQuery || originalParseQuery;
|
|
461
|
+
const stringifyQuery = options.stringifyQuery || originalStringifyQuery;
|
|
462
|
+
const routerHistory = options.history;
|
|
463
|
+
const routeRecordRawList: RouteLocationRaw[] = options.routes;
|
|
464
|
+
const limit: number | undefined = options.limit;
|
|
465
|
+
const routeTypes: Array<ESRouteType> = options.types;
|
|
466
|
+
|
|
467
|
+
//---------------------------------------------------------------
|
|
468
|
+
const _active = ref(true);
|
|
469
|
+
|
|
470
|
+
function getActive(): boolean {
|
|
471
|
+
return _active.value;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function setActive(active: boolean): void {
|
|
475
|
+
info("router setActive:", active);
|
|
476
|
+
_active.value = active;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
//---------------------------------------------------------------
|
|
480
|
+
|
|
481
|
+
function isSupportSlotType() {
|
|
482
|
+
const index = routeTypes.findIndex(
|
|
483
|
+
(type) => type == ESRouteType.ES_ROUTE_TYPE_SLOT,
|
|
484
|
+
);
|
|
485
|
+
return index > -1;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
//原生路由
|
|
489
|
+
const nativeRouter = Native.isAndroid()
|
|
490
|
+
? createESNativeRouterForAndroid(isSupportSlotType())
|
|
491
|
+
: createESNativeRouterForHarmony(isSupportSlotType());
|
|
492
|
+
|
|
493
|
+
if (__DEV__ && !routerHistory)
|
|
494
|
+
throw new Error(
|
|
495
|
+
'Provide the "history" option when calling "createRouter()":' +
|
|
496
|
+
" https://next.router.vuejs.org/api/#history.",
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const beforeGuards = useCallbacks<NavigationGuardWithThis<undefined>>();
|
|
500
|
+
const beforeResolveGuards =
|
|
501
|
+
useCallbacks<NavigationGuardWithThis<undefined>>();
|
|
502
|
+
const afterGuards = useCallbacks<NavigationHookAfter>();
|
|
503
|
+
const currentRoute = shallowRef<RouteLocationNormalizedLoaded>(
|
|
504
|
+
START_LOCATION_NORMALIZED,
|
|
505
|
+
);
|
|
506
|
+
let pendingLocation: RouteLocation = START_LOCATION_NORMALIZED;
|
|
507
|
+
|
|
508
|
+
//
|
|
509
|
+
const navigationType = shallowRef<NavigationType>(NavigationType.push);
|
|
510
|
+
|
|
511
|
+
//router view name : default
|
|
512
|
+
const routerViewName = shallowRef<string>();
|
|
513
|
+
|
|
514
|
+
//
|
|
515
|
+
const routerComponentInstance = ref<ComponentPublicInstance | undefined>();
|
|
516
|
+
const routerViewInstance = ref<ComponentPublicInstance | undefined>();
|
|
517
|
+
const routeViewInstanceList: Ref<ComponentPublicInstance | undefined>[] = [];
|
|
518
|
+
// leave the scrollRestoration if no scrollBehavior is provided
|
|
519
|
+
if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) {
|
|
520
|
+
history.scrollRestoration = "manual";
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const normalizeParams = applyToParams.bind(
|
|
524
|
+
null,
|
|
525
|
+
(paramValue) => "" + paramValue,
|
|
526
|
+
);
|
|
527
|
+
const encodeParams = applyToParams.bind(null, encodeParam);
|
|
528
|
+
const decodeParams: (params: RouteParams | undefined) => RouteParams =
|
|
529
|
+
// @ts-expect-error: intentionally avoid the type check
|
|
530
|
+
applyToParams.bind(null, decode);
|
|
531
|
+
|
|
532
|
+
function addRoute(
|
|
533
|
+
parentOrRoute: RouteRecordName | RouteRecordRaw,
|
|
534
|
+
route?: RouteRecordRaw,
|
|
535
|
+
) {
|
|
536
|
+
let parent: Parameters<(typeof matcher)["addRoute"]>[1] | undefined;
|
|
537
|
+
let record: RouteRecordRaw;
|
|
538
|
+
if (isRouteName(parentOrRoute)) {
|
|
539
|
+
parent = matcher.getRecordMatcher(parentOrRoute);
|
|
540
|
+
record = route!;
|
|
541
|
+
} else {
|
|
542
|
+
record = parentOrRoute;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return matcher.addRoute(record, parent);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function removeRoute(name: RouteRecordName) {
|
|
549
|
+
const recordMatcher = matcher.getRecordMatcher(name);
|
|
550
|
+
if (recordMatcher) {
|
|
551
|
+
matcher.removeRoute(recordMatcher);
|
|
552
|
+
} else if (__DEV__) {
|
|
553
|
+
warn(`Cannot remove non-existent route "${String(name)}"`);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function getRoutes() {
|
|
558
|
+
return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function getRouterHistory() {
|
|
562
|
+
return routerHistory;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function getRoute(name: RouteRecordName) {
|
|
566
|
+
const routeRecordMatcher = matcher.getRecordMatcher(name);
|
|
567
|
+
if (routeRecordMatcher) {
|
|
568
|
+
return routeRecordMatcher.record;
|
|
569
|
+
}
|
|
570
|
+
return undefined;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function hasRoute(name: RouteRecordName): boolean {
|
|
574
|
+
return !!matcher.getRecordMatcher(name);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function resolve(
|
|
578
|
+
rawLocation: Readonly<RouteLocationRaw>,
|
|
579
|
+
currentLocation?: RouteLocationNormalizedLoaded,
|
|
580
|
+
): RouteLocation & { href: string } {
|
|
581
|
+
//
|
|
582
|
+
let key: string = new Date().getTime().toString();
|
|
583
|
+
|
|
584
|
+
// const objectLocation = routerLocationAsObject(rawLocation)
|
|
585
|
+
// we create a copy to modify it later
|
|
586
|
+
currentLocation = assign({}, currentLocation || currentRoute.value);
|
|
587
|
+
if (typeof rawLocation === "string") {
|
|
588
|
+
const locationNormalized = parseURL(
|
|
589
|
+
parseQuery,
|
|
590
|
+
rawLocation,
|
|
591
|
+
currentLocation.path,
|
|
592
|
+
);
|
|
593
|
+
const matchedRoute = matcher.resolve(
|
|
594
|
+
{ path: locationNormalized.path },
|
|
595
|
+
currentLocation,
|
|
596
|
+
);
|
|
597
|
+
|
|
598
|
+
const href = routerHistory.createHref(locationNormalized.fullPath);
|
|
599
|
+
if (__DEV__) {
|
|
600
|
+
if (href.startsWith("//"))
|
|
601
|
+
warn(
|
|
602
|
+
`Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.`,
|
|
603
|
+
);
|
|
604
|
+
else if (!matchedRoute.matched.length) {
|
|
605
|
+
warn(`No match found for location with path "${rawLocation}"`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// locationNormalized is always a new object
|
|
610
|
+
return assign(locationNormalized, matchedRoute, {
|
|
611
|
+
key: key,
|
|
612
|
+
params: decodeParams(matchedRoute.params),
|
|
613
|
+
hash: decode(locationNormalized.hash),
|
|
614
|
+
redirectedFrom: undefined,
|
|
615
|
+
href,
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let matcherLocation: MatcherLocationRaw;
|
|
620
|
+
|
|
621
|
+
// path could be relative in object as well
|
|
622
|
+
if ("path" in rawLocation) {
|
|
623
|
+
if (
|
|
624
|
+
__DEV__ &&
|
|
625
|
+
"params" in rawLocation &&
|
|
626
|
+
!("name" in rawLocation) &&
|
|
627
|
+
// @ts-expect-error: the type is never
|
|
628
|
+
Object.keys(rawLocation.params).length
|
|
629
|
+
) {
|
|
630
|
+
warn(
|
|
631
|
+
`Path "${rawLocation.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`,
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
matcherLocation = assign({}, rawLocation, {
|
|
635
|
+
path: parseURL(parseQuery, rawLocation.path, currentLocation.path).path,
|
|
636
|
+
});
|
|
637
|
+
} else {
|
|
638
|
+
// remove any nullish param
|
|
639
|
+
const targetParams = assign({}, rawLocation.params);
|
|
640
|
+
for (const key in targetParams) {
|
|
641
|
+
if (targetParams[key] == null) {
|
|
642
|
+
delete targetParams[key];
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
// pass encoded values to the matcher, so it can produce encoded path and fullPath
|
|
646
|
+
matcherLocation = assign({}, rawLocation, {
|
|
647
|
+
params: encodeParams(targetParams),
|
|
648
|
+
});
|
|
649
|
+
// current location params are decoded, we need to encode them in case the
|
|
650
|
+
// matcher merges the params
|
|
651
|
+
currentLocation.params = encodeParams(currentLocation.params);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
|
|
655
|
+
const hash = rawLocation.hash || "";
|
|
656
|
+
|
|
657
|
+
if (__DEV__ && hash && !hash.startsWith("#")) {
|
|
658
|
+
warn(
|
|
659
|
+
`A \`hash\` should always start with the character "#". Replace "${hash}" with "#${hash}".`,
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// the matcher might have merged current location params, so
|
|
664
|
+
// we need to run the decoding again
|
|
665
|
+
matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
|
|
666
|
+
|
|
667
|
+
const fullPath = stringifyURL(
|
|
668
|
+
stringifyQuery,
|
|
669
|
+
assign({}, rawLocation, {
|
|
670
|
+
hash: encodeHash(hash),
|
|
671
|
+
path: matchedRoute.path,
|
|
672
|
+
}),
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
const href = routerHistory.createHref(fullPath);
|
|
676
|
+
if (__DEV__) {
|
|
677
|
+
if (href.startsWith("//")) {
|
|
678
|
+
warn(
|
|
679
|
+
`Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.`,
|
|
680
|
+
);
|
|
681
|
+
} else if (!matchedRoute.matched.length) {
|
|
682
|
+
warn(
|
|
683
|
+
`No match found for location with path "${
|
|
684
|
+
"path" in rawLocation ? rawLocation.path : rawLocation
|
|
685
|
+
}"`,
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
let resultCallback = {};
|
|
691
|
+
|
|
692
|
+
if (typeof rawLocation === "object") {
|
|
693
|
+
const rawKey = (rawLocation as RouteLocationOptions).key;
|
|
694
|
+
if (rawKey) {
|
|
695
|
+
key = rawKey;
|
|
696
|
+
}
|
|
697
|
+
//
|
|
698
|
+
const callback = (rawLocation as RouteLocationOptions).resultCallback;
|
|
699
|
+
if (callback) {
|
|
700
|
+
resultCallback = {
|
|
701
|
+
resultCallback: callback,
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* TODO LIULIPENG 参数转换
|
|
708
|
+
*/
|
|
709
|
+
return assign(
|
|
710
|
+
{
|
|
711
|
+
key: key,
|
|
712
|
+
fullPath,
|
|
713
|
+
// keep the hash encoded so fullPath is effectively path + encodedQuery +
|
|
714
|
+
// hash
|
|
715
|
+
hash,
|
|
716
|
+
query:
|
|
717
|
+
// if the user is using a custom query lib like qs, we might have
|
|
718
|
+
// nested objects, so we keep the query as is, meaning it can contain
|
|
719
|
+
// numbers at `$route.query`, but at the point, the user will have to
|
|
720
|
+
// use their own type anyway.
|
|
721
|
+
// https://github.com/vuejs/router/issues/328#issuecomment-649481567
|
|
722
|
+
stringifyQuery === originalStringifyQuery
|
|
723
|
+
? normalizeQuery(rawLocation.query)
|
|
724
|
+
: ((rawLocation.query || {}) as LocationQuery),
|
|
725
|
+
},
|
|
726
|
+
matchedRoute,
|
|
727
|
+
{
|
|
728
|
+
redirectedFrom: undefined,
|
|
729
|
+
href,
|
|
730
|
+
},
|
|
731
|
+
resultCallback,
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function locationAsObject(
|
|
736
|
+
to: RouteLocationRaw | RouteLocationNormalized,
|
|
737
|
+
): Exclude<RouteLocationRaw, string> | RouteLocationNormalized {
|
|
738
|
+
return typeof to === "string"
|
|
739
|
+
? parseURL(parseQuery, to, currentRoute.value.path)
|
|
740
|
+
: assign({}, to);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function checkCanceledNavigation(
|
|
744
|
+
to: RouteLocationNormalized,
|
|
745
|
+
from: RouteLocationNormalized,
|
|
746
|
+
): NavigationFailure | void {
|
|
747
|
+
if (pendingLocation !== to) {
|
|
748
|
+
return createRouterError<NavigationFailure>(
|
|
749
|
+
ErrorTypes.NAVIGATION_CANCELLED,
|
|
750
|
+
{
|
|
751
|
+
from,
|
|
752
|
+
to,
|
|
753
|
+
},
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function setResult(result: RouteResult): Promise<any> {
|
|
759
|
+
try {
|
|
760
|
+
const historyLocationList = routerHistory.getHistoryLocations();
|
|
761
|
+
if (historyLocationList && historyLocationList.length > 0) {
|
|
762
|
+
const topHistoryLocation: HistoryLocation =
|
|
763
|
+
historyLocationList[historyLocationList.length - 1];
|
|
764
|
+
console.log(
|
|
765
|
+
"ESRouter:setResult: route:",
|
|
766
|
+
topHistoryLocation.location,
|
|
767
|
+
" lifecycle:" + topHistoryLocation.lifecycle,
|
|
768
|
+
);
|
|
769
|
+
if (topHistoryLocation && topHistoryLocation.resultCallback) {
|
|
770
|
+
const ret = topHistoryLocation.resultCallback.onResult(result);
|
|
771
|
+
console.log("ESRouter:setResult: onResult:", ret);
|
|
772
|
+
if (ret instanceof Promise) {
|
|
773
|
+
return ret as Promise<any>;
|
|
774
|
+
}
|
|
775
|
+
return Promise.resolve();
|
|
776
|
+
} else {
|
|
777
|
+
console.log("ESRouter:setResult: resultCallback is null ...");
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
} catch (e) {
|
|
781
|
+
console.log("ESRouter:setResult: error", e);
|
|
782
|
+
}
|
|
783
|
+
return Promise.reject();
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function push(to: RouteLocationRaw) {
|
|
787
|
+
navigationType.value = NavigationType.push;
|
|
788
|
+
return pushWithRedirect(to);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function replace(to: RouteLocationRaw) {
|
|
792
|
+
navigationType.value = NavigationType.pop;
|
|
793
|
+
return push(assign(locationAsObject(to), { replace: true }));
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
function splice(to: RouteLocationRaw): boolean {
|
|
797
|
+
navigationType.value = NavigationType.splice;
|
|
798
|
+
const targetLocation: RouteLocation = (pendingLocation = resolve(to));
|
|
799
|
+
const toLocation = targetLocation as RouteLocationNormalized;
|
|
800
|
+
const location = resolveHistoryLocation(
|
|
801
|
+
toLocation.key,
|
|
802
|
+
toLocation.fullPath,
|
|
803
|
+
toLocation.resultCallback,
|
|
804
|
+
);
|
|
805
|
+
//
|
|
806
|
+
let ret = routerHistory.splice(location);
|
|
807
|
+
console.log("ESRouter:splice location: ", location, "result:" + ret);
|
|
808
|
+
return ret;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
function handleRedirectRecord(to: RouteLocation): RouteLocationRaw | void {
|
|
812
|
+
const lastMatched = to.matched[to.matched.length - 1];
|
|
813
|
+
if (lastMatched && lastMatched.redirect) {
|
|
814
|
+
const { redirect } = lastMatched;
|
|
815
|
+
let newTargetLocation =
|
|
816
|
+
typeof redirect === "function" ? redirect(to) : redirect;
|
|
817
|
+
|
|
818
|
+
if (typeof newTargetLocation === "string") {
|
|
819
|
+
newTargetLocation =
|
|
820
|
+
newTargetLocation.includes("?") || newTargetLocation.includes("#")
|
|
821
|
+
? (newTargetLocation = locationAsObject(newTargetLocation))
|
|
822
|
+
: // force empty params
|
|
823
|
+
{ path: newTargetLocation };
|
|
824
|
+
// @ts-expect-error: force empty params when a string is passed to let
|
|
825
|
+
// the router parse them again
|
|
826
|
+
newTargetLocation.params = {};
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (
|
|
830
|
+
__DEV__ &&
|
|
831
|
+
!("path" in newTargetLocation) &&
|
|
832
|
+
!("name" in newTargetLocation)
|
|
833
|
+
) {
|
|
834
|
+
warn(
|
|
835
|
+
`Invalid redirect found:\n${JSON.stringify(
|
|
836
|
+
newTargetLocation,
|
|
837
|
+
null,
|
|
838
|
+
2,
|
|
839
|
+
)}\n when navigating to "${
|
|
840
|
+
to.fullPath
|
|
841
|
+
}". A redirect must contain a name or path. This will break in production.`,
|
|
842
|
+
);
|
|
843
|
+
throw new Error("Invalid redirect");
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
return assign(
|
|
847
|
+
{
|
|
848
|
+
query: to.query,
|
|
849
|
+
hash: to.hash,
|
|
850
|
+
// avoid transferring params if the redirect has a path
|
|
851
|
+
params: "path" in newTargetLocation ? {} : to.params,
|
|
852
|
+
},
|
|
853
|
+
newTargetLocation,
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function pushWithRedirect(
|
|
859
|
+
to: RouteLocationRaw | RouteLocation,
|
|
860
|
+
redirectedFrom?: RouteLocation,
|
|
861
|
+
): Promise<NavigationFailure | void | undefined> {
|
|
862
|
+
const targetLocation: RouteLocation = (pendingLocation = resolve(to));
|
|
863
|
+
const from = currentRoute.value;
|
|
864
|
+
const data: HistoryState | undefined = (to as RouteLocationOptions).state;
|
|
865
|
+
const force: boolean | undefined = (to as RouteLocationOptions).force;
|
|
866
|
+
// to could be a string where `replace` is a function
|
|
867
|
+
const replace = (to as RouteLocationOptions).replace === true;
|
|
868
|
+
|
|
869
|
+
const shouldRedirect = handleRedirectRecord(targetLocation);
|
|
870
|
+
|
|
871
|
+
if (shouldRedirect)
|
|
872
|
+
return pushWithRedirect(
|
|
873
|
+
assign(locationAsObject(shouldRedirect), {
|
|
874
|
+
state:
|
|
875
|
+
typeof shouldRedirect === "object"
|
|
876
|
+
? assign({}, data, shouldRedirect.state)
|
|
877
|
+
: data,
|
|
878
|
+
force,
|
|
879
|
+
replace,
|
|
880
|
+
}),
|
|
881
|
+
// keep original redirectedFrom if it exists
|
|
882
|
+
redirectedFrom || targetLocation,
|
|
883
|
+
);
|
|
884
|
+
|
|
885
|
+
// if it was a redirect we already called `pushWithRedirect` above
|
|
886
|
+
const toLocation = targetLocation as RouteLocationNormalized;
|
|
887
|
+
|
|
888
|
+
toLocation.redirectedFrom = redirectedFrom;
|
|
889
|
+
let failure: NavigationFailure | void | undefined;
|
|
890
|
+
return (failure ? Promise.resolve(failure) : navigate(toLocation, from))
|
|
891
|
+
.catch((error: NavigationFailure | NavigationRedirectError) =>
|
|
892
|
+
isNavigationFailure(error)
|
|
893
|
+
? // navigation redirects still mark the router as ready
|
|
894
|
+
isNavigationFailure(error, ErrorTypes.NAVIGATION_GUARD_REDIRECT)
|
|
895
|
+
? error
|
|
896
|
+
: markAsReady(error) // also returns the error
|
|
897
|
+
: // reject any unknown error
|
|
898
|
+
triggerError(error, toLocation, from),
|
|
899
|
+
)
|
|
900
|
+
.then((failure: NavigationFailure | NavigationRedirectError | void) => {
|
|
901
|
+
if (failure) {
|
|
902
|
+
if (
|
|
903
|
+
isNavigationFailure(failure, ErrorTypes.NAVIGATION_GUARD_REDIRECT)
|
|
904
|
+
) {
|
|
905
|
+
if (
|
|
906
|
+
__DEV__ &&
|
|
907
|
+
// we are redirecting to the same location we were already at
|
|
908
|
+
isSameRouteLocation(
|
|
909
|
+
stringifyQuery,
|
|
910
|
+
resolve(failure.to),
|
|
911
|
+
toLocation,
|
|
912
|
+
) &&
|
|
913
|
+
// and we have done it a couple of times
|
|
914
|
+
redirectedFrom &&
|
|
915
|
+
// @ts-expect-error: added only in dev
|
|
916
|
+
(redirectedFrom._count = redirectedFrom._count
|
|
917
|
+
? // @ts-expect-error
|
|
918
|
+
redirectedFrom._count + 1
|
|
919
|
+
: 1) > 30
|
|
920
|
+
) {
|
|
921
|
+
warn(
|
|
922
|
+
`Detected a possibly infinite redirection in a navigation guard when going from "${from.fullPath}" to "${toLocation.fullPath}". Aborting to avoid a Stack Overflow.\n Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`,
|
|
923
|
+
);
|
|
924
|
+
return Promise.reject(
|
|
925
|
+
new Error("Infinite redirect in navigation guard"),
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
return pushWithRedirect(
|
|
930
|
+
// keep options
|
|
931
|
+
assign(
|
|
932
|
+
{
|
|
933
|
+
// preserve an existing replacement but allow the redirect to override it
|
|
934
|
+
replace,
|
|
935
|
+
},
|
|
936
|
+
locationAsObject(failure.to),
|
|
937
|
+
{
|
|
938
|
+
state:
|
|
939
|
+
typeof failure.to === "object"
|
|
940
|
+
? assign({}, data, failure.to.state)
|
|
941
|
+
: data,
|
|
942
|
+
force,
|
|
943
|
+
},
|
|
944
|
+
),
|
|
945
|
+
// preserve the original redirectedFrom if any
|
|
946
|
+
redirectedFrom || toLocation,
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
} else {
|
|
950
|
+
// if we fail we don't finalize the navigation
|
|
951
|
+
failure = finalizeNavigation(
|
|
952
|
+
toLocation as RouteLocationNormalizedLoaded,
|
|
953
|
+
from,
|
|
954
|
+
true,
|
|
955
|
+
replace,
|
|
956
|
+
data,
|
|
957
|
+
);
|
|
958
|
+
}
|
|
959
|
+
triggerAfterEach(
|
|
960
|
+
toLocation as RouteLocationNormalizedLoaded,
|
|
961
|
+
from,
|
|
962
|
+
failure,
|
|
963
|
+
);
|
|
964
|
+
return failure;
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Helper to reject and skip all navigation guards if a new navigation happened
|
|
970
|
+
* @param to
|
|
971
|
+
* @param from
|
|
972
|
+
*/
|
|
973
|
+
function checkCanceledNavigationAndReject(
|
|
974
|
+
to: RouteLocationNormalized,
|
|
975
|
+
from: RouteLocationNormalized,
|
|
976
|
+
): Promise<void> {
|
|
977
|
+
const error = checkCanceledNavigation(to, from);
|
|
978
|
+
return error ? Promise.reject(error) : Promise.resolve();
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
function runWithContext<T>(fn: () => T): T {
|
|
982
|
+
const app: App | undefined = installedApps.values().next().value;
|
|
983
|
+
// support Vue < 3.3
|
|
984
|
+
return app && typeof app.runWithContext === "function"
|
|
985
|
+
? app.runWithContext(fn)
|
|
986
|
+
: fn();
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
// TODO: refactor the whole before guards by internally using router.beforeEach
|
|
990
|
+
|
|
991
|
+
function navigate(
|
|
992
|
+
to: RouteLocationNormalized,
|
|
993
|
+
from: RouteLocationNormalizedLoaded,
|
|
994
|
+
): Promise<any> {
|
|
995
|
+
let guards: Lazy<any>[];
|
|
996
|
+
|
|
997
|
+
const [leavingRecords, updatingRecords, enteringRecords] =
|
|
998
|
+
extractChangingRecords(to, from);
|
|
999
|
+
|
|
1000
|
+
// all components here have been resolved once because we are leaving
|
|
1001
|
+
guards = extractComponentsGuards(
|
|
1002
|
+
leavingRecords.reverse(),
|
|
1003
|
+
"beforeRouteLeave",
|
|
1004
|
+
to,
|
|
1005
|
+
from,
|
|
1006
|
+
);
|
|
1007
|
+
|
|
1008
|
+
// leavingRecords is already reversed
|
|
1009
|
+
for (const record of leavingRecords) {
|
|
1010
|
+
record.leaveGuards.forEach((guard) => {
|
|
1011
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(
|
|
1016
|
+
null,
|
|
1017
|
+
to,
|
|
1018
|
+
from,
|
|
1019
|
+
);
|
|
1020
|
+
|
|
1021
|
+
guards.push(canceledNavigationCheck);
|
|
1022
|
+
|
|
1023
|
+
// run the queue of per route beforeRouteLeave guards
|
|
1024
|
+
return (
|
|
1025
|
+
runGuardQueue(guards)
|
|
1026
|
+
.then(() => {
|
|
1027
|
+
// check global guards beforeEach
|
|
1028
|
+
guards = [];
|
|
1029
|
+
for (const guard of beforeGuards.list()) {
|
|
1030
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
1031
|
+
}
|
|
1032
|
+
guards.push(canceledNavigationCheck);
|
|
1033
|
+
|
|
1034
|
+
return runGuardQueue(guards);
|
|
1035
|
+
})
|
|
1036
|
+
.then(() => {
|
|
1037
|
+
// check in components beforeRouteUpdate
|
|
1038
|
+
guards = extractComponentsGuards(
|
|
1039
|
+
updatingRecords,
|
|
1040
|
+
"beforeRouteUpdate",
|
|
1041
|
+
to,
|
|
1042
|
+
from,
|
|
1043
|
+
);
|
|
1044
|
+
|
|
1045
|
+
for (const record of updatingRecords) {
|
|
1046
|
+
record.updateGuards.forEach((guard) => {
|
|
1047
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
guards.push(canceledNavigationCheck);
|
|
1051
|
+
|
|
1052
|
+
// run the queue of per route beforeEnter guards
|
|
1053
|
+
return runGuardQueue(guards);
|
|
1054
|
+
})
|
|
1055
|
+
.then(() => {
|
|
1056
|
+
// check the route beforeEnter
|
|
1057
|
+
guards = [];
|
|
1058
|
+
for (const record of to.matched) {
|
|
1059
|
+
// do not trigger beforeEnter on reused views
|
|
1060
|
+
if (record.beforeEnter && !from.matched.includes(record)) {
|
|
1061
|
+
if (isArray(record.beforeEnter)) {
|
|
1062
|
+
for (const beforeEnter of record.beforeEnter)
|
|
1063
|
+
guards.push(guardToPromiseFn(beforeEnter, to, from));
|
|
1064
|
+
} else {
|
|
1065
|
+
guards.push(guardToPromiseFn(record.beforeEnter, to, from));
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
guards.push(canceledNavigationCheck);
|
|
1070
|
+
|
|
1071
|
+
// run the queue of per route beforeEnter guards
|
|
1072
|
+
return runGuardQueue(guards);
|
|
1073
|
+
})
|
|
1074
|
+
.then(() => {
|
|
1075
|
+
// NOTE: at this point to.matched is normalized and does not contain any () => Promise<Component>
|
|
1076
|
+
|
|
1077
|
+
// clear existing enterCallbacks, these are added by extractComponentsGuards
|
|
1078
|
+
to.matched.forEach((record) => (record.enterCallbacks = {}));
|
|
1079
|
+
|
|
1080
|
+
// check in-component beforeRouteEnter
|
|
1081
|
+
guards = extractComponentsGuards(
|
|
1082
|
+
enteringRecords,
|
|
1083
|
+
"beforeRouteEnter",
|
|
1084
|
+
to,
|
|
1085
|
+
from,
|
|
1086
|
+
);
|
|
1087
|
+
guards.push(canceledNavigationCheck);
|
|
1088
|
+
|
|
1089
|
+
// run the queue of per route beforeEnter guards
|
|
1090
|
+
return runGuardQueue(guards);
|
|
1091
|
+
})
|
|
1092
|
+
.then(() => {
|
|
1093
|
+
// check global guards beforeResolve
|
|
1094
|
+
guards = [];
|
|
1095
|
+
for (const guard of beforeResolveGuards.list()) {
|
|
1096
|
+
guards.push(guardToPromiseFn(guard, to, from));
|
|
1097
|
+
}
|
|
1098
|
+
guards.push(canceledNavigationCheck);
|
|
1099
|
+
|
|
1100
|
+
return runGuardQueue(guards);
|
|
1101
|
+
})
|
|
1102
|
+
// catch any navigation canceled
|
|
1103
|
+
.catch((err) =>
|
|
1104
|
+
isNavigationFailure(err, ErrorTypes.NAVIGATION_CANCELLED)
|
|
1105
|
+
? err
|
|
1106
|
+
: Promise.reject(err),
|
|
1107
|
+
)
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
function triggerAfterEach(
|
|
1112
|
+
to: RouteLocationNormalizedLoaded,
|
|
1113
|
+
from: RouteLocationNormalizedLoaded,
|
|
1114
|
+
failure?: NavigationFailure | void,
|
|
1115
|
+
): void {
|
|
1116
|
+
// navigation is confirmed, call afterGuards
|
|
1117
|
+
// TODO: wrap with error handlers
|
|
1118
|
+
for (const guard of afterGuards.list()) {
|
|
1119
|
+
runWithContext(() => guard(to, from, failure));
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* - Cleans up any navigation guards
|
|
1125
|
+
* - Changes the url if necessary
|
|
1126
|
+
* - Calls the scrollBehavior
|
|
1127
|
+
*/
|
|
1128
|
+
function finalizeNavigation(
|
|
1129
|
+
toLocation: RouteLocationNormalizedLoaded,
|
|
1130
|
+
from: RouteLocationNormalizedLoaded,
|
|
1131
|
+
isPush: boolean,
|
|
1132
|
+
replace?: boolean,
|
|
1133
|
+
data?: HistoryState,
|
|
1134
|
+
): NavigationFailure | void {
|
|
1135
|
+
// a more recent navigation took place
|
|
1136
|
+
const error = checkCanceledNavigation(toLocation, from);
|
|
1137
|
+
if (error) return error;
|
|
1138
|
+
|
|
1139
|
+
// only consider as push if it's not the first navigation
|
|
1140
|
+
const isFirstNavigation = from === START_LOCATION_NORMALIZED;
|
|
1141
|
+
const state: Partial<HistoryState> | null = !isBrowser ? {} : history.state;
|
|
1142
|
+
|
|
1143
|
+
// change URL only if the user did a push/replace and if it's not the initial navigation because
|
|
1144
|
+
// it's just reflecting the url
|
|
1145
|
+
if (isPush) {
|
|
1146
|
+
info("router::isPush start...", toLocation);
|
|
1147
|
+
//---------------------------TODO LIULIPENG---------------------------
|
|
1148
|
+
const routeLocationMatched = resolveRouteLocationMatched(toLocation);
|
|
1149
|
+
console.log("toLocation: ", toLocation);
|
|
1150
|
+
console.log("RouteLocationMatched: ", routeLocationMatched);
|
|
1151
|
+
|
|
1152
|
+
if (!isSupportSlotType()) {
|
|
1153
|
+
//resume
|
|
1154
|
+
const toHistoryLocation = findHistoryLocation(toLocation);
|
|
1155
|
+
if (toHistoryLocation) {
|
|
1156
|
+
if (toHistoryLocation.lifecycle >= LifecycleState.destroy) {
|
|
1157
|
+
toHistoryLocation.lifecycle = LifecycleState.initialized;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
//clear task
|
|
1162
|
+
if (
|
|
1163
|
+
routeLocationMatched.launchMode ===
|
|
1164
|
+
ESRouteLaunchMode.ES_ROUTE_LAUNCH_MODE_CLEAR_TASK
|
|
1165
|
+
) {
|
|
1166
|
+
if (!isFirstNavigation) {
|
|
1167
|
+
resolveClearTaskLifecycle(routeLocationMatched);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
//single task
|
|
1171
|
+
else if (
|
|
1172
|
+
routeLocationMatched.launchMode ===
|
|
1173
|
+
ESRouteLaunchMode.ES_ROUTE_LAUNCH_MODE_SINGLE_TASK
|
|
1174
|
+
) {
|
|
1175
|
+
resolveSingleTaskLifecycle(routeLocationMatched, toLocation, replace);
|
|
1176
|
+
}
|
|
1177
|
+
//standard
|
|
1178
|
+
else {
|
|
1179
|
+
resolveStandardLifecycle(routeLocationMatched, replace);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
//--------------------------------------------------------------
|
|
1183
|
+
// TODO replace + clear task = clear task ==> 不执行replace操作(replace 操作没有意义)
|
|
1184
|
+
//
|
|
1185
|
+
// on the initial navigation, we want to reuse the scroll position from
|
|
1186
|
+
// history state if it exists
|
|
1187
|
+
if (
|
|
1188
|
+
replace &&
|
|
1189
|
+
routeLocationMatched.launchMode !==
|
|
1190
|
+
ESRouteLaunchMode.ES_ROUTE_LAUNCH_MODE_CLEAR_TASK
|
|
1191
|
+
) {
|
|
1192
|
+
info("router::replace start...", toLocation);
|
|
1193
|
+
routerHistory.replace(
|
|
1194
|
+
resolveHistoryLocation(
|
|
1195
|
+
toLocation.key,
|
|
1196
|
+
toLocation.fullPath,
|
|
1197
|
+
toLocation.resultCallback,
|
|
1198
|
+
),
|
|
1199
|
+
assign(
|
|
1200
|
+
{
|
|
1201
|
+
scroll: isFirstNavigation && state && state.scroll,
|
|
1202
|
+
},
|
|
1203
|
+
data,
|
|
1204
|
+
),
|
|
1205
|
+
);
|
|
1206
|
+
} else {
|
|
1207
|
+
if (
|
|
1208
|
+
routeLocationMatched.launchMode ===
|
|
1209
|
+
ESRouteLaunchMode.ES_ROUTE_LAUNCH_MODE_SINGLE_TASK
|
|
1210
|
+
) {
|
|
1211
|
+
const index = findHistoryLocationIndex(toLocation);
|
|
1212
|
+
if (index <= -1) {
|
|
1213
|
+
routerHistory.push(
|
|
1214
|
+
resolveHistoryLocation(
|
|
1215
|
+
toLocation.key,
|
|
1216
|
+
toLocation.fullPath,
|
|
1217
|
+
toLocation.resultCallback,
|
|
1218
|
+
),
|
|
1219
|
+
data,
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
} else {
|
|
1223
|
+
routerHistory.push(
|
|
1224
|
+
resolveHistoryLocation(
|
|
1225
|
+
toLocation.key,
|
|
1226
|
+
toLocation.fullPath,
|
|
1227
|
+
toLocation.resultCallback,
|
|
1228
|
+
),
|
|
1229
|
+
data,
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
// TODO
|
|
1235
|
+
// accept current navigation
|
|
1236
|
+
currentRoute.value = toLocation;
|
|
1237
|
+
//
|
|
1238
|
+
handleScroll(toLocation, from, isPush, isFirstNavigation);
|
|
1239
|
+
//
|
|
1240
|
+
markAsReady();
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* TODO LIULIPENG 参数转换
|
|
1245
|
+
*/
|
|
1246
|
+
function resolveHistoryLocation(
|
|
1247
|
+
key?: string,
|
|
1248
|
+
location: string,
|
|
1249
|
+
resultCallback?: RouteResultCallback,
|
|
1250
|
+
): HistoryLocation {
|
|
1251
|
+
return {
|
|
1252
|
+
key: key,
|
|
1253
|
+
location: location,
|
|
1254
|
+
lifecycle: LifecycleState.uninitialized,
|
|
1255
|
+
saveInstanceState: {},
|
|
1256
|
+
resultCallback: resultCallback,
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
let removeHistoryListener: undefined | null | (() => void);
|
|
1261
|
+
|
|
1262
|
+
//------------------------------------清空堆栈--------------------------------------
|
|
1263
|
+
function resolveClearTaskLifecycle(routeLocationMatched) {
|
|
1264
|
+
info("router::resolveClearTaskLifecycle ...");
|
|
1265
|
+
console.log("ESRouter: resolveClearTaskLifecycle");
|
|
1266
|
+
const historyLocationList: HistoryLocation[] =
|
|
1267
|
+
routerHistory.clearHistoryLocations();
|
|
1268
|
+
if (historyLocationList && historyLocationList.length > 0) {
|
|
1269
|
+
historyLocationList.forEach((historyLocation, index) => {
|
|
1270
|
+
if (historyLocation) {
|
|
1271
|
+
pauseStopDestroyRoute(historyLocation, true, true, false);
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
function findHistoryLocationIndex(toLocation) {
|
|
1278
|
+
const historyLocationList = routerHistory.getHistoryLocations();
|
|
1279
|
+
if (historyLocationList && historyLocationList.length > 0) {
|
|
1280
|
+
for (let i = 0; i < historyLocationList.length; i++) {
|
|
1281
|
+
const location = historyLocationList[i];
|
|
1282
|
+
if (location && location.location === toLocation.fullPath) {
|
|
1283
|
+
return i;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return -1;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
function findHistoryLocation(toLocation) {
|
|
1291
|
+
const historyLocationList = routerHistory.getHistoryLocations();
|
|
1292
|
+
if (historyLocationList && historyLocationList.length > 0) {
|
|
1293
|
+
for (let i = 0; i < historyLocationList.length; i++) {
|
|
1294
|
+
const location = historyLocationList[i];
|
|
1295
|
+
if (
|
|
1296
|
+
location &&
|
|
1297
|
+
location.location === toLocation.fullPath &&
|
|
1298
|
+
location.key === toLocation.key
|
|
1299
|
+
) {
|
|
1300
|
+
return location;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
return null;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
//------------------------------------单例--------------------------------------
|
|
1308
|
+
function resolveSingleTaskLifecycle(
|
|
1309
|
+
routeLocationMatched,
|
|
1310
|
+
toLocation,
|
|
1311
|
+
replace: boolean,
|
|
1312
|
+
) {
|
|
1313
|
+
const historyLocationList = routerHistory.getHistoryLocations();
|
|
1314
|
+
const length = historyLocationList.length;
|
|
1315
|
+
const index = findHistoryLocationIndex(toLocation);
|
|
1316
|
+
if (index > -1) {
|
|
1317
|
+
const locationList = routerHistory.popHistoryLocations(
|
|
1318
|
+
length - index - 1,
|
|
1319
|
+
);
|
|
1320
|
+
if (locationList && locationList.length > 0) {
|
|
1321
|
+
locationList.forEach((historyLocation, index) => {
|
|
1322
|
+
if (historyLocation) {
|
|
1323
|
+
pauseStopDestroyRoute(historyLocation, true, true, false);
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
if (replace) {
|
|
1328
|
+
resolveStandardLifecycle(routeLocationMatched, replace);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
//
|
|
1332
|
+
else {
|
|
1333
|
+
resolveStandardLifecycle(routeLocationMatched, replace);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
//------------------------------------标准模式--------------------------------------
|
|
1338
|
+
function resolveStandardLifecycle(routeLocationMatched, replace?: boolean) {
|
|
1339
|
+
const historyLocationList = routerHistory.getHistoryLocations();
|
|
1340
|
+
if (historyLocationList && historyLocationList.length > 0) {
|
|
1341
|
+
const length = historyLocationList.length;
|
|
1342
|
+
//stack bottom
|
|
1343
|
+
try {
|
|
1344
|
+
if (limit && length + 1 > limit) {
|
|
1345
|
+
const historyLocation = historyLocationList[length - limit];
|
|
1346
|
+
if (historyLocation) {
|
|
1347
|
+
pauseStopDestroyRoute(historyLocation, true, true, true);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
} catch (e) {
|
|
1351
|
+
console.log(
|
|
1352
|
+
"invoke stack bottom component instance pause stop error...",
|
|
1353
|
+
e,
|
|
1354
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
const isDialogType =
|
|
1358
|
+
routeLocationMatched.type == ESRouteType.ES_ROUTE_TYPE_DIALOG;
|
|
1359
|
+
console.log(
|
|
1360
|
+
"RouteLocationMatched: isDialogType",
|
|
1361
|
+
routeLocationMatched,
|
|
1362
|
+
isDialogType,
|
|
1363
|
+
);
|
|
1364
|
+
|
|
1365
|
+
//stack middle
|
|
1366
|
+
if (!isDialogType) {
|
|
1367
|
+
for (let i = 0; i < historyLocationList.length - 1; i++) {
|
|
1368
|
+
const location = historyLocationList[i];
|
|
1369
|
+
if (location) {
|
|
1370
|
+
pauseStopDestroyRoute(location, true, false, false);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
//stack top
|
|
1376
|
+
try {
|
|
1377
|
+
const historyLocation = historyLocationList[length - 1];
|
|
1378
|
+
if (historyLocation) {
|
|
1379
|
+
const stop = replace || !isDialogType;
|
|
1380
|
+
const destroy = replace;
|
|
1381
|
+
pauseStopDestroyRoute(historyLocation, stop, destroy, false);
|
|
1382
|
+
}
|
|
1383
|
+
} catch (e) {
|
|
1384
|
+
console.log(
|
|
1385
|
+
"invoke stack top component instance pause stop error...",
|
|
1386
|
+
e,
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
function pauseStopDestroyRoute(
|
|
1393
|
+
historyLocation: HistoryLocation,
|
|
1394
|
+
stop: boolean,
|
|
1395
|
+
destroy: boolean,
|
|
1396
|
+
saveInstanceState: boolean,
|
|
1397
|
+
) {
|
|
1398
|
+
console.log(
|
|
1399
|
+
"PauseStopDestroyRoute: " +
|
|
1400
|
+
" Location" +
|
|
1401
|
+
historyLocation.location +
|
|
1402
|
+
" stop:" +
|
|
1403
|
+
stop +
|
|
1404
|
+
" destroy:" +
|
|
1405
|
+
destroy +
|
|
1406
|
+
" saveInstanceState:" +
|
|
1407
|
+
saveInstanceState,
|
|
1408
|
+
);
|
|
1409
|
+
//
|
|
1410
|
+
const instance = historyLocation.instances;
|
|
1411
|
+
//onESPause
|
|
1412
|
+
if (historyLocation.lifecycle < LifecycleState.pause) {
|
|
1413
|
+
historyLocation.lifecycle = LifecycleState.pause;
|
|
1414
|
+
try {
|
|
1415
|
+
if (instance) {
|
|
1416
|
+
try {
|
|
1417
|
+
triggerESLifecycle(instance, "pause");
|
|
1418
|
+
} catch (e) {}
|
|
1419
|
+
|
|
1420
|
+
// @ts-ignore
|
|
1421
|
+
if (isFunction(instance.onESPause)) {
|
|
1422
|
+
// @ts-ignore
|
|
1423
|
+
instance.onESPause();
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
} catch (e) {
|
|
1427
|
+
console.log(
|
|
1428
|
+
"invoke " +
|
|
1429
|
+
historyLocation +
|
|
1430
|
+
" component instance onESPause error...",
|
|
1431
|
+
e,
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
//onESStop
|
|
1436
|
+
if (stop && historyLocation.lifecycle < LifecycleState.stop) {
|
|
1437
|
+
historyLocation.lifecycle = LifecycleState.stop;
|
|
1438
|
+
try {
|
|
1439
|
+
if (instance) {
|
|
1440
|
+
try {
|
|
1441
|
+
triggerESLifecycle(instance, "stop");
|
|
1442
|
+
} catch (e) {}
|
|
1443
|
+
|
|
1444
|
+
// @ts-ignore
|
|
1445
|
+
if (isFunction(instance.onESStop)) {
|
|
1446
|
+
// @ts-ignore
|
|
1447
|
+
instance.onESStop();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
} catch (e) {
|
|
1451
|
+
console.log(
|
|
1452
|
+
"invoke " + historyLocation + " component instance onESStop error...",
|
|
1453
|
+
e,
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
//onESSaveInstanceState
|
|
1459
|
+
if (
|
|
1460
|
+
stop &&
|
|
1461
|
+
saveInstanceState &&
|
|
1462
|
+
historyLocation.lifecycle < LifecycleState.saveInstanceState
|
|
1463
|
+
) {
|
|
1464
|
+
historyLocation.lifecycle = LifecycleState.saveInstanceState;
|
|
1465
|
+
try {
|
|
1466
|
+
if (instance) {
|
|
1467
|
+
try {
|
|
1468
|
+
triggerESLifecycle(
|
|
1469
|
+
instance,
|
|
1470
|
+
"saveInstanceState",
|
|
1471
|
+
historyLocation.saveInstanceState,
|
|
1472
|
+
);
|
|
1473
|
+
} catch (e) {}
|
|
1474
|
+
|
|
1475
|
+
// @ts-ignore
|
|
1476
|
+
if (isFunction(instance.onESSaveInstanceState)) {
|
|
1477
|
+
// @ts-ignore
|
|
1478
|
+
instance.onESSaveInstanceState(historyLocation.saveInstanceState);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
} catch (e) {
|
|
1482
|
+
console.log(
|
|
1483
|
+
"invoke " +
|
|
1484
|
+
historyLocation +
|
|
1485
|
+
" component instance onESSaveInstanceState error...",
|
|
1486
|
+
e,
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
//onESDestroy
|
|
1492
|
+
if (stop && destroy && historyLocation.lifecycle < LifecycleState.destroy) {
|
|
1493
|
+
historyLocation.lifecycle = LifecycleState.destroy;
|
|
1494
|
+
try {
|
|
1495
|
+
if (instance) {
|
|
1496
|
+
try {
|
|
1497
|
+
triggerESLifecycle(instance, "destroy");
|
|
1498
|
+
} catch (e) {}
|
|
1499
|
+
// @ts-ignore
|
|
1500
|
+
if (isFunction(instance.onESDestroy)) {
|
|
1501
|
+
// @ts-ignore
|
|
1502
|
+
instance.onESDestroy();
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
} catch (e) {
|
|
1506
|
+
console.log(
|
|
1507
|
+
"invoke " +
|
|
1508
|
+
historyLocation +
|
|
1509
|
+
" component instance onESDestroy error...",
|
|
1510
|
+
e,
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
//
|
|
1514
|
+
historyLocation.instances = null;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
function resolveRouteLocationMatched(
|
|
1519
|
+
targetLocation: RouteLocation,
|
|
1520
|
+
): RouteLocationMatched {
|
|
1521
|
+
let initialDepth = 0;
|
|
1522
|
+
const { matched } = targetLocation;
|
|
1523
|
+
let matchedRoute: RouteLocationMatched | undefined;
|
|
1524
|
+
while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) {
|
|
1525
|
+
initialDepth++;
|
|
1526
|
+
}
|
|
1527
|
+
return matched[initialDepth];
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
function isFunction(func) {
|
|
1531
|
+
return Object.prototype.toString.call(func) === "[object Function]";
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
// attach listener to history to trigger navigations
|
|
1535
|
+
function setupListeners() {
|
|
1536
|
+
// avoid setting up listeners twice due to an invalid first navigation
|
|
1537
|
+
if (removeHistoryListener) return;
|
|
1538
|
+
removeHistoryListener = routerHistory.listen((to, _from, info) => {
|
|
1539
|
+
if (!router.listening) return;
|
|
1540
|
+
// cannot be a redirect route because it was in history
|
|
1541
|
+
const toLocation = resolve(to.location) as RouteLocationNormalized;
|
|
1542
|
+
|
|
1543
|
+
// due to dynamic routing, and to hash history with manual navigation
|
|
1544
|
+
// (manually changing the url or calling history.hash = '#/somewhere'),
|
|
1545
|
+
// there could be a redirect record in history
|
|
1546
|
+
const shouldRedirect = handleRedirectRecord(toLocation);
|
|
1547
|
+
if (shouldRedirect) {
|
|
1548
|
+
pushWithRedirect(
|
|
1549
|
+
assign(shouldRedirect, { replace: true }),
|
|
1550
|
+
toLocation,
|
|
1551
|
+
).catch(noop);
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
pendingLocation = toLocation;
|
|
1556
|
+
const from = currentRoute.value;
|
|
1557
|
+
|
|
1558
|
+
//-------------------------TODO LIULIPENG----------------------
|
|
1559
|
+
//resume
|
|
1560
|
+
if (to) {
|
|
1561
|
+
if (to.lifecycle >= LifecycleState.destroy) {
|
|
1562
|
+
to.lifecycle = LifecycleState.initialized;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
//---------------------------------------------------------
|
|
1566
|
+
// TODO: should be moved to web history?
|
|
1567
|
+
if (isBrowser) {
|
|
1568
|
+
saveScrollPosition(
|
|
1569
|
+
getScrollKey(from.fullPath, info.delta),
|
|
1570
|
+
computeScrollPosition(),
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
navigate(toLocation, from)
|
|
1575
|
+
.catch((error: NavigationFailure | NavigationRedirectError) => {
|
|
1576
|
+
if (
|
|
1577
|
+
isNavigationFailure(
|
|
1578
|
+
error,
|
|
1579
|
+
ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED,
|
|
1580
|
+
)
|
|
1581
|
+
) {
|
|
1582
|
+
return error;
|
|
1583
|
+
}
|
|
1584
|
+
if (
|
|
1585
|
+
isNavigationFailure(error, ErrorTypes.NAVIGATION_GUARD_REDIRECT)
|
|
1586
|
+
) {
|
|
1587
|
+
// Here we could call if (info.delta) routerHistory.go(-info.delta,
|
|
1588
|
+
// false) but this is bug prone as we have no way to wait the
|
|
1589
|
+
// navigation to be finished before calling pushWithRedirect. Using
|
|
1590
|
+
// a setTimeout of 16ms seems to work but there is no guarantee for
|
|
1591
|
+
// it to work on every browser. So instead we do not restore the
|
|
1592
|
+
// history entry and trigger a new navigation as requested by the
|
|
1593
|
+
// navigation guard.
|
|
1594
|
+
|
|
1595
|
+
// the error is already handled by router.push we just want to avoid
|
|
1596
|
+
// logging the error
|
|
1597
|
+
pushWithRedirect(
|
|
1598
|
+
(error as NavigationRedirectError).to,
|
|
1599
|
+
toLocation,
|
|
1600
|
+
// avoid an uncaught rejection, let push call triggerError
|
|
1601
|
+
)
|
|
1602
|
+
.then((failure) => {
|
|
1603
|
+
// manual change in hash history #916 ending up in the URL not
|
|
1604
|
+
// changing, but it was changed by the manual url change, so we
|
|
1605
|
+
// need to manually change it ourselves
|
|
1606
|
+
if (
|
|
1607
|
+
isNavigationFailure(
|
|
1608
|
+
failure,
|
|
1609
|
+
ErrorTypes.NAVIGATION_ABORTED |
|
|
1610
|
+
ErrorTypes.NAVIGATION_DUPLICATED,
|
|
1611
|
+
) &&
|
|
1612
|
+
!info.delta &&
|
|
1613
|
+
info.type === NavigationType.pop
|
|
1614
|
+
) {
|
|
1615
|
+
routerHistory.go(-1, false);
|
|
1616
|
+
}
|
|
1617
|
+
})
|
|
1618
|
+
.catch(noop);
|
|
1619
|
+
// avoid the then branch
|
|
1620
|
+
return Promise.reject();
|
|
1621
|
+
}
|
|
1622
|
+
// do not restore history on unknown direction
|
|
1623
|
+
if (info.delta) {
|
|
1624
|
+
routerHistory.go(-info.delta, false);
|
|
1625
|
+
}
|
|
1626
|
+
// unrecognized error, transfer to the global handler
|
|
1627
|
+
return triggerError(error, toLocation, from);
|
|
1628
|
+
})
|
|
1629
|
+
.then((failure: NavigationFailure | void) => {
|
|
1630
|
+
failure =
|
|
1631
|
+
failure ||
|
|
1632
|
+
finalizeNavigation(
|
|
1633
|
+
// after navigation, all matched components are resolved
|
|
1634
|
+
toLocation as RouteLocationNormalizedLoaded,
|
|
1635
|
+
from,
|
|
1636
|
+
false,
|
|
1637
|
+
);
|
|
1638
|
+
|
|
1639
|
+
// revert the navigation
|
|
1640
|
+
if (failure) {
|
|
1641
|
+
if (
|
|
1642
|
+
info.delta &&
|
|
1643
|
+
// a new navigation has been triggered, so we do not want to revert, that will change the current history
|
|
1644
|
+
// entry while a different route is displayed
|
|
1645
|
+
!isNavigationFailure(failure, ErrorTypes.NAVIGATION_CANCELLED)
|
|
1646
|
+
) {
|
|
1647
|
+
routerHistory.go(-info.delta, false);
|
|
1648
|
+
} else if (
|
|
1649
|
+
info.type === NavigationType.pop &&
|
|
1650
|
+
isNavigationFailure(
|
|
1651
|
+
failure,
|
|
1652
|
+
ErrorTypes.NAVIGATION_ABORTED |
|
|
1653
|
+
ErrorTypes.NAVIGATION_DUPLICATED,
|
|
1654
|
+
)
|
|
1655
|
+
) {
|
|
1656
|
+
// manual change in hash history #916
|
|
1657
|
+
// it's like a push but lacks the information of the direction
|
|
1658
|
+
routerHistory.go(-1, false);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
triggerAfterEach(
|
|
1663
|
+
toLocation as RouteLocationNormalizedLoaded,
|
|
1664
|
+
from,
|
|
1665
|
+
failure,
|
|
1666
|
+
);
|
|
1667
|
+
})
|
|
1668
|
+
.catch(noop);
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
// Initialization and Errors
|
|
1673
|
+
|
|
1674
|
+
let readyHandlers = useCallbacks<OnReadyCallback>();
|
|
1675
|
+
let errorHandlers = useCallbacks<_ErrorHandler>();
|
|
1676
|
+
let ready: boolean;
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Trigger errorHandlers added via onError and throws the error as well
|
|
1680
|
+
*
|
|
1681
|
+
* @param error - error to throw
|
|
1682
|
+
* @param to - location we were navigating to when the error happened
|
|
1683
|
+
* @param from - location we were navigating from when the error happened
|
|
1684
|
+
* @returns the error as a rejected promise
|
|
1685
|
+
*/
|
|
1686
|
+
function triggerError(
|
|
1687
|
+
error: any,
|
|
1688
|
+
to: RouteLocationNormalized,
|
|
1689
|
+
from: RouteLocationNormalizedLoaded,
|
|
1690
|
+
): Promise<unknown> {
|
|
1691
|
+
markAsReady(error);
|
|
1692
|
+
const list = errorHandlers.list();
|
|
1693
|
+
if (list.length) {
|
|
1694
|
+
list.forEach((handler) => handler(error, to, from));
|
|
1695
|
+
} else {
|
|
1696
|
+
if (__DEV__) {
|
|
1697
|
+
warn("uncaught error during route navigation:");
|
|
1698
|
+
}
|
|
1699
|
+
console.error(error);
|
|
1700
|
+
}
|
|
1701
|
+
return Promise.reject(error);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
function isReady(): Promise<void> {
|
|
1705
|
+
if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
|
|
1706
|
+
return Promise.resolve();
|
|
1707
|
+
return new Promise((resolve, reject) => {
|
|
1708
|
+
readyHandlers.add([resolve, reject]);
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* Mark the router as ready, resolving the promised returned by isReady(). Can
|
|
1714
|
+
* only be called once, otherwise does nothing.
|
|
1715
|
+
* @param err - optional error
|
|
1716
|
+
*/
|
|
1717
|
+
function markAsReady<E = any>(err: E): E;
|
|
1718
|
+
function markAsReady<E = any>(): void;
|
|
1719
|
+
function markAsReady<E = any>(err?: E): E | void {
|
|
1720
|
+
if (!ready) {
|
|
1721
|
+
// still not ready if an error happened
|
|
1722
|
+
ready = !err;
|
|
1723
|
+
setupListeners();
|
|
1724
|
+
readyHandlers
|
|
1725
|
+
.list()
|
|
1726
|
+
.forEach(([resolve, reject]) => (err ? reject(err) : resolve()));
|
|
1727
|
+
readyHandlers.reset();
|
|
1728
|
+
}
|
|
1729
|
+
return err;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
// Scroll behavior
|
|
1733
|
+
function handleScroll(
|
|
1734
|
+
to: RouteLocationNormalizedLoaded,
|
|
1735
|
+
from: RouteLocationNormalizedLoaded,
|
|
1736
|
+
isPush: boolean,
|
|
1737
|
+
isFirstNavigation: boolean,
|
|
1738
|
+
): Promise<any> {
|
|
1739
|
+
const { scrollBehavior } = options;
|
|
1740
|
+
if (!isBrowser || !scrollBehavior) return Promise.resolve();
|
|
1741
|
+
|
|
1742
|
+
const scrollPosition: _ScrollPositionNormalized | null =
|
|
1743
|
+
(!isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0))) ||
|
|
1744
|
+
((isFirstNavigation || !isPush) &&
|
|
1745
|
+
(history.state as HistoryState) &&
|
|
1746
|
+
history.state.scroll) ||
|
|
1747
|
+
null;
|
|
1748
|
+
|
|
1749
|
+
return nextTick()
|
|
1750
|
+
.then(() => scrollBehavior(to, from, scrollPosition))
|
|
1751
|
+
.then((position) => position && scrollToPosition(position))
|
|
1752
|
+
.catch((err) => triggerError(err, to, from));
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
function go(delta) {
|
|
1756
|
+
navigationType.value = delta < 0 ? NavigationType.pop : NavigationType.push;
|
|
1757
|
+
//
|
|
1758
|
+
if (delta < 0) {
|
|
1759
|
+
pauseStopDestroyRoute(routerHistory.getLocation(), true, true, false);
|
|
1760
|
+
}
|
|
1761
|
+
//
|
|
1762
|
+
let ret = routerHistory.go(delta);
|
|
1763
|
+
console.log("ESRouter:go result:" + ret);
|
|
1764
|
+
if (!ret || isSupportSlotType()) {
|
|
1765
|
+
console.log("call native router:go start:" + delta);
|
|
1766
|
+
ret = nativeRouter.go(delta);
|
|
1767
|
+
console.log("call native router:go result:" + ret);
|
|
1768
|
+
}
|
|
1769
|
+
return ret;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
let started: boolean | undefined;
|
|
1773
|
+
const installedApps = new Set<App>();
|
|
1774
|
+
|
|
1775
|
+
const router: Router = {
|
|
1776
|
+
//----------------------------------------------
|
|
1777
|
+
get active() {
|
|
1778
|
+
return getActive();
|
|
1779
|
+
},
|
|
1780
|
+
setActive,
|
|
1781
|
+
//----------------------------------------------
|
|
1782
|
+
currentRoute,
|
|
1783
|
+
listening: true,
|
|
1784
|
+
|
|
1785
|
+
addRoute,
|
|
1786
|
+
removeRoute,
|
|
1787
|
+
hasRoute,
|
|
1788
|
+
getRoutes,
|
|
1789
|
+
getRouterHistory,
|
|
1790
|
+
getRoute,
|
|
1791
|
+
resolve,
|
|
1792
|
+
options,
|
|
1793
|
+
|
|
1794
|
+
//
|
|
1795
|
+
push,
|
|
1796
|
+
replace,
|
|
1797
|
+
splice,
|
|
1798
|
+
go,
|
|
1799
|
+
back: () => go(-1),
|
|
1800
|
+
forward: () => go(1),
|
|
1801
|
+
|
|
1802
|
+
//
|
|
1803
|
+
setResult,
|
|
1804
|
+
|
|
1805
|
+
//
|
|
1806
|
+
beforeEach: beforeGuards.add,
|
|
1807
|
+
beforeResolve: beforeResolveGuards.add,
|
|
1808
|
+
afterEach: afterGuards.add,
|
|
1809
|
+
|
|
1810
|
+
onError: errorHandlers.add,
|
|
1811
|
+
isReady,
|
|
1812
|
+
|
|
1813
|
+
install: function (app: App) {
|
|
1814
|
+
const router = this;
|
|
1815
|
+
app.component("EsRouterLink", RouterLink);
|
|
1816
|
+
app.component("EsRouterView", RouterView);
|
|
1817
|
+
app.component("EsSlotView", SlotView);
|
|
1818
|
+
|
|
1819
|
+
registerPageRouteView(app);
|
|
1820
|
+
registerPageView(app);
|
|
1821
|
+
registerSlotRootView(app);
|
|
1822
|
+
registerSlotView(app);
|
|
1823
|
+
|
|
1824
|
+
app.config.globalProperties.$router = router;
|
|
1825
|
+
Object.defineProperty(app.config.globalProperties, "$route", {
|
|
1826
|
+
enumerable: true,
|
|
1827
|
+
get: () => unref(currentRoute),
|
|
1828
|
+
});
|
|
1829
|
+
|
|
1830
|
+
// this initial navigation is only necessary on client, on server it doesn't
|
|
1831
|
+
// make sense because it will create an extra unnecessary navigation and could
|
|
1832
|
+
// lead to problems
|
|
1833
|
+
if (
|
|
1834
|
+
isBrowser &&
|
|
1835
|
+
// used for the initial navigation client side to avoid pushing
|
|
1836
|
+
// multiple times when the router is used in multiple apps
|
|
1837
|
+
!started &&
|
|
1838
|
+
currentRoute.value === START_LOCATION_NORMALIZED
|
|
1839
|
+
) {
|
|
1840
|
+
// see above
|
|
1841
|
+
started = true;
|
|
1842
|
+
push(routerHistory.location).catch((err) => {
|
|
1843
|
+
if (__DEV__) warn("Unexpected error when starting the router:", err);
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
const reactiveRoute = {} as {
|
|
1848
|
+
[k in keyof RouteLocationNormalizedLoaded]: ComputedRef<
|
|
1849
|
+
RouteLocationNormalizedLoaded[k]
|
|
1850
|
+
>;
|
|
1851
|
+
};
|
|
1852
|
+
for (const key in START_LOCATION_NORMALIZED) {
|
|
1853
|
+
// @ts-expect-error: the key matches
|
|
1854
|
+
reactiveRoute[key] = computed(() => currentRoute.value[key]);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
app.provide(routerKey, router);
|
|
1858
|
+
app.provide(routeLocationKey, reactive(reactiveRoute));
|
|
1859
|
+
app.provide(routerViewLocationKey, currentRoute);
|
|
1860
|
+
app.provide(routerHistoryKey, options.history);
|
|
1861
|
+
app.provide(routerRecordRawKey, options.routes);
|
|
1862
|
+
app.provide(navigationTypeKey, navigationType);
|
|
1863
|
+
app.provide(routerComponentInstanceKey, routerComponentInstance);
|
|
1864
|
+
app.provide(routerViewNameKey, routerViewName);
|
|
1865
|
+
app.provide(nativeRouterKey, nativeRouter);
|
|
1866
|
+
app.provide(routerViewInstanceKey, routerViewInstance);
|
|
1867
|
+
app.provide(routeViewInstancesKey, routeViewInstanceList);
|
|
1868
|
+
|
|
1869
|
+
const unmountApp = app.unmount;
|
|
1870
|
+
installedApps.add(app);
|
|
1871
|
+
app.unmount = function () {
|
|
1872
|
+
installedApps.delete(app);
|
|
1873
|
+
// the router is not attached to an app anymore
|
|
1874
|
+
if (installedApps.size < 1) {
|
|
1875
|
+
// invalidate the current navigation
|
|
1876
|
+
pendingLocation = START_LOCATION_NORMALIZED;
|
|
1877
|
+
removeHistoryListener && removeHistoryListener();
|
|
1878
|
+
removeHistoryListener = null;
|
|
1879
|
+
currentRoute.value = START_LOCATION_NORMALIZED;
|
|
1880
|
+
started = false;
|
|
1881
|
+
ready = false;
|
|
1882
|
+
}
|
|
1883
|
+
unmountApp();
|
|
1884
|
+
};
|
|
1885
|
+
|
|
1886
|
+
// TODO: this probably needs to be updated so it can be used by vue-termui
|
|
1887
|
+
if ((__DEV__ || __FEATURE_PROD_DEVTOOLS__) && isBrowser) {
|
|
1888
|
+
addDevtools(app, router, matcher);
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1893
|
+
// TODO: type this as NavigationGuardReturn or similar instead of any
|
|
1894
|
+
function runGuardQueue(guards: Lazy<any>[]): Promise<any> {
|
|
1895
|
+
return guards.reduce(
|
|
1896
|
+
(promise, guard) => promise.then(() => runWithContext(guard)),
|
|
1897
|
+
Promise.resolve(),
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
return router;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
function extractChangingRecords(
|
|
1905
|
+
to: RouteLocationNormalized,
|
|
1906
|
+
from: RouteLocationNormalizedLoaded,
|
|
1907
|
+
) {
|
|
1908
|
+
const leavingRecords: RouteRecordNormalized[] = [];
|
|
1909
|
+
const updatingRecords: RouteRecordNormalized[] = [];
|
|
1910
|
+
const enteringRecords: RouteRecordNormalized[] = [];
|
|
1911
|
+
|
|
1912
|
+
const len = Math.max(from.matched.length, to.matched.length);
|
|
1913
|
+
for (let i = 0; i < len; i++) {
|
|
1914
|
+
const recordFrom = from.matched[i];
|
|
1915
|
+
if (recordFrom) {
|
|
1916
|
+
if (to.matched.find((record) => isSameRouteRecord(record, recordFrom)))
|
|
1917
|
+
updatingRecords.push(recordFrom);
|
|
1918
|
+
else leavingRecords.push(recordFrom);
|
|
1919
|
+
}
|
|
1920
|
+
const recordTo = to.matched[i];
|
|
1921
|
+
if (recordTo) {
|
|
1922
|
+
// the type doesn't matter because we are comparing per reference
|
|
1923
|
+
if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) {
|
|
1924
|
+
enteringRecords.push(recordTo);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
return [leavingRecords, updatingRecords, enteringRecords];
|
|
1930
|
+
}
|