what-router 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "what-router",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "What Framework - File-based & programmatic router with View Transitions",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -26,7 +26,7 @@
26
26
  "author": "",
27
27
  "license": "MIT",
28
28
  "peerDependencies": {
29
- "what-core": "^0.3.0"
29
+ "what-core": "^0.4.0"
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",
package/src/index.js CHANGED
@@ -261,7 +261,10 @@ export function Link({
261
261
  ...rest
262
262
  }) {
263
263
  const currentPath = route.path;
264
- const isActive = currentPath.startsWith(href);
264
+ // Segment-boundary matching: '/blog' matches '/blog/123' but not '/blog-archive'
265
+ const isActive = href === '/'
266
+ ? currentPath === '/'
267
+ : currentPath === href || currentPath.startsWith(href + '/');
265
268
  const isExactActive = currentPath === href;
266
269
 
267
270
  const classes = [