@tdacorp/hyle-sdk 0.9.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +111 -2
  2. package/bin/hyle-sdk-engage-keygen.mjs +3 -0
  3. package/dist/check-routes-bin.js +5 -1
  4. package/dist/{chunk-54JF4E53.js → chunk-N7ZQUAGM.js} +45 -2
  5. package/dist/chunk-R5EMI4HQ.js +61 -0
  6. package/dist/{chunk-XKR74Y5G.js → chunk-S7PCCEHP.js} +1 -1
  7. package/dist/{chunk-6LW33475.js → chunk-ZQFYH4FX.js} +538 -50
  8. package/dist/comments.cjs +1048 -0
  9. package/dist/comments.d.cts +152 -0
  10. package/dist/comments.d.ts +152 -0
  11. package/dist/comments.js +1025 -0
  12. package/dist/{types-BPPZrYOZ.d.cts → embed-DL5QIZRJ.d.ts} +44 -3
  13. package/dist/{types-C1eCQ2As.d.ts → embed-jCaSI31t.d.cts} +44 -3
  14. package/dist/engage-keygen-bin.js +67 -0
  15. package/dist/index.cjs +26 -1
  16. package/dist/index.d.cts +11 -3
  17. package/dist/index.d.ts +11 -3
  18. package/dist/index.js +5 -1
  19. package/dist/mermaid-diagram.js +9 -54
  20. package/dist/next.cjs +1010 -78
  21. package/dist/next.d.cts +163 -6
  22. package/dist/next.d.ts +163 -6
  23. package/dist/next.js +442 -14
  24. package/dist/react.cjs +340 -49
  25. package/dist/react.d.cts +112 -7
  26. package/dist/react.d.ts +112 -7
  27. package/dist/react.js +7 -1
  28. package/dist/{resolve-Dpb6Orsj.d.ts → resolve-DvmuBlpO.d.ts} +1 -1
  29. package/dist/{resolve-D2rnnho9.d.cts → resolve-f6IJ6SL9.d.cts} +1 -1
  30. package/dist/styles.css +117 -0
  31. package/dist/{types-CHxH5E0S.d.cts → types-5D6ZD0Wi.d.cts} +59 -1
  32. package/dist/{types-CHxH5E0S.d.ts → types-5D6ZD0Wi.d.ts} +59 -1
  33. package/dist/use-cache.cjs +5 -1
  34. package/dist/use-cache.d.cts +2 -2
  35. package/dist/use-cache.d.ts +2 -2
  36. package/dist/use-cache.js +2 -2
  37. package/package.json +4 -3
package/dist/react.d.cts CHANGED
@@ -1,20 +1,22 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement } from 'react';
3
- import { H as HyleComponents, P as PageBaseProps } from './types-BPPZrYOZ.cjs';
4
- export { C as CalloutKind, b as CalloutProps, c as CodeBlockProps, a as HyleSlots, I as ImageProps, L as LinkProps, d as ListItemProps, M as MermaidProps } from './types-BPPZrYOZ.cjs';
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';
5
5
  import { Root } from 'hast';
6
- import { f as ResolvedArticle, h as ResolvedList } from './types-CHxH5E0S.cjs';
6
+ import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.cjs';
7
7
 
8
8
  interface HastContentProps {
9
9
  /** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
10
10
  tree: unknown;
11
11
  /** The page title; a leading body h1 that repeats it is dropped. */
12
12
  title?: string;
13
+ /** The page description; a leading body paragraph that starts with it is dropped. */
14
+ description?: string | null;
13
15
  components?: HyleComponents;
14
16
  locale?: string;
15
17
  }
16
18
  /** Renders the `hast` content format as React elements. Never uses dangerouslySetInnerHTML; every node passes the allowlist first. */
17
- declare function HastContent({ tree, title, components, locale }: HastContentProps): ReactElement;
19
+ declare function HastContent({ tree, title, description, components, locale }: HastContentProps): ReactElement;
18
20
  /**
19
21
  * The one escape hatch: renders `content.format === "html"` as raw HTML. Use it ONLY with HTML that came from hyle's
20
22
  * resolve endpoint over your server-side connection, which sanitizes it before serializing. It is not sanitized again
@@ -91,9 +93,77 @@ declare const scopeId: (id: string) => string;
91
93
  declare function isSafeUrl(value: unknown, kind: "href" | "src"): boolean;
92
94
  /**
93
95
  * @param title when the body opens with an h1 that repeats the page title, that h1 is dropped (the page renders the title itself).
96
+ * @param description when the first paragraph after that h1 starts with it, the paragraph is dropped (the page renders the description itself; hyle derives it, capped, from that paragraph).
94
97
  * @throws HastLimitError when the tree has more than 20,000 nodes or 512 KiB of text (hyle's own renderer caps).
95
98
  */
