@tdacorp/hyle-sdk 0.17.0 → 0.22.2

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 (92) hide show
  1. package/README.md +261 -42
  2. package/dist/check-routes-bin.js +190 -53
  3. package/dist/{chunk-6VOHFFA5.js → chunk-7T5EEJHK.js} +2 -2
  4. package/dist/chunk-DUPT6XLB.js +57 -0
  5. package/dist/chunk-IW3TUD4G.js +841 -0
  6. package/dist/{chunk-MGSUQBDW.js → chunk-KU7LWK4E.js} +249 -24
  7. package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
  8. package/dist/chunk-SFFBZFEN.js +178 -0
  9. package/dist/chunk-U74B7AUG.js +398 -0
  10. package/dist/chunk-ZIW6FDU2.js +1126 -0
  11. package/dist/client-BGjmEWhN.d.cts +207 -0
  12. package/dist/client-D0LTpr3Y.d.ts +207 -0
  13. package/dist/code-copy.cjs +74 -0
  14. package/dist/code-copy.d.cts +18 -0
  15. package/dist/code-copy.d.ts +18 -0
  16. package/dist/code-copy.js +50 -0
  17. package/dist/comments.cjs +738 -280
  18. package/dist/comments.d.cts +66 -3
  19. package/dist/comments.d.ts +66 -3
  20. package/dist/comments.js +419 -331
  21. package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
  22. package/dist/docs-enhance.cjs +7 -4
  23. package/dist/docs-enhance.d.cts +5 -3
  24. package/dist/docs-enhance.d.ts +5 -3
  25. package/dist/docs-enhance.js +8 -5
  26. package/dist/{embed-DNTZ2UXv.d.ts → embed-CbtsbZs3.d.cts} +5 -3
  27. package/dist/{embed-BmdwA2G9.d.cts → embed-Cf_2ZR5x.d.ts} +5 -3
  28. package/dist/fragment-alias.cjs +51 -0
  29. package/dist/fragment-alias.d.cts +7 -0
  30. package/dist/fragment-alias.d.ts +7 -0
  31. package/dist/fragment-alias.js +27 -0
  32. package/dist/html.cjs +886 -0
  33. package/dist/html.d.cts +20 -0
  34. package/dist/html.d.ts +20 -0
  35. package/dist/html.js +45 -0
  36. package/dist/index.cjs +244 -24
  37. package/dist/index.d.cts +22 -68
  38. package/dist/index.d.ts +22 -68
  39. package/dist/index.js +12 -2
  40. package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.cts} +9 -0
  41. package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.ts} +9 -0
  42. package/dist/mermaid-diagram.cjs +441 -125
  43. package/dist/mermaid-diagram.d.cts +23 -7
  44. package/dist/mermaid-diagram.d.ts +23 -7
  45. package/dist/mermaid-diagram.js +213 -51
  46. package/dist/mermaid-image.cjs +137 -60
  47. package/dist/mermaid-image.d.cts +4 -3
  48. package/dist/mermaid-image.d.ts +4 -3
  49. package/dist/mermaid-image.js +27 -28
  50. package/dist/next.cjs +836 -304
  51. package/dist/next.d.cts +45 -20
  52. package/dist/next.d.ts +45 -20
  53. package/dist/next.js +151 -40
  54. package/dist/print-coordinator.cjs +157 -0
  55. package/dist/print-coordinator.d.cts +27 -0
  56. package/dist/print-coordinator.d.ts +27 -0
  57. package/dist/print-coordinator.js +83 -0
  58. package/dist/react.cjs +603 -240
  59. package/dist/react.d.cts +148 -30
  60. package/dist/react.d.ts +148 -30
  61. package/dist/react.js +26 -4
  62. package/dist/reactions.cjs +653 -0
  63. package/dist/reactions.d.cts +27 -0
  64. package/dist/reactions.d.ts +27 -0
  65. package/dist/reactions.js +364 -0
  66. package/dist/{resolve-euZ4-aC9.d.cts → resolve-BnIv7aB7.d.cts} +2 -2
  67. package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BysHtZ_i.d.ts} +2 -2
  68. package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
  69. package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
  70. package/dist/sanitize-BpY_AdZh.d.cts +23 -0
  71. package/dist/sanitize-BpY_AdZh.d.ts +23 -0
  72. package/dist/styles.css +100 -29
  73. package/dist/toc-spy.cjs +60 -0
  74. package/dist/toc-spy.d.cts +15 -0
  75. package/dist/toc-spy.d.ts +15 -0
  76. package/dist/toc-spy.js +36 -0
  77. package/dist/{types-Czt887Iv.d.cts → types-D09Z072G.d.cts} +57 -2
  78. package/dist/{types-Czt887Iv.d.ts → types-D09Z072G.d.ts} +57 -2
  79. package/dist/use-cache.cjs +89 -13
  80. package/dist/use-cache.d.cts +12 -5
  81. package/dist/use-cache.d.ts +12 -5
  82. package/dist/use-cache.js +8 -8
  83. package/dist/youtube-facade.cjs +50 -0
  84. package/dist/youtube-facade.d.cts +17 -0
  85. package/dist/youtube-facade.d.ts +17 -0
  86. package/dist/youtube-facade.js +26 -0
  87. package/package.json +16 -3
  88. package/dist/chunk-67IOIAVW.js +0 -35
  89. package/dist/chunk-DMK4XQLU.js +0 -1556
  90. package/dist/chunk-PJMJMP66.js +0 -63
  91. package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
  92. 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}
