@open-xamu-co/ui-common-types 4.0.0-next.4 → 4.0.0-next.6
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/package.json +1 -1
- package/src/fetch.ts +2 -1
- package/src/files.ts +16 -0
- package/src/values.ts +14 -7
package/package.json
CHANGED
package/src/fetch.ts
CHANGED
package/src/files.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import type { eMimeType } from "@open-xamu-co/ui-common-enums";
|
|
2
2
|
|
|
3
3
|
export interface iMime {
|
|
4
|
+
/**
|
|
5
|
+
* Mime type
|
|
6
|
+
* @example image/jpeg
|
|
7
|
+
*/
|
|
4
8
|
mime: string;
|
|
9
|
+
/**
|
|
10
|
+
* Pattern to match
|
|
11
|
+
* @example [0xff, 0xd8, 0xff]
|
|
12
|
+
*/
|
|
5
13
|
pattern: number[];
|
|
14
|
+
/**
|
|
15
|
+
* Mask to match
|
|
16
|
+
* @example [0xff, 0xff, 0xff]
|
|
17
|
+
*/
|
|
6
18
|
mask: number[];
|
|
19
|
+
/**
|
|
20
|
+
* Mime type range
|
|
21
|
+
* @example eMimeType.IMAGE
|
|
22
|
+
*/
|
|
7
23
|
type: eMimeType;
|
|
8
24
|
}
|
package/src/values.ts
CHANGED
|
@@ -11,11 +11,10 @@ export interface iSelectOption {
|
|
|
11
11
|
*
|
|
12
12
|
* Action result, event and callback
|
|
13
13
|
*/
|
|
14
|
-
export type iNodeFnResponse<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
];
|
|
14
|
+
export type iNodeFnResponse<
|
|
15
|
+
T extends Record<string, any> = never,
|
|
16
|
+
E extends Record<string, any> = Record<string, any>,
|
|
17
|
+
> = [(boolean | T)?, (Event & Partial<CustomEvent<E>>)?, (() => void)?];
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Stream like response from node functions
|
|
@@ -23,9 +22,12 @@ export type iNodeFnResponse<T extends Record<string, any> = never> = [
|
|
|
23
22
|
* Action result, event and callback
|
|
24
23
|
* Can accept an stream like array for multiple updates (hydration)
|
|
25
24
|
*/
|
|
26
|
-
export type iNodeFnResponseStream<
|
|
25
|
+
export type iNodeFnResponseStream<
|
|
26
|
+
T extends Record<string, any> = never,
|
|
27
|
+
E extends Record<string, any> = Record<string, any>,
|
|
28
|
+
> = [
|
|
27
29
|
(boolean | T | [boolean | T, ...Promise<boolean | T>[]])?,
|
|
28
|
-
Event?,
|
|
30
|
+
(Event & Partial<CustomEvent<E>>)?,
|
|
29
31
|
(() => void)?,
|
|
30
32
|
];
|
|
31
33
|
|
|
@@ -70,6 +72,11 @@ export interface iProperty<
|
|
|
70
72
|
P extends Record<string, any> = Record<string, any>,
|
|
71
73
|
ComponentType = unknown,
|
|
72
74
|
> extends iSelectOption {
|
|
75
|
+
/**
|
|
76
|
+
* Prefer to use the node's id instead of the value
|
|
77
|
+
* Useful for object like properties
|
|
78
|
+
*/
|
|
79
|
+
preferId?: boolean;
|
|
73
80
|
/**
|
|
74
81
|
* Function to create a node within the relation
|
|
75
82
|
* The parent is given since the node doesn't exist yet
|