@tdacorp/hyle-sdk 0.9.0 → 0.11.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.
Files changed (37) hide show
  1. package/README.md +80 -2
  2. package/bin/hyle-sdk-engage-keygen.mjs +3 -0
  3. package/dist/check-routes-bin.js +5 -1
  4. package/dist/{chunk-54JF4E53.js → chunk-N7ZQUAGM.js} +45 -2
  5. package/dist/chunk-R5EMI4HQ.js +61 -0
  6. package/dist/{chunk-6LW33475.js → chunk-S3LT6G4M.js} +536 -50
  7. package/dist/{chunk-XKR74Y5G.js → chunk-S7PCCEHP.js} +1 -1
  8. package/dist/comments.cjs +1048 -0
  9. package/dist/comments.d.cts +152 -0
  10. package/dist/comments.d.ts +152 -0
  11. package/dist/comments.js +1025 -0
  12. package/dist/{types-C1eCQ2As.d.ts → embed-BC8Tlc6A.d.cts} +44 -3
  13. package/dist/{types-BPPZrYOZ.d.cts → embed-CwSzvBUO.d.ts} +44 -3
  14. package/dist/engage-keygen-bin.js +67 -0
  15. package/dist/index.cjs +26 -1
  16. package/dist/index.d.cts +11 -3
  17. package/dist/index.d.ts +11 -3
  18. package/dist/index.js +5 -1
  19. package/dist/mermaid-diagram.js +9 -54
  20. package/dist/next.cjs +940 -58
  21. package/dist/next.d.cts +149 -6
  22. package/dist/next.d.ts +149 -6
  23. package/dist/next.js +390 -11
  24. package/dist/react.cjs +339 -49
  25. package/dist/react.d.cts +112 -7
  26. package/dist/react.d.ts +112 -7
  27. package/dist/react.js +7 -1
  28. package/dist/{resolve-Dpb6Orsj.d.ts → resolve-BYL8jMg0.d.ts} +1 -1
  29. package/dist/{resolve-D2rnnho9.d.cts → resolve-Ra8-y2U-.d.cts} +1 -1
  30. package/dist/styles.css +117 -0
  31. package/dist/{types-CHxH5E0S.d.cts → types-C72FwzOd.d.cts} +57 -1
  32. package/dist/{types-CHxH5E0S.d.ts → types-C72FwzOd.d.ts} +57 -1
  33. package/dist/use-cache.cjs +5 -1
  34. package/dist/use-cache.d.cts +2 -2
  35. package/dist/use-cache.d.ts +2 -2
  36. package/dist/use-cache.js +2 -2
  37. package/package.json +4 -3
package/dist/react.cjs CHANGED
@@ -21,9 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var react_exports = {};
22
22
  __export(react_exports, {
23
23
  ArticlePage: () => ArticlePage,
24
+ Comments: () => import_comments2.Comments,
24
25
  DocsPage: () => DocsPage,
25
26
  HastContent: () => HastContent,
26
27
  HastLimitError: () => HastLimitError,
28
+ HyleArticleView: () => HyleArticleView,
29
+ HyleListView: () => HyleListView,
27
30
  ListPage: () => ListPage,
28
31
  MermaidDiagram: () => import_mermaid_diagram2.MermaidDiagram,
29
32
  NotFound: () => NotFound,
@@ -87,7 +90,18 @@ var SHAPES = {
87
90
  chev: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
88
91
  "chev-down": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
89
92
  "chev-left": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 3.5 5.5 8 10 12.5" }),
90
- x: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m4 4 8 8M12 4l-8 8" })
93
+ x: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m4 4 8 8M12 4l-8 8" }),
94
+ heart: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 13.5S2.2 10 2.2 6.1A3 3 0 0 1 8 5a3 3 0 0 1 5.8 1.1C13.8 10 8 13.5 8 13.5z" }),
95
+ reply: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.5 3.5 2.5 7.5l4 4M2.5 7.5h6a5 5 0 0 1 5 5" }),
96
+ clock: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 4.5V8l2.3 1.5" })
99
+ ] }),
100
+ ban: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.8 12.2 8.4-8.4" })
103
+ ] }),
104
+ refresh: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
91
105
  };
