woxi-wasm 0.3.0 → 0.4.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.3.0",
3
+ "version": "0.4.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,34 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+
3
4
  /**
4
- * Register (or replace) an in-memory file so `Import["name"]` can read it
5
- * in the browser.
5
+ * Clear all interpreter state (variables and function definitions).
6
6
  */
7
- export function set_virtual_file(name: string, data: Uint8Array): void;
7
+ export function clear(): void;
8
+
8
9
  /**
9
10
  * Remove all host-registered in-memory files.
10
11
  */
11
12
  export function clear_virtual_files(): void;
13
+
12
14
  /**
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
+ * Evaluate a Wolfram Language expression and return the result.
16
+ * If the expression produces Print output, it is prepended to the result.
18
17
  */
19
- export function take_exported_files(): string;
18
+ export function evaluate(input: string): string;
19
+
20
20
  /**
21
- * Split `input` into top-level statements and return a JSON array of strings.
22
- * Lets the front-end loop one statement at a time so output (and side
23
- * effects like `Pause[n]`) appear progressively rather than batched.
21
+ * Evaluate all top-level statements and return a JSON array of output items.
22
+ * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
23
+ * "manipulate") and corresponding content fields.
24
24
  */
25
- export function split_statements(input: string): string;
25
+ export function evaluate_all(input: string): string;
26
+
26
27
  /**
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.
28
+ * Evaluate, returning only the final expression result (no Print output).
30
29
  */
31
- export function evaluate_statement(stmt: string): string;
30
+ export function evaluate_expr(input: string): string;
31
+
32
32
  /**
33
33
  * Evaluate a Manipulate body with a specific set of variable bindings
34
34
  * and return a single JSON output item representing the result.
@@ -42,6 +42,7 @@ export function evaluate_statement(stmt: string): string;
42
42
  * the evaluate_all manipulate item: `{"svg": "...", "text": "..."}`.
43
43
  */
44
44
  export function evaluate_manipulate(body: string, bindings_json: string): string;
45
+
45
46
  /**
46
47
  * Evaluate each Manipulate control's `Enabled` condition against a binding
47
48
  * set and return a JSON array of booleans (one per control, in order).
@@ -49,10 +50,11 @@ export function evaluate_manipulate(body: string, bindings_json: string): string
49
50
  * `conditions_json` is a JSON string array aligned with the control list;
50
51
  * an empty string marks a control with no condition (always enabled).
51
52
  * `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
+ * `evaluate_manipulate`. Used by the Playground to gray out controls that a
53
54
  * `Enabled -> Dynamic[…]` option has switched off for the current state.
54
55
  */
55
56
  export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
57
+
56
58
  /**
57
59
  * Render a Manipulate body, its extra display elements, and any pending
58
60
  * interactive write-backs in one call. Used by widgets that have display
@@ -68,42 +70,57 @@ export function evaluate_manipulate_enabled(conditions_json: string, bindings_js
68
70
  * "state":{name:value,…}}`.
69
71
  */
70
72
  export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
73
+
71
74
  /**
72
- * Evaluate, returning only the final expression result (no Print output).
73
- */
74
- export function evaluate_expr(input: string): string;
75
- export function init(): void;
76
- /**
77
- * Evaluate a Wolfram Language expression and return the result.
78
- * If the expression produces Print output, it is prepended to the result.
75
+ * Evaluate a single statement and return a JSON array of output items
76
+ * (same shape as `evaluate_all`'s elements). Use together with
77
+ * `split_statements` for progressive output.
79
78
  */
80
- export function evaluate(input: string): string;
79
+ export function evaluate_statement(stmt: string): string;
80
+
81
81
  /**
82
82
  * Return the captured SVG graphics from the last `evaluate()` call, if any.
83
83
  * Returns an empty string when there is no graphics output.
84
84
  */
85
85
  export function get_graphics(): string;
86
+
86
87
  /**
87
88
  * Return the playable audio (base64-encoded) from the last `evaluate()`
88
89
  * call, if any. Returns an empty string when there is no sound.
89
90
  */
90
91
  export function get_sound(): string;
92
+
91
93
  /**
92
94
  * Return warnings from the last `evaluate()` call as newline-separated text.
93
95
  * Returns an empty string when there are no warnings.
94
96
  */
95
97
  export function get_warnings(): string;
96
- /**
97
- * Clear all interpreter state (variables and function definitions).
98
- */
99
- export function clear(): void;
98
+
99
+ export function init(): void;
100
+
100
101
  /**
101
102
  * Enable or disable dark mode for SVG output colors.
102
103
  */
103
104
  export function set_dark_mode(enabled: boolean): void;
105
+
104
106
  /**
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.
107
+ * Register (or replace) an in-memory file so `Import["name"]` can read it
108
+ * in the browser.
108
109
  */
109
- export function evaluate_all(input: string): string;
110
+ export function set_virtual_file(name: string, data: Uint8Array): void;
111
+
112
+ /**
113
+ * Split `input` into top-level statements and return a JSON array of strings.
114
+ * Lets the front-end loop one statement at a time so output (and side
115
+ * effects like `Pause[n]`) appear progressively rather than batched.
116
+ */
117
+ export function split_statements(input: string): string;
118
+
119
+ /**
120
+ * Return every file produced by `Export` since the last call as a JSON array
121
+ * of `{"name":…, "data":<base64>[, "rasterize":"png"]}`, then clear the store.
122
+ * The host decodes each base64 payload into a Blob and renders a download
123
+ * link; entries carrying `rasterize` hold SVG the host converts to that raster
124
+ * format first. Draining on read keeps each evaluation's exports separate.
125
+ */
126
+ export function take_exported_files(): string;