@lynx-js/web-core-wasm 0.0.2 → 0.0.4

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 (60) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/binary/client/client.d.ts +6 -8
  3. package/binary/client/client.js +21 -28
  4. package/binary/client/client_bg.wasm +0 -0
  5. package/binary/client/client_bg.wasm.d.ts +3 -4
  6. package/binary/client/client_debug.d.ts +32 -34
  7. package/binary/client/client_debug.js +21 -28
  8. package/binary/client/client_debug_bg.wasm +0 -0
  9. package/binary/client/client_debug_bg.wasm.d.ts +29 -30
  10. package/binary/encode/encode_bg.wasm +0 -0
  11. package/binary/encode/encode_debug_bg.wasm +0 -0
  12. package/binary/encode/encode_debug_bg.wasm.d.ts +1 -1
  13. package/binary/server/package.json +4 -0
  14. package/binary/server/server.d.ts +134 -0
  15. package/binary/server/server.js +839 -0
  16. package/binary/server/server_bg.wasm +0 -0
  17. package/binary/server/server_bg.wasm.d.ts +51 -0
  18. package/binary/server/server_debug.d.ts +134 -0
  19. package/binary/server/server_debug.js +839 -0
  20. package/binary/server/server_debug_bg.wasm +0 -0
  21. package/binary/server/server_debug_bg.wasm.d.ts +51 -0
  22. package/dist/client/decodeWorker/decode.worker.js +24 -45
  23. package/dist/client/mainthread/Background.js +1 -2
  24. package/dist/client/mainthread/LynxViewInstance.d.ts +2 -4
  25. package/dist/client/mainthread/LynxViewInstance.js +12 -34
  26. package/dist/client/mainthread/TemplateManager.d.ts +1 -0
  27. package/dist/client/mainthread/TemplateManager.js +14 -3
  28. package/dist/client/mainthread/elementAPIs/createElementAPI.js +2 -1
  29. package/dist/client/mainthread/utils/requestIdleCallback.d.ts +1 -0
  30. package/dist/client/mainthread/utils/requestIdleCallback.js +5 -0
  31. package/dist/client/wasm.d.ts +0 -1
  32. package/dist/client/wasm.js +0 -3
  33. package/dist/client_prod/static/js/async/web-core-main-chunk.js +1 -1
  34. package/dist/client_prod/static/js/async/web-core-template-loader-thread.js +4 -6
  35. package/dist/client_prod/static/js/async/web-elements.js +10 -10
  36. package/dist/client_prod/static/js/client.js +2 -2
  37. package/dist/client_prod/static/wasm/af9fb056.module.wasm +0 -0
  38. package/dist/common/decodeUtils.d.ts +1 -0
  39. package/dist/common/decodeUtils.js +41 -0
  40. package/dist/constants.d.ts +3 -2
  41. package/dist/constants.js +3 -2
  42. package/dist/encode/webEncoder.js +5 -3
  43. package/dist/server/createServerLynx.d.ts +3 -0
  44. package/dist/server/createServerLynx.js +40 -0
  45. package/dist/server/decode.d.ts +7 -0
  46. package/dist/server/decode.js +83 -0
  47. package/dist/server/deploy.d.ts +2 -0
  48. package/dist/server/deploy.js +61 -0
  49. package/dist/server/elementAPIs/createElementAPI.d.ts +13 -0
  50. package/dist/server/elementAPIs/createElementAPI.js +235 -0
  51. package/dist/server/elementAPIs/pureElementAPIs.d.ts +38 -0
  52. package/dist/server/elementAPIs/pureElementAPIs.js +112 -0
  53. package/dist/server/index.d.ts +4 -0
  54. package/dist/server/index.js +10 -0
  55. package/dist/server/wasm.d.ts +1 -0
  56. package/dist/server/wasm.js +7 -0
  57. package/dist/types/DecodedTemplate.d.ts +2 -0
  58. package/package.json +17 -12
  59. package/dist/client_prod/static/css/async/web-elements.css +0 -1
  60. package/dist/client_prod/static/wasm/a156b496.module.wasm +0 -0
