@blaaiz/docs-core 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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +103 -0
  3. package/dist/chunk-3ZX4WIE3.js +2984 -0
  4. package/dist/chunk-3ZX4WIE3.js.map +1 -0
  5. package/dist/chunk-JCYR6RPE.js +31 -0
  6. package/dist/chunk-JCYR6RPE.js.map +1 -0
  7. package/dist/chunk-ZKOOKLZ3.js +124 -0
  8. package/dist/chunk-ZKOOKLZ3.js.map +1 -0
  9. package/dist/cli.js +534 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/generator.cjs +508 -0
  12. package/dist/generator.cjs.map +1 -0
  13. package/dist/generator.d.cts +122 -0
  14. package/dist/generator.d.ts +122 -0
  15. package/dist/generator.js +177 -0
  16. package/dist/generator.js.map +1 -0
  17. package/dist/index.cjs +3024 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.cts +1182 -0
  20. package/dist/index.d.ts +1182 -0
  21. package/dist/index.js +3 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/navigation-CGqFIPlP.d.cts +498 -0
  24. package/dist/navigation-CGqFIPlP.d.ts +498 -0
  25. package/dist/openapi-types-CJ6p5Cux.d.cts +78 -0
  26. package/dist/openapi-types-CJ6p5Cux.d.ts +78 -0
  27. package/dist/ui/api-try-it.cjs +654 -0
  28. package/dist/ui/api-try-it.cjs.map +1 -0
  29. package/dist/ui/api-try-it.d.cts +78 -0
  30. package/dist/ui/api-try-it.d.ts +78 -0
  31. package/dist/ui/api-try-it.js +509 -0
  32. package/dist/ui/api-try-it.js.map +1 -0
  33. package/dist/ui/ask-ai.cjs +810 -0
  34. package/dist/ui/ask-ai.cjs.map +1 -0
  35. package/dist/ui/ask-ai.d.cts +57 -0
  36. package/dist/ui/ask-ai.d.ts +57 -0
  37. package/dist/ui/ask-ai.js +808 -0
  38. package/dist/ui/ask-ai.js.map +1 -0
  39. package/dist/ui/copy-page.cjs +312 -0
  40. package/dist/ui/copy-page.cjs.map +1 -0
  41. package/dist/ui/copy-page.d.cts +33 -0
  42. package/dist/ui/copy-page.d.ts +33 -0
  43. package/dist/ui/copy-page.js +183 -0
  44. package/dist/ui/copy-page.js.map +1 -0
  45. package/dist/ui/mermaid.cjs +363 -0
  46. package/dist/ui/mermaid.cjs.map +1 -0
  47. package/dist/ui/mermaid.d.cts +13 -0
  48. package/dist/ui/mermaid.d.ts +13 -0
  49. package/dist/ui/mermaid.js +361 -0
  50. package/dist/ui/mermaid.js.map +1 -0
  51. package/dist/ui.cjs +661 -0
  52. package/dist/ui.cjs.map +1 -0
  53. package/dist/ui.d.cts +428 -0
  54. package/dist/ui.d.ts +428 -0
  55. package/dist/ui.js +537 -0
  56. package/dist/ui.js.map +1 -0
  57. package/package.json +145 -0
  58. package/patches/fumadocs-openapi.patch +173 -0
  59. package/skills/AGENTS-section.md +36 -0
  60. package/skills/SKILL.md +363 -0
  61. package/styles/api-reference.css +1417 -0
  62. package/styles/ask-ai.css +563 -0
  63. package/styles/auth.css +462 -0
  64. package/styles/docs.css +247 -0
  65. package/styles/home.css +376 -0
  66. package/templates/init/content/docs/index.mdx.tmpl +52 -0
  67. package/templates/init/content/docs/meta.json.tmpl +3 -0
  68. package/templates/init/content/docs.json.tmpl +12 -0
  69. package/templates/init/content/nav.json.tmpl +7 -0
  70. package/templates/init/docs.config.ts.tmpl +36 -0
  71. package/templates/init/env.example.tmpl +15 -0
