solid-navigator 0.3.7 → 0.3.8
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/dev.js +6 -2
- package/dist/dev.jsx +6 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/dist/index.jsx +6 -2
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -74,6 +74,7 @@ var createLocation = (path, query, setQuery) => {
|
|
|
74
74
|
const search = createMemo(() => url().search);
|
|
75
75
|
const pathname = createMemo(() => url().pathname);
|
|
76
76
|
const hash = createMemo(() => url().hash);
|
|
77
|
+
const state = createMemo(on([hash, pathname, search], () => history.state));
|
|
77
78
|
return {
|
|
78
79
|
query,
|
|
79
80
|
get search() {
|
|
@@ -84,6 +85,9 @@ var createLocation = (path, query, setQuery) => {
|
|
|
84
85
|
},
|
|
85
86
|
get hash() {
|
|
86
87
|
return hash();
|
|
88
|
+
},
|
|
89
|
+
get state() {
|
|
90
|
+
return state();
|
|
87
91
|
}
|
|
88
92
|
};
|
|
89
93
|
};
|
|
@@ -281,9 +285,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
281
285
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
282
286
|
}
|
|
283
287
|
if (options?.replace) {
|
|
284
|
-
history.replaceState(
|
|
288
|
+
history.replaceState(options.data || null, "", newPath);
|
|
285
289
|
} else {
|
|
286
|
-
history.pushState(
|
|
290
|
+
history.pushState(options?.data || null, "", newPath);
|
|
287
291
|
}
|
|
288
292
|
if (!isValidPath(routes, location.pathname)) {
|
|
289
293
|
console.warn("Invalid path: " + path);
|
package/dist/dev.jsx
CHANGED
|
@@ -88,6 +88,7 @@ var createLocation = (path, query, setQuery) => {
|
|
|
88
88
|
const search = createMemo(() => url().search);
|
|
89
89
|
const pathname = createMemo(() => url().pathname);
|
|
90
90
|
const hash = createMemo(() => url().hash);
|
|
91
|
+
const state = createMemo(on([hash, pathname, search], () => history.state));
|
|
91
92
|
return {
|
|
92
93
|
query,
|
|
93
94
|
get search() {
|
|
@@ -98,6 +99,9 @@ var createLocation = (path, query, setQuery) => {
|
|
|
98
99
|
},
|
|
99
100
|
get hash() {
|
|
100
101
|
return hash();
|
|
102
|
+
},
|
|
103
|
+
get state() {
|
|
104
|
+
return state();
|
|
101
105
|
}
|
|
102
106
|
};
|
|
103
107
|
};
|
|
@@ -287,9 +291,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
287
291
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
288
292
|
}
|
|
289
293
|
if (options?.replace) {
|
|
290
|
-
history.replaceState(
|
|
294
|
+
history.replaceState(options.data || null, "", newPath);
|
|
291
295
|
} else {
|
|
292
|
-
history.pushState(
|
|
296
|
+
history.pushState(options?.data || null, "", newPath);
|
|
293
297
|
}
|
|
294
298
|
if (!isValidPath(routes, location.pathname)) {
|
|
295
299
|
console.warn("Invalid path: " + path);
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const matchComponent: (name: () => string) => () => Component;
|
|
|
14
14
|
|
|
15
15
|
interface NavigateOptions {
|
|
16
16
|
replace?: boolean;
|
|
17
|
+
data?: any;
|
|
17
18
|
}
|
|
18
19
|
declare const useNavigate: () => (path: string, options?: NavigateOptions | undefined) => void;
|
|
19
20
|
declare const Navigate: (props: {
|
|
@@ -43,6 +44,7 @@ declare const useLocation: () => {
|
|
|
43
44
|
readonly search: string;
|
|
44
45
|
readonly pathname: string;
|
|
45
46
|
readonly hash: string;
|
|
47
|
+
readonly state: any;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
type LinkProps = {
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ var createLocation = (path, query, setQuery) => {
|
|
|
74
74
|
const search = createMemo(() => url().search);
|
|
75
75
|
const pathname = createMemo(() => url().pathname);
|
|
76
76
|
const hash = createMemo(() => url().hash);
|
|
77
|
+
const state = createMemo(on([hash, pathname, search], () => history.state));
|
|
77
78
|
return {
|
|
78
79
|
query,
|
|
79
80
|
get search() {
|
|
@@ -84,6 +85,9 @@ var createLocation = (path, query, setQuery) => {
|
|
|
84
85
|
},
|
|
85
86
|
get hash() {
|
|
86
87
|
return hash();
|
|
88
|
+
},
|
|
89
|
+
get state() {
|
|
90
|
+
return state();
|
|
87
91
|
}
|
|
88
92
|
};
|
|
89
93
|
};
|
|
@@ -281,9 +285,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
281
285
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
282
286
|
}
|
|
283
287
|
if (options?.replace) {
|
|
284
|
-
history.replaceState(
|
|
288
|
+
history.replaceState(options.data || null, "", newPath);
|
|
285
289
|
} else {
|
|
286
|
-
history.pushState(
|
|
290
|
+
history.pushState(options?.data || null, "", newPath);
|
|
287
291
|
}
|
|
288
292
|
if (!isValidPath(routes, location.pathname)) ;
|
|
289
293
|
batch(() => {
|
package/dist/index.jsx
CHANGED
|
@@ -88,6 +88,7 @@ var createLocation = (path, query, setQuery) => {
|
|
|
88
88
|
const search = createMemo(() => url().search);
|
|
89
89
|
const pathname = createMemo(() => url().pathname);
|
|
90
90
|
const hash = createMemo(() => url().hash);
|
|
91
|
+
const state = createMemo(on([hash, pathname, search], () => history.state));
|
|
91
92
|
return {
|
|
92
93
|
query,
|
|
93
94
|
get search() {
|
|
@@ -98,6 +99,9 @@ var createLocation = (path, query, setQuery) => {
|
|
|
98
99
|
},
|
|
99
100
|
get hash() {
|
|
100
101
|
return hash();
|
|
102
|
+
},
|
|
103
|
+
get state() {
|
|
104
|
+
return state();
|
|
101
105
|
}
|
|
102
106
|
};
|
|
103
107
|
};
|
|
@@ -287,9 +291,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
287
291
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
288
292
|
}
|
|
289
293
|
if (options?.replace) {
|
|
290
|
-
history.replaceState(
|
|
294
|
+
history.replaceState(options.data || null, "", newPath);
|
|
291
295
|
} else {
|
|
292
|
-
history.pushState(
|
|
296
|
+
history.pushState(options?.data || null, "", newPath);
|
|
293
297
|
}
|
|
294
298
|
if (!isValidPath(routes, location.pathname)) {
|
|
295
299
|
}
|