@lcap/nasl 2.22.0-beta.5 → 3.0.0-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.
Files changed (304) hide show
  1. package/README.md +13 -0
  2. package/docs/classes/Module.html +15 -15
  3. package/docs/classes/Namespace.html +15 -15
  4. package/docs/classes/ViewComponent.html +19 -19
  5. package/out/automate/engine/utils.js +4 -0
  6. package/out/automate/engine/utils.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  8. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  9. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  10. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  11. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  12. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  13. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  14. package/out/breakpoint/generator/BreakpointNode.js +166 -0
  15. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  16. package/out/breakpoint/generator/index.d.ts +4 -0
  17. package/out/breakpoint/generator/index.js +98 -0
  18. package/out/breakpoint/generator/index.js.map +1 -0
  19. package/out/breakpoint/index.d.ts +3 -0
  20. package/out/breakpoint/index.js +20 -0
  21. package/out/breakpoint/index.js.map +1 -0
  22. package/out/breakpoint/shared/constants.d.ts +30 -0
  23. package/out/breakpoint/shared/constants.js +87 -0
  24. package/out/breakpoint/shared/constants.js.map +1 -0
  25. package/out/breakpoint/shared/index.d.ts +3 -0
  26. package/out/breakpoint/shared/index.js +33 -0
  27. package/out/breakpoint/shared/index.js.map +1 -0
  28. package/out/breakpoint/shared/operations.d.ts +10 -0
  29. package/out/breakpoint/shared/operations.js +25 -0
  30. package/out/breakpoint/shared/operations.js.map +1 -0
  31. package/out/breakpoint/shared/socket.d.ts +47 -0
  32. package/out/breakpoint/shared/socket.js +210 -0
  33. package/out/breakpoint/shared/socket.js.map +1 -0
  34. package/out/breakpoint/shared/utils.d.ts +20 -0
  35. package/out/breakpoint/shared/utils.js +133 -0
  36. package/out/breakpoint/shared/utils.js.map +1 -0
  37. package/out/breakpoint/store/core.d.ts +30 -0
  38. package/out/breakpoint/store/core.js +341 -0
  39. package/out/breakpoint/store/core.js.map +1 -0
  40. package/out/breakpoint/store/dock.d.ts +1 -0
  41. package/out/breakpoint/store/dock.js +127 -0
  42. package/out/breakpoint/store/dock.js.map +1 -0
  43. package/out/breakpoint/store/index.d.ts +2 -0
  44. package/out/breakpoint/store/index.js +19 -0
  45. package/out/breakpoint/store/index.js.map +1 -0
  46. package/out/common/BaseNode.d.ts +8 -0
  47. package/out/common/BaseNode.js +19 -0
  48. package/out/common/BaseNode.js.map +1 -1
  49. package/out/concepts/App__.d.ts +365 -16
  50. package/out/concepts/App__.js +431 -10
  51. package/out/concepts/App__.js.map +1 -1
  52. package/out/concepts/Assignment__.js +1 -1
  53. package/out/concepts/Assignment__.js.map +1 -1
  54. package/out/concepts/AuthInterface__.d.ts +37 -0
  55. package/out/concepts/AuthInterface__.js +141 -0
  56. package/out/concepts/AuthInterface__.js.map +1 -0
  57. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  58. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  59. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  60. package/out/concepts/AuthLogic__.d.ts +66 -0
  61. package/out/concepts/AuthLogic__.js +206 -0
  62. package/out/concepts/AuthLogic__.js.map +1 -0
  63. package/out/concepts/BackendVariable__.d.ts +137 -0
  64. package/out/concepts/BackendVariable__.js +422 -0
  65. package/out/concepts/BackendVariable__.js.map +1 -0
  66. package/out/concepts/Backend__.d.ts +134 -0
  67. package/out/concepts/Backend__.js +274 -0
  68. package/out/concepts/Backend__.js.map +1 -0
  69. package/out/concepts/BindAttribute__.d.ts +1 -1
  70. package/out/concepts/BindAttribute__.js +3 -1
  71. package/out/concepts/BindAttribute__.js.map +1 -1
  72. package/out/concepts/BindEvent__.d.ts +12 -0
  73. package/out/concepts/BindEvent__.js +68 -0
  74. package/out/concepts/BindEvent__.js.map +1 -1
  75. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  76. package/out/concepts/CallAuthInterface__.js +408 -0
  77. package/out/concepts/CallAuthInterface__.js.map +1 -0
  78. package/out/concepts/CallInterface__.d.ts +6 -1
  79. package/out/concepts/CallInterface__.js +9 -1
  80. package/out/concepts/CallInterface__.js.map +1 -1
  81. package/out/concepts/CallLogic__.js +3 -1
  82. package/out/concepts/CallLogic__.js.map +1 -1
  83. package/out/concepts/CallQueryComponent__.js +9 -7
  84. package/out/concepts/CallQueryComponent__.js.map +1 -1
  85. package/out/concepts/Destination__.js +1 -1
  86. package/out/concepts/Destination__.js.map +1 -1
  87. package/out/concepts/End__.js +29 -2
  88. package/out/concepts/End__.js.map +1 -1
  89. package/out/concepts/EntityProperty__.js.map +1 -1
  90. package/out/concepts/Entity__.d.ts +1 -2
  91. package/out/concepts/Entity__.js +1 -31
  92. package/out/concepts/Entity__.js.map +1 -1
  93. package/out/concepts/ForEachStatement__.js +9 -4
  94. package/out/concepts/ForEachStatement__.js.map +1 -1
  95. package/out/concepts/FrontendLibrary__.d.ts +29 -29
  96. package/out/concepts/FrontendLibrary__.js +2 -2
  97. package/out/concepts/FrontendVariable__.d.ts +21 -0
  98. package/out/concepts/FrontendVariable__.js +64 -0
  99. package/out/concepts/FrontendVariable__.js.map +1 -0
  100. package/out/concepts/Frontend__.d.ts +151 -47
  101. package/out/concepts/Frontend__.js +188 -32
  102. package/out/concepts/Frontend__.js.map +1 -1
  103. package/out/concepts/Function__.js +1 -1
  104. package/out/concepts/Function__.js.map +1 -1
  105. package/out/concepts/Identifier__.js +1 -1
  106. package/out/concepts/Identifier__.js.map +1 -1
  107. package/out/concepts/Interface__.d.ts +1 -1
  108. package/out/concepts/Interface__.js.map +1 -1
  109. package/out/concepts/LogicItem__.d.ts +18 -3
  110. package/out/concepts/LogicItem__.js +22 -4
  111. package/out/concepts/LogicItem__.js.map +1 -1
  112. package/out/concepts/Logic__.d.ts +14 -9
  113. package/out/concepts/Logic__.js +43 -5
  114. package/out/concepts/Logic__.js.map +1 -1
  115. package/out/concepts/Module__.js.map +1 -1
  116. package/out/concepts/Namespace__.d.ts +29 -29
  117. package/out/concepts/Namespace__.js +2 -2
  118. package/out/concepts/NewComposite__.js +2 -2
  119. package/out/concepts/NewComposite__.js.map +1 -1
  120. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  121. package/out/concepts/OverriddenLogic__.js +1602 -0
  122. package/out/concepts/OverriddenLogic__.js.map +1 -0
  123. package/out/concepts/Param__.d.ts +6 -0
  124. package/out/concepts/Param__.js +10 -0
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/QueryFieldExpression__.d.ts +2 -0
  127. package/out/concepts/QueryFieldExpression__.js +9 -0
  128. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  129. package/out/concepts/QuerySelectExpression__.d.ts +2 -2
  130. package/out/concepts/QuerySelectExpression__.js +2 -2
  131. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  132. package/out/concepts/TypeAnnotation__.js +6 -6
  133. package/out/concepts/TypeAnnotation__.js.map +1 -1
  134. package/out/concepts/Variable__.d.ts +10 -0
  135. package/out/concepts/Variable__.js +12 -0
  136. package/out/concepts/Variable__.js.map +1 -1
  137. package/out/concepts/ViewComponent__.d.ts +33 -33
  138. package/out/concepts/ViewComponent__.js +7 -7
  139. package/out/concepts/ViewElement__.d.ts +6 -0
  140. package/out/concepts/ViewElement__.js +104 -1
  141. package/out/concepts/ViewElement__.js.map +1 -1
  142. package/out/concepts/View__.js +2 -2
  143. package/out/concepts/View__.js.map +1 -1
  144. package/out/concepts/basics/stdlib/index.js +2 -1
  145. package/out/concepts/basics/stdlib/index.js.map +1 -1
  146. package/out/concepts/basics/stdlib/nasl.auth.js +24 -0
  147. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  148. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  149. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  150. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  151. package/out/concepts/basics/stdlib/nasl.process.js +68 -0
  152. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.ui.js +4 -19
  154. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.util.js +83 -17
  156. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  157. package/out/concepts/basics/types/index.d.ts +1 -0
  158. package/out/concepts/basics/types/index.js +4 -1
  159. package/out/concepts/basics/types/index.js.map +1 -1
  160. package/out/concepts/index__.d.ts +8 -0
  161. package/out/concepts/index__.js +8 -0
  162. package/out/concepts/index__.js.map +1 -1
  163. package/out/enums/KEYWORDS.js +0 -1
  164. package/out/enums/KEYWORDS.js.map +1 -1
  165. package/out/generator/genBundleFiles.d.ts +1 -0
  166. package/out/generator/genBundleFiles.js +27 -0
  167. package/out/generator/genBundleFiles.js.map +1 -1
  168. package/out/generator/genMetaData.d.ts +4 -1
  169. package/out/generator/genMetaData.js +14 -0
  170. package/out/generator/genMetaData.js.map +1 -1
  171. package/out/generator/genReleaseBody.d.ts +2 -1
  172. package/out/generator/genReleaseBody.js +2 -1
  173. package/out/generator/genReleaseBody.js.map +1 -1
  174. package/out/index.d.ts +2 -1
  175. package/out/index.js +3 -1
  176. package/out/index.js.map +1 -1
  177. package/out/server/extendBaseNode.js +16 -4
  178. package/out/server/extendBaseNode.js.map +1 -1
  179. package/out/server/formatTsUtils.d.ts +2 -1
  180. package/out/server/formatTsUtils.js +39 -4
  181. package/out/server/formatTsUtils.js.map +1 -1
  182. package/out/server/getExtensionModules.d.ts +2 -2
  183. package/out/server/getExtensionModules.js +16 -2
  184. package/out/server/getExtensionModules.js.map +1 -1
  185. package/out/server/getLogics.js +5 -5
  186. package/out/server/getLogics.js.map +1 -1
  187. package/out/server/getMemberIdentifier.d.ts +1 -0
  188. package/out/server/getMemberIdentifier.js +34 -7
  189. package/out/server/getMemberIdentifier.js.map +1 -1
  190. package/out/server/naslServer.d.ts +64 -64
  191. package/out/server/naslServer.js +249 -121
  192. package/out/server/naslServer.js.map +1 -1
  193. package/out/server/naslStdlibMap.js +2 -0
  194. package/out/server/naslStdlibMap.js.map +1 -1
  195. package/out/server/translator.d.ts +1 -0
  196. package/out/server/translator.js +67 -2
  197. package/out/server/translator.js.map +1 -1
  198. package/out/service/defaultErrorMessage.json +1 -0
  199. package/out/service/storage/api.d.ts +10 -1
  200. package/out/service/storage/api.js +6 -0
  201. package/out/service/storage/api.js.map +1 -1
  202. package/out/service/storage/init.d.ts +4 -0
  203. package/out/service/storage/init.js +55 -35
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/service/storage/service.d.ts +3 -0
  206. package/out/service/storage/service.js +14 -0
  207. package/out/service/storage/service.js.map +1 -1
  208. package/out/utils/sortTsString.d.ts +1 -0
  209. package/out/utils/sortTsString.js +36 -0
  210. package/out/utils/sortTsString.js.map +1 -0
  211. package/out/utils/traverse.js +2 -2
  212. package/out/utils/traverse.js.map +1 -1
  213. package/package.json +7 -2
  214. package/sandbox/stdlib/nasl.auth.ts +8 -4
  215. package/sandbox/stdlib/nasl.core.d.ts +206 -0
  216. package/sandbox/stdlib/nasl.core.js +1 -0
  217. package/sandbox/stdlib/nasl.core.js.map +1 -0
  218. package/sandbox/stdlib/nasl.http.ts +35 -0
  219. package/sandbox/stdlib/nasl.process.ts +13 -0
  220. package/sandbox/stdlib/nasl.ui.ts +0 -5
  221. package/src/automate/engine/utils.js +4 -1
  222. package/src/breakpoint/generator/AfterStartNode.ts +27 -0
  223. package/src/breakpoint/generator/BeforeEndNode.ts +27 -0
  224. package/src/breakpoint/generator/BreakpointNode.ts +228 -0
  225. package/src/breakpoint/generator/index.ts +114 -0
  226. package/src/breakpoint/index.ts +3 -0
  227. package/src/breakpoint/shared/constants.ts +95 -0
  228. package/src/breakpoint/shared/index.ts +3 -0
  229. package/src/breakpoint/shared/operations.ts +25 -0
  230. package/src/breakpoint/shared/socket.ts +326 -0
  231. package/src/breakpoint/shared/utils.ts +195 -0
  232. package/src/breakpoint/store/core.ts +411 -0
  233. package/src/breakpoint/store/dock.ts +166 -0
  234. package/src/breakpoint/store/index.ts +2 -0
  235. package/src/breakpoint/types/index.d.ts +19 -0
  236. package/src/common/BaseNode.ts +19 -1
  237. package/src/concepts/App__.ts +828 -26
  238. package/src/concepts/Assignment__.ts +1 -1
  239. package/src/concepts/AuthInterface__.ts +148 -0
  240. package/src/concepts/AuthLogicForCallInterface__.ts +573 -0
  241. package/src/concepts/AuthLogic__.ts +225 -0
  242. package/src/concepts/BackendVariable__.ts +466 -0
  243. package/src/concepts/Backend__.ts +347 -0
  244. package/src/concepts/BindAttribute__.ts +4 -3
  245. package/src/concepts/BindEvent__.ts +71 -2
  246. package/src/concepts/CallAuthInterface__.ts +490 -0
  247. package/src/concepts/CallInterface__.ts +10 -2
  248. package/src/concepts/CallLogic__.ts +3 -1
  249. package/src/concepts/CallQueryComponent__.ts +67 -7
  250. package/src/concepts/Destination__.ts +19 -1
  251. package/src/concepts/End__.ts +31 -3
  252. package/src/concepts/EntityProperty__.ts +6 -0
  253. package/src/concepts/Entity__.ts +8 -31
  254. package/src/concepts/ForEachStatement__.ts +9 -4
  255. package/src/concepts/FrontendLibrary__.ts +30 -30
  256. package/src/concepts/FrontendVariable__.ts +76 -0
  257. package/src/concepts/Frontend__.ts +352 -89
  258. package/src/concepts/Function__.ts +1 -1
  259. package/src/concepts/Identifier__.ts +5 -5
  260. package/src/concepts/Interface__.ts +1 -1
  261. package/src/concepts/LogicItem__.ts +26 -6
  262. package/src/concepts/Logic__.ts +86 -8
  263. package/src/concepts/Module__.ts +32 -2
  264. package/src/concepts/Namespace__.ts +30 -30
  265. package/src/concepts/NewComposite__.ts +2 -3
  266. package/src/concepts/OverriddenLogic__.ts +2165 -0
  267. package/src/concepts/Param__.ts +13 -3
  268. package/src/concepts/QueryFieldExpression__.ts +18 -0
  269. package/src/concepts/QuerySelectExpression__.ts +11 -3
  270. package/src/concepts/TypeAnnotation__.ts +45 -6
  271. package/src/concepts/Variable__.ts +14 -0
  272. package/src/concepts/ViewComponent__.ts +35 -35
  273. package/src/concepts/ViewElement__.ts +104 -1
  274. package/src/concepts/View__.ts +24 -2
  275. package/src/concepts/basics/stdlib/index.ts +2 -1
  276. package/src/concepts/basics/stdlib/nasl.auth.ts +24 -0
  277. package/src/concepts/basics/stdlib/nasl.http.ts +166 -0
  278. package/src/concepts/basics/stdlib/nasl.process.ts +68 -0
  279. package/src/concepts/basics/stdlib/nasl.ui.ts +4 -19
  280. package/src/concepts/basics/stdlib/nasl.util.ts +83 -17
  281. package/src/concepts/basics/types/index.ts +5 -4
  282. package/src/concepts/index__.ts +8 -0
  283. package/src/enums/KEYWORDS.ts +0 -1
  284. package/src/generator/genBundleFiles.ts +36 -2
  285. package/src/generator/genMetaData.ts +16 -1
  286. package/src/generator/genReleaseBody.ts +4 -1
  287. package/src/index.ts +2 -1
  288. package/src/server/extendBaseNode.ts +18 -7
  289. package/src/server/formatTsUtils.ts +37 -5
  290. package/src/server/getExtensionModules.ts +18 -3
  291. package/src/server/getLogics.ts +6 -6
  292. package/src/server/getMemberIdentifier.ts +35 -9
  293. package/src/server/naslServer.ts +250 -124
  294. package/src/server/naslStdlibMap.ts +2 -0
  295. package/src/server/translator.ts +67 -1
  296. package/src/service/defaultErrorMessage.json +1 -0
  297. package/src/service/storage/api.js +7 -1
  298. package/src/service/storage/init.ts +66 -35
  299. package/src/service/storage/service.ts +18 -2
  300. package/src/utils/sortTsString.ts +32 -0
  301. package/src/utils/traverse.ts +2 -2
  302. package/test/examples/app-simple.json +73635 -0
  303. package/ts-worker/lib/tsserver.js +3 -3
  304. package/ts-worker/package.json +1 -1
