quickwin 2026.5.2-3.145209

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 (83) hide show
  1. package/README.md +6 -0
  2. package/examples/pdf_preview.js +440 -0
  3. package/examples/pdf_preview.ts +470 -0
  4. package/examples/preact_demo.js +35 -0
  5. package/examples/preact_demo.tsx +49 -0
  6. package/examples/tray_demo.js +75 -0
  7. package/examples/tray_demo.tsx +79 -0
  8. package/lib/fetch.js +746 -0
  9. package/lib/fetch.ts +811 -0
  10. package/lib/polyfill.js +500 -0
  11. package/lib/polyfill.ts +454 -0
  12. package/lib/preact/hooks.js +287 -0
  13. package/lib/preact/hooks.ts +330 -0
  14. package/lib/preact/jsx-runtime.js +1 -0
  15. package/lib/preact/jsx-runtime.ts +2 -0
  16. package/lib/preact/jsx.d.ts +36 -0
  17. package/lib/preact/layout.js +153 -0
  18. package/lib/preact/layout.ts +183 -0
  19. package/lib/preact/preact.js +54 -0
  20. package/lib/preact/preact.ts +133 -0
  21. package/lib/preact/props.js +99 -0
  22. package/lib/preact/props.ts +119 -0
  23. package/lib/preact/render.js +320 -0
  24. package/lib/preact/render.ts +353 -0
  25. package/lib/websocket.js +540 -0
  26. package/lib/websocket.ts +574 -0
  27. package/package.json +32 -0
  28. package/quickwin.d.ts +657 -0
  29. package/test/add.wasm +0 -0
  30. package/test/complex.wasm +0 -0
  31. package/test/complex_imports.wasm +0 -0
  32. package/test/global_imports.wasm +0 -0
  33. package/test/import_func.wasm +0 -0
  34. package/test/imports.wasm +0 -0
  35. package/test/run.js +86 -0
  36. package/test/run.ts +90 -0
  37. package/test/sjlj.wasm +0 -0
  38. package/test/test_basic.js +7 -0
  39. package/test/test_basic.ts +9 -0
  40. package/test/test_brotli.js +48 -0
  41. package/test/test_brotli.ts +52 -0
  42. package/test/test_fetch_cache.js +131 -0
  43. package/test/test_fetch_cache.ts +141 -0
  44. package/test/test_ffi.js +157 -0
  45. package/test/test_ffi.ts +174 -0
  46. package/test/test_frame_encoding.js +128 -0
  47. package/test/test_frame_encoding.ts +132 -0
  48. package/test/test_helper.js +84 -0
  49. package/test/test_helper.ts +80 -0
  50. package/test/test_http_import.js +78 -0
  51. package/test/test_http_import.ts +74 -0
  52. package/test/test_mupdf_render.js +69 -0
  53. package/test/test_mupdf_render.ts +74 -0
  54. package/test/test_mupdf_twice.js +77 -0
  55. package/test/test_mupdf_twice.ts +81 -0
  56. package/test/test_mupdf_wasm.js +33 -0
  57. package/test/test_mupdf_wasm.ts +30 -0
  58. package/test/test_net_event.js +63 -0
  59. package/test/test_net_event.ts +59 -0
  60. package/test/test_net_fetch.js +153 -0
  61. package/test/test_net_fetch.ts +131 -0
  62. package/test/test_net_websocket.js +158 -0
  63. package/test/test_net_websocket.ts +144 -0
  64. package/test/test_polyfill.js +58 -0
  65. package/test/test_polyfill.ts +60 -0
  66. package/test/test_url.js +173 -0
  67. package/test/test_url.ts +183 -0
  68. package/test/test_wasm_basic.js +82 -0
  69. package/test/test_wasm_basic.ts +70 -0
  70. package/test/test_wasm_import_global.js +41 -0
  71. package/test/test_wasm_import_global.ts +39 -0
  72. package/test/test_wasm_sjlj.js +153 -0
  73. package/test/test_wasm_sjlj.ts +134 -0
  74. package/test/test_wasm_types.js +96 -0
  75. package/test/test_wasm_types.ts +108 -0
  76. package/test/types.wasm +0 -0
  77. package/tsconfig.json +18 -0
  78. package/vendor/mupdf-wasm/mupdf-wasm.d.ts +571 -0
  79. package/vendor/mupdf-wasm/mupdf-wasm.js +2749 -0
  80. package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
  81. package/vendor/mupdf-wasm/mupdf.d.ts +939 -0
  82. package/vendor/mupdf-wasm/mupdf.js +3317 -0
  83. package/win-mingw64.exe +0 -0
