@pretextbook/pretext-html 0.14.0 → 0.16.0

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/index.d.ts CHANGED
@@ -24,6 +24,8 @@ export { PREVIEW_BANNER_STORAGE_KEY, injectPreviewBanner, previewBannerScript, }
24
24
  export type { PreviewBannerOptions } from './banner.js';
25
25
  export { PRINT_PREVIEW_GLOBAL, injectPrintPreview, listPrintouts, printPreviewBridgeScript, rootPrintoutId, } from './printout.js';
26
26
  export type { PrintoutInfo } from './printout.js';
27
+ export { LIVE_PATCH_GLOBAL, livePatchScript, patchDocument, typesetPatch, } from './live-patch.js';
28
+ export type { LivePatchResult } from './live-patch.js';
27
29
  export { main as runCli } from './cli.js';
28
30
  export { setAssetsBase } from './host.js';
29
31
  export { setMountReader } from './mounts.js';
package/dist/index.js CHANGED
@@ -1,43 +1,48 @@
1
- import { O as i, P as s, b as t, d as a, a as n, c as o, f as l, e as d, i as p, g as E, o as c, p as P, r as v, h as m, j as S, m as g, s as A, k as B, x as f } from "./cli-BkTQ4BJP.js";
2
- import { injectRevealBridge as R, isRevealView as _, revealBridgeScript as u } from "./reveal.js";
3
- import { describeAsset as x, missingAssetPlaceholder as T, missingAssetSvg as b, rewriteAssetUrls as M } from "./assets.js";
4
- import { PREVIEW_THEME_MESSAGE as G, injectThemeBridge as I, isPreviewTheme as L, previewThemeMessage as O, themeBridgeScript as V } from "./theme.js";
5
- import { PRINT_PREVIEW_GLOBAL as H, injectPrintPreview as N, listPrintouts as W, printPreviewBridgeScript as D, rootPrintoutId as F } from "./printout.js";
1
+ import { O as i, P as s, b as t, d as a, a as n, c as o, f as l, e as p, i as c, g as d, o as P, p as E, r as m, h as v, j as A, m as S, s as g, k as B, x as f } from "./cli-ox-z2TCZ.js";
2
+ import { injectRevealBridge as h, isRevealView as w, revealBridgeScript as R } from "./reveal.js";
3
+ import { describeAsset as x, missingAssetPlaceholder as L, missingAssetSvg as T, rewriteAssetUrls as b } from "./assets.js";
4
+ import { PREVIEW_THEME_MESSAGE as I, injectThemeBridge as M, isPreviewTheme as j, previewThemeMessage as O, themeBridgeScript as V } from "./theme.js";
5
+ import { PRINT_PREVIEW_GLOBAL as k, injectPrintPreview as D, listPrintouts as N, printPreviewBridgeScript as W, rootPrintoutId as y } from "./printout.js";
6
+ import { LIVE_PATCH_GLOBAL as F, livePatchScript as K, patchDocument as X, typesetPatch as J } from "./live-patch.js";
6
7
  export {
8
+ F as LIVE_PATCH_GLOBAL,
7
9
  i as OFF_PAGE_MESSAGE,
8
10
  s as PREVIEW_BANNER_STORAGE_KEY,
9
- G as PREVIEW_THEME_MESSAGE,
10
- H as PRINT_PREVIEW_GLOBAL,
11
+ I as PREVIEW_THEME_MESSAGE,
12
+ k as PRINT_PREVIEW_GLOBAL,
11
13
  t as buildSkeleton,
12
14
  a as defaultXslDir,
13
15
  x as describeAsset,
14
16
  n as detectRenderTarget,
15
17
  o as divisionLevel,
16
18
  l as findSourceMapEntry,
17
- d as forcePortablePublication,
18
- p as injectPreviewBanner,
19
- N as injectPrintPreview,
20
- R as injectRevealBridge,
21
- I as injectThemeBridge,
22
- E as isJspiAvailable,
23
- L as isPreviewTheme,
24
- _ as isRevealView,
25
- W as listPrintouts,
26
- T as missingAssetPlaceholder,
27
- b as missingAssetSvg,
28
- c as openBornHiddenKnowls,
29
- P as previewBannerScript,
19
+ p as forcePortablePublication,
20
+ c as injectPreviewBanner,
21
+ D as injectPrintPreview,
22
+ h as injectRevealBridge,
23
+ M as injectThemeBridge,
24
+ d as isJspiAvailable,
25
+ j as isPreviewTheme,
26
+ w as isRevealView,
27
+ N as listPrintouts,
28
+ K as livePatchScript,
29
+ L as missingAssetPlaceholder,
30
+ T as missingAssetSvg,
31
+ P as openBornHiddenKnowls,
32
+ X as patchDocument,
33
+ E as previewBannerScript,
30
34
  O as previewThemeMessage,
31
- D as printPreviewBridgeScript,
32
- v as renderHtml,
33
- m as replaceDivision,
34
- u as revealBridgeScript,
35
- M as rewriteAssetUrls,
36
- S as rewriteXrefLinks,
37
- F as rootPrintoutId,
38
- g as runCli,
39
- A as setAssetsBase,
35
+ W as printPreviewBridgeScript,
36
+ m as renderHtml,
37
+ v as replaceDivision,
38
+ R as revealBridgeScript,
39
+ b as rewriteAssetUrls,
40
+ A as rewriteXrefLinks,
41
+ y as rootPrintoutId,
42
+ S as runCli,
43
+ g as setAssetsBase,
40
44
  B as setMountReader,
41
45
  V as themeBridgeScript,
46
+ J as typesetPatch,
42
47
  f as xpathStringLiteral
43
48
  };
