@tdacorp/hyle-sdk 0.12.0 → 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 +46 -12
- package/dist/check-routes-bin.js +31 -18
- package/dist/{chunk-S7PCCEHP.js → chunk-6VOHFFA5.js} +4 -3
- package/dist/{chunk-ZQFYH4FX.js → chunk-DMK4XQLU.js} +497 -327
- package/dist/{chunk-N7ZQUAGM.js → chunk-MGSUQBDW.js} +19 -7
- 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-jCaSI31t.d.cts → embed-BmdwA2G9.d.cts} +51 -5
- package/dist/{embed-DL5QIZRJ.d.ts → embed-DNTZ2UXv.d.ts} +51 -5
- package/dist/index.cjs +19 -7
- package/dist/index.d.cts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.js +1 -1
- 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 +1235 -789
- package/dist/next.d.cts +149 -24
- package/dist/next.d.ts +149 -24
- package/dist/next.js +887 -612
- package/dist/react.cjs +336 -196
- package/dist/react.d.cts +39 -7
- package/dist/react.d.ts +39 -7
- package/dist/react.js +1 -1
- package/dist/{resolve-DvmuBlpO.d.ts → resolve-Ae7UFjsQ.d.ts} +5 -5
- package/dist/{resolve-f6IJ6SL9.d.cts → resolve-euZ4-aC9.d.cts} +5 -5
- package/dist/styles.css +11 -22
- package/dist/{types-5D6ZD0Wi.d.cts → types-Czt887Iv.d.cts} +32 -3
- package/dist/{types-5D6ZD0Wi.d.ts → types-Czt887Iv.d.ts} +32 -3
- package/dist/use-cache.cjs +1 -1
- package/dist/use-cache.d.cts +2 -2
- package/dist/use-cache.d.ts +2 -2
- package/dist/use-cache.js +2 -2
- package/package.json +1 -1
|
@@ -58,9 +58,7 @@ function Icon({ name, className }) {
|
|
|
58
58
|
|
|
59
59
|
// src/react/content.tsx
|
|
60
60
|
import { MermaidDiagram } from "./mermaid-diagram.js";
|
|
61
|
-
|
|
62
|
-
// src/react/mermaid-config.ts
|
|
63
|
-
var MAX_MERMAID_SOURCE = 2e4;
|
|
61
|
+
import { MermaidImage } from "./mermaid-image.js";
|
|
64
62
|
|
|
65
63
|
// src/react/sanitize.ts
|
|
66
64
|
var HastLimitError = class extends Error {
|
|
@@ -72,7 +70,7 @@ var HastLimitError = class extends Error {
|
|
|
72
70
|
var MAX_NODES = 2e4;
|
|
73
71
|
var MAX_TEXT = 512 * 1024;
|
|
74
72
|
var MAX_DEPTH = 128;
|
|
75
|
-
var MAX_SRCDOC =
|
|
73
|
+
var MAX_SRCDOC = 1024 * 1024;
|
|
76
74
|
var DROP = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
|
|
77
75
|
var VOID = /* @__PURE__ */ new Set(["br", "hr", "img", "input", "path"]);
|
|
78
76
|
var isString = (v) => typeof v === "string";
|
|
@@ -89,6 +87,7 @@ var classTokens = (v) => {
|
|
|
89
87
|
};
|
|
90
88
|
var isClass = (v) => classTokens(v) !== void 0;
|
|
91
89
|
var isAlign = matches(/^(left|right|center)$/);
|
|
90
|
+
var isPixels = (v) => typeof v === "number" ? Number.isInteger(v) && v > 0 : typeof v === "string" && /^[1-9]\d*$/.test(v);
|
|
92
91
|
var isLength = matches(/^[\d.]+(em|px|%)?$/);
|
|
93
92
|
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"]);
|
|
94
93
|
var STYLE_LENGTH = /^(-?\d+(?:\.\d+)?)(em|px|%)?$/;
|
|
@@ -125,10 +124,14 @@ var MERMAID_SRCDOC = new RegExp(
|
|
|
125
124
|
var isMermaidSrcdoc = (v) => typeof v === "string" && v.length <= MAX_SRCDOC && MERMAID_SRCDOC.test(v);
|
|
126
125
|
var ENTITIES = { "<": "<", "&": "&", "<": "<", ">": ">", "&": "&", """: '"', "'": "'" };
|
|
127
126
|
function mermaidSource(srcDoc) {
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
return MERMAID_SRCDOC.exec(srcDoc)?.[1]?.replace(/&(?:#x3c|#x26|#x27|lt|gt|amp|quot);/gi, (e) => ENTITIES[e.toLowerCase()]);
|
|
128
|
+
}
|
|
129
|
+
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})$/;
|
|
130
|
+
var isRenderRef = matches(RENDER_REF);
|
|
131
|
+
function diagramRender(value) {
|
|
132
|
+
const m = typeof value === "string" ? RENDER_REF.exec(value) : null;
|
|
133
|
+
return m ? { src: hostAssetSrc(m[1]), width: Number(m[2]), height: Number(m[3]) } : void 0;
|
|
130
134
|
}
|
|
131
|
-
var MERMAID_FRAME_CSP = `default-src 'none'; script-src ${MERMAID_SCRIPT_URL} 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:`;
|
|
132
135
|
var heading = { id: isIdValue, className: isClass };
|
|
133
136
|
var ATTRS = new Map(
|
|
134
137
|
Object.entries({
|
|
@@ -153,7 +156,7 @@ var ATTRS = new Map(
|
|
|
153
156
|
h5: heading,
|
|
154
157
|
h6: heading,
|
|
155
158
|
a: { href: isHref, id: isIdValue, ariaDescribedBy: isIdValue, ariaLabel: isString, dataFootnoteRef: isScalar, dataFootnoteBackref: isScalar, className: isClass },
|
|
156
|
-
img: { src: isSrc, alt: isString },
|
|
159
|
+
img: { src: isSrc, alt: isString, width: isPixels, height: isPixels },
|
|
157
160
|
table: {},
|
|
158
161
|
th: { scope: matches(/^(row|col|rowgroup|colgroup)$/), align: isAlign },
|
|
159
162
|
td: { align: isAlign },
|
|
@@ -167,7 +170,7 @@ var ATTRS = new Map(
|
|
|
167
170
|
video: { src: isSrc, controls: isScalar },
|
|
168
171
|
audio: { src: isSrc, controls: isScalar },
|
|
169
172
|
// hyle's sandboxed Mermaid frame (ADR 0001). The renderer emits `sandbox` as ["allow-scripts"]; it is normalized below.
|
|
170
|
-
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc }
|
|
173
|
+
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc, dataLight: isRenderRef, dataDark: isRenderRef }
|
|
171
174
|
})
|
|
172
175
|
);
|
|
173
176
|
var isObject = (v) => typeof v === "object" && v !== null;
|
|
@@ -541,11 +544,17 @@ var en = {
|
|
|
541
544
|
caution: "Caution",
|
|
542
545
|
diagram: "Diagram",
|
|
543
546
|
diagramError: "This diagram could not be rendered.",
|
|
547
|
+
diagramLoading: "Loading the diagram",
|
|
548
|
+
diagramSource: "Diagram source",
|
|
544
549
|
contentError: "This content cannot be displayed.",
|
|
545
550
|
fallbackTitle: "Not translated into {language} yet.",
|
|
546
551
|
fallbackBody: "You are reading the original.",
|
|
552
|
+
readingTime: "{n} min read",
|
|
553
|
+
readingTimeLabel: "Reading time",
|
|
547
554
|
older: "Older posts",
|
|
548
555
|
viewAll: "View all",
|
|
556
|
+
moreInSection: "More in this section",
|
|
557
|
+
subPages: "In this section",
|
|
549
558
|
readAtSource: "Read at source",
|
|
550
559
|
emptyTitle: "Nothing published here yet",
|
|
551
560
|
emptyBody: "Documents published to this section will appear here, newest first.",
|
|
@@ -587,11 +596,17 @@ var fr = {
|
|
|
587
596
|
caution: "Danger",
|
|
588
597
|
diagram: "Sch\xE9ma",
|
|
589
598
|
diagramError: "Ce sch\xE9ma n'a pas pu \xEAtre affich\xE9.",
|
|
599
|
+
diagramLoading: "Chargement du sch\xE9ma",
|
|
600
|
+
diagramSource: "Source du sch\xE9ma",
|
|
590
601
|
contentError: "Ce contenu ne peut pas \xEAtre affich\xE9.",
|
|
591
602
|
fallbackTitle: "Pas encore traduit en {language}.",
|
|
592
603
|
fallbackBody: "Vous lisez l'original.",
|
|
604
|
+
readingTime: "{n} min de lecture",
|
|
605
|
+
readingTimeLabel: "Temps de lecture",
|
|
593
606
|
older: "Articles plus anciens",
|
|
594
607
|
viewAll: "Tout voir",
|
|
608
|
+
moreInSection: "Plus dans cette section",
|
|
609
|
+
subPages: "Dans cette section",
|
|
595
610
|
readAtSource: "Lire \xE0 la source",
|
|
596
611
|
emptyTitle: "Rien n'est encore publi\xE9 ici",
|
|
597
612
|
emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
|
|
@@ -633,11 +648,17 @@ var es = {
|
|
|
633
648
|
caution: "Peligro",
|
|
634
649
|
diagram: "Diagrama",
|
|
635
650
|
diagramError: "No se pudo mostrar este diagrama.",
|
|
651
|
+
diagramLoading: "Cargando el diagrama",
|
|
652
|
+
diagramSource: "C\xF3digo del diagrama",
|
|
636
653
|
contentError: "No se puede mostrar este contenido.",
|
|
637
654
|
fallbackTitle: "A\xFAn no est\xE1 traducida al {language}.",
|
|
638
655
|
fallbackBody: "Est\xE1s leyendo el original.",
|
|
656
|
+
readingTime: "{n} min de lectura",
|
|
657
|
+
readingTimeLabel: "Tiempo de lectura",
|
|
639
658
|
older: "Entradas anteriores",
|
|
640
659
|
viewAll: "Ver todo",
|
|
660
|
+
moreInSection: "M\xE1s en esta secci\xF3n",
|
|
661
|
+
subPages: "En esta secci\xF3n",
|
|
641
662
|
readAtSource: "Leer en la fuente",
|
|
642
663
|
emptyTitle: "A\xFAn no hay nada publicado aqu\xED",
|
|
643
664
|
emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
|
|
@@ -700,7 +721,12 @@ function buildComponents(c, s) {
|
|
|
700
721
|
}
|
|
701
722
|
return /* @__PURE__ */ jsx3("a", { href: url, rel: "noopener noreferrer", ...rest, children });
|
|
702
723
|
};
|
|
703
|
-
|
|
724
|
+
let images = 0;
|
|
725
|
+
const Image = (props) => {
|
|
726
|
+
if (typeof props.src !== "string") return null;
|
|
727
|
+
const first = images++ === 0;
|
|
728
|
+
return /* @__PURE__ */ jsx3(Img, { loading: first ? "eager" : "lazy", ...first ? { fetchPriority: "high" } : {}, decoding: "async", ...props });
|
|
729
|
+
};
|
|
704
730
|
const Pre = ({ children, ...rest }) => {
|
|
705
731
|
const code = Children.toArray(children).find(isValidElement);
|
|
706
732
|
const language = /(?:^|\s)language-([\w-]+)/.exec(code?.props.className ?? "")?.[1];
|
|
@@ -724,12 +750,18 @@ function buildComponents(c, s) {
|
|
|
724
750
|
] })
|
|
725
751
|
] });
|
|
726
752
|
};
|
|
727
|
-
const Frame = (
|
|
753
|
+
const Frame = (props) => {
|
|
754
|
+
const { srcDoc } = props;
|
|
728
755
|
if (typeof srcDoc !== "string") return null;
|
|
729
756
|
const source = mermaidSource(srcDoc);
|
|
730
757
|
if (c.Mermaid) return /* @__PURE__ */ jsx3(c.Mermaid, { srcDoc, source, title: s.diagram });
|
|
731
|
-
if (source
|
|
732
|
-
|
|
758
|
+
if (source === void 0) return null;
|
|
759
|
+
const light = diagramRender(props["data-light"]);
|
|
760
|
+
const dark = diagramRender(props["data-dark"]);
|
|
761
|
+
if (light && dark) {
|
|
762
|
+
return /* @__PURE__ */ jsx3(MermaidImage, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, sourceLabel: s.diagramSource, light, dark, labels: s.viewer });
|
|
763
|
+
}
|
|
764
|
+
return /* @__PURE__ */ jsx3(MermaidDiagram, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, labels: s.viewer });
|
|
733
765
|
};
|
|
734
766
|
const Heading = (level) => function HyleHeading({ id, children, ...rest }) {
|
|
735
767
|
const Tag = `h${level}`;
|
|
@@ -773,261 +805,6 @@ import { MermaidDiagram as MermaidDiagram2 } from "./mermaid-diagram.js";
|
|
|
773
805
|
|
|
774
806
|
// src/react/pages.tsx
|
|
775
807
|
import { Comments } from "./comments.js";
|
|
776
|
-
import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
777
|
-
function Slot({ name, slots, tag: Tag = "div", className }) {
|
|
778
|
-
const fill = slots?.[name];
|
|
779
|
-
return fill ? /* @__PURE__ */ jsx4(Tag, { "data-slot": name, className, children: fill }) : null;
|
|
780
|
-
}
|
|
781
|
-
function Shell({ children }) {
|
|
782
|
-
return /* @__PURE__ */ jsx4("div", { className: "hyle", children: /* @__PURE__ */ jsx4("div", { className: "hyle-page", children }) });
|
|
783
|
-
}
|
|
784
|
-
function ctx(p, fallbackLocale) {
|
|
785
|
-
const locale = p.locale ?? fallbackLocale;
|
|
786
|
-
return { s: stringsFor(locale), locale, href: (path, linkLocale) => p.toHref ? p.toHref(path, linkLocale ?? locale) : path, Link: p.components?.Link ?? "a" };
|
|
787
|
-
}
|
|
788
|
-
function Pager({ prev, next, c }) {
|
|
789
|
-
if (!prev && !next) return null;
|
|
790
|
-
const { Link, s } = c;
|
|
791
|
-
return /* @__PURE__ */ jsxs4("nav", { className: "hyle-pager", "aria-label": s.pager, children: [
|
|
792
|
-
prev ? /* @__PURE__ */ jsxs4(Link, { href: c.href(prev.canonical_path), rel: "prev", children: [
|
|
793
|
-
/* @__PURE__ */ jsxs4("span", { className: "dir", children: [
|
|
794
|
-
/* @__PURE__ */ jsx4(Icon, { name: "chev-left" }),
|
|
795
|
-
s.prev
|
|
796
|
-
] }),
|
|
797
|
-
/* @__PURE__ */ jsx4("span", { className: "ttl", children: prev.title })
|
|
798
|
-
] }) : /* @__PURE__ */ jsx4("span", { className: "none", "aria-hidden": "true" }),
|
|
799
|
-
next ? /* @__PURE__ */ jsxs4(Link, { href: c.href(next.canonical_path), rel: "next", className: "next", children: [
|
|
800
|
-
/* @__PURE__ */ jsxs4("span", { className: "dir", children: [
|
|
801
|
-
s.next,
|
|
802
|
-
/* @__PURE__ */ jsx4(Icon, { name: "chev" })
|
|
803
|
-
] }),
|
|
804
|
-
/* @__PURE__ */ jsx4("span", { className: "ttl", children: next.title })
|
|
805
|
-
] }) : null
|
|
806
|
-
] });
|
|
807
|
-
}
|
|
808
|
-
function TocList({ toc }) {
|
|
809
|
-
const groups = [];
|
|
810
|
-
for (const entry of toc) {
|
|
811
|
-
const last = groups.at(-1);
|
|
812
|
-
if (entry.depth === 3 && last) last.subs.push(entry);
|
|
813
|
-
else groups.push({ entry, subs: [] });
|
|
814
|
-
}
|
|
815
|
-
return /* @__PURE__ */ jsx4("ul", { children: groups.map(({ entry, subs }) => /* @__PURE__ */ jsxs4("li", { children: [
|
|
816
|
-
/* @__PURE__ */ jsx4("a", { href: `#${scopeId(entry.id)}`, children: entry.text }),
|
|
817
|
-
subs.length > 0 ? /* @__PURE__ */ jsx4("ul", { children: subs.map((sub) => /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsx4("a", { href: `#${scopeId(sub.id)}`, children: sub.text }) }, sub.id)) }) : null
|
|
818
|
-
] }, entry.id)) });
|
|
819
|
-
}
|
|
820
|
-
function Toc({ toc, c, aside }) {
|
|
821
|
-
const entries = toc.filter((t) => t.depth === 2 || t.depth === 3);
|
|
822
|
-
if (entries.length === 0 && !aside) return { narrow: null, wide: null };
|
|
823
|
-
const { s } = c;
|
|
824
|
-
return {
|
|
825
|
-
narrow: entries.length === 0 ? null : /* @__PURE__ */ jsxs4("details", { className: "hyle-toc-m", children: [
|
|
826
|
-
/* @__PURE__ */ jsxs4("summary", { children: [
|
|
827
|
-
/* @__PURE__ */ jsx4(Icon, { name: "file" }),
|
|
828
|
-
s.toc,
|
|
829
|
-
/* @__PURE__ */ jsx4(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
830
|
-
] }),
|
|
831
|
-
/* @__PURE__ */ jsx4("nav", { className: "hyle-toc-list", "aria-label": s.toc, children: /* @__PURE__ */ jsx4(TocList, { toc: entries }) })
|
|
832
|
-
] }),
|
|
833
|
-
wide: /* @__PURE__ */ jsxs4("aside", { className: "hyle-toc-d", "aria-label": s.toc, children: [
|
|
834
|
-
entries.length === 0 ? null : /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
835
|
-
/* @__PURE__ */ jsx4("p", { className: "hyle-toc-title", children: s.toc }),
|
|
836
|
-
/* @__PURE__ */ jsx4("nav", { className: "hyle-toc-list", children: /* @__PURE__ */ jsx4(TocList, { toc: entries }) })
|
|
837
|
-
] }),
|
|
838
|
-
aside
|
|
839
|
-
] })
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
function Body({ article, components, locale }) {
|
|
843
|
-
const { content, publication } = article;
|
|
844
|
-
return /* @__PURE__ */ jsx4("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ jsx4(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : /* @__PURE__ */ jsx4(TrustedServerHtml, { html: content.html }) });
|
|
845
|
-
}
|
|
846
|
-
function Languages({ alternates, current, c }) {
|
|
847
|
-
if (alternates.length < 2) return null;
|
|
848
|
-
const { Link, s } = c;
|
|
849
|
-
return /* @__PURE__ */ jsxs4("nav", { className: "hyle-langs", "aria-label": s.languages, children: [
|
|
850
|
-
/* @__PURE__ */ jsx4("span", { children: s.readIn }),
|
|
851
|
-
/* @__PURE__ */ jsx4("ul", { children: alternates.map((a) => {
|
|
852
|
-
const label = languageName(a.locale, a.locale);
|
|
853
|
-
return /* @__PURE__ */ jsx4("li", { children: a.locale === current ? /* @__PURE__ */ jsx4("a", { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, "aria-current": "true", children: label }) : /* @__PURE__ */ jsx4(Link, { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, children: label }) }, a.locale);
|
|
854
|
-
}) })
|
|
855
|
-
] });
|
|
856
|
-
}
|
|
857
|
-
var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
|
|
858
|
-
function articleJsonLd(article, origin, c, author) {
|
|
859
|
-
const { publication: pub } = article;
|
|
860
|
-
const url = (path) => origin + encodeURI(c.href(path, pub.locale));
|
|
861
|
-
const graph = {
|
|
862
|
-
"@context": "https://schema.org",
|
|
863
|
-
"@graph": [
|
|
864
|
-
{
|
|
865
|
-
"@type": "BlogPosting",
|
|
866
|
-
headline: pub.title,
|
|
867
|
-
...pub.description ? { description: pub.description } : {},
|
|
868
|
-
datePublished: pub.published_at,
|
|
869
|
-
// a save before the publish leaves updated_at earlier than published_at; dateModified before datePublished is invalid
|
|
870
|
-
...pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? { dateModified: pub.updated_at } : {},
|
|
871
|
-
...author ? { author: { "@type": "Person", name: author } } : {},
|
|
872
|
-
inLanguage: pub.locale,
|
|
873
|
-
mainEntityOfPage: url(pub.canonical_path)
|
|
874
|
-
},
|
|
875
|
-
{
|
|
876
|
-
"@type": "BreadcrumbList",
|
|
877
|
-
itemListElement: article.breadcrumbs.map((b, i) => ({ "@type": "ListItem", position: i + 1, name: b.title, item: url(b.canonical_path) }))
|
|
878
|
-
}
|
|
879
|
-
]
|
|
880
|
-
};
|
|
881
|
-
return JSON.stringify(graph).replace(/</g, "\\u003c");
|
|
882
|
-
}
|
|
883
|
-
function ArticlePage({ article, engagement, origin, ...base }) {
|
|
884
|
-
const { publication: pub } = article;
|
|
885
|
-
const c = ctx(base, pub.locale);
|
|
886
|
-
const { s } = c;
|
|
887
|
-
const author = typeof article.frontmatter.author === "string" ? article.frontmatter.author : void 0;
|
|
888
|
-
const toc = Toc({ toc: article.toc, c, aside: /* @__PURE__ */ jsx4(Slot, { name: "article.aside", slots: base.slots, className: "hyle-slot-wrap" }) });
|
|
889
|
-
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
890
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("article", { className: "hyle-article", "data-hyle-page": "article", lang: c.locale, children: [
|
|
891
|
-
/* @__PURE__ */ jsxs4("header", { className: "hyle-head", children: [
|
|
892
|
-
/* @__PURE__ */ jsx4(Slot, { name: "article.before", slots: base.slots, className: "hyle-eyebrow" }),
|
|
893
|
-
/* @__PURE__ */ jsx4("h1", { className: "hyle-title", children: pub.title }),
|
|
894
|
-
pub.description ? /* @__PURE__ */ jsx4("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
895
|
-
/* @__PURE__ */ jsxs4("div", { className: "hyle-meta", children: [
|
|
896
|
-
author ? /* @__PURE__ */ jsxs4("span", { children: [
|
|
897
|
-
/* @__PURE__ */ jsx4("span", { className: "hyle-avatar", "aria-hidden": "true", children: author.slice(0, 2).toUpperCase() }),
|
|
898
|
-
/* @__PURE__ */ jsxs4("span", { children: [
|
|
899
|
-
/* @__PURE__ */ jsxs4("span", { className: "hyle-sr", children: [
|
|
900
|
-
s.by,
|
|
901
|
-
" "
|
|
902
|
-
] }),
|
|
903
|
-
/* @__PURE__ */ jsx4("span", { className: "by", children: author })
|
|
904
|
-
] })
|
|
905
|
-
] }) : null,
|
|
906
|
-
/* @__PURE__ */ jsxs4("span", { children: [
|
|
907
|
-
/* @__PURE__ */ jsx4(Icon, { name: "calendar" }),
|
|
908
|
-
/* @__PURE__ */ jsx4("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) })
|
|
909
|
-
] }),
|
|
910
|
-
/* @__PURE__ */ jsxs4("span", { children: [
|
|
911
|
-
/* @__PURE__ */ jsx4(Icon, { name: "globe" }),
|
|
912
|
-
/* @__PURE__ */ jsx4("span", { lang: pub.locale, children: languageName(pub.locale, c.locale) })
|
|
913
|
-
] }),
|
|
914
|
-
/* @__PURE__ */ jsx4(Slot, { name: "article.meta", slots: base.slots, tag: "span" })
|
|
915
|
-
] }),
|
|
916
|
-
/* @__PURE__ */ jsx4(Languages, { alternates: article.alternates, current: pub.locale, c }),
|
|
917
|
-
notTranslated ? /* @__PURE__ */ jsxs4("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
918
|
-
/* @__PURE__ */ jsx4(Icon, { name: "alert" }),
|
|
919
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
920
|
-
/* @__PURE__ */ jsx4("b", { children: notTranslated }),
|
|
921
|
-
" ",
|
|
922
|
-
s.fallbackBody
|
|
923
|
-
] })
|
|
924
|
-
] }) : null
|
|
925
|
-
] }),
|
|
926
|
-
toc.narrow,
|
|
927
|
-
/* @__PURE__ */ jsx4(Body, { article, components: base.components, locale: c.locale }),
|
|
928
|
-
engagement ? /* @__PURE__ */ jsx4(Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
|
|
929
|
-
/* @__PURE__ */ jsx4(Pager, { prev: article.prev, next: article.next, c }),
|
|
930
|
-
/* @__PURE__ */ jsx4(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
|
|
931
|
-
toc.wide,
|
|
932
|
-
origin && BARE_HTTPS_ORIGIN.test(origin) ? /* @__PURE__ */ jsx4("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: articleJsonLd(article, origin, c, author) } }) : null
|
|
933
|
-
] }) });
|
|
934
|
-
}
|
|
935
|
-
function ListPage({ list, olderHref, description, ...base }) {
|
|
936
|
-
const c = ctx(base, "en");
|
|
937
|
-
const { s, Link } = c;
|
|
938
|
-
const Row = base.slots?.["list.item"];
|
|
939
|
-
const groups = /* @__PURE__ */ new Map();
|
|
940
|
-
for (const item of list.items) groups.set(item.published_at.slice(0, 7), [...groups.get(item.published_at.slice(0, 7)) ?? [], item]);
|
|
941
|
-
const notTranslated = list.fallback ? s.fallbackTitle.replace("{language}", languageName(list.fallback.requested_locale, c.locale)) : void 0;
|
|
942
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("div", { className: "hyle-listpage", "data-hyle-page": "list", lang: c.locale, children: [
|
|
943
|
-
/* @__PURE__ */ jsxs4("header", { className: "hyle-head", children: [
|
|
944
|
-
/* @__PURE__ */ jsx4("h1", { className: "hyle-title", children: list.section.title }),
|
|
945
|
-
description ? /* @__PURE__ */ jsx4("p", { className: "hyle-desc", children: description }) : null,
|
|
946
|
-
/* @__PURE__ */ jsx4(Slot, { name: "list.header", slots: base.slots, className: "hyle-slot-wrap" }),
|
|
947
|
-
notTranslated ? /* @__PURE__ */ jsxs4("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
948
|
-
/* @__PURE__ */ jsx4(Icon, { name: "alert" }),
|
|
949
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
950
|
-
/* @__PURE__ */ jsx4("b", { children: notTranslated }),
|
|
951
|
-
" ",
|
|
952
|
-
s.fallbackBody
|
|
953
|
-
] })
|
|
954
|
-
] }) : null
|
|
955
|
-
] }),
|
|
956
|
-
list.items.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "hyle-empty", "data-slot-state": "empty", children: [
|
|
957
|
-
/* @__PURE__ */ jsx4(Icon, { name: "file" }),
|
|
958
|
-
/* @__PURE__ */ jsx4("h2", { children: s.emptyTitle }),
|
|
959
|
-
/* @__PURE__ */ jsx4("p", { children: s.emptyBody }),
|
|
960
|
-
/* @__PURE__ */ jsx4(Slot, { name: "list.empty", slots: base.slots })
|
|
961
|
-
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ jsxs4("section", { "aria-label": formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }), children: [
|
|
962
|
-
/* @__PURE__ */ jsx4("h2", { className: "hyle-year", children: formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }) }),
|
|
963
|
-
/* @__PURE__ */ jsx4("ul", { className: "hyle-items", children: items.map((item) => /* @__PURE__ */ jsx4("li", { children: Row ? /* @__PURE__ */ jsx4(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs4(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
964
|
-
/* @__PURE__ */ jsx4("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
965
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
966
|
-
/* @__PURE__ */ jsx4("span", { className: "t", children: item.title }),
|
|
967
|
-
item.description ? /* @__PURE__ */ jsx4("p", { children: item.description }) : null
|
|
968
|
-
] })
|
|
969
|
-
] }) }, item.canonical_path)) })
|
|
970
|
-
] }, month)),
|
|
971
|
-
olderHref ? /* @__PURE__ */ jsxs4("nav", { className: "hyle-pagination", "aria-label": s.pager, children: [
|
|
972
|
-
/* @__PURE__ */ jsx4("span", { className: "sp" }),
|
|
973
|
-
/* @__PURE__ */ jsxs4(Link, { className: "hyle-btn sm", href: olderHref, rel: "next", children: [
|
|
974
|
-
s.older,
|
|
975
|
-
/* @__PURE__ */ jsx4(Icon, { name: "chev" })
|
|
976
|
-
] })
|
|
977
|
-
] }) : null
|
|
978
|
-
] }) });
|
|
979
|
-
}
|
|
980
|
-
function NotFound({ path, homeHref = "/", ...base }) {
|
|
981
|
-
const c = ctx(base, "en");
|
|
982
|
-
const { Link, s } = c;
|
|
983
|
-
const body = base.slots?.["notfound.body"];
|
|
984
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("section", { className: "hyle-state", "data-hyle-page": "not-found", lang: c.locale, children: [
|
|
985
|
-
/* @__PURE__ */ jsx4("span", { className: "kind", children: s.nfKind }),
|
|
986
|
-
/* @__PURE__ */ jsx4("h1", { children: s.nfTitle }),
|
|
987
|
-
body ? /* @__PURE__ */ jsx4("div", { "data-slot": "notfound.body", children: body }) : /* @__PURE__ */ jsx4("p", { children: s.nfBody }),
|
|
988
|
-
path ? /* @__PURE__ */ jsx4("dl", { className: "hyle-addr", children: /* @__PURE__ */ jsxs4("div", { children: [
|
|
989
|
-
/* @__PURE__ */ jsx4("dt", { children: s.path }),
|
|
990
|
-
/* @__PURE__ */ jsx4("dd", { children: path })
|
|
991
|
-
] }) }) : null,
|
|
992
|
-
/* @__PURE__ */ jsxs4("div", { className: "hyle-actions", children: [
|
|
993
|
-
/* @__PURE__ */ jsx4(Link, { className: "hyle-btn primary", href: c.href(homeHref), children: s.home }),
|
|
994
|
-
/* @__PURE__ */ jsx4(Slot, { name: "notfound.actions", slots: base.slots, tag: "span" })
|
|
995
|
-
] })
|
|
996
|
-
] }) });
|
|
997
|
-
}
|
|
998
|
-
function Unavailable(base) {
|
|
999
|
-
const c = ctx(base, "en");
|
|
1000
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("section", { className: "hyle-state", "data-hyle-page": "unavailable", lang: c.locale, role: "status", children: [
|
|
1001
|
-
/* @__PURE__ */ jsx4("span", { className: "kind", children: c.s.unKind }),
|
|
1002
|
-
/* @__PURE__ */ jsx4("h1", { children: c.s.unTitle }),
|
|
1003
|
-
/* @__PURE__ */ jsx4("p", { children: c.s.unBody })
|
|
1004
|
-
] }) });
|
|
1005
|
-
}
|
|
1006
|
-
function Redirecting({ from, to, ...base }) {
|
|
1007
|
-
const c = ctx(base, "en");
|
|
1008
|
-
const { Link, s } = c;
|
|
1009
|
-
const extra = base.slots?.["redirecting.body"];
|
|
1010
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("section", { className: "hyle-state", "data-hyle-page": "redirecting", role: "status", lang: c.locale, children: [
|
|
1011
|
-
/* @__PURE__ */ jsx4("span", { className: "kind", children: s.rdKind }),
|
|
1012
|
-
/* @__PURE__ */ jsx4("h1", { children: s.rdTitle }),
|
|
1013
|
-
/* @__PURE__ */ jsx4("p", { children: s.rdBody }),
|
|
1014
|
-
/* @__PURE__ */ jsxs4("dl", { className: "hyle-addr", children: [
|
|
1015
|
-
from ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1016
|
-
/* @__PURE__ */ jsx4("dt", { children: s.from }),
|
|
1017
|
-
/* @__PURE__ */ jsx4("dd", { children: from })
|
|
1018
|
-
] }) : null,
|
|
1019
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1020
|
-
/* @__PURE__ */ jsx4("dt", { children: s.to }),
|
|
1021
|
-
/* @__PURE__ */ jsx4("dd", { children: to })
|
|
1022
|
-
] })
|
|
1023
|
-
] }),
|
|
1024
|
-
/* @__PURE__ */ jsx4("p", { className: "fine", children: /* @__PURE__ */ jsx4(Link, { href: c.href(to), children: s.rdFallback }) }),
|
|
1025
|
-
extra ? /* @__PURE__ */ jsx4("p", { "data-slot": "redirecting.body", className: "fine", children: extra }) : null
|
|
1026
|
-
] }) });
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
// src/react/index.ts
|
|
1030
|
-
import { Comments as Comments2 } from "./comments.js";
|
|
1031
808
|
|
|
1032
809
|
// src/react/comments-api.ts
|
|
1033
810
|
var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -1132,9 +909,9 @@ function buildThread(listing, localHeld) {
|
|
|
1132
909
|
|
|
1133
910
|
// src/react/comments-body.tsx
|
|
1134
911
|
import { toJsxRuntime as toJsxRuntime2 } from "hast-util-to-jsx-runtime";
|
|
1135
|
-
import { Fragment as
|
|
1136
|
-
import { jsx as
|
|
1137
|
-
import { jsx as
|
|
912
|
+
import { Fragment as Fragment4 } from "react";
|
|
913
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
914
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1138
915
|
var ALLOWED = /* @__PURE__ */ new Set(["p", "a", "em", "strong", "del", "code", "pre", "blockquote", "ul", "ol", "li", "br"]);
|
|
1139
916
|
var LINK_REL = "nofollow ugc noopener noreferrer";
|
|
1140
917
|
function narrow(node) {
|
|
@@ -1157,44 +934,45 @@ function CommentBody({ tree }) {
|
|
|
1157
934
|
if (error instanceof HastLimitError) return null;
|
|
1158
935
|
throw error;
|
|
1159
936
|
}
|
|
1160
|
-
return /* @__PURE__ */
|
|
937
|
+
return /* @__PURE__ */ jsx5("div", { className: "hyle-cm-body", children: toJsxRuntime2({ type: "root", children }, { Fragment: Fragment4, jsx: jsx4, jsxs: jsxs4, elementAttributeNameCase: "react", stylePropertyNameCase: "dom" }) });
|
|
1161
938
|
}
|
|
1162
939
|
|
|
1163
940
|
// src/react/embed.tsx
|
|
1164
|
-
import { Fragment as
|
|
1165
|
-
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, ...base }) {
|
|
941
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
942
|
+
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, olderHref, ...base }) {
|
|
1166
943
|
const c = ctx(base, "en");
|
|
1167
944
|
const { s, Link } = c;
|
|
1168
945
|
const Row = base.slots?.["list.item"];
|
|
1169
946
|
const Heading = `h${headingLevel}`;
|
|
1170
947
|
const safe = items.filter((item) => item.canonical_path.startsWith("/"));
|
|
1171
|
-
if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */
|
|
1172
|
-
return /* @__PURE__ */
|
|
1173
|
-
title ? /* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
item.description ? /* @__PURE__ */
|
|
948
|
+
if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", "data-layout": layout, children: /* @__PURE__ */ jsx6(Slot, { name: "list.empty", slots: base.slots }) }) : null;
|
|
949
|
+
return /* @__PURE__ */ jsxs5("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
|
|
950
|
+
title ? /* @__PURE__ */ jsx6(Heading, { className: "hyle-title", children: title }) : null,
|
|
951
|
+
/* @__PURE__ */ jsx6("ul", { className: "hyle-items", children: safe.map((item) => /* @__PURE__ */ jsx6("li", { children: Row ? /* @__PURE__ */ jsx6(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs5(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
952
|
+
item.published_at ? /* @__PURE__ */ jsx6("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }) : null,
|
|
953
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
954
|
+
/* @__PURE__ */ jsx6("span", { className: "t", children: item.title }),
|
|
955
|
+
item.description ? /* @__PURE__ */ jsx6("p", { children: item.description }) : null
|
|
1179
956
|
] })
|
|
1180
957
|
] }) }, item.canonical_path)) }),
|
|
1181
|
-
|
|
958
|
+
olderHref ? /* @__PURE__ */ jsx6(OlderNav, { href: olderHref, c }) : null,
|
|
959
|
+
moreHref ? /* @__PURE__ */ jsx6("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
|
|
1182
960
|
] });
|
|
1183
961
|
}
|
|
1184
962
|
function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
1185
963
|
const { publication: pub } = article;
|
|
1186
964
|
const c = ctx(base, pub.locale);
|
|
1187
965
|
const Heading = `h${headingLevel}`;
|
|
1188
|
-
return /* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
pub.description ? /* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs5("article", { lang: c.locale, children: [
|
|
967
|
+
/* @__PURE__ */ jsxs5("header", { className: "hyle-head", children: [
|
|
968
|
+
/* @__PURE__ */ jsx6(Heading, { className: "hyle-title", children: pub.title }),
|
|
969
|
+
pub.description ? /* @__PURE__ */ jsx6("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
970
|
+
/* @__PURE__ */ jsx6("div", { className: "hyle-meta", children: /* @__PURE__ */ jsx6("span", { children: /* @__PURE__ */ jsx6("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) }) }) })
|
|
1193
971
|
] }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
pub.canonical_path.startsWith("/") ? /* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ jsx6(Body, { article, components: base.components, locale: c.locale }),
|
|
973
|
+
pub.canonical_path.startsWith("/") ? /* @__PURE__ */ jsxs5("a", { className: "hyle-more", href: c.href(pub.canonical_path, pub.locale), rel: "bookmark", children: [
|
|
1196
974
|
c.s.readAtSource,
|
|
1197
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ jsxs5("span", { className: "hyle-sr", children: [
|
|
1198
976
|
": ",
|
|
1199
977
|
pub.title
|
|
1200
978
|
] })
|
|
@@ -1203,35 +981,35 @@ function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
|
1203
981
|
}
|
|
1204
982
|
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((w) => [...w][0] ?? "").join("").toUpperCase() || "?";
|
|
1205
983
|
function StaticThread({ nodes, locale, s, level = 1 }) {
|
|
1206
|
-
return /* @__PURE__ */
|
|
1207
|
-
const kids = node.kids.length > 0 && level < 32 ? /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ jsx6("ol", { className: "hyle-cm-list", role: "list", children: nodes.map((node) => {
|
|
985
|
+
const kids = node.kids.length > 0 && level < 32 ? /* @__PURE__ */ jsx6(StaticThread, { nodes: node.kids, locale, s, level: level + 1 }) : null;
|
|
1208
986
|
if (node.status === "removed") {
|
|
1209
987
|
const why = node.removedBy === "moderator" ? s.removedByModerator : node.removedBy === "author" ? s.removedByAuthor : s.removed;
|
|
1210
|
-
return /* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsxs5("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "removed", "data-removed-by": node.removedBy, children: [
|
|
989
|
+
/* @__PURE__ */ jsxs5("article", { "aria-label": why, children: [
|
|
990
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(Icon, { name: "ban" }) }),
|
|
991
|
+
/* @__PURE__ */ jsx6("div", { className: "hyle-cm-main", children: /* @__PURE__ */ jsx6("div", { className: "hyle-cm-body", children: /* @__PURE__ */ jsx6("p", { children: why }) }) })
|
|
1214
992
|
] }),
|
|
1215
993
|
kids
|
|
1216
994
|
] }, node.id);
|
|
1217
995
|
}
|
|
1218
|
-
return /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
node.editedAt ? /* @__PURE__ */
|
|
996
|
+
return /* @__PURE__ */ jsxs5("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "visible", children: [
|
|
997
|
+
/* @__PURE__ */ jsxs5("article", { children: [
|
|
998
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-avatar", "aria-hidden": "true", children: initials(node.name ?? "") }),
|
|
999
|
+
/* @__PURE__ */ jsxs5("div", { className: "hyle-cm-main", children: [
|
|
1000
|
+
/* @__PURE__ */ jsxs5("div", { className: "hyle-cm-by", children: [
|
|
1001
|
+
/* @__PURE__ */ jsx6("b", { children: node.name }),
|
|
1002
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1003
|
+
/* @__PURE__ */ jsx6("time", { dateTime: node.createdAt, title: node.createdAt, children: formatDate(node.createdAt, locale) }),
|
|
1004
|
+
node.editedAt ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1227
1005
|
" ",
|
|
1228
|
-
/* @__PURE__ */
|
|
1006
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
1229
1007
|
" ",
|
|
1230
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ jsx6("span", { children: s.edited })
|
|
1231
1009
|
] }) : null
|
|
1232
1010
|
] })
|
|
1233
1011
|
] }),
|
|
1234
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ jsx6(CommentBody, { tree: node.tree })
|
|
1235
1013
|
] })
|
|
1236
1014
|
] }),
|
|
1237
1015
|
kids
|
|
@@ -1242,31 +1020,415 @@ function HyleCommentsView({ listing, locale }) {
|
|
|
1242
1020
|
const thread = buildThread(listing, []);
|
|
1243
1021
|
if (thread.length === 0) return null;
|
|
1244
1022
|
const s = stringsFor(locale).comments;
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs5("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", lang: locale, children: [
|
|
1024
|
+
/* @__PURE__ */ jsx6("div", { className: "hyle-cm-head", children: /* @__PURE__ */ jsxs5("h2", { children: [
|
|
1247
1025
|
s.heading,
|
|
1248
1026
|
" ",
|
|
1249
|
-
/* @__PURE__ */
|
|
1027
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-cm-count", "aria-label": s.countLabel.replace("{n}", String(listing.comment_count)), children: listing.comment_count })
|
|
1250
1028
|
] }) }),
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
listing.truncated ? /* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ jsx6(StaticThread, { nodes: thread, locale, s }),
|
|
1030
|
+
listing.truncated ? /* @__PURE__ */ jsx6("p", { className: "hyle-cm-note", children: s.truncated }) : null
|
|
1253
1031
|
] }) });
|
|
1254
1032
|
}
|
|
1255
1033
|
function HyleCommentsFallback({ locale }) {
|
|
1256
1034
|
const s = stringsFor(locale).comments;
|
|
1257
|
-
return /* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
/* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
/* @__PURE__ */
|
|
1263
|
-
/* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1035
|
+
return /* @__PURE__ */ jsx6("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsx6("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", children: /* @__PURE__ */ jsxs5("div", { role: "status", "aria-live": "polite", "aria-busy": "true", children: [
|
|
1036
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-sr", children: s.loading }),
|
|
1037
|
+
/* @__PURE__ */ jsx6("div", { "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs5("div", { className: "hyle-cm-sk", children: [
|
|
1038
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-sk c" }),
|
|
1039
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1040
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: 120 } }),
|
|
1041
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: "100%" } }),
|
|
1042
|
+
/* @__PURE__ */ jsx6("span", { className: "hyle-sk l", style: { width: "72%" } })
|
|
1265
1043
|
] })
|
|
1266
1044
|
] }, i)) })
|
|
1267
1045
|
] }) }) });
|
|
1268
1046
|
}
|
|
1269
1047
|
|
|
1048
|
+
// src/react/seo.ts
|
|
1049
|
+
var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
|
|
1050
|
+
var bareOrigin = (origin) => origin && BARE_HTTPS_ORIGIN.test(origin) ? origin : void 0;
|
|
1051
|
+
var absoluteUrl = (origin, href) => origin + encodeURI(href);
|
|
1052
|
+
var modifiedAt = (pub) => pub.updated_at && Date.parse(pub.updated_at) > Date.parse(pub.published_at) ? pub.updated_at : void 0;
|
|
1053
|
+
var wordCountOf = (pub) => Number.isInteger(pub.word_count) && pub.word_count > 0 ? pub.word_count : void 0;
|
|
1054
|
+
var WORDS_PER_MINUTE = 275;
|
|
1055
|
+
var readingMinutes = (wordCount) => Math.max(1, Math.ceil(wordCount / WORDS_PER_MINUTE));
|
|
1056
|
+
var breadcrumbItems = (article, jsonLd) => [
|
|
1057
|
+
...jsonLd?.breadcrumbRoot ? [{ title: jsonLd.breadcrumbRoot.name, canonical_path: "/" }] : [],
|
|
1058
|
+
...article.breadcrumbs
|
|
1059
|
+
];
|
|
1060
|
+
var crumbHref = (href, path, locale) => path === "/" ? href("/", locale).replace(/(.)\/$/, "$1") : href(path, locale);
|
|
1061
|
+
function articleAuthor(article, jsonLd) {
|
|
1062
|
+
const authored = article.publication.author;
|
|
1063
|
+
if (authored?.name) return { name: authored.name, ...authored.url ? { url: authored.url } : {} };
|
|
1064
|
+
const given = jsonLd?.author?.(article);
|
|
1065
|
+
if (given && typeof given.name === "string" && given.name) return given;
|
|
1066
|
+
const fromFrontmatter = article.frontmatter.author;
|
|
1067
|
+
return typeof fromFrontmatter === "string" && fromFrontmatter ? { name: fromFrontmatter } : void 0;
|
|
1068
|
+
}
|
|
1069
|
+
var UNSAFE_URL = /[\u0000- \u007f\\]/;
|
|
1070
|
+
var positive = (n) => typeof n === "number" && Number.isInteger(n) && n > 0 ? n : void 0;
|
|
1071
|
+
function validOgImage(image, origin) {
|
|
1072
|
+
if (!image || typeof image.url !== "string" || UNSAFE_URL.test(image.url)) return void 0;
|
|
1073
|
+
const relative = image.url.startsWith("/") && !image.url.startsWith("//");
|
|
1074
|
+
const url = relative ? origin ? origin + image.url : void 0 : image.url;
|
|
1075
|
+
if (!url) return void 0;
|
|
1076
|
+
try {
|
|
1077
|
+
const parsed = new URL(url);
|
|
1078
|
+
if (parsed.protocol !== "https:" || relative && parsed.origin !== origin) return void 0;
|
|
1079
|
+
} catch {
|
|
1080
|
+
return void 0;
|
|
1081
|
+
}
|
|
1082
|
+
const width = positive(image.width);
|
|
1083
|
+
const height = positive(image.height);
|
|
1084
|
+
const type = typeof image.type === "string" && image.type ? image.type : "image/png";
|
|
1085
|
+
return { url, type, ...width ? { width } : {}, ...height ? { height } : {}, ...typeof image.alt === "string" && image.alt ? { alt: image.alt } : {} };
|
|
1086
|
+
}
|
|
1087
|
+
function hreflangLanguages(members, defaultLocale, selfUrl, url) {
|
|
1088
|
+
const defaultMember = members.find((m) => m.locale === defaultLocale);
|
|
1089
|
+
return { ...Object.fromEntries(members.map((m) => [m.locale, url(m)])), "x-default": defaultMember ? url(defaultMember) : selfUrl };
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
// src/react/jsonld.ts
|
|
1093
|
+
var script = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
1094
|
+
var organization = (publisher) => ({ "@type": "Organization", "@id": publisher.id, name: publisher.name, ...publisher.logo ? { logo: publisher.logo } : {} });
|
|
1095
|
+
var webSite = (website) => ({ "@type": "WebSite", "@id": website.id, name: website.name });
|
|
1096
|
+
function articleJsonLd({ article, origin, href, jsonLd, imageUrl, imageWidth, imageHeight }) {
|
|
1097
|
+
const { publication: pub } = article;
|
|
1098
|
+
const url = (path) => absoluteUrl(origin, href(path, pub.locale));
|
|
1099
|
+
const canonical = url(pub.canonical_path);
|
|
1100
|
+
const id = (fragment) => ({ "@id": `${canonical}#${fragment}` });
|
|
1101
|
+
const full = jsonLd !== void 0;
|
|
1102
|
+
const author = articleAuthor(article, jsonLd);
|
|
1103
|
+
const publisher = jsonLd?.publisher;
|
|
1104
|
+
const website = jsonLd?.website?.(pub.locale);
|
|
1105
|
+
const modified = modifiedAt(pub);
|
|
1106
|
+
const words = wordCountOf(pub);
|
|
1107
|
+
const publisherNode = publisher ? organization(publisher) : void 0;
|
|
1108
|
+
const section = article.breadcrumbs[0]?.title;
|
|
1109
|
+
const graph = [
|
|
1110
|
+
...full ? [{
|
|
1111
|
+
"@type": "WebPage",
|
|
1112
|
+
...id("webpage"),
|
|
1113
|
+
url: canonical,
|
|
1114
|
+
name: pub.title,
|
|
1115
|
+
...pub.description ? { description: pub.description } : {},
|
|
1116
|
+
inLanguage: pub.locale,
|
|
1117
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
1118
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
1119
|
+
breadcrumb: id("breadcrumb"),
|
|
1120
|
+
mainEntity: id("article")
|
|
1121
|
+
}] : [],
|
|
1122
|
+
{
|
|
1123
|
+
"@type": "BlogPosting",
|
|
1124
|
+
...id("article"),
|
|
1125
|
+
headline: pub.title,
|
|
1126
|
+
...pub.description ? { description: pub.description } : {},
|
|
1127
|
+
datePublished: pub.published_at,
|
|
1128
|
+
...section ? { articleSection: section } : {},
|
|
1129
|
+
...modified ? { dateModified: modified } : {},
|
|
1130
|
+
...words ? { wordCount: words } : {},
|
|
1131
|
+
url: canonical,
|
|
1132
|
+
mainEntityOfPage: full ? id("webpage") : canonical,
|
|
1133
|
+
...author ? { author: { "@type": "Person", ...author.id ? { "@id": author.id } : {}, name: author.name, ...author.url ? { url: author.url } : {} } } : {},
|
|
1134
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
1135
|
+
inLanguage: pub.locale,
|
|
1136
|
+
...imageUrl ? { image: imageWidth && imageHeight ? { "@type": "ImageObject", url: imageUrl, width: imageWidth, height: imageHeight } : [imageUrl] } : {}
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
"@type": "BreadcrumbList",
|
|
1140
|
+
...id("breadcrumb"),
|
|
1141
|
+
itemListElement: breadcrumbItems(article, jsonLd).map((b, i) => ({
|
|
1142
|
+
"@type": "ListItem",
|
|
1143
|
+
position: i + 1,
|
|
1144
|
+
name: b.title,
|
|
1145
|
+
item: absoluteUrl(origin, crumbHref(href, b.canonical_path, pub.locale).replace(/^\/$/, ""))
|
|
1146
|
+
}))
|
|
1147
|
+
}
|
|
1148
|
+
];
|
|
1149
|
+
return script({ "@context": "https://schema.org", "@graph": graph });
|
|
1150
|
+
}
|
|
1151
|
+
function listJsonLd({ list, origin, href, path, locale, description, jsonLd, cursor }) {
|
|
1152
|
+
const url = absoluteUrl(origin, href(path)) + (cursor ? `?cursor=${cursor}` : "");
|
|
1153
|
+
const website = jsonLd?.website?.(locale);
|
|
1154
|
+
return script({
|
|
1155
|
+
"@context": "https://schema.org",
|
|
1156
|
+
"@type": "CollectionPage",
|
|
1157
|
+
...jsonLd ? { "@id": `${url}#webpage` } : {},
|
|
1158
|
+
url,
|
|
1159
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
1160
|
+
...jsonLd?.publisher ? { publisher: organization(jsonLd.publisher) } : {},
|
|
1161
|
+
name: list.section.title,
|
|
1162
|
+
...description ? { description } : {},
|
|
1163
|
+
inLanguage: locale,
|
|
1164
|
+
mainEntity: {
|
|
1165
|
+
"@type": "ItemList",
|
|
1166
|
+
itemListElement: list.items.map((item, i) => ({ "@type": "ListItem", position: i + 1, url: absoluteUrl(origin, href(item.canonical_path)), name: item.title }))
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// src/react/pages.tsx
|
|
1172
|
+
import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1173
|
+
function Slot({ name, slots, tag: Tag = "div", className }) {
|
|
1174
|
+
const fill = slots?.[name];
|
|
1175
|
+
return fill ? /* @__PURE__ */ jsx7(Tag, { "data-slot": name, className, children: fill }) : null;
|
|
1176
|
+
}
|
|
1177
|
+
function Shell({ children }) {
|
|
1178
|
+
return /* @__PURE__ */ jsx7("div", { className: "hyle", children: /* @__PURE__ */ jsx7("div", { className: "hyle-page", children }) });
|
|
1179
|
+
}
|
|
1180
|
+
function ctx(p, fallbackLocale) {
|
|
1181
|
+
const locale = p.locale ?? fallbackLocale;
|
|
1182
|
+
return { s: stringsFor(locale), locale, href: (path, linkLocale) => p.toHref ? p.toHref(path, linkLocale ?? locale) : path, Link: p.components?.Link ?? "a" };
|
|
1183
|
+
}
|
|
1184
|
+
function Pager({ prev, next, c }) {
|
|
1185
|
+
if (!prev && !next) return null;
|
|
1186
|
+
const { Link, s } = c;
|
|
1187
|
+
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-pager", "aria-label": s.pager, children: [
|
|
1188
|
+
prev ? /* @__PURE__ */ jsxs6(Link, { href: c.href(prev.canonical_path), rel: "prev", children: [
|
|
1189
|
+
/* @__PURE__ */ jsxs6("span", { className: "dir", children: [
|
|
1190
|
+
/* @__PURE__ */ jsx7(Icon, { name: "chev-left" }),
|
|
1191
|
+
s.prev
|
|
1192
|
+
] }),
|
|
1193
|
+
/* @__PURE__ */ jsx7("span", { className: "ttl", children: prev.title })
|
|
1194
|
+
] }) : /* @__PURE__ */ jsx7("span", { className: "none", "aria-hidden": "true" }),
|
|
1195
|
+
next ? /* @__PURE__ */ jsxs6(Link, { href: c.href(next.canonical_path), rel: "next", className: "next", children: [
|
|
1196
|
+
/* @__PURE__ */ jsxs6("span", { className: "dir", children: [
|
|
1197
|
+
s.next,
|
|
1198
|
+
/* @__PURE__ */ jsx7(Icon, { name: "chev" })
|
|
1199
|
+
] }),
|
|
1200
|
+
/* @__PURE__ */ jsx7("span", { className: "ttl", children: next.title })
|
|
1201
|
+
] }) : null
|
|
1202
|
+
] });
|
|
1203
|
+
}
|
|
1204
|
+
function OlderNav({ href, c }) {
|
|
1205
|
+
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-pagination", "aria-label": c.s.pager, children: [
|
|
1206
|
+
/* @__PURE__ */ jsx7("span", { className: "sp" }),
|
|
1207
|
+
/* @__PURE__ */ jsxs6(c.Link, { className: "hyle-btn sm", href, rel: "next", children: [
|
|
1208
|
+
c.s.older,
|
|
1209
|
+
/* @__PURE__ */ jsx7(Icon, { name: "chev" })
|
|
1210
|
+
] })
|
|
1211
|
+
] });
|
|
1212
|
+
}
|
|
1213
|
+
function TocList({ toc }) {
|
|
1214
|
+
const groups = [];
|
|
1215
|
+
for (const entry of toc) {
|
|
1216
|
+
const last = groups.at(-1);
|
|
1217
|
+
if (entry.depth === 3 && last) last.subs.push(entry);
|
|
1218
|
+
else groups.push({ entry, subs: [] });
|
|
1219
|
+
}
|
|
1220
|
+
return /* @__PURE__ */ jsx7("ul", { children: groups.map(({ entry, subs }) => /* @__PURE__ */ jsxs6("li", { children: [
|
|
1221
|
+
/* @__PURE__ */ jsx7("a", { href: `#${scopeId(entry.id)}`, children: entry.text }),
|
|
1222
|
+
subs.length > 0 ? /* @__PURE__ */ jsx7("ul", { children: subs.map((sub) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7("a", { href: `#${scopeId(sub.id)}`, children: sub.text }) }, sub.id)) }) : null
|
|
1223
|
+
] }, entry.id)) });
|
|
1224
|
+
}
|
|
1225
|
+
function Toc({ toc, c, aside }) {
|
|
1226
|
+
const entries = toc.filter((t) => t.depth === 2 || t.depth === 3);
|
|
1227
|
+
if (entries.length === 0 && !aside) return { narrow: null, wide: null };
|
|
1228
|
+
const { s } = c;
|
|
1229
|
+
return {
|
|
1230
|
+
narrow: entries.length === 0 ? null : /* @__PURE__ */ jsxs6("details", { className: "hyle-toc-m", children: [
|
|
1231
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
1232
|
+
/* @__PURE__ */ jsx7(Icon, { name: "file" }),
|
|
1233
|
+
s.toc,
|
|
1234
|
+
/* @__PURE__ */ jsx7(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
1235
|
+
] }),
|
|
1236
|
+
/* @__PURE__ */ jsx7("nav", { className: "hyle-toc-list", "aria-label": s.toc, children: /* @__PURE__ */ jsx7(TocList, { toc: entries }) })
|
|
1237
|
+
] }),
|
|
1238
|
+
wide: /* @__PURE__ */ jsxs6("aside", { className: "hyle-toc-d", "aria-label": s.toc, children: [
|
|
1239
|
+
entries.length === 0 ? null : /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1240
|
+
/* @__PURE__ */ jsx7("p", { className: "hyle-toc-title", children: s.toc }),
|
|
1241
|
+
/* @__PURE__ */ jsx7("nav", { className: "hyle-toc-list", children: /* @__PURE__ */ jsx7(TocList, { toc: entries }) })
|
|
1242
|
+
] }),
|
|
1243
|
+
aside
|
|
1244
|
+
] })
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
function Body({ article, components, locale }) {
|
|
1248
|
+
const { content, publication } = article;
|
|
1249
|
+
return /* @__PURE__ */ jsx7("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ jsx7(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : content.format === "html" ? /* @__PURE__ */ jsx7(TrustedServerHtml, { html: content.html }) : null });
|
|
1250
|
+
}
|
|
1251
|
+
function Languages({ alternates, current, c }) {
|
|
1252
|
+
if (alternates.length < 2) return null;
|
|
1253
|
+
const { Link, s } = c;
|
|
1254
|
+
return /* @__PURE__ */ jsxs6("nav", { className: "hyle-langs", "aria-label": s.languages, children: [
|
|
1255
|
+
/* @__PURE__ */ jsx7("span", { children: s.readIn }),
|
|
1256
|
+
/* @__PURE__ */ jsx7("ul", { children: alternates.map((a) => {
|
|
1257
|
+
const label = languageName(a.locale, a.locale);
|
|
1258
|
+
return /* @__PURE__ */ jsx7("li", { children: a.locale === current ? /* @__PURE__ */ jsx7("a", { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, "aria-current": "true", children: label }) : /* @__PURE__ */ jsx7(Link, { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, children: label }) }, a.locale);
|
|
1259
|
+
}) })
|
|
1260
|
+
] });
|
|
1261
|
+
}
|
|
1262
|
+
function LdScript({ json }) {
|
|
1263
|
+
return /* @__PURE__ */ jsx7("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } });
|
|
1264
|
+
}
|
|
1265
|
+
function Crumbs({ items, c }) {
|
|
1266
|
+
const { Link } = c;
|
|
1267
|
+
return /* @__PURE__ */ jsx7("nav", { className: "hyle-crumbs", "aria-label": c.s.crumbs, children: /* @__PURE__ */ jsx7("ol", { children: items.map((b, i) => /* @__PURE__ */ jsx7("li", { "aria-current": i === items.length - 1 ? "page" : void 0, children: i === items.length - 1 ? b.title : /* @__PURE__ */ jsx7(Link, { href: crumbHref(c.href, b.canonical_path, c.locale), children: b.title }) }, b.canonical_path)) }) });
|
|
1268
|
+
}
|
|
1269
|
+
function ArticlePage({ article, engagement, origin, jsonLd, imageUrl, imageWidth, imageHeight, related, ...base }) {
|
|
1270
|
+
const { publication: pub } = article;
|
|
1271
|
+
const c = ctx(base, pub.locale);
|
|
1272
|
+
const { s } = c;
|
|
1273
|
+
const jsonLdOrigin = bareOrigin(origin);
|
|
1274
|
+
const author = articleAuthor(article, jsonLd)?.name;
|
|
1275
|
+
const modified = modifiedAt(pub);
|
|
1276
|
+
const words = wordCountOf(pub);
|
|
1277
|
+
const toc = Toc({ toc: article.toc, c, aside: /* @__PURE__ */ jsx7(Slot, { name: "article.aside", slots: base.slots, className: "hyle-slot-wrap" }) });
|
|
1278
|
+
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
1279
|
+
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("article", { className: "hyle-article", "data-hyle-page": "article", lang: c.locale, children: [
|
|
1280
|
+
/* @__PURE__ */ jsxs6("header", { className: "hyle-head", children: [
|
|
1281
|
+
/* @__PURE__ */ jsx7(Slot, { name: "article.before", slots: base.slots, className: "hyle-eyebrow" }),
|
|
1282
|
+
/* @__PURE__ */ jsx7(Crumbs, { items: breadcrumbItems(article, jsonLd), c }),
|
|
1283
|
+
/* @__PURE__ */ jsx7("h1", { className: "hyle-title", children: pub.title }),
|
|
1284
|
+
pub.description ? /* @__PURE__ */ jsx7("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1285
|
+
/* @__PURE__ */ jsxs6("div", { className: "hyle-meta", children: [
|
|
1286
|
+
author ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1287
|
+
/* @__PURE__ */ jsx7("span", { className: "hyle-avatar", "aria-hidden": "true", children: author.slice(0, 2).toUpperCase() }),
|
|
1288
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1289
|
+
/* @__PURE__ */ jsxs6("span", { className: "hyle-sr", children: [
|
|
1290
|
+
s.by,
|
|
1291
|
+
" "
|
|
1292
|
+
] }),
|
|
1293
|
+
/* @__PURE__ */ jsx7("span", { className: "by", children: author })
|
|
1294
|
+
] })
|
|
1295
|
+
] }) : null,
|
|
1296
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1297
|
+
/* @__PURE__ */ jsx7(Icon, { name: "calendar" }),
|
|
1298
|
+
/* @__PURE__ */ jsx7("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) })
|
|
1299
|
+
] }),
|
|
1300
|
+
modified ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1301
|
+
/* @__PURE__ */ jsx7(Icon, { name: "calendar" }),
|
|
1302
|
+
s.updated,
|
|
1303
|
+
" ",
|
|
1304
|
+
/* @__PURE__ */ jsx7("time", { dateTime: modified, title: modified, children: formatDate(modified, c.locale) })
|
|
1305
|
+
] }) : null,
|
|
1306
|
+
words ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
1307
|
+
/* @__PURE__ */ jsx7(Icon, { name: "clock" }),
|
|
1308
|
+
s.readingTime.replace("{n}", String(readingMinutes(words)))
|
|
1309
|
+
] }) : null,
|
|
1310
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1311
|
+
/* @__PURE__ */ jsx7(Icon, { name: "globe" }),
|
|
1312
|
+
/* @__PURE__ */ jsx7("span", { lang: pub.locale, children: languageName(pub.locale, c.locale) })
|
|
1313
|
+
] }),
|
|
1314
|
+
/* @__PURE__ */ jsx7(Slot, { name: "article.meta", slots: base.slots, tag: "span" })
|
|
1315
|
+
] }),
|
|
1316
|
+
/* @__PURE__ */ jsx7(Languages, { alternates: article.alternates, current: pub.locale, c }),
|
|
1317
|
+
notTranslated ? /* @__PURE__ */ jsxs6("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1318
|
+
/* @__PURE__ */ jsx7(Icon, { name: "alert" }),
|
|
1319
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx7("b", { children: notTranslated }),
|
|
1321
|
+
" ",
|
|
1322
|
+
s.fallbackBody
|
|
1323
|
+
] })
|
|
1324
|
+
] }) : null
|
|
1325
|
+
] }),
|
|
1326
|
+
toc.narrow,
|
|
1327
|
+
/* @__PURE__ */ jsx7(Body, { article, components: base.components, locale: c.locale }),
|
|
1328
|
+
engagement ? /* @__PURE__ */ jsx7(Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
|
|
1329
|
+
/* @__PURE__ */ jsx7(Pager, { prev: article.prev, next: article.next, c }),
|
|
1330
|
+
related ? /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
1331
|
+
related.items.length > 0 ? /* @__PURE__ */ jsx7(HyleListView, { items: related.items, title: related.title ?? s.moreInSection, ...base, locale: c.locale }) : null,
|
|
1332
|
+
article.children.length > 0 ? /* @__PURE__ */ jsx7(HyleListView, { items: article.children.map((child) => ({ ...child, description: null, published_at: "" })), title: s.subPages, ...base, locale: c.locale }) : null
|
|
1333
|
+
] }) : null,
|
|
1334
|
+
/* @__PURE__ */ jsx7(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
|
|
1335
|
+
toc.wide,
|
|
1336
|
+
jsonLdOrigin ? /* @__PURE__ */ jsx7(LdScript, { json: articleJsonLd({ article, origin: jsonLdOrigin, href: c.href, jsonLd, imageUrl, imageWidth, imageHeight }) }) : null
|
|
1337
|
+
] }) });
|
|
1338
|
+
}
|
|
1339
|
+
function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }) {
|
|
1340
|
+
const c = ctx(base, "en");
|
|
1341
|
+
const { s, Link } = c;
|
|
1342
|
+
const Row = base.slots?.["list.item"];
|
|
1343
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1344
|
+
for (const item of list.items) groups.set(item.published_at.slice(0, 7), [...groups.get(item.published_at.slice(0, 7)) ?? [], item]);
|
|
1345
|
+
const notTranslated = list.fallback ? s.fallbackTitle.replace("{language}", languageName(list.fallback.requested_locale, c.locale)) : void 0;
|
|
1346
|
+
const jsonLdOrigin = bareOrigin(origin);
|
|
1347
|
+
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("div", { className: "hyle-listpage", "data-hyle-page": "list", lang: c.locale, children: [
|
|
1348
|
+
/* @__PURE__ */ jsxs6("header", { className: "hyle-head", children: [
|
|
1349
|
+
/* @__PURE__ */ jsx7("h1", { className: "hyle-title", children: list.section.title }),
|
|
1350
|
+
description ? /* @__PURE__ */ jsx7("p", { className: "hyle-desc", children: description }) : null,
|
|
1351
|
+
/* @__PURE__ */ jsx7(Slot, { name: "list.header", slots: base.slots, className: "hyle-slot-wrap" }),
|
|
1352
|
+
notTranslated ? /* @__PURE__ */ jsxs6("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1353
|
+
/* @__PURE__ */ jsx7(Icon, { name: "alert" }),
|
|
1354
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1355
|
+
/* @__PURE__ */ jsx7("b", { children: notTranslated }),
|
|
1356
|
+
" ",
|
|
1357
|
+
s.fallbackBody
|
|
1358
|
+
] })
|
|
1359
|
+
] }) : null
|
|
1360
|
+
] }),
|
|
1361
|
+
list.items.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "hyle-empty", "data-slot-state": "empty", children: [
|
|
1362
|
+
/* @__PURE__ */ jsx7(Icon, { name: "file" }),
|
|
1363
|
+
/* @__PURE__ */ jsx7("h2", { children: s.emptyTitle }),
|
|
1364
|
+
/* @__PURE__ */ jsx7("p", { children: s.emptyBody }),
|
|
1365
|
+
/* @__PURE__ */ jsx7(Slot, { name: "list.empty", slots: base.slots })
|
|
1366
|
+
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ jsxs6("section", { "aria-label": formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }), children: [
|
|
1367
|
+
/* @__PURE__ */ jsx7("h2", { className: "hyle-year", children: formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }) }),
|
|
1368
|
+
/* @__PURE__ */ jsx7("ul", { className: "hyle-items", children: items.map((item) => /* @__PURE__ */ jsx7("li", { children: Row ? /* @__PURE__ */ jsx7(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs6(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
1369
|
+
/* @__PURE__ */ jsx7("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
1370
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1371
|
+
/* @__PURE__ */ jsx7("span", { className: "t", children: item.title }),
|
|
1372
|
+
item.description ? /* @__PURE__ */ jsx7("p", { children: item.description }) : null
|
|
1373
|
+
] })
|
|
1374
|
+
] }) }, item.canonical_path)) })
|
|
1375
|
+
] }, month)),
|
|
1376
|
+
olderHref ? /* @__PURE__ */ jsx7(OlderNav, { href: olderHref, c }) : null,
|
|
1377
|
+
jsonLdOrigin && path ? /* @__PURE__ */ jsx7(LdScript, { json: listJsonLd({ list, origin: jsonLdOrigin, href: c.href, path, locale: c.locale, description, jsonLd, cursor }) }) : null
|
|
1378
|
+
] }) });
|
|
1379
|
+
}
|
|
1380
|
+
function NotFound({ path, homeHref = "/", ...base }) {
|
|
1381
|
+
const c = ctx(base, "en");
|
|
1382
|
+
const { Link, s } = c;
|
|
1383
|
+
const body = base.slots?.["notfound.body"];
|
|
1384
|
+
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "not-found", lang: c.locale, children: [
|
|
1385
|
+
/* @__PURE__ */ jsx7("span", { className: "kind", children: s.nfKind }),
|
|
1386
|
+
/* @__PURE__ */ jsx7("h1", { children: s.nfTitle }),
|
|
1387
|
+
body ? /* @__PURE__ */ jsx7("div", { "data-slot": "notfound.body", children: body }) : /* @__PURE__ */ jsx7("p", { children: s.nfBody }),
|
|
1388
|
+
path ? /* @__PURE__ */ jsx7("dl", { className: "hyle-addr", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
1389
|
+
/* @__PURE__ */ jsx7("dt", { children: s.path }),
|
|
1390
|
+
/* @__PURE__ */ jsx7("dd", { children: path })
|
|
1391
|
+
] }) }) : null,
|
|
1392
|
+
/* @__PURE__ */ jsxs6("div", { className: "hyle-actions", children: [
|
|
1393
|
+
/* @__PURE__ */ jsx7(Link, { className: "hyle-btn primary", href: crumbHref(c.href, homeHref, c.locale), children: s.home }),
|
|
1394
|
+
/* @__PURE__ */ jsx7(Slot, { name: "notfound.actions", slots: base.slots, tag: "span" })
|
|
1395
|
+
] })
|
|
1396
|
+
] }) });
|
|
1397
|
+
}
|
|
1398
|
+
function Unavailable(base) {
|
|
1399
|
+
const c = ctx(base, "en");
|
|
1400
|
+
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "unavailable", lang: c.locale, role: "status", children: [
|
|
1401
|
+
/* @__PURE__ */ jsx7("span", { className: "kind", children: c.s.unKind }),
|
|
1402
|
+
/* @__PURE__ */ jsx7("h1", { children: c.s.unTitle }),
|
|
1403
|
+
/* @__PURE__ */ jsx7("p", { children: c.s.unBody })
|
|
1404
|
+
] }) });
|
|
1405
|
+
}
|
|
1406
|
+
function Redirecting({ from, to, ...base }) {
|
|
1407
|
+
const c = ctx(base, "en");
|
|
1408
|
+
const { Link, s } = c;
|
|
1409
|
+
const extra = base.slots?.["redirecting.body"];
|
|
1410
|
+
return /* @__PURE__ */ jsx7(Shell, { children: /* @__PURE__ */ jsxs6("section", { className: "hyle-state", "data-hyle-page": "redirecting", role: "status", lang: c.locale, children: [
|
|
1411
|
+
/* @__PURE__ */ jsx7("span", { className: "kind", children: s.rdKind }),
|
|
1412
|
+
/* @__PURE__ */ jsx7("h1", { children: s.rdTitle }),
|
|
1413
|
+
/* @__PURE__ */ jsx7("p", { children: s.rdBody }),
|
|
1414
|
+
/* @__PURE__ */ jsxs6("dl", { className: "hyle-addr", children: [
|
|
1415
|
+
from ? /* @__PURE__ */ jsxs6("div", { children: [
|
|
1416
|
+
/* @__PURE__ */ jsx7("dt", { children: s.from }),
|
|
1417
|
+
/* @__PURE__ */ jsx7("dd", { children: from })
|
|
1418
|
+
] }) : null,
|
|
1419
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1420
|
+
/* @__PURE__ */ jsx7("dt", { children: s.to }),
|
|
1421
|
+
/* @__PURE__ */ jsx7("dd", { children: to })
|
|
1422
|
+
] })
|
|
1423
|
+
] }),
|
|
1424
|
+
/* @__PURE__ */ jsx7("p", { className: "fine", children: /* @__PURE__ */ jsx7(Link, { href: c.href(to), children: s.rdFallback }) }),
|
|
1425
|
+
extra ? /* @__PURE__ */ jsx7("p", { "data-slot": "redirecting.body", className: "fine", children: extra }) : null
|
|
1426
|
+
] }) });
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// src/react/index.ts
|
|
1430
|
+
import { Comments as Comments2 } from "./comments.js";
|
|
1431
|
+
|
|
1270
1432
|
// src/react/docs.tsx
|
|
1271
1433
|
import { DocsEnhance } from "./docs-enhance.js";
|
|
1272
1434
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -1369,17 +1531,25 @@ export {
|
|
|
1369
1531
|
stringsFor,
|
|
1370
1532
|
HastContent,
|
|
1371
1533
|
TrustedServerHtml,
|
|
1534
|
+
parseListing,
|
|
1535
|
+
HyleListView,
|
|
1536
|
+
HyleArticleView,
|
|
1537
|
+
HyleCommentsView,
|
|
1538
|
+
HyleCommentsFallback,
|
|
1372
1539
|
BARE_HTTPS_ORIGIN,
|
|
1540
|
+
bareOrigin,
|
|
1541
|
+
absoluteUrl,
|
|
1542
|
+
modifiedAt,
|
|
1543
|
+
wordCountOf,
|
|
1544
|
+
readingMinutes,
|
|
1545
|
+
articleAuthor,
|
|
1546
|
+
validOgImage,
|
|
1547
|
+
hreflangLanguages,
|
|
1373
1548
|
ArticlePage,
|
|
1374
1549
|
ListPage,
|
|
1375
1550
|
NotFound,
|
|
1376
1551
|
Unavailable,
|
|
1377
1552
|
Redirecting,
|
|
1378
|
-
parseListing,
|
|
1379
|
-
HyleListView,
|
|
1380
|
-
HyleArticleView,
|
|
1381
|
-
HyleCommentsView,
|
|
1382
|
-
HyleCommentsFallback,
|
|
1383
1553
|
DocsPage,
|
|
1384
1554
|
MermaidDiagram2 as MermaidDiagram,
|
|
1385
1555
|
Comments2 as Comments
|