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.
Files changed (513) hide show
  1. package/API.md +565 -19
  2. package/README.md +21 -5
  3. package/dist/app/activate.d.ts.map +1 -1
  4. package/dist/app/activate.js +3 -0
  5. package/dist/app/activate.js.map +1 -1
  6. package/dist/app/activation/index.d.ts +3 -0
  7. package/dist/app/activation/index.d.ts.map +1 -1
  8. package/dist/app/activation/index.js +2 -0
  9. package/dist/app/activation/index.js.map +1 -1
  10. package/dist/app/activation/login.d.ts +2 -1
  11. package/dist/app/activation/login.d.ts.map +1 -1
  12. package/dist/app/activation/login.js +2 -1
  13. package/dist/app/activation/login.js.map +1 -1
  14. package/dist/app/activation/native.js +1 -2
  15. package/dist/app/activation/native.js.map +1 -1
  16. package/dist/app/activation/packaged.d.ts +49 -0
  17. package/dist/app/activation/packaged.d.ts.map +1 -0
  18. package/dist/app/activation/packaged.js +90 -0
  19. package/dist/app/activation/packaged.js.map +1 -0
  20. package/dist/app/activation/receive.d.ts +11 -2
  21. package/dist/app/activation/receive.d.ts.map +1 -1
  22. package/dist/app/activation/receive.js +11 -4
  23. package/dist/app/activation/receive.js.map +1 -1
  24. package/dist/app/activation/registration.d.ts +3 -3
  25. package/dist/app/activation/registration.js +7 -7
  26. package/dist/app/activation/registration.js.map +1 -1
  27. package/dist/app/activation/scheme.d.ts +10 -0
  28. package/dist/app/activation/scheme.d.ts.map +1 -1
  29. package/dist/app/activation/scheme.js +17 -0
  30. package/dist/app/activation/scheme.js.map +1 -1
  31. package/dist/app/index.d.ts +4 -2
  32. package/dist/app/index.d.ts.map +1 -1
  33. package/dist/app/index.js +3 -1
  34. package/dist/app/index.js.map +1 -1
  35. package/dist/app/instance-running.d.ts +15 -0
  36. package/dist/app/instance-running.d.ts.map +1 -0
  37. package/dist/app/instance-running.js +20 -0
  38. package/dist/app/instance-running.js.map +1 -0
  39. package/dist/app/jump-list/native.d.ts.map +1 -1
  40. package/dist/app/jump-list/native.js +1 -2
  41. package/dist/app/jump-list/native.js.map +1 -1
  42. package/dist/app/native-messaging/browsers.d.ts +19 -0
  43. package/dist/app/native-messaging/browsers.d.ts.map +1 -0
  44. package/dist/app/native-messaging/browsers.js +17 -0
  45. package/dist/app/native-messaging/browsers.js.map +1 -0
  46. package/dist/app/native-messaging/index.d.ts +41 -0
  47. package/dist/app/native-messaging/index.d.ts.map +1 -0
  48. package/dist/app/native-messaging/index.js +84 -0
  49. package/dist/app/native-messaging/index.js.map +1 -0
  50. package/dist/app/native.d.ts +0 -6
  51. package/dist/app/native.d.ts.map +1 -1
  52. package/dist/app/native.js +1 -24
  53. package/dist/app/native.js.map +1 -1
  54. package/dist/app/notification-source.d.ts.map +1 -1
  55. package/dist/app/notification-source.js +1 -2
  56. package/dist/app/notification-source.js.map +1 -1
  57. package/dist/app/shell/native.js +1 -2
  58. package/dist/app/shell/native.js.map +1 -1
  59. package/dist/app/single-instance.d.ts +27 -1
  60. package/dist/app/single-instance.d.ts.map +1 -1
  61. package/dist/app/single-instance.js +32 -10
  62. package/dist/app/single-instance.js.map +1 -1
  63. package/dist/automation/native.d.ts.map +1 -1
  64. package/dist/automation/native.js +1 -2
  65. package/dist/automation/native.js.map +1 -1
  66. package/dist/bindings/.dynwinrt-js-types +198 -0
  67. package/dist/bindings/.dynwinrt-managed +1 -1
  68. package/dist/bindings/index.d.ts +15 -0
  69. package/dist/bindings/index.js +20 -0
  70. package/dist/bindings/index.mjs +2902 -2882
  71. package/dist/bindings/index.proxy.js +10 -0
  72. package/dist/bindings/windows/application-model/activation/ActivationKind.d.ts +49 -0
  73. package/dist/bindings/windows/application-model/activation/ActivationKind.js +50 -0
  74. package/dist/bindings/windows/application-model/activation/ApplicationExecutionState.d.ts +9 -0
  75. package/dist/bindings/windows/application-model/activation/ApplicationExecutionState.js +10 -0
  76. package/dist/bindings/windows/application-model/activation/IActivatedEventArgs.d.ts +36 -0
  77. package/dist/bindings/windows/application-model/activation/IActivatedEventArgs.js +149 -0
  78. package/dist/bindings/windows/application-model/activation/IActivatedEventArgsWithUser.d.ts +28 -0
  79. package/dist/bindings/windows/application-model/activation/IActivatedEventArgsWithUser.js +119 -0
  80. package/dist/bindings/windows/application-model/activation/IApplicationViewActivatedEventArgs.d.ts +27 -0
  81. package/dist/bindings/windows/application-model/activation/IApplicationViewActivatedEventArgs.js +116 -0
  82. package/dist/bindings/windows/application-model/activation/IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData.d.ts +31 -0
  83. package/dist/bindings/windows/application-model/activation/IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData.js +131 -0
  84. package/dist/bindings/windows/application-model/activation/IViewSwitcherProvider.d.ts +28 -0
  85. package/dist/bindings/windows/application-model/activation/IViewSwitcherProvider.js +119 -0
  86. package/dist/bindings/windows/application-model/activation/ProtocolActivatedEventArgs.d.ts +25 -0
  87. package/dist/bindings/windows/application-model/activation/ProtocolActivatedEventArgs.js +166 -0
  88. package/dist/bindings/windows/application-model/activation/SplashScreen.d.ts +35 -0
  89. package/dist/bindings/windows/application-model/activation/SplashScreen.js +105 -0
  90. package/dist/bindings/windows/foundation/TypedEventHandler_WindowsApplicationModelActivationSplashScreen_Object_g7a7dbfa699cd28ff.d.ts +7 -0
  91. package/dist/bindings/windows/foundation/TypedEventHandler_WindowsApplicationModelActivationSplashScreen_Object_g7a7dbfa699cd28ff.js +7 -0
  92. package/dist/bindings/windows/ui/view-management/ActivationViewSwitcher.d.ts +12 -0
  93. package/dist/bindings/windows/ui/view-management/ActivationViewSwitcher.js +96 -0
  94. package/dist/chrome/context-menus/context-menu-schema.d.ts.map +1 -1
  95. package/dist/chrome/context-menus/context-menu-schema.js +1 -7
  96. package/dist/chrome/context-menus/context-menu-schema.js.map +1 -1
  97. package/dist/chrome/parse-or-throw.d.ts +7 -0
  98. package/dist/chrome/parse-or-throw.d.ts.map +1 -0
  99. package/dist/chrome/parse-or-throw.js +9 -0
  100. package/dist/chrome/parse-or-throw.js.map +1 -0
  101. package/dist/chrome/permissions/permission-schema.d.ts.map +1 -1
  102. package/dist/chrome/permissions/permission-schema.js +1 -7
  103. package/dist/chrome/permissions/permission-schema.js.map +1 -1
  104. package/dist/chrome/windows/chrome-windows.d.ts.map +1 -1
  105. package/dist/chrome/windows/chrome-windows.js +1 -7
  106. package/dist/chrome/windows/chrome-windows.js.map +1 -1
  107. package/dist/components/hand-written/items/keyed-rows.svelte.d.ts.map +1 -1
  108. package/dist/components/hand-written/items/keyed-rows.svelte.js +6 -0
  109. package/dist/components/hand-written/items/keyed-rows.svelte.js.map +1 -1
  110. package/dist/components/index.d.ts +1 -0
  111. package/dist/components/index.d.ts.map +1 -1
  112. package/dist/components/runtime.svelte.d.ts.map +1 -1
  113. package/dist/components/runtime.svelte.js +7 -0
  114. package/dist/components/runtime.svelte.js.map +1 -1
  115. package/dist/composition/expression.d.ts +1 -1
  116. package/dist/css/runtime/containers.d.ts.map +1 -1
  117. package/dist/css/runtime/containers.js +1 -17
  118. package/dist/css/runtime/containers.js.map +1 -1
  119. package/dist/css/runtime/native.d.ts.map +1 -1
  120. package/dist/css/runtime/native.js +40 -20
  121. package/dist/css/runtime/native.js.map +1 -1
  122. package/dist/css/translate/property-kit.d.ts +9 -0
  123. package/dist/css/translate/property-kit.d.ts.map +1 -1
  124. package/dist/css/translate/property-kit.js.map +1 -1
  125. package/dist/css/translate/transition-properties.d.ts +1 -1
  126. package/dist/css/translate/transition-properties.d.ts.map +1 -1
  127. package/dist/css/translate/transition-properties.js +32 -5
  128. package/dist/css/translate/transition-properties.js.map +1 -1
  129. package/dist/data-transfer/data-transfer.d.ts +3 -3
  130. package/dist/data-transfer/data-transfer.d.ts.map +1 -1
  131. package/dist/data-transfer/data-transfer.js.map +1 -1
  132. package/dist/data-transfer/drag-effects.d.ts +25 -2
  133. package/dist/data-transfer/drag-effects.d.ts.map +1 -1
  134. package/dist/data-transfer/drag-effects.js +27 -2
  135. package/dist/data-transfer/drag-effects.js.map +1 -1
  136. package/dist/data-transfer/drag-helper.d.ts +50 -0
  137. package/dist/data-transfer/drag-helper.d.ts.map +1 -0
  138. package/dist/data-transfer/drag-helper.js +156 -0
  139. package/dist/data-transfer/drag-helper.js.map +1 -0
  140. package/dist/data-transfer/drop-target.d.ts +6 -5
  141. package/dist/data-transfer/drop-target.d.ts.map +1 -1
  142. package/dist/data-transfer/drop-target.js +68 -20
  143. package/dist/data-transfer/drop-target.js.map +1 -1
  144. package/dist/data-transfer/index.d.ts +1 -0
  145. package/dist/data-transfer/index.d.ts.map +1 -1
  146. package/dist/data-transfer/index.js.map +1 -1
  147. package/dist/data-transfer/launcher.d.ts +4 -3
  148. package/dist/data-transfer/launcher.d.ts.map +1 -1
  149. package/dist/data-transfer/launcher.js +58 -9
  150. package/dist/data-transfer/launcher.js.map +1 -1
  151. package/dist/data-transfer/native.d.ts +66 -0
  152. package/dist/data-transfer/native.d.ts.map +1 -0
  153. package/dist/data-transfer/native.js +148 -0
  154. package/dist/data-transfer/native.js.map +1 -0
  155. package/dist/data-transfer/ole-data-object.d.ts +62 -0
  156. package/dist/data-transfer/ole-data-object.d.ts.map +1 -0
  157. package/dist/data-transfer/ole-data-object.js +162 -0
  158. package/dist/data-transfer/ole-data-object.js.map +1 -0
  159. package/dist/data-transfer/ole-drop-target.d.ts +54 -0
  160. package/dist/data-transfer/ole-drop-target.d.ts.map +1 -0
  161. package/dist/data-transfer/ole-drop-target.js +192 -0
  162. package/dist/data-transfer/ole-drop-target.js.map +1 -0
  163. package/dist/data-transfer/share-interop.d.ts.map +1 -1
  164. package/dist/data-transfer/share-interop.js +1 -1
  165. package/dist/data-transfer/share-interop.js.map +1 -1
  166. package/dist/data-transfer/shell-items.d.ts +10 -0
  167. package/dist/data-transfer/shell-items.d.ts.map +1 -0
  168. package/dist/data-transfer/shell-items.js +67 -0
  169. package/dist/data-transfer/shell-items.js.map +1 -0
  170. package/dist/data-transfer/window-drop.d.ts +35 -0
  171. package/dist/data-transfer/window-drop.d.ts.map +1 -0
  172. package/dist/data-transfer/window-drop.js +311 -0
  173. package/dist/data-transfer/window-drop.js.map +1 -0
  174. package/dist/devices/native.js +1 -2
  175. package/dist/devices/native.js.map +1 -1
  176. package/dist/enums.d.ts +3 -0
  177. package/dist/enums.d.ts.map +1 -1
  178. package/dist/enums.js +3 -0
  179. package/dist/enums.js.map +1 -1
  180. package/dist/input/index.d.ts +2 -0
  181. package/dist/input/index.d.ts.map +1 -1
  182. package/dist/input/index.js +1 -0
  183. package/dist/input/index.js.map +1 -1
  184. package/dist/input/modifier-keys.d.ts +24 -0
  185. package/dist/input/modifier-keys.d.ts.map +1 -0
  186. package/dist/input/modifier-keys.js +20 -0
  187. package/dist/input/modifier-keys.js.map +1 -0
  188. package/dist/media/pixel-buffer.d.ts.map +1 -1
  189. package/dist/media/pixel-buffer.js +1 -1
  190. package/dist/media/pixel-buffer.js.map +1 -1
  191. package/dist/messaging/web-view2/core.d.ts +56 -0
  192. package/dist/messaging/web-view2/core.d.ts.map +1 -1
  193. package/dist/messaging/web-view2/core.js +6 -0
  194. package/dist/messaging/web-view2/core.js.map +1 -1
  195. package/dist/messaging/web-view2/environment.d.ts +41 -0
  196. package/dist/messaging/web-view2/environment.d.ts.map +1 -0
  197. package/dist/messaging/web-view2/environment.js +91 -0
  198. package/dist/messaging/web-view2/environment.js.map +1 -0
  199. package/dist/messaging/web-view2/index.d.ts +9 -1
  200. package/dist/messaging/web-view2/index.d.ts.map +1 -1
  201. package/dist/messaging/web-view2/index.js +5 -0
  202. package/dist/messaging/web-view2/index.js.map +1 -1
  203. package/dist/messaging/web-view2/input.d.ts +68 -0
  204. package/dist/messaging/web-view2/input.d.ts.map +1 -0
  205. package/dist/messaging/web-view2/input.js +108 -0
  206. package/dist/messaging/web-view2/input.js.map +1 -0
  207. package/dist/messaging/web-view2/protocol.d.ts +24 -0
  208. package/dist/messaging/web-view2/protocol.d.ts.map +1 -0
  209. package/dist/messaging/web-view2/protocol.js +31 -0
  210. package/dist/messaging/web-view2/protocol.js.map +1 -0
  211. package/dist/messaging/web-view2/recovery.d.ts +65 -0
  212. package/dist/messaging/web-view2/recovery.d.ts.map +1 -0
  213. package/dist/messaging/web-view2/recovery.js +138 -0
  214. package/dist/messaging/web-view2/recovery.js.map +1 -0
  215. package/dist/messaging/web-view2/requests.d.ts +88 -0
  216. package/dist/messaging/web-view2/requests.d.ts.map +1 -0
  217. package/dist/messaging/web-view2/requests.js +169 -0
  218. package/dist/messaging/web-view2/requests.js.map +1 -0
  219. package/dist/messaging/web-view2/transport.d.ts.map +1 -1
  220. package/dist/messaging/web-view2/transport.js +1 -4
  221. package/dist/messaging/web-view2/transport.js.map +1 -1
  222. package/dist/native-identity.d.ts +10 -0
  223. package/dist/native-identity.d.ts.map +1 -0
  224. package/dist/native-identity.js +20 -0
  225. package/dist/native-identity.js.map +1 -0
  226. package/dist/renderer/host/host.d.ts.map +1 -1
  227. package/dist/renderer/host/host.js +33 -16
  228. package/dist/renderer/host/host.js.map +1 -1
  229. package/dist/renderer/host/structure-sync.d.ts +9 -0
  230. package/dist/renderer/host/structure-sync.d.ts.map +1 -0
  231. package/dist/renderer/host/structure-sync.js +24 -0
  232. package/dist/renderer/host/structure-sync.js.map +1 -0
  233. package/dist/security/data-protection-error.d.ts +14 -0
  234. package/dist/security/data-protection-error.d.ts.map +1 -0
  235. package/dist/security/data-protection-error.js +15 -0
  236. package/dist/security/data-protection-error.js.map +1 -0
  237. package/dist/security/index.d.ts +48 -0
  238. package/dist/security/index.d.ts.map +1 -0
  239. package/dist/security/index.js +32 -0
  240. package/dist/security/index.js.map +1 -0
  241. package/dist/security/native.d.ts +43 -0
  242. package/dist/security/native.d.ts.map +1 -0
  243. package/dist/security/native.js +170 -0
  244. package/dist/security/native.js.map +1 -0
  245. package/dist/security/protection-scope.d.ts +13 -0
  246. package/dist/security/protection-scope.d.ts.map +1 -0
  247. package/dist/security/protection-scope.js +11 -0
  248. package/dist/security/protection-scope.js.map +1 -0
  249. package/dist/store/states.d.ts +2 -2
  250. package/dist/store/windows-identity.d.ts +2 -6
  251. package/dist/store/windows-identity.d.ts.map +1 -1
  252. package/dist/store/windows-identity.js +2 -29
  253. package/dist/store/windows-identity.js.map +1 -1
  254. package/dist/store/windows-packages.d.ts +2 -2
  255. package/dist/store/windows-store.d.ts +2 -2
  256. package/dist/tray/click-detector.d.ts.map +1 -1
  257. package/dist/tray/click-detector.js.map +1 -1
  258. package/dist/tray/flyout-model.d.ts +4 -3
  259. package/dist/tray/flyout-model.d.ts.map +1 -1
  260. package/dist/tray/flyout-model.js +12 -2
  261. package/dist/tray/flyout-model.js.map +1 -1
  262. package/dist/tray/menu/icon.d.ts +17 -0
  263. package/dist/tray/menu/icon.d.ts.map +1 -0
  264. package/dist/tray/menu/icon.js +31 -0
  265. package/dist/tray/menu/icon.js.map +1 -0
  266. package/dist/tray/menu/index.d.ts +1 -1
  267. package/dist/tray/menu/index.d.ts.map +1 -1
  268. package/dist/tray/menu/index.js.map +1 -1
  269. package/dist/tray/menu/types.d.ts +23 -6
  270. package/dist/tray/menu/types.d.ts.map +1 -1
  271. package/dist/tray/menu/types.js.map +1 -1
  272. package/dist/tray/menu-svelte/menu-node.d.ts +4 -4
  273. package/dist/tray/native.d.ts +9 -4
  274. package/dist/tray/native.d.ts.map +1 -1
  275. package/dist/tray/native.js +10 -18
  276. package/dist/tray/native.js.map +1 -1
  277. package/dist/tray/personalize.d.ts +18 -0
  278. package/dist/tray/personalize.d.ts.map +1 -0
  279. package/dist/tray/personalize.js +42 -0
  280. package/dist/tray/personalize.js.map +1 -0
  281. package/dist/tray/standalone/icon-raster.d.ts +72 -0
  282. package/dist/tray/standalone/icon-raster.d.ts.map +1 -0
  283. package/dist/tray/standalone/icon-raster.js +161 -0
  284. package/dist/tray/standalone/icon-raster.js.map +1 -0
  285. package/dist/tray/standalone/index.d.ts +3 -2
  286. package/dist/tray/standalone/index.d.ts.map +1 -1
  287. package/dist/tray/standalone/index.js +1 -0
  288. package/dist/tray/standalone/index.js.map +1 -1
  289. package/dist/tray/standalone/menu-icons.d.ts +9 -0
  290. package/dist/tray/standalone/menu-icons.d.ts.map +1 -0
  291. package/dist/tray/standalone/menu-icons.js +280 -0
  292. package/dist/tray/standalone/menu-icons.js.map +1 -0
  293. package/dist/tray/standalone/native.d.ts +19 -6
  294. package/dist/tray/standalone/native.d.ts.map +1 -1
  295. package/dist/tray/standalone/native.js +58 -15
  296. package/dist/tray/standalone/native.js.map +1 -1
  297. package/dist/tray/standalone/standalone-tray.d.ts +4 -2
  298. package/dist/tray/standalone/standalone-tray.d.ts.map +1 -1
  299. package/dist/tray/standalone/standalone-tray.js +12 -2
  300. package/dist/tray/standalone/standalone-tray.js.map +1 -1
  301. package/dist/tray/themed-icon.d.ts.map +1 -1
  302. package/dist/tray/themed-icon.js +4 -28
  303. package/dist/tray/themed-icon.js.map +1 -1
  304. package/dist/tray/tray-core.d.ts.map +1 -1
  305. package/dist/tray/tray-core.js +5 -1
  306. package/dist/tray/tray-core.js.map +1 -1
  307. package/dist/tray/tray-extras.d.ts +26 -2
  308. package/dist/tray/tray-extras.d.ts.map +1 -1
  309. package/dist/web-apis/eye-dropper.d.ts.map +1 -1
  310. package/dist/web-apis/eye-dropper.js +8 -5
  311. package/dist/web-apis/eye-dropper.js.map +1 -1
  312. package/dist/web-apis/media-devices-source.d.ts +1 -1
  313. package/dist/web-apis/native.d.ts +0 -7
  314. package/dist/web-apis/native.d.ts.map +1 -1
  315. package/dist/web-apis/native.js +0 -19
  316. package/dist/web-apis/native.js.map +1 -1
  317. package/dist/win2d/activation-failure.d.ts +10 -0
  318. package/dist/win2d/activation-failure.d.ts.map +1 -0
  319. package/dist/win2d/activation-failure.js +30 -0
  320. package/dist/win2d/activation-failure.js.map +1 -0
  321. package/dist/win2d/element-lifecycle.d.ts.map +1 -1
  322. package/dist/win2d/element-lifecycle.js +6 -1
  323. package/dist/win2d/element-lifecycle.js.map +1 -1
  324. package/dist/win2d/manifest.d.ts +29 -0
  325. package/dist/win2d/manifest.d.ts.map +1 -0
  326. package/dist/win2d/manifest.js +67 -0
  327. package/dist/win2d/manifest.js.map +1 -0
  328. package/dist/win32/index.d.ts +3 -0
  329. package/dist/win32/index.d.ts.map +1 -0
  330. package/dist/win32/index.js +11 -0
  331. package/dist/win32/index.js.map +1 -0
  332. package/dist/win32-calls.d.ts +6 -0
  333. package/dist/win32-calls.d.ts.map +1 -1
  334. package/dist/win32-calls.js +6 -1
  335. package/dist/win32-calls.js.map +1 -1
  336. package/dist/win32-foreground.d.ts +20 -0
  337. package/dist/win32-foreground.d.ts.map +1 -1
  338. package/dist/win32-foreground.js +24 -4
  339. package/dist/win32-foreground.js.map +1 -1
  340. package/dist/win32-icons.d.ts.map +1 -1
  341. package/dist/win32-icons.js +1 -2
  342. package/dist/win32-icons.js.map +1 -1
  343. package/dist/win32-key-state.d.ts +31 -0
  344. package/dist/win32-key-state.d.ts.map +1 -0
  345. package/dist/win32-key-state.js +41 -0
  346. package/dist/win32-key-state.js.map +1 -0
  347. package/dist/window/anchor.d.ts +15 -0
  348. package/dist/window/anchor.d.ts.map +1 -1
  349. package/dist/window/anchor.js +23 -0
  350. package/dist/window/anchor.js.map +1 -1
  351. package/dist/window/apply-frame.d.ts +4 -2
  352. package/dist/window/apply-frame.d.ts.map +1 -1
  353. package/dist/window/apply-frame.js +2 -3
  354. package/dist/window/apply-frame.js.map +1 -1
  355. package/dist/window/bootstrap-core.d.ts +69 -0
  356. package/dist/window/bootstrap-core.d.ts.map +1 -0
  357. package/dist/window/bootstrap-core.js +93 -0
  358. package/dist/window/bootstrap-core.js.map +1 -0
  359. package/dist/window/bootstrap-mode.d.ts +21 -0
  360. package/dist/window/bootstrap-mode.d.ts.map +1 -0
  361. package/dist/window/bootstrap-mode.js +17 -0
  362. package/dist/window/bootstrap-mode.js.map +1 -0
  363. package/dist/window/bootstrap.d.ts +12 -28
  364. package/dist/window/bootstrap.d.ts.map +1 -1
  365. package/dist/window/bootstrap.js +18 -66
  366. package/dist/window/bootstrap.js.map +1 -1
  367. package/dist/window/cover.d.ts +43 -0
  368. package/dist/window/cover.d.ts.map +1 -0
  369. package/dist/window/cover.js +64 -0
  370. package/dist/window/cover.js.map +1 -0
  371. package/dist/window/create-window.d.ts +1 -1
  372. package/dist/window/create-window.d.ts.map +1 -1
  373. package/dist/window/create-window.js +1 -0
  374. package/dist/window/create-window.js.map +1 -1
  375. package/dist/window/dpi-awareness.d.ts +71 -0
  376. package/dist/window/dpi-awareness.d.ts.map +1 -0
  377. package/dist/window/dpi-awareness.js +127 -0
  378. package/dist/window/dpi-awareness.js.map +1 -0
  379. package/dist/window/foreground-native.d.ts.map +1 -1
  380. package/dist/window/foreground-native.js +3 -5
  381. package/dist/window/foreground-native.js.map +1 -1
  382. package/dist/window/index.d.ts +2 -0
  383. package/dist/window/index.d.ts.map +1 -1
  384. package/dist/window/index.js +1 -0
  385. package/dist/window/index.js.map +1 -1
  386. package/dist/window/native.d.ts.map +1 -1
  387. package/dist/window/native.js +1 -2
  388. package/dist/window/native.js.map +1 -1
  389. package/dist/window/package-identity.d.ts +17 -0
  390. package/dist/window/package-identity.d.ts.map +1 -0
  391. package/dist/window/package-identity.js +97 -0
  392. package/dist/window/package-identity.js.map +1 -0
  393. package/dist/window/system-dispatcher-queue.d.ts.map +1 -1
  394. package/dist/window/system-dispatcher-queue.js +1 -2
  395. package/dist/window/system-dispatcher-queue.js.map +1 -1
  396. package/dist/window/taskbar-calls.d.ts +1 -1
  397. package/dist/window/taskbar-native.d.ts.map +1 -1
  398. package/dist/window/taskbar-native.js +1 -2
  399. package/dist/window/taskbar-native.js.map +1 -1
  400. package/dist/window/window-handle.d.ts +25 -1
  401. package/dist/window/window-handle.d.ts.map +1 -1
  402. package/dist/window/window-handle.js +27 -1
  403. package/dist/window/window-handle.js.map +1 -1
  404. package/dist/window/window-host.svelte.d.ts +10 -1
  405. package/dist/window/window-host.svelte.d.ts.map +1 -1
  406. package/dist/window/window-host.svelte.js +38 -4
  407. package/dist/window/window-host.svelte.js.map +1 -1
  408. package/package.json +26 -4
  409. package/src/app/activate.ts +3 -0
  410. package/src/app/activation/index.ts +3 -0
  411. package/src/app/activation/login.ts +2 -1
  412. package/src/app/activation/native.ts +1 -1
  413. package/src/app/activation/packaged.ts +118 -0
  414. package/src/app/activation/receive.ts +24 -4
  415. package/src/app/activation/registration.ts +7 -7
  416. package/src/app/activation/scheme.ts +19 -0
  417. package/src/app/index.ts +4 -2
  418. package/src/app/instance-running.ts +22 -0
  419. package/src/app/jump-list/native.ts +1 -2
  420. package/src/app/native-messaging/browsers.ts +21 -0
  421. package/src/app/native-messaging/index.ts +124 -0
  422. package/src/app/native.ts +1 -32
  423. package/src/app/notification-source.ts +1 -3
  424. package/src/app/shell/native.ts +1 -1
  425. package/src/app/single-instance.ts +34 -10
  426. package/src/automation/native.ts +1 -2
  427. package/src/chrome/context-menus/context-menu-schema.ts +1 -12
  428. package/src/chrome/parse-or-throw.ts +14 -0
  429. package/src/chrome/permissions/permission-schema.ts +1 -12
  430. package/src/chrome/windows/chrome-windows.ts +1 -13
  431. package/src/components/hand-written/items/keyed-rows.svelte.ts +6 -0
  432. package/src/components/index.ts +1 -0
  433. package/src/components/runtime.svelte.ts +8 -0
  434. package/src/css/runtime/containers.ts +1 -20
  435. package/src/css/runtime/native.ts +46 -21
  436. package/src/css/translate/property-kit.ts +9 -0
  437. package/src/css/translate/transition-properties.ts +44 -10
  438. package/src/data-transfer/data-transfer.ts +3 -3
  439. package/src/data-transfer/drag-effects.ts +48 -4
  440. package/src/data-transfer/drag-helper.ts +216 -0
  441. package/src/data-transfer/drop-target.ts +90 -26
  442. package/src/data-transfer/index.ts +1 -0
  443. package/src/data-transfer/launcher.ts +65 -9
  444. package/src/data-transfer/native.ts +184 -0
  445. package/src/data-transfer/ole-data-object.ts +200 -0
  446. package/src/data-transfer/ole-drop-target.ts +263 -0
  447. package/src/data-transfer/share-interop.ts +1 -1
  448. package/src/data-transfer/shell-items.ts +81 -0
  449. package/src/data-transfer/window-drop.ts +411 -0
  450. package/src/devices/native.ts +1 -1
  451. package/src/enums.ts +3 -0
  452. package/src/input/index.ts +2 -0
  453. package/src/input/modifier-keys.ts +30 -0
  454. package/src/media/pixel-buffer.ts +1 -1
  455. package/src/messaging/web-view2/core.ts +64 -0
  456. package/src/messaging/web-view2/environment.ts +131 -0
  457. package/src/messaging/web-view2/index.ts +11 -0
  458. package/src/messaging/web-view2/input.ts +154 -0
  459. package/src/messaging/web-view2/protocol.ts +41 -0
  460. package/src/messaging/web-view2/recovery.ts +177 -0
  461. package/src/messaging/web-view2/requests.ts +238 -0
  462. package/src/messaging/web-view2/transport.ts +1 -5
  463. package/src/native-identity.ts +22 -0
  464. package/src/renderer/host/host.ts +39 -17
  465. package/src/renderer/host/structure-sync.ts +25 -0
  466. package/src/security/data-protection-error.ts +18 -0
  467. package/src/security/index.ts +57 -0
  468. package/src/security/native.ts +234 -0
  469. package/src/security/protection-scope.ts +13 -0
  470. package/src/store/windows-identity.ts +3 -35
  471. package/src/tray/click-detector.ts +6 -7
  472. package/src/tray/flyout-model.ts +14 -3
  473. package/src/tray/menu/icon.ts +40 -0
  474. package/src/tray/menu/index.ts +3 -0
  475. package/src/tray/menu/types.ts +27 -6
  476. package/src/tray/native.ts +20 -21
  477. package/src/tray/personalize.ts +57 -0
  478. package/src/tray/pointer-share.ts +3 -3
  479. package/src/tray/standalone/icon-raster.ts +208 -0
  480. package/src/tray/standalone/index.ts +4 -1
  481. package/src/tray/standalone/menu-icons.ts +317 -0
  482. package/src/tray/standalone/native.ts +78 -15
  483. package/src/tray/standalone/standalone-tray.ts +26 -5
  484. package/src/tray/themed-icon.ts +4 -36
  485. package/src/tray/tray-core.ts +6 -1
  486. package/src/tray/tray-extras.ts +31 -2
  487. package/src/web-apis/eye-dropper.ts +9 -5
  488. package/src/web-apis/native.ts +0 -20
  489. package/src/win2d/activation-failure.ts +35 -0
  490. package/src/win2d/element-lifecycle.ts +6 -1
  491. package/src/win2d/manifest.ts +78 -0
  492. package/src/win32/index.ts +19 -0
  493. package/src/win32-calls.ts +8 -1
  494. package/src/win32-foreground.ts +28 -4
  495. package/src/win32-icons.ts +7 -2
  496. package/src/win32-key-state.ts +48 -0
  497. package/src/window/anchor.ts +28 -0
  498. package/src/window/apply-frame.ts +6 -4
  499. package/src/window/bootstrap-core.ts +165 -0
  500. package/src/window/bootstrap-mode.ts +23 -0
  501. package/src/window/bootstrap.ts +20 -103
  502. package/src/window/cover.ts +100 -0
  503. package/src/window/create-window.ts +2 -0
  504. package/src/window/dpi-awareness.ts +162 -0
  505. package/src/window/foreground-native.ts +3 -5
  506. package/src/window/index.ts +2 -0
  507. package/src/window/native.ts +1 -1
  508. package/src/window/package-identity.ts +112 -0
  509. package/src/window/system-dispatcher-queue.ts +7 -2
  510. package/src/window/taskbar-native.ts +1 -2
  511. package/src/window/window-handle.ts +29 -1
  512. package/src/window/window-host.svelte.ts +58 -5
  513. package/web-types.json +11 -3
