docpensieve 0.1.3 → 0.1.5

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.
@@ -76,6 +76,7 @@ the `dp-*` class below.
76
76
  | `skip` | `dp-skip` | Skip link to the content |
77
77
  | `header` | `dp-header` | Site header |
78
78
  | `brand` | `dp-brand` | Project name, in the header |
79
+ | `brandLogo` | `dp-brand-logo` | Logo beside the project name |
79
80
  | `versions` | `dp-versions` | Version switcher |
80
81
  | `versionsList` | `dp-versions-list` | Open list of the switcher |
81
82
  | `shell` | `dp-shell` | Menu / content / table of contents grid |
@@ -124,7 +125,8 @@ The delivered stylesheet is assembled from four pieces, in this order:
124
125
  | a skin or a bridge | `custom.css`, or `tailwind-bridge.css` |
125
126
  | the components' one | The `dp-*` rules of the shipped components |
126
127
 
127
- Then comes what the project adds through `theme.css`.
128
+ Then comes what the project adds: `theme.css`, then every `.css` file of its
129
+ `theme/` folder, in name order.
128
130
 
129
131
  The layout is **never** duplicated in a provider: it lives in `structure.css`,
130
132
  which both share. A provider only takes care of the styling.
@@ -144,6 +146,6 @@ The `custom` theme has no utility layer: its stylesheets are in no layer, and
144
146
  therefore come before the component rules, which stay in the `components`
145
147
  layer.
146
148
 