96
- declare function sanitizeHast(tree: unknown, title?: string): Root;
99
+ declare function sanitizeHast(tree: unknown, title?: string, description?: string | null): Root;
100
+
101
+ /**
102
+ * Chrome strings of the Comments component (en, fr, es). The fr and es copy is a draft and has not been reviewed by a native
103
+ * speaker. Placeholders in braces are filled by the component. Plain data: the client component receives only the active set.
104
+ */
105
+ interface CommentStrings {
106
+ readonly heading: string;
107
+ readonly countLabel: string;
108
+ readonly likeArticle: string;
109
+ readonly likedArticle: string;
110
+ readonly likeArticleSignIn: string;
111
+ readonly likeComment: string;
112
+ readonly likeCommentSignIn: string;
113
+ readonly signInTitle: string;
114
+ readonly signInBody: string;
115
+ readonly signIn: string;
116
+ readonly commentingAs: string;
117
+ readonly write: string;
118
+ readonly placeholder: string;
119
+ readonly help: string;
120
+ readonly chars: string;
121
+ readonly post: string;
122
+ readonly posting: string;
123
+ readonly reply: string;
124
+ readonly replyTo: string;
125
+ readonly replyPlaceholder: string;
126
+ readonly cancel: string;
127
+ readonly edit: string;
128
+ readonly editLeft: string;
129
+ readonly save: string;
130
+ readonly delete: string;
131
+ readonly deleteConfirm: string;
132
+ readonly keep: string;
133
+ readonly you: string;
134
+ readonly edited: string;
135
+ readonly removed: string;
136
+ readonly removedByModerator: string;
137
+ readonly removedByAuthor: string;
138
+ readonly depthEnd: string;
139
+ readonly held: string;
140
+ readonly heldBanner: string;
141
+ readonly heldBannerBody: string;
142
+ readonly heldNote: string;
143
+ readonly heldLive: string;
144
+ readonly postedLive: string;
145
+ readonly deletedLive: string;
146
+ readonly savedLive: string;
147
+ readonly empty: string;
148
+ readonly emptyBody: string;
149
+ readonly loading: string;
150
+ readonly loadError: string;
151
+ readonly loadErrorBody: string;
152
+ readonly retry: string;
153
+ readonly postError: string;
154
+ readonly tooLong: string;
155
+ readonly editClosed: string;
156
+ readonly actionError: string;
157
+ readonly rateTitle: string;
158
+ readonly rateBody: string;
159
+ readonly rateWait: string;
160
+ readonly bannedTitle: string;
161
+ readonly bannedBody: string;
162
+ readonly expired: string;
163
+ readonly more: string;
164
+ readonly truncated: string;
165
+ readonly justNow: string;
166
+ }
97
167
 
98
168
  /**
99
169
  * Chrome strings for en, fr and es. The fr and es copy is a draft carried over from the design kit and has not been
@@ -121,6 +191,8 @@ declare const en: {
121
191
  fallbackTitle: string;
122
192
  fallbackBody: string;
123
193
  older: string;
194
+ viewAll: string;
195
+ readAtSource: string;
124
196
  emptyTitle: string;
125
197
  emptyBody: string;
126
198
  docs: string;
@@ -142,6 +214,7 @@ declare const en: {
142
214
  unTitle: string;
143
215
  unBody: string;
144
216
  viewer: ViewerLabels;
217
+ comments: CommentStrings;
145
218
  };
146
219
  type Strings = typeof en;
147
220
  /** Strings for a BCP 47 tag; the primary subtag decides, anything unknown falls back to English. */
@@ -149,8 +222,15 @@ declare function stringsFor(locale: string | undefined): Strings;
149
222
 
150
223
  interface ArticlePageProps extends PageBaseProps {
151
224
  article: ResolvedArticle;
225
+ /**
226
+ * Renders the comments and likes section between the article and the pager. Default off: hyle's resolve does not say whether a
227
+ * workspace has engagement on, so the host opts in. The section loads in the browser after the (cached) article.
228
+ */
229
+ engagement?: EngagementConfig | undefined;
230
+ /** 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
+ origin?: string | undefined;
152
232
  }
153
- declare function ArticlePage({ article, ...base }: ArticlePageProps): ReactElement;
233
+ declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
154
234
  interface ListPageProps extends PageBaseProps {
155
235
  list: ResolvedList;
156
236
  /** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
@@ -175,6 +255,31 @@ interface RedirectingProps extends PageBaseProps {
175
255
  /** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
176
256
  declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
177
257
 
258
+ /**
259
+ * The comments and likes section of an article (ADR 0017). It is fetched in the browser, uncached, after the cached article
260
+ * has rendered, so a like never purges a page. It talks only to the host's own `createEngagementRoute` (same origin): no
261
+ * credential, no hyle URL and no markup built from text ever reaches this file. Comment bodies are server-rendered hast, turned
262
+ * into React elements by `CommentBody`; the reader's own unapproved comment is shown as plain text.
263
+ */
264
+ interface CommentsProps {
265
+ /** The article's canonical site path (`publication.canonical_path`). */
266
+ readonly path: string;
267
+ /** The host route that answers the calls, for example "/api/hyle/engage". No trailing slash. */
268
+ readonly endpoint: string;
269
+ /** Where the sign-in button goes. Without it a signed-out visitor sees the prompt but no button. */
270
+ readonly signInHref?: string | undefined;
271
+ readonly locale: string;
272
+ readonly labels: CommentStrings;
273
+ /**
274
+ * The public listing, fetched on the server (`HyleComments` with `interactive`): the section renders from it at once, with no
275
+ * skeleton, and still refetches silently on mount. Keep it referentially stable between renders. Public data only.
276
+ */
277
+ readonly initial?: EngageListing | undefined;
278
+ /** Epoch milliseconds `initial` was fetched at: the first render's clock, so relative times hydrate identically. The real clock takes over on mount. */
279
+ readonly initialAt?: number | undefined;
280
+ }
281
+ declare function Comments({ path, endpoint, signInHref, locale, labels: s, initial, initialAt }: CommentsProps): ReactElement | null;
282
+
178
283
  declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
179
284
 
180
- export { ArticlePage, type ArticlePageProps, DocsPage, 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 };
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 };
package/dist/react.d.ts CHANGED
@@ -1,20 +1,22 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement } from 'react';
3
- import { H as HyleComponents, P as PageBaseProps } from './types-C1eCQ2As.js';
4
- export { C as CalloutKind, b as CalloutProps, c as CodeBlockProps, a as HyleSlots, I as ImageProps, L as LinkProps, d as ListItemProps, M as MermaidProps } from './types-C1eCQ2As.js';
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';
5
5
  import { Root } from 'hast';
