woxi-wasm 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "woxi-wasm",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Interpreter for a subset of the Wolfram Language, compiled to WebAssembly",
5
5
  "keywords": [
6
6
  "wolfram",
package/pkg/woxi.d.ts CHANGED
@@ -1,42 +1,22 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Render a Manipulate body, its extra display elements, and any pending
5
- * interactive write-backs in one call. Used by widgets that have display
6
- * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
7
- * state.
8
- *
9
- * `displays_json` and `mutations_json` are JSON string arrays. Each
10
- * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
11
- * re-render; the updated value of every mutated variable is returned under
12
- * `state` so the frontend can keep its binding set in sync.
13
- *
14
- * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
15
- * "state":{name:value,…}}`.
16
- */
17
- export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
18
3
  /**
19
4
  * Register (or replace) an in-memory file so `Import["name"]` can read it
20
5
  * in the browser.
21
6
  */
22
7
  export function set_virtual_file(name: string, data: Uint8Array): void;
23
8
  /**
24
- * Return the captured SVG graphics from the last `evaluate()` call, if any.
25
- * Returns an empty string when there is no graphics output.
26
- */
27
- export function get_graphics(): string;
28
- /**
29
- * Evaluate all top-level statements and return a JSON array of output items.
30
- * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
31
- * "manipulate") and corresponding content fields.
9
+ * Remove all host-registered in-memory files.
32
10
  */
33
- export function evaluate_all(input: string): string;
11
+ export function clear_virtual_files(): void;
34
12
  /**
35
- * Evaluate a single statement and return a JSON array of output items
36
- * (same shape as `evaluate_all`'s elements). Use together with
37
- * `split_statements` for progressive output.
13
+ * Return every file produced by `Export` since the last call as a JSON array
14
+ * of `{"name":…, "data":<base64>[, "rasterize":"png"]}`, then clear the store.
15
+ * The host decodes each base64 payload into a Blob and renders a download
16
+ * link; entries carrying `rasterize` hold SVG the host converts to that raster
17
+ * format first. Draining on read keeps each evaluation's exports separate.
38
18
  */
39
- export function evaluate_statement(stmt: string): string;
19
+ export function take_exported_files(): string;
40
20
  /**
41
21
  * Split `input` into top-level statements and return a JSON array of strings.
42
22
  * Lets the front-end loop one statement at a time so output (and side
@@ -44,9 +24,11 @@ export function evaluate_statement(stmt: string): string;
44
24
  */
45
25
  export function split_statements(input: string): string;
46
26
  /**
47
- * Remove all host-registered in-memory files.
27
+ * Evaluate a single statement and return a JSON array of output items
28
+ * (same shape as `evaluate_all`'s elements). Use together with
29
+ * `split_statements` for progressive output.
48
30
  */
49
- export function clear_virtual_files(): void;
31
+ export function evaluate_statement(stmt: string): string;
50
32
  /**
51
33
  * Evaluate a Manipulate body with a specific set of variable bindings
52
34
  * and return a single JSON output item representing the result.
@@ -61,51 +43,67 @@ export function clear_virtual_files(): void;
61
43
  */
62
44
  export function evaluate_manipulate(body: string, bindings_json: string): string;
63
45
  /**
64
- * Evaluate, returning only the final expression result (no Print output).
46
+ * Evaluate each Manipulate control's `Enabled` condition against a binding
47
+ * set and return a JSON array of booleans (one per control, in order).
48
+ *
49
+ * `conditions_json` is a JSON string array aligned with the control list;
50
+ * an empty string marks a control with no condition (always enabled).
51
+ * `bindings_json` is the same JSON object of variable bindings used by
52
+ * `evaluate_manipulate`. Used by the Playground to grey out controls that a
53
+ * `Enabled -> Dynamic[…]` option has switched off for the current state.
65
54
  */
66
- export function evaluate_expr(input: string): string;
55
+ export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
67
56
  /**
68
- * Return SVG rendering of the last text result (with superscripts etc.).
69
- * Returns an empty string when there is no output SVG (e.g. for Graphics results).
57
+ * Render a Manipulate body, its extra display elements, and any pending
58
+ * interactive write-backs in one call. Used by widgets that have display
59
+ * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
60
+ * state.
61
+ *
62
+ * `displays_json` and `mutations_json` are JSON string arrays. Each
63
+ * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
64
+ * re-render; the updated value of every mutated variable is returned under
65
+ * `state` so the frontend can keep its binding set in sync.
66
+ *
67
+ * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
68
+ * "state":{name:value,…}}`.
70
69
  */