@@ -261,6 +266,8 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
261
266
 
262
267
  /* ---- prose layer: rendered markdown, plain semantic elements ---- */
263
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)}}
264
271
  .hyle-prose img{max-width:100%;height:auto}
265
272
  .hyle-prose>*+*{margin-top:var(--h-paragraph-gap)}
266
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}
@@ -271,9 +278,10 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
271
278
  .hyle-prose :where(h1,h2,h3,h4)+*{margin-top:12px}
272
279
  .hyle-prose h2:first-child{margin-top:0;padding-top:0;border-top:0}
273
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:"#"}
274
282
  .hyle-prose :is(h2,h3,h4):hover .hyle-anchor,.hyle-anchor:focus-visible{opacity:1}
275
283
  .hyle-prose h2 .hyle-anchor{top:var(--h-block-gap)}
276
- .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}
277
285
  .hyle-prose a:not(.hyle-anchor){color:var(--h-link);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
278
286
  .hyle-prose a:not(.hyle-anchor):hover{text-decoration-thickness:2px}
279
287
  .hyle-prose strong{font-weight:600}
@@ -325,6 +333,10 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
325
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)}
326
334
  .hyle-codeblock pre code{display:block;width:max-content;min-width:100%;font:inherit;background:none;border:0;padding:0}
327
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)}
328
340
  .hljs-keyword,.hljs-selector-tag,.hljs-tag,.hljs-doctag,.hljs-section{color:var(--h-syn-keyword)}
329
341
  .hljs-string,.hljs-regexp,.hljs-template-variable,.hljs-addition{color:var(--h-syn-string)}
330
342
  .hljs-number,.hljs-unit,.hljs-bullet{color:var(--h-syn-number)}
@@ -338,28 +350,30 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
338
350
  .hljs-addition{background:color-mix(in srgb,var(--h-ok) 12%,transparent);display:inline-block;width:100%}
339
351
  .hljs-deletion{background:color-mix(in srgb,var(--h-bad) 12%,transparent);display:inline-block;width:100%}
340
352
 
341
- /* math: KaTeX markup. The real stylesheet and fonts come with katex; these rules only set colour, spacing and the fallbacks used in this kit */
342
- .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}
343
- .katex .mord.rm,.katex .mop,.katex .mbin,.katex .mrel,.katex .mopen,.katex .mclose,.katex .mpunct,.katex .num{font-style:normal}
344
- .katex .mbin,.katex .mrel{margin:0 .28em}
345
- .katex .msupsub{font-size:.7em;vertical-align:.5em;font-style:normal;line-height:0}
346
- .katex .mfrac{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;margin:0 .12em;text-align:center}
347
- .katex .mfrac>span:first-child{padding:0 .2em .1em;border-bottom:1px solid currentColor}
348
- .katex .mfrac>span:last-child{padding:.1em .2em 0}
349
- .katex .delim{font-size:2.2em;font-weight:200;font-style:normal;line-height:.8;vertical-align:middle;color:var(--h-text-muted)}
350
- .katex .text{font-family:var(--h-font-sans);font-style:normal;font-size:.8em}
351
- .katex-mathml{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
352
- .katex-display{display:block;overflow-x:auto;text-align:center;padding:16px 0}
353
- .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}
354
355
 
