woxi-wasm 0.2.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.2.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,19 +1,22 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Return the playable audio (base64-encoded) from the last `evaluate()`
5
- * call, if any. Returns an empty string when there is no sound.
4
+ * Register (or replace) an in-memory file so `Import["name"]` can read it
5
+ * in the browser.
6
6
  */
7
- export function get_sound(): string;
7
+ export function set_virtual_file(name: string, data: Uint8Array): void;
8
8
  /**
9
9
  * Remove all host-registered in-memory files.
10
10
  */
11
11
  export function clear_virtual_files(): void;
12
12
  /**
13
- * Return SVG rendering of the last text result (with superscripts etc.).
14
- * Returns an empty string when there is no output SVG (e.g. for Graphics results).
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.
15
18
  */
16
- export function get_output_svg(): string;
19
+ export function take_exported_files(): string;
17
20
  /**
18
21
  * Split `input` into top-level statements and return a JSON array of strings.
19
22
  * Lets the front-end loop one statement at a time so output (and side
@@ -21,29 +24,11 @@ export function get_output_svg(): string;
21
24
  */
22
25
  export function split_statements(input: string): string;
23
26
  /**
24
- * Register (or replace) an in-memory file so `Import["name"]` can read it
25
- * in the browser.
26
- */
27
- export function set_virtual_file(name: string, data: Uint8Array): void;
28
- /**
29
- * Render a Manipulate body, its extra display elements, and any pending
30
- * interactive write-backs in one call. Used by widgets that have display
31
- * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
32
- * state.
33
- *
34
- * `displays_json` and `mutations_json` are JSON string arrays. Each
35
- * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
36
- * re-render; the updated value of every mutated variable is returned under
37
- * `state` so the frontend can keep its binding set in sync.
38
- *
39
- * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
40
- * "state":{name:value,…}}`.
41
- */
42
- export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
43
- /**
44
- * Enable or disable dark mode for SVG output colors.
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.
45
30
  */
46
- export function set_dark_mode(enabled: boolean): void;
31
+ export function evaluate_statement(stmt: string): string;
47
32
  /**
48
33
  * Evaluate a Manipulate body with a specific set of variable bindings
49
34
  * and return a single JSON output item representing the result.
@@ -57,21 +42,6 @@ export function set_dark_mode(enabled: boolean): void;
57
42
  * the evaluate_all manipulate item: `{"svg": "...", "text": "..."}`.
58
43
  */
59
44
  export function evaluate_manipulate(body: string, bindings_json: string): string;
60
- /**
61
- * Evaluate all top-level statements and return a JSON array of output items.
62
- * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
63
- * "manipulate") and corresponding content fields.
64
- */
65
- export function evaluate_all(input: string): string;
66
- /**
67
- * Return the captured GraphicsBox expression from the last `evaluate()` call.
68
- * Returns an empty string when there is no graphics output.
69
- */
70
- export function get_graphicsbox(): string;
71
- /**
72
- * Clear all interpreter state (variables and function definitions).
73
- */
74
- export function clear(): void;
75
45
  /**
76
46
  * Evaluate each Manipulate control's `Enabled` condition against a binding
77
47
  * set and return a JSON array of booleans (one per control, in order).
@@ -84,28 +54,56 @@ export function clear(): void;
84
54
  */
85
55
  export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
86
56
  /**
87
- * Evaluate a single statement and return a JSON array of output items
88
- * (same shape as `evaluate_all`'s elements). Use together with
89
- * `split_statements` for progressive output.
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,…}}`.
90
69
  */
91
- export function evaluate_statement(stmt: string): string;
70
+ export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
92
71
  /**
93
72
  * Evaluate, returning only the final expression result (no Print output).
94
73
  */
95
74
  export function evaluate_expr(input: string): string;
75
+ export function init(): void;
96
76
  /**
97
- * Return warnings from the last `evaluate()` call as newline-separated text.
98
- * Returns an empty string when there are no warnings.
77
+ * Evaluate a Wolfram Language expression and return the result.
78
+ * If the expression produces Print output, it is prepended to the result.
99
79
  */
100
- export function get_warnings(): string;
80
+ export function evaluate(input: string): string;
101
81
  /**
102
82
  * Return the captured SVG graphics from the last `evaluate()` call, if any.
103
83
  * Returns an empty string when there is no graphics output.
104
84
  */
105
85
  export function get_graphics(): string;
106
- export function init(): void;
107
86
  /**
108
- * Evaluate a Wolfram Language expression and return the result.
109
- * If the expression produces Print output, it is prepended to the result.
87
+ * Return the playable audio (base64-encoded) from the last `evaluate()`
88
+ * call, if any. Returns an empty string when there is no sound.
110
89
  */
