@geenius/docs 0.1.0 → 0.4.1

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 (158) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +53 -1
  3. package/package.json +101 -13
  4. package/packages/convex/dist/index.d.ts +503 -0
  5. package/packages/convex/dist/index.js +482 -0
  6. package/packages/convex/dist/index.js.map +1 -0
  7. package/packages/react/dist/index.d.ts +439 -0
  8. package/packages/react/dist/index.js +4954 -0
  9. package/packages/react/dist/index.js.map +1 -0
  10. package/packages/react-css/{src/styles.css → dist/index.css} +183 -223
  11. package/packages/react-css/dist/index.css.map +1 -0
  12. package/packages/react-css/dist/index.d.ts +443 -0
  13. package/packages/react-css/dist/index.js +5058 -0
  14. package/packages/react-css/dist/index.js.map +1 -0
  15. package/packages/shared/dist/index.d.ts +684 -0
  16. package/packages/shared/dist/index.js +788 -0
  17. package/packages/shared/dist/index.js.map +1 -0
  18. package/packages/solidjs/dist/index.d.ts +435 -0
  19. package/packages/solidjs/dist/index.js +4584 -0
  20. package/packages/solidjs/dist/index.js.map +1 -0
  21. package/packages/solidjs-css/{src/styles.css → dist/index.css} +183 -223
  22. package/packages/solidjs-css/dist/index.css.map +1 -0
  23. package/packages/solidjs-css/dist/index.d.ts +432 -0
  24. package/packages/solidjs-css/dist/index.js +4934 -0
  25. package/packages/solidjs-css/dist/index.js.map +1 -0
  26. package/.changeset/config.json +0 -11
  27. package/.github/CODEOWNERS +0 -1
  28. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -16
  29. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -11
  30. package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
  31. package/.github/dependabot.yml +0 -11
  32. package/.github/workflows/ci.yml +0 -23
  33. package/.github/workflows/release.yml +0 -29
  34. package/.nvmrc +0 -1
  35. package/.project/ACCOUNT.yaml +0 -4
  36. package/.project/IDEAS.yaml +0 -7
  37. package/.project/PROJECT.yaml +0 -11
  38. package/.project/ROADMAP.yaml +0 -15
  39. package/CODE_OF_CONDUCT.md +0 -16
  40. package/CONTRIBUTING.md +0 -26
  41. package/SECURITY.md +0 -15
  42. package/SUPPORT.md +0 -8
  43. package/packages/convex/README.md +0 -1
  44. package/packages/convex/package.json +0 -12
  45. package/packages/convex/src/convex.config.ts +0 -3
  46. package/packages/convex/src/index.ts +0 -3
  47. package/packages/convex/src/mutations.ts +0 -270
  48. package/packages/convex/src/queries.ts +0 -175
  49. package/packages/convex/src/schema.ts +0 -55
  50. package/packages/react/README.md +0 -1
  51. package/packages/react/package.json +0 -36
  52. package/packages/react/src/DocsLayout.tsx +0 -116
  53. package/packages/react/src/DocsProvider.tsx +0 -93
  54. package/packages/react/src/RouterDocsContent.tsx +0 -148
  55. package/packages/react/src/RouterDocsLayout.tsx +0 -161
  56. package/packages/react/src/components/Breadcrumbs.tsx +0 -34
  57. package/packages/react/src/components/DocPage.tsx +0 -191
  58. package/packages/react/src/components/DocSearch.tsx +0 -140
  59. package/packages/react/src/components/DocSidebar.tsx +0 -86
  60. package/packages/react/src/components/DocsLayout.tsx +0 -62
  61. package/packages/react/src/components/EditButton.tsx +0 -26
  62. package/packages/react/src/components/PageNavigation.tsx +0 -45
  63. package/packages/react/src/components/TableOfContents.tsx +0 -46
  64. package/packages/react/src/components/VersionSelector.tsx +0 -60
  65. package/packages/react/src/components/index.ts +0 -9
  66. package/packages/react/src/hooks/index.ts +0 -8
  67. package/packages/react/src/hooks/useDocSearch.ts +0 -55
  68. package/packages/react/src/hooks/useDocs.ts +0 -57
  69. package/packages/react/src/hooks/useDocsAdmin.ts +0 -151
  70. package/packages/react/src/hooks/useTableOfContents.ts +0 -66
  71. package/packages/react/src/index.ts +0 -38
  72. package/packages/react/src/pages/DocSearchPage.tsx +0 -129
  73. package/packages/react/src/pages/DocViewPage.tsx +0 -158
  74. package/packages/react/src/pages/DocsAdminPage.tsx +0 -330
  75. package/packages/react/src/pages/DocsIndexPage.tsx +0 -172
  76. package/packages/react/src/pages/index.ts +0 -4
  77. package/packages/react/src/useDocs.ts +0 -58
  78. package/packages/react/tsup.config.ts +0 -12
  79. package/packages/react-css/README.md +0 -1
  80. package/packages/react-css/package.json +0 -37
  81. package/packages/react-css/src/DocsLayout.tsx +0 -117
  82. package/packages/react-css/src/DocsProvider.tsx +0 -93
  83. package/packages/react-css/src/RouterDocsContent.tsx +0 -60
  84. package/packages/react-css/src/RouterDocsLayout.tsx +0 -101
  85. package/packages/react-css/src/components/DocPage.tsx +0 -21
  86. package/packages/react-css/src/components/DocSearch.tsx +0 -55
  87. package/packages/react-css/src/components/DocSidebar.tsx +0 -56
  88. package/packages/react-css/src/components/DocsLayout.tsx +0 -28
  89. package/packages/react-css/src/components/common.tsx +0 -93
  90. package/packages/react-css/src/components/index.ts +0 -5
  91. package/packages/react-css/src/hooks/index.ts +0 -2
  92. package/packages/react-css/src/index.ts +0 -6
  93. package/packages/react-css/src/index.tsx +0 -3
  94. package/packages/react-css/src/pages/DocViewPage.tsx +0 -78
  95. package/packages/react-css/src/pages/DocsAdminPage.tsx +0 -101
  96. package/packages/react-css/src/pages/DocsIndexPage.tsx +0 -68
  97. package/packages/react-css/src/pages/index.ts +0 -3
  98. package/packages/react-css/src/useDocs.ts +0 -58
  99. package/packages/react-css/tsconfig.json +0 -19
  100. package/packages/react-css/tsup.config.ts +0 -10
  101. package/packages/shared/README.md +0 -1
  102. package/packages/shared/package.json +0 -31
  103. package/packages/shared/src/__tests__/docs.test.ts +0 -69
  104. package/packages/shared/src/config.ts +0 -80
  105. package/packages/shared/src/index.ts +0 -179
  106. package/packages/shared/src/providers/astro.ts +0 -94
  107. package/packages/shared/src/providers/fumadocs.ts +0 -116
  108. package/packages/shared/src/providers/internal.ts +0 -80
  109. package/packages/shared/src/types.ts +0 -73
  110. package/packages/shared/tsconfig.json +0 -18
  111. package/packages/shared/tsup.config.ts +0 -12
  112. package/packages/shared/vitest.config.ts +0 -4
  113. package/packages/solidjs/README.md +0 -1
  114. package/packages/solidjs/package.json +0 -33
  115. package/packages/solidjs/src/DocsLayout.tsx +0 -87
  116. package/packages/solidjs/src/DocsProvider.tsx +0 -95
  117. package/packages/solidjs/src/RouterDocsContent.tsx +0 -147
  118. package/packages/solidjs/src/RouterDocsLayout.tsx +0 -161
  119. package/packages/solidjs/src/components/Breadcrumbs.tsx +0 -27
  120. package/packages/solidjs/src/components/DocPage.tsx +0 -110
  121. package/packages/solidjs/src/components/DocSearch.tsx +0 -81
  122. package/packages/solidjs/src/components/DocSidebar.tsx +0 -92
  123. package/packages/solidjs/src/components/DocsLayout.tsx +0 -38
  124. package/packages/solidjs/src/components/EditButton.tsx +0 -15
  125. package/packages/solidjs/src/components/PageNavigation.tsx +0 -31
  126. package/packages/solidjs/src/components/TableOfContents.tsx +0 -41
  127. package/packages/solidjs/src/components/VersionSelector.tsx +0 -30
  128. package/packages/solidjs/src/components/index.ts +0 -9
  129. package/packages/solidjs/src/createDocs.ts +0 -62
  130. package/packages/solidjs/src/index.ts +0 -28
  131. package/packages/solidjs/src/pages/DocSearchPage.tsx +0 -72
  132. package/packages/solidjs/src/pages/DocViewPage.tsx +0 -80
  133. package/packages/solidjs/src/pages/DocsAdminPage.tsx +0 -123
  134. package/packages/solidjs/src/pages/DocsIndexPage.tsx +0 -85
  135. package/packages/solidjs/src/pages/index.ts +0 -4
  136. package/packages/solidjs/src/primitives/createDocSearch.ts +0 -42
  137. package/packages/solidjs/src/primitives/createDocs.ts +0 -35
  138. package/packages/solidjs/src/primitives/createDocsAdmin.ts +0 -63
  139. package/packages/solidjs/src/primitives/createTableOfContents.ts +0 -51
  140. package/packages/solidjs/src/primitives/index.ts +0 -4
  141. package/packages/solidjs/tsup.config.ts +0 -12
  142. package/packages/solidjs-css/README.md +0 -1
  143. package/packages/solidjs-css/package.json +0 -36
  144. package/packages/solidjs-css/src/DocsLayout.tsx +0 -106
  145. package/packages/solidjs-css/src/DocsProvider.tsx +0 -95
  146. package/packages/solidjs-css/src/RouterDocsContent.tsx +0 -54
  147. package/packages/solidjs-css/src/RouterDocsLayout.tsx +0 -104
  148. package/packages/solidjs-css/src/createDocs.ts +0 -62
  149. package/packages/solidjs-css/src/index.ts +0 -7
  150. package/packages/solidjs-css/src/index.tsx +0 -17
  151. package/packages/solidjs-css/src/pages/DocViewPage.tsx +0 -111
  152. package/packages/solidjs-css/src/pages/DocsAdminPage.tsx +0 -332
  153. package/packages/solidjs-css/src/pages/DocsIndexPage.tsx +0 -116
  154. package/packages/solidjs-css/src/pages/index.ts +0 -3
  155. package/packages/solidjs-css/src/primitives/index.ts +0 -1
  156. package/packages/solidjs-css/tsconfig.json +0 -20
  157. package/packages/solidjs-css/tsup.config.ts +0 -10
  158. package/pnpm-workspace.yaml +0 -2
