woxi-wasm 0.2.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 +1 -1
- package/pkg/woxi.d.ts +72 -57
- package/pkg/woxi.js +612 -675
- package/pkg/woxi_bg.wasm +2 -2
- package/pkg/woxi_bg.wasm.d.ts +3 -4
package/package.json
CHANGED
package/pkg/woxi.d.ts
CHANGED
|
@@ -1,49 +1,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* call, if any. Returns an empty string when there is no sound.
|
|
5
|
+
* Clear all interpreter state (variables and function definitions).
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
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
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export function get_output_svg(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Split `input` into top-level statements and return a JSON array of strings.
|
|
19
|
-
* Lets the front-end loop one statement at a time so output (and side
|
|
20
|
-
* effects like `Pause[n]`) appear progressively rather than batched.
|
|
21
|
-
*/
|
|
22
|
-
export function split_statements(input: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Register (or replace) an in-memory file so `Import["name"]` can read it
|
|
25
|
-
* in the browser.
|
|
15
|
+
* Evaluate a Wolfram Language expression and return the result.
|
|
16
|
+
* If the expression produces Print output, it is prepended to the result.
|
|
26
17
|
*/
|
|
27
|
-
export function
|
|
18
|
+
export function evaluate(input: string): string;
|
|
19
|
+
|
|
28
20
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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,…}}`.
|
|
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.
|
|
41
24
|
*/
|
|
42
|
-
export function
|
|
25
|
+
export function evaluate_all(input: string): string;
|
|
26
|
+
|
|
43
27
|
/**
|
|
44
|
-
*
|
|
28
|
+
* Evaluate, returning only the final expression result (no Print output).
|
|
45
29
|
*/
|
|
46
|
-
export function
|
|
30
|
+
export function evaluate_expr(input: string): string;
|
|
31
|
+
|
|
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,7 @@ 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;
|
|
45
|
+
|
|
75
46
|
/**
|
|
76
47
|
* Evaluate each Manipulate control's `Enabled` condition against a binding
|
|
77
48
|
* set and return a JSON array of booleans (one per control, in order).
|
|
@@ -79,33 +50,77 @@ export function clear(): void;
|
|
|
79
50
|
* `conditions_json` is a JSON string array aligned with the control list;
|
|
80
51
|
* an empty string marks a control with no condition (always enabled).
|
|
81
52
|
* `bindings_json` is the same JSON object of variable bindings used by
|
|
82
|
-
* `evaluate_manipulate`. Used by the Playground to
|
|
53
|
+
* `evaluate_manipulate`. Used by the Playground to gray out controls that a
|
|
83
54
|
* `Enabled -> Dynamic[…]` option has switched off for the current state.
|
|
84
55
|
*/
|
|
85
56
|
export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Render a Manipulate body, its extra display elements, and any pending
|
|
60
|
+
* interactive write-backs in one call. Used by widgets that have display
|
|
61
|
+
* elements (e.g. a `Checkbox` grid) that both read and rewrite shared
|
|
62
|
+
* state.
|
|
63
|
+
*
|
|
64
|
+
* `displays_json` and `mutations_json` are JSON string arrays. Each
|
|
65
|
+
* mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
|
|
66
|
+
* re-render; the updated value of every mutated variable is returned under
|
|
67
|
+
* `state` so the frontend can keep its binding set in sync.
|
|
68
|
+
*
|
|
69
|
+
* The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
|
|
70
|
+
* "state":{name:value,…}}`.
|
|
71
|
+
*/
|
|
72
|
+
export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
|
|
73
|
+
|
|
86
74
|
/**
|
|
87
75
|
* Evaluate a single statement and return a JSON array of output items
|
|
88
76
|
* (same shape as `evaluate_all`'s elements). Use together with
|
|
89
77
|
* `split_statements` for progressive output.
|
|
90
78
|
*/
|
|
91
79
|
export function evaluate_statement(stmt: string): string;
|
|
80
|
+
|
|
92
81
|
/**
|
|
93
|
-
*
|
|
82
|
+
* Return the captured SVG graphics from the last `evaluate()` call, if any.
|
|
83
|
+
* Returns an empty string when there is no graphics output.
|
|
94
84
|
*/
|
|
95
|
-
export function
|
|
85
|
+
export function get_graphics(): string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Return the playable audio (base64-encoded) from the last `evaluate()`
|
|
89
|
+
* call, if any. Returns an empty string when there is no sound.
|
|
90
|
+
*/
|
|
91
|
+
export function get_sound(): string;
|
|
92
|
+
|
|
96
93
|
/**
|
|
97
94
|
* Return warnings from the last `evaluate()` call as newline-separated text.
|
|
98
95
|
* Returns an empty string when there are no warnings.
|
|
99
96
|
*/
|
|
100
97
|
export function get_warnings(): string;
|
|
98
|
+
|
|
99
|
+
export function init(): void;
|
|
100
|
+
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
103
|
-
* Returns an empty string when there is no graphics output.
|
|
102
|
+
* Enable or disable dark mode for SVG output colors.
|
|
104
103
|
*/
|
|
105
|
-
export function
|
|
106
|
-
|
|
104
|
+
export function set_dark_mode(enabled: boolean): void;
|
|
105
|
+
|
|
107
106
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
107
|
+
* Register (or replace) an in-memory file so `Import["name"]` can read it
|
|
108
|
+
* in the browser.
|
|
110
109
|
*/
|
|
111
|
-
export function
|
|
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;
|