puredocs_v2 1.0.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 (66) hide show
  1. package/LICENSE +46 -0
  2. package/README.md +164 -0
  3. package/dist/api/http-client.d.ts +14 -0
  4. package/dist/api/snippets.d.ts +15 -0
  5. package/dist/components/app.d.ts +7 -0
  6. package/dist/components/layout/empty-state-page.d.ts +11 -0
  7. package/dist/components/layout/page-layout.d.ts +9 -0
  8. package/dist/components/modals/auth-modal.d.ts +17 -0
  9. package/dist/components/modals/modal-base.d.ts +15 -0
  10. package/dist/components/modals/search-modal.d.ts +6 -0
  11. package/dist/components/nav/route-nav.d.ts +2 -0
  12. package/dist/components/nav/sidebar.d.ts +13 -0
  13. package/dist/components/pages/endpoint.d.ts +3 -0
  14. package/dist/components/pages/overview.d.ts +2 -0
  15. package/dist/components/pages/tag-page.d.ts +2 -0
  16. package/dist/components/pages/webhook.d.ts +3 -0
  17. package/dist/components/shared/connection-settings.d.ts +2 -0
  18. package/dist/components/shared/copy-button.d.ts +12 -0
  19. package/dist/components/shared/editor-panel.d.ts +14 -0
  20. package/dist/components/shared/example-picker.d.ts +20 -0
  21. package/dist/components/shared/responses.d.ts +27 -0
  22. package/dist/components/shared/schema-viewer.d.ts +17 -0
  23. package/dist/components/shared/summary.d.ts +5 -0
  24. package/dist/components/shared/try-it.d.ts +20 -0
  25. package/dist/components/ui/badge.d.ts +24 -0
  26. package/dist/components/ui/breadcrumb.d.ts +12 -0
  27. package/dist/components/ui/button.d.ts +17 -0
  28. package/dist/components/ui/card.d.ts +25 -0
  29. package/dist/components/ui/index.d.ts +20 -0
  30. package/dist/components/ui/input.d.ts +20 -0
  31. package/dist/components/ui/lock-icon.d.ts +8 -0
  32. package/dist/components/ui/section.d.ts +8 -0
  33. package/dist/components/ui/select.d.ts +20 -0
  34. package/dist/core/auth-storage.d.ts +3 -0
  35. package/dist/core/effects.d.ts +33 -0
  36. package/dist/core/parser.d.ts +7 -0
  37. package/dist/core/persistence.d.ts +12 -0
  38. package/dist/core/router.d.ts +40 -0
  39. package/dist/core/search.d.ts +5 -0
  40. package/dist/core/security.d.ts +16 -0
  41. package/dist/core/state.d.ts +24 -0
  42. package/dist/core/theme.d.ts +9 -0
  43. package/dist/core/types.d.ts +291 -0
  44. package/dist/core/validation.d.ts +17 -0
  45. package/dist/helpers/debounce.d.ts +1 -0
  46. package/dist/helpers/schema-utils.d.ts +2 -0
  47. package/dist/helpers/text.d.ts +2 -0
  48. package/dist/helpers/validation-ui.d.ts +4 -0
  49. package/dist/index.d.ts +34 -0
  50. package/dist/lib/dom.d.ts +17 -0
  51. package/dist/lib/highlight.d.ts +8 -0
  52. package/dist/lib/icons.d.ts +24 -0
  53. package/dist/puredocs.cjs +49 -0
  54. package/dist/puredocs.cjs.map +1 -0
  55. package/dist/puredocs.css +1 -0
  56. package/dist/puredocs.js +5324 -0
  57. package/dist/puredocs.js.map +1 -0
  58. package/dist/puredocs.umd.js +49 -0
  59. package/dist/puredocs.umd.js.map +1 -0
  60. package/dist/server.cjs +117 -0
  61. package/dist/server.cjs.map +1 -0
  62. package/dist/server.d.ts +43 -0
  63. package/dist/server.js +116 -0
  64. package/dist/server.js.map +1 -0
  65. package/dist/services/env.d.ts +7 -0
  66. package/package.json +84 -0