92
106
  function Icon({ name, className }) {
93
107
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
@@ -266,14 +280,205 @@ function clean(node, depth, ctx2, budget) {
266
280
  const tagName = tag === "h1" ? "h2" : tag;
267
281
  return [{ type: "element", tagName, properties, children: VOID.has(tag) ? [] : children }];
268
282
  }
269
- function sanitizeHast(tree, title) {
283
+ function sanitizeHast(tree, title, description) {
270
284
  const raw = isObject(tree) && tree.type === "root" && Array.isArray(tree.children) ? tree.children : [];
271
- const first = raw.find((n) => isObject(n) && n.type === "element");
285
+ const elements = raw.filter((n) => isObject(n) && n.type === "element");
286
+ const [first] = elements;
272
287
  const skip = title !== void 0 && isObject(first) && first.tagName === "h1" && textOf(first).trim() === title.trim() ? first : void 0;
288
+ const lead = elements[skip ? 1 : 0];
289
+ const repeat = description && isObject(lead) && lead.tagName === "p" && textOf(lead).trim().startsWith(description.trim()) ? lead : void 0;
273
290
  const budget = { nodes: 0, text: 0 };
274
- return { type: "root", children: raw.filter((n) => n !== skip).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
291
+ return { type: "root", children: raw.filter((n) => n !== skip && n !== repeat).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
275
292
  }
276
293
 
294
+ // src/react/comments-labels.ts
295
+ var COMMENT_LABELS_EN = {
296
+ heading: "Comments",
297
+ countLabel: "{n} comments",
298
+ likeArticle: "Like this article",
299
+ likedArticle: "Liked",
300
+ likeArticleSignIn: "(sign in), ",
301
+ likeComment: "Like this comment, ",
302
+ likeCommentSignIn: "Sign in to like this comment, ",
303
+ signInTitle: "Sign in to join the discussion",
304
+ signInBody: "Anyone can read. To comment or like, sign in.",
305
+ signIn: "Sign in",
306
+ commentingAs: "Commenting as {name}",
307
+ write: "Write a comment",
308
+ placeholder: "Add to the discussion",
309
+ help: "Markdown: links, emphasis, code and quotes.",
310
+ chars: "{n} / {max}",
311
+ post: "Post comment",
312
+ posting: "Posting",
313
+ reply: "Reply",
314
+ replyTo: "Reply to {name}",
315
+ replyPlaceholder: "Write a reply",
316
+ cancel: "Cancel",
317
+ edit: "Edit",
318
+ editLeft: "({n} min left)",
319
+ save: "Save",
320
+ delete: "Delete",
321
+ deleteConfirm: "Delete this comment?",
322
+ keep: "Keep",
323
+ you: "You",
324
+ edited: "edited",
325
+ removed: "This comment was removed.",
326
+ removedByModerator: "This comment was removed by a moderator.",
327
+ removedByAuthor: "This comment was deleted by its author.",
328
+ depthEnd: "Replies end at this depth",
329
+ held: "Awaiting approval.",
330
+ heldBanner: "Thanks, your comment is awaiting approval",
331
+ heldBannerBody: "New commenters may be reviewed first. You will see it here, marked as pending, until a moderator approves it. Nobody else can see it yet.",
332
+ heldNote: "Only you can see this until a moderator approves it.",
333
+ heldLive: "Comment awaiting approval",
334
+ postedLive: "Comment posted",
335
+ deletedLive: "Comment deleted",
336
+ savedLive: "Comment saved",
337
+ empty: "No comments yet",
338
+ emptyBody: "Start the discussion. Comments may be reviewed before they appear.",
339
+ loading: "Loading comments",
340
+ loadError: "Comments could not be loaded",
341
+ loadErrorBody: "The article is fine. The comments service did not answer.",
342
+ retry: "Try again",
343
+ postError: "Your comment was not posted. We kept your text, so nothing is lost. Check your connection and try again.",
344
+ tooLong: "That comment is too long or empty. Comments are 1 to 4000 characters.",
345
+ editClosed: "Comments can be edited for ten minutes after posting. That time has passed.",
346
+ actionError: "That did not go through. Please try again.",
347
+ rateTitle: "You are commenting too quickly",
348
+ rateBody: "Please wait before posting again. Your draft is kept in the box below.",
349
+ rateWait: "You can post again in {n} seconds.",
350
+ bannedTitle: "You cannot comment right now",
351
+ bannedBody: "Commenting is not available for your account on this site. You can still read every comment. If you think this is a mistake, contact the site team.",
352
+ expired: "Your session ended. Sign in again to post. Your text is kept.",
353
+ more: "Load more comments",
354
+ truncated: "Showing the first 500 comments.",
355
+ justNow: "just now"
356
+ };
357
+ var COMMENT_LABELS_FR = {
358
+ heading: "Commentaires",
359
+ countLabel: "{n} commentaires",
360
+ likeArticle: "Aimer cet article",
361
+ likedArticle: "Aim\xE9",
362
+ likeArticleSignIn: "(connexion requise), ",
363
+ likeComment: "Aimer ce commentaire, ",
364
+ likeCommentSignIn: "Connectez-vous pour aimer ce commentaire, ",
365
+ signInTitle: "Connectez-vous pour participer \xE0 la discussion",
366
+ signInBody: "Tout le monde peut lire. Pour commenter ou aimer, connectez-vous.",
367
+ signIn: "Se connecter",
368
+ commentingAs: "Vous commentez en tant que {name}",
369
+ write: "\xC9crire un commentaire",
370
+ placeholder: "Participez \xE0 la discussion",
371
+ help: "Markdown : liens, emphase, code et citations.",
372
+ chars: "{n} / {max}",
373
+ post: "Publier le commentaire",
374
+ posting: "Publication",
375
+ reply: "R\xE9pondre",
376
+ replyTo: "R\xE9pondre \xE0 {name}",
377
+ replyPlaceholder: "\xC9crire une r\xE9ponse",
378
+ cancel: "Annuler",
379
+ edit: "Modifier",
380
+ editLeft: "({n} min restantes)",
381
+ save: "Enregistrer",
382
+ delete: "Supprimer",
383
+ deleteConfirm: "Supprimer ce commentaire ?",
384
+ keep: "Conserver",
385
+ you: "Vous",
386
+ edited: "modifi\xE9",
387
+ removed: "Ce commentaire a \xE9t\xE9 retir\xE9.",
388
+ removedByModerator: "Ce commentaire a \xE9t\xE9 retir\xE9 par un mod\xE9rateur.",
389
+ removedByAuthor: "Ce commentaire a \xE9t\xE9 supprim\xE9 par son auteur.",
390
+ depthEnd: "Les r\xE9ponses s'arr\xEAtent \xE0 ce niveau",
391
+ held: "En attente d'approbation.",
392
+ heldBanner: "Merci, votre commentaire est en attente d'approbation",
393
+ heldBannerBody: "Les nouveaux commentaires peuvent \xEAtre relus d'abord. Vous le voyez ici, marqu\xE9 en attente, jusqu'\xE0 son approbation par un mod\xE9rateur. Personne d'autre ne peut le voir.",
394
+ heldNote: "Vous seul le voyez tant qu'un mod\xE9rateur ne l'a pas approuv\xE9.",
395
+ heldLive: "Commentaire en attente d'approbation",
396
+ postedLive: "Commentaire publi\xE9",
397
+ deletedLive: "Commentaire supprim\xE9",
398
+ savedLive: "Commentaire enregistr\xE9",
399
+ empty: "Aucun commentaire pour l'instant",
400
+ emptyBody: "Lancez la discussion. Les commentaires peuvent \xEAtre relus avant d'appara\xEEtre.",
401
+ loading: "Chargement des commentaires",
402
+ loadError: "Les commentaires n'ont pas pu \xEAtre charg\xE9s",
403
+ loadErrorBody: "L'article est intact. Le service de commentaires n'a pas r\xE9pondu.",
404
+ retry: "R\xE9essayer",
405
+ postError: "Votre commentaire n'a pas \xE9t\xE9 publi\xE9. Votre texte est conserv\xE9. V\xE9rifiez votre connexion et r\xE9essayez.",
406
+ tooLong: "Ce commentaire est trop long ou vide. Un commentaire compte de 1 \xE0 4000 caract\xE8res.",
407
+ editClosed: "Un commentaire peut \xEAtre modifi\xE9 pendant dix minutes apr\xE8s sa publication. Ce d\xE9lai est \xE9coul\xE9.",
408
+ actionError: "L'action a \xE9chou\xE9. R\xE9essayez.",
409
+ rateTitle: "Vous commentez trop vite",
410
+ rateBody: "Patientez avant de publier \xE0 nouveau. Votre brouillon est conserv\xE9 dans la zone ci-dessous.",
411
+ rateWait: "Vous pourrez publier \xE0 nouveau dans {n} secondes.",
412
+ bannedTitle: "Vous ne pouvez pas commenter pour le moment",
413
+ bannedBody: "Les commentaires ne sont pas disponibles pour votre compte sur ce site. Vous pouvez toujours tout lire. Si vous pensez \xE0 une erreur, contactez l'\xE9quipe du site.",
414
+ expired: "Votre session a expir\xE9. Reconnectez-vous pour publier. Votre texte est conserv\xE9.",
415
+ more: "Charger plus de commentaires",
416
+ truncated: "Affichage des 500 premiers commentaires.",
417
+ justNow: "\xE0 l'instant"
418
+ };
419
+ var COMMENT_LABELS_ES = {
420
+ heading: "Comentarios",
421
+ countLabel: "{n} comentarios",
422
+ likeArticle: "Me gusta este art\xEDculo",
423
+ likedArticle: "Te gusta",
424
+ likeArticleSignIn: "(inicia sesi\xF3n), ",
425
+ likeComment: "Me gusta este comentario, ",
426
+ likeCommentSignIn: "Inicia sesi\xF3n para dar me gusta a este comentario, ",
427
+ signInTitle: "Inicia sesi\xF3n para unirte a la conversaci\xF3n",
428
+ signInBody: "Todos pueden leer. Para comentar o dar me gusta, inicia sesi\xF3n.",
429
+ signIn: "Iniciar sesi\xF3n",
430
+ commentingAs: "Comentando como {name}",
431
+ write: "Escribe un comentario",
432
+ placeholder: "A\xF1ade a la conversaci\xF3n",
433
+ help: "Markdown: enlaces, \xE9nfasis, c\xF3digo y citas.",
434
+ chars: "{n} / {max}",
435
+ post: "Publicar comentario",
436
+ posting: "Publicando",
437
+ reply: "Responder",
438
+ replyTo: "Responder a {name}",
439
+ replyPlaceholder: "Escribe una respuesta",
440
+ cancel: "Cancelar",
441
+ edit: "Editar",
442
+ editLeft: "(quedan {n} min)",
443
+ save: "Guardar",
444
+ delete: "Eliminar",
445
+ deleteConfirm: "\xBFEliminar este comentario?",
446
+ keep: "Conservar",
447
+ you: "T\xFA",
448
+ edited: "editado",
449
+ removed: "Este comentario fue eliminado.",
450
+ removedByModerator: "Un moderador elimin\xF3 este comentario.",
451
+ removedByAuthor: "Su autor elimin\xF3 este comentario.",
452
+ depthEnd: "Las respuestas terminan en este nivel",
453
+ held: "Pendiente de aprobaci\xF3n.",
454
+ heldBanner: "Gracias, tu comentario est\xE1 pendiente de aprobaci\xF3n",
455
+ heldBannerBody: "Los comentarios nuevos pueden revisarse primero. Lo ves aqu\xED, marcado como pendiente, hasta que un moderador lo apruebe. Nadie m\xE1s puede verlo todav\xEDa.",
456
+ heldNote: "Solo t\xFA lo ves hasta que un moderador lo apruebe.",
457
+ heldLive: "Comentario pendiente de aprobaci\xF3n",
458
+ postedLive: "Comentario publicado",
459
+ deletedLive: "Comentario eliminado",
460
+ savedLive: "Comentario guardado",
461
+ empty: "A\xFAn no hay comentarios",
462
+ emptyBody: "Empieza la conversaci\xF3n. Los comentarios pueden revisarse antes de aparecer.",
463
+ loading: "Cargando comentarios",
464
+ loadError: "No se pudieron cargar los comentarios",
465
+ loadErrorBody: "El art\xEDculo est\xE1 bien. El servicio de comentarios no respondi\xF3.",
466
+ retry: "Reintentar",
467
+ postError: "Tu comentario no se public\xF3. Hemos conservado tu texto. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
468
+ tooLong: "Ese comentario es demasiado largo o est\xE1 vac\xEDo. Los comentarios tienen de 1 a 4000 caracteres.",
469
+ editClosed: "Un comentario puede editarse durante diez minutos tras publicarlo. Ese tiempo ya pas\xF3.",
470
+ actionError: "No se pudo completar. Int\xE9ntalo de nuevo.",
471
+ rateTitle: "Est\xE1s comentando demasiado r\xE1pido",
472
+ rateBody: "Espera antes de publicar de nuevo. Tu borrador se conserva en el cuadro de abajo.",
473
+ rateWait: "Podr\xE1s publicar de nuevo en {n} segundos.",
474
+ bannedTitle: "No puedes comentar por ahora",
475
+ bannedBody: "Los comentarios no est\xE1n disponibles para tu cuenta en este sitio. A\xFAn puedes leerlos todos. Si crees que es un error, contacta con el equipo del sitio.",
476
+ expired: "Tu sesi\xF3n termin\xF3. Inicia sesi\xF3n de nuevo para publicar. Tu texto se conserva.",
477
+ more: "Cargar m\xE1s comentarios",
478
+ truncated: "Se muestran los primeros 500 comentarios.",
479
+ justNow: "ahora mismo"
480
+ };
481
+
277
482
  // src/react/viewer/labels.ts
278
483
  var VIEWER_LABELS_EN = {
279
484
  expand: "Expand diagram",
@@ -391,6 +596,8 @@ var en = {
391
596
  fallbackTitle: "Not translated into {language} yet.",
392
597
  fallbackBody: "You are reading the original.",
393
598
  older: "Older posts",
599
+ viewAll: "View all",
600
+ readAtSource: "Read at source",
394
601
  emptyTitle: "Nothing published here yet",
395
602
  emptyBody: "Documents published to this section will appear here, newest first.",
396
603
  docs: "Documentation",
@@ -411,7 +618,8 @@ var en = {
411
618
  unKind: "Unavailable",
412
619
  unTitle: "This page is temporarily unavailable",
413
620
  unBody: "The content could not be loaded. Please try again in a moment.",
414
- viewer: VIEWER_LABELS_EN
621
+ viewer: VIEWER_LABELS_EN,
622
+ comments: COMMENT_LABELS_EN
415
623
  };
416
624
  var fr = {
417
625
  toc: "Sur cette page",
@@ -434,6 +642,8 @@ var fr = {
434
642
  fallbackTitle: "Pas encore traduit en {language}.",
435
643
  fallbackBody: "Vous lisez l'original.",
436
644
  older: "Articles plus anciens",
645
+ viewAll: "Tout voir",
646
+ readAtSource: "Lire \xE0 la source",
437
647
  emptyTitle: "Rien n'est encore publi\xE9 ici",
438
648
  emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
439
649
  docs: "Documentation",
@@ -454,7 +664,8 @@ var fr = {
454
664
  unKind: "Indisponible",
455
665
  unTitle: "Cette page est momentan\xE9ment indisponible",
456
666
  unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
457
- viewer: VIEWER_LABELS_FR
667
+ viewer: VIEWER_LABELS_FR,
668
+ comments: COMMENT_LABELS_FR
458
669
  };
459
670
  var es = {
460
671
  toc: "En esta p\xE1gina",
@@ -477,6 +688,8 @@ var es = {
477
688
  fallbackTitle: "A\xFAn no est\xE1 traducida al {language}.",
478
689
  fallbackBody: "Est\xE1s leyendo el original.",
479
690
  older: "Entradas anteriores",
691
+ viewAll: "Ver todo",
692
+ readAtSource: "Leer en la fuente",
480
693
  emptyTitle: "A\xFAn no hay nada publicado aqu\xED",
481
694
  emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
482
695
  docs: "Documentaci\xF3n",
@@ -497,7 +710,8 @@ var es = {
497
710
  unKind: "No disponible",
498
711
  unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
499
712
  unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
500
- viewer: VIEWER_LABELS_ES
713
+ viewer: VIEWER_LABELS_ES,
714
+ comments: COMMENT_LABELS_ES
501
715
  };
502
716
  var TABLE = { en, fr, es };
503
717
  function stringsFor(locale) {
@@ -580,10 +794,10 @@ function buildComponents(c, s) {
580
794
  for (const key of overrides) if (c[key]) defaults[key] = c[key];
581
795
  return defaults;
582
796
  }
583
- function HastContent({ tree, title, components = {}, locale }) {
797
+ function HastContent({ tree, title, description, components = {}, locale }) {
584
798
  let root;
585
799
  try {
586
- root = sanitizeHast(tree, title);
800
+ root = sanitizeHast(tree, title, description);
587
801
  } catch (error) {
588
802
  if (!(error instanceof HastLimitError)) throw error;
589
803
  const s = stringsFor(locale);
@@ -609,6 +823,7 @@ function TrustedServerHtml({ html }) {
609
823
  var import_mermaid_diagram2 = require("./mermaid-diagram.cjs");
610
824
 
611
825
  // src/react/pages.tsx
826
+ var import_comments = require("./comments.cjs");
612
827
  var import_jsx_runtime4 = require("react/jsx-runtime");
613
828
  function Slot({ name, slots, tag: Tag = "div", className }) {
614
829
  const fill = slots?.[name];
@@ -677,7 +892,7 @@ function Toc({ toc, c, aside }) {
677
892
  }
678
893
  function Body({ article, components, locale }) {
679
894
  const { content, publication } = article;
680
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HastContent, { tree: content.tree, title: publication.title, components: components ?? {}, locale }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TrustedServerHtml, { html: content.html }) });
895
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TrustedServerHtml, { html: content.html }) });
681
896
  }
682
897
  function Languages({ alternates, current, c }) {
683
898
  if (alternates.length < 2) return null;
@@ -690,7 +905,32 @@ function Languages({ alternates, current, c }) {
690
905
  }) })
691
906
  ] });
692
907
  }
693
- function ArticlePage({ article, ...base }) {
908
+ var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
909
+ function articleJsonLd(article, origin, c, author) {
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
+ ...pub.updated_at ? { dateModified: pub.updated_at } : {},
921
+ ...author ? { author: { "@type": "Person", name: author } } : {},
922
+ inLanguage: pub.locale,
923
+ mainEntityOfPage: url(pub.canonical_path)
924
+ },
925
+ {
926
+ "@type": "BreadcrumbList",
927
+ itemListElement: article.breadcrumbs.map((b, i) => ({ "@type": "ListItem", position: i + 1, name: b.title, item: url(b.canonical_path) }))
928
+ }
929
+ ]
930
+ };
931
+ return JSON.stringify(graph).replace(/</g, "\\u003c");
932
+ }
933
+ function ArticlePage({ article, engagement, origin, ...base }) {
694
934
  const { publication: pub } = article;
695
935
  const c = ctx(base, pub.locale);
696
936
  const { s } = c;
@@ -735,9 +975,11 @@ function ArticlePage({ article, ...base }) {
735
975
  ] }),
736
976
  toc.narrow,
737
977
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Body, { article, components: base.components, locale: c.locale }),
978
+ engagement ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_comments.Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
738
979
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pager, { prev: article.prev, next: article.next, c }),
739
980
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
740
- toc.wide
981
+ toc.wide,
982
+ origin && BARE_HTTPS_ORIGIN.test(origin) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: articleJsonLd(article, origin, c, author) } }) : null
741
983
  ] }) });