@@ -0,0 +1,79 @@
1
+ import * as gui from 'gui'
2
+ import * as std from 'std'
3
+
4
+ const WM_TRAY = 0x8001
5
+
6
+ gui.RegisterClass('TrayApp', (hwnd, msg, wParam, lParam) => {
7
+ if (msg === WM_TRAY) {
8
+ const evt = lParam
9
+ if (evt === 0x0201) { // WM_LBUTTONDOWN
10
+ gui.ShowWindow(hwnd, 5) // SW_SHOW
11
+ gui.SetForegroundWindow(hwnd)
12
+ } else if (evt === 0x0204 || evt === 0x007B) { // WM_RBUTTONDOWN or WM_CONTEXTMENU
13
+ gui.SetForegroundWindow(hwnd)
14
+ const pos = gui.GetCursorPos()
15
+ const x = pos ? pos[0] : 0
16
+ const y = pos ? pos[1] : 0
17
+ const hMenu = gui.CreatePopupMenu()
18
+ if (hMenu) {
19
+ gui.AppendMenu(hMenu, 0, 1, '显示窗口')
20
+ gui.AppendMenu(hMenu, 0x0800, 0, '')
21
+ gui.AppendMenu(hMenu, 0, 2, '退出')
22
+ const cmd = gui.TrackPopupMenu(hMenu, x, y, undefined, hwnd)
23
+ gui.DestroyMenu(hMenu)
24
+ if (cmd === 1) {
25
+ gui.ShowWindow(hwnd, 5) // SW_SHOW
26
+ } else if (cmd === 2) {
27
+ gui.ShellNotifyIcon(gui.NotifyIconCmd.DELETE, { hwnd, uID: 1 })
28
+ gui.PostQuitMessage(0)
29
+ }
30
+ }
31
+ }
32
+ return 0
33
+ }
34
+ if (msg === gui.WmMsg.CLOSE) {
35
+ gui.ShowWindow(hwnd, 0) // SW_HIDE
36
+ return 0
37
+ }
38
+ return gui.DefWindowProc(hwnd, msg, wParam, lParam)
39
+ })
40
+
41
+ // 创建窗口
42
+ const W = 500, H = 400
43
+ const scr = gui.GetScreenSize()
44
+ const x = (scr[0] - W) >> 1
45
+ const y = (scr[1] - H) >> 1
46
+ const hwnd = gui.CreateWindow('TrayApp', '系统托盘示例', gui.WindowStyle.OVERLAPPEDWINDOW, x, y, W, H, null, null)
47
+ gui.ShowWindow(hwnd)
48
+
49
+ // 添加说明文字
50
+ const ES_MULTILINE = 0x0004
51
+ const ES_READONLY = 0x0800
52
+ const style = gui.WindowStyle.CHILD | gui.WindowStyle.VISIBLE | ES_MULTILINE | ES_READONLY
53
+ const text = gui.CreateWindow('EDIT',
54
+ 'QuickWin 系统托盘示例\r\n'
55
+ + '\r\n'
56
+ + '右键点击托盘图标打开上下文菜单。\r\n'
57
+ + '关闭此窗口将隐藏到托盘。\r\n'
58
+ + '从菜单中选择"显示窗口"恢复窗口,"退出"结束程序。',
59
+ style, 15, 15, W - 30, H - 70, hwnd, null)
60
+ if (text) {
61
+ const font = gui.CreateSystemDpiFont()
62
+ if (font)
63
+ gui.SendMessage(text, gui.WmMsg.SETFONT, font, 1)
64
+ }
65
+
66
+ const hIcon = gui.LoadIcon('APPLICATION')
67
+ if (hIcon) {
68
+ const ok = gui.ShellNotifyIcon(gui.NotifyIconCmd.ADD, {
69
+ hwnd, uID: 1,
70
+ flags: gui.NotifyIconFlag.MESSAGE | gui.NotifyIconFlag.ICON,
71
+ callbackMessage: WM_TRAY,
72
+ hIcon,
73
+ })
74
+ std.out.printf('tray icon %s\n', ok ? 'added' : 'FAILED')
75
+ std.out.flush()
76
+ } else {
77
+ std.out.printf('failed to load icon\n')
78
+ std.out.flush()
79
+ }