@@ -0,0 +1,162 @@
1
+ import { bindDll } from "#src/win32-calls.js";
2
+
3
+ // The process's DPI awareness, apart from the window runtime: it imports no
4
+ // WinRT, so it runs on a host's main thread before anything else. Bound when
5
+ // called, never when the module loads.
6
+
7
+ /** How a process is told the pixels of a display: from not at all to per monitor. */
8
+ export const DpiAwareness = {
9
+ unaware: "unaware",
10
+ system: "system",
11
+ perMonitor: "per-monitor",
12
+ perMonitorV2: "per-monitor-v2"
13
+ } as const;
14
+
15
+ /** One of the `DpiAwareness` values. */
16
+ export type DpiAwareness = (typeof DpiAwareness)[keyof typeof DpiAwareness];
17
+
18
+ /** From the lowest awareness to the highest: a later one satisfies an earlier request. */
19
+ const AWARENESS_ORDER = [
20
+ DpiAwareness.unaware,
21
+ DpiAwareness.system,
22
+ DpiAwareness.perMonitor,
23
+ DpiAwareness.perMonitorV2
24
+ ] as const;
25
+
26
+ /** The pseudo handles of `DPI_AWARENESS_CONTEXT`, signed as Windows defines them; the one table. */
27
+ export const DPI_CONTEXT_HANDLES = {
28
+ [DpiAwareness.unaware]: -1n,
29
+ [DpiAwareness.system]: -2n,
30
+ [DpiAwareness.perMonitor]: -3n,
31
+ [DpiAwareness.perMonitorV2]: -4n
32
+ } as const;
33
+
34
+ const UNAWARE_GDI_SCALED_HANDLE = -5n;
35
+ const POINTER_BITS = 64;
36
+
37
+ /**
38
+ * The awareness a pseudo handle stands for.
39
+ *
40
+ * @param handle - A `DPI_AWARENESS_CONTEXT` pseudo handle, signed or as a 64-bit address.
41
+ * @returns The awareness; undefined for a handle that is not one of the pseudo values.
42
+ */
43
+ export function awarenessOfHandle(handle: bigint) {
44
+ const signed = BigInt.asIntN(POINTER_BITS, handle);
45
+ const isGdiScaled = signed === UNAWARE_GDI_SCALED_HANDLE;
46
+ if (isGdiScaled) {
47
+ return DpiAwareness.unaware;
48
+ }
49
+
50
+ return AWARENESS_ORDER.find(awareness => DPI_CONTEXT_HANDLES[awareness] === signed);
51
+ }
52
+
53
+ /**
54
+ * The awareness the process asked for was refused and what it has is lower;
55
+ * a manifest or an earlier call set it, or a window already exists.
56
+ */
57
+ export class DpiAwarenessTooLow extends Error {
58
+ /** What the process asked for. */
59
+ readonly requested: DpiAwareness;
60
+
61
+ /** What the process has. */
62
+ readonly current: DpiAwareness;
63
+
64
+ constructor({ requested, current }: {
65
+ readonly requested: DpiAwareness;
66
+ readonly current: DpiAwareness;
67
+ }) {
68
+ super(`The process is ${current} DPI aware and cannot become ${requested}: set the awareness before the first window exists, or in the application manifest`);
69
+ this.requested = requested;
70
+ this.current = current;
71
+ }
72
+ }
73
+
74
+ /** The two native steps `ensureDpiAwareness` takes, so a test can stand in for them. */
75
+ export interface DpiAwarenessCalls {
76
+ /** Asks Windows to make the process this aware; true when it did. */
77
+ readonly setProcess: (awareness: DpiAwareness) => boolean;
78
+
79
+ /** What the process is now. */
80
+ readonly current: () => DpiAwareness;
81
+ }
82
+
83
+ function rankOf(awareness: DpiAwareness) {
84
+ return AWARENESS_ORDER.indexOf(awareness);
85
+ }
86
+
87
+ /**
88
+ * Asks for an awareness; refusal is success when the process already has at
89
+ * least that (a manifest or an earlier call set it).
90
+ *
91
+ * @param options - `requested`, and the native `calls`.
92
+ * @throws {DpiAwarenessTooLow} when refused and the process has less
93
+ */
94
+ export function ensureDpiAwareness({ requested, calls }: {
95
+ readonly requested: DpiAwareness;
96
+ readonly calls: DpiAwarenessCalls;
97
+ }) {
98
+ const isSet = calls.setProcess(requested);
99
+ if (isSet) {
100
+ return;
101
+ }
102
+
103
+ const current = calls.current();
104
+ const isSufficient = rankOf(current) >= rankOf(requested);
105
+ if (!isSufficient) {
106
+ throw new DpiAwarenessTooLow({
107
+ requested,
108
+ current
109
+ });
110
+ }
111
+ }
112
+
113
+ function bindUser32() {
114
+ return bindDll({
115
+ dll: "user32.dll",
116
+ functions: {
117
+ setProcess: ["SetProcessDpiAwarenessContext", ["pointer"], "i32"],
118
+ thread: ["GetThreadDpiAwarenessContext", [], "pointer"],
119
+ areEqual: ["AreDpiAwarenessContextsEqual", ["pointer", "pointer"], "i32"]
120
+ }
121
+ });
122
+ }
123
+
124
+ function handleArgument(awareness: DpiAwareness) {
125
+ return BigInt.asUintN(POINTER_BITS, DPI_CONTEXT_HANDLES[awareness]);
126
+ }
127
+
128
+ /**
129
+ * What this process is now, from `GetThreadDpiAwarenessContext`.
130
+ *
131
+ * @returns The awareness; `unaware` for the GDI-scaled flavour of it.
132
+ */
133
+ export function processDpiAwareness() {
134
+ const user32 = bindUser32();
135
+ const context = user32.thread();
136
+ function isEqual(awareness: DpiAwareness) {
137
+ return user32.areEqual(context, handleArgument(awareness)) !== 0;
138
+ }
139
+
140
+ return [...AWARENESS_ORDER].reverse().find(isEqual) ?? DpiAwareness.unaware;
141
+ }
142
+
143
+ /**
144
+ * Asks Windows for a process-wide awareness. Call it on the main thread
145
+ * before any window exists: user32 allows it once, and a library that created
146
+ * a window first keeps an unaware process.
147
+ *
148
+ * @param requested - The awareness to ask for.
149
+ * @throws {DpiAwarenessTooLow} when refused and the process has less
150
+ */
151
+ export function requestDpiAwareness(requested: DpiAwareness) {
152
+ const user32 = bindUser32();
153
+ ensureDpiAwareness({
154
+ requested,
155
+ calls: {
156
+ setProcess(awareness) {
157
+ return user32.setProcess(handleArgument(awareness)) !== 0;
158
+ },
159
+ current: processDpiAwareness
160
+ }
161
+ });
162
+ }
@@ -1,11 +1,11 @@
1
1
  import type { ForegroundSource } from "./foreground-filter.ts";
