@tdacorp/hyle-sdk 0.14.1 → 0.21.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 (86) hide show
  1. package/README.md +171 -32
  2. package/dist/check-routes-bin.js +48 -21
  3. package/dist/chunk-56Y24XBV.js +840 -0
  4. package/dist/{chunk-MGSUQBDW.js → chunk-75JFLML4.js} +176 -14
  5. package/dist/chunk-HJX57NLI.js +1105 -0
  6. package/dist/chunk-K5VDLROQ.js +145 -0
  7. package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
  8. package/dist/chunk-U74B7AUG.js +398 -0
  9. package/dist/{chunk-6VOHFFA5.js → chunk-X2TLYM7Y.js} +2 -2
  10. package/dist/client-41fU6OY2.d.cts +201 -0
  11. package/dist/client-LwzHwqpM.d.ts +201 -0
  12. package/dist/code-copy.cjs +72 -0
  13. package/dist/code-copy.d.cts +15 -0
  14. package/dist/code-copy.d.ts +15 -0
  15. package/dist/code-copy.js +48 -0
  16. package/dist/comments.cjs +733 -278
  17. package/dist/comments.d.cts +66 -3
  18. package/dist/comments.d.ts +66 -3
  19. package/dist/comments.js +414 -330
  20. package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-XY3CG75U.js} +107 -46
  21. package/dist/{embed-B76zRRPa.d.cts → embed-BUFRQboD.d.ts} +10 -5
  22. package/dist/{embed-SqOBGI-E.d.ts → embed-CYt-q13P.d.cts} +10 -5
  23. package/dist/fragment-alias.cjs +51 -0
  24. package/dist/fragment-alias.d.cts +7 -0
  25. package/dist/fragment-alias.d.ts +7 -0
  26. package/dist/fragment-alias.js +27 -0
  27. package/dist/html.cjs +881 -0
  28. package/dist/html.d.cts +20 -0
  29. package/dist/html.d.ts +20 -0
  30. package/dist/html.js +45 -0
  31. package/dist/index.cjs +181 -14
  32. package/dist/index.d.cts +14 -62
  33. package/dist/index.d.ts +14 -62
  34. package/dist/index.js +11 -1
  35. package/dist/labels-CrA-iqTN.d.cts +46 -0
  36. package/dist/labels-CrA-iqTN.d.ts +46 -0
  37. package/dist/mermaid-diagram.cjs +453 -148
  38. package/dist/mermaid-diagram.d.cts +25 -42
  39. package/dist/mermaid-diagram.d.ts +25 -42
  40. package/dist/mermaid-diagram.js +205 -50
  41. package/dist/mermaid-image.cjs +1456 -0
  42. package/dist/mermaid-image.d.cts +30 -0
  43. package/dist/mermaid-image.d.ts +30 -0
  44. package/dist/mermaid-image.js +93 -0
  45. package/dist/next.cjs +1709 -1134
  46. package/dist/next.d.cts +67 -14
  47. package/dist/next.d.ts +67 -14
  48. package/dist/next.js +950 -794
  49. package/dist/print-coordinator.cjs +157 -0
  50. package/dist/print-coordinator.d.cts +27 -0
  51. package/dist/print-coordinator.d.ts +27 -0
  52. package/dist/print-coordinator.js +83 -0
  53. package/dist/react.cjs +677 -264
  54. package/dist/react.d.cts +161 -31
  55. package/dist/react.d.ts +161 -31
  56. package/dist/react.js +23 -3
  57. package/dist/reactions.cjs +653 -0
  58. package/dist/reactions.d.cts +27 -0
  59. package/dist/reactions.d.ts +27 -0
  60. package/dist/reactions.js +364 -0
  61. package/dist/{resolve-DC2ccfwA.d.ts → resolve-BjAK0k_Y.d.ts} +2 -2
  62. package/dist/{resolve-DKLVftk_.d.cts → resolve-eI1muCKL.d.cts} +2 -2
  63. package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
  64. package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
  65. package/dist/sanitize-ijiWjEm9.d.cts +23 -0
  66. package/dist/sanitize-ijiWjEm9.d.ts +23 -0
  67. package/dist/styles.css +107 -47
  68. package/dist/toc-spy.cjs +59 -0
  69. package/dist/toc-spy.d.cts +15 -0
  70. package/dist/toc-spy.d.ts +15 -0
  71. package/dist/toc-spy.js +35 -0
  72. package/dist/{types-ByodIyEv.d.cts → types-3F0wqD-o.d.cts} +44 -4
  73. package/dist/{types-ByodIyEv.d.ts → types-3F0wqD-o.d.ts} +44 -4
  74. package/dist/use-cache.cjs +37 -11
  75. package/dist/use-cache.d.cts +12 -5
  76. package/dist/use-cache.d.ts +12 -5
  77. package/dist/use-cache.js +7 -7
  78. package/dist/youtube-facade.cjs +50 -0
  79. package/dist/youtube-facade.d.cts +17 -0
  80. package/dist/youtube-facade.d.ts +17 -0
  81. package/dist/youtube-facade.js +26 -0
  82. package/package.json +16 -3
  83. package/dist/chunk-4V4VKB3O.js +0 -1471
  84. package/dist/chunk-R5EMI4HQ.js +0 -61
  85. package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
  86. package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
package/dist/styles.css CHANGED
@@ -66,7 +66,7 @@
66
66
  /* END tokens */
67
67
 
68
68
  .hyle{container:hyle/inline-size;display:block;color:var(--h-text);background:var(--h-bg);font-family:var(--h-font-sans);font-size:var(--h-font-size);line-height:var(--h-line-height);-webkit-font-smoothing:antialiased;text-size-adjust:100%}
69
- .hyle *,.hyle *::before,.hyle *::after{box-sizing:border-box}
69
+ .hyle *:where(:not(.katex *)),.hyle *:where(:not(.katex *))::before,.hyle *:where(:not(.katex *))::after{box-sizing:border-box}
70
70
  .hyle :where(h1,h2,h3,h4,p,ul,ol,li,figure,blockquote,pre,dl,dd,table){margin:0;padding:0}
71
71
  .hyle :where(ul,ol){list-style:none}
72
72
  .hyle :where(a){color:inherit}
@@ -140,6 +140,11 @@
140
140
  .hyle-toc-list li{padding:0}
141
141
  .hyle-toc-list ul ul{padding-left:12px}
142
142
  .hyle-toc-list>ul{border-left:1px solid var(--h-hairline);padding-left:12px}
