@jaamd/jaad 0.11.0 → 1.0.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/README.md +8 -2
- package/dist/jaad.css +232 -347
- package/docs/00-overview.md +25 -0
- package/docs/01-getting-started/01-installation.md +216 -0
- package/docs/01-getting-started/02-pages.md +109 -0
- package/docs/01-getting-started/03-deployment.md +100 -0
- package/docs/02-configurations/01-reference.md +215 -0
- package/docs/02-configurations/02-frontmatter.md +105 -0
- package/docs/02-configurations/03-i18n.md +210 -0
- package/docs/02-configurations/04-search.md +58 -0
- package/docs/02-configurations/05-themes.md +104 -0
- package/docs/02-configurations/06-styles.md +156 -0
- package/docs/02-configurations/07-custom-pages.md +119 -0
- package/docs/02-configurations/08-advanced-layout.md +139 -0
- package/docs/03-upgrading.md +208 -0
- package/index.ts +8 -22
- package/package.json +10 -9
- package/site.ts +18 -1
- package/src/config.ts +25 -176
- package/src/{advanced.ts → docs/advanced.ts} +6 -4
- package/src/docs/collection.ts +109 -0
- package/src/docs/components/Breadcrumbs.astro +29 -0
- package/src/docs/components/DocsMobileNav.astro +90 -0
- package/src/docs/components/DocsNavTree.astro +57 -0
- package/src/docs/components/DocsPage.astro +66 -0
- package/src/{components/docs → docs/components}/DocsPageNav.astro +4 -4
- package/src/docs/components/DocsSidebarLeft.astro +53 -0
- package/src/{components/docs → docs/components}/PageActions.astro +10 -8
- package/src/{components/docs → docs/components}/StructuredData.astro +3 -3
- package/src/{components/docs → docs/components}/TableOfContents.astro +20 -22
- package/src/docs/config.ts +167 -0
- package/src/docs/content.ts +36 -0
- package/src/docs/endpoints.ts +89 -0
- package/src/docs/integration.ts +249 -0
- package/src/{layouts → docs/layouts}/DefaultDocsFrame.astro +7 -5
- package/src/{layouts → docs/layouts}/Docs.astro +44 -43
- package/src/docs/layouts/Page.astro +18 -0
- package/src/docs/link-plugins.ts +52 -0
- package/src/docs/links.ts +42 -0
- package/src/{locale-tree.ts → docs/locale-tree.ts} +1 -1
- package/src/docs/model/ids.ts +87 -0
- package/src/docs/model/rendered.ts +185 -0
- package/src/docs/model/tree.ts +124 -0
- package/src/docs/model/validate.ts +75 -0
- package/src/docs/navigation.ts +75 -0
- package/src/{routes → docs/routes}/404.astro +1 -1
- package/src/docs/routes/docs-index.astro +19 -0
- package/src/docs/routes/docs-slug.astro +54 -0
- package/src/{routes → docs/routes}/docs-slug.md.ts +8 -10
- package/src/{routes → docs/routes}/llms-locale.txt.ts +1 -1
- package/src/{routes → docs/routes}/llms.txt.ts +1 -1
- package/src/{routes → docs/routes}/search-index-locale.json.ts +1 -1
- package/src/{routes → docs/routes}/search-index.json.ts +1 -1
- package/src/docs/runtime.ts +17 -0
- package/src/docs/search-index.ts +39 -0
- package/src/docs/styles/components/breadcrumbs.css +26 -0
- package/src/docs/styles/components/docs-mobile-nav.css +47 -0
- package/src/docs/styles/components/docs-page-nav.css +41 -0
- package/src/docs/styles/components/docs-sidebar.css +59 -0
- package/src/docs/styles/components/page-actions.css +51 -0
- package/src/docs/styles/components/toc.css +38 -0
- package/src/docs/styles/components.css +7 -0
- package/src/docs/styles/docs.css +81 -0
- package/src/{@types/docs.ts → docs/types.ts} +8 -16
- package/src/{urls.ts → docs/urls.ts} +2 -16
- package/src/env.d.ts +1 -1
- package/src/integration.ts +15 -249
- package/src/{components → site/components}/Footer.astro +1 -1
- package/src/{components → site/components}/Header.astro +14 -11
- package/src/{components → site/components}/LocaleSwitcher.astro +2 -2
- package/src/{components → site/components}/NavMobile.astro +1 -1
- package/src/{components → site/components}/SearchPalette.astro +160 -79
- package/src/{components → site/components}/ThemeSwitcher.astro +1 -1
- package/src/site/config.ts +149 -0
- package/src/{infer.ts → site/infer.ts} +3 -3
- package/src/site/integration.ts +59 -0
- package/src/{layouts/Page.astro → site/layouts/Shell.astro} +6 -3
- package/src/{locales.ts → site/locales.ts} +9 -1
- package/src/{docs-config.ts → site/runtime.ts} +1 -12
- package/src/site/search.ts +227 -0
- package/src/{social.ts → site/social.ts} +2 -2
- package/src/site/styles/components/header.css +31 -0
- package/src/{styles → site/styles}/components/search.css +21 -1
- package/src/{styles → site/styles}/components/shell.css +4 -0
- package/src/site/styles/components.css +10 -0
- package/src/{styles → site/styles}/global.css +4 -26
- package/src/{themes/index.ts → site/themes.ts} +1 -1
- package/src/{ui → site/ui}/en.ts +3 -5
- package/src/{ui → site/ui}/it.ts +2 -4
- package/src/site/urls.ts +14 -0
- package/src/{virtual.ts → site/virtual.ts} +12 -18
- package/src/styles.css +5 -0
- package/src/collection.ts +0 -97
- package/src/components/ScrollToTop.astro +0 -43
- package/src/components/docs/Breadcrumbs.astro +0 -36
- package/src/components/docs/DocsMobileNav.astro +0 -93
- package/src/components/docs/DocsPage.astro +0 -68
- package/src/components/docs/DocsSidebarLeft.astro +0 -82
- package/src/content.ts +0 -42
- package/src/navigation.ts +0 -97
- package/src/routes/docs-index.astro +0 -19
- package/src/routes/docs-slug.astro +0 -58
- package/src/styles/components/breadcrumbs.css +0 -13
- package/src/styles/components/docs-mobile-nav.css +0 -9
- package/src/styles/components/docs-page-nav.css +0 -31
- package/src/styles/components/docs-sidebar.css +0 -42
- package/src/styles/components/header.css +0 -20
- package/src/styles/components/page-actions.css +0 -13
- package/src/styles/components/scroll-to-top.css +0 -11
- package/src/styles/components/toc.css +0 -21
- package/src/styles/docs.css +0 -112
- package/src/utils/docs.ts +0 -300
- package/src/utils/endpoints.ts +0 -80
- package/src/utils/search.ts +0 -83
- /package/src/{styles → docs/styles}/components/docs-page.css +0 -0
- /package/src/{styles → docs/styles}/jaamd.css +0 -0
- /package/src/{components → site/components}/Head.astro +0 -0
- /package/src/{components → site/components}/Nav.astro +0 -0
- /package/src/{components → site/components}/SocialLinks.astro +0 -0
- /package/src/{components → site/components}/locale-switcher.ts +0 -0
- /package/src/{fonts → site/fonts}/OFL.txt +0 -0
- /package/src/{fonts → site/fonts}/inter.woff2 +0 -0
- /package/src/{fonts → site/fonts}/merriweather-italic.woff2 +0 -0
- /package/src/{fonts → site/fonts}/merriweather.woff2 +0 -0
- /package/src/{fonts.ts → site/fonts.ts} +0 -0
- /package/src/{forges.ts → site/forges.ts} +0 -0
- /package/src/{utils → site}/helpers.ts +0 -0
- /package/src/{styles → site/styles}/components/footer.css +0 -0
- /package/src/{styles → site/styles}/components/locale-switcher.css +0 -0
- /package/src/{styles → site/styles}/components/nav-mobile.css +0 -0
- /package/src/{styles → site/styles}/components/nav.css +0 -0
- /package/src/{styles → site/styles}/components/not-found.css +0 -0
- /package/src/{styles → site/styles}/components/social-links.css +0 -0
- /package/src/{styles → site/styles}/components/theme-switcher.css +0 -0
- /package/src/{styles → site/styles}/jaamd-forward.css +0 -0
- /package/src/{styles → site/styles}/jaamd-reverse.css +0 -0
- /package/src/{styles → site/styles}/tailwind.css +0 -0
- /package/src/{ui.ts → site/ui.ts} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Pages of your own beside the documentation, with your layout or with JAAD's."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Custom pages
|
|
6
|
+
|
|
7
|
+
Files in `src/pages/` are regular Astro pages. They keep their own layouts,
|
|
8
|
+
styles and metadata; JAAD options affect only documentation below `routeBase`.
|
|
9
|
+
|
|
10
|
+
The `site` template creates a local layout and landing page, then mounts the
|
|
11
|
+
documentation at `/docs`:
|
|
12
|
+
|
|
13
|
+
:::code-tabs
|
|
14
|
+
|
|
15
|
+
```bash npm
|
|
16
|
+
npm create @jaamd/jaad@latest my-site -- --template site
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```bash pnpm
|
|
20
|
+
pnpm create @jaamd/jaad@latest my-site --template site
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash yarn
|
|
24
|
+
yarn create @jaamd/jaad@latest my-site --template site
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash bun
|
|
28
|
+
bun create @jaamd/jaad@latest my-site --template site
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
src/
|
|
35
|
+
layouts/SiteLayout.astro
|
|
36
|
+
pages/index.astro
|
|
37
|
+
styles/site.css
|
|
38
|
+
utils/base.ts
|
|
39
|
+
public/
|
|
40
|
+
favicon.svg
|
|
41
|
+
docs/
|
|
42
|
+
01-introduction.md
|
|
43
|
+
tsconfig.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`utils/base.ts` exports `withBase()`, which applies Astro's deployment base to
|
|
47
|
+
a root-relative href. Use it for every link the layout writes, so the site keeps
|
|
48
|
+
working when it moves to a subpath.
|
|
49
|
+
|
|
50
|
+
Use the generated layout for other application pages:
|
|
51
|
+
|
|
52
|
+
```astro
|
|
53
|
+
---
|
|
54
|
+
import SiteLayout from '../layouts/SiteLayout.astro'
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
<SiteLayout pageTitle="Pricing">
|
|
58
|
+
<h1>Pricing</h1>
|
|
59
|
+
</SiteLayout>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
JAAD still generates documentation pages, search, `llms.txt`, raw Markdown
|
|
63
|
+
routes and the sitemap without controlling the rest of the application.
|
|
64
|
+
|
|
65
|
+
## Keeping JAAD's header and footer
|
|
66
|
+
|
|
67
|
+
A site with a landing page of its own wants its own identity, and a local
|
|
68
|
+
layout is the right answer for it. A documentation-first site is the other
|
|
69
|
+
case: when `routeBase` is `/` and you add one page beside the documentation —
|
|
70
|
+
a changelog, a pricing page — rebuilding the header and footer to match would
|
|
71
|
+
be work spent on looking the same.
|
|
72
|
+
|
|
73
|
+
Import the page layout instead:
|
|
74
|
+
|
|
75
|
+
```astro
|
|
76
|
+
---
|
|
77
|
+
import Page from '@jaamd/jaad/layouts/Page.astro'
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
<Page title="Changelog">
|
|
81
|
+
<h1>Changelog</h1>
|
|
82
|
+
</Page>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
It renders the documentation header and footer, the theme, and your
|
|
86
|
+
configuration's title, navigation and social links around whatever you put
|
|
87
|
+
inside. `title` and `description` set the metadata for the page; `bare` drops
|
|
88
|
+
the default spacing when the content needs the full width; `class` is added to
|
|
89
|
+
the body.
|
|
90
|
+
|
|
91
|
+
Search comes with the header. A documentation page shows the full search field;
|
|
92
|
+
a page outside the documentation shows the magnifier alone, because
|
|
93
|
+
<kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>K</kbd> opens the palette there too and the
|
|
94
|
+
icon is what says so. Clicking it opens the same palette.
|
|
95
|
+
|
|
96
|
+
This is the site chrome, not the reading layout: there is no sidebar and no
|
|
97
|
+
table of contents, because a page outside the documentation has no place in
|
|
98
|
+
its navigation. To restructure documentation pages themselves, use
|
|
99
|
+
[Advanced layout](08-advanced-layout.md).
|
|
100
|
+
|
|
101
|
+
## Matching the documentation's layout
|
|
102
|
+
|
|
103
|
+
- `.jaad-chrome`: the column shared by header, footer and documentation
|
|
104
|
+
content, as wide as `--jaad-chrome-width`.
|
|
105
|
+
- `.jaad-main`: vertical margin and horizontal padding of the main landmark.
|
|
106
|
+
`bare` swaps it for `.jaad-main-bare`, which has none.
|
|
107
|
+
- Layout tokens (`--jaad-content-width`, `--jaad-page-padding`, …) are listed
|
|
108
|
+
in [Styles](06-styles.md).
|
|
109
|
+
|
|
110
|
+
```astro
|
|
111
|
+
<Page title="Changelog">
|
|
112
|
+
<div class="jaad-chrome">…</div>
|
|
113
|
+
</Page>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Tailwind
|
|
117
|
+
|
|
118
|
+
With `tailwind: true`, utilities on `Page` pages use JAAD's tokens. See
|
|
119
|
+
[Styles](06-styles.md#tailwind).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Replace the documentation page layout with a DocsFrame of your own.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Advanced layout
|
|
6
|
+
|
|
7
|
+
Use the default layout unless the documentation needs a different structure.
|
|
8
|
+
To replace it, create:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
src/jaad/DocsFrame.astro
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
JAAD detects the file automatically. Restart the development server after
|
|
15
|
+
creating it; later edits are watched.
|
|
16
|
+
|
|
17
|
+
The frame controls `<body data-docs>`. JAAD still owns the HTML document,
|
|
18
|
+
metadata, theme, fonts, view transitions and keyboard navigation.
|
|
19
|
+
|
|
20
|
+
## Frame contract
|
|
21
|
+
|
|
22
|
+
| Slot | Contents |
|
|
23
|
+
| ------------------- | --------------------------------------------- |
|
|
24
|
+
| `header` | Header, navigation and search |
|
|
25
|
+
| `sidebar` | Desktop page navigation, every section open |
|
|
26
|
+
| `mobile-navigation` | Mobile navigation and table of contents menus |
|
|
27
|
+
| `breadcrumbs` | Section and chapter of the page |
|
|
28
|
+
| `page-actions` | Copy and edit actions |
|
|
29
|
+
| `content` | Rendered Markdown article |
|
|
30
|
+
| `page-navigation` | Previous and next links |
|
|
31
|
+
| `table-of-contents` | Desktop heading navigation |
|
|
32
|
+
| `footer` | Documentation footer |
|
|
33
|
+
|
|
34
|
+
Omitting a slot removes that element from every documentation page.
|
|
35
|
+
|
|
36
|
+
```astro
|
|
37
|
+
---
|
|
38
|
+
import type { DocsFrameProps } from '@jaamd/jaad/advanced'
|
|
39
|
+
|
|
40
|
+
type Props = DocsFrameProps
|
|
41
|
+
const { page, headings } = Astro.props
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<div class="docs-frame" data-page={page.id}>
|
|
45
|
+
<slot name="header" />
|
|
46
|
+
<slot name="mobile-navigation" />
|
|
47
|
+
|
|
48
|
+
<div class="docs-grid">
|
|
49
|
+
<aside class="docs-aside">
|
|
50
|
+
<slot name="sidebar" />
|
|
51
|
+
</aside>
|
|
52
|
+
<main>
|
|
53
|
+
<slot name="breadcrumbs" />
|
|
54
|
+
<slot name="page-actions" />
|
|
55
|
+
<slot name="content" />
|
|
56
|
+
<slot name="page-navigation" />
|
|
57
|
+
</main>
|
|
58
|
+
{headings.length > 0 && (
|
|
59
|
+
<aside class="docs-aside">
|
|
60
|
+
<slot name="table-of-contents" />
|
|
61
|
+
</aside>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<slot name="footer" />
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.docs-grid {
|
|
70
|
+
display: grid;
|
|
71
|
+
grid-template-columns: minmax(0, 56rem);
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.docs-aside {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (min-width: 64rem) {
|
|
80
|
+
.docs-grid {
|
|
81
|
+
grid-template-columns: 16rem minmax(0, 56rem) 16rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.docs-aside {
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Wrap the slots you need to position in elements of your own, and style those.
|
|
92
|
+
|
|
93
|
+
`DocsFrameProps` exposes the current page, headings and navigation model for
|
|
94
|
+
conditional placement. JAAD's internal components are not part of this API.
|
|
95
|
+
|
|
96
|
+
| Property | Contents |
|
|
97
|
+
| ------------------------- | -------------------------------------------- |
|
|
98
|
+
| `page.id` | Content collection ID |
|
|
99
|
+
| `page.slug` | File-derived slug, including the opening one |
|
|
100
|
+
| `page.title` | Resolved page title |
|
|
101
|
+
| `page.section` | Section key, when the docs have sections |
|
|
102
|
+
| `page.chapter` | Chapter slug, when present |
|
|
103
|
+
| `headings` | `{ depth, slug, text }[]` for levels 2 and 3 |
|
|
104
|
+
| `navigation.groups` | The whole tree: sections, chapters and pages |
|
|
105
|
+
| `navigation.previousPage` | Previous navigation item or `null` |
|
|
106
|
+
| `navigation.nextPage` | Next navigation item or `null` |
|
|
107
|
+
|
|
108
|
+
`page.chapter` and a chapter group's `chapter` are directory slugs, such as
|
|
109
|
+
`getting-started`. Title-case them for display.
|
|
110
|
+
|
|
111
|
+
### Navigation shapes
|
|
112
|
+
|
|
113
|
+
`DocsNavGroup` is a union discriminated on `type`. With sections, every group
|
|
114
|
+
is a `section`, holding the pages and chapters of that section.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
type DocsNavEntry = { type: 'page'; item: DocsNavItem } | { type: 'chapter'; chapter: string; items: DocsNavItem[] }
|
|
118
|
+
|
|
119
|
+
type DocsNavGroup = DocsNavEntry | { type: 'section'; section: string; label: string; entries: DocsNavEntry[] }
|
|
120
|
+
|
|
121
|
+
interface DocsNavItem {
|
|
122
|
+
title: string
|
|
123
|
+
section?: string
|
|
124
|
+
chapter?: string
|
|
125
|
+
href: string
|
|
126
|
+
isActive: boolean
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Groups and their items arrive in display order.
|
|
131
|
+
|
|
132
|
+
`href` already carries `routeBase` and the deployment `base`. `isActive` marks
|
|
133
|
+
the current page.
|
|
134
|
+
|
|
135
|
+
`DocsFrameProps`, `DocsNavigation`, `DocsNavGroup`, `DocsNavEntry`,
|
|
136
|
+
`DocsHeading`, `DocsNavItem` and `DocsPageData` are exported from `@jaamd/jaad/advanced`.
|
|
137
|
+
|
|
138
|
+
For colours, fonts, widths and spacing, use
|
|
139
|
+
[`src/jaad.css`](06-styles.md) instead.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: How to upgrade JAAD, and the changes that need action, by the version you upgrade from.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Upgrading
|
|
6
|
+
|
|
7
|
+
JAAD is usually upgraded together with Astro: each JAAD release targets one Astro
|
|
8
|
+
major, and most releases follow an Astro release. Upgrade both at once:
|
|
9
|
+
|
|
10
|
+
:::code-tabs
|
|
11
|
+
|
|
12
|
+
```bash npm
|
|
13
|
+
npx @astrojs/upgrade
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```bash pnpm
|
|
17
|
+
pnpm dlx @astrojs/upgrade
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```bash yarn
|
|
21
|
+
yarn dlx @astrojs/upgrade
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash bun
|
|
25
|
+
bunx @astrojs/upgrade
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
To upgrade JAAD alone:
|
|
31
|
+
|
|
32
|
+
:::code-tabs
|
|
33
|
+
|
|
34
|
+
```bash npm
|
|
35
|
+
npm install @jaamd/jaad@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```bash pnpm
|
|
39
|
+
pnpm add @jaamd/jaad@latest
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash yarn
|
|
43
|
+
yarn add @jaamd/jaad@latest
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash bun
|
|
47
|
+
bun add @jaamd/jaad@latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
Then run a build and read below the changes since the version you upgrade from.
|
|
53
|
+
|
|
54
|
+
## From 0.10 and 0.11
|
|
55
|
+
|
|
56
|
+
### The package is now @jaamd/jaad
|
|
57
|
+
|
|
58
|
+
`@lancher-dev/jaad` is now `@jaamd/jaad`, and `@lancher-dev/create-jaad` is
|
|
59
|
+
`@jaamd/create-jaad`. The old packages are deprecated and receive no further
|
|
60
|
+
releases. `@jaamd/jaad` 0.11 was 0.10 under the new scope: from it, skip to
|
|
61
|
+
the next heading.
|
|
62
|
+
|
|
63
|
+
:::code-tabs
|
|
64
|
+
|
|
65
|
+
```bash npm
|
|
66
|
+
npm uninstall @lancher-dev/jaad
|
|
67
|
+
npm install @jaamd/jaad
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash pnpm
|
|
71
|
+
pnpm remove @lancher-dev/jaad
|
|
72
|
+
pnpm add @jaamd/jaad
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash yarn
|
|
76
|
+
yarn remove @lancher-dev/jaad
|
|
77
|
+
yarn add @jaamd/jaad
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash bun
|
|
81
|
+
bun remove @lancher-dev/jaad
|
|
82
|
+
bun add @jaamd/jaad
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
:::
|
|
86
|
+
|
|
87
|
+
Then replace `@lancher-dev/jaad` with `@jaamd/jaad` in every import:
|
|
88
|
+
`astro.config.*`, `src/content.config.*`, `jaad.config.ts`, and any page using
|
|
89
|
+
`@jaamd/jaad/layouts/Page.astro` or `@jaamd/jaad/advanced`.
|
|
90
|
+
|
|
91
|
+
The documentation moved from `jaad.lancher.dev` to `docs.jaamd.org/jaad`: update
|
|
92
|
+
the links in `AGENTS.md` if `create-jaad` generated one.
|
|
93
|
+
|
|
94
|
+
### JAAMD is now @jaamd/astro
|
|
95
|
+
|
|
96
|
+
JAAD installs it for you: a site that only uses `@jaamd/jaad` has nothing to do.
|
|
97
|
+
A project that imports `@lancher-dev/jaamd` or `@jaamd/jaamd` directly follows
|
|
98
|
+
[JAAMD's upgrade guide](../../astro/docs/06-upgrading.md#from-011).
|
|
99
|
+
|
|
100
|
+
### Page titles name their section
|
|
101
|
+
|
|
102
|
+
With [sections](01-getting-started/02-pages.md#sections), the browser title of
|
|
103
|
+
a page is `Page · Section | Site`, so pages with the same name in two sections
|
|
104
|
+
no longer share a title. Docs without sections are unchanged.
|
|
105
|
+
|
|
106
|
+
### A fixed shell
|
|
107
|
+
|
|
108
|
+
The header and both sidebars are fixed to the window and only the page
|
|
109
|
+
scrolls. They sit in one column, `--jaad-chrome-width`, which now defaults to
|
|
110
|
+
the sidebars, the page and their gaps; to fit the documentation to a site of
|
|
111
|
+
your own, set it. See [Layout tokens](02-configurations/06-styles.md#layout-tokens).
|
|
112
|
+
|
|
113
|
+
- The sidebar lists every section with all its pages, under the section's name.
|
|
114
|
+
- Above the title, the page shows its section and chapter instead of a full
|
|
115
|
+
breadcrumb trail.
|
|
116
|
+
- Copy and edit sit under the table of contents, in the right column.
|
|
117
|
+
- Previous and next are a line of text, and the footer closes the page column.
|
|
118
|
+
- On narrow screens, a menu named after the current page opens the navigation,
|
|
119
|
+
and another opens the table of contents. The scroll-to-top button is gone.
|
|
120
|
+
|
|
121
|
+
`--jaad-sidebar-offset` and the `.docs-main-gutters` class are gone: set
|
|
122
|
+
`--jaad-chrome-width` and `--jaad-sidebar-width` instead. The `ui` keys
|
|
123
|
+
`breadcrumb.root`, `nav.jumpToSection`, `nav.selectPage` and `scrollTop` are no
|
|
124
|
+
longer used: remove them from your overrides.
|
|
125
|
+
|
|
126
|
+
### Custom docs frame: renamed navigation types
|
|
127
|
+
|
|
128
|
+
"Section" now names a part of the documentation with its own directory. A
|
|
129
|
+
`src/jaad/DocsFrame.astro` that reads the navigation follows these renames:
|
|
130
|
+
|
|
131
|
+
| Before | After |
|
|
132
|
+
| ------------------------------- | ------------------- |
|
|
133
|
+
| `navigation.sections` | `navigation.groups` |
|
|
134
|
+
| `NavSection` | `DocsNavGroup` |
|
|
135
|
+
| `DocsHeadings` | `DocsHeading` |
|
|
136
|
+
| `order` on a group | removed |
|
|
137
|
+
| `primaryOrder` on `DocsNavItem` | removed |
|
|
138
|
+
|
|
139
|
+
Groups and items arrive in display order, so nothing replaces the two removed
|
|
140
|
+
fields.
|
|
141
|
+
|
|
142
|
+
`DocsEntry` is no longer exported: no prop of the frame carried it. The page a
|
|
143
|
+
frame renders is `DocsFrameProps['page']`.
|
|
144
|
+
|
|
145
|
+
### Search index
|
|
146
|
+
|
|
147
|
+
`search-index.json` now holds one entry per heading, for
|
|
148
|
+
[search by heading](02-configurations/04-search.md). Its format is internal to
|
|
149
|
+
JAAD's search and can change in any release: do not read it from code of your
|
|
150
|
+
own.
|
|
151
|
+
|
|
152
|
+
### Fewer exports
|
|
153
|
+
|
|
154
|
+
`@jaamd/jaad` exports `jaad()`, `defineJaadConfig()` and the `JaadUserConfig`
|
|
155
|
+
type. `defineJaadSite`, `JaadConfig` and `JaadResolvedConfig` are gone:
|
|
156
|
+
`@jaamd/jaad/site` builds the Astro configuration, and the resolved
|
|
157
|
+
configuration, `virtual:jaad/config` included, is internal.
|
|
158
|
+
|
|
159
|
+
## From 0.9
|
|
160
|
+
|
|
161
|
+
### Tailwind on your own pages
|
|
162
|
+
|
|
163
|
+
0.9 left Tailwind to the site: plugin in `astro.vite.plugins` and a stylesheet
|
|
164
|
+
importing `tailwindcss`. Replace both with the option:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
// jaad.config.ts
|
|
168
|
+
defineJaadConfig({ title: 'My Project', tailwind: true })
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- Remove `@tailwindcss/vite` from `astro.vite.plugins`. If it stays, JAAD
|
|
172
|
+
leaves it and skips its own.
|
|
173
|
+
- Remove CSS that imports `tailwindcss` for pages using `Page`: it adds a second
|
|
174
|
+
preflight and Tailwind's default fonts over JAAD's. Utilities now read JAAD's
|
|
175
|
+
tokens directly (`bg-surface`, `text-primary`), with no `@theme` to write.
|
|
176
|
+
- Pages on a local layout keep their own `@import "tailwindcss";`.
|
|
177
|
+
- `tailwindcss` and `@tailwindcss/vite` stay in your devDependencies.
|
|
178
|
+
|
|
179
|
+
See [Styles](02-configurations/06-styles.md#tailwind).
|
|
180
|
+
|
|
181
|
+
### Component classes
|
|
182
|
+
|
|
183
|
+
JAAD's markup no longer uses Tailwind utilities: every element has a
|
|
184
|
+
`jaad-*` or `docs-*` class, styled in `@layer components`. CSS that targeted
|
|
185
|
+
utilities in JAAD's markup needs the new names:
|
|
186
|
+
|
|
187
|
+
| Before | Now |
|
|
188
|
+
| -------------------------------- | ------------------------------------- |
|
|
189
|
+
| `body` utilities | `.jaad-body` |
|
|
190
|
+
| default frame wrapper `contents` | `.docs-frame` |
|
|
191
|
+
| `.theme-icon-to-dark` / `-light` | `.jaad-theme-icon-to-dark` / `-light` |
|
|
192
|
+
| active ToC link class | `[aria-current="location"]` |
|
|
193
|
+
|
|
194
|
+
`dist/jaad.css` no longer contains stray utilities (`.hidden`, `.block`,
|
|
195
|
+
`.relative`, …). Pages that used them without Tailwind need `tailwind: true` or
|
|
196
|
+
their own CSS.
|
|
197
|
+
|
|
198
|
+
## From 0.8
|
|
199
|
+
|
|
200
|
+
JAAD ships a precompiled stylesheet and no longer depends on Tailwind. Until
|
|
201
|
+
0.8 its Tailwind plugin also generated the utilities used in your own pages;
|
|
202
|
+
from 0.9 those classes are missing unless the site provides Tailwind. Use
|
|
203
|
+
`tailwind: true` (see [From 0.9](#from-09)).
|
|
204
|
+
|
|
205
|
+
## From 0.7
|
|
206
|
+
|
|
207
|
+
`@jaamd/jaad/layouts/Base.astro` is gone. It forwarded every prop to the
|
|
208
|
+
page layout: change the import to `@jaamd/jaad/layouts/Page.astro`.
|
package/index.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { AstroIntegration } from 'astro'
|
|
2
2
|
import sitemap from '@astrojs/sitemap'
|
|
3
|
-
import jaamd from '@jaamd/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import jaamd from '@jaamd/astro'
|
|
4
|
+
import { resolveConfig, type JaadUserConfig } from './src/config.ts'
|
|
5
|
+
import { createIntegrationState, createSitemapFilter } from './src/docs/integration.ts'
|
|
6
|
+
import { createJaadIntegration } from './src/integration.ts'
|
|
7
|
+
import { resolveStylesheets } from './src/site/config.ts'
|
|
7
8
|
|
|
8
9
|
/** The whole set: Astro flattens nested arrays in `integrations`. */
|
|
9
10
|
export default function jaad(options: JaadUserConfig): AstroIntegration[] {
|
|
10
11
|
const config = resolveConfig(options)
|
|
11
12
|
const css = resolveStylesheets(config)
|
|
12
13
|
const state = createIntegrationState()
|
|
13
|
-
const core =
|
|
14
|
+
const core = createJaadIntegration(config, css, state, Boolean(options.site))
|
|
14
15
|
|
|
15
16
|
// Without `site` the sitemap integration can only warn and skip.
|
|
16
17
|
return [
|
|
@@ -18,7 +19,7 @@ export default function jaad(options: JaadUserConfig): AstroIntegration[] {
|
|
|
18
19
|
...(options.site
|
|
19
20
|
? [
|
|
20
21
|
sitemap({
|
|
21
|
-
filter: createSitemapFilter(config.
|
|
22
|
+
filter: createSitemapFilter(config.docs.base, state, config.defaultLocale),
|
|
22
23
|
}),
|
|
23
24
|
]
|
|
24
25
|
: []),
|
|
@@ -26,20 +27,5 @@ export default function jaad(options: JaadUserConfig): AstroIntegration[] {
|
|
|
26
27
|
]
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
/** The whole Astro config for a JAAD site. `astro` is merged in, with its
|
|
30
|
-
* integrations appended rather than replacing ours. */
|
|
31
|
-
export function defineJaadSite(options: JaadUserConfig) {
|
|
32
|
-
const { site, base, astro } = options
|
|
33
|
-
const extra = astro ?? {}
|
|
34
|
-
const extraIntegrations = Array.isArray(extra.integrations) ? (extra.integrations as AstroIntegration[]) : []
|
|
35
|
-
|
|
36
|
-
return defineConfig({
|
|
37
|
-
...(site ? { site } : {}),
|
|
38
|
-
...(base ? { base } : {}),
|
|
39
|
-
...extra,
|
|
40
|
-
integrations: [...jaad(options), ...extraIntegrations],
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
30
|
export { defineJaadConfig } from './src/config.ts'
|
|
45
|
-
export type { JaadUserConfig
|
|
31
|
+
export type { JaadUserConfig } from './src/config.ts'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaamd/jaad",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Turn a folder of markdown into a documentation site. An Astro integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"markdown",
|
|
11
11
|
"withastro"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://jaamd.org/
|
|
13
|
+
"homepage": "https://docs.jaamd.org/jaad",
|
|
14
14
|
"bugs": "https://github.com/jaamd/jaamd/issues",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Kasui92 <info@lucapattocchio.dev>",
|
|
@@ -24,15 +24,16 @@
|
|
|
24
24
|
"site.ts",
|
|
25
25
|
"src",
|
|
26
26
|
"dist",
|
|
27
|
+
"docs",
|
|
27
28
|
"README.md",
|
|
28
29
|
"LICENSE"
|
|
29
30
|
],
|
|
30
31
|
"type": "module",
|
|
31
32
|
"exports": {
|
|
32
33
|
".": "./index.ts",
|
|
33
|
-
"./advanced": "./src/advanced.ts",
|
|
34
|
-
"./content": "./src/content.ts",
|
|
35
|
-
"./layouts/Page.astro": "./src/layouts/Page.astro",
|
|
34
|
+
"./advanced": "./src/docs/advanced.ts",
|
|
35
|
+
"./content": "./src/docs/content.ts",
|
|
36
|
+
"./layouts/Page.astro": "./src/docs/layouts/Page.astro",
|
|
36
37
|
"./site": "./site.ts"
|
|
37
38
|
},
|
|
38
39
|
"publishConfig": {
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@astrojs/sitemap": "^3.7.4",
|
|
43
|
-
"@jaamd/
|
|
44
|
+
"@jaamd/astro": "^1.0.0",
|
|
44
45
|
"github-slugger": "^2.0.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"@tailwindcss/vite": "^4.3.0",
|
|
52
|
-
"astro": "
|
|
53
|
+
"astro": "^7.3.0",
|
|
53
54
|
"tailwindcss": "^4.3.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependenciesMeta": {
|
|
@@ -64,10 +65,10 @@
|
|
|
64
65
|
"node": ">=22.12.0"
|
|
65
66
|
},
|
|
66
67
|
"scripts": {
|
|
67
|
-
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tailwindcss -i ./src/styles
|
|
68
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tailwindcss -i ./src/styles.css -o ./dist/jaad.css",
|
|
68
69
|
"check": "astro check && tsc --noEmit -p tests",
|
|
69
70
|
"test": "node --test \"tests/unit/**/*.test.ts\" \"tests/unit/**/*.test.mjs\"",
|
|
70
|
-
"test:consumer": "node --test \"tests/consumer/**/*.test.mjs\"",
|
|
71
|
+
"test:consumer": "pnpm --filter \"@jaamd/jaad...\" run build && node --test \"tests/consumer/**/*.test.mjs\"",
|
|
71
72
|
"test:build": "pnpm --filter jaad-fixture build && node --test \"tests/build/**/*.test.mjs\""
|
|
72
73
|
}
|
|
73
74
|
}
|
package/site.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { JaadUserConfig } from './src/config.ts'
|
|
2
|
+
import type { AstroIntegration } from 'astro'
|
|
2
3
|
import { existsSync } from 'node:fs'
|
|
3
4
|
import { join } from 'node:path'
|
|
4
5
|
import { pathToFileURL } from 'node:url'
|
|
5
|
-
import {
|
|
6
|
+
import { defineConfig } from 'astro/config'
|
|
7
|
+
import jaad from './index.ts'
|
|
6
8
|
|
|
7
9
|
const CANDIDATES = ['jaad.config.ts', 'jaad.config.mjs', 'jaad.config.js']
|
|
8
10
|
|
|
@@ -16,4 +18,19 @@ const loaded = (await import(/* @vite-ignore */ pathToFileURL(file).href)) as {
|
|
|
16
18
|
default: JaadUserConfig
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
/** The whole Astro config for a JAAD site. `astro` is merged in, with its
|
|
22
|
+
* integrations appended rather than replacing ours. */
|
|
23
|
+
function defineJaadSite(options: JaadUserConfig) {
|
|
24
|
+
const { site, base, astro } = options
|
|
25
|
+
const extra = astro ?? {}
|
|
26
|
+
const extraIntegrations = Array.isArray(extra.integrations) ? (extra.integrations as AstroIntegration[]) : []
|
|
27
|
+
|
|
28
|
+
return defineConfig({
|
|
29
|
+
...(site ? { site } : {}),
|
|
30
|
+
...(base ? { base } : {}),
|
|
31
|
+
...extra,
|
|
32
|
+
integrations: [...jaad(options), ...extraIntegrations],
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
export default defineJaadSite(loaded.default)
|