@pie-element/shared-math-rendering-mathjax 0.1.1-next.3 → 0.1.1-next.4

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/adapter.d.ts CHANGED
@@ -2,8 +2,9 @@ import type { MathjaxOptions } from './types.js';
2
2
  /**
3
3
  * Create a MathJax renderer function.
4
4
  *
5
- * MathJax loads once per page, the first time an element holds math, from `srcUrl` or MathJax
6
- * 4.1.3 on jsDelivr. A MathJax the page already has, or is loading, is used instead.
5
+ * MathJax loads once per page, on the first render, from `srcUrl` or MathJax 4.1.3 on jsDelivr.
6
+ * A MathJax the page already has, or is loading, is used instead. A render waits on the load only
7
+ * when its element holds math.
7
8
  *
8
9
  * @param options - Renderer options
9
10
  * @returns Renderer function that typesets math in an element
package/dist/index.js CHANGED
@@ -86,10 +86,16 @@ function h(e) {
86
86
  function g(e = {}) {
87
87
  let t = e.useSingleDollar ?? !1;
88
88
  return async (n) => {
89
- if (typeof window > "u" || (l(n), !u(n, t))) return;
90
- await h(e);
91
- let r = s();
92
- await r?.startup?.promise, typeof r?.typesetPromise == "function" && await r.typesetPromise([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]);
93
99
  };
94
100
  }
95
101
  function _() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/shared-math-rendering-mathjax",
3
- "version": "0.1.1-next.3",
3
+ "version": "0.1.1-next.4",
4
4
  "description": "MathJax adapter for PIE math rendering",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",