preact-hashish-router 0.0.2 → 0.0.6
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/package.json +9 -5
- package/src/ErrorRoute.tsx +1 -5
- package/src/Route.tsx +1 -9
- package/src/RouterErrorBoundary.tsx +1 -5
- package/src/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-hashish-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple router for preact",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc -p ./tsconfig.json",
|
|
8
|
-
"format": "prettier --write src --ignore-unknown"
|
|
8
|
+
"format": "prettier --write src --ignore-unknown",
|
|
9
|
+
"prepublishOnly": "npm run build && npm run format",
|
|
10
|
+
"push": "npm version patch && git push",
|
|
11
|
+
"push-minor": "npm version minor && git push",
|
|
12
|
+
"push-major": "npm version major && git push"
|
|
9
13
|
},
|
|
10
14
|
"exports": {
|
|
11
|
-
".": "./
|
|
15
|
+
".": "./index.ts"
|
|
12
16
|
},
|
|
13
17
|
"peerDependencies": {
|
|
14
|
-
"preact": "
|
|
18
|
+
"preact": "^10.26.2"
|
|
15
19
|
},
|
|
16
20
|
"keywords": [
|
|
17
21
|
"preact",
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
"author": "LiasCode",
|
|
26
30
|
"devDependencies": {
|
|
27
31
|
"@preact/preset-vite": "^2.10.1",
|
|
28
|
-
"prettier": "^3.
|
|
32
|
+
"prettier": "^3.5.1",
|
|
29
33
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
30
34
|
"typescript": "^5.7.3",
|
|
31
35
|
"vite": "^6.1.0"
|
package/src/ErrorRoute.tsx
CHANGED
|
@@ -7,11 +7,7 @@ export function ErrorRoute(props: PropsWithChildren<{ lazy?: boolean }>) {
|
|
|
7
7
|
if (router.itMatch) return null;
|
|
8
8
|
|
|
9
9
|
if (props.lazy) {
|
|
10
|
-
return
|
|
11
|
-
<Suspense fallback={<div className="flex flex-row w-full items-center justify-center h-fit">Loading...</div>}>
|
|
12
|
-
{props.children}
|
|
13
|
-
</Suspense>
|
|
14
|
-
);
|
|
10
|
+
return <Suspense fallback={<div>Loading...</div>}>{props.children}</Suspense>;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
return props.children;
|
package/src/Route.tsx
CHANGED
|
@@ -20,15 +20,7 @@ export function Route(props: RouteProps) {
|
|
|
20
20
|
router.setItMatch(true);
|
|
21
21
|
|
|
22
22
|
if (props.lazy) {
|
|
23
|
-
return
|
|
24
|
-
<Suspense
|
|
25
|
-
fallback={
|
|
26
|
-
props.fallback ?? <div className="flex flex-row w-full items-center justify-center h-fit">Loading...</div>
|
|
27
|
-
}
|
|
28
|
-
>
|
|
29
|
-
{props.children}
|
|
30
|
-
</Suspense>
|
|
31
|
-
);
|
|
23
|
+
return <Suspense fallback={props.fallback ?? <div>Loading...</div>}>{props.children}</Suspense>;
|
|
32
24
|
}
|
|
33
25
|
|
|
34
26
|
return props.children;
|
|
@@ -17,11 +17,7 @@ export class RouterErrorBoundary extends Component<PropsWithChildren & { fallbac
|
|
|
17
17
|
if (this.state.error) {
|
|
18
18
|
if (this.props.fallback) return this.props.fallback;
|
|
19
19
|
|
|
20
|
-
return
|
|
21
|
-
<p className="flex flex-row justify-center items-center w-full h-fit text-red-500 font-bold text-pretty">
|
|
22
|
-
Oh no! We ran into an error: {this.state.error}
|
|
23
|
-
</p>
|
|
24
|
-
);
|
|
20
|
+
return <p>Oh no! We ran into an error: {this.state.error}</p>;
|
|
25
21
|
}
|
|
26
22
|
return this.props.children;
|
|
27
23
|
}
|