@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
package/dist/react.cjs
CHANGED
|
@@ -109,9 +109,7 @@ function Icon({ name, className }) {
|
|
|
109
109
|
|
|
110
110
|
// src/react/content.tsx
|
|
111
111
|
var import_mermaid_diagram = require("./mermaid-diagram.cjs");
|
|
112
|
-
|
|
113
|
-
// src/react/mermaid-config.ts
|
|
114
|
-
var MAX_MERMAID_SOURCE = 2e4;
|
|
112
|
+
var import_mermaid_image = require("./mermaid-image.cjs");
|
|
115
113
|
|
|
116
114
|
// src/react/sanitize.ts
|
|
117
115
|
var HastLimitError = class extends Error {
|
|
@@ -123,7 +121,7 @@ var HastLimitError = class extends Error {
|
|
|
123
121
|
var MAX_NODES = 2e4;
|
|
124
122
|
var MAX_TEXT = 512 * 1024;
|
|
125
123
|
var MAX_DEPTH = 128;
|
|
126
|
-
var MAX_SRCDOC =
|
|
124
|
+
var MAX_SRCDOC = 1024 * 1024;
|
|
127
125
|
var DROP = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
|
|
128
126
|
var VOID = /* @__PURE__ */ new Set(["br", "hr", "img", "input", "path"]);
|
|
129
127
|
var isString = (v) => typeof v === "string";
|
|
@@ -140,6 +138,7 @@ var classTokens = (v) => {
|
|
|
140
138
|
};
|
|
141
139
|
var isClass = (v) => classTokens(v) !== void 0;
|
|
142
140
|
var isAlign = matches(/^(left|right|center)$/);
|
|
141
|
+
var isPixels = (v) => typeof v === "number" ? Number.isInteger(v) && v > 0 : typeof v === "string" && /^[1-9]\d*$/.test(v);
|
|
143
142
|
var isLength = matches(/^[\d.]+(em|px|%)?$/);
|
|
144
143
|
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"]);
|
|
145
144
|
var STYLE_LENGTH = /^(-?\d+(?:\.\d+)?)(em|px|%)?$/;
|
|
@@ -176,10 +175,14 @@ var MERMAID_SRCDOC = new RegExp(
|
|
|
176
175
|
var isMermaidSrcdoc = (v) => typeof v === "string" && v.length <= MAX_SRCDOC && MERMAID_SRCDOC.test(v);
|
|
177
176
|
var ENTITIES = { "<": "<", "&": "&", "<": "<", ">": ">", "&": "&", """: '"', "'": "'" };
|
|
178
177
|
function mermaidSource(srcDoc) {
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
return MERMAID_SRCDOC.exec(srcDoc)?.[1]?.replace(/&(?:#x3c|#x26|#x27|lt|gt|amp|quot);/gi, (e) => ENTITIES[e.toLowerCase()]);
|
|
179
|
+
}
|
|
180
|
+
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})$/;
|
|
181
|
+
var isRenderRef = matches(RENDER_REF);
|
|
182
|
+
function diagramRender(value) {
|
|
183
|
+
const m = typeof value === "string" ? RENDER_REF.exec(value) : null;
|
|
184
|
+
return m ? { src: hostAssetSrc(m[1]), width: Number(m[2]), height: Number(m[3]) } : void 0;
|
|
181
185
|
}
|
|
182
|
-
var MERMAID_FRAME_CSP = `default-src 'none'; script-src ${MERMAID_SCRIPT_URL} 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:`;
|
|
183
186
|
var heading = { id: isIdValue, className: isClass };
|
|
184
187
|
var ATTRS = new Map(
|
|
185
188
|
Object.entries({
|
|
@@ -204,7 +207,7 @@ var ATTRS = new Map(
|
|
|
204
207
|
h5: heading,
|
|
205
208
|
h6: heading,
|
|
206
209
|
a: { href: isHref, id: isIdValue, ariaDescribedBy: isIdValue, ariaLabel: isString, dataFootnoteRef: isScalar, dataFootnoteBackref: isScalar, className: isClass },
|
|
207
|
-
img: { src: isSrc, alt: isString },
|
|
210
|
+
img: { src: isSrc, alt: isString, width: isPixels, height: isPixels },
|
|
208
211
|
table: {},
|
|
209
212
|
th: { scope: matches(/^(row|col|rowgroup|colgroup)$/), align: isAlign },
|
|
210
213
|
td: { align: isAlign },
|
|
@@ -218,7 +221,7 @@ var ATTRS = new Map(
|
|
|
218
221
|
video: { src: isSrc, controls: isScalar },
|
|
219
222
|
audio: { src: isSrc, controls: isScalar },
|
|
220
223
|
// hyle's sandboxed Mermaid frame (ADR 0001). The renderer emits `sandbox` as ["allow-scripts"]; it is normalized below.
|
|
221
|
-
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc }
|
|
224
|
+
iframe: { sandbox: (v) => v === "allow-scripts" || Array.isArray(v) && v.length === 1 && v[0] === "allow-scripts", srcdoc: isMermaidSrcdoc, dataLight: isRenderRef, dataDark: isRenderRef }
|
|
222
225
|
})
|
|
223
226
|
);
|
|
224
227
|
var isObject = (v) => typeof v === "object" && v !== null;
|
|
@@ -592,11 +595,17 @@ var en = {
|
|
|
592
595
|
caution: "Caution",
|
|
593
596
|
diagram: "Diagram",
|
|
594
597
|
diagramError: "This diagram could not be rendered.",
|
|
598
|
+
diagramLoading: "Loading the diagram",
|
|
599
|
+
diagramSource: "Diagram source",
|
|
595
600
|
contentError: "This content cannot be displayed.",
|
|
596
601
|
fallbackTitle: "Not translated into {language} yet.",
|
|
597
602
|
fallbackBody: "You are reading the original.",
|
|
603
|
+
readingTime: "{n} min read",
|
|
604
|
+
readingTimeLabel: "Reading time",
|
|
598
605
|
older: "Older posts",
|
|
599
606
|
viewAll: "View all",
|
|
607
|
+
moreInSection: "More in this section",
|
|
608
|
+
subPages: "In this section",
|
|
600
609
|
readAtSource: "Read at source",
|
|
601
610
|
emptyTitle: "Nothing published here yet",
|
|
602
611
|
emptyBody: "Documents published to this section will appear here, newest first.",
|
|
@@ -638,11 +647,17 @@ var fr = {
|
|
|
638
647
|
caution: "Danger",
|
|
639
648
|
diagram: "Sch\xE9ma",
|
|
640
649
|
diagramError: "Ce sch\xE9ma n'a pas pu \xEAtre affich\xE9.",
|
|
650
|
+
diagramLoading: "Chargement du sch\xE9ma",
|
|
651
|
+
diagramSource: "Source du sch\xE9ma",
|
|
641
652
|
contentError: "Ce contenu ne peut pas \xEAtre affich\xE9.",
|
|
642
653
|
fallbackTitle: "Pas encore traduit en {language}.",
|
|
643
654
|
fallbackBody: "Vous lisez l'original.",
|
|
655
|
+
readingTime: "{n} min de lecture",
|
|
656
|
+
readingTimeLabel: "Temps de lecture",
|
|
644
657
|
older: "Articles plus anciens",
|
|
645
658
|
viewAll: "Tout voir",
|
|
659
|
+
moreInSection: "Plus dans cette section",
|
|
660
|
+
subPages: "Dans cette section",
|
|
646
661
|
readAtSource: "Lire \xE0 la source",
|
|
647
662
|
emptyTitle: "Rien n'est encore publi\xE9 ici",
|
|
648
663
|
emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
|
|
@@ -684,11 +699,17 @@ var es = {
|
|
|
684
699
|
caution: "Peligro",
|
|
685
700
|
diagram: "Diagrama",
|
|
686
701
|
diagramError: "No se pudo mostrar este diagrama.",
|
|
702
|
+
diagramLoading: "Cargando el diagrama",
|
|
703
|
+
diagramSource: "C\xF3digo del diagrama",
|
|
687
704
|
contentError: "No se puede mostrar este contenido.",
|
|
688
705
|
fallbackTitle: "A\xFAn no est\xE1 traducida al {language}.",
|
|
689
706
|
fallbackBody: "Est\xE1s leyendo el original.",
|
|
707
|
+
readingTime: "{n} min de lectura",
|
|
708
|
+
readingTimeLabel: "Tiempo de lectura",
|
|
690
709
|
older: "Entradas anteriores",
|
|
691
710
|
viewAll: "Ver todo",
|
|
711
|
+
moreInSection: "M\xE1s en esta secci\xF3n",
|
|
712
|
+
subPages: "En esta secci\xF3n",
|
|
692
713
|
readAtSource: "Leer en la fuente",
|
|
693
714
|
emptyTitle: "A\xFAn no hay nada publicado aqu\xED",
|
|
694
715
|
emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
|
|
@@ -751,7 +772,12 @@ function buildComponents(c, s) {
|
|
|
751
772
|
}
|
|
752
773
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: url, rel: "noopener noreferrer", ...rest, children });
|
|
753
774
|
};
|
|
754
|
-
|
|
775
|
+
let images = 0;
|
|
776
|
+
const Image = (props) => {
|
|
777
|
+
if (typeof props.src !== "string") return null;
|
|
778
|
+
const first = images++ === 0;
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Img, { loading: first ? "eager" : "lazy", ...first ? { fetchPriority: "high" } : {}, decoding: "async", ...props });
|
|
780
|
+
};
|
|
755
781
|
const Pre = ({ children, ...rest }) => {
|
|
756
782
|
const code = import_react.Children.toArray(children).find(import_react.isValidElement);
|
|
757
783
|
const language = /(?:^|\s)language-([\w-]+)/.exec(code?.props.className ?? "")?.[1];
|
|
@@ -775,12 +801,18 @@ function buildComponents(c, s) {
|
|
|
775
801
|
] })
|
|
776
802
|
] });
|
|
777
803
|
};
|
|
778
|
-
const Frame = (
|
|
804
|
+
const Frame = (props) => {
|
|
805
|
+
const { srcDoc } = props;
|
|
779
806
|
if (typeof srcDoc !== "string") return null;
|
|
780
807
|
const source = mermaidSource(srcDoc);
|
|
781
808
|
if (c.Mermaid) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(c.Mermaid, { srcDoc, source, title: s.diagram });
|
|
782
|
-
if (source
|
|
783
|
-
|
|
809
|
+
if (source === void 0) return null;
|
|
810
|
+
const light = diagramRender(props["data-light"]);
|
|
811
|
+
const dark = diagramRender(props["data-dark"]);
|
|
812
|
+
if (light && dark) {
|
|
813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mermaid_image.MermaidImage, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, sourceLabel: s.diagramSource, light, dark, labels: s.viewer });
|
|
814
|
+
}
|
|
815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mermaid_diagram.MermaidDiagram, { source, title: s.diagram, errorText: s.diagramError, loadingText: s.diagramLoading, labels: s.viewer });
|
|
784
816
|
};
|
|
785
817
|
const Heading = (level) => function HyleHeading({ id, children, ...rest }) {
|
|
786
818
|
const Tag = `h${level}`;
|
|
@@ -825,12 +857,65 @@ var import_mermaid_diagram2 = require("./mermaid-diagram.cjs");
|
|
|
825
857
|
// src/react/pages.tsx
|
|
826
858
|
var import_comments = require("./comments.cjs");
|
|
827
859
|
|
|
860
|
+
// src/react/embed.tsx
|
|
861
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
862
|
+
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, olderHref, ...base }) {
|
|
863
|
+
const c = ctx(base, "en");
|
|
864
|
+
const { s, Link } = c;
|
|
865
|
+
const Row = base.slots?.["list.item"];
|
|
866
|
+
const Heading = `h${headingLevel}`;
|
|
867
|
+
const safe = items.filter((item) => item.canonical_path.startsWith("/"));
|
|
868
|
+
if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hyle hyle-embed", "data-layout": layout, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Slot, { name: "list.empty", slots: base.slots }) }) : null;
|
|
869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
|
|
870
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Heading, { className: "hyle-title", children: title }) : null,
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "hyle-items", children: safe.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: Row ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
872
|
+
item.published_at ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }) : null,
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "t", children: item.title }),
|
|
875
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: item.description }) : null
|
|
876
|
+
] })
|
|
877
|
+
] }) }, item.canonical_path)) }),
|
|
878
|
+
olderHref ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(OlderNav, { href: olderHref, c }) : null,
|
|
879
|
+
moreHref ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
|
|
880
|
+
] });
|
|
881
|
+
}
|
|
882
|
+
function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
883
|
+
const { publication: pub } = article;
|
|
884
|
+
const c = ctx(base, pub.locale);
|
|
885
|
+
const Heading = `h${headingLevel}`;
|
|
886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("article", { lang: c.locale, children: [
|
|
887
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "hyle-head", children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Heading, { className: "hyle-title", children: pub.title }),
|
|
889
|
+
pub.description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hyle-meta", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) }) }) })
|
|
891
|
+
] }),
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Body, { article, components: base.components, locale: c.locale }),
|
|
893
|
+
pub.canonical_path.startsWith("/") ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("a", { className: "hyle-more", href: c.href(pub.canonical_path, pub.locale), rel: "bookmark", children: [
|
|
894
|
+
c.s.readAtSource,
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "hyle-sr", children: [
|
|
896
|
+
": ",
|
|
897
|
+
pub.title
|
|
898
|
+
] })
|
|
899
|
+
] }) : null
|
|
900
|
+
] }) });
|
|
901
|
+
}
|
|
902
|
+
|
|
828
903
|
// src/react/seo.ts
|
|
829
904
|
var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
|
|
830
905
|
var bareOrigin = (origin) => origin && BARE_HTTPS_ORIGIN.test(origin) ? origin : void 0;
|
|
831
906
|
var absoluteUrl = (origin, href) => origin + encodeURI(href);
|
|
832
907
|
var modifiedAt = (pub) => pub.updated_at && Date.parse(pub.updated_at) > Date.parse(pub.published_at) ? pub.updated_at : void 0;
|
|
908
|
+
var wordCountOf = (pub) => Number.isInteger(pub.word_count) && pub.word_count > 0 ? pub.word_count : void 0;
|
|
909
|
+
var WORDS_PER_MINUTE = 275;
|
|
910
|
+
var readingMinutes = (wordCount) => Math.max(1, Math.ceil(wordCount / WORDS_PER_MINUTE));
|
|
911
|
+
var breadcrumbItems = (article, jsonLd) => [
|
|
912
|
+
...jsonLd?.breadcrumbRoot ? [{ title: jsonLd.breadcrumbRoot.name, canonical_path: "/" }] : [],
|
|
913
|
+
...article.breadcrumbs
|
|
914
|
+
];
|
|
915
|
+
var crumbHref = (href, path, locale) => path === "/" ? href("/", locale).replace(/(.)\/$/, "$1") : href(path, locale);
|
|
833
916
|
function articleAuthor(article, jsonLd) {
|
|
917
|
+
const authored = article.publication.author;
|
|
918
|
+
if (authored?.name) return { name: authored.name, ...authored.url ? { url: authored.url } : {} };
|
|
834
919
|
const given = jsonLd?.author?.(article);
|
|
835
920
|
if (given && typeof given.name === "string" && given.name) return given;
|
|
836
921
|
const fromFrontmatter = article.frontmatter.author;
|
|
@@ -839,7 +924,9 @@ function articleAuthor(article, jsonLd) {
|
|
|
839
924
|
|
|
840
925
|
// src/react/jsonld.ts
|
|
841
926
|
var script = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
842
|
-
|
|
927
|
+
var organization = (publisher) => ({ "@type": "Organization", "@id": publisher.id, name: publisher.name, ...publisher.logo ? { logo: publisher.logo } : {} });
|
|
928
|
+
var webSite = (website) => ({ "@type": "WebSite", "@id": website.id, name: website.name });
|
|
929
|
+
function articleJsonLd({ article, origin, href, jsonLd, imageUrl, imageWidth, imageHeight }) {
|
|
843
930
|
const { publication: pub } = article;
|
|
844
931
|
const url = (path) => absoluteUrl(origin, href(path, pub.locale));
|
|
845
932
|
const canonical = url(pub.canonical_path);
|
|
@@ -849,7 +936,9 @@ function articleJsonLd({ article, origin, href, jsonLd, imageUrl }) {
|
|
|
849
936
|
const publisher = jsonLd?.publisher;
|
|
850
937
|
const website = jsonLd?.website?.(pub.locale);
|
|
851
938
|
const modified = modifiedAt(pub);
|
|
852
|
-
const
|
|
939
|
+
const words = wordCountOf(pub);
|
|
940
|
+
const publisherNode = publisher ? organization(publisher) : void 0;
|
|
941
|
+
const section = article.breadcrumbs[0]?.title;
|
|
853
942
|
const graph = [
|
|
854
943
|
...full ? [{
|
|
855
944
|
"@type": "WebPage",
|
|
@@ -858,8 +947,8 @@ function articleJsonLd({ article, origin, href, jsonLd, imageUrl }) {
|
|
|
858
947
|
name: pub.title,
|
|
859
948
|
...pub.description ? { description: pub.description } : {},
|
|
860
949
|
inLanguage: pub.locale,
|
|
861
|
-
...website ? { isPartOf:
|
|
862
|
-
...
|
|
950
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
951
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
863
952
|
breadcrumb: id("breadcrumb"),
|
|
864
953
|
mainEntity: id("article")
|
|
865
954
|
}] : [],
|
|
@@ -868,28 +957,40 @@ function articleJsonLd({ article, origin, href, jsonLd, imageUrl }) {
|
|
|
868
957
|
...id("article"),
|
|
869
958
|
headline: pub.title,
|
|
870
959
|
...pub.description ? { description: pub.description } : {},
|
|
871
|
-
datePublished: pub.published_at
|
|
960
|
+
datePublished: pub.published_at,
|
|
961
|
+
...section ? { articleSection: section } : {},
|
|
872
962
|
...modified ? { dateModified: modified } : {},
|
|
963
|
+
...words ? { wordCount: words } : {},
|
|
873
964
|
url: canonical,
|
|
874
965
|
mainEntityOfPage: full ? id("webpage") : canonical,
|
|
875
|
-
...author ? { author: author.id ? { "@id": author.id } : {
|
|
876
|
-
...
|
|
966
|
+
...author ? { author: { "@type": "Person", ...author.id ? { "@id": author.id } : {}, name: author.name, ...author.url ? { url: author.url } : {} } } : {},
|
|
967
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
877
968
|
inLanguage: pub.locale,
|
|
878
|
-
...imageUrl ? { image: [imageUrl] } : {}
|
|
969
|
+
...imageUrl ? { image: imageWidth && imageHeight ? { "@type": "ImageObject", url: imageUrl, width: imageWidth, height: imageHeight } : [imageUrl] } : {}
|
|
879
970
|
},
|
|
880
971
|
{
|
|
881
972
|
"@type": "BreadcrumbList",
|
|
882
973
|
...id("breadcrumb"),
|
|
883
|
-
itemListElement:
|
|
974
|
+
itemListElement: breadcrumbItems(article, jsonLd).map((b, i) => ({
|
|
975
|
+
"@type": "ListItem",
|
|
976
|
+
position: i + 1,
|
|
977
|
+
name: b.title,
|
|
978
|
+
item: absoluteUrl(origin, crumbHref(href, b.canonical_path, pub.locale).replace(/^\/$/, ""))
|
|
979
|
+
}))
|
|
884
980
|
}
|
|
885
981
|
];
|
|
886
982
|
return script({ "@context": "https://schema.org", "@graph": graph });
|
|
887
983
|
}
|
|
888
|
-
function listJsonLd({ list, origin, href, path, locale, description }) {
|
|
984
|
+
function listJsonLd({ list, origin, href, path, locale, description, jsonLd, cursor }) {
|
|
985
|
+
const url = absoluteUrl(origin, href(path)) + (cursor ? `?cursor=${cursor}` : "");
|
|
986
|
+
const website = jsonLd?.website?.(locale);
|
|
889
987
|
return script({
|
|
890
988
|
"@context": "https://schema.org",
|
|
891
989
|
"@type": "CollectionPage",
|
|
892
|
-
url:
|
|
990
|
+
...jsonLd ? { "@id": `${url}#webpage` } : {},
|
|
991
|
+
url,
|
|
992
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
993
|
+
...jsonLd?.publisher ? { publisher: organization(jsonLd.publisher) } : {},
|
|
893
994
|
name: list.section.title,
|
|
894
995
|
...description ? { description } : {},
|
|
895
996
|
inLanguage: locale,
|
|
@@ -901,13 +1002,13 @@ function listJsonLd({ list, origin, href, path, locale, description }) {
|
|
|
901
1002
|
}
|
|
902
1003
|
|
|
903
1004
|
// src/react/pages.tsx
|
|
904
|
-
var
|
|
1005
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
905
1006
|
function Slot({ name, slots, tag: Tag = "div", className }) {
|
|
906
1007
|
const fill = slots?.[name];
|
|
907
|
-
return fill ? /* @__PURE__ */ (0,
|
|
1008
|
+
return fill ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tag, { "data-slot": name, className, children: fill }) : null;
|
|
908
1009
|
}
|
|
909
1010
|
function Shell({ children }) {
|
|
910
|
-
return /* @__PURE__ */ (0,
|
|
1011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle-page", children }) });
|
|
911
1012
|
}
|
|
912
1013
|
function ctx(p, fallbackLocale) {
|
|
913
1014
|
const locale = p.locale ?? fallbackLocale;
|
|
@@ -916,23 +1017,32 @@ function ctx(p, fallbackLocale) {
|
|
|
916
1017
|
function Pager({ prev, next, c }) {
|
|
917
1018
|
if (!prev && !next) return null;
|
|
918
1019
|
const { Link, s } = c;
|
|
919
|
-
return /* @__PURE__ */ (0,
|
|
920
|
-
prev ? /* @__PURE__ */ (0,
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
1020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("nav", { className: "hyle-pager", "aria-label": s.pager, children: [
|
|
1021
|
+
prev ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Link, { href: c.href(prev.canonical_path), rel: "prev", children: [
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dir", children: [
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev-left" }),
|
|
923
1024
|
s.prev
|
|
924
1025
|
] }),
|
|
925
|
-
/* @__PURE__ */ (0,
|
|
926
|
-
] }) : /* @__PURE__ */ (0,
|
|
927
|
-
next ? /* @__PURE__ */ (0,
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ttl", children: prev.title })
|
|
1027
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "none", "aria-hidden": "true" }),
|
|
1028
|
+
next ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Link, { href: c.href(next.canonical_path), rel: "next", className: "next", children: [
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dir", children: [
|
|
929
1030
|
s.next,
|
|
930
|
-
/* @__PURE__ */ (0,
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev" })
|
|
931
1032
|
] }),
|
|
932
|
-
/* @__PURE__ */ (0,
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ttl", children: next.title })
|
|
933
1034
|
] }) : null
|
|
934
1035
|
] });
|
|
935
1036
|
}
|
|
1037
|
+
function OlderNav({ href, c }) {
|
|
1038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("nav", { className: "hyle-pagination", "aria-label": c.s.pager, children: [
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sp" }),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(c.Link, { className: "hyle-btn sm", href, rel: "next", children: [
|
|
1041
|
+
c.s.older,
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev" })
|
|
1043
|
+
] })
|
|
1044
|
+
] });
|
|
1045
|
+
}
|
|
936
1046
|
function TocList({ toc }) {
|
|
937
1047
|
const groups = [];
|
|
938
1048
|
for (const entry of toc) {
|
|
@@ -940,9 +1050,9 @@ function TocList({ toc }) {
|
|
|
940
1050
|
if (entry.depth === 3 && last) last.subs.push(entry);
|
|
941
1051
|
else groups.push({ entry, subs: [] });
|
|
942
1052
|
}
|
|
943
|
-
return /* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
945
|
-
subs.length > 0 ? /* @__PURE__ */ (0,
|
|
1053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: groups.map(({ entry, subs }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { children: [
|
|
1054
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: `#${scopeId(entry.id)}`, children: entry.text }),
|
|
1055
|
+
subs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: subs.map((sub) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: `#${scopeId(sub.id)}`, children: sub.text }) }, sub.id)) }) : null
|
|
946
1056
|
] }, entry.id)) });
|
|
947
1057
|
}
|
|
948
1058
|
function Toc({ toc, c, aside }) {
|
|
@@ -950,18 +1060,18 @@ function Toc({ toc, c, aside }) {
|
|
|
950
1060
|
if (entries.length === 0 && !aside) return { narrow: null, wide: null };
|
|
951
1061
|
const { s } = c;
|
|
952
1062
|
return {
|
|
953
|
-
narrow: entries.length === 0 ? null : /* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
1063
|
+
narrow: entries.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "hyle-toc-m", children: [
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { children: [
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file" }),
|
|
956
1066
|
s.toc,
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
958
1068
|
] }),
|
|
959
|
-
/* @__PURE__ */ (0,
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "hyle-toc-list", "aria-label": s.toc, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TocList, { toc: entries }) })
|
|
960
1070
|
] }),
|
|
961
|
-
wide: /* @__PURE__ */ (0,
|
|
962
|
-
entries.length === 0 ? null : /* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
1071
|
+
wide: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "hyle-toc-d", "aria-label": s.toc, children: [
|
|
1072
|
+
entries.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-toc-title", children: s.toc }),
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "hyle-toc-list", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TocList, { toc: entries }) })
|
|
965
1075
|
] }),
|
|
966
1076
|
aside
|
|
967
1077
|
] })
|
|
@@ -969,76 +1079,97 @@ function Toc({ toc, c, aside }) {
|
|
|
969
1079
|
}
|
|
970
1080
|
function Body({ article, components, locale }) {
|
|
971
1081
|
const { content, publication } = article;
|
|
972
|
-
return /* @__PURE__ */ (0,
|
|
1082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : content.format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TrustedServerHtml, { html: content.html }) : null });
|
|
973
1083
|
}
|
|
974
1084
|
function Languages({ alternates, current, c }) {
|
|
975
1085
|
if (alternates.length < 2) return null;
|
|
976
1086
|
const { Link, s } = c;
|
|
977
|
-
return /* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
1087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("nav", { className: "hyle-langs", "aria-label": s.languages, children: [
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: s.readIn }),
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: alternates.map((a) => {
|
|
980
1090
|
const label = languageName(a.locale, a.locale);
|
|
981
|
-
return /* @__PURE__ */ (0,
|
|
1091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: a.locale === current ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, "aria-current": "true", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: c.href(a.canonical_path, a.locale), hrefLang: a.locale, lang: a.locale, children: label }) }, a.locale);
|
|
982
1092
|
}) })
|
|
983
1093
|
] });
|
|
984
1094
|
}
|
|
985
1095
|
function LdScript({ json }) {
|
|
986
|
-
return /* @__PURE__ */ (0,
|
|
1096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } });
|
|
987
1097
|
}
|
|
988
|
-
function
|
|
1098
|
+
function Crumbs({ items, c }) {
|
|
1099
|
+
const { Link } = c;
|
|
1100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "hyle-crumbs", "aria-label": c.s.crumbs, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ol", { children: items.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { "aria-current": i === items.length - 1 ? "page" : void 0, children: i === items.length - 1 ? b.title : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: crumbHref(c.href, b.canonical_path, c.locale), children: b.title }) }, b.canonical_path)) }) });
|
|
1101
|
+
}
|
|
1102
|
+
function ArticlePage({ article, engagement, origin, jsonLd, imageUrl, imageWidth, imageHeight, related, ...base }) {
|
|
989
1103
|
const { publication: pub } = article;
|
|
990
1104
|
const c = ctx(base, pub.locale);
|
|
991
1105
|
const { s } = c;
|
|
992
1106
|
const jsonLdOrigin = bareOrigin(origin);
|
|
993
1107
|
const author = articleAuthor(article, jsonLd)?.name;
|
|
994
|
-
const
|
|
1108
|
+
const modified = modifiedAt(pub);
|
|
1109
|
+
const words = wordCountOf(pub);
|
|
1110
|
+
const toc = Toc({ toc: article.toc, c, aside: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "article.aside", slots: base.slots, className: "hyle-slot-wrap" }) });
|
|
995
1111
|
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
996
|
-
return /* @__PURE__ */ (0,
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
999
|
-
/* @__PURE__ */ (0,
|
|
1000
|
-
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1005
|
-
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { className: "hyle-article", "data-hyle-page": "article", lang: c.locale, children: [
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "hyle-head", children: [
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "article.before", slots: base.slots, className: "hyle-eyebrow" }),
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Crumbs, { items: breadcrumbItems(article, jsonLd), c }),
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { className: "hyle-title", children: pub.title }),
|
|
1117
|
+
pub.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-meta", children: [
|
|
1119
|
+
author ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "hyle-avatar", "aria-hidden": "true", children: author.slice(0, 2).toUpperCase() }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "hyle-sr", children: [
|
|
1006
1123
|
s.by,
|
|
1007
1124
|
" "
|
|
1008
1125
|
] }),
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "by", children: author })
|
|
1010
1127
|
] })
|
|
1011
1128
|
] }) : null,
|
|
1012
|
-
/* @__PURE__ */ (0,
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "calendar" }),
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) })
|
|
1015
1132
|
] }),
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1018
|
-
|
|
1133
|
+
modified ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "calendar" }),
|
|
1135
|
+
s.updated,
|
|
1136
|
+
" ",
|
|
1137
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: modified, title: modified, children: formatDate(modified, c.locale) })
|
|
1138
|
+
] }) : null,
|
|
1139
|
+
words ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "clock" }),
|
|
1141
|
+
s.readingTime.replace("{n}", String(readingMinutes(words)))
|
|
1142
|
+
] }) : null,
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "globe" }),
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { lang: pub.locale, children: languageName(pub.locale, c.locale) })
|
|
1019
1146
|
] }),
|
|
1020
|
-
/* @__PURE__ */ (0,
|
|
1147
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "article.meta", slots: base.slots, tag: "span" })
|
|
1021
1148
|
] }),
|
|
1022
|
-
/* @__PURE__ */ (0,
|
|
1023
|
-
notTranslated ? /* @__PURE__ */ (0,
|
|
1024
|
-
/* @__PURE__ */ (0,
|
|
1025
|
-
/* @__PURE__ */ (0,
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Languages, { alternates: article.alternates, current: pub.locale, c }),
|
|
1150
|
+
notTranslated ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "alert" }),
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: notTranslated }),
|
|
1027
1154
|
" ",
|
|
1028
1155
|
s.fallbackBody
|
|
1029
1156
|
] })
|
|
1030
1157
|
] }) : null
|
|
1031
1158
|
] }),
|
|
1032
1159
|
toc.narrow,
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
engagement ? /* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Body, { article, components: base.components, locale: c.locale }),
|
|
1161
|
+
engagement ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_comments.Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Pager, { prev: article.prev, next: article.next, c }),
|
|
1163
|
+
related ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1164
|
+
related.items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HyleListView, { items: related.items, title: related.title ?? s.moreInSection, ...base, locale: c.locale }) : null,
|
|
1165
|
+
article.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HyleListView, { items: article.children.map((child) => ({ ...child, description: null, published_at: "" })), title: s.subPages, ...base, locale: c.locale }) : null
|
|
1166
|
+
] }) : null,
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
|
|
1037
1168
|
toc.wide,
|
|
1038
|
-
jsonLdOrigin ? /* @__PURE__ */ (0,
|
|
1169
|
+
jsonLdOrigin ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LdScript, { json: articleJsonLd({ article, origin: jsonLdOrigin, href: c.href, jsonLd, imageUrl, imageWidth, imageHeight }) }) : null
|
|
1039
1170
|
] }) });
|
|
1040
1171
|
}
|
|
1041
|
-
function ListPage({ list, olderHref, description, origin, path, ...base }) {
|
|
1172
|
+
function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }) {
|
|
1042
1173
|
const c = ctx(base, "en");
|
|
1043
1174
|
const { s, Link } = c;
|
|
1044
1175
|
const Row = base.slots?.["list.item"];
|
|
@@ -1046,139 +1177,91 @@ function ListPage({ list, olderHref, description, origin, path, ...base }) {
|
|
|
1046
1177
|
for (const item of list.items) groups.set(item.published_at.slice(0, 7), [...groups.get(item.published_at.slice(0, 7)) ?? [], item]);
|
|
1047
1178
|
const notTranslated = list.fallback ? s.fallbackTitle.replace("{language}", languageName(list.fallback.requested_locale, c.locale)) : void 0;
|
|
1048
1179
|
const jsonLdOrigin = bareOrigin(origin);
|
|
1049
|
-
return /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__PURE__ */ (0,
|
|
1052
|
-
description ? /* @__PURE__ */ (0,
|
|
1053
|
-
/* @__PURE__ */ (0,
|
|
1054
|
-
notTranslated ? /* @__PURE__ */ (0,
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1056
|
-
/* @__PURE__ */ (0,
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-listpage", "data-hyle-page": "list", lang: c.locale, children: [
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "hyle-head", children: [
|
|
1182
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { className: "hyle-title", children: list.section.title }),
|
|
1183
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: description }) : null,
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "list.header", slots: base.slots, className: "hyle-slot-wrap" }),
|
|
1185
|
+
notTranslated ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
1186
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "alert" }),
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1188
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: notTranslated }),
|
|
1058
1189
|
" ",
|
|
1059
1190
|
s.fallbackBody
|
|
1060
1191
|
] })
|
|
1061
1192
|
] }) : null
|
|
1062
1193
|
] }),
|
|
1063
|
-
list.items.length === 0 ? /* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
item.description ? /* @__PURE__ */ (0,
|
|
1194
|
+
list.items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-empty", "data-slot-state": "empty", children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file" }),
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: s.emptyTitle }),
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: s.emptyBody }),
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "list.empty", slots: base.slots })
|
|
1199
|
+
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }), children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "hyle-year", children: formatDate(`${month}-01`, c.locale, { month: "long", year: "numeric" }) }),
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "hyle-items", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: Row ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "t", children: item.title }),
|
|
1205
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: item.description }) : null
|
|
1075
1206
|
] })
|
|
1076
1207
|
] }) }, item.canonical_path)) })
|
|
1077
1208
|
] }, month)),
|
|
1078
|
-
olderHref ? /* @__PURE__ */ (0,
|
|
1079
|
-
|
|
1080
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Link, { className: "hyle-btn sm", href: olderHref, rel: "next", children: [
|
|
1081
|
-
s.older,
|
|
1082
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "chev" })
|
|
1083
|
-
] })
|
|
1084
|
-
] }) : null,
|
|
1085
|
-
jsonLdOrigin && path ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LdScript, { json: listJsonLd({ list, origin: jsonLdOrigin, href: c.href, path, locale: c.locale, description }) }) : null
|
|
1209
|
+
olderHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OlderNav, { href: olderHref, c }) : null,
|
|
1210
|
+
jsonLdOrigin && path ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LdScript, { json: listJsonLd({ list, origin: jsonLdOrigin, href: c.href, path, locale: c.locale, description, jsonLd, cursor }) }) : null
|
|
1086
1211
|
] }) });
|
|
1087
1212
|
}
|
|
1088
1213
|
function NotFound({ path, homeHref = "/", ...base }) {
|
|
1089
1214
|
const c = ctx(base, "en");
|
|
1090
1215
|
const { Link, s } = c;
|
|
1091
1216
|
const body = base.slots?.["notfound.body"];
|
|
1092
|
-
return /* @__PURE__ */ (0,
|
|
1093
|
-
/* @__PURE__ */ (0,
|
|
1094
|
-
/* @__PURE__ */ (0,
|
|
1095
|
-
body ? /* @__PURE__ */ (0,
|
|
1096
|
-
path ? /* @__PURE__ */ (0,
|
|
1097
|
-
/* @__PURE__ */ (0,
|
|
1098
|
-
/* @__PURE__ */ (0,
|
|
1217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "hyle-state", "data-hyle-page": "not-found", lang: c.locale, children: [
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kind", children: s.nfKind }),
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: s.nfTitle }),
|
|
1220
|
+
body ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-slot": "notfound.body", children: body }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: s.nfBody }),
|
|
1221
|
+
path ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dl", { className: "hyle-addr", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: s.path }),
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: path })
|
|
1099
1224
|
] }) }) : null,
|
|
1100
|
-
/* @__PURE__ */ (0,
|
|
1101
|
-
/* @__PURE__ */ (0,
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-actions", children: [
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { className: "hyle-btn primary", href: crumbHref(c.href, homeHref, c.locale), children: s.home }),
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "notfound.actions", slots: base.slots, tag: "span" })
|
|
1103
1228
|
] })
|
|
1104
1229
|
] }) });
|
|
1105
1230
|
}
|
|
1106
1231
|
function Unavailable(base) {
|
|
1107
1232
|
const c = ctx(base, "en");
|
|
1108
|
-
return /* @__PURE__ */ (0,
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1110
|
-
/* @__PURE__ */ (0,
|
|
1111
|
-
/* @__PURE__ */ (0,
|
|
1233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "hyle-state", "data-hyle-page": "unavailable", lang: c.locale, role: "status", children: [
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kind", children: c.s.unKind }),
|
|
1235
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: c.s.unTitle }),
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: c.s.unBody })
|
|
1112
1237
|
] }) });
|
|
1113
1238
|
}
|
|
1114
1239
|
function Redirecting({ from, to, ...base }) {
|
|
1115
1240
|
const c = ctx(base, "en");
|
|
1116
1241
|
const { Link, s } = c;
|
|
1117
1242
|
const extra = base.slots?.["redirecting.body"];
|
|
1118
|
-
return /* @__PURE__ */ (0,
|
|
1119
|
-
/* @__PURE__ */ (0,
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1122
|
-
/* @__PURE__ */ (0,
|
|
1123
|
-
from ? /* @__PURE__ */ (0,
|
|
1124
|
-
/* @__PURE__ */ (0,
|
|
1125
|
-
/* @__PURE__ */ (0,
|
|
1243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "hyle-state", "data-hyle-page": "redirecting", role: "status", lang: c.locale, children: [
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "kind", children: s.rdKind }),
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: s.rdTitle }),
|
|
1246
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: s.rdBody }),
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dl", { className: "hyle-addr", children: [
|
|
1248
|
+
from ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: s.from }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: from })
|
|
1126
1251
|
] }) : null,
|
|
1127
|
-
/* @__PURE__ */ (0,
|
|
1128
|
-
/* @__PURE__ */ (0,
|
|
1129
|
-
/* @__PURE__ */ (0,
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { children: s.to }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { children: to })
|
|
1130
1255
|
] })
|
|
1131
1256
|
] }),
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1133
|
-
extra ? /* @__PURE__ */ (0,
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fine", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: c.href(to), children: s.rdFallback }) }),
|
|
1258
|
+
extra ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { "data-slot": "redirecting.body", className: "fine", children: extra }) : null
|
|
1134
1259
|
] }) });
|
|
1135
1260
|
}
|
|
1136
1261
|
|
|
1137
1262
|
// src/react/index.ts
|
|
1138
1263
|
var import_comments2 = require("./comments.cjs");
|
|
1139
1264
|
|
|
1140
|
-
// src/react/embed.tsx
|
|
1141
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1142
|
-
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, ...base }) {
|
|
1143
|
-
const c = ctx(base, "en");
|
|
1144
|
-
const { s, Link } = c;
|
|
1145
|
-
const Row = base.slots?.["list.item"];
|
|
1146
|
-
const Heading = `h${headingLevel}`;
|
|
1147
|
-
const safe = items.filter((item) => item.canonical_path.startsWith("/"));
|
|
1148
|
-
if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle hyle-embed", "data-layout": layout, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "list.empty", slots: base.slots }) }) : null;
|
|
1149
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
|
|
1150
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: title }) : null,
|
|
1151
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "hyle-items", children: safe.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: Row ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
|
|
1152
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
1153
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1154
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "t", children: item.title }),
|
|
1155
|
-
item.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: item.description }) : null
|
|
1156
|
-
] })
|
|
1157
|
-
] }) }, item.canonical_path)) }),
|
|
1158
|
-
moreHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
|
|
1159
|
-
] });
|
|
1160
|
-
}
|
|
1161
|
-
function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
1162
|
-
const { publication: pub } = article;
|
|
1163
|
-
const c = ctx(base, pub.locale);
|
|
1164
|
-
const Heading = `h${headingLevel}`;
|
|
1165
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { lang: c.locale, children: [
|
|
1166
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "hyle-head", children: [
|
|
1167
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: pub.title }),
|
|
1168
|
-
pub.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle-meta", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) }) }) })
|
|
1170
|
-
] }),
|
|
1171
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Body, { article, components: base.components, locale: c.locale }),
|
|
1172
|
-
pub.canonical_path.startsWith("/") ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("a", { className: "hyle-more", href: c.href(pub.canonical_path, pub.locale), rel: "bookmark", children: [
|
|
1173
|
-
c.s.readAtSource,
|
|
1174
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "hyle-sr", children: [
|
|
1175
|
-
": ",
|
|
1176
|
-
pub.title
|
|
1177
|
-
] })
|
|
1178
|
-
] }) : null
|
|
1179
|
-
] }) });
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
1265
|
// src/react/docs.tsx
|
|
1183
1266
|
var import_docs_enhance = require("./docs-enhance.cjs");
|
|
1184
1267
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|