quickwin 2.3.0 → 3.0.0

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 (99) hide show
  1. package/README.en.md +1 -2
  2. package/README.md +1 -2
  3. package/constants.ts +22 -0
  4. package/enum_map.d.ts +4 -0
  5. package/examples/PdfCanvas.js +1 -1
  6. package/examples/PdfCanvas.tsx +2 -2
  7. package/examples/execd/main.js +491 -217
  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/bitmap.js +40 -0
  24. package/lib/bitmap.ts +39 -0
  25. package/lib/certs.js +31 -3
  26. package/lib/certs.ts +32 -3
  27. package/lib/dpi.js +30 -0
  28. package/lib/dpi.ts +31 -0
  29. package/lib/dumpRects.js +14 -7
  30. package/lib/dumpRects.ts +14 -6
  31. package/lib/ffi/bind.js +5 -4
  32. package/lib/ffi/bind.ts +9 -8
  33. package/lib/http-server.js +50 -25
  34. package/lib/http-server.ts +51 -23
  35. package/lib/react-qw/components/DateTimePicker.js +6 -7
  36. package/lib/react-qw/components/Input.js +5 -1
  37. package/lib/react-qw/components/ListView.js +8 -6
  38. package/lib/react-qw/components/ScrollView.js +28 -22
  39. package/lib/react-qw/index.js +7 -5
  40. package/lib/react-qw/index.ts +5 -5
  41. package/lib/react-qw/props.js +3 -3
  42. package/lib/react-qw/props.ts +3 -3
  43. package/lib/react-qw/reconciler.js +12 -17
  44. package/lib/react-qw/reconciler.ts +12 -16
  45. package/lib/text-measure.js +9 -6
  46. package/lib/text-measure.ts +9 -6
  47. package/lib/windows/comctl32.js +3 -2
  48. package/lib/windows/comctl32.ts +3 -2
  49. package/lib/windows/gdi32.js +28 -6
  50. package/lib/windows/gdi32.ts +30 -6
  51. package/lib/windows/kernel32.js +9 -0
  52. package/lib/windows/kernel32.ts +9 -0
  53. package/lib/windows/shell32.js +11 -2
  54. package/lib/windows/shell32.ts +13 -2
  55. package/lib/windows/structs.js +51 -0
  56. package/lib/windows/structs.ts +55 -0
  57. package/lib/windows/user32.js +6 -5
  58. package/lib/windows/user32.ts +6 -5
  59. package/main.js +13 -5
  60. package/package.json +2 -2
  61. package/quickwin.d.ts +13 -115
  62. package/qwin-nowasm-x86.exe +0 -0
  63. package/qwin-nowasm.exe +0 -0
  64. package/qwin-x86.exe +0 -0
  65. package/qwin.exe +0 -0
  66. package/test/bench_ffi_callraw.js +3 -4
  67. package/test/bench_ffi_callraw.ts +3 -4
  68. package/test/debug/mupdf_debug.js +4 -22
  69. package/test/debug/wasm_export_debug.js +2 -12
  70. package/test/debug/wasm_names.js +3 -13
  71. package/test/example.pdf +0 -0
  72. package/test/mupdf-cdn.js +40 -0
  73. package/test/mupdf-cdn.ts +43 -0
  74. package/test/test_ffi.js +8 -9
  75. package/test/test_ffi.ts +8 -9
  76. package/test/test_ffi_abi.js +6 -6
  77. package/test/test_ffi_abi.ts +8 -8
  78. package/test/test_ffi_windows.js +82 -11
  79. package/test/test_ffi_windows.ts +85 -11
  80. package/test/test_gdi_draw.js +3 -3
  81. package/test/test_gdi_draw.ts +4 -4
  82. package/test/test_mupdf_render.js +4 -22
  83. package/test/test_mupdf_render.ts +4 -23
  84. package/test/test_mupdf_twice.js +4 -19
  85. package/test/test_mupdf_twice.ts +4 -20
  86. package/test/test_mupdf_wasm.js +10 -4
  87. package/test/test_mupdf_wasm.ts +6 -4
  88. package/test/test_react_complex.js +316 -140
  89. package/test/test_react_counter.js +295 -133
  90. package/test/test_react_flex.js +297 -138
  91. package/test/test_react_hidden.js +296 -134
  92. package/test/test_react_listview_link.js +288 -131
  93. package/test/test_react_notify.js +290 -133
  94. package/test/test_react_render.js +295 -133
  95. package/vendor/mupdf-wasm/mupdf-wasm.d.ts +0 -571
  96. package/vendor/mupdf-wasm/mupdf-wasm.js +0 -2749
  97. package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
  98. package/vendor/mupdf-wasm/mupdf.d.ts +0 -939
  99. 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,10 +15357,10 @@ 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
 
15362
15362
  // _build/lib/react-qw/index.js
15363
- import * as gui17 from "gui";
15363
+ import * as gui16 from "gui";
15364
15364
 
15365
15365
  // _build/lib/windows/user32.js
15366
15366
  import * as os3 from "os";
@@ -15369,7 +15369,6 @@ import * as os3 from "os";
15369
15369
  import * as ffi from "ffi";
15370
15370
  import * as os2 from "os";
15371
15371
  import * as std from "std";
15372
- import * as win from "win";
15373
15372
 
15374
15373
  // _build/lib/text-codec.js
