@vutex/vutex-unknown-wasm32 0.0.11 → 0.0.13
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/lib/package.json +1 -1
- package/lib/wetex_wasm.d.ts +6 -0
- package/lib/wetex_wasm.js +94 -28
- package/lib/wetex_wasm_bg.wasm +0 -0
- package/lib/wetex_wasm_bg.wasm.d.ts +1 -0
- package/package.json +2 -2
package/lib/package.json
CHANGED
package/lib/wetex_wasm.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export function measureFormula(source: string, options_json?: string | null): st
|
|
|
11
11
|
*/
|
|
12
12
|
export function renderFormula(source: string, options_json?: string | null): string;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Render a formula to an HTML fragment.
|
|
16
|
+
*/
|
|
17
|
+
export function renderHtml(source: string, options_json?: string | null): string;
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* Render a formula to Presentation MathML.
|
|
16
21
|
*/
|
|
@@ -32,6 +37,7 @@ export interface InitOutput {
|
|
|
32
37
|
readonly memory: WebAssembly.Memory;
|
|
33
38
|
readonly measureFormula: (a: number, b: number, c: number, d: number) => [number, number];
|
|
34
39
|
readonly renderFormula: (a: number, b: number, c: number, d: number) => [number, number];
|
|
40
|
+
readonly renderHtml: (a: number, b: number, c: number, d: number) => [number, number];
|
|
35
41
|
readonly renderMathml: (a: number, b: number, c: number, d: number) => [number, number];
|
|
36
42
|
readonly renderSvg: (a: number, b: number, c: number, d: number) => [number, number];
|
|
37
43
|
readonly wetexVersion: () => [number, number];
|
package/lib/wetex_wasm.js
CHANGED
|
@@ -10,10 +10,17 @@ export function measureFormula(source, options_json) {
|
|
|
10
10
|
let deferred3_0;
|
|
11
11
|
let deferred3_1;
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
let ptr0, len0, ptr1, len1;
|
|
14
|
+
try {
|
|
15
|
+
ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
16
|
+
len0 = WASM_VECTOR_LEN;
|
|
17
|
+
ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
18
|
+
len1 = WASM_VECTOR_LEN;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
21
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
17
24
|
const ret = wasm.measureFormula(ptr0, len0, ptr1, len1);
|
|
18
25
|
deferred3_0 = ret[0];
|
|
19
26
|
deferred3_1 = ret[1];
|
|
@@ -33,10 +40,17 @@ export function renderFormula(source, options_json) {
|
|
|
33
40
|
let deferred3_0;
|
|
34
41
|
let deferred3_1;
|
|
35
42
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
let ptr0, len0, ptr1, len1;
|
|
44
|
+
try {
|
|
45
|
+
ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
46
|
+
len0 = WASM_VECTOR_LEN;
|
|
47
|
+
ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
48
|
+
len1 = WASM_VECTOR_LEN;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
51
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
52
|
+
throw e;
|
|
53
|
+
}
|
|
40
54
|
const ret = wasm.renderFormula(ptr0, len0, ptr1, len1);
|
|
41
55
|
deferred3_0 = ret[0];
|
|
42
56
|
deferred3_1 = ret[1];
|
|
@@ -46,6 +60,36 @@ export function renderFormula(source, options_json) {
|
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Render a formula to an HTML fragment.
|
|
65
|
+
* @param {string} source
|
|
66
|
+
* @param {string | null} [options_json]
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
export function renderHtml(source, options_json) {
|
|
70
|
+
let deferred3_0;
|
|
71
|
+
let deferred3_1;
|
|
72
|
+
try {
|
|
73
|
+
let ptr0, len0, ptr1, len1;
|
|
74
|
+
try {
|
|
75
|
+
ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
76
|
+
len0 = WASM_VECTOR_LEN;
|
|
77
|
+
ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
78
|
+
len1 = WASM_VECTOR_LEN;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
81
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
82
|
+
throw e;
|
|
83
|
+
}
|
|
84
|
+
const ret = wasm.renderHtml(ptr0, len0, ptr1, len1);
|
|
85
|
+
deferred3_0 = ret[0];
|
|
86
|
+
deferred3_1 = ret[1];
|
|
87
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
88
|
+
} finally {
|
|
89
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
49
93
|
/**
|
|
50
94
|
* Render a formula to Presentation MathML.
|
|
51
95
|
* @param {string} source
|
|
@@ -56,10 +100,17 @@ export function renderMathml(source, options_json) {
|
|
|
56
100
|
let deferred3_0;
|
|
57
101
|
let deferred3_1;
|
|
58
102
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
103
|
+
let ptr0, len0, ptr1, len1;
|
|
104
|
+
try {
|
|
105
|
+
ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
|
+
len0 = WASM_VECTOR_LEN;
|
|
107
|
+
ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
108
|
+
len1 = WASM_VECTOR_LEN;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
111
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
63
114
|
const ret = wasm.renderMathml(ptr0, len0, ptr1, len1);
|
|
64
115
|
deferred3_0 = ret[0];
|
|
65
116
|
deferred3_1 = ret[1];
|
|
@@ -79,10 +130,17 @@ export function renderSvg(source, options_json) {
|
|
|
79
130
|
let deferred3_0;
|
|
80
131
|
let deferred3_1;
|
|
81
132
|
try {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
133
|
+
let ptr0, len0, ptr1, len1;
|
|
134
|
+
try {
|
|
135
|
+
ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
136
|
+
len0 = WASM_VECTOR_LEN;
|
|
137
|
+
ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
138
|
+
len1 = WASM_VECTOR_LEN;
|
|
139
|
+
} catch (e) {
|
|
140
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
141
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
86
144
|
const ret = wasm.renderSvg(ptr0, len0, ptr1, len1);
|
|
87
145
|
deferred3_0 = ret[0];
|
|
88
146
|
deferred3_1 = ret[1];
|
|
@@ -113,12 +171,11 @@ function __wbg_get_imports() {
|
|
|
113
171
|
__proto__: null,
|
|
114
172
|
__wbindgen_init_externref_table: function() {
|
|
115
173
|
const table = wasm.__wbindgen_externrefs;
|
|
116
|
-
const offset = table.grow(4);
|
|
117
174
|
table.set(0, undefined);
|
|
118
|
-
table.set(
|
|
119
|
-
table.set(
|
|
120
|
-
table.set(
|
|
121
|
-
table.set(
|
|
175
|
+
table.set(1024, undefined);
|
|
176
|
+
table.set(1025, null);
|
|
177
|
+
table.set(1026, true);
|
|
178
|
+
table.set(1027, false);
|
|
122
179
|
},
|
|
123
180
|
};
|
|
124
181
|
return {
|
|
@@ -128,7 +185,8 @@ function __wbg_get_imports() {
|
|
|
128
185
|
}
|
|
129
186
|
|
|
130
187
|
function getStringFromWasm0(ptr, len) {
|
|
131
|
-
|
|
188
|
+
ptr = ptr >>> 0;
|
|
189
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
132
190
|
}
|
|
133
191
|
|
|
134
192
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -180,18 +238,18 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
180
238
|
return ptr;
|
|
181
239
|
}
|
|
182
240
|
|
|
183
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
241
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
184
242
|
cachedTextDecoder.decode();
|
|
185
243
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
186
244
|
let numBytesDecoded = 0;
|
|
187
|
-
function decodeText(
|
|
188
|
-
numBytesDecoded +=
|
|
245
|
+
function decodeText(bytes) {
|
|
246
|
+
numBytesDecoded += bytes.length;
|
|
189
247
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
190
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
248
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
191
249
|
cachedTextDecoder.decode();
|
|
192
|
-
numBytesDecoded =
|
|
250
|
+
numBytesDecoded = bytes.length;
|
|
193
251
|
}
|
|
194
|
-
return cachedTextDecoder.decode(
|
|
252
|
+
return cachedTextDecoder.decode(bytes);
|
|
195
253
|
}
|
|
196
254
|
|
|
197
255
|
const cachedTextEncoder = new TextEncoder();
|
|
@@ -278,9 +336,17 @@ function initSync(module) {
|
|
|
278
336
|
return __wbg_finalize_init(instance, module);
|
|
279
337
|
}
|
|
280
338
|
|
|
339
|
+
let __wbg_init_promise;
|
|
281
340
|
async function __wbg_init(module_or_path) {
|
|
282
341
|
if (wasm !== undefined) return wasm;
|
|
342
|
+
if (__wbg_init_promise === undefined) {
|
|
343
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
344
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
345
|
+
}
|
|
346
|
+
return __wbg_init_promise;
|
|
347
|
+
}
|
|
283
348
|
|
|
349
|
+
async function __wbg_init_once(module_or_path) {
|
|
284
350
|
|
|
285
351
|
if (module_or_path !== undefined) {
|
|
286
352
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
package/lib/wetex_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const measureFormula: (a: number, b: number, c: number, d: number) => [number, number];
|
|
5
5
|
export const renderFormula: (a: number, b: number, c: number, d: number) => [number, number];
|
|
6
|
+
export const renderHtml: (a: number, b: number, c: number, d: number) => [number, number];
|
|
6
7
|
export const renderMathml: (a: number, b: number, c: number, d: number) => [number, number];
|
|
7
8
|
export const renderSvg: (a: number, b: number, c: number, d: number) => [number, number];
|
|
8
9
|
export const wetexVersion: () => [number, number];
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
|
-
"directory": "projects/
|
|
14
|
+
"directory": "projects/vutex.ts/platforms/vutex-unknown-wasm32",
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/notedge/VuTeX.git"
|
|
17
17
|
},
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
22
|
"types": "./lib/wetex_wasm.d.ts",
|
|
23
|
-
"version": "0.0.
|
|
23
|
+
"version": "0.0.13"
|
|
24
24
|
}
|