cradova 2.3.1 → 3.1.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 +18 -15
- package/package.json +1 -1
- package/dist/index.d.ts +0 -601
- package/dist/index.js +0 -1519
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
Cradova is a web development framework for building Single Page Applications and PWAs.
|
|
43
43
|
|
|
44
|
-
It's a fast
|
|
44
|
+
It's a fast and simple framework, it provides an easy to use state management and router system.
|
|
45
45
|
|
|
46
46
|
Cradova follows the [VJS specification](https://github.com/fridaycandour/cradova/blob/main/spec.md)
|
|
47
47
|
|
|
@@ -54,11 +54,11 @@ Instead, State management is done more elegantly with a simple predictive model,
|
|
|
54
54
|
|
|
55
55
|
## Is this a big benefit?
|
|
56
56
|
|
|
57
|
-
Undoubtedly, this provides a significant advantage.
|
|
57
|
+
Undoubtedly, this provides a significant advantage.
|
|
58
58
|
|
|
59
59
|
Cradova has already been utilized in multiple production projects, and we will continuously update this page to showcase our advancements as we keep improving.
|
|
60
60
|
|
|
61
|
-
[current version changes](https://github.com/fridaycandour/cradova/blob/main/CHANGELOG.md#
|
|
61
|
+
[current version changes](https://github.com/fridaycandour/cradova/blob/main/CHANGELOG.md#v300)
|
|
62
62
|
|
|
63
63
|
## Installation
|
|
64
64
|
|
|
@@ -111,16 +111,21 @@ you can choose any that best suite what problem you want to solve
|
|
|
111
111
|
```js
|
|
112
112
|
import _, { button, createSignal, Ref, reference, h1, br, div } from "cradova";
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
|
|
115
|
+
const count = new Ref(function () {
|
|
116
|
+
const [count, setCounter] = useState(0, this);
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
setCounter(count + 1);
|
|
119
|
+
}, 1000);
|
|
120
|
+
return h1(" the current count is = " + count);
|
|
121
|
+
});
|
|
116
122
|
|
|
117
123
|
function counter() {
|
|
118
124
|
let num = 0;
|
|
119
125
|
return _("h1| 0", {
|
|
120
|
-
shouldUpdate: true,
|
|
121
126
|
onclick() {
|
|
122
127
|
num++;
|
|
123
|
-
this.
|
|
128
|
+
this.innerText = num;
|
|
124
129
|
},
|
|
125
130
|
});
|
|
126
131
|
}
|
|
@@ -129,11 +134,11 @@ function counter() {
|
|
|
129
134
|
|
|
130
135
|
function dataCounter() {
|
|
131
136
|
return _("h1| 0", {
|
|
132
|
-
shouldUpdate: true,
|
|
133
137
|
"data-num": "0",
|
|
134
138
|
onclick() {
|
|
135
139
|
const num = this.getAttribute("data-num") * 1 + 1;
|
|
136
|
-
this.
|
|
140
|
+
this.setAttribute("data-num", num });
|
|
141
|
+
this.innerText = num;
|
|
137
142
|
},
|
|
138
143
|
});
|
|
139
144
|
}
|
|
@@ -142,13 +147,10 @@ function dataCounter() {
|
|
|
142
147
|
|
|
143
148
|
function HelloMessage() {
|
|
144
149
|
return div({
|
|
145
|
-
shouldUpdate: true,
|
|
146
150
|
text: "Click to get a greeting",
|
|
147
151
|
onclick() {
|
|
148
152
|
const name = prompt("what are your names");
|
|
149
|
-
this.
|
|
150
|
-
text: name ? "hello " + name : "Click to get a greeting",
|
|
151
|
-
});
|
|
153
|
+
this.innerText = name ? "hello " + name : "Click to get a greeting";
|
|
152
154
|
},
|
|
153
155
|
});
|
|
154
156
|
}
|
|
@@ -185,7 +187,7 @@ function typingExample() {
|
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
function App() {
|
|
188
|
-
return div(counter, dataCounter, HelloMessage, br, nameRef);
|
|
190
|
+
return div(count, counter, dataCounter, HelloMessage, br, nameRef);
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
// add your app to the DOM
|
|
@@ -439,6 +441,7 @@ We are currently working to [set](https://github.com/fridaycandour/cradova/blob/
|
|
|
439
441
|
- UI component libraries for cradova
|
|
440
442
|
- Sample projects
|
|
441
443
|
- maintenance and promotion
|
|
444
|
+
<!--
|
|
442
445
|
|
|
443
446
|
## Sponsor
|
|
444
447
|
|
|
@@ -446,4 +449,4 @@ Your support is appreciated and needed to advance Cradova for more performance a
|
|
|
446
449
|
|
|
447
450
|
Sponsorships can be done via [Patreon](https://www.patreon.com/FridayCandour) and [KO-FI](https://www.ko-fi.com/fridaycandour).
|
|
448
451
|
|
|
449
|
-
Both monthly-recurring sponsorships and one-time donations are accepted.
|
|
452
|
+
Both monthly-recurring sponsorships and one-time donations are accepted. -->
|
package/package.json
CHANGED
package/dist/index.d.ts
DELETED
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
declare module "cradova" {
|
|
2
|
-
type ElementType<T> = (
|
|
3
|
-
...VJS: (
|
|
4
|
-
| string
|
|
5
|
-
| undefined
|
|
6
|
-
| Partial<T>
|
|
7
|
-
| HTMLElement
|
|
8
|
-
| (() => HTMLElement)
|
|
9
|
-
| {
|
|
10
|
-
style?: Partial<CSSStyleDeclaration>;
|
|
11
|
-
beforeMount?: () => void;
|
|
12
|
-
afterMount?: () => void;
|
|
13
|
-
text?: string;
|
|
14
|
-
reference?: any;
|
|
15
|
-
stateID?: string;
|
|
16
|
-
shouldUpdate?: boolean;
|
|
17
|
-
}
|
|
18
|
-
)[]
|
|
19
|
-
) => T;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
type CradovaScreenType = {
|
|
24
|
-
/**
|
|
25
|
-
* Cradova screen
|
|
26
|
-
* ---
|
|
27
|
-
* title of the page
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* .
|
|
31
|
-
*/
|
|
32
|
-
name: string;
|
|
33
|
-
/**
|
|
34
|
-
* Cradova screen
|
|
35
|
-
* ---
|
|
36
|
-
* a css className to add to screen when rendering it
|
|
37
|
-
* Usually for adding css transitions
|
|
38
|
-
* .
|
|
39
|
-
*/
|
|
40
|
-
transition?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Cradova screen
|
|
43
|
-
* ---
|
|
44
|
-
* The component for the screen
|
|
45
|
-
* @param data
|
|
46
|
-
* @returns void
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* .
|
|
50
|
-
*/
|
|
51
|
-
template: Function | HTMLElement;
|
|
52
|
-
/**
|
|
53
|
-
* Cradova screen
|
|
54
|
-
* ---
|
|
55
|
-
* Allows this screen render in parallel for unique routes
|
|
56
|
-
*
|
|
57
|
-
* limit is 1000
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* .
|
|
62
|
-
*/
|
|
63
|
-
renderInParallel?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Cradova screen
|
|
66
|
-
* ---
|
|
67
|
-
* gets called when the the screen is displayed
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* .
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* Cradova screen
|
|
74
|
-
* ---
|
|
75
|
-
* Should this screen be cached after first render?
|
|
76
|
-
* you can use Route.navigate(url, null, true) to force later
|
|
77
|
-
*
|
|
78
|
-
* .
|
|
79
|
-
*/
|
|
80
|
-
persist?: boolean;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const a: ElementType<HTMLAnchorElement>;
|
|
84
|
-
export const abbr: ElementType<HTMLElement>;
|
|
85
|
-
export const address: ElementType<HTMLElement>;
|
|
86
|
-
export const area: ElementType<HTMLAreaElement>;
|
|
87
|
-
export const article: ElementType<HTMLElement>;
|
|
88
|
-
export const aside: ElementType<HTMLElement>;
|
|
89
|
-
export const audio: ElementType<HTMLAudioElement>;
|
|
90
|
-
export const b: ElementType<HTMLElement>;
|
|
91
|
-
export const base: ElementType<HTMLBaseElement>;
|
|
92
|
-
export const bdi: ElementType<HTMLElement>;
|
|
93
|
-
export const bdo: ElementType<HTMLElement>;
|
|
94
|
-
export const blockquote: ElementType<HTMLElement>;
|
|
95
|
-
export const body: ElementType<HTMLBodyElement>;
|
|
96
|
-
export const br: ElementType<HTMLBRElement>;
|
|
97
|
-
export const button: ElementType<HTMLButtonElement>;
|
|
98
|
-
export const canvas: ElementType<HTMLCanvasElement>;
|
|
99
|
-
export const caption: ElementType<HTMLTableCaptionElement>;
|
|
100
|
-
export const cite: ElementType<HTMLElement>;
|
|
101
|
-
export const code: ElementType<HTMLElement>;
|
|
102
|
-
export const col: ElementType<HTMLTableColElement>;
|
|
103
|
-
export const colgroup: ElementType<HTMLElement>;
|
|
104
|
-
export const data: ElementType<HTMLDataElement>;
|
|
105
|
-
export const datalist: ElementType<HTMLDataListElement>;
|
|
106
|
-
export const dd: ElementType<HTMLElement>;
|
|
107
|
-
export const del: ElementType<HTMLElement>;
|
|
108
|
-
export const details: ElementType<HTMLDetailsElement>;
|
|
109
|
-
export const dfn: ElementType<HTMLElement>;
|
|
110
|
-
export const dialog: ElementType<HTMLDialogElement>;
|
|
111
|
-
export const div: ElementType<HTMLDivElement>;
|
|
112
|
-
export const dl: ElementType<HTMLElement>;
|
|
113
|
-
export const dt: ElementType<HTMLElement>;
|
|
114
|
-
export const em: ElementType<HTMLElement>;
|
|
115
|
-
export const embed: ElementType<HTMLEmbedElement>;
|
|
116
|
-
export const fieldset: ElementType<HTMLFieldSetElement>;
|
|
117
|
-
export const figcaption: ElementType<HTMLElement>;
|
|
118
|
-
export const figure: ElementType<HTMLElement>;
|
|
119
|
-
export const footer: ElementType<HTMLElement>;
|
|
120
|
-
export const form: ElementType<HTMLFormElement>;
|
|
121
|
-
export const h1: ElementType<HTMLHeadingElement>;
|
|
122
|
-
export const h2: ElementType<HTMLHeadingElement>;
|
|
123
|
-
export const h3: ElementType<HTMLHeadingElement>;
|
|
124
|
-
export const h4: ElementType<HTMLHeadingElement>;
|
|
125
|
-
export const h5: ElementType<HTMLHeadingElement>;
|
|
126
|
-
export const h6: ElementType<HTMLHeadingElement>;
|
|
127
|
-
export const head: ElementType<HTMLHeadElement>;
|
|
128
|
-
export const header: ElementType<HTMLElement>;
|
|
129
|
-
export const hr: ElementType<HTMLHRElement>;
|
|
130
|
-
export const html: ElementType<HTMLHtmlElement>;
|
|
131
|
-
export const i: ElementType<HTMLElement>;
|
|
132
|
-
export const iframe: ElementType<HTMLIFrameElement>;
|
|
133
|
-
export const img: ElementType<HTMLImageElement>;
|
|
134
|
-
export const input: ElementType<HTMLInputElement>;
|
|
135
|
-
export const ins: ElementType<HTMLElement>;
|
|
136
|
-
export const kbd: ElementType<HTMLElement>;
|
|
137
|
-
export const label: ElementType<HTMLLabelElement>;
|
|
138
|
-
export const legend: ElementType<HTMLLegendElement>;
|
|
139
|
-
export const li: ElementType<HTMLLIElement>;
|
|
140
|
-
export const link: ElementType<HTMLLinkElement>;
|
|
141
|
-
export const main: ElementType<HTMLElement>;
|
|
142
|
-
export const map: ElementType<HTMLMapElement>;
|
|
143
|
-
export const mark: ElementType<HTMLElement>;
|
|
144
|
-
export const math: ElementType<HTMLElement>;
|
|
145
|
-
export const menu: ElementType<HTMLMenuElement>;
|
|
146
|
-
export const meta: ElementType<HTMLMetaElement>;
|
|
147
|
-
export const meter: ElementType<HTMLMeterElement>;
|
|
148
|
-
export const nav: ElementType<HTMLElement>;
|
|
149
|
-
export const object: ElementType<HTMLObjectElement>;
|
|
150
|
-
export const ol: ElementType<HTMLOListElement>;
|
|
151
|
-
export const optgroup: ElementType<HTMLOptGroupElement>;
|
|
152
|
-
export const option: ElementType<HTMLOptionElement>;
|
|
153
|
-
export const output: ElementType<HTMLOutputElement>;
|
|
154
|
-
export const p: ElementType<HTMLParagraphElement>;
|
|
155
|
-
export const picture: ElementType<HTMLPictureElement>;
|
|
156
|
-
export const portal: ElementType<HTMLElement>;
|
|
157
|
-
export const pre: ElementType<HTMLPreElement>;
|
|
158
|
-
export const progress: ElementType<HTMLProgressElement>;
|
|
159
|
-
export const q: ElementType<HTMLQuoteElement>;
|
|
160
|
-
export const rp: ElementType<HTMLElement>;
|
|
161
|
-
export const rt: ElementType<HTMLElement>;
|
|
162
|
-
export const ruby: ElementType<HTMLElement>;
|
|
163
|
-
export const s: ElementType<HTMLElement>;
|
|
164
|
-
export const samp: ElementType<HTMLElement>;
|
|
165
|
-
export const script: ElementType<HTMLScriptElement>;
|
|
166
|
-
export const section: ElementType<HTMLElement>;
|
|
167
|
-
export const select: ElementType<HTMLSelectElement>;
|
|
168
|
-
export const slot: ElementType<HTMLSlotElement>;
|
|
169
|
-
export const small: ElementType<HTMLElement>;
|
|
170
|
-
export const source: ElementType<HTMLSourceElement>;
|
|
171
|
-
export const span: ElementType<HTMLSpanElement>;
|
|
172
|
-
export const strong: ElementType<HTMLElement>;
|
|
173
|
-
export const style: ElementType<HTMLStyleElement>;
|
|
174
|
-
export const sub: ElementType<HTMLElement>;
|
|
175
|
-
export const summary: ElementType<HTMLElement>;
|
|
176
|
-
export const sup: ElementType<HTMLElement>;
|
|
177
|
-
export const table: ElementType<HTMLTableElement>;
|
|
178
|
-
export const tbody: ElementType<HTMLTableColElement>;
|
|
179
|
-
export const td: ElementType<HTMLTableCellElement>;
|
|
180
|
-
export const template: ElementType<HTMLTemplateElement>;
|
|
181
|
-
export const textarea: ElementType<HTMLTextAreaElement>;
|
|
182
|
-
export const tfoot: ElementType<HTMLElement>;
|
|
183
|
-
export const th: ElementType<HTMLTableSectionElement>;
|
|
184
|
-
export const thead: ElementType<HTMLTableSectionElement>;
|
|
185
|
-
export const time: ElementType<HTMLTimeElement>;
|
|
186
|
-
export const title: ElementType<HTMLTitleElement>;
|
|
187
|
-
export const tr: ElementType<HTMLTableRowElement>;
|
|
188
|
-
export const track: ElementType<HTMLTrackElement>;
|
|
189
|
-
export const u: ElementType<HTMLElement>;
|
|
190
|
-
export const ul: ElementType<HTMLUListElement>;
|
|
191
|
-
export const val: ElementType<HTMLElement>;
|
|
192
|
-
export const video: ElementType<HTMLVideoElement>;
|
|
193
|
-
export const wbr: ElementType<HTMLElement>;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
* Cradova Ajax
|
|
198
|
-
* ------------------
|
|
199
|
-
* your new axios alternative
|
|
200
|
-
* supports files upload
|
|
201
|
-
* @param url string
|
|
202
|
-
* @param {{method: string;data;header;callbacks;}} opts
|
|
203
|
-
* @returns any
|
|
204
|
-
*/
|
|
205
|
-
export function Ajax(
|
|
206
|
-
url: string | URL,
|
|
207
|
-
opts?:
|
|
208
|
-
| {
|
|
209
|
-
method?: "GET" | "POST";
|
|
210
|
-
data?: Record<string, any>;
|
|
211
|
-
header?: {
|
|
212
|
-
"content-type": string;
|
|
213
|
-
} & Record<string, any>;
|
|
214
|
-
callbacks?: Record<string, (arg: any) => void>;
|
|
215
|
-
}
|
|
216
|
-
| any
|
|
217
|
-
): Promise<unknown>;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Cradova event
|
|
221
|
-
*/
|
|
222
|
-
export class cradovaEvent {
|
|
223
|
-
private listeners;
|
|
224
|
-
addEventListener(eventName: string, callback: any): void;
|
|
225
|
-
removeEventListener(eventName: string, callback: any): void;
|
|
226
|
-
dispatchEvent(eventName: string, eventArgs?: any): void;
|
|
227
|
-
}
|
|
228
|
-
export const CradovaEvent: cradovaEvent;
|
|
229
|
-
export function css(identifier: string | TemplateStringsArray): void;
|
|
230
|
-
/**
|
|
231
|
-
*
|
|
232
|
-
* @param {expression} condition
|
|
233
|
-
* @param {function} elements[]
|
|
234
|
-
*/
|
|
235
|
-
export function assert(condition: any, ...elements: any): any;
|
|
236
|
-
export function loop(
|
|
237
|
-
datalist: any[],
|
|
238
|
-
component: (value: any, index?: number, array?: any[]) => any
|
|
239
|
-
): HTMLElement | undefined;
|
|
240
|
-
export function assertOr(
|
|
241
|
-
condition: boolean,
|
|
242
|
-
ifTrue: () => any,
|
|
243
|
-
ifFalse: () => any
|
|
244
|
-
): () => any;
|
|
245
|
-
/**
|
|
246
|
-
* Cradova Ref
|
|
247
|
-
* -------
|
|
248
|
-
* create dynamic components
|
|
249
|
-
*/
|
|
250
|
-
type RefProps<D> = D | any;
|
|
251
|
-
export class Ref<D> {
|
|
252
|
-
private component;
|
|
253
|
-
private effects;
|
|
254
|
-
private effectuate;
|
|
255
|
-
private rendered;
|
|
256
|
-
private published;
|
|
257
|
-
private hasFirstStateUpdateRun;
|
|
258
|
-
private preRendered;
|
|
259
|
-
private reference;
|
|
260
|
-
Signal: createSignal<any> | undefined;
|
|
261
|
-
stash: D | undefined;
|
|
262
|
-
constructor(component: (data?: RefProps<D>) => any);
|
|
263
|
-
preRender(data?: RefProps<D>): void;
|
|
264
|
-
destroyPreRendered(): void;
|
|
265
|
-
/**
|
|
266
|
-
* Cradova Ref
|
|
267
|
-
* ---
|
|
268
|
-
* returns html with cradova reference
|
|
269
|
-
* @param data
|
|
270
|
-
* @returns () => HTMLElement
|
|
271
|
-
*/
|
|
272
|
-
render(data?: D, stash?: boolean): HTMLElement;
|
|
273
|
-
instance(): Record<string, any>;
|
|
274
|
-
_setExtra(Extra: createSignal<any>): void;
|
|
275
|
-
/**
|
|
276
|
-
* Cradova Ref
|
|
277
|
-
* ---
|
|
278
|
-
* runs on first state update
|
|
279
|
-
*
|
|
280
|
-
*/
|
|
281
|
-
effect(fn: () => Promise<unknown>): void;
|
|
282
|
-
private effector;
|
|
283
|
-
/**
|
|
284
|
-
* Cradova Ref
|
|
285
|
-
* ---
|
|
286
|
-
* update ref component with new data and update the dom.
|
|
287
|
-
* @param data
|
|
288
|
-
* @returns void
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* .
|
|
292
|
-
*/
|
|
293
|
-
updateState(data: D, stash?: boolean): void;
|
|
294
|
-
private Activate;
|
|
295
|
-
remove(): void;
|
|
296
|
-
}
|
|
297
|
-
export const svgNS: (
|
|
298
|
-
type: string,
|
|
299
|
-
props: Record<string, any>,
|
|
300
|
-
...children: any
|
|
301
|
-
) => HTMLElement;
|
|
302
|
-
export class lazy {
|
|
303
|
-
content: any;
|
|
304
|
-
private _cb;
|
|
305
|
-
constructor(cb: () => Promise<any>);
|
|
306
|
-
load(): Promise<void>;
|
|
307
|
-
}
|
|
308
|
-
export class reference {
|
|
309
|
-
[x: string]: Record<string, any>;
|
|
310
|
-
bindAs(name: string): any;
|
|
311
|
-
_appendDom(name: string, Element: any): void;
|
|
312
|
-
_appendDomForce(name: string, Element: any): void;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Cradova Signal
|
|
317
|
-
* ----
|
|
318
|
-
* create stateful data store.
|
|
319
|
-
* ability to:
|
|
320
|
-
* - create store
|
|
321
|
-
* - create actions and fire them
|
|
322
|
-
* - bind a Ref
|
|
323
|
-
* - listen to changes
|
|
324
|
-
* - persist changes to localStorage
|
|
325
|
-
* - set keys instead of all values
|
|
326
|
-
* - update a cradova Ref and bindings automatically
|
|
327
|
-
* @constructor initial: any, props: {useHistory, persist}
|
|
328
|
-
*/
|
|
329
|
-
|
|
330
|
-
export class createSignal<Type extends Record<string, any>> {
|
|
331
|
-
private callback;
|
|
332
|
-
private persistName;
|
|
333
|
-
private actions;
|
|
334
|
-
private ref;
|
|
335
|
-
value: Type;
|
|
336
|
-
constructor(
|
|
337
|
-
initial: Type,
|
|
338
|
-
props?: {
|
|
339
|
-
persistName?: string | undefined;
|
|
340
|
-
}
|
|
341
|
-
);
|
|
342
|
-
/**
|
|
343
|
-
* Cradova Signal
|
|
344
|
-
* ----
|
|
345
|
-
* set signal value
|
|
346
|
-
* @param value - signal value
|
|
347
|
-
* @returns void
|
|
348
|
-
*/
|
|
349
|
-
set(value: Type | ((value: Type) => Type), shouldRefRender?: boolean): void;
|
|
350
|
-
/**
|
|
351
|
-
* Cradova Signal
|
|
352
|
-
* ----
|
|
353
|
-
* set a key value if it's an object
|
|
354
|
-
* @param key - key of the key
|
|
355
|
-
* @param value - value of the key
|
|
356
|
-
* @returns void
|
|
357
|
-
*/
|
|
358
|
-
setKey<k extends keyof Type>(
|
|
359
|
-
key: k,
|
|
360
|
-
value: any,
|
|
361
|
-
shouldRefRender?: boolean
|
|
362
|
-
): void;
|
|
363
|
-
/**
|
|
364
|
-
* Cradova Signal
|
|
365
|
-
* ----
|
|
366
|
-
* set a key to signal an action
|
|
367
|
-
* @param key - key of the action
|
|
368
|
-
* @param action function to execute
|
|
369
|
-
*/
|
|
370
|
-
createAction(
|
|
371
|
-
key: string | Record<string, (data?: Type) => void>,
|
|
372
|
-
action?: ((data?: Type) => void) | Ref<unknown>
|
|
373
|
-
): void;
|
|
374
|
-
/**
|
|
375
|
-
* Cradova Signal
|
|
376
|
-
* ----
|
|
377
|
-
* fires an action if available
|
|
378
|
-
* @param key - string key of the action
|
|
379
|
-
* @param data - data for the action
|
|
380
|
-
*/
|
|
381
|
-
fireAction(key: string, data?: unknown): void;
|
|
382
|
-
/**
|
|
383
|
-
* Cradova
|
|
384
|
-
* ---
|
|
385
|
-
* is used to bind store data to any element
|
|
386
|
-
*
|
|
387
|
-
* @param prop
|
|
388
|
-
* @returns something
|
|
389
|
-
*/
|
|
390
|
-
bind(prop: string): (string | this)[];
|
|
391
|
-
private _updateState;
|
|
392
|
-
/**
|
|
393
|
-
* Cradova Signal
|
|
394
|
-
* ----
|
|
395
|
-
* set a auto - rendering component for this store
|
|
396
|
-
*
|
|
397
|
-
* @param Ref component to bind to.
|
|
398
|
-
* @param path a property in the object to send to attached ref
|
|
399
|
-
*/
|
|
400
|
-
bindRef(
|
|
401
|
-
ref: any,
|
|
402
|
-
binding?: {
|
|
403
|
-
event?: string;
|
|
404
|
-
signalProperty: string;
|
|
405
|
-
_element_property: string;
|
|
406
|
-
}
|
|
407
|
-
): void;
|
|
408
|
-
/**
|
|
409
|
-
* Cradova Signal
|
|
410
|
-
* ----
|
|
411
|
-
* set a update listener on value changes
|
|
412
|
-
* @param callback
|
|
413
|
-
*/
|
|
414
|
-
listen(callback: (a: any) => void): void;
|
|
415
|
-
/**
|
|
416
|
-
* Cradova Signal
|
|
417
|
-
* ----
|
|
418
|
-
* clear the history on local storage
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* .
|
|
422
|
-
*/
|
|
423
|
-
clearPersist(): void;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
type stateType =
|
|
427
|
-
| Partial<HTMLElement>
|
|
428
|
-
| {
|
|
429
|
-
class?: string;
|
|
430
|
-
text?: string;
|
|
431
|
-
style?: Partial<CSSStyleDeclaration>;
|
|
432
|
-
tree?: Function | HTMLElement;
|
|
433
|
-
remove?: boolean;
|
|
434
|
-
};
|
|
435
|
-
type stateID = string;
|
|
436
|
-
/**
|
|
437
|
-
* Send a new state to specified element with stateID
|
|
438
|
-
*
|
|
439
|
-
* @param stateID
|
|
440
|
-
* @param state
|
|
441
|
-
* @returns element(s)
|
|
442
|
-
*/
|
|
443
|
-
export function dispatch(
|
|
444
|
-
stateID: stateID | Record<stateID, stateType>,
|
|
445
|
-
state?: stateType
|
|
446
|
-
): any;
|
|
447
|
-
|
|
448
|
-
/** cradova router
|
|
449
|
-
* ---
|
|
450
|
-
* Registers a route.
|
|
451
|
-
*
|
|
452
|
-
* @param {string} path Route path.
|
|
453
|
-
* @param {any} screen the cradova document tree for the route.
|
|
454
|
-
*/
|
|
455
|
-
class RouterClass {
|
|
456
|
-
/** cradova router
|
|
457
|
-
* ---
|
|
458
|
-
* Registers a route.
|
|
459
|
-
*
|
|
460
|
-
* accepts an object containing
|
|
461
|
-
*
|
|
462
|
-
* @param {string} path Route path.
|
|
463
|
-
* @param {any} screen the cradova screen.
|
|
464
|
-
*/
|
|
465
|
-
BrowserRoutes(obj: Record<string, any>): void;
|
|
466
|
-
/**
|
|
467
|
-
* Cradova Router
|
|
468
|
-
* ------
|
|
469
|
-
*
|
|
470
|
-
* Navigates to a designated screen in your app
|
|
471
|
-
*
|
|
472
|
-
* @param href string
|
|
473
|
-
* @param data object
|
|
474
|
-
* @param force boolean
|
|
475
|
-
*/
|
|
476
|
-
navigate(
|
|
477
|
-
href: string,
|
|
478
|
-
data?: Record<string, any> | null,
|
|
479
|
-
force?: boolean
|
|
480
|
-
): void;
|
|
481
|
-
/** cradova router
|
|
482
|
-
* ---
|
|
483
|
-
* Listen for navigation events
|
|
484
|
-
*
|
|
485
|
-
* @param callback () => void
|
|
486
|
-
*/
|
|
487
|
-
onPageEvent(callback: () => void): void;
|
|
488
|
-
/** cradova router
|
|
489
|
-
* ---
|
|
490
|
-
* get a screen ready before time.
|
|
491
|
-
*
|
|
492
|
-
* @param {string} path Route path.
|
|
493
|
-
* @param {any} data data for the screen.
|
|
494
|
-
*/
|
|
495
|
-
packageScreen(path: string, data?: any): Promise<void>;
|
|
496
|
-
/**
|
|
497
|
-
* Cradova Router
|
|
498
|
-
* ------
|
|
499
|
-
*
|
|
500
|
-
* return last set router params
|
|
501
|
-
*
|
|
502
|
-
* .
|
|
503
|
-
*/
|
|
504
|
-
getParams: () => any;
|
|
505
|
-
/**
|
|
506
|
-
* Cradova
|
|
507
|
-
* ---
|
|
508
|
-
* Error Handler for your app
|
|
509
|
-
*
|
|
510
|
-
* @param callback
|
|
511
|
-
* @param path? page path
|
|
512
|
-
*/
|
|
513
|
-
addErrorHandler(callback: () => void): void;
|
|
514
|
-
_mount(): void;
|
|
515
|
-
}
|
|
516
|
-
export const Router: RouterClass;
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Cradova Screen
|
|
520
|
-
* ---
|
|
521
|
-
* create instances of manageable pages and scaffolds
|
|
522
|
-
* @param name
|
|
523
|
-
* @param template
|
|
524
|
-
* @param transitions
|
|
525
|
-
*/
|
|
526
|
-
export class Screen {
|
|
527
|
-
/**
|
|
528
|
-
* this should be a cradova screen component
|
|
529
|
-
*/
|
|
530
|
-
_html: Function;
|
|
531
|
-
/**
|
|
532
|
-
* this is a set of added html to the screen
|
|
533
|
-
*/
|
|
534
|
-
_secondaryChildren: Array<Node>;
|
|
535
|
-
/**
|
|
536
|
-
* error handler for the screen
|
|
537
|
-
*/
|
|
538
|
-
errorHandler: (() => void) | null;
|
|
539
|
-
/**
|
|
540
|
-
* used internally
|
|
541
|
-
*/
|
|
542
|
-
_name: string;
|
|
543
|
-
private _packed;
|
|
544
|
-
private _template;
|
|
545
|
-
private _callBack;
|
|
546
|
-
private _deCallBack;
|
|
547
|
-
private _persist;
|
|
548
|
-
private _data;
|
|
549
|
-
_params: Record<string, any> | null;
|
|
550
|
-
private _delegatedRoutesCount;
|
|
551
|
-
private _transition;
|
|
552
|
-
constructor(cradova_screen_initials: CradovaScreenType);
|
|
553
|
-
get _delegatedRoutes(): boolean;
|
|
554
|
-
set _delegatedRoutes(count: boolean);
|
|
555
|
-
get _paramData(): typeof this._params;
|
|
556
|
-
set _paramData(params: typeof this._params);
|
|
557
|
-
setErrorHandler(errorHandler: () => void): void;
|
|
558
|
-
_package(): Promise<void>;
|
|
559
|
-
onActivate(cb: () => Promise<void> | void): void;
|
|
560
|
-
onDeactivate(cb: () => Promise<void> | void): void;
|
|
561
|
-
addChild(...addOns: any[]): void;
|
|
562
|
-
_deActivate(): Promise<void>;
|
|
563
|
-
_Activate(force?: boolean): Promise<void>;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Cradova
|
|
568
|
-
* ---
|
|
569
|
-
* Creates new cradova HTML element
|
|
570
|
-
* @example
|
|
571
|
-
* // using template
|
|
572
|
-
* const p = _("p");
|
|
573
|
-
* _("p.class");
|
|
574
|
-
* _("p#id");
|
|
575
|
-
* _("p.class#id");
|
|
576
|
-
* _("p.foo.bar#poo.loo");
|
|
577
|
-
*
|
|
578
|
-
* // using inline props
|
|
579
|
-
*
|
|
580
|
-
* _("p",{
|
|
581
|
-
* text: "am a p tag",
|
|
582
|
-
* style: {
|
|
583
|
-
* color: "blue"
|
|
584
|
-
* }
|
|
585
|
-
* })
|
|
586
|
-
*
|
|
587
|
-
* // props and children
|
|
588
|
-
* _("p", // template first
|
|
589
|
-
* // property next if wanted
|
|
590
|
-
* {style: {color: "brown"}, // optional
|
|
591
|
-
* // the rest should be children or text
|
|
592
|
-
* _("span", " am a span tag text like so"),
|
|
593
|
-
* ...
|
|
594
|
-
* )
|
|
595
|
-
*
|
|
596
|
-
* @param {...any[]} element_initials
|
|
597
|
-
* @returns function - cradova element
|
|
598
|
-
*/
|
|
599
|
-
const _: any;
|
|
600
|
-
export default _;
|
|
601
|
-
}
|