docpensieve 0.1.3 → 0.1.4
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 +22 -3
- package/package.json +5 -5
- package/src/commands/dev.js +27 -3
- package/src/commands/init.js +60 -4
- package/src/templates/custom.css +20 -0
- package/src/theme.js +30 -7
- package/starter/01-guide/01-installation.md +16 -5
- package/starter/01-guide/03-writing-pages.md +2 -2
- package/starter/01-guide/05-themes.md +5 -3
- package/starter/02-components/01-card.mdx +155 -7
- package/starter/02-components/02-columns.mdx +98 -5
- package/starter/02-components/03-time-timer.mdx +1 -1
- package/starter/02-components/05-tree.mdx +32 -2
- package/starter/02-components/06-scroll-to-top.mdx +40 -0
- package/starter/02-components/07-skill.mdx +44 -12
- package/starter/02-components/08-logo-icon.mdx +44 -16
- package/starter/02-components/09-for-theme.mdx +45 -0
- package/starter/02-components/{index.md → index.mdx} +44 -1
- package/starter/03-reference/01-cli.md +5 -0
- package/starter/03-reference/02-configuration.md +5 -0
- package/starter/03-reference/04-theme.md +4 -3
- package/starter/examples.css +156 -0
- package/types/theme.d.ts +12 -2
|
@@ -81,6 +81,10 @@ produce nothing visible, and the error would take a long time to find.
|
|
|
81
81
|
independent settings. The grid subtracts the gaps by itself, so spacing the
|
|
82
82
|
columns distorts no width.
|
|
83
83
|
|
|
84
|
+
<ForTheme framework="tailwind">
|
|
85
|
+
|
|
86
|
+
With the Tailwind theme, a `gap-*` utility sets it:
|
|
87
|
+
|
|
84
88
|
<Columns className="gap-10">
|
|
85
89
|
<Column>
|
|
86
90
|
<Card>
|
|
@@ -98,6 +102,37 @@ columns distorts no width.
|
|
|
98
102
|
<Columns className="gap-10">…</Columns>
|
|
99
103
|
```
|
|
100
104
|
|
|
105
|
+
</ForTheme>
|
|
106
|
+
<ForTheme framework="custom">
|
|
107
|
+
|
|
108
|
+
With the custom theme, a class of your own sets it — here `wide-gap`, from
|
|
109
|
+
`theme/99-docpensieve.css`:
|
|
110
|
+
|
|
111
|
+
<Columns className="wide-gap">
|
|
112
|
+
<Column>
|
|
113
|
+
<Card>
|
|
114
|
+
<CardBody>The gap widens</CardBody>
|
|
115
|
+
</Card>
|
|
116
|
+
</Column>
|
|
117
|
+
<Column>
|
|
118
|
+
<Card>
|
|
119
|
+
<CardBody>without touching the widths</CardBody>
|
|
120
|
+
</Card>
|
|
121
|
+
</Column>
|
|
122
|
+
</Columns>
|
|
123
|
+
|
|
124
|
+
```mdx
|
|
125
|
+
<Columns className="wide-gap">…</Columns>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
.wide-gap {
|
|
130
|
+
gap: 2.5rem;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
</ForTheme>
|
|
135
|
+
|
|
101
136
|
## An aside next to the text
|
|
102
137
|
|
|
103
138
|
The most useful layout in documentation: the main point wide, the remark
|
|
@@ -115,9 +150,15 @@ class table is announced to them.
|
|
|
115
150
|
|
|
116
151
|
</Column>
|
|
117
152
|
<Column span={4}>
|
|
118
|
-
<Card
|
|
119
|
-
|
|
120
|
-
|
|
153
|
+
<Card
|
|
154
|
+
style={{
|
|
155
|
+
height: '100%',
|
|
156
|
+
borderColor: 'var(--dp-accent)',
|
|
157
|
+
background: 'var(--dp-accent-soft)',
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<CardHeader style={{ fontSize: '0.875rem' }}>Remember</CardHeader>
|
|
161
|
+
<CardBody style={{ fontSize: '0.875rem' }}>
|
|
121
162
|
A component that produces a URL resolves it itself, following the same rules as a
|
|
122
163
|
Markdown link.
|
|
123
164
|
</CardBody>
|
|
@@ -159,8 +200,12 @@ versions: [
|
|
|
159
200
|
## Letting content flow
|
|
160
201
|
|
|
161
202
|
For a text or a gallery that _flows_ from one column to the next, the grid is
|
|
162
|
-
not the right tool and no component is needed:
|
|
163
|
-
|
|
203
|
+
not the right tool and no component is needed: CSS multi-column is enough,
|
|
204
|
+
directly in the page.
|
|
205
|
+
|
|
206
|
+
<ForTheme framework="tailwind">
|
|
207
|
+
|
|
208
|
+
With the Tailwind theme, its utilities write it:
|
|
164
209
|
|
|
165
210
|
<div className="columns-2 gap-6 sm:columns-3">
|
|
166
211
|
<Card className="mb-6 break-inside-avoid">
|
|
@@ -184,6 +229,54 @@ enough, directly in the page.
|
|
|
184
229
|
<div className="columns-2 gap-6 sm:columns-3">…</div>
|
|
185
230
|
```
|
|
186
231
|
|
|
232
|
+
</ForTheme>
|
|
233
|
+
<ForTheme framework="custom">
|
|
234
|
+
|
|
235
|
+
With the custom theme, a class of your own — here `flow`, from
|
|
236
|
+
`theme/99-docpensieve.css`:
|
|
237
|
+
|
|
238
|
+
<div className="flow">
|
|
239
|
+
<Card>
|
|
240
|
+
<CardBody>One</CardBody>
|
|
241
|
+
</Card>
|
|
242
|
+
<Card>
|
|
243
|
+
<CardBody>Two, a little longer, so that the heights differ.</CardBody>
|
|
244
|
+
</Card>
|
|
245
|
+
<Card>
|
|
246
|
+
<CardBody>Three</CardBody>
|
|
247
|
+
</Card>
|
|
248
|
+
<Card>
|
|
249
|
+
<CardBody>Four</CardBody>
|
|
250
|
+
</Card>
|
|
251
|
+
<Card>
|
|
252
|
+
<CardBody>Five</CardBody>
|
|
253
|
+
</Card>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
```mdx
|
|
257
|
+
<div className="flow">…</div>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```css
|
|
261
|
+
.flow {
|
|
262
|
+
columns: 2;
|
|
263
|
+
column-gap: 1.5rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@media (min-width: 40rem) {
|
|
267
|
+
.flow {
|
|
268
|
+
columns: 3;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.flow > * {
|
|
273
|
+
break-inside: avoid;
|
|
274
|
+
margin-block-end: 1.5rem;
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
</ForTheme>
|
|
279
|
+
|
|
187
280
|
The difference is there: above, the order is vertical and the browser
|
|
188
281
|
distributes as it likes; with `Columns`, each block stays where you put it.
|
|
189
282
|
|
|
@@ -93,7 +93,7 @@ months.
|
|
|
93
93
|
|
|
94
94
|
An announcement banner that removes itself:
|
|
95
95
|
|
|
96
|
-
<Card
|
|
96
|
+
<Card style={{ borderColor: 'var(--dp-accent)', background: 'var(--dp-accent-soft)' }}>
|
|
97
97
|
<CardBody>
|
|
98
98
|
<TimeTimer start="01/01/2020" duration="36500d">
|
|
99
99
|
**Version 1.1 in preparation.** New features are written in this version.
|
|
@@ -46,7 +46,7 @@ children** is a collapsible branch, an entry **without children** is a leaf.
|
|
|
46
46
|
|
|
47
47
|
<Columns>
|
|
48
48
|
<Column span={6}>
|
|
49
|
-
<Card
|
|
49
|
+
<Card style={{ height: '100%' }}>
|
|
50
50
|
<CardHeader>Closed by default</CardHeader>
|
|
51
51
|
<CardBody>
|
|
52
52
|
<Tree>
|
|
@@ -58,7 +58,7 @@ children** is a collapsible branch, an entry **without children** is a leaf.
|
|
|
58
58
|
</Card>
|
|
59
59
|
</Column>
|
|
60
60
|
<Column span={6}>
|
|
61
|
-
<Card
|
|
61
|
+
<Card style={{ height: '100%' }}>
|
|
62
62
|
<CardHeader>Opened by `open`</CardHeader>
|
|
63
63
|
<CardBody>
|
|
64
64
|
<Tree>
|
|
@@ -146,12 +146,42 @@ well.
|
|
|
146
146
|
|
|
147
147
|
## Styling the tree
|
|
148
148
|
|
|
149
|
+
<ForTheme framework="tailwind">
|
|
150
|
+
|
|
149
151
|
<Tree className="text-indigo-700 dark:text-indigo-300">
|
|
150
152
|
<TreeItem label="in colour" open>
|
|
151
153
|
<TreeItem label="the children inherit" />
|
|
152
154
|
</TreeItem>
|
|
153
155
|
</Tree>
|
|
154
156
|
|
|
157
|
+
```mdx
|
|
158
|
+
<Tree className="text-indigo-700 dark:text-indigo-300">…</Tree>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
</ForTheme>
|
|
162
|
+
<ForTheme framework="custom">
|
|
163
|
+
|
|
164
|
+
A class of your own colours it — here `accent-text`, from
|
|
165
|
+
`theme/99-docpensieve.css`, which follows the palette in dark mode too:
|
|
166
|
+
|
|
167
|
+
<Tree className="accent-text">
|
|
168
|
+
<TreeItem label="in colour" open>
|
|
169
|
+
<TreeItem label="the children inherit" />
|
|
170
|
+
</TreeItem>
|
|
171
|
+
</Tree>
|
|
172
|
+
|
|
173
|
+
```mdx
|
|
174
|
+
<Tree className="accent-text">…</Tree>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```css
|
|
178
|
+
.accent-text {
|
|
179
|
+
color: var(--dp-accent);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
</ForTheme>
|
|
184
|
+
|
|
155
185
|
## What it does not announce
|
|
156
186
|
|
|
157
187
|
The structure is a nested list, not a `role="tree"`. That role promises a
|
|
@@ -31,6 +31,8 @@ scrollToTop: false,
|
|
|
31
31
|
text**, with its own content — a pointer at the end of a chapter, for
|
|
32
32
|
instance.
|
|
33
33
|
|
|
34
|
+
<ForTheme framework="tailwind">
|
|
35
|
+
|
|
34
36
|
<div className="flex flex-wrap items-center gap-3">
|
|
35
37
|
<ScrollToTop className="!static !inline-flex !w-auto !shadow-none px-4" label="Top of page">
|
|
36
38
|
Top
|
|
@@ -59,6 +61,44 @@ All three carry `!static`: that is what takes them out of the corner of the
|
|
|
59
61
|
screen to set them in the text. **Without this class, they would stack** on
|
|
60
62
|
top of the shell's button, all in the same place.
|
|
61
63
|
|
|
64
|
+
</ForTheme>
|
|
65
|
+
<ForTheme framework="custom">
|
|
66
|
+
|
|
67
|
+
<div className="row">
|
|
68
|
+
<ScrollToTop className="inline-button" label="Top of page">
|
|
69
|
+
Top
|
|
70
|
+
</ScrollToTop>
|
|
71
|
+
<ScrollToTop className="inline-button" label="Back to the summit">
|
|
72
|
+
↑ Summit
|
|
73
|
+
</ScrollToTop>
|
|
74
|
+
<ScrollToTop className="inline-button accent-text" label="Start reading again">
|
|
75
|
+
Start again
|
|
76
|
+
</ScrollToTop>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
```mdx
|
|
80
|
+
<ScrollToTop className="inline-button" label="Top of page">
|
|
81
|
+
Top
|
|
82
|
+
</ScrollToTop>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
.inline-button {
|
|
87
|
+
position: static;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
inline-size: auto;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
padding-inline: 1rem;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
All three carry `inline-button`, from `theme/99-docpensieve.css`: its
|
|
96
|
+
`position: static` takes them out of the corner of the screen to set them in
|
|
97
|
+
the text. **Without this class, they would stack** on top of the shell's
|
|
98
|
+
button, all in the same place.
|
|
99
|
+
|
|
100
|
+
</ForTheme>
|
|
101
|
+
|
|
62
102
|
The accessible name stays set by `label`: without it, the link would announce
|
|
63
103
|
itself by its appearance alone.
|
|
64
104
|
|
|
@@ -31,7 +31,7 @@ Content passed as a child becomes a comment under the bar.
|
|
|
31
31
|
`shape="circle"` draws a dial rather than a bar. Useful when the gauges are
|
|
32
32
|
few and you want them to stand out.
|
|
33
33
|
|
|
34
|
-
<div
|
|
34
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
35
35
|
<Skill name="Accessibility" level={85} shape="circle" />
|
|
36
36
|
<Skill name="Performance" level={92} shape="circle" />
|
|
37
37
|
<Skill name="Coverage" level={64} shape="circle" />
|
|
@@ -53,7 +53,9 @@ the entry animation only has to start from zero.
|
|
|
53
53
|
|
|
54
54
|
It is set through `--dp-skill-size`, on the gauge or on what surrounds it.
|
|
55
55
|
|
|
56
|
-
<div
|
|
56
|
+
<div
|
|
57
|
+
style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', '--dp-skill-size': '4rem' }}
|
|
58
|
+
>
|
|
57
59
|
<Skill name="Smaller" level={70} shape="circle" />
|
|
58
60
|
<Skill name="Also smaller" level={45} shape="circle" />
|
|
59
61
|
</div>
|
|
@@ -72,7 +74,7 @@ It is set through `--dp-skill-size`, on the gauge or on what surrounds it.
|
|
|
72
74
|
|
|
73
75
|
### Without the figure
|
|
74
76
|
|
|
75
|
-
<div
|
|
77
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
76
78
|
<Skill name="Silent" level={55} shape="circle" showValue={false} />
|
|
77
79
|
</div>
|
|
78
80
|
|
|
@@ -96,7 +98,7 @@ seeing them match helps read a column of gauges at a glance.
|
|
|
96
98
|
|
|
97
99
|
### As a circle too
|
|
98
100
|
|
|
99
|
-
<div
|
|
101
|
+
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
|
100
102
|
<Skill
|
|
101
103
|
name="Speed"
|
|
102
104
|
level={92}
|
|
@@ -161,7 +163,7 @@ Several gauges in columns, each in its card.
|
|
|
161
163
|
|
|
162
164
|
<Columns>
|
|
163
165
|
<Column span={6}>
|
|
164
|
-
<Card
|
|
166
|
+
<Card style={{ height: '100%' }}>
|
|
165
167
|
<CardHeader>Quality</CardHeader>
|
|
166
168
|
<CardBody>
|
|
167
169
|
<Skill name="Tests" level={88} />
|
|
@@ -171,7 +173,7 @@ Several gauges in columns, each in its card.
|
|
|
171
173
|
</Card>
|
|
172
174
|
</Column>
|
|
173
175
|
<Column span={6}>
|
|
174
|
-
<Card
|
|
176
|
+
<Card style={{ height: '100%' }}>
|
|
175
177
|
<CardHeader>Delivery</CardHeader>
|
|
176
178
|
<CardBody>
|
|
177
179
|
<Skill name="Continuous integration" level={100} />
|
|
@@ -186,20 +188,50 @@ Several gauges in columns, each in its card.
|
|
|
186
188
|
|
|
187
189
|
## Styling the gauge
|
|
188
190
|
|
|
191
|
+
<ForTheme framework="tailwind">
|
|
192
|
+
|
|
189
193
|
The component classes live below the utilities: a `className` set at use wins.
|
|
190
194
|
|
|
191
195
|
<Skill className="max-w-sm" name="Reduced width" level={55} />
|
|
192
196
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
The gauge takes its colour from `--dp-skill-color`, which an arbitrary
|
|
198
|
+
property sets:
|
|
199
|
+
|
|
200
|
+
<Skill className="[--dp-skill-color:#10b981]" name="Green fill" level={78} />
|
|
196
201
|
|
|
197
202
|
```mdx
|
|
198
|
-
<
|
|
199
|
-
<Skill name="Green fill" level={78} />
|
|
200
|
-
</div>
|
|
203
|
+
<Skill className="[--dp-skill-color:#10b981]" name="Green fill" level={78} />
|
|
201
204
|
```
|
|
202
205
|
|
|
206
|
+
A selector written in a class, such as `[&_.dp-skill-fill]:…`, would not do:
|
|
207
|
+
its `&` reaches the HTML as `&`, and the stylesheet — compiled from the
|
|
208
|
+
rendered pages — never receives the rule.
|
|
209
|
+
|
|
210
|
+
</ForTheme>
|
|
211
|
+
<ForTheme framework="custom">
|
|
212
|
+
|
|
213
|
+
The component classes live in the `components` layer, those of the theme
|
|
214
|
+
folder in none: a class of yours set at use wins. The gauge takes its colour
|
|
215
|
+
from `--dp-skill-color`, which a class can set — here `narrow` and `green`,
|
|
216
|
+
from `theme/99-docpensieve.css`:
|
|
217
|
+
|
|
218
|
+
<Skill className="narrow" name="Reduced width" level={55} />
|
|
219
|
+
|
|
220
|
+
<Skill className="green" name="Green fill" level={78} />
|
|
221
|
+
|
|
222
|
+
```mdx
|
|
223
|
+
<Skill className="green" name="Green fill" level={78} />
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
.green {
|
|
228
|
+
--dp-skill-color: #10b981;
|
|
229
|
+
color: #10b981;
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
</ForTheme>
|
|
234
|
+
|
|
203
235
|
## The fill
|
|
204
236
|
|
|
205
237
|
It animates as it enters the viewport, through `animation-timeline: view()`,
|
|
@@ -27,6 +27,8 @@ folder. Nothing can leave it: a page does not read the rest of the machine.
|
|
|
27
27
|
|
|
28
28
|
Placed in a text, the icon takes its size and colour.
|
|
29
29
|
|
|
30
|
+
<ForTheme framework="tailwind">
|
|
31
|
+
|
|
30
32
|
<div className="text-indigo-600 text-2xl">
|
|
31
33
|
<LogoIcon src="./icons/star.svg" /> at the size and colour of the text
|
|
32
34
|
</div>
|
|
@@ -35,38 +37,64 @@ Placed in a text, the icon takes its size and colour.
|
|
|
35
37
|
<LogoIcon src="./icons/star.svg" /> and here, smaller and greyer
|
|
36
38
|
</div>
|
|
37
39
|
|
|
40
|
+
</ForTheme>
|
|
41
|
+
<ForTheme framework="custom">
|
|
42
|
+
|
|
43
|
+
<div className="accent-text large">
|
|
44
|
+
<LogoIcon src="./icons/star.svg" /> at the size and colour of the text
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div className="small muted">
|
|
48
|
+
<LogoIcon src="./icons/star.svg" /> and here, smaller and greyer
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
</ForTheme>
|
|
52
|
+
|
|
38
53
|
## Sizes
|
|
39
54
|
|
|
40
55
|
`size` accepts any CSS length.
|
|
41
56
|
|
|
42
|
-
<div
|
|
57
|
+
<div style={{ display: 'flex', alignItems: 'flex-end', gap: '1rem', color: '#10b981' }}>
|
|
43
58
|
<LogoIcon src="./icons/shield.svg" size="1rem" />
|
|
44
59
|
<LogoIcon src="./icons/shield.svg" size="2rem" />
|
|
45
60
|
<LogoIcon src="./icons/shield.svg" size="3rem" />
|
|
46
61
|
<LogoIcon src="./icons/shield.svg" size="4rem" />
|
|
47
62
|
</div>
|
|
48
63
|
|
|
64
|
+
<ForTheme framework="tailwind">
|
|
65
|
+
|
|
66
|
+
```mdx
|
|
67
|
+
<LogoIcon src="./icons/shield.svg" size="3rem" style={{ color: '#10b981' }} />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
</ForTheme>
|
|
71
|
+
<ForTheme framework="custom">
|
|
72
|
+
|
|
49
73
|
```mdx
|
|
50
|
-
<LogoIcon src="./icons/shield.svg" size="3rem" className="
|
|
74
|
+
<LogoIcon src="./icons/shield.svg" size="3rem" className="green" />
|
|
51
75
|
```
|
|
52
76
|
|
|
77
|
+
`green` comes from `theme/99-docpensieve.css`, and sets `color`.
|
|
78
|
+
|
|
79
|
+
</ForTheme>
|
|
80
|
+
|
|
53
81
|
The colour only follows if the file relies on `currentColor` rather than on a
|
|
54
82
|
fixed colour.
|
|
55
83
|
|
|
56
84
|
## In a list
|
|
57
85
|
|
|
58
|
-
<ul
|
|
59
|
-
<li
|
|
60
|
-
<LogoIcon src="./icons/lightning.svg" size="1.1rem"
|
|
86
|
+
<ul style={{ listStyle: 'none', paddingInlineStart: 0, display: 'grid', gap: '0.5rem' }}>
|
|
87
|
+
<li style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
88
|
+
<LogoIcon src="./icons/lightning.svg" size="1.1rem" style={{ color: '#f59e0b' }} /> No script to
|
|
61
89
|
load
|
|
62
90
|
</li>
|
|
63
|
-
<li
|
|
64
|
-
<LogoIcon src="./icons/shield.svg" size="1.1rem"
|
|
91
|
+
<li style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
92
|
+
<LogoIcon src="./icons/shield.svg" size="1.1rem" style={{ color: '#10b981' }} /> Links are read
|
|
65
93
|
back before publishing
|
|
66
94
|
</li>
|
|
67
|
-
<li
|
|
68
|
-
<LogoIcon src="./icons/book.svg" size="1.1rem"
|
|
69
|
-
branch
|
|
95
|
+
<li style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
96
|
+
<LogoIcon src="./icons/book.svg" size="1.1rem" style={{ color: 'var(--dp-accent)' }} /> One
|
|
97
|
+
version per branch
|
|
70
98
|
</li>
|
|
71
99
|
</ul>
|
|
72
100
|
|
|
@@ -74,10 +102,10 @@ fixed colour.
|
|
|
74
102
|
|
|
75
103
|
<Columns>
|
|
76
104
|
<Column span={6}>
|
|
77
|
-
<Card
|
|
105
|
+
<Card style={{ height: '100%' }}>
|
|
78
106
|
<CardBody>
|
|
79
|
-
<LogoIcon src="./icons/lightning.svg" size="1.6rem"
|
|
80
|
-
<strong
|
|
107
|
+
<LogoIcon src="./icons/lightning.svg" size="1.6rem" style={{ color: '#f59e0b' }} />
|
|
108
|
+
<strong style={{ display: 'block', margin: '0.5rem 0 0.25rem', fontSize: '1rem' }}>Fast</strong>
|
|
81
109
|
|
|
82
110
|
No hydration, no bundle to download before reading.
|
|
83
111
|
</CardBody>
|
|
@@ -85,10 +113,10 @@ fixed colour.
|
|
|
85
113
|
|
|
86
114
|
</Column>
|
|
87
115
|
<Column span={6}>
|
|
88
|
-
<Card
|
|
116
|
+
<Card style={{ height: '100%' }}>
|
|
89
117
|
<CardBody>
|
|
90
|
-
<LogoIcon src="./icons/shield.svg" size="1.6rem"
|
|
91
|
-
<strong
|
|
118
|
+
<LogoIcon src="./icons/shield.svg" size="1.6rem" style={{ color: '#10b981' }} />
|
|
119
|
+
<strong style={{ display: 'block', margin: '0.5rem 0 0.25rem', fontSize: '1rem' }}>Verified</strong>
|
|
92
120
|
|
|
93
121
|
Dead links and invalid markup stop the publication.
|
|
94
122
|
</CardBody>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ForTheme
|
|
3
|
+
description: Content kept for one theme only.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ForTheme
|
|
7
|
+
|
|
8
|
+
Keeps its content for the sites whose theme matches. The choice is made at
|
|
9
|
+
build time: the other variant does not even reach the HTML.
|
|
10
|
+
|
|
11
|
+
```mdx
|
|
12
|
+
<ForTheme framework="tailwind">
|
|
13
|
+
|
|
14
|
+
With Tailwind, a utility: `className="max-w-sm"`.
|
|
15
|
+
|
|
16
|
+
</ForTheme>
|
|
17
|
+
<ForTheme framework="custom">
|
|
18
|
+
|
|
19
|
+
With the custom theme, a class of the `theme/` folder: `className="narrow"`.
|
|
20
|
+
|
|
21
|
+
</ForTheme>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
It is how the pages of this documentation show each example in the terms of
|
|
25
|
+
your theme. Changing `theme.framework` in the configuration changes what they
|
|
26
|
+
show, without editing them.
|
|
27
|
+
|
|
28
|
+
## On this site
|
|
29
|
+
|
|
30
|
+
<ForTheme framework="tailwind">
|
|
31
|
+
|
|
32
|
+
This site is built with the **Tailwind** theme.
|
|
33
|
+
|
|
34
|
+
</ForTheme>
|
|
35
|
+
<ForTheme framework="custom">
|
|
36
|
+
|
|
37
|
+
This site is built with the **custom** theme.
|
|
38
|
+
|
|
39
|
+
</ForTheme>
|
|
40
|
+
|
|
41
|
+
## What it refuses
|
|
42
|
+
|
|
43
|
+
A `framework` other than `tailwind` or `custom` stops the build, with the
|
|
44
|
+
accepted values: a typo would otherwise hide the content under every theme,
|
|
45
|
+
without a word.
|
|
@@ -8,7 +8,12 @@ description: The components available in every page, without an import.
|
|
|
8
8
|
These components can be used in any `.mdx` page **without an import**.
|
|
9
9
|
|
|
10
10
|
They provide the **structure** — wrappers, separators, spacing. The look is set
|
|
11
|
-
with `className
|
|
11
|
+
with `className`.
|
|
12
|
+
|
|
13
|
+
<ForTheme framework="tailwind">
|
|
14
|
+
|
|
15
|
+
With the Tailwind theme, a `className` holds utilities, compiled from the ones
|
|
16
|
+
your pages use:
|
|
12
17
|
|
|
13
18
|
```mdx
|
|
14
19
|
<Card className="max-w-sm">
|
|
@@ -19,6 +24,43 @@ with `className`, in utilities of the active theme:
|
|
|
19
24
|
The component classes live in the `components` layer, below the utilities: a
|
|
20
25
|
`className` set at use always wins.
|
|
21
26
|
|
|
27
|
+
</ForTheme>
|
|
28
|
+
<ForTheme framework="custom">
|
|
29
|
+
|
|
30
|
+
With the custom theme, a `className` names classes of your own: there are no
|
|
31
|
+
utilities. Every `.css` file of the `theme/` folder, at the root of the
|
|
32
|
+
project, is appended to the stylesheet, and `docpensieve dev` picks up every
|
|
33
|
+
change.
|
|
34
|
+
|
|
35
|
+
```mdx
|
|
36
|
+
<Card className="narrow">
|
|
37
|
+
<CardHeader className="centered">Title</CardHeader>
|
|
38
|
+
</Card>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
/* theme/custom.css */
|
|
43
|
+
.narrow {
|
|
44
|
+
max-inline-size: 24rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.centered {
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The component classes live in the `components` layer, those of the theme
|
|
53
|
+
folder in none: a class of yours always wins.
|
|
54
|
+
|
|
55
|
+
The examples of these pages use the classes of `theme/99-docpensieve.css`,
|
|
56
|
+
which `init` wrote next to this documentation: delete both together.
|
|
57
|
+
|
|
58
|
+
</ForTheme>
|
|
59
|
+
|
|
60
|
+
Every example is shown in the terms of the site's theme, through
|
|
61
|
+
[ForTheme](./for-theme/): changing `theme.framework` in the configuration
|
|
62
|
+
changes the examples too.
|
|
63
|
+
|
|
22
64
|
## Available
|
|
23
65
|
|
|
24
66
|
- [Card](./card/) — card, with header, body, footer and image
|
|
@@ -29,6 +71,7 @@ The component classes live in the `components` layer, below the utilities: a
|
|
|
29
71
|
- [ScrollToTop](./scroll-to-top/) — back to the top of the page
|
|
30
72
|
- [Skill](./skill/) — level gauge
|
|
31
73
|
- [LogoIcon](./logo-icon/) — SVG icon inlined in the page
|
|
74
|
+
- [ForTheme](./for-theme/) — content kept for one theme only
|
|
32
75
|
|
|
33
76
|
## Without JavaScript
|
|
34
77
|
|
|
@@ -45,6 +45,11 @@ in the new site, in `docs/<version>/99-docpensieve/`: a **DocPensieve** section
|
|
|
45
45
|
at the end of the menu, matching the installed version. Delete that folder when
|
|
46
46
|
you no longer need it.
|
|
47
47
|
|
|
48
|
+
Under the `custom` theme, the command also writes `theme/custom.css`, where the
|
|
49
|
+
project's own classes go, and — with the documentation —
|
|
50
|
+
`theme/99-docpensieve.css`, the classes of its examples, to delete along with
|
|
51
|
+
it. An existing `theme/custom.css` is never overwritten, even with `--force`.
|
|
52
|
+
|
|
48
53
|
## `build`
|
|
49
54
|
|
|
50
55
|
Generates the site.
|
|
@@ -103,6 +103,11 @@ theme: {
|
|
|
103
103
|
|
|
104
104
|
The available tokens are listed in [Themes](../guide/themes/).
|
|
105
105
|
|
|
106
|
+
Longer rules go in the `theme/` folder, at the root of the project: every
|
|
107
|
+
`.css` file in it is appended after `css`, in name order, and
|
|
108
|
+
`docpensieve dev` picks up every change. Under the `custom` theme, `init`
|
|
109
|
+
starts it with `theme/custom.css`.
|
|
110
|
+
|
|
106
111
|
## `baseUrl`, and why you rarely write it
|
|
107
112
|
|
|
108
113
|
A `siteUrl` with a sub-path already gives it: `https://example.com/my-project`
|
|
@@ -124,7 +124,8 @@ The delivered stylesheet is assembled from four pieces, in this order:
|
|
|
124
124
|
| a skin or a bridge | `custom.css`, or `tailwind-bridge.css` |
|
|
125
125
|
| the components' one | The `dp-*` rules of the shipped components |
|
|
126
126
|
|
|
127
|
-
Then comes what the project adds
|
|
127
|
+
Then comes what the project adds: `theme.css`, then every `.css` file of its
|
|
128
|
+
`theme/` folder, in name order.
|
|
128
129
|
|
|
129
130
|
The layout is **never** duplicated in a provider: it lives in `structure.css`,
|
|
130
131
|
which both share. A provider only takes care of the styling.
|
|
@@ -144,6 +145,6 @@ The `custom` theme has no utility layer: its stylesheets are in no layer, and
|
|
|
144
145
|
therefore come before the component rules, which stay in the `components`
|
|
145
146
|
layer.
|
|
146
147
|
|
|
147
|
-
What `theme.css`
|
|
148
|
-
those that have one. That is what lets you write a fix there without worrying
|
|
148
|
+
What `theme.css` and the `theme/` folder add is in no layer: without a layer, a
|
|
149
|
+
rule wins over all those that have one. That is what lets you write a fix there without worrying
|
|
149
150
|
about specificity.
|