cradova 3.3.18 → 3.3.20

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/index.js CHANGED
@@ -45,21 +45,18 @@ function $case(value, ...elements) {
45
45
  };
46
46
  }
47
47
  function $switch(key, ...cases) {
48
+ let elements;
48
49
  if (cases.length) {
49
50
  for (let i = 0;i < cases.length; i++) {
50
- const case_N = cases[i];
51
- const elements = case_N(key);
51
+ elements = cases[i](key);
52
52
  if (elements) {
53
- return elements;
53
+ break;
54
54
  }
55
55
  }
56
56
  }
57
- return;
57
+ return elements;
58
58
  }
59
59
  function loop(datalist, component) {
60
- if (typeof component !== "function") {
61
- throw new Error(" \u2718 Cradova err : Invalid component type, must be a function that returns html ");
62
- }
63
60
  return Array.isArray(datalist) ? datalist.map(component) : undefined;
64
61
  }
65
62
  function useState(newState, Comp2) {
@@ -200,7 +197,6 @@ var frag = function(children) {
200
197
  continue;
201
198
  }
202
199
  console.error(" \u2718 Cradova err: wrong element type" + html);
203
- throw new TypeError(" \u2718 Cradova err: invalid element");
204
200
  }
205
201
  return par;
206
202
  };
@@ -607,7 +603,6 @@ class RouterBoxClass {
607
603
  if (typeof page !== "undefined") {
608
604
  if (page && !page) {
609
605
  console.error(" \u2718 Cradova err: not a valid page ", page);
610
- throw new Error(" \u2718 Cradova err: Not a valid cradova page component");
611
606
  }
612
607
  return this.routes[path] = page;
613
608
  }
@@ -619,9 +614,6 @@ class RouterBoxClass {
619
614
  window.location.hash = "paused";
620
615
  return;
621
616
  }
622
- if (url === this.lastNavigatedRoute) {
623
- return;
624
- }
625
617
  if (this.nextRouteController) {
626
618
  route = this.nextRouteController;
627
619
  this.nextRouteController = undefined;
@@ -760,15 +752,12 @@ class Router {
760
752
  }
761
753
  static navigate(href, data = null) {
762
754
  if (typeof href !== "string") {
763
- throw new TypeError(" \u2718 Cradova err: href must be a defined path but got " + href + " instead");
755
+ console.error(" \u2718 Cradova err: href must be a defined path but got " + href + " instead");
764
756
  }
765
757
  let route = null, params;
766
758
  if (href.includes(".")) {
767
759
  window.location.href = href;
768
760
  } else {
769
- if (href === window.location.href) {
770
- return;
771
- }
772
761
  [route, params] = RouterBox.checker(href);
773
762
  if (route) {
774
763
  RouterBox.nextRouteController = route;
@@ -10,8 +10,8 @@ export declare function Rhoda(l: VJS_params_TYPE<HTMLElement>): DocumentFragment
10
10
  */
11
11
  export declare function $if<E>(condition: any, ...elements: VJS_params_TYPE<E>): any;
12
12
  export declare function $ifelse(condition: any, ifTrue: any, ifFalse?: any): any;
13
- export declare function $case<E>(value: any, ...elements: VJS_params_TYPE<E>): (key: any) => VJS_params_TYPE<E> | undefined;
14
- export declare function $switch(key: unknown, ...cases: ((key: any) => HTMLElement[] | undefined)[]): HTMLElement[] | undefined;
13
+ export declare function $case<E = HTMLElement>(value: any, ...elements: VJS_params_TYPE<E>): (key: any) => VJS_params_TYPE<E> | undefined;
14
+ export declare function $switch(key: unknown, ...cases: ((key: any) => any)[]): any;
15
15
  type LoopData<Type> = Type[];
16
16
  export declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
17
17
  /** Calculate a simple numerical representation of the URL */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.3.18",
3
+ "version": "3.3.20",
4
4
  "description": "Build Powerful ⚡ Web Apps with Ease",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",