quickwin 2.3.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -2
- package/README.md +1 -2
- package/constants.ts +15 -0
- package/enum_map.d.ts +3 -0
- package/examples/PdfCanvas.js +1 -1
- package/examples/PdfCanvas.tsx +2 -2
- package/examples/execd/main.js +334 -188
- package/examples/pdf_preview2.js +76 -67
- package/examples/pdf_preview2.ts +84 -64
- package/examples/pdf_viewer.js +4932 -1029
- package/examples/pdf_viewer.tsx +11 -22
- package/examples/test_gallery.js +308 -143
- package/examples/test_gallery.tsx +12 -7
- package/examples/test_react_lazy.js +295 -133
- package/examples/test_react_lazy.tsx +4 -3
- package/examples/test_react_listbox.js +293 -132
- package/examples/test_react_listbox.tsx +3 -2
- package/examples/test_root_window.js +283 -126
- package/examples/test_tab.js +295 -133
- package/examples/test_tab.tsx +4 -3
- package/examples/tray_demo.js +37 -30
- package/examples/tray_demo.tsx +39 -32
- package/lib/bitmap.js +40 -0
- package/lib/bitmap.ts +39 -0
- package/lib/certs.js +31 -3
- package/lib/certs.ts +32 -3
- package/lib/dpi.js +30 -0
- package/lib/dpi.ts +31 -0
- package/lib/dumpRects.js +14 -7
- package/lib/dumpRects.ts +14 -6
- package/lib/ffi/bind.js +5 -4
- package/lib/ffi/bind.ts +9 -8
- package/lib/react-qw/components/DateTimePicker.js +6 -7
- package/lib/react-qw/components/Input.js +5 -1
- package/lib/react-qw/components/ListView.js +8 -6
- package/lib/react-qw/components/ScrollView.js +28 -22
- package/lib/react-qw/index.js +7 -5
- package/lib/react-qw/index.ts +5 -5
- package/lib/react-qw/props.js +3 -3
- package/lib/react-qw/props.ts +3 -3
- package/lib/react-qw/reconciler.js +12 -17
- package/lib/react-qw/reconciler.ts +12 -16
- package/lib/text-measure.js +9 -6
- package/lib/text-measure.ts +9 -6
- package/lib/windows/comctl32.js +3 -2
- package/lib/windows/comctl32.ts +3 -2
- package/lib/windows/gdi32.js +28 -6
- package/lib/windows/gdi32.ts +30 -6
- package/lib/windows/kernel32.js +9 -0
- package/lib/windows/kernel32.ts +9 -0
- package/lib/windows/shell32.js +11 -2
- package/lib/windows/shell32.ts +13 -2
- package/lib/windows/structs.js +51 -0
- package/lib/windows/structs.ts +55 -0
- package/lib/windows/user32.js +6 -5
- package/lib/windows/user32.ts +6 -5
- package/main.js +13 -5
- package/package.json +2 -2
- package/quickwin.d.ts +13 -115
- 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 +3 -4
- package/test/bench_ffi_callraw.ts +3 -4
- package/test/debug/mupdf_debug.js +4 -22
- package/test/debug/wasm_export_debug.js +2 -12
- package/test/debug/wasm_names.js +3 -13
- package/test/example.pdf +0 -0
- package/test/mupdf-cdn.js +40 -0
- package/test/mupdf-cdn.ts +43 -0
- package/test/test_ffi.js +8 -9
- package/test/test_ffi.ts +8 -9
- package/test/test_ffi_abi.js +6 -6
- package/test/test_ffi_abi.ts +8 -8
- package/test/test_ffi_windows.js +82 -11
- package/test/test_ffi_windows.ts +85 -11
- package/test/test_gdi_draw.js +3 -3
- package/test/test_gdi_draw.ts +4 -4
- package/test/test_mupdf_render.js +4 -22
- package/test/test_mupdf_render.ts +4 -23
- package/test/test_mupdf_twice.js +4 -19
- package/test/test_mupdf_twice.ts +4 -20
- package/test/test_mupdf_wasm.js +10 -4
- package/test/test_mupdf_wasm.ts +6 -4
- package/test/test_react_complex.js +316 -140
- package/test/test_react_counter.js +295 -133
- package/test/test_react_flex.js +297 -138
- package/test/test_react_hidden.js +296 -134
- package/test/test_react_listview_link.js +288 -131
- package/test/test_react_notify.js +290 -133
- package/test/test_react_render.js +295 -133
- package/vendor/mupdf-wasm/mupdf-wasm.d.ts +0 -571
- package/vendor/mupdf-wasm/mupdf-wasm.js +0 -2749
- package/vendor/mupdf-wasm/mupdf-wasm.wasm +0 -0
- package/vendor/mupdf-wasm/mupdf.d.ts +0 -939
- package/vendor/mupdf-wasm/mupdf.js +0 -3317
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
import * as std from 'std';
|
|
2
2
|
import '../lib/polyfill.js';
|
|
3
|
-
|
|
4
|
-
const fp = std.open(path, 'rb');
|
|
5
|
-
if (!fp)
|
|
6
|
-
throw new Error('Cannot open: ' + path);
|
|
7
|
-
fp.seek(0, 2);
|
|
8
|
-
const size = fp.tell();
|
|
9
|
-
fp.seek(0, 0);
|
|
10
|
-
const buffer = new ArrayBuffer(size);
|
|
11
|
-
fp.read(buffer, 0, size);
|
|
12
|
-
fp.close();
|
|
13
|
-
return buffer;
|
|
14
|
-
}
|
|
15
|
-
function setupMupdfModule(wasmPath) {
|
|
16
|
-
const wasmBinary = loadWasmBytes(wasmPath);
|
|
17
|
-
globalThis["$libmupdf_wasm_Module"] = {
|
|
18
|
-
wasmBinary,
|
|
19
|
-
locateFile: (p) => p
|
|
20
|
-
};
|
|
21
|
-
}
|
|
3
|
+
import { MUPDF_JS_URL, preloadMupdfWasm } from './mupdf-cdn.js';
|
|
22
4
|
export const suite = {
|
|
23
5
|
name: 'mupdf-render',
|
|
24
6
|
run: async (t) => {
|
|
25
7
|
try {
|
|
26
|
-
|
|
27
|
-
const mupdf = await import(
|
|
28
|
-
const fp = std.open('./example.pdf', 'rb');
|
|
8
|
+
await preloadMupdfWasm();
|
|
9
|
+
const mupdf = await import(MUPDF_JS_URL);
|
|
10
|
+
const fp = std.open('./test/example.pdf', 'rb');
|
|
29
11
|
if (!fp) {
|
|
30
12
|
console.log('SKIP: no example.pdf');
|
|
31
13
|
return;
|
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
import * as std from 'std'
|
|
2
2
|
import { Tester } from './test_helper.js'
|
|
3
3
|
import '../lib/polyfill.js'
|
|
4
|
-
|
|
5
|
-
function loadWasmBytes(path: string): ArrayBuffer {
|
|
6
|
-
const fp = std.open(path, 'rb')
|
|
7
|
-
if (!fp) throw new Error('Cannot open: ' + path)
|
|
8
|
-
fp.seek(0, 2)
|
|
9
|
-
const size = fp.tell()
|
|
10
|
-
fp.seek(0, 0)
|
|
11
|
-
const buffer = new ArrayBuffer(size)
|
|
12
|
-
fp.read(buffer, 0, size)
|
|
13
|
-
fp.close()
|
|
14
|
-
return buffer
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function setupMupdfModule(wasmPath: string) {
|
|
18
|
-
const wasmBinary = loadWasmBytes(wasmPath)
|
|
19
|
-
;(globalThis as any)["$libmupdf_wasm_Module"] = {
|
|
20
|
-
wasmBinary,
|
|
21
|
-
locateFile: (p: string) => p
|
|
22
|
-
}
|
|
23
|
-
}
|
|
4
|
+
import { MUPDF_JS_URL, preloadMupdfWasm } from './mupdf-cdn.js'
|
|
24
5
|
|
|
25
6
|
export const suite = {
|
|
26
7
|
name: 'mupdf-render',
|
|
27
8
|
run: async (t: Tester): Promise<void> => {
|
|
28
9
|
try {
|
|
29
|
-
|
|
10
|
+
await preloadMupdfWasm()
|
|
30
11
|
|
|
31
|
-
const mupdf: typeof import('
|
|
12
|
+
const mupdf: typeof import('@quickwinlabs/mupdf-wasm') = await import(MUPDF_JS_URL)
|
|
32
13
|
|
|
33
|
-
const fp = std.open('./example.pdf', 'rb')
|
|
14
|
+
const fp = std.open('./test/example.pdf', 'rb')
|
|
34
15
|
if (!fp) { console.log('SKIP: no example.pdf'); return }
|
|
35
16
|
fp.seek(0, 2)
|
|
36
17
|
const size = fp.tell()
|
package/test/test_mupdf_twice.js
CHANGED
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import '../lib/polyfill.js';
|
|
2
2
|
import * as std from 'std';
|
|
3
|
-
|
|
4
|
-
const fp = std.open(path, 'rb');
|
|
5
|
-
if (!fp)
|
|
6
|
-
throw new Error('Cannot open: ' + path);
|
|
7
|
-
fp.seek(0, 2);
|
|
8
|
-
const size = fp.tell();
|
|
9
|
-
fp.seek(0, 0);
|
|
10
|
-
const buffer = new ArrayBuffer(size);
|
|
11
|
-
fp.read(buffer, 0, size);
|
|
12
|
-
fp.close();
|
|
13
|
-
return buffer;
|
|
14
|
-
}
|
|
3
|
+
import { MUPDF_JS_URL, preloadMupdfWasm } from './mupdf-cdn.js';
|
|
15
4
|
export const suite = {
|
|
16
5
|
name: 'mupdf-twice',
|
|
17
6
|
run: async (t) => {
|
|
18
7
|
try {
|
|
19
8
|
console.log(' Loading WASM binary...');
|
|
20
|
-
const wasmBinary =
|
|
9
|
+
const wasmBinary = await preloadMupdfWasm();
|
|
21
10
|
console.log(' WASM binary loaded, size:', wasmBinary.byteLength);
|
|
22
|
-
globalThis["$libmupdf_wasm_Module"] = {
|
|
23
|
-
wasmBinary,
|
|
24
|
-
locateFile: (p) => p
|
|
25
|
-
};
|
|
26
11
|
console.log(' Importing mupdf module...');
|
|
27
|
-
const mupdf = await import(
|
|
12
|
+
const mupdf = await import(MUPDF_JS_URL);
|
|
28
13
|
console.log(' mupdf module imported ok');
|
|
29
|
-
const fp = std.open('./example.pdf', 'rb');
|
|
14
|
+
const fp = std.open('./test/example.pdf', 'rb');
|
|
30
15
|
if (!fp) {
|
|
31
16
|
console.log('SKIP: no example.pdf');
|
|
32
17
|
return;
|
package/test/test_mupdf_twice.ts
CHANGED
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
import '../lib/polyfill.js'
|
|
2
2
|
import * as std from 'std'
|
|
3
3
|
import { Tester } from './test_helper.js'
|
|
4
|
-
|
|
5
|
-
function loadWasmBytes(path: string): ArrayBuffer {
|
|
6
|
-
const fp = std.open(path, 'rb')
|
|
7
|
-
if (!fp) throw new Error('Cannot open: ' + path)
|
|
8
|
-
fp.seek(0, 2)
|
|
9
|
-
const size = fp.tell()
|
|
10
|
-
fp.seek(0, 0)
|
|
11
|
-
const buffer = new ArrayBuffer(size)
|
|
12
|
-
fp.read(buffer, 0, size)
|
|
13
|
-
fp.close()
|
|
14
|
-
return buffer
|
|
15
|
-
}
|
|
4
|
+
import { MUPDF_JS_URL, preloadMupdfWasm } from './mupdf-cdn.js'
|
|
16
5
|
|
|
17
6
|
export const suite = {
|
|
18
7
|
name: 'mupdf-twice',
|
|
19
8
|
run: async (t: Tester): Promise<void> => {
|
|
20
9
|
try {
|
|
21
10
|
console.log(' Loading WASM binary...')
|
|
22
|
-
const wasmBinary =
|
|
11
|
+
const wasmBinary = await preloadMupdfWasm()
|
|
23
12
|
console.log(' WASM binary loaded, size:', wasmBinary.byteLength)
|
|
24
13
|
|
|
25
|
-
;(globalThis as any)["$libmupdf_wasm_Module"] = {
|
|
26
|
-
wasmBinary,
|
|
27
|
-
locateFile: (p: string) => p
|
|
28
|
-
}
|
|
29
|
-
|
|
30
14
|
console.log(' Importing mupdf module...')
|
|
31
|
-
const mupdf: typeof import('
|
|
15
|
+
const mupdf: typeof import('@quickwinlabs/mupdf-wasm') = await import(MUPDF_JS_URL)
|
|
32
16
|
console.log(' mupdf module imported ok')
|
|
33
17
|
|
|
34
|
-
const fp = std.open('./example.pdf', 'rb')
|
|
18
|
+
const fp = std.open('./test/example.pdf', 'rb')
|
|
35
19
|
if (!fp) { console.log('SKIP: no example.pdf'); return }
|
|
36
20
|
fp.seek(0, 2)
|
|
37
21
|
const size = fp.tell()
|
package/test/test_mupdf_wasm.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fetchMupdfWasm } from './mupdf-cdn.js';
|
|
2
2
|
export const suite = {
|
|
3
|
-
name: '
|
|
4
|
-
run: (t) => {
|
|
3
|
+
name: 'mupdf-wasm',
|
|
4
|
+
run: async (t) => {
|
|
5
5
|
t.section('validate binary');
|
|
6
|
-
|
|
6
|
+
let buf = null;
|
|
7
|
+
try {
|
|
8
|
+
buf = await fetchMupdfWasm();
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
console.log('mupdf wasm fetch failed: ' + String(e));
|
|
12
|
+
}
|
|
7
13
|
if (!buf) {
|
|
8
14
|
t.fail++;
|
|
9
15
|
return;
|
package/test/test_mupdf_wasm.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Tester
|
|
1
|
+
import { Tester } from './test_helper.js'
|
|
2
|
+
import { fetchMupdfWasm } from './mupdf-cdn.js'
|
|
2
3
|
|
|
3
4
|
export const suite = {
|
|
4
|
-
name: '
|
|
5
|
-
run: (t: Tester) => {
|
|
5
|
+
name: 'mupdf-wasm',
|
|
6
|
+
run: async (t: Tester) => {
|
|
6
7
|
t.section('validate binary')
|
|
7
|
-
|
|
8
|
+
let buf: ArrayBuffer | null = null
|
|
9
|
+
try { buf = await fetchMupdfWasm() } catch (e) { console.log('mupdf wasm fetch failed: ' + String(e)) }
|
|
8
10
|
if (!buf) { t.fail++; return }
|
|
9
11
|
t.check('file size > 0', true, buf.byteLength > 0)
|
|
10
12
|
const header = new Uint8Array(buf)
|