quickwin 1.3.0 → 2.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.
- package/README.en.md +1 -2
- package/README.md +19 -23
- package/examples/PdfCanvas.js +8 -37
- package/examples/PdfCanvas.tsx +11 -41
- package/examples/exec_server.js +20054 -1423
- package/examples/exec_server.tsx +489 -0
- package/examples/exec_server_worker.js +383 -33
- package/examples/exec_server_worker.ts +408 -30
- package/examples/pdf_preview2.js +25 -82
- package/examples/pdf_preview2.ts +27 -84
- package/examples/pdf_viewer.js +1318 -1178
- package/examples/pdf_viewer.tsx +16 -67
- package/examples/setres.js +22 -47
- package/examples/setres.ts +23 -57
- package/examples/test_gallery.js +1313 -1074
- package/examples/test_react_lazy.js +1284 -1056
- package/examples/test_react_listbox.js +1283 -1055
- package/examples/test_root_window.js +1279 -1051
- package/examples/test_tab.js +1284 -1056
- package/lib/abort.js +70 -0
- package/lib/abort.ts +69 -0
- package/lib/certs.js +214 -0
- package/lib/certs.ts +224 -0
- package/lib/exec-log.js +15 -0
- package/lib/exec-log.ts +30 -0
- package/lib/fetch.js +37 -4
- package/lib/fetch.ts +35 -4
- package/lib/ffi/bind.js +352 -0
- package/lib/ffi/bind.ts +442 -0
- package/lib/ffi/ctype.js +168 -0
- package/lib/ffi/ctype.ts +331 -0
- package/lib/ffi/index.js +6 -0
- package/lib/ffi/index.ts +6 -0
- package/lib/ffi/struct.js +412 -0
- package/lib/ffi/struct.ts +664 -0
- package/lib/http-common.js +43 -5
- package/lib/http-common.ts +48 -6
- package/lib/http-server.js +187 -29
- package/lib/http-server.ts +177 -26
- package/lib/react-qw/components/DateTimePicker.js +18 -37
- package/lib/react-qw/components/Input.js +3 -10
- package/lib/react-qw/components/Link.js +6 -19
- package/lib/react-qw/components/ListView.js +49 -154
- package/lib/react-qw/components/PathPicker.js +28 -88
- package/lib/react-qw/components/ScrollView.js +15 -8
- package/lib/react-qw/components/Slider.js +2 -1
- package/lib/react-qw/components/Tab.js +6 -22
- package/lib/react-qw/components/Tooltip.js +10 -21
- package/lib/react-qw/components/TreeView.js +8 -31
- package/lib/react-qw/index.js +4 -2
- package/lib/react-qw/index.ts +4 -2
- package/lib/react-qw/nmhdr.js +3 -24
- package/lib/react-qw/nmhdr.ts +5 -30
- package/lib/react-qw/props.js +7 -2
- package/lib/react-qw/props.ts +7 -3
- package/lib/react-qw/reconciler.js +23 -13
- package/lib/react-qw/reconciler.ts +22 -13
- package/lib/text-measure.js +18 -23
- package/lib/text-measure.ts +20 -25
- package/lib/websocket.js +12 -2
- package/lib/websocket.ts +15 -2
- package/lib/windows/comctl32.js +18 -0
- package/lib/windows/comctl32.ts +20 -0
- package/lib/windows/comdlg32.js +7 -0
- package/lib/windows/comdlg32.ts +9 -0
- package/lib/windows/gdi32.js +90 -0
- package/lib/windows/gdi32.ts +97 -0
- package/lib/windows/kernel32.js +66 -0
- package/lib/windows/kernel32.ts +76 -0
- package/lib/windows/ntdll.js +8 -0
- package/lib/windows/ntdll.ts +10 -0
- package/lib/windows/ole32.js +7 -0
- package/lib/windows/ole32.ts +9 -0
- package/lib/windows/shell32.js +11 -0
- package/lib/windows/shell32.ts +14 -0
- package/lib/windows/structs.js +384 -0
- package/lib/windows/structs.ts +422 -0
- package/lib/windows/user32.js +469 -0
- package/lib/windows/user32.ts +502 -0
- package/package.json +1 -1
- package/quickwin.d.ts +22 -37
- package/quickwin_const.d.ts +1 -0
- package/qwin-nowasm-x86.exe +0 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin-x86.exe +0 -0
- package/qwin.exe +0 -0
- package/test/bench_ffi_callraw.js +236 -0
- package/test/bench_ffi_callraw.ts +236 -0
- package/test/bench_ffi_overhead.js +139 -0
- package/test/bench_ffi_overhead.ts +141 -0
- package/test/bench_sendmessage.js +104 -0
- package/test/bench_sendmessage.ts +100 -0
- package/test/bench_sendmessage_nonnull.js +187 -0
- package/test/bench_sendmessage_nonnull.ts +188 -0
- package/test/run.js +12 -4
- package/test/run.ts +13 -5
- package/test/test_basic_fetch.js +8 -0
- package/test/test_basic_fetch.ts +9 -0
- package/test/test_ffi.js +25 -43
- package/test/test_ffi.ts +33 -52
- package/test/test_ffi_abi.js +235 -0
- package/test/test_ffi_abi.ts +218 -0
- package/test/test_ffi_bind.js +538 -8
- package/test/test_ffi_bind.ts +559 -8
- package/test/test_ffi_struct.js +632 -88
- package/test/test_ffi_struct.ts +666 -91
- package/test/test_ffi_struct_layout.js +495 -0
- package/test/test_ffi_struct_layout.ts +543 -0
- package/test/test_ffi_user32.js +103 -0
- package/test/test_ffi_user32.ts +113 -0
- package/test/test_ffi_windows.js +101 -0
- package/test/test_ffi_windows.ts +113 -0
- package/test/test_helper.js +8 -1
- package/test/test_helper.ts +9 -1
- package/test/test_http_import.js +18 -0
- package/test/test_http_import.ts +19 -0
- package/test/test_http_server.js +73 -1
- package/test/test_http_server.ts +75 -1
- package/test/test_ipv6.js +2 -2
- package/test/test_ipv6.ts +2 -2
- package/test/test_net_fetch.js +70 -8
- package/test/test_net_fetch.ts +69 -7
- package/test/test_net_websocket.js +1 -1
- package/test/test_net_websocket.ts +1 -1
- package/test/test_react_complex.js +1294 -1066
- package/test/test_react_counter.js +1284 -1056
- package/test/test_react_flex.js +1304 -1069
- package/test/test_react_hidden.js +1287 -1059
- package/test/test_react_listview_link.js +1284 -1056
- package/test/test_react_notify.js +18534 -0
- package/test/test_react_render.js +1284 -1056
- package/test/test_wolfssl_read.js +3 -2
- package/test/test_wolfssl_read.ts +3 -1
- package/test/test_worker_net.js +35 -17
- package/test/test_worker_net.ts +27 -15
- package/tsconfig.json +1 -1
- package/examples/exec_server.ts +0 -80
- package/lib/ffi-bind.js +0 -85
- package/lib/ffi-bind.ts +0 -170
- package/lib/ffi-struct.js +0 -224
- package/lib/ffi-struct.ts +0 -239
- package/lib/win-common-structs.js +0 -39
- package/lib/win-common-structs.ts +0 -41
|
@@ -1367,9 +1367,9 @@ var require_scheduler_development = __commonJS({
|
|
|
1367
1367
|
}
|
|
1368
1368
|
return first;
|
|
1369
1369
|
}
|
|
1370
|
-
function compare(a,
|
|
1371
|
-
var diff = a.sortIndex -
|
|
1372
|
-
return 0 !== diff ? diff : a.id -
|
|
1370
|
+
function compare(a, b6) {
|
|
1371
|
+
var diff = a.sortIndex - b6.sortIndex;
|
|
1372
|
+
return 0 !== diff ? diff : a.id - b6.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,
|
|
1670
|
+
for (var a = fiber, b6 = 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
|
-
|
|
1676
|
-
if (null !==
|
|
1677
|
-
a =
|
|
1675
|
+
b6 = parentA.return;
|
|
1676
|
+
if (null !== b6) {
|
|
1677
|
+
a = b6;
|
|
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 ===
|
|
1685
|
+
if (parentB === b6) 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 !==
|
|
1690
|
+
if (a.return !== b6.return) a = parentA, b6 = 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
|
-
|
|
1696
|
+
b6 = parentB;
|
|
1697
1697
|
break;
|
|
1698
1698
|
}
|
|
1699
|
-
if (_child ===
|
|
1699
|
+
if (_child === b6) {
|
|
1700
1700
|
didFindChild = true;
|
|
1701
|
-
|
|
1701
|
+
b6 = 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
|
-
|
|
1712
|
+
b6 = parentA;
|
|
1713
1713
|
break;
|
|
1714
1714
|
}
|
|
1715
|
-
if (_child ===
|
|
1715
|
+
if (_child === b6) {
|
|
1716
1716
|
didFindChild = true;
|
|
1717
|
-
|
|
1717
|
+
b6 = 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 !==
|
|
1729
|
+
if (a.alternate !== b6)
|
|
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,
|
|
15074
|
+
exports2.discreteUpdates = function(fn, a, b6, c, d) {
|
|
15075
15075
|
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
15076
15076
|
try {
|
|
15077
|
-
return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a,
|
|
15077
|
+
return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b6, c, d);
|
|
15078
15078
|
} finally {
|
|
15079
15079
|
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS);
|
|
15080
15080
|
}
|
|
@@ -15357,142 +15357,19 @@ 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 gui19 from "gui";
|
|
15361
|
-
import * as os4 from "os";
|
|
15362
|
-
|
|
15363
|
-
// _build/lib/react-qw/index.js
|
|
15364
15360
|
import * as gui18 from "gui";
|
|
15361
|
+
import * as os5 from "os";
|
|
15365
15362
|
|
|
15366
|
-
// _build/lib/react-qw/
|
|
15367
|
-
|
|
15368
|
-
var import_react = __toESM(require_react(), 1);
|
|
15369
|
-
var import_constants = __toESM(require_constants(), 1);
|
|
15370
|
-
import * as gui3 from "gui";
|
|
15371
|
-
import * as os from "os";
|
|
15372
|
-
|
|
15373
|
-
// _build/lib/react-qw/props.js
|
|
15374
|
-
import * as gui from "gui";
|
|
15375
|
-
function applyProps(instance, newProps, _oldProps) {
|
|
15376
|
-
const hwnd2 = instance.hwnd;
|
|
15377
|
-
instance.props = newProps;
|
|
15378
|
-
const textVal = "text" in newProps ? newProps.text : typeof newProps.children === "string" ? newProps.children : typeof newProps.children === "number" ? String(newProps.children) : void 0;
|
|
15379
|
-
if (textVal !== void 0) {
|
|
15380
|
-
let cursor = -1;
|
|
15381
|
-
if (instance.type === "EDIT") {
|
|
15382
|
-
const sel = gui.SendMessage(hwnd2, 176, 0, 0);
|
|
15383
|
-
cursor = sel >>> 16;
|
|
15384
|
-
}
|
|
15385
|
-
gui.SetWindowText(hwnd2, textVal);
|
|
15386
|
-
if (instance.type === "EDIT" && cursor >= 0) {
|
|
15387
|
-
gui.SendMessage(hwnd2, 177, cursor, cursor);
|
|
15388
|
-
}
|
|
15389
|
-
}
|
|
15390
|
-
if ("disabled" in newProps) {
|
|
15391
|
-
gui.EnableWindow(hwnd2, !newProps.disabled);
|
|
15392
|
-
}
|
|
15393
|
-
if ("hidden" in newProps) {
|
|
15394
|
-
gui.ShowWindow(
|
|
15395
|
-
hwnd2,
|
|
15396
|
-
newProps.hidden ? 0 : 5
|
|
15397
|
-
/* gui.ShowWindowCmd.SHOW */
|
|
15398
|
-
);
|
|
15399
|
-
}
|
|
15400
|
-
if ("visible" in newProps) {
|
|
15401
|
-
gui.ShowWindow(
|
|
15402
|
-
hwnd2,
|
|
15403
|
-
newProps.visible ? 5 : 0
|
|
15404
|
-
/* gui.ShowWindowCmd.HIDE */
|
|
15405
|
-
);
|
|
15406
|
-
}
|
|
15407
|
-
}
|
|
15408
|
-
|
|
15409
|
-
// _build/lib/react-qw/layout.js
|
|
15410
|
-
var DEFAULT_W = 100;
|
|
15411
|
-
var DEFAULT_H = 30;
|
|
15412
|
-
function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
15413
|
-
const dir = flex.flexDirection || "column";
|
|
15414
|
-
const gap = flex.gap ?? 0;
|
|
15415
|
-
const justify = flex.justifyContent || "flex-start";
|
|
15416
|
-
const align = flex.alignItems || "stretch";
|
|
15417
|
-
const isRow = dir === "row";
|
|
15418
|
-
const n = children.length;
|
|
15419
|
-
const mainSize = isRow ? "w" : "h";
|
|
15420
|
-
const crossSize = isRow ? "h" : "w";
|
|
15421
|
-
const mainPos = isRow ? "x" : "y";
|
|
15422
|
-
const crossPos = isRow ? "y" : "x";
|
|
15423
|
-
const mainDim = isRow ? "width" : "height";
|
|
15424
|
-
const crossDim = isRow ? "height" : "width";
|
|
15425
|
-
const pt = flex.paddingTop ?? flex.padding ?? 0;
|
|
15426
|
-
const pr = flex.paddingRight ?? flex.padding ?? 0;
|
|
15427
|
-
const pb = flex.paddingBottom ?? flex.padding ?? 0;
|
|
15428
|
-
const pl = flex.paddingLeft ?? flex.padding ?? 0;
|
|
15429
|
-
const mainPadding = isRow ? pl + pr : pt + pb;
|
|
15430
|
-
const crossPadding = isRow ? pt + pb : pl + pr;
|
|
15431
|
-
const parentMain = (isRow ? parentW : parentH) - mainPadding;
|
|
15432
|
-
const parentCross = (isRow ? parentH : parentW) - crossPadding;
|
|
15433
|
-
const sizes = children.map((c) => ({
|
|
15434
|
-
w: typeof c.style.width === "number" ? c.style.width : DEFAULT_W,
|
|
15435
|
-
h: typeof c.style.height === "number" ? c.style.height : DEFAULT_H
|
|
15436
|
-
}));
|
|
15437
|
-
const flexGrows = children.map((c) => c.style.flexGrow ?? 0);
|
|
15438
|
-
const totalGrow = flexGrows.reduce((s, g) => s + g, 0);
|
|
15439
|
-
const baseMain = sizes.reduce((s, c) => s + c[mainSize], 0);
|
|
15440
|
-
let freeGrow = parentMain - baseMain - Math.max(0, n - 1) * gap;
|
|
15441
|
-
if (totalGrow > 0 && freeGrow > 0) {
|
|
15442
|
-
for (let i = 0; i < n; i++) {
|
|
15443
|
-
sizes[i][mainSize] += freeGrow * flexGrows[i] / totalGrow;
|
|
15444
|
-
}
|
|
15445
|
-
}
|
|
15446
|
-
const totalMain = sizes.reduce((s, c) => s + c[mainSize], 0);
|
|
15447
|
-
const free = parentMain - totalMain - Math.max(0, n - 1) * gap;
|
|
15448
|
-
let offset = 0, extraGap = 0;
|
|
15449
|
-
if (justify === "flex-end")
|
|
15450
|
-
offset = free;
|
|
15451
|
-
else if (justify === "center")
|
|
15452
|
-
offset = Math.max(0, free / 2);
|
|
15453
|
-
else if (justify === "space-between" && n > 1)
|
|
15454
|
-
extraGap = free / (n - 1);
|
|
15455
|
-
else if (justify === "space-around") {
|
|
15456
|
-
extraGap = free / n;
|
|
15457
|
-
offset = extraGap / 2;
|
|
15458
|
-
} else if (justify === "space-evenly") {
|
|
15459
|
-
extraGap = free / (n + 1);
|
|
15460
|
-
offset = extraGap;
|
|
15461
|
-
}
|
|
15462
|
-
let cursor = offset;
|
|
15463
|
-
return sizes.map((sz, i) => {
|
|
15464
|
-
const childCrossBase = sz[crossSize];
|
|
15465
|
-
const childAlign = children[i].style.alignSelf ?? "auto";
|
|
15466
|
-
const effectiveAlign = childAlign === "auto" ? align : childAlign;
|
|
15467
|
-
let childMain = sz[mainSize];
|
|
15468
|
-
let childCross = childCrossBase;
|
|
15469
|
-
const res = { x: 0, y: 0, width: 0, height: 0 };
|
|
15470
|
-
res[mainPos] = cursor;
|
|
15471
|
-
res[crossPos] = 0;
|
|
15472
|
-
res[mainDim] = childMain;
|
|
15473
|
-
res[crossDim] = childCross;
|
|
15474
|
-
if (effectiveAlign === "stretch") {
|
|
15475
|
-
const hasExplicitCross = typeof children[i].style[crossDim] === "number";
|
|
15476
|
-
if (!hasExplicitCross) {
|
|
15477
|
-
res[crossDim] = parentCross;
|
|
15478
|
-
res[crossPos] = 0;
|
|
15479
|
-
}
|
|
15480
|
-
} else if (effectiveAlign === "flex-end") {
|
|
15481
|
-
res[crossPos] = parentCross - childCross;
|
|
15482
|
-
} else if (effectiveAlign === "center") {
|
|
15483
|
-
res[crossPos] = Math.max(0, (parentCross - childCross) / 2);
|
|
15484
|
-
}
|
|
15485
|
-
cursor += childMain + gap + extraGap;
|
|
15486
|
-
return res;
|
|
15487
|
-
});
|
|
15488
|
-
}
|
|
15363
|
+
// _build/lib/react-qw/index.js
|
|
15364
|
+
import * as gui17 from "gui";
|
|
15489
15365
|
|
|
15490
|
-
// _build/lib/
|
|
15491
|
-
import * as
|
|
15492
|
-
import * as gui2 from "gui";
|
|
15366
|
+
// _build/lib/windows/user32.js
|
|
15367
|
+
import * as os3 from "os";
|
|
15493
15368
|
|
|
15494
|
-
// _build/lib/ffi
|
|
15369
|
+
// _build/lib/ffi/bind.js
|
|
15495
15370
|
import * as ffi from "ffi";
|
|
15371
|
+
import * as os2 from "os";
|
|
15372
|
+
import * as std from "std";
|
|
15496
15373
|
import * as win from "win";
|
|
15497
15374
|
|
|
15498
15375
|
// _build/lib/text-codec.js
|
|
@@ -15515,62 +15392,62 @@ function _normalizeLabel(label) {
|
|
|
15515
15392
|
function _decodeUTF8(buf, fatal) {
|
|
15516
15393
|
let out = "";
|
|
15517
15394
|
for (let i = 0; i < buf.length; ) {
|
|
15518
|
-
const
|
|
15519
|
-
if (
|
|
15520
|
-
out += String.fromCharCode(
|
|
15395
|
+
const b6 = buf[i++];
|
|
15396
|
+
if (b6 < 128) {
|
|
15397
|
+
out += String.fromCharCode(b6);
|
|
15521
15398
|
continue;
|
|
15522
15399
|
}
|
|
15523
|
-
if (
|
|
15400
|
+
if (b6 < 192) {
|
|
15524
15401
|
out += fatal ? (() => {
|
|
15525
15402
|
throw new TypeError("unexpected continuation byte");
|
|
15526
15403
|
})() : "\uFFFD";
|
|
15527
15404
|
continue;
|
|
15528
15405
|
}
|
|
15529
15406
|
let c, min;
|
|
15530
|
-
if (
|
|
15407
|
+
if (b6 < 224) {
|
|
15531
15408
|
if (i >= buf.length) {
|
|
15532
15409
|
out += fatal ? (() => {
|
|
15533
15410
|
throw new TypeError("incomplete utf-8");
|
|
15534
15411
|
})() : "\uFFFD";
|
|
15535
15412
|
break;
|
|
15536
15413
|
}
|
|
15537
|
-
const
|
|
15538
|
-
if ((
|
|
15414
|
+
const b22 = buf[i++];
|
|
15415
|
+
if ((b22 & 192) !== 128) {
|
|
15539
15416
|
out += "\uFFFD";
|
|
15540
15417
|
continue;
|
|
15541
15418
|
}
|
|
15542
|
-
c = (
|
|
15419
|
+
c = (b6 & 31) << 6 | b22 & 63;
|
|
15543
15420
|
min = 128;
|
|
15544
|
-
} else if (
|
|
15421
|
+
} else if (b6 < 240) {
|
|
15545
15422
|
if (i + 1 >= buf.length) {
|
|
15546
15423
|
out += fatal ? (() => {
|
|
15547
15424
|
throw new TypeError("incomplete utf-8");
|
|
15548
15425
|
})() : "\uFFFD";
|
|
15549
15426
|
break;
|
|
15550
15427
|
}
|
|
15551
|
-
const
|
|
15552
|
-
const
|
|
15553
|
-
if ((
|
|
15428
|
+
const b22 = buf[i++];
|
|
15429
|
+
const b32 = buf[i++];
|
|
15430
|
+
if ((b22 & 192) !== 128 || (b32 & 192) !== 128) {
|
|
15554
15431
|
out += "\uFFFD";
|
|
15555
15432
|
continue;
|
|
15556
15433
|
}
|
|
15557
|
-
c = (
|
|
15434
|
+
c = (b6 & 15) << 12 | (b22 & 63) << 6 | b32 & 63;
|
|
15558
15435
|
min = 2048;
|
|
15559
|
-
} else if (
|
|
15436
|
+
} else if (b6 < 248) {
|
|
15560
15437
|
if (i + 2 >= buf.length) {
|
|
15561
15438
|
out += fatal ? (() => {
|
|
15562
15439
|
throw new TypeError("incomplete utf-8");
|
|
15563
15440
|
})() : "\uFFFD";
|
|
15564
15441
|
break;
|
|
15565
15442
|
}
|
|
15566
|
-
const
|
|
15567
|
-
const
|
|
15568
|
-
const
|
|
15569
|
-
if ((
|
|
15443
|
+
const b22 = buf[i++];
|
|
15444
|
+
const b32 = buf[i++];
|
|
15445
|
+
const b42 = buf[i++];
|
|
15446
|
+
if ((b22 & 192) !== 128 || (b32 & 192) !== 128 || (b42 & 192) !== 128) {
|
|
15570
15447
|
out += "\uFFFD";
|
|
15571
15448
|
continue;
|
|
15572
15449
|
}
|
|
15573
|
-
c = (
|
|
15450
|
+
c = (b6 & 7) << 18 | (b22 & 63) << 12 | (b32 & 63) << 6 | b42 & 63;
|
|
15574
15451
|
min = 65536;
|
|
15575
15452
|
} else {
|
|
15576
15453
|
out += fatal ? (() => {
|
|
@@ -15708,66 +15585,151 @@ if (typeof globalThis.TextEncoder === "undefined") {
|
|
|
15708
15585
|
globalThis.TextEncoder = TextEncoderImpl;
|
|
15709
15586
|
}
|
|
15710
15587
|
|
|
15711
|
-
// _build/lib/ffi
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15588
|
+
// _build/lib/ffi/ctype.js
|
|
15589
|
+
import { bufferPtr } from "ffi";
|
|
15590
|
+
import * as os from "os";
|
|
15591
|
+
var C_BASIC_TYPE = [
|
|
15592
|
+
"void",
|
|
15593
|
+
"u8",
|
|
15594
|
+
"i8",
|
|
15595
|
+
"u16",
|
|
15596
|
+
"i16",
|
|
15597
|
+
"u32",
|
|
15598
|
+
"i32",
|
|
15599
|
+
"u64",
|
|
15600
|
+
"i64",
|
|
15601
|
+
"f32",
|
|
15602
|
+
"f64",
|
|
15603
|
+
"ptr"
|
|
15604
|
+
];
|
|
15605
|
+
var PTR_TOKEN_RE = /^<([^<>\s]*)>ptr(!|@[A-Za-z_]\w*)?$/;
|
|
15606
|
+
function isCPtrToken(t) {
|
|
15607
|
+
return PTR_TOKEN_RE.test(t);
|
|
15608
|
+
}
|
|
15609
|
+
function ptrName(t) {
|
|
15610
|
+
const m = PTR_TOKEN_RE.exec(t);
|
|
15611
|
+
return m?.[1] || "";
|
|
15612
|
+
}
|
|
15613
|
+
var cTokenToType = (t) => {
|
|
15614
|
+
if (isCPtrToken(t))
|
|
15615
|
+
return "ptr";
|
|
15616
|
+
else
|
|
15617
|
+
return t;
|
|
15726
15618
|
};
|
|
15727
|
-
var
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
HRESULT: "i32",
|
|
15740
|
-
SHORT: "i16",
|
|
15741
|
-
USHORT: "u16",
|
|
15742
|
-
BYTE: "u8",
|
|
15743
|
-
LONG_PTR: "ptr",
|
|
15744
|
-
ULONG_PTR: "ptr",
|
|
15745
|
-
INT_PTR: "ptr",
|
|
15746
|
-
UINT_PTR: "ptr",
|
|
15747
|
-
DWORD_PTR: "ptr",
|
|
15748
|
-
SIZE_T: "ptr",
|
|
15749
|
-
WPARAM: "ptr",
|
|
15750
|
-
LPARAM: "ptr",
|
|
15751
|
-
HANDLE: "ptr",
|
|
15752
|
-
HWND: "ptr",
|
|
15753
|
-
HDC: "ptr",
|
|
15754
|
-
HMODULE: "ptr",
|
|
15755
|
-
HFONT: "ptr",
|
|
15756
|
-
HBRUSH: "ptr",
|
|
15757
|
-
HICON: "ptr",
|
|
15758
|
-
HBITMAP: "ptr",
|
|
15759
|
-
LPVOID: "ptr",
|
|
15760
|
-
LPCVOID: "ptr",
|
|
15761
|
-
LPCWSTR: "ptr",
|
|
15762
|
-
PCWSTR: "ptr",
|
|
15763
|
-
LPWSTR: "ptr"
|
|
15619
|
+
var PTR_SIZE = os.arch === "x64" ? 8 : 4;
|
|
15620
|
+
var SizeAlign = {
|
|
15621
|
+
u8: 1,
|
|
15622
|
+
i8: 1,
|
|
15623
|
+
u16: 2,
|
|
15624
|
+
i16: 2,
|
|
15625
|
+
u32: 4,
|
|
15626
|
+
i32: 4,
|
|
15627
|
+
u64: 8,
|
|
15628
|
+
i64: 8,
|
|
15629
|
+
f32: 4,
|
|
15630
|
+
f64: 8
|
|
15764
15631
|
};
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
if (
|
|
15768
|
-
|
|
15769
|
-
|
|
15632
|
+
var NULL = 0;
|
|
15633
|
+
function normToken(t) {
|
|
15634
|
+
if (isCPtrToken(t)) {
|
|
15635
|
+
const m = PTR_TOKEN_RE.exec(t);
|
|
15636
|
+
return m?.[2]?.startsWith("@") ? `<${m[1]}>ptr` : t;
|
|
15637
|
+
}
|
|
15638
|
+
const at = t.indexOf("@");
|
|
15639
|
+
const base = at >= 0 ? t.slice(0, at) : t;
|
|
15640
|
+
const suffixOk = at < 0 || /^[A-Za-z_]\w*$/.test(t.slice(at + 1));
|
|
15641
|
+
if (suffixOk && base !== "ptr" && C_BASIC_TYPE.includes(base))
|
|
15642
|
+
return base;
|
|
15643
|
+
throw new Error("Unknown token: " + t);
|
|
15644
|
+
}
|
|
15645
|
+
function readScalar(dv, off, k) {
|
|
15646
|
+
switch (k) {
|
|
15647
|
+
case "u8":
|
|
15648
|
+
return dv.getUint8(off);
|
|
15649
|
+
case "i8":
|
|
15650
|
+
return dv.getInt8(off);
|
|
15651
|
+
case "u16":
|
|
15652
|
+
return dv.getUint16(off, true);
|
|
15653
|
+
case "i16":
|
|
15654
|
+
return dv.getInt16(off, true);
|
|
15655
|
+
case "u32":
|
|
15656
|
+
return dv.getUint32(off, true);
|
|
15657
|
+
case "i32":
|
|
15658
|
+
return dv.getInt32(off, true);
|
|
15659
|
+
case "u64":
|
|
15660
|
+
return dv.getBigUint64(off, true);
|
|
15661
|
+
case "i64":
|
|
15662
|
+
return dv.getBigInt64(off, true);
|
|
15663
|
+
case "f32":
|
|
15664
|
+
return dv.getFloat32(off, true);
|
|
15665
|
+
case "f64":
|
|
15666
|
+
return dv.getFloat64(off, true);
|
|
15667
|
+
case "ptr": {
|
|
15668
|
+
return PTR_SIZE === 8 ? Number(dv.getBigInt64(off, true)) : dv.getInt32(off, true);
|
|
15669
|
+
}
|
|
15670
|
+
}
|
|
15770
15671
|
}
|
|
15672
|
+
function writeScalar(dv, off, { k, v }) {
|
|
15673
|
+
switch (k) {
|
|
15674
|
+
case "u8":
|
|
15675
|
+
dv.setUint8(off, Number(v));
|
|
15676
|
+
break;
|
|
15677
|
+
case "i8":
|
|
15678
|
+
dv.setInt8(off, Number(v));
|
|
15679
|
+
break;
|
|
15680
|
+
case "u16":
|
|
15681
|
+
dv.setUint16(off, Number(v), true);
|
|
15682
|
+
break;
|
|
15683
|
+
case "i16":
|
|
15684
|
+
dv.setInt16(off, Number(v), true);
|
|
15685
|
+
break;
|
|
15686
|
+
case "u32":
|
|
15687
|
+
dv.setUint32(off, v >>> 0, true);
|
|
15688
|
+
break;
|
|
15689
|
+
case "i32":
|
|
15690
|
+
dv.setUint32(off, v >>> 0, true);
|
|
15691
|
+
break;
|
|
15692
|
+
case "u64":
|
|
15693
|
+
dv.setBigUint64(off, v, true);
|
|
15694
|
+
break;
|
|
15695
|
+
case "i64":
|
|
15696
|
+
dv.setBigInt64(off, v, true);
|
|
15697
|
+
break;
|
|
15698
|
+
case "f32":
|
|
15699
|
+
dv.setFloat32(off, v, true);
|
|
15700
|
+
break;
|
|
15701
|
+
case "f64":
|
|
15702
|
+
dv.setFloat64(off, v, true);
|
|
15703
|
+
break;
|
|
15704
|
+
case "ptr": {
|
|
15705
|
+
if (v == null) {
|
|
15706
|
+
throw new Error("ffi: got null/undefined for a ptr slot; pass the imported NULL constant for empty");
|
|
15707
|
+
}
|
|
15708
|
+
if (PTR_SIZE === 8)
|
|
15709
|
+
dv.setBigUint64(off, BigInt.asUintN(64, BigInt(v)), true);
|
|
15710
|
+
else
|
|
15711
|
+
dv.setUint32(off, v >>> 0, true);
|
|
15712
|
+
break;
|
|
15713
|
+
}
|
|
15714
|
+
}
|
|
15715
|
+
}
|
|
15716
|
+
function writeSlot(dv, off, e) {
|
|
15717
|
+
const { k, v } = e;
|
|
15718
|
+
if (k === "u8" || k === "i8" || k === "u16" || k === "i16") {
|
|
15719
|
+
dv.setUint32(off, Number(v) >>> 0, true);
|
|
15720
|
+
return;
|
|
15721
|
+
}
|
|
15722
|
+
writeScalar(dv, off, e);
|
|
15723
|
+
}
|
|
15724
|
+
var PtrArrayBuffer = class extends ArrayBuffer {
|
|
15725
|
+
ptr;
|
|
15726
|
+
constructor(byteLength) {
|
|
15727
|
+
super(byteLength);
|
|
15728
|
+
this.ptr = bufferPtr(this);
|
|
15729
|
+
}
|
|
15730
|
+
};
|
|
15731
|
+
|
|
15732
|
+
// _build/lib/ffi/bind.js
|
|
15771
15733
|
var _dllCache = /* @__PURE__ */ new Map();
|
|
15772
15734
|
function loadDll(dll) {
|
|
15773
15735
|
const cached = _dllCache.get(dll);
|
|
@@ -15781,77 +15743,923 @@ function loadDll(dll) {
|
|
|
15781
15743
|
}
|
|
15782
15744
|
function parseSig(sig) {
|
|
15783
15745
|
const parts = sig.split(" -> ");
|
|
15784
|
-
|
|
15785
|
-
if (ret === void 0 || parts.length > 2) {
|
|
15746
|
+
if (parts.length !== 2) {
|
|
15786
15747
|
throw new Error(`ffi-bind: invalid signature "${sig}" (expected "arg1 arg2 -> ret")`);
|
|
15787
15748
|
}
|
|
15788
|
-
const
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15749
|
+
const rawArgs = parts[0].split(" ").filter((t) => t !== "");
|
|
15750
|
+
const argTokens = [];
|
|
15751
|
+
for (const raw of rawArgs) {
|
|
15752
|
+
const tok = normToken(raw);
|
|
15753
|
+
if (tok === "void") {
|
|
15754
|
+
throw new Error("Void can not in args");
|
|
15755
|
+
}
|
|
15756
|
+
argTokens.push(tok);
|
|
15757
|
+
}
|
|
15758
|
+
return {
|
|
15759
|
+
argTokens,
|
|
15760
|
+
retToken: normToken(parts[1]),
|
|
15761
|
+
sig
|
|
15762
|
+
};
|
|
15763
|
+
}
|
|
15764
|
+
function makeFn(proc, sig, encoders, decoders) {
|
|
15765
|
+
const ps = parseSig(sig);
|
|
15766
|
+
return (...a) => callPacked(proc, ps, a, encoders, decoders);
|
|
15794
15767
|
}
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15768
|
+
var IA32_ARG_SIZE = {
|
|
15769
|
+
u8: 4,
|
|
15770
|
+
i8: 4,
|
|
15771
|
+
u16: 4,
|
|
15772
|
+
i16: 4,
|
|
15773
|
+
u32: 4,
|
|
15774
|
+
i32: 4,
|
|
15775
|
+
u64: 8,
|
|
15776
|
+
i64: 8,
|
|
15777
|
+
f32: 4,
|
|
15778
|
+
f64: 8,
|
|
15779
|
+
ptr: PTR_SIZE
|
|
15780
|
+
};
|
|
15781
|
+
var X64_MIN_SLOTS = 4;
|
|
15782
|
+
function callPacked(proc, { argTokens, retToken, sig }, args, encoders, decoders) {
|
|
15783
|
+
const is64 = os2.arch === "x64";
|
|
15784
|
+
const getWidth = (t, is642) => {
|
|
15785
|
+
if (is642)
|
|
15786
|
+
return 8;
|
|
15787
|
+
if (isCPtrToken(t))
|
|
15788
|
+
return PTR_SIZE;
|
|
15789
|
+
return IA32_ARG_SIZE[t];
|
|
15802
15790
|
};
|
|
15791
|
+
let total = 0;
|
|
15792
|
+
for (const t of argTokens)
|
|
15793
|
+
total += getWidth(t, is64);
|
|
15794
|
+
if (is64 && argTokens.length < X64_MIN_SLOTS)
|
|
15795
|
+
total = X64_MIN_SLOTS * 8;
|
|
15796
|
+
const argFrame = new ArrayBuffer(total);
|
|
15797
|
+
const dv = new DataView(argFrame);
|
|
15798
|
+
const held = [];
|
|
15799
|
+
let off = 0;
|
|
15800
|
+
for (let i = 0; i < argTokens.length; i++) {
|
|
15801
|
+
const argToken = argTokens[i];
|
|
15802
|
+
const nonnull = argToken.endsWith("!");
|
|
15803
|
+
const arg = args[i];
|
|
15804
|
+
if (isCPtrToken(argToken)) {
|
|
15805
|
+
const name = ptrName(argToken);
|
|
15806
|
+
if (typeof arg === "number") {
|
|
15807
|
+
if (nonnull && arg === 0)
|
|
15808
|
+
throw new Error(`ffi-bind: ${sig}: arg#${i + 1} <${name}>ptr! got 0 (null pointer forbidden here; the token marks this position non-null)`);
|
|
15809
|
+
writeSlot(dv, off, { k: "ptr", v: arg });
|
|
15810
|
+
} else {
|
|
15811
|
+
if (arg === null || arg === void 0) {
|
|
15812
|
+
throw new Error(`ffi-bind: <${name}>ptr got ${String(arg)}; pass the imported NULL constant for an empty pointer`);
|
|
15813
|
+
}
|
|
15814
|
+
const codec = encoders[name];
|
|
15815
|
+
if (!codec) {
|
|
15816
|
+
throw new Error(name === "" ? `ffi-bind: <>ptr expects number (NULL | Ptr), got ${typeof arg}; use <BYTE>ptr with a PtrArrayBuffer (new PtrArrayBuffer(n)), or ffi.bufferPtr(buf) for an address` : `ffi-bind: unknown layout "<${name}>ptr" (available: ${Object.keys(encoders).join(", ") || "none"})`);
|
|
15817
|
+
}
|
|
15818
|
+
if (!codec.encode) {
|
|
15819
|
+
throw new Error(`ffi-bind: <${name}>ptr has no encoder (out-only codec)`);
|
|
15820
|
+
}
|
|
15821
|
+
const buf = codec.encode(arg);
|
|
15822
|
+
held.push(buf);
|
|
15823
|
+
const p = buf.ptr;
|
|
15824
|
+
if (typeof p !== "number")
|
|
15825
|
+
throw new Error("ffi-bind: codec.encode must return a PtrArrayBuffer, got plain ArrayBuffer");
|
|
15826
|
+
if (nonnull && p === 0)
|
|
15827
|
+
throw new Error(`ffi-bind: ${sig}: arg#${i + 1} <${name}>ptr! encode produced 0 (null pointer forbidden here)`);
|
|
15828
|
+
writeSlot(dv, off, { k: "ptr", v: p });
|
|
15829
|
+
}
|
|
15830
|
+
} else {
|
|
15831
|
+
writeSlot(dv, off, { k: argToken, v: arg });
|
|
15832
|
+
}
|
|
15833
|
+
off += getWidth(argToken, is64);
|
|
15834
|
+
}
|
|
15835
|
+
const retBuf = new ArrayBuffer(8);
|
|
15836
|
+
const retIsFp = retToken === "f32" || retToken === "f64";
|
|
15837
|
+
ffi.ffiCall(proc, argFrame, retBuf, retIsFp ? 1 : 0);
|
|
15838
|
+
const raw = readRet(cTokenToType(retToken), retBuf);
|
|
15839
|
+
if (retToken.endsWith("!") && raw === 0)
|
|
15840
|
+
throw new Error(`ffi-bind: ${sig}: return ${retToken} got 0 (the token promises C never returns null here)`);
|
|
15841
|
+
if (isCPtrToken(retToken) && raw !== 0) {
|
|
15842
|
+
const name = ptrName(retToken);
|
|
15843
|
+
if (name !== "") {
|
|
15844
|
+
const codec = decoders[name];
|
|
15845
|
+
if (codec?.decode)
|
|
15846
|
+
return codec.decode(raw);
|
|
15847
|
+
}
|
|
15848
|
+
}
|
|
15849
|
+
return raw;
|
|
15850
|
+
}
|
|
15851
|
+
function readRet(ret, retBuf) {
|
|
15852
|
+
if (ret === "void")
|
|
15853
|
+
return void 0;
|
|
15854
|
+
return readScalar(new DataView(retBuf), 0, ret);
|
|
15855
|
+
}
|
|
15856
|
+
var WCHAR = {
|
|
15857
|
+
encode: (v) => {
|
|
15858
|
+
const u8 = new TextEncoder("utf-16le").encode(v + "\0");
|
|
15859
|
+
const out = new PtrArrayBuffer(u8.byteLength);
|
|
15860
|
+
new Uint8Array(out).set(u8);
|
|
15861
|
+
return out;
|
|
15862
|
+
},
|
|
15863
|
+
decode: (p) => {
|
|
15864
|
+
if (typeof p === "number") {
|
|
15865
|
+
let s2 = "";
|
|
15866
|
+
let addr = p;
|
|
15867
|
+
const start = addr;
|
|
15868
|
+
for (; ; ) {
|
|
15869
|
+
const lo = ffi.readByte(addr);
|
|
15870
|
+
const hi = ffi.readByte(addr + 1);
|
|
15871
|
+
if (lo === 0 && hi === 0)
|
|
15872
|
+
return s2;
|
|
15873
|
+
s2 += String.fromCharCode(lo | hi << 8);
|
|
15874
|
+
addr += 2;
|
|
15875
|
+
if (addr - start > 1 << 21) {
|
|
15876
|
+
throw new Error("ffi-bind: WCHAR decode exceeded 4MiB without NUL");
|
|
15877
|
+
}
|
|
15878
|
+
}
|
|
15879
|
+
}
|
|
15880
|
+
const u8 = new Uint8Array(p);
|
|
15881
|
+
const limit = u8.length & ~1;
|
|
15882
|
+
let s = "";
|
|
15883
|
+
for (let i = 0; i < limit; i += 2) {
|
|
15884
|
+
const c = u8[i] | u8[i + 1] << 8;
|
|
15885
|
+
if (c === 0)
|
|
15886
|
+
return s;
|
|
15887
|
+
s += String.fromCharCode(c);
|
|
15888
|
+
}
|
|
15889
|
+
return s;
|
|
15890
|
+
},
|
|
15891
|
+
alloc: (size = 256) => new PtrArrayBuffer(size * 2)
|
|
15892
|
+
};
|
|
15893
|
+
var BYTE = {
|
|
15894
|
+
encode: (v) => {
|
|
15895
|
+
if (!(v instanceof PtrArrayBuffer))
|
|
15896
|
+
throw new Error("ffi-bind: <BYTE>ptr wants a PtrArrayBuffer (new PtrArrayBuffer(n) / BYTE.alloc / struct.encode), not a plain ArrayBuffer");
|
|
15897
|
+
return v;
|
|
15898
|
+
},
|
|
15899
|
+
alloc: (byteLen) => new PtrArrayBuffer(byteLen)
|
|
15900
|
+
};
|
|
15901
|
+
var builtinCodecs = { WCHAR, BYTE };
|
|
15902
|
+
function bind(dll, name, sig, encoders, decoders) {
|
|
15903
|
+
const proc = win.GetProcAddress(loadDll(dll), name);
|
|
15904
|
+
if (!proc)
|
|
15905
|
+
throw new Error(`ffi-bind: proc "${name}" not found in ${dll}`);
|
|
15906
|
+
const effDec = decoders ?? encoders;
|
|
15907
|
+
return makeFn(proc, sig, { ...builtinCodecs, ...encoders }, { ...builtinCodecs, ...effDec ?? {} });
|
|
15803
15908
|
}
|
|
15804
|
-
|
|
15909
|
+
var leakRegistry = new FinalizationRegistry((held) => {
|
|
15910
|
+
std.printf('[ffi] closure leaked (GCed without dispose): sig="%s" ptr=0x%x\n', held.sig, held.ptr);
|
|
15911
|
+
});
|
|
15912
|
+
|
|
15913
|
+
// _build/lib/ffi/struct.js
|
|
15914
|
+
import * as ffi2 from "ffi";
|
|
15915
|
+
function alignUp(v, a) {
|
|
15916
|
+
return v + a - 1 & ~(a - 1);
|
|
15917
|
+
}
|
|
15918
|
+
var isCNumberToken = (t) => SizeAlign[t] !== void 0;
|
|
15919
|
+
function lower(v) {
|
|
15920
|
+
if (typeof v === "string") {
|
|
15921
|
+
const st = /^(u8|u16)\[(\d+)\]@(utf-8|utf-16le)$/.exec(v);
|
|
15922
|
+
if (st) {
|
|
15923
|
+
const length = Number(st[2]);
|
|
15924
|
+
if (!Number.isInteger(length) || length < 1)
|
|
15925
|
+
throw new Error(`ffi-struct: string length must be an integer >= 1, got ${length}`);
|
|
15926
|
+
const s2 = st[1] === "u8" ? 1 : 2;
|
|
15927
|
+
return { size: s2 * length, align: s2, type: { tag: "string", encoding: st[3] } };
|
|
15928
|
+
}
|
|
15929
|
+
const a = /^([^\[\]]+)\[(\d+)\]$/.exec(v);
|
|
15930
|
+
if (a) {
|
|
15931
|
+
const length = Number(a[2]);
|
|
15932
|
+
if (!Number.isInteger(length) || length < 1)
|
|
15933
|
+
throw new Error(`ffi-struct: array length must be an integer >= 1, got ${length}`);
|
|
15934
|
+
const el = lower(a[1]);
|
|
15935
|
+
if (el.type.tag === "bitfield")
|
|
15936
|
+
throw new Error("ffi-struct: bitfields cannot be array elements");
|
|
15937
|
+
return {
|
|
15938
|
+
size: el.size * length,
|
|
15939
|
+
align: el.align,
|
|
15940
|
+
type: { tag: "array", elementType: el.type, elementSize: el.size }
|
|
15941
|
+
};
|
|
15942
|
+
}
|
|
15943
|
+
const b6 = /^([A-Za-z_]\w*):(\d+)$/.exec(v);
|
|
15944
|
+
if (b6) {
|
|
15945
|
+
const rawUnit = b6[1];
|
|
15946
|
+
const unit = normToken(rawUnit);
|
|
15947
|
+
if (!isCNumberToken(unit) || unit === "f32" || unit === "f64")
|
|
15948
|
+
throw new Error(`ffi-struct: bitfield unit must be an integer type, got "${rawUnit}"`);
|
|
15949
|
+
const width = Number(b6[2]);
|
|
15950
|
+
const s2 = SizeAlign[unit];
|
|
15951
|
+
const cap = s2 * 8;
|
|
15952
|
+
if (!Number.isInteger(width) || width < 1)
|
|
15953
|
+
throw new Error(`ffi-struct: bitfield width must be an integer >= 1, got ${width}`);
|
|
15954
|
+
if (width > cap)
|
|
15955
|
+
throw new Error(`ffi-struct: bitfield width ${width} exceeds unit width ${cap}`);
|
|
15956
|
+
return { size: s2, align: s2, type: { tag: "bitfield", unit, bit: 0, width } };
|
|
15957
|
+
}
|
|
15958
|
+
const k = normToken(v);
|
|
15959
|
+
if (isCPtrToken(k))
|
|
15960
|
+
return { size: PTR_SIZE, align: PTR_SIZE, type: { tag: "basic", kind: "ptr" } };
|
|
15961
|
+
if (!isCNumberToken(k))
|
|
15962
|
+
throw new Error(`ffi-struct: unknown kind "${v}"`);
|
|
15963
|
+
const s = SizeAlign[k];
|
|
15964
|
+
return { size: s, align: s, type: { tag: "basic", kind: k } };
|
|
15965
|
+
}
|
|
15966
|
+
if (v && typeof v === "object") {
|
|
15967
|
+
const o = v;
|
|
15968
|
+
const tag = o["#"];
|
|
15969
|
+
if (tag === void 0)
|
|
15970
|
+
throw new Error(`ffi-struct: nested object value requires a '#' key ('struct' | 'union' | 'array')`);
|
|
15971
|
+
if (tag === "array" && "#pack" in o)
|
|
15972
|
+
throw new Error(`ffi-struct: '#pack' is only allowed on struct/union, got '${tag}'`);
|
|
15973
|
+
if (tag === "array") {
|
|
15974
|
+
const length = o["length"];
|
|
15975
|
+
if (!Number.isInteger(length) || length < 1)
|
|
15976
|
+
throw new Error(`ffi-struct: array length must be an integer >= 1, got ${String(length)}`);
|
|
15977
|
+
const el = lower(o["element"]);
|
|
15978
|
+
if (el.type.tag === "bitfield")
|
|
15979
|
+
throw new Error("ffi-struct: bitfields cannot be array elements");
|
|
15980
|
+
return {
|
|
15981
|
+
size: el.size * length,
|
|
15982
|
+
align: el.align,
|
|
15983
|
+
type: { tag: "array", elementType: el.type, elementSize: el.size }
|
|
15984
|
+
};
|
|
15985
|
+
}
|
|
15986
|
+
if (tag === "struct" || tag === "union") {
|
|
15987
|
+
const l = computeStructLayout(v);
|
|
15988
|
+
return { size: l.size, align: l.maxEffectiveAlign, type: { tag, fields: l.fields } };
|
|
15989
|
+
}
|
|
15990
|
+
throw new Error(`ffi-struct: unknown '#' declaration ${JSON.stringify(String(tag))}`);
|
|
15991
|
+
}
|
|
15992
|
+
throw new Error(`ffi-struct: invalid member value: ${String(v)}`);
|
|
15993
|
+
}
|
|
15994
|
+
function computeStructLayout(t) {
|
|
15995
|
+
const isStruct = t["#"] === "struct";
|
|
15996
|
+
const pack = t["#pack"] ?? 8;
|
|
15997
|
+
let maxEffectiveAlign = 1;
|
|
15998
|
+
let maxMemberSize = 0;
|
|
15999
|
+
const fields = [];
|
|
16000
|
+
let cursor = 0;
|
|
16001
|
+
let unitBase = -1;
|
|
16002
|
+
let unitBits = 0;
|
|
16003
|
+
let unitSize = 0;
|
|
16004
|
+
const flushUnit = () => {
|
|
16005
|
+
if (unitBase < 0)
|
|
16006
|
+
return;
|
|
16007
|
+
cursor = alignUp(unitBase + Math.ceil(unitBits / 8), unitSize);
|
|
16008
|
+
unitBase = -1;
|
|
16009
|
+
};
|
|
16010
|
+
for (const [rawName, v] of Object.entries(t)) {
|
|
16011
|
+
if (rawName.startsWith("#"))
|
|
16012
|
+
continue;
|
|
16013
|
+
const m = /^([^@]+)@(\d+)$/.exec(rawName);
|
|
16014
|
+
const name = m ? m[1] : rawName;
|
|
16015
|
+
const alignas = m ? Number(m[2]) : 0;
|
|
16016
|
+
const { size, align: natural, type } = lower(v);
|
|
16017
|
+
const nonnull = typeof v === "string" && v.endsWith("!");
|
|
16018
|
+
let align = natural;
|
|
16019
|
+
if (pack > 0)
|
|
16020
|
+
align = Math.min(pack, align);
|
|
16021
|
+
if (alignas)
|
|
16022
|
+
align = Math.max(align, alignas);
|
|
16023
|
+
if (type.tag === "bitfield") {
|
|
16024
|
+
if (name.startsWith("$"))
|
|
16025
|
+
throw new Error("ffi-struct: bitfield members must be named");
|
|
16026
|
+
if (!isStruct) {
|
|
16027
|
+
fields.push({ name, offset: 0, size, type: { ...type, bit: 0 } });
|
|
16028
|
+
maxEffectiveAlign = Math.max(maxEffectiveAlign, align);
|
|
16029
|
+
maxMemberSize = Math.max(maxMemberSize, size);
|
|
16030
|
+
continue;
|
|
16031
|
+
}
|
|
16032
|
+
const width = type.width;
|
|
16033
|
+
if (unitBase < 0 || size !== unitSize || unitBits + width > unitSize * 8) {
|
|
16034
|
+
if (unitBase >= 0)
|
|
16035
|
+
flushUnit();
|
|
16036
|
+
const offset2 = alignUp(cursor, align);
|
|
16037
|
+
unitBase = offset2;
|
|
16038
|
+
unitBits = 0;
|
|
16039
|
+
unitSize = size;
|
|
16040
|
+
}
|
|
16041
|
+
fields.push({
|
|
16042
|
+
name,
|
|
16043
|
+
offset: unitBase,
|
|
16044
|
+
// 单元基址(不是位域自己的地址)
|
|
16045
|
+
size,
|
|
16046
|
+
type: { ...type, bit: unitBits }
|
|
16047
|
+
});
|
|
16048
|
+
unitBits += width;
|
|
16049
|
+
maxEffectiveAlign = Math.max(maxEffectiveAlign, align);
|
|
16050
|
+
maxMemberSize = Math.max(maxMemberSize, size);
|
|
16051
|
+
continue;
|
|
16052
|
+
}
|
|
16053
|
+
flushUnit();
|
|
16054
|
+
const offset = alignUp(cursor, align);
|
|
16055
|
+
if (!name.startsWith("$")) {
|
|
16056
|
+
fields.push({ name, offset, size, type, ...nonnull ? { nonnull: true } : {} });
|
|
16057
|
+
} else {
|
|
16058
|
+
if (type.tag !== "struct" && type.tag !== "union")
|
|
16059
|
+
throw new Error(`ffi-struct: anonymous member "${name}" must be a struct/union`);
|
|
16060
|
+
for (const cf of type.fields)
|
|
16061
|
+
fields.push({ ...cf, offset: cf.offset + offset });
|
|
16062
|
+
}
|
|
16063
|
+
if (isStruct)
|
|
16064
|
+
cursor = offset + size;
|
|
16065
|
+
maxEffectiveAlign = Math.max(maxEffectiveAlign, align);
|
|
16066
|
+
maxMemberSize = Math.max(maxMemberSize, size);
|
|
16067
|
+
}
|
|
16068
|
+
flushUnit();
|
|
16069
|
+
return {
|
|
16070
|
+
size: isStruct ? alignUp(cursor, maxEffectiveAlign) : alignUp(maxMemberSize, maxEffectiveAlign),
|
|
16071
|
+
maxEffectiveAlign,
|
|
16072
|
+
fields
|
|
16073
|
+
};
|
|
16074
|
+
}
|
|
16075
|
+
function readUnitRaw(dv, off, unit) {
|
|
16076
|
+
const s = SizeAlign[unit];
|
|
16077
|
+
if (s === 1)
|
|
16078
|
+
return BigInt(dv.getUint8(off));
|
|
16079
|
+
if (s === 2)
|
|
16080
|
+
return BigInt(dv.getUint16(off, true));
|
|
16081
|
+
if (s === 4)
|
|
16082
|
+
return BigInt(dv.getUint32(off, true));
|
|
16083
|
+
return dv.getBigUint64(off, true);
|
|
16084
|
+
}
|
|
16085
|
+
function writeUnitRaw(dv, off, unit, v) {
|
|
16086
|
+
const s = SizeAlign[unit];
|
|
16087
|
+
if (s === 1) {
|
|
16088
|
+
dv.setUint8(off, Number(v & 0xffn));
|
|
16089
|
+
return;
|
|
16090
|
+
}
|
|
16091
|
+
if (s === 2) {
|
|
16092
|
+
dv.setUint16(off, Number(v & 0xffffn), true);
|
|
16093
|
+
return;
|
|
16094
|
+
}
|
|
16095
|
+
if (s === 4) {
|
|
16096
|
+
dv.setUint32(off, Number(v & 0xffffffffn), true);
|
|
16097
|
+
return;
|
|
16098
|
+
}
|
|
16099
|
+
dv.setBigUint64(off, v & 0xffffffffffffffffn, true);
|
|
16100
|
+
}
|
|
16101
|
+
function readBitfield(dv, off, t) {
|
|
16102
|
+
const w = BigInt(t.width);
|
|
16103
|
+
let v = readUnitRaw(dv, off, t.unit) >> BigInt(t.bit) & (1n << w) - 1n;
|
|
16104
|
+
if (t.unit[0] === "i" && v & 1n << w - 1n)
|
|
16105
|
+
v -= 1n << w;
|
|
16106
|
+
if (t.width > 53)
|
|
16107
|
+
return v;
|
|
16108
|
+
return Number(v);
|
|
16109
|
+
}
|
|
16110
|
+
function writeBitfield(dv, off, t, val) {
|
|
16111
|
+
const w = BigInt(t.width);
|
|
16112
|
+
const bit = BigInt(t.bit);
|
|
16113
|
+
const widthMask = (1n << w) - 1n;
|
|
16114
|
+
const posMask = widthMask << bit;
|
|
16115
|
+
const raw = readUnitRaw(dv, off, t.unit);
|
|
16116
|
+
const bits = (typeof val === "bigint" ? val : BigInt(Math.trunc(val))) & widthMask;
|
|
16117
|
+
writeUnitRaw(dv, off, t.unit, raw & ~posMask | bits << bit);
|
|
16118
|
+
}
|
|
16119
|
+
var stringEncoders = {
|
|
16120
|
+
"utf-8": new TextEncoder("utf-8"),
|
|
16121
|
+
"utf-16le": new TextEncoder("utf-16le")
|
|
16122
|
+
};
|
|
16123
|
+
var stringDecoders = {
|
|
16124
|
+
"utf-8": new TextDecoder("utf-8", { ignoreBOM: true }),
|
|
16125
|
+
"utf-16le": new TextDecoder("utf-16le", { ignoreBOM: true })
|
|
16126
|
+
};
|
|
16127
|
+
function readString(dv, off, size, enc) {
|
|
16128
|
+
const bytes = new Uint8Array(dv.buffer, dv.byteOffset + off, size);
|
|
16129
|
+
const unit = enc === "utf-16le" ? 2 : 1;
|
|
16130
|
+
let end = size;
|
|
16131
|
+
for (let i = 0; i + unit <= size; i += unit) {
|
|
16132
|
+
if (bytes[i] === 0 && (unit === 1 || bytes[i + 1] === 0)) {
|
|
16133
|
+
end = i;
|
|
16134
|
+
break;
|
|
16135
|
+
}
|
|
16136
|
+
}
|
|
16137
|
+
return stringDecoders[enc].decode(bytes.subarray(0, end));
|
|
16138
|
+
}
|
|
16139
|
+
function writeString(dv, off, size, enc, v) {
|
|
16140
|
+
const bytes = new Uint8Array(dv.buffer, dv.byteOffset + off, size);
|
|
16141
|
+
bytes.fill(0);
|
|
16142
|
+
const unit = enc === "utf-16le" ? 2 : 1;
|
|
16143
|
+
const cap = size - unit;
|
|
16144
|
+
if (cap <= 0)
|
|
16145
|
+
return;
|
|
16146
|
+
const src = stringEncoders[enc].encode(String(v ?? ""));
|
|
16147
|
+
bytes.set(src.subarray(0, Math.min(src.length, cap)));
|
|
16148
|
+
}
|
|
16149
|
+
function readArray(dv, off, size, t) {
|
|
16150
|
+
const count = t.elementSize > 0 ? size / t.elementSize : 0;
|
|
16151
|
+
const out = [];
|
|
16152
|
+
for (let i = 0; i < count; i++)
|
|
16153
|
+
out.push(readElement(dv, off + i * t.elementSize, t.elementType, t.elementSize));
|
|
16154
|
+
return out;
|
|
16155
|
+
}
|
|
16156
|
+
function writeArray(dv, off, size, t, v) {
|
|
16157
|
+
const count = t.elementSize > 0 ? size / t.elementSize : 0;
|
|
16158
|
+
const list = v ?? [];
|
|
16159
|
+
for (let i = 0; i < count; i++)
|
|
16160
|
+
writeElement(dv, off + i * t.elementSize, t.elementType, t.elementSize, list[i]);
|
|
16161
|
+
}
|
|
16162
|
+
function readElement(dv, off, t, size) {
|
|
16163
|
+
switch (t.tag) {
|
|
16164
|
+
case "basic":
|
|
16165
|
+
return readScalar(dv, off, t.kind);
|
|
16166
|
+
case "bitfield":
|
|
16167
|
+
return readBitfield(dv, off, t);
|
|
16168
|
+
case "string":
|
|
16169
|
+
return readString(dv, off, size, t.encoding);
|
|
16170
|
+
case "struct":
|
|
16171
|
+
case "union":
|
|
16172
|
+
return doDecode(dv, off, t.fields);
|
|
16173
|
+
case "array":
|
|
16174
|
+
return readArray(dv, off, size, t);
|
|
16175
|
+
}
|
|
16176
|
+
}
|
|
16177
|
+
function writeElement(dv, off, t, size, val) {
|
|
16178
|
+
switch (t.tag) {
|
|
16179
|
+
// TODO: remove this any
|
|
16180
|
+
case "basic":
|
|
16181
|
+
writeScalar(dv, off, { k: t.kind, v: val });
|
|
16182
|
+
break;
|
|
16183
|
+
// 直传(不 Number()):writeBitfield 的 val 是 number | bigint,
|
|
16184
|
+
// 64 位单元走 bigint,先 Number() 会把 >2^53 的位域值截断。
|
|
16185
|
+
case "bitfield":
|
|
16186
|
+
writeBitfield(dv, off, t, val ?? 0);
|
|
16187
|
+
break;
|
|
16188
|
+
case "string":
|
|
16189
|
+
writeString(dv, off, size, t.encoding, val);
|
|
16190
|
+
break;
|
|
16191
|
+
case "struct":
|
|
16192
|
+
case "union":
|
|
16193
|
+
doEncode(dv, off, t.fields, val ?? {});
|
|
16194
|
+
break;
|
|
16195
|
+
case "array":
|
|
16196
|
+
writeArray(dv, off, size, t, val);
|
|
16197
|
+
break;
|
|
16198
|
+
}
|
|
16199
|
+
}
|
|
16200
|
+
function doDecode(dv, base, fields) {
|
|
15805
16201
|
const out = {};
|
|
15806
|
-
const
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
out[name] = makeFn(proc, sig);
|
|
16202
|
+
for (const f of fields) {
|
|
16203
|
+
const v = readElement(dv, base + f.offset, f.type, f.size);
|
|
16204
|
+
if (f.nonnull && v === 0)
|
|
16205
|
+
throw new Error(`ffi-struct: decode: '!' field "${f.name}" got 0 (C did not fill it, or decode was called on an unfilled slot)`);
|
|
16206
|
+
out[f.name] = v;
|
|
15812
16207
|
}
|
|
15813
16208
|
return out;
|
|
15814
16209
|
}
|
|
16210
|
+
function doEncode(dv, base, fields, v) {
|
|
16211
|
+
for (const f of fields) {
|
|
16212
|
+
if (v[f.name] === void 0)
|
|
16213
|
+
continue;
|
|
16214
|
+
writeElement(dv, base + f.offset, f.type, f.size, v[f.name]);
|
|
16215
|
+
}
|
|
16216
|
+
}
|
|
16217
|
+
function createStruct(t) {
|
|
16218
|
+
const { fields, size, maxEffectiveAlign } = computeStructLayout(t);
|
|
16219
|
+
return {
|
|
16220
|
+
__struct: t,
|
|
16221
|
+
size,
|
|
16222
|
+
structAlign: maxEffectiveAlign,
|
|
16223
|
+
decode: (p) => {
|
|
16224
|
+
if (typeof p === "number") {
|
|
16225
|
+
const buf = new ArrayBuffer(size);
|
|
16226
|
+
const u8 = new Uint8Array(buf);
|
|
16227
|
+
for (let i = 0; i < size; i++)
|
|
16228
|
+
u8[i] = ffi2.readByte(p + i);
|
|
16229
|
+
return doDecode(new DataView(buf), 0, fields);
|
|
16230
|
+
}
|
|
16231
|
+
return doDecode(new DataView(p), 0, fields);
|
|
16232
|
+
},
|
|
16233
|
+
alloc: (() => new PtrArrayBuffer(size)),
|
|
16234
|
+
encode: ((v, buf) => {
|
|
16235
|
+
if (v === void 0 || v === null)
|
|
16236
|
+
throw new Error(`ffi-struct: encode(v) requires an argument; use alloc() for a zeroed out-param slot`);
|
|
16237
|
+
const out = buf ?? new PtrArrayBuffer(size);
|
|
16238
|
+
doEncode(new DataView(out), 0, fields, v);
|
|
16239
|
+
return out;
|
|
16240
|
+
}),
|
|
16241
|
+
offsetOf: (name) => {
|
|
16242
|
+
for (const f of fields)
|
|
16243
|
+
if (f.name === name)
|
|
16244
|
+
return f.offset;
|
|
16245
|
+
throw new Error(`ffi-struct: no field "${name}"`);
|
|
16246
|
+
}
|
|
16247
|
+
};
|
|
16248
|
+
}
|
|
16249
|
+
function buildDecl(kind, member, pack) {
|
|
16250
|
+
const decl = { "#": kind };
|
|
16251
|
+
if (pack !== void 0)
|
|
16252
|
+
decl["#pack"] = pack;
|
|
16253
|
+
for (const [k, v] of Object.entries(member))
|
|
16254
|
+
if (!k.startsWith("#"))
|
|
16255
|
+
decl[k] = v;
|
|
16256
|
+
return decl;
|
|
16257
|
+
}
|
|
16258
|
+
function struct(a, b6, c) {
|
|
16259
|
+
const isNamed = typeof a === "string";
|
|
16260
|
+
const raw = isNamed ? b6 : a;
|
|
16261
|
+
const opts = isNamed ? c : b6;
|
|
16262
|
+
return createStruct(buildDecl("struct", raw, opts?.pack));
|
|
16263
|
+
}
|
|
16264
|
+
|
|
16265
|
+
// _build/lib/windows/structs.js
|
|
16266
|
+
var RECT = /* @__PURE__ */ struct("RECT", {
|
|
16267
|
+
left: "i32",
|
|
16268
|
+
top: "i32",
|
|
16269
|
+
right: "i32",
|
|
16270
|
+
bottom: "i32"
|
|
16271
|
+
});
|
|
16272
|
+
var POINT = /* @__PURE__ */ struct("POINT", {
|
|
16273
|
+
x: "i32",
|
|
16274
|
+
y: "i32"
|
|
16275
|
+
});
|
|
16276
|
+
var SIZE = /* @__PURE__ */ struct("SIZE", {
|
|
16277
|
+
cx: "i32",
|
|
16278
|
+
cy: "i32"
|
|
16279
|
+
});
|
|
16280
|
+
var LOGFONTW = /* @__PURE__ */ struct("LOGFONTW", {
|
|
16281
|
+
lfHeight: "i32",
|
|
16282
|
+
lfWidth: "i32",
|
|
16283
|
+
lfEscapement: "i32",
|
|
16284
|
+
lfOrientation: "i32",
|
|
16285
|
+
lfWeight: "i32",
|
|
16286
|
+
lfItalic: "u8",
|
|
16287
|
+
lfUnderline: "u8",
|
|
16288
|
+
lfStrikeOut: "u8",
|
|
16289
|
+
lfCharSet: "u8",
|
|
16290
|
+
lfOutPrecision: "u8",
|
|
16291
|
+
lfClipPrecision: "u8",
|
|
16292
|
+
lfQuality: "u8",
|
|
16293
|
+
lfPitchAndFamily: "u8",
|
|
16294
|
+
lfFaceName: "u16[32]@utf-16le"
|
|
16295
|
+
});
|
|
16296
|
+
var OPENFILENAMEW = /* @__PURE__ */ struct("OPENFILENAMEW", {
|
|
16297
|
+
lStructSize: "u32",
|
|
16298
|
+
hwndOwner: "<HWND>ptr",
|
|
16299
|
+
hInstance: "<HMODULE>ptr",
|
|
16300
|
+
lpstrFilter: "<>ptr",
|
|
16301
|
+
lpstrCustomFilter: "<>ptr",
|
|
16302
|
+
nMaxCustFilter: "u32",
|
|
16303
|
+
nFilterIndex: "u32",
|
|
16304
|
+
lpstrFile: "<>ptr",
|
|
16305
|
+
nMaxFile: "u32",
|
|
16306
|
+
lpstrFileTitle: "<>ptr",
|
|
16307
|
+
nMaxFileTitle: "u32",
|
|
16308
|
+
lpstrInitialDir: "<>ptr",
|
|
16309
|
+
lpstrTitle: "<>ptr",
|
|
16310
|
+
Flags: "u32",
|
|
16311
|
+
nFileOffset: "u16",
|
|
16312
|
+
nFileExtension: "u16",
|
|
16313
|
+
lpstrDefExt: "<>ptr",
|
|
16314
|
+
lCustData: "<>ptr",
|
|
16315
|
+
lpfnHook: "<>ptr",
|
|
16316
|
+
lpTemplateName: "<>ptr",
|
|
16317
|
+
pvReserved: "<>ptr",
|
|
16318
|
+
dwReserved: "u32",
|
|
16319
|
+
FlagsEx: "u32"
|
|
16320
|
+
});
|
|
16321
|
+
var BROWSEINFOW = /* @__PURE__ */ struct("BROWSEINFOW", {
|
|
16322
|
+
hwndOwner: "<HWND>ptr",
|
|
16323
|
+
pidlRoot: "<>ptr",
|
|
16324
|
+
pszDisplayName: "<>ptr",
|
|
16325
|
+
lpszTitle: "<>ptr",
|
|
16326
|
+
ulFlags: "u32",
|
|
16327
|
+
lpfn: "<>ptr",
|
|
16328
|
+
lParam: "<>ptr",
|
|
16329
|
+
iImage: "i32"
|
|
16330
|
+
});
|
|
16331
|
+
var NMHDR = /* @__PURE__ */ struct("NMHDR", {
|
|
16332
|
+
hwndFrom: "<HWND>ptr",
|
|
16333
|
+
idFrom: "<>ptr",
|
|
16334
|
+
code: "i32"
|
|
16335
|
+
});
|
|
16336
|
+
var SYSTEMTIME = /* @__PURE__ */ struct("SYSTEMTIME", {
|
|
16337
|
+
wYear: "u16",
|
|
16338
|
+
wMonth: "u16",
|
|
16339
|
+
wDayOfWeek: "u16",
|
|
16340
|
+
wDay: "u16",
|
|
16341
|
+
wHour: "u16",
|
|
16342
|
+
wMinute: "u16",
|
|
16343
|
+
wSecond: "u16",
|
|
16344
|
+
wMilliseconds: "u16"
|
|
16345
|
+
});
|
|
16346
|
+
var NMDATETIMECHANGE = /* @__PURE__ */ struct("NMDATETIMECHANGE", {
|
|
16347
|
+
hdr: NMHDR.__struct,
|
|
16348
|
+
dwFlags: "u32",
|
|
16349
|
+
st: SYSTEMTIME.__struct
|
|
16350
|
+
});
|
|
16351
|
+
var LITEM = /* @__PURE__ */ struct("LITEM", {
|
|
16352
|
+
mask: "u32",
|
|
16353
|
+
iLink: "i32",
|
|
16354
|
+
state: "u32",
|
|
16355
|
+
stateMask: "u32",
|
|
16356
|
+
szID: "u16[48]@utf-16le",
|
|
16357
|
+
szUrl: "u16[2084]@utf-16le"
|
|
16358
|
+
});
|
|
16359
|
+
var NMLINK = /* @__PURE__ */ struct("NMLINK", {
|
|
16360
|
+
hdr: NMHDR.__struct,
|
|
16361
|
+
item: LITEM.__struct
|
|
16362
|
+
});
|
|
16363
|
+
var NMCUSTOMDRAW = /* @__PURE__ */ struct("NMCUSTOMDRAW", {
|
|
16364
|
+
hdr: NMHDR.__struct,
|
|
16365
|
+
dwDrawStage: "u32",
|
|
16366
|
+
hdc: "<HDC>ptr",
|
|
16367
|
+
rc: "i32[4]",
|
|
16368
|
+
dwItemSpec: "<>ptr",
|
|
16369
|
+
uItemState: "u32",
|
|
16370
|
+
lItemlParam: "<>ptr"
|
|
16371
|
+
});
|
|
16372
|
+
var NMLVCUSTOMDRAW = /* @__PURE__ */ struct("NMLVCUSTOMDRAW", {
|
|
16373
|
+
hdr: NMHDR.__struct,
|
|
16374
|
+
dwDrawStage: "u32",
|
|
16375
|
+
hdc: "<HDC>ptr",
|
|
16376
|
+
rc: "i32[4]",
|
|
16377
|
+
dwItemSpec: "<>ptr",
|
|
16378
|
+
uItemState: "u32",
|
|
16379
|
+
lItemlParam: "<>ptr",
|
|
16380
|
+
clrText: "u32",
|
|
16381
|
+
clrTextBk: "u32",
|
|
16382
|
+
iSubItem: "i32",
|
|
16383
|
+
dwItemType: "u32"
|
|
16384
|
+
});
|
|
16385
|
+
var NMLISTVIEW = /* @__PURE__ */ struct("NMLISTVIEW", {
|
|
16386
|
+
hdr: NMHDR.__struct,
|
|
16387
|
+
iItem: "i32",
|
|
16388
|
+
iSubItem: "i32",
|
|
16389
|
+
uNewState: "u32",
|
|
16390
|
+
uOldState: "u32",
|
|
16391
|
+
uChanged: "u32",
|
|
16392
|
+
ptAction: "i32[2]",
|
|
16393
|
+
lParam: "<>ptr"
|
|
16394
|
+
});
|
|
16395
|
+
var TCITEMW = /* @__PURE__ */ struct("TCITEMW", {
|
|
16396
|
+
mask: "u32",
|
|
16397
|
+
dwState: "u32",
|
|
16398
|
+
dwStateMask: "u32",
|
|
16399
|
+
pszText: "<>ptr",
|
|
16400
|
+
cchTextMax: "i32",
|
|
16401
|
+
iImage: "i32",
|
|
16402
|
+
lParam: "<>ptr"
|
|
16403
|
+
});
|
|
16404
|
+
var TVITEM = /* @__PURE__ */ struct("TVITEM", {
|
|
16405
|
+
mask: "u32",
|
|
16406
|
+
hItem: "<>ptr",
|
|
16407
|
+
state: "u32",
|
|
16408
|
+
stateMask: "u32",
|
|
16409
|
+
pszText: "<>ptr",
|
|
16410
|
+
cchTextMax: "i32",
|
|
16411
|
+
iImage: "i32",
|
|
16412
|
+
iSelectedImage: "i32",
|
|
16413
|
+
cChildren: "i32",
|
|
16414
|
+
lParam: "<>ptr"
|
|
16415
|
+
});
|
|
16416
|
+
var TVINSERTSTRUCT = /* @__PURE__ */ struct("TVINSERTSTRUCT", {
|
|
16417
|
+
hParent: "<>ptr",
|
|
16418
|
+
hInsertAfter: "<>ptr",
|
|
16419
|
+
item: TVITEM.__struct
|
|
16420
|
+
});
|
|
16421
|
+
var LVHITTESTINFO = /* @__PURE__ */ struct("LVHITTESTINFO", {
|
|
16422
|
+
pt: "i32[2]",
|
|
16423
|
+
flags: "u32",
|
|
16424
|
+
iItem: "i32",
|
|
16425
|
+
iSubItem: "i32",
|
|
16426
|
+
iGroup: "i32"
|
|
16427
|
+
});
|
|
16428
|
+
var LVITEMW = /* @__PURE__ */ struct("LVITEMW", {
|
|
16429
|
+
mask: "u32",
|
|
16430
|
+
iItem: "i32",
|
|
16431
|
+
iSubItem: "i32",
|
|
16432
|
+
state: "u32",
|
|
16433
|
+
stateMask: "u32",
|
|
16434
|
+
pszText: "<>ptr",
|
|
16435
|
+
cchTextMax: "i32",
|
|
16436
|
+
iImage: "i32",
|
|
16437
|
+
lParam: "<>ptr",
|
|
16438
|
+
iIndent: "i32",
|
|
16439
|
+
iGroupId: "i32",
|
|
16440
|
+
cColumns: "u32",
|
|
16441
|
+
puColumns: "<>ptr",
|
|
16442
|
+
piColFmt: "<>ptr",
|
|
16443
|
+
iGroup: "i32"
|
|
16444
|
+
});
|
|
16445
|
+
var LVCOLUMNW = /* @__PURE__ */ struct("LVCOLUMNW", {
|
|
16446
|
+
mask: "u32",
|
|
16447
|
+
fmt: "i32",
|
|
16448
|
+
cx: "i32",
|
|
16449
|
+
pszText: "<>ptr",
|
|
16450
|
+
cchTextMax: "i32",
|
|
16451
|
+
iSubItem: "i32",
|
|
16452
|
+
iImage: "i32",
|
|
16453
|
+
iOrder: "i32",
|
|
16454
|
+
cxMin: "i32",
|
|
16455
|
+
cxDefault: "i32",
|
|
16456
|
+
cxIdeal: "i32"
|
|
16457
|
+
});
|
|
16458
|
+
var MSG = /* @__PURE__ */ struct("MSG", {
|
|
16459
|
+
hwnd: "<HWND>ptr",
|
|
16460
|
+
message: "u32",
|
|
16461
|
+
wParam: "<>ptr",
|
|
16462
|
+
lParam: "<>ptr",
|
|
16463
|
+
time: "u32",
|
|
16464
|
+
pt: POINT.__struct
|
|
16465
|
+
});
|
|
16466
|
+
var PAINTSTRUCT = /* @__PURE__ */ struct("PAINTSTRUCT", {
|
|
16467
|
+
hdc: "<HDC>ptr",
|
|
16468
|
+
fErase: "i32",
|
|
16469
|
+
rcPaint: RECT.__struct,
|
|
16470
|
+
fRestore: "i32",
|
|
16471
|
+
fIncUpdate: "i32",
|
|
16472
|
+
rgbReserved: "u8[32]"
|
|
16473
|
+
});
|
|
16474
|
+
|
|
16475
|
+
// _build/lib/windows/user32.js
|
|
16476
|
+
var b = (name, sig, encoders) => bind("user32.dll", name, sig, encoders);
|
|
16477
|
+
var _bProbe = b("GetDesktopWindow", " -> <HWND>ptr");
|
|
16478
|
+
var LONG_PTR_SYM = os3.arch === "x64" ? "PtrW" : "W";
|
|
16479
|
+
var SetWindowPos = /* @__PURE__ */ b("SetWindowPos", "<HWND>ptr <>ptr@SetWindowPosHwnd i32 i32 i32 i32 u32 -> i32");
|
|
16480
|
+
var SetWindowText = /* @__PURE__ */ b("SetWindowTextW", "<HWND>ptr <WCHAR>ptr -> i32");
|
|
16481
|
+
var GetWindowLongPtr = /* @__PURE__ */ b("GetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp -> <>ptr");
|
|
16482
|
+
var SetWindowLongPtr = /* @__PURE__ */ b("SetWindowLong" + LONG_PTR_SYM, "<HWND>ptr i32@Gwlp <>ptr -> <>ptr");
|
|
16483
|
+
var EnableWindow = /* @__PURE__ */ b("EnableWindow", "<HWND>ptr i32 -> i32");
|
|
16484
|
+
var SetParent = /* @__PURE__ */ b("SetParent", "<HWND>ptr <HWND>ptr -> <HWND>ptr");
|
|
16485
|
+
var DefWindowProc = /* @__PURE__ */ b("DefWindowProcW", "<HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
|
|
16486
|
+
var CallWindowProc = /* @__PURE__ */ b("CallWindowProcW", "<>ptr <HWND>ptr u32@AnyMsg <>ptr <>ptr -> <>ptr");
|
|
16487
|
+
var GetDC = /* @__PURE__ */ b("GetDC", "<HWND>ptr -> <HDC>ptr");
|
|
16488
|
+
var ReleaseDC = /* @__PURE__ */ b("ReleaseDC", "<HWND>ptr <HDC>ptr! -> i32");
|
|
16489
|
+
var DrawText = /* @__PURE__ */ b("DrawTextW", "<HDC>ptr! <WCHAR>ptr i32 <RECT>ptr i32 -> i32");
|
|
16490
|
+
var InvalidateRect = /* @__PURE__ */ b("InvalidateRect", "<HWND>ptr <RECT>ptr i32 -> i32", { RECT });
|
|
16491
|
+
var SetCursor = /* @__PURE__ */ b("SetCursor", "<HCURSOR>ptr -> <HCURSOR>ptr");
|
|
16492
|
+
var LoadCursor = /* @__PURE__ */ b("LoadCursorW", "<HMODULE>ptr <>ptr -> <HCURSOR>ptr");
|
|
16493
|
+
var GetCursorPos = /* @__PURE__ */ b("GetCursorPos", "<POINT>ptr -> i32");
|
|
16494
|
+
var ScreenToClient = /* @__PURE__ */ b("ScreenToClient", "<HWND>ptr <POINT>ptr -> i32");
|
|
16495
|
+
var ShowScrollBar = /* @__PURE__ */ b("ShowScrollBar", "<HWND>ptr u32 i32 -> i32");
|
|
16496
|
+
var GetSystemMetrics = /* @__PURE__ */ b("GetSystemMetrics", "i32 -> i32");
|
|
16497
|
+
|
|
16498
|
+
// _build/lib/react-qw/reconciler.js
|
|
16499
|
+
var import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
16500
|
+
var import_react = __toESM(require_react(), 1);
|
|
16501
|
+
var import_constants = __toESM(require_constants(), 1);
|
|
16502
|
+
import * as gui3 from "gui";
|
|
16503
|
+
import * as os4 from "os";
|
|
16504
|
+
|
|
16505
|
+
// _build/lib/windows/gdi32.js
|
|
16506
|
+
var b2 = (name, sig, encoders) => bind("gdi32.dll", name, sig, encoders);
|
|
16507
|
+
var DeleteObject = /* @__PURE__ */ b2("DeleteObject", "<>ptr -> i32");
|
|
16508
|
+
var GetDeviceCaps = /* @__PURE__ */ b2("GetDeviceCaps", "<HDC>ptr! i32@DeviceCap -> i32");
|
|
16509
|
+
var CreateFontIndirect = /* @__PURE__ */ b2("CreateFontIndirectW", "<LOGFONTW>ptr -> <>ptr", { LOGFONTW });
|
|
16510
|
+
var SelectObject = /* @__PURE__ */ b2("SelectObject", "<HDC>ptr! <>ptr -> <>ptr");
|
|
16511
|
+
var GetObject = /* @__PURE__ */ b2("GetObjectW", "<>ptr i32 <BYTE>ptr -> i32");
|
|
16512
|
+
|
|
16513
|
+
// _build/lib/react-qw/props.js
|
|
16514
|
+
import * as gui from "gui";
|
|
16515
|
+
function applyProps(instance, newProps, _oldProps) {
|
|
16516
|
+
const hwnd2 = instance.hwnd;
|
|
16517
|
+
instance.props = newProps;
|
|
16518
|
+
if (hwnd2 === null)
|
|
16519
|
+
return;
|
|
16520
|
+
const textVal = "text" in newProps ? newProps.text : typeof newProps.children === "string" ? newProps.children : typeof newProps.children === "number" ? String(newProps.children) : void 0;
|
|
16521
|
+
if (textVal !== void 0) {
|
|
16522
|
+
let cursor = -1;
|
|
16523
|
+
if (instance.type === "EDIT") {
|
|
16524
|
+
const sel = gui.SendMessage(hwnd2, 176, 0, 0);
|
|
16525
|
+
cursor = sel >>> 16;
|
|
16526
|
+
}
|
|
16527
|
+
SetWindowText(hwnd2, textVal);
|
|
16528
|
+
if (instance.type === "EDIT" && cursor >= 0) {
|
|
16529
|
+
gui.SendMessage(hwnd2, 177, cursor, cursor);
|
|
16530
|
+
}
|
|
16531
|
+
}
|
|
16532
|
+
if ("disabled" in newProps) {
|
|
16533
|
+
EnableWindow(hwnd2, !newProps.disabled ? 1 : 0);
|
|
16534
|
+
}
|
|
16535
|
+
if ("hidden" in newProps) {
|
|
16536
|
+
gui.ShowWindow(
|
|
16537
|
+
hwnd2,
|
|
16538
|
+
newProps.hidden ? 0 : 5
|
|
16539
|
+
/* gui.ShowWindowCmd.SHOW */
|
|
16540
|
+
);
|
|
16541
|
+
}
|
|
16542
|
+
if ("visible" in newProps) {
|
|
16543
|
+
gui.ShowWindow(
|
|
16544
|
+
hwnd2,
|
|
16545
|
+
newProps.visible ? 5 : 0
|
|
16546
|
+
/* gui.ShowWindowCmd.HIDE */
|
|
16547
|
+
);
|
|
16548
|
+
}
|
|
16549
|
+
}
|
|
16550
|
+
|
|
16551
|
+
// _build/lib/react-qw/layout.js
|
|
16552
|
+
var DEFAULT_W = 100;
|
|
16553
|
+
var DEFAULT_H = 30;
|
|
16554
|
+
function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
16555
|
+
const dir = flex.flexDirection || "column";
|
|
16556
|
+
const gap = flex.gap ?? 0;
|
|
16557
|
+
const justify = flex.justifyContent || "flex-start";
|
|
16558
|
+
const align = flex.alignItems || "stretch";
|
|
16559
|
+
const isRow = dir === "row";
|
|
16560
|
+
const n = children.length;
|
|
16561
|
+
const mainSize = isRow ? "w" : "h";
|
|
16562
|
+
const crossSize = isRow ? "h" : "w";
|
|
16563
|
+
const mainPos = isRow ? "x" : "y";
|
|
16564
|
+
const crossPos = isRow ? "y" : "x";
|
|
16565
|
+
const mainDim = isRow ? "width" : "height";
|
|
16566
|
+
const crossDim = isRow ? "height" : "width";
|
|
16567
|
+
const pt = flex.paddingTop ?? flex.padding ?? 0;
|
|
16568
|
+
const pr = flex.paddingRight ?? flex.padding ?? 0;
|
|
16569
|
+
const pb = flex.paddingBottom ?? flex.padding ?? 0;
|
|
16570
|
+
const pl = flex.paddingLeft ?? flex.padding ?? 0;
|
|
16571
|
+
const mainPadding = isRow ? pl + pr : pt + pb;
|
|
16572
|
+
const crossPadding = isRow ? pt + pb : pl + pr;
|
|
16573
|
+
const parentMain = (isRow ? parentW : parentH) - mainPadding;
|
|
16574
|
+
const parentCross = (isRow ? parentH : parentW) - crossPadding;
|
|
16575
|
+
const sizes = children.map((c) => ({
|
|
16576
|
+
w: typeof c.style.width === "number" ? c.style.width : DEFAULT_W,
|
|
16577
|
+
h: typeof c.style.height === "number" ? c.style.height : DEFAULT_H
|
|
16578
|
+
}));
|
|
16579
|
+
const flexGrows = children.map((c) => c.style.flexGrow ?? 0);
|
|
16580
|
+
const totalGrow = flexGrows.reduce((s, g) => s + g, 0);
|
|
16581
|
+
const baseMain = sizes.reduce((s, c) => s + c[mainSize], 0);
|
|
16582
|
+
let freeGrow = parentMain - baseMain - Math.max(0, n - 1) * gap;
|
|
16583
|
+
if (totalGrow > 0 && freeGrow > 0) {
|
|
16584
|
+
for (let i = 0; i < n; i++) {
|
|
16585
|
+
sizes[i][mainSize] += freeGrow * flexGrows[i] / totalGrow;
|
|
16586
|
+
}
|
|
16587
|
+
}
|
|
16588
|
+
const totalMain = sizes.reduce((s, c) => s + c[mainSize], 0);
|
|
16589
|
+
const free = parentMain - totalMain - Math.max(0, n - 1) * gap;
|
|
16590
|
+
let offset = 0, extraGap = 0;
|
|
16591
|
+
if (justify === "flex-end")
|
|
16592
|
+
offset = free;
|
|
16593
|
+
else if (justify === "center")
|
|
16594
|
+
offset = Math.max(0, free / 2);
|
|
16595
|
+
else if (justify === "space-between" && n > 1)
|
|
16596
|
+
extraGap = free / (n - 1);
|
|
16597
|
+
else if (justify === "space-around") {
|
|
16598
|
+
extraGap = free / n;
|
|
16599
|
+
offset = extraGap / 2;
|
|
16600
|
+
} else if (justify === "space-evenly") {
|
|
16601
|
+
extraGap = free / (n + 1);
|
|
16602
|
+
offset = extraGap;
|
|
16603
|
+
}
|
|
16604
|
+
let cursor = offset;
|
|
16605
|
+
return sizes.map((sz, i) => {
|
|
16606
|
+
const childCrossBase = sz[crossSize];
|
|
16607
|
+
const childAlign = children[i].style.alignSelf ?? "auto";
|
|
16608
|
+
const effectiveAlign = childAlign === "auto" ? align : childAlign;
|
|
16609
|
+
let childMain = sz[mainSize];
|
|
16610
|
+
let childCross = childCrossBase;
|
|
16611
|
+
const res = { x: 0, y: 0, width: 0, height: 0 };
|
|
16612
|
+
res[mainPos] = cursor;
|
|
16613
|
+
res[crossPos] = 0;
|
|
16614
|
+
res[mainDim] = childMain;
|
|
16615
|
+
res[crossDim] = childCross;
|
|
16616
|
+
if (effectiveAlign === "stretch") {
|
|
16617
|
+
const hasExplicitCross = typeof children[i].style[crossDim] === "number";
|
|
16618
|
+
if (!hasExplicitCross) {
|
|
16619
|
+
res[crossDim] = parentCross;
|
|
16620
|
+
res[crossPos] = 0;
|
|
16621
|
+
}
|
|
16622
|
+
} else if (effectiveAlign === "flex-end") {
|
|
16623
|
+
res[crossPos] = parentCross - childCross;
|
|
16624
|
+
} else if (effectiveAlign === "center") {
|
|
16625
|
+
res[crossPos] = Math.max(0, (parentCross - childCross) / 2);
|
|
16626
|
+
}
|
|
16627
|
+
cursor += childMain + gap + extraGap;
|
|
16628
|
+
return res;
|
|
16629
|
+
});
|
|
16630
|
+
}
|
|
15815
16631
|
|
|
15816
16632
|
// _build/lib/text-measure.js
|
|
15817
|
-
|
|
15818
|
-
DrawTextW: "ptr wstr i32 ptr i32 -> i32",
|
|
15819
|
-
GetDC: "ptr -> ptr",
|
|
15820
|
-
ReleaseDC: "ptr ptr -> i32"
|
|
15821
|
-
});
|
|
15822
|
-
var gdi32 = bindLib("gdi32.dll", {
|
|
15823
|
-
SelectObject: "ptr ptr -> ptr"
|
|
15824
|
-
});
|
|
16633
|
+
import * as gui2 from "gui";
|
|
15825
16634
|
function measureText(hdc, text, maxWidth) {
|
|
15826
|
-
const
|
|
15827
|
-
|
|
15828
|
-
dv.setInt32(8, maxWidth, true);
|
|
15829
|
-
user32.DrawTextW(
|
|
16635
|
+
const r = RECT.encode({ right: maxWidth });
|
|
16636
|
+
DrawText(
|
|
15830
16637
|
hdc,
|
|
15831
16638
|
text,
|
|
15832
16639
|
-1,
|
|
15833
|
-
|
|
16640
|
+
r.ptr,
|
|
15834
16641
|
1024
|
|
15835
16642
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15836
16643
|
);
|
|
15837
|
-
|
|
16644
|
+
const { right, bottom } = RECT.decode(r);
|
|
16645
|
+
return { width: right, height: bottom };
|
|
15838
16646
|
}
|
|
15839
16647
|
function getButtonIdealSize(hwnd2) {
|
|
15840
|
-
const size =
|
|
15841
|
-
gui2.SendMessage(hwnd2, 5633, 0,
|
|
15842
|
-
const
|
|
15843
|
-
return { width:
|
|
16648
|
+
const size = SIZE.alloc();
|
|
16649
|
+
gui2.SendMessage(hwnd2, 5633, 0, size.ptr);
|
|
16650
|
+
const { cx, cy } = SIZE.decode(size);
|
|
16651
|
+
return { width: cx, height: cy };
|
|
15844
16652
|
}
|
|
15845
16653
|
function measureTextForHwnd(hwnd2, text) {
|
|
15846
|
-
const hdc =
|
|
16654
|
+
const hdc = GetDC(hwnd2);
|
|
15847
16655
|
if (!hdc)
|
|
15848
16656
|
return { width: 0, height: 0 };
|
|
15849
16657
|
const hFont = gui2.SendMessage(hwnd2, 49, 0, 0);
|
|
15850
|
-
const oldFont = hFont ?
|
|
16658
|
+
const oldFont = hFont ? SelectObject(hdc, hFont) : 0;
|
|
15851
16659
|
const result = measureText(hdc, text, 0);
|
|
15852
16660
|
if (hFont)
|
|
15853
|
-
|
|
15854
|
-
|
|
16661
|
+
SelectObject(hdc, oldFont);
|
|
16662
|
+
ReleaseDC(hwnd2, hdc);
|
|
15855
16663
|
const wr = gui2.GetWindowRect(hwnd2);
|
|
15856
16664
|
const cr = gui2.GetClientRect(hwnd2);
|
|
15857
16665
|
if (wr && cr) {
|
|
@@ -15863,14 +16671,20 @@ function measureTextForHwnd(hwnd2, text) {
|
|
|
15863
16671
|
|
|
15864
16672
|
// _build/lib/react-qw/reconciler.js
|
|
15865
16673
|
var dpiFont = gui3.CreateSystemDpiFont();
|
|
15866
|
-
var scaleFactor =
|
|
16674
|
+
var scaleFactor = (() => {
|
|
16675
|
+
const hdc = GetDC(NULL);
|
|
16676
|
+
const dpi = hdc ? GetDeviceCaps(hdc, 88) : 96;
|
|
16677
|
+
if (hdc)
|
|
16678
|
+
ReleaseDC(NULL, hdc);
|
|
16679
|
+
return dpi / 96;
|
|
16680
|
+
})();
|
|
15867
16681
|
var DELAYED_CONTROLS = /* @__PURE__ */ new Set(["SysListView32", "SysTreeView32", "LISTBOX", "COMBOBOX", "msctls_trackbar32", "SysDateTimePick32", "SysLink"]);
|
|
15868
16682
|
function isDelayedControl(winClass) {
|
|
15869
16683
|
return DELAYED_CONTROLS.has(winClass);
|
|
15870
16684
|
}
|
|
15871
16685
|
function setupWindowProc(instance, hwnd2) {
|
|
15872
16686
|
instance.hwnd = hwnd2;
|
|
15873
|
-
const oldProc =
|
|
16687
|
+
const oldProc = GetWindowLongPtr(
|
|
15874
16688
|
hwnd2,
|
|
15875
16689
|
-4
|
|
15876
16690
|
/* gui.Gwlp.WNDPROC */
|
|
@@ -15879,11 +16693,11 @@ function setupWindowProc(instance, hwnd2) {
|
|
|
15879
16693
|
gui3.SetWindowProc(hwnd2, (hwnd3, msg, wParam, lParam) => {
|
|
15880
16694
|
const ev = instance.props.onEvent;
|
|
15881
16695
|
if (!ev)
|
|
15882
|
-
return
|
|
16696
|
+
return CallWindowProc(oldProc, hwnd3, msg, wParam, lParam);
|
|
15883
16697
|
if (typeof ev === "object") {
|
|
15884
|
-
return ev.fn({ hwnd: hwnd3, msg, wParam, lParam, callOldWndProc: () =>
|
|
16698
|
+
return ev.fn({ hwnd: hwnd3, msg, wParam, lParam, callOldWndProc: () => CallWindowProc(oldProc, hwnd3, msg, wParam, lParam) });
|
|
15885
16699
|
}
|
|
15886
|
-
const result =
|
|
16700
|
+
const result = CallWindowProc(oldProc, hwnd3, msg, wParam, lParam);
|
|
15887
16701
|
const override = ev({ hwnd: hwnd3, msg, wParam, lParam });
|
|
15888
16702
|
return typeof override === "number" && Number.isInteger(override) ? override : result;
|
|
15889
16703
|
});
|
|
@@ -15953,7 +16767,7 @@ function runFlexLayout(inst) {
|
|
|
15953
16767
|
if (lr && lr.x === r.x && lr.y === r.y && lr.w === r.width && lr.h === r.height)
|
|
15954
16768
|
continue;
|
|
15955
16769
|
console.log("flex: set", child.type, child.hwnd, "to", r.x, r.y, r.width, r.height);
|
|
15956
|
-
|
|
16770
|
+
SetWindowPos(
|
|
15957
16771
|
child.hwnd,
|
|
15958
16772
|
0,
|
|
15959
16773
|
(r.x + pl) * scaleFactor,
|
|
@@ -15963,7 +16777,7 @@ function runFlexLayout(inst) {
|
|
|
15963
16777
|
64
|
|
15964
16778
|
/* gui.SetWindowPosFlag.SWP_SHOWWINDOW */
|
|
15965
16779
|
);
|
|
15966
|
-
|
|
16780
|
+
InvalidateRect(child.hwnd, NULL, 1);
|
|
15967
16781
|
child.lastRect = { x: r.x, y: r.y, w: r.width, h: r.height };
|
|
15968
16782
|
}
|
|
15969
16783
|
for (const c of children)
|
|
@@ -16009,7 +16823,7 @@ var hostConfig = {
|
|
|
16009
16823
|
if (child.hwnd === null) {
|
|
16010
16824
|
ensureChildWindow(child, parent.hwnd);
|
|
16011
16825
|
} else {
|
|
16012
|
-
|
|
16826
|
+
SetParent(child.hwnd, parent.hwnd ?? NULL);
|
|
16013
16827
|
}
|
|
16014
16828
|
if (false)
|
|
16015
16829
|
console.log("[reconciler] appendInitialChild parent:", parent.hwnd, "child:", child.hwnd);
|
|
@@ -16019,7 +16833,7 @@ var hostConfig = {
|
|
|
16019
16833
|
if (child.hwnd === null) {
|
|
16020
16834
|
ensureChildWindow(child, parent.hwnd);
|
|
16021
16835
|
} else {
|
|
16022
|
-
|
|
16836
|
+
SetParent(child.hwnd, parent.hwnd ?? NULL);
|
|
16023
16837
|
}
|
|
16024
16838
|
if (false)
|
|
16025
16839
|
console.log("[reconciler] appendChild parent:", parent.hwnd, "child:", child.hwnd);
|
|
@@ -16029,7 +16843,7 @@ var hostConfig = {
|
|
|
16029
16843
|
if (child.hwnd === null) {
|
|
16030
16844
|
ensureChildWindow(child, container);
|
|
16031
16845
|
} else {
|
|
16032
|
-
|
|
16846
|
+
SetParent(child.hwnd, container);
|
|
16033
16847
|
}
|
|
16034
16848
|
const rootInst = instancesByHwnd.get(container);
|
|
16035
16849
|
if (rootInst)
|
|
@@ -16041,7 +16855,7 @@ var hostConfig = {
|
|
|
16041
16855
|
if (child.hwnd === null) {
|
|
16042
16856
|
ensureChildWindow(child, parent.hwnd);
|
|
16043
16857
|
} else {
|
|
16044
|
-
|
|
16858
|
+
SetParent(child.hwnd, parent.hwnd ?? NULL);
|
|
16045
16859
|
}
|
|
16046
16860
|
if (false)
|
|
16047
16861
|
console.log("[reconciler] insertBefore parent:", parent.hwnd, "child:", child.hwnd, "before:", beforeChild.hwnd);
|
|
@@ -16053,7 +16867,7 @@ var hostConfig = {
|
|
|
16053
16867
|
if (child.hwnd === null) {
|
|
16054
16868
|
ensureChildWindow(child, container);
|
|
16055
16869
|
} else {
|
|
16056
|
-
|
|
16870
|
+
SetParent(child.hwnd, container);
|
|
16057
16871
|
}
|
|
16058
16872
|
const rootInst = instancesByHwnd.get(container);
|
|
16059
16873
|
if (!rootInst)
|
|
@@ -16110,7 +16924,7 @@ var hostConfig = {
|
|
|
16110
16924
|
resetTextContent(_instance) {
|
|
16111
16925
|
},
|
|
16112
16926
|
commitTextUpdate(instance, _oldText, newText) {
|
|
16113
|
-
|
|
16927
|
+
SetWindowText(instance.hwnd, newText);
|
|
16114
16928
|
},
|
|
16115
16929
|
hideInstance(instance) {
|
|
16116
16930
|
if (instance.hwnd !== null)
|
|
@@ -16164,10 +16978,10 @@ var hostConfig = {
|
|
|
16164
16978
|
clearContainer(_container) {
|
|
16165
16979
|
},
|
|
16166
16980
|
scheduleTimeout(fn, delay) {
|
|
16167
|
-
return
|
|
16981
|
+
return os4.setTimeout(fn, delay);
|
|
16168
16982
|
},
|
|
16169
16983
|
cancelTimeout(id) {
|
|
16170
|
-
|
|
16984
|
+
os4.clearTimeout?.(id);
|
|
16171
16985
|
},
|
|
16172
16986
|
noTimeout: -1,
|
|
16173
16987
|
supportsMutation: true,
|
|
@@ -16334,298 +17148,23 @@ var ComboBox = (0, import_react4.forwardRef)(({ items, selectedIndex: controlled
|
|
|
16334
17148
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
16335
17149
|
var import_react5 = __toESM(require_react(), 1);
|
|
16336
17150
|
import * as gui6 from "gui";
|
|
16337
|
-
import * as ffi4 from "ffi";
|
|
16338
|
-
|
|
16339
|
-
// _build/lib/ffi-struct.js
|
|
16340
|
-
import * as os2 from "os";
|
|
16341
|
-
var PTR = os2.arch === "x64" ? 8 : 4;
|
|
16342
|
-
var AS = {
|
|
16343
|
-
u8: [1, 1],
|
|
16344
|
-
i8: [1, 1],
|
|
16345
|
-
u16: [2, 2],
|
|
16346
|
-
i16: [2, 2],
|
|
16347
|
-
u32: [4, 4],
|
|
16348
|
-
i32: [4, 4],
|
|
16349
|
-
u64: [8, 8],
|
|
16350
|
-
i64: [8, 8],
|
|
16351
|
-
f32: [4, 4],
|
|
16352
|
-
f64: [8, 8],
|
|
16353
|
-
ptr: [PTR, PTR],
|
|
16354
|
-
wstr: [2, 2]
|
|
16355
|
-
// 仅定长数组元素用(wchar)
|
|
16356
|
-
};
|
|
16357
|
-
function alignUp(v, a) {
|
|
16358
|
-
return v + a - 1 & ~(a - 1);
|
|
16359
|
-
}
|
|
16360
|
-
function parseField(f) {
|
|
16361
|
-
const arr = /^(.+)\[(\d+)\]$/.exec(f);
|
|
16362
|
-
if (arr) {
|
|
16363
|
-
const b2 = normKind(arr[1]);
|
|
16364
|
-
if (b2 === "void")
|
|
16365
|
-
throw new Error(`ffi-struct: "void" cannot be an array base`);
|
|
16366
|
-
return { base: b2, count: Number(arr[2]) };
|
|
16367
|
-
}
|
|
16368
|
-
const b = normKind(f);
|
|
16369
|
-
if (b === "void" || b === "wstr")
|
|
16370
|
-
throw new Error(`ffi-struct: invalid scalar field type "${f}"`);
|
|
16371
|
-
return { base: b, count: 1 };
|
|
16372
|
-
}
|
|
16373
|
-
function layout(def) {
|
|
16374
|
-
const fields = [];
|
|
16375
|
-
let cursor = 0;
|
|
16376
|
-
let maxAlign = 1;
|
|
16377
|
-
for (const key of Object.keys(def)) {
|
|
16378
|
-
const v = def[key];
|
|
16379
|
-
let a;
|
|
16380
|
-
let w;
|
|
16381
|
-
if (typeof v === "string") {
|
|
16382
|
-
const { base, count } = parseField(v);
|
|
16383
|
-
const [align, elem] = AS[base];
|
|
16384
|
-
a = align;
|
|
16385
|
-
w = count >= 1 ? elem * count : elem;
|
|
16386
|
-
fields.push({ name: key, base, count, offset: 0 });
|
|
16387
|
-
} else {
|
|
16388
|
-
const child = v;
|
|
16389
|
-
a = child.structAlign;
|
|
16390
|
-
w = child.size;
|
|
16391
|
-
fields.push({ name: key, base: "u8", count: 0, offset: 0, child });
|
|
16392
|
-
}
|
|
16393
|
-
const off = alignUp(cursor, a);
|
|
16394
|
-
const f = fields[fields.length - 1];
|
|
16395
|
-
f.offset = off;
|
|
16396
|
-
cursor = off + w;
|
|
16397
|
-
if (a > maxAlign)
|
|
16398
|
-
maxAlign = a;
|
|
16399
|
-
}
|
|
16400
|
-
return { fields, size: alignUp(cursor, maxAlign), structAlign: maxAlign };
|
|
16401
|
-
}
|
|
16402
|
-
var _layoutCache = /* @__PURE__ */ new WeakMap();
|
|
16403
|
-
function buildLayout(def) {
|
|
16404
|
-
let hit = _layoutCache.get(def);
|
|
16405
|
-
if (hit)
|
|
16406
|
-
return hit;
|
|
16407
|
-
hit = layout(def);
|
|
16408
|
-
_layoutCache.set(def, hit);
|
|
16409
|
-
return hit;
|
|
16410
|
-
}
|
|
16411
|
-
function readScalar(dv, off, k) {
|
|
16412
|
-
switch (k) {
|
|
16413
|
-
case "u8":
|
|
16414
|
-
return dv.getUint8(off);
|
|
16415
|
-
case "i8":
|
|
16416
|
-
return dv.getInt8(off);
|
|
16417
|
-
case "u16":
|
|
16418
|
-
return dv.getUint16(off, true);
|
|
16419
|
-
case "i16":
|
|
16420
|
-
return dv.getInt16(off, true);
|
|
16421
|
-
case "u32":
|
|
16422
|
-
return dv.getUint32(off, true);
|
|
16423
|
-
case "i32":
|
|
16424
|
-
return dv.getInt32(off, true);
|
|
16425
|
-
case "u64":
|
|
16426
|
-
return Number(dv.getBigUint64(off, true));
|
|
16427
|
-
case "i64":
|
|
16428
|
-
return Number(dv.getBigInt64(off, true));
|
|
16429
|
-
case "f32":
|
|
16430
|
-
return dv.getFloat32(off, true);
|
|
16431
|
-
case "f64":
|
|
16432
|
-
return dv.getFloat64(off, true);
|
|
16433
|
-
case "ptr":
|
|
16434
|
-
return readPtr(dv, off);
|
|
16435
|
-
case "wstr":
|
|
16436
|
-
return dv.getUint16(off, true);
|
|
16437
|
-
}
|
|
16438
|
-
}
|
|
16439
|
-
function readPtr(dv, off) {
|
|
16440
|
-
if (PTR === 8)
|
|
16441
|
-
return Number(dv.getBigUint64(off, true));
|
|
16442
|
-
return dv.getUint32(off, true);
|
|
16443
|
-
}
|
|
16444
|
-
function writeScalar(dv, off, k, val) {
|
|
16445
|
-
switch (k) {
|
|
16446
|
-
case "u8":
|
|
16447
|
-
dv.setUint8(off, val);
|
|
16448
|
-
break;
|
|
16449
|
-
case "i8":
|
|
16450
|
-
dv.setInt8(off, val);
|
|
16451
|
-
break;
|
|
16452
|
-
case "u16":
|
|
16453
|
-
dv.setUint16(off, val, true);
|
|
16454
|
-
break;
|
|
16455
|
-
case "i16":
|
|
16456
|
-
dv.setInt16(off, val, true);
|
|
16457
|
-
break;
|
|
16458
|
-
case "u32":
|
|
16459
|
-
dv.setUint32(off, val >>> 0, true);
|
|
16460
|
-
break;
|
|
16461
|
-
case "i32":
|
|
16462
|
-
dv.setInt32(off, val | 0, true);
|
|
16463
|
-
break;
|
|
16464
|
-
case "u64":
|
|
16465
|
-
dv.setBigUint64(off, BigInt(Math.trunc(val)), true);
|
|
16466
|
-
break;
|
|
16467
|
-
case "i64":
|
|
16468
|
-
dv.setBigInt64(off, BigInt(Math.trunc(val)), true);
|
|
16469
|
-
break;
|
|
16470
|
-
case "f32":
|
|
16471
|
-
dv.setFloat32(off, val, true);
|
|
16472
|
-
break;
|
|
16473
|
-
case "f64":
|
|
16474
|
-
dv.setFloat64(off, val, true);
|
|
16475
|
-
break;
|
|
16476
|
-
case "ptr":
|
|
16477
|
-
writePtr(dv, off, val);
|
|
16478
|
-
break;
|
|
16479
|
-
case "wstr":
|
|
16480
|
-
dv.setUint16(off, val, true);
|
|
16481
|
-
break;
|
|
16482
|
-
}
|
|
16483
|
-
}
|
|
16484
|
-
function writePtr(dv, off, val) {
|
|
16485
|
-
if (PTR === 8)
|
|
16486
|
-
dv.setBigUint64(off, BigInt(Math.trunc(val)), true);
|
|
16487
|
-
else
|
|
16488
|
-
dv.setUint32(off, val >>> 0, true);
|
|
16489
|
-
}
|
|
16490
|
-
function readField(dv, base, f) {
|
|
16491
|
-
const off = base + f.offset;
|
|
16492
|
-
if (f.child)
|
|
16493
|
-
return readInto(f.child, dv.buffer, off);
|
|
16494
|
-
if (f.count > 1) {
|
|
16495
|
-
if (f.base === "wstr") {
|
|
16496
|
-
const arr = new Uint16Array(dv.buffer, dv.byteOffset + off, f.count);
|
|
16497
|
-
let end = 0;
|
|
16498
|
-
while (end < arr.length && arr[end] !== 0)
|
|
16499
|
-
end++;
|
|
16500
|
-
let s = "";
|
|
16501
|
-
for (let i = 0; i < end; i++)
|
|
16502
|
-
s += String.fromCharCode(arr[i]);
|
|
16503
|
-
return s;
|
|
16504
|
-
}
|
|
16505
|
-
const out = [];
|
|
16506
|
-
const step = AS[f.base][1];
|
|
16507
|
-
for (let i = 0; i < f.count; i++)
|
|
16508
|
-
out.push(readScalar(dv, off + i * step, f.base));
|
|
16509
|
-
return out;
|
|
16510
|
-
}
|
|
16511
|
-
return readScalar(dv, off, f.base);
|
|
16512
|
-
}
|
|
16513
|
-
function writeField(dv, base, f, v) {
|
|
16514
|
-
const off = base + f.offset;
|
|
16515
|
-
if (f.child) {
|
|
16516
|
-
writeInto(f.child, v, dv.buffer, off);
|
|
16517
|
-
return;
|
|
16518
|
-
}
|
|
16519
|
-
if (f.count > 1) {
|
|
16520
|
-
if (f.base === "wstr") {
|
|
16521
|
-
const s = String(v ?? "");
|
|
16522
|
-
const arr = new Uint16Array(dv.buffer, dv.byteOffset + off, f.count);
|
|
16523
|
-
for (let i = 0; i < arr.length; i++)
|
|
16524
|
-
arr[i] = 0;
|
|
16525
|
-
const n = Math.min(s.length, f.count - 1);
|
|
16526
|
-
for (let i = 0; i < n; i++)
|
|
16527
|
-
arr[i] = s.charCodeAt(i);
|
|
16528
|
-
return;
|
|
16529
|
-
}
|
|
16530
|
-
const step = AS[f.base][1];
|
|
16531
|
-
const list = v ?? [];
|
|
16532
|
-
for (let i = 0; i < f.count; i++)
|
|
16533
|
-
writeScalar(dv, off + i * step, f.base, list[i] ?? 0);
|
|
16534
|
-
return;
|
|
16535
|
-
}
|
|
16536
|
-
writeScalar(dv, off, f.base, Number(v));
|
|
16537
|
-
}
|
|
16538
|
-
function doSize(def) {
|
|
16539
|
-
return buildLayout(def).size;
|
|
16540
|
-
}
|
|
16541
|
-
function readInto(child, buf, offset) {
|
|
16542
|
-
const r = child;
|
|
16543
|
-
return r.read(buf, offset);
|
|
16544
|
-
}
|
|
16545
|
-
function doRead(_def, fields, buf, offset) {
|
|
16546
|
-
const out = {};
|
|
16547
|
-
const dv = new DataView(buf);
|
|
16548
|
-
for (const f of fields)
|
|
16549
|
-
out[f.name] = readField(dv, offset, f);
|
|
16550
|
-
return out;
|
|
16551
|
-
}
|
|
16552
|
-
function doWrite(def, fields, v, buf, offset = 0) {
|
|
16553
|
-
buf = buf ?? new ArrayBuffer(doSize(def));
|
|
16554
|
-
const dv = new DataView(buf);
|
|
16555
|
-
for (const f of fields)
|
|
16556
|
-
writeField(dv, offset, f, v[f.name]);
|
|
16557
|
-
return buf;
|
|
16558
|
-
}
|
|
16559
|
-
function writeInto(child, v, buf, offset) {
|
|
16560
|
-
const w = child;
|
|
16561
|
-
w.write(v, buf, offset);
|
|
16562
|
-
}
|
|
16563
|
-
function struct(def) {
|
|
16564
|
-
const { fields, size, structAlign } = buildLayout(def);
|
|
16565
|
-
return {
|
|
16566
|
-
__fields: def,
|
|
16567
|
-
size,
|
|
16568
|
-
structAlign,
|
|
16569
|
-
read: (buf, offset = 0) => doRead(def, fields, buf, offset),
|
|
16570
|
-
write: (v, buf, offset = 0) => doWrite(def, fields, v, buf, offset),
|
|
16571
|
-
offsetOf: (name) => {
|
|
16572
|
-
for (const f of fields)
|
|
16573
|
-
if (f.name === name)
|
|
16574
|
-
return f.offset;
|
|
16575
|
-
throw new Error(`ffi-struct: no field "${String(name)}"`);
|
|
16576
|
-
}
|
|
16577
|
-
};
|
|
16578
|
-
}
|
|
16579
17151
|
|
|
16580
17152
|
// _build/lib/react-qw/nmhdr.js
|
|
16581
|
-
import * as os3 from "os";
|
|
16582
|
-
import * as ffi3 from "ffi";
|
|
16583
|
-
var IS64 = os3.arch === "x64";
|
|
16584
|
-
var PTR_SIZE = IS64 ? 8 : 4;
|
|
16585
|
-
var NMHDR = struct({ hwndFrom: "ptr", idFrom: "ptr", code: "i32" });
|
|
16586
|
-
var NMHDR_SIZE = NMHDR.size;
|
|
16587
|
-
var NMHDR_CODE = NMHDR.offsetOf("code");
|
|
16588
|
-
function readI32At(ptr, offset) {
|
|
16589
|
-
return ffi3.readByte(ptr + offset) | ffi3.readByte(ptr + offset + 1) << 8 | ffi3.readByte(ptr + offset + 2) << 16 | ffi3.readByte(ptr + offset + 3) << 24;
|
|
16590
|
-
}
|
|
16591
|
-
function readU16At(ptr, offset) {
|
|
16592
|
-
return ffi3.readByte(ptr + offset) | ffi3.readByte(ptr + offset + 1) << 8;
|
|
16593
|
-
}
|
|
16594
17153
|
function nmCode(lParam) {
|
|
16595
|
-
return
|
|
17154
|
+
return NMHDR.decode(lParam).code;
|
|
16596
17155
|
}
|
|
16597
17156
|
|
|
16598
17157
|
// _build/lib/react-qw/components/DateTimePicker.js
|
|
16599
|
-
var SYSTEMTIME = struct({
|
|
16600
|
-
wYear: "u16",
|
|
16601
|
-
wMonth: "u16",
|
|
16602
|
-
wDayOfWeek: "u16",
|
|
16603
|
-
wDay: "u16",
|
|
16604
|
-
wHour: "u16",
|
|
16605
|
-
wMinute: "u16",
|
|
16606
|
-
wSecond: "u16",
|
|
16607
|
-
wMilliseconds: "u16"
|
|
16608
|
-
});
|
|
16609
|
-
var NMDATETIMECHANGE = struct({
|
|
16610
|
-
hdr: NMHDR,
|
|
16611
|
-
dwFlags: "u32",
|
|
16612
|
-
st: SYSTEMTIME
|
|
16613
|
-
});
|
|
16614
|
-
function bufPtr(buf) {
|
|
16615
|
-
return ffi4.bufferPtr(buf);
|
|
16616
|
-
}
|
|
16617
17158
|
function dateToSysTimeBuf(d) {
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
dv.setUint16(14, d.getMilliseconds(), true);
|
|
16628
|
-
return buf;
|
|
17159
|
+
return SYSTEMTIME.encode({
|
|
17160
|
+
wYear: d.getFullYear(),
|
|
17161
|
+
wMonth: d.getMonth() + 1,
|
|
17162
|
+
wDay: d.getDate(),
|
|
17163
|
+
wHour: d.getHours(),
|
|
17164
|
+
wMinute: d.getMinutes(),
|
|
17165
|
+
wSecond: d.getSeconds(),
|
|
17166
|
+
wMilliseconds: d.getMilliseconds()
|
|
17167
|
+
});
|
|
16629
17168
|
}
|
|
16630
17169
|
var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ value, onChange, defaultValue, format = "short", allowNone, updown, style }, ref) {
|
|
16631
17170
|
const [internalDate, setInternalDate] = (0, import_react5.useState)(defaultValue ?? null);
|
|
@@ -16650,7 +17189,7 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16650
17189
|
const d = effectiveDate;
|
|
16651
17190
|
if (d) {
|
|
16652
17191
|
const buf = dateToSysTimeBuf(d);
|
|
16653
|
-
gui6.SendMessage(h, 4098, 0,
|
|
17192
|
+
gui6.SendMessage(h, 4098, 0, buf.ptr);
|
|
16654
17193
|
} else {
|
|
16655
17194
|
gui6.SendMessage(h, 4098, 1, 0);
|
|
16656
17195
|
}
|
|
@@ -16659,7 +17198,7 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16659
17198
|
const h = dpRef.current;
|
|
16660
17199
|
if (!h)
|
|
16661
17200
|
return;
|
|
16662
|
-
|
|
17201
|
+
InvalidateRect(h, NULL, 1);
|
|
16663
17202
|
const cr = gui6.GetClientRect(h);
|
|
16664
17203
|
if (cr) {
|
|
16665
17204
|
const w = cr.right - cr.left;
|
|
@@ -16671,20 +17210,13 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16671
17210
|
if (e.msg === 78) {
|
|
16672
17211
|
const code = nmCode(e.lParam);
|
|
16673
17212
|
if (code === -759) {
|
|
16674
|
-
const st = NMDATETIMECHANGE.
|
|
16675
|
-
const dwFlags = readI32At(e.lParam, NMDATETIMECHANGE.offsetOf("dwFlags"));
|
|
17213
|
+
const { dwFlags, st } = NMDATETIMECHANGE.decode(e.lParam);
|
|
16676
17214
|
if (dwFlags === 1) {
|
|
16677
17215
|
if (!isControlled)
|
|
16678
17216
|
setInternalDate(null);
|
|
16679
17217
|
onChangeRef.current?.(null);
|
|
16680
17218
|
} else {
|
|
16681
|
-
const
|
|
16682
|
-
const month = readU16At(e.lParam, st + 2);
|
|
16683
|
-
const day = readU16At(e.lParam, st + 6);
|
|
16684
|
-
const hour = readU16At(e.lParam, st + 8);
|
|
16685
|
-
const min = readU16At(e.lParam, st + 10);
|
|
16686
|
-
const sec = readU16At(e.lParam, st + 12);
|
|
16687
|
-
const d = new Date(year, month - 1, day, hour, min, sec);
|
|
17219
|
+
const d = new Date(st.wYear, st.wMonth - 1, st.wDay, st.wHour, st.wMinute, st.wSecond);
|
|
16688
17220
|
if (!isControlled)
|
|
16689
17221
|
setInternalDate(d);
|
|
16690
17222
|
onChangeRef.current?.(d);
|
|
@@ -16700,14 +17232,6 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16700
17232
|
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
16701
17233
|
var import_react6 = __toESM(require_react(), 1);
|
|
16702
17234
|
import * as gui7 from "gui";
|
|
16703
|
-
import * as ffi5 from "ffi";
|
|
16704
|
-
function textToUtf16(s) {
|
|
16705
|
-
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16706
|
-
const dv = new DataView(buf);
|
|
16707
|
-
for (let i = 0; i < s.length; i++)
|
|
16708
|
-
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16709
|
-
return buf;
|
|
16710
|
-
}
|
|
16711
17235
|
var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValue = "", onChange, placeholder, password, multiline, readonly, number, disabled, style }, ref) => {
|
|
16712
17236
|
const [internalValue, setInternalValue] = (0, import_react6.useState)(defaultValue);
|
|
16713
17237
|
const isControlled = controlledValue !== void 0;
|
|
@@ -16726,8 +17250,8 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
|
|
|
16726
17250
|
const h = inputRef.current;
|
|
16727
17251
|
if (!h || !placeholder)
|
|
16728
17252
|
return;
|
|
16729
|
-
const buf =
|
|
16730
|
-
gui7.SendMessage(h, 5377, 1,
|
|
17253
|
+
const buf = WCHAR.encode(placeholder);
|
|
17254
|
+
gui7.SendMessage(h, 5377, 1, buf.ptr);
|
|
16731
17255
|
}, [placeholder]);
|
|
16732
17256
|
return (0, import_jsx_runtime5.jsx)("w", { type: "EDIT", text: displayValue, ws, style, disabled, ref: (h) => {
|
|
16733
17257
|
inputRef.current = h;
|
|
@@ -16751,20 +17275,6 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
|
|
|
16751
17275
|
// _build/lib/react-qw/components/Link.js
|
|
16752
17276
|
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
16753
17277
|
var import_react7 = __toESM(require_react(), 1);
|
|
16754
|
-
import * as gui8 from "gui";
|
|
16755
|
-
import * as ffi6 from "ffi";
|
|
16756
|
-
function readUtf16(ptr, offset, maxWords) {
|
|
16757
|
-
const chars = [];
|
|
16758
|
-
for (let i = 0; i < maxWords; i++) {
|
|
16759
|
-
const lo = ffi6.readByte(ptr + offset + i * 2);
|
|
16760
|
-
const hi = ffi6.readByte(ptr + offset + i * 2 + 1);
|
|
16761
|
-
const code = hi << 8 | lo;
|
|
16762
|
-
if (code === 0)
|
|
16763
|
-
break;
|
|
16764
|
-
chars.push(String.fromCharCode(code));
|
|
16765
|
-
}
|
|
16766
|
-
return chars.join("");
|
|
16767
|
-
}
|
|
16768
17278
|
var Link = (0, import_react7.forwardRef)(function Link2({ href, children, onClick, style }, ref) {
|
|
16769
17279
|
const displayText = children != null ? String(children) : href ?? "";
|
|
16770
17280
|
const linkText = href ? `<A HREF="${href}">${displayText}</A>` : displayText;
|
|
@@ -16775,14 +17285,13 @@ var Link = (0, import_react7.forwardRef)(function Link2({ href, children, onClic
|
|
|
16775
17285
|
const h = linkRef.current;
|
|
16776
17286
|
if (!h)
|
|
16777
17287
|
return;
|
|
16778
|
-
|
|
17288
|
+
InvalidateRect(h, NULL, 1);
|
|
16779
17289
|
}, [linkText]);
|
|
16780
17290
|
return (0, import_jsx_runtime6.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
16781
17291
|
if (e.msg === 78) {
|
|
16782
17292
|
const code = nmCode(e.lParam);
|
|
16783
17293
|
if (code === -2 || code === -4) {
|
|
16784
|
-
|
|
16785
|
-
onClickRef.current?.(url);
|
|
17294
|
+
onClickRef.current?.(NMLINK.decode(e.lParam).item.szUrl);
|
|
16786
17295
|
}
|
|
16787
17296
|
}
|
|
16788
17297
|
}, children: (0, import_jsx_runtime6.jsx)("w", { type: "SysLink", ws: 268435456 | 65536, text: linkText, style: { flexGrow: 1 }, ref: (h) => {
|
|
@@ -16793,7 +17302,7 @@ var Link = (0, import_react7.forwardRef)(function Link2({ href, children, onClic
|
|
|
16793
17302
|
// _build/lib/react-qw/components/ListBox.js
|
|
16794
17303
|
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
|
16795
17304
|
var import_react8 = __toESM(require_react(), 1);
|
|
16796
|
-
import * as
|
|
17305
|
+
import * as gui8 from "gui";
|
|
16797
17306
|
var ListBox = (0, import_react8.forwardRef)(({ items, selectedIndex: controlledIndex, defaultSelectedIndex = -1, onChange, style, sort, scrollToBottom }, ref) => {
|
|
16798
17307
|
const [internalIndex, setInternalIndex] = (0, import_react8.useState)(defaultSelectedIndex);
|
|
16799
17308
|
const isControlled = controlledIndex !== void 0;
|
|
@@ -16805,18 +17314,18 @@ var ListBox = (0, import_react8.forwardRef)(({ items, selectedIndex: controlledI
|
|
|
16805
17314
|
const h = lbRef.current;
|
|
16806
17315
|
if (!h)
|
|
16807
17316
|
return;
|
|
16808
|
-
|
|
17317
|
+
gui8.SendMessage(h, 388, 0, 0);
|
|
16809
17318
|
for (const item of items)
|
|
16810
|
-
|
|
17319
|
+
gui8.SendMessage(h, 384, 0, item);
|
|
16811
17320
|
if (sel >= 0 && sel < items.length)
|
|
16812
|
-
|
|
17321
|
+
gui8.SendMessage(h, 390, sel, 0);
|
|
16813
17322
|
if (scrollToBottom && items.length > 0)
|
|
16814
|
-
|
|
17323
|
+
gui8.SendMessage(h, 407, items.length - 1, 0);
|
|
16815
17324
|
}, [items]);
|
|
16816
17325
|
(0, import_react8.useEffect)(() => {
|
|
16817
17326
|
const h = lbRef.current;
|
|
16818
17327
|
if (h)
|
|
16819
|
-
|
|
17328
|
+
gui8.SendMessage(h, 390, sel, 0);
|
|
16820
17329
|
}, [sel]);
|
|
16821
17330
|
return (0, import_jsx_runtime7.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, onEvent: (e) => {
|
|
16822
17331
|
if (e.msg !== 273)
|
|
@@ -16826,7 +17335,7 @@ var ListBox = (0, import_react8.forwardRef)(({ items, selectedIndex: controlledI
|
|
|
16826
17335
|
const h = lbRef.current;
|
|
16827
17336
|
if (!h)
|
|
16828
17337
|
return;
|
|
16829
|
-
const newSel =
|
|
17338
|
+
const newSel = gui8.SendMessage(h, 392, 0, 0);
|
|
16830
17339
|
if (newSel !== sel && newSel >= 0) {
|
|
16831
17340
|
if (!isControlled)
|
|
16832
17341
|
setInternalIndex(newSel);
|
|
@@ -16841,138 +17350,18 @@ var ListBox = (0, import_react8.forwardRef)(({ items, selectedIndex: controlledI
|
|
|
16841
17350
|
// _build/lib/react-qw/components/ListView.js
|
|
16842
17351
|
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
16843
17352
|
var import_react9 = __toESM(require_react(), 1);
|
|
16844
|
-
import * as
|
|
16845
|
-
import * as
|
|
16846
|
-
import * as win2 from "win";
|
|
16847
|
-
function textToUtf162(s) {
|
|
16848
|
-
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16849
|
-
const dv = new DataView(buf);
|
|
16850
|
-
for (let i = 0; i < s.length; i++)
|
|
16851
|
-
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16852
|
-
return buf;
|
|
16853
|
-
}
|
|
16854
|
-
function readI32(ptr, offset) {
|
|
16855
|
-
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24;
|
|
16856
|
-
}
|
|
16857
|
-
function readU32(ptr, offset) {
|
|
16858
|
-
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24 >>> 0;
|
|
16859
|
-
}
|
|
16860
|
-
function readU64(ptr, offset) {
|
|
16861
|
-
const lo = readU32(ptr, offset);
|
|
16862
|
-
const hi = readU32(ptr, offset + 4);
|
|
16863
|
-
return lo + hi * 4294967296;
|
|
16864
|
-
}
|
|
17353
|
+
import * as gui9 from "gui";
|
|
17354
|
+
import * as ffi3 from "ffi";
|
|
16865
17355
|
function writeU32(ptr, offset, v) {
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
}
|
|
16871
|
-
function bufPtr2(buf) {
|
|
16872
|
-
return ffi7.bufferPtr(buf);
|
|
17356
|
+
ffi3.writeByte(ptr + offset, v & 255);
|
|
17357
|
+
ffi3.writeByte(ptr + offset + 1, v >> 8 & 255);
|
|
17358
|
+
ffi3.writeByte(ptr + offset + 2, v >> 16 & 255);
|
|
17359
|
+
ffi3.writeByte(ptr + offset + 3, v >> 24 & 255);
|
|
16873
17360
|
}
|
|
16874
17361
|
var LV_WS = 268435456 | 8388608 | 2097152 | 1048576 | 1 | 4;
|
|
16875
|
-
var NMCUSTOMDRAW = struct({
|
|
16876
|
-
hdr: NMHDR,
|
|
16877
|
-
dwDrawStage: "u32",
|
|
16878
|
-
hdc: "ptr",
|
|
16879
|
-
rc: "i32[4]",
|
|
16880
|
-
dwItemSpec: "ptr",
|
|
16881
|
-
uItemState: "u32",
|
|
16882
|
-
lItemlParam: "ptr"
|
|
16883
|
-
});
|
|
16884
|
-
var NMLVCUSTOMDRAW = struct({
|
|
16885
|
-
hdr: NMHDR,
|
|
16886
|
-
dwDrawStage: "u32",
|
|
16887
|
-
hdc: "ptr",
|
|
16888
|
-
rc: "i32[4]",
|
|
16889
|
-
dwItemSpec: "ptr",
|
|
16890
|
-
uItemState: "u32",
|
|
16891
|
-
lItemlParam: "ptr",
|
|
16892
|
-
clrText: "u32",
|
|
16893
|
-
clrTextBk: "u32",
|
|
16894
|
-
iSubItem: "i32",
|
|
16895
|
-
dwItemType: "u32"
|
|
16896
|
-
});
|
|
16897
|
-
var NMLISTVIEW = struct({
|
|
16898
|
-
hdr: NMHDR,
|
|
16899
|
-
iItem: "i32",
|
|
16900
|
-
iSubItem: "i32",
|
|
16901
|
-
uNewState: "u32",
|
|
16902
|
-
uOldState: "u32",
|
|
16903
|
-
uChanged: "u32",
|
|
16904
|
-
ptAction: "i32[2]",
|
|
16905
|
-
lParam: "ptr"
|
|
16906
|
-
});
|
|
16907
|
-
var CD_STAGE = NMCUSTOMDRAW.offsetOf("dwDrawStage");
|
|
16908
|
-
var CD_HDC = NMCUSTOMDRAW.offsetOf("hdc");
|
|
16909
|
-
var CD_ITEM = NMCUSTOMDRAW.offsetOf("dwItemSpec");
|
|
16910
17362
|
var CD_CLRTEXT = NMLVCUSTOMDRAW.offsetOf("clrText");
|
|
16911
17363
|
var CD_CLRTEXTBK = NMLVCUSTOMDRAW.offsetOf("clrTextBk");
|
|
16912
|
-
var CD_SUBITEM = NMLVCUSTOMDRAW.offsetOf("iSubItem");
|
|
16913
|
-
var NMIA_ITEM = NMLISTVIEW.offsetOf("iItem");
|
|
16914
|
-
var NMIA_SUBITEM = NMLISTVIEW.offsetOf("iSubItem");
|
|
16915
|
-
var NMLV_UNEW = NMLISTVIEW.offsetOf("uNewState");
|
|
16916
|
-
var NMLV_UOLD = NMLISTVIEW.offsetOf("uOldState");
|
|
16917
|
-
var LVITEMW = struct({
|
|
16918
|
-
mask: "u32",
|
|
16919
|
-
iItem: "i32",
|
|
16920
|
-
iSubItem: "i32",
|
|
16921
|
-
state: "u32",
|
|
16922
|
-
stateMask: "u32",
|
|
16923
|
-
pszText: "ptr",
|
|
16924
|
-
cchTextMax: "i32",
|
|
16925
|
-
iImage: "i32",
|
|
16926
|
-
lParam: "ptr",
|
|
16927
|
-
iIndent: "i32",
|
|
16928
|
-
iGroupId: "i32",
|
|
16929
|
-
cColumns: "u32",
|
|
16930
|
-
puColumns: "ptr",
|
|
16931
|
-
piColFmt: "ptr",
|
|
16932
|
-
iGroup: "i32"
|
|
16933
|
-
});
|
|
16934
|
-
var LVCOLUMNW = struct({
|
|
16935
|
-
mask: "u32",
|
|
16936
|
-
fmt: "i32",
|
|
16937
|
-
cx: "i32",
|
|
16938
|
-
pszText: "ptr",
|
|
16939
|
-
cchTextMax: "i32",
|
|
16940
|
-
iSubItem: "i32",
|
|
16941
|
-
iImage: "i32",
|
|
16942
|
-
iOrder: "i32",
|
|
16943
|
-
cxMin: "i32",
|
|
16944
|
-
cxDefault: "i32",
|
|
16945
|
-
cxIdeal: "i32"
|
|
16946
|
-
});
|
|
16947
17364
|
var fontCache = /* @__PURE__ */ new Map();
|
|
16948
|
-
var gdi322 = null;
|
|
16949
|
-
var createFontIndirectW = null;
|
|
16950
|
-
var selectObjectFn = null;
|
|
16951
|
-
var getObjectW = null;
|
|
16952
|
-
function ensureGdi() {
|
|
16953
|
-
if (gdi322 !== null)
|
|
16954
|
-
return;
|
|
16955
|
-
gdi322 = win2.LoadLibrary("gdi32.dll");
|
|
16956
|
-
if (!gdi322)
|
|
16957
|
-
return;
|
|
16958
|
-
createFontIndirectW = win2.GetProcAddress(gdi322, "CreateFontIndirectW");
|
|
16959
|
-
selectObjectFn = win2.GetProcAddress(gdi322, "SelectObject");
|
|
16960
|
-
getObjectW = win2.GetProcAddress(gdi322, "GetObjectW");
|
|
16961
|
-
}
|
|
16962
|
-
var user322 = null;
|
|
16963
|
-
var loadCursorW = null;
|
|
16964
|
-
var setCursorFn = null;
|
|
16965
|
-
var screenToClient = null;
|
|
16966
|
-
function ensureUser32() {
|
|
16967
|
-
if (user322 !== null)
|
|
16968
|
-
return;
|
|
16969
|
-
user322 = win2.LoadLibrary("user32.dll");
|
|
16970
|
-
if (!user322)
|
|
16971
|
-
return;
|
|
16972
|
-
loadCursorW = win2.GetProcAddress(user322, "LoadCursorW");
|
|
16973
|
-
setCursorFn = win2.GetProcAddress(user322, "SetCursor");
|
|
16974
|
-
screenToClient = win2.GetProcAddress(user322, "ScreenToClient");
|
|
16975
|
-
}
|
|
16976
17365
|
function getCellFont(hwnd2, style) {
|
|
16977
17366
|
const key = (style.bold ? "b" : "") + (style.italic ? "i" : "") + (style.underline ? "u" : "");
|
|
16978
17367
|
if (key === "")
|
|
@@ -16980,39 +17369,37 @@ function getCellFont(hwnd2, style) {
|
|
|
16980
17369
|
const cached = fontCache.get(key);
|
|
16981
17370
|
if (cached !== void 0)
|
|
16982
17371
|
return cached === 0 ? null : cached;
|
|
16983
|
-
|
|
16984
|
-
if (!createFontIndirectW || !getObjectW || !hwnd2)
|
|
17372
|
+
if (!hwnd2)
|
|
16985
17373
|
return null;
|
|
16986
|
-
|
|
16987
|
-
const
|
|
16988
|
-
const cur = gui10.SendMessage(hwnd2, 49, 0, 0);
|
|
17374
|
+
let base = { lfHeight: -13 };
|
|
17375
|
+
const cur = gui9.SendMessage(hwnd2, 49, 0, 0);
|
|
16989
17376
|
if (cur) {
|
|
16990
|
-
const
|
|
16991
|
-
if (!
|
|
17377
|
+
const lf = LOGFONTW.alloc();
|
|
17378
|
+
if (!GetObject(cur, LOGFONTW.size, lf))
|
|
16992
17379
|
return null;
|
|
16993
|
-
|
|
16994
|
-
dv.setInt32(0, -13, true);
|
|
17380
|
+
base = LOGFONTW.decode(lf);
|
|
16995
17381
|
}
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17001
|
-
|
|
17002
|
-
|
|
17382
|
+
const h = CreateFontIndirect({
|
|
17383
|
+
...base,
|
|
17384
|
+
...style.bold ? {
|
|
17385
|
+
lfWeight: 700
|
|
17386
|
+
/* gui.FontWeight.BOLD */
|
|
17387
|
+
} : {},
|
|
17388
|
+
...style.italic ? { lfItalic: 1 } : {},
|
|
17389
|
+
...style.underline ? { lfUnderline: 1 } : {}
|
|
17390
|
+
});
|
|
17003
17391
|
fontCache.set(key, h ? h : 0);
|
|
17004
17392
|
return h ? h : null;
|
|
17005
17393
|
}
|
|
17006
17394
|
function handleCustomDraw(lParam, columns, data, hwnd2) {
|
|
17007
|
-
const stage =
|
|
17395
|
+
const { dwDrawStage: stage } = NMCUSTOMDRAW.decode(lParam);
|
|
17008
17396
|
if (stage === 1)
|
|
17009
17397
|
return 32;
|
|
17010
17398
|
if (stage === 65537)
|
|
17011
17399
|
return 32;
|
|
17012
17400
|
if (stage === 196609) {
|
|
17013
|
-
const
|
|
17014
|
-
const
|
|
17015
|
-
const style = resolveCellStyle(columns, data, row, colIndex);
|
|
17401
|
+
const cd = NMLVCUSTOMDRAW.decode(lParam);
|
|
17402
|
+
const style = resolveCellStyle(columns, data, cd.dwItemSpec, cd.iSubItem);
|
|
17016
17403
|
if (!style)
|
|
17017
17404
|
return 0;
|
|
17018
17405
|
if (style.color !== void 0)
|
|
@@ -17020,12 +17407,9 @@ function handleCustomDraw(lParam, columns, data, hwnd2) {
|
|
|
17020
17407
|
if (style.background !== void 0)
|
|
17021
17408
|
writeU32(lParam, CD_CLRTEXTBK, style.background);
|
|
17022
17409
|
const hfont = getCellFont(hwnd2, style);
|
|
17023
|
-
if (hfont &&
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
ffi7.ffiCall(selectObjectFn, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [hdc, hfont], ffi7.FFI_TYPE_POINTER);
|
|
17027
|
-
return 2;
|
|
17028
|
-
}
|
|
17410
|
+
if (hfont && cd.hdc) {
|
|
17411
|
+
SelectObject(cd.hdc, hfont);
|
|
17412
|
+
return 2;
|
|
17029
17413
|
}
|
|
17030
17414
|
}
|
|
17031
17415
|
return 0;
|
|
@@ -17056,14 +17440,14 @@ function resolveCellStyle(columns, data, row, colIndex) {
|
|
|
17056
17440
|
return style || void 0;
|
|
17057
17441
|
}
|
|
17058
17442
|
function makeLVItem(i, sub, text, image) {
|
|
17059
|
-
const textBuf =
|
|
17060
|
-
const
|
|
17443
|
+
const textBuf = WCHAR.encode(text);
|
|
17444
|
+
const b6 = LVITEMW.encode({
|
|
17061
17445
|
mask: 1 | (image !== void 0 ? 2 : 0),
|
|
17062
17446
|
iItem: i,
|
|
17063
17447
|
iSubItem: sub,
|
|
17064
17448
|
state: 0,
|
|
17065
17449
|
stateMask: 0,
|
|
17066
|
-
pszText:
|
|
17450
|
+
pszText: textBuf.ptr,
|
|
17067
17451
|
cchTextMax: 0,
|
|
17068
17452
|
iImage: image ?? 0,
|
|
17069
17453
|
lParam: 0,
|
|
@@ -17074,8 +17458,8 @@ function makeLVItem(i, sub, text, image) {
|
|
|
17074
17458
|
piColFmt: 0,
|
|
17075
17459
|
iGroup: 0
|
|
17076
17460
|
});
|
|
17077
|
-
|
|
17078
|
-
return
|
|
17461
|
+
b6.__textBuf = textBuf;
|
|
17462
|
+
return b6;
|
|
17079
17463
|
}
|
|
17080
17464
|
var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, data, style, icons, iconSize, getIcon }, ref) {
|
|
17081
17465
|
const lvRef = (0, import_react9.useRef)(null);
|
|
@@ -17087,36 +17471,36 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17087
17471
|
const il = iconListRef.current;
|
|
17088
17472
|
iconListRef.current = 0;
|
|
17089
17473
|
if (il) {
|
|
17090
|
-
|
|
17091
|
-
|
|
17474
|
+
gui9.SendMessage(h, 4099, 1, 0);
|
|
17475
|
+
gui9.ImageListDestroy(il);
|
|
17092
17476
|
}
|
|
17093
17477
|
if (!icons || icons.length === 0)
|
|
17094
17478
|
return;
|
|
17095
17479
|
const size = iconSize ?? 32;
|
|
17096
|
-
const img =
|
|
17480
|
+
const img = gui9.ImageListCreate(size, size, 32, icons.length, 1);
|
|
17097
17481
|
if (!img)
|
|
17098
17482
|
return;
|
|
17099
17483
|
for (const p of icons) {
|
|
17100
|
-
const hbm =
|
|
17484
|
+
const hbm = gui9.CreateBitmapFromPixels(size, size, p);
|
|
17101
17485
|
if (hbm) {
|
|
17102
|
-
|
|
17103
|
-
|
|
17486
|
+
gui9.ImageListAdd(img, hbm);
|
|
17487
|
+
DeleteObject(hbm);
|
|
17104
17488
|
}
|
|
17105
17489
|
}
|
|
17106
|
-
|
|
17490
|
+
gui9.SendMessage(h, 4099, 1, img);
|
|
17107
17491
|
iconListRef.current = img;
|
|
17108
17492
|
}, [icons, iconSize]);
|
|
17109
17493
|
(0, import_react9.useEffect)(() => {
|
|
17110
17494
|
const h = lvRef.current;
|
|
17111
17495
|
if (!h)
|
|
17112
17496
|
return;
|
|
17113
|
-
const hdr =
|
|
17497
|
+
const hdr = gui9.SendMessage(h, 4127, 0, 0);
|
|
17114
17498
|
if (hdr) {
|
|
17115
|
-
let n2 =
|
|
17499
|
+
let n2 = gui9.SendMessage(hdr, 4608, 0, 0);
|
|
17116
17500
|
for (let k = n2 - 1; k >= 0; k--)
|
|
17117
|
-
|
|
17501
|
+
gui9.SendMessage(h, 4124, k, 0);
|
|
17118
17502
|
}
|
|
17119
|
-
|
|
17503
|
+
gui9.SendMessage(
|
|
17120
17504
|
h,
|
|
17121
17505
|
4150,
|
|
17122
17506
|
0,
|
|
@@ -17125,12 +17509,12 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17125
17509
|
);
|
|
17126
17510
|
const n = columns.length;
|
|
17127
17511
|
for (let j = 0; j < n; j++) {
|
|
17128
|
-
const titleBuf =
|
|
17129
|
-
const lvc = LVCOLUMNW.
|
|
17512
|
+
const titleBuf = WCHAR.encode(columns[j].name);
|
|
17513
|
+
const lvc = LVCOLUMNW.encode({
|
|
17130
17514
|
mask: 4 | 2 | 1,
|
|
17131
17515
|
fmt: alignToFmt(columns[j].align),
|
|
17132
17516
|
cx: columns[j].width ?? 100,
|
|
17133
|
-
pszText:
|
|
17517
|
+
pszText: titleBuf.ptr,
|
|
17134
17518
|
cchTextMax: 0,
|
|
17135
17519
|
iSubItem: j,
|
|
17136
17520
|
iImage: 0,
|
|
@@ -17140,28 +17524,28 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17140
17524
|
cxIdeal: 0
|
|
17141
17525
|
});
|
|
17142
17526
|
lvc.__titleBuf = titleBuf;
|
|
17143
|
-
|
|
17527
|
+
gui9.SendMessage(h, 4193, j, lvc.ptr);
|
|
17144
17528
|
}
|
|
17145
17529
|
}, [columns]);
|
|
17146
17530
|
(0, import_react9.useEffect)(() => {
|
|
17147
17531
|
const h = lvRef.current;
|
|
17148
17532
|
if (!h)
|
|
17149
17533
|
return;
|
|
17150
|
-
|
|
17534
|
+
gui9.SendMessage(h, 4105, 0, 0);
|
|
17151
17535
|
const nCols = columns.length;
|
|
17152
17536
|
for (let i = 0; i < data.length; i++) {
|
|
17153
17537
|
const record = data[i];
|
|
17154
17538
|
const img = getIcon ? getIcon(record, i) : void 0;
|
|
17155
17539
|
const itemBuf = makeLVItem(i, 0, cellText(record, columns[0], i), img);
|
|
17156
|
-
|
|
17540
|
+
gui9.SendMessage(h, 4173, 0, itemBuf.ptr);
|
|
17157
17541
|
for (let j = 1; j < nCols; j++) {
|
|
17158
17542
|
const subBuf = makeLVItem(i, j, cellText(record, columns[j], i));
|
|
17159
|
-
|
|
17543
|
+
gui9.SendMessage(h, 4172, 0, subBuf.ptr);
|
|
17160
17544
|
}
|
|
17161
17545
|
}
|
|
17162
17546
|
for (let j = 0; j < columns.length; j++) {
|
|
17163
17547
|
if (columns[j].width == null) {
|
|
17164
|
-
|
|
17548
|
+
gui9.SendMessage(
|
|
17165
17549
|
h,
|
|
17166
17550
|
4126,
|
|
17167
17551
|
j,
|
|
@@ -17178,14 +17562,12 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17178
17562
|
return handleCustomDraw(e.lParam, columns, data, lvRef.current);
|
|
17179
17563
|
}
|
|
17180
17564
|
if (code === -100) {
|
|
17181
|
-
const uNewState =
|
|
17182
|
-
const uOldState = readU32(e.lParam, NMLV_UOLD);
|
|
17565
|
+
const { uNewState, uOldState } = NMLISTVIEW.decode(e.lParam);
|
|
17183
17566
|
if ((uNewState & 2) !== (uOldState & 2))
|
|
17184
17567
|
return 1;
|
|
17185
17568
|
}
|
|
17186
17569
|
if (code === -2) {
|
|
17187
|
-
const iItem =
|
|
17188
|
-
const iSubItem = readI32(e.lParam, NMIA_SUBITEM);
|
|
17570
|
+
const { iItem, iSubItem } = NMLISTVIEW.decode(e.lParam);
|
|
17189
17571
|
const col = columns[iSubItem];
|
|
17190
17572
|
const record = data[iItem];
|
|
17191
17573
|
if (col?.onCellClick && record !== void 0)
|
|
@@ -17203,33 +17585,20 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17203
17585
|
const h = lvRef.current;
|
|
17204
17586
|
if (!h)
|
|
17205
17587
|
return;
|
|
17206
|
-
|
|
17207
|
-
if (!
|
|
17208
|
-
return;
|
|
17209
|
-
const sp = gui10.GetCursorPos();
|
|
17210
|
-
if (!sp)
|
|
17588
|
+
const pt = POINT.alloc();
|
|
17589
|
+
if (!GetCursorPos(pt.ptr))
|
|
17211
17590
|
return;
|
|
17212
|
-
|
|
17213
|
-
const
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
const lvhi = new ArrayBuffer(24);
|
|
17218
|
-
const lvd = new DataView(lvhi);
|
|
17219
|
-
lvd.setInt32(0, sdv.getInt32(0, true), true);
|
|
17220
|
-
lvd.setInt32(4, sdv.getInt32(4, true), true);
|
|
17221
|
-
lvd.setInt32(12, -1, true);
|
|
17222
|
-
lvd.setInt32(16, -1, true);
|
|
17223
|
-
const lvhiPtr = bufPtr2(lvhi);
|
|
17224
|
-
gui10.SendMessage(h, 4153, 0, lvhiPtr);
|
|
17225
|
-
const iItem = readI32(lvhiPtr, 12);
|
|
17226
|
-
const iSubItem = readI32(lvhiPtr, 16);
|
|
17591
|
+
ScreenToClient(h, pt.ptr);
|
|
17592
|
+
const { x: sx, y: sy } = POINT.decode(pt);
|
|
17593
|
+
const hit = LVHITTESTINFO.encode({ pt: [sx, sy], iItem: -1, iSubItem: -1 });
|
|
17594
|
+
gui9.SendMessage(h, 4153, 0, hit.ptr);
|
|
17595
|
+
const { iItem, iSubItem } = LVHITTESTINFO.decode(hit);
|
|
17227
17596
|
const style2 = resolveCellStyle(columns, data, iItem, iSubItem);
|
|
17228
17597
|
if (!style2 || style2.cursor === void 0)
|
|
17229
17598
|
return;
|
|
17230
|
-
const hc =
|
|
17599
|
+
const hc = LoadCursor(NULL, style2.cursor);
|
|
17231
17600
|
if (hc) {
|
|
17232
|
-
|
|
17601
|
+
SetCursor(hc);
|
|
17233
17602
|
return 1;
|
|
17234
17603
|
}
|
|
17235
17604
|
return;
|
|
@@ -17239,7 +17608,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
17239
17608
|
// _build/lib/react-qw/components/ProgressBar.js
|
|
17240
17609
|
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
17241
17610
|
var import_react10 = __toESM(require_react(), 1);
|
|
17242
|
-
import * as
|
|
17611
|
+
import * as gui10 from "gui";
|
|
17243
17612
|
var ProgressBar = (0, import_react10.forwardRef)(({ value = 0, max = 100, style, smooth }, ref) => {
|
|
17244
17613
|
const pbRef = (0, import_react10.useRef)(null);
|
|
17245
17614
|
const ws = 268435456 | 8388608 | (smooth ? 1 : 0);
|
|
@@ -17247,8 +17616,8 @@ var ProgressBar = (0, import_react10.forwardRef)(({ value = 0, max = 100, style,
|
|
|
17247
17616
|
const h = pbRef.current;
|
|
17248
17617
|
if (!h)
|
|
17249
17618
|
return;
|
|
17250
|
-
|
|
17251
|
-
|
|
17619
|
+
gui10.SendMessage(h, 1030, 0, max);
|
|
17620
|
+
gui10.SendMessage(h, 1026, Math.min(value, max), 0);
|
|
17252
17621
|
}, [value, max]);
|
|
17253
17622
|
return (0, import_jsx_runtime9.jsx)("w", { type: "msctls_progress32", ws, style, ref: (h) => {
|
|
17254
17623
|
pbRef.current = h;
|
|
@@ -17262,7 +17631,7 @@ var ProgressBar = (0, import_react10.forwardRef)(({ value = 0, max = 100, style,
|
|
|
17262
17631
|
// _build/lib/react-qw/components/RadioButton.js
|
|
17263
17632
|
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
17264
17633
|
var import_react11 = __toESM(require_react(), 1);
|
|
17265
|
-
import * as
|
|
17634
|
+
import * as gui11 from "gui";
|
|
17266
17635
|
var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked, defaultChecked = false, onChange, label, style, disabled }, ref) => {
|
|
17267
17636
|
const [internalChecked, setInternalChecked] = (0, import_react11.useState)(defaultChecked);
|
|
17268
17637
|
const isControlled = controlledChecked !== void 0;
|
|
@@ -17272,7 +17641,7 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
|
|
|
17272
17641
|
const h = rbRef.current;
|
|
17273
17642
|
if (!h)
|
|
17274
17643
|
return;
|
|
17275
|
-
|
|
17644
|
+
gui11.SendMessage(h, 241, displayChecked ? 1 : 0, 0);
|
|
17276
17645
|
}, [displayChecked]);
|
|
17277
17646
|
return (0, import_jsx_runtime10.jsx)("w", { type: "BUTTON", text: label ?? "", ws: 268435456 | 9, style, disabled, ref: (h) => {
|
|
17278
17647
|
rbRef.current = h;
|
|
@@ -17282,7 +17651,7 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
|
|
|
17282
17651
|
ref.current = h;
|
|
17283
17652
|
}, onEvent: (e) => {
|
|
17284
17653
|
if (e.msg === 514) {
|
|
17285
|
-
const newChecked =
|
|
17654
|
+
const newChecked = gui11.SendMessage(e.hwnd, 240, 0, 0) !== 0;
|
|
17286
17655
|
if (newChecked !== displayChecked) {
|
|
17287
17656
|
if (!isControlled)
|
|
17288
17657
|
setInternalChecked(newChecked);
|
|
@@ -17295,24 +17664,27 @@ var RadioButton = (0, import_react11.forwardRef)(({ checked: controlledChecked,
|
|
|
17295
17664
|
// _build/lib/react-qw/components/ScrollView.js
|
|
17296
17665
|
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
17297
17666
|
var import_react12 = __toESM(require_react(), 1);
|
|
17298
|
-
import * as
|
|
17667
|
+
import * as gui12 from "gui";
|
|
17299
17668
|
var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth, contentHeight }, ref) => {
|
|
17300
17669
|
const svRef = (0, import_react12.useRef)(null);
|
|
17301
17670
|
const contentRef = (0, import_react12.useRef)(null);
|
|
17302
17671
|
const scrollXRef = (0, import_react12.useRef)(0);
|
|
17303
17672
|
const scrollYRef = (0, import_react12.useRef)(0);
|
|
17304
17673
|
function updateScroll(sv, content) {
|
|
17305
|
-
const svRect =
|
|
17674
|
+
const svRect = gui12.GetClientRect(sv);
|
|
17306
17675
|
if (!svRect)
|
|
17307
17676
|
return;
|
|
17308
17677
|
const svW = svRect.right - svRect.left;
|
|
17309
17678
|
const svH = svRect.bottom - svRect.top;
|
|
17310
|
-
const
|
|
17679
|
+
const hdc = GetDC(NULL);
|
|
17680
|
+
const scale = hdc ? GetDeviceCaps(hdc, 88) / 96 : 1;
|
|
17681
|
+
if (hdc)
|
|
17682
|
+
ReleaseDC(NULL, hdc);
|
|
17311
17683
|
const natW = Math.round((contentWidth ?? svW / scale) * scale);
|
|
17312
17684
|
const natH = Math.round((contentHeight ?? svH / scale) * scale);
|
|
17313
17685
|
scrollXRef.current = Math.max(0, Math.min(scrollXRef.current, natW - svW));
|
|
17314
17686
|
scrollYRef.current = Math.max(0, Math.min(scrollYRef.current, natH - svH));
|
|
17315
|
-
|
|
17687
|
+
SetWindowPos(
|
|
17316
17688
|
content,
|
|
17317
17689
|
0,
|
|
17318
17690
|
-scrollXRef.current,
|
|
@@ -17324,18 +17696,18 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17324
17696
|
);
|
|
17325
17697
|
forceFlexLayout(content);
|
|
17326
17698
|
if (natW > svW) {
|
|
17327
|
-
|
|
17328
|
-
|
|
17699
|
+
gui12.SetScrollInfo(sv, 0, { min: 0, max: natW - 1, page: svW, pos: scrollXRef.current }, true);
|
|
17700
|
+
ShowScrollBar(sv, 0, 1);
|
|
17329
17701
|
} else {
|
|
17330
17702
|
scrollXRef.current = 0;
|
|
17331
|
-
|
|
17703
|
+
ShowScrollBar(sv, 0, 0);
|
|
17332
17704
|
}
|
|
17333
17705
|
if (natH > svH) {
|
|
17334
|
-
|
|
17335
|
-
|
|
17706
|
+
gui12.SetScrollInfo(sv, 1, { min: 0, max: natH - 1, page: svH, pos: scrollYRef.current }, true);
|
|
17707
|
+
ShowScrollBar(sv, 1, 1);
|
|
17336
17708
|
} else {
|
|
17337
17709
|
scrollYRef.current = 0;
|
|
17338
|
-
|
|
17710
|
+
ShowScrollBar(sv, 1, 0);
|
|
17339
17711
|
}
|
|
17340
17712
|
}
|
|
17341
17713
|
(0, import_react12.useLayoutEffect)(() => {
|
|
@@ -17351,7 +17723,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17351
17723
|
} else {
|
|
17352
17724
|
scrollXRef.current = newPos;
|
|
17353
17725
|
}
|
|
17354
|
-
|
|
17726
|
+
SetWindowPos(
|
|
17355
17727
|
content,
|
|
17356
17728
|
0,
|
|
17357
17729
|
-scrollXRef.current,
|
|
@@ -17361,14 +17733,14 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17361
17733
|
1 | 4
|
|
17362
17734
|
/* gui.SetWindowPosFlag.SWP_NOZORDER */
|
|
17363
17735
|
);
|
|
17364
|
-
|
|
17736
|
+
gui12.SetScrollInfo(sv, bar, { pos: newPos }, true);
|
|
17365
17737
|
}
|
|
17366
17738
|
function handleScroll(e, bar) {
|
|
17367
17739
|
const sv = svRef.current;
|
|
17368
17740
|
const content = contentRef.current;
|
|
17369
17741
|
if (!sv || !content)
|
|
17370
17742
|
return;
|
|
17371
|
-
const info =
|
|
17743
|
+
const info = gui12.GetScrollInfo(sv, bar);
|
|
17372
17744
|
const maxPos = info.max - info.page + 1;
|
|
17373
17745
|
const code = e.wParam & 65535;
|
|
17374
17746
|
const ref_ = bar === 1 ? scrollYRef : scrollXRef;
|
|
@@ -17402,7 +17774,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17402
17774
|
if (!isHorz && contentHeight === void 0)
|
|
17403
17775
|
return;
|
|
17404
17776
|
const bar = isHorz ? 0 : 1;
|
|
17405
|
-
const info =
|
|
17777
|
+
const info = gui12.GetScrollInfo(sv, bar);
|
|
17406
17778
|
const maxPos = info.max - info.page + 1;
|
|
17407
17779
|
const ref_ = isHorz ? scrollXRef : scrollYRef;
|
|
17408
17780
|
let newPos = ref_.current + dy;
|
|
@@ -17419,7 +17791,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17419
17791
|
}, onEvent: {
|
|
17420
17792
|
fn: (e) => {
|
|
17421
17793
|
if (e.msg === 132 || e.msg === 161) {
|
|
17422
|
-
return
|
|
17794
|
+
return DefWindowProc(e.hwnd, e.msg, e.wParam, e.lParam);
|
|
17423
17795
|
}
|
|
17424
17796
|
if (e.msg === 277) {
|
|
17425
17797
|
handleScroll(
|
|
@@ -17451,7 +17823,7 @@ var ScrollView = (0, import_react12.forwardRef)(({ children, style, contentWidth
|
|
|
17451
17823
|
// _build/lib/react-qw/components/Slider.js
|
|
17452
17824
|
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
17453
17825
|
var import_react13 = __toESM(require_react(), 1);
|
|
17454
|
-
import * as
|
|
17826
|
+
import * as gui13 from "gui";
|
|
17455
17827
|
var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 100, vertical = false, disabled, style }, ref) => {
|
|
17456
17828
|
const wrapperRef = (0, import_react13.useRef)(null);
|
|
17457
17829
|
const sliderRef = (0, import_react13.useRef)(null);
|
|
@@ -17460,14 +17832,14 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
|
|
|
17460
17832
|
if (!h)
|
|
17461
17833
|
return;
|
|
17462
17834
|
const lParam = min & 65535 | (max & 65535) << 16;
|
|
17463
|
-
|
|
17464
|
-
|
|
17835
|
+
gui13.SendMessage(h, 1030, 0, lParam);
|
|
17836
|
+
gui13.SendMessage(h, 1029, 1, value);
|
|
17465
17837
|
}, [min, max]);
|
|
17466
17838
|
(0, import_react13.useEffect)(() => {
|
|
17467
17839
|
const h = sliderRef.current;
|
|
17468
17840
|
if (!h)
|
|
17469
17841
|
return;
|
|
17470
|
-
|
|
17842
|
+
gui13.SendMessage(h, 1029, 1, value);
|
|
17471
17843
|
}, [value]);
|
|
17472
17844
|
const tbStyle = 268435456 | 65536 | 1 | (vertical ? 2 : 0);
|
|
17473
17845
|
return (0, import_jsx_runtime12.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style, ref: (h) => {
|
|
@@ -17478,13 +17850,13 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
|
|
|
17478
17850
|
ref.current = h;
|
|
17479
17851
|
}, onEvent: (e) => {
|
|
17480
17852
|
if (e.msg === 132 || e.msg === 161) {
|
|
17481
|
-
return
|
|
17853
|
+
return DefWindowProc(e.hwnd, e.msg, e.wParam, e.lParam);
|
|
17482
17854
|
}
|
|
17483
17855
|
if (e.msg === 276 || e.msg === 277) {
|
|
17484
17856
|
const h = sliderRef.current;
|
|
17485
17857
|
if (!h)
|
|
17486
17858
|
return 0;
|
|
17487
|
-
const pos =
|
|
17859
|
+
const pos = gui13.SendMessage(h, 1024, 0, 0);
|
|
17488
17860
|
onChange?.(pos);
|
|
17489
17861
|
return 0;
|
|
17490
17862
|
}
|
|
@@ -17497,24 +17869,7 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
|
|
|
17497
17869
|
// _build/lib/react-qw/components/Tab.js
|
|
17498
17870
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
17499
17871
|
var import_react14 = __toESM(require_react(), 1);
|
|
17500
|
-
import * as
|
|
17501
|
-
import * as ffi8 from "ffi";
|
|
17502
|
-
var TCITEMW = struct({
|
|
17503
|
-
mask: "u32",
|
|
17504
|
-
dwState: "u32",
|
|
17505
|
-
dwStateMask: "u32",
|
|
17506
|
-
pszText: "ptr",
|
|
17507
|
-
cchTextMax: "i32",
|
|
17508
|
-
iImage: "i32",
|
|
17509
|
-
lParam: "ptr"
|
|
17510
|
-
});
|
|
17511
|
-
function textToUtf163(s) {
|
|
17512
|
-
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
17513
|
-
const dv = new DataView(buf);
|
|
17514
|
-
for (let i = 0; i < s.length; i++)
|
|
17515
|
-
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
17516
|
-
return buf;
|
|
17517
|
-
}
|
|
17872
|
+
import * as gui14 from "gui";
|
|
17518
17873
|
var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
|
|
17519
17874
|
const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
|
|
17520
17875
|
const isControlled = controlledIndex !== void 0;
|
|
@@ -17524,27 +17879,27 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
17524
17879
|
const h = tabHwnd.current;
|
|
17525
17880
|
if (!h)
|
|
17526
17881
|
return;
|
|
17527
|
-
|
|
17882
|
+
gui14.SendMessage(h, 4873, 0, 0);
|
|
17528
17883
|
for (let i = 0; i < tabs.length; i++) {
|
|
17529
|
-
const titleBuf =
|
|
17530
|
-
const tci = TCITEMW.
|
|
17884
|
+
const titleBuf = WCHAR.encode(tabs[i].title);
|
|
17885
|
+
const tci = TCITEMW.encode({
|
|
17531
17886
|
mask: 1,
|
|
17532
17887
|
dwState: 0,
|
|
17533
17888
|
dwStateMask: 0,
|
|
17534
|
-
pszText:
|
|
17889
|
+
pszText: titleBuf.ptr,
|
|
17535
17890
|
cchTextMax: tabs[i].title.length + 1,
|
|
17536
17891
|
iImage: 0,
|
|
17537
17892
|
lParam: 0
|
|
17538
17893
|
});
|
|
17539
|
-
const tciPtr =
|
|
17540
|
-
|
|
17894
|
+
const tciPtr = tci.ptr;
|
|
17895
|
+
gui14.SendMessage(h, 4926, i, tciPtr);
|
|
17541
17896
|
}
|
|
17542
|
-
|
|
17897
|
+
gui14.SendMessage(h, 4876, sel, 0);
|
|
17543
17898
|
}, [tabs]);
|
|
17544
17899
|
(0, import_react14.useEffect)(() => {
|
|
17545
17900
|
const h = tabHwnd.current;
|
|
17546
17901
|
if (h)
|
|
17547
|
-
|
|
17902
|
+
gui14.SendMessage(h, 4876, sel, 0);
|
|
17548
17903
|
}, [sel]);
|
|
17549
17904
|
return (0, import_jsx_runtime13.jsxs)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
17550
17905
|
if (e.msg === 78) {
|
|
@@ -17553,7 +17908,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
17553
17908
|
return;
|
|
17554
17909
|
const code = nmCode(e.lParam);
|
|
17555
17910
|
if (code === -552 || code === -2) {
|
|
17556
|
-
const newSel =
|
|
17911
|
+
const newSel = gui14.SendMessage(h, 4875, 0, 0);
|
|
17557
17912
|
if (newSel !== sel) {
|
|
17558
17913
|
if (!isControlled)
|
|
17559
17914
|
setInternalIndex(newSel);
|
|
@@ -17566,54 +17921,17 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
17566
17921
|
|
|
17567
17922
|
// _build/lib/react-qw/components/Tooltip.js
|
|
17568
17923
|
var import_react15 = __toESM(require_react(), 1);
|
|
17569
|
-
import * as
|
|
17570
|
-
import * as ffi9 from "ffi";
|
|
17571
|
-
var TTTOOLINFOW = struct({
|
|
17572
|
-
cbSize: "u32",
|
|
17573
|
-
uFlags: "u32",
|
|
17574
|
-
hwnd: "ptr",
|
|
17575
|
-
uId: "ptr",
|
|
17576
|
-
rect: "i32[4]",
|
|
17577
|
-
hinst: "ptr",
|
|
17578
|
-
lpszText: "ptr",
|
|
17579
|
-
lParam: "ptr",
|
|
17580
|
-
lpReserved: "ptr"
|
|
17581
|
-
// WinXP+ 追加字段(系统 sizeof 含之)
|
|
17582
|
-
});
|
|
17924
|
+
import * as gui15 from "gui";
|
|
17583
17925
|
|
|
17584
17926
|
// _build/lib/react-qw/components/TreeView.js
|
|
17585
17927
|
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
17586
17928
|
var import_react16 = __toESM(require_react(), 1);
|
|
17587
|
-
import * as
|
|
17588
|
-
import * as ffi10 from "ffi";
|
|
17589
|
-
var TVITEM = struct({
|
|
17590
|
-
mask: "u32",
|
|
17591
|
-
hItem: "ptr",
|
|
17592
|
-
state: "u32",
|
|
17593
|
-
stateMask: "u32",
|
|
17594
|
-
pszText: "ptr",
|
|
17595
|
-
cchTextMax: "i32",
|
|
17596
|
-
iImage: "i32",
|
|
17597
|
-
iSelectedImage: "i32",
|
|
17598
|
-
cChildren: "i32",
|
|
17599
|
-
lParam: "ptr"
|
|
17600
|
-
});
|
|
17601
|
-
var TVINSERTSTRUCT = struct({ hParent: "ptr", hInsertAfter: "ptr", item: TVITEM });
|
|
17602
|
-
function textToUtf164(s) {
|
|
17603
|
-
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
17604
|
-
const dv = new DataView(buf);
|
|
17605
|
-
for (let i = 0; i < s.length; i++)
|
|
17606
|
-
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
17607
|
-
return buf;
|
|
17608
|
-
}
|
|
17609
|
-
function bufPtr3(buf) {
|
|
17610
|
-
return ffi10.bufferPtr(buf);
|
|
17611
|
-
}
|
|
17929
|
+
import * as gui16 from "gui";
|
|
17612
17930
|
function buildTvItem(textPtr, cChildren) {
|
|
17613
17931
|
let mask = 1;
|
|
17614
17932
|
if (cChildren > 0)
|
|
17615
17933
|
mask |= 64;
|
|
17616
|
-
return TVITEM.
|
|
17934
|
+
return TVITEM.encode({
|
|
17617
17935
|
mask,
|
|
17618
17936
|
hItem: 0,
|
|
17619
17937
|
state: 0,
|
|
@@ -17629,24 +17947,24 @@ function buildTvItem(textPtr, cChildren) {
|
|
|
17629
17947
|
function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
|
|
17630
17948
|
for (const node of nodes) {
|
|
17631
17949
|
const cChildren = node.children && node.children.length > 0 ? 1 : 0;
|
|
17632
|
-
const textBuf =
|
|
17633
|
-
const itemBuf = buildTvItem(
|
|
17634
|
-
const item = TVITEM.
|
|
17635
|
-
const tvins = TVINSERTSTRUCT.
|
|
17636
|
-
const hItem =
|
|
17950
|
+
const textBuf = WCHAR.encode(node.label);
|
|
17951
|
+
const itemBuf = buildTvItem(textBuf.ptr, cChildren);
|
|
17952
|
+
const item = TVITEM.decode(itemBuf);
|
|
17953
|
+
const tvins = TVINSERTSTRUCT.encode({ hParent: parentHandle, hInsertAfter: -65536, item });
|
|
17954
|
+
const hItem = gui16.SendMessage(hTree, 4402, 0, tvins.ptr);
|
|
17637
17955
|
hItemMap.set(hItem, node);
|
|
17638
17956
|
if (node.key)
|
|
17639
17957
|
keyMap.set(node.key, hItem);
|
|
17640
17958
|
if (node.children && node.children.length > 0) {
|
|
17641
17959
|
insertItems(hTree, node.children, hItem, hItemMap, keyMap);
|
|
17642
|
-
|
|
17960
|
+
gui16.SendMessage(hTree, 4354, 2, hItem);
|
|
17643
17961
|
}
|
|
17644
17962
|
}
|
|
17645
17963
|
}
|
|
17646
17964
|
function deleteAllItems(hTree) {
|
|
17647
|
-
const n =
|
|
17965
|
+
const n = gui16.SendMessage(hTree, 4357, 0, 0);
|
|
17648
17966
|
if (n > 0)
|
|
17649
|
-
|
|
17967
|
+
gui16.SendMessage(
|
|
17650
17968
|
hTree,
|
|
17651
17969
|
4353,
|
|
17652
17970
|
1,
|
|
@@ -17678,7 +17996,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17678
17996
|
const h = tvRef.current;
|
|
17679
17997
|
if (!h)
|
|
17680
17998
|
return;
|
|
17681
|
-
|
|
17999
|
+
gui16.SendMessage(
|
|
17682
18000
|
h,
|
|
17683
18001
|
4396,
|
|
17684
18002
|
0,
|
|
@@ -17694,7 +18012,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17694
18012
|
return;
|
|
17695
18013
|
const hItem = keyMapRef.current.get(selKey);
|
|
17696
18014
|
if (hItem !== void 0)
|
|
17697
|
-
|
|
18015
|
+
gui16.SendMessage(h, 4363, 9, hItem);
|
|
17698
18016
|
}, [selKey]);
|
|
17699
18017
|
return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
17700
18018
|
if (e.msg === 78) {
|
|
@@ -17703,7 +18021,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17703
18021
|
const h = tvRef.current;
|
|
17704
18022
|
if (!h)
|
|
17705
18023
|
return;
|
|
17706
|
-
const hCaret =
|
|
18024
|
+
const hCaret = gui16.SendMessage(h, 4362, 9, 0);
|
|
17707
18025
|
const node = hItemMapRef.current.get(hCaret) ?? null;
|
|
17708
18026
|
const key = node?.key ?? null;
|
|
17709
18027
|
if (!isControlled)
|
|
@@ -17719,153 +18037,63 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17719
18037
|
// _build/lib/react-qw/components/PathPicker.js
|
|
17720
18038
|
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
|
|
17721
18039
|
var import_react17 = __toESM(require_react(), 1);
|
|
17722
|
-
import * as ffi11 from "ffi";
|
|
17723
|
-
import * as win3 from "win";
|
|
17724
18040
|
|
|
17725
|
-
// _build/lib/
|
|
17726
|
-
var
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
|
|
17734
|
-
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
nMaxFileTitle: "u32",
|
|
17738
|
-
lpstrInitialDir: "ptr",
|
|
17739
|
-
lpstrTitle: "ptr",
|
|
17740
|
-
Flags: "u32",
|
|
17741
|
-
nFileOffset: "u16",
|
|
17742
|
-
nFileExtension: "u16",
|
|
17743
|
-
lpstrDefExt: "ptr",
|
|
17744
|
-
lCustData: "ptr",
|
|
17745
|
-
lpfnHook: "ptr",
|
|
17746
|
-
lpTemplateName: "ptr",
|
|
17747
|
-
pvReserved: "ptr",
|
|
17748
|
-
dwReserved: "u32",
|
|
17749
|
-
FlagsEx: "u32"
|
|
17750
|
-
});
|
|
17751
|
-
var BROWSEINFOW = struct({
|
|
17752
|
-
hwndOwner: "ptr",
|
|
17753
|
-
pidlRoot: "ptr",
|
|
17754
|
-
pszDisplayName: "ptr",
|
|
17755
|
-
lpszTitle: "ptr",
|
|
17756
|
-
ulFlags: "u32",
|
|
17757
|
-
lpfn: "ptr",
|
|
17758
|
-
lParam: "ptr",
|
|
17759
|
-
iImage: "i32"
|
|
17760
|
-
});
|
|
18041
|
+
// _build/lib/windows/comdlg32.js
|
|
18042
|
+
var b3 = (name, sig) => bind("comdlg32.dll", name, sig);
|
|
18043
|
+
var GetOpenFileName = /* @__PURE__ */ b3("GetOpenFileNameW", "<BYTE>ptr -> u32");
|
|
18044
|
+
|
|
18045
|
+
// _build/lib/windows/shell32.js
|
|
18046
|
+
var b4 = (name, sig) => bind("shell32.dll", name, sig);
|
|
18047
|
+
var SHBrowseForFolder = /* @__PURE__ */ b4("SHBrowseForFolderW", "<BYTE>ptr -> <>ptr");
|
|
18048
|
+
var SHGetPathFromIDList = /* @__PURE__ */ b4("SHGetPathFromIDListW", "<>ptr <BYTE>ptr -> u32");
|
|
18049
|
+
|
|
18050
|
+
// _build/lib/windows/ole32.js
|
|
18051
|
+
var b5 = (name, sig) => bind("ole32.dll", name, sig);
|
|
18052
|
+
var CoTaskMemFree = /* @__PURE__ */ b5("CoTaskMemFree", "<>ptr -> void");
|
|
17761
18053
|
|
|
17762
18054
|
// _build/lib/react-qw/components/PathPicker.js
|
|
17763
|
-
var FFI_PTR = ffi11.FFI_TYPE_POINTER;
|
|
17764
|
-
var FFI_U32 = ffi11.FFI_TYPE_UINT32;
|
|
17765
|
-
var _GetOpenFileNameW = 0;
|
|
17766
|
-
var _SHBrowseForFolderW = 0;
|
|
17767
|
-
var _SHGetPathFromIDListW = 0;
|
|
17768
|
-
var _CoTaskMemFree = 0;
|
|
17769
|
-
function ensureDlls() {
|
|
17770
|
-
if (_GetOpenFileNameW)
|
|
17771
|
-
return true;
|
|
17772
|
-
const comdlg32 = win3.LoadLibrary("comdlg32.dll");
|
|
17773
|
-
const shell32 = win3.LoadLibrary("shell32.dll");
|
|
17774
|
-
const ole32 = win3.LoadLibrary("ole32.dll");
|
|
17775
|
-
if (!comdlg32 || !shell32 || !ole32)
|
|
17776
|
-
return false;
|
|
17777
|
-
const load = (lib, name) => win3.GetProcAddress(lib, name) || 0;
|
|
17778
|
-
_GetOpenFileNameW = load(comdlg32, "GetOpenFileNameW");
|
|
17779
|
-
_SHBrowseForFolderW = load(shell32, "SHBrowseForFolderW");
|
|
17780
|
-
_SHGetPathFromIDListW = load(shell32, "SHGetPathFromIDListW");
|
|
17781
|
-
_CoTaskMemFree = load(ole32, "CoTaskMemFree");
|
|
17782
|
-
return !!_GetOpenFileNameW && !!_SHBrowseForFolderW && !!_SHGetPathFromIDListW && !!_CoTaskMemFree;
|
|
17783
|
-
}
|
|
17784
|
-
function strToWide(s) {
|
|
17785
|
-
return new TextEncoder("utf-16le").encode(s + "\0").buffer;
|
|
17786
|
-
}
|
|
17787
|
-
var _decoder = new TextDecoder("utf-16le");
|
|
17788
|
-
function wideToStr(buf, offset = 0) {
|
|
17789
|
-
const str = _decoder.decode(new Uint8Array(buf, offset));
|
|
17790
|
-
const nullIdx = str.indexOf("\0");
|
|
17791
|
-
return nullIdx >= 0 ? str.substring(0, nullIdx) : str;
|
|
17792
|
-
}
|
|
17793
18055
|
function openFileDialog(owner, filter, title, multiple) {
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
const
|
|
17797
|
-
const filterWide = strToWide(filter);
|
|
17798
|
-
const titleWide = title ? strToWide(title) : null;
|
|
18056
|
+
const fileBuf = WCHAR.alloc(260);
|
|
18057
|
+
const filterWide = WCHAR.encode(filter);
|
|
18058
|
+
const titleWide = title ? WCHAR.encode(title) : null;
|
|
17799
18059
|
let flags = 4096 | 2048 | 8;
|
|
17800
18060
|
if (multiple)
|
|
17801
18061
|
flags |= 512;
|
|
17802
18062
|
flags |= 524288;
|
|
17803
|
-
const ofn = OPENFILENAMEW.
|
|
18063
|
+
const ofn = OPENFILENAMEW.encode({
|
|
17804
18064
|
lStructSize: OPENFILENAMEW.size,
|
|
17805
18065
|
hwndOwner: owner,
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
lpstrCustomFilter: 0,
|
|
17809
|
-
nMaxCustFilter: 0,
|
|
17810
|
-
nFilterIndex: 0,
|
|
17811
|
-
lpstrFile: ffi11.bufferPtr(fileBuf),
|
|
18066
|
+
lpstrFilter: filterWide.ptr,
|
|
18067
|
+
lpstrFile: fileBuf.ptr,
|
|
17812
18068
|
nMaxFile: 260,
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
lpstrInitialDir: 0,
|
|
17816
|
-
lpstrTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17817
|
-
Flags: flags,
|
|
17818
|
-
nFileOffset: 0,
|
|
17819
|
-
nFileExtension: 0,
|
|
17820
|
-
lpstrDefExt: 0,
|
|
17821
|
-
lCustData: 0,
|
|
17822
|
-
lpfnHook: 0,
|
|
17823
|
-
lpTemplateName: 0,
|
|
17824
|
-
pvReserved: 0,
|
|
17825
|
-
dwReserved: 0,
|
|
17826
|
-
FlagsEx: 0
|
|
18069
|
+
lpstrTitle: titleWide?.ptr ?? 0,
|
|
18070
|
+
Flags: flags
|
|
17827
18071
|
});
|
|
17828
|
-
const ret =
|
|
18072
|
+
const ret = GetOpenFileName(ofn);
|
|
17829
18073
|
if (!ret)
|
|
17830
18074
|
return null;
|
|
17831
18075
|
if (!multiple) {
|
|
17832
|
-
return
|
|
17833
|
-
}
|
|
17834
|
-
const dir = wideToStr(fileBuf);
|
|
17835
|
-
let pos = (dir.length + 1) * 2;
|
|
17836
|
-
const files = [];
|
|
17837
|
-
while (pos < fileBuf.byteLength) {
|
|
17838
|
-
const f = wideToStr(fileBuf, pos);
|
|
17839
|
-
if (f.length === 0)
|
|
17840
|
-
break;
|
|
17841
|
-
files.push(dir + "\\" + f);
|
|
17842
|
-
pos += (f.length + 1) * 2;
|
|
18076
|
+
return WCHAR.decode(fileBuf);
|
|
17843
18077
|
}
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
18078
|
+
const strs = new TextDecoder("utf-16le").decode(new Uint8Array(fileBuf)).split("\0");
|
|
18079
|
+
const dir = strs[0] ?? "";
|
|
18080
|
+
const files = strs.slice(1).filter((f) => f.length > 0).map((f) => dir + "\\" + f);
|
|
18081
|
+
return files.length > 0 ? files : [dir];
|
|
17847
18082
|
}
|
|
17848
18083
|
function openFolderDialog(owner, title) {
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
const titleWide = title ? strToWide(title) : null;
|
|
17852
|
-
const bi = BROWSEINFOW.write({
|
|
18084
|
+
const titleWide = title ? WCHAR.encode(title) : null;
|
|
18085
|
+
const bi = BROWSEINFOW.encode({
|
|
17853
18086
|
hwndOwner: owner,
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
lpszTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17857
|
-
ulFlags: 65,
|
|
17858
|
-
lpfn: 0,
|
|
17859
|
-
lParam: 0,
|
|
17860
|
-
iImage: 0
|
|
18087
|
+
lpszTitle: titleWide?.ptr ?? 0,
|
|
18088
|
+
ulFlags: 65
|
|
17861
18089
|
});
|
|
17862
|
-
const pidl =
|
|
18090
|
+
const pidl = SHBrowseForFolder(bi);
|
|
17863
18091
|
if (!pidl)
|
|
17864
18092
|
return null;
|
|
17865
|
-
const pathBuf =
|
|
17866
|
-
const ok =
|
|
17867
|
-
|
|
17868
|
-
return ok ?
|
|
18093
|
+
const pathBuf = WCHAR.alloc(260);
|
|
18094
|
+
const ok = SHGetPathFromIDList(pidl, pathBuf);
|
|
18095
|
+
CoTaskMemFree(pidl);
|
|
18096
|
+
return ok ? WCHAR.decode(pathBuf) : null;
|
|
17869
18097
|
}
|
|
17870
18098
|
var PathPicker = (0, import_react17.forwardRef)((props, ref) => {
|
|
17871
18099
|
const { type = "file", filter = "All Files\0*.*\0\0", title, disabled, style } = props;
|
|
@@ -17916,7 +18144,7 @@ var rootMap = /* @__PURE__ */ new Map();
|
|
|
17916
18144
|
function ensureDefaultClass() {
|
|
17917
18145
|
if (defaultClassRegistered)
|
|
17918
18146
|
return DEFAULT_CLASS;
|
|
17919
|
-
|
|
18147
|
+
gui17.RegisterClass(DEFAULT_CLASS, (hwnd2, msg, wParam, lParam) => {
|
|
17920
18148
|
const entry = rootMap.get(hwnd2);
|
|
17921
18149
|
if (msg === 2 && entry) {
|
|
17922
18150
|
rootMap.delete(hwnd2);
|
|
@@ -17929,7 +18157,7 @@ function ensureDefaultClass() {
|
|
|
17929
18157
|
return result;
|
|
17930
18158
|
if (msg === 5)
|
|
17931
18159
|
forceFlexLayout(hwnd2);
|
|
17932
|
-
return
|
|
18160
|
+
return DefWindowProc(hwnd2, msg, wParam, lParam);
|
|
17933
18161
|
});
|
|
17934
18162
|
defaultClassRegistered = true;
|
|
17935
18163
|
return DEFAULT_CLASS;
|
|
@@ -17942,15 +18170,15 @@ function createRoot(container) {
|
|
|
17942
18170
|
const ws = (cfg.ws ?? 0) | 13565952;
|
|
17943
18171
|
const w = (cfg.width ?? 800) * scaleFactor;
|
|
17944
18172
|
const h = (cfg.height ?? 600) * scaleFactor;
|
|
17945
|
-
const [sw, sh] =
|
|
18173
|
+
const [sw, sh] = [GetSystemMetrics(0), GetSystemMetrics(1)];
|
|
17946
18174
|
const x = cfg.x === void 0 ? (sw - w) / 2 | 0 : cfg.x === -2147483648 ? -2147483648 : cfg.x * scaleFactor;
|
|
17947
18175
|
const y = cfg.y === void 0 ? (sh - h) / 2 | 0 : cfg.y === -2147483648 ? -2147483648 : cfg.y * scaleFactor;
|
|
17948
|
-
const hwin =
|
|
18176
|
+
const hwin = gui17.CreateWindow(className, cfg.text || "", ws, x, y, w, h, null, null);
|
|
17949
18177
|
if (!hwin)
|
|
17950
18178
|
throw new Error("CreateWindow failed");
|
|
17951
18179
|
hwnd2 = hwin;
|
|
17952
18180
|
if (!cfg.noShowWindow)
|
|
17953
|
-
|
|
18181
|
+
gui17.ShowWindow(hwnd2);
|
|
17954
18182
|
} else {
|
|
17955
18183
|
hwnd2 = container;
|
|
17956
18184
|
}
|
|
@@ -17980,29 +18208,29 @@ function render(element, containerOrConfig, _callback) {
|
|
|
17980
18208
|
// _build/test/test_react_hidden.js
|
|
17981
18209
|
var WS_CHILD = 1073741824;
|
|
17982
18210
|
var WS_VISIBLE = 268435456;
|
|
17983
|
-
|
|
18211
|
+
gui18.RegisterClass("ReactHidden", (hwnd2, msg, wParam, lParam) => {
|
|
17984
18212
|
if (!hwnd2)
|
|
17985
|
-
return
|
|
18213
|
+
return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
|
|
17986
18214
|
if (msg === 2) {
|
|
17987
|
-
|
|
18215
|
+
gui18.PostQuitMessage(0);
|
|
17988
18216
|
return 0;
|
|
17989
18217
|
}
|
|
17990
18218
|
if (msg === 513) {
|
|
17991
|
-
|
|
18219
|
+
gui18.PostQuitMessage(0);
|
|
17992
18220
|
return 0;
|
|
17993
18221
|
}
|
|
17994
|
-
return
|
|
18222
|
+
return gui18.DefWindowProc(hwnd2, msg, wParam, lParam);
|
|
17995
18223
|
});
|
|
17996
18224
|
function App() {
|
|
17997
18225
|
const [hidden, setHidden] = (0, import_react18.useState)(true);
|
|
17998
18226
|
(0, import_react18.useEffect)(() => {
|
|
17999
|
-
|
|
18227
|
+
os5.setTimeout(() => setHidden(false), 2e3);
|
|
18000
18228
|
}, []);
|
|
18001
18229
|
return (0, import_jsx_runtime16.jsxs)("w", { type: "STATIC", ws: WS_CHILD | WS_VISIBLE, style: { width: 480, height: 360, flexDirection: "column", padding: 10, gap: 10 }, children: [(0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: "Click to close", ws: WS_CHILD | WS_VISIBLE, style: { width: 200, height: 30 } }), (0, import_jsx_runtime16.jsx)("w", { type: "STATIC", text: hidden ? "HIDDEN" : "VISIBLE", ws: WS_CHILD | WS_VISIBLE, hidden, style: { width: 200, height: 100 } })] });
|
|
18002
18230
|
}
|
|
18003
|
-
var hwnd =
|
|
18231
|
+
var hwnd = gui18.CreateWindow("ReactHidden", "Hidden Prop Test", 13565952, 200, 200, 500, 400, null, null);
|
|
18004
18232
|
if (hwnd) {
|
|
18005
|
-
|
|
18233
|
+
gui18.ShowWindow(hwnd);
|
|
18006
18234
|
render((0, import_jsx_runtime16.jsx)(App, {}), hwnd);
|
|
18007
18235
|
}
|
|
18008
18236
|
/*! Bundled license information:
|