6
- import { f as ResolvedArticle, h as ResolvedList } from './types-CHxH5E0S.js';
6
+ import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.js';
7
7
 
8
8
  interface HastContentProps {
9
9
  /** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
10
10
  tree: unknown;
11
11
  /** The page title; a leading body h1 that repeats it is dropped. */
12
12
  title?: string;
13
+ /** The page description; a leading body paragraph that starts with it is dropped. */
14
+ description?: string | null;
13
15
  components?: HyleComponents;
14
16
  locale?: string;
15
17
  }
16
18
  /** Renders the `hast` content format as React elements. Never uses dangerouslySetInnerHTML; every node passes the allowlist first. */
17
- declare function HastContent({ tree, title, components, locale }: HastContentProps): ReactElement;
19
+ declare function HastContent({ tree, title, description, components, locale }: HastContentProps): ReactElement;
18
20
  /**
19
21
  * The one escape hatch: renders `content.format === "html"` as raw HTML. Use it ONLY with HTML that came from hyle's
20
22
  * resolve endpoint over your server-side connection, which sanitizes it before serializing. It is not sanitized again
@@ -91,9 +93,77 @@ declare const scopeId: (id: string) => string;
91
93
  declare function isSafeUrl(value: unknown, kind: "href" | "src"): boolean;
92
94
  /**
93
95
  * @param title when the body opens with an h1 that repeats the page title, that h1 is dropped (the page renders the title itself).
96
+ * @param description when the first paragraph after that h1 starts with it, the paragraph is dropped (the page renders the description itself; hyle derives it, capped, from that paragraph).
94
97
  * @throws HastLimitError when the tree has more than 20,000 nodes or 512 KiB of text (hyle's own renderer caps).
95
98
  */
96
- declare function sanitizeHast(tree: unknown, title?: string): Root;
99
+ declare function sanitizeHast(tree: unknown, title?: string, description?: string | null): Root;
100
+
101
+ /**
102
+ * Chrome strings of the Comments component (en, fr, es). The fr and es copy is a draft and has not been reviewed by a native
103
+ * speaker. Placeholders in braces are filled by the component. Plain data: the client component receives only the active set.
104
+ */
105
+ interface CommentStrings {
106
+ readonly heading: string;
107
+ readonly countLabel: string;
108
+ readonly likeArticle: string;
109
+ readonly likedArticle: string;
110
+ readonly likeArticleSignIn: string;
111
+ readonly likeComment: string;
112
+ readonly likeCommentSignIn: string;
113
+ readonly signInTitle: string;
114
+ readonly signInBody: string;
115
+ readonly signIn: string;
116
+ readonly commentingAs: string;
117
+ readonly write: string;
118
+ readonly placeholder: string;
119
+ readonly help: string;
120
+ readonly chars: string;
121
+ readonly post: string;
122
+ readonly posting: string;
123
+ readonly reply: string;
124
+ readonly replyTo: string;
125
+ readonly replyPlaceholder: string;
126
+ readonly cancel: string;
127
+ readonly edit: string;
128
+ readonly editLeft: string;
129
+ readonly save: string;
130
+ readonly delete: string;
131
+ readonly deleteConfirm: string;
132
+ readonly keep: string;
133
+ readonly you: string;
134
+ readonly edited: string;
135
+ readonly removed: string;
136
+ readonly removedByModerator: string;
137
+ readonly removedByAuthor: string;
138
+ readonly depthEnd: string;
139
+ readonly held: string;
140
+ readonly heldBanner: string;
141
+ readonly heldBannerBody: string;
142
+ readonly heldNote: string;
143
+ readonly heldLive: string;
144
+ readonly postedLive: string;
145
+ readonly deletedLive: string;
146
+ readonly savedLive: string;
147
+ readonly empty: string;
148
+ readonly emptyBody: string;
149
+ readonly loading: string;
150
+ readonly loadError: string;
151
+ readonly loadErrorBody: string;
152
+ readonly retry: string;
153
+ readonly postError: string;
154
+ readonly tooLong: string;
155
+ readonly editClosed: string;
156
+ readonly actionError: string;
157
+ readonly rateTitle: string;
158
+ readonly rateBody: string;
159
+ readonly rateWait: string;
160
+ readonly bannedTitle: string;
161
+ readonly bannedBody: string;
162
+ readonly expired: string;
163
+ readonly more: string;
164
+ readonly truncated: string;
165
+ readonly justNow: string;
166
+ }
97
167
 
