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