@@ -1,9 +1,11 @@
1
1
  import { TranslatorState } from '../translator';
2
2
  import { AssetsInfo } from './App__';
3
+ import Variable from './Variable__';
3
4
  import { Params } from '../common/EventEmitter';
4
5
  import BaseNode from '../common/BaseNode';
6
+ import BindEvent from './BindEvent__';
5
7
  import View from './View__';
6
- import Variable from './Variable__';
8
+ import FrontendVariable from './FrontendVariable__';
7
9
  import Theme from './Theme__';
8
10
  import Module from './Module__';
9
11
  import App from './App__';
@@ -39,14 +41,18 @@ export declare class Frontend extends BaseNode {
39
41
  * 制品应用图标
40
42
  */
41
43
  documentIcon: string;
44
+ /**
45
+ * 元素绑定事件列表
46
+ */
47
+ bindEvents: Array<BindEvent>;
42
48
  /**
43
49
  * 页面列表
44
50
  */
45
51
  views: Array<View>;
46
52
  /**
47
- * 变量列表
53
+ * 前端全局变量列表
48
54
  */
49
- variables: Array<Variable>;
55
+ variables: Array<FrontendVariable>;
50
56
  /**
51
57
  * 主题配置
52
58
  */
@@ -55,6 +61,14 @@ export declare class Frontend extends BaseNode {
55
61
  * 扩展组件列表(兼容老版)
56
62
  */
57
63
  componentDependencies: Array<Module>;
64
+ /**
65
+ * 全局缩放开关
66
+ */
67
+ globalScaleEnabled: boolean;
68
+ /**
69
+ * 画布宽度
70
+ */
71
+ canvasWidth: number;
58
72
  /**
59
73
  * 祖先 App
60
74
  */
@@ -90,6 +104,83 @@ export declare class Frontend extends BaseNode {
90
104
  * 设置制品应用图标
91
105
  */
92
106
  setDocumentIcon(documentIcon: string): void;
107
+ /**
108
+ * 设置全局缩放开关
109
+ */
110
+ setGlobalScaleEnabled(globalScaleEnabled: boolean): void;
111
+ /**
112
+ * 设置画布宽度
113
+ */
114
+ setCanvasWidth(canvasWidth: number): void;
115
+ getBindEventExistingNames(excludedList?: Array<BindEvent>): string[];
116
+ getBindEventUniqueName(name?: string): string;
117
+ /**
118
+ * 插入元素绑定事件
119
+ * @internal
120
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
121
+ */
122
+ _insertBindEventAt(name: string, index: number): BindEvent;
123
+ /**
124
+ * 插入元素绑定事件
125
+ * @internal
126
+ * @param bindEventOptions 元素绑定事件参数
127
+ */
128
+ _insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
129
+ /**
130
+ * 插入元素绑定事件
131
+ * @internal
132
+ * @param bindEvent 已有的元素绑定事件实例
133
+ */
134
+ _insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
135
+ /**
136
+ * 插入元素绑定事件
137
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
138
+ */
139
+ insertBindEventAt(name: string, index: number): BindEvent;
140
+ /**
141
+ * 插入元素绑定事件
142
+ * @param bindEventOptions 元素绑定事件参数
143
+ */
144
+ insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
145
+ /**
146
+ * 插入元素绑定事件
147
+ * @param bindEvent 已有的元素绑定事件实例
148
+ */
149
+ insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
150
+ /**
151
+ * 添加元素绑定事件
152
+ * @internal
153
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
154
+ */
155
+ _addBindEvent(name?: string): BindEvent;
156
+ /**
157
+ * 添加元素绑定事件
158
+ * @internal
159
+ * @param bindEventOptions 元素绑定事件参数
160
+ */
161
+ _addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
162
+ /**
163
+ * 添加元素绑定事件
164
+ * @internal
165
+ * @param bindEvent 已有的元素绑定事件实例
166
+ */
167
+ _addBindEvent(bindEvent: BindEvent): BindEvent;
168
+ /**
169
+ * 添加元素绑定事件
170
+ * @internal
171
+ * @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
172
+ */
173
+ addBindEvent(name?: string): BindEvent;
174
+ /**
175
+ * 添加元素绑定事件
176
+ * @param bindEventOptions 元素绑定事件参数
177
+ */
178
+ addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
179
+ /**
180
+ * 添加元素绑定事件
181
+ * @param bindEvent 已有的元素绑定事件实例
182
+ */
183
+ addBindEvent(bindEvent: BindEvent): BindEvent;
93
184
  getViewExistingNames(excludedList?: Array<View>): string[];
94
185
  getViewUniqueName(name?: string): string;
95
186
  /**
@@ -159,75 +250,75 @@ export declare class Frontend extends BaseNode {
159
250
  * @param view 已有的页面实例
160
251
  */
161
252
  addView(view: View): View;
162
- getVarExistingNames(excludedList?: Array<Variable>): string[];
163
- getVariableUniqueName(name?: string): string;
253
+ getVarExistingNames(excludedList?: Array<FrontendVariable>): string[];
254
+ getFrontendVariableUniqueName(name?: string): string;
164
255
  /**
165
- * 插入变量
256
+ * 插入前端全局变量
166
257
  * @internal
167
- * @param name 变量名称,如果不填会自动生成一个唯一名称
258
+ * @param name 前端全局变量名称,如果不填会自动生成一个唯一名称
168
259
  */
169
- _insertVariableAt(name: string, index: number): Variable;
260
+ _insertFrontendVariableAt(name: string, index: number): FrontendVariable;
170
261
  /**
171
- * 插入变量
262
+ * 插入前端全局变量
172
263
  * @internal
173
- * @param variableOptions 变量参数
264
+ * @param frontendVariableOptions 前端全局变量参数
174
265
  */
175
- _insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
266
+ _insertFrontendVariableAt(frontendVariableOptions: Partial<FrontendVariable>, index: number): FrontendVariable;
176
267
  /**
177
- * 插入变量
268
+ * 插入前端全局变量
178
269
  * @internal
179
- * @param variable 已有的变量实例
270
+ * @param frontendVariable 已有的前端全局变量实例
180
271
  */
181
- _insertVariableAt(variable: Variable, index: number): Variable;
272
+ _insertFrontendVariableAt(frontendVariable: FrontendVariable, index: number): FrontendVariable;
182
273
  /**
183
- * 插入变量
184
- * @param name 变量名称,如果不填会自动生成一个唯一名称
274
+ * 插入前端全局变量
275
+ * @param name 前端全局变量名称,如果不填会自动生成一个唯一名称
185
276
  */
186
- insertVariableAt(name: string, index: number): Variable;
277
+ insertFrontendVariableAt(name: string, index: number): FrontendVariable;
187
278
  /**
188
- * 插入变量
189
- * @param variableOptions 变量参数
279
+ * 插入前端全局变量
280
+ * @param frontendVariableOptions 前端全局变量参数
190
281
  */
191
- insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
282
+ insertFrontendVariableAt(frontendVariableOptions: Partial<FrontendVariable>, index: number): FrontendVariable;
192
283
  /**
193
- * 插入变量
194
- * @param variable 已有的变量实例
284
+ * 插入前端全局变量
285
+ * @param frontendVariable 已有的前端全局变量实例
195
286
  */
196
- insertVariableAt(variable: Variable, index: number): Variable;
287
+ insertFrontendVariableAt(frontendVariable: FrontendVariable, index: number): FrontendVariable;
197
288
  /**
198
- * 添加变量
289
+ * 添加前端全局变量
199
290
  * @internal
200
- * @param name 变量名称,如果不填会自动生成一个唯一名称
291
+ * @param name 前端全局变量名称,如果不填会自动生成一个唯一名称
201
292
  */
202
- _addVariable(name?: string): Variable;
293
+ _addFrontendVariable(name?: string): FrontendVariable;
203
294
  /**
204
- * 添加变量
295
+ * 添加前端全局变量
205
296
  * @internal
206
- * @param variableOptions 变量参数
297
+ * @param frontendVariableOptions 前端全局变量参数
207
298
  */
208
- _addVariable(variableOptions: Partial<Variable>): Variable;
299
+ _addFrontendVariable(frontendVariableOptions: Partial<FrontendVariable>): FrontendVariable;
209
300
  /**
210
- * 添加变量
301
+ * 添加前端全局变量
211
302
  * @internal
212
- * @param variable 已有的变量实例
303
+ * @param frontendVariable 已有的前端全局变量实例
213
304
  */
214
- _addVariable(variable: Variable): Variable;
305
+ _addFrontendVariable(frontendVariable: FrontendVariable): FrontendVariable;
215
306
  /**
216
- * 添加变量
307
+ * 添加前端全局变量
217
308
  * @internal
218
- * @param name 变量名称,如果不填会自动生成一个唯一名称
309
+ * @param name 前端全局变量名称,如果不填会自动生成一个唯一名称
219
310
  */
220
- addVariable(name?: string): Variable;
311
+ addFrontendVariable(name?: string): FrontendVariable;
221
312
  /**
222
- * 添加变量
223
- * @param variableOptions 变量参数
313
+ * 添加前端全局变量
314
+ * @param frontendVariableOptions 前端全局变量参数
224
315
  */
225
- addVariable(variableOptions: Partial<Variable>): Variable;
316
+ addFrontendVariable(frontendVariableOptions: Partial<FrontendVariable>): FrontendVariable;
226
317
  /**
227
- * 添加变量
228
- * @param variable 已有的变量实例
318
+ * 添加前端全局变量
319
+ * @param frontendVariable 已有的前端全局变量实例
229
320
  */
230
- addVariable(variable: Variable): Variable;
321
+ addFrontendVariable(frontendVariable: FrontendVariable): FrontendVariable;
231
322
  getModuleExistingNames(excludedList?: Array<Module>): string[];
232
323
  getModuleUniqueName(name?: string): string;
233
324
  /**
@@ -298,6 +389,17 @@ export declare class Frontend extends BaseNode {
298
389
  */
299
390
  addModule(module: Module): Module;
300
391
  /**
392
+ * 删除元素绑定事件
393
+ * @param name 元素绑定事件名称
394
+ */
395
+ removeBindEvent(name: string): void;
396
+ /**
397
+ * 删除元素绑定事件
398
+ * @param bindEvent 已有的元素绑定事件实例
399
+ */
400
+ removeBindEvent(bindEvent: BindEvent): void;
401
+ __removeBindEvent(bindEvent: BindEvent): Params;
402
+ /**
301
403
  * 删除页面
302
404
  * @param name 页面名称
303
405
  */
@@ -309,15 +411,15 @@ export declare class Frontend extends BaseNode {
309
411
  removeView(view: View): void;
310
412
  __removeView(view: View): Params;
311
413
  /**
312
- * 删除变量
313
- * @param name 变量名称
414
+ * 删除前端全局变量
415
+ * @param name 前端全局变量名称
314
416
  */
315
- removeVariable(name: string): void;
417
+ removeFrontendVariable(name: string): void;
316
418
  /**
317
- * 删除变量
318
- * @param variable 已有的变量实例
419
+ * 删除前端全局变量
420
+ * @param frontendVariable 已有的前端全局变量实例
319
421
  */
320
- removeVariable(variable: Variable): void;
422
+ removeFrontendVariable(frontendVariable: FrontendVariable): void;
321
423
  __removeVariable(variable: Variable): Params;
322
424
  /**
323
425
  * 删除主题
@@ -349,6 +451,7 @@ export declare class Frontend extends BaseNode {
349
451
  findViewByPath(path: string): View;
350
452
  findViewByName(name: string): View;
351
453
  genThemeCSS(): string;
454
+ getTsNamespace(): string;
352
455
  getNamespace(): string;
353
456
  /**
354
457
  * 生成宿主语言的文件路径
@@ -369,5 +472,6 @@ export declare class Frontend extends BaseNode {
369
472
  get basePath(): string;
370
473
  genCustomAssetsInfo(prefix: string): AssetsInfo;
371
474
  getExtensionsCallbackLogics(): string[];
475
+ get defaultCanvasWidth(): 1440 | 375;
372
476
  }
373
477
  export default Frontend;
@@ -39,8 +39,9 @@ const decorators_1 = require("../decorators");
39
39
  const utils = __importStar(require("../utils"));
40
40
  const BaseNode_1 = __importDefault(require("../common/BaseNode"));
41
41
  const classMap_1 = __importDefault(require("../common/classMap"));
42
+ const BindEvent__1 = __importDefault(require("./BindEvent__"));
42
43
  const View__1 = __importDefault(require("./View__"));
43
- const Variable__1 = __importDefault(require("./Variable__"));
44
+ const FrontendVariable__1 = __importDefault(require("./FrontendVariable__"));
44
45
  const Theme__1 = __importDefault(require("./Theme__"));
45
46
  const Module__1 = __importDefault(require("./Module__"));
46
47
  /**
@@ -75,12 +76,16 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
75
76
  * 制品应用图标
76
77
  */
77
78
  documentIcon = undefined;
79
+ /**
80
+ * 元素绑定事件列表
81
+ */
82
+ bindEvents = [];
78
83
  /**
79
84
  * 页面列表
80
85
  */
81
86
  views = [];
82
87
  /**
83
- * 变量列表
88
+ * 前端全局变量列表
84
89
  */
85
90
  variables = [];
86
91
  /**
@@ -91,6 +96,14 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
91
96
  * 扩展组件列表(兼容老版)
92
97
  */
93
98
  componentDependencies = [];
99
+ /**
100
+ * 全局缩放开关
101
+ */
102
+ globalScaleEnabled = false;
103
+ /**
104
+ * 画布宽度
105
+ */
106
+ canvasWidth = 0;
94
107
  /**
95
108
  * 祖先 App
96
109
  */
@@ -178,6 +191,88 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
178
191
  ...object,
179
192
  });
180
193
  }
194
+ /**
195
+ * 设置全局缩放开关
196
+ */
197
+ setGlobalScaleEnabled(globalScaleEnabled) {
198
+ const object = {
199
+ globalScaleEnabled,
200
+ };
201
+ this.update({
202
+ ...object,
203
+ });
204
+ }
205
+ /**
206
+ * 设置画布宽度
207
+ */
208
+ setCanvasWidth(canvasWidth) {
209
+ const object = {
210
+ canvasWidth,
211
+ };
212
+ this.update({
213
+ ...object,
214
+ });
215
+ }
216
+ getBindEventExistingNames(excludedList = []) {
217
+ const excludedSet = new Set(excludedList);
218
+ return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
219
+ }
220
+ getBindEventUniqueName(name = 'bindEvent1') {
221
+ return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
222
+ }
223
+ _insertBindEventAt(options, index) {
224
+ const bindEventOptions = {};
225
+ const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
226
+ let bindEvent;
227
+ if (!options) {
228
+ bindEvent = BindEvent__1.default.from({
229
+ ...bindEventOptions,
230
+ name: this.getBindEventUniqueName(),
231
+ }, this, 'bindEvents');
232
+ }
233
+ else if (typeof options === 'string') {
234
+ bindEvent = BindEvent__1.default.from({
235
+ ...bindEventOptions,
236
+ name: options,
237
+ }, this, 'bindEvents');
238
+ }
239
+ else if (options instanceof BindEvent__1.default) {
240
+ options.ensureDelete(); // 同一实例不支持多处存在
241
+ bindEvent = options;
242
+ Object.assign(bindEvent, relationOptions);
243
+ }
244
+ else {
245
+ bindEvent = BindEvent__1.default.from({
246
+ ...bindEventOptions,
247
+ ...options,
248
+ }, this, 'bindEvents');
249
+ }
250
+ this.bindEvents.splice(index, 0, bindEvent);
251
+ return bindEvent;
252
+ }
253
+ insertBindEventAt(options, index) {
254
+ const node = this._insertBindEventAt(options, index);
255
+ node.create({
256
+ index,
257
+ parentNode: this,
258
+ parentKey: 'bindEvents',
259
+ });
260
+ return node;
261
+ }
262
+ _addBindEvent(options) {
263
+ const index = this.bindEvents.length;
264
+ return this._insertBindEventAt(options, index);
265
+ }
266
+ addBindEvent(options) {
267
+ const node = this._addBindEvent(options);
268
+ const index = this.bindEvents.indexOf(node);
269
+ node.create({
270
+ index,
271
+ parentNode: this,
272
+ parentKey: 'bindEvents',
273
+ });
274
+ return node;
275
+ }
181
276
  getViewExistingNames(excludedList = []) {
182
277
  const excludedSet = new Set(excludedList);
183
278
  return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -242,41 +337,41 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
242
337
  const excludedSet = new Set(excludedList);
243
338
  return (this.variables || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
244
339
  }
245
- getVariableUniqueName(name = 'variable1') {
340
+ getFrontendVariableUniqueName(name = 'frontendVariable1') {
246
341
  return utils.unique(name, this.getVarExistingNames(), undefined, true);
247
342
  }
248
- _insertVariableAt(options, index) {
249
- const variableOptions = {};
343
+ _insertFrontendVariableAt(options, index) {
344
+ const frontendVariableOptions = {};
250
345
  const relationOptions = { parentNode: this, parentKey: 'variables' };
251
- let variable;
346
+ let frontendVariable;
252
347
  if (!options) {
253
- variable = Variable__1.default.from({
254
- ...variableOptions,
255
- name: this.getVariableUniqueName(),
348
+ frontendVariable = FrontendVariable__1.default.from({
349
+ ...frontendVariableOptions,
350
+ name: this.getFrontendVariableUniqueName(),
256
351
  }, this, 'variables');
257
352
  }
258
353
  else if (typeof options === 'string') {
259
- variable = Variable__1.default.from({
260
- ...variableOptions,
354
+ frontendVariable = FrontendVariable__1.default.from({
355
+ ...frontendVariableOptions,
261
356
  name: options,
262
357
  }, this, 'variables');
263
358
  }
264
- else if (options instanceof Variable__1.default) {
359
+ else if (options instanceof FrontendVariable__1.default) {
265
360
  options.ensureDelete(); // 同一实例不支持多处存在
266
- variable = options;
267
- Object.assign(variable, relationOptions);
361
+ frontendVariable = options;
362
+ Object.assign(frontendVariable, relationOptions);
268
363
  }
269
364
  else {
270
- variable = Variable__1.default.from({
271
- ...variableOptions,
365
+ frontendVariable = FrontendVariable__1.default.from({
366
+ ...frontendVariableOptions,
272
367
  ...options,
273
368
  }, this, 'variables');
274
369
  }
275
- this.variables.splice(index, 0, variable);
276
- return variable;
370
+ this.variables.splice(index, 0, frontendVariable);
371
+ return frontendVariable;
277
372
  }
278
- insertVariableAt(options, index) {
279
- const node = this._insertVariableAt(options, index);
373
+ insertFrontendVariableAt(options, index) {
374
+ const node = this._insertFrontendVariableAt(options, index);
280
375
  node.create({
281
376
  index,
282
377
  parentNode: this,
@@ -284,12 +379,12 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
284
379
  });
285
380
  return node;
286
381
  }
287
- _addVariable(options) {
382
+ _addFrontendVariable(options) {
288
383
  const index = this.variables.length;
289
- return this._insertVariableAt(options, index);
384
+ return this._insertFrontendVariableAt(options, index);
290
385
  }
291
- addVariable(options) {
292
- const node = this._addVariable(options);
386
+ addFrontendVariable(options) {
387
+ const node = this._addFrontendVariable(options);
293
388
  const index = this.variables.indexOf(node);
294
389
  node.create({
295
390
  index,
@@ -358,6 +453,42 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
358
453
  });
359
454
  return node;
360
455
  }
456
+ removeBindEvent(options) {
457
+ let bindEvent;
458
+ if (typeof options === 'string') {
459
+ bindEvent = this.bindEvents.find((item) => item.name === options);
460
+ if (!bindEvent) {
461
+ throw new Error('找不到元素绑定事件 ' + options);
462
+ }
463
+ }
464
+ else {
465
+ bindEvent = options;
466
+ }
467
+ return bindEvent.delete();
468
+ }
469
+ __removeBindEvent(bindEvent) {
470
+ const parentKey = bindEvent.parentKey;
471
+ const params = {
472
+ parentNode: this,
473
+ parentKey,
474
+ index: -1,
475
+ object: null,
476
+ oldObject: bindEvent,
477
+ };
478
+ if (parentKey) {
479
+ params.parentKey = parentKey;
480
+ if (Array.isArray(this[parentKey])) {
481
+ const index = this[parentKey].indexOf(bindEvent);
482
+ ~index && this[parentKey].splice(index, 1);
483
+ params.index = index;
484
+ }
485
+ else if (this[parentKey] === bindEvent) {
486
+ params.index = 0;
487
+ this[parentKey] = undefined;
488
+ }
489
+ }
490
+ return params;
491
+ }
361
492
  removeView(options) {
362
493
  let view;
363
494
  if (typeof options === 'string') {
@@ -394,18 +525,18 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
394
525
  }
395
526
  return params;
396
527
  }
397
- removeVariable(options) {
398
- let variable;
528
+ removeFrontendVariable(options) {
529
+ let frontendVariable;
399
530
  if (typeof options === 'string') {
400
- variable = this.variables.find((item) => item.name === options);
401
- if (!variable) {
402
- throw new Error('找不到变量 ' + options);
531
+ frontendVariable = this.variables.find((item) => item.name === options);
532
+ if (!frontendVariable) {
533
+ throw new Error('找不到前端全局变量 ' + options);
403
534
  }
404
535
  }
405
536
  else {
406
- variable = options;
537
+ frontendVariable = options;
407
538
  }
408
- return variable.delete();
539
+ return frontendVariable.delete();
409
540
  }
410
541
  __removeVariable(variable) {
411
542
  const parentKey = variable.parentKey;
@@ -537,6 +668,19 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
537
668
  ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
538
669
  }`;
539
670
  }
671
+ getTsNamespace() {
672
+ if (this.parentNode && this.parentNode.getNamespace) {
673
+ const parentNamespace = this.parentNode.getNamespace();
674
+ const parentName = this.parentNode.name;
675
+ const arr = [parentNamespace];
676
+ if (this.parentNode.concept !== 'App' && parentName) {
677
+ arr.push(parentName);
678
+ }
679
+ return `${arr.join('.')}.frontends`;
680
+ }
681
+ else
682
+ throw new Error('无法获取命名空间,请设置 parentNode!');
683
+ }
540
684
  getNamespace() {
541
685
  if (this.parentNode && this.parentNode.getNamespace) {
542
686
  const parentNamespace = this.parentNode.getNamespace();
@@ -635,6 +779,9 @@ let Frontend = Frontend_1 = class Frontend extends BaseNode_1.default {
635
779
  });
636
780
  return Array.from(new Set(resultLogics));
637
781
  }
782
+ get defaultCanvasWidth() {
783
+ return this.type === 'pc' ? 1440 : 375;
784
+ }
638
785
  };
639
786
  __decorate([
640
787
  (0, decorators_1.property)()
@@ -657,11 +804,14 @@ __decorate([
657
804
  __decorate([
658
805
  (0, decorators_1.property)()
659
806
  ], Frontend.prototype, "documentIcon", void 0);
807
+ __decorate([
808
+ (0, decorators_1.property)('BindEvent')
809
+ ], Frontend.prototype, "bindEvents", void 0);
660
810
  __decorate([
661
811
  (0, decorators_1.property)('View')
662
812
  ], Frontend.prototype, "views", void 0);
663
813
  __decorate([
664
- (0, decorators_1.property)('Variable')
814
+ (0, decorators_1.property)('FrontendVariable')
665
815
  ], Frontend.prototype, "variables", void 0);
666
816
  __decorate([
667
817
  (0, decorators_1.property)('Theme')
@@ -669,6 +819,12 @@ __decorate([
669
819
  __decorate([
670
820
  (0, decorators_1.property)('Module')
671
821
  ], Frontend.prototype, "componentDependencies", void 0);
822
+ __decorate([
823
+ (0, decorators_1.property)()
824
+ ], Frontend.prototype, "globalScaleEnabled", void 0);
825
+ __decorate([
826
+ (0, decorators_1.property)()
827
+ ], Frontend.prototype, "canvasWidth", void 0);
672
828
  __decorate([
673
829
  (0, translator_1.withSourceMap)()
674
830
  ], Frontend.prototype, "toEmbeddedTS", null);