@the-seeker/changes-react 0.0.0-stage → 0.1.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 (82) hide show
  1. package/README.md +104 -2
  2. package/dist/core/cache.d.ts +14 -0
  3. package/dist/core/cache.js +34 -0
  4. package/dist/core/client.d.ts +161 -0
  5. package/dist/core/client.js +97 -0
  6. package/dist/core/decide.d.ts +16 -0
  7. package/dist/core/decide.js +57 -0
  8. package/dist/core/rating.d.ts +7 -0
  9. package/dist/core/rating.js +18 -0
  10. package/dist/core/storage.d.ts +20 -0
  11. package/dist/core/storage.js +73 -0
  12. package/dist/core/types.d.ts +332 -0
  13. package/dist/core/types.js +126 -0
  14. package/dist/core/versions.d.ts +2 -0
  15. package/dist/core/versions.js +20 -0
  16. package/dist/index.d.ts +24 -0
  17. package/dist/index.js +47 -0
  18. package/dist/web/Blocks.d.ts +5 -0
  19. package/dist/web/Blocks.js +42 -0
  20. package/dist/web/ChangelogButton.d.ts +5 -0
  21. package/dist/web/ChangelogButton.js +17 -0
  22. package/dist/web/ChangelogDialog.d.ts +2 -0
  23. package/dist/web/ChangelogDialog.js +19 -0
  24. package/dist/web/ChangelogList.d.ts +2 -0
  25. package/dist/web/ChangelogList.js +32 -0
  26. package/dist/web/CommentComposer.d.ts +9 -0
  27. package/dist/web/CommentComposer.js +47 -0
  28. package/dist/web/CommentItem.d.ts +11 -0
  29. package/dist/web/CommentItem.js +23 -0
  30. package/dist/web/CommentsThread.d.ts +4 -0
  31. package/dist/web/CommentsThread.js +15 -0
  32. package/dist/web/DialogShell.d.ts +11 -0
  33. package/dist/web/DialogShell.js +36 -0
  34. package/dist/web/Provider.d.ts +24 -0
  35. package/dist/web/Provider.js +109 -0
  36. package/dist/web/ReleaseCard.d.ts +5 -0
  37. package/dist/web/ReleaseCard.js +23 -0
  38. package/dist/web/ReleaseEngagement.d.ts +5 -0
  39. package/dist/web/ReleaseEngagement.js +24 -0
  40. package/dist/web/ReleaseSummary.d.ts +8 -0
  41. package/dist/web/ReleaseSummary.js +15 -0
  42. package/dist/web/ReportMenu.d.ts +4 -0
  43. package/dist/web/ReportMenu.js +79 -0
  44. package/dist/web/VoteCapsule.d.ts +9 -0
  45. package/dist/web/VoteCapsule.js +12 -0
  46. package/dist/web/WhatsNewModal.d.ts +2 -0
  47. package/dist/web/WhatsNewModal.js +26 -0
  48. package/dist/web/context.d.ts +82 -0
  49. package/dist/web/context.js +5 -0
  50. package/dist/web/controls-css.d.ts +1 -0
  51. package/dist/web/controls-css.js +48 -0
  52. package/dist/web/focus-trap.d.ts +7 -0
  53. package/dist/web/focus-trap.js +69 -0
  54. package/dist/web/icons.d.ts +17 -0
  55. package/dist/web/icons.js +29 -0
  56. package/dist/web/links.d.ts +11 -0
  57. package/dist/web/links.js +45 -0
  58. package/dist/web/load.d.ts +35 -0
  59. package/dist/web/load.js +61 -0
  60. package/dist/web/local-store.d.ts +7 -0
  61. package/dist/web/local-store.js +27 -0
  62. package/dist/web/model.d.ts +36 -0
  63. package/dist/web/model.js +37 -0
  64. package/dist/web/storage.d.ts +7 -0
  65. package/dist/web/storage.js +53 -0
  66. package/dist/web/styles.d.ts +273 -0
  67. package/dist/web/styles.js +201 -0
  68. package/dist/web/texts-defaults.d.ts +115 -0
  69. package/dist/web/texts-defaults.js +117 -0
  70. package/dist/web/texts.d.ts +9 -0
  71. package/dist/web/texts.js +49 -0
  72. package/dist/web/theme.d.ts +6 -0
  73. package/dist/web/theme.js +82 -0
  74. package/dist/web/use-actions.d.ts +10 -0
  75. package/dist/web/use-actions.js +114 -0
  76. package/dist/web/use-comments-api.d.ts +5 -0
  77. package/dist/web/use-comments-api.js +75 -0
  78. package/dist/web/use-thread.d.ts +23 -0
  79. package/dist/web/use-thread.js +82 -0
  80. package/dist/web/useChanges.d.ts +5 -0
  81. package/dist/web/useChanges.js +19 -0
  82. package/package.json +33 -3
