@lynx-js/web-mainthread-apis 0.19.5 → 0.19.6
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/CHANGELOG.md +17 -0
- package/binary/debug.d.ts +2 -0
- package/binary/debug.js +5 -1
- package/binary/debug_bg.js +83 -95
- package/binary/debug_bg.wasm +0 -0
- package/binary/legacy.d.ts +2 -0
- package/binary/legacy.js +7 -2
- package/binary/legacy_bg.js +104 -117
- package/binary/legacy_bg.wasm +0 -0
- package/binary/standard.d.ts +2 -0
- package/binary/standard.js +5 -1
- package/binary/standard_bg.js +83 -95
- package/binary/standard_bg.wasm +0 -0
- package/dist/createMainThreadGlobalThis.js +161 -46
- package/package.json +2 -2
- package/wasm/index.js +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @lynx-js/web-mainthread-apis
|
|
2
2
|
|
|
3
|
+
## 0.19.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add main-thread API: \_\_QuerySelector ([#2115](https://github.com/lynx-family/lynx-stack/pull/2115))
|
|
8
|
+
|
|
9
|
+
- fix: when a list-item is deleted from list, the deleted list-item is still showed incorrectly. ([#1092](https://github.com/lynx-family/lynx-stack/pull/1092))
|
|
10
|
+
|
|
11
|
+
This is because the `enqueueComponent` method does not delete the node from the Element Tree. It is only to maintain the display node on RL, and lynx web needs to delete the dom additionally.
|
|
12
|
+
|
|
13
|
+
- feat: support main thread invoke ui method ([#2104](https://github.com/lynx-family/lynx-stack/pull/2104))
|
|
14
|
+
|
|
15
|
+
- fix: mts && bts events can be binded both ([#2121](https://github.com/lynx-family/lynx-stack/pull/2121))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`179f984`](https://github.com/lynx-family/lynx-stack/commit/179f9844adf00ff4b2cd450ffb943649441c87d3), [`f7133c1`](https://github.com/lynx-family/lynx-stack/commit/f7133c137f094063e991dfa0e993ea92177aa173), [`6c2b51a`](https://github.com/lynx-family/lynx-stack/commit/6c2b51a661ae244eb40671f63f29ee971e084ed4), [`5b589ab`](https://github.com/lynx-family/lynx-stack/commit/5b589ab53b01a8e2357d3ccbb159edab004086d3)]:
|
|
18
|
+
- @lynx-js/web-constants@0.19.6
|
|
19
|
+
|
|
3
20
|
## 0.19.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/binary/debug.d.ts
CHANGED
package/binary/debug.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./debug.d.ts" */
|
|
2
|
+
|
|
1
3
|
import * as wasm from "./debug_bg.wasm";
|
|
2
|
-
export * from "./debug_bg.js";
|
|
3
4
|
import { __wbg_set_wasm } from "./debug_bg.js";
|
|
4
5
|
__wbg_set_wasm(wasm);
|
|
5
6
|
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
transform_raw_u16_inline_style_ptr, transform_raw_u16_inline_style_ptr_parsed
|
|
9
|
+
} from "./debug_bg.js";
|
package/binary/debug_bg.js
CHANGED
|
@@ -1,56 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} str
|
|
3
|
+
* @returns {string | undefined}
|
|
4
|
+
*/
|
|
5
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
6
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
7
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
9
|
+
let v2;
|
|
10
|
+
if (ret[0] !== 0) {
|
|
11
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
12
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
+
return v2;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} name
|
|
19
|
+
* @param {string} value
|
|
20
|
+
* @returns {Array<any> | undefined}
|
|
21
|
+
*/
|
|
22
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
23
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
24
|
+
const len0 = WASM_VECTOR_LEN;
|
|
25
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
26
|
+
const len1 = WASM_VECTOR_LEN;
|
|
27
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
28
|
+
return ret;
|
|
29
|
+
}
|
|
30
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
31
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
32
|
+
}
|
|
33
|
+
export function __wbg_new_3eb36ae241fe6f44() {
|
|
34
|
+
const ret = new Array();
|
|
35
|
+
return ret;
|
|
36
|
+
}
|
|
37
|
+
export function __wbg_push_8ffdcb2063340ba5(arg0, arg1) {
|
|
38
|
+
const ret = arg0.push(arg1);
|
|
39
|
+
return ret;
|
|
40
|
+
}
|
|
41
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
42
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
43
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
44
|
+
return ret;
|
|
45
|
+
}
|
|
46
|
+
export function __wbindgen_init_externref_table() {
|
|
47
|
+
const table = wasm.__wbindgen_externrefs;
|
|
48
|
+
const offset = table.grow(4);
|
|
49
|
+
table.set(0, undefined);
|
|
50
|
+
table.set(offset + 0, undefined);
|
|
51
|
+
table.set(offset + 1, null);
|
|
52
|
+
table.set(offset + 2, true);
|
|
53
|
+
table.set(offset + 3, false);
|
|
30
54
|
}
|
|
31
|
-
|
|
32
55
|
function getStringFromWasm0(ptr, len) {
|
|
33
56
|
ptr = ptr >>> 0;
|
|
34
57
|
return decodeText(ptr, len);
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
42
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
43
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
44
|
-
view.set(buf);
|
|
45
|
-
return {
|
|
46
|
-
read: arg.length,
|
|
47
|
-
written: buf.length
|
|
48
|
-
};
|
|
60
|
+
let cachedUint8ArrayMemory0 = null;
|
|
61
|
+
function getUint8ArrayMemory0() {
|
|
62
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
63
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
49
64
|
}
|
|
65
|
+
return cachedUint8ArrayMemory0;
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
53
|
-
|
|
54
69
|
if (realloc === undefined) {
|
|
55
70
|
const buf = cachedTextEncoder.encode(arg);
|
|
56
71
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -71,7 +86,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
71
86
|
if (code > 0x7F) break;
|
|
72
87
|
mem[ptr + offset] = code;
|
|
73
88
|
}
|
|
74
|
-
|
|
75
89
|
if (offset !== len) {
|
|
76
90
|
if (offset !== 0) {
|
|
77
91
|
arg = arg.slice(offset);
|
|
@@ -87,64 +101,38 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
87
101
|
WASM_VECTOR_LEN = offset;
|
|
88
102
|
return ptr;
|
|
89
103
|
}
|
|
90
|
-
/**
|
|
91
|
-
* @param {string} str
|
|
92
|
-
* @returns {string | undefined}
|
|
93
|
-
*/
|
|
94
|
-
export function transform_raw_u16_inline_style_ptr(str) {
|
|
95
|
-
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
-
const len0 = WASM_VECTOR_LEN;
|
|
97
|
-
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
98
|
-
let v2;
|
|
99
|
-
if (ret[0] !== 0) {
|
|
100
|
-
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
101
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
102
|
-
}
|
|
103
|
-
return v2;
|
|
104
|
-
}
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return
|
|
105
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
106
|
+
cachedTextDecoder.decode();
|
|
107
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
108
|
+
let numBytesDecoded = 0;
|
|
109
|
+
function decodeText(ptr, len) {
|
|
110
|
+
numBytesDecoded += len;
|
|
111
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
112
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
113
|
+
cachedTextDecoder.decode();
|
|
114
|
+
numBytesDecoded = len;
|
|
115
|
+
}
|
|
116
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export function __wbg_new_e17d9f43105b08be() {
|
|
125
|
-
const ret = new Array();
|
|
126
|
-
return ret;
|
|
127
|
-
};
|
|
119
|
+
const cachedTextEncoder = new TextEncoder();
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
122
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
123
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
124
|
+
view.set(buf);
|
|
125
|
+
return {
|
|
126
|
+
read: arg.length,
|
|
127
|
+
written: buf.length
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
}
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
136
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
137
|
-
return ret;
|
|
138
|
-
};
|
|
132
|
+
let WASM_VECTOR_LEN = 0;
|
|
139
133
|
|
|
140
|
-
export function __wbindgen_init_externref_table() {
|
|
141
|
-
const table = wasm.__wbindgen_externrefs;
|
|
142
|
-
const offset = table.grow(4);
|
|
143
|
-
table.set(0, undefined);
|
|
144
|
-
table.set(offset + 0, undefined);
|
|
145
|
-
table.set(offset + 1, null);
|
|
146
|
-
table.set(offset + 2, true);
|
|
147
|
-
table.set(offset + 3, false);
|
|
148
|
-
;
|
|
149
|
-
};
|
|
150
134
|
|
|
135
|
+
let wasm;
|
|
136
|
+
export function __wbg_set_wasm(val) {
|
|
137
|
+
wasm = val;
|
|
138
|
+
}
|
package/binary/debug_bg.wasm
CHANGED
|
Binary file
|
package/binary/legacy.d.ts
CHANGED
package/binary/legacy.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./legacy.d.ts" */
|
|
2
|
+
|
|
1
3
|
import * as wasm from "./legacy_bg.wasm";
|
|
2
|
-
export * from "./legacy_bg.js";
|
|
3
4
|
import { __wbg_set_wasm } from "./legacy_bg.js";
|
|
4
|
-
__wbg_set_wasm(wasm);
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
transform_raw_u16_inline_style_ptr, transform_raw_u16_inline_style_ptr_parsed
|
|
9
|
+
} from "./legacy_bg.js";
|
package/binary/legacy_bg.js
CHANGED
|
@@ -1,45 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} str
|
|
3
|
+
* @returns {string | undefined}
|
|
4
|
+
*/
|
|
5
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
6
|
+
try {
|
|
7
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
9
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10
|
+
wasm.transform_raw_u16_inline_style_ptr(retptr, ptr0, len0);
|
|
11
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13
|
+
let v2;
|
|
14
|
+
if (r0 !== 0) {
|
|
15
|
+
v2 = getStringFromWasm0(r0, r1).slice();
|
|
16
|
+
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
17
|
+
}
|
|
18
|
+
return v2;
|
|
19
|
+
} finally {
|
|
20
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
12
21
|
}
|
|
13
|
-
return cachedUint8ArrayMemory0;
|
|
14
22
|
}
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} name
|
|
26
|
+
* @param {string} value
|
|
27
|
+
* @returns {Array<any> | undefined}
|
|
28
|
+
*/
|
|
29
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
30
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
31
|
+
const len0 = WASM_VECTOR_LEN;
|
|
32
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
33
|
+
const len1 = WASM_VECTOR_LEN;
|
|
34
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
35
|
+
return takeObject(ret);
|
|
30
36
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
38
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
39
|
+
}
|
|
40
|
+
export function __wbg_new_3eb36ae241fe6f44() {
|
|
41
|
+
const ret = new Array();
|
|
42
|
+
return addHeapObject(ret);
|
|
43
|
+
}
|
|
44
|
+
export function __wbg_push_8ffdcb2063340ba5(arg0, arg1) {
|
|
45
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
46
|
+
return ret;
|
|
47
|
+
}
|
|
48
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
49
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
50
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
51
|
+
return addHeapObject(ret);
|
|
52
|
+
}
|
|
53
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
54
|
+
takeObject(arg0);
|
|
35
55
|
}
|
|
36
|
-
|
|
37
|
-
let heap = new Array(128).fill(undefined);
|
|
38
|
-
|
|
39
|
-
heap.push(undefined, null, true, false);
|
|
40
|
-
|
|
41
|
-
let heap_next = heap.length;
|
|
42
|
-
|
|
43
56
|
function addHeapObject(obj) {
|
|
44
57
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
58
|
const idx = heap_next;
|
|
@@ -49,37 +62,41 @@ function addHeapObject(obj) {
|
|
|
49
62
|
return idx;
|
|
50
63
|
}
|
|
51
64
|
|
|
52
|
-
function getObject(idx) { return heap[idx]; }
|
|
53
|
-
|
|
54
65
|
function dropObject(idx) {
|
|
55
66
|
if (idx < 132) return;
|
|
56
67
|
heap[idx] = heap_next;
|
|
57
68
|
heap_next = idx;
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
let cachedDataViewMemory0 = null;
|
|
72
|
+
function getDataViewMemory0() {
|
|
73
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
74
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
75
|
+
}
|
|
76
|
+
return cachedDataViewMemory0;
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
function getStringFromWasm0(ptr, len) {
|
|
80
|
+
ptr = ptr >>> 0;
|
|
81
|
+
return decodeText(ptr, len);
|
|
82
|
+
}
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
read: arg.length,
|
|
76
|
-
written: buf.length
|
|
77
|
-
};
|
|
84
|
+
let cachedUint8ArrayMemory0 = null;
|
|
85
|
+
function getUint8ArrayMemory0() {
|
|
86
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
87
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
78
88
|
}
|
|
89
|
+
return cachedUint8ArrayMemory0;
|
|
79
90
|
}
|
|
80
91
|
|
|
81
|
-
function
|
|
92
|
+
function getObject(idx) { return heap[idx]; }
|
|
82
93
|
|
|
94
|
+
let heap = new Array(128).fill(undefined);
|
|
95
|
+
heap.push(undefined, null, true, false);
|
|
96
|
+
|
|
97
|
+
let heap_next = heap.length;
|
|
98
|
+
|
|
99
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
83
100
|
if (realloc === undefined) {
|
|
84
101
|
const buf = cachedTextEncoder.encode(arg);
|
|
85
102
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -100,7 +117,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
100
117
|
if (code > 0x7F) break;
|
|
101
118
|
mem[ptr + offset] = code;
|
|
102
119
|
}
|
|
103
|
-
|
|
104
120
|
if (offset !== len) {
|
|
105
121
|
if (offset !== 0) {
|
|
106
122
|
arg = arg.slice(offset);
|
|
@@ -117,72 +133,43 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
117
133
|
return ptr;
|
|
118
134
|
}
|
|
119
135
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
125
|
-
}
|
|
126
|
-
return cachedDataViewMemory0;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @param {string} str
|
|
130
|
-
* @returns {string | undefined}
|
|
131
|
-
*/
|
|
132
|
-
export function transform_raw_u16_inline_style_ptr(str) {
|
|
133
|
-
try {
|
|
134
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
-
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
136
|
-
const len0 = WASM_VECTOR_LEN;
|
|
137
|
-
wasm.transform_raw_u16_inline_style_ptr(retptr, ptr0, len0);
|
|
138
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
139
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140
|
-
let v2;
|
|
141
|
-
if (r0 !== 0) {
|
|
142
|
-
v2 = getStringFromWasm0(r0, r1).slice();
|
|
143
|
-
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
144
|
-
}
|
|
145
|
-
return v2;
|
|
146
|
-
} finally {
|
|
147
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
148
|
-
}
|
|
136
|
+
function takeObject(idx) {
|
|
137
|
+
const ret = getObject(idx);
|
|
138
|
+
dropObject(idx);
|
|
139
|
+
return ret;
|
|
149
140
|
}
|
|
150
141
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return
|
|
142
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
143
|
+
cachedTextDecoder.decode();
|
|
144
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
145
|
+
let numBytesDecoded = 0;
|
|
146
|
+
function decodeText(ptr, len) {
|
|
147
|
+
numBytesDecoded += len;
|
|
148
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
149
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
150
|
+
cachedTextDecoder.decode();
|
|
151
|
+
numBytesDecoded = len;
|
|
152
|
+
}
|
|
153
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
163
154
|
}
|
|
164
155
|
|
|
165
|
-
|
|
166
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export function __wbg_new_e17d9f43105b08be() {
|
|
170
|
-
const ret = new Array();
|
|
171
|
-
return addHeapObject(ret);
|
|
172
|
-
};
|
|
156
|
+
const cachedTextEncoder = new TextEncoder();
|
|
173
157
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
158
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
159
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
160
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
161
|
+
view.set(buf);
|
|
162
|
+
return {
|
|
163
|
+
read: arg.length,
|
|
164
|
+
written: buf.length
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
}
|
|
178
168
|
|
|
179
|
-
|
|
180
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
181
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
182
|
-
return addHeapObject(ret);
|
|
183
|
-
};
|
|
169
|
+
let WASM_VECTOR_LEN = 0;
|
|
184
170
|
|
|
185
|
-
export function __wbindgen_object_drop_ref(arg0) {
|
|
186
|
-
takeObject(arg0);
|
|
187
|
-
};
|
|
188
171
|
|
|
172
|
+
let wasm;
|
|
173
|
+
export function __wbg_set_wasm(val) {
|
|
174
|
+
wasm = val;
|
|
175
|
+
}
|
package/binary/legacy_bg.wasm
CHANGED
|
Binary file
|
package/binary/standard.d.ts
CHANGED
package/binary/standard.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./standard.d.ts" */
|
|
2
|
+
|
|
1
3
|
import * as wasm from "./standard_bg.wasm";
|
|
2
|
-
export * from "./standard_bg.js";
|
|
3
4
|
import { __wbg_set_wasm } from "./standard_bg.js";
|
|
4
5
|
__wbg_set_wasm(wasm);
|
|
5
6
|
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
transform_raw_u16_inline_style_ptr, transform_raw_u16_inline_style_ptr_parsed
|
|
9
|
+
} from "./standard_bg.js";
|
package/binary/standard_bg.js
CHANGED
|
@@ -1,56 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} str
|
|
3
|
+
* @returns {string | undefined}
|
|
4
|
+
*/
|
|
5
|
+
export function transform_raw_u16_inline_style_ptr(str) {
|
|
6
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
7
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
9
|
+
let v2;
|
|
10
|
+
if (ret[0] !== 0) {
|
|
11
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
12
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
+
return v2;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} name
|
|
19
|
+
* @param {string} value
|
|
20
|
+
* @returns {Array<any> | undefined}
|
|
21
|
+
*/
|
|
22
|
+
export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
23
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
24
|
+
const len0 = WASM_VECTOR_LEN;
|
|
25
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
26
|
+
const len1 = WASM_VECTOR_LEN;
|
|
27
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
28
|
+
return ret;
|
|
29
|
+
}
|
|
30
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
31
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
32
|
+
}
|
|
33
|
+
export function __wbg_new_3eb36ae241fe6f44() {
|
|
34
|
+
const ret = new Array();
|
|
35
|
+
return ret;
|
|
36
|
+
}
|
|
37
|
+
export function __wbg_push_8ffdcb2063340ba5(arg0, arg1) {
|
|
38
|
+
const ret = arg0.push(arg1);
|
|
39
|
+
return ret;
|
|
40
|
+
}
|
|
41
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
42
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
43
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
44
|
+
return ret;
|
|
45
|
+
}
|
|
46
|
+
export function __wbindgen_init_externref_table() {
|
|
47
|
+
const table = wasm.__wbindgen_externrefs;
|
|
48
|
+
const offset = table.grow(4);
|
|
49
|
+
table.set(0, undefined);
|
|
50
|
+
table.set(offset + 0, undefined);
|
|
51
|
+
table.set(offset + 1, null);
|
|
52
|
+
table.set(offset + 2, true);
|
|
53
|
+
table.set(offset + 3, false);
|
|
30
54
|
}
|
|
31
|
-
|
|
32
55
|
function getStringFromWasm0(ptr, len) {
|
|
33
56
|
ptr = ptr >>> 0;
|
|
34
57
|
return decodeText(ptr, len);
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
42
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
43
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
44
|
-
view.set(buf);
|
|
45
|
-
return {
|
|
46
|
-
read: arg.length,
|
|
47
|
-
written: buf.length
|
|
48
|
-
};
|
|
60
|
+
let cachedUint8ArrayMemory0 = null;
|
|
61
|
+
function getUint8ArrayMemory0() {
|
|
62
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
63
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
49
64
|
}
|
|
65
|
+
return cachedUint8ArrayMemory0;
|
|
50
66
|
}
|
|
51
67
|
|
|
52
68
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
53
|
-
|
|
54
69
|
if (realloc === undefined) {
|
|
55
70
|
const buf = cachedTextEncoder.encode(arg);
|
|
56
71
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -71,7 +86,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
71
86
|
if (code > 0x7F) break;
|
|
72
87
|
mem[ptr + offset] = code;
|
|
73
88
|
}
|
|
74
|
-
|
|
75
89
|
if (offset !== len) {
|
|
76
90
|
if (offset !== 0) {
|
|
77
91
|
arg = arg.slice(offset);
|
|
@@ -87,64 +101,38 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
87
101
|
WASM_VECTOR_LEN = offset;
|
|
88
102
|
return ptr;
|
|
89
103
|
}
|
|
90
|
-
/**
|
|
91
|
-
* @param {string} str
|
|
92
|
-
* @returns {string | undefined}
|
|
93
|
-
*/
|
|
94
|
-
export function transform_raw_u16_inline_style_ptr(str) {
|
|
95
|
-
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
-
const len0 = WASM_VECTOR_LEN;
|
|
97
|
-
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
98
|
-
let v2;
|
|
99
|
-
if (ret[0] !== 0) {
|
|
100
|
-
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
101
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
102
|
-
}
|
|
103
|
-
return v2;
|
|
104
|
-
}
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return
|
|
105
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
106
|
+
cachedTextDecoder.decode();
|
|
107
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
108
|
+
let numBytesDecoded = 0;
|
|
109
|
+
function decodeText(ptr, len) {
|
|
110
|
+
numBytesDecoded += len;
|
|
111
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
112
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
113
|
+
cachedTextDecoder.decode();
|
|
114
|
+
numBytesDecoded = len;
|
|
115
|
+
}
|
|
116
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export function __wbg_new_e17d9f43105b08be() {
|
|
125
|
-
const ret = new Array();
|
|
126
|
-
return ret;
|
|
127
|
-
};
|
|
119
|
+
const cachedTextEncoder = new TextEncoder();
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
122
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
123
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
124
|
+
view.set(buf);
|
|
125
|
+
return {
|
|
126
|
+
read: arg.length,
|
|
127
|
+
written: buf.length
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
}
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
136
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
137
|
-
return ret;
|
|
138
|
-
};
|
|
132
|
+
let WASM_VECTOR_LEN = 0;
|
|
139
133
|
|
|
140
|
-
export function __wbindgen_init_externref_table() {
|
|
141
|
-
const table = wasm.__wbindgen_externrefs;
|
|
142
|
-
const offset = table.grow(4);
|
|
143
|
-
table.set(0, undefined);
|
|
144
|
-
table.set(offset + 0, undefined);
|
|
145
|
-
table.set(offset + 1, null);
|
|
146
|
-
table.set(offset + 2, true);
|
|
147
|
-
table.set(offset + 3, false);
|
|
148
|
-
;
|
|
149
|
-
};
|
|
150
134
|
|
|
135
|
+
let wasm;
|
|
136
|
+
export function __wbg_set_wasm(val) {
|
|
137
|
+
wasm = val;
|
|
138
|
+
}
|
package/binary/standard_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Lynx Authors. All rights reserved.
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
import { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute, lynxEntryNameAttribute, } from '@lynx-js/web-constants';
|
|
4
|
+
import { lynxUniqueIdAttribute, systemInfo, parentComponentUniqueIdAttribute, componentIdAttribute, LynxEventNameToW3cByTagName, LynxEventNameToW3cCommon, lynxTagAttribute, W3cEventNameToLynx, cssIdAttribute, lynxDefaultDisplayLinearAttribute, __lynx_timing_flag, lynxDisposedAttribute, lynxEntryNameAttribute, ErrorCode, } from '@lynx-js/web-constants';
|
|
5
5
|
import { createMainThreadLynx } from './createMainThreadLynx.js';
|
|
6
6
|
import { __AddClass, __AddConfig, __AddDataset, __AddInlineStyle, __AppendElement, __ElementIsEqual, __FirstElement, __GetAttributes, __GetChildren, __GetClasses, __GetComponentID, __GetDataByKey, __GetDataset, __GetElementConfig, __GetElementUniqueID, __GetID, __GetParent, __GetTag, __GetTemplateParts, __InsertElementBefore, __LastElement, __MarkPartElement, __MarkTemplateElement, __NextElement, __RemoveElement, __ReplaceElement, __ReplaceElements, __SetClasses, __SetConfig, __SetCSSId, __SetDataset, __SetID, __SetInlineStyles, __UpdateComponentID, __UpdateComponentInfo, __GetAttributeByName, } from './pureElementPAPIs.js';
|
|
7
7
|
import { createCrossThreadEvent } from './utils/createCrossThreadEvent.js';
|
|
@@ -46,37 +46,45 @@ export function createMainThreadGlobalThis(config) {
|
|
|
46
46
|
const lynxEventName = W3cEventNameToLynx[event.type] ?? event.type;
|
|
47
47
|
const runtimeInfo = elementToRuntimeInfoMap.get(currentTarget);
|
|
48
48
|
if (runtimeInfo) {
|
|
49
|
-
const
|
|
49
|
+
const handlerInfos = (isCapture
|
|
50
50
|
? runtimeInfo.eventHandlerMap[lynxEventName]?.capture
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
: runtimeInfo.eventHandlerMap[lynxEventName]?.bind);
|
|
52
|
+
let stopPropagation = false;
|
|
53
|
+
if (handlerInfos) {
|
|
54
|
+
for (const handlerInfo of handlerInfos) {
|
|
55
|
+
const hname = handlerInfo.handler;
|
|
56
|
+
const crossThreadEvent = createCrossThreadEvent(event, lynxEventName);
|
|
57
|
+
if (typeof hname === 'string') {
|
|
58
|
+
const parentComponentUniqueId = Number(currentTarget.getAttribute(parentComponentUniqueIdAttribute));
|
|
59
|
+
const parentComponent = lynxUniqueIdToElement[parentComponentUniqueId]
|
|
60
|
+
.deref();
|
|
61
|
+
const componentId = parentComponent?.getAttribute(lynxTagAttribute) !== 'page'
|
|
62
|
+
? parentComponent?.getAttribute(componentIdAttribute)
|
|
63
|
+
?? undefined
|
|
64
|
+
: undefined;
|
|
65
|
+
if (componentId) {
|
|
66
|
+
callbacks.publicComponentEvent(componentId, hname, crossThreadEvent);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
callbacks.publishEvent(hname, crossThreadEvent);
|
|
70
|
+
}
|
|
71
|
+
if (handlerInfos.length === 1) {
|
|
72
|
+
stopPropagation = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (hname) {
|
|
76
|
+
crossThreadEvent.target.elementRefptr =
|
|
77
|
+
event.target;
|
|
78
|
+
if (crossThreadEvent.currentTarget) {
|
|
79
|
+
crossThreadEvent.currentTarget
|
|
80
|
+
.elementRefptr = event.currentTarget;
|
|
81
|
+
}
|
|
82
|
+
mtsRealm.globalWindow
|
|
83
|
+
.runWorklet?.(hname.value, [crossThreadEvent]);
|
|
84
|
+
}
|
|
76
85
|
}
|
|
77
|
-
mtsRealm.globalWindow
|
|
78
|
-
.runWorklet?.(hname.value, [crossThreadEvent]);
|
|
79
86
|
}
|
|
87
|
+
return stopPropagation;
|
|
80
88
|
}
|
|
81
89
|
return false;
|
|
82
90
|
};
|
|
@@ -106,9 +114,10 @@ export function createMainThreadGlobalThis(config) {
|
|
|
106
114
|
componentAtIndex: undefined,
|
|
107
115
|
enqueueComponent: undefined,
|
|
108
116
|
};
|
|
109
|
-
const
|
|
117
|
+
const handlerList = (isCapture
|
|
110
118
|
? runtimeInfo.eventHandlerMap[eventName]?.capture
|
|
111
|
-
: runtimeInfo.eventHandlerMap[eventName]?.bind;
|
|
119
|
+
: runtimeInfo.eventHandlerMap[eventName]?.bind);
|
|
120
|
+
const currentHandler = handlerList && handlerList.length > 0;
|
|
112
121
|
const currentRegisteredHandler = isCatch
|
|
113
122
|
? (isCapture ? catchCaptureHandler : defaultCatchHandler)
|
|
114
123
|
: (isCapture ? captureHandler : defaultHandler);
|
|
@@ -126,6 +135,14 @@ export function createMainThreadGlobalThis(config) {
|
|
|
126
135
|
if (isExposure && element.getAttribute('exposure-id') === '-1') {
|
|
127
136
|
mtsGlobalThis.__SetAttribute(element, 'exposure-id', null);
|
|
128
137
|
}
|
|
138
|
+
if (runtimeInfo.eventHandlerMap[eventName]) {
|
|
139
|
+
if (isCapture) {
|
|
140
|
+
runtimeInfo.eventHandlerMap[eventName].capture = undefined;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
runtimeInfo.eventHandlerMap[eventName].bind = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
else {
|
|
@@ -157,11 +174,25 @@ export function createMainThreadGlobalThis(config) {
|
|
|
157
174
|
bind: undefined,
|
|
158
175
|
};
|
|
159
176
|
}
|
|
177
|
+
let targetList = (isCapture
|
|
178
|
+
? runtimeInfo.eventHandlerMap[eventName].capture
|
|
179
|
+
: runtimeInfo.eventHandlerMap[eventName].bind);
|
|
180
|
+
if (!Array.isArray(targetList)) {
|
|
181
|
+
targetList = targetList ? [targetList] : [];
|
|
182
|
+
}
|
|
183
|
+
const typeOfNew = typeof newEventHandler;
|
|
184
|
+
const index = targetList.findIndex((h) => typeof h.handler === typeOfNew);
|
|
185
|
+
if (index !== -1) {
|
|
186
|
+
targetList[index] = info;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
targetList.push(info);
|
|
190
|
+
}
|
|
160
191
|
if (isCapture) {
|
|
161
|
-
runtimeInfo.eventHandlerMap[eventName].capture =
|
|
192
|
+
runtimeInfo.eventHandlerMap[eventName].capture = targetList;
|
|
162
193
|
}
|
|
163
194
|
else {
|
|
164
|
-
runtimeInfo.eventHandlerMap[eventName].bind =
|
|
195
|
+
runtimeInfo.eventHandlerMap[eventName].bind = targetList;
|
|
165
196
|
}
|
|
166
197
|
}
|
|
167
198
|
elementToRuntimeInfoMap.set(element, runtimeInfo);
|
|
@@ -171,9 +202,12 @@ export function createMainThreadGlobalThis(config) {
|
|
|
171
202
|
if (runtimeInfo) {
|
|
172
203
|
eventName = eventName.toLowerCase();
|
|
173
204
|
const isCapture = eventType.startsWith('capture');
|
|
174
|
-
const handler = isCapture
|
|
205
|
+
const handler = (isCapture
|
|
175
206
|
? runtimeInfo.eventHandlerMap[eventName]?.capture
|
|
176
|
-
: runtimeInfo.eventHandlerMap[eventName]?.bind;
|
|
207
|
+
: runtimeInfo.eventHandlerMap[eventName]?.bind);
|
|
208
|
+
if (Array.isArray(handler)) {
|
|
209
|
+
return handler[0]?.handler;
|
|
210
|
+
}
|
|
177
211
|
return handler?.handler;
|
|
178
212
|
}
|
|
179
213
|
else {
|
|
@@ -186,13 +220,18 @@ export function createMainThreadGlobalThis(config) {
|
|
|
186
220
|
for (const [lynxEventName, info] of Object.entries(eventHandlerMap)) {
|
|
187
221
|
for (const atomInfo of [info.bind, info.capture]) {
|
|
188
222
|
if (atomInfo) {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
223
|
+
const handlerList = (Array.isArray(atomInfo)
|
|
224
|
+
? atomInfo
|
|
225
|
+
: [atomInfo]);
|
|
226
|
+
for (const item of handlerList) {
|
|
227
|
+
const { type, handler } = item;
|
|
228
|
+
if (handler) {
|
|
229
|
+
eventInfos.push({
|
|
230
|
+
type: type,
|
|
231
|
+
name: lynxEventName,
|
|
232
|
+
function: handler,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
196
235
|
}
|
|
197
236
|
}
|
|
198
237
|
}
|
|
@@ -272,11 +311,26 @@ export function createMainThreadGlobalThis(config) {
|
|
|
272
311
|
const componentAtIndex = runtimeInfo.componentAtIndex;
|
|
273
312
|
const enqueueComponent = runtimeInfo.enqueueComponent;
|
|
274
313
|
const uniqueId = __GetElementUniqueID(element);
|
|
314
|
+
removeAction.forEach((position, i) => {
|
|
315
|
+
// remove list-item
|
|
316
|
+
const removedEle = element.children[position - i];
|
|
317
|
+
if (removedEle) {
|
|
318
|
+
const sign = __GetElementUniqueID(removedEle);
|
|
319
|
+
enqueueComponent?.(element, uniqueId, sign);
|
|
320
|
+
element.removeChild(removedEle);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
275
323
|
for (const action of insertAction) {
|
|
276
|
-
componentAtIndex?.(element, uniqueId, action.position, 0, false);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
324
|
+
const childSign = componentAtIndex?.(element, uniqueId, action.position, 0, false);
|
|
325
|
+
if (typeof childSign === 'number') {
|
|
326
|
+
const childElement = lynxUniqueIdToElement[childSign]?.deref();
|
|
327
|
+
if (childElement) {
|
|
328
|
+
const referenceNode = element.children[action.position];
|
|
329
|
+
if (referenceNode !== childElement) {
|
|
330
|
+
element.insertBefore(childElement, referenceNode || null);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
280
334
|
}
|
|
281
335
|
}
|
|
282
336
|
});
|
|
@@ -357,6 +411,65 @@ export function createMainThreadGlobalThis(config) {
|
|
|
357
411
|
exposureChangedElements.clear();
|
|
358
412
|
callbacks.flushElementTree(options, timingFlagsCopied, exposureChangedElementsArray);
|
|
359
413
|
};
|
|
414
|
+
const __InvokeUIMethod = (element, method, params, callback) => {
|
|
415
|
+
try {
|
|
416
|
+
if (method === 'boundingClientRect') {
|
|
417
|
+
const rect = element.getBoundingClientRect();
|
|
418
|
+
callback({
|
|
419
|
+
code: ErrorCode.SUCCESS,
|
|
420
|
+
data: {
|
|
421
|
+
id: element.id,
|
|
422
|
+
width: rect.width,
|
|
423
|
+
height: rect.height,
|
|
424
|
+
left: rect.left,
|
|
425
|
+
right: rect.right,
|
|
426
|
+
top: rect.top,
|
|
427
|
+
bottom: rect.bottom,
|
|
428
|
+
},
|
|
429
|
+
});
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (typeof element[method] === 'function') {
|
|
433
|
+
const data = element[method](params);
|
|
434
|
+
callback({
|
|
435
|
+
code: ErrorCode.SUCCESS,
|
|
436
|
+
data,
|
|
437
|
+
});
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
callback({
|
|
441
|
+
code: ErrorCode.METHOD_NOT_FOUND,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
catch (e) {
|
|
445
|
+
console.error(`[lynx-web] invokeUIMethod: apply method failed with`, e, element);
|
|
446
|
+
callback({
|
|
447
|
+
code: ErrorCode.PARAM_INVALID,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const __QuerySelector = (element, selector) => {
|
|
452
|
+
if (!element)
|
|
453
|
+
return null;
|
|
454
|
+
const el = element.querySelector(selector);
|
|
455
|
+
if (el) {
|
|
456
|
+
if (!el.invoke) {
|
|
457
|
+
el.invoke = (method, params) => {
|
|
458
|
+
return new Promise((resolve, reject) => {
|
|
459
|
+
__InvokeUIMethod(el, method, params, (res) => {
|
|
460
|
+
if (res.code === ErrorCode.SUCCESS) {
|
|
461
|
+
resolve(res.data);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
reject(res);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return el;
|
|
472
|
+
};
|
|
360
473
|
const __GetPageElement = () => {
|
|
361
474
|
return pageElement;
|
|
362
475
|
};
|
|
@@ -501,6 +614,8 @@ export function createMainThreadGlobalThis(config) {
|
|
|
501
614
|
_I18nResourceTranslation: callbacks._I18nResourceTranslation,
|
|
502
615
|
_AddEventListener: () => { },
|
|
503
616
|
renderPage: undefined,
|
|
617
|
+
__InvokeUIMethod,
|
|
618
|
+
__QuerySelector,
|
|
504
619
|
};
|
|
505
620
|
Object.assign(mtsRealm.globalWindow, mtsGlobalThis);
|
|
506
621
|
Object.defineProperty(mtsRealm.globalWindow, 'renderPage', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-mainthread-apis",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"hyphenate-style-name": "^1.1.0",
|
|
30
30
|
"wasm-feature-detect": "^1.8.0",
|
|
31
|
-
"@lynx-js/web-constants": "0.19.
|
|
31
|
+
"@lynx-js/web-constants": "0.19.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"binaryen": "^125.0.0",
|
package/wasm/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { referenceTypes } from 'wasm-feature-detect';
|
|
1
|
+
import { referenceTypes, simd } from 'wasm-feature-detect';
|
|
2
2
|
export let wasm;
|
|
3
3
|
export async function initWasm() {
|
|
4
|
-
const supportsReferenceTypes = await
|
|
5
|
-
|
|
4
|
+
const [supportsReferenceTypes, supportsSimd] = await Promise.all([
|
|
5
|
+
referenceTypes(),
|
|
6
|
+
simd(),
|
|
7
|
+
]);
|
|
8
|
+
if (supportsReferenceTypes && supportsSimd) {
|
|
6
9
|
wasm = await import(
|
|
7
10
|
/* webpackMode: "eager" */
|
|
8
11
|
/* webpackFetchPriority: "high" */
|