@@ -0,0 +1,100 @@
1
+ /**
2
+ * In-place updates for a live preview: bring the page already on screen up to
3
+ * date with a freshly rendered one by touching only what changed.
4
+ *
5
+ * ## Why not just replace the page
6
+ *
7
+ * A rendered page is a complete document with a dozen scripts behind it
8
+ * (MathJax, pretext-core.js, the Runestone bundles). Replacing it — whether by
9
+ * reassigning an iframe/webview's HTML or with `document.open/write/close` —
10
+ * blanks the page, re-runs every script, and has MathJax typeset the whole
11
+ * document again. The page flashes, and a scroll position restored before
12
+ * MathJax settles the layout lands somewhere else. For a preview that updates
13
+ * on every save (or every pause in typing), that is most of what the reader
14
+ * sees.
15
+ *
16
+ * ## What this does instead
17
+ *
18
+ * {@link patchDocument} compares the previous render with the new one — both
19
+ * as pristine parsed documents, never the live page, which scripts have been
20
+ * rewriting since it loaded — and applies the difference to the live page:
21
+ *
22
+ * - Identical subtrees are left alone, so their typeset math, expanded
23
+ * `<details>`, and Runestone state all survive.
24
+ * - Block containers (`section`, `article`, `div` wrappers with no text of
25
+ * their own) are recursed into, their children matched up by content.
26
+ * - Blocks whose only change is attributes — overwhelmingly the
27
+ * auto-generated ids that shift when a sibling is inserted before them —
28
+ * are updated in place rather than replaced.
29
+ * - Everything else that changed is replaced wholesale, and
30
+ * {@link typesetPatch} has MathJax typeset just those blocks.
31
+ *
32
+ * Matching live elements to the previous render tolerates what the page's own
33
+ * scripts add (MathJax output, pretext-core.js's copy-button wrapper around
34
+ * code), but not everything: anything it cannot account for, and anything that
35
+ * only works when the page loads from scratch (scripts, Runestone exercises,
36
+ * the LaTeX macro block), makes it decline with `ok: false`. The caller then
37
+ * falls back to replacing the page, which is always correct, just not smooth.
38
+ *
39
+ * ## Shipping it to a page
40
+ *
41
+ * A VS Code webview is a separate JavaScript context, so the embedder cannot
42
+ * call these functions — it has to inject them. {@link livePatchScript}
43
+ * serializes both functions' source text into an inline script. That is why
44
+ * each is written to be **self-contained**: every helper and constant lives
45
+ * inside the function body, and nothing is imported. Keep it that way; a
46
+ * reference to anything outside the function would be undefined in the page
47
+ * (the spec runs the serialized script in a bare window to catch that).
48
+ */
49
+ /** What {@link patchDocument} did, or why it declined. */
50
+ export interface LivePatchResult {
51
+ /**
52
+ * True when the live document now shows the new render. False means nothing
53
+ * was changed and the caller must replace the page itself; see `reason`.
54
+ */
55
+ ok: boolean;
56
+ /** Why the patch was declined, when `ok` is false. */
57
+ reason?: string;
58
+ /** Elements newly inserted into the live page (replacements included). */
59
+ added: Element[];
60
+ /** Live elements taken out of the page (replaced ones included). */
61
+ removed: Element[];
62
+ /** Number of elements whose attributes were updated in place. */
63
+ attributeUpdates: number;
64
+ }
65
+ /**
66
+ * Window property the injected script installs the patcher on, as
67
+ * `{ patchDocument, typeset }`.
68
+ */
69
+ export declare const LIVE_PATCH_GLOBAL = "__ptxLivePatch";
70
+ /**
71
+ * Update `live` — a page that was rendered from `oldDoc` and has been running
72
+ * since — so that it shows `newDoc`, changing only what differs.
73
+ *
74
+ * `oldDoc` and `newDoc` must be pristine parses of the two renders' HTML (for
75
+ * instance from `DOMParser`); neither is modified. Nothing in `live` is touched
76
+ * unless the whole update can be applied, so on `ok: false` the page is
77
+ * exactly as it was.
78
+ */
79
+ export declare function patchDocument(live: Document, oldDoc: Document, newDoc: Document): LivePatchResult;
80
+ /**
81
+ * Have the page's MathJax typeset what {@link patchDocument} inserted, and
82
+ * forget what it removed. Resolves once typesetting is done; a no-op when the
83
+ * page has no MathJax (yet — one still starting up typesets the whole page,
84
+ * inserted blocks included, when it gets there).
85
+ *
86
+ * Only `.process-math` elements are typeset, exactly as the page's own
87
+ * startup does: PreTeXt pages are `body.ignore-math`, and typesetting a whole
88
+ * block would also pick up text outside the math spans.
89
+ *
90
+ * Self-contained for the same reason as patchDocument; see the module docs.
91
+ */
92
+ export declare function typesetPatch(win: Window, result: Pick<LivePatchResult, "added" | "removed">): Promise<void>;
93
+ /**
94
+ * The inline `<script>` (as a string) that installs {@link patchDocument} and
95
+ * {@link typesetPatch} on `window[LIVE_PATCH_GLOBAL]` as
96
+ * `{ patchDocument, typeset }`, for embedders whose page runs in a context
97
+ * they cannot call into directly (a VS Code webview). Safe to run again on
98
+ * every in-place rewrite of the page: it just reassigns the property.
99
+ */
100
+ export declare function livePatchScript(): string;
@@ -0,0 +1,346 @@
1
+ const Z = "__ptxLivePatch";
2
+ function K(d, g, f) {
3
+ const N = "script, #latex-macros, [data-component], .ptx-runestone-container", L = /* @__PURE__ */ new Set([
4
+ "BODY",
5
+ "MAIN",
6
+ "DIV",
7
+ "SECTION",
8
+ "ARTICLE",
9
+ "ASIDE",
10
+ "NAV",
11
+ "HEADER",
12
+ "FOOTER",
13
+ "DETAILS",
14
+ "FIGURE",
15
+ "UL",
16
+ "OL",
17
+ "LI",
18
+ "DL",
19
+ "BLOCKQUOTE",
20
+ "TABLE",
21
+ "THEAD",
22
+ "TBODY",
23
+ "TFOOT",
24
+ "TR"
25
+ ]), C = /* @__PURE__ */ new Set([
26
+ "A",
27
+ "ABBR",
28
+ "B",
29
+ "BDI",
30
+ "BDO",
31
+ "BR",
32
+ "BUTTON",
33
+ "CITE",
34
+ "CODE",
35
+ "DATA",
36
+ "DEL",
37
+ "DFN",
38
+ "EM",
39
+ "I",
40
+ "IMG",
41
+ "INPUT",
42
+ "INS",
43
+ "KBD",
44
+ "LABEL",
45
+ "MARK",
46
+ "Q",
47
+ "S",
48
+ "SAMP",
49
+ "SELECT",
50
+ "SMALL",
51
+ "SPAN",
52
+ "STRONG",
53
+ "SUB",
54
+ "SUP",
55
+ "SVG",
56
+ "TEXTAREA",
57
+ "TIME",
58
+ "U",
59
+ "VAR",
60
+ "WBR"
61
+ ]), O = ["clipboardable"], T = 25e4, G = 3, y = [], P = /* @__PURE__ */ new Map();
62
+ function b(e) {
63
+ return { bail: e };
64
+ }
65
+ function H(e) {
66
+ return typeof e == "object" && e !== null && typeof e.bail == "string";
67
+ }
68
+ function v(e) {
69
+ return e.matches(N) || e.querySelector(N) !== null;
70
+ }
71
+ function M(e) {
72
+ return e.tagName === "SCRIPT" && !e.hasAttribute("src") && (e.textContent ?? "").indexOf("ptx_lunr_docs") !== -1;
73
+ }
74
+ function w(e) {
75
+ if (!L.has(e.tagName) || e.matches(".process-math") || // Never looked inside: a change anywhere in one is a change to it.
76
+ e.matches(N))
77
+ return !1;
78
+ for (const t of Array.from(e.childNodes))
79
+ if (t.nodeType === G && /\S/.test(t.nodeValue ?? ""))
80
+ return !1;
81
+ if (e.tagName === "DIV" || e.tagName === "LI") {
82
+ for (const t of Array.from(e.children))
83
+ if (C.has(t.tagName.toUpperCase()))
84
+ return !1;
85
+ }
86
+ return !0;
87
+ }
88
+ function F(e) {
89
+ return O.indexOf(e) !== -1;
90
+ }
91
+ function _(e, t) {
92
+ if (e.tagName !== t.tagName)
93
+ return !1;
94
+ const r = t.getAttribute("id");
95
+ if (r !== null && e.getAttribute("id") !== r)
96
+ return !1;
97
+ for (const n of Array.from(t.classList))
98
+ if (!F(n))
99
+ return e.classList.contains(n);
100
+ return !0;
101
+ }
102
+ function D(e, t) {
103
+ const r = Array.from(e.children), n = [];
104
+ let a = 0;
105
+ for (const s of t) {
106
+ let o = null;
107
+ for (; !o && a < r.length; ) {
108
+ const i = r[a++];
109
+ _(i, s) ? o = { inner: i, outer: i } : i.tagName === "DIV" && O.some((m) => i.classList.contains(m)) && i.firstElementChild && _(i.firstElementChild, s) && (o = { inner: i.firstElementChild, outer: i });
110
+ }
111
+ if (!o)
112
+ return null;
113
+ n.push(o);
114
+ }
115
+ return n;
116
+ }
117
+ function R(e, t) {
118
+ if (e.attributes.length !== t.attributes.length)
119
+ return !1;
120
+ for (const r of Array.from(e.attributes))
121
+ if (t.getAttributeNS(r.namespaceURI, r.localName) !== r.value)
122
+ return !1;
123
+ return !0;
124
+ }
125
+ function q(e) {
126
+ return e.outerHTML.replace(/<([A-Za-z][^\s/>]*)\s[^>]*>/g, "<$1>");
127
+ }
128
+ function W(e) {
129
+ let t = P.get(e);
130
+ return t === void 0 && (t = e.outerHTML.replace(/<span class="codenumber">[^<]*<\/span>/g, "").replace(/<([A-Za-z][^\s/>]*)\s[^>]*>/g, "<$1>"), P.set(e, t)), t;
131
+ }
132
+ function j(e, t, r, n, a) {
133
+ const s = /* @__PURE__ */ new Map(), o = (A) => {
134
+ const p = W(A);
135
+ let U = s.get(p);
136
+ return U === void 0 && (U = s.size, s.set(p, U)), U;
137
+ }, i = e.slice(r, n).map(o), m = t.slice(r, a).map(o), h = i.length, u = m.length, c = u + 1, l = new Uint32Array((h + 1) * c);
138
+ for (let A = h - 1; A >= 0; A--)
139
+ for (let p = u - 1; p >= 0; p--)
140
+ l[A * c + p] = i[A] === m[p] ? l[(A + 1) * c + p + 1] + 1 : Math.max(l[(A + 1) * c + p], l[A * c + p + 1]);
141
+ const E = [];
142
+ let S = 0, I = 0;
143
+ for (; S < h && I < u; )
144
+ i[S] === m[I] ? (E.push([r + S, r + I]), S++, I++) : l[(S + 1) * c + I] >= l[S * c + I + 1] ? S++ : I++;
145
+ return E;
146
+ }
147
+ function z(e, t) {
148
+ const r = t.map(() => -1);
149
+ let n = 0;
150
+ for (; n < e.length && n < t.length && e[n].isEqualNode(t[n]); )
151
+ r[n] = n, n++;
152
+ let a = e.length, s = t.length;
153
+ for (; a > n && s > n && e[a - 1].isEqualNode(t[s - 1]); )
154
+ a--, s--, r[s] = a;
155
+ const o = a - n, i = s - n;
156
+ if (o === 0 || i === 0)
157
+ return r;
158
+ const m = (o > 1 || i > 1) && o * i <= T ? j(e, t, n, a, s) : [];
159
+ m.push([a, s]);
160
+ let h = n, u = n;
161
+ for (const [c, l] of m) {
162
+ for (; h < c && u < l; ) {
163
+ if (e[h].tagName === t[u].tagName) {
164
+ r[u++] = h++;
165
+ continue;
166
+ }
167
+ let E = h + 1;
168
+ for (; E < c && e[E].tagName !== t[u].tagName; )
169
+ E++;
170
+ E < c ? h = E : u++;
171
+ }
172
+ c < a && (r[l] = c), h = c + 1, u = l + 1;
173
+ }
174
+ return r;
175
+ }
176
+ function J(e, t) {
177
+ if (v(e) || v(t))
178
+ throw b(`<${t.tagName.toLowerCase()}> needs a full page load`);
179
+ return { next: t, replace: !0 };
180
+ }
181
+ function V(e, t, r) {
182
+ R(t, r) || y.push({ live: e, old: t, next: r });
183
+ const n = Array.from(t.children), a = Array.from(r.children);
184
+ if (n.length !== a.length)
185
+ return !1;
186
+ let s = null;
187
+ for (let o = 0; o < n.length; o++)
188
+ if (!n[o].isEqualNode(a[o]) && (s = s ?? D(e, n), !s || !V(s[o].inner, n[o], a[o])))
189
+ return !1;
190
+ return !0;
191
+ }
192
+ function Q(e, t, r) {
193
+ if (t.isEqualNode(r) || M(t) && M(r))
194
+ return { next: r, outer: e.outer };
195
+ if (t.tagName === r.tagName && w(t) && w(r)) {
196
+ const n = $(e.inner, t, r);
197
+ if (n)
198
+ return R(t, r) || y.push({ live: e.inner, old: t, next: r }), { next: r, outer: e.outer, sub: n };
199
+ } else if (q(t) === q(r)) {
200
+ const n = y.length;
201
+ if (V(e.inner, t, r)) {
202
+ if (v(t))
203
+ throw b(
204
+ "attributes changed inside an element that needs a full page load"
205
+ );
206
+ return { next: r, outer: e.outer };
207
+ }
208
+ y.length = n;
209
+ }
210
+ return { ...J(t, r), outer: e.outer };
211
+ }
212
+ function $(e, t, r) {
213
+ const n = Array.from(t.children), a = Array.from(r.children), s = D(e, n);
214
+ if (!s)
215
+ return null;
216
+ const o = z(n, a), i = n.map(() => !1), m = [];
217
+ a.forEach((u, c) => {
218
+ const l = o[c];
219
+ if (l === -1) {
220
+ if (v(u))
221
+ throw b(
222
+ `new <${u.tagName.toLowerCase()}> needs a full page load`
223
+ );
224
+ m.push({ next: u });
225
+ return;
226
+ }
227
+ i[l] = !0, m.push(Q(s[l], n[l], u));
228
+ });
229
+ const h = [];
230
+ return n.forEach((u, c) => {
231
+ if (!i[c]) {
232
+ if (v(u))
233
+ throw b(
234
+ `removing <${u.tagName.toLowerCase()}> needs a full page load`
235
+ );
236
+ h.push(s[c].outer);
237
+ }
238
+ }), {
239
+ live: e,
240
+ first: s.length ? s[0].outer : null,
241
+ items: m,
242
+ removed: h
243
+ };
244
+ }
245
+ function X() {
246
+ const e = Array.from(g.head.children), t = Array.from(f.head.children);
247
+ if (e.length !== t.length)
248
+ throw b("the page head changed");
249
+ let r = null;
250
+ for (let n = 0; n < e.length; n++) {
251
+ const a = e[n], s = t[n];
252
+ if (!a.isEqualNode(s)) {
253
+ if (a.tagName === "TITLE" && s.tagName === "TITLE")
254
+ r = s.textContent ?? "";
255
+ else if (a.tagName !== "META" || s.tagName !== "META")
256
+ throw b("the page head changed");
257
+ }
258
+ }
259
+ return r;
260
+ }
261
+ function Y(e) {
262
+ const { live: t, old: r, next: n } = e;
263
+ for (const o of Array.from(r.attributes))
264
+ o.name !== "class" && !n.hasAttributeNS(o.namespaceURI, o.localName) && t.removeAttributeNS(o.namespaceURI, o.localName);
265
+ for (const o of Array.from(n.attributes))
266
+ o.name !== "class" && r.getAttributeNS(o.namespaceURI, o.localName) !== o.value && t.setAttributeNS(o.namespaceURI, o.name, o.value);
267
+ const a = Array.from(r.classList), s = Array.from(n.classList);
268
+ for (const o of a)
269
+ s.indexOf(o) === -1 && t.classList.remove(o);
270
+ for (const o of s)
271
+ a.indexOf(o) === -1 && t.classList.add(o);
272
+ }
273
+ const k = [], B = [];
274
+ function x(e) {
275
+ let t = null;
276
+ for (const r of e.items) {
277
+ if (!r.outer || r.replace) {
278
+ const n = d.importNode(r.next, !0);
279
+ r.outer ? (r.outer.replaceWith(n), B.push(r.outer)) : t ? t.after(n) : e.first ? e.first.before(n) : e.live.appendChild(n), k.push(n), t = n;
280
+ continue;
281
+ }
282
+ r.sub && x(r.sub), t = r.outer;
283
+ }
284
+ for (const r of e.removed)
285
+ r.remove(), B.push(r);
286
+ }
287
+ try {
288
+ const e = X(), t = {
289
+ live: d.documentElement,
290
+ old: g.documentElement,
291
+ next: f.documentElement
292
+ };
293
+ if (R(t.old, t.next) || y.push(t), !d.body || !w(g.body) || !w(f.body))
294
+ throw b("the page body is not patchable");
295
+ const r = $(d.body, g.body, f.body);
296
+ if (!r)
297
+ throw b("the live page no longer matches the previous render");
298
+ return R(g.body, f.body) || y.push({ live: d.body, old: g.body, next: f.body }), y.forEach(Y), x(r), e !== null && d.title !== e && (d.title = e), { ok: !0, added: k, removed: B, attributeUpdates: y.length };
299
+ } catch (e) {
300
+ if (H(e))
301
+ return {
302
+ ok: !1,
303
+ reason: e.bail,
304
+ added: [],
305
+ removed: [],
306
+ attributeUpdates: 0
307
+ };
308
+ throw e;
309
+ }
310
+ }
311
+ function ee(d, g) {
312
+ const f = d.MathJax, N = f && f.startup;
313
+ if (!f || !N || !N.promise || typeof f.typesetPromise != "function")
314
+ return Promise.resolve();
315
+ const L = [];
316
+ for (const T of g.added)
317
+ T.matches(".process-math") ? L.push(T) : L.push(...Array.from(T.querySelectorAll(".process-math")));
318
+ const C = g.removed;
319
+ if (L.length === 0 && C.length === 0)
320
+ return Promise.resolve();
321
+ const O = N.promise.then(() => (C.length && typeof f.typesetClear == "function" && f.typesetClear(C), L.length && f.typesetPromise ? f.typesetPromise(L) : void 0)).then(
322
+ () => {
323
+ },
324
+ (T) => {
325
+ console.error("pretext-html: typesetting a live patch failed", T);
326
+ }
327
+ );
328
+ return N.promise = O, O;
329
+ }
330
+ function te() {
331
+ return [
332
+ "<script>",
333
+ `window[${JSON.stringify(Z)}] = {`,
334
+ ` patchDocument: ${K.toString()},`,
335
+ ` typeset: ${ee.toString()}`,
336
+ "};",
337
+ "<\/script>"
338
+ ].join(`
339
+ `);
340
+ }
341
+ export {
342
+ Z as LIVE_PATCH_GLOBAL,
343
+ te as livePatchScript,
344
+ K as patchDocument,
345
+ ee as typesetPatch
346
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretextbook/pretext-html",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Convert PreTeXt documents to HTML in pure JavaScript using the official PreTeXt XSLT stylesheets via libxslt-wasm. No Python or PreTeXt installation required.",
5
5
  "author": "Oscar Levin",
6
6
  "license": "MIT",
@@ -29,6 +29,9 @@
29
29
  ],
30
30
  "printout": [
31
31
  "./dist/printout.d.ts"
32
+ ],
33
+ "live-patch": [
34
+ "./dist/live-patch.d.ts"
32
35
  ]
33
36
  }
34
37
  },
@@ -65,6 +68,11 @@
65
68
  "import": "./dist/printout.js",
66
69
  "default": "./dist/printout.js"
67
70
  },
71
+ "./live-patch": {
72
+ "types": "./dist/live-patch.d.ts",
73
+ "import": "./dist/live-patch.js",
74
+ "default": "./dist/live-patch.js"
75
+ },
68
76
  "./cli": "./dist/cli.js"
69
77
  },
70
78
  "sideEffects": false,