@lynx-js/web-mainthread-apis 0.18.3 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @lynx-js/web-mainthread-apis
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: capture and bind event listener should be trigger correctly ([#1972](https://github.com/lynx-family/lynx-stack/pull/1972))
8
+
9
+ - fix: the l-p-comp-uid of page should be '1' ([#1970](https://github.com/lynx-family/lynx-stack/pull/1970))
10
+
11
+ - Updated dependencies []:
12
+ - @lynx-js/web-constants@0.19.0
13
+
14
+ ## 0.18.4
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies []:
19
+ - @lynx-js/web-constants@0.18.4
20
+
3
21
  ## 0.18.3
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function transform_raw_u16_inline_style_ptr(str: string): string | undefined;
4
+ export function transform_raw_u16_inline_style_ptr_parsed(name: string, value: string): Array<any> | undefined;
@@ -0,0 +1,5 @@
1
+ import * as wasm from "./debug_bg.wasm";
2
+ export * from "./debug_bg.js";
3
+ import { __wbg_set_wasm } from "./debug_bg.js";
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();
@@ -0,0 +1,150 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
36
+
37
+ let WASM_VECTOR_LEN = 0;
38
+
39
+ const cachedTextEncoder = new TextEncoder();
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
+ };
49
+ }
50
+ }
51
+
52
+ function passStringToWasm0(arg, malloc, realloc) {
53
+
54
+ if (realloc === undefined) {
55
+ const buf = cachedTextEncoder.encode(arg);
56
+ const ptr = malloc(buf.length, 1) >>> 0;
57
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
58
+ WASM_VECTOR_LEN = buf.length;
59
+ return ptr;
60
+ }
61
+
62
+ let len = arg.length;
63
+ let ptr = malloc(len, 1) >>> 0;
64
+
65
+ const mem = getUint8ArrayMemory0();
66
+
67
+ let offset = 0;
68
+
69
+ for (; offset < len; offset++) {
70
+ const code = arg.charCodeAt(offset);
71
+ if (code > 0x7F) break;
72
+ mem[ptr + offset] = code;
73
+ }
74
+
75
+ if (offset !== len) {
76
+ if (offset !== 0) {
77
+ arg = arg.slice(offset);
78
+ }
79
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
80
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
81
+ const ret = cachedTextEncoder.encodeInto(arg, view);
82
+
83
+ offset += ret.written;
84
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
85
+ }
86
+
87
+ WASM_VECTOR_LEN = offset;
88
+ return ptr;
89
+ }
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
+
106
+ /**
107
+ * @param {string} name
108
+ * @param {string} value
109
+ * @returns {Array<any> | undefined}
110
+ */
111
+ export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
112
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
113
+ const len0 = WASM_VECTOR_LEN;
114
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
115
+ const len1 = WASM_VECTOR_LEN;
116
+ const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
117
+ return ret;
118
+ }
119
+
120
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
121
+ throw new Error(getStringFromWasm0(arg0, arg1));
122
+ };
123
+
124
+ export function __wbg_new_e17d9f43105b08be() {
125
+ const ret = new Array();
126
+ return ret;
127
+ };
128
+
129
+ export function __wbg_push_df81a39d04db858c(arg0, arg1) {
130
+ const ret = arg0.push(arg1);
131
+ return ret;
132
+ };
133
+
134
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
135
+ // Cast intrinsic for `Ref(String) -> Externref`.
136
+ const ret = getStringFromWasm0(arg0, arg1);
137
+ return ret;
138
+ };
139
+
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
+
Binary file
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const transform_raw_u16_inline_style_ptr: (a: number, b: number) => [number, number];
5
+ export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => any;
6
+ export const __wbindgen_externrefs: WebAssembly.Table;
7
+ export const __wbindgen_malloc: (a: number, b: number) => number;
8
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
9
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,4 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function transform_raw_u16_inline_style_ptr(str: string): string | undefined;
4
+ export function transform_raw_u16_inline_style_ptr_parsed(name: string, value: string): Array<any> | undefined;
@@ -0,0 +1,4 @@
1
+ import * as wasm from "./legacy_bg.wasm";
2
+ export * from "./legacy_bg.js";
3
+ import { __wbg_set_wasm } from "./legacy_bg.js";
4
+ __wbg_set_wasm(wasm);
@@ -0,0 +1,188 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
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
+ function addHeapObject(obj) {
44
+ if (heap_next === heap.length) heap.push(heap.length + 1);
45
+ const idx = heap_next;
46
+ heap_next = heap[idx];
47
+
48
+ heap[idx] = obj;
49
+ return idx;
50
+ }
51
+
52
+ function getObject(idx) { return heap[idx]; }
53
+
54
+ function dropObject(idx) {
55
+ if (idx < 132) return;
56
+ heap[idx] = heap_next;
57
+ heap_next = idx;
58
+ }
59
+
60
+ function takeObject(idx) {
61
+ const ret = getObject(idx);
62
+ dropObject(idx);
63
+ return ret;
64
+ }
65
+
66
+ let WASM_VECTOR_LEN = 0;
67
+
68
+ const cachedTextEncoder = new TextEncoder();
69
+
70
+ if (!('encodeInto' in cachedTextEncoder)) {
71
+ cachedTextEncoder.encodeInto = function (arg, view) {
72
+ const buf = cachedTextEncoder.encode(arg);
73
+ view.set(buf);
74
+ return {
75
+ read: arg.length,
76
+ written: buf.length
77
+ };
78
+ }
79
+ }
80
+
81
+ function passStringToWasm0(arg, malloc, realloc) {
82
+
83
+ if (realloc === undefined) {
84
+ const buf = cachedTextEncoder.encode(arg);
85
+ const ptr = malloc(buf.length, 1) >>> 0;
86
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
87
+ WASM_VECTOR_LEN = buf.length;
88
+ return ptr;
89
+ }
90
+
91
+ let len = arg.length;
92
+ let ptr = malloc(len, 1) >>> 0;
93
+
94
+ const mem = getUint8ArrayMemory0();
95
+
96
+ let offset = 0;
97
+
98
+ for (; offset < len; offset++) {
99
+ const code = arg.charCodeAt(offset);
100
+ if (code > 0x7F) break;
101
+ mem[ptr + offset] = code;
102
+ }
103
+
104
+ if (offset !== len) {
105
+ if (offset !== 0) {
106
+ arg = arg.slice(offset);
107
+ }
108
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
109
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
110
+ const ret = cachedTextEncoder.encodeInto(arg, view);
111
+
112
+ offset += ret.written;
113
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
114
+ }
115
+
116
+ WASM_VECTOR_LEN = offset;
117
+ return ptr;
118
+ }
119
+
120
+ let cachedDataViewMemory0 = null;
121
+
122
+ function getDataViewMemory0() {
123
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
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
+ }
149
+ }
150
+
151
+ /**
152
+ * @param {string} name
153
+ * @param {string} value
154
+ * @returns {Array<any> | undefined}
155
+ */
156
+ export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
157
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
158
+ const len0 = WASM_VECTOR_LEN;
159
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const len1 = WASM_VECTOR_LEN;
161
+ const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
162
+ return takeObject(ret);
163
+ }
164
+
165
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
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
+ };
173
+
174
+ export function __wbg_push_df81a39d04db858c(arg0, arg1) {
175
+ const ret = getObject(arg0).push(getObject(arg1));
176
+ return ret;
177
+ };
178
+
179
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
180
+ // Cast intrinsic for `Ref(String) -> Externref`.
181
+ const ret = getStringFromWasm0(arg0, arg1);
182
+ return addHeapObject(ret);
183
+ };
184
+
185
+ export function __wbindgen_object_drop_ref(arg0) {
186
+ takeObject(arg0);
187
+ };
188
+
Binary file
@@ -0,0 +1,9 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const transform_raw_u16_inline_style_ptr: (a: number, b: number, c: number) => void;
5
+ export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => number;
6
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
7
+ export const __wbindgen_export: (a: number, b: number) => number;
8
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
9
+ export const __wbindgen_export3: (a: number, b: number, c: number) => void;
@@ -0,0 +1,4 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function transform_raw_u16_inline_style_ptr(str: string): string | undefined;
4
+ export function transform_raw_u16_inline_style_ptr_parsed(name: string, value: string): Array<any> | undefined;
@@ -0,0 +1,5 @@
1
+ import * as wasm from "./standard_bg.wasm";
2
+ export * from "./standard_bg.js";
3
+ import { __wbg_set_wasm } from "./standard_bg.js";
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();
@@ -0,0 +1,150 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
+
18
+ cachedTextDecoder.decode();
19
+
20
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
+ let numBytesDecoded = 0;
22
+ function decodeText(ptr, len) {
23
+ numBytesDecoded += len;
24
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
+ cachedTextDecoder.decode();
27
+ numBytesDecoded = len;
28
+ }
29
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
+ }
31
+
32
+ function getStringFromWasm0(ptr, len) {
33
+ ptr = ptr >>> 0;
34
+ return decodeText(ptr, len);
35
+ }
36
+
37
+ let WASM_VECTOR_LEN = 0;
38
+
39
+ const cachedTextEncoder = new TextEncoder();
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
+ };
49
+ }
50
+ }
51
+
52
+ function passStringToWasm0(arg, malloc, realloc) {
53
+
54
+ if (realloc === undefined) {
55
+ const buf = cachedTextEncoder.encode(arg);
56
+ const ptr = malloc(buf.length, 1) >>> 0;
57
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
58
+ WASM_VECTOR_LEN = buf.length;
59
+ return ptr;
60
+ }
61
+
62
+ let len = arg.length;
63
+ let ptr = malloc(len, 1) >>> 0;
64
+
65
+ const mem = getUint8ArrayMemory0();
66
+
67
+ let offset = 0;
68
+
69
+ for (; offset < len; offset++) {
70
+ const code = arg.charCodeAt(offset);
71
+ if (code > 0x7F) break;
72
+ mem[ptr + offset] = code;
73
+ }
74
+
75
+ if (offset !== len) {
76
+ if (offset !== 0) {
77
+ arg = arg.slice(offset);
78
+ }
79
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
80
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
81
+ const ret = cachedTextEncoder.encodeInto(arg, view);
82
+
83
+ offset += ret.written;
84
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
85
+ }
86
+
87
+ WASM_VECTOR_LEN = offset;
88
+ return ptr;
89
+ }
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
+
106
+ /**
107
+ * @param {string} name
108
+ * @param {string} value
109
+ * @returns {Array<any> | undefined}
110
+ */
111
+ export function transform_raw_u16_inline_style_ptr_parsed(name, value) {
112
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
113
+ const len0 = WASM_VECTOR_LEN;
114
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
115
+ const len1 = WASM_VECTOR_LEN;
116
+ const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
117
+ return ret;
118
+ }
119
+
120
+ export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
121
+ throw new Error(getStringFromWasm0(arg0, arg1));
122
+ };
123
+
124
+ export function __wbg_new_e17d9f43105b08be() {
125
+ const ret = new Array();
126
+ return ret;
127
+ };
128
+
129
+ export function __wbg_push_df81a39d04db858c(arg0, arg1) {
130
+ const ret = arg0.push(arg1);
131
+ return ret;
132
+ };
133
+
134
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
135
+ // Cast intrinsic for `Ref(String) -> Externref`.
136
+ const ret = getStringFromWasm0(arg0, arg1);
137
+ return ret;
138
+ };
139
+
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
+
Binary file
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const transform_raw_u16_inline_style_ptr: (a: number, b: number) => [number, number];
5
+ export const transform_raw_u16_inline_style_ptr_parsed: (a: number, b: number, c: number, d: number) => any;
6
+ export const __wbindgen_externrefs: WebAssembly.Table;
7
+ export const __wbindgen_malloc: (a: number, b: number) => number;
8
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
9
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
+ export const __wbindgen_start: () => void;
@@ -1,7 +1,7 @@
1
- import { type LynxTemplate, type PageConfig, type FlushElementTreeOptions, type Cloneable, type BrowserConfig, type publishEventEndpoint, type publicComponentEventEndpoint, type reportErrorEndpoint, type RpcCallType, type LynxContextEventTarget, type MainThreadGlobalThis, type WebFiberElementImpl, type I18nResourceTranslationOptions, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm, type QueryComponentPAPI } from '@lynx-js/web-constants';
1
+ import { type LynxTemplate, type PageConfig, type FlushElementTreeOptions, type Cloneable, type BrowserConfig, type publishEventEndpoint, type publicComponentEventEndpoint, type reportErrorEndpoint, type RpcCallType, type LynxContextEventTarget, type MainThreadGlobalThis, type I18nResourceTranslationOptions, type SSRHydrateInfo, type SSRDehydrateHooks, type JSRealm, type QueryComponentPAPI } from '@lynx-js/web-constants';
2
2
  export interface MainThreadRuntimeCallbacks {
3
3
  mainChunkReady: () => void;
4
- flushElementTree: (options: FlushElementTreeOptions, timingFlags: string[], exposureChangedElements: WebFiberElementImpl[]) => void;
4
+ flushElementTree: (options: FlushElementTreeOptions | undefined, timingFlags: string[], exposureChangedElements: HTMLElement[]) => void;
5
5
  _ReportError: RpcCallType<typeof reportErrorEndpoint>;
6
6
  __OnLifecycleEvent: (lifeCycleEvent: Cloneable) => void;
7
7
  markTiming: (pipelineId: string, timingKey: string) => void;
@@ -27,12 +27,22 @@ export function createMainThreadGlobalThis(config) {
27
27
  ?.deref();
28
28
  let uniqueIdInc = lynxUniqueIdToElement.length || 1;
29
29
  const exposureChangedElements = new Set();
30
- const commonHandler = (event) => {
30
+ const commonHandler = (event, capture) => {
31
31
  if (!event.currentTarget) {
32
32
  return;
33
33
  }
34
+ // The `capture false` event should not be triggered during the capture-phase
35
+ // The `capture true` event should not be triggered during the bubbling phase
36
+ if ((event.eventPhase === Event.CAPTURING_PHASE && capture === false)
37
+ || (event.eventPhase === Event.BUBBLING_PHASE && capture === true)) {
38
+ return;
39
+ }
34
40
  const currentTarget = event.currentTarget;
35
- const isCapture = event.eventPhase === Event.CAPTURING_PHASE;
41
+ // When the event is triggered by the target element, `event.eventPhase` is always `target`, and the listener type is determined by the passed-in `capture`.
42
+ // When the event is triggered by a non-target element, the listener type is determined by `event.eventPhase` (1, 3).
43
+ const isCapture = event.eventPhase === Event.AT_TARGET
44
+ ? capture
45
+ : event.eventPhase === event.CAPTURING_PHASE;
36
46
  const lynxEventName = W3cEventNameToLynx[event.type] ?? event.type;
37
47
  const runtimeInfo = elementToRuntimeInfoMap.get(currentTarget);
38
48
  if (runtimeInfo) {
@@ -70,11 +80,23 @@ export function createMainThreadGlobalThis(config) {
70
80
  }
71
81
  return false;
72
82
  };
73
- const commonCatchHandler = (event) => {
74
- const handlerTriggered = commonHandler(event);
83
+ const captureHandler = (e) => {
84
+ commonHandler(e, true);
85
+ };
86
+ const defaultHandler = (e) => {
87
+ commonHandler(e, false);
88
+ };
89
+ const commonCatchHandler = (event, isCapture) => {
90
+ const handlerTriggered = commonHandler(event, isCapture);
75
91
  if (handlerTriggered)
76
92
  event.stopPropagation();
77
93
  };
94
+ const catchCaptureHandler = (e) => {
95
+ commonCatchHandler(e, true);
96
+ };
97
+ const defaultCatchHandler = (e) => {
98
+ commonCatchHandler(e, false);
99
+ };
78
100
  const __AddEvent = (element, eventType, eventName, newEventHandler) => {
79
101
  eventName = eventName.toLowerCase();
80
102
  const isCatch = eventType === 'catchEvent' || eventType === 'capture-catch';
@@ -88,8 +110,8 @@ export function createMainThreadGlobalThis(config) {
88
110
  ? runtimeInfo.eventHandlerMap[eventName]?.capture
89
111
  : runtimeInfo.eventHandlerMap[eventName]?.bind;
90
112
  const currentRegisteredHandler = isCatch
91
- ? commonCatchHandler
92
- : commonHandler;
113
+ ? (isCapture ? catchCaptureHandler : defaultCatchHandler)
114
+ : (isCapture ? captureHandler : defaultHandler);
93
115
  if (currentHandler) {
94
116
  if (!newEventHandler) {
95
117
  /**
@@ -210,7 +232,7 @@ export function createMainThreadGlobalThis(config) {
210
232
  const page = __CreateElement('page', 0);
211
233
  page.setAttribute('part', 'page');
212
234
  page.setAttribute(cssIdAttribute, cssID + '');
213
- page.setAttribute(parentComponentUniqueIdAttribute, '0');
235
+ page.setAttribute(parentComponentUniqueIdAttribute, '1');
214
236
  page.setAttribute(componentIdAttribute, componentID);
215
237
  __MarkTemplateElement(page);
216
238
  if (pageConfig.defaultDisplayLinear === false) {
@@ -285,10 +307,8 @@ export function createMainThreadGlobalThis(config) {
285
307
  };
286
308
  const __SwapElement = (childA, childB) => {
287
309
  const temp = document.createElement('div');
288
- // @ts-expect-error fixme
289
310
  childA.replaceWith(temp);
290
311
  childB.replaceWith(childA);
291
- // @ts-expect-error fixme
292
312
  temp.replaceWith(childB);
293
313
  };
294
314
  const __SetCSSIdForCSSOG = (elements, cssId, entryName) => {
@@ -331,7 +351,6 @@ export function createMainThreadGlobalThis(config) {
331
351
  timingFlags = [];
332
352
  if (pageElement && !pageElement.parentNode
333
353
  && pageElement.getAttribute(lynxDisposedAttribute) !== '') {
334
- // @ts-expect-error
335
354
  rootDom.append(pageElement);
336
355
  }
337
356
  const exposureChangedElementsArray = Array.from(exposureChangedElements);
@@ -6,10 +6,8 @@ import { registerCallLepusMethodHandler } from './crossThreadHandlers/registerCa
6
6
  import { registerGetCustomSectionHandler } from './crossThreadHandlers/registerGetCustomSectionHandler.js';
7
7
  import { createMainThreadGlobalThis } from './createMainThreadGlobalThis.js';
8
8
  import { createExposureService } from './utils/createExposureService.js';
9
- import { initWasm } from '@lynx-js/web-style-transformer';
10
9
  import { appendStyleElement } from './utils/processStyleInfo.js';
11
10
  import { createQueryComponent } from './crossThreadHandlers/createQueryComponent.js';
12
- const initWasmPromise = initWasm();
13
11
  export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealmPromise, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
14
12
  const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
15
13
  const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
@@ -25,7 +23,6 @@ export function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mt
25
23
  const { styleInfo, pageConfig, customSections, cardType, } = template;
26
24
  const mtsRealm = await mtsRealmPromise;
27
25
  markTimingInternal('decode_start');
28
- await initWasmPromise;
29
26
  const jsContext = new LynxCrossThreadContext({
30
27
  rpc: backgroundThreadRpc,
31
28
  receiveEventEndpoint: dispatchJSContextOnMainThreadEndpoint,
@@ -1,4 +1,4 @@
1
- import { wasm } from '@lynx-js/web-style-transformer';
1
+ import { wasm } from '../../wasm/index.js';
2
2
  export function transformInlineStyleString(str) {
3
3
  return wasm.transform_raw_u16_inline_style_ptr(str) ?? str;
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-mainthread-apis",
3
- "version": "0.18.3",
3
+ "version": "0.19.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -16,7 +16,9 @@
16
16
  "files": [
17
17
  "dist",
18
18
  "binary",
19
+ "wasm",
19
20
  "!dist/**/*.js.map",
21
+ "!binary/**/*.js.map",
20
22
  "LICENSE.txt",
21
23
  "Notice.txt",
22
24
  "CHANGELOG.md",
@@ -25,7 +27,14 @@
25
27
  ],
26
28
  "dependencies": {
27
29
  "hyphenate-style-name": "^1.1.0",
28
- "@lynx-js/web-constants": "0.18.3",
29
- "@lynx-js/web-style-transformer": "0.18.3"
30
+ "wasm-feature-detect": "^1.8.0",
31
+ "@lynx-js/web-constants": "0.19.0"
32
+ },
33
+ "devDependencies": {
34
+ "binaryen": "^125.0.0",
35
+ "fb-dotslash": "^0.5.8"
36
+ },
37
+ "scripts": {
38
+ "build": "node scripts/build.js"
30
39
  }
31
40
  }
@@ -0,0 +1,3 @@
1
+ export type WASMModule = typeof import('./standard.js');
2
+ export declare let wasm: WASMModule;
3
+ export declare function initWasm(): Promise<void>;
package/wasm/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import { referenceTypes } from 'wasm-feature-detect';
2
+ export let wasm;
3
+ export async function initWasm() {
4
+ const supportsReferenceTypes = await referenceTypes();
5
+ if (supportsReferenceTypes) {
6
+ wasm = await import(
7
+ /* webpackMode: "eager" */
8
+ /* webpackFetchPriority: "high" */
9
+ /* webpackChunkName: "standard-wasm-chunk" */
10
+ /* webpackPrefetch: true */
11
+ /* webpackPreload: true */
12
+ './standard.js'
13
+ );
14
+ } else {
15
+ wasm = await import(
16
+ /* webpackMode: "lazy" */
17
+ /* webpackChunkName: "legacy-wasm-chunk" */
18
+ /* webpackPrefetch: false */
19
+ './legacy.js'
20
+ );
21
+ }
22
+ }
23
+ await initWasm();
package/wasm/legacy.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../binary/legacy.js';
@@ -0,0 +1,9 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function transform_raw_u16_inline_style_ptr(
4
+ str: string,
5
+ ): string | undefined;
6
+ export function transform_raw_u16_inline_style_ptr_parsed(
7
+ name: string,
8
+ value: string,
9
+ ): [[string, string][], [string, string][]] | undefined;
@@ -0,0 +1 @@
1
+ export * from '../binary/standard.js';