143
+ /* `HyleToc` on a host page: shown wherever the host puts it, and never a size container (a flex column could collapse it) */
144
+ .hyle.hyle-toc-solo{container-type:normal}
145
+ /* One class of specificity, so a host's own selector can still hide the rail at a breakpoint. */
146
+ .hyle-toc-d:where(.hyle-toc-solo){display:block}
147
+ .hyle-toc-solo .hyle-slot-wrap{margin-top:24px}
143
148
  @container hyle (min-width:1040px){
144
149
  .hyle-article{grid-template-columns:minmax(0,var(--h-measure)) var(--h-toc-width)}
145
150
  .hyle-article>.hyle-toc-m{display:none}
@@ -169,6 +174,7 @@
169
174
  .hyle-item .t{display:block}
170
175
  .hyle-item time{font-size:14px;line-height:1.7;color:var(--h-text-muted);font-variant-numeric:tabular-nums}
171
176
  .hyle-item h3,.hyle-item .t{display:block;font-family:var(--h-font-heading);font-size:1.25em;line-height:1.3;font-weight:var(--h-heading-weight);letter-spacing:var(--h-heading-tracking)}
177
+ .hyle-item>div:only-child{grid-column:1/-1}
172
178
  .hyle-item p{margin-top:4px;color:var(--h-text-muted);font-size:15px;line-height:1.55}
173
179
  .hyle-item .tags{display:flex;gap:8px;margin-top:8px}
174
180
  @container hyle (max-width:640px){.hyle-item{grid-template-columns:minmax(0,1fr);gap:4px;margin-inline:-8px;padding:16px 8px}.hyle-item .t{display:block}
@@ -260,6 +266,9 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
260
266
 
261
267
  /* ---- prose layer: rendered markdown, plain semantic elements ---- */
262
268
  .hyle-prose{overflow-wrap:break-word}
269
+ /* Nothing a writer positions (a formula's \raisebox, say) paints above or below the article, over the host's own page. */
270
+ @media screen{.hyle-prose{clip-path:inset(-8px -100vw)}}
271
+ .hyle-prose img{max-width:100%;height:auto}
263
272
  .hyle-prose>*+*{margin-top:var(--h-paragraph-gap)}
264
273
  .hyle-prose :where(h1,h2,h3,h4){font-family:var(--h-font-heading);font-weight:var(--h-heading-weight);letter-spacing:var(--h-heading-tracking);line-height:1.25;color:var(--h-text);scroll-margin-top:calc(var(--h-sticky-top) + 24px);text-wrap:balance;position:relative}
265
274
  .hyle-prose h1{font-size:var(--h-h1-size);line-height:1.15}
@@ -269,9 +278,10 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
269
278
  .hyle-prose :where(h1,h2,h3,h4)+*{margin-top:12px}
270
279
  .hyle-prose h2:first-child{margin-top:0;padding-top:0;border-top:0}
271
280
  .hyle-anchor{position:absolute;left:-24px;top:0;width:24px;text-align:left;color:var(--h-text-faint);text-decoration:none;font-weight:400;opacity:0}
281
+ .hyle-anchor::before{content:"#"}
272
282
  .hyle-prose :is(h2,h3,h4):hover .hyle-anchor,.hyle-anchor:focus-visible{opacity:1}
273
283
  .hyle-prose h2 .hyle-anchor{top:var(--h-block-gap)}
274
- .hyle-prose h2:first-child .hyle-anchor{top:0}
284
+ .hyle-prose h2:first-child .hyle-anchor,.hyle-prose section[data-footnotes] h2 .hyle-anchor{top:0}
275
285
  .hyle-prose a:not(.hyle-anchor){color:var(--h-link);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
276
286
  .hyle-prose a:not(.hyle-anchor):hover{text-decoration-thickness:2px}
277
287
  .hyle-prose strong{font-weight:600}
@@ -323,6 +333,10 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
323
333
  .hyle-codeblock pre{overflow-x:auto;padding:16px;font:400 var(--h-code-size)/1.65 var(--h-font-mono);tab-size:2;color:var(--h-text)}
324
334
  .hyle-codeblock pre code{display:block;width:max-content;min-width:100%;font:inherit;background:none;border:0;padding:0}
325
335
  .hyle-prose .hyle-codeblock pre,.hyle-prose .hyle-table table{margin:0}
336
+ .hyle-codeblock>header>button:first-child{margin-left:auto}
337
+ .hyle-codeblock>header>button .hyle-ic+.hyle-ic,.hyle-codeblock>header>button[data-state="copied"] .hyle-ic:first-child{display:none}
338
+ .hyle-codeblock>header>button[data-state="copied"] .hyle-ic+.hyle-ic{display:block;color:var(--h-ok)}
339
+ .hyle-codeblock>header>button[data-state="blocked"]{color:var(--h-bad)}
326
340
  .hljs-keyword,.hljs-selector-tag,.hljs-tag,.hljs-doctag,.hljs-section{color:var(--h-syn-keyword)}
327
341
  .hljs-string,.hljs-regexp,.hljs-template-variable,.hljs-addition{color:var(--h-syn-string)}
328
342
  .hljs-number,.hljs-unit,.hljs-bullet{color:var(--h-syn-number)}
@@ -336,28 +350,30 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
336
350
  .hljs-addition{background:color-mix(in srgb,var(--h-ok) 12%,transparent);display:inline-block;width:100%}
337
351
  .hljs-deletion{background:color-mix(in srgb,var(--h-bad) 12%,transparent);display:inline-block;width:100%}
338
352
 
339
- /* math: KaTeX markup. The real stylesheet and fonts come with katex; these rules only set colour, spacing and the fallbacks used in this kit */
340
- .katex{font:italic 400 1.1em/1.2 "KaTeX_Main","STIX Two Math","Cambria Math","Latin Modern Math","Noto Serif",serif;color:var(--h-text);white-space:nowrap}
341
- .katex .mord.rm,.katex .mop,.katex .mbin,.katex .mrel,.katex .mopen,.katex .mclose,.katex .mpunct,.katex .num{font-style:normal}
342
- .katex .mbin,.katex .mrel{margin:0 .28em}
343
- .katex .msupsub{font-size:.7em;vertical-align:.5em;font-style:normal;line-height:0}
344
- .katex .mfrac{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;margin:0 .12em;text-align:center}
345
- .katex .mfrac>span:first-child{padding:0 .2em .1em;border-bottom:1px solid currentColor}
346
- .katex .mfrac>span:last-child{padding:.1em .2em 0}
347
- .katex .delim{font-size:2.2em;font-weight:200;font-style:normal;line-height:.8;vertical-align:middle;color:var(--h-text-muted)}
348
- .katex .text{font-family:var(--h-font-sans);font-style:normal;font-size:.8em}
349
- .katex-mathml{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
350
- .katex-display{display:block;overflow-x:auto;text-align:center;padding:16px 0}
351
- .katex-display .katex{font-size:1.3em}
353
+ /* math: KaTeX's own stylesheet (loaded by the host) draws it; a wide display equation only needs to scroll inside the column */
354
+ .hyle-prose .katex-display{overflow-x:auto;overflow-y:hidden;padding:4px 0}
352
355
 
353
356
  /* figure */
354
357
  .hyle-prose figure{margin-inline:0}
355
358
  .hyle-prose figure img{display:block;width:100%;height:auto;border:var(--h-border-width) solid var(--h-border);border-radius:var(--h-radius);background:var(--h-surface)}
356
359
  .hyle-prose figcaption{margin-top:8px;font-size:14px;line-height:1.5;color:var(--h-text-muted)}
357
360
 
361
+ /* YouTube: a thumbnail and play button until clicked, then the frame; the plain link stays under it */
362
+ .hyle-prose .hyle-youtube,.hyle-prose .hyle-youtube+*{margin-top:var(--h-block-gap)}
363
+ .hyle-youtube-stage{position:relative;aspect-ratio:16/9;overflow:hidden;border:var(--h-border-width) solid var(--h-border);border-radius:var(--h-radius);background:var(--h-surface-2)}
364
+ .hyle-youtube-stage>*{position:absolute;inset:0;width:100%;height:100%;border:0}
365
+ .hyle-youtube-stage>button{padding:0;background:transparent;cursor:pointer}
366
+ .hyle-youtube-stage>button:focus-visible{outline-offset:-4px}
367
+ .hyle-youtube .hyle-youtube-stage img{width:100%;height:100%;object-fit:cover}
368
+ .hyle-youtube-stage>button::before,.hyle-youtube-stage>button::after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}
369
+ .hyle-youtube-stage>button::before{z-index:1;width:64px;height:44px;border-radius:var(--h-radius);background:var(--h-accent)}
370
+ .hyle-youtube-stage>button::after{z-index:2;border-block:9px solid transparent;border-left:15px solid var(--h-on-accent)}
371
+ .hyle-youtube>p{margin-top:8px;font-size:14px}
372
+
358
373
  /* callout */
359
374
  .hyle-callout{--k:var(--h-text-muted);display:grid;grid-template-columns:20px minmax(0,1fr);gap:12px;padding:16px;border:var(--h-border-width) solid color-mix(in srgb,var(--k) 30%,var(--h-border));border-radius:var(--h-radius);background:color-mix(in srgb,var(--k) 8%,var(--h-surface))}
360
375
  .hyle-callout[data-kind="tip"]{--k:var(--h-ok)}
376
+ .hyle-callout[data-kind="important"]{--k:var(--h-link)}
361
377
  .hyle-callout[data-kind="warning"]{--k:var(--h-warn)}
362
378
  .hyle-callout[data-kind="caution"]{--k:var(--h-bad)}
363
379
  .hyle-callout>.hyle-ic{width:20px;height:20px;margin-top:2px;color:var(--k)}
@@ -366,7 +382,7 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
366
382
  .hyle-callout .bd{font-size:.9375em;line-height:1.6}
367
383
 
368
384
  /* mermaid placeholder frame */
369
- .hyle-mermaid{margin-inline:0;border:var(--h-border-width) dashed var(--h-border);border-radius:var(--h-radius);background:var(--h-surface);overflow-x:auto}
385
+ .hyle-mermaid{position:relative;margin-inline:0;border:var(--h-border-width) dashed var(--h-border);border-radius:var(--h-radius);background:var(--h-surface);overflow-x:auto}
370
386
  .hyle-mermaid .hyle-stage{display:flex;align-items:center;justify-content:center;gap:0;padding:32px 16px;flex-wrap:wrap;row-gap:12px}
371
387
  .hyle-mermaid .node{display:grid;place-items:center;min-width:104px;height:40px;padding:0 12px;border:var(--h-border-width) solid var(--h-border);border-radius:min(var(--h-radius),8px);background:var(--h-surface-2);font:500 13px/1 var(--h-font-mono);color:var(--h-text-muted)}
372
388
  .hyle-mermaid .edge{width:32px;height:1px;background:var(--h-border);position:relative}
@@ -398,11 +414,8 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
398
414
  .hyle-prose a[data-footnote-backref]{margin-left:4px;text-decoration:none;color:var(--h-link)}
399
415
 
400
416
  @media (prefers-reduced-motion:no-preference){.hyle-btn,.hyle-chips a,.hyle-item,.hyle-pager a,.hyle-toc-list a,.hyle-tree li a{transition:background-color .12s,color .12s}}
401
- @media print{.hyle-toc-d,.hyle-toc-m,.hyle-nav-d,.hyle-nav-m,.hyle-pager,.hyle-codeblock header button{display:none}.hyle-article,.hyle-docs{display:block}}
417
+ @media print{.hyle-toc-d,.hyle-toc-m,.hyle-nav-d,.hyle-nav-m,.hyle-pager,.hyle-youtube-stage,.hyle-codeblock header button{display:none}.hyle-article,.hyle-docs{display:block}}
402
418
 
403
- .katex .mop.lim{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;line-height:1;margin:0 .2em;font-style:normal}
404
- .katex .mop.lim .sym{font-size:1.6em}
405
- .katex .mop.lim small{font-size:.65em}
406
419
  .hyle-docs-main>.hyle-prose{margin-top:32px}
407
420
  .hyle-state>div[data-slot="notfound.body"]{margin-top:16px;color:var(--h-text-muted)}
408
421
  .hyle-state>div[data-slot="notfound.body"]>p{margin:0}
@@ -410,25 +423,77 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
410
423
  .hyle-nav-m .hyle-side-head{margin:0;padding:12px 12px 0}
411
424
 
412
425
  /* ---- additions not in the design kit (the kit mocks these; the real hast needs them) ---- */
413
- .hyle .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
414
- .hyle-mermaid iframe{display:block;width:100%;min-height:240px;border:0;background:transparent}
426
+ /* Hidden text stays hidden in prose even when the host wraps `HastContent` in `.hyle-prose` only. */
427
+ .hyle .sr-only,.hyle-prose .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
415
428
  .hyle-mermaid>pre{padding:16px}
429
+ .hyle-mermaid[data-state=pending]{min-height:240px}
430
+ /* A stored render: the box is reserved by aspect-ratio before the image arrives, so nothing shifts. */
431
+ .hyle-mermaid-frame{position:relative;display:block;margin-inline:auto;width:100%;padding:0;box-sizing:content-box}
432
+ .hyle-mermaid-frame img{display:block;width:100%;height:auto}
433
+ .hyle-mermaid-loader{position:absolute;inset:0 0 auto 0;height:3px;overflow:hidden;background:var(--h-border,GrayText);opacity:.5;z-index:1}
434
+ .hyle-mermaid-loader::after{content:"";position:absolute;inset:0;width:40%;background:var(--h-accent,Highlight);animation:hyle-mermaid-load 1.2s ease-in-out infinite}
435
+ @keyframes hyle-mermaid-load{from{transform:translateX(-100%)}to{transform:translateX(250%)}}
436
+ @media (prefers-reduced-motion:reduce){.hyle-mermaid-loader::after{animation:none;width:100%}}
416
437
  /* contain:paint clips the SVG and makes it the containing block of any absolute or fixed descendant, so diagram CSS cannot overlay the host page */
417
438
  .hyle-mermaid-svg{display:flex;justify-content:center;padding:16px;contain:paint}
418
439
  .hyle-mermaid-svg svg{position:static!important;max-width:100%;height:auto}
419
440
  .hyle-mermaid-note{margin:0;padding:8px 16px;border-top:1px dashed var(--h-border);font-size:13px;color:var(--h-warn)}
441
+ /* inside the box: the clamp's mask and the frame both clip an outline drawn outside it */
442
+ .hyle-mermaid>pre:focus-visible,.hyle-mermaid-source>pre:focus-visible{outline-offset:-2px}
443
+
444
+ /* ---- a large diagram before it is drawn: a notice with the Draw button, then its source, clamped behind a toggle ---- */
445
+ .hyle-mermaid-gate{display:flex;flex-wrap:wrap;align-items:center;gap:12px 24px;padding:16px;border-bottom:var(--h-border-width,1px) dashed var(--h-border,GrayText)}
446
+ .hyle-mermaid-gate-text{flex:1 1 30ch;min-width:0;max-width:68ch}
447
+ .hyle-mermaid-gate-title{margin:0;font-size:15px;font-weight:600;line-height:1.5;color:var(--h-text)}
448
+ .hyle-mermaid-gate-body{margin:4px 0 0;font-size:14px;line-height:1.6;color:var(--h-text-muted)}
449
+ .hyle-mermaid-gate .hyle-mermaid-note{flex-basis:100%;padding:0;border:0}
450
+ .hyle-mermaid-draw{display:block;flex:none;margin:0;padding:6px 14px;border:var(--h-border-width,1px) solid var(--h-border,GrayText);border-radius:var(--h-radius,6px);background:var(--h-surface-2,Canvas);font-family:inherit;font-size:13px;font-weight:500;line-height:1.4;color:var(--h-text,CanvasText);cursor:pointer}
451
+ .hyle-mermaid-draw:hover{border-color:var(--h-accent,Highlight)}
452
+ .hyle-mermaid-draw[aria-disabled=true]{cursor:progress;color:var(--h-text-muted)}
453
+ .hyle-mermaid-draw[aria-disabled=true]:hover{border-color:var(--h-border,GrayText)}
454
+ div.hyle-mermaid-source{position:relative}
455
+ div.hyle-mermaid-source>pre{padding:16px}
456
+ div.hyle-mermaid-source[data-drawing]{display:none}
457
+ .hyle-mermaid-more{display:block;margin:4px 16px 16px;padding:4px 12px;border:var(--h-border-width,1px) solid var(--h-border,GrayText);border-radius:var(--h-radius,6px);background:var(--h-surface,Canvas);font-family:inherit;font-size:13px;font-weight:500;line-height:1.4;color:var(--h-text-muted);cursor:pointer}
458
+ .hyle-mermaid-more:hover{border-color:var(--h-accent,Highlight);color:var(--h-text)}
459
+ div.hyle-mermaid-source[data-clamped]>pre{max-height:15rem;overflow-y:auto;-webkit-mask-image:linear-gradient(#000 calc(100% - 4rem),transparent);mask-image:linear-gradient(#000 calc(100% - 4rem),transparent)}
460
+ /* The server's notice and toggle are inert stand-ins. They show, and a long source is clamped, only where scripting is enabled, so mounting
461
+ moves nothing; a reader without JavaScript keeps the whole source and no notice. */
462
+ .hyle-mermaid-gate[inert],.hyle-mermaid-more[inert]{display:none}
463
+ @media screen and (scripting:enabled){
464
+ .hyle-mermaid-gate[inert]{display:flex}
465
+ .hyle-mermaid-more[inert]{display:block}
466
+ .hyle-mermaid[data-clamp] div.hyle-mermaid-source>pre{max-height:15rem;overflow-y:auto;-webkit-mask-image:linear-gradient(#000 calc(100% - 4rem),transparent);mask-image:linear-gradient(#000 calc(100% - 4rem),transparent)}
467
+ }
468
+ /* While drawing: the spinner turns with transform only, so it runs on the compositor and keeps turning while Mermaid blocks the main thread. */
469
+ .hyle-mermaid-drawing{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;min-height:240px;padding:24px 16px;font-size:14px;line-height:1.6;color:var(--h-text-muted);text-align:center}
470
+ .hyle-mermaid-spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--h-accent,Highlight) 22%,transparent);border-top-color:var(--h-accent,Highlight);border-radius:50%;animation:hyle-mermaid-spin .9s linear infinite;will-change:transform}
471
+ @keyframes hyle-mermaid-spin{to{transform:rotate(1turn)}}
472
+ @media (prefers-reduced-motion:reduce){.hyle-mermaid-spinner{animation:none}}
473
+
474
+ /* ---- print: the whole source of anything not drawn; a diagram drawn in the dark theme goes dark-on-white ---- */
475
+ .hyle-print-status{position:fixed;inset:auto 16px 16px auto;z-index:100;max-width:calc(100vw - 32px);padding:8px 12px;border:1px solid GrayText;border-radius:6px;background:Canvas;color:CanvasText;font:500 13px/1.4 system-ui,sans-serif}
476
+ @media print{
477
+ .hyle-mermaid-gate-body,.hyle-mermaid-draw,.hyle-mermaid-more,.hyle-mermaid-drawing,.hyle-mermaid-hint,.hyle-print-status{display:none}
478
+ div.hyle-mermaid-source[data-drawing]{display:block}
479
+ div.hyle-mermaid-source[data-clamped]>pre{max-height:none;-webkit-mask-image:none;mask-image:none}
480
+ .hyle-mermaid>pre,.hyle-mermaid-source>pre{white-space:pre-wrap;overflow-wrap:anywhere}
481
+ /* Trade-off: a classDef colour in the source is inverted too (hue kept). Redrawing in the light theme is what beforeprint cannot wait for. */
482
+ .hyle-mermaid[data-mermaid-theme=dark]{background:#fff}
483
+ .hyle-mermaid[data-mermaid-theme=dark] .hyle-mermaid-svg svg{filter:invert(1) hue-rotate(180deg)}
484
+ }
420
485
 
421
486
  /* ---- diagram viewer (the click-to-expand trigger and its dialog, loaded on first click) ----
422
487
  Public variables: --hyle-viewer-bg, --hyle-viewer-accent, --hyle-viewer-up, --hyle-viewer-down, --hyle-viewer-dim (opacity of dimmed
423
488
  parts), --hyle-viewer-backdrop. All fall back to the --hyle-* surface, accent, warn and ok tokens above. */
424
489
  .hyle-mermaid-open{position:relative;display:block;width:100%;margin:0;padding:0;border:0;border-radius:inherit;background:none;color:inherit;font:inherit;text-align:inherit;cursor:zoom-in}
425
- .hyle-mermaid-open:focus-visible{outline-offset:-2px}
426
- .hyle-mermaid-hint{position:absolute;top:8px;right:8px;padding:2px 10px;border:var(--h-border-width,1px) solid var(--h-border,GrayText);border-radius:var(--h-radius,6px);background:var(--h-surface-2,Canvas);font:500 12px/1.6 var(--h-font-sans,system-ui,sans-serif);color:var(--h-text-muted,CanvasText);opacity:0;transition:opacity .15s;pointer-events:none}
427
- .hyle-mermaid-open:hover .hyle-mermaid-hint,.hyle-mermaid-open:focus-visible .hyle-mermaid-hint{opacity:1}
490
+ .hyle-mermaid-hint{position:absolute;top:8px;right:8px;margin:0;padding:2px 10px;border:var(--h-border-width,1px) solid var(--h-border,GrayText);border-radius:var(--h-radius,6px);background:var(--h-surface-2,Canvas);font:500 12px/1.6 var(--h-font-sans,system-ui,sans-serif);color:var(--h-text-muted,CanvasText);opacity:0;transition:opacity .15s;cursor:zoom-in}
491
+ .hyle-mermaid-open:hover .hyle-mermaid-hint,.hyle-mermaid-hint:focus-visible{opacity:1}
428
492
  @media (hover:none){.hyle-mermaid-hint{opacity:1}}
429
493
  @media (prefers-reduced-motion:reduce){.hyle-mermaid-hint{transition:none}}
430
494
  html.hyle-viewer-lock{overflow:hidden;scrollbar-gutter:stable}
431
- html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
495
+ /* plain classes set by the viewer, never :has(): each :has rule on <html> is re-checked on every DOM change, and a Mermaid draw makes ~1,500 */
496
+ html.hyle-viewer-lock.hyle-viewer-fs{scrollbar-gutter:auto}
432
497
 
433
498
  .hyle-viewer{--hv-bg:var(--hyle-viewer-bg,var(--h-surface,Canvas));--hv-accent:var(--hyle-viewer-accent,var(--h-accent,#6f9bff));--hv-up:var(--hyle-viewer-up,var(--h-warn,#e0a030));--hv-down:var(--hyle-viewer-down,var(--h-ok,#3fb27f));--hv-dim:var(--hyle-viewer-dim,.16);
434
499
  --hv-text:var(--h-text,CanvasText);--hv-muted:var(--h-text-muted,color-mix(in srgb,var(--hv-text) 65%,transparent));--hv-border:var(--h-border,color-mix(in srgb,var(--hv-text) 28%,transparent));--hv-raise:var(--h-surface-2,color-mix(in srgb,var(--hv-text) 8%,var(--hv-bg)));--hv-hairline:var(--h-hairline,color-mix(in srgb,var(--hv-text) 14%,transparent));--hv-focus:var(--h-focus,var(--hv-accent));
@@ -458,27 +523,7 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
458
523
  .hv-view.hv-grabbing{cursor:grabbing}
459
524
  /* --hv-k is the current zoom, written by the viewer while something is highlighted: strokes of highlights are divided by it so they keep their on-screen width. */
460
525
  .hv-stage{--hv-k:1;position:absolute;top:0;left:0;transform-origin:0 0}
461
- .hv-stage svg{display:block;position:static!important;width:100%;height:100%;max-width:none!important}
462
- .hv-stage .hv-n{cursor:pointer;outline:none}
463
- .hv-stage .hv-n,.hv-stage .hv-e{transition:opacity .15s}
464
- @media (prefers-reduced-motion:reduce){.hv-stage .hv-n,.hv-stage .hv-e{transition:none}}
465
- .hv-stage.hv-plain .hv-n,.hv-stage.hv-plain .hv-e{transition:none}
466
- .hv-stage.hv-active .hv-n:not(.hv-on),.hv-stage.hv-active .hv-e:not(.hv-on){opacity:var(--hv-dim)}
467
- .hv-stage .hv-n:focus-visible :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-focus)!important;stroke-width:calc(3px / var(--hv-k,1))!important}
468
- .hv-stage .hv-n.hv-nb :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(2px / var(--hv-k,1))!important}
469
- .hv-stage .hv-n.hv-up :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-up)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
470
- .hv-stage .hv-n.hv-down :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-down)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
471
- .hv-stage .hv-n.hv-sel :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(3.5px / var(--hv-k,1))!important}
472
- .hv-stage .hv-n.hv-hit :is(rect,polygon,circle,ellipse,path){stroke:var(--hv-accent)!important;stroke-width:calc(3px / var(--hv-k,1))!important}
473
- .hv-stage .hv-n.hv-cur :is(rect,polygon,circle,ellipse,path){stroke-width:calc(5px / var(--hv-k,1))!important}
474
- .hv-stage text.hv-hit,.hv-stage text.hv-hit tspan{fill:var(--hv-accent)!important;font-weight:700}
475
- .hv-stage text.hv-cur{text-decoration:underline}
476
- .hv-stage path.hv-nb{stroke:var(--hv-accent)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
477
- .hv-stage path.hv-up{stroke:var(--hv-up)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
478
- .hv-stage path.hv-down{stroke:var(--hv-down)!important;stroke-width:calc(2.5px / var(--hv-k,1))!important}
479
- .hv-stage path.hv-flow{stroke-dasharray:calc(7px / var(--hv-k,1)) calc(6px / var(--hv-k,1))!important;animation:hv-dash .9s linear infinite}
480
- @keyframes hv-dash{to{stroke-dashoffset:calc(-26px / var(--hv-k,1))}}
481
- @media (prefers-reduced-motion:reduce){.hv-stage path.hv-flow{animation:none}}
526
+ /* The diagram itself lives in the stage's shadow root, so its rules are in viewer/svg-css.ts and the SVG's own <style> cannot reach this page. */
482
527
 
483
528
  .hv-mini{position:absolute;right:12px;bottom:44px;width:176px;height:120px;border:1px solid var(--hv-border);border-radius:var(--h-radius,6px);background:color-mix(in srgb,var(--hv-bg) 88%,transparent);color:var(--hv-muted);accent-color:var(--hv-accent);cursor:crosshair;touch-action:none}
484
529
  @media (max-width:640px){.hv-mini{width:120px;height:82px}}
@@ -597,6 +642,21 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
597
642
  .hyle-banner{flex-wrap:wrap}
598
643
  .hyle-cm[data-status="held"]>article{margin-inline:-8px;padding:8px}
599
644
  }
645
+ /* reactions, votes and sort */
646
+ .hyle-reactions{--hc-like-on:var(--hyle-comments-like-on,var(--h-link))}
647
+ .hyle-reactions .hyle-react{margin-top:0;min-height:40px}
648
+ .hyle-react{flex-wrap:wrap}
649
+ .hyle-reaction-set{display:inline-flex;flex-wrap:wrap;align-items:center;gap:8px}
650
+ .hyle-cm-btn.chip[aria-pressed="true"]{color:var(--hc-like-on);font-weight:600}
651
+ .hyle-react .hyle-btn.chip[aria-pressed="true"]{border-color:var(--hc-like-on)}
652
+ .hyle-react .hyle-sk{width:96px;height:40px}
653
+ .hyle-cm-votes{display:inline-flex;align-items:center}
654
+ .hyle-cm-votes .hyle-cm-btn{justify-content:center;min-width:32px}
655
+ .hyle-cm-score{min-width:3ch;text-align:center;font:500 13px/1 var(--h-font-mono);font-variant-numeric:tabular-nums;color:var(--h-text)}
656
+ .hyle-cm-sort{display:inline-flex;gap:4px}
657
+ .hyle-cm-votes .hyle-cm-btn[aria-pressed="true"] .hyle-ic{fill:none;stroke:var(--hc-like-on,currentColor);stroke-width:2.2}
658
+ .hyle-cm-sort .hyle-cm-btn[aria-pressed="true"]{font-weight:600}
659
+ @container hyle (max-width:640px){.hyle-cm-votes .hyle-cm-btn{min-width:40px}}
600
660
  .hyle-cm-note{margin-top:16px;font-size:13px;color:var(--h-text-muted)}
601
661
  .hyle-cm-reply,.hyle-cm-main>.hyle-cm-compose{margin-top:12px}
602
662
 
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/react/toc-spy.tsx
22
+ var toc_spy_exports = {};
23
+ __export(toc_spy_exports, {
24
+ TocSpy: () => TocSpy
25
+ });
26
+ module.exports = __toCommonJS(toc_spy_exports);
27
+ var import_react = require("react");
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ var LINE = 0.25;
30
+ var ABOVE_THE_LINE = "1000000px 0px -75% 0px";
31
+ function TocSpy({ ids }) {
32
+ const marker = (0, import_react.useRef)(null);
33
+ const key = ids.join("\n");
34
+ (0, import_react.useEffect)(() => {
35
+ const links = Array.from(marker.current?.parentElement?.querySelectorAll(".hyle-toc-list a[href^='#']") ?? []);
36
+ const headings = key.split("\n").map((id) => document.getElementById(id)).filter((h) => h !== null);
37
+ if (links.length === 0 || headings.length === 0 || typeof IntersectionObserver !== "function") return;
38
+ const update = () => {
39
+ let active = headings[0];
40
+ for (const heading of headings) if (heading.getBoundingClientRect().top <= window.innerHeight * LINE) active = heading;
41
+ for (const link of links) {
42
+ if (link.getAttribute("href") === `#${active.id}`) link.setAttribute("aria-current", "location");
43
+ else link.removeAttribute("aria-current");
44
+ }
45
+ };
46
+ const observer = new IntersectionObserver(update, { rootMargin: ABOVE_THE_LINE });
47
+ for (const heading of headings) observer.observe(heading);
48
+ update();
49
+ return () => {
50
+ observer.disconnect();
51
+ for (const link of links) link.removeAttribute("aria-current");
52
+ };
53
+ }, [key]);
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: marker, hidden: true });
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ TocSpy
59
+ });
@@ -0,0 +1,15 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ interface TocSpyProps {
4
+ /** The `id`s of the headings to follow, in document order (already scoped, as in the TOC hrefs). */
5
+ ids: readonly string[];
6
+ }
7
+ /**
8
+ * Scroll-spy for the rail contents list: the link of the last heading reached carries `aria-current="location"`, the first one
9
+ * before that. It works on its parent element's links only, and the links themselves are server HTML. The one element it renders
10
+ * is a hidden marker that locates that parent.
11
+ * shortcut: a last section too short to reach the line never becomes current; add an end marker as `DocsEnhance` has if it matters.
12
+ */
13
+ declare function TocSpy({ ids }: TocSpyProps): ReactElement;
14
+
15
+ export { TocSpy, type TocSpyProps };
@@ -0,0 +1,15 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ interface TocSpyProps {
4
+ /** The `id`s of the headings to follow, in document order (already scoped, as in the TOC hrefs). */
5
+ ids: readonly string[];
6
+ }
7
+ /**
8
+ * Scroll-spy for the rail contents list: the link of the last heading reached carries `aria-current="location"`, the first one
9
+ * before that. It works on its parent element's links only, and the links themselves are server HTML. The one element it renders
10
+ * is a hidden marker that locates that parent.
11
+ * shortcut: a last section too short to reach the line never becomes current; add an end marker as `DocsEnhance` has if it matters.
12
+ */
13
+ declare function TocSpy({ ids }: TocSpyProps): ReactElement;
14
+
15
+ export { TocSpy, type TocSpyProps };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ // src/react/toc-spy.tsx
4
+ import { useEffect, useRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var LINE = 0.25;
7
+ var ABOVE_THE_LINE = "1000000px 0px -75% 0px";
8
+ function TocSpy({ ids }) {
9
+ const marker = useRef(null);
10
+ const key = ids.join("\n");
11
+ useEffect(() => {
12
+ const links = Array.from(marker.current?.parentElement?.querySelectorAll(".hyle-toc-list a[href^='#']") ?? []);
13
+ const headings = key.split("\n").map((id) => document.getElementById(id)).filter((h) => h !== null);
14
+ if (links.length === 0 || headings.length === 0 || typeof IntersectionObserver !== "function") return;
15
+ const update = () => {
16
+ let active = headings[0];
17
+ for (const heading of headings) if (heading.getBoundingClientRect().top <= window.innerHeight * LINE) active = heading;
18
+ for (const link of links) {
19
+ if (link.getAttribute("href") === `#${active.id}`) link.setAttribute("aria-current", "location");
20
+ else link.removeAttribute("aria-current");
21
+ }
22
+ };
23
+ const observer = new IntersectionObserver(update, { rootMargin: ABOVE_THE_LINE });
24
+ for (const heading of headings) observer.observe(heading);
25
+ update();
26
+ return () => {
27
+ observer.disconnect();
28
+ for (const link of links) link.removeAttribute("aria-current");
29
+ };
30
+ }, [key]);
31
+ return /* @__PURE__ */ jsx("span", { ref: marker, hidden: true });
32
+ }
33
+ export {
34
+ TocSpy
35
+ };
@@ -52,6 +52,22 @@ type ArticleContent = {
52
52
  readonly format: "md";
53
53
  readonly markdown: string;
54
54
  };
55
+ /** The document's authored fields (tags, kicker, status label, cover, author, word count). Absent from an older server. */
56
+ interface DocumentMetaFields {
57
+ readonly tags?: readonly string[];
58
+ readonly kicker?: string | null;
59
+ readonly status?: string | null;
60
+ /** `path` is root-relative (`/assets/<id>`); serve it through the host's asset route. */
61
+ readonly cover?: {
62
+ readonly path: string;
63
+ } | null;
64
+ readonly author?: {
65
+ readonly name: string;
66
+ readonly url: string | null;
67
+ } | null;
68
+ /** Words in the rendered prose (code, title and math excluded), counted by the server. Absent from an older server. */
69
+ readonly word_count?: number | null;
70
+ }
55
71
  interface ResolvedArticle {
56
72
  readonly cp: 1;
57
73
  readonly kind: "article";
@@ -67,7 +83,7 @@ interface ResolvedArticle {
67
83
  readonly published_at: string;
68
84
  readonly updated_at: string;
69
85
  readonly locale: string;
70
- };
86
+ } & DocumentMetaFields;
71
87
  readonly content: ArticleContent;
72
88
  readonly frontmatter: Record<string, unknown>;
73
89
  readonly toc: readonly TocEntry[];
@@ -84,7 +100,7 @@ interface ResolvedArticle {
84
100
  readonly fallback?: Fallback;
85
101
  readonly cache: CacheInfo;
86
102
  }
87
- interface ListItem {
103
+ interface ListItem extends DocumentMetaFields {
88
104
  readonly slug: string;
89
105
  readonly title: string;
90
106
  readonly description: string | null;
@@ -149,6 +165,12 @@ interface Mounts {
149
165
  readonly cache: CacheInfo;
150
166
  }
151
167
  type MountsResult = Mounts | ResolvedDisabled;
168
+ /** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
169
+ type ReactionKind = "like" | "love" | "insightful" | "celebrate";
170
+ /** Reactions on a subject by kind; a kind nobody used is absent. */
171
+ type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
172
+ /** A comment vote: up or down. */
173
+ type VoteValue = 1 | -1;
152
174
  /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
153
175
  interface EngageComment {
154
176
  readonly id: string;
@@ -163,10 +185,16 @@ interface EngageComment {
163
185
  readonly created_at: string;
164
186
  readonly edited_at: string | null;
165
187
  readonly like_count: number;
188
+ /** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
189
+ readonly score?: number;
190
+ /** Absent from a hyle without reaction kinds. */
191
+ readonly reaction_counts?: ReactionCounts;
166
192
  /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
167
193
  readonly removed: boolean;
168
194
  /** On a tombstone only: who removed it. Absent on a live comment. */
169
195
  readonly removed_by?: "moderator" | "author";
196
+ /** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
197
+ readonly unrenderable?: true;
170
198
  readonly body: {
171
199
  readonly format: "hast";
172
200
  readonly tree: unknown;
@@ -174,8 +202,12 @@ interface EngageComment {
174
202
  /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
175
203
  readonly mine?: boolean;
176
204
  readonly liked_by_me?: boolean;
205
+ /** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
206
+ readonly my_reactions?: readonly ReactionKind[];
177
207
  /** ISO instant until which the reader may edit, or null. */
178
208
  readonly can_edit_until?: string | null;
209
+ /** The reader's own vote, or null. Absent from a hyle without votes. */
210
+ readonly my_vote?: VoteValue | null;
179
211
  }
180
212
  /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
181
213
  interface EngageHeldComment {
@@ -186,6 +218,8 @@ interface EngageHeldComment {
186
218
  readonly created_at: string;
187
219
  readonly edited_at: string | null;
188
220
  readonly can_edit_until: string | null;
221
+ /** As on `EngageComment`. */
222
+ readonly unrenderable?: true;
189
223
  readonly body: {
190
224
  readonly format: "hast";
191
225
  readonly tree: unknown;
@@ -198,12 +232,18 @@ interface EngageListing {
198
232
  readonly publication_id: string;
199
233
  readonly comment_count: number;
200
234
  readonly like_count: number;
201
- /** More than the 500 listed comments exist. */
235
+ /** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
236
+ readonly reaction_counts?: ReactionCounts;
237
+ /** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
202
238
  readonly truncated: boolean;
239
+ /** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
240
+ readonly next_cursor?: string | null;
203
241
  readonly comments: readonly EngageComment[];
204
242
  /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
205
243
  readonly liked_by_me?: boolean;
244
+ /** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
245
+ readonly my_reactions?: readonly ReactionKind[];
206
246
  readonly mine_held?: readonly EngageHeldComment[];
207
247
  }
208
248
 
209
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, EngageComment as E, Fallback as F, ListItem as L, MountsResult as M, NavItem as N, Resolved as R, TocEntry as T, ArticleContent as a, EngageHeldComment as b, EngageListing as c, Mount as d, Mounts as e, NavNode as f, NavTree as g, ResolvedArticle as h, ResolvedDisabled as i, ResolvedList as j, ResolvedNotFound as k, ResolvedRedirect as l };
249
+ export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, EngageComment as E, Fallback as F, ListItem as L, Mount as M, NavItem as N, ReactionCounts as R, TocEntry as T, VoteValue as V, ArticleContent as a, EngageHeldComment as b, EngageListing as c, Mounts as d, MountsResult as e, NavNode as f, NavTree as g, ReactionKind as h, Resolved as i, ResolvedArticle as j, ResolvedDisabled as k, ResolvedList as l, ResolvedNotFound as m, ResolvedRedirect as n };
@@ -52,6 +52,22 @@ type ArticleContent = {
52
52
  readonly format: "md";
53
53
  readonly markdown: string;
54
54
  };
55
+ /** The document's authored fields (tags, kicker, status label, cover, author, word count). Absent from an older server. */
56
+ interface DocumentMetaFields {
57
+ readonly tags?: readonly string[];
58
+ readonly kicker?: string | null;
59
+ readonly status?: string | null;
60
+ /** `path` is root-relative (`/assets/<id>`); serve it through the host's asset route. */
61
+ readonly cover?: {
62
+ readonly path: string;
63
+ } | null;
64
+ readonly author?: {
65
+ readonly name: string;
66
+ readonly url: string | null;
67
+ } | null;
68
+ /** Words in the rendered prose (code, title and math excluded), counted by the server. Absent from an older server. */
69
+ readonly word_count?: number | null;
70
+ }
55
71
  interface ResolvedArticle {
56
72
  readonly cp: 1;
57
73
  readonly kind: "article";
@@ -67,7 +83,7 @@ interface ResolvedArticle {
67
83
  readonly published_at: string;
68
84
  readonly updated_at: string;
69
85
  readonly locale: string;
70
- };
86
+ } & DocumentMetaFields;
71
87
  readonly content: ArticleContent;
72
88
  readonly frontmatter: Record<string, unknown>;
73
89
  readonly toc: readonly TocEntry[];
@@ -84,7 +100,7 @@ interface ResolvedArticle {
84
100
  readonly fallback?: Fallback;
85
101
  readonly cache: CacheInfo;
86
102
  }
87
- interface ListItem {
103
+ interface ListItem extends DocumentMetaFields {
88
104
  readonly slug: string;
89
105
  readonly title: string;
90
106
  readonly description: string | null;
@@ -149,6 +165,12 @@ interface Mounts {
149
165
  readonly cache: CacheInfo;
150
166
  }
151
167
  type MountsResult = Mounts | ResolvedDisabled;
168
+ /** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
169
+ type ReactionKind = "like" | "love" | "insightful" | "celebrate";
170
+ /** Reactions on a subject by kind; a kind nobody used is absent. */
171
+ type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
172
+ /** A comment vote: up or down. */
173
+ type VoteValue = 1 | -1;
152
174
  /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
153
175
  interface EngageComment {
154
176
  readonly id: string;
@@ -163,10 +185,16 @@ interface EngageComment {
163
185
  readonly created_at: string;
164
186
  readonly edited_at: string | null;
165
187
  readonly like_count: number;
188
+ /** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
189
+ readonly score?: number;
190
+ /** Absent from a hyle without reaction kinds. */
191
+ readonly reaction_counts?: ReactionCounts;
166
192
  /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
167
193
  readonly removed: boolean;
168
194
  /** On a tombstone only: who removed it. Absent on a live comment. */
169
195
  readonly removed_by?: "moderator" | "author";
196
+ /** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
197
+ readonly unrenderable?: true;
170
198
  readonly body: {
171
199
  readonly format: "hast";
172
200
  readonly tree: unknown;
@@ -174,8 +202,12 @@ interface EngageComment {
174
202
  /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
175
203
  readonly mine?: boolean;
176
204
  readonly liked_by_me?: boolean;
205
+ /** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
206
+ readonly my_reactions?: readonly ReactionKind[];
177
207
  /** ISO instant until which the reader may edit, or null. */
178
208
  readonly can_edit_until?: string | null;
209
+ /** The reader's own vote, or null. Absent from a hyle without votes. */
210
+ readonly my_vote?: VoteValue | null;
179
211
  }
180
212
  /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
181
213
  interface EngageHeldComment {
@@ -186,6 +218,8 @@ interface EngageHeldComment {
186
218
  readonly created_at: string;
187
219
  readonly edited_at: string | null;
188
220
  readonly can_edit_until: string | null;
221
+ /** As on `EngageComment`. */
222
+ readonly unrenderable?: true;
189
223
  readonly body: {
190
224
  readonly format: "hast";
191
225
  readonly tree: unknown;
@@ -198,12 +232,18 @@ interface EngageListing {
198
232
  readonly publication_id: string;
199
233
  readonly comment_count: number;
200
234
  readonly like_count: number;
201
- /** More than the 500 listed comments exist. */
235
+ /** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
236
+ readonly reaction_counts?: ReactionCounts;
237
+ /** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
202
238
  readonly truncated: boolean;
239
+ /** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
240
+ readonly next_cursor?: string | null;
203
241
  readonly comments: readonly EngageComment[];
204
242
  /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
205
243
  readonly liked_by_me?: boolean;
244
+ /** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
245
+ readonly my_reactions?: readonly ReactionKind[];
206
246
  readonly mine_held?: readonly EngageHeldComment[];
207
247
  }
208
248
 
209
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, EngageComment as E, Fallback as F, ListItem as L, MountsResult as M, NavItem as N, Resolved as R, TocEntry as T, ArticleContent as a, EngageHeldComment as b, EngageListing as c, Mount as d, Mounts as e, NavNode as f, NavTree as g, ResolvedArticle as h, ResolvedDisabled as i, ResolvedList as j, ResolvedNotFound as k, ResolvedRedirect as l };
249
+ export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, EngageComment as E, Fallback as F, ListItem as L, Mount as M, NavItem as N, ReactionCounts as R, TocEntry as T, VoteValue as V, ArticleContent as a, EngageHeldComment as b, EngageListing as c, Mounts as d, MountsResult as e, NavNode as f, NavTree as g, ReactionKind as h, Resolved as i, ResolvedArticle as j, ResolvedDisabled as k, ResolvedList as l, ResolvedNotFound as m, ResolvedRedirect as n };