@tdacorp/hyle-sdk 0.8.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -4
- package/bin/hyle-sdk-engage-keygen.mjs +3 -0
- package/dist/check-routes-bin.js +6 -1
- package/dist/{chunk-EBNIKRQH.js → chunk-N7ZQUAGM.js} +46 -2
- package/dist/chunk-R5EMI4HQ.js +61 -0
- package/dist/{chunk-LGW2KP4X.js → chunk-S3LT6G4M.js} +601 -77
- package/dist/{chunk-N4QYPO7S.js → chunk-S7PCCEHP.js} +3 -2
- package/dist/comments.cjs +1048 -0
- package/dist/comments.d.cts +152 -0
- package/dist/comments.d.ts +152 -0
- package/dist/comments.js +1025 -0
- package/dist/docs-enhance.cjs +97 -0
- package/dist/docs-enhance.d.cts +16 -0
- package/dist/docs-enhance.d.ts +16 -0
- package/dist/docs-enhance.js +73 -0
- package/dist/{types-DnPzhrFx.d.cts → embed-BC8Tlc6A.d.cts} +44 -3
- package/dist/{types-BoyBWF2F.d.ts → embed-CwSzvBUO.d.ts} +44 -3
- package/dist/engage-keygen-bin.js +67 -0
- package/dist/index.cjs +27 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +5 -1
- package/dist/mermaid-diagram.js +9 -54
- package/dist/next.cjs +988 -66
- package/dist/next.d.cts +149 -6
- package/dist/next.d.ts +149 -6
- package/dist/next.js +391 -12
- package/dist/react.cjs +403 -75
- package/dist/react.d.cts +141 -33
- package/dist/react.d.ts +141 -33
- package/dist/react.js +7 -1
- package/dist/{resolve-36-Ng1H0.d.cts → resolve-BYL8jMg0.d.ts} +2 -2
- package/dist/{resolve-1rQntRBh.d.ts → resolve-Ra8-y2U-.d.cts} +2 -2
- package/dist/styles.css +149 -21
- package/dist/{types-CwBCPh6K.d.cts → types-C72FwzOd.d.cts} +71 -1
- package/dist/{types-CwBCPh6K.d.ts → types-C72FwzOd.d.ts} +71 -1
- package/dist/use-cache.cjs +9 -4
- package/dist/use-cache.d.cts +2 -2
- package/dist/use-cache.d.ts +2 -2
- package/dist/use-cache.js +5 -5
- 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 './
|
|
4
|
-
export { C as CalloutKind,
|
|
3
|
+
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-BC8Tlc6A.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-BC8Tlc6A.cjs';
|
|
5
5
|
import { Root } from 'hast';
|
|
6
|
-
import {
|
|
6
|
+
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-C72FwzOd.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,38 +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;
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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;
|
|
123
166
|
}
|
|
124
|
-
/** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
|
|
125
|
-
declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
|
|
126
167
|
|
|
127
168
|
/**
|
|
128
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
|
|
@@ -150,10 +191,14 @@ declare const en: {
|
|
|
150
191
|
fallbackTitle: string;
|
|
151
192
|
fallbackBody: string;
|
|
152
193
|
older: string;
|
|
194
|
+
viewAll: string;
|
|
195
|
+
readAtSource: string;
|
|
153
196
|
emptyTitle: string;
|
|
154
197
|
emptyBody: string;
|
|
155
198
|
docs: string;
|
|
156
199
|
menu: string;
|
|
200
|
+
closeMenu: string;
|
|
201
|
+
updated: string;
|
|
157
202
|
nfKind: string;
|
|
158
203
|
nfTitle: string;
|
|
159
204
|
nfBody: string;
|
|
@@ -169,9 +214,72 @@ declare const en: {
|
|
|
169
214
|
unTitle: string;
|
|
170
215
|
unBody: string;
|
|
171
216
|
viewer: ViewerLabels;
|
|
217
|
+
comments: CommentStrings;
|
|
172
218
|
};
|
|
173
219
|
type Strings = typeof en;
|
|
174
220
|
/** Strings for a BCP 47 tag; the primary subtag decides, anything unknown falls back to English. */
|
|
175
221
|
declare function stringsFor(locale: string | undefined): Strings;
|
|
176
222
|
|
|
177
|
-
|
|
223
|
+
interface ArticlePageProps extends PageBaseProps {
|
|
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;
|
|
232
|
+
}
|
|
233
|
+
declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
|
|
234
|
+
interface ListPageProps extends PageBaseProps {
|
|
235
|
+
list: ResolvedList;
|
|
236
|
+
/** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
|
|
237
|
+
olderHref?: string;
|
|
238
|
+
/** Page description under the title. */
|
|
239
|
+
description?: string;
|
|
240
|
+
}
|
|
241
|
+
declare function ListPage({ list, olderHref, description, ...base }: ListPageProps): ReactElement;
|
|
242
|
+
interface NotFoundProps extends PageBaseProps {
|
|
243
|
+
/** The path that was not found, shown to the visitor. */
|
|
244
|
+
path?: string;
|
|
245
|
+
/** Where "Go to home" goes. */
|
|
246
|
+
homeHref?: string;
|
|
247
|
+
}
|
|
248
|
+
declare function NotFound({ path, homeHref, ...base }: NotFoundProps): ReactElement;
|
|
249
|
+
/** The fail-safe state `hylePage` renders when hyle cannot be reached. It takes no error: nothing internal can reach the markup. */
|
|
250
|
+
declare function Unavailable(base: PageBaseProps): ReactElement;
|
|
251
|
+
interface RedirectingProps extends PageBaseProps {
|
|
252
|
+
from?: string;
|
|
253
|
+
to: string;
|
|
254
|
+
}
|
|
255
|
+
/** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
|
|
256
|
+
declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
|
|
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
|
+
|
|
283
|
+
declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
|
|
284
|
+
|
|
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 './
|
|
4
|
-
export { C as CalloutKind,
|
|
3
|
+
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-CwSzvBUO.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-CwSzvBUO.js';
|
|
5
5
|
import { Root } from 'hast';
|
|
6
|
-
import {
|
|
6
|
+
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-C72FwzOd.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,38 +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;
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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;
|
|
123
166
|
}
|
|
124
|
-
/** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
|
|
125
|
-
declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
|
|
126
167
|
|
|
127
168
|
/**
|
|
128
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
|
|
@@ -150,10 +191,14 @@ declare const en: {
|
|
|
150
191
|
fallbackTitle: string;
|
|
151
192
|
fallbackBody: string;
|
|
152
193
|
older: string;
|
|
194
|
+
viewAll: string;
|
|
195
|
+
readAtSource: string;
|
|
153
196
|
emptyTitle: string;
|
|
154
197
|
emptyBody: string;
|
|
155
198
|
docs: string;
|
|
156
199
|
menu: string;
|
|
200
|
+
closeMenu: string;
|
|
201
|
+
updated: string;
|
|
157
202
|
nfKind: string;
|
|
158
203
|
nfTitle: string;
|
|
159
204
|
nfBody: string;
|
|
@@ -169,9 +214,72 @@ declare const en: {
|
|
|
169
214
|
unTitle: string;
|
|
170
215
|
unBody: string;
|
|
171
216
|
viewer: ViewerLabels;
|
|
217
|
+
comments: CommentStrings;
|
|
172
218
|
};
|
|
173
219
|
type Strings = typeof en;
|
|
174
220
|
/** Strings for a BCP 47 tag; the primary subtag decides, anything unknown falls back to English. */
|
|
175
221
|
declare function stringsFor(locale: string | undefined): Strings;
|
|
176
222
|
|
|
177
|
-
|
|
223
|
+
interface ArticlePageProps extends PageBaseProps {
|
|
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;
|
|
232
|
+
}
|
|
233
|
+
declare function ArticlePage({ article, engagement, origin, ...base }: ArticlePageProps): ReactElement;
|
|
234
|
+
interface ListPageProps extends PageBaseProps {
|
|
235
|
+
list: ResolvedList;
|
|
236
|
+
/** Where "Older posts" goes; omit to hide it. The list endpoint is cursor based, so a host builds this from `list.next_cursor`. */
|
|
237
|
+
olderHref?: string;
|
|
238
|
+
/** Page description under the title. */
|
|
239
|
+
description?: string;
|
|
240
|
+
}
|
|
241
|
+
declare function ListPage({ list, olderHref, description, ...base }: ListPageProps): ReactElement;
|
|
242
|
+
interface NotFoundProps extends PageBaseProps {
|
|
243
|
+
/** The path that was not found, shown to the visitor. */
|
|
244
|
+
path?: string;
|
|
245
|
+
/** Where "Go to home" goes. */
|
|
246
|
+
homeHref?: string;
|
|
247
|
+
}
|
|
248
|
+
declare function NotFound({ path, homeHref, ...base }: NotFoundProps): ReactElement;
|
|
249
|
+
/** The fail-safe state `hylePage` renders when hyle cannot be reached. It takes no error: nothing internal can reach the markup. */
|
|
250
|
+
declare function Unavailable(base: PageBaseProps): ReactElement;
|
|
251
|
+
interface RedirectingProps extends PageBaseProps {
|
|
252
|
+
from?: string;
|
|
253
|
+
to: string;
|
|
254
|
+
}
|
|
255
|
+
/** For a client-side explanation of a move. The Next adapter redirects on the server and never renders this. */
|
|
256
|
+
declare function Redirecting({ from, to, ...base }: RedirectingProps): ReactElement;
|
|
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
|
+
|
|
283
|
+
declare function DocsPage({ article, ...base }: ArticlePageProps): ReactElement;
|
|
284
|
+
|
|
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-
|
|
19
|
+
} from "./chunk-S3LT6G4M.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,7 +1,7 @@
|
|
|
1
|
-
import { R as Resolved } from './types-
|
|
1
|
+
import { R as Resolved } from './types-C72FwzOd.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) => Promise<Resolved>;
|
|
4
|
+
type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
|
|
5
5
|
interface FetchResolverOptions {
|
|
6
6
|
readonly baseUrl: string;
|
|
7
7
|
readonly token: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as Resolved } from './types-
|
|
1
|
+
import { R as Resolved } from './types-C72FwzOd.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) => Promise<Resolved>;
|
|
4
|
+
type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
|
|
5
5
|
interface FetchResolverOptions {
|
|
6
6
|
readonly baseUrl: string;
|
|
7
7
|
readonly token: string;
|