@colletdev/core 0.1.3

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 (119) hide show
  1. package/README.md +77 -0
  2. package/custom-elements.json +6037 -0
  3. package/generated/.gitattributes +2 -0
  4. package/generated/index.d.ts +120 -0
  5. package/generated/index.js +521 -0
  6. package/generated/styles.js +2845 -0
  7. package/package.json +56 -0
  8. package/src/elements/accordion.d.ts +20 -0
  9. package/src/elements/accordion.js +92 -0
  10. package/src/elements/activity_group.d.ts +19 -0
  11. package/src/elements/activity_group.js +27 -0
  12. package/src/elements/alert.d.ts +24 -0
  13. package/src/elements/alert.js +40 -0
  14. package/src/elements/autocomplete.d.ts +30 -0
  15. package/src/elements/autocomplete.js +671 -0
  16. package/src/elements/avatar.d.ts +18 -0
  17. package/src/elements/avatar.js +28 -0
  18. package/src/elements/backdrop.d.ts +14 -0
  19. package/src/elements/backdrop.js +28 -0
  20. package/src/elements/badge.d.ts +21 -0
  21. package/src/elements/badge.js +42 -0
  22. package/src/elements/breadcrumb.d.ts +17 -0
  23. package/src/elements/breadcrumb.js +41 -0
  24. package/src/elements/button.d.ts +24 -0
  25. package/src/elements/button.js +36 -0
  26. package/src/elements/card.d.ts +21 -0
  27. package/src/elements/card.js +67 -0
  28. package/src/elements/carousel.d.ts +23 -0
  29. package/src/elements/carousel.js +895 -0
  30. package/src/elements/chat_input.d.ts +22 -0
  31. package/src/elements/chat_input.js +78 -0
  32. package/src/elements/checkbox.d.ts +21 -0
  33. package/src/elements/checkbox.js +114 -0
  34. package/src/elements/code_block.d.ts +21 -0
  35. package/src/elements/code_block.js +27 -0
  36. package/src/elements/collapsible.d.ts +20 -0
  37. package/src/elements/collapsible.js +93 -0
  38. package/src/elements/date_picker.d.ts +30 -0
  39. package/src/elements/date_picker.js +528 -0
  40. package/src/elements/dialog.d.ts +20 -0
  41. package/src/elements/dialog.js +314 -0
  42. package/src/elements/drawer.d.ts +20 -0
  43. package/src/elements/drawer.js +318 -0
  44. package/src/elements/fab.d.ts +22 -0
  45. package/src/elements/fab.js +36 -0
  46. package/src/elements/file_upload.d.ts +26 -0
  47. package/src/elements/file_upload.js +59 -0
  48. package/src/elements/listbox.d.ts +19 -0
  49. package/src/elements/listbox.js +250 -0
  50. package/src/elements/menu.d.ts +20 -0
  51. package/src/elements/menu.js +224 -0
  52. package/src/elements/message_bubble.d.ts +23 -0
  53. package/src/elements/message_bubble.js +29 -0
  54. package/src/elements/message_group.d.ts +18 -0
  55. package/src/elements/message_group.js +28 -0
  56. package/src/elements/message_part.d.ts +35 -0
  57. package/src/elements/message_part.js +153 -0
  58. package/src/elements/pagination.d.ts +22 -0
  59. package/src/elements/pagination.js +36 -0
  60. package/src/elements/popover.d.ts +26 -0
  61. package/src/elements/popover.js +191 -0
  62. package/src/elements/profile_menu.d.ts +20 -0
  63. package/src/elements/profile_menu.js +213 -0
  64. package/src/elements/progress.d.ts +18 -0
  65. package/src/elements/progress.js +31 -0
  66. package/src/elements/radio_group.d.ts +22 -0
  67. package/src/elements/radio_group.js +70 -0
  68. package/src/elements/scrollbar.d.ts +19 -0
  69. package/src/elements/scrollbar.js +299 -0
  70. package/src/elements/search_bar.d.ts +27 -0
  71. package/src/elements/search_bar.js +98 -0
  72. package/src/elements/select.d.ts +26 -0
  73. package/src/elements/select.js +485 -0
  74. package/src/elements/sidebar.d.ts +21 -0
  75. package/src/elements/sidebar.js +322 -0
  76. package/src/elements/skeleton.d.ts +17 -0
  77. package/src/elements/skeleton.js +31 -0
  78. package/src/elements/slider.d.ts +28 -0
  79. package/src/elements/slider.js +93 -0
  80. package/src/elements/speed_dial.d.ts +23 -0
  81. package/src/elements/speed_dial.js +370 -0
  82. package/src/elements/spinner.d.ts +15 -0
  83. package/src/elements/spinner.js +28 -0
  84. package/src/elements/split_button.d.ts +23 -0
  85. package/src/elements/split_button.js +281 -0
  86. package/src/elements/stepper.d.ts +20 -0
  87. package/src/elements/stepper.js +31 -0
  88. package/src/elements/switch.d.ts +22 -0
  89. package/src/elements/switch.js +129 -0
  90. package/src/elements/table.d.ts +29 -0
  91. package/src/elements/table.js +371 -0
  92. package/src/elements/tabs.d.ts +19 -0
  93. package/src/elements/tabs.js +139 -0
  94. package/src/elements/text.d.ts +26 -0
  95. package/src/elements/text.js +32 -0
  96. package/src/elements/text_input.d.ts +36 -0
  97. package/src/elements/text_input.js +121 -0
  98. package/src/elements/thinking.d.ts +17 -0
  99. package/src/elements/thinking.js +28 -0
  100. package/src/elements/toast.d.ts +23 -0
  101. package/src/elements/toast.js +209 -0
  102. package/src/elements/toggle_group.d.ts +22 -0
  103. package/src/elements/toggle_group.js +176 -0
  104. package/src/elements/tooltip.d.ts +18 -0
  105. package/src/elements/tooltip.js +64 -0
  106. package/src/markdown.d.ts +24 -0
  107. package/src/markdown.js +66 -0
  108. package/src/runtime.d.ts +35 -0
  109. package/src/runtime.js +790 -0
  110. package/src/server.d.ts +69 -0
  111. package/src/server.js +176 -0
  112. package/src/streaming-markdown.js +43 -0
  113. package/src/vite-plugin.d.ts +46 -0
  114. package/src/vite-plugin.js +221 -0
  115. package/wasm/package.json +16 -0
  116. package/wasm/wasm_api.d.ts +72 -0
  117. package/wasm/wasm_api.js +593 -0
  118. package/wasm/wasm_api_bg.wasm +0 -0
  119. package/wasm/wasm_api_bg.wasm.d.ts +10 -0
