@fluid-app/rep-core 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/dist/chunk-CKQMccvm.cjs +28 -0
  2. package/dist/data-sources/DataAwareWidget.cjs +47 -56
  3. package/dist/data-sources/DataAwareWidget.cjs.map +1 -1
  4. package/dist/data-sources/DataAwareWidget.d.cts +27 -19
  5. package/dist/data-sources/DataAwareWidget.d.cts.map +1 -0
  6. package/dist/data-sources/DataAwareWidget.d.mts +38 -0
  7. package/dist/data-sources/DataAwareWidget.d.mts.map +1 -0
  8. package/dist/data-sources/DataAwareWidget.mjs +48 -0
  9. package/dist/data-sources/DataAwareWidget.mjs.map +1 -0
  10. package/dist/data-sources/ErrorState.cjs +18 -10
  11. package/dist/data-sources/ErrorState.cjs.map +1 -1
  12. package/dist/data-sources/ErrorState.d.cts +5 -3
  13. package/dist/data-sources/ErrorState.d.cts.map +1 -0
  14. package/dist/data-sources/ErrorState.d.mts +7 -0
  15. package/dist/data-sources/ErrorState.d.mts.map +1 -0
  16. package/dist/data-sources/ErrorState.mjs +18 -0
  17. package/dist/data-sources/ErrorState.mjs.map +1 -0
  18. package/dist/data-sources/context.cjs +22 -14
  19. package/dist/data-sources/context.cjs.map +1 -1
  20. package/dist/data-sources/context.d.cts +16 -10
  21. package/dist/data-sources/context.d.cts.map +1 -0
  22. package/dist/data-sources/context.d.mts +22 -0
  23. package/dist/data-sources/context.d.mts.map +1 -0
  24. package/dist/data-sources/context.mjs +21 -0
  25. package/dist/data-sources/context.mjs.map +1 -0
  26. package/dist/data-sources/fetchers/api.cjs +63 -10
  27. package/dist/data-sources/fetchers/api.cjs.map +1 -1
  28. package/dist/data-sources/fetchers/api.d.cts +4 -2
  29. package/dist/data-sources/fetchers/api.d.cts.map +1 -0
  30. package/dist/data-sources/fetchers/api.d.mts +10 -0
  31. package/dist/data-sources/fetchers/api.d.mts.map +1 -0
  32. package/dist/data-sources/fetchers/api.mjs +64 -0
  33. package/dist/data-sources/fetchers/api.mjs.map +1 -0
  34. package/dist/data-sources/fetchers/custom.cjs +106 -10
  35. package/dist/data-sources/fetchers/custom.cjs.map +1 -1
  36. package/dist/data-sources/fetchers/custom.d.cts +4 -2
  37. package/dist/data-sources/fetchers/custom.d.cts.map +1 -0
  38. package/dist/data-sources/fetchers/{custom.d.ts → custom.d.mts} +4 -2
  39. package/dist/data-sources/fetchers/custom.d.mts.map +1 -0
  40. package/dist/data-sources/fetchers/custom.mjs +107 -0
  41. package/dist/data-sources/fetchers/custom.mjs.map +1 -0
  42. package/dist/data-sources/fetchers/static.cjs +159 -14
  43. package/dist/data-sources/fetchers/static.cjs.map +1 -1
  44. package/dist/data-sources/fetchers/static.d.cts +12 -10
  45. package/dist/data-sources/fetchers/static.d.cts.map +1 -0
  46. package/dist/data-sources/fetchers/{static.d.ts → static.d.mts} +12 -10
  47. package/dist/data-sources/fetchers/static.d.mts.map +1 -0
  48. package/dist/data-sources/fetchers/static.mjs +158 -0
  49. package/dist/data-sources/fetchers/static.mjs.map +1 -0
  50. package/dist/data-sources/preview-context.cjs +15 -15
  51. package/dist/data-sources/preview-context.cjs.map +1 -1
  52. package/dist/data-sources/preview-context.d.cts +10 -6
  53. package/dist/data-sources/preview-context.d.cts.map +1 -0
  54. package/dist/data-sources/preview-context.d.mts +15 -0
  55. package/dist/data-sources/preview-context.d.mts.map +1 -0
  56. package/dist/data-sources/preview-context.mjs +18 -0
  57. package/dist/data-sources/preview-context.mjs.map +1 -0
  58. package/dist/data-sources/registry-context.cjs +51 -24
  59. package/dist/data-sources/registry-context.cjs.map +1 -1
  60. package/dist/data-sources/registry-context.d.cts +30 -22
  61. package/dist/data-sources/registry-context.d.cts.map +1 -0
  62. package/dist/data-sources/registry-context.d.mts +49 -0
  63. package/dist/data-sources/registry-context.d.mts.map +1 -0
  64. package/dist/data-sources/registry-context.mjs +49 -0
  65. package/dist/data-sources/registry-context.mjs.map +1 -0
  66. package/dist/data-sources/registry.cjs +29 -18
  67. package/dist/data-sources/registry.cjs.map +1 -1
  68. package/dist/data-sources/registry.d.cts +9 -7
  69. package/dist/data-sources/registry.d.cts.map +1 -0
  70. package/dist/data-sources/registry.d.mts +19 -0
  71. package/dist/data-sources/registry.d.mts.map +1 -0
  72. package/dist/data-sources/registry.mjs +29 -0
  73. package/dist/data-sources/registry.mjs.map +1 -0
  74. package/dist/data-sources/transformers.cjs +152 -10
  75. package/dist/data-sources/transformers.cjs.map +1 -1
  76. package/dist/data-sources/transformers.d.cts +4 -17
  77. package/dist/data-sources/transformers.d.cts.map +1 -0
  78. package/dist/data-sources/transformers.d.mts +10 -0
  79. package/dist/data-sources/transformers.d.mts.map +1 -0
  80. package/dist/data-sources/transformers.mjs +153 -0
  81. package/dist/data-sources/transformers.mjs.map +1 -0
  82. package/dist/data-sources/types.cjs +0 -4
  83. package/dist/data-sources/types.d.cts +2 -157
  84. package/dist/data-sources/types.d.mts +2 -0
  85. package/dist/data-sources/types.mjs +1 -0
  86. package/dist/data-sources/use-widget-data.cjs +109 -17
  87. package/dist/data-sources/use-widget-data.cjs.map +1 -1
  88. package/dist/data-sources/use-widget-data.d.cts +9 -8
  89. package/dist/data-sources/use-widget-data.d.cts.map +1 -0
  90. package/dist/data-sources/use-widget-data.d.mts +17 -0
  91. package/dist/data-sources/use-widget-data.d.mts.map +1 -0
  92. package/dist/data-sources/use-widget-data.mjs +109 -0
  93. package/dist/data-sources/use-widget-data.mjs.map +1 -0
  94. package/dist/index-Bxe_LIi8.d.cts +287 -0
  95. package/dist/index-Bxe_LIi8.d.cts.map +1 -0
  96. package/dist/index-CCAu2n19.d.mts +287 -0
  97. package/dist/index-CCAu2n19.d.mts.map +1 -0
  98. package/dist/registries/index.cjs +212 -127
  99. package/dist/registries/index.cjs.map +1 -1
  100. package/dist/registries/index.d.cts +146 -149
  101. package/dist/registries/index.d.cts.map +1 -0
  102. package/dist/registries/{index.d.ts → index.d.mts} +146 -149
  103. package/dist/registries/index.d.mts.map +1 -0
  104. package/dist/registries/index.mjs +229 -0
  105. package/dist/registries/index.mjs.map +1 -0
  106. package/dist/shell/AppShellLayout.cjs +47 -12
  107. package/dist/shell/AppShellLayout.cjs.map +1 -1
  108. package/dist/shell/AppShellLayout.d.cts +29 -19
  109. package/dist/shell/AppShellLayout.d.cts.map +1 -0
  110. package/dist/shell/AppShellLayout.d.mts +40 -0
  111. package/dist/shell/AppShellLayout.d.mts.map +1 -0
  112. package/dist/shell/AppShellLayout.mjs +46 -0
  113. package/dist/{chunk-45BCVWQK.cjs.map → shell/AppShellLayout.mjs.map} +1 -1
  114. package/dist/shell/ScreenHeader.cjs +44 -0
  115. package/dist/shell/ScreenHeader.cjs.map +1 -0
  116. package/dist/shell/ScreenHeader.d.cts +12 -0
  117. package/dist/shell/ScreenHeader.d.cts.map +1 -0
  118. package/dist/shell/ScreenHeader.d.mts +12 -0
  119. package/dist/shell/ScreenHeader.d.mts.map +1 -0
  120. package/dist/shell/ScreenHeader.mjs +42 -0
  121. package/dist/shell/ScreenHeader.mjs.map +1 -0
  122. package/dist/shell/ScreenHeaderContext.cjs +91 -0
  123. package/dist/shell/ScreenHeaderContext.cjs.map +1 -0
  124. package/dist/shell/ScreenHeaderContext.d.cts +36 -0
  125. package/dist/shell/ScreenHeaderContext.d.cts.map +1 -0
  126. package/dist/shell/ScreenHeaderContext.d.mts +36 -0
  127. package/dist/shell/ScreenHeaderContext.d.mts.map +1 -0
  128. package/dist/shell/ScreenHeaderContext.mjs +86 -0
  129. package/dist/shell/ScreenHeaderContext.mjs.map +1 -0
  130. package/dist/shell/ThemeModeContext.cjs +68 -18
  131. package/dist/shell/ThemeModeContext.cjs.map +1 -1
  132. package/dist/shell/ThemeModeContext.d.cts +23 -16
  133. package/dist/shell/ThemeModeContext.d.cts.map +1 -0
  134. package/dist/shell/ThemeModeContext.d.mts +34 -0
  135. package/dist/shell/ThemeModeContext.d.mts.map +1 -0
  136. package/dist/shell/ThemeModeContext.mjs +66 -0
  137. package/dist/shell/ThemeModeContext.mjs.map +1 -0
  138. package/dist/shell/index.cjs +43 -205
  139. package/dist/shell/index.d.cts +7 -43
  140. package/dist/shell/index.d.mts +7 -0
  141. package/dist/shell/index.mjs +7 -0
  142. package/dist/shell/sidebar.cjs +372 -87
  143. package/dist/shell/sidebar.cjs.map +1 -1
  144. package/dist/shell/sidebar.d.cts +38 -36
  145. package/dist/shell/sidebar.d.cts.map +1 -0
  146. package/dist/shell/{sidebar.d.ts → sidebar.d.mts} +38 -36
  147. package/dist/shell/sidebar.d.mts.map +1 -0
  148. package/dist/shell/sidebar.mjs +364 -0
  149. package/dist/{chunk-PFDBULOI.cjs.map → shell/sidebar.mjs.map} +1 -1
  150. package/dist/shell/use-mobile.cjs +49 -18
  151. package/dist/shell/use-mobile.cjs.map +1 -1
  152. package/dist/shell/use-mobile.d.cts +3 -1
  153. package/dist/shell/use-mobile.d.cts.map +1 -0
  154. package/dist/shell/{use-mobile.d.ts → use-mobile.d.mts} +3 -1
  155. package/dist/shell/use-mobile.d.mts.map +1 -0
  156. package/dist/shell/use-mobile.mjs +47 -0
  157. package/dist/shell/use-mobile.mjs.map +1 -0
  158. package/dist/theme/index.cjs +662 -549
  159. package/dist/theme/index.cjs.map +1 -1
  160. package/dist/theme/index.d.cts +32 -32
  161. package/dist/theme/index.d.cts.map +1 -0
  162. package/dist/theme/{index.d.ts → index.d.mts} +32 -32
  163. package/dist/theme/index.d.mts.map +1 -0
  164. package/dist/theme/index.mjs +727 -0
  165. package/dist/theme/index.mjs.map +1 -0
  166. package/dist/types/index.cjs +18 -72
  167. package/dist/types/index.d.cts +4 -268
  168. package/dist/types/index.d.mts +4 -0
  169. package/dist/types/index.mjs +2 -0
  170. package/dist/types-BIXtQlHB.d.cts +155 -0
  171. package/dist/types-BIXtQlHB.d.cts.map +1 -0
  172. package/dist/types-BXFX9bXp.cjs +303 -0
  173. package/dist/types-BXFX9bXp.cjs.map +1 -0
  174. package/dist/types-Bjmd7Fdx.mjs +208 -0
  175. package/dist/types-Bjmd7Fdx.mjs.map +1 -0
  176. package/dist/types-ByG6Xy3C.d.mts +85 -0
  177. package/dist/types-ByG6Xy3C.d.mts.map +1 -0
  178. package/dist/types-C5OFJy-O.d.mts +155 -0
  179. package/dist/types-C5OFJy-O.d.mts.map +1 -0
  180. package/dist/types-Ctu-Zio6.d.cts +85 -0
  181. package/dist/types-Ctu-Zio6.d.cts.map +1 -0
  182. package/dist/{widget-schema-D-ca3--K.d.ts → widget-schema--PY1uMWx.d.cts} +38 -41
  183. package/dist/widget-schema--PY1uMWx.d.cts.map +1 -0
  184. package/dist/{widget-schema-DvJdg1-B.d.cts → widget-schema-YkD5p3v4.d.mts} +38 -41
  185. package/dist/widget-schema-YkD5p3v4.d.mts.map +1 -0
  186. package/dist/widget-utils/index.cjs +96 -89
  187. package/dist/widget-utils/index.cjs.map +1 -1
  188. package/dist/widget-utils/index.d.cts +8 -6
  189. package/dist/widget-utils/index.d.cts.map +1 -0
  190. package/dist/widget-utils/{index.d.ts → index.d.mts} +8 -6
  191. package/dist/widget-utils/index.d.mts.map +1 -0
  192. package/dist/widget-utils/index.mjs +119 -0
  193. package/dist/widget-utils/index.mjs.map +1 -0
  194. package/package.json +4 -4
  195. package/dist/chunk-2SPTFZRC.js +0 -72
  196. package/dist/chunk-2SPTFZRC.js.map +0 -1
  197. package/dist/chunk-3I5Y3PEO.js +0 -23
  198. package/dist/chunk-3I5Y3PEO.js.map +0 -1
  199. package/dist/chunk-3ZRE7GX6.js +0 -620
  200. package/dist/chunk-3ZRE7GX6.js.map +0 -1
  201. package/dist/chunk-45BCVWQK.cjs +0 -38
  202. package/dist/chunk-46PUWB7C.cjs +0 -69
  203. package/dist/chunk-46PUWB7C.cjs.map +0 -1
  204. package/dist/chunk-5NYM4UTW.cjs +0 -58
  205. package/dist/chunk-5NYM4UTW.cjs.map +0 -1
  206. package/dist/chunk-B2NTWEDF.cjs +0 -130
  207. package/dist/chunk-B2NTWEDF.cjs.map +0 -1
  208. package/dist/chunk-GDY76JA6.cjs +0 -153
  209. package/dist/chunk-GDY76JA6.cjs.map +0 -1
  210. package/dist/chunk-HGVSPZEL.cjs +0 -119
  211. package/dist/chunk-HGVSPZEL.cjs.map +0 -1
  212. package/dist/chunk-HIDJYVKJ.js +0 -54
  213. package/dist/chunk-HIDJYVKJ.js.map +0 -1
  214. package/dist/chunk-KTXGU7OP.cjs +0 -136
  215. package/dist/chunk-KTXGU7OP.cjs.map +0 -1
  216. package/dist/chunk-KW5E2H5T.js +0 -128
  217. package/dist/chunk-KW5E2H5T.js.map +0 -1
  218. package/dist/chunk-LBLHDGMT.js +0 -25
  219. package/dist/chunk-LBLHDGMT.js.map +0 -1
  220. package/dist/chunk-MNVDL4FX.js +0 -134
  221. package/dist/chunk-MNVDL4FX.js.map +0 -1
  222. package/dist/chunk-MOTOSPAO.cjs +0 -15
  223. package/dist/chunk-MOTOSPAO.cjs.map +0 -1
  224. package/dist/chunk-N2K6W7FX.cjs +0 -169
  225. package/dist/chunk-N2K6W7FX.cjs.map +0 -1
  226. package/dist/chunk-PFDBULOI.cjs +0 -665
  227. package/dist/chunk-PVTQWD4I.js +0 -166
  228. package/dist/chunk-PVTQWD4I.js.map +0 -1
  229. package/dist/chunk-SJQPHJL4.cjs +0 -26
  230. package/dist/chunk-SJQPHJL4.cjs.map +0 -1
  231. package/dist/chunk-TML66UEU.js +0 -13
  232. package/dist/chunk-TML66UEU.js.map +0 -1
  233. package/dist/chunk-U3CQLX2Z.cjs +0 -28
  234. package/dist/chunk-U3CQLX2Z.cjs.map +0 -1
  235. package/dist/chunk-UUNEVOA5.js +0 -36
  236. package/dist/chunk-UUNEVOA5.js.map +0 -1
  237. package/dist/chunk-VRF7QEID.js +0 -67
  238. package/dist/chunk-VRF7QEID.js.map +0 -1
  239. package/dist/chunk-VSZWXSQA.js +0 -38
  240. package/dist/chunk-VSZWXSQA.js.map +0 -1
  241. package/dist/chunk-WYOHFNNW.js +0 -117
  242. package/dist/chunk-WYOHFNNW.js.map +0 -1
  243. package/dist/chunk-YKF5ZFF5.js +0 -136
  244. package/dist/chunk-YKF5ZFF5.js.map +0 -1
  245. package/dist/chunk-YXJMBVXO.cjs +0 -76
  246. package/dist/chunk-YXJMBVXO.cjs.map +0 -1
  247. package/dist/chunk-ZA4AE7KF.cjs +0 -42
  248. package/dist/chunk-ZA4AE7KF.cjs.map +0 -1
  249. package/dist/data-sources/DataAwareWidget.d.ts +0 -30
  250. package/dist/data-sources/DataAwareWidget.js +0 -57
  251. package/dist/data-sources/DataAwareWidget.js.map +0 -1
  252. package/dist/data-sources/ErrorState.d.ts +0 -5
  253. package/dist/data-sources/ErrorState.js +0 -3
  254. package/dist/data-sources/ErrorState.js.map +0 -1
  255. package/dist/data-sources/context.d.ts +0 -16
  256. package/dist/data-sources/context.js +0 -3
  257. package/dist/data-sources/context.js.map +0 -1
  258. package/dist/data-sources/fetchers/api.d.ts +0 -8
  259. package/dist/data-sources/fetchers/api.js +0 -3
  260. package/dist/data-sources/fetchers/api.js.map +0 -1
  261. package/dist/data-sources/fetchers/custom.js +0 -3
  262. package/dist/data-sources/fetchers/custom.js.map +0 -1
  263. package/dist/data-sources/fetchers/static.js +0 -3
  264. package/dist/data-sources/fetchers/static.js.map +0 -1
  265. package/dist/data-sources/preview-context.d.ts +0 -11
  266. package/dist/data-sources/preview-context.js +0 -18
  267. package/dist/data-sources/preview-context.js.map +0 -1
  268. package/dist/data-sources/registry-context.d.ts +0 -41
  269. package/dist/data-sources/registry-context.js +0 -9
  270. package/dist/data-sources/registry-context.js.map +0 -1
  271. package/dist/data-sources/registry.d.ts +0 -17
  272. package/dist/data-sources/registry.js +0 -7
  273. package/dist/data-sources/registry.js.map +0 -1
  274. package/dist/data-sources/transformers.d.ts +0 -23
  275. package/dist/data-sources/transformers.js +0 -3
  276. package/dist/data-sources/transformers.js.map +0 -1
  277. package/dist/data-sources/types.cjs.map +0 -1
  278. package/dist/data-sources/types.d.ts +0 -157
  279. package/dist/data-sources/types.js +0 -3
  280. package/dist/data-sources/types.js.map +0 -1
  281. package/dist/data-sources/use-widget-data.d.ts +0 -16
  282. package/dist/data-sources/use-widget-data.js +0 -10
  283. package/dist/data-sources/use-widget-data.js.map +0 -1
  284. package/dist/registries/index.js +0 -144
  285. package/dist/registries/index.js.map +0 -1
  286. package/dist/shareable-item-DkgWpwoU.d.cts +0 -21
  287. package/dist/shareable-item-DkgWpwoU.d.ts +0 -21
  288. package/dist/shell/AppShellLayout.d.ts +0 -30
  289. package/dist/shell/AppShellLayout.js +0 -5
  290. package/dist/shell/AppShellLayout.js.map +0 -1
  291. package/dist/shell/ThemeModeContext.d.ts +0 -27
  292. package/dist/shell/ThemeModeContext.js +0 -3
  293. package/dist/shell/ThemeModeContext.js.map +0 -1
  294. package/dist/shell/index.cjs.map +0 -1
  295. package/dist/shell/index.d.ts +0 -43
  296. package/dist/shell/index.js +0 -76
  297. package/dist/shell/index.js.map +0 -1
  298. package/dist/shell/sidebar.js +0 -4
  299. package/dist/shell/sidebar.js.map +0 -1
  300. package/dist/shell/use-mobile.js +0 -3
  301. package/dist/shell/use-mobile.js.map +0 -1
  302. package/dist/theme/index.js +0 -611
  303. package/dist/theme/index.js.map +0 -1
  304. package/dist/types/index.cjs.map +0 -1
  305. package/dist/types/index.d.ts +0 -268
  306. package/dist/types/index.js +0 -3
  307. package/dist/types/index.js.map +0 -1
  308. package/dist/types-CNIhy4JD.d.cts +0 -83
  309. package/dist/types-CNIhy4JD.d.ts +0 -83
  310. package/dist/widget-utils/index.js +0 -111
  311. package/dist/widget-utils/index.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ Object.defineProperty(exports, "__toESM", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return __toESM;
27
+ }
28
+ });
@@ -1,59 +1,50 @@
1
- 'use strict';
2
-
3
- var chunkKTXGU7OP_cjs = require('../chunk-KTXGU7OP.cjs');
4
- var chunkMOTOSPAO_cjs = require('../chunk-MOTOSPAO.cjs');
5
- require('../chunk-ZA4AE7KF.cjs');
6
- require('../chunk-SJQPHJL4.cjs');
7
- require('../chunk-U3CQLX2Z.cjs');
8
- require('../chunk-46PUWB7C.cjs');
9
- require('../chunk-HGVSPZEL.cjs');
10
- require('../chunk-N2K6W7FX.cjs');
11
- require('../chunk-B2NTWEDF.cjs');
12
- var react = require('react');
13
- var jsxRuntime = require('react/jsx-runtime');
14
-
15
- var EMPTY_OBJECT = {};
16
- function DataAwareWidgetImpl({
17
- widget,
18
- Component,
19
- additionalProps,
20
- loadingComponent,
21
- errorComponent,
22
- baseUrl
23
- }) {
24
- const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;
25
- const { data, isLoading, error } = chunkKTXGU7OP_cjs.useWidgetData(widget, { baseUrl });
26
- const mergedProps = react.useMemo(
27
- () => ({
28
- ...widget.props,
29
- ...data,
30
- ...stableAdditionalProps
31
- }),
32
- [widget.props, data, stableAdditionalProps]
33
- );
34
- if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {
35
- if (loadingComponent) {
36
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
37
- }
38
- return /* @__PURE__ */ jsxRuntime.jsx(
39
- "div",
40
- {
41
- className: "bg-muted animate-pulse rounded-md",
42
- style: { minHeight: 100 },
43
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
44
- }
45
- );
46
- }
47
- if (error && !data) {
48
- if (errorComponent) {
49
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: errorComponent(error) });
50
- }
51
- return /* @__PURE__ */ jsxRuntime.jsx(chunkMOTOSPAO_cjs.ErrorState, {});
52
- }
53
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...mergedProps });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ const require_data_sources_use_widget_data = require("./use-widget-data.cjs");
4
+ const require_data_sources_ErrorState = require("./ErrorState.cjs");
5
+ let react = require("react");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ //#region src/data-sources/DataAwareWidget.tsx
8
+ const EMPTY_OBJECT = {};
9
+ /**
10
+ * Wrapper component that resolves data sources before rendering the widget.
11
+ * Merges resolved data with static props.
12
+ */
13
+ function DataAwareWidgetImpl({ widget, Component, additionalProps, loadingComponent, errorComponent, baseUrl }) {
14
+ const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;
15
+ const { data, isLoading, error } = require_data_sources_use_widget_data.useWidgetData(widget, { baseUrl });
16
+ const mergedProps = (0, react.useMemo)(() => ({
17
+ ...widget.props,
18
+ ...data,
19
+ ...stableAdditionalProps
20
+ }), [
21
+ widget.props,
22
+ data,
23
+ stableAdditionalProps
24
+ ]);
25
+ if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {
26
+ if (loadingComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: loadingComponent });
27
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
28
+ className: "bg-muted animate-pulse rounded-md",
29
+ style: { minHeight: 100 },
30
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
31
+ className: "sr-only",
32
+ children: "Loading..."
33
+ })
34
+ });
35
+ }
36
+ if (error && !data) {
37
+ if (errorComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: errorComponent(error) });
38
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_data_sources_ErrorState.ErrorState, {});
39
+ }
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...mergedProps });
54
41
  }