2
2
  import { DynComRawMemory } from "@microsoft/dynwinrt/com/unsafe/raw";
3
- import { bindDll, WIDE_CHAR_BYTES, wideMemory } from "#src/win32-calls.js";
3
+ import { bindDll, DWORD_BYTES, WIDE_CHAR_BYTES, wideMemory } from "#src/win32-calls.js";
4
+ import { FOREGROUND_QUERY_CALLS } from "#src/win32-foreground.js";
4
5
 
5
6
  // The Win32 calls behind foreground tracking. Bound when a function is called, never when the module loads.
6
7
 
7
8
  const CLASS_NAME_CHARS = 256;
8
- const DWORD_BYTES = 4;
9
9
  const WS_POPUP = 0x80000000;
10
10
  const NO_WINDOW = 0n;
11
11
  const SHELL_HOOK_MESSAGE = "SHELLHOOK";
@@ -15,10 +15,8 @@ function bindUser32() {
15
15
  return bindDll({
16
16
  dll: "user32.dll",
17
17
  functions: {
18
- foreground: ["GetForegroundWindow", [], "pointer"],
18
+ ...FOREGROUND_QUERY_CALLS,
19
19
  className: ["GetClassNameW", ["pointer", "pointer", "i32"], "i32"],
20
- threadOf: ["GetWindowThreadProcessId", ["pointer", "pointer"], "u32"],
21
- isWindow: ["IsWindow", ["pointer"], "i32"],
22
20
  createWindow: [
23
21
  "CreateWindowExW",
24
22
  ["u32", "pointer", "pointer", "u32", "i32", "i32", "i32", "i32", "pointer", "pointer", "pointer", "pointer"],
@@ -4,6 +4,8 @@ export type { AppWindow, WindowOptions } from "./create-window.ts";
4
4
  export { Backdrop } from "./backdrop.ts";
5
5
  export type { WindowBounds, WindowSize } from "./anchor.ts";
6
6
  export { SizeToContent, WindowAnchor } from "./anchor.ts";
7
+ export type { CoverOptions } from "./cover.ts";
8
+ export { coverWindow } from "./cover.ts";
7
9
  export type { DockOptions } from "./dock.ts";
8
10
  export { displayAreaOf, DockDisplay, dockWindow } from "./dock.ts";
9
11
  export type { CaptionButtonColors, WindowRegion } from "./chrome.ts";
@@ -9,6 +9,7 @@ import {
9
9
  addressOf,
10
10
  bind,
11
11
  numberOf,
12
+ POINTER_BYTES,
12
13
  pointerOf,
13
14
  wideMemory,
14
15
  withMemory
@@ -598,7 +599,6 @@ export function requestFineTimerResolution() {
598
599
 
599
600
  const LOOP_OFFSET = 8;
600
601
  const IOCP_OFFSET = 56;
601
- const POINTER_BYTES = 8;
602
602
  const POINTER_ALIGNMENT = 8;
603
603
  const OBJECT_TYPE_BUFFER_BYTES = 256;
604
604
  const OBJECT_TYPE_NAME_LENGTH_OFFSET = 0;
@@ -0,0 +1,112 @@
1
+ import type { DynComRawMemory } from "@microsoft/dynwinrt/com/unsafe/raw";
2
+ import { bindDll, DWORD_BYTES, POINTER_BYTES, withMemory } from "#src/win32-calls.js";
3
+
4
+ // Two questions of the process's package identity, answered with kernel32 calls
5
+ // only, no WinRT: this module is on the path of `winui-svelte/bootstrap`, which
6
+ // promises to import nothing of WinRT. GetCurrentPackageFullName (appmodel.h)
7
+ // is the cheap check: called with a zero length it answers
8
+ // APPMODEL_ERROR_NO_PACKAGE outside a package and ERROR_INSUFFICIENT_BUFFER
9
+ // inside one. GetCurrentPackageInfo lists the package graph, whose framework
10
+ // packages tell whether the Windows App SDK is already loaded for the process.
11
+
12
+ const NO_PACKAGE_ERROR = 15_700;
13
+ const INSUFFICIENT_BUFFER_ERROR = 122;
14
+ const SUCCESS = 0;
15
+ const PACKAGE_FILTER_HEAD = 0x10;
16
+ const PACKAGE_FILTER_DIRECT = 0x20;
17
+ const FRAMEWORK_PREFIX = "Microsoft.WindowsAppRuntime";
18
+ // PACKAGE_INFO on 64-bit Windows: reserved, flags, path, full name, family name,
19
+ // then the PACKAGE_ID (reserved, architecture, version, name, publisher, ...).
20
+ const PACKAGE_INFO_BYTES = 80;
21
+ const NAME_OFFSET = 48;
22
+ const COUNT_OFFSET = DWORD_BYTES;
23
+
24
+ const appModel = bindDll({
25
+ dll: "kernel32.dll",
26
+ functions: {
27
+ currentPackageFullName: ["GetCurrentPackageFullName", ["pointer", "pointer"], "i32"],
28
+ currentPackageInfo: ["GetCurrentPackageInfo", ["u32", "pointer", "pointer", "pointer"], "i32"]
29
+ }
30
+ });
31
+
32
+ /**
33
+ * Whether this process has a package identity (MSIX, or a sparse package).
34
+ *
35
+ * @returns False for plain Node.js, Electron and `pnpm dev`.
36
+ */
37
+ export function hasPackageIdentity() {
38
+ return withMemory({
39
+ size: DWORD_BYTES,
40
+ alignment: DWORD_BYTES,
41
+ use(length) {
42
+ length.writeU32(0, 0);
43
+ return appModel.currentPackageFullName(length, null) !== NO_PACKAGE_ERROR;
44
+ }
45
+ });
46
+ }
47
+
48
+ function nameAt({ buffer, address }: {
49
+ buffer: DynComRawMemory;
50
+ address: bigint;
51
+ }) {
52
+ const start = Number(address - buffer.pointer().address);
53
+ const remaining = Number(buffer.size) - start;
54
+ const [name = ""] = buffer.readBytes(start, remaining).toString("utf16le").split("\0");
55
+ return name;
56
+ }
57
+
58
+ function packageNames({ buffer, count }: {
59
+ buffer: DynComRawMemory;
60
+ count: number;
61
+ }) {
62
+ return Array.from({ length: count }, (_, iPackage) => {
63
+ const address = buffer.readU64(iPackage * PACKAGE_INFO_BYTES + NAME_OFFSET);
64
+ return nameAt({
65
+ buffer,
66
+ address
67
+ });
68
+ });
69
+ }
70
+
71
+ // The two-call pattern: the first call, given no buffer, reports the size.
72
+ function packageGraphNames() {
73
+ const flags = PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT;
74
+ return withMemory({
75
+ size: DWORD_BYTES * 2,
76
+ alignment: DWORD_BYTES,
77
+ use(sizes) {
78
+ const count = sizes.pointer(COUNT_OFFSET).address;
79
+ sizes.writeU32(0, 0);
80
+ const isSized = appModel.currentPackageInfo(flags, sizes, null, count) === INSUFFICIENT_BUFFER_ERROR;
81
+ if (!isSized) {
82
+ return [];
83
+ }
84
+
85
+ return withMemory({
86
+ size: sizes.readU32(0),
87
+ alignment: POINTER_BYTES,
88
+ use(buffer) {
89
+ const isFilled = appModel.currentPackageInfo(flags, sizes, buffer, count) === SUCCESS;
90
+ return isFilled ? packageNames({
91
+ buffer,
92
+ count: sizes.readU32(COUNT_OFFSET)
93
+ }) : [];
94
+ }
95
+ });
96
+ }
97
+ });
98
+ }
99
+
100
+ /**
101
+ * Whether a Windows App SDK framework package is in this process's package
102
+ * graph, which is the case when the manifest declares the `PackageDependency`:
103
+ * WinRT and WinUI then activate with no bootstrapper, and the bootstrapper
104
+ * refuses to run. A sparse package has an identity and may have no such
105
+ * dependency.
106
+ *
107
+ * @returns False outside a package and in a package without the framework.
108
+ */
109
+ export function hasWindowsAppRuntimeDependency() {
110
+ const isPackaged = hasPackageIdentity();
111
+ return isPackaged && packageGraphNames().some(name => name.startsWith(FRAMEWORK_PREFIX));
112
+ }
@@ -1,4 +1,10 @@
1
- import { bind, numberOf, pointerOf, withMemory } from "#src/win32-calls.js";
1
+ import {
2
+ bind,
3
+ numberOf,
4
+ POINTER_BYTES,
5
+ pointerOf,
6
+ withMemory
7
+ } from "#src/win32-calls.js";
2
8
 
3
9
  // Windows.UI.Composition.Compositor (the system's, which the transparent
4
10
  // backdrop needs) refuses to be created on a thread with no
@@ -9,7 +15,6 @@ import { bind, numberOf, pointerOf, withMemory } from "#src/win32-calls.js";
9
15
  // makes it, as Microsoft's own MicaController samples do.
10
16
 
11
17
  const OPTIONS_BYTES = 12;
12
- const POINTER_BYTES = 8;
13
18
  const ALIGNMENT = 8;
14
19
  const THREAD_CURRENT = 2;
15
20
  const APARTMENT_NONE = 0;
@@ -2,7 +2,7 @@ import type { TaskbarBackend } from "./taskbar.ts";
2
2
  import { DynWinRtValue, WinGuid } from "@microsoft/dynwinrt";
3
3
  import { DynCom, DynComMethodSig, DynComUnsafe } from "@microsoft/dynwinrt/com/unsafe";
4
4
  import { DynComRawMemory } from "@microsoft/dynwinrt/com/unsafe/raw";
5
- import { bind, pointerOf } from "#src/win32-calls.js";
5
+ import { bind, POINTER_BYTES, pointerOf } from "#src/win32-calls.js";
6
6
  import { createIconFileCalls, createPixelIconCalls } from "#src/win32-icons.js";
7
7
 
8
8
  // ITaskbarList3 (shobjidl_core.h) has no WinRT form, so its methods are
@@ -25,7 +25,6 @@ const OFFSET_TOP = 4;
25
25
  const OFFSET_RIGHT = 8;
26
26
  const OFFSET_BOTTOM = 12;
27
27
  const FLASH_INFO_SIZE = 32;
28
- const POINTER_BYTES = 8;
29
28
  const NO_ICON = 0n;
30
29
  const OFFSET_SIZE = 0;
31
30
  const OFFSET_HWND = 8;
@@ -1,4 +1,6 @@
1
1
  import { applyShownInSwitchers } from "./apply-chrome.ts";
2
+ import type { CoverOptions } from "./cover.ts";
3
+ import { coverWindow } from "./cover.ts";
2
4
  import type { DockOptions } from "./dock.ts";
3
5
  import { dockWindow } from "./dock.ts";
4
6
  import { scaleOf } from "./native.ts";
@@ -8,6 +10,7 @@ import { createTaskbarButton } from "./taskbar.ts";
8
10
  import type { TaskbarButton } from "./taskbar.ts";
9
11
  import { WindowControlsOverlay, windowTitleBarSource } from "#src/web-apis/window-controls-overlay.js";
10
12
  import { WindowGeometry } from "#src/web-apis/window-geometry.js";
13
+ import { bringWindowToFront } from "#src/win32-foreground.js";
11
14
  import type { Window } from "#src/winui.js";
12
15
  import {
13
16
  FileOpenPicker,
@@ -121,6 +124,24 @@ export class WindowHandle {
121
124
  });
122
125
  }
123
126
 
127
+ /**
128
+ * Covers a whole display, or a rectangle of one, in physical pixels, and
129
+ * returns the bounds it applied. A covering window needs `isBorderless` and
130
+ * `isResizable={false}`; `cover` leaves those props to you. `dock` is a
131
+ * corner of the work area at the window's own size, `cover` is the whole
132
+ * display at the display's size, and `geometry` is in CSS pixels and can do
133
+ * neither exactly.
134
+ *
135
+ * @param options - The display (the active one by default) and the region of
136
+ * it, from its top left (the whole display by default).
137
+ */
138
+ cover(options: CoverOptions = {}) {
139
+ return coverWindow({
140
+ appWindow: this.appWindow,
141
+ ...options
142
+ });
143
+ }
144
+
124
145
  /** Shows the window and gives it focus. */
125
146
  activate() {
126
147
  this.window.activate();
@@ -141,10 +162,17 @@ export class WindowHandle {
141
162
  this.presenter.restore();
142
163
  }
143
164
 
144
- /** Restored, shown and focused: what launching an app again does. */
165
+ /**
166
+ * Restored, shown and focused: what launching an app again does. WinUI's
167
+ * activation alone is refused by Windows' foreground lock when this process
168
+ * was not just given the foreground (a tray menu in another process asked
169
+ * for the window), and the window then only flashes on the taskbar, so the
170
+ * window is also brought to the front the way `bringWindowToFront` does.
171
+ */
145
172
  bringToFront() {
146
173
  this.restore();
147
174
  this.activate();
175
+ bringWindowToFront(this.appWindow.id.value);
148
176
  }
149
177
 
150
178
  /**
@@ -184,6 +184,16 @@ export interface WindowProps {
184
184
  */
185
185
  isActivatable?: boolean | undefined;
186
186
 
187
+ /**
188
+ * The window is shown, so its page runs at full speed, and never seen: a
189
+ * tool window that is not activatable, opens without taking focus and sits
190
+ * clear of every display (left of the virtual screen). `placement` and
191
+ * `width`/`height` give only the size. Dropped again, the window goes back
192
+ * where it was. Not the same as `isHidden`: a hidden window is a hidden
193
+ * page, and Chromium slows it down.
194
+ */
195
+ isParked?: boolean | undefined;
196
+
187
197
  /** Clicks go to whatever is behind the window. */
188
198
  isClickThrough?: boolean | undefined;
189
199
 
@@ -216,7 +226,7 @@ export interface WindowProps {
216
226
  * again when the window goes back to it.
217
227
  */
218
228
  presentation?: WindowPresentation | undefined;
219
- isResizable?: boolean;
229
+ isResizable?: boolean | undefined;
220
230
  isMaximizable?: boolean;
221
231
  isMinimizable?: boolean;
222
232
 
@@ -355,6 +365,12 @@ class WindowHost {
355
365
  private isBorderApplied = false;
356
366
  private isCaptureApplied = false;
357
367
  private isSwitcherApplied = false;
368
+ private unparkedBounds: {
369
+ x: number;
370
+ y: number;
371
+ width: number;
372
+ height: number;
373
+ } | null = null;
358
374
  private isClipApplied = false;
359
375
  private isTopApplied = false;
360
376
  private hasShown = false;
@@ -392,7 +408,7 @@ class WindowHost {
392
408
  file: windowStateFile(stateKey)
393
409
  }) : null;
394
410
 
395
- const isNewBackgroundWindow = isBackgroundRun() && !this.isTakenOver;
411
+ const isNewBackgroundWindow = this.isKeptInBackground && !this.isTakenOver;
396
412
  if (isNewBackgroundWindow) {
397
413
  keepInBackground(this.handle.appWindow.id.value);
398
414
  }
@@ -409,6 +425,7 @@ class WindowHost {
409
425
  this.keepInLine(() => this.syncPresentation());
410
426
  this.keepInLine(() => this.syncLimits());
411
427
  this.keepInLine(() => this.syncFrame());
428
+ $effect(() => this.syncParked());
412
429
  this.keepInLine(() => this.syncShape());
413
430
 
414
431
  if (!this.isTakenOver) {
@@ -630,6 +647,10 @@ class WindowHost {
630
647
  }
631
648
  }
632
649
 
650
+ private get isKeptInBackground() {
651
+ return isBackgroundRun() || this.props.isParked === true;
652
+ }
653
+
633
654
  private get isWindowed() {
634
655
  const presentation = this.props.presentation ?? WindowPresentation.windowed;
635
656
  return presentation === WindowPresentation.windowed;
@@ -650,7 +671,7 @@ class WindowHost {
650
671
  presentation: presentation ?? WindowPresentation.windowed
651
672
  });
652
673
 
653
- if (isBackgroundRun()) {
674
+ if (this.isKeptInBackground) {
654
675
  // A presenter (full screen, compact overlay) puts the window on a display.
655
676
  this.handle.appWindow.moveAndResize(backgroundPlacement(this.handle.appWindow.size));
656
677
  }
@@ -711,6 +732,37 @@ class WindowHost {
711
732
  }
712
733
  }
713
734
 
735
+ // Parking after the window is open moves it off every display; dropping the
736
+ // prop moves it back. The first placement is placeFirst's.
737
+ private syncParked() {
738
+ const isParked = this.props.isParked === true && !isBackgroundRun();
739
+ const { appWindow } = this.handle;
740
+ if (!this.hasShown) {
741
+ return;
742
+ }
743
+
744
+ const isToPark = isParked && this.unparkedBounds === null;
745
+ if (isToPark) {
746
+ const { x, y } = appWindow.position;
747
+ const { width, height } = appWindow.size;
748
+ this.unparkedBounds = {
749
+ x,
750
+ y,
751
+ width,
752
+ height
753
+ };
754
+ appWindow.moveAndResize(backgroundPlacement(appWindow.size));
755
+ return;
756
+ }
757
+
758
+ const { unparkedBounds } = this;
759
+ const isToUnpark = !isParked && unparkedBounds !== null;
760
+ if (isToUnpark) {
761
+ appWindow.moveAndResize(unparkedBounds);
762
+ this.unparkedBounds = null;
763
+ }
764
+ }
765
+
714
766
  // The window styles, the borderless presenter and the capture affinity: all
715
767
  // left alone until the app names them.
716
768
  private syncFrame() {
@@ -745,6 +797,7 @@ class WindowHost {
745
797
  hwnd,
746
798
  style,
747
799
  isOn,
800
+ isParked: this.isKeptInBackground,
748
801
  applied: this.appliedStyles
749
802
  });
750
803
  }
@@ -893,7 +946,7 @@ class WindowHost {
893
946
  scale
894
947
  })
895
948
  };
896
- if (isBackgroundRun()) {
949
+ if (this.isKeptInBackground) {
897
950
  appWindow.moveAndResize(
898
951
  backgroundPlacement({
899
952
  width: props.placement?.width ?? size.width,
@@ -1142,7 +1195,7 @@ class WindowHost {
1142
1195
 
1143
1196
  private showWindow() {
1144
1197
  const { window } = this.handle;
1145
- const isBackground = this.props.activate === false || isBackgroundRun();
1198
+ const isBackground = this.props.activate === false || this.isKeptInBackground;
1146
1199
  if (isBackground) {
1147
1200
  window.appWindow.showWithActivation(false);
1148
1201
  } else {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "winui-svelte",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "framework": "svelte",
6
6
  "description-markup": "markdown",
7
7
  "contributions": {
@@ -26666,6 +26666,14 @@
26666
26666
  "type": "boolean"
26667
26667
  }
26668
26668
  },
26669
+ {
26670
+ "name": "isParked",
26671
+ "description": "The window is shown, so its page runs at full speed, and never seen: a tool window that is not activatable, opens without taking focus and sits clear of every display (left of the virtual screen). `placement` and `width`/`height` give only the size. Dropped again, the window goes back where it was. Not the same as `isHidden`: a hidden window is a hidden page, and Chromium slows it down.",
26672
+ "value": {
26673
+ "kind": "expression",
26674
+ "type": "boolean"
26675
+ }
26676
+ },
26669
26677
  {
26670
26678
  "name": "isClickThrough",
26671
26679
  "description": "Clicks go to whatever is behind the window.",
@@ -26933,7 +26941,7 @@
26933
26941
  },
26934
26942
  {
26935
26943
  "name": "icon",
26936
- "description": "A path to an `.ico` or `.png`, a glyph string, or square BGRA pixels (`IconPixels`); each renderer decides what it can draw."
26944
+ "description": "The picture beside the label; each renderer decides what it can draw."
26937
26945
  },
26938
26946
  {
26939
26947
  "name": "badge",
@@ -27023,7 +27031,7 @@
27023
27031
  },
27024
27032
  {
27025
27033
  "name": "icon",
27026
- "description": "A path to an `.ico` or `.png`, a glyph string, or square BGRA pixels (`IconPixels`); each renderer decides what it can draw."
27034
+ "description": "The picture beside the label; each renderer decides what it can draw."
27027
27035
  },
27028
27036
  {
27029
27037
  "name": "badge",