71
- export function get_output_svg(): string;
70
+ export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
72
71
  /**
73
- * Enable or disable dark mode for SVG output colors.
72
+ * Evaluate, returning only the final expression result (no Print output).
74
73
  */
75
- export function set_dark_mode(enabled: boolean): void;
74
+ export function evaluate_expr(input: string): string;
75
+ export function init(): void;
76
76
  /**
77
77
  * Evaluate a Wolfram Language expression and return the result.
78
78
  * If the expression produces Print output, it is prepended to the result.
79
79
  */
80
80
  export function evaluate(input: string): string;
81
81
  /**
82
- * Return warnings from the last `evaluate()` call as newline-separated text.
83
- * Returns an empty string when there are no warnings.
82
+ * Return the captured SVG graphics from the last `evaluate()` call, if any.
83
+ * Returns an empty string when there is no graphics output.
84
84
  */
85
- export function get_warnings(): string;
85
+ export function get_graphics(): string;
86
86
  /**
87
87
  * Return the playable audio (base64-encoded) from the last `evaluate()`
88
88
  * call, if any. Returns an empty string when there is no sound.
89
89
  */
90
90
  export function get_sound(): string;
91
+ /**
92
+ * Return warnings from the last `evaluate()` call as newline-separated text.
93
+ * Returns an empty string when there are no warnings.
94
+ */
95
+ export function get_warnings(): string;
91
96
  /**
92
97
  * Clear all interpreter state (variables and function definitions).
93
98
  */
94
99
  export function clear(): void;
95
- export function init(): void;
96
100
  /**
97
- * Evaluate each Manipulate control's `Enabled` condition against a binding
98
- * set and return a JSON array of booleans (one per control, in order).
99
- *
100
- * `conditions_json` is a JSON string array aligned with the control list;
101
- * an empty string marks a control with no condition (always enabled).
102
- * `bindings_json` is the same JSON object of variable bindings used by
103
- * `evaluate_manipulate`. Used by the Playground to grey out controls that a
104
- * `Enabled -> Dynamic[…]` option has switched off for the current state.
101
+ * Enable or disable dark mode for SVG output colors.
105
102
  */
106
- export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
103
+ export function set_dark_mode(enabled: boolean): void;
107
104
  /**
108
- * Return the captured GraphicsBox expression from the last `evaluate()` call.
109
- * Returns an empty string when there is no graphics output.
105
+ * Evaluate all top-level statements and return a JSON array of output items.
106
+ * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
107
+ * "manipulate") and corresponding content fields.
110
108
  */
111
- export function get_graphicsbox(): string;
109
+ export function evaluate_all(input: string): string;
package/pkg/woxi.js CHANGED
@@ -175,45 +175,6 @@ function getArrayU8FromWasm0(ptr, len) {
175
175
  ptr = ptr >>> 0;
176
176
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
177
177
  }
