@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.
Files changed (69) hide show
  1. package/dist/components/ActionBar.svelte +85 -0
  2. package/dist/components/ActionBar.svelte.d.ts +13 -0
  3. package/dist/components/Avatar.svelte +104 -0
  4. package/dist/components/Avatar.svelte.d.ts +19 -0
  5. package/dist/components/Comment.svelte +172 -0
  6. package/dist/components/Comment.svelte.d.ts +22 -0
  7. package/dist/components/CommentsSection.svelte +89 -0
  8. package/dist/components/DocumentCard.svelte +126 -56
  9. package/dist/components/DocumentCard.svelte.d.ts +51 -0
  10. package/dist/components/Footnotes.svelte +72 -0
  11. package/dist/components/Footnotes.svelte.d.ts +13 -0
  12. package/dist/components/RecommendButton.svelte +153 -0
  13. package/dist/components/RecommendButton.svelte.d.ts +17 -0
  14. package/dist/components/ThemeProvider.svelte +92 -0
  15. package/dist/components/ThemeProvider.svelte.d.ts +13 -0
  16. package/dist/components/Toast.svelte +177 -0
  17. package/dist/components/Toast.svelte.d.ts +32 -0
  18. package/dist/components/Watermark.svelte +100 -0
  19. package/dist/components/Watermark.svelte.d.ts +17 -0
  20. package/dist/components/common/ThemedCard.svelte +15 -15
  21. package/dist/components/common/ThemedCard.svelte.d.ts +5 -0
  22. package/dist/components/document/BlockRenderer.svelte +3 -0
  23. package/dist/components/document/DocumentRenderer.svelte +41 -1
  24. package/dist/components/document/RichText.svelte +87 -2
  25. package/dist/components/document/RichText.svelte.d.ts +2 -0
  26. package/dist/components/document/blocks/OrderedListBlock.svelte +152 -0
  27. package/dist/components/document/blocks/UnorderedListBlock.svelte +1 -1
  28. package/dist/components/index.d.ts +28 -0
  29. package/dist/components/index.js +30 -0
  30. package/dist/index.d.ts +5 -4
  31. package/dist/index.js +6 -4
  32. package/dist/publisher.d.ts +73 -0
  33. package/dist/publisher.js +185 -0
  34. package/dist/schemas.d.ts +1162 -2
  35. package/dist/schemas.js +316 -0
  36. package/dist/types.d.ts +393 -2
  37. package/dist/types.js +1 -1
  38. package/dist/utils/native-comments.d.ts +68 -0
  39. package/dist/utils/native-comments.js +149 -0
  40. package/dist/utils/theme-helpers.d.ts +41 -1
  41. package/dist/utils/theme-helpers.js +98 -1
  42. package/dist/utils/theme.d.ts +48 -1
  43. package/dist/utils/theme.js +158 -0
  44. package/package.json +62 -65
  45. package/src/lib/components/ActionBar.svelte +85 -0
  46. package/src/lib/components/Avatar.svelte +104 -0
  47. package/src/lib/components/Comment.svelte +172 -0
  48. package/src/lib/components/CommentsSection.svelte +89 -0
  49. package/src/lib/components/DocumentCard.svelte +126 -56
  50. package/src/lib/components/Footnotes.svelte +72 -0
  51. package/src/lib/components/RecommendButton.svelte +153 -0
  52. package/src/lib/components/ThemeProvider.svelte +92 -0
  53. package/src/lib/components/Toast.svelte +177 -0
  54. package/src/lib/components/Watermark.svelte +100 -0
  55. package/src/lib/components/common/ThemedCard.svelte +15 -15
  56. package/src/lib/components/document/BlockRenderer.svelte +3 -0
  57. package/src/lib/components/document/DocumentRenderer.svelte +41 -1
  58. package/src/lib/components/document/RichText.svelte +87 -2
  59. package/src/lib/components/document/blocks/OrderedListBlock.svelte +152 -0
  60. package/src/lib/components/document/blocks/UnorderedListBlock.svelte +1 -1
  61. package/src/lib/components/index.ts +32 -0
  62. package/src/lib/index.ts +119 -5
  63. package/src/lib/publisher.ts +251 -0
  64. package/src/lib/schemas.ts +411 -0
  65. package/src/lib/types.ts +506 -2
  66. package/src/lib/utils/native-comments.ts +197 -0
  67. package/src/lib/utils/theme-helpers.ts +136 -3
  68. package/src/lib/utils/theme.ts +189 -1
  69. package/dist/components/document/blocks/UnorderedListBlock.svelte.d.ts +0 -9
