You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7201fa3
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: ai/integrations.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ If this page and the code are not enough to build on, the seam is wrong and not
18
18
|---|---|---|
19
19
|`Router`| the platform, the page, the cascade (guards, data, titles), the route lifecycle, the settings. Nothing of a route's, nothing of a view's. `router.root` is the root route |`packages/nav-router/src/router.js`|
20
20
|`Route`| its data slice, its active life (an abort signal), its reactive runs, and what it shows under `rendered`|`packages/nav-router/src/route.js`|
21
-
| a plugin | nothing. `Router.extend(plugin, options)`calls `plugin(options, Router, Navigator)` once; a plugin wraps a moment on a prototype and calls through|`packages/nav-router/src/plugins/*`|
21
+
| a plugin | nothing. `import 'nav-router/plugins/x'` is the install, as a custom element's definition is: the module patches a moment on `Router.prototype` or `Navigator.prototype` once, at evaluation, and calls through; its options are the router's, declared on `Router.defaults` and read from `config`. Options are flat, each word qualified enough to stand alone in `router({...})`; a plugin that wants a namespace declares one object-valued key and merges what it is passed over its own defaults itself, since the router's merge is shallow|`packages/nav-router/src/plugins/*`|
22
22
| the dom plugin | the native how for the three seams. The reference implementation of this page |`packages/nav-router/src/plugins/dom.js`|
23
23
|`ReactiveRouter`| the scaffold a reactive integration extends: the five primitives, slices as per-key stores, hooks in reactions |`packages/nav-router/src/reactive-router.js`|
24
24
| an integration | a class extending `Router` or `ReactiveRouter` that fills the seams, in its own package |`@nav-router/<name>`|
Copy file name to clipboardExpand all lines: docs/src/content/docs/plugins/head.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,29 +2,29 @@
2
2
title: head
3
3
kind: plugin
4
4
lede: Writes each page’s title, meta tags and canonical link into `document.head`, merged down the routes that are active.
5
-
import: import head from 'nav-router/plugins/head'
5
+
import: import 'nav-router/plugins/head'
6
6
size: head
7
7
updated: 2026-11-05
8
8
---
9
9
10
10
## Install
11
11
12
-
Extend the router once, before it starts. A plugin wraps one moment in the router and calls through, so installing it changes nothing else.
12
+
Import the plugin once. A plugin wraps one moment in the router and calls through, so importing it changes nothing else, and its options are the router's own.
13
13
14
14
```js title="app.js"
15
-
import{ Router } from'nav-router';
16
-
importheadfrom'nav-router/plugins/head';
15
+
import'nav-router/plugins/head';
16
+
import{ router } from'nav-router';
17
17
18
-
Router.extend(head, {
18
+
constapp=router({
19
19
formatTitle: (title) =>`${title} · Acme`,
20
+
// the routes
20
21
});
21
22
```
22
23
23
24
## Options
24
25
25
26
| Option | Type | Default | Description |
26
27
|---|---|---|---|
27
-
|`defaults`|`object`|`{}`| Tags every page starts from, before routes add theirs. |
28
28
|`formatTitle`|`function`|`null`| Turns a route’s title into the document title. |
<p>Like day.js, the core does one job and plugins add the rest. Each one wraps a single moment in the router and calls through, so you only ship what you install.</p>
256
256
<divclass="code">
257
257
<predata-hl>
258
-
import { Router } from 'nav-router';
259
-
import head from 'nav-router/plugins/head';
260
-
import viewTransitions from 'nav-router/plugins/view-transitions';
261
-
262
-
Router.extend(head);
263
-
Router.extend(viewTransitions);
258
+
import 'nav-router/plugins/head';
259
+
import 'nav-router/plugins/view-transitions';
264
260
</pre>
265
261
</div>
266
262
<aclass="text-link" href="#">Browse all plugins</a>
0 commit comments