svelte-spa-history-router 2.1.0 → 2.1.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/README.md CHANGED
@@ -24,7 +24,7 @@ $ yarn add svelte-spa-history-router
24
24
 
25
25
  ## Usage
26
26
 
27
- Import `Route` and put into your main component (typically App.svelte).
27
+ Import `Router` and put into your main component (typically App.svelte).
28
28
 
29
29
  For example:
30
30
 
@@ -96,8 +96,6 @@ import { push } from 'svelte-spa-history-router';
96
96
 
97
97
  ### resolver
98
98
 
99
- (Added in v2.0.0)
100
-
101
99
  Resolver is a mechanism to dynamically determine component and can be used in multiple use cases.
102
100
 
103
101
  Example: code spliting (dynamic import)
@@ -120,6 +118,7 @@ Example: dynamic routing and pass value to component props.
120
118
  import { Router } from 'svelte-spa-history-router';
121
119
 
122
120
  import Article from "./Article.svelte";
121
+ import NotFound from "./NotFound.svelte";
123
122
 
124
123
  async function prefetchArticle(route) {
125
124
  const article = await getArticle(route.params.postId);
@@ -145,7 +144,7 @@ Example: guard
145
144
  <script>
146
145
  import { Router, redirect } from 'svelte-spa-history-router';
147
146
 
148
- import Admin from "./Admin.svelte";
147
+ import Admin from "./Admin.svelte";
149
148
 
150
149
  function adminGuard(route) {
151
150
  if (!isAdmin($user)) {
@@ -162,12 +161,37 @@ import Admin from "./Admin.svelte";
162
161
  <Router {routes}/>
163
162
  ```
164
163
 
164
+ (Added in v2.0.0)
165
+
166
+ ### currentURL
167
+
168
+ store to detect URL changes (including query string or hash)
169
+
170
+ ```html
171
+ <script>
172
+ import { currentURL } from "svelte-spa-history-router";
173
+
174
+ $: name = $currentURL.searchParams.get("name") || 'unknown';
175
+ </script>
176
+ <div>{ name }</div>
177
+ ```
178
+
179
+ (Added in 2.1.0)
180
+
165
181
  ### Full example:
166
182
 
167
183
  [example](https://github.com/ykrods/svelte-spa-history-router/tree/master/example)
168
184
 
169
185
  ## ChangeLog
170
186
 
187
+ ### 2.1.2 (2024-04-29)
188
+
189
+ * Support types [PR10](https://github.com/ykrods/svelte-spa-history-router/pull/10)
190
+
191
+ ### 2.1.1 (2024-01-13)
192
+
193
+ * ~~Support Types~~ Add typecheck [PR9](https://github.com/ykrods/svelte-spa-history-router/pull/9)
194
+
171
195
  ### 2.1.0 (2021-04-29)
172
196
 
173
197
  * Add `currentURL` store to detect URL changes [PR6](https://github.com/ykrods/svelte-spa-history-router/pull/6)
@@ -9,7 +9,7 @@
9
9
  import Admin from './Admin.svelte';
10
10
  import NotFound from "./NotFound.svelte";
11
11
 
12
- function adminGuard(route) {
12
+ function adminGuard() {
13
13
  if ($user === null) {
14
14
  return redirect("/login");
15
15
  } else {
@@ -17,6 +17,9 @@
17
17
  }
18
18
  }
19
19
 
20
+ /**
21
+ * @param {import("../src/types").RouteState} route
22
+ */
20
23
  async function prefetchArticle(route) {
21
24
  const article = await getArticle(route.params.postId);
22
25
  if (article) {
@@ -32,8 +35,8 @@
32
35
  { path: '/', component: Home},
33
36
  { path: '/posts/(?<postId>.*)', resolver: prefetchArticle },
34
37
  { path: '/admin', resolver: adminGuard },
35
- { path: '/login', resolver: _ => import("./Login.svelte") },
36
- { path: '/query', resolver: _ => import("./Query.svelte") },
38
+ { path: '/login', resolver: () => import("./Login.svelte") },
39
+ { path: '/query', resolver: () => import("./Query.svelte") },
37
40
  ];
38
41
  </script>
39
42
 
@@ -1,6 +1,6 @@
1
- import { S as SvelteComponentDev, i as init, s as safe_not_equal, d as dispatch_dev, g as globals, v as validate_store, r as routeParams, c as component_subscribe, a as validate_slots, l as link, e as element, t as text, b as attr_dev, f as add_location, h as insert_dev, j as append_dev, k as action_destroyer, m as detach_dev, n as space, o as set_data_dev, p as noop, H as HtmlTag } from './main2.js';
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 v3.37.0 */
3
+ /* Article.svelte generated by Svelte v4.2.8 */
4
4
 
5
5
  const { console: console_1 } = globals;
6
6
  const file = "Article.svelte";
@@ -35,7 +35,10 @@ function create_if_block_1(ctx) {
35
35
  }
36
36
  },
37
37
  d: function destroy(detaching) {
38
- if (detaching) detach_dev(a);
38
+ if (detaching) {
39
+ detach_dev(a);
40
+ }
41
+
39
42
  mounted = false;
40
43
  dispose();
41
44
  }
@@ -82,7 +85,10 @@ function create_if_block(ctx) {
82
85
  }
83
86
  },
84
87
  d: function destroy(detaching) {
85
- if (detaching) detach_dev(a);
88
+ if (detaching) {
89
+ detach_dev(a);
90
+ }
91
+
86
92
  mounted = false;
87
93
  dispose();
88
94
  }
@@ -123,13 +129,14 @@ function create_fragment(ctx) {
123
129
  h1 = element("h1");
124
130
  t1 = text(t1_value);
125
131
  t2 = space();
132
+ html_tag = new HtmlTag(false);
126
133
  t3 = space();
127
134
  div0 = element("div");
128
135
  if (if_block0) if_block0.c();
129
136
  t4 = space();
130
137
  if (if_block1) if_block1.c();
131
138
  add_location(h1, file, 15, 2, 299);
132
- html_tag = new HtmlTag(t3);
139
+ html_tag.a = t3;
133
140
  add_location(div0, file, 17, 2, 349);
134
141
  attr_dev(div1, "class", "article");
135
142
  add_location(div1, file, 14, 0, 275);
@@ -187,8 +194,11 @@ function create_fragment(ctx) {
187
194
  i: noop,
188
195
  o: noop,
189
196
  d: function destroy(detaching) {
190
- if (detaching) detach_dev(t0);
191
- if (detaching) detach_dev(div1);
197
+ if (detaching) {
198
+ detach_dev(t0);
199
+ detach_dev(div1);
200
+ }
201
+
192
202
  if (if_block0) if_block0.d();
193
203
  if (if_block1) if_block1.d();
194
204
  }
@@ -207,26 +217,32 @@ function create_fragment(ctx) {
207
217
 
208
218
  function instance($$self, $$props, $$invalidate) {
209
219
  let $routeParams;
210
- validate_store(routeParams, "routeParams");
220
+ validate_store(routeParams, 'routeParams');
211
221
  component_subscribe($$self, routeParams, $$value => $$invalidate(1, $routeParams = $$value));
212
222
  let { $$slots: slots = {}, $$scope } = $$props;
213
- validate_slots("Article", slots, []);
223
+ validate_slots('Article', slots, []);
214
224
  let { article } = $$props;
215
-
216
- const writable_props = ["article"];
225
+
226
+ $$self.$$.on_mount.push(function () {
227
+ if (article === undefined && !('article' in $$props || $$self.$$.bound[$$self.$$.props['article']])) {
228
+ console_1.warn("<Article> was created without expected prop 'article'");
229
+ }
230
+ });
231
+
232
+ const writable_props = ['article'];
217
233
 
218
234
  Object.keys($$props).forEach(key => {
219
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`<Article> was created with unknown prop '${key}'`);
235
+ if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<Article> was created with unknown prop '${key}'`);
220
236
  });
