xmlui 0.4.0

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 (308) hide show
  1. package/dist/Pdf-DeGhSMXe.mjs +19537 -0
  2. package/dist/Pdf.css +1 -0
  3. package/dist/apiInterceptorWorker-CwuUhYyc.mjs +9229 -0
  4. package/dist/array-USo-Szhp.mjs +12 -0
  5. package/dist/index-C24dkfpd.mjs +1434 -0
  6. package/dist/index-ao27SnVp.mjs +145185 -0
  7. package/dist/index.css +1 -0
  8. package/dist/nivo-bar.es-CWh0ZlxB.mjs +1666 -0
  9. package/dist/nivo-geo.es-BTqNt5Db.mjs +1579 -0
  10. package/dist/nivo-legends.es-BuIxHGSU.mjs +6916 -0
  11. package/dist/nivo-pie.es-BvCBFA0L.mjs +700 -0
  12. package/dist/react-apexcharts.min-DqWuDOyO.mjs +8881 -0
  13. package/dist/scripts/bin/bootstrap.js +11 -0
  14. package/dist/scripts/bin/build.js +256 -0
  15. package/dist/scripts/bin/index.js +88 -0
  16. package/dist/scripts/bin/preview.js +27 -0
  17. package/dist/scripts/bin/start.js +41 -0
  18. package/dist/scripts/bin/vite-ueml-plugin.js +113 -0
  19. package/dist/scripts/bin/viteConfig.js +112 -0
  20. package/dist/scripts/src/abstractions/ActionDefs.js +2 -0
  21. package/dist/scripts/src/abstractions/AppContextDefs.js +2 -0
  22. package/dist/scripts/src/abstractions/BlockScope.js +4 -0
  23. package/dist/scripts/src/abstractions/ComponentDefs.js +2 -0
  24. package/dist/scripts/src/abstractions/ComponentDescriptorDefs.js +2 -0
  25. package/dist/scripts/src/abstractions/ContainerDefs.js +2 -0
  26. package/dist/scripts/src/abstractions/FunctionDefs.js +2 -0
  27. package/dist/scripts/src/abstractions/RendererDefs.js +2 -0
  28. package/dist/scripts/src/abstractions/scripting/ScriptParserError.js +2 -0
  29. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +2 -0
  30. package/dist/scripts/src/abstractions/scripting/Token.js +110 -0
  31. package/dist/scripts/src/components/App/App.js +253 -0
  32. package/dist/scripts/src/components/App/AppLayoutContext.js +9 -0
  33. package/dist/scripts/src/components/App/AppStateContext.js +9 -0
  34. package/dist/scripts/src/components/App/Sheet.js +89 -0
  35. package/dist/scripts/src/components/AppHeader/AppHeader.js +121 -0
  36. package/dist/scripts/src/components/AppState/AppState.js +29 -0
  37. package/dist/scripts/src/components/Avatar/Avatar.js +81 -0
  38. package/dist/scripts/src/components/Badge/Badge.js +56 -0
  39. package/dist/scripts/src/components/BarChart/BarChart.js +199 -0
  40. package/dist/scripts/src/components/Bookmark/Bookmark.js +11 -0
  41. package/dist/scripts/src/components/Button/Button.js +196 -0
  42. package/dist/scripts/src/components/Card/Card.js +65 -0
  43. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +43 -0
  44. package/dist/scripts/src/components/Chart/Chart.js +158 -0
  45. package/dist/scripts/src/components/Checkbox/Checkbox.js +43 -0
  46. package/dist/scripts/src/components/Combobox/Combobox.js +145 -0
  47. package/dist/scripts/src/components/ComponentProvider.js +357 -0
  48. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +40 -0
  49. package/dist/scripts/src/components/DatePicker/DatePicker.js +196 -0
  50. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +175 -0
  51. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +56 -0
  52. package/dist/scripts/src/components/FileInput/FileInput.js +127 -0
  53. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +106 -0
  54. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +139 -0
  55. package/dist/scripts/src/components/Footer/Footer.js +42 -0
  56. package/dist/scripts/src/components/Form/Form.js +320 -0
  57. package/dist/scripts/src/components/Form/FormContext.js +9 -0
  58. package/dist/scripts/src/components/Form/formActions.js +86 -0
  59. package/dist/scripts/src/components/FormItem/FormItem.js +204 -0
  60. package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
  61. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +39 -0
  62. package/dist/scripts/src/components/FormItem/Validations.js +346 -0
  63. package/dist/scripts/src/components/FormSection/FormSection.js +45 -0
  64. package/dist/scripts/src/components/Heading/Heading.js +206 -0
  65. package/dist/scripts/src/components/HoverCard/HoverCard.js +45 -0
  66. package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
  67. package/dist/scripts/src/components/Icon/Attach.js +10 -0
  68. package/dist/scripts/src/components/Icon/Binding.js +11 -0
  69. package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
  70. package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
  71. package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
  72. package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
  73. package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
  74. package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
  75. package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
  76. package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
  77. package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
  78. package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
  79. package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
  80. package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
  81. package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
  82. package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
  83. package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
  84. package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
  85. package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
  86. package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
  87. package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
  88. package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
  89. package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
  90. package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
  91. package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
  92. package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
  93. package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
  94. package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
  95. package/dist/scripts/src/components/Icon/Icon.js +101 -0
  96. package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
  97. package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
  98. package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
  99. package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
  100. package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
  101. package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
  102. package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
  103. package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
  104. package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
  105. package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
  106. package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
  107. package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
  108. package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
  109. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  110. package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
  111. package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
  112. package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
  113. package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
  114. package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
  115. package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
  116. package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
  117. package/dist/scripts/src/components/IconProvider.js +249 -0
  118. package/dist/scripts/src/components/IconRegistryContext.js +307 -0
  119. package/dist/scripts/src/components/Image/Image.js +34 -0
  120. package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
  121. package/dist/scripts/src/components/Input/input-abstractions.js +44 -0
  122. package/dist/scripts/src/components/Items/Items.js +48 -0
  123. package/dist/scripts/src/components/Link/Link.js +72 -0
  124. package/dist/scripts/src/components/List/List.js +442 -0
  125. package/dist/scripts/src/components/Logo/Logo.js +25 -0
  126. package/dist/scripts/src/components/Map/Map.js +60 -0
  127. package/dist/scripts/src/components/Map/world_countries.json +45307 -0
  128. package/dist/scripts/src/components/Markdown/Markdown.js +120 -0
  129. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +106 -0
  130. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  131. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +145 -0
  132. package/dist/scripts/src/components/MultiCombobox/MultiCombobox.js +249 -0
  133. package/dist/scripts/src/components/MultiSelect/MultiSelect.js +192 -0
  134. package/dist/scripts/src/components/NavGroup/NavGroup.js +113 -0
  135. package/dist/scripts/src/components/NavLink/NavLink.js +115 -0
  136. package/dist/scripts/src/components/NavPanel/NavPanel.js +101 -0
  137. package/dist/scripts/src/components/NoResult/NoResult.js +39 -0
  138. package/dist/scripts/src/components/NumberBox/NumberBox.js +373 -0
  139. package/dist/scripts/src/components/Option/Option.js +41 -0
  140. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +22 -0
  141. package/dist/scripts/src/components/Pages/Pages.js +74 -0
  142. package/dist/scripts/src/components/Pdf/LazyPdf.js +44 -0
  143. package/dist/scripts/src/components/Pdf/Pdf.js +19 -0
  144. package/dist/scripts/src/components/PieChart/PieChart.js +184 -0
  145. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +29 -0
  146. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +38 -0
  147. package/dist/scripts/src/components/Queue/Queue.js +286 -0
  148. package/dist/scripts/src/components/Queue/queueActions.js +87 -0
  149. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +144 -0
  150. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +147 -0
  151. package/dist/scripts/src/components/Redirect/Redirect.js +10 -0
  152. package/dist/scripts/src/components/Select/Select.js +139 -0
  153. package/dist/scripts/src/components/Select/SelectContext.js +45 -0
  154. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +88 -0
  155. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +22 -0
  156. package/dist/scripts/src/components/Spinner/Spinner.js +59 -0
  157. package/dist/scripts/src/components/Splitter/Splitter.js +205 -0
  158. package/dist/scripts/src/components/Splitter/utils.js +17 -0
  159. package/dist/scripts/src/components/Stack/Stack.js +117 -0
  160. package/dist/scripts/src/components/StickyBox/StickyBox.js +33 -0
  161. package/dist/scripts/src/components/Switch/Switch.js +50 -0
  162. package/dist/scripts/src/components/Table/Table.js +499 -0
  163. package/dist/scripts/src/components/Table/useRowSelection.js +169 -0
  164. package/dist/scripts/src/components/TableColumnDef/TableColumnDef.js +44 -0
  165. package/dist/scripts/src/components/TableColumnDef/TableContext.js +12 -0
  166. package/dist/scripts/src/components/Tabs/Tabs.js +85 -0
  167. package/dist/scripts/src/components/Text/Text.js +175 -0
  168. package/dist/scripts/src/components/TextArea/TextArea.js +194 -0
  169. package/dist/scripts/src/components/TextArea/TextAreaResizable.js +63 -0
  170. package/dist/scripts/src/components/TextArea/useComposedRef.js +50 -0
  171. package/dist/scripts/src/components/TextBox/TextBox.js +145 -0
  172. package/dist/scripts/src/components/Theme/NotificationToast.js +39 -0
  173. package/dist/scripts/src/components/Theme/Theme.js +153 -0
  174. package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +125 -0
  175. package/dist/scripts/src/components/Toggle/Toggle.js +88 -0
  176. package/dist/scripts/src/components/Tree/TreeComponent.js +79 -0
  177. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
  178. package/dist/scripts/src/components/ViewComponentRegistryContext.js +34 -0
  179. package/dist/scripts/src/components/abstractions.js +2 -0
  180. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  181. package/dist/scripts/src/components/component-utils.js +32 -0
  182. package/dist/scripts/src/components/container-helpers.js +18 -0
  183. package/dist/scripts/src/components-core/ApiBoundComponent.js +189 -0
  184. package/dist/scripts/src/components-core/AppContext.js +17 -0
  185. package/dist/scripts/src/components-core/ChildrenSlot.js +10 -0
  186. package/dist/scripts/src/components-core/Component.js +280 -0
  187. package/dist/scripts/src/components-core/ComponentDecorator.js +63 -0
  188. package/dist/scripts/src/components-core/CompoundComponent.js +132 -0
  189. package/dist/scripts/src/components-core/EngineError.js +91 -0
  190. package/dist/scripts/src/components-core/ErrorBoundary.js +58 -0
  191. package/dist/scripts/src/components-core/Fragment.js +14 -0
  192. package/dist/scripts/src/components-core/InvalidComponent.js +15 -0
  193. package/dist/scripts/src/components-core/LoaderComponent.js +78 -0
  194. package/dist/scripts/src/components-core/RestApiProxy.js +341 -0
  195. package/dist/scripts/src/components-core/RootComponent.js +272 -0
  196. package/dist/scripts/src/components-core/RouteContext.js +45 -0
  197. package/dist/scripts/src/components-core/ScrollContext.js +9 -0
  198. package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
  199. package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
  200. package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
  201. package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
  202. package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
  203. package/dist/scripts/src/components-core/action/ApiAction.js +276 -0
  204. package/dist/scripts/src/components-core/action/DownloadFileAction.js +80 -0
  205. package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
  206. package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
  207. package/dist/scripts/src/components-core/action/UploadAction.js +88 -0
  208. package/dist/scripts/src/components-core/action/actions.js +15 -0
  209. package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
  210. package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
  211. package/dist/scripts/src/components-core/component-hooks.js +25 -0
  212. package/dist/scripts/src/components-core/constants.js +18 -0
  213. package/dist/scripts/src/components-core/container/Container.js +1110 -0
  214. package/dist/scripts/src/components-core/container/ContainerComponentDef.js +16 -0
  215. package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
  216. package/dist/scripts/src/components-core/container/collectFnVarDeps.js +26 -0
  217. package/dist/scripts/src/components-core/container/valueExtractor.js +195 -0
  218. package/dist/scripts/src/components-core/descriptorHelper.js +75 -0
  219. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  220. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  221. package/dist/scripts/src/components-core/loader/ApiLoader.js +46 -0
  222. package/dist/scripts/src/components-core/loader/DataLoader.js +160 -0
  223. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +52 -0
  224. package/dist/scripts/src/components-core/loader/Loader.js +115 -0
  225. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +32 -0
  226. package/dist/scripts/src/components-core/loader/PageableLoader.js +240 -0
  227. package/dist/scripts/src/components-core/renderers.js +45 -0
  228. package/dist/scripts/src/components-core/reportEngineError.js +59 -0
  229. package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
  230. package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
  231. package/dist/scripts/src/components-core/script-runner/LogicalThread.js +2 -0
  232. package/dist/scripts/src/components-core/script-runner/LoopScope.js +2 -0
  233. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
  234. package/dist/scripts/src/components-core/script-runner/TryScope.js +2 -0
  235. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +96 -0
  236. package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
  237. package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
  238. package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
  239. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +551 -0
  240. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +498 -0
  241. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +434 -0
  242. package/dist/scripts/src/components-core/script-runner/modules.js +250 -0
  243. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +818 -0
  244. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
  245. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +740 -0
  246. package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
  247. package/dist/scripts/src/components-core/script-runner/visitors.js +352 -0
  248. package/dist/scripts/src/components-core/theming/ThemeContext.js +43 -0
  249. package/dist/scripts/src/components-core/theming/ThemeProvider.js +334 -0
  250. package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
  251. package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
  252. package/dist/scripts/src/components-core/theming/hvar.js +105 -0
  253. package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
  254. package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
  255. package/dist/scripts/src/components-core/theming/themes/palette.js +53 -0
  256. package/dist/scripts/src/components-core/theming/themes/root.js +257 -0
  257. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  258. package/dist/scripts/src/components-core/theming/themes/theme-colors.js +407 -0
  259. package/dist/scripts/src/components-core/theming/themes/xmlui.js +32 -0
  260. package/dist/scripts/src/components-core/theming/transformThemeVars.js +286 -0
  261. package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +34 -0
  262. package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
  263. package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
  264. package/dist/scripts/src/components-core/utils/classnames.js +58 -0
  265. package/dist/scripts/src/components-core/utils/css-utils.js +127 -0
  266. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  267. package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
  268. package/dist/scripts/src/components-core/utils/hooks.js +221 -0
  269. package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
  270. package/dist/scripts/src/components-core/utils/misc.js +460 -0
  271. package/dist/scripts/src/components-core/utils/statementUtils.js +205 -0
  272. package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
  273. package/dist/scripts/src/components-core/xmlui-parser.js +52 -0
  274. package/dist/scripts/src/parsers/scripting/InputStream.js +59 -0
  275. package/dist/scripts/src/parsers/scripting/Lexer.js +1028 -0
  276. package/dist/scripts/src/parsers/scripting/Parser.js +2647 -0
  277. package/dist/scripts/src/parsers/scripting/ParserError.js +46 -0
  278. package/dist/scripts/src/parsers/scripting/TokenTrait.js +109 -0
  279. package/dist/scripts/src/parsers/scripting/code-behind-collect.js +118 -0
  280. package/dist/scripts/src/parsers/scripting/tree-visitor.js +602 -0
  281. package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
  282. package/dist/scripts/src/parsers/style-parser/StyleLexer.js +621 -0
  283. package/dist/scripts/src/parsers/style-parser/StyleParser.js +1000 -0
  284. package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
  285. package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
  286. package/dist/scripts/src/parsers/style-parser/style-compiler.js +513 -0
  287. package/dist/scripts/src/parsers/style-parser/tokens.js +42 -0
  288. package/dist/scripts/src/parsers/ueml/ParserError.js +54 -0
  289. package/dist/scripts/src/parsers/ueml/UemlHelper.js +579 -0
  290. package/dist/scripts/src/parsers/ueml/UemlInputStream.js +59 -0
  291. package/dist/scripts/src/parsers/ueml/UemlLexer.js +868 -0
  292. package/dist/scripts/src/parsers/ueml/UemlParser.js +1439 -0
  293. package/dist/scripts/src/parsers/ueml/UemlToken.js +24 -0
  294. package/dist/scripts/src/parsers/ueml/fileExtensions.js +6 -0
  295. package/dist/scripts/src/parsers/ueml/source-tree.js +2 -0
  296. package/dist/scripts/src/parsers/ueml/ueml-tree.js +2 -0
  297. package/dist/scripts/src/parsers/xmlui-parser/CharacterCodes.js +136 -0
  298. package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +100 -0
  299. package/dist/scripts/src/parsers/xmlui-parser/parser.js +476 -0
  300. package/dist/scripts/src/parsers/xmlui-parser/scanner.js +415 -0
  301. package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +106 -0
  302. package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +2 -0
  303. package/dist/scripts/src/parsers/xmlui-parser/transform.js +922 -0
  304. package/dist/scripts/src/parsers/xmlui-parser/utils.js +83 -0
  305. package/dist/xmlui.es.d.ts +1667 -0
  306. package/dist/xmlui.es.js +17 -0
  307. package/dist/xmlui.umd.js +1589 -0
  308. package/package.json +175 -0
@@ -0,0 +1,460 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isPrimitive = exports.pickFromObject = exports.shallowCompare = exports.MIME_TYPES = exports.useEvent = exports.asyncWait = void 0;
13
+ exports.partition = partition;
14
+ exports.generatedId = generatedId;
15
+ exports.randomUUID = randomUUID;
16
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
17
+ exports.removeNullProperties = removeNullProperties;
18
+ exports.humanFileSize = humanFileSize;
19
+ exports.isLocale = isLocale;
20
+ exports.filterKeysInObject = filterKeysInObject;
21
+ exports.subStringsPresentInString = subStringsPresentInString;
22
+ exports.ensureTrailingSlashForUrl = ensureTrailingSlashForUrl;
23
+ exports.humanReadableDateTimeTillNow = humanReadableDateTimeTillNow;
24
+ exports.checkFileType = checkFileType;
25
+ exports.delay = delay;
26
+ exports.normalizePath = normalizePath;
27
+ exports.isComponentDefChildren = isComponentDefChildren;
28
+ exports.orderBy = orderBy;
29
+ exports.shallowEqualArrays = shallowEqualArrays;
30
+ exports.shallowEqualObjects = shallowEqualObjects;
31
+ exports.groupChildrenByType = groupChildrenByType;
32
+ exports.getChildrenByType = getChildrenByType;
33
+ exports.formatFileSizeInBytes = formatFileSizeInBytes;
34
+ exports.getFileExtension = getFileExtension;
35
+ exports.pluralize = pluralize;
36
+ exports.asyncThrottle = asyncThrottle;
37
+ const react_1 = require("react");
38
+ const lodash_es_1 = require("lodash-es");
39
+ const date_fns_1 = require("date-fns");
40
+ const EngineError_1 = require("@components-core/EngineError");
41
+ /**
42
+ * Slice a single array into two based on a discriminator function.
43
+ * @param array Input array
44
+ * @param discriminator Does the separation of data
45
+ * @returns An array containing the two disjunct arrays
46
+ */
47
+ function partition(array, discriminator) {
48
+ return array.reduce(([pass, fail], elem) => {
49
+ return discriminator(elem) ? [[...pass, elem], fail] : [pass, [...fail, elem]];
50
+ }, [[], []]);
51
+ }
52
+ /**
53
+ * The value used last time for ID generation
54
+ */
55
+ let lastIdValue = 1;
56
+ /**
57
+ * We use a generated value for all components that do not have an explicitly set ID.
58
+ */
59
+ function generatedId() {
60
+ return `$qid_${lastIdValue++}`;
61
+ }
62
+ function randomUUID() {
63
+ if (crypto === null || crypto === void 0 ? void 0 : crypto.randomUUID) {
64
+ return crypto === null || crypto === void 0 ? void 0 : crypto.randomUUID();
65
+ }
66
+ // @ts-ignore
67
+ return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
68
+ }
69
+ /**
70
+ * Wait for a set duration asynchronously.
71
+ * @param ms Time in ms to wait before continuing execution
72
+ * @returns An empty promise
73
+ */
74
+ const asyncWait = (ms) => new Promise((res) => setTimeout(res, ms));
75
+ exports.asyncWait = asyncWait;
76
+ /**
77
+ * Capitalizes the first letter of a string.
78
+ * @param str Input string to capitalize
79
+ */
80
+ function capitalizeFirstLetter(str) {
81
+ return str[0].toUpperCase() + str.substring(1);
82
+ }
83
+ /**
84
+ * Removes "null" properties from the specified object
85
+ * @param obj Object to remove nulls from
86
+ */
87
+ function removeNullProperties(obj) {
88
+ if (typeof obj !== "object")
89
+ return;
90
+ for (const key in obj) {
91
+ if (obj[key] === null || obj[key] === undefined) {
92
+ delete obj[key];
93
+ }
94
+ else {
95
+ removeNullProperties(obj[key]);
96
+ }
97
+ }
98
+ }
99
+ //changed to useInsertionEffect, (from useLayoutEffect): https://stackoverflow.com/a/76514983
100
+ // as for now, it's going to be called 'useEffectEvent'
101
+ // more here: https://react.dev/reference/react/experimental_useEffectEvent
102
+ const useEvent = (callback) => {
103
+ const callbackRef = (0, react_1.useRef)(callback);
104
+ (0, react_1.useInsertionEffect)(() => {
105
+ callbackRef.current = callback;
106
+ }, [callback]);
107
+ return (0, react_1.useCallback)((...args) => {
108
+ return callbackRef.current(...args);
109
+ }, []);
110
+ };
111
+ exports.useEvent = useEvent;
112
+ /**
113
+ * Format bytes as human-readable text.
114
+ *
115
+ * @param bytes Number of bytes.
116
+ * @param si True to use metric (SI) units, aka powers of 1000. False to use
117
+ * binary (IEC), aka powers of 1024.
118
+ * @param dp Number of decimal places to display.
119
+ *
120
+ * @return Formatted string.
121
+ */
122
+ function humanFileSize(bytes, si = false, dp = 1) {
123
+ const thresh = si ? 1000 : 1024;
124
+ if (Math.abs(bytes) < thresh) {
125
+ return bytes + " B";
126
+ }
127
+ const units = si
128
+ ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
129
+ : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
130
+ let u = -1;
131
+ const r = Math.pow(10, dp);
132
+ do {
133
+ bytes /= thresh;
134
+ ++u;
135
+ } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
136
+ return bytes.toFixed(dp) + " " + units[u];
137
+ }
138
+ /**
139
+ * Returns whether a string is a locale ID according to specific ISO standards.
140
+ * See link for details:
141
+ * https://stackoverflow.com/questions/8758340/is-there-a-regex-to-test-if-a-string-is-for-a-locale
142
+ * @param value to test
143
+ * @returns whether the given value is a locale ID
144
+ */
145
+ function isLocale(value) {
146
+ return /^[A-Za-z]{2,4}([_-][A-Za-z]{4})?([_-]([A-Za-z]{2}|[0-9]{3}))?$/.test(value);
147
+ }
148
+ /**
149
+ * Get certain keys from an object. This function preserves the original order of elements.
150
+ * @param object The target object
151
+ * @param keys a list of possible keys to find among the object keys
152
+ * @returns List of keys that are in the object, if no relevant keys found return an empty list
153
+ */
154
+ function filterKeysInObject(object, keys) {
155
+ let objKeys = [];
156
+ if (keys && keys.length > 0) {
157
+ const relevantKeys = Object.keys(object).filter((key) => keys.find((fkey) => fkey === key));
158
+ objKeys = relevantKeys.length > 0 ? relevantKeys : objKeys;
159
+ }
160
+ return objKeys;
161
+ }
162
+ function subStringsPresentInString(original, toCheck) {
163
+ return toCheck.some((item) => original.includes(item));
164
+ }
165
+ function ensureTrailingSlashForUrl(url) {
166
+ if (!url) {
167
+ return undefined;
168
+ }
169
+ if (url.endsWith("/")) {
170
+ return url;
171
+ }
172
+ return `${url}/`;
173
+ }
174
+ function humanReadableDateTimeTillNow(dateTime, nowLabel, time) {
175
+ // WARNING: does not handle locales, consider doing Date arithmetic instead of parsing human-readable date time
176
+ const dateTimeStr = (0, date_fns_1.formatDistanceToNow)(new Date(dateTime), {
177
+ includeSeconds: true /* TODO: , locale */,
178
+ });
179
+ const _nowLabel = nowLabel || dateTimeStr;
180
+ return time && dateTimeStr.includes(time) ? _nowLabel : dateTimeStr;
181
+ }
182
+ function checkFileType(fileName, mimeType) {
183
+ var _a;
184
+ const ext = (fileName === null || fileName === void 0 ? void 0 : fileName.includes(".")) ? (_a = fileName === null || fileName === void 0 ? void 0 : fileName.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : undefined;
185
+ if (!mimeType)
186
+ return ext;
187
+ const type = exports.MIME_TYPES.get(mimeType.split(";")[0] || "");
188
+ if (!ext && type)
189
+ return type;
190
+ // This last check may be unnecessary
191
+ return ext === type ? ext : undefined;
192
+ }
193
+ exports.MIME_TYPES = new Map([
194
+ ["text/html", "html"], // htm shtml
195
+ ["text/css", "css"],
196
+ ["text/xml", "xml"],
197
+ ["image/gif", "gif"],
198
+ ["image/jpeg", "jpg"], // jpeg
199
+ ["application/x-javascript", "js"],
200
+ ["application/atom+xml", "atom"],
201
+ ["application/rss+xml", "rss"],
202
+ ["text/mathml", "mml"],
203
+ ["text/plain", "txt"],
204
+ ["text/vnd.sun.j2me.app-descriptor", "jad"],
205
+ ["text/vnd.wap.wml", "wml"],
206
+ ["text/x-component", "htc"],
207
+ ["image/png", "png"],
208
+ ["image/tiff", "tif"], // tiff
209
+ ["image/vnd.wap.wbmp", "wbmp"],
210
+ ["image/x-icon", "ico"],
211
+ ["image/x-jng", "jng"],
212
+ ["image/x-ms-bmp", "bmp"],
213
+ ["image/svg+xml", "svg"],
214
+ ["image/webp", "webp"],
215
+ ["application/java-archive", "jar"], // war ear
216
+ ["application/mac-binhex40", "hqx"],
217
+ ["application/msword", "doc"],
218
+ ["application/pdf", "pdf"],
219
+ ["application/postscript", "ps"], // eps ai
220
+ ["application/rtf", "rtf"],
221
+ ["application/vnd.ms-excel", "xls"],
222
+ ["application/vnd.ms-powerpoint", "ppt"],
223
+ ["application/vnd.wap.wmlc", "wmlc"],
224
+ ["application/vnd.google-earth.kml+xml", "kml"],
225
+ ["application/vnd.google-earth.kmz", "kmz"],
226
+ ["application/x-7z-compressed", "7z"],
227
+ ["application/x-cocoa", "cco"],
228
+ ["application/x-java-archive-diff", "jardiff"],
229
+ ["application/x-java-jnlp-file", "jnlp"],
230
+ ["application/x-makeself", "run"],
231
+ ["application/x-perl", "pl"], // pm
232
+ ["application/x-pilot", "prc"], // pdb
233
+ ["application/x-rar-compressed", "rar"],
234
+ ["application/x-redhat-package-manager", "rpm"],
235
+ ["application/x-sea", "sea"],
236
+ ["application/x-shockwave-flash", "swf"],
237
+ ["application/x-stuffit", "sit"],
238
+ ["application/x-tcl", "tcl"], // tk
239
+ ["application/x-x509-ca-cert", "pem"], // der crt
240
+ ["application/x-xpinstall", "xpi"],
241
+ ["application/xhtml+xml", "xhtml"],
242
+ ["application/zip", "zip"],
243
+ ["application/octet-stream", "exe"], // bin dll
244
+ /*
245
+ application/octet-stream "deb",
246
+ application/octet-stream "dmg",
247
+ application/octet-stream "eot",
248
+ application/octet-stream "iso", // img
249
+ application/octet-stream "msi", // msp msm
250
+ */
251
+ ["audio/midi", "mid"], // midi kar
252
+ ["audio/mpeg", "mp3"],
253
+ ["audio/ogg", "ogg"],
254
+ ["audio/x-realaudio", "ra"],
255
+ ["video/3gpp", "3gpp"], // 3gp
256
+ ["video/mpeg", "mpeg"], // mpg
257
+ ["video/quicktime", "mov"],
258
+ ["video/x-flv", "flv"],
259
+ ["video/x-mng", "mng"],
260
+ ["video/x-ms-asf", "asf"], // asx
261
+ ["video/x-ms-wmv", "wmv"],
262
+ ["video/x-msvideo", "avi"],
263
+ ["video/mp4", "mp4"], // m4v
264
+ ]);
265
+ function delay(timeInMs, callback) {
266
+ return new Promise((resolve) => setTimeout(() => __awaiter(this, void 0, void 0, function* () {
267
+ yield (callback === null || callback === void 0 ? void 0 : callback());
268
+ resolve === null || resolve === void 0 ? void 0 : resolve();
269
+ }), timeInMs));
270
+ }
271
+ function normalizePath(url) {
272
+ if (!url) {
273
+ return undefined;
274
+ }
275
+ if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("/")) {
276
+ return url;
277
+ }
278
+ if (typeof window === 'undefined') {
279
+ return url;
280
+ }
281
+ // @ts-ignore
282
+ const prefix = ensureTrailingSlashForUrl(window.__PUBLIC_PATH) || "";
283
+ return `${prefix}${url}`;
284
+ }
285
+ function isComponentDefChildren(children) {
286
+ return typeof children !== "string";
287
+ }
288
+ function orderBy(array, ...mappers) {
289
+ return __awaiter(this, void 0, void 0, function* () {
290
+ if (!mappers.length)
291
+ return array;
292
+ // --- Create sort segment information
293
+ let count = 0;
294
+ const segments = [];
295
+ while (count < mappers.length) {
296
+ const mapper = mappers[count];
297
+ let segmentInfo;
298
+ if (typeof mapper === "string") {
299
+ segmentInfo = {
300
+ mapperFn: (item) => item[mapper],
301
+ };
302
+ }
303
+ else if (typeof mapper === "function") {
304
+ segmentInfo = {
305
+ mapperFn: (item) => mapper(item),
306
+ };
307
+ }
308
+ else {
309
+ // --- Skip invalid sort parameter
310
+ count++;
311
+ continue;
312
+ }
313
+ // --- Check if next mapper is a sort order specification
314
+ count++;
315
+ if (count < mappers.length && typeof mappers[count] === "boolean") {
316
+ segmentInfo.desc = true;
317
+ count++;
318
+ }
319
+ // --- Add the new segment
320
+ segments.push(segmentInfo);
321
+ }
322
+ // --- Create maps
323
+ const mappedValues = [];
324
+ for (const segment of segments) {
325
+ const mappedValue = new Map();
326
+ for (let i = 0; i < array.length; i++) {
327
+ mappedValue.set(array[i], yield segment.mapperFn(array[i]));
328
+ }
329
+ mappedValues.push(mappedValue);
330
+ }
331
+ return array.sort((a, b) => {
332
+ for (let i = 0; i < segments.length; i++) {
333
+ const segment = segments[i];
334
+ const fieldA = mappedValues[i].get(a);
335
+ const fieldB = mappedValues[i].get(b);
336
+ if (fieldA === fieldB)
337
+ continue;
338
+ return fieldA < fieldB ? (segment.desc ? 1 : -1) : segment.desc ? -1 : 1;
339
+ }
340
+ return 0;
341
+ });
342
+ });
343
+ }
344
+ const shallowCompare = (obj1, obj2) => {
345
+ return shallowEqual(obj1, obj2);
346
+ };
347
+ exports.shallowCompare = shallowCompare;
348
+ function shallowEqual(a, b) {
349
+ const aIsArr = Array.isArray(a);
350
+ const bIsArr = Array.isArray(b);
351
+ if (aIsArr !== bIsArr) {
352
+ return false;
353
+ }
354
+ if (aIsArr && bIsArr) {
355
+ return shallowEqualArrays(a, b);
356
+ }
357
+ return shallowEqualObjects(a, b);
358
+ }
359
+ function shallowEqualArrays(arrA, arrB) {
360
+ if (arrA === arrB) {
361
+ return true;
362
+ }
363
+ if (!arrA || !arrB) {
364
+ return false;
365
+ }
366
+ const len = arrA.length;
367
+ if (arrB.length !== len) {
368
+ return false;
369
+ }
370
+ for (let i = 0; i < len; i++) {
371
+ if (arrA[i] !== arrB[i]) {
372
+ return false;
373
+ }
374
+ }
375
+ return true;
376
+ }
377
+ function shallowEqualObjects(objA, objB) {
378
+ if (objA === objB) {
379
+ return true;
380
+ }
381
+ if (!objA || !objB) {
382
+ return false;
383
+ }
384
+ const aKeys = Reflect.ownKeys(objA);
385
+ const bKeys = Reflect.ownKeys(objB);
386
+ const len = aKeys.length;
387
+ if (bKeys.length !== len) {
388
+ return false;
389
+ }
390
+ for (let i = 0; i < len; i++) {
391
+ const key = aKeys[i];
392
+ if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
393
+ return false;
394
+ }
395
+ }
396
+ return true;
397
+ }
398
+ const pickFromObject = (object, paths) => {
399
+ const ret = {};
400
+ paths.forEach((path) => {
401
+ if ((0, lodash_es_1.get)(object, path) !== undefined) {
402
+ ret[path] = (0, lodash_es_1.get)(object, path);
403
+ }
404
+ });
405
+ return ret;
406
+ };
407
+ exports.pickFromObject = pickFromObject;
408
+ const isPrimitive = (val) => Object(val) !== val;
409
+ exports.isPrimitive = isPrimitive;
410
+ function groupChildrenByType(node) {
411
+ var _a;
412
+ if (!isComponentDefChildren(node.children)) {
413
+ throw new EngineError_1.NotAComponentDefError();
414
+ }
415
+ const ret = {};
416
+ (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
417
+ if (!ret[child.type]) {
418
+ ret[child.type] = [];
419
+ }
420
+ ret[child.type].push(child);
421
+ });
422
+ return ret;
423
+ }
424
+ function getChildrenByType(node, type) {
425
+ const grouped = groupChildrenByType(node);
426
+ return (grouped[type] || []);
427
+ }
428
+ function formatFileSizeInBytes(size) {
429
+ if (!size)
430
+ return "-";
431
+ return humanFileSize(size);
432
+ }
433
+ function getFileExtension(fileName, mimeType) {
434
+ return checkFileType(fileName, mimeType);
435
+ }
436
+ function pluralize(number, singular, plural) {
437
+ if (number === 1) {
438
+ return `${number} ${singular}`;
439
+ }
440
+ return `${number} ${plural}`;
441
+ }
442
+ // from here: https://github.com/lodash/lodash/issues/4815
443
+ /**
444
+ * Throttles an async function in a way that can be awaited.
445
+ * By default throttle doesn't return a promise for async functions unless it's invoking them immediately. See CUR-4769 for details.
446
+ * @param func async function to throttle calls for.
447
+ * @param wait same function as lodash.throttle's wait parameter.
448
+ * Call this function at most this often.
449
+ * @returns a promise which will be resolved/ rejected only if the function is executed, with the result of the underlying call.
450
+ */
451
+ function asyncThrottle(func, wait, options) {
452
+ const throttled = (0, lodash_es_1.throttle)((resolve, reject, args) => {
453
+ func(...args)
454
+ .then(resolve)
455
+ .catch(reject);
456
+ }, wait, options);
457
+ return (...args) => new Promise((resolve, reject) => {
458
+ throttled(resolve, reject, args);
459
+ });
460
+ }
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.parseHandlerCode = parseHandlerCode;
13
+ exports.prepareHandlerStatements = prepareHandlerStatements;
14
+ exports.runEventHandlerCode = runEventHandlerCode;
15
+ const Parser_1 = require("../../parsers/scripting/Parser");
16
+ const process_statement_async_1 = require("../script-runner/process-statement-async");
17
+ const reportEngineError_1 = require("../reportEngineError");
18
+ const EngineError_1 = require("../EngineError");
19
+ /**
20
+ * Parse the specified source code as event handler code
21
+ * @param source Event handler source code
22
+ */
23
+ function parseHandlerCode(source) {
24
+ // --- Parse the event code
25
+ const wParser = new Parser_1.Parser(source);
26
+ let parsedStatements = null;
27
+ try {
28
+ // --- Invoke the parser
29
+ parsedStatements = wParser.parseStatements();
30
+ }
31
+ catch (err) {
32
+ // --- Parsing error with explicit error code
33
+ if (wParser.errors.length > 0) {
34
+ const err = wParser.errors[0];
35
+ (0, reportEngineError_1.reportEngineError)(new EngineError_1.ScriptParseError(`${err.code}(${err.line}, ${err.column}): ${wParser.errors[0].text}`, source, err.position));
36
+ }
37
+ else {
38
+ throw err;
39
+ }
40
+ }
41
+ // --- Check for the completeness of source code parsing
42
+ if (!wParser.isEof) {
43
+ const tail = wParser.getTail();
44
+ (0, reportEngineError_1.reportEngineError)(new EngineError_1.ScriptParseError(`Invalid tail found`, source, source.length - tail.length + 1));
45
+ }
46
+ // --- Done
47
+ return parsedStatements;
48
+ }
49
+ /**
50
+ * Optionally transform statements in an event handler to an arrow expression statement
51
+ * @param statements Statements to transform
52
+ * @param evalContext Optional event arguments
53
+ */
54
+ function prepareHandlerStatements(statements, evalContext) {
55
+ var _a;
56
+ const stmtLength = (_a = statements === null || statements === void 0 ? void 0 : statements.length) !== null && _a !== void 0 ? _a : 0;
57
+ if (stmtLength === 0) {
58
+ // -- Use a no-op arrow function
59
+ return [
60
+ {
61
+ type: "ArrowS",
62
+ expression: {
63
+ type: "ArrowE",
64
+ args: [],
65
+ statement: {
66
+ type: "EmptyS",
67
+ },
68
+ },
69
+ },
70
+ ];
71
+ }
72
+ if (stmtLength === 1) {
73
+ const stmt = statements[0];
74
+ if (evalContext && stmt.type === "ExprS" && stmt.expression.type === "IdE") {
75
+ // --- A single identifier, it is supposed to be an arrow function
76
+ // --- Create formal arguments
77
+ const formalArgs = evalContext.eventArgs
78
+ ? evalContext.eventArgs.map((_, idx) => ({
79
+ type: "IdE",
80
+ name: `__arg@@#__${idx}__`,
81
+ }))
82
+ : [];
83
+ // --- Add formal argument with current values
84
+ if (evalContext.eventArgs) {
85
+ evalContext.eventArgs.forEach((val, idx) => {
86
+ evalContext.localContext[`__arg@@#__${idx}__`] = val;
87
+ });
88
+ }
89
+ // --- Create the arrow expression
90
+ const arrowExpr = {
91
+ type: "ArrowE",
92
+ args: formalArgs,
93
+ statement: {
94
+ type: "ExprS",
95
+ expression: {
96
+ type: "InvokeE",
97
+ object: stmt.expression,
98
+ arguments: [...formalArgs],
99
+ },
100
+ },
101
+ };
102
+ // --- Use this arrow expression
103
+ return [
104
+ {
105
+ type: "ArrowS",
106
+ expression: arrowExpr,
107
+ },
108
+ ];
109
+ }
110
+ if (stmt.type === "ExprS" && stmt.expression.type === "ArrowE") {
111
+ // --- A single arrow expression
112
+ return [
113
+ {
114
+ type: "ArrowS",
115
+ expression: stmt.expression,
116
+ },
117
+ ];
118
+ }
119
+ if (stmt.type === "ExprS" && stmt.expression.type !== "ArrowE") {
120
+ // --- A single arrow expression
121
+ return [
122
+ {
123
+ type: "ArrowS",
124
+ expression: {
125
+ type: "ArrowE",
126
+ args: [],
127
+ statement: statements[0],
128
+ },
129
+ },
130
+ ];
131
+ }
132
+ if (stmt.type === "RetS") {
133
+ // --- A single arrow expression with a return
134
+ return [
135
+ {
136
+ type: "ArrowS",
137
+ expression: {
138
+ type: "ArrowE",
139
+ args: [],
140
+ statement: {
141
+ type: "BlockS",
142
+ statements: [stmt],
143
+ },
144
+ },
145
+ },
146
+ ];
147
+ }
148
+ if (stmt.type === "BlockS") {
149
+ // --- A single block statement?
150
+ if (stmt.statements[0].type === "ExprS" && stmt.statements[0].expression.type === "ArrowE") {
151
+ // --- A single block statement with a single arrow expression?
152
+ return [
153
+ {
154
+ type: "ArrowS",
155
+ expression: stmt.statements[0].expression,
156
+ },
157
+ ];
158
+ }
159
+ else {
160
+ // --- Consider as a body of a no-arg arrow function
161
+ return [
162
+ {
163
+ type: "ArrowS",
164
+ expression: {
165
+ type: "ArrowE",
166
+ args: [],
167
+ statement: statements[0],
168
+ },
169
+ },
170
+ ];
171
+ }
172
+ }
173
+ }
174
+ if (stmtLength > 1) {
175
+ // --- Use the statements as the body of a no-arg arrow function
176
+ return [
177
+ {
178
+ type: "ArrowS",
179
+ expression: {
180
+ type: "ArrowE",
181
+ args: [],
182
+ statement: {
183
+ type: "BlockS",
184
+ statements,
185
+ },
186
+ },
187
+ },
188
+ ];
189
+ }
190
+ // --- Nothing to transform
191
+ return statements;
192
+ }
193
+ /**
194
+ * Runs the specified event handler code
195
+ * @param source Event handler source code
196
+ * @param evalContext Evaluation context to use
197
+ * @param thread Logical thread to use
198
+ * @param onStatementCompleted Callback for statement completion
199
+ */
200
+ function runEventHandlerCode(source, evalContext, thread, onStatementCompleted) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ const statements = prepareHandlerStatements(parseHandlerCode(source));
203
+ return yield (0, process_statement_async_1.processStatementQueueAsync)(statements, evalContext, thread, onStatementCompleted);
204
+ });
205
+ }