@umami/shiso 1.17.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 +1217 -196
- 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 +843 -22
- 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 -1131
- package/package.json +1 -2
- package/scripts/check-content.mjs +44 -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/load-shiso-config.mjs +30 -1
- package/scripts/prerender.mjs +17 -14
- package/scripts/vite-docs-config.mjs +1 -0
- package/src/App.tsx +32 -22
- package/src/components/ApiPlayground.tsx +522 -0
- package/src/components/CodeBlock.tsx +3 -1
- package/src/components/DocContent.tsx +15 -4
- package/src/components/Docs.tsx +19 -2
- package/src/components/Footer.tsx +3 -1
- package/src/components/Header.tsx +4 -3
- package/src/components/LanguageSwitcher.tsx +38 -29
- package/src/components/OpenApiOperation.tsx +73 -20
- package/src/components/OpenApiSchema.tsx +97 -0
- package/src/components/PageActions.tsx +8 -7
- package/src/components/SideNav.tsx +2 -2
- package/src/components/docs/Changelog.tsx +5 -5
- package/src/components/docs/CodeGroup.tsx +3 -1
- package/src/components/docs/Mermaid.tsx +8 -6
- package/src/components/docs/PropertiesTable.tsx +11 -6
- package/src/components/docs/Tabs.tsx +3 -1
- package/src/components/docs/Tree.tsx +3 -1
- package/src/components/docs/ZoomableImage.tsx +4 -2
- package/src/components/ui/dialog.tsx +7 -2
- package/src/components/ui/sheet.tsx +5 -2
- package/src/lib/label-context.tsx +7 -0
- package/src/lib/labels.ts +37 -0
- package/src/lib/openapi.generated.ts +2 -1
- package/src/lib/openapi.ts +123 -16
- package/src/lib/site-config.ts +66 -2
- package/src/lib/site-model.ts +14 -32
- package/src/lib/standalone-pages.ts +15 -1
- package/src/lib/translations/de.json +99 -0
- package/src/lib/translations/en.json +99 -0
- package/src/lib/translations/es.json +99 -0
- package/src/lib/translations/fr.json +99 -0
- package/src/lib/translations/ja.json +99 -0
- package/src/lib/translations/zh-Hans.json +99 -0
- package/src/lib/translations/zh-Hant.json +99 -0
- package/src/lib/types.ts +109 -37
- package/types/config.d.ts +7 -1
- package/types/labels.d.ts +101 -0
- package/vite.config.ts +3 -4
- package/CHANGELOG.md +0 -8
package/src/lib/types.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { ThemeLabels, Translations } from '../../types/labels';
|
|
2
|
+
|
|
3
|
+
export type { ThemeLabels, Translations } from '../../types/labels';
|
|
4
|
+
|
|
1
5
|
import type { PluggableList } from 'unified';
|
|
2
6
|
|
|
3
7
|
/* ---------------------------------------------------------------------------
|
|
@@ -134,8 +138,10 @@ export interface ShisoConfig {
|
|
|
134
138
|
contentDir?: string;
|
|
135
139
|
/** Absolute site origin, required for canonical and og:url tags. */
|
|
136
140
|
siteUrl?: string;
|
|
137
|
-
/**
|
|
141
|
+
/** Default locale for UI labels and date formatting. */
|
|
138
142
|
locale?: string;
|
|
143
|
+
/** Partial UI label overrides keyed by BCP 47 locale. */
|
|
144
|
+
translations?: Translations;
|
|
139
145
|
/** Build-time remark and rehype plugins. */
|
|
140
146
|
mdx?: MdxConfig;
|
|
141
147
|
}
|
|
@@ -146,6 +152,7 @@ export interface ResolvedShisoConfig {
|
|
|
146
152
|
contentDir: string;
|
|
147
153
|
siteUrl?: string;
|
|
148
154
|
locale: string;
|
|
155
|
+
translations?: Translations;
|
|
149
156
|
/** Build-only compiler hooks. Removed from the virtual browser module. */
|
|
150
157
|
mdx?: MdxConfig;
|
|
151
158
|
}
|
|
@@ -211,6 +218,11 @@ export interface StandalonePageItem {
|
|
|
211
218
|
page: string;
|
|
212
219
|
/** Page title used in the document head. Frontmatter title wins. */
|
|
213
220
|
title?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Navigation language this page belongs to, e.g. "ja". Sets the document
|
|
223
|
+
* language, header navigation, and language selector for the page.
|
|
224
|
+
*/
|
|
225
|
+
language?: string;
|
|
214
226
|
}
|
|
215
227
|
|
|
216
228
|
/** Normalized standalone page. */
|
|
@@ -221,6 +233,13 @@ export interface StandalonePage {
|
|
|
221
233
|
filePath: string;
|
|
222
234
|
/** Config-level head-title override. */
|
|
223
235
|
title?: string;
|
|
236
|
+
/** Navigation language the page belongs to; untagged pages use the default language. */
|
|
237
|
+
language?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Language-independent identity: the file slug without its language folder,
|
|
240
|
+
* so "ja/home" (language "ja") and "home" are the same page in two languages.
|
|
241
|
+
*/
|
|
242
|
+
key: string;
|
|
224
243
|
}
|
|
225
244
|
|
|
226
245
|
export interface SeoConfig {
|
|
@@ -402,11 +421,38 @@ export interface DocsConfig {
|
|
|
402
421
|
api?: ApiConfig;
|
|
403
422
|
}
|
|
404
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
|
+
|
|
405
440
|
export interface ApiConfig {
|
|
406
|
-
/**
|
|
407
|
-
|
|
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[];
|
|
408
446
|
/** Folder inside the content directory for generated endpoint pages. Default "api-reference". */
|
|
409
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;
|
|
410
456
|
}
|
|
411
457
|
|
|
412
458
|
/* ---------------------------------------------------------------------------
|
|
@@ -550,37 +596,6 @@ export interface NormalizedFooter {
|
|
|
550
596
|
attribution: boolean;
|
|
551
597
|
}
|
|
552
598
|
|
|
553
|
-
export interface ThemeLabels {
|
|
554
|
-
menu: string;
|
|
555
|
-
documentationNavigation: string;
|
|
556
|
-
sections: string;
|
|
557
|
-
tableOfContents: string;
|
|
558
|
-
tableOfContentsNavigation: string;
|
|
559
|
-
searchTitle: string;
|
|
560
|
-
searching: string;
|
|
561
|
-
searchUnavailable: string;
|
|
562
|
-
noResults: string;
|
|
563
|
-
lastUpdated: string;
|
|
564
|
-
relatedTopics: string;
|
|
565
|
-
previousPage: string;
|
|
566
|
-
nextPage: string;
|
|
567
|
-
notFound: string;
|
|
568
|
-
dismissBanner: string;
|
|
569
|
-
toggleTheme: string;
|
|
570
|
-
moreOptions: string;
|
|
571
|
-
copied: string;
|
|
572
|
-
expand: string;
|
|
573
|
-
collapse: string;
|
|
574
|
-
copyPage: string;
|
|
575
|
-
copyPageDescription: string;
|
|
576
|
-
viewMarkdown: string;
|
|
577
|
-
viewMarkdownDescription: string;
|
|
578
|
-
openInChatGPT: string;
|
|
579
|
-
openInClaude: string;
|
|
580
|
-
openInPerplexity: string;
|
|
581
|
-
askQuestionsAboutPage: string;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
599
|
export interface SiteModel {
|
|
585
600
|
name?: string;
|
|
586
601
|
logo: {
|
|
@@ -607,6 +622,7 @@ export interface SiteModel {
|
|
|
607
622
|
drilldown?: boolean;
|
|
608
623
|
locale: string;
|
|
609
624
|
labels: ThemeLabels;
|
|
625
|
+
api: { playground: ResolvedApiPlayground };
|
|
610
626
|
docs: NormalizedDocsConfig;
|
|
611
627
|
}
|
|
612
628
|
|
|
@@ -647,8 +663,16 @@ export interface DocFrontmatter {
|
|
|
647
663
|
timestamp?: boolean;
|
|
648
664
|
/** Related pages rendered above the prev/next pager. */
|
|
649
665
|
related?: RelatedEntry[];
|
|
650
|
-
/**
|
|
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
|
+
*/
|
|
651
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;
|
|
652
676
|
[key: string]: unknown;
|
|
653
677
|
}
|
|
654
678
|
|
|
@@ -671,9 +695,32 @@ export interface SchemaNode {
|
|
|
671
695
|
description?: string;
|
|
672
696
|
default?: string;
|
|
673
697
|
enum?: string[];
|
|
698
|
+
/** Example value (stringified) for parameters, used by samples and the playground. */
|
|
699
|
+
example?: string;
|
|
674
700
|
children?: SchemaNode[];
|
|
675
701
|
}
|
|
676
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
|
+
|
|
677
724
|
export interface OpenApiSample {
|
|
678
725
|
language: string;
|
|
679
726
|
label: string;
|
|
@@ -694,9 +741,18 @@ export interface OpenApiResponse {
|
|
|
694
741
|
|
|
695
742
|
export interface NormalizedOperation {
|
|
696
743
|
id: string;
|
|
697
|
-
/** Frontmatter lookup key, e.g. "GET /users/{id}". */
|
|
744
|
+
/** Frontmatter lookup key, e.g. "GET /users/{id}" or "WEBHOOK userCreated". */
|
|
698
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;
|
|
699
754
|
method: string;
|
|
755
|
+
/** URL path, or the webhook name for webhooks. */
|
|
700
756
|
path: string;
|
|
701
757
|
summary?: string;
|
|
702
758
|
description?: string;
|
|
@@ -716,7 +772,23 @@ export interface NormalizedOperation {
|
|
|
716
772
|
exampleHtml?: string;
|
|
717
773
|
};
|
|
718
774
|
responses: OpenApiResponse[];
|
|
719
|
-
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. */
|
|
720
779
|
serverUrl: string;
|
|
721
780
|
samples: OpenApiSample[];
|
|
722
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/config.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { Translations } from './labels';
|
|
2
|
+
|
|
3
|
+
export type { ThemeLabels, Translations } from './labels';
|
|
4
|
+
|
|
1
5
|
import type { PluggableList } from 'unified';
|
|
2
6
|
|
|
3
7
|
/** Build-time Markdown and MDX compiler extensions. */
|
|
@@ -16,8 +20,10 @@ export interface ShisoConfig {
|
|
|
16
20
|
contentDir?: string;
|
|
17
21
|
/** Absolute site origin (e.g. "https://docs.example.com") used for canonical URLs, og:url, and the sitemap. */
|
|
18
22
|
siteUrl?: string;
|
|
19
|
-
/**
|
|
23
|
+
/** Default locale for UI labels and date formatting. Default "en-US". */
|
|
20
24
|
locale?: string;
|
|
25
|
+
/** Partial UI label overrides keyed by BCP 47 locale. */
|
|
26
|
+
translations?: Translations;
|
|
21
27
|
/** Build-time remark and rehype plugins for Markdown and MDX content. */
|
|
22
28
|
mdx?: MdxConfig;
|
|
23
29
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export interface ThemeLabels {
|
|
2
|
+
menu: string;
|
|
3
|
+
documentationNavigation: string;
|
|
4
|
+
sections: string;
|
|
5
|
+
tableOfContents: string;
|
|
6
|
+
tableOfContentsNavigation: string;
|
|
7
|
+
searchTitle: string;
|
|
8
|
+
searching: string;
|
|
9
|
+
searchUnavailable: string;
|
|
10
|
+
noResults: string;
|
|
11
|
+
lastUpdated: string;
|
|
12
|
+
relatedTopics: string;
|
|
13
|
+
previousPage: string;
|
|
14
|
+
nextPage: string;
|
|
15
|
+
notFound: string;
|
|
16
|
+
dismissBanner: string;
|
|
17
|
+
toggleTheme: string;
|
|
18
|
+
moreOptions: string;
|
|
19
|
+
copied: string;
|
|
20
|
+
expand: string;
|
|
21
|
+
collapse: string;
|
|
22
|
+
copyPage: string;
|
|
23
|
+
copyPageDescription: string;
|
|
24
|
+
viewMarkdown: string;
|
|
25
|
+
viewMarkdownDescription: string;
|
|
26
|
+
openInChatGPT: string;
|
|
27
|
+
openInClaude: string;
|
|
28
|
+
openInPerplexity: string;
|
|
29
|
+
askQuestionsAboutPage: string;
|
|
30
|
+
searchPlaceholder: string;
|
|
31
|
+
poweredBy: string;
|
|
32
|
+
copyCode: string;
|
|
33
|
+
editPage: string;
|
|
34
|
+
feedbackPrompt: string;
|
|
35
|
+
feedbackYes: string;
|
|
36
|
+
feedbackNo: string;
|
|
37
|
+
feedbackSuccess: string;
|
|
38
|
+
feedbackError: string;
|
|
39
|
+
close: string;
|
|
40
|
+
filterUpdates: string;
|
|
41
|
+
clear: string;
|
|
42
|
+
noUpdates: string;
|
|
43
|
+
codeSnippets: string;
|
|
44
|
+
contentTabs: string;
|
|
45
|
+
fileTree: string;
|
|
46
|
+
diagram: string;
|
|
47
|
+
diagramError: string;
|
|
48
|
+
zoomOut: string;
|
|
49
|
+
resetView: string;
|
|
50
|
+
zoomIn: string;
|
|
51
|
+
viewImage: string;
|
|
52
|
+
viewNamedImage: string;
|
|
53
|
+
fullSizeImage: string;
|
|
54
|
+
diagramSource: string;
|
|
55
|
+
fieldName: string;
|
|
56
|
+
fieldType: string;
|
|
57
|
+
fieldDescription: string;
|
|
58
|
+
fieldRequired: string;
|
|
59
|
+
fieldDeprecated: string;
|
|
60
|
+
fieldDefault: string;
|
|
61
|
+
fieldOptions: string;
|
|
62
|
+
allowedTypes: string;
|
|
63
|
+
properties: string;
|
|
64
|
+
apiHeaders: string;
|
|
65
|
+
apiPathParameters: string;
|
|
66
|
+
apiQueryParameters: string;
|
|
67
|
+
apiCookieParameters: string;
|
|
68
|
+
apiRequestBody: string;
|
|
69
|
+
apiResponses: string;
|
|
70
|
+
apiCodeSamples: string;
|
|
71
|
+
apiExampleRequest: string;
|
|
72
|
+
apiExampleResponse: string;
|
|
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;
|
|
99
|
+
}
|
|
100
|
+
|
|
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
|
),
|