221
237
 
222
238
  $$self.$$set = $$props => {
223
- if ("article" in $$props) $$invalidate(0, article = $$props.article);
239
+ if ('article' in $$props) $$invalidate(0, article = $$props.article);
224
240
  };
225
241
 
226
242
  $$self.$capture_state = () => ({ link, routeParams, article, $routeParams });
227
243
 
228
244
  $$self.$inject_state = $$props => {
229
- if ("article" in $$props) $$invalidate(0, article = $$props.article);
245
+ if ('article' in $$props) $$invalidate(0, article = $$props.article);
230
246
  };
231
247
 
232
248
  if ($$props && "$$inject" in $$props) {
@@ -255,13 +271,6 @@ class Article extends SvelteComponentDev {
255
271
  options,
256
272
  id: create_fragment.name
257
273
  });
258
-
259
- const { ctx } = this.$$;
260
- const props = options.props || {};
261
-
262
- if (/*article*/ ctx[0] === undefined && !("article" in props)) {
263
- console_1.warn("<Article> was created without expected prop 'article'");
264
- }
265
274
  }
266
275
 
267
276
  get article() {
@@ -273,5 +282,5 @@ class Article extends SvelteComponentDev {
273
282
  }
274
283
  }
275
284
 
276
- export default Article;
285
+ export { Article as default };
277
286
  //# sourceMappingURL=Article.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Article.js","sources":["../Article.svelte"],"sourcesContent":["<script>\n import { link } from '../src/index.js';\n import { routeParams } from '../src/stores.js';\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":";;;;;;;;;;;;;;;;;;;4DAkBsD,GAAO,IAAC,QAAQ;;;;;;;;;;;;;uFAAhB,GAAO,IAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DACpB,GAAO,IAAC,IAAI;;;;;;;;;;;;;uFAAZ,GAAO,IAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAJvD,GAAO,IAAC,KAAK;;;;6BACX,GAAO,IAAC,IAAI;;;;4CAJV,GAAO,IAAC,KAAK;6BAMf,GAAO,IAAC,QAAQ;6BAChB,GAAO,IAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAPV,GAAO,IAAC,KAAK;;;;qEAGjB,GAAO,IAAC,KAAK;uEACX,GAAO,IAAC,IAAI;;mBAEZ,GAAO,IAAC,QAAQ;;;;;;;;;;;;;mBAChB,GAAO,IAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAfR,OAAO;;;;;;;;;;;;;;;;;;;;;;;;OAEX,YAAY,CAAC,MAAM;IACxB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Article.js","sources":["../Article.svelte"],"sourcesContent":["<script>\n import { link } from '../src/index.js';\n import { routeParams } from '../src/stores.js';\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":";;;;;;;;;;;;;;;;;;YAkB0E,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,6 +1,6 @@
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, n as space, f as add_location, b as attr_dev, h as insert_dev, j as append_dev, p as noop, m as detach_dev, w as set_store_value, t as text, x as listen_dev, o as set_data_dev } from './main2.js';
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 v3.37.0 */
3
+ /* Login.svelte generated by Svelte v4.2.8 */
4
4
  const file = "Login.svelte";
