@yodaos-pkg/ink 0.3.0 → 0.6.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 → env.js} +12 -14
- package/index.d.ts +365 -0
- package/{dist/index.js → index.js} +9 -0
- package/package.json +11 -15
- package/{dist/pkg → pkg}/ink_web.d.ts +9 -5
- package/{dist/pkg → pkg}/ink_web.js +29 -16
- package/{dist/pkg → pkg}/ink_web_bg.wasm +0 -0
- package/{dist/pkg → pkg}/ink_web_bg.wasm.d.ts +7 -5
- package/dist/README.md +0 -724
- package/dist/index.d.ts +0 -166
- package/dist/package.json +0 -20
- package/dist/pkg/README.md +0 -34
- package/dist/pkg/package.json +0 -3
package/{dist/env.js → env.js}
RENAMED
|
@@ -323,13 +323,10 @@ function createVaListReader(argsPtr) {
|
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
function formatInteger(
|
|
327
|
-
|
|
328
|
-
base = 10,
|
|
329
|
-
|
|
330
|
-
padZero = false,
|
|
331
|
-
uppercase = false,
|
|
332
|
-
} = {}) {
|
|
326
|
+
function formatInteger(
|
|
327
|
+
value,
|
|
328
|
+
{ signed = true, base = 10, width = 0, padZero = false, uppercase = false } = {},
|
|
329
|
+
) {
|
|
333
330
|
let normalized = normalizePrintfValue(value);
|
|
334
331
|
let negative = false;
|
|
335
332
|
let digits = '';
|
|
@@ -358,13 +355,12 @@ function formatInteger(value, {
|
|
|
358
355
|
}
|
|
359
356
|
|
|
360
357
|
const prefix = negative ? '-' : '';
|
|
361
|
-
const paddedDigits =
|
|
362
|
-
|
|
363
|
-
|
|
358
|
+
const paddedDigits =
|
|
359
|
+
padZero && width > prefix.length + digits.length
|
|
360
|
+
? digits.padStart(width - prefix.length, '0')
|
|
361
|
+
: digits;
|
|
364
362
|
const result = `${prefix}${paddedDigits}`;
|
|
365
|
-
return !padZero && width > result.length
|
|
366
|
-
? result.padStart(width, ' ')
|
|
367
|
-
: result;
|
|
363
|
+
return !padZero && width > result.length ? result.padStart(width, ' ') : result;
|
|
368
364
|
}
|
|
369
365
|
|
|
370
366
|
function formatStringValue(value, precision) {
|
|
@@ -564,7 +560,9 @@ export function vsnprintf(dst, size, fmtPtr, argsPtr) {
|
|
|
564
560
|
}
|
|
565
561
|
|
|
566
562
|
export function snprintf(dst, size, fmtPtr) {
|
|
567
|
-
return
|
|
563
|
+
return (
|
|
564
|
+
writeCString(dst, size, formatPrintf(fmtPtr, createDirectArgumentReader(arguments, 3))) | 0
|
|
565
|
+
);
|
|
568
566
|
}
|
|
569
567
|
|
|
570
568
|
export function scalbn(x, n) {
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single bundle file payload accepted by the browser SDK.
|
|
3
|
+
*
|
|
4
|
+
* String values are encoded as UTF-8 text. Typed arrays and array buffers are
|
|
5
|
+
* forwarded as binary file contents without additional transformation.
|
|
6
|
+
*/
|
|
7
|
+
export type BundleFileInput = string | Uint8Array | ArrayBuffer | ArrayBufferView;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A normalized bundle file collection accepted by bundle-loading helpers.
|
|
11
|
+
*
|
|
12
|
+
* File paths are repository-style relative paths inside the app bundle, such as
|
|
13
|
+
* `app.json`, `pages/home/index.js`, or `assets/logo.png`.
|
|
14
|
+
*/
|
|
15
|
+
export type BundleFiles =
|
|
16
|
+
| Map<string, BundleFileInput>
|
|
17
|
+
| Array<[string, BundleFileInput]>
|
|
18
|
+
| Record<string, BundleFileInput>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Shared initialization options used when the browser SDK needs to bootstrap
|
|
22
|
+
* the Ink WebAssembly runtime.
|
|
23
|
+
*/
|
|
24
|
+
export interface InitInkOptions {
|
|
25
|
+
/** Explicit URL for the Ink WebAssembly binary. */
|
|
26
|
+
wasmUrl?: string | URL | Request;
|
|
27
|
+
/** Preloaded module or alternative module source accepted by the wasm loader. */
|
|
28
|
+
moduleOrPath?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
29
|
+
/** Optional proxy endpoint used by Ink's network compatibility layer. */
|
|
30
|
+
proxyUrl?: string;
|
|
31
|
+
/** Query parameter name that carries the original target URL when proxying. */
|
|
32
|
+
targetSearchParam?: string;
|
|
33
|
+
/** Request interceptor applied to compatibility-layer network requests. */
|
|
34
|
+
requestInterceptor?: InkRequestInterceptor;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Options used to construct a browser-side {@link InkView}.
|
|
39
|
+
*/
|
|
40
|
+
export interface CreateInkViewOptions {
|
|
41
|
+
/** Initial logical width in CSS pixels. */
|
|
42
|
+
width: number;
|
|
43
|
+
/** Initial logical height in CSS pixels. */
|
|
44
|
+
height: number;
|
|
45
|
+
/** Device pixel ratio override. Defaults to `window.devicePixelRatio` when available. */
|
|
46
|
+
scaleFactor?: number;
|
|
47
|
+
/** Optional canvas to bind immediately after creation. */
|
|
48
|
+
canvas?: HTMLCanvasElement;
|
|
49
|
+
/** Optional wasm bootstrap overrides. */
|
|
50
|
+
wasm?: InitInkOptions;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Opens an in-memory Ink app bundle that is already available in the host.
|
|
55
|
+
*/
|
|
56
|
+
export interface OpenBundleOptions {
|
|
57
|
+
/** Stable application identifier used by the runtime. */
|
|
58
|
+
appId: string;
|
|
59
|
+
/** Bundle file map or file list. */
|
|
60
|
+
files: BundleFiles;
|
|
61
|
+
/** Optional initial page route. */
|
|
62
|
+
initialPage?: string | null;
|
|
63
|
+
/** Optional launch query string or structured query object. */
|
|
64
|
+
query?: string | Record<string, unknown> | null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Base options for loading a bundle from a VFS-style HTTP endpoint.
|
|
69
|
+
*/
|
|
70
|
+
export interface LoadBundleFromVfsOptions {
|
|
71
|
+
/** Stable application identifier used by the runtime. */
|
|
72
|
+
appId: string;
|
|
73
|
+
/** Base URL that serves `manifest.json` and bundle files. */
|
|
74
|
+
baseUrl: string;
|
|
75
|
+
/** Optional fetch implementation override. */
|
|
76
|
+
fetch?: typeof globalThis.fetch;
|
|
77
|
+
/** Abort signal used while downloading the bundle. */
|
|
78
|
+
signal?: AbortSignal;
|
|
79
|
+
/** Additional request headers sent to the VFS host. */
|
|
80
|
+
headers?: HeadersInit;
|
|
81
|
+
/** Request interceptor applied to bundle download requests. */
|
|
82
|
+
requestInterceptor?: InkRequestInterceptor;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Loads a bundle from VFS and opens it immediately in the target view.
|
|
87
|
+
*/
|
|
88
|
+
export interface OpenFromVfsOptions extends LoadBundleFromVfsOptions {
|
|
89
|
+
/** Optional initial page route. */
|
|
90
|
+
initialPage?: string | null;
|
|
91
|
+
/** Optional launch query string or structured query object. */
|
|
92
|
+
query?: string | Record<string, unknown> | null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Normalized request data passed to an {@link InkRequestInterceptor}.
|
|
97
|
+
*/
|
|
98
|
+
export interface InkInterceptedRequest {
|
|
99
|
+
url: string;
|
|
100
|
+
method: string;
|
|
101
|
+
headers: Record<string, string>;
|
|
102
|
+
body: BodyInit | ArrayBuffer | ArrayBufferView | Uint8Array | null;
|
|
103
|
+
metadata: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The action returned from an {@link InkRequestInterceptor}.
|
|
108
|
+
*/
|
|
109
|
+
export type InkInterceptedRequestAction =
|
|
110
|
+
| { action?: 'continue' }
|
|
111
|
+
| {
|
|
112
|
+
action: 'rewrite';
|
|
113
|
+
url?: string;
|
|
114
|
+
method?: string;
|
|
115
|
+
headers?: HeadersInit | Record<string, string>;
|
|
116
|
+
body?: BodyInit | ArrayBuffer | ArrayBufferView | Uint8Array | null;
|
|
117
|
+
}
|
|
118
|
+
| {
|
|
119
|
+
action: 'block';
|
|
120
|
+
reason?: string;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type InkRequestInterceptor = (
|
|
124
|
+
request: InkInterceptedRequest,
|
|
125
|
+
) => InkInterceptedRequestAction | Promise<InkInterceptedRequestAction>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Applies global network compatibility configuration for the browser SDK.
|
|
129
|
+
*/
|
|
130
|
+
export interface ConfigureNetworkOptions {
|
|
131
|
+
proxyUrl?: string;
|
|
132
|
+
targetSearchParam?: string;
|
|
133
|
+
interceptor?: InkRequestInterceptor;
|
|
134
|
+
clear?: boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Single file entry inside a VFS manifest. */
|
|
138
|
+
export interface VfsManifestEntry {
|
|
139
|
+
path: string;
|
|
140
|
+
size?: number;
|
|
141
|
+
contentType?: string;
|
|
142
|
+
etag?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Manifest payload returned by a VFS host. */
|
|
146
|
+
export interface VfsManifest {
|
|
147
|
+
appId: string;
|
|
148
|
+
files: VfsManifestEntry[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Fully downloaded bundle returned by {@link loadBundleFromVfs}. */
|
|
152
|
+
export interface LoadedVfsBundle {
|
|
153
|
+
appId: string;
|
|
154
|
+
manifest: VfsManifest;
|
|
155
|
+
files: Map<string, Uint8Array>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Customizes DOM event binding behavior for {@link InkView.bindDomEvents}.
|
|
160
|
+
*/
|
|
161
|
+
export interface BindDomEventsOptions {
|
|
162
|
+
/** Canvas used for pointer and wheel event binding. Defaults to the currently bound canvas. */
|
|
163
|
+
canvas?: HTMLCanvasElement;
|
|
164
|
+
/** Keyboard event target, typically `window`, `document`, or a focusable element. */
|
|
165
|
+
keyboardTarget?: EventTarget | null;
|
|
166
|
+
/** Element that should receive focus/blur synchronization for the Ink instance. */
|
|
167
|
+
focusTarget?: HTMLElement | HTMLCanvasElement | null;
|
|
168
|
+
/** Whether wheel events should call `preventDefault()` before forwarding. */
|
|
169
|
+
preventWheelDefault?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Initializes the browser SDK and ensures the wasm runtime is ready to create
|
|
174
|
+
* views. Most applications can use {@link InkView.create} or
|
|
175
|
+
* {@link createInkView} directly, which call this lazily when needed.
|
|
176
|
+
*/
|
|
177
|
+
export declare function initInk(options?: InitInkOptions): Promise<{
|
|
178
|
+
InkWebView: unknown;
|
|
179
|
+
getInkVersion: () => string;
|
|
180
|
+
}>;
|
|
181
|
+
|
|
182
|
+
/** Returns the Ink runtime version string exported by the wasm module. */
|
|
183
|
+
export declare function getInkVersion(): string;
|
|
184
|
+
|
|
185
|
+
/** Normalizes supported bundle file inputs into a UTF-8 / binary file map. */
|
|
186
|
+
export declare function normalizeBundleFiles(files: BundleFiles): Map<string, Uint8Array>;
|
|
187
|
+
|
|
188
|
+
/** Serializes a launch query into the format expected by the Ink runtime. */
|
|
189
|
+
export declare function serializeQuery(
|
|
190
|
+
query: string | Record<string, unknown> | null | undefined,
|
|
191
|
+
): string | null;
|
|
192
|
+
|
|
193
|
+
/** Creates an interceptor that rewrites requests through a proxy endpoint. */
|
|
194
|
+
export declare function createProxyUrlResolver(options: {
|
|
195
|
+
proxyUrl: string;
|
|
196
|
+
targetSearchParam?: string;
|
|
197
|
+
}): InkRequestInterceptor;
|
|
198
|
+
|
|
199
|
+
/** Registers the global request interceptor used by browser compatibility networking. */
|
|
200
|
+
export declare function setInkRequestInterceptor(
|
|
201
|
+
interceptor: InkRequestInterceptor | null | undefined,
|
|
202
|
+
): void;
|
|
203
|
+
|
|
204
|
+
/** Clears the global request interceptor. */
|
|
205
|
+
export declare function clearInkRequestInterceptor(): void;
|
|
206
|
+
|
|
207
|
+
/** Applies global browser compatibility network settings. */
|
|
208
|
+
export declare function configureNetwork(options?: ConfigureNetworkOptions): void;
|
|
209
|
+
|
|
210
|
+
/** Creates manifest and file URLs for a VFS-served bundle. */
|
|
211
|
+
export declare function createVfsUrls(input: { baseUrl: string; appId: string }): {
|
|
212
|
+
manifestUrl: string;
|
|
213
|
+
fileUrl(filePath: string): string;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/** Downloads and materializes a VFS bundle into memory without opening it. */
|
|
217
|
+
export declare function loadBundleFromVfs(
|
|
218
|
+
options: LoadBundleFromVfsOptions,
|
|
219
|
+
): Promise<LoadedVfsBundle>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Browser host wrapper around the wasm `InkWebView`.
|
|
223
|
+
*
|
|
224
|
+
* `InkView` owns the runtime instance, optional canvas binding, DOM event
|
|
225
|
+
* forwarding, and render loop orchestration for one Ink application surface.
|
|
226
|
+
* A typical flow is:
|
|
227
|
+
*
|
|
228
|
+
* 1. Create a view with {@link InkView.create}.
|
|
229
|
+
* 2. Bind a canvas and DOM events if needed.
|
|
230
|
+
* 3. Open an in-memory bundle or load one from VFS.
|
|
231
|
+
* 4. Render manually with {@link render} or start the internal loop with
|
|
232
|
+
* {@link startRendering}.
|
|
233
|
+
* 5. Dispose the view with {@link destroy} when the host is done.
|
|
234
|
+
*/
|
|
235
|
+
export declare class InkView {
|
|
236
|
+
/**
|
|
237
|
+
* Creates a browser-side Ink view and bootstraps the wasm runtime if needed.
|
|
238
|
+
*
|
|
239
|
+
* If `options.canvas` is provided, the canvas is bound immediately. The view
|
|
240
|
+
* is created without opening an app bundle; call {@link openBundle} or
|
|
241
|
+
* {@link openFromVfs} afterwards.
|
|
242
|
+
*/
|
|
243
|
+
static create(options: CreateInkViewOptions): Promise<InkView>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Binds or rebinds the canvas used for drawing the current view.
|
|
247
|
+
*
|
|
248
|
+
* Rebinding is useful when the host recreates a canvas element while keeping
|
|
249
|
+
* the same Ink runtime instance alive.
|
|
250
|
+
*/
|
|
251
|
+
bindCanvas(canvas: HTMLCanvasElement): this;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Registers the common DOM event bridges used by Ink in the browser.
|
|
255
|
+
*
|
|
256
|
+
* This helper wires pointer, wheel, keyboard, and focus/blur forwarding to
|
|
257
|
+
* the underlying wasm view. It returns an unbind function that should be
|
|
258
|
+
* called before replacing the canvas, removing the host element, or
|
|
259
|
+
* destroying the view.
|
|
260
|
+
*/
|
|
261
|
+
bindDomEvents(options?: BindDomEventsOptions): () => void;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Opens an already-materialized application bundle.
|
|
265
|
+
*
|
|
266
|
+
* The bundle is normalized in memory and passed directly to the runtime. This
|
|
267
|
+
* call returns the current view for chaining.
|
|
268
|
+
*/
|
|
269
|
+
openBundle(options: OpenBundleOptions): this;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Downloads a bundle from a VFS host and opens it in the current view.
|
|
273
|
+
*
|
|
274
|
+
* The returned promise resolves with the downloaded bundle payload after the
|
|
275
|
+
* app has been opened successfully.
|
|
276
|
+
*/
|
|
277
|
+
openFromVfs(options: OpenFromVfsOptions): Promise<LoadedVfsBundle>;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Resizes the logical surface and optionally updates the scale factor.
|
|
281
|
+
*
|
|
282
|
+
* Hosts should call this whenever the canvas size or device pixel ratio
|
|
283
|
+
* changes.
|
|
284
|
+
*/
|
|
285
|
+
resize(width: number, height: number, scaleFactor?: number): this;
|
|
286
|
+
|
|
287
|
+
/** Forwards a host focus event so the Ink instance can accept focus-dependent input. */
|
|
288
|
+
focus(): this;
|
|
289
|
+
|
|
290
|
+
/** Forwards a host blur event so the Ink instance stops behaving as focused. */
|
|
291
|
+
blur(): this;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Controls whether this view currently accepts interaction-gated work.
|
|
295
|
+
*
|
|
296
|
+
* When set to `false`, keyboard events and voice wakeup are dropped before
|
|
297
|
+
* reaching the runtime, and new interaction-gated capabilities fail fast.
|
|
298
|
+
* This includes recording, speech recognition, photo capture, and Bluetooth
|
|
299
|
+
* `requestDevice()`, `scanDevices()`, `connect()`, and
|
|
300
|
+
* `startNotifications()`.
|
|
301
|
+
*
|
|
302
|
+
* Existing active sessions are not force-stopped by this toggle.
|
|
303
|
+
*/
|
|
304
|
+
setInteractive(interactive: boolean): this;
|
|
305
|
+
|
|
306
|
+
/** Returns the current host-visible interactive flag for this view. */
|
|
307
|
+
isInteractive(): boolean;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Notifies the runtime that the host has observed a trusted user interaction.
|
|
311
|
+
*
|
|
312
|
+
* This is useful in browser environments where some APIs require a recent
|
|
313
|
+
* user gesture signal.
|
|
314
|
+
*/
|
|
315
|
+
notifyUserInteraction(): this;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Performs one render pass immediately.
|
|
319
|
+
*
|
|
320
|
+
* Returns `true` when the frame produced visible work and `false` when
|
|
321
|
+
* nothing needed to be drawn.
|
|
322
|
+
*/
|
|
323
|
+
render(): boolean;
|
|
324
|
+
|
|
325
|
+
/** Marks the view as needing another frame on the next render opportunity. */
|
|
326
|
+
requestRender(): this;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Starts the internal animation/render loop.
|
|
330
|
+
*
|
|
331
|
+
* Use this when the host wants Ink to schedule frames automatically with
|
|
332
|
+
* `requestAnimationFrame`.
|
|
333
|
+
*/
|
|
334
|
+
startRendering(): this;
|
|
335
|
+
|
|
336
|
+
/** Stops the internal animation/render loop started by {@link startRendering}. */
|
|
337
|
+
stopRendering(): this;
|
|
338
|
+
|
|
339
|
+
/** Returns whether the internal render loop is currently active. */
|
|
340
|
+
isRunning(): boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Releases the underlying wasm view and detaches associated host resources.
|
|
344
|
+
*
|
|
345
|
+
* Hosts should unbind DOM events before calling this if they previously used
|
|
346
|
+
* {@link bindDomEvents}.
|
|
347
|
+
*/
|
|
348
|
+
destroy(): void;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Convenience factory equivalent to {@link InkView.create}. */
|
|
352
|
+
export declare function createInkView(options: CreateInkViewOptions): Promise<InkView>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Creates the small helper set consumed by framework integrations and adapters.
|
|
356
|
+
*/
|
|
357
|
+
export declare function createFrameworkBindings(): {
|
|
358
|
+
ensureLeadingSlash(path: string): string;
|
|
359
|
+
initInk: typeof initInk;
|
|
360
|
+
createInkView: typeof createInkView;
|
|
361
|
+
configureNetwork: typeof configureNetwork;
|
|
362
|
+
setInkRequestInterceptor: typeof setInkRequestInterceptor;
|
|
363
|
+
clearInkRequestInterceptor: typeof clearInkRequestInterceptor;
|
|
364
|
+
createProxyUrlResolver: typeof createProxyUrlResolver;
|
|
365
|
+
};
|
|
@@ -546,6 +546,15 @@ export class InkView {
|
|
|
546
546
|
return this;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
setInteractive(interactive) {
|
|
550
|
+
this.#rawView.setInteractive(Boolean(interactive));
|
|
551
|
+
return this;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
isInteractive() {
|
|
555
|
+
return Boolean(this.#rawView.isInteractive());
|
|
556
|
+
}
|
|
557
|
+
|
|
549
558
|
notifyUserInteraction() {
|
|
550
559
|
this.#rawView.notifyUserInteraction();
|
|
551
560
|
return this;
|
package/package.json
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yodaos-pkg/ink",
|
|
3
|
-
"version": "0.3.0",
|
|
4
3
|
"description": "Ink Web SDK for browser rendering and VFS-backed app loading",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist/"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "node scripts/build.js",
|
|
13
|
-
"test": "npm run build && node --test test/**/*.test.js"
|
|
14
|
-
},
|
|
15
4
|
"repository": {
|
|
16
5
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/jsar-project/ink"
|
|
6
|
+
"url": "git+https://github.com/jsar-project/ink.git"
|
|
18
7
|
},
|
|
8
|
+
"license": "Apache-2.0",
|
|
19
9
|
"publishConfig": {
|
|
20
10
|
"access": "public",
|
|
21
|
-
"registry": "https://registry.npmjs.
|
|
11
|
+
"registry": "https://registry.npmjs.com/"
|
|
22
12
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
13
|
+
"version": "0.6.0",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "index.js",
|
|
16
|
+
"types": "index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -10,12 +10,14 @@ export class InkWebView {
|
|
|
10
10
|
dispatchInput(event_type: string, code: string, timestamp: number): void;
|
|
11
11
|
dispatchPointer(event_type: string, x: number, y: number, id: number, button: number, delta_x: number, delta_y: number): void;
|
|
12
12
|
focus(): void;
|
|
13
|
+
isInteractive(): boolean;
|
|
13
14
|
isRunning(): boolean;
|
|
14
15
|
constructor(width: number, height: number, scale_factor: number);
|
|
15
16
|
notifyUserInteraction(): void;
|
|
16
17
|
openBundle(app_id: string, files: Map<any, any>, initial_page?: string | null, query_json?: string | null): void;
|
|
17
18
|
render(): boolean;
|
|
18
19
|
resize(width: number, height: number, scale_factor: number): void;
|
|
20
|
+
setInteractive(interactive: boolean): void;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export function get_version(): string;
|
|
@@ -34,18 +36,20 @@ export interface InitOutput {
|
|
|
34
36
|
readonly inkwebview_dispatchInput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
35
37
|
readonly inkwebview_dispatchPointer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
36
38
|
readonly inkwebview_focus: (a: number) => void;
|
|
39
|
+
readonly inkwebview_isInteractive: (a: number) => number;
|
|
37
40
|
readonly inkwebview_isRunning: (a: number) => number;
|
|
38
41
|
readonly inkwebview_new: (a: number, b: number, c: number) => number;
|
|
39
42
|
readonly inkwebview_notifyUserInteraction: (a: number) => void;
|
|
40
43
|
readonly inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
41
44
|
readonly inkwebview_render: (a: number, b: number) => void;
|
|
42
45
|
readonly inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
46
|
+
readonly inkwebview_setInteractive: (a: number, b: number) => void;
|
|
43
47
|
readonly main: () => void;
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
48
|
+
readonly __wasm_bindgen_func_elem_9121: (a: number, b: number) => void;
|
|
49
|
+
readonly __wasm_bindgen_func_elem_13334: (a: number, b: number) => void;
|
|
50
|
+
readonly __wasm_bindgen_func_elem_9385: (a: number, b: number, c: number) => void;
|
|
51
|
+
readonly __wasm_bindgen_func_elem_13335: (a: number, b: number, c: number) => void;
|
|
52
|
+
readonly __wasm_bindgen_func_elem_9383: (a: number, b: number) => void;
|
|
49
53
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
50
54
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
51
55
|
readonly __wbindgen_export3: (a: number) => void;
|
|
@@ -82,6 +82,13 @@ export class InkWebView {
|
|
|
82
82
|
focus() {
|
|
83
83
|
wasm.inkwebview_focus(this.__wbg_ptr);
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* @returns {boolean}
|
|
87
|
+
*/
|
|
88
|
+
isInteractive() {
|
|
89
|
+
const ret = wasm.inkwebview_isInteractive(this.__wbg_ptr);
|
|
90
|
+
return ret !== 0;
|
|
91
|
+
}
|
|
85
92
|
/**
|
|
86
93
|
* @returns {boolean}
|
|
87
94
|
*/
|
|
@@ -154,6 +161,12 @@ export class InkWebView {
|
|
|
154
161
|
resize(width, height, scale_factor) {
|
|
155
162
|
wasm.inkwebview_resize(this.__wbg_ptr, width, height, scale_factor);
|
|
156
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* @param {boolean} interactive
|
|
166
|
+
*/
|
|
167
|
+
setInteractive(interactive) {
|
|
168
|
+
wasm.inkwebview_setInteractive(this.__wbg_ptr, interactive);
|
|
169
|
+
}
|
|
157
170
|
}
|
|
158
171
|
if (Symbol.dispose) InkWebView.prototype[Symbol.dispose] = InkWebView.prototype.free;
|
|
159
172
|
|
|
@@ -967,28 +980,28 @@ function __wbg_get_imports() {
|
|
|
967
980
|
return ret;
|
|
968
981
|
},
|
|
969
982
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
970
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
971
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
983
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2469, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2402, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
984
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9121, __wasm_bindgen_func_elem_9385);
|
|
972
985
|
return addHeapObject(ret);
|
|
973
986
|
},
|
|
974
987
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
975
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
976
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
988
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2469, function: Function { arguments: [NamedExternref("Event")], shim_idx: 2402, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
989
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9121, __wasm_bindgen_func_elem_9385);
|
|
977
990
|
return addHeapObject(ret);
|
|
978
991
|
},
|
|
979
992
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
980
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
981
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
993
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2469, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2402, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
994
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9121, __wasm_bindgen_func_elem_9385);
|
|
982
995
|
return addHeapObject(ret);
|
|
983
996
|
},
|
|
984
997
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
985
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
986
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
998
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2469, function: Function { arguments: [], shim_idx: 2470, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
999
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9121, __wasm_bindgen_func_elem_9383);
|
|
987
1000
|
return addHeapObject(ret);
|
|
988
1001
|
},
|
|
989
1002
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
990
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
991
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1003
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3378, function: Function { arguments: [Externref], shim_idx: 3379, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1004
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_13334, __wasm_bindgen_func_elem_13335);
|
|
992
1005
|
return addHeapObject(ret);
|
|
993
1006
|
},
|
|
994
1007
|
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
@@ -1045,16 +1058,16 @@ function __wbg_get_imports() {
|
|
|
1045
1058
|
};
|
|
1046
1059
|
}
|
|
1047
1060
|
|
|
1048
|
-
function
|
|
1049
|
-
wasm.
|
|
1061
|
+
function __wasm_bindgen_func_elem_9383(arg0, arg1) {
|
|
1062
|
+
wasm.__wasm_bindgen_func_elem_9383(arg0, arg1);
|
|
1050
1063
|
}
|
|
1051
1064
|
|
|
1052
|
-
function
|
|
1053
|
-
wasm.
|
|
1065
|
+
function __wasm_bindgen_func_elem_9385(arg0, arg1, arg2) {
|
|
1066
|
+
wasm.__wasm_bindgen_func_elem_9385(arg0, arg1, addHeapObject(arg2));
|
|
1054
1067
|
}
|
|
1055
1068
|
|
|
1056
|
-
function
|
|
1057
|
-
wasm.
|
|
1069
|
+
function __wasm_bindgen_func_elem_13335(arg0, arg1, arg2) {
|
|
1070
|
+
wasm.__wasm_bindgen_func_elem_13335(arg0, arg1, addHeapObject(arg2));
|
|
1058
1071
|
}
|
|
1059
1072
|
|
|
1060
1073
|
|
|
Binary file
|
|
@@ -9,18 +9,20 @@ export const inkwebview_destroy: (a: number) => void;
|
|
|
9
9
|
export const inkwebview_dispatchInput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
10
10
|
export const inkwebview_dispatchPointer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
11
11
|
export const inkwebview_focus: (a: number) => void;
|
|
12
|
+
export const inkwebview_isInteractive: (a: number) => number;
|
|
12
13
|
export const inkwebview_isRunning: (a: number) => number;
|
|
13
14
|
export const inkwebview_new: (a: number, b: number, c: number) => number;
|
|
14
15
|
export const inkwebview_notifyUserInteraction: (a: number) => void;
|
|
15
16
|
export const inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
16
17
|
export const inkwebview_render: (a: number, b: number) => void;
|
|
17
18
|
export const inkwebview_resize: (a: number, b: number, c: number, d: number) => void;
|
|
19
|
+
export const inkwebview_setInteractive: (a: number, b: number) => void;
|
|
18
20
|
export const main: () => void;
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
21
|
+
export const __wasm_bindgen_func_elem_9121: (a: number, b: number) => void;
|
|
22
|
+
export const __wasm_bindgen_func_elem_13334: (a: number, b: number) => void;
|
|
23
|
+
export const __wasm_bindgen_func_elem_9385: (a: number, b: number, c: number) => void;
|
|
24
|
+
export const __wasm_bindgen_func_elem_13335: (a: number, b: number, c: number) => void;
|
|
25
|
+
export const __wasm_bindgen_func_elem_9383: (a: number, b: number) => void;
|
|
24
26
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
25
27
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
26
28
|
export const __wbindgen_export3: (a: number) => void;
|