@tenphi/cookbook 0.23.0 → 0.25.0

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.
@@ -214,7 +214,7 @@ it stays complete when a surface changes.
214
214
 
215
215
  #### Page shell
216
216
 
217
- * `Document`: `All`, `BlockSpacing`, `Body`, `Control`, `Pointer`, `ResponsiveWidth`, `ResponsiveHeight`, `Hidden`, `PrintHidden`, `DesktopBlock`, `DesktopFlex`, `ScreenReaderOnly`, `Strong`, `Link`, `NarrowBlock`, `MobileBlock`, `Code`, `FocusRing`, `CurrentLink`, `SearchOpen`
217
+ * `Document`: `All`, `BlockSpacing`, `Body`, `Control`, `Pointer`, `ResponsiveWidth`, `ResponsiveHeight`, `Hidden`, `PrintHidden`, `DesktopBlock`, `DesktopFlex`, `ScreenReaderOnly`, `RouteAnnouncer`, `Strong`, `Link`, `NarrowBlock`, `MobileBlock`, `Code`, `FocusRing`, `CurrentLink`, `SearchOpen`
218
218
  * `Layout`: `Islands`
219
219
  * `PageFrame`: `MainFrame`, `SidebarFrame`, `Columns`
220
220
  * `MainPane`: None
@@ -49,10 +49,12 @@ rejects the TypeScript 7 API. Runtime compilation and lint parsing are separate.
49
49
 
50
50
  The reference build enforces separate limits for initial page JavaScript,
51
51
  lazy search assets, font files, images, and extracted Tasty CSS. A default guide
52
- currently loads about 9 KB of first-party JavaScript initially; search is lazy.
52
+ currently loads about 22 KB of first-party JavaScript initially (about 10 KB
53
+ gzipped), including Astro's built-in hover prefetching; search and the client
54
+ router remain lazy. The initial JavaScript budget is 24 KiB.
53
55
  The checked reference output contains about 73 KB of fonts, 66 KB of images and
54
- icons, and a 189 KB shared stylesheet. The guide's first-party HTML, CSS, and
55
- initial JavaScript total about 33 KB when gzipped. Actual network transfers vary
56
+ icons, and a 181 KB shared stylesheet. The guide's first-party HTML, CSS, and
57
+ initial JavaScript total about 40 KB when gzipped. Actual network transfers vary
56
58
  with hosting compression and caching. `node scripts/check-reference-budgets.mjs`
57
59
  prints current raw budgets and the gzip estimate; neither includes external
58
60
  analytics.
@@ -21,6 +21,49 @@ navigation: {
21
21
  }
22
22
  ```
23
23
 
24
+ ## Client navigation
25
+
26
+ Internal page links use client navigation over the generated static HTML. The
27
+ router loads when an internal page link is hovered, focused, or clicked, so it
28
+ does not add to the initial page download for readers who stay on one page. The
29
+ current page stays visible while the next page and its styles load, then swaps
30
+ without a full-page fade. Appearance preferences, sidebar expansion choices, and
31
+ desktop sidebar scroll within the same navigation section are preserved. Article
32
+ scroll resets to the top on page changes, including Back and Forward; links with
33
+ fragments still navigate to their heading. The current page and its ancestors
34
+ update from the destination markup. Mobile navigation and other open panels close.
35
+
36
+ Cookbook enables Astro's built-in hover prefetching by default. Hovering over or
37
+ focusing an internal link for about 80 ms downloads the destination HTML in the
38
+ background. Moving across links briefly does not prefetch them, and repeated
39
+ links to the same page share a prefetch. When the browser reports data-saving
40
+ mode or a slow connection, Astro waits for tap intent instead.
41
+
42
+ Prefetching warms the browser's HTTP cache. Static hosting should send cache
43
+ headers such as `Cache-Control` or `ETag` so navigation can reuse the response;
44
+ uncacheable responses may still be downloaded again on click. Browser and private
45
+ session policies can also limit cache reuse. Destination stylesheets remain part
46
+ of the router's preparation before the page swap.
47
+
48
+ Set `prefetch: false` in `astro.config.mjs` to disable page prefetching while
49
+ retaining client navigation. Cookbook preserves any explicit Astro `prefetch`
50
+ configuration, including `prefetchAll: false` for selective prefetching. For a
51
+ single link, use `data-astro-prefetch="false"` to opt out or
52
+ `data-astro-prefetch` to opt in. See [Astro's prefetch guide](https://docs.astro.build/en/guides/prefetch/)
53
+ for the supported strategies.
54
+
55
+ Search keeps its query and loaded engine between pages in the same language,
56
+ and closes when a result is followed. Language changes initialize the translated
57
+ search interface. External links, downloads, modified clicks, and links marked
58
+ `data-astro-reload` keep normal browser behavior. Without JavaScript, page links
59
+ use normal document navigation.
60
+
61
+ Custom browser scripts should attach behavior through custom-element lifecycle
62
+ callbacks or initialize on `astro:page-load`; bundled scripts are not rerun on
63
+ every client navigation. The router and appearance initialization belong to the
64
+ common page shell and remain available with replacement Header, Head, and
65
+ PageFrame components.
66
+
24
67
  ## Search
25
68
 
26
69
  The production build creates a local Pagefind index. Readers can select Search
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/cookbook",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
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.23.0",
72
- "@tenphi/renderer": "0.23.0"
71
+ "@tenphi/docs": "0.25.0",
72
+ "@tenphi/renderer": "0.25.0"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "astro": "^7.3.2"