55
- var DataAwareWidget = react.memo(DataAwareWidgetImpl);
56
-
42
+ /**
43
+ * Memoized wrapper component that resolves data sources before rendering the widget.
44
+ * Prevents re-renders when parent re-renders but props haven't changed.
45
+ */
46
+ const DataAwareWidget = (0, react.memo)(DataAwareWidgetImpl);
47
+ //#endregion
57
48
  exports.DataAwareWidget = DataAwareWidget;
58
- //# sourceMappingURL=DataAwareWidget.cjs.map
49
+
59
50
  //# sourceMappingURL=DataAwareWidget.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/data-sources/DataAwareWidget.tsx"],"names":["useWidgetData","useMemo","jsx","Fragment","ErrorState","memo"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,eAAwC,EAAC;AAM/C,SAAS,mBAAA,CAAoB;AAAA,EAC3B,MAAA;AAAA,EACA,SAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,EAAyB;AAEvB,EAAA,MAAM,wBAAwB,eAAA,IAAmB,YAAA;AACjD,EAAA,MAAM,EAAE,MAAM,SAAA,EAAW,KAAA,KAAUA,+BAAA,CAAc,MAAA,EAAQ,EAAE,OAAA,EAAS,CAAA;AAMpE,EAAA,MAAM,WAAA,GAAcC,aAAA;AAAA,IAClB,OAAO;AAAA,MACL,GAAG,MAAA,CAAO,KAAA;AAAA,MACV,GAAG,IAAA;AAAA,MACH,GAAG;AAAA,KACL,CAAA;AAAA,IACA,CAAC,MAAA,CAAO,KAAA,EAAO,IAAA,EAAM,qBAAqB;AAAA,GAC5C;AAGA,EAAA,IAAI,SAAA,IAAa,MAAA,CAAO,UAAA,EAAY,OAAA,EAAS,iBAAiB,KAAA,EAAO;AACnE,IAAA,IAAI,gBAAA,EAAkB;AACpB,MAAA,6DAAU,QAAA,EAAA,gBAAA,EAAiB,CAAA;AAAA,IAC7B;AAEA,IAAA,uBACEC,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,mCAAA;AAAA,QACV,KAAA,EAAO,EAAE,SAAA,EAAW,GAAA,EAAI;AAAA,QAExB,QAAA,kBAAAA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,YAAA,EAAU;AAAA;AAAA,KACtC;AAAA,EAEJ;AAGA,EAAA,IAAI,KAAA,IAAS,CAAC,IAAA,EAAM;AAClB,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,uBAAOA,cAAA,CAAAC,mBAAA,EAAA,EAAG,QAAA,EAAA,cAAA,CAAe,KAAK,CAAA,EAAE,CAAA;AAAA,IAClC;AAEA,IAAA,sCAAQC,4BAAA,EAAA,EAAW,CAAA;AAAA,EACrB;AAEA,EAAA,uBAAOF,cAAA,CAAC,SAAA,EAAA,EAAW,GAAG,WAAA,EAAa,CAAA;AACrC;AAMO,IAAM,eAAA,GAAkBG,WAAK,mBAAmB","file":"DataAwareWidget.cjs","sourcesContent":["import { memo, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport { useWidgetData } from \"./use-widget-data\";\nimport { ErrorState } from \"./ErrorState\";\n\nexport interface DataAwareWidgetProps {\n widget: WidgetSchema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Component: ComponentType<any>;\n /** Additional props to pass through (e.g., edit mode callbacks) */\n additionalProps?: Record<string, unknown>;\n /** Custom loading component */\n loadingComponent?: ReactNode;\n /** Custom error component */\n errorComponent?: (error: Error) => ReactNode;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n// Empty object constant to avoid creating new references\nconst EMPTY_OBJECT: Record<string, unknown> = {};\n\n/**\n * Wrapper component that resolves data sources before rendering the widget.\n * Merges resolved data with static props.\n */\nfunction DataAwareWidgetImpl({\n widget,\n Component,\n additionalProps,\n loadingComponent,\n errorComponent,\n baseUrl,\n}: DataAwareWidgetProps) {\n // Use stable empty object if no additionalProps provided\n const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;\n const { data, isLoading, error } = useWidgetData(widget, { baseUrl });\n\n // Merge static props with resolved data\n // Data takes precedence (allows overriding defaults)\n // Memoized to prevent unnecessary child re-renders\n // Note: Must be called before any early returns to satisfy Rules of Hooks\n const mergedProps = useMemo(\n () => ({\n ...widget.props,\n ...data,\n ...stableAdditionalProps,\n }),\n [widget.props, data, stableAdditionalProps],\n );\n\n // Show loading state\n if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Default skeleton - can be customized\n return (\n <div\n className=\"bg-muted animate-pulse rounded-md\"\n style={{ minHeight: 100 }}\n >\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n\n // Show error state (if no fallback was applied)\n if (error && !data) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n // Default error display\n return <ErrorState />;\n }\n\n return <Component {...mergedProps} />;\n}\n\n/**\n * Memoized wrapper component that resolves data sources before rendering the widget.\n * Prevents re-renders when parent re-renders but props haven't changed.\n */\nexport const DataAwareWidget = memo(DataAwareWidgetImpl);\n"]}