@@ -0,0 +1,332 @@
1
+ import { z } from "zod";
2
+ export declare const platformSchema: z.ZodEnum<{
3
+ web: "web";
4
+ ios: "ios";
5
+ android: "android";
6
+ }>;
7
+ export type Platform = z.infer<typeof platformSchema>;
8
+ export declare const inlineSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
9
+ t: z.ZodEnum<{
10
+ text: "text";
11
+ strong: "strong";
12
+ code: "code";
13
+ }>;
14
+ v: z.ZodString;
15
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
16
+ t: z.ZodLiteral<"link">;
17
+ v: z.ZodString;
18
+ href: z.ZodString;
19
+ }, z.core.$strip>>]>;
20
+ export declare const blockSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
21
+ t: z.ZodEnum<{
22
+ p: "p";
23
+ h: "h";
24
+ }>;
25
+ c: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
26
+ t: z.ZodEnum<{
27
+ text: "text";
28
+ strong: "strong";
29
+ code: "code";
30
+ }>;
31
+ v: z.ZodString;
32
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
33
+ t: z.ZodLiteral<"link">;
34
+ v: z.ZodString;
35
+ href: z.ZodString;
36
+ }, z.core.$strip>>]>>>;
37
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
38
+ t: z.ZodLiteral<"ul">;
39
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
40
+ t: z.ZodEnum<{
41
+ text: "text";
42
+ strong: "strong";
43
+ code: "code";
44
+ }>;
45
+ v: z.ZodString;
46
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
47
+ t: z.ZodLiteral<"link">;
48
+ v: z.ZodString;
49
+ href: z.ZodString;
50
+ }, z.core.$strip>>]>>>>>;
51
+ }, z.core.$strip>>]>;
52
+ export type Inline = z.infer<typeof inlineSchema>;
53
+ export type Block = z.infer<typeof blockSchema>;
54
+ export declare const voteSchema: z.ZodReadonly<z.ZodObject<{
55
+ upvotes: z.ZodNumber;
56
+ downvotes: z.ZodNumber;
57
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
58
+ }, z.core.$strip>>;
59
+ export declare const releaseSchema: z.ZodReadonly<z.ZodObject<{
60
+ commentCount: z.ZodNumber;
61
+ upvotes: z.ZodNumber;
62
+ downvotes: z.ZodNumber;
63
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
64
+ id: z.ZodString;
65
+ version: z.ZodNullable<z.ZodString>;
66
+ ref: z.ZodString;
67
+ title: z.ZodString;
68
+ body: z.ZodString;
69
+ blocks: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
70
+ t: z.ZodEnum<{
71
+ p: "p";
72
+ h: "h";
73
+ }>;
74
+ c: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
75
+ t: z.ZodEnum<{
76
+ text: "text";
77
+ strong: "strong";
78
+ code: "code";
79
+ }>;
80
+ v: z.ZodString;
81
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
82
+ t: z.ZodLiteral<"link">;
83
+ v: z.ZodString;
84
+ href: z.ZodString;
85
+ }, z.core.$strip>>]>>>;
86
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
87
+ t: z.ZodLiteral<"ul">;
88
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
89
+ t: z.ZodEnum<{
90
+ text: "text";
91
+ strong: "strong";
92
+ code: "code";
93
+ }>;
94
+ v: z.ZodString;
95
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
96
+ t: z.ZodLiteral<"link">;
97
+ v: z.ZodString;
98
+ href: z.ZodString;
99
+ }, z.core.$strip>>]>>>>>;
100
+ }, z.core.$strip>>]>>>;
101
+ tags: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
102
+ new: "new";
103
+ improved: "improved";
104
+ fixed: "fixed";
105
+ security: "security";
106
+ deprecated: "deprecated";
107
+ }>>>;
108
+ platforms: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
109
+ web: "web";
110
+ ios: "ios";
111
+ android: "android";
112
+ }>>>;
113
+ source: z.ZodEnum<{
114
+ manual: "manual";
115
+ app_store: "app_store";
116
+ }>;
117
+ publishedAt: z.ZodString;
118
+ }, z.core.$strip>>;
119
+ export declare const releasesSchema: z.ZodReadonly<z.ZodObject<{
120
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
121
+ commentCount: z.ZodNumber;
122
+ upvotes: z.ZodNumber;
123
+ downvotes: z.ZodNumber;
124
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
125
+ id: z.ZodString;
126
+ version: z.ZodNullable<z.ZodString>;
127
+ ref: z.ZodString;
128
+ title: z.ZodString;
129
+ body: z.ZodString;
130
+ blocks: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
131
+ t: z.ZodEnum<{
132
+ p: "p";
133
+ h: "h";
134
+ }>;
135
+ c: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
136
+ t: z.ZodEnum<{
137
+ text: "text";
138
+ strong: "strong";
139
+ code: "code";
140
+ }>;
141
+ v: z.ZodString;
142
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
143
+ t: z.ZodLiteral<"link">;
144
+ v: z.ZodString;
145
+ href: z.ZodString;
146
+ }, z.core.$strip>>]>>>;
147
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
148
+ t: z.ZodLiteral<"ul">;
149
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
150
+ t: z.ZodEnum<{
151
+ text: "text";
152
+ strong: "strong";
153
+ code: "code";
154
+ }>;
155
+ v: z.ZodString;
156
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
157
+ t: z.ZodLiteral<"link">;
158
+ v: z.ZodString;
159
+ href: z.ZodString;
160
+ }, z.core.$strip>>]>>>>>;
161
+ }, z.core.$strip>>]>>>;
162
+ tags: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
163
+ new: "new";
164
+ improved: "improved";
165
+ fixed: "fixed";
166
+ security: "security";
167
+ deprecated: "deprecated";
168
+ }>>>;
169
+ platforms: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
170
+ web: "web";
171
+ ios: "ios";
172
+ android: "android";
173
+ }>>>;
174
+ source: z.ZodEnum<{
175
+ manual: "manual";
176
+ app_store: "app_store";
177
+ }>;
178
+ publishedAt: z.ZodString;
179
+ }, z.core.$strip>>>>;
180
+ nextCursor: z.ZodNullable<z.ZodString>;
181
+ }, z.core.$strip>>;
182
+ export type Release = z.infer<typeof releaseSchema>;
183
+ export type Releases = z.infer<typeof releasesSchema>;
184
+ export declare const configSchema: z.ZodReadonly<z.ZodObject<{
185
+ enabled: z.ZodBoolean;
186
+ defaultLocale: z.ZodEnum<{
187
+ ko: "ko";
188
+ en: "en";
189
+ }>;
190
+ app: z.ZodReadonly<z.ZodObject<{
191
+ name: z.ZodString;
192
+ subtitle: z.ZodNullable<z.ZodString>;
193
+ description: z.ZodNullable<z.ZodString>;
194
+ iconUrl: z.ZodNullable<z.ZodString>;
195
+ websiteUrl: z.ZodNullable<z.ZodString>;
196
+ accentColor: z.ZodString;
197
+ contactEmail: z.ZodNullable<z.ZodString>;
198
+ appStoreUrl: z.ZodNullable<z.ZodString>;
199
+ playStoreUrl: z.ZodNullable<z.ZodString>;
200
+ }, z.core.$strip>>;
201
+ page: z.ZodReadonly<z.ZodObject<{
202
+ enabled: z.ZodBoolean;
203
+ url: z.ZodString;
204
+ }, z.core.$strip>>;
205
+ community: z.ZodReadonly<z.ZodObject<{
206
+ votesEnabled: z.ZodBoolean;
207
+ commentsEnabled: z.ZodBoolean;
208
+ requireGuidelinesAck: z.ZodBoolean;
209
+ allowAuthorNames: z.ZodBoolean;
210
+ }, z.core.$strip>>;
211
+ rating: z.ZodReadonly<z.ZodObject<{
212
+ mode: z.ZodEnum<{
213
+ off: "off";
214
+ always: "always";
215
+ after_upvote: "after_upvote";
216
+ }>;
217
+ iosAppStoreId: z.ZodNullable<z.ZodString>;
218
+ androidPackage: z.ZodNullable<z.ZodString>;
219
+ reviewUrl: z.ZodNullable<z.ZodString>;
220
+ }, z.core.$strip>>;
221
+ texts: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>>;
222
+ }, z.core.$strip>>;
223
+ export type Config = z.infer<typeof configSchema>;
224
+ export declare const commentSchema: z.ZodReadonly<z.ZodObject<{
225
+ upvotes: z.ZodNumber;
226
+ downvotes: z.ZodNumber;
227
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
228
+ id: z.ZodString;
229
+ authorName: z.ZodString;
230
+ isDeveloper: z.ZodBoolean;
231
+ body: z.ZodString;
232
+ createdAt: z.ZodString;
233
+ }, z.core.$strip>>;
234
+ export declare const threadSchema: z.ZodReadonly<z.ZodObject<{
235
+ upvotes: z.ZodNumber;
236
+ downvotes: z.ZodNumber;
237
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
238
+ id: z.ZodString;
239
+ authorName: z.ZodString;
240
+ isDeveloper: z.ZodBoolean;
241
+ body: z.ZodString;
242
+ createdAt: z.ZodString;
243
+ replies: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
244
+ upvotes: z.ZodNumber;
245
+ downvotes: z.ZodNumber;
246
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
247
+ id: z.ZodString;
248
+ authorName: z.ZodString;
249
+ isDeveloper: z.ZodBoolean;
250
+ body: z.ZodString;
251
+ createdAt: z.ZodString;
252
+ }, z.core.$strip>>>>;
253
+ }, z.core.$strip>>;
254
+ export declare const commentsSchema: z.ZodReadonly<z.ZodObject<{
255
+ items: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
256
+ upvotes: z.ZodNumber;
257
+ downvotes: z.ZodNumber;
258
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
259
+ id: z.ZodString;
260
+ authorName: z.ZodString;
261
+ isDeveloper: z.ZodBoolean;
262
+ body: z.ZodString;
263
+ createdAt: z.ZodString;
264
+ replies: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
265
+ upvotes: z.ZodNumber;
266
+ downvotes: z.ZodNumber;
267
+ myVote: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>, z.ZodLiteral<0>]>;
268
+ id: z.ZodString;
269
+ authorName: z.ZodString;
270
+ isDeveloper: z.ZodBoolean;
271
+ body: z.ZodString;
272
+ createdAt: z.ZodString;
273
+ }, z.core.$strip>>>>;
274
+ }, z.core.$strip>>>>;
275
+ nextCursor: z.ZodNullable<z.ZodString>;
276
+ total: z.ZodNumber;
277
+ }, z.core.$strip>>;
278
+ export type Comment = z.infer<typeof threadSchema>;
279
+ export type CommentReply = z.infer<typeof commentSchema>;
280
+ export declare const errorCodeSchema: z.ZodEnum<{
281
+ BAD_REQUEST: "BAD_REQUEST";
282
+ VALIDATION_ERROR: "VALIDATION_ERROR";
283
+ PAYLOAD_TOO_LARGE: "PAYLOAD_TOO_LARGE";
284
+ RATE_LIMITED: "RATE_LIMITED";
285
+ ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
286
+ APP_NOT_ALLOWED: "APP_NOT_ALLOWED";
287
+ CHANGES_NOT_FOUND: "CHANGES_NOT_FOUND";
288
+ RELEASE_NOT_FOUND: "RELEASE_NOT_FOUND";
289
+ COMMENT_NOT_FOUND: "COMMENT_NOT_FOUND";
290
+ PROPERTY_NOT_FOUND: "PROPERTY_NOT_FOUND";
291
+ VOTES_DISABLED: "VOTES_DISABLED";
292
+ COMMENTS_DISABLED: "COMMENTS_DISABLED";
293
+ BANNED: "BANNED";
294
+ GUIDELINES_REQUIRED: "GUIDELINES_REQUIRED";
295
+ NETWORK_ERROR: "NETWORK_ERROR";
296
+ HTTP_ERROR: "HTTP_ERROR";
297
+ INVALID_RESPONSE: "INVALID_RESPONSE";
298
+ }>;
299
+ export type ErrorCode = z.infer<typeof errorCodeSchema>;
300
+ export type Failure = Readonly<{
301
+ ok: false;
302
+ code: ErrorCode;
303
+ }>;
304
+ export type Result<T> = Readonly<{
305
+ ok: true;
306
+ body: T;
307
+ }> | Failure;
308
+ export type Voter = Readonly<{
309
+ installId: string;
310
+ userId?: string;
311
+ name?: string;
312
+ }>;
313
+ export type User = Readonly<{
314
+ userId?: string;
315
+ name?: string;
316
+ }>;
317
+ export type ClientInfo = Readonly<{
318
+ platform: Platform;
319
+ osVersion?: string;
320
+ appVersion?: string;
321
+ deviceModel?: string;
322
+ deviceType?: string;
323
+ }>;
324
+ export declare const stateSchema: z.ZodReadonly<z.ZodObject<{
325
+ v: z.ZodLiteral<1>;
326
+ lastVersion: z.ZodNullable<z.ZodString>;
327
+ baselineReleaseId: z.ZodNullable<z.ZodString>;
328
+ presentedIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
329
+ firstSeenAt: z.ZodString;
330
+ listOpenedAt: z.ZodNullable<z.ZodString>;
331
+ }, z.core.$strip>>;
332
+ export type ChangesState = z.infer<typeof stateSchema>;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stateSchema = exports.errorCodeSchema = exports.commentsSchema = exports.threadSchema = exports.commentSchema = exports.configSchema = exports.releasesSchema = exports.releaseSchema = exports.voteSchema = exports.blockSchema = exports.inlineSchema = exports.platformSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.platformSchema = zod_1.z.enum(["web", "ios", "android"]);
6
+ exports.inlineSchema = zod_1.z.union([
7
+ zod_1.z.object({ t: zod_1.z.enum(["text", "strong", "code"]), v: zod_1.z.string() }).readonly(),
8
+ zod_1.z.object({ t: zod_1.z.literal("link"), v: zod_1.z.string(), href: zod_1.z.string().url().startsWith("https://") }).readonly(),
9
+ ]);
10
+ exports.blockSchema = zod_1.z.union([
11
+ zod_1.z.object({ t: zod_1.z.enum(["p", "h"]), c: zod_1.z.array(exports.inlineSchema).readonly() }).readonly(),
12
+ zod_1.z.object({ t: zod_1.z.literal("ul"), items: zod_1.z.array(zod_1.z.array(exports.inlineSchema).readonly()).readonly() }).readonly(),
13
+ ]);
14
+ exports.voteSchema = zod_1.z
15
+ .object({
16
+ upvotes: zod_1.z.number().int().nonnegative(),
17
+ downvotes: zod_1.z.number().int().nonnegative(),
18
+ myVote: zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(-1), zod_1.z.literal(0)]),
19
+ })
20
+ .readonly();
21
+ exports.releaseSchema = zod_1.z
22
+ .object({
23
+ id: zod_1.z.string(),
24
+ version: zod_1.z.string().nullable(),
25
+ ref: zod_1.z.string(),
26
+ title: zod_1.z.string(),
27
+ body: zod_1.z.string(),
28
+ blocks: zod_1.z.array(exports.blockSchema).max(200).readonly(),
29
+ tags: zod_1.z.array(zod_1.z.enum(["new", "improved", "fixed", "security", "deprecated"])).readonly(),
30
+ platforms: zod_1.z.array(exports.platformSchema).readonly(),
31
+ source: zod_1.z.enum(["manual", "app_store"]),
32
+ publishedAt: zod_1.z.string().datetime(),
33
+ ...exports.voteSchema.unwrap().shape,
34
+ commentCount: zod_1.z.number().int().nonnegative(),
35
+ })
36
+ .readonly();
37
+ exports.releasesSchema = zod_1.z
38
+ .object({ items: zod_1.z.array(exports.releaseSchema).readonly(), nextCursor: zod_1.z.string().nullable() })
39
+ .readonly();
40
+ exports.configSchema = zod_1.z
41
+ .object({
42
+ enabled: zod_1.z.boolean(),
43
+ defaultLocale: zod_1.z.enum(["ko", "en"]),
44
+ app: zod_1.z
45
+ .object({
46
+ name: zod_1.z.string(),
47
+ subtitle: zod_1.z.string().nullable(),
48
+ description: zod_1.z.string().nullable(),
49
+ iconUrl: zod_1.z.string().nullable(),
50
+ websiteUrl: zod_1.z.string().nullable(),
51
+ accentColor: zod_1.z.string(),
52
+ contactEmail: zod_1.z.string().nullable(),
53
+ appStoreUrl: zod_1.z.string().nullable(),
54
+ playStoreUrl: zod_1.z.string().nullable(),
55
+ })
56
+ .readonly(),
57
+ page: zod_1.z.object({ enabled: zod_1.z.boolean(), url: zod_1.z.string() }).readonly(),
58
+ community: zod_1.z
59
+ .object({
60
+ votesEnabled: zod_1.z.boolean(),
61
+ commentsEnabled: zod_1.z.boolean(),
62
+ requireGuidelinesAck: zod_1.z.boolean(),
63
+ allowAuthorNames: zod_1.z.boolean(),
64
+ })
65
+ .readonly(),
66
+ rating: zod_1.z
67
+ .object({
68
+ mode: zod_1.z.enum(["off", "always", "after_upvote"]),
69
+ iosAppStoreId: zod_1.z.string().nullable(),
70
+ androidPackage: zod_1.z.string().nullable(),
71
+ reviewUrl: zod_1.z.string().nullable(),
72
+ })
73
+ .readonly(),
74
+ texts: zod_1.z.record(zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.string()).readonly()).readonly(),
75
+ })
76
+ .readonly();
77
+ exports.commentSchema = zod_1.z
78
+ .object({
79
+ id: zod_1.z.string(),
80
+ authorName: zod_1.z.string(),
81
+ isDeveloper: zod_1.z.boolean(),
82
+ body: zod_1.z.string(),
83
+ createdAt: zod_1.z.string().datetime(),
84
+ ...exports.voteSchema.unwrap().shape,
85
+ })
86
+ .readonly();
87
+ exports.threadSchema = exports.commentSchema
88
+ .unwrap()
89
+ .extend({ replies: zod_1.z.array(exports.commentSchema).max(50).readonly() })
90
+ .readonly();
91
+ exports.commentsSchema = zod_1.z
92
+ .object({
93
+ items: zod_1.z.array(exports.threadSchema).readonly(),
94
+ nextCursor: zod_1.z.string().nullable(),
95
+ total: zod_1.z.number().int().nonnegative(),
96
+ })
97
+ .readonly();
98
+ exports.errorCodeSchema = zod_1.z.enum([
99
+ "BAD_REQUEST",
100
+ "VALIDATION_ERROR",
101
+ "PAYLOAD_TOO_LARGE",
102
+ "RATE_LIMITED",
103
+ "ORIGIN_NOT_ALLOWED",
104
+ "APP_NOT_ALLOWED",
105
+ "CHANGES_NOT_FOUND",
106
+ "RELEASE_NOT_FOUND",
107
+ "COMMENT_NOT_FOUND",
108
+ "PROPERTY_NOT_FOUND",
109
+ "VOTES_DISABLED",
110
+ "COMMENTS_DISABLED",
111
+ "BANNED",
112
+ "GUIDELINES_REQUIRED",
113
+ "NETWORK_ERROR",
114
+ "HTTP_ERROR",
115
+ "INVALID_RESPONSE",
116
+ ]);
117
+ exports.stateSchema = zod_1.z
118
+ .object({
119
+ v: zod_1.z.literal(1),
120
+ lastVersion: zod_1.z.string().nullable(),
121
+ baselineReleaseId: zod_1.z.string().nullable(),
122
+ presentedIds: zod_1.z.array(zod_1.z.string()).max(50).readonly(),
123
+ firstSeenAt: zod_1.z.string().datetime(),
124
+ listOpenedAt: zod_1.z.string().datetime().nullable(),
125
+ })
126
+ .readonly();
@@ -0,0 +1,2 @@
1
+ export declare function versionKey(version: string): string | null;
2
+ export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.versionKey = versionKey;
4
+ exports.compareVersions = compareVersions;
5
+ function versionKey(version) {
6
+ const lead = /^\d+(?:\.\d+)*/.exec(version)?.[0];
7
+ if (!lead)
8
+ return null;
9
+ const parts = lead.split(".").slice(0, 4);
10
+ if (parts.some((part) => Number(part) > 999999))
11
+ return null;
12
+ return Array.from({ length: 4 }, (_, index) => String(Number(parts[index] ?? 0)).padStart(6, "0")).join("");
13
+ }
14
+ function compareVersions(a, b) {
15
+ const aKey = versionKey(a);
16
+ const bKey = versionKey(b);
17
+ const left = aKey !== null && bKey !== null ? aKey : a;
18
+ const right = aKey !== null && bKey !== null ? bKey : b;
19
+ return left === right ? 0 : left < right ? -1 : 1;
20
+ }
@@ -0,0 +1,24 @@
1
+ export * from "./core/types";
2
+ export * from "./core/client";
3
+ export * from "./core/storage";
4
+ export * from "./core/decide";
5
+ export * from "./core/cache";
6
+ export * from "./core/versions";
7
+ export * from "./core/rating";
8
+ export { ChangesProvider } from "./web/Provider";
9
+ export type { ChangesProviderProps } from "./web/Provider";
10
+ export { useChanges, ChangesProviderMissingError } from "./web/useChanges";
11
+ export type { ChangesContextValue, CommentsApi, CommentsPage, FeedbackRequest, PostCommentInput, ReportReason, VoteResult, VoteValue, } from "./web/context";
12
+ export type { ChangesStatus } from "./web/model";
13
+ export { WhatsNewModal } from "./web/WhatsNewModal";
14
+ export { ChangelogButton } from "./web/ChangelogButton";
15
+ export type { ChangelogButtonProps } from "./web/ChangelogButton";
16
+ export { ChangelogList } from "./web/ChangelogList";
17
+ export { ChangelogDialog } from "./web/ChangelogDialog";
18
+ export { ReleaseCard } from "./web/ReleaseCard";
19
+ export { CommentsThread } from "./web/CommentsThread";
20
+ export { Blocks } from "./web/Blocks";
21
+ export { localStorageAdapter } from "./web/storage";
22
+ export { DEFAULT_TEXTS } from "./web/texts-defaults";
23
+ export type { Locale, LocalePreference, TextKey, Texts } from "./web/texts";
24
+ export type { ColorScheme } from "./web/theme";
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.DEFAULT_TEXTS = exports.localStorageAdapter = exports.Blocks = exports.CommentsThread = exports.ReleaseCard = exports.ChangelogDialog = exports.ChangelogList = exports.ChangelogButton = exports.WhatsNewModal = exports.ChangesProviderMissingError = exports.useChanges = exports.ChangesProvider = void 0;
18
+ __exportStar(require("./core/types"), exports);
19
+ __exportStar(require("./core/client"), exports);
20
+ __exportStar(require("./core/storage"), exports);
21
+ __exportStar(require("./core/decide"), exports);
22
+ __exportStar(require("./core/cache"), exports);
23
+ __exportStar(require("./core/versions"), exports);
24
+ __exportStar(require("./core/rating"), exports);
25
+ var Provider_1 = require("./web/Provider");
26
+ Object.defineProperty(exports, "ChangesProvider", { enumerable: true, get: function () { return Provider_1.ChangesProvider; } });
27
+ var useChanges_1 = require("./web/useChanges");
28
+ Object.defineProperty(exports, "useChanges", { enumerable: true, get: function () { return useChanges_1.useChanges; } });
29
+ Object.defineProperty(exports, "ChangesProviderMissingError", { enumerable: true, get: function () { return useChanges_1.ChangesProviderMissingError; } });
30
+ var WhatsNewModal_1 = require("./web/WhatsNewModal");
31
+ Object.defineProperty(exports, "WhatsNewModal", { enumerable: true, get: function () { return WhatsNewModal_1.WhatsNewModal; } });
32
+ var ChangelogButton_1 = require("./web/ChangelogButton");
33
+ Object.defineProperty(exports, "ChangelogButton", { enumerable: true, get: function () { return ChangelogButton_1.ChangelogButton; } });
34
+ var ChangelogList_1 = require("./web/ChangelogList");
35
+ Object.defineProperty(exports, "ChangelogList", { enumerable: true, get: function () { return ChangelogList_1.ChangelogList; } });
36
+ var ChangelogDialog_1 = require("./web/ChangelogDialog");
37
+ Object.defineProperty(exports, "ChangelogDialog", { enumerable: true, get: function () { return ChangelogDialog_1.ChangelogDialog; } });
38
+ var ReleaseCard_1 = require("./web/ReleaseCard");
39
+ Object.defineProperty(exports, "ReleaseCard", { enumerable: true, get: function () { return ReleaseCard_1.ReleaseCard; } });
40
+ var CommentsThread_1 = require("./web/CommentsThread");
41
+ Object.defineProperty(exports, "CommentsThread", { enumerable: true, get: function () { return CommentsThread_1.CommentsThread; } });
42
+ var Blocks_1 = require("./web/Blocks");
43
+ Object.defineProperty(exports, "Blocks", { enumerable: true, get: function () { return Blocks_1.Blocks; } });
44
+ var storage_1 = require("./web/storage");
45
+ Object.defineProperty(exports, "localStorageAdapter", { enumerable: true, get: function () { return storage_1.localStorageAdapter; } });
46
+ var texts_defaults_1 = require("./web/texts-defaults");
47
+ Object.defineProperty(exports, "DEFAULT_TEXTS", { enumerable: true, get: function () { return texts_defaults_1.DEFAULT_TEXTS; } });
@@ -0,0 +1,5 @@
1
+ import type { Block } from "../core/types";
2
+ /** Renders the server's markdown-lite AST as React elements; no HTML string is ever interpreted. */
3
+ export declare function Blocks({ blocks }: Readonly<{
4
+ blocks: readonly Block[];
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Blocks = Blocks;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const styles_1 = require("./styles");
6
+ function Inlines({ items }) {
7
+ return items.map((inline, index) => {
8
+ const key = `${index}-${inline.t}`;
9
+ switch (inline.t) {
10
+ case "text":
11
+ return (0, jsx_runtime_1.jsx)("span", { children: inline.v }, key);
12
+ case "strong":
13
+ return ((0, jsx_runtime_1.jsx)("strong", { style: { fontWeight: 600 }, children: inline.v }, key));
14
+ case "code":
15
+ return ((0, jsx_runtime_1.jsx)("code", { style: styles_1.text.code, children: inline.v }, key));
16
+ case "link":
17
+ return ((0, jsx_runtime_1.jsx)("a", { href: inline.href, target: "_blank", rel: "noopener noreferrer", "data-tsc-link": "", children: inline.v }, key));
18
+ default: {
19
+ const exhaustive = inline;
20
+ return exhaustive;
21
+ }
22
+ }
23
+ });
24
+ }
25
+ /** Renders the server's markdown-lite AST as React elements; no HTML string is ever interpreted. */
26
+ function Blocks({ blocks }) {
27
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles_1.layout.stack12, children: blocks.map((block, index) => {
28
+ const key = `${index}-${block.t}`;
29
+ switch (block.t) {
30
+ case "p":
31
+ return ((0, jsx_runtime_1.jsx)("p", { style: styles_1.text.body, children: (0, jsx_runtime_1.jsx)(Inlines, { items: block.c }) }, key));
32
+ case "h":
33
+ return ((0, jsx_runtime_1.jsx)("h4", { style: styles_1.text.blockHeading, children: (0, jsx_runtime_1.jsx)(Inlines, { items: block.c }) }, key));
34
+ case "ul":
35
+ return ((0, jsx_runtime_1.jsx)("ul", { style: { ...styles_1.layout.bullets, ...styles_1.text.body }, children: block.items.map((item, itemIndex) => ((0, jsx_runtime_1.jsx)("li", { style: { paddingInlineStart: 2 }, children: (0, jsx_runtime_1.jsx)(Inlines, { items: item }) }, `${key}-${itemIndex}`))) }, key));
36
+ default: {
37
+ const exhaustive = block;
38
+ return exhaustive;
39
+ }
40
+ }
41
+ }) }));
42
+ }
@@ -0,0 +1,5 @@
1
+ export type ChangelogButtonProps = Readonly<{
2
+ label?: string;
3
+ }>;
4
+ /** Opens the changelog dialog; the badge counts releases published since the list was last opened. */
5
+ export declare function ChangelogButton({ label }: ChangelogButtonProps): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangelogButton = ChangelogButton;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const icons_1 = require("./icons");
6
+ const styles_1 = require("./styles");
7
+ const texts_1 = require("./texts");
8
+ const useChanges_1 = require("./useChanges");
9
+ /** Opens the changelog dialog; the badge counts releases published since the list was last opened. */
10
+ function ChangelogButton({ label }) {
11
+ const { status, unseenCount, openChangelog, texts, rootProps } = (0, useChanges_1.useChanges)();
12
+ if (status === "disabled")
13
+ return null;
14
+ const name = label ?? texts.title;
15
+ const accessibleName = unseenCount > 0 ? `${name}, ${(0, texts_1.fillCount)(texts.unreadCount, unseenCount)}` : name;
16
+ return ((0, jsx_runtime_1.jsxs)("button", { ...rootProps, type: "button", "data-tsc-btn": "secondary", "data-tsc-changelog": "", "aria-haspopup": "dialog", "aria-label": accessibleName, onClick: openChangelog, children: [(0, jsx_runtime_1.jsx)(icons_1.Megaphone, { size: 18 }), (0, jsx_runtime_1.jsx)("span", { children: name }), unseenCount > 0 ? ((0, jsx_runtime_1.jsx)("span", { "data-tsc-badge": "", "aria-hidden": "true", style: styles_1.surface.badge, children: unseenCount > 99 ? "99+" : unseenCount })) : null] }));
17
+ }
@@ -0,0 +1,2 @@
1
+ /** The full changelog, opened by `openChangelog()` (ChangelogButton or a custom settings row). */
2
+ export declare function ChangelogDialog(): import("react").JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangelogDialog = ChangelogDialog;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const ChangelogList_1 = require("./ChangelogList");
7
+ const icons_1 = require("./icons");
8
+ const styles_1 = require("./styles");
9
+ const DialogShell_1 = require("./DialogShell");
10
+ const useChanges_1 = require("./useChanges");
11
+ /** The full changelog, opened by `openChangelog()` (ChangelogButton or a custom settings row). */
12
+ function ChangelogDialog() {
13
+ const { changelogOpen, closeChangelog, texts, config } = (0, useChanges_1.useChanges)();
14
+ const titleId = (0, react_1.useId)();
15
+ if (!changelogOpen)
16
+ return null;
17
+ const pageUrl = config?.page.enabled && config.page.url.startsWith("https://") ? config.page.url : null;
18
+ return ((0, jsx_runtime_1.jsx)(DialogShell_1.DialogShell, { labelledBy: titleId, size: "wide", onClose: closeChangelog, header: (0, jsx_runtime_1.jsxs)("div", { style: styles_1.layout.stack4, children: [(0, jsx_runtime_1.jsx)("h2", { id: titleId, style: styles_1.text.cardTitle, children: texts.title }), (0, jsx_runtime_1.jsx)("p", { style: styles_1.text.meta, children: config?.app.name ?? texts.subtitle })] }), footer: pageUrl ? ((0, jsx_runtime_1.jsxs)("a", { href: pageUrl, target: "_blank", rel: "noopener noreferrer", "data-tsc-btn": "secondary", style: { width: "100%" }, children: [texts.viewAll, (0, jsx_runtime_1.jsx)(icons_1.ArrowUpRight, { size: 16 })] })) : undefined, children: (0, jsx_runtime_1.jsx)("div", { style: { paddingTop: 12 }, children: (0, jsx_runtime_1.jsx)(ChangelogList_1.ChangelogList, {}) }) }));
19
+ }
@@ -0,0 +1,2 @@
1
+ /** Every visible release as a card. Renders inline anywhere inside the provider; also used by the changelog dialog. */
2
+ export declare function ChangelogList(): import("react").JSX.Element | null;