@@ -0,0 +1,684 @@
1
+ import { GeeniusError, GeeniusErrorOptions, ErrorCode } from '@geenius/tools/errors';
2
+
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
+ /**
273
+ * @module docsConfig
274
+ * @package @geenius/docs-shared
275
+ * @description Stores and resolves the shared docs configuration used by every
276
+ * framework variant. The config is intentionally process-local so applications
277
+ * can opt into a single docs baseline during bootstrap.
278
+ */
279
+
280
+ /**
281
+ * Initialize the docs system with a configuration.
282
+ * Call this once at app startup before using any docs features.
283
+ *
284
+ * @param config - Configuration overrides applied for the current app runtime.
285
+ * @returns Nothing. The docs config is stored in module state.
286
+ *
287
+ * @example
288
+ * ```ts
289
+ * import { configureDocs } from '@geenius/docs-shared'
290
+ *
291
+ * configureDocs({
292
+ * baseUrl: '/docs',
293
+ * siteName: 'My Docs',
294
+ * versionsEnabled: true,
295
+ * })
296
+ * ```
297
+ */
298
+ declare function configureDocs(config: DocsConfig): void;
299
+ /**
300
+ * Get the current docs configuration.
301
+ * Throws if `configureDocs()` has not been called.
302
+ *
303
+ * @returns The active docs configuration for the current runtime.
304
+ * @throws {DocsConfigurationError} When the docs config has not been initialised.
305
+ */
306
+ declare function getDocsConfig(): DocsConfig;
307
+ /**
308
+ * Check if docs have been configured.
309
+ *
310
+ * @returns `true` when a config has been registered for the current runtime.
311
+ */
312
+ declare function isDocsConfigured(): boolean;
313
+ /**
314
+ * Reset docs configuration (useful for testing).
315
+ *
316
+ * @returns Nothing. The stored docs config is cleared.
317
+ */
318
+ declare function resetDocsConfig(): void;
319
+ /**
320
+ * Create a fully resolved docs config with defaults.
321
+ *
322
+ * @param overrides - Partial config overrides supplied by the caller.
323
+ * @returns A complete docs config with package defaults applied.
324
+ */
325
+ declare function defineDocsConfig(overrides: Partial<DocsConfig>): DocsConfig;
326
+ /**
327
+ * Merge an existing config with partial overrides.
328
+ *
329
+ * @param base - Existing base config to extend.
330
+ * @param overrides - Partial config overrides supplied by the caller.
331
+ * @returns A merged docs config object.
332
+ */
333
+ declare function mergeDocsConfig(base: DocsConfig, overrides: Partial<DocsConfig>): DocsConfig;
334
+
335
+ /**
336
+ * @module docsErrors
337
+ * @package @geenius/docs-shared
338
+ * @description Defines the typed error hierarchy used by the docs package so
339
+ * configuration, provider, and context failures can be caught and handled without
340
+ * relying on raw `Error` instances.
341
+ */
342
+
343
+ /**
344
+ * Supported structured error codes for docs-specific failures.
345
+ */
346
+ type DocsErrorCode = ErrorCode.INVALID_CONFIG | ErrorCode.MISSING_CONFIG | ErrorCode.NOT_FOUND | ErrorCode.INTERNAL_ERROR;
347
+ /**
348
+ * Structured error options for docs-specific failures.
349
+ */
350
+ interface DocsErrorOptions extends Omit<GeeniusErrorOptions, 'code'> {
351
+ code: DocsErrorCode;
352
+ }
353
+ /**
354
+ * Base structured error for the docs package.
355
+ *
356
+ * @param options - Error metadata describing the docs failure.
357
+ */
358
+ declare class DocsError extends GeeniusError {
359
+ constructor(options: DocsErrorOptions);
360
+ }
361
+ /**
362
+ * Error thrown when docs configuration is missing or invalid.
363
+ *
364
+ * @param options - Error metadata describing the configuration problem.
365
+ */
366
+ declare class DocsConfigurationError extends DocsError {
367
+ constructor(options: Omit<DocsErrorOptions, 'code'> & {
368
+ code?: ErrorCode.INVALID_CONFIG | ErrorCode.MISSING_CONFIG;
369
+ });
370
+ }
371
+ /**
372
+ * Error thrown when a docs provider or provider-backed hook is used incorrectly.
373
+ *
374
+ * @param options - Error metadata describing the provider failure.
375
+ */
376
+ declare class DocsProviderError extends DocsError {
377
+ constructor(options: Omit<DocsErrorOptions, 'code'> & {
378
+ code?: ErrorCode.NOT_FOUND | ErrorCode.INTERNAL_ERROR;
379
+ });
380
+ }
381
+
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
+ /**
614
+ * @module docsUtilities
615
+ * @package @geenius/docs-shared
616
+ * @description Hosts the framework-agnostic docs helpers used by the shared
617
+ * barrel and provider implementations for search, slugging, breadcrumbs, table
618
+ * of contents extraction, and default config resolution.
619
+ */
620
+
621
+ /**
622
+ * Extracts a nested table of contents from Markdown heading lines.
623
+ *
624
+ * @param mdxContent - Markdown or MDX content to parse.
625
+ * @returns A nested heading tree containing only level 2 through 4 headings.
626
+ */
627
+ declare function extractToc(mdxContent: string): TocItem[];
628
+ /**
629
+ * Calculates approximate word count and reading time for page content.
630
+ *
631
+ * @param content - Markdown or MDX content to measure.
632
+ * @returns Word count and reading-time metadata derived from the content.
633
+ */
634
+ declare function calcWordCount(content: string): {
635
+ wordCount: number;
636
+ readingTime: number;
637
+ };
638
+ /**
639
+ * Builds a breadcrumb trail for a page from a section tree.
640
+ *
641
+ * @param sections - Full section list used to resolve parent relationships.
642
+ * @param sectionId - Identifier of the page's containing section.
643
+ * @param slug - Page slug appended as the terminal breadcrumb.
644
+ * @returns Breadcrumb items suitable for page-level navigation UI.
645
+ */
646
+ declare function buildBreadcrumbs(sections: DocSection[], sectionId: string, slug: string): BreadcrumbItem[];
647
+ /**
648
+ * Builds a full-text search index from published pages and their sections.
649
+ *
650
+ * @param pages - Page records to index.
651
+ * @param sections - Section metadata used to enrich each result.
652
+ * @returns Search index entries derived from the published pages.
653
+ */
654
+ declare function buildDocsIndex(pages: DocPage[], sections: DocSection[]): SearchResult[];
655
+ /**
656
+ * Searches a shared search index and returns ranked matches.
657
+ *
658
+ * @param query - User-entered search query.
659
+ * @param index - Search index entries to rank.
660
+ * @returns Ranked search results limited to the top twenty entries.
661
+ */
662
+ declare function searchDocs(query: string, index: SearchResult[]): SearchResult[];
663
+ /**
664
+ * Creates a URL-safe slug from arbitrary text.
665
+ *
666
+ * @param title - Source text to slugify.
667
+ * @returns A lower-case kebab-case slug.
668
+ */
669
+ declare function slugify(title: string): string;
670
+ /**
671
+ * Produces a search-result snippet centred around a matching query.
672
+ *
673
+ * @param text - Source text used to build the snippet.
674
+ * @param query - User-entered search query.
675
+ * @param maxLen - Maximum snippet length.
676
+ * @returns A trimmed snippet containing the best query match when available.
677
+ */
678
+ declare function highlightMatch(text: string, query: string, maxLen?: number): string;
679
+ /**
680
+ * Baseline config used by the framework variants when no explicit config is provided.
681
+ */
682
+ declare const defaultDocsConfig: DocsConfig;
683
+
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 };