svelte-spa-history-router 2.1.2 → 2.2.0-next.0
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/README.md +5 -0
- package/{example → examples/app-svelte4}/dist/Article.js +11 -11
- package/examples/app-svelte4/dist/Article.js.map +1 -0
- package/{example → examples/app-svelte4}/dist/Login.js +8 -8
- package/examples/app-svelte4/dist/Login.js.map +1 -0
- package/{example → examples/app-svelte4}/dist/Query.js +16 -39
- package/examples/app-svelte4/dist/Query.js.map +1 -0
- package/{example → examples/app-svelte4}/dist/main2.js +148 -116
- package/examples/app-svelte4/dist/main2.js.map +1 -0
- package/examples/app-svelte4/package-lock.json +776 -0
- package/examples/app-svelte4/package.json +23 -0
- package/{example → examples/app-svelte4}/rollup.config.js +25 -2
- package/examples/app-svelte4/server.js +115 -0
- package/{example → examples/app-svelte4/src}/App.svelte +9 -5
- package/{example → examples/app-svelte4/src}/Article.svelte +1 -2
- package/{example → examples/app-svelte4/src}/Home.svelte +1 -2
- package/{example → examples/app-svelte4/src}/Login.svelte +1 -1
- package/{example → examples/app-svelte4/src}/Query.svelte +2 -3
- package/{example → examples/app-svelte4/src}/data-source.js +7 -0
- package/examples/app-svelte4/src/store.js +11 -0
- package/examples/app-svelte5/index.html +14 -0
- package/examples/app-svelte5/jsconfig.json +17 -0
- package/examples/app-svelte5/package-lock.json +1178 -0
- package/examples/app-svelte5/package.json +24 -0
- package/examples/app-svelte5/playwright.config.js +26 -0
- package/examples/app-svelte5/src/App.svelte +66 -0
- package/examples/app-svelte5/src/articles.js +43 -0
- package/examples/app-svelte5/src/main.js +10 -0
- package/examples/app-svelte5/src/pages/Admin.svelte +6 -0
- package/examples/app-svelte5/src/pages/Blog.svelte +18 -0
- package/examples/app-svelte5/src/pages/Guide.svelte +21 -0
- package/examples/app-svelte5/src/pages/Home.svelte +6 -0
- package/examples/app-svelte5/src/pages/NotFound.svelte +1 -0
- package/examples/app-svelte5/src/pages/Post.svelte +21 -0
- package/examples/app-svelte5/src/vite-env.d.ts +2 -0
- package/examples/app-svelte5/svelte.config.js +7 -0
- package/examples/app-svelte5/tests/e2e.spec.js +69 -0
- package/examples/app-svelte5/vite.config.js +7 -0
- package/jsconfig.json +1 -1
- package/package.json +9 -10
- package/src/Router.svelte +52 -12
- package/src/index.d.ts +9 -1
- package/src/scratch.js +12 -0
- package/src/stores.js +4 -2
- package/src/types.ts +20 -4
- package/example/dist/Article.js.map +0 -1
- package/example/dist/Login.js.map +0 -1
- package/example/dist/Query.js.map +0 -1
- package/example/dist/main2.js.map +0 -1
- package/example/store.js +0 -3
- package/server.js +0 -65
- package/src/route_state.js +0 -44
- /package/{example → examples/app-svelte4}/dist/index.html +0 -0
- /package/{example → examples/app-svelte4}/dist/main.js +0 -0
- /package/{example → examples/app-svelte4}/dist/main.js.map +0 -0
- /package/{example → examples/app-svelte4/src}/Admin.svelte +0 -0
- /package/{example → examples/app-svelte4/src}/NotFound.svelte +0 -0
- /package/{example → examples/app-svelte4/src}/main.js +0 -0
- /package/{tests → examples/app-svelte4/tests}/e2e.test.js +0 -0
package/README.md
CHANGED
|
@@ -184,6 +184,11 @@ store to detect URL changes (including query string or hash)
|
|
|
184
184
|
|
|
185
185
|
## ChangeLog
|
|
186
186
|
|
|
187
|
+
### 2.1.0-next.0
|
|
188
|
+
|
|
189
|
+
* [PR12](https://github.com/ykrods/svelte-spa-history-router/pull/12)
|
|
190
|
+
* Refactor (changes: [2.1.2...7b7795b](https://github.com/ykrods/svelte-spa-history-router/compare/2.1.2...7b7795b2675c452a1a189d3931c0c4c9abb04c51) )
|
|
191
|
+
|
|
187
192
|
### 2.1.2 (2024-04-29)
|
|
188
193
|
|
|
189
194
|
* Support types [PR10](https://github.com/ykrods/svelte-spa-history-router/pull/10)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { S as SvelteComponentDev, i as init, s as safe_not_equal, d as dispatch_dev, v as validate_store, r as routeParams, c as component_subscribe, a as validate_slots, l as link, g as globals, b as space, e as element, t as text, f as add_location, h as attr_dev, j as insert_dev, k as append_dev, m as set_data_dev, n as noop, o as detach_dev, p as action_destroyer, H as HtmlTag } from './main2.js';
|
|
2
2
|
|
|
3
|
-
/* Article.svelte generated by Svelte v4.2.
|
|
3
|
+
/* src/Article.svelte generated by Svelte v4.2.17 */
|
|
4
4
|
|
|
5
5
|
const { console: console_1 } = globals;
|
|
6
|
-
const file = "Article.svelte";
|
|
6
|
+
const file = "src/Article.svelte";
|
|
7
7
|
|
|
8
|
-
// (
|
|
8
|
+
// (18:4) {#if article.previous}
|
|
9
9
|
function create_if_block_1(ctx) {
|
|
10
10
|
let a;
|
|
11
11
|
let t;
|
|
@@ -18,7 +18,7 @@ function create_if_block_1(ctx) {
|
|
|
18
18
|
a = element("a");
|
|
19
19
|
t = text("Prev");
|
|
20
20
|
attr_dev(a, "href", a_href_value = `/posts/${/*article*/ ctx[0].previous}`);
|
|
21
|
-
add_location(a, file,
|
|
21
|
+
add_location(a, file, 17, 26, 354);
|
|
22
22
|
},
|
|
23
23
|
m: function mount(target, anchor) {
|
|
24
24
|
insert_dev(target, a, anchor);
|
|
@@ -48,14 +48,14 @@ function create_if_block_1(ctx) {
|
|
|
48
48
|
block,
|
|
49
49
|
id: create_if_block_1.name,
|
|
50
50
|
type: "if",
|
|
51
|
-
source: "(
|
|
51
|
+
source: "(18:4) {#if article.previous}",
|
|
52
52
|
ctx
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
return block;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// (
|
|
58
|
+
// (19:4) {#if article.next}
|
|
59
59
|
function create_if_block(ctx) {
|
|
60
60
|
let a;
|
|
61
61
|
let t;
|
|
@@ -68,7 +68,7 @@ function create_if_block(ctx) {
|
|
|
68
68
|
a = element("a");
|
|
69
69
|
t = text("Next");
|
|
70
70
|
attr_dev(a, "href", a_href_value = `/posts/${/*article*/ ctx[0].next}`);
|
|
71
|
-
add_location(a, file,
|
|
71
|
+
add_location(a, file, 18, 22, 438);
|
|
72
72
|
},
|
|
73
73
|
m: function mount(target, anchor) {
|
|
74
74
|
insert_dev(target, a, anchor);
|
|
@@ -98,7 +98,7 @@ function create_if_block(ctx) {
|
|
|
98
98
|
block,
|
|
99
99
|
id: create_if_block.name,
|
|
100
100
|
type: "if",
|
|
101
|
-
source: "(
|
|
101
|
+
source: "(19:4) {#if article.next}",
|
|
102
102
|
ctx
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -135,11 +135,11 @@ function create_fragment(ctx) {
|
|
|
135
135
|
if (if_block0) if_block0.c();
|
|
136
136
|
t4 = space();
|
|
137
137
|
if (if_block1) if_block1.c();
|
|
138
|
-
add_location(h1, file,
|
|
138
|
+
add_location(h1, file, 14, 2, 272);
|
|
139
139
|
html_tag.a = t3;
|
|
140
|
-
add_location(div0, file,
|
|
140
|
+
add_location(div0, file, 16, 2, 322);
|
|
141
141
|
attr_dev(div1, "class", "article");
|
|
142
|
-
add_location(div1, file,
|
|
142
|
+
add_location(div1, file, 13, 0, 248);
|
|
143
143
|
},
|
|
144
144
|
l: function claim(nodes) {
|
|
145
145
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Article.js","sources":["../src/Article.svelte"],"sourcesContent":["<script>\n import { link, routeParams } from 'svelte-spa-history-router';\n\n export let article;\n\n $: if ($routeParams.postId) {\n console.log($routeParams.postId);\n };\n</script>\n\n<svelte:head>\n <title>{ article.title }</title>\n</svelte:head>\n<div class=\"article\">\n <h1>{article.title}</h1>\n {@html article.html}\n <div>\n {#if article.previous}<a use:link href={`/posts/${article.previous}`}>Prev</a>{/if}\n {#if article.next}<a use:link href={`/posts/${article.next}`}>Next</a>{/if}\n </div>\n</div>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;YAiB0E,MAAI,CAAA,CAAA;AAAxB,GAAA,QAAA,CAAA,CAAA,EAAA,MAAA,EAAA,YAAA,GAAA,CAAA,OAAA,cAAA,GAAO,IAAC,QAAQ,CAAA,CAAA,CAAA,CAAA;;;;GAA5C,UAAwD,CAAA,MAAA,EAAA,CAAA,EAAA,MAAA,CAAA,CAAA;;;;;;;;;AAA5B,GAAA,IAAA,KAAA,eAAA,CAAA,IAAA,YAAA,MAAA,YAAA,GAAA,CAAA,OAAA,cAAA,GAAO,IAAC,QAAQ,CAAA,CAAA,CAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACJ,MAAI,CAAA,CAAA;AAApB,GAAA,QAAA,CAAA,CAAA,EAAA,MAAA,EAAA,YAAA,GAAA,CAAA,OAAA,cAAA,GAAO,IAAC,IAAI,CAAA,CAAA,CAAA,CAAA;;;;GAAxC,UAAoD,CAAA,MAAA,EAAA,CAAA,EAAA,MAAA,CAAA,CAAA;;;;;;;;;AAAxB,GAAA,IAAA,KAAA,eAAA,CAAA,IAAA,YAAA,MAAA,YAAA,GAAA,CAAA,OAAA,cAAA,GAAO,IAAC,IAAI,CAAA,CAAA,CAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJvD,CAAA,IAAA,QAAA,eAAA,GAAO,IAAC,KAAK,GAAA,EAAA,CAAA;;;;AACX,CAAA,IAAA,SAAA,eAAA,GAAO,IAAC,IAAI,GAAA,EAAA,CAAA;;;;AAJV,CAAA,QAAA,CAAA,KAAA,GAAA,WAAA,eAAA,GAAO,IAAC,KAAK,CAAA;AAMf,CAAA,IAAA,SAAA,eAAA,GAAO,IAAC,QAAQ,IAAA,iBAAA,CAAA,GAAA,CAAA,CAAA;AAChB,CAAA,IAAA,SAAA,eAAA,GAAO,IAAC,IAAI,IAAA,eAAA,CAAA,GAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GALrB,UAOM,CAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,CAAA;GANJ,UAAwB,CAAA,IAAA,EAAA,EAAA,CAAA,CAAA;;;;;GAExB,UAGM,CAAA,IAAA,EAAA,IAAA,CAAA,CAAA;;;;;;AARG,GAAA,IAAA,KAAA,eAAA,CAAA,IAAA,WAAA,MAAA,WAAA,eAAA,GAAO,IAAC,KAAK,CAAA,EAAA;;;;AAGjB,GAAA,IAAA,KAAA,eAAA,CAAA,IAAA,QAAA,MAAA,QAAA,eAAA,GAAO,IAAC,KAAK,GAAA,EAAA,CAAA,EAAA,YAAA,CAAA,EAAA,EAAA,QAAA,CAAA,CAAA;AACX,GAAA,IAAA,KAAA,eAAA,CAAA,IAAA,SAAA,MAAA,SAAA,eAAA,GAAO,IAAC,IAAI,GAAA,EAAA,CAAA,EAAA,QAAA,CAAA,CAAA,CAAA,SAAA,CAAA,CAAA;;AAEZ,GAAA,gBAAA,GAAO,IAAC,QAAQ,EAAA;;;;;;;;;;;;;AAChB,GAAA,gBAAA,GAAO,IAAC,IAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAfR,OAAO,EAAA,GAAA,OAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEjB,IAAM,YAAY,CAAC,MAAM,EAAA;AACxB,IAAA,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as SvelteComponentDev, i as init, s as safe_not_equal, d as dispatch_dev, v as validate_store, u as user, c as component_subscribe, a as validate_slots, q as push, e as element, b as space, f as add_location, h as attr_dev, j as insert_dev, k as append_dev, n as noop, o as detach_dev, w as set_store_value, t as text, x as listen_dev, m as set_data_dev } from './main2.js';
|
|
2
2
|
|
|
3
|
-
/* Login.svelte generated by Svelte v4.2.
|
|
4
|
-
const file = "Login.svelte";
|
|
3
|
+
/* src/Login.svelte generated by Svelte v4.2.17 */
|
|
4
|
+
const file = "src/Login.svelte";
|
|
5
5
|
|
|
6
6
|
// (18:2) {:else }
|
|
7
7
|
function create_else_block(ctx) {
|
|
@@ -20,7 +20,7 @@ function create_else_block(ctx) {
|
|
|
20
20
|
button = element("button");
|
|
21
21
|
button.textContent = "logout";
|
|
22
22
|
attr_dev(button, "id", "logout");
|
|
23
|
-
add_location(button, file, 18, 26,
|
|
23
|
+
add_location(button, file, 18, 26, 352);
|
|
24
24
|
},
|
|
25
25
|
m: function mount(target, anchor) {
|
|
26
26
|
insert_dev(target, t0, anchor);
|
|
@@ -29,7 +29,7 @@ function create_else_block(ctx) {
|
|
|
29
29
|
insert_dev(target, button, anchor);
|
|
30
30
|
|
|
31
31
|
if (!mounted) {
|
|
32
|
-
dispose = listen_dev(button, "click", /*logout*/ ctx[2], false
|
|
32
|
+
dispose = listen_dev(button, "click", /*logout*/ ctx[2], false);
|
|
33
33
|
mounted = true;
|
|
34
34
|
}
|
|
35
35
|
},
|
|
@@ -71,13 +71,13 @@ function create_if_block(ctx) {
|
|
|
71
71
|
button = element("button");
|
|
72
72
|
button.textContent = "login";
|
|
73
73
|
attr_dev(button, "id", "login");
|
|
74
|
-
add_location(button, file, 16, 2,
|
|
74
|
+
add_location(button, file, 16, 2, 264);
|
|
75
75
|
},
|
|
76
76
|
m: function mount(target, anchor) {
|
|
77
77
|
insert_dev(target, button, anchor);
|
|
78
78
|
|
|
79
79
|
if (!mounted) {
|
|
80
|
-
dispose = listen_dev(button, "click", /*login*/ ctx[1], false
|
|
80
|
+
dispose = listen_dev(button, "click", /*login*/ ctx[1], false);
|
|
81
81
|
mounted = true;
|
|
82
82
|
}
|
|
83
83
|
},
|
|
@@ -123,9 +123,9 @@ function create_fragment(ctx) {
|
|
|
123
123
|
h1.textContent = "Login";
|
|
124
124
|
t1 = space();
|
|
125
125
|
if_block.c();
|
|
126
|
-
add_location(h1, file, 14, 2,
|
|
126
|
+
add_location(h1, file, 14, 2, 223);
|
|
127
127
|
attr_dev(div, "class", "login");
|
|
128
|
-
add_location(div, file, 13, 0,
|
|
128
|
+
add_location(div, file, 13, 0, 201);
|
|
129
129
|
},
|
|
130
130
|
l: function claim(nodes) {
|
|
131
131
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Login.js","sources":["../src/Login.svelte"],"sourcesContent":["<script>\n import { push } from 'svelte-spa-history-router';\n\n import { user } from './store.js';\n\n function login() {\n $user = \"admin\";\n }\n function logout() {\n $user = null;\n }\n</script>\n\n<div class=\"login\">\n <h1>Login</h1>\n {#if $user === null }\n <button id=\"login\" on:click={login}>login</button>\n {:else }\n current user: { $user } <button id=\"logout\" on:click={logout}>logout</button>\n {/if }\n</div>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;aAiBU,gBACM,CAAA,CAAA;uBAAE,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;GAAG,UAAqD,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;;qDAAvB,GAAM,CAAA,CAAA,CAAA,EAAA,KAAA,CAAA,CAAA;;;;;uDAA5C,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAFrB,UAAkD,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;;oDAArB,GAAK,CAAA,CAAA,CAAA,EAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAD7B,EAAA,cAAA,GAAK,QAAK,IAAI,EAAA,OAAA,eAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;GAFrB,UAOM,CAAA,MAAA,EAAA,GAAA,EAAA,MAAA,CAAA,CAAA;GANJ,UAAc,CAAA,GAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UATL,KAAK,GAAA;AACZ,EAAA,eAAA,CAAA,IAAA,EAAA,KAAK,GAAG,OAAO,EAAA,KAAA,CAAA,CAAA;;;UAER,MAAM,GAAA;AACb,EAAA,eAAA,CAAA,IAAA,EAAA,KAAK,GAAG,IAAI,EAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { S as SvelteComponentDev, i as init, s as safe_not_equal, d as dispatch_dev, v as validate_store, y as currentURL, c as component_subscribe, a as validate_slots, l as link,
|
|
1
|
+
import { S as SvelteComponentDev, i as init, s as safe_not_equal, d as dispatch_dev, v as validate_store, y as currentURL, c as component_subscribe, a as validate_slots, l as link, b as space, e as element, t as text, h as attr_dev, f as add_location, j as insert_dev, k as append_dev, p as action_destroyer, m as set_data_dev, n as noop, o as detach_dev, z as run_all } from './main2.js';
|
|
2
2
|
|
|
3
|
-
/* Query.svelte generated by Svelte v4.2.
|
|
4
|
-
|
|
5
|
-
const { console: console_1 } = globals;
|
|
6
|
-
const file = "Query.svelte";
|
|
3
|
+
/* src/Query.svelte generated by Svelte v4.2.17 */
|
|
4
|
+
const file = "src/Query.svelte";
|
|
7
5
|
|
|
8
6
|
function create_fragment(ctx) {
|
|
9
7
|
let t0;
|
|
@@ -35,14 +33,14 @@ function create_fragment(ctx) {
|
|
|
35
33
|
a1.textContent = "bar";
|
|
36
34
|
document.title = "query";
|
|
37
35
|
attr_dev(span, "id", "name");
|
|
38
|
-
add_location(span, file,
|
|
39
|
-
add_location(p, file,
|
|
36
|
+
add_location(span, file, 9, 11, 230);
|
|
37
|
+
add_location(p, file, 9, 2, 221);
|
|
40
38
|
attr_dev(a0, "href", "/query?name=foo");
|
|
41
|
-
add_location(a0, file,
|
|
39
|
+
add_location(a0, file, 10, 2, 268);
|
|
42
40
|
attr_dev(a1, "href", "/query?name=bar");
|
|
43
|
-
add_location(a1, file,
|
|
41
|
+
add_location(a1, file, 11, 2, 313);
|
|
44
42
|
attr_dev(div, "class", "query");
|
|
45
|
-
add_location(div, file,
|
|
43
|
+
add_location(div, file, 8, 0, 199);
|
|
46
44
|
},
|
|
47
45
|
l: function claim(nodes) {
|
|
48
46
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
|
@@ -99,31 +97,18 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
99
97
|
let name;
|
|
100
98
|
let $currentURL;
|
|
101
99
|
validate_store(currentURL, 'currentURL');
|
|
102
|
-
component_subscribe($$self, currentURL, $$value => $$invalidate(
|
|
100
|
+
component_subscribe($$self, currentURL, $$value => $$invalidate(1, $currentURL = $$value));
|
|
103
101
|
let { $$slots: slots = {}, $$scope } = $$props;
|
|
104
102
|
validate_slots('Query', slots, []);
|
|
105
|
-
|
|
106
|
-
console.log(article);
|
|
107
|
-
const writable_props = ['article'];
|
|
103
|
+
const writable_props = [];
|
|
108
104
|
|
|
109
105
|
Object.keys($$props).forEach(key => {
|
|
110
|
-
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot')
|
|
106
|
+
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Query> was created with unknown prop '${key}'`);
|
|
111
107
|
});
|
|
112
108
|
|
|
113
|
-
$$self
|
|
114
|
-
if ('article' in $$props) $$invalidate(1, article = $$props.article);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
$$self.$capture_state = () => ({
|
|
118
|
-
link,
|
|
119
|
-
currentURL,
|
|
120
|
-
article,
|
|
121
|
-
name,
|
|
122
|
-
$currentURL
|
|
123
|
-
});
|
|
109
|
+
$$self.$capture_state = () => ({ link, currentURL, name, $currentURL });
|
|
124
110
|
|
|
125
111
|
$$self.$inject_state = $$props => {
|
|
126
|
-
if ('article' in $$props) $$invalidate(1, article = $$props.article);
|
|
127
112
|
if ('name' in $$props) $$invalidate(0, name = $$props.name);
|
|
128
113
|
};
|
|
129
114
|
|
|
@@ -132,18 +117,18 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
132
117
|
}
|
|
133
118
|
|
|
134
119
|
$$self.$$.update = () => {
|
|
135
|
-
if ($$self.$$.dirty & /*$currentURL*/
|
|
136
|
-
$$invalidate(0, name = $currentURL.searchParams.get("name")
|
|
120
|
+
if ($$self.$$.dirty & /*$currentURL*/ 2) {
|
|
121
|
+
$$invalidate(0, name = $currentURL.searchParams.get("name") ?? 'unknown');
|
|
137
122
|
}
|
|
138
123
|
};
|
|
139
124
|
|
|
140
|
-
return [name,
|
|
125
|
+
return [name, $currentURL];
|
|
141
126
|
}
|
|
142
127
|
|
|
143
128
|
class Query extends SvelteComponentDev {
|
|
144
129
|
constructor(options) {
|
|
145
130
|
super(options);
|
|
146
|
-
init(this, options, instance, create_fragment, safe_not_equal, {
|
|
131
|
+
init(this, options, instance, create_fragment, safe_not_equal, {});
|
|
147
132
|
|
|
148
133
|
dispatch_dev("SvelteRegisterComponent", {
|
|
149
134
|
component: this,
|
|
@@ -152,14 +137,6 @@ class Query extends SvelteComponentDev {
|
|
|
152
137
|
id: create_fragment.name
|
|
153
138
|
});
|
|
154
139
|
}
|
|
155
|
-
|
|
156
|
-
get article() {
|
|
157
|
-
throw new Error("<Query>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
set article(value) {
|
|
161
|
-
throw new Error("<Query>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'");
|
|
162
|
-
}
|
|
163
140
|
}
|
|
164
141
|
|
|
165
142
|
export { Query as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Query.js","sources":["../src/Query.svelte"],"sourcesContent":["<script>\n import { link, currentURL } from \"svelte-spa-history-router\";\n\n $: name = $currentURL.searchParams.get(\"name\") ?? 'unknown';\n</script>\n<svelte:head>\n <title>query</title>\n</svelte:head>\n<div class=\"query\">\n <p>name: <span id=\"name\">{ name }</span></p>\n <a use:link href=\"/query?name=foo\">foo</a>\n <a use:link href=\"/query?name=bar\">bar</a>\n</div>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;aASK,QAAM,CAAA,CAAA;;sBAAkB,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;GADjC,UAIM,CAAA,MAAA,EAAA,GAAA,EAAA,MAAA,CAAA,CAAA;GAHJ,UAA4C,CAAA,GAAA,EAAA,CAAA,CAAA,CAAA;;GAAnC,UAA+B,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA;;;GACxC,UAA0C,CAAA,GAAA,EAAA,EAAA,CAAA,CAAA;;GAC1C,UAA0C,CAAA,GAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;qDAFf,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAN9B,YAAA,CAAA,CAAA,EAAE,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAA,IAAK,SAAS,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|