quickwin 2.3.1 → 3.0.1

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 (172) hide show
  1. package/README.en.md +1 -2
  2. package/README.md +1 -2
  3. package/constants.ts +15 -0
  4. package/enum_map.d.ts +3 -0
  5. package/examples/PdfCanvas.js +1 -1
  6. package/examples/PdfCanvas.tsx +2 -2
  7. package/examples/execd/main.js +334 -188
  8. package/examples/pdf_preview2.js +76 -67
  9. package/examples/pdf_preview2.ts +84 -64
  10. package/examples/pdf_viewer.js +4932 -1029
  11. package/examples/pdf_viewer.tsx +11 -22
  12. package/examples/test_gallery.js +308 -143
  13. package/examples/test_gallery.tsx +12 -7
  14. package/examples/test_react_lazy.js +295 -133
  15. package/examples/test_react_lazy.tsx +4 -3
  16. package/examples/test_react_listbox.js +293 -132
  17. package/examples/test_react_listbox.tsx +3 -2
  18. package/examples/test_root_window.js +283 -126
  19. package/examples/test_tab.js +295 -133
  20. package/examples/test_tab.tsx +4 -3
  21. package/examples/tray_demo.js +37 -30
  22. package/examples/tray_demo.tsx +39 -32
  23. package/lib/abort.d.ts +21 -0
  24. package/lib/assert.d.ts +2 -0
  25. package/lib/bitmap.d.ts +7 -0
  26. package/lib/bitmap.js +40 -0
  27. package/lib/cache-utils.d.ts +6 -0
  28. package/lib/certs.d.ts +1 -0
  29. package/lib/certs.js +31 -3
  30. package/lib/dpi.d.ts +9 -0
  31. package/lib/dpi.js +30 -0
  32. package/lib/dumpRects.d.ts +2 -0
  33. package/lib/dumpRects.js +14 -7
  34. package/lib/exec-log.d.ts +23 -0
  35. package/lib/fetch.d.ts +4 -0
  36. package/lib/ffi/bind.d.ts +70 -0
  37. package/lib/ffi/bind.js +5 -4
  38. package/lib/ffi/ctype.d.ts +117 -0
  39. package/lib/ffi/index.d.ts +2 -0
  40. package/lib/ffi/struct.d.ts +174 -0
  41. package/lib/http-common.d.ts +143 -0
  42. package/lib/http-server.d.ts +59 -0
  43. package/lib/polyfill.d.ts +22 -0
  44. package/lib/react-qw/components/Button.d.ts +9 -0
  45. package/lib/react-qw/components/CheckBox.d.ts +11 -0
  46. package/lib/react-qw/components/ComboBox.d.ts +11 -0
  47. package/lib/react-qw/components/DateTimePicker.d.ts +15 -0
  48. package/lib/react-qw/components/DateTimePicker.js +6 -7
  49. package/lib/react-qw/components/Input.d.ts +15 -0
  50. package/lib/react-qw/components/Input.js +5 -1
  51. package/lib/react-qw/components/Link.d.ts +12 -0
  52. package/lib/react-qw/components/ListBox.d.ts +13 -0
  53. package/lib/react-qw/components/ListView.d.ts +37 -0
  54. package/lib/react-qw/components/ListView.js +8 -6
  55. package/lib/react-qw/components/PathPicker.d.ts +23 -0
  56. package/lib/react-qw/components/ProgressBar.d.ts +9 -0
  57. package/lib/react-qw/components/RadioButton.d.ts +11 -0
  58. package/lib/react-qw/components/ScrollView.d.ts +9 -0
  59. package/lib/react-qw/components/ScrollView.js +28 -22
  60. package/lib/react-qw/components/Slider.d.ts +12 -0
  61. package/lib/react-qw/components/Tab.d.ts +14 -0
  62. package/lib/react-qw/components/Tooltip.d.ts +7 -0
  63. package/lib/react-qw/components/TreeView.d.ts +18 -0
  64. package/lib/react-qw/components/index.d.ts +16 -0
  65. package/lib/react-qw/index.d.ts +24 -0
  66. package/lib/react-qw/index.js +7 -5
  67. package/lib/react-qw/layout.d.ts +29 -0
  68. package/lib/react-qw/nmhdr.d.ts +1 -0
  69. package/lib/react-qw/props.d.ts +2 -0
  70. package/lib/react-qw/props.js +3 -3
  71. package/lib/react-qw/reconciler.d.ts +21 -0
  72. package/lib/react-qw/reconciler.js +12 -17
  73. package/lib/stream.d.ts +20 -0
  74. package/lib/text-codec.d.ts +39 -0
  75. package/lib/text-measure.d.ts +14 -0
  76. package/lib/text-measure.js +9 -6
  77. package/lib/url.d.ts +54 -0
  78. package/lib/websocket.d.ts +73 -0
  79. package/lib/windows/{advapi32.ts → advapi32.d.ts} +6 -21
  80. package/lib/windows/comctl32.d.ts +14 -0
  81. package/lib/windows/comctl32.js +3 -2
  82. package/lib/windows/comdlg32.d.ts +4 -0
  83. package/lib/windows/{gdi32.ts → gdi32.d.ts} +184 -97
  84. package/lib/windows/gdi32.js +28 -6
  85. package/lib/windows/{kernel32.ts → kernel32.d.ts} +145 -113
  86. package/lib/windows/kernel32.js +9 -0
  87. package/lib/windows/{msimg32.ts → msimg32.d.ts} +11 -14
  88. package/lib/windows/ntdll.d.ts +5 -0
  89. package/lib/windows/ole32.d.ts +3 -0
  90. package/lib/windows/{psapi.ts → psapi.d.ts} +9 -18
  91. package/lib/windows/shell32.d.ts +51 -0
  92. package/lib/windows/shell32.js +11 -2
  93. package/lib/windows/structs.d.ts +3141 -0
  94. package/lib/windows/structs.js +51 -0
  95. package/lib/windows/user32.d.ts +623 -0
  96. package/lib/windows/user32.js +6 -5
  97. package/lib/windows/version.d.ts +27 -0
  98. package/lib/windows/{winspool.ts → winspool.d.ts} +18 -32
  99. package/main.js +13 -5
  100. package/package.json +16 -7
  101. package/quickwin.d.ts +13 -115
  102. package/qwin-nowasm-x86.exe +0 -0
  103. package/qwin-nowasm.exe +0 -0
  104. package/qwin-x86.exe +0 -0
  105. package/qwin.exe +0 -0
  106. package/test/bench_ffi_callraw.js +3 -4
  107. package/test/bench_ffi_callraw.ts +3 -4
  108. package/test/debug/mupdf_debug.js +4 -22
  109. package/test/debug/wasm_export_debug.js +2 -12
  110. package/test/debug/wasm_names.js +3 -13
  111. package/test/example.pdf +0 -0
  112. package/test/mupdf-cdn.js +40 -0
  113. package/test/mupdf-cdn.ts +43 -0
  114. package/test/test_ffi.js +8 -9
  115. package/test/test_ffi.ts +8 -9
  116. package/test/test_ffi_abi.js +6 -6
  117. package/test/test_ffi_abi.ts +8 -8
  118. package/test/test_ffi_windows.js +82 -11
  119. package/test/test_ffi_windows.ts +85 -11
  120. package/test/test_gdi_draw.js +3 -3
  121. package/test/test_gdi_draw.ts +4 -4
  122. package/test/test_mupdf_render.js +4 -22
  123. package/test/test_mupdf_render.ts +4 -23
  124. package/test/test_mupdf_twice.js +4 -19
  125. package/test/test_mupdf_twice.ts +4 -20
  126. package/test/test_mupdf_wasm.js +10 -4
  127. package/test/test_mupdf_wasm.ts +6 -4
  128. package/test/test_react_complex.js +316 -140
  129. package/test/test_react_counter.js +295 -133
  130. package/test/test_react_flex.js +297 -138
  131. package/test/test_react_hidden.js +296 -134
  132. package/test/test_react_listview_link.js +288 -131
  133. package/test/test_react_notify.js +290 -133
  134. package/test/test_react_render.js +295 -133
  135. package/lib/abort.ts +0 -69
  136. package/lib/assert.ts +0 -7
  137. package/lib/cache-utils.ts +0 -40
  138. package/lib/certs.ts +0 -229
  139. package/lib/dumpRects.ts +0 -26
  140. package/lib/exec-log.ts +0 -30
  141. package/lib/fetch.ts +0 -589
  142. package/lib/ffi/bind.ts +0 -539
  143. package/lib/ffi/ctype.ts +0 -371
  144. package/lib/ffi/index.ts +0 -6
  145. package/lib/ffi/struct.ts +0 -780
  146. package/lib/http-common.ts +0 -441
  147. package/lib/http-server.ts +0 -604
  148. package/lib/polyfill.ts +0 -171
  149. package/lib/react-qw/components/index.ts +0 -17
  150. package/lib/react-qw/index.ts +0 -96
  151. package/lib/react-qw/layout.ts +0 -111
  152. package/lib/react-qw/nmhdr.ts +0 -7
  153. package/lib/react-qw/props.ts +0 -41
  154. package/lib/react-qw/reconciler.ts +0 -383
  155. package/lib/stream.ts +0 -22
  156. package/lib/text-codec.ts +0 -171
  157. package/lib/text-measure.ts +0 -41
  158. package/lib/url.ts +0 -201
  159. package/lib/websocket.ts +0 -600
  160. package/lib/windows/comctl32.ts +0 -19
  161. package/lib/windows/comdlg32.ts +0 -10
  162. package/lib/windows/ntdll.ts +0 -11
  163. package/lib/windows/ole32.ts +0 -9
  164. package/lib/windows/shell32.ts +0 -39
  165. package/lib/windows/structs.ts +0 -752
  166. package/lib/windows/user32.ts +0 -619
  167. package/lib/windows/version.ts +0 -35
  168. package/vendor/mupdf-wasm/mupdf-wasm.d.ts +0 -571
  169. package/vendor/mupdf-wasm/mupdf-wasm.js +0 -2749
  170. package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
  171. package/vendor/mupdf-wasm/mupdf.d.ts +0 -939
  172. package/vendor/mupdf-wasm/mupdf.js +0 -3317