package/src/lib/types.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Core types for site.standard.* lexicons
2
+ * Core types for site.standard.* and pub.leaflet.* lexicons
3
3
  */
4
4
 
5
+ // ============================================
6
+ // AT Protocol Base Types
7
+ // ============================================
8
+
5
9
  /**
6
10
  * AT Protocol blob reference
7
11
  */
@@ -22,6 +26,10 @@ export interface StrongRef {
22
26
  cid: string;
23
27
  }
24
28
 
29
+ // ============================================
30
+ // Color & Theme Types
31
+ // ============================================
32
+
25
33
  /**
26
34
  * RGB Color
27
35
  */
@@ -31,6 +39,31 @@ export interface RGBColor {
31
39
  b: number; // 0-255
32
40
  }
33
41
 
42
+ /**
43
+ * RGBA Color (with alpha)
44
+ */
45
+ export interface RGBAColor {
46
+ r: number; // 0-255
47
+ g: number; // 0-255
48
+ b: number; // 0-255
49
+ a: number; // 0-100
50
+ }
51
+
52
+ /**
53
+ * Color union (RGB or RGBA)
54
+ */
55
+ export type Color = RGBColor | RGBAColor;
56
+
57
+ /**
58
+ * Background image configuration
59
+ */
60
+ export interface BackgroundImage {
61
+ $type?: 'pub.leaflet.theme.backgroundImage';
62
+ url: string;
63
+ opacity?: number; // 0-1
64
+ blur?: number;
65
+ }
66
+
34
67
  /**
35
68
  * Basic theme for publications
36
69
  */
@@ -42,6 +75,27 @@ export interface BasicTheme {
42
75
  accentForeground: RGBColor;
43
76
  }
44
77
 
78
+ /**
79
+ * Extended theme for publications (pub.leaflet.publication#theme)
80
+ */
81
+ export interface ExtendedTheme {
82
+ $type?: 'pub.leaflet.theme';
83
+ backgroundColor?: Color;
84
+ pageBackground?: Color;
85
+ showPageBackground?: boolean;
86
+ primary?: Color;
87
+ accentBackground?: Color;
88
+ accentText?: Color;
89
+ headingFont?: string;
90
+ bodyFont?: string;
91
+ pageWidth?: number; // 0-1600
92
+ backgroundImage?: BackgroundImage;
93
+ }
94
+
95
+ // ============================================
96
+ // Publication Types
97
+ // ============================================
98
+
45
99
  /**
46
100
  * Publication preferences
47
101
  */
@@ -63,9 +117,14 @@ export interface Publication {
63
117
  icon?: string; // Blob URL converted to string
64
118
  description?: string;
65
119
  basicTheme?: BasicTheme;
120
+ theme?: ExtendedTheme;
66
121
  preferences?: PublicationPreferences;
67
122
  }
68
123
 
124
+ // ============================================
125
+ // Document Types
126
+ // ============================================
127
+
69
128
  /**
70
129
  * Site Standard Document record
71
130
  */
@@ -76,15 +135,460 @@ export interface Document {
76
135
  path?: string;
77
136
  description?: string;
78
137
  coverImage?: string; // Blob URL converted to string
79
- content?: any; // Open union
138
+ content?: Content; // Open union
80
139
  textContent?: string;
81
140
  bskyPostRef?: StrongRef;
82
141
  tags?: string[];
83
142
  publishedAt: string;
84
143
  updatedAt?: string;
144
+ theme?: ExtendedTheme;
85
145
  preferences?: PublicationPreferences;
86
146
  }
87
147
 
