aaex-file-router 1.7.4 → 1.7.5
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A file-based routing system for React projects that automatically generates routes from your file structure. Similar to Next.js App Router or Remix file conventions.
|
|
4
4
|
|
|
5
|
-
## V. 1.7.
|
|
5
|
+
## V. 1.7.5
|
|
6
6
|
Removed the 404 and root layout support since it was implemented wrong and broke
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
interface FileLinkProps<RouteType extends string = string> {
|
|
2
|
+
interface FileLinkProps<RouteType extends string = string> extends React.PropsWithChildren {
|
|
3
3
|
to: RouteType;
|
|
4
|
-
|
|
4
|
+
activeClassName?: string;
|
|
5
|
+
className?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function FileLink<RouteType extends string = string>({ to, children, }: FileLinkProps<RouteType>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function FileLink<RouteType extends string = string>({ to, children, activeClassName, className, }: FileLinkProps<RouteType>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=FileLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileLink.d.ts","sourceRoot":"","sources":["../../src/components/FileLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,aAAa,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"FileLink.d.ts","sourceRoot":"","sources":["../../src/components/FileLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,aAAa,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,CACvD,SAAQ,KAAK,CAAC,iBAAiB;IAC/B,EAAE,EAAE,SAAS,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,EAC1D,EAAE,EACF,QAAQ,EACR,eAA0B,EAC1B,SAAc,GACf,EAAE,aAAa,CAAC,SAAS,CAAC,2CAmB1B"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Link } from "react-router-dom";
|
|
3
|
-
export function FileLink({ to, children, }) {
|
|
2
|
+
import { Link, useLocation } from "react-router-dom";
|
|
3
|
+
export function FileLink({ to, children, activeClassName = "active", className = "", }) {
|
|
4
4
|
const isServer = typeof window === "undefined";
|
|
5
5
|
if (isServer) {
|
|
6
|
-
//
|
|
6
|
+
// SSR fallback
|
|
7
7
|
return _jsx("a", { href: to, children: children });
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const location = useLocation();
|
|
10
|
+
const isActive = location.pathname === to;
|
|
11
|
+
return (_jsx(Link, { to: to, className: `${className} ${isActive ? activeClassName : ""}`.trim(), children: children }));
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=FileLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileLink.js","sourceRoot":"","sources":["../../src/components/FileLink.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileLink.js","sourceRoot":"","sources":["../../src/components/FileLink.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AASrD,MAAM,UAAU,QAAQ,CAAoC,EAC1D,EAAE,EACF,QAAQ,EACR,eAAe,GAAG,QAAQ,EAC1B,SAAS,GAAG,EAAE,GACW;IACzB,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IAE/C,IAAI,QAAQ,EAAE,CAAC;QACb,eAAe;QACf,OAAO,YAAG,IAAI,EAAE,EAAY,YAAG,QAAQ,GAAK,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,KAAK,EAAE,CAAC;IAE1C,OAAO,CACL,KAAC,IAAI,IACH,EAAE,EAAE,EAAY,EAChB,SAAS,EAAE,GAAG,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,YAElE,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aaex-file-router",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "A file-based routing system for React projects that automatically generates routes from your file structure. Similar to Next.js App Router or Remix file conventions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|