@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.
Files changed (92) hide show
  1. package/README.md +261 -42
  2. package/dist/check-routes-bin.js +190 -53
  3. package/dist/{chunk-6VOHFFA5.js → chunk-7T5EEJHK.js} +2 -2
  4. package/dist/chunk-DUPT6XLB.js +57 -0
  5. package/dist/chunk-IW3TUD4G.js +841 -0
  6. package/dist/{chunk-MGSUQBDW.js → chunk-KU7LWK4E.js} +249 -24
  7. package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
  8. package/dist/chunk-SFFBZFEN.js +178 -0
  9. package/dist/chunk-U74B7AUG.js +398 -0
  10. package/dist/chunk-ZIW6FDU2.js +1126 -0
  11. package/dist/client-BGjmEWhN.d.cts +207 -0
  12. package/dist/client-D0LTpr3Y.d.ts +207 -0
  13. package/dist/code-copy.cjs +74 -0
  14. package/dist/code-copy.d.cts +18 -0
  15. package/dist/code-copy.d.ts +18 -0
  16. package/dist/code-copy.js +50 -0
  17. package/dist/comments.cjs +738 -280
  18. package/dist/comments.d.cts +66 -3
  19. package/dist/comments.d.ts +66 -3
  20. package/dist/comments.js +419 -331
  21. package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
  22. package/dist/docs-enhance.cjs +7 -4
  23. package/dist/docs-enhance.d.cts +5 -3
  24. package/dist/docs-enhance.d.ts +5 -3
  25. package/dist/docs-enhance.js +8 -5
  26. package/dist/{embed-DNTZ2UXv.d.ts → embed-CbtsbZs3.d.cts} +5 -3
  27. package/dist/{embed-BmdwA2G9.d.cts → embed-Cf_2ZR5x.d.ts} +5 -3
  28. package/dist/fragment-alias.cjs +51 -0
  29. package/dist/fragment-alias.d.cts +7 -0
  30. package/dist/fragment-alias.d.ts +7 -0
  31. package/dist/fragment-alias.js +27 -0
  32. package/dist/html.cjs +886 -0
  33. package/dist/html.d.cts +20 -0
  34. package/dist/html.d.ts +20 -0
  35. package/dist/html.js +45 -0
  36. package/dist/index.cjs +244 -24
  37. package/dist/index.d.cts +22 -68
  38. package/dist/index.d.ts +22 -68
  39. package/dist/index.js +12 -2
  40. package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.cts} +9 -0
  41. package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.ts} +9 -0
  42. package/dist/mermaid-diagram.cjs +441 -125
  43. package/dist/mermaid-diagram.d.cts +23 -7
  44. package/dist/mermaid-diagram.d.ts +23 -7
  45. package/dist/mermaid-diagram.js +213 -51
  46. package/dist/mermaid-image.cjs +137 -60
  47. package/dist/mermaid-image.d.cts +4 -3
  48. package/dist/mermaid-image.d.ts +4 -3
  49. package/dist/mermaid-image.js +27 -28
  50. package/dist/next.cjs +836 -304
  51. package/dist/next.d.cts +45 -20
  52. package/dist/next.d.ts +45 -20
  53. package/dist/next.js +151 -40
  54. package/dist/print-coordinator.cjs +157 -0
  55. package/dist/print-coordinator.d.cts +27 -0
  56. package/dist/print-coordinator.d.ts +27 -0
  57. package/dist/print-coordinator.js +83 -0
  58. package/dist/react.cjs +603 -240
  59. package/dist/react.d.cts +148 -30
  60. package/dist/react.d.ts +148 -30
  61. package/dist/react.js +26 -4
  62. package/dist/reactions.cjs +653 -0
  63. package/dist/reactions.d.cts +27 -0
  64. package/dist/reactions.d.ts +27 -0
  65. package/dist/reactions.js +364 -0
  66. package/dist/{resolve-euZ4-aC9.d.cts → resolve-BnIv7aB7.d.cts} +2 -2
  67. package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BysHtZ_i.d.ts} +2 -2
  68. package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
  69. package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
  70. package/dist/sanitize-BpY_AdZh.d.cts +23 -0
  71. package/dist/sanitize-BpY_AdZh.d.ts +23 -0
  72. package/dist/styles.css +100 -29
  73. package/dist/toc-spy.cjs +60 -0
  74. package/dist/toc-spy.d.cts +15 -0
  75. package/dist/toc-spy.d.ts +15 -0
  76. package/dist/toc-spy.js +36 -0
  77. package/dist/{types-Czt887Iv.d.cts → types-D09Z072G.d.cts} +57 -2
  78. package/dist/{types-Czt887Iv.d.ts → types-D09Z072G.d.ts} +57 -2
  79. package/dist/use-cache.cjs +89 -13
  80. package/dist/use-cache.d.cts +12 -5
  81. package/dist/use-cache.d.ts +12 -5
  82. package/dist/use-cache.js +8 -8
  83. package/dist/youtube-facade.cjs +50 -0
  84. package/dist/youtube-facade.d.cts +17 -0
  85. package/dist/youtube-facade.d.ts +17 -0
  86. package/dist/youtube-facade.js +26 -0
  87. package/package.json +16 -3
  88. package/dist/chunk-67IOIAVW.js +0 -35
  89. package/dist/chunk-DMK4XQLU.js +0 -1556
  90. package/dist/chunk-PJMJMP66.js +0 -63
  91. package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
  92. 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
+ };