docpensieve 0.2.0-beta.1 → 0.3.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docpensieve",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.3.0-beta.1",
4
4
  "description": "DocPensieve command-line interface (init, build, check, dev, serve)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,10 +24,10 @@
24
24
  "types"
25
25
  ],
26
26
  "dependencies": {
27
- "@docpensieve/components": "0.2.0-beta.1",
28
- "@docpensieve/core": "0.2.0-beta.1",
29
- "@docpensieve/shared": "0.2.0-beta.1",
30
- "@docpensieve/theme": "0.2.0-beta.1",
27
+ "@docpensieve/components": "0.3.0-beta.1",
28
+ "@docpensieve/core": "0.3.0-beta.1",
29
+ "@docpensieve/shared": "0.3.0-beta.1",
30
+ "@docpensieve/theme": "0.3.0-beta.1",
31
31
  "chalk": "^6.0.0",
32
32
  "chokidar": "^5.0.0",
33
33
  "commander": "^15.0.0"
@@ -237,6 +237,10 @@ function renderConfig({ name, theme, siteUrl, version }) {
237
237
  ` framework: ${quote(theme)},`,
238
238
  " // 'class' follows the reader's system; 'dark' or 'light' keeps one scheme.",
239
239
  " darkMode: 'class',",
240
+ ' // A light / dark button in the header, which remembers the choice: a few',
241
+ ' // lines of inline script in every page. false removes it, and the pages',
242
+ ' // then load no script.',
243
+ ' toggle: true,',
240
244
  '',
241
245
  ' // Design tokens to override, for instance the accent colour:',
242
246
  " // tokens: { '--dp-accent': '#008060', '--dp-radius': '0.75rem' },",
@@ -99,6 +99,10 @@ The documentation `init` installed in `99-docpensieve` stays at the version it
99
99
  came with. To refresh it, run `init` in a scratch folder and copy that folder
100
100
  over.
101
101
 
102
+ Coming from the 0.2, [Migrate from latest to beta](./migrate-to-beta/) says
103
+ what changes on its own and what to check first. To try this beta, install
104
+ `docpensieve@beta`, or run `npx docpensieve@beta` alone.
105
+
102
106
  ## Checking
103
107
 
104
108
  ```bash
@@ -95,3 +95,14 @@ online.
95
95
 
96
96
  It is the check to run after any change of `baseUrl`, of folder structure or of
97
97
  URL.
98
+
99
+ ## Searching the site
100
+
101
+ Every page carries a search field in its header. It leads to the search page
102
+ of the version, at `/search/`, which the build writes with the site: the list
103
+ of every page, that a small script filters as the reader types — best matches
104
+ first, each with an excerpt. It is the only page to load a script of its own,
105
+ and without it, it stays the list of every page.
106
+
107
+ It works the same under both themes. `search: false` in the configuration
108
+ removes the field and the page.
@@ -54,6 +54,27 @@ Two rules to remember:
54
54
  The switcher only appears in the header from **two** versions on: a single
55
55
  choice is not a choice.
56
56
 
57
+ ### Naming a version: the number or the channel
58
+
59
+ The `slug` is the address. Two conventions, and the choice is not neutral.
60
+
61
+ **The number** — `v1.0`, `v1.1` — gives each version an address that never
62
+ moves: a link captured today leads to the same pages in two years. But the
63
+ address can only carry what stays true for a whole series. `v1.0` still names
64
+ the documentation once `1.0.7` is out, so the URL says less than the switcher,
65
+ which reads the exact version.
66
+
67
+ **The channel** — `latest`, `beta` — names the role instead. The address a
68
+ reader shares stays right for ever: `/versions/latest/` always leads to the
69
+ documentation that counts, `/versions/beta/` to the one being prepared. What
70
+ moves is what sits behind it — on release day, `latest` becomes the new
71
+ version, and the one it replaces takes a numbered slug as it is archived: its
72
+ content freezes, so its address can freeze with it.
73
+
74
+ Neither is better. Take the number if your readers link to a precise version,
75
+ the channel if they link to "the documentation". DocPensieve's own
76
+ documentation takes the channel: its versions are `latest` and `beta`.
77
+
57
78
  ## 2. Opening the beta
58
79
 
59
80
  Start from the current version, and give it its own folder:
@@ -131,9 +152,10 @@ those who use it.
131
152
 
132
153
  > **The `slug` changes along with the folder, and so does the URL.**
133
154
  > `/versions/v1.1-beta/` disappears in favour of `/versions/v1.1/`, and the
134
- > external links that pointed to the beta lead nowhere any more. To avoid this,
155
+ > external links that pointed to the beta lead nowhere any more. Two ways out:
135
156
  > keep the same slug from start to finish — `v1.1` from the start, with only
136
- > the label mentioning the beta.
157
+ > the label mentioning the beta — or name the channel rather than the number,
158
+ > `beta` then `latest`, which never moves. See _Naming a version_ above.
137
159
 
138
160
  ## What the build produces
139
161
 
@@ -81,6 +81,55 @@ theme: {
81
81
 
82
82
  The content of `css` is appended to the produced stylesheet.
83
83
 
84
+ ## Colour scheme
85
+
86
+ `theme.darkMode` decides which palette the reader gets. `'class'`, the default,
87
+ follows the reader's system; `'dark'` or `'light'` keeps one whatever the
88
+ system — the build sets it as a class on `<html>`.
89
+
90
+ The header also carries a button that switches between light and dark, and
91
+ remembers the reader's choice from page to page — a few hundred bytes of inline
92
+ script, the only one content pages carry. `theme.toggle: false` removes it.
93
+ Without JavaScript, the button does not show.
94
+
95
+ The dark palette is a set of tokens, the same under both themes. To change it,
96
+ redefine them in the `theme/` folder, for both ways of being dark — the
97
+ system's scheme, and the class that `darkMode: 'dark'` sets:
98
+
99
+ ```css
100
+ @media (prefers-color-scheme: dark) {
101
+ :root:not(.light) {
102
+ --dp-bg: #060814;
103
+ }
104
+ }
105
+
106
+ :root.dark {
107
+ --dp-bg: #060814;
108
+ }
109
+ ```
110
+
111
+ <ForTheme framework="tailwind">
112
+
113
+ The `dark:` utilities of your pages follow the same rule: they apply under the
114
+ system's dark scheme, and always once `darkMode: 'dark'` is set.
115
+
116
+ ```mdx
117
+ <div className="bg-white dark:bg-slate-900">…</div>
118
+ ```
119
+
120
+ </ForTheme>
121
+ <ForTheme framework="custom">
122
+
123
+ Your own classes follow it through the same two selectors:
124
+
125
+ ```css
126
+ :root.dark .note {
127
+ border-color: var(--dp-accent);
128
+ }
129
+ ```
130
+
131
+ </ForTheme>
132
+
84
133
  ## Layer order
85
134
 
86
135
  Under the `tailwind` theme, the stylesheet declares its layers in this order:
@@ -133,3 +133,10 @@ site sits at the root of its domain.
133
133
  For pages that are news rather than reference — release notes, a changelog —
134
134
  give them a `date` and set `feed: true`: `feed.xml` then lists them, newest
135
135
  first. The fields are in the [configuration reference](../reference/configuration/).
136
+
137
+ ## What the reader downloads
138
+
139
+ The build keeps it light on its own. The stylesheet is minified — a third to
140
+ half lighter. Every image of a page gets its width and height, read from its
141
+ file, so that the text does not jump when it arrives, and all but the first
142
+ load lazily, when the reader nears them. There is nothing to configure.
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: Migrate from latest to beta
3
+ description: Move a project from the latest version, the 0.2, to the 0.3 beta — what changes on its own, and what to check.
4
+ tags: [guide, migration]
5
+ ---
6
+
7
+ # Migrate from latest to beta
8
+
9
+ A project on the latest version — the 0.2 — builds with the 0.3 beta as it is:
10
+ every new field is optional.
11
+
12
+ ## Update
13
+
14
+ ```bash
15
+ npm install docpensieve@beta
16
+ ```
17
+
18
+ Through `npx` alone, `npx docpensieve@beta` runs the beta. Going back is
19
+ `npm install docpensieve@latest`.
20
+
21
+ ## What changes on its own
22
+
23
+ Nothing yet: the 0.3 has just opened. Each change is listed here as it lands,
24
+ beside what it asks of a project already built on the 0.2.
@@ -25,6 +25,8 @@ up.
25
25
  touching the HTML.
26
26
  6. **[Deployment](./deployment/)** — publish, and keep past versions
27
27
  online.
28
+ 7. **[Migrate from latest to beta](./migrate-to-beta/)** — move a 0.2 project
29
+ to the 0.3 beta.
28
30
 
29
31
  ## What to know first
30
32
 
@@ -188,9 +188,9 @@ carrying the caption.
188
188
  <Card className="h-full text-center">
189
189
  <CardBody>
190
190
  <div className="text-4xl font-semibold text-indigo-600">0</div>
191
- <div className="text-sm">bytes of JavaScript</div>
191
+ <div className="text-sm">bytes of JavaScript runtime</div>
192
192
  </CardBody>
193
- <CardFooter>on every content page</CardFooter>
193
+ <CardFooter>on every page</CardFooter>
194
194
  </Card>
195
195
  </Column>
196
196
  <Column span={4}>
@@ -221,9 +221,9 @@ carrying the caption.
221
221
  <Card className="full-height centered">
222
222
  <CardBody>
223
223
  <div className="figure">0</div>
224
- <div className="small">bytes of JavaScript</div>
224
+ <div className="small">bytes of JavaScript runtime</div>
225
225
  </CardBody>
226
- <CardFooter>on every content page</CardFooter>
226
+ <CardFooter>on every page</CardFooter>
227
227
  </Card>
228
228
  </Column>
229
229
  <Column span={4}>
@@ -93,7 +93,7 @@ The shipped components avoid that clipping wherever they can — a `Card` rounds
93
93
  the corners of its image one by one rather than clipping its content.
94
94
 
95
95
  The bubble does not close with the Escape key: listening for it would take a
96
- script, and content pages load none. It disappears when the pointer or the focus
96
+ script, and components load none. It disappears when the pointer or the focus
97
97
  leaves the term.
98
98
 
99
99
  A `Tooltip` without text stops the build: a hover with no effect goes
@@ -146,5 +146,4 @@ folder: each one stops the build, naming the expected path. A missing icon
146
146
  would otherwise leave an empty box that nobody notices.
147
147
 
148
148
  The scripts and event handlers present in a file are removed before inlining.
149
- Content pages load no JavaScript, and a component is not going to introduce
150
- any.
149
+ A component loads no JavaScript, and this one is not going to introduce any.
@@ -75,8 +75,7 @@ changes the examples too.
75
75
 
76
76
  ## Without JavaScript
77
77
 
78
- Content pages load no script the search page alone does. Whatever needs
79
- interaction therefore goes
78
+ No component loads a script. Whatever needs interaction therefore goes
80
79
  through native elements or through CSS: `details` for expanding, a link for
81
80
  moving, `animation-timeline` for appearing on scroll.
82
81
 
@@ -120,8 +120,8 @@ search page in each version, at `/search/`. The build writes the index of the
120
120
  version — the plain text of every page — and the search page already lists
121
121
  every page with its description.
122
122
 
123
- The field is a plain form that leads to that page: **content pages load no
124
- script**. The search page alone loads one, of a few kilobytes, which filters
123
+ The field is a plain form that leads to that page: it needs no script. The
124
+ search page loads one of its own, of a few kilobytes, which filters
125
125
  the list as you type, best matches first, with an excerpt of each. Without
126
126
  JavaScript, the page stays the full list of pages.
127
127
 
@@ -138,16 +138,16 @@ versions: [
138
138
  ],
139
139
  ```
140
140
 
141
- | Field | Role |
142
- | ------------ | ----------------------------------------------------------------------------- |
143
- | `slug` | URL and branch identifier |
144
- | `name` | Label shown in the switcher |
145
- | `folder` | Source folder, relative to the root |
146
- | `current` | Version served by default. At most one |
147
- | `archived` | Version kept but no longer maintained. Banner, but stays indexed |
148
- | `prerelease` | Version in preparation. Banner **and** `noindex` |
149
- | `logo` | This version's logo, instead of the project's — a beta told apart at a glance |
150
- | `favicon` | This version's favicon, instead of the project's |
141
+ | Field | Role |
142
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------ |
143
+ | `slug` | URL and branch identifier. A number (`v1.0`) freezes the address; a channel (`latest`, `beta`) keeps it right as versions move |
144
+ | `name` | Label shown in the switcher |
145
+ | `folder` | Source folder, relative to the root |
146
+ | `current` | Version served by default. At most one |
147
+ | `archived` | Version kept but no longer maintained. Banner, but stays indexed |
148
+ | `prerelease` | Version in preparation. Banner **and** `noindex` |
149
+ | `logo` | This version's logo, instead of the project's — a beta told apart at a glance |
150
+ | `favicon` | This version's favicon, instead of the project's |
151
151
 
152
152
  ## `theme`
153
153
 
@@ -161,13 +161,14 @@ theme: {
161
161
  },
162
162
  ```
163
163
 
164
- | Field | Effect |
165
- | ----------- | ----------------------------------------------------------------------------- |
166
- | `framework` | `'tailwind'` or `'custom'` |
167
- | `darkMode` | `'class'` follows the reader's system; `'dark'` or `'light'` keeps one scheme |
168
- | `tokens` | Redefined `--dp-*` tokens |
169
- | `css` | CSS appended to the produced stylesheet |
170
- | `source` | Stylesheet handed to the utility compiler |
164
+ | Field | Effect |
165
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
166
+ | `framework` | `'tailwind'` or `'custom'` |
167
+ | `darkMode` | `'class'` follows the reader's system; `'dark'` or `'light'` keeps one scheme |
168
+ | `toggle` | On by default: a light / dark button in the header, remembered from page to page — a few lines of inline script. `false` removes it |
169
+ | `tokens` | Redefined `--dp-*` tokens |
170
+ | `css` | CSS appended to the produced stylesheet |
171
+ | `source` | Stylesheet handed to the utility compiler |
171
172
 
172
173
  The available tokens are listed in [Themes](../guide/themes/).
173
174
 
@@ -29,6 +29,7 @@ theme: {
29
29
  | ----------- | ------------------------ | --------------------------------------------------------------------------------------------------------- |
30
30
  | `framework` | `'tailwind'` | `'tailwind'` or `'custom'` |
31
31
  | `darkMode` | `'class'` | `'class'`: the reader's system, unless a class on `<html>` decides. `'dark'` or `'light'` sets that class |
32
+ | `toggle` | `true` | A light / dark button in the header, remembered from page to page |
32
33
  | `tokens` | — | Redefined `--dp-*` tokens, merged with the provider's |
33
34
  | `css` | `''` | CSS appended to the produced stylesheet |
34
35
  | `source` | `@import "tailwindcss";` | Stylesheet handed to the utility compiler |
@@ -99,6 +100,7 @@ the `dp-*` class below.
99
100
  | `scrollTop` | `dp-scroll-top` | Back-to-top button |
100
101
  | `scrollTopIcon` | `dp-scroll-top-icon` | Arrow of that button |
101
102
  | `search` | `dp-search` | Search field of the header |
103
+ | `schemeToggle` | `dp-scheme-toggle` | Light / dark button of the header |
102
104
 
103
105
  A slot can carry **variants**, suffixed `--variant`: `column` gives
104
106
  `dp-column--span-8`, `skill` gives `dp-skill--circle`.
@@ -36,9 +36,10 @@ utility theme needs to know which classes were actually used.
36
36
 
37
37
  ## React does not leave the build
38
38
 
39
- Components are rendered to HTML during the build. Content pages load no
40
- runtime: what reaches the reader is markup and a stylesheet. The search page
41
- alone adds a script, of a few kilobytes, to filter its list.
39
+ Components are rendered to HTML during the build. Pages load no runtime: what
40
+ reaches the reader is markup and a stylesheet, plus the few lines of the
41
+ light / dark switch; the search page adds a script, of a few kilobytes, to
42
+ filter its list.
42
43
 
43
44
  That explains the shape of the shipped components. None of them has state or
44
45
  an event listener, because there would be nothing to bring them to life.
@@ -1,73 +1,28 @@
1
1
  ---
2
- title: What's new in 0.2
3
- description: What the 0.2 brings, what it is still to bring, and what it changes for a 0.1 project.
2
+ title: What's new in 0.3
3
+ description: What the 0.3 brings, and what it changes for a 0.2 project.
4
4
  tags: [release]
5
5
  ---
6
6
 
7
- # What's new in 0.2
7
+ # What's new in 0.3
8
8
 
9
9
  This version is **in preparation**. Its betas go out under the npm tag `beta`,
10
- while the version installed by default stays the 0.1, documented in the 0.1
11
- pages of this site:
10
+ while the version installed by default stays the 0.2, documented in the
11
+ `latest` pages of this site:
12
12
 
13
13
  ```bash
14
14
  npx docpensieve@beta init my-site
15
15
  ```
16
16
 
17
- What follows describes the 0.2 as it stands, and
18
- [Moving from 0.1 to 0.2](./migrating/) says what to check in a 0.1 project.
19
-
20
17
  ## Already there
21
18
 
22
- ### A menu written by hand
23
-
24
- `sidebar: 'sidebar.json'` replaces the menu derived from the file tree with
25
- one you describe — pages in the order you want, categories, links outside the
26
- site. Each version reads its own file, since each has its own pages. A section
27
- can keep its automatic menu with a single entry, which is how the DocPensieve
28
- section stays whole without listing its pages.
29
-
30
- See [Writing the menu by hand](./guide/writing-pages/) in the guide, and the
31
- [`sidebar` field](./reference/configuration/) in the reference.
32
-
33
- ### Search engines and feed readers
34
-
35
- With `siteUrl` set, the build writes `sitemap.xml` for search engines — and
36
- `robots.txt` when the site sits at the root of its domain. `feed: true` adds an
37
- RSS feed of the dated pages. See [Sitemap and feed](./reference/configuration/)
38
- in the reference.
39
-
40
- ### Search
41
-
42
- A search field in the header, and a search page in each version. The index is
43
- built with the site; content pages still load no script — the search page
44
- alone does, and without it the page stays the list of every page. See
45
- [Search](./reference/configuration/) in the reference.
46
-
47
- ### A colour scheme of your choosing, and a logo per version
48
-
49
- `theme.darkMode: 'dark'` keeps the site dark whatever the reader's system —
50
- `'light'` keeps it light; `'class'`, the default, still follows the system.
51
- Until now the field was accepted and did nothing. A version can also carry its
52
- own `logo` and `favicon`, to tell a beta apart at a glance. See the
53
- [configuration reference](./reference/configuration/).
54
-
55
- ### Lighter pages
56
-
57
- The stylesheet reaches the reader minified. Every image of a page gets its
58
- width and height, read from its file, so that the text no longer jumps when it
59
- arrives; all but the first load lazily, and are no longer preloaded — the
60
- first, often in view, keeps its normal loading. `CardImage` loads lazily too.
61
-
62
- ### The API reference, and two example projects
63
-
64
- Every export of the five packages is in the [API reference](./reference/api/),
65
- generated from the JSDoc of the sources, so that it cannot drift from the code.
66
- The repository also holds two complete example projects, one per theme, built
67
- and checked on every run of its tests.
19
+ Nothing yet: the 0.3 has just opened, and its pages are still those of the 0.2.
20
+ Each feature is announced here as it lands, with a link to the guide and to the
21
+ reference this page announces, it is never the only place something is
22
+ written.
68
23
 
69
- ## For a 0.1 project
24
+ ## For a 0.2 project
70
25
 
71
- Nothing to change: a 0.1 configuration builds as it is. `sidebar: 'auto'`
72
- stays the default, and every new field is optional. A guide to moving from
73
- 0.1 to 0.2 will come with the release.
26
+ Nothing to change: a 0.2 configuration builds as it is.
27
+ [Migrate from latest to beta](./guide/migrate-to-beta/) lists what changes on
28
+ its own, what to check, and what is worth turning on.
@@ -1,53 +0,0 @@
1
- ---
2
- title: Moving from 0.1 to 0.2
3
- description: What the 0.2 changes on its own, what to check, and what to turn on.
4
- tags: [release, migration]
5
- ---
6
-
7
- # Moving from 0.1 to 0.2
8
-
9
- A 0.1 project builds with the 0.2 as it is: every new field is optional.
10
- A few things change on their own, though, and deserve a look.
11
-
12
- ## Update
13
-
14
- ```bash
15
- npm install docpensieve@beta # while the 0.2 is in beta
16
- npm install docpensieve@latest # once it is released
17
- ```
18
-
19
- Through `npx` alone, `npx docpensieve@beta` runs the beta.
20
-
21
- ## What changes on its own
22
-
23
- | What | In 0.2 |
24
- | ---------------- | ------------------------------------------------------------------------------ |
25
- | Search | A field in the header, and a page at `/search/` in each version |
26
- | `sitemap.xml` | Written at the root of the site as soon as `siteUrl` is set |
27
- | `robots.txt` | Written with it, when the site is served at the root of its domain |
28
- | The stylesheet | Minified |
29
- | Images | Their width and height are written; all but the first of a page load lazily |
30
- | `theme.darkMode` | Now read: `'dark'` and `'light'` keep one scheme, `'class'` follows the system |
31
-
32
- Content pages still load no script: the search page alone does.
33
-
34
- ## What to check
35
-
36
- - **A page of yours at `/search/`** now stops the build: that address is the
37
- search page's. Rename your page, or set `search: false`.
38
- - **`theme.darkMode`** was accepted and ignored in 0.1. A value other than
39
- `'class'` now takes effect — and an unknown one stops the build.
40
- - **Your own `robots.txt`**, if you published one next to the site, is now
41
- written by the build when the site sits at the root of its domain. Set
42
- `sitemap: false` to keep yours.
43
-
44
- ## What to turn on
45
-
46
- | Field | Gives |
47
- | ---------------------------- | ------------------------------------------------------------- |
48
- | `sidebar: 'sidebar.json'` | A menu written by hand, in each version's folder |
49
- | `feed: true` | An RSS feed of the pages that carry a `date` |
50
- | `versions[].logo`, `favicon` | A logo and a favicon of the version's own — a beta told apart |
51
- | `search: false` | No search at all, if the site does not need one |
52
-
53
- Every field is in the [configuration reference](./reference/configuration/).