@wavemaker-ai/react-runtime 1.0.0-rc.309 → 1.0.0-rc.647469

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 (315) hide show
  1. package/actions/navigation-action.js +5 -23
  2. package/components/advanced/carousel/index.d.ts +0 -1
  3. package/components/advanced/carousel/index.js +1 -2
  4. package/components/advanced/carousel/template.d.ts +0 -1
  5. package/components/advanced/carousel/template.js +1 -2
  6. package/components/advanced/login/index.d.ts +0 -1
  7. package/components/advanced/marquee/index.d.ts +0 -1
  8. package/components/advanced/marquee/index.js +1 -2
  9. package/components/basic/anchor/index.d.ts +0 -1
  10. package/components/basic/anchor/index.js +3 -4
  11. package/components/basic/audio/index.d.ts +0 -1
  12. package/components/basic/audio/index.js +2 -3
  13. package/components/basic/html/index.d.ts +0 -1
  14. package/components/basic/icon/index.d.ts +0 -1
  15. package/components/basic/icon/index.js +7 -4
  16. package/components/basic/iframe/iframe.utils.d.ts +1 -1
  17. package/components/basic/iframe/iframe.utils.js +4 -8
  18. package/components/basic/iframe/index.d.ts +0 -1
  19. package/components/basic/label/index.d.ts +0 -1
  20. package/components/basic/label/index.js +2 -3
  21. package/components/basic/message/index.js +1 -1
  22. package/components/basic/picture/index.d.ts +0 -1
  23. package/components/basic/picture/index.js +4 -3
  24. package/components/basic/progress-bar/index.d.ts +0 -1
  25. package/components/basic/progress-bar/index.js +1 -2
  26. package/components/basic/progress-circle/index.d.ts +0 -1
  27. package/components/basic/richtexteditor/index.d.ts +0 -2
  28. package/components/basic/search/index.d.ts +0 -3
  29. package/components/basic/search/index.js +4 -7
  30. package/components/basic/search/props.d.ts +0 -2
  31. package/components/basic/spinner/index.d.ts +0 -1
  32. package/components/basic/tile/index.d.ts +0 -1
  33. package/components/basic/tile/index.js +1 -2
  34. package/components/basic/tree/Components/TreeNodeComponent.js +5 -9
  35. package/components/basic/tree/index.d.ts +0 -1
  36. package/components/basic/tree/index.js +3 -14
  37. package/components/basic/tree/utils.d.ts +0 -2
  38. package/components/basic/tree/utils.js +1 -11
  39. package/components/basic/video/index.d.ts +0 -1
  40. package/components/basic/video/index.js +23 -40
  41. package/components/chart/index.d.ts +0 -1
  42. package/components/common/AppSpinner.js +5 -2
  43. package/components/container/accordion/accordion-pane/index.d.ts +0 -1
  44. package/components/container/accordion/accordion-pane/index.js +4 -1
  45. package/components/container/accordion/index.d.ts +0 -1
  46. package/components/container/index.d.ts +0 -3
  47. package/components/container/index.js +1 -6
  48. package/components/container/layout-grid/grid-column/index.d.ts +0 -1
  49. package/components/container/layout-grid/grid-row/index.d.ts +0 -1
  50. package/components/container/layout-grid/index.d.ts +0 -1
  51. package/components/container/layout-grid/index.js +8 -4
  52. package/components/container/linear-layout/index.d.ts +0 -1
  53. package/components/container/linear-layout/linear-layout-item/index.d.ts +0 -1
  54. package/components/container/panel/components/panel-header/index.js +6 -11
  55. package/components/container/panel/components/panel-header/props.d.ts +0 -5
  56. package/components/container/panel/index.d.ts +0 -1
  57. package/components/container/panel/index.js +1 -2
  58. package/components/container/props.d.ts +0 -2
  59. package/components/container/repeat-template/index.d.ts +1 -22
  60. package/components/container/repeat-template/index.js +1 -2
  61. package/components/container/tabs/index.d.ts +1 -3
  62. package/components/container/tabs/index.js +51 -102
  63. package/components/container/tabs/props.d.ts +0 -12
  64. package/components/container/tabs/tab-pane/index.d.ts +0 -1
  65. package/components/container/tabs/tab-pane/index.js +11 -28
  66. package/components/container/wizard/index.d.ts +0 -2
  67. package/components/container/wizard/wizard-step/index.d.ts +0 -1
  68. package/components/container/wizard/wizard-step/index.js +2 -2
  69. package/components/data/card/card-actions/index.d.ts +0 -1
  70. package/components/data/card/card-actions/index.js +5 -3
  71. package/components/data/card/card-content/index.d.ts +0 -1
  72. package/components/data/card/card-content/index.js +13 -3
  73. package/components/data/card/card-footer/index.d.ts +0 -1
  74. package/components/data/card/card-footer/index.js +5 -3
  75. package/components/data/card/index.d.ts +0 -1
  76. package/components/data/card/index.js +14 -3
  77. package/components/data/form/dynamic-fields/index.js +1 -7
  78. package/components/data/form/dynamic-fields/props.d.ts +0 -1
  79. package/components/data/form/form-action/index.d.ts +0 -2
  80. package/components/data/form/form-body/index.js +1 -2
  81. package/components/data/form/form-field/base-field.js +3 -4
  82. package/components/data/form/form-footer/index.js +1 -2
  83. package/components/data/list/components/ListItemWithTemplate.js +2 -4
  84. package/components/data/list/hooks/props.d.ts +2 -2
  85. package/components/data/list/hooks/useListEventHandlers.js +6 -6
  86. package/components/data/list/index.d.ts +0 -2
  87. package/components/data/list/index.js +4 -3
  88. package/components/data/list/props.d.ts +1 -2
  89. package/components/data/list/utils/list-widget-methods.d.ts +1 -2
  90. package/components/data/table/components/RowCells.d.ts +2 -16
  91. package/components/data/table/components/RowCells.js +24 -38
  92. package/components/data/table/components/TableBody.js +3 -11
  93. package/components/data/table/components/TableDataRow.d.ts +0 -3
  94. package/components/data/table/components/TableDataRow.js +3 -11
  95. package/components/data/table/components/TableHeader.js +4 -1
  96. package/components/data/table/hooks/index.d.ts +0 -1
  97. package/components/data/table/hooks/index.js +0 -12
  98. package/components/data/table/hooks/useDynamicColumns.js +1 -1
  99. package/components/data/table/hooks/useResponsiveColumns.d.ts +0 -1
  100. package/components/data/table/hooks/useRowSelection.d.ts +1 -1
  101. package/components/data/table/hooks/useRowSelection.js +5 -26
  102. package/components/data/table/hooks/useTableInitialization.js +1 -2
  103. package/components/data/table/index.d.ts +0 -4
  104. package/components/data/table/index.js +12 -77
  105. package/components/data/table/live-table/index.d.ts +0 -1
  106. package/components/data/table/props.d.ts +0 -7
  107. package/components/data/table/table-action/index.d.ts +0 -1
  108. package/components/data/table/table-column/index.d.ts +0 -1
  109. package/components/data/table/table-row/index.d.ts +0 -1
  110. package/components/data/table/table-row-action/index.d.ts +0 -1
  111. package/components/data/table/utils/buildSelectionColumns.js +1 -7
  112. package/components/data/table/utils/columnBuilder.js +1 -1
  113. package/components/data/table/utils/index.js +2 -2
  114. package/components/data/table/utils/renderDisplayCell.js +1 -1
  115. package/components/dialogs/alert-dialog/index.d.ts +0 -2
  116. package/components/dialogs/confirm-dialog/index.d.ts +0 -2
  117. package/components/dialogs/dialog/index.d.ts +0 -2
  118. package/components/dialogs/dialog/index.js +4 -2
  119. package/components/dialogs/dialog-actions/index.d.ts +0 -1
  120. package/components/dialogs/dialog-body/index.d.ts +0 -1
  121. package/components/dialogs/dialog-content/index.d.ts +0 -1
  122. package/components/dialogs/dialog-header/index.d.ts +0 -1
  123. package/components/dialogs/iframe-dialog/index.d.ts +0 -2
  124. package/components/dialogs/login-dialog/index.d.ts +0 -2
  125. package/components/dialogs/page-dialog/index.d.ts +0 -2
  126. package/components/form/button/index.d.ts +0 -1
  127. package/components/form/button/index.js +3 -4
  128. package/components/form/button-group/index.d.ts +0 -1
  129. package/components/form/button-group/index.js +1 -2
  130. package/components/input/calendar/index.d.ts +0 -2
  131. package/components/input/chips/index.d.ts +0 -2
  132. package/components/input/color-picker/index.d.ts +0 -2
  133. package/components/input/composite/index.d.ts +0 -1
  134. package/components/input/currency/index.d.ts +0 -2
  135. package/components/input/default/checkbox/index.d.ts +0 -2
  136. package/components/input/default/checkboxset/index.d.ts +0 -2
  137. package/components/input/default/radioset/index.d.ts +0 -2
  138. package/components/input/default/switch/index.d.ts +0 -2
  139. package/components/input/epoch/date/components/DatePickerPopover.js +29 -11
  140. package/components/input/epoch/date/index.d.ts +0 -1
  141. package/components/input/epoch/datetime/index.d.ts +0 -1
  142. package/components/input/epoch/datetime/index.js +25 -10
  143. package/components/input/epoch/datetime/styled.d.ts +78 -0
  144. package/components/input/epoch/datetime/styled.js +90 -0
  145. package/components/input/epoch/time/index.d.ts +0 -1
  146. package/components/input/epoch/time/index.js +1 -1
  147. package/components/input/epoch/time/utils.d.ts +17 -0
  148. package/components/input/epoch/time/utils.js +18 -1
  149. package/components/input/fileupload/index.d.ts +0 -1
  150. package/components/input/number/index.d.ts +0 -2
  151. package/components/input/rating/index.d.ts +0 -2
  152. package/components/input/rating/index.js +17 -14
  153. package/components/input/select/index.d.ts +0 -2
  154. package/components/input/select/index.js +4 -1
  155. package/components/input/slider/index.d.ts +0 -2
  156. package/components/input/slider/index.js +12 -13
  157. package/components/input/text/index.d.ts +0 -2
  158. package/components/input/text/index.js +14 -3
  159. package/components/input/textarea/index.d.ts +0 -2
  160. package/components/input/textarea/index.js +10 -7
  161. package/components/input/upload/index.d.ts +0 -2
  162. package/components/input/upload/index.js +5 -3
  163. package/components/layout/footer/index.js +1 -2
  164. package/components/layout/footer/props.d.ts +0 -1
  165. package/components/layout/header/index.js +1 -2
  166. package/components/layout/header/props.d.ts +0 -1
  167. package/components/layout/leftnav/index.js +1 -2
  168. package/components/layout/leftnav/props.d.ts +0 -1
  169. package/components/layout/rightnav/index.js +1 -2
  170. package/components/layout/rightnav/props.d.ts +0 -1
  171. package/components/layout/topnav/index.js +1 -2
  172. package/components/layout/topnav/props.d.ts +0 -1
  173. package/components/navbar/index.d.ts +0 -1
  174. package/components/navbar/index.js +1 -2
  175. package/components/navbar/nav/index.d.ts +0 -1
  176. package/components/navbar/nav-item/index.d.ts +0 -1
  177. package/components/navbar/nav-item/index.js +1 -2
  178. package/components/navigation/breadcrumb/index.d.ts +0 -1
  179. package/components/navigation/menu/index.d.ts +0 -1
  180. package/components/navigation/menu/index.js +4 -5
  181. package/components/navigation/popover/index.d.ts +1 -2
  182. package/components/navigation/popover/index.js +1 -1
  183. package/components/page/error-boundary/index.js +5 -5
  184. package/components/page/index.js +9 -13
  185. package/components/page/partial/index.d.ts +0 -1
  186. package/components/prefab/container/index.js +1 -2
  187. package/context/WidgetProvider.js +2 -2
  188. package/core/app.service.js +35 -40
  189. package/core/constants/events.js +0 -6
  190. package/core/constants/index.d.ts +1 -9
  191. package/core/constants/index.js +5 -32
  192. package/core/formatter/date-formatters.d.ts +1 -1
  193. package/core/formatter/date-formatters.js +13 -38
  194. package/core/formatter/types.d.ts +1 -1
  195. package/core/proxy-service.js +5 -15
  196. package/core/util/index.js +2 -3
  197. package/higherOrder/BaseApp.js +2 -2
  198. package/higherOrder/BasePage.d.ts +17 -0
  199. package/higherOrder/BasePage.js +104 -53
  200. package/higherOrder/BasePrefab.js +59 -69
  201. package/higherOrder/props.d.ts +0 -1
  202. package/higherOrder/withBaseWrapper.js +4 -3
  203. package/hooks/useAccess.js +0 -13
  204. package/mui-config/theme.js +4 -1
  205. package/package-lock.json +605 -2630
  206. package/package.json +4 -23
  207. package/store/middleware/navigationMiddleware.js +1 -1
  208. package/store/slices/appConfigSlice.js +8 -10
  209. package/store/slices/authSlice.js +32 -46
  210. package/tsconfig.declaration.tsbuildinfo +1 -1
  211. package/types/index.d.ts +0 -1
  212. package/utils/attr.js +14 -71
  213. package/utils/lib-error-skipper.d.ts +26 -4
  214. package/utils/lib-error-skipper.js +165 -41
  215. package/utils/style-utils.d.ts +0 -6
  216. package/utils/style-utils.js +1 -10
  217. package/variables/metadata.service.js +3 -2
  218. package/variables/model-variable.js +7 -10
  219. package/variables/service-variable.d.ts +0 -1
  220. package/variables/service-variable.js +6 -26
  221. package/actions/base-action.d.ts +0 -7
  222. package/actions/login-action.d.ts +0 -11
  223. package/actions/logout-action.d.ts +0 -10
  224. package/actions/navigation-action.d.ts +0 -35
  225. package/actions/notification-action.d.ts +0 -20
  226. package/actions/timer-action.d.ts +0 -27
  227. package/components/data/table/hooks/useCustomExpressionColumns.d.ts +0 -16
  228. package/components/data/table/hooks/useCustomExpressionColumns.js +0 -88
  229. package/core/security.service.d.ts +0 -12
  230. package/mui-config/theme-provider.d.ts +0 -3
  231. package/mui-config/theme.d.ts +0 -2
  232. package/runtime-dynamic/App.d.ts +0 -7
  233. package/runtime-dynamic/App.js +0 -144
  234. package/runtime-dynamic/app-initializer.d.ts +0 -15
  235. package/runtime-dynamic/app-initializer.js +0 -447
  236. package/runtime-dynamic/components/ErrorBoundary.d.ts +0 -18
  237. package/runtime-dynamic/components/ErrorBoundary.js +0 -93
  238. package/runtime-dynamic/components/PageWrapper.d.ts +0 -1
  239. package/runtime-dynamic/components/PageWrapper.js +0 -43
  240. package/runtime-dynamic/components/PrefabPreview.d.ts +0 -1
  241. package/runtime-dynamic/components/PrefabPreview.js +0 -84
  242. package/runtime-dynamic/components/partial-content.d.ts +0 -15
  243. package/runtime-dynamic/components/partial-content.js +0 -50
  244. package/runtime-dynamic/components/prefab-content.d.ts +0 -10
  245. package/runtime-dynamic/components/prefab-content.js +0 -31
  246. package/runtime-dynamic/components/use-dynamic-component.d.ts +0 -10
  247. package/runtime-dynamic/components/use-dynamic-component.js +0 -165
  248. package/runtime-dynamic/factories/build-base-page-like-component.d.ts +0 -8
  249. package/runtime-dynamic/factories/build-base-page-like-component.js +0 -59
  250. package/runtime-dynamic/factories/prefab-factory.d.ts +0 -3
  251. package/runtime-dynamic/factories/prefab-factory.js +0 -82
  252. package/runtime-dynamic/factories/startup-info.d.ts +0 -6
  253. package/runtime-dynamic/factories/startup-info.js +0 -28
  254. package/runtime-dynamic/factories/utils.d.ts +0 -23
  255. package/runtime-dynamic/factories/utils.js +0 -131
  256. package/runtime-dynamic/index.d.ts +0 -14
  257. package/runtime-dynamic/index.js +0 -191
  258. package/runtime-dynamic/main.d.ts +0 -2
  259. package/runtime-dynamic/main.js +0 -84
  260. package/runtime-dynamic/preview-mode.d.ts +0 -15
  261. package/runtime-dynamic/preview-mode.js +0 -31
  262. package/runtime-dynamic/preview-navigation.d.ts +0 -6
  263. package/runtime-dynamic/preview-navigation.js +0 -38
  264. package/runtime-dynamic/preview-resource-base.d.ts +0 -12
  265. package/runtime-dynamic/preview-resource-base.js +0 -65
  266. package/runtime-dynamic/registry/component-registry.d.ts +0 -3
  267. package/runtime-dynamic/registry/component-registry.js +0 -353
  268. package/runtime-dynamic/registry/custom-widget-registry.d.ts +0 -7
  269. package/runtime-dynamic/registry/custom-widget-registry.js +0 -18
  270. package/runtime-dynamic/registry/index.d.ts +0 -2
  271. package/runtime-dynamic/registry/index.js +0 -63
  272. package/runtime-dynamic/registry/store.d.ts +0 -9
  273. package/runtime-dynamic/registry/store.js +0 -26
  274. package/runtime-dynamic/routes.d.ts +0 -2
  275. package/runtime-dynamic/routes.js +0 -107
  276. package/runtime-dynamic/services/app-extension-provider.d.ts +0 -1
  277. package/runtime-dynamic/services/app-extension-provider.js +0 -45
  278. package/runtime-dynamic/services/cache.d.ts +0 -29
  279. package/runtime-dynamic/services/cache.js +0 -57
  280. package/runtime-dynamic/services/component-ref-provider.d.ts +0 -12
  281. package/runtime-dynamic/services/component-ref-provider.js +0 -149
  282. package/runtime-dynamic/services/css-scoping.d.ts +0 -2
  283. package/runtime-dynamic/services/css-scoping.js +0 -53
  284. package/runtime-dynamic/services/fragment-url.d.ts +0 -16
  285. package/runtime-dynamic/services/fragment-url.js +0 -74
  286. package/runtime-dynamic/services/index.d.ts +0 -10
  287. package/runtime-dynamic/services/index.js +0 -152
  288. package/runtime-dynamic/services/markup-transpiler.d.ts +0 -12
  289. package/runtime-dynamic/services/markup-transpiler.js +0 -250
  290. package/runtime-dynamic/services/prefab-resources.d.ts +0 -18
  291. package/runtime-dynamic/services/prefab-resources.js +0 -159
  292. package/runtime-dynamic/services/resource-manager.d.ts +0 -2
  293. package/runtime-dynamic/services/resource-manager.js +0 -66
  294. package/runtime-dynamic/services/script-executor.d.ts +0 -8
  295. package/runtime-dynamic/services/script-executor.js +0 -90
  296. package/runtime-dynamic/services/variable-factory.d.ts +0 -2
  297. package/runtime-dynamic/services/variable-factory.js +0 -260
  298. package/runtime-dynamic/services/variable-registry.d.ts +0 -12
  299. package/runtime-dynamic/services/variable-registry.js +0 -118
  300. package/runtime-dynamic/services/variable-transpiler.d.ts +0 -5
  301. package/runtime-dynamic/services/variable-transpiler.js +0 -159
  302. package/runtime-dynamic/shims/next-image.d.ts +0 -35
  303. package/runtime-dynamic/shims/next-image.js +0 -60
  304. package/runtime-dynamic/shims/next-link.d.ts +0 -25
  305. package/runtime-dynamic/shims/next-link.js +0 -33
  306. package/runtime-dynamic/shims/next-navigation.d.ts +0 -16
  307. package/runtime-dynamic/shims/next-navigation.js +0 -52
  308. package/runtime-dynamic/utils/index.d.ts +0 -9
  309. package/runtime-dynamic/utils/index.js +0 -40
  310. package/utils/custom-expression/index.d.ts +0 -43
  311. package/utils/custom-expression/index.js +0 -161
  312. package/utils/custom-expression/parser.d.ts +0 -15
  313. package/utils/custom-expression/parser.js +0 -208
  314. package/utils/layoutsize-util.d.ts +0 -1
  315. package/utils/layoutsize-util.js +0 -57