148
+ // ============================================
149
+ // Rich Text Facet Types (pub.leaflet.richtext.facet)
150
+ // ============================================
151
+
152
+ /**
153
+ * Byte slice for facet index
154
+ */
155
+ export interface ByteSlice {
156
+ byteStart: number;
157
+ byteEnd: number;
158
+ }
159
+
160
+ /**
161
+ * Link facet feature
162
+ */
163
+ export interface LinkFeature {
164
+ $type: 'pub.leaflet.richtext.facet#link';
165
+ uri: string;
166
+ }
167
+
168
+ /**
169
+ * DID Mention facet feature
170
+ */
171
+ export interface DidMentionFeature {
172
+ $type: 'pub.leaflet.richtext.facet#didMention';
173
+ did: string;
174
+ }
175
+
176
+ /**
177
+ * AT URI Mention facet feature
178
+ */
179
+ export interface AtMentionFeature {
180
+ $type: 'pub.leaflet.richtext.facet#atMention';
181
+ atURI: string;
182
+ }
183
+
184
+ /**
185
+ * Code facet feature (inline code)
186
+ */
187
+ export interface CodeFeature {
188
+ $type: 'pub.leaflet.richtext.facet#code';
189
+ }
190
+
191
+ /**
192
+ * Highlight facet feature
193
+ */
194
+ export interface HighlightFeature {
195
+ $type: 'pub.leaflet.richtext.facet#highlight';
196
+ }
197
+
198
+ /**
199
+ * Underline facet feature
200
+ */
201
+ export interface UnderlineFeature {
202
+ $type: 'pub.leaflet.richtext.facet#underline';
203
+ }
204
+
205
+ /**
206
+ * Strikethrough facet feature
207
+ */
208
+ export interface StrikethroughFeature {
209
+ $type: 'pub.leaflet.richtext.facet#strikethrough';
210
+ }
211
+
212
+ /**
213
+ * Bold facet feature
214
+ */
215
+ export interface BoldFeature {
216
+ $type: 'pub.leaflet.richtext.facet#bold';
217
+ }
218
+
219
+ /**
220
+ * Italic facet feature
221
+ */
222
+ export interface ItalicFeature {
223
+ $type: 'pub.leaflet.richtext.facet#italic';
224
+ }
225
+
226
+ /**
227
+ * ID facet feature (for anchor links)
228
+ */
229
+ export interface IdFeature {
230
+ $type: 'pub.leaflet.richtext.facet#id';
231
+ id: string;
232
+ }
233
+
234
+ /**
235
+ * Footnote facet feature
236
+ */
237
+ export interface FootnoteFeature {
238
+ $type: 'pub.leaflet.richtext.facet#footnote';
239
+ footnoteId: string;
240
+ contentPlaintext: string;
241
+ contentFacets?: Facet[];
242
+ }
243
+
244
+ /**
245
+ * Facet feature union
246
+ */
247
+ export type FacetFeature =
248
+ | LinkFeature
249
+ | DidMentionFeature
250
+ | AtMentionFeature
251
+ | CodeFeature
252
+ | HighlightFeature
253
+ | UnderlineFeature
254
+ | StrikethroughFeature
255
+ | BoldFeature
256
+ | ItalicFeature
257
+ | IdFeature
258
+ | FootnoteFeature;
259
+
260
+ /**
261
+ * Rich Text Facet
262
+ */
263
+ export interface Facet {
264
+ index: ByteSlice;
265
+ features: FacetFeature[];
266
+ }
267
+
268
+ // ============================================
269
+ // Block Types (pub.leaflet.blocks.*)
270
+ // ============================================
271
+
272
+ /**
273
+ * Text Block
274
+ */
275
+ export interface TextBlock {
276
+ $type: 'pub.leaflet.blocks.text';
277
+ plaintext: string;
278
+ textSize?: 'default' | 'small' | 'large';
279
+ facets?: Facet[];
280
+ }
281
+
282
+ /**
283
+ * Header Block
284
+ */
285
+ export interface HeaderBlock {
286
+ $type: 'pub.leaflet.blocks.header';
287
+ plaintext: string;
288
+ level?: number; // 1-6
289
+ facets?: Facet[];
290
+ }
291
+
292
+ /**
293
+ * Blockquote Block
294
+ */
295
+ export interface BlockquoteBlock {
296
+ $type: 'pub.leaflet.blocks.blockquote';
297
+ plaintext: string;
298
+ facets?: Facet[];
299
+ }
300
+
301
+ /**
302
+ * Image Block
303
+ */
304
+ export interface ImageBlock {
305
+ $type: 'pub.leaflet.blocks.image';
306
+ image: AtProtoBlob;
307
+ alt?: string;
308
+ aspectRatio?: { width: number; height: number };
309
+ }
310
+
311
+ /**
312
+ * Code Block
313
+ */
314
+ export interface CodeBlock {
315
+ $type: 'pub.leaflet.blocks.code';
316
+ code: string;
317
+ language?: string;
318
+ filename?: string;
319
+ }
320
+
321
+ /**
322
+ * Math Block
323
+ */
324
+ export interface MathBlock {
325
+ $type: 'pub.leaflet.blocks.math';
326
+ tex: string;
327
+ display?: boolean;
328
+ }
329
+
330
+ /**
331
+ * Ordered List Item
332
+ */
333
+ export interface OrderedListItem {
334
+ content?: TextBlock | HeaderBlock | ImageBlock;
335
+ checked?: boolean; // For checklist items
336
+ children?: OrderedListItem[];
337
+ unorderedListChildren?: UnorderedListBlock;
338
+ }
339
+
340
+ /**
341
+ * Ordered List Block
342
+ */
343
+ export interface OrderedListBlock {
344
+ $type: 'pub.leaflet.blocks.orderedList';
345
+ children: OrderedListItem[];
346
+ startIndex?: number;
347
+ }
348
+
349
+ /**
350
+ * Unordered List Item
351
+ */
352
+ export interface UnorderedListItem {
353
+ content?: TextBlock | HeaderBlock | ImageBlock;
354
+ children?: UnorderedListItem[];
355
+ }
356
+
357
+ /**
358
+ * Unordered List Block
359
+ */
360
+ export interface UnorderedListBlock {
361
+ $type: 'pub.leaflet.blocks.unorderedList';
362
+ children: UnorderedListItem[];
363
+ }
364
+
365
+ /**
366
+ * Horizontal Rule Block
367
+ */
368
+ export interface HorizontalRuleBlock {
369
+ $type: 'pub.leaflet.blocks.horizontalRule';
370
+ }
371
+
372
+ /**
373
+ * Iframe Block
374
+ */
375
+ export interface IframeBlock {
376
+ $type: 'pub.leaflet.blocks.iframe';
377
+ src: string;
378
+ title?: string;
379
+ width?: number;
380
+ height?: number;
381
+ }
382
+
383
+ /**
384
+ * Website Embed Block
385
+ */
386
+ export interface WebsiteBlock {
387
+ $type: 'pub.leaflet.blocks.website';
388
+ url: string;
389
+ title?: string;
390
+ description?: string;
391
+ image?: AtProtoBlob;
392
+ }
393
+
394
+ /**
395
+ * Button Block
396
+ */
397
+ export interface ButtonBlock {
398
+ $type: 'pub.leaflet.blocks.button';
399
+ text: string;
400
+ href: string;
401
+ variant?: 'primary' | 'secondary' | 'outline';
402
+ }
403
+
404
+ /**
405
+ * Bluesky Post Block
406
+ */
407
+ export interface BskyPostBlock {
408
+ $type: 'pub.leaflet.blocks.bskyPost';
409
+ uri: string;
410
+ }
411
+
412
+ /**
413
+ * Poll Block
414
+ */
415
+ export interface PollBlock {
416
+ $type: 'pub.leaflet.blocks.poll';
417
+ question: string;
418
+ options: Array<{ text: string; votes?: number }>;
419
+ endsAt?: string;
420
+ }
421
+
422
+ /**
423
+ * Page Block (internal page reference)
424
+ */
425
+ export interface PageBlock {
426
+ $type: 'pub.leaflet.blocks.page';
427
+ pageId: string;
428
+ }
429
+
430
+ /**
431
+ * Block union type
432
+ */
433
+ export type Block =
434
+ | TextBlock
435
+ | HeaderBlock
436
+ | BlockquoteBlock
437
+ | ImageBlock
438
+ | CodeBlock
439
+ | MathBlock
440
+ | OrderedListBlock
441
+ | UnorderedListBlock
442
+ | HorizontalRuleBlock
443
+ | IframeBlock
444
+ | WebsiteBlock
445
+ | ButtonBlock
446
+ | BskyPostBlock
447
+ | PollBlock
448
+ | PageBlock;
449
+
450
+ // ============================================
451
+ // Content Types (pub.leaflet.content)
452
+ // ============================================
453
+
454
+ /**
455
+ * Position for quotes
456
+ */
457
+ export interface Position {
458
+ block: number[];
459
+ offset: number;
460
+ }
461
+
462
+ /**
463
+ * Quote reference
464
+ */
465
+ export interface Quote {
466
+ start: Position;
467
+ end: Position;
468
+ }
469
+
470
+ /**
471
+ * Linear Document Page Block Wrapper
472
+ */
473
+ export interface LinearDocumentBlockWrapper {
474
+ $type: 'pub.leaflet.pages.linearDocument#block';
475
+ block: Block;
476
+ alignment?: '#textAlignLeft' | '#textAlignCenter' | '#textAlignRight' | '#textAlignJustify';
477
+ }
478
+
479
+ /**
480
+ * Linear Document Page
481
+ */
482
+ export interface LinearDocumentPage {
483
+ $type: 'pub.leaflet.pages.linearDocument';
484
+ id?: string;
485
+ blocks: LinearDocumentBlockWrapper[];
486
+ quote?: Quote;
487
+ }
488
+
489
+ /**
490
+ * Canvas Page Block Wrapper
491
+ */
492
+ export interface CanvasBlockWrapper {
493
+ $type: 'pub.leaflet.pages.canvas#block';
494
+ block: Block;
495
+ x: number;
496
+ y: number;
497
+ width: number;
498
+ height?: number;
499
+ rotation?: number;
500
+ }
501
+
502
+ /**
503
+ * Canvas Page
504
+ */
505
+ export interface CanvasPage {
506
+ $type: 'pub.leaflet.pages.canvas';
507
+ id?: string;
508
+ blocks: CanvasBlockWrapper[];
509
+ quote?: Quote;
510
+ }
511
+
512
+ /**
513
+ * Content (pub.leaflet.content)
514
+ */
515
+ export interface Content {
516
+ $type: 'pub.leaflet.content';
517
+ pages: (LinearDocumentPage | CanvasPage)[];
518
+ }
519
+
520
+ // ============================================
521
+ // Comment Types (pub.leaflet.comment)
522
+ // ============================================
523
+
524
+ /**
525
+ * Linear Document Quote (for comment attachments)
526
+ */
527
+ export interface LinearDocumentQuote {
528
+ $type?: 'pub.leaflet.comment#linearDocumentQuote';
529
+ document: string;
530
+ quote?: Quote;
531
+ }
532
+
533
+ /**
534
+ * Comment Reply Reference
535
+ */
536
+ export interface CommentReplyRef {
537
+ $type?: 'pub.leaflet.comment#replyRef';
538
+ parent: string;
539
+ }
540
+
541
+ /**
542
+ * Comment record
543
+ */
544
+ export interface CommentRecord {
545
+ $type: 'pub.leaflet.comment';
546
+ subject: string; // AT-URI of the document being commented on
547
+ plaintext: string;
548
+ createdAt: string;
549
+ reply?: CommentReplyRef;
550
+ facets?: Facet[];
551
+ onPage?: string;
552
+ attachment?: LinearDocumentQuote;
553
+ }
554
+
555
+ // ============================================
556
+ // Interaction Types (pub.leaflet.interactions.*)
557
+ // ============================================
558
+
559
+ /**
560
+ * Recommend record
561
+ */
562
+ export interface RecommendRecord {
563
+ $type: 'pub.leaflet.interactions.recommend';
564
+ subject: string; // AT-URI of the document being recommended
565
+ createdAt: string;
566
+ }
567
+
568
+ // ============================================
569
+ // Graph Types (site.standard.graph.*, pub.leaflet.graph.*)
570
+ // ============================================
571
+
572
+ /**
573
+ * Subscription record (site.standard.graph.subscription)
574
+ */
575
+ export interface SubscriptionRecord {
576
+ $type: 'site.standard.graph.subscription';
577
+ publication: string; // AT-URI of the publication
578
+ }
579
+
580
+ /**
581
+ * Leaflet Subscription record (pub.leaflet.graph.subscription)
582
+ */
583
+ export interface LeafletSubscriptionRecord {
584
+ $type: 'pub.leaflet.graph.subscription';
585
+ publication: string; // AT-URI of the publication
586
+ }
587
+
588
+ // ============================================
589
+ // Utility Types
590
+ // ============================================
591
+
88
592
  /**
89
593
  * AT Protocol record response
90
594
  */