147
- What `theme.css` adds is in no layer: without a layer, a rule wins over all
148
- those that have one. That is what lets you write a fix there without worrying
149
+ What `theme.css` and the `theme/` folder add is in no layer: without a layer, a
150
+ rule wins over all those that have one. That is what lets you write a fix there without worrying
149
151
  about specificity.
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Classes of the documentation's examples, for the custom theme.
3
+ *
4
+ * The custom theme loads no utility framework: the classes a page uses are
5
+ * written by the project. These are the ones DocPensieve's own pages use.
6
+ * "docpensieve init" installs this file as theme/99-docpensieve.css, next to
7
+ * the documentation in 99-docpensieve/: delete both together.
8
+ *
9
+ * Every colour comes from the --dp-* tokens, or is mixed with them, so that
10
+ * the examples follow the light and dark palettes.
11
+ */
12
+
13
+ /* Sizes */
14
+
15
+ .narrow {
16
+ max-inline-size: 24rem;
17
+ }
18
+
19
+ .full-height {
20
+ block-size: 100%;
21
+ }
22
+
23
+ /* Text */
24
+
25
+ .centered {
26
+ text-align: center;
27
+ }
28
+
29
+ .small {
30
+ font-size: 0.875rem;
31
+ }
32
+
33
+ .large {
34
+ font-size: 1.5rem;
35
+ }
36
+
37
+ .caps {
38
+ text-transform: uppercase;
39
+ letter-spacing: 0.05em;
40
+ }
41
+
42
+ .italic {
43
+ font-style: italic;
44
+ }
45
+
46
+ .muted {
47
+ color: var(--dp-text-soft);
48
+ }
49
+
50
+ .accent-text {
51
+ color: var(--dp-accent);
52
+ }
53
+
54
+ .figure {
55
+ font-size: 2.25rem;
56
+ font-weight: 600;
57
+ line-height: 1.2;
58
+ color: var(--dp-accent);
59
+ }
60
+
61
+ .label {
62
+ display: block;
63
+ margin-block: 0.5rem 0.25rem;
64
+ font-size: 1rem;
65
+ font-weight: 600;
66
+ }
67
+
68
+ /* Colours, for the text and the gauges alike */
69
+
70
+ .green {
71
+ --dp-skill-color: #10b981;
72
+ color: #10b981;
73
+ }
74
+
75
+ .amber {
76
+ --dp-skill-color: #f59e0b;
77
+ color: #f59e0b;
78
+ }
79
+
80
+ /* Cards */
81
+
82
+ .highlight {
83
+ border-color: var(--dp-accent);
84
+ background: var(--dp-accent-soft);
85
+ }
86
+
87
+ .warning {
88
+ border-color: #f59e0b;
89
+ background: color-mix(in oklab, #f59e0b 12%, var(--dp-bg));
90
+ }
91
+
92
+ .warning-title {
93
+ color: color-mix(in oklab, #d97706 70%, var(--dp-text));
94
+ }
95
+
96
+ .plain {
97
+ border: 0;
98
+ box-shadow: none;
99
+ background: transparent;
100
+ }
101
+
102
+ .flush {
103
+ padding-inline: 0;
104
+ }
105
+
106
+ /* Layout */
107
+
108
+ .row {
109
+ display: flex;
110
+ flex-wrap: wrap;
111
+ align-items: center;
112
+ gap: 0.75rem;
113
+ }
114
+
115
+ .row.align-end {
116
+ align-items: flex-end;
117
+ }
118
+
119
+ .plain-list {
120
+ display: grid;
121
+ gap: 0.5rem;
122
+ padding-inline-start: 0;
123
+ list-style: none;
124
+ }
125
+
126
+ .wide-gap {
127
+ gap: 2.5rem;
128
+ }
129
+
130
+ /* Content that flows from one column to the next, as in a newspaper */
131
+
132
+ .flow {
133
+ columns: 2;
134
+ column-gap: 1.5rem;
135
+ }
136
+
137
+ @media (min-width: 40rem) {
138
+ .flow {
139
+ columns: 3;
140
+ }
141
+ }
142
+
143
+ .flow > * {
144
+ break-inside: avoid;
145
+ margin-block-end: 1.5rem;
146
+ }
147
+
148
+ /* A back-to-top button placed in the text rather than fixed on the screen */
149
+
150
+ .inline-button {
151
+ position: static;
152
+ display: inline-flex;
153
+ inline-size: auto;
154
+ box-shadow: none;
155
+ padding-inline: 1rem;
156
+ }
package/types/theme.d.ts CHANGED
@@ -4,14 +4,24 @@
4
4
  * @module docpensieve/theme
5
5
  */
6
6
  import { ThemeEngine } from '@docpensieve/theme';
7
+ /**
8
+ * Reads the project's own stylesheets: every `.css` file of its `theme/`
9
+ * folder, in name order. None when the folder does not exist.
10
+ *
11
+ * @param {string} [rootDir] Project root.
12
+ * @returns {string[]} The contents of each file.
13
+ */
14
+ export declare function projectCss(rootDir?: string): string[];
7
15
  /**
8
16
  * Mounts the ThemeEngine matching the declared framework.
9
17
  *
10
18
  * The CLI does this wiring: `core` deliberately ignores the `theme` package
11
19
  * and receives the engine by injection (ADR-002).
12
20
  *
13
- * Along the way, the class table is handed to the components: that is what
14
- * lets them ask for their class instead of hard-coding it (ADR-007).
21
+ * Along the way, the class table and the framework are handed to the
22
+ * components: that is what lets them ask for their class instead of
23
+ * hard-coding it (ADR-007), and lets `ForTheme` keep the variant of the active
24
+ * theme.
15
25
  *
16
26
  * @param {Record<string, any>} config Normalised configuration.
17
27
  * @param {string} [extraCss] CSS appended after the theme's — the look of the
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2
- <rect x="3" y="3" width="7.5" height="7.5" rx="1.5" />
3
- <rect x="13.5" y="3" width="7.5" height="7.5" rx="1.5" />
4
- <rect x="3" y="13.5" width="7.5" height="7.5" rx="1.5" />
5
- <rect x="13.5" y="13.5" width="7.5" height="7.5" rx="1.5" />
6
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
- <path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
3
- <path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
4
- </svg>
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2
- <circle cx="6" cy="5" r="2.5" />
3
- <circle cx="6" cy="19" r="2.5" />
4
- <circle cx="18" cy="12" r="2.5" />
5
- <path d="M6 7.5v9M8.5 5h5a4 4 0 0 1 4 4v.5" />
6
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2
- <circle cx="12" cy="12" r="9" />
3
- <path d="m15.5 8.5-2 5-5 2 2-5z" />
4
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
- <path d="M13 2 4 14h6l-1 8 9-12h-6z" />
3
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2
- <path d="M8 6h13M8 12h13M8 18h13" />
3
- <path d="M3.5 6h.01M3.5 12h.01M3.5 18h.01" />
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
2
- <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
3
- <path d="m9 12 2 2 4-4" />
4
- </svg>
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
- <path d="m12 2 2.9 6.26 6.85.7-5.1 4.6 1.44 6.72L12 16.9l-6.09 3.38 1.44-6.72-5.1-4.6 6.85-.7z" />
3
- </svg>
package/starter/index.mdx DELETED
@@ -1,244 +0,0 @@
1
- ---
2
- title: DocPensieve
3
- description: Static documentation site generator — Markdown and MDX in, runtime-free HTML out, one version per branch.
4
- layout: home
5
- authors: [Valentin Chevoleau]
6
- date: 2026-09-09
7
- tags: [home]
8
- draft: false
9
-
10
- jsonld:
11
- type: TechArticle
12
- breadcrumbs: false
13
- ---
14
-
15
- <div className="dp-hero">
16
-
17
- # DocPensieve
18
-
19
- Your Markdown and MDX files become a static site. No runtime to load, one version per branch, structured data derived from the frontmatter.
20
-
21
- <div className="dp-actions">
22
-
23
- [Get started](/guide/installation/) [See the components](/components/)
24
-
25
- </div>
26
-
27
- </div>
28
-
29
- <Columns>
30
- <Column>
31
- <Card className="h-full" href="/guide/">
32
- <CardBody className="text-sm text-slate-600 dark:text-slate-400">
33
- <LogoIcon src="./icons/compass.svg" size="1.75rem" className="text-indigo-600" />
34
- <strong className="block mt-3 mb-1 text-base font-semibold">Guide</strong>
35
-
36
- From installation to deployment, in order.
37
- </CardBody>
38
- </Card>
39
-
40
- </Column>
41
- <Column>
42
- <Card className="h-full" href="/components/">
43
- <CardBody className="text-sm text-slate-600 dark:text-slate-400">
44
- <LogoIcon src="./icons/blocks.svg" size="1.75rem" className="text-indigo-600" />
45
- <strong className="block mt-3 mb-1 text-base font-semibold">Components</strong>
46
-
47
- Eight components usable without an import, none of them with JavaScript.
48
- </CardBody>
49
- </Card>
50
-
51
- </Column>
52
- <Column>
53
- <Card className="h-full" href="/reference/">
54
- <CardBody className="text-sm text-slate-600 dark:text-slate-400">
55
- <LogoIcon src="./icons/list.svg" size="1.75rem" className="text-indigo-600" />
56
- <strong className="block mt-3 mb-1 text-base font-semibold">Reference</strong>
57
-
58
- Commands, configuration, frontmatter and theme.
59
- </CardBody>
60
- </Card>
61
-
62
- </Column>
63
- <Column>
64
- <Card className="h-full" href="/architecture/">
65
- <CardBody className="text-sm text-slate-600 dark:text-slate-400">
66
- <LogoIcon src="./icons/branch.svg" size="1.75rem" className="text-indigo-600" />
67
- <strong className="block mt-3 mb-1 text-base font-semibold">Architecture</strong>
68
-
69
- How a page becomes HTML, and why it works that way.
70
- </CardBody>
71
- </Card>
72
-
73
- </Column>
74
- </Columns>
75
-
76
- ## In three commands
77
-
78
- <Columns>
79
- <Column span={7}>
80
-
81
- ```bash
82
- npx docpensieve init my-site
83
- cd my-site
84
- npx docpensieve dev
85
- ```
86
-
87
- The first one sets up a configuration and a documentation folder, the last one
88
- opens a server that rebuilds on every save.
89
-
90
- Nothing else to install: the <Tooltip text="Turning the sources into HTML pages ready to serve.">build</Tooltip> runs on your machine, and the produced site only needs a file host.
91
-
92
- </Column>
93
- <Column span={5}>
94
- <Card className="h-full">
95
- <CardHeader>What you get</CardHeader>
96
- <CardBody>
97
- <Tree>
98
- <TreeItem label="dist" open>
99
- <TreeItem label="index.html" />
100
- <TreeItem label="versions.json" />
101
- <TreeItem label="versions" open>
102
- <TreeItem label="v1.0">
103
- <TreeItem label="index.html" />
104
- <TreeItem label="assets" />
105
- </TreeItem>
106
- </TreeItem>
107
- </TreeItem>
108
- </Tree>
109
- </CardBody>
110
- </Card>
111
- </Column>
112
- </Columns>
113
-
114
- ## What it costs the reader
115
-
116
- <div className="flex flex-wrap justify-center gap-6 my-8">
117
- <Skill
118
- name="JavaScript"
119
- level={0}
120
- shape="circle"
121
- color="#10b981"
122
- icon={<LogoIcon src="./icons/lightning.svg" />}
123
- />
124
- <Skill
125
- name="Hydration"
126
- level={0}
127
- shape="circle"
128
- color="#10b981"
129
- icon={<LogoIcon src="./icons/lightning.svg" />}
130
- />
131
- <Skill
132
- name="HTML served as is"
133
- level={100}
134
- shape="circle"
135
- color="#6366f1"
136
- icon={<LogoIcon src="./icons/shield.svg" />}
137
- />
138
- <Skill
139
- name="One stylesheet per version"
140
- level={100}
141
- shape="circle"
142
- color="#6366f1"
143
- icon={<LogoIcon src="./icons/book.svg" />}
144
- />
145
- </div>
146
-
147
- Two dials at zero, and that is on purpose: React serves the **build**, not the
148
- display. What reaches the reader is markup and a stylesheet.
149
-
150
- ## What sets the tool apart
151
-
152
- <Columns>
153
- <Column span={6}>
154
- <Card className="h-full">
155
- <CardHeader>Nothing to load</CardHeader>
156
- <CardBody className="text-sm">
157
- No hydration, no bundle to download before reading. A page stays readable in ten years,
158
- because there is nothing that can stop working.
159
- </CardBody>
160
- </Card>
161
- </Column>
162
- <Column span={6}>
163
- <Card className="h-full">
164
- <CardHeader>One version per branch</CardHeader>
165
- <CardBody className="text-sm">
166
- Each published version lives on its own orphan branch, with its history. Going back to an
167
- old version does not require rebuilding it.
168
- </CardBody>
169
- </Card>
170
- </Column>
171
- <Column span={6}>
172
- <Card className="h-full">
173
- <CardHeader>The frontmatter is enough</CardHeader>
174
- <CardBody className="text-sm">
175
- Title, description, authors and dates produce the JSON-LD, the breadcrumb and the metadata.
176
- Nothing to write twice.
177
- </CardBody>
178
- </Card>
179
- </Column>
180
- <Column span={6}>
181
- <Card className="h-full">
182
- <CardHeader>Nothing fails silently</CardHeader>
183
- <CardBody className="text-sm">
184
- An unknown value, a missing parent, a dead link: each one stops the build with a message and
185
- a hint.
186
- </CardBody>
187
- </Card>
188
- </Column>
189
- </Columns>
190
-
191
- ## Quality, in figures
192
-
193
- <Columns>
194
- <Column span={7}>
195
-
196
- These gauges are not decorative: they are the repository's own measurements,
197
- taken by hand — nothing updates them on its own. <Tooltip text="Share of lines executed by the test suite.">Coverage</Tooltip> and <Tooltip text="TypeScript checks the JSDoc of the source code and of the tests.">typing</Tooltip> are checked on every push.
198
-
199
- What is not measured does not improve — and what is not checked every time
200
- degrades.
201
-
202
- </Column>
203
- <Column span={5}>
204
- <Skill name="Line coverage" level={97} color="#10b981" icon={<LogoIcon src="./icons/shield.svg" />} />
205
- <Skill name="Branch coverage" level={87} color="#f59e0b" icon={<LogoIcon src="./icons/shield.svg" />} />
206
- <Skill name="Typing of code and tests" level={100} color="#6366f1" icon={<LogoIcon src="./icons/star.svg" />} />
207
- </Column>
208
- </Columns>
209
-
210
- ## A page, end to end
211
-
212
- <Columns>
213
- <Column span={5}>
214
-
215
- ```mdx
216
- ---
217
- title: Installation
218
- description: Install the tool.
219
- ---
220
-
221
- # Installation
222
-
223
- Node.js 22 or later.
224
-
225
- <Tooltip text="Complete new project">init</Tooltip>
226
- sets up the configuration.
227
- ```
228
-
229
- </Column>
230
- <Column span={7}>
231
-
232
- The file is read, its frontmatter detached, its content compiled to HTML.
233
- Components are rendered **at build time**: `Tooltip` becomes two elements and a
234
- style rule, without a line of script.
235
-
236
- The title feeds the `<title>` tag, the description the metadata, and both
237
- together the JSON-LD. The file name gives the URL, its folder the place in the
238
- menu.
239
-
240
- None of this needs configuration: [writing a page](/guide/writing-pages/) is
241
- enough.
242
-
243
- </Column>
244
- </Columns>