@deot/docs-client 1.0.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.
@@ -0,0 +1,422 @@
1
+ import { App } from 'vue';
2
+ import { DocsLocaleEntry } from '@deot/docs-locale';
3
+ import { DocsTheme } from '@deot/docs-theme';
4
+ import { DocsThemeOptions } from '@deot/docs-theme';
5
+ import { DocsThemePreference } from '@deot/docs-theme';
6
+ import { HTTPController } from '@deot/http-core';
7
+ import { Language } from '@deot/docs-locale';
8
+ import type { Ref } from 'vue';
9
+ import type { RendererDocument } from '@deot/docs-renderer';
10
+ import type { RendererModuleSource } from '@deot/docs-renderer';
11
+ import type { RouteLocationNormalized } from 'vue-router';
12
+ import type { RouteLocationNormalizedGeneric } from 'vue-router';
13
+ import { _RouterClassic } from 'vue-router';
14
+
15
+ export declare const bootstrap: (config?: DocsConfig) => Promise<{
16
+ app: App<Element>;
17
+ router: _RouterClassic;
18
+ disconnect: () => void;
19
+ }>;
20
+
21
+ export declare const classifyResourceSource: (source: string) => DocsResourceType;
22
+
23
+ export declare const createRendererEditorDemoDocument: (demo: RendererEditorDemo, lang: string) => RendererDocument;
24
+
25
+ export declare const createResourceIdentity: (config: DocsConfig, lang: string, type: DocsResourceType, source: string) => ResourceIdentity;
26
+
27
+ export declare const DOCS_RESOURCE_TYPES: readonly ["markdown", "sidebar", "page", "sfc", "module", "style"];
28
+
29
+ export declare interface DocsConfig {
30
+ locales: Record<string, DocsLocaleEntry>;
31
+ routes: Record<string, DocsRouteConfig>;
32
+ base?: string;
33
+ namespace?: string;
34
+ modules?: Record<string, string>;
35
+ styles?: Record<string, string>;
36
+ prefetch?: boolean | DocsPrefetchOptions;
37
+ theme?: boolean | DocsThemeOptions;
38
+ home?: DocsHomeOptions;
39
+ renderers?: RendererModuleSource[];
40
+ resolve?: {
41
+ markdown?: (context: DocsMarkdownContext) => string | Promise<string>;
42
+ resource?: (context: DocsResourceContext) => string | null | undefined | Promise<string | null | undefined>;
43
+ link?: (context: DocsLinkContext) => string | null | undefined;
44
+ };
45
+ runtime?: Readonly<DocsRuntime>;
46
+ }
47
+
48
+ export declare type DocsContent = DocsSlot | RendererDocument;
49
+
50
+ export declare interface DocsHomeOptions {
51
+ locales: Record<string, RendererDocument | string>;
52
+ }
53
+
54
+ export declare interface DocsLinkContext {
55
+ href: string;
56
+ lang: string;
57
+ source: string;
58
+ route: RouteLocationNormalized;
59
+ }
60
+
61
+ export { DocsLocaleEntry }
62
+
63
+ export declare interface DocsMarkdownContext {
64
+ lang: string;
65
+ value: string;
66
+ route: RouteLocationNormalizedGeneric;
67
+ }
68
+
69
+ export declare interface DocsPrefetchOptions {
70
+ batchSize?: number;
71
+ idleTimeout?: number;
72
+ }
73
+
74
+ export declare interface DocsResourceContext {
75
+ source: string;
76
+ type: DocsResourceType;
77
+ lang: string;
78
+ importer?: string;
79
+ base?: string;
80
+ runtime: Readonly<DocsRuntime>;
81
+ }
82
+
83
+ export declare type DocsResourceType = typeof DOCS_RESOURCE_TYPES[number];
84
+
85
+ export declare interface DocsRoute {
86
+ value?: string | ((to: RouteLocationNormalizedGeneric) => string);
87
+ content?: DocsContent;
88
+ sidebar?: DocsSidebar;
89
+ header?: DocsSlot;
90
+ footer?: DocsSlot;
91
+ extra?: DocsSlot;
92
+ }
93
+
94
+ export declare type DocsRouteConfig = DocsRoute | string | ((to: RouteLocationNormalizedGeneric) => string);
95
+
96
+ export declare interface DocsRuntime {
97
+ mode: 'development' | 'production';
98
+ workspace?: string;
99
+ events?: string;
100
+ }
101
+
102
+ export declare type DocsSidebar = DocsSlot | SidebarItem[] | Record<string, SidebarItem[]>;
103
+
104
+ export declare type DocsSlot = 'default' | string | null;
105
+
106
+ export { DocsTheme }
107
+
108
+ export declare interface DocsThemeController {
109
+ readonly current: Readonly<Ref<DocsTheme>>;
110
+ readonly enabled: Readonly<Ref<boolean>>;
111
+ readonly ready: Readonly<Ref<boolean>>;
112
+ set(theme: DocsTheme, origin?: HTMLElement): Promise<void>;
113
+ toggle(origin?: HTMLElement): Promise<void>;
114
+ }
115
+
116
+ export { DocsThemeOptions }
117
+
118
+ export { DocsThemePreference }
119
+
120
+ export declare const Gateway: ResourceGateway;
121
+
122
+ export declare const getDefaultLanguage: (config: DocsConfig) => string;
123
+
124
+ export declare const getDocsBase: (config: DocsConfig) => string;
125
+
126
+ export declare const getDocsConfig: () => DocsConfig;
127
+
128
+ export declare const getDocsDeploymentBase: (config: DocsConfig) => string;
129
+
130
+ export declare const getDocsNamespace: (config: DocsConfig) => string;
131
+
132
+ export declare const getDocsRuntime: () => Readonly<DocsRuntime>;
133
+
134
+ export declare const initializeDocsRuntime: (target?: Window, config?: DocsConfig) => Readonly<Readonly<DocsRuntime>>;
135
+
136
+ export declare const isRendererEditorDemo: (value: unknown) => value is RendererEditorDemo;
137
+
138
+ export { Language }
139
+
140
+ declare type LegacyResourceField = Exclude<keyof ResourceRecord, 'identity' | 'url' | 'etag' | 'lastModified' | 'previous'>;
141
+
142
+ export declare const listRendererEditorDemos: (lang: string) => RendererEditorDemoItem[];
143
+
144
+ export declare const Network: HTTPController;
145
+
146
+ export declare const normalizeWorkspaceBase: (value?: string) => string;
147
+
148
+ export declare const PlaygroundResource: PlaygroundResourceRuntime;
149
+
150
+ export declare class PlaygroundResourceCache {
151
+ private store;
152
+ private createId;
153
+ private putRecord;
154
+ list(namespace: string): Promise<PlaygroundResourceRecord[]>;
155
+ set(namespace: string, alias: string, url: string, kind: PlaygroundResourceKind, patch?: StatusPatch): Promise<PlaygroundResourceRecord | null>;
156
+ patch(namespace: string, alias: string, kind: PlaygroundResourceKind, patch: Partial<PlaygroundResourceRecord>): Promise<PlaygroundResourceRecord | null>;
157
+ remove(namespace: string, alias: string, kind: PlaygroundResourceKind): Promise<void>;
158
+ clear(namespace: string): Promise<void>;
159
+ }
160
+
161
+ export declare type PlaygroundResourceKind = 'import' | 'style';
162
+
163
+ export declare type PlaygroundResourceLastAction = 'save' | 'reset' | 'prefetch' | 'retry';
164
+
165
+ export declare interface PlaygroundResourceProbeSummary {
166
+ total: number;
167
+ fulfilled: number;
168
+ rejected: number;
169
+ }
170
+
171
+ export declare interface PlaygroundResourceRecord {
172
+ id: string;
173
+ namespace: string;
174
+ alias: string;
175
+ url: string;
176
+ kind: PlaygroundResourceKind;
177
+ updatedAt: number;
178
+ source?: PlaygroundResourceSource;
179
+ requestStatus?: PlaygroundResourceRequestStatus;
180
+ requestStatusUpdatedAt?: number;
181
+ checkedAt?: number;
182
+ reason?: string;
183
+ lastAction?: PlaygroundResourceLastAction;
184
+ }
185
+
186
+ export declare type PlaygroundResourceRequestStatus = 'waiting' | 'pending' | 'success' | 'error';
187
+
188
+ export declare interface PlaygroundResourceRow {
189
+ kind: PlaygroundResourceKind;
190
+ alias: string;
191
+ defaultUrl: string;
192
+ currentUrl: string;
193
+ overridden: boolean;
194
+ requestStatus: PlaygroundResourceRequestStatus;
195
+ requestStatusUpdatedAt?: number;
196
+ updatedAt?: number;
197
+ checkedAt?: number;
198
+ reason?: string;
199
+ lastAction?: PlaygroundResourceLastAction;
200
+ }
201
+
202
+ declare class PlaygroundResourceRuntime {
203
+ private cache;
204
+ private generation;
205
+ private seedTask;
206
+ private statusSubscribers;
207
+ private sessionStatus;
208
+ waitForIdle(): Promise<void>;
209
+ subscribeStatus(listener: StatusListener): () => boolean;
210
+ private notifyStatus;
211
+ private sessionKey;
212
+ private setSessionStatus;
213
+ private clearSessionStatus;
214
+ private markStatus;
215
+ private hydrateDefaults;
216
+ private toRows;
217
+ list(namespace: string): Promise<PlaygroundResourceRecord[]>;
218
+ listPage(config: DocsConfig): Promise<{
219
+ rows: PlaygroundResourceRow[];
220
+ bytes: number;
221
+ }>;
222
+ set(namespace: string, alias: string, url: string, kind: PlaygroundResourceKind): Promise<PlaygroundResourceRecord | null>;
223
+ remove(namespace: string, alias: string, kind: PlaygroundResourceKind): Promise<void>;
224
+ private probeUrl;
225
+ private runPool;
226
+ private withPending;
227
+ save(namespace: string, alias: string, url: string, kind: PlaygroundResourceKind, defaultUrl?: string): Promise<PlaygroundResourceRecord>;
228
+ reset(namespace: string, alias: string, kind: PlaygroundResourceKind, defaultUrl: string): Promise<void>;
229
+ prefetch(namespace: string, rows: PlaygroundResourceRow[]): Promise<PlaygroundResourceProbeSummary>;
230
+ retry(namespace: string, row: PlaygroundResourceRow): Promise<PlaygroundResourceRecord | null>;
231
+ clear(namespace: string): Promise<void>;
232
+ start(config: DocsConfig): Promise<() => void>;
233
+ }
234
+
235
+ declare type PlaygroundResourceSource = 'default' | 'override';
236
+
237
+ export declare const RENDERER_EDITOR_DEMOS: readonly ["sortable", "landing", "shared", "promo", "docs", "combo", "draggable", "selection"];
238
+
239
+ export declare type RendererEditorDemo = typeof RENDERER_EDITOR_DEMOS[number];
240
+
241
+ declare interface RendererEditorDemoItem {
242
+ name: RendererEditorDemo;
243
+ title: string;
244
+ description: string;
245
+ modules: readonly string[];
246
+ accent: string;
247
+ }
248
+
249
+ export declare const rendererEditorDemoPath: (lang: string, demo?: RendererEditorDemo) => string;
250
+
251
+ export declare const resolveResource: (config: DocsConfig, context: Omit<DocsResourceContext, "runtime" | "base">) => Promise<string>;
252
+
253
+ declare interface ResourceCache {
254
+ get(key: string): Promise<ResourceRecordInput | null>;
255
+ set(key: string, value: ResourceRecord): Promise<void>;
256
+ remove(key: string): Promise<void>;
257
+ list(): Promise<ResourceRecordInput[]>;
258
+ clear(): Promise<void>;
259
+ }
260
+
261
+ export declare interface ResourceContentRecord extends ResourceRecord {
262
+ status: 'success';
263
+ content: string;
264
+ hash: string;
265
+ updatedAt: number;
266
+ }
267
+
268
+ export declare class ResourceGateway {
269
+ private cache;
270
+ private request;
271
+ private scheduler;
272
+ private memory;
273
+ private pending;
274
+ private controllers;
275
+ private trailing;
276
+ private cacheWrites;
277
+ private subscribers;
278
+ private statusSubscribers;
279
+ private prefetched;
280
+ private globalRevision;
281
+ private resourceRevisions;
282
+ private polling;
283
+ private deletionBarrier;
284
+ constructor(options?: ResourceGatewayOptions);
285
+ setConcurrency(value: number): void;
286
+ load(identity: ResourceIdentity, options?: ResourceLoadOptions): Promise<ResourceContentRecord>;
287
+ revalidate(identity: ResourceIdentity, options?: ResourceLoadOptions): Promise<ResourceContentRecord>;
288
+ prefetch(identities: ResourceIdentity[], options?: ResourcePrefetchOptions): Promise<PromiseSettledResult<ResourceContentRecord>[]>;
289
+ poll(input: ResourceIdentity | ResourceIdentity[], options?: number | ResourcePollOptions): () => void;
290
+ private startPolling;
291
+ stopPolling(identity: ResourceIdentity): void;
292
+ subscribe(identity: ResourceIdentity, listener: (record: ResourceContentRecord) => void): () => void;
293
+ subscribeStatus(listener: (record: ResourceRecord) => void): () => boolean;
294
+ isSubscribed(identity: ResourceIdentity): boolean;
295
+ isPrefetched(identity: ResourceIdentity): boolean;
296
+ list(): Promise<ResourceRecord[]>;
297
+ invalidate(identity: ResourceIdentity): Promise<void>;
298
+ clear(): Promise<void>;
299
+ prune(namespace: string, retainedIdentities: ResourceIdentity[]): Promise<ResourceRecord[]>;
300
+ private loadInternal;
301
+ private revalidateInternal;
302
+ private revalidateSilently;
303
+ private consumePending;
304
+ private queueTrailing;
305
+ private mergeTrailingOptions;
306
+ private flushTrailing;
307
+ private cancelTrailing;
308
+ private enqueueDeletion;
309
+ private enqueueCacheWrite;
310
+ private settlePending;
311
+ private readRecord;
312
+ private writeRecord;
313
+ private getMutationToken;
314
+ private isMutationTokenCurrent;
315
+ private assertMutationToken;
316
+ private repairStaleWrite;
317
+ private transition;
318
+ private update;
319
+ private completeSuccess;
320
+ }
321
+
322
+ declare interface ResourceGatewayOptions {
323
+ concurrency?: number;
324
+ cache?: ResourceCache;
325
+ request?: ResourceRequest;
326
+ }
327
+
328
+ export declare interface ResourceIdentity {
329
+ namespace: string;
330
+ lang: string;
331
+ type: DocsResourceType;
332
+ source: string;
333
+ }
334
+
335
+ export declare const resourceIdentityKey: (identity: ResourceIdentity) => string;
336
+
337
+ export declare interface ResourceLoadOptions {
338
+ url?: string;
339
+ priority?: number;
340
+ refresh?: boolean;
341
+ signal?: AbortSignal;
342
+ trailing?: boolean;
343
+ }
344
+
345
+ export declare interface ResourcePollOptions {
346
+ interval?: number;
347
+ priority?: number;
348
+ }
349
+
350
+ export declare interface ResourcePrefetchOptions {
351
+ priority?: number;
352
+ signal?: AbortSignal;
353
+ }
354
+
355
+ export declare interface ResourceRecord {
356
+ identity: ResourceIdentity;
357
+ url: string;
358
+ status: ResourceStatus;
359
+ requestStatus: ResourceStatus;
360
+ requestStatusUpdatedAt: number;
361
+ statusHistory: ResourceStatusHistory[];
362
+ contentHistoryId: string | null;
363
+ contentHistoryIndex: number | null;
364
+ reason?: string;
365
+ content?: string;
366
+ hash?: string;
367
+ updatedAt?: number;
368
+ etag?: string;
369
+ lastModified?: string;
370
+ checkedAt: number;
371
+ accessedAt: number;
372
+ previous?: ResourceVersion;
373
+ }
374
+
375
+ export declare type ResourceRecordInput = Omit<ResourceRecord, LegacyResourceField> & {
376
+ [K in LegacyResourceField]?: unknown;
377
+ } & {
378
+ statusUpdatedAt?: unknown;
379
+ };
380
+
381
+ declare type ResourceRequest = (url: string, headers: Record<string, string>, signal?: AbortSignal) => Promise<TextResponse>;
382
+
383
+ export declare type ResourceStatus = 'waiting' | 'pending' | 'success' | 'error';
384
+
385
+ export declare interface ResourceStatusHistory {
386
+ id: string;
387
+ status: ResourceStatus;
388
+ createdAt: number;
389
+ waitingAt?: number;
390
+ pendingAt?: number;
391
+ completedAt?: number;
392
+ reason?: string;
393
+ }
394
+
395
+ export declare interface ResourceVersion {
396
+ content: string;
397
+ hash: string;
398
+ updatedAt: number;
399
+ }
400
+
401
+ export declare interface SidebarItem {
402
+ label: string;
403
+ value?: string;
404
+ children?: SidebarItem[];
405
+ }
406
+
407
+ declare type StatusListener = () => void;
408
+
409
+ declare type StatusPatch = Pick<PlaygroundResourceRecord, 'source' | 'requestStatus' | 'requestStatusUpdatedAt' | 'checkedAt' | 'reason' | 'lastAction'>;
410
+
411
+ declare interface TextResponse {
412
+ status: number;
413
+ body: string;
414
+ etag?: string;
415
+ lastModified?: string;
416
+ }
417
+
418
+ export declare const Theme: DocsThemeController;
419
+
420
+ export declare const trimSlashes: (value: string) => string;
421
+
422
+ export { }