cradova 2.3.1 → 3.0.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 +12 -11
- package/dist/index.d.ts +381 -359
- package/dist/index.js +411 -561
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,253 +1,149 @@
|
|
|
1
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
2
|
/**
|
|
21
|
-
*
|
|
3
|
+
* Cradova Signal
|
|
4
|
+
* ----
|
|
5
|
+
* Create stateful data store.
|
|
6
|
+
* Features:
|
|
7
|
+
* - create a store
|
|
8
|
+
* - create actions and fire them
|
|
9
|
+
* - bind a Ref and elements
|
|
10
|
+
* - listen to updates
|
|
11
|
+
* - set object keys instead of all values
|
|
12
|
+
* - persist changes to localStorage
|
|
13
|
+
* - update a cradova Ref automatically
|
|
14
|
+
* @constructor initial: unknown, props: {useHistory, persist}
|
|
22
15
|
*/
|
|
23
|
-
|
|
16
|
+
export class createSignal<Type extends Record<string, unknown>> {
|
|
17
|
+
private callback;
|
|
18
|
+
private persistName;
|
|
19
|
+
private actions;
|
|
20
|
+
private ref;
|
|
21
|
+
value: Type;
|
|
22
|
+
constructor(
|
|
23
|
+
initial: Type,
|
|
24
|
+
props?: {
|
|
25
|
+
persistName?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
);
|
|
24
28
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* .
|
|
29
|
+
* Cradova Signal
|
|
30
|
+
* ----
|
|
31
|
+
* set signal value
|
|
32
|
+
* @param value - signal value
|
|
33
|
+
* @returns void
|
|
31
34
|
*/
|
|
32
|
-
|
|
35
|
+
set(value: Type | ((value: Type) => Type), shouldRefRender?: boolean): void;
|
|
33
36
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* a
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* Cradova Signal
|
|
38
|
+
* ----
|
|
39
|
+
* set a key value if it's an object
|
|
40
|
+
* @param key - key of the key
|
|
41
|
+
* @param value - value of the key
|
|
42
|
+
* @returns void
|
|
39
43
|
*/
|
|
40
|
-
|
|
44
|
+
setKey<k extends keyof Type>(
|
|
45
|
+
key: k,
|
|
46
|
+
value: unknown,
|
|
47
|
+
shouldRefRender?: boolean
|
|
48
|
+
): void;
|
|
41
49
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @param
|
|
46
|
-
* @
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* .
|
|
50
|
+
* Cradova Signal
|
|
51
|
+
* ----
|
|
52
|
+
* set a key to signal an action
|
|
53
|
+
* @param name - name of the action
|
|
54
|
+
* @param action function to execute
|
|
50
55
|
*/
|
|
51
|
-
|
|
56
|
+
createAction(name: string, action: (data?: unknown) => void): void;
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* .
|
|
58
|
+
* Cradova Signal
|
|
59
|
+
* ----
|
|
60
|
+
* creates man y actions at a time
|
|
61
|
+
* @param name - name of the action
|
|
62
|
+
* @param action function to execute
|
|
62
63
|
*/
|
|
63
|
-
|
|
64
|
+
createActions(Actions: Record<string, (data?: unknown) => void>): void;
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Cradova Signal
|
|
67
|
+
* ----
|
|
68
|
+
* fires an action if available
|
|
69
|
+
* @param key - string key of the action
|
|
70
|
+
* @param data - data for the action
|
|
71
|
+
*/
|
|
72
|
+
fireAction(key: string, data?: unknown): void;
|
|
73
|
+
/**
|
|
74
|
+
* Cradova
|
|
66
75
|
* ---
|
|
67
|
-
*
|
|
76
|
+
* is used to bind signal data to elements and Refs
|
|
68
77
|
*
|
|
78
|
+
* @param prop
|
|
79
|
+
* @returns something
|
|
80
|
+
*/
|
|
81
|
+
bind(prop: string): any;
|
|
82
|
+
private _updateState;
|
|
83
|
+
/**
|
|
84
|
+
* Cradova Signal
|
|
85
|
+
* ----
|
|
86
|
+
* set a auto - rendering component for this store
|
|
69
87
|
*
|
|
70
|
-
* .
|
|
88
|
+
* @param Ref component to bind to.
|
|
89
|
+
* @param path a property in the object to send to attached ref
|
|
71
90
|
*/
|
|
91
|
+
bindRef(
|
|
92
|
+
ref: Partial<Ref<unknown>>, //! there's more to this friday (even elements act as ref here because of the updateState)
|
|
93
|
+
binding?: {
|
|
94
|
+
event?: string;
|
|
95
|
+
signalProperty: string;
|
|
96
|
+
_element_property: string;
|
|
97
|
+
}
|
|
98
|
+
): void;
|
|
72
99
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
100
|
+
* Cradova Signal
|
|
101
|
+
* ----
|
|
102
|
+
* set a update listener on value changes
|
|
103
|
+
* @param callback
|
|
104
|
+
*/
|
|
105
|
+
listen(callback: (a: Type) => void): void;
|
|
106
|
+
/**
|
|
107
|
+
* Cradova Signal
|
|
108
|
+
* ----
|
|
109
|
+
* clear the history on local storage
|
|
77
110
|
*
|
|
78
|
-
* .
|
|
79
111
|
*/
|
|
80
|
-
|
|
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;
|
|
112
|
+
clearPersist(): void;
|
|
227
113
|
}
|
|
228
|
-
|
|
114
|
+
|
|
229
115
|
export function css(identifier: string | TemplateStringsArray): void;
|
|
230
116
|
/**
|
|
231
117
|
*
|
|
232
118
|
* @param {expression} condition
|
|
233
119
|
* @param {function} elements[]
|
|
234
120
|
*/
|
|
235
|
-
export function assert(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
121
|
+
export function assert(
|
|
122
|
+
condition: boolean,
|
|
123
|
+
...elements: VJS_Child_TYPE<HTMLElement>[]
|
|
124
|
+
): VJS_Child_TYPE<HTMLElement> | undefined;
|
|
125
|
+
|
|
126
|
+
type LoopData<Type> = Type[];
|
|
127
|
+
|
|
128
|
+
export function loop<Type>(
|
|
129
|
+
datalist: LoopData<Type>,
|
|
130
|
+
component: (
|
|
131
|
+
value: Type,
|
|
132
|
+
index?: number,
|
|
133
|
+
array?: LoopData<Type>
|
|
134
|
+
) => HTMLElement | undefined
|
|
239
135
|
): HTMLElement | undefined;
|
|
240
136
|
export function assertOr(
|
|
241
137
|
condition: boolean,
|
|
242
|
-
ifTrue:
|
|
243
|
-
ifFalse:
|
|
244
|
-
):
|
|
138
|
+
ifTrue: HTMLElement | HTMLElement[],
|
|
139
|
+
ifFalse: HTMLElement | HTMLElement[]
|
|
140
|
+
): HTMLElement;
|
|
245
141
|
/**
|
|
246
142
|
* Cradova Ref
|
|
247
143
|
* -------
|
|
248
144
|
* create dynamic components
|
|
249
145
|
*/
|
|
250
|
-
|
|
146
|
+
|
|
251
147
|
export class Ref<D> {
|
|
252
148
|
private component;
|
|
253
149
|
private effects;
|
|
@@ -259,8 +155,8 @@ declare module "cradova" {
|
|
|
259
155
|
private reference;
|
|
260
156
|
Signal: createSignal<any> | undefined;
|
|
261
157
|
stash: D | undefined;
|
|
262
|
-
constructor(component: (
|
|
263
|
-
preRender(data?:
|
|
158
|
+
constructor(component: (this: Ref<D>, data: D) => HTMLElement);
|
|
159
|
+
preRender(data?: D | undefined): void;
|
|
264
160
|
destroyPreRendered(): void;
|
|
265
161
|
/**
|
|
266
162
|
* Cradova Ref
|
|
@@ -278,7 +174,7 @@ declare module "cradova" {
|
|
|
278
174
|
* runs on first state update
|
|
279
175
|
*
|
|
280
176
|
*/
|
|
281
|
-
effect(fn: () => Promise<
|
|
177
|
+
effect(fn: () => Promise<void> | void): void;
|
|
282
178
|
private effector;
|
|
283
179
|
/**
|
|
284
180
|
* Cradova Ref
|
|
@@ -294,163 +190,243 @@ declare module "cradova" {
|
|
|
294
190
|
private Activate;
|
|
295
191
|
remove(): void;
|
|
296
192
|
}
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
props: Record<string, any>,
|
|
300
|
-
...children: any
|
|
301
|
-
) => HTMLElement;
|
|
302
|
-
export class lazy {
|
|
303
|
-
content: any;
|
|
193
|
+
export class lazy<Type> {
|
|
194
|
+
public content: Type | undefined;
|
|
304
195
|
private _cb;
|
|
305
|
-
constructor(cb: () => Promise<
|
|
196
|
+
constructor(cb: () => Promise<unknown>);
|
|
306
197
|
load(): Promise<void>;
|
|
307
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Cradova
|
|
201
|
+
* ---
|
|
202
|
+
* make reference to dom elements
|
|
203
|
+
*/
|
|
308
204
|
export class reference {
|
|
309
205
|
[x: string]: Record<string, any>;
|
|
310
|
-
bindAs(name: string):
|
|
311
|
-
_appendDom(name: string, Element:
|
|
312
|
-
_appendDomForce(name: string, Element:
|
|
206
|
+
bindAs(name: string): reference;
|
|
207
|
+
// _appendDom(name: string, Element: HTMLElement): void;
|
|
208
|
+
_appendDomForce(name: string, Element: HTMLElement): void;
|
|
313
209
|
}
|
|
314
210
|
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
*/
|
|
211
|
+
type DataAttributes = { [key: `data-${string}`]: string };
|
|
212
|
+
type AriaAttributes = { [key: `aria-${string}`]: string };
|
|
329
213
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
214
|
+
type VJSType<T> = (
|
|
215
|
+
...VJS: (
|
|
216
|
+
| undefined
|
|
217
|
+
| string
|
|
218
|
+
| Partial<T>
|
|
219
|
+
| HTMLElement
|
|
220
|
+
| HTMLElement[]
|
|
221
|
+
| DataAttributes
|
|
222
|
+
| AriaAttributes
|
|
223
|
+
| (() => HTMLElement)
|
|
224
|
+
| {
|
|
225
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
226
|
+
onmount?: (this: T) => void;
|
|
227
|
+
text?: string;
|
|
228
|
+
reference?: reference;
|
|
229
|
+
}
|
|
230
|
+
)[]
|
|
231
|
+
) => T;
|
|
232
|
+
type VJS_params_TYPE<T> = (
|
|
233
|
+
| undefined
|
|
234
|
+
| string
|
|
235
|
+
| Partial<T>
|
|
236
|
+
| HTMLElement
|
|
237
|
+
| HTMLElement[]
|
|
238
|
+
| Partial<CSSStyleDeclaration>
|
|
239
|
+
| DataAttributes
|
|
240
|
+
| AriaAttributes
|
|
241
|
+
| TemplateStringsArray
|
|
242
|
+
| (() => HTMLElement)
|
|
243
|
+
| any
|
|
244
|
+
| {
|
|
245
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
246
|
+
onmount?: (this: T) => void;
|
|
247
|
+
text?: string;
|
|
248
|
+
reference?: reference;
|
|
340
249
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
*/
|
|
349
|
-
set(value: Type | ((value: Type) => Type), shouldRefRender?: boolean): void;
|
|
250
|
+
)[];
|
|
251
|
+
|
|
252
|
+
type VJS_Child_TYPE<T> = undefined | string | T | (() => T);
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
type CradovaScreenType = {
|
|
350
257
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* @param value - value of the key
|
|
356
|
-
* @returns void
|
|
258
|
+
* Cradova screen
|
|
259
|
+
* ---
|
|
260
|
+
* title of the page
|
|
261
|
+
* .
|
|
357
262
|
*/
|
|
358
|
-
|
|
359
|
-
key: k,
|
|
360
|
-
value: any,
|
|
361
|
-
shouldRefRender?: boolean
|
|
362
|
-
): void;
|
|
263
|
+
name: string;
|
|
363
264
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
265
|
+
* Cradova screen
|
|
266
|
+
* ---
|
|
267
|
+
* a css className to add to screen when rendering it
|
|
268
|
+
* Usually for adding css transitions
|
|
269
|
+
* .
|
|
369
270
|
*/
|
|
370
|
-
|
|
371
|
-
key: string | Record<string, (data?: Type) => void>,
|
|
372
|
-
action?: ((data?: Type) => void) | Ref<unknown>
|
|
373
|
-
): void;
|
|
271
|
+
transition?: string;
|
|
374
272
|
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* @param
|
|
379
|
-
* @
|
|
273
|
+
* Cradova screen
|
|
274
|
+
* ---
|
|
275
|
+
* The component for the screen
|
|
276
|
+
* @param data
|
|
277
|
+
* @returns void
|
|
278
|
+
* .
|
|
380
279
|
*/
|
|
381
|
-
|
|
280
|
+
template: ((this: Screen, data?: unknown) => HTMLElement) | HTMLElement;
|
|
382
281
|
/**
|
|
383
|
-
* Cradova
|
|
282
|
+
* Cradova screen
|
|
384
283
|
* ---
|
|
385
|
-
*
|
|
284
|
+
* Allows this screen render in parallel for unique routes
|
|
386
285
|
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
286
|
+
* limit is 1000
|
|
287
|
+
* .
|
|
389
288
|
*/
|
|
390
|
-
|
|
391
|
-
private _updateState;
|
|
289
|
+
renderInParallel?: boolean;
|
|
392
290
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
291
|
+
* Cradova screen
|
|
292
|
+
* ---
|
|
293
|
+
* Should this screen be cached after first render?
|
|
294
|
+
* you can use Route.navigate(url, null, true) to force later
|
|
396
295
|
*
|
|
397
|
-
*
|
|
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
|
|
296
|
+
* .
|
|
413
297
|
*/
|
|
414
|
-
|
|
298
|
+
persist?: boolean;
|
|
415
299
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
300
|
+
* Cradova screen
|
|
301
|
+
* ---
|
|
302
|
+
* Should the loading screen be show as this screen is loading?
|
|
421
303
|
* .
|
|
422
304
|
*/
|
|
423
|
-
|
|
424
|
-
}
|
|
305
|
+
suspend?: boolean;
|
|
306
|
+
};
|
|
425
307
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
export
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
308
|
+
export const makeElement: (
|
|
309
|
+
element: HTMLElement,
|
|
310
|
+
...ElementChildrenAndPropertyList: VJS_params_TYPE<HTMLElement>
|
|
311
|
+
) => HTMLElement;
|
|
312
|
+
export const a: VJSType<HTMLAnchorElement>;
|
|
313
|
+
export const abbr: VJSType<HTMLElement>;
|
|
314
|
+
export const address: VJSType<HTMLElement>;
|
|
315
|
+
export const area: VJSType<HTMLAreaElement>;
|
|
316
|
+
export const article: VJSType<HTMLElement>;
|
|
317
|
+
export const aside: VJSType<HTMLElement>;
|
|
318
|
+
export const audio: VJSType<HTMLAudioElement>;
|
|
319
|
+
export const b: VJSType<HTMLElement>;
|
|
320
|
+
export const base: VJSType<HTMLBaseElement>;
|
|
321
|
+
export const bdi: VJSType<HTMLElement>;
|
|
322
|
+
export const bdo: VJSType<HTMLElement>;
|
|
323
|
+
export const blockquote: VJSType<HTMLElement>;
|
|
324
|
+
export const body: VJSType<HTMLBodyElement>;
|
|
325
|
+
export const br: VJSType<HTMLBRElement>;
|
|
326
|
+
export const button: VJSType<HTMLButtonElement>;
|
|
327
|
+
export const canvas: VJSType<HTMLCanvasElement>;
|
|
328
|
+
export const caption: VJSType<HTMLTableCaptionElement>;
|
|
329
|
+
export const cite: VJSType<HTMLElement>;
|
|
330
|
+
export const code: VJSType<HTMLElement>;
|
|
331
|
+
export const col: VJSType<HTMLTableColElement>;
|
|
332
|
+
export const colgroup: VJSType<HTMLElement>;
|
|
333
|
+
export const data: VJSType<HTMLDataElement>;
|
|
334
|
+
export const datalist: VJSType<HTMLDataListElement>;
|
|
335
|
+
export const dd: VJSType<HTMLElement>;
|
|
336
|
+
export const del: VJSType<HTMLElement>;
|
|
337
|
+
export const details: VJSType<HTMLDetailsElement>;
|
|
338
|
+
export const dfn: VJSType<HTMLElement>;
|
|
339
|
+
export const dialog: VJSType<HTMLDialogElement>;
|
|
340
|
+
export const div: VJSType<HTMLDivElement>;
|
|
341
|
+
export const dl: VJSType<HTMLElement>;
|
|
342
|
+
export const dt: VJSType<HTMLElement>;
|
|
343
|
+
export const em: VJSType<HTMLElement>;
|
|
344
|
+
export const embed: VJSType<HTMLEmbedElement>;
|
|
345
|
+
export const fieldset: VJSType<HTMLFieldSetElement>;
|
|
346
|
+
export const figcaption: VJSType<HTMLElement>;
|
|
347
|
+
export const figure: VJSType<HTMLElement>;
|
|
348
|
+
export const footer: VJSType<HTMLElement>;
|
|
349
|
+
export const form: VJSType<HTMLFormElement>;
|
|
350
|
+
export const h1: VJSType<HTMLHeadingElement>;
|
|
351
|
+
export const h2: VJSType<HTMLHeadingElement>;
|
|
352
|
+
export const h3: VJSType<HTMLHeadingElement>;
|
|
353
|
+
export const h4: VJSType<HTMLHeadingElement>;
|
|
354
|
+
export const h5: VJSType<HTMLHeadingElement>;
|
|
355
|
+
export const h6: VJSType<HTMLHeadingElement>;
|
|
356
|
+
export const head: VJSType<HTMLHeadElement>;
|
|
357
|
+
export const header: VJSType<HTMLElement>;
|
|
358
|
+
export const hr: VJSType<HTMLHRElement>;
|
|
359
|
+
export const html: VJSType<HTMLHtmlElement>;
|
|
360
|
+
export const i: VJSType<HTMLElement>;
|
|
361
|
+
export const iframe: VJSType<HTMLIFrameElement>;
|
|
362
|
+
export const img: VJSType<HTMLImageElement>;
|
|
363
|
+
export const input: VJSType<HTMLInputElement>;
|
|
364
|
+
export const ins: VJSType<HTMLElement>;
|
|
365
|
+
export const kbd: VJSType<HTMLElement>;
|
|
366
|
+
export const label: VJSType<HTMLLabelElement>;
|
|
367
|
+
export const legend: VJSType<HTMLLegendElement>;
|
|
368
|
+
export const li: VJSType<HTMLLIElement>;
|
|
369
|
+
export const link: VJSType<HTMLLinkElement>;
|
|
370
|
+
export const main: VJSType<HTMLElement>;
|
|
371
|
+
export const map: VJSType<HTMLMapElement>;
|
|
372
|
+
export const mark: VJSType<HTMLElement>;
|
|
373
|
+
export const math: VJSType<HTMLElement>;
|
|
374
|
+
export const menu: VJSType<HTMLMenuElement>;
|
|
375
|
+
export const meta: VJSType<HTMLMetaElement>;
|
|
376
|
+
export const meter: VJSType<HTMLMeterElement>;
|
|
377
|
+
export const nav: VJSType<HTMLElement>;
|
|
378
|
+
export const object: VJSType<HTMLObjectElement>;
|
|
379
|
+
export const ol: VJSType<HTMLOListElement>;
|
|
380
|
+
export const optgroup: VJSType<HTMLOptGroupElement>;
|
|
381
|
+
export const option: VJSType<HTMLOptionElement>;
|
|
382
|
+
export const output: VJSType<HTMLOutputElement>;
|
|
383
|
+
export const p: VJSType<HTMLParagraphElement>;
|
|
384
|
+
export const picture: VJSType<HTMLPictureElement>;
|
|
385
|
+
export const portal: VJSType<HTMLElement>;
|
|
386
|
+
export const pre: VJSType<HTMLPreElement>;
|
|
387
|
+
export const progress: VJSType<HTMLProgressElement>;
|
|
388
|
+
export const q: VJSType<HTMLQuoteElement>;
|
|
389
|
+
export const rp: VJSType<HTMLElement>;
|
|
390
|
+
export const rt: VJSType<HTMLElement>;
|
|
391
|
+
export const ruby: VJSType<HTMLElement>;
|
|
392
|
+
export const s: VJSType<HTMLElement>;
|
|
393
|
+
export const samp: VJSType<HTMLElement>;
|
|
394
|
+
export const script: VJSType<HTMLScriptElement>;
|
|
395
|
+
export const section: VJSType<HTMLElement>;
|
|
396
|
+
export const select: VJSType<HTMLSelectElement>;
|
|
397
|
+
export const slot: VJSType<HTMLSlotElement>;
|
|
398
|
+
export const small: VJSType<HTMLElement>;
|
|
399
|
+
export const source: VJSType<HTMLSourceElement>;
|
|
400
|
+
export const span: VJSType<HTMLSpanElement>;
|
|
401
|
+
export const strong: VJSType<HTMLElement>;
|
|
402
|
+
export const style: VJSType<HTMLStyleElement>;
|
|
403
|
+
export const sub: VJSType<HTMLElement>;
|
|
404
|
+
export const summary: VJSType<HTMLElement>;
|
|
405
|
+
export const sup: VJSType<HTMLElement>;
|
|
406
|
+
export const table: VJSType<HTMLTableElement>;
|
|
407
|
+
export const tbody: VJSType<HTMLTableColElement>;
|
|
408
|
+
export const td: VJSType<HTMLTableCellElement>;
|
|
409
|
+
export const template: VJSType<HTMLTemplateElement>;
|
|
410
|
+
export const textarea: VJSType<HTMLTextAreaElement>;
|
|
411
|
+
export const tfoot: VJSType<HTMLElement>;
|
|
412
|
+
export const th: VJSType<HTMLTableSectionElement>;
|
|
413
|
+
export const thead: VJSType<HTMLTableSectionElement>;
|
|
414
|
+
export const time: VJSType<HTMLTimeElement>;
|
|
415
|
+
export const title: VJSType<HTMLTitleElement>;
|
|
416
|
+
export const tr: VJSType<HTMLTableRowElement>;
|
|
417
|
+
export const track: VJSType<HTMLTrackElement>;
|
|
418
|
+
export const u: VJSType<HTMLElement>;
|
|
419
|
+
export const ul: VJSType<HTMLUListElement>;
|
|
420
|
+
export const val: VJSType<HTMLElement>;
|
|
421
|
+
export const video: VJSType<HTMLVideoElement>;
|
|
422
|
+
export const wbr: VJSType<HTMLElement>;
|
|
447
423
|
|
|
448
424
|
/** cradova router
|
|
449
425
|
* ---
|
|
450
426
|
* Registers a route.
|
|
451
427
|
*
|
|
452
428
|
* @param {string} path Route path.
|
|
453
|
-
* @param
|
|
429
|
+
* @param screen the cradova document tree for the route.
|
|
454
430
|
*/
|
|
455
431
|
class RouterClass {
|
|
456
432
|
/** cradova router
|
|
@@ -460,9 +436,17 @@ declare module "cradova" {
|
|
|
460
436
|
* accepts an object containing
|
|
461
437
|
*
|
|
462
438
|
* @param {string} path Route path.
|
|
463
|
-
* @param
|
|
439
|
+
* @param screen the cradova screen.
|
|
464
440
|
*/
|
|
465
441
|
BrowserRoutes(obj: Record<string, any>): void;
|
|
442
|
+
/**
|
|
443
|
+
Go back in Navigation history
|
|
444
|
+
*/
|
|
445
|
+
back(): void;
|
|
446
|
+
/**
|
|
447
|
+
Go forward in Navigation history
|
|
448
|
+
*/
|
|
449
|
+
forward(): void;
|
|
466
450
|
/**
|
|
467
451
|
* Cradova Router
|
|
468
452
|
* ------
|
|
@@ -475,7 +459,7 @@ declare module "cradova" {
|
|
|
475
459
|
*/
|
|
476
460
|
navigate(
|
|
477
461
|
href: string,
|
|
478
|
-
data?: Record<string,
|
|
462
|
+
data?: Record<string, unknown> | null,
|
|
479
463
|
force?: boolean
|
|
480
464
|
): void;
|
|
481
465
|
/** cradova router
|
|
@@ -490,9 +474,9 @@ declare module "cradova" {
|
|
|
490
474
|
* get a screen ready before time.
|
|
491
475
|
*
|
|
492
476
|
* @param {string} path Route path.
|
|
493
|
-
* @param
|
|
477
|
+
* @param data data for the screen.
|
|
494
478
|
*/
|
|
495
|
-
packageScreen(path: string, data?:
|
|
479
|
+
packageScreen(path: string, data?: Record<string, unknown>): Promise<void>;
|
|
496
480
|
/**
|
|
497
481
|
* Cradova Router
|
|
498
482
|
* ------
|
|
@@ -510,7 +494,18 @@ declare module "cradova" {
|
|
|
510
494
|
* @param callback
|
|
511
495
|
* @param path? page path
|
|
512
496
|
*/
|
|
513
|
-
addErrorHandler(callback: () => void): void;
|
|
497
|
+
addErrorHandler(callback: (err: unknown) => void): void;
|
|
498
|
+
/**
|
|
499
|
+
* Cradova
|
|
500
|
+
* ---
|
|
501
|
+
* Loading screen for your app
|
|
502
|
+
*
|
|
503
|
+
* lazy loaded loading use
|
|
504
|
+
*
|
|
505
|
+
* @param screen
|
|
506
|
+
*/
|
|
507
|
+
setLoadingScreen(screen: Screen): void;
|
|
508
|
+
|
|
514
509
|
_mount(): void;
|
|
515
510
|
}
|
|
516
511
|
export const Router: RouterClass;
|
|
@@ -527,15 +522,15 @@ declare module "cradova" {
|
|
|
527
522
|
/**
|
|
528
523
|
* this should be a cradova screen component
|
|
529
524
|
*/
|
|
530
|
-
_html: Function;
|
|
525
|
+
_html: Function | HTMLElement;
|
|
531
526
|
/**
|
|
532
527
|
* this is a set of added html to the screen
|
|
533
528
|
*/
|
|
534
|
-
_secondaryChildren:
|
|
529
|
+
_secondaryChildren: VJSType<HTMLElement>[];
|
|
535
530
|
/**
|
|
536
531
|
* error handler for the screen
|
|
537
532
|
*/
|
|
538
|
-
|
|
533
|
+
_errorHandler: ((err: unknown) => void) | null;
|
|
539
534
|
/**
|
|
540
535
|
* used internally
|
|
541
536
|
*/
|
|
@@ -546,23 +541,50 @@ declare module "cradova" {
|
|
|
546
541
|
private _deCallBack;
|
|
547
542
|
private _persist;
|
|
548
543
|
private _data;
|
|
549
|
-
_params: Record<string,
|
|
544
|
+
// _params: Record<string, unknown> | null;
|
|
545
|
+
_suspend: boolean;
|
|
550
546
|
private _delegatedRoutesCount;
|
|
551
547
|
private _transition;
|
|
548
|
+
private _doc;
|
|
552
549
|
constructor(cradova_screen_initials: CradovaScreenType);
|
|
553
550
|
get _delegatedRoutes(): boolean;
|
|
554
551
|
set _delegatedRoutes(count: boolean);
|
|
555
|
-
get _paramData(): typeof this._params;
|
|
556
|
-
set _paramData(params: typeof this._params);
|
|
557
|
-
setErrorHandler(errorHandler: () => void): void;
|
|
552
|
+
// get _paramData(): typeof this._params;
|
|
553
|
+
// set _paramData(params: typeof this._params);
|
|
554
|
+
setErrorHandler(errorHandler: (err: unknown) => void): void;
|
|
558
555
|
_package(): Promise<void>;
|
|
559
556
|
onActivate(cb: () => Promise<void> | void): void;
|
|
560
557
|
onDeactivate(cb: () => Promise<void> | void): void;
|
|
561
|
-
|
|
558
|
+
addChildren(...addOns: VJSType<HTMLElement>[]): void;
|
|
562
559
|
_deActivate(): Promise<void>;
|
|
563
560
|
_Activate(force?: boolean): Promise<void>;
|
|
564
561
|
}
|
|
565
562
|
|
|
563
|
+
/**
|
|
564
|
+
*
|
|
565
|
+
* Cradova Ajax
|
|
566
|
+
* ------------------
|
|
567
|
+
* your new axios alternative
|
|
568
|
+
* supports files upload
|
|
569
|
+
* @param url string
|
|
570
|
+
* @param {{method: string;data;header;callbacks;}} opts
|
|
571
|
+
* @returns unknown
|
|
572
|
+
*/
|
|
573
|
+
export function Ajax(
|
|
574
|
+
url: string | URL,
|
|
575
|
+
opts?: {
|
|
576
|
+
method?: "GET" | "POST";
|
|
577
|
+
data?: Record<string, unknown>;
|
|
578
|
+
header?: {
|
|
579
|
+
"content-type"?: string;
|
|
580
|
+
} & Record<string, string>;
|
|
581
|
+
callbacks?: Record<string, (arg: Function) => void>;
|
|
582
|
+
}
|
|
583
|
+
): Promise<unknown>;
|
|
584
|
+
|
|
585
|
+
type TemplateType = (
|
|
586
|
+
...element_initials: VJS_params_TYPE<HTMLElement>
|
|
587
|
+
) => HTMLElement;
|
|
566
588
|
/**
|
|
567
589
|
* Cradova
|
|
568
590
|
* ---
|
|
@@ -593,9 +615,9 @@ declare module "cradova" {
|
|
|
593
615
|
* ...
|
|
594
616
|
* )
|
|
595
617
|
*
|
|
596
|
-
* @param
|
|
618
|
+
* @param element_initials
|
|
597
619
|
* @returns function - cradova element
|
|
598
620
|
*/
|
|
599
|
-
const _:
|
|
621
|
+
const _: TemplateType;
|
|
600
622
|
export default _;
|
|
601
623
|
}
|