@wavemaker-ai/react-codegen 1.0.0-next.27766

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 (400) hide show
  1. package/build-react-web.js +149 -0
  2. package/build-react-web.js.map +1 -0
  3. package/command.js +106 -0
  4. package/command.js.map +1 -0
  5. package/dist/transpiler/index.d.mts +77 -0
  6. package/dist/transpiler/index.mjs +48241 -0
  7. package/dist/transpiler/index.mjs.map +1 -0
  8. package/dist/transpiler/wm-styles.css +1617 -0
  9. package/index.js +122 -0
  10. package/index.js.map +1 -0
  11. package/package-lock.json +5233 -0
  12. package/package.json +104 -0
  13. package/src/app.generator.js +1291 -0
  14. package/src/app.generator.js.map +1 -0
  15. package/src/download-packages.js +193 -0
  16. package/src/download-packages.js.map +1 -0
  17. package/src/fomatter.js +20 -0
  18. package/src/fomatter.js.map +1 -0
  19. package/src/gen-app-override-css.js +379 -0
  20. package/src/gen-app-override-css.js.map +1 -0
  21. package/src/genappoverridecssold-file.js +311 -0
  22. package/src/genappoverridecssold-file.js.map +1 -0
  23. package/src/handlebar-helpers.js +51 -0
  24. package/src/handlebar-helpers.js.map +1 -0
  25. package/src/increment-builder.js +85 -0
  26. package/src/increment-builder.js.map +1 -0
  27. package/src/profiles/profile.js +24 -0
  28. package/src/profiles/profile.js.map +1 -0
  29. package/src/profiles/web-preview.profile.js +15 -0
  30. package/src/profiles/web-preview.profile.js.map +1 -0
  31. package/src/project.service.js +314 -0
  32. package/src/project.service.js.map +1 -0
  33. package/src/transpile/bind.ex.transformer.js +257 -0
  34. package/src/transpile/bind.ex.transformer.js.map +1 -0
  35. package/src/transpile/class-expression.util.js +44 -0
  36. package/src/transpile/class-expression.util.js.map +1 -0
  37. package/src/transpile/components/advanced/carousel-template.transformer.js +16 -0
  38. package/src/transpile/components/advanced/carousel-template.transformer.js.map +1 -0
  39. package/src/transpile/components/advanced/carousel.transformer.js +54 -0
  40. package/src/transpile/components/advanced/carousel.transformer.js.map +1 -0
  41. package/src/transpile/components/advanced/login.transformer.js +25 -0
  42. package/src/transpile/components/advanced/login.transformer.js.map +1 -0
  43. package/src/transpile/components/advanced/marquee.transformer.js +16 -0
  44. package/src/transpile/components/advanced/marquee.transformer.js.map +1 -0
  45. package/src/transpile/components/basic/anchor.transformer.js +13 -0
  46. package/src/transpile/components/basic/anchor.transformer.js.map +1 -0
  47. package/src/transpile/components/basic/audio.transformer.js +16 -0
  48. package/src/transpile/components/basic/audio.transformer.js.map +1 -0
  49. package/src/transpile/components/basic/html.transformer.js +15 -0
  50. package/src/transpile/components/basic/html.transformer.js.map +1 -0
  51. package/src/transpile/components/basic/icon.transformer.js +16 -0
  52. package/src/transpile/components/basic/icon.transformer.js.map +1 -0
  53. package/src/transpile/components/basic/iframe.transformer.js +16 -0
  54. package/src/transpile/components/basic/iframe.transformer.js.map +1 -0
  55. package/src/transpile/components/basic/label.transformer.js +16 -0
  56. package/src/transpile/components/basic/label.transformer.js.map +1 -0
  57. package/src/transpile/components/basic/message.transformer.js +16 -0
  58. package/src/transpile/components/basic/message.transformer.js.map +1 -0
  59. package/src/transpile/components/basic/picture.transformer.js +22 -0
  60. package/src/transpile/components/basic/picture.transformer.js.map +1 -0
  61. package/src/transpile/components/basic/progress-bar.transformer.js +18 -0
  62. package/src/transpile/components/basic/progress-bar.transformer.js.map +1 -0
  63. package/src/transpile/components/basic/progress-circle.transformer.js +16 -0
  64. package/src/transpile/components/basic/progress-circle.transformer.js.map +1 -0
  65. package/src/transpile/components/basic/richtexteditor.transformer.js +21 -0
  66. package/src/transpile/components/basic/richtexteditor.transformer.js.map +1 -0
  67. package/src/transpile/components/basic/search.transformer.js +68 -0
  68. package/src/transpile/components/basic/search.transformer.js.map +1 -0
  69. package/src/transpile/components/basic/spinner.transformer.js +16 -0
  70. package/src/transpile/components/basic/spinner.transformer.js.map +1 -0
  71. package/src/transpile/components/basic/tree.transformer.js +16 -0
  72. package/src/transpile/components/basic/tree.transformer.js.map +1 -0
  73. package/src/transpile/components/basic/video.transformer.js +16 -0
  74. package/src/transpile/components/basic/video.transformer.js.map +1 -0
  75. package/src/transpile/components/chart/chart.transformer.js +13 -0
  76. package/src/transpile/components/chart/chart.transformer.js.map +1 -0
  77. package/src/transpile/components/container/accordion-pane.transformer.js +28 -0
  78. package/src/transpile/components/container/accordion-pane.transformer.js.map +1 -0
  79. package/src/transpile/components/container/accordion.transformer.js +48 -0
  80. package/src/transpile/components/container/accordion.transformer.js.map +1 -0
  81. package/src/transpile/components/container/container.transformer.js +25 -0
  82. package/src/transpile/components/container/container.transformer.js.map +1 -0
  83. package/src/transpile/components/container/layout-grid/grid-column.transformer.js +16 -0
  84. package/src/transpile/components/container/layout-grid/grid-column.transformer.js.map +1 -0
  85. package/src/transpile/components/container/layout-grid/grid-row.transformer.js +16 -0
  86. package/src/transpile/components/container/layout-grid/grid-row.transformer.js.map +1 -0
  87. package/src/transpile/components/container/layout-grid/grid.transformer.js +16 -0
  88. package/src/transpile/components/container/layout-grid/grid.transformer.js.map +1 -0
  89. package/src/transpile/components/container/linear-layout/linear-layout-item.js +16 -0
  90. package/src/transpile/components/container/linear-layout/linear-layout-item.js.map +1 -0
  91. package/src/transpile/components/container/linear-layout/linear-layout.js +16 -0
  92. package/src/transpile/components/container/linear-layout/linear-layout.js.map +1 -0
  93. package/src/transpile/components/container/panel-content.transformer.js +16 -0
  94. package/src/transpile/components/container/panel-content.transformer.js.map +1 -0
  95. package/src/transpile/components/container/panel-footer.transformer.js +11 -0
  96. package/src/transpile/components/container/panel-footer.transformer.js.map +1 -0
  97. package/src/transpile/components/container/panel.transformer.js +20 -0
  98. package/src/transpile/components/container/panel.transformer.js.map +1 -0
  99. package/src/transpile/components/container/repeat-template.transformer.js +16 -0
  100. package/src/transpile/components/container/repeat-template.transformer.js.map +1 -0
  101. package/src/transpile/components/container/tabheader.transformer.js +13 -0
  102. package/src/transpile/components/container/tabheader.transformer.js.map +1 -0
  103. package/src/transpile/components/container/tabpane.transformer.js +32 -0
  104. package/src/transpile/components/container/tabpane.transformer.js.map +1 -0
  105. package/src/transpile/components/container/tabs.transformer.js +71 -0
  106. package/src/transpile/components/container/tabs.transformer.js.map +1 -0
  107. package/src/transpile/components/container/tile.transformer.js +16 -0
  108. package/src/transpile/components/container/tile.transformer.js.map +1 -0
  109. package/src/transpile/components/container/wizard.transformer.js +80 -0
  110. package/src/transpile/components/container/wizard.transformer.js.map +1 -0
  111. package/src/transpile/components/container/wizardaction.transformer.js +121 -0
  112. package/src/transpile/components/container/wizardaction.transformer.js.map +1 -0
  113. package/src/transpile/components/container/wizardstep.transformer.js +67 -0
  114. package/src/transpile/components/container/wizardstep.transformer.js.map +1 -0
  115. package/src/transpile/components/data/card/card-actions.transformer.js +13 -0
  116. package/src/transpile/components/data/card/card-actions.transformer.js.map +1 -0
  117. package/src/transpile/components/data/card/card-content.transformer.js +17 -0
  118. package/src/transpile/components/data/card/card-content.transformer.js.map +1 -0
  119. package/src/transpile/components/data/card/card-footer.transformer.js +13 -0
  120. package/src/transpile/components/data/card/card-footer.transformer.js.map +1 -0
  121. package/src/transpile/components/data/card/card.transformer.js +13 -0
  122. package/src/transpile/components/data/card/card.transformer.js.map +1 -0
  123. package/src/transpile/components/data/form/dynamic-fields.transformer.js +24 -0
  124. package/src/transpile/components/data/form/dynamic-fields.transformer.js.map +1 -0
  125. package/src/transpile/components/data/form/field-widget-shared.js +9 -0
  126. package/src/transpile/components/data/form/field-widget-shared.js.map +1 -0
  127. package/src/transpile/components/data/form/form-action.transformer.js +150 -0
  128. package/src/transpile/components/data/form/form-action.transformer.js.map +1 -0
  129. package/src/transpile/components/data/form/form-body.transformer.js +16 -0
  130. package/src/transpile/components/data/form/form-body.transformer.js.map +1 -0
  131. package/src/transpile/components/data/form/form-field.transformer.js +443 -0
  132. package/src/transpile/components/data/form/form-field.transformer.js.map +1 -0
  133. package/src/transpile/components/data/form/form-footer.transformer.js +16 -0
  134. package/src/transpile/components/data/form/form-footer.transformer.js.map +1 -0
  135. package/src/transpile/components/data/form/form.transformer.js +166 -0
  136. package/src/transpile/components/data/form/form.transformer.js.map +1 -0
  137. package/src/transpile/components/data/form/util.js +70 -0
  138. package/src/transpile/components/data/form/util.js.map +1 -0
  139. package/src/transpile/components/data/list/list-content.transformer.js +35 -0
  140. package/src/transpile/components/data/list/list-content.transformer.js.map +1 -0
  141. package/src/transpile/components/data/list/list-template-transformer.js +22 -0
  142. package/src/transpile/components/data/list/list-template-transformer.js.map +1 -0
  143. package/src/transpile/components/data/list/list-transformer.js +294 -0
  144. package/src/transpile/components/data/list/list-transformer.js.map +1 -0
  145. package/src/transpile/components/data/live-filter-field.transformer.js +435 -0
  146. package/src/transpile/components/data/live-filter-field.transformer.js.map +1 -0
  147. package/src/transpile/components/data/live-form-shared.js +135 -0
  148. package/src/transpile/components/data/live-form-shared.js.map +1 -0
  149. package/src/transpile/components/data/livefilter.transformer.js +20 -0
  150. package/src/transpile/components/data/livefilter.transformer.js.map +1 -0
  151. package/src/transpile/components/data/liveform.transformer.js +40 -0
  152. package/src/transpile/components/data/liveform.transformer.js.map +1 -0
  153. package/src/transpile/components/data/table/live-table.transformer.js +15 -0
  154. package/src/transpile/components/data/table/live-table.transformer.js.map +1 -0
  155. package/src/transpile/components/data/table/table-action.transformer.js +29 -0
  156. package/src/transpile/components/data/table/table-action.transformer.js.map +1 -0
  157. package/src/transpile/components/data/table/table-column.transformer.js +124 -0
  158. package/src/transpile/components/data/table/table-column.transformer.js.map +1 -0
  159. package/src/transpile/components/data/table/table-group.transformer.js +16 -0
  160. package/src/transpile/components/data/table/table-group.transformer.js.map +1 -0
  161. package/src/transpile/components/data/table/table-row-action.transformer.js +34 -0
  162. package/src/transpile/components/data/table/table-row-action.transformer.js.map +1 -0
  163. package/src/transpile/components/data/table/table-row.transformer.js +37 -0
  164. package/src/transpile/components/data/table/table-row.transformer.js.map +1 -0
  165. package/src/transpile/components/data/table/table.transformer.js +77 -0
  166. package/src/transpile/components/data/table/table.transformer.js.map +1 -0
  167. package/src/transpile/components/data/table/utils.js +229 -0
  168. package/src/transpile/components/data/table/utils.js.map +1 -0
  169. package/src/transpile/components/dialogs/alert-dialog.transformer.js +8 -0
  170. package/src/transpile/components/dialogs/alert-dialog.transformer.js.map +1 -0
  171. package/src/transpile/components/dialogs/confirm-dialog.transformer.js +8 -0
  172. package/src/transpile/components/dialogs/confirm-dialog.transformer.js.map +1 -0
  173. package/src/transpile/components/dialogs/dialog-actions.transformer.js +56 -0
  174. package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -0
  175. package/src/transpile/components/dialogs/dialog-body.transformer.js +13 -0
  176. package/src/transpile/components/dialogs/dialog-body.transformer.js.map +1 -0
  177. package/src/transpile/components/dialogs/dialog-factory.js +18 -0
  178. package/src/transpile/components/dialogs/dialog-factory.js.map +1 -0
  179. package/src/transpile/components/dialogs/dialog.transformer.js +26 -0
  180. package/src/transpile/components/dialogs/dialog.transformer.js.map +1 -0
  181. package/src/transpile/components/dialogs/iframe-dialog.transformer.js +8 -0
  182. package/src/transpile/components/dialogs/iframe-dialog.transformer.js.map +1 -0
  183. package/src/transpile/components/dialogs/login-dialog.transformer.js +44 -0
  184. package/src/transpile/components/dialogs/login-dialog.transformer.js.map +1 -0
  185. package/src/transpile/components/dialogs/page-dialog.transformer.js +16 -0
  186. package/src/transpile/components/dialogs/page-dialog.transformer.js.map +1 -0
  187. package/src/transpile/components/element/html-transformer.js +9 -0
  188. package/src/transpile/components/element/html-transformer.js.map +1 -0
  189. package/src/transpile/components/form/button-group.transformer.js +16 -0
  190. package/src/transpile/components/form/button-group.transformer.js.map +1 -0
  191. package/src/transpile/components/form/button.transformer.js +27 -0
  192. package/src/transpile/components/form/button.transformer.js.map +1 -0
  193. package/src/transpile/components/form/rating.transformer.js +19 -0
  194. package/src/transpile/components/form/rating.transformer.js.map +1 -0
  195. package/src/transpile/components/input/calendar.transformer.js +13 -0
  196. package/src/transpile/components/input/calendar.transformer.js.map +1 -0
  197. package/src/transpile/components/input/checkbox-set.transformer.js +29 -0
  198. package/src/transpile/components/input/checkbox-set.transformer.js.map +1 -0
  199. package/src/transpile/components/input/checkbox.transformer.js +47 -0
  200. package/src/transpile/components/input/checkbox.transformer.js.map +1 -0
  201. package/src/transpile/components/input/chips.transformer.js +23 -0
  202. package/src/transpile/components/input/chips.transformer.js.map +1 -0
  203. package/src/transpile/components/input/color-picker.transformer.js +19 -0
  204. package/src/transpile/components/input/color-picker.transformer.js.map +1 -0
  205. package/src/transpile/components/input/composite.transformer.js +16 -0
  206. package/src/transpile/components/input/composite.transformer.js.map +1 -0
  207. package/src/transpile/components/input/currency.transformer.js +21 -0
  208. package/src/transpile/components/input/currency.transformer.js.map +1 -0
  209. package/src/transpile/components/input/epoch/date.transformer.js +16 -0
  210. package/src/transpile/components/input/epoch/date.transformer.js.map +1 -0
  211. package/src/transpile/components/input/epoch/datetime.transformer.js +16 -0
  212. package/src/transpile/components/input/epoch/datetime.transformer.js.map +1 -0
  213. package/src/transpile/components/input/epoch/time.transformer.js +16 -0
  214. package/src/transpile/components/input/epoch/time.transformer.js.map +1 -0
  215. package/src/transpile/components/input/file-upload.transformer.js +32 -0
  216. package/src/transpile/components/input/file-upload.transformer.js.map +1 -0
  217. package/src/transpile/components/input/number.transformer.js +20 -0
  218. package/src/transpile/components/input/number.transformer.js.map +1 -0
  219. package/src/transpile/components/input/radio-set.transformer.js +25 -0
  220. package/src/transpile/components/input/radio-set.transformer.js.map +1 -0
  221. package/src/transpile/components/input/rating.transformer.js +20 -0
  222. package/src/transpile/components/input/rating.transformer.js.map +1 -0
  223. package/src/transpile/components/input/select.transformer.js +57 -0
  224. package/src/transpile/components/input/select.transformer.js.map +1 -0
  225. package/src/transpile/components/input/slider.transformer.js +28 -0
  226. package/src/transpile/components/input/slider.transformer.js.map +1 -0
  227. package/src/transpile/components/input/switch.transformer.js +21 -0
  228. package/src/transpile/components/input/switch.transformer.js.map +1 -0
  229. package/src/transpile/components/input/text.transformer.js +21 -0
  230. package/src/transpile/components/input/text.transformer.js.map +1 -0
  231. package/src/transpile/components/input/textarea.transformer.js +19 -0
  232. package/src/transpile/components/input/textarea.transformer.js.map +1 -0
  233. package/src/transpile/components/input/upload.transformer.js +19 -0
  234. package/src/transpile/components/input/upload.transformer.js.map +1 -0
  235. package/src/transpile/components/layout/footer.transformer.js +10 -0
  236. package/src/transpile/components/layout/footer.transformer.js.map +1 -0
  237. package/src/transpile/components/layout/header.transformer.js +10 -0
  238. package/src/transpile/components/layout/header.transformer.js.map +1 -0
  239. package/src/transpile/components/layout/layout-region-factory.js +46 -0
  240. package/src/transpile/components/layout/layout-region-factory.js.map +1 -0
  241. package/src/transpile/components/layout/leftnav.transformer.js +10 -0
  242. package/src/transpile/components/layout/leftnav.transformer.js.map +1 -0
  243. package/src/transpile/components/layout/rightnav.transformer.js +10 -0
  244. package/src/transpile/components/layout/rightnav.transformer.js.map +1 -0
  245. package/src/transpile/components/layout/topnav.transformer.js +10 -0
  246. package/src/transpile/components/layout/topnav.transformer.js.map +1 -0
  247. package/src/transpile/components/nav/nav-item.transformer.js +24 -0
  248. package/src/transpile/components/nav/nav-item.transformer.js.map +1 -0
  249. package/src/transpile/components/nav/nav.transformer.js +68 -0
  250. package/src/transpile/components/nav/nav.transformer.js.map +1 -0
  251. package/src/transpile/components/nav/navbar.transformer.js +120 -0
  252. package/src/transpile/components/nav/navbar.transformer.js.map +1 -0
  253. package/src/transpile/components/navigation/breadcrumb.transformer.js +16 -0
  254. package/src/transpile/components/navigation/breadcrumb.transformer.js.map +1 -0
  255. package/src/transpile/components/navigation/menu.transformer.js +36 -0
  256. package/src/transpile/components/navigation/menu.transformer.js.map +1 -0
  257. package/src/transpile/components/navigation/popover.transformer.js +23 -0
  258. package/src/transpile/components/navigation/popover.transformer.js.map +1 -0
  259. package/src/transpile/components/page/build-partial-markup.js +77 -0
  260. package/src/transpile/components/page/build-partial-markup.js.map +1 -0
  261. package/src/transpile/components/page/content.transformer.js +17 -0
  262. package/src/transpile/components/page/content.transformer.js.map +1 -0
  263. package/src/transpile/components/page/page-content.transformer.js +17 -0
  264. package/src/transpile/components/page/page-content.transformer.js.map +1 -0
  265. package/src/transpile/components/page/page.transformer.js +50 -0
  266. package/src/transpile/components/page/page.transformer.js.map +1 -0
  267. package/src/transpile/components/page/partial-container.transformer.js +16 -0
  268. package/src/transpile/components/page/partial-container.transformer.js.map +1 -0
  269. package/src/transpile/components/page/partial.transformer.js +19 -0
  270. package/src/transpile/components/page/partial.transformer.js.map +1 -0
  271. package/src/transpile/components/page/with-partial-container.js +26 -0
  272. package/src/transpile/components/page/with-partial-container.js.map +1 -0
  273. package/src/transpile/components/partial/partial-content.transformer.js +11 -0
  274. package/src/transpile/components/partial/partial-content.transformer.js.map +1 -0
  275. package/src/transpile/components/prefab/prefab-container.transformer.js +32 -0
  276. package/src/transpile/components/prefab/prefab-container.transformer.js.map +1 -0
  277. package/src/transpile/components/prefab/prefab.transformer.js +91 -0
  278. package/src/transpile/components/prefab/prefab.transformer.js.map +1 -0
  279. package/src/transpile/components/transform-register.js +247 -0
  280. package/src/transpile/components/transform-register.js.map +1 -0
  281. package/src/transpile/components/utils.js +367 -0
  282. package/src/transpile/components/utils.js.map +1 -0
  283. package/src/transpile/components/wmx-component/wmx-component.transformer.js +35 -0
  284. package/src/transpile/components/wmx-component/wmx-component.transformer.js.map +1 -0
  285. package/src/transpile/id-generator.js +87 -0
  286. package/src/transpile/id-generator.js.map +1 -0
  287. package/src/transpile/index.js +65 -0
  288. package/src/transpile/index.js.map +1 -0
  289. package/src/transpile/property/base-parser.js +13 -0
  290. package/src/transpile/property/base-parser.js.map +1 -0
  291. package/src/transpile/property/property-parser.js +278 -0
  292. package/src/transpile/property/property-parser.js.map +1 -0
  293. package/src/transpile/property/show-in-device.parser.js +17 -0
  294. package/src/transpile/property/show-in-device.parser.js.map +1 -0
  295. package/src/transpile/serialize-variables.js +322 -0
  296. package/src/transpile/serialize-variables.js.map +1 -0
  297. package/src/transpile/style/background-image.parser.js +20 -0
  298. package/src/transpile/style/background-image.parser.js.map +1 -0
  299. package/src/transpile/style/border-width.parser.js +20 -0
  300. package/src/transpile/style/border-width.parser.js.map +1 -0
  301. package/src/transpile/style/dimension-style.parser.js +70 -0
  302. package/src/transpile/style/dimension-style.parser.js.map +1 -0
  303. package/src/transpile/style/horizontal-align.parser.js +24 -0
  304. package/src/transpile/style/horizontal-align.parser.js.map +1 -0
  305. package/src/transpile/style/margin.parser.js +20 -0
  306. package/src/transpile/style/margin.parser.js.map +1 -0
  307. package/src/transpile/style/multi-dimension-style.parser.js +29 -0
  308. package/src/transpile/style/multi-dimension-style.parser.js.map +1 -0
  309. package/src/transpile/style/numeric-style.parser.js +18 -0
  310. package/src/transpile/style/numeric-style.parser.js.map +1 -0
  311. package/src/transpile/style/padding.parser.js +20 -0
  312. package/src/transpile/style/padding.parser.js.map +1 -0
  313. package/src/transpile/style/split-css-shorthand.js +60 -0
  314. package/src/transpile/style/split-css-shorthand.js.map +1 -0
  315. package/src/transpile/style/style.parser.js +15 -0
  316. package/src/transpile/style/style.parser.js.map +1 -0
  317. package/src/transpile/style.transformer.js +124 -0
  318. package/src/transpile/style.transformer.js.map +1 -0
  319. package/src/transpile/transform-markup.js +286 -0
  320. package/src/transpile/transform-markup.js.map +1 -0
  321. package/src/transpile/transpile-variables.js +35 -0
  322. package/src/transpile/transpile-variables.js.map +1 -0
  323. package/src/transpile/transpile.js +1349 -0
  324. package/src/transpile/transpile.js.map +1 -0
  325. package/src/transpile/transpiler.js +30 -0
  326. package/src/transpile/transpiler.js.map +1 -0
  327. package/src/transpile/variables-template-source.js +6 -0
  328. package/src/transpile/variables-template-source.js.map +1 -0
  329. package/src/transpile/variables-template.js +15 -0
  330. package/src/transpile/variables-template.js.map +1 -0
  331. package/src/transpile/widget-inline-style-constants.js +203 -0
  332. package/src/transpile/widget-inline-style-constants.js.map +1 -0
  333. package/src/transpile/widget-inline-style-processor.js +732 -0
  334. package/src/transpile/widget-inline-style-processor.js.map +1 -0
  335. package/src/types/index.js +6 -0
  336. package/src/types/index.js.map +1 -0
  337. package/src/utils/grouping-util.js +528 -0
  338. package/src/utils/grouping-util.js.map +1 -0
  339. package/src/utils.browser.js +903 -0
  340. package/src/utils.browser.js.map +1 -0
  341. package/src/utils.js +835 -0
  342. package/src/utils.js.map +1 -0
  343. package/src/variables/variable.transformer.js +736 -0
  344. package/src/variables/variable.transformer.js.map +1 -0
  345. package/src/wmx.generator.js +216 -0
  346. package/src/wmx.generator.js.map +1 -0
  347. package/templates/.DS_Store +0 -0
  348. package/templates/app.style.template +3 -0
  349. package/templates/app.variables.template +1 -0
  350. package/templates/component/app.libs.hbs +38 -0
  351. package/templates/component/app.script.hbs +8 -0
  352. package/templates/component/app.template.hbs +47 -0
  353. package/templates/component/component.hbs +80 -0
  354. package/templates/component/component.props.template +1 -0
  355. package/templates/component/formatter.hbs +8 -0
  356. package/templates/component/layout.hbs +33 -0
  357. package/templates/component/page.hbs +16 -0
  358. package/templates/component/partial.hbs +70 -0
  359. package/templates/component/script.template +6 -0
  360. package/templates/component/style-def.template +18 -0
  361. package/templates/component/style.template +1 -0
  362. package/templates/entity-provider.template +21 -0
  363. package/templates/foundation/layout.tsx +30 -0
  364. package/templates/pages-config.template +12 -0
  365. package/templates/partial-config.template +58 -0
  366. package/templates/project/.DS_Store +0 -0
  367. package/templates/project/.env +1 -0
  368. package/templates/project/.gitignore +2 -0
  369. package/templates/project/.prettierrc +8 -0
  370. package/templates/project/README.md +60 -0
  371. package/templates/project/app/autoLayout.css +134 -0
  372. package/templates/project/app/client.layout.tsx +193 -0
  373. package/templates/project/app/components.css +292 -0
  374. package/templates/project/app/error.tsx +27 -0
  375. package/templates/project/app/globals.css +5 -0
  376. package/templates/project/app/layout.tsx +40 -0
  377. package/templates/project/app/loading.tsx +6 -0
  378. package/templates/project/app/page.tsx +3 -0
  379. package/templates/project/app/widgetInlineStylesOverride.css +1031 -0
  380. package/templates/project/app/wm-globals.css +152 -0
  381. package/templates/project/app/wm-styles.css +4 -0
  382. package/templates/project/hooks/usePageEvents.tsx +45 -0
  383. package/templates/project/libs/appConfig.ts +14 -0
  384. package/templates/project/next-env.d.ts +5 -0
  385. package/templates/project/next.config.ts +17 -0
  386. package/templates/project/package-lock.json +5397 -0
  387. package/templates/project/package.json +41 -0
  388. package/templates/project/public/error-fallback.svg +89 -0
  389. package/templates/project/public/file.svg +1 -0
  390. package/templates/project/public/globe.svg +1 -0
  391. package/templates/project/public/next.svg +1 -0
  392. package/templates/project/public/vercel.svg +1 -0
  393. package/templates/project/public/window.svg +1 -0
  394. package/templates/project/scripts/app-custom-server.js +44 -0
  395. package/templates/project/scripts/getlibs.js +53 -0
  396. package/templates/project/tsconfig.json +36 -0
  397. package/templates/project/types/runtime-config.d.ts +9 -0
  398. package/templates/resource.resolver.template +20 -0
  399. package/templates/service.defs.template +3 -0
  400. package/templates/variables.template +255 -0
