@pie-element/shared-math-rendering-mathjax 0.1.8-next.20261021000713 → 0.1.8
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/dist/browser/{PUA-CbN4yDmT.js → PUA-CJdZh2Wf.js} +1 -1
- package/dist/browser/{accents-CuTAD9hz.js → accents-DUN0SGpR.js} +1 -1
- package/dist/browser/{accents-b-i-kTUl6uGi.js → accents-b-i-BonjkJko.js} +1 -1
- package/dist/browser/{arabic-Cuxbegyx.js → arabic-DPsBZ_6r.js} +1 -1
- package/dist/browser/{arrows-Do9BFEGJ.js → arrows-BdSPBhI1.js} +1 -1
- package/dist/browser/{braille-C2YZEvXz.js → braille-D67IP_T7.js} +1 -1
- package/dist/browser/{braille-d-CwSD319B.js → braille-d-CP1DcXKB.js} +1 -1
- package/dist/browser/{calligraphic-DQVVeBro.js → calligraphic-D3g8rnJG.js} +1 -1
- package/dist/browser/{cherokee-CrPMaIKH.js → cherokee-D9O6NlBu.js} +1 -1
- package/dist/browser/{cyrillic-CaFzNnzy.js → cyrillic-DJvnsbqS.js} +1 -1
- package/dist/browser/{cyrillic-ss-CcSXB7Cf.js → cyrillic-ss-C1kj2CQV.js} +1 -1
- package/dist/browser/{devanagari-I6l5QKGg.js → devanagari-DaEPBZJl.js} +1 -1
- package/dist/browser/{double-struck-L6xkxWZd.js → double-struck-DMCx5OKu.js} +1 -1
- package/dist/browser/{fraktur-ClbpHv7v.js → fraktur-BhEkb_dS.js} +1 -1
- package/dist/browser/{greek-r3EyO7jP.js → greek-BUUqFJHy.js} +1 -1
- package/dist/browser/{greek-ss-BtGf6Dlt.js → greek-ss-BEMpAOeY.js} +1 -1
- package/dist/browser/{hebrew-DiqU3zjt.js → hebrew-Bzl8nOEB.js} +1 -1
- package/dist/browser/index.js +360 -8994
- package/dist/browser/{latin-owjqN_GN.js → latin-P9zTNHCd.js} +1 -1
- package/dist/browser/{latin-b-Bzvjr2WB.js → latin-b-PZ4kq6lM.js} +1 -1
- package/dist/browser/{latin-bi-ek_n1Eq7.js → latin-bi-CmN1JUsd.js} +1 -1
- package/dist/browser/{latin-i-CZNhuMaR.js → latin-i-CXBnDzSq.js} +1 -1
- package/dist/browser/{marrows-4z_l10iZ.js → marrows-B7SUVmW5.js} +1 -1
- package/dist/browser/{math-Cs97lB_F.js → math-vXr73lk6.js} +1 -1
- package/dist/browser/{mathjax-7Uf03266.js → mathjax-2nQh1S7u.js} +6701 -6672
- package/dist/browser/{monospace-CGXct8fs.js → monospace-DoS6YAxd.js} +1 -1
- package/dist/browser/{monospace-ex-DvsIXSF9.js → monospace-ex-DRTvVzi3.js} +1 -1
- package/dist/browser/{monospace-l-BGVS0yCI.js → monospace-l-DUCa7CxU.js} +1 -1
- package/dist/browser/{mshapes-B4HEzEgD.js → mshapes-CpjjJVqV.js} +1 -1
- package/dist/browser/{phonetics-D5AM_a_d.js → phonetics-bqiQHE22.js} +1 -1
- package/dist/browser/{phonetics-ss-ChDEGY5y.js → phonetics-ss-Q6DbUcOI.js} +1 -1
- package/dist/browser/{sans-serif-Cj9spRF-.js → sans-serif-Bp2jHFky.js} +1 -1
- package/dist/browser/{sans-serif-b-BdUb_Z_y.js → sans-serif-b-BibGpEzd.js} +1 -1
- package/dist/browser/{sans-serif-bi-DfdLvy57.js → sans-serif-bi-iTiG6eGH.js} +1 -1
- package/dist/browser/{sans-serif-ex-CClUQG0Y.js → sans-serif-ex-C8xaAvoq.js} +1 -1
- package/dist/browser/{sans-serif-i-D3KODAl0.js → sans-serif-i-BU3dKyZu.js} +1 -1
- package/dist/browser/{sans-serif-r-MNhQrum9.js → sans-serif-r-CgglPh5w.js} +1 -1
- package/dist/browser/{script-CKFQLx5d.js → script-ClY84mt2.js} +1 -1
- package/dist/browser/{shapes-DyVxqSxY.js → shapes-myFFmw20.js} +1 -1
- package/dist/browser/speech-worker-BeK2X8Ed.js +132 -0
- package/dist/browser/{symbols-BKRxgFQ3.js → symbols-Cm-dpMqm.js} +1 -1
- package/dist/browser/{symbols-b-i-D3kdYI4S.js → symbols-b-i-Ckpc29j-.js} +1 -1
- package/dist/browser/{variants-vyRqULni.js → variants-CXvLtZew.js} +1 -1
- package/dist/index.js +395 -9029
- package/dist/render-math.d.ts +1 -6
- package/package.json +1 -1
- package/dist/browser/speech-worker-DFQhVkcx.js +0 -158
package/dist/render-math.d.ts
CHANGED
|
@@ -28,12 +28,7 @@ export declare const unWrapMath: (latex: string) => {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* MathML to LaTeX
|
|
32
|
-
* the page installed, such as the legacy renderer under the IIFE strategy, wins; otherwise the
|
|
33
|
-
* bundled one, the same converter legacy @pie-lib/math-rendering bundles, converts, so the ESM
|
|
34
|
-
* page, which installs only `renderMath`, converts too. The bundled converter gives an empty
|
|
35
|
-
* string for MathML it cannot read, and the input back if it throws, so callers treat both as
|
|
36
|
-
* "no LaTeX to give".
|
|
31
|
+
* MathML to LaTeX - MathJax renders MathML natively, so just pass through
|
|
37
32
|
*/
|
|
38
33
|
export declare const mmlToLatex: (mathml: string) => string;
|
|
39
34
|
/**
|
package/package.json
CHANGED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t, n) => () => {
|
|
3
|
-
if (n) throw n[0];
|
|
4
|
-
try {
|
|
5
|
-
return e && (t = e(e = 0)), t;
|
|
6
|
-
} catch (e) {
|
|
7
|
-
throw n = [e], e;
|
|
8
|
-
}
|
|
9
|
-
}, s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), c = (e, n) => {
|
|
10
|
-
let r = {};
|
|
11
|
-
for (var i in e) t(r, i, {
|
|
12
|
-
get: e[i],
|
|
13
|
-
enumerable: !0
|
|
14
|
-
});
|
|
15
|
-
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
16
|
-
}, l = (e, i, o, s) => {
|
|
17
|
-
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
18
|
-
get: ((e) => i[e]).bind(null, d),
|
|
19
|
-
enumerable: !(s = n(i, d)) || s.enumerable
|
|
20
|
-
});
|
|
21
|
-
return e;
|
|
22
|
-
}, u = (n, r, o) => (o = n == null ? {} : e(i(n)), l(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
23
|
-
value: n,
|
|
24
|
-
enumerable: !0
|
|
25
|
-
}) : o, n)), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
26
|
-
if (typeof require < "u") return require.apply(this, arguments);
|
|
27
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
28
|
-
}), f = "4.1.3", p = "https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets", m = "@pie-lib/math-rendering@2", h = ["nemeth", "euro"], g = `mathjax@${f}/sre`, _ = /^[^@]+@[^@]+$/;
|
|
29
|
-
function v(e) {
|
|
30
|
-
if (!e) return;
|
|
31
|
-
let t;
|
|
32
|
-
try {
|
|
33
|
-
t = new URL(e);
|
|
34
|
-
} catch {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (t.origin === "null") return;
|
|
38
|
-
let n = t.pathname.split("/");
|
|
39
|
-
for (let e = n.length - 1; e > 0; e--) {
|
|
40
|
-
let r = n[e];
|
|
41
|
-
if (r === "node_modules") return;
|
|
42
|
-
if (!_.test(r)) continue;
|
|
43
|
-
let i = n[e - 1]?.startsWith("@") ? e - 1 : e;
|
|
44
|
-
return t.origin + n.slice(0, i).join("/");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function y() {
|
|
48
|
-
let e = globalThis[m]?.opts;
|
|
49
|
-
return e && typeof e == "object" ? e : {};
|
|
50
|
-
}
|
|
51
|
-
function b() {
|
|
52
|
-
return y().inTabOrder === !0;
|
|
53
|
-
}
|
|
54
|
-
function x(e) {
|
|
55
|
-
if (typeof e != "string" || !e) return;
|
|
56
|
-
let t = typeof document > "u" ? void 0 : document.baseURI;
|
|
57
|
-
try {
|
|
58
|
-
return new URL(e, t).href.replace(/\/+$/, "");
|
|
59
|
-
} catch {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function S(e) {
|
|
64
|
-
if (!e || typeof e != "object") return;
|
|
65
|
-
let t = /* @__PURE__ */ new Map();
|
|
66
|
-
for (let [n, r] of Object.entries(e)) {
|
|
67
|
-
let e = x(r);
|
|
68
|
-
e && t.set(n, e);
|
|
69
|
-
}
|
|
70
|
-
return t.size ? t : void 0;
|
|
71
|
-
}
|
|
72
|
-
function C(e) {
|
|
73
|
-
if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
|
|
74
|
-
if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
|
|
75
|
-
}
|
|
76
|
-
function w(e, t) {
|
|
77
|
-
let n = y(), r = x(e.assetRoot ?? n.assetRoot) ?? v(t);
|
|
78
|
-
return {
|
|
79
|
-
root: r,
|
|
80
|
-
speechPath: x(e.speechPath ?? n.speechPath) ?? (r ? `${r}/mathjax@4.1.3/sre` : void 0),
|
|
81
|
-
speechLocales: C(e.speechLocales ?? n.speechLocales),
|
|
82
|
-
urls: S(e.assetUrls ?? n.assetUrls)
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function T({ root: e, urls: t }, n) {
|
|
86
|
-
return t?.get(n) ?? (e ? `${e}/${n}` : void 0);
|
|
87
|
-
}
|
|
88
|
-
function E({ speechPath: e, urls: t }, n) {
|
|
89
|
-
return t?.get(`mathjax@4.1.3/sre/${n}`) ?? (e ? `${e}/${n}` : void 0);
|
|
90
|
-
}
|
|
91
|
-
function D(e, t) {
|
|
92
|
-
if (e && t) {
|
|
93
|
-
for (let n of [...e.keys()]) !t.has(n) && !h.includes(n) && e.delete(n);
|
|
94
|
-
for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function O(e) {
|
|
98
|
-
if (e && !e.has("en")) return [...e.keys()].find((e) => !h.includes(e));
|
|
99
|
-
}
|
|
100
|
-
var k = "pie-mathjax-no-asset-root", A = {
|
|
101
|
-
untypeset: "no MathJax loads, so math stays untypeset",
|
|
102
|
-
"no-web-fonts": "math renders without web fonts",
|
|
103
|
-
"no-web-fonts-or-speech": "math renders without web fonts and speech"
|
|
104
|
-
}, j = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
105
|
-
function M(e) {
|
|
106
|
-
let t = globalThis;
|
|
107
|
-
t[j] ??= [];
|
|
108
|
-
let n = t[j];
|
|
109
|
-
if (n.includes(e)) return;
|
|
110
|
-
n.push(e);
|
|
111
|
-
let r = `[math-rendering] No asset root for MathJax: ${A[e]}. Set window['${m}'].opts.assetRoot to an npm root. See ${p}`;
|
|
112
|
-
e === "untypeset" ? console.error(r) : console.warn(r), typeof window < "u" && window.dispatchEvent(new CustomEvent(k, { detail: {
|
|
113
|
-
effect: e,
|
|
114
|
-
message: r,
|
|
115
|
-
docsUrl: p
|
|
116
|
-
} }));
|
|
117
|
-
}
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/speech-worker.ts
|
|
120
|
-
var N = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
121
|
-
function P() {
|
|
122
|
-
let e = globalThis;
|
|
123
|
-
e[N] || (e[N] = !0, console.warn(`[math-rendering] MathJax's speech worker did not start, so speech, braille and the explorer are off. A content security policy must allow blob: workers, and scripts and fetches from the asset root. See ${p}`));
|
|
124
|
-
}
|
|
125
|
-
function F(e) {
|
|
126
|
-
let t = e.webworker;
|
|
127
|
-
if (!t || t.ready) return;
|
|
128
|
-
e.options ??= {};
|
|
129
|
-
let n = e.options;
|
|
130
|
-
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), P();
|
|
131
|
-
}
|
|
132
|
-
function I(e) {
|
|
133
|
-
let t = e?.adaptor, n = t?.createWorker;
|
|
134
|
-
e && t && n && (t.createWorker = async (r, i) => {
|
|
135
|
-
let a = await n.call(t, r, i);
|
|
136
|
-
return a.addEventListener("error", () => F(e), { once: !0 }), a;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
var L = `${g}/mathmaps/`;
|
|
140
|
-
function R(e) {
|
|
141
|
-
let t = E(e, "speech-worker.js");
|
|
142
|
-
if (!t) return;
|
|
143
|
-
let n = e.speechPath ? `${e.speechPath}/mathmaps` : "mathmaps", r = {};
|
|
144
|
-
for (let [t, i] of e.urls ?? []) t.startsWith(L) && (r[`${n}/${t.slice(L.length)}`] = i);
|
|
145
|
-
let i = [`self.maps = ${JSON.stringify(n)};`];
|
|
146
|
-
return Object.keys(r).length && i.push("{", ` const urls = new Map(Object.entries(${JSON.stringify(r)}));`, " const fetchFile = self.fetch.bind(self);", " self.fetch = (input, init) => fetchFile(urls.get(input) ?? input, init);", "}"), i.push(`importScripts(${JSON.stringify(t)});`), i.join("\n");
|
|
147
|
-
}
|
|
148
|
-
function z(e, t) {
|
|
149
|
-
let n = URL.createObjectURL(new Blob([e], { type: "text/javascript" }));
|
|
150
|
-
try {
|
|
151
|
-
let e = new Worker(n);
|
|
152
|
-
return e.onmessage = t, e;
|
|
153
|
-
} finally {
|
|
154
|
-
URL.revokeObjectURL(n);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
//#endregion
|
|
158
|
-
export { k as a, D as c, w as d, s as f, u as g, d as h, f as i, b as l, c as m, R as n, T as o, o as p, z as r, O as s, I as t, M as u };
|