@lynx-js/web-core-wasm-canary 0.0.2-canary-20260129-92881e7c → 0.0.2-canary-20260129-d02a6062

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/binary/client/client.d.ts +99 -99
  3. package/binary/client/client.js +381 -391
  4. package/binary/client/client_bg.wasm +0 -0
  5. package/binary/client/client_bg.wasm.d.ts +41 -40
  6. package/binary/client/client_debug.d.ts +102 -102
  7. package/binary/client/client_debug.js +381 -391
  8. package/binary/client/client_debug_bg.wasm +0 -0
  9. package/binary/client/client_debug_bg.wasm.d.ts +44 -43
  10. package/binary/encode/encode.d.ts +10 -59
  11. package/binary/encode/encode.js +151 -330
  12. package/binary/encode/encode_bg.wasm +0 -0
  13. package/binary/encode/encode_bg.wasm.d.ts +4 -24
  14. package/binary/encode/encode_debug.d.ts +10 -59
  15. package/binary/encode/encode_debug.js +82 -333
  16. package/binary/encode/encode_debug_bg.wasm +0 -0
  17. package/binary/encode/encode_debug_bg.wasm.d.ts +5 -25
  18. package/dist/client/decodeWorker/cssLoader.d.ts +1 -1
  19. package/dist/client/decodeWorker/cssLoader.js +2 -3
  20. package/dist/client/decodeWorker/decode.worker.js +4 -3
  21. package/dist/client/mainthread/LynxViewInstance.d.ts +1 -5
  22. package/dist/client/mainthread/LynxViewInstance.js +8 -16
  23. package/dist/client/mainthread/TemplateManager.d.ts +0 -1
  24. package/dist/client/mainthread/TemplateManager.js +5 -29
  25. package/dist/client/mainthread/elementAPIs/WASMJSBinding.d.ts +4 -10
  26. package/dist/client/mainthread/elementAPIs/WASMJSBinding.js +14 -19
  27. package/dist/client/mainthread/elementAPIs/createElementAPI.d.ts +1 -1
  28. package/dist/client/mainthread/elementAPIs/createElementAPI.js +60 -84
  29. package/dist/client/wasm.d.ts +1 -9
  30. package/dist/client/wasm.js +3 -17
  31. package/dist/client/webElementsDynamicLoader.d.ts +0 -7
  32. package/dist/client/webElementsDynamicLoader.js +3 -72
  33. package/dist/client_prod/static/js/async/web-core-main-chunk.js +1 -303
  34. package/dist/client_prod/static/js/async/web-core-template-loader-thread.js +4 -4
  35. package/dist/client_prod/static/js/async/web-elements.js +309 -0
  36. package/dist/client_prod/static/js/client.js +2 -2
  37. package/dist/client_prod/static/wasm/a156b496.module.wasm +0 -0
  38. package/dist/encode/webEncoder.js +1 -16
  39. package/dist/types/DecodedTemplate.d.ts +0 -3
  40. package/dist/types/IElementPAPI.d.ts +0 -2
  41. package/dist/types/IMtsBinding.d.ts +4 -1
  42. package/package.json +3 -4
  43. package/dist/client/mainthread/StyleManager.d.ts +0 -15
  44. package/dist/client/mainthread/StyleManager.js +0 -72
  45. package/dist/client_prod/static/js/async/web-elements-audio.js +0 -1
  46. package/dist/client_prod/static/js/async/web-elements-foldview.js +0 -1
  47. package/dist/client_prod/static/js/async/web-elements-input.js +0 -1
  48. package/dist/client_prod/static/js/async/web-elements-list.js +0 -1
  49. package/dist/client_prod/static/js/async/web-elements-overlay.js +0 -1
  50. package/dist/client_prod/static/js/async/web-elements-refrshview.js +0 -1
  51. package/dist/client_prod/static/js/async/web-elements-swiper.js +0 -1
  52. package/dist/client_prod/static/js/async/web-elements-textarea.js +0 -1
  53. package/dist/client_prod/static/js/async/web-elements-viewpager.js +0 -1
  54. package/dist/client_prod/static/wasm/aa6eb16a.module.wasm +0 -0
  55. package/dist/encode/encodeElementTemplate.d.ts +0 -2
  56. package/dist/encode/encodeElementTemplate.js +0 -52
  57. /package/dist/client_prod/static/css/async/{web-core-main-chunk.css → web-elements.css} +0 -0
@@ -1,301 +1,5 @@
1
1
  /* @ts-self-types="./encode_debug.d.ts" */
2
2
 
