@geenius/docs 0.4.1 → 0.8.10

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.
@@ -1,274 +1,7 @@
1
+ import { D as DocsConfig, a as DocSection, B as BreadcrumbItem, b as DocPage, S as SearchResult, T as TocItem } from './types-n-Ryn258.js';
2
+ export { c as DocAccess, d as DocAuthor, e as DocNavigationLink, f as DocRevision, g as DocStatus, h as DocsPage, i as DocsProvider, j as DocsSearchResult, k as DocsSidebar, l as DocsSidebarItem, m as DocsSidebarPage } from './types-n-Ryn258.js';
1
3
  import { GeeniusError, GeeniusErrorOptions, ErrorCode } from '@geenius/tools/errors';
2
4
 
3
- /**
4
- * @module docsTypes
5
- * @package @geenius/docs-shared
6
- * @description Declares the shared docs domain model used by the framework
7
- * variants, Convex integration, and provider adapters. These types form the
8
- * public contract exported from `@geenius/docs`.
9
- */
10
- /**
11
- * Access levels supported by docs content.
12
- */
13
- type DocAccess = 'public' | 'team' | 'admin';
14
- /**
15
- * Publishing states supported by docs pages.
16
- */
17
- type DocStatus = 'draft' | 'published' | 'archived';
18
- /**
19
- * Author metadata attached to a docs page.
20
- *
21
- * @property name - Human-readable author display name.
22
- * @property avatar - Optional avatar URL for UI surfaces that show authorship.
23
- */
24
- interface DocAuthor {
25
- name: string;
26
- avatar?: string;
27
- }
28
- /**
29
- * Last-editor metadata attached to a docs page revision.
30
- *
31
- * @property name - Human-readable editor display name.
32
- * @property editedAt - ISO timestamp describing the edit event.
33
- */
34
- interface DocRevision {
35
- name: string;
36
- editedAt: string;
37
- }
38
- /**
39
- * Minimal navigation link used for previous and next page affordances.
40
- *
41
- * @property title - Label shown in the navigation UI.
42
- * @property slug - Page slug used to resolve the target.
43
- */
44
- interface DocNavigationLink {
45
- title: string;
46
- slug: string;
47
- }
48
- /**
49
- * Core page record shared across all docs variants.
50
- *
51
- * @property id - Stable page identifier.
52
- * @property title - Human-readable page title.
53
- * @property slug - Route slug relative to the docs base path.
54
- * @property content - Markdown or MDX body content.
55
- * @property excerpt - Optional preview excerpt used by search and listings.
56
- * @property sectionId - Stable section identifier used for grouping.
57
- * @property order - Sort order inside the containing section.
58
- * @property author - Primary author metadata for the page.
59
- * @property lastEditedBy - Optional revision metadata for the last editor.
60
- * @property version - Optional semantic version label for versioned docs.
61
- * @property access - Access control level for the page.
62
- * @property tags - Searchable tags attached to the page.
63
- * @property status - Publishing status for the page.
64
- * @property createdAt - ISO timestamp describing when the page was created.
65
- * @property updatedAt - ISO timestamp describing the most recent update.
66
- * @property wordCount - Approximate rendered word count.
67
- * @property readingTime - Reading time in minutes.
68
- * @property viewCount - Recorded page view count.
69
- */
70
- interface DocPage {
71
- id: string;
72
- title: string;
73
- slug: string;
74
- content: string;
75
- excerpt?: string;
76
- sectionId: string;
77
- order: number;
78
- author: DocAuthor;
79
- lastEditedBy?: DocRevision;
80
- version?: string;
81
- access: DocAccess;
82
- tags: string[];
83
- status: DocStatus;
84
- createdAt: string;
85
- updatedAt: string;
86
- wordCount: number;
87
- readingTime: number;
88
- viewCount: number;
89
- }
90
- /**
91
- * Section record used by listings, navigation trees, and admin tooling.
92
- *
93
- * @property id - Stable section identifier.
94
- * @property title - Human-readable section title.
95
- * @property slug - Route slug for the section landing page.
96
- * @property parentId - Optional parent section identifier for nested trees.
97
- * @property order - Sort order among sibling sections.
98
- * @property icon - Optional decorative icon token or emoji.
99
- * @property description - Optional descriptive copy used in dashboards and cards.
100
- * @property access - Access control level inherited by the section.
101
- * @property pageCount - Optional precomputed number of pages in the section.
102
- */
103
- interface DocSection {
104
- id: string;
105
- title: string;
106
- slug: string;
107
- parentId?: string;
108
- order: number;
109
- icon?: string;
110
- description?: string;
111
- access: DocAccess;
112
- pageCount?: number;
113
- }
114
- /**
115
- * Search result returned by the shared search helpers.
116
- *
117
- * @property pageId - Stable page identifier.
118
- * @property pageTitle - Human-readable page title.
119
- * @property sectionTitle - Human-readable section title.
120
- * @property sectionSlug - Route slug for the containing section.
121
- * @property slug - Route slug for the page.
122
- * @property highlight - Excerpt or match snippet shown in results.
123
- * @property score - Rank score used to sort results.
124
- * @property tags - Searchable tags attached to the matching page.
125
- */
126
- interface SearchResult {
127
- pageId: string;
128
- pageTitle: string;
129
- sectionTitle: string;
130
- sectionSlug: string;
131
- slug: string;
132
- highlight: string;
133
- score: number;
134
- tags: string[];
135
- }
136
- /**
137
- * Table-of-contents node extracted from a page body.
138
- *
139
- * @property id - Heading anchor identifier.
140
- * @property text - Visible heading label.
141
- * @property level - Heading depth supported by the docs renderer.
142
- * @property children - Nested headings beneath this item.
143
- */
144
- interface TocItem {
145
- id: string;
146
- text: string;
147
- level: 2 | 3 | 4;
148
- children: TocItem[];
149
- }
150
- /**
151
- * Breadcrumb node used by page-level navigation chrome.
152
- *
153
- * @property title - Visible breadcrumb label.
154
- * @property href - Target route for the breadcrumb item.
155
- */
156
- interface BreadcrumbItem {
157
- title: string;
158
- href: string;
159
- }
160
- /**
161
- * Shared configuration options consumed by the docs variants.
162
- *
163
- * @property siteName - Optional site label for layouts and metadata.
164
- * @property baseUrl - Optional docs base path.
165
- * @property defaultAccess - Default access level for new content.
166
- * @property versionsEnabled - Enables version selection UI when true.
167
- * @property cmdKEnabled - Enables keyboard search affordances when true.
168
- * @property editPageUrl - Optional base URL used by "Edit this page" actions.
169
- * @property showReadingTime - Controls reading-time metadata visibility.
170
- * @property showLastEdited - Controls last-edited metadata visibility.
171
- * @property showViewCount - Controls view-count metadata visibility.
172
- * @property printModeEnabled - Enables print-focused layout affordances.
173
- */
174
- interface DocsConfig {
175
- siteName?: string;
176
- baseUrl?: string;
177
- defaultAccess?: DocAccess;
178
- versionsEnabled?: boolean;
179
- cmdKEnabled?: boolean;
180
- editPageUrl?: string;
181
- showReadingTime?: boolean;
182
- showLastEdited?: boolean;
183
- showViewCount?: boolean;
184
- printModeEnabled?: boolean;
185
- }
186
- /**
187
- * Provider-backed page record with derived navigation and heading data.
188
- */
189
- interface DocsPage extends DocPage {
190
- prev?: DocNavigationLink | null;
191
- next?: DocNavigationLink | null;
192
- toc?: TocItem[];
193
- breadcrumbs?: BreadcrumbItem[];
194
- }
195
- /**
196
- * Page summary entry displayed inside a sidebar section.
197
- *
198
- * @property slug - Route slug used by the nav item.
199
- * @property title - Human-readable nav label.
200
- */
201
- interface DocsSidebarPage {
202
- slug: string;
203
- title: string;
204
- }
205
- /**
206
- * Section node displayed by docs navigation components.
207
- *
208
- * @property id - Stable section identifier.
209
- * @property title - Human-readable section label.
210
- * @property slug - Route slug for the section.
211
- * @property icon - Optional decorative icon token or emoji.
212
- * @property pages - Flattened page entries belonging to the section.
213
- * @property children - Optional nested section tree beneath this item.
214
- */
215
- interface DocsSidebarItem {
216
- id: string;
217
- title: string;
218
- slug: string;
219
- icon?: string;
220
- pages: DocsSidebarPage[];
221
- children?: DocsSidebarItem[];
222
- }
223
- /**
224
- * Full sidebar structure returned by docs providers.
225
- */
226
- type DocsSidebar = DocsSidebarItem[];
227
- /**
228
- * Search result returned by provider-backed docs integrations.
229
- *
230
- * @property pageId - Stable page identifier.
231
- * @property pageTitle - Human-readable page title.
232
- * @property sectionTitle - Human-readable containing section label.
233
- * @property slug - Page route slug.
234
- * @property highlight - Preview snippet used in search results.
235
- * @property score - Rank score used to sort results.
236
- */
237
- interface DocsSearchResult {
238
- pageId: string;
239
- pageTitle: string;
240
- sectionTitle: string;
241
- slug: string;
242
- highlight: string;
243
- score: number;
244
- }
245
- /**
246
- * Provider contract implemented by pluggable docs backends such as internal
247
- * arrays, Astro content directories, and Fumadocs sources.
248
- */
249
- interface DocsProvider {
250
- /**
251
- * Load the sidebar navigation structure for the docs source.
252
- *
253
- * @returns The full sidebar tree for the provider.
254
- */
255
- getSidebar(): Promise<DocsSidebar>;
256
- /**
257
- * Resolve a single docs page by slug.
258
- *
259
- * @param slug - Route slug for the requested page.
260
- * @returns The resolved page record or `null` when not found.
261
- */
262
- getPage(slug: string): Promise<DocsPage | null>;
263
- /**
264
- * Search the provider-backed content source.
265
- *
266
- * @param query - User-entered search query.
267
- * @returns Ranked provider search results for the query.
268
- */
269
- search(query: string): Promise<DocsSearchResult[]>;
270
- }
271
-
272
5
  /**
273
6
  * @module docsConfig
274
7
  * @package @geenius/docs-shared
@@ -379,237 +112,6 @@ declare class DocsProviderError extends DocsError {
379
112
  });
380
113
  }
381
114
 
382
- /**
383
- * @module astroDocsProvider
384
- * @package @geenius/docs-shared
385
- * @description Implements the Astro-oriented provider used to normalise Markdown
386
- * and MDX files discovered from Astro content collections into the shared docs
387
- * contract consumed by the framework variants.
388
- */
389
-
390
- /**
391
- * Normalises Astro Markdown and MDX files into the shared docs contract.
392
- */
393
- declare class AstroDocsProvider implements DocsProvider {
394
- private pages;
395
- /**
396
- * Loads docs from an Astro-style `import.meta.glob()` result.
397
- *
398
- * @param globResult - Lazy or eager Astro content loaders keyed by path.
399
- * @returns Nothing. The provider page set is replaced in memory.
400
- */
401
- loadFromGlob(globResult: Record<string, (() => Promise<string>) | string>): Promise<void>;
402
- /**
403
- * Loads docs from already-read file contents.
404
- *
405
- * @param files - File path and content pairs to normalise.
406
- * @returns Nothing. The provider page set is replaced in memory.
407
- */
408
- loadFromFiles(files: Array<{
409
- path: string;
410
- content: string;
411
- }>): Promise<void>;
412
- private parseDoc;
413
- private linkPages;
414
- /**
415
- * Loads the sidebar structure derived from the parsed Astro pages.
416
- *
417
- * @returns Sidebar navigation entries derived from the published pages.
418
- */
419
- getSidebar(): Promise<DocsSidebar>;
420
- /**
421
- * Resolves a linked docs page by slug.
422
- *
423
- * @param slug - Target page slug.
424
- * @returns The linked page or `null` when no page matches the slug.
425
- */
426
- getPage(slug: string): Promise<DocsPage | null>;
427
- /**
428
- * Returns all published pages managed by the provider.
429
- *
430
- * @returns Published pages in their linked navigation order.
431
- */
432
- getAllPages(): Promise<DocsPage[]>;
433
- /**
434
- * Searches the parsed Astro page set.
435
- *
436
- * @param query - User-entered search query.
437
- * @returns Ranked search results derived from the published pages.
438
- */
439
- search(query: string): Promise<DocsSearchResult[]>;
440
- /**
441
- * Resolves previous and next pages for a slug.
442
- *
443
- * @param slug - Target page slug.
444
- * @returns Linked previous and next page records when available.
445
- */
446
- getNavigation(slug: string): Promise<{
447
- prev: DocsPage | null;
448
- next: DocsPage | null;
449
- }>;
450
- }
451
-
452
- /**
453
- * @module fumadocsProvider
454
- * @package @geenius/docs-shared
455
- * @description Implements the Fumadocs-backed provider used to normalise
456
- * source pages and page-tree metadata from Fumadocs into the shared docs
457
- * contract consumed by the framework variants.
458
- */
459
-
460
- /**
461
- * Fumadocs source-page shape accepted by the provider.
462
- */
463
- interface FumadocsSourcePage {
464
- slug?: string;
465
- slugs?: string[];
466
- url?: string;
467
- data: {
468
- title?: string;
469
- description?: string;
470
- body?: string;
471
- icon?: string;
472
- order?: number;
473
- toc?: TocItem[];
474
- draft?: boolean;
475
- status?: DocStatus;
476
- access?: DocAccess;
477
- author?: string;
478
- avatar?: string;
479
- tags?: string[] | string;
480
- version?: string;
481
- lastModified?: string;
482
- lastUpdated?: string;
483
- [key: string]: unknown;
484
- };
485
- }
486
- /**
487
- * Fumadocs tree-node shape accepted by the provider.
488
- */
489
- interface FumadocsTreeNode {
490
- type: 'page' | 'folder' | 'separator';
491
- name?: string;
492
- slug?: string;
493
- icon?: string;
494
- children?: FumadocsTreeNode[];
495
- }
496
- /**
497
- * Fumadocs provider that bridges source pages and trees into the shared docs contract.
498
- */
499
- declare class FumadocsDocsProvider implements DocsProvider {
500
- private pages;
501
- private tree;
502
- /**
503
- * Loads pages and an optional page tree from Fumadocs.
504
- *
505
- * @param pages - Source pages supplied by Fumadocs.
506
- * @param tree - Optional source page tree for nested sidebar rendering.
507
- * @returns Nothing. The provider page set is replaced in memory.
508
- */
509
- loadFromSource(pages: FumadocsSourcePage[], tree?: FumadocsTreeNode[]): void;
510
- private normalizePage;
511
- private linkPages;
512
- private treeToSidebar;
513
- /**
514
- * Loads the sidebar structure derived from the Fumadocs tree or grouped pages.
515
- *
516
- * @returns Sidebar navigation entries derived from the published pages.
517
- */
518
- getSidebar(): Promise<DocsSidebar>;
519
- /**
520
- * Resolves a linked docs page by slug.
521
- *
522
- * @param slug - Target page slug.
523
- * @returns The linked page or `null` when no page matches the slug.
524
- */
525
- getPage(slug: string): Promise<DocsPage | null>;
526
- /**
527
- * Returns all published pages managed by the provider.
528
- *
529
- * @returns Published pages in their linked navigation order.
530
- */
531
- getAllPages(): Promise<DocsPage[]>;
532
- /**
533
- * Searches the provider-backed page set.
534
- *
535
- * @param query - User-entered search query.
536
- * @returns Ranked search results derived from the published pages.
537
- */
538
- search(query: string): Promise<DocsSearchResult[]>;
539
- /**
540
- * Resolves previous and next pages for a slug.
541
- *
542
- * @param slug - Target page slug.
543
- * @returns Linked previous and next page records when available.
544
- */
545
- getNavigation(slug: string): Promise<{
546
- prev: DocsPage | null;
547
- next: DocsPage | null;
548
- }>;
549
- }
550
-
551
- /**
552
- * @module internalDocsProvider
553
- * @package @geenius/docs-shared
554
- * @description Implements the in-memory docs provider used by local fixtures,
555
- * tests, and apps that already have page records loaded in process memory.
556
- */
557
-
558
- /**
559
- * In-memory provider for already-hydrated docs pages.
560
- */
561
- declare class InternalDocsProvider implements DocsProvider {
562
- private pages;
563
- /**
564
- * @param pages - Optional initial page records to seed the provider with.
565
- */
566
- constructor(pages?: DocPage[]);
567
- /**
568
- * Replaces the provider's page set.
569
- *
570
- * @param pages - Fresh page records to seed into the provider.
571
- * @returns Nothing. The provider page set is replaced in memory.
572
- */
573
- setPages(pages: DocPage[]): void;
574
- private linkPages;
575
- /**
576
- * Loads the sidebar structure derived from the current page set.
577
- *
578
- * @returns Sidebar navigation entries derived from the published pages.
579
- */
580
- getSidebar(): Promise<DocsSidebar>;
581
- /**
582
- * Resolves a linked docs page by slug.
583
- *
584
- * @param slug - Target page slug.
585
- * @returns The linked page or `null` when no page matches the slug.
586
- */
587
- getPage(slug: string): Promise<DocsPage | null>;
588
- /**
589
- * Returns all published pages managed by the provider.
590
- *
591
- * @returns Published pages in their linked navigation order.
592
- */
593
- getAllPages(): Promise<DocsPage[]>;
594
- /**
595
- * Searches the provider-backed page set.
596
- *
597
- * @param query - User-entered search query.
598
- * @returns Ranked search results derived from the published pages.
599
- */
600
- search(query: string): Promise<DocsSearchResult[]>;
601
- /**
602
- * Resolves previous and next pages for a slug.
603
- *
604
- * @param slug - Target page slug.
605
- * @returns Linked previous and next page records when available.
606
- */
607
- getNavigation(slug: string): Promise<{
608
- prev: DocsPage | null;
609
- next: DocsPage | null;
610
- }>;
611
- }
612
-
613
115
  /**
614
116
  * @module docsUtilities
615
117
  * @package @geenius/docs-shared
@@ -681,4 +183,4 @@ declare function highlightMatch(text: string, query: string, maxLen?: number): s
681
183
  */
