page-transition 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -10,7 +10,7 @@ A page transition library for the Next.js App Router.
10
10
  - Scroll restoration
11
11
 
12
12
  ## Install
13
- ![Version](https://img.shields.io/badge/v0.2.0-000000) ![86.1 KB](https://img.shields.io/badge/86.1_KB-1677FF)
13
+ ![Version](https://img.shields.io/badge/v0.2.2-000000) ![86.3 KB](https://img.shields.io/badge/86.3_KB-1677FF)
14
14
 
15
15
  `npm install page-transition`
16
16
 
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, useContext, useEffect, useRef } from "react";
3
+ import { createContext, useContext, useEffect, useRef, } from "react";
4
4
  const ActiveLinkContext = createContext(null);
5
5
  export function useActiveLinkContext() {
6
6
  const context = useContext(ActiveLinkContext);
@@ -21,6 +21,9 @@ export function ActiveLinkProvider({ children }) {
21
21
  if (ref) {
22
22
  element = ref;
23
23
  map.current.set(ref, href);
24
+ for (const [el, href] of map.current) {
25
+ el.classList.toggle('active', href === pathname);
26
+ }
24
27
  }
25
28
  if (!ref)
26
29
  map.current.delete(element);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "page-transition",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A page transition library for the Next.js App Router.",
5
5
  "license": "MIT",
6
6
  "files": [