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
@@ -1,12 +1,14 @@
1
1
  import { DynComRawMemory } from "@microsoft/dynwinrt/com/unsafe/raw";
2
2
  import { MenuItemKind } from "#src/tray/menu/types.js";
3
3
  import type { ResolvedCheck, ResolvedCommand, ResolvedMenuItem, ResolvedRadio } from "#src/tray/menu/types.js";
4
- import { bindDll, wideMemory } from "#src/win32-calls.js";
4
+ import type { MenuIconCalls } from "#src/tray/tray-extras.js";
5
+ import { bindDll, POINTER_BYTES, wideMemory } from "#src/win32-calls.js";
5
6
 
6
7
  const MIIM_STATE = 0x1;
7
8
  const MIIM_ID = 0x2;
8
9
  const MIIM_SUBMENU = 0x4;
9
10
  const MIIM_STRING = 0x40;
11
+ const MIIM_BITMAP = 0x80;
10
12
  const MIIM_FTYPE = 0x100;
11
13
  const MFT_SEPARATOR = 0x800;
12
14
  const MFT_RADIOCHECK = 0x200;
@@ -14,13 +16,13 @@ const MFS_GRAYED = 0x3;
14
16
  const MFS_CHECKED = 0x8;
15
17
  const MFS_DEFAULT = 0x1000;
16
18
  const MENU_ITEM_INFO_SIZE = 80;
17
- const POINTER_BYTES = 8;
18
19
  const OFFSET_MASK = 4;
19
20
  const OFFSET_TYPE = 8;
20
21
  const OFFSET_STATE = 12;
21
22
  const OFFSET_ID = 16;
22
23
  const OFFSET_SUBMENU = 24;
23
24
  const OFFSET_TEXT = 56;
25
+ const OFFSET_BITMAP = 72;
24
26
  const BY_POSITION = 1;
25
27
  const FIRST_COMMAND_ID = 1;
26
28
  const TPM_RIGHTBUTTON = 0x2;
@@ -29,12 +31,19 @@ const TPM_NONOTIFY = 0x80;
29
31
  const TPM_RETURNCMD = 0x100;
30
32
  const WM_NULL = 0;
31
33
  const NO_SUBMENU = 0n;
34
+ const NO_BITMAP = 0n;
32
35
  const TAB_CODE = 9;
33
36
  const SHORTCUT_SEPARATOR = String.fromCodePoint(TAB_CODE);
34
37
 
35
38
  /** A line the user can pick in a native menu: a command, a check or a radio. */
36
39
  export type NativeChoice = ResolvedCommand | ResolvedCheck | ResolvedRadio;
37
40
 
41
+ interface IconTheme {
42
+ readonly isDark: boolean;
43
+ readonly size: number;
44
+ readonly bitmaps: bigint[];
45
+ }
46
+
38
47
  type TextLine = Exclude<ResolvedMenuItem, { readonly kind: typeof MenuItemKind.SEPARATOR }>;
39
48
 
40
49
  /**
@@ -56,6 +65,9 @@ export interface NativeMenu {
56
65
  readonly y: number;
57
66
  };
58
67
  readonly items: readonly ResolvedMenuItem[];
68
+
69
+ /** Whether the menu is dark now, which picks the member of an icon pair and the color of a tinted glyph. */
70
+ readonly isDark: boolean;
59
71
  }): NativeChoice | undefined;
60
72
  }
61
73
 
@@ -95,8 +107,12 @@ function typeOf(item: ResolvedMenuItem) {
95
107
  return (isSeparator ? MFT_SEPARATOR : 0) | (item.kind === MenuItemKind.RADIO ? MFT_RADIOCHECK : 0);
96
108
  }
97
109
 
