@toapi/router 1.0.1 → 1.0.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/dist/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/link.js +2 -2
- package/dist/path.d.ts +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +1 -1
- package/dist/route.js +2 -2
- package/dist/router.js +3 -3
- package/dist/switch.d.ts +1 -1
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +2 -2
- package/dist/use-hash.js +1 -1
- package/dist/use-params.js +1 -1
- package/dist/use-pathname.js +1 -1
- package/dist/use-router.d.ts +1 -1
- package/dist/use-router.d.ts.map +1 -1
- package/dist/use-router.js +2 -2
- package/dist/use-search-params.d.ts +1 -1
- package/dist/use-search-params.d.ts.map +1 -1
- package/dist/use-search-params.js +1 -1
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImmutableSearchParams } from "./immutable-search-params";
|
|
1
|
+
import { ImmutableSearchParams } from "./immutable-search-params.js";
|
|
2
2
|
export declare const PathnameContext: import("react").Context<string>;
|
|
3
3
|
export declare const SearchParamsContext: import("react").Context<ImmutableSearchParams>;
|
|
4
4
|
export declare const HashContext: import("react").Context<string>;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,eAAO,MAAM,eAAe,iCAA6B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,gDAE/B,CAAC;AAEF,eAAO,MAAM,WAAW,iCAA4B,CAAC;AAErD,eAAO,MAAM,aAAa;UAClB,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;aACnB,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;EAI/B,CAAC;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,4CAIvB,CAAC"}
|
package/dist/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
import { ImmutableSearchParams } from "./immutable-search-params";
|
|
2
|
+
import { ImmutableSearchParams } from "./immutable-search-params.js";
|
|
3
3
|
export const PathnameContext = createContext("/");
|
|
4
4
|
export const SearchParamsContext = createContext(new ImmutableSearchParams());
|
|
5
5
|
export const HashContext = createContext("");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { Router } from "./router";
|
|
2
|
-
export { Route } from "./route";
|
|
3
|
-
export { Link } from "./link";
|
|
4
|
-
export { useRouter } from "./use-router";
|
|
5
|
-
export { usePathname } from "./use-pathname";
|
|
6
|
-
export { useSearchParams } from "./use-search-params";
|
|
7
|
-
export { useHash } from "./use-hash";
|
|
8
|
-
export { useParams } from "./use-params";
|
|
9
|
-
export { Switch } from "./switch";
|
|
1
|
+
export { Router } from "./router.js";
|
|
2
|
+
export { Route } from "./route.js";
|
|
3
|
+
export { Link } from "./link.js";
|
|
4
|
+
export { useRouter } from "./use-router.js";
|
|
5
|
+
export { usePathname } from "./use-pathname.js";
|
|
6
|
+
export { useSearchParams } from "./use-search-params.js";
|
|
7
|
+
export { useHash } from "./use-hash.js";
|
|
8
|
+
export { useParams } from "./use-params.js";
|
|
9
|
+
export { Switch } from "./switch.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Router } from "./router";
|
|
2
|
-
export { Route } from "./route";
|
|
3
|
-
export { Link } from "./link";
|
|
4
|
-
export { useRouter } from "./use-router";
|
|
5
|
-
export { usePathname } from "./use-pathname";
|
|
6
|
-
export { useSearchParams } from "./use-search-params";
|
|
7
|
-
export { useHash } from "./use-hash";
|
|
8
|
-
export { useParams } from "./use-params";
|
|
9
|
-
export { Switch } from "./switch";
|
|
1
|
+
export { Router } from "./router.js";
|
|
2
|
+
export { Route } from "./route.js";
|
|
3
|
+
export { Link } from "./link.js";
|
|
4
|
+
export { useRouter } from "./use-router.js";
|
|
5
|
+
export { usePathname } from "./use-pathname.js";
|
|
6
|
+
export { useSearchParams } from "./use-search-params.js";
|
|
7
|
+
export { useHash } from "./use-hash.js";
|
|
8
|
+
export { useParams } from "./use-params.js";
|
|
9
|
+
export { Switch } from "./switch.js";
|
package/dist/link.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { use, useMemo } from "react";
|
|
3
|
-
import { PathnameContext, RouteContext, RouterContext, SearchParamsContext, } from "./context";
|
|
4
|
-
import { resolve } from "./path";
|
|
3
|
+
import { PathnameContext, RouteContext, RouterContext, SearchParamsContext, } from "./context.js";
|
|
4
|
+
import { resolve } from "./path.js";
|
|
5
5
|
export function Link({ href, replace, children, onClick, ...rawProps }) {
|
|
6
6
|
const { matchedPathname: parentPathname } = use(RouteContext);
|
|
7
7
|
const router = use(RouterContext);
|
package/dist/path.d.ts
CHANGED
package/dist/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,OAAO,UAepD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBrD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU1D;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,UAa9D"}
|
package/dist/path.js
CHANGED
package/dist/route.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { use, useMemo } from "react";
|
|
3
|
-
import { PathnameContext, RouteContext } from "./context";
|
|
4
|
-
import { buildFullPath, compileExactPathRegex, compilePathRegex } from "./path";
|
|
3
|
+
import { PathnameContext, RouteContext } from "./context.js";
|
|
4
|
+
import { buildFullPath, compileExactPathRegex, compilePathRegex } from "./path.js";
|
|
5
5
|
export function Route({ path, exact, children }) {
|
|
6
6
|
const parentRoute = use(RouteContext);
|
|
7
7
|
const pathname = use(PathnameContext);
|
package/dist/router.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { startTransition, useEffect, useMemo, useState } from "react";
|
|
3
|
-
import { HashContext, PathnameContext, RouterContext, SearchParamsContext, } from "./context";
|
|
4
|
-
import { ImmutableSearchParams } from "./immutable-search-params";
|
|
5
|
-
import { removeTrailingSlash } from "./path";
|
|
3
|
+
import { HashContext, PathnameContext, RouterContext, SearchParamsContext, } from "./context.js";
|
|
4
|
+
import { ImmutableSearchParams } from "./immutable-search-params.js";
|
|
5
|
+
import { removeTrailingSlash } from "./path.js";
|
|
6
6
|
export function Router({ history = window.history, location = window.location, children, }) {
|
|
7
7
|
const [pathname, setPathname] = useState(removeTrailingSlash(location.pathname));
|
|
8
8
|
const [searchParams, setSearchParams] = useState(new ImmutableSearchParams(location.search));
|
package/dist/switch.d.ts
CHANGED
package/dist/switch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../src/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../src/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQpD,UAAU,KAAK;IACb,QAAQ,EACJ,YAAY,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,GACtC,YAAY,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,EAAE,CAAC;CAC9C;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,sCAmDzC"}
|
package/dist/switch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Children, use, useMemo } from "react";
|
|
3
|
-
import { PathnameContext, RouteContext, } from "./context";
|
|
4
|
-
import { buildFullPath, compileExactPathRegex, compilePathRegex } from "./path";
|
|
3
|
+
import { PathnameContext, RouteContext, } from "./context.js";
|
|
4
|
+
import { buildFullPath, compileExactPathRegex, compilePathRegex } from "./path.js";
|
|
5
5
|
export function Switch({ children }) {
|
|
6
6
|
const parentRoute = use(RouteContext);
|
|
7
7
|
const pathname = use(PathnameContext);
|
package/dist/use-hash.js
CHANGED
package/dist/use-params.js
CHANGED
package/dist/use-pathname.js
CHANGED
package/dist/use-router.d.ts
CHANGED
package/dist/use-router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-router.d.ts","sourceRoot":"","sources":["../src/use-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,OAAO,CAAC;AACvD,OAAO,EAGL,aAAa,EAEd,MAAM,
|
|
1
|
+
{"version":3,"file":"use-router.d.ts","sourceRoot":"","sources":["../src/use-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,OAAO,CAAC;AACvD,OAAO,EAGL,aAAa,EAEd,MAAM,cAAc,CAAC;AAGtB,wBAAgB,SAAS,IAAI,WAAW,CAAC,OAAO,aAAa,CAAC,CA6B7D"}
|
package/dist/use-router.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { use, useMemo } from "react";
|
|
2
|
-
import { PathnameContext, RouteContext, RouterContext, SearchParamsContext, } from "./context";
|
|
3
|
-
import { resolve } from "./path";
|
|
2
|
+
import { PathnameContext, RouteContext, RouterContext, SearchParamsContext, } from "./context.js";
|
|
3
|
+
import { resolve } from "./path.js";
|
|
4
4
|
export function useRouter() {
|
|
5
5
|
const { push, replace } = use(RouterContext);
|
|
6
6
|
const { matchedPathname: parentPathname } = use(RouteContext);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useSearchParams(): import("./immutable-search-params").ImmutableSearchParams;
|
|
1
|
+
export declare function useSearchParams(): import("./immutable-search-params.js").ImmutableSearchParams;
|
|
2
2
|
//# sourceMappingURL=use-search-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search-params.d.ts","sourceRoot":"","sources":["../src/use-search-params.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"use-search-params.d.ts","sourceRoot":"","sources":["../src/use-search-params.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,iEAE9B"}
|