cradova 3.5.0 → 3.5.2

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.
@@ -6,78 +6,47 @@ import { Comp } from "./classes.js";
6
6
  * make reference to dom elements
7
7
  */
8
8
  declare class __raw_ref {
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;
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>(name: string): ElementType | undefined;
20
+ /**
21
+ * Swap referenced DOM element.
22
+ */
23
+ swap(name1: string, name2: string): void;
24
+ /**
25
+ * Append a DOM element to the reference, overwriting any existing reference.
26
+ * @param name - The name to reference the DOM element by.
27
+ * @param element - The DOM element to reference.
28
+ */
29
+ _append(name: string, Element: HTMLElement): void;
32
30
  }
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;
31
+ export declare const makeElement: <E extends HTMLElement>(element: E & HTMLElement, ElementChildrenAndPropertyList: VJS_params_TYPE<E>) => E;
32
+ export declare const cra: <E extends HTMLElement>(tag: string) => (...Children_and_Properties: VJS_params_TYPE<E>) => E;
33
+ export declare function Rhoda(l: VJS_params_TYPE<HTMLElement>): DocumentFragment;
43
34
  /**
44
35
  * @param {expression} condition
45
36
  * @param {function} elements[]
46
37
  */
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;
38
+ export declare function $if<E extends HTMLElement>(condition: any, ...elements: VJS_params_TYPE<E>): any;
39
+ export declare function $ifelse(condition: any, ifTrue: any, ifFalse?: any): any;
40
+ export declare function $case<E extends HTMLElement = HTMLElement>(value: any, ...elements: VJS_params_TYPE<E>): (key: any) => VJS_params_TYPE<E> | undefined;
41
+ export declare function $switch(key: unknown, ...cases: ((key: any) => any)[]): any;
64
42
  type LoopData<Type> = 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;
43
+ export declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
73
44
  /**
74
45
  * Document fragment
75
46
  * @param children
76
47
  * @returns
77
48
  */
78
- export declare const frag: (
79
- children: VJS_params_TYPE<HTMLElement>,
80
- ) => DocumentFragment;
49
+ export declare const frag: (children: VJS_params_TYPE<HTMLElement>) => DocumentFragment;
81
50
  /**
82
51
  * Cradova
83
52
  * ---
@@ -86,10 +55,7 @@ export declare const frag: (
86
55
  * @param Comp
87
56
  * @returns [state, setState]
88
57
  */
89
- export declare function useState<S = unknown>(
90
- newState: S,
91
- Comp: Comp<any>,
92
- ): [S, (newState: S | ((preS: S) => S)) => void];
58
+ export declare function useState<S = unknown>(newState: S, Comp: Comp<any>): [S, (newState: S | ((preS: S) => S)) => void];
93
59
  /**
94
60
  * Cradova
95
61
  * ---
@@ -1,112 +1,81 @@
1
1
  import * as CSS from "csstype";
2
2
  import { Comp, Page } from "./classes.js";
3
3
  type DataAttributes = {
4
- [key: `data-${string}`]: string;
4
+ [key: `data-${string}`]: string;
5
5
  };
6
6
  type AriaAttributes = {
7
- [key: `aria-${string}`]: string;
7
+ [key: `aria-${string}`]: string;
8
8
  };
9
9
  type Attributes = {
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;
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
+ ref?: [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> = (
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
- )[];
33
+ export type VJS_params_TYPE<E extends HTMLElement> = (Comp | Comp[] | string | undefined | HTMLElement | HTMLElement[] | DocumentFragment | DocumentFragment[] | Attributes | Partial<Attributes> | (() => HTMLElement) | Partial<E> | Record<string, (this: E) => void> | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties<string | number>)[];
51
34
  export interface RouterRouteObject {
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;
35
+ _html: ((this: Page, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
36
+ _delegatedRoutes: number | boolean;
37
+ _Activate: (force: boolean) => Promise<void>;
38
+ _deActivate: (params: object) => void;
39
+ _package: (params: unknown) => void;
40
+ _errorHandler: ((err: unknown) => void) | null;
41
+ _derive(): {
42
+ _name: string;
43
+ _callBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
44
+ _deCallBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
45
+ };
46
+ _apply_derivation(data: {
47
+ _name: string;
48
+ _callBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
49
+ _deCallBack: ((cradovaPageSet: HTMLElement) => void | Promise<void>) | undefined;
50
+ }): unknown;
79
51
  }
80
52
  export type CradovaPageType = {
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;
53
+ /**
54
+ * Cradova page
55
+ * ---
56
+ * title of the page
57
+ * .
58
+ */
59
+ name?: string;
60
+ /**
61
+ * Cradova page
62
+ * ---
63
+ * The component for the page
64
+ * @param data
65
+ * @returns void
66
+ * .
67
+ */
68
+ template: (this: Page) => HTMLElement;
69
+ /**
70
+ * Cradova page
71
+ * ---
72
+ * a snapshot is the initial render of a page.
73
+ * snapshot isolation allows for good SEO guarantee with the flexibility of client based rendering
74
+ * the origin server should accept post requesting to save a snapshot of this page for future use.
75
+ * the origin server should respond with the snapshot for future request to the page url
76
+ * the origin server should implement suitable mechanisms to invalidate it's caches
77
+ */
78
+ snapshotIsolation?: boolean;
107
79
  };
108
- export type browserPageType<importType = Page> =
109
- | importType
110
- | Promise<importType>
111
- | (() => Promise<importType>);
80
+ export type browserPageType<importType = Page> = importType | Promise<importType> | (() => Promise<importType>);
112
81
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Build Powerful ⚡ Web Apps with Ease",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -11,21 +11,18 @@
11
11
  ],
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/FridayCandour/cradova.git"
14
+ "url": "git+https://github.com/Uieddbook/cradova.git"
15
15
  },
16
16
  "scripts": {
17
17
  "compile": "bun bundle.ts",
18
- "pub:patch": " git add . && git commit -m 'new version' && bun bundle.ts && npm version patch && npm publish && git push && git push --tags",
19
18
  "lint": "eslint . --fix"
20
19
  },
21
20
  "keywords": [
22
21
  "PWA",
23
22
  "webapp",
24
- "parallel rendering",
25
- "conditionals",
26
- "prerendering",
23
+ "SPA",
27
24
  "Comps",
28
- "createSignal",
25
+ "Signal",
29
26
  "VJS",
30
27
  "vjs specification",
31
28
  "cradova"
@@ -48,25 +45,13 @@
48
45
  {
49
46
  "name": "friday candour",
50
47
  "url": "https://www.t.me/procal"
51
- },
52
- {
53
- "name": "Thomas",
54
- "url": "https://github.com/trgwii"
55
48
  }
56
49
  ],
57
50
  "license": "Apache-2.0",
58
51
  "bugs": {
59
- "url": "https://github.com/FridayCandour/cradova/issues"
60
- },
61
- "homepage": "https://github.com/FridayCandour/cradova",
62
- "devDependencies": {
63
- "@typescript-eslint/eslint-plugin": "^5.47.0",
64
- "@typescript-eslint/parser": "^5.47.0",
65
- "eslint": "^8.30.0",
66
- "eslint-config-prettier": "^8.5.0",
67
- "eslint-plugin-prettier": "^4.2.1",
68
- "prettier": "^2.8.1"
52
+ "url": "https://github.com/Uiedbook/cradova/issues"
69
53
  },
54
+ "homepage": "https://github.com/Uiedbook/cradova",
70
55
  "dependencies": {
71
56
  "csstype": "^3.1.2"
72
57
  }