@pie-element/element-player 0.1.2 → 0.1.3-next.20261002222413
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.
|
@@ -32,49 +32,53 @@ var i = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", a = {
|
|
|
32
32
|
["$", "$"],
|
|
33
33
|
["\\[", "\\]"],
|
|
34
34
|
["\\(", "\\)"]
|
|
35
|
-
], d = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), f = "PIE-MJX-CHTML-styles", p = "MJX-CHTML-styles", m =
|
|
36
|
-
function
|
|
35
|
+
], d = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), f = "PIE-MJX-CHTML-styles", p = "MJX-CHTML-styles", m = "PIE-MJX-SVG-styles", h = "MJX-SVG-styles", g = "PIE-MathJax-Menu-Settings", _ = [p, h], v = 200, y = 201;
|
|
36
|
+
function b(e) {
|
|
37
37
|
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
38
38
|
for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function x() {
|
|
41
41
|
return window.MathJax;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function S(e) {
|
|
44
44
|
for (let [t, n] of u) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
45
45
|
return e;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function C(e) {
|
|
48
|
+
return S(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
49
49
|
}
|
|
50
|
-
var
|
|
51
|
-
function
|
|
52
|
-
let n = e.closest(`.${
|
|
53
|
-
return n !== null && t.contains(n) && !n.classList.contains(
|
|
50
|
+
var w = "mathjax_ignore", T = "mathjax_process";
|
|
51
|
+
function E(e, t) {
|
|
52
|
+
let n = e.closest(`.${w}, .${T}`);
|
|
53
|
+
return n !== null && t.contains(n) && !n.classList.contains(T);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function D(e) {
|
|
56
56
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
57
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") ||
|
|
57
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || E(t, e)) continue;
|
|
58
58
|
let n = t.textContent;
|
|
59
|
-
n && (t.textContent = `\\(${
|
|
59
|
+
n && (t.textContent = `\\(${C(n)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function O(e, t) {
|
|
63
63
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
64
64
|
return (t ? c : s).test(e.textContent ?? "");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function k(e) {
|
|
67
67
|
return new Promise((t, n) => {
|
|
68
68
|
let { useSingleDollar: r = !1, accessibility: s = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
|
|
69
69
|
loader: {
|
|
70
70
|
load: s ? ["a11y/assistive-mml"] : [],
|
|
71
|
-
failed: (e) => n(e)
|
|
71
|
+
failed: (e) => n(e),
|
|
72
|
+
"output/svg": { ready: (e) => {
|
|
73
|
+
let t = x();
|
|
74
|
+
return A(t) && j(t), e;
|
|
75
|
+
} }
|
|
72
76
|
},
|
|
73
77
|
startup: {
|
|
74
78
|
typeset: !1,
|
|
75
79
|
ready: () => {
|
|
76
|
-
let e =
|
|
77
|
-
i &&
|
|
80
|
+
let e = x(), r = e?.startup, i = A(e);
|
|
81
|
+
i && (j(e), M(e)), r?.defaultReady?.(), i && N(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
78
82
|
}
|
|
79
83
|
},
|
|
80
84
|
tex: { macros: { ...a } },
|
|
@@ -84,7 +88,8 @@ function T(e) {
|
|
|
84
88
|
assistiveMml: s,
|
|
85
89
|
enrich: !1,
|
|
86
90
|
inTabOrder: !1
|
|
87
|
-
} }
|
|
91
|
+
} },
|
|
92
|
+
a11y: { inTabOrder: !1 }
|
|
88
93
|
}
|
|
89
94
|
};
|
|
90
95
|
r && u.tex && (console.warn(o), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
@@ -92,88 +97,123 @@ function T(e) {
|
|
|
92
97
|
d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
t && (t.STYLESHEETID = f);
|
|
100
|
+
function A(e) {
|
|
101
|
+
return !!e?.version?.startsWith("4.");
|
|
98
102
|
}
|
|
99
|
-
function
|
|
103
|
+
function j(e) {
|
|
104
|
+
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
105
|
+
n && (n.STYLESHEETID = f);
|
|
106
|
+
let r = t?.svg_ts?.SVG;
|
|
107
|
+
r && (r.STYLESHEETID = m);
|
|
108
|
+
}
|
|
109
|
+
function M(e) {
|
|
110
|
+
let t = e?._?.ui?.menu?.Menu?.Menu;
|
|
111
|
+
if (t) {
|
|
112
|
+
t.MENU_STORAGE = g;
|
|
113
|
+
try {
|
|
114
|
+
let e = localStorage.getItem(g);
|
|
115
|
+
if (!e) return;
|
|
116
|
+
let { assistiveMml: t, ...n } = JSON.parse(e);
|
|
117
|
+
if (t === void 0) return;
|
|
118
|
+
Object.keys(n).length ? localStorage.setItem(g, JSON.stringify(n)) : localStorage.removeItem(g);
|
|
119
|
+
} catch {}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function N(e) {
|
|
100
123
|
if (!e) return;
|
|
101
124
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
102
125
|
let n = e.typesetRoot;
|
|
103
|
-
!n || t.has(n) || (
|
|
126
|
+
!n || t.has(n) || (b(n), t.add(n));
|
|
104
127
|
};
|
|
105
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
128
|
+
e.addRenderAction?.("pie-strip-latex", y, (e) => {
|
|
106
129
|
for (let t of e.math ?? []) n(t);
|
|
107
130
|
return !1;
|
|
108
131
|
}, (e) => {
|
|
109
132
|
let t = e.typesetRoot;
|
|
110
|
-
return t &&
|
|
133
|
+
return t && b(t), !1;
|
|
111
134
|
});
|
|
112
135
|
let r = e.outputJax?.chtmlStyles;
|
|
113
|
-
r?.id === p && (r.id = f),
|
|
136
|
+
r?.id === p && (r.id = f), I();
|
|
114
137
|
}
|
|
115
|
-
function
|
|
116
|
-
return e instanceof HTMLStyleElement &&
|
|
138
|
+
function P(e) {
|
|
139
|
+
return e instanceof HTMLStyleElement && _.includes(e.id);
|
|
117
140
|
}
|
|
118
|
-
function
|
|
141
|
+
function F(e) {
|
|
119
142
|
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
120
143
|
}
|
|
121
|
-
function
|
|
122
|
-
let e = document.head, t = [...e.children].find(
|
|
144
|
+
function I() {
|
|
145
|
+
let e = document.head, t = [...e.children].find(P);
|
|
123
146
|
if (t) {
|
|
124
|
-
|
|
147
|
+
F(t);
|
|
125
148
|
return;
|
|
126
149
|
}
|
|
127
150
|
let n = new MutationObserver((e) => {
|
|
128
151
|
for (let t of e) {
|
|
129
|
-
let e = [...t.addedNodes].find(
|
|
152
|
+
let e = [...t.addedNodes].find(P);
|
|
130
153
|
if (e) {
|
|
131
|
-
|
|
154
|
+
F(e), n.disconnect();
|
|
132
155
|
return;
|
|
133
156
|
}
|
|
134
157
|
}
|
|
135
158
|
});
|
|
136
159
|
n.observe(e, { childList: !0 });
|
|
137
160
|
}
|
|
138
|
-
function
|
|
161
|
+
function L(e) {
|
|
162
|
+
let t = e?.math;
|
|
163
|
+
if (!t?.remove) return;
|
|
164
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= v && e.typesetRoot?.isConnected === !1);
|
|
165
|
+
if (n.length !== 0) {
|
|
166
|
+
for (let e of [...n].reverse()) e.clear?.();
|
|
167
|
+
t.remove(...n);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function R(e) {
|
|
139
171
|
return new Promise((t, n) => {
|
|
140
172
|
let r = e.startup ?? {};
|
|
141
173
|
e.startup = r;
|
|
142
174
|
let i = r.ready;
|
|
143
175
|
r.ready = () => {
|
|
144
|
-
let e =
|
|
176
|
+
let e = x()?.startup;
|
|
145
177
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
146
178
|
};
|
|
147
179
|
});
|
|
148
180
|
}
|
|
149
|
-
function
|
|
150
|
-
let t =
|
|
151
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
181
|
+
function z(e) {
|
|
182
|
+
let t = x();
|
|
183
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : R(t) : k(e);
|
|
152
184
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
155
|
-
typeof
|
|
185
|
+
function B(e) {
|
|
186
|
+
return z(e).then(() => {
|
|
187
|
+
typeof x()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
156
188
|
});
|
|
157
189
|
}
|
|
158
|
-
function
|
|
190
|
+
function V(e) {
|
|
159
191
|
let t = globalThis, n = t[d];
|
|
160
|
-
return n || (n =
|
|
192
|
+
return n || (n = B(e), t[d] = n), n;
|
|
161
193
|
}
|
|
162
|
-
function
|
|
194
|
+
function H(e = {}) {
|
|
163
195
|
let t = e.useSingleDollar ?? !1;
|
|
164
196
|
return async (i) => {
|
|
165
197
|
if (typeof window > "u") return;
|
|
166
198
|
let a = r();
|
|
167
|
-
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`),
|
|
168
|
-
let o =
|
|
169
|
-
if (!
|
|
199
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), D(i);
|
|
200
|
+
let o = V(e);
|
|
201
|
+
if (!O(i, t)) {
|
|
170
202
|
o.catch(() => {});
|
|
171
203
|
return;
|
|
172
204
|
}
|
|
173
205
|
await o;
|
|
174
|
-
let s =
|
|
175
|
-
await s?.startup?.promise, typeof s?.typesetPromise == "function"
|
|
206
|
+
let s = x();
|
|
207
|
+
if (await s?.startup?.promise, typeof s?.typesetPromise == "function") {
|
|
208
|
+
L(s.startup?.document);
|
|
209
|
+
try {
|
|
210
|
+
await s.typesetPromise([i]);
|
|
211
|
+
} catch (e) {
|
|
212
|
+
throw s.typesetClear?.([i]), e;
|
|
213
|
+
}
|
|
214
|
+
b(i);
|
|
215
|
+
}
|
|
176
216
|
};
|
|
177
217
|
}
|
|
178
218
|
//#endregion
|
|
179
|
-
export {
|
|
219
|
+
export { H as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-E8NYPSwi.js";
|
|
2
2
|
//#region ../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/disclose-version.js
|
|
3
3
|
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-next.20261002222413",
|
|
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.
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261002222413"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|