@umami/shiso 1.11.0 → 1.13.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 (148) hide show
  1. package/bin/shiso.mjs +20 -1
  2. package/dist/chunks/App.js +412 -51
  3. package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
  4. package/dist/chunks/arc.js +130 -0
  5. package/dist/chunks/architecture-7GRP2DOG.js +4 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
  7. package/dist/chunks/array.js +8 -0
  8. package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
  9. package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
  10. package/dist/chunks/channel.js +9 -0
  11. package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
  12. package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
  13. package/dist/chunks/chunk-5VM5RSS4.js +21 -0
  14. package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
  15. package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
  16. package/dist/chunks/chunk-F27PBJKO.js +95 -0
  17. package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
  18. package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
  19. package/dist/chunks/chunk-GVQU2GXP.js +58 -0
  20. package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
  21. package/dist/chunks/chunk-JWPE2WC7.js +12 -0
  22. package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
  23. package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
  24. package/dist/chunks/chunk-P2QGCYS3.js +95 -0
  25. package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
  26. package/dist/chunks/chunk-PWAF6VOD.js +467 -0
  27. package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
  28. package/dist/chunks/chunk-SVP7TREG.js +686 -0
  29. package/dist/chunks/chunk-TICWLB2K.js +3800 -0
  30. package/dist/chunks/chunk-XXDRQBXY.js +12 -0
  31. package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
  32. package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
  33. package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
  34. package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
  35. package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
  36. package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
  37. package/dist/chunks/cytoscape.esm.js +28282 -0
  38. package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
  39. package/dist/chunks/dagre.js +4235 -0
  40. package/dist/chunks/defaultLocale.js +246 -0
  41. package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
  42. package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
  43. package/dist/chunks/diagram-VSXAHHWV.js +553 -0
  44. package/dist/chunks/diagram-VX7I27RA.js +798 -0
  45. package/dist/chunks/diagram-Z3DM3KII.js +186 -0
  46. package/dist/chunks/dist.js +92 -0
  47. package/dist/chunks/docs.js +989 -93
  48. package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
  49. package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
  50. package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
  51. package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
  52. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
  53. package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
  54. package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
  55. package/dist/chunks/graphlib.js +4194 -0
  56. package/dist/chunks/info-A6RAGUB7.js +4 -0
  57. package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
  58. package/dist/chunks/init.js +14 -0
  59. package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
  60. package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
  61. package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
  62. package/dist/chunks/katex.js +26463 -0
  63. package/dist/chunks/line.js +48 -0
  64. package/dist/chunks/linear.js +391 -0
  65. package/dist/chunks/mermaid-parser.core.js +754 -0
  66. package/dist/chunks/mermaid.core.js +4898 -0
  67. package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
  68. package/dist/chunks/ordinal.js +84 -0
  69. package/dist/chunks/packet-AYTQ26CC.js +4 -0
  70. package/dist/chunks/path.js +106 -0
  71. package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
  72. package/dist/chunks/pie-WAS4IAKB.js +4 -0
  73. package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
  74. package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
  75. package/dist/chunks/radar-RG4KPBEZ.js +4 -0
  76. package/dist/chunks/railroad-74A4TZTK.js +4 -0
  77. package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
  78. package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
  79. package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
  80. package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
  81. package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
  82. package/dist/chunks/rough.esm.js +1396 -0
  83. package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
  84. package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
  85. package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
  86. package/dist/chunks/src.js +2653 -0
  87. package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
  88. package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
  89. package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
  90. package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
  91. package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
  92. package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
  93. package/dist/chunks/treemap-WGGIJYW6.js +4 -0
  94. package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
  95. package/dist/chunks/wardley-WFR3VGLG.js +4 -0
  96. package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
  97. package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
  98. package/dist/components.js +2 -2
  99. package/dist/entry-client.js +2 -2
  100. package/dist/entry-server.js +31 -3
  101. package/docs.schema.json +90 -0
  102. package/mdx.config.ts +13 -97
  103. package/package.json +6 -4
  104. package/scripts/build-runtime.mjs +1 -0
  105. package/scripts/check-content.mjs +358 -0
  106. package/scripts/expand-navigation-globs.mjs +277 -0
  107. package/scripts/expand-openapi-navigation.mjs +94 -0
  108. package/scripts/generate-openapi.mjs +117 -0
  109. package/scripts/generate-search-index.mjs +31 -1
  110. package/scripts/lib/openapi.mjs +653 -0
  111. package/scripts/load-docs-config.mjs +52 -6
  112. package/scripts/load-shiso-config.mjs +45 -3
  113. package/scripts/prerender.mjs +83 -3
  114. package/scripts/vite-docs-config.mjs +27 -6
  115. package/src/App.tsx +0 -1
  116. package/src/components/CodeBlock.tsx +108 -8
  117. package/src/components/DocContent.tsx +18 -0
  118. package/src/components/Docs.tsx +45 -17
  119. package/src/components/OpenApiOperation.tsx +205 -0
  120. package/src/components/SideNav.tsx +13 -2
  121. package/src/components/docs/Changelog.tsx +163 -0
  122. package/src/components/docs/CodeGroup.tsx +6 -2
  123. package/src/components/docs/Mermaid.tsx +164 -0
  124. package/src/components/docs/Panel.tsx +23 -0
  125. package/src/components/docs/ParamField.tsx +17 -5
  126. package/src/components/docs/PropertiesTable.tsx +2 -2
  127. package/src/components/docs/ResponseField.tsx +17 -5
  128. package/src/components/docs/Tiles.tsx +59 -0
  129. package/src/components/docs/Tree.tsx +359 -0
  130. package/src/components/docs/Update.tsx +72 -0
  131. package/src/components/docs/index.ts +7 -0
  132. package/src/components/docs/panel-context.tsx +25 -0
  133. package/src/components/docs/styles.ts +49 -0
  134. package/src/components/icons/index.ts +4 -0
  135. package/src/entry-server.tsx +50 -0
  136. package/src/lib/code-blocks.ts +18 -0
  137. package/src/lib/code-meta.ts +87 -0
  138. package/src/lib/docs-config.ts +4 -1
  139. package/src/lib/openapi.generated.ts +4 -0
  140. package/src/lib/openapi.ts +63 -0
  141. package/src/lib/rehype-shiki.ts +213 -0
  142. package/src/lib/site-model.ts +2 -0
  143. package/src/lib/types.ts +116 -2
  144. package/src/styles/global.css +63 -73
  145. package/types/components.d.ts +79 -0
  146. package/types/config.d.ts +11 -4
  147. package/vite.config.ts +49 -3
  148. package/CHANGELOG.md +0 -171