111
- export function evaluate(input: string): string;
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;
96
+ /**
97
+ * Clear all interpreter state (variables and function definitions).
98
+ */
99
+ export function clear(): void;
100
+ /**
101
+ * Enable or disable dark mode for SVG output colors.
102
+ */
103
+ export function set_dark_mode(enabled: boolean): void;
104
+ /**
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.
108
+ */
109
+ export function evaluate_all(input: string): string;
package/pkg/woxi.js CHANGED
@@ -175,22 +175,25 @@ function getArrayU8FromWasm0(ptr, len) {
175
175
  ptr = ptr >>> 0;
176
176
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
177
177
  }
178
+
179
+ function passArray8ToWasm0(arg, malloc) {
180
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
181
+ getUint8ArrayMemory0().set(arg, ptr / 1);
182
+ WASM_VECTOR_LEN = arg.length;
183
+ return ptr;
184
+ }
178
185
  /**
179
- * Return the playable audio (base64-encoded) from the last `evaluate()`
180
- * call, if any. Returns an empty string when there is no sound.
181
- * @returns {string}
186
+ * Register (or replace) an in-memory file so `Import["name"]` can read it
187
+ * in the browser.
188
+ * @param {string} name
189
+ * @param {Uint8Array} data
182
190
  */
183
- exports.get_sound = function() {
184
- let deferred1_0;
185
- let deferred1_1;
186
- try {
187
- const ret = wasm.get_sound();
188
- deferred1_0 = ret[0];
189
- deferred1_1 = ret[1];
190
- return getStringFromWasm0(ret[0], ret[1]);
191
- } finally {
192
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
193
- }
191
+ exports.set_virtual_file = function(name, data) {
192
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
193
+ const len0 = WASM_VECTOR_LEN;
194
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
195
+ const len1 = WASM_VECTOR_LEN;
196
+ wasm.set_virtual_file(ptr0, len0, ptr1, len1);
194
197
  };
195
198
 
196
199
  /**
@@ -201,15 +204,18 @@ exports.clear_virtual_files = function() {
201
204
  };
202
205
 
203
206
  /**
204
- * Return SVG rendering of the last text result (with superscripts etc.).
205
- * Returns an empty string when there is no output SVG (e.g. for Graphics results).
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.
206
212
  * @returns {string}
207
213
  */
208
- exports.get_output_svg = function() {
214
+ exports.take_exported_files = function() {
209
215
  let deferred1_0;
210
216
  let deferred1_1;
211
217
  try {
212
- const ret = wasm.get_output_svg();
218
+ const ret = wasm.take_exported_files();
213
219
  deferred1_0 = ret[0];
214
220
  deferred1_1 = ret[1];
215
221
  return getStringFromWasm0(ret[0], ret[1]);
@@ -240,74 +246,28 @@ exports.split_statements = function(input) {
240
246
  }
241
247
  };
242
248
 
243
- function passArray8ToWasm0(arg, malloc) {
244
- const ptr = malloc(arg.length * 1, 1) >>> 0;
245
- getUint8ArrayMemory0().set(arg, ptr / 1);
246
- WASM_VECTOR_LEN = arg.length;
247
- return ptr;
248
- }
249
- /**
250
- * Register (or replace) an in-memory file so `Import["name"]` can read it
251
- * in the browser.
252
- * @param {string} name
253
- * @param {Uint8Array} data
254
- */
255
- exports.set_virtual_file = function(name, data) {
256
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
- const len0 = WASM_VECTOR_LEN;
258
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
259
- const len1 = WASM_VECTOR_LEN;
260
- wasm.set_virtual_file(ptr0, len0, ptr1, len1);
261
- };
262
-
263
249
  /**
264
- * Render a Manipulate body, its extra display elements, and any pending
265
- * interactive write-backs in one call. Used by widgets that have display
266
- * elements (e.g. a `Checkbox` grid) that both read and rewrite shared
267
- * state.
268
- *
269
- * `displays_json` and `mutations_json` are JSON string arrays. Each
270
- * mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
271
- * re-render; the updated value of every mutated variable is returned under
272
- * `state` so the frontend can keep its binding set in sync.
273
- *
274
- * The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
275
- * "state":{name:value,…}}`.
276
- * @param {string} body
277
- * @param {string} displays_json
278
- * @param {string} bindings_json
279
- * @param {string} mutations_json
250
+ * Evaluate a single statement and return a JSON array of output items
251
+ * (same shape as `evaluate_all`'s elements). Use together with
252
+ * `split_statements` for progressive output.
253
+ * @param {string} stmt
280
254
  * @returns {string}
281
255
  */
282
- exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
283
- let deferred5_0;
284
- let deferred5_1;
256
+ exports.evaluate_statement = function(stmt) {
257
+ let deferred2_0;
258
+ let deferred2_1;
285
259
  try {
286
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
260
+ const ptr0 = passStringToWasm0(stmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
287
261
  const len0 = WASM_VECTOR_LEN;
288
- const ptr1 = passStringToWasm0(displays_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
289
- const len1 = WASM_VECTOR_LEN;
290
- const ptr2 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
291
- const len2 = WASM_VECTOR_LEN;
292
- const ptr3 = passStringToWasm0(mutations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
- const len3 = WASM_VECTOR_LEN;
294
- const ret = wasm.evaluate_manipulate_full(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
295
- deferred5_0 = ret[0];
296
- deferred5_1 = ret[1];
262
+ const ret = wasm.evaluate_statement(ptr0, len0);
263
+ deferred2_0 = ret[0];
264
+ deferred2_1 = ret[1];
297
265
  return getStringFromWasm0(ret[0], ret[1]);
298
266
  } finally {
299
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
267
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
300
268
  }
301
269
  };
302
270
 
303
- /**
304
- * Enable or disable dark mode for SVG output colors.
305
- * @param {boolean} enabled
306
- */
307
- exports.set_dark_mode = function(enabled) {
308
- wasm.set_dark_mode(enabled);
309
- };
310
-
311
271
  /**
312
272
  * Evaluate a Manipulate body with a specific set of variable bindings
313
273
  * and return a single JSON output item representing the result.
@@ -340,53 +300,6 @@ exports.evaluate_manipulate = function(body, bindings_json) {
340
300
  }
341
301
  };
342
302
 
343
- /**
344
- * Evaluate all top-level statements and return a JSON array of output items.
345
- * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
346
- * "manipulate") and corresponding content fields.
347
- * @param {string} input
348
- * @returns {string}
349
- */
350
- exports.evaluate_all = function(input) {
351
- let deferred2_0;
352
- let deferred2_1;
353
- try {
354
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
355
- const len0 = WASM_VECTOR_LEN;
356
- const ret = wasm.evaluate_all(ptr0, len0);
357
- deferred2_0 = ret[0];
358
- deferred2_1 = ret[1];
359
- return getStringFromWasm0(ret[0], ret[1]);
360
- } finally {
361
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
362
- }
363
- };
364
-
365
- /**
366
- * Return the captured GraphicsBox expression from the last `evaluate()` call.
367
- * Returns an empty string when there is no graphics output.
368
- * @returns {string}
369
- */
370
- exports.get_graphicsbox = function() {
371
- let deferred1_0;
372
- let deferred1_1;
373
- try {
374
- const ret = wasm.get_graphicsbox();
375
- deferred1_0 = ret[0];
376
- deferred1_1 = ret[1];
377
- return getStringFromWasm0(ret[0], ret[1]);
378
- } finally {
379
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
380
- }
381
- };
382
-
383
- /**
384
- * Clear all interpreter state (variables and function definitions).
385
- */
386
- exports.clear = function() {
387
- wasm.clear();
388
- };
389
-
390
303
  /**
391
304
  * Evaluate each Manipulate control's `Enabled` condition against a binding
392
305
  * set and return a JSON array of booleans (one per control, in order).
@@ -418,19 +331,57 @@ exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
418
331
  };
419
332
 
420
333
  /**
421
- * Evaluate a single statement and return a JSON array of output items
422
- * (same shape as `evaluate_all`'s elements). Use together with
423
- * `split_statements` for progressive output.
424
- * @param {string} stmt
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
425
350
  * @returns {string}
426
351
  */
427
- exports.evaluate_statement = function(stmt) {
352
+ exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
353
+ let deferred5_0;
354
+ let deferred5_1;
355
+ try {
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];
367
+ return getStringFromWasm0(ret[0], ret[1]);
368
+ } finally {
369
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
370
+ }
371
+ };
372
+
373
+ /**
374
+ * Evaluate, returning only the final expression result (no Print output).
375
+ * @param {string} input
376
+ * @returns {string}
377
+ */
378
+ exports.evaluate_expr = function(input) {
428
379
  let deferred2_0;
429
380
  let deferred2_1;
430
381
  try {
431
- const ptr0 = passStringToWasm0(stmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
382
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
432
383
  const len0 = WASM_VECTOR_LEN;
433
- const ret = wasm.evaluate_statement(ptr0, len0);
384
+ const ret = wasm.evaluate_expr(ptr0, len0);
434
385
  deferred2_0 = ret[0];
435
386
  deferred2_1 = ret[1];
436
387
  return getStringFromWasm0(ret[0], ret[1]);
@@ -439,18 +390,23 @@ exports.evaluate_statement = function(stmt) {
439
390
  }
440
391
  };
441
392
 
393
+ exports.init = function() {
394
+ wasm.init();
395
+ };
396
+
442
397
  /**
443
- * Evaluate, returning only the final expression result (no Print output).
398
+ * Evaluate a Wolfram Language expression and return the result.
399
+ * If the expression produces Print output, it is prepended to the result.
444
400
  * @param {string} input
445
401
  * @returns {string}
446
402
  */
447
- exports.evaluate_expr = function(input) {
403
+ exports.evaluate = function(input) {
448
404
  let deferred2_0;
449
405
  let deferred2_1;
450
406
  try {
451
407
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
452
408
  const len0 = WASM_VECTOR_LEN;
453
- const ret = wasm.evaluate_expr(ptr0, len0);
409
+ const ret = wasm.evaluate(ptr0, len0);
454
410
  deferred2_0 = ret[0];
455
411
  deferred2_1 = ret[1];
456
412
  return getStringFromWasm0(ret[0], ret[1]);
@@ -460,15 +416,15 @@ exports.evaluate_expr = function(input) {
460
416
  };
461
417
 
462
418
  /**
463
- * Return warnings from the last `evaluate()` call as newline-separated text.
464
- * 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.
465
421
  * @returns {string}
466
422
  */
467
- exports.get_warnings = function() {
423
+ exports.get_graphics = function() {
468
424
  let deferred1_0;
469
425
  let deferred1_1;
470
426
  try {
471
- const ret = wasm.get_warnings();
427
+ const ret = wasm.get_graphics();
472
428
  deferred1_0 = ret[0];
473
429
  deferred1_1 = ret[1];
474
430
  return getStringFromWasm0(ret[0], ret[1]);
@@ -478,15 +434,15 @@ exports.get_warnings = function() {
478
434
  };
479
435
 
480
436
  /**
481
- * Return the captured SVG graphics from the last `evaluate()` call, if any.
482
- * Returns an empty string when there is no graphics output.
437
+ * Return the playable audio (base64-encoded) from the last `evaluate()`
438
+ * call, if any. Returns an empty string when there is no sound.
483
439
  * @returns {string}
484
440
  */
485
- exports.get_graphics = function() {
441
+ exports.get_sound = function() {
486
442
  let deferred1_0;
487
443
  let deferred1_1;
488
444
  try {
489
- const ret = wasm.get_graphics();
445
+ const ret = wasm.get_sound();
490
446
  deferred1_0 = ret[0];
491
447
  deferred1_1 = ret[1];
492
448
  return getStringFromWasm0(ret[0], ret[1]);
@@ -495,23 +451,53 @@ exports.get_graphics = function() {
495
451
  }
496
452
  };
497
453
 
498
- exports.init = function() {
499
- wasm.init();
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
+ }
500
470
  };
501
471
 
502
472
  /**
503
- * Evaluate a Wolfram Language expression and return the result.
504
- * If the expression produces Print output, it is prepended to the result.
473
+ * Clear all interpreter state (variables and function definitions).
474
+ */
475
+ exports.clear = function() {
476
+ wasm.clear();
477
+ };
478
+
479
+ /**
480
+ * Enable or disable dark mode for SVG output colors.
481
+ * @param {boolean} enabled
482
+ */
483
+ exports.set_dark_mode = function(enabled) {
484
+ wasm.set_dark_mode(enabled);
485
+ };
486
+
487
+ /**
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.
505
491
  * @param {string} input
506
492
  * @returns {string}
507
493
  */
508
- exports.evaluate = function(input) {
494
+ exports.evaluate_all = function(input) {
509
495
  let deferred2_0;
510
496
  let deferred2_1;
511
497
  try {
512
498
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
513
499
  const len0 = WASM_VECTOR_LEN;
514
- const ret = wasm.evaluate(ptr0, len0);
500
+ const ret = wasm.evaluate_all(ptr0, len0);
515
501
  deferred2_0 = ret[0];
516
502
  deferred2_1 = ret[1];
517
503
  return getStringFromWasm0(ret[0], ret[1]);
@@ -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_a5ed8b2ee9da4ed7 = 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_a5ed8b2ee9da4ed7 = function() { return handleErro
561
547
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
562
548
  }, arguments) };
563
549
 
564
- exports.__wbg___woxi_report_panic_be5ad4a7b740d1b8 = 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;