742
984
  }
743
985
  function ListPage({ list, olderHref, description, ...base }) {
@@ -834,9 +1076,54 @@ function Redirecting({ from, to, ...base }) {
834
1076
  ] }) });
835
1077
  }
836
1078
 
1079
+ // src/react/index.ts
1080
+ var import_comments2 = require("./comments.cjs");
1081
+
1082
+ // src/react/embed.tsx
1083
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1084
+ function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, ...base }) {
1085
+ const c = ctx(base, "en");
1086
+ const { s, Link } = c;
1087
+ const Row = base.slots?.["list.item"];
1088
+ const Heading = `h${headingLevel}`;
1089
+ const safe = items.filter((item) => item.canonical_path.startsWith("/"));
1090
+ 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;
1091
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
1092
+ title ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: title }) : null,
1093
+ /* @__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: [
1094
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
1095
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1096
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "t", children: item.title }),
1097
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: item.description }) : null
1098
+ ] })
1099
+ ] }) }, item.canonical_path)) }),
1100
+ moreHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
1101
+ ] });
1102
+ }
1103
+ function HyleArticleView({ article, headingLevel = 2, ...base }) {
1104
+ const { publication: pub } = article;
1105
+ const c = ctx(base, pub.locale);
1106
+ const Heading = `h${headingLevel}`;
1107
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { lang: c.locale, children: [
1108
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { className: "hyle-head", children: [
1109
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { className: "hyle-title", children: pub.title }),
1110
+ pub.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
1111
+ /* @__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) }) }) })
1112
+ ] }),
1113
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Body, { article, components: base.components, locale: c.locale }),
1114
+ 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: [
1115
+ c.s.readAtSource,
1116
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "hyle-sr", children: [
1117
+ ": ",
1118
+ pub.title
1119
+ ] })
1120
+ ] }) : null
1121
+ ] }) });
1122
+ }
1123
+
837
1124
  // src/react/docs.tsx
838
1125
  var import_docs_enhance = require("./docs-enhance.cjs");
839
- var import_jsx_runtime5 = require("react/jsx-runtime");
1126
+ var import_jsx_runtime6 = require("react/jsx-runtime");
840
1127
  var ROOT_ID = "hyle-docs";
841
1128
  var NAV_ID = "hyle-docs-nav";
842
1129
  function navTreeOf(article) {
@@ -860,15 +1147,15 @@ function pathTo(nodes, path) {
860
1147
  }
861
1148
  function Branch({ nodes, current, onPath, c }) {
862
1149
  const { Link } = c;
863
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { children: nodes.map((node) => {
864
- const link = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
865
- if (node.children.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: link }, node.canonical_path);
866
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
867
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { children: [
868
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev" }),
1150
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { children: nodes.map((node) => {
1151
+ const link = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
1152
+ if (node.children.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: link }, node.canonical_path);
1153
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
1154
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("summary", { children: [
1155
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "chev" }),
869
1156
  link
870
1157
  ] }),
871
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Branch, { nodes: node.children, current, onPath, c })
1158
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Branch, { nodes: node.children, current, onPath, c })
872
1159
  ] }) }, node.canonical_path);
873
1160
  }) });
874
1161
  }
@@ -882,47 +1169,47 @@ function DocsPage({ article, ...base }) {
882
1169
  const siteName = article.breadcrumbs[0]?.title ?? "";
883
1170
  const headingIds = article.toc.filter((t) => t.depth === 2 || t.depth === 3).map((t) => scopeId(t.id));
884
1171
  const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
885
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
886
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_docs_enhance.DocsEnhance, { headingIds, rootId: ROOT_ID }),
887
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
888
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "file" }),
1172
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Shell, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
1173
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_docs_enhance.DocsEnhance, { headingIds, rootId: ROOT_ID }),
1174
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
1175
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "file" }),
889
1176
  s.menu,
890
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "cur", children: pub.title }),
891
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "chev-down", className: "hyle-chev" })
1177
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "cur", children: pub.title }),
1178
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "chev-down", className: "hyle-chev" })
892
1179
  ] }),
893
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
894
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-side-head", children: [
895
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: siteName }),
896
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
897
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "x" }) })
1180
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
1181
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "hyle-side-head", children: [
1182
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: siteName }),
1183
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
1184
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "x" }) })
898
1185
  ] }),
899
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
900
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
901
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
1186
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
1188
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
902
1189
  ] }),
903
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
904
- notTranslated ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
905
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "alert" }),
906
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
907
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: notTranslated }),
1190
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
1191
+ notTranslated ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
1192
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "alert" }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
1194
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: notTranslated }),
908
1195
  " ",
909
1196
  s.fallbackBody
910
1197
  ] })
911
1198
  ] }) : null,
912
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
913
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { className: "hyle-title", children: pub.title }),
914
- pub.description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
915
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "hyle-updated", children: [
916
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "calendar" }),
1199
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
1200
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { className: "hyle-title", children: pub.title }),
1201
+ pub.description ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
1202
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "hyle-updated", children: [
1203
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "calendar" }),
917
1204
  s.updated,
918
1205
  " ",
919
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
1206
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
920
1207
  ] }),
921
1208
  toc.narrow,
922
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Body, { article, components: base.components, locale: c.locale }),
923
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Pager, { prev: article.prev, next: article.next, c }),
924
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
925
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "hyle-docs-end", "aria-hidden": "true" })
1209
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Body, { article, components: base.components, locale: c.locale }),
1210
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Pager, { prev: article.prev, next: article.next, c }),
1211
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
1212
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "hyle-docs-end", "aria-hidden": "true" })
926
1213
  ] }),
927
1214
  toc.wide
928
1215
  ] }) });
@@ -930,9 +1217,12 @@ function DocsPage({ article, ...base }) {
930
1217
  // Annotate the CommonJS export names for ESM import in node:
931
1218
  0 && (module.exports = {
932
1219
  ArticlePage,
1220
+ Comments,
933
1221
  DocsPage,
934
1222
  HastContent,
935
1223
  HastLimitError,
1224
+ HyleArticleView,
1225
+ HyleListView,
936
1226
  ListPage,
937
1227
  MermaidDiagram,
938
1228
  NotFound,