15375
15374
  var _labelMap = {
@@ -15391,19 +15390,19 @@ function _normalizeLabel(label) {
15391
15390
  function _decodeUTF8(buf, fatal) {
15392
15391
  let out = "";
15393
15392
  for (let i = 0; i < buf.length; ) {
15394
- const b6 = buf[i++];
15395
- if (b6 < 128) {
15396
- out += String.fromCharCode(b6);
15393
+ const b7 = buf[i++];
15394
+ if (b7 < 128) {
15395
+ out += String.fromCharCode(b7);
15397
15396
  continue;
15398
15397
  }
15399
- if (b6 < 192) {
15398
+ if (b7 < 192) {
15400
15399
  out += fatal ? (() => {
15401
15400
  throw new TypeError("unexpected continuation byte");
15402
15401
  })() : "\uFFFD";
15403
15402
  continue;
15404
15403
  }
15405
15404
  let c, min;
15406
- if (b6 < 224) {
15405
+ if (b7 < 224) {
15407
15406
  if (i >= buf.length) {
15408
15407
  out += fatal ? (() => {
15409
15408
  throw new TypeError("incomplete utf-8");
@@ -15415,9 +15414,9 @@ function _decodeUTF8(buf, fatal) {
15415
15414
  out += "\uFFFD";
15416
15415
  continue;
15417
15416
  }
15418
- c = (b6 & 31) << 6 | b22 & 63;
15417
+ c = (b7 & 31) << 6 | b22 & 63;
15419
15418
  min = 128;
15420
- } else if (b6 < 240) {
15419
+ } else if (b7 < 240) {
15421
15420
  if (i + 1 >= buf.length) {
15422
15421
  out += fatal ? (() => {
15423
15422
  throw new TypeError("incomplete utf-8");
@@ -15430,9 +15429,9 @@ function _decodeUTF8(buf, fatal) {
15430
15429
  out += "\uFFFD";
15431
15430
  continue;
15432
15431
  }
15433
- c = (b6 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15432
+ c = (b7 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
15434
15433
  min = 2048;
15435
- } else if (b6 < 248) {
15434
+ } else if (b7 < 248) {
15436
15435
  if (i + 2 >= buf.length) {
15437
15436
  out += fatal ? (() => {
15438
15437
  throw new TypeError("incomplete utf-8");
@@ -15446,7 +15445,7 @@ function _decodeUTF8(buf, fatal) {
15446
15445
  out += "\uFFFD";
15447
15446
  continue;
15448
15447
  }
15449
- c = (b6 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15448
+ c = (b7 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
15450
15449
  min = 65536;
15451
15450
  } else {
15452
15451
  out += fatal ? (() => {
@@ -15750,7 +15749,7 @@ function loadDll(dll) {
15750
15749
  const cached = _dllCache.get(dll);
15751
15750
  if (cached !== void 0)
15752
15751
  return cached;
15753
- const loaded = win.LoadLibrary(dll);
15752
+ const loaded = ffi.LoadLibrary(dll);
15754
15753
  if (!loaded)
15755
15754
  throw new Error(`ffi-bind: LoadLibrary("${dll}") failed`);
15756
15755
  _dllCache.set(dll, loaded);
@@ -15960,7 +15959,7 @@ var BYTE = {
15960
15959
  };
15961
15960
  var builtinCodecs = { WCHAR, BYTE };
15962
15961
  function bind(dll, name, sig, encoders, decoders) {
15963
- const proc = win.GetProcAddress(loadDll(dll), name);
15962
+ const proc = ffi.GetProcAddress(loadDll(dll), name);
15964
15963
  if (!proc)
15965
15964
  throw new Error(`ffi-bind: proc "${name}" not found in ${dll}`);
15966
15965
  const effDec = decoders ?? encoders;
@@ -16000,13 +15999,13 @@ function lower(v) {
16000
15999
  type: { tag: "array", elementType: el.type, elementSize: el.size }
16001
16000
  };
16002
16001
  }
16003
- const b6 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16004
- if (b6) {
16005
- const rawUnit = b6[1];
16002
+ const b7 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
16003
+ if (b7) {
16004
+ const rawUnit = b7[1];
16006
16005
  const unit = normToken(rawUnit);
16007
16006
  if (!isCNumberToken(unit) || unit === "f32" || unit === "f64")
16008
16007
  throw new Error(`ffi-struct: bitfield unit must be an integer type, got "${rawUnit}"`);
16009
- const width = Number(b6[2]);
16008
+ const width = Number(b7[2]);
16010
16009
  const s2 = SizeAlign[unit];
16011
16010
  const cap = s2 * 8;
16012
16011
  if (!Number.isInteger(width) || width < 1)
@@ -16322,10 +16321,10 @@ function buildDecl(kind, member, pack) {
16322
16321
  decl[k] = v;
16323
16322
  return decl;
16324
16323
  }
16325
- function struct(a, b6, c) {
16324
+ function struct(a, b7, c) {
16326
16325
  const isNamed = typeof a === "string";
16327
- const raw = isNamed ? b6 : a;
16328
- const opts = isNamed ? c : b6;
16326
+ const raw = isNamed ? b7 : a;
16327
+ const opts = isNamed ? c : b7;
16329
16328
  return createStruct(buildDecl("struct", raw, opts?.pack));
16330
16329
  }
16331
16330
 
@@ -16350,6 +16349,17 @@ var SIZE_DECL = {
16350
16349
  cy: "i32"
16351
16350
  };
16352
16351
  var SIZE = /* @__PURE__ */ struct("SIZE", SIZE_DECL);
16352
+ var SCROLLINFO_DECL = {
16353
+ "#": "struct",
16354
+ cbSize: "u32",
16355
+ fMask: "u32",
16356
+ nMin: "i32",
16357
+ nMax: "i32",
16358
+ nPage: "u32",
16359
+ nPos: "i32",
16360
+ nTrackPos: "i32"
16361
+ };
16362
+ var SCROLLINFO = /* @__PURE__ */ struct("SCROLLINFO", SCROLLINFO_DECL);
16353
16363
  var LOGFONTW_DECL = {
16354
16364
  "#": "struct",
16355
16365
  lfHeight: "i32",
@@ -16368,6 +16378,41 @@ var LOGFONTW_DECL = {
16368
16378
  lfFaceName: "u16[32]@utf-16le"
16369
16379
  };
16370
16380
  var LOGFONTW = /* @__PURE__ */ struct("LOGFONTW", LOGFONTW_DECL);
16381
+ var NONCLIENTMETRICSW_DECL = {
16382
+ "#": "struct",
16383
+ cbSize: "u32",
16384
+ iBorderWidth: "i32",
16385
+ iScrollWidth: "i32",
16386
+ iScrollHeight: "i32",
16387
+ iCaptionWidth: "i32",
16388
+ iCaptionHeight: "i32",
16389
+ lfCaptionFont: LOGFONTW_DECL,
16390
+ iSmCaptionWidth: "i32",
16391
+ iSmCaptionHeight: "i32",
16392
+ lfSmCaptionFont: LOGFONTW_DECL,
16393
+ iMenuWidth: "i32",
16394
+ iMenuHeight: "i32",
16395
+ lfMenuFont: LOGFONTW_DECL,
16396
+ lfStatusFont: LOGFONTW_DECL,
16397
+ lfMessageFont: LOGFONTW_DECL,
16398
+ iPaddedBorderWidth: "i32"
16399
+ };
16400
+ var NONCLIENTMETRICSW = /* @__PURE__ */ struct("NONCLIENTMETRICSW", NONCLIENTMETRICSW_DECL);
16401
+ var BITMAPINFOHEADER_DECL = {
16402
+ "#": "struct",
16403
+ biSize: "u32",
16404
+ biWidth: "i32",
16405
+ biHeight: "i32",
16406
+ biPlanes: "u16",
16407
+ biBitCount: "u16",
16408
+ biCompression: "u32",
16409
+ biSizeImage: "u32",
16410
+ biXPelsPerMeter: "i32",
16411
+ biYPelsPerMeter: "i32",
16412
+ biClrUsed: "u32",
16413
+ biClrImportant: "u32"
16414
+ };
16415
+ var BITMAPINFOHEADER = /* @__PURE__ */ struct("BITMAPINFOHEADER", BITMAPINFOHEADER_DECL);
16371
16416
  var OPENFILENAMEW_DECL = {
16372
16417
  "#": "struct",
16373
16418
  lStructSize: "u32",
@@ -16588,24 +16633,34 @@ var NOTIFYICONIDENTIFIER = /* @__PURE__ */ struct("NOTIFYICONIDENTIFIER", NOTIFY
16588
16633
  var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
16589
16634
  var _bProbe = b("GetDesktopWindow", " -> <HWND>ptr");
16590
16635
  var LONG_PTR_SYM = os3.arch === "x64" ? "PtrW" : "W";
16636
+ var ShowWindow = /* @__PURE__ */ b("ShowWindow", "<HWND>ptr i32@ShowWindowCmd -> i32");
16591
16637
  var SetWindowPos = /* @__PURE__ */ b("SetWindowPos", "<HWND>ptr <>ptr@SetWindowPosHwnd i32 i32 i32 i32 u32 -> i32");
16638
+ var GetWindowRect = /* @__PURE__ */ b("GetWindowRect", "<HWND>ptr <RECT>ptr -> i32");
16639
+ var GetClientRect = /* @__PURE__ */ b("GetClientRect", "<HWND>ptr <RECT>ptr -> i32");
16640
+ var GetWindowText = /* @__PURE__ */ b("GetWindowTextW", "<HWND>ptr <BYTE>ptr i32 -> i32");
16592
16641
  var SetWindowText = /* @__PURE__ */ b("SetWindowTextW", "<HWND>ptr <WCHAR>ptr -> i32");
16642
+ var GetWindowTextLength = /* @__PURE__ */ b("GetWindowTextLengthW", "<HWND>ptr -> i32");
16593
16643
  var GetWindowLongPtr = /* @__PURE__ */ b("GetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp -> <>ptr");
16594
16644
  var SetWindowLongPtr = /* @__PURE__ */ b("SetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp <>ptr -> <>ptr");
16595
16645
  var EnableWindow = /* @__PURE__ */ b("EnableWindow", "<HWND>ptr i32 -> i32");
16596
16646
  var SetParent = /* @__PURE__ */ b("SetParent", "<HWND>ptr <HWND>ptr -> <HWND>ptr");
16647
+ var PostQuitMessage = /* @__PURE__ */ b("PostQuitMessage", "i32 -> void");
16597
16648
  var DefWindowProc = /* @__PURE__ */ b("DefWindowProcW", "<HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16598
16649
  var CallWindowProc = /* @__PURE__ */ b("CallWindowProcW", "<>ptr <HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
16599
16650
  var GetDC = /* @__PURE__ */ b("GetDC", "<HWND>ptr -> <HDC>ptr");
16600
16651
  var ReleaseDC = /* @__PURE__ */ b("ReleaseDC", "<HWND>ptr <HDC>ptr! -> i32");
16601
16652
  var DrawText = /* @__PURE__ */ b("DrawTextW", "<HDC>ptr! <WCHAR>ptr i32 <RECT>ptr i32 -> i32");
16602
16653
  var InvalidateRect = /* @__PURE__ */ b("InvalidateRect", "<HWND>ptr <RECT>ptr i32 -> i32", { RECT });
16654
+ var UpdateWindow = /* @__PURE__ */ b("UpdateWindow", "<HWND>ptr -> i32");
16603
16655
  var SetCursor = /* @__PURE__ */ b("SetCursor", "<HCURSOR>ptr -> <HCURSOR>ptr");
16604
16656
  var LoadCursor = /* @__PURE__ */ b("LoadCursorW", "<HMODULE>ptr <>ptr -> <HCURSOR>ptr");
16605
16657
  var GetCursorPos = /* @__PURE__ */ b("GetCursorPos", "<POINT>ptr -> i32");
16606
16658
  var ScreenToClient = /* @__PURE__ */ b("ScreenToClient", "<HWND>ptr <POINT>ptr -> i32");
16659
+ var SetScrollInfo = /* @__PURE__ */ b("SetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr i32 -> i32", { SCROLLINFO });
16660
+ var GetScrollInfo = /* @__PURE__ */ b("GetScrollInfo", "<HWND>ptr u32 <SCROLLINFO>ptr -> i32");
16607
16661
  var ShowScrollBar = /* @__PURE__ */ b("ShowScrollBar", "<HWND>ptr u32 i32 -> i32");
16608
16662
  var GetSystemMetrics = /* @__PURE__ */ b("GetSystemMetrics", "i32 -> i32");
16663
+ var SystemParametersInfo = /* @__PURE__ */ b("SystemParametersInfoW", "u32 u32 <BYTE>ptr u32 -> i32");
16609
16664
 
16610
16665
  // _build/lib/react-qw/reconciler.js
16611
16666
  var import_react_reconciler = __toESM(require_react_reconciler(), 1);
@@ -16620,8 +16675,33 @@ var DeleteObject = /* @__PURE__ */ b2("DeleteObject", "<HGDIOBJ>ptr -> i32");
16620
16675
  var GetDeviceCaps = /* @__PURE__ */ b2("GetDeviceCaps", "<HDC>ptr! i32@DeviceCap -> i32");
16621
16676
  var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr -> <HGDIOBJ>ptr", { LOGFONTW });
16622
16677
  var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr! <HGDIOBJ>ptr -> <HGDIOBJ>ptr");
16678
+ var CreateDIBSection = /* @__PURE__ */ b2("CreateDIBSection", "<HDC>ptr <>ptr u32@ColorUse <>ptr <>ptr u32 -> <HGDIOBJ>ptr");
16679
+ var SetDIBits = /* @__PURE__ */ b2("SetDIBits", "<HDC>ptr <HGDIOBJ>ptr! u32 u32 <BYTE>ptr <>ptr u32@ColorUse -> i32");
16623
16680
  var GetObject = /* @__PURE__ */ b2("GetObjectW", "<HGDIOBJ>ptr i32 <BYTE>ptr -> i32");
16624
16681
 
16682
+ // _build/lib/dpi.js
16683
+ function getScaleFactor() {
16684
+ const hdc = GetDC(NULL);
16685
+ const dpi = hdc ? GetDeviceCaps(
16686
+ hdc,
16687
+ 88
16688
+ /* DeviceCap.LOGPIXELSX */
16689
+ ) : 96;
16690
+ if (hdc)
16691
+ ReleaseDC(NULL, hdc);
16692
+ return dpi / 96;
16693
+ }
16694
+ function createSystemDpiFont() {
16695
+ const ncm = NONCLIENTMETRICSW.encode({ cbSize: NONCLIENTMETRICSW.size });
16696
+ if (!SystemParametersInfo(41, NONCLIENTMETRICSW.size, ncm, 0)) {
16697
+ const legacySize = NONCLIENTMETRICSW.size - 4;
16698
+ NONCLIENTMETRICSW.encode({ cbSize: legacySize }, ncm);
16699
+ if (!SystemParametersInfo(41, legacySize, ncm, 0))
16700
+ return NULL;
16701
+ }
16702
+ return CreateFontIndirect(NONCLIENTMETRICSW.decode(ncm).lfMessageFont);
16703
+ }
16704
+
16625
16705
  // _build/lib/react-qw/props.js
16626
16706
  import * as gui from "gui";
16627
16707
  function applyProps(instance, newProps, _oldProps) {
@@ -16645,14 +16725,14 @@ function applyProps(instance, newProps, _oldProps) {
16645
16725
  EnableWindow(hwnd2, !newProps.disabled ? 1 : 0);
16646
16726
  }
16647
16727
  if ("hidden" in newProps) {
16648
- gui.ShowWindow(
16728
+ ShowWindow(
16649
16729
  hwnd2,
16650
16730
  newProps.hidden ? 0 : 5
16651
16731
  /* ShowWindowCmd.SHOW */
16652
16732
  );
16653
16733
  }
16654
16734
  if ("visible" in newProps) {
16655
- gui.ShowWindow(
16735
+ ShowWindow(
16656
16736
  hwnd2,
16657
16737
  newProps.visible ? 5 : 0
16658
16738
  /* ShowWindowCmd.HIDE */
@@ -16772,24 +16852,21 @@ function measureTextForHwnd(hwnd2, text) {
16772
16852
  if (hFont)
16773
16853
  SelectObject(hdc, oldFont);
16774
16854
  ReleaseDC(hwnd2, hdc);
16775
- const wr = gui2.GetWindowRect(hwnd2);
16776
- const cr = gui2.GetClientRect(hwnd2);
16777
- if (wr && cr) {
16778
- result.width += wr.right - wr.left - (cr.right - cr.left);
16779
- result.height += wr.bottom - wr.top - (cr.bottom - cr.top);
16855
+ const wr = RECT.alloc();
16856
+ const cr = RECT.alloc();
16857
+ const okWr = GetWindowRect(hwnd2, wr.ptr);
16858
+ const okCr = GetClientRect(hwnd2, cr.ptr);
16859
+ if (okWr && okCr) {
16860
+ const w = RECT.decode(wr), c = RECT.decode(cr);
16861
+ result.width += w.right - w.left - (c.right - c.left);
16862
+ result.height += w.bottom - w.top - (c.bottom - c.top);
16780
16863
  }
16781
16864
  return result;
16782
16865
  }
16783
16866
 
16784
16867
  // _build/lib/react-qw/reconciler.js
16785
- var dpiFont = gui3.CreateSystemDpiFont();
16786
- var scaleFactor = (() => {
16787
- const hdc = GetDC(NULL);
16788
- const dpi = hdc ? GetDeviceCaps(hdc, 88) : 96;
16789
- if (hdc)
16790
- ReleaseDC(NULL, hdc);
16791
- return dpi / 96;
16792
- })();
16868
+ var dpiFont = createSystemDpiFont();
16869
+ var scaleFactor = getScaleFactor();
16793
16870
  var DELAYED_CONTROLS = /* @__PURE__ */ new Set(["SysListView32", "SysTreeView32", "LISTBOX", "COMBOBOX", "msctls_trackbar32", "SysDateTimePick32", "SysLink"]);
16794
16871
  function isDelayedControl(winClass) {
16795
16872
  return DELAYED_CONTROLS.has(winClass);
@@ -16835,11 +16912,12 @@ function runFlexLayout(inst) {
16835
16912
  const visible = children.filter((c) => !c.props.hidden);
16836
16913
  if (visible.length === 0)
16837
16914
  return;
16838
- const rect = gui3.GetClientRect(inst.hwnd);
16839
- if (!rect) {
16915
+ const rcBuf = RECT.alloc();
16916
+ if (!GetClientRect(inst.hwnd, rcBuf.ptr)) {
16840
16917
  console.log("flex: no rect for", inst.hwnd, inst.type);
16841
16918
  return;
16842
16919
  }
16920
+ const rect = RECT.decode(rcBuf);
16843
16921
  const pw = (rect.right - rect.left) / scaleFactor;
16844
16922
  const ph = (rect.bottom - rect.top) / scaleFactor;
16845
16923
  if (pw <= 0 || ph <= 0) {
@@ -17040,7 +17118,7 @@ var hostConfig = {
17040
17118
  },
17041
17119
  hideInstance(instance) {
17042
17120
  if (instance.hwnd !== null)
17043
- gui3.ShowWindow(
17121
+ ShowWindow(
17044
17122
  instance.hwnd,
17045
17123
  0
17046
17124
  /* ShowWindowCmd.HIDE */
@@ -17048,7 +17126,7 @@ var hostConfig = {
17048
17126
  },
17049
17127
  hideTextInstance(instance) {
17050
17128
  if (instance.hwnd !== null)
17051
- gui3.ShowWindow(
17129
+ ShowWindow(
17052
17130
  instance.hwnd,
17053
17131
  0
17054
17132
  /* ShowWindowCmd.HIDE */
@@ -17056,7 +17134,7 @@ var hostConfig = {
17056
17134
  },
17057
17135
  unhideInstance(instance, _props) {
17058
17136
  if (instance.hwnd !== null)
17059
- gui3.ShowWindow(
17137
+ ShowWindow(
17060
17138
  instance.hwnd,
17061
17139
  5
17062
17140
  /* ShowWindowCmd.SHOW */
@@ -17064,7 +17142,7 @@ var hostConfig = {
17064
17142
  },
17065
17143
  unhideTextInstance(instance, _text) {
17066
17144
  if (instance.hwnd !== null)
17067
- gui3.ShowWindow(
17145
+ ShowWindow(
17068
17146
  instance.hwnd,
17069
17147
  5
17070
17148
  /* ShowWindowCmd.SHOW */
@@ -17311,11 +17389,10 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
17311
17389
  if (!h)
17312
17390
  return;
17313
17391
  InvalidateRect(h, NULL, 1);
17314
- const cr = gui6.GetClientRect(h);
17315
- if (cr) {
17316
- const w = cr.right - cr.left;
17317
- const hh = cr.bottom - cr.top;
17318
- gui6.SendMessage(h, 5, 0, hh << 16 | w);
17392
+ const cr = RECT.alloc();
17393
+ if (GetClientRect(h, cr.ptr)) {
17394
+ const { left, top, right, bottom } = RECT.decode(cr);
17395
+ gui6.SendMessage(h, 5, 0, bottom - top << 16 | right - left);
17319
17396
  }
17320
17397
  }, []);
17321
17398
  return (0, import_jsx_runtime4.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
@@ -17376,7 +17453,10 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
17376
17453
  const h = inputRef.current;
17377
17454
  if (!h)
17378
17455
  return;
17379
- const newText = gui7.GetWindowText(h);
17456
+ const cap = GetWindowTextLength(h) + 1;
17457
+ const buf = WCHAR.alloc(cap);
17458
+ GetWindowText(h, buf, cap);
17459
+ const newText = WCHAR.decode(buf);
17380
17460
  if (!isControlled)
17381
17461
  setInternalValue(newText);
17382
17462
  onChange?.(newText);
@@ -17464,6 +17544,49 @@ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
17464
17544
  var import_react9 = __toESM(require_react(), 1);
17465
17545
  import * as gui9 from "gui";
17466
17546
  import * as ffi3 from "ffi";
17547
+
17548
+ // _build/lib/bitmap.js
17549
+ function createBitmapFromPixels(width, height, pixels) {
17550
+ if (width <= 0 || height <= 0)
17551
+ return NULL;
17552
+ const len = width * height * 4;
17553
+ if (pixels.byteLength < len)
17554
+ return NULL;
17555
+ const bi = BITMAPINFOHEADER.encode({
17556
+ biSize: BITMAPINFOHEADER.size,
17557
+ biWidth: width,
17558
+ biHeight: -height,
17559
+ biPlanes: 1,
17560
+ biBitCount: 32
17561
+ });
17562
+ const hbm = CreateDIBSection(NULL, bi.ptr, 0, NULL, NULL, 0);
17563
+ if (!hbm)
17564
+ return NULL;
17565
+ const src = new PtrArrayBuffer(len);
17566
+ new Uint8Array(src).set(new Uint8Array(pixels, 0, len));
17567
+ if (SetDIBits(
17568
+ NULL,
17569
+ hbm,
17570
+ 0,
17571
+ height,
17572
+ src,
17573
+ bi.ptr,
17574
+ 0
17575
+ /* ColorUse.RGB_COLORS */
17576
+ ) !== height) {
17577
+ DeleteObject(hbm);
17578
+ return NULL;
17579
+ }
17580
+ return hbm;
17581
+ }
17582
+
17583
+ // _build/lib/windows/comctl32.js
17584
+ var b3 = (name, sig) => bind("comctl32.dll", name, sig);
17585
+ var ImageListCreate = /* @__PURE__ */ b3("ImageList_Create", "i32 i32 u32 i32 i32 -> <HIMAGELIST>ptr");
17586
+ var ImageListAdd = /* @__PURE__ */ b3("ImageList_Add", "<HIMAGELIST>ptr <HGDIOBJ>ptr <HGDIOBJ>ptr -> i32");
17587
+ var ImageListDestroy = /* @__PURE__ */ b3("ImageList_Destroy", "<HIMAGELIST>ptr -> i32");
17588
+
17589
+ // _build/lib/react-qw/components/ListView.js
17467
17590
  function writeU32(ptr, offset, v) {
17468
17591
  ffi3.writeByte(ptr + offset, v & 255);
17469
17592
  ffi3.writeByte(ptr + offset + 1, v >> 8 & 255);
@@ -17553,7 +17676,7 @@ function resolveCellStyle(columns, data, row, colIndex) {
17553
17676
  }
17554
17677
  function makeLVItem(i, sub, text, image) {
17555
17678
  const textBuf = WCHAR.encode(text);
17556
- const b6 = LVITEMW.encode({
17679
+ const b7 = LVITEMW.encode({
17557
17680
  mask: 1 | (image !== void 0 ? 2 : 0),
17558
17681
  iItem: i,
17559
17682
  iSubItem: sub,
@@ -17570,32 +17693,32 @@ function makeLVItem(i, sub, text, image) {
17570
17693
  piColFmt: 0,
17571
17694
  iGroup: 0
17572
17695
  });
17573
- b6.__textBuf = textBuf;
17574
- return b6;
17696
+ b7.__textBuf = textBuf;
17697
+ return b7;
17575
17698
  }
17576
17699
  var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, data, style, icons, iconSize, getIcon }, ref) {
17577
17700
  const lvRef = (0, import_react9.useRef)(null);
17578
- const iconListRef = (0, import_react9.useRef)(0);
17701
+ const iconListRef = (0, import_react9.useRef)(NULL);
17579
17702
  (0, import_react9.useEffect)(() => {
17580
17703
  const h = lvRef.current;
17581
17704
  if (!h)
17582
17705
  return;
17583
17706
  const il = iconListRef.current;
17584
- iconListRef.current = 0;
17707
+ iconListRef.current = NULL;
17585
17708
  if (il) {
17586
17709
  gui9.SendMessage(h, 4099, 1, 0);
17587
- gui9.ImageListDestroy(il);
17710
+ ImageListDestroy(il);
17588
17711
  }
17589
17712
  if (!icons || icons.length === 0)
17590
17713
  return;
17591
17714
  const size = iconSize ?? 32;
17592
- const img = gui9.ImageListCreate(size, size, 32, icons.length, 1);
17715
+ const img = ImageListCreate(size, size, 32, icons.length, 1);
17593
17716
  if (!img)
17594
17717
  return;
17595
17718
  for (const p of icons) {
17596
- const hbm = gui9.CreateBitmapFromPixels(size, size, p);
17719
+ const hbm = createBitmapFromPixels(size, size, p);
17597
17720
  if (hbm) {
17598
- gui9.ImageListAdd(img, hbm);
17721
+ ImageListAdd(img, hbm, NULL);
17599
17722
  DeleteObject(hbm);
17600
17723
  }
17601
17724
  }
@@ -17776,22 +17899,19 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
17776
17899
  // _build/lib/react-qw/components/ScrollView.js
17777
17900
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
17778
17901
  var import_react12 = __toESM(require_react(), 1);
17779
- import * as gui12 from "gui";
17780
17902
  var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth, contentHeight }, ref) => {
17781
17903
  const svRef = (0, import_react12.useRef)(null);
17782
17904
  const contentRef = (0, import_react12.useRef)(null);
17783
17905
  const scrollXRef = (0, import_react12.useRef)(0);
17784
17906
  const scrollYRef = (0, import_react12.useRef)(0);
17785
17907
  function updateScroll(sv, content) {
17786
- const svRect = gui12.GetClientRect(sv);
17787
- if (!svRect)
17908
+ const svBuf = RECT.alloc();
17909
+ if (!GetClientRect(sv, svBuf.ptr))
17788
17910
  return;
17789
- const svW = svRect.right - svRect.left;
17790
- const svH = svRect.bottom - svRect.top;
17791
- const hdc = GetDC(NULL);
17792
- const scale = hdc ? GetDeviceCaps(hdc, 88) / 96 : 1;
17793
- if (hdc)
17794
- ReleaseDC(NULL, hdc);
17911
+ const { left, top, right, bottom } = RECT.decode(svBuf);
17912
+ const svW = right - left;
17913
+ const svH = bottom - top;
17914
+ const scale = getScaleFactor();
17795
17915
  const natW = Math.round((contentWidth ?? svW / scale) * scale);
17796
17916
  const natH = Math.round((contentHeight ?? svH / scale) * scale);
17797
17917
  scrollXRef.current = Math.max(0, Math.min(scrollXRef.current, natW - svW));
@@ -17808,14 +17928,28 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17808
17928
  );
17809
17929
  forceFlexLayout(content);
17810
17930
  if (natW > svW) {
17811
- gui12.SetScrollInfo(sv, 0, { min: 0, max: natW - 1, page: svW, pos: scrollXRef.current }, true);
17931
+ SetScrollInfo(sv, 0, {
17932
+ cbSize: SCROLLINFO.size,
17933
+ fMask: 1 | 2 | 4,
17934
+ nMin: 0,
17935
+ nMax: natW - 1,
17936
+ nPage: svW,
17937
+ nPos: scrollXRef.current
17938
+ }, 1);
17812
17939
  ShowScrollBar(sv, 0, 1);
17813
17940
  } else {
17814
17941
  scrollXRef.current = 0;
17815
17942
  ShowScrollBar(sv, 0, 0);
17816
17943
  }
17817
17944
  if (natH > svH) {
17818
- gui12.SetScrollInfo(sv, 1, { min: 0, max: natH - 1, page: svH, pos: scrollYRef.current }, true);
17945
+ SetScrollInfo(sv, 1, {
17946
+ cbSize: SCROLLINFO.size,
17947
+ fMask: 1 | 2 | 4,
17948
+ nMin: 0,
17949
+ nMax: natH - 1,
17950
+ nPage: svH,
17951
+ nPos: scrollYRef.current
17952
+ }, 1);
17819
17953
  ShowScrollBar(sv, 1, 1);
17820
17954
  } else {
17821
17955
  scrollYRef.current = 0;
@@ -17845,15 +17979,21 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17845
17979
  1 | 4
17846
17980
  /* SetWindowPosFlag.SWP_NOZORDER */
17847
17981
  );
17848
- gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
17982
+ SetScrollInfo(sv, bar, { cbSize: SCROLLINFO.size, fMask: 4, nPos: newPos }, 1);
17849
17983
  }
17850
17984
  function handleScroll(e, bar) {
17851
17985
  const sv = svRef.current;
17852
17986
  const content = contentRef.current;
17853
17987
  if (!sv || !content)
17854
17988
  return;
17855
- const info = gui12.GetScrollInfo(sv, bar);
17856
- const maxPos = info.max - info.page + 1;
17989
+ const si = SCROLLINFO.encode({
17990
+ cbSize: SCROLLINFO.size,
17991
+ fMask: 23
17992
+ /* ScrollInfoFlag.ALL */
17993
+ });
17994
+ GetScrollInfo(sv, bar, si.ptr);
17995
+ const info = SCROLLINFO.decode(si);
17996
+ const maxPos = info.nMax - info.nPage + 1;
17857
17997
  const code = e.wParam & 65535;
17858
17998
  const ref_ = bar === 1 ? scrollYRef : scrollXRef;
17859
17999
  let newPos = ref_.current;
@@ -17864,9 +18004,9 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17864
18004
  else if (code === 1)
17865
18005
  newPos += 20;
17866
18006
  else if (code === 2)
17867
- newPos -= info.page;
18007
+ newPos -= info.nPage;
17868
18008
  else if (code === 3)
17869
- newPos += info.page;
18009
+ newPos += info.nPage;
17870
18010
  else
17871
18011
  return;
17872
18012
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17886,8 +18026,14 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17886
18026
  if (!isHorz && contentHeight === void 0)
17887
18027
  return;
17888
18028
  const bar = isHorz ? 0 : 1;
17889
- const info = gui12.GetScrollInfo(sv, bar);
17890
- const maxPos = info.max - info.page + 1;
18029
+ const si = SCROLLINFO.encode({
18030
+ cbSize: SCROLLINFO.size,
18031
+ fMask: 23
18032
+ /* ScrollInfoFlag.ALL */
18033
+ });
18034
+ GetScrollInfo(sv, bar, si.ptr);
18035
+ const info = SCROLLINFO.decode(si);
18036
+ const maxPos = info.nMax - info.nPage + 1;
17891
18037
  const ref_ = isHorz ? scrollXRef : scrollYRef;
17892
18038
  let newPos = ref_.current + dy;
17893
18039
  newPos = Math.max(0, Math.min(maxPos, newPos));
@@ -17935,7 +18081,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
17935
18081
  // _build/lib/react-qw/components/Slider.js
17936
18082
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
17937
18083
  var import_react13 = __toESM(require_react(), 1);
17938
- import * as gui13 from "gui";
18084
+ import * as gui12 from "gui";
17939
18085
  var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 100, vertical = false, disabled, style }, ref) => {
17940
18086
  const wrapperRef = (0, import_react13.useRef)(null);
17941
18087
  const sliderRef = (0, import_react13.useRef)(null);
@@ -17944,14 +18090,14 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17944
18090
  if (!h)
17945
18091
  return;
17946
18092
  const lParam = min & 65535 | (max & 65535) << 16;
17947
- gui13.SendMessage(h, 1030, 0, lParam);
17948
- gui13.SendMessage(h, 1029, 1, value);
18093
+ gui12.SendMessage(h, 1030, 0, lParam);
18094
+ gui12.SendMessage(h, 1029, 1, value);
17949
18095
  }, [min, max]);
17950
18096
  (0, import_react13.useEffect)(() => {
17951
18097
  const h = sliderRef.current;
17952
18098
  if (!h)
17953
18099
  return;
17954
- gui13.SendMessage(h, 1029, 1, value);
18100
+ gui12.SendMessage(h, 1029, 1, value);
17955
18101
  }, [value]);
17956
18102
  const tbStyle = 268435456 | 65536 | 1 | (vertical ? 2 : 0);
17957
18103
  return (0, import_jsx_runtime12.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style, ref: (h) => {
@@ -17968,7 +18114,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17968
18114
  const h = sliderRef.current;
17969
18115
  if (!h)
17970
18116
  return 0;
17971
- const pos = gui13.SendMessage(h, 1024, 0, 0);
18117
+ const pos = gui12.SendMessage(h, 1024, 0, 0);
17972
18118
  onChange?.(pos);
17973
18119
  return 0;
17974
18120
  }
@@ -17981,7 +18127,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
17981
18127
  // _build/lib/react-qw/components/Tab.js
17982
18128
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
17983
18129
  var import_react14 = __toESM(require_react(), 1);
17984
- import * as gui14 from "gui";
18130
+ import * as gui13 from "gui";
17985
18131
  var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
17986
18132
  const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
17987
18133
  const isControlled = controlledIndex !== void 0;
@@ -17991,7 +18137,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
17991
18137
  const h = tabHwnd.current;
17992
18138
  if (!h)
17993
18139
  return;
17994
- gui14.SendMessage(h, 4873, 0, 0);
18140
+ gui13.SendMessage(h, 4873, 0, 0);
17995
18141
  for (let i = 0; i < tabs.length; i++) {
17996
18142
  const titleBuf = WCHAR.encode(tabs[i].title);
17997
18143
  const tci = TCITEMW.encode({
@@ -18004,14 +18150,14 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18004
18150
  lParam: 0
18005
18151
  });
18006
18152
  const tciPtr = tci.ptr;
18007
- gui14.SendMessage(h, 4926, i, tciPtr);
18153
+ gui13.SendMessage(h, 4926, i, tciPtr);
18008
18154
  }
18009
- gui14.SendMessage(h, 4876, sel, 0);
18155
+ gui13.SendMessage(h, 4876, sel, 0);
18010
18156
  }, [tabs]);
18011
18157
  (0, import_react14.useEffect)(() => {
18012
18158
  const h = tabHwnd.current;
18013
18159
  if (h)
18014
- gui14.SendMessage(h, 4876, sel, 0);
18160
+ gui13.SendMessage(h, 4876, sel, 0);
18015
18161
  }, [sel]);
18016
18162
  return (0, import_jsx_runtime13.jsxs)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18017
18163
  if (e.msg === 78) {
@@ -18020,7 +18166,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18020
18166
  return;
18021
18167
  const code = nmCode(e.lParam);
18022
18168
  if (code === -552 || code === -2) {
18023
- const newSel = gui14.SendMessage(h, 4875, 0, 0);
18169
+ const newSel = gui13.SendMessage(h, 4875, 0, 0);
18024
18170
  if (newSel !== sel) {
18025
18171
  if (!isControlled)
18026
18172
  setInternalIndex(newSel);
@@ -18033,7 +18179,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
18033
18179
 
18034
18180
  // _build/lib/react-qw/components/Tooltip.js
18035
18181
  var import_react15 = __toESM(require_react(), 1);
18036
- import * as gui15 from "gui";
18182
+ import * as gui14 from "gui";
18037
18183
  function buildToolInfo(hTarget, text) {
18038
18184
  const size = TTTOOLINFOW.size;
18039
18185
  const textLen = (text.length + 1) * 2;
@@ -18062,7 +18208,7 @@ function Tooltip({ text, children, balloon }) {
18062
18208
  const hTarget = childRef.current;
18063
18209
  if (!hTarget)
18064
18210
  return;
18065
- const hTT = gui15.CreateWindow("tooltips_class32", "", -2147483648 | 1 | 2 | (balloon ? 64 : 0), 0, 0, 0, 0, hTarget, null);
18211
+ const hTT = gui14.CreateWindow("tooltips_class32", "", -2147483648 | 1 | 2 | (balloon ? 64 : 0), 0, 0, 0, 0, hTarget, null);
18066
18212
  if (!hTT)
18067
18213
  return;
18068
18214
  hTTRef.current = hTT;
@@ -18077,14 +18223,14 @@ function Tooltip({ text, children, balloon }) {
18077
18223
  /* SetWindowPosFlag.SWP_NOACTIVATE */
18078
18224
  );
18079
18225
  const ti = buildToolInfo(hTarget, text);
18080
- gui15.SendMessage(hTT, 1074, 0, ti.ptr);
18081
- gui15.SendMessage(hTT, 1048, 0, 400);
18082
- gui15.SendMessage(hTT, 1025, 1, 0);
18226
+ gui14.SendMessage(hTT, 1074, 0, ti.ptr);
18227
+ gui14.SendMessage(hTT, 1048, 0, 400);
18228
+ gui14.SendMessage(hTT, 1025, 1, 0);
18083
18229
  return () => {
18084
18230
  if (hTT) {
18085
18231
  const ti2 = buildToolInfo(hTarget, text);
18086
- gui15.SendMessage(hTT, 1075, 0, ti2.ptr);
18087
- gui15.DestroyWindow(hTT);
18232
+ gui14.SendMessage(hTT, 1075, 0, ti2.ptr);
18233
+ gui14.DestroyWindow(hTT);
18088
18234
  }
18089
18235
  hTTRef.current = null;
18090
18236
  };
@@ -18096,7 +18242,7 @@ function Tooltip({ text, children, balloon }) {
18096
18242
  // _build/lib/react-qw/components/TreeView.js
18097
18243
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
18098
18244
  var import_react16 = __toESM(require_react(), 1);
18099
- import * as gui16 from "gui";
18245
+ import * as gui15 from "gui";
18100
18246
  function buildTvItem(textPtr, cChildren) {
18101
18247
  let mask = 1;
18102
18248
  if (cChildren > 0)
@@ -18121,20 +18267,20 @@ function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
18121
18267
  const itemBuf = buildTvItem(textBuf.ptr, cChildren);
18122
18268
  const item = TVITEM.decode(itemBuf);
18123
18269
  const tvins = TVINSERTSTRUCT.encode({ hParent: parentHandle, hInsertAfter: -65536, item });
18124
- const hItem = gui16.SendMessage(hTree, 4402, 0, tvins.ptr);
18270
+ const hItem = gui15.SendMessage(hTree, 4402, 0, tvins.ptr);
18125
18271
  hItemMap.set(hItem, node);
18126
18272
  if (node.key)
18127
18273
  keyMap.set(node.key, hItem);
18128
18274
  if (node.children && node.children.length > 0) {
18129
18275
  insertItems(hTree, node.children, hItem, hItemMap, keyMap);
18130
- gui16.SendMessage(hTree, 4354, 2, hItem);
18276
+ gui15.SendMessage(hTree, 4354, 2, hItem);
18131
18277
  }
18132
18278
  }
18133
18279
  }
18134
18280
  function deleteAllItems(hTree) {
18135
- const n = gui16.SendMessage(hTree, 4357, 0, 0);
18281
+ const n = gui15.SendMessage(hTree, 4357, 0, 0);
18136
18282
  if (n > 0)
18137
- gui16.SendMessage(
18283
+ gui15.SendMessage(
18138
18284
  hTree,
18139
18285
  4353,
18140
18286
  1,
@@ -18166,7 +18312,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18166
18312
  const h = tvRef.current;
18167
18313
  if (!h)
18168
18314
  return;
18169
- gui16.SendMessage(
18315
+ gui15.SendMessage(
18170
18316
  h,
18171
18317
  4396,
18172
18318
  0,
@@ -18182,7 +18328,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18182
18328
  return;
18183
18329
  const hItem = keyMapRef.current.get(selKey);
18184
18330
  if (hItem !== void 0)
18185
- gui16.SendMessage(h, 4363, 9, hItem);
18331
+ gui15.SendMessage(h, 4363, 9, hItem);
18186
18332
  }, [selKey]);
18187
18333
  return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
18188
18334
  if (e.msg === 78) {
@@ -18191,7 +18337,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
18191
18337
  const h = tvRef.current;
18192
18338
  if (!h)
18193
18339
  return;
18194
- const hCaret = gui16.SendMessage(h, 4362, 9, 0);
18340
+ const hCaret = gui15.SendMessage(h, 4362, 9, 0);
18195
18341
  const node = hItemMapRef.current.get(hCaret) ?? null;
18196
18342
  const key = node?.key ?? null;
18197
18343
  if (!isControlled)
@@ -18209,24 +18355,24 @@ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
18209
18355
  var import_react17 = __toESM(require_react(), 1);
18210
18356
 
18211
18357
  // _build/lib/windows/comdlg32.js
18212
- var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
18213
- var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18358
+ var b4 = (name, sig) => bind("comdlg32.dll", name, sig);
18359
+ var GetOpenFileName = /* @__PURE__ */ b4("GetOpenFileNameW", "<OPENFILENAMEW>ptr -> u32");
18214
18360
 
18215
18361
  // _build/lib/windows/shell32.js
18216
- var b4 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18217
- var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18218
- var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18362
+ var b5 = (name, sig, encoders) => bind("shell32.dll", name, sig, encoders);
18363
+ var SHBrowseForFolder = /* @__PURE__ */ b5("SHBrowseForFolderW", "<BROWSEINFOW>ptr -> <>ptr");
18364
+ var SHGetPathFromIDList = /* @__PURE__ */ b5("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
18219
18365
  var Shell_NotifyIconGetRect = (() => {
18220
18366
  try {
18221
- return b4("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18367
+ return b5("Shell_NotifyIconGetRect", "<NOTIFYICONIDENTIFIER>ptr <RECT>ptr -> i32", { NOTIFYICONIDENTIFIER });
18222
18368
  } catch {
18223
18369
  return null;
18224
18370
  }
18225
18371
  })();
18226
18372
 
18227
18373
  // _build/lib/windows/ole32.js
18228
- var b5 = (name, sig) => bind("ole32.dll", name, sig);
18229
- var CoTaskMemFree = /* @__PURE__ */ b5("CoTaskMemFree", "<>ptr -> void");
18374
+ var b6 = (name, sig) => bind("ole32.dll", name, sig);
18375
+ var CoTaskMemFree = /* @__PURE__ */ b6("CoTaskMemFree", "<>ptr -> void");
18230
18376
 
18231
18377
  // _build/lib/react-qw/components/PathPicker.js
18232
18378
  function openFileDialog(owner, filter, title, multiple) {
@@ -18321,7 +18467,7 @@ var rootMap = /* @__PURE__ */ new Map();
18321
18467
  function ensureDefaultClass() {
18322
18468
  if (defaultClassRegistered)
18323
18469
  return DEFAULT_CLASS;
18324
- gui17.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18470
+ gui16.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
18325
18471
  const entry = rootMap.get(hwnd2);
18326
18472
  if (msg === 2 && entry) {
18327
18473
  rootMap.delete(hwnd2);
@@ -18347,15 +18493,27 @@ function createRoot(container) {
18347
18493
  const ws = (cfg.ws ?? 0) | 13565952;
18348
18494
  const w = (cfg.width ?? 800) * scaleFactor;
18349
18495
  const h = (cfg.height ?? 600) * scaleFactor;
18350
- const [sw, sh] = [GetSystemMetrics(0), GetSystemMetrics(1)];
18496
+ const [sw, sh] = [GetSystemMetrics(
18497
+ 0
18498
+ /* SysMetrics.CXSCREEN */
18499
+ ), GetSystemMetrics(
18500
+ 1
18501
+ /* SysMetrics.CYSCREEN */
18502
+ )];
18351
18503
  const x = cfg.x === void 0 ? (sw - w) / 2 | 0 : cfg.x === -2147483648 ? -2147483648 : cfg.x * scaleFactor;
18352
18504
  const y = cfg.y === void 0 ? (sh - h) / 2 | 0 : cfg.y === -2147483648 ? -2147483648 : cfg.y * scaleFactor;
18353
- const hwin = gui17.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18505
+ const hwin = gui16.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
18354
18506
  if (!hwin)
18355
18507
  throw new Error("CreateWindow failed");
18356
18508
  hwnd2 = hwin;
18357
- if (!cfg.noShowWindow)
18358
- gui17.ShowWindow(hwnd2);
18509
+ if (!cfg.noShowWindow) {
18510
+ ShowWindow(
18511
+ hwnd2,
18512
+ 1
18513
+ /* ShowWindowCmd.SHOWNORMAL */
18514
+ );
18515
+ UpdateWindow(hwnd2);
18516
+ }
18359
18517
  } else {
18360
18518
  hwnd2 = container;
18361
18519
  }
@@ -18383,14 +18541,14 @@ function render(element, containerOrConfig, _callback) {
18383
18541
  }
18384
18542
 
18385
18543
  // _build/examples/test_gallery.js
18386
- gui18.RegisterClass("Gallery", (hwnd2, msg, wParam, lParam) => {
18544
+ gui17.RegisterClass("Gallery", (hwnd2, msg, wParam, lParam) => {
18387
18545
  if (!hwnd2)
18388
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18546
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18389
18547
  if (msg === 2) {
18390
- gui18.PostQuitMessage(0);
18548
+ PostQuitMessage(0);
18391
18549
  return 0;
18392
18550
  }
18393
- return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
18551
+ return gui17.DefWindowProc(hwnd2, msg, wParam, lParam);
18394
18552
  });
18395
18553
  var VISIBLE = 268435456;
18396
18554
  var CLIPCHILDREN = 33554432;
@@ -18457,15 +18615,22 @@ function App({ svW, svH }) {
18457
18615
  { title: "Typing", content: (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE | CLIPCHILDREN, style: { flexDirection: "column", gap: 6 }, children: [(0, import_jsx_runtime16.jsx)(Input, { value: inputText, onChange: setInputText, placeholder: "Type here...", style: { height: 28 } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: inputText ? `You typed: ${inputText}` : "(empty)", style: { height: 24 } })] }) }
18458
18616
  ], style: { height: 120 } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: `DateTimePicker (${dtDate ? `${dtDate.getFullYear()}-${String(dtDate.getMonth() + 1).padStart(2, "0")}-${String(dtDate.getDate()).padStart(2, "0")}` : "none"})`, style: { height: 24 } }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE, style: { flexDirection: "row", gap: 8, alignItems: "stretch", height: 28 }, children: [(0, import_jsx_runtime16.jsx)(DateTimePicker, { value: dtDate, onChange: setDtDate, style: { flexGrow: 1 } }), (0, import_jsx_runtime16.jsx)(DateTimePicker, { value: dtDate, onChange: setDtDate, format: "long", style: { flexGrow: 1 } }), (0, import_jsx_runtime16.jsx)(DateTimePicker, { value: dtDate, onChange: setDtDate, format: "time", style: { flexGrow: 1 } })] }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: "SysLink", style: { height: 24 } }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE, style: { flexDirection: "row", gap: 8, alignItems: "stretch", height: 28 }, children: [(0, import_jsx_runtime16.jsx)(Link, { href: "https://example.com", onClick: (url) => console.log("Link clicked:", url), style: { flexGrow: 1 }, children: "Example Link" }), (0, import_jsx_runtime16.jsx)(Link, { href: "https://github.com", onClick: (url) => console.log("Link clicked:", url), style: { flexGrow: 1 } })] }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: "PathPicker", style: { height: 24 } }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE, style: { flexDirection: "column", gap: 6, height: 130 }, children: [(0, import_jsx_runtime16.jsx)(PathPicker, { type: "file", title: "Select a file", style: { height: 28 } }), (0, import_jsx_runtime16.jsx)(PathPicker, { type: "folder", title: "Select a folder", style: { height: 28 } }), (0, import_jsx_runtime16.jsx)(PathPicker, { type: "file", value: pickerPath, onChange: setPickerPath, title: "Controlled", style: { height: 28 } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: pickerPath ? `Selected: ${pickerPath}` : "(none)", style: { height: 20 } })] }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE, style: { flexDirection: "row", gap: 6, alignItems: "stretch", height: 400 }, children: [(0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE | CLIPCHILDREN, style: { flexDirection: "column", gap: 4, flexGrow: 1 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: `ListView (${listData.length} items)`, style: { height: 24 } }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE, style: { flexDirection: "row", gap: 6, alignItems: "stretch", flexGrow: 1 }, children: [(0, import_jsx_runtime16.jsx)(ListView, { columns: listCols, data: listData, style: { flexGrow: 1 } }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE | CLIPCHILDREN, style: { flexDirection: "column", gap: 6, width: 100 }, children: [(0, import_jsx_runtime16.jsx)(Button, { onClick: () => setListData((d) => [...d, { name: "NewItem " + String(listData.length + 1), color: "", origin: "" }]), style: { height: 28 }, children: "Add" }), (0, import_jsx_runtime16.jsx)(Button, { onClick: () => setListCols((cols) => [...cols, { name: "Col" + (listCols.length + 1), dataIndex: "name" }]), style: { height: 28 }, children: "+Column" })] })] })] }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE | CLIPCHILDREN, style: { flexDirection: "column", gap: 4, flexGrow: 1 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: "ScrollView (scrollable)", style: { height: 24 } }), (0, import_jsx_runtime16.jsx)(ScrollView, { style: { flexGrow: 1 }, contentWidth: 500, contentHeight: 560, children: Array.from({ length: 20 }, (_, i) => (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: `Item ${i + 1} - ${i === 0 ? "here is a line so wide that the horizontal scrollbar appears for demonstration" : ""}`, style: { width: i === 0 ? 500 : 200, height: 28 } }, i)) })] }), (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: VISIBLE | CLIPCHILDREN, style: { flexDirection: "column", gap: 4, flexGrow: 1 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "STATIC", ws: VISIBLE, text: `TreeView (sel=${treeSel?.label ?? "none"})`, style: { height: 24 } }), (0, import_jsx_runtime16.jsx)(TreeView, { data: treeData, onSelect: setTreeSel, style: { flexGrow: 1 } })] })] })] }) });
18459
18617
  }
18460
- var hwnd = gui18.CreateWindow("Gallery", "Component Gallery", 13565952, 100, 100, 1400, 1200, null, null);
18618
+ var hwnd = gui17.CreateWindow("Gallery", "Component Gallery", 13565952, 100, 100, 1400, 1200, null, null);
18461
18619
  if (hwnd) {
18462
- const cr = gui18.GetClientRect(hwnd);
18463
- const scale = gui18.GetScaleFactor();
18464
- const svW = Math.round((cr.right - cr.left) / scale);
18465
- const svH = Math.round((cr.bottom - cr.top) / scale);
18620
+ const crBuf = RECT.alloc();
18621
+ if (!GetClientRect(hwnd, crBuf.ptr))
18622
+ throw new Error("gallery: GetClientRect failed");
18623
+ const { left, top, right, bottom } = RECT.decode(crBuf);
18624
+ const scale = getScaleFactor();
18625
+ const svW = Math.round((right - left) / scale);
18626
+ const svH = Math.round((bottom - top) / scale);
18466
18627
  render((0, import_jsx_runtime16.jsx)(App, { svW, svH }), hwnd);
18467
18628
  setTimeout(() => {
18468
- gui18.ShowWindow(hwnd);
18629
+ ShowWindow(
18630
+ hwnd,
18631
+ 1
18632
+ /* ShowWindowCmd.SHOWNORMAL */
18633
+ );
18469
18634
  }, 0);
18470
18635
  }
18471
18636
  /*! Bundled license information: