@umami/shiso 1.18.0 → 1.19.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.
- package/dist/chunks/App.js +1081 -47
- package/dist/chunks/architectureDiagram-5GKGNRK7.js +1 -1
- package/dist/chunks/chunk-GMAD6QVW.js +1 -1
- package/dist/chunks/cose-bilkent-JH36ORCC.js +1 -1
- package/dist/chunks/dist.js +1 -1
- package/dist/chunks/docs.js +183 -8
- package/dist/chunks/ganttDiagram-EL5Y4UJY.js +1 -1
- package/dist/chunks/src.js +1 -1
- package/dist/components.js +1 -1
- package/dist/entry-client.js +1 -1
- package/dist/entry-server.js +1 -1
- package/docs.schema.json +1164 -1135
- package/package.json +1 -2
- package/scripts/check-content.mjs +42 -15
- package/scripts/expand-openapi-navigation.mjs +47 -21
- package/scripts/generate-openapi.mjs +36 -11
- package/scripts/generate-search-index.mjs +19 -18
- package/scripts/lib/openapi-project.mjs +197 -0
- package/scripts/lib/openapi.mjs +257 -111
- package/scripts/lib/request-samples.mjs +323 -0
- package/scripts/load-docs-config.mjs +23 -15
- package/scripts/prerender.mjs +17 -14
- package/scripts/vite-docs-config.mjs +1 -0
- package/src/components/ApiPlayground.tsx +522 -0
- package/src/components/DocContent.tsx +15 -4
- package/src/components/Docs.tsx +18 -3
- package/src/components/LanguageSwitcher.tsx +26 -30
- package/src/components/OpenApiOperation.tsx +58 -12
- package/src/components/OpenApiSchema.tsx +97 -0
- package/src/components/SideNav.tsx +2 -2
- package/src/lib/openapi.generated.ts +2 -1
- package/src/lib/openapi.ts +104 -10
- package/src/lib/site-model.ts +12 -0
- package/src/lib/translations/de.json +26 -1
- package/src/lib/translations/en.json +26 -1
- package/src/lib/translations/es.json +26 -1
- package/src/lib/translations/fr.json +26 -1
- package/src/lib/translations/ja.json +26 -1
- package/src/lib/translations/zh-Hans.json +26 -1
- package/src/lib/translations/zh-Hant.json +26 -1
- package/src/lib/types.ts +89 -5
- package/types/labels.d.ts +25 -0
- package/vite.config.ts +3 -4
- package/CHANGELOG.md +0 -8
package/src/lib/types.ts
CHANGED
|
@@ -421,11 +421,38 @@ export interface DocsConfig {
|
|
|
421
421
|
api?: ApiConfig;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
export type ApiPlaygroundDisplay = 'interactive' | 'simple' | 'none';
|
|
425
|
+
|
|
426
|
+
export interface ApiPlaygroundConfig {
|
|
427
|
+
/**
|
|
428
|
+
* "interactive" (default) renders the "Try it" panel on endpoint pages;
|
|
429
|
+
* "simple" and "none" show the reference without it.
|
|
430
|
+
*/
|
|
431
|
+
display?: ApiPlaygroundDisplay;
|
|
432
|
+
/**
|
|
433
|
+
* URL of a CORS proxy the playground sends requests through. `$url` in the
|
|
434
|
+
* value is replaced with the encoded target URL; without it the target URL
|
|
435
|
+
* is appended. Requests go directly to the API when omitted.
|
|
436
|
+
*/
|
|
437
|
+
proxy?: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
424
440
|
export interface ApiConfig {
|
|
425
|
-
/**
|
|
426
|
-
|
|
441
|
+
/**
|
|
442
|
+
* One OpenAPI 3.x spec (JSON or YAML) or a list of them: paths relative to
|
|
443
|
+
* the project root, or https URLs fetched at build time.
|
|
444
|
+
*/
|
|
445
|
+
spec: string | string[];
|
|
427
446
|
/** Folder inside the content directory for generated endpoint pages. Default "api-reference". */
|
|
428
447
|
directory?: string;
|
|
448
|
+
/** "Try it" panel settings for endpoint pages. */
|
|
449
|
+
playground?: ApiPlaygroundConfig;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Playground settings after defaults, as carried on the site model. */
|
|
453
|
+
export interface ResolvedApiPlayground {
|
|
454
|
+
display: ApiPlaygroundDisplay;
|
|
455
|
+
proxy?: string;
|
|
429
456
|
}
|
|
430
457
|
|
|
431
458
|
/* ---------------------------------------------------------------------------
|
|
@@ -595,6 +622,7 @@ export interface SiteModel {
|
|
|
595
622
|
drilldown?: boolean;
|
|
596
623
|
locale: string;
|
|
597
624
|
labels: ThemeLabels;
|
|
625
|
+
api: { playground: ResolvedApiPlayground };
|
|
598
626
|
docs: NormalizedDocsConfig;
|
|
599
627
|
}
|
|
600
628
|
|
|
@@ -635,8 +663,16 @@ export interface DocFrontmatter {
|
|
|
635
663
|
timestamp?: boolean;
|
|
636
664
|
/** Related pages rendered above the prev/next pager. */
|
|
637
665
|
related?: RelatedEntry[];
|
|
638
|
-
/**
|
|
666
|
+
/**
|
|
667
|
+
* Binds the page to an API operation, e.g. "GET /users/{id}", a webhook
|
|
668
|
+
* ("webhook userCreated"), or a spec-qualified key on multi-spec sites
|
|
669
|
+
* ("users.yaml GET /users").
|
|
670
|
+
*/
|
|
639
671
|
openapi?: string;
|
|
672
|
+
/** Binds the page to a named component schema, e.g. "User" or "users.yaml User". */
|
|
673
|
+
'openapi-schema'?: string;
|
|
674
|
+
/** Overrides `api.playground.display` for this page. */
|
|
675
|
+
playground?: ApiPlaygroundDisplay;
|
|
640
676
|
[key: string]: unknown;
|
|
641
677
|
}
|
|
642
678
|
|
|
@@ -659,9 +695,32 @@ export interface SchemaNode {
|
|
|
659
695
|
description?: string;
|
|
660
696
|
default?: string;
|
|
661
697
|
enum?: string[];
|
|
698
|
+
/** Example value (stringified) for parameters, used by samples and the playground. */
|
|
699
|
+
example?: string;
|
|
662
700
|
children?: SchemaNode[];
|
|
663
701
|
}
|
|
664
702
|
|
|
703
|
+
/** A security scheme an operation accepts, resolved from components.securitySchemes. */
|
|
704
|
+
export interface SecurityScheme {
|
|
705
|
+
/** Scheme key in the spec, e.g. "bearerAuth". */
|
|
706
|
+
name: string;
|
|
707
|
+
type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect' | 'unknown';
|
|
708
|
+
/** HTTP authentication scheme, lowercased: "bearer", "basic", ... */
|
|
709
|
+
scheme?: string;
|
|
710
|
+
/** Where an API key is sent. */
|
|
711
|
+
in?: 'header' | 'query' | 'cookie';
|
|
712
|
+
/** Header, query, or cookie name carrying an API key. */
|
|
713
|
+
paramName?: string;
|
|
714
|
+
description?: string;
|
|
715
|
+
/** Display label, e.g. "bearerAuth (http bearer)". */
|
|
716
|
+
label: string;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
export interface ApiServer {
|
|
720
|
+
url: string;
|
|
721
|
+
description?: string;
|
|
722
|
+
}
|
|
723
|
+
|
|
665
724
|
export interface OpenApiSample {
|
|
666
725
|
language: string;
|
|
667
726
|
label: string;
|
|
@@ -682,9 +741,18 @@ export interface OpenApiResponse {
|
|
|
682
741
|
|
|
683
742
|
export interface NormalizedOperation {
|
|
684
743
|
id: string;
|
|
685
|
-
/** Frontmatter lookup key, e.g. "GET /users/{id}". */
|
|
744
|
+
/** Frontmatter lookup key, e.g. "GET /users/{id}" or "WEBHOOK userCreated". */
|
|
686
745
|
key: string;
|
|
746
|
+
/** The configured spec (path or URL) this operation came from. */
|
|
747
|
+
spec?: string;
|
|
748
|
+
/** True for OpenAPI `webhooks` entries: payloads the API sends to subscribers. */
|
|
749
|
+
webhook?: boolean;
|
|
750
|
+
/** Content folder of the endpoint page, relative to the content directory. */
|
|
751
|
+
directory?: string;
|
|
752
|
+
/** Navigation page reference of the endpoint page, e.g. "api-reference/get-user". */
|
|
753
|
+
pageRef?: string;
|
|
687
754
|
method: string;
|
|
755
|
+
/** URL path, or the webhook name for webhooks. */
|
|
688
756
|
path: string;
|
|
689
757
|
summary?: string;
|
|
690
758
|
description?: string;
|
|
@@ -704,7 +772,23 @@ export interface NormalizedOperation {
|
|
|
704
772
|
exampleHtml?: string;
|
|
705
773
|
};
|
|
706
774
|
responses: OpenApiResponse[];
|
|
707
|
-
security:
|
|
775
|
+
security: SecurityScheme[];
|
|
776
|
+
/** Servers the operation can be sent to, most specific level first. */
|
|
777
|
+
servers: ApiServer[];
|
|
778
|
+
/** URL of the first server; kept for consumers that need a single origin. */
|
|
708
779
|
serverUrl: string;
|
|
709
780
|
samples: OpenApiSample[];
|
|
710
781
|
}
|
|
782
|
+
|
|
783
|
+
/** A named component schema rendered by an `openapi-schema:` page. */
|
|
784
|
+
export interface SchemaPage {
|
|
785
|
+
name: string;
|
|
786
|
+
/** Frontmatter lookup key: the schema name. */
|
|
787
|
+
key: string;
|
|
788
|
+
spec?: string;
|
|
789
|
+
title?: string;
|
|
790
|
+
description?: string;
|
|
791
|
+
schema: SchemaNode;
|
|
792
|
+
example?: string;
|
|
793
|
+
exampleHtml?: string;
|
|
794
|
+
}
|
package/types/labels.d.ts
CHANGED
|
@@ -71,6 +71,31 @@ export interface ThemeLabels {
|
|
|
71
71
|
apiExampleRequest: string;
|
|
72
72
|
apiExampleResponse: string;
|
|
73
73
|
apiCredentials: string;
|
|
74
|
+
apiPlayground: string;
|
|
75
|
+
apiServer: string;
|
|
76
|
+
apiAuthorization: string;
|
|
77
|
+
apiUsername: string;
|
|
78
|
+
apiPassword: string;
|
|
79
|
+
apiToken: string;
|
|
80
|
+
apiApiKey: string;
|
|
81
|
+
apiBody: string;
|
|
82
|
+
apiSend: string;
|
|
83
|
+
apiSending: string;
|
|
84
|
+
apiCancel: string;
|
|
85
|
+
apiRequest: string;
|
|
86
|
+
apiResponse: string;
|
|
87
|
+
apiResponseHeaders: string;
|
|
88
|
+
apiResponseBody: string;
|
|
89
|
+
apiNoResponse: string;
|
|
90
|
+
apiRequestFailed: string;
|
|
91
|
+
apiRequestTimedOut: string;
|
|
92
|
+
apiCookiesUnsupported: string;
|
|
93
|
+
apiOptional: string;
|
|
94
|
+
apiElapsed: string;
|
|
95
|
+
apiCredentialsStored: string;
|
|
96
|
+
apiPayload: string;
|
|
97
|
+
apiSchemaProperties: string;
|
|
98
|
+
apiExample: string;
|
|
74
99
|
}
|
|
75
100
|
|
|
76
101
|
export type Translations = Record<string, Partial<ThemeLabels>>;
|
package/vite.config.ts
CHANGED
|
@@ -41,7 +41,7 @@ function shisoIconRegistry(getDocsConfig: () => DocsConfig, root: string, output
|
|
|
41
41
|
*/
|
|
42
42
|
function shisoOpenApi(
|
|
43
43
|
getDocsConfig: () => DocsConfig,
|
|
44
|
-
|
|
44
|
+
getSpecPaths: () => string[],
|
|
45
45
|
root: string,
|
|
46
46
|
output: string,
|
|
47
47
|
): Plugin {
|
|
@@ -59,8 +59,7 @@ function shisoOpenApi(
|
|
|
59
59
|
await generate();
|
|
60
60
|
},
|
|
61
61
|
async handleHotUpdate({ file }) {
|
|
62
|
-
|
|
63
|
-
if ((specPath && path.resolve(file) === specPath) || file.endsWith('docs.json')) {
|
|
62
|
+
if (getSpecPaths().includes(path.resolve(file)) || file.endsWith('docs.json')) {
|
|
64
63
|
await generate();
|
|
65
64
|
}
|
|
66
65
|
},
|
|
@@ -494,7 +493,7 @@ export default defineConfig(async () => {
|
|
|
494
493
|
),
|
|
495
494
|
shisoOpenApi(
|
|
496
495
|
getDocsConfig,
|
|
497
|
-
() => configModule.
|
|
496
|
+
() => configModule.getSpecPaths?.() ?? [],
|
|
498
497
|
projectRoot,
|
|
499
498
|
path.join(generatedRoot, 'openapi.generated.ts'),
|
|
500
499
|
),
|