@tdacorp/hyle-sdk 0.12.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +46 -12
  2. package/dist/check-routes-bin.js +31 -18
  3. package/dist/{chunk-S7PCCEHP.js → chunk-6VOHFFA5.js} +4 -3
  4. package/dist/{chunk-ZQFYH4FX.js → chunk-DMK4XQLU.js} +497 -327
  5. package/dist/{chunk-N7ZQUAGM.js → chunk-MGSUQBDW.js} +19 -7
  6. package/dist/{chunk-R5EMI4HQ.js → chunk-PJMJMP66.js} +3 -1
  7. package/dist/comments.cjs +6 -4
  8. package/dist/comments.js +6 -5
  9. package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-FJPED4SN.js} +46 -26
  10. package/dist/{embed-jCaSI31t.d.cts → embed-BmdwA2G9.d.cts} +51 -5
  11. package/dist/{embed-DL5QIZRJ.d.ts → embed-DNTZ2UXv.d.ts} +51 -5
  12. package/dist/index.cjs +19 -7
  13. package/dist/index.d.cts +15 -8
  14. package/dist/index.d.ts +15 -8
  15. package/dist/index.js +1 -1
  16. package/dist/labels-nmukKYgL.d.cts +37 -0
  17. package/dist/labels-nmukKYgL.d.ts +37 -0
  18. package/dist/mermaid-diagram.cjs +59 -30
  19. package/dist/mermaid-diagram.d.cts +4 -37
  20. package/dist/mermaid-diagram.d.ts +4 -37
  21. package/dist/mermaid-diagram.js +7 -5
  22. package/dist/mermaid-image.cjs +1382 -0
  23. package/dist/mermaid-image.d.cts +29 -0
  24. package/dist/mermaid-image.d.ts +29 -0
  25. package/dist/mermaid-image.js +94 -0
  26. package/dist/next.cjs +1235 -789
  27. package/dist/next.d.cts +149 -24
  28. package/dist/next.d.ts +149 -24
  29. package/dist/next.js +887 -612
  30. package/dist/react.cjs +336 -196
  31. package/dist/react.d.cts +39 -7
  32. package/dist/react.d.ts +39 -7
  33. package/dist/react.js +1 -1
  34. package/dist/{resolve-DvmuBlpO.d.ts → resolve-Ae7UFjsQ.d.ts} +5 -5
  35. package/dist/{resolve-f6IJ6SL9.d.cts → resolve-euZ4-aC9.d.cts} +5 -5
  36. package/dist/styles.css +11 -22
  37. package/dist/{types-5D6ZD0Wi.d.cts → types-Czt887Iv.d.cts} +32 -3
  38. package/dist/{types-5D6ZD0Wi.d.ts → types-Czt887Iv.d.ts} +32 -3
  39. package/dist/use-cache.cjs +1 -1
  40. package/dist/use-cache.d.cts +2 -2
  41. package/dist/use-cache.d.ts +2 -2
  42. package/dist/use-cache.js +2 -2
  43. package/package.json +1 -1
package/dist/react.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement } from 'react';
3
- import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-jCaSI31t.cjs';
4
- export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-jCaSI31t.cjs';
3
+ import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig, J as JsonLdConfig } from './embed-BmdwA2G9.cjs';
4
+ export { A as ArticleRef, C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps, O as OgImage } from './embed-BmdwA2G9.cjs';
5
5
  import { Root } from 'hast';
6
- import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.cjs';
6
+ import { h as ResolvedArticle, L as ListItem, j as ResolvedList, c as EngageListing } from './types-Czt887Iv.cjs';
7
7
 
8
8
  interface HastContentProps {
9
9
  /** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
@@ -73,10 +73,12 @@ interface MermaidDiagramProps {
73
73
  title: string;
74
74
  /** Shown when Mermaid cannot render the source. */
75
75
  errorText: string;
76
+ /** Accessible name of the loader shown while the diagram renders (English when omitted). */
77
+ loadingText?: string;
76
78
  /** Strings of the diagram viewer (English when omitted). */
77
79
  labels?: ViewerLabels;
78
80
  }