1
+ {"version":3,"file":"DataAwareWidget.cjs","names":["useWidgetData","ErrorState"],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"sourcesContent":["import { memo, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport { useWidgetData } from \"./use-widget-data\";\nimport { ErrorState } from \"./ErrorState\";\n\nexport interface DataAwareWidgetProps {\n widget: WidgetSchema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Component: ComponentType<any>;\n /** Additional props to pass through (e.g., edit mode callbacks) */\n additionalProps?: Record<string, unknown>;\n /** Custom loading component */\n loadingComponent?: ReactNode;\n /** Custom error component */\n errorComponent?: (error: Error) => ReactNode;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n// Empty object constant to avoid creating new references\nconst EMPTY_OBJECT: Record<string, unknown> = {};\n\n/**\n * Wrapper component that resolves data sources before rendering the widget.\n * Merges resolved data with static props.\n */\nfunction DataAwareWidgetImpl({\n widget,\n Component,\n additionalProps,\n loadingComponent,\n errorComponent,\n baseUrl,\n}: DataAwareWidgetProps) {\n // Use stable empty object if no additionalProps provided\n const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;\n const { data, isLoading, error } = useWidgetData(widget, { baseUrl });\n\n // Merge static props with resolved data\n // Data takes precedence (allows overriding defaults)\n // Memoized to prevent unnecessary child re-renders\n // Note: Must be called before any early returns to satisfy Rules of Hooks\n const mergedProps = useMemo(\n () => ({\n ...widget.props,\n ...data,\n ...stableAdditionalProps,\n }),\n [widget.props, data, stableAdditionalProps],\n );\n\n // Show loading state\n if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Default skeleton - can be customized\n return (\n <div\n className=\"bg-muted animate-pulse rounded-md\"\n style={{ minHeight: 100 }}\n >\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n\n // Show error state (if no fallback was applied)\n if (error && !data) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n // Default error display\n return <ErrorState />;\n }\n\n return <Component {...mergedProps} />;\n}\n\n/**\n * Memoized wrapper component that resolves data sources before rendering the widget.\n * Prevents re-renders when parent re-renders but props haven't changed.\n */\nexport const DataAwareWidget = memo(DataAwareWidgetImpl);\n"],"mappings":";;;;;;;AAoBA,MAAM,eAAwC,EAAE;;;;;AAMhD,SAAS,oBAAoB,EAC3B,QACA,WACA,iBACA,kBACA,gBACA,WACuB;CAEvB,MAAM,wBAAwB,mBAAmB;CACjD,MAAM,EAAE,MAAM,WAAW,UAAUA,qCAAAA,cAAc,QAAQ,EAAE,SAAS,CAAC;CAMrE,MAAM,eAAA,GAAA,MAAA,gBACG;EACL,GAAG,OAAO;EACV,GAAG;EACH,GAAG;EACJ,GACD;EAAC,OAAO;EAAO;EAAM;EAAsB,CAC5C;AAGD,KAAI,aAAa,OAAO,YAAY,SAAS,iBAAiB,OAAO;AACnE,MAAI,iBACF,QAAO,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,kBAAoB,CAAA;AAGhC,SACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,WAAW,KAAK;aAEzB,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,WAAU;cAAU;IAAiB,CAAA;GACvC,CAAA;;AAKV,KAAI,SAAS,CAAC,MAAM;AAClB,MAAI,eACF,QAAO,iBAAA,GAAA,kBAAA,KAAA,kBAAA,UAAA,EAAA,UAAG,eAAe,MAAM,EAAI,CAAA;AAGrC,SAAO,iBAAA,GAAA,kBAAA,KAACC,gCAAAA,YAAD,EAAc,CAAA;;AAGvB,QAAO,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAW,GAAI,aAAe,CAAA;;;;;;AAOvC,MAAa,mBAAA,GAAA,MAAA,MAAuB,oBAAoB"}
@@ -1,30 +1,38 @@
1
- import * as React from 'react';
2
- import { ComponentType, ReactNode } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { a as WidgetSchema } from '../widget-schema-DvJdg1-B.cjs';
5
- import './types.cjs';
1
+ import { a as WidgetSchema } from "../widget-schema--PY1uMWx.cjs";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as react from "react";
4
+ import { ComponentType, ReactNode } from "react";
6
5
 