@@ -0,0 +1,839 @@
1
+ /* @ts-self-types="./server.d.ts" */
2
+
3
+ export class MainThreadServerContext {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ MainThreadServerContextFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_mainthreadservercontext_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @param {number} element_id
16
+ * @param {string} class_name
17
+ */
18
+ add_class(element_id, class_name) {
19
+ const ptr0 = passStringToWasm0(class_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
20
+ const len0 = WASM_VECTOR_LEN;
21
+ const ret = wasm.mainthreadservercontext_add_class(this.__wbg_ptr, element_id, ptr0, len0);
22
+ if (ret[1]) {
23
+ throw takeFromExternrefTable0(ret[0]);
24
+ }
25
+ }
26
+ /**
27
+ * @param {number} element_id
28
+ * @param {string} key
29
+ * @param {string | null} [value]
30
+ */
31
+ add_inline_style_raw_string_key(element_id, key, value) {
32
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
33
+ const len0 = WASM_VECTOR_LEN;
34
+ var ptr1 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35
+ var len1 = WASM_VECTOR_LEN;
36
+ wasm.mainthreadservercontext_add_inline_style_raw_string_key(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
37
+ }
38
+ /**
39
+ * @param {number} parent_id
40
+ * @param {number} child_id
41
+ */
42
+ append_child(parent_id, child_id) {
43
+ wasm.mainthreadservercontext_append_child(this.__wbg_ptr, parent_id, child_id);
44
+ }
45
+ /**
46
+ * @param {string} tag_name
47
+ * @param {number | null} [parent_component_unique_id]
48
+ * @param {number | null} [css_id_opt]
49
+ * @param {string | null} [component_id]
50
+ * @returns {number}
51
+ */
52
+ create_element(tag_name, parent_component_unique_id, css_id_opt, component_id) {
53
+ const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
54
+ const len0 = WASM_VECTOR_LEN;
55
+ var ptr1 = isLikeNone(component_id) ? 0 : passStringToWasm0(component_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
56
+ var len1 = WASM_VECTOR_LEN;
57
+ const ret = wasm.mainthreadservercontext_create_element(this.__wbg_ptr, ptr0, len0, isLikeNone(parent_component_unique_id) ? 0x100000001 : (parent_component_unique_id) >>> 0, isLikeNone(css_id_opt) ? 0x100000001 : (css_id_opt) >> 0, ptr1, len1);
58
+ return ret >>> 0;
59
+ }
60
+ /**
61
+ * @param {number} element_id
62
+ * @returns {string}
63
+ */
64
+ generate_html(element_id) {
65
+ let deferred1_0;
66
+ let deferred1_1;
67
+ try {
68
+ const ret = wasm.mainthreadservercontext_generate_html(this.__wbg_ptr, element_id);
69
+ deferred1_0 = ret[0];
70
+ deferred1_1 = ret[1];
71
+ return getStringFromWasm0(ret[0], ret[1]);
72
+ } finally {
73
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
74
+ }
75
+ }
76
+ /**
77
+ * @param {number} element_id
78
+ * @param {string} key
79
+ * @returns {string | undefined}
80
+ */
81
+ get_attribute(element_id, key) {
82
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
83
+ const len0 = WASM_VECTOR_LEN;
84
+ const ret = wasm.mainthreadservercontext_get_attribute(this.__wbg_ptr, element_id, ptr0, len0);
85
+ let v2;
86
+ if (ret[0] !== 0) {
87
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
88
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
89
+ }
90
+ return v2;
91
+ }
92
+ /**
93
+ * @param {number} element_id
94
+ * @returns {object}
95
+ */
96
+ get_attributes(element_id) {
97
+ const ret = wasm.mainthreadservercontext_get_attributes(this.__wbg_ptr, element_id);
98
+ if (ret[2]) {
99
+ throw takeFromExternrefTable0(ret[1]);
100
+ }
101
+ return takeFromExternrefTable0(ret[0]);
102
+ }
103
+ /**
104
+ * @param {number} element_id
105
+ * @param {string[]} k_v_vec
106
+ */
107
+ get_inline_styles_in_key_value_vec(element_id, k_v_vec) {
108
+ const ptr0 = passArrayJsValueToWasm0(k_v_vec, wasm.__wbindgen_malloc);
109
+ const len0 = WASM_VECTOR_LEN;
110
+ wasm.mainthreadservercontext_get_inline_styles_in_key_value_vec(this.__wbg_ptr, element_id, ptr0, len0);
111
+ }
112
+ /**
113
+ * @returns {string}
114
+ */
115
+ get_page_css() {
116
+ let deferred1_0;
117
+ let deferred1_1;
118
+ try {
119
+ const ret = wasm.mainthreadservercontext_get_page_css(this.__wbg_ptr);
120
+ deferred1_0 = ret[0];
121
+ deferred1_1 = ret[1];
122
+ return getStringFromWasm0(ret[0], ret[1]);
123
+ } finally {
124
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
125
+ }
126
+ }
127
+ /**
128
+ * @param {number} element_id
129
+ * @returns {string | undefined}
130
+ */
131
+ get_tag(element_id) {
132
+ const ret = wasm.mainthreadservercontext_get_tag(this.__wbg_ptr, element_id);
133
+ let v1;
134
+ if (ret[0] !== 0) {
135
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
136
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
137
+ }
138
+ return v1;
139
+ }
140
+ /**
141
+ * @param {string} view_attributes
142
+ * @param {boolean} enable_css_selector
143
+ */
144
+ constructor(view_attributes, enable_css_selector) {
145
+ const ptr0 = passStringToWasm0(view_attributes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
146
+ const len0 = WASM_VECTOR_LEN;
147
+ const ret = wasm.mainthreadservercontext_new(ptr0, len0, enable_css_selector);
148
+ this.__wbg_ptr = ret >>> 0;
149
+ MainThreadServerContextFinalization.register(this, this.__wbg_ptr, this);
150
+ return this;
151
+ }
152
+ /**
153
+ * @param {StyleSheetResource} resource
154
+ * @param {string | null} [entry_name]
155
+ */
156
+ push_style_sheet(resource, entry_name) {
157
+ _assertClass(resource, StyleSheetResource);
158
+ var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
159
+ var len0 = WASM_VECTOR_LEN;
160
+ const ret = wasm.mainthreadservercontext_push_style_sheet(this.__wbg_ptr, resource.__wbg_ptr, ptr0, len0);
161
+ if (ret[1]) {
162
+ throw takeFromExternrefTable0(ret[0]);
163
+ }
164
+ }
165
+ /**
166
+ * @param {number} element_id
167
+ * @param {string} key
168
+ */
169
+ remove_attribute(element_id, key) {
170
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
+ const len0 = WASM_VECTOR_LEN;
172
+ wasm.mainthreadservercontext_remove_attribute(this.__wbg_ptr, element_id, ptr0, len0);
173
+ }
174
+ /**
175
+ * @param {number} element_id
176
+ * @param {string} key
177
+ * @param {string} value
178
+ */
179
+ set_attribute(element_id, key, value) {
180
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
181
+ const len0 = WASM_VECTOR_LEN;
182
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
183
+ const len1 = WASM_VECTOR_LEN;
184
+ wasm.mainthreadservercontext_set_attribute(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
185
+ }
186
+ /**
187
+ * @param {Uint32Array} elements_unique_id
188
+ * @param {number} css_id
189
+ * @param {string | null} [entry_name]
190
+ */
191
+ set_css_id(elements_unique_id, css_id, entry_name) {
192
+ const ptr0 = passArray32ToWasm0(elements_unique_id, wasm.__wbindgen_malloc);
193
+ const len0 = WASM_VECTOR_LEN;
194
+ var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
195
+ var len1 = WASM_VECTOR_LEN;
196
+ const ret = wasm.mainthreadservercontext_set_css_id(this.__wbg_ptr, ptr0, len0, css_id, ptr1, len1);
197
+ if (ret[1]) {
198
+ throw takeFromExternrefTable0(ret[0]);
199
+ }
200
+ }
201
+ /**
202
+ * @param {number} element_id
203
+ * @param {string} styles
204
+ * @returns {boolean}
205
+ */
206
+ set_inline_styles_in_str(element_id, styles) {
207
+ const ptr0 = passStringToWasm0(styles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
208
+ const len0 = WASM_VECTOR_LEN;
209
+ const ret = wasm.mainthreadservercontext_set_inline_styles_in_str(this.__wbg_ptr, element_id, ptr0, len0);
210
+ return ret !== 0;
211
+ }
212
+ /**
213
+ * @param {number} element_id
214
+ * @param {number} key
215
+ * @param {string | null} [value]
216
+ */
217
+ set_inline_styles_number_key(element_id, key, value) {
218
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
219
+ var len0 = WASM_VECTOR_LEN;
220
+ wasm.mainthreadservercontext_set_inline_styles_number_key(this.__wbg_ptr, element_id, key, ptr0, len0);
221
+ }
222
+ /**
223
+ * @param {number} unique_id
224
+ * @param {string | null} [entry_name]
225
+ */
226
+ update_css_og_style(unique_id, entry_name) {
227
+ var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
+ var len0 = WASM_VECTOR_LEN;
229
+ const ret = wasm.mainthreadservercontext_update_css_og_style(this.__wbg_ptr, unique_id, ptr0, len0);
230
+ if (ret[1]) {
231
+ throw takeFromExternrefTable0(ret[0]);
232
+ }
233
+ }
234
+ }
235
+ if (Symbol.dispose) MainThreadServerContext.prototype[Symbol.dispose] = MainThreadServerContext.prototype.free;
236
+
237
+ export class RawStyleInfo {
238
+ __destroy_into_raw() {
239
+ const ptr = this.__wbg_ptr;
240
+ this.__wbg_ptr = 0;
241
+ RawStyleInfoFinalization.unregister(this);
242
+ return ptr;
243
+ }
244
+ free() {
245
+ const ptr = this.__destroy_into_raw();
246
+ wasm.__wbg_rawstyleinfo_free(ptr, 0);
247
+ }
248
+ /**
249
+ *
250
+ * * Appends an import to the stylesheet identified by `css_id`.
251
+ * * If the stylesheet does not exist, it is created.
252
+ * * @param css_id - The ID of the CSS file.
253
+ * * @param import_css_id - The ID of the imported CSS file.
254
+ *
255
+ * @param {number} css_id
256
+ * @param {number} import_css_id
257
+ */
258
+ append_import(css_id, import_css_id) {
259
+ wasm.rawstyleinfo_append_import(this.__wbg_ptr, css_id, import_css_id);
260
+ }
261
+ constructor() {
262
+ const ret = wasm.rawstyleinfo_new();
263
+ this.__wbg_ptr = ret >>> 0;
264
+ RawStyleInfoFinalization.register(this, this.__wbg_ptr, this);
265
+ return this;
266
+ }
267
+ /**
268
+ *
269
+ * * Pushes a rule to the stylesheet identified by `css_id`.
270
+ * * If the stylesheet does not exist, it is created.
271
+ * * @param css_id - The ID of the CSS file.
272
+ * * @param rule - The rule to append.
273
+ *
274
+ * @param {number} css_id
275
+ * @param {Rule} rule
276
+ */
277
+ push_rule(css_id, rule) {
278
+ _assertClass(rule, Rule);
279
+ var ptr0 = rule.__destroy_into_raw();
280
+ wasm.rawstyleinfo_push_rule(this.__wbg_ptr, css_id, ptr0);
281
+ }
282
+ }
283
+ if (Symbol.dispose) RawStyleInfo.prototype[Symbol.dispose] = RawStyleInfo.prototype.free;
284
+
285
+ export class Rule {
286
+ __destroy_into_raw() {
287
+ const ptr = this.__wbg_ptr;
288
+ this.__wbg_ptr = 0;
289
+ RuleFinalization.unregister(this);
290
+ return ptr;
291
+ }
292
+ free() {
293
+ const ptr = this.__destroy_into_raw();
294
+ wasm.__wbg_rule_free(ptr, 0);
295
+ }
296
+ /**
297
+ *
298
+ * * Creates a new Rule with the specified type.
299
+ * * @param rule_type - The type of the rule (e.g., "StyleRule", "FontFaceRule", "KeyframesRule").
300
+ *
301
+ * @param {string} rule_type
302
+ */
303
+ constructor(rule_type) {
304
+ const ptr0 = passStringToWasm0(rule_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
305
+ const len0 = WASM_VECTOR_LEN;
306
+ const ret = wasm.rule_new(ptr0, len0);
307
+ if (ret[2]) {
308
+ throw takeFromExternrefTable0(ret[1]);
309
+ }
310
+ this.__wbg_ptr = ret[0] >>> 0;
311
+ RuleFinalization.register(this, this.__wbg_ptr, this);
312
+ return this;
313
+ }
314
+ /**
315
+ *
316
+ * * Pushes a declaration to the rule's declaration block.
317
+ * * LynxJS doesn't support !important
318
+ * * @param property_name - The property name.
319
+ * * @param value - The property value.
320
+ *
321
+ * @param {string} property_name
322
+ * @param {string} value
323
+ */
324
+ push_declaration(property_name, value) {
325
+ const ptr0 = passStringToWasm0(property_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
326
+ const len0 = WASM_VECTOR_LEN;
327
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
+ const len1 = WASM_VECTOR_LEN;
329
+ wasm.rule_push_declaration(this.__wbg_ptr, ptr0, len0, ptr1, len1);
330
+ }
331
+ /**
332
+ *
333
+ * * Pushes a nested rule to the rule.
334
+ * * @param rule - The nested rule to add.
335
+ *
336
+ * @param {Rule} rule
337
+ */
338
+ push_rule_children(rule) {
339
+ _assertClass(rule, Rule);
340
+ var ptr0 = rule.__destroy_into_raw();
341
+ wasm.rule_push_rule_children(this.__wbg_ptr, ptr0);
342
+ }
343
+ /**
344
+ *
345
+ * * Sets the prelude for the rule.
346
+ * * @param prelude - The prelude to set (SelectorList or KeyFramesPrelude).
347
+ *
348
+ * @param {RulePrelude} prelude
349
+ */
350
+ set_prelude(prelude) {
351
+ _assertClass(prelude, RulePrelude);
352
+ var ptr0 = prelude.__destroy_into_raw();
353
+ wasm.rule_set_prelude(this.__wbg_ptr, ptr0);
354
+ }
355
+ }
356
+ if (Symbol.dispose) Rule.prototype[Symbol.dispose] = Rule.prototype.free;
357
+
358
+ /**
359
+ *
360
+ * * Either SelectorList or KeyFramesPrelude
361
+ * * Depending on the RuleType
362
+ * * If it is SelectorList, then selectors is a list of Selector
363
+ * * If it is KeyFramesPrelude, then selectors has only one selector which is Prelude text, its simple_selectors is empty
364
+ * * If the parent is FontFace, then selectors is empty
365
+ *
366
+ */
367
+ export class RulePrelude {
368
+ __destroy_into_raw() {
369
+ const ptr = this.__wbg_ptr;
370
+ this.__wbg_ptr = 0;
371
+ RulePreludeFinalization.unregister(this);
372
+ return ptr;
373
+ }
374
+ free() {
375
+ const ptr = this.__destroy_into_raw();
376
+ wasm.__wbg_ruleprelude_free(ptr, 0);
377
+ }
378
+ constructor() {
379
+ const ret = wasm.ruleprelude_new();
380
+ this.__wbg_ptr = ret >>> 0;
381
+ RulePreludeFinalization.register(this, this.__wbg_ptr, this);
382
+ return this;
383
+ }
384
+ /**
385
+ *
386
+ * * Pushes a selector to the list.
387
+ * * @param selector - The selector to add.
388
+ *
389
+ * @param {Selector} selector
390
+ */
391
+ push_selector(selector) {
392
+ _assertClass(selector, Selector);
393
+ var ptr0 = selector.__destroy_into_raw();
394
+ wasm.ruleprelude_push_selector(this.__wbg_ptr, ptr0);
395
+ }
396
+ }
397
+ if (Symbol.dispose) RulePrelude.prototype[Symbol.dispose] = RulePrelude.prototype.free;
398
+
399
+ export class Selector {
400
+ __destroy_into_raw() {
401
+ const ptr = this.__wbg_ptr;
402
+ this.__wbg_ptr = 0;
403
+ SelectorFinalization.unregister(this);
404
+ return ptr;
405
+ }
406
+ free() {
407
+ const ptr = this.__destroy_into_raw();
408
+ wasm.__wbg_selector_free(ptr, 0);
409
+ }
410
+ constructor() {
411
+ const ret = wasm.ruleprelude_new();
412
+ this.__wbg_ptr = ret >>> 0;
413
+ SelectorFinalization.register(this, this.__wbg_ptr, this);
414
+ return this;
415
+ }
416
+ /**
417
+ *
418
+ * * Pushes a selector section to the selector.
419
+ * * @param selector_type - The type of the selector section (e.g., "ClassSelector", "IdSelector").
420
+ * * @param value - The value of the selector section.
421
+ *
422
+ * @param {string} selector_type
423
+ * @param {string} value
424
+ */
425
+ push_one_selector_section(selector_type, value) {
426
+ const ptr0 = passStringToWasm0(selector_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
+ const len1 = WASM_VECTOR_LEN;
430
+ const ret = wasm.selector_push_one_selector_section(this.__wbg_ptr, ptr0, len0, ptr1, len1);
431
+ if (ret[1]) {
432
+ throw takeFromExternrefTable0(ret[0]);
433
+ }
434
+ }
435
+ }
436
+ if (Symbol.dispose) Selector.prototype[Symbol.dispose] = Selector.prototype.free;
437
+
438
+ export class StyleSheetResource {
439
+ __destroy_into_raw() {
440
+ const ptr = this.__wbg_ptr;
441
+ this.__wbg_ptr = 0;
442
+ StyleSheetResourceFinalization.unregister(this);
443
+ return ptr;
444
+ }
445
+ free() {
446
+ const ptr = this.__destroy_into_raw();
447
+ wasm.__wbg_stylesheetresource_free(ptr, 0);
448
+ }
449
+ /**
450
+ * @param {Uint8Array} buffer
451
+ * @param {any} _document
452
+ */
453
+ constructor(buffer, _document) {
454
+ const ret = wasm.stylesheetresource_new(buffer, _document);
455
+ if (ret[2]) {
456
+ throw takeFromExternrefTable0(ret[1]);
457
+ }
458
+ this.__wbg_ptr = ret[0] >>> 0;
459
+ StyleSheetResourceFinalization.register(this, this.__wbg_ptr, this);
460
+ return this;
461
+ }
462
+ }
463
+ if (Symbol.dispose) StyleSheetResource.prototype[Symbol.dispose] = StyleSheetResource.prototype.free;
464
+
465
+ /**
466
+ * @param {Uint8Array} buffer
467
+ * @param {string | null | undefined} entry_name
468
+ * @param {boolean} config_enable_css_selector
469
+ * @returns {Uint8Array}
470
+ */
471
+ export function decode_style_info(buffer, entry_name, config_enable_css_selector) {
472
+ var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
+ var len0 = WASM_VECTOR_LEN;
474
+ const ret = wasm.decode_style_info(buffer, ptr0, len0, config_enable_css_selector);
475
+ if (ret[2]) {
476
+ throw takeFromExternrefTable0(ret[1]);
477
+ }
478
+ return takeFromExternrefTable0(ret[0]);
479
+ }
480
+
481
+ /**
482
+ * @param {RawStyleInfo} raw_style_info
483
+ * @param {boolean} config_enable_css_selector
484
+ * @param {string | null} [entry_name]
485
+ * @returns {Uint8Array}
486
+ */
487
+ export function encode_legacy_json_generated_raw_style_info(raw_style_info, config_enable_css_selector, entry_name) {
488
+ _assertClass(raw_style_info, RawStyleInfo);
489
+ var ptr0 = raw_style_info.__destroy_into_raw();
490
+ var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
491
+ var len1 = WASM_VECTOR_LEN;
492
+ const ret = wasm.encode_legacy_json_generated_raw_style_info(ptr0, config_enable_css_selector, ptr1, len1);
493
+ if (ret[2]) {
494
+ throw takeFromExternrefTable0(ret[1]);
495
+ }
496
+ return takeFromExternrefTable0(ret[0]);
497
+ }
498
+
499
+ /**
500
+ * @param {Uint8Array} buffer
501
+ * @returns {string}
502
+ */
503
+ export function get_font_face_content(buffer) {
504
+ let deferred2_0;
505
+ let deferred2_1;
506
+ try {
507
+ const ret = wasm.get_font_face_content(buffer);
508
+ var ptr1 = ret[0];
509
+ var len1 = ret[1];
510
+ if (ret[3]) {
511
+ ptr1 = 0; len1 = 0;
512
+ throw takeFromExternrefTable0(ret[2]);
513
+ }
514
+ deferred2_0 = ptr1;
515
+ deferred2_1 = len1;
516
+ return getStringFromWasm0(ptr1, len1);
517
+ } finally {
518
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
519
+ }
520
+ }
521
+
522
+ /**
523
+ * @param {Uint8Array} buffer
524
+ * @returns {string}
525
+ */
526
+ export function get_style_content(buffer) {
527
+ let deferred2_0;
528
+ let deferred2_1;
529
+ try {
530
+ const ret = wasm.get_style_content(buffer);
531
+ var ptr1 = ret[0];
532
+ var len1 = ret[1];
533
+ if (ret[3]) {
534
+ ptr1 = 0; len1 = 0;
535
+ throw takeFromExternrefTable0(ret[2]);
536
+ }
537
+ deferred2_0 = ptr1;
538
+ deferred2_1 = len1;
539
+ return getStringFromWasm0(ptr1, len1);
540
+ } finally {
541
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
542
+ }
543
+ }
544
+
545
+ function __wbg_get_imports() {
546
+ const import0 = {
547
+ __proto__: null,
548
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
549
+ const ret = Error(getStringFromWasm0(arg0, arg1));
550
+ return ret;
551
+ },
552
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
553
+ const ret = debugString(arg1);
554
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
555
+ const len1 = WASM_VECTOR_LEN;
556
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
557
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
558
+ },
559
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
560
+ const obj = arg1;
561
+ const ret = typeof(obj) === 'string' ? obj : undefined;
562
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
563
+ var len1 = WASM_VECTOR_LEN;
564
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
565
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
566
+ },
567
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
568
+ throw new Error(getStringFromWasm0(arg0, arg1));
569
+ },
570
+ __wbg_length_32ed9a279acd054c: function(arg0) {
571
+ const ret = arg0.length;
572
+ return ret;
573
+ },
574
+ __wbg_new_361308b2356cecd0: function() {
575
+ const ret = new Object();
576
+ return ret;
577
+ },
578
+ __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
579
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
580
+ return ret;
581
+ },
582
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
583
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
584
+ },
585
+ __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
586
+ const ret = Reflect.set(arg0, arg1, arg2);
587
+ return ret;
588
+ }, arguments); },
589
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
590
+ // Cast intrinsic for `Ref(String) -> Externref`.
591
+ const ret = getStringFromWasm0(arg0, arg1);
592
+ return ret;
593
+ },
594
+ __wbindgen_init_externref_table: function() {
595
+ const table = wasm.__wbindgen_externrefs;
596
+ const offset = table.grow(4);
597
+ table.set(0, undefined);
598
+ table.set(offset + 0, undefined);
599
+ table.set(offset + 1, null);
600
+ table.set(offset + 2, true);
601
+ table.set(offset + 3, false);
602
+ },
603
+ };
604
+ return {
605
+ __proto__: null,
606
+ "./server_bg.js": import0,
607
+ };
608
+ }
609
+
610
+ const MainThreadServerContextFinalization = (typeof FinalizationRegistry === 'undefined')
611
+ ? { register: () => {}, unregister: () => {} }
612
+ : new FinalizationRegistry(ptr => wasm.__wbg_mainthreadservercontext_free(ptr >>> 0, 1));
613
+ const RawStyleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
614
+ ? { register: () => {}, unregister: () => {} }
615
+ : new FinalizationRegistry(ptr => wasm.__wbg_rawstyleinfo_free(ptr >>> 0, 1));
616
+ const RuleFinalization = (typeof FinalizationRegistry === 'undefined')
617
+ ? { register: () => {}, unregister: () => {} }
618
+ : new FinalizationRegistry(ptr => wasm.__wbg_rule_free(ptr >>> 0, 1));
619
+ const RulePreludeFinalization = (typeof FinalizationRegistry === 'undefined')
620
+ ? { register: () => {}, unregister: () => {} }
621
+ : new FinalizationRegistry(ptr => wasm.__wbg_ruleprelude_free(ptr >>> 0, 1));
622
+ const SelectorFinalization = (typeof FinalizationRegistry === 'undefined')
623
+ ? { register: () => {}, unregister: () => {} }
624
+ : new FinalizationRegistry(ptr => wasm.__wbg_selector_free(ptr >>> 0, 1));
625
+ const StyleSheetResourceFinalization = (typeof FinalizationRegistry === 'undefined')
626
+ ? { register: () => {}, unregister: () => {} }
627
+ : new FinalizationRegistry(ptr => wasm.__wbg_stylesheetresource_free(ptr >>> 0, 1));
628
+
629
+ function addToExternrefTable0(obj) {
630
+ const idx = wasm.__externref_table_alloc();
631
+ wasm.__wbindgen_externrefs.set(idx, obj);
632
+ return idx;
633
+ }
634
+
635
+ function _assertClass(instance, klass) {
636
+ if (!(instance instanceof klass)) {
637
+ throw new Error(`expected instance of ${klass.name}`);
638
+ }
639
+ }
640
+
641
+ function debugString(val) {
642
+ // primitive types
643
+ const type = typeof val;
644
+ if (type == 'number' || type == 'boolean' || val == null) {
645
+ return `${val}`;
646
+ }
647
+ if (type == 'string') {
648
+ return `"${val}"`;
649
+ }
650
+ if (type == 'symbol') {
651
+ const description = val.description;
652
+ if (description == null) {
653
+ return 'Symbol';
654
+ } else {
655
+ return `Symbol(${description})`;
656
+ }
657
+ }
658
+ if (type == 'function') {
659
+ const name = val.name;
660
+ if (typeof name == 'string' && name.length > 0) {
661
+ return `Function(${name})`;
662
+ } else {
663
+ return 'Function';
664
+ }
665
+ }
666
+ // objects
667
+ if (Array.isArray(val)) {
668
+ const length = val.length;
669
+ let debug = '[';
670
+ if (length > 0) {
671
+ debug += debugString(val[0]);
672
+ }
673
+ for(let i = 1; i < length; i++) {
674
+ debug += ', ' + debugString(val[i]);
675
+ }
676
+ debug += ']';
677
+ return debug;
678
+ }
679
+ // Test for built-in
680
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
681
+ let className;
682
+ if (builtInMatches && builtInMatches.length > 1) {
683
+ className = builtInMatches[1];
684
+ } else {
685
+ // Failed to match the standard '[object ClassName]'
686
+ return toString.call(val);
687
+ }
688
+ if (className == 'Object') {
689
+ // we're a user defined class or Object
690
+ // JSON.stringify avoids problems with cycles, and is generally much
691
+ // easier than looping through ownProperties of `val`.
692
+ try {
693
+ return 'Object(' + JSON.stringify(val) + ')';
694
+ } catch (_) {
695
+ return 'Object';
696
+ }
697
+ }
698
+ // errors
699
+ if (val instanceof Error) {
700
+ return `${val.name}: ${val.message}\n${val.stack}`;
701
+ }
702
+ // TODO we could test for more things here, like `Set`s and `Map`s.
703
+ return className;
704
+ }
705
+
706
+ function getArrayU8FromWasm0(ptr, len) {
707
+ ptr = ptr >>> 0;
708
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
709
+ }
710
+
711
+ let cachedDataViewMemory0 = null;
712
+ function getDataViewMemory0() {
713
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
714
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
715
+ }
716
+ return cachedDataViewMemory0;
717
+ }
718
+
719
+ function getStringFromWasm0(ptr, len) {
720
+ ptr = ptr >>> 0;
721
+ return decodeText(ptr, len);
722
+ }
723
+
724
+ let cachedUint32ArrayMemory0 = null;
725
+ function getUint32ArrayMemory0() {
726
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
727
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
728
+ }
729
+ return cachedUint32ArrayMemory0;
730
+ }
731
+
732
+ let cachedUint8ArrayMemory0 = null;
733
+ function getUint8ArrayMemory0() {
734
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
735
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
736
+ }
737
+ return cachedUint8ArrayMemory0;
738
+ }
739
+
740
+ function handleError(f, args) {
741
+ try {
742
+ return f.apply(this, args);
743
+ } catch (e) {
744
+ const idx = addToExternrefTable0(e);
745
+ wasm.__wbindgen_exn_store(idx);
746
+ }
747
+ }
748
+
749
+ function isLikeNone(x) {
750
+ return x === undefined || x === null;
751
+ }
752
+
753
+ function passArray32ToWasm0(arg, malloc) {
754
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
755
+ getUint32ArrayMemory0().set(arg, ptr / 4);
756
+ WASM_VECTOR_LEN = arg.length;
757
+ return ptr;
758
+ }
759
+
760
+ function passArrayJsValueToWasm0(array, malloc) {
761
+ const ptr = malloc(array.length * 4, 4) >>> 0;
762
+ for (let i = 0; i < array.length; i++) {
763
+ const add = addToExternrefTable0(array[i]);
764
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
765
+ }
766
+ WASM_VECTOR_LEN = array.length;
767
+ return ptr;
768
+ }
769
+
770
+ function passStringToWasm0(arg, malloc, realloc) {
771
+ if (realloc === undefined) {
772
+ const buf = cachedTextEncoder.encode(arg);
773
+ const ptr = malloc(buf.length, 1) >>> 0;
774
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
775
+ WASM_VECTOR_LEN = buf.length;
776
+ return ptr;
777
+ }
778
+
779
+ let len = arg.length;
780
+ let ptr = malloc(len, 1) >>> 0;
781
+
782
+ const mem = getUint8ArrayMemory0();
783
+
784
+ let offset = 0;
785
+
786
+ for (; offset < len; offset++) {
787
+ const code = arg.charCodeAt(offset);
788
+ if (code > 0x7F) break;
789
+ mem[ptr + offset] = code;
790
+ }
791
+ if (offset !== len) {
792
+ if (offset !== 0) {
793
+ arg = arg.slice(offset);
794
+ }
795
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
796
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
797
+ const ret = cachedTextEncoder.encodeInto(arg, view);
798
+
799
+ offset += ret.written;
800
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
801
+ }
802
+
803
+ WASM_VECTOR_LEN = offset;
804
+ return ptr;
805
+ }
806
+
807
+ function takeFromExternrefTable0(idx) {
808
+ const value = wasm.__wbindgen_externrefs.get(idx);
809
+ wasm.__externref_table_dealloc(idx);
810
+ return value;
811
+ }
812
+
813
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
814
+ cachedTextDecoder.decode();
815
+ function decodeText(ptr, len) {
816
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
817
+ }
818
+
819
+ const cachedTextEncoder = new TextEncoder();
820
+
821
+ if (!('encodeInto' in cachedTextEncoder)) {
822
+ cachedTextEncoder.encodeInto = function (arg, view) {
823
+ const buf = cachedTextEncoder.encode(arg);
824
+ view.set(buf);
825
+ return {
826
+ read: arg.length,
827
+ written: buf.length
828
+ };
829
+ };
830
+ }
831
+
832
+ let WASM_VECTOR_LEN = 0;
833
+
834
+ import { readFileSync } from 'node:fs';
835
+ const wasmUrl = new URL('server_bg.wasm', import.meta.url);
836
+ const wasmBytes = readFileSync(wasmUrl);
837
+ const wasmModule = new WebAssembly.Module(wasmBytes);
838
+ const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
839
+ wasm.__wbindgen_start();