cradova 3.6.7 → 3.6.8

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
@@ -430,7 +430,7 @@ class Page {
430
430
  _dropped = false;
431
431
  _snapshot;
432
432
  _snapshot_html;
433
- _de_active_CB;
433
+ _unload_CB;
434
434
  constructor(pageParams) {
435
435
  const { template, name } = pageParams;
436
436
  if (typeof template !== "function") {
@@ -474,7 +474,7 @@ class Page {
474
474
  this._snapshot_html = undefined;
475
475
  }
476
476
  set onDeactivate(cb) {
477
- this._de_active_CB = cb;
477
+ this._unload_CB = cb;
478
478
  }
479
479
  drop(state) {
480
480
  if (typeof state === "boolean") {
@@ -483,7 +483,7 @@ class Page {
483
483
  } else
484
484
  return this._dropped;
485
485
  }
486
- async _activate() {
486
+ async _load() {
487
487
  if (this._dropped) {
488
488
  history.go(-1);
489
489
  return;
@@ -542,7 +542,7 @@ class RouterBoxClass {
542
542
  try {
543
543
  if (typeof route === "function") {
544
544
  if (this.loadingPage instanceof Page) {
545
- await this.loadingPage._activate();
545
+ await this.loadingPage._load();
546
546
  }
547
547
  route = await route();
548
548
  }
@@ -557,8 +557,8 @@ class RouterBoxClass {
557
557
  if (params) {
558
558
  this.pageData.params = params;
559
559
  }
560
- await route._activate();
561
- this.lastNavigatedRouteController && this.lastNavigatedRouteController._de_active_CB?.();
560
+ await route._load();
561
+ this.lastNavigatedRouteController && this.lastNavigatedRouteController._unload_CB?.();
562
562
  this.lastNavigatedRoute = url;
563
563
  this.lastNavigatedRouteController = route;
564
564
  } catch (error) {
@@ -570,7 +570,7 @@ class RouterBoxClass {
570
570
  }
571
571
  } else {
572
572
  if (this.routes["*"]) {
573
- await this.routes["*"]._activate();
573
+ await this.routes["*"]._load();
574
574
  }
575
575
  }
576
576
  }
@@ -3,25 +3,23 @@ import type { browserPageType, CradovaPageType } from "./types.js";
3
3
  * Cradova event
4
4
  */
5
5
  export declare class cradovaEvent {
6
- /**
7
- * the events runs only once and removed to avoid duplication when added on the next rendering
8
- * these event are call and removed once when when a Function is rendered to the dom
9
- * @param callback
10
- */
11
- after_comp_is_mounted: Function[];
12
- /**
13
- * the events runs once after comps unmounts.
14
- * these event are called before a Function is rendered to the dom
15
- * @param callback
16
- */
17
- after_page_is_killed: Function[];
18
- /**
19
- * Dispatch any event
20
- * @param eventName
21
- */
22
- dispatchEvent(
23
- eventName: "after_comp_is_mounted" | "after_page_is_killed",
24
- ): void;
6
+ /**
7
+ * the events runs only once and removed to avoid duplication when added on the next rendering
8
+ * these event are call and removed once when when a Function is rendered to the dom
9
+ * @param callback
10
+ */
11
+ after_comp_is_mounted: Function[];
12
+ /**
13
+ * the events runs once after comps unmounts.
14
+ * these event are called before a Function is rendered to the dom
15
+ * @param callback
16
+ */
17
+ after_page_is_killed: Function[];
18
+ /**
19
+ * Dispatch any event
20
+ * @param eventName
21
+ */
22
+ dispatchEvent(eventName: "after_comp_is_mounted" | "after_page_is_killed"): void;
25
23
  }
26
24
  export declare const CradovaEvent: cradovaEvent;
27
25
  /**
@@ -35,41 +33,41 @@ export declare const CradovaEvent: cradovaEvent;
35
33
  * @constructor initial: Record<string, any>, props: {persist}
36
34
  */
37
35
  export declare class Signal<Type extends Record<string, any>> {
38
- private pn?;
39
- private subs?;
40
- pipe: Type;
41
- constructor(initial: Type, props?: {
42
- persistName?: string | undefined;
43
- });
44
- /**
45
- * Cradova Signal
46
- * ----
47
- * fires an action if available
48
- * @param key - string key of the action
49
- * @param data - data for the action
50
- */
51
- publish<T extends keyof Type>(eventName: T, data: Type[T]): void;
52
- /**
53
- * Cradova Signal
54
- * ----
55
- * fires actions if any available
56
- */
57
- batchPublish<T extends keyof Type>(events: Record<T, Type[T]>): void;
58
- /**
59
- * Cradova Signal
60
- * ----
61
- * subscribe to an event
62
- *
63
- * @param name of event.
64
- * @param Func component to bind to.
65
- */
66
- subscribe<T extends keyof Type>(eventName: T | T[], comp: any): void;
67
- /**
68
- * Cradova Signal
69
- * ----
70
- * clear the history on local storage
71
- */
72
- clearPersist(): void;
36
+ private pn?;
37
+ private subs?;
38
+ pipe: Type;
39
+ constructor(initial: Type, props?: {
40
+ persistName?: string | undefined;
41
+ });
42
+ /**
43
+ * Cradova Signal
44
+ * ----
45
+ * fires an action if available
46
+ * @param key - string key of the action
47
+ * @param data - data for the action
48
+ */
49
+ publish<T extends keyof Type>(eventName: T, data: Type[T]): void;
50
+ /**
51
+ * Cradova Signal
52
+ * ----
53
+ * fires actions if any available
54
+ */
55
+ batchPublish<T extends keyof Type>(events: Record<T, Type[T]>): void;
56
+ /**
57
+ * Cradova Signal
58
+ * ----
59
+ * subscribe to an event
60
+ *
61
+ * @param name of event.
62
+ * @param Func component to bind to.
63
+ */
64
+ subscribe<T extends keyof Type>(eventName: T | T[], comp: any): void;
65
+ /**
66
+ * Cradova Signal
67
+ * ----
68
+ * clear the history on local storage
69
+ */
70
+ clearPersist(): void;
73
71
  }
74
72
  /**
75
73
  * Cradova Page
@@ -79,22 +77,21 @@ export declare class Signal<Type extends Record<string, any>> {
79
77
  * @param template
80
78
  */
81
79
  export declare class Page {
82
- /**
83
- * used internally
84
- */
85
- private _name;
86
- _html: (this: Page) => HTMLElement;
87
- _template?: HTMLElement;
88
- private _dropped;
89
- private _snapshot;
90
- private _snapshot_html?;
91
- _de_active_CB?: () => Promise<void> | void;
92
- constructor(pageParams: CradovaPageType);
93
- private _takeSnapShot;
94
- set onDeactivate(cb: () => Promise<void> | void);
95
- drop(state?: boolean): boolean | undefined;
96
- /** @internal */
97
- _activate(): Promise<void>;
80
+ /**
81
+ * used internally
82
+ */
83
+ private _name;
84
+ _html: (this: Page) => HTMLElement;
85
+ _template?: HTMLElement;
86
+ private _dropped;
87
+ private _snapshot;
88
+ private _snapshot_html?;
89
+ _unload_CB?: () => Promise<void> | void;
90
+ constructor(pageParams: CradovaPageType);
91
+ private _takeSnapShot;
92
+ set onDeactivate(cb: () => Promise<void> | void);
93
+ drop(state?: boolean): boolean | undefined;
94
+ _load(): Promise<void>;
98
95
  }
99
96
  /** cradova router
100
97
  * ---
@@ -104,69 +101,65 @@ export declare class Page {
104
101
  * @param page the cradova document tree for the route.
105
102
  */
106
103
  export declare class Router {
107
- /**
108
- * cradova router
109
- * ---
110
- * Registers a route.
111
- *
112
- * accepts an object containing pat and page
113
- */
114
- static BrowserRoutes(
115
- obj: Record<string, browserPageType<Page | unknown>>,
116
- ): void;
117
- /**
104
+ /**
105
+ * cradova router
106
+ * ---
107
+ * Registers a route.
108
+ *
109
+ * accepts an object containing pat and page
110
+ */
111
+ static BrowserRoutes(obj: Record<string, browserPageType<Page | unknown>>): void;
112
+ /**
118
113
  Pause navigation
119
114
  */
120
- static pauseNavigation(): void;
121
- /**
115
+ static pauseNavigation(): void;
116
+ /**
122
117
  resume navigation
123
118
  */
124
- static resumeNavigation(): void;
125
- /**
126
- * Cradova Router
127
- * ------
128
- *
129
- * Navigates to a designated page in your app
130
- *
131
- * @param href string
132
- * @param data object
133
- * @param force boolean
134
- */
135
- static navigate(href: string, data?: Record<string, any>): void;
136
- /**
137
- * Cradova
138
- * ---
139
- * Loading page for your app
140
- *
141
- * lazy loaded loading use
142
- *
143
- * @param page
144
- */
145
- static setLoadingPage(page: Page): void;
146
- /**
147
- * Cradova Router
148
- * ------
149
- *
150
- * return last set router params
151
- *
152
- * .
153
- */
154
- static get PageData(): {
155
- params: Record<string, string>;
156
- data?: Record<string, any>;
157
- };
158
- /**
159
- * Cradova
160
- * ---
161
- * Error Handler for your app
162
- *
163
- * @param callback
164
- * @param path? page path
165
- */
166
- static addErrorHandler(
167
- callback: (err?: unknown, pagePath?: string) => void,
168
- ): void;
169
- static _mount(): void;
119
+ static resumeNavigation(): void;
120
+ /**
121
+ * Cradova Router
122
+ * ------
123
+ *
124
+ * Navigates to a designated page in your app
125
+ *
126
+ * @param href string
127
+ * @param data object
128
+ * @param force boolean
129
+ */
130
+ static navigate(href: string, data?: Record<string, any>): void;
131
+ /**
132
+ * Cradova
133
+ * ---
134
+ * Loading page for your app
135
+ *
136
+ * lazy loaded loading use
137
+ *
138
+ * @param page
139
+ */
140
+ static setLoadingPage(page: Page): void;
141
+ /**
142
+ * Cradova Router
143
+ * ------
144
+ *
145
+ * return last set router params
146
+ *
147
+ * .
148
+ */
149
+ static get PageData(): {
150
+ params: Record<string, string>;
151
+ data?: Record<string, any>;
152
+ };
153
+ /**
154
+ * Cradova
155
+ * ---
156
+ * Error Handler for your app
157
+ *
158
+ * @param callback
159
+ * @param path? page path
160
+ */
161
+ static addErrorHandler(callback: (err?: unknown, pagePath?: string) => void): void;
162
+ static _mount(): void;
170
163
  }
171
164
  /**
172
165
  * Cradova
@@ -174,23 +167,21 @@ export declare class Router {
174
167
  * make reference to dom elements
175
168
  */
176
169
  export declare class __raw_ref {
177
- tree: Record<string, any>;
178
- /**
179
- * Bind a DOM element to a reference name.
180
- * @param name - The name to reference the DOM element by.
181
- */
182
- bindAs(name: string): __raw_ref;
183
- /**
184
- * Retrieve a referenced DOM element.
185
- * @param name - The name of the referenced DOM element.
186
- */
187
- elem<ElementType extends HTMLElement = HTMLElement>(
188
- name: string,
189
- ): ElementType | undefined;
190
- /**
191
- * Append a DOM element to the reference, overwriting any existing reference.
192
- * @param name - The name to reference the DOM element by.
193
- * @param element - The DOM element to reference.
194
- */
195
- _append(name: string, Element: HTMLElement): void;
170
+ tree: Record<string, any>;
171
+ /**
172
+ * Bind a DOM element to a reference name.
173
+ * @param name - The name to reference the DOM element by.
174
+ */
175
+ bindAs(name: string): __raw_ref;
176
+ /**
177
+ * Retrieve a referenced DOM element.
178
+ * @param name - The name of the referenced DOM element.
179
+ */
180
+ elem<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType | undefined;
181
+ /**
182
+ * Append a DOM element to the reference, overwriting any existing reference.
183
+ * @param name - The name to reference the DOM element by.
184
+ * @param element - The DOM element to reference.
185
+ */
186
+ _append(name: string, Element: HTMLElement): void;
196
187
  }
@@ -1,113 +1,38 @@
1
1
  import { type VJS_params_TYPE } from "./types.js";
2
- export declare const a: (
3
- ...Children_and_Properties: VJS_params_TYPE<HTMLAnchorElement>
4
- ) => HTMLAnchorElement;
5
- export declare const audio: (
6
- ...Children_and_Properties: VJS_params_TYPE<HTMLAudioElement>
7
- ) => HTMLAudioElement;
8
- export declare const button: (
9
- ...Children_and_Properties: VJS_params_TYPE<HTMLButtonElement>
10
- ) => HTMLButtonElement;
11
- export declare const canvas: (
12
- ...Children_and_Properties: VJS_params_TYPE<HTMLCanvasElement>
13
- ) => HTMLCanvasElement;
14
- export declare const div: (
15
- ...Children_and_Properties: VJS_params_TYPE<HTMLDivElement>
16
- ) => HTMLDivElement;
17
- export declare const footer: (
18
- ...Children_and_Properties: VJS_params_TYPE<HTMLElement>
19
- ) => HTMLElement;
20
- export declare const form: (
21
- ...Children_and_Properties: VJS_params_TYPE<HTMLFormElement>
22
- ) => HTMLFormElement;
23
- export declare const h1: (
24
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
25
- ) => HTMLHeadingElement;
26
- export declare const h2: (
27
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
28
- ) => HTMLHeadingElement;
29
- export declare const h3: (
30
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
31
- ) => HTMLHeadingElement;
32
- export declare const h4: (
33
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
34
- ) => HTMLHeadingElement;
35
- export declare const h5: (
36
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
37
- ) => HTMLHeadingElement;
38
- export declare const h6: (
39
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
40
- ) => HTMLHeadingElement;
41
- export declare const header: (
42
- ...Children_and_Properties: VJS_params_TYPE<HTMLHeadElement>
43
- ) => HTMLHeadElement;
44
- export declare const i: (
45
- ...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>
46
- ) => HTMLLIElement;
47
- export declare const iframe: (
48
- ...Children_and_Properties: VJS_params_TYPE<HTMLIFrameElement>
49
- ) => HTMLIFrameElement;
50
- export declare const img: (
51
- ...Children_and_Properties: VJS_params_TYPE<HTMLImageElement>
52
- ) => HTMLImageElement;
53
- export declare const input: (
54
- ...Children_and_Properties: VJS_params_TYPE<HTMLInputElement>
55
- ) => HTMLInputElement;
56
- export declare const label: (
57
- ...Children_and_Properties: VJS_params_TYPE<HTMLLabelElement>
58
- ) => HTMLLabelElement;
59
- export declare const li: (
60
- ...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>
61
- ) => HTMLLIElement;
62
- export declare const main: (
63
- ...Children_and_Properties: VJS_params_TYPE<HTMLElement>
64
- ) => HTMLElement;
65
- export declare const nav: (
66
- ...Children_and_Properties: VJS_params_TYPE<HTMLElement>
67
- ) => HTMLElement;
68
- export declare const ol: (
69
- ...Children_and_Properties: VJS_params_TYPE<HTMLOListElement>
70
- ) => HTMLOListElement;
71
- export declare const option: (
72
- ...Children_and_Properties: VJS_params_TYPE<HTMLOptionElement>
73
- ) => HTMLOptionElement;
74
- export declare const p: (
75
- ...Children_and_Properties: VJS_params_TYPE<HTMLParagraphElement>
76
- ) => HTMLParagraphElement;
77
- export declare const section: (
78
- ...Children_and_Properties: VJS_params_TYPE<HTMLElement>
79
- ) => HTMLElement;
80
- export declare const select: (
81
- ...Children_and_Properties: VJS_params_TYPE<HTMLSelectElement>
82
- ) => HTMLSelectElement;
83
- export declare const span: (
84
- ...Children_and_Properties: VJS_params_TYPE<HTMLSpanElement>
85
- ) => HTMLSpanElement;
86
- export declare const textarea: (
87
- ...Children_and_Properties: VJS_params_TYPE<HTMLTextAreaElement>
88
- ) => HTMLTextAreaElement;
89
- export declare const ul: (
90
- ...Children_and_Properties: VJS_params_TYPE<HTMLUListElement>
91
- ) => HTMLUListElement;
92
- export declare const video: (
93
- ...Children_and_Properties: VJS_params_TYPE<HTMLVideoElement>
94
- ) => HTMLVideoElement;
95
- export declare const tbody: (
96
- ...Children_and_Properties: VJS_params_TYPE<HTMLTableElement>
97
- ) => HTMLTableElement;
98
- export declare const table: (
99
- ...Children_and_Properties: VJS_params_TYPE<HTMLTableSectionElement>
100
- ) => HTMLTableSectionElement;
101
- export declare const td: (
102
- ...Children_and_Properties: VJS_params_TYPE<HTMLTableCellElement>
103
- ) => HTMLTableCellElement;
104
- export declare const tr: (
105
- ...Children_and_Properties: VJS_params_TYPE<HTMLTableColElement>
106
- ) => HTMLTableColElement;
107
- export declare const svg: (
108
- svg: string,
109
- properties?: VJS_params_TYPE<HTMLSpanElement>,
110
- ) => HTMLSpanElement;
111
- export declare const raw: (
112
- html: string | TemplateStringsArray,
113
- ) => DocumentFragment;
2
+ export declare const a: (...Children_and_Properties: VJS_params_TYPE<HTMLAnchorElement>) => HTMLAnchorElement;
3
+ export declare const audio: (...Children_and_Properties: VJS_params_TYPE<HTMLAudioElement>) => HTMLAudioElement;
4
+ export declare const button: (...Children_and_Properties: VJS_params_TYPE<HTMLButtonElement>) => HTMLButtonElement;
5
+ export declare const canvas: (...Children_and_Properties: VJS_params_TYPE<HTMLCanvasElement>) => HTMLCanvasElement;
6
+ export declare const div: (...Children_and_Properties: VJS_params_TYPE<HTMLDivElement>) => HTMLDivElement;
7
+ export declare const footer: (...Children_and_Properties: VJS_params_TYPE<HTMLElement>) => HTMLElement;
8
+ export declare const form: (...Children_and_Properties: VJS_params_TYPE<HTMLFormElement>) => HTMLFormElement;
9
+ export declare const h1: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
10
+ export declare const h2: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
11
+ export declare const h3: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
12
+ export declare const h4: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
13
+ export declare const h5: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
14
+ export declare const h6: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>) => HTMLHeadingElement;
15
+ export declare const header: (...Children_and_Properties: VJS_params_TYPE<HTMLHeadElement>) => HTMLHeadElement;
16
+ export declare const i: (...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>) => HTMLLIElement;
17
+ export declare const iframe: (...Children_and_Properties: VJS_params_TYPE<HTMLIFrameElement>) => HTMLIFrameElement;
18
+ export declare const img: (...Children_and_Properties: VJS_params_TYPE<HTMLImageElement>) => HTMLImageElement;
19
+ export declare const input: (...Children_and_Properties: VJS_params_TYPE<HTMLInputElement>) => HTMLInputElement;
20
+ export declare const label: (...Children_and_Properties: VJS_params_TYPE<HTMLLabelElement>) => HTMLLabelElement;
21
+ export declare const li: (...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>) => HTMLLIElement;
22
+ export declare const main: (...Children_and_Properties: VJS_params_TYPE<HTMLElement>) => HTMLElement;
23
+ export declare const nav: (...Children_and_Properties: VJS_params_TYPE<HTMLElement>) => HTMLElement;
24
+ export declare const ol: (...Children_and_Properties: VJS_params_TYPE<HTMLOListElement>) => HTMLOListElement;
25
+ export declare const option: (...Children_and_Properties: VJS_params_TYPE<HTMLOptionElement>) => HTMLOptionElement;
26
+ export declare const p: (...Children_and_Properties: VJS_params_TYPE<HTMLParagraphElement>) => HTMLParagraphElement;
27
+ export declare const section: (...Children_and_Properties: VJS_params_TYPE<HTMLElement>) => HTMLElement;
28
+ export declare const select: (...Children_and_Properties: VJS_params_TYPE<HTMLSelectElement>) => HTMLSelectElement;
29
+ export declare const span: (...Children_and_Properties: VJS_params_TYPE<HTMLSpanElement>) => HTMLSpanElement;
30
+ export declare const textarea: (...Children_and_Properties: VJS_params_TYPE<HTMLTextAreaElement>) => HTMLTextAreaElement;
31
+ export declare const ul: (...Children_and_Properties: VJS_params_TYPE<HTMLUListElement>) => HTMLUListElement;
32
+ export declare const video: (...Children_and_Properties: VJS_params_TYPE<HTMLVideoElement>) => HTMLVideoElement;
33
+ export declare const tbody: (...Children_and_Properties: VJS_params_TYPE<HTMLTableElement>) => HTMLTableElement;
34
+ export declare const table: (...Children_and_Properties: VJS_params_TYPE<HTMLTableSectionElement>) => HTMLTableSectionElement;
35
+ export declare const td: (...Children_and_Properties: VJS_params_TYPE<HTMLTableCellElement>) => HTMLTableCellElement;
36
+ export declare const tr: (...Children_and_Properties: VJS_params_TYPE<HTMLTableColElement>) => HTMLTableColElement;
37
+ export declare const svg: (svg: string, properties?: VJS_params_TYPE<HTMLSpanElement>) => HTMLSpanElement;
38
+ export declare const raw: (html: string | TemplateStringsArray) => DocumentFragment;
@@ -1,50 +1,23 @@
1
1
  import type { Func, VJS_params_TYPE } from "./types.js";
2
2
  import { __raw_ref } from "./classes.js";
3
- export declare const makeElement: <E extends HTMLElement>(
4
- element: E & HTMLElement,
5
- ElementChildrenAndPropertyList: VJS_params_TYPE<E>,
6
- ) => E;
7
- export declare const cra: <E extends HTMLElement>(
8
- tag: string,
9
- ) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
3
+ export declare const makeElement: <E extends HTMLElement>(element: E & HTMLElement, ElementChildrenAndPropertyList: VJS_params_TYPE<E>) => E;
4
+ export declare const cra: <E extends HTMLElement>(tag: string) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
10
5
  /**
11
6
  * @param {expression} condition
12
7
  * @param {function} elements[]
13
8
  */
14
- export declare function $if<E extends HTMLElement>(
15
- condition: any,
16
- ...elements: VJS_params_TYPE<E>
17
- ): any;
18
- export declare function $ifelse(
19
- condition: any,
20
- ifTrue: any,
21
- ifFalse?: any,
22
- ): any;
23
- export declare function $case<E extends HTMLElement = HTMLElement>(
24
- value: any,
25
- ...elements: VJS_params_TYPE<E>
26
- ): (key: any) => VJS_params_TYPE<E> | undefined;
27
- export declare function $switch(
28
- key: unknown,
29
- ...cases: ((key: any) => any)[]
30
- ): any;
9
+ export declare function $if<E extends HTMLElement>(condition: any, ...elements: VJS_params_TYPE<E>): any;
10
+ export declare function $ifelse(condition: any, ifTrue: any, ifFalse?: any): any;
11
+ export declare function $case<E extends HTMLElement = HTMLElement>(value: any, ...elements: VJS_params_TYPE<E>): (key: any) => VJS_params_TYPE<E> | undefined;
12
+ export declare function $switch(key: unknown, ...cases: ((key: any) => any)[]): any;
31
13
  type LoopData<Type> = Type[];
32
- export declare function loop<Type>(
33
- datalist: LoopData<Type>,
34
- component: (
35
- value: Type,
36
- index?: number,
37
- array?: LoopData<Type>,
38
- ) => HTMLElement | DocumentFragment | undefined,
39
- ): HTMLElement[] | undefined;
14
+ export declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
40
15
  /**
41
16
  * Document fragment
42
17
  * @param children
43
18
  * @returns
44
19
  */
45
- export declare const frag: (
46
- children: VJS_params_TYPE<HTMLElement>,
47
- ) => DocumentFragment;
20
+ export declare const frag: (children: VJS_params_TYPE<HTMLElement>) => DocumentFragment;
48
21
  /**
49
22
  * Cradova
50
23
  * ---
@@ -53,10 +26,7 @@ export declare const frag: (
53
26
  * @param Func
54
27
  * @returns [state, setState]
55
28
  */
56
- export declare function useState<S = unknown>(
57
- newState: S,
58
- self: any,
59
- ): [S, (newState: S | ((preS: S) => S)) => void];
29
+ export declare function useState<S = unknown>(newState: S, self: any): [S, (newState: S | ((preS: S) => S)) => void];
60
30
  /**
61
31
  * Cradova
62
32
  * ---
@@ -75,10 +45,10 @@ export declare function useRef(): __raw_ref;
75
45
  export declare const getSignal: (name: string, func: Func) => any;
76
46
  export declare const sendSignal: (name: string, data: any, func: Func) => void;
77
47
  export declare const funcManager: {
78
- render(func: Func): HTMLElement;
79
- _effect(func: Func, fn: () => Promise<void> | void): void;
80
- effector(func: Func): Promise<void>;
81
- recall(func: Func): void;
82
- activate(func: Func): Promise<void>;
48
+ render(func: Func): HTMLElement;
49
+ _effect(func: Func, fn: () => Promise<void> | void): void;
50
+ effector(func: Func): Promise<void>;
51
+ recall(func: Func): void;
52
+ activate(func: Func): Promise<void>;
83
53
  };
84
54
  export {};
@@ -1,119 +1,95 @@
1
1
  import * as CSS from "csstype";
2
2
  import { __raw_ref, Page, Signal } from "./classes.js";
3
3
  type Attributes<E> = {
4
- src?: string;
5
- alt?: string;
6
- for?: string;
7
- rel?: string;
8
- href?: string;
9
- type?: string;
10
- name?: string;
11
- rows?: string;
12
- value?: string;
13
- accept: string;
14
- action?: string;
15
- target?: string;
16
- method?: string;
17
- checked?: boolean;
18
- required?: string;
19
- frameBorder?: string;
20
- placeholder?: string;
21
- ref?: __raw_ref;
22
- autocomplete?: string;
23
- style?: CSS.Properties;
24
- recall?: (P: any) => void;
25
- [key: `data-${string}` | `data-${string}`]: string | undefined;
26
- [key: `on${string}`]: (this: E) => void;
27
- /**
28
- * Cradova calls this function when this element is rendered on the DOM.
29
- */
30
- onmount: (this: E) => void;
4
+ src?: string;
5
+ alt?: string;
6
+ for?: string;
7
+ rel?: string;
8
+ href?: string;
9
+ type?: string;
10
+ name?: string;
11
+ rows?: string;
12
+ value?: string;
13
+ accept: string;
14
+ action?: string;
15
+ target?: string;
16
+ method?: string;
17
+ checked?: boolean;
18
+ required?: string;
19
+ frameBorder?: string;
20
+ placeholder?: string;
21
+ ref?: __raw_ref;
22
+ autocomplete?: string;
23
+ style?: CSS.Properties;
24
+ recall?: (P: any) => void;
25
+ [key: `data-${string}` | `data-${string}`]: string | undefined;
26
+ [key: `on${string}`]: (this: E, event: Event) => void;
27
+ } & {
28
+ /**
29
+ * Cradova calls this function when this element is rendered on the DOM.
30
+ */
31
+ onmount: (this: E) => void;
31
32
  };
32
- export type VJS_params_TYPE<E extends HTMLElement> = (
33
- | undefined
34
- | string
35
- | HTMLElement
36
- | HTMLElement[]
37
- | DocumentFragment
38
- | DocumentFragment[]
39
- | (() => HTMLElement)
40
- | Partial<Attributes<E>>
41
- | Partial<E>
42
- | {
33
+ export type VJS_params_TYPE<E extends HTMLElement> = (undefined | string | HTMLElement | HTMLElement[] | DocumentFragment | DocumentFragment[] | (() => HTMLElement) | Partial<Attributes<E>> | {
43
34
  style: CSS.Properties;
44
- }
45
- )[];
35
+ })[];
46
36
  export interface RouterRouteObject {
47
- _html:
48
- | ((this: Page, data?: unknown) => HTMLElement | DocumentFragment)
49
- | HTMLElement
50
- | DocumentFragment;
51
- _delegatedRoutes: number | boolean;
52
- _Activate: (force: boolean) => Promise<void>;
53
- _deActivate: (params: object) => void;
54
- _package: (params: unknown) => void;
55
- _errorHandler: ((err: unknown) => void) | null;
56
- _derive(): {
57
- _name: string;
58
- _callBack:
59
- | ((cradovaPageSet: HTMLElement) => void | Promise<void>)
60
- | undefined;
61
- _deCallBack:
62
- | ((cradovaPageSet: HTMLElement) => void | Promise<void>)
63
- | undefined;
64
- };
65
- _apply_derivation(data: {
66
- _name: string;
67
- _callBack:
68
- | ((cradovaPageSet: HTMLElement) => void | Promise<void>)
69
- | undefined;
70
- _deCallBack:
71
- | ((cradovaPageSet: HTMLElement) => void | Promise<void>)
72
- | undefined;
73
- }): unknown;
37
+ _html: ((this: Page, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
38
+ _delegatedRoutes: number | boolean;
39
+ _Activate: (force: boolean) => Promise<void>;
40
+ _deActivate: (params: object) => void;
41
+ _package: (params: unknown) => void;
42
+ _errorHandler: ((err: unknown) => void) | null;
43
+ _derive(): {
44
+ _name: string;
45
+ _callBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
46
+ _deCallBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
47
+ };
48
+ _apply_derivation(data: {
49
+ _name: string;
50
+ _callBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
51
+ _deCallBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
52
+ }): unknown;
74
53
  }
75
54
  export type CradovaPageType = {
76
- /**
77
- * Cradova page
78
- * ---
79
- * title of the page
80
- * .
81
- */
82
- name?: string;
83
- /**
84
- * Cradova page
85
- * ---
86
- * The component for the page
87
- * @param data
88
- * @returns void
89
- * .
90
- */
91
- template: (this: Page) => HTMLElement;
92
- /**
93
- * Cradova page
94
- * ---
95
- * a snapshot is the initial render of a page.
96
- * snapshot isolation allows for good SEO guarantee with the flexibility of client based rendering
97
- * the origin server should accept post requesting to save a snapshot of this page for future use.
98
- * the origin server should respond with the snapshot for future request to the page url
99
- * the origin server should implement suitable mechanisms to invalidate it's caches
100
- */
101
- snapshotIsolation?: boolean;
55
+ /**
56
+ * Cradova page
57
+ * ---
58
+ * title of the page
59
+ * .
60
+ */
61
+ name?: string;
62
+ /**
63
+ * Cradova page
64
+ * ---
65
+ * The component for the page
66
+ * @param data
67
+ * @returns void
68
+ * .
69
+ */
70
+ template: (this: Page) => HTMLElement;
71
+ /**
72
+ * Cradova page
73
+ * ---
74
+ * a snapshot is the initial render of a page.
75
+ * snapshot isolation allows for good SEO guarantee with the flexibility of client based rendering
76
+ * the origin server should accept post requesting to save a snapshot of this page for future use.
77
+ * the origin server should respond with the snapshot for future request to the page url
78
+ * the origin server should implement suitable mechanisms to invalidate it's caches
79
+ */
80
+ snapshotIsolation?: boolean;
102
81
  };
103
- export type browserPageType<importType = Page> =
104
- | importType
105
- | Promise<importType>
106
- | (() => Promise<importType>);
82
+ export type browserPageType<importType = Page> = importType | Promise<importType> | (() => Promise<importType>);
107
83
  export type Func = {
108
- (): HTMLElement;
109
- rendered?: boolean;
110
- published?: boolean;
111
- reference?: HTMLElement | null;
112
- signals?: Map<string, Signal<any>>;
113
- pipes?: Map<string, any>;
114
- effects?: (() => Promise<void> | void)[];
115
- effectuate?: ((this: any) => void) | null;
116
- _state?: unknown[];
117
- _state_index?: number;
84
+ (): HTMLElement;
85
+ rendered?: boolean;
86
+ published?: boolean;
87
+ reference?: HTMLElement | null;
88
+ signals?: Map<string, Signal<any>>;
89
+ pipes?: Map<string, any>;
90
+ effects?: (() => Promise<void> | void)[];
91
+ effectuate?: ((this: any) => void) | null;
92
+ _state?: unknown[];
93
+ _state_index?: number;
118
94
  };
119
95
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "description": "Build Powerful ⚡ Web Apps with Ease",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",