@pie-element/element-player 0.1.2 → 0.1.3-next.20261002215153
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,38 +32,38 @@ 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 = [p, "MJX-SVG-styles"], h = 201;
|
|
36
|
-
function
|
|
35
|
+
], d = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), f = "PIE-MJX-CHTML-styles", p = "MJX-CHTML-styles", m = [p, "MJX-SVG-styles"], h = 200, g = 201;
|
|
36
|
+
function _(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 v() {
|
|
41
41
|
return window.MathJax;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function y(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 b(e) {
|
|
48
|
+
return y(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 x = "mathjax_ignore", S = "mathjax_process";
|
|
51
|
+
function C(e, t) {
|
|
52
|
+
let n = e.closest(`.${x}, .${S}`);
|
|
53
|
+
return n !== null && t.contains(n) && !n.classList.contains(S);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function w(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") || C(t, e)) continue;
|
|
58
58
|
let n = t.textContent;
|
|
59
|
-
n && (t.textContent = `\\(${
|
|
59
|
+
n && (t.textContent = `\\(${b(n)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function T(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 E(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: {
|
|
@@ -73,8 +73,8 @@ function T(e) {
|
|
|
73
73
|
startup: {
|
|
74
74
|
typeset: !1,
|
|
75
75
|
ready: () => {
|
|
76
|
-
let e =
|
|
77
|
-
i &&
|
|
76
|
+
let e = v(), r = e?.startup, i = !!e?.version?.startsWith("4.");
|
|
77
|
+
i && D(e), r?.defaultReady?.(), i && O(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
tex: { macros: { ...a } },
|
|
@@ -92,88 +92,105 @@ function T(e) {
|
|
|
92
92
|
d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function D(e) {
|
|
96
96
|
let t = e?._?.output?.chtml_ts?.CHTML;
|
|
97
97
|
t && (t.STYLESHEETID = f);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function O(e) {
|
|
100
100
|
if (!e) return;
|
|
101
101
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
102
102
|
let n = e.typesetRoot;
|
|
103
|
-
!n || t.has(n) || (
|
|
103
|
+
!n || t.has(n) || (_(n), t.add(n));
|
|
104
104
|
};
|
|
105
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
105
|
+
e.addRenderAction?.("pie-strip-latex", g, (e) => {
|
|
106
106
|
for (let t of e.math ?? []) n(t);
|
|
107
107
|
return !1;
|
|
108
108
|
}, (e) => {
|
|
109
109
|
let t = e.typesetRoot;
|
|
110
|
-
return t &&
|
|
110
|
+
return t && _(t), !1;
|
|
111
111
|
});
|
|
112
112
|
let r = e.outputJax?.chtmlStyles;
|
|
113
|
-
r?.id === p && (r.id = f),
|
|
113
|
+
r?.id === p && (r.id = f), j();
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function k(e) {
|
|
116
116
|
return e instanceof HTMLStyleElement && m.includes(e.id);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function A(e) {
|
|
119
119
|
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
let e = document.head, t = [...e.children].find(
|
|
121
|
+
function j() {
|
|
122
|
+
let e = document.head, t = [...e.children].find(k);
|
|
123
123
|
if (t) {
|
|
124
|
-
|
|
124
|
+
A(t);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
let n = new MutationObserver((e) => {
|
|
128
128
|
for (let t of e) {
|
|
129
|
-
let e = [...t.addedNodes].find(
|
|
129
|
+
let e = [...t.addedNodes].find(k);
|
|
130
130
|
if (e) {
|
|
131
|
-
|
|
131
|
+
A(e), n.disconnect();
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
n.observe(e, { childList: !0 });
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function M(e) {
|
|
139
|
+
let t = e?.math;
|
|
140
|
+
if (!t?.remove) return;
|
|
141
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= h && e.typesetRoot?.isConnected === !1);
|
|
142
|
+
if (n.length !== 0) {
|
|
143
|
+
for (let e of [...n].reverse()) e.clear?.();
|
|
144
|
+
t.remove(...n);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function N(e) {
|
|
139
148
|
return new Promise((t, n) => {
|
|
140
149
|
let r = e.startup ?? {};
|
|
141
150
|
e.startup = r;
|
|
142
151
|
let i = r.ready;
|
|
143
152
|
r.ready = () => {
|
|
144
|
-
let e =
|
|
153
|
+
let e = v()?.startup;
|
|
145
154
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
146
155
|
};
|
|
147
156
|
});
|
|
148
157
|
}
|
|
149
|
-
function
|
|
150
|
-
let t =
|
|
151
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
158
|
+
function P(e) {
|
|
159
|
+
let t = v();
|
|
160
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : N(t) : E(e);
|
|
152
161
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
155
|
-
typeof
|
|
162
|
+
function F(e) {
|
|
163
|
+
return P(e).then(() => {
|
|
164
|
+
typeof v()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
156
165
|
});
|
|
157
166
|
}
|
|
158
|
-
function
|
|
167
|
+
function I(e) {
|
|
159
168
|
let t = globalThis, n = t[d];
|
|
160
|
-
return n || (n =
|
|
169
|
+
return n || (n = F(e), t[d] = n), n;
|
|
161
170
|
}
|
|
162
|
-
function
|
|
171
|
+
function L(e = {}) {
|
|
163
172
|
let t = e.useSingleDollar ?? !1;
|
|
164
173
|
return async (i) => {
|
|
165
174
|
if (typeof window > "u") return;
|
|
166
175
|
let a = r();
|
|
167
|
-
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`),
|
|
168
|
-
let o =
|
|
169
|
-
if (!
|
|
176
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), w(i);
|
|
177
|
+
let o = I(e);
|
|
178
|
+
if (!T(i, t)) {
|
|
170
179
|
o.catch(() => {});
|
|
171
180
|
return;
|
|
172
181
|
}
|
|
173
182
|
await o;
|
|
174
|
-
let s =
|
|
175
|
-
await s?.startup?.promise, typeof s?.typesetPromise == "function"
|
|
183
|
+
let s = v();
|
|
184
|
+
if (await s?.startup?.promise, typeof s?.typesetPromise == "function") {
|
|
185
|
+
M(s.startup?.document);
|
|
186
|
+
try {
|
|
187
|
+
await s.typesetPromise([i]);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
throw s.typesetClear?.([i]), e;
|
|
190
|
+
}
|
|
191
|
+
_(i);
|
|
192
|
+
}
|
|
176
193
|
};
|
|
177
194
|
}
|
|
178
195
|
//#endregion
|
|
179
|
-
export {
|
|
196
|
+
export { L as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-BfidiJW6.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.20261002215153",
|
|
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.20261002215153"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|