98
168
  /**
99
169
  * Chrome strings for en, fr and es. The fr and es copy is a draft carried over from the design kit and has not been
@@ -121,6 +191,8 @@ declare const en: {
121
191
  fallbackTitle: string;
122
192
  fallbackBody: string;
123
193
  older: string;
194
+ viewAll: string;
195
+ readAtSource: string;
124
196
  emptyTitle: string;
125
197
  emptyBody: string;
126
198
  docs: string;
@@ -142,6 +214,7 @@ declare const en: {
142
214
  unTitle: string;
143
215
  unBody: string;
144
216
  viewer: ViewerLabels;
217
+ comments: CommentStrings;
145
218
  };
146
219
  type Strings = typeof en;
147
220
  /** Strings for a BCP 47 tag; the primary subtag decides, anything unknown falls back to English. */
@@ -149,8 +222,15 @@ declare function stringsFor(locale: string | undefined): Strings;
149
222
 
150
223
  interface ArticlePageProps extends PageBaseProps {
151
224
  article: ResolvedArticle;
225
+ /**
226
+ * Renders the comments and likes section between the article and the pager. Default off: hyle's resolve does not say whether a
227
+ * workspace has engagement on, so the host opts in. The section loads in the browser after the (cached) article.
228
+ */
229
+ engagement?: EngagementConfig | undefined;
230
+ /** 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
+ origin?: string | undefined;
152
232
  }
153
- declare function ArticlePage({ article, ...base }: ArticlePageProps): ReactElement;
233
+ declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
154
234
  interface ListPageProps extends PageBaseProps {
155
235
  list: ResolvedList;
156
236
  /** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
@@ -175,6 +255,31 @@ interface RedirectingProps extends PageBaseProps {
175
255
  /** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
176
256
  declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
177
257
 
258
+ /**
259
+ * The comments and likes section of an article (ADR 0017). It is fetched in the browser, uncached, after the cached article
260
+ * has rendered, so a like never purges a page. It talks only to the host's own `createEngagementRoute` (same origin): no
261
+ * credential, no hyle URL and no markup built from text ever reaches this file. Comment bodies are server-rendered hast, turned
262
+ * into React elements by `CommentBody`; the reader's own unapproved comment is shown as plain text.
263
+ */
264
+ interface CommentsProps {
265
+ /** The article's canonical site path (`publication.canonical_path`). */
266
+ readonly path: string;
267
+ /** The host route that answers the calls, for example "/api/hyle/engage". No trailing slash. */
268
+ readonly endpoint: string;
269
+ /** Where the sign-in button goes. Without it a signed-out visitor sees the prompt but no button. */
270
+ readonly signInHref?: string | undefined;
271
+ readonly locale: string;
272
+ readonly labels: CommentStrings;
273
+ /**
274
+ * The public listing, fetched on the server (`HyleComments` with `interactive`): the section renders from it at once, with no
275
+ * skeleton, and still refetches silently on mount. Keep it referentially stable between renders. Public data only.
276
+ */
277
+ readonly initial?: EngageListing | undefined;
278
+ /** Epoch milliseconds `initial` was fetched at: the first render's clock, so relative times hydrate identically. The real clock takes over on mount. */
279
+ readonly initialAt?: number | undefined;
280
+ }
281
+ declare function Comments({ path, endpoint, signInHref, locale, labels: s, initial, initialAt }: CommentsProps): ReactElement | null;
282
+
178
283
  declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
179
284
 
180
- export { ArticlePage, type ArticlePageProps, DocsPage, 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 };
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 };
package/dist/react.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import {
2
2
  ArticlePage,
3
+ Comments,
3
4
  DocsPage,
4
5
  HastContent,
5
6
  HastLimitError,
7
+ HyleArticleView,
8
+ HyleListView,
6
9
  ListPage,
7
10
  MermaidDiagram,
8
11
  NotFound,
@@ -13,13 +16,16 @@ import {
13
16
  sanitizeHast,
14
17
  scopeId,
15
18
  stringsFor
16
- } from "./chunk-6LW33475.js";
19
+ } from "./chunk-ZQFYH4FX.js";
17
20
  import "./chunk-67IOIAVW.js";