@@ -1367,9 +1367,9 @@ var require_scheduler_development = __commonJS({
1367
1367
  }
1368
1368
  return first;
1369
1369
  }
1370
- function compare(a, b6) {
1371
- var diff = a.sortIndex - b6.sortIndex;
1372
- return 0 !== diff ? diff : a.id - b6.id;
1370
+ function compare(a, b7) {
1371
+ var diff = a.sortIndex - b7.sortIndex;
1372
+ return 0 !== diff ? diff : a.id - b7.id;
1373
1373
  }
1374
1374
  function advanceTimers(currentTime) {
1375
1375
  for (var timer = peek(timerQueue); null !== timer; ) {
@@ -1667,14 +1667,14 @@ var require_react_reconciler_development = __commonJS({
1667
1667
  throw Error("Unable to find node on an unmounted component.");
1668
1668
  return alternate !== fiber ? null : fiber;
1669
1669
  }
1670
- for (var a = fiber, b6 = alternate; ; ) {
1670
+ for (var a = fiber, b7 = alternate; ; ) {
1671
1671
  var parentA = a.return;
1672
1672
  if (null === parentA) break;
1673
1673
  var parentB = parentA.alternate;
1674
1674
  if (null === parentB) {
1675
- b6 = parentA.return;
1676
- if (null !== b6) {
1677
- a = b6;
1675
+ b7 = parentA.return;
1676
+ if (null !== b7) {
1677
+ a = b7;
1678
1678
  continue;
1679
1679
  }
1680
1680
  break;
@@ -1682,23 +1682,23 @@ var require_react_reconciler_development = __commonJS({
1682
1682
  if (parentA.child === parentB.child) {
1683
1683
  for (parentB = parentA.child; parentB; ) {
1684
1684
  if (parentB === a) return assertIsMounted(parentA), fiber;
1685
- if (parentB === b6) return assertIsMounted(parentA), alternate;
1685
+ if (parentB === b7) return assertIsMounted(parentA), alternate;
1686
1686
  parentB = parentB.sibling;
1687
1687
  }
1688
1688
  throw Error("Unable to find node on an unmounted component.");
1689
1689
  }
1690
- if (a.return !== b6.return) a = parentA, b6 = parentB;
1690
+ if (a.return !== b7.return) a = parentA, b7 = parentB;
1691
1691
  else {
1692
1692
  for (var didFindChild = false, _child = parentA.child; _child; ) {
1693
1693
  if (_child === a) {
1694
1694
  didFindChild = true;
1695
1695
  a = parentA;
1696
- b6 = parentB;
1696
+ b7 = parentB;
1697
1697
  break;
1698
1698
  }
1699
- if (_child === b6) {
1699
+ if (_child === b7) {
1700
1700
  didFindChild = true;
1701
- b6 = parentA;
1701
+ b7 = parentA;
1702
1702
  a = parentB;
1703
1703
  break;
1704
1704
  }
@@ -1709,12 +1709,12 @@ var require_react_reconciler_development = __commonJS({
1709
1709
  if (_child === a) {
1710
1710
  didFindChild = true;
1711
1711
  a = parentB;
1712
- b6 = parentA;
1712
+ b7 = parentA;
1713
1713
  break;
1714
1714
  }
1715
- if (_child === b6) {
1715
+ if (_child === b7) {
1716
1716
  didFindChild = true;
1717
- b6 = parentB;
1717
+ b7 = parentB;
1718
1718
  a = parentA;
1719
1719
  break;
1720
1720
  }
@@ -1726,7 +1726,7 @@ var require_react_reconciler_development = __commonJS({
1726
1726
  );
1727
1727
  }
1728
1728
  }
1729
- if (a.alternate !== b6)
1729
+ if (a.alternate !== b7)
1730
1730
  throw Error(
1731
1731
  "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
1732
1732
  );
@@ -15071,10 +15071,10 @@ var require_react_reconciler_development = __commonJS({
15071
15071
  setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition;
15072
15072
  }
15073
15073
  };
15074
- exports2.discreteUpdates = function(fn, a, b6, c, d) {
15074
+ exports2.discreteUpdates = function(fn, a, b7, c, d) {
15075
15075
  var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
15076
15076
  try {
15077
- return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b6, c, d);
15077
+ return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b7, c, d);
15078
15078
  } finally {
15079
15079
  setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS);
15080
15080
  }
@@ -15357,11 +15357,11 @@ var require_constants = __commonJS({
15357
15357
  var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
15358
15358
  var import_react18 = __toESM(require_react(), 1);
15359
15359
  import "../lib/polyfill.js";
15360
- import * as gui18 from "gui";
15360
+ import * as gui17 from "gui";
15361
15361
  import * as os5 from "os";
15362
15362
 
15363
15363
  // _build/lib/react-qw/index.js
15364
- import * as gui17 from "gui";
15364
+ import * as gui16 from "gui";
15365
15365
 
15366
15366
  // _build/lib/windows/user32.js
15367
15367
  import * as os3 from "os";
@@ -15370,7 +15370,6 @@ import * as os3 from "os";
15370
15370
  import * as ffi from "ffi";
15371
15371
  import * as os2 from "os";
15372
15372
  import * as std from "std";
15373
- import * as win from "win";
15374
15373
 
15375
15374
  // _build/lib/text-codec.js
15376
15375
  var _labelMap = {
@@ -15392,19 +15391,19 @@ function _normalizeLabel(label) {
15392
15391
  function _decodeUTF8(buf, fatal) {
15393
15392
  let out = "";
15394
15393
  for (let i = 0; i < buf.length; ) {
15395
- const b6 = buf[i++];
15396
- if (b6 < 128) {
15397
- out += String.fromCharCode(b6);
15394
+ const b7 = buf[i++];
15395
+ if (b7 < 128) {
15396
+ out += String.fromCharCode(b7);
15398
15397
  continue;
15399
15398
  }
15400
- if (b6 < 192) {
15399
+ if (b7 < 192) {
15401
15400
  out += fatal ? (() => {
15402
15401
  throw new TypeError("unexpected continuation byte");
15403
15402
  })() : "\uFFFD";
15404
15403
  continue;
15405
15404
  }
15406
15405
  let c, min;
15407
- if (b6 < 224) {
15406
+ if (b7 < 224) {
15408
15407
  if (i >= buf.length) {
15409
15408
  out += fatal ? (() => {
15410
15409
  throw new TypeError("incomplete utf-8");
@@ -15416,9 +15415,9 @@ function _decodeUTF8(buf, fatal) {
15416
15415
  out += "\uFFFD";
15417
15416
  continue;
15418
15417
  }
15419
- c = (b6 & 31) << 6 | b22 & 63;
15418
+ c = (b7 & 31) << 6 | b22 & 63;
15420
15419
  min = 128;
15421
- } else if (b6 < 240) {
15420
+ } else if (b7 < 240) {
15422
15421
  if (i + 1 >= buf.length) {
15423
15422
  out += fatal ? (() => {
15424
15423
  throw new TypeError("incomplete utf-8");
@@ -15431,9 +15430,9 @@ function _decodeUTF8(buf, fatal) {
15431
15430
  out += "\uFFFD";
15432
15431
  continue;
15433
15432
  }
15434
- c = (b6 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15433
+ c = (b7 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15435
15434
  min = 2048;
15436
- } else if (b6 < 248) {
15435
+ } else if (b7 < 248) {
15437
15436
  if (i + 2 >= buf.length) {
15438
15437
  out += fatal ? (() => {
15439
15438
  throw new TypeError("incomplete utf-8");
@@ -15447,7 +15446,7 @@ function _decodeUTF8(buf, fatal) {
15447
15446
  out += "\uFFFD";
15448
15447
  continue;
15449
15448
  }
15450
- c = (b6 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15449
+ c = (b7 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15451
15450
  min = 65536;
15452
15451
  } else {
15453
15452
  out += fatal ? (() => {
@@ -15751,7 +15750,7 @@ function loadDll(dll) {
15751
15750
  const cached = _dllCache.get(dll);
15752
15751
  if (cached !== void 0)
15753
15752
  return cached;
15754
- const loaded = win.LoadLibrary(dll);
15753
+ const loaded = ffi.LoadLibrary(dll);
15755
15754
  if (!loaded)
15756
15755
  throw new Error(`ffi-bind: LoadLibrary("${dll}") failed`);
15757
15756
  _dllCache.set(dll, loaded);
@@ -15961,7 +15960,7 @@ var BYTE = {
15961
15960
  };
15962
15961
  var builtinCodecs = { WCHAR, BYTE };
15963
15962
  function bind(dll, name, sig, encoders, decoders) {
15964
- const proc = win.GetProcAddress(loadDll(dll), name);
15963
+ const proc = ffi.GetProcAddress(loadDll(dll), name);
15965
15964
  if (!proc)
15966
15965
  throw new Error(`ffi-bind: proc "${name}" not found in ${dll}`);
15967
15966
  const effDec = decoders ?? encoders;
@@ -16001,13 +16000,13 @@ function lower(v) {
16001
16000
  type: { tag: "array", elementType: el.type, elementSize: el.size }
16002
16001
  };
16003
16002
  }
16004
- const b6 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16005
- if (b6) {
16006
- const rawUnit = b6[1];
16003
+ const b7 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16004
+ if (b7) {
16005
+ const rawUnit = b7[1];
16007
16006
  const unit = normToken(rawUnit);
16008
16007
  if (!isCNumberToken(unit) || unit === "f32" || unit === "f64")
16009
16008
  throw new Error(`ffi-struct: bitfield unit must be an integer type, got "${rawUnit}"`);
16010
- const width = Number(b6[2]);
16009
+ const width = Number(b7[2]);
16011
16010
  const s2 = SizeAlign[unit];
16012
16011
  const cap = s2 * 8;
16013
16012
  if (!Number.isInteger(width) || width < 1)
@@ -16323,10 +16322,10 @@ function buildDecl(kind, member, pack) {
16323
16322
  decl[k] = v;
16324
16323
  return decl;
16325
16324
  }
16326
- function struct(a, b6, c) {
16325
+ function struct(a, b7, c) {
16327
16326
  const isNamed = typeof a === "string";
16328
- const raw = isNamed ? b6 : a;
16329
- const opts = isNamed ? c : b6;
16327
+ const raw = isNamed ? b7 : a;
16328
+ const opts = isNamed ? c : b7;
16330
16329
  return createStruct(buildDecl("struct", raw, opts?.pack));
16331
16330
  }
16332
16331
 
@@ -16351,6 +16350,17 @@ var SIZE_DECL = {
16351
16350
  cy: "i32"
16352
16351
  };
16353
16352
  var SIZE = /* @__PURE__ */ struct("SIZE", SIZE_DECL);
16353
+ var SCROLLINFO_DECL = {
16354
+ "#": "struct",
16355
+ cbSize: "u32",
16356
+ fMask: "u32",
16357
+ nMin: "i32",
16358
+ nMax: "i32",
16359
+ nPage: "u32",
16360
+ nPos: "i32",
16361
+ nTrackPos: "i32"
16362
+ };
16363
+ var SCROLLINFO = /* @__PURE__ */ struct("SCROLLINFO", SCROLLINFO_DECL);
16354
16364
  var LOGFONTW_DECL = {
16355
16365
  "#": "struct",
16356
16366
  lfHeight: "i32",
@@ -16369,6 +16379,41 @@ var LOGFONTW_DECL = {
16369
16379
  lfFaceName: "u16[32]@utf-16le"
16370
16380
  };
16371
16381
  var LOGFONTW = /* @__PURE__ */ struct("LOGFONTW", LOGFONTW_DECL);
16382
+ var NONCLIENTMETRICSW_DECL = {
16383
+ "#": "struct",
16384
+ cbSize: "u32",
16385
+ iBorderWidth: "i32",
16386
+ iScrollWidth: "i32",
16387
+ iScrollHeight: "i32",
16388
+ iCaptionWidth: "i32",
16389
+ iCaptionHeight: "i32",
16390
+ lfCaptionFont: LOGFONTW_DECL,
16391
+ iSmCaptionWidth: "i32",
16392
+ iSmCaptionHeight: "i32",
16393
+ lfSmCaptionFont: LOGFONTW_DECL,
16394
+ iMenuWidth: "i32",
16395
+ iMenuHeight: "i32",
16396
+ lfMenuFont: LOGFONTW_DECL,
16397
+ lfStatusFont: LOGFONTW_DECL,
16398
+ lfMessageFont: LOGFONTW_DECL,
16399
+ iPaddedBorderWidth: "i32"
16400
+ };
16401
+ var NONCLIENTMETRICSW = /* @__PURE__ */ struct("NONCLIENTMETRICSW", NONCLIENTMETRICSW_DECL);
16402
+ var BITMAPINFOHEADER_DECL = {
16403
+ "#": "struct",
16404
+ biSize: "u32",
16405
+ biWidth: "i32",
16406
+ biHeight: "i32",
16407
+ biPlanes: "u16",
16408
+ biBitCount: "u16",
16409
+ biCompression: "u32",
16410
+ biSizeImage: "u32",
16411
+ biXPelsPerMeter: "i32",
16412
+ biYPelsPerMeter: "i32",
16413
+ biClrUsed: "u32",
16414
+ biClrImportant: "u32"
16415
+ };
16416
+ var BITMAPINFOHEADER = /* @__PURE__ */ struct("BITMAPINFOHEADER", BITMAPINFOHEADER_DECL);
16372
16417
  var OPENFILENAMEW_DECL = {
16373
16418
  "#": "struct",
16374
16419
  lStructSize: "u32",
@@ -16575,24 +16620,36 @@ var NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct("NOTIFYICONIDENTIFIER", NOTIFY
16575
16620
  var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
16576
16621
  var _bProbe = b("GetDesktopWindow", " -> <HWND>ptr");
16577
16622
  var LONG_PTR_SYM = os3.arch === "x64" ? "PtrW" : "W";
16623
+ var ShowWindow = /* @__PURE__ */ b("ShowWindow", "<HWND>ptr i32@ShowWindowCmd -> i32");
16578
16624
  var SetWindowPos = /* @__PURE__ */ b("SetWindowPos", "<HWND>ptr <>ptr@SetWindowPosHwnd i32 i32 i32 i32 u32 -> i32");
16625
+ var GetWindowRect = /* @__PURE__ */ b("GetWindowRect", "<HWND>ptr <RECT>ptr -> i32");
16626
+ var GetClientRect = /* @__PURE__ */ b("GetClientRect", "<HWND>ptr <RECT>ptr -> i32");
16627
+ var IsWindow = /* @__PURE__ */ b("IsWindow", "<HWND>ptr -> i32");
16628
+ var GetWindowText = /* @__PURE__ */ b("GetWindowTextW", "<HWND>ptr <BYTE>ptr i32 -> i32");
16579
16629
  var SetWindowText = /* @__PURE__ */ b("SetWindowTextW", "<HWND>ptr <WCHAR>ptr -> i32");
16630
+ var GetWindowTextLength = /* @__PURE__ */ b("GetWindowTextLengthW", "<HWND>ptr -> i32");
16580
16631
  var GetWindowLongPtr = /* @__PURE__ */ b("GetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp -> <>ptr");
16581
16632
  var SetWindowLongPtr = /* @__PURE__ */ b("SetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp <>ptr -> <>ptr");
16582
16633
  var EnableWindow = /* @__PURE__ */ b("EnableWindow", "<HWND>ptr i32 -> i32");
16583
16634
  var SetParent = /* @__PURE__ */ b("SetParent", "<HWND>ptr <HWND>ptr -> <HWND>ptr");
16635
+ var GetWindow = /* @__PURE__ */ b("GetWindow", "<HWND>ptr u32@GetWindowCmd -> <HWND>ptr");
16636
+ var PostQuitMessage = /* @__PURE__ */ b("PostQuitMessage", "i32 -> void");
16584
16637
  var DefWindowProc = /* @__PURE__ */ b("DefWindowProcW", "<HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16585
16638
  var CallWindowProc = /* @__PURE__ */ b("CallWindowProcW", "<>ptr <HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16586
16639
  var GetDC = /* @__PURE__ */ b("GetDC", "<HWND>ptr -> <HDC>ptr");
16587
16640
  var ReleaseDC = /* @__PURE__ */ b("ReleaseDC", "<HWND>ptr <HDC>ptr! -> i32");
16588
16641
  var DrawText = /* @__PURE__ */ b("DrawTextW", "<HDC>ptr! <WCHAR>ptr i32 <RECT>ptr i32 -> i32");
16589
16642
  var InvalidateRect = /* @__PURE__ */ b("InvalidateRect", "<HWND>ptr <RECT>ptr i32 -> i32", { RECT });
16643
+ var UpdateWindow = /* @__PURE__ */ b("UpdateWindow", "<HWND>ptr -> i32");
16590
16644
  var SetCursor = /* @__PURE__ */ b("SetCursor", "<HCURSOR>ptr -> <HCURSOR>ptr");
16591
16645
  var LoadCursor = /* @__PURE__ */ b("LoadCursorW", "<HMODULE>ptr <>ptr -> <HCURSOR>ptr");
16592
16646
  var GetCursorPos = /* @__PURE__ */ b("GetCursorPos", "<POINT>ptr -> i32");
16593
16647
  var ScreenToClient = /* @__PURE__ */ b("ScreenToClient", "<HWND>ptr <POINT>ptr -> i32");
16648
+ var SetScrollInfo = /* @__PURE__ */ b("SetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr i32 -> i32", { SCROLLINFO });
16649
+ var GetScrollInfo = /* @__PURE__ */ b("GetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr -> i32");
16594
16650
  var ShowScrollBar = /* @__PURE__ */ b("ShowScrollBar", "<HWND>ptr u32 i32 -> i32");
16595
16651
  var GetSystemMetrics = /* @__PURE__ */ b("GetSystemMetrics", "i32 -> i32");
16652
+ var SystemParametersInfo = /* @__PURE__ */ b("SystemParametersInfoW", "u32 u32 <BYTE>ptr u32 -> i32");
16596
16653
 
16597
16654
  // _build/lib/react-qw/reconciler.js
16598
16655
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
@@ -16607,8 +16664,33 @@ var DeleteObject = /* @__PURE__ */ b2("DeleteObject", "<HGDIOBJ>ptr -> i32");
16607
16664
  var GetDeviceCaps = /* @__PURE__ */ b2("GetDeviceCaps", "<HDC>ptr! i32@DeviceCap -> i32");
16608
16665
  var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr -> <HGDIOBJ>ptr", { LOGFONTW });
16609
16666
  var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr! <HGDIOBJ>ptr -> <HGDIOBJ>ptr");
16667
+ var CreateDIBSection = /* @__PURE__ */ b2("CreateDIBSection", "<HDC>ptr <>ptr u32@ColorUse <>ptr <>ptr u32 -> <HGDIOBJ>ptr");
16668
+ var SetDIBits = /* @__PURE__ */ b2("SetDIBits", "<HDC>ptr <HGDIOBJ>ptr! u32 u32 <BYTE>ptr <>ptr u32@ColorUse -> i32");
16610
16669
  var GetObject = /* @__PURE__ */ b2("GetObjectW", "<HGDIOBJ>ptr i32 <BYTE>ptr -> i32");
16611
16670
 
16671
+ // _build/lib/dpi.js
16672
+ function getScaleFactor() {
16673
+ const hdc = GetDC(NULL);
16674
+ const dpi = hdc ? GetDeviceCaps(
16675
+ hdc,
16676
+ 88
16677
+ /* DeviceCap.LOGPIXELSX */
16678
+ ) : 96;
16679
+ if (hdc)
16680
+ ReleaseDC(NULL, hdc);
16681
+ return dpi / 96;
16682
+ }
16683
+ function createSystemDpiFont() {
16684
+ const ncm = NONCLIENTMETRICSW.encode({ cbSize: NONCLIENTMETRICSW.size });
16685
+ if (!SystemParametersInfo(41, NONCLIENTMETRICSW.size, ncm, 0)) {
16686
+ const legacySize = NONCLIENTMETRICSW.size - 4;
16687
+ NONCLIENTMETRICSW.encode({ cbSize: legacySize }, ncm);
16688
+ if (!SystemParametersInfo(41, legacySize, ncm, 0))
16689
+ return NULL;
16690
+ }
16691
+ return CreateFontIndirect(NONCLIENTMETRICSW.decode(ncm).lfMessageFont);
16692
+ }
16693
+
16612
16694
  // _build/lib/react-qw/props.js
16613
16695
  import * as gui from "gui";
16614
16696
  function applyProps(instance, newProps, _oldProps) {
@@ -16632,14 +16714,14 @@ function applyProps(instance, newProps, _oldProps) {
16632
16714
  EnableWindow(hwnd2, !newProps.disabled ? 1 : 0);
16633
16715
  }
16634
16716
  if ("hidden" in newProps) {
16635
- gui.ShowWindow(
16717
+ ShowWindow(
16636
16718
  hwnd2,
16637
16719
  newProps.hidden ? 0 : 5
16638
16720
  /* ShowWindowCmd.SHOW */
16639
16721
  );
16640
16722
  }
16641
16723
  if ("visible" in newProps) {
16642
- gui.ShowWindow(
16724
+ ShowWindow(
16643
16725
  hwnd2,
16644
16726
  newProps.visible ? 5 : 0
16645
16727
  /* ShowWindowCmd.HIDE */
@@ -16759,24 +16841,21 @@ function measureTextForHwnd(hwnd2, text) {
16759
16841
  if (hFont)
16760
16842
  SelectObject(hdc, oldFont);
16761
16843
  ReleaseDC(hwnd2, hdc);
16762
- const wr = gui2.GetWindowRect(hwnd2);
16763
- const cr = gui2.GetClientRect(hwnd2);
16764
- if (wr && cr) {
16765
- result.width += wr.right - wr.left - (cr.right - cr.left);
16766
- result.height += wr.bottom - wr.top - (cr.bottom - cr.top);
16844
+ const wr = RECT.alloc();
16845
+ const cr = RECT.alloc();
16846
+ const okWr = GetWindowRect(hwnd2, wr.ptr);
16847
+ const okCr = GetClientRect(hwnd2, cr.ptr);
16848
+ if (okWr && okCr) {
16849
+ const w = RECT.decode(wr), c = RECT.decode(cr);
16850
+ result.width += w.right - w.left - (c.right - c.left);
16851
+ result.height += w.bottom - w.top - (c.bottom - c.top);
16767
16852
  }
16768
16853
  return result;
16769
16854
  }
16770
16855
 
16771
16856
  // _build/lib/react-qw/reconciler.js
16772
- var dpiFont = gui3.CreateSystemDpiFont();
16773
- var scaleFactor = (() => {
16774
- const hdc = GetDC(NULL);
16775
- const dpi = hdc ? GetDeviceCaps(hdc, 88) : 96;
16776
- if (hdc)
16777
- ReleaseDC(NULL, hdc);
16778
- return dpi / 96;
16779
- })();
16857
+ var dpiFont = createSystemDpiFont();
16858
+ var scaleFactor = getScaleFactor();
16780
16859
  var DELAYED_CONTROLS = /* @__PURE__ */ new Set(["SysListView32", "SysTreeView32", "LISTBOX", "COMBOBOX", "msctls_trackbar32", "SysDateTimePick32", "SysLink"]);
16781
16860
  function isDelayedControl(winClass) {
16782
16861
  return DELAYED_CONTROLS.has(winClass);
@@ -16822,11 +16901,12 @@ function runFlexLayout(inst) {
16822
16901
  const visible = children.filter((c) => !c.props.hidden);
16823
16902
  if (visible.length === 0)
16824
16903
  return;
16825
- const rect = gui3.GetClientRect(inst.hwnd);
16826
- if (!rect) {
16904
+ const rcBuf = RECT.alloc();
16905
+ if (!GetClientRect(inst.hwnd, rcBuf.ptr)) {
16827
16906
  console.log("flex: no rect for", inst.hwnd, inst.type);
16828
16907
  return;
16829
16908
  }
16909
+ const rect = RECT.decode(rcBuf);
16830
16910
  const pw = (rect.right - rect.left) / scaleFactor;
16831
16911
  const ph = (rect.bottom - rect.top) / scaleFactor;
16832
16912
  if (pw <= 0 || ph <= 0) {
@@ -17027,7 +17107,7 @@ var hostConfig = {
17027
17107
  },
17028
17108
  hideInstance(instance) {
17029
17109
  if (instance.hwnd !== null)
17030
- gui3.ShowWindow(
17110
+ ShowWindow(
17031
17111
  instance.hwnd,
17032
17112
  0
17033
17113
  /* ShowWindowCmd.HIDE */
@@ -17035,7 +17115,7 @@ var hostConfig = {
17035
17115
  },
17036
17116
  hideTextInstance(instance) {
17037
17117
  if (instance.hwnd !== null)
17038
- gui3.ShowWindow(
17118
+ ShowWindow(
17039
17119
  instance.hwnd,
17040
17120
  0
17041
17121
  /* ShowWindowCmd.HIDE */
@@ -17043,7 +17123,7 @@ var hostConfig = {
17043
17123
  },
17044
17124
  unhideInstance(instance, _props) {
17045
17125
  if (instance.hwnd !== null)
17046
- gui3.ShowWindow(
17126
+ ShowWindow(
17047
17127
  instance.hwnd,
17048
17128
  5
17049
17129
  /* ShowWindowCmd.SHOW */
@@ -17051,7 +17131,7 @@ var hostConfig = {
17051
17131
  },
17052
17132
  unhideTextInstance(instance, _text) {
17053
17133
  if (instance.hwnd !== null)
17054
- gui3.ShowWindow(
17134
+ ShowWindow(
17055
17135
  instance.hwnd,
17056
17136
  5
17057
17137
  /* ShowWindowCmd.SHOW */
@@ -17298,11 +17378,10 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
17298
17378
  if (!h)
17299
17379
  return;
17300
17380
  InvalidateRect(h, NULL, 1);
17301
- const cr = gui6.GetClientRect(h);
17302
- if (cr) {
17303
- const w = cr.right - cr.left;
17304
- const hh = cr.bottom - cr.top;
17305
- gui6.SendMessage(h, 5, 0, hh << 16 | w);
17381
+ const cr = RECT.alloc();
17382
+ if (GetClientRect(h, cr.ptr)) {
17383
+ const { left, top, right, bottom } = RECT.decode(cr);
17384
+ gui6.SendMessage(h, 5, 0, bottom - top << 16 | right - left);
17306
17385
  }
17307
17386
  }, []);
17308
17387
  return (0, import_jsx_runtime4.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
@@ -17363,7 +17442,10 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
17363
17442
  const h = inputRef.current;
17364
17443
  if (!h)
17365
17444
  return;
17366
- const newText = gui7.GetWindowText(h);
17445
+ const cap = GetWindowTextLength(h) + 1;
17446
+ const buf = WCHAR.alloc(cap);
17447
+ GetWindowText(h, buf, cap);
17448
+ const newText = WCHAR.decode(buf);
17367
17449
  if (!isControlled)
17368
17450
  setInternalValue(newText);
17369
17451
  onChange?.(newText);
@@ -17451,6 +17533,49 @@ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
17451
17533
  var import_react9 = __toESM(require_react(), 1);
17452
17534
  import * as gui9 from "gui";
17453
17535
  import * as ffi3 from "ffi";
17536
+
17537
+ // _build/lib/bitmap.js
17538
+ function createBitmapFromPixels(width, height, pixels) {
17539
+ if (width <= 0 || height <= 0)
17540
+ return NULL;
17541
+ const len = width * height * 4;
17542
+ if (pixels.byteLength < len)
17543
+ return NULL;
17544
+ const bi = BITMAPINFOHEADER.encode({
17545
+ biSize: BITMAPINFOHEADER.size,
17546
+ biWidth: width,
17547
+ biHeight: -height,
17548
+ biPlanes: 1,
17549
+ biBitCount: 32
17550
+ });
17551
+ const hbm = CreateDIBSection(NULL, bi.ptr, 0, NULL, NULL, 0);
17552
+ if (!hbm)
17553
+ return NULL;
17554
+ const src = new PtrArrayBuffer(len);
17555
+ new Uint8Array(src).set(new Uint8Array(pixels, 0, len));
17556
+ if (SetDIBits(
17557
+ NULL,
17558
+ hbm,
17559
+ 0,
17560
+ height,
17561
+ src,
17562
+ bi.ptr,
17563
+ 0
17564
+ /* ColorUse.RGB_COLORS */
17565
+ ) !== height) {
17566
+ DeleteObject(hbm);
17567
+ return NULL;
17568
+ }
17569
+ return hbm;
17570
+ }
17571
+
17572
+ // _build/lib/windows/comctl32.js
17573
+ var b3 = (name, sig) => bind("comctl32.dll", name, sig);
17574
+ var ImageListCreate = /* @__PURE__ */ b3("ImageList_Create", "i32 i32 u32 i32 i32 -> <HIMAGELIST>ptr");
17575
+ var ImageListAdd = /* @__PURE__ */ b3("ImageList_Add", "<HIMAGELIST>ptr <HGDIOBJ>ptr <HGDIOBJ>ptr -> i32");
17576
+ var ImageListDestroy = /* @__PURE__ */ b3("ImageList_Destroy", "<HIMAGELIST>ptr -> i32");
17577
+
17578
+ // _build/lib/react-qw/components/ListView.js
17454
17579
  function writeU32(ptr, offset, v) {
17455
17580
  ffi3.writeByte(ptr + offset, v & 255);
17456
17581
  ffi3.writeByte(ptr + offset + 1, v >> 8 & 255);
@@ -17540,7 +17665,7 @@ function resolveCellStyle(columns, data, row, colIndex) {
17540
17665
  }
17541
17666
  function makeLVItem(i, sub, text, image) {
17542
17667
  const textBuf = WCHAR.encode(text);
17543
- const b6 = LVITEMW.encode({
17668
+ const b7 = LVITEMW.encode({
17544
17669
  mask: 1 | (image !== void 0 ? 2 : 0),
17545
17670
  iItem: i,
17546
17671
  iSubItem: sub,
@@ -17557,32 +17682,32 @@ function makeLVItem(i, sub, text, image) {
17557
17682
  piColFmt: 0,
17558
17683
  iGroup: 0
17559
17684
  });
17560
- b6.__textBuf = textBuf;
17561
- return b6;
17685
+ b7.__textBuf = textBuf;
17686
+ return b7;
17562
17687
  }
17563
17688
  var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, data, style, icons, iconSize, getIcon }, ref) {
17564
17689
  const lvRef = (0, import_react9.useRef)(null);
17565
- const iconListRef = (0, import_react9.useRef)(0);
17690
+ const iconListRef = (0, import_react9.useRef)(NULL);
17566
17691
  (0, import_react9.useEffect)(() => {
17567
17692
  const h = lvRef.current;
17568
17693
  if (!h)
17569
17694
  return;
17570
17695
  const il = iconListRef.current;
17571
- iconListRef.current = 0;
17696
+ iconListRef.current = NULL;
17572
17697
  if (il) {
17573
17698
  gui9.SendMessage(h, 4099, 1, 0);
17574
- gui9.ImageListDestroy(il);
17699
+ ImageListDestroy(il);
17575
17700
  }
17576
17701
  if (!icons || icons.length === 0)
17577
17702
  return;
17578
17703
  const size = iconSize ?? 32;
17579
- const img = gui9.ImageListCreate(size, size, 32, icons.length, 1);
17704
+ const img = ImageListCreate(size, size, 32, icons.length, 1);
17580
17705
  if (!img)
17581
17706
  return;
17582
17707
  for (const p of icons) {
17583
- const hbm = gui9.CreateBitmapFromPixels(size, size, p);
17708
+ const hbm = createBitmapFromPixels(size, size, p);
17584
17709
  if (hbm) {
17585
- gui9.ImageListAdd(img, hbm);
17710
+ ImageListAdd(img, hbm, NULL);
17586
17711
  DeleteObject(hbm);
17587
17712
  }
17588
17713
  }
@@ -17763,22 +17888,19 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
17763
17888
  // _build/lib/react-qw/components/ScrollView.js
17764
17889
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
17765
17890
  var import_react12 = __toESM(require_react(), 1);
17766
- import * as gui12 from "gui";
17767
17891
  var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth, contentHeight }, ref) => {
17768
17892
  const svRef = (0, import_react12.useRef)(null);
17769
17893
  const contentRef = (0, import_react12.useRef)(null);
17770
17894
  const scrollXRef = (0, import_react12.useRef)(0);
17771
17895
  const scrollYRef = (0, import_react12.useRef)(0);
17772
17896
  function updateScroll(sv, content) {
17773
- const svRect = gui12.GetClientRect(sv);
17774
- if (!svRect)
17897
+ const svBuf = RECT.alloc();
17898
+ if (!GetClientRect(sv, svBuf.ptr))
17775
17899
  return;
17776
- const svW = svRect.right - svRect.left;
17777
- const svH = svRect.bottom - svRect.top;
17778
- const hdc = GetDC(NULL);
17779
- const scale = hdc ? GetDeviceCaps(hdc, 88) / 96 : 1;
17780
- if (hdc)
17781
- ReleaseDC(NULL, hdc);
17900
+ const { left, top, right, bottom } = RECT.decode(svBuf);
17901
+ const svW = right - left;
17902
+ const svH = bottom - top;
17903
+ const scale = getScaleFactor();
17782
17904
  const natW = Math.round((contentWidth ?? svW / scale) * scale);
17783
17905
  const natH = Math.round((contentHeight ?? svH / scale) * scale);
17784
17906
  scrollXRef.current = Math.max(0, Math.min(scrollXRef.current, natW - svW));
@@ -17795,14 +17917,28 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17795
17917
  );
17796
17918
  forceFlexLayout(content);
17797
17919
  if (natW > svW) {
17798
- gui12.SetScrollInfo(sv, 0, { min: 0, max: natW - 1, page: svW, pos: scrollXRef.current }, true);
17920
+ SetScrollInfo(sv, 0, {
17921
+ cbSize: SCROLLINFO.size,
17922
+ fMask: 1 | 2 | 4,
17923
+ nMin: 0,
17924
+ nMax: natW - 1,
17925
+ nPage: svW,
17926
+ nPos: scrollXRef.current
17927
+ }, 1);
17799
17928
  ShowScrollBar(sv, 0, 1);
17800
17929
  } else {
17801
17930
  scrollXRef.current = 0;
17802
17931
  ShowScrollBar(sv, 0, 0);
17803
17932
  }
17804
17933
  if (natH > svH) {
17805
- gui12.SetScrollInfo(sv, 1, { min: 0, max: natH - 1, page: svH, pos: scrollYRef.current }, true);
17934
+ SetScrollInfo(sv, 1, {
17935
+ cbSize: SCROLLINFO.size,
17936
+ fMask: 1 | 2 | 4,
17937
+ nMin: 0,
17938
+ nMax: natH - 1,
17939
+ nPage: svH,
17940
+ nPos: scrollYRef.current
17941
+ }, 1);
17806
17942
  ShowScrollBar(sv, 1, 1);
17807
17943
  } else {
17808
17944
  scrollYRef.current = 0;
@@ -17832,15 +17968,21 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17832
17968
  1 | 4
17833
17969
  /* SetWindowPosFlag.SWP_NOZORDER */
17834
17970
  );
17835
- gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
17971
+ SetScrollInfo(sv, bar, { cbSize: SCROLLINFO.size, fMask: 4, nPos: newPos }, 1);
17836
17972
  }
17837
17973
  function handleScroll(e, bar) {
17838
17974
  const sv = svRef.current;
17839
17975
  const content = contentRef.current;
17840
17976
  if (!sv || !content)
17841
17977
  return;
17842
- const info = gui12.GetScrollInfo(sv, bar);
17843
- const maxPos = info.max - info.page + 1;
17978
+ const si = SCROLLINFO.encode({
17979
+ cbSize: SCROLLINFO.size,
17980
+ fMask: 23
17981
+ /* ScrollInfoFlag.ALL */
17982
+ });
17983
+ GetScrollInfo(sv, bar, si.ptr);
17984
+ const info = SCROLLINFO.decode(si);
17985
+ const maxPos = info.nMax - info.nPage + 1;
17844
17986
  const code = e.wParam & 65535;
17845
17987
  const ref_ = bar === 1 ? scrollYRef : scrollXRef;
17846
17988
  let newPos = ref_.current;
@@ -17851,9 +17993,9 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17851
17993
  else if (code === 1)
17852
17994
  newPos += 20;
17853
17995
  else if (code === 2)
17854
- newPos -= info.page;
17996
+ newPos -= info.nPage;
17855
17997
  else if (code === 3)
17856
- newPos += info.page;
17998
+ newPos += info.nPage;
17857
17999
  else
17858
18000
  return;
17859
18001
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17873,8 +18015,14 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17873
18015
  if (!isHorz && contentHeight === void 0)
17874
18016
  return;
17875
18017
  const bar = isHorz ? 0 : 1;
17876
- const info = gui12.GetScrollInfo(sv, bar);
17877
- const maxPos = info.max - info.page + 1;
18018
+ const si = SCROLLINFO.encode({
18019
+ cbSize: SCROLLINFO.size,
18020
+ fMask: 23
18021
+ /* ScrollInfoFlag.ALL */
18022
+ });
18023
+ GetScrollInfo(sv, bar, si.ptr);
18024
+ const info = SCROLLINFO.decode(si);
18025
+ const maxPos = info.nMax - info.nPage + 1;
17878
18026
  const ref_ = isHorz ? scrollXRef : scrollYRef;
17879
18027
  let newPos = ref_.current + dy;
17880
18028
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17922,7 +18070,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17922
18070
  // _build/lib/react-qw/components/Slider.js
17923
18071
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
17924
18072
  var import_react13 = __toESM(require_react(), 1);
17925
- import * as gui13 from "gui";
18073
+ import * as gui12 from "gui";
17926
18074
  var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 100, vertical = false, disabled, style }, ref) => {
17927
18075
  const wrapperRef = (0, import_react13.useRef)(null);
17928
18076
  const sliderRef = (0, import_react13.useRef)(null);
@@ -17931,14 +18079,14 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17931
18079
  if (!h)
17932
18080
  return;
17933
18081
  const lParam = min & 65535 | (max & 65535) << 16;
17934
- gui13.SendMessage(h, 1030, 0, lParam);
17935
- gui13.SendMessage(h, 1029, 1, value);
18082
+ gui12.SendMessage(h, 1030, 0, lParam);
18083
+ gui12.SendMessage(h, 1029, 1, value);
17936
18084
  }, [min, max]);
17937
18085
  (0, import_react13.useEffect)(() => {
17938
18086
  const h = sliderRef.current;
17939
18087
  if (!h)
17940
18088
  return;
17941
- gui13.SendMessage(h, 1029, 1, value);
18089
+ gui12.SendMessage(h, 1029, 1, value);
17942
18090
  }, [value]);
17943
18091
  const tbStyle = 268435456 | 65536 | 1 | (vertical ? 2 : 0);
17944
18092
  return (0, import_jsx_runtime12.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style, ref: (h) => {
@@ -17955,7 +18103,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17955
18103
  const h = sliderRef.current;
17956
18104
  if (!h)
17957
18105
  return 0;
17958
- const pos = gui13.SendMessage(h, 1024, 0, 0);
18106
+ const pos = gui12.SendMessage(h, 1024, 0, 0);
17959
18107
  onChange?.(pos);
17960
18108
  return 0;
17961
18109
  }
@@ -17968,7 +18116,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17968
18116
  // _build/lib/react-qw/components/Tab.js
17969
18117
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
17970
18118
  var import_react14 = __toESM(require_react(), 1);
17971
- import * as gui14 from "gui";
18119
+ import * as gui13 from "gui";
17972
18120
  var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
17973
18121
  const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
17974
18122
  const isControlled = controlledIndex !== void 0;
@@ -17978,7 +18126,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
17978
18126
  const h = tabHwnd.current;
17979
18127
  if (!h)
17980
18128
  return;
17981
- gui14.SendMessage(h, 4873, 0, 0);
18129
+ gui13.SendMessage(h, 4873, 0, 0);
17982
18130
  for (let i = 0; i < tabs.length; i++) {
17983
18131
  const titleBuf = WCHAR.encode(tabs[i].title);
17984
18132
  const tci = TCITEMW.encode({
@@ -17991,14 +18139,14 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
17991
18139
  lParam: 0
17992
18140
  });
17993
18141
  const tciPtr = tci.ptr;
17994
- gui14.SendMessage(h, 4926, i, tciPtr);
18142
+ gui13.SendMessage(h, 4926, i, tciPtr);
17995
18143
  }
17996
- gui14.SendMessage(h, 4876, sel, 0);
18144
+ gui13.SendMessage(h, 4876, sel, 0);
17997
18145
  }, [tabs]);
17998
18146
  (0, import_react14.useEffect)(() => {
17999
18147
  const h = tabHwnd.current;
18000
18148
  if (h)
18001
- gui14.SendMessage(h, 4876, sel, 0);
18149
+ gui13.SendMessage(h, 4876, sel, 0);
18002
18150
  }, [sel]);
18003
18151
  return (0, import_jsx_runtime13.jsxs)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18004
18152
  if (e.msg === 78) {
@@ -18007,7 +18155,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18007
18155
  return;
18008
18156
  const code = nmCode(e.lParam);
18009
18157
  if (code === -552 || code === -2) {
18010
- const newSel = gui14.SendMessage(h, 4875, 0, 0);
18158
+ const newSel = gui13.SendMessage(h, 4875, 0, 0);
18011
18159
  if (newSel !== sel) {
18012
18160
  if (!isControlled)
18013
18161
  setInternalIndex(newSel);
@@ -18020,12 +18168,12 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18020
18168
 
18021
18169
  // _build/lib/react-qw/components/Tooltip.js
18022
18170
  var import_react15 = __toESM(require_react(), 1);
18023
- import * as gui15 from "gui";
18171
+ import * as gui14 from "gui";
18024
18172
 
18025
18173
  // _build/lib/react-qw/components/TreeView.js
18026
18174
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
18027
18175
  var import_react16 = __toESM(require_react(), 1);
18028
- import * as gui16 from "gui";
18176
+ import * as gui15 from "gui";
18029
18177
  function buildTvItem(textPtr, cChildren) {
18030
18178
  let mask = 1;
18031
18179
  if (cChildren > 0)
@@ -18050,20 +18198,20 @@ function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
18050
18198
  const itemBuf = buildTvItem(textBuf.ptr, cChildren);
18051
18199
  const item = TVITEM.decode(itemBuf);
18052
18200
  const tvins = TVINSERTSTRUCT.encode({ hParent: parentHandle, hInsertAfter: -65536, item });
18053
- const hItem = gui16.SendMessage(hTree, 4402, 0, tvins.ptr);
18201
+ const hItem = gui15.SendMessage(hTree, 4402, 0, tvins.ptr);
18054
18202
  hItemMap.set(hItem, node);
18055
18203
  if (node.key)
18056
18204
  keyMap.set(node.key, hItem);
18057
18205
  if (node.children && node.children.length > 0) {
18058
18206
  insertItems(hTree, node.children, hItem, hItemMap, keyMap);
18059
- gui16.SendMessage(hTree, 4354, 2, hItem);
18207
+ gui15.SendMessage(hTree, 4354, 2, hItem);
18060
18208
  }
18061
18209
  }
18062
18210
  }
18063
18211
  function deleteAllItems(hTree) {
18064
- const n = gui16.SendMessage(hTree, 4357, 0, 0);
18212
+ const n = gui15.SendMessage(hTree, 4357, 0, 0);
18065
18213
  if (n > 0)
18066
- gui16.SendMessage(
18214
+ gui15.SendMessage(
18067
18215
  hTree,
18068
18216
  4353,
18069
18217
  1,
@@ -18095,7 +18243,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18095
18243
  const h = tvRef.current;
18096
18244
  if (!h)
18097
18245
  return;
18098
- gui16.SendMessage(
18246
+ gui15.SendMessage(
18099
18247
  h,
18100
18248
  4396,
18101
18249
  0,
@@ -18111,7 +18259,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18111
18259
  return;
18112
18260
  const hItem = keyMapRef.current.get(selKey);
18113
18261
  if (hItem !== void 0)
18114
- gui16.SendMessage(h, 4363, 9, hItem);
18262
+ gui15.SendMessage(h, 4363, 9, hItem);
18115
18263
  }, [selKey]);
18116
18264
  return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18117
18265
  if (e.msg === 78) {
@@ -18120,7 +18268,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18120
18268
  const h = tvRef.current;
18121
18269
  if (!h)
18122
18270
  return;
18123
- const hCaret = gui16.SendMessage(h, 4362, 9, 0);
18271
+ const hCaret = gui15.SendMessage(h, 4362, 9, 0);
18124
18272
  const node = hItemMapRef.current.get(hCaret) ?? null;
18125
18273
  const key = node?.key ?? null;
18126
18274
  if (!isControlled)
@@ -18138,24 +18286,24 @@ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
18138
18286
  var import_react17 = __toESM(require_react(), 1);
18139
18287
 
18140
18288
  // _build/lib/windows/comdlg32.js
18141
- var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
18142
- var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18289
+ var b4 = (name, sig) => bind("comdlg32.dll", name, sig);
18290
+ var GetOpenFileName = /* @__PURE__ */ b4("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18143
18291
 
18144
18292
  // _build/lib/windows/shell32.js
18145
- var b4 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18146
- var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18147
- var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18293
+ var b5 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18294
+ var SHBrowseForFolder = /* @__PURE__ */ b5("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18295
+ var SHGetPathFromIDList = /* @__PURE__ */ b5("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18148
18296
  var Shell_NotifyIconGetRect = (() => {
18149
18297
  try {
18150
- return b4("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18298
+ return b5("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18151
18299
  } catch {
18152
18300
  return null;
18153
18301
  }
18154
18302
  })();
18155
18303
 
18156
18304
  // _build/lib/windows/ole32.js
18157
- var b5 = (name, sig) => bind("ole32.dll", name, sig);
18158
- var CoTaskMemFree = /* @__PURE__ */ b5("CoTaskMemFree", "<>ptr -> void");
18305
+ var b6 = (name, sig) => bind("ole32.dll", name, sig);
18306
+ var CoTaskMemFree = /* @__PURE__ */ b6("CoTaskMemFree", "<>ptr -> void");
18159
18307
 
18160
18308
  // _build/lib/react-qw/components/PathPicker.js
18161
18309
  function openFileDialog(owner, filter, title, multiple) {
@@ -18250,7 +18398,7 @@ var rootMap = /* @__PURE__ */ new Map();
18250
18398
  function ensureDefaultClass() {
18251
18399
  if (defaultClassRegistered)
18252
18400
  return DEFAULT_CLASS;
18253
- gui17.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18401
+ gui16.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18254
18402
  const entry = rootMap.get(hwnd2);
18255
18403
  if (msg === 2 && entry) {
18256
18404
  rootMap.delete(hwnd2);
@@ -18276,15 +18424,27 @@ function createRoot(container) {
18276
18424
  const ws = (cfg.ws ?? 0) | 13565952;
18277
18425
  const w = (cfg.width ?? 800) * scaleFactor;
18278
18426
  const h = (cfg.height ?? 600) * scaleFactor;
18279
- const [sw, sh] = [GetSystemMetrics(0), GetSystemMetrics(1)];
18427
+ const [sw, sh] = [GetSystemMetrics(
18428
+ 0
18429
+ /* SysMetrics.CXSCREEN */
18430
+ ), GetSystemMetrics(
18431
+ 1
18432
+ /* SysMetrics.CYSCREEN */
18433
+ )];
18280
18434
  const x = cfg.x === void 0 ? (sw - w) / 2 | 0 : cfg.x === -2147483648 ? -2147483648 : cfg.x * scaleFactor;
18281
18435
  const y = cfg.y === void 0 ? (sh - h) / 2 | 0 : cfg.y === -2147483648 ? -2147483648 : cfg.y * scaleFactor;
18282
- const hwin = gui17.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18436
+ const hwin = gui16.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18283
18437
  if (!hwin)
18284
18438
  throw new Error("CreateWindow failed");
18285
18439
  hwnd2 = hwin;
18286
- if (!cfg.noShowWindow)
18287
- gui17.ShowWindow(hwnd2);
18440
+ if (!cfg.noShowWindow) {
18441
+ ShowWindow(
18442
+ hwnd2,
18443
+ 1
18444
+ /* ShowWindowCmd.SHOWNORMAL */
18445
+ );
18446
+ UpdateWindow(hwnd2);
18447
+ }
18288
18448
  } else {
18289
18449
  hwnd2 = container;
18290
18450
  }
@@ -18318,20 +18478,23 @@ function printWindowTree(hwnd2, indent = 0) {
18318
18478
  const prefix = " ".repeat(indent);
18319
18479
  let text = "(no text)";
18320
18480
  try {
18321
- text = gui18.GetWindowText(hwnd2) || "(no text)";
18481
+ const cap = GetWindowTextLength(hwnd2) + 1;
18482
+ const buf = WCHAR.alloc(cap);
18483
+ GetWindowText(hwnd2, buf, cap);
18484
+ text = WCHAR.decode(buf) || "(no text)";
18322
18485
  } catch (e) {
18323
18486
  text = "(error)";
18324
18487
  }
18325
- const isWindow = gui18.IsWindow(hwnd2);
18488
+ const isWindow = IsWindow(hwnd2);
18326
18489
  console.log(`${prefix}hwnd=${hwnd2}, text="${text}", IsWindow=${isWindow}`);
18327
- let child = gui18.GetWindow(
18490
+ let child = GetWindow(
18328
18491
  hwnd2,
18329
18492
  5
18330
18493
  /* GetWindowCmd.CHILD */
18331
18494
  );
18332
18495
  while (child) {
18333
18496
  printWindowTree(child, indent + 1);
18334
- child = gui18.GetWindow(
18497
+ child = GetWindow(
18335
18498
  child,
18336
18499
  2
18337
18500
  /* GetWindowCmd.NEXT */
@@ -18345,14 +18508,14 @@ function mockSetInterval(func, delay) {
18345
18508
  }
18346
18509
  os5.setTimeout(loop, delay);
18347
18510
  }
18348
- gui18.RegisterClass("ComplexTest", (hwnd2, msg, wParam, lParam) => {
18511
+ gui17.RegisterClass("ComplexTest", (hwnd2, msg, wParam, lParam) => {
18349
18512
  if (!hwnd2)
18350
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18513
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18351
18514
  if (msg === 2) {
18352
- gui18.PostQuitMessage(0);
18515
+ PostQuitMessage(0);
18353
18516
  return 0;
18354
18517
  }
18355
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18518
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18356
18519
  });
18357
18520
  var WM_LBUTTONUP = 514;
18358
18521
  function Counter({ label, initial = 0 }) {
@@ -18380,7 +18543,10 @@ function InputField() {
18380
18543
  const editRef = (0, import_react18.useRef)(null);
18381
18544
  return (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: 1073741824 | 268435456, style: { flexDirection: "column", gap: 4 }, children: [(0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: 1073741824 | 268435456, style: { flexDirection: "row", gap: 10, alignItems: "center" }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "EDIT", text: "type here", ws: 1073741824 | 268435456 | 8388608, style: { width: 160, height: 24 }, ref: editRef }), (0, import_jsx_runtime16.jsx)("w", { type: "BUTTON", text: "Read", ws: 1073741824 | 268435456, style: { width: 60, height: 24 }, onEvent: (e) => {
18382
18545
  if (e.msg === WM_LBUTTONUP && editRef.current) {
18383
- setText(gui18.GetWindowText(editRef.current));
18546
+ const cap = GetWindowTextLength(editRef.current) + 1;
18547
+ const buf = WCHAR.alloc(cap);
18548
+ GetWindowText(editRef.current, buf, cap);
18549
+ setText(WCHAR.decode(buf));
18384
18550
  }
18385
18551
  } })] }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: `Input: ${text}`, ws: 1073741824 | 268435456 | 8388608, style: { width: 300, height: 22 } })] });
18386
18552
  }
@@ -18390,7 +18556,10 @@ function CounterWithInput() {
18390
18556
  const inputRef = (0, import_react18.useRef)(null);
18391
18557
  return (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: 1073741824 | 268435456, style: { flexDirection: "row", gap: 10, alignItems: "center" }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "EDIT", text: "0", ws: 1073741824 | 268435456 | 8388608, style: { width: 60, height: 24 }, ref: inputRef }), (0, import_jsx_runtime16.jsx)("w", { type: "BUTTON", text: "Start", ws: 1073741824 | 268435456, style: { width: 60, height: 24 }, onEvent: (e) => {
18392
18558
  if (e.msg === WM_LBUTTONUP && inputRef.current) {
18393
- const val = parseInt(gui18.GetWindowText(inputRef.current) || "0", 10);
18559
+ const cap = GetWindowTextLength(inputRef.current) + 1;
18560
+ const buf = WCHAR.alloc(cap);
18561
+ GetWindowText(inputRef.current, buf, cap);
18562
+ const val = parseInt(WCHAR.decode(buf) || "0", 10);
18394
18563
  setDisplayValue(val);
18395
18564
  setCount(0);
18396
18565
  }
@@ -18414,7 +18583,10 @@ function ControlledInput() {
18414
18583
  const [value, setValue] = (0, import_react18.useState)("");
18415
18584
  return (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: 1073741824 | 268435456, style: { flexDirection: "column", gap: 4 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "EDIT", text: value, ws: 1073741824 | 268435456 | 8388608, style: { width: 200, height: 24 }, onEvent: (e) => {
18416
18585
  if (e.msg === 258) {
18417
- setValue(gui18.GetWindowText(e.hwnd));
18586
+ const cap = GetWindowTextLength(e.hwnd) + 1;
18587
+ const buf = WCHAR.alloc(cap);
18588
+ GetWindowText(e.hwnd, buf, cap);
18589
+ setValue(WCHAR.decode(buf));
18418
18590
  }
18419
18591
  } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: `Controlled: "${value}"`, ws: 1073741824 | 268435456 | 8388608, style: { width: 300, height: 22 } })] });
18420
18592
  }
@@ -18433,9 +18605,13 @@ function App() {
18433
18605
  }
18434
18606
  } }), showExtra && (0, import_jsx_runtime16.jsx)(Counter, { label: "Extra", initial: 100 })] }), showNested && (0, import_jsx_runtime16.jsx)(NestedButtons, {}), (0, import_jsx_runtime16.jsx)(InputField, {}), (0, import_jsx_runtime16.jsx)(CounterWithInput, {}), (0, import_jsx_runtime16.jsx)(ControlledInput, {}), (0, import_jsx_runtime16.jsx)(EffectLogger, {})] });
18435
18607
  }
18436
- var hwnd = gui18.CreateWindow("ComplexTest", "Complex React Test", 13565952, 100, 100, 520, 480, null, null);
18608
+ var hwnd = gui17.CreateWindow("ComplexTest", "Complex React Test", 13565952, 100, 100, 520, 480, null, null);
18437
18609
  if (hwnd) {
18438
- gui18.ShowWindow(hwnd);
18610
+ ShowWindow(
18611
+ hwnd,
18612
+ 1
18613
+ /* ShowWindowCmd.SHOWNORMAL */
18614
+ );
18439
18615
  render((0, import_jsx_runtime16.jsx)(App, {}), hwnd);
18440
18616
  mockSetInterval(() => {
18441
18617
  console.log("\n=== Window Tree ===");