cradova 3.3.10 → 3.3.11

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ var makeElement = (element, ElementChildrenAndPropertyList) => {
124
124
  if (!href.includes("://")) {
125
125
  element.addEventListener("click", (e) => {
126
126
  e.preventDefault();
127
- Router.navigate(element.pathname);
127
+ Router.navigate(element.href);
128
128
  if (href.includes("#")) {
129
129
  const l = href.split("#").at(-1);
130
130
  document.getElementById("#" + l)?.scrollIntoView();
@@ -621,7 +621,7 @@ class RouterBoxClass {
621
621
  return;
622
622
  }
623
623
  async router(_e, _force) {
624
- let url = window.location.pathname, route, params;
624
+ let url = window.location.href, route, params;
625
625
  if (this.paused) {
626
626
  window.location.hash = "paused";
627
627
  return;
@@ -682,17 +682,16 @@ class RouterBoxClass {
682
682
  if (this.routes[url]) {
683
683
  return [this.routes[url], { path: url }];
684
684
  }
685
- if (this.routes[url + "/"]) {
686
- return [this.routes[url + "/"], { path: url }];
687
- }
688
- if (url.includes("/?")) {
689
- const sraw = [...new URLSearchParams(url).entries()];
690
- const search = {};
691
- for (const idx in sraw) {
692
- search[sraw[idx][0].includes("?") ? sraw[idx][0].split("?")[1] : sraw[idx][0]] = sraw[idx][1];
685
+ if (url.includes("?")) {
686
+ let search;
687
+ const params = {};
688
+ [url, search] = url.split("?");
689
+ new URLSearchParams(search).forEach((val, key) => {
690
+ params[key] = val;
691
+ });
692
+ if (this.routes[url]) {
693
+ return [this.routes[url], { data: params, path: url }];
693
694
  }
694
- const path = url.slice(0, url.indexOf("/?") + 2);
695
- return [this.routes[path], { path, search }];
696
695
  }
697
696
  for (const path in this.routes) {
698
697
  if (path.includes(":")) {
@@ -774,7 +773,7 @@ class Router {
774
773
  if (href.includes(".")) {
775
774
  window.location.href = href;
776
775
  } else {
777
- if (href === window.location.pathname) {
776
+ if (href === window.location.href) {
778
777
  return;
779
778
  }
780
779
  [route, params] = RouterBox.checker(href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.3.10",
3
+ "version": "3.3.11",
4
4
  "description": "Build Powerful ⚡ Web Apps with Ease",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",