@nasl/types 0.1.0 → 0.1.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/nasl.ui.ast.d.ts CHANGED
@@ -153,29 +153,50 @@ export interface LogicDeclaration {
153
153
  title: string;
154
154
  description: string;
155
155
  typeParams?: Array<TypeParam>;
156
- params: Array<ParamDeclaration>;
156
+ params: Array<Param>;
157
157
  returns: Array<Return>;
158
158
  }
159
159
 
160
160
  /**
161
- * 输入参数声明
161
+ * 空字面量
162
162
  */
163
- export interface ParamDeclaration {
164
- concept: 'ParamDeclaration';
165
- name: string;
166
- title: string;
167
- description: string;
168
- tsType: string;
163
+ export interface NullLiteral {
164
+ concept: 'NullLiteral';
165
+
169
166
  }
170
167
 
171
168
  /**
172
- * 输出参数声明
169
+ * 布尔型字面量
173
170
  */
174
- export interface ReturnDeclaration {
175
- concept: 'ReturnDeclaration';
176
- name: string;
177
- description: string;
178
- tsType: string;
171
+ export interface BooleanLiteral {
172
+ concept: 'BooleanLiteral';
173
+ value: string;
174
+ }
175
+
176
+ /**
177
+ * 字符串字面量
178
+ */
179
+ export interface StringLiteral {
180
+ concept: 'StringLiteral';
181
+ value: string;
182
+ }
183
+
184
+ /**
185
+ * 数字字面量
186
+ */
187
+ export interface NumericLiteral {
188
+ concept: 'NumericLiteral';
189
+ value: string;
190
+ typeAnnotation: TypeAnnotation;
191
+ }
192
+
193
+ /**
194
+ * 列表构造器
195
+ */
196
+ export interface NewList {
197
+ concept: 'NewList';
198
+ typeAnnotation: TypeAnnotation;
199
+ items: Array<LogicItem>;
179
200
  }
180
201
 
181
202
  /**
@@ -230,14 +251,14 @@ export interface TypeParam {
230
251
  }
231
252
 
232
253
  /**
233
- * 输出参数
254
+ * 输入参数
234
255
  */
235
- export interface Return {
236
- concept: 'Return';
256
+ export interface Param {
257
+ concept: 'Param';
237
258
  name: string;
238
259
  description: string;
239
260
  typeAnnotation: TypeAnnotation;
240
- defaultValue: DefaultValue;
261
+ defaultValue?: DefaultValue;
241
262
  }
242
263
 
243
264
  /**
@@ -264,7 +285,6 @@ export interface StructureProperty {
264
285
  label: string;
265
286
  description: string;
266
287
  typeAnnotation: TypeAnnotation;
267
- required: boolean;
268
288
  defaultValue: DefaultValue;
269
289
  jsonName: string;
270
290
  }
@@ -279,15 +299,19 @@ export interface DefaultValue {
279
299
  }
280
300
 
281
301
  /**
282
- * 逻辑项
302
+ * 设置器基类
303
+ */
304
+ export type LogicItem = NullLiteral | BooleanLiteral | StringLiteral | NumericLiteral | NewList;
305
+
306
+ /**
307
+ * 输出参数
283
308
  */
284
- export interface LogicItem {
285
- concept: 'LogicItem';
286
- label?: string;
287
- description?: string;
288
- folded?: boolean;
289
- offsetX?: number;
290
- offsetY?: number;
309
+ export interface Return {
310
+ concept: 'Return';
311
+ name: string;
312
+ description: string;
313
+ typeAnnotation: TypeAnnotation;
314
+ defaultValue?: DefaultValue;
291
315
  }
292
316
 
293
317
  export type UILib = Array<ViewComponentDeclaration>;
@@ -527,7 +527,7 @@
527
527
  "params": {
528
528
  "type": "array",
529
529
  "items": {
530
- "$ref": "#/definitions/ParamDeclaration"
530
+ "$ref": "#/definitions/Param"
531
531
  }
532
532
  },
533
533
  "returns": {
@@ -566,42 +566,12 @@
566
566
  "additionalProperties": false,
567
567
  "description": "类型参数"
568
568
  },
569
- "ParamDeclaration": {
569
+ "Param": {
570
570
  "type": "object",
571
571
  "properties": {
572
572
  "concept": {
573
573
  "type": "string",
574
- "const": "ParamDeclaration"
575
- },
576
- "name": {
577
- "type": "string"
578
- },
579
- "title": {
580
- "type": "string"
581
- },
582
- "description": {
583
- "type": "string"
584
- },
585
- "tsType": {
586
- "type": "string"
587
- }
588
- },
589
- "required": [
590
- "concept",
591
- "name",
592
- "title",
593
- "description",
594
- "tsType"
595
- ],
596
- "additionalProperties": false,
597
- "description": "输入参数声明"
598
- },
599
- "Return": {
600
- "type": "object",
601
- "properties": {
602
- "concept": {
603
- "type": "string",
604
- "const": "Return"
574
+ "const": "Param"
605
575
  },
606
576
  "name": {
607
577
  "type": "string"
@@ -620,11 +590,10 @@
620
590
  "concept",
621
591
  "name",
622
592
  "description",
623
- "typeAnnotation",
624
- "defaultValue"
593
+ "typeAnnotation"
625
594
  ],
626
595
  "additionalProperties": false,
627
- "description": "输出参数"
596
+ "description": "输入参数"
628
597
  },
629
598
  "TypeAnnotation": {
630
599
  "type": "object",
@@ -715,9 +684,6 @@
715
684
  "typeAnnotation": {
716
685
  "$ref": "#/definitions/TypeAnnotation"
717
686
  },
718
- "required": {
719
- "type": "boolean"
720
- },
721
687
  "defaultValue": {
722
688
  "$ref": "#/definitions/DefaultValue"
723
689
  },
@@ -731,7 +697,6 @@
731
697
  "label",
732
698
  "description",
733
699
  "typeAnnotation",
734
- "required",
735
700
  "defaultValue",
736
701
  "jsonName"
737
702
  ],
@@ -764,33 +729,150 @@
764
729
  "description": "默认值"
765
730
  },
766
731
  "LogicItem": {
732
+ "anyOf": [
733
+ {
734
+ "$ref": "#/definitions/NullLiteral"
735
+ },
736
+ {
737
+ "$ref": "#/definitions/BooleanLiteral"
738
+ },
739
+ {
740
+ "$ref": "#/definitions/StringLiteral"
741
+ },
742
+ {
743
+ "$ref": "#/definitions/NumericLiteral"
744
+ },
745
+ {
746
+ "$ref": "#/definitions/NewList"
747
+ }
748
+ ],
749
+ "description": "设置器基类"
750
+ },
751
+ "NullLiteral": {
767
752
  "type": "object",
768
753
  "properties": {
769
754
  "concept": {
770
755
  "type": "string",
771
- "const": "LogicItem"
756
+ "const": "NullLiteral"
757
+ }
758
+ },
759
+ "required": [
760
+ "concept"
761
+ ],
762
+ "additionalProperties": false,
763
+ "description": "空字面量"
764
+ },
765
+ "BooleanLiteral": {
766
+ "type": "object",
767
+ "properties": {
768
+ "concept": {
769
+ "type": "string",
770
+ "const": "BooleanLiteral"
772
771
  },
773
- "label": {
772
+ "value": {
774
773
  "type": "string"
774
+ }
775
+ },
776
+ "required": [
777
+ "concept",
778
+ "value"
779
+ ],
780
+ "additionalProperties": false,
781
+ "description": "布尔型字面量"
782
+ },
783
+ "StringLiteral": {
784
+ "type": "object",
785
+ "properties": {
786
+ "concept": {
787
+ "type": "string",
788
+ "const": "StringLiteral"
775
789
  },
776
- "description": {
790
+ "value": {
777
791
  "type": "string"
792
+ }
793
+ },
794
+ "required": [
795
+ "concept",
796
+ "value"
797
+ ],
798
+ "additionalProperties": false,
799
+ "description": "字符串字面量"
800
+ },
801
+ "NumericLiteral": {
802
+ "type": "object",
803
+ "properties": {
804
+ "concept": {
805
+ "type": "string",
806
+ "const": "NumericLiteral"
778
807
  },
779
- "folded": {
780
- "type": "boolean"
808
+ "value": {
809
+ "type": "string"
781
810
  },
782
- "offsetX": {
783
- "type": "number"
811
+ "typeAnnotation": {
812
+ "$ref": "#/definitions/TypeAnnotation"
813
+ }
814
+ },
815
+ "required": [
816
+ "concept",
817
+ "value",
818
+ "typeAnnotation"
819
+ ],
820
+ "additionalProperties": false,
821
+ "description": "数字字面量"
822
+ },
823
+ "NewList": {
824
+ "type": "object",
825
+ "properties": {
826
+ "concept": {
827
+ "type": "string",
828
+ "const": "NewList"
784
829
  },
785
- "offsetY": {
786
- "type": "number"
830
+ "typeAnnotation": {
831
+ "$ref": "#/definitions/TypeAnnotation"
832
+ },
833
+ "items": {
834
+ "type": "array",
835
+ "items": {
836
+ "$ref": "#/definitions/LogicItem"
837
+ }
787
838
  }
788
839
  },
789
840
  "required": [
790
- "concept"
841
+ "concept",
842
+ "typeAnnotation",
843
+ "items"
791
844
  ],
792
845
  "additionalProperties": false,
793
- "description": "逻辑项"
846
+ "description": "列表构造器"
847
+ },
848
+ "Return": {
849
+ "type": "object",
850
+ "properties": {
851
+ "concept": {
852
+ "type": "string",
853
+ "const": "Return"
854
+ },
855
+ "name": {
856
+ "type": "string"
857
+ },
858
+ "description": {
859
+ "type": "string"
860
+ },
861
+ "typeAnnotation": {
862
+ "$ref": "#/definitions/TypeAnnotation"
863
+ },
864
+ "defaultValue": {
865
+ "$ref": "#/definitions/DefaultValue"
866
+ }
867
+ },
868
+ "required": [
869
+ "concept",
870
+ "name",
871
+ "description",
872
+ "typeAnnotation"
873
+ ],
874
+ "additionalProperties": false,
875
+ "description": "输出参数"
794
876
  },
795
877
  "ThemeVariable": {
796
878
  "type": "object",
@@ -4,7 +4,7 @@ declare namespace nasl.ui {
4
4
  /**
5
5
  * 设置器基类
6
6
  */
7
- export type BaseSetter = InputSetter | SwitchSetter | EnumSelectSetter | CapsulesSetter | NumberInputSetter | IconSetter | ImageSetter | PropertySelectSetter;
7
+ export type BaseSetter<T, K> = InputSetter | SwitchSetter | EnumSelectSetter<T, K> | CapsulesSetter<T, K> | NumberInputSetter | IconSetter | ImageSetter | PropertySelectSetter;
8
8
 
9
9
  /**
10
10
  * 输入框设置器
@@ -25,17 +25,17 @@ declare namespace nasl.ui {
25
25
  /**
26
26
  * 枚举选择设置器
27
27
  */
28
- export interface EnumSelectSetter {
28
+ export interface EnumSelectSetter<T, K> {
29
29
  concept: 'EnumSelectSetter';
30
- options: Array<SetterOption>;
30
+ options: Array<SetterOption<T, K>>;
31
31
  }
32
32
 
33
33
  /**
34
34
  * 胶囊设置器
35
35
  */
36
- export interface CapsulesSetter {
36
+ export interface CapsulesSetter<T, K> {
37
37
  concept: 'CapsulesSetter';
38
- options: Array<SetterOption>;
38
+ options: Array<SetterOption<T, K>>;
39
39
  }
40
40
 
41
41
  /**
@@ -89,7 +89,7 @@ declare namespace nasl.ui {
89
89
  /**
90
90
  * 组件属性
91
91
  */
92
- export interface PropOptions<T extends ViewComponent, K extends keyof T> {
92
+ export interface PropOptions<T extends object, K extends keyof T> {
93
93
  title: string;
94
94
  group?: '基础信息' | '数据属性' | '主要属性' | '交互属性' | '状态属性' | '样式属性' | '工具属性';
95
95
  icon?: string;
@@ -100,7 +100,7 @@ declare namespace nasl.ui {
100
100
  bindHide?: boolean;
101
101
  bindOpen?: boolean;
102
102
  tabKind?: 'property' | 'style';
103
- setter?: BaseSetter;
103
+ setter?: BaseSetter<T, K>;
104
104
  designerValue?: any;
105
105
  if?: (target: T) => boolean;
106
106
  disabledIf?: (target: T) => boolean;
@@ -133,21 +133,6 @@ declare namespace nasl.ui {
133
133
  description: string;
134
134
  }
135
135
 
136
- /**
137
- * 输入参数声明
138
- */
139
- export interface ParamOptions {
140
- title: string;
141
- description: string;
142
- }
143
-
144
- /**
145
- * 输出参数声明
146
- */
147
- export interface ReturnOptions {
148
- description: string;
149
- }
150
-
151
136
  /**
152
137
  * 设置器枚举选项
153
138
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nasl/types",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "NASL types for TypeScript Declaration",
5
5
  "main": "index.d.ts",
6
6
  "scripts": {},