cradova 3.4.1 → 3.5.0
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/README.md +33 -61
- package/dist/index.d.ts +3 -3
- package/dist/index.js +49 -9
- package/dist/primitives/classes.d.ts +181 -173
- package/dist/primitives/dom-objects.d.ts +161 -54
- package/dist/primitives/functions.d.ts +67 -33
- package/dist/primitives/types.d.ts +100 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ function Hello({ name }) {
|
|
|
58
58
|
return div(
|
|
59
59
|
$if(name === "john", h1("Hello john")),
|
|
60
60
|
$if(name === "paul", h1("Goodbye paul")),
|
|
61
|
-
$ifelse(name === "john", h1("Hello john"), h1("Hello Paul"))
|
|
61
|
+
$ifelse(name === "john", h1("Hello john"), h1("Hello Paul"))
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -70,8 +70,8 @@ function whatsAllowed({ age }) {
|
|
|
70
70
|
age,
|
|
71
71
|
$case(12, h1("too young")),
|
|
72
72
|
$case(26, h1("you are welcome")),
|
|
73
|
-
$case(52, h1("too old"))
|
|
74
|
-
)
|
|
73
|
+
$case(52, h1("too old"))
|
|
74
|
+
)
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -166,14 +166,6 @@ import {
|
|
|
166
166
|
useRef,
|
|
167
167
|
} from "cradova";
|
|
168
168
|
|
|
169
|
-
const count = new Comp(function () {
|
|
170
|
-
const [count, setCounter] = useState(0, this);
|
|
171
|
-
setTimeout(() => {
|
|
172
|
-
setCounter(count + 1);
|
|
173
|
-
}, 1000);
|
|
174
|
-
return h1(" count: " + count);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
169
|
// hello message
|
|
178
170
|
|
|
179
171
|
function HelloMessage() {
|
|
@@ -185,22 +177,6 @@ function HelloMessage() {
|
|
|
185
177
|
});
|
|
186
178
|
}
|
|
187
179
|
|
|
188
|
-
// using CradovaRef
|
|
189
|
-
|
|
190
|
-
const nameRef = new Comp(function () {
|
|
191
|
-
const [name, setName] = (useState < string) | (undefined > (undefined, this));
|
|
192
|
-
return div(name ? "hello " + name : "Click to get a second greeting", {
|
|
193
|
-
onclick() {
|
|
194
|
-
const name = prompt();
|
|
195
|
-
if (name) {
|
|
196
|
-
setName(name);
|
|
197
|
-
} else {
|
|
198
|
-
alert("Please provide a valid name");
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
180
|
// reference (not state)
|
|
205
181
|
|
|
206
182
|
function typingExample() {
|
|
@@ -212,12 +188,12 @@ function typingExample() {
|
|
|
212
188
|
},
|
|
213
189
|
placeholder: "typing simulation",
|
|
214
190
|
}),
|
|
215
|
-
p(" no thing typed yet!", { reference: ref.bindAs("text") })
|
|
191
|
+
p(" no thing typed yet!", { reference: ref.bindAs("text") })
|
|
216
192
|
);
|
|
217
193
|
}
|
|
218
194
|
|
|
219
195
|
function App() {
|
|
220
|
-
return div(
|
|
196
|
+
return div(typingExample, HelloMessage);
|
|
221
197
|
}
|
|
222
198
|
|
|
223
199
|
document.body.append(App());
|
|
@@ -241,34 +217,31 @@ import {
|
|
|
241
217
|
useState,
|
|
242
218
|
} from "../dist/index.js";
|
|
243
219
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
220
|
+
// creating a store
|
|
221
|
+
const todoStore = new Signal({
|
|
222
|
+
todo: ["take bath", "code coded", "take a break"],
|
|
223
|
+
});
|
|
247
224
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
"take a break",
|
|
253
|
-
]);
|
|
225
|
+
// create actions
|
|
226
|
+
const addTodo = function (todo: string) {
|
|
227
|
+
todoStore.publish("todo", [...todoStore.pipe.todo, todo]);
|
|
228
|
+
};
|
|
254
229
|
|
|
255
|
-
|
|
256
|
-
todoStore.
|
|
257
|
-
|
|
258
|
-
|
|
230
|
+
const removeTodo = function (todo: string) {
|
|
231
|
+
const ind = todoStore.pipe.todo.indexOf(todo);
|
|
232
|
+
todoStore.pipe.todo.splice(ind, 1);
|
|
233
|
+
todoStore.publish("todo", todoStore.pipe.todo);
|
|
234
|
+
};
|
|
259
235
|
|
|
260
|
-
todoStore.createAction("remove-todo", function (todo) {
|
|
261
|
-
const ind = this.value.indexOf(todo);
|
|
262
|
-
this.value.splice(ind, 1);
|
|
263
|
-
this.set(this.value);
|
|
264
|
-
});
|
|
265
236
|
|
|
237
|
+
function TodoList() {
|
|
238
|
+
// can be used to hold multiple references
|
|
239
|
+
const referenceSet = useRef();
|
|
266
240
|
// bind Comp to Signal
|
|
267
|
-
todoStore.
|
|
268
|
-
|
|
269
|
-
// markup
|
|
241
|
+
todoStore.subscribe("todo", todoList);
|
|
242
|
+
// vjs
|
|
270
243
|
return main(
|
|
271
|
-
|
|
244
|
+
h1(`Todo List`),
|
|
272
245
|
div(
|
|
273
246
|
input({
|
|
274
247
|
placeholder: "type in todo",
|
|
@@ -276,29 +249,28 @@ function TodoList() {
|
|
|
276
249
|
}),
|
|
277
250
|
button("Add todo", {
|
|
278
251
|
onclick() {
|
|
279
|
-
|
|
280
|
-
"
|
|
281
|
-
referenceSet.current("todoInput").value,
|
|
252
|
+
addTodo(
|
|
253
|
+
referenceSet.elem<HTMLInputElement>("todoInput")!.value || ""
|
|
282
254
|
);
|
|
283
|
-
referenceSet.
|
|
255
|
+
referenceSet.elem<HTMLInputElement>("todoInput")!.value = "";
|
|
284
256
|
},
|
|
285
|
-
})
|
|
257
|
+
})
|
|
286
258
|
),
|
|
287
|
-
todoList
|
|
259
|
+
todoList
|
|
288
260
|
);
|
|
289
261
|
}
|
|
290
262
|
|
|
291
263
|
const todoList = new Comp(function () {
|
|
292
|
-
const
|
|
264
|
+
const data = this.subData;
|
|
293
265
|
return div(
|
|
294
|
-
|
|
266
|
+
data.map((item: any) =>
|
|
295
267
|
p(item, {
|
|
296
268
|
title: "click to remove",
|
|
297
269
|
onclick() {
|
|
298
|
-
|
|
270
|
+
removeTodo(item);
|
|
299
271
|
},
|
|
300
272
|
})
|
|
301
|
-
)
|
|
273
|
+
)
|
|
302
274
|
);
|
|
303
275
|
});
|
|
304
276
|
document.body.appendChild(TodoList());
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./primitives/classes";
|
|
2
|
-
export * from "./primitives/functions";
|
|
3
|
-
export * from "./primitives/dom-objects";
|
|
1
|
+
export * from "./primitives/classes.js";
|
|
2
|
+
export * from "./primitives/functions.js";
|
|
3
|
+
export * from "./primitives/dom-objects.js";
|
package/dist/index.js
CHANGED
|
@@ -162,6 +162,9 @@ class Signal {
|
|
|
162
162
|
} else {
|
|
163
163
|
this.subs[eventName].push(comp);
|
|
164
164
|
}
|
|
165
|
+
if (this.pipe[eventName]) {
|
|
166
|
+
comp.subData = this.pipe[eventName];
|
|
167
|
+
}
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
clearPersist() {
|
|
@@ -178,11 +181,47 @@ class Page {
|
|
|
178
181
|
_callBack;
|
|
179
182
|
_deCallBack;
|
|
180
183
|
_dropped = false;
|
|
181
|
-
|
|
182
|
-
|
|
184
|
+
_snapshot;
|
|
185
|
+
_snapshot_html;
|
|
186
|
+
constructor(pageParams) {
|
|
187
|
+
const { template, name } = pageParams;
|
|
183
188
|
this._html = template;
|
|
184
189
|
this._name = name || "Document";
|
|
185
190
|
this._template.setAttribute("id", "page");
|
|
191
|
+
this._snapshot = pageParams.snapshotIsolation || false;
|
|
192
|
+
}
|
|
193
|
+
async _takeSnapShot() {
|
|
194
|
+
if (RouterBox.doc.dataset["snapshot"] === "true")
|
|
195
|
+
return;
|
|
196
|
+
try {
|
|
197
|
+
const response = await fetch(location.href);
|
|
198
|
+
if (!response.ok)
|
|
199
|
+
throw new Error("Failed to fetch the page");
|
|
200
|
+
const html = await response.text();
|
|
201
|
+
const parser = new DOMParser;
|
|
202
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
203
|
+
doc.title = this._name;
|
|
204
|
+
const wrapper = doc.querySelector('[data-wrapper="app"]');
|
|
205
|
+
if (wrapper) {
|
|
206
|
+
wrapper.setAttribute("data-snapshot", "true");
|
|
207
|
+
wrapper.innerHTML = this._snapshot_html;
|
|
208
|
+
} else {
|
|
209
|
+
console.error("Wrapper or template is not found");
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const snapshot = doc.documentElement.outerHTML;
|
|
213
|
+
await fetch(`${location.origin}`, {
|
|
214
|
+
body: snapshot,
|
|
215
|
+
method: "POST",
|
|
216
|
+
headers: {
|
|
217
|
+
"Content-Type": "text/html",
|
|
218
|
+
"cradova-snapshot": location.href
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error("Snapshot error:", error);
|
|
223
|
+
}
|
|
224
|
+
this._snapshot_html = undefined;
|
|
186
225
|
}
|
|
187
226
|
onActivate(cb) {
|
|
188
227
|
this._callBack = cb;
|
|
@@ -215,6 +254,8 @@ class Page {
|
|
|
215
254
|
document.title = this._name;
|
|
216
255
|
RouterBox.doc.innerHTML = "";
|
|
217
256
|
CradovaEvent.dispatchEvent("beforeMountActive");
|
|
257
|
+
if (this._snapshot)
|
|
258
|
+
this._snapshot_html = this._template.outerHTML;
|
|
218
259
|
RouterBox.doc.appendChild(this._template);
|
|
219
260
|
CradovaEvent.dispatchEvent("afterMount");
|
|
220
261
|
window.scrollTo({
|
|
@@ -224,6 +265,8 @@ class Page {
|
|
|
224
265
|
});
|
|
225
266
|
this._callBack && await this._callBack();
|
|
226
267
|
CradovaEvent.dispatchEvent("afterDeactivate");
|
|
268
|
+
if (this._snapshot)
|
|
269
|
+
this._takeSnapShot();
|
|
227
270
|
}
|
|
228
271
|
}
|
|
229
272
|
|
|
@@ -382,11 +425,11 @@ class Router {
|
|
|
382
425
|
static forward() {
|
|
383
426
|
history.go(1);
|
|
384
427
|
}
|
|
385
|
-
static
|
|
428
|
+
static pauseNavigation() {
|
|
386
429
|
RouterBox["paused"] = true;
|
|
387
430
|
window.location.hash = "paused";
|
|
388
431
|
}
|
|
389
|
-
static
|
|
432
|
+
static resumeNavigation() {
|
|
390
433
|
RouterBox["paused"] = false;
|
|
391
434
|
window.location.replace(window.location.pathname + window.location.search);
|
|
392
435
|
history.go(-1);
|
|
@@ -435,13 +478,10 @@ class Router {
|
|
|
435
478
|
}
|
|
436
479
|
static _mount() {
|
|
437
480
|
let doc = document.querySelector("[data-wrapper=app]");
|
|
438
|
-
if (
|
|
439
|
-
doc = document.createElement("div");
|
|
440
|
-
doc.setAttribute("data-wrapper", "app");
|
|
441
|
-
document.body.appendChild(doc);
|
|
481
|
+
if (doc) {
|
|
442
482
|
RouterBox.doc = doc;
|
|
443
483
|
} else {
|
|
444
|
-
|
|
484
|
+
throw new Error(`\u2718 Cradova err: please add '<div data-wrapper="app"></div>' to the body of your index.html file `);
|
|
445
485
|
}
|
|
446
486
|
window.addEventListener("pageshow", () => RouterBox.router());
|
|
447
487
|
window.addEventListener("popstate", (_e) => {
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import { type browserPageType, type CradovaPageType } from "./types";
|
|
1
|
+
import { type browserPageType, type CradovaPageType } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Cradova event
|
|
4
4
|
*/
|
|
5
5
|
declare class cradovaEvent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
static refid: number;
|
|
7
|
+
/**
|
|
8
|
+
* the events runs only once and removed.
|
|
9
|
+
* these event are call and removed once when when a comp is rendered to the dom
|
|
10
|
+
* @param callback
|
|
11
|
+
*/
|
|
12
|
+
afterMount: Function[];
|
|
13
|
+
/**
|
|
14
|
+
* the events runs many times.
|
|
15
|
+
* these event are called before a comp is rendered to the dom
|
|
16
|
+
* @param callback
|
|
17
|
+
*/
|
|
18
|
+
beforeMountActive: Function[];
|
|
19
|
+
/**
|
|
20
|
+
* the events runs once after comps unmounts.
|
|
21
|
+
* these event are called before a comp is rendered to the dom
|
|
22
|
+
* @param callback
|
|
23
|
+
*/
|
|
24
|
+
afterDeactivate: Function[];
|
|
25
|
+
/**
|
|
26
|
+
* Dispatch any event
|
|
27
|
+
* @param eventName
|
|
28
|
+
*/
|
|
29
|
+
dispatchEvent(
|
|
30
|
+
eventName: "beforeMountActive" | "afterMount" | "afterDeactivate",
|
|
31
|
+
): void;
|
|
30
32
|
}
|
|
31
33
|
export declare const CradovaEvent: cradovaEvent;
|
|
32
34
|
/**
|
|
@@ -35,80 +37,79 @@ export declare const CradovaEvent: cradovaEvent;
|
|
|
35
37
|
* create dynamic components
|
|
36
38
|
*/
|
|
37
39
|
export declare class Comp<Prop extends Record<string, any> = any> {
|
|
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
|
-
|
|
40
|
+
id: number;
|
|
41
|
+
private component;
|
|
42
|
+
private effects;
|
|
43
|
+
private effectuate;
|
|
44
|
+
private rendered;
|
|
45
|
+
private published;
|
|
46
|
+
private preRendered;
|
|
47
|
+
private reference;
|
|
48
|
+
subData: Prop | null;
|
|
49
|
+
_state: Prop[];
|
|
50
|
+
_state_index: number;
|
|
51
|
+
test?: string;
|
|
52
|
+
constructor(component: (this: Comp<Prop>) => HTMLElement);
|
|
53
|
+
preRender(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Cradova Comp
|
|
56
|
+
* ---
|
|
57
|
+
* returns html with cradova reference
|
|
58
|
+
* @param data
|
|
59
|
+
* @returns () => HTMLElement
|
|
60
|
+
*/
|
|
61
|
+
render(): HTMLElement;
|
|
62
|
+
_effect(fn: () => Promise<void> | void): void;
|
|
63
|
+
private effector;
|
|
64
|
+
/**
|
|
65
|
+
* Cradova Comp
|
|
66
|
+
* ---
|
|
67
|
+
* update comp component with new data and update the dom.
|
|
68
|
+
* @param data
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
recall(): void;
|
|
72
|
+
private activate;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Cradova Signal
|
|
74
76
|
* ----
|
|
75
|
-
* Create
|
|
77
|
+
* Create a pub&sub store.
|
|
76
78
|
* Features:
|
|
77
79
|
* - create a store
|
|
78
80
|
* - subscribe components to events
|
|
79
|
-
* - set object keys instead of all values
|
|
80
81
|
* - persist changes to localStorage
|
|
81
|
-
* @constructor initial:
|
|
82
|
+
* @constructor initial: Record<string, any>, props: {persist}
|
|
82
83
|
*/
|
|
83
84
|
export declare class Signal<Type extends Record<string, any>> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
85
|
+
private pn?;
|
|
86
|
+
private subs?;
|
|
87
|
+
pipe: Type;
|
|
88
|
+
constructor(initial: Type, props?: {
|
|
89
|
+
persistName?: string | undefined;
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Cradova Signal
|
|
93
|
+
* ----
|
|
94
|
+
* fires an action if available
|
|
95
|
+
* @param key - string key of the action
|
|
96
|
+
* @param data - data for the action
|
|
97
|
+
*/
|
|
98
|
+
publish<T extends keyof Type>(eventName: T, data: Type[T]): void;
|
|
99
|
+
/**
|
|
100
|
+
* Cradova Signal
|
|
101
|
+
* ----
|
|
102
|
+
* subscribe to an event
|
|
103
|
+
*
|
|
104
|
+
* @param Comp component to bind to.
|
|
105
|
+
*/
|
|
106
|
+
subscribe<T extends keyof Type>(eventName: T, comp: Comp): void;
|
|
107
|
+
/**
|
|
108
|
+
* Cradova Signal
|
|
109
|
+
* ----
|
|
110
|
+
* clear the history on local storage
|
|
111
|
+
*/
|
|
112
|
+
clearPersist(): void;
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
115
|
* Cradova Page
|
|
@@ -118,24 +119,27 @@ export declare class Signal<Type extends Record<string, any>> {
|
|
|
118
119
|
* @param template
|
|
119
120
|
*/
|
|
120
121
|
export declare class Page {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
/**
|
|
123
|
+
* used internally
|
|
124
|
+
*/
|
|
125
|
+
private _name;
|
|
126
|
+
/**
|
|
127
|
+
* this should be a cradova page component
|
|
128
|
+
*/
|
|
129
|
+
_html: (this: Page) => HTMLElement;
|
|
130
|
+
private _template;
|
|
131
|
+
private _callBack;
|
|
132
|
+
private _deCallBack;
|
|
133
|
+
private _dropped;
|
|
134
|
+
private _snapshot;
|
|
135
|
+
private _snapshot_html?;
|
|
136
|
+
constructor(pageParams: CradovaPageType);
|
|
137
|
+
private _takeSnapShot;
|
|
138
|
+
onActivate(cb: () => Promise<void> | void): void;
|
|
139
|
+
onDeactivate(cb: () => Promise<void> | void): void;
|
|
140
|
+
_deActivate(): Promise<void>;
|
|
141
|
+
drop(state?: boolean): boolean | undefined;
|
|
142
|
+
_activate(): Promise<void>;
|
|
139
143
|
}
|
|
140
144
|
/** cradova router
|
|
141
145
|
* ---
|
|
@@ -145,79 +149,83 @@ export declare class Page {
|
|
|
145
149
|
* @param page the cradova document tree for the route.
|
|
146
150
|
*/
|
|
147
151
|
export declare class Router {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
/**
|
|
153
|
+
* cradova router
|
|
154
|
+
* ---
|
|
155
|
+
* Registers a route.
|
|
156
|
+
*
|
|
157
|
+
* accepts an object containing pat and page
|
|
158
|
+
*/
|
|
159
|
+
static BrowserRoutes(
|
|
160
|
+
obj: Record<string, browserPageType<Page | unknown>>,
|
|
161
|
+
): void;
|
|
162
|
+
/**
|
|
157
163
|
Go back in Navigation history
|
|
158
164
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
static back(): void;
|
|
166
|
+
/**
|
|
161
167
|
Go forward in Navigation history
|
|
162
168
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
static forward(): void;
|
|
170
|
+
/**
|
|
165
171
|
Pause navigation
|
|
166
172
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
static pauseNavigation(): void;
|
|
174
|
+
/**
|
|
169
175
|
resume navigation
|
|
170
176
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
177
|
+
static resumeNavigation(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Cradova Router
|
|
180
|
+
* ------
|
|
181
|
+
*
|
|
182
|
+
* Navigates to a designated page in your app
|
|
183
|
+
*
|
|
184
|
+
* @param href string
|
|
185
|
+
* @param data object
|
|
186
|
+
* @param force boolean
|
|
187
|
+
*/
|
|
188
|
+
static navigate(href: string, data?: Record<string, any>): void;
|
|
189
|
+
/**
|
|
190
|
+
* Cradova
|
|
191
|
+
* ---
|
|
192
|
+
* Loading page for your app
|
|
193
|
+
*
|
|
194
|
+
* lazy loaded loading use
|
|
195
|
+
*
|
|
196
|
+
* @param page
|
|
197
|
+
*/
|
|
198
|
+
static setLoadingPage(page: Page): void;
|
|
199
|
+
/** cradova router
|
|
200
|
+
* ---
|
|
201
|
+
* Listen for navigation events
|
|
202
|
+
*
|
|
203
|
+
* @param callback () => void
|
|
204
|
+
*/
|
|
205
|
+
static onPageEvent(callback: () => void): void;
|
|
206
|
+
/**
|
|
207
|
+
* Cradova Router
|
|
208
|
+
* ------
|
|
209
|
+
*
|
|
210
|
+
* return last set router params
|
|
211
|
+
*
|
|
212
|
+
* .
|
|
213
|
+
*/
|
|
214
|
+
static get PageData(): {
|
|
215
|
+
params: Record<string, string>;
|
|
216
|
+
data?: Record<string, any>;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Cradova
|
|
220
|
+
* ---
|
|
221
|
+
* Error Handler for your app
|
|
222
|
+
*
|
|
223
|
+
* @param callback
|
|
224
|
+
* @param path? page path
|
|
225
|
+
*/
|
|
226
|
+
static addErrorHandler(
|
|
227
|
+
callback: (err?: unknown, pagePath?: string) => void,
|
|
228
|
+
): void;
|
|
229
|
+
static _mount(): void;
|
|
222
230
|
}
|
|
223
231
|
export {};
|
|
@@ -1,54 +1,161 @@
|
|
|
1
|
-
import { type VJS_params_TYPE } from "./types";
|
|
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
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export declare const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export declare const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export declare const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export declare const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export declare const
|
|
54
|
-
|
|
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 br: (
|
|
9
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLBRElement>
|
|
10
|
+
) => HTMLBRElement;
|
|
11
|
+
export declare const button: (
|
|
12
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLButtonElement>
|
|
13
|
+
) => HTMLButtonElement;
|
|
14
|
+
export declare const canvas: (
|
|
15
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLCanvasElement>
|
|
16
|
+
) => HTMLCanvasElement;
|
|
17
|
+
export declare const caption: (
|
|
18
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableCaptionElement>
|
|
19
|
+
) => HTMLTableCaptionElement;
|
|
20
|
+
export declare const datalist: (
|
|
21
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLDataListElement>
|
|
22
|
+
) => HTMLDataListElement;
|
|
23
|
+
export declare const details: (
|
|
24
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLDetailsElement>
|
|
25
|
+
) => HTMLDetailsElement;
|
|
26
|
+
export declare const dialog: (
|
|
27
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLDialogElement>
|
|
28
|
+
) => HTMLDialogElement;
|
|
29
|
+
export declare const div: (
|
|
30
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLDivElement>
|
|
31
|
+
) => HTMLDivElement;
|
|
32
|
+
export declare const footer: (
|
|
33
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
34
|
+
) => HTMLElement;
|
|
35
|
+
export declare const form: (
|
|
36
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLFormElement>
|
|
37
|
+
) => HTMLFormElement;
|
|
38
|
+
export declare const h1: (
|
|
39
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
40
|
+
) => HTMLHeadingElement;
|
|
41
|
+
export declare const h2: (
|
|
42
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
43
|
+
) => HTMLHeadingElement;
|
|
44
|
+
export declare const h3: (
|
|
45
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
46
|
+
) => HTMLHeadingElement;
|
|
47
|
+
export declare const h4: (
|
|
48
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
49
|
+
) => HTMLHeadingElement;
|
|
50
|
+
export declare const h5: (
|
|
51
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
52
|
+
) => HTMLHeadingElement;
|
|
53
|
+
export declare const h6: (
|
|
54
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadingElement>
|
|
55
|
+
) => HTMLHeadingElement;
|
|
56
|
+
export declare const head: (
|
|
57
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadElement>
|
|
58
|
+
) => HTMLHeadElement;
|
|
59
|
+
export declare const header: (
|
|
60
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHeadElement>
|
|
61
|
+
) => HTMLHeadElement;
|
|
62
|
+
export declare const hr: (
|
|
63
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLHRElement>
|
|
64
|
+
) => HTMLHRElement;
|
|
65
|
+
export declare const i: (
|
|
66
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>
|
|
67
|
+
) => HTMLLIElement;
|
|
68
|
+
export declare const iframe: (
|
|
69
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLIFrameElement>
|
|
70
|
+
) => HTMLIFrameElement;
|
|
71
|
+
export declare const img: (
|
|
72
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLImageElement>
|
|
73
|
+
) => HTMLImageElement;
|
|
74
|
+
export declare const input: (
|
|
75
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLInputElement>
|
|
76
|
+
) => HTMLInputElement;
|
|
77
|
+
export declare const label: (
|
|
78
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLLabelElement>
|
|
79
|
+
) => HTMLLabelElement;
|
|
80
|
+
export declare const li: (
|
|
81
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLLIElement>
|
|
82
|
+
) => HTMLLIElement;
|
|
83
|
+
export declare const main: (
|
|
84
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
85
|
+
) => HTMLElement;
|
|
86
|
+
export declare const nav: (
|
|
87
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
88
|
+
) => HTMLElement;
|
|
89
|
+
export declare const ol: (
|
|
90
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLOListElement>
|
|
91
|
+
) => HTMLOListElement;
|
|
92
|
+
export declare const optgroup: (
|
|
93
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLOptGroupElement>
|
|
94
|
+
) => HTMLOptGroupElement;
|
|
95
|
+
export declare const option: (
|
|
96
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLOptionElement>
|
|
97
|
+
) => HTMLOptionElement;
|
|
98
|
+
export declare const p: (
|
|
99
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLParagraphElement>
|
|
100
|
+
) => HTMLParagraphElement;
|
|
101
|
+
export declare const progress: (
|
|
102
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLProgressElement>
|
|
103
|
+
) => HTMLProgressElement;
|
|
104
|
+
export declare const q: (
|
|
105
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLQuoteElement>
|
|
106
|
+
) => HTMLQuoteElement;
|
|
107
|
+
export declare const section: (
|
|
108
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
109
|
+
) => HTMLElement;
|
|
110
|
+
export declare const select: (
|
|
111
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLSelectElement>
|
|
112
|
+
) => HTMLSelectElement;
|
|
113
|
+
export declare const source: (
|
|
114
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLSourceElement>
|
|
115
|
+
) => HTMLSourceElement;
|
|
116
|
+
export declare const span: (
|
|
117
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLSpanElement>
|
|
118
|
+
) => HTMLSpanElement;
|
|
119
|
+
export declare const strong: (
|
|
120
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
121
|
+
) => HTMLElement;
|
|
122
|
+
export declare const summary: (
|
|
123
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLElement>
|
|
124
|
+
) => HTMLElement;
|
|
125
|
+
export declare const table: (
|
|
126
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableElement>
|
|
127
|
+
) => HTMLTableElement;
|
|
128
|
+
export declare const tbody: (
|
|
129
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableColElement>
|
|
130
|
+
) => HTMLTableColElement;
|
|
131
|
+
export declare const td: (
|
|
132
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableCellElement>
|
|
133
|
+
) => HTMLTableCellElement;
|
|
134
|
+
export declare const textarea: (
|
|
135
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTextAreaElement>
|
|
136
|
+
) => HTMLTextAreaElement;
|
|
137
|
+
export declare const th: (
|
|
138
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableSectionElement>
|
|
139
|
+
) => HTMLTableSectionElement;
|
|
140
|
+
export declare const title: (
|
|
141
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTitleElement>
|
|
142
|
+
) => HTMLTitleElement;
|
|
143
|
+
export declare const tr: (
|
|
144
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLTableRowElement>
|
|
145
|
+
) => HTMLTableRowElement;
|
|
146
|
+
export declare const u: (
|
|
147
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLUListElement>
|
|
148
|
+
) => HTMLUListElement;
|
|
149
|
+
export declare const ul: (
|
|
150
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLUListElement>
|
|
151
|
+
) => HTMLUListElement;
|
|
152
|
+
export declare const video: (
|
|
153
|
+
...Children_and_Properties: VJS_params_TYPE<HTMLVideoElement>
|
|
154
|
+
) => HTMLVideoElement;
|
|
155
|
+
export declare const svg: (
|
|
156
|
+
svg: string,
|
|
157
|
+
properties?: VJS_params_TYPE<HTMLSpanElement>,
|
|
158
|
+
) => HTMLSpanElement;
|
|
159
|
+
export declare const raw: (
|
|
160
|
+
html: string | TemplateStringsArray,
|
|
161
|
+
) => DocumentFragment;
|
|
@@ -1,52 +1,83 @@
|
|
|
1
|
-
import { type VJS_params_TYPE } from "./types";
|
|
2
|
-
import { Comp } from "./classes";
|
|
1
|
+
import { type VJS_params_TYPE } from "./types.js";
|
|
2
|
+
import { Comp } from "./classes.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cradova
|
|
5
5
|
* ---
|
|
6
6
|
* make reference to dom elements
|
|
7
7
|
*/
|
|
8
8
|
declare class __raw_ref {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
tree: Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* Bind a DOM element to a reference name.
|
|
12
|
+
* @param name - The name to reference the DOM element by.
|
|
13
|
+
*/
|
|
14
|
+
bindAs(name: string): __raw_ref;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieve a referenced DOM element.
|
|
17
|
+
* @param name - The name of the referenced DOM element.
|
|
18
|
+
*/
|
|
19
|
+
elem<ElementType extends HTMLElement = HTMLElement>(
|
|
20
|
+
name: string,
|
|
21
|
+
): ElementType | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Swap referenced DOM element.
|
|
24
|
+
*/
|
|
25
|
+
swap(name1: string, name2: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Append a DOM element to the reference, overwriting any existing reference.
|
|
28
|
+
* @param name - The name to reference the DOM element by.
|
|
29
|
+
* @param element - The DOM element to reference.
|
|
30
|
+
*/
|
|
31
|
+
_append(name: string, Element: HTMLElement): void;
|
|
30
32
|
}
|
|
31
|
-
export declare const makeElement: <E extends HTMLElement>(
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export declare const makeElement: <E extends HTMLElement>(
|
|
34
|
+
element: E & HTMLElement,
|
|
35
|
+
ElementChildrenAndPropertyList: VJS_params_TYPE<E>,
|
|
36
|
+
) => E;
|
|
37
|
+
export declare const cra: <E extends HTMLElement>(
|
|
38
|
+
tag: string,
|
|
39
|
+
) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
|
|
40
|
+
export declare function Rhoda(
|
|
41
|
+
l: VJS_params_TYPE<HTMLElement>,
|
|
42
|
+
): DocumentFragment;
|
|
34
43
|
/**
|
|
35
44
|
* @param {expression} condition
|
|
36
45
|
* @param {function} elements[]
|
|
37
46
|
*/
|
|
38
|
-
export declare function $if<E extends HTMLElement>(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
export declare function $if<E extends HTMLElement>(
|
|
48
|
+
condition: any,
|
|
49
|
+
...elements: VJS_params_TYPE<E>
|
|
50
|
+
): any;
|
|
51
|
+
export declare function $ifelse(
|
|
52
|
+
condition: any,
|
|
53
|
+
ifTrue: any,
|
|
54
|
+
ifFalse?: any,
|
|
55
|
+
): any;
|
|
56
|
+
export declare function $case<E extends HTMLElement = HTMLElement>(
|
|
57
|
+
value: any,
|
|
58
|
+
...elements: VJS_params_TYPE<E>
|
|
59
|
+
): (key: any) => VJS_params_TYPE<E> | undefined;
|
|
60
|
+
export declare function $switch(
|
|
61
|
+
key: unknown,
|
|
62
|
+
...cases: ((key: any) => any)[]
|
|
63
|
+
): any;
|
|
42
64
|
type LoopData<Type> = Type[];
|
|
43
|
-
export declare function loop<Type>(
|
|
65
|
+
export declare function loop<Type>(
|
|
66
|
+
datalist: LoopData<Type>,
|
|
67
|
+
component: (
|
|
68
|
+
value: Type,
|
|
69
|
+
index?: number,
|
|
70
|
+
array?: LoopData<Type>,
|
|
71
|
+
) => HTMLElement | DocumentFragment | undefined,
|
|
72
|
+
): HTMLElement[] | undefined;
|
|
44
73
|
/**
|
|
45
74
|
* Document fragment
|
|
46
75
|
* @param children
|
|
47
76
|
* @returns
|
|
48
77
|
*/
|
|
49
|
-
export declare const frag: (
|
|
78
|
+
export declare const frag: (
|
|
79
|
+
children: VJS_params_TYPE<HTMLElement>,
|
|
80
|
+
) => DocumentFragment;
|
|
50
81
|
/**
|
|
51
82
|
* Cradova
|
|
52
83
|
* ---
|
|
@@ -55,7 +86,10 @@ export declare const frag: (children: VJS_params_TYPE<HTMLElement>) => DocumentF
|
|
|
55
86
|
* @param Comp
|
|
56
87
|
* @returns [state, setState]
|
|
57
88
|
*/
|
|
58
|
-
export declare function useState<S = unknown>(
|
|
89
|
+
export declare function useState<S = unknown>(
|
|
90
|
+
newState: S,
|
|
91
|
+
Comp: Comp<any>,
|
|
92
|
+
): [S, (newState: S | ((preS: S) => S)) => void];
|
|
59
93
|
/**
|
|
60
94
|
* Cradova
|
|
61
95
|
* ---
|
|
@@ -1,71 +1,112 @@
|
|
|
1
1
|
import * as CSS from "csstype";
|
|
2
|
-
import { Comp, Page } from "./classes";
|
|
2
|
+
import { Comp, Page } from "./classes.js";
|
|
3
3
|
type DataAttributes = {
|
|
4
|
-
|
|
4
|
+
[key: `data-${string}`]: string;
|
|
5
5
|
};
|
|
6
6
|
type AriaAttributes = {
|
|
7
|
-
|
|
7
|
+
[key: `aria-${string}`]: string;
|
|
8
8
|
};
|
|
9
9
|
type Attributes = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
src?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
for?: string;
|
|
13
|
+
rel?: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
type?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
rows?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
accept: string;
|
|
20
|
+
action?: string;
|
|
21
|
+
target?: string;
|
|
22
|
+
method?: string;
|
|
23
|
+
checked?: boolean;
|
|
24
|
+
required?: string;
|
|
25
|
+
frameBorder?: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
reference?: [any, string];
|
|
28
|
+
autocomplete?: string;
|
|
29
|
+
style?: CSS.Properties;
|
|
30
|
+
recall?: (P: any) => void;
|
|
31
|
+
onmount?: (this: HTMLElement & Attributes) => void;
|
|
32
32
|
};
|
|
33
|
-
export type VJS_params_TYPE<E extends HTMLElement> = (
|
|
33
|
+
export type VJS_params_TYPE<E extends HTMLElement> = (
|
|
34
|
+
| Comp
|
|
35
|
+
| Comp[]
|
|
36
|
+
| string
|
|
37
|
+
| undefined
|
|
38
|
+
| HTMLElement
|
|
39
|
+
| HTMLElement[]
|
|
40
|
+
| DocumentFragment
|
|
41
|
+
| DocumentFragment[]
|
|
42
|
+
| Attributes
|
|
43
|
+
| Partial<Attributes>
|
|
44
|
+
| (() => HTMLElement)
|
|
45
|
+
| Partial<E>
|
|
46
|
+
| Record<string, (this: E) => void>
|
|
47
|
+
| Partial<DataAttributes>
|
|
48
|
+
| Partial<AriaAttributes>
|
|
49
|
+
| CSS.Properties<string | number>
|
|
50
|
+
)[];
|
|
34
51
|
export interface RouterRouteObject {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
_html:
|
|
53
|
+
| ((this: Page, data?: unknown) => HTMLElement | DocumentFragment)
|
|
54
|
+
| HTMLElement
|
|
55
|
+
| DocumentFragment;
|
|
56
|
+
_delegatedRoutes: number | boolean;
|
|
57
|
+
_Activate: (force: boolean) => Promise<void>;
|
|
58
|
+
_deActivate: (params: object) => void;
|
|
59
|
+
_package: (params: unknown) => void;
|
|
60
|
+
_errorHandler: ((err: unknown) => void) | null;
|
|
61
|
+
_derive(): {
|
|
62
|
+
_name: string;
|
|
63
|
+
_callBack:
|
|
64
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
65
|
+
| undefined;
|
|
66
|
+
_deCallBack:
|
|
67
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
68
|
+
| undefined;
|
|
69
|
+
};
|
|
70
|
+
_apply_derivation(data: {
|
|
71
|
+
_name: string;
|
|
72
|
+
_callBack:
|
|
73
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
74
|
+
| undefined;
|
|
75
|
+
_deCallBack:
|
|
76
|
+
| ((cradovaPageSet: HTMLElement) => void | Promise<void>)
|
|
77
|
+
| undefined;
|
|
78
|
+
}): unknown;
|
|
51
79
|
}
|
|
52
80
|
export type CradovaPageType = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Cradova page
|
|
83
|
+
* ---
|
|
84
|
+
* title of the page
|
|
85
|
+
* .
|
|
86
|
+
*/
|
|
87
|
+
name?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Cradova page
|
|
90
|
+
* ---
|
|
91
|
+
* The component for the page
|
|
92
|
+
* @param data
|
|
93
|
+
* @returns void
|
|
94
|
+
* .
|
|
95
|
+
*/
|
|
96
|
+
template: (this: Page) => HTMLElement;
|
|
97
|
+
/**
|
|
98
|
+
* Cradova page
|
|
99
|
+
* ---
|
|
100
|
+
* a snapshot is the initial render of a page.
|
|
101
|
+
* snapshot isolation allows for good SEO guarantee with the flexibility of client based rendering
|
|
102
|
+
* the origin server should accept post requesting to save a snapshot of this page for future use.
|
|
103
|
+
* the origin server should respond with the snapshot for future request to the page url
|
|
104
|
+
* the origin server should implement suitable mechanisms to invalidate it's caches
|
|
105
|
+
*/
|
|
106
|
+
snapshotIsolation?: boolean;
|
|
69
107
|
};
|
|
70
|
-
export type browserPageType<importType = Page> =
|
|
108
|
+
export type browserPageType<importType = Page> =
|
|
109
|
+
| importType
|
|
110
|
+
| Promise<importType>
|
|
111
|
+
| (() => Promise<importType>);
|
|
71
112
|
export {};
|