6
+ //#region src/data-sources/DataAwareWidget.d.ts
7
7
  interface DataAwareWidgetProps {
8
- widget: WidgetSchema;
9
- Component: ComponentType<any>;
10
- /** Additional props to pass through (e.g., edit mode callbacks) */
11
- additionalProps?: Record<string, unknown>;
12
- /** Custom loading component */
13
- loadingComponent?: ReactNode;
14
- /** Custom error component */
15
- errorComponent?: (error: Error) => ReactNode;
16
- /** Base URL for API calls (e.g., "https://api.fluid.app/api") */
17
- baseUrl?: string | undefined;
8
+ widget: WidgetSchema;
9
+ Component: ComponentType<any>;
10
+ /** Additional props to pass through (e.g., edit mode callbacks) */
11
+ additionalProps?: Record<string, unknown>;
12
+ /** Custom loading component */
13
+ loadingComponent?: ReactNode;
14
+ /** Custom error component */
15
+ errorComponent?: (error: Error) => ReactNode;
16
+ /** Base URL for API calls (e.g., "https://api.fluid.app/api") */
17
+ baseUrl?: string | undefined;
18
18
  }
19
19
  /**
20
20
  * Wrapper component that resolves data sources before rendering the widget.
21
21
  * Merges resolved data with static props.
22
22
  */
