@tdacorp/hyle-sdk 0.17.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -28
- package/dist/check-routes-bin.js +38 -13
- package/dist/chunk-56Y24XBV.js +840 -0
- package/dist/{chunk-MGSUQBDW.js → chunk-75JFLML4.js} +176 -14
- package/dist/chunk-HJX57NLI.js +1105 -0
- package/dist/chunk-K5VDLROQ.js +145 -0
- package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
- package/dist/chunk-U74B7AUG.js +398 -0
- package/dist/{chunk-6VOHFFA5.js → chunk-X2TLYM7Y.js} +2 -2
- package/dist/client-41fU6OY2.d.cts +201 -0
- package/dist/client-LwzHwqpM.d.ts +201 -0
- package/dist/code-copy.cjs +72 -0
- package/dist/code-copy.d.cts +15 -0
- package/dist/code-copy.d.ts +15 -0
- package/dist/code-copy.js +48 -0
- package/dist/comments.cjs +728 -275
- package/dist/comments.d.cts +66 -3
- package/dist/comments.d.ts +66 -3
- package/dist/comments.js +409 -326
- package/dist/{diagram-viewer-FJPED4SN.js → diagram-viewer-XY3CG75U.js} +62 -21
- package/dist/{embed-BmdwA2G9.d.cts → embed-BUFRQboD.d.ts} +2 -2
- package/dist/{embed-DNTZ2UXv.d.ts → embed-CYt-q13P.d.cts} +2 -2
- package/dist/fragment-alias.cjs +51 -0
- package/dist/fragment-alias.d.cts +7 -0
- package/dist/fragment-alias.d.ts +7 -0
- package/dist/fragment-alias.js +27 -0
- package/dist/html.cjs +881 -0
- package/dist/html.d.cts +20 -0
- package/dist/html.d.ts +20 -0
- package/dist/html.js +45 -0
- package/dist/index.cjs +181 -14
- package/dist/index.d.cts +14 -62
- package/dist/index.d.ts +14 -62
- package/dist/index.js +11 -1
- package/dist/{labels-nmukKYgL.d.ts → labels-CrA-iqTN.d.cts} +9 -0
- package/dist/{labels-nmukKYgL.d.cts → labels-CrA-iqTN.d.ts} +9 -0
- package/dist/mermaid-diagram.cjs +401 -125
- package/dist/mermaid-diagram.d.cts +23 -7
- package/dist/mermaid-diagram.d.ts +23 -7
- package/dist/mermaid-diagram.js +204 -51
- package/dist/mermaid-image.cjs +134 -60
- package/dist/mermaid-image.d.cts +4 -3
- package/dist/mermaid-image.d.ts +4 -3
- package/dist/mermaid-image.js +27 -28
- package/dist/next.cjs +627 -264
- package/dist/next.d.cts +11 -8
- package/dist/next.d.ts +11 -8
- package/dist/next.js +39 -12
- package/dist/print-coordinator.cjs +157 -0
- package/dist/print-coordinator.d.cts +27 -0
- package/dist/print-coordinator.d.ts +27 -0
- package/dist/print-coordinator.js +83 -0
- package/dist/react.cjs +556 -226
- package/dist/react.d.cts +136 -29
- package/dist/react.d.ts +136 -29
- package/dist/react.js +23 -3
- package/dist/reactions.cjs +653 -0
- package/dist/reactions.d.cts +27 -0
- package/dist/reactions.d.ts +27 -0
- package/dist/reactions.js +364 -0
- package/dist/{resolve-Ae7UFjsQ.d.ts → resolve-BjAK0k_Y.d.ts} +2 -2
- package/dist/{resolve-euZ4-aC9.d.cts → resolve-eI1muCKL.d.cts} +2 -2
- package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
- package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
- package/dist/sanitize-ijiWjEm9.d.cts +23 -0
- package/dist/sanitize-ijiWjEm9.d.ts +23 -0
- package/dist/styles.css +96 -25
- package/dist/toc-spy.cjs +59 -0
- package/dist/toc-spy.d.cts +15 -0
- package/dist/toc-spy.d.ts +15 -0
- package/dist/toc-spy.js +35 -0
- package/dist/{types-Czt887Iv.d.cts → types-3F0wqD-o.d.cts} +26 -2
- package/dist/{types-Czt887Iv.d.ts → types-3F0wqD-o.d.ts} +26 -2
- package/dist/use-cache.cjs +37 -11
- package/dist/use-cache.d.cts +12 -5
- package/dist/use-cache.d.ts +12 -5
- package/dist/use-cache.js +7 -7
- package/dist/youtube-facade.cjs +50 -0
- package/dist/youtube-facade.d.cts +17 -0
- package/dist/youtube-facade.d.ts +17 -0
- package/dist/youtube-facade.js +26 -0
- package/package.json +16 -3
- package/dist/chunk-DMK4XQLU.js +0 -1556
- package/dist/chunk-PJMJMP66.js +0 -63
- package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
- package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
package/dist/comments.d.cts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
+
/** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
|
|
4
|
+
type ReactionKind = "like" | "love" | "insightful" | "celebrate";
|
|
5
|
+
/** Reactions on a subject by kind; a kind nobody used is absent. */
|
|
6
|
+
type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
|
|
7
|
+
/** A comment vote: up or down. */
|
|
8
|
+
type VoteValue = 1 | -1;
|
|
3
9
|
/** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
|
|
4
10
|
interface EngageComment {
|
|
5
11
|
readonly id: string;
|
|
@@ -14,10 +20,16 @@ interface EngageComment {
|
|
|
14
20
|
readonly created_at: string;
|
|
15
21
|
readonly edited_at: string | null;
|
|
16
22
|
readonly like_count: number;
|
|
23
|
+
/** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
|
|
24
|
+
readonly score?: number;
|
|
25
|
+
/** Absent from a hyle without reaction kinds. */
|
|
26
|
+
readonly reaction_counts?: ReactionCounts;
|
|
17
27
|
/** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
|
|
18
28
|
readonly removed: boolean;
|
|
19
29
|
/** On a tombstone only: who removed it. Absent on a live comment. */
|
|
20
30
|
readonly removed_by?: "moderator" | "author";
|
|
31
|
+
/** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
|
|
32
|
+
readonly unrenderable?: true;
|
|
21
33
|
readonly body: {
|
|
22
34
|
readonly format: "hast";
|
|
23
35
|
readonly tree: unknown;
|
|
@@ -25,8 +37,12 @@ interface EngageComment {
|
|
|
25
37
|
/** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
|
|
26
38
|
readonly mine?: boolean;
|
|
27
39
|
readonly liked_by_me?: boolean;
|
|
40
|
+
/** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
|
|
41
|
+
readonly my_reactions?: readonly ReactionKind[];
|
|
28
42
|
/** ISO instant until which the reader may edit, or null. */
|
|
29
43
|
readonly can_edit_until?: string | null;
|
|
44
|
+
/** The reader's own vote, or null. Absent from a hyle without votes. */
|
|
45
|
+
readonly my_vote?: VoteValue | null;
|
|
30
46
|
}
|
|
31
47
|
/** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
|
|
32
48
|
interface EngageHeldComment {
|
|
@@ -37,6 +53,8 @@ interface EngageHeldComment {
|
|
|
37
53
|
readonly created_at: string;
|
|
38
54
|
readonly edited_at: string | null;
|
|
39
55
|
readonly can_edit_until: string | null;
|
|
56
|
+
/** As on `EngageComment`. */
|
|
57
|
+
readonly unrenderable?: true;
|
|
40
58
|
readonly body: {
|
|
41
59
|
readonly format: "hast";
|
|
42
60
|
readonly tree: unknown;
|
|
@@ -49,11 +67,17 @@ interface EngageListing {
|
|
|
49
67
|
readonly publication_id: string;
|
|
50
68
|
readonly comment_count: number;
|
|
51
69
|
readonly like_count: number;
|
|
52
|
-
/**
|
|
70
|
+
/** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
|
|
71
|
+
readonly reaction_counts?: ReactionCounts;
|
|
72
|
+
/** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
|
|
53
73
|
readonly truncated: boolean;
|
|
74
|
+
/** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
|
|
75
|
+
readonly next_cursor?: string | null;
|
|
54
76
|
readonly comments: readonly EngageComment[];
|
|
55
77
|
/** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
|
|
56
78
|
readonly liked_by_me?: boolean;
|
|
79
|
+
/** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
|
|
80
|
+
readonly my_reactions?: readonly ReactionKind[];
|
|
57
81
|
readonly mine_held?: readonly EngageHeldComment[];
|
|
58
82
|
}
|
|
59
83
|
|
|
@@ -94,6 +118,7 @@ interface CommentStrings {
|
|
|
94
118
|
readonly removed: string;
|
|
95
119
|
readonly removedByModerator: string;
|
|
96
120
|
readonly removedByAuthor: string;
|
|
121
|
+
readonly unrenderable: string;
|
|
97
122
|
readonly depthEnd: string;
|
|
98
123
|
readonly held: string;
|
|
99
124
|
readonly heldBanner: string;
|
|
@@ -122,10 +147,41 @@ interface CommentStrings {
|
|
|
122
147
|
readonly more: string;
|
|
123
148
|
readonly truncated: string;
|
|
124
149
|
readonly justNow: string;
|
|
150
|
+
readonly react: string;
|
|
151
|
+
readonly reactions: string;
|
|
152
|
+
readonly reactionLike: string;
|
|
153
|
+
readonly reactionLove: string;
|
|
154
|
+
readonly reactionInsightful: string;
|
|
155
|
+
readonly reactionCelebrate: string;
|
|
156
|
+
readonly reactionSignIn: string;
|
|
157
|
+
readonly reactionAddedLive: string;
|
|
158
|
+
readonly reactionRemovedLive: string;
|
|
159
|
+
readonly reactionsLoading: string;
|
|
160
|
+
readonly reactionsError: string;
|
|
161
|
+
readonly votesOn: string;
|
|
162
|
+
readonly score: string;
|
|
163
|
+
readonly upvote: string;
|
|
164
|
+
readonly downvote: string;
|
|
165
|
+
readonly upvoteSignIn: string;
|
|
166
|
+
readonly downvoteSignIn: string;
|
|
167
|
+
readonly upvotedLive: string;
|
|
168
|
+
readonly downvotedLive: string;
|
|
169
|
+
readonly voteRemovedLive: string;
|
|
170
|
+
readonly voteRefused: string;
|
|
171
|
+
readonly slowDown: string;
|
|
172
|
+
readonly sort: string;
|
|
173
|
+
readonly sortNewest: string;
|
|
174
|
+
readonly sortTop: string;
|
|
175
|
+
readonly sortedNewestLive: string;
|
|
176
|
+
readonly sortedTopLive: string;
|
|
177
|
+
readonly sortError: string;
|
|
178
|
+
readonly newerLater: string;
|
|
179
|
+
readonly moreError: string;
|
|
180
|
+
readonly loadedLive: string;
|
|
125
181
|
}
|
|
126
182
|
|
|
127
183
|
/**
|
|
128
|
-
* The comments and
|
|
184
|
+
* The comments, votes and reactions section of an article (ADR 0017, 0021). It is fetched in the browser, uncached, after the cached article
|
|
129
185
|
* has rendered, so a like never purges a page. It talks only to the host's own `createEngagementRoute` (same origin): no
|
|
130
186
|
* credential, no hyle URL and no markup built from text ever reaches this file. Comment bodies are server-rendered hast, turned
|
|
131
187
|
* into React elements by `CommentBody`; the reader's own unapproved comment is shown as plain text.
|
|
@@ -146,7 +202,14 @@ interface CommentsProps {
|
|
|
146
202
|
readonly initial?: EngageListing | undefined;
|
|
147
203
|
/** Epoch milliseconds `initial` was fetched at: the first render's clock, so relative times hydrate identically. The real clock takes over on mount. */
|
|
148
204
|
readonly initialAt?: number | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Fetch nothing until the section is about to scroll into view (within 600px), so a statically cached page costs no request for
|
|
207
|
+
* readers who never get there. Without IntersectionObserver it loads at once. Default false.
|
|
208
|
+
*/
|
|
209
|
+
readonly lazy?: boolean | undefined;
|
|
210
|
+
/** The article's own reactions above the thread. Set false when the page already has `HyleReactions`. Default true. */
|
|
211
|
+
readonly articleReactions?: boolean | undefined;
|
|
149
212
|
}
|
|
150
|
-
declare function Comments(
|
|
213
|
+
declare function Comments(props: CommentsProps): ReactElement;
|
|
151
214
|
|
|
152
215
|
export { Comments, type CommentsProps };
|
package/dist/comments.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
+
/** The reaction kinds hyle accepts. A reader holds at most one of each kind on a subject. */
|
|
4
|
+
type ReactionKind = "like" | "love" | "insightful" | "celebrate";
|
|
5
|
+
/** Reactions on a subject by kind; a kind nobody used is absent. */
|
|
6
|
+
type ReactionCounts = Readonly<Partial<Record<ReactionKind, number>>>;
|
|
7
|
+
/** A comment vote: up or down. */
|
|
8
|
+
type VoteValue = 1 | -1;
|
|
3
9
|
/** One comment of `GET /cp1/engage/comments` (docs/cp1-spec.md section 3.11), in thread order. */
|
|
4
10
|
interface EngageComment {
|
|
5
11
|
readonly id: string;
|
|
@@ -14,10 +20,16 @@ interface EngageComment {
|
|
|
14
20
|
readonly created_at: string;
|
|
15
21
|
readonly edited_at: string | null;
|
|
16
22
|
readonly like_count: number;
|
|
23
|
+
/** Sum of votes (may be negative; 0 on a tombstone). Absent from a hyle without votes. */
|
|
24
|
+
readonly score?: number;
|
|
25
|
+
/** Absent from a hyle without reaction kinds. */
|
|
26
|
+
readonly reaction_counts?: ReactionCounts;
|
|
17
27
|
/** A hidden or deleted comment kept only because a visible reply hangs from it: no body, no author. */
|
|
18
28
|
readonly removed: boolean;
|
|
19
29
|
/** On a tombstone only: who removed it. Absent on a live comment. */
|
|
20
30
|
readonly removed_by?: "moderator" | "author";
|
|
31
|
+
/** A live comment hyle can no longer render: `body` is an empty tree. Absent otherwise, and from an older hyle. */
|
|
32
|
+
readonly unrenderable?: true;
|
|
21
33
|
readonly body: {
|
|
22
34
|
readonly format: "hast";
|
|
23
35
|
readonly tree: unknown;
|
|
@@ -25,8 +37,12 @@ interface EngageComment {
|
|
|
25
37
|
/** Viewer members: present on a live comment only when the listing was fetched for a known reader. */
|
|
26
38
|
readonly mine?: boolean;
|
|
27
39
|
readonly liked_by_me?: boolean;
|
|
40
|
+
/** The reader's own reactions, every kind. Absent from a hyle that only says `liked_by_me`. */
|
|
41
|
+
readonly my_reactions?: readonly ReactionKind[];
|
|
28
42
|
/** ISO instant until which the reader may edit, or null. */
|
|
29
43
|
readonly can_edit_until?: string | null;
|
|
44
|
+
/** The reader's own vote, or null. Absent from a hyle without votes. */
|
|
45
|
+
readonly my_vote?: VoteValue | null;
|
|
30
46
|
}
|
|
31
47
|
/** One of the reader's own held comments (`mine_held`): never part of `comments`, never counted. */
|
|
32
48
|
interface EngageHeldComment {
|
|
@@ -37,6 +53,8 @@ interface EngageHeldComment {
|
|
|
37
53
|
readonly created_at: string;
|
|
38
54
|
readonly edited_at: string | null;
|
|
39
55
|
readonly can_edit_until: string | null;
|
|
56
|
+
/** As on `EngageComment`. */
|
|
57
|
+
readonly unrenderable?: true;
|
|
40
58
|
readonly body: {
|
|
41
59
|
readonly format: "hast";
|
|
42
60
|
readonly tree: unknown;
|
|
@@ -49,11 +67,17 @@ interface EngageListing {
|
|
|
49
67
|
readonly publication_id: string;
|
|
50
68
|
readonly comment_count: number;
|
|
51
69
|
readonly like_count: number;
|
|
52
|
-
/**
|
|
70
|
+
/** Reactions on the article by kind. Absent from a hyle without reaction kinds. */
|
|
71
|
+
readonly reaction_counts?: ReactionCounts;
|
|
72
|
+
/** More comments exist than this page lists. A hyle that pages every comment sets it exactly when `next_cursor` is set. */
|
|
53
73
|
readonly truncated: boolean;
|
|
74
|
+
/** Opaque cursor of the next page, valid with the same sort only. Null or absent when there is none. */
|
|
75
|
+
readonly next_cursor?: string | null;
|
|
54
76
|
readonly comments: readonly EngageComment[];
|
|
55
77
|
/** Viewer members: absent from the public listing (anonymous, banned or unknown reader, or a rate-limited viewer read). */
|
|
56
78
|
readonly liked_by_me?: boolean;
|
|
79
|
+
/** The reader's own reactions on the article. Absent from a hyle that only says `liked_by_me`. */
|
|
80
|
+
readonly my_reactions?: readonly ReactionKind[];
|
|
57
81
|
readonly mine_held?: readonly EngageHeldComment[];
|
|
58
82
|
}
|
|
59
83
|
|
|
@@ -94,6 +118,7 @@ interface CommentStrings {
|
|
|
94
118
|
readonly removed: string;
|
|
95
119
|
readonly removedByModerator: string;
|
|
96
120
|
readonly removedByAuthor: string;
|
|
121
|
+
readonly unrenderable: string;
|
|
97
122
|
readonly depthEnd: string;
|
|
98
123
|
readonly held: string;
|
|
99
124
|
readonly heldBanner: string;
|
|
@@ -122,10 +147,41 @@ interface CommentStrings {
|
|
|
122
147
|
readonly more: string;
|
|
123
148
|
readonly truncated: string;
|
|
124
149
|
readonly justNow: string;
|
|
150
|
+
readonly react: string;
|
|
151
|
+
readonly reactions: string;
|
|
152
|
+
readonly reactionLike: string;
|
|
153
|
+
readonly reactionLove: string;
|
|
154
|
+
readonly reactionInsightful: string;
|
|
155
|
+
readonly reactionCelebrate: string;
|
|
156
|
+
readonly reactionSignIn: string;
|
|
157
|
+
readonly reactionAddedLive: string;
|
|
158
|
+
readonly reactionRemovedLive: string;
|
|
159
|
+
readonly reactionsLoading: string;
|
|
160
|
+
readonly reactionsError: string;
|
|
161
|
+
readonly votesOn: string;
|
|
162
|
+
readonly score: string;
|
|
163
|
+
readonly upvote: string;
|
|
164
|
+
readonly downvote: string;
|
|
165
|
+
readonly upvoteSignIn: string;
|
|
166
|
+
readonly downvoteSignIn: string;
|
|
167
|
+
readonly upvotedLive: string;
|
|
168
|
+
readonly downvotedLive: string;
|
|
169
|
+
readonly voteRemovedLive: string;
|
|
170
|
+
readonly voteRefused: string;
|
|
171
|
+
readonly slowDown: string;
|
|
172
|
+
readonly sort: string;
|
|
173
|
+
readonly sortNewest: string;
|
|
174
|
+
readonly sortTop: string;
|
|
175
|
+
readonly sortedNewestLive: string;
|
|
176
|
+
readonly sortedTopLive: string;
|
|
177
|
+
readonly sortError: string;
|
|
178
|
+
readonly newerLater: string;
|
|
179
|
+
readonly moreError: string;
|
|
180
|
+
readonly loadedLive: string;
|
|
125
181
|
}
|
|
126
182
|
|
|
127
183
|
/**
|
|
128
|
-
* The comments and
|
|
184
|
+
* The comments, votes and reactions section of an article (ADR 0017, 0021). It is fetched in the browser, uncached, after the cached article
|
|
129
185
|
* has rendered, so a like never purges a page. It talks only to the host's own `createEngagementRoute` (same origin): no
|
|
130
186
|
* credential, no hyle URL and no markup built from text ever reaches this file. Comment bodies are server-rendered hast, turned
|
|
131
187
|
* into React elements by `CommentBody`; the reader's own unapproved comment is shown as plain text.
|
|
@@ -146,7 +202,14 @@ interface CommentsProps {
|
|
|
146
202
|
readonly initial?: EngageListing | undefined;
|
|
147
203
|
/** Epoch milliseconds `initial` was fetched at: the first render's clock, so relative times hydrate identically. The real clock takes over on mount. */
|
|
148
204
|
readonly initialAt?: number | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Fetch nothing until the section is about to scroll into view (within 600px), so a statically cached page costs no request for
|
|
207
|
+
* readers who never get there. Without IntersectionObserver it loads at once. Default false.
|
|
208
|
+
*/
|
|
209
|
+
readonly lazy?: boolean | undefined;
|
|
210
|
+
/** The article's own reactions above the thread. Set false when the page already has `HyleReactions`. Default true. */
|
|
211
|
+
readonly articleReactions?: boolean | undefined;
|
|
149
212
|
}
|
|
150
|
-
declare function Comments(
|
|
213
|
+
declare function Comments(props: CommentsProps): ReactElement;
|
|
151
214
|
|
|
152
215
|
export { Comments, type CommentsProps };
|