@tenphi/cookbook 0.25.2 → 0.25.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/docs/migration.md CHANGED
@@ -230,8 +230,8 @@ Tasty-generated style hashes and library-owned Pagefind sub-element classes rema
230
230
 
231
231
  Hero buttons stay stationary on hover. Minimal actions share secondary outline
232
232
  padding, background, and border width, with a transparent border (`border: "#clear"`).
233
- Pagination links also reserve a transparent border before hover; hover changes
234
- only its color, preserving `theme.styles.Pagination.Link` border width and style.
233
+ Pagination links keep their border at rest; hover changes only colors,
234
+ preserving `theme.styles.Pagination.Link` border width and style.
235
235
 
236
236
  ## Smaller shared state set
237
237
 
@@ -382,6 +382,38 @@ Adopt Cookbook's Tasty validation preset and register your additional names.
382
382
  See [Linting custom styles](./custom-components.md#linting-custom-styles) for
383
383
  ESLint and oxlint examples.
384
384
 
385
+ ## Reader appearance
386
+
387
+ The Appearance menu stores each reader's color scheme and contrast in one
388
+ `localStorage` entry. Its key and format are a stable contract, so another app
389
+ on the same origin can share the preference with the documentation. A typical
390
+ example is a product site that serves Cookbook under `/docs/`.
391
+
392
+ ```ts
393
+ // localStorage["cookbook-appearance"], stored as JSON
394
+ type CookbookAppearance = {
395
+ theme?: "light" | "dark" | "system";
396
+ contrast?: "normal" | "more" | "system";
397
+ };
398
+ ```
399
+
400
+ A missing or unrecognized field means `"system"`, which follows the reader's
401
+ operating system. Keep any other fields when you write the object:
402
+
403
+ ```ts
404
+ const key = "cookbook-appearance";
405
+ const appearance = JSON.parse(localStorage.getItem(key) ?? "{}") ?? {};
406
+
407
+ localStorage.setItem(key, JSON.stringify({ ...appearance, theme: "dark" }));
408
+ ```
409
+
410
+ Cookbook applies the stored choice before the first paint, as `data-theme` and
411
+ `data-contrast` on `<html>`. Open pages follow changes made in other tabs through
412
+ the `storage` event. Your app can map the same values onto its own attributes.
413
+
414
+ Browsers keep `localStorage` per origin: the scheme, host, and port must all
415
+ match, so a docs subdomain does not share the preference.
416
+
385
417
  ## Static behavior
386
418
 
387
419
  The page content remains readable without client JavaScript. Search, menus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/cookbook",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "description": "Repository-native static documentation for Astro",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -68,8 +68,8 @@
68
68
  "author": "Andrey Yamanov",
69
69
  "license": "MIT",
70
70
  "dependencies": {
71
- "@tenphi/docs": "0.25.2",
72
- "@tenphi/renderer": "0.25.2"
71
+ "@tenphi/docs": "0.25.4",
72
+ "@tenphi/renderer": "0.25.4"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "astro": "^7.3.2"