23
- declare function DataAwareWidgetImpl({ widget, Component, additionalProps, loadingComponent, errorComponent, baseUrl, }: DataAwareWidgetProps): react_jsx_runtime.JSX.Element;
23
+ declare function DataAwareWidgetImpl({
24
+ widget,
25
+ Component,
26
+ additionalProps,
27
+ loadingComponent,
28
+ errorComponent,
29
+ baseUrl
30
+ }: DataAwareWidgetProps): react_jsx_runtime0.JSX.Element;
24
31
  /**
25
32
  * Memoized wrapper component that resolves data sources before rendering the widget.
26
33
  * Prevents re-renders when parent re-renders but props haven't changed.
27
34
  */
28
- declare const DataAwareWidget: React.MemoExoticComponent<typeof DataAwareWidgetImpl>;
29
-
30
- export { DataAwareWidget, type DataAwareWidgetProps };
35
+ declare const DataAwareWidget: react.MemoExoticComponent<typeof DataAwareWidgetImpl>;
36
+ //#endregion
37
+ export { DataAwareWidget, DataAwareWidgetProps };
38
+ //# sourceMappingURL=DataAwareWidget.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataAwareWidget.d.cts","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"mappings":";;;;;;UAKiB,oBAAA;EACf,MAAA,EAAQ,YAAA;EAER,SAAA,EAAW,aAAA;;EAEX,eAAA,GAAkB,MAAA;EALiB;EAOnC,gBAAA,GAAmB,SAAA;EANX;EAQR,cAAA,IAAkB,KAAA,EAAO,KAAA,KAAU,SAAA;EAJjB;EAMlB,OAAA;AAAA;;;;;iBAUO,mBAAA,CAAA;EACP,MAAA;EACA,SAAA;EACA,eAAA;EACA,gBAAA;EACA,cAAA;EACA;AAAA,GACC,oBAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;cAkDV,eAAA,EAAe,KAAA,CAAA,mBAAA,QAAA,mBAAA"}
@@ -0,0 +1,38 @@
1
+ import { a as WidgetSchema } from "../widget-schema-YkD5p3v4.mjs";
2
+ import * as react from "react";
3
+ import { ComponentType, ReactNode } from "react";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+
6
+ //#region src/data-sources/DataAwareWidget.d.ts
7
+ interface DataAwareWidgetProps {
8
+ widget: WidgetSchema;
9
+ Component: ComponentType<any>;
10
+ /** Additional props to pass through (e.g., edit mode callbacks) */
11
+ additionalProps?: Record<string, unknown>;
12
+ /** Custom loading component */
13
+ loadingComponent?: ReactNode;
14
+ /** Custom error component */
15
+ errorComponent?: (error: Error) => ReactNode;
16
+ /** Base URL for API calls (e.g., "https://api.fluid.app/api") */
17
+ baseUrl?: string | undefined;
18
+ }
19
+ /**
20
+ * Wrapper component that resolves data sources before rendering the widget.
21
+ * Merges resolved data with static props.
22
+ */
23
+ declare function DataAwareWidgetImpl({
24
+ widget,
25
+ Component,
26
+ additionalProps,
27
+ loadingComponent,
28
+ errorComponent,
29
+ baseUrl
30
+ }: DataAwareWidgetProps): react_jsx_runtime0.JSX.Element;
31
+ /**
32
+ * Memoized wrapper component that resolves data sources before rendering the widget.
33
+ * Prevents re-renders when parent re-renders but props haven't changed.
34
+ */
35
+ declare const DataAwareWidget: react.MemoExoticComponent<typeof DataAwareWidgetImpl>;
36
+ //#endregion
37
+ export { DataAwareWidget, DataAwareWidgetProps };
38
+ //# sourceMappingURL=DataAwareWidget.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataAwareWidget.d.mts","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"mappings":";;;;;;UAKiB,oBAAA;EACf,MAAA,EAAQ,YAAA;EAER,SAAA,EAAW,aAAA;;EAEX,eAAA,GAAkB,MAAA;EALiB;EAOnC,gBAAA,GAAmB,SAAA;EANX;EAQR,cAAA,IAAkB,KAAA,EAAO,KAAA,KAAU,SAAA;EAJjB;EAMlB,OAAA;AAAA;;;;;iBAUO,mBAAA,CAAA;EACP,MAAA;EACA,SAAA;EACA,eAAA;EACA,gBAAA;EACA,cAAA;EACA;AAAA,GACC,oBAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;cAkDV,eAAA,EAAe,KAAA,CAAA,mBAAA,QAAA,mBAAA"}
@@ -0,0 +1,48 @@
1
+ import { useWidgetData } from "./use-widget-data.mjs";
2
+ import { ErrorState } from "./ErrorState.mjs";
3
+ import { memo, useMemo } from "react";
4
+ import { Fragment, jsx } from "react/jsx-runtime";
5
+ //#region src/data-sources/DataAwareWidget.tsx
6
+ const EMPTY_OBJECT = {};
7
+ /**
8
+ * Wrapper component that resolves data sources before rendering the widget.
9
+ * Merges resolved data with static props.
10
+ */
11
+ function DataAwareWidgetImpl({ widget, Component, additionalProps, loadingComponent, errorComponent, baseUrl }) {
12
+ const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;
13
+ const { data, isLoading, error } = useWidgetData(widget, { baseUrl });
14
+ const mergedProps = useMemo(() => ({
15
+ ...widget.props,
16
+ ...data,
17
+ ...stableAdditionalProps
18
+ }), [
19
+ widget.props,
20
+ data,
21
+ stableAdditionalProps
22
+ ]);
23
+ if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {
24
+ if (loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
25
+ return /* @__PURE__ */ jsx("div", {
26
+ className: "bg-muted animate-pulse rounded-md",
27
+ style: { minHeight: 100 },
28
+ children: /* @__PURE__ */ jsx("span", {
29
+ className: "sr-only",
30
+ children: "Loading..."
31
+ })
32
+ });
33
+ }
34
+ if (error && !data) {
35
+ if (errorComponent) return /* @__PURE__ */ jsx(Fragment, { children: errorComponent(error) });
36
+ return /* @__PURE__ */ jsx(ErrorState, {});
37
+ }
38
+ return /* @__PURE__ */ jsx(Component, { ...mergedProps });
39
+ }
40
+ /**
41
+ * Memoized wrapper component that resolves data sources before rendering the widget.
42
+ * Prevents re-renders when parent re-renders but props haven't changed.
43
+ */
44
+ const DataAwareWidget = memo(DataAwareWidgetImpl);
45
+ //#endregion
46
+ export { DataAwareWidget };
47
+
48
+ //# sourceMappingURL=DataAwareWidget.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataAwareWidget.mjs","names":[],"sources":["../../src/data-sources/DataAwareWidget.tsx"],"sourcesContent":["import { memo, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { WidgetSchema } from \"../types/widget-schema\";\nimport { useWidgetData } from \"./use-widget-data\";\nimport { ErrorState } from \"./ErrorState\";\n\nexport interface DataAwareWidgetProps {\n widget: WidgetSchema;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Component: ComponentType<any>;\n /** Additional props to pass through (e.g., edit mode callbacks) */\n additionalProps?: Record<string, unknown>;\n /** Custom loading component */\n loadingComponent?: ReactNode;\n /** Custom error component */\n errorComponent?: (error: Error) => ReactNode;\n /** Base URL for API calls (e.g., \"https://api.fluid.app/api\") */\n baseUrl?: string | undefined;\n}\n\n// Empty object constant to avoid creating new references\nconst EMPTY_OBJECT: Record<string, unknown> = {};\n\n/**\n * Wrapper component that resolves data sources before rendering the widget.\n * Merges resolved data with static props.\n */\nfunction DataAwareWidgetImpl({\n widget,\n Component,\n additionalProps,\n loadingComponent,\n errorComponent,\n baseUrl,\n}: DataAwareWidgetProps) {\n // Use stable empty object if no additionalProps provided\n const stableAdditionalProps = additionalProps ?? EMPTY_OBJECT;\n const { data, isLoading, error } = useWidgetData(widget, { baseUrl });\n\n // Merge static props with resolved data\n // Data takes precedence (allows overriding defaults)\n // Memoized to prevent unnecessary child re-renders\n // Note: Must be called before any early returns to satisfy Rules of Hooks\n const mergedProps = useMemo(\n () => ({\n ...widget.props,\n ...data,\n ...stableAdditionalProps,\n }),\n [widget.props, data, stableAdditionalProps],\n );\n\n // Show loading state\n if (isLoading && widget.dataSource?.loading?.showSkeleton !== false) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Default skeleton - can be customized\n return (\n <div\n className=\"bg-muted animate-pulse rounded-md\"\n style={{ minHeight: 100 }}\n >\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n\n // Show error state (if no fallback was applied)\n if (error && !data) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n // Default error display\n return <ErrorState />;\n }\n\n return <Component {...mergedProps} />;\n}\n\n/**\n * Memoized wrapper component that resolves data sources before rendering the widget.\n * Prevents re-renders when parent re-renders but props haven't changed.\n */\nexport const DataAwareWidget = memo(DataAwareWidgetImpl);\n"],"mappings":";;;;;AAoBA,MAAM,eAAwC,EAAE;;;;;AAMhD,SAAS,oBAAoB,EAC3B,QACA,WACA,iBACA,kBACA,gBACA,WACuB;CAEvB,MAAM,wBAAwB,mBAAmB;CACjD,MAAM,EAAE,MAAM,WAAW,UAAU,cAAc,QAAQ,EAAE,SAAS,CAAC;CAMrE,MAAM,cAAc,eACX;EACL,GAAG,OAAO;EACV,GAAG;EACH,GAAG;EACJ,GACD;EAAC,OAAO;EAAO;EAAM;EAAsB,CAC5C;AAGD,KAAI,aAAa,OAAO,YAAY,SAAS,iBAAiB,OAAO;AACnE,MAAI,iBACF,QAAO,oBAAA,UAAA,EAAA,UAAG,kBAAoB,CAAA;AAGhC,SACE,oBAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,WAAW,KAAK;aAEzB,oBAAC,QAAD;IAAM,WAAU;cAAU;IAAiB,CAAA;GACvC,CAAA;;AAKV,KAAI,SAAS,CAAC,MAAM;AAClB,MAAI,eACF,QAAO,oBAAA,UAAA,EAAA,UAAG,eAAe,MAAM,EAAI,CAAA;AAGrC,SAAO,oBAAC,YAAD,EAAc,CAAA;;AAGvB,QAAO,oBAAC,WAAD,EAAW,GAAI,aAAe,CAAA;;;;;;AAOvC,MAAa,kBAAkB,KAAK,oBAAoB"}
@@ -1,12 +1,20 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ //#region src/data-sources/ErrorState.tsx
5
+ function ErrorState() {
6
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7
+ className: "flex min-h-[120px] flex-col items-center justify-center p-6 text-center",
8
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9
+ className: "text-lg font-semibold",
10
+ children: "Something Went Wrong"
11
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12
+ className: "text-muted-foreground text-sm",
13
+ children: "Please contact a company admin for help"
14
+ })]
15
+ });
16
+ }
17
+ //#endregion
18
+ exports.ErrorState = ErrorState;
2
19
 
