quickwin 1.0.2 → 1.1.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/README.en.md +204 -204
- package/README.md +203 -203
- package/examples/PdfCanvas.tsx +83 -83
- package/examples/exec_server.ts +35 -35
- package/examples/pdf_preview2.ts +375 -375
- package/examples/pdf_viewer.tsx +279 -279
- package/examples/test_gallery.tsx +285 -285
- package/examples/test_react_lazy.tsx +63 -63
- package/examples/test_react_listbox.tsx +71 -71
- package/examples/test_root_window.tsx +41 -41
- package/examples/test_tab.tsx +75 -75
- package/examples/tray_demo.tsx +81 -81
- package/lib/assert.ts +6 -6
- package/lib/cache-utils.ts +40 -40
- package/lib/dumpRects.ts +25 -25
- package/lib/fetch.ts +502 -502
- package/lib/http-common.ts +399 -399
- package/lib/http-server.ts +424 -424
- package/lib/polyfill.ts +171 -171
- package/lib/react-qw/components/index.ts +17 -17
- package/lib/react-qw/index.ts +90 -90
- package/lib/react-qw/jsx.d.ts +34 -34
- package/lib/react-qw/layout.ts +111 -111
- package/lib/react-qw/props.ts +36 -36
- package/lib/react-qw/reconciler.ts +373 -373
- package/lib/stream.ts +21 -21
- package/lib/text-codec.ts +171 -171
- package/lib/text-measure.ts +54 -54
- package/lib/url.ts +201 -201
- package/lib/vendor/web-streams/ponyfill.d.mts +829 -829
- package/lib/vendor/web-streams/ponyfill.mjs +8 -8
- package/lib/websocket.js +8 -0
- package/lib/websocket.ts +563 -555
- package/package.json +50 -44
- 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/run.ts +96 -96
- package/test/test_basic.ts +9 -9
- package/test/test_basic_fetch.ts +33 -33
- package/test/test_brotli.ts +52 -52
- package/test/test_fetch_cache.ts +187 -187
- package/test/test_ffi.ts +174 -174
- package/test/test_frame_encoding.ts +132 -132
- package/test/test_helper.ts +80 -80
- package/test/test_http_import.ts +74 -74
- package/test/test_http_server.ts +136 -136
- package/test/test_import_dir.ts +5 -5
- package/test/test_ipv6.ts +129 -129
- package/test/test_meta_url.ts +4 -4
- package/test/test_mupdf_render.ts +74 -74
- package/test/test_mupdf_twice.ts +81 -81
- package/test/test_mupdf_wasm.ts +30 -30
- package/test/test_net_event.ts +55 -55
- package/test/test_net_fetch.ts +238 -238
- package/test/test_net_websocket.ts +164 -164
- package/test/test_polyfill.ts +159 -159
- package/test/test_url.ts +183 -183
- package/test/test_wasm_basic.ts +73 -73
- package/test/test_wasm_import_global.ts +45 -45
- package/test/test_wasm_sjlj.ts +125 -125
- package/test/test_wasm_types.ts +124 -124
- package/test/test_worker.ts +24 -24
- package/test/test_worker_fetch.ts +27 -27
- package/test/test_worker_net.ts +54 -54
- package/test/test_worker_wasm_concurrent.ts +45 -45
- package/test/worker_fetch.ts +13 -13
- package/test/worker_helper.ts +1 -1
- package/test/worker_http.ts +20 -20
- package/test/worker_import_lib.ts +13 -13
- package/test/worker_module.ts +17 -17
- package/test/worker_wasm_concurrent.ts +22 -22
- package/tsconfig.json +27 -27
- package/vendor/mupdf-wasm/mupdf-wasm.d.ts +571 -571
- package/vendor/mupdf-wasm/mupdf-wasm.js +2749 -2749
- package/vendor/mupdf-wasm/mupdf.d.ts +939 -939
- package/vendor/mupdf-wasm/mupdf.js +3317 -3317
package/lib/assert.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function assertNonNullable<T>(v: T, msg?: string): asserts v is NonNullable<T> {
|
|
2
|
-
if (v === null || v === undefined) throw new Error(msg ?? `Assert failed: unexpected ${v}`)
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function assertArrayBuffer(v: ArrayBufferLike): asserts v is ArrayBuffer {
|
|
6
|
-
if (!(v instanceof ArrayBuffer)) throw new Error('Assert failed: expected ArrayBuffer')
|
|
1
|
+
export function assertNonNullable<T>(v: T, msg?: string): asserts v is NonNullable<T> {
|
|
2
|
+
if (v === null || v === undefined) throw new Error(msg ?? `Assert failed: unexpected ${v}`)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function assertArrayBuffer(v: ArrayBufferLike): asserts v is ArrayBuffer {
|
|
6
|
+
if (!(v instanceof ArrayBuffer)) throw new Error('Assert failed: expected ArrayBuffer')
|
|
7
7
|
}
|
package/lib/cache-utils.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
// ── INI-format cache helpers ──
|
|
2
|
-
|
|
3
|
-
export interface IniCache {
|
|
4
|
-
headers: Record<string, string>
|
|
5
|
-
meta: Record<string, string>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function parseIni(text: string): IniCache {
|
|
9
|
-
const headers: Record<string, string> = {}
|
|
10
|
-
const meta: Record<string, string> = {}
|
|
11
|
-
let section = ''
|
|
12
|
-
for (const line of text.split('\n')) {
|
|
13
|
-
const trimmed = line.trim()
|
|
14
|
-
if (trimmed === '[headers]') { section = 'headers'; continue }
|
|
15
|
-
if (trimmed === '[meta]') { section = 'meta'; continue }
|
|
16
|
-
if (!section || !trimmed) continue
|
|
17
|
-
const colon = trimmed.indexOf(':')
|
|
18
|
-
if (colon < 0) continue
|
|
19
|
-
const key = trimmed.slice(0, colon).trim()
|
|
20
|
-
const val = trimmed.slice(colon + 1).trim()
|
|
21
|
-
if (section === 'headers') headers[key] = val
|
|
22
|
-
else if (section === 'meta') meta[key] = val
|
|
23
|
-
}
|
|
24
|
-
return { headers, meta }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function toIni(headers: Record<string, string>, meta: Record<string, string>): string {
|
|
28
|
-
let s = ''
|
|
29
|
-
if (Object.keys(headers).length > 0) {
|
|
30
|
-
s += '[headers]\n'
|
|
31
|
-
for (const k in headers) {
|
|
32
|
-
s += k + ': ' + headers[k] + '\n'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
s += '[meta]\n'
|
|
36
|
-
for (const k in meta) {
|
|
37
|
-
s += k + ': ' + meta[k] + '\n'
|
|
38
|
-
}
|
|
39
|
-
return s
|
|
40
|
-
}
|
|
1
|
+
// ── INI-format cache helpers ──
|
|
2
|
+
|
|
3
|
+
export interface IniCache {
|
|
4
|
+
headers: Record<string, string>
|
|
5
|
+
meta: Record<string, string>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function parseIni(text: string): IniCache {
|
|
9
|
+
const headers: Record<string, string> = {}
|
|
10
|
+
const meta: Record<string, string> = {}
|
|
11
|
+
let section = ''
|
|
12
|
+
for (const line of text.split('\n')) {
|
|
13
|
+
const trimmed = line.trim()
|
|
14
|
+
if (trimmed === '[headers]') { section = 'headers'; continue }
|
|
15
|
+
if (trimmed === '[meta]') { section = 'meta'; continue }
|
|
16
|
+
if (!section || !trimmed) continue
|
|
17
|
+
const colon = trimmed.indexOf(':')
|
|
18
|
+
if (colon < 0) continue
|
|
19
|
+
const key = trimmed.slice(0, colon).trim()
|
|
20
|
+
const val = trimmed.slice(colon + 1).trim()
|
|
21
|
+
if (section === 'headers') headers[key] = val
|
|
22
|
+
else if (section === 'meta') meta[key] = val
|
|
23
|
+
}
|
|
24
|
+
return { headers, meta }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function toIni(headers: Record<string, string>, meta: Record<string, string>): string {
|
|
28
|
+
let s = ''
|
|
29
|
+
if (Object.keys(headers).length > 0) {
|
|
30
|
+
s += '[headers]\n'
|
|
31
|
+
for (const k in headers) {
|
|
32
|
+
s += k + ': ' + headers[k] + '\n'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
s += '[meta]\n'
|
|
36
|
+
for (const k in meta) {
|
|
37
|
+
s += k + ': ' + meta[k] + '\n'
|
|
38
|
+
}
|
|
39
|
+
return s
|
|
40
|
+
}
|
package/lib/dumpRects.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import * as os from 'os'
|
|
2
|
-
import * as gui from 'gui'
|
|
3
|
-
|
|
4
|
-
export function startDumpRects(rootHwnd: gui.HWND, intervalMs: number = 3000): void {
|
|
5
|
-
function dumpChild(parent: gui.HWND, indent: string): void {
|
|
6
|
-
var ch = gui.GetWindow(parent, gui.GetWindowCmd.CHILD)
|
|
7
|
-
var n = 0
|
|
8
|
-
while (ch) {
|
|
9
|
-
n++
|
|
10
|
-
var wr = gui.GetWindowRect(ch)
|
|
11
|
-
var cr = gui.GetClientRect(ch)
|
|
12
|
-
var txt = String(gui.GetWindowText(ch) || '').slice(0, 16)
|
|
13
|
-
console.log(indent + '[' + n + '] hwnd=' + String(ch) + ' txt="' + txt + '" wr=' + JSON.stringify(wr) + ' cr=' + JSON.stringify(cr))
|
|
14
|
-
dumpChild(ch, indent + ' ')
|
|
15
|
-
ch = gui.GetWindow(ch, gui.GetWindowCmd.NEXT)
|
|
16
|
-
}
|
|
17
|
-
if (n === 0) console.log(indent + '(no children)')
|
|
18
|
-
}
|
|
19
|
-
function tick(): void {
|
|
20
|
-
console.log('--- dump rects ---')
|
|
21
|
-
dumpChild(rootHwnd, '')
|
|
22
|
-
os.setTimeout(tick, intervalMs)
|
|
23
|
-
}
|
|
24
|
-
tick()
|
|
25
|
-
}
|
|
1
|
+
import * as os from 'os'
|
|
2
|
+
import * as gui from 'gui'
|
|
3
|
+
|
|
4
|
+
export function startDumpRects(rootHwnd: gui.HWND, intervalMs: number = 3000): void {
|
|
5
|
+
function dumpChild(parent: gui.HWND, indent: string): void {
|
|
6
|
+
var ch = gui.GetWindow(parent, gui.GetWindowCmd.CHILD)
|
|
7
|
+
var n = 0
|
|
8
|
+
while (ch) {
|
|
9
|
+
n++
|
|
10
|
+
var wr = gui.GetWindowRect(ch)
|
|
11
|
+
var cr = gui.GetClientRect(ch)
|
|
12
|
+
var txt = String(gui.GetWindowText(ch) || '').slice(0, 16)
|
|
13
|
+
console.log(indent + '[' + n + '] hwnd=' + String(ch) + ' txt="' + txt + '" wr=' + JSON.stringify(wr) + ' cr=' + JSON.stringify(cr))
|
|
14
|
+
dumpChild(ch, indent + ' ')
|
|
15
|
+
ch = gui.GetWindow(ch, gui.GetWindowCmd.NEXT)
|
|
16
|
+
}
|
|
17
|
+
if (n === 0) console.log(indent + '(no children)')
|
|
18
|
+
}
|
|
19
|
+
function tick(): void {
|
|
20
|
+
console.log('--- dump rects ---')
|
|
21
|
+
dumpChild(rootHwnd, '')
|
|
22
|
+
os.setTimeout(tick, intervalMs)
|
|
23
|
+
}
|
|
24
|
+
tick()
|
|
25
|
+
}
|