5
5
 
6
6
  // (18:2) {:else }
@@ -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, false, false);
32
+ dispose = listen_dev(button, "click", /*logout*/ ctx[2], false, false, false, false);
33
33
  mounted = true;
34
34
  }
35
35
  },
@@ -37,10 +37,13 @@ function create_else_block(ctx) {
37
37
  if (dirty & /*$user*/ 1) set_data_dev(t1, /*$user*/ ctx[0]);
38
38
  },
39
39
  d: function destroy(detaching) {
40
- if (detaching) detach_dev(t0);
41
- if (detaching) detach_dev(t1);
42
- if (detaching) detach_dev(t2);
43
- if (detaching) detach_dev(button);
40
+ if (detaching) {
41
+ detach_dev(t0);
42
+ detach_dev(t1);
43
+ detach_dev(t2);
44
+ detach_dev(button);
45
+ }
46
+
44
47
  mounted = false;
45
48
  dispose();
46
49
  }
@@ -74,13 +77,16 @@ function create_if_block(ctx) {
74
77
  insert_dev(target, button, anchor);
75
78
 
76
79
  if (!mounted) {
77
- dispose = listen_dev(button, "click", /*login*/ ctx[1], false, false, false);
80
+ dispose = listen_dev(button, "click", /*login*/ ctx[1], false, false, false, false);
78
81
  mounted = true;
79
82
  }
80
83
  },
81
84
  p: noop,
