@timmo001/docs-kit 0.10.1 → 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.
Files changed (2) hide show
  1. package/README.md +25 -0
  2. package/package.json +4 -4
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/docs-kit",
3
- "version": "0.10.1",
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.1",
43
- "@timmo001/groundwork-ui": "0.10.1",
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.2005",
55
+ "oxlint-tsgolint": "7.0.2006",
56
56
  "prettier": "3.9.10",
57
57
  "typescript": "7.0.2"
58
58
  }