@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
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}`;
|
|
@@ -824,13 +856,159 @@ var import_mermaid_diagram2 = require("./mermaid-diagram.cjs");
|
|
|
824
856
|
|
|
825
857
|
// src/react/pages.tsx
|
|
826
858
|
var import_comments = require("./comments.cjs");
|
|
859
|
+
|
|
860
|
+
// src/react/embed.tsx
|
|
827
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
|
+
|
|
903
|
+
// src/react/seo.ts
|
|
904
|
+
var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
|
|
905
|
+
var bareOrigin = (origin) => origin && BARE_HTTPS_ORIGIN.test(origin) ? origin : void 0;
|
|
906
|
+
var absoluteUrl = (origin, href) => origin + encodeURI(href);
|
|
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);
|
|
916
|
+
function articleAuthor(article, jsonLd) {
|
|
917
|
+
const authored = article.publication.author;
|
|
918
|
+
if (authored?.name) return { name: authored.name, ...authored.url ? { url: authored.url } : {} };
|
|
919
|
+
const given = jsonLd?.author?.(article);
|
|
920
|
+
if (given && typeof given.name === "string" && given.name) return given;
|
|
921
|
+
const fromFrontmatter = article.frontmatter.author;
|
|
922
|
+
return typeof fromFrontmatter === "string" && fromFrontmatter ? { name: fromFrontmatter } : void 0;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// src/react/jsonld.ts
|
|
926
|
+
var script = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
|
|
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 }) {
|
|
930
|
+
const { publication: pub } = article;
|
|
931
|
+
const url = (path) => absoluteUrl(origin, href(path, pub.locale));
|
|
932
|
+
const canonical = url(pub.canonical_path);
|
|
933
|
+
const id = (fragment) => ({ "@id": `${canonical}#${fragment}` });
|
|
934
|
+
const full = jsonLd !== void 0;
|
|
935
|
+
const author = articleAuthor(article, jsonLd);
|
|
936
|
+
const publisher = jsonLd?.publisher;
|
|
937
|
+
const website = jsonLd?.website?.(pub.locale);
|
|
938
|
+
const modified = modifiedAt(pub);
|
|
939
|
+
const words = wordCountOf(pub);
|
|
940
|
+
const publisherNode = publisher ? organization(publisher) : void 0;
|
|
941
|
+
const section = article.breadcrumbs[0]?.title;
|
|
942
|
+
const graph = [
|
|
943
|
+
...full ? [{
|
|
944
|
+
"@type": "WebPage",
|
|
945
|
+
...id("webpage"),
|
|
946
|
+
url: canonical,
|
|
947
|
+
name: pub.title,
|
|
948
|
+
...pub.description ? { description: pub.description } : {},
|
|
949
|
+
inLanguage: pub.locale,
|
|
950
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
951
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
952
|
+
breadcrumb: id("breadcrumb"),
|
|
953
|
+
mainEntity: id("article")
|
|
954
|
+
}] : [],
|
|
955
|
+
{
|
|
956
|
+
"@type": "BlogPosting",
|
|
957
|
+
...id("article"),
|
|
958
|
+
headline: pub.title,
|
|
959
|
+
...pub.description ? { description: pub.description } : {},
|
|
960
|
+
datePublished: pub.published_at,
|
|
961
|
+
...section ? { articleSection: section } : {},
|
|
962
|
+
...modified ? { dateModified: modified } : {},
|
|
963
|
+
...words ? { wordCount: words } : {},
|
|
964
|
+
url: canonical,
|
|
965
|
+
mainEntityOfPage: full ? id("webpage") : canonical,
|
|
966
|
+
...author ? { author: { "@type": "Person", ...author.id ? { "@id": author.id } : {}, name: author.name, ...author.url ? { url: author.url } : {} } } : {},
|
|
967
|
+
...publisherNode ? { publisher: publisherNode } : {},
|
|
968
|
+
inLanguage: pub.locale,
|
|
969
|
+
...imageUrl ? { image: imageWidth && imageHeight ? { "@type": "ImageObject", url: imageUrl, width: imageWidth, height: imageHeight } : [imageUrl] } : {}
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"@type": "BreadcrumbList",
|
|
973
|
+
...id("breadcrumb"),
|
|
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
|
+
}))
|
|
980
|
+
}
|
|
981
|
+
];
|
|
982
|
+
return script({ "@context": "https://schema.org", "@graph": graph });
|
|
983
|
+
}
|
|
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);
|
|
987
|
+
return script({
|
|
988
|
+
"@context": "https://schema.org",
|
|
989
|
+
"@type": "CollectionPage",
|
|
990
|
+
...jsonLd ? { "@id": `${url}#webpage` } : {},
|
|
991
|
+
url,
|
|
992
|
+
...website ? { isPartOf: webSite(website) } : {},
|
|
993
|
+
...jsonLd?.publisher ? { publisher: organization(jsonLd.publisher) } : {},
|
|
994
|
+
name: list.section.title,
|
|
995
|
+
...description ? { description } : {},
|
|
996
|
+
inLanguage: locale,
|
|
997
|
+
mainEntity: {
|
|
998
|
+
"@type": "ItemList",
|
|
999
|
+
itemListElement: list.items.map((item, i) => ({ "@type": "ListItem", position: i + 1, url: absoluteUrl(origin, href(item.canonical_path)), name: item.title }))
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// src/react/pages.tsx
|
|
1005
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
828
1006
|
function Slot({ name, slots, tag: Tag = "div", className }) {
|
|
829
1007
|
const fill = slots?.[name];
|
|
830
|
-
return fill ? /* @__PURE__ */ (0,
|
|
1008
|
+
return fill ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tag, { "data-slot": name, className, children: fill }) : null;
|
|
831
1009
|
}
|
|
832
1010
|
function Shell({ children }) {
|
|
833
|
-
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 }) });
|
|
834
1012
|
}
|
|
835
1013
|
function ctx(p, fallbackLocale) {
|
|
836
1014
|
const locale = p.locale ?? fallbackLocale;
|
|
@@ -839,23 +1017,32 @@ function ctx(p, fallbackLocale) {
|
|
|
839
1017
|
function Pager({ prev, next, c }) {
|
|
840
1018
|
if (!prev && !next) return null;
|
|
841
1019
|
const { Link, s } = c;
|
|
842
|
-
return /* @__PURE__ */ (0,
|
|
843
|
-
prev ? /* @__PURE__ */ (0,
|
|
844
|
-
/* @__PURE__ */ (0,
|
|
845
|
-
/* @__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" }),
|
|
846
1024
|
s.prev
|
|
847
1025
|
] }),
|
|
848
|
-
/* @__PURE__ */ (0,
|
|
849
|
-
] }) : /* @__PURE__ */ (0,
|
|
850
|
-
next ? /* @__PURE__ */ (0,
|
|
851
|
-
/* @__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: [
|
|
852
1030
|
s.next,
|
|
853
|
-
/* @__PURE__ */ (0,
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev" })
|
|
854
1032
|
] }),
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ttl", children: next.title })
|
|
856
1034
|
] }) : null
|
|
857
1035
|
] });
|
|
858
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
|
+
}
|
|
859
1046
|
function TocList({ toc }) {
|
|
860
1047
|
const groups = [];
|
|
861
1048
|
for (const entry of toc) {
|
|
@@ -863,9 +1050,9 @@ function TocList({ toc }) {
|
|
|
863
1050
|
if (entry.depth === 3 && last) last.subs.push(entry);
|
|
864
1051
|
else groups.push({ entry, subs: [] });
|
|
865
1052
|
}
|
|
866
|
-
return /* @__PURE__ */ (0,
|
|
867
|
-
/* @__PURE__ */ (0,
|
|
868
|
-
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
|
|
869
1056
|
] }, entry.id)) });
|
|
870
1057
|
}
|
|
871
1058
|
function Toc({ toc, c, aside }) {
|
|
@@ -873,18 +1060,18 @@ function Toc({ toc, c, aside }) {
|
|
|
873
1060
|
if (entries.length === 0 && !aside) return { narrow: null, wide: null };
|
|
874
1061
|
const { s } = c;
|
|
875
1062
|
return {
|
|
876
|
-
narrow: entries.length === 0 ? null : /* @__PURE__ */ (0,
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
878
|
-
/* @__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" }),
|
|
879
1066
|
s.toc,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
881
1068
|
] }),
|
|
882
|
-
/* @__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 }) })
|
|
883
1070
|
] }),
|
|
884
|
-
wide: /* @__PURE__ */ (0,
|
|
885
|
-
entries.length === 0 ? null : /* @__PURE__ */ (0,
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
887
|
-
/* @__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 }) })
|
|
888
1075
|
] }),
|
|
889
1076
|
aside
|
|
890
1077
|
] })
|
|
@@ -892,236 +1079,189 @@ function Toc({ toc, c, aside }) {
|
|
|
892
1079
|
}
|
|
893
1080
|
function Body({ article, components, locale }) {
|
|
894
1081
|
const { content, publication } = article;
|
|
895
|
-
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 });
|
|
896
1083
|
}
|
|
897
1084
|
function Languages({ alternates, current, c }) {
|
|
898
1085
|
if (alternates.length < 2) return null;
|
|
899
1086
|
const { Link, s } = c;
|
|
900
|
-
return /* @__PURE__ */ (0,
|
|
901
|
-
/* @__PURE__ */ (0,
|
|
902
|
-
/* @__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) => {
|
|
903
1090
|
const label = languageName(a.locale, a.locale);
|
|
904
|
-
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);
|
|
905
1092
|
}) })
|
|
906
1093
|
] });
|
|
907
1094
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
const { publication: pub } = article;
|
|
911
|
-
const url = (path) => origin + encodeURI(c.href(path, pub.locale));
|
|
912
|
-
const graph = {
|
|
913
|
-
"@context": "https://schema.org",
|
|
914
|
-
"@graph": [
|
|
915
|
-
{
|
|
916
|
-
"@type": "BlogPosting",
|
|
917
|
-
headline: pub.title,
|
|
918
|
-
...pub.description ? { description: pub.description } : {},
|
|
919
|
-
datePublished: pub.published_at,
|
|
920
|
-
// a save before the publish leaves updated_at earlier than published_at; dateModified before datePublished is invalid
|
|
921
|
-
...pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? { dateModified: pub.updated_at } : {},
|
|
922
|
-
...author ? { author: { "@type": "Person", name: author } } : {},
|
|
923
|
-
inLanguage: pub.locale,
|
|
924
|
-
mainEntityOfPage: url(pub.canonical_path)
|
|
925
|
-
},
|
|
926
|
-
{
|
|
927
|
-
"@type": "BreadcrumbList",
|
|
928
|
-
itemListElement: article.breadcrumbs.map((b, i) => ({ "@type": "ListItem", position: i + 1, name: b.title, item: url(b.canonical_path) }))
|
|
929
|
-
}
|
|
930
|
-
]
|
|
931
|
-
};
|
|
932
|
-
return JSON.stringify(graph).replace(/</g, "\\u003c");
|
|
1095
|
+
function LdScript({ json }) {
|
|
1096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: json } });
|
|
933
1097
|
}
|
|
934
|
-
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 }) {
|
|
935
1103
|
const { publication: pub } = article;
|
|
936
1104
|
const c = ctx(base, pub.locale);
|
|
937
1105
|
const { s } = c;
|
|
938
|
-
const
|
|
939
|
-
const
|
|
1106
|
+
const jsonLdOrigin = bareOrigin(origin);
|
|
1107
|
+
const author = articleAuthor(article, jsonLd)?.name;
|
|
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" }) });
|
|
940
1111
|
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
941
|
-
return /* @__PURE__ */ (0,
|
|
942
|
-
/* @__PURE__ */ (0,
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
945
|
-
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
/* @__PURE__ */ (0,
|
|
950
|
-
|
|
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: [
|
|
951
1123
|
s.by,
|
|
952
1124
|
" "
|
|
953
1125
|
] }),
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "by", children: author })
|
|
955
1127
|
] })
|
|
956
1128
|
] }) : null,
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
958
|
-
/* @__PURE__ */ (0,
|
|
959
|
-
/* @__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) })
|
|
960
1132
|
] }),
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
962
|
-
/* @__PURE__ */ (0,
|
|
963
|
-
|
|
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) })
|
|
964
1146
|
] }),
|
|
965
|
-
/* @__PURE__ */ (0,
|
|
1147
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "article.meta", slots: base.slots, tag: "span" })
|
|
966
1148
|
] }),
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
notTranslated ? /* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
/* @__PURE__ */ (0,
|
|
971
|
-
/* @__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 }),
|
|
972
1154
|
" ",
|
|
973
1155
|
s.fallbackBody
|
|
974
1156
|
] })
|
|
975
1157
|
] }) : null
|
|
976
1158
|
] }),
|
|
977
1159
|
toc.narrow,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
engagement ? /* @__PURE__ */ (0,
|
|
980
|
-
/* @__PURE__ */ (0,
|
|
981
|
-
/* @__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" }),
|
|
982
1168
|
toc.wide,
|
|
983
|
-
|
|
1169
|
+
jsonLdOrigin ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LdScript, { json: articleJsonLd({ article, origin: jsonLdOrigin, href: c.href, jsonLd, imageUrl, imageWidth, imageHeight }) }) : null
|
|
984
1170
|
] }) });
|
|
985
1171
|
}
|
|
986
|
-
function ListPage({ list, olderHref, description, ...base }) {
|
|
1172
|
+
function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }) {
|
|
987
1173
|
const c = ctx(base, "en");
|
|
988
1174
|
const { s, Link } = c;
|
|
989
1175
|
const Row = base.slots?.["list.item"];
|
|
990
1176
|
const groups = /* @__PURE__ */ new Map();
|
|
991
1177
|
for (const item of list.items) groups.set(item.published_at.slice(0, 7), [...groups.get(item.published_at.slice(0, 7)) ?? [], item]);
|
|
992
1178
|
const notTranslated = list.fallback ? s.fallbackTitle.replace("{language}", languageName(list.fallback.requested_locale, c.locale)) : void 0;
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
|
|
1179
|
+
const jsonLdOrigin = bareOrigin(origin);
|
|
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 }),
|
|
1002
1189
|
" ",
|
|
1003
1190
|
s.fallbackBody
|
|
1004
1191
|
] })
|
|
1005
1192
|
] }) : null
|
|
1006
1193
|
] }),
|
|
1007
|
-
list.items.length === 0 ? /* @__PURE__ */ (0,
|
|
1008
|
-
/* @__PURE__ */ (0,
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1010
|
-
/* @__PURE__ */ (0,
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1012
|
-
] }) : [...groups].map(([month, items]) => /* @__PURE__ */ (0,
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1018
|
-
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
|
|
1019
1206
|
] })
|
|
1020
1207
|
] }) }, item.canonical_path)) })
|
|
1021
1208
|
] }, month)),
|
|
1022
|
-
olderHref ? /* @__PURE__ */ (0,
|
|
1023
|
-
|
|
1024
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Link, { className: "hyle-btn sm", href: olderHref, rel: "next", children: [
|
|
1025
|
-
s.older,
|
|
1026
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: "chev" })
|
|
1027
|
-
] })
|
|
1028
|
-
] }) : 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
|
|
1029
1211
|
] }) });
|
|
1030
1212
|
}
|
|
1031
1213
|
function NotFound({ path, homeHref = "/", ...base }) {
|
|
1032
1214
|
const c = ctx(base, "en");
|
|
1033
1215
|
const { Link, s } = c;
|
|
1034
1216
|
const body = base.slots?.["notfound.body"];
|
|
1035
|
-
return /* @__PURE__ */ (0,
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
body ? /* @__PURE__ */ (0,
|
|
1039
|
-
path ? /* @__PURE__ */ (0,
|
|
1040
|
-
/* @__PURE__ */ (0,
|
|
1041
|
-
/* @__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 })
|
|
1042
1224
|
] }) }) : null,
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
/* @__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" })
|
|
1046
1228
|
] })
|
|
1047
1229
|
] }) });
|
|
1048
1230
|
}
|
|
1049
1231
|
function Unavailable(base) {
|
|
1050
1232
|
const c = ctx(base, "en");
|
|
1051
|
-
return /* @__PURE__ */ (0,
|
|
1052
|
-
/* @__PURE__ */ (0,
|
|
1053
|
-
/* @__PURE__ */ (0,
|
|
1054
|
-
/* @__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 })
|
|
1055
1237
|
] }) });
|
|
1056
1238
|
}
|
|
1057
1239
|
function Redirecting({ from, to, ...base }) {
|
|
1058
1240
|
const c = ctx(base, "en");
|
|
1059
1241
|
const { Link, s } = c;
|
|
1060
1242
|
const extra = base.slots?.["redirecting.body"];
|
|
1061
|
-
return /* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
from ? /* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
/* @__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 })
|
|
1069
1251
|
] }) : null,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
/* @__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 })
|
|
1073
1255
|
] })
|
|
1074
1256
|
] }),
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
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
|
|
1077
1259
|
] }) });
|
|
1078
1260
|
}
|
|
1079
1261
|
|
|
1080
1262
|
// src/react/index.ts
|
|
1081
1263
|
var import_comments2 = require("./comments.cjs");
|
|
1082
1264
|
|
|
1083
|
-
// src/react/embed.tsx
|
|
1084
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1085
|
-
function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, ...base }) {
|
|
1086
|
-
const c = ctx(base, "en");
|
|
1087
|
-
const { s, Link } = c;
|
|
1088
|
-
const Row = base.slots?.["list.item"];
|
|
1089
|
-
const Heading = `h${headingLevel}`;
|
|
1090
|
-
const safe = items.filter((item) => item.canonical_path.startsWith("/"));
|
|
1091
|
-
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;
|
|
1092
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
|
|
1093
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: title }) : null,
|
|
1094
|
-
/* @__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: [
|
|
1095
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
|
|
1096
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1097
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "t", children: item.title }),
|
|
1098
|
-
item.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: item.description }) : null
|
|
1099
|
-
] })
|
|
1100
|
-
] }) }, item.canonical_path)) }),
|
|
1101
|
-
moreHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
|
|
1102
|
-
] });
|
|
1103
|
-
}
|
|
1104
|
-
function HyleArticleView({ article, headingLevel = 2, ...base }) {
|
|
1105
|
-
const { publication: pub } = article;
|
|
1106
|
-
const c = ctx(base, pub.locale);
|
|
1107
|
-
const Heading = `h${headingLevel}`;
|
|
1108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { lang: c.locale, children: [
|
|
1109
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "hyle-head", children: [
|
|
1110
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: pub.title }),
|
|
1111
|
-
pub.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
1112
|
-
/* @__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) }) }) })
|
|
1113
|
-
] }),
|
|
1114
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Body, { article, components: base.components, locale: c.locale }),
|
|
1115
|
-
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: [
|
|
1116
|
-
c.s.readAtSource,
|
|
1117
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "hyle-sr", children: [
|
|
1118
|
-
": ",
|
|
1119
|
-
pub.title
|
|
1120
|
-
] })
|
|
1121
|
-
] }) : null
|
|
1122
|
-
] }) });
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
1265
|
// src/react/docs.tsx
|
|
1126
1266
|
var import_docs_enhance = require("./docs-enhance.cjs");
|
|
1127
1267
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|