@yodaos-pkg/ink 0.2.0 → 0.3.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/dist/env.js +270 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +71 -11
- package/dist/pkg/ink_web.d.ts +5 -5
- package/dist/pkg/ink_web.js +42 -16
- package/dist/pkg/ink_web_bg.wasm +0 -0
- package/dist/pkg/ink_web_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
package/dist/env.js
CHANGED
|
@@ -3,6 +3,21 @@ const allocationSizes = new Map();
|
|
|
3
3
|
const textDecoder = new TextDecoder('utf-8', { fatal: false });
|
|
4
4
|
const textEncoder = new TextEncoder();
|
|
5
5
|
let inkRequestInterceptor = null;
|
|
6
|
+
const hrtimeOriginNs =
|
|
7
|
+
typeof performance !== 'undefined' && typeof performance.now === 'function'
|
|
8
|
+
? BigInt(Math.floor(performance.now() * 1_000_000))
|
|
9
|
+
: 0n;
|
|
10
|
+
|
|
11
|
+
export function rquickjs_browser_date_now_us() {
|
|
12
|
+
return BigInt(Date.now()) * 1000n;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function rquickjs_browser_hrtime_ns() {
|
|
16
|
+
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
|
|
17
|
+
return BigInt(Math.floor(performance.now() * 1_000_000)) - hrtimeOriginNs;
|
|
18
|
+
}
|
|
19
|
+
return BigInt(Date.now()) * 1_000_000n;
|
|
20
|
+
}
|
|
6
21
|
|
|
7
22
|
export function __setWasmInstance(exports) {
|
|
8
23
|
wasmExports = exports;
|
|
@@ -39,7 +54,10 @@ function headersToObject(headersLike) {
|
|
|
39
54
|
}
|
|
40
55
|
if (headersLike && typeof headersLike === 'object') {
|
|
41
56
|
return Object.fromEntries(
|
|
42
|
-
Object.entries(headersLike).map(([name, value]) => [
|
|
57
|
+
Object.entries(headersLike).map(([name, value]) => [
|
|
58
|
+
name,
|
|
59
|
+
Array.isArray(value) ? value.join(', ') : String(value),
|
|
60
|
+
]),
|
|
43
61
|
);
|
|
44
62
|
}
|
|
45
63
|
return {};
|
|
@@ -156,7 +174,12 @@ export async function __inkFetch(input, init, metadata) {
|
|
|
156
174
|
}
|
|
157
175
|
|
|
158
176
|
export async function fetchWithInkRequestInterceptor(input, init = {}, options = {}) {
|
|
159
|
-
const resolved = await resolveInkFetchRequest(
|
|
177
|
+
const resolved = await resolveInkFetchRequest(
|
|
178
|
+
input,
|
|
179
|
+
init,
|
|
180
|
+
options.metadata,
|
|
181
|
+
options.interceptor || null,
|
|
182
|
+
);
|
|
160
183
|
const fetchImpl = ensureFetchImplementation(options.fetch);
|
|
161
184
|
return fetchImpl(resolved.url, resolved.init);
|
|
162
185
|
}
|
|
@@ -229,8 +252,243 @@ function consoleWrite(prefix, text) {
|
|
|
229
252
|
console.log(value);
|
|
230
253
|
}
|
|
231
254
|
|
|
232
|
-
function
|
|
233
|
-
|
|
255
|
+
function readCStringWithLength(ptr, maxBytes) {
|
|
256
|
+
ptr >>>= 0;
|
|
257
|
+
const bytes = memoryBytes();
|
|
258
|
+
let end = ptr;
|
|
259
|
+
const maxEnd = Math.min(bytes.length, ptr + Math.max(0, maxBytes | 0));
|
|
260
|
+
while (end < maxEnd && bytes[end] !== 0) {
|
|
261
|
+
end += 1;
|
|
262
|
+
}
|
|
263
|
+
return textDecoder.decode(bytes.subarray(ptr, end));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function normalizePrintfValue(value) {
|
|
267
|
+
if (typeof value === 'bigint') {
|
|
268
|
+
return value;
|
|
269
|
+
}
|
|
270
|
+
if (typeof value === 'number') {
|
|
271
|
+
return Number.isFinite(value) ? value : 0;
|
|
272
|
+
}
|
|
273
|
+
if (value == null) {
|
|
274
|
+
return 0;
|
|
275
|
+
}
|
|
276
|
+
return Number(value) || 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function createDirectArgumentReader(values, offset) {
|
|
280
|
+
let index = offset;
|
|
281
|
+
return {
|
|
282
|
+
next() {
|
|
283
|
+
const value = index < values.length ? values[index] : 0;
|
|
284
|
+
index += 1;
|
|
285
|
+
return value;
|
|
286
|
+
},
|
|
287
|
+
nextInt32() {
|
|
288
|
+
return Number(normalizePrintfValue(this.next())) | 0;
|
|
289
|
+
},
|
|
290
|
+
nextUint32() {
|
|
291
|
+
return Number(normalizePrintfValue(this.next())) >>> 0;
|
|
292
|
+
},
|
|
293
|
+
nextPointer() {
|
|
294
|
+
return Number(normalizePrintfValue(this.next())) >>> 0;
|
|
295
|
+
},
|
|
296
|
+
nextFloat64() {
|
|
297
|
+
return Number(normalizePrintfValue(this.next()));
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function createVaListReader(argsPtr) {
|
|
303
|
+
let cursor = argsPtr >>> 0;
|
|
304
|
+
const view = memoryView();
|
|
305
|
+
const nextSlot = () => {
|
|
306
|
+
const slot = cursor;
|
|
307
|
+
cursor = (cursor + 8) >>> 0;
|
|
308
|
+
return slot;
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
nextInt32() {
|
|
312
|
+
return view.getInt32(nextSlot(), true);
|
|
313
|
+
},
|
|
314
|
+
nextUint32() {
|
|
315
|
+
return view.getUint32(nextSlot(), true);
|
|
316
|
+
},
|
|
317
|
+
nextPointer() {
|
|
318
|
+
return view.getUint32(nextSlot(), true);
|
|
319
|
+
},
|
|
320
|
+
nextFloat64() {
|
|
321
|
+
return view.getFloat64(nextSlot(), true);
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function formatInteger(value, {
|
|
327
|
+
signed = true,
|
|
328
|
+
base = 10,
|
|
329
|
+
width = 0,
|
|
330
|
+
padZero = false,
|
|
331
|
+
uppercase = false,
|
|
332
|
+
} = {}) {
|
|
333
|
+
let normalized = normalizePrintfValue(value);
|
|
334
|
+
let negative = false;
|
|
335
|
+
let digits = '';
|
|
336
|
+
|
|
337
|
+
if (typeof normalized === 'bigint') {
|
|
338
|
+
if (signed && normalized < 0n) {
|
|
339
|
+
negative = true;
|
|
340
|
+
normalized = -normalized;
|
|
341
|
+
} else if (!signed) {
|
|
342
|
+
normalized = BigInt.asUintN(64, normalized);
|
|
343
|
+
}
|
|
344
|
+
digits = normalized.toString(base);
|
|
345
|
+
} else {
|
|
346
|
+
let numberValue = Math.trunc(Number(normalized) || 0);
|
|
347
|
+
if (signed) {
|
|
348
|
+
negative = numberValue < 0;
|
|
349
|
+
numberValue = Math.abs(numberValue);
|
|
350
|
+
digits = numberValue.toString(base);
|
|
351
|
+
} else {
|
|
352
|
+
digits = (numberValue >>> 0).toString(base);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (uppercase) {
|
|
357
|
+
digits = digits.toUpperCase();
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const prefix = negative ? '-' : '';
|
|
361
|
+
const paddedDigits = padZero && width > prefix.length + digits.length
|
|
362
|
+
? digits.padStart(width - prefix.length, '0')
|
|
363
|
+
: digits;
|
|
364
|
+
const result = `${prefix}${paddedDigits}`;
|
|
365
|
+
return !padZero && width > result.length
|
|
366
|
+
? result.padStart(width, ' ')
|
|
367
|
+
: result;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function formatStringValue(value, precision) {
|
|
371
|
+
if (typeof value === 'string') {
|
|
372
|
+
return precision == null ? value : value.slice(0, precision);
|
|
373
|
+
}
|
|
374
|
+
const ptr = Number(normalizePrintfValue(value)) >>> 0;
|
|
375
|
+
if (ptr === 0) {
|
|
376
|
+
return '(null)';
|
|
377
|
+
}
|
|
378
|
+
if (precision == null) {
|
|
379
|
+
return readCString(ptr);
|
|
380
|
+
}
|
|
381
|
+
return readCStringWithLength(ptr, precision);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function formatPrintf(fmtPtr, reader = null) {
|
|
385
|
+
const fmt = readCString(fmtPtr);
|
|
386
|
+
if (!reader) {
|
|
387
|
+
return fmt;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
let result = '';
|
|
391
|
+
for (let i = 0; i < fmt.length; i += 1) {
|
|
392
|
+
const ch = fmt[i];
|
|
393
|
+
if (ch !== '%') {
|
|
394
|
+
result += ch;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const next = fmt[i + 1];
|
|
399
|
+
if (next === '%') {
|
|
400
|
+
result += '%';
|
|
401
|
+
i += 1;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let cursor = i + 1;
|
|
406
|
+
let padZero = false;
|
|
407
|
+
if (fmt[cursor] === '0') {
|
|
408
|
+
padZero = true;
|
|
409
|
+
cursor += 1;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
let widthText = '';
|
|
413
|
+
while (cursor < fmt.length && /[0-9]/.test(fmt[cursor])) {
|
|
414
|
+
widthText += fmt[cursor];
|
|
415
|
+
cursor += 1;
|
|
416
|
+
}
|
|
417
|
+
const width = widthText ? Number.parseInt(widthText, 10) : 0;
|
|
418
|
+
|
|
419
|
+
let precision = null;
|
|
420
|
+
if (fmt[cursor] === '.') {
|
|
421
|
+
cursor += 1;
|
|
422
|
+
if (fmt[cursor] === '*') {
|
|
423
|
+
precision = Math.max(0, reader.nextInt32());
|
|
424
|
+
cursor += 1;
|
|
425
|
+
} else {
|
|
426
|
+
let precisionText = '';
|
|
427
|
+
while (cursor < fmt.length && /[0-9]/.test(fmt[cursor])) {
|
|
428
|
+
precisionText += fmt[cursor];
|
|
429
|
+
cursor += 1;
|
|
430
|
+
}
|
|
431
|
+
precision = precisionText ? Number.parseInt(precisionText, 10) : 0;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
while (cursor < fmt.length && /[hljztL]/.test(fmt[cursor])) {
|
|
436
|
+
cursor += 1;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const specifier = fmt[cursor];
|
|
440
|
+
if (!specifier) {
|
|
441
|
+
result += '%';
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
switch (specifier) {
|
|
446
|
+
case 's':
|
|
447
|
+
result += formatStringValue(reader.nextPointer(), precision);
|
|
448
|
+
break;
|
|
449
|
+
case 'c':
|
|
450
|
+
result += String.fromCodePoint(reader.nextInt32() >>> 0);
|
|
451
|
+
break;
|
|
452
|
+
case 'd':
|
|
453
|
+
case 'i':
|
|
454
|
+
result += formatInteger(reader.nextInt32(), {
|
|
455
|
+
signed: true,
|
|
456
|
+
base: 10,
|
|
457
|
+
width,
|
|
458
|
+
padZero,
|
|
459
|
+
});
|
|
460
|
+
break;
|
|
461
|
+
case 'u':
|
|
462
|
+
result += formatInteger(reader.nextUint32(), {
|
|
463
|
+
signed: false,
|
|
464
|
+
base: 10,
|
|
465
|
+
width,
|
|
466
|
+
padZero,
|
|
467
|
+
});
|
|
468
|
+
break;
|
|
469
|
+
case 'x':
|
|
470
|
+
case 'X':
|
|
471
|
+
result += formatInteger(reader.nextUint32(), {
|
|
472
|
+
signed: false,
|
|
473
|
+
base: 16,
|
|
474
|
+
width,
|
|
475
|
+
padZero,
|
|
476
|
+
uppercase: specifier === 'X',
|
|
477
|
+
});
|
|
478
|
+
break;
|
|
479
|
+
case 'f':
|
|
480
|
+
case 'g':
|
|
481
|
+
result += String(reader.nextFloat64());
|
|
482
|
+
break;
|
|
483
|
+
default:
|
|
484
|
+
result += `%${fmt.slice(i + 1, cursor + 1)}`;
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
i = cursor;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return result;
|
|
234
492
|
}
|
|
235
493
|
|
|
236
494
|
function parseNumberPrefix(text) {
|
|
@@ -262,8 +520,8 @@ export function __assert_fail(assertionPtr, filePtr, line, functionPtr) {
|
|
|
262
520
|
throw new Error(`assertion failed: ${assertion} at ${file}:${line} in ${func}`);
|
|
263
521
|
}
|
|
264
522
|
|
|
265
|
-
export function printf(fmtPtr
|
|
266
|
-
const message = formatPrintf(fmtPtr);
|
|
523
|
+
export function printf(fmtPtr) {
|
|
524
|
+
const message = formatPrintf(fmtPtr, createDirectArgumentReader(arguments, 1));
|
|
267
525
|
consoleWrite('', message);
|
|
268
526
|
return message.length | 0;
|
|
269
527
|
}
|
|
@@ -284,8 +542,8 @@ export function putchar(ch) {
|
|
|
284
542
|
return ch | 0;
|
|
285
543
|
}
|
|
286
544
|
|
|
287
|
-
export function fprintf(_stream, fmtPtr
|
|
288
|
-
const message = formatPrintf(fmtPtr);
|
|
545
|
+
export function fprintf(_stream, fmtPtr) {
|
|
546
|
+
const message = formatPrintf(fmtPtr, createDirectArgumentReader(arguments, 2));
|
|
289
547
|
consoleWrite('', message);
|
|
290
548
|
return message.length | 0;
|
|
291
549
|
}
|
|
@@ -301,12 +559,12 @@ export function fputc(ch, _stream) {
|
|
|
301
559
|
return putchar(ch);
|
|
302
560
|
}
|
|
303
561
|
|
|
304
|
-
export function vsnprintf(dst, size, fmtPtr,
|
|
305
|
-
return writeCString(dst, size, formatPrintf(fmtPtr)) | 0;
|
|
562
|
+
export function vsnprintf(dst, size, fmtPtr, argsPtr) {
|
|
563
|
+
return writeCString(dst, size, formatPrintf(fmtPtr, createVaListReader(argsPtr))) | 0;
|
|
306
564
|
}
|
|
307
565
|
|
|
308
|
-
export function snprintf(dst, size, fmtPtr
|
|
309
|
-
return writeCString(dst, size, formatPrintf(fmtPtr)) | 0;
|
|
566
|
+
export function snprintf(dst, size, fmtPtr) {
|
|
567
|
+
return writeCString(dst, size, formatPrintf(fmtPtr, createDirectArgumentReader(arguments, 3))) | 0;
|
|
310
568
|
}
|
|
311
569
|
|
|
312
570
|
export function scalbn(x, n) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export type BundleFileInput =
|
|
2
|
-
| string
|
|
3
|
-
| Uint8Array
|
|
4
|
-
| ArrayBuffer
|
|
5
|
-
| ArrayBufferView;
|
|
1
|
+
export type BundleFileInput = string | Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
6
2
|
|
|
7
3
|
export type BundleFiles =
|
|
8
4
|
| Map<string, BundleFileInput>
|
|
@@ -113,28 +109,31 @@ export declare function getInkVersion(): string;
|
|
|
113
109
|
|
|
114
110
|
export declare function normalizeBundleFiles(files: BundleFiles): Map<string, Uint8Array>;
|
|
115
111
|
|
|
116
|
-
export declare function serializeQuery(
|
|
112
|
+
export declare function serializeQuery(
|
|
113
|
+
query: string | Record<string, unknown> | null | undefined,
|
|
114
|
+
): string | null;
|
|
117
115
|
|
|
118
116
|
export declare function createProxyUrlResolver(options: {
|
|
119
117
|
proxyUrl: string;
|
|
120
118
|
targetSearchParam?: string;
|
|
121
119
|
}): InkRequestInterceptor;
|
|
122
120
|
|
|
123
|
-
export declare function setInkRequestInterceptor(
|
|
121
|
+
export declare function setInkRequestInterceptor(
|
|
122
|
+
interceptor: InkRequestInterceptor | null | undefined,
|
|
123
|
+
): void;
|
|
124
124
|
|
|
125
125
|
export declare function clearInkRequestInterceptor(): void;
|
|
126
126
|
|
|
127
127
|
export declare function configureNetwork(options?: ConfigureNetworkOptions): void;
|
|
128
128
|
|
|
129
|
-
export declare function createVfsUrls(input: {
|
|
130
|
-
baseUrl: string;
|
|
131
|
-
appId: string;
|
|
132
|
-
}): {
|
|
129
|
+
export declare function createVfsUrls(input: { baseUrl: string; appId: string }): {
|
|
133
130
|
manifestUrl: string;
|
|
134
131
|
fileUrl(filePath: string): string;
|
|
135
132
|
};
|
|
136
133
|
|
|
137
|
-
export declare function loadBundleFromVfs(
|
|
134
|
+
export declare function loadBundleFromVfs(
|
|
135
|
+
options: LoadBundleFromVfsOptions,
|
|
136
|
+
): Promise<LoadedVfsBundle>;
|
|
138
137
|
|
|
139
138
|
export declare class InkView {
|
|
140
139
|
static create(options: CreateInkViewOptions): Promise<InkView>;
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,9 @@ function cloneUint8Array(value) {
|
|
|
45
45
|
return new Uint8Array(value);
|
|
46
46
|
}
|
|
47
47
|
if (ArrayBuffer.isView(value)) {
|
|
48
|
-
return new Uint8Array(
|
|
48
|
+
return new Uint8Array(
|
|
49
|
+
value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength),
|
|
50
|
+
);
|
|
49
51
|
}
|
|
50
52
|
if (value instanceof ArrayBuffer) {
|
|
51
53
|
return new Uint8Array(value.slice(0));
|
|
@@ -284,7 +286,8 @@ export async function initInk(options = {}) {
|
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
if (!bindingsPromise) {
|
|
287
|
-
const initInput =
|
|
289
|
+
const initInput =
|
|
290
|
+
options.wasmUrl || options.moduleOrPath || new URL('./pkg/ink_web_bg.wasm', import.meta.url);
|
|
288
291
|
bindingsPromise = initInkWasm(initInput).then(() => ({
|
|
289
292
|
InkWebView: RawInkWebView,
|
|
290
293
|
getInkVersion: getInkVersionFromWasm,
|
|
@@ -309,7 +312,11 @@ export class InkView {
|
|
|
309
312
|
}
|
|
310
313
|
|
|
311
314
|
const bindings = await initInk(config.wasm);
|
|
312
|
-
const rawView = new bindings.InkWebView(
|
|
315
|
+
const rawView = new bindings.InkWebView(
|
|
316
|
+
width,
|
|
317
|
+
height,
|
|
318
|
+
Number(config.scaleFactor || getDefaultScaleFactor()),
|
|
319
|
+
);
|
|
313
320
|
const view = new InkView(rawView, config);
|
|
314
321
|
|
|
315
322
|
if (config.canvas) {
|
|
@@ -376,22 +383,54 @@ export class InkView {
|
|
|
376
383
|
if (focusTarget && typeof focusTarget.focus === 'function') {
|
|
377
384
|
focusTarget.focus();
|
|
378
385
|
}
|
|
379
|
-
this.#rawView.dispatchPointer(
|
|
386
|
+
this.#rawView.dispatchPointer(
|
|
387
|
+
'pointerdown',
|
|
388
|
+
x,
|
|
389
|
+
y,
|
|
390
|
+
event.pointerId || 0,
|
|
391
|
+
event.button || 0,
|
|
392
|
+
0,
|
|
393
|
+
0,
|
|
394
|
+
);
|
|
380
395
|
this.requestRender();
|
|
381
396
|
});
|
|
382
397
|
addListener(canvas, 'pointermove', (event) => {
|
|
383
398
|
const { x, y } = getPointerPosition(canvas, event);
|
|
384
|
-
this.#rawView.dispatchPointer(
|
|
399
|
+
this.#rawView.dispatchPointer(
|
|
400
|
+
'pointermove',
|
|
401
|
+
x,
|
|
402
|
+
y,
|
|
403
|
+
event.pointerId || 0,
|
|
404
|
+
event.button || 0,
|
|
405
|
+
0,
|
|
406
|
+
0,
|
|
407
|
+
);
|
|
385
408
|
this.requestRender();
|
|
386
409
|
});
|
|
387
410
|
addListener(canvas, 'pointerup', (event) => {
|
|
388
411
|
const { x, y } = getPointerPosition(canvas, event);
|
|
389
|
-
this.#rawView.dispatchPointer(
|
|
412
|
+
this.#rawView.dispatchPointer(
|
|
413
|
+
'pointerup',
|
|
414
|
+
x,
|
|
415
|
+
y,
|
|
416
|
+
event.pointerId || 0,
|
|
417
|
+
event.button || 0,
|
|
418
|
+
0,
|
|
419
|
+
0,
|
|
420
|
+
);
|
|
390
421
|
this.requestRender();
|
|
391
422
|
});
|
|
392
423
|
addListener(canvas, 'pointercancel', (event) => {
|
|
393
424
|
const { x, y } = getPointerPosition(canvas, event);
|
|
394
|
-
this.#rawView.dispatchPointer(
|
|
425
|
+
this.#rawView.dispatchPointer(
|
|
426
|
+
'touchcancel',
|
|
427
|
+
x,
|
|
428
|
+
y,
|
|
429
|
+
event.pointerId || 0,
|
|
430
|
+
event.button || 0,
|
|
431
|
+
0,
|
|
432
|
+
0,
|
|
433
|
+
);
|
|
395
434
|
this.requestRender();
|
|
396
435
|
});
|
|
397
436
|
addListener(
|
|
@@ -402,18 +441,34 @@ export class InkView {
|
|
|
402
441
|
if (options.preventWheelDefault !== false && typeof event.preventDefault === 'function') {
|
|
403
442
|
event.preventDefault();
|
|
404
443
|
}
|
|
405
|
-
this.#rawView.dispatchPointer(
|
|
444
|
+
this.#rawView.dispatchPointer(
|
|
445
|
+
'mousewheel',
|
|
446
|
+
x,
|
|
447
|
+
y,
|
|
448
|
+
0,
|
|
449
|
+
0,
|
|
450
|
+
event.deltaX || 0,
|
|
451
|
+
event.deltaY || 0,
|
|
452
|
+
);
|
|
406
453
|
this.requestRender();
|
|
407
454
|
},
|
|
408
455
|
{ passive: false },
|
|
409
456
|
);
|
|
410
457
|
|
|
411
458
|
addListener(keyboardTarget, 'keydown', (event) => {
|
|
412
|
-
this.#rawView.dispatchInput(
|
|
459
|
+
this.#rawView.dispatchInput(
|
|
460
|
+
'keydown',
|
|
461
|
+
normalizeKeyboardCode(event),
|
|
462
|
+
Number(event.timeStamp || Date.now()),
|
|
463
|
+
);
|
|
413
464
|
this.requestRender();
|
|
414
465
|
});
|
|
415
466
|
addListener(keyboardTarget, 'keyup', (event) => {
|
|
416
|
-
this.#rawView.dispatchInput(
|
|
467
|
+
this.#rawView.dispatchInput(
|
|
468
|
+
'keyup',
|
|
469
|
+
normalizeKeyboardCode(event),
|
|
470
|
+
Number(event.timeStamp || Date.now()),
|
|
471
|
+
);
|
|
417
472
|
this.requestRender();
|
|
418
473
|
});
|
|
419
474
|
addListener(focusTarget, 'focus', () => {
|
|
@@ -438,7 +493,12 @@ export class InkView {
|
|
|
438
493
|
throw new Error('`appId` must be a non-empty string.');
|
|
439
494
|
}
|
|
440
495
|
|
|
441
|
-
this.#rawView.openBundle(
|
|
496
|
+
this.#rawView.openBundle(
|
|
497
|
+
appId,
|
|
498
|
+
normalizeBundleFiles(files),
|
|
499
|
+
initialPage,
|
|
500
|
+
serializeQuery(query),
|
|
501
|
+
);
|
|
442
502
|
this.requestRender();
|
|
443
503
|
return this;
|
|
444
504
|
}
|
package/dist/pkg/ink_web.d.ts
CHANGED
|
@@ -41,11 +41,11 @@ export interface InitOutput {
|
|
|
41
41
|
readonly inkwebview_render: (a: number, b: number) => void;
|
|
42
42
|
readonly inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
43
43
|
readonly main: () => void;
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
44
|
+
readonly __wasm_bindgen_func_elem_8658: (a: number, b: number) => void;
|
|
45
|
+
readonly __wasm_bindgen_func_elem_12847: (a: number, b: number) => void;
|
|
46
|
+
readonly __wasm_bindgen_func_elem_8747: (a: number, b: number, c: number) => void;
|
|
47
|
+
readonly __wasm_bindgen_func_elem_12848: (a: number, b: number, c: number) => void;
|
|
48
|
+
readonly __wasm_bindgen_func_elem_8748: (a: number, b: number) => void;
|
|
49
49
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
50
50
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
51
51
|
readonly __wbindgen_export3: (a: number) => void;
|
package/dist/pkg/ink_web.js
CHANGED
|
@@ -208,6 +208,8 @@ import * as import25 from "../env.js"
|
|
|
208
208
|
import * as import26 from "../env.js"
|
|
209
209
|
import * as import27 from "../env.js"
|
|
210
210
|
import * as import28 from "../env.js"
|
|
211
|
+
import * as import29 from "../env.js"
|
|
212
|
+
import * as import30 from "../env.js"
|
|
211
213
|
|
|
212
214
|
function __wbg_get_imports() {
|
|
213
215
|
const import0 = {
|
|
@@ -498,6 +500,16 @@ function __wbg_get_imports() {
|
|
|
498
500
|
const ret = result;
|
|
499
501
|
return ret;
|
|
500
502
|
},
|
|
503
|
+
__wbg_instanceof_Error_8573fe0b0b480f46: function(arg0) {
|
|
504
|
+
let result;
|
|
505
|
+
try {
|
|
506
|
+
result = getObject(arg0) instanceof Error;
|
|
507
|
+
} catch (_) {
|
|
508
|
+
result = false;
|
|
509
|
+
}
|
|
510
|
+
const ret = result;
|
|
511
|
+
return ret;
|
|
512
|
+
},
|
|
501
513
|
__wbg_instanceof_HtmlCanvasElement_3f2f6e1edb1c9792: function(arg0) {
|
|
502
514
|
let result;
|
|
503
515
|
try {
|
|
@@ -598,9 +610,17 @@ function __wbg_get_imports() {
|
|
|
598
610
|
const ret = getObject(arg0).measureText(getStringFromWasm0(arg1, arg2));
|
|
599
611
|
return addHeapObject(ret);
|
|
600
612
|
}, arguments); },
|
|
613
|
+
__wbg_message_9ddc4b9a62a7c379: function(arg0) {
|
|
614
|
+
const ret = getObject(arg0).message;
|
|
615
|
+
return addHeapObject(ret);
|
|
616
|
+
},
|
|
601
617
|
__wbg_moveTo_e9190fc700d55b40: function(arg0, arg1, arg2) {
|
|
602
618
|
getObject(arg0).moveTo(arg1, arg2);
|
|
603
619
|
},
|
|
620
|
+
__wbg_name_446e25ef2cfdab5a: function(arg0) {
|
|
621
|
+
const ret = getObject(arg0).name;
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
},
|
|
604
624
|
__wbg_navigator_43be698ba96fc088: function(arg0) {
|
|
605
625
|
const ret = getObject(arg0).navigator;
|
|
606
626
|
return addHeapObject(ret);
|
|
@@ -621,6 +641,10 @@ function __wbg_get_imports() {
|
|
|
621
641
|
const ret = new Headers();
|
|
622
642
|
return addHeapObject(ret);
|
|
623
643
|
}, arguments); },
|
|
644
|
+
__wbg_new_72b49615380db768: function(arg0, arg1) {
|
|
645
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
646
|
+
return addHeapObject(ret);
|
|
647
|
+
},
|
|
624
648
|
__wbg_new_7455c5eb8798868d: function() { return handleError(function () {
|
|
625
649
|
const ret = new Audio();
|
|
626
650
|
return addHeapObject(ret);
|
|
@@ -943,28 +967,28 @@ function __wbg_get_imports() {
|
|
|
943
967
|
return ret;
|
|
944
968
|
},
|
|
945
969
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
946
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
947
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
970
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2300, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
971
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8658, __wasm_bindgen_func_elem_8747);
|
|
948
972
|
return addHeapObject(ret);
|
|
949
973
|
},
|
|
950
974
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
951
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
952
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
975
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2300, function: Function { arguments: [NamedExternref("Event")], shim_idx: 2304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
976
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8658, __wasm_bindgen_func_elem_8747);
|
|
953
977
|
return addHeapObject(ret);
|
|
954
978
|
},
|
|
955
979
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
956
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
957
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
980
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2300, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
981
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8658, __wasm_bindgen_func_elem_8747);
|
|
958
982
|
return addHeapObject(ret);
|
|
959
983
|
},
|
|
960
984
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
961
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
962
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
985
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2300, function: Function { arguments: [], shim_idx: 2301, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
986
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8658, __wasm_bindgen_func_elem_8748);
|
|
963
987
|
return addHeapObject(ret);
|
|
964
988
|
},
|
|
965
989
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
966
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
967
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
990
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3264, function: Function { arguments: [Externref], shim_idx: 3265, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
991
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_12847, __wasm_bindgen_func_elem_12848);
|
|
968
992
|
return addHeapObject(ret);
|
|
969
993
|
},
|
|
970
994
|
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
@@ -1016,19 +1040,21 @@ function __wbg_get_imports() {
|
|
|
1016
1040
|
"env": import26,
|
|
1017
1041
|
"env": import27,
|
|
1018
1042
|
"env": import28,
|
|
1043
|
+
"env": import29,
|
|
1044
|
+
"env": import30,
|
|
1019
1045
|
};
|
|
1020
1046
|
}
|
|
1021
1047
|
|
|
1022
|
-
function
|
|
1023
|
-
wasm.
|
|
1048
|
+
function __wasm_bindgen_func_elem_8748(arg0, arg1) {
|
|
1049
|
+
wasm.__wasm_bindgen_func_elem_8748(arg0, arg1);
|
|
1024
1050
|
}
|
|
1025
1051
|
|
|
1026
|
-
function
|
|
1027
|
-
wasm.
|
|
1052
|
+
function __wasm_bindgen_func_elem_8747(arg0, arg1, arg2) {
|
|
1053
|
+
wasm.__wasm_bindgen_func_elem_8747(arg0, arg1, addHeapObject(arg2));
|
|
1028
1054
|
}
|
|
1029
1055
|
|
|
1030
|
-
function
|
|
1031
|
-
wasm.
|
|
1056
|
+
function __wasm_bindgen_func_elem_12848(arg0, arg1, arg2) {
|
|
1057
|
+
wasm.__wasm_bindgen_func_elem_12848(arg0, arg1, addHeapObject(arg2));
|
|
1032
1058
|
}
|
|
1033
1059
|
|
|
1034
1060
|
|
package/dist/pkg/ink_web_bg.wasm
CHANGED
|
Binary file
|
|
@@ -16,11 +16,11 @@ export const inkwebview_openBundle: (a: number, b: number, c: number, d: number,
|
|
|
16
16
|
export const inkwebview_render: (a: number, b: number) => void;
|
|
17
17
|
export const inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
18
18
|
export const main: () => void;
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
19
|
+
export const __wasm_bindgen_func_elem_8658: (a: number, b: number) => void;
|
|
20
|
+
export const __wasm_bindgen_func_elem_12847: (a: number, b: number) => void;
|
|
21
|
+
export const __wasm_bindgen_func_elem_8747: (a: number, b: number, c: number) => void;
|
|
22
|
+
export const __wasm_bindgen_func_elem_12848: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const __wasm_bindgen_func_elem_8748: (a: number, b: number) => void;
|
|
24
24
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
25
25
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
26
26
|
export const __wbindgen_export3: (a: number) => void;
|