3
- var chunkMOTOSPAO_cjs = require('../chunk-MOTOSPAO.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "ErrorState", {
8
- enumerable: true,
9
- get: function () { return chunkMOTOSPAO_cjs.ErrorState; }
10
- });
11
- //# sourceMappingURL=ErrorState.cjs.map
12
20
  //# sourceMappingURL=ErrorState.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ErrorState.cjs"}
1
+ {"version":3,"file":"ErrorState.cjs","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"sourcesContent":["export function ErrorState() {\n return (\n <div className=\"flex min-h-[120px] flex-col items-center justify-center p-6 text-center\">\n <p className=\"text-lg font-semibold\">Something Went Wrong</p>\n <p className=\"text-muted-foreground text-sm\">\n Please contact a company admin for help\n </p>\n </div>\n );\n}\n"],"mappings":";;;;AAAA,SAAgB,aAAa;AAC3B,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,WAAU;aAAwB;GAAwB,CAAA,EAC7D,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,WAAU;aAAgC;GAEzC,CAAA,CACA"}
@@ -1,5 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function ErrorState(): react_jsx_runtime.JSX.Element;
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
2
 
3
+ //#region src/data-sources/ErrorState.d.ts
4
+ declare function ErrorState(): react_jsx_runtime0.JSX.Element;
5
+ //#endregion
5
6
  export { ErrorState };
7
+ //# sourceMappingURL=ErrorState.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorState.d.cts","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"mappings":";;;iBAAgB,UAAA,CAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/data-sources/ErrorState.d.ts
4
+ declare function ErrorState(): react_jsx_runtime0.JSX.Element;
5
+ //#endregion
6
+ export { ErrorState };
7
+ //# sourceMappingURL=ErrorState.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorState.d.mts","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"mappings":";;;iBAAgB,UAAA,CAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,18 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/data-sources/ErrorState.tsx
3
+ function ErrorState() {
4
+ return /* @__PURE__ */ jsxs("div", {
5
+ className: "flex min-h-[120px] flex-col items-center justify-center p-6 text-center",
6
+ children: [/* @__PURE__ */ jsx("p", {
7
+ className: "text-lg font-semibold",
8
+ children: "Something Went Wrong"
9
+ }), /* @__PURE__ */ jsx("p", {
10
+ className: "text-muted-foreground text-sm",
11
+ children: "Please contact a company admin for help"
12
+ })]
13
+ });
14
+ }
15
+ //#endregion
16
+ export { ErrorState };
17
+
18
+ //# sourceMappingURL=ErrorState.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorState.mjs","names":[],"sources":["../../src/data-sources/ErrorState.tsx"],"sourcesContent":["export function ErrorState() {\n return (\n <div className=\"flex min-h-[120px] flex-col items-center justify-center p-6 text-center\">\n <p className=\"text-lg font-semibold\">Something Went Wrong</p>\n <p className=\"text-muted-foreground text-sm\">\n Please contact a company admin for help\n </p>\n </div>\n );\n}\n"],"mappings":";;AAAA,SAAgB,aAAa;AAC3B,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,KAAD;GAAG,WAAU;aAAwB;GAAwB,CAAA,EAC7D,oBAAC,KAAD;GAAG,WAAU;aAAgC;GAEzC,CAAA,CACA"}
@@ -1,16 +1,24 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/data-sources/context.tsx
6
+ const DataSourceContext = (0, react.createContext)({});
7
+ function DataSourceProvider({ baseUrl, getApiHeaders, children }) {
8
+ const value = (0, react.useMemo)(() => ({
9
+ baseUrl,
10
+ getApiHeaders
11
+ }), [baseUrl, getApiHeaders]);
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataSourceContext.Provider, {
13
+ value,
14
+ children
15
+ });
16
+ }
17
+ function useDataSourceConfig() {
18
+ return (0, react.useContext)(DataSourceContext);
19
+ }
20
+ //#endregion
21
+ exports.DataSourceProvider = DataSourceProvider;
22
+ exports.useDataSourceConfig = useDataSourceConfig;
2
23
 
