@timmo001/docs-kit 0.10.0 → 0.10.2
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 +27 -1
- package/package.json +4 -4
- package/src/blume/theme-picker.astro +2 -1
package/README.md
CHANGED
|
@@ -106,6 +106,31 @@ so load the theme's font files in `theme.css` too, for example with
|
|
|
106
106
|
`@import "@fontsource-variable/inter";`. Use Base until the app has a theme of
|
|
107
107
|
its own.
|
|
108
108
|
|
|
109
|
+
An app whose own theme isn't in Groundwork's set keeps its theme document in
|
|
110
|
+
the app and renders the stylesheet from a site script with `blumeThemeCss` from
|
|
111
|
+
`@timmo001/groundwork-tokens/runtime`, then imports that file in place of a
|
|
112
|
+
docs-kit theme. Fail the script on a missed contrast check, so a theme that
|
|
113
|
+
reads badly never ships:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import {
|
|
117
|
+
blumeThemeCss,
|
|
118
|
+
parseTheme,
|
|
119
|
+
runtimeTheme,
|
|
120
|
+
} from "@timmo001/groundwork-tokens/runtime";
|
|
121
|
+
|
|
122
|
+
const parsed = parseTheme(await Bun.file("theme.json").text());
|
|
123
|
+
|
|
124
|
+
if (parsed._tag === "Failure") throw new Error(String(parsed.failure));
|
|
125
|
+
|
|
126
|
+
const { theme, checks } = runtimeTheme(parsed.success);
|
|
127
|
+
const misses = checks.filter((check) => !check.passes);
|
|
128
|
+
|
|
129
|
+
if (misses.length > 0) throw new Error(`Contrast misses: ${misses.length}`);
|
|
130
|
+
|
|
131
|
+
await Bun.write("theme-app.css", `${blumeThemeCss(theme)}\n`);
|
|
132
|
+
```
|
|
133
|
+
|
|
109
134
|
`HeaderSearch` adds a mode picker next to Blume's light and dark toggle, with
|
|
110
135
|
Light, Dark and Darker. To let readers pick the theme as well, import every
|
|
111
136
|
theme after the site's default and pass the themes to `HeaderSearch` from a
|
|
@@ -122,7 +147,8 @@ each optional theme's `family`, which groups it in the select, and `mode` for
|
|
|
122
147
|
one that comes in one scheme only, such as Catppuccin Latte. Picking that
|
|
123
148
|
theme moves the page into its scheme, and the other modes can't be picked
|
|
124
149
|
while it's in use. Themes without a family go under `group`, which defaults
|
|
125
|
-
to Groundwork.
|
|
150
|
+
to Groundwork. From seven themes the select has a search field, which also
|
|
151
|
+
finds themes by family, or by `light` or `dark`.
|
|
126
152
|
|
|
127
153
|
```astro
|
|
128
154
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmo001/docs-kit",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Shared branding, layout and config for timmo001 documentation sites",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"format:check": "prettier --check ."
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@timmo001/groundwork-tokens": "0.10.
|
|
43
|
-
"@timmo001/groundwork-ui": "0.10.
|
|
42
|
+
"@timmo001/groundwork-tokens": "0.10.2",
|
|
43
|
+
"@timmo001/groundwork-ui": "0.10.2",
|
|
44
44
|
"sharp": "0.35.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/bun": "1.4.4",
|
|
53
53
|
"blume": "2.2.6",
|
|
54
54
|
"oxlint": "1.91.0",
|
|
55
|
-
"oxlint-tsgolint": "7.0.
|
|
55
|
+
"oxlint-tsgolint": "7.0.2006",
|
|
56
56
|
"prettier": "3.9.10",
|
|
57
57
|
"typescript": "7.0.2"
|
|
58
58
|
}
|
|
@@ -118,13 +118,14 @@ const modes = [
|
|
|
118
118
|
data-gw-theme-select
|
|
119
119
|
label="Theme"
|
|
120
120
|
inline-label
|
|
121
|
-
search="never"
|
|
122
121
|
options={JSON.stringify(
|
|
123
122
|
themes.map((theme) => ({
|
|
124
123
|
value: theme.id,
|
|
125
124
|
label: theme.name,
|
|
126
125
|
// Headings only once there's more than one group
|
|
127
126
|
group: grouped ? (theme.family ?? group) : undefined,
|
|
127
|
+
// So a search for light or dark finds the themes that have it
|
|
128
|
+
keywords: theme.mode === undefined ? ["light", "dark"] : [theme.mode],
|
|
128
129
|
})),
|
|
129
130
|
)}
|
|
130
131
|
/>
|