@craftile/types 0.2.1 → 0.3.1
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/index.ts +26 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,9 +3,34 @@ export interface BlockProperties {
|
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
export type VisibilityOperator =
|
|
7
|
+
| 'equals'
|
|
8
|
+
| 'not_equals'
|
|
9
|
+
| 'in'
|
|
10
|
+
| 'not_in'
|
|
11
|
+
| 'contains'
|
|
12
|
+
| 'greater_than'
|
|
13
|
+
| 'less_than'
|
|
14
|
+
| 'truthy'
|
|
15
|
+
| 'falsy';
|
|
16
|
+
|
|
17
|
+
export interface VisibilityCondition {
|
|
18
|
+
field: string;
|
|
19
|
+
operator: VisibilityOperator;
|
|
20
|
+
value?: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface VisibilityLogicGroup {
|
|
24
|
+
and?: VisibilityRule[];
|
|
25
|
+
or?: VisibilityRule[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type VisibilityRule = VisibilityCondition | VisibilityLogicGroup;
|
|
29
|
+
|
|
6
30
|
export interface Block {
|
|
7
31
|
type: string;
|
|
8
32
|
id: string;
|
|
33
|
+
name?: string; // Custom display name for the block
|
|
9
34
|
semanticId?: string;
|
|
10
35
|
properties: BlockProperties;
|
|
11
36
|
disabled?: boolean;
|
|
@@ -20,6 +45,7 @@ export interface PropertyField {
|
|
|
20
45
|
label?: string;
|
|
21
46
|
default?: any;
|
|
22
47
|
group?: string; // Optional group name for organizing properties in UI
|
|
48
|
+
visibleIf?: VisibilityRule; // Conditional visibility based on other property values
|
|
23
49
|
[key: string]: any;
|
|
24
50
|
}
|
|
25
51
|
|