355
356
  /* figure */
356
357
  .hyle-prose figure{margin-inline:0}
357
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)}
358
359
  .hyle-prose figcaption{margin-top:8px;font-size:14px;line-height:1.5;color:var(--h-text-muted)}
359
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
+
360
373
  /* callout */
361
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))}
362
375
  .hyle-callout[data-kind="tip"]{--k:var(--h-ok)}
376
+ .hyle-callout[data-kind="important"]{--k:var(--h-link)}
363
377
  .hyle-callout[data-kind="warning"]{--k:var(--h-warn)}
364
378
  .hyle-callout[data-kind="caution"]{--k:var(--h-bad)}
365
379
  .hyle-callout>.hyle-ic{width:20px;height:20px;margin-top:2px;color:var(--k)}
@@ -368,7 +382,7 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
368
382
  .hyle-callout .bd{font-size:.9375em;line-height:1.6}
369
383
 
370
384
  /* mermaid placeholder frame */
371
- .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}
372
386
  .hyle-mermaid .hyle-stage{display:flex;align-items:center;justify-content:center;gap:0;padding:32px 16px;flex-wrap:wrap;row-gap:12px}
373
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)}
374
388
  .hyle-mermaid .edge{width:32px;height:1px;background:var(--h-border);position:relative}
@@ -400,11 +414,8 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
400
414
  .hyle-prose a[data-footnote-backref]{margin-left:4px;text-decoration:none;color:var(--h-link)}
401
415
 
402
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}}
403
- @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}}
404
418
 
405
- .katex .mop.lim{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;line-height:1;margin:0 .2em;font-style:normal}
406
- .katex .mop.lim .sym{font-size:1.6em}
407
- .katex .mop.lim small{font-size:.65em}
408
419
  .hyle-docs-main>.hyle-prose{margin-top:32px}
409
420
  .hyle-state>div[data-slot="notfound.body"]{margin-top:16px;color:var(--h-text-muted)}
410
421
  .hyle-state>div[data-slot="notfound.body"]>p{margin:0}
@@ -412,7 +423,8 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
412
423
  .hyle-nav-m .hyle-side-head{margin:0;padding:12px 12px 0}
413
424
 
414
425
  /* ---- additions not in the design kit (the kit mocks these; the real hast needs them) ---- */
415
- .hyle .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
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}
416
428
  .hyle-mermaid>pre{padding:16px}
417
429
  .hyle-mermaid[data-state=pending]{min-height:240px}
418
430
  /* A stored render: the box is reserved by aspect-ratio before the image arrives, so nothing shifts. */
@@ -426,18 +438,62 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
426
438
  .hyle-mermaid-svg{display:flex;justify-content:center;padding:16px;contain:paint}
427
439
  .hyle-mermaid-svg svg{position:static!important;max-width:100%;height:auto}
428
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
+ }
429
485
 
430
486
  /* ---- diagram viewer (the click-to-expand trigger and its dialog, loaded on first click) ----
431
487
  Public variables: --hyle-viewer-bg, --hyle-viewer-accent, --hyle-viewer-up, --hyle-viewer-down, --hyle-viewer-dim (opacity of dimmed
432
488
  parts), --hyle-viewer-backdrop. All fall back to the --hyle-* surface, accent, warn and ok tokens above. */
433
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}
434
- .hyle-mermaid-open:focus-visible{outline-offset:-2px}
435
- .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}
436
- .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}
437
492
  @media (hover:none){.hyle-mermaid-hint{opacity:1}}
438
493
  @media (prefers-reduced-motion:reduce){.hyle-mermaid-hint{transition:none}}
439
494
  html.hyle-viewer-lock{overflow:hidden;scrollbar-gutter:stable}
440
- 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}
441
497
 
442
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);
443
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));
@@ -559,10 +615,10 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
559
615
  .hyle-cm-acts small{font-size:12px;color:var(--h-text-faint)}
560
616
  .hyle-cm-depth{font-size:13px;color:var(--h-text-faint);padding:0 8px}
561
617
  /* tombstones */
562
- .hyle-cm[data-status="deleted"] .hyle-avatar,.hyle-cm[data-status="removed"] .hyle-avatar{background:transparent;border-style:dashed;color:var(--h-text-faint)}
563
- .hyle-cm[data-status="deleted"] .hyle-cm-body,.hyle-cm[data-status="removed"] .hyle-cm-body{margin-top:0;font-style:italic;color:var(--h-text-muted)}
564
- .hyle-cm[data-status="deleted"] .hyle-cm-by,.hyle-cm[data-status="removed"] .hyle-cm-by{display:none}
565
- .hyle-cm[data-status="deleted"] .hyle-cm-main,.hyle-cm[data-status="removed"] .hyle-cm-main{align-self:center}
618
+ .hyle-cm[data-status="deleted"]>article .hyle-avatar,.hyle-cm[data-status="removed"]>article .hyle-avatar{background:transparent;border-style:dashed;color:var(--h-text-faint)}
619
+ .hyle-cm[data-status="deleted"]>article .hyle-cm-body,.hyle-cm[data-status="removed"]>article .hyle-cm-body{margin-top:0;font-style:italic;color:var(--h-text-muted)}
620
+ .hyle-cm[data-status="deleted"]>article .hyle-cm-by,.hyle-cm[data-status="removed"]>article .hyle-cm-by{display:none}
621
+ .hyle-cm[data-status="deleted"]>article .hyle-cm-main,.hyle-cm[data-status="removed"]>article .hyle-cm-main{align-self:center}
566
622
  /* held for moderation (only its author sees it) */
567
623
  .hyle-cm[data-status="held"]>article{padding:12px;margin-left:-12px;margin-right:-12px;border:1px dashed color-mix(in srgb,var(--hc-held) 55%,var(--h-border));border-radius:var(--h-radius);background:color-mix(in srgb,var(--hc-held) 7%,transparent)}
568
624
  .hyle-cm-held{display:flex;align-items:center;gap:8px;margin-top:8px;font-size:13px;line-height:1.4;color:var(--h-text-muted)}
@@ -586,6 +642,21 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
586
642
  .hyle-banner{flex-wrap:wrap}
587
643
  .hyle-cm[data-status="held"]>article{margin-inline:-8px;padding:8px}
588
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}}
589
660
  .hyle-cm-note{margin-top:16px;font-size:13px;color:var(--h-text-muted)}
590
661
  .hyle-cm-reply,.hyle-cm-main>.hyle-cm-compose{margin-top:12px}
591
662
 
@@ -0,0 +1,60 @@
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 tree = marker.current?.getRootNode();
37
+ const headings = key.split("\n").map((id) => tree?.getElementById(id)).filter((h) => Boolean(h));
38
+ if (links.length === 0 || headings.length === 0 || typeof IntersectionObserver !== "function") return;
39
+ const update = () => {
40
+ let active = headings[0];
41
+ for (const heading of headings) if (heading.getBoundingClientRect().top <= window.innerHeight * LINE) active = heading;
42
+ for (const link of links) {
43
+ if (link.getAttribute("href") === `#${active.id}`) link.setAttribute("aria-current", "location");
44
+ else link.removeAttribute("aria-current");
45
+ }
46
+ };
47
+ const observer = new IntersectionObserver(update, { rootMargin: ABOVE_THE_LINE });
48
+ for (const heading of headings) observer.observe(heading);
49
+ update();
50
+ return () => {
51
+ observer.disconnect();
52
+ for (const link of links) link.removeAttribute("aria-current");
53
+ };
54
+ }, [key]);
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: marker, hidden: true });
56
+ }
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ TocSpy
60
+ });
@@ -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,36 @@
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 tree = marker.current?.getRootNode();
14
+ const headings = key.split("\n").map((id) => tree?.getElementById(id)).filter((h) => Boolean(h));
15
+ if (links.length === 0 || headings.length === 0 || typeof IntersectionObserver !== "function") return;
16
+ const update = () => {
17
+ let active = headings[0];
18
+ for (const heading of headings) if (heading.getBoundingClientRect().top <= window.innerHeight * LINE) active = heading;
19
+ for (const link of links) {
20
+ if (link.getAttribute("href") === `#${active.id}`) link.setAttribute("aria-current", "location");
21
+ else link.removeAttribute("aria-current");
22
+ }
23
+ };
24
+ const observer = new IntersectionObserver(update, { rootMargin: ABOVE_THE_LINE });
25
+ for (const heading of headings) observer.observe(heading);
26
+ update();
27
+ return () => {
28
+ observer.disconnect();
29
+ for (const link of links) link.removeAttribute("aria-current");
30
+ };
31
+ }, [key]);
32
+ return /* @__PURE__ */ jsx("span", { ref: marker, hidden: true });
33
+ }
34
+ export {
35
+ TocSpy
36
+ };
@@ -68,6 +68,17 @@ interface DocumentMetaFields {
68
68
  /** Words in the rendered prose (code, title and math excluded), counted by the server. Absent from an older server. */
69
69
  readonly word_count?: number | null;
70
70
  }
71
+ /** A themed workspace's stylesheet (hyle ADR 0036, docs/cp1-spec.md section 3.10.1). Render it with `<HyleTheme>`. */
72
+ interface ThemeRef {
73
+ /** sha256 (lowercase hex) of the stylesheet; it changes exactly when the stylesheet does. */
74
+ readonly hash: string;
75
+ /** Names the workspace without revealing it (16 hex); the same for every stylesheet that workspace ever has. */
76
+ readonly scope: string;
77
+ /** The stylesheet's path on hyle (server to server; a browser gets it from the host's asset route). */
78
+ readonly css: string;
79
+ /** Font files worth preloading, as `/assets/<uuid>.woff2`. */
80
+ readonly preload: readonly string[];
81
+ }
71
82
  interface ResolvedArticle {
72
83
  readonly cp: 1;
73
84
  readonly kind: "article";
@@ -98,6 +109,8 @@ interface ResolvedArticle {
98
109
  /** The workspace default locale; absent from an older server. */
99
110
  readonly default_locale?: string;
100
111
  readonly fallback?: Fallback;
112
+ /** Absent without a theme and from an older server. */
113
+ readonly theme?: ThemeRef;
101
114
  readonly cache: CacheInfo;
102
115
  }
103
116
  interface ListItem extends DocumentMetaFields {
@@ -121,6 +134,8 @@ interface ResolvedList {
121
134
  readonly items: readonly ListItem[];
122
135
  readonly next_cursor: string | null;
123
136
  readonly fallback?: Fallback;
137
+ /** Absent without a theme and from an older server. */
138
+ readonly theme?: ThemeRef;
124
139
  readonly cache: CacheInfo;
125
140
  }
126
141
  interface ResolvedRedirect {
@@ -162,9 +177,17 @@ interface Mounts {
162
177
  readonly supported_locales: readonly string[];
163
178
  readonly mounts: readonly Mount[];
164
179
  readonly reserved: readonly string[];
180
+ /** Absent without a theme and from an older server. */
181
+ readonly theme?: ThemeRef;
165
182
  readonly cache: CacheInfo;
166
183
  }
167
184
  type MountsResult = Mounts | ResolvedDisabled;
185
+ /** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
186
+ type ReactionKind = "like" | "love" | "insightful" | "celebrate";
187
+ /** Reactions on a subject by kind; a kind nobody used is absent. */
188
+ type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
189
+ /** A comment vote: up or down. */
190
+ type VoteValue = 1 | -1;
168
191
  /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
169
192
  interface EngageComment {
170
193
  readonly id: string;
@@ -179,10 +202,16 @@ interface EngageComment {
179
202
  readonly created_at: string;
180
203
  readonly edited_at: string | null;
181
204
  readonly like_count: number;
205
+ /** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
206
+ readonly score?: number;
207
+ /** Absent from a hyle without reaction kinds. */
208
+ readonly reaction_counts?: ReactionCounts;
182
209
  /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
183
210
  readonly removed: boolean;
184
211
  /** On a tombstone only: who removed it. Absent on a live comment. */
185
212
  readonly removed_by?: "moderator" | "author";
213
+ /** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
214
+ readonly unrenderable?: true;
186
215
  readonly body: {
187
216
  readonly format: "hast";
188
217
  readonly tree: unknown;
@@ -190,8 +219,12 @@ interface EngageComment {
190
219
  /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
191
220
  readonly mine?: boolean;
192
221
  readonly liked_by_me?: boolean;
222
+ /** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
223
+ readonly my_reactions?: readonly ReactionKind[];
193
224
  /** ISO instant until which the reader may edit, or null. */
194
225
  readonly can_edit_until?: string | null;
226
+ /** The reader's own vote, or null. Absent from a hyle without votes. */
227
+ readonly my_vote?: VoteValue | null;
195
228
  }
196
229
  /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
197
230
  interface EngageHeldComment {
@@ -202,6 +235,8 @@ interface EngageHeldComment {
202
235
  readonly created_at: string;
203
236
  readonly edited_at: string | null;
204
237
  readonly can_edit_until: string | null;
238
+ /** As on `EngageComment`. */
239
+ readonly unrenderable?: true;
205
240
  readonly body: {
206
241
  readonly format: "hast";
207
242
  readonly tree: unknown;
@@ -214,12 +249,32 @@ interface EngageListing {
214
249
  readonly publication_id: string;
215
250
  readonly comment_count: number;
216
251
  readonly like_count: number;
217
- /** More than the 500 listed comments exist. */
252
+ /** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
253
+ readonly reaction_counts?: ReactionCounts;
254
+ /** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
218
255
  readonly truncated: boolean;
256
+ /** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
257
+ readonly next_cursor?: string | null;
219
258
  readonly comments: readonly EngageComment[];
220
259
  /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
221
260
  readonly liked_by_me?: boolean;
261
+ /** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
262
+ readonly my_reactions?: readonly ReactionKind[];
222
263
  readonly mine_held?: readonly EngageHeldComment[];
223
264
  }
265
+ /** The `data` of GET /cp1/read/_preview (docs/cp1-spec.md section 3.10.2), or why there is no draft to draw. */
266
+ type HylePreview =
267
+ /** `expires_at`: when the link stops working. The article's asset addresses carry the token. */
268
+ {
269
+ readonly kind: "preview";
270
+ readonly expires_at: string;
271
+ readonly article: ResolvedArticle;
272
+ }
273
+ /** A wrong, expired or foreign token (hyle does not say which), or a document that can no longer be previewed. */
274
+ | {
275
+ readonly kind: "notfound";
276
+ } | {
277
+ readonly kind: "disabled";
278
+ };
224
279
 
225
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, 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 };
280
+ export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, EngageComment as E, Fallback as F, HylePreview as H, ListItem as L, Mount as M, NavItem as N, ReactionCounts as R, ThemeRef 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, TocEntry as o };
@@ -68,6 +68,17 @@ interface DocumentMetaFields {
68
68
  /** Words in the rendered prose (code, title and math excluded), counted by the server. Absent from an older server. */
69
69
  readonly word_count?: number | null;
70
70
  }
71
+ /** A themed workspace's stylesheet (hyle ADR 0036, docs/cp1-spec.md section 3.10.1). Render it with `<HyleTheme>`. */
72
+ interface ThemeRef {
73
+ /** sha256 (lowercase hex) of the stylesheet; it changes exactly when the stylesheet does. */
74
+ readonly hash: string;
75
+ /** Names the workspace without revealing it (16 hex); the same for every stylesheet that workspace ever has. */
76
+ readonly scope: string;
77
+ /** The stylesheet's path on hyle (server to server; a browser gets it from the host's asset route). */
78
+ readonly css: string;
79
+ /** Font files worth preloading, as `/assets/<uuid>.woff2`. */
80
+ readonly preload: readonly string[];
81
+ }
71
82
  interface ResolvedArticle {
72
83
  readonly cp: 1;
73
84
  readonly kind: "article";
@@ -98,6 +109,8 @@ interface ResolvedArticle {
98
109
  /** The workspace default locale; absent from an older server. */
99
110
  readonly default_locale?: string;
100
111
  readonly fallback?: Fallback;
112
+ /** Absent without a theme and from an older server. */
113
+ readonly theme?: ThemeRef;
101
114
  readonly cache: CacheInfo;
102
115
  }
103
116
  interface ListItem extends DocumentMetaFields {
@@ -121,6 +134,8 @@ interface ResolvedList {
121
134
  readonly items: readonly ListItem[];
122
135
  readonly next_cursor: string | null;
123
136
  readonly fallback?: Fallback;
137
+ /** Absent without a theme and from an older server. */
138
+ readonly theme?: ThemeRef;
124
139
  readonly cache: CacheInfo;
125
140
  }
126
141
  interface ResolvedRedirect {
@@ -162,9 +177,17 @@ interface Mounts {
162
177
  readonly supported_locales: readonly string[];
163
178
  readonly mounts: readonly Mount[];
164
179
  readonly reserved: readonly string[];
180
+ /** Absent without a theme and from an older server. */
181
+ readonly theme?: ThemeRef;
165
182
  readonly cache: CacheInfo;
166
183
  }
167
184
  type MountsResult = Mounts | ResolvedDisabled;
185
+ /** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
186
+ type ReactionKind = "like" | "love" | "insightful" | "celebrate";
187
+ /** Reactions on a subject by kind; a kind nobody used is absent. */
188
+ type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
189
+ /** A comment vote: up or down. */
190
+ type VoteValue = 1 | -1;
168
191
  /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
169
192
  interface EngageComment {
170
193
  readonly id: string;
@@ -179,10 +202,16 @@ interface EngageComment {
179
202
  readonly created_at: string;
180
203
  readonly edited_at: string | null;
181
204
  readonly like_count: number;
205
+ /** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
206
+ readonly score?: number;
207
+ /** Absent from a hyle without reaction kinds. */
208
+ readonly reaction_counts?: ReactionCounts;
182
209
  /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
183
210
  readonly removed: boolean;
184
211
  /** On a tombstone only: who removed it. Absent on a live comment. */
185
212
  readonly removed_by?: "moderator" | "author";
213
+ /** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
214
+ readonly unrenderable?: true;
186
215
  readonly body: {
187
216
  readonly format: "hast";
188
217
  readonly tree: unknown;
@@ -190,8 +219,12 @@ interface EngageComment {
190
219
  /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
191
220
  readonly mine?: boolean;
192
221
  readonly liked_by_me?: boolean;
222
+ /** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
223
+ readonly my_reactions?: readonly ReactionKind[];
193
224
  /** ISO instant until which the reader may edit, or null. */
194
225
  readonly can_edit_until?: string | null;
226
+ /** The reader's own vote, or null. Absent from a hyle without votes. */
227
+ readonly my_vote?: VoteValue | null;
195
228
  }
196
229
  /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
197
230
  interface EngageHeldComment {
@@ -202,6 +235,8 @@ interface EngageHeldComment {
202
235
  readonly created_at: string;
203
236
  readonly edited_at: string | null;
204
237
  readonly can_edit_until: string | null;
238
+ /** As on `EngageComment`. */
239
+ readonly unrenderable?: true;
205
240
  readonly body: {
206
241
  readonly format: "hast";
207
242
  readonly tree: unknown;
@@ -214,12 +249,32 @@ interface EngageListing {
214
249
  readonly publication_id: string;
215
250
  readonly comment_count: number;
216
251
  readonly like_count: number;
217
- /** More than the 500 listed comments exist. */
252
+ /** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
253
+ readonly reaction_counts?: ReactionCounts;
254
+ /** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
218
255
  readonly truncated: boolean;
256
+ /** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
257
+ readonly next_cursor?: string | null;
219
258
  readonly comments: readonly EngageComment[];
220
259
  /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
221
260
  readonly liked_by_me?: boolean;
261
+ /** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
262
+ readonly my_reactions?: readonly ReactionKind[];
222
263
  readonly mine_held?: readonly EngageHeldComment[];
223
264
  }
265
+ /** The `data` of GET /cp1/read/_preview (docs/cp1-spec.md section 3.10.2), or why there is no draft to draw. */
266
+ type HylePreview =
267
+ /** `expires_at`: when the link stops working. The article's asset addresses carry the token. */
268
+ {
269
+ readonly kind: "preview";
270
+ readonly expires_at: string;
271
+ readonly article: ResolvedArticle;
272
+ }
273
+ /** A wrong, expired or foreign token (hyle does not say which), or a document that can no longer be previewed. */
274
+ | {
275
+ readonly kind: "notfound";
276
+ } | {
277
+ readonly kind: "disabled";
278
+ };
224
279
 
225
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, 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 };
280
+ export type { Alternate as A, Breadcrumb as B, CacheInfo as C, DocumentMetaFields as D, EngageComment as E, Fallback as F, HylePreview as H, ListItem as L, Mount as M, NavItem as N, ReactionCounts as R, ThemeRef 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, TocEntry as o };