@tdacorp/hyle-sdk 0.14.1 → 0.17.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 +20 -8
- package/dist/check-routes-bin.js +10 -8
- package/dist/{chunk-4V4VKB3O.js → chunk-DMK4XQLU.js} +470 -385
- package/dist/{chunk-R5EMI4HQ.js → chunk-PJMJMP66.js} +3 -1
- package/dist/comments.cjs +6 -4
- package/dist/comments.js +6 -5
- package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-FJPED4SN.js} +46 -26
- package/dist/{embed-B76zRRPa.d.cts → embed-BmdwA2G9.d.cts} +9 -4
- package/dist/{embed-SqOBGI-E.d.ts → embed-DNTZ2UXv.d.ts} +9 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/labels-nmukKYgL.d.cts +37 -0
- package/dist/labels-nmukKYgL.d.ts +37 -0
- package/dist/mermaid-diagram.cjs +59 -30
- package/dist/mermaid-diagram.d.cts +4 -37
- package/dist/mermaid-diagram.d.ts +4 -37
- package/dist/mermaid-diagram.js +7 -5
- package/dist/mermaid-image.cjs +1382 -0
- package/dist/mermaid-image.d.cts +29 -0
- package/dist/mermaid-image.d.ts +29 -0
- package/dist/mermaid-image.js +94 -0
- package/dist/next.cjs +1330 -1118
- package/dist/next.d.cts +61 -11
- package/dist/next.d.ts +61 -11
- package/dist/next.js +922 -793
- package/dist/react.cjs +267 -184
- package/dist/react.d.cts +29 -6
- package/dist/react.d.ts +29 -6
- package/dist/react.js +1 -1
- package/dist/{resolve-DC2ccfwA.d.ts → resolve-Ae7UFjsQ.d.ts} +1 -1
- package/dist/{resolve-DKLVftk_.d.cts → resolve-euZ4-aC9.d.cts} +1 -1
- package/dist/styles.css +11 -22
- package/dist/{types-ByodIyEv.d.cts → types-Czt887Iv.d.cts} +19 -3
- package/dist/{types-ByodIyEv.d.ts → types-Czt887Iv.d.ts} +19 -3
- package/dist/use-cache.d.cts +2 -2
- package/dist/use-cache.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/react/mermaid-config.ts
|
|
2
|
-
var MAX_MERMAID_SOURCE =
|
|
2
|
+
var MAX_MERMAID_SOURCE = 1024 * 1024;
|
|
3
|
+
var MAX_MERMAID_EDGES = 5e3;
|
|
3
4
|
function luminance(css) {
|
|
4
5
|
const m = /^(rgba?)\(([^)]*)\)$|^color\(srgb ([^)]*)\)$/.exec(css.trim());
|
|
5
6
|
if (!m) return void 0;
|
|
@@ -52,6 +53,7 @@ function whenNearViewport(el, onNear, Observer = globalThis.IntersectionObserver
|
|
|
52
53
|
|
|
53
54
|
export {
|
|
54
55
|
MAX_MERMAID_SOURCE,
|
|
56
|
+
MAX_MERMAID_EDGES,
|
|
55
57
|
pickMermaidTheme,
|
|
56
58
|
RENDER_TIMEOUT_MS,
|
|
57
59
|
stripMermaidConfig,
|
package/dist/comments.cjs
CHANGED
|
@@ -179,7 +179,7 @@ var HastLimitError = class extends Error {
|
|
|
179
179
|
var MAX_NODES = 2e4;
|
|
180
180
|
var MAX_TEXT = 512 * 1024;
|
|
181
181
|
var MAX_DEPTH = 128;
|
|
182
|
-
var MAX_SRCDOC =
|
|
182
|
+
var MAX_SRCDOC = 1024 * 1024;
|
|
183
183
|
var DROP = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
|
|
184
184
|
var VOID = /* @__PURE__ */ new Set(["br", "hr", "img", "input", "path"]);
|
|
185
185
|
var isString = (v) => typeof v === "string";
|
|
@@ -196,6 +196,7 @@ var classTokens = (v) => {
|
|
|
196
196
|
};
|
|
197
197
|
var isClass = (v) => classTokens(v) !== void 0;
|
|
198
198
|
var isAlign = matches(/^(left|right|center)$/);
|
|
199
|
+
var isPixels = (v) => typeof v === "number" ? Number.isInteger(v) && v > 0 : typeof v === "string" && /^[1-9]\d*$/.test(v);
|
|
199
200
|
var isLength = matches(/^[\d.]+(em|px|%)?$/);
|
|
200
201
|
var STYLE_PROPS = /* @__PURE__ */ new Set(["height", "vertical-align", "margin-left", "margin-right", "margin-top", "margin-bottom", "top", "width", "min-width", "border-bottom-width", "padding-left"]);
|
|
201
202
|
var STYLE_LENGTH = /^(-?\d+(?:\.\d+)?)(em|px|%)?$/;
|
|
@@ -230,7 +231,8 @@ var MERMAID_SRCDOC = new RegExp(
|
|
|
230
231
|
`^<!doctype html><html><head><meta charset="utf-8"></head><body><div class="mermaid">([^<]*)</div><script src="${MERMAID_SCRIPT_URL.replace(/[.]/g, "\\.")}"></script><script>mermaid\\.initialize\\(\\{ startOnLoad: true, securityLevel: "strict" \\}\\);</script></body></html>$`
|
|
231
232
|
);
|
|
232
233
|
var isMermaidSrcdoc = (v) => typeof v === "string" && v.length <= MAX_SRCDOC && MERMAID_SRCDOC.test(v);
|
|
233
|
-
var
|
|
234
|
+
var RENDER_REF = /^(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.svg) ([1-9]\d{0,5}) ([1-9]\d{0,5})$/;
|
|
235
|
+
var isRenderRef = matches(RENDER_REF);
|
|
234
236
|
var heading = { id: isIdValue, className: isClass };
|
|
235
237
|
var ATTRS = new Map(
|
|
236
238
|
Object.entries({
|
|
@@ -255,7 +257,7 @@ var ATTRS = new Map(
|
|
|
255
257
|
h5: heading,
|
|
256
258
|
h6: heading,
|
|
257
259
|
a: { href: isHref, id: isIdValue, ariaDescribedBy: isIdValue, ariaLabel: isString, dataFootnoteRef: isScalar, dataFootnoteBackref: isScalar, className: isClass },
|
|
258
|
-
img: { src: isSrc, alt: isString },
|
|
260
|
+
img: { src: isSrc, alt: isString, width: isPixels, height: isPixels },
|
|
259
261
|
table: {},
|
|
260
262
|
th: { scope: matches(/^(row|col|rowgroup|colgroup)$/), align: isAlign },
|
|
261
263
|
td: { align: isAlign },
|
|
@@ -269,7 +271,7 @@ var ATTRS = new Map(
|
|
|
269
271
|
video: { src: isSrc, controls: isScalar },
|
|
270
272
|
audio: { src: isSrc, controls: isScalar },
|
|
271
273
|
// hyle's sandboxed Mermaid frame (ADR 0001). The renderer emits `sandbox` as ["allow-scripts"]; it is normalized below.
|
|
272
|
-
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc }
|
|
274
|
+
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc, dataLight: isRenderRef, dataDark: isRenderRef }
|
|
273
275
|
})
|
|
274
276
|
);
|
|
275
277
|
var isObject2 = (v) => typeof v === "object" && v !== null;
|
package/dist/comments.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "./chunk-R5EMI4HQ.js";
|
|
3
2
|
|
|
4
3
|
// src/react/comments.tsx
|
|
5
4
|
import { useCallback, useEffect as useEffect2, useId, useRef as useRef2, useState as useState2 } from "react";
|
|
@@ -157,7 +156,7 @@ var HastLimitError = class extends Error {
|
|
|
157
156
|
var MAX_NODES = 2e4;
|
|
158
157
|
var MAX_TEXT = 512 * 1024;
|
|
159
158
|
var MAX_DEPTH = 128;
|
|
160
|
-
var MAX_SRCDOC =
|
|
159
|
+
var MAX_SRCDOC = 1024 * 1024;
|
|
161
160
|
var DROP = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
|
|
162
161
|
var VOID = /* @__PURE__ */ new Set(["br", "hr", "img", "input", "path"]);
|
|
163
162
|
var isString = (v) => typeof v === "string";
|
|
@@ -174,6 +173,7 @@ var classTokens = (v) => {
|
|
|
174
173
|
};
|
|
175
174
|
var isClass = (v) => classTokens(v) !== void 0;
|
|
176
175
|
var isAlign = matches(/^(left|right|center)$/);
|
|
176
|
+
var isPixels = (v) => typeof v === "number" ? Number.isInteger(v) && v > 0 : typeof v === "string" && /^[1-9]\d*$/.test(v);
|
|
177
177
|
var isLength = matches(/^[\d.]+(em|px|%)?$/);
|
|
178
178
|
var STYLE_PROPS = /* @__PURE__ */ new Set(["height", "vertical-align", "margin-left", "margin-right", "margin-top", "margin-bottom", "top", "width", "min-width", "border-bottom-width", "padding-left"]);
|
|
179
179
|
var STYLE_LENGTH = /^(-?\d+(?:\.\d+)?)(em|px|%)?$/;
|
|
@@ -208,7 +208,8 @@ var MERMAID_SRCDOC = new RegExp(
|
|
|
208
208
|
`^<!doctype html><html><head><meta charset="utf-8"></head><body><div class="mermaid">([^<]*)</div><script src="${MERMAID_SCRIPT_URL.replace(/[.]/g, "\\.")}"></script><script>mermaid\\.initialize\\(\\{ startOnLoad: true, securityLevel: "strict" \\}\\);</script></body></html>$`
|
|
209
209
|
);
|
|
210
210
|
var isMermaidSrcdoc = (v) => typeof v === "string" && v.length <= MAX_SRCDOC && MERMAID_SRCDOC.test(v);
|
|
211
|
-
var
|
|
211
|
+
var RENDER_REF = /^(\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.svg) ([1-9]\d{0,5}) ([1-9]\d{0,5})$/;
|
|
212
|
+
var isRenderRef = matches(RENDER_REF);
|
|
212
213
|
var heading = { id: isIdValue, className: isClass };
|
|
213
214
|
var ATTRS = new Map(
|
|
214
215
|
Object.entries({
|
|
@@ -233,7 +234,7 @@ var ATTRS = new Map(
|
|
|
233
234
|
h5: heading,
|
|
234
235
|
h6: heading,
|
|
235
236
|
a: { href: isHref, id: isIdValue, ariaDescribedBy: isIdValue, ariaLabel: isString, dataFootnoteRef: isScalar, dataFootnoteBackref: isScalar, className: isClass },
|
|
236
|
-
img: { src: isSrc, alt: isString },
|
|
237
|
+
img: { src: isSrc, alt: isString, width: isPixels, height: isPixels },
|
|
237
238
|
table: {},
|
|
238
239
|
th: { scope: matches(/^(row|col|rowgroup|colgroup)$/), align: isAlign },
|
|
239
240
|
td: { align: isAlign },
|
|
@@ -247,7 +248,7 @@ var ATTRS = new Map(
|
|
|
247
248
|
video: { src: isSrc, controls: isScalar },
|
|
248
249
|
audio: { src: isSrc, controls: isScalar },
|
|
249
250
|
// hyle's sandboxed Mermaid frame (ADR 0001). The renderer emits `sandbox` as ["allow-scripts"]; it is normalized below.
|
|
250
|
-
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc }
|
|
251
|
+
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc, dataLight: isRenderRef, dataDark: isRenderRef }
|
|
251
252
|
})
|
|
252
253
|
);
|
|
253
254
|
var isObject2 = (v) => typeof v === "object" && v !== null;
|
|
@@ -257,6 +257,31 @@ function standaloneSvg(svg) {
|
|
|
257
257
|
return svg.replace(open, tagText);
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
// src/react/viewer/svg-css.ts
|
|
261
|
+
var SVG_CSS = `
|
|
262
|
+
svg{display:block;position:static!important;width:100%;height:100%;max-width:none!important}
|
|
263
|
+
.hv-n{cursor:pointer;outline:none}
|
|
264
|
+
.hv-n,.hv-e{transition:opacity .15s}
|
|
265
|
+
@media (prefers-reduced-motion:reduce){.hv-n,.hv-e{transition:none}}
|
|
266
|
+
:host(.hv-plain) .hv-n,:host(.hv-plain) .hv-e{transition:none}
|
|
267
|
+
:host(.hv-active) .hv-n:not(.hv-on),:host(.hv-active) .hv-e:not(.hv-on){opacity:var(--hv-dim)}
|
|
268
|
+
.hv-n:focus-visible :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-focus)!important;stroke-width:calc(3px / var(--hv-k,1))!important}
|
|
269
|
+
.hv-n.hv-nb :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(2px / var(--hv-k,1))!important}
|
|
270
|
+
.hv-n.hv-up :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-up)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
|
|
271
|
+
.hv-n.hv-down :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-down)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
|
|
272
|
+
.hv-n.hv-sel :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(3.5px / var(--hv-k,1))!important}
|
|
273
|
+
.hv-n.hv-hit :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(3px / var(--hv-k,1))!important}
|
|
274
|
+
.hv-n.hv-cur :is(rect,polygon,circle,ellipse,path){stroke-width:calc(5px / var(--hv-k,1))!important}
|
|
275
|
+
text.hv-hit,text.hv-hit tspan{fill:var(--hv-accent)!important;font-weight:700}
|
|
276
|
+
text.hv-cur{text-decoration:underline}
|
|
277
|
+
path.hv-nb{stroke:var(--hv-accent)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
|
|
278
|
+
path.hv-up{stroke:var(--hv-up)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
|
|
279
|
+
path.hv-down{stroke:var(--hv-down)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
|
|
280
|
+
path.hv-flow{stroke-dasharray:calc(7px / var(--hv-k,1)) calc(6px / var(--hv-k,1))!important;animation:hv-dash .9s linear infinite}
|
|
281
|
+
@keyframes hv-dash{to{stroke-dashoffset:calc(-26px / var(--hv-k,1))}}
|
|
282
|
+
@media (prefers-reduced-motion:reduce){path.hv-flow{animation:none}}
|
|
283
|
+
`;
|
|
284
|
+
|
|
260
285
|
// src/react/viewer/view-math.ts
|
|
261
286
|
var MIN_K = 0.2;
|
|
262
287
|
var MAX_K = 10;
|
|
@@ -355,6 +380,7 @@ var DiagramController = class {
|
|
|
355
380
|
constructor(o) {
|
|
356
381
|
this.o = o;
|
|
357
382
|
const { viewport: vp, stage, minimap } = o;
|
|
383
|
+
const root = this.root = stage.shadowRoot ?? stage.attachShadow({ mode: "open" });
|
|
358
384
|
const on = (el, type, fn, opts) => {
|
|
359
385
|
el.addEventListener(type, fn, opts);
|
|
360
386
|
this.off.push(() => el.removeEventListener(type, fn, opts));
|
|
@@ -364,21 +390,16 @@ var DiagramController = class {
|
|
|
364
390
|
on(vp, "pointermove", (e) => this.onMove(e));
|
|
365
391
|
on(vp, "pointerup", (e) => this.onUp(e));
|
|
366
392
|
on(vp, "pointercancel", (e) => this.onUp(e, true));
|
|
367
|
-
on(
|
|
368
|
-
on(
|
|
369
|
-
on(
|
|
370
|
-
on(
|
|
393
|
+
on(root, "pointerover", (e) => e.pointerType === "mouse" && !this.pointers.size && this.mouseOver(this.keyAt(e.target)));
|
|
394
|
+
on(root, "pointerout", (e) => e.pointerType === "mouse" && !this.pointers.size && this.mouseOver(this.keyAt(e.relatedTarget)));
|
|
395
|
+
on(root, "focusin", (e) => this.onFocusIn(e));
|
|
396
|
+
on(root, "focusout", () => this.focusLeft());
|
|
371
397
|
on(minimap, "pointerdown", (e) => this.onMiniDown(e));
|
|
372
398
|
on(minimap, "pointermove", (e) => this.miniDrag && this.miniTo(e));
|
|
373
399
|
on(minimap, "pointerup", () => this.miniDrag = false);
|
|
374
400
|
on(minimap, "pointercancel", () => this.miniDrag = false);
|
|
375
401
|
this.ro = new ResizeObserver(() => this.measure());
|
|
376
402
|
this.ro.observe(vp);
|
|
377
|
-
this.watcher = new MutationObserver(() => {
|
|
378
|
-
const now = stage.querySelector("svg");
|
|
379
|
-
if (now && now !== this.svg && this.source) this.mount(now, this.source.markup, this.source.idPrefix);
|
|
380
|
-
});
|
|
381
|
-
this.watcher.observe(stage, { childList: true });
|
|
382
403
|
this.measure();
|
|
383
404
|
}
|
|
384
405
|
o;
|
|
@@ -416,8 +437,7 @@ var DiagramController = class {
|
|
|
416
437
|
dragging = false;
|
|
417
438
|
samples = [];
|
|
418
439
|
ro;
|
|
419
|
-
|
|
420
|
-
source;
|
|
440
|
+
root;
|
|
421
441
|
miniDrag = false;
|
|
422
442
|
miniColors = { node: "#888", edge: "#555", view: "#0af", bg: "transparent" };
|
|
423
443
|
off = [];
|
|
@@ -425,16 +445,19 @@ var DiagramController = class {
|
|
|
425
445
|
this.anim?.stop();
|
|
426
446
|
cancelAnimationFrame(this.frame);
|
|
427
447
|
this.ro?.disconnect();
|
|
428
|
-
this.watcher?.disconnect();
|
|
429
448
|
for (const f of this.off) f();
|
|
430
449
|
}
|
|
431
450
|
// ---- mounting -----------------------------------------------------------------------------------------------------------------------
|
|
432
|
-
/**
|
|
451
|
+
/** Shows `markup` in the stage's shadow root and attaches to its SVG. A new SVG (theme change) keeps the view and a still-valid pin. */
|
|
452
|
+
show(markup, idPrefix) {
|
|
453
|
+
this.root.innerHTML = `<style>${SVG_CSS}</style>${markup}`;
|
|
454
|
+
const svg = this.root.querySelector("svg");
|
|
455
|
+
if (svg) this.mount(svg, markup, idPrefix);
|
|
456
|
+
}
|
|
433
457
|
mount(svg, markup, idPrefix) {
|
|
434
458
|
const size = svgSize(markup) ?? { w: svg.getBoundingClientRect().width || 600, h: svg.getBoundingClientRect().height || 400 };
|
|
435
459
|
const first = this.svg === void 0;
|
|
436
460
|
this.svg = svg;
|
|
437
|
-
this.source = { markup, idPrefix };
|
|
438
461
|
this.content = { x: 0, y: 0, w: size.w, h: size.h };
|
|
439
462
|
this.o.stage.style.width = `${size.w}px`;
|
|
440
463
|
this.o.stage.style.height = `${size.h}px`;
|
|
@@ -568,8 +591,9 @@ var DiagramController = class {
|
|
|
568
591
|
const at = this.local(e);
|
|
569
592
|
this.pointers.set(e.pointerId, at);
|
|
570
593
|
if (this.pointers.size === 1) {
|
|
571
|
-
const
|
|
572
|
-
|
|
594
|
+
const target = e.composedPath()[0];
|
|
595
|
+
const key = this.keyAt(target);
|
|
596
|
+
this.tap = { at, key, moved: false, link: Boolean(target.closest?.("a")), id: e.pointerId };
|
|
573
597
|
this.start = { view: this.view, at };
|
|
574
598
|
this.dragging = false;
|
|
575
599
|
this.samples = [{ t: e.timeStamp, ...at }];
|
|
@@ -701,7 +725,7 @@ var DiagramController = class {
|
|
|
701
725
|
}
|
|
702
726
|
focusLeft() {
|
|
703
727
|
queueMicrotask(() => {
|
|
704
|
-
if (this.
|
|
728
|
+
if (this.root.activeElement) return;
|
|
705
729
|
this.focusKey = null;
|
|
706
730
|
this.refreshHot();
|
|
707
731
|
});
|
|
@@ -757,7 +781,7 @@ var DiagramController = class {
|
|
|
757
781
|
}
|
|
758
782
|
/** Arrow-key traversal from the focused node. Returns false when the key was not used. */
|
|
759
783
|
traverse(dir) {
|
|
760
|
-
const el =
|
|
784
|
+
const el = this.root.activeElement?.closest?.(".hv-n") ?? null;
|
|
761
785
|
const key = el && this.stageHas(el) ? this.keyAt(el) : null;
|
|
762
786
|
if (key === null || !this.graph) return false;
|
|
763
787
|
const next = pickNeighbour(this.graph, key, dir);
|
|
@@ -769,7 +793,7 @@ var DiagramController = class {
|
|
|
769
793
|
return true;
|
|
770
794
|
}
|
|
771
795
|
stageHas(el) {
|
|
772
|
-
return this.
|
|
796
|
+
return this.root.contains(el);
|
|
773
797
|
}
|
|
774
798
|
/** Keyboard commands of the viewer. Returns true when the key was handled (the caller then prevents the default). */
|
|
775
799
|
key(e) {
|
|
@@ -783,7 +807,7 @@ var DiagramController = class {
|
|
|
783
807
|
this.set({ ...this.view, x: this.view.x + (dir === "left" ? step : dir === "right" ? -step : 0), y: this.view.y + (dir === "up" ? step : dir === "down" ? -step : 0) });
|
|
784
808
|
return true;
|
|
785
809
|
}
|
|
786
|
-
const onNode = this.keyAt(
|
|
810
|
+
const onNode = this.keyAt(this.root.activeElement);
|
|
787
811
|
switch (e.key) {
|
|
788
812
|
case "+":
|
|
789
813
|
case "=":
|
|
@@ -978,7 +1002,6 @@ function DiagramViewer({ svg, svgId, source, title, labels, onClose }) {
|
|
|
978
1002
|
const [scale, setScale] = useState("2");
|
|
979
1003
|
const [fullscreen, setFullscreen] = useState(false);
|
|
980
1004
|
const scoped = useMemo(() => scopeSvg(svg, svgId, ownId.current), [svg, svgId]);
|
|
981
|
-
const html = useMemo(() => ({ __html: scoped }), [scoped]);
|
|
982
1005
|
const say = (message) => {
|
|
983
1006
|
clearTimeout(toastTimer.current);
|
|
984
1007
|
setToast(message);
|
|
@@ -1000,10 +1023,7 @@ function DiagramViewer({ svg, svgId, source, title, labels, onClose }) {
|
|
|
1000
1023
|
ctl.current = null;
|
|
1001
1024
|
};
|
|
1002
1025
|
}, []);
|
|
1003
|
-
useLayoutEffect(() => {
|
|
1004
|
-
const el = stage.current?.querySelector("svg");
|
|
1005
|
-
if (el) ctl.current?.mount(el, scoped, `${ownId.current}_`);
|
|
1006
|
-
}, [scoped]);
|
|
1026
|
+
useLayoutEffect(() => ctl.current?.show(scoped, `${ownId.current}_`), [scoped]);
|
|
1007
1027
|
useEffect(() => {
|
|
1008
1028
|
const d = dialog.current;
|
|
1009
1029
|
if (!d.open) d.showModal();
|
|
@@ -1112,7 +1132,7 @@ function DiagramViewer({ svg, svgId, source, title, labels, onClose }) {
|
|
|
1112
1132
|
/* @__PURE__ */ jsx("button", { type: "button", className: "hv-btn", "aria-label": labels.close, title: `${labels.close} (Esc)`, onClick: () => dialog.current?.close(), children: /* @__PURE__ */ jsx(Glyph, { d: ICONS.close }) })
|
|
1113
1133
|
] })
|
|
1114
1134
|
] }),
|
|
1115
|
-
/* @__PURE__ */ jsx("div", { className: "hv-view", ref: viewport, tabIndex: -1, role: "group", "aria-label": title, "aria-describedby": helpId, children: /* @__PURE__ */ jsx("div", { className: "hv-stage", ref: stage
|
|
1135
|
+
/* @__PURE__ */ jsx("div", { className: "hv-view", ref: viewport, tabIndex: -1, role: "group", "aria-label": title, "aria-describedby": helpId, children: /* @__PURE__ */ jsx("div", { className: "hv-stage", ref: stage }) }),
|
|
1116
1136
|
/* @__PURE__ */ jsx("canvas", { className: "hv-mini", ref: minimap, width: 176, height: 120, hidden: !ui.minimap, "aria-hidden": "true" }),
|
|
1117
1137
|
/* @__PURE__ */ jsxs("div", { className: "hv-foot", children: [
|
|
1118
1138
|
ui.pinned ? /* @__PURE__ */ jsxs("ul", { className: "hv-legend", "aria-hidden": "true", children: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode, ComponentType, ReactElement } from 'react';
|
|
2
|
-
import { h as ResolvedArticle, L as ListItem } from './types-
|
|
2
|
+
import { h as ResolvedArticle, L as ListItem } from './types-Czt887Iv.cjs';
|
|
3
3
|
|
|
4
4
|
type CalloutKind = "note" | "tip" | "warning" | "caution";
|
|
5
5
|
interface LinkProps {
|
|
@@ -11,6 +11,9 @@ interface LinkProps {
|
|
|
11
11
|
interface ImageProps {
|
|
12
12
|
src?: string;
|
|
13
13
|
alt?: string;
|
|
14
|
+
/** Intrinsic pixel size when hyle knows it; pass both to the host image so the page reserves its box. */
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
14
17
|
[prop: string]: unknown;
|
|
15
18
|
}
|
|
16
19
|
interface CodeBlockProps {
|
|
@@ -23,7 +26,7 @@ interface CodeBlockProps {
|
|
|
23
26
|
interface MermaidProps {
|
|
24
27
|
/** The sandboxed document hyle produced for the diagram. Render it only inside an iframe with `sandbox="allow-scripts"`. */
|
|
25
28
|
srcDoc: string;
|
|
26
|
-
/** The diagram text, extracted from `srcDoc
|
|
29
|
+
/** The diagram text, extracted from `srcDoc`; undefined when it could not be extracted. */
|
|
27
30
|
source: string | undefined;
|
|
28
31
|
title: string;
|
|
29
32
|
}
|
|
@@ -155,9 +158,11 @@ interface HyleListViewProps extends PageBaseProps {
|
|
|
155
158
|
readonly headingLevel?: EmbedHeading | undefined;
|
|
156
159
|
/** Where "View all" goes (a URL in the host's space); omit to hide it. */
|
|
157
160
|
readonly moreHref?: string | undefined;
|
|
161
|
+
/** Where "Older posts" goes (built from the list's `next_cursor`); omit to hide it. */
|
|
162
|
+
readonly olderHref?: string | undefined;
|
|
158
163
|
}
|
|
159
|
-
/** Items link to `toHref(canonical_path)`: plain anchors in a flat list, newest first as hyle sent them, no grouping
|
|
160
|
-
declare function HyleListView({ items, layout, title, headingLevel, moreHref, ...base }: HyleListViewProps): ReactElement | null;
|
|
164
|
+
/** Items link to `toHref(canonical_path)`: plain anchors in a flat list, newest first as hyle sent them, no grouping. Pagination is only the optional `olderHref` link. */
|
|
165
|
+
declare function HyleListView({ items, layout, title, headingLevel, moreHref, olderHref, ...base }: HyleListViewProps): ReactElement | null;
|
|
161
166
|
interface HyleArticleViewProps extends PageBaseProps {
|
|
162
167
|
readonly article: ResolvedArticle;
|
|
163
168
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode, ComponentType, ReactElement } from 'react';
|
|
2
|
-
import { h as ResolvedArticle, L as ListItem } from './types-
|
|
2
|
+
import { h as ResolvedArticle, L as ListItem } from './types-Czt887Iv.js';
|
|
3
3
|
|
|
4
4
|
type CalloutKind = "note" | "tip" | "warning" | "caution";
|
|
5
5
|
interface LinkProps {
|
|
@@ -11,6 +11,9 @@ interface LinkProps {
|
|
|
11
11
|
interface ImageProps {
|
|
12
12
|
src?: string;
|
|
13
13
|
alt?: string;
|
|
14
|
+
/** Intrinsic pixel size when hyle knows it; pass both to the host image so the page reserves its box. */
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
14
17
|
[prop: string]: unknown;
|
|
15
18
|
}
|
|
16
19
|
interface CodeBlockProps {
|
|
@@ -23,7 +26,7 @@ interface CodeBlockProps {
|
|
|
23
26
|
interface MermaidProps {
|
|
24
27
|
/** The sandboxed document hyle produced for the diagram. Render it only inside an iframe with `sandbox="allow-scripts"`. */
|
|
25
28
|
srcDoc: string;
|
|
26
|
-
/** The diagram text, extracted from `srcDoc
|
|
29
|
+
/** The diagram text, extracted from `srcDoc`; undefined when it could not be extracted. */
|
|
27
30
|
source: string | undefined;
|
|
28
31
|
title: string;
|
|
29
32
|
}
|
|
@@ -155,9 +158,11 @@ interface HyleListViewProps extends PageBaseProps {
|
|
|
155
158
|
readonly headingLevel?: EmbedHeading | undefined;
|
|
156
159
|
/** Where "View all" goes (a URL in the host's space); omit to hide it. */
|
|
157
160
|
readonly moreHref?: string | undefined;
|
|
161
|
+
/** Where "Older posts" goes (built from the list's `next_cursor`); omit to hide it. */
|
|
162
|
+
readonly olderHref?: string | undefined;
|
|
158
163
|
}
|
|
159
|
-
/** Items link to `toHref(canonical_path)`: plain anchors in a flat list, newest first as hyle sent them, no grouping
|
|
160
|
-
declare function HyleListView({ items, layout, title, headingLevel, moreHref, ...base }: HyleListViewProps): ReactElement | null;
|
|
164
|
+
/** Items link to `toHref(canonical_path)`: plain anchors in a flat list, newest first as hyle sent them, no grouping. Pagination is only the optional `olderHref` link. */
|
|
165
|
+
declare function HyleListView({ items, layout, title, headingLevel, moreHref, olderHref, ...base }: HyleListViewProps): ReactElement | null;
|
|
161
166
|
interface HyleArticleViewProps extends PageBaseProps {
|
|
162
167
|
readonly article: ResolvedArticle;
|
|
163
168
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Resolved, M as MountsResult } from './types-
|
|
2
|
-
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-
|
|
1
|
+
import { R as Resolved, M as MountsResult } from './types-Czt887Iv.cjs';
|
|
2
|
+
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-Czt887Iv.cjs';
|
|
3
3
|
export { R as RevalidationCallbackOptions, a as RevalidationCallbackRoute, b as RevalidationPayload, c as createRevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.cjs';
|
|
4
4
|
|
|
5
5
|
/** `next` is a Next.js fetch extension with no lib.dom type; typed structurally so this module needs no Next import. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Resolved, M as MountsResult } from './types-
|
|
2
|
-
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-
|
|
1
|
+
import { R as Resolved, M as MountsResult } from './types-Czt887Iv.js';
|
|
2
|
+
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-Czt887Iv.js';
|
|
3
3
|
export { R as RevalidationCallbackOptions, a as RevalidationCallbackRoute, b as RevalidationPayload, c as createRevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.js';
|
|
4
4
|
|
|
5
5
|
/** `next` is a Next.js fetch extension with no lib.dom type; typed structurally so this module needs no Next import. */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string the diagram viewer shows. Pure data, so the client component can carry the English defaults without importing
|
|
3
|
+
* the viewer chunk, and the server passes the host's locale in (strings.ts holds fr and es, unreviewed drafts like the rest).
|
|
4
|
+
*/
|
|
5
|
+
interface ViewerLabels {
|
|
6
|
+
expand: string;
|
|
7
|
+
expandHint: string;
|
|
8
|
+
viewer: string;
|
|
9
|
+
close: string;
|
|
10
|
+
zoomIn: string;
|
|
11
|
+
zoomOut: string;
|
|
12
|
+
fit: string;
|
|
13
|
+
actual: string;
|
|
14
|
+
search: string;
|
|
15
|
+
searchPlaceholder: string;
|
|
16
|
+
noMatch: string;
|
|
17
|
+
matchOf: string;
|
|
18
|
+
copySource: string;
|
|
19
|
+
downloadSvg: string;
|
|
20
|
+
downloadPng: string;
|
|
21
|
+
copyImage: string;
|
|
22
|
+
pngScale: string;
|
|
23
|
+
fullscreen: string;
|
|
24
|
+
exitFullscreen: string;
|
|
25
|
+
copied: string;
|
|
26
|
+
saved: string;
|
|
27
|
+
unavailable: string;
|
|
28
|
+
hint: string;
|
|
29
|
+
legendSelected: string;
|
|
30
|
+
legendUpstream: string;
|
|
31
|
+
legendDownstream: string;
|
|
32
|
+
outgoing: string;
|
|
33
|
+
tracing: string;
|
|
34
|
+
map: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type { ViewerLabels as V };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string the diagram viewer shows. Pure data, so the client component can carry the English defaults without importing
|
|
3
|
+
* the viewer chunk, and the server passes the host's locale in (strings.ts holds fr and es, unreviewed drafts like the rest).
|
|
4
|
+
*/
|
|
5
|
+
interface ViewerLabels {
|
|
6
|
+
expand: string;
|
|
7
|
+
expandHint: string;
|
|
8
|
+
viewer: string;
|
|
9
|
+
close: string;
|
|
10
|
+
zoomIn: string;
|
|
11
|
+
zoomOut: string;
|
|
12
|
+
fit: string;
|
|
13
|
+
actual: string;
|
|
14
|
+
search: string;
|
|
15
|
+
searchPlaceholder: string;
|
|
16
|
+
noMatch: string;
|
|
17
|
+
matchOf: string;
|
|
18
|
+
copySource: string;
|
|
19
|
+
downloadSvg: string;
|
|
20
|
+
downloadPng: string;
|
|
21
|
+
copyImage: string;
|
|
22
|
+
pngScale: string;
|
|
23
|
+
fullscreen: string;
|
|
24
|
+
exitFullscreen: string;
|
|
25
|
+
copied: string;
|
|
26
|
+
saved: string;
|
|
27
|
+
unavailable: string;
|
|
28
|
+
hint: string;
|
|
29
|
+
legendSelected: string;
|
|
30
|
+
legendUpstream: string;
|
|
31
|
+
legendDownstream: string;
|
|
32
|
+
outgoing: string;
|
|
33
|
+
tracing: string;
|
|
34
|
+
map: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type { ViewerLabels as V };
|