82
85
  d: function destroy(detaching) {
83
- if (detaching) detach_dev(button);
86
+ if (detaching) {
87
+ detach_dev(button);
88
+ }
89
+
84
90
  mounted = false;
85
91
  dispose();
86
92
  }
@@ -146,7 +152,10 @@ function create_fragment(ctx) {
146
152
  i: noop,
147
153
  o: noop,
148
154
  d: function destroy(detaching) {
149
- if (detaching) detach_dev(div);
155
+ if (detaching) {
156
+ detach_dev(div);
157
+ }
158
+
150
159
  if_block.d();
151
160
  }
152
161
  };
@@ -164,10 +173,10 @@ function create_fragment(ctx) {
164
173
 
165
174
  function instance($$self, $$props, $$invalidate) {
166
175
  let $user;
167
- validate_store(user, "user");
176
+ validate_store(user, 'user');
168
177
  component_subscribe($$self, user, $$value => $$invalidate(0, $user = $$value));
169
178
  let { $$slots: slots = {}, $$scope } = $$props;
170
- validate_slots("Login", slots, []);
179
+ validate_slots('Login', slots, []);
171
180
 
172
181
  function login() {
173
182
  set_store_value(user, $user = "admin", $user);
@@ -180,7 +189,7 @@ function instance($$self, $$props, $$invalidate) {
180
189
  const writable_props = [];
181
190
 
182
191
  Object.keys($$props).forEach(key => {
183
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Login> was created with unknown prop '${key}'`);
192
+ if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Login> was created with unknown prop '${key}'`);
184
193
  });
185
194
 
186
195
  $$self.$capture_state = () => ({ push, user, login, logout, $user });
@@ -201,5 +210,5 @@ class Login extends SvelteComponentDev {
201
210
  }
202
211
  }
203
212
 
204
- export default Login;
213
+ export { Login as default };
205
214
  //# sourceMappingURL=Login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Login.js","sources":["../Login.svelte"],"sourcesContent":["<script>\n import { push } from '../src/push.js';\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":";;;;;;;;;;;;;;;;;uBAkBkB,GAAK;;;;;;;;;;;;;;qDAAiC,GAAM;;;;;uDAA5C,GAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAFQ,GAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAD7B,GAAK,QAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAVV,KAAK;wBACZ,KAAK,GAAG,OAAO;;;UAER,MAAM;wBACb,KAAK,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Login.js","sources":["../Login.svelte"],"sourcesContent":["<script>\n import { push } from '../src/push.js';\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,EAAA,KAAA,EAAA,KAAA,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,EAAA,KAAA,EAAA,KAAA,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,6 +1,8 @@
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, n as space, e as element, t as text, b as attr_dev, f as add_location, h as insert_dev, j as append_dev, k as action_destroyer, o as set_data_dev, p as noop, m as detach_dev, z as run_all } from './main2.js';
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, g as globals, 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 v3.37.0 */
3
+ /* Query.svelte generated by Svelte v4.2.8 */
4
+
5
+ const { console: console_1 } = globals;
4
6
  const file = "Query.svelte";
5
7
 
6
8
  function create_fragment(ctx) {
@@ -33,14 +35,14 @@ function create_fragment(ctx) {
33
35
  a1.textContent = "bar";
34
36
  document.title = "query";
35
37
  attr_dev(span, "id", "name");
36
- add_location(span, file, 10, 11, 256);
37
- add_location(p, file, 10, 2, 247);
38
+ add_location(span, file, 14, 11, 311);
39
+ add_location(p, file, 14, 2, 302);
38
40
  attr_dev(a0, "href", "/query?name=foo");
39
- add_location(a0, file, 11, 2, 294);
41
+ add_location(a0, file, 15, 2, 349);
40
42
  attr_dev(a1, "href", "/query?name=bar");
41
- add_location(a1, file, 12, 2, 339);
43
+ add_location(a1, file, 16, 2, 394);
42
44
  attr_dev(div, "class", "query");
43
- add_location(div, file, 9, 0, 225);
45
+ add_location(div, file, 13, 0, 280);
44
46
  },
45
47
  l: function claim(nodes) {
46
48
  throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
@@ -72,8 +74,11 @@ function create_fragment(ctx) {
72
74
  i: noop,
73
75
  o: noop,
74
76
  d: function destroy(detaching) {
75
- if (detaching) detach_dev(t0);
76
- if (detaching) detach_dev(div);
77
+ if (detaching) {
78
+ detach_dev(t0);
79
+ detach_dev(div);
80
+ }
81
+
77
82
  mounted = false;
78
83
  run_all(dispose);
79
84
  }
@@ -93,20 +98,33 @@ function create_fragment(ctx) {
93
98
  function instance($$self, $$props, $$invalidate) {
94
99
  let name;
95
100
  let $currentURL;
96
- validate_store(currentURL, "currentURL");
97
- component_subscribe($$self, currentURL, $$value => $$invalidate(1, $currentURL = $$value));
101
+ validate_store(currentURL, 'currentURL');
102
+ component_subscribe($$self, currentURL, $$value => $$invalidate(2, $currentURL = $$value));
98
103
  let { $$slots: slots = {}, $$scope } = $$props;
99
- validate_slots("Query", slots, []);
100
- const writable_props = [];
104
+ validate_slots('Query', slots, []);
105
+ let { article = null } = $$props;
106
+ console.log(article);
107
+ const writable_props = ['article'];
101
108
 
102
109
  Object.keys($$props).forEach(key => {
103
- if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<Query> was created with unknown prop '${key}'`);
110
+ if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<Query> was created with unknown prop '${key}'`);
104
111
  });
105
112
 
106
- $$self.$capture_state = () => ({ link, currentURL, name, $currentURL });
113
+ $$self.$$set = $$props => {
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
+ });
107
124
 
108
125
  $$self.$inject_state = $$props => {
109
- if ("name" in $$props) $$invalidate(0, name = $$props.name);
126
+ if ('article' in $$props) $$invalidate(1, article = $$props.article);
127
+ if ('name' in $$props) $$invalidate(0, name = $$props.name);
110
128
  };
111
129
 
112
130
  if ($$props && "$$inject" in $$props) {
@@ -114,18 +132,18 @@ function instance($$self, $$props, $$invalidate) {
114
132
  }
115
133
 
116
134
  $$self.$$.update = () => {
117
- if ($$self.$$.dirty & /*$currentURL*/ 2) {
118
- $$invalidate(0, name = $currentURL.searchParams.get("name") || "unknown");
135
+ if ($$self.$$.dirty & /*$currentURL*/ 4) {
136
+ $$invalidate(0, name = $currentURL.searchParams.get("name") || 'unknown');
119
137
  }
120
138
  };
121
139
 
122
- return [name, $currentURL];
140
+ return [name, article, $currentURL];
123
141
  }
124
142
 
125
143
  class Query extends SvelteComponentDev {
126
144
  constructor(options) {
127
145
  super(options);
128
- init(this, options, instance, create_fragment, safe_not_equal, {});
146
+ init(this, options, instance, create_fragment, safe_not_equal, { article: 1 });
129
147
 
130
148
  dispatch_dev("SvelteRegisterComponent", {
131
149
  component: this,
@@ -134,7 +152,15 @@ class Query extends SvelteComponentDev {
134
152
  id: create_fragment.name
135
153
  });
136
154
  }
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
+ }
137
163
  }
138
164
 
139
- export default Query;
165
+ export { Query as default };
140
166
  //# sourceMappingURL=Query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sources":["../Query.svelte"],"sourcesContent":["<script>\n import { link } from \"../src/link.js\";\n import { currentURL } from \"../src/stores.js\";\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":";;;;;;;;;;;;;;;;;;;;;;;;;;sBAU6B,GAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qDAAJ,GAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAN5B,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Query.js","sources":["../Query.svelte"],"sourcesContent":["<script>\n import { link } from \"../src/link.js\";\n import { currentURL } from \"../src/stores.js\";\n\n export let article = null;\n\n console.log(article);\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":";;;;;;;;;;;;;;;;;;;;;;;;;;aAcK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVpB,CAAA,IAAA,EAAA,OAAO,GAAG,IAAI,EAAA,GAAA,OAAA,CAAA;CAEzB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAElB,YAAA,CAAA,CAAA,EAAE,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAA,IAAK,SAAS,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}