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,127 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getStyleObjectFromString = void 0;
7
+ exports.kebabCase = kebabCase;
8
+ exports.toStyleString = toStyleString;
9
+ exports.normalizeCssValueForCalc = normalizeCssValueForCalc;
10
+ exports.getColor = getColor;
11
+ exports.getColors = getColors;
12
+ exports.getMaxLinesStyle = getMaxLinesStyle;
13
+ exports.getSizeString = getSizeString;
14
+ const color_1 = __importDefault(require("color"));
15
+ const themeVars_1 = require("@components-core/theming/themeVars");
16
+ const constants_1 = require("@components-core/constants");
17
+ /**
18
+ * Converts a string to its kebab-case representation
19
+ * @param str Input string
20
+ * @returns Kebab-case representation
21
+ */
22
+ function kebabCase(str) {
23
+ return str.replace(/[A-Z]/g, (v) => `-${v.toLowerCase()}`);
24
+ }
25
+ /**
26
+ * Converts the set of style properties to a string
27
+ * @param style Style properties
28
+ * @returns Style string representation
29
+ */
30
+ function toStyleString(style) {
31
+ return Object.keys(style).reduce((accumulator, key) => {
32
+ // remove ' in value
33
+ const cssValue = style[key].toString().replace("'", "");
34
+ // build the result
35
+ // you can break the line, add indent for it if you need
36
+ return `${accumulator}${key}:${cssValue};`;
37
+ }, "");
38
+ }
39
+ const formatStringToCamelCase = (str) => {
40
+ const splitted = str.split("-");
41
+ if (splitted.length === 1)
42
+ return splitted[0];
43
+ return (splitted[0] +
44
+ splitted
45
+ .slice(1)
46
+ .map((word) => word[0].toUpperCase() + word.slice(1))
47
+ .join(""));
48
+ };
49
+ const getStyleObjectFromString = (str) => {
50
+ const style = {};
51
+ str.split(";").forEach((el) => {
52
+ const [property, value] = el.split(":");
53
+ if (!property || !value)
54
+ return;
55
+ const formattedProperty = formatStringToCamelCase(property.trim());
56
+ // @ts-ignore
57
+ style[formattedProperty] = value.trim();
58
+ });
59
+ return style;
60
+ };
61
+ exports.getStyleObjectFromString = getStyleObjectFromString;
62
+ function normalizeCssValueForCalc(cssValue) {
63
+ // 1. number -> append "px"
64
+ if (typeof cssValue === "number")
65
+ return cssValue + "px";
66
+ // 2. string
67
+ const cssTrimmed = cssValue.trim();
68
+ if (cssTrimmed.startsWith("var(")) {
69
+ return cssTrimmed;
70
+ }
71
+ const value = parseFloat(cssTrimmed);
72
+ const valueStr = value.toString();
73
+ const unit = cssTrimmed.replace(valueStr, "");
74
+ // a) non-value -> "0px"
75
+ if (Number.isNaN(value))
76
+ return "0px";
77
+ // b) value without unit -> append "px"
78
+ if (unit === "")
79
+ return valueStr + "px";
80
+ // c) value with unit -> do nothing
81
+ return cssTrimmed;
82
+ }
83
+ function getColor(varName, format) {
84
+ const varValue = getComputedStyle(document.getElementById("_ui-engine-theme-root")).getPropertyValue((0, themeVars_1.getVarKey)(varName));
85
+ if (format === "hex") {
86
+ return (0, color_1.default)(varValue).hex().toString();
87
+ }
88
+ return (0, color_1.default)(varValue).toString();
89
+ }
90
+ function getColors(...colors) {
91
+ const ret = {};
92
+ for (const color of colors) {
93
+ if (typeof color === "string") {
94
+ ret[color] = getColor(color);
95
+ }
96
+ else {
97
+ ret[color.name] = getColor(color.name, color.format);
98
+ }
99
+ }
100
+ return ret;
101
+ }
102
+ function getMaxLinesStyle(maxLines) {
103
+ const _maxLines = maxLines && maxLines > 0 ? maxLines : 0;
104
+ const maxLinesStyles = _maxLines > 1
105
+ ? {
106
+ WebkitLineClamp: _maxLines,
107
+ lineClamp: _maxLines,
108
+ display: "-webkit-box",
109
+ WebkitBoxOrient: "vertical",
110
+ boxOrient: "vertical",
111
+ whiteSpace: "initial",
112
+ }
113
+ : constants_1.EMPTY_OBJECT;
114
+ return maxLinesStyles;
115
+ }
116
+ function getSizeString(size) {
117
+ if (typeof size === "number") {
118
+ return size + "px";
119
+ }
120
+ if (typeof size === "string" && /^\d+$/.test(size.trim())) {
121
+ const rowGapValue = parseInt(size, 10);
122
+ if (!isNaN(rowGapValue)) {
123
+ return rowGapValue + "px";
124
+ }
125
+ }
126
+ return size === null || size === void 0 ? void 0 : size.toString();
127
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isoDateString = isoDateString;
4
+ exports.formatDate = formatDate;
5
+ exports.formatDateTime = formatDateTime;
6
+ exports.formatTime = formatTime;
7
+ exports.formatTimeWithoutSeconds = formatTimeWithoutSeconds;
8
+ exports.formatDateWithoutYear = formatDateWithoutYear;
9
+ exports.getDate = getDate;
10
+ exports.getDateUntilNow = getDateUntilNow;
11
+ exports.smartFormatDateTime = smartFormatDateTime;
12
+ exports.smartFormatDate = smartFormatDate;
13
+ exports.isDateToday = isDateToday;
14
+ exports.isDateYesterday = isDateYesterday;
15
+ exports.isDateTomorrow = isDateTomorrow;
16
+ const date_fns_1 = require("date-fns");
17
+ const misc_1 = require("@components-core/utils/misc");
18
+ function isoDateString(date) {
19
+ return (!date ? new Date() : new Date(date)).toJSON();
20
+ }
21
+ function formatDate(date) {
22
+ return new Date(date).toLocaleDateString();
23
+ }
24
+ function formatDateTime(date) {
25
+ return new Date(date).toLocaleString();
26
+ }
27
+ function formatTime(date) {
28
+ return new Date(date).toLocaleTimeString();
29
+ }
30
+ function formatTimeWithoutSeconds(date) {
31
+ return (0, date_fns_1.format)(new Date(date), "H:m");
32
+ }
33
+ function formatDateWithoutYear(date) {
34
+ return new Date(date).toLocaleDateString([], {
35
+ month: "numeric",
36
+ day: "2-digit"
37
+ });
38
+ }
39
+ function getDate(date) {
40
+ return date ? new Date(date) : new Date();
41
+ }
42
+ function getDateUntilNow(date, nowLabel, time) {
43
+ return date ? (0, misc_1.humanReadableDateTimeTillNow)(date, nowLabel, time) : "-";
44
+ }
45
+ function smartFormatDateTime(date) {
46
+ if (!date) {
47
+ return "-";
48
+ }
49
+ if ((0, date_fns_1.isToday)(new Date(date))) {
50
+ return new Date(date).toLocaleTimeString();
51
+ }
52
+ if ((0, date_fns_1.isThisWeek)(new Date(date))) {
53
+ return `${(0, date_fns_1.formatRelative)(new Date(date), new Date())}`;
54
+ }
55
+ return new Date(date).toLocaleString();
56
+ }
57
+ function smartFormatDate(date) {
58
+ if (!date) {
59
+ return "-";
60
+ }
61
+ //TODO we could use formatRelative when they implement this: https://github.com/date-fns/date-fns/issues/1218
62
+ if ((0, date_fns_1.isToday)(new Date(date))) {
63
+ return "Today";
64
+ }
65
+ if ((0, date_fns_1.isYesterday)(new Date(date))) {
66
+ return "Yesterday";
67
+ }
68
+ return new Date(date).toLocaleDateString();
69
+ }
70
+ function isDateToday(date) {
71
+ return (0, date_fns_1.isToday)(new Date(date));
72
+ }
73
+ function isDateYesterday(date) {
74
+ return (0, date_fns_1.isYesterday)(new Date(date));
75
+ }
76
+ function isDateTomorrow(date) {
77
+ return (0, date_fns_1.isTomorrow)(new Date(date));
78
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.extractParam = extractParam;
7
+ exports.withStableObjectReference = withStableObjectReference;
8
+ exports.shouldKeep = shouldKeep;
9
+ const react_1 = __importDefault(require("react"));
10
+ const lodash_es_1 = require("lodash-es");
11
+ const ParameterParser_1 = require("@components-core/script-runner/ParameterParser");
12
+ const eval_tree_sync_1 = require("@components-core/script-runner/eval-tree-sync");
13
+ const LruCache_1 = require("@components-core/utils/LruCache");
14
+ /**
15
+ * Extract the value of the specified parameter from the given view container state
16
+ * @param state The state of the view container
17
+ * @param param Parameter to extract
18
+ * @param appContext Application context to use
19
+ * @param strict Strict evaluation?
20
+ * @param extractContext
21
+ * @returns
22
+ */
23
+ function extractParam(state, param, appContext = undefined, strict = false, // --- In this case we only allow string binding expression
24
+ extractContext = { didResolve: false }) {
25
+ if (typeof param === "string") {
26
+ const paramSegments = (0, ParameterParser_1.parseParameterString)(param);
27
+ if (paramSegments.length === 0) {
28
+ // --- The param is an empty string, retrieve it
29
+ return param;
30
+ }
31
+ if (paramSegments.length === 1) {
32
+ // --- We have a single string literal or expression
33
+ if (paramSegments[0].type === "literal") {
34
+ // --- No expression to evaluate
35
+ return paramSegments[0].value;
36
+ }
37
+ else {
38
+ // --- We have a single expression to evaluate
39
+ extractContext.didResolve = true;
40
+ return (0, eval_tree_sync_1.evalBinding)(paramSegments[0].value, {
41
+ localContext: state,
42
+ appContext,
43
+ options: {
44
+ defaultToOptionalMemberAccess: true,
45
+ },
46
+ });
47
+ }
48
+ }
49
+ // --- At this point, we have multiple segments. Evaluate all expressions and convert them to strings
50
+ let result = "";
51
+ paramSegments.forEach((ps) => {
52
+ if (ps.type === "literal") {
53
+ result += ps.value;
54
+ }
55
+ else {
56
+ extractContext.didResolve = true;
57
+ const exprValue = (0, eval_tree_sync_1.evalBinding)(ps.value, {
58
+ localContext: state,
59
+ appContext,
60
+ options: {
61
+ defaultToOptionalMemberAccess: true,
62
+ },
63
+ });
64
+ if (exprValue === null) {
65
+ result += "null";
66
+ }
67
+ else if (exprValue === undefined) {
68
+ result += "undefined";
69
+ }
70
+ else if (exprValue === null || exprValue === void 0 ? void 0 : exprValue.toString) {
71
+ result += exprValue.toString();
72
+ }
73
+ }
74
+ });
75
+ return result;
76
+ }
77
+ if (strict) {
78
+ // --- As we allow only string parameters as binding expressions, we return with the provided
79
+ // --- *not string* parameter without transforming it
80
+ return param;
81
+ }
82
+ // --- Resolve each array item
83
+ if (Array.isArray(param)) {
84
+ const arrayExtractContext = { didResolve: false };
85
+ let resolvedChildren = param.map((childParam) => extractParam(state, childParam, appContext, false, arrayExtractContext));
86
+ if (arrayExtractContext.didResolve) {
87
+ extractContext.didResolve = true;
88
+ return resolvedChildren;
89
+ }
90
+ return param;
91
+ }
92
+ // --- Resolve each object property
93
+ if ((0, lodash_es_1.isPlainObject)(param)) {
94
+ const objectExtractContext = { didResolve: false };
95
+ const substitutedObject = {};
96
+ Object.entries(param).forEach(([key, value]) => {
97
+ substitutedObject[key] = extractParam(state, value, appContext, false, objectExtractContext);
98
+ });
99
+ if (objectExtractContext.didResolve) {
100
+ extractContext.didResolve = true;
101
+ return substitutedObject;
102
+ }
103
+ return param;
104
+ }
105
+ // --- The param itself is the extracted value
106
+ return param;
107
+ }
108
+ // --- Store stable object references for extracted parameter values
109
+ const extractedObjectCache = new LruCache_1.LRUCache(1024 * 10);
110
+ /**
111
+ * Get a stable object reference from an LRU cache
112
+ * @param object Object to get the stable reference for
113
+ *
114
+ * We are doing this to prevent creating new objects with new references when the data hasn't changed this way we
115
+ * can use these as dependencies for useEffect
116
+ */
117
+ function withStableObjectReference(object) {
118
+ if (typeof object === "function") {
119
+ return object;
120
+ }
121
+ if (react_1.default.isValidElement(object) || (Array.isArray(object) && react_1.default.isValidElement(object[0]))) {
122
+ //here could be some gnarly circular object references, JSON.stringify would blow up
123
+ return object;
124
+ }
125
+ if (object === null || object === void 0 ? void 0 : object._ARROW_EXPR_) {
126
+ //here could be some gnarly circular object references, JSON.stringify would blow up
127
+ return object;
128
+ }
129
+ try {
130
+ const stringObject = JSON.stringify(object);
131
+ const cachedObject = extractedObjectCache.get(stringObject);
132
+ if (cachedObject) {
133
+ return cachedObject;
134
+ }
135
+ extractedObjectCache.set(stringObject, object);
136
+ }
137
+ catch (e) {
138
+ console.log(object);
139
+ console.warn("couldn't cache result", e);
140
+ }
141
+ return object;
142
+ }
143
+ function shouldKeep(when, componentState, appContext) {
144
+ if (when === undefined) {
145
+ return true;
146
+ }
147
+ return extractParam(componentState, when, appContext, true);
148
+ }
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.useIsomorphicLayoutEffect = exports.useResizeObserver = void 0;
27
+ exports.usePrevious = usePrevious;
28
+ exports.useIsInIFrame = useIsInIFrame;
29
+ exports.useIsWindowFocused = useIsWindowFocused;
30
+ exports.useMediaQuery = useMediaQuery;
31
+ exports.useDocumentKeydown = useDocumentKeydown;
32
+ exports.useOnMount = useOnMount;
33
+ exports.useShallowCompareMemoize = useShallowCompareMemoize;
34
+ exports.useDeepCompareMemoize = useDeepCompareMemoize;
35
+ exports.useColors = useColors;
36
+ exports.useReferenceTrackedApi = useReferenceTrackedApi;
37
+ const react_1 = __importStar(require("react"));
38
+ const lodash_es_1 = require("lodash-es");
39
+ const misc_1 = require("@components-core/utils/misc");
40
+ const ThemeContext_1 = require("@components-core/theming/ThemeContext");
41
+ const constants_1 = require("@components-core/constants");
42
+ const css_utils_1 = require("./css-utils");
43
+ /**
44
+ * This hook invokes a callback when the size of the specified DOM element changes.
45
+ * @param element A DOM element to watch for size changes
46
+ * @param callback The callback function to invoke on size changes
47
+ */
48
+ const useResizeObserver = (element, callback) => {
49
+ const current = element === null || element === void 0 ? void 0 : element.current;
50
+ const observer = (0, react_1.useRef)();
51
+ (0, react_1.useEffect)(() => {
52
+ // --- We are already observing old element
53
+ if ((observer === null || observer === void 0 ? void 0 : observer.current) && current) {
54
+ observer.current.unobserve(current);
55
+ }
56
+ observer.current = new ResizeObserver(callback);
57
+ if (element && element.current && observer.current) {
58
+ observer.current.observe(element.current);
59
+ }
60
+ }, [callback, current, element]);
61
+ };
62
+ exports.useResizeObserver = useResizeObserver;
63
+ /**
64
+ * This hook gets the previous state of the specified value (props, variable used in a React
65
+ * function).
66
+ *
67
+ * @see {@link https://blog.logrocket.com/accessing-previous-props-state-react-hooks/}
68
+ */
69
+ function usePrevious(value) {
70
+ const ref = (0, react_1.useRef)();
71
+ (0, react_1.useEffect)(() => {
72
+ ref.current = value;
73
+ }, [value]);
74
+ return ref.current;
75
+ }
76
+ /**
77
+ * This hook tests if the component is used within an iframe.
78
+ * @returns True, if the component is used within an iframe; otherwise, false.
79
+ */
80
+ function useIsInIFrame() {
81
+ return (0, react_1.useMemo)(() => {
82
+ try {
83
+ return window.self !== window.top;
84
+ }
85
+ catch (e) {
86
+ return true;
87
+ }
88
+ }, []);
89
+ }
90
+ // --- Tests if the document has the focus
91
+ const hasFocus = () => typeof document !== "undefined" && document.hasFocus();
92
+ /**
93
+ * This hook tests if the window has the focus.
94
+ * @returns True, if the window has the focus; otherwise, false.
95
+ */
96
+ function useIsWindowFocused() {
97
+ const [focused, setFocused] = (0, react_1.useState)(hasFocus); // Focus for first render
98
+ (0, react_1.useEffect)(() => {
99
+ setFocused(hasFocus()); // Focus for additional renders
100
+ const onFocus = () => setFocused(true);
101
+ const onBlur = () => setFocused(false);
102
+ window.addEventListener("focus", onFocus);
103
+ window.addEventListener("blur", onBlur);
104
+ return () => {
105
+ window.removeEventListener("focus", onFocus);
106
+ window.removeEventListener("blur", onBlur);
107
+ };
108
+ }, []);
109
+ return focused;
110
+ }
111
+ /**
112
+ * This hook allows running media queries.
113
+ * @param query Media query to run
114
+ */
115
+ function useMediaQuery(query) {
116
+ const [matches, setMatches] = (0, react_1.useState)(false);
117
+ (0, react_1.useEffect)(() => {
118
+ if (!window) {
119
+ setMatches(false);
120
+ return;
121
+ }
122
+ const matchMedia = window.matchMedia(query);
123
+ // Triggered at the first client-side load and if query changes
124
+ handleChange();
125
+ matchMedia.addEventListener("change", handleChange);
126
+ return () => {
127
+ matchMedia.removeEventListener("change", handleChange);
128
+ };
129
+ function handleChange() {
130
+ setMatches(matchMedia.matches);
131
+ }
132
+ }, [query]);
133
+ return matches;
134
+ }
135
+ /**
136
+ * This hook runs a callback function when a key is pressed in the document window.
137
+ * @param onDocumentKeydown Callback function to run
138
+ */
139
+ function useDocumentKeydown(onDocumentKeydown) {
140
+ const onKeyDown = (0, misc_1.useEvent)(onDocumentKeydown);
141
+ (0, react_1.useEffect)(() => {
142
+ document.addEventListener("keydown", onKeyDown);
143
+ return () => {
144
+ document.removeEventListener("keydown", onKeyDown);
145
+ };
146
+ }, [onKeyDown]);
147
+ }
148
+ /**
149
+ * This hook runs a function when the corresponding component has been mounted.
150
+ * @param onMount
151
+ */
152
+ function useOnMount(onMount) {
153
+ const thizRef = (0, react_1.useRef)({ mountedFired: false });
154
+ (0, react_1.useEffect)(() => {
155
+ if (!thizRef.current.mountedFired) {
156
+ thizRef.current.mountedFired = true;
157
+ onMount === null || onMount === void 0 ? void 0 : onMount();
158
+ }
159
+ }, [onMount]);
160
+ }
161
+ /**
162
+ * This hook memoizes the specified value. It uses a shallow comparison with the previously
163
+ * stored value when checking for changes. So, while a shallow comparison shows equality, it returns with the memoized value.
164
+ * @param value Value to memoize
165
+ */
166
+ function useShallowCompareMemoize(value) {
167
+ const ref = react_1.default.useRef(value);
168
+ const signalRef = react_1.default.useRef(0);
169
+ if (!(0, misc_1.shallowCompare)(value, ref.current)) {
170
+ ref.current = value;
171
+ signalRef.current++;
172
+ }
173
+ // eslint-disable-next-line react-hooks/exhaustive-deps
174
+ return react_1.default.useMemo(() => ref.current, [signalRef.current]);
175
+ }
176
+ /**
177
+ * This hook memoizes the specified value. When checking for changes, it uses a deep comparison
178
+ * with the previously stored value. So, while a deep comparison shows equality, it returns with
179
+ * the memoized value, even if value references differ.
180
+ * @param value Value to memoize
181
+ */
182
+ function useDeepCompareMemoize(value) {
183
+ const ref = react_1.default.useRef(value);
184
+ const signalRef = react_1.default.useRef(0);
185
+ if (!(0, lodash_es_1.isEqual)(value, ref.current)) {
186
+ ref.current = value;
187
+ signalRef.current += 1;
188
+ }
189
+ // eslint-disable-next-line react-hooks/exhaustive-deps
190
+ return react_1.default.useMemo(() => ref.current, [signalRef.current]);
191
+ }
192
+ function useColors(...colorNames) {
193
+ const paramsRef = (0, react_1.useRef)(colorNames);
194
+ const { themeStyles } = (0, ThemeContext_1.useTheme)();
195
+ const [colors, setColors] = (0, react_1.useState)(() => (0, css_utils_1.getColors)(...paramsRef.current));
196
+ (0, react_1.useEffect)(() => {
197
+ setColors((0, css_utils_1.getColors)(...paramsRef.current));
198
+ }, [themeStyles]);
199
+ return colors;
200
+ }
201
+ function useReferenceTrackedApi(componentState) {
202
+ return useShallowCompareMemoize((0, react_1.useMemo)(() => {
203
+ const ret = {};
204
+ if (Reflect.ownKeys(componentState).length === 0) {
205
+ //skip containers with no registered apis
206
+ return constants_1.EMPTY_OBJECT;
207
+ }
208
+ for (const componentApiKey of Object.getOwnPropertySymbols(componentState)) {
209
+ const value = componentState[componentApiKey];
210
+ if (componentApiKey.description) {
211
+ ret[componentApiKey.description] = value;
212
+ }
213
+ }
214
+ return ret;
215
+ }, [componentState]));
216
+ }
217
+ /**
218
+ * This hook uses either useLayoutEffect or useEffect based on the environment
219
+ * (client-side or server-side).
220
+ */
221
+ exports.useIsomorphicLayoutEffect = typeof document !== "undefined" ? react_1.useLayoutEffect : react_1.useEffect;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeProps = mergeProps;
4
+ /**
5
+ * Merges child component props with rest props.
6
+ * @param childProps Child component props
7
+ * @param restProps Rest props
8
+ * @returns
9
+ *
10
+ * The origin of this method is:
11
+ * https://github.com/radix-ui/primitives/blob/c31c97274ff357aea99afe6c01c1c8c58b6356e0/packages/react/slot/src/Slot.tsx#L91
12
+ */
13
+ function mergeProps(childProps, restProps) {
14
+ // --- All child props should override
15
+ const overrideProps = Object.assign({}, restProps);
16
+ for (const propName in restProps) {
17
+ const childPropValue = childProps[propName];
18
+ const restPropValue = restProps[propName];
19
+ const isHandler = /^on[A-Z]/.test(propName);
20
+ if (isHandler) {
21
+ // --- If the handler exists on both, we compose them...
22
+ if (childPropValue && restPropValue) {
23
+ overrideProps[propName] = (...args) => {
24
+ restPropValue(...args);
25
+ childPropValue(...args);
26
+ };
27
+ }
28
+ // --- ...but if it exists only on the original, we use only this one
29
+ else if (childPropValue) {
30
+ overrideProps[propName] = childPropValue;
31
+ }
32
+ }
33
+ else if (propName === "style") {
34
+ // --- We merge `style`
35
+ overrideProps[propName] = restPropValue ? Object.assign(Object.assign({}, restPropValue), childPropValue) : childPropValue;
36
+ }
37
+ else if (propName === "className") {
38
+ // --- We merge `className`
39
+ overrideProps[propName] = restPropValue
40
+ ? [restPropValue, childPropValue].filter(Boolean).join(" ")
41
+ : childPropValue;
42
+ }
43
+ }
44
+ return Object.assign(Object.assign({}, childProps), overrideProps);
45
+ }