package/src/lib/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { PluggableList } from 'unified';
2
+
1
3
  /* ---------------------------------------------------------------------------
2
4
  * Raw docs.json shapes
3
5
  * ------------------------------------------------------------------------- */
@@ -8,6 +10,8 @@ export interface PageObjectItem {
8
10
  label?: string;
9
11
  icon?: string;
10
12
  tag?: string;
13
+ /** HTTP method badge shown in the sidebar, set by OpenAPI navigation entries. */
14
+ method?: string;
11
15
  hidden?: boolean;
12
16
  }
13
17
 
@@ -21,7 +25,12 @@ export interface LinkItem {
21
25
  target?: LinkTarget;
22
26
  }
23
27
 
24
- export type PageItem = string | GroupItem | PageObjectItem | LinkItem;
28
+ export interface GlobItem {
29
+ glob: string;
30
+ exclude?: string[];
31
+ }
32
+
33
+ export type PageItem = string | GroupItem | PageObjectItem | LinkItem | GlobItem;
25
34
 
26
35
  export interface GroupItem {
27
36
  group: string;
@@ -113,6 +122,11 @@ export type LogoOption =
113
122
 
114
123
  /** Project-level settings supplied by shiso.config.ts. Mirrors the public
115
124
  * shape exported from "@umami/shiso/config". */
125
+ export interface MdxConfig {
126
+ remarkPlugins?: PluggableList;
127
+ rehypePlugins?: PluggableList;
128
+ }
129
+
116
130
  export interface ShisoConfig {
117
131
  /** Where docs pages are mounted within the site. Default "/docs"; "" for root. */
118
132
  docsPrefix?: string;
@@ -122,6 +136,8 @@ export interface ShisoConfig {
122
136
  siteUrl?: string;
123
137
  /** Locale used for deterministic date formatting. */
124
138
  locale?: string;
139
+ /** Build-time remark and rehype plugins. */
140
+ mdx?: MdxConfig;
125
141
  }
126
142
 
127
143
  /** ShisoConfig after defaults and normalization, as served by `virtual:shiso-config`. */
@@ -130,6 +146,8 @@ export interface ResolvedShisoConfig {
130
146
  contentDir: string;
131
147
  siteUrl?: string;
132
148
  locale: string;
149
+ /** Build-only compiler hooks. Removed from the virtual browser module. */
150
+ mdx?: MdxConfig;
133
151
  }
134
152
 
135
153
  export type LinkTarget = '_self' | '_blank';
@@ -236,9 +254,26 @@ export interface AppearanceConfig {
236
254
  strict?: boolean;
237
255
  }
238
256
 
257
+ export interface CodeBlockConfig {
258
+ /** Show line numbers on every block. Override per block with `showLineNumbers` or `hideLineNumbers`. */
259
+ lineNumbers?: boolean;
260
+ /** Bundled Shiki theme names for each color mode. */
261
+ theme?: {
262
+ light?: string;
263
+ dark?: string;
264
+ };
265
+ }
266
+
239
267
  export interface StylingConfig {
240
268
  /** Page eyebrow style: the section name (default) or the full breadcrumb path. */
241
269
  eyebrows?: 'section' | 'breadcrumbs';
270
+ /** Fenced code block defaults. */
271
+ codeBlocks?: CodeBlockConfig;
272
+ }
273
+
274
+ export interface ResolvedCodeBlockConfig {
275
+ lineNumbers: boolean;
276
+ theme: { light: string; dark: string };
242
277
  }
243
278
 
244
279
  export interface FontSpec {
@@ -345,6 +380,15 @@ export interface DocsConfig {
345
380
  search?: false | SearchConfig;
346
381
  interaction?: InteractionConfig;
347
382
  contextual?: ContextualConfig;
383
+ /** API reference settings: the OpenAPI spec powering `openapi:` frontmatter pages. */
384
+ api?: ApiConfig;
385
+ }
386
+
387
+ export interface ApiConfig {
388
+ /** Path to a local OpenAPI 3.x spec (JSON or YAML), relative to the project root. */
389
+ spec: string;
390
+ /** Folder inside the content directory for generated endpoint pages. Default "api-reference". */
391
+ directory?: string;
348
392
  }
349
393
 
350
394
  /* ---------------------------------------------------------------------------
@@ -387,6 +431,8 @@ export interface NormalizedDocsPage {
387
431
  tag?: string;
388
432
  /** Module key of the MDX file, e.g. "/content/docs/installation.mdx". */
389
433
  filePath: string;
434
+ /** HTTP method badge for API reference pages. */
435
+ method?: string;
390
436
  }
391
437
 
392
438
  /** A routed docs page in the navigation tree. */
@@ -530,7 +576,10 @@ export interface SiteModel {
530
576
  footer: NormalizedFooter | null;
531
577
  banner: BannerConfig | null;
532
578
  appearance: Required<AppearanceConfig>;
533
- styling: Required<Pick<StylingConfig, 'eyebrows'>>;
579
+ styling: {
580
+ eyebrows: 'section' | 'breadcrumbs';
581
+ codeBlocks: ResolvedCodeBlockConfig;
582
+ };
534
583
  search: import('@/lib/search/config').ResolvedSearchConfig;
535
584
  contextualOptions: ContextualOption[];
536
585
  error404: Required<Pick<Error404Config, 'redirect'>> & Error404Config;
@@ -574,6 +623,8 @@ export interface DocFrontmatter {
574
623
  timestamp?: boolean;
575
624
  /** Related pages rendered above the prev/next pager. */
576
625
  related?: RelatedEntry[];
626
+ /** Binds the page to an API operation, e.g. "GET /users/{id}". */
627
+ openapi?: string;
577
628
  [key: string]: unknown;
578
629
  }
579
630
 
@@ -582,3 +633,66 @@ export interface DocModule {
582
633
  frontmatter?: DocFrontmatter;
583
634
  toc?: TocEntry[];
584
635
  }
636
+
637
+ /* ---------------------------------------------------------------------------
638
+ * OpenAPI reference shapes (produced by scripts/lib/openapi.mjs)
639
+ * ------------------------------------------------------------------------- */
640
+
641
+ export interface SchemaNode {
642
+ name?: string;
643
+ /** Display label such as "string", "User[]", "enum<string>", or "oneOf". */
644
+ type: string;
645
+ required?: boolean;
646
+ deprecated?: boolean;
647
+ description?: string;
648
+ default?: string;
649
+ enum?: string[];
650
+ children?: SchemaNode[];
651
+ }
652
+
653
+ export interface OpenApiSample {
654
+ language: string;
655
+ label: string;
656
+ source: string;
657
+ /** Shiki-highlighted markup generated at build time. */
658
+ html?: string;
659
+ lineCount?: number;
660
+ }
661
+
662
+ export interface OpenApiResponse {
663
+ status: string;
664
+ description?: string;
665
+ contentType?: string;
666
+ schema?: SchemaNode;
667
+ example?: string;
668
+ exampleHtml?: string;
669
+ }
670
+
671
+ export interface NormalizedOperation {
672
+ id: string;
673
+ /** Frontmatter lookup key, e.g. "GET /users/{id}". */
674
+ key: string;
675
+ method: string;
676
+ path: string;
677
+ summary?: string;
678
+ description?: string;
679
+ tags: string[];
680
+ deprecated?: boolean;
681
+ parameters: {
682
+ query: SchemaNode[];
683
+ path: SchemaNode[];
684
+ header: SchemaNode[];
685
+ cookie: SchemaNode[];
686
+ };
687
+ requestBody?: {
688
+ required?: boolean;
689
+ contentType: string;
690
+ schema: SchemaNode;
691
+ example?: string;
692
+ exampleHtml?: string;
693
+ };
694
+ responses: OpenApiResponse[];
695
+ security: string[];
696
+ serverUrl: string;
697
+ samples: OpenApiSample[];
698
+ }
@@ -256,88 +256,78 @@
256
256
  }
257
257
  }
258
258
 
259
- /* These rules are unlayered so they can override Highlight.js's unlayered theme. */
260
-
261
- code.hljs {
262
- background: transparent;
263
- }
264
-
265
- /* The scroll area owns code-block overflow and padding. */
266
- pre.code-block code.hljs {
267
- overflow: visible;
268
- padding: 0;
269
- }
270
-
271
- /* GitHub Dark syntax colors, scoped so the default GitHub theme stays light. */
272
- [data-theme="dark"] .hljs {
273
- color: #c9d1d9;
274
- }
259
+ @layer components {
260
+ /* Shiki output: one inline-block per line so highlight and diff bands span the
261
+ full scroll width. Line numbers and diff markers are pseudo-elements, which
262
+ keeps them out of the copy button, text selection, and the search index. */
263
+ .code-block .line {
264
+ position: relative;
265
+ display: inline-block;
266
+ box-sizing: border-box;
267
+ min-width: 100%;
268
+ min-height: 1lh;
269
+ padding-inline: 0.75rem 3rem;
270
+ }
275
271
 
276
- [data-theme="dark"]
277
- :is(
278
- .hljs-doctag,
279
- .hljs-keyword,
280
- .hljs-meta .hljs-keyword,
281
- .hljs-template-tag,
282
- .hljs-template-variable,
283
- .hljs-type,
284
- .hljs-variable.language_
285
- ) {
286
- color: #ff7b72;
287
- }
272
+ .code-block .line span {
273
+ color: var(--shiki-light);
274
+ font-style: var(--shiki-light-font-style, inherit);
275
+ font-weight: var(--shiki-light-font-weight, inherit);
276
+ text-decoration: var(--shiki-light-text-decoration, inherit);
277
+ }
288
278
 
289
- [data-theme="dark"]
290
- :is(.hljs-title, .hljs-title.class_, .hljs-title.class_.inherited__, .hljs-title.function_) {
291
- color: #d2a8ff;
292
- }
279
+ [data-theme="dark"] .code-block .line span {
280
+ color: var(--shiki-dark);
281
+ font-style: var(--shiki-dark-font-style, inherit);
282
+ font-weight: var(--shiki-dark-font-weight, inherit);
283
+ text-decoration: var(--shiki-dark-text-decoration, inherit);
284
+ }
293
285
 
294
- [data-theme="dark"]
295
- :is(
296
- .hljs-attr,
297
- .hljs-attribute,
298
- .hljs-literal,
299
- .hljs-meta,
300
- .hljs-number,
301
- .hljs-operator,
302
- .hljs-variable,
303
- .hljs-selector-attr,
304
- .hljs-selector-class,
305
- .hljs-selector-id,
306
- .hljs-section
307
- ) {
308
- color: #79c0ff;
309
- }
286
+ .code-block .line[data-highlighted] {
287
+ background: color-mix(in srgb, var(--primary) 10%, transparent);
288
+ box-shadow: inset 2px 0 var(--primary);
289
+ }
310
290
 
311
- [data-theme="dark"] :is(.hljs-regexp, .hljs-string, .hljs-meta .hljs-string) {
312
- color: #a5d6ff;
313
- }
291
+ .code-block .line[data-diff="add"] {
292
+ background: color-mix(in srgb, #3fb950 14%, transparent);
293
+ }
314
294
 
315
- [data-theme="dark"] :is(.hljs-built_in, .hljs-symbol) {
316
- color: #ffa657;
317
- }
295
+ .code-block .line[data-diff="remove"] {
296
+ background: color-mix(in srgb, #f85149 14%, transparent);
297
+ }
318
298
 
319
- [data-theme="dark"] :is(.hljs-comment, .hljs-code, .hljs-formula) {
320
- color: #8b949e;
321
- }
299
+ .code-block[data-diff-markers] .line {
300
+ padding-inline-start: 1.5rem;
301
+ }
322
302
 
323
- [data-theme="dark"] :is(.hljs-name, .hljs-quote, .hljs-selector-tag, .hljs-selector-pseudo) {
324
- color: #7ee787;
325
- }
303
+ .code-block[data-diff-markers] .line[data-diff]::after {
304
+ position: absolute;
305
+ top: 0;
306
+ left: 0.5rem;
307
+ color: var(--muted-foreground);
308
+ user-select: none;
309
+ }
326
310
 
327
- [data-theme="dark"] :is(.hljs-subst, .hljs-emphasis, .hljs-strong) {
328
- color: #c9d1d9;
329
- }
311
+ .code-block[data-diff-markers] .line[data-diff="add"]::after {
312
+ content: "+";
313
+ }
330
314
 
331
- [data-theme="dark"] .hljs-bullet {
332
- color: #f2cc60;
333
- }
315
+ .code-block[data-diff-markers] .line[data-diff="remove"]::after {
316
+ content: "-";
317
+ }
334
318
 
335
- [data-theme="dark"] .hljs-addition {
336
- color: #aff5b4;
337
- background-color: #033a16;
338
- }
319
+ /* `counter-reset` is set inline by CodeBlock so blocks can start at any line. */
320
+ .code-block[data-line-numbers] .line {
321
+ counter-increment: line;
322
+ }
339
323
 
340
- [data-theme="dark"] .hljs-deletion {
341
- color: #ffdcd7;
342
- background-color: #67060c;
324
+ .code-block[data-line-numbers] .line::before {
325
+ content: counter(line);
326
+ display: inline-block;
327
+ width: var(--code-gutter, 2ch);
328
+ margin-inline-end: 1rem;
329
+ color: var(--muted-foreground);
330
+ text-align: right;
331
+ user-select: none;
332
+ }
343
333
  }
@@ -211,6 +211,85 @@ export interface TooltipProps {
211
211
 
212
212
  export declare function Tooltip(props: TooltipProps): ReactElement;
213
213
 
214
+ export interface UpdateRss {
215
+ title?: string;
216
+ description?: string;
217
+ }
218
+
219
+ export interface UpdateProps {
220
+ label: string;
221
+ description?: ReactNode;
222
+ tags?: string[];
223
+ rss?: UpdateRss;
224
+ children?: ReactNode;
225
+ }
226
+
227
+ export declare function Update(props: UpdateProps): ReactElement;
228
+
229
+ export interface ChangelogProps {
230
+ children?: ReactNode;
231
+ }
232
+
233
+ export declare function Changelog(props: ChangelogProps): ReactElement;
234
+
235
+ export type MermaidPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
236
+
237
+ export interface MermaidProps {
238
+ chart?: string;
239
+ title?: ReactNode;
240
+ actions?: boolean;
241
+ placement?: MermaidPlacement;
242
+ children?: ReactNode;
243
+ }
244
+
245
+ export declare function Mermaid(props: MermaidProps): ReactElement;
246
+
247
+ export interface PanelProps {
248
+ children?: ReactNode;
249
+ }
250
+
251
+ export declare function Panel(props: PanelProps): ReactElement;
252
+
253
+ export interface TileProps {
254
+ href: string;
255
+ title?: ReactNode;
256
+ description?: ReactNode;
257
+ children: ReactNode;
258
+ target?: '_self' | '_blank';
259
+ }
260
+
261
+ export interface TilesProps {
262
+ children?: ReactNode;
263
+ cols?: 1 | 2 | 3 | 4;
264
+ }
265
+
266
+ export declare function Tile(props: TileProps): ReactElement;
267
+ export declare function Tiles(props: TilesProps): ReactElement;
268
+
269
+ export interface TreeFolderProps {
270
+ name: string;
271
+ defaultOpen?: boolean;
272
+ openable?: boolean;
273
+ highlight?: boolean;
274
+ children?: ReactNode;
275
+ }
276
+
277
+ export interface TreeFileProps {
278
+ name: string;
279
+ highlight?: boolean;
280
+ }
281
+
282
+ export interface TreeProps {
283
+ children?: ReactNode;
284
+ style?: React.CSSProperties;
285
+ className?: string;
286
+ }
287
+
288
+ export declare function Tree(props: TreeProps): ReactElement;
289
+ export declare function FileTree(props: TreeProps): ReactElement;
290
+ export declare function TreeFolder(props: TreeFolderProps): ReactElement;
291
+ export declare function TreeFile(props: TreeFileProps): ReactElement;
292
+
214
293
  export interface ZoomableImageProps extends ImgHTMLAttributes<HTMLImageElement> {
215
294
  noZoom?: boolean;
216
295
  }
package/types/config.d.ts CHANGED
@@ -1,7 +1,12 @@
1
- /**
2
- * Public types for shiso.config.ts. Kept self-contained (no imports) so the
3
- * config file typechecks in consuming projects without pulling in the runtime.
4
- */
1
+ import type { PluggableList } from 'unified';
2
+
3
+ /** Build-time Markdown and MDX compiler extensions. */
4
+ export interface MdxConfig {
5
+ /** Unified remark plugins, run before Shiso's code-title and table-of-contents transforms. */
6
+ remarkPlugins?: PluggableList;
7
+ /** Unified rehype plugins, run before Shiso's highlighting, image, and heading transforms. */
8
+ rehypePlugins?: PluggableList;
9
+ }
5
10
 
6
11
  /** Project-level settings supplied by shiso.config.ts. All fields are optional. */
7
12
  export interface ShisoConfig {
@@ -13,6 +18,8 @@ export interface ShisoConfig {
13
18
  siteUrl?: string;
14
19
  /** Locale used for deterministic date formatting. Default "en-US". */
15
20
  locale?: string;
21
+ /** Build-time remark and rehype plugins for Markdown and MDX content. */
22
+ mdx?: MdxConfig;
16
23
  }
17
24
 
18
25
  /** Identity helper that types a shiso.config.ts default export. */
package/vite.config.ts CHANGED
@@ -7,8 +7,10 @@ import { defineConfig, type Plugin, searchForWorkspaceRoot } from 'vite';
7
7
  import { shisoMdx } from './mdx.config.ts';
8
8
  import { generateIconRegistry } from './scripts/generate-icon-registry.mjs';
9
9
  import { shisoLastModified } from './scripts/generate-last-modified.mjs';
10
+ import { generateOpenApiModule } from './scripts/generate-openapi.mjs';
10
11
  import { generateSearchIndex } from './scripts/generate-search-index.mjs';
11
12
  import { createDocsConfigModule } from './scripts/vite-docs-config.mjs';
13
+ import { resolveCodeBlockConfig } from './src/lib/code-blocks.ts';
12
14
  import type { DocsConfig, ResolvedShisoConfig } from './src/lib/types.ts';
13
15
 
14
16
  /**
@@ -37,6 +39,34 @@ function shisoIconRegistry(getDocsConfig: () => DocsConfig, root: string, output
37
39
  * Keeps src/lib/search-index.generated.ts in sync with content, so the search
38
40
  * dialog can query page text without a server.
39
41
  */
42
+ function shisoOpenApi(
43
+ getDocsConfig: () => DocsConfig,
44
+ getSpecPath: () => string | undefined,
45
+ root: string,
46
+ output: string,
47
+ ): Plugin {
48
+ const generate = () =>
49
+ generateOpenApiModule({
50
+ root,
51
+ config: getDocsConfig(),
52
+ theme: resolveCodeBlockConfig(getDocsConfig().styling).theme,
53
+ output,
54
+ });
55
+
56
+ return {
57
+ name: 'shiso-openapi',
58
+ async buildStart() {
59
+ await generate();
60
+ },
61
+ async handleHotUpdate({ file }) {
62
+ const specPath = getSpecPath();
63
+ if ((specPath && path.resolve(file) === specPath) || file.endsWith('docs.json')) {
64
+ await generate();
65
+ }
66
+ },
67
+ };
68
+ }
69
+
40
70
  function shisoSearchIndex(
41
71
  getDocsConfig: () => DocsConfig,
42
72
  getShisoConfig: () => ResolvedShisoConfig,
@@ -221,8 +251,11 @@ function buildThemeCss(config: DocsConfig): string {
221
251
  }
222
252
 
223
253
  return [
224
- root.length ? `:root{${root.join('')}}` : '',
225
- dark.length ? `[data-theme="dark"]{${dark.join('')}}` : '',
254
+ // App styles are loaded by the client entry after this head style in dev.
255
+ // Use a more specific selector than the default token declarations so
256
+ // configured theme values win regardless of stylesheet load order.
257
+ root.length ? `html:root{${root.join('')}}` : '',
258
+ dark.length ? `html[data-theme="dark"]{${dark.join('')}}` : '',
226
259
  ...extra,
227
260
  ]
228
261
  .filter(Boolean)
@@ -459,9 +492,18 @@ export default defineConfig(async () => {
459
492
  projectRoot,
460
493
  path.join(generatedRoot, 'search-index.generated.ts'),
461
494
  ),
495
+ shisoOpenApi(
496
+ getDocsConfig,
497
+ () => configModule.getSpecPath?.(),
498
+ projectRoot,
499
+ path.join(generatedRoot, 'openapi.generated.ts'),
500
+ ),
462
501
  shisoHtml(getDocsConfig),
463
502
  shisoMarkdownDev(getDocsConfig, getShisoConfig, projectRoot),
464
- shisoMdx(),
503
+ shisoMdx({
504
+ ...getShisoConfig().mdx,
505
+ codeBlocks: resolveCodeBlockConfig(getDocsConfig().styling),
506
+ }),
465
507
  react({ include: /\.(mdx|md|tsx|ts|jsx|js)$/ }),
466
508
  ],
467
509
  resolve: {
@@ -476,6 +518,10 @@ export default defineConfig(async () => {
476
518
  find: '@/lib/search-index.generated',
477
519
  replacement: path.join(generatedRoot, 'search-index.generated.ts'),
478
520
  },
521
+ {
522
+ find: '@/lib/openapi.generated',
523
+ replacement: path.join(generatedRoot, 'openapi.generated.ts'),
524
+ },
479
525
  {
480
526
  find: '@/generated/last-modified',
481
527
  replacement: path.join(generatedRoot, 'last-modified.ts'),