quickwin 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abort.d.ts +21 -0
- package/lib/assert.d.ts +2 -0
- package/lib/bitmap.d.ts +7 -0
- package/lib/cache-utils.d.ts +6 -0
- package/lib/certs.d.ts +1 -0
- package/lib/dpi.d.ts +9 -0
- package/lib/dumpRects.d.ts +2 -0
- package/lib/exec-log.d.ts +23 -0
- package/lib/fetch.d.ts +4 -0
- package/lib/ffi/bind.d.ts +70 -0
- package/lib/ffi/ctype.d.ts +117 -0
- package/lib/ffi/index.d.ts +2 -0
- package/lib/ffi/struct.d.ts +174 -0
- package/lib/http-common.d.ts +143 -0
- package/lib/http-server.d.ts +59 -0
- package/lib/polyfill.d.ts +22 -0
- package/lib/react-qw/components/Button.d.ts +9 -0
- package/lib/react-qw/components/CheckBox.d.ts +11 -0
- package/lib/react-qw/components/ComboBox.d.ts +11 -0
- package/lib/react-qw/components/DateTimePicker.d.ts +15 -0
- package/lib/react-qw/components/Input.d.ts +15 -0
- package/lib/react-qw/components/Link.d.ts +12 -0
- package/lib/react-qw/components/ListBox.d.ts +13 -0
- package/lib/react-qw/components/ListView.d.ts +37 -0
- package/lib/react-qw/components/PathPicker.d.ts +23 -0
- package/lib/react-qw/components/ProgressBar.d.ts +9 -0
- package/lib/react-qw/components/RadioButton.d.ts +11 -0
- package/lib/react-qw/components/ScrollView.d.ts +9 -0
- package/lib/react-qw/components/Slider.d.ts +12 -0
- package/lib/react-qw/components/Tab.d.ts +14 -0
- package/lib/react-qw/components/Tooltip.d.ts +7 -0
- package/lib/react-qw/components/TreeView.d.ts +18 -0
- package/lib/react-qw/components/index.d.ts +16 -0
- package/lib/react-qw/index.d.ts +24 -0
- package/lib/react-qw/layout.d.ts +29 -0
- package/lib/react-qw/nmhdr.d.ts +1 -0
- package/lib/react-qw/props.d.ts +2 -0
- package/lib/react-qw/reconciler.d.ts +21 -0
- package/lib/stream.d.ts +20 -0
- package/lib/text-codec.d.ts +39 -0
- package/lib/text-measure.d.ts +14 -0
- package/lib/url.d.ts +54 -0
- package/lib/websocket.d.ts +73 -0
- package/lib/windows/{advapi32.ts → advapi32.d.ts} +6 -21
- package/lib/windows/comctl32.d.ts +14 -0
- package/lib/windows/comdlg32.d.ts +4 -0
- package/lib/windows/{gdi32.ts → gdi32.d.ts} +161 -98
- package/lib/windows/{kernel32.ts → kernel32.d.ts} +138 -115
- package/lib/windows/{msimg32.ts → msimg32.d.ts} +11 -14
- package/lib/windows/ntdll.d.ts +5 -0
- package/lib/windows/ole32.d.ts +3 -0
- package/lib/windows/{psapi.ts → psapi.d.ts} +9 -18
- package/lib/windows/{shell32.ts → shell32.d.ts} +25 -24
- package/lib/windows/structs.d.ts +3141 -0
- package/lib/windows/{user32.ts → user32.d.ts} +196 -193
- package/lib/windows/version.d.ts +27 -0
- package/lib/windows/{winspool.ts → winspool.d.ts} +18 -32
- package/package.json +15 -6
- 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/lib/abort.ts +0 -69
- package/lib/assert.ts +0 -7
- package/lib/bitmap.ts +0 -39
- package/lib/cache-utils.ts +0 -40
- package/lib/certs.ts +0 -258
- package/lib/dpi.ts +0 -31
- package/lib/dumpRects.ts +0 -34
- package/lib/exec-log.ts +0 -30
- package/lib/fetch.ts +0 -589
- package/lib/ffi/bind.ts +0 -540
- package/lib/ffi/ctype.ts +0 -371
- package/lib/ffi/index.ts +0 -6
- package/lib/ffi/struct.ts +0 -780
- package/lib/http-common.ts +0 -441
- package/lib/http-server.ts +0 -604
- package/lib/polyfill.ts +0 -171
- package/lib/react-qw/components/index.ts +0 -17
- package/lib/react-qw/index.ts +0 -96
- package/lib/react-qw/layout.ts +0 -111
- package/lib/react-qw/nmhdr.ts +0 -7
- package/lib/react-qw/props.ts +0 -41
- package/lib/react-qw/reconciler.ts +0 -379
- package/lib/stream.ts +0 -22
- package/lib/text-codec.ts +0 -171
- package/lib/text-measure.ts +0 -44
- package/lib/url.ts +0 -201
- package/lib/websocket.ts +0 -600
- package/lib/windows/comctl32.ts +0 -20
- package/lib/windows/comdlg32.ts +0 -10
- package/lib/windows/ntdll.ts +0 -11
- package/lib/windows/ole32.ts +0 -9
- package/lib/windows/structs.ts +0 -807
- package/lib/windows/version.ts +0 -35
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import './polyfill.js';
|
|
2
|
+
import * as sock from 'sock';
|
|
3
|
+
import { RequestImpl } from './http-common.js';
|
|
4
|
+
import { AbortController } from './abort.js';
|
|
5
|
+
type SockHandle = import('sock').SockHandle;
|
|
6
|
+
export type ServerHandler = (req: Request) => Promise<Response>;
|
|
7
|
+
interface ParsedHeader {
|
|
8
|
+
method: string;
|
|
9
|
+
target: string;
|
|
10
|
+
version: string;
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
chunked: boolean;
|
|
13
|
+
contentLength: number;
|
|
14
|
+
}
|
|
15
|
+
interface PendingReq {
|
|
16
|
+
parsed: ParsedHeader;
|
|
17
|
+
bodyStart: number;
|
|
18
|
+
}
|
|
19
|
+
interface ActiveReq {
|
|
20
|
+
req: RequestImpl;
|
|
21
|
+
}
|
|
22
|
+
interface Conn {
|
|
23
|
+
sock: SockHandle;
|
|
24
|
+
parts: Uint8Array[];
|
|
25
|
+
/** Cached total length of `parts` — lets the pending-body wait check
|
|
26
|
+
* "have we received enough yet" in O(1) instead of re-concatenating
|
|
27
|
+
* every received byte on each read event (O(n²) for large bodies). */
|
|
28
|
+
partsLen: number;
|
|
29
|
+
pending: PendingReq | null;
|
|
30
|
+
current: ActiveReq | null;
|
|
31
|
+
outQueue: Uint8Array | null;
|
|
32
|
+
resumeRead: (() => void) | null;
|
|
33
|
+
closed: boolean;
|
|
34
|
+
closeAfterFlush: boolean;
|
|
35
|
+
keepAlive: boolean;
|
|
36
|
+
owner: HttpServer;
|
|
37
|
+
/** AbortController for the request currently served on this connection,
|
|
38
|
+
* aborted when the client disconnects mid-response. */
|
|
39
|
+
ac: AbortController | null;
|
|
40
|
+
}
|
|
41
|
+
export declare class HttpServer {
|
|
42
|
+
readonly handler: ServerHandler;
|
|
43
|
+
private serverSock;
|
|
44
|
+
readonly conns: Map<sock.SockHandle, Conn>;
|
|
45
|
+
private closed;
|
|
46
|
+
constructor(handler: ServerHandler);
|
|
47
|
+
/** Actual bound address, or null if not listening. */
|
|
48
|
+
address(): {
|
|
49
|
+
addr: string;
|
|
50
|
+
port: number;
|
|
51
|
+
} | null;
|
|
52
|
+
/** Bind and start listening. Returns 0 on success, -1 on failure. */
|
|
53
|
+
listen(port: number, host?: string, backlog?: number): number;
|
|
54
|
+
close(): void;
|
|
55
|
+
private acceptLoop;
|
|
56
|
+
private onConnEvent;
|
|
57
|
+
}
|
|
58
|
+
export declare function createServer(handler: ServerHandler): HttpServer;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import './url.js';
|
|
3
|
+
import './text-codec.js';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Console {
|
|
6
|
+
error: (...args: unknown[]) => void;
|
|
7
|
+
}
|
|
8
|
+
var window: typeof globalThis;
|
|
9
|
+
type TimerId = os.TimerId;
|
|
10
|
+
function setTimeout<P extends unknown[]>(fn: (...argsf: P) => void, ms?: number, ...argsr: P): TimerId;
|
|
11
|
+
function clearTimeout(id: TimerId): void;
|
|
12
|
+
function btoa(data: string): string;
|
|
13
|
+
function atob(data: string): string;
|
|
14
|
+
interface SubtleCrypto {
|
|
15
|
+
digest(algorithm: 'SHA-1', data: ArrayBuffer | Uint8Array): Promise<ArrayBuffer>;
|
|
16
|
+
}
|
|
17
|
+
interface Crypto {
|
|
18
|
+
getRandomValues<T extends ArrayBufferView>(array: T): T;
|
|
19
|
+
subtle: SubtleCrypto;
|
|
20
|
+
}
|
|
21
|
+
var crypto: Crypto;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
children?: string | number | (string | number)[];
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
style?: WStyle;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface CheckBoxProps {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
defaultChecked?: boolean;
|
|
6
|
+
onChange?: (checked: boolean) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
style?: WStyle;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CheckBox: import("react").ForwardRefExoticComponent<CheckBoxProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface ComboBoxProps {
|
|
4
|
+
items: string[];
|
|
5
|
+
selectedIndex?: number;
|
|
6
|
+
defaultSelectedIndex?: number;
|
|
7
|
+
onChange?: (index: number) => void;
|
|
8
|
+
style?: WStyle;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const ComboBox: import("react").ForwardRefExoticComponent<ComboBoxProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface DateTimePickerProps {
|
|
4
|
+
value?: Date | null;
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
defaultValue?: Date;
|
|
7
|
+
format?: 'short' | 'long' | 'time';
|
|
8
|
+
allowNone?: boolean;
|
|
9
|
+
updown?: boolean;
|
|
10
|
+
style?: WStyle;
|
|
11
|
+
}
|
|
12
|
+
declare const DateTimePicker: (props: DateTimePickerProps & {
|
|
13
|
+
ref?: React.Ref<gui.HWND>;
|
|
14
|
+
}) => React.ReactElement;
|
|
15
|
+
export { DateTimePicker };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface InputProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
password?: boolean;
|
|
9
|
+
multiline?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
number?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
style?: WStyle;
|
|
14
|
+
}
|
|
15
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface LinkProps {
|
|
4
|
+
href?: string;
|
|
5
|
+
children?: string;
|
|
6
|
+
onClick?: (url: string) => void;
|
|
7
|
+
style?: WStyle;
|
|
8
|
+
}
|
|
9
|
+
declare const Link: (props: LinkProps & {
|
|
10
|
+
ref?: React.Ref<gui.HWND>;
|
|
11
|
+
}) => React.ReactElement;
|
|
12
|
+
export { Link };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface ListBoxProps {
|
|
4
|
+
items: string[];
|
|
5
|
+
selectedIndex?: number;
|
|
6
|
+
defaultSelectedIndex?: number;
|
|
7
|
+
onChange?: (index: number) => void;
|
|
8
|
+
style?: WStyle;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
sort?: boolean;
|
|
11
|
+
scrollToBottom?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const ListBox: import("react").ForwardRefExoticComponent<ListBoxProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
import { StandardCursor } from '../../../constants';
|
|
4
|
+
export declare function makeColorBlock(size: number, bgra: number): ArrayBuffer;
|
|
5
|
+
export type Align = 'left' | 'center' | 'right';
|
|
6
|
+
export interface CellStyle {
|
|
7
|
+
color?: number;
|
|
8
|
+
background?: number;
|
|
9
|
+
bold?: boolean;
|
|
10
|
+
underline?: boolean;
|
|
11
|
+
italic?: boolean;
|
|
12
|
+
cursor?: StandardCursor;
|
|
13
|
+
}
|
|
14
|
+
export interface Column<D> {
|
|
15
|
+
name: string;
|
|
16
|
+
dataIndex?: keyof D;
|
|
17
|
+
width?: number;
|
|
18
|
+
align?: Align;
|
|
19
|
+
render?: (record: D, index: number) => string;
|
|
20
|
+
cellStyle?: CellStyle | ((record: D, index: number) => CellStyle);
|
|
21
|
+
onCellClick?: (record: D, index: number) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface ListViewProps<D extends object> {
|
|
24
|
+
columns: Column<D>[];
|
|
25
|
+
data: D[];
|
|
26
|
+
style?: WStyle;
|
|
27
|
+
/** 图标像素数据数组,每个元素为 iconSize*iconSize*4 的 BGRA 像素 ArrayBuffer(色块/程序生成) */
|
|
28
|
+
icons?: ArrayBuffer[];
|
|
29
|
+
/** 图标尺寸,默认 32 */
|
|
30
|
+
iconSize?: number;
|
|
31
|
+
/** 返回记录使用的图标在 icons 中的下标 */
|
|
32
|
+
getIcon?: (record: D, index: number) => number;
|
|
33
|
+
}
|
|
34
|
+
declare const ListView: <D extends object>(props: ListViewProps<D> & {
|
|
35
|
+
ref?: React.Ref<gui.HWND>;
|
|
36
|
+
}) => React.ReactElement;
|
|
37
|
+
export { ListView };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
interface PathPickerBase {
|
|
4
|
+
type?: 'file' | 'folder';
|
|
5
|
+
filter?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
style?: WStyle;
|
|
10
|
+
}
|
|
11
|
+
export type PathPickerProps = PathPickerBase & ({
|
|
12
|
+
multiple: true;
|
|
13
|
+
value?: string[];
|
|
14
|
+
defaultValue?: string[];
|
|
15
|
+
onChange?: (v: string[]) => void;
|
|
16
|
+
} | {
|
|
17
|
+
multiple?: false;
|
|
18
|
+
value?: string;
|
|
19
|
+
defaultValue?: string;
|
|
20
|
+
onChange?: (v: string) => void;
|
|
21
|
+
});
|
|
22
|
+
export declare const PathPicker: import("react").ForwardRefExoticComponent<PathPickerProps & import("react").RefAttributes<gui.HWND>>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface ProgressBarProps {
|
|
4
|
+
value?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
style?: WStyle;
|
|
7
|
+
smooth?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ProgressBar: import("react").ForwardRefExoticComponent<ProgressBarProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface RadioButtonProps {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
defaultChecked?: boolean;
|
|
6
|
+
onChange?: (checked: boolean) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
style?: WStyle;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RadioButton: import("react").ForwardRefExoticComponent<RadioButtonProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface ScrollViewProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
style?: WStyle;
|
|
6
|
+
contentWidth?: number;
|
|
7
|
+
contentHeight?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const ScrollView: import("react").ForwardRefExoticComponent<ScrollViewProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface SliderProps {
|
|
4
|
+
value: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
vertical?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
style?: WStyle;
|
|
11
|
+
}
|
|
12
|
+
export declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import * as gui from 'gui';
|
|
3
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
4
|
+
export interface TabProps {
|
|
5
|
+
tabs: {
|
|
6
|
+
title: string;
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
}[];
|
|
9
|
+
selectedIndex?: number;
|
|
10
|
+
defaultSelectedIndex?: number;
|
|
11
|
+
onChange?: (index: number) => void;
|
|
12
|
+
style?: WStyle;
|
|
13
|
+
}
|
|
14
|
+
export declare const Tab: import("react").ForwardRefExoticComponent<TabProps & import("react").RefAttributes<gui.HWND>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface TooltipProps {
|
|
2
|
+
text: string;
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
balloon?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function Tooltip({ text, children, balloon }: TooltipProps): import("react").ReactElement<Record<string, unknown>, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
export { Tooltip };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import type { WStyle } from '../jsx.d.ts';
|
|
3
|
+
export interface TreeNode<D = unknown> {
|
|
4
|
+
key?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
children?: TreeNode<D>[];
|
|
7
|
+
}
|
|
8
|
+
export interface TreeViewProps<D> {
|
|
9
|
+
data: TreeNode<D>[];
|
|
10
|
+
onSelect?: (node: TreeNode<D> | null) => void;
|
|
11
|
+
defaultSelectedKey?: string;
|
|
12
|
+
selectedKey?: string;
|
|
13
|
+
style?: WStyle;
|
|
14
|
+
}
|
|
15
|
+
declare const TreeView: <D = unknown>(props: TreeViewProps<D> & {
|
|
16
|
+
ref?: React.Ref<gui.HWND>;
|
|
17
|
+
}) => React.ReactElement;
|
|
18
|
+
export { TreeView };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { Button, type ButtonProps } from './Button.js';
|
|
2
|
+
export { CheckBox, type CheckBoxProps } from './CheckBox.js';
|
|
3
|
+
export { ComboBox, type ComboBoxProps } from './ComboBox.js';
|
|
4
|
+
export { DateTimePicker, type DateTimePickerProps } from './DateTimePicker.js';
|
|
5
|
+
export { Input, type InputProps } from './Input.js';
|
|
6
|
+
export { Link, type LinkProps } from './Link.js';
|
|
7
|
+
export { ListBox, type ListBoxProps } from './ListBox.js';
|
|
8
|
+
export { ListView, makeColorBlock, type ListViewProps, type Column, type CellStyle, type Align } from './ListView.js';
|
|
9
|
+
export { ProgressBar, type ProgressBarProps } from './ProgressBar.js';
|
|
10
|
+
export { RadioButton, type RadioButtonProps } from './RadioButton.js';
|
|
11
|
+
export { ScrollView, type ScrollViewProps } from './ScrollView.js';
|
|
12
|
+
export { Slider, type SliderProps } from './Slider.js';
|
|
13
|
+
export { Tab, type TabProps } from './Tab.js';
|
|
14
|
+
export { Tooltip, type TooltipProps } from './Tooltip.js';
|
|
15
|
+
export { TreeView, type TreeViewProps, type TreeNode } from './TreeView.js';
|
|
16
|
+
export { PathPicker, type PathPickerProps } from './PathPicker.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as gui from 'gui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface RootWindowConfig {
|
|
4
|
+
text?: string;
|
|
5
|
+
ws?: number;
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
noShowWindow?: boolean;
|
|
11
|
+
onEvent?: (e: {
|
|
12
|
+
hwnd: gui.HWND;
|
|
13
|
+
msg: number;
|
|
14
|
+
wParam: number;
|
|
15
|
+
lParam: number;
|
|
16
|
+
}) => number | void;
|
|
17
|
+
}
|
|
18
|
+
export declare function createRoot(container: gui.HWND | RootWindowConfig): {
|
|
19
|
+
hwnd: gui.HWND;
|
|
20
|
+
render(element: React.ReactNode): void;
|
|
21
|
+
unmount(): void;
|
|
22
|
+
};
|
|
23
|
+
export * from './components/index.js';
|
|
24
|
+
export declare function render(element: React.ReactNode, containerOrConfig?: gui.HWND | RootWindowConfig | null, _callback?: () => void): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type JustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
2
|
+
export interface FlexStyle {
|
|
3
|
+
flexDirection?: 'row' | 'column';
|
|
4
|
+
justifyContent?: JustifyContent;
|
|
5
|
+
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch';
|
|
6
|
+
gap?: number;
|
|
7
|
+
padding?: number;
|
|
8
|
+
paddingTop?: number;
|
|
9
|
+
paddingRight?: number;
|
|
10
|
+
paddingBottom?: number;
|
|
11
|
+
paddingLeft?: number;
|
|
12
|
+
}
|
|
13
|
+
interface ChildStyle {
|
|
14
|
+
width?: number | 'auto';
|
|
15
|
+
height?: number | 'auto';
|
|
16
|
+
flexGrow?: number;
|
|
17
|
+
alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch';
|
|
18
|
+
}
|
|
19
|
+
interface ChildInfo {
|
|
20
|
+
style: ChildStyle;
|
|
21
|
+
}
|
|
22
|
+
export interface LayoutResult {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function calculateFlexLayout(flex: FlexStyle, parentW: number, parentH: number, children: ChildInfo[]): LayoutResult[];
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nmCode(lParam: number): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import ReactReconciler from 'react-reconciler';
|
|
2
|
+
import * as gui from 'gui';
|
|
3
|
+
import type { WIntrinsicProps } from './jsx.js';
|
|
4
|
+
export declare const scaleFactor: number;
|
|
5
|
+
export type Props = WIntrinsicProps;
|
|
6
|
+
export interface Instance {
|
|
7
|
+
hwnd: gui.HWND | null;
|
|
8
|
+
type: string;
|
|
9
|
+
props: Props;
|
|
10
|
+
children: Instance[];
|
|
11
|
+
lastRect?: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const instancesByHwnd: Map<gui.HWND, Instance>;
|
|
19
|
+
export declare function forceFlexLayout(hwnd: gui.HWND): void;
|
|
20
|
+
declare const reconciler: ReactReconciler.Reconciler<gui.HWND, Instance, Instance, never, never, gui.HWND>;
|
|
21
|
+
export default reconciler;
|
package/lib/stream.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
import { ReadableStream as ReadableStreamImpl, ReadableStreamDefaultController as ReadableStreamDefaultControllerImpl, ReadableStreamDefaultReader as ReadableStreamDefaultReaderImpl } from './vendor/web-streams/ponyfill.mjs';
|
|
3
|
+
declare global {
|
|
4
|
+
type ReadableStreamReadResult<R = any> = {
|
|
5
|
+
done: false;
|
|
6
|
+
value: R;
|
|
7
|
+
} | {
|
|
8
|
+
done: true;
|
|
9
|
+
value?: undefined;
|
|
10
|
+
};
|
|
11
|
+
interface ReadableStreamReader<R = any> extends ReadableStreamDefaultReaderImpl<R> {
|
|
12
|
+
}
|
|
13
|
+
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamDefaultReaderImpl<R> {
|
|
14
|
+
}
|
|
15
|
+
interface ReadableStream<R = any> extends ReadableStreamImpl<R> {
|
|
16
|
+
}
|
|
17
|
+
interface ReadableStreamDefaultController<R = any> extends ReadableStreamDefaultControllerImpl<R> {
|
|
18
|
+
}
|
|
19
|
+
var ReadableStream: typeof ReadableStreamImpl;
|
|
20
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface TextDecoder<T extends _Label | undefined = _Label | undefined> extends TextDecoderImpl<T> {
|
|
4
|
+
}
|
|
5
|
+
var TextDecoder: typeof TextDecoderImpl;
|
|
6
|
+
interface TextEncoder<T extends _Label | undefined = _Label | undefined> extends TextEncoderImpl<T> {
|
|
7
|
+
}
|
|
8
|
+
var TextEncoder: typeof TextEncoderImpl;
|
|
9
|
+
}
|
|
10
|
+
declare const _labelMap: {
|
|
11
|
+
readonly 'utf-8': 'utf-8';
|
|
12
|
+
readonly utf8: 'utf-8';
|
|
13
|
+
readonly 'unicode-1-1-utf-8': 'utf-8';
|
|
14
|
+
readonly 'utf-16': 'utf-16le';
|
|
15
|
+
readonly 'utf-16le': 'utf-16le';
|
|
16
|
+
readonly 'utf-16be': 'utf-16be';
|
|
17
|
+
};
|
|
18
|
+
type _Label = keyof typeof _labelMap;
|
|
19
|
+
type _Encoding = typeof _labelMap[_Label];
|
|
20
|
+
type _Result<T> = T extends _Label ? typeof _labelMap[T] : 'utf-8';
|
|
21
|
+
declare class TextDecoderImpl<T extends _Label | undefined = _Label | undefined> {
|
|
22
|
+
_encoding: _Encoding;
|
|
23
|
+
_fatal: boolean;
|
|
24
|
+
_ignoreBOM: boolean;
|
|
25
|
+
constructor(label?: T, options?: {
|
|
26
|
+
fatal?: boolean;
|
|
27
|
+
ignoreBOM?: boolean;
|
|
28
|
+
});
|
|
29
|
+
get encoding(): _Result<T>;
|
|
30
|
+
get fatal(): boolean;
|
|
31
|
+
get ignoreBOM(): boolean;
|
|
32
|
+
decode(buffer?: ArrayBufferView | ArrayBuffer | null): string;
|
|
33
|
+
}
|
|
34
|
+
declare class TextEncoderImpl<T extends _Label | undefined = _Label | undefined> {
|
|
35
|
+
_encoding: _Encoding;
|
|
36
|
+
constructor(label?: T);
|
|
37
|
+
get encoding(): _Result<T>;
|
|
38
|
+
encode(input?: string): Uint8Array<ArrayBuffer>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Ptr } from './ffi/ctype.js';
|
|
2
|
+
import * as gui from 'gui';
|
|
3
|
+
export declare function measureText(hdc: Ptr<'HDC'>, text: string, maxWidth: number): {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function getButtonIdealSize(hwnd: gui.HWND): {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function measureTextForHwnd(hwnd: gui.HWND, text: string): {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
package/lib/url.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
declare global {
|
|
3
|
+
interface URLSearchParams extends URLSearchParamsImpl {
|
|
4
|
+
}
|
|
5
|
+
var URLSearchParams: typeof URLSearchParamsImpl;
|
|
6
|
+
interface URL extends URLImpl {
|
|
7
|
+
}
|
|
8
|
+
var URL: typeof URLImpl;
|
|
9
|
+
}
|
|
10
|
+
declare class URLSearchParamsImpl {
|
|
11
|
+
private _list;
|
|
12
|
+
constructor(init?: string | [string, string][] | Record<string, string>);
|
|
13
|
+
append(key: string, value: string): void;
|
|
14
|
+
delete(key: string): void;
|
|
15
|
+
get(key: string): string | null;
|
|
16
|
+
getAll(key: string): string[];
|
|
17
|
+
has(key: string): boolean;
|
|
18
|
+
set(key: string, value: string): void;
|
|
19
|
+
sort(): void;
|
|
20
|
+
forEach(fn: (v: string, k: string) => void): void;
|
|
21
|
+
keys(): IterableIterator<string>;
|
|
22
|
+
values(): IterableIterator<string>;
|
|
23
|
+
entries(): IterableIterator<[string, string]>;
|
|
24
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
25
|
+
toString(): string;
|
|
26
|
+
get size(): number;
|
|
27
|
+
}
|
|
28
|
+
declare class URLImpl {
|
|
29
|
+
private _scheme;
|
|
30
|
+
private _username;
|
|
31
|
+
private _password;
|
|
32
|
+
private _hostname;
|
|
33
|
+
private _port;
|
|
34
|
+
private _pathname;
|
|
35
|
+
private _query;
|
|
36
|
+
private _fragment;
|
|
37
|
+
private _searchParams;
|
|
38
|
+
constructor(url: string, base?: string);
|
|
39
|
+
private _apply;
|
|
40
|
+
get href(): string;
|
|
41
|
+
get protocol(): string;
|
|
42
|
+
get hostname(): string;
|
|
43
|
+
get port(): string;
|
|
44
|
+
get pathname(): string;
|
|
45
|
+
get search(): string;
|
|
46
|
+
get hash(): string;
|
|
47
|
+
get host(): string;
|
|
48
|
+
get origin(): string;
|
|
49
|
+
get username(): string;
|
|
50
|
+
get password(): string;
|
|
51
|
+
get searchParams(): URLSearchParams;
|
|
52
|
+
toString(): string;
|
|
53
|
+
toJSON(): string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import '../lib/polyfill.js';
|
|
2
|
+
declare enum State {
|
|
3
|
+
CONNECTING = 0,
|
|
4
|
+
OPEN = 1,
|
|
5
|
+
CLOSING = 2,
|
|
6
|
+
CLOSED = 3
|
|
7
|
+
}
|
|
8
|
+
interface WebSocketOptions {
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
/** Non-standard: when false, TLS certificate verification is skipped
|
|
11
|
+
* (mirrors Node's tls.connect rejectUnauthorized option). */
|
|
12
|
+
rejectUnauthorized?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare class WebSocketImpl {
|
|
15
|
+
readonly url: string;
|
|
16
|
+
readyState: State;
|
|
17
|
+
onopen: ((event: Event) => void) | null;
|
|
18
|
+
onclose: ((event: CloseEvent) => void) | null;
|
|
19
|
+
onerror: ((event: Event) => void) | null;
|
|
20
|
+
onmessage: ((event: MessageEvent) => void) | null;
|
|
21
|
+
private _options;
|
|
22
|
+
private _sock;
|
|
23
|
+
private _ssl;
|
|
24
|
+
private _ctx;
|
|
25
|
+
private _readBuffer;
|
|
26
|
+
private _state;
|
|
27
|
+
private _processingHandshake;
|
|
28
|
+
static readonly CONNECTING = State.CONNECTING;
|
|
29
|
+
static readonly OPEN = State.OPEN;
|
|
30
|
+
static readonly CLOSING = State.CLOSING;
|
|
31
|
+
static readonly CLOSED = State.CLOSED;
|
|
32
|
+
private _closeCode;
|
|
33
|
+
private _closeReason;
|
|
34
|
+
constructor(url: string, options?: WebSocketOptions);
|
|
35
|
+
send(data: string | ArrayBuffer | Uint8Array): void;
|
|
36
|
+
close(code?: number, reason?: string): void;
|
|
37
|
+
private _connect;
|
|
38
|
+
private _sendRaw;
|
|
39
|
+
private _sendRawStr;
|
|
40
|
+
private _onData;
|
|
41
|
+
private _setState;
|
|
42
|
+
private _dispatchEvent;
|
|
43
|
+
private _fireError;
|
|
44
|
+
private _cleanup;
|
|
45
|
+
}
|
|
46
|
+
declare class Event {
|
|
47
|
+
readonly type: string;
|
|
48
|
+
constructor(type: string, _init?: unknown);
|
|
49
|
+
}
|
|
50
|
+
declare class MessageEvent {
|
|
51
|
+
readonly type: string;
|
|
52
|
+
readonly data: unknown;
|
|
53
|
+
constructor(type: string, init: {
|
|
54
|
+
data: unknown;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
declare class CloseEvent {
|
|
58
|
+
readonly type: string;
|
|
59
|
+
readonly code: number;
|
|
60
|
+
readonly reason: string;
|
|
61
|
+
readonly wasClean: boolean;
|
|
62
|
+
constructor(type: string, init: {
|
|
63
|
+
code?: number;
|
|
64
|
+
reason?: string;
|
|
65
|
+
wasClean?: boolean;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
declare global {
|
|
69
|
+
interface WebSocket extends WebSocketImpl {
|
|
70
|
+
}
|
|
71
|
+
var WebSocket: typeof WebSocketImpl;
|
|
72
|
+
}
|
|
73
|
+
export {};
|