package/dist/ui.d.ts ADDED
@@ -0,0 +1,428 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { D as DocsConfig, N as Navigation, l as NavPage } from './navigation-CGqFIPlP.js';
4
+
5
+ /**
6
+ * Accordion components — the Mintlify `<Accordion>` and `<AccordionGroup>`.
7
+ * Built on the native `<details>` element, so they are interactive with zero
8
+ * client JavaScript and render in a Server Component. The hairline uses the
9
+ * framework's border token, so it follows the site's palette and the dark theme.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ /**
14
+ * A single collapsible section.
15
+ *
16
+ * @public
17
+ */
18
+ declare function Accordion({ title, children }: {
19
+ title: string;
20
+ children?: ReactNode;
21
+ }): react.JSX.Element;
22
+ /**
23
+ * A group of accordions.
24
+ *
25
+ * @public
26
+ */
27
+ declare function AccordionGroup({ children }: {
28
+ children?: ReactNode;
29
+ }): react.JSX.Element;
30
+
31
+ /**
32
+ * The Mintlify-style API operation layout: one two-column row for the whole
33
+ * operation, so the code rail starts level with the endpoint title. Pass it to
34
+ * fumadocs-openapi — the slots type is structural, so this module needs no
35
+ * fumadocs dependency and the site keeps ownership of that package.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * export const APIPage = createOpenAPIPage({
40
+ * content: { renderOperationLayout: apiOperationLayout },
41
+ * });
42
+ * ```
43
+ *
44
+ * @packageDocumentation
45
+ */
46
+ /**
47
+ * The slots fumadocs-openapi hands to `renderOperationLayout`.
48
+ *
49
+ * @public
50
+ */
51
+ interface ApiOperationSlots {
52
+ readonly header: ReactNode;
53
+ readonly description: ReactNode;
54
+ readonly apiPlayground: ReactNode;
55
+ readonly authSchemes: ReactNode;
56
+ readonly parameters: ReactNode;
57
+ readonly body: ReactNode;
58
+ readonly responses: ReactNode;
59
+ readonly callbacks: ReactNode;
60
+ readonly apiExample: ReactNode;
61
+ }
62
+ /**
63
+ * Render an API operation as title → description → playground → request details
64
+ * on the left, with the code/response rail as the right column. Pair with
65
+ * `@blaaiz/docs-core/styles/api-reference.css`, which anchors the rail to the
66
+ * viewport.
67
+ *
68
+ * @param slots - the operation slots from fumadocs-openapi
69
+ * @returns the two-column operation layout
70
+ * @public
71
+ */
72
+ declare function apiOperationLayout(slots: ApiOperationSlots): ReactNode;
73
+
74
+ /**
75
+ * Sidebar helpers for the API reference: a coloured HTTP-method badge and a
76
+ * page-tree transformer that prefixes each API page's sidebar entry with it —
77
+ * the Mintlify look (POST · GET · … next to the endpoint name). Server-
78
+ * compatible; styled by `styles/api-reference.css`.
79
+ *
80
+ * @packageDocumentation
81
+ */
82
+ /**
83
+ * A coloured HTTP-method pill (GET, POST, …).
84
+ *
85
+ * @param props - the HTTP method
86
+ * @public
87
+ */
88
+ declare function MethodBadge({ method }: {
89
+ method: string;
90
+ }): react.JSX.Element;
91
+ /**
92
+ * The minimal page-tree item this transformer touches. Structural, so the
93
+ * framework needs no fumadocs types; a site passes the result straight into
94
+ * `loader({ pageTree: { transformers } })`.
95
+ *
96
+ * @public
97
+ */
98
+ interface SidebarItem {
99
+ readonly type?: string;
100
+ readonly url?: string;
101
+ name?: ReactNode;
102
+ }
103
+ /**
104
+ * A page-tree transformer with a `file` hook, generic over the tree's own item
105
+ * type so it slots into fumadocs' `loader({ pageTree: { transformers } })`
106
+ * without a cast: `file` returns exactly the item type it was given.
107
+ *
108
+ * @public
109
+ */
110
+ interface SidebarBadgeTransformer {
111
+ file<T extends SidebarItem>(node: T): T;
112
+ }
113
+ /**
114
+ * A page-tree transformer that prefixes every API page's sidebar entry with its
115
+ * HTTP-method badge, matching endpoint URLs against the `methods` map the
116
+ * generator emits (`content/api-methods.json`).
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import methods from '@/content/api-methods.json';
121
+ * loader({ pageTree: { transformers: [apiMethodBadges(methods)] } });
122
+ * ```
123
+ *
124
+ * @param methods - map of page URL to HTTP method
125
+ * @returns a transformer with a `file` hook
126
+ * @public
127
+ */
128
+ declare function apiMethodBadges(methods: Readonly<Record<string, string>>): SidebarBadgeTransformer;
129
+
130
+ /**
131
+ * The sign-in screen for a workspace-gated docs site.
132
+ *
133
+ * A site renders one element — `<AuthScreen config={config} .../>` — and gets
134
+ * the whole gate: brand, the allowed-domain note, the providers its config
135
+ * declares (email, shared secret, Google), and an inline error banner. The
136
+ * shared-secret provider is a two-step flow — email, then secret — rendered by
137
+ * the `step` prop. The framework owns the layout and copy; the site owns only
138
+ * its config. Server-rendered: every form is a native POST, no client JS.
139
+ *
140
+ * @packageDocumentation
141
+ */
142
+
143
+ /**
144
+ * Map a sign-in error code (carried on `?error=` after a failed attempt) to a
145
+ * human sentence. Unknown codes get a safe generic message.
146
+ *
147
+ * @param code - the error code, or undefined
148
+ * @param domains - the allowed email domains, for the domain-mismatch message
149
+ * @returns the message to show, or null when there is no error
150
+ * @public
151
+ */
152
+ declare function authErrorMessage(code: string | undefined, domains: readonly string[]): string | null;
153
+ /**
154
+ * Props for {@link AuthScreen}.
155
+ *
156
+ * @public
157
+ */
158
+ interface AuthScreenProps {
159
+ /** The site configuration; drives brand, providers, and allowed domains. */
160
+ readonly config: DocsConfig;
161
+ /** The path to return to after sign-in (from the gate's `?from=`). */
162
+ readonly from?: string;
163
+ /** A sign-in error code to surface inline (from `?error=`). */
164
+ readonly error?: string;
165
+ /**
166
+ * Which step of the shared-secret flow to render. `'email'` (default) shows
167
+ * the email field; `'secret'` shows the secret field for the already-validated
168
+ * {@link AuthScreenProps.email}. Ignored unless the secret provider is enabled.
169
+ */
170
+ readonly step?: 'email' | 'secret';
171
+ /** The domain-checked email to show on the secret step (from the site's cookie). */
172
+ readonly email?: string;
173
+ /**
174
+ * Whether to offer the shared-secret flow. Defaults to whether config declares
175
+ * the secret provider; pass `false` when its env secret is absent. When on, it
176
+ * supersedes plain email sign-in.
177
+ */
178
+ readonly secretEnabled?: boolean;
179
+ /**
180
+ * Whether to offer the Google button. Defaults to whether config declares the
181
+ * Google provider; pass `false` to hide it when its env vars are absent.
182
+ */
183
+ readonly googleEnabled?: boolean;
184
+ /** The email sign-in endpoint. Default `/api/auth/email`. */
185
+ readonly emailAction?: string;
186
+ /** The shared-secret sign-in endpoint (both steps post here). Default `/api/auth/secret`. */
187
+ readonly secretAction?: string;
188
+ /** The Google sign-in start path. Default `/api/auth/google/start`. */
189
+ readonly googleStartPath?: string;
190
+ /** The sign-in page path, for the "use a different email" link. Default `/signin`. */
191
+ readonly signInPath?: string;
192
+ }
193
+ /**
194
+ * Render the sign-in screen.
195
+ *
196
+ * @param props - see {@link AuthScreenProps}
197
+ * @public
198
+ */
199
+ declare function AuthScreen(props: AuthScreenProps): ReactNode;
200
+
201
+ /**
202
+ * Callout components — the Mintlify `<Note>`, `<Warning>`, `<Info>`, and `<Tip>`
203
+ * blocks. Server-compatible: no client state, so they render in a React Server
204
+ * Component without a `'use client'` boundary.
205
+ *
206
+ * The box is styled by the `.cl` classes in `@blaaiz/docs-core/styles/docs.css`,
207
+ * which a site already imports. That is what makes a callout follow the dark
208
+ * theme: the class set carries a light and a dark palette per tone, where the
209
+ * inline colours these components used before could only ever be light.
210
+ *
211
+ * @packageDocumentation
212
+ */
213
+ type Tone = 'note' | 'warning' | 'info' | 'tip';
214
+ /**
215
+ * A tinted callout box with the tone's icon.
216
+ *
217
+ * @public
218
+ */
219
+ declare function Callout({ tone, children }: {
220
+ tone?: Tone;
221
+ children?: ReactNode;
222
+ }): react.JSX.Element;
223
+ /** Mintlify `<Note>`. @public */
224
+ declare function Note({ children }: {
225
+ children?: ReactNode;
226
+ }): react.JSX.Element;
227
+ /** Mintlify `<Warning>`. @public */
228
+ declare function Warning({ children }: {
229
+ children?: ReactNode;
230
+ }): react.JSX.Element;
231
+ /** Mintlify `<Info>`. @public */
232
+ declare function Info({ children }: {
233
+ children?: ReactNode;
234
+ }): react.JSX.Element;
235
+ /** Mintlify `<Tip>`. @public */
236
+ declare function Tip({ children }: {
237
+ children?: ReactNode;
238
+ }): react.JSX.Element;
239
+
240
+ /**
241
+ * Card components — the Mintlify `<Card>` and `<CardGroup>`. Server-compatible.
242
+ *
243
+ * Colours come from the framework's `--color-fd-*` theme variables, so a card
244
+ * follows the site's palette and the dark theme. Nothing here is a fixed hue.
245
+ *
246
+ * @packageDocumentation
247
+ */
248
+ /**
249
+ * A card. When `href` is set it renders as a link.
250
+ *
251
+ * @public
252
+ */
253
+ declare function Card({ title, href, children, }: {
254
+ title?: string;
255
+ href?: string;
256
+ children?: ReactNode;
257
+ }): react.JSX.Element;
258
+ /**
259
+ * A responsive grid of cards. `cols` sets the column count (default 2).
260
+ *
261
+ * @public
262
+ */
263
+ declare function CardGroup({ cols, children }: {
264
+ cols?: number;
265
+ children?: ReactNode;
266
+ }): react.JSX.Element;
267
+
268
+ /**
269
+ * Resolve a `docs.json` icon name to an inline SVG. Unknown names resolve to
270
+ * nothing, so the sidebar simply shows no icon rather than a broken one.
271
+ *
272
+ * @param name - the icon name from `docs.json`, or undefined
273
+ * @returns the icon element, or undefined
274
+ * @public
275
+ */
276
+ declare function docsIcon(name: string | undefined): ReactNode;
277
+
278
+ /**
279
+ * A general error screen with per-kind states.
280
+ *
281
+ * One component covers every full-page error a docs site shows — a missing page
282
+ * (404), a forbidden account (403), a runtime failure (500), an offline state —
283
+ * each with its own icon, eyebrow, and default copy. A site picks the `kind`
284
+ * and, for runtime errors, passes a retry action; the framework owns the rest.
285
+ * Server-compatible: the site's `error.tsx` wrapper carries the `'use client'`
286
+ * boundary and hands in the retry button.
287
+ *
288
+ * @packageDocumentation
289
+ */
290
+
291
+ /**
292
+ * The error states the screen renders.
293
+ *
294
+ * @public
295
+ */
296
+ type ErrorKind = 'not-found' | 'forbidden' | 'server' | 'offline' | 'unknown';
297
+ /**
298
+ * The default eyebrow, title, description, and icon for a {@link ErrorKind}.
299
+ *
300
+ * @public
301
+ */
302
+ interface ErrorPreset {
303
+ readonly code: string;
304
+ readonly title: string;
305
+ readonly description: string;
306
+ readonly icon: ReactNode;
307
+ }
308
+ /**
309
+ * The default preset for an error kind — its icon, eyebrow, and copy.
310
+ *
311
+ * @param kind - the error state
312
+ * @returns the preset a site can render or override
313
+ * @public
314
+ */
315
+ declare function errorPreset(kind: ErrorKind): ErrorPreset;
316
+ /**
317
+ * Props for {@link ErrorScreen}. Everything but `kind` is optional: the kind's
318
+ * preset fills the eyebrow, title, description, and icon unless overridden.
319
+ *
320
+ * @public
321
+ */
322
+ interface ErrorScreenProps {
323
+ /** Which error state to render. Default `unknown`. */
324
+ readonly kind?: ErrorKind;
325
+ /** Override the eyebrow code (e.g. a specific status). */
326
+ readonly code?: string;
327
+ /** Override the title. */
328
+ readonly title?: string;
329
+ /** Override the description. */
330
+ readonly description?: string;
331
+ /** When set, render a primary button linking here (e.g. `/docs`). */
332
+ readonly homeHref?: string;
333
+ /** Label for the home button. Default "Back to docs". */
334
+ readonly homeLabel?: string;
335
+ /** An extra action rendered beside the home button (e.g. a retry button). */
336
+ readonly action?: ReactNode;
337
+ }
338
+ /**
339
+ * Render the error screen.
340
+ *
341
+ * @param props - see {@link ErrorScreenProps}
342
+ * @public
343
+ */
344
+ declare function ErrorScreen(props: ErrorScreenProps): ReactNode;
345
+
346
+ /**
347
+ * Steps components — the Mintlify `<Steps>` and `<Step>`. Server-compatible.
348
+ *
349
+ * The spine uses the framework's border token, so it follows the site's palette
350
+ * and the dark theme.
351
+ *
352
+ * @packageDocumentation
353
+ */
354
+ /**
355
+ * An ordered list of steps.
356
+ *
357
+ * @public
358
+ */
359
+ declare function Steps({ children }: {
360
+ children?: ReactNode;
361
+ }): react.JSX.Element;
362
+ /**
363
+ * A single step with an optional title.
364
+ *
365
+ * @public
366
+ */
367
+ declare function Step({ title, children }: {
368
+ title?: string;
369
+ children?: ReactNode;
370
+ }): react.JSX.Element;
371
+
372
+ /**
373
+ * The Mintlify-compatible MDX component map.
374
+ *
375
+ * Pass this to an MDX renderer (for example `next-mdx-remote`'s `compileMDX`)
376
+ * so real Mintlify guides render unchanged. A site no longer needs to shim
377
+ * these itself.
378
+ *
379
+ * @public
380
+ */
381
+ declare const mdxComponents: {
382
+ Note: typeof Note;
383
+ Warning: typeof Warning;
384
+ Info: typeof Info;
385
+ Tip: typeof Tip;
386
+ Card: typeof Card;
387
+ CardGroup: typeof CardGroup;
388
+ Accordion: typeof Accordion;
389
+ AccordionGroup: typeof AccordionGroup;
390
+ Steps: typeof Steps;
391
+ Step: typeof Step;
392
+ };
393
+
394
+ /**
395
+ * The navigation sidebar. Renders a {@link Navigation} tree (produced by
396
+ * `parseNavigation`) as tabs, groups, and page links. Framework-agnostic: it
397
+ * emits plain anchors and takes an optional `resolveHref` so a site controls
398
+ * its own routing. Server-compatible.
399
+ *
400
+ * @packageDocumentation
401
+ */
402
+ /**
403
+ * Map a navigation page to a URL. Override to control routing — the default
404
+ * assumes one specific site shape, which is why {@link DocsSidebar} is
405
+ * deprecated.
406
+ *
407
+ * @public
408
+ */
409
+ type ResolveHref = (page: NavPage) => string;
410
+ /**
411
+ * Render the documentation sidebar.
412
+ *
413
+ * @deprecated Use fumadocs' `DocsLayout` with `loader({ icon: docsIcon })`,
414
+ * which both shipped sites use. This component predates that wiring: it renders
415
+ * plain anchors with no active state, no collapsible groups, and no search, and
416
+ * its default `resolveHref` assumes a routing shape (`/reference`, and
417
+ * `introduction` at the root) that no site now uses. Pass your own
418
+ * {@link ResolveHref} if you keep it. It stays exported, and behaves exactly as
419
+ * before, until the next major version.
420
+ *
421
+ * @public
422
+ */
423
+ declare function DocsSidebar({ nav, resolveHref, }: {
424
+ nav: Navigation;
425
+ resolveHref?: ResolveHref;
426
+ }): react.JSX.Element;
427
+
428
+ export { Accordion, AccordionGroup, type ApiOperationSlots, AuthScreen, type AuthScreenProps, Callout, Card, CardGroup, DocsSidebar, type ErrorKind, type ErrorPreset, ErrorScreen, type ErrorScreenProps, Info, MethodBadge, Note, type ResolveHref, type SidebarBadgeTransformer, type SidebarItem, Step, Steps, Tip, Warning, apiMethodBadges, apiOperationLayout, authErrorMessage, docsIcon, errorPreset, mdxComponents };