xmlui 0.7.13 → 0.7.15

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 (392) hide show
  1. package/dist/{apiInterceptorWorker-BuZoKCP8.mjs → apiInterceptorWorker-yKpXImCG.mjs} +1 -1
  2. package/dist/{index-C8kHu1Bs.mjs → index-XNGGyvQ0.mjs} +9904 -9653
  3. package/dist/index.css +1 -1
  4. package/dist/scripts/bin/build.js +17 -7
  5. package/dist/scripts/bin/vite-ueml-plugin.js +17 -7
  6. package/dist/scripts/bin/viteConfig.js +17 -7
  7. package/dist/scripts/package.json +209 -0
  8. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +51 -0
  9. package/dist/scripts/src/components/APICall/APICall.js +74 -0
  10. package/dist/scripts/src/components/APICall/APICallNative.js +31 -0
  11. package/dist/scripts/src/components/Accordion/Accordion.js +78 -0
  12. package/dist/scripts/src/components/Accordion/AccordionContext.js +20 -0
  13. package/dist/scripts/src/components/Accordion/AccordionItem.js +28 -0
  14. package/dist/scripts/src/components/Accordion/AccordionItemNative.js +79 -0
  15. package/dist/scripts/src/components/Accordion/AccordionNative.js +122 -0
  16. package/dist/scripts/src/components/Alert/Alert.js +42 -0
  17. package/dist/scripts/src/components/Alert/AlertNative.js +8 -0
  18. package/dist/scripts/src/components/Animation/Animation.js +59 -0
  19. package/dist/scripts/src/components/Animation/AnimationNative.js +75 -0
  20. package/dist/scripts/src/components/App/App.js +76 -0
  21. package/dist/scripts/src/components/App/AppLayoutContext.js +49 -0
  22. package/dist/scripts/src/components/App/AppNative.js +204 -0
  23. package/dist/scripts/src/components/App/AppStateContext.js +9 -0
  24. package/dist/scripts/src/components/App/Sheet.js +99 -0
  25. package/dist/scripts/src/components/AppHeader/AppHeader.js +59 -0
  26. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +58 -0
  27. package/dist/scripts/src/components/AppState/AppState.js +26 -0
  28. package/dist/scripts/src/components/AppState/AppStateNative.js +24 -0
  29. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +83 -0
  30. package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +16 -0
  31. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +225 -0
  32. package/dist/scripts/src/components/Avatar/Avatar.js +47 -0
  33. package/dist/scripts/src/components/Avatar/AvatarNative.js +40 -0
  34. package/dist/scripts/src/components/Backdrop/Backdrop.js +31 -0
  35. package/dist/scripts/src/components/Backdrop/BackdropNative.js +14 -0
  36. package/dist/scripts/src/components/Badge/Badge.js +58 -0
  37. package/dist/scripts/src/components/Badge/BadgeNative.js +22 -0
  38. package/dist/scripts/src/components/BarChart/BarChart.js +49 -0
  39. package/dist/scripts/src/components/BarChart/BarChartNative.js +176 -0
  40. package/dist/scripts/src/components/Bookmark/Bookmark.js +23 -0
  41. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +24 -0
  42. package/dist/scripts/src/components/Breakout/Breakout.js +16 -0
  43. package/dist/scripts/src/components/Breakout/BreakoutNative.js +12 -0
  44. package/dist/scripts/src/components/Button/Button.js +142 -0
  45. package/dist/scripts/src/components/Button/ButtonNative.js +88 -0
  46. package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +41 -0
  47. package/dist/scripts/src/components/ButtonGroup/ButtonGroupNative.js +8 -0
  48. package/dist/scripts/src/components/Card/Card.js +57 -0
  49. package/dist/scripts/src/components/Card/CardNative.js +26 -0
  50. package/dist/scripts/src/components/Carousel/Carousel.js +68 -0
  51. package/dist/scripts/src/components/Carousel/CarouselItem.js +16 -0
  52. package/dist/scripts/src/components/Carousel/CarouselItemNative.js +13 -0
  53. package/dist/scripts/src/components/Carousel/CarouselNative.js +163 -0
  54. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +24 -0
  55. package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +26 -0
  56. package/dist/scripts/src/components/Chart/Chart.js +24 -0
  57. package/dist/scripts/src/components/Chart/ChartNative.js +165 -0
  58. package/dist/scripts/src/components/Checkbox/Checkbox.js +68 -0
  59. package/dist/scripts/src/components/Column/Column.js +34 -0
  60. package/dist/scripts/src/components/Column/ColumnNative.js +38 -0
  61. package/dist/scripts/src/components/Column/TableContext.js +12 -0
  62. package/dist/scripts/src/components/ComponentProvider.js +503 -0
  63. package/dist/scripts/src/components/ComponentRegistryContext.js +44 -0
  64. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +38 -0
  65. package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +16 -0
  66. package/dist/scripts/src/components/DatePicker/DatePicker.js +62 -0
  67. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +196 -0
  68. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +125 -0
  69. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +95 -0
  70. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +26 -0
  71. package/dist/scripts/src/components/EmojiSelector/EmojiSelectorNative.js +52 -0
  72. package/dist/scripts/src/components/FileInput/FileInput.js +64 -0
  73. package/dist/scripts/src/components/FileInput/FileInputNative.js +128 -0
  74. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +46 -0
  75. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +112 -0
  76. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +53 -0
  77. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +108 -0
  78. package/dist/scripts/src/components/Footer/Footer.js +35 -0
  79. package/dist/scripts/src/components/Footer/FooterNative.js +20 -0
  80. package/dist/scripts/src/components/Form/Form.js +89 -0
  81. package/dist/scripts/src/components/Form/FormContext.js +9 -0
  82. package/dist/scripts/src/components/Form/FormNative.js +317 -0
  83. package/dist/scripts/src/components/Form/formActions.js +114 -0
  84. package/dist/scripts/src/components/FormItem/FormItem.js +125 -0
  85. package/dist/scripts/src/components/FormItem/FormItemNative.js +157 -0
  86. package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
  87. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +40 -0
  88. package/dist/scripts/src/components/FormItem/Validations.js +351 -0
  89. package/dist/scripts/src/components/FormSection/FormSection.js +41 -0
  90. package/dist/scripts/src/components/Heading/Heading.js +258 -0
  91. package/dist/scripts/src/components/Heading/HeadingNative.js +45 -0
  92. package/dist/scripts/src/components/HoverCard/HoverCard.js +19 -0
  93. package/dist/scripts/src/components/HoverCard/HovercardNative.js +44 -0
  94. package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
  95. package/dist/scripts/src/components/Icon/Attach.js +10 -0
  96. package/dist/scripts/src/components/Icon/Binding.js +11 -0
  97. package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
  98. package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
  99. package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
  100. package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
  101. package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
  102. package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
  103. package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
  104. package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
  105. package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
  106. package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
  107. package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
  108. package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
  109. package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
  110. package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
  111. package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
  112. package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
  113. package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
  114. package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
  115. package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
  116. package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
  117. package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
  118. package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
  119. package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
  120. package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
  121. package/dist/scripts/src/components/Icon/Icon.js +32 -0
  122. package/dist/scripts/src/components/Icon/IconNative.js +102 -0
  123. package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
  124. package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
  125. package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
  126. package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
  127. package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
  128. package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
  129. package/dist/scripts/src/components/Icon/NoSortIcon.js +8 -0
  130. package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
  131. package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
  132. package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
  133. package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
  134. package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
  135. package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
  136. package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
  137. package/dist/scripts/src/components/Icon/SortAscendingIcon.js +8 -0
  138. package/dist/scripts/src/components/Icon/SortDescendingIcon.js +8 -0
  139. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  140. package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
  141. package/dist/scripts/src/components/Icon/TrendingDownIcon.js +10 -0
  142. package/dist/scripts/src/components/Icon/TrendingLevelIcon.js +10 -0
  143. package/dist/scripts/src/components/Icon/TrendingUpIcon.js +10 -0
  144. package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
  145. package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
  146. package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
  147. package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
  148. package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
  149. package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
  150. package/dist/scripts/src/components/IconInfoCard/IconInfoCard.js +39 -0
  151. package/dist/scripts/src/components/IconProvider.js +264 -0
  152. package/dist/scripts/src/components/IconRegistryContext.js +317 -0
  153. package/dist/scripts/src/components/Image/Image.js +35 -0
  154. package/dist/scripts/src/components/Image/ImageNative.js +15 -0
  155. package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
  156. package/dist/scripts/src/components/Items/Items.js +33 -0
  157. package/dist/scripts/src/components/Items/ItemsNative.js +29 -0
  158. package/dist/scripts/src/components/Link/Link.js +64 -0
  159. package/dist/scripts/src/components/Link/LinkNative.js +26 -0
  160. package/dist/scripts/src/components/List/List.js +81 -0
  161. package/dist/scripts/src/components/List/ListNative.js +425 -0
  162. package/dist/scripts/src/components/Logo/Logo.js +16 -0
  163. package/dist/scripts/src/components/Logo/LogoNative.js +15 -0
  164. package/dist/scripts/src/components/Map/Map.js +75 -0
  165. package/dist/scripts/src/components/Map/world_countries.json +45307 -0
  166. package/dist/scripts/src/components/Markdown/Markdown.js +45 -0
  167. package/dist/scripts/src/components/Markdown/MarkdownNative.js +107 -0
  168. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
  169. package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
  170. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +64 -0
  171. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +167 -0
  172. package/dist/scripts/src/components/ModalDialog/ModalVisibilityContext.js +60 -0
  173. package/dist/scripts/src/components/NavGroup/NavGroup.js +34 -0
  174. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +91 -0
  175. package/dist/scripts/src/components/NavLink/NavLink.js +71 -0
  176. package/dist/scripts/src/components/NavLink/NavLinkNative.js +61 -0
  177. package/dist/scripts/src/components/NavPanel/NavPanel.js +31 -0
  178. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +74 -0
  179. package/dist/scripts/src/components/NoResult/NoResult.js +38 -0
  180. package/dist/scripts/src/components/NoResult/NoResultNative.js +13 -0
  181. package/dist/scripts/src/components/NumberBox/NumberBox.js +61 -0
  182. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +337 -0
  183. package/dist/scripts/src/components/NumberBox/numberbox-abstractions.js +74 -0
  184. package/dist/scripts/src/components/OffCanvas/OffCanvas.js +57 -0
  185. package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +48 -0
  186. package/dist/scripts/src/components/Option/Option.js +33 -0
  187. package/dist/scripts/src/components/Option/OptionTypeProvider.js +16 -0
  188. package/dist/scripts/src/components/PageHeader/PageHeader.js +36 -0
  189. package/dist/scripts/src/components/PageMetaTitle/PageMetaTilteNative.js +9 -0
  190. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +18 -0
  191. package/dist/scripts/src/components/Pages/Pages.js +33 -0
  192. package/dist/scripts/src/components/Pages/PagesNative.js +69 -0
  193. package/dist/scripts/src/components/PieChart/PieChart.js +45 -0
  194. package/dist/scripts/src/components/PieChart/PieChartNative.js +165 -0
  195. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +24 -0
  196. package/dist/scripts/src/components/PositionedContainer/PositionedContainerNative.js +14 -0
  197. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +36 -0
  198. package/dist/scripts/src/components/ProgressBar/ProgressBarNative.js +12 -0
  199. package/dist/scripts/src/components/Queue/Queue.js +71 -0
  200. package/dist/scripts/src/components/Queue/QueueNative.js +278 -0
  201. package/dist/scripts/src/components/Queue/queueActions.js +87 -0
  202. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +68 -0
  203. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +104 -0
  204. package/dist/scripts/src/components/Range/Range.js +56 -0
  205. package/dist/scripts/src/components/Range/RangeNative.js +8 -0
  206. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +21 -0
  207. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +131 -0
  208. package/dist/scripts/src/components/Redirect/Redirect.js +20 -0
  209. package/dist/scripts/src/components/Select/OptionContext.js +12 -0
  210. package/dist/scripts/src/components/Select/Select.js +98 -0
  211. package/dist/scripts/src/components/Select/SelectContext.js +9 -0
  212. package/dist/scripts/src/components/Select/SelectNative.js +214 -0
  213. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +22 -0
  214. package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +94 -0
  215. package/dist/scripts/src/components/Slider/Slider.js +54 -0
  216. package/dist/scripts/src/components/Slider/SliderNative.js +8 -0
  217. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +19 -0
  218. package/dist/scripts/src/components/SpaceFiller/SpaceFillerNative.js +10 -0
  219. package/dist/scripts/src/components/Spinner/Spinner.js +42 -0
  220. package/dist/scripts/src/components/Spinner/SpinnerNative.js +31 -0
  221. package/dist/scripts/src/components/Splitter/Splitter.js +89 -0
  222. package/dist/scripts/src/components/Splitter/SplitterNative.js +159 -0
  223. package/dist/scripts/src/components/Splitter/utils.js +17 -0
  224. package/dist/scripts/src/components/Stack/Stack.js +110 -0
  225. package/dist/scripts/src/components/Stack/StackNative.js +39 -0
  226. package/dist/scripts/src/components/StateViewer/StateViewerNative.js +19 -0
  227. package/dist/scripts/src/components/StickyBox/StickyBox.js +30 -0
  228. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +15 -0
  229. package/dist/scripts/src/components/Switch/Switch.js +72 -0
  230. package/dist/scripts/src/components/Table/Table.js +184 -0
  231. package/dist/scripts/src/components/Table/TableNative.js +470 -0
  232. package/dist/scripts/src/components/Table/useRowSelection.js +245 -0
  233. package/dist/scripts/src/components/TableHeader/TableHeader.js +34 -0
  234. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +74 -0
  235. package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +55 -0
  236. package/dist/scripts/src/components/Tabs/TabContext.js +45 -0
  237. package/dist/scripts/src/components/Tabs/TabItem.js +20 -0
  238. package/dist/scripts/src/components/Tabs/TabItemNative.js +24 -0
  239. package/dist/scripts/src/components/Tabs/Tabs.js +55 -0
  240. package/dist/scripts/src/components/Tabs/TabsNative.js +72 -0
  241. package/dist/scripts/src/components/Text/Text.js +122 -0
  242. package/dist/scripts/src/components/Text/TextNative.js +124 -0
  243. package/dist/scripts/src/components/TextArea/TextArea.js +65 -0
  244. package/dist/scripts/src/components/TextArea/TextAreaNative.js +176 -0
  245. package/dist/scripts/src/components/TextArea/TextAreaResizable.js +73 -0
  246. package/dist/scripts/src/components/TextArea/useComposedRef.js +60 -0
  247. package/dist/scripts/src/components/TextBox/TextBox.js +85 -0
  248. package/dist/scripts/src/components/TextBox/TextBoxNative.js +109 -0
  249. package/dist/scripts/src/components/Theme/NotificationToast.js +50 -0
  250. package/dist/scripts/src/components/Theme/Theme.js +43 -0
  251. package/dist/scripts/src/components/Theme/ThemeNative.js +126 -0
  252. package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +115 -0
  253. package/dist/scripts/src/components/ThemeChanger/ToneChangerButton.js +28 -0
  254. package/dist/scripts/src/components/Toggle/Toggle.js +99 -0
  255. package/dist/scripts/src/components/Toolbar/Toolbar.js +32 -0
  256. package/dist/scripts/src/components/ToolbarButton/ToolbarButton.js +38 -0
  257. package/dist/scripts/src/components/Tree/TreeComponent.js +32 -0
  258. package/dist/scripts/src/components/Tree/TreeNative.js +69 -0
  259. package/dist/scripts/src/components/TrendLabel/TrendLabel.js +37 -0
  260. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
  261. package/dist/scripts/src/components/abstractions.js +151 -0
  262. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  263. package/dist/scripts/src/components/component-utils.js +17 -0
  264. package/dist/scripts/src/components/container-helpers.js +25 -0
  265. package/dist/scripts/src/components/metadata-helpers.js +245 -0
  266. package/dist/scripts/src/components/slot-helpers.js +22 -0
  267. package/dist/scripts/src/components-core/ApiBoundComponent.js +194 -0
  268. package/dist/scripts/src/components-core/AppContext.js +16 -0
  269. package/dist/scripts/src/components-core/AppRoot.js +424 -0
  270. package/dist/scripts/src/components-core/ComponentBed.js +325 -0
  271. package/dist/scripts/src/components-core/ComponentDecorator.js +90 -0
  272. package/dist/scripts/src/components-core/CompoundComponent.js +144 -0
  273. package/dist/scripts/src/components-core/DebugViewProvider.js +43 -0
  274. package/dist/scripts/src/components-core/EngineError.js +91 -0
  275. package/dist/scripts/src/components-core/ErrorBoundary.js +59 -0
  276. package/dist/scripts/src/components-core/Fragment.js +15 -0
  277. package/dist/scripts/src/components-core/InspectorContext.js +176 -0
  278. package/dist/scripts/src/components-core/InvalidComponent.js +17 -0
  279. package/dist/scripts/src/components-core/LoaderComponent.js +92 -0
  280. package/dist/scripts/src/components-core/RestApiProxy.js +354 -0
  281. package/dist/scripts/src/components-core/ScrollContext.js +11 -0
  282. package/dist/scripts/src/components-core/Slot.js +17 -0
  283. package/dist/scripts/src/components-core/StandaloneApp.js +589 -0
  284. package/dist/scripts/src/components-core/StandaloneComponentManager.js +51 -0
  285. package/dist/scripts/src/components-core/TableOfContentsContext.js +110 -0
  286. package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
  287. package/dist/scripts/src/components-core/XmluiCodeHighlighter.js +110 -0
  288. package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
  289. package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
  290. package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
  291. package/dist/scripts/src/components-core/abstractions/standalone.js +2 -0
  292. package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
  293. package/dist/scripts/src/components-core/action/APICall.js +283 -0
  294. package/dist/scripts/src/components-core/action/FileDownloadAction.js +80 -0
  295. package/dist/scripts/src/components-core/action/FileUploadAction.js +88 -0
  296. package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
  297. package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
  298. package/dist/scripts/src/components-core/action/actions.js +15 -0
  299. package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
  300. package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
  301. package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
  302. package/dist/scripts/src/components-core/component-hooks.js +25 -0
  303. package/dist/scripts/src/components-core/constants.js +18 -0
  304. package/dist/scripts/src/components-core/container/Container.js +1241 -0
  305. package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
  306. package/dist/scripts/src/components-core/container/collectFnVarDeps.js +49 -0
  307. package/dist/scripts/src/components-core/container/valueExtractor.js +205 -0
  308. package/dist/scripts/src/components-core/descriptorHelper.js +72 -0
  309. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +198 -0
  310. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
  311. package/dist/scripts/src/components-core/interception/Backend.js +129 -0
  312. package/dist/scripts/src/components-core/interception/Errors.js +129 -0
  313. package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
  314. package/dist/scripts/src/components-core/interception/IndexedDb.js +205 -0
  315. package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
  316. package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
  317. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
  318. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
  319. package/dist/scripts/src/components-core/loader/ApiLoader.js +54 -0
  320. package/dist/scripts/src/components-core/loader/DataLoader.js +149 -0
  321. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +62 -0
  322. package/dist/scripts/src/components-core/loader/Loader.js +126 -0
  323. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +40 -0
  324. package/dist/scripts/src/components-core/loader/PageableLoader.js +262 -0
  325. package/dist/scripts/src/components-core/markup-check.js +279 -0
  326. package/dist/scripts/src/components-core/renderers.js +45 -0
  327. package/dist/scripts/src/components-core/reportEngineError.js +62 -0
  328. package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
  329. package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
  330. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
  331. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +149 -0
  332. package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
  333. package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
  334. package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
  335. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +593 -0
  336. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +497 -0
  337. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +482 -0
  338. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +766 -0
  339. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
  340. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +752 -0
  341. package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
  342. package/dist/scripts/src/components-core/script-runner/syncProxy.js +31 -0
  343. package/dist/scripts/src/components-core/script-runner/visitors.js +361 -0
  344. package/dist/scripts/src/components-core/theming/ThemeContext.js +53 -0
  345. package/dist/scripts/src/components-core/theming/ThemeProvider.js +335 -0
  346. package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
  347. package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
  348. package/dist/scripts/src/components-core/theming/hvar.js +105 -0
  349. package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
  350. package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
  351. package/dist/scripts/src/components-core/theming/themes/palette.js +55 -0
  352. package/dist/scripts/src/components-core/theming/themes/root.js +287 -0
  353. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  354. package/dist/scripts/src/components-core/theming/themes/theme-colors.js +561 -0
  355. package/dist/scripts/src/components-core/theming/themes/xmlui.js +58 -0
  356. package/dist/scripts/src/components-core/theming/transformThemeVars.js +300 -0
  357. package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +35 -0
  358. package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
  359. package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
  360. package/dist/scripts/src/components-core/utils/classnames.js +58 -0
  361. package/dist/scripts/src/components-core/utils/compound-utils.js +11 -0
  362. package/dist/scripts/src/components-core/utils/css-utils.js +163 -0
  363. package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
  364. package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
  365. package/dist/scripts/src/components-core/utils/hooks.js +249 -0
  366. package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
  367. package/dist/scripts/src/components-core/utils/misc.js +472 -0
  368. package/dist/scripts/src/components-core/utils/request-params.js +70 -0
  369. package/dist/scripts/src/components-core/utils/statementUtils.js +221 -0
  370. package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
  371. package/dist/scripts/src/index.js +69 -0
  372. package/dist/scripts/src/parsers/common/GenericToken.js +2 -0
  373. package/dist/scripts/src/parsers/scripting-exp/TokenType.js +112 -0
  374. package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
  375. package/dist/scripts/src/parsers/style-parser/StyleLexer.js +623 -0
  376. package/dist/scripts/src/parsers/style-parser/StyleParser.js +1036 -0
  377. package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
  378. package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
  379. package/dist/scripts/src/parsers/style-parser/style-compiler.js +558 -0
  380. package/dist/scripts/src/parsers/style-parser/tokens.js +43 -0
  381. package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +7 -0
  382. package/dist/scripts/src/parsers/xmlui-parser/transform.js +80 -32
  383. package/dist/scripts/src/syntax/grammar.tmLanguage.json +328 -0
  384. package/dist/scripts/src/syntax/textMate/xmlui.json +630 -0
  385. package/dist/style.css +1 -1
  386. package/dist/xmlui-metadata.mjs +2676 -2608
  387. package/dist/xmlui-metadata.umd.js +16 -16
  388. package/dist/xmlui-standalone.umd.js +186 -186
  389. package/dist/xmlui.d.ts +1868 -13
  390. package/dist/xmlui.mjs +1 -1
  391. package/package.json +5 -5
  392. package/dist/xmlui.umd.js +0 -293