@@ -0,0 +1,593 @@
1
+ /* @ts-self-types="./wasm_api.d.ts" */
2
+
3
+ /**
4
+ * Single dispatcher for all component renders.
5
+ *
6
+ * Replaces 44 individual `#[wasm_bindgen]` exports with one entry point.
7
+ * Each wasm-bindgen export generates a `catch_unwind` wrapper (~2 KB each).
8
+ * By consolidating to a single export, we eliminate 43 redundant wrappers
9
+ * (~91 KB savings in the final WASM binary).
10
+ *
11
+ * JS calls `cx_render("button", { label: "Click" })` instead of
12
+ * `cx_button({ label: "Click" })`. The generated index.js creates
13
+ * thin wrapper functions so the DX is unchanged.
14
+ *
15
+ * # Errors
16
+ *
17
+ * Returns `JsError` if the component name is unknown or the config
18
+ * can't be deserialized.
19
+ * @param {string} component
20
+ * @param {any} config
21
+ * @returns {any}
22
+ */
23
+ export function cx_render(component, config) {
24
+ try {
25
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
26
+ const ptr0 = passStringToWasm0(component, wasm.__wbindgen_export, wasm.__wbindgen_export2);
27
+ const len0 = WASM_VECTOR_LEN;
28
+ wasm.cx_render(retptr, ptr0, len0, addHeapObject(config));
29
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
30
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
31
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
32
+ if (r2) {
33
+ throw takeObject(r1);
34
+ }
35
+ return takeObject(r0);
36
+ } finally {
37
+ wasm.__wbindgen_add_to_stack_pointer(16);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Render GFM markdown to sanitized HTML.
43
+ *
44
+ * Returns a `<div class="cx-prose">...</div>` wrapper containing the
45
+ * rendered HTML. Raw HTML in the markdown source is escaped (not passed
46
+ * through), making the output XSS-safe by construction.
47
+ *
48
+ * # Example (from JS)
49
+ *
50
+ * ```js
51
+ * const html = cx_render_markdown("**Hello** world");
52
+ * // → '<div class="cx-prose"><p><strong>Hello</strong> world</p>\n</div>'
53
+ * ```
54
+ * @param {string} input
55
+ * @returns {string}
56
+ */
57
+ export function cx_render_markdown(input) {
58
+ let deferred2_0;
59
+ let deferred2_1;
60
+ try {
61
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
62
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
63
+ const len0 = WASM_VECTOR_LEN;
64
+ wasm.cx_render_markdown(retptr, ptr0, len0);
65
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
66
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
67
+ deferred2_0 = r0;
68
+ deferred2_1 = r1;
69
+ return getStringFromWasm0(r0, r1);
70
+ } finally {
71
+ wasm.__wbindgen_add_to_stack_pointer(16);
72
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
73
+ }
74
+ }
75
+
76
+ function __wbg_get_imports() {
77
+ const import0 = {
78
+ __proto__: null,
79
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
80
+ const ret = Error(getStringFromWasm0(arg0, arg1));
81
+ return addHeapObject(ret);
82
+ },
83
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
84
+ const ret = Number(getObject(arg0));
85
+ return ret;
86
+ },
87
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
88
+ const ret = String(getObject(arg1));
89
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
90
+ const len1 = WASM_VECTOR_LEN;
91
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
92
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
93
+ },
94
+ __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
95
+ const v = getObject(arg1);
96
+ const ret = typeof(v) === 'bigint' ? v : undefined;
97
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
98
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
99
+ },
100
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
101
+ const v = getObject(arg0);
102
+ const ret = typeof(v) === 'boolean' ? v : undefined;
103
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
104
+ },
105
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
106
+ const ret = debugString(getObject(arg1));
107
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
108
+ const len1 = WASM_VECTOR_LEN;
109
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
110
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
111
+ },
112
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
113
+ const ret = getObject(arg0) in getObject(arg1);
114
+ return ret;
115
+ },
116
+ __wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
117
+ const ret = typeof(getObject(arg0)) === 'bigint';
118
+ return ret;
119
+ },
120
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
121
+ const ret = typeof(getObject(arg0)) === 'function';
122
+ return ret;
123
+ },
124
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
125
+ const val = getObject(arg0);
126
+ const ret = typeof(val) === 'object' && val !== null;
127
+ return ret;
128
+ },
129
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
130
+ const ret = typeof(getObject(arg0)) === 'string';
131
+ return ret;
132
+ },
133
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
134
+ const ret = getObject(arg0) === undefined;
135
+ return ret;
136
+ },
137
+ __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
138
+ const ret = getObject(arg0) === getObject(arg1);
139
+ return ret;
140
+ },
141
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
142
+ const ret = getObject(arg0) == getObject(arg1);
143
+ return ret;
144
+ },
145
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
146
+ const obj = getObject(arg1);
147
+ const ret = typeof(obj) === 'number' ? obj : undefined;
148
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
149
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
150
+ },
151
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
152
+ const obj = getObject(arg1);
153
+ const ret = typeof(obj) === 'string' ? obj : undefined;
154
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
155
+ var len1 = WASM_VECTOR_LEN;
156
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
157
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
158
+ },
159
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
160
+ throw new Error(getStringFromWasm0(arg0, arg1));
161
+ },
162
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
163
+ const ret = getObject(arg0).call(getObject(arg1));
164
+ return addHeapObject(ret);
165
+ }, arguments); },
166
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
167
+ const ret = getObject(arg0).done;
168
+ return ret;
169
+ },
170
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
171
+ const ret = Object.entries(getObject(arg0));
172
+ return addHeapObject(ret);
173
+ },
174
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
175
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
176
+ return addHeapObject(ret);
177
+ }, arguments); },
178
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
179
+ const ret = getObject(arg0)[arg1 >>> 0];
180
+ return addHeapObject(ret);
181
+ },
182
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
183
+ const ret = getObject(arg0)[getObject(arg1)];
184
+ return addHeapObject(ret);
185
+ },
186
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
187
+ let result;
188
+ try {
189
+ result = getObject(arg0) instanceof ArrayBuffer;
190
+ } catch (_) {
191
+ result = false;
192
+ }
193
+ const ret = result;
194
+ return ret;
195
+ },
196
+ __wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
197
+ let result;
198
+ try {
199
+ result = getObject(arg0) instanceof Map;
200
+ } catch (_) {
201
+ result = false;
202
+ }
203
+ const ret = result;
204
+ return ret;
205
+ },
206
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
207
+ let result;
208
+ try {
209
+ result = getObject(arg0) instanceof Uint8Array;
210
+ } catch (_) {
211
+ result = false;
212
+ }
213
+ const ret = result;
214
+ return ret;
215
+ },
216
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
217
+ const ret = Array.isArray(getObject(arg0));
218
+ return ret;
219
+ },
220
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
221
+ const ret = Number.isSafeInteger(getObject(arg0));
222
+ return ret;
223
+ },
224
+ __wbg_iterator_d8f549ec8fb061b1: function() {
225
+ const ret = Symbol.iterator;
226
+ return addHeapObject(ret);
227
+ },
228
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
229
+ const ret = getObject(arg0).length;
230
+ return ret;
231
+ },
232
+ __wbg_length_ea16607d7b61445b: function(arg0) {
233
+ const ret = getObject(arg0).length;
234
+ return ret;
235
+ },
236
+ __wbg_new_49d5571bd3f0c4d4: function() {
237
+ const ret = new Map();
238
+ return addHeapObject(ret);
239
+ },
240
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
241
+ const ret = new Uint8Array(getObject(arg0));
242
+ return addHeapObject(ret);
243
+ },
244
+ __wbg_new_a70fbab9066b301f: function() {
245
+ const ret = new Array();
246
+ return addHeapObject(ret);
247
+ },
248
+ __wbg_new_ab79df5bd7c26067: function() {
249
+ const ret = new Object();
250
+ return addHeapObject(ret);
251
+ },
252
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
253
+ const ret = getObject(arg0).next();
254
+ return addHeapObject(ret);
255
+ }, arguments); },
256
+ __wbg_next_e01a967809d1aa68: function(arg0) {
257
+ const ret = getObject(arg0).next;
258
+ return addHeapObject(ret);
259
+ },
260
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
261
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
262
+ },
263
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
264
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
265
+ },
266
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
267
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
268
+ },
269
+ __wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
270
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
271
+ return addHeapObject(ret);
272
+ },
273
+ __wbg_value_21fc78aab0322612: function(arg0) {
274
+ const ret = getObject(arg0).value;
275
+ return addHeapObject(ret);
276
+ },
277
+ __wbindgen_cast_0000000000000001: function(arg0) {
278
+ // Cast intrinsic for `I64 -> Externref`.
279
+ const ret = arg0;
280
+ return addHeapObject(ret);
281
+ },
282
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
283
+ // Cast intrinsic for `Ref(String) -> Externref`.
284
+ const ret = getStringFromWasm0(arg0, arg1);
285
+ return addHeapObject(ret);
286
+ },
287
+ __wbindgen_cast_0000000000000003: function(arg0) {
288
+ // Cast intrinsic for `U64 -> Externref`.
289
+ const ret = BigInt.asUintN(64, arg0);
290
+ return addHeapObject(ret);
291
+ },
292
+ __wbindgen_object_clone_ref: function(arg0) {
293
+ const ret = getObject(arg0);
294
+ return addHeapObject(ret);
295
+ },
296
+ __wbindgen_object_drop_ref: function(arg0) {
297
+ takeObject(arg0);
298
+ },
299
+ };
300
+ return {
301
+ __proto__: null,
302
+ "./wasm_api_bg.js": import0,
303
+ };
304
+ }
305
+
306
+ function addHeapObject(obj) {
307
+ if (heap_next === heap.length) heap.push(heap.length + 1);
308
+ const idx = heap_next;
309
+ heap_next = heap[idx];
310
+
311
+ heap[idx] = obj;
312
+ return idx;
313
+ }
314
+
315
+ function debugString(val) {
316
+ // primitive types
317
+ const type = typeof val;
318
+ if (type == 'number' || type == 'boolean' || val == null) {
319
+ return `${val}`;
320
+ }
321
+ if (type == 'string') {
322
+ return `"${val}"`;
323
+ }
324
+ if (type == 'symbol') {
325
+ const description = val.description;
326
+ if (description == null) {
327
+ return 'Symbol';
328
+ } else {
329
+ return `Symbol(${description})`;
330
+ }
331
+ }
332
+ if (type == 'function') {
333
+ const name = val.name;
334
+ if (typeof name == 'string' && name.length > 0) {
335
+ return `Function(${name})`;
336
+ } else {
337
+ return 'Function';
338
+ }
339
+ }
340
+ // objects
341
+ if (Array.isArray(val)) {
342
+ const length = val.length;
343
+ let debug = '[';
344
+ if (length > 0) {
345
+ debug += debugString(val[0]);
346
+ }
347
+ for(let i = 1; i < length; i++) {
348
+ debug += ', ' + debugString(val[i]);
349
+ }
350
+ debug += ']';
351
+ return debug;
352
+ }
353
+ // Test for built-in
354
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
355
+ let className;
356
+ if (builtInMatches && builtInMatches.length > 1) {
357
+ className = builtInMatches[1];
358
+ } else {
359
+ // Failed to match the standard '[object ClassName]'
360
+ return toString.call(val);
361
+ }
362
+ if (className == 'Object') {
363
+ // we're a user defined class or Object
364
+ // JSON.stringify avoids problems with cycles, and is generally much
365
+ // easier than looping through ownProperties of `val`.
366
+ try {
367
+ return 'Object(' + JSON.stringify(val) + ')';
368
+ } catch (_) {
369
+ return 'Object';
370
+ }
371
+ }
372
+ // errors
373
+ if (val instanceof Error) {
374
+ return `${val.name}: ${val.message}\n${val.stack}`;
375
+ }
376
+ // TODO we could test for more things here, like `Set`s and `Map`s.
377
+ return className;
378
+ }
379
+
380
+ function dropObject(idx) {
381
+ if (idx < 1028) return;
382
+ heap[idx] = heap_next;
383
+ heap_next = idx;
384
+ }
385
+
386
+ function getArrayU8FromWasm0(ptr, len) {
387
+ ptr = ptr >>> 0;
388
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
389
+ }
390
+
391
+ let cachedDataViewMemory0 = null;
392
+ function getDataViewMemory0() {
393
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
394
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
395
+ }
396
+ return cachedDataViewMemory0;
397
+ }
398
+
399
+ function getStringFromWasm0(ptr, len) {
400
+ ptr = ptr >>> 0;
401
+ return decodeText(ptr, len);
402
+ }
403
+
404
+ let cachedUint8ArrayMemory0 = null;
405
+ function getUint8ArrayMemory0() {
406
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
407
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
408
+ }
409
+ return cachedUint8ArrayMemory0;
410
+ }
411
+
412
+ function getObject(idx) { return heap[idx]; }
413
+
414
+ function handleError(f, args) {
415
+ try {
416
+ return f.apply(this, args);
417
+ } catch (e) {
418
+ wasm.__wbindgen_export3(addHeapObject(e));
419
+ }
420
+ }
421
+
422
+ let heap = new Array(1024).fill(undefined);
423
+ heap.push(undefined, null, true, false);
424
+
425
+ let heap_next = heap.length;
426
+
427
+ function isLikeNone(x) {
428
+ return x === undefined || x === null;
429
+ }
430
+
431
+ function passStringToWasm0(arg, malloc, realloc) {
432
+ if (realloc === undefined) {
433
+ const buf = cachedTextEncoder.encode(arg);
434
+ const ptr = malloc(buf.length, 1) >>> 0;
435
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
436
+ WASM_VECTOR_LEN = buf.length;
437
+ return ptr;
438
+ }
439
+
440
+ let len = arg.length;
441
+ let ptr = malloc(len, 1) >>> 0;
442
+
443
+ const mem = getUint8ArrayMemory0();
444
+
445
+ let offset = 0;
446
+
447
+ for (; offset < len; offset++) {
448
+ const code = arg.charCodeAt(offset);
449
+ if (code > 0x7F) break;
450
+ mem[ptr + offset] = code;
451
+ }
452
+ if (offset !== len) {
453
+ if (offset !== 0) {
454
+ arg = arg.slice(offset);
455
+ }
456
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
457
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
458
+ const ret = cachedTextEncoder.encodeInto(arg, view);
459
+
460
+ offset += ret.written;
461
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
462
+ }
463
+
464
+ WASM_VECTOR_LEN = offset;
465
+ return ptr;
466
+ }
467
+
468
+ function takeObject(idx) {
469
+ const ret = getObject(idx);
470
+ dropObject(idx);
471
+ return ret;
472
+ }
473
+
474
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
475
+ cachedTextDecoder.decode();
476
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
477
+ let numBytesDecoded = 0;
478
+ function decodeText(ptr, len) {
479
+ numBytesDecoded += len;
480
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
481
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
482
+ cachedTextDecoder.decode();
483
+ numBytesDecoded = len;
484
+ }
485
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
486
+ }
487
+
488
+ const cachedTextEncoder = new TextEncoder();
489
+
490
+ if (!('encodeInto' in cachedTextEncoder)) {
491
+ cachedTextEncoder.encodeInto = function (arg, view) {
492
+ const buf = cachedTextEncoder.encode(arg);
493
+ view.set(buf);
494
+ return {
495
+ read: arg.length,
496
+ written: buf.length
497
+ };
498
+ };
499
+ }
500
+
501
+ let WASM_VECTOR_LEN = 0;
502
+
503
+ let wasmModule, wasm;
504
+ function __wbg_finalize_init(instance, module) {
505
+ wasm = instance.exports;
506
+ wasmModule = module;
507
+ cachedDataViewMemory0 = null;
508
+ cachedUint8ArrayMemory0 = null;
509
+ return wasm;
510
+ }
511
+
512
+ async function __wbg_load(module, imports) {
513
+ if (typeof Response === 'function' && module instanceof Response) {
514
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
515
+ try {
516
+ return await WebAssembly.instantiateStreaming(module, imports);
517
+ } catch (e) {
518
+ const validResponse = module.ok && expectedResponseType(module.type);
519
+
520
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
521
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
522
+
523
+ } else { throw e; }
524
+ }
525
+ }
526
+
527
+ const bytes = await module.arrayBuffer();
528
+ return await WebAssembly.instantiate(bytes, imports);
529
+ } else {
530
+ const instance = await WebAssembly.instantiate(module, imports);
531
+
532
+ if (instance instanceof WebAssembly.Instance) {
533
+ return { instance, module };
534
+ } else {
535
+ return instance;
536
+ }
537
+ }
538
+
539
+ function expectedResponseType(type) {
540
+ switch (type) {
541
+ case 'basic': case 'cors': case 'default': return true;
542
+ }
543
+ return false;
544
+ }
545
+ }
546
+
547
+ function initSync(module) {
548
+ if (wasm !== undefined) return wasm;
549
+
550
+
551
+ if (module !== undefined) {
552
+ if (Object.getPrototypeOf(module) === Object.prototype) {
553
+ ({module} = module)
554
+ } else {
555
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
556
+ }
557
+ }
558
+
559
+ const imports = __wbg_get_imports();
560
+ if (!(module instanceof WebAssembly.Module)) {
561
+ module = new WebAssembly.Module(module);
562
+ }
563
+ const instance = new WebAssembly.Instance(module, imports);
564
+ return __wbg_finalize_init(instance, module);
565
+ }
566
+
567
+ async function __wbg_init(module_or_path) {
568
+ if (wasm !== undefined) return wasm;
569
+
570
+
571
+ if (module_or_path !== undefined) {
572
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
573
+ ({module_or_path} = module_or_path)
574
+ } else {
575
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
576
+ }
577
+ }
578
+
579
+ if (module_or_path === undefined) {
580
+ module_or_path = new URL('wasm_api_bg.wasm', import.meta.url);
581
+ }
582
+ const imports = __wbg_get_imports();
583
+
584
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
585
+ module_or_path = fetch(module_or_path);
586
+ }
587
+
588
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
589
+
590
+ return __wbg_finalize_init(instance, module);
591
+ }
592
+
593
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const cx_render: (a: number, b: number, c: number, d: number) => void;
5
+ export const cx_render_markdown: (a: number, b: number, c: number) => void;
6
+ export const __wbindgen_export: (a: number, b: number) => number;
7
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
8
+ export const __wbindgen_export3: (a: number) => void;
9
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
10
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;