solid-navigator 0.2.0 → 0.2.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/dev.js CHANGED
@@ -140,8 +140,8 @@ function Router(props) {
140
140
  setHashAndSearch(getHashAndSearch());
141
141
  };
142
142
  const onClick = (event) => {
143
- const target = event.target;
144
- if (target.tagName !== "A")
143
+ const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
144
+ if (target?.tagName !== "A")
145
145
  return;
146
146
  if (!target.hasAttribute("sn-link"))
147
147
  return;
@@ -304,7 +304,10 @@ var Outlet = (props) => {
304
304
  }
305
305
  return component2;
306
306
  });
307
- return component;
307
+ const MemodComponent = createMemo(() => {
308
+ return component()();
309
+ });
310
+ return MemodComponent;
308
311
  };
309
312
  var Route = (props) => {
310
313
  const childRoutes = children(() => props.children).toArray;
package/dist/dev.jsx CHANGED
@@ -147,8 +147,8 @@ function Router(props) {
147
147
  setHashAndSearch(getHashAndSearch());
148
148
  };
149
149
  const onClick = (event) => {
150
- const target = event.target;
151
- if (target.tagName !== "A")
150
+ const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
151
+ if (target?.tagName !== "A")
152
152
  return;
153
153
  if (!target.hasAttribute("sn-link"))
154
154
  return;
@@ -167,7 +167,17 @@ function Router(props) {
167
167
  });
168
168
  });
169
169
  return <RouterContext.Provider
170
- value={{ routes, matched, navigate, params, location: loc, setHashAndSearch, setPathname, setQuery, query }}
170
+ value={{
171
+ routes,
172
+ matched,
173
+ navigate,
174
+ params,
175
+ location: loc,
176
+ setHashAndSearch,
177
+ setPathname,
178
+ setQuery,
179
+ query
180
+ }}
171
181
  >{props.root?.()}</RouterContext.Provider>;
172
182
  }
173
183
  var useRouterContext = () => {
@@ -271,7 +281,6 @@ var useSearchParams = () => {
271
281
  context.setQuery(reconcile3(query));
272
282
  const url = new URL(window.location.href);
273
283
  const newSearch = new URLSearchParams(context.query);
274
- ;
275
284
  url.search = newSearch.toString();
276
285
  navigate(url.pathname + url.search + url.hash);
277
286
  };
@@ -303,7 +312,10 @@ var Outlet = (props) => {
303
312
  }
304
313
  return component2;
305
314
  });
306
- return <>{component}</>;
315
+ const MemodComponent = createMemo3(() => {
316
+ return component()();
317
+ });
318
+ return <>{MemodComponent}</>;
307
319
  };
308
320
 
309
321
  // src/Route.ts
package/dist/index.js CHANGED
@@ -140,8 +140,8 @@ function Router(props) {
140
140
  setHashAndSearch(getHashAndSearch());
141
141
  };
142
142
  const onClick = (event) => {
143
- const target = event.target;
144
- if (target.tagName !== "A")
143
+ const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
144
+ if (target?.tagName !== "A")
145
145
  return;
146
146
  if (!target.hasAttribute("sn-link"))
147
147
  return;
@@ -301,7 +301,10 @@ var Outlet = (props) => {
301
301
  }
302
302
  return component2;
303
303
  });
304
- return component;
304
+ const MemodComponent = createMemo(() => {
305
+ return component()();
306
+ });
307
+ return MemodComponent;
305
308
  };
306
309
  var Route = (props) => {
307
310
  const childRoutes = children(() => props.children).toArray;
package/dist/index.jsx CHANGED
@@ -147,8 +147,8 @@ function Router(props) {
147
147
  setHashAndSearch(getHashAndSearch());
148
148
  };
149
149
  const onClick = (event) => {
150
- const target = event.target;
151
- if (target.tagName !== "A")
150
+ const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
151
+ if (target?.tagName !== "A")
152
152
  return;
153
153
  if (!target.hasAttribute("sn-link"))
154
154
  return;
@@ -167,7 +167,17 @@ function Router(props) {
167
167
  });
168
168
  });
169
169
  return <RouterContext.Provider
170
- value={{ routes, matched, navigate, params, location: loc, setHashAndSearch, setPathname, setQuery, query }}
170
+ value={{
171
+ routes,
172
+ matched,
173
+ navigate,
174
+ params,
175
+ location: loc,
176
+ setHashAndSearch,
177
+ setPathname,
178
+ setQuery,
179
+ query
180
+ }}
171
181
  >{props.root?.()}</RouterContext.Provider>;
172
182
  }
173
183
  var useRouterContext = () => {
@@ -270,7 +280,6 @@ var useSearchParams = () => {
270
280
  context.setQuery(reconcile3(query));
271
281
  const url = new URL(window.location.href);
272
282
  const newSearch = new URLSearchParams(context.query);
273
- ;
274
283
  url.search = newSearch.toString();
275
284
  navigate(url.pathname + url.search + url.hash);
276
285
  };
@@ -300,7 +309,10 @@ var Outlet = (props) => {
300
309
  }
301
310
  return component2;
302
311
  });
303
- return <>{component}</>;
312
+ const MemodComponent = createMemo3(() => {
313
+ return component()();
314
+ });
315
+ return <>{MemodComponent}</>;
304
316
  };
305
317
 
306
318
  // src/Route.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-navigator",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Solid Navigator is a library that is inspired by vue router and solid router.",
5
5
  "license": "MIT",
6
6
  "author": "SupertigerDev",