solid-navigator 0.3.8 → 0.3.10
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 +7 -3
- package/dist/dev.jsx +5 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -3
- package/dist/index.jsx +5 -4
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -174,7 +174,8 @@ function Router(props) {
|
|
|
174
174
|
return;
|
|
175
175
|
event.preventDefault();
|
|
176
176
|
navigate(href, {
|
|
177
|
-
replace: target.hasAttribute("replace")
|
|
177
|
+
replace: target.hasAttribute("replace"),
|
|
178
|
+
state: JSON.parse(target.getAttribute("d-state") || "null")
|
|
178
179
|
});
|
|
179
180
|
};
|
|
180
181
|
delegateEvents(["click"]);
|
|
@@ -285,9 +286,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
285
286
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
286
287
|
}
|
|
287
288
|
if (options?.replace) {
|
|
288
|
-
history.replaceState(options.
|
|
289
|
+
history.replaceState(options.state || null, "", newPath);
|
|
289
290
|
} else {
|
|
290
|
-
history.pushState(options?.
|
|
291
|
+
history.pushState(options?.state || null, "", newPath);
|
|
291
292
|
}
|
|
292
293
|
if (!isValidPath(routes, location.pathname)) {
|
|
293
294
|
console.warn("Invalid path: " + path);
|
|
@@ -388,6 +389,9 @@ var A = (props) => {
|
|
|
388
389
|
return (() => {
|
|
389
390
|
var _el$ = _tmpl$();
|
|
390
391
|
spread(_el$, mergeProps$1(props, {
|
|
392
|
+
get ["d-state"]() {
|
|
393
|
+
return JSON.stringify(props.state);
|
|
394
|
+
},
|
|
391
395
|
get href() {
|
|
392
396
|
return resolvedHref();
|
|
393
397
|
}
|
package/dist/dev.jsx
CHANGED
|
@@ -185,7 +185,8 @@ function Router(props) {
|
|
|
185
185
|
return;
|
|
186
186
|
event.preventDefault();
|
|
187
187
|
navigate(href, {
|
|
188
|
-
replace: target.hasAttribute("replace")
|
|
188
|
+
replace: target.hasAttribute("replace"),
|
|
189
|
+
state: JSON.parse(target.getAttribute("d-state") || "null")
|
|
189
190
|
});
|
|
190
191
|
};
|
|
191
192
|
delegateEvents(["click"]);
|
|
@@ -291,9 +292,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
291
292
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
292
293
|
}
|
|
293
294
|
if (options?.replace) {
|
|
294
|
-
history.replaceState(options.
|
|
295
|
+
history.replaceState(options.state || null, "", newPath);
|
|
295
296
|
} else {
|
|
296
|
-
history.pushState(options?.
|
|
297
|
+
history.pushState(options?.state || null, "", newPath);
|
|
297
298
|
}
|
|
298
299
|
if (!isValidPath(routes, location.pathname)) {
|
|
299
300
|
console.warn("Invalid path: " + path);
|
|
@@ -399,7 +400,7 @@ var A = (props) => {
|
|
|
399
400
|
}
|
|
400
401
|
return newPath;
|
|
401
402
|
};
|
|
402
|
-
return <a sn-link {...props} href={resolvedHref()} />;
|
|
403
|
+
return <a sn-link {...props} d-state={JSON.stringify(props.state)} href={resolvedHref()} />;
|
|
403
404
|
};
|
|
404
405
|
var useMatch = (path) => {
|
|
405
406
|
const location2 = useLocation();
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare const matchComponent: (name: () => string) => () => Component;
|
|
|
14
14
|
|
|
15
15
|
interface NavigateOptions {
|
|
16
16
|
replace?: boolean;
|
|
17
|
-
|
|
17
|
+
state?: any;
|
|
18
18
|
}
|
|
19
19
|
declare const useNavigate: () => (path: string, options?: NavigateOptions | undefined) => void;
|
|
20
20
|
declare const Navigate: (props: {
|
|
@@ -49,6 +49,7 @@ declare const useLocation: () => {
|
|
|
49
49
|
|
|
50
50
|
type LinkProps = {
|
|
51
51
|
replace?: boolean;
|
|
52
|
+
state?: any;
|
|
52
53
|
} & JSX.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
53
54
|
declare const A: (props: LinkProps) => JSX.Element;
|
|
54
55
|
declare const useMatch: (path: () => string) => solid_js.Accessor<PathMatch | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -174,7 +174,8 @@ function Router(props) {
|
|
|
174
174
|
return;
|
|
175
175
|
event.preventDefault();
|
|
176
176
|
navigate(href, {
|
|
177
|
-
replace: target.hasAttribute("replace")
|
|
177
|
+
replace: target.hasAttribute("replace"),
|
|
178
|
+
state: JSON.parse(target.getAttribute("d-state") || "null")
|
|
178
179
|
});
|
|
179
180
|
};
|
|
180
181
|
delegateEvents(["click"]);
|
|
@@ -285,9 +286,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
285
286
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
286
287
|
}
|
|
287
288
|
if (options?.replace) {
|
|
288
|
-
history.replaceState(options.
|
|
289
|
+
history.replaceState(options.state || null, "", newPath);
|
|
289
290
|
} else {
|
|
290
|
-
history.pushState(options?.
|
|
291
|
+
history.pushState(options?.state || null, "", newPath);
|
|
291
292
|
}
|
|
292
293
|
if (!isValidPath(routes, location.pathname)) ;
|
|
293
294
|
batch(() => {
|
|
@@ -384,6 +385,9 @@ var A = (props) => {
|
|
|
384
385
|
return (() => {
|
|
385
386
|
var _el$ = _tmpl$();
|
|
386
387
|
spread(_el$, mergeProps$1(props, {
|
|
388
|
+
get ["d-state"]() {
|
|
389
|
+
return JSON.stringify(props.state);
|
|
390
|
+
},
|
|
387
391
|
get href() {
|
|
388
392
|
return resolvedHref();
|
|
389
393
|
}
|
package/dist/index.jsx
CHANGED
|
@@ -185,7 +185,8 @@ function Router(props) {
|
|
|
185
185
|
return;
|
|
186
186
|
event.preventDefault();
|
|
187
187
|
navigate(href, {
|
|
188
|
-
replace: target.hasAttribute("replace")
|
|
188
|
+
replace: target.hasAttribute("replace"),
|
|
189
|
+
state: JSON.parse(target.getAttribute("d-state") || "null")
|
|
189
190
|
});
|
|
190
191
|
};
|
|
191
192
|
delegateEvents(["click"]);
|
|
@@ -291,9 +292,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
|
|
|
291
292
|
newPath = currentPathname + "/" + newPath.slice(2);
|
|
292
293
|
}
|
|
293
294
|
if (options?.replace) {
|
|
294
|
-
history.replaceState(options.
|
|
295
|
+
history.replaceState(options.state || null, "", newPath);
|
|
295
296
|
} else {
|
|
296
|
-
history.pushState(options?.
|
|
297
|
+
history.pushState(options?.state || null, "", newPath);
|
|
297
298
|
}
|
|
298
299
|
if (!isValidPath(routes, location.pathname)) {
|
|
299
300
|
}
|
|
@@ -396,7 +397,7 @@ var A = (props) => {
|
|
|
396
397
|
}
|
|
397
398
|
return newPath;
|
|
398
399
|
};
|
|
399
|
-
return <a sn-link {...props} href={resolvedHref()} />;
|
|
400
|
+
return <a sn-link {...props} d-state={JSON.stringify(props.state)} href={resolvedHref()} />;
|
|
400
401
|
};
|
|
401
402
|
var useMatch = (path) => {
|
|
402
403
|
const location2 = useLocation();
|