winui-svelte 0.0.7 → 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 +565 -19
- package/README.md +21 -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/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/automation/native.d.ts.map +1 -1
- package/dist/automation/native.js +1 -2
- package/dist/automation/native.js.map +1 -1
- 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.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/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/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/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/enums.d.ts +3 -0
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +3 -0
- package/dist/enums.js.map +1 -1
- 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/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/menu-node.d.ts +4 -4
- package/dist/tray/native.d.ts +9 -4
- package/dist/tray/native.d.ts.map +1 -1
- package/dist/tray/native.js +10 -18
- 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/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 +3 -2
- package/dist/tray/standalone/index.d.ts.map +1 -1
- package/dist/tray/standalone/index.js +1 -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/native.d.ts +19 -6
- package/dist/tray/standalone/native.d.ts.map +1 -1
- package/dist/tray/standalone/native.js +58 -15
- package/dist/tray/standalone/native.js.map +1 -1
- package/dist/tray/standalone/standalone-tray.d.ts +4 -2
- package/dist/tray/standalone/standalone-tray.d.ts.map +1 -1
- package/dist/tray/standalone/standalone-tray.js +12 -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 +5 -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/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/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 +20 -0
- package/dist/win32-foreground.d.ts.map +1 -1
- package/dist/win32-foreground.js +24 -4
- package/dist/win32-foreground.js.map +1 -1
- 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 +1 -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-native.d.ts.map +1 -1
- package/dist/window/foreground-native.js +3 -5
- package/dist/window/foreground-native.js.map +1 -1
- 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 +10 -1
- 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 +26 -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/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/automation/native.ts +1 -2
- 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/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/enums.ts +3 -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/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/native.ts +20 -21
- package/src/tray/personalize.ts +57 -0
- package/src/tray/pointer-share.ts +3 -3
- package/src/tray/standalone/icon-raster.ts +208 -0
- package/src/tray/standalone/index.ts +4 -1
- package/src/tray/standalone/menu-icons.ts +317 -0
- package/src/tray/standalone/native.ts +78 -15
- package/src/tray/standalone/standalone-tray.ts +26 -5
- package/src/tray/themed-icon.ts +4 -36
- package/src/tray/tray-core.ts +6 -1
- package/src/tray/tray-extras.ts +31 -2
- package/src/web-apis/eye-dropper.ts +9 -5
- 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 +28 -4
- 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 +2 -0
- package/src/window/dpi-awareness.ts +162 -0
- package/src/window/foreground-native.ts +3 -5
- 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 +58 -5
- package/web-types.json +11 -3
|
@@ -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
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
vectorOf,
|
|
7
7
|
write
|
|
8
8
|
} from "./reflect.ts";
|
|
9
|
+
import { duringStructureSync } from "./structure-sync.ts";
|
|
9
10
|
import {
|
|
10
11
|
autoLength,
|
|
11
12
|
boxed,
|
|
@@ -34,7 +35,7 @@ import type { ElementNode, FragmentNode, NativeHost, TreeNode } from "#src/rende
|
|
|
34
35
|
import { createTreeRenderer, NodeType, parentElement } from "#src/renderer/tree/tree.js";
|
|
35
36
|
import { isBackgroundRun } from "#src/window/background-mode.js";
|
|
36
37
|
import type { FrameworkElement, UIElement } from "#src/winui.js";
|
|
37
|
-
import { Run } from "#src/winui.js";
|
|
38
|
+
import { Run, TextWrapping } from "#src/winui.js";
|
|
38
39
|
|
|
39
40
|
// The renderer for WinUI: a .svelte component's elements are
|
|
40
41
|
// WinUI's own controls, named in kebab case (<stack-panel>, <text-block>), so
|
|
@@ -544,23 +545,25 @@ function syncCollection({ element, collection, wanted = element.children.flatMap
|
|
|
544
545
|
wanted?: object[];
|
|
545
546
|
}) {
|
|
546
547
|
const byKey = new Map(wanted.map(child => [keyOf(child), child]));
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
548
|
+
duringStructureSync(() => {
|
|
549
|
+
syncKeyed({
|
|
550
|
+
list: {
|
|
551
|
+
items: placedItems({
|
|
552
|
+
element,
|
|
553
|
+
collection
|
|
554
|
+
}),
|
|
555
|
+
keyOf,
|
|
556
|
+
create(key) {
|
|
557
|
+
const child = byKey.get(key);
|
|
558
|
+
if (!child) {
|
|
559
|
+
throw new RangeError(`no control has key ${key}`);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return child;
|
|
558
563
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
},
|
|
563
|
-
wantedKeys: [...byKey.keys()]
|
|
564
|
+
},
|
|
565
|
+
wantedKeys: [...byKey.keys()]
|
|
566
|
+
});
|
|
564
567
|
});
|
|
565
568
|
}
|
|
566
569
|
|
|
@@ -1027,6 +1030,21 @@ function keepPopupInWindow(control: object) {
|
|
|
1027
1030
|
}
|
|
1028
1031
|
}
|
|
1029
1032
|
|
|
1033
|
+
// The web wraps text at the edge of its box; a TextBlock's WinUI default (NoWrap)
|
|
1034
|
+
// runs it past the window. A `textWrapping` prop, `white-space` or `text-wrap`
|
|
1035
|
+
// written later still wins.
|
|
1036
|
+
const WRAPPED_TEXT_TAGS = new Set(["text-block", "rich-text-block"]);
|
|
1037
|
+
|
|
1038
|
+
function wrapTextLikeTheWeb({ control, name }: {
|
|
1039
|
+
control: object;
|
|
1040
|
+
name: string;
|
|
1041
|
+
}) {
|
|
1042
|
+
const isText = WRAPPED_TEXT_TAGS.has(kebabCase(name));
|
|
1043
|
+
if (isText) {
|
|
1044
|
+
write(control, "textWrapping", TextWrapping.Wrap);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1030
1048
|
function createControl(name: string) {
|
|
1031
1049
|
const type = controls.get(kebabCase(name));
|
|
1032
1050
|
if (!isControlClass(type)) {
|
|
@@ -1035,6 +1053,10 @@ function createControl(name: string) {
|
|
|
1035
1053
|
|
|
1036
1054
|
const control = new type();
|
|
1037
1055
|
keepPopupInWindow(control);
|
|
1056
|
+
wrapTextLikeTheWeb({
|
|
1057
|
+
control,
|
|
1058
|
+
name
|
|
1059
|
+
});
|
|
1038
1060
|
return control;
|
|
1039
1061
|
}
|
|
1040
1062
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// While the renderer changes a control's items or children, the control raises
|
|
2
|
+
// the events a user's change would (a ComboBox loses its selection when the
|
|
3
|
+
// item it shows is taken out and put back): those are the renderer's own, and
|
|
4
|
+
// no component may take them for the user's.
|
|
5
|
+
|
|
6
|
+
let depth = 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Runs `action`, a change of a control's items or children by the renderer.
|
|
10
|
+
*
|
|
11
|
+
* @param action - What changes the control's structure.
|
|
12
|
+
*/
|
|
13
|
+
export function duringStructureSync(action: () => void) {
|
|
14
|
+
depth++;
|
|
15
|
+
try {
|
|
16
|
+
action();
|
|
17
|
+
} finally {
|
|
18
|
+
depth--;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Whether the renderer is changing a control's items or children now. */
|
|
23
|
+
export function isStructureSyncing() {
|
|
24
|
+
return depth > 0;
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when Windows refuses to seal or unseal; `code` is the Win32 error
|
|
3
|
+
* (for example 87, `ERROR_INVALID_PARAMETER`, for bytes that are no blob, or
|
|
4
|
+
* 13, `ERROR_INVALID_DATA`, for a blob another user sealed); the message never
|
|
5
|
+
* holds the data.
|
|
6
|
+
*/
|
|
7
|
+
export class DataProtectionError extends Error {
|
|
8
|
+
readonly code: number;
|
|
9
|
+
|
|
10
|
+
constructor({ operation, code }: {
|
|
11
|
+
readonly operation: string;
|
|
12
|
+
readonly code: number;
|
|
13
|
+
}) {
|
|
14
|
+
super(`${operation} failed with Windows error ${code}`);
|
|
15
|
+
this.name = "DataProtectionError";
|
|
16
|
+
this.code = code;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createDataProtection, REAL_NATIVE } from "./native.ts";
|
|
2
|
+
import type { ProtectionScope } from "./protection-scope.ts";
|
|
3
|
+
|
|
4
|
+
export { DataProtectionError } from "./data-protection-error.ts";
|
|
5
|
+
export { MAX_DATA_BYTES, wipe } from "./native.ts";
|
|
6
|
+
export { ProtectionScope } from "./protection-scope.ts";
|
|
7
|
+
|
|
8
|
+
/** What `protectData` takes. */
|
|
9
|
+
export interface ProtectOptions {
|
|
10
|
+
/** The bytes to seal; the library keeps no copy, and wiping yours is up to you (`wipe`). */
|
|
11
|
+
readonly data: Uint8Array;
|
|
12
|
+
/** Mixed into the key; the same bytes are needed to unseal. */
|
|
13
|
+
readonly entropy?: Uint8Array;
|
|
14
|
+
/** `ProtectionScope.CURRENT_USER` by default, as .NET's `DataProtectionScope`. */
|
|
15
|
+
readonly scope?: ProtectionScope;
|
|
16
|
+
/** A label stored in the blob and shown by tools. */
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** What `unprotectData` takes. */
|
|
21
|
+
export interface UnprotectOptions {
|
|
22
|
+
/** The blob DPAPI or .NET's `ProtectedData.Protect` made. */
|
|
23
|
+
readonly data: Uint8Array;
|
|
24
|
+
/** The entropy the blob was sealed with. */
|
|
25
|
+
readonly entropy?: Uint8Array;
|
|
26
|
+
/** The scope the blob was sealed with; Windows reads it from the blob, so this is only a hint. */
|
|
27
|
+
readonly scope?: ProtectionScope;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Seals bytes with DPAPI for the current Windows user (or the machine); the
|
|
32
|
+
* result is the blob .NET's `ProtectedData.Protect` makes, so each can read the
|
|
33
|
+
* other's. Windows keeps no copy and offers no recovery: a password reset by an
|
|
34
|
+
* administrator can make a blob unreadable. Native buffers that held the data
|
|
35
|
+
* are zeroed; a JavaScript string cannot be, so keep secrets as bytes.
|
|
36
|
+
*
|
|
37
|
+
* @param options - The data and, optionally, entropy, scope and a description.
|
|
38
|
+
* @returns The sealed blob.
|
|
39
|
+
* @throws DataProtectionError - When Windows refuses (carries the Win32 code).
|
|
40
|
+
* @throws RangeError - When the data or the entropy is over `MAX_DATA_BYTES`.
|
|
41
|
+
*/
|
|
42
|
+
export function protectData(options: ProtectOptions) {
|
|
43
|
+
return createDataProtection(REAL_NATIVE).protect(options);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Unseals a DPAPI blob made by DPAPI or .NET's `ProtectedData.Protect`. The
|
|
48
|
+
* returned bytes are the caller's to `wipe`.
|
|
49
|
+
*
|
|
50
|
+
* @param options - The blob and, when it was sealed with one, its entropy.
|
|
51
|
+
* @returns The plain bytes.
|
|
52
|
+
* @throws DataProtectionError - When the blob is corrupt, the entropy is wrong or another user sealed it.
|
|
53
|
+
* @throws RangeError - When the data or the entropy is over `MAX_DATA_BYTES`.
|
|
54
|
+
*/
|
|
55
|
+
export function unprotectData(options: UnprotectOptions) {
|
|
56
|
+
return createDataProtection(REAL_NATIVE).unprotect(options);
|
|
57
|
+
}
|