@nasl/types 0.1.6 → 0.1.7-beta.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.
@@ -11,6 +11,9 @@ declare namespace nasl.ui {
11
11
  */
12
12
  export interface InputSetter {
13
13
  concept: 'InputSetter';
14
+ /**
15
+ * 占位文本
16
+ */
14
17
  placeholder?: string;
15
18
  }
16
19
 
@@ -27,6 +30,9 @@ declare namespace nasl.ui {
27
30
  */
28
31
  export interface EnumSelectSetter<T extends object, K extends keyof T> {
29
32
  concept: 'EnumSelectSetter';
33
+ /**
34
+ * 枚举选项列表
35
+ */
30
36
  options: Array<SetterOption<T, K>>;
31
37
  }
32
38
 
@@ -35,6 +41,9 @@ declare namespace nasl.ui {
35
41
  */
36
42
  export interface CapsulesSetter<T extends object, K extends keyof T> {
37
43
  concept: 'CapsulesSetter';
44
+ /**
45
+ * 枚举选项列表
46
+ */
38
47
  options: Array<SetterOption<T, K>>;
39
48
  }
40
49
 
@@ -43,10 +52,25 @@ declare namespace nasl.ui {
43
52
  */
44
53
  export interface NumberInputSetter {
45
54
  concept: 'NumberInputSetter';
55
+ /**
56
+ * 按钮位置
57
+ */
46
58
  placement?: string;
59
+ /**
60
+ * 最小值
61
+ */
47
62
  min?: number;
63
+ /**
64
+ * 最大值
65
+ */
48
66
  max?: number;
67
+ /**
68
+ * 精度
69
+ */
49
70
  precision?: number;
71
+ /**
72
+ * 占位文本
73
+ */
50
74
  placeholder?: string;
51
75
  }
52
76
 
@@ -55,6 +79,9 @@ declare namespace nasl.ui {
55
79
  */
56
80
  export interface IconSetter {
57
81
  concept: 'IconSetter';
82
+ /**
83
+ * 图标标题
84
+ */
58
85
  title?: string;
59
86
  }
60
87
 
@@ -78,40 +105,137 @@ declare namespace nasl.ui {
78
105
  * 页面组件
79
106
  */
80
107
  export interface ViewComponentOpts {
108
+ /**
109
+ * 页面组件中划线名称
110
+ */
81
111
  kebabName?: string;
112
+ /**
113
+ * 页面组件标题
114
+ */
82
115
  title: string;
116
+ /**
117
+ * 所在分组
118
+ */
83
119
  group?: string;
120
+ /**
121
+ * 页面组件图标
122
+ */
84
123
  icon?: string;
124
+ /**
125
+ * 页面组件描述
126
+ */
85
127
  description?: string;
128
+ /**
129
+ * 关于 TS 的 typeParams
130
+ */
86
131
  typeParams?: string;
132
+ /**
133
+ * 国际化配置列表
134
+ */
135
+ i18nMap?: Map<string, Map<string, string>>;
87
136
  }
88
137
 
89
138
  /**
90
139
  * 组件属性
91
140
  */
92
- export interface PropOpts<T extends object, K extends keyof T> {
141
+ export type PropOpts<T extends object, K extends keyof T> = {
142
+ /**
143
+ * 组件属性标题
144
+ */
93
145
  title: string;
146
+ /**
147
+ * 组件属性分组
148
+ */
94
149
  group?: '基础信息' | '数据属性' | '主要属性' | '交互属性' | '状态属性' | '样式属性' | '工具属性';
150
+ /**
151
+ * 组件属性图标
152
+ */
95
153
  icon?: string;
154
+ /**
155
+ * 组件属性描述
156
+ */
96
157
  description?: string;
97
- sync?: boolean;
158
+ /**
159
+ * 工具提示链接
160
+ */
98
161
  tooltipLink?: string;
162
+ /**
163
+ * 文档描述
164
+ */
99
165
  docDescription?: string;
166
+ /**
167
+ * 隐藏绑定属性按钮
168
+ */
100
169
  bindHide?: boolean;
170
+ /**
171
+ * 绑定属性并打开弹窗
172
+ */
101
173
  bindOpen?: boolean;
174
+ /**
175
+ * 所在的 tab 页
176
+ */
102
177
  tabKind?: 'property' | 'style';
178
+ /**
179
+ * 属性设置器
180
+ */
103
181
  setter?: BaseSetter<T, K>;
182
+ /**
183
+ * 属性在面板中的布局方式
184
+ *
185
+ * block 表示标题与设置器分行展示;inline 表示同一行展示
186
+ */
187
+ layout?: 'block' | 'inline';
188
+ /**
189
+ * 渲染时的设计值
190
+ */
104
191
  designerValue?: any;
192
+ /**
193
+ * 是否显隐
194
+ *
195
+ * 用 TS 写表达式,在 IDE 中直接 eval
196
+ */
105
197
  if?: (target: T) => boolean;
198
+ /**
199
+ * 是否禁用
200
+ *
201
+ * 用 TS 写表达式,在 IDE 中直接 eval
202
+ */
106
203
  disabledIf?: (target: T) => boolean;
204
+ /**
205
+ * 在属性切换时发生的事件
206
+ *
207
+ * 用 TS 写表达式,在 IDE 中直接 eval
208
+ */
107
209
  onChange?: Array<{ update: any; if?: (value: T[K]) => boolean } | { clear: Array<string>; if?: (value: T[K]) => boolean }>;
108
- }
210
+ } & ({
211
+ /**
212
+ * 是否支持双向绑定
213
+ */
214
+ sync?: true;
215
+ } | {
216
+ /**
217
+ * 是否支持双向绑定
218
+ */
219
+ sync?: false;
220
+ /**
221
+ * 是否将任意类型隐式转换成String
222
+ *
223
+ * 仅在属性类型为 string(不包括字符串枚举)的情况下,且 sync 为 falsy 时可配置
224
+ */
225
+ implicitToString?: T[K] extends string ? (string extends T[K] ? boolean : never) : never;
226
+ })
109
227
 
110
228
  /**
111
229
  * 组件事件
112
230
  */
113
231
  export interface EventOpts {
232
+ /**
233
+ * 组件事件标题
234
+ */
114
235
  title: string;
236
+ /**
237
+ * 组件事件描述
238
+ */
115
239
  description?: string;
116
240
  }
117
241
 
@@ -119,9 +243,21 @@ declare namespace nasl.ui {
119
243
  * 插槽
120
244
  */
121
245
  export interface SlotOpts {
246
+ /**
247
+ * 插槽标题
248
+ */
122
249
  title: string;
250
+ /**
251
+ * 插槽描述
252
+ */
123
253
  description?: string;
254
+ /**
255
+ * 空的占位图
256
+ */
124
257
  emptyBackground?: string;
258
+ /**
259
+ * 插槽代码块
260
+ */
125
261
  snippets?: Array<ViewBlockWithImage>;
126
262
  }
127
263
 
@@ -129,7 +265,13 @@ declare namespace nasl.ui {
129
265
  * 逻辑声明
130
266
  */
131
267
  export interface LogicOpts {
268
+ /**
269
+ * 逻辑标题
270
+ */
132
271
  title: string;
272
+ /**
273
+ * 逻辑描述
274
+ */
133
275
  description: string;
134
276
  }
135
277
 
@@ -137,8 +279,21 @@ declare namespace nasl.ui {
137
279
  * 带分组的参数
138
280
  */
139
281
  export interface ParamOpts {
282
+ /**
283
+ * 输入参数描述
284
+ */
140
285
  description?: string;
286
+ /**
287
+ * 是否为展开参数
288
+ */
289
+ spread?: boolean;
290
+ /**
291
+ * 标题
292
+ */
141
293
  title: string;
294
+ /**
295
+ * 分组
296
+ */
142
297
  group?: string;
143
298
  }
144
299
 
@@ -146,10 +301,29 @@ declare namespace nasl.ui {
146
301
  * 设置器枚举选项
147
302
  */
148
303
  export interface SetterOption<T extends object = never, K extends keyof T = never> {
304
+ /**
305
+ * 选项标题
306
+ */
149
307
  title: string;
308
+ /**
309
+ * 选项图标
310
+ */
150
311
  icon?: string;
312
+ /**
313
+ * 选项工具提示
314
+ */
151
315
  tooltip?: string;
316
+ /**
317
+ * 是否显隐
318
+ *
319
+ * 用 TS 写表达式,在 IDE 中直接 eval
320
+ */
152
321
  if?: (target: T) => boolean;
322
+ /**
323
+ * 是否禁用
324
+ *
325
+ * 用 TS 写表达式,在 IDE 中直接 eval
326
+ */
153
327
  disabledIf?: (target: T) => boolean;
154
328
  }
155
329
 
@@ -157,10 +331,25 @@ declare namespace nasl.ui {
157
331
  * 带截图的代码块
158
332
  */
159
333
  export interface ViewBlockWithImage {
334
+ /**
335
+ * 标题
336
+ */
160
337
  title: string;
338
+ /**
339
+ * 代码
340
+ */
161
341
  code: string;
342
+ /**
343
+ * 描述
344
+ */
162
345
  description?: string;
346
+ /**
347
+ * 截图
348
+ */
163
349
  screenshot?: string;
350
+ /**
351
+ * 手绘
352
+ */
164
353
  drawing?: string;
165
354
  }
166
355
 
@@ -168,8 +357,17 @@ declare namespace nasl.ui {
168
357
  * 页面组件的代码块
169
358
  */
170
359
  export interface ViewBlock {
360
+ /**
361
+ * 标题
362
+ */
171
363
  title: string;
364
+ /**
365
+ * 代码
366
+ */
172
367
  code: string;
368
+ /**
369
+ * 描述
370
+ */
173
371
  description?: string;
174
372
  }
175
373
  }
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@nasl/types",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-beta.1",
4
4
  "description": "NASL types for TypeScript Declaration",
5
5
  "main": "index.d.ts",
6
6
  "scripts": {
7
- "build": "node ../../out/bin/genUIOptionsForTS.js && node ../../out/bin/genUIAstForTS.js"
7
+ "build": "node ../../out/bin/genUIOptionsForTS.js && node ../../out/bin/genUIAstForTS.js",
8
+ "release:alpha": "npm run build && npm publish --tag alpha --access public --no-git-checks",
9
+ "release:beta": "npm run build && npm publish --tag beta --access public --no-git-checks",
10
+ "release": "npm run build && npm publish --tag latest --access public"
8
11
  },
9
12
  "author": "Forrest <rainforest92@126.com>",
10
13
  "license": "MIT",