682
184
  declare const defaultDocsConfig: DocsConfig;
683
185
 
684
- export { AstroDocsProvider, type BreadcrumbItem, type DocAccess, type DocAuthor, type DocNavigationLink, type DocPage, type DocRevision, type DocSection, type DocStatus, type DocsConfig, DocsConfigurationError, DocsError, type DocsErrorCode, type DocsErrorOptions, type DocsPage, type DocsProvider, DocsProviderError, type DocsSearchResult, type DocsSidebar, type DocsSidebarItem, type DocsSidebarPage, FumadocsDocsProvider, InternalDocsProvider, type SearchResult, type TocItem, buildBreadcrumbs, buildDocsIndex, calcWordCount, configureDocs, defaultDocsConfig, defineDocsConfig, extractToc, getDocsConfig, highlightMatch, isDocsConfigured, mergeDocsConfig, resetDocsConfig, searchDocs, slugify };
186
+ export { BreadcrumbItem, DocPage, DocSection, DocsConfig, DocsConfigurationError, DocsError, type DocsErrorCode, type DocsErrorOptions, DocsProviderError, SearchResult, TocItem, buildBreadcrumbs, buildDocsIndex, calcWordCount, configureDocs, defaultDocsConfig, defineDocsConfig, extractToc, getDocsConfig, highlightMatch, isDocsConfigured, mergeDocsConfig, resetDocsConfig, searchDocs, slugify };