178
- /**
179
- * Render a Manipulate body, its extra display elements, and any pending
180
- * interactive write-backs in one call. Used by widgets that have display
181
- * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
182
- * state.
183
- *
184
- * `displays_json` and `mutations_json` are JSON string arrays. Each
185
- * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
186
- * re-render; the updated value of every mutated variable is returned under
187
- * `state` so the frontend can keep its binding set in sync.
188
- *
189
- * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
190
- * "state":{name:value,…}}`.
191
- * @param {string} body
192
- * @param {string} displays_json
193
- * @param {string} bindings_json
194
- * @param {string} mutations_json
195
- * @returns {string}
196
- */
197
- exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
198
- let deferred5_0;
199
- let deferred5_1;
200
- try {
201
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
202
- const len0 = WASM_VECTOR_LEN;
203
- const ptr1 = passStringToWasm0(displays_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
204
- const len1 = WASM_VECTOR_LEN;
205
- const ptr2 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
206
- const len2 = WASM_VECTOR_LEN;
207
- const ptr3 = passStringToWasm0(mutations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
208
- const len3 = WASM_VECTOR_LEN;
209
- const ret = wasm.evaluate_manipulate_full(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
210
- deferred5_0 = ret[0];
211
- deferred5_1 = ret[1];
212
- return getStringFromWasm0(ret[0], ret[1]);
213
- } finally {
214
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
215
- }
216
- };
217
178
 
218
179
  function passArray8ToWasm0(arg, malloc) {
219
180
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -236,15 +197,25 @@ exports.set_virtual_file = function(name, data) {
236
197
  };
237
198
 
238
199
  /**
239
- * Return the captured SVG graphics from the last `evaluate()` call, if any.
240
- * Returns an empty string when there is no graphics output.
200
+ * Remove all host-registered in-memory files.
201
+ */
202
+ exports.clear_virtual_files = function() {
203
+ wasm.clear_virtual_files();
204
+ };
205
+
206
+ /**
207
+ * Return every file produced by `Export` since the last call as a JSON array
208
+ * of `{"name":…, "data":<base64>[, "rasterize":"png"]}`, then clear the store.
209
+ * The host decodes each base64 payload into a Blob and renders a download
210
+ * link; entries carrying `rasterize` hold SVG the host converts to that raster
211
+ * format first. Draining on read keeps each evaluation's exports separate.
241
212
  * @returns {string}
242
213
  */
243
- exports.get_graphics = function() {
214
+ exports.take_exported_files = function() {
244
215
  let deferred1_0;
245
216
  let deferred1_1;
246
217
  try {
247
- const ret = wasm.get_graphics();
218
+ const ret = wasm.take_exported_files();
248
219
  deferred1_0 = ret[0];
249
220
  deferred1_1 = ret[1];
250
221
  return getStringFromWasm0(ret[0], ret[1]);
@@ -254,19 +225,19 @@ exports.get_graphics = function() {
254
225
  };
255
226
 
256
227
  /**
257
- * Evaluate all top-level statements and return a JSON array of output items.
258
- * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
259
- * "manipulate") and corresponding content fields.
228
+ * Split `input` into top-level statements and return a JSON array of strings.
229
+ * Lets the front-end loop one statement at a time so output (and side
230
+ * effects like `Pause[n]`) appear progressively rather than batched.
260
231
  * @param {string} input
261
232
  * @returns {string}
262
233
  */
263
- exports.evaluate_all = function(input) {
234
+ exports.split_statements = function(input) {
264
235
  let deferred2_0;
265
236
  let deferred2_1;
266
237
  try {
267
238
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268
239
  const len0 = WASM_VECTOR_LEN;
269
- const ret = wasm.evaluate_all(ptr0, len0);
240
+ const ret = wasm.split_statements(ptr0, len0);
270
241
  deferred2_0 = ret[0];
271
242
  deferred2_1 = ret[1];
272
243
  return getStringFromWasm0(ret[0], ret[1]);
@@ -297,35 +268,6 @@ exports.evaluate_statement = function(stmt) {
297
268
  }
298
269
  };
299
270
 
300
- /**
301
- * Split `input` into top-level statements and return a JSON array of strings.
302
- * Lets the front-end loop one statement at a time so output (and side
303
- * effects like `Pause[n]`) appear progressively rather than batched.
304
- * @param {string} input
305
- * @returns {string}
306
- */
307
- exports.split_statements = function(input) {
308
- let deferred2_0;
309
- let deferred2_1;
310
- try {
311
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
312
- const len0 = WASM_VECTOR_LEN;
313
- const ret = wasm.split_statements(ptr0, len0);
314
- deferred2_0 = ret[0];
315
- deferred2_1 = ret[1];
316
- return getStringFromWasm0(ret[0], ret[1]);
317
- } finally {
318
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
319
- }
320
- };
321
-
322
- /**
323
- * Remove all host-registered in-memory files.
324
- */
325
- exports.clear_virtual_files = function() {
326
- wasm.clear_virtual_files();
327
- };
328
-
329
271
  /**
330
272
  * Evaluate a Manipulate body with a specific set of variable bindings
331
273
  * and return a single JSON output item representing the result.
@@ -359,49 +301,97 @@ exports.evaluate_manipulate = function(body, bindings_json) {
359
301
  };
360
302
 
361
303
  /**
362
- * Evaluate, returning only the final expression result (no Print output).
363
- * @param {string} input
304
+ * Evaluate each Manipulate control's `Enabled` condition against a binding
305
+ * set and return a JSON array of booleans (one per control, in order).
306
+ *
307
+ * `conditions_json` is a JSON string array aligned with the control list;
308
+ * an empty string marks a control with no condition (always enabled).
309
+ * `bindings_json` is the same JSON object of variable bindings used by
310
+ * `evaluate_manipulate`. Used by the Playground to grey out controls that a
311
+ * `Enabled -> Dynamic[…]` option has switched off for the current state.
312
+ * @param {string} conditions_json
313
+ * @param {string} bindings_json
364
314
  * @returns {string}
365
315
  */
366
- exports.evaluate_expr = function(input) {
367
- let deferred2_0;
368
- let deferred2_1;
316
+ exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
317
+ let deferred3_0;
318
+ let deferred3_1;
369
319
  try {
370
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const ptr0 = passStringToWasm0(conditions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
371
321
  const len0 = WASM_VECTOR_LEN;
372
- const ret = wasm.evaluate_expr(ptr0, len0);
373
- deferred2_0 = ret[0];
374
- deferred2_1 = ret[1];
322
+ const ptr1 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
323
+ const len1 = WASM_VECTOR_LEN;
324
+ const ret = wasm.evaluate_manipulate_enabled(ptr0, len0, ptr1, len1);
325
+ deferred3_0 = ret[0];
326
+ deferred3_1 = ret[1];
375
327
  return getStringFromWasm0(ret[0], ret[1]);
376
328
  } finally {
377
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
329
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
378
330
  }
379
331
  };
380
332
 
381
333
  /**
382
- * Return SVG rendering of the last text result (with superscripts etc.).
383
- * Returns an empty string when there is no output SVG (e.g. for Graphics results).
334
+ * Render a Manipulate body, its extra display elements, and any pending
335
+ * interactive write-backs in one call. Used by widgets that have display
336
+ * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
337
+ * state.
338
+ *
339
+ * `displays_json` and `mutations_json` are JSON string arrays. Each
340
+ * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
341
+ * re-render; the updated value of every mutated variable is returned under
342
+ * `state` so the frontend can keep its binding set in sync.
343
+ *
344
+ * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
345
+ * "state":{name:value,…}}`.
346
+ * @param {string} body
347
+ * @param {string} displays_json
348
+ * @param {string} bindings_json
349
+ * @param {string} mutations_json
384
350
  * @returns {string}
385
351
  */
386
- exports.get_output_svg = function() {
387
- let deferred1_0;
388
- let deferred1_1;
352
+ exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
353
+ let deferred5_0;
354
+ let deferred5_1;
389
355
  try {
390
- const ret = wasm.get_output_svg();
391
- deferred1_0 = ret[0];
392
- deferred1_1 = ret[1];
356
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ptr1 = passStringToWasm0(displays_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
359
+ const len1 = WASM_VECTOR_LEN;
360
+ const ptr2 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ const len2 = WASM_VECTOR_LEN;
362
+ const ptr3 = passStringToWasm0(mutations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
+ const len3 = WASM_VECTOR_LEN;
364
+ const ret = wasm.evaluate_manipulate_full(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
365
+ deferred5_0 = ret[0];
366
+ deferred5_1 = ret[1];
393
367
  return getStringFromWasm0(ret[0], ret[1]);
394
368
  } finally {
395
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
369
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
396
370
  }
397
371
  };
398
372
 
399
373
  /**
400
- * Enable or disable dark mode for SVG output colors.
401
- * @param {boolean} enabled
374
+ * Evaluate, returning only the final expression result (no Print output).
375
+ * @param {string} input
376
+ * @returns {string}
402
377
  */
403
- exports.set_dark_mode = function(enabled) {
404
- wasm.set_dark_mode(enabled);
378
+ exports.evaluate_expr = function(input) {
379
+ let deferred2_0;
380
+ let deferred2_1;
381
+ try {
382
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ret = wasm.evaluate_expr(ptr0, len0);
385
+ deferred2_0 = ret[0];
386
+ deferred2_1 = ret[1];
387
+ return getStringFromWasm0(ret[0], ret[1]);
388
+ } finally {
389
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
390
+ }
391
+ };
392
+
393
+ exports.init = function() {
394
+ wasm.init();
405
395
  };
406
396
 
407
397
  /**
@@ -426,15 +416,15 @@ exports.evaluate = function(input) {
426
416
  };
427
417
 
428
418
  /**
429
- * Return warnings from the last `evaluate()` call as newline-separated text.
430
- * Returns an empty string when there are no warnings.
419
+ * Return the captured SVG graphics from the last `evaluate()` call, if any.
420
+ * Returns an empty string when there is no graphics output.
431
421
  * @returns {string}
432
422
  */
433
- exports.get_warnings = function() {
423
+ exports.get_graphics = function() {
434
424
  let deferred1_0;
435
425
  let deferred1_1;
436
426
  try {
437
- const ret = wasm.get_warnings();
427
+ const ret = wasm.get_graphics();
438
428
  deferred1_0 = ret[0];
439
429
  deferred1_1 = ret[1];
440
430
  return getStringFromWasm0(ret[0], ret[1]);
@@ -461,6 +451,24 @@ exports.get_sound = function() {
461
451
  }
462
452
  };
463
453
 
454
+ /**
455
+ * Return warnings from the last `evaluate()` call as newline-separated text.
456
+ * Returns an empty string when there are no warnings.
457
+ * @returns {string}
458
+ */
459
+ exports.get_warnings = function() {
460
+ let deferred1_0;
461
+ let deferred1_1;
462
+ try {
463
+ const ret = wasm.get_warnings();
464
+ deferred1_0 = ret[0];
465
+ deferred1_1 = ret[1];
466
+ return getStringFromWasm0(ret[0], ret[1]);
467
+ } finally {
468
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
469
+ }
470
+ };
471
+
464
472
  /**
465
473
  * Clear all interpreter state (variables and function definitions).
466
474
  */
@@ -468,55 +476,33 @@ exports.clear = function() {
468
476
  wasm.clear();
469
477
  };
470
478
 
471
- exports.init = function() {
472
- wasm.init();
473
- };
474
-
475
479
  /**
476
- * Evaluate each Manipulate control's `Enabled` condition against a binding
477
- * set and return a JSON array of booleans (one per control, in order).
478
- *
479
- * `conditions_json` is a JSON string array aligned with the control list;
480
- * an empty string marks a control with no condition (always enabled).
481
- * `bindings_json` is the same JSON object of variable bindings used by
482
- * `evaluate_manipulate`. Used by the Playground to grey out controls that a
483
- * `Enabled -> Dynamic[…]` option has switched off for the current state.
484
- * @param {string} conditions_json
485
- * @param {string} bindings_json
486
- * @returns {string}
480
+ * Enable or disable dark mode for SVG output colors.
481
+ * @param {boolean} enabled
487
482
  */
488
- exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
489
- let deferred3_0;
490
- let deferred3_1;
491
- try {
492
- const ptr0 = passStringToWasm0(conditions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
- const len0 = WASM_VECTOR_LEN;
494
- const ptr1 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
495
- const len1 = WASM_VECTOR_LEN;
496
- const ret = wasm.evaluate_manipulate_enabled(ptr0, len0, ptr1, len1);
497
- deferred3_0 = ret[0];
498
- deferred3_1 = ret[1];
499
- return getStringFromWasm0(ret[0], ret[1]);
500
- } finally {
501
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
502
- }
483
+ exports.set_dark_mode = function(enabled) {
484
+ wasm.set_dark_mode(enabled);
503
485
  };
504
486
 
505
487
  /**
506
- * Return the captured GraphicsBox expression from the last `evaluate()` call.
507
- * Returns an empty string when there is no graphics output.
488
+ * Evaluate all top-level statements and return a JSON array of output items.
489
+ * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
490
+ * "manipulate") and corresponding content fields.
491
+ * @param {string} input
508
492
  * @returns {string}
509
493
  */
510
- exports.get_graphicsbox = function() {
511
- let deferred1_0;
512
- let deferred1_1;
494
+ exports.evaluate_all = function(input) {
495
+ let deferred2_0;
496
+ let deferred2_1;
513
497
  try {
514
- const ret = wasm.get_graphicsbox();
515
- deferred1_0 = ret[0];
516
- deferred1_1 = ret[1];
498
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
499
+ const len0 = WASM_VECTOR_LEN;
500
+ const ret = wasm.evaluate_all(ptr0, len0);
501
+ deferred2_0 = ret[0];
502
+ deferred2_1 = ret[1];
517
503
  return getStringFromWasm0(ret[0], ret[1]);
518
504
  } finally {
519
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
505
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
520
506
  }
521
507
  };
522
508
 
@@ -553,7 +539,7 @@ exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
553
539
  throw new Error(getStringFromWasm0(arg0, arg1));
554
540
  };
555
541
 
556
- exports.__wbg___woxi_fetch_url_b456f49aff4e3138 = function() { return handleError(function (arg0, arg1, arg2) {
542
+ exports.__wbg___woxi_fetch_url_1a2edada61209f50 = function() { return handleError(function (arg0, arg1, arg2) {
557
543
  const ret = __woxi_fetch_url(getStringFromWasm0(arg1, arg2));
558
544
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
559
545
  const len1 = WASM_VECTOR_LEN;
@@ -561,7 +547,7 @@ exports.__wbg___woxi_fetch_url_b456f49aff4e3138 = function() { return handleErro
561
547
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
562
548
  }, arguments) };
563
549
 
564
- exports.__wbg___woxi_report_panic_13444e27f27ce1cd = function() { return handleError(function (arg0, arg1) {
550
+ exports.__wbg___woxi_report_panic_295788df1c67306c = function() { return handleError(function (arg0, arg1) {
565
551
  __woxi_report_panic(getStringFromWasm0(arg0, arg1));
566
552
  }, arguments) };
567
553
 
package/pkg/woxi_bg.wasm CHANGED
Binary file
@@ -10,13 +10,12 @@ export const evaluate_manipulate_enabled: (a: number, b: number, c: number, d: n
10
10
  export const evaluate_manipulate_full: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
11
11
  export const evaluate_statement: (a: number, b: number) => [number, number];
12
12
  export const get_graphics: () => [number, number];
13
- export const get_graphicsbox: () => [number, number];
14
- export const get_output_svg: () => [number, number];
15
13
  export const get_sound: () => [number, number];
16
14
  export const get_warnings: () => [number, number];
17
15
  export const set_dark_mode: (a: number) => void;
18
16
  export const set_virtual_file: (a: number, b: number, c: number, d: number) => void;
19
17
  export const split_statements: (a: number, b: number) => [number, number];
18
+ export const take_exported_files: () => [number, number];
20
19
  export const clear: () => void;
21
20
  export const init: () => void;
22
21
  export const __wbindgen_malloc: (a: number, b: number) => number;