@ewanc26/svelte-standard-site 0.2.2 → 0.2.4
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/dist/components/ActionBar.svelte +85 -0
- package/dist/components/ActionBar.svelte.d.ts +13 -0
- package/dist/components/Avatar.svelte +104 -0
- package/dist/components/Avatar.svelte.d.ts +19 -0
- package/dist/components/Comment.svelte +172 -0
- package/dist/components/Comment.svelte.d.ts +22 -0
- package/dist/components/CommentsSection.svelte +89 -0
- package/dist/components/DocumentCard.svelte +126 -56
- package/dist/components/DocumentCard.svelte.d.ts +51 -0
- package/dist/components/Footnotes.svelte +72 -0
- package/dist/components/Footnotes.svelte.d.ts +13 -0
- package/dist/components/RecommendButton.svelte +153 -0
- package/dist/components/RecommendButton.svelte.d.ts +17 -0
- package/dist/components/ThemeProvider.svelte +92 -0
- package/dist/components/ThemeProvider.svelte.d.ts +13 -0
- package/dist/components/Toast.svelte +177 -0
- package/dist/components/Toast.svelte.d.ts +32 -0
- package/dist/components/Watermark.svelte +100 -0
- package/dist/components/Watermark.svelte.d.ts +17 -0
- package/dist/components/common/ThemedCard.svelte +15 -15
- package/dist/components/common/ThemedCard.svelte.d.ts +5 -0
- package/dist/components/document/BlockRenderer.svelte +3 -0
- package/dist/components/document/DocumentRenderer.svelte +41 -1
- package/dist/components/document/RichText.svelte +87 -2
- package/dist/components/document/RichText.svelte.d.ts +2 -0
- package/dist/components/document/blocks/OrderedListBlock.svelte +152 -0
- package/dist/components/document/blocks/UnorderedListBlock.svelte +1 -1
- package/dist/components/index.d.ts +28 -0
- package/dist/components/index.js +30 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +6 -4
- package/dist/publisher.d.ts +73 -0
- package/dist/publisher.js +185 -0
- package/dist/schemas.d.ts +1162 -2
- package/dist/schemas.js +316 -0
- package/dist/types.d.ts +393 -2
- package/dist/types.js +1 -1
- package/dist/utils/native-comments.d.ts +68 -0
- package/dist/utils/native-comments.js +149 -0
- package/dist/utils/theme-helpers.d.ts +41 -1
- package/dist/utils/theme-helpers.js +98 -1
- package/dist/utils/theme.d.ts +48 -1
- package/dist/utils/theme.js +158 -0
- package/package.json +62 -65
- package/src/lib/components/ActionBar.svelte +85 -0
- package/src/lib/components/Avatar.svelte +104 -0
- package/src/lib/components/Comment.svelte +172 -0
- package/src/lib/components/CommentsSection.svelte +89 -0
- package/src/lib/components/DocumentCard.svelte +126 -56
- package/src/lib/components/Footnotes.svelte +72 -0
- package/src/lib/components/RecommendButton.svelte +153 -0
- package/src/lib/components/ThemeProvider.svelte +92 -0
- package/src/lib/components/Toast.svelte +177 -0
- package/src/lib/components/Watermark.svelte +100 -0
- package/src/lib/components/common/ThemedCard.svelte +15 -15
- package/src/lib/components/document/BlockRenderer.svelte +3 -0
- package/src/lib/components/document/DocumentRenderer.svelte +41 -1
- package/src/lib/components/document/RichText.svelte +87 -2
- package/src/lib/components/document/blocks/OrderedListBlock.svelte +152 -0
- package/src/lib/components/document/blocks/UnorderedListBlock.svelte +1 -1
- package/src/lib/components/index.ts +32 -0
- package/src/lib/index.ts +119 -5
- package/src/lib/publisher.ts +251 -0
- package/src/lib/schemas.ts +411 -0
- package/src/lib/types.ts +506 -2
- package/src/lib/utils/native-comments.ts +197 -0
- package/src/lib/utils/theme-helpers.ts +136 -3
- package/src/lib/utils/theme.ts +189 -1
- package/dist/components/document/blocks/UnorderedListBlock.svelte.d.ts +0 -9
package/dist/schemas.js
CHANGED
|
@@ -17,6 +17,28 @@ export const RGBColorSchema = z.object({
|
|
|
17
17
|
g: z.number().int().min(0).max(255),
|
|
18
18
|
b: z.number().int().min(0).max(255)
|
|
19
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* RGBA Color schema (with alpha)
|
|
22
|
+
*/
|
|
23
|
+
export const RGBAColorSchema = z.object({
|
|
24
|
+
r: z.number().int().min(0).max(255),
|
|
25
|
+
g: z.number().int().min(0).max(255),
|
|
26
|
+
b: z.number().int().min(0).max(255),
|
|
27
|
+
a: z.number().int().min(0).max(100)
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Color union (RGB or RGBA)
|
|
31
|
+
*/
|
|
32
|
+
export const ColorSchema = z.union([RGBColorSchema, RGBAColorSchema]);
|
|
33
|
+
/**
|
|
34
|
+
* Background Image schema
|
|
35
|
+
*/
|
|
36
|
+
export const BackgroundImageSchema = z.object({
|
|
37
|
+
$type: z.literal('pub.leaflet.theme.backgroundImage').optional(),
|
|
38
|
+
url: z.string(),
|
|
39
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
40
|
+
blur: z.number().min(0).optional()
|
|
41
|
+
});
|
|
20
42
|
/**
|
|
21
43
|
* Basic Theme schema
|
|
22
44
|
*/
|
|
@@ -27,6 +49,22 @@ export const BasicThemeSchema = z.object({
|
|
|
27
49
|
accent: RGBColorSchema,
|
|
28
50
|
accentForeground: RGBColorSchema
|
|
29
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* Extended Theme schema (pub.leaflet.publication#theme)
|
|
54
|
+
*/
|
|
55
|
+
export const ExtendedThemeSchema = z.object({
|
|
56
|
+
$type: z.literal('pub.leaflet.theme').optional(),
|
|
57
|
+
backgroundColor: ColorSchema.optional(),
|
|
58
|
+
pageBackground: ColorSchema.optional(),
|
|
59
|
+
showPageBackground: z.boolean().optional(),
|
|
60
|
+
primary: ColorSchema.optional(),
|
|
61
|
+
accentBackground: ColorSchema.optional(),
|
|
62
|
+
accentText: ColorSchema.optional(),
|
|
63
|
+
headingFont: z.string().max(100).optional(),
|
|
64
|
+
bodyFont: z.string().max(100).optional(),
|
|
65
|
+
pageWidth: z.number().int().min(0).max(1600).optional(),
|
|
66
|
+
backgroundImage: BackgroundImageSchema.optional()
|
|
67
|
+
});
|
|
30
68
|
/**
|
|
31
69
|
* Publication Preferences schema
|
|
32
70
|
*/
|
|
@@ -111,3 +149,281 @@ export const LoaderConfigSchema = z.object({
|
|
|
111
149
|
limit: z.number().int().positive().default(100),
|
|
112
150
|
service: z.string().url().default('https://public.api.bsky.app')
|
|
113
151
|
});
|
|
152
|
+
// ============================================
|
|
153
|
+
// Rich Text Facet Schemas (pub.leaflet.richtext.facet)
|
|
154
|
+
// ============================================
|
|
155
|
+
/**
|
|
156
|
+
* Byte slice for facet index
|
|
157
|
+
*/
|
|
158
|
+
export const ByteSliceSchema = z.object({
|
|
159
|
+
byteStart: z.number().int().min(0),
|
|
160
|
+
byteEnd: z.number().int().min(0)
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Link facet feature
|
|
164
|
+
*/
|
|
165
|
+
export const LinkFeatureSchema = z.object({
|
|
166
|
+
$type: z.literal('pub.leaflet.richtext.facet#link'),
|
|
167
|
+
uri: z.string()
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* DID Mention facet feature
|
|
171
|
+
*/
|
|
172
|
+
export const DidMentionFeatureSchema = z.object({
|
|
173
|
+
$type: z.literal('pub.leaflet.richtext.facet#didMention'),
|
|
174
|
+
did: z.string()
|
|
175
|
+
});
|
|
176
|
+
/**
|
|
177
|
+
* AT URI Mention facet feature
|
|
178
|
+
*/
|
|
179
|
+
export const AtMentionFeatureSchema = z.object({
|
|
180
|
+
$type: z.literal('pub.leaflet.richtext.facet#atMention'),
|
|
181
|
+
atURI: z.string()
|
|
182
|
+
});
|
|
183
|
+
/**
|
|
184
|
+
* Code facet feature (inline code)
|
|
185
|
+
*/
|
|
186
|
+
export const CodeFeatureSchema = z.object({
|
|
187
|
+
$type: z.literal('pub.leaflet.richtext.facet#code')
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* Highlight facet feature
|
|
191
|
+
*/
|
|
192
|
+
export const HighlightFeatureSchema = z.object({
|
|
193
|
+
$type: z.literal('pub.leaflet.richtext.facet#highlight')
|
|
194
|
+
});
|
|
195
|
+
/**
|
|
196
|
+
* Underline facet feature
|
|
197
|
+
*/
|
|
198
|
+
export const UnderlineFeatureSchema = z.object({
|
|
199
|
+
$type: z.literal('pub.leaflet.richtext.facet#underline')
|
|
200
|
+
});
|
|
201
|
+
/**
|
|
202
|
+
* Strikethrough facet feature
|
|
203
|
+
*/
|
|
204
|
+
export const StrikethroughFeatureSchema = z.object({
|
|
205
|
+
$type: z.literal('pub.leaflet.richtext.facet#strikethrough')
|
|
206
|
+
});
|
|
207
|
+
/**
|
|
208
|
+
* Bold facet feature
|
|
209
|
+
*/
|
|
210
|
+
export const BoldFeatureSchema = z.object({
|
|
211
|
+
$type: z.literal('pub.leaflet.richtext.facet#bold')
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Italic facet feature
|
|
215
|
+
*/
|
|
216
|
+
export const ItalicFeatureSchema = z.object({
|
|
217
|
+
$type: z.literal('pub.leaflet.richtext.facet#italic')
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* ID facet feature (for anchor links)
|
|
221
|
+
*/
|
|
222
|
+
export const IdFeatureSchema = z.object({
|
|
223
|
+
$type: z.literal('pub.leaflet.richtext.facet#id'),
|
|
224
|
+
id: z.string()
|
|
225
|
+
});
|
|
226
|
+
/**
|
|
227
|
+
* Footnote facet feature
|
|
228
|
+
*/
|
|
229
|
+
export const FootnoteFeatureSchema = z.object({
|
|
230
|
+
$type: z.literal('pub.leaflet.richtext.facet#footnote'),
|
|
231
|
+
footnoteId: z.string(),
|
|
232
|
+
contentPlaintext: z.string(),
|
|
233
|
+
contentFacets: z.array(z.lazy(() => FacetSchema)).optional()
|
|
234
|
+
});
|
|
235
|
+
/**
|
|
236
|
+
* Facet feature union
|
|
237
|
+
*/
|
|
238
|
+
export const FacetFeatureSchema = z.union([
|
|
239
|
+
LinkFeatureSchema,
|
|
240
|
+
DidMentionFeatureSchema,
|
|
241
|
+
AtMentionFeatureSchema,
|
|
242
|
+
CodeFeatureSchema,
|
|
243
|
+
HighlightFeatureSchema,
|
|
244
|
+
UnderlineFeatureSchema,
|
|
245
|
+
StrikethroughFeatureSchema,
|
|
246
|
+
BoldFeatureSchema,
|
|
247
|
+
ItalicFeatureSchema,
|
|
248
|
+
IdFeatureSchema,
|
|
249
|
+
FootnoteFeatureSchema
|
|
250
|
+
]);
|
|
251
|
+
/**
|
|
252
|
+
* Rich Text Facet schema
|
|
253
|
+
*/
|
|
254
|
+
export const FacetSchema = z.object({
|
|
255
|
+
index: ByteSliceSchema,
|
|
256
|
+
features: z.array(FacetFeatureSchema)
|
|
257
|
+
});
|
|
258
|
+
// ============================================
|
|
259
|
+
// Block Schemas (pub.leaflet.blocks.*)
|
|
260
|
+
// ============================================
|
|
261
|
+
/**
|
|
262
|
+
* Text Block schema
|
|
263
|
+
*/
|
|
264
|
+
export const TextBlockSchema = z.object({
|
|
265
|
+
$type: z.literal('pub.leaflet.blocks.text'),
|
|
266
|
+
plaintext: z.string(),
|
|
267
|
+
textSize: z.enum(['default', 'small', 'large']).optional(),
|
|
268
|
+
facets: z.array(FacetSchema).optional()
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* Header Block schema
|
|
272
|
+
*/
|
|
273
|
+
export const HeaderBlockSchema = z.object({
|
|
274
|
+
$type: z.literal('pub.leaflet.blocks.header'),
|
|
275
|
+
plaintext: z.string(),
|
|
276
|
+
level: z.number().int().min(1).max(6).optional(),
|
|
277
|
+
facets: z.array(FacetSchema).optional()
|
|
278
|
+
});
|
|
279
|
+
/**
|
|
280
|
+
* Ordered List Item schema
|
|
281
|
+
*/
|
|
282
|
+
export const OrderedListItemSchema = z.lazy(() => z.object({
|
|
283
|
+
content: z.union([TextBlockSchema, HeaderBlockSchema, z.any()]).optional(),
|
|
284
|
+
checked: z.boolean().optional(),
|
|
285
|
+
children: z.array(OrderedListItemSchema).optional(),
|
|
286
|
+
unorderedListChildren: z.any().optional()
|
|
287
|
+
}));
|
|
288
|
+
/**
|
|
289
|
+
* Ordered List Block schema
|
|
290
|
+
*/
|
|
291
|
+
export const OrderedListBlockSchema = z.object({
|
|
292
|
+
$type: z.literal('pub.leaflet.blocks.orderedList'),
|
|
293
|
+
children: z.array(OrderedListItemSchema),
|
|
294
|
+
startIndex: z.number().int().optional()
|
|
295
|
+
});
|
|
296
|
+
/**
|
|
297
|
+
* Unordered List Item schema
|
|
298
|
+
*/
|
|
299
|
+
export const UnorderedListItemSchema = z.lazy(() => z.object({
|
|
300
|
+
content: z.union([TextBlockSchema, HeaderBlockSchema, z.any()]).optional(),
|
|
301
|
+
children: z.array(UnorderedListItemSchema).optional()
|
|
302
|
+
}));
|
|
303
|
+
/**
|
|
304
|
+
* Unordered List Block schema
|
|
305
|
+
*/
|
|
306
|
+
export const UnorderedListBlockSchema = z.object({
|
|
307
|
+
$type: z.literal('pub.leaflet.blocks.unorderedList'),
|
|
308
|
+
children: z.array(UnorderedListItemSchema)
|
|
309
|
+
});
|
|
310
|
+
// ============================================
|
|
311
|
+
// Comment Schemas (pub.leaflet.comment)
|
|
312
|
+
// ============================================
|
|
313
|
+
/**
|
|
314
|
+
* Linear Document Quote schema (for comment attachments)
|
|
315
|
+
*/
|
|
316
|
+
export const LinearDocumentQuoteSchema = z.object({
|
|
317
|
+
$type: z.literal('pub.leaflet.comment#linearDocumentQuote').optional(),
|
|
318
|
+
document: z.string(),
|
|
319
|
+
quote: z.object({
|
|
320
|
+
start: z.object({
|
|
321
|
+
block: z.array(z.number().int()),
|
|
322
|
+
offset: z.number().int()
|
|
323
|
+
}),
|
|
324
|
+
end: z.object({
|
|
325
|
+
block: z.array(z.number().int()),
|
|
326
|
+
offset: z.number().int()
|
|
327
|
+
})
|
|
328
|
+
}).optional()
|
|
329
|
+
});
|
|
330
|
+
/**
|
|
331
|
+
* Comment Reply Reference schema
|
|
332
|
+
*/
|
|
333
|
+
export const CommentReplyRefSchema = z.object({
|
|
334
|
+
$type: z.literal('pub.leaflet.comment#replyRef').optional(),
|
|
335
|
+
parent: z.string()
|
|
336
|
+
});
|
|
337
|
+
/**
|
|
338
|
+
* Comment schema
|
|
339
|
+
*/
|
|
340
|
+
export const CommentSchema = z.object({
|
|
341
|
+
$type: z.literal('pub.leaflet.comment'),
|
|
342
|
+
subject: z.string(),
|
|
343
|
+
plaintext: z.string(),
|
|
344
|
+
createdAt: z.string().datetime(),
|
|
345
|
+
reply: CommentReplyRefSchema.optional(),
|
|
346
|
+
facets: z.array(FacetSchema).optional(),
|
|
347
|
+
onPage: z.string().optional(),
|
|
348
|
+
attachment: LinearDocumentQuoteSchema.optional()
|
|
349
|
+
});
|
|
350
|
+
// ============================================
|
|
351
|
+
// Interactions Schemas (pub.leaflet.interactions.*)
|
|
352
|
+
// ============================================
|
|
353
|
+
/**
|
|
354
|
+
* Recommend schema
|
|
355
|
+
*/
|
|
356
|
+
export const RecommendSchema = z.object({
|
|
357
|
+
$type: z.literal('pub.leaflet.interactions.recommend'),
|
|
358
|
+
subject: z.string(),
|
|
359
|
+
createdAt: z.string().datetime()
|
|
360
|
+
});
|
|
361
|
+
// ============================================
|
|
362
|
+
// Graph Schemas (site.standard.graph.*, pub.leaflet.graph.*)
|
|
363
|
+
// ============================================
|
|
364
|
+
/**
|
|
365
|
+
* Subscription schema (site.standard.graph.subscription)
|
|
366
|
+
*/
|
|
367
|
+
export const SubscriptionSchema = z.object({
|
|
368
|
+
$type: z.literal('site.standard.graph.subscription'),
|
|
369
|
+
publication: z.string()
|
|
370
|
+
});
|
|
371
|
+
/**
|
|
372
|
+
* Leaflet Subscription schema (pub.leaflet.graph.subscription)
|
|
373
|
+
*/
|
|
374
|
+
export const LeafletSubscriptionSchema = z.object({
|
|
375
|
+
$type: z.literal('pub.leaflet.graph.subscription'),
|
|
376
|
+
publication: z.string()
|
|
377
|
+
});
|
|
378
|
+
// ============================================
|
|
379
|
+
// Content Schemas (pub.leaflet.content)
|
|
380
|
+
// ============================================
|
|
381
|
+
/**
|
|
382
|
+
* Position schema for quotes
|
|
383
|
+
*/
|
|
384
|
+
export const PositionSchema = z.object({
|
|
385
|
+
block: z.array(z.number().int()),
|
|
386
|
+
offset: z.number().int()
|
|
387
|
+
});
|
|
388
|
+
/**
|
|
389
|
+
* Quote schema
|
|
390
|
+
*/
|
|
391
|
+
export const QuoteSchema = z.object({
|
|
392
|
+
start: PositionSchema,
|
|
393
|
+
end: PositionSchema
|
|
394
|
+
});
|
|
395
|
+
/**
|
|
396
|
+
* Linear Document Page schema
|
|
397
|
+
*/
|
|
398
|
+
export const LinearDocumentPageSchema = z.object({
|
|
399
|
+
$type: z.literal('pub.leaflet.pages.linearDocument'),
|
|
400
|
+
id: z.string().optional(),
|
|
401
|
+
blocks: z.array(z.object({
|
|
402
|
+
$type: z.literal('pub.leaflet.pages.linearDocument#block'),
|
|
403
|
+
block: z.any(),
|
|
404
|
+
alignment: z.enum(['#textAlignLeft', '#textAlignCenter', '#textAlignRight', '#textAlignJustify']).optional()
|
|
405
|
+
}))
|
|
406
|
+
});
|
|
407
|
+
/**
|
|
408
|
+
* Canvas Page schema
|
|
409
|
+
*/
|
|
410
|
+
export const CanvasPageSchema = z.object({
|
|
411
|
+
$type: z.literal('pub.leaflet.pages.canvas'),
|
|
412
|
+
id: z.string().optional(),
|
|
413
|
+
blocks: z.array(z.object({
|
|
414
|
+
$type: z.literal('pub.leaflet.pages.canvas#block'),
|
|
415
|
+
block: z.any(),
|
|
416
|
+
x: z.number().int(),
|
|
417
|
+
y: z.number().int(),
|
|
418
|
+
width: z.number().int(),
|
|
419
|
+
height: z.number().int().optional(),
|
|
420
|
+
rotation: z.number().int().optional()
|
|
421
|
+
}))
|
|
422
|
+
});
|
|
423
|
+
/**
|
|
424
|
+
* Content schema (pub.leaflet.content)
|
|
425
|
+
*/
|
|
426
|
+
export const ContentSchema = z.object({
|
|
427
|
+
$type: z.literal('pub.leaflet.content'),
|
|
428
|
+
pages: z.array(z.union([LinearDocumentPageSchema, CanvasPageSchema]))
|
|
429
|
+
});
|