18
21
  export {
19
22
  ArticlePage,
23
+ Comments,
20
24
  DocsPage,
21
25
  HastContent,
22
26
  HastLimitError,
27
+ HyleArticleView,
28
+ HyleListView,
23
29
  ListPage,
24
30
  MermaidDiagram,
25
31
  NotFound,
@@ -1,4 +1,4 @@
1
- import { R as Resolved } from './types-CHxH5E0S.js';
1
+ import { R as Resolved } from './types-5D6ZD0Wi.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
4
  type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
@@ -1,4 +1,4 @@
1
- import { R as Resolved } from './types-CHxH5E0S.cjs';
1
+ import { R as Resolved } from './types-5D6ZD0Wi.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
4
  type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
package/dist/styles.css CHANGED
@@ -493,3 +493,120 @@ html.hyle-viewer-lock:has(.hv-shell:fullscreen){scrollbar-gutter:auto}
493
493
  .hv-legend .hv-sel{color:var(--hv-accent)}
494
494
  .hv-legend .hv-up{color:var(--hv-up)}
495
495
  .hv-legend .hv-down{color:var(--hv-down)}
496
+
497
+ /* ===== Comments (engagement) =====
498
+ Hand-maintained, outside the generated token block. Public variables are --hyle-comments-* (not yet in site_tokens.py, DECISIONS 72).
499
+ Everything else reads --h-* only. Rendered by ArticlePage when the workspace enables engagement, between the article body and the pager. */
500
+ .hyle-comments{
501
+ --hc-indent:var(--hyle-comments-indent,24px);
502
+ --hc-gap:var(--hyle-comments-gap,20px);
503
+ --hc-avatar:var(--hyle-comments-avatar-size,32px);
504
+ --hc-rule:var(--hyle-comments-rule,var(--h-hairline));
505
+ --hc-held:var(--hyle-comments-held,var(--h-warn));
506
+ --hc-like-on:var(--hyle-comments-like-on,var(--h-link));
507
+ margin-top:64px;padding-top:32px;border-top:1px solid var(--h-hairline)}
508
+ .hyle-cm-head{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px;justify-content:space-between}
509
+ .hyle-cm-head h2{font-family:var(--h-font-heading);font-weight:600;font-size:20px;line-height:1.3;letter-spacing:var(--h-heading-tracking);display:flex;align-items:center;gap:12px}
510
+ .hyle-cm-count{font:500 12px/1 var(--h-font-mono);color:var(--h-text-muted);padding:4px 8px;border:var(--h-border-width) solid var(--h-border);border-radius:min(var(--h-radius),6px);background:var(--h-surface-2)}
511
+ .hyle-comments .hyle-banner{margin-top:16px}
512
+ .hyle-comments .hyle-banner[data-kind="bad"]{background:color-mix(in srgb,var(--h-bad) 9%,var(--h-surface));border-color:color-mix(in srgb,var(--h-bad) 35%,var(--h-border))}
513
+ .hyle-comments .hyle-banner[data-kind="bad"]>.hyle-ic{color:var(--h-bad)}
514
+ .hyle-banner .hyle-bt{flex:1;min-width:0}
515
+ .hyle-banner .hyle-bt p+p{margin-top:4px}
516
+ .hyle-banner .hyle-btn{flex:none;margin-left:auto}
517
+ /* buttons inside comments: quiet, 32px tall (40px on narrow mounts for touch) */
518
+ .hyle-cm-btn{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 8px;border:0;border-radius:min(var(--h-radius),6px);background:transparent;color:var(--h-text-muted);font:500 13px/1 var(--h-font-sans);cursor:pointer;text-decoration:none}
519
+ .hyle-cm-acts>:first-child{margin-left:-8px}
520
+ .hyle-cm-btn:hover{background:var(--h-surface-2);color:var(--h-text)}
521
+ .hyle-cm-btn[aria-pressed="true"]{background:var(--h-surface-2);color:var(--h-text)}
522
+ .hyle-cm-btn[aria-pressed="true"] .hyle-ic{fill:var(--hc-like-on);stroke:var(--hc-like-on)}
523
+ .hyle-cm-btn[aria-disabled="true"]{color:var(--h-text-faint);cursor:default;pointer-events:none}
524
+ .hyle-cm-btn .hyle-ic{width:16px;height:16px}
525
+ .hyle-cm-btn.danger:hover{color:var(--h-bad)}
526
+ .hyle-cm-btn.cnt{font-variant-numeric:tabular-nums}
527
+ /* article-level like */
528
+ .hyle-react{display:flex;align-items:center;gap:12px;margin-top:24px}
529
+ .hyle-react .hyle-btn[aria-pressed="true"]{background:var(--h-surface-2);font-weight:600}
530
+ .hyle-react .hyle-btn[aria-pressed="true"] .hyle-ic{fill:var(--hc-like-on);stroke:var(--hc-like-on)}
531
+ .hyle-react small{font-size:13px;color:var(--h-text-muted)}
532
+ /* composer */
533
+ .hyle-cm-compose{display:grid;grid-template-columns:var(--hc-avatar) minmax(0,1fr);gap:12px;margin-top:24px}
534
+ .hyle-cm-compose .hyle-avatar,.hyle-cm .hyle-avatar{font-size:11px}
535
+ .hyle-cm-compose .hyle-avatar{width:var(--hc-avatar);height:var(--hc-avatar)}
536
+ .hyle-cm-as{font-size:13px;color:var(--h-text-muted);margin-bottom:8px}
537
+ .hyle-cm-as b{color:var(--h-text);font-weight:600}
538
+ .hyle-cm-input{display:block;width:100%;min-height:96px;padding:12px;border:var(--h-border-width) solid var(--h-border);border-radius:var(--h-radius);background:var(--h-surface);color:var(--h-text);font:400 15px/1.5 var(--h-font-sans);resize:vertical}
539
+ .hyle-cm-input::placeholder{color:var(--h-text-faint)}
540
+ .hyle-cm-input:hover{border-color:var(--h-text-faint)}
541
+ .hyle-cm-input[aria-invalid="true"]{border-color:var(--h-bad)}
542
+ .hyle-cm-input:disabled{background:transparent;color:var(--h-text-faint);cursor:not-allowed}
543
+ .hyle-cm-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-top:8px;font-size:13px;color:var(--h-text-muted)}
544
+ .hyle-cm-foot .grow{flex:1;min-width:200px}
545
+ .hyle-cm-foot .cnt{font-variant-numeric:tabular-nums;font-family:var(--h-font-mono);font-size:12px;color:var(--h-text-faint)}
546
+ .hyle-cm-err{display:flex;gap:8px;align-items:flex-start;margin-top:8px;font-size:14px;color:var(--h-bad)}
547
+ .hyle-cm-err .hyle-ic{margin-top:2px}
548
+ /* signed-out prompt */
549
+ .hyle-cm-signin{display:flex;flex-wrap:wrap;align-items:center;gap:12px 24px;justify-content:space-between;margin-top:24px;padding:16px;border:var(--h-border-width) solid var(--h-border);border-radius:var(--h-radius-lg);background:var(--h-surface)}
550
+ .hyle-cm-signin p{font-size:15px;line-height:1.5;color:var(--h-text-muted);max-width:44ch}
551
+ .hyle-cm-signin b{color:var(--h-text);font-weight:600;display:block}
552
+ /* thread */
553
+ .hyle-cm-list{margin-top:8px}
554
+ .hyle-cm-list .hyle-cm-list{margin-top:0;margin-left:calc(var(--hc-avatar) / 2);padding-left:var(--hc-indent);border-left:1px solid var(--hc-rule)}
555
+ .hyle-cm{padding-top:var(--hc-gap)}
556
+ .hyle-cm>article{display:grid;grid-template-columns:var(--hc-avatar) minmax(0,1fr);column-gap:12px}
557
+ .hyle-cm .hyle-avatar{width:var(--hc-avatar);height:var(--hc-avatar);font-size:12px}
558
+ .hyle-cm-main{min-width:0}
559
+ .hyle-cm-by{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;font-size:14px;line-height:1.4;color:var(--h-text-muted)}
560
+ .hyle-cm-by b{color:var(--h-text);font-weight:600}
561
+ .hyle-cm-by a{color:var(--h-text-muted);text-underline-offset:3px}
562
+ .hyle-cm-tag{font:500 11px/1 var(--h-font-sans);padding:2px 6px;border-radius:min(var(--h-radius),4px);border:var(--h-border-width) solid var(--h-border);color:var(--h-text-muted)}
563
+ .hyle-cm-body{margin-top:4px;font-size:15px;line-height:1.6;color:var(--h-text);overflow-wrap:anywhere}
564
+ .hyle-cm-body>*+*{margin-top:8px}
565
+ .hyle-cm-body a{color:var(--h-link);text-underline-offset:3px}
566
+ .hyle-cm-body code{font:400 .875em var(--h-font-mono);padding:1px 4px;border-radius:4px;background:var(--h-code-bg);border:1px solid var(--h-code-border)}
567
+ .hyle-cm-body blockquote{padding-left:12px;border-left:2px solid var(--h-border);color:var(--h-text-muted)}
568
+ .hyle-cm-acts{display:flex;flex-wrap:wrap;align-items:center;gap:0 8px;margin-top:4px}
569
+ .hyle-cm-acts .sp{flex:1}
570
+ .hyle-cm-acts small{font-size:12px;color:var(--h-text-faint)}
571
+ .hyle-cm-depth{font-size:13px;color:var(--h-text-faint);padding:0 8px}
572
+ /* tombstones */
573
+ .hyle-cm[data-status="deleted"] .hyle-avatar,.hyle-cm[data-status="removed"] .hyle-avatar{background:transparent;border-style:dashed;color:var(--h-text-faint)}
574
+ .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)}
575
+ .hyle-cm[data-status="deleted"] .hyle-cm-by,.hyle-cm[data-status="removed"] .hyle-cm-by{display:none}
576
+ .hyle-cm[data-status="deleted"] .hyle-cm-main,.hyle-cm[data-status="removed"] .hyle-cm-main{align-self:center}
577
+ /* held for moderation (only its author sees it) */
578
+ .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)}
579
+ .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)}
580
+ .hyle-cm-held .hyle-ic{color:var(--hc-held)}
581
+ .hyle-cm-held b{color:var(--h-text);font-weight:600}
582
+ .hyle-cm-more{margin-top:var(--hc-gap)}
583
+ .hyle-cm-more .hyle-btn{height:32px}
584
+ /* empty and loading */
585
+ .hyle-cm-empty{display:grid;justify-items:start;gap:4px;margin-top:24px;padding:24px 0;border-top:1px solid var(--h-hairline);color:var(--h-text-muted);font-size:15px}
586
+ .hyle-cm-empty b{color:var(--h-text);font-weight:600}
587
+ .hyle-sk{display:block;background:var(--h-surface-2);border-radius:4px}
588
+ .hyle-cm-sk{display:grid;grid-template-columns:var(--hc-avatar) minmax(0,1fr);column-gap:12px;padding-top:var(--hc-gap)}
589
+ .hyle-cm-sk .hyle-sk.c{width:var(--hc-avatar);height:var(--hc-avatar);border-radius:50%}
590
+ .hyle-cm-sk .hyle-sk.l{height:12px;margin-top:8px}
591
+ @media (prefers-reduced-motion:no-preference){.hyle-sk{animation:hyle-sk 1.4s ease-in-out infinite}@keyframes hyle-sk{50%{opacity:.5}}}
592
+ @container hyle (max-width:640px){
593
+ .hyle-comments{--hc-avatar:var(--hyle-comments-avatar-size,24px);--hc-indent:var(--hyle-comments-indent,8px);margin-top:48px}
594
+ .hyle-cm>article,.hyle-cm-compose,.hyle-cm-sk{column-gap:8px}
595
+ .hyle-cm-btn{height:40px}
596
+ .hyle-cm-signin .hyle-btn,.hyle-banner .hyle-btn{width:100%;margin-left:0}
597
+ .hyle-banner{flex-wrap:wrap}
598
+ .hyle-cm[data-status="held"]>article{margin-inline:-8px;padding:8px}
599
+ }
600
+ .hyle-cm-note{margin-top:16px;font-size:13px;color:var(--h-text-muted)}
601
+ .hyle-cm-reply,.hyle-cm-main>.hyle-cm-compose{margin-top:12px}
602
+
603
+ /* ---- embeds (HyleList, HyleArticle, HyleComments): no page frame; the host owns width, padding and the page's headings ---- */
604
+ .hyle-embed .hyle-title{font-size:var(--h-h2-size);line-height:1.3}
605
+ .hyle-embed>.hyle-title+.hyle-items,.hyle-embed .hyle-head+.hyle-body{margin-top:16px}
606
+ .hyle-embed .hyle-item{margin-inline:0}
607
+ .hyle-embed .hyle-more{display:inline-block;margin-top:16px;font-weight:500;color:var(--h-link);text-underline-offset:3px}
608
+ .hyle-embed>.hyle-comments{margin-top:0}
609
+ .hyle-embed[data-layout="grid"] .hyle-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--h-gutter)}
610
+ .hyle-embed[data-layout="grid"] .hyle-items>li{border:var(--h-border-width) solid var(--h-border);border-radius:var(--h-radius-lg)}
611
+ .hyle-embed[data-layout="grid"] .hyle-item{grid-template-columns:minmax(0,1fr);gap:4px;height:100%;padding:16px}
612
+ .hyle-embed[data-layout="grid"] .hyle-item time{order:-1;font-size:13px;line-height:1.4}
@@ -74,6 +74,8 @@ interface ResolvedArticle {
74
74
  /** Present only when requested with `nav: "tree"` (the docs layout does); absent from every other response. */
75
75
  readonly nav?: NavTree;
76
76
  readonly alternates: readonly Alternate[];
77
+ /** The workspace default locale; absent from an older server. */
78
+ readonly default_locale?: string;
77
79
  readonly fallback?: Fallback;
78
80
  readonly cache: CacheInfo;
79
81
  }