98
- /** The Win32 calls that make a menu from resolved lines, bound when this is called, never when the module loads. */
99
- export function createMenuBuilder() {
110
+ /**
111
+ * The Win32 calls that make a menu from resolved lines, bound when this is called, never when the module loads.
112
+ *
113
+ * @param options - `icons`: the calls of the `menuIcons` extra; without them no line has an icon.
114
+ */
115
+ export function createMenuBuilder({ icons }: { readonly icons?: MenuIconCalls | undefined } = {}) {
100
116
  const { createPopup, destroyMenu, insertItem } = bindDll({
101
117
  dll: "user32.dll",
102
118
  functions: {
@@ -106,10 +122,11 @@ export function createMenuBuilder() {
106
122
  }
107
123
  });
108
124
 
109
- function fill({ menu, items, choices }: {
125
+ function fill({ menu, items, choices, theme }: {
110
126
  readonly menu: bigint;
111
127
  readonly items: readonly ResolvedMenuItem[];
112
128
  readonly choices: Map<number, NativeChoice>;
129
+ readonly theme: IconTheme;
113
130
  }) {
114
131
  for (const [position, item] of items.entries()) {
115
132
  const isSubmenu = item.kind === MenuItemKind.SUBMENU;
@@ -118,7 +135,8 @@ export function createMenuBuilder() {
118
135
  fill({
119
136
  menu: submenu,
120
137
  items: item.items,
121
- choices
138
+ choices,
139
+ theme
122
140
  });
123
141
  }
124
142
 
@@ -128,11 +146,21 @@ export function createMenuBuilder() {
128
146
  choices.set(id, item);
129
147
  }
130
148
 
149
+ const bitmap = bitmapOfItem({
150
+ item,
151
+ theme
152
+ });
153
+ const hasBitmap = bitmap !== NO_BITMAP;
154
+ if (hasBitmap) {
155
+ theme.bitmaps.push(bitmap);
156
+ }
157
+
131
158
  const text = wideMemory(item.kind === MenuItemKind.SEPARATOR ? "" : menuTextOf(item));
132
159
  const info = DynComRawMemory.allocate(MENU_ITEM_INFO_SIZE, POINTER_BYTES);
133
160
  try {
134
161
  info.writeU32(0, MENU_ITEM_INFO_SIZE);
135
- info.writeU32(OFFSET_MASK, MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_STRING);
162
+ info.writeU32(OFFSET_MASK, MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_STRING | MIIM_BITMAP);
163
+ info.writeU64(OFFSET_BITMAP, bitmap);
136
164
  info.writeU32(OFFSET_TYPE, typeOf(item));
137
165
  info.writeU32(OFFSET_STATE, stateOf(item));
138
166
  info.writeU32(OFFSET_ID, id);
@@ -146,25 +174,57 @@ export function createMenuBuilder() {
146
174
  }
147
175
  }
148
176
 
177
+ function bitmapOfItem({ item, theme }: {
178
+ readonly item: ResolvedMenuItem;
179
+ readonly theme: IconTheme;
180
+ }) {
181
+ const icon = "icon" in item ? item.icon : undefined;
182
+ const hasIcon = icon !== undefined && icons !== undefined;
183
+ if (!hasIcon) {
184
+ return NO_BITMAP;
185
+ }
186
+
187
+ return icons.bitmapOf({
188
+ icon,
189
+ isDark: theme.isDark,
190
+ isEnabled: "isEnabled" in item && item.isEnabled,
191
+ isChecked: "isChecked" in item && item.isChecked,
192
+ size: theme.size
193
+ });
194
+ }
195
+
149
196
  return {
150
197
  /**
151
- * Makes a popup menu, with a submenu for each submenu line to any depth.
198
+ * Makes a popup menu, with a submenu for each submenu line to any depth. A line with an `icon` gets
199
+ * a bitmap beside its label, sized for the screen scale and dimmed when the line is disabled.
152
200
  *
153
201
  * @returns The menu handle, the table from command number to line, and `destroy`, which
154
- * frees the menu and its submenus.
202
+ * frees the menu, its submenus and the bitmaps.
155
203
  */
156
- build({ items }: { readonly items: readonly ResolvedMenuItem[] }) {
204
+ build({ items, isDark }: {
205
+ readonly items: readonly ResolvedMenuItem[];
206
+ readonly isDark: boolean;
207
+ }) {
157
208
  const menu = createPopup();
158
209
  const choices = new Map<number, NativeChoice>();
210
+ const theme: IconTheme = {
211
+ isDark,
212
+ size: icons?.size() ?? 0,
213
+ bitmaps: []
214
+ };
159
215
  function destroy() {
160
216
  destroyMenu(menu);
217
+ for (const bitmap of theme.bitmaps) {
218
+ icons?.free(bitmap);
219
+ }
161
220
  }
162
221
 
163
222
  try {
164
223
  fill({
165
224
  menu,
166
225
  items,
167
- choices
226
+ choices,
227
+ theme
168
228
  });
169
229
  } catch (error) {
170
230
  destroy();
@@ -185,8 +245,8 @@ export function createMenuBuilder() {
185
245
  * loads. It does not theme itself: the menu follows the process's preferred app mode, which the
186
246
  * caller sets before `choose` (see `createMenuTheme`).
187
247
  */
188
- export function createNativeMenu() {
189
- const builder = createMenuBuilder();
248
+ export function createNativeMenu({ icons }: { readonly icons?: MenuIconCalls | undefined } = {}) {
249
+ const builder = createMenuBuilder({ icons });
190
250
  const { trackPopup, postMessage } = bindDll({
191
251
  dll: "user32.dll",
192
252
  functions: {
@@ -196,8 +256,11 @@ export function createNativeMenu() {
196
256
  });
197
257
 
198
258
  const native: NativeMenu = {
199
- choose({ owner, point, items }) {
200
- const built = builder.build({ items });
259
+ choose({ owner, point, items, isDark }) {
260
+ const built = builder.build({
261
+ items,
262
+ isDark
263
+ });
201
264
  try {
202
265
  const chosen = trackPopup(
203
266
  built.menu,
@@ -10,7 +10,14 @@ import { createTrayNative } from "#src/tray/native.js";
10
10
  import type { TrayNative } from "#src/tray/native.js";
11
11
  import { createTrayCore } from "#src/tray/tray-core.js";
12
12
  import type { TrayIconOptions, TrayScheduler } from "#src/tray/tray-core.js";
13
- import type { BalloonsExtra, ImageOf, TrayExtra, TrayHandle } from "#src/tray/tray-extras.js";
13
+ import type {
14
+ BalloonsExtra,
15
+ ImageOf,
16
+ MenuIconCalls,
17
+ MenuIconsExtra,
18
+ TrayExtra,
19
+ TrayHandle
20
+ } from "#src/tray/tray-extras.js";
14
21
 
15
22
  /** The menu of `createStandaloneTray`; `ItemId` is the union of the ids of `menu`. */
16
23
  interface StandaloneMenuOptions<ItemId extends string, Extras extends readonly TrayExtra[]>
@@ -20,7 +27,8 @@ interface StandaloneMenuOptions<ItemId extends string, Extras extends readonly T
20
27
 
21
28
  /**
22
29
  * The optional parts of the icon, each one import: `balloons` adds `notify`, `bounds` adds `bounds`,
23
- * `themedIcon` lets `icon` follow the taskbar theme. None of their code is in the bundle unless passed.
30
+ * `themedIcon` lets `icon` follow the taskbar theme, `menuIcons` draws the icons of the menu's lines.
31
+ * None of their code is in the bundle unless passed.
24
32
  */
25
33
  readonly extras?: Extras;
26
34
 
@@ -28,7 +36,8 @@ interface StandaloneMenuOptions<ItemId extends string, Extras extends readonly T
28
36
  * The menu a right click opens, in the model of `winui-svelte/tray/menu`: commands, checks, radios,
29
37
  * submenus to any depth, separators and headers. A separator needs an `id` like every line. On this
30
38
  * renderer a submenu's own `onselect` and `autoExpand` do nothing (Windows opens a submenu row and
31
- * reports no pick) and an `icon` is not drawn. None means a right click does nothing. A function makes
39
+ * reports no pick) and an `icon` is drawn only with the `menuIcons` extra in `extras`. None means a right
40
+ * click does nothing. A function makes
32
41
  * the lines each time the menu opens, which is how a tray written as markup keeps its variables current.
33
42
  */
34
43
  readonly menu?: ReadonlyArray<MenuItem<ItemId>> | (() => ReadonlyArray<MenuItem<ItemId>>) | undefined;
@@ -76,6 +85,10 @@ function isBalloons(extra: TrayExtra): extra is BalloonsExtra {
76
85
  return extra.kind === "balloons";
77
86
  }
78
87
 
88
+ function isMenuIcons(extra: TrayExtra): extra is MenuIconsExtra {
89
+ return extra.kind === "menuIcons";
90
+ }
91
+
79
92
  // The menu runs a message loop of its own on the only thread there is, and ends only when the user
80
93
  // picks a line or a click lands elsewhere; a click elsewhere is seen only when the owner is in front.
81
94
  const FOCUS_ATTEMPTS = 3;
@@ -137,6 +150,7 @@ export function createStandaloneTray<
137
150
  const { menu: source } = options;
138
151
  let menu = options.nativeMenu;
139
152
  let theme = options.menuTheme;
153
+ let icons: MenuIconCalls | undefined;
140
154
 
141
155
  function resolved() {
142
156
  const { profile } = options;
@@ -151,7 +165,8 @@ export function createStandaloneTray<
151
165
  readonly x: number;
152
166
  readonly y: number;
153
167
  }) {
154
- menu ??= createNativeMenu();
168
+ icons ??= extras.find(isMenuIcons)?.createCalls();
169
+ menu ??= createNativeMenu({ icons });
155
170
  theme ??= createMenuTheme();
156
171
  const owner = native.createOwnerWindow();
157
172
  let choice: NativeChoice | undefined;
@@ -165,10 +180,12 @@ export function createStandaloneTray<
165
180
  }
166
181
 
167
182
  do {
168
- theme.apply(options.colorScheme ?? MenuColorScheme.SYSTEM);
183
+ const colorScheme = options.colorScheme ?? MenuColorScheme.SYSTEM;
184
+ theme.apply(colorScheme);
169
185
  choice = menu.choose({
170
186
  owner,
171
187
  point,
188
+ isDark: icons?.isDark(colorScheme) ?? false,
172
189
  items: resolved()
173
190
  });
174
191
 
@@ -176,6 +193,10 @@ export function createStandaloneTray<
176
193
  choice.select();
177
194
  }
178
195
  } while (choice?.staysOpen);
196
+
197
+ if (choice) {
198
+ native.allowForeground();
199
+ }
179
200
  } finally {
180
201
  native.destroyWindow(owner);
181
202
  }
@@ -1,11 +1,5 @@
1
+ import { createLightReader, PersonalizeValue } from "./personalize.ts";
1
2
  import type { ThemedIconExtra } from "./tray-extras.ts";
2
- import { bindDll, wideMemory, withMemory } from "#src/win32-calls.js";
3
-
4
- const DWORD_BYTES = 4;
5
- const HKEY_CURRENT_USER = 0x80000001n;
6
- const REG_DWORD_ONLY = 0x10;
7
- const PERSONALIZE_KEY = String.raw`Software\Microsoft\Windows\CurrentVersion\Themes\Personalize`;
8
- const LIGHT_THEME_VALUE = "SystemUsesLightTheme";
9
3
 
10
4
  /**
11
5
  * The extra that lets a tray icon's `icon` be `{ forLightTaskbar, forDarkTaskbar }`: pass it in `extras`
@@ -14,35 +8,9 @@ const LIGHT_THEME_VALUE = "SystemUsesLightTheme";
14
8
  export const themedIcon: ThemedIconExtra = {
15
9
  kind: "themedIcon",
16
10
  createReader() {
17
- const { registryValue } = bindDll({
18
- dll: "advapi32.dll",
19
- functions: {
20
- registryValue: ["RegGetValueW", ["pointer", "pointer", "pointer", "u32", "pointer", "pointer", "pointer"], "i32"]
21
- }
22
- });
23
- return () => withMemory({
24
- size: 2 * DWORD_BYTES,
25
- alignment: DWORD_BYTES,
26
- use(buffer) {
27
- buffer.writeU32(DWORD_BYTES, DWORD_BYTES);
28
- const subKey = wideMemory(PERSONALIZE_KEY);
29
- const valueName = wideMemory(LIGHT_THEME_VALUE);
30
- try {
31
- const result = registryValue(
32
- HKEY_CURRENT_USER,
33
- subKey,
34
- valueName,
35
- REG_DWORD_ONLY,
36
- null,
37
- buffer,
38
- buffer.pointer(DWORD_BYTES).address
39
- );
40
- return result === 0 && buffer.readU32(0) !== 0;
41
- } finally {
42
- subKey.release();
43
- valueName.release();
44
- }
45
- }
11
+ return createLightReader({
12
+ value: PersonalizeValue.TASKBAR_IS_LIGHT,
13
+ isLightWhenMissing: false
46
14
  });
47
15
  }
48
16
  };
@@ -1,4 +1,4 @@
1
- import { createClickDetector } from "./click-detector.ts";
1
+ import { createClickDetector, TrayGesture } from "./click-detector.ts";
2
2
  import type { TrayPointerEvent } from "./click-detector.ts";
3
3
  import { NotifyOperation } from "./native.ts";
4
4
  import type {
@@ -182,6 +182,11 @@ export function createTrayCore<const Extras extends readonly TrayExtra[]>(option
182
182
  contextMenu: options.oncontextmenu,
183
183
  middleClick: options.onmiddleclick
184
184
  };
185
+ const isMenu = event.gesture === TrayGesture.contextMenu;
186
+ if (!isMenu) {
187
+ native.allowForeground();
188
+ }
189
+
185
190
  handlers[event.gesture]?.(event);
186
191
  }
187
192
  });
@@ -1,4 +1,6 @@
1
+ import type { MenuIcon } from "./menu/types.ts";
1
2
  import type { Balloon, BalloonWriter, NotifyOperation, ScreenRect } from "./native.ts";
3
+ import type { MenuColorScheme } from "./standalone/menu-theme.ts";
2
4
  import type { BalloonOptions, TrayIconImage } from "./tray-core.ts";
3
5
 
4
6
  /** What an extra may use of a live tray icon. */
@@ -37,8 +39,35 @@ export interface ThemedIconExtra {
37
39
  createReader(): () => boolean;
38
40
  }
39
41
 
40
- /** One of the three optional parts of a tray icon. */
41
- export type TrayExtra = BalloonsExtra | BoundsExtra | ThemedIconExtra;
42
+ /** What the popup menu calls to draw the icon of a line. */
43
+ export interface MenuIconCalls {
44
+ /** The side of a menu bitmap, in pixels, at the screen's scale. */
45
+ size(): number;
46
+
47
+ /** Whether a menu of this color scheme is dark now, read fresh on each call. */
48
+ isDark(colorScheme: MenuColorScheme): boolean;
49
+
50
+ /** Makes the premultiplied bitmap of an icon for the theme; 0n when the picture cannot be read. */
51
+ bitmapOf(options: {
52
+ readonly icon: MenuIcon;
53
+ readonly isDark: boolean;
54
+ readonly isEnabled: boolean;
55
+ readonly isChecked: boolean;
56
+ readonly size: number;
57
+ }): bigint;
58
+
59
+ /** Frees a bitmap `bitmapOf` made. */
60
+ free(bitmap: bigint): void;
61
+ }
62
+
63
+ /** The extra that draws the `icon` of the lines of a standalone tray's menu. Import `menuIcons`. */
64
+ export interface MenuIconsExtra {
65
+ readonly kind: "menuIcons";
66
+ createCalls(): MenuIconCalls;
67
+ }
68
+
69
+ /** One of the four optional parts of a tray icon. */
70
+ export type TrayExtra = BalloonsExtra | BoundsExtra | ThemedIconExtra | MenuIconsExtra;
42
71
 
43
72
  type HasExtra<Extras extends readonly TrayExtra[], Kind extends TrayExtra["kind"]> =
44
73
  [Extract<Extras[number], { readonly kind: Kind }>] extends [never] ? false : true;
@@ -1,10 +1,10 @@
1
1
  import { DomErrorName, domException } from "./dom-exception.ts";
2
2
  import { defineProperty } from "./install.ts";
3
3
  import { createCursorReader } from "#src/tray/native.js";
4
- import { createKeyStateReader, createScreenPixelReader } from "#src/web-apis/native.js";
4
+ import { createScreenPixelReader } from "#src/web-apis/native.js";
5
+ import { createKeyStateReader, PointerButtonKey } from "#src/win32-key-state.js";
5
6
 
6
7
  const POLL_MILLISECONDS = 16;
7
- const VIRTUAL_KEY_LEFT_BUTTON = 0x01;
8
8
  const VIRTUAL_KEY_ESCAPE = 0x1b;
9
9
  const HEX_RADIX = 16;
10
10
  const HEX_DIGITS = 2;
@@ -69,11 +69,15 @@ function delay(milliseconds: number) {
69
69
  export function windowsScreenPicker() {
70
70
  const readCursor = createCursorReader();
71
71
  const readPixel = createScreenPixelReader();
72
- const isDown = createKeyStateReader();
72
+ const readKey = createKeyStateReader();
73
+
74
+ function isDown(virtualKey: number) {
75
+ return readKey(virtualKey).isDown;
76
+ }
73
77
 
74
78
  return {
75
79
  async pick({ signal }) {
76
- let isHeld = isDown(VIRTUAL_KEY_LEFT_BUTTON);
80
+ let isHeld = isDown(PointerButtonKey.left);
77
81
  for (;;) {
78
82
  signal?.throwIfAborted();
79
83
  const isCancelled = isDown(VIRTUAL_KEY_ESCAPE);
@@ -81,7 +85,7 @@ export function windowsScreenPicker() {
81
85
  return undefined;
82
86
  }
83
87
 
84
- const isPressed = isDown(VIRTUAL_KEY_LEFT_BUTTON);
88
+ const isPressed = isDown(PointerButtonKey.left);
85
89
  const isNewPress = isPressed && !isHeld;
86
90
  isHeld = isPressed;
87
91
 
@@ -1,7 +1,6 @@
1
1
  import { DynWin32, DynWin32Unsafe } from "@microsoft/dynwinrt/win32/unsafe";
2
2
  import { addressOf, bind, numberOf, pointerOf } from "#src/win32-calls.js";
3
3
 
4
- const KEY_DOWN_BIT = 0x8000;
5
4
  const INVALID_COLOR = 0xffffffff;
6
5
  const BYTE_MASK = 0xff;
7
6
  const GREEN_SHIFT = 8;
@@ -54,22 +53,3 @@ export function createScreenPixelReader() {
54
53
  }
55
54
  };
56
55
  }
57
-
58
- /**
59
- * Reads whether a key or mouse button is held down, by virtual key code. It
60
- * only reads; nothing is sent.
61
- *
62
- * @returns A function from a virtual key code to whether it is down now.
63
- */
64
- export function createKeyStateReader() {
65
- const keyState = bind({
66
- dll: "user32.dll",
67
- entryPoint: "GetAsyncKeyState",
68
- parameters: ["i32"],
69
- returnType: "i32"
70
- });
71
- return (virtualKey: number) => {
72
- const state = numberOf(keyState.invoke([DynWin32.i32(virtualKey)]).returnValue);
73
- return (state & KEY_DOWN_BIT) !== 0;
74
- };
75
- }
@@ -0,0 +1,35 @@
1
+ import { hasPackageIdentity } from "#src/window/package-identity.js";
2
+
3
+ // A Win2D class that a packaged process cannot activate is almost always the
4
+ // manifest's doing, and the error says only which class, once per class:
5
+ // this words it once for the process, naming the fix.
6
+
7
+ const NOT_REGISTERED = "0x80040154";
8
+ const WIN2D_CLASS = "Microsoft.Graphics.Canvas.";
9
+ const PACKAGED_HINT = "Win2D is not registered in this package: add win2dActivatableClasses() of winui-svelte/win2d/manifest to the package's <Extensions> in AppxManifest.xml, with Microsoft.Graphics.Canvas.dll in the package (API.md, Win2D, Packaged apps)";
10
+
11
+ let isHinted = false;
12
+
13
+ /**
14
+ * What to write for a failure of a Win2D effect or drawing: in a packaged
15
+ * process, a Win2D class that is not registered is one message that names the
16
+ * manifest fragment, written once; anything else is the error's own message.
17
+ *
18
+ * @param error - What was thrown.
19
+ * @returns The line to write, or null when it was already written.
20
+ */
21
+ export function win2dFailureMessage(error: unknown) {
22
+ const message = error instanceof Error ? error.message : String(error);
23
+ const isUnregistered = message.includes(NOT_REGISTERED) && message.includes(WIN2D_CLASS);
24
+ const isPackagedUnregistered = isUnregistered && hasPackageIdentity();
25
+ if (!isPackagedUnregistered) {
26
+ return message;
27
+ }
28
+
29
+ if (isHinted) {
30
+ return null;
31
+ }
32
+
33
+ isHinted = true;
34
+ return PACKAGED_HINT;
35
+ }
@@ -1,3 +1,4 @@
1
+ import { win2dFailureMessage } from "./activation-failure.ts";
1
2
  import type { FrameworkElement } from "#winui/microsoft/ui/xaml/FrameworkElement";
2
3
 
3
4
  // What the controllers that draw on an element's Composition visual have in
@@ -74,7 +75,11 @@ export class ElementFollower {
74
75
  height
75
76
  });
76
77
  } catch (error) {
77
- process.stderr.write(`winui-svelte css: ${error instanceof Error ? error.message : String(error)}${NEWLINE}`);
78
+ const message = win2dFailureMessage(error);
79
+ const isWritten = message !== null;
80
+ if (isWritten) {
81
+ process.stderr.write(`winui-svelte css: ${message}${NEWLINE}`);
82
+ }
78
83
  }
79
84
  }
80
85
  }
@@ -0,0 +1,78 @@
1
+ import { readdirSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ // What a packaged app's manifest must say for Win2D to activate: a package's
6
+ // registration catalogue holds only the classes its manifest declares (and
7
+ // those of its framework packages), and Win2D ships no framework package, so
8
+ // every Win2D class the app uses is an `ActivatableClass` of an
9
+ // `InProcessServer` that names Microsoft.Graphics.Canvas.dll inside the
10
+ // package. Unpackaged, `initWindowsAppSdk` puts the library's folder on PATH
11
+ // and the class is found without any of this.
12
+
13
+ const WIN2D_NAMESPACE = "Microsoft.Graphics.Canvas";
14
+ const ANCHOR_CLASS = "microsoft/graphics/canvas/CanvasDevice";
15
+ const ACTIVATION_PATTERN = /activationFactory\('(Microsoft\.Graphics\.Canvas\.[^']+)'/g;
16
+ const THREADING_MODEL = "both";
17
+
18
+ const IN_PROCESS_SERVER_CATEGORY = "windows.activatableClass.inProcessServer";
19
+
20
+ function bindingsFolder() {
21
+ const anchor = fileURLToPath(import.meta.resolve(`#winui/${ANCHOR_CLASS}`));
22
+ return path.resolve(path.dirname(anchor), "..", "..", "..");
23
+ }
24
+
25
+ function bindingFiles(folder: string) {
26
+ return readdirSync(folder, {
27
+ withFileTypes: true,
28
+ recursive: true
29
+ }).filter(entry => entry.isFile() && entry.name.endsWith(".js")).map(entry => path.join(entry.parentPath, entry.name));
30
+ }
31
+
32
+ /**
33
+ * Every Win2D class the bindings activate by name, sorted.
34
+ *
35
+ * @param options - `bindings`: the folder the `#winui` bindings are generated
36
+ * into; the library's own by default.
37
+ * @returns Full class names such as `Microsoft.Graphics.Canvas.Effects.GaussianBlurEffect`.
38
+ */
39
+ export function win2dClassNames({ bindings = bindingsFolder() }: { bindings?: string } = {}) {
40
+ const names = new Set<string>();
41
+ for (const file of bindingFiles(path.join(bindings, ...WIN2D_NAMESPACE.toLowerCase().split(".")))) {
42
+ for (const match of readFileSync(file, "utf8").matchAll(ACTIVATION_PATTERN)) {
43
+ names.add(match[1] ?? "");
44
+ }
45
+ }
46
+
47
+ return [...names].sort();
48
+ }
49
+
50
+ /**
51
+ * The manifest fragment that lets a packaged app activate Win2D: one
52
+ * `InProcessServer` with an `ActivatableClass` per class. Put it in the
53
+ * package's own `<Extensions>` (a child of `<Package>`, after
54
+ * `<Capabilities>`), not the application's, and ship
55
+ * `Microsoft.Graphics.Canvas.dll` at `libraryPath` (`bin\x64\...`, which
56
+ * `buildApp` writes); an x64 and an arm64 package each need their own path.
57
+ *
58
+ * @param options - `libraryPath`: where the DLL is inside the package,
59
+ * relative to its root. `classes`: the classes to list, every Win2D class
60
+ * the bindings hold by default. `bindings`: where those bindings are.
61
+ * @returns The `<Extension>` element.
62
+ */
63
+ export function win2dActivatableClasses({ libraryPath, classes, bindings }: {
64
+ libraryPath: string;
65
+ classes?: readonly string[];
66
+ bindings?: string;
67
+ }) {
68
+ const listed = classes ?? win2dClassNames(bindings === undefined ? {} : { bindings });
69
+ const entries = listed.map(name => ` <ActivatableClass ActivatableClassId="${name}" ThreadingModel="${THREADING_MODEL}" />`);
70
+ return [
71
+ `<Extension Category="${IN_PROCESS_SERVER_CATEGORY}">`,
72
+ " <InProcessServer>",
73
+ ` <Path>${libraryPath.replaceAll("/", "\\")}</Path>`,
74
+ ...entries,
75
+ " </InProcessServer>",
76
+ "</Extension>"
77
+ ].join("\n");
78
+ }
@@ -0,0 +1,19 @@
1
+ // The Win32 seam: the few pieces a consumer needs to call a function of a
2
+ // DLL that WinRT has no equivalent for, over the same binder the package uses.
3
+ // An escape hatch, not a stable API: parameter and return types are strings,
4
+ // the caller owns the lifetime of memory it allocates, and
5
+ // `@microsoft/dynwinrt` is a preview, so this surface may change with it.
6
+ // `bind` takes values that `DynWin32` makes; `bindDll` takes plain numbers,
7
+ // bigints, strings and memory and gives back plain numbers and addresses.
8
+ // The registry has its own typed entry (`winui-svelte/app/activation`).
9
+ export {
10
+ addressOf,
11
+ bind,
12
+ bindDll,
13
+ numberOf,
14
+ pointerOf,
15
+ WIDE_CHAR_BYTES,
16
+ wideMemory,
17
+ withMemory
18
+ } from "#src/win32-calls.js";
19
+ export { hasPackageIdentity } from "#src/window/package-identity.js";
@@ -8,7 +8,14 @@ import type { DynWin32Value } from "@microsoft/dynwinrt/win32/unsafe";
8
8
 
9
9
  /** The size of a UTF-16 code unit, in bytes. */
10
10
  export const WIDE_CHAR_BYTES = 2;
11
- const NO_ADDRESS = 0n;
11
+ /** The size of a pointer, in bytes. */
12
+ export const POINTER_BYTES = 8;
13
+
14
+ /** The size of a DWORD or a 32-bit integer, in bytes. */
15
+ export const DWORD_BYTES = 4;
16
+
17
+ /** The address of a null pointer. */
18
+ export const NO_ADDRESS = 0n;
12
19
 
13
20
  /** A Win32 function to bind: its DLL, name, parameter types and return type (`pointer`, `i32`, `u32`, `i64`). */
14
21
  interface BindOptions {