package/LICENSE ADDED
@@ -0,0 +1,46 @@
1
+ PureDocs Non-Commercial License v1.0
2
+
3
+ Copyright (c) 2026 esurkov1
4
+
5
+ 1. Grant of Rights
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to use,
9
+ copy, modify, and distribute the Software for non-commercial purposes only,
10
+ subject to the conditions below.
11
+
12
+ 2. Conditions
13
+
14
+ - The above copyright notice and this license text must be included in all
15
+ copies or substantial portions of the Software.
16
+ - Any modified version must clearly indicate that changes were made.
17
+ - Distribution of modified versions must remain under this license.
18
+
19
+ 3. Commercial Use
20
+
21
+ Commercial use is not permitted under this license.
22
+
23
+ "Commercial use" means use of the Software in exchange for money, to provide a
24
+ paid service, as part of a paid product, or in any activity primarily intended
25
+ for commercial advantage or monetary compensation.
26
+
27
+ For commercial licensing terms, contact the author:
28
+ https://github.com/esurkov1
29
+
30
+ 4. Trademark
31
+
32
+ This license does not grant permission to use the project name, brand, or logo
33
+ except as necessary for fair attribution.
34
+
35
+ 5. Warranty Disclaimer
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
40
+
41
+ 6. Limitation of Liability
42
+
43
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
44
+ DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR
45
+ OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE
46
+ OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,164 @@
1
+ <p align="center">
2
+ <img src="apps/landing/assets/img/image1.png" alt="PureDocs — API Documentation Portal" width="720">
3
+ </p>
4
+
5
+ <h1 align="center">PureDocs</h1>
6
+
7
+ <p align="center">
8
+ Beautiful, interactive API documentation from any OpenAPI 3.1 spec.<br>
9
+ One function call for Express or Fastify. One Web Component for everything else.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://esurkov1.github.io/puredocs/">puredocs.dev</a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://www.npmjs.com/package/puredocs"><img src="https://img.shields.io/npm/v/puredocs?color=2563EB&label=npm" alt="npm"></a>
18
+ <a href="https://github.com/esurkov1/puredocs"><img src="https://img.shields.io/github/stars/esurkov1/puredocs?style=flat&logo=github" alt="GitHub stars"></a>
19
+ <a href="https://github.com/esurkov1/puredocs/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-see%20LICENSE-blue" alt="License"></a>
20
+ <img src="https://img.shields.io/badge/OpenAPI-3.1-green" alt="OpenAPI 3.1">
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## Features
26
+
27
+ - **Full OpenAPI 3.1** — paths, callbacks, webhooks, all HTTP methods, `$ref` resolution, `oneOf`/`anyOf`/`allOf`
28
+ - **Express & Fastify** — add a `/docs` route in one function call
29
+ - **Web Component** — drop `<pure-docs>` into React, Vue, Angular, Next.js, Nuxt, Svelte, or plain HTML
30
+ - **Live Try It Console** — send real requests, configure environments, switch auth
31
+ - **Smart Search** — Cmd+K to find endpoints, schemas, webhooks instantly
32
+ - **Light & Dark Theme** — auto-detects system preference or set manually
33
+ - **Full Auth Support** — Bearer, Basic, API Key, OAuth2, OpenID Connect
34
+ - **Multi-Language Snippets** — auto-generated cURL, JavaScript, Python, Go, Rust
35
+ - **JSON & YAML** — load specs in either format
36
+ - **Zero Config** — works out of the box with sensible defaults
37
+
38
+ ---
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ npm install puredocs
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ ### Express
49
+
50
+ ```ts
51
+ import express from 'express';
52
+ import { pureDocs } from 'puredocs';
53
+
54
+ const app = express();
55
+
56
+ pureDocs.express(app, {
57
+ route: '/docs',
58
+ specUrl: '/openapi.json',
59
+ });
60
+
61
+ app.listen(3000);
62
+ ```
63
+
64
+ ### Fastify
65
+
66
+ ```ts
67
+ import Fastify from 'fastify';
68
+ import { pureDocs } from 'puredocs';
69
+
70
+ const app = Fastify();
71
+
72
+ pureDocs.fastify(app, {
73
+ route: '/docs',
74
+ specUrl: '/openapi.json',
75
+ });
76
+
77
+ await app.listen({ port: 3000 });
78
+ ```
79
+
80
+ ### HTML
81
+
82
+ ```html
83
+ <pure-docs
84
+ spec-url="/openapi.json"
85
+ theme="auto"
86
+ ></pure-docs>
87
+
88
+ <script type="module">
89
+ import 'puredocs/web';
90
+ import 'puredocs/style.css';
91
+ </script>
92
+ ```
93
+
94
+ ### CDN (no bundler)
95
+
96
+ ```html
97
+ <link rel="stylesheet" href="https://unpkg.com/puredocs/dist/puredocs.css" />
98
+
99
+ <pure-docs spec-url="/openapi.json" theme="auto"></pure-docs>
100
+
101
+ <script src="https://unpkg.com/puredocs/dist/puredocs.umd.js"></script>
102
+ ```
103
+
104
+ ### Raw HTML Generation
105
+
106
+ ```ts
107
+ const html = pureDocs.html({
108
+ specUrl: '/openapi.json',
109
+ title: 'My API',
110
+ theme: 'auto',
111
+ });
112
+ // Returns a full self-contained HTML string — serve it however you want
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Configuration
118
+
119
+ ### Web Component Attributes
120
+
121
+ | Attribute | Type | Description |
122
+ |-----------|------|-------------|
123
+ | `spec-url` | `string` | OpenAPI spec URL (JSON or YAML) |
124
+ | `spec-json` | `string` | Inline OpenAPI object as JSON string |
125
+ | `theme` | `'light' \| 'dark' \| 'auto'` | Color theme (default: `auto`) |
126
+ | `title` | `string` | Portal title |
127
+ | `primary-color` | `string` | Accent color (hex) |
128
+
129
+ ### Server API Options
130
+
131
+ | Option | Type | Description |
132
+ |--------|------|-------------|
133
+ | `specUrl` | `string` | OpenAPI spec URL |
134
+ | `spec` | `object` | Inline OpenAPI object |
135
+ | `title` | `string` | Portal title |
136
+ | `theme` | `'light' \| 'dark' \| 'auto'` | Color theme |
137
+ | `primaryColor` | `string` | Accent color |
138
+ | `route` | `string` | Route path (default: `/docs`) |
139
+
140
+ ---
141
+
142
+ ## Works with Any Framework
143
+
144
+ PureDocs is a standard Web Component. It works in any framework that supports custom elements:
145
+
146
+ - **React / Next.js** — `import 'puredocs/web'` then use `<pure-docs>` in JSX
147
+ - **Vue / Nuxt** — add `isCustomElement` config, then use `<pure-docs>` in templates
148
+ - **Angular** — add `CUSTOM_ELEMENTS_SCHEMA`, then use `<pure-docs>` in templates
149
+ - **Svelte** — use `<pure-docs>` directly
150
+ - **Plain HTML** — just add the `<script>` and `<link>` tags
151
+
152
+ ---
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ bun run dev # dev server with hot reload
158
+ bun run build # production build
159
+ bun run typecheck # type checking
160
+ ```
161
+
162
+ ## License
163
+
164
+ See [LICENSE](./LICENSE).
@@ -0,0 +1,14 @@
1
+ import type { TryItResponse } from '../core/types';
2
+ interface RequestConfig {
3
+ method: string;
4
+ url: string;
5
+ headers?: Record<string, string>;
6
+ body?: string | FormData;
7
+ /** Timeout in ms */
8
+ timeout?: number;
9
+ }
10
+ /** Execute an HTTP request for the Try It console */
11
+ export declare function executeRequest(config: RequestConfig): Promise<TryItResponse>;
12
+ /** Build full URL from base, path, and parameters */
13
+ export declare function buildRequestUrl(baseUrl: string, pathTemplate: string, pathParams: Record<string, string>, queryParams: Record<string, string>): string;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ interface SnippetParams {
2
+ method: string;
3
+ url: string;
4
+ headers: Record<string, string>;
5
+ body?: string;
6
+ }
7
+ type Language = 'curl' | 'javascript' | 'python' | 'go' | 'rust';
8
+ export interface Snippet {
9
+ language: Language;
10
+ label: string;
11
+ code: string;
12
+ }
13
+ /** Generate code snippets for multiple languages */
14
+ export declare function generateSnippets(params: SnippetParams): Snippet[];
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { PortalConfig } from '../core/types';
2
+ /** Get current portal config */
3
+ export declare function getCurrentConfig(): PortalConfig | null;
4
+ /** Mount the full portal app into the container */
5
+ export declare function mountApp(container: HTMLElement, config: PortalConfig): void;
6
+ /** Unmount the portal */
7
+ export declare function unmountApp(): void;
@@ -0,0 +1,11 @@
1
+ export interface EmptyStateOptions {
2
+ title: string;
3
+ message?: string;
4
+ icon?: string;
5
+ variant?: 'loading' | 'error' | 'empty';
6
+ }
7
+ /**
8
+ * Helper for loading/error/empty pages.
9
+ * Returns ready page for render(pageSlotEl, createEmptyStatePage(...)).
10
+ */
11
+ export declare function createEmptyStatePage(opts: EmptyStateOptions): HTMLElement;
@@ -0,0 +1,9 @@
1
+ export interface ContentAreaLayout {
2
+ page: HTMLElement;
3
+ main: HTMLElement;
4
+ aside: HTMLElement;
5
+ }
6
+ /** Layout: page (main + aside). */
7
+ export declare function createContentArea(): ContentAreaLayout;
8
+ /** Enable/disable aside in page layout. */
9
+ export declare function setContentAreaAside(page: HTMLElement, hasAside: boolean): void;
@@ -0,0 +1,17 @@
1
+ import type { OperationSecurityInfo, SecurityRequirement, SecurityScheme } from '../../core/types';
2
+ /** Open authentication settings modal */
3
+ export declare function openAuthModal(securitySchemes: Record<string, SecurityScheme>, portalRoot?: HTMLElement, initialScheme?: string): void;
4
+ /** Get human-readable configured scheme label for display */
5
+ export declare function getSchemeStatusLabel(name: string, scheme: SecurityScheme): string;
6
+ /** Check if a specific scheme is configured */
7
+ export declare function isSchemeConfigured(name: string): boolean;
8
+ /** Check if operation's auth requirements are satisfied (token/schemes configured) */
9
+ export declare function isOperationAuthConfigured(security: OperationSecurityInfo | SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>): boolean;
10
+ /** Resolve auth headers for an operation's security requirements */
11
+ export declare function resolveAuthHeaders(security: OperationSecurityInfo | SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>): Record<string, string>;
12
+ /** Resolve auth query params for an operation's security requirements */
13
+ export declare function resolveAuthQuery(security: OperationSecurityInfo | SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>): Record<string, string>;
14
+ /** Resolve auth cookie values for an operation's security requirements */
15
+ export declare function resolveAuthCookies(security: OperationSecurityInfo | SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>): Record<string, string>;
16
+ /** Get placeholder header value for display (when no token configured) */
17
+ export declare function getAuthHeaderPlaceholder(security: OperationSecurityInfo | SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>): Record<string, string>;
@@ -0,0 +1,15 @@
1
+ export interface ModalBaseOptions {
2
+ overlayClass: string;
3
+ modalClass: string;
4
+ role?: string;
5
+ ariaLabel: string;
6
+ dataOverlayAttr: string;
7
+ onClose?: () => void;
8
+ }
9
+ export interface ModalBase {
10
+ overlay: HTMLElement;
11
+ modal: HTMLElement;
12
+ mount: (target?: ParentNode | null) => void;
13
+ close: () => void;
14
+ }
15
+ export declare function createModalBase(options: ModalBaseOptions): ModalBase;
@@ -0,0 +1,6 @@
1
+ /** Render and show the search modal */
2
+ export declare function showSearchModal(): void;
3
+ /** Close the search modal */
4
+ export declare function closeSearchModal(): void;
5
+ /** Setup global keyboard shortcut for search */
6
+ export declare function setupSearchShortcut(): () => void;
@@ -0,0 +1,2 @@
1
+ import type { RouteInfo } from '../../core/types';
2
+ export declare function renderRouteNavigation(currentRoute: RouteInfo): HTMLElement | null;
@@ -0,0 +1,13 @@
1
+ import type { PortalConfig } from '../../core/types';
2
+ import type { RouteInfo } from '../../core/types';
3
+ /** Update active state of items and expand group with active route */
4
+ export declare function updateSidebarActiveState(container: HTMLElement, currentRoute: RouteInfo): void;
5
+ /**
6
+ * Lightweight update: patch only auth-related elements in the sidebar
7
+ * (lock icons on endpoints + top auth button) without full re-render.
8
+ */
9
+ export declare function updateSidebarAuthState(container: HTMLElement): void;
10
+ /** Render the sidebar navigation */
11
+ export declare function renderSidebar(container: HTMLElement, config: PortalConfig): void;
12
+ /** Update the sidebar env <select> value to match current activeEnvironment */
13
+ export declare function updateSidebarEnvironment(container: HTMLElement): void;
@@ -0,0 +1,3 @@
1
+ import type { SpecOperation } from '../../core/types';
2
+ /** Render an endpoint detail page. Main block divided into 2 parts: doc | Try It + Code Examples */
3
+ export declare function renderEndpoint(pageSlot: HTMLElement, asideSlot: HTMLElement, operation: SpecOperation): Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Render the API overview page */
2
+ export declare function renderOverview(pageSlot: HTMLElement, _asideSlot: HTMLElement): Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Render a tag page — list of group operations */
2
+ export declare function renderTagPage(pageSlot: HTMLElement, _asideSlot: HTMLElement, tagName: string): void;
@@ -0,0 +1,3 @@
1
+ import type { SpecWebhook } from '../../core/types';
2
+ /** Render a webhook detail page — similar to endpoint but marked as Webhook, no Try It */
3
+ export declare function renderWebhookPage(pageSlot: HTMLElement, webhook: SpecWebhook): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { SecurityScheme } from '../../core/types';
2
+ export declare function createConnectionSettingsSections(securitySchemes: Record<string, SecurityScheme>, portalRoot?: HTMLElement): HTMLElement[];
@@ -0,0 +1,12 @@
1
+ export interface CopyButtonOptions {
2
+ getText: () => string | Promise<string>;
3
+ ariaLabel?: string;
4
+ copiedAriaLabel?: string;
5
+ className?: string;
6
+ onCopied?: () => void;
7
+ }
8
+ /**
9
+ * Shared icon button with copy/check feedback.
10
+ * Keeps copy interaction consistent across endpoint/try-it panels.
11
+ */
12
+ export declare function createCopyButton(options: CopyButtonOptions): HTMLButtonElement;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Auto-resize a plain textarea to fit its content.
3
+ * Used for response body/headers textareas (NOT the editor panel).
4
+ */
5
+ export declare function autoResizeTextarea(ta: HTMLTextAreaElement): void;
6
+ export declare function createEditorPanel(initialValue: string, lang: string, options?: {
7
+ dataField?: string;
8
+ onInput?: () => void;
9
+ }): {
10
+ wrap: HTMLElement;
11
+ textarea: HTMLTextAreaElement;
12
+ setValue: (v: string, highlightLang?: string) => void;
13
+ syncLayout: () => void;
14
+ };
@@ -0,0 +1,20 @@
1
+ import type { SpecMediaType, SpecParameter } from '../../core/types';
2
+ export interface ParamExampleSet {
3
+ name: string;
4
+ summary?: string;
5
+ values: Record<string, string>;
6
+ }
7
+ /** Extract example sets from path/query parameters (for GET, DELETE etc.) */
8
+ export declare function extractParamExampleSets(params: SpecParameter[]): ParamExampleSet[];
9
+ export interface ExampleOption {
10
+ name: string;
11
+ summary?: string;
12
+ description?: string;
13
+ value: unknown;
14
+ }
15
+ /** Extract named examples from a media type, with schema fallback */
16
+ export declare function extractExamples(mediaType: SpecMediaType): ExampleOption[];
17
+ /** Get display label for example, without duplicating summary/description */
18
+ export declare function getExampleLabel(ex: ExampleOption): string;
19
+ /** Format an example value as pretty JSON string */
20
+ export declare function formatExampleValue(value: unknown): string;
@@ -0,0 +1,27 @@
1
+ import type { SpecMediaType, SpecResponseHeader, SchemaObject } from '../../core/types';
2
+ export interface CollapsibleCategoryOptions {
3
+ title: string;
4
+ content: HTMLElement;
5
+ expanded?: boolean;
6
+ trailing?: HTMLElement;
7
+ counter?: number | string;
8
+ }
9
+ export interface SchemaBodyContent {
10
+ content: HTMLElement;
11
+ contentType: string;
12
+ schemaType: string;
13
+ itemsCount: number;
14
+ }
15
+ export interface ResponseTabData {
16
+ body: SchemaBodyContent;
17
+ headers: HTMLElement | null;
18
+ headersCount: number;
19
+ }
20
+ export declare function createSchemaBodyContent(contentType: string, mediaType: SpecMediaType | undefined, emptyText: string): SchemaBodyContent;
21
+ export declare function createBodyCategoryTrailing(body: SchemaBodyContent): HTMLElement;
22
+ export declare function getSchemaTopLevelCount(schema: SchemaObject): number;
23
+ export declare function createCollapsibleCategory(options: CollapsibleCategoryOptions): {
24
+ root: HTMLElement;
25
+ };
26
+ export declare function renderResponseHeadersList(headers: Record<string, SpecResponseHeader>): HTMLElement | null;
27
+ export declare function renderResponseCategories(data: ResponseTabData): HTMLElement;
@@ -0,0 +1,17 @@
1
+ import type { SchemaObject, SpecParameter } from '../../core/types';
2
+ export interface SchemaBodyResult {
3
+ body: HTMLElement;
4
+ toggleCollapse: () => void;
5
+ isExpanded: () => boolean;
6
+ hasExpandable: boolean;
7
+ }
8
+ /** Render only the schema tree body (no card wrapper). For custom headers (e.g. Responses). */
9
+ export declare function renderSchemaBody(schema: SchemaObject): SchemaBodyResult;
10
+ /** Render an expandable schema tree viewer */
11
+ export declare function renderSchemaViewer(schema: SchemaObject, title?: string | HTMLElement): HTMLElement;
12
+ export interface ParametersCardOptions {
13
+ headerTitle: string;
14
+ withEnumAndDefault?: boolean;
15
+ }
16
+ /** Parameters in the same style as schema (flat list). */
17
+ export declare function renderParametersCard(params: SpecParameter[], options: ParametersCardOptions): HTMLElement;
@@ -0,0 +1,5 @@
1
+ export interface SnapshotMetric {
2
+ label: string;
3
+ value: string | number;
4
+ }
5
+ export declare function createSummaryLine(metrics: SnapshotMetric[], methodCounts: Record<string, number>, emptyText?: string): HTMLElement;
@@ -0,0 +1,20 @@
1
+ import type { SpecOperation } from '../../core/types';
2
+ export interface InitialResponseExample {
3
+ statusCode: string;
4
+ statusText: string;
5
+ body: string;
6
+ }
7
+ export interface TryItConfig {
8
+ method: string;
9
+ url: string;
10
+ headers: Record<string, string>;
11
+ body?: string | FormData;
12
+ }
13
+ /** Collect current request config from Try It form (path, query, headers, body) */
14
+ export declare function collectRequestConfig(container: HTMLElement, operation: SpecOperation): TryItConfig;
15
+ /** Render the Try It interactive console */
16
+ export declare function renderTryIt(operation: SpecOperation, container: HTMLElement, initialResponse?: InitialResponseExample | null, options?: {
17
+ onConfigChange?: (config: TryItConfig) => void;
18
+ extraContent?: HTMLElement;
19
+ }): void;
20
+ export declare function createHeaderRow(name: string, value: string): HTMLElement;
@@ -0,0 +1,24 @@
1
+ export type BadgeSize = 's' | 'm' | 'l';
2
+ export type BadgeKind = 'method' | 'status' | 'webhook' | 'required' | 'chip';
3
+ export type BadgeColor = 'default' | 'transparent' | 'primary' | 'green' | 'blue' | 'orange' | 'purple' | 'red';
4
+ export interface BadgeProps {
5
+ text: string;
6
+ kind?: BadgeKind;
7
+ color?: BadgeColor;
8
+ size?: BadgeSize;
9
+ /** @deprecated All badges are monospace by default. */
10
+ mono?: boolean;
11
+ className?: string;
12
+ method?: string;
13
+ statusCode?: string;
14
+ }
15
+ /** Unified Badge primitive (`.badge` + kind + size + optional modifiers). */
16
+ export declare function createBadge(props: BadgeProps): HTMLElement;
17
+ /** Tab button based on badge. Used for Body/Headers, Code Example, etc. */
18
+ export declare function createTab(text: string, options?: {
19
+ active?: boolean;
20
+ context?: boolean;
21
+ }): HTMLButtonElement;
22
+ /** Tab button with response code (200, 404, etc.). Inherits badge + status styles. */
23
+ export declare function createResponseCodeTab(code: string, active?: boolean): HTMLButtonElement;
24
+ export declare function setResponseCodeTabActive(btn: HTMLElement, active: boolean): void;
@@ -0,0 +1,12 @@
1
+ export interface BreadcrumbItem {
2
+ label: string;
3
+ href?: string;
4
+ className?: string;
5
+ onClick?: (e: Event) => void;
6
+ }
7
+ export interface BreadcrumbOptions {
8
+ className?: string;
9
+ leading?: HTMLElement[];
10
+ trailing?: HTMLElement[];
11
+ }
12
+ export declare function createBreadcrumb(items: BreadcrumbItem[], options?: BreadcrumbOptions): HTMLElement;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Unified Button primitive.
3
+ * Variants: 'primary' | 'secondary' | 'ghost' | 'icon'
4
+ * Uses CSS classes: `.btn` + utility/modifier classes.
5
+ */
6
+ export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'icon';
7
+ export interface ButtonProps {
8
+ variant?: ButtonVariant;
9
+ label?: string;
10
+ icon?: string;
11
+ ariaLabel?: string;
12
+ disabled?: boolean;
13
+ className?: string;
14
+ onClick?: (e: Event) => void;
15
+ }
16
+ export declare function getButtonClasses(variant?: ButtonVariant): string[];
17
+ export declare function createButton(props: ButtonProps): HTMLButtonElement;
@@ -0,0 +1,25 @@
1
+ export interface CardProps {
2
+ /** If true — creates a simple card (`.card.simple`), otherwise structural (`.card`) */
3
+ simple?: boolean;
4
+ /** Interactive flag (adds interactive) */
5
+ interactive?: boolean;
6
+ /** Active flag (adds active) */
7
+ active?: boolean;
8
+ /** Additional classes */
9
+ className?: string;
10
+ /** Click handler */
11
+ onClick?: (e: Event) => void;
12
+ }
13
+ /** Creates a simple or structural card */
14
+ export declare function createCard(props?: CardProps): HTMLElement;
15
+ /** Creates header for structural card */
16
+ export declare function createCardHeader(...children: (HTMLElement | string)[]): HTMLElement;
17
+ /** Creates body for structural card */
18
+ export declare function createCardBody(variant?: 'default' | 'code' | 'no-padding'): HTMLElement;
19
+ export interface CardHeaderRowOptions {
20
+ title: string | HTMLElement;
21
+ leading?: HTMLElement | string;
22
+ trailing?: HTMLElement | string | number;
23
+ className?: string;
24
+ }
25
+ export declare function createCardHeaderRow(options: CardHeaderRowOptions): HTMLElement;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * UI Primitives — unified re-exports.
3
+ */
4
+ export { createSelect } from './select';
5
+ export type { SelectOption, SelectProps } from './select';
6
+ export { createInput } from './input';
7
+ export type { InputProps } from './input';
8
+ export { createButton } from './button';
9
+ export type { ButtonVariant, ButtonProps } from './button';
10
+ export { createCard, createCardHeader, createCardBody } from './card';
11
+ export { createCardHeaderRow } from './card';
12
+ export type { CardProps, CardHeaderRowOptions } from './card';
13
+ export { createBadge, createTab, createResponseCodeTab, setResponseCodeTabActive } from './badge';
14
+ export type { BadgeProps, BadgeKind, BadgeSize, BadgeColor } from './badge';
15
+ export { createSection, createSectionTitleWrap } from './section';
16
+ export type { SectionOptions } from './section';
17
+ export { createBreadcrumb } from './breadcrumb';
18
+ export type { BreadcrumbItem, BreadcrumbOptions } from './breadcrumb';
19
+ export { createLockIcon } from './lock-icon';
20
+ export type { CreateLockIconOptions } from './lock-icon';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Unified Input primitive.
3
+ * Base styles — by input tag (forms.css).
4
+ */
5
+ export type InputModifier = 'filled' | 'invalid';
6
+ export interface InputProps {
7
+ type?: string;
8
+ placeholder?: string;
9
+ value?: string;
10
+ ariaLabel?: string;
11
+ required?: boolean;
12
+ readOnly?: boolean;
13
+ invalid?: boolean;
14
+ modifiers?: InputModifier[];
15
+ dataAttrs?: Record<string, string>;
16
+ className?: string;
17
+ onInput?: (value: string) => void;
18
+ onChange?: (value: string) => void;
19
+ }
20
+ export declare function createInput(props: InputProps): HTMLInputElement;
@@ -0,0 +1,8 @@
1
+ export interface CreateLockIconOptions {
2
+ configured: boolean;
3
+ variant?: 'tag' | 'nav' | 'endpoint';
4
+ label?: string;
5
+ title?: string;
6
+ }
7
+ /** Common factory for lock/unlock icons in navigation, cards, and endpoint */
8
+ export declare function createLockIcon(options: CreateLockIconOptions): HTMLElement;
@@ -0,0 +1,8 @@
1
+ export interface SectionOptions {
2
+ title?: string;
3
+ titleEl?: HTMLElement;
4
+ badge?: string | number | HTMLElement;
5
+ className?: string;
6
+ }
7
+ export declare function createSectionTitleWrap(title: string | HTMLElement, badge?: string | number | HTMLElement): HTMLElement;
8
+ export declare function createSection(options: SectionOptions, ...children: (HTMLElement | string)[]): HTMLElement;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Unified Select primitive.
3
+ * Base styles — by select tag (forms.css).
4
+ * variant: inline → data-variant="inline"
5
+ */
6
+ export interface SelectOption {
7
+ value: string;
8
+ label: string;
9
+ }
10
+ export interface SelectProps {
11
+ options: SelectOption[];
12
+ value?: string;
13
+ ariaLabel?: string;
14
+ onChange?: (value: string) => void;
15
+ className?: string;
16
+ variant?: 'default' | 'inline';
17
+ invalid?: boolean;
18
+ dataAttrs?: Record<string, string>;
19
+ }
20
+ export declare function createSelect(props: SelectProps): HTMLSelectElement;