3
- var chunkSJQPHJL4_cjs = require('../chunk-SJQPHJL4.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "DataSourceProvider", {
8
- enumerable: true,
9
- get: function () { return chunkSJQPHJL4_cjs.DataSourceProvider; }
10
- });
11
- Object.defineProperty(exports, "useDataSourceConfig", {
12
- enumerable: true,
13
- get: function () { return chunkSJQPHJL4_cjs.useDataSourceConfig; }
14
- });
15
- //# sourceMappingURL=context.cjs.map
16
24
  //# sourceMappingURL=context.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"context.cjs"}
1
+ {"version":3,"file":"context.cjs","names":[],"sources":["../../src/data-sources/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport interface DataSourceContextValue {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n}\n\nconst DataSourceContext = createContext<DataSourceContextValue>({});\n\nexport interface DataSourceProviderProps {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n children: ReactNode;\n}\n\nexport function DataSourceProvider({\n baseUrl,\n getApiHeaders,\n children,\n}: DataSourceProviderProps) {\n const value = useMemo(\n () => ({ baseUrl, getApiHeaders }),\n [baseUrl, getApiHeaders],\n );\n\n return (\n <DataSourceContext.Provider value={value}>\n {children}\n </DataSourceContext.Provider>\n );\n}\n\nexport function useDataSourceConfig(): DataSourceContextValue {\n return useContext(DataSourceContext);\n}\n"],"mappings":";;;;;AAOA,MAAM,qBAAA,GAAA,MAAA,eAA0D,EAAE,CAAC;AAQnE,SAAgB,mBAAmB,EACjC,SACA,eACA,YAC0B;CAC1B,MAAM,SAAA,GAAA,MAAA,gBACG;EAAE;EAAS;EAAe,GACjC,CAAC,SAAS,cAAc,CACzB;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,kBAAkB,UAAnB;EAAmC;EAChC;EAC0B,CAAA;;AAIjC,SAAgB,sBAA8C;AAC5D,SAAA,GAAA,MAAA,YAAkB,kBAAkB"}
@@ -1,16 +1,22 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { ReactNode } from "react";
3
3
 
4
+ //#region src/data-sources/context.d.ts
4
5
  interface DataSourceContextValue {
5
- baseUrl?: string | undefined;
6
- getApiHeaders?: (() => Record<string, string>) | undefined;
6
+ baseUrl?: string | undefined;
7
+ getApiHeaders?: (() => Record<string, string>) | undefined;
7
8
  }
8
9
  interface DataSourceProviderProps {
9
- baseUrl?: string | undefined;
10
- getApiHeaders?: (() => Record<string, string>) | undefined;
11
- children: ReactNode;
10
+ baseUrl?: string | undefined;
11
+ getApiHeaders?: (() => Record<string, string>) | undefined;
12
+ children: ReactNode;
12
13
  }
13
- declare function DataSourceProvider({ baseUrl, getApiHeaders, children, }: DataSourceProviderProps): react_jsx_runtime.JSX.Element;
14
+ declare function DataSourceProvider({
15
+ baseUrl,
16
+ getApiHeaders,
17
+ children
18
+ }: DataSourceProviderProps): react_jsx_runtime0.JSX.Element;
14
19
  declare function useDataSourceConfig(): DataSourceContextValue;