@@ -1,260 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createVariablesFromJson = createVariablesFromJson;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
- var _variableRegistry = require("./variable-registry");
13
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
16
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
- // ---------------------------------------------------------------------------
19
- // Event handler wiring
20
- // ---------------------------------------------------------------------------
21
-
22
- var EVENT_HANDLER_REGEX = /^(\w+)\(([^)]*)\)$/;
23
- var RETURN_VALUE_HANDLERS = new Set(["onBeforeUpdate", "onBeforeDatasetReady", "onOnline", "onOffline"]);
24
- var EVENT_HANDLER_KEYS = new Set(["onSuccess", "onError", "onBeforeUpdate", "onCanUpdate", "onResult", "onBeforeDatasetReady", "onOnline", "onOffline", "onTimerFire"]);
25
- function wireEventHandlers(config, scopeProxy) {
26
- var _iterator = _createForOfIteratorHelper(EVENT_HANDLER_KEYS),
27
- _step;
28
- try {
29
- var _loop = function _loop() {
30
- var key = _step.value;
31
- var value = config[key];
32
- if (typeof value !== "string") return 0; // continue
33
- var match = value.match(EVENT_HANDLER_REGEX);
34
- if (!match) {
35
- delete config[key];
36
- return 0; // continue
37
- }
38
- var methodName = match[1];
39
- var shouldReturn = RETURN_VALUE_HANDLERS.has(key);
40
- config[key] = function () {
41
- var fn = scopeProxy === null || scopeProxy === void 0 ? void 0 : scopeProxy[methodName];
42
- if (typeof fn === "function") {
43
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
- args[_key] = arguments[_key];
45
- }
46
- var result = fn.call.apply(fn, [scopeProxy].concat(args));
47
- if (shouldReturn) return result;
48
- }
49
- };
50
- },
51
- _ret;
52
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
53
- _ret = _loop();
54
- if (_ret === 0) continue;
55
- }
56
- } catch (err) {
57
- _iterator.e(err);
58
- } finally {
59
- _iterator.f();
60
- }
61
- }
62
-
63
- // ---------------------------------------------------------------------------
64
- // isStaticParams — mirrors codegen's isStaticParamsVariable
65
- // ---------------------------------------------------------------------------
66
-
67
- function isStaticParams(variable) {
68
- var db = variable.dataBinding;
69
- if (!db) return true;
70
- var entryIsStatic = function entryIsStatic(entry) {
71
- var v = Array.isArray(entry.value) ? entry.value[0] : entry.value;
72
- return !v || !(typeof v === "string" && v.startsWith("bind:"));
73
- };
74
- if (Array.isArray(db)) return db.every(entryIsStatic);
75
- if (db && (0, _typeof2["default"])(db) === "object") {
76
- return Object.values(db).every(function (opBindings) {
77
- return Array.isArray(opBindings) ? opBindings.every(entryIsStatic) : true;
78
- });
79
- }
80
- return true;
81
- }
82
-
83
- // ---------------------------------------------------------------------------
84
- // paramProvider builder
85
- // ---------------------------------------------------------------------------
86
-
87
- function buildParamProvider(variable) {
88
- var dataSet = variable.dataSet;
89
- if (variable.isList && Array.isArray(dataSet)) {
90
- return function () {
91
- return (0, _toConsumableArray2["default"])(dataSet);
92
- };
93
- }
94
- var params = {};
95
- var dataBinding = variable.dataBinding;
96
- if (Array.isArray(dataBinding)) {
97
- var _iterator2 = _createForOfIteratorHelper(dataBinding),
98
- _step2;
99
- try {
100
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
101
- var binding = _step2.value;
102
- if (binding.target) params[binding.target] = binding.value;
103
- }
104
- } catch (err) {
105
- _iterator2.e(err);
106
- } finally {
107
- _iterator2.f();
108
- }
109
- }
110
- if (dataSet && !Array.isArray(dataSet) && (0, _typeof2["default"])(dataSet) === "object") {
111
- for (var _i = 0, _Object$entries = Object.entries(dataSet); _i < _Object$entries.length; _i++) {
112
- var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
113
- key = _Object$entries$_i[0],
114
- value = _Object$entries$_i[1];
115
- if (!(key in params)) params[key] = value;
116
- }
117
- }
118
- if (variable.pageName && !params["pageName"]) {
119
- params["pageName"] = variable.pageName;
120
- }
121
- return function () {
122
- return _objectSpread({}, params);
123
- };
124
- }
125
-
126
- // ---------------------------------------------------------------------------
127
- // Per-category config enhancers (DRY replacement for if-chains)
128
- // ---------------------------------------------------------------------------
129
-
130
- var NAVIGATION_CATEGORIES = new Set(["wm.NavigationAction", "wm.NavigationVariable"]);
131
- var NOTIFICATION_CATEGORIES = new Set(["wm.NotificationAction", "wm.NotificationVariable"]);
132
- var AUTH_CATEGORIES = new Set(["wm.LoginAction", "wm.LoginVariable", "wm.LogoutAction", "wm.LogoutVariable"]);
133
- var enhanceNavigation = function enhanceNavigation(config, _variable, scopeProxy) {
134
- config.appConfig = scopeProxy.appConfig;
135
- };
136
- var enhanceNotification = function enhanceNotification(config, variable, scopeProxy) {
137
- config.toasterService = function () {
138
- return scopeProxy.toaster;
139
- };
140
- config.onOk = config.onOk || function () {};
141
- config.onClose = config.onClose || function () {};
142
- var operation = variable.operation;
143
- if (operation === "alert" || operation === "confirm") {
144
- var widgetName = "Common".concat(operation.charAt(0).toUpperCase() + operation.slice(1), "Dialog");
145
- config.showDialog = function (options) {
146
- var _scopeProxy$App, _scopeProxy$App$openA;
147
- scopeProxy === null || scopeProxy === void 0 || (_scopeProxy$App = scopeProxy.App) === null || _scopeProxy$App === void 0 || (_scopeProxy$App$openA = _scopeProxy$App.openActionDialog) === null || _scopeProxy$App$openA === void 0 || _scopeProxy$App$openA.call(_scopeProxy$App, options, widgetName);
148
- };
149
- }
150
- var dataBindings = variable.dataBinding;
151
- var pageBinding = dataBindings === null || dataBindings === void 0 ? void 0 : dataBindings.find(function (b) {
152
- return b.target === "page";
153
- });
154
- if (pageBinding !== null && pageBinding !== void 0 && pageBinding.value) {
155
- var partialName = pageBinding.value.charAt(0).toUpperCase() + pageBinding.value.slice(1);
156
- config.partialContent = {
157
- component: (0, _variableRegistry.createLazyPartial)(partialName)
158
- };
159
- }
160
- };
161
- var enhanceAuth = function enhanceAuth(config, variable, scopeProxy) {
162
- var _scopeProxy$appConfig, _variable$useDefaultS;
163
- config.baseURL = (_scopeProxy$appConfig = scopeProxy.appConfig) === null || _scopeProxy$appConfig === void 0 ? void 0 : _scopeProxy$appConfig.url;
164
- config.securityService = function () {
165
- var _scopeProxy$appConfig2;
166
- return (_scopeProxy$appConfig2 = scopeProxy.appConfig) === null || _scopeProxy$appConfig2 === void 0 ? void 0 : _scopeProxy$appConfig2.SecurityService;
167
- };
168
- config.useDefaultSuccessHandler = (_variable$useDefaultS = variable.useDefaultSuccessHandler) !== null && _variable$useDefaultS !== void 0 ? _variable$useDefaultS : true;
169
- };
170
- var enhanceServiceVariable = function enhanceServiceVariable(config, variable, scopeProxy) {
171
- var _config$isStaticParam;
172
- config.baseUrl = scopeProxy.baseUrl + "/services";
173
- config.getServiceInfo = function () {
174
- var _scopeProxy$serviceDe;
175
- return (_scopeProxy$serviceDe = scopeProxy.serviceDefinitions) === null || _scopeProxy$serviceDe === void 0 || (_scopeProxy$serviceDe = _scopeProxy$serviceDe[variable.operationId]) === null || _scopeProxy$serviceDe === void 0 ? void 0 : _scopeProxy$serviceDe.wmServiceOperationInfo;
176
- };
177
- (_config$isStaticParam = config.isStaticParams) !== null && _config$isStaticParam !== void 0 ? _config$isStaticParam : config.isStaticParams = isStaticParams(variable);
178
- };
179
- var enhanceLiveVariable = function enhanceLiveVariable(config, variable, scopeProxy) {
180
- var _config$isStaticParam2;
181
- if (!config.operation) config.operation = "read";
182
- if (!config.propertiesMap) config.propertiesMap = {
183
- columns: []
184
- };
185
- if (!config.relatedTables) config.relatedTables = [];
186
- config.baseUrl = scopeProxy.baseUrl;
187
- (_config$isStaticParam2 = config.isStaticParams) !== null && _config$isStaticParam2 !== void 0 ? _config$isStaticParam2 : config.isStaticParams = isStaticParams(variable);
188
- };
189
- var enhanceCrudVariable = function enhanceCrudVariable(config, variable, scopeProxy) {
190
- var _config$isStaticParam3;
191
- config.baseUrl = scopeProxy.baseUrl;
192
- (_config$isStaticParam3 = config.isStaticParams) !== null && _config$isStaticParam3 !== void 0 ? _config$isStaticParam3 : config.isStaticParams = isStaticParams(variable);
193
- };
194
- function getEnhancer(category) {
195
- if (NAVIGATION_CATEGORIES.has(category)) return enhanceNavigation;
196
- if (NOTIFICATION_CATEGORIES.has(category)) return enhanceNotification;
197
- if (AUTH_CATEGORIES.has(category)) return enhanceAuth;
198
- switch (category) {
199
- case "wm.ServiceVariable":
200
- return enhanceServiceVariable;
201
- case "wm.LiveVariable":
202
- return enhanceLiveVariable;
203
- case "wm.CrudVariable":
204
- return enhanceCrudVariable;
205
- default:
206
- return null;
207
- }
208
- }
209
-
210
- // ---------------------------------------------------------------------------
211
- // Config builder
212
- // ---------------------------------------------------------------------------
213
-
214
- function buildInstanceConfig(variable, scopeProxy) {
215
- var config = _objectSpread(_objectSpread({}, variable), {}, {
216
- _context: scopeProxy,
217
- paramProvider: variable.name === "loggedInUser" ? function () {
218
- var _scopeProxy$appConfig3;
219
- return (_scopeProxy$appConfig3 = scopeProxy.appConfig) === null || _scopeProxy$appConfig3 === void 0 ? void 0 : _scopeProxy$appConfig3.loggedInUser;
220
- } : buildParamProvider(variable)
221
- });
222
- wireEventHandlers(config, scopeProxy);
223
- var enhancer = getEnhancer(variable.category);
224
- if (enhancer) enhancer(config, variable, scopeProxy);
225
- return config;
226
- }
227
-
228
- // ---------------------------------------------------------------------------
229
- // Public API
230
- // ---------------------------------------------------------------------------
231
-
232
- function createVariablesFromJson(rawVariables, scopeProxy) {
233
- if (!rawVariables || Object.keys(rawVariables).length === 0) return _variableRegistry.EMPTY_RESULT;
234
- var Variables = {};
235
- var Actions = {};
236
- for (var _i2 = 0, _Object$entries2 = Object.entries(rawVariables); _i2 < _Object$entries2.length; _i2++) {
237
- var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i2], 2),
238
- key = _Object$entries2$_i[0],
239
- value = _Object$entries2$_i[1];
240
- var _variable2 = value;
241
- var category = _variable2.category;
242
- var Ctor = _variableRegistry.CATEGORY_TO_CONSTRUCTOR[category];
243
- if (!Ctor) continue;
244
- try {
245
- var _config = buildInstanceConfig(_variable2, scopeProxy);
246
- var instance = new Ctor(_config);
247
- if (_variableRegistry.ACTION_CATEGORIES.has(category)) {
248
- Actions[key] = instance;
249
- } else {
250
- Variables[key] = instance;
251
- }
252
- } catch (err) {
253
- console.error("[variable-factory] Failed to create \"".concat(key, "\" (").concat(category, "):"), err);
254
- }
255
- }
256
- return {
257
- Variables: Variables,
258
- Actions: Actions
259
- };
260
- }
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- type ConstructorClass = new (config: any) => any;
3
- export declare const CATEGORY_TO_CONSTRUCTOR: Record<string, ConstructorClass>;
4
- export declare const ACTION_CATEGORIES: Set<string>;
5
- export declare const SCOPE_MAP: Record<string, unknown>;
6
- export interface VariablesResult {
7
- Variables: Record<string, unknown>;
8
- Actions: Record<string, unknown>;
9
- }
10
- export declare const EMPTY_RESULT: VariablesResult;
11
- export declare function createLazyPartial(partialName: string): React.LazyExoticComponent<React.ComponentType<any>>;
12
- export {};
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.SCOPE_MAP = exports.EMPTY_RESULT = exports.CATEGORY_TO_CONSTRUCTOR = exports.ACTION_CATEGORIES = void 0;
9
- exports.createLazyPartial = createLazyPartial;
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _modelVariable = require("@wavemaker-ai/react-runtime/variables/model-variable");
14
- var _serviceVariable = require("@wavemaker-ai/react-runtime/variables/service-variable");
15
- var _liveVariable = _interopRequireDefault(require("@wavemaker-ai/react-runtime/variables/live-variable"));
16
- var _crudVariable = _interopRequireDefault(require("@wavemaker-ai/react-runtime/variables/crud-variable"));
17
- var _navigationAction = require("@wavemaker-ai/react-runtime/actions/navigation-action");
18
- var _notificationAction = require("@wavemaker-ai/react-runtime/actions/notification-action");
19
- var _timerAction = require("@wavemaker-ai/react-runtime/actions/timer-action");
20
- var _loginAction = require("@wavemaker-ai/react-runtime/actions/login-action");
21
- var _logoutAction = require("@wavemaker-ai/react-runtime/actions/logout-action");
22
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
23
- var CATEGORY_TO_CONSTRUCTOR = exports.CATEGORY_TO_CONSTRUCTOR = {
24
- "wm.Variable": _modelVariable.ModelVariable,
25
- "wm.ServiceVariable": _serviceVariable.ServiceVariable,
26
- "wm.LiveVariable": _liveVariable["default"],
27
- "wm.CrudVariable": _crudVariable["default"],
28
- "wm.NavigationAction": _navigationAction.NavigationAction,
29
- "wm.NavigationVariable": _navigationAction.NavigationAction,
30
- "wm.NotificationAction": _notificationAction.NotificationAction,
31
- "wm.NotificationVariable": _notificationAction.NotificationAction,
32
- "wm.TimerAction": _timerAction.TimerAction,
33
- "wm.TimerVariable": _timerAction.TimerAction,
34
- "wm.LoginAction": _loginAction.LoginAction,
35
- "wm.LoginVariable": _loginAction.LoginAction,
36
- "wm.LogoutAction": _logoutAction.LogoutAction,
37
- "wm.LogoutVariable": _logoutAction.LogoutAction
38
- };
39
- var ACTION_CATEGORIES = exports.ACTION_CATEGORIES = new Set(["wm.NavigationAction", "wm.NavigationVariable", "wm.NotificationAction", "wm.NotificationVariable", "wm.TimerAction", "wm.TimerVariable", "wm.LoginAction", "wm.LoginVariable", "wm.LogoutAction", "wm.LogoutVariable"]);
40
- var SCOPE_MAP = exports.SCOPE_MAP = {
41
- React: _react["default"],
42
- ModelVariable: _modelVariable.ModelVariable,
43
- ServiceVariable: _serviceVariable.ServiceVariable,
44
- LiveVariable: _liveVariable["default"],
45
- CrudVariable: _crudVariable["default"],
46
- NavigationAction: _navigationAction.NavigationAction,
47
- NotificationAction: _notificationAction.NotificationAction,
48
- TimerAction: _timerAction.TimerAction,
49
- LoginAction: _loginAction.LoginAction,
50
- LogoutAction: _logoutAction.LogoutAction
51
- };
52
- var EMPTY_RESULT = exports.EMPTY_RESULT = {
53
- Variables: {},
54
- Actions: {}
55
- };
56
- function createLazyPartial(partialName) {
57
- return /*#__PURE__*/(0, _react.lazy)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
58
- var _yield$import, getComponentFromCache, setComponentInCache, _yield$import2, FType, _yield$import3, getComponentRef, _yield$import4, buildBasePageLikeComponent, cached, fragment, Built;
59
- return _regenerator["default"].wrap(function _callee$(_context) {
60
- while (1) switch (_context.prev = _context.next) {
61
- case 0:
62
- _context.next = 2;
63
- return Promise.resolve().then(function () {
64
- return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/cache"));
65
- });
66
- case 2:
67
- _yield$import = _context.sent;
68
- getComponentFromCache = _yield$import.getComponentFromCache;
69
- setComponentInCache = _yield$import.setComponentInCache;
70
- _context.next = 7;
71
- return Promise.resolve().then(function () {
72
- return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/fragment-url"));
73
- });
74
- case 7:
75
- _yield$import2 = _context.sent;
76
- FType = _yield$import2.ComponentType;
77
- _context.next = 11;
78
- return Promise.resolve().then(function () {
79
- return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/component-ref-provider"));
80
- });
81
- case 11:
82
- _yield$import3 = _context.sent;
83
- getComponentRef = _yield$import3.getComponentRef;
84
- _context.next = 15;
85
- return Promise.resolve().then(function () {
86
- return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/factories/build-base-page-like-component"));
87
- });
88
- case 15:
89
- _yield$import4 = _context.sent;
90
- buildBasePageLikeComponent = _yield$import4.buildBasePageLikeComponent;
91
- cached = getComponentFromCache(FType.PARTIAL, partialName);
92
- if (!cached) {
93
- _context.next = 20;
94
- break;
95
- }
96
- return _context.abrupt("return", {
97
- "default": cached
98
- });
99
- case 20:
100
- _context.next = 22;
101
- return getComponentRef(partialName, FType.PARTIAL);
102
- case 22:
103
- fragment = _context.sent;
104
- _context.next = 25;
105
- return buildBasePageLikeComponent("partial", partialName, fragment);
106
- case 25:
107
- Built = _context.sent;
108
- setComponentInCache(FType.PARTIAL, partialName, Built);
109
- return _context.abrupt("return", {
110
- "default": Built
111
- });
112
- case 28:
113
- case "end":
114
- return _context.stop();
115
- }
116
- }, _callee);
117
- })));
118
- }
@@ -1,5 +0,0 @@
1
- import { type VariablesResult } from "./variable-registry";
2
- type GetVariablesFn = (pageProxy: unknown) => VariablesResult;
3
- export declare function clearVariablesCache(): void;
4
- export declare function transpileAndBuildGetVariables(variablesCodeString: string, rawVariables: Record<string, unknown>): GetVariablesFn;
5
- export {};
@@ -1,159 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.clearVariablesCache = clearVariablesCache;
8
- exports.transpileAndBuildGetVariables = transpileAndBuildGetVariables;
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
- var _sucrase = require("sucrase");
14
- var _variableRegistry = require("./variable-registry");
15
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
16
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- // ---------------------------------------------------------------------------
21
- // Entity provider shims (injects getEntityPropertyMap / getEntityRelatedTables)
22
- // ---------------------------------------------------------------------------
23
-
24
- function buildEntityProviderShims(rawVariables) {
25
- var entityMap = new Map();
26
- for (var _i = 0, _Object$values = Object.values(rawVariables || {}); _i < _Object$values.length; _i++) {
27
- var config = _Object$values[_i];
28
- var v = config;
29
- if (!v.liveSource || !v.type || !v.propertiesMap) continue;
30
- var key = "".concat(v.liveSource, "::").concat(v.type);
31
- if (!entityMap.has(key)) {
32
- entityMap.set(key, {
33
- propertiesMap: v.propertiesMap,
34
- relatedTables: v.relatedTables || []
35
- });
36
- }
37
- }
38
- return {
39
- getEntityPropertyMap: function getEntityPropertyMap(liveSource, entityName) {
40
- var _entityMap$get;
41
- return (_entityMap$get = entityMap.get("".concat(liveSource, "::").concat(entityName))) === null || _entityMap$get === void 0 ? void 0 : _entityMap$get.propertiesMap;
42
- },
43
- getEntityRelatedTables: function getEntityRelatedTables(liveSource, entityName) {
44
- var _entityMap$get2;
45
- return (_entityMap$get2 = entityMap.get("".concat(liveSource, "::").concat(entityName))) === null || _entityMap$get2 === void 0 ? void 0 : _entityMap$get2.relatedTables;
46
- }
47
- };
48
- }
49
-
50
- // ---------------------------------------------------------------------------
51
- // Code preprocessing
52
- // ---------------------------------------------------------------------------
53
-
54
- var IMPORT_STATEMENT_REGEX = /import\s+[\s\S]*?\s+from\s+['"][^'"]+['"];?/g;
55
- var EXPORT_DEFAULT_REGEX = /^\s*export\s+default\s+/m;
56
- var PARTIAL_IMPORT_REGEX = /import\s+(\w+)\s+from\s+['"]@\/app\/components\/[^'"]+['"];?/g;
57
- function extractPartialImports(code) {
58
- var names = [];
59
- var match;
60
- while ((match = PARTIAL_IMPORT_REGEX.exec(code)) !== null) {
61
- names.push(match[1]);
62
- }
63
- PARTIAL_IMPORT_REGEX.lastIndex = 0;
64
- return names;
65
- }
66
- function preprocessVariablesCode(code) {
67
- return code.replace(IMPORT_STATEMENT_REGEX, "").replace(EXPORT_DEFAULT_REGEX, "return ");
68
- }
69
- function compileTypeScript(code) {
70
- var wrapped = "function __variableFactory__() {\n".concat(code, "\n}");
71
- var result = (0, _sucrase.transform)(wrapped, {
72
- transforms: ["typescript"]
73
- });
74
- return "".concat(result.code, "\nreturn __variableFactory__();");
75
- }
76
- function tryCompileVariableFactory(preprocessed) {
77
- try {
78
- return compileTypeScript(preprocessed);
79
- } catch (err) {
80
- console.error("[variable-transpiler] Compilation failed:", err);
81
- return null;
82
- }
83
- }
84
- function tryConstructVariableFactory(scopeNames, compiled) {
85
- try {
86
- return (0, _construct2["default"])(Function, (0, _toConsumableArray2["default"])(scopeNames).concat([compiled]));
87
- } catch (err) {
88
- console.error("[variable-transpiler] Function construction failed:", err);
89
- return null;
90
- }
91
- }
92
-
93
- // ---------------------------------------------------------------------------
94
- // Cache
95
- // ---------------------------------------------------------------------------
96
-
97
- var variablesCache = new Map();
98
- function clearVariablesCache() {
99
- variablesCache.clear();
100
- }
101
-
102
- // ---------------------------------------------------------------------------
103
- // Public API
104
- // ---------------------------------------------------------------------------
105
-
106
- function transpileAndBuildGetVariables(variablesCodeString, rawVariables) {
107
- if (!(variablesCodeString !== null && variablesCodeString !== void 0 && variablesCodeString.trim())) return function () {
108
- return _variableRegistry.EMPTY_RESULT;
109
- };
110
- var cached = variablesCache.get(variablesCodeString);
111
- if (cached) return cached;
112
- var _buildEntityProviderS = buildEntityProviderShims(rawVariables),
113
- getEntityPropertyMap = _buildEntityProviderS.getEntityPropertyMap,
114
- getEntityRelatedTables = _buildEntityProviderS.getEntityRelatedTables;
115
- var scopeWithShims = _objectSpread(_objectSpread({}, _variableRegistry.SCOPE_MAP), {}, {
116
- getEntityPropertyMap: getEntityPropertyMap,
117
- getEntityRelatedTables: getEntityRelatedTables
118
- });
119
- var _iterator = _createForOfIteratorHelper(extractPartialImports(variablesCodeString)),
120
- _step;
121
- try {
122
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
123
- var name = _step.value;
124
- scopeWithShims[name] = (0, _variableRegistry.createLazyPartial)(name);
125
- }
126
- } catch (err) {
127
- _iterator.e(err);
128
- } finally {
129
- _iterator.f();
130
- }
131
- var scopeNames = Object.keys(scopeWithShims);
132
- var scopeValues = Object.values(scopeWithShims);
133
- var preprocessed = preprocessVariablesCode(variablesCodeString);
134
- var compiled = tryCompileVariableFactory(preprocessed);
135
- if (!compiled) return function () {
136
- return _variableRegistry.EMPTY_RESULT;
137
- };
138
- var factoryBuilder = tryConstructVariableFactory(scopeNames, compiled);
139
- if (!factoryBuilder) return function () {
140
- return _variableRegistry.EMPTY_RESULT;
141
- };
142
- var getVariablesFn;
143
- try {
144
- getVariablesFn = factoryBuilder.apply(void 0, scopeValues);
145
- } catch (err) {
146
- console.error("[variable-transpiler] Factory execution failed:", err);
147
- return function () {
148
- return _variableRegistry.EMPTY_RESULT;
149
- };
150
- }
151
- if (typeof getVariablesFn !== "function") {
152
- console.error("[variable-transpiler] Expected a function, got:", (0, _typeof2["default"])(getVariablesFn));
153
- return function () {
154
- return _variableRegistry.EMPTY_RESULT;
155
- };
156
- }
157
- variablesCache.set(variablesCodeString, getVariablesFn);
158
- return getVariablesFn;
159
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Shim for next/image in the dynamic preview runtime (non-Next.js).
3
- * Renders a standard <img> element with the same props.
4
- */
5
- import React from "react";
6
- interface ImageSrc {
7
- src: string;
8
- height?: number;
9
- width?: number;
10
- }
11
- interface ImageProps {
12
- src: string | ImageSrc;
13
- alt?: string;
14
- width?: number | string;
15
- height?: number | string;
16
- fill?: boolean;
17
- loader?: (params: {
18
- src: string;
19
- width: number;
20
- quality?: number;
21
- }) => string;
22
- quality?: number;
23
- priority?: boolean;
24
- loading?: "lazy" | "eager";
25
- placeholder?: string;
26
- blurDataURL?: string;
27
- unoptimized?: boolean;
28
- onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
29
- onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
30
- style?: React.CSSProperties;
31
- className?: string;
32
- [key: string]: unknown;
33
- }
34
- declare function NextImage({ src, alt, width, height, fill, loader: _loader, quality: _quality, priority, loading, placeholder: _placeholder, blurDataURL: _blurDataURL, unoptimized: _unoptimized, ...rest }: ImageProps): import("react/jsx-runtime").JSX.Element;
35
- export default NextImage;
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _react = _interopRequireDefault(require("react"));
12
- var _excluded = ["src", "alt", "width", "height", "fill", "loader", "quality", "priority", "loading", "placeholder", "blurDataURL", "unoptimized"];
13
- /**
14
- * Shim for next/image in the dynamic preview runtime (non-Next.js).
15
- * Renders a standard <img> element with the same props.
16
- */
17
- var __jsx = _react["default"].createElement;
18
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
- function NextImage(_ref) {
21
- var src = _ref.src,
22
- _ref$alt = _ref.alt,
23
- alt = _ref$alt === void 0 ? "" : _ref$alt,
24
- width = _ref.width,
25
- height = _ref.height,
26
- fill = _ref.fill,
27
- _loader = _ref.loader,
28
- _quality = _ref.quality,
29
- priority = _ref.priority,
30
- loading = _ref.loading,
31
- _placeholder = _ref.placeholder,
32
- _blurDataURL = _ref.blurDataURL,
33
- _unoptimized = _ref.unoptimized,
34
- rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
35
- var imgSrc = (0, _typeof2["default"])(src) === "object" ? src.src : src;
36
- var imgWidth = width !== null && width !== void 0 ? width : (0, _typeof2["default"])(src) === "object" ? src.width : undefined;
37
- var imgHeight = height !== null && height !== void 0 ? height : (0, _typeof2["default"])(src) === "object" ? src.height : undefined;
38
- var resolvedStyle = _objectSpread({}, rest.style || {});
39
- if (fill) {
40
- resolvedStyle.position = "absolute";
41
- resolvedStyle.width = "100%";
42
- resolvedStyle.height = "100%";
43
- resolvedStyle.objectFit = resolvedStyle.objectFit || "cover";
44
- }
45
- return (
46
- // eslint-disable-next-line @next/next/no-img-element
47
- __jsx("img", {
48
- src: imgSrc,
49
- alt: alt,
50
- width: fill ? undefined : imgWidth,
51
- height: fill ? undefined : imgHeight,
52
- loading: priority ? "eager" : loading || "lazy",
53
- style: resolvedStyle,
54
- className: rest.className,
55
- onLoad: rest.onLoad,
56
- onError: rest.onError
57
- })
58
- );
59
- }
60
- var _default = exports["default"] = NextImage;