@pie-element/element-player 0.1.2-next.7 → 0.1.2
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/README.md +7 -6
- package/dist/index.d.ts +1 -1
- package/dist/lib/element-loader.d.ts +1 -1
- package/dist/lib/math-rendering-types.d.ts +0 -6
- package/dist/lib/types.d.ts +0 -6
- package/dist/lib/unified-player-loader.d.ts +4 -4
- package/dist/math-mathjax-Y_CMClAV.js +179 -0
- package/dist/pie-element-player.css +1 -1
- package/dist/pie-element-player.js +776 -749
- package/package.json +2 -2
- package/dist/math-mathjax-BunKB1NS.js +0 -102
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Shared PIE element player web component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"unpkg": "./dist/pie-element-player.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dev": "vite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.1
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.1"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
//#region ../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e = {
|
|
3
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
4
|
-
overarc: "\\overparen",
|
|
5
|
-
napprox: "\\not\\approx",
|
|
6
|
-
longdiv: "\\enclose{longdiv}",
|
|
7
|
-
abs: ["\\left|#1\\right|", 1]
|
|
8
|
-
}, t = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", n = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, r = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, i = /\\embed\{newLine\}\[\]/g, a = [
|
|
9
|
-
["$$", "$$"],
|
|
10
|
-
["$", "$"],
|
|
11
|
-
["\\[", "\\]"],
|
|
12
|
-
["\\(", "\\)"]
|
|
13
|
-
], o = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
|
|
14
|
-
function s() {
|
|
15
|
-
return window.MathJax;
|
|
16
|
-
}
|
|
17
|
-
function c(e) {
|
|
18
|
-
let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
|
|
19
|
-
for (let [e, n] of a) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
|
|
20
|
-
return t;
|
|
21
|
-
}
|
|
22
|
-
function l(e) {
|
|
23
|
-
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
24
|
-
if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
|
|
25
|
-
let e = t.textContent;
|
|
26
|
-
e && (t.textContent = `\\(${c(e)}\\)`.replace(i, "\\newline "), t.dataset.mathHandled = "true");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function u(e, t) {
|
|
30
|
-
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
31
|
-
return (t ? r : n).test(e.textContent ?? "");
|
|
32
|
-
}
|
|
33
|
-
function d(n) {
|
|
34
|
-
return new Promise((r, i) => {
|
|
35
|
-
let { useSingleDollar: a = !1, accessibility: o = !0, loadFonts: c = !0, srcUrl: l } = n, u = {
|
|
36
|
-
loader: {
|
|
37
|
-
load: o ? ["a11y/assistive-mml"] : [],
|
|
38
|
-
failed: (e) => i(e)
|
|
39
|
-
},
|
|
40
|
-
startup: {
|
|
41
|
-
typeset: !1,
|
|
42
|
-
ready: () => {
|
|
43
|
-
let e = s()?.startup;
|
|
44
|
-
e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => r(), i);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
tex: { macros: { ...e } },
|
|
48
|
-
options: {
|
|
49
|
-
enableMenu: o,
|
|
50
|
-
menuOptions: { settings: {
|
|
51
|
-
assistiveMml: o,
|
|
52
|
-
enrich: !1,
|
|
53
|
-
inTabOrder: !1
|
|
54
|
-
} }
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
a && u.tex && (console.warn(t), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
58
|
-
let d = document.createElement("script");
|
|
59
|
-
d.src = l || "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", d.async = !0, d.onerror = () => i(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function f(e) {
|
|
63
|
-
return new Promise((t, n) => {
|
|
64
|
-
let r = e.startup ?? {};
|
|
65
|
-
e.startup = r;
|
|
66
|
-
let i = r.ready;
|
|
67
|
-
r.ready = () => {
|
|
68
|
-
let e = s()?.startup;
|
|
69
|
-
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function p(e) {
|
|
74
|
-
let t = s();
|
|
75
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : f(t) : d(e);
|
|
76
|
-
}
|
|
77
|
-
function m(e) {
|
|
78
|
-
return p(e).then(() => {
|
|
79
|
-
typeof s()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function h(e) {
|
|
83
|
-
let t = globalThis, n = t[o];
|
|
84
|
-
return n || (n = m(e), t[o] = n), n;
|
|
85
|
-
}
|
|
86
|
-
function g(e = {}) {
|
|
87
|
-
let t = e.useSingleDollar ?? !1;
|
|
88
|
-
return async (n) => {
|
|
89
|
-
if (typeof window > "u") return;
|
|
90
|
-
l(n);
|
|
91
|
-
let r = h(e);
|
|
92
|
-
if (!u(n, t)) {
|
|
93
|
-
r.catch(() => {});
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
await r;
|
|
97
|
-
let i = s();
|
|
98
|
-
await i?.startup?.promise, typeof i?.typesetPromise == "function" && await i.typesetPromise([n]);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { g as t };
|