@@ -0,0 +1,589 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.startApp = startApp;
16
+ const jsx_runtime_1 = require("react/jsx-runtime");
17
+ const react_1 = require("react");
18
+ const client_1 = __importDefault(require("react-dom/client"));
19
+ require("../index.scss");
20
+ const AppRoot_1 = __importDefault(require("@components-core/AppRoot"));
21
+ const misc_1 = require("@components-core/utils/misc");
22
+ const ApiInterceptorProvider_1 = require("@components-core/interception/ApiInterceptorProvider");
23
+ const constants_1 = require("@components-core/constants");
24
+ const xmlui_parser_1 = require("@components-core/xmlui-parser");
25
+ const hooks_1 = require("./utils/hooks");
26
+ const fileExtensions_1 = require("../parsers/xmlui-parser/fileExtensions");
27
+ const Parser_1 = require("../parsers/scripting/Parser");
28
+ const code_behind_collect_1 = require("../parsers/scripting/code-behind-collect");
29
+ const ComponentProvider_1 = require("@components/ComponentProvider");
30
+ const markup_check_1 = require("@components-core/markup-check");
31
+ const ThemeProvider_1 = require("@components-core/theming/ThemeProvider");
32
+ const MAIN_FILE = "Main." + fileExtensions_1.componentFileExtension;
33
+ const MAIN_CODE_BEHIND_FILE = "Main." + fileExtensions_1.codeBehindFileExtension;
34
+ const CONFIG_FILE = "config.json";
35
+ /**
36
+ * This React component represents a standalone app that implements a web
37
+ * application with xmlui components. A StandaloneApp instance uses a
38
+ * AppRoot wrapped into an ApiInterceptor.
39
+ *
40
+ * AppRoot is responsible for rendering the app (using an internal
41
+ * representation); ApiInterceptor can emulate some backend functionality
42
+ * running in the browser.
43
+ */
44
+ function StandaloneApp({ appDef, decorateComponentsWithTestId, debugEnabled = false, runtime, components: customComponents, componentManager, }) {
45
+ var _a;
46
+ const servedFromSingleFile = (0, react_1.useMemo)(() => {
47
+ return typeof window !== "undefined" && window.location.href.startsWith("file");
48
+ }, []);
49
+ // --- Fetch all files constituting the standalone app, including components,
50
+ // --- themes, and other artifacts. Display the app version numbers in the
51
+ // --- console.
52
+ const standaloneApp = useStandalone(appDef, runtime, componentManager);
53
+ usePrintVersionNumber(standaloneApp);
54
+ if (!standaloneApp) {
55
+ // --- Problems found, the standalone app cannot run
56
+ return null;
57
+ }
58
+ const { apiInterceptor, name, appGlobals, defaultTheme, defaultTone, resources, resourceMap, entryPoint, components, themes, sources, } = standaloneApp;
59
+ // --- The app may use a mocked API already defined in `window.XMLUI_MOCK_API`
60
+ // --- or within the standalone app's definition, in `apiInterceptor`.
61
+ const mockedApi =
62
+ // @ts-ignore
63
+ typeof window !== "undefined" && window.XMLUI_MOCK_API ? window.XMLUI_MOCK_API : apiInterceptor;
64
+ // --- Components can be decorated with test IDs used in end-to-end tests.
65
+ // --- This flag checks the environment if the app runs in E2E test mode.
66
+ const shouldDecorateWithTestId = decorateComponentsWithTestId ||
67
+ // @ts-ignore
68
+ (typeof window !== "undefined" ? window.XMLUI_MOCK_TEST_ID : false);
69
+ // --- An app can turn off the default hash routing.
70
+ const useHashBasedRouting = (_a = appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) !== null && _a !== void 0 ? _a : true;
71
+ return ((0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mockedApi, useHashBasedRouting: useHashBasedRouting, children: (0, jsx_runtime_1.jsx)(AppRoot_1.default, { servedFromSingleFile: servedFromSingleFile, decorateComponentsWithTestId: shouldDecorateWithTestId, node: entryPoint, standalone: true, debugEnabled: debugEnabled,
72
+ // @ts-ignore
73
+ routerBaseName: typeof window !== "undefined" ? window.__PUBLIC_PATH || "" : "", globalProps: Object.assign({ name: name }, (appGlobals || {})), defaultTheme: defaultTheme, defaultTone: defaultTone, resources: resources, resourceMap: resourceMap, sources: sources, componentManager: componentManager, contributes: {
74
+ compoundComponents: components,
75
+ components: customComponents,
76
+ themes,
77
+ } }) }));
78
+ }
79
+ /**
80
+ * This function parses the response of a fetch retrieving the contents of a
81
+ * component markup file.
82
+ * @param response The response coming from the fetch
83
+ * @returns If parsing is successful, it returns the parsed response containing
84
+ * the component definition. Otherwise, it returns a component definition that
85
+ * displays the errors.
86
+ */
87
+ function parseComponentMarkupResponse(response) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ if (!response.ok) {
90
+ throw new Error(`Failed to fetch ${response.url}`);
91
+ }
92
+ const code = yield response.text();
93
+ const fileId = response.url;
94
+ let { component, errors, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(code, fileId);
95
+ if (errors.length > 0) {
96
+ const compName = erroneousCompoundComponentName !== null && erroneousCompoundComponentName !== void 0 ? erroneousCompoundComponentName : response.url.substring(response.url.lastIndexOf("/") + 1, response.url.length - ".xmlui".length);
97
+ component = (0, xmlui_parser_1.errReportComponent)(errors, fileId, compName);
98
+ }
99
+ return {
100
+ component,
101
+ src: code,
102
+ file: fileId,
103
+ hasError: errors.length > 0,
104
+ };
105
+ });
106
+ }
107
+ /**
108
+ * This function parses the response of a fetch retrieving the contents of a
109
+ * code-behind file.
110
+ * @param response The response coming from the fetch
111
+ * @returns If parsing is successful, it returns the parsed response containing
112
+ * the code-behind declarations. Otherwise, it returns a component definition that
113
+ * displays the errors.
114
+ */
115
+ function parseCodeBehindResponse(response) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ var _a;
118
+ if (!response.ok) {
119
+ throw new Error(`Failed to fetch ${response.url}`);
120
+ }
121
+ const code = yield response.text();
122
+ const parser = new Parser_1.Parser(code);
123
+ try {
124
+ parser.parseStatements();
125
+ }
126
+ catch (e) {
127
+ if (parser.errors.length > 0) {
128
+ return {
129
+ component: (0, xmlui_parser_1.errReportScriptError)(parser.errors[0], response.url),
130
+ file: response.url,
131
+ hasError: true,
132
+ };
133
+ }
134
+ }
135
+ const codeBehind = (0, code_behind_collect_1.collectCodeBehindFromSource)("Main", code, () => {
136
+ return "";
137
+ }, (a) => a);
138
+ if (Object.keys((_a = codeBehind.moduleErrors) !== null && _a !== void 0 ? _a : {}).length > 0) {
139
+ return {
140
+ component: (0, xmlui_parser_1.errReportModuleErrors)(codeBehind.moduleErrors, response.url),
141
+ file: response.url,
142
+ hasError: true,
143
+ };
144
+ }
145
+ // --- Remove the code-behind tokens from the tree shrinking the tree
146
+ (0, code_behind_collect_1.removeCodeBehindTokensFromTree)(codeBehind);
147
+ return {
148
+ codeBehind: codeBehind,
149
+ file: response.url,
150
+ };
151
+ });
152
+ }
153
+ // --- Tests is the given path matches the speified file name
154
+ function matchesFileName(path, fileName) {
155
+ return (path.endsWith(`/${fileName}.ts`) ||
156
+ path.endsWith(`/${fileName}.js`) ||
157
+ path.endsWith(`/${fileName}.${fileExtensions_1.componentFileExtension}`) ||
158
+ path.endsWith(`/${fileName}.${fileExtensions_1.codeBehindFileExtension}`));
159
+ }
160
+ // --- Tests if the given path contains the specified folder
161
+ function matchesFolder(path, folderName) {
162
+ return path.includes(`/${folderName}/`);
163
+ }
164
+ /**
165
+ * This function turns a collection of runtime file declarations into a standalone
166
+ * app description.
167
+ * @param runtime A hash object containing the runtime files. The keys are the file
168
+ * paths and the values are the file contents.
169
+ * @returns The standalone app description.
170
+ *
171
+ * When the standalone app is pre-compiled, each property in `runtime` holds such a
172
+ * pre-compiled item. Otherwise, `runtime` is an empty object.
173
+ *
174
+ * While processing the files here, we can assume they are free from compilation
175
+ * errors, as such errors would be observed in the compile phase.
176
+ */
177
+ function resolveRuntime(runtime) {
178
+ // --- Collect the components and their sources. We pass the sources to the standalone app
179
+ // --- so that it can be used for error display and debugging purposes.
180
+ const sources = {};
181
+ const componentsByFileName = {};
182
+ const codeBehindsByFileName = {};
183
+ const themes = [];
184
+ // --- Some working variables
185
+ let config;
186
+ let entryPoint;
187
+ let entryPointCodeBehind;
188
+ let apiInterceptor;
189
+ // --- Process the runtime files
190
+ for (const [key, value] of Object.entries(runtime)) {
191
+ if (matchesFileName(key, "config")) {
192
+ // --- We assume that the config file has a default export and this
193
+ // --- export is the standalone app's configuration.
194
+ config = value.default;
195
+ }
196
+ // --- We assume that the entry point is either named "Main" or "App".
197
+ if (matchesFileName(key, "Main") || matchesFileName(key, "App")) {
198
+ if (key.endsWith(fileExtensions_1.codeBehindFileExtension)) {
199
+ // --- "default" contains the functions and variables declared in the
200
+ // --- code behind file.
201
+ entryPointCodeBehind = value.default;
202
+ }
203
+ else {
204
+ // --- "default" contains the component definition, the file index,
205
+ // --- and the source code.
206
+ entryPoint = value.default.component;
207
+ if (value.default.file) {
208
+ sources[value.default.file] = value.default.src;
209
+ }
210
+ }
211
+ }
212
+ // --- Use API emulation if available
213
+ if (matchesFileName(key, "api")) {
214
+ apiInterceptor = value.default;
215
+ }
216
+ // --- Collect the components and their code behinds
217
+ if (matchesFolder(key, "components")) {
218
+ if (key.endsWith(`.${fileExtensions_1.codeBehindFileExtension}`)) {
219
+ // --- "default" contains the functions and variables declared in the
220
+ // --- component's code behind file.
221
+ codeBehindsByFileName[key] = value.default;
222
+ }
223
+ else {
224
+ // --- "default" contains the component definition, the file index,
225
+ // --- and the source code.
226
+ componentsByFileName[key] = value.default.component;
227
+ sources[value.default.file] = value.default.src;
228
+ }
229
+ }
230
+ // --- Collect the themes declared with the app
231
+ if (matchesFolder(key, "themes")) {
232
+ themes.push(value.default);
233
+ }
234
+ }
235
+ // --- We have an entry point defined in the configuration file or in the main app file.
236
+ const safeEntryPoint = (config === null || config === void 0 ? void 0 : config.entryPoint) || entryPoint;
237
+ // --- We may have a code-behind file. If so, we merge the variables and functions
238
+ const entryPointWithCodeBehind = Object.assign(Object.assign({}, safeEntryPoint), { vars: Object.assign(Object.assign({}, entryPointCodeBehind === null || entryPointCodeBehind === void 0 ? void 0 : entryPointCodeBehind.vars), safeEntryPoint === null || safeEntryPoint === void 0 ? void 0 : safeEntryPoint.vars), functions: entryPointCodeBehind === null || entryPointCodeBehind === void 0 ? void 0 : entryPointCodeBehind.functions, scriptError: entryPointCodeBehind === null || entryPointCodeBehind === void 0 ? void 0 : entryPointCodeBehind.moduleErrors });
239
+ // --- Collect the component definition we pass to the rendering engine
240
+ let components = [];
241
+ if (config === null || config === void 0 ? void 0 : config.components) {
242
+ // --- We have a list of components defined in the configuration file
243
+ components = config.components;
244
+ }
245
+ else {
246
+ // --- Use the components collected from the runtime files; merge the components
247
+ // --- with their code behinds
248
+ Object.entries(componentsByFileName).forEach(([key, compound]) => {
249
+ const componentCodeBehind = codeBehindsByFileName[`${key}.xs`];
250
+ const componentWithCodeBehind = Object.assign(Object.assign({}, compound), { component: Object.assign(Object.assign({}, compound.component), { vars: Object.assign(Object.assign({}, compound.component.vars), componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.vars), functions: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.functions, scriptError: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.moduleErrors }) });
251
+ components.push(componentWithCodeBehind);
252
+ });
253
+ }
254
+ // --- Done.
255
+ return Object.assign(Object.assign({}, config), { entryPoint: entryPointWithCodeBehind, components, themes: (config === null || config === void 0 ? void 0 : config.themes) || themes, apiInterceptor: (config === null || config === void 0 ? void 0 : config.apiInterceptor) || apiInterceptor, sources });
256
+ }
257
+ /**
258
+ * Merges app definitions
259
+ * @param resolvedRuntime Standalone app definition coming from the resolved runtime
260
+ * @param standaloneAppDef Standalode app definition coming from the source
261
+ * @returns Merged standalone app definition
262
+ */
263
+ function mergeAppDefWithRuntime(resolvedRuntime, standaloneAppDef) {
264
+ if (!standaloneAppDef) {
265
+ return resolvedRuntime;
266
+ }
267
+ return Object.assign(Object.assign({}, standaloneAppDef), { entryPoint: standaloneAppDef.entryPoint || resolvedRuntime.entryPoint, components: standaloneAppDef.components || resolvedRuntime.components, themes: standaloneAppDef.themes || resolvedRuntime.themes, apiInterceptor: standaloneAppDef.apiInterceptor || resolvedRuntime.apiInterceptor });
268
+ }
269
+ /**
270
+ * Fetch the up-to-date state of the source file
271
+ * @param url The URL to fetch the source file from
272
+ * @returns The source file contents response
273
+ */
274
+ function fetchWithoutCache(url) {
275
+ return __awaiter(this, void 0, void 0, function* () {
276
+ return fetch((0, misc_1.normalizePath)(url), {
277
+ headers: {
278
+ "Cache-Control": "no-cache, no-store",
279
+ },
280
+ });
281
+ });
282
+ }
283
+ /**
284
+ * Using its definition, this React hook prepares the runtime environment of a
285
+ * standalone app. It runs every time an app source file changes.
286
+ * @param standaloneAppDef The standalone app description
287
+ * @param runtime The pre-compiled runtime environment
288
+ * @returns The prepared StandaloneAppDescription if the collection is
289
+ * successful; otherwise, null.
290
+ */
291
+ function useStandalone(standaloneAppDef, runtime = constants_1.EMPTY_OBJECT, componentManager) {
292
+ const [standaloneApp, setStandaloneApp] = (0, react_1.useState)(() => {
293
+ // --- Initialize the standalone app
294
+ const resolvedRuntime = resolveRuntime(runtime);
295
+ const appDef = mergeAppDefWithRuntime(resolvedRuntime, standaloneAppDef);
296
+ // --- In dev mode or when the app is inlined (provided we do not use the standalone mode),
297
+ // --- we must have the app definition available.
298
+ if ((process.env.VITE_DEV_MODE || process.env.VITE_BUILD_MODE === "INLINE_ALL") &&
299
+ !process.env.VITE_STANDALONE) {
300
+ if (!appDef) {
301
+ throw new Error("couldn't find the application metadata");
302
+ }
303
+ return appDef;
304
+ }
305
+ // --- No standalone app yet, we need to get that from the fetched source code
306
+ return null;
307
+ });
308
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
309
+ (function () {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ var _a, _b, _c, _d;
312
+ const resolvedRuntime = resolveRuntime(runtime);
313
+ const appDef = mergeAppDefWithRuntime(resolvedRuntime, standaloneAppDef);
314
+ // --- In dev mode or when the app is inlined (provided we do not use the standalone mode),
315
+ // --- we must have the app definition available.
316
+ if ((process.env.VITE_DEV_MODE || process.env.VITE_BUILD_MODE === "INLINE_ALL") &&
317
+ !process.env.VITE_STANDALONE) {
318
+ if (!appDef) {
319
+ throw new Error("couldn't find the application metadata");
320
+ }
321
+ setStandaloneApp(appDef);
322
+ return;
323
+ }
324
+ // --- In standalone mode, we must fetch the XMLUI app's source files,
325
+ // --- compile them, and prepare the app's definition for the rendering
326
+ // --- engine.
327
+ if (process.env.VITE_BUILD_MODE === "CONFIG_ONLY") {
328
+ // --- In config-only mode, we override the pre-compiled app definition
329
+ // --- with elements from the configuration file. Note that we do not
330
+ // --- check whether the config file's content is semantically valid.
331
+ const configResponse = yield fetchWithoutCache(CONFIG_FILE);
332
+ const config = yield configResponse.json();
333
+ const themePromises = [];
334
+ (_a = config.themes) === null || _a === void 0 ? void 0 : _a.forEach((theme) => {
335
+ themePromises.push(fetchWithoutCache(theme).then((value) => value.json()));
336
+ });
337
+ const themes = yield Promise.all(themePromises);
338
+ setStandaloneApp(Object.assign(Object.assign({}, appDef), { name: config.name, appGlobals: config.appGlobals, defaultTheme: config.defaultTheme, resources: config.resources, resourceMap: config.resourceMap, themes }));
339
+ return;
340
+ }
341
+ // --- Fetch the main file
342
+ const entryPointPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
343
+ try {
344
+ const resp = yield fetchWithoutCache(MAIN_FILE);
345
+ if (resp.ok) {
346
+ resolve(parseComponentMarkupResponse(resp));
347
+ }
348
+ else {
349
+ resolve({
350
+ component: (0, xmlui_parser_1.errReportMessage)(`Failed to load the main component (${MAIN_FILE})`),
351
+ file: MAIN_FILE,
352
+ hasError: true,
353
+ });
354
+ }
355
+ }
356
+ catch (e) {
357
+ resolve(null);
358
+ }
359
+ }));
360
+ // --- Fetch the main code-behind file (if any)
361
+ const entryPointCodeBehindPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
362
+ try {
363
+ const resp = yield fetchWithoutCache(MAIN_CODE_BEHIND_FILE);
364
+ const codeBehind = yield parseCodeBehindResponse(resp);
365
+ resolve(codeBehind.hasError ? codeBehind : codeBehind.codeBehind);
366
+ }
367
+ catch (e) {
368
+ resolve(null);
369
+ }
370
+ }));
371
+ // --- Fetch the configuration file (we do not check whether the content is semantically valid)
372
+ let config = undefined;
373
+ try {
374
+ const configResponse = yield fetchWithoutCache(CONFIG_FILE);
375
+ config = yield configResponse.json();
376
+ }
377
+ catch (e) { }
378
+ // --- Fetch the themes according to the configuration
379
+ const themePromises = (_b = config === null || config === void 0 ? void 0 : config.themes) === null || _b === void 0 ? void 0 : _b.map((themePath) => {
380
+ return fetchWithoutCache(themePath).then((value) => value.json());
381
+ });
382
+ // --- Fetch component files according to the configuration
383
+ const componentPromises = (_c = config === null || config === void 0 ? void 0 : config.components) === null || _c === void 0 ? void 0 : _c.map((componentPath) => __awaiter(this, void 0, void 0, function* () {
384
+ const value = yield fetchWithoutCache(componentPath);
385
+ if (componentPath.endsWith(`.${fileExtensions_1.componentFileExtension}`)) {
386
+ return yield parseComponentMarkupResponse(value);
387
+ }
388
+ else {
389
+ return yield parseCodeBehindResponse(value);
390
+ }
391
+ }));
392
+ // --- Let the promises resolve
393
+ const [loadedEntryPoint, loadedEntryPointCodeBehind, loadedComponents, themes] = yield Promise.all([
394
+ entryPointPromise,
395
+ entryPointCodeBehindPromise,
396
+ Promise.all(componentPromises || []),
397
+ Promise.all(themePromises || []),
398
+ ]);
399
+ // --- Collect the elements of the standalone app (and potential errors)
400
+ const errorComponents = [];
401
+ // --- Check if the main component has errors
402
+ if (loadedEntryPoint.hasError) {
403
+ errorComponents.push(loadedEntryPoint.component);
404
+ }
405
+ if (loadedEntryPointCodeBehind === null || loadedEntryPointCodeBehind === void 0 ? void 0 : loadedEntryPointCodeBehind.hasError) {
406
+ errorComponents.push(loadedEntryPointCodeBehind.component);
407
+ }
408
+ // --- Check if any of the components have markup errors
409
+ loadedComponents.forEach((compWrapper) => {
410
+ if (compWrapper.hasError) {
411
+ errorComponents.push(compWrapper.component);
412
+ }
413
+ });
414
+ // --- Collect the sources and code-behinds
415
+ const sources = {};
416
+ const codeBehinds = {};
417
+ // --- The main component source
418
+ if (loadedEntryPoint.file) {
419
+ sources[loadedEntryPoint.file] = loadedEntryPoint.src;
420
+ }
421
+ // --- Components may have code-behind files
422
+ loadedComponents.forEach((compWrapper) => {
423
+ var _a;
424
+ if ((_a = compWrapper === null || compWrapper === void 0 ? void 0 : compWrapper.file) === null || _a === void 0 ? void 0 : _a.endsWith(`.${fileExtensions_1.codeBehindFileExtension}`)) {
425
+ codeBehinds[compWrapper.file] = compWrapper.codeBehind;
426
+ }
427
+ else {
428
+ if (compWrapper.file) {
429
+ sources[compWrapper.file] = compWrapper.src;
430
+ }
431
+ }
432
+ });
433
+ // --- Assemble the runtime for the main app file
434
+ const entryPointWithCodeBehind = Object.assign(Object.assign({}, loadedEntryPoint.component), { vars: Object.assign(Object.assign({}, loadedEntryPointCodeBehind === null || loadedEntryPointCodeBehind === void 0 ? void 0 : loadedEntryPointCodeBehind.vars), loadedEntryPoint.component.vars), functions: loadedEntryPointCodeBehind === null || loadedEntryPointCodeBehind === void 0 ? void 0 : loadedEntryPointCodeBehind.functions, scriptError: loadedEntryPointCodeBehind === null || loadedEntryPointCodeBehind === void 0 ? void 0 : loadedEntryPointCodeBehind.moduleErrors });
435
+ const defaultTheme = (_d = entryPointWithCodeBehind.props) === null || _d === void 0 ? void 0 : _d.defaultTheme;
436
+ // --- We test whether the default theme is not from a binding
437
+ // --- expression and is not a built-in theme already loaded. If so,
438
+ // --- we load it from the `themes` folder.
439
+ if (defaultTheme && typeof defaultTheme === "string" && !defaultTheme.includes("{")) {
440
+ if (!ThemeProvider_1.builtInThemes.find((theme) => theme.id === defaultTheme) &&
441
+ !themes.find((theme) => theme.id === defaultTheme)) {
442
+ themes.push(yield fetchWithoutCache(`themes/${defaultTheme}.json`).then((value) => value.json()));
443
+ }
444
+ }
445
+ // --- Assemble the runtime for the components
446
+ const componentsWithCodeBehinds = loadedComponents
447
+ .filter((compWrapper) => { var _a; return !((_a = compWrapper === null || compWrapper === void 0 ? void 0 : compWrapper.file) === null || _a === void 0 ? void 0 : _a.endsWith(".xmlui.xs")); })
448
+ .map((compWrapper) => {
449
+ const componentCodeBehind = codeBehinds[compWrapper.file + ".xs"];
450
+ return Object.assign(Object.assign({}, compWrapper.component), { component: Object.assign(Object.assign({}, compWrapper.component.component), { vars: Object.assign(Object.assign({}, compWrapper.component.component.vars), componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.vars), functions: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.functions, scriptError: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.moduleErrors }) });
451
+ });
452
+ // --- We may have components that are not in the configuration file.
453
+ // --- We need to load them and their code-behinds. First, we collect
454
+ // --- the components to load.
455
+ let componentsToLoad = collectMissingComponents(entryPointWithCodeBehind, componentsWithCodeBehinds, undefined, componentManager);
456
+ // --- Try to load the components referenced in the markup, collect
457
+ // --- those that failed
458
+ const componentsFailedToLoad = new Set();
459
+ while (componentsToLoad.size > 0) {
460
+ const componentPromises = [...componentsToLoad].map((componentPath) => __awaiter(this, void 0, void 0, function* () {
461
+ try {
462
+ // --- Promises for the component markup files
463
+ const componentPromise = fetchWithoutCache(`components/${componentPath}.${fileExtensions_1.componentFileExtension}`);
464
+ // --- Promises for the component code-behind files
465
+ const componentCodeBehindPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
466
+ try {
467
+ const codeBehindWrapper = yield parseCodeBehindResponse(yield fetchWithoutCache(`components/${componentPath}.${fileExtensions_1.codeBehindFileExtension}`));
468
+ if (codeBehindWrapper.hasError) {
469
+ errorComponents.push(codeBehindWrapper.component);
470
+ }
471
+ resolve(codeBehindWrapper.hasError
472
+ ? codeBehindWrapper.component
473
+ : codeBehindWrapper.codeBehind);
474
+ }
475
+ catch (_a) {
476
+ resolve(null);
477
+ }
478
+ }));
479
+ // --- Let the promises resolve
480
+ const [componentMarkup, componentCodeBehind] = yield Promise.all([
481
+ componentPromise,
482
+ componentCodeBehindPromise,
483
+ ]);
484
+ // --- Parse the component markup and check for errors
485
+ const compWrapper = yield parseComponentMarkupResponse(componentMarkup);
486
+ if (compWrapper.hasError) {
487
+ errorComponents.push(compWrapper.component);
488
+ }
489
+ sources[compWrapper.file] = compWrapper.src;
490
+ return Object.assign(Object.assign({}, compWrapper.component), { component: Object.assign(Object.assign({}, compWrapper.component.component), { vars: Object.assign(Object.assign({}, compWrapper.component.component.vars), componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.vars), functions: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.functions, scriptError: componentCodeBehind === null || componentCodeBehind === void 0 ? void 0 : componentCodeBehind.moduleErrors }) });
491
+ }
492
+ catch (e) {
493
+ componentsFailedToLoad.add(componentPath);
494
+ return null;
495
+ }
496
+ }));
497
+ const componentWrappers = yield Promise.all(componentPromises);
498
+ componentsWithCodeBehinds.push(...componentWrappers.filter((comp) => !!comp));
499
+ componentsToLoad = collectMissingComponents(entryPointWithCodeBehind, componentsWithCodeBehinds, componentsFailedToLoad, componentManager);
500
+ }
501
+ // --- Let's check for errors to display
502
+ const errorComponent = errorComponents.length > 0
503
+ ? {
504
+ type: "VStack",
505
+ props: { gap: 0, padding: 0 },
506
+ children: errorComponents,
507
+ }
508
+ : null;
509
+ setStandaloneApp(Object.assign(Object.assign({}, config), { themes,
510
+ sources, components: componentsWithCodeBehinds, entryPoint: errorComponent || entryPointWithCodeBehind }));
511
+ });
512
+ })();
513
+ }, [runtime, standaloneAppDef]);
514
+ return standaloneApp;
515
+ }
516
+ /**
517
+ * Collect the missing components referenced by any part of the app
518
+ * @param entryPoint The app's main markup
519
+ * @param components The component markups
520
+ * @param componentsFailedToLoad The components that failed to load here
521
+ * @returns The components that are still missing
522
+ */
523
+ function collectMissingComponents(entryPoint, components, componentsFailedToLoad = new Set(), componentManager) {
524
+ // --- Add the discovered compound components to the registry
525
+ const componentRegistry = new ComponentProvider_1.ComponentRegistry({ compoundComponents: components }, componentManager);
526
+ // --- Check the xmlui markup. This check will find all unloaded components
527
+ const result = (0, markup_check_1.checkXmlUiMarkup)(entryPoint, components, {
528
+ getComponentProps: (componentName) => {
529
+ var _a, _b;
530
+ return (_b = (_a = componentRegistry.lookupComponentRenderer(componentName)) === null || _a === void 0 ? void 0 : _a.descriptor) === null || _b === void 0 ? void 0 : _b.props;
531
+ },
532
+ acceptArbitraryProps: () => {
533
+ return true;
534
+ },
535
+ getComponentValidator: () => {
536
+ return null;
537
+ },
538
+ getComponentEvents: () => {
539
+ return null;
540
+ },
541
+ componentRegistered: (componentName) => {
542
+ return componentRegistry.hasComponent(componentName);
543
+ },
544
+ });
545
+ componentRegistry.destroy();
546
+ // --- Collect all missing components.Omit the components that failed to load
547
+ return new Set(result
548
+ .filter((r) => r.code === "M001")
549
+ .map((r) => r.args[0])
550
+ .filter((comp) => !componentsFailedToLoad.has(comp)));
551
+ }
552
+ // --- This React hook logs the app's version number to the browser's console at startup
553
+ function usePrintVersionNumber(standaloneApp) {
554
+ const logged = (0, react_1.useRef)(false);
555
+ (0, react_1.useEffect)(() => {
556
+ if (logged.current) {
557
+ return;
558
+ }
559
+ logged.current = true;
560
+ let log = `XMLUI version: ${process.env.VITE_XMLUI_VERSION || "dev"}`;
561
+ if (standaloneApp === null || standaloneApp === void 0 ? void 0 : standaloneApp.name) {
562
+ log += `; ${standaloneApp.name} version: ${process.env.VITE_APP_VERSION || "dev"}`;
563
+ }
564
+ console.log(log);
565
+ }, [standaloneApp === null || standaloneApp === void 0 ? void 0 : standaloneApp.name]);
566
+ }
567
+ let contentRoot = null;
568
+ /**
569
+ * This function injects the StandaloneApp component into a React app. It looks
570
+ * up a component with the "root" id as the host of the standalone app. If such
571
+ * an element does not exist, it creates a `<div id="root">` element.
572
+ * @param runtime The app's runtime representation
573
+ * @param components The related component's runtime representation
574
+ * @returns The content's root element
575
+ */
576
+ function startApp(runtime, components, componentManager) {
577
+ let rootElement = document.getElementById("root");
578
+ if (!rootElement) {
579
+ rootElement = document.createElement("div");
580
+ rootElement.setAttribute("id", "root");
581
+ document.body.appendChild(rootElement);
582
+ }
583
+ if (!contentRoot) {
584
+ contentRoot = client_1.default.createRoot(rootElement);
585
+ }
586
+ contentRoot.render((0, jsx_runtime_1.jsx)(StandaloneApp, { runtime: runtime, components: components, componentManager: componentManager }));
587
+ return contentRoot;
588
+ }
589
+ exports.default = StandaloneApp;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * This class allows external component libraries to add their components to
5
+ * the xmlui component registry. The framework resolves the components used
6
+ * in an application markup with this registry.
7
+ */
8
+ class StandaloneComponentManager {
9
+ constructor() {
10
+ this.subscriptions = new Set();
11
+ this.registeredComponents = [];
12
+ }
13
+ /**
14
+ * You can add a callback function invoked whenever a new component is added
15
+ * to the registry. When you register a new callback function, the component
16
+ * manager automatically invokes it for all components already in the
17
+ * registry.
18
+ * @param cb Function to call when a new component is registered
19
+ */
20
+ subscribeToRegistrations(cb) {
21
+ this.subscriptions.add(cb);
22
+ this.registeredComponents.forEach((component) => {
23
+ cb(component);
24
+ });
25
+ }
26
+ /**
27
+ * You can remove a function added by `subscribeToRegistrations`. After
28
+ * calling this method, the particular callback function won't be invoked
29
+ * for a new component registration.
30
+ * @param cb Function to call when a new component is registered
31
+ */
32
+ unSubscribeFromRegistrations(cb) {
33
+ this.subscriptions.delete(cb);
34
+ }
35
+ /**
36
+ * Use this function to add a new component to the registry. Adding a new
37
+ * component will invoke all callbacks that have already subscribed to the
38
+ * component registration.
39
+ * @param component The component to register. You can pass a single
40
+ * component or an array of components.
41
+ */
42
+ registerComponent(component) {
43
+ (Array.isArray(component) ? component : [component]).forEach((component) => {
44
+ this.registeredComponents.push(component);
45
+ this.subscriptions.forEach((cb) => {
46
+ cb(component);
47
+ });
48
+ });
49
+ }
50
+ }
51
+ exports.default = StandaloneComponentManager;