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
@@ -0,0 +1,3 @@
1
+ import type { AuthState, SecurityScheme } from './types';
2
+ export declare function areAuthStatesEqual(a: AuthState, b: AuthState): boolean;
3
+ export declare function reconcileAuthWithSecuritySchemes(auth: AuthState, securitySchemes: Record<string, SecurityScheme>): AuthState;
@@ -0,0 +1,33 @@
1
+ import type { PortalState } from './types';
2
+ type EffectHandler = (state: PortalState) => void;
3
+ type CleanupFn = () => void;
4
+ /**
5
+ * Page-scoped reactive effects manager.
6
+ *
7
+ * Each page component registers its own effects at render time via `useEffects()`.
8
+ * When state changes (env / auth) without a route change, `notifyEffects()` runs
9
+ * all registered handlers so every component can update itself.
10
+ * On route change, `disposeEffects()` tears everything down cleanly.
11
+ *
12
+ * This replaces the monolithic `updateEnvironmentState` in app.ts — each component
13
+ * now owns its reactive behaviour.
14
+ */
15
+ declare class Effects {
16
+ private handlers;
17
+ private cleanupFns;
18
+ /** Register a named reactive handler that runs on every state change */
19
+ on(key: string, handler: EffectHandler): void;
20
+ /** Register a cleanup callback (runs on dispose) */
21
+ onCleanup(fn: CleanupFn): void;
22
+ /** Run all registered handlers with current state */
23
+ notify(state: PortalState): void;
24
+ /** Dispose: run cleanups and clear all handlers */
25
+ dispose(): void;
26
+ }
27
+ /** Get the current page effects instance (creates one if needed) */
28
+ export declare function useEffects(): Effects;
29
+ /** Notify all page effects of a state change (env / auth) */
30
+ export declare function notifyEffects(state: PortalState): void;
31
+ /** Dispose current effects — call on route change / unmount */
32
+ export declare function disposeEffects(): void;
33
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ParsedSpec, SchemaObject } from './types';
2
+ /** Parse and normalize an OpenAPI 3.x spec */
3
+ export declare function parseSpec(raw: Record<string, unknown>): ParsedSpec;
4
+ /** Generate a sample value from a schema when no example is provided */
5
+ export declare function generateExample(schema: SchemaObject | undefined): unknown;
6
+ /** Load spec from URL (JSON or YAML) */
7
+ export declare function loadSpec(url: string): Promise<Record<string, unknown>>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Persist portal state (env, baseUrl, auth) to localStorage
3
+ * so values survive page refresh.
4
+ */
5
+ import type { PortalEnvironment, AuthState } from './types';
6
+ export interface PersistedState {
7
+ activeEnvironment: string;
8
+ environments: PortalEnvironment[];
9
+ auth: AuthState;
10
+ }
11
+ export declare function loadPersisted(): PersistedState | null;
12
+ export declare function savePersisted(data: PersistedState): void;
@@ -0,0 +1,40 @@
1
+ import type { RouteInfo } from './types';
2
+ /** Initialize the hash-based router */
3
+ export declare function initRouter(base?: string): void;
4
+ /** Remove all router event listeners */
5
+ export declare function destroyRouter(): void;
6
+ /** Push a new hash path and trigger a route change */
7
+ export declare function navigate(path: string): void;
8
+ /**
9
+ * Build a human-readable URL from a RouteInfo object.
10
+ *
11
+ * URL patterns:
12
+ * #/ → Overview
13
+ * #/{tag} → Tag page
14
+ * #/{tag}/{method}/{apiPath} → Endpoint
15
+ * #/schemas/{name} → Schema
16
+ * #/webhooks/{name} → Webhook
17
+ * #/guides/{path} → Guide
18
+ *
19
+ * Examples:
20
+ * #/users → "Users" tag page
21
+ * #/users/get/users/{id} → GET /users/{id} in "Users" tag
22
+ * #/pets/post/pets → POST /pets in "Pets" tag
23
+ * #/schemas/UserResponse → Schema "UserResponse"
24
+ */
25
+ export declare function buildPath(route: RouteInfo): string;
26
+ /**
27
+ * Parse a raw hash path into a RouteInfo object.
28
+ *
29
+ * Handles URL-encoded segments, normalizes slashes,
30
+ * and strips query strings.
31
+ */
32
+ export declare function parsePath(rawPath: string): RouteInfo;
33
+ /**
34
+ * Convert a tag name to a URL-friendly slug.
35
+ *
36
+ * "User Management" → "user-management"
37
+ * "Pets" → "pets"
38
+ * "auth/v2" → "auth-v2"
39
+ */
40
+ export declare function slugifyTag(tag: string): string;
@@ -0,0 +1,5 @@
1
+ import type { ParsedSpec, SearchEntry } from './types';
2
+ /** Build search index from parsed spec */
3
+ export declare function buildSearchIndex(spec: ParsedSpec): void;
4
+ /** Search the index with a query string */
5
+ export declare function search(query: string, limit?: number): SearchEntry[];
@@ -0,0 +1,16 @@
1
+ import type { OperationSecurityInfo, SecurityRequirement, SecurityScheme } from './types';
2
+ export interface OperationAuthResolved {
3
+ headers: Record<string, string>;
4
+ query: Record<string, string>;
5
+ cookies: Record<string, string>;
6
+ matchedSchemeNames: string[];
7
+ }
8
+ export declare function normalizeSecurityRequirements(raw: unknown): SecurityRequirement[] | undefined;
9
+ export declare function resolveOperationSecurityInfo(requirements: SecurityRequirement[] | undefined, securitySchemes: Record<string, SecurityScheme>, explicitlyNoAuth: boolean): OperationSecurityInfo;
10
+ export declare function hasOperationAuth(info: OperationSecurityInfo | undefined): boolean;
11
+ export declare function getSecuritySchemeBadge(scheme: SecurityScheme | undefined): string;
12
+ export declare function getOperationSecurityBadges(info: OperationSecurityInfo | undefined): string[];
13
+ export declare function formatOperationAuthBadge(info: OperationSecurityInfo | undefined): string | null;
14
+ export declare function formatOperationAuthTitle(info: OperationSecurityInfo | undefined): string;
15
+ export declare function resolveOperationAuth(info: OperationSecurityInfo | undefined, configuredSchemes: Record<string, string>, activeScheme: string, fallbackToken: string): OperationAuthResolved;
16
+ export declare function getOperationAuthHeaderPlaceholders(info: OperationSecurityInfo | undefined): Record<string, string>;
@@ -0,0 +1,24 @@
1
+ import type { PortalState, AuthState, TryItState, RouteInfo } from './types';
2
+ type Listener = (state: PortalState) => void;
3
+ type PartialUpdate = Partial<PortalState>;
4
+ /** Simple reactive state store */
5
+ declare class Store {
6
+ private state;
7
+ private listeners;
8
+ constructor();
9
+ private defaultState;
10
+ get(): PortalState;
11
+ set(update: PartialUpdate): void;
12
+ setAuth(update: Partial<AuthState>): void;
13
+ /** Update a specific scheme value and sync token if it's the active scheme */
14
+ setSchemeValue(schemeName: string, value: string): void;
15
+ setTryIt(update: Partial<TryItState> | null): void;
16
+ setRoute(route: RouteInfo): void;
17
+ /** Switch active environment */
18
+ setActiveEnvironment(name: string): void;
19
+ subscribe(fn: Listener): () => void;
20
+ private notify;
21
+ reset(): void;
22
+ }
23
+ export declare const store: Store;
24
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface ThemeConfig {
2
+ primaryColor?: string;
3
+ }
4
+ /** Theme class switching only and optional config overrides */
5
+ export declare function applyTheme(root: HTMLElement, themeMode: 'light' | 'dark', config?: ThemeConfig): void;
6
+ /** Toggle between light and dark theme */
7
+ export declare function toggleTheme(): void;
8
+ /** Detect initial theme */
9
+ export declare function detectTheme(preference?: 'light' | 'dark' | 'auto'): 'light' | 'dark';
@@ -0,0 +1,291 @@
1
+ export interface PortalConfig {
2
+ /** CSS selector or HTMLElement to mount into */
3
+ mount: string | HTMLElement;
4
+ /** URL to fetch the OpenAPI spec from */
5
+ specUrl?: string;
6
+ /** Inline OpenAPI spec object */
7
+ spec?: Record<string, unknown>;
8
+ /** Portal title override */
9
+ title?: string;
10
+ /** Initial theme */
11
+ theme?: 'light' | 'dark' | 'auto';
12
+ /** Primary accent color (hex) */
13
+ primaryColor?: string;
14
+ /** Hide Try It console */
15
+ hideTryIt?: boolean;
16
+ /** Hide deprecated endpoints */
17
+ hideDeprecated?: boolean;
18
+ /** Hide schema viewer */
19
+ hideSchemas?: boolean;
20
+ /** Language */
21
+ locale?: 'en' | 'ru';
22
+ /** Plugin hooks */
23
+ plugins?: PortalPlugin[];
24
+ }
25
+ /** Zero-boilerplate startup config: auto-create mount and optional CSS link injection */
26
+ export interface PortalBootstrapConfig extends Omit<PortalConfig, 'mount'> {
27
+ /** Existing mount selector/element. If omitted, container is auto-created in body. */
28
+ mount?: string | HTMLElement;
29
+ /** Auto-created mount id when mount is omitted. Default: "puredocs". */
30
+ mountId?: string;
31
+ /** Apply minimal full-page layout styles. Default: true. */
32
+ fullPage?: boolean;
33
+ /** Optional stylesheet URL to inject once (useful for plain JS/UMD). */
34
+ cssHref?: string;
35
+ }
36
+ export interface PortalEnvironment {
37
+ name: string;
38
+ baseUrl: string;
39
+ variables?: Record<string, string>;
40
+ bearerToken?: string;
41
+ }
42
+ export interface PortalPlugin {
43
+ name: string;
44
+ init?: (portal: PortalApi) => void;
45
+ destroy?: () => void;
46
+ }
47
+ export interface PortalApi {
48
+ getState: () => PortalState;
49
+ subscribe: (fn: (state: PortalState) => void) => () => void;
50
+ setToken: (token: string) => void;
51
+ setEnvironment: (name: string) => void;
52
+ navigate: (path: string) => void;
53
+ }
54
+ export interface PortalState {
55
+ spec: ParsedSpec | null;
56
+ loading: boolean;
57
+ error: string | null;
58
+ route: RouteInfo;
59
+ theme: 'light' | 'dark';
60
+ sidebarOpen: boolean;
61
+ searchOpen: boolean;
62
+ activeEnvironment: string;
63
+ environments: PortalEnvironment[];
64
+ /** Canonical env list from config/spec — baseUrl reset to this when switching env */
65
+ initialEnvironments: PortalEnvironment[];
66
+ auth: AuthState;
67
+ tryItState: TryItState | null;
68
+ }
69
+ export interface AuthState {
70
+ /** Per-scheme configured values: schemeName -> value (token/apiKey/etc.) */
71
+ schemes: Record<string, string>;
72
+ /** Currently active scheme name */
73
+ activeScheme: string;
74
+ /** Derived token for requests (from active scheme) */
75
+ token: string;
76
+ locked: boolean;
77
+ source: 'manual' | 'auto-body' | 'auto-header';
78
+ }
79
+ export interface TryItState {
80
+ operationId: string;
81
+ response: TryItResponse | null;
82
+ loading: boolean;
83
+ }
84
+ export interface TryItResponse {
85
+ status: number;
86
+ statusText: string;
87
+ headers: Record<string, string>;
88
+ body: string;
89
+ duration: number;
90
+ size: number;
91
+ }
92
+ export interface RouteInfo {
93
+ type: 'overview' | 'endpoint' | 'schema' | 'guide' | 'tag' | 'webhook';
94
+ tag?: string;
95
+ method?: string;
96
+ path?: string;
97
+ operationId?: string;
98
+ schemaName?: string;
99
+ guidePath?: string;
100
+ webhookName?: string;
101
+ }
102
+ export interface ParsedSpec {
103
+ raw: Record<string, unknown>;
104
+ info: SpecInfo;
105
+ servers: SpecServer[];
106
+ tags: SpecTag[];
107
+ operations: SpecOperation[];
108
+ schemas: Record<string, SchemaObject>;
109
+ securitySchemes: Record<string, SecurityScheme>;
110
+ webhooks: SpecWebhook[];
111
+ }
112
+ export interface SpecInfo {
113
+ title: string;
114
+ description?: string;
115
+ version: string;
116
+ contact?: {
117
+ name?: string;
118
+ email?: string;
119
+ url?: string;
120
+ };
121
+ license?: {
122
+ name: string;
123
+ url?: string;
124
+ };
125
+ }
126
+ export interface SpecServer {
127
+ url: string;
128
+ description?: string;
129
+ variables?: Record<string, {
130
+ default: string;
131
+ enum?: string[];
132
+ description?: string;
133
+ }>;
134
+ }
135
+ export interface SpecTag {
136
+ name: string;
137
+ description?: string;
138
+ operations: SpecOperation[];
139
+ }
140
+ export interface SpecOperation {
141
+ operationId: string;
142
+ method: string;
143
+ path: string;
144
+ summary?: string;
145
+ description?: string;
146
+ tags: string[];
147
+ deprecated?: boolean;
148
+ security?: SecurityRequirement[];
149
+ resolvedSecurity?: OperationSecurityInfo;
150
+ parameters: SpecParameter[];
151
+ requestBody?: SpecRequestBody;
152
+ responses: Record<string, SpecResponse>;
153
+ callbacks?: SpecCallback[];
154
+ }
155
+ export interface SpecWebhook {
156
+ /** Key from the webhooks object */
157
+ name: string;
158
+ method: string;
159
+ /** URL template (usually runtime expression) */
160
+ path: string;
161
+ summary?: string;
162
+ description?: string;
163
+ security?: SecurityRequirement[];
164
+ resolvedSecurity?: OperationSecurityInfo;
165
+ parameters: SpecParameter[];
166
+ requestBody?: SpecRequestBody;
167
+ responses: Record<string, SpecResponse>;
168
+ }
169
+ export interface SpecCallback {
170
+ /** Key from the callbacks object */
171
+ name: string;
172
+ operations: SpecOperation[];
173
+ }
174
+ export interface SpecParameter {
175
+ name: string;
176
+ in: 'path' | 'query' | 'header' | 'cookie';
177
+ required?: boolean;
178
+ description?: string;
179
+ schema?: SchemaObject;
180
+ example?: unknown;
181
+ examples?: Record<string, SpecExample>;
182
+ deprecated?: boolean;
183
+ }
184
+ export interface SpecRequestBody {
185
+ description?: string;
186
+ required?: boolean;
187
+ content: Record<string, SpecMediaType>;
188
+ }
189
+ export interface SpecMediaType {
190
+ schema?: SchemaObject;
191
+ example?: unknown;
192
+ examples?: Record<string, SpecExample>;
193
+ }
194
+ export interface SpecResponseHeader {
195
+ description?: string;
196
+ required?: boolean;
197
+ schema?: SchemaObject;
198
+ example?: unknown;
199
+ deprecated?: boolean;
200
+ }
201
+ export interface SpecResponse {
202
+ statusCode: string;
203
+ description?: string;
204
+ headers?: Record<string, SpecResponseHeader>;
205
+ content?: Record<string, SpecMediaType>;
206
+ }
207
+ export interface SpecExample {
208
+ summary?: string;
209
+ description?: string;
210
+ value: unknown;
211
+ }
212
+ export interface SecurityScheme {
213
+ type: string;
214
+ scheme?: string;
215
+ bearerFormat?: string;
216
+ description?: string;
217
+ in?: string;
218
+ name?: string;
219
+ openIdConnectUrl?: string;
220
+ flows?: Record<string, SecurityOAuthFlow>;
221
+ }
222
+ export interface SecurityOAuthFlow {
223
+ authorizationUrl?: string;
224
+ tokenUrl?: string;
225
+ refreshUrl?: string;
226
+ scopes?: Record<string, string>;
227
+ }
228
+ export type SecurityRequirement = Record<string, string[]>;
229
+ export interface ResolvedSecuritySchemeRequirement {
230
+ schemeName: string;
231
+ scopes: string[];
232
+ scheme?: SecurityScheme;
233
+ }
234
+ export interface OperationSecurityInfo {
235
+ explicitlyNoAuth: boolean;
236
+ requirements: ResolvedSecuritySchemeRequirement[][];
237
+ }
238
+ export interface SchemaObject {
239
+ type?: string;
240
+ format?: string;
241
+ title?: string;
242
+ description?: string;
243
+ default?: unknown;
244
+ example?: unknown;
245
+ examples?: unknown[];
246
+ enum?: unknown[];
247
+ const?: unknown;
248
+ nullable?: boolean;
249
+ deprecated?: boolean;
250
+ readOnly?: boolean;
251
+ writeOnly?: boolean;
252
+ required?: string[];
253
+ properties?: Record<string, SchemaObject>;
254
+ additionalProperties?: boolean | SchemaObject;
255
+ items?: SchemaObject;
256
+ allOf?: SchemaObject[];
257
+ oneOf?: SchemaObject[];
258
+ anyOf?: SchemaObject[];
259
+ discriminator?: {
260
+ propertyName: string;
261
+ mapping?: Record<string, string>;
262
+ };
263
+ minLength?: number;
264
+ maxLength?: number;
265
+ minimum?: number;
266
+ maximum?: number;
267
+ pattern?: string;
268
+ minItems?: number;
269
+ maxItems?: number;
270
+ uniqueItems?: boolean;
271
+ $ref?: string;
272
+ [key: string]: unknown;
273
+ }
274
+ export interface SearchEntry {
275
+ type: 'operation' | 'schema' | 'tag' | 'webhook';
276
+ title: string;
277
+ subtitle?: string;
278
+ method?: string;
279
+ requiresAuth?: boolean;
280
+ authBadge?: string;
281
+ authTitle?: string;
282
+ resolvedSecurity?: OperationSecurityInfo;
283
+ path?: string;
284
+ tag?: string;
285
+ operationId?: string;
286
+ schemaName?: string;
287
+ webhookName?: string;
288
+ keywords: string;
289
+ }
290
+ export type UiBadgeSize = 's' | 'm' | 'l';
291
+ export type UiBadgeKind = 'method' | 'status' | 'webhook' | 'required' | 'chip';
@@ -0,0 +1,17 @@
1
+ import type { SchemaObject, SpecOperation, SpecParameter } from './types';
2
+ export interface ValidationError {
3
+ field: string;
4
+ message: string;
5
+ /** 'param' | 'body' */
6
+ kind: 'param' | 'body';
7
+ }
8
+ export interface ValidationResult {
9
+ valid: boolean;
10
+ message?: string;
11
+ }
12
+ /** Validate a single parameter value against its schema */
13
+ export declare function validateParam(value: string, param: SpecParameter): ValidationResult;
14
+ /** Validate the request body string */
15
+ export declare function validateBody(bodyStr: string, contentType: string, schema?: SchemaObject, required?: boolean): ValidationResult;
16
+ /** Validate all fields in a Try It form. Returns array of errors (empty = valid). */
17
+ export declare function validateAll(container: HTMLElement, operation: SpecOperation): ValidationError[];
@@ -0,0 +1 @@
1
+ export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, ms: number): T;
@@ -0,0 +1,2 @@
1
+ import type { SchemaObject } from '../core/types';
2
+ export declare function getSchemaTypeLabel(schema: SchemaObject): string;
@@ -0,0 +1,2 @@
1
+ export declare function looksLikeJson(str: string): boolean;
2
+ export declare function escapeHtml(str: string): string;
@@ -0,0 +1,4 @@
1
+ import type { ValidationError } from '../core/validation';
2
+ export declare function clearValidationErrors(container: HTMLElement): void;
3
+ export declare function showValidationErrors(container: HTMLElement, errors: ValidationError[]): void;
4
+ export declare function createErrorPlaceholder(field: string): HTMLElement;
@@ -0,0 +1,34 @@
1
+ import './styles/index.css';
2
+ import type { PortalConfig, PortalApi, PortalState, PortalBootstrapConfig } from './core/types';
3
+ /** Mount the portal into the DOM */
4
+ declare function mount(config: PortalConfig): Promise<PortalApi>;
5
+ /** Universal zero-boilerplate startup for JS consumers */
6
+ declare function bootstrap(config: PortalBootstrapConfig): Promise<PortalApi>;
7
+ /** Unmount portal and cleanup */
8
+ declare function unmount(): void;
9
+ export declare class PureDocsElement extends HTMLElement {
10
+ private static activeElement;
11
+ private api;
12
+ private reloadTimer;
13
+ static get observedAttributes(): string[];
14
+ connectedCallback(): Promise<void>;
15
+ disconnectedCallback(): void;
16
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
17
+ reload(): Promise<void>;
18
+ getState(): PortalState | null;
19
+ subscribe(fn: (state: PortalState) => void): () => void;
20
+ navigate(path: string): void;
21
+ setToken(token: string): void;
22
+ setEnvironment(name: string): void;
23
+ private mountFromAttributes;
24
+ private parseConfig;
25
+ private renderSingletonError;
26
+ }
27
+ export declare const PureDocs: {
28
+ mount: typeof mount;
29
+ bootstrap: typeof bootstrap;
30
+ unmount: typeof unmount;
31
+ version: string;
32
+ };
33
+ export type { PortalConfig, PortalBootstrapConfig, PortalApi, PortalState } from './core/types';
34
+ export default PureDocs;
@@ -0,0 +1,17 @@
1
+ type Attrs = Record<string, string | boolean | number | EventListener | undefined>;
2
+ type Child = HTMLElement | SVGElement | string | null | undefined | false;
3
+ /** Create an HTML element with attributes and children */
4
+ export declare function h(tag: string, attrs?: Attrs | null, ...children: Child[]): HTMLElement;
5
+ /** Clear all children of an element */
6
+ export declare function clear(el: HTMLElement): void;
7
+ /** Replace all children of a container */
8
+ export declare function render(container: HTMLElement, ...children: Child[]): void;
9
+ /** Escape HTML to prevent XSS */
10
+ export declare function escapeHtml(str: string): string;
11
+ /** Copy text to clipboard */
12
+ export declare function copyToClipboard(text: string): Promise<boolean>;
13
+ /** Format bytes to human readable */
14
+ export declare function formatBytes(bytes: number): string;
15
+ /** Format duration in ms to human readable */
16
+ export declare function formatDuration(ms: number): string;
17
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Custom regex-based syntax highlighter — zero dependencies.
3
+ * Supports: JSON, JavaScript, Bash/curl, Go, Python, Rust.
4
+ * ~90 lines TS → ~1.4 KB min → ~0.6 KB gzip (vs ~18 KB for highlight.js).
5
+ */
6
+ import { looksLikeJson } from '../helpers/text';
7
+ export declare function highlightCode(code: string, language: string): string;
8
+ export { looksLikeJson };
@@ -0,0 +1,24 @@
1
+ /** SVG icon set — clean, consistent 20x20 Lucide-inspired icons */
2
+ export declare const icons: {
3
+ readonly search: string;
4
+ readonly close: string;
5
+ readonly plus: string;
6
+ readonly chevronDown: string;
7
+ readonly chevronRight: string;
8
+ readonly chevronLeft: string;
9
+ readonly menu: string;
10
+ readonly sun: string;
11
+ readonly moon: string;
12
+ readonly copy: string;
13
+ readonly check: string;
14
+ /** Closed padlock — requires auth (red) */
15
+ readonly lock: string;
16
+ /** Open padlock — auth configured (green) */
17
+ readonly unlock: string;
18
+ readonly send: string;
19
+ readonly key: string;
20
+ readonly globe: string;
21
+ readonly server: string;
22
+ readonly warning: string;
23
+ readonly settings: string;
24
+ };