@@ -0,0 +1,903 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractScriptAndLinkTags = exports.extractInteractiveContainerDiv = exports.htmlToJsx = exports.convertStyleStringToObject = exports.OVERRIDE_TOKENS_PATH = exports.APP_OVERRIDE_CSS_PATH = exports.DESIGN_TOKENS_DIR_NAME = exports.htmlElements = exports.fixURLPathAndScope = exports.scopeCssUnderWmApp = exports.buildCssScopeClass = exports.modifyExpression = exports.convertHyphenatedPropsToBracketNotation = exports.transformAppLocale = exports.fixURLPath = exports.addOptionalChaining = exports.addOptionalChainingToPropertyPath = void 0;
4
+ exports.isValid = isValid;
5
+ exports.isJSExpression = isJSExpression;
6
+ const parser_1 = require("@babel/parser");
7
+ const node_html_parser_1 = require("node-html-parser");
8
+ function isValid(expr) {
9
+ try {
10
+ (0, parser_1.parse)(expr, { sourceType: "module", plugins: ["optionalChaining"] });
11
+ return true;
12
+ }
13
+ catch (_a) {
14
+ return false;
15
+ }
16
+ }
17
+ function isJSExpression(expr) {
18
+ try {
19
+ (0, parser_1.parseExpression)(expr, { sourceType: "module", plugins: ["optionalChaining"] });
20
+ return true;
21
+ }
22
+ catch (_a) {
23
+ return false;
24
+ }
25
+ }
26
+ /**
27
+ * Finds the closing `]` for `[` at `openIdx` using bracket nesting depth.
28
+ * Used so property paths inside computed keys (`dataSet[outer[inner]]`) are not truncated.
29
+ */
30
+ const findMatchingBracketEnd = (str, openIdx) => {
31
+ if (openIdx >= str.length || str[openIdx] !== "[")
32
+ return -1;
33
+ let depth = 0;
34
+ for (let p = openIdx; p < str.length; p++) {
35
+ const c = str[p];
36
+ if (c === "[")
37
+ depth++;
38
+ else if (c === "]") {
39
+ depth--;
40
+ if (depth === 0)
41
+ return p;
42
+ }
43
+ }
44
+ return -1;
45
+ };
46
+ /**
47
+ * Extends a property-access path from `start` (must point at the first char of an identifier):
48
+ * `a.b[c[d]].e` — includes balanced bracket segments (not `\[[^\]]+\]`).
49
+ */
50
+ const extendPropertyAccessPath = (str, start) => {
51
+ let i = start;
52
+ if (i >= str.length || !/[a-zA-Z_$]/.test(str[i]))
53
+ return null;
54
+ i++;
55
+ while (i < str.length && /[a-zA-Z0-9_$]/.test(str[i]))
56
+ i++;
57
+ let end = i;
58
+ while (end < str.length) {
59
+ if (str[end] === ".") {
60
+ if (end + 1 >= str.length || !/[a-zA-Z_$]/.test(str[end + 1]))
61
+ break;
62
+ let j = end + 2;
63
+ while (j < str.length && /[a-zA-Z0-9_$]/.test(str[j]))
64
+ j++;
65
+ end = j;
66
+ }
67
+ else if (str[end] === "[") {
68
+ const rb = findMatchingBracketEnd(str, end);
69
+ if (rb === -1)
70
+ break;
71
+ end = rb + 1;
72
+ }
73
+ else {
74
+ break;
75
+ }
76
+ }
77
+ return { end, text: str.substring(start, end) };
78
+ };
79
+ const collectPropertyPathMatches = (searchStr) => {
80
+ const matches = [];
81
+ let idx = 0;
82
+ while (idx < searchStr.length) {
83
+ const ch = searchStr[idx];
84
+ if (/[a-zA-Z_$]/.test(ch)) {
85
+ const prev = idx > 0 ? searchStr[idx - 1] : "";
86
+ const prevIsIdent = /[a-zA-Z0-9_$]/.test(prev);
87
+ if (!prevIsIdent) {
88
+ const ext = extendPropertyAccessPath(searchStr, idx);
89
+ if (ext && ext.text.length > 0) {
90
+ matches.push({ start: idx, end: ext.end, text: ext.text });
91
+ idx = ext.end;
92
+ continue;
93
+ }
94
+ }
95
+ }
96
+ idx++;
97
+ }
98
+ return matches;
99
+ };
100
+ const addOptionalChainingToPropertyPath = (propertyPath) => {
101
+ var _a;
102
+ // Split the path into meaningful parts while preserving structure
103
+ const parts = [];
104
+ let current = "";
105
+ let i = 0;
106
+ // Handle the first part specially (no optional chaining at the start)
107
+ while (i < propertyPath.length && propertyPath[i] !== "." && propertyPath[i] !== "[") {
108
+ current += propertyPath[i];
109
+ i++;
110
+ }
111
+ if (current) {
112
+ parts.push({ type: "prop", content: current });
113
+ current = "";
114
+ }
115
+ while (i < propertyPath.length) {
116
+ if (propertyPath[i] === ".") {
117
+ i++; // Skip the dot
118
+ current = "";
119
+ while (i < propertyPath.length && propertyPath[i] !== "." && propertyPath[i] !== "[") {
120
+ current += propertyPath[i];
121
+ i++;
122
+ }
123
+ if (current) {
124
+ parts.push({ type: "prop", content: `.${current}` });
125
+ current = "";
126
+ }
127
+ }
128
+ else if (propertyPath[i] === "[") {
129
+ i++; // Skip the opening bracket
130
+ let bracketContent = "";
131
+ let nestedBracketLevel = 0;
132
+ // Handle nested brackets properly
133
+ while (i < propertyPath.length) {
134
+ if (propertyPath[i] === "[") {
135
+ nestedBracketLevel++;
136
+ bracketContent += propertyPath[i];
137
+ }
138
+ else if (propertyPath[i] === "]") {
139
+ if (nestedBracketLevel === 0) {
140
+ break; // Found the matching closing bracket
141
+ }
142
+ nestedBracketLevel--;
143
+ bracketContent += propertyPath[i];
144
+ }
145
+ else {
146
+ bracketContent += propertyPath[i];
147
+ }
148
+ i++;
149
+ }
150
+ if (i < propertyPath.length) {
151
+ parts.push({ type: "bracket", content: bracketContent });
152
+ i++; // Skip the closing bracket
153
+ }
154
+ }
155
+ else {
156
+ i++; // Skip any unexpected characters
157
+ }
158
+ }
159
+ // Helper to process only property paths within bracket content, preserving bracket structure
160
+ const processBracketContent = (content) => {
161
+ const trimmed = content.trim();
162
+ // Skip if it's a string literal or numeric index
163
+ if (trimmed.startsWith("'") || trimmed.startsWith('"'))
164
+ return content;
165
+ if (/^\d+$/.test(trimmed))
166
+ return content;
167
+ // If it contains nested brackets, process property paths within them
168
+ if (trimmed.includes("[")) {
169
+ // Find property paths (identifier.identifier) and process only those parts
170
+ // Example: "data[Widgets.form.value]" -> "data[Widgets?.form?.value]"
171
+ // Example: "items[0]" -> "items[0]" (no change)
172
+ // Use regex to find and replace property paths, preserving bracket structure
173
+ const propertyPathRegex = /([a-zA-Z_$][a-zA-Z0-9_$]*\.[a-zA-Z_$][a-zA-Z0-9_$]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)*)/g;
174
+ return trimmed.replace(propertyPathRegex, match => {
175
+ // Process only the property path part (the part with dots)
176
+ return (0, exports.addOptionalChainingToPropertyPath)(match);
177
+ });
178
+ }
179
+ // Check if it's a property path (contains dots after identifier)
180
+ if (/^[a-zA-Z_$][a-zA-Z0-9_$]*\.[a-zA-Z_$]/.test(trimmed)) {
181
+ return (0, exports.addOptionalChainingToPropertyPath)(content);
182
+ }
183
+ // Simple identifier or other - leave as is
184
+ return content;
185
+ };
186
+ // Add optional chaining
187
+ let result = ((_a = parts[0]) === null || _a === void 0 ? void 0 : _a.content) || "";
188
+ for (let j = 1; j < parts.length; j++) {
189
+ const part = parts[j];
190
+ if (part.type === "bracket") {
191
+ // Process bracket content - only property paths get optional chaining
192
+ const processedContent = processBracketContent(part.content);
193
+ result += `?.[${processedContent}]`;
194
+ }
195
+ else if (part.content.startsWith(".")) {
196
+ result += `?${part.content}`;
197
+ }
198
+ }
199
+ return result;
200
+ };
201
+ exports.addOptionalChainingToPropertyPath = addOptionalChainingToPropertyPath;
202
+ const addOptionalChaining = (bindPath, options = {}) => {
203
+ const { targetPattern, addFallback = false, fallbackValue = '""', detectFunctionCalls = false, } = options;
204
+ // Helper to find balanced parentheses
205
+ const findBalancedParens = (str, start) => {
206
+ let depth = 0;
207
+ for (let i = start; i < str.length; i++) {
208
+ if (str[i] === "(")
209
+ depth++;
210
+ else if (str[i] === ")") {
211
+ depth--;
212
+ if (depth === 0)
213
+ return i;
214
+ }
215
+ }
216
+ return -1;
217
+ };
218
+ // Step 1: Extract and protect string literals
219
+ const stringLiterals = [];
220
+ let protectedExpression = bindPath.replace(/"[^"]*"|'[^']*'/g, match => {
221
+ const placeholder = `__STRING_${stringLiterals.length}__`;
222
+ stringLiterals.push(match);
223
+ return placeholder;
224
+ });
225
+ // Step 1.5: Extract and protect function arguments (including arrow functions)
226
+ // This prevents processing property paths inside function arguments
227
+ const functionArgs = [];
228
+ let argProtectedExpression = protectedExpression;
229
+ // Find all function calls and protect their arguments
230
+ let funcArgIndex = 0;
231
+ let i = 0;
232
+ while (i < argProtectedExpression.length) {
233
+ if (argProtectedExpression[i] === "(") {
234
+ const parenStart = i;
235
+ const parenEnd = findBalancedParens(argProtectedExpression, i);
236
+ if (parenEnd !== -1) {
237
+ const argsContent = argProtectedExpression.substring(parenStart + 1, parenEnd);
238
+ // Only protect if there's actual content (not empty parentheses)
239
+ if (argsContent.trim()) {
240
+ const placeholder = `__FUNCARG_${funcArgIndex}__`;
241
+ functionArgs.push(argsContent);
242
+ argProtectedExpression =
243
+ argProtectedExpression.substring(0, parenStart + 1) +
244
+ placeholder +
245
+ argProtectedExpression.substring(parenEnd);
246
+ funcArgIndex++;
247
+ i = parenStart + placeholder.length + 1;
248
+ continue;
249
+ }
250
+ }
251
+ }
252
+ i++;
253
+ }
254
+ // Step 2: Process property access patterns, handling function calls
255
+ // Default matcher must use balanced `[`…`]` so nested computed keys do not truncate
256
+ // (regex `\[[^\]]+\]` breaks on `dataSet[foo[bar].baz]`).
257
+ let result = argProtectedExpression;
258
+ let matches = [];
259
+ if (targetPattern) {
260
+ targetPattern.lastIndex = 0;
261
+ let match;
262
+ while ((match = targetPattern.exec(argProtectedExpression)) !== null) {
263
+ matches.push({
264
+ start: match.index,
265
+ end: match.index + match[0].length,
266
+ text: match[0],
267
+ });
268
+ }
269
+ }
270
+ else {
271
+ matches = collectPropertyPathMatches(argProtectedExpression);
272
+ }
273
+ // Process matches in reverse order to maintain indices
274
+ for (let i = matches.length - 1; i >= 0; i--) {
275
+ const m = matches[i];
276
+ let processed = (0, exports.addOptionalChainingToPropertyPath)(m.text);
277
+ // Check if there's a function call immediately after this match
278
+ const afterMatch = argProtectedExpression.substring(m.end);
279
+ const funcCallMatch = afterMatch.match(/^\s*\(/);
280
+ if (funcCallMatch) {
281
+ // Find the closing parenthesis
282
+ const parenEnd = findBalancedParens(argProtectedExpression, m.end + funcCallMatch[0].length - 1);
283
+ if (parenEnd !== -1) {
284
+ const funcCall = argProtectedExpression.substring(m.end, parenEnd + 1);
285
+ processed += funcCall;
286
+ // Check if there's property access after the function call
287
+ const afterFunc = argProtectedExpression.substring(parenEnd + 1);
288
+ const propAccessMatch = afterFunc.match(/^\s*\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);
289
+ if (propAccessMatch) {
290
+ processed += `?.${propAccessMatch[1]}`;
291
+ // Update the match end to include the function call and property
292
+ matches[i].end = parenEnd + 1 + propAccessMatch[0].length;
293
+ }
294
+ else {
295
+ matches[i].end = parenEnd + 1;
296
+ }
297
+ }
298
+ }
299
+ // Replace in result
300
+ result = result.substring(0, m.start) + processed + result.substring(m.end);
301
+ }
302
+ // Step 3: Add optional chaining after closing parentheses/brackets that are followed by property access
303
+ // This handles cases like:
304
+ // - obj.method().prop
305
+ // - (expr | pipe)[0].url
306
+ // - (expr)[0].url
307
+ result = result.replace(/(\))\s*\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g, "$1?.$2");
308
+ result = result.replace(/(\))\s*\[/g, "$1?.[");
309
+ result = result.replace(/(\])\s*\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g, "$1?.$2");
310
+ result = result.replace(/(\])\s*\[/g, "$1?.[");
311
+ // Step 4: Restore function arguments and process property paths in them
312
+ functionArgs.forEach((arg, index) => {
313
+ let processedArg = arg;
314
+ // Process arrow function bodies (parts after =>)
315
+ const arrowMatch = arg.match(/^([^=]*)=>\s*(.+)$/);
316
+ if (arrowMatch) {
317
+ const [, params, body] = arrowMatch;
318
+ // Process property paths in the arrow function body
319
+ const processedBody = (0, exports.addOptionalChaining)(body);
320
+ processedArg = `${params}=> ${processedBody}`;
321
+ }
322
+ else {
323
+ // Not an arrow function - recursively process with addOptionalChaining
324
+ // This handles nested brackets properly
325
+ processedArg = (0, exports.addOptionalChaining)(arg);
326
+ }
327
+ result = result.replace(`__FUNCARG_${index}__`, processedArg);
328
+ });
329
+ // Step 5: Restore string literals
330
+ stringLiterals.forEach((literal, index) => {
331
+ result = result.replace(`__STRING_${index}__`, literal);
332
+ });
333
+ // Step 6: Add fallback handling if requested
334
+ if (addFallback) {
335
+ if (detectFunctionCalls) {
336
+ const hasFunctionCall = /\([^)]*\)\s*$/.test(result);
337
+ if (!hasFunctionCall) {
338
+ result = `(${result} || ${fallbackValue})`;
339
+ }
340
+ }
341
+ else {
342
+ result = `(${result} || ${fallbackValue})`;
343
+ }
344
+ }
345
+ return result;
346
+ };
347
+ exports.addOptionalChaining = addOptionalChaining;
348
+ const fixURLPath = (file_content, basePath, isAppCss) => {
349
+ // Fix resources URLs
350
+ let updatedContent = file_content.replace(/url\((['"]?)resources/g, `url($1${basePath || ""}/resources`);
351
+ // Fix font URLs and other URLs that need leading slash
352
+ // This regex matches url() with single or double quotes that don't start with /, http, or data:
353
+ if (isAppCss) {
354
+ updatedContent = updatedContent.replace(/url\((['"])(?!\/|http|data:)([^'"]+)\1\)/g, (match, quote, url) => {
355
+ // Add leading slash if the URL doesn't already have one
356
+ // Check if URL already starts with / (absolute path)
357
+ const fixedUrl = url.startsWith("/") ? url : `/${url}`;
358
+ return `url(${quote}${fixedUrl}${quote})`;
359
+ });
360
+ }
361
+ return updatedContent;
362
+ };
363
+ exports.fixURLPath = fixURLPath;
364
+ const transformAppLocale = (exp) => {
365
+ if (exp.startsWith("fragment?.Prefab") || exp.startsWith("fragment.Prefab")) {
366
+ exp = exp.replace("fragment?.Prefab", "fragment");
367
+ exp = exp.replace("fragment.Prefab", "fragment");
368
+ }
369
+ // Updated regex to capture the optional 'fragment.' prefix
370
+ const appLocaleRegex = /(fragment\.)?appLocale(?:\.messages)?(?:\[(['"])([^'"]+)\2\]|\.([a-zA-Z0-9_]+))/g;
371
+ // We use a replacer function with .replace() to have full control over the output.
372
+ // This function is called for every match found by the regex.
373
+ const replacer = (fullMatch, fragmentPrefix, quoteType, keyFromBrackets, keyFromDot) => {
374
+ // The key will either be from the bracket capture group or the dot capture group.
375
+ const key = keyFromBrackets || keyFromDot;
376
+ if (key) {
377
+ // If there's a fragment prefix, include it in the formatMessage call
378
+ if (fragmentPrefix) {
379
+ return `formatMessage(fragment, '${key}')`;
380
+ }
381
+ else {
382
+ return `formatMessage('${key}')`;
383
+ }
384
+ }
385
+ // Fallback to return the original match if key extraction fails (unlikely)
386
+ return fullMatch;
387
+ };
388
+ // Apply the transformation
389
+ const expression = exp.replace(appLocaleRegex, replacer);
390
+ return expression;
391
+ };
392
+ exports.transformAppLocale = transformAppLocale;
393
+ /**
394
+ * Converts property paths with hyphens to bracket notation for valid JavaScript.
395
+ * e.g. Actions.goToPage_test-page.invoke() -> Actions["goToPage_test-page"].invoke()
396
+ * Hyphens in identifiers are invalid in JS (parsed as subtraction), so we use bracket notation.
397
+ */
398
+ const convertHyphenatedPropsToBracketNotation = (expr) => {
399
+ if (!expr || typeof expr !== "string")
400
+ return expr;
401
+ // Match .identifier where identifier contains hyphen (e.g. .goToPage_test-page, .my-var)
402
+ return expr.replace(/\.([a-zA-Z_$][a-zA-Z0-9_$]*-[a-zA-Z_$][a-zA-Z0-9_$\-]*)/g, (_, propName) => {
403
+ return `["${propName}"]`;
404
+ });
405
+ };
406
+ exports.convertHyphenatedPropsToBracketNotation = convertHyphenatedPropsToBracketNotation;
407
+ const modifyExpression = (exp) => {
408
+ if (exp.startsWith('"http') || exp.startsWith('"/') || exp.startsWith("{")) {
409
+ return exp;
410
+ }
411
+ if (!isValid(exp))
412
+ return `""`;
413
+ if (exp.includes("appLocale")) {
414
+ const transformedExp = (0, exports.transformAppLocale)(exp);
415
+ return (0, exports.addOptionalChaining)(transformedExp);
416
+ }
417
+ else {
418
+ return (0, exports.addOptionalChaining)(exp);
419
+ }
420
+ };
421
+ exports.modifyExpression = modifyExpression;
422
+ const DISABLE_SCOPING_MARKER = "/*DISABLE_SCOPING*/";
423
+ const buildCssScopeClass = (scopeType, name) => {
424
+ const lowerName = name.toLowerCase();
425
+ switch (scopeType) {
426
+ case "page":
427
+ return `app-page-${lowerName}`;
428
+ case "partial":
429
+ return `app-partial-${lowerName}`;
430
+ case "prefab":
431
+ return `app-prefab-${lowerName}`;
432
+ }
433
+ };
434
+ exports.buildCssScopeClass = buildCssScopeClass;
435
+ const removeLeadingCssBlockComments = (rule) => {
436
+ let idx = 0;
437
+ const len = rule.length;
438
+ let prefix = "";
439
+ while (idx < len) {
440
+ const wsStart = idx;
441
+ while (idx < len && /\s/.test(rule.charAt(idx))) {
442
+ idx++;
443
+ }
444
+ prefix += rule.slice(wsStart, idx);
445
+ if (idx > len - 2 || rule.charAt(idx) !== "/" || rule.charAt(idx + 1) !== "*") {
446
+ break;
447
+ }
448
+ const commentStart = idx;
449
+ idx += 2;
450
+ let closed = false;
451
+ while (idx < len - 1) {
452
+ if (rule.charAt(idx) === "*" && rule.charAt(idx + 1) === "/") {
453
+ idx += 2;
454
+ closed = true;
455
+ break;
456
+ }
457
+ idx++;
458
+ }
459
+ if (!closed) {
460
+ return { prefix: "", rest: rule };
461
+ }
462
+ prefix += rule.slice(commentStart, idx);
463
+ }
464
+ return { prefix, rest: rule.slice(idx) };
465
+ };
466
+ const scopeSingleSelector = (selector, scopeClass) => {
467
+ const sel = selector.trim();
468
+ if (!sel) {
469
+ return sel;
470
+ }
471
+ if (sel.startsWith(":")) {
472
+ return sel;
473
+ }
474
+ const wmAppIndex = sel.search(/\.wm-app\b/);
475
+ if (wmAppIndex !== -1) {
476
+ if (sel.includes(`.${scopeClass}`)) {
477
+ return sel;
478
+ }
479
+ return sel.replace(/\.wm-app\b/, `.wm-app .${scopeClass}`);
480
+ }
481
+ return `.wm-app .${scopeClass} ${sel}`;
482
+ };
483
+ const splitCssIntoRules = (cssContent) => {
484
+ const rules = [];
485
+ let currentRule = "";
486
+ let inComment = false;
487
+ let inString = false;
488
+ let stringChar = "";
489
+ let braceLevel = 0;
490
+ for (let i = 0; i < cssContent.length; i++) {
491
+ const char = cssContent[i];
492
+ const nextChar = cssContent[i + 1];
493
+ // Handle comments
494
+ if (!inString && char === "/" && nextChar === "*") {
495
+ inComment = true;
496
+ currentRule += char;
497
+ continue;
498
+ }
499
+ if (inComment && char === "*" && nextChar === "/") {
500
+ inComment = false;
501
+ currentRule += char;
502
+ continue;
503
+ }
504
+ if (inComment) {
505
+ currentRule += char;
506
+ continue;
507
+ }
508
+ // Handle strings
509
+ if (!inString && (char === '"' || char === "'")) {
510
+ inString = true;
511
+ stringChar = char;
512
+ currentRule += char;
513
+ continue;
514
+ }
515
+ if (inString && char === stringChar && cssContent[i - 1] !== "\\") {
516
+ inString = false;
517
+ stringChar = "";
518
+ currentRule += char;
519
+ continue;
520
+ }
521
+ if (inString) {
522
+ currentRule += char;
523
+ continue;
524
+ }
525
+ // Handle braces to track rule boundaries
526
+ if (char === "{") {
527
+ braceLevel++;
528
+ currentRule += char;
529
+ }
530
+ else if (char === "}") {
531
+ braceLevel--;
532
+ currentRule += char;
533
+ // If we're back to level 0, we've completed a rule
534
+ if (braceLevel === 0) {
535
+ rules.push(currentRule.trim());
536
+ currentRule = "";
537
+ }
538
+ }
539
+ else {
540
+ currentRule += char;
541
+ }
542
+ }
543
+ // Add any remaining content
544
+ if (currentRule.trim()) {
545
+ rules.push(currentRule.trim());
546
+ }
547
+ return rules;
548
+ };
549
+ const scopeCssUnderWmApp = (cssContent, scopeOptions) => {
550
+ if (!cssContent || cssContent.trim() === "") {
551
+ return cssContent;
552
+ }
553
+ if (!scopeOptions) {
554
+ return cssContent;
555
+ }
556
+ if (cssContent.trimStart().startsWith(DISABLE_SCOPING_MARKER)) {
557
+ return cssContent;
558
+ }
559
+ const scopeClass = (0, exports.buildCssScopeClass)(scopeOptions.scopeType, scopeOptions.name);
560
+ const rules = splitCssIntoRules(cssContent);
561
+ const processedRules = rules.map(rule => {
562
+ if (!rule) {
563
+ return rule;
564
+ }
565
+ const { prefix, rest } = removeLeadingCssBlockComments(rule);
566
+ const body = rest;
567
+ if (!body.trim()) {
568
+ return rule;
569
+ }
570
+ if (body.startsWith("@import") || body.startsWith("@charset")) {
571
+ return rule;
572
+ }
573
+ if (body.startsWith("@")) {
574
+ return rule;
575
+ }
576
+ const openBraceIndex = body.indexOf("{");
577
+ if (openBraceIndex === -1) {
578
+ return rule;
579
+ }
580
+ const selector = body.substring(0, openBraceIndex).trim();
581
+ const declarations = body.substring(openBraceIndex);
582
+ const selectors = selector.split(",").map(s => s.trim());
583
+ const scopedSelectors = selectors.map(sel => scopeSingleSelector(sel, scopeClass));
584
+ return `${prefix}${scopedSelectors.join(", ")} ${declarations}`;
585
+ });
586
+ return processedRules.join("\n");
587
+ };
588
+ exports.scopeCssUnderWmApp = scopeCssUnderWmApp;
589
+ const fixURLPathAndScope = (file_content, basePath, isAppCss, scopeOptions) => {
590
+ const urlFixed = (0, exports.fixURLPath)(file_content, basePath, isAppCss);
591
+ return (0, exports.scopeCssUnderWmApp)(urlFixed, scopeOptions);
592
+ };
593
+ exports.fixURLPathAndScope = fixURLPathAndScope;
594
+ exports.htmlElements = [
595
+ "header",
596
+ "footer",
597
+ "main",
598
+ "section",
599
+ "article",
600
+ "aside",
601
+ "nav",
602
+ "div",
603
+ "span",
604
+ "p",
605
+ "a",
606
+ "img",
607
+ "button",
608
+ "input",
609
+ "textarea",
610
+ "select",
611
+ "option",
612
+ "label",
613
+ "form",
614
+ "table",
615
+ "tbody",
616
+ "tr",
617
+ "td",
618
+ "th",
619
+ "ul",
620
+ "li",
621
+ "ol",
622
+ "h1",
623
+ "h2",
624
+ "h3",
625
+ "h4",
626
+ "h5",
627
+ "h6",
628
+ "iframe",
629
+ ];
630
+ exports.DESIGN_TOKENS_DIR_NAME = "design-tokens";
631
+ exports.APP_OVERRIDE_CSS_PATH = `${exports.DESIGN_TOKENS_DIR_NAME}/app.override.css`;
632
+ exports.OVERRIDE_TOKENS_PATH = `${exports.DESIGN_TOKENS_DIR_NAME}/overrides`;
633
+ const getExistingImportUrls = (layoutContent) => {
634
+ const existingUrls = new Set();
635
+ try {
636
+ const parsed = (0, node_html_parser_1.parse)(layoutContent);
637
+ const traverseNodes = (node) => {
638
+ var _a;
639
+ if (node.nodeType === node_html_parser_1.NodeType.ELEMENT_NODE) {
640
+ const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
641
+ if (tagName === "script" || tagName === "link") {
642
+ const url = node.getAttribute("src") || node.getAttribute("href") || "";
643
+ if (url) {
644
+ existingUrls.add(url);
645
+ }
646
+ }
647
+ if (node.childNodes) {
648
+ node.childNodes.forEach((child) => {
649
+ traverseNodes(child);
650
+ });
651
+ }
652
+ }
653
+ };
654
+ parsed.childNodes.forEach((node) => {
655
+ traverseNodes(node);
656
+ });
657
+ }
658
+ catch (error) {
659
+ // If parsing fails, return empty set
660
+ }
661
+ return existingUrls;
662
+ };
663
+ /**
664
+ * HTML attribute names that need to be converted for JSX compatibility
665
+ */
666
+ const HTML_TO_JSX_ATTR_MAP = {
667
+ class: "className",
668
+ for: "htmlFor",
669
+ tabindex: "tabIndex",
670
+ readonly: "readOnly",
671
+ autofocus: "autoFocus",
672
+ autoplay: "autoPlay",
673
+ crossorigin: "crossOrigin",
674
+ maxlength: "maxLength",
675
+ minlength: "minLength",
676
+ spellcheck: "spellCheck",
677
+ };
678
+ /**
679
+ * Void elements that must be self-closing in JSX
680
+ */
681
+ const VOID_ELEMENTS = new Set([
682
+ "area",
683
+ "base",
684
+ "br",
685
+ "col",
686
+ "embed",
687
+ "hr",
688
+ "img",
689
+ "input",
690
+ "link",
691
+ "meta",
692
+ "param",
693
+ "source",
694
+ "track",
695
+ "wbr",
696
+ ]);
697
+ /**
698
+ * Converts CSS style string to React style object format
699
+ * Example: "color:#ffffff; font-size:14px" -> {color:"#ffffff",fontSize:"14px"}
700
+ */
701
+ const convertStyleStringToObject = (styleString) => {
702
+ if (!styleString || styleString.trim() === "") {
703
+ return "{}";
704
+ }
705
+ const styleObject = {};
706
+ styleString.split(";").forEach(rule => {
707
+ const colonIndex = rule.indexOf(":");
708
+ if (colonIndex > 0) {
709
+ const property = rule.substring(0, colonIndex).trim();
710
+ const value = rule.substring(colonIndex + 1).trim();
711
+ if (property && value) {
712
+ const camelCaseProperty = property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
713
+ styleObject[camelCaseProperty] = value;
714
+ }
715
+ }
716
+ });
717
+ return JSON.stringify(styleObject);
718
+ };
719
+ exports.convertStyleStringToObject = convertStyleStringToObject;
720
+ /**
721
+ * Converts HTML string to JSX-compatible format (class->className, style->style object, etc.)
722
+ * @param htmlString The HTML string to convert
723
+ * @returns JSX-compatible string
724
+ */
725
+ const htmlToJsx = (htmlString) => {
726
+ if (!htmlString || typeof htmlString !== "string") {
727
+ return "";
728
+ }
729
+ try {
730
+ const parsed = (0, node_html_parser_1.parse)(htmlString);
731
+ const nodeToJsx = (node) => {
732
+ var _a, _b;
733
+ if (node.nodeType === node_html_parser_1.NodeType.TEXT_NODE) {
734
+ return node.text || "";
735
+ }
736
+ if (node.nodeType !== node_html_parser_1.NodeType.ELEMENT_NODE) {
737
+ return "";
738
+ }
739
+ const tagName = ((_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || "div";
740
+ const isVoid = VOID_ELEMENTS.has(tagName);
741
+ const attrs = [];
742
+ const attributes = node.attributes || node.attrs || {};
743
+ if (Object.keys(attributes).length > 0) {
744
+ for (const [attr, value] of Object.entries(attributes)) {
745
+ if (value == null || value === "")
746
+ continue;
747
+ const attrLower = attr.toLowerCase();
748
+ if (attrLower === "class") {
749
+ attrs.push(`className="${value}"`);
750
+ }
751
+ else if (attrLower === "style") {
752
+ attrs.push(`style={${(0, exports.convertStyleStringToObject)(value)}}`);
753
+ }
754
+ else {
755
+ const jsxAttr = HTML_TO_JSX_ATTR_MAP[attrLower] || attr;
756
+ attrs.push(`${jsxAttr}="${value}"`);
757
+ }
758
+ }
759
+ }
760
+ const attrsStr = attrs.length ? " " + attrs.join(" ") : "";
761
+ if (isVoid) {
762
+ return `<${tagName}${attrsStr} />`;
763
+ }
764
+ let children = "";
765
+ if ((_b = node.childNodes) === null || _b === void 0 ? void 0 : _b.length) {
766
+ children = node.childNodes.map((child) => nodeToJsx(child)).join("");
767
+ }
768
+ return `<${tagName}${attrsStr}>${children}</${tagName}>`;
769
+ };
770
+ return parsed.childNodes.map((node) => nodeToJsx(node)).join("");
771
+ }
772
+ catch (error) {
773
+ console.error("Error converting HTML to JSX:", error);
774
+ return "";
775
+ }
776
+ };
777
+ exports.htmlToJsx = htmlToJsx;
778
+ /**
779
+ * Extracts the interactive-container div from HTML (with full structure including children)
780
+ * @param htmlString The HTML string to parse
781
+ * @returns The outerHTML of the interactive-container div, or empty string if not found
782
+ */
783
+ const extractInteractiveContainerDiv = (htmlString) => {
784
+ if (!htmlString || typeof htmlString !== "string") {
785
+ return "";
786
+ }
787
+ try {
788
+ const parsed = (0, node_html_parser_1.parse)(htmlString);
789
+ const findInteractiveContainer = (node) => {
790
+ var _a;
791
+ if (node.nodeType === node_html_parser_1.NodeType.ELEMENT_NODE) {
792
+ const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
793
+ if (tagName === "div") {
794
+ const className = node.getAttribute("class") || "";
795
+ if (className.split(/\s+/).includes("interactive-container")) {
796
+ return node;
797
+ }
798
+ }
799
+ if (node.childNodes) {
800
+ for (const child of node.childNodes) {
801
+ const found = findInteractiveContainer(child);
802
+ if (found)
803
+ return found;
804
+ }
805
+ }
806
+ }
807
+ return null;
808
+ };
809
+ for (const node of parsed.childNodes) {
810
+ const div = findInteractiveContainer(node);
811
+ if (div) {
812
+ return div.outerHTML;
813
+ }
814
+ }
815
+ }
816
+ catch (error) {
817
+ console.error("Error extracting interactive-container div:", error);
818
+ }
819
+ return "";
820
+ };
821
+ exports.extractInteractiveContainerDiv = extractInteractiveContainerDiv;
822
+ /**
823
+ * Extracts only <script> and <link> tags from an HTML string that:
824
+ * - Have CDN paths (http:// or https:// URLs)
825
+ * - Are NOT from jQuery or Angular libraries
826
+ * - Are NOT already present in the layout file
827
+ * @param htmlString The HTML string to parse
828
+ * @param layoutContent Optional layout file content to check for existing imports
829
+ * @returns A string containing only the extracted <script> and <link> tags
830
+ */
831
+ const extractScriptAndLinkTags = (htmlString, layoutContent) => {
832
+ if (!htmlString || typeof htmlString !== "string") {
833
+ return "";
834
+ }
835
+ try {
836
+ const parsed = (0, node_html_parser_1.parse)(htmlString);
837
+ const extractedTags = [];
838
+ // Get existing URLs from layout if provided
839
+ const existingUrls = layoutContent ? getExistingImportUrls(layoutContent) : new Set();
840
+ // Patterns to identify jQuery and Angular libraries
841
+ const jqueryPatterns = [/jquery/i, /\bjq\b/i, /jquery-ui/i, /jquery\.min/i];
842
+ const angularPatterns = [/angular/i, /ng-/i, /angularjs/i, /@angular/i];
843
+ // Function to check if a URL is from jQuery or Angular
844
+ const isJQueryOrAngular = (url) => {
845
+ if (!url)
846
+ return false;
847
+ const lowerUrl = url.toLowerCase();
848
+ return (jqueryPatterns.some(pattern => pattern.test(lowerUrl)) ||
849
+ angularPatterns.some(pattern => pattern.test(lowerUrl)));
850
+ };
851
+ // Function to check if a URL is a CDN path (http:// or https://)
852
+ const isCdnPath = (url) => {
853
+ if (!url)
854
+ return false;
855
+ return url.startsWith("http://") || url.startsWith("https://");
856
+ };
857
+ // Function to recursively traverse nodes
858
+ const traverseNodes = (node) => {
859
+ var _a;
860
+ if (node.nodeType === node_html_parser_1.NodeType.ELEMENT_NODE) {
861
+ const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
862
+ // Extract script and link tags
863
+ if (tagName === "script" || tagName === "link") {
864
+ // Get the URL from src (for script) or href (for link)
865
+ const url = node.getAttribute("src") || node.getAttribute("href") || "";
866
+ // It's a CDN path (http:// or https://)
867
+ if (isCdnPath(url) && !isJQueryOrAngular(url) && !existingUrls.has(url)) {
868
+ // Convert to JSX-compatible format (self-closing for link tags only)
869
+ let jsxTag = node.outerHTML;
870
+ // For link tags, ensure they are self-closing for JSX compatibility
871
+ if (tagName === "link") {
872
+ // Remove any closing tag </link>
873
+ jsxTag = jsxTag.replace(/\s*<\/link>/gi, "");
874
+ // If it doesn't end with />, make it self-closing
875
+ if (!jsxTag.trim().endsWith("/>")) {
876
+ // Replace the closing > with />
877
+ jsxTag = jsxTag.replace(/>\s*$/, " />");
878
+ }
879
+ }
880
+ extractedTags.push(jsxTag);
881
+ }
882
+ }
883
+ // Recursively process child nodes
884
+ if (node.childNodes) {
885
+ node.childNodes.forEach((child) => {
886
+ traverseNodes(child);
887
+ });
888
+ }
889
+ }
890
+ };
891
+ // Traverse all nodes in the parsed HTML
892
+ parsed.childNodes.forEach((node) => {
893
+ traverseNodes(node);
894
+ });
895
+ return extractedTags.join("\n");
896
+ }
897
+ catch (error) {
898
+ console.error("Error extracting script and link tags:", error);
899
+ return "";
900
+ }
901
+ };
902
+ exports.extractScriptAndLinkTags = extractScriptAndLinkTags;
903
+ //# sourceMappingURL=utils.browser.js.map