15
-
16
- export { type DataSourceContextValue, DataSourceProvider, type DataSourceProviderProps, useDataSourceConfig };
20
+ //#endregion
21
+ export { DataSourceContextValue, DataSourceProvider, DataSourceProviderProps, useDataSourceConfig };
22
+ //# sourceMappingURL=context.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.cts","names":[],"sources":["../../src/data-sources/context.tsx"],"mappings":";;;;UAEiB,sBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;AAAA;AAAA,UAKR,uBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;EACvB,QAAA,EAAU,SAAA;AAAA;AAAA,iBAGI,kBAAA,CAAA;EACd,OAAA;EACA,aAAA;EACA;AAAA,GACC,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAaV,mBAAA,CAAA,GAAuB,sBAAA"}
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/data-sources/context.d.ts
5
+ interface DataSourceContextValue {
6
+ baseUrl?: string | undefined;
7
+ getApiHeaders?: (() => Record<string, string>) | undefined;
8
+ }
9
+ interface DataSourceProviderProps {
10
+ baseUrl?: string | undefined;
11
+ getApiHeaders?: (() => Record<string, string>) | undefined;
12
+ children: ReactNode;
13
+ }
14
+ declare function DataSourceProvider({
15
+ baseUrl,
16
+ getApiHeaders,
17
+ children
18
+ }: DataSourceProviderProps): react_jsx_runtime0.JSX.Element;
19
+ declare function useDataSourceConfig(): DataSourceContextValue;
20
+ //#endregion
21
+ export { DataSourceContextValue, DataSourceProvider, DataSourceProviderProps, useDataSourceConfig };
22
+ //# sourceMappingURL=context.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.mts","names":[],"sources":["../../src/data-sources/context.tsx"],"mappings":";;;;UAEiB,sBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;AAAA;AAAA,UAKR,uBAAA;EACf,OAAA;EACA,aAAA,UAAuB,MAAA;EACvB,QAAA,EAAU,SAAA;AAAA;AAAA,iBAGI,kBAAA,CAAA;EACd,OAAA;EACA,aAAA;EACA;AAAA,GACC,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAaV,mBAAA,CAAA,GAAuB,sBAAA"}
@@ -0,0 +1,21 @@
1
+ import { createContext, useContext, useMemo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/data-sources/context.tsx
4
+ const DataSourceContext = createContext({});
5
+ function DataSourceProvider({ baseUrl, getApiHeaders, children }) {
6
+ const value = useMemo(() => ({
7
+ baseUrl,
8
+ getApiHeaders
9
+ }), [baseUrl, getApiHeaders]);
10
+ return /* @__PURE__ */ jsx(DataSourceContext.Provider, {
11
+ value,
12
+ children
13
+ });
14
+ }
15
+ function useDataSourceConfig() {
16
+ return useContext(DataSourceContext);
17
+ }
18
+ //#endregion
19
+ export { DataSourceProvider, useDataSourceConfig };
20
+
21
+ //# sourceMappingURL=context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.mjs","names":[],"sources":["../../src/data-sources/context.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport interface DataSourceContextValue {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n}\n\nconst DataSourceContext = createContext<DataSourceContextValue>({});\n\nexport interface DataSourceProviderProps {\n baseUrl?: string | undefined;\n getApiHeaders?: (() => Record<string, string>) | undefined;\n children: ReactNode;\n}\n\nexport function DataSourceProvider({\n baseUrl,\n getApiHeaders,\n children,\n}: DataSourceProviderProps) {\n const value = useMemo(\n () => ({ baseUrl, getApiHeaders }),\n [baseUrl, getApiHeaders],\n );\n\n return (\n <DataSourceContext.Provider value={value}>\n {children}\n </DataSourceContext.Provider>\n );\n}\n\nexport function useDataSourceConfig(): DataSourceContextValue {\n return useContext(DataSourceContext);\n}\n"],"mappings":";;;AAOA,MAAM,oBAAoB,cAAsC,EAAE,CAAC;AAQnE,SAAgB,mBAAmB,EACjC,SACA,eACA,YAC0B;CAC1B,MAAM,QAAQ,eACL;EAAE;EAAS;EAAe,GACjC,CAAC,SAAS,cAAc,CACzB;AAED,QACE,oBAAC,kBAAkB,UAAnB;EAAmC;EAChC;EAC0B,CAAA;;AAIjC,SAAgB,sBAA8C;AAC5D,QAAO,WAAW,kBAAkB"}
@@ -1,12 +1,65 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/data-sources/fetchers/api.ts
3
+ /**
4
+ * Extracts a value from an object using dot notation path
5
+ * e.g., getByPath({ data: { items: [1,2,3] } }, 'data.items') => [1,2,3]
6
+ */
7
+ function getByPath(obj, path) {
8
+ return path.split(".").reduce((current, key) => {
9
+ if (current && typeof current === "object" && key in current) return current[key];
10
+ }, obj);
11
+ }
12
+ /**
13
+ * Replaces {variable} placeholders in an endpoint path with values from the
14
+ * variables map. E.g., "/reps/{rep_id}/most_shared" with { rep_id: "42" }
15
+ * becomes "/reps/42/most_shared".
16
+ */
17
+ function interpolateVariables(endpoint, variables) {
18
+ if (!variables) return endpoint;
19
+ const resolved = endpoint.replace(/\{(\w+)\}/g, (match, key) => variables[key] ?? match);
20
+ const unresolved = resolved.match(/\{(\w+)\}/g);
21
+ if (unresolved) console.warn(`[DataSource] Unresolved variable placeholders in endpoint: ${unresolved.join(", ")}. Endpoint: "${endpoint}". Available variables: ${Object.keys(variables).join(", ") || "(none)"}`);
22
+ return resolved;
23
+ }
24
+ /**
25
+ * Resolves the full URL for an endpoint.
26
+ * - Substitutes {variable} placeholders from context variables
27
+ * - Absolute URLs (starting with http:// or https://) are used as-is
28
+ * - Relative paths are prefixed with the context's baseUrl
29
+ */
30
+ function resolveEndpointUrl(endpoint, baseUrl, variables) {
31
+ const resolved = interpolateVariables(endpoint, variables);
32
+ if (resolved.startsWith("http://") || resolved.startsWith("https://")) return resolved;
33
+ if (baseUrl) return `${baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl}${resolved.startsWith("/") ? resolved : `/${resolved}`}`;
34
+ return resolved;
35
+ }
36
+ /**
37
+ * Default API fetcher implementation
38
+ */
39
+ async function apiFetcher(source, context) {
40
+ const { endpoint, method = "GET", headers = {}, body } = source;
41
+ const mergedVariables = {
42
+ ...context.variables,
43
+ ...source.variables
44
+ };
45
+ const url = resolveEndpointUrl(endpoint, context.baseUrl, mergedVariables);
46
+ const fetchOptions = {
47
+ method,
48
+ headers: {
49
+ "content-type": "application/json",
50
+ ...context.getApiHeaders?.(),
51
+ ...headers
52
+ },
53
+ signal: context.signal
54
+ };
55
+ if (body && (method === "POST" || method === "PUT")) fetchOptions.body = JSON.stringify(body);
56
+ const response = await fetch(url, fetchOptions);
57
+ if (!response.ok) throw new Error(`API request failed: ${response.status} ${response.statusText}`);
58
+ const data = await response.json();
59
+ if (source.resultPath) return getByPath(data, source.resultPath);
60
+ return data;
61
+ }
62
+ //#endregion
63
+ exports.apiFetcher = apiFetcher;
2
64
 
3
- var chunk46PUWB7C_cjs = require('../../chunk-46PUWB7C.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "apiFetcher", {
8
- enumerable: true,
9
- get: function () { return chunk46PUWB7C_cjs.apiFetcher; }
10
- });
11
- //# sourceMappingURL=api.cjs.map
12
65
  //# sourceMappingURL=api.cjs.map