@umami/shiso 1.16.0 → 1.18.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 (51) hide show
  1. package/bin/shiso.mjs +0 -0
  2. package/dist/chunks/App.js +310 -205
  3. package/dist/chunks/architectureDiagram-5GKGNRK7.js +1 -1
  4. package/dist/chunks/chunk-GMAD6QVW.js +1 -1
  5. package/dist/chunks/cose-bilkent-JH36ORCC.js +1 -1
  6. package/dist/chunks/dist.js +1 -1
  7. package/dist/chunks/docs.js +848 -202
  8. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +1 -1
  9. package/dist/chunks/src.js +1 -1
  10. package/dist/entry-client.js +1 -1
  11. package/dist/entry-server.js +2 -2
  12. package/docs.schema.json +1135 -1003
  13. package/package.json +1 -1
  14. package/scripts/check-content.mjs +2 -0
  15. package/scripts/load-shiso-config.mjs +30 -1
  16. package/src/App.tsx +41 -23
  17. package/src/components/CodeBlock.tsx +3 -1
  18. package/src/components/DocContent.tsx +15 -6
  19. package/src/components/Docs.tsx +3 -1
  20. package/src/components/Footer.tsx +3 -1
  21. package/src/components/Header.tsx +4 -3
  22. package/src/components/LanguageSwitcher.tsx +27 -7
  23. package/src/components/OpenApiOperation.tsx +22 -15
  24. package/src/components/PageActions.tsx +135 -0
  25. package/src/components/docs/Changelog.tsx +27 -13
  26. package/src/components/docs/CodeGroup.tsx +3 -1
  27. package/src/components/docs/Mermaid.tsx +8 -6
  28. package/src/components/docs/PropertiesTable.tsx +11 -6
  29. package/src/components/docs/Tabs.tsx +3 -1
  30. package/src/components/docs/Tree.tsx +3 -1
  31. package/src/components/docs/ZoomableImage.tsx +4 -2
  32. package/src/components/ui/dialog.tsx +7 -2
  33. package/src/components/ui/sheet.tsx +5 -2
  34. package/src/lib/label-context.tsx +7 -0
  35. package/src/lib/labels.ts +37 -0
  36. package/src/lib/locale.ts +25 -0
  37. package/src/lib/openapi.ts +21 -8
  38. package/src/lib/site-config.ts +66 -2
  39. package/src/lib/site-model.ts +4 -32
  40. package/src/lib/standalone-pages.ts +15 -1
  41. package/src/lib/translations/de.json +74 -0
  42. package/src/lib/translations/en.json +74 -0
  43. package/src/lib/translations/es.json +74 -0
  44. package/src/lib/translations/fr.json +74 -0
  45. package/src/lib/translations/ja.json +74 -0
  46. package/src/lib/translations/zh-Hans.json +74 -0
  47. package/src/lib/translations/zh-Hant.json +74 -0
  48. package/src/lib/types.ts +44 -32
  49. package/src/styles/global.css +1 -1
  50. package/types/config.d.ts +7 -1
  51. package/types/labels.d.ts +76 -0
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
- /** Locale used for deterministic date formatting. */
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 {
@@ -242,6 +261,22 @@ export interface ErrorsConfig {
242
261
  '404'?: Error404Config;
243
262
  }
244
263
 
264
+ export interface EditLinkConfig {
265
+ /** HTTP(S) URL template. $file is the encoded source path relative to the project root. */
266
+ url: string;
267
+ label?: string;
268
+ }
269
+
270
+ export interface FeedbackConfig {
271
+ /** HTTP(S) or site-relative endpoint accepting a JSON POST. */
272
+ endpoint: string;
273
+ prompt?: string;
274
+ helpfulLabel?: string;
275
+ unhelpfulLabel?: string;
276
+ successMessage?: string;
277
+ errorMessage?: string;
278
+ }
279
+
245
280
  export interface MetadataConfig {
246
281
  /** Show the last-modified date on all pages. Overridable per page via `timestamp` frontmatter. */
247
282
  timestamp?: boolean;
@@ -372,6 +407,8 @@ export interface DocsConfig {
372
407
  seo?: SeoConfig;
373
408
  errors?: ErrorsConfig;
374
409
  metadata?: MetadataConfig;
410
+ editLink?: false | EditLinkConfig;
411
+ feedback?: false | FeedbackConfig;
375
412
  appearance?: AppearanceConfig;
376
413
  styling?: StylingConfig;
377
414
  fonts?: FontsConfig;
@@ -532,37 +569,6 @@ export interface NormalizedFooter {
532
569
  attribution: boolean;
533
570
  }
534
571
 
535
- export interface ThemeLabels {
536
- menu: string;
537
- documentationNavigation: string;
538
- sections: string;
539
- tableOfContents: string;
540
- tableOfContentsNavigation: string;
541
- searchTitle: string;
542
- searching: string;
543
- searchUnavailable: string;
544
- noResults: string;
545
- lastUpdated: string;
546
- relatedTopics: string;
547
- previousPage: string;
548
- nextPage: string;
549
- notFound: string;
550
- dismissBanner: string;
551
- toggleTheme: string;
552
- moreOptions: string;
553
- copied: string;
554
- expand: string;
555
- collapse: string;
556
- copyPage: string;
557
- copyPageDescription: string;
558
- viewMarkdown: string;
559
- viewMarkdownDescription: string;
560
- openInChatGPT: string;
561
- openInClaude: string;
562
- openInPerplexity: string;
563
- askQuestionsAboutPage: string;
564
- }
565
-
566
572
  export interface SiteModel {
567
573
  name?: string;
568
574
  logo: {
@@ -584,6 +590,8 @@ export interface SiteModel {
584
590
  contextualOptions: ContextualOption[];
585
591
  error404: Required<Pick<Error404Config, 'redirect'>> & Error404Config;
586
592
  showTimestamp: boolean;
593
+ editLink?: EditLinkConfig | null;
594
+ feedback?: FeedbackConfig | null;
587
595
  drilldown?: boolean;
588
596
  locale: string;
589
597
  labels: ThemeLabels;
@@ -614,6 +622,10 @@ export interface TocEntry {
614
622
  export type RelatedEntry = string | { href: string; title?: string };
615
623
 
616
624
  export interface DocFrontmatter {
625
+ /** Override the edit URL, or hide the edit link on this page. */
626
+ editLink?: string | false;
627
+ /** Hide the feedback controls on this page. */
628
+ feedback?: false;
617
629
  title?: string;
618
630
  description?: string;
619
631
  noindex?: boolean;
@@ -183,7 +183,7 @@
183
183
  border-radius: var(--radius-sm);
184
184
  background: color-mix(in srgb, currentColor 4%, transparent);
185
185
  padding: 0.1rem 0.3rem;
186
- font-size: 0.875rem;
186
+ font-size: 0.875em;
187
187
  }
188
188
 
189
189
  /* Shared by GFM tables and the PropertiesTable component: rounded outer border,
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
- /** Locale used for deterministic date formatting. Default "en-US". */
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,76 @@
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
+ }
75
+
76
+ export type Translations = Record<string, Partial<ThemeLabels>>;