@tdacorp/hyle-sdk 0.14.1 → 0.21.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/README.md +171 -32
- package/dist/check-routes-bin.js +48 -21
- package/dist/chunk-56Y24XBV.js +840 -0
- package/dist/{chunk-MGSUQBDW.js → chunk-75JFLML4.js} +176 -14
- package/dist/chunk-HJX57NLI.js +1105 -0
- package/dist/chunk-K5VDLROQ.js +145 -0
- package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
- package/dist/chunk-U74B7AUG.js +398 -0
- package/dist/{chunk-6VOHFFA5.js → chunk-X2TLYM7Y.js} +2 -2
- package/dist/client-41fU6OY2.d.cts +201 -0
- package/dist/client-LwzHwqpM.d.ts +201 -0
- package/dist/code-copy.cjs +72 -0
- package/dist/code-copy.d.cts +15 -0
- package/dist/code-copy.d.ts +15 -0
- package/dist/code-copy.js +48 -0
- package/dist/comments.cjs +733 -278
- package/dist/comments.d.cts +66 -3
- package/dist/comments.d.ts +66 -3
- package/dist/comments.js +414 -330
- package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-XY3CG75U.js} +107 -46
- package/dist/{embed-B76zRRPa.d.cts → embed-BUFRQboD.d.ts} +10 -5
- package/dist/{embed-SqOBGI-E.d.ts → embed-CYt-q13P.d.cts} +10 -5
- 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 +881 -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 +181 -14
- package/dist/index.d.cts +14 -62
- package/dist/index.d.ts +14 -62
- package/dist/index.js +11 -1
- package/dist/labels-CrA-iqTN.d.cts +46 -0
- package/dist/labels-CrA-iqTN.d.ts +46 -0
- package/dist/mermaid-diagram.cjs +453 -148
- package/dist/mermaid-diagram.d.cts +25 -42
- package/dist/mermaid-diagram.d.ts +25 -42
- package/dist/mermaid-diagram.js +205 -50
- package/dist/mermaid-image.cjs +1456 -0
- package/dist/mermaid-image.d.cts +30 -0
- package/dist/mermaid-image.d.ts +30 -0
- package/dist/mermaid-image.js +93 -0
- package/dist/next.cjs +1709 -1134
- package/dist/next.d.cts +67 -14
- package/dist/next.d.ts +67 -14
- package/dist/next.js +950 -794
- 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 +677 -264
- package/dist/react.d.cts +161 -31
- package/dist/react.d.ts +161 -31
- package/dist/react.js +23 -3
- 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-DC2ccfwA.d.ts → resolve-BjAK0k_Y.d.ts} +2 -2
- package/dist/{resolve-DKLVftk_.d.cts → resolve-eI1muCKL.d.cts} +2 -2
- package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
- package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
- package/dist/sanitize-ijiWjEm9.d.cts +23 -0
- package/dist/sanitize-ijiWjEm9.d.ts +23 -0
- package/dist/styles.css +107 -47
- package/dist/toc-spy.cjs +59 -0
- package/dist/toc-spy.d.cts +15 -0
- package/dist/toc-spy.d.ts +15 -0
- package/dist/toc-spy.js +35 -0
- package/dist/{types-ByodIyEv.d.cts → types-3F0wqD-o.d.cts} +44 -4
- package/dist/{types-ByodIyEv.d.ts → types-3F0wqD-o.d.ts} +44 -4
- package/dist/use-cache.cjs +37 -11
- package/dist/use-cache.d.cts +12 -5
- package/dist/use-cache.d.ts +12 -5
- package/dist/use-cache.js +7 -7
- 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-4V4VKB3O.js +0 -1471
- package/dist/chunk-R5EMI4HQ.js +0 -61
- package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
- package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/react/print-coordinator.ts
|
|
21
|
+
var print_coordinator_exports = {};
|
|
22
|
+
__export(print_coordinator_exports, {
|
|
23
|
+
holdPrintUntil: () => holdPrintUntil,
|
|
24
|
+
installPrintShortcut: () => installPrintShortcut,
|
|
25
|
+
registerPrintTarget: () => registerPrintTarget
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(print_coordinator_exports);
|
|
28
|
+
|
|
29
|
+
// src/react/mermaid-config.ts
|
|
30
|
+
var MAX_MERMAID_SOURCE = 1024 * 1024;
|
|
31
|
+
var RENDER_TIMEOUT_MS = 1e4;
|
|
32
|
+
function withTimeout(promise, ms) {
|
|
33
|
+
let timer;
|
|
34
|
+
const timeout = new Promise((_, reject) => {
|
|
35
|
+
timer = setTimeout(() => reject(new Error("timeout")), ms);
|
|
36
|
+
});
|
|
37
|
+
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/react/viewer/labels.ts
|
|
41
|
+
var VIEWER_LABELS_EN = {
|
|
42
|
+
expand: "Expand diagram",
|
|
43
|
+
expandHint: "Expand",
|
|
44
|
+
viewer: "Diagram viewer",
|
|
45
|
+
close: "Close",
|
|
46
|
+
zoomIn: "Zoom in",
|
|
47
|
+
zoomOut: "Zoom out",
|
|
48
|
+
fit: "Fit to window",
|
|
49
|
+
actual: "100%: actual size",
|
|
50
|
+
search: "Find in diagram",
|
|
51
|
+
searchPlaceholder: "Find",
|
|
52
|
+
noMatch: "No match",
|
|
53
|
+
matchOf: "{n} of {total}",
|
|
54
|
+
copySource: "MMD: copy diagram source",
|
|
55
|
+
downloadSvg: "SVG: download",
|
|
56
|
+
downloadPng: "PNG: download",
|
|
57
|
+
copyImage: "IMG: copy as image",
|
|
58
|
+
pngScale: "PNG scale",
|
|
59
|
+
fullscreen: "Fullscreen",
|
|
60
|
+
exitFullscreen: "Exit fullscreen",
|
|
61
|
+
copied: "Copied",
|
|
62
|
+
saved: "Saved",
|
|
63
|
+
unavailable: "Not available here",
|
|
64
|
+
hint: "Scroll to zoom, drag to pan, click a node to trace its paths, press / to search",
|
|
65
|
+
legendSelected: "Selected",
|
|
66
|
+
legendUpstream: "Upstream",
|
|
67
|
+
legendDownstream: "Downstream",
|
|
68
|
+
outgoing: "outgoing",
|
|
69
|
+
tracing: "{label}: {up} upstream, {down} downstream",
|
|
70
|
+
map: "Overview map",
|
|
71
|
+
largeTitle: "Large diagram, not drawn automatically",
|
|
72
|
+
largeBody: "Drawing a diagram this size can freeze this page for a few seconds, so it waits until you ask. Press Draw diagram: it takes a couple of seconds (a few more on a phone) and the page may pause while it works.",
|
|
73
|
+
drawLarge: "Draw diagram",
|
|
74
|
+
drawing: "Drawing\u2026",
|
|
75
|
+
drawingBody: "Drawing the diagram\u2026 this takes a couple of seconds.",
|
|
76
|
+
drawAgain: "Draw again",
|
|
77
|
+
showSource: "Show full source",
|
|
78
|
+
hideSource: "Show less",
|
|
79
|
+
printPreparing: "Preparing diagrams for print\u2026 Esc cancels between steps."
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/react/print-coordinator.ts
|
|
83
|
+
var targets = /* @__PURE__ */ new Set();
|
|
84
|
+
var loading = /* @__PURE__ */ new Set();
|
|
85
|
+
function holdPrintUntil(loaded) {
|
|
86
|
+
loading.add(loaded);
|
|
87
|
+
const release = () => void loading.delete(loaded);
|
|
88
|
+
void loaded.then(release, release);
|
|
89
|
+
}
|
|
90
|
+
function registerPrintTarget(target) {
|
|
91
|
+
targets.add(target);
|
|
92
|
+
return () => void targets.delete(target);
|
|
93
|
+
}
|
|
94
|
+
function isPrintChord(e) {
|
|
95
|
+
const platform = navigator.userAgentData?.platform || navigator.platform;
|
|
96
|
+
const modifier = /mac/i.test(platform) ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey;
|
|
97
|
+
const nonLatinLetter = /^\p{L}$/u.test(e.key) && !/\p{Script=Latin}/u.test(e.key);
|
|
98
|
+
const isP = e.key.toLowerCase() === "p" || nonLatinLetter && e.code === "KeyP";
|
|
99
|
+
return modifier && !e.altKey && !e.shiftKey && isP;
|
|
100
|
+
}
|
|
101
|
+
function showStatus() {
|
|
102
|
+
const note = document.createElement("div");
|
|
103
|
+
note.className = "hyle-print-status";
|
|
104
|
+
note.setAttribute("role", "status");
|
|
105
|
+
note.textContent = [...targets].find((t) => t.status)?.status ?? VIEWER_LABELS_EN.printPreparing;
|
|
106
|
+
const dialogs = document.querySelectorAll("dialog[open]");
|
|
107
|
+
(dialogs[dialogs.length - 1] ?? document.body).append(note);
|
|
108
|
+
return () => note.remove();
|
|
109
|
+
}
|
|
110
|
+
var cancel = null;
|
|
111
|
+
var installs = 0;
|
|
112
|
+
async function printWhenDrawn() {
|
|
113
|
+
let cancelled = false;
|
|
114
|
+
const escaped = new Promise((resolve) => {
|
|
115
|
+
cancel = () => {
|
|
116
|
+
cancelled = true;
|
|
117
|
+
resolve();
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
const hideStatus = showStatus();
|
|
121
|
+
const drawn = withTimeout(Promise.all(loading).then(() => Promise.all([...targets].map((t) => t.prepare?.()))), RENDER_TIMEOUT_MS).catch((error) => {
|
|
122
|
+
loading.clear();
|
|
123
|
+
throw error;
|
|
124
|
+
}).then(() => withTimeout(Promise.all([...targets].map((t) => t.ensureDrawn())), RENDER_TIMEOUT_MS)).catch(() => void 0);
|
|
125
|
+
await Promise.race([drawn, escaped]);
|
|
126
|
+
cancel = null;
|
|
127
|
+
hideStatus();
|
|
128
|
+
if (!cancelled) window.print();
|
|
129
|
+
}
|
|
130
|
+
function onKeyDown(e) {
|
|
131
|
+
if (e.defaultPrevented) return;
|
|
132
|
+
if (cancel && e.key === "Escape") {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
return cancel();
|
|
135
|
+
}
|
|
136
|
+
if (!isPrintChord(e)) return;
|
|
137
|
+
if (!cancel && loading.size === 0 && [...targets].every((t) => t.settled())) return;
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
if (!cancel) void printWhenDrawn();
|
|
140
|
+
}
|
|
141
|
+
function installPrintShortcut() {
|
|
142
|
+
if (installs++ === 0) document.addEventListener("keydown", onKeyDown);
|
|
143
|
+
let installed = true;
|
|
144
|
+
return () => {
|
|
145
|
+
if (!installed) return;
|
|
146
|
+
installed = false;
|
|
147
|
+
if (--installs > 0) return;
|
|
148
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
149
|
+
cancel?.();
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
holdPrintUntil,
|
|
155
|
+
installPrintShortcut,
|
|
156
|
+
registerPrintTarget
|
|
157
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** One mounted diagram, as the print shortcut sees it. */
|
|
2
|
+
interface PrintTarget {
|
|
3
|
+
/** True once the diagram is drawn, has failed, or is a large one the reader has not asked for (print shows its source). */
|
|
4
|
+
settled: () => boolean;
|
|
5
|
+
/** Fetches the code drawing needs (Mermaid), so a slow download is not counted against the draw budget. */
|
|
6
|
+
prepare?: () => Promise<unknown>;
|
|
7
|
+
/** Forces the diagram to draw; resolves once it is settled (at once when it already is, which includes a large one not asked for). */
|
|
8
|
+
ensureDrawn: () => Promise<void>;
|
|
9
|
+
/** The note shown while the print waits, in the diagram's locale (English when omitted). */
|
|
10
|
+
status?: string;
|
|
11
|
+
}
|
|
12
|
+
/** `loaded` must settle (never reject) once every diagram it mounts has registered; a failed load settles it too. */
|
|
13
|
+
declare function holdPrintUntil(loaded: Promise<unknown>): void;
|
|
14
|
+
/** Called by each mounted diagram; returns the cleanup. */
|
|
15
|
+
declare function registerPrintTarget(target: PrintTarget): () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Ctrl/Cmd+P while a diagram is not drawn yet: hold the browser's print, draw every diagram, then call `window.print()`.
|
|
18
|
+
* Otherwise the key is left alone. Escape during the wait cancels the print.
|
|
19
|
+
* File > Print cannot be intercepted and still prints the source.
|
|
20
|
+
* Every MermaidDiagram installs it. One document listener serves every caller: it goes with the last cleanup, which
|
|
21
|
+
* also cancels a wait in progress.
|
|
22
|
+
* shortcut: the budgets and Escape are only served between tasks. Mermaid lays a diagram out in one synchronous task, so a diagram that
|
|
23
|
+
* is one huge layout holds the press until that layout ends, timers and Escape included; upgrade by not drawing such diagrams at all.
|
|
24
|
+
*/
|
|
25
|
+
declare function installPrintShortcut(): () => void;
|
|
26
|
+
|
|
27
|
+
export { type PrintTarget, holdPrintUntil, installPrintShortcut, registerPrintTarget };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** One mounted diagram, as the print shortcut sees it. */
|
|
2
|
+
interface PrintTarget {
|
|
3
|
+
/** True once the diagram is drawn, has failed, or is a large one the reader has not asked for (print shows its source). */
|
|
4
|
+
settled: () => boolean;
|
|
5
|
+
/** Fetches the code drawing needs (Mermaid), so a slow download is not counted against the draw budget. */
|
|
6
|
+
prepare?: () => Promise<unknown>;
|
|
7
|
+
/** Forces the diagram to draw; resolves once it is settled (at once when it already is, which includes a large one not asked for). */
|
|
8
|
+
ensureDrawn: () => Promise<void>;
|
|
9
|
+
/** The note shown while the print waits, in the diagram's locale (English when omitted). */
|
|
10
|
+
status?: string;
|
|
11
|
+
}
|
|
12
|
+
/** `loaded` must settle (never reject) once every diagram it mounts has registered; a failed load settles it too. */
|
|
13
|
+
declare function holdPrintUntil(loaded: Promise<unknown>): void;
|
|
14
|
+
/** Called by each mounted diagram; returns the cleanup. */
|
|
15
|
+
declare function registerPrintTarget(target: PrintTarget): () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Ctrl/Cmd+P while a diagram is not drawn yet: hold the browser's print, draw every diagram, then call `window.print()`.
|
|
18
|
+
* Otherwise the key is left alone. Escape during the wait cancels the print.
|
|
19
|
+
* File > Print cannot be intercepted and still prints the source.
|
|
20
|
+
* Every MermaidDiagram installs it. One document listener serves every caller: it goes with the last cleanup, which
|
|
21
|
+
* also cancels a wait in progress.
|
|
22
|
+
* shortcut: the budgets and Escape are only served between tasks. Mermaid lays a diagram out in one synchronous task, so a diagram that
|
|
23
|
+
* is one huge layout holds the press until that layout ends, timers and Escape included; upgrade by not drawing such diagrams at all.
|
|
24
|
+
*/
|
|
25
|
+
declare function installPrintShortcut(): () => void;
|
|
26
|
+
|
|
27
|
+
export { type PrintTarget, holdPrintUntil, installPrintShortcut, registerPrintTarget };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RENDER_TIMEOUT_MS,
|
|
3
|
+
withTimeout
|
|
4
|
+
} from "./chunk-K5VDLROQ.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
|
+
};
|