quickwin 3.0.0 → 3.0.2

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.
Files changed (253) hide show
  1. package/README.en.md +3 -0
  2. package/README.md +2 -0
  3. package/lib/abort.d.ts +21 -0
  4. package/lib/assert.d.ts +2 -0
  5. package/lib/bitmap.d.ts +7 -0
  6. package/lib/cache-utils.d.ts +6 -0
  7. package/lib/certs.d.ts +1 -0
  8. package/lib/dpi.d.ts +9 -0
  9. package/lib/dumpRects.d.ts +2 -0
  10. package/lib/exec-log.d.ts +23 -0
  11. package/lib/fetch.d.ts +4 -0
  12. package/lib/ffi/bind.d.ts +70 -0
  13. package/lib/ffi/ctype.d.ts +117 -0
  14. package/lib/ffi/index.d.ts +2 -0
  15. package/lib/ffi/struct.d.ts +174 -0
  16. package/lib/http-common.d.ts +143 -0
  17. package/lib/http-server.d.ts +59 -0
  18. package/lib/polyfill.d.ts +22 -0
  19. package/lib/react-qw/components/Button.d.ts +9 -0
  20. package/lib/react-qw/components/CheckBox.d.ts +11 -0
  21. package/lib/react-qw/components/ComboBox.d.ts +11 -0
  22. package/lib/react-qw/components/DateTimePicker.d.ts +15 -0
  23. package/lib/react-qw/components/Input.d.ts +15 -0
  24. package/lib/react-qw/components/Link.d.ts +12 -0
  25. package/lib/react-qw/components/ListBox.d.ts +13 -0
  26. package/lib/react-qw/components/ListView.d.ts +37 -0
  27. package/lib/react-qw/components/PathPicker.d.ts +23 -0
  28. package/lib/react-qw/components/ProgressBar.d.ts +9 -0
  29. package/lib/react-qw/components/RadioButton.d.ts +11 -0
  30. package/lib/react-qw/components/ScrollView.d.ts +9 -0
  31. package/lib/react-qw/components/Slider.d.ts +12 -0
  32. package/lib/react-qw/components/Tab.d.ts +14 -0
  33. package/lib/react-qw/components/Tooltip.d.ts +7 -0
  34. package/lib/react-qw/components/TreeView.d.ts +18 -0
  35. package/lib/react-qw/components/index.d.ts +16 -0
  36. package/lib/react-qw/index.d.ts +24 -0
  37. package/lib/react-qw/layout.d.ts +29 -0
  38. package/lib/react-qw/nmhdr.d.ts +1 -0
  39. package/lib/react-qw/props.d.ts +2 -0
  40. package/lib/react-qw/reconciler.d.ts +21 -0
  41. package/lib/stream.d.ts +20 -0
  42. package/lib/text-codec.d.ts +39 -0
  43. package/lib/text-measure.d.ts +14 -0
  44. package/lib/url.d.ts +54 -0
  45. package/lib/websocket.d.ts +73 -0
  46. package/lib/windows/{advapi32.ts → advapi32.d.ts} +6 -21
  47. package/lib/windows/comctl32.d.ts +14 -0
  48. package/lib/windows/comdlg32.d.ts +4 -0
  49. package/lib/windows/{gdi32.ts → gdi32.d.ts} +161 -98
  50. package/lib/windows/{kernel32.ts → kernel32.d.ts} +138 -115
  51. package/lib/windows/{msimg32.ts → msimg32.d.ts} +11 -14
  52. package/lib/windows/ntdll.d.ts +5 -0
  53. package/lib/windows/ole32.d.ts +3 -0
  54. package/lib/windows/{psapi.ts → psapi.d.ts} +9 -18
  55. package/lib/windows/{shell32.ts → shell32.d.ts} +25 -24
  56. package/lib/windows/structs.d.ts +3141 -0
  57. package/lib/windows/{user32.ts → user32.d.ts} +196 -193
  58. package/lib/windows/version.d.ts +27 -0
  59. package/lib/windows/{winspool.ts → winspool.d.ts} +18 -32
  60. package/package.json +15 -8
  61. package/qwin-nowasm-x86.exe +0 -0
  62. package/qwin-nowasm.exe +0 -0
  63. package/qwin-x86.exe +0 -0
  64. package/qwin.exe +0 -0
  65. package/examples/PdfCanvas.js +0 -38
  66. package/examples/PdfCanvas.tsx +0 -54
  67. package/examples/execd/main.js +0 -23379
  68. package/examples/execd/tray.js +0 -192
  69. package/examples/execd/worker.js +0 -122
  70. package/examples/pdf_preview2.js +0 -398
  71. package/examples/pdf_preview2.ts +0 -353
  72. package/examples/pdf_viewer.js +0 -22515
  73. package/examples/pdf_viewer.tsx +0 -228
  74. package/examples/test_gallery.js +0 -18692
  75. package/examples/test_gallery.tsx +0 -291
  76. package/examples/test_react_lazy.js +0 -18560
  77. package/examples/test_react_lazy.tsx +0 -65
  78. package/examples/test_react_listbox.js +0 -18562
  79. package/examples/test_react_listbox.tsx +0 -73
  80. package/examples/test_root_window.js +0 -18532
  81. package/examples/test_root_window.tsx +0 -41
  82. package/examples/test_tab.js +0 -18563
  83. package/examples/test_tab.tsx +0 -77
  84. package/examples/tray_demo.js +0 -86
  85. package/examples/tray_demo.tsx +0 -89
  86. package/lib/abort.ts +0 -69
  87. package/lib/assert.ts +0 -7
  88. package/lib/bitmap.ts +0 -39
  89. package/lib/cache-utils.ts +0 -40
  90. package/lib/certs.ts +0 -258
  91. package/lib/dpi.ts +0 -31
  92. package/lib/dumpRects.ts +0 -34
  93. package/lib/exec-log.ts +0 -30
  94. package/lib/fetch.ts +0 -589
  95. package/lib/ffi/bind.ts +0 -540
  96. package/lib/ffi/ctype.ts +0 -371
  97. package/lib/ffi/index.ts +0 -6
  98. package/lib/ffi/struct.ts +0 -780
  99. package/lib/http-common.ts +0 -441
  100. package/lib/http-server.ts +0 -604
  101. package/lib/polyfill.ts +0 -171
  102. package/lib/react-qw/components/index.ts +0 -17
  103. package/lib/react-qw/index.ts +0 -96
  104. package/lib/react-qw/layout.ts +0 -111
  105. package/lib/react-qw/nmhdr.ts +0 -7
  106. package/lib/react-qw/props.ts +0 -41
  107. package/lib/react-qw/reconciler.ts +0 -379
  108. package/lib/stream.ts +0 -22
  109. package/lib/text-codec.ts +0 -171
  110. package/lib/text-measure.ts +0 -44
  111. package/lib/url.ts +0 -201
  112. package/lib/websocket.ts +0 -600
  113. package/lib/windows/comctl32.ts +0 -20
  114. package/lib/windows/comdlg32.ts +0 -10
  115. package/lib/windows/ntdll.ts +0 -11
  116. package/lib/windows/ole32.ts +0 -9
  117. package/lib/windows/structs.ts +0 -807
  118. package/lib/windows/version.ts +0 -35
  119. package/test/add.wasm +0 -0
  120. package/test/bench_ffi_callraw.js +0 -235
  121. package/test/bench_ffi_callraw.ts +0 -235
  122. package/test/bench_ffi_overhead.js +0 -139
  123. package/test/bench_ffi_overhead.ts +0 -141
  124. package/test/bench_sendmessage.js +0 -104
  125. package/test/bench_sendmessage.ts +0 -100
  126. package/test/bench_sendmessage_nonnull.js +0 -187
  127. package/test/bench_sendmessage_nonnull.ts +0 -188
  128. package/test/complex.wasm +0 -0
  129. package/test/complex_imports.wasm +0 -0
  130. package/test/debug/http_server_e2e.js +0 -31
  131. package/test/debug/minwasm.js +0 -52
  132. package/test/debug/mupdf_debug.js +0 -86
  133. package/test/debug/wasm.js +0 -122
  134. package/test/debug/wasm_export_debug.js +0 -54
  135. package/test/debug/wasm_names.js +0 -36
  136. package/test/example.pdf +0 -0
  137. package/test/global_imports.wasm +0 -0
  138. package/test/import_func.wasm +0 -0
  139. package/test/imports.wasm +0 -0
  140. package/test/mupdf-cdn.js +0 -40
  141. package/test/mupdf-cdn.ts +0 -43
  142. package/test/run.js +0 -111
  143. package/test/run.ts +0 -116
  144. package/test/sjlj.wasm +0 -0
  145. package/test/test_basic.js +0 -7
  146. package/test/test_basic.ts +0 -9
  147. package/test/test_basic_fetch.js +0 -63
  148. package/test/test_basic_fetch.ts +0 -59
  149. package/test/test_brotli.js +0 -48
  150. package/test/test_brotli.ts +0 -52
  151. package/test/test_fetch_cache.js +0 -169
  152. package/test/test_fetch_cache.ts +0 -187
  153. package/test/test_ffi.js +0 -157
  154. package/test/test_ffi.ts +0 -170
  155. package/test/test_ffi_abi.js +0 -290
  156. package/test/test_ffi_abi.ts +0 -274
  157. package/test/test_ffi_array.js +0 -116
  158. package/test/test_ffi_array.ts +0 -141
  159. package/test/test_ffi_bind.js +0 -656
  160. package/test/test_ffi_bind.ts +0 -670
  161. package/test/test_ffi_struct.js +0 -779
  162. package/test/test_ffi_struct.ts +0 -828
  163. package/test/test_ffi_struct_layout.js +0 -495
  164. package/test/test_ffi_struct_layout.ts +0 -543
  165. package/test/test_ffi_user32.js +0 -103
  166. package/test/test_ffi_user32.ts +0 -113
  167. package/test/test_ffi_windows.js +0 -172
  168. package/test/test_ffi_windows.ts +0 -187
  169. package/test/test_files.js +0 -102
  170. package/test/test_files.ts +0 -121
  171. package/test/test_frame_encoding.js +0 -128
  172. package/test/test_frame_encoding.ts +0 -132
  173. package/test/test_gdi_draw.js +0 -681
  174. package/test/test_gdi_draw.ts +0 -725
  175. package/test/test_helper.js +0 -91
  176. package/test/test_helper.ts +0 -88
  177. package/test/test_http_import.js +0 -96
  178. package/test/test_http_import.ts +0 -93
  179. package/test/test_http_server.js +0 -214
  180. package/test/test_http_server.ts +0 -211
  181. package/test/test_import_dir.js +0 -4
  182. package/test/test_import_dir.ts +0 -5
  183. package/test/test_ipv6.js +0 -134
  184. package/test/test_ipv6.ts +0 -130
  185. package/test/test_jsx.js +0 -1314
  186. package/test/test_meta_url.js +0 -3
  187. package/test/test_meta_url.ts +0 -4
  188. package/test/test_mupdf_render.js +0 -51
  189. package/test/test_mupdf_render.ts +0 -55
  190. package/test/test_mupdf_twice.js +0 -62
  191. package/test/test_mupdf_twice.ts +0 -65
  192. package/test/test_mupdf_wasm.js +0 -39
  193. package/test/test_mupdf_wasm.ts +0 -32
  194. package/test/test_net_event.js +0 -57
  195. package/test/test_net_event.ts +0 -56
  196. package/test/test_net_fetch.js +0 -384
  197. package/test/test_net_fetch.ts +0 -373
  198. package/test/test_net_websocket.js +0 -180
  199. package/test/test_net_websocket.ts +0 -164
  200. package/test/test_polyfill.js +0 -144
  201. package/test/test_polyfill.ts +0 -159
  202. package/test/test_printer.js +0 -137
  203. package/test/test_printer.ts +0 -148
  204. package/test/test_proc.js +0 -141
  205. package/test/test_proc.ts +0 -163
  206. package/test/test_react_complex.js +0 -18678
  207. package/test/test_react_counter.js +0 -18555
  208. package/test/test_react_flex.js +0 -18871
  209. package/test/test_react_hidden.js +0 -18560
  210. package/test/test_react_listview_link.js +0 -18590
  211. package/test/test_react_notify.js +0 -18797
  212. package/test/test_react_render.js +0 -18550
  213. package/test/test_registry.js +0 -74
  214. package/test/test_registry.ts +0 -95
  215. package/test/test_sysinfo.js +0 -122
  216. package/test/test_sysinfo.ts +0 -141
  217. package/test/test_url.js +0 -173
  218. package/test/test_url.ts +0 -183
  219. package/test/test_wasm_basic.js +0 -85
  220. package/test/test_wasm_basic.ts +0 -73
  221. package/test/test_wasm_import_global.js +0 -41
  222. package/test/test_wasm_import_global.ts +0 -45
  223. package/test/test_wasm_sjlj.js +0 -145
  224. package/test/test_wasm_sjlj.ts +0 -125
  225. package/test/test_wasm_types.js +0 -97
  226. package/test/test_wasm_types.ts +0 -124
  227. package/test/test_wolfssl_read.js +0 -203
  228. package/test/test_wolfssl_read.ts +0 -184
  229. package/test/test_worker.js +0 -21
  230. package/test/test_worker.ts +0 -24
  231. package/test/test_worker_concurrent.js +0 -45
  232. package/test/test_worker_concurrent.ts +0 -56
  233. package/test/test_worker_data_url.js +0 -46
  234. package/test/test_worker_data_url.ts +0 -51
  235. package/test/test_worker_fetch.js +0 -26
  236. package/test/test_worker_fetch.ts +0 -27
  237. package/test/test_worker_net.js +0 -69
  238. package/test/test_worker_net.ts +0 -66
  239. package/test/test_worker_wasm_concurrent.js +0 -44
  240. package/test/test_worker_wasm_concurrent.ts +0 -45
  241. package/test/types.wasm +0 -0
  242. package/test/worker_fetch.js +0 -13
  243. package/test/worker_fetch.ts +0 -13
  244. package/test/worker_helper.js +0 -1
  245. package/test/worker_helper.ts +0 -1
  246. package/test/worker_http.js +0 -18
  247. package/test/worker_http.ts +0 -20
  248. package/test/worker_import_lib.js +0 -12
  249. package/test/worker_import_lib.ts +0 -13
  250. package/test/worker_module.js +0 -16
  251. package/test/worker_module.ts +0 -17
  252. package/test/worker_wasm_concurrent.js +0 -22
  253. package/test/worker_wasm_concurrent.ts +0 -22
