@umami/shiso 1.10.0 → 1.12.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 (43) hide show
  1. package/bin/shiso.mjs +20 -1
  2. package/dist/chunks/App.js +363 -29
  3. package/dist/chunks/docs.js +33 -41
  4. package/dist/entry-client.js +1 -1
  5. package/dist/entry-server.js +30 -2
  6. package/docs.schema.json +90 -0
  7. package/mdx.config.ts +13 -97
  8. package/package.json +5 -4
  9. package/scripts/build-runtime.mjs +1 -0
  10. package/scripts/check-content.mjs +358 -0
  11. package/scripts/expand-navigation-globs.mjs +208 -0
  12. package/scripts/expand-openapi-navigation.mjs +94 -0
  13. package/scripts/generate-openapi.mjs +117 -0
  14. package/scripts/generate-search-index.mjs +31 -1
  15. package/scripts/lib/openapi.mjs +653 -0
  16. package/scripts/load-docs-config.mjs +52 -6
  17. package/scripts/load-shiso-config.mjs +45 -3
  18. package/scripts/prerender.mjs +83 -3
  19. package/scripts/vite-docs-config.mjs +27 -6
  20. package/src/App.tsx +0 -1
  21. package/src/components/CodeBlock.tsx +73 -9
  22. package/src/components/DocContent.tsx +24 -3
  23. package/src/components/Docs.tsx +6 -1
  24. package/src/components/OpenApiOperation.tsx +197 -0
  25. package/src/components/SideNav.tsx +8 -2
  26. package/src/components/docs/Card.tsx +1 -1
  27. package/src/components/docs/CodeGroup.tsx +6 -2
  28. package/src/components/docs/Expandable.tsx +1 -1
  29. package/src/components/docs/PropertiesTable.tsx +12 -25
  30. package/src/components/docs/styles.ts +7 -4
  31. package/src/entry-server.tsx +50 -0
  32. package/src/lib/code-blocks.ts +18 -0
  33. package/src/lib/code-meta.ts +87 -0
  34. package/src/lib/docs-config.ts +4 -1
  35. package/src/lib/openapi.generated.ts +4 -0
  36. package/src/lib/openapi.ts +63 -0
  37. package/src/lib/rehype-shiki.ts +196 -0
  38. package/src/lib/site-model.ts +2 -0
  39. package/src/lib/types.ts +116 -2
  40. package/src/styles/global.css +75 -76
  41. package/types/config.d.ts +11 -4
  42. package/vite.config.ts +49 -3
  43. package/CHANGELOG.md +0 -171
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'),
package/CHANGELOG.md DELETED
@@ -1,171 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `@umami/shiso` are documented here. This project follows
4
- [Semantic Versioning](https://semver.org/).
5
-
6
- ## Unreleased
7
-
8
- ### Added
9
-
10
- - `Link` export from `@umami/shiso/components`: a client-side navigation link
11
- bound to Shiso's router, for TSX standalone pages and other app code.
12
- Importing `react-router` directly from app code creates a second router
13
- instance without Shiso's context, so use this instead.
14
- - Public `@umami/shiso/components` entry point for importing Shiso's built-in
15
- content components from TSX standalone pages and other React modules.
16
- - TSX standalone pages under `content/pages`. Component pages retain Shiso's
17
- site chrome, metadata, sitemap, and prerendering behavior while owning their
18
- layout without the `.docs-markdown` typography wrapper. Raw `.md` copies are
19
- only generated for Markdown and MDX pages.
20
- - `not-prose` escape hatch: elements with the `not-prose` class (and their
21
- descendants) are excluded from `.docs-markdown` typography styles — headings,
22
- lists, tables, links, and spacing rules — so embedded UI components render
23
- with their own styles. Guards use `:not(:where(…))` and add no specificity.
24
- - Per-page `search: false` frontmatter to hide the header search control and
25
- disable its keyboard shortcut on selected docs or standalone pages.
26
- - Link tabs: a navigation tab may define `href` instead of `groups`/`pages`/
27
- `dropdowns` to link to a standalone page or external URL from the top
28
- navigation. Internal hrefs route client-side and highlight when active;
29
- external URLs open in a new browser tab.
30
-
31
- ### Fixed
32
-
33
- - Let standalone page content expand through the layout's flex chain so short
34
- pages keep the footer at the bottom of the viewport.
35
- - Bundle `@umami/shiso` entry points into the SSR build (`ssr.noExternal`) so
36
- TSX standalone pages that import `@umami/shiso/components` prerender
37
- correctly; previously Node hit the unresolved project-time virtual import
38
- `@/lib/icon-registry.generated` inside the published chunks.
39
- - Dev server: allow serving raw assets (fonts, images) from Shiso's real
40
- install location when the framework is linked from outside the project's
41
- workspace root (`link:`/`file:` installs previously returned 403 for
42
- bundled font files).
43
-
44
- ## 2.0.0 - 2026-08-21
45
-
46
- ### Breaking
47
-
48
- - Move project settings (`docsPrefix`, `contentDir`, `siteUrl`, `locale`) from
49
- the `$shiso` key in docs.json to a new optional `shiso.config.ts` file at the
50
- project root. `shiso check` now rejects docs.json files that still contain
51
- `$shiso` with a migration message.
52
-
53
- ### Added
54
-
55
- - New `@umami/shiso/config` export providing `defineConfig` and the
56
- `ShisoConfig` type for shiso.config.ts.
57
- - `shiso.config.ts`, `shiso.config.mjs`, and `shiso.config.js` are supported;
58
- the file is optional and defaults apply when absent. Config edits (and
59
- creating the file) hot-reload during development.
60
-
61
- ## 1.1.11 - 2026-08-19
62
-
63
- ### Changed
64
-
65
- - Remove rounded corners from full-screen images and anchor the close button to
66
- the viewport's top-right corner.
67
- - Render the active sidebar page label in bold.
68
-
69
- ## 1.1.10 - 2026-08-19
70
-
71
- ### Added
72
-
73
- - Add more vertical space around documentation images and open them in an
74
- accessible full-size viewer when clicked.
75
- - Support `noZoom` on MDX images and disable zoom automatically for linked
76
- images.
77
-
78
- ## 1.1.9 - 2026-08-19
79
-
80
- ### Fixed
81
-
82
- - Stop automatically inverting a shared logo in dark mode so PNG and other
83
- full-color images render unchanged.
84
-
85
- ## 1.1.8 - 2026-08-19
86
-
87
- ### Changed
88
-
89
- - Replace the custom and Zinc-derived light and dark grayscale theme tokens with
90
- exact values from Tailwind's Neutral palette.
91
-
92
- ## 1.1.7 - 2026-08-19
93
-
94
- ### Fixed
95
-
96
- - Remove the nested callout description's leading paragraph margin so the first
97
- line of text and icon share the same line box.
98
-
99
- ## 1.1.6 - 2026-08-19
100
-
101
- ### Fixed
102
-
103
- - Apply Alert's optical SVG offset to wrapped callout icons so their visible
104
- strokes align with the first line of text.
105
-
106
- ## 1.1.5 - 2026-08-19
107
-
108
- ### Fixed
109
-
110
- - Align callout icons with the first line of text using a fixed line-height box
111
- that remains consistent in published production builds.
112
- - Keep header actions aligned to the right when the current navigation scope
113
- does not render top-level tabs.
114
-
115
- ## 1.1.3 - 2026-08-18
116
-
117
- ### Fixed
118
-
119
- - Publish Shiso's browser and server runtime as bundled ESM instead of exposing
120
- raw framework source to consuming Vite projects.
121
- - Move `hydrateRoot` into the generated app entry so React DOM is discovered as
122
- a normal direct app dependency without framework-specific prebundle entries.
123
-
124
- ## 1.1.2 - 2026-08-18
125
-
126
- ### Fixed
127
-
128
- - Replace the CommonJS-only `classnames` dependency with ESM-capable `clsx` so
129
- fresh pnpm projects can load Shiso's navigation components during development.
130
-
131
- ## 1.1.1 - 2026-08-18
132
-
133
- ### Fixed
134
-
135
- - Prebundle Base UI's CommonJS external-store shims so fresh pnpm projects load
136
- their named exports correctly during development.
137
-
138
- ## 1.0.0 - 2026-08-15
139
-
140
- ### Added
141
-
142
- - Full multi-version and multi-language navigation, including versions nested
143
- inside languages and responsive header selectors.
144
- - Per-scope prerendering, Markdown export, sitemap metadata, document locale,
145
- text direction, and local search results.
146
- - A multi-scope integration fixture covering visible and hidden pages,
147
- versions, languages, redirects, search, and sitemap output.
148
- - Public exports for the bundled `docs.json` schema.
149
-
150
- ### Changed
151
-
152
- - Navigation containers now require exactly one non-empty navigation mode, and
153
- default to the first visible version or language when none is marked.
154
- - Hidden versions and languages remain buildable and directly reachable while
155
- staying out of selectors and search.
156
- - Redirect sources are exact paths; wildcard and parameter patterns are
157
- rejected during configuration validation.
158
- - Supported Node.js versions now match Vite: `^20.19.0 || >=22.12.0`.
159
-
160
- ### Fixed
161
-
162
- - Client-side navigation now updates page metadata, document language, and
163
- left-to-right or right-to-left text direction.
164
-
165
- ## 0.61.0 - 2026-08-13
166
-
167
- ### Added
168
-
169
- - Initial package release of the upgradeable Shiso framework.
170
- - Framework-owned development, validation, build, preview, and prerender commands.
171
- - Project-local generated caches for search, icons, and last-modified metadata.