3
- export class DecodedStyleData {
4
- __destroy_into_raw() {
5
- const ptr = this.__wbg_ptr;
6
- this.__wbg_ptr = 0;
7
- DecodedStyleDataFinalization.unregister(this);
8
- return ptr;
9
- }
10
- free() {
11
- const ptr = this.__destroy_into_raw();
12
- wasm.__wbg_decodedstyledata_free(ptr, 0);
13
- }
14
- /**
15
- * @param {Uint8Array} buffer
16
- * @param {string | null | undefined} entry_name
17
- * @param {boolean} config_enable_css_selector
18
- * @returns {Uint8Array}
19
- */
20
- static decode_into(buffer, entry_name, config_enable_css_selector) {
21
- var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
22
- var len0 = WASM_VECTOR_LEN;
23
- const ret = wasm.decodedstyledata_decode_into(buffer, ptr0, len0, config_enable_css_selector);
24
- if (ret[2]) {
25
- throw takeFromExternrefTable0(ret[1]);
26
- }
27
- return takeFromExternrefTable0(ret[0]);
28
- }
29
- /**
30
- * @param {RawStyleInfo} raw_style_info
31
- * @param {boolean} config_enable_css_selector
32
- * @param {string | null} [entry_name]
33
- * @returns {Uint8Array}
34
- */
35
- static encode_from_raw_style_info(raw_style_info, config_enable_css_selector, entry_name) {
36
- _assertClass(raw_style_info, RawStyleInfo);
37
- var ptr0 = raw_style_info.__destroy_into_raw();
38
- var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
39
- var len1 = WASM_VECTOR_LEN;
40
- const ret = wasm.decodedstyledata_encode_from_raw_style_info(ptr0, config_enable_css_selector, ptr1, len1);
41
- if (ret[2]) {
42
- throw takeFromExternrefTable0(ret[1]);
43
- }
44
- return takeFromExternrefTable0(ret[0]);
45
- }
46
- /**
47
- * @returns {string}
48
- */
49
- get font_face_content() {
50
- let deferred1_0;
51
- let deferred1_1;
52
- try {
53
- const ret = wasm.decodedstyledata_font_face_content(this.__wbg_ptr);
54
- deferred1_0 = ret[0];
55
- deferred1_1 = ret[1];
56
- return getStringFromWasm0(ret[0], ret[1]);
57
- } finally {
58
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
59
- }
60
- }
61
- /**
62
- * @param {Uint8Array} buffer
63
- */
64
- constructor(buffer) {
65
- const ret = wasm.decodedstyledata_new(buffer);
66
- if (ret[2]) {
67
- throw takeFromExternrefTable0(ret[1]);
68
- }
69
- this.__wbg_ptr = ret[0] >>> 0;
70
- DecodedStyleDataFinalization.register(this, this.__wbg_ptr, this);
71
- return this;
72
- }
73
- /**
74
- * @param {number} css_id
75
- * @param {string[]} class_name
76
- * @returns {string}
77
- */
78
- query_css_og_declarations_by_css_id(css_id, class_name) {
79
- let deferred2_0;
80
- let deferred2_1;
81
- try {
82
- const ptr0 = passArrayJsValueToWasm0(class_name, wasm.__wbindgen_malloc);
83
- const len0 = WASM_VECTOR_LEN;
84
- const ret = wasm.decodedstyledata_query_css_og_declarations_by_css_id(this.__wbg_ptr, css_id, ptr0, len0);
85
- deferred2_0 = ret[0];
86
- deferred2_1 = ret[1];
87
- return getStringFromWasm0(ret[0], ret[1]);
88
- } finally {
89
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
90
- }
91
- }
92
- /**
93
- * @returns {string}
94
- */
95
- get style_content() {
96
- let deferred1_0;
97
- let deferred1_1;
98
- try {
99
- const ret = wasm.decodedstyledata_style_content(this.__wbg_ptr);
100
- deferred1_0 = ret[0];
101
- deferred1_1 = ret[1];
102
- return getStringFromWasm0(ret[0], ret[1]);
103
- } finally {
104
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
105
- }
106
- }
107
- }
108
- if (Symbol.dispose) DecodedStyleData.prototype[Symbol.dispose] = DecodedStyleData.prototype.free;
109
-
110
- export class ElementTemplateSection {
111
- static __wrap(ptr) {
112
- ptr = ptr >>> 0;
113
- const obj = Object.create(ElementTemplateSection.prototype);
114
- obj.__wbg_ptr = ptr;
115
- ElementTemplateSectionFinalization.register(obj, obj.__wbg_ptr, obj);
116
- return obj;
117
- }
118
- __destroy_into_raw() {
119
- const ptr = this.__wbg_ptr;
120
- this.__wbg_ptr = 0;
121
- ElementTemplateSectionFinalization.unregister(this);
122
- return ptr;
123
- }
124
- free() {
125
- const ptr = this.__destroy_into_raw();
126
- wasm.__wbg_elementtemplatesection_free(ptr, 0);
127
- }
128
- /**
129
- * @param {string} id
130
- * @param {RawElementTemplate} raw_element_template
131
- */
132
- add_element_template(id, raw_element_template) {
133
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
134
- const len0 = WASM_VECTOR_LEN;
135
- _assertClass(raw_element_template, RawElementTemplate);
136
- var ptr1 = raw_element_template.__destroy_into_raw();
137
- wasm.elementtemplatesection_add_element_template(this.__wbg_ptr, ptr0, len0, ptr1);
138
- }
139
- /**
140
- * @returns {Uint8Array}
141
- */
142
- encode() {
143
- const ret = wasm.elementtemplatesection_encode(this.__wbg_ptr);
144
- return ret;
145
- }
146
- /**
147
- * @param {Uint8Array} buffer
148
- * @returns {ElementTemplateSection}
149
- */
150
- static from_encoded(buffer) {
151
- const ret = wasm.elementtemplatesection_from_encoded(buffer);
152
- if (ret[2]) {
153
- throw takeFromExternrefTable0(ret[1]);
154
- }
155
- return ElementTemplateSection.__wrap(ret[0]);
156
- }
157
- constructor() {
158
- const ret = wasm.elementtemplatesection_new();
159
- this.__wbg_ptr = ret >>> 0;
160
- ElementTemplateSectionFinalization.register(this, this.__wbg_ptr, this);
161
- return this;
162
- }
163
- }
164
- if (Symbol.dispose) ElementTemplateSection.prototype[Symbol.dispose] = ElementTemplateSection.prototype.free;
165
-
166
- /**
167
- * @enum {1 | 3 | 5 | 6 | 7 | 8 | 10 | 11 | 12}
168
- */
169
- export const LEOAsmOpcode = Object.freeze({
170
- SetAttribute: 1, "1": "SetAttribute",
171
- RemoveChild: 3, "3": "RemoveChild",
172
- AppendChild: 5, "5": "AppendChild",
173
- CreateElement: 6, "6": "CreateElement",
174
- SetAttributeSlot: 7, "7": "SetAttributeSlot",
175
- AppendElementSlot: 8, "8": "AppendElementSlot",
176
- SetDataset: 10, "10": "SetDataset",
177
- AddEvent: 11, "11": "AddEvent",
178
- AppendToRoot: 12, "12": "AppendToRoot",
179
- });
180
-
181
- export class Operation {
182
- __destroy_into_raw() {
183
- const ptr = this.__wbg_ptr;
184
- this.__wbg_ptr = 0;
185
- OperationFinalization.unregister(this);
186
- return ptr;
187
- }
188
- free() {
189
- const ptr = this.__destroy_into_raw();
190
- wasm.__wbg_operation_free(ptr, 0);
191
- }
192
- }
193
- if (Symbol.dispose) Operation.prototype[Symbol.dispose] = Operation.prototype.free;
194
-
195
- export class RawElementTemplate {
196
- __destroy_into_raw() {
197
- const ptr = this.__wbg_ptr;
198
- this.__wbg_ptr = 0;
199
- RawElementTemplateFinalization.unregister(this);
200
- return ptr;
201
- }
202
- free() {
203
- const ptr = this.__destroy_into_raw();
204
- wasm.__wbg_rawelementtemplate_free(ptr, 0);
205
- }
206
- /**
207
- * @param {number} parent_element_id
208
- * @param {number} child_element_id
209
- */
210
- append_child(parent_element_id, child_element_id) {
211
- wasm.rawelementtemplate_append_child(this.__wbg_ptr, parent_element_id, child_element_id);
212
- }
213
- /**
214
- * @param {number} parent_element_id
215
- * @param {number} child_element_slot_id
216
- */
217
- append_element_slot(parent_element_id, child_element_slot_id) {
218
- wasm.rawelementtemplate_append_element_slot(this.__wbg_ptr, parent_element_id, child_element_slot_id);
219
- }
220
- /**
221
- * @param {number} element_id
222
- */
223
- append_to_root(element_id) {
224
- wasm.rawelementtemplate_append_to_root(this.__wbg_ptr, element_id);
225
- }
226
- /**
227
- * @param {string} tag_names
228
- * @param {number} element_id
229
- */
230
- create_element(tag_names, element_id) {
231
- const ptr0 = passStringToWasm0(tag_names, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
- const len0 = WASM_VECTOR_LEN;
233
- wasm.rawelementtemplate_create_element(this.__wbg_ptr, ptr0, len0, element_id);
234
- }
235
- constructor() {
236
- const ret = wasm.rawelementtemplate_new();
237
- this.__wbg_ptr = ret >>> 0;
238
- RawElementTemplateFinalization.register(this, this.__wbg_ptr, this);
239
- return this;
240
- }
241
- /**
242
- * @param {number} element_id
243
- * @param {string} attr_name
244
- * @param {string} attr_value
245
- */
246
- set_attribute(element_id, attr_name, attr_value) {
247
- const ptr0 = passStringToWasm0(attr_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
248
- const len0 = WASM_VECTOR_LEN;
249
- const ptr1 = passStringToWasm0(attr_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
250
- const len1 = WASM_VECTOR_LEN;
251
- wasm.rawelementtemplate_set_attribute(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
252
- }
253
- /**
254
- * @param {number} element_id
255
- * @param {number} attribute_slot_id
256
- * @param {string} attr_name
257
- */
258
- set_attribute_slot(element_id, attribute_slot_id, attr_name) {
259
- const ptr0 = passStringToWasm0(attr_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
260
- const len0 = WASM_VECTOR_LEN;
261
- wasm.rawelementtemplate_set_attribute_slot(this.__wbg_ptr, element_id, attribute_slot_id, ptr0, len0);
262
- }
263
- /**
264
- * @param {number} element_id
265
- * @param {string} event_type
266
- * @param {string} event_name
267
- * @param {string} event_value
268
- */
269
- set_cross_thread_event(element_id, event_type, event_name, event_value) {
270
- const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
271
- const len0 = WASM_VECTOR_LEN;
272
- const ptr1 = passStringToWasm0(event_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
- const len1 = WASM_VECTOR_LEN;
274
- const ptr2 = passStringToWasm0(event_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
275
- const len2 = WASM_VECTOR_LEN;
276
- wasm.rawelementtemplate_set_cross_thread_event(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1, ptr2, len2);
277
- }
278
- /**
279
- * @param {number} element_id
280
- * @param {string} data_name
281
- * @param {string} data_value
282
- */
283
- set_dataset(element_id, data_name, data_value) {
284
- const ptr0 = passStringToWasm0(data_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
285
- const len0 = WASM_VECTOR_LEN;
286
- const ptr1 = passStringToWasm0(data_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
287
- const len1 = WASM_VECTOR_LEN;
288
- wasm.rawelementtemplate_set_dataset(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
289
- }
290
- }
291
- if (Symbol.dispose) RawElementTemplate.prototype[Symbol.dispose] = RawElementTemplate.prototype.free;
292
-
293
- /**
294
- *
295
- * * key: cssId
296
- * * value: StyleSheet
297
- *
298
- */
299
3
  export class RawStyleInfo {
300
4
  __destroy_into_raw() {
301
5
  const ptr = this.__wbg_ptr;
@@ -322,7 +26,7 @@ export class RawStyleInfo {
322
26
  }
323
27
  /**
324
28
  *
325
- * * Encodes the RawStyleInfo into a Uint8Array using bincode serialization.
29
+ * * Encodes the RawStyleInfo into a Uint8Array using rkyv serialization.
326
30
  * * @returns A Uint8Array containing the serialized RawStyleInfo.
327
31
  *
328
32
  * @returns {Uint8Array}
@@ -390,6 +94,7 @@ export class Rule {
390
94
  /**
391
95
  *
392
96
  * * Pushes a declaration to the rule's declaration block.
97
+ * * LynxJS doesn't support !important
393
98
  * * @param property_name - The property name.
394
99
  * * @param value - The property value.
395
100
  *
@@ -524,6 +229,86 @@ export class StyleInfoDecoder {
524
229
  }
525
230
  if (Symbol.dispose) StyleInfoDecoder.prototype[Symbol.dispose] = StyleInfoDecoder.prototype.free;
526
231
 
232
+ /**
233
+ * @param {Uint8Array} buffer
234
+ * @param {string | null | undefined} entry_name
235
+ * @param {boolean} config_enable_css_selector
236
+ * @returns {Uint8Array}
237
+ */
238
+ export function decode_style_info(buffer, entry_name, config_enable_css_selector) {
239
+ var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
+ var len0 = WASM_VECTOR_LEN;
241
+ const ret = wasm.decode_style_info(buffer, ptr0, len0, config_enable_css_selector);
242
+ if (ret[2]) {
243
+ throw takeFromExternrefTable0(ret[1]);
244
+ }
245
+ return takeFromExternrefTable0(ret[0]);
246
+ }
247
+
248
+ /**
249
+ * @param {RawStyleInfo} raw_style_info
250
+ * @param {boolean} config_enable_css_selector
251
+ * @param {string | null} [entry_name]
252
+ * @returns {Uint8Array}
253
+ */
254
+ export function encode_legacy_json_generated_raw_style_info(raw_style_info, config_enable_css_selector, entry_name) {
255
+ _assertClass(raw_style_info, RawStyleInfo);
256
+ var ptr0 = raw_style_info.__destroy_into_raw();
257
+ var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
258
+ var len1 = WASM_VECTOR_LEN;
259
+ const ret = wasm.encode_legacy_json_generated_raw_style_info(ptr0, config_enable_css_selector, ptr1, len1);
260
+ if (ret[2]) {
261
+ throw takeFromExternrefTable0(ret[1]);
262
+ }
263
+ return takeFromExternrefTable0(ret[0]);
264
+ }
265
+
266
+ /**
267
+ * @param {Uint8Array} buffer
268
+ * @returns {string}
269
+ */
270
+ export function get_font_face_content(buffer) {
271
+ let deferred2_0;
272
+ let deferred2_1;
273
+ try {
274
+ const ret = wasm.get_font_face_content(buffer);
275
+ var ptr1 = ret[0];
276
+ var len1 = ret[1];
277
+ if (ret[3]) {
278
+ ptr1 = 0; len1 = 0;
279
+ throw takeFromExternrefTable0(ret[2]);
280
+ }
281
+ deferred2_0 = ptr1;
282
+ deferred2_1 = len1;
283
+ return getStringFromWasm0(ptr1, len1);
284
+ } finally {
285
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
286
+ }
287
+ }
288
+
289
+ /**
290
+ * @param {Uint8Array} buffer
291
+ * @returns {string}
292
+ */
293
+ export function get_style_content(buffer) {
294
+ let deferred2_0;
295
+ let deferred2_1;
296
+ try {
297
+ const ret = wasm.get_style_content(buffer);
298
+ var ptr1 = ret[0];
299
+ var len1 = ret[1];
300
+ if (ret[3]) {
301
+ ptr1 = 0; len1 = 0;
302
+ throw takeFromExternrefTable0(ret[2]);
303
+ }
304
+ deferred2_0 = ptr1;
305
+ deferred2_1 = len1;
306
+ return getStringFromWasm0(ptr1, len1);
307
+ } finally {
308
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
309
+ }
310
+ }
311
+
527
312
  function __wbg_get_imports() {
528
313
  const import0 = {
529
314
  __proto__: null,
@@ -538,14 +323,6 @@ function __wbg_get_imports() {
538
323
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
539
324
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
540
325
  },
541
- __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
542
- const obj = arg1;
543
- const ret = typeof(obj) === 'string' ? obj : undefined;
544
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
- var len1 = WASM_VECTOR_LEN;
546
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
547
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
548
- },
549
326
  __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
550
327
  throw new Error(getStringFromWasm0(arg0, arg1));
551
328
  },
@@ -576,18 +353,6 @@ function __wbg_get_imports() {
576
353
  };
577
354
  }
578
355
 
579
- const DecodedStyleDataFinalization = (typeof FinalizationRegistry === 'undefined')
580
- ? { register: () => {}, unregister: () => {} }
581
- : new FinalizationRegistry(ptr => wasm.__wbg_decodedstyledata_free(ptr >>> 0, 1));
582
- const ElementTemplateSectionFinalization = (typeof FinalizationRegistry === 'undefined')
583
- ? { register: () => {}, unregister: () => {} }
584
- : new FinalizationRegistry(ptr => wasm.__wbg_elementtemplatesection_free(ptr >>> 0, 1));
585
- const OperationFinalization = (typeof FinalizationRegistry === 'undefined')
586
- ? { register: () => {}, unregister: () => {} }
587
- : new FinalizationRegistry(ptr => wasm.__wbg_operation_free(ptr >>> 0, 1));
588
- const RawElementTemplateFinalization = (typeof FinalizationRegistry === 'undefined')
589
- ? { register: () => {}, unregister: () => {} }
590
- : new FinalizationRegistry(ptr => wasm.__wbg_rawelementtemplate_free(ptr >>> 0, 1));
591
356
  const RawStyleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
592
357
  ? { register: () => {}, unregister: () => {} }
593
358
  : new FinalizationRegistry(ptr => wasm.__wbg_rawstyleinfo_free(ptr >>> 0, 1));
@@ -604,12 +369,6 @@ const StyleInfoDecoderFinalization = (typeof FinalizationRegistry === 'undefined
604
369
  ? { register: () => {}, unregister: () => {} }
605
370
  : new FinalizationRegistry(ptr => wasm.__wbg_styleinfodecoder_free(ptr >>> 0, 1));
606
371
 
607
- function addToExternrefTable0(obj) {
608
- const idx = wasm.__externref_table_alloc();
609
- wasm.__wbindgen_externrefs.set(idx, obj);
610
- return idx;
611
- }
612
-
613
372
  function _assertClass(instance, klass) {
614
373
  if (!(instance instanceof klass)) {
615
374
  throw new Error(`expected instance of ${klass.name}`);
@@ -711,16 +470,6 @@ function isLikeNone(x) {
711
470
  return x === undefined || x === null;
712
471
  }
713
472
 
714
- function passArrayJsValueToWasm0(array, malloc) {
715
- const ptr = malloc(array.length * 4, 4) >>> 0;
716
- for (let i = 0; i < array.length; i++) {
717
- const add = addToExternrefTable0(array[i]);
718
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
719
- }
720
- WASM_VECTOR_LEN = array.length;
721
- return ptr;
722
- }
723
-
724
473
  function passStringToWasm0(arg, malloc, realloc) {
725
474
  if (realloc === undefined) {
726
475
  const buf = cachedTextEncoder.encode(arg);
Binary file
@@ -1,17 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_styleinfodecoder_free: (a: number, b: number) => void;
5
- export const __wbg_rawelementtemplate_free: (a: number, b: number) => void;
6
- export const rawelementtemplate_append_child: (a: number, b: number, c: number) => void;
7
- export const rawelementtemplate_append_element_slot: (a: number, b: number, c: number) => void;
8
- export const rawelementtemplate_append_to_root: (a: number, b: number) => void;
9
- export const rawelementtemplate_create_element: (a: number, b: number, c: number, d: number) => void;
10
- export const rawelementtemplate_new: () => number;
11
- export const rawelementtemplate_set_attribute: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
- export const rawelementtemplate_set_attribute_slot: (a: number, b: number, c: number, d: number, e: number) => void;
13
- export const rawelementtemplate_set_cross_thread_event: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
14
- export const rawelementtemplate_set_dataset: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
15
4
  export const __wbg_rawstyleinfo_free: (a: number, b: number) => void;
16
5
  export const __wbg_rule_free: (a: number, b: number) => void;
17
6
  export const __wbg_ruleprelude_free: (a: number, b: number) => void;
@@ -28,23 +17,14 @@ export const ruleprelude_new: () => number;
28
17
  export const ruleprelude_push_selector: (a: number, b: number) => void;
29
18
  export const selector_new: () => number;
30
19
  export const selector_push_one_selector_section: (a: number, b: number, c: number, d: number, e: number) => [number, number];
31
- export const __wbg_decodedstyledata_free: (a: number, b: number) => void;
32
- export const decodedstyledata_decode_into: (a: any, b: number, c: number, d: number) => [number, number, number];
33
- export const decodedstyledata_encode_from_raw_style_info: (a: number, b: number, c: number, d: number) => [number, number, number];
34
- export const decodedstyledata_font_face_content: (a: number) => [number, number];
35
- export const decodedstyledata_new: (a: any) => [number, number, number];
36
- export const decodedstyledata_query_css_og_declarations_by_css_id: (a: number, b: number, c: number, d: number) => [number, number];
37
- export const decodedstyledata_style_content: (a: number) => [number, number];
38
- export const __wbg_operation_free: (a: number, b: number) => void;
39
- export const __wbg_elementtemplatesection_free: (a: number, b: number) => void;
40
- export const elementtemplatesection_add_element_template: (a: number, b: number, c: number, d: number) => void;
41
- export const elementtemplatesection_encode: (a: number) => any;
42
- export const elementtemplatesection_from_encoded: (a: any) => [number, number, number];
43
- export const elementtemplatesection_new: () => number;
20
+ export const decode_style_info: (a: any, b: number, c: number, d: number) => [number, number, number];
21
+ export const encode_legacy_json_generated_raw_style_info: (a: number, b: number, c: number, d: number) => [number, number, number];
22
+ export const get_font_face_content: (a: any) => [number, number, number, number];
23
+ export const get_style_content: (a: any) => [number, number, number, number];
24
+ export const __wbg_styleinfodecoder_free: (a: number, b: number) => void;
44
25
  export const __wbindgen_malloc: (a: number, b: number) => number;
45
26
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
46
27
  export const __wbindgen_externrefs: WebAssembly.Table;
47
28
  export const __externref_table_dealloc: (a: number) => void;
48
29
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
49
- export const __externref_table_alloc: () => number;
50
30
  export const __wbindgen_start: () => void;
@@ -8,5 +8,5 @@ interface OneInfo {
8
8
  imports?: string[];
9
9
  }
10
10
  type StyleInfo = Record<string, OneInfo>;
11
- export declare function loadStyleFromJSON(styleInfo: StyleInfo, configEnableCssSelector: boolean, entryName?: string): Uint8Array;
11
+ export declare function loadStyleFromJSON(styleInfo: StyleInfo, configEnableCSSSelector: boolean, entryName?: string): Uint8Array;
12
12
  export {};
@@ -1,5 +1,5 @@
1
1
  import { wasmInstance } from '../wasm.js';
2
- export function loadStyleFromJSON(styleInfo, configEnableCssSelector, entryName) {
2
+ export function loadStyleFromJSON(styleInfo, configEnableCSSSelector, entryName) {
3
3
  const rawStyleInfo = new wasmInstance.RawStyleInfo();
4
4
  for (const [cssIdStr, info] of Object.entries(styleInfo)) {
5
5
  const cssId = parseInt(cssIdStr, 10);
@@ -64,8 +64,7 @@ export function loadStyleFromJSON(styleInfo, configEnableCssSelector, entryName)
64
64
  rawStyleInfo.push_rule(cssId, wasmRule);
65
65
  }
66
66
  }
67
- // Use the new Rust method
68
- return wasmInstance.DecodedStyleData.encode_from_raw_style_info(rawStyleInfo, configEnableCssSelector, entryName);
67
+ return wasmInstance.encode_legacy_json_generated_raw_style_info(rawStyleInfo, configEnableCSSSelector, entryName);
69
68
  }
70
69
  function parseAndPushSelector(selector, s) {
71
70
  if (s.startsWith('.')) {
@@ -1,5 +1,5 @@
1
1
  import { TemplateSectionLabel, MagicHeader } from '../../constants.js';
2
- import { DecodedStyle, wasmInstance } from '../wasm.js';
2
+ import { wasmInstance } from '../wasm.js';
3
3
  let wasmModuleLoadedResolve;
4
4
  const wasmModuleLoadedPromise = new Promise((resolve) => {
5
5
  wasmModuleLoadedResolve = resolve;
@@ -188,7 +188,7 @@ async function handleStream(url, reader, overrideConfig) {
188
188
  }
189
189
  case TemplateSectionLabel.StyleInfo: {
190
190
  await wasmModuleLoadedPromise;
191
- const buffer = DecodedStyle.webWorkerDecode(content, config['enableCSSSelector'] === 'true', config['isLazy'] === 'true' ? url : undefined);
191
+ const buffer = wasmInstance.decode_style_info(content, config['isLazy'] === 'true' ? url : undefined, config['enableCSSSelector'] === 'true');
192
192
  postMessage({
193
193
  type: 'section',
194
194
  label,
@@ -252,6 +252,7 @@ async function handleJSON(json, url, overrideConfig) {
252
252
  if (overrideConfig) {
253
253
  config = { ...config, ...overrideConfig };
254
254
  }
255
+ config = Object.fromEntries(Object.entries(config).map(([key, value]) => [key, value.toString()]));
255
256
  postMessage({
256
257
  type: 'section',
257
258
  label: TemplateSectionLabel.Configurations,
@@ -328,7 +329,7 @@ async function handleJSON(json, url, overrideConfig) {
328
329
  });
329
330
  }
330
331
  // ElementTemplates
331
- if (json.elementTemplates) {
332
+ if (json.elementTemplates && Object.keys(json.elementTemplates).length > 0) {
332
333
  // TemplateManager expects Uint8Array for ElementTemplates.
333
334
  // We can't support this easily for JSON.
334
335
  throw new Error('ElementTemplates in JSON artifacts are not supported yet.');
@@ -1,11 +1,9 @@
1
1
  import type { Cloneable, InitI18nResources, JSRealm, MainThreadGlobalThis, NapiModulesMap, NativeModulesMap, PageConfig } from '../../types/index.js';
2
- import type { DecodedStyle } from '../wasm.js';
3
2
  import { BackgroundThread } from './Background.js';
4
3
  import { I18nManager } from './I18n.js';
5
4
  import { WASMJSBinding } from './elementAPIs/WASMJSBinding.js';
6
5
  import { ExposureServices } from './ExposureServices.js';
7
6
  import type { LynxViewElement } from './LynxView.js';
8
- import { StyleManager } from './StyleManager.js';
9
7
  export declare const systemInfo: Readonly<{
10
8
  pixelRatio: number;
11
9
  pixelWidth: number;
@@ -38,15 +36,13 @@ export declare class LynxViewInstance implements AsyncDisposable {
38
36
  readonly webElementsLoadingPromises: Promise<void>[];
39
37
  readonly styleReadyPromise: Promise<void>;
40
38
  readonly styleReadyResolve: () => void;
41
- styleManager?: StyleManager;
42
39
  lepusCodeUrls: Map<string, Record<string, string>>;
43
40
  constructor(parentDom: LynxViewElement, initData: Cloneable, globalprops: Cloneable, templateUrl: string, rootDom: ShadowRoot, mtsRealm: JSRealm, lynxGroupId: number | undefined, nativeModulesMap?: NativeModulesMap, napiModulesMap?: NapiModulesMap, initI18nResources?: InitI18nResources);
44
41
  onPageConfigReady(config: PageConfig): void;
45
- onStyleInfoReady(styleInfo: DecodedStyle, currentUrl: string): void;
42
+ onStyleInfoReady(currentUrl: string): void;
46
43
  onMTSScriptsLoaded(currentUrl: string, isLazy: boolean): void;
47
44
  onMTSScriptsExecuted(): Promise<void>;
48
45
  onBTSScriptsLoaded(url: string): Promise<void>;
49
- loadWebElement(id: number): void;
50
46
  loadUnknownElement(tagName: string): void;
51
47
  queryComponent(url: string): Promise<unknown>;
52
48
  updateData(data: Cloneable, processorName?: string): Promise<void>;
@@ -6,8 +6,8 @@ import { ExposureServices } from './ExposureServices.js';
6
6
  import { createElementAPI } from './elementAPIs/createElementAPI.js';
7
7
  import { createMainThreadGlobalAPIs } from './createMainThreadGlobalAPIs.js';
8
8
  import { templateManager } from './TemplateManager.js';
9
- import { loadAllWebElements, loadWebElement, } from '../webElementsDynamicLoader.js';
10
- import { StyleManager } from './StyleManager.js';
9
+ import { loadAllWebElements } from '../webElementsDynamicLoader.js';
10
+ import { templateManagerWasm } from '../wasm.js';
11
11
  const pixelRatio = window.devicePixelRatio;
12
12
  const screenWidth = window.screen.availWidth * pixelRatio;
13
13
  const screenHeight = window.screen.availHeight * pixelRatio;
@@ -33,7 +33,6 @@ export class LynxViewInstance {
33
33
  webElementsLoadingPromises = [];
34
34
  styleReadyPromise;
35
35
  styleReadyResolve;
36
- styleManager;
37
36
  #renderPageFunction = null;
38
37
  #queryComponentCache = new Map();
39
38
  #pageConfig;
@@ -72,8 +71,7 @@ export class LynxViewInstance {
72
71
  const enableCSSSelector = config['enableCSSSelector'] == 'true';
73
72
  const defaultDisplayLinear = config['defaultDisplayLinear'] == 'true';
74
73
  const defaultOverflowVisible = config['defaultOverflowVisible'] == 'true';
75
- this.styleManager = new StyleManager(this.rootDom);
76
- Object.assign(this.mtsRealm.globalWindow, createElementAPI(this.templateUrl, this.rootDom, this.mtsWasmBinding, enableCSSSelector, defaultDisplayLinear, defaultOverflowVisible), createMainThreadGlobalAPIs(this));
74
+ Object.assign(this.mtsRealm.globalWindow, createElementAPI(this.rootDom, this.mtsWasmBinding, enableCSSSelector, defaultDisplayLinear, defaultOverflowVisible), createMainThreadGlobalAPIs(this));
77
75
  Object.defineProperty(this.mainThreadGlobalThis, 'renderPage', {
78
76
  get: () => {
79
77
  return this.#renderPageFunction;
@@ -86,8 +84,10 @@ export class LynxViewInstance {
86
84
  enumerable: true,
87
85
  });
88
86
  }
89
- onStyleInfoReady(styleInfo, currentUrl) {
90
- this.styleManager?.pushStyleSheet(styleInfo, currentUrl === this.templateUrl ? undefined : currentUrl);
87
+ onStyleInfoReady(currentUrl) {
88
+ if (this.mtsWasmBinding.wasmContext) {
89
+ this.mtsWasmBinding.wasmContext.push_style_sheet(templateManagerWasm, currentUrl, this.templateUrl === currentUrl);
90
+ }
91
91
  this.parentDom.style.display = 'flex';
92
92
  this.styleReadyResolve();
93
93
  }
@@ -102,9 +102,7 @@ export class LynxViewInstance {
102
102
  }
103
103
  async onMTSScriptsExecuted() {
104
104
  this.backgroundThread.markTiming('lepus_execute_end');
105
- if (!templateManager.getTemplate(this.templateUrl)?.elementTemplates) {
106
- this.webElementsLoadingPromises.push(loadAllWebElements());
107
- }
105
+ this.webElementsLoadingPromises.push(loadAllWebElements());
108
106
  await Promise.all([
109
107
  ...this.webElementsLoadingPromises,
110
108
  this.styleReadyPromise,
@@ -125,12 +123,6 @@ export class LynxViewInstance {
125
123
  await this.backgroundThread.updateBTSChunk(url, btsUrls);
126
124
  this.backgroundThread.startBTS();
127
125
  }
128
- loadWebElement(id) {
129
- const loadPromise = loadWebElement(id);
130
- if (loadPromise) {
131
- this.webElementsLoadingPromises.push(loadPromise);
132
- }
133
- }
134
126
  loadUnknownElement(tagName) {
135
127
  if (tagName.includes('-') && !customElements.get(tagName)) {
136
128
  this.rootDom.dispatchEvent(new CustomEvent(loadUnknownElementEventName, {
@@ -5,7 +5,6 @@ export declare class TemplateManager {
5
5
  constructor();
6
6
  fetchBundle(url: string, lynxViewInstancePromise: Promise<LynxViewInstance>, overrideConfig?: Record<string, string>): Promise<void>;
7
7
  createTemplate(url: string): void;
8
- setElementTemplateSection(url: string, section: any): void;
9
8
  getTemplate(url: string): DecodedTemplate | undefined;
10
9
  }
11
10
  export declare const templateManager: TemplateManager;