@@ -134,5 +136,61 @@ interface Mounts {
134
136
  readonly cache: CacheInfo;
135
137
  }
136
138
  type MountsResult = Mounts | ResolvedDisabled;
139
+ /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
140
+ interface EngageComment {
141
+ readonly id: string;
142
+ readonly parent_id: string | null;
143
+ /** 1 to 4. */
144
+ readonly depth: number;
145
+ /** An immutable author-name string, read if a hyle sends it; the contract on main is `author: { name }`, which is read the same way. */
146
+ readonly author_name?: string | null;
147
+ readonly author?: {
148
+ readonly name: string;
149
+ } | null;
150
+ readonly created_at: string;
151
+ readonly edited_at: string | null;
152
+ readonly like_count: number;
153
+ /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
154
+ readonly removed: boolean;
155
+ /** On a tombstone only: who removed it. Absent on a live comment. */
156
+ readonly removed_by?: "moderator" | "author";
157
+ readonly body: {
158
+ readonly format: "hast";
159
+ readonly tree: unknown;
160
+ } | null;
161
+ /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
162
+ readonly mine?: boolean;
163
+ readonly liked_by_me?: boolean;
164
+ /** ISO instant until which the reader may edit, or null. */
165
+ readonly can_edit_until?: string | null;
166
+ }
167
+ /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
168
+ interface EngageHeldComment {
169
+ readonly id: string;
170
+ readonly parent_id: string | null;
171
+ readonly depth: number;
172
+ readonly author_name: string | null;
173
+ readonly created_at: string;
174
+ readonly edited_at: string | null;
175
+ readonly can_edit_until: string | null;
176
+ readonly body: {
177
+ readonly format: "hast";
178
+ readonly tree: unknown;
179
+ } | null;
180
+ }
181
+ /** `data` of `GET /cp1/engage/comments`. */
182
+ interface EngageListing {
183
+ readonly cp: 1;
184
+ readonly kind: "comments";
185
+ readonly publication_id: string;
186
+ readonly comment_count: number;
187
+ readonly like_count: number;
188
+ /** More than the 500 listed comments exist. */
189
+ readonly truncated: boolean;
190
+ readonly comments: readonly EngageComment[];
191
+ /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
192
+ readonly liked_by_me?: boolean;
193
+ readonly mine_held?: readonly EngageHeldComment[];
194
+ }
137
195
 
