@yodaos-pkg/ink 0.8.0 → 0.9.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.md +28 -2
- package/index.d.ts +111 -8
- package/index.js +544 -28
- package/package.json +1 -1
- package/pkg/ink_web.d.ts +19 -7
- package/pkg/ink_web.js +71 -18
- package/pkg/ink_web_bg.wasm +0 -0
- package/pkg/ink_web_bg.wasm.d.ts +12 -6
package/README.md
CHANGED
|
@@ -67,8 +67,12 @@ Creates an `InkView` instance and initializes the wasm runtime internally.
|
|
|
67
67
|
- Required
|
|
68
68
|
- The logical width of the Ink view
|
|
69
69
|
- `options.height: number`
|
|
70
|
-
- Required
|
|
71
|
-
-
|
|
70
|
+
- Required in `bounded` mode
|
|
71
|
+
- Optional in `width-constrained-auto-height` mode
|
|
72
|
+
- `options.layoutMode?: 'bounded' | 'width-constrained-auto-height'`
|
|
73
|
+
- Optional
|
|
74
|
+
- Defaults to `bounded`
|
|
75
|
+
- Use `width-constrained-auto-height` when the host wants a fixed width and a runtime-driven height
|
|
72
76
|
- `options.scaleFactor?: number`
|
|
73
77
|
- Optional
|
|
74
78
|
- The device pixel ratio, defaulting to `window.devicePixelRatio`
|
|
@@ -87,6 +91,7 @@ Creates an `InkView` instance and initializes the wasm runtime internally.
|
|
|
87
91
|
- Creates the underlying `InkWebView`
|
|
88
92
|
- Returns the higher-level `InkView` wrapper
|
|
89
93
|
- Automatically calls `bindCanvas()` if a `canvas` is provided
|
|
94
|
+
- In auto-height mode, automatically adopts the latest runtime content height for HTML canvas surfaces
|
|
90
95
|
|
|
91
96
|
**Returns**
|
|
92
97
|
|
|
@@ -94,6 +99,27 @@ Creates an `InkView` instance and initializes the wasm runtime internally.
|
|
|
94
99
|
- Resolves to an `InkView` instance that can then call
|
|
95
100
|
`bindDomEvents()`, `openBundle()`, and `openFromVfs()`
|
|
96
101
|
|
|
102
|
+
### Auto-height Layout
|
|
103
|
+
|
|
104
|
+
Use `layoutMode: 'width-constrained-auto-height'` when the host controls width
|
|
105
|
+
but wants Ink to drive the rendered height:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const view = await createInkView({
|
|
109
|
+
width: 360,
|
|
110
|
+
layoutMode: 'width-constrained-auto-height',
|
|
111
|
+
scaleFactor: window.devicePixelRatio,
|
|
112
|
+
canvas,
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
In this mode:
|
|
117
|
+
|
|
118
|
+
- the host still owns the constrained width
|
|
119
|
+
- the SDK automatically adopts runtime-reported content height
|
|
120
|
+
- browser hosts should call `view.resize()` when width or device pixel ratio changes
|
|
121
|
+
- browser hosts do not need to manually apply HTML canvas height in the common case
|
|
122
|
+
|
|
97
123
|
### `configureNetwork(options)`
|
|
98
124
|
|
|
99
125
|
Configures host-controlled request interception for Ink network traffic.
|
package/index.d.ts
CHANGED
|
@@ -40,16 +40,61 @@ export interface InitInkOptions {
|
|
|
40
40
|
export interface CreateInkViewOptions {
|
|
41
41
|
/** Initial logical width in CSS pixels. */
|
|
42
42
|
width: number;
|
|
43
|
-
/** Initial logical height in CSS pixels. */
|
|
44
|
-
height
|
|
43
|
+
/** Initial logical height in CSS pixels. Required in `bounded` mode and optional in auto-height mode. */
|
|
44
|
+
height?: number;
|
|
45
|
+
/** Layout behavior used by the host surface. Defaults to `bounded`. */
|
|
46
|
+
layoutMode?: InkLayoutMode;
|
|
45
47
|
/** Device pixel ratio override. Defaults to `window.devicePixelRatio` when available. */
|
|
46
48
|
scaleFactor?: number;
|
|
47
|
-
/**
|
|
49
|
+
/** Legacy shortcut for immediately binding an HTML canvas after creation. */
|
|
48
50
|
canvas?: HTMLCanvasElement;
|
|
51
|
+
/** Optional surface descriptor bound immediately after creation. */
|
|
52
|
+
surface?: InkSurfaceDescriptor | null;
|
|
53
|
+
/** Whether the internal render loop should start immediately after creation. */
|
|
54
|
+
autoRender?: boolean;
|
|
55
|
+
/** Whether `destroy()` should clear the currently attached surface. Defaults to `true`. */
|
|
56
|
+
clearOnDestroy?: boolean;
|
|
57
|
+
/** Callback fired after Ink reports a new measured content size. */
|
|
58
|
+
onContentSizeChanged?: InkContentSizeChangedHandler | null;
|
|
49
59
|
/** Optional wasm bootstrap overrides. */
|
|
50
60
|
wasm?: InitInkOptions;
|
|
51
61
|
}
|
|
52
62
|
|
|
63
|
+
/** Cross-platform layout mode exposed by browser hosts. */
|
|
64
|
+
export type InkLayoutMode = 'bounded' | 'width-constrained-auto-height';
|
|
65
|
+
|
|
66
|
+
/** Measured content size reported by the Ink runtime in CSS pixels. */
|
|
67
|
+
export interface InkContentSize {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Surface descriptor for a DOM-backed HTML canvas target. */
|
|
73
|
+
export interface InkHtmlCanvasSurface {
|
|
74
|
+
type: 'html-canvas';
|
|
75
|
+
canvas: HTMLCanvasElement;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Surface descriptor for an OffscreenCanvas target.
|
|
80
|
+
*
|
|
81
|
+
* The current browser SDK supports this descriptor on the main thread by
|
|
82
|
+
* rendering into an internal backing `HTMLCanvasElement` and copying each
|
|
83
|
+
* presented frame into the target `OffscreenCanvas`.
|
|
84
|
+
*
|
|
85
|
+
* This means the host-facing `InkView` API already works with
|
|
86
|
+
* `offscreen-canvas`, but it is not yet a pure worker-only renderer path.
|
|
87
|
+
* Hosts that need a document-free OffscreenCanvas backend should treat that as
|
|
88
|
+
* a future capability.
|
|
89
|
+
*/
|
|
90
|
+
export interface InkOffscreenCanvasSurface {
|
|
91
|
+
type: 'offscreen-canvas';
|
|
92
|
+
canvas: OffscreenCanvas;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Supported surface descriptors accepted by {@link InkView.attachSurface}. */
|
|
96
|
+
export type InkSurfaceDescriptor = InkHtmlCanvasSurface | InkOffscreenCanvasSurface;
|
|
97
|
+
|
|
53
98
|
/**
|
|
54
99
|
* Opens an in-memory Ink app bundle that is already available in the host.
|
|
55
100
|
*/
|
|
@@ -197,6 +242,8 @@ export interface InkHostMessageStream {
|
|
|
197
242
|
|
|
198
243
|
/** Callback invoked after the runtime requests that the host close the current view. */
|
|
199
244
|
export type InkCloseRequestedHandler = () => void;
|
|
245
|
+
/** Callback invoked after the runtime reports a new measured content size. */
|
|
246
|
+
export type InkContentSizeChangedHandler = (contentSize: InkContentSize) => void;
|
|
200
247
|
|
|
201
248
|
/**
|
|
202
249
|
* Initializes the browser SDK and ensures the wasm runtime is ready to create
|
|
@@ -255,7 +302,7 @@ export declare function loadBundleFromVfs(
|
|
|
255
302
|
* A typical flow is:
|
|
256
303
|
*
|
|
257
304
|
* 1. Create a view with {@link InkView.create}.
|
|
258
|
-
* 2.
|
|
305
|
+
* 2. Attach a surface and DOM events if needed.
|
|
259
306
|
* 3. Open an in-memory bundle or load one from VFS.
|
|
260
307
|
* 4. Render manually with {@link render} or start the internal loop with
|
|
261
308
|
* {@link startRendering}.
|
|
@@ -271,11 +318,33 @@ export declare class InkView {
|
|
|
271
318
|
*/
|
|
272
319
|
static create(options: CreateInkViewOptions): Promise<InkView>;
|
|
273
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Attaches or reattaches the render surface used by this view.
|
|
323
|
+
*
|
|
324
|
+
* Hosts should prefer this over the legacy {@link bindCanvas} alias when
|
|
325
|
+
* adopting the `View + Surface + Runtime Control` API shape.
|
|
326
|
+
*/
|
|
327
|
+
attachSurface(surface: InkSurfaceDescriptor): this;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Detaches the currently attached surface without destroying the view.
|
|
331
|
+
*
|
|
332
|
+
* When `options.clear` is not `false`, the host-visible surface is cleared
|
|
333
|
+
* before it is released from the view.
|
|
334
|
+
*/
|
|
335
|
+
detachSurface(options?: { clear?: boolean }): this;
|
|
336
|
+
|
|
337
|
+
/** Returns the currently attached surface descriptor, if any. */
|
|
338
|
+
getSurface(): InkSurfaceDescriptor | null;
|
|
339
|
+
|
|
274
340
|
/**
|
|
275
341
|
* Binds or rebinds the canvas used for drawing the current view.
|
|
276
342
|
*
|
|
277
343
|
* Rebinding is useful when the host recreates a canvas element while keeping
|
|
278
344
|
* the same Ink runtime instance alive.
|
|
345
|
+
*
|
|
346
|
+
* This is a legacy alias for
|
|
347
|
+
* `attachSurface({ type: 'html-canvas', canvas })`.
|
|
279
348
|
*/
|
|
280
349
|
bindCanvas(canvas: HTMLCanvasElement): this;
|
|
281
350
|
|
|
@@ -321,11 +390,15 @@ export declare class InkView {
|
|
|
321
390
|
/**
|
|
322
391
|
* Resizes the logical surface and optionally updates the scale factor.
|
|
323
392
|
*
|
|
324
|
-
* Hosts should call this whenever the
|
|
325
|
-
* changes.
|
|
393
|
+
* Hosts should call this whenever the constrained width or device pixel ratio
|
|
394
|
+
* changes. In `width-constrained-auto-height` mode, the SDK continues to
|
|
395
|
+
* adopt the runtime-reported height automatically after width-driven relayout.
|
|
326
396
|
*/
|
|
327
397
|
resize(width: number, height: number, scaleFactor?: number): this;
|
|
328
398
|
|
|
399
|
+
/** Switches the active layout mode and forces the current page to re-layout. */
|
|
400
|
+
setLayoutMode(layoutMode: InkLayoutMode): this;
|
|
401
|
+
|
|
329
402
|
/** Forwards a host focus event so the Ink instance can accept focus-dependent input. */
|
|
330
403
|
focus(): this;
|
|
331
404
|
|
|
@@ -356,6 +429,20 @@ export declare class InkView {
|
|
|
356
429
|
*/
|
|
357
430
|
notifyUserInteraction(): this;
|
|
358
431
|
|
|
432
|
+
/** Forwards a pointer-like event directly into the current Ink view. */
|
|
433
|
+
dispatchPointer(
|
|
434
|
+
eventType: string,
|
|
435
|
+
x: number,
|
|
436
|
+
y: number,
|
|
437
|
+
id?: number,
|
|
438
|
+
button?: number,
|
|
439
|
+
deltaX?: number,
|
|
440
|
+
deltaY?: number,
|
|
441
|
+
): this;
|
|
442
|
+
|
|
443
|
+
/** Forwards a keyboard/input event directly into the current Ink view. */
|
|
444
|
+
dispatchInput(eventType: string, code: string, timestamp?: number): this;
|
|
445
|
+
|
|
359
446
|
/**
|
|
360
447
|
* Dispatches a one-shot host message to the current Ink page.
|
|
361
448
|
*
|
|
@@ -396,21 +483,37 @@ export declare class InkView {
|
|
|
396
483
|
/** Stops the internal animation/render loop started by {@link startRendering}. */
|
|
397
484
|
stopRendering(): this;
|
|
398
485
|
|
|
399
|
-
/** Returns whether the
|
|
486
|
+
/** Returns whether the current app is still running and has not requested close. */
|
|
400
487
|
isRunning(): boolean;
|
|
401
488
|
|
|
489
|
+
/** Returns whether the internal render loop is currently active. */
|
|
490
|
+
isRendering(): boolean;
|
|
491
|
+
|
|
492
|
+
/** Returns whether this host wrapper has already been destroyed. */
|
|
493
|
+
isDestroyed(): boolean;
|
|
494
|
+
|
|
402
495
|
/**
|
|
403
496
|
* Registers the callback fired after Ink requests that the host close this view.
|
|
404
497
|
*
|
|
405
498
|
* When close is requested, the SDK marks the view as close-requested, stops
|
|
406
|
-
* the internal render loop automatically,
|
|
499
|
+
* the internal render loop automatically, relies on the runtime to blank the
|
|
500
|
+
* currently attached surface, and then invokes this callback.
|
|
407
501
|
* Pass `null` to clear the current callback.
|
|
408
502
|
*/
|
|
409
503
|
setOnCloseRequested(callback: InkCloseRequestedHandler | null): this;
|
|
410
504
|
|
|
505
|
+
/** Property-style close callback preferred by the new SDK shape. */
|
|
506
|
+
onCloseRequested: InkCloseRequestedHandler | null;
|
|
507
|
+
|
|
411
508
|
/** Returns whether Ink has already requested that the host close this view. */
|
|
412
509
|
isCloseRequested(): boolean;
|
|
413
510
|
|
|
511
|
+
/** Registers the callback fired after Ink reports a new measured content size. */
|
|
512
|
+
setOnContentSizeChanged(callback: InkContentSizeChangedHandler | null): this;
|
|
513
|
+
|
|
514
|
+
/** Property-style content size callback preferred by the new SDK shape. */
|
|
515
|
+
onContentSizeChanged: InkContentSizeChangedHandler | null;
|
|
516
|
+
|
|
414
517
|
/**
|
|
415
518
|
* Releases the underlying wasm view and detaches associated host resources.
|
|
416
519
|
*
|
package/index.js
CHANGED
|
@@ -250,9 +250,11 @@ function normalizeKeyboardCode(event) {
|
|
|
250
250
|
|
|
251
251
|
function getPointerPosition(canvas, event) {
|
|
252
252
|
const rect = canvas.getBoundingClientRect();
|
|
253
|
+
const scaleX = rect.width > 0 ? canvas.width / rect.width : 1;
|
|
254
|
+
const scaleY = rect.height > 0 ? canvas.height / rect.height : 1;
|
|
253
255
|
return {
|
|
254
|
-
x: event.clientX - rect.left,
|
|
255
|
-
y: event.clientY - rect.top,
|
|
256
|
+
x: (event.clientX - rect.left) * scaleX,
|
|
257
|
+
y: (event.clientY - rect.top) * scaleY,
|
|
256
258
|
};
|
|
257
259
|
}
|
|
258
260
|
|
|
@@ -278,6 +280,20 @@ function ensureAnimationFrameApi() {
|
|
|
278
280
|
};
|
|
279
281
|
}
|
|
280
282
|
|
|
283
|
+
function createDomCanvas(width, height) {
|
|
284
|
+
const documentRef = globalThis.document;
|
|
285
|
+
if (!documentRef || typeof documentRef.createElement !== 'function') {
|
|
286
|
+
throw new Error(
|
|
287
|
+
'OffscreenCanvas surfaces currently require a browser document to create a backing HTML canvas.',
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const canvas = documentRef.createElement('canvas');
|
|
292
|
+
canvas.width = Math.max(1, Number(width) || 1);
|
|
293
|
+
canvas.height = Math.max(1, Number(height) || 1);
|
|
294
|
+
return canvas;
|
|
295
|
+
}
|
|
296
|
+
|
|
281
297
|
function normalizeHostMessageMetadata(origin, lastEventId) {
|
|
282
298
|
if (typeof origin !== 'string') {
|
|
283
299
|
throw new TypeError('`origin` must be a string.');
|
|
@@ -313,6 +329,81 @@ function serializeHostMessagePayload(dataOrJson) {
|
|
|
313
329
|
return payloadJson;
|
|
314
330
|
}
|
|
315
331
|
|
|
332
|
+
function cloneSurfaceDescriptor(surface) {
|
|
333
|
+
if (!surface) {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
return { ...surface };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function normalizeSurfaceDescriptor(surface) {
|
|
340
|
+
if (!surface) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (typeof surface !== 'object') {
|
|
345
|
+
throw new TypeError('`surface` must be an object.');
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (surface.type === 'html-canvas') {
|
|
349
|
+
if (!surface.canvas || typeof surface.canvas.getBoundingClientRect !== 'function') {
|
|
350
|
+
throw new TypeError('`surface.canvas` must be an HTMLCanvasElement-like object.');
|
|
351
|
+
}
|
|
352
|
+
return {
|
|
353
|
+
type: 'html-canvas',
|
|
354
|
+
canvas: surface.canvas,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (surface.type === 'offscreen-canvas') {
|
|
359
|
+
if (!surface.canvas || typeof surface.canvas.getContext !== 'function') {
|
|
360
|
+
throw new TypeError('`surface.canvas` must be an OffscreenCanvas-like object.');
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
type: 'offscreen-canvas',
|
|
364
|
+
canvas: surface.canvas,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
throw new TypeError(`Unsupported surface type: ${String(surface.type)}`);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function normalizeLayoutMode(value) {
|
|
372
|
+
if (value == null || value === '') {
|
|
373
|
+
return 'bounded';
|
|
374
|
+
}
|
|
375
|
+
if (value === 'bounded' || value === 'width-constrained-auto-height') {
|
|
376
|
+
return value;
|
|
377
|
+
}
|
|
378
|
+
throw new TypeError('`layoutMode` must be either `bounded` or `width-constrained-auto-height`.');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function normalizeHostLanguageModelConfig(config) {
|
|
382
|
+
if (config == null) {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
if (typeof config !== 'object') {
|
|
386
|
+
throw new TypeError('`config` must be an object or null.');
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const headers =
|
|
390
|
+
config.headers && typeof config.headers === 'object' && !Array.isArray(config.headers)
|
|
391
|
+
? Object.fromEntries(
|
|
392
|
+
Object.entries(config.headers).map(([key, value]) => [String(key), String(value)]),
|
|
393
|
+
)
|
|
394
|
+
: {};
|
|
395
|
+
|
|
396
|
+
return {
|
|
397
|
+
endpoint: String(config.endpoint || '').trim(),
|
|
398
|
+
defaultModel: config.defaultModel == null ? null : String(config.defaultModel).trim(),
|
|
399
|
+
apiStyle: String(config.apiStyle || '').trim(),
|
|
400
|
+
headers,
|
|
401
|
+
shareVendorHeaders: Boolean(config.shareVendorHeaders),
|
|
402
|
+
vendorHeadersEnv:
|
|
403
|
+
config.vendorHeadersEnv == null ? null : String(config.vendorHeadersEnv).trim(),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
316
407
|
class InkHostMessageStream {
|
|
317
408
|
#rawStream;
|
|
318
409
|
#requestRender;
|
|
@@ -369,22 +460,31 @@ export class InkView {
|
|
|
369
460
|
static async create(options) {
|
|
370
461
|
const config = options || {};
|
|
371
462
|
const width = Number(config.width);
|
|
463
|
+
const layoutMode = normalizeLayoutMode(config.layoutMode);
|
|
372
464
|
const height = Number(config.height);
|
|
465
|
+
const scaleFactor = Number(config.scaleFactor || getDefaultScaleFactor());
|
|
373
466
|
|
|
374
|
-
if (!Number.isFinite(width)
|
|
375
|
-
throw new Error('`width`
|
|
467
|
+
if (!Number.isFinite(width)) {
|
|
468
|
+
throw new Error('`width` is a required numeric value.');
|
|
469
|
+
}
|
|
470
|
+
if (layoutMode === 'bounded' && !Number.isFinite(height)) {
|
|
471
|
+
throw new Error('`height` is required when `layoutMode` is `bounded`.');
|
|
376
472
|
}
|
|
473
|
+
const initialHeight =
|
|
474
|
+
layoutMode === 'width-constrained-auto-height' && !Number.isFinite(height) ? 1 : height;
|
|
377
475
|
|
|
378
476
|
const bindings = await initInk(config.wasm);
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
Number(config.scaleFactor || getDefaultScaleFactor()),
|
|
383
|
-
);
|
|
477
|
+
const physicalWidth = Math.max(1, Math.round(width * scaleFactor));
|
|
478
|
+
const physicalHeight = Math.max(1, Math.round(initialHeight * scaleFactor));
|
|
479
|
+
const rawView = new bindings.InkWebView(physicalWidth, physicalHeight, scaleFactor, layoutMode);
|
|
384
480
|
const view = new InkView(rawView, config);
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
481
|
+
const initialSurface =
|
|
482
|
+
config.surface || (config.canvas ? { type: 'html-canvas', canvas: config.canvas } : null);
|
|
483
|
+
if (initialSurface) {
|
|
484
|
+
view.attachSurface(initialSurface);
|
|
485
|
+
}
|
|
486
|
+
if (config.autoRender) {
|
|
487
|
+
view.startRendering();
|
|
388
488
|
}
|
|
389
489
|
|
|
390
490
|
return view;
|
|
@@ -392,6 +492,7 @@ export class InkView {
|
|
|
392
492
|
|
|
393
493
|
#rawView;
|
|
394
494
|
#canvas;
|
|
495
|
+
#surface;
|
|
395
496
|
#animationFrameApi;
|
|
396
497
|
#frameHandle;
|
|
397
498
|
#autoRender;
|
|
@@ -399,10 +500,20 @@ export class InkView {
|
|
|
399
500
|
#destroyed;
|
|
400
501
|
#domCleanup;
|
|
401
502
|
#onCloseRequested;
|
|
503
|
+
#clearOnDestroy;
|
|
504
|
+
#logicalWidth;
|
|
505
|
+
#logicalHeight;
|
|
506
|
+
#boundedHeight;
|
|
507
|
+
#layoutMode;
|
|
508
|
+
#latestContentSize;
|
|
509
|
+
#scaleFactor;
|
|
510
|
+
#surfaceBinding;
|
|
511
|
+
#onContentSizeChanged;
|
|
402
512
|
|
|
403
513
|
constructor(rawView, options = {}) {
|
|
404
514
|
this.#rawView = rawView;
|
|
405
515
|
this.#canvas = options.canvas || null;
|
|
516
|
+
this.#surface = null;
|
|
406
517
|
this.#animationFrameApi = ensureAnimationFrameApi();
|
|
407
518
|
this.#frameHandle = null;
|
|
408
519
|
this.#autoRender = false;
|
|
@@ -410,6 +521,225 @@ export class InkView {
|
|
|
410
521
|
this.#destroyed = false;
|
|
411
522
|
this.#domCleanup = null;
|
|
412
523
|
this.#onCloseRequested = null;
|
|
524
|
+
this.#clearOnDestroy = options.clearOnDestroy !== false;
|
|
525
|
+
this.#logicalWidth = Number(options.width) || 1;
|
|
526
|
+
this.#logicalHeight = Number(options.height) || 1;
|
|
527
|
+
this.#boundedHeight = Number(options.height) || 1;
|
|
528
|
+
this.#layoutMode = normalizeLayoutMode(options.layoutMode);
|
|
529
|
+
this.#latestContentSize = null;
|
|
530
|
+
this.#scaleFactor = Number(options.scaleFactor || getDefaultScaleFactor());
|
|
531
|
+
this.#surfaceBinding = null;
|
|
532
|
+
this.#onContentSizeChanged = null;
|
|
533
|
+
this.onContentSizeChanged = options.onContentSizeChanged || null;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
#clearSurfaceContents() {
|
|
537
|
+
const clearTarget = (target) => {
|
|
538
|
+
if (!target || typeof target.getContext !== 'function') {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const context = target.getContext('2d');
|
|
543
|
+
if (!context || typeof context.clearRect !== 'function') {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (typeof context.save === 'function') {
|
|
548
|
+
context.save();
|
|
549
|
+
}
|
|
550
|
+
if (typeof context.setTransform === 'function') {
|
|
551
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
552
|
+
} else if (typeof context.resetTransform === 'function') {
|
|
553
|
+
context.resetTransform();
|
|
554
|
+
}
|
|
555
|
+
context.clearRect(0, 0, Number(target.width) || 0, Number(target.height) || 0);
|
|
556
|
+
if (typeof context.restore === 'function') {
|
|
557
|
+
context.restore();
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
clearTarget(this.#canvas);
|
|
562
|
+
if (this.#surfaceBinding?.type === 'offscreen-canvas') {
|
|
563
|
+
clearTarget(this.#surfaceBinding.targetCanvas);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
#syncSurfaceBindingSize(width, height) {
|
|
568
|
+
if (!this.#surfaceBinding || this.#surfaceBinding.type !== 'offscreen-canvas') {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const nextWidth = Math.max(1, Number(width) || 1);
|
|
573
|
+
const nextHeight = Math.max(1, Number(height) || 1);
|
|
574
|
+
const nextBitmapWidth = Math.max(1, Math.round(nextWidth * this.#scaleFactor));
|
|
575
|
+
const nextBitmapHeight = Math.max(1, Math.round(nextHeight * this.#scaleFactor));
|
|
576
|
+
this.#surfaceBinding.backingCanvas.width = nextBitmapWidth;
|
|
577
|
+
this.#surfaceBinding.backingCanvas.height = nextBitmapHeight;
|
|
578
|
+
this.#surfaceBinding.targetCanvas.width = nextBitmapWidth;
|
|
579
|
+
this.#surfaceBinding.targetCanvas.height = nextBitmapHeight;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
#syncHtmlCanvasBindingSize(width, height, options = {}) {
|
|
583
|
+
if (!this.#surfaceBinding || this.#surfaceBinding.type !== 'html-canvas') {
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const nextWidth = Math.max(1, Number(width) || 1);
|
|
588
|
+
const nextHeight = Math.max(1, Number(height) || 1);
|
|
589
|
+
const nextBitmapWidth = Math.max(1, Math.round(nextWidth * this.#scaleFactor));
|
|
590
|
+
const nextBitmapHeight = Math.max(1, Math.round(nextHeight * this.#scaleFactor));
|
|
591
|
+
const canvas = this.#surfaceBinding.canvas;
|
|
592
|
+
let changed = false;
|
|
593
|
+
|
|
594
|
+
if (Number(canvas.width) !== nextBitmapWidth) {
|
|
595
|
+
canvas.width = nextBitmapWidth;
|
|
596
|
+
changed = true;
|
|
597
|
+
}
|
|
598
|
+
if (Number(canvas.height) !== nextBitmapHeight) {
|
|
599
|
+
canvas.height = nextBitmapHeight;
|
|
600
|
+
changed = true;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (options.updateStyleWidth && canvas.style?.width !== `${nextWidth}px`) {
|
|
604
|
+
canvas.style.width = `${nextWidth}px`;
|
|
605
|
+
changed = true;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (options.updateStyleHeight && canvas.style?.height !== `${nextHeight}px`) {
|
|
609
|
+
canvas.style.height = `${nextHeight}px`;
|
|
610
|
+
changed = true;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (options.updateContainerWidth && canvas.parentElement?.style?.width !== `${nextWidth}px`) {
|
|
614
|
+
canvas.parentElement.style.width = `${nextWidth}px`;
|
|
615
|
+
changed = true;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (options.updateContainerHeight && canvas.parentElement?.style?.height !== 'auto') {
|
|
619
|
+
canvas.parentElement.style.height = 'auto';
|
|
620
|
+
changed = true;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return changed;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
#syncHtmlCanvasAutoHeight(contentSize) {
|
|
627
|
+
if (this.#layoutMode !== 'width-constrained-auto-height') {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
if (!this.#surfaceBinding || this.#surfaceBinding.type !== 'html-canvas') {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const nextHeight = Math.max(1, Number(contentSize?.height) || 1);
|
|
635
|
+
const adopted = this.#syncHtmlCanvasBindingSize(this.#logicalWidth, nextHeight, {
|
|
636
|
+
updateStyleWidth: true,
|
|
637
|
+
updateStyleHeight: true,
|
|
638
|
+
updateContainerWidth: true,
|
|
639
|
+
updateContainerHeight: true,
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
if (!adopted && this.#logicalHeight === nextHeight) {
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
this.#logicalHeight = nextHeight;
|
|
647
|
+
this.#syncRawViewSize(this.#logicalWidth, nextHeight);
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
#physicalWidth() {
|
|
652
|
+
return Math.max(1, Math.round(this.#logicalWidth * this.#scaleFactor));
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
#physicalHeight(height = this.#logicalHeight) {
|
|
656
|
+
return Math.max(1, Math.round((Number(height) || 1) * this.#scaleFactor));
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
#syncRawViewSize(width = this.#logicalWidth, height = this.#logicalHeight) {
|
|
660
|
+
if (typeof this.#rawView.resize !== 'function') {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
this.#rawView.resize(
|
|
664
|
+
Math.max(1, Math.round((Number(width) || 1) * this.#scaleFactor)),
|
|
665
|
+
Math.max(1, Math.round((Number(height) || 1) * this.#scaleFactor)),
|
|
666
|
+
this.#scaleFactor,
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
#currentContentSize() {
|
|
671
|
+
if (
|
|
672
|
+
typeof this.#rawView.currentContentWidth !== 'function' ||
|
|
673
|
+
typeof this.#rawView.currentContentHeight !== 'function'
|
|
674
|
+
) {
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
const width = Number(this.#rawView.currentContentWidth());
|
|
678
|
+
const height = Number(this.#rawView.currentContentHeight());
|
|
679
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width < 0 || height < 0) {
|
|
680
|
+
return null;
|
|
681
|
+
}
|
|
682
|
+
return { width, height };
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
#consumeContentSizeChanged() {
|
|
686
|
+
if (typeof this.#rawView.consumeContentSizeChanged !== 'function') {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
if (!this.#rawView.consumeContentSizeChanged()) {
|
|
690
|
+
return false;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const contentSize = this.#currentContentSize();
|
|
694
|
+
if (!contentSize) {
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
this.#latestContentSize = contentSize;
|
|
698
|
+
this.#syncHtmlCanvasAutoHeight(contentSize);
|
|
699
|
+
if (typeof this.#onContentSizeChanged === 'function') {
|
|
700
|
+
this.#onContentSizeChanged(contentSize);
|
|
701
|
+
}
|
|
702
|
+
return true;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
#presentSurface() {
|
|
706
|
+
if (!this.#surfaceBinding || this.#surfaceBinding.type !== 'offscreen-canvas') {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
const { backingCanvas, targetCanvas } = this.#surfaceBinding;
|
|
711
|
+
const context = targetCanvas.getContext('2d');
|
|
712
|
+
if (
|
|
713
|
+
!context ||
|
|
714
|
+
typeof context.clearRect !== 'function' ||
|
|
715
|
+
typeof context.drawImage !== 'function'
|
|
716
|
+
) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (typeof context.save === 'function') {
|
|
721
|
+
context.save();
|
|
722
|
+
}
|
|
723
|
+
if (typeof context.setTransform === 'function') {
|
|
724
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
725
|
+
} else if (typeof context.resetTransform === 'function') {
|
|
726
|
+
context.resetTransform();
|
|
727
|
+
}
|
|
728
|
+
context.clearRect(0, 0, Number(targetCanvas.width) || 0, Number(targetCanvas.height) || 0);
|
|
729
|
+
context.drawImage(
|
|
730
|
+
backingCanvas,
|
|
731
|
+
0,
|
|
732
|
+
0,
|
|
733
|
+
Number(backingCanvas.width) || 0,
|
|
734
|
+
Number(backingCanvas.height) || 0,
|
|
735
|
+
0,
|
|
736
|
+
0,
|
|
737
|
+
Number(targetCanvas.width) || 0,
|
|
738
|
+
Number(targetCanvas.height) || 0,
|
|
739
|
+
);
|
|
740
|
+
if (typeof context.restore === 'function') {
|
|
741
|
+
context.restore();
|
|
742
|
+
}
|
|
413
743
|
}
|
|
414
744
|
|
|
415
745
|
#resetCloseRequestedState() {
|
|
@@ -435,16 +765,67 @@ export class InkView {
|
|
|
435
765
|
return true;
|
|
436
766
|
}
|
|
437
767
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
768
|
+
attachSurface(surface) {
|
|
769
|
+
const normalizedSurface = normalizeSurfaceDescriptor(surface);
|
|
770
|
+
if (!normalizedSurface) {
|
|
771
|
+
throw new TypeError('`surface` must be provided.');
|
|
441
772
|
}
|
|
442
773
|
|
|
443
|
-
|
|
444
|
-
|
|
774
|
+
if (normalizedSurface.type === 'html-canvas') {
|
|
775
|
+
this.#rawView.bindCanvas(normalizedSurface.canvas);
|
|
776
|
+
this.#surfaceBinding = {
|
|
777
|
+
type: 'html-canvas',
|
|
778
|
+
canvas: normalizedSurface.canvas,
|
|
779
|
+
};
|
|
780
|
+
this.#surface = normalizedSurface;
|
|
781
|
+
this.#canvas = normalizedSurface.canvas;
|
|
782
|
+
this.#syncRawViewSize();
|
|
783
|
+
if (this.#layoutMode === 'width-constrained-auto-height') {
|
|
784
|
+
this.#syncHtmlCanvasAutoHeight(this.#latestContentSize || { height: this.#logicalHeight });
|
|
785
|
+
}
|
|
786
|
+
return this;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const backingCanvas = createDomCanvas(this.#physicalWidth(), this.#physicalHeight());
|
|
790
|
+
this.#rawView.bindCanvas(backingCanvas);
|
|
791
|
+
this.#surfaceBinding = {
|
|
792
|
+
type: 'offscreen-canvas',
|
|
793
|
+
backingCanvas,
|
|
794
|
+
targetCanvas: normalizedSurface.canvas,
|
|
795
|
+
};
|
|
796
|
+
this.#surface = normalizedSurface;
|
|
797
|
+
this.#canvas = backingCanvas;
|
|
798
|
+
this.#syncRawViewSize();
|
|
799
|
+
this.#syncSurfaceBindingSize(this.#logicalWidth, this.#logicalHeight);
|
|
800
|
+
this.#presentSurface();
|
|
445
801
|
return this;
|
|
446
802
|
}
|
|
447
803
|
|
|
804
|
+
detachSurface(options = {}) {
|
|
805
|
+
if (!this.#surface && !this.#canvas) {
|
|
806
|
+
return this;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (options.clear !== false) {
|
|
810
|
+
this.#clearSurfaceContents();
|
|
811
|
+
}
|
|
812
|
+
if (typeof this.#rawView.clearSurface === 'function') {
|
|
813
|
+
this.#rawView.clearSurface();
|
|
814
|
+
}
|
|
815
|
+
this.#surfaceBinding = null;
|
|
816
|
+
this.#surface = null;
|
|
817
|
+
this.#canvas = null;
|
|
818
|
+
return this;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
getSurface() {
|
|
822
|
+
return cloneSurfaceDescriptor(this.#surface);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
bindCanvas(canvas) {
|
|
826
|
+
return this.attachSurface({ type: 'html-canvas', canvas });
|
|
827
|
+
}
|
|
828
|
+
|
|
448
829
|
bindDomEvents(options = {}) {
|
|
449
830
|
const canvas = options.canvas || this.#canvas;
|
|
450
831
|
if (!canvas) {
|
|
@@ -470,6 +851,16 @@ export class InkView {
|
|
|
470
851
|
focusTarget.setAttribute('tabindex', '0');
|
|
471
852
|
}
|
|
472
853
|
|
|
854
|
+
const scaleWheelDelta = (event) => {
|
|
855
|
+
const rect = canvas.getBoundingClientRect();
|
|
856
|
+
const scaleX = rect.width > 0 ? canvas.width / rect.width : this.#scaleFactor;
|
|
857
|
+
const scaleY = rect.height > 0 ? canvas.height / rect.height : this.#scaleFactor;
|
|
858
|
+
return {
|
|
859
|
+
deltaX: (event.deltaX || 0) * scaleX,
|
|
860
|
+
deltaY: (event.deltaY || 0) * scaleY,
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
|
|
473
864
|
addListener(canvas, 'pointerdown', (event) => {
|
|
474
865
|
const { x, y } = getPointerPosition(canvas, event);
|
|
475
866
|
this.notifyUserInteraction();
|
|
@@ -531,18 +922,11 @@ export class InkView {
|
|
|
531
922
|
'wheel',
|
|
532
923
|
(event) => {
|
|
533
924
|
const { x, y } = getPointerPosition(canvas, event);
|
|
925
|
+
const { deltaX, deltaY } = scaleWheelDelta(event);
|
|
534
926
|
if (options.preventWheelDefault !== false && typeof event.preventDefault === 'function') {
|
|
535
927
|
event.preventDefault();
|
|
536
928
|
}
|
|
537
|
-
this.#rawView.dispatchPointer(
|
|
538
|
-
'mousewheel',
|
|
539
|
-
x,
|
|
540
|
-
y,
|
|
541
|
-
0,
|
|
542
|
-
0,
|
|
543
|
-
event.deltaX || 0,
|
|
544
|
-
event.deltaY || 0,
|
|
545
|
-
);
|
|
929
|
+
this.#rawView.dispatchPointer('mousewheel', x, y, 0, 0, deltaX, deltaY);
|
|
546
930
|
this.requestRender();
|
|
547
931
|
},
|
|
548
932
|
{ passive: false },
|
|
@@ -640,7 +1024,67 @@ export class InkView {
|
|
|
640
1024
|
}
|
|
641
1025
|
|
|
642
1026
|
resize(width, height, scaleFactor = getDefaultScaleFactor()) {
|
|
643
|
-
|
|
1027
|
+
const nextWidth = Math.max(1, Number(width) || 1);
|
|
1028
|
+
const fallbackHeight =
|
|
1029
|
+
this.#layoutMode === 'width-constrained-auto-height'
|
|
1030
|
+
? this.#logicalHeight
|
|
1031
|
+
: this.#boundedHeight;
|
|
1032
|
+
const nextHeight = Math.max(1, Number(height) || fallbackHeight || 1);
|
|
1033
|
+
this.#logicalWidth = nextWidth;
|
|
1034
|
+
this.#logicalHeight = nextHeight;
|
|
1035
|
+
if (this.#layoutMode === 'bounded') {
|
|
1036
|
+
this.#boundedHeight = nextHeight;
|
|
1037
|
+
}
|
|
1038
|
+
this.#scaleFactor = Number(scaleFactor || getDefaultScaleFactor());
|
|
1039
|
+
this.#syncRawViewSize();
|
|
1040
|
+
if (this.#surfaceBinding?.type === 'html-canvas') {
|
|
1041
|
+
this.#syncHtmlCanvasBindingSize(this.#logicalWidth, this.#logicalHeight, {
|
|
1042
|
+
updateStyleWidth: true,
|
|
1043
|
+
updateStyleHeight: this.#layoutMode === 'width-constrained-auto-height',
|
|
1044
|
+
updateContainerWidth: true,
|
|
1045
|
+
updateContainerHeight: this.#layoutMode === 'width-constrained-auto-height',
|
|
1046
|
+
});
|
|
1047
|
+
} else {
|
|
1048
|
+
this.#syncSurfaceBindingSize(this.#logicalWidth, this.#logicalHeight);
|
|
1049
|
+
}
|
|
1050
|
+
this.#presentSurface();
|
|
1051
|
+
this.requestRender();
|
|
1052
|
+
return this;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
setLayoutMode(layoutMode) {
|
|
1056
|
+
const nextLayoutMode = normalizeLayoutMode(layoutMode);
|
|
1057
|
+
if (this.#layoutMode === nextLayoutMode) {
|
|
1058
|
+
return this;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const currentContentSize = this.#currentContentSize();
|
|
1062
|
+
this.#layoutMode = nextLayoutMode;
|
|
1063
|
+
this.#latestContentSize = currentContentSize;
|
|
1064
|
+
this.#rawView.setLayoutMode(nextLayoutMode);
|
|
1065
|
+
|
|
1066
|
+
if (nextLayoutMode === 'bounded') {
|
|
1067
|
+
this.#logicalHeight = this.#boundedHeight;
|
|
1068
|
+
this.#syncRawViewSize();
|
|
1069
|
+
if (this.#surfaceBinding?.type === 'html-canvas') {
|
|
1070
|
+
this.#syncHtmlCanvasBindingSize(this.#logicalWidth, this.#logicalHeight);
|
|
1071
|
+
} else {
|
|
1072
|
+
this.#syncSurfaceBindingSize(this.#logicalWidth, this.#logicalHeight);
|
|
1073
|
+
}
|
|
1074
|
+
} else if (currentContentSize) {
|
|
1075
|
+
this.#syncHtmlCanvasAutoHeight(currentContentSize);
|
|
1076
|
+
} else {
|
|
1077
|
+
this.#syncRawViewSize();
|
|
1078
|
+
if (this.#surfaceBinding?.type === 'html-canvas') {
|
|
1079
|
+
this.#syncHtmlCanvasBindingSize(this.#logicalWidth, this.#logicalHeight, {
|
|
1080
|
+
updateStyleWidth: true,
|
|
1081
|
+
updateStyleHeight: true,
|
|
1082
|
+
updateContainerWidth: true,
|
|
1083
|
+
updateContainerHeight: true,
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
644
1088
|
this.requestRender();
|
|
645
1089
|
return this;
|
|
646
1090
|
}
|
|
@@ -669,6 +1113,29 @@ export class InkView {
|
|
|
669
1113
|
return this;
|
|
670
1114
|
}
|
|
671
1115
|
|
|
1116
|
+
setHostLanguageModelConfig(config) {
|
|
1117
|
+
if (typeof this.#rawView.setLanguageModelConfig !== 'function') {
|
|
1118
|
+
return this;
|
|
1119
|
+
}
|
|
1120
|
+
const normalizedConfig = normalizeHostLanguageModelConfig(config);
|
|
1121
|
+
this.#rawView.setLanguageModelConfig(
|
|
1122
|
+
normalizedConfig == null ? null : JSON.stringify(normalizedConfig),
|
|
1123
|
+
);
|
|
1124
|
+
return this;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
dispatchPointer(eventType, x, y, id = 0, button = 0, deltaX = 0, deltaY = 0) {
|
|
1128
|
+
this.#rawView.dispatchPointer(eventType, x, y, id, button, deltaX, deltaY);
|
|
1129
|
+
this.requestRender();
|
|
1130
|
+
return this;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
dispatchInput(eventType, code, timestamp = Date.now()) {
|
|
1134
|
+
this.#rawView.dispatchInput(eventType, code, Number(timestamp));
|
|
1135
|
+
this.requestRender();
|
|
1136
|
+
return this;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
672
1139
|
dispatchMessageEvent(dataOrJson, origin = 'host', lastEventId = '') {
|
|
673
1140
|
const metadata = normalizeHostMessageMetadata(origin, lastEventId);
|
|
674
1141
|
this.#rawView.dispatchMessageEvent(
|
|
@@ -693,8 +1160,10 @@ export class InkView {
|
|
|
693
1160
|
return false;
|
|
694
1161
|
}
|
|
695
1162
|
const hasMoreWork = Boolean(this.#rawView.render());
|
|
1163
|
+
const contentSizeChanged = this.#consumeContentSizeChanged();
|
|
1164
|
+
this.#presentSurface();
|
|
696
1165
|
const closeRequested = this.#consumeCloseRequested();
|
|
697
|
-
if (!closeRequested && (hasMoreWork || this.#autoRender)) {
|
|
1166
|
+
if (!closeRequested && (hasMoreWork || contentSizeChanged || this.#autoRender)) {
|
|
698
1167
|
this.requestRender();
|
|
699
1168
|
}
|
|
700
1169
|
return !closeRequested && hasMoreWork;
|
|
@@ -737,14 +1206,52 @@ export class InkView {
|
|
|
737
1206
|
return !this.#closeRequested && Boolean(this.#rawView.isRunning());
|
|
738
1207
|
}
|
|
739
1208
|
|
|
1209
|
+
isDestroyed() {
|
|
1210
|
+
return this.#destroyed;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
isRendering() {
|
|
1214
|
+
return this.#autoRender;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
740
1217
|
setOnCloseRequested(callback) {
|
|
1218
|
+
if (callback != null && typeof callback !== 'function') {
|
|
1219
|
+
throw new TypeError('`callback` must be a function or null.');
|
|
1220
|
+
}
|
|
1221
|
+
this.onCloseRequested = callback || null;
|
|
1222
|
+
return this;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
get onCloseRequested() {
|
|
1226
|
+
return this.#onCloseRequested;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
set onCloseRequested(callback) {
|
|
741
1230
|
if (callback != null && typeof callback !== 'function') {
|
|
742
1231
|
throw new TypeError('`callback` must be a function or null.');
|
|
743
1232
|
}
|
|
744
1233
|
this.#onCloseRequested = callback || null;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
setOnContentSizeChanged(callback) {
|
|
1237
|
+
if (callback != null && typeof callback !== 'function') {
|
|
1238
|
+
throw new TypeError('`callback` must be a function or null.');
|
|
1239
|
+
}
|
|
1240
|
+
this.onContentSizeChanged = callback || null;
|
|
745
1241
|
return this;
|
|
746
1242
|
}
|
|
747
1243
|
|
|
1244
|
+
get onContentSizeChanged() {
|
|
1245
|
+
return this.#onContentSizeChanged;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
set onContentSizeChanged(callback) {
|
|
1249
|
+
if (callback != null && typeof callback !== 'function') {
|
|
1250
|
+
throw new TypeError('`callback` must be a function or null.');
|
|
1251
|
+
}
|
|
1252
|
+
this.#onContentSizeChanged = callback || null;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
748
1255
|
isCloseRequested() {
|
|
749
1256
|
return this.#closeRequested;
|
|
750
1257
|
}
|
|
@@ -755,9 +1262,18 @@ export class InkView {
|
|
|
755
1262
|
}
|
|
756
1263
|
this.#destroyed = true;
|
|
757
1264
|
this.stopRendering();
|
|
1265
|
+
if (this.#clearOnDestroy) {
|
|
1266
|
+
this.#clearSurfaceContents();
|
|
1267
|
+
}
|
|
758
1268
|
if (this.#domCleanup) {
|
|
759
1269
|
this.#domCleanup();
|
|
760
1270
|
}
|
|
1271
|
+
if (typeof this.#rawView.clearSurface === 'function') {
|
|
1272
|
+
this.#rawView.clearSurface();
|
|
1273
|
+
}
|
|
1274
|
+
this.#surfaceBinding = null;
|
|
1275
|
+
this.#surface = null;
|
|
1276
|
+
this.#canvas = null;
|
|
761
1277
|
this.#rawView.destroy();
|
|
762
1278
|
}
|
|
763
1279
|
}
|
package/package.json
CHANGED
package/pkg/ink_web.d.ts
CHANGED
|
@@ -14,8 +14,12 @@ export class InkWebView {
|
|
|
14
14
|
[Symbol.dispose](): void;
|
|
15
15
|
bindCanvas(canvas: HTMLCanvasElement): void;
|
|
16
16
|
blur(): void;
|
|
17
|
+
clearSurface(): void;
|
|
17
18
|
consumeCloseRequested(): boolean;
|
|
19
|
+
consumeContentSizeChanged(): boolean;
|
|
18
20
|
createMessageStream(origin: string, last_event_id: string): InkWebMessageStream;
|
|
21
|
+
currentContentHeight(): number;
|
|
22
|
+
currentContentWidth(): number;
|
|
19
23
|
destroy(): void;
|
|
20
24
|
dispatchInput(event_type: string, code: string, timestamp: number): void;
|
|
21
25
|
dispatchMessageEvent(payload_json: string, origin: string, last_event_id: string): void;
|
|
@@ -23,13 +27,15 @@ export class InkWebView {
|
|
|
23
27
|
focus(): void;
|
|
24
28
|
isInteractive(): boolean;
|
|
25
29
|
isRunning(): boolean;
|
|
26
|
-
constructor(width: number, height: number, scale_factor: number);
|
|
30
|
+
constructor(width: number, height: number, scale_factor: number, layout_mode: string);
|
|
27
31
|
notifyUserInteraction(): void;
|
|
28
32
|
open(path: string, initial_page?: string | null, query_json?: string | null): void;
|
|
29
33
|
openBundle(app_id: string, files: Map<any, any>, initial_page?: string | null, query_json?: string | null): void;
|
|
30
34
|
render(): boolean;
|
|
31
35
|
resize(width: number, height: number, scale_factor: number): void;
|
|
32
36
|
setInteractive(interactive: boolean): void;
|
|
37
|
+
setLanguageModelConfig(config_json?: string | null): void;
|
|
38
|
+
setLayoutMode(layout_mode: string): void;
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export function get_version(): string;
|
|
@@ -47,8 +53,12 @@ export interface InitOutput {
|
|
|
47
53
|
readonly inkwebmessagestream_write: (a: number, b: number, c: number, d: number) => void;
|
|
48
54
|
readonly inkwebview_bindCanvas: (a: number, b: number, c: number) => void;
|
|
49
55
|
readonly inkwebview_blur: (a: number) => void;
|
|
56
|
+
readonly inkwebview_clearSurface: (a: number) => void;
|
|
50
57
|
readonly inkwebview_consumeCloseRequested: (a: number) => number;
|
|
58
|
+
readonly inkwebview_consumeContentSizeChanged: (a: number) => number;
|
|
51
59
|
readonly inkwebview_createMessageStream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
60
|
+
readonly inkwebview_currentContentHeight: (a: number) => number;
|
|
61
|
+
readonly inkwebview_currentContentWidth: (a: number) => number;
|
|
52
62
|
readonly inkwebview_destroy: (a: number) => void;
|
|
53
63
|
readonly inkwebview_dispatchInput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
54
64
|
readonly inkwebview_dispatchMessageEvent: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
@@ -56,19 +66,21 @@ export interface InitOutput {
|
|
|
56
66
|
readonly inkwebview_focus: (a: number) => void;
|
|
57
67
|
readonly inkwebview_isInteractive: (a: number) => number;
|
|
58
68
|
readonly inkwebview_isRunning: (a: number) => number;
|
|
59
|
-
readonly inkwebview_new: (a: number, b: number, c: number) => number;
|
|
69
|
+
readonly inkwebview_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
60
70
|
readonly inkwebview_notifyUserInteraction: (a: number) => void;
|
|
61
71
|
readonly inkwebview_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
62
72
|
readonly inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
63
73
|
readonly inkwebview_render: (a: number, b: number) => void;
|
|
64
74
|
readonly inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
65
75
|
readonly inkwebview_setInteractive: (a: number, b: number) => void;
|
|
76
|
+
readonly inkwebview_setLanguageModelConfig: (a: number, b: number, c: number, d: number) => void;
|
|
77
|
+
readonly inkwebview_setLayoutMode: (a: number, b: number, c: number) => void;
|
|
66
78
|
readonly main: () => void;
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
69
|
-
readonly
|
|
70
|
-
readonly
|
|
71
|
-
readonly
|
|
79
|
+
readonly __wasm_bindgen_func_elem_9470: (a: number, b: number) => void;
|
|
80
|
+
readonly __wasm_bindgen_func_elem_13736: (a: number, b: number) => void;
|
|
81
|
+
readonly __wasm_bindgen_func_elem_9754: (a: number, b: number, c: number) => void;
|
|
82
|
+
readonly __wasm_bindgen_func_elem_13737: (a: number, b: number, c: number) => void;
|
|
83
|
+
readonly __wasm_bindgen_func_elem_9755: (a: number, b: number) => void;
|
|
72
84
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
73
85
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
74
86
|
readonly __wbindgen_export3: (a: number) => void;
|
package/pkg/ink_web.js
CHANGED
|
@@ -72,6 +72,9 @@ export class InkWebView {
|
|
|
72
72
|
blur() {
|
|
73
73
|
wasm.inkwebview_blur(this.__wbg_ptr);
|
|
74
74
|
}
|
|
75
|
+
clearSurface() {
|
|
76
|
+
wasm.inkwebview_clearSurface(this.__wbg_ptr);
|
|
77
|
+
}
|
|
75
78
|
/**
|
|
76
79
|
* @returns {boolean}
|
|
77
80
|
*/
|
|
@@ -79,6 +82,13 @@ export class InkWebView {
|
|
|
79
82
|
const ret = wasm.inkwebview_consumeCloseRequested(this.__wbg_ptr);
|
|
80
83
|
return ret !== 0;
|
|
81
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* @returns {boolean}
|
|
87
|
+
*/
|
|
88
|
+
consumeContentSizeChanged() {
|
|
89
|
+
const ret = wasm.inkwebview_consumeContentSizeChanged(this.__wbg_ptr);
|
|
90
|
+
return ret !== 0;
|
|
91
|
+
}
|
|
82
92
|
/**
|
|
83
93
|
* @param {string} origin
|
|
84
94
|
* @param {string} last_event_id
|
|
@@ -92,6 +102,20 @@ export class InkWebView {
|
|
|
92
102
|
const ret = wasm.inkwebview_createMessageStream(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
93
103
|
return InkWebMessageStream.__wrap(ret);
|
|
94
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* @returns {number}
|
|
107
|
+
*/
|
|
108
|
+
currentContentHeight() {
|
|
109
|
+
const ret = wasm.inkwebview_currentContentHeight(this.__wbg_ptr);
|
|
110
|
+
return ret;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @returns {number}
|
|
114
|
+
*/
|
|
115
|
+
currentContentWidth() {
|
|
116
|
+
const ret = wasm.inkwebview_currentContentWidth(this.__wbg_ptr);
|
|
117
|
+
return ret;
|
|
118
|
+
}
|
|
95
119
|
destroy() {
|
|
96
120
|
wasm.inkwebview_destroy(this.__wbg_ptr);
|
|
97
121
|
}
|
|
@@ -186,9 +210,12 @@ export class InkWebView {
|
|
|
186
210
|
* @param {number} width
|
|
187
211
|
* @param {number} height
|
|
188
212
|
* @param {number} scale_factor
|
|
213
|
+
* @param {string} layout_mode
|
|
189
214
|
*/
|
|
190
|
-
constructor(width, height, scale_factor) {
|
|
191
|
-
const
|
|
215
|
+
constructor(width, height, scale_factor, layout_mode) {
|
|
216
|
+
const ptr0 = passStringToWasm0(layout_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
218
|
+
const ret = wasm.inkwebview_new(width, height, scale_factor, ptr0, len0);
|
|
192
219
|
this.__wbg_ptr = ret >>> 0;
|
|
193
220
|
InkWebViewFinalization.register(this, this.__wbg_ptr, this);
|
|
194
221
|
return this;
|
|
@@ -277,6 +304,32 @@ export class InkWebView {
|
|
|
277
304
|
setInteractive(interactive) {
|
|
278
305
|
wasm.inkwebview_setInteractive(this.__wbg_ptr, interactive);
|
|
279
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* @param {string | null} [config_json]
|
|
309
|
+
*/
|
|
310
|
+
setLanguageModelConfig(config_json) {
|
|
311
|
+
try {
|
|
312
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
313
|
+
var ptr0 = isLikeNone(config_json) ? 0 : passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
314
|
+
var len0 = WASM_VECTOR_LEN;
|
|
315
|
+
wasm.inkwebview_setLanguageModelConfig(retptr, this.__wbg_ptr, ptr0, len0);
|
|
316
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
317
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
318
|
+
if (r1) {
|
|
319
|
+
throw takeObject(r0);
|
|
320
|
+
}
|
|
321
|
+
} finally {
|
|
322
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @param {string} layout_mode
|
|
327
|
+
*/
|
|
328
|
+
setLayoutMode(layout_mode) {
|
|
329
|
+
const ptr0 = passStringToWasm0(layout_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
331
|
+
wasm.inkwebview_setLayoutMode(this.__wbg_ptr, ptr0, len0);
|
|
332
|
+
}
|
|
280
333
|
}
|
|
281
334
|
if (Symbol.dispose) InkWebView.prototype[Symbol.dispose] = InkWebView.prototype.free;
|
|
282
335
|
|
|
@@ -1094,28 +1147,28 @@ function __wbg_get_imports() {
|
|
|
1094
1147
|
return ret;
|
|
1095
1148
|
},
|
|
1096
1149
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1097
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1098
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1150
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1151
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1099
1152
|
return addHeapObject(ret);
|
|
1100
1153
|
},
|
|
1101
1154
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1102
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1103
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1155
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("Event")], shim_idx: 2523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1156
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1104
1157
|
return addHeapObject(ret);
|
|
1105
1158
|
},
|
|
1106
1159
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1107
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1108
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1160
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1161
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1109
1162
|
return addHeapObject(ret);
|
|
1110
1163
|
},
|
|
1111
1164
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1112
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1113
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1165
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [], shim_idx: 2527, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1166
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9755);
|
|
1114
1167
|
return addHeapObject(ret);
|
|
1115
1168
|
},
|
|
1116
1169
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1117
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1118
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1170
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3491, function: Function { arguments: [Externref], shim_idx: 3492, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1171
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_13736, __wasm_bindgen_func_elem_13737);
|
|
1119
1172
|
return addHeapObject(ret);
|
|
1120
1173
|
},
|
|
1121
1174
|
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
@@ -1172,16 +1225,16 @@ function __wbg_get_imports() {
|
|
|
1172
1225
|
};
|
|
1173
1226
|
}
|
|
1174
1227
|
|
|
1175
|
-
function
|
|
1176
|
-
wasm.
|
|
1228
|
+
function __wasm_bindgen_func_elem_9755(arg0, arg1) {
|
|
1229
|
+
wasm.__wasm_bindgen_func_elem_9755(arg0, arg1);
|
|
1177
1230
|
}
|
|
1178
1231
|
|
|
1179
|
-
function
|
|
1180
|
-
wasm.
|
|
1232
|
+
function __wasm_bindgen_func_elem_9754(arg0, arg1, arg2) {
|
|
1233
|
+
wasm.__wasm_bindgen_func_elem_9754(arg0, arg1, addHeapObject(arg2));
|
|
1181
1234
|
}
|
|
1182
1235
|
|
|
1183
|
-
function
|
|
1184
|
-
wasm.
|
|
1236
|
+
function __wasm_bindgen_func_elem_13737(arg0, arg1, arg2) {
|
|
1237
|
+
wasm.__wasm_bindgen_func_elem_13737(arg0, arg1, addHeapObject(arg2));
|
|
1185
1238
|
}
|
|
1186
1239
|
|
|
1187
1240
|
|
package/pkg/ink_web_bg.wasm
CHANGED
|
Binary file
|
package/pkg/ink_web_bg.wasm.d.ts
CHANGED
|
@@ -8,8 +8,12 @@ export const inkwebmessagestream_close: (a: number) => void;
|
|
|
8
8
|
export const inkwebmessagestream_write: (a: number, b: number, c: number, d: number) => void;
|
|
9
9
|
export const inkwebview_bindCanvas: (a: number, b: number, c: number) => void;
|
|
10
10
|
export const inkwebview_blur: (a: number) => void;
|
|
11
|
+
export const inkwebview_clearSurface: (a: number) => void;
|
|
11
12
|
export const inkwebview_consumeCloseRequested: (a: number) => number;
|
|
13
|
+
export const inkwebview_consumeContentSizeChanged: (a: number) => number;
|
|
12
14
|
export const inkwebview_createMessageStream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
15
|
+
export const inkwebview_currentContentHeight: (a: number) => number;
|
|
16
|
+
export const inkwebview_currentContentWidth: (a: number) => number;
|
|
13
17
|
export const inkwebview_destroy: (a: number) => void;
|
|
14
18
|
export const inkwebview_dispatchInput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
15
19
|
export const inkwebview_dispatchMessageEvent: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
@@ -17,19 +21,21 @@ export const inkwebview_dispatchPointer: (a: number, b: number, c: number, d: nu
|
|
|
17
21
|
export const inkwebview_focus: (a: number) => void;
|
|
18
22
|
export const inkwebview_isInteractive: (a: number) => number;
|
|
19
23
|
export const inkwebview_isRunning: (a: number) => number;
|
|
20
|
-
export const inkwebview_new: (a: number, b: number, c: number) => number;
|
|
24
|
+
export const inkwebview_new: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
21
25
|
export const inkwebview_notifyUserInteraction: (a: number) => void;
|
|
22
26
|
export const inkwebview_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
23
27
|
export const inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
24
28
|
export const inkwebview_render: (a: number, b: number) => void;
|
|
25
29
|
export const inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
26
30
|
export const inkwebview_setInteractive: (a: number, b: number) => void;
|
|
31
|
+
export const inkwebview_setLanguageModelConfig: (a: number, b: number, c: number, d: number) => void;
|
|
32
|
+
export const inkwebview_setLayoutMode: (a: number, b: number, c: number) => void;
|
|
27
33
|
export const main: () => void;
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
34
|
+
export const __wasm_bindgen_func_elem_9470: (a: number, b: number) => void;
|
|
35
|
+
export const __wasm_bindgen_func_elem_13736: (a: number, b: number) => void;
|
|
36
|
+
export const __wasm_bindgen_func_elem_9754: (a: number, b: number, c: number) => void;
|
|
37
|
+
export const __wasm_bindgen_func_elem_13737: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const __wasm_bindgen_func_elem_9755: (a: number, b: number) => void;
|
|
33
39
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
34
40
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
35
41
|
export const __wbindgen_export3: (a: number) => void;
|