package/lib/url.ts DELETED
@@ -1,201 +0,0 @@
1
- export {} // make this a module so declare global works
2
-
3
- declare global {
4
- interface URLSearchParams extends URLSearchParamsImpl {}
5
- var URLSearchParams: typeof URLSearchParamsImpl
6
- interface URL extends URLImpl {}
7
- var URL: typeof URLImpl
8
- }
9
-
10
- function _encode(s: string): string { return encodeURIComponent(s) }
11
- function _decode(s: string): string {
12
- try { return decodeURIComponent(s.replace(/\+/g, ' ')) }
13
- catch { return s }
14
- }
15
-
16
- function _normalizePath(path: string): string {
17
- if (!path) return '/'
18
- const parts = path.split('/')
19
- const out: string[] = []
20
- let hasRoot = path[0] === '/'
21
- if (hasRoot) out.push('')
22
- for (const p of parts) {
23
- if (p === '' || p === '.') continue
24
- if (p === '..') {
25
- const last = out[out.length - 1]
26
- if (last !== undefined && last !== '') out.pop()
27
- } else {
28
- out.push(p)
29
- }
30
- }
31
- if (path.endsWith('/') && out[out.length - 1] !== '') out.push('')
32
- const result = out.join('/')
33
- if (hasRoot && !result.startsWith('/')) return '/' + result
34
- return result || '/'
35
- }
36
-
37
- function _parseURL(url: string): { scheme: string; user: string; pass: string; host: string; port: string; path: string; query: string; fragment: string } {
38
- const r = { scheme: '', user: '', pass: '', host: '', port: '', path: '/', query: '', fragment: '' }
39
- const fi = url.indexOf('#')
40
- if (fi >= 0) { r.fragment = url.slice(fi + 1); url = url.slice(0, fi) }
41
- const qi = url.indexOf('?')
42
- if (qi >= 0) { r.query = url.slice(qi + 1); url = url.slice(0, qi) }
43
- const sm = url.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*):(.*)$/)
44
- if (sm) { r.scheme = sm[1]!.toLowerCase(); url = sm[2]! }
45
- if (url.startsWith('//')) {
46
- url = url.slice(2)
47
- const si = url.indexOf('/')
48
- let auth: string
49
- if (si < 0) { auth = url; url = '' } else { auth = url.slice(0, si); url = url.slice(si) }
50
- const ai = auth.lastIndexOf('@')
51
- if (ai >= 0) {
52
- const ui = auth.slice(0, ai); auth = auth.slice(ai + 1)
53
- const ci = ui.indexOf(':')
54
- if (ci >= 0) { r.user = _decode(ui.slice(0, ci)); r.pass = _decode(ui.slice(ci + 1)) }
55
- else r.user = _decode(ui)
56
- }
57
- if (auth.startsWith('[')) {
58
- const cb = auth.indexOf(']')
59
- r.host = auth.slice(1, cb).toLowerCase()
60
- const pp = auth.slice(cb + 1)
61
- if (pp.startsWith(':')) r.port = pp.slice(1)
62
- } else {
63
- const ci = auth.lastIndexOf(':')
64
- if (ci >= 0 && ci === auth.lastIndexOf(':')) { r.host = auth.slice(0, ci).toLowerCase(); r.port = auth.slice(ci + 1) }
65
- else r.host = auth.toLowerCase()
66
- }
67
- }
68
- r.path = url
69
- if (r.host && !r.path.startsWith('/')) r.path = '/' + r.path
70
- return r
71
- }
72
-
73
- class URLSearchParamsImpl {
74
- private _list: [string, string][] = []
75
-
76
- constructor(init?: string | [string, string][] | Record<string, string>) {
77
- if (typeof init === 'string') {
78
- const s = init.startsWith('?') ? init.slice(1) : init
79
- if (!s) return
80
- for (const p of s.split('&')) {
81
- const eq = p.indexOf('=')
82
- if (eq < 0) { this._list.push([_decode(p), '']); continue }
83
- this._list.push([_decode(p.slice(0, eq)), _decode(p.slice(eq + 1))])
84
- }
85
- } else if (init) {
86
- if (Array.isArray(init)) for (const [k, v] of init) this._list.push([String(k), String(v)])
87
- else for (const k of Object.keys(init)) this._list.push([k, String(init[k])])
88
- }
89
- }
90
-
91
- append(key: string, value: string): void { this._list.push([key, value]) }
92
- delete(key: string): void { this._list = this._list.filter(([k]) => k !== key) }
93
- get(key: string): string | null { for (const [k, v] of this._list) if (k === key) return v; return null }
94
- getAll(key: string): string[] { return this._list.filter(([k]) => k === key).map(([, v]) => v) }
95
- has(key: string): boolean { return this._list.some(([k]) => k === key) }
96
- set(key: string, value: string): void {
97
- let f = false
98
- for (let i = 0; i < this._list.length; i++) {
99
- if (this._list[i]![0] === key) { if (!f) { this._list[i]![1] = value; f = true } else { this._list.splice(i, 1); i-- } }
100
- }
101
- if (!f) this._list.push([key, value])
102
- }
103
- sort(): void { this._list.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0) }
104
- forEach(fn: (v: string, k: string) => void): void { for (const [k, v] of this._list) fn(v, k) }
105
-
106
- *keys(): IterableIterator<string> { for (const [k] of this._list) yield k }
107
- *values(): IterableIterator<string> { for (const [, v] of this._list) yield v }
108
- *entries(): IterableIterator<[string, string]> { for (const item of this._list) yield [item[0], item[1]] }
109
- *[Symbol.iterator](): IterableIterator<[string, string]> { for (const item of this._list) yield item }
110
-
111
- toString(): string { return this._list.map(([k, v]) => _encode(k) + '=' + _encode(v)).join('&') }
112
- get size(): number { return this._list.length }
113
- }
114
-
115
- if (typeof globalThis.URLSearchParams === 'undefined') {
116
- globalThis.URLSearchParams = URLSearchParamsImpl
117
- }
118
-
119
- class URLImpl {
120
- private _scheme = ''
121
- private _username = ''
122
- private _password = ''
123
- private _hostname = ''
124
- private _port = ''
125
- private _pathname = '/'
126
- private _query = ''
127
- private _fragment = ''
128
- private _searchParams: URLSearchParams = new URLSearchParamsImpl()
129
-
130
- constructor(url: string, base?: string) {
131
- let p = _parseURL(url)
132
- if (p.scheme) { this._apply(p); return }
133
- if (base === undefined) throw new TypeError('Invalid URL')
134
-
135
- const b = new URLImpl(base)
136
- if (p.host) { p.scheme = b._scheme; this._apply(p); return }
137
- if (!p.path && !p.query) {
138
- this._apply({
139
- scheme: b._scheme, user: b._username, pass: b._password,
140
- host: b._hostname, port: b._port,
141
- path: b._pathname, query: b._query, fragment: p.fragment || ''
142
- }); return
143
- }
144
- p.scheme = b._scheme; if (!p.user) p.user = b._username; if (!p.pass) p.pass = b._password
145
- if (!p.host) p.host = b._hostname; if (!p.port) p.port = b._port; if (!p.fragment) p.fragment = ''
146
- if (p.path && !p.path.startsWith('/')) {
147
- const bd = b._pathname.substring(0, b._pathname.lastIndexOf('/') + 1)
148
- p.path = _normalizePath(bd + p.path)
149
- } else if (!p.path) { p.path = b._pathname; if (!p.query) p.query = b._query }
150
- this._apply(p)
151
- }
152
-
153
- private _apply(p: { scheme: string; user: string; pass: string; host: string; port: string; path: string; query: string; fragment: string }): void {
154
- this._scheme = p.scheme; this._username = p.user; this._password = p.pass
155
- this._hostname = p.host; this._port = p.port
156
- this._pathname = _normalizePath(p.path || '/')
157
- this._query = p.query; this._fragment = p.fragment
158
- this._searchParams = new URLSearchParamsImpl(this._query)
159
- }
160
-
161
- get href(): string { return this.toString() }
162
- get protocol(): string { return this._scheme + ':' }
163
- get hostname(): string { return this._hostname }
164
- get port(): string { return this._port }
165
- get pathname(): string { return this._pathname }
166
- get search(): string { return this._query ? '?' + this._query : '' }
167
- get hash(): string { return this._fragment ? '#' + this._fragment : '' }
168
- get host(): string {
169
- const h = this._hostname
170
- const ipv6 = h.includes(':')
171
- return (ipv6 ? '[' + h + ']' : h) + (this._port ? ':' + this._port : '')
172
- }
173
- get origin(): string {
174
- const h = this._hostname
175
- const ipv6 = h.includes(':')
176
- return this._scheme + '://' + (ipv6 ? '[' + h + ']' : h) + (this._port ? ':' + this._port : '')
177
- }
178
- get username(): string { return this._username }
179
- get password(): string { return this._password }
180
- get searchParams(): URLSearchParams { return this._searchParams }
181
-
182
- toString(): string {
183
- let s = this._scheme + ':'
184
- const special = ['http', 'https', 'ws', 'wss', 'ftp', 'file']
185
- if (this._hostname || (special.includes(this._scheme) && this._pathname.startsWith('/'))) {
186
- s += '//'
187
- if (this._username) { s += _encode(this._username); if (this._password) s += ':' + _encode(this._password); s += '@' }
188
- s += this._hostname.includes(':') ? '[' + this._hostname + ']' : this._hostname
189
- if (this._port) s += ':' + this._port
190
- }
191
- s += this._pathname
192
- if (this._query) s += '?' + this._query
193
- if (this._fragment) s += '#' + this._fragment
194
- return s
195
- }
196
-
197
- toJSON(): string { return this.toString() }
198
- }
199
- if (typeof globalThis.URL === 'undefined') {
200
- globalThis.URL = URLImpl
201
- }