solid-navigator 0.3.2 → 0.3.4

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
@@ -163,8 +163,10 @@ function Router(props) {
163
163
  return;
164
164
  if (!target.hasAttribute("sn-link"))
165
165
  return;
166
- event.preventDefault();
167
166
  const href = target.getAttribute("href") || "";
167
+ if (href.startsWith("http://") || href.startsWith("https://"))
168
+ return;
169
+ event.preventDefault();
168
170
  navigate(href, {
169
171
  replace: target.hasAttribute("replace")
170
172
  });
@@ -297,7 +299,7 @@ var Navigate = (props) => {
297
299
  navigate(props.href, { replace: true });
298
300
  return null;
299
301
  };
300
- var useSearchParams = () => {
302
+ function useSearchParams() {
301
303
  const context = useRouterContext();
302
304
  const navigate = useNavigate();
303
305
  const updateQuery = (query) => {
@@ -308,7 +310,7 @@ var useSearchParams = () => {
308
310
  navigate(url.pathname + url.search + url.hash);
309
311
  };
310
312
  return [context.location.query, updateQuery];
311
- };
313
+ }
312
314
  var Fragment = () => [];
313
315
  var Outlet = (props) => {
314
316
  const context = useRouterContext();
package/dist/dev.jsx CHANGED
@@ -170,8 +170,10 @@ function Router(props) {
170
170
  return;
171
171
  if (!target.hasAttribute("sn-link"))
172
172
  return;
173
- event.preventDefault();
174
173
  const href = target.getAttribute("href") || "";
174
+ if (href.startsWith("http://") || href.startsWith("https://"))
175
+ return;
176
+ event.preventDefault();
175
177
  navigate(href, {
176
178
  replace: target.hasAttribute("replace")
177
179
  });
@@ -299,7 +301,7 @@ var Navigate = (props) => {
299
301
  navigate(props.href, { replace: true });
300
302
  return null;
301
303
  };
302
- var useSearchParams = () => {
304
+ function useSearchParams() {
303
305
  const context = useRouterContext();
304
306
  const navigate = useNavigate();
305
307
  const updateQuery = (query) => {
@@ -310,7 +312,7 @@ var useSearchParams = () => {
310
312
  navigate(url.pathname + url.search + url.hash);
311
313
  };
312
314
  return [context.location.query, updateQuery];
313
- };
315
+ }
314
316
 
315
317
  // src/Outlet.tsx
316
318
  import { createMemo as createMemo3 } from "solid-js";
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ declare const useNavigate: () => (path: string, options?: NavigateOptions | unde
19
19
  declare const Navigate: (props: {
20
20
  href: string;
21
21
  }) => null;
22
- declare const useSearchParams: () => readonly [Record<string, string>, (query: Record<string, string>) => void];
22
+ declare function useSearchParams<T = Record<string, string>>(): readonly [T, (query: T) => void];
23
23
 
24
24
  declare const Outlet: (props: {
25
25
  children?: string;
package/dist/index.js CHANGED
@@ -163,8 +163,10 @@ function Router(props) {
163
163
  return;
164
164
  if (!target.hasAttribute("sn-link"))
165
165
  return;
166
- event.preventDefault();
167
166
  const href = target.getAttribute("href") || "";
167
+ if (href.startsWith("http://") || href.startsWith("https://"))
168
+ return;
169
+ event.preventDefault();
168
170
  navigate(href, {
169
171
  replace: target.hasAttribute("replace")
170
172
  });
@@ -295,7 +297,7 @@ var Navigate = (props) => {
295
297
  navigate(props.href, { replace: true });
296
298
  return null;
297
299
  };
298
- var useSearchParams = () => {
300
+ function useSearchParams() {
299
301
  const context = useRouterContext();
300
302
  const navigate = useNavigate();
301
303
  const updateQuery = (query) => {
@@ -306,7 +308,7 @@ var useSearchParams = () => {
306
308
  navigate(url.pathname + url.search + url.hash);
307
309
  };
308
310
  return [context.location.query, updateQuery];
309
- };
311
+ }
310
312
  var Fragment = () => [];
311
313
  var Outlet = (props) => {
312
314
  const context = useRouterContext();
package/dist/index.jsx CHANGED
@@ -170,8 +170,10 @@ function Router(props) {
170
170
  return;
171
171
  if (!target.hasAttribute("sn-link"))
172
172
  return;
173
- event.preventDefault();
174
173
  const href = target.getAttribute("href") || "";
174
+ if (href.startsWith("http://") || href.startsWith("https://"))
175
+ return;
176
+ event.preventDefault();
175
177
  navigate(href, {
176
178
  replace: target.hasAttribute("replace")
177
179
  });
@@ -298,7 +300,7 @@ var Navigate = (props) => {
298
300
  navigate(props.href, { replace: true });
299
301
  return null;
300
302
  };
301
- var useSearchParams = () => {
303
+ function useSearchParams() {
302
304
  const context = useRouterContext();
303
305
  const navigate = useNavigate();
304
306
  const updateQuery = (query) => {
@@ -309,7 +311,7 @@ var useSearchParams = () => {
309
311
  navigate(url.pathname + url.search + url.hash);
310
312
  };
311
313
  return [context.location.query, updateQuery];
312
- };
314
+ }
313
315
 
314
316
  // src/Outlet.tsx
315
317
  import { createMemo as createMemo3 } from "solid-js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-navigator",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
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",