solid-navigator 0.3.10 → 0.3.12

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
@@ -1,4 +1,4 @@
1
- import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, createEffect, on, useContext } from 'solid-js';
1
+ import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, splitProps, createEffect, on, useContext } from 'solid-js';
2
2
  import { delegateEvents, createComponent, spread, mergeProps as mergeProps$1, template } from 'solid-js/web';
3
3
  import { createStore, reconcile } from 'solid-js/store';
4
4
 
@@ -285,6 +285,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
285
285
  if (newPath.startsWith("./")) {
286
286
  newPath = currentPathname + "/" + newPath.slice(2);
287
287
  }
288
+ if (newPath.startsWith("../")) {
289
+ newPath = currentPathname + "/" + newPath.slice(3);
290
+ }
288
291
  if (options?.replace) {
289
292
  history.replaceState(options.state || null, "", newPath);
290
293
  } else {
@@ -370,8 +373,9 @@ var matchComponent = (name) => {
370
373
  return component();
371
374
  });
372
375
  };
373
- var _tmpl$ = /* @__PURE__ */ template(`<a sn-link>`);
376
+ var _tmpl$ = /* @__PURE__ */ template(`<a>`);
374
377
  var A = (props) => {
378
+ const [, rest] = splitProps(props, ["href", "state"]);
375
379
  const location2 = useLocation();
376
380
  const resolvedHref = () => {
377
381
  if (!props.href)
@@ -384,16 +388,20 @@ var A = (props) => {
384
388
  if (newPath.startsWith("./")) {
385
389
  newPath = currentPathname + "/" + newPath.slice(2);
386
390
  }
391
+ if (newPath.startsWith("../")) {
392
+ newPath = currentPathname + "/" + newPath.slice(3);
393
+ }
387
394
  return newPath;
388
395
  };
389
396
  return (() => {
390
397
  var _el$ = _tmpl$();
391
- spread(_el$, mergeProps$1(props, {
392
- get ["d-state"]() {
393
- return JSON.stringify(props.state);
394
- },
398
+ spread(_el$, mergeProps$1(rest, {
395
399
  get href() {
396
400
  return resolvedHref();
401
+ },
402
+ "sn-link": "",
403
+ get ["d-state"]() {
404
+ return JSON.stringify(props.state);
397
405
  }
398
406
  }), false, false);
399
407
  return _el$;
package/dist/dev.jsx CHANGED
@@ -291,6 +291,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
291
291
  if (newPath.startsWith("./")) {
292
292
  newPath = currentPathname + "/" + newPath.slice(2);
293
293
  }
294
+ if (newPath.startsWith("../")) {
295
+ newPath = currentPathname + "/" + newPath.slice(3);
296
+ }
294
297
  if (options?.replace) {
295
298
  history.replaceState(options.state || null, "", newPath);
296
299
  } else {
@@ -384,8 +387,9 @@ var matchComponent = (name) => {
384
387
  };
385
388
 
386
389
  // src/Link.tsx
387
- import { createMemo as createMemo5 } from "solid-js";
390
+ import { createMemo as createMemo5, splitProps } from "solid-js";
388
391
  var A = (props) => {
392
+ const [, rest] = splitProps(props, ["href", "state"]);
389
393
  const location2 = useLocation();
390
394
  const resolvedHref = () => {
391
395
  if (!props.href)
@@ -398,9 +402,12 @@ var A = (props) => {
398
402
  if (newPath.startsWith("./")) {
399
403
  newPath = currentPathname + "/" + newPath.slice(2);
400
404
  }
405
+ if (newPath.startsWith("../")) {
406
+ newPath = currentPathname + "/" + newPath.slice(3);
407
+ }
401
408
  return newPath;
402
409
  };
403
- return <a sn-link {...props} d-state={JSON.stringify(props.state)} href={resolvedHref()} />;
410
+ return <a {...rest} href={resolvedHref()} sn-link d-state={JSON.stringify(props.state)} />;
404
411
  };
405
412
  var useMatch = (path) => {
406
413
  const location2 = useLocation();
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, createEffect, on, useContext } from 'solid-js';
1
+ import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, splitProps, createEffect, on, useContext } from 'solid-js';
2
2
  import { delegateEvents, createComponent, spread, mergeProps as mergeProps$1, template } from 'solid-js/web';
3
3
  import { createStore, reconcile } from 'solid-js/store';
4
4
 
@@ -285,6 +285,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
285
285
  if (newPath.startsWith("./")) {
286
286
  newPath = currentPathname + "/" + newPath.slice(2);
287
287
  }
288
+ if (newPath.startsWith("../")) {
289
+ newPath = currentPathname + "/" + newPath.slice(3);
290
+ }
288
291
  if (options?.replace) {
289
292
  history.replaceState(options.state || null, "", newPath);
290
293
  } else {
@@ -366,8 +369,9 @@ var matchComponent = (name) => {
366
369
  return component();
367
370
  });
368
371
  };
369
- var _tmpl$ = /* @__PURE__ */ template(`<a sn-link>`);
372
+ var _tmpl$ = /* @__PURE__ */ template(`<a>`);
370
373
  var A = (props) => {
374
+ const [, rest] = splitProps(props, ["href", "state"]);
371
375
  const location2 = useLocation();
372
376
  const resolvedHref = () => {
373
377
  if (!props.href)
@@ -380,16 +384,20 @@ var A = (props) => {
380
384
  if (newPath.startsWith("./")) {
381
385
  newPath = currentPathname + "/" + newPath.slice(2);
382
386
  }
387
+ if (newPath.startsWith("../")) {
388
+ newPath = currentPathname + "/" + newPath.slice(3);
389
+ }
383
390
  return newPath;
384
391
  };
385
392
  return (() => {
386
393
  var _el$ = _tmpl$();
387
- spread(_el$, mergeProps$1(props, {
388
- get ["d-state"]() {
389
- return JSON.stringify(props.state);
390
- },
394
+ spread(_el$, mergeProps$1(rest, {
391
395
  get href() {
392
396
  return resolvedHref();
397
+ },
398
+ "sn-link": "",
399
+ get ["d-state"]() {
400
+ return JSON.stringify(props.state);
393
401
  }
394
402
  }), false, false);
395
403
  return _el$;
package/dist/index.jsx CHANGED
@@ -291,6 +291,9 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
291
291
  if (newPath.startsWith("./")) {
292
292
  newPath = currentPathname + "/" + newPath.slice(2);
293
293
  }
294
+ if (newPath.startsWith("../")) {
295
+ newPath = currentPathname + "/" + newPath.slice(3);
296
+ }
294
297
  if (options?.replace) {
295
298
  history.replaceState(options.state || null, "", newPath);
296
299
  } else {
@@ -381,8 +384,9 @@ var matchComponent = (name) => {
381
384
  };
382
385
 
383
386
  // src/Link.tsx
384
- import { createMemo as createMemo5 } from "solid-js";
387
+ import { createMemo as createMemo5, splitProps } from "solid-js";
385
388
  var A = (props) => {
389
+ const [, rest] = splitProps(props, ["href", "state"]);
386
390
  const location2 = useLocation();
387
391
  const resolvedHref = () => {
388
392
  if (!props.href)
@@ -395,9 +399,12 @@ var A = (props) => {
395
399
  if (newPath.startsWith("./")) {
396
400
  newPath = currentPathname + "/" + newPath.slice(2);
397
401
  }
402
+ if (newPath.startsWith("../")) {
403
+ newPath = currentPathname + "/" + newPath.slice(3);
404
+ }
398
405
  return newPath;
399
406
  };
400
- return <a sn-link {...props} d-state={JSON.stringify(props.state)} href={resolvedHref()} />;
407
+ return <a {...rest} href={resolvedHref()} sn-link d-state={JSON.stringify(props.state)} />;
401
408
  };
402
409
  var useMatch = (path) => {
403
410
  const location2 = useLocation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-navigator",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
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",