@solidjs/router 0.13.1 → 0.13.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/data/cache.d.ts +3 -1
- package/dist/data/events.js +2 -0
- package/dist/index.js +10 -6
- package/dist/routers/MemoryRouter.js +6 -3
- package/dist/routing.js +3 -3
- package/package.json +1 -1
package/dist/data/cache.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CacheEntry } from "../types.js";
|
|
2
2
|
export declare function revalidate(key?: string | string[] | void, force?: boolean): Promise<void>;
|
|
3
3
|
export declare function cacheKeyOp(key: string | string[] | void, fn: (cacheEntry: CacheEntry) => void): void;
|
|
4
|
-
export type CachedFunction<T extends (...args: any) => any> = T extends (...args: infer A) => infer R ? ([] extends
|
|
4
|
+
export type CachedFunction<T extends (...args: any) => any> = T extends (...args: infer A) => infer R ? ([] extends {
|
|
5
|
+
[K in keyof A]-?: A[K];
|
|
6
|
+
} ? (...args: never[]) => R : T) & {
|
|
5
7
|
keyFor: (...args: A) => string;
|
|
6
8
|
key: string;
|
|
7
9
|
} : never;
|
package/dist/data/events.js
CHANGED
|
@@ -83,6 +83,8 @@ export function setupNativeEvents(preload = true, explicitLinks = false, actionB
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
function handleFormSubmit(evt) {
|
|
86
|
+
if (evt.defaultPrevented)
|
|
87
|
+
return;
|
|
86
88
|
let actionRef = evt.submitter && evt.submitter.hasAttribute("formaction")
|
|
87
89
|
? evt.submitter.getAttribute("formaction")
|
|
88
90
|
: evt.target.getAttribute("action");
|
package/dist/index.js
CHANGED
|
@@ -292,9 +292,9 @@ function createRoutes(routeDef, base = "") {
|
|
|
292
292
|
load,
|
|
293
293
|
info
|
|
294
294
|
};
|
|
295
|
-
return asArray(routeDef.path).reduce((acc,
|
|
296
|
-
for (const
|
|
297
|
-
const path = joinPaths(base,
|
|
295
|
+
return asArray(routeDef.path).reduce((acc, originalPath) => {
|
|
296
|
+
for (const expandedPath of expandOptionals(originalPath)) {
|
|
297
|
+
const path = joinPaths(base, expandedPath);
|
|
298
298
|
let pattern = isLeaf ? path : path.split("/*", 1)[0];
|
|
299
299
|
pattern = pattern.split("/").map(s => {
|
|
300
300
|
return s.startsWith(":") || s.startsWith("*") ? s : encodeURIComponent(s);
|
|
@@ -1231,6 +1231,7 @@ function setupNativeEvents(preload = true, explicitLinks = false, actionBase = "
|
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
function handleFormSubmit(evt) {
|
|
1234
|
+
if (evt.defaultPrevented) return;
|
|
1234
1235
|
let actionRef = evt.submitter && evt.submitter.hasAttribute("formaction") ? evt.submitter.getAttribute("formaction") : evt.target.getAttribute("action");
|
|
1235
1236
|
if (!actionRef) return;
|
|
1236
1237
|
if (!actionRef.startsWith("https://action/")) {
|
|
@@ -1382,9 +1383,12 @@ function createMemoryHistory() {
|
|
|
1382
1383
|
entries.splice(index + 1, entries.length - index, value);
|
|
1383
1384
|
index++;
|
|
1384
1385
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1386
|
+
listeners.forEach(listener => listener(value));
|
|
1387
|
+
setTimeout(() => {
|
|
1388
|
+
if (scroll) {
|
|
1389
|
+
scrollToHash(value.split("#")[1] || "", true);
|
|
1390
|
+
}
|
|
1391
|
+
}, 0);
|
|
1388
1392
|
},
|
|
1389
1393
|
back: () => {
|
|
1390
1394
|
go(-1);
|
|
@@ -20,9 +20,12 @@ export function createMemoryHistory() {
|
|
|
20
20
|
entries.splice(index + 1, entries.length - index, value);
|
|
21
21
|
index++;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
listeners.forEach(listener => listener(value));
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
if (scroll) {
|
|
26
|
+
scrollToHash(value.split("#")[1] || "", true);
|
|
27
|
+
}
|
|
28
|
+
}, 0);
|
|
26
29
|
},
|
|
27
30
|
back: () => {
|
|
28
31
|
go(-1);
|
package/dist/routing.js
CHANGED
|
@@ -65,9 +65,9 @@ export function createRoutes(routeDef, base = "") {
|
|
|
65
65
|
load,
|
|
66
66
|
info
|
|
67
67
|
};
|
|
68
|
-
return asArray(routeDef.path).reduce((acc,
|
|
69
|
-
for (const
|
|
70
|
-
const path = joinPaths(base,
|
|
68
|
+
return asArray(routeDef.path).reduce((acc, originalPath) => {
|
|
69
|
+
for (const expandedPath of expandOptionals(originalPath)) {
|
|
70
|
+
const path = joinPaths(base, expandedPath);
|
|
71
71
|
let pattern = isLeaf ? path : path.split("/*", 1)[0];
|
|
72
72
|
pattern = pattern
|
|
73
73
|
.split("/")
|