cradova 3.7.11 → 3.7.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/index.d.ts +3 -3
- package/dist/index.js +7 -5
- package/dist/primitives/classes.d.ts +129 -120
- package/dist/primitives/dom-objects.d.ts +112 -37
- package/dist/primitives/functions.d.ts +61 -23
- package/dist/primitives/types.d.ts +93 -56
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./primitives/functions.js";
|
|
|
3
3
|
export * from "./primitives/dom-objects.js";
|
|
4
4
|
export type { Func } from "./primitives/types.js";
|
|
5
5
|
declare global {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface Function {
|
|
7
|
+
cloneFunc(): () => HTMLElement;
|
|
8
|
+
}
|
|
9
9
|
}
|
package/dist/index.js
CHANGED
|
@@ -411,11 +411,13 @@ class Signal {
|
|
|
411
411
|
});
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
|
-
if (!
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
414
|
+
if (!comp.signals) {
|
|
415
|
+
if (!isArrowFunc(comp)) {
|
|
416
|
+
comp = toFuncNoRender(comp);
|
|
417
|
+
} else {
|
|
418
|
+
console.error(` ✘ Cradova err: ${String(comp)} is not a valid component or function`);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
419
421
|
}
|
|
420
422
|
if (comp.signals.get(eventName))
|
|
421
423
|
return;
|
|
@@ -3,23 +3,25 @@ import type { browserPageType, CradovaPageType } from "./types.js";
|
|
|
3
3
|
* Cradova event
|
|
4
4
|
*/
|
|
5
5
|
export declare class cradovaEvent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
): Promise<void>;
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Cradova Signal
|
|
@@ -32,51 +34,54 @@ export declare class cradovaEvent {
|
|
|
32
34
|
* @constructor initial: Record<string, any>, props: {persist}
|
|
33
35
|
*/
|
|
34
36
|
export declare class Signal<Type extends Record<string, any>> {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
37
|
+
private pn?;
|
|
38
|
+
private subs;
|
|
39
|
+
private listening_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(events: Partial<Type>): 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
|
+
* subscribe an element to an event
|
|
71
|
+
*
|
|
72
|
+
* @param name(s) of event.
|
|
73
|
+
* @param Func to bind to.
|
|
74
|
+
*/
|
|
75
|
+
subscriber<T extends keyof Type>(
|
|
76
|
+
eventName: T | T[],
|
|
77
|
+
fn: (this: HTMLElement, data: Partial<Type>) => void,
|
|
78
|
+
): Signal<any>;
|
|
79
|
+
/**
|
|
80
|
+
* Cradova Signal
|
|
81
|
+
* ----
|
|
82
|
+
* clear the history on local storage
|
|
83
|
+
*/
|
|
84
|
+
clearPersist(): void;
|
|
80
85
|
}
|
|
81
86
|
/**
|
|
82
87
|
* Cradova Page
|
|
@@ -86,9 +91,9 @@ export declare class Signal<Type extends Record<string, any>> {
|
|
|
86
91
|
* @param template
|
|
87
92
|
*/
|
|
88
93
|
export declare class Page {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
constructor(pageParams: CradovaPageType);
|
|
95
|
+
private _takeSnapShot;
|
|
96
|
+
set onDeactivate(cb: () => Promise<void> | void);
|
|
92
97
|
}
|
|
93
98
|
/** cradova router
|
|
94
99
|
* ---
|
|
@@ -98,63 +103,67 @@ export declare class Page {
|
|
|
98
103
|
* @param page the cradova document tree for the route.
|
|
99
104
|
*/
|
|
100
105
|
export declare class Router {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
/**
|
|
107
|
+
* cradova router
|
|
108
|
+
* ---
|
|
109
|
+
* Registers a route.
|
|
110
|
+
*
|
|
111
|
+
* accepts an object containing pat and page
|
|
112
|
+
*/
|
|
113
|
+
static BrowserRoutes(
|
|
114
|
+
obj: Record<string, browserPageType<Page | unknown>>,
|
|
115
|
+
): void;
|
|
116
|
+
/**
|
|
110
117
|
Pause navigation
|
|
111
118
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
static pauseNavigation(): void;
|
|
120
|
+
/**
|
|
114
121
|
resume navigation
|
|
115
122
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
123
|
+
static resumeNavigation(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Cradova Router
|
|
126
|
+
* ------
|
|
127
|
+
*
|
|
128
|
+
* Navigates to a designated page in your app
|
|
129
|
+
*
|
|
130
|
+
* @param href string
|
|
131
|
+
* @param data object
|
|
132
|
+
* @param force boolean
|
|
133
|
+
*/
|
|
134
|
+
static navigate(href: string, data?: Record<string, any>): void;
|
|
135
|
+
/**
|
|
136
|
+
* Cradova
|
|
137
|
+
* ---
|
|
138
|
+
* Loading page for your app
|
|
139
|
+
*
|
|
140
|
+
* lazy loaded loading use
|
|
141
|
+
*
|
|
142
|
+
* @param page
|
|
143
|
+
*/
|
|
144
|
+
static setLoadingPage(page: Page): void;
|
|
145
|
+
/**
|
|
146
|
+
* Cradova Router
|
|
147
|
+
* ------
|
|
148
|
+
*
|
|
149
|
+
* return last set router params
|
|
150
|
+
*
|
|
151
|
+
* .
|
|
152
|
+
*/
|
|
153
|
+
static get PageData(): {
|
|
154
|
+
params: Record<string, string>;
|
|
155
|
+
data?: Record<string, any>;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Cradova
|
|
159
|
+
* ---
|
|
160
|
+
* Error Handler for your app
|
|
161
|
+
*
|
|
162
|
+
* @param callback
|
|
163
|
+
* @param path? page path
|
|
164
|
+
*/
|
|
165
|
+
static addErrorHandler(
|
|
166
|
+
callback: (err?: unknown, pagePath?: string) => void,
|
|
167
|
+
): void;
|
|
168
|
+
static _mount(): void;
|
|
160
169
|
}
|
|
@@ -1,38 +1,113 @@
|
|
|
1
1
|
import { type VJS_params_TYPE } from "./types.js";
|
|
2
|
-
export declare const a: (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export declare const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export declare const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export declare const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export declare const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export declare const
|
|
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;
|
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
import type { Func, VJS_params_TYPE } from "./types.js";
|
|
2
|
-
export declare const makeElement: <E extends HTMLElement>(
|
|
3
|
-
|
|
2
|
+
export declare const makeElement: <E extends HTMLElement>(
|
|
3
|
+
element: E & HTMLElement,
|
|
4
|
+
ElementChildrenAndPropertyList: VJS_params_TYPE<E>,
|
|
5
|
+
) => E;
|
|
6
|
+
export declare const cra: <E extends HTMLElement>(
|
|
7
|
+
tag: string,
|
|
8
|
+
) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
|
|
4
9
|
/**
|
|
5
10
|
* @param {expression} condition
|
|
6
11
|
* @param {function} elements[]
|
|
7
12
|
*/
|
|
8
|
-
export declare function $if<E extends HTMLElement>(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
export declare function $if<E extends HTMLElement>(
|
|
14
|
+
condition: any,
|
|
15
|
+
...elements: VJS_params_TYPE<E>
|
|
16
|
+
): any;
|
|
17
|
+
export declare function $ifelse(
|
|
18
|
+
condition: any,
|
|
19
|
+
ifTrue: any,
|
|
20
|
+
ifFalse?: any,
|
|
21
|
+
): any;
|
|
22
|
+
export declare function $case<E extends HTMLElement = HTMLElement>(
|
|
23
|
+
value: any,
|
|
24
|
+
...elements: VJS_params_TYPE<E>
|
|
25
|
+
): (key: any) => VJS_params_TYPE<E> | undefined;
|
|
26
|
+
export declare function $switch(
|
|
27
|
+
key: unknown,
|
|
28
|
+
...cases: ((key: any) => any)[]
|
|
29
|
+
): any;
|
|
12
30
|
type LoopData<Type> = Type[];
|
|
13
|
-
export declare function loop<Type>(
|
|
31
|
+
export declare function loop<Type>(
|
|
32
|
+
datalist: LoopData<Type>,
|
|
33
|
+
component: (
|
|
34
|
+
value: Type,
|
|
35
|
+
index?: number,
|
|
36
|
+
array?: LoopData<Type>,
|
|
37
|
+
) =>
|
|
38
|
+
| HTMLElement
|
|
39
|
+
| HTMLElement[]
|
|
40
|
+
| DocumentFragment
|
|
41
|
+
| DocumentFragment[]
|
|
42
|
+
| undefined
|
|
43
|
+
| undefined[],
|
|
44
|
+
): HTMLElement[] | undefined;
|
|
14
45
|
/**
|
|
15
46
|
* Document fragment
|
|
16
47
|
* @param children
|
|
17
48
|
* @returns
|
|
18
49
|
*/
|
|
19
|
-
export declare const frag: (
|
|
50
|
+
export declare const frag: (
|
|
51
|
+
children: VJS_params_TYPE<HTMLElement>,
|
|
52
|
+
) => DocumentFragment;
|
|
20
53
|
/**
|
|
21
54
|
* Cradova
|
|
22
55
|
* ---
|
|
@@ -25,7 +58,10 @@ export declare const frag: (children: VJS_params_TYPE<HTMLElement>) => DocumentF
|
|
|
25
58
|
* @param Func
|
|
26
59
|
* @returns [state, setState]
|
|
27
60
|
*/
|
|
28
|
-
export declare function useState<S = unknown>(
|
|
61
|
+
export declare function useState<S = unknown>(
|
|
62
|
+
newState: S,
|
|
63
|
+
self: any,
|
|
64
|
+
): [S, (newState: S | ((preS: S) => S)) => void];
|
|
29
65
|
/**
|
|
30
66
|
* Cradova
|
|
31
67
|
* ---
|
|
@@ -40,17 +76,19 @@ export declare function useEffect(effect: () => void, self: Func): void;
|
|
|
40
76
|
* make reference to dom elements
|
|
41
77
|
*/
|
|
42
78
|
declare class __raw_ref {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
tree: Record<string, any>;
|
|
80
|
+
/**
|
|
81
|
+
* Bind a DOM element to a reference name.
|
|
82
|
+
* @param name - The name to reference the DOM element by.
|
|
83
|
+
*/
|
|
84
|
+
bindAs(name: string): __raw_ref;
|
|
85
|
+
/**
|
|
86
|
+
* Retrieve a referenced DOM element.
|
|
87
|
+
* @param name - The name of the referenced DOM element.
|
|
88
|
+
*/
|
|
89
|
+
elem<ElementType extends HTMLElement = HTMLElement>(
|
|
90
|
+
name: string,
|
|
91
|
+
): ElementType | undefined;
|
|
54
92
|
}
|
|
55
93
|
/**
|
|
56
94
|
* Cradova
|
|
@@ -63,8 +101,8 @@ export declare const getSignal: (name: string, func: Func) => any;
|
|
|
63
101
|
export declare const isArrowFunc: (fn: Function) => boolean;
|
|
64
102
|
export declare const toFuncNoRender: (func: any) => any;
|
|
65
103
|
export declare const funcManager: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
104
|
+
render(func: Func): HTMLElement;
|
|
105
|
+
recall(func: Func): void;
|
|
106
|
+
activate(func: Func): Promise<void>;
|
|
69
107
|
};
|
|
70
108
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as CSS from "csstype";
|
|
2
2
|
import { __raw_ref, Page, Signal } from "./classes.js";
|
|
3
|
-
type Attributes<E extends HTMLElement> =
|
|
3
|
+
type Attributes<E extends HTMLElement> =
|
|
4
|
+
& {
|
|
4
5
|
ref?: __raw_ref;
|
|
5
6
|
value?: any;
|
|
6
7
|
subscription?: Signal<any>;
|
|
@@ -9,70 +10,106 @@ type Attributes<E extends HTMLElement> = {
|
|
|
9
10
|
[key: `data-${string}`]: string | undefined;
|
|
10
11
|
[key: `aria-${string}`]: string | undefined;
|
|
11
12
|
[key: `on${string}`]: (this: E, event: Event) => void;
|
|
12
|
-
}
|
|
13
|
+
}
|
|
14
|
+
& {
|
|
13
15
|
/**
|
|
14
16
|
* Cradova calls this function when this element is rendered on the DOM.
|
|
15
17
|
*/
|
|
16
18
|
onmount?: (this: E) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
+
}
|
|
20
|
+
& Partial<
|
|
21
|
+
Omit<
|
|
22
|
+
E,
|
|
23
|
+
| "style"
|
|
24
|
+
| `data-${string}`
|
|
25
|
+
| `aria-${string}`
|
|
26
|
+
| `on${string}`
|
|
27
|
+
| "ref"
|
|
28
|
+
| "recall"
|
|
29
|
+
>
|
|
30
|
+
>;
|
|
31
|
+
export type VJS_params_TYPE<E extends HTMLElement> = (
|
|
32
|
+
| undefined
|
|
33
|
+
| string
|
|
34
|
+
| HTMLElement
|
|
35
|
+
| HTMLElement[]
|
|
36
|
+
| DocumentFragment
|
|
37
|
+
| DocumentFragment[]
|
|
38
|
+
| (() => HTMLElement)
|
|
39
|
+
| Partial<Attributes<E>>
|
|
40
|
+
| {
|
|
19
41
|
style: CSS.Properties;
|
|
20
|
-
}
|
|
42
|
+
}
|
|
43
|
+
)[];
|
|
21
44
|
export interface RouterRouteObject {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
_html:
|
|
46
|
+
| ((this: Page, data?: unknown) => HTMLElement | DocumentFragment)
|
|
47
|
+
| HTMLElement
|
|
48
|
+
| DocumentFragment;
|
|
49
|
+
_delegatedRoutes: number | boolean;
|
|
50
|
+
_Activate: (force: boolean) => Promise<void>;
|
|
51
|
+
_deActivate: (params: object) => void;
|
|
52
|
+
_package: (params: unknown) => void;
|
|
53
|
+
_errorHandler: ((err: unknown) => void) | null;
|
|
54
|
+
_derive(): {
|
|
55
|
+
_name: string;
|
|
56
|
+
_callBack:
|
|
57
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
58
|
+
| undefined;
|
|
59
|
+
_deCallBack:
|
|
60
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
61
|
+
| undefined;
|
|
62
|
+
};
|
|
63
|
+
_apply_derivation(data: {
|
|
64
|
+
_name: string;
|
|
65
|
+
_callBack:
|
|
66
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
67
|
+
| undefined;
|
|
68
|
+
_deCallBack:
|
|
69
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
70
|
+
| undefined;
|
|
71
|
+
}): unknown;
|
|
38
72
|
}
|
|
39
73
|
export type CradovaPageType = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Cradova page
|
|
76
|
+
* ---
|
|
77
|
+
* title of the page
|
|
78
|
+
* .
|
|
79
|
+
*/
|
|
80
|
+
name?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Cradova page
|
|
83
|
+
* ---
|
|
84
|
+
* The component for the page
|
|
85
|
+
* @param data
|
|
86
|
+
* @returns void
|
|
87
|
+
* .
|
|
88
|
+
*/
|
|
89
|
+
template: (this: any) => HTMLElement;
|
|
90
|
+
/**
|
|
91
|
+
* Cradova page
|
|
92
|
+
* ---
|
|
93
|
+
* a snapshot is the initial render of a page.
|
|
94
|
+
* snapshot isolation allows for good SEO guarantee with the flexibility of client based rendering
|
|
95
|
+
* the origin server should accept post requesting to save a snapshot of this page for future use.
|
|
96
|
+
* the origin server should respond with the snapshot for future request to the page url
|
|
97
|
+
* the origin server should implement suitable mechanisms to invalidate it's caches
|
|
98
|
+
*/
|
|
99
|
+
snapshotIsolation?: boolean;
|
|
66
100
|
};
|
|
67
|
-
export type browserPageType<importType = Page> =
|
|
101
|
+
export type browserPageType<importType = Page> =
|
|
102
|
+
| importType
|
|
103
|
+
| Promise<importType>
|
|
104
|
+
| (() => Promise<importType>);
|
|
68
105
|
export type Func = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
106
|
+
(): HTMLElement;
|
|
107
|
+
rendered?: boolean;
|
|
108
|
+
published?: boolean;
|
|
109
|
+
reference?: HTMLElement | null;
|
|
110
|
+
signals?: Map<string, Signal<any>>;
|
|
111
|
+
pipes?: Map<string, any>;
|
|
112
|
+
_state?: unknown[];
|
|
113
|
+
_state_index?: number;
|
|
77
114
|
};
|
|
78
115
|
export {};
|