@tdacorp/hyle-sdk 0.17.0 → 0.22.2
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/README.md +261 -42
- package/dist/check-routes-bin.js +190 -53
- package/dist/{chunk-6VOHFFA5.js → chunk-7T5EEJHK.js} +2 -2
- package/dist/chunk-DUPT6XLB.js +57 -0
- package/dist/chunk-IW3TUD4G.js +841 -0
- package/dist/{chunk-MGSUQBDW.js → chunk-KU7LWK4E.js} +249 -24
- package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
- package/dist/chunk-SFFBZFEN.js +178 -0
- package/dist/chunk-U74B7AUG.js +398 -0
- package/dist/chunk-ZIW6FDU2.js +1126 -0
- package/dist/client-BGjmEWhN.d.cts +207 -0
- package/dist/client-D0LTpr3Y.d.ts +207 -0
- package/dist/code-copy.cjs +74 -0
- package/dist/code-copy.d.cts +18 -0
- package/dist/code-copy.d.ts +18 -0
- package/dist/code-copy.js +50 -0
- package/dist/comments.cjs +738 -280
- package/dist/comments.d.cts +66 -3
- package/dist/comments.d.ts +66 -3
- package/dist/comments.js +419 -331
- package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
- package/dist/docs-enhance.cjs +7 -4
- package/dist/docs-enhance.d.cts +5 -3
- package/dist/docs-enhance.d.ts +5 -3
- package/dist/docs-enhance.js +8 -5
- package/dist/{embed-DNTZ2UXv.d.ts → embed-CbtsbZs3.d.cts} +5 -3
- package/dist/{embed-BmdwA2G9.d.cts → embed-Cf_2ZR5x.d.ts} +5 -3
- package/dist/fragment-alias.cjs +51 -0
- package/dist/fragment-alias.d.cts +7 -0
- package/dist/fragment-alias.d.ts +7 -0
- package/dist/fragment-alias.js +27 -0
- package/dist/html.cjs +886 -0
- package/dist/html.d.cts +20 -0
- package/dist/html.d.ts +20 -0
- package/dist/html.js +45 -0
- package/dist/index.cjs +244 -24
- package/dist/index.d.cts +22 -68
- package/dist/index.d.ts +22 -68
- package/dist/index.js +12 -2
- package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.cts} +9 -0
- package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.ts} +9 -0
- package/dist/mermaid-diagram.cjs +441 -125
- package/dist/mermaid-diagram.d.cts +23 -7
- package/dist/mermaid-diagram.d.ts +23 -7
- package/dist/mermaid-diagram.js +213 -51
- package/dist/mermaid-image.cjs +137 -60
- package/dist/mermaid-image.d.cts +4 -3
- package/dist/mermaid-image.d.ts +4 -3
- package/dist/mermaid-image.js +27 -28
- package/dist/next.cjs +836 -304
- package/dist/next.d.cts +45 -20
- package/dist/next.d.ts +45 -20
- package/dist/next.js +151 -40
- package/dist/print-coordinator.cjs +157 -0
- package/dist/print-coordinator.d.cts +27 -0
- package/dist/print-coordinator.d.ts +27 -0
- package/dist/print-coordinator.js +83 -0
- package/dist/react.cjs +603 -240
- package/dist/react.d.cts +148 -30
- package/dist/react.d.ts +148 -30
- package/dist/react.js +26 -4
- package/dist/reactions.cjs +653 -0
- package/dist/reactions.d.cts +27 -0
- package/dist/reactions.d.ts +27 -0
- package/dist/reactions.js +364 -0
- package/dist/{resolve-euZ4-aC9.d.cts → resolve-BnIv7aB7.d.cts} +2 -2
- package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BysHtZ_i.d.ts} +2 -2
- package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
- package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
- package/dist/sanitize-BpY_AdZh.d.cts +23 -0
- package/dist/sanitize-BpY_AdZh.d.ts +23 -0
- package/dist/styles.css +100 -29
- package/dist/toc-spy.cjs +60 -0
- package/dist/toc-spy.d.cts +15 -0
- package/dist/toc-spy.d.ts +15 -0
- package/dist/toc-spy.js +36 -0
- package/dist/{types-Czt887Iv.d.cts → types-D09Z072G.d.cts} +57 -2
- package/dist/{types-Czt887Iv.d.ts → types-D09Z072G.d.ts} +57 -2
- package/dist/use-cache.cjs +89 -13
- package/dist/use-cache.d.cts +12 -5
- package/dist/use-cache.d.ts +12 -5
- package/dist/use-cache.js +8 -8
- package/dist/youtube-facade.cjs +50 -0
- package/dist/youtube-facade.d.cts +17 -0
- package/dist/youtube-facade.d.ts +17 -0
- package/dist/youtube-facade.js +26 -0
- package/package.json +16 -3
- package/dist/chunk-67IOIAVW.js +0 -35
- package/dist/chunk-DMK4XQLU.js +0 -1556
- package/dist/chunk-PJMJMP66.js +0 -63
- package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
- package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RENDER_TIMEOUT_MS,
|
|
3
|
+
withTimeout
|
|
4
|
+
} from "./chunk-SFFBZFEN.js";
|
|
5
|
+
import {
|
|
6
|
+
VIEWER_LABELS_EN
|
|
7
|
+
} from "./chunk-QVYQM5R2.js";
|
|
8
|
+
|
|
9
|
+
// src/react/print-coordinator.ts
|
|
10
|
+
var targets = /* @__PURE__ */ new Set();
|
|
11
|
+
var loading = /* @__PURE__ */ new Set();
|
|
12
|
+
function holdPrintUntil(loaded) {
|
|
13
|
+
loading.add(loaded);
|
|
14
|
+
const release = () => void loading.delete(loaded);
|
|
15
|
+
void loaded.then(release, release);
|
|
16
|
+
}
|
|
17
|
+
function registerPrintTarget(target) {
|
|
18
|
+
targets.add(target);
|
|
19
|
+
return () => void targets.delete(target);
|
|
20
|
+
}
|
|
21
|
+
function isPrintChord(e) {
|
|
22
|
+
const platform = navigator.userAgentData?.platform || navigator.platform;
|
|
23
|
+
const modifier = /mac/i.test(platform) ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey;
|
|
24
|
+
const nonLatinLetter = /^\p{L}$/u.test(e.key) && !/\p{Script=Latin}/u.test(e.key);
|
|
25
|
+
const isP = e.key.toLowerCase() === "p" || nonLatinLetter && e.code === "KeyP";
|
|
26
|
+
return modifier && !e.altKey && !e.shiftKey && isP;
|
|
27
|
+
}
|
|
28
|
+
function showStatus() {
|
|
29
|
+
const note = document.createElement("div");
|
|
30
|
+
note.className = "hyle-print-status";
|
|
31
|
+
note.setAttribute("role", "status");
|
|
32
|
+
note.textContent = [...targets].find((t) => t.status)?.status ?? VIEWER_LABELS_EN.printPreparing;
|
|
33
|
+
const dialogs = document.querySelectorAll("dialog[open]");
|
|
34
|
+
(dialogs[dialogs.length - 1] ?? document.body).append(note);
|
|
35
|
+
return () => note.remove();
|
|
36
|
+
}
|
|
37
|
+
var cancel = null;
|
|
38
|
+
var installs = 0;
|
|
39
|
+
async function printWhenDrawn() {
|
|
40
|
+
let cancelled = false;
|
|
41
|
+
const escaped = new Promise((resolve) => {
|
|
42
|
+
cancel = () => {
|
|
43
|
+
cancelled = true;
|
|
44
|
+
resolve();
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const hideStatus = showStatus();
|
|
48
|
+
const drawn = withTimeout(Promise.all(loading).then(() => Promise.all([...targets].map((t) => t.prepare?.()))), RENDER_TIMEOUT_MS).catch((error) => {
|
|
49
|
+
loading.clear();
|
|
50
|
+
throw error;
|
|
51
|
+
}).then(() => withTimeout(Promise.all([...targets].map((t) => t.ensureDrawn())), RENDER_TIMEOUT_MS)).catch(() => void 0);
|
|
52
|
+
await Promise.race([drawn, escaped]);
|
|
53
|
+
cancel = null;
|
|
54
|
+
hideStatus();
|
|
55
|
+
if (!cancelled) window.print();
|
|
56
|
+
}
|
|
57
|
+
function onKeyDown(e) {
|
|
58
|
+
if (e.defaultPrevented) return;
|
|
59
|
+
if (cancel && e.key === "Escape") {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
return cancel();
|
|
62
|
+
}
|
|
63
|
+
if (!isPrintChord(e)) return;
|
|
64
|
+
if (!cancel && loading.size === 0 && [...targets].every((t) => t.settled())) return;
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
if (!cancel) void printWhenDrawn();
|
|
67
|
+
}
|
|
68
|
+
function installPrintShortcut() {
|
|
69
|
+
if (installs++ === 0) document.addEventListener("keydown", onKeyDown);
|
|
70
|
+
let installed = true;
|
|
71
|
+
return () => {
|
|
72
|
+
if (!installed) return;
|
|
73
|
+
installed = false;
|
|
74
|
+
if (--installs > 0) return;
|
|
75
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
76
|
+
cancel?.();
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
holdPrintUntil,
|
|
81
|
+
installPrintShortcut,
|
|
82
|
+
registerPrintTarget
|
|
83
|
+
};
|