winui-svelte 0.0.6 → 0.0.8
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/API.md +955 -22
- package/README.md +25 -5
- package/dist/app/activate.d.ts.map +1 -1
- package/dist/app/activate.js +3 -0
- package/dist/app/activate.js.map +1 -1
- package/dist/app/activation/index.d.ts +3 -0
- package/dist/app/activation/index.d.ts.map +1 -1
- package/dist/app/activation/index.js +2 -0
- package/dist/app/activation/index.js.map +1 -1
- package/dist/app/activation/login.d.ts +2 -1
- package/dist/app/activation/login.d.ts.map +1 -1
- package/dist/app/activation/login.js +2 -1
- package/dist/app/activation/login.js.map +1 -1
- package/dist/app/activation/native.js +1 -2
- package/dist/app/activation/native.js.map +1 -1
- package/dist/app/activation/packaged.d.ts +49 -0
- package/dist/app/activation/packaged.d.ts.map +1 -0
- package/dist/app/activation/packaged.js +90 -0
- package/dist/app/activation/packaged.js.map +1 -0
- package/dist/app/activation/receive.d.ts +11 -2
- package/dist/app/activation/receive.d.ts.map +1 -1
- package/dist/app/activation/receive.js +11 -4
- package/dist/app/activation/receive.js.map +1 -1
- package/dist/app/activation/registration.d.ts +3 -3
- package/dist/app/activation/registration.js +7 -7
- package/dist/app/activation/registration.js.map +1 -1
- package/dist/app/activation/scheme.d.ts +10 -0
- package/dist/app/activation/scheme.d.ts.map +1 -1
- package/dist/app/activation/scheme.js +17 -0
- package/dist/app/activation/scheme.js.map +1 -1
- package/dist/app/index.d.ts +4 -2
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +3 -1
- package/dist/app/index.js.map +1 -1
- package/dist/app/instance-running.d.ts +15 -0
- package/dist/app/instance-running.d.ts.map +1 -0
- package/dist/app/instance-running.js +20 -0
- package/dist/app/instance-running.js.map +1 -0
- package/dist/app/jump-list/native.d.ts.map +1 -1
- package/dist/app/jump-list/native.js +1 -2
- package/dist/app/jump-list/native.js.map +1 -1
- package/dist/app/launch-command.d.ts +11 -6
- package/dist/app/launch-command.d.ts.map +1 -1
- package/dist/app/launch-command.js +16 -5
- package/dist/app/launch-command.js.map +1 -1
- package/dist/app/native-messaging/browsers.d.ts +19 -0
- package/dist/app/native-messaging/browsers.d.ts.map +1 -0
- package/dist/app/native-messaging/browsers.js +17 -0
- package/dist/app/native-messaging/browsers.js.map +1 -0
- package/dist/app/native-messaging/index.d.ts +41 -0
- package/dist/app/native-messaging/index.d.ts.map +1 -0
- package/dist/app/native-messaging/index.js +84 -0
- package/dist/app/native-messaging/index.js.map +1 -0
- package/dist/app/native.d.ts +0 -6
- package/dist/app/native.d.ts.map +1 -1
- package/dist/app/native.js +1 -24
- package/dist/app/native.js.map +1 -1
- package/dist/app/notification-source.d.ts.map +1 -1
- package/dist/app/notification-source.js +1 -2
- package/dist/app/notification-source.js.map +1 -1
- package/dist/app/shell/native.js +1 -2
- package/dist/app/shell/native.js.map +1 -1
- package/dist/app/single-instance.d.ts +27 -1
- package/dist/app/single-instance.d.ts.map +1 -1
- package/dist/app/single-instance.js +32 -10
- package/dist/app/single-instance.js.map +1 -1
- package/dist/app/tray-instance.d.ts +4 -3
- package/dist/app/tray-instance.d.ts.map +1 -1
- package/dist/app/tray-instance.js +7 -5
- package/dist/app/tray-instance.js.map +1 -1
- package/dist/automation/backend.d.ts +51 -0
- package/dist/automation/backend.d.ts.map +1 -0
- package/dist/automation/backend.js +5 -0
- package/dist/automation/backend.js.map +1 -0
- package/dist/automation/client.d.ts +97 -0
- package/dist/automation/client.d.ts.map +1 -0
- package/dist/automation/client.js +203 -0
- package/dist/automation/client.js.map +1 -0
- package/dist/automation/ids.d.ts +90 -0
- package/dist/automation/ids.d.ts.map +1 -0
- package/dist/automation/ids.js +84 -0
- package/dist/automation/ids.js.map +1 -0
- package/dist/automation/index.d.ts +13 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +8 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/native.d.ts +11 -0
- package/dist/automation/native.d.ts.map +1 -0
- package/dist/automation/native.js +594 -0
- package/dist/automation/native.js.map +1 -0
- package/dist/automation/text.d.ts +50 -0
- package/dist/automation/text.d.ts.map +1 -0
- package/dist/automation/text.js +110 -0
- package/dist/automation/text.js.map +1 -0
- package/dist/automation/with-client.d.ts +13 -0
- package/dist/automation/with-client.d.ts.map +1 -0
- package/dist/automation/with-client.js +19 -0
- package/dist/automation/with-client.js.map +1 -0
- package/dist/automation/worker-job.d.ts +32 -0
- package/dist/automation/worker-job.d.ts.map +1 -0
- package/dist/automation/worker-job.js +69 -0
- package/dist/automation/worker-job.js.map +1 -0
- package/dist/automation/worker.d.ts +44 -0
- package/dist/automation/worker.d.ts.map +1 -0
- package/dist/automation/worker.js +70 -0
- package/dist/automation/worker.js.map +1 -0
- package/dist/bindings/.dynwinrt-js-types +198 -0
- package/dist/bindings/.dynwinrt-managed +1 -1
- package/dist/bindings/index.d.ts +15 -0
- package/dist/bindings/index.js +20 -0
- package/dist/bindings/index.mjs +2902 -2882
- package/dist/bindings/index.proxy.js +10 -0
- package/dist/bindings/windows/application-model/activation/ActivationKind.d.ts +49 -0
- package/dist/bindings/windows/application-model/activation/ActivationKind.js +50 -0
- package/dist/bindings/windows/application-model/activation/ApplicationExecutionState.d.ts +9 -0
- package/dist/bindings/windows/application-model/activation/ApplicationExecutionState.js +10 -0
- package/dist/bindings/windows/application-model/activation/IActivatedEventArgs.d.ts +36 -0
- package/dist/bindings/windows/application-model/activation/IActivatedEventArgs.js +149 -0
- package/dist/bindings/windows/application-model/activation/IActivatedEventArgsWithUser.d.ts +28 -0
- package/dist/bindings/windows/application-model/activation/IActivatedEventArgsWithUser.js +119 -0
- package/dist/bindings/windows/application-model/activation/IApplicationViewActivatedEventArgs.d.ts +27 -0
- package/dist/bindings/windows/application-model/activation/IApplicationViewActivatedEventArgs.js +116 -0
- package/dist/bindings/windows/application-model/activation/IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData.d.ts +31 -0
- package/dist/bindings/windows/application-model/activation/IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData.js +131 -0
- package/dist/bindings/windows/application-model/activation/IViewSwitcherProvider.d.ts +28 -0
- package/dist/bindings/windows/application-model/activation/IViewSwitcherProvider.js +119 -0
- package/dist/bindings/windows/application-model/activation/ProtocolActivatedEventArgs.d.ts +25 -0
- package/dist/bindings/windows/application-model/activation/ProtocolActivatedEventArgs.js +166 -0
- package/dist/bindings/windows/application-model/activation/SplashScreen.d.ts +35 -0
- package/dist/bindings/windows/application-model/activation/SplashScreen.js +105 -0
- package/dist/bindings/windows/foundation/TypedEventHandler_WindowsApplicationModelActivationSplashScreen_Object_g7a7dbfa699cd28ff.d.ts +7 -0
- package/dist/bindings/windows/foundation/TypedEventHandler_WindowsApplicationModelActivationSplashScreen_Object_g7a7dbfa699cd28ff.js +7 -0
- package/dist/bindings/windows/ui/view-management/ActivationViewSwitcher.d.ts +12 -0
- package/dist/bindings/windows/ui/view-management/ActivationViewSwitcher.js +96 -0
- package/dist/chrome/context-menus/context-menu-schema.d.ts +4 -4
- package/dist/chrome/context-menus/context-menu-schema.d.ts.map +1 -1
- package/dist/chrome/context-menus/context-menu-schema.js +1 -7
- package/dist/chrome/context-menus/context-menu-schema.js.map +1 -1
- package/dist/chrome/notifications/notification-schema.d.ts +2 -2
- package/dist/chrome/parse-or-throw.d.ts +7 -0
- package/dist/chrome/parse-or-throw.d.ts.map +1 -0
- package/dist/chrome/parse-or-throw.js +9 -0
- package/dist/chrome/parse-or-throw.js.map +1 -0
- package/dist/chrome/permissions/permission-schema.d.ts.map +1 -1
- package/dist/chrome/permissions/permission-schema.js +1 -7
- package/dist/chrome/permissions/permission-schema.js.map +1 -1
- package/dist/chrome/windows/chrome-windows.d.ts.map +1 -1
- package/dist/chrome/windows/chrome-windows.js +1 -7
- package/dist/chrome/windows/chrome-windows.js.map +1 -1
- package/dist/components/hand-written/Window.svelte +2 -0
- package/dist/components/hand-written/items/keyed-rows.svelte.d.ts.map +1 -1
- package/dist/components/hand-written/items/keyed-rows.svelte.js +6 -0
- package/dist/components/hand-written/items/keyed-rows.svelte.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/runtime.svelte.d.ts.map +1 -1
- package/dist/components/runtime.svelte.js +7 -0
- package/dist/components/runtime.svelte.js.map +1 -1
- package/dist/components/window-context.d.ts +14 -0
- package/dist/components/window-context.d.ts.map +1 -0
- package/dist/components/window-context.js +20 -0
- package/dist/components/window-context.js.map +1 -0
- package/dist/composition/expression.d.ts +1 -1
- package/dist/css/runtime/containers.d.ts.map +1 -1
- package/dist/css/runtime/containers.js +1 -17
- package/dist/css/runtime/containers.js.map +1 -1
- package/dist/css/runtime/native.d.ts.map +1 -1
- package/dist/css/runtime/native.js +40 -20
- package/dist/css/runtime/native.js.map +1 -1
- package/dist/css/translate/property-kit.d.ts +9 -0
- package/dist/css/translate/property-kit.d.ts.map +1 -1
- package/dist/css/translate/property-kit.js.map +1 -1
- package/dist/css/translate/transition-properties.d.ts +1 -1
- package/dist/css/translate/transition-properties.d.ts.map +1 -1
- package/dist/css/translate/transition-properties.js +32 -5
- package/dist/css/translate/transition-properties.js.map +1 -1
- package/dist/data-transfer/data-transfer.d.ts +3 -3
- package/dist/data-transfer/data-transfer.d.ts.map +1 -1
- package/dist/data-transfer/data-transfer.js.map +1 -1
- package/dist/data-transfer/drag-effects.d.ts +25 -2
- package/dist/data-transfer/drag-effects.d.ts.map +1 -1
- package/dist/data-transfer/drag-effects.js +27 -2
- package/dist/data-transfer/drag-effects.js.map +1 -1
- package/dist/data-transfer/drag-helper.d.ts +50 -0
- package/dist/data-transfer/drag-helper.d.ts.map +1 -0
- package/dist/data-transfer/drag-helper.js +156 -0
- package/dist/data-transfer/drag-helper.js.map +1 -0
- package/dist/data-transfer/drop-target.d.ts +6 -5
- package/dist/data-transfer/drop-target.d.ts.map +1 -1
- package/dist/data-transfer/drop-target.js +68 -20
- package/dist/data-transfer/drop-target.js.map +1 -1
- package/dist/data-transfer/index.d.ts +1 -0
- package/dist/data-transfer/index.d.ts.map +1 -1
- package/dist/data-transfer/index.js.map +1 -1
- package/dist/data-transfer/launcher.d.ts +4 -3
- package/dist/data-transfer/launcher.d.ts.map +1 -1
- package/dist/data-transfer/launcher.js +58 -9
- package/dist/data-transfer/launcher.js.map +1 -1
- package/dist/data-transfer/native.d.ts +66 -0
- package/dist/data-transfer/native.d.ts.map +1 -0
- package/dist/data-transfer/native.js +148 -0
- package/dist/data-transfer/native.js.map +1 -0
- package/dist/data-transfer/ole-data-object.d.ts +62 -0
- package/dist/data-transfer/ole-data-object.d.ts.map +1 -0
- package/dist/data-transfer/ole-data-object.js +162 -0
- package/dist/data-transfer/ole-data-object.js.map +1 -0
- package/dist/data-transfer/ole-drop-target.d.ts +54 -0
- package/dist/data-transfer/ole-drop-target.d.ts.map +1 -0
- package/dist/data-transfer/ole-drop-target.js +192 -0
- package/dist/data-transfer/ole-drop-target.js.map +1 -0
- package/dist/data-transfer/share-interop.d.ts.map +1 -1
- package/dist/data-transfer/share-interop.js +1 -1
- package/dist/data-transfer/share-interop.js.map +1 -1
- package/dist/data-transfer/shell-items.d.ts +10 -0
- package/dist/data-transfer/shell-items.d.ts.map +1 -0
- package/dist/data-transfer/shell-items.js +67 -0
- package/dist/data-transfer/shell-items.js.map +1 -0
- package/dist/data-transfer/window-drop.d.ts +35 -0
- package/dist/data-transfer/window-drop.d.ts.map +1 -0
- package/dist/data-transfer/window-drop.js +311 -0
- package/dist/data-transfer/window-drop.js.map +1 -0
- package/dist/devices/native.js +1 -2
- package/dist/devices/native.js.map +1 -1
- package/dist/downloads/chrome-downloads.d.ts +8 -0
- package/dist/downloads/chrome-downloads.d.ts.map +1 -1
- package/dist/downloads/chrome-downloads.js +35 -6
- package/dist/downloads/chrome-downloads.js.map +1 -1
- package/dist/downloads/download-record.d.ts +3 -2
- package/dist/downloads/download-record.d.ts.map +1 -1
- package/dist/downloads/download-record.js.map +1 -1
- package/dist/downloads/download-transfer.d.ts.map +1 -1
- package/dist/downloads/download-transfer.js +3 -3
- package/dist/downloads/download-transfer.js.map +1 -1
- package/dist/downloads/download-types.d.ts +3 -1
- package/dist/downloads/download-types.d.ts.map +1 -1
- package/dist/downloads/download-types.js.map +1 -1
- package/dist/downloads/fetch-to-file.d.ts +11 -6
- package/dist/downloads/fetch-to-file.d.ts.map +1 -1
- package/dist/downloads/fetch-to-file.js +45 -16
- package/dist/downloads/fetch-to-file.js.map +1 -1
- package/dist/downloads/taskbar-progress.d.ts +3 -18
- package/dist/downloads/taskbar-progress.d.ts.map +1 -1
- package/dist/downloads/taskbar-progress.js +1 -38
- package/dist/downloads/taskbar-progress.js.map +1 -1
- package/dist/enums.d.ts +4 -0
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +4 -0
- package/dist/enums.js.map +1 -1
- package/dist/forms/form-field-props.d.ts +2 -2
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/index.js +1 -0
- package/dist/input/index.js.map +1 -1
- package/dist/input/modifier-keys.d.ts +24 -0
- package/dist/input/modifier-keys.d.ts.map +1 -0
- package/dist/input/modifier-keys.js +20 -0
- package/dist/input/modifier-keys.js.map +1 -0
- package/dist/media/pixel-buffer.d.ts.map +1 -1
- package/dist/media/pixel-buffer.js +1 -1
- package/dist/media/pixel-buffer.js.map +1 -1
- package/dist/messaging/web-view2/core.d.ts +56 -0
- package/dist/messaging/web-view2/core.d.ts.map +1 -1
- package/dist/messaging/web-view2/core.js +6 -0
- package/dist/messaging/web-view2/core.js.map +1 -1
- package/dist/messaging/web-view2/environment.d.ts +41 -0
- package/dist/messaging/web-view2/environment.d.ts.map +1 -0
- package/dist/messaging/web-view2/environment.js +91 -0
- package/dist/messaging/web-view2/environment.js.map +1 -0
- package/dist/messaging/web-view2/index.d.ts +9 -1
- package/dist/messaging/web-view2/index.d.ts.map +1 -1
- package/dist/messaging/web-view2/index.js +5 -0
- package/dist/messaging/web-view2/index.js.map +1 -1
- package/dist/messaging/web-view2/input.d.ts +68 -0
- package/dist/messaging/web-view2/input.d.ts.map +1 -0
- package/dist/messaging/web-view2/input.js +108 -0
- package/dist/messaging/web-view2/input.js.map +1 -0
- package/dist/messaging/web-view2/protocol.d.ts +24 -0
- package/dist/messaging/web-view2/protocol.d.ts.map +1 -0
- package/dist/messaging/web-view2/protocol.js +31 -0
- package/dist/messaging/web-view2/protocol.js.map +1 -0
- package/dist/messaging/web-view2/recovery.d.ts +65 -0
- package/dist/messaging/web-view2/recovery.d.ts.map +1 -0
- package/dist/messaging/web-view2/recovery.js +138 -0
- package/dist/messaging/web-view2/recovery.js.map +1 -0
- package/dist/messaging/web-view2/requests.d.ts +88 -0
- package/dist/messaging/web-view2/requests.d.ts.map +1 -0
- package/dist/messaging/web-view2/requests.js +169 -0
- package/dist/messaging/web-view2/requests.js.map +1 -0
- package/dist/messaging/web-view2/transport.d.ts.map +1 -1
- package/dist/messaging/web-view2/transport.js +1 -4
- package/dist/messaging/web-view2/transport.js.map +1 -1
- package/dist/native-identity.d.ts +10 -0
- package/dist/native-identity.d.ts.map +1 -0
- package/dist/native-identity.js +20 -0
- package/dist/native-identity.js.map +1 -0
- package/dist/progress/TaskbarProgress.d.svelte.ts +6 -0
- package/dist/progress/TaskbarProgress.svelte +32 -0
- package/dist/progress/aggregate.d.ts +23 -0
- package/dist/progress/aggregate.d.ts.map +1 -0
- package/dist/progress/aggregate.js +59 -0
- package/dist/progress/aggregate.js.map +1 -0
- package/dist/progress/core.d.ts +14 -0
- package/dist/progress/core.d.ts.map +1 -0
- package/dist/progress/core.js +8 -0
- package/dist/progress/core.js.map +1 -0
- package/dist/progress/index.d.ts +5 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +4 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/progress-event.d.ts +18 -0
- package/dist/progress/progress-event.d.ts.map +1 -0
- package/dist/progress/progress-event.js +19 -0
- package/dist/progress/progress-event.js.map +1 -0
- package/dist/progress/progress-operation.d.ts +163 -0
- package/dist/progress/progress-operation.d.ts.map +1 -0
- package/dist/progress/progress-operation.js +356 -0
- package/dist/progress/progress-operation.js.map +1 -0
- package/dist/progress/progress-registry.d.ts +89 -0
- package/dist/progress/progress-registry.d.ts.map +1 -0
- package/dist/progress/progress-registry.js +187 -0
- package/dist/progress/progress-registry.js.map +1 -0
- package/dist/progress/progress-source.d.ts +46 -0
- package/dist/progress/progress-source.d.ts.map +1 -0
- package/dist/progress/progress-source.js +31 -0
- package/dist/progress/progress-source.js.map +1 -0
- package/dist/progress/progress-state.d.ts +54 -0
- package/dist/progress/progress-state.d.ts.map +1 -0
- package/dist/progress/progress-state.js +35 -0
- package/dist/progress/progress-state.js.map +1 -0
- package/dist/progress/progress-text.d.ts +10 -0
- package/dist/progress/progress-text.d.ts.map +1 -0
- package/dist/progress/progress-text.js +23 -0
- package/dist/progress/progress-text.js.map +1 -0
- package/dist/progress/scoped-source.d.ts +31 -0
- package/dist/progress/scoped-source.d.ts.map +1 -0
- package/dist/progress/scoped-source.js +46 -0
- package/dist/progress/scoped-source.js.map +1 -0
- package/dist/progress/taskbar-progress-props.d.ts +15 -0
- package/dist/progress/taskbar-progress-props.d.ts.map +1 -0
- package/dist/progress/taskbar-progress-props.js +2 -0
- package/dist/progress/taskbar-progress-props.js.map +1 -0
- package/dist/progress/taskbar-progress.d.ts +44 -0
- package/dist/progress/taskbar-progress.d.ts.map +1 -0
- package/dist/progress/taskbar-progress.js +62 -0
- package/dist/progress/taskbar-progress.js.map +1 -0
- package/dist/progress/track-operation.d.ts +36 -0
- package/dist/progress/track-operation.d.ts.map +1 -0
- package/dist/progress/track-operation.js +53 -0
- package/dist/progress/track-operation.js.map +1 -0
- package/dist/renderer/host/host.d.ts.map +1 -1
- package/dist/renderer/host/host.js +33 -16
- package/dist/renderer/host/host.js.map +1 -1
- package/dist/renderer/host/structure-sync.d.ts +9 -0
- package/dist/renderer/host/structure-sync.d.ts.map +1 -0
- package/dist/renderer/host/structure-sync.js +24 -0
- package/dist/renderer/host/structure-sync.js.map +1 -0
- package/dist/security/data-protection-error.d.ts +14 -0
- package/dist/security/data-protection-error.d.ts.map +1 -0
- package/dist/security/data-protection-error.js +15 -0
- package/dist/security/data-protection-error.js.map +1 -0
- package/dist/security/index.d.ts +48 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +32 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/native.d.ts +43 -0
- package/dist/security/native.d.ts.map +1 -0
- package/dist/security/native.js +170 -0
- package/dist/security/native.js.map +1 -0
- package/dist/security/protection-scope.d.ts +13 -0
- package/dist/security/protection-scope.d.ts.map +1 -0
- package/dist/security/protection-scope.js +11 -0
- package/dist/security/protection-scope.js.map +1 -0
- package/dist/store/states.d.ts +2 -2
- package/dist/store/windows-identity.d.ts +2 -6
- package/dist/store/windows-identity.d.ts.map +1 -1
- package/dist/store/windows-identity.js +2 -29
- package/dist/store/windows-identity.js.map +1 -1
- package/dist/store/windows-packages.d.ts +2 -2
- package/dist/store/windows-store.d.ts +2 -2
- package/dist/tray/click-detector.d.ts.map +1 -1
- package/dist/tray/click-detector.js.map +1 -1
- package/dist/tray/flyout-model.d.ts +4 -3
- package/dist/tray/flyout-model.d.ts.map +1 -1
- package/dist/tray/flyout-model.js +12 -2
- package/dist/tray/flyout-model.js.map +1 -1
- package/dist/tray/menu/icon.d.ts +17 -0
- package/dist/tray/menu/icon.d.ts.map +1 -0
- package/dist/tray/menu/icon.js +31 -0
- package/dist/tray/menu/icon.js.map +1 -0
- package/dist/tray/menu/index.d.ts +1 -1
- package/dist/tray/menu/index.d.ts.map +1 -1
- package/dist/tray/menu/index.js.map +1 -1
- package/dist/tray/menu/types.d.ts +23 -6
- package/dist/tray/menu/types.d.ts.map +1 -1
- package/dist/tray/menu/types.js.map +1 -1
- package/dist/tray/menu-svelte/TrayMenuOperations.d.svelte.ts +6 -0
- package/dist/tray/menu-svelte/TrayMenuOperations.svelte +33 -0
- package/dist/tray/menu-svelte/TrayMenuProgress.d.svelte.ts +6 -0
- package/dist/tray/menu-svelte/TrayMenuProgress.svelte +28 -0
- package/dist/tray/menu-svelte/index.d.ts +3 -1
- package/dist/tray/menu-svelte/index.d.ts.map +1 -1
- package/dist/tray/menu-svelte/index.js +2 -0
- package/dist/tray/menu-svelte/index.js.map +1 -1
- package/dist/tray/menu-svelte/menu-node.d.ts +9 -9
- package/dist/tray/menu-svelte/menu-props.d.ts +16 -0
- package/dist/tray/menu-svelte/menu-props.d.ts.map +1 -1
- package/dist/tray/menu-svelte/operation-ids.d.ts +8 -0
- package/dist/tray/menu-svelte/operation-ids.d.ts.map +1 -0
- package/dist/tray/menu-svelte/operation-ids.js +20 -0
- package/dist/tray/menu-svelte/operation-ids.js.map +1 -0
- package/dist/tray/native.d.ts +15 -5
- package/dist/tray/native.d.ts.map +1 -1
- package/dist/tray/native.js +27 -45
- package/dist/tray/native.js.map +1 -1
- package/dist/tray/personalize.d.ts +18 -0
- package/dist/tray/personalize.d.ts.map +1 -0
- package/dist/tray/personalize.js +42 -0
- package/dist/tray/personalize.js.map +1 -0
- package/dist/tray/pointer-share.d.ts +27 -0
- package/dist/tray/pointer-share.d.ts.map +1 -0
- package/dist/tray/pointer-share.js +61 -0
- package/dist/tray/pointer-share.js.map +1 -0
- package/dist/tray/standalone/icon-raster.d.ts +72 -0
- package/dist/tray/standalone/icon-raster.d.ts.map +1 -0
- package/dist/tray/standalone/icon-raster.js +161 -0
- package/dist/tray/standalone/icon-raster.js.map +1 -0
- package/dist/tray/standalone/index.d.ts +4 -2
- package/dist/tray/standalone/index.d.ts.map +1 -1
- package/dist/tray/standalone/index.js +2 -0
- package/dist/tray/standalone/index.js.map +1 -1
- package/dist/tray/standalone/menu-icons.d.ts +9 -0
- package/dist/tray/standalone/menu-icons.d.ts.map +1 -0
- package/dist/tray/standalone/menu-icons.js +280 -0
- package/dist/tray/standalone/menu-icons.js.map +1 -0
- package/dist/tray/standalone/menu-theme.d.ts +38 -0
- package/dist/tray/standalone/menu-theme.d.ts.map +1 -0
- package/dist/tray/standalone/menu-theme.js +74 -0
- package/dist/tray/standalone/menu-theme.js.map +1 -0
- package/dist/tray/standalone/native.d.ts +24 -7
- package/dist/tray/standalone/native.d.ts.map +1 -1
- package/dist/tray/standalone/native.js +63 -16
- package/dist/tray/standalone/native.js.map +1 -1
- package/dist/tray/standalone/standalone-tray.d.ts +17 -2
- package/dist/tray/standalone/standalone-tray.d.ts.map +1 -1
- package/dist/tray/standalone/standalone-tray.js +34 -2
- package/dist/tray/standalone/standalone-tray.js.map +1 -1
- package/dist/tray/themed-icon.d.ts.map +1 -1
- package/dist/tray/themed-icon.js +4 -28
- package/dist/tray/themed-icon.js.map +1 -1
- package/dist/tray/tray-core.d.ts.map +1 -1
- package/dist/tray/tray-core.js +6 -1
- package/dist/tray/tray-core.js.map +1 -1
- package/dist/tray/tray-extras.d.ts +26 -2
- package/dist/tray/tray-extras.d.ts.map +1 -1
- package/dist/tray/tray-manifest.d.ts +44 -4
- package/dist/tray/tray-manifest.d.ts.map +1 -1
- package/dist/tray/tray-manifest.js +48 -4
- package/dist/tray/tray-manifest.js.map +1 -1
- package/dist/vite/entrypoints/build-tray.d.ts +3 -1
- package/dist/vite/entrypoints/build-tray.d.ts.map +1 -1
- package/dist/vite/entrypoints/build-tray.js +22 -16
- package/dist/vite/entrypoints/build-tray.js.map +1 -1
- package/dist/vite/entrypoints/extract-tray.d.ts +7 -6
- package/dist/vite/entrypoints/extract-tray.d.ts.map +1 -1
- package/dist/vite/entrypoints/extract-tray.js +35 -15
- package/dist/vite/entrypoints/extract-tray.js.map +1 -1
- package/dist/vite/entrypoints/tray-module.d.ts +2 -1
- package/dist/vite/entrypoints/tray-module.d.ts.map +1 -1
- package/dist/vite/entrypoints/tray-module.js +8 -4
- package/dist/vite/entrypoints/tray-module.js.map +1 -1
- package/dist/web-apis/eye-dropper.d.ts.map +1 -1
- package/dist/web-apis/eye-dropper.js +8 -5
- package/dist/web-apis/eye-dropper.js.map +1 -1
- package/dist/web-apis/file-read.d.ts +14 -0
- package/dist/web-apis/file-read.d.ts.map +1 -0
- package/dist/web-apis/file-read.js +37 -0
- package/dist/web-apis/file-read.js.map +1 -0
- package/dist/web-apis/file-system.d.ts +9 -0
- package/dist/web-apis/file-system.d.ts.map +1 -1
- package/dist/web-apis/file-system.js +24 -0
- package/dist/web-apis/file-system.js.map +1 -1
- package/dist/web-apis/media-devices-source.d.ts +1 -1
- package/dist/web-apis/native.d.ts +0 -7
- package/dist/web-apis/native.d.ts.map +1 -1
- package/dist/web-apis/native.js +0 -19
- package/dist/web-apis/native.js.map +1 -1
- package/dist/win2d/activation-failure.d.ts +10 -0
- package/dist/win2d/activation-failure.d.ts.map +1 -0
- package/dist/win2d/activation-failure.js +30 -0
- package/dist/win2d/activation-failure.js.map +1 -0
- package/dist/win2d/element-lifecycle.d.ts.map +1 -1
- package/dist/win2d/element-lifecycle.js +6 -1
- package/dist/win2d/element-lifecycle.js.map +1 -1
- package/dist/win2d/manifest.d.ts +29 -0
- package/dist/win2d/manifest.d.ts.map +1 -0
- package/dist/win2d/manifest.js +67 -0
- package/dist/win2d/manifest.js.map +1 -0
- package/dist/win32/index.d.ts +3 -0
- package/dist/win32/index.d.ts.map +1 -0
- package/dist/win32/index.js +11 -0
- package/dist/win32/index.js.map +1 -0
- package/dist/win32-calls.d.ts +6 -0
- package/dist/win32-calls.d.ts.map +1 -1
- package/dist/win32-calls.js +6 -1
- package/dist/win32-calls.js.map +1 -1
- package/dist/win32-foreground.d.ts +34 -0
- package/dist/win32-foreground.d.ts.map +1 -0
- package/dist/win32-foreground.js +91 -0
- package/dist/win32-foreground.js.map +1 -0
- package/dist/win32-icons.d.ts.map +1 -1
- package/dist/win32-icons.js +1 -2
- package/dist/win32-icons.js.map +1 -1
- package/dist/win32-key-state.d.ts +31 -0
- package/dist/win32-key-state.d.ts.map +1 -0
- package/dist/win32-key-state.js +41 -0
- package/dist/win32-key-state.js.map +1 -0
- package/dist/window/anchor.d.ts +15 -0
- package/dist/window/anchor.d.ts.map +1 -1
- package/dist/window/anchor.js +23 -0
- package/dist/window/anchor.js.map +1 -1
- package/dist/window/apply-frame.d.ts +4 -2
- package/dist/window/apply-frame.d.ts.map +1 -1
- package/dist/window/apply-frame.js +2 -3
- package/dist/window/apply-frame.js.map +1 -1
- package/dist/window/bootstrap-core.d.ts +69 -0
- package/dist/window/bootstrap-core.d.ts.map +1 -0
- package/dist/window/bootstrap-core.js +93 -0
- package/dist/window/bootstrap-core.js.map +1 -0
- package/dist/window/bootstrap-mode.d.ts +21 -0
- package/dist/window/bootstrap-mode.d.ts.map +1 -0
- package/dist/window/bootstrap-mode.js +17 -0
- package/dist/window/bootstrap-mode.js.map +1 -0
- package/dist/window/bootstrap.d.ts +12 -28
- package/dist/window/bootstrap.d.ts.map +1 -1
- package/dist/window/bootstrap.js +18 -66
- package/dist/window/bootstrap.js.map +1 -1
- package/dist/window/cover.d.ts +43 -0
- package/dist/window/cover.d.ts.map +1 -0
- package/dist/window/cover.js +64 -0
- package/dist/window/cover.js.map +1 -0
- package/dist/window/create-window.d.ts +1 -1
- package/dist/window/create-window.d.ts.map +1 -1
- package/dist/window/create-window.js +2 -0
- package/dist/window/create-window.js.map +1 -1
- package/dist/window/dpi-awareness.d.ts +71 -0
- package/dist/window/dpi-awareness.d.ts.map +1 -0
- package/dist/window/dpi-awareness.js +127 -0
- package/dist/window/dpi-awareness.js.map +1 -0
- package/dist/window/foreground-filter.d.ts +71 -0
- package/dist/window/foreground-filter.d.ts.map +1 -0
- package/dist/window/foreground-filter.js +108 -0
- package/dist/window/foreground-filter.js.map +1 -0
- package/dist/window/foreground-native.d.ts +25 -0
- package/dist/window/foreground-native.d.ts.map +1 -0
- package/dist/window/foreground-native.js +86 -0
- package/dist/window/foreground-native.js.map +1 -0
- package/dist/window/foreground.d.ts +49 -0
- package/dist/window/foreground.d.ts.map +1 -0
- package/dist/window/foreground.js +78 -0
- package/dist/window/foreground.js.map +1 -0
- package/dist/window/index.d.ts +2 -0
- package/dist/window/index.d.ts.map +1 -1
- package/dist/window/index.js +1 -0
- package/dist/window/index.js.map +1 -1
- package/dist/window/native.d.ts.map +1 -1
- package/dist/window/native.js +1 -2
- package/dist/window/native.js.map +1 -1
- package/dist/window/package-identity.d.ts +17 -0
- package/dist/window/package-identity.d.ts.map +1 -0
- package/dist/window/package-identity.js +97 -0
- package/dist/window/package-identity.js.map +1 -0
- package/dist/window/system-dispatcher-queue.d.ts.map +1 -1
- package/dist/window/system-dispatcher-queue.js +1 -2
- package/dist/window/system-dispatcher-queue.js.map +1 -1
- package/dist/window/taskbar-calls.d.ts +1 -1
- package/dist/window/taskbar-native.d.ts.map +1 -1
- package/dist/window/taskbar-native.js +1 -2
- package/dist/window/taskbar-native.js.map +1 -1
- package/dist/window/window-handle.d.ts +25 -1
- package/dist/window/window-handle.d.ts.map +1 -1
- package/dist/window/window-handle.js +27 -1
- package/dist/window/window-handle.js.map +1 -1
- package/dist/window/window-host.svelte.d.ts +11 -2
- package/dist/window/window-host.svelte.d.ts.map +1 -1
- package/dist/window/window-host.svelte.js +38 -4
- package/dist/window/window-host.svelte.js.map +1 -1
- package/package.json +43 -4
- package/src/app/activate.ts +3 -0
- package/src/app/activation/index.ts +3 -0
- package/src/app/activation/login.ts +2 -1
- package/src/app/activation/native.ts +1 -1
- package/src/app/activation/packaged.ts +118 -0
- package/src/app/activation/receive.ts +24 -4
- package/src/app/activation/registration.ts +7 -7
- package/src/app/activation/scheme.ts +19 -0
- package/src/app/index.ts +4 -2
- package/src/app/instance-running.ts +22 -0
- package/src/app/jump-list/native.ts +1 -2
- package/src/app/launch-command.ts +19 -5
- package/src/app/native-messaging/browsers.ts +21 -0
- package/src/app/native-messaging/index.ts +124 -0
- package/src/app/native.ts +1 -32
- package/src/app/notification-source.ts +1 -3
- package/src/app/shell/native.ts +1 -1
- package/src/app/single-instance.ts +34 -10
- package/src/app/tray-instance.ts +7 -5
- package/src/automation/backend.ts +56 -0
- package/src/automation/client.ts +327 -0
- package/src/automation/ids.ts +97 -0
- package/src/automation/index.ts +23 -0
- package/src/automation/native.ts +688 -0
- package/src/automation/text.ts +174 -0
- package/src/automation/with-client.ts +20 -0
- package/src/automation/worker-job.ts +97 -0
- package/src/automation/worker.ts +116 -0
- package/src/chrome/context-menus/context-menu-schema.ts +1 -12
- package/src/chrome/parse-or-throw.ts +14 -0
- package/src/chrome/permissions/permission-schema.ts +1 -12
- package/src/chrome/windows/chrome-windows.ts +1 -13
- package/src/components/hand-written/items/keyed-rows.svelte.ts +6 -0
- package/src/components/index.ts +1 -0
- package/src/components/runtime.svelte.ts +8 -0
- package/src/components/window-context.ts +23 -0
- package/src/css/runtime/containers.ts +1 -20
- package/src/css/runtime/native.ts +46 -21
- package/src/css/translate/property-kit.ts +9 -0
- package/src/css/translate/transition-properties.ts +44 -10
- package/src/data-transfer/data-transfer.ts +3 -3
- package/src/data-transfer/drag-effects.ts +48 -4
- package/src/data-transfer/drag-helper.ts +216 -0
- package/src/data-transfer/drop-target.ts +90 -26
- package/src/data-transfer/index.ts +1 -0
- package/src/data-transfer/launcher.ts +65 -9
- package/src/data-transfer/native.ts +184 -0
- package/src/data-transfer/ole-data-object.ts +200 -0
- package/src/data-transfer/ole-drop-target.ts +263 -0
- package/src/data-transfer/share-interop.ts +1 -1
- package/src/data-transfer/shell-items.ts +81 -0
- package/src/data-transfer/window-drop.ts +411 -0
- package/src/devices/native.ts +1 -1
- package/src/downloads/chrome-downloads.ts +46 -6
- package/src/downloads/download-record.ts +3 -2
- package/src/downloads/download-transfer.ts +3 -3
- package/src/downloads/download-types.ts +3 -0
- package/src/downloads/fetch-to-file.ts +47 -17
- package/src/downloads/taskbar-progress.ts +3 -49
- package/src/enums.ts +4 -0
- package/src/input/index.ts +2 -0
- package/src/input/modifier-keys.ts +30 -0
- package/src/media/pixel-buffer.ts +1 -1
- package/src/messaging/web-view2/core.ts +64 -0
- package/src/messaging/web-view2/environment.ts +131 -0
- package/src/messaging/web-view2/index.ts +11 -0
- package/src/messaging/web-view2/input.ts +154 -0
- package/src/messaging/web-view2/protocol.ts +41 -0
- package/src/messaging/web-view2/recovery.ts +177 -0
- package/src/messaging/web-view2/requests.ts +238 -0
- package/src/messaging/web-view2/transport.ts +1 -5
- package/src/native-identity.ts +22 -0
- package/src/progress/TaskbarProgress.d.svelte.ts +6 -0
- package/src/progress/aggregate.ts +68 -0
- package/src/progress/core.ts +13 -0
- package/src/progress/index.ts +4 -0
- package/src/progress/progress-event.ts +25 -0
- package/src/progress/progress-operation.ts +469 -0
- package/src/progress/progress-registry.ts +224 -0
- package/src/progress/progress-source.ts +66 -0
- package/src/progress/progress-state.ts +72 -0
- package/src/progress/progress-text.ts +27 -0
- package/src/progress/scoped-source.ts +56 -0
- package/src/progress/taskbar-progress-props.ts +18 -0
- package/src/progress/taskbar-progress.ts +80 -0
- package/src/progress/track-operation.ts +81 -0
- package/src/renderer/host/host.ts +39 -17
- package/src/renderer/host/structure-sync.ts +25 -0
- package/src/security/data-protection-error.ts +18 -0
- package/src/security/index.ts +57 -0
- package/src/security/native.ts +234 -0
- package/src/security/protection-scope.ts +13 -0
- package/src/store/windows-identity.ts +3 -35
- package/src/tray/click-detector.ts +6 -7
- package/src/tray/flyout-model.ts +14 -3
- package/src/tray/menu/icon.ts +40 -0
- package/src/tray/menu/index.ts +3 -0
- package/src/tray/menu/types.ts +27 -6
- package/src/tray/menu-svelte/TrayMenuOperations.d.svelte.ts +6 -0
- package/src/tray/menu-svelte/TrayMenuProgress.d.svelte.ts +6 -0
- package/src/tray/menu-svelte/index.ts +4 -0
- package/src/tray/menu-svelte/menu-props.ts +20 -0
- package/src/tray/menu-svelte/operation-ids.ts +21 -0
- package/src/tray/native.ts +44 -49
- package/src/tray/personalize.ts +57 -0
- package/src/tray/pointer-share.ts +71 -0
- package/src/tray/standalone/icon-raster.ts +208 -0
- package/src/tray/standalone/index.ts +5 -1
- package/src/tray/standalone/menu-icons.ts +317 -0
- package/src/tray/standalone/menu-theme.ts +90 -0
- package/src/tray/standalone/native.ts +83 -16
- package/src/tray/standalone/standalone-tray.ts +68 -5
- package/src/tray/themed-icon.ts +4 -36
- package/src/tray/tray-core.ts +7 -1
- package/src/tray/tray-extras.ts +31 -2
- package/src/tray/tray-manifest.ts +53 -4
- package/src/vite/entrypoints/build-tray.ts +23 -16
- package/src/vite/entrypoints/extract-tray.ts +41 -15
- package/src/vite/entrypoints/tray-module.ts +8 -4
- package/src/web-apis/eye-dropper.ts +9 -5
- package/src/web-apis/file-read.ts +43 -0
- package/src/web-apis/file-system.ts +33 -0
- package/src/web-apis/native.ts +0 -20
- package/src/win2d/activation-failure.ts +35 -0
- package/src/win2d/element-lifecycle.ts +6 -1
- package/src/win2d/manifest.ts +78 -0
- package/src/win32/index.ts +19 -0
- package/src/win32-calls.ts +8 -1
- package/src/win32-foreground.ts +100 -0
- package/src/win32-icons.ts +7 -2
- package/src/win32-key-state.ts +48 -0
- package/src/window/anchor.ts +28 -0
- package/src/window/apply-frame.ts +6 -4
- package/src/window/bootstrap-core.ts +165 -0
- package/src/window/bootstrap-mode.ts +23 -0
- package/src/window/bootstrap.ts +20 -103
- package/src/window/cover.ts +100 -0
- package/src/window/create-window.ts +4 -0
- package/src/window/dpi-awareness.ts +162 -0
- package/src/window/foreground-filter.ts +167 -0
- package/src/window/foreground-native.ts +91 -0
- package/src/window/foreground.ts +106 -0
- package/src/window/index.ts +2 -0
- package/src/window/native.ts +1 -1
- package/src/window/package-identity.ts +112 -0
- package/src/window/system-dispatcher-queue.ts +7 -2
- package/src/window/taskbar-native.ts +1 -2
- package/src/window/window-handle.ts +29 -1
- package/src/window/window-host.svelte.ts +59 -6
- package/web-types.json +11 -3
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { messageOf, waitForCoreWebView2 } from "./core.ts";
|
|
2
|
+
import type { CoreWebView2Like, WebView2Like } from "./core.ts";
|
|
3
|
+
import { CoreWebView2ProcessFailedKind } from "#winui/microsoft/web/web-view2/core/CoreWebView2ProcessFailedKind";
|
|
4
|
+
|
|
5
|
+
/** What went wrong in the browser, as `keepWebView2Alive` tells the app. */
|
|
6
|
+
export const ProcessFailureKind = {
|
|
7
|
+
BROWSER_EXITED: "browserExited",
|
|
8
|
+
RENDER_EXITED: "renderExited",
|
|
9
|
+
UNRESPONSIVE: "unresponsive",
|
|
10
|
+
OTHER: "other"
|
|
11
|
+
} as const;
|
|
12
|
+
/** One of the values of `ProcessFailureKind`. */
|
|
13
|
+
export type ProcessFailureKind = (typeof ProcessFailureKind)[keyof typeof ProcessFailureKind];
|
|
14
|
+
|
|
15
|
+
const KINDS = new Map<number, ProcessFailureKind>([
|
|
16
|
+
[CoreWebView2ProcessFailedKind.BrowserProcessExited, ProcessFailureKind.BROWSER_EXITED],
|
|
17
|
+
[CoreWebView2ProcessFailedKind.RenderProcessExited, ProcessFailureKind.RENDER_EXITED],
|
|
18
|
+
[CoreWebView2ProcessFailedKind.FrameRenderProcessExited, ProcessFailureKind.RENDER_EXITED],
|
|
19
|
+
[CoreWebView2ProcessFailedKind.RenderProcessUnresponsive, ProcessFailureKind.UNRESPONSIVE]
|
|
20
|
+
]);
|
|
21
|
+
const DEFAULT_MAX_CRASHES = 3;
|
|
22
|
+
const DEFAULT_WINDOW_MILLISECONDS = 30_000;
|
|
23
|
+
|
|
24
|
+
/** The control that `keepWebView2Alive` watches, and the means to stop or restart it. */
|
|
25
|
+
export interface WebView2Guard {
|
|
26
|
+
/**
|
|
27
|
+
* Tries again after the guard gave up (`onGaveUp`): forgets the failures
|
|
28
|
+
* so far and rebuilds the control, as for a browser that exited
|
|
29
|
+
* Does nothing while a recovery is running or after `dispose`
|
|
30
|
+
*/
|
|
31
|
+
retry(): Promise<void>;
|
|
32
|
+
/** Stops listening; a recovery already running finishes. */
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function quietly(action: () => void) {
|
|
37
|
+
try {
|
|
38
|
+
action();
|
|
39
|
+
} catch {
|
|
40
|
+
// A dead core may throw while its handler is removed; there is nothing left to undo
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Keeps a `WebView2` working through the browser's crashes, with no action
|
|
46
|
+
* from the user
|
|
47
|
+
*
|
|
48
|
+
* It runs `setup` with the core of `control`, then watches the control's
|
|
49
|
+
* `CoreProcessFailed`:
|
|
50
|
+
*
|
|
51
|
+
* - the browser process exiting leaves the control dead, so it calls
|
|
52
|
+
* `rebuild`, which must resolve with a new control that is already
|
|
53
|
+
* started (`startWebView2`), then runs `setup` with the new core
|
|
54
|
+
* - any other process failing (a renderer, a utility process) reloads the
|
|
55
|
+
* page in place
|
|
56
|
+
* - more than `maxCrashes` failures within `windowMilliseconds` stop the
|
|
57
|
+
* loop: `onGaveUp` is called once, and nothing more happens until
|
|
58
|
+
* `retry()`
|
|
59
|
+
* - a failure while a recovery is running is ignored, so one is never run twice
|
|
60
|
+
*
|
|
61
|
+
* Everything bound to the old core is lost with it: scripts from
|
|
62
|
+
* `addDocumentCreatedScript`, the handlers (`onNavigationStarting`,
|
|
63
|
+
* `onPermissionRequested`, `onWebResourceRequested`), a `webView2Transport`
|
|
64
|
+
* and its messaging; put them in `setup`, which runs again after every rebuild
|
|
65
|
+
* Cookies and storage live in the profile folder and survive; a page that is
|
|
66
|
+
* only reloaded keeps the scripts and handlers, and loses its own state
|
|
67
|
+
*
|
|
68
|
+
* A failure of `rebuild` or `setup` gives up, with the error's text as the
|
|
69
|
+
* reason
|
|
70
|
+
*
|
|
71
|
+
* @param options - The control and the policy.
|
|
72
|
+
* @returns The guard.
|
|
73
|
+
*/
|
|
74
|
+
export function keepWebView2Alive({
|
|
75
|
+
control,
|
|
76
|
+
setup,
|
|
77
|
+
rebuild,
|
|
78
|
+
maxCrashes = DEFAULT_MAX_CRASHES,
|
|
79
|
+
windowMilliseconds = DEFAULT_WINDOW_MILLISECONDS,
|
|
80
|
+
onRecovering,
|
|
81
|
+
onGaveUp
|
|
82
|
+
}: {
|
|
83
|
+
control: WebView2Like;
|
|
84
|
+
setup(core: CoreWebView2Like): void | Promise<void>;
|
|
85
|
+
rebuild(): Promise<WebView2Like>;
|
|
86
|
+
maxCrashes?: number;
|
|
87
|
+
windowMilliseconds?: number;
|
|
88
|
+
onRecovering?(failure: { readonly kind: ProcessFailureKind }): void;
|
|
89
|
+
onGaveUp?(failure: { readonly reason: string }): void;
|
|
90
|
+
}) {
|
|
91
|
+
let current = control;
|
|
92
|
+
let unsubscribe: (() => void) | undefined;
|
|
93
|
+
let failures: number[] = [];
|
|
94
|
+
let isRecovering = false;
|
|
95
|
+
let isGivenUp = false;
|
|
96
|
+
let isDisposed = false;
|
|
97
|
+
|
|
98
|
+
function giveUp(reason: string) {
|
|
99
|
+
isGivenUp = true;
|
|
100
|
+
onGaveUp?.({ reason });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function watch(next: WebView2Like) {
|
|
104
|
+
current = next;
|
|
105
|
+
unsubscribe = next.onCoreProcessFailed((_sender, args) => {
|
|
106
|
+
void recover(KINDS.get(args.processFailedKind) ?? ProcessFailureKind.OTHER);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function run(kind: ProcessFailureKind) {
|
|
111
|
+
const isRebuild = kind === ProcessFailureKind.BROWSER_EXITED;
|
|
112
|
+
if (!isRebuild) {
|
|
113
|
+
(await waitForCoreWebView2(current)).reload();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
quietly(() => unsubscribe?.());
|
|
118
|
+
watch(await rebuild());
|
|
119
|
+
await setup(await waitForCoreWebView2(current));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function recover(kind: ProcessFailureKind) {
|
|
123
|
+
const isIgnored = isDisposed || isGivenUp || isRecovering;
|
|
124
|
+
if (isIgnored) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const now = Date.now();
|
|
129
|
+
failures = [...failures.filter(failedAt => now - failedAt < windowMilliseconds), now];
|
|
130
|
+
const isStreak = failures.length > maxCrashes;
|
|
131
|
+
if (isStreak) {
|
|
132
|
+
giveUp(`${failures.length} failures within ${windowMilliseconds} ms`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
isRecovering = true;
|
|
137
|
+
onRecovering?.({ kind });
|
|
138
|
+
try {
|
|
139
|
+
await run(kind);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
giveUp(messageOf(error));
|
|
142
|
+
} finally {
|
|
143
|
+
isRecovering = false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function start() {
|
|
148
|
+
isRecovering = true;
|
|
149
|
+
watch(control);
|
|
150
|
+
try {
|
|
151
|
+
await setup(await waitForCoreWebView2(control));
|
|
152
|
+
} catch (error) {
|
|
153
|
+
giveUp(messageOf(error));
|
|
154
|
+
} finally {
|
|
155
|
+
isRecovering = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
void start();
|
|
160
|
+
const guard: WebView2Guard = {
|
|
161
|
+
async retry() {
|
|
162
|
+
const isBusy = isDisposed || isRecovering;
|
|
163
|
+
if (isBusy) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
isGivenUp = false;
|
|
168
|
+
failures = [];
|
|
169
|
+
await recover(ProcessFailureKind.BROWSER_EXITED);
|
|
170
|
+
},
|
|
171
|
+
dispose() {
|
|
172
|
+
isDisposed = true;
|
|
173
|
+
quietly(() => unsubscribe?.());
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
return guard;
|
|
177
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { waitForCoreWebView2 } from "./core.ts";
|
|
2
|
+
import type { WebResourceRequestedArguments, WebView2Like } from "./core.ts";
|
|
3
|
+
import { streamOf } from "#src/components/byte-stream.js";
|
|
4
|
+
import { CoreWebView2WebResourceContext } from "#winui/microsoft/web/web-view2/core/CoreWebView2WebResourceContext";
|
|
5
|
+
import { InMemoryRandomAccessStream } from "#winui/windows/storage/streams/InMemoryRandomAccessStream";
|
|
6
|
+
|
|
7
|
+
/** What kind of request a filter matches. */
|
|
8
|
+
export const ResourceContext = {
|
|
9
|
+
ALL: "all",
|
|
10
|
+
DOCUMENT: "document",
|
|
11
|
+
STYLESHEET: "stylesheet",
|
|
12
|
+
IMAGE: "image",
|
|
13
|
+
MEDIA: "media",
|
|
14
|
+
FONT: "font",
|
|
15
|
+
SCRIPT: "script",
|
|
16
|
+
XML_HTTP_REQUEST: "xmlHttpRequest",
|
|
17
|
+
FETCH: "fetch",
|
|
18
|
+
TEXT_TRACK: "textTrack",
|
|
19
|
+
EVENT_SOURCE: "eventSource",
|
|
20
|
+
WEBSOCKET: "websocket",
|
|
21
|
+
MANIFEST: "manifest",
|
|
22
|
+
SIGNED_EXCHANGE: "signedExchange",
|
|
23
|
+
PING: "ping",
|
|
24
|
+
CSP_VIOLATION_REPORT: "cspViolationReport",
|
|
25
|
+
OTHER: "other"
|
|
26
|
+
} as const;
|
|
27
|
+
/** One of the values of `ResourceContext`. */
|
|
28
|
+
export type ResourceContext = (typeof ResourceContext)[keyof typeof ResourceContext];
|
|
29
|
+
|
|
30
|
+
const CONTEXTS = new Map<ResourceContext, number>([
|
|
31
|
+
[ResourceContext.ALL, CoreWebView2WebResourceContext.All],
|
|
32
|
+
[ResourceContext.DOCUMENT, CoreWebView2WebResourceContext.Document],
|
|
33
|
+
[ResourceContext.STYLESHEET, CoreWebView2WebResourceContext.Stylesheet],
|
|
34
|
+
[ResourceContext.IMAGE, CoreWebView2WebResourceContext.Image],
|
|
35
|
+
[ResourceContext.MEDIA, CoreWebView2WebResourceContext.Media],
|
|
36
|
+
[ResourceContext.FONT, CoreWebView2WebResourceContext.Font],
|
|
37
|
+
[ResourceContext.SCRIPT, CoreWebView2WebResourceContext.Script],
|
|
38
|
+
[ResourceContext.XML_HTTP_REQUEST, CoreWebView2WebResourceContext.XmlHttpRequest],
|
|
39
|
+
[ResourceContext.FETCH, CoreWebView2WebResourceContext.Fetch],
|
|
40
|
+
[ResourceContext.TEXT_TRACK, CoreWebView2WebResourceContext.TextTrack],
|
|
41
|
+
[ResourceContext.EVENT_SOURCE, CoreWebView2WebResourceContext.EventSource],
|
|
42
|
+
[ResourceContext.WEBSOCKET, CoreWebView2WebResourceContext.Websocket],
|
|
43
|
+
[ResourceContext.MANIFEST, CoreWebView2WebResourceContext.Manifest],
|
|
44
|
+
[ResourceContext.SIGNED_EXCHANGE, CoreWebView2WebResourceContext.SignedExchange],
|
|
45
|
+
[ResourceContext.PING, CoreWebView2WebResourceContext.Ping],
|
|
46
|
+
[ResourceContext.CSP_VIOLATION_REPORT, CoreWebView2WebResourceContext.CspViolationReport],
|
|
47
|
+
[ResourceContext.OTHER, CoreWebView2WebResourceContext.Other]
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const ALL_CONTEXTS = CoreWebView2WebResourceContext.All;
|
|
51
|
+
|
|
52
|
+
/** The status codes a block or a canned answer uses. */
|
|
53
|
+
export const StatusCode = {
|
|
54
|
+
OK: 200,
|
|
55
|
+
NO_CONTENT: 204,
|
|
56
|
+
FORBIDDEN: 403,
|
|
57
|
+
NOT_FOUND: 404
|
|
58
|
+
} as const;
|
|
59
|
+
const REASON_PHRASES = new Map<number, string>([
|
|
60
|
+
[StatusCode.OK, "OK"],
|
|
61
|
+
[StatusCode.NO_CONTENT, "No Content"],
|
|
62
|
+
[StatusCode.FORBIDDEN, "Forbidden"],
|
|
63
|
+
[StatusCode.NOT_FOUND, "Not Found"]
|
|
64
|
+
]);
|
|
65
|
+
const REGEXP_SPECIALS = /[$()+.[\\\]^{|}]/g;
|
|
66
|
+
|
|
67
|
+
/** Which requests a handler wants: a URI pattern (`*` and `?` are wildcards) of one kind. */
|
|
68
|
+
export interface RequestFilter {
|
|
69
|
+
readonly uri: string;
|
|
70
|
+
readonly context?: ResourceContext;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A request about to be sent. */
|
|
74
|
+
export interface WebRequest {
|
|
75
|
+
readonly uri: string;
|
|
76
|
+
readonly method: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** What answers a request instead of the network. */
|
|
80
|
+
export interface WebResponse {
|
|
81
|
+
/** Defaults to 200. */
|
|
82
|
+
readonly statusCode?: number;
|
|
83
|
+
readonly reasonPhrase?: string;
|
|
84
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
85
|
+
|
|
86
|
+
/** Text is sent as UTF-8; no body is an empty one. */
|
|
87
|
+
readonly body?: string | Uint8Array;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function patternOf(uri: string) {
|
|
91
|
+
const escaped = uri.replaceAll(REGEXP_SPECIALS, String.raw`\$&`);
|
|
92
|
+
return new RegExp(`^${escaped.replaceAll("*", ".*").replaceAll("?", ".")}$`, "i");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function contextNumberOf(context: ResourceContext) {
|
|
96
|
+
return CONTEXTS.get(context) ?? ALL_CONTEXTS;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The filters are the browser's: a handler hears every filter of the control,
|
|
101
|
+
* so each one checks its own.
|
|
102
|
+
*/
|
|
103
|
+
function isWanted({ filters, uri, context }: {
|
|
104
|
+
filters: readonly RequestFilter[];
|
|
105
|
+
uri: string;
|
|
106
|
+
context: number;
|
|
107
|
+
}) {
|
|
108
|
+
return filters.some(filter => {
|
|
109
|
+
const filterContext = contextNumberOf(filter.context ?? ResourceContext.ALL);
|
|
110
|
+
const isContextMatching = filterContext === ALL_CONTEXTS || filterContext === context;
|
|
111
|
+
return isContextMatching && patternOf(filter.uri).test(uri);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function headerLinesOf(headers: Readonly<Record<string, string>> | undefined) {
|
|
116
|
+
return Object.entries(headers ?? {}).map(([name, value]) => `${name}: ${value}`).join("\r\n");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function bytesOfBody(body: string | Uint8Array) {
|
|
120
|
+
return typeof body === "string" ? new TextEncoder().encode(body) : body;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Where a response body lives: WinRT streams, or a fake in a test. */
|
|
124
|
+
export interface BodyStreams {
|
|
125
|
+
empty(): unknown;
|
|
126
|
+
of(bytes: Uint8Array): Promise<unknown>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const WINRT_STREAMS: BodyStreams = {
|
|
130
|
+
empty: () => new InMemoryRandomAccessStream(),
|
|
131
|
+
of: bytes => streamOf(bytes)
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Answers the requests that match `filters` with what `respond` returns, and
|
|
136
|
+
* lets the others (and a `null`) go to the network; resolves with the function
|
|
137
|
+
* that removes the handler and the filters
|
|
138
|
+
* `respond` must be a plain function: the answer is given before the event's
|
|
139
|
+
* handler returns, except a body, which is written to a stream first and
|
|
140
|
+
* holds the request meanwhile
|
|
141
|
+
* A filter added before the first navigation applies to it; one added later
|
|
142
|
+
* does not apply to requests already in flight
|
|
143
|
+
*/
|
|
144
|
+
export function onWebResourceRequested({ control, filters, respond }: {
|
|
145
|
+
control: WebView2Like;
|
|
146
|
+
filters: readonly RequestFilter[];
|
|
147
|
+
respond(request: WebRequest): WebResponse | null;
|
|
148
|
+
}) {
|
|
149
|
+
return subscribeRequests({
|
|
150
|
+
control,
|
|
151
|
+
filters,
|
|
152
|
+
respond,
|
|
153
|
+
streams: WINRT_STREAMS
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** `onWebResourceRequested` over any body streams; the unit tests'. */
|
|
158
|
+
export async function subscribeRequests({ control, filters, respond, streams }: {
|
|
159
|
+
control: WebView2Like;
|
|
160
|
+
filters: readonly RequestFilter[];
|
|
161
|
+
respond(request: WebRequest): WebResponse | null;
|
|
162
|
+
streams: BodyStreams;
|
|
163
|
+
}) {
|
|
164
|
+
const core = await waitForCoreWebView2(control);
|
|
165
|
+
function answer({ args, response }: {
|
|
166
|
+
args: WebResourceRequestedArguments;
|
|
167
|
+
response: WebResponse;
|
|
168
|
+
}) {
|
|
169
|
+
const statusCode = response.statusCode ?? StatusCode.OK;
|
|
170
|
+
const reasonPhrase = response.reasonPhrase ?? REASON_PHRASES.get(statusCode) ?? "";
|
|
171
|
+
const headers = headerLinesOf(response.headers);
|
|
172
|
+
const hasBody = response.body !== undefined && response.body.length > 0;
|
|
173
|
+
if (!hasBody) {
|
|
174
|
+
args.response = core.environment.createWebResourceResponse(streams.empty(), statusCode, reasonPhrase, headers);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const deferral = args.getDeferral();
|
|
179
|
+
void streams.of(bytesOfBody(response.body ?? "")).then(stream => {
|
|
180
|
+
args.response = core.environment.createWebResourceResponse(stream, statusCode, reasonPhrase, headers);
|
|
181
|
+
}).finally(() => deferral.complete());
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
for (const filter of filters) {
|
|
185
|
+
core.addWebResourceRequestedFilter(filter.uri, contextNumberOf(filter.context ?? ResourceContext.ALL));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const stopListening = core.onWebResourceRequested((_sender, args) => {
|
|
189
|
+
const { uri, method } = args.request;
|
|
190
|
+
const isMine = isWanted({
|
|
191
|
+
filters,
|
|
192
|
+
uri,
|
|
193
|
+
context: args.resourceContext
|
|
194
|
+
});
|
|
195
|
+
if (!isMine) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const response = respond({
|
|
200
|
+
uri,
|
|
201
|
+
method
|
|
202
|
+
});
|
|
203
|
+
const isAnswered = response !== null;
|
|
204
|
+
if (isAnswered) {
|
|
205
|
+
answer({
|
|
206
|
+
args,
|
|
207
|
+
response
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return () => {
|
|
212
|
+
stopListening();
|
|
213
|
+
for (const filter of filters) {
|
|
214
|
+
core.removeWebResourceRequestedFilter(filter.uri, contextNumberOf(filter.context ?? ResourceContext.ALL));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Answers every request to `uri` (`*` and `?` are wildcards) with `statusCode`
|
|
221
|
+
* and an empty body, until the returned function is called; the page sees a
|
|
222
|
+
* response, not a network error
|
|
223
|
+
*/
|
|
224
|
+
export function blockRequests({ control, uri, context = ResourceContext.ALL, statusCode = StatusCode.NO_CONTENT }: {
|
|
225
|
+
control: WebView2Like;
|
|
226
|
+
uri: string;
|
|
227
|
+
context?: ResourceContext;
|
|
228
|
+
statusCode?: number;
|
|
229
|
+
}) {
|
|
230
|
+
return onWebResourceRequested({
|
|
231
|
+
control,
|
|
232
|
+
filters: [{
|
|
233
|
+
uri,
|
|
234
|
+
context
|
|
235
|
+
}],
|
|
236
|
+
respond: () => ({ statusCode })
|
|
237
|
+
});
|
|
238
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { waitForCoreWebView2 } from "./core.ts";
|
|
1
|
+
import { messageOf, waitForCoreWebView2 } from "./core.ts";
|
|
2
2
|
import type { CoreWebView2Like, WebView2Like } from "./core.ts";
|
|
3
3
|
import type { Frame } from "#src/messaging/frame.js";
|
|
4
4
|
import { jsonSchema } from "#src/messaging/json.js";
|
|
@@ -21,10 +21,6 @@ function originOf(source: string) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function messageOf(error: unknown) {
|
|
25
|
-
return error instanceof Error ? error.message : String(error);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
/**
|
|
29
25
|
* A messaging transport to the page in a WebView2 control, over
|
|
30
26
|
* `PostWebMessageAsJson` and `WebMessageReceived`: pass it to
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { call, isRecord, read } from "#src/renderer/host/reflect.js";
|
|
2
|
+
|
|
3
|
+
// dynwinrt keeps the native object of a projection in a member of this name.
|
|
4
|
+
const NATIVE_OBJECT_KEY = "_obj";
|
|
5
|
+
|
|
6
|
+
function nativeIdentityOf(value: object) {
|
|
7
|
+
const nativeObject = read(value, NATIVE_OBJECT_KEY);
|
|
8
|
+
const identity = isRecord(nativeObject) ? call(nativeObject, "identityRaw") : null;
|
|
9
|
+
return typeof identity === "number" ? identity : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* What tells one WinUI control from another: every read of `parent` or a hit
|
|
14
|
+
* test projects the native object into a new wrapper, so a control is known
|
|
15
|
+
* by the identity of its native object.
|
|
16
|
+
*
|
|
17
|
+
* @param control - A projected WinUI object.
|
|
18
|
+
* @returns A key the same for every wrapper of one native object (the wrapper for a non-projection).
|
|
19
|
+
*/
|
|
20
|
+
export function identityOf(control: object) {
|
|
21
|
+
return nativeIdentityOf(control) ?? control;
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TaskbarProgressProps } from "./taskbar-progress-props.ts";
|
|
2
|
+
import type { Component } from "svelte";
|
|
3
|
+
|
|
4
|
+
declare const TaskbarProgress: Component<TaskbarProgressProps, Record<string, never>, "">;
|
|
5
|
+
// eslint-disable-next-line no-restricted-exports -- Svelte declares a component as the default export
|
|
6
|
+
export default TaskbarProgress;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { fractionOf, isUnfinished, ProgressState } from "./progress-state.ts";
|
|
2
|
+
import type { ProgressSnapshot } from "./progress-state.ts";
|
|
3
|
+
|
|
4
|
+
function sum(values: readonly number[]) {
|
|
5
|
+
let total = 0;
|
|
6
|
+
for (const value of values) {
|
|
7
|
+
total += value;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return total;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function stateOf({ unfinished, failedCount }: {
|
|
14
|
+
unfinished: readonly ProgressSnapshot[];
|
|
15
|
+
failedCount: number;
|
|
16
|
+
}) {
|
|
17
|
+
const isNothingLeft = unfinished.length === 0;
|
|
18
|
+
if (isNothingLeft) {
|
|
19
|
+
return failedCount > 0 ? ProgressState.ERROR : ProgressState.IDLE;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const isRunning = unfinished.some(({ state }) => state === ProgressState.RUNNING);
|
|
23
|
+
if (isRunning) {
|
|
24
|
+
return ProgressState.RUNNING;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isPaused = unfinished.every(({ state }) => state === ProgressState.PAUSED);
|
|
28
|
+
return isPaused ? ProgressState.PAUSED : ProgressState.IDLE;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* One snapshot for many: the overall bar of the taskbar and the count of a
|
|
33
|
+
* tray item. The bar covers the operations that know their total (their
|
|
34
|
+
* loaded bytes over their total bytes); it is indeterminate only when none
|
|
35
|
+
* does. It is `running` while any runs, `paused` when all unfinished ones are,
|
|
36
|
+
* and `error` when only failed ones are left.
|
|
37
|
+
*
|
|
38
|
+
* @param snapshots - The snapshots of the operations the registry holds.
|
|
39
|
+
* @returns The aggregate.
|
|
40
|
+
*/
|
|
41
|
+
export function aggregateSnapshots(snapshots: readonly ProgressSnapshot[]) {
|
|
42
|
+
const unfinished = snapshots.filter(({ state }) => isUnfinished(state));
|
|
43
|
+
const failedCount = snapshots.filter(({ state }) => state === ProgressState.ERROR).length;
|
|
44
|
+
const known = unfinished.filter(({ total }) => total !== undefined && total > 0);
|
|
45
|
+
const loaded = sum(known.map(snapshot => snapshot.loaded));
|
|
46
|
+
const total = sum(known.map(snapshot => snapshot.total ?? 0));
|
|
47
|
+
const state = stateOf({
|
|
48
|
+
unfinished,
|
|
49
|
+
failedCount
|
|
50
|
+
});
|
|
51
|
+
const isMoving = state === ProgressState.RUNNING || state === ProgressState.PAUSED;
|
|
52
|
+
const [only] = unfinished;
|
|
53
|
+
const isSingle = unfinished.length === 1;
|
|
54
|
+
return {
|
|
55
|
+
state,
|
|
56
|
+
count: unfinished.length,
|
|
57
|
+
loaded,
|
|
58
|
+
total: known.length > 0 ? total : undefined,
|
|
59
|
+
value: fractionOf({
|
|
60
|
+
loaded,
|
|
61
|
+
total
|
|
62
|
+
}),
|
|
63
|
+
isIndeterminate: isMoving && known.length === 0,
|
|
64
|
+
showPaused: state === ProgressState.PAUSED,
|
|
65
|
+
showError: failedCount > 0,
|
|
66
|
+
label: isSingle ? only?.label : undefined
|
|
67
|
+
} satisfies ProgressSnapshot;
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { aggregateSnapshots } from "./aggregate.ts";
|
|
2
|
+
export { OperationProgressEvent } from "./progress-event.ts";
|
|
3
|
+
export type { OperationProgressEventInit } from "./progress-event.ts";
|
|
4
|
+
export { ProgressOperation } from "./progress-operation.ts";
|
|
5
|
+
export type { ProgressBarValues, ProgressHandlers, ProgressOperationOptions } from "./progress-operation.ts";
|
|
6
|
+
export { defaultProgressRegistry, ProgressRegistry } from "./progress-registry.ts";
|
|
7
|
+
export type { ProgressFilter } from "./progress-registry.ts";
|
|
8
|
+
export type { ProgressSource, TrackedOperation } from "./progress-source.ts";
|
|
9
|
+
export { ProgressState } from "./progress-state.ts";
|
|
10
|
+
export type { ProgressSnapshot } from "./progress-state.ts";
|
|
11
|
+
export { progressText } from "./progress-text.ts";
|
|
12
|
+
export { trackOperation, trackStream } from "./track-operation.ts";
|
|
13
|
+
export type { ProgressReporter, TrackOperationOptions } from "./track-operation.ts";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** What `OperationProgressEvent` takes. */
|
|
2
|
+
export interface OperationProgressEventInit {
|
|
3
|
+
readonly loaded: number;
|
|
4
|
+
readonly total: number | undefined;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The web's `ProgressEvent` (which Node has no global for): `lengthComputable`,
|
|
9
|
+
* `loaded` and `total`, fired as `loadstart`, `progress`, `load`, `error`,
|
|
10
|
+
* `abort` and `loadend`, as `XMLHttpRequest` and `FileReader` fire them.
|
|
11
|
+
*/
|
|
12
|
+
export class OperationProgressEvent extends Event {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- the web ProgressEvent name
|
|
14
|
+
readonly lengthComputable: boolean;
|
|
15
|
+
readonly loaded: number;
|
|
16
|
+
readonly total: number;
|
|
17
|
+
|
|
18
|
+
/** Made by `ProgressOperation`. */
|
|
19
|
+
constructor(type: string, init: OperationProgressEventInit) {
|
|
20
|
+
super(type);
|
|
21
|
+
this.lengthComputable = init.total !== undefined && init.total > 0;
|
|
22
|
+
this.loaded = init.loaded;
|
|
23
|
+
this.total = init.total ?? 0;
|
|
24
|
+
}
|
|
25
|
+
}
|