138
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, Fallback as F, ListItem as L, MountsResult as M, NavItem as N, Resolved as R, TocEntry as T, ArticleContent as a, Mount as b, Mounts as c, NavNode as d, NavTree as e, ResolvedArticle as f, ResolvedDisabled as g, ResolvedList as h, ResolvedNotFound as i, ResolvedRedirect as j };
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 };
@@ -74,6 +74,8 @@ interface ResolvedArticle {
74
74
  /** Present only when requested with `nav: "tree"` (the docs layout does); absent from every other response. */
75
75
  readonly nav?: NavTree;
76
76
  readonly alternates: readonly Alternate[];
77
+ /** The workspace default locale; absent from an older server. */
78
+ readonly default_locale?: string;
77
79
  readonly fallback?: Fallback;
78
80
  readonly cache: CacheInfo;
79
81
  }
@@ -134,5 +136,61 @@ interface Mounts {
134
136
  readonly cache: CacheInfo;
135
137
  }
136
138
  type MountsResult = Mounts | ResolvedDisabled;
139
+ /** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
140
+ interface EngageComment {
141
+ readonly id: string;
142
+ readonly parent_id: string | null;
143
+ /** 1 to 4. */
144
+ readonly depth: number;
145
+ /** An immutable author-name string, read if a hyle sends it; the contract on main is `author: { name }`, which is read the same way. */
146
+ readonly author_name?: string | null;
147
+ readonly author?: {
148
+ readonly name: string;
149
+ } | null;
150
+ readonly created_at: string;
151
+ readonly edited_at: string | null;
152
+ readonly like_count: number;
153
+ /** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
154
+ readonly removed: boolean;
155
+ /** On a tombstone only: who removed it. Absent on a live comment. */
156
+ readonly removed_by?: "moderator" | "author";
157
+ readonly body: {
158
+ readonly format: "hast";
159
+ readonly tree: unknown;
160
+ } | null;
161
+ /** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
162
+ readonly mine?: boolean;
163
+ readonly liked_by_me?: boolean;
164
+ /** ISO instant until which the reader may edit, or null. */
165
+ readonly can_edit_until?: string | null;
166
+ }
167
+ /** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
168
+ interface EngageHeldComment {
169
+ readonly id: string;
170
+ readonly parent_id: string | null;
171
+ readonly depth: number;
172
+ readonly author_name: string | null;
173
+ readonly created_at: string;
174
+ readonly edited_at: string | null;
175
+ readonly can_edit_until: string | null;
176
+ readonly body: {
177
+ readonly format: "hast";
178
+ readonly tree: unknown;
179
+ } | null;
180
+ }
181
+ /** `data` of `GET /cp1/engage/comments`. */
182
+ interface EngageListing {
183
+ readonly cp: 1;
184
+ readonly kind: "comments";
185
+ readonly publication_id: string;
186
+ readonly comment_count: number;
187
+ readonly like_count: number;
188
+ /** More than the 500 listed comments exist. */
189
+ readonly truncated: boolean;
190
+ readonly comments: readonly EngageComment[];
191
+ /** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
192
+ readonly liked_by_me?: boolean;
193
+ readonly mine_held?: readonly EngageHeldComment[];
194
+ }
137
195
 
138
- export type { Alternate as A, Breadcrumb as B, CacheInfo as C, Fallback as F, ListItem as L, MountsResult as M, NavItem as N, Resolved as R, TocEntry as T, ArticleContent as a, Mount as b, Mounts as c, NavNode as d, NavTree as e, ResolvedArticle as f, ResolvedDisabled as g, ResolvedList as h, ResolvedNotFound as i, ResolvedRedirect as j };
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 };