cradova 3.1.2 → 3.1.3

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +53 -31
  2. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -6,15 +6,17 @@
6
6
  ██║ ██╔══██╗ ██║ ██║ █ ██ ██║ ██ ╚██╗ ██╔╝ ██║ ██╗
7
7
  ╚██████╗ ██║ ██║ ██║ ██║ ███████╔╝ ████████ ╚███╔╝ ██║ ██║
8
8
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚════╝ ╚══╝ ╚═╝ ╚═╝
9
- =============================================================================
10
- Cradova FrameWork
11
- @version 3.0.0
12
- License: Apache V2
9
+ =============================================================================
10
+ Cradova FrameWork
11
+ @version 3.0.0
12
+ License: Apache V2
13
13
  Copyright 2022 Friday Candour.
14
14
  Repository - https://github.com/fridaycandour/cradova
15
15
  =============================================================================
16
16
  */
17
17
 
18
+ import * as CSS from "csstype";
19
+
18
20
  declare module "cradova" {
19
21
  /**
20
22
  * Cradova Signal
@@ -129,6 +131,19 @@ declare module "cradova" {
129
131
  clearPersist(): void;
130
132
  }
131
133
 
134
+ export const isNode: (element: unknown) => boolean;
135
+ /**
136
+ * Cradova event
137
+ */
138
+ export class cradovaEvent {
139
+ private listeners;
140
+ addEventListener(eventName: string, callback: () => void): void;
141
+ dispatchEvent(eventName: string, eventArgs?: unknown): void;
142
+ }
143
+ export const CradovaEvent: cradovaEvent;
144
+ export function Rhoda(
145
+ l: VJSType<HTMLElement>[] | (() => any)[] | Ref<unknown>[] | HTMLElement[]
146
+ ): DocumentFragment;
132
147
  export function css(identifier: string | TemplateStringsArray): void;
133
148
  /**
134
149
  *
@@ -138,7 +153,12 @@ declare module "cradova" {
138
153
  export function assert<Type>(
139
154
  condition: boolean,
140
155
  ...elements: VJS_Child_TYPE<Type | HTMLElement>[]
141
- ): HTMLElement[];
156
+ ): HTMLElement[] | undefined;
157
+ export function assertOr<Type>(
158
+ condition: boolean,
159
+ ifTrue: VJS_Child_TYPE<Type | HTMLElement>,
160
+ ifFalse: VJS_Child_TYPE<Type | HTMLElement>
161
+ ): VJS_Child_TYPE<HTMLElement | Type>;
142
162
  type LoopData<Type> = Type[];
143
163
  export function loop<Type>(
144
164
  datalist: LoopData<Type>,
@@ -148,11 +168,6 @@ declare module "cradova" {
148
168
  array?: LoopData<Type>
149
169
  ) => HTMLElement | DocumentFragment | undefined
150
170
  ): HTMLElement[] | undefined;
151
- export function assertOr<Type>(
152
- condition: boolean,
153
- ifTrue: VJS_Child_TYPE<Type | HTMLElement>,
154
- ifFalse: VJS_Child_TYPE<Type | HTMLElement>
155
- ): HTMLElement;
156
171
  /**
157
172
  * Cradova Ref
158
173
  * -------
@@ -201,6 +216,12 @@ declare module "cradova" {
201
216
  updateState(data?: D, stash?: boolean): void;
202
217
  private Activate;
203
218
  }
219
+ /**
220
+ * Document fragment
221
+ * @param children
222
+ * @returns
223
+ */
224
+ export const frag: (children: VJSType<HTMLElement>[]) => DocumentFragment;
204
225
  /**
205
226
  * cradova
206
227
  * ---
@@ -230,24 +251,24 @@ declare module "cradova" {
230
251
  * @param ActiveRef
231
252
  * @returns [state, setState]
232
253
  */
233
- export function useState<S>(
254
+ export function useState<S = unknown>(
234
255
  initialValue: S,
235
- ActiveRef: Ref<S>
256
+ ActiveRef: Ref<unknown>
236
257
  ): [S, (newState: S) => void];
237
258
  /**
238
- * Cradova
239
- * ---
240
- Allows side effects to be performed in functional components (Refs), such as fetching data or subscribing to events.
241
- * @param effect
242
- * @returns
243
- */
259
+ * Cradova
260
+ * ---
261
+ Allows side effects to be performed in functional components (Refs), such as fetching data or subscribing to events.
262
+ * @param effect
263
+ * @returns
264
+ */
244
265
  export function useEffect(effect: () => void, ActiveRef: Ref<unknown>): void;
245
266
  /**
246
- * Cradova
247
- * ---
248
- Returns a mutable reference object of dom elements that persists across component renders.
249
- * @returns reference
250
- */
267
+ * Cradova
268
+ * ---
269
+ Returns a mutable reference object of dom elements that persists across component renders.
270
+ * @returns reference
271
+ */
251
272
  export function useRef(): Record<string, HTMLElement | undefined>;
252
273
 
253
274
  /**
@@ -316,9 +337,9 @@ Returns a mutable reference object of dom elements that persists across componen
316
337
  | (() => HTMLElement)
317
338
  | Partial<DataAttributes>
318
339
  | Partial<AriaAttributes>
319
- | Partial<CSSStyleDeclaration>
340
+ | CSS.Properties
320
341
  | {
321
- style?: Partial<CSSStyleDeclaration>;
342
+ style?: CSS.Properties;
322
343
  onmount?: (this: T) => void;
323
344
  reference?: reference;
324
345
  }
@@ -336,9 +357,8 @@ Returns a mutable reference object of dom elements that persists across componen
336
357
  | (() => HTMLElement)
337
358
  | Partial<DataAttributes>
338
359
  | Partial<AriaAttributes>
339
- | Partial<CSSStyleDeclaration>
360
+ | CSS.Properties<string | number>
340
361
  | {
341
- style?: Partial<CSSStyleDeclaration>;
342
362
  src?: string;
343
363
  href?: string;
344
364
  placeholder?: string;
@@ -354,6 +374,7 @@ Returns a mutable reference object of dom elements that persists across componen
354
374
  rel?: string;
355
375
  required?: string;
356
376
  frameBorder?: string;
377
+ style?: CSS.Properties;
357
378
  onmount?: (this: T) => void;
358
379
  reference?: reference;
359
380
  }
@@ -412,6 +433,7 @@ Returns a mutable reference object of dom elements that persists across componen
412
433
  element: E & HTMLElement,
413
434
  ElementChildrenAndPropertyList: VJS_params_TYPE<E>
414
435
  ) => E;
436
+ export const make: (descriptor: any) => any[];
415
437
  export const a: VJSType<HTMLAnchorElement>;
416
438
  export const area: VJSType<HTMLAreaElement>;
417
439
  export const article: VJSType<HTMLElement>;
@@ -503,12 +525,12 @@ Returns a mutable reference object of dom elements that persists across componen
503
525
  */
504
526
  BrowserRoutes(obj: Record<string, any>): void;
505
527
  /**
506
- Go back in Navigation history
507
- */
528
+ Go back in Navigation history
529
+ */
508
530
  back(): void;
509
531
  /**
510
- Go forward in Navigation history
511
- */
532
+ Go forward in Navigation history
533
+ */
512
534
  forward(): void;
513
535
  /**
514
536
  * Cradova Router
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "Web framework for building web apps and PWAs",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -62,6 +62,7 @@
62
62
  "@types/jest": "^29.2.4",
63
63
  "@typescript-eslint/eslint-plugin": "^5.47.0",
64
64
  "@typescript-eslint/parser": "^5.47.0",
65
+ "csstype": "^3.1.2",
65
66
  "eslint": "^8.30.0",
66
67
  "eslint-config-prettier": "^8.5.0",
67
68
  "eslint-plugin-prettier": "^4.2.1",