79
- declare function MermaidDiagram({ source, title, errorText, labels }: MermaidDiagramProps): react.JSX.Element;
81
+ declare function MermaidDiagram({ source, title, errorText, loadingText, labels }: MermaidDiagramProps): react.JSX.Element;
80
82
 
81
83
  /**
82
84
  * Defense in depth. hyle sanitizes server-side (packages/renderer/src/render.ts); this guard repeats the same allowlist
@@ -187,11 +189,17 @@ declare const en: {
187
189
  caution: string;
188
190
  diagram: string;
189
191
  diagramError: string;
192
+ diagramLoading: string;
193
+ diagramSource: string;
190
194
  contentError: string;
191
195
  fallbackTitle: string;
192
196
  fallbackBody: string;
197
+ readingTime: string;
198
+ readingTimeLabel: string;
193
199
  older: string;
194
200
  viewAll: string;
201
+ moreInSection: string;
202
+ subPages: string;
195
203
  readAtSource: string;
196
204
  emptyTitle: string;
197
205
  emptyBody: string;
@@ -229,16 +237,40 @@ interface ArticlePageProps extends PageBaseProps {
229
237
  engagement?: EngagementConfig | undefined;
230
238
  /** The site's public origin (https, no trailing slash). Set, it adds BlogPosting and BreadcrumbList JSON-LD, which needs absolute URLs. A malformed value emits nothing: wrong absolute URLs are worse for SEO than none. */
231
239
  origin?: string | undefined;
240
+ /** The host's structured-data identities; set, the JSON-LD becomes the full graph (see `JsonLdConfig`). Needs `origin`. */
241
+ jsonLd?: JsonLdConfig | undefined;
242
+ /** The validated og:image URL, put in the BlogPosting `image`. */
243
+ imageUrl?: string | undefined;
244
+ /** The image's size when known, so the BlogPosting `image` becomes an ImageObject. */
245
+ imageWidth?: number | undefined;
246
+ imageHeight?: number | undefined;
247
+ /**
248
+ * "More in this section" (`items`, the host's choice of siblings) and the article's own `children`, rendered after the pager with
249
+ * `HyleListView`. `hylePage` fills it from the `related` option. A list with no items renders nothing.
250
+ */
251
+ related?: {
252
+ title?: string | undefined;
253
+ items: readonly ListItem[];
254
+ } | undefined;
232
255
  }
233
- declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
256
+
257
+ declare function ArticlePage({ article, engagement, origin, jsonLd, imageUrl, imageWidth, imageHeight, related, ...base }: ArticlePageProps): ReactElement;
234
258
  interface ListPageProps extends PageBaseProps {
235
259
  list: ResolvedList;
236
260
  /** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
237
261
  olderHref?: string;
238
262
  /** Page description under the title. */
239
263
  description?: string;
264
+ /** With `path`, adds CollectionPage and ItemList JSON-LD (needs a bare https origin; anything else emits nothing). */
265
+ origin?: string | undefined;
266
+ /** The list's own site path (what `hylePage` resolved). */
267
+ path?: string | undefined;
268
+ /** With `origin` and `path`, joins the CollectionPage to the host's WebSite and Organization graph (see `JsonLdConfig`). */
269
+ jsonLd?: JsonLdConfig | undefined;
270
+ /** The page's `?cursor=`, put in the JSON-LD url and @id. */
271
+ cursor?: string | undefined;
240
272
  }
241
- declare function ListPage({ list, olderHref, description, ...base }: ListPageProps): ReactElement;
273
+ declare function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }: ListPageProps): ReactElement;
242
274
  interface NotFoundProps extends PageBaseProps {
243
275
  /** The path that was not found, shown to the visitor. */
244
276
  path?: string;
@@ -282,4 +314,4 @@ declare function Comments({ path, endpoint, signInHref, locale, labels: s, initi
282
314
 
283
315
  declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
284
316
 
285
- export { ArticlePage, type ArticlePageProps, Comments, type CommentsProps, DocsPage, EngagementConfig, HastContent, type HastContentProps, HastLimitError, HyleComponents, ListPage, type ListPageProps, MermaidDiagram, type MermaidDiagramProps, NotFound, type NotFoundProps, PageBaseProps, Redirecting, type RedirectingProps, type Strings, TrustedServerHtml, Unavailable, isSafeUrl, sanitizeHast, scopeId, stringsFor };
317
+ export { ArticlePage, type ArticlePageProps, Comments, type CommentsProps, DocsPage, EngagementConfig, HastContent, type HastContentProps, HastLimitError, HyleComponents, JsonLdConfig, ListPage, type ListPageProps, MermaidDiagram, type MermaidDiagramProps, NotFound, type NotFoundProps, PageBaseProps, Redirecting, type RedirectingProps, type Strings, TrustedServerHtml, Unavailable, isSafeUrl, sanitizeHast, scopeId, stringsFor };
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement } from 'react';
3
- import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-DL5QIZRJ.js';
4
- export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-DL5QIZRJ.js';
3
+ import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig, J as JsonLdConfig } from './embed-DNTZ2UXv.js';
4
+ export { A as ArticleRef, C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps, O as OgImage } from './embed-DNTZ2UXv.js';
5
5
  import { Root } from 'hast';
6
- import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.js';
6
+ import { h as ResolvedArticle, L as ListItem, j as ResolvedList, c as EngageListing } from './types-Czt887Iv.js';
7
7
 
8
8
  interface HastContentProps {
9
9
  /** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
@@ -73,10 +73,12 @@ interface MermaidDiagramProps {
73
73
  title: string;
74
74
  /** Shown when Mermaid cannot render the source. */
75
75
  errorText: string;
76
+ /** Accessible name of the loader shown while the diagram renders (English when omitted). */
77
+ loadingText?: string;
76
78
  /** Strings of the diagram viewer (English when omitted). */
77
79
  labels?: ViewerLabels;
78
80
  }
79
- declare function MermaidDiagram({ source, title, errorText, labels }: MermaidDiagramProps): react.JSX.Element;
81
+ declare function MermaidDiagram({ source, title, errorText, loadingText, labels }: MermaidDiagramProps): react.JSX.Element;
80
82
 
81
83
  /**
82
84
  * Defense in depth. hyle sanitizes server-side (packages/renderer/src/render.ts); this guard repeats the same allowlist
@@ -187,11 +189,17 @@ declare const en: {
187
189
  caution: string;
188
190
  diagram: string;
189
191
  diagramError: string;
192
+ diagramLoading: string;
193
+ diagramSource: string;
190
194
  contentError: string;
191
195
  fallbackTitle: string;
192
196
  fallbackBody: string;
197
+ readingTime: string;
198
+ readingTimeLabel: string;
193
199
  older: string;
194
200
  viewAll: string;
201
+ moreInSection: string;
202
+ subPages: string;
195
203
  readAtSource: string;
196
204
  emptyTitle: string;
197
205
  emptyBody: string;
@@ -229,16 +237,40 @@ interface ArticlePageProps extends PageBaseProps {
229
237
  engagement?: EngagementConfig | undefined;
230
238
  /** The site's public origin (https, no trailing slash). Set, it adds BlogPosting and BreadcrumbList JSON-LD, which needs absolute URLs. A malformed value emits nothing: wrong absolute URLs are worse for SEO than none. */
231
239
  origin?: string | undefined;
240
+ /** The host's structured-data identities; set, the JSON-LD becomes the full graph (see `JsonLdConfig`). Needs `origin`. */
241
+ jsonLd?: JsonLdConfig | undefined;
242
+ /** The validated og:image URL, put in the BlogPosting `image`. */
243
+ imageUrl?: string | undefined;
244
+ /** The image's size when known, so the BlogPosting `image` becomes an ImageObject. */
245
+ imageWidth?: number | undefined;
246
+ imageHeight?: number | undefined;
247
+ /**
248
+ * "More in this section" (`items`, the host's choice of siblings) and the article's own `children`, rendered after the pager with
249
+ * `HyleListView`. `hylePage` fills it from the `related` option. A list with no items renders nothing.
250
+ */
251
+ related?: {
252
+ title?: string | undefined;
253
+ items: readonly ListItem[];
254
+ } | undefined;
232
255
  }
233
- declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
256
+
257
+ declare function ArticlePage({ article, engagement, origin, jsonLd, imageUrl, imageWidth, imageHeight, related, ...base }: ArticlePageProps): ReactElement;
234
258
  interface ListPageProps extends PageBaseProps {
235
259
  list: ResolvedList;
236
260
  /** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
237
261
  olderHref?: string;
238
262
  /** Page description under the title. */
239
263
  description?: string;
264
+ /** With `path`, adds CollectionPage and ItemList JSON-LD (needs a bare https origin; anything else emits nothing). */
265
+ origin?: string | undefined;
266
+ /** The list's own site path (what `hylePage` resolved). */
267
+ path?: string | undefined;
268
+ /** With `origin` and `path`, joins the CollectionPage to the host's WebSite and Organization graph (see `JsonLdConfig`). */
269
+ jsonLd?: JsonLdConfig | undefined;
270
+ /** The page's `?cursor=`, put in the JSON-LD url and @id. */
271
+ cursor?: string | undefined;
240
272
  }
241
- declare function ListPage({ list, olderHref, description, ...base }: ListPageProps): ReactElement;
273
+ declare function ListPage({ list, olderHref, description, origin, path, jsonLd, cursor, ...base }: ListPageProps): ReactElement;
242
274
  interface NotFoundProps extends PageBaseProps {
243
275
  /** The path that was not found, shown to the visitor. */
244
276
  path?: string;
@@ -282,4 +314,4 @@ declare function Comments({ path, endpoint, signInHref, locale, labels: s, initi
282
314
 
283
315
  declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
284
316
 
285
- export { ArticlePage, type ArticlePageProps, Comments, type CommentsProps, DocsPage, EngagementConfig, HastContent, type HastContentProps, HastLimitError, HyleComponents, ListPage, type ListPageProps, MermaidDiagram, type MermaidDiagramProps, NotFound, type NotFoundProps, PageBaseProps, Redirecting, type RedirectingProps, type Strings, TrustedServerHtml, Unavailable, isSafeUrl, sanitizeHast, scopeId, stringsFor };
317
+ export { ArticlePage, type ArticlePageProps, Comments, type CommentsProps, DocsPage, EngagementConfig, HastContent, type HastContentProps, HastLimitError, HyleComponents, JsonLdConfig, ListPage, type ListPageProps, MermaidDiagram, type MermaidDiagramProps, NotFound, type NotFoundProps, PageBaseProps, Redirecting, type RedirectingProps, type Strings, TrustedServerHtml, Unavailable, isSafeUrl, sanitizeHast, scopeId, stringsFor };
package/dist/react.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  sanitizeHast,
17
17
  scopeId,
18
18
  stringsFor
19
- } from "./chunk-ZQFYH4FX.js";
19
+ } from "./chunk-DMK4XQLU.js";
20
20
  import "./chunk-67IOIAVW.js";
21
21
  export {
22
22
  ArticlePage,
@@ -1,7 +1,7 @@
1
- import { R as Resolved } from './types-5D6ZD0Wi.js';
1
+ import { R as Resolved } from './types-Czt887Iv.js';
2
2
 
3
3
  /** Resolves a site path to a result. The two built-in strategies are `fetchResolver` (default) and `cachedResolver` (`@tdacorp/hyle-sdk/next/use-cache`). */
4
- type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
4
+ type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree", format?: "md") => Promise<Resolved>;
5
5
  interface FetchResolverOptions {
6
6
  readonly baseUrl: string;
7
7
  readonly token: string;
@@ -9,13 +9,13 @@ interface FetchResolverOptions {
9
9
  readonly workspaceId: string;
10
10
  /** Seconds before a cached page is revalidated in the background. Webhooks purge sooner. Default 300. */
11
11
  readonly revalidate?: number;
12
- /** Section slugs this mount can show besides the default "posts". Used only for tagging. */
12
+ /** Section slugs this mount shows (its own section slug first): each gets a cache tag. Used only for tagging. */
13
13
  readonly sections?: readonly string[];
14
14
  }
15
15
  /**
16
16
  * The fetch cache tags for a workspace, in the contract's format (`hyle:1:ws:<id>`, `hyle:1:sec:<ws>:<section>`; docs/cp1-spec.md
17
- * section 5.8). Tags known BEFORE the response, bounded however many URLs a visitor requests: the workspace tag, the default section
18
- * and the configured `sections`. A publish, unpublish, rename or edit purges the section tag of the page's section, and the
17
+ * section 5.8). Tags known BEFORE the response, bounded however many URLs a visitor requests: the workspace tag and the configured
18
+ * `sections` (the mount's own section among them). A publish, unpublish, rename or edit purges the section tag of the page's section, and the
19
19
  * workspace tag covers section renames and the kill switch (docs/cp1-spec.md section 5.8), so a page refreshes without its
20
20
  * own publication tag. A bad `workspaceId` or section slug throws a TypeError. A section not listed in `sections` falls back to `revalidate`, as does cross-section wikilink refresh.
21
21
  */
@@ -1,7 +1,7 @@
1
- import { R as Resolved } from './types-5D6ZD0Wi.cjs';
1
+ import { R as Resolved } from './types-Czt887Iv.cjs';
2
2
 
3
3
  /** Resolves a site path to a result. The two built-in strategies are `fetchResolver` (default) and `cachedResolver` (`@tdacorp/hyle-sdk/next/use-cache`). */
4
- type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
4
+ type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree", format?: "md") => Promise<Resolved>;
5
5
  interface FetchResolverOptions {
6
6
  readonly baseUrl: string;
7
7
  readonly token: string;
@@ -9,13 +9,13 @@ interface FetchResolverOptions {
9
9
  readonly workspaceId: string;
10
10
  /** Seconds before a cached page is revalidated in the background. Webhooks purge sooner. Default 300. */
11
11
  readonly revalidate?: number;
12
- /** Section slugs this mount can show besides the default "posts". Used only for tagging. */
12
+ /** Section slugs this mount shows (its own section slug first): each gets a cache tag. Used only for tagging. */
13
13
  readonly sections?: readonly string[];
14
14
  }
15
15
  /**
16
16
  * The fetch cache tags for a workspace, in the contract's format (`hyle:1:ws:<id>`, `hyle:1:sec:<ws>:<section>`; docs/cp1-spec.md
17
- * section 5.8). Tags known BEFORE the response, bounded however many URLs a visitor requests: the workspace tag, the default section
18
- * and the configured `sections`. A publish, unpublish, rename or edit purges the section tag of the page's section, and the
17
+ * section 5.8). Tags known BEFORE the response, bounded however many URLs a visitor requests: the workspace tag and the configured
18
+ * `sections` (the mount's own section among them). A publish, unpublish, rename or edit purges the section tag of the page's section, and the
19
19
  * workspace tag covers section renames and the kill switch (docs/cp1-spec.md section 5.8), so a page refreshes without its
20
20
  * own publication tag. A bad `workspaceId` or section slug throws a TypeError. A section not listed in `sections` falls back to `revalidate`, as does cross-section wikilink refresh.
21
21
  */
package/dist/styles.css CHANGED
@@ -169,6 +169,7 @@
169
169
  .hyle-item .t{display:block}
170
170
  .hyle-item time{font-size:14px;line-height:1.7;color:var(--h-text-muted);font-variant-numeric:tabular-nums}
171
171
  .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)}
172
+ .hyle-item>div:only-child{grid-column:1/-1}
172
173
  .hyle-item p{margin-top:4px;color:var(--h-text-muted);font-size:15px;line-height:1.55}
173
174
  .hyle-item .tags{display:flex;gap:8px;margin-top:8px}
174
175
  @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 +261,7 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
260
261
 
261
262
  /* ---- prose layer: rendered markdown, plain semantic elements ---- */
262
263
  .hyle-prose{overflow-wrap:break-word}
264
+ .hyle-prose img{max-width:100%;height:auto}
263
265
  .hyle-prose>*+*{margin-top:var(--h-paragraph-gap)}
264
266
  .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
267
  .hyle-prose h1{font-size:var(--h-h1-size);line-height:1.15}
@@ -411,8 +413,15 @@ html:has(.hyle-nav-d:popover-open){overflow:hidden}
411
413
 
412
414
  /* ---- additions not in the design kit (the kit mocks these; the real hast needs them) ---- */
413
415
  .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}
415
416
  .hyle-mermaid>pre{padding:16px}
417
+ .hyle-mermaid[data-state=pending]{min-height:240px}
418
+ /* A stored render: the box is reserved by aspect-ratio before the image arrives, so nothing shifts. */
419
+ .hyle-mermaid-frame{position:relative;display:block;margin-inline:auto;width:100%;padding:0;box-sizing:content-box}
420
+ .hyle-mermaid-frame img{display:block;width:100%;height:auto}
421
+ .hyle-mermaid-loader{position:absolute;inset:0 0 auto 0;height:3px;overflow:hidden;background:var(--h-border,GrayText);opacity:.5;z-index:1}
422
+ .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}
423
+ @keyframes hyle-mermaid-load{from{transform:translateX(-100%)}to{transform:translateX(250%)}}
424
+ @media (prefers-reduced-motion:reduce){.hyle-mermaid-loader::after{animation:none;width:100%}}
416
425
  /* 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
426
  .hyle-mermaid-svg{display:flex;justify-content:center;padding:16px;contain:paint}
418
427
  .hyle-mermaid-svg svg{position:static!important;max-width:100%;height:auto}
@@ -458,27 +467,7 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
458
467
  .hv-view.hv-grabbing{cursor:grabbing}
459
468
  /* --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
469
  .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}}
470
+ /* 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
471
 
483
472
  .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
473
  @media (max-width:640px){.hv-mini{width:120px;height:82px}}
@@ -46,7 +46,28 @@ type ArticleContent = {
46
46
  } | {
47
47
  readonly format: "html";
48
48
  readonly html: string;
49
+ }
50
+ /** Only when requested with `format: "md"` (the `.md` twin route): the page's markdown source. */
51
+ | {
52
+ readonly format: "md";
53
+ readonly markdown: string;
49
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
+ }
50
71
  interface ResolvedArticle {
51
72
  readonly cp: 1;
52
73
  readonly kind: "article";
@@ -62,7 +83,7 @@ interface ResolvedArticle {
62
83
  readonly published_at: string;
63
84
  readonly updated_at: string;
64
85
  readonly locale: string;
65
- };
86
+ } & DocumentMetaFields;
66
87
  readonly content: ArticleContent;
67
88
  readonly frontmatter: Record<string, unknown>;
68
89
  readonly toc: readonly TocEntry[];
@@ -79,12 +100,16 @@ interface ResolvedArticle {
79
100
  readonly fallback?: Fallback;
80
101
  readonly cache: CacheInfo;
81
102
  }
82
- interface ListItem {
103
+ interface ListItem extends DocumentMetaFields {
83
104
  readonly slug: string;
84
105
  readonly title: string;
85
106
  readonly description: string | null;
86
107
  readonly canonical_path: string;
87
108
  readonly published_at: string;
109
+ /** Absent from an older server. */
110
+ readonly updated_at?: string;
111
+ /** The item's translation group, itself included, in the `alternates` shape of an article. Absent from an older server or when the item has none. */
112
+ readonly alternates?: readonly Alternate[];
88
113
  }
89
114
  interface ResolvedList {
90
115
  readonly cp: 1;
@@ -124,6 +149,10 @@ type Resolved = ResolvedArticle | ResolvedList | ResolvedRedirect | ResolvedNotF
124
149
  interface Mount {
125
150
  readonly prefix: string;
126
151
  readonly default_section: string;
152
+ /** The mount's display name (the section's name), when the server sends one. */
153
+ readonly name?: string;
154
+ /** The locales this mount is published in; absent from an older server (then only the workspace default locale). */
155
+ readonly locales?: readonly string[];
127
156
  }
128
157
  interface Mounts {
129
158
  readonly cp: 1;
@@ -193,4 +222,4 @@ interface EngageListing {
193
222
  readonly mine_held?: readonly EngageHeldComment[];
194
223
  }
195
224
 
196
- 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 };
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 };
@@ -46,7 +46,28 @@ type ArticleContent = {
46
46
  } | {
47
47
  readonly format: "html";
48
48
  readonly html: string;
49
+ }
50
+ /** Only when requested with `format: "md"` (the `.md` twin route): the page's markdown source. */
51
+ | {
52
+ readonly format: "md";
53
+ readonly markdown: string;
49
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
+ }
50
71
  interface ResolvedArticle {
51
72
  readonly cp: 1;
52
73
  readonly kind: "article";
@@ -62,7 +83,7 @@ interface ResolvedArticle {
62
83
  readonly published_at: string;
63
84
  readonly updated_at: string;
64
85
  readonly locale: string;
65
- };
86
+ } & DocumentMetaFields;
66
87
  readonly content: ArticleContent;
67
88
  readonly frontmatter: Record<string, unknown>;
68
89
  readonly toc: readonly TocEntry[];
@@ -79,12 +100,16 @@ interface ResolvedArticle {
79
100
  readonly fallback?: Fallback;
80
101
  readonly cache: CacheInfo;
81
102
  }
82
- interface ListItem {
103
+ interface ListItem extends DocumentMetaFields {
83
104
  readonly slug: string;
84
105
  readonly title: string;
85
106
  readonly description: string | null;
86
107
  readonly canonical_path: string;
87
108
  readonly published_at: string;
109
+ /** Absent from an older server. */
110
+ readonly updated_at?: string;
111
+ /** The item's translation group, itself included, in the `alternates` shape of an article. Absent from an older server or when the item has none. */
112
+ readonly alternates?: readonly Alternate[];
88
113
  }
89
114
  interface ResolvedList {
90
115
  readonly cp: 1;
@@ -124,6 +149,10 @@ type Resolved = ResolvedArticle | ResolvedList | ResolvedRedirect | ResolvedNotF
124
149
  interface Mount {
125
150
  readonly prefix: string;
126
151
  readonly default_section: string;
152
+ /** The mount's display name (the section's name), when the server sends one. */
153
+ readonly name?: string;
154
+ /** The locales this mount is published in; absent from an older server (then only the workspace default locale). */
155
+ readonly locales?: readonly string[];
127
156
  }
128
157
  interface Mounts {
129
158
  readonly cp: 1;
@@ -193,4 +222,4 @@ interface EngageListing {
193
222
  readonly mine_held?: readonly EngageHeldComment[];
194
223
  }
195
224
 
196
- 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 };
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 };
@@ -124,7 +124,7 @@ function createHyleClient(options) {
124
124
  const data = reply.parsed?.data;
125
125
  if (data && data.cp === 1 && typeof data.kind === "string" && KINDS.has(data.kind)) {
126
126
  const resolved = data;
127
- if (resolved.kind === "article" && resolved.content.format === "html" && opts.format !== "html") throw failure(reply);
127
+ if (resolved.kind === "article" && resolved.content.format !== "hast" && resolved.content.format !== opts.format) throw failure(reply);
128
128
  return resolved;
129
129
  }
130
130
  throw failure(reply);
@@ -1,5 +1,5 @@
1
- import { H as HyleResolver } from './resolve-f6IJ6SL9.cjs';
2
- import './types-5D6ZD0Wi.cjs';
1
+ import { H as HyleResolver } from './resolve-euZ4-aC9.cjs';
2
+ import './types-Czt887Iv.cjs';
3
3
 
4
4
  /**
5
5
  * The exact caching strategy: a `'use cache'` function that fetches, then tags its own entry with the tags the response
@@ -1,5 +1,5 @@
1
- import { H as HyleResolver } from './resolve-DvmuBlpO.js';
2
- import './types-5D6ZD0Wi.js';
1
+ import { H as HyleResolver } from './resolve-Ae7UFjsQ.js';
2
+ import './types-Czt887Iv.js';
3
3
 
4
4
  /**
5
5
  * The exact caching strategy: a `'use cache'` function that fetches, then tags its own entry with the tags the response
package/dist/use-cache.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DEFAULT_REVALIDATE
3
- } from "./chunk-S7PCCEHP.js";
3
+ } from "./chunk-6VOHFFA5.js";
4
4
  import {
5
5
  createHyleClient,
6
6
  isValidCacheTag
7
- } from "./chunk-N7ZQUAGM.js";
7
+ } from "./chunk-MGSUQBDW.js";
8
8
  import "./chunk-67IOIAVW.js";
9
9
 
10
10
  // src/next/use-cache.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdacorp/hyle-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.17.0",
4
4
  "description": "hyle SDK: a typed client for hyle's resolve endpoint, a hast renderer for React, and a Next.js catch-all page with tag-based revalidation.",
5
5
  "license": "MIT",
6
6
  "repository": {