@pie-element/element-player 0.1.2-next.14 → 0.1.2-next.15

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.
@@ -41,22 +41,29 @@ function _() {
41
41
  return window.MathJax;
42
42
  }
43
43
  function v(e) {
44
- let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
45
- for (let [e, n] of u) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
46
- return t;
44
+ for (let [t, n] of u) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
45
+ return e;
47
46
  }
48
47
  function y(e) {
48
+ return v(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
49
+ }
50
+ var b = "mathjax_ignore", x = "mathjax_process";
51
+ function S(e, t) {
52
+ let n = e.closest(`.${b}, .${x}`);
53
+ return n !== null && t.contains(n) && !n.classList.contains(x);
54
+ }
55
+ function C(e) {
49
56
  for (let t of e.querySelectorAll("[data-latex]")) {
50
- if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
51
- let e = t.textContent;
52
- e && (t.textContent = `\\(${v(e)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
57
+ if (t.dataset.mathHandled || t.closest("mjx-container") || S(t, e)) continue;
58
+ let n = t.textContent;
59
+ n && (t.textContent = `\\(${y(n)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
53
60
  }
54
61
  }
55
- function b(e, t) {
62
+ function w(e, t) {
56
63
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
57
64
  return (t ? c : s).test(e.textContent ?? "");
58
65
  }
59
- function x(e) {
66
+ function T(e) {
60
67
  return new Promise((t, n) => {
61
68
  let { useSingleDollar: r = !1, accessibility: s = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
62
69
  loader: {
@@ -67,7 +74,7 @@ function x(e) {
67
74
  typeset: !1,
68
75
  ready: () => {
69
76
  let e = _(), r = e?.startup, i = !!e?.version?.startsWith("4.");
70
- i && S(e), r?.defaultReady?.(), i && C(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
77
+ i && E(e), r?.defaultReady?.(), i && D(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
71
78
  }
72
79
  },
73
80
  tex: { macros: { ...a } },
@@ -85,11 +92,11 @@ function x(e) {
85
92
  d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
86
93
  });
87
94
  }
88
- function S(e) {
95
+ function E(e) {
89
96
  let t = e?._?.output?.chtml_ts?.CHTML;
90
97
  t && (t.STYLESHEETID = f);
91
98
  }
92
- function C(e) {
99
+ function D(e) {
93
100
  if (!e) return;
94
101
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
95
102
  let n = e.typesetRoot;
@@ -103,32 +110,32 @@ function C(e) {
103
110
  return t && g(t), !1;
104
111
  });
105
112
  let r = e.outputJax?.chtmlStyles;
106
- r?.id === p && (r.id = f), E();
113
+ r?.id === p && (r.id = f), A();
107
114
  }
108
- function w(e) {
115
+ function O(e) {
109
116
  return e instanceof HTMLStyleElement && m.includes(e.id);
110
117
  }
111
- function T(e) {
118
+ function k(e) {
112
119
  n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
113
120
  }
114
- function E() {
115
- let e = document.head, t = [...e.children].find(w);
121
+ function A() {
122
+ let e = document.head, t = [...e.children].find(O);
116
123
  if (t) {
117
- T(t);
124
+ k(t);
118
125
  return;
119
126
  }
120
127
  let n = new MutationObserver((e) => {
121
128
  for (let t of e) {
122
- let e = [...t.addedNodes].find(w);
129
+ let e = [...t.addedNodes].find(O);
123
130
  if (e) {
124
- T(e), n.disconnect();
131
+ k(e), n.disconnect();
125
132
  return;
126
133
  }
127
134
  }
128
135
  });
129
136
  n.observe(e, { childList: !0 });
130
137
  }
131
- function D(e) {
138
+ function j(e) {
132
139
  return new Promise((t, n) => {
133
140
  let r = e.startup ?? {};
134
141
  e.startup = r;
@@ -139,27 +146,27 @@ function D(e) {
139
146
  };
140
147
  });
141
148
  }
142
- function O(e) {
149
+ function M(e) {
143
150
  let t = _();
144
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : D(t) : x(e);
151
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : j(t) : T(e);
145
152
  }
146
- function k(e) {
147
- return O(e).then(() => {
153
+ function N(e) {
154
+ return M(e).then(() => {
148
155
  typeof _()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
149
156
  });
150
157
  }
151
- function A(e) {
158
+ function P(e) {
152
159
  let t = globalThis, n = t[d];
153
- return n || (n = k(e), t[d] = n), n;
160
+ return n || (n = N(e), t[d] = n), n;
154
161
  }
155
- function j(e = {}) {
162
+ function F(e = {}) {
156
163
  let t = e.useSingleDollar ?? !1;
157
164
  return async (i) => {
158
165
  if (typeof window > "u") return;
159
166
  let a = r();
160
- a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), y(i);
161
- let o = A(e);
162
- if (!b(i, t)) {
167
+ a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), C(i);
168
+ let o = P(e);
169
+ if (!w(i, t)) {
163
170
  o.catch(() => {});
164
171
  return;
165
172
  }
@@ -169,4 +176,4 @@ function j(e = {}) {
169
176
  };
170
177
  }
171
178
  //#endregion
172
- export { j as t };
179
+ export { F as t };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./math-mathjax-iaHklMFp.js";
1
+ import { t as e } from "./math-mathjax-Y_CMClAV.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.2-next.14",
3
+ "version": "0.1.2-next.15",
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-next.7"
29
+ "@pie-element/shared-math-rendering-mathjax": "0.1.1-next.8"
30
30
  },
31
31
  "license": "MIT",
32
32
  "publishConfig": {