@yodaos-pkg/ink 0.9.1-daily.202605280331 → 0.10.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 +5 -0
- package/index.d.ts +2 -0
- package/index.js +10 -0
- package/package.json +1 -1
- package/pkg/ink_web.d.ts +7 -7
- package/pkg/ink_web.js +19 -18
- package/pkg/ink_web_bg.wasm +0 -0
- package/pkg/ink_web_bg.wasm.d.ts +6 -6
package/README.md
CHANGED
|
@@ -76,6 +76,10 @@ Creates an `InkView` instance and initializes the wasm runtime internally.
|
|
|
76
76
|
- `options.scaleFactor?: number`
|
|
77
77
|
- Optional
|
|
78
78
|
- The device pixel ratio, defaulting to `window.devicePixelRatio`
|
|
79
|
+
- `options.appFps?: number`
|
|
80
|
+
- Optional
|
|
81
|
+
- Per-view app logic frame rate
|
|
82
|
+
- Defaults to `60`
|
|
79
83
|
- `options.canvas?: HTMLCanvasElement`
|
|
80
84
|
- Optional
|
|
81
85
|
- If provided, the view is automatically bound to this canvas
|
|
@@ -109,6 +113,7 @@ const view = await createInkView({
|
|
|
109
113
|
width: 360,
|
|
110
114
|
layoutMode: 'width-constrained-auto-height',
|
|
111
115
|
scaleFactor: window.devicePixelRatio,
|
|
116
|
+
appFps: 30,
|
|
112
117
|
canvas,
|
|
113
118
|
});
|
|
114
119
|
```
|
package/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export interface CreateInkViewOptions {
|
|
|
48
48
|
themeName?: string;
|
|
49
49
|
/** Device pixel ratio override. Defaults to `window.devicePixelRatio` when available. */
|
|
50
50
|
scaleFactor?: number;
|
|
51
|
+
/** Per-view app logic frame rate. Defaults to `60`. */
|
|
52
|
+
appFps?: number;
|
|
51
53
|
/** Legacy shortcut for immediately binding an HTML canvas after creation. */
|
|
52
54
|
canvas?: HTMLCanvasElement;
|
|
53
55
|
/** Optional surface descriptor bound immediately after creation. */
|
package/index.js
CHANGED
|
@@ -28,6 +28,14 @@ function normalizeScaleFactor(value) {
|
|
|
28
28
|
return 1;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
function normalizeAppFps(value) {
|
|
32
|
+
const numericValue = Math.trunc(Number(value));
|
|
33
|
+
if (Number.isFinite(numericValue) && numericValue > 0) {
|
|
34
|
+
return numericValue;
|
|
35
|
+
}
|
|
36
|
+
return 60;
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
function ensureFetch(fetchImpl) {
|
|
32
40
|
const resolved = fetchImpl || globalThis.fetch;
|
|
33
41
|
if (typeof resolved !== 'function') {
|
|
@@ -490,6 +498,7 @@ export class InkView {
|
|
|
490
498
|
const themeName = normalizeThemeName(config.themeName);
|
|
491
499
|
const height = Number(config.height);
|
|
492
500
|
const scaleFactor = normalizeScaleFactor(config.scaleFactor);
|
|
501
|
+
const appFps = normalizeAppFps(config.appFps);
|
|
493
502
|
|
|
494
503
|
if (!Number.isFinite(width)) {
|
|
495
504
|
throw new Error('`width` is a required numeric value.');
|
|
@@ -507,6 +516,7 @@ export class InkView {
|
|
|
507
516
|
physicalWidth,
|
|
508
517
|
physicalHeight,
|
|
509
518
|
scaleFactor,
|
|
519
|
+
appFps,
|
|
510
520
|
layoutMode,
|
|
511
521
|
themeName,
|
|
512
522
|
);
|
package/package.json
CHANGED
package/pkg/ink_web.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export class InkWebView {
|
|
|
30
30
|
focus(): void;
|
|
31
31
|
isInteractive(): boolean;
|
|
32
32
|
isRunning(): boolean;
|
|
33
|
-
constructor(width: number, height: number, scale_factor: number, layout_mode: string, theme_name?: string | null);
|
|
33
|
+
constructor(width: number, height: number, scale_factor: number, app_fps: number, layout_mode: string, theme_name?: string | null);
|
|
34
34
|
notifyUserInteraction(): void;
|
|
35
35
|
open(path: string, initial_page?: string | null, query_json?: string | null): void;
|
|
36
36
|
openBundle(app_id: string, files: Map<any, any>, initial_page?: string | null, query_json?: string | null): void;
|
|
@@ -73,7 +73,7 @@ export interface InitOutput {
|
|
|
73
73
|
readonly inkwebview_focus: (a: number) => void;
|
|
74
74
|
readonly inkwebview_isInteractive: (a: number) => number;
|
|
75
75
|
readonly inkwebview_isRunning: (a: number) => number;
|
|
76
|
-
readonly inkwebview_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
76
|
+
readonly inkwebview_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
77
77
|
readonly inkwebview_notifyUserInteraction: (a: number) => void;
|
|
78
78
|
readonly inkwebview_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
79
79
|
readonly inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
@@ -84,11 +84,11 @@ export interface InitOutput {
|
|
|
84
84
|
readonly inkwebview_setLayoutMode: (a: number, b: number, c: number) => void;
|
|
85
85
|
readonly inkwebview_setViewport: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
86
86
|
readonly main: () => void;
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
87
|
+
readonly __wasm_bindgen_func_elem_9822: (a: number, b: number) => void;
|
|
88
|
+
readonly __wasm_bindgen_func_elem_14048: (a: number, b: number) => void;
|
|
89
|
+
readonly __wasm_bindgen_func_elem_9965: (a: number, b: number, c: number) => void;
|
|
90
|
+
readonly __wasm_bindgen_func_elem_14049: (a: number, b: number, c: number) => void;
|
|
91
|
+
readonly __wasm_bindgen_func_elem_9963: (a: number, b: number) => void;
|
|
92
92
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
93
93
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
94
94
|
readonly __wbindgen_export3: (a: number) => void;
|
package/pkg/ink_web.js
CHANGED
|
@@ -255,15 +255,16 @@ export class InkWebView {
|
|
|
255
255
|
* @param {number} width
|
|
256
256
|
* @param {number} height
|
|
257
257
|
* @param {number} scale_factor
|
|
258
|
+
* @param {number} app_fps
|
|
258
259
|
* @param {string} layout_mode
|
|
259
260
|
* @param {string | null} [theme_name]
|
|
260
261
|
*/
|
|
261
|
-
constructor(width, height, scale_factor, layout_mode, theme_name) {
|
|
262
|
+
constructor(width, height, scale_factor, app_fps, layout_mode, theme_name) {
|
|
262
263
|
const ptr0 = passStringToWasm0(layout_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
263
264
|
const len0 = WASM_VECTOR_LEN;
|
|
264
265
|
var ptr1 = isLikeNone(theme_name) ? 0 : passStringToWasm0(theme_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
265
266
|
var len1 = WASM_VECTOR_LEN;
|
|
266
|
-
const ret = wasm.inkwebview_new(width, height, scale_factor, ptr0, len0, ptr1, len1);
|
|
267
|
+
const ret = wasm.inkwebview_new(width, height, scale_factor, app_fps, ptr0, len0, ptr1, len1);
|
|
267
268
|
this.__wbg_ptr = ret >>> 0;
|
|
268
269
|
InkWebViewFinalization.register(this, this.__wbg_ptr, this);
|
|
269
270
|
return this;
|
|
@@ -1216,28 +1217,28 @@ function __wbg_get_imports() {
|
|
|
1216
1217
|
return ret;
|
|
1217
1218
|
},
|
|
1218
1219
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1219
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1220
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1220
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2633, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1221
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9822, __wasm_bindgen_func_elem_9965);
|
|
1221
1222
|
return addHeapObject(ret);
|
|
1222
1223
|
},
|
|
1223
1224
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1224
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1225
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1225
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2633, function: Function { arguments: [NamedExternref("Event")], shim_idx: 2621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1226
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9822, __wasm_bindgen_func_elem_9965);
|
|
1226
1227
|
return addHeapObject(ret);
|
|
1227
1228
|
},
|
|
1228
1229
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1229
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1230
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1230
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2633, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2621, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1231
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9822, __wasm_bindgen_func_elem_9965);
|
|
1231
1232
|
return addHeapObject(ret);
|
|
1232
1233
|
},
|
|
1233
1234
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1234
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1235
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1235
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2633, function: Function { arguments: [], shim_idx: 2634, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1236
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9822, __wasm_bindgen_func_elem_9963);
|
|
1236
1237
|
return addHeapObject(ret);
|
|
1237
1238
|
},
|
|
1238
1239
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1239
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1240
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
1240
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3529, function: Function { arguments: [Externref], shim_idx: 3530, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1241
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_14048, __wasm_bindgen_func_elem_14049);
|
|
1241
1242
|
return addHeapObject(ret);
|
|
1242
1243
|
},
|
|
1243
1244
|
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
@@ -1294,16 +1295,16 @@ function __wbg_get_imports() {
|
|
|
1294
1295
|
};
|
|
1295
1296
|
}
|
|
1296
1297
|
|
|
1297
|
-
function
|
|
1298
|
-
wasm.
|
|
1298
|
+
function __wasm_bindgen_func_elem_9963(arg0, arg1) {
|
|
1299
|
+
wasm.__wasm_bindgen_func_elem_9963(arg0, arg1);
|
|
1299
1300
|
}
|
|
1300
1301
|
|
|
1301
|
-
function
|
|
1302
|
-
wasm.
|
|
1302
|
+
function __wasm_bindgen_func_elem_9965(arg0, arg1, arg2) {
|
|
1303
|
+
wasm.__wasm_bindgen_func_elem_9965(arg0, arg1, addHeapObject(arg2));
|
|
1303
1304
|
}
|
|
1304
1305
|
|
|
1305
|
-
function
|
|
1306
|
-
wasm.
|
|
1306
|
+
function __wasm_bindgen_func_elem_14049(arg0, arg1, arg2) {
|
|
1307
|
+
wasm.__wasm_bindgen_func_elem_14049(arg0, arg1, addHeapObject(arg2));
|
|
1307
1308
|
}
|
|
1308
1309
|
|
|
1309
1310
|
|
package/pkg/ink_web_bg.wasm
CHANGED
|
Binary file
|
package/pkg/ink_web_bg.wasm.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const inkwebview_dispatchPointer: (a: number, b: number, c: number, d: nu
|
|
|
24
24
|
export const inkwebview_focus: (a: number) => void;
|
|
25
25
|
export const inkwebview_isInteractive: (a: number) => number;
|
|
26
26
|
export const inkwebview_isRunning: (a: number) => number;
|
|
27
|
-
export const inkwebview_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
27
|
+
export const inkwebview_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
28
28
|
export const inkwebview_notifyUserInteraction: (a: number) => void;
|
|
29
29
|
export const inkwebview_open: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
30
30
|
export const inkwebview_openBundle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
@@ -35,11 +35,11 @@ export const inkwebview_setLanguageModelConfig: (a: number, b: number, c: number
|
|
|
35
35
|
export const inkwebview_setLayoutMode: (a: number, b: number, c: number) => void;
|
|
36
36
|
export const inkwebview_setViewport: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
37
37
|
export const main: () => void;
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
38
|
+
export const __wasm_bindgen_func_elem_9822: (a: number, b: number) => void;
|
|
39
|
+
export const __wasm_bindgen_func_elem_14048: (a: number, b: number) => void;
|
|
40
|
+
export const __wasm_bindgen_func_elem_9965: (a: number, b: number, c: number) => void;
|
|
41
|
+
export const __wasm_bindgen_func_elem_14049: (a: number, b: number, c: number) => void;
|
|
42
|
+
export const __wasm_bindgen_func_elem_9963: (a: number, b: number) => void;
|
|
43
43
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
44
44
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
45
45
|
export const __wbindgen_export3: (a: number) => void;
|