@webiny/app 0.0.0-unstable.06b2ede40f → 0.0.0-unstable.0d717d18dd

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 (440) hide show
  1. package/App.d.ts +5 -6
  2. package/App.js +75 -88
  3. package/App.js.map +1 -1
  4. package/AppContainer.js +3 -6
  5. package/AppContainer.js.map +1 -1
  6. package/README.md +7 -15
  7. package/components/Image.d.ts +1 -2
  8. package/components/Image.js +12 -18
  9. package/components/Image.js.map +1 -1
  10. package/components/index.d.ts +1 -2
  11. package/components/index.js +1 -4
  12. package/config/RouterConfig/Route.d.ts +9 -10
  13. package/config/RouterConfig/Route.js +23 -37
  14. package/config/RouterConfig/Route.js.map +1 -1
  15. package/config/RouterConfig.d.ts +11 -14
  16. package/config/RouterConfig.js +12 -11
  17. package/config/RouterConfig.js.map +1 -1
  18. package/config.js +19 -20
  19. package/config.js.map +1 -1
  20. package/contexts/Ui/index.js +26 -28
  21. package/contexts/Ui/index.js.map +1 -1
  22. package/core/Plugin.d.ts +1 -1
  23. package/core/Plugin.js +9 -11
  24. package/core/Plugin.js.map +1 -1
  25. package/core/Plugins.d.ts +4 -3
  26. package/core/Plugins.js +18 -36
  27. package/core/Plugins.js.map +1 -1
  28. package/core/Provider.d.ts +1 -1
  29. package/core/Provider.js +6 -14
  30. package/core/Provider.js.map +1 -1
  31. package/core/createProvider.js +3 -6
  32. package/core/createProvider.js.map +1 -1
  33. package/core/createProviderPlugin.js +9 -14
  34. package/core/createProviderPlugin.js.map +1 -1
  35. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  36. package/errors/AuthenticationErrorEvent.js +13 -0
  37. package/errors/AuthenticationErrorEvent.js.map +1 -0
  38. package/errors/NetworkErrorEvent.d.ts +15 -0
  39. package/errors/NetworkErrorEvent.js +13 -0
  40. package/errors/NetworkErrorEvent.js.map +1 -0
  41. package/errors/abstractions.d.ts +12 -0
  42. package/errors/abstractions.js +6 -0
  43. package/errors/abstractions.js.map +1 -0
  44. package/errors/index.d.ts +6 -0
  45. package/errors/index.js +3 -0
  46. package/errors/overlay/ErrorOverlay.d.ts +9 -0
  47. package/errors/overlay/ErrorOverlay.js +43 -0
  48. package/errors/overlay/ErrorOverlay.js.map +1 -0
  49. package/{plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts → errors/overlay/GqlErrorOverlay.d.ts} +2 -2
  50. package/errors/overlay/GqlErrorOverlay.js +27 -0
  51. package/errors/overlay/GqlErrorOverlay.js.map +1 -0
  52. package/errors/overlay/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  53. package/errors/overlay/LocalAwsLambdaTimeoutMessage.js +20 -0
  54. package/errors/overlay/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  55. package/errors/overlay/StyledComponents.d.ts +7 -0
  56. package/errors/overlay/StyledComponents.js +10 -0
  57. package/errors/overlay/StyledComponents.js.map +1 -0
  58. package/errors/overlay/Typography.d.ts +8 -0
  59. package/errors/overlay/Typography.js +13 -0
  60. package/errors/overlay/Typography.js.map +1 -0
  61. package/errors/overlay/assets/close_24px.js +19 -0
  62. package/errors/overlay/assets/close_24px.js.map +1 -0
  63. package/errors/overlay/createErrorOverlay.d.ts +7 -0
  64. package/errors/overlay/createErrorOverlay.js +15 -0
  65. package/errors/overlay/createErrorOverlay.js.map +1 -0
  66. package/exports/admin/env-config.d.ts +2 -0
  67. package/exports/admin/env-config.js +2 -0
  68. package/exports/admin/graphql-client.d.ts +1 -0
  69. package/exports/admin/graphql-client.js +1 -0
  70. package/exports/admin/local-storage.d.ts +2 -0
  71. package/exports/admin/local-storage.js +2 -0
  72. package/exports/admin/router.d.ts +5 -0
  73. package/exports/admin/router.js +5 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +1 -0
  76. package/exports/admin.d.ts +7 -0
  77. package/exports/admin.js +7 -0
  78. package/features/envConfig/EnvConfig.d.ts +7 -0
  79. package/features/envConfig/EnvConfig.js +16 -0
  80. package/features/envConfig/EnvConfig.js.map +1 -0
  81. package/features/envConfig/abstractions.d.ts +28 -0
  82. package/features/envConfig/abstractions.js +5 -0
  83. package/features/envConfig/abstractions.js.map +1 -0
  84. package/features/envConfig/feature.d.ts +17 -0
  85. package/features/envConfig/feature.js +15 -0
  86. package/features/envConfig/feature.js.map +1 -0
  87. package/features/envConfig/index.d.ts +1 -0
  88. package/features/envConfig/index.js +1 -0
  89. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  90. package/features/eventPublisher/EventPublisher.js +19 -0
  91. package/features/eventPublisher/EventPublisher.js.map +1 -0
  92. package/features/eventPublisher/abstractions.d.ts +18 -0
  93. package/features/eventPublisher/abstractions.js +12 -0
  94. package/features/eventPublisher/abstractions.js.map +1 -0
  95. package/features/eventPublisher/feature.d.ts +3 -0
  96. package/features/eventPublisher/feature.js +17 -0
  97. package/features/eventPublisher/feature.js.map +1 -0
  98. package/features/eventPublisher/index.d.ts +3 -0
  99. package/features/eventPublisher/index.js +2 -0
  100. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  101. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  102. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  103. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  104. package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
  105. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  106. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  107. package/features/graphqlClient/FetchGraphQLClient.js +51 -0
  108. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  109. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  110. package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
  111. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  112. package/features/graphqlClient/RequestValue.d.ts +21 -0
  113. package/features/graphqlClient/RequestValue.js +46 -0
  114. package/features/graphqlClient/RequestValue.js.map +1 -0
  115. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  116. package/features/graphqlClient/RetryGraphQLClient.js +45 -0
  117. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  118. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  119. package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
  120. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  121. package/features/graphqlClient/abstractions.d.ts +18 -0
  122. package/features/graphqlClient/abstractions.js +5 -0
  123. package/features/graphqlClient/abstractions.js.map +1 -0
  124. package/features/graphqlClient/feature.d.ts +6 -0
  125. package/features/graphqlClient/feature.js +25 -0
  126. package/features/graphqlClient/feature.js.map +1 -0
  127. package/features/graphqlClient/index.d.ts +1 -0
  128. package/features/graphqlClient/index.js +1 -0
  129. package/features/graphqlClient/types.d.ts +5 -0
  130. package/features/graphqlClient/types.js +0 -0
  131. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  132. package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
  133. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  134. package/features/localStorage/LocalStorage.d.ts +12 -0
  135. package/features/localStorage/LocalStorage.js +34 -0
  136. package/features/localStorage/LocalStorage.js.map +1 -0
  137. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  138. package/features/localStorage/LocalStorageRepository.js +82 -0
  139. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  140. package/features/localStorage/abstractions.d.ts +48 -0
  141. package/features/localStorage/abstractions.js +8 -0
  142. package/features/localStorage/abstractions.js.map +1 -0
  143. package/features/localStorage/feature.d.ts +12 -0
  144. package/features/localStorage/feature.js +23 -0
  145. package/features/localStorage/feature.js.map +1 -0
  146. package/features/localStorage/index.d.ts +1 -0
  147. package/features/localStorage/index.js +1 -0
  148. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  149. package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
  150. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  151. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  152. package/features/mainGraphQLClient/abstractions.js +5 -0
  153. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  154. package/features/mainGraphQLClient/feature.d.ts +3 -0
  155. package/features/mainGraphQLClient/feature.js +17 -0
  156. package/features/mainGraphQLClient/feature.js.map +1 -0
  157. package/features/mainGraphQLClient/index.d.ts +1 -0
  158. package/features/mainGraphQLClient/index.js +1 -0
  159. package/features/router/HistoryRouterGateway.d.ts +25 -0
  160. package/features/router/HistoryRouterGateway.js +100 -0
  161. package/features/router/HistoryRouterGateway.js.map +1 -0
  162. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  163. package/features/router/HistoryRouterGateway.test.js +195 -0
  164. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  165. package/features/router/Route.d.ts +19 -0
  166. package/features/router/Route.js +43 -0
  167. package/features/router/Route.js.map +1 -0
  168. package/features/router/RouteUrl.d.ts +85 -0
  169. package/features/router/RouteUrl.js +99 -0
  170. package/features/router/RouteUrl.js.map +1 -0
  171. package/features/router/Router.d.ts +45 -0
  172. package/features/router/Router.js +72 -0
  173. package/features/router/Router.js.map +1 -0
  174. package/features/router/RouterPresenter.d.ts +23 -0
  175. package/features/router/RouterPresenter.js +62 -0
  176. package/features/router/RouterPresenter.js.map +1 -0
  177. package/features/router/RouterRepository.d.ts +32 -0
  178. package/features/router/RouterRepository.js +123 -0
  179. package/features/router/RouterRepository.js.map +1 -0
  180. package/features/router/RouterRepository.test.d.ts +1 -0
  181. package/features/router/RouterRepository.test.js +138 -0
  182. package/features/router/RouterRepository.test.js.map +1 -0
  183. package/features/router/abstractions.d.ts +90 -0
  184. package/features/router/abstractions.js +7 -0
  185. package/features/router/abstractions.js.map +1 -0
  186. package/features/router/feature.d.ts +4 -0
  187. package/features/router/feature.js +19 -0
  188. package/features/router/feature.js.map +1 -0
  189. package/features/router/index.d.ts +2 -0
  190. package/features/router/index.js +1 -0
  191. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  192. package/helpers/InterfaceGenerator/date.js +0 -0
  193. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  194. package/helpers/InterfaceGenerator/id.js +0 -0
  195. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  196. package/helpers/InterfaceGenerator/identity.js +0 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +0 -0
  199. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  200. package/helpers/InterfaceGenerator/numeric.js +0 -0
  201. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  202. package/helpers/InterfaceGenerator/truthful.js +0 -0
  203. package/hooks/useHandler.js +12 -16
  204. package/hooks/useHandler.js.map +1 -1
  205. package/hooks/useHandlers.js +18 -20
  206. package/hooks/useHandlers.js.map +1 -1
  207. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  208. package/hooks/useRegisterLegacyPlugin.js +7 -6
  209. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  210. package/hooks/useUi.d.ts +1 -1
  211. package/hooks/useUi.js +3 -4
  212. package/hooks/useUi.js.map +1 -1
  213. package/i18n/i18n.js +8 -4
  214. package/i18n/i18n.js.map +1 -1
  215. package/i18n/index.d.ts +1 -1
  216. package/i18n/index.js +1 -3
  217. package/index.d.ts +20 -15
  218. package/index.js +19 -19
  219. package/package.json +34 -42
  220. package/plugins/components/Image.d.ts +6 -0
  221. package/plugins/components/Image.js +12 -0
  222. package/plugins/components/Image.js.map +1 -0
  223. package/plugins/image.d.ts +2 -2
  224. package/plugins/image.js +95 -134
  225. package/plugins/image.js.map +1 -1
  226. package/plugins/index.d.ts +3 -3
  227. package/plugins/index.js +35 -59
  228. package/plugins/index.js.map +1 -1
  229. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  230. package/presentation/envConfig/useEnvConfig.js +9 -0
  231. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  232. package/presentation/localStorage/index.d.ts +3 -0
  233. package/presentation/localStorage/index.js +3 -0
  234. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  235. package/presentation/localStorage/useLocalStorage.js +15 -0
  236. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  237. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  238. package/presentation/localStorage/useLocalStorageValue.js +22 -0
  239. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  240. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  241. package/presentation/localStorage/useLocalStorageValues.js +32 -0
  242. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  243. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  244. package/presentation/router/RouteElementRegistry.js +29 -0
  245. package/presentation/router/RouteElementRegistry.js.map +1 -0
  246. package/presentation/router/abstractions.d.ts +13 -0
  247. package/presentation/router/abstractions.js +5 -0
  248. package/presentation/router/abstractions.js.map +1 -0
  249. package/presentation/router/components/Redirect.d.ts +14 -0
  250. package/presentation/router/components/Redirect.js +13 -0
  251. package/presentation/router/components/Redirect.js.map +1 -0
  252. package/presentation/router/components/RouteContent.d.ts +2 -0
  253. package/presentation/router/components/RouteContent.js +20 -0
  254. package/presentation/router/components/RouteContent.js.map +1 -0
  255. package/presentation/router/components/RouteLink.d.ts +50 -0
  256. package/presentation/router/components/RouteLink.js +17 -0
  257. package/presentation/router/components/RouteLink.js.map +1 -0
  258. package/presentation/router/components/RouteParamsSync.d.ts +22 -0
  259. package/presentation/router/components/RouteParamsSync.js +53 -0
  260. package/presentation/router/components/RouteParamsSync.js.map +1 -0
  261. package/presentation/router/components/SimpleLink.d.ts +44 -0
  262. package/presentation/router/components/SimpleLink.js +24 -0
  263. package/presentation/router/components/SimpleLink.js.map +1 -0
  264. package/presentation/router/hooks/useRoute.d.ts +7 -0
  265. package/presentation/router/hooks/useRoute.js +23 -0
  266. package/presentation/router/hooks/useRoute.js.map +1 -0
  267. package/presentation/router/hooks/useRouter.d.ts +12 -0
  268. package/presentation/router/hooks/useRouter.js +30 -0
  269. package/presentation/router/hooks/useRouter.js.map +1 -0
  270. package/presentation/router/index.d.ts +6 -0
  271. package/presentation/router/index.js +4 -0
  272. package/presentation/router/types.d.ts +5 -0
  273. package/presentation/router/types.js +0 -0
  274. package/renderApp.d.ts +1 -1
  275. package/renderApp.js +7 -6
  276. package/renderApp.js.map +1 -1
  277. package/router.d.ts +5 -0
  278. package/router.js +5 -0
  279. package/rslib-runtime.js +14 -0
  280. package/rslib-runtime.js.map +1 -0
  281. package/shared/di/DiContainerProvider.d.ts +8 -0
  282. package/shared/di/DiContainerProvider.js +13 -0
  283. package/shared/di/DiContainerProvider.js.map +1 -0
  284. package/shared/di/createFeature.d.ts +11 -0
  285. package/shared/di/createFeature.js +10 -0
  286. package/shared/di/createFeature.js.map +1 -0
  287. package/shared/di/useFeature.d.ts +2 -0
  288. package/shared/di/useFeature.js +12 -0
  289. package/shared/di/useFeature.js.map +1 -0
  290. package/static/svg/close_24px.33adaadc.svg +1 -0
  291. package/types.d.ts +6 -24
  292. package/types.js +0 -14
  293. package/utils/createGenericContext.js +17 -21
  294. package/utils/createGenericContext.js.map +1 -1
  295. package/utils/createHashing.js +13 -16
  296. package/utils/createHashing.js.map +1 -1
  297. package/utils/index.d.ts +2 -10
  298. package/utils/index.js +2 -12
  299. package/utils/legacyPluginToReactComponent.js +12 -11
  300. package/utils/legacyPluginToReactComponent.js.map +1 -1
  301. package/apollo-client/InMemoryCache.d.ts +0 -8
  302. package/apollo-client/InMemoryCache.js +0 -20
  303. package/apollo-client/InMemoryCache.js.map +0 -1
  304. package/apollo-client/IntrospectionFragmentMatcher.d.ts +0 -11
  305. package/apollo-client/IntrospectionFragmentMatcher.js +0 -45
  306. package/apollo-client/IntrospectionFragmentMatcher.js.map +0 -1
  307. package/components/Routes.d.ts +0 -2
  308. package/components/Routes.js +0 -36
  309. package/components/Routes.js.map +0 -1
  310. package/components/View.d.ts +0 -8
  311. package/components/View.js +0 -19
  312. package/components/View.js.map +0 -1
  313. package/components/index.js.map +0 -1
  314. package/core/DebounceRender.d.ts +0 -12
  315. package/core/DebounceRender.js +0 -31
  316. package/core/DebounceRender.js.map +0 -1
  317. package/core/Routes.d.ts +0 -6
  318. package/core/Routes.js +0 -34
  319. package/core/Routes.js.map +0 -1
  320. package/hooks/useAutocomplete/index.d.ts +0 -1
  321. package/hooks/useAutocomplete/index.js +0 -3
  322. package/hooks/useAutocomplete/index.js.map +0 -1
  323. package/hooks/useAutocomplete/useAutocomplete.d.ts +0 -11
  324. package/hooks/useAutocomplete/useAutocomplete.js +0 -23
  325. package/hooks/useAutocomplete/useAutocomplete.js.map +0 -1
  326. package/hooks/useDataList/functions/getData.d.ts +0 -2
  327. package/hooks/useDataList/functions/getData.js +0 -4
  328. package/hooks/useDataList/functions/getData.js.map +0 -1
  329. package/hooks/useDataList/functions/getError.d.ts +0 -2
  330. package/hooks/useDataList/functions/getError.js +0 -4
  331. package/hooks/useDataList/functions/getError.js.map +0 -1
  332. package/hooks/useDataList/functions/getMeta.d.ts +0 -2
  333. package/hooks/useDataList/functions/getMeta.js +0 -4
  334. package/hooks/useDataList/functions/getMeta.js.map +0 -1
  335. package/hooks/useDataList/functions/index.d.ts +0 -3
  336. package/hooks/useDataList/functions/index.js +0 -5
  337. package/hooks/useDataList/functions/index.js.map +0 -1
  338. package/hooks/useDataList/functions/searchDataByKey.d.ts +0 -2
  339. package/hooks/useDataList/functions/searchDataByKey.js +0 -18
  340. package/hooks/useDataList/functions/searchDataByKey.js.map +0 -1
  341. package/hooks/useDataList/index.d.ts +0 -1
  342. package/hooks/useDataList/index.js +0 -3
  343. package/hooks/useDataList/index.js.map +0 -1
  344. package/hooks/useDataList/useDataList.d.ts +0 -36
  345. package/hooks/useDataList/useDataList.js +0 -183
  346. package/hooks/useDataList/useDataList.js.map +0 -1
  347. package/hooks/useDataList/utils/index.d.ts +0 -2
  348. package/hooks/useDataList/utils/index.js +0 -4
  349. package/hooks/useDataList/utils/index.js.map +0 -1
  350. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +0 -10
  351. package/hooks/useDataList/utils/prepareLoadListParams.js +0 -38
  352. package/hooks/useDataList/utils/prepareLoadListParams.js.map +0 -1
  353. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  354. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
  355. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  356. package/hooks/useDataList/utils/types.d.ts +0 -40
  357. package/hooks/useDataList/utils/types.js +0 -3
  358. package/hooks/useDataList/utils/types.js.map +0 -1
  359. package/i18n/index.js.map +0 -1
  360. package/index.js.map +0 -1
  361. package/plugins/AddQuerySelectionPlugin.d.ts +0 -22
  362. package/plugins/AddQuerySelectionPlugin.js +0 -72
  363. package/plugins/AddQuerySelectionPlugin.js.map +0 -1
  364. package/plugins/ApolloCacheObjectIdPlugin.d.ts +0 -15
  365. package/plugins/ApolloCacheObjectIdPlugin.js +0 -16
  366. package/plugins/ApolloCacheObjectIdPlugin.js.map +0 -1
  367. package/plugins/ApolloDynamicLink.d.ts +0 -7
  368. package/plugins/ApolloDynamicLink.js +0 -31
  369. package/plugins/ApolloDynamicLink.js.map +0 -1
  370. package/plugins/ApolloLinkPlugin.d.ts +0 -13
  371. package/plugins/ApolloLinkPlugin.js +0 -22
  372. package/plugins/ApolloLinkPlugin.js.map +0 -1
  373. package/plugins/ConsoleLinkPlugin.d.ts +0 -8
  374. package/plugins/ConsoleLinkPlugin.js +0 -26
  375. package/plugins/ConsoleLinkPlugin.js.map +0 -1
  376. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  377. package/plugins/LocaleHeaderLinkPlugin.js +0 -32
  378. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  379. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +0 -66
  380. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +0 -1
  381. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -9
  382. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +0 -78
  383. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +0 -1
  384. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +0 -7
  385. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +0 -31
  386. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +0 -1
  387. package/plugins/NetworkErrorLinkPlugin.d.ts +0 -7
  388. package/plugins/NetworkErrorLinkPlugin.js +0 -30
  389. package/plugins/NetworkErrorLinkPlugin.js.map +0 -1
  390. package/plugins/OmitTypenameLinkPlugin.d.ts +0 -8
  391. package/plugins/OmitTypenameLinkPlugin.js +0 -21
  392. package/plugins/OmitTypenameLinkPlugin.js.map +0 -1
  393. package/plugins/RoutePlugin.d.ts +0 -12
  394. package/plugins/RoutePlugin.js +0 -16
  395. package/plugins/RoutePlugin.js.map +0 -1
  396. package/plugins/TenantHeaderLinkPlugin.d.ts +0 -10
  397. package/plugins/TenantHeaderLinkPlugin.js +0 -39
  398. package/plugins/TenantHeaderLinkPlugin.js.map +0 -1
  399. package/plugins/ViewPlugin.d.ts +0 -14
  400. package/plugins/ViewPlugin.js +0 -19
  401. package/plugins/ViewPlugin.js.map +0 -1
  402. package/react-butterfiles/Files.d.ts +0 -69
  403. package/react-butterfiles/Files.js +0 -227
  404. package/react-butterfiles/Files.js.map +0 -1
  405. package/react-butterfiles/index.d.ts +0 -2
  406. package/react-butterfiles/index.js +0 -4
  407. package/react-butterfiles/index.js.map +0 -1
  408. package/react-butterfiles/utils/generateId.d.ts +0 -1
  409. package/react-butterfiles/utils/generateId.js +0 -5
  410. package/react-butterfiles/utils/generateId.js.map +0 -1
  411. package/react-butterfiles/utils/readFileContent.d.ts +0 -1
  412. package/react-butterfiles/utils/readFileContent.js +0 -15
  413. package/react-butterfiles/utils/readFileContent.js.map +0 -1
  414. package/types.js.map +0 -1
  415. package/utils/getApiUrl.d.ts +0 -1
  416. package/utils/getApiUrl.js +0 -5
  417. package/utils/getApiUrl.js.map +0 -1
  418. package/utils/getGqlApiUrl.d.ts +0 -1
  419. package/utils/getGqlApiUrl.js +0 -6
  420. package/utils/getGqlApiUrl.js.map +0 -1
  421. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  422. package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
  423. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  424. package/utils/getLocaleCode.d.ts +0 -6
  425. package/utils/getLocaleCode.js +0 -33
  426. package/utils/getLocaleCode.js.map +0 -1
  427. package/utils/getPrerenderId.d.ts +0 -6
  428. package/utils/getPrerenderId.js +0 -5
  429. package/utils/getPrerenderId.js.map +0 -1
  430. package/utils/getTenantId.d.ts +0 -6
  431. package/utils/getTenantId.js +0 -45
  432. package/utils/getTenantId.js.map +0 -1
  433. package/utils/index.js.map +0 -1
  434. package/utils/isLocalhost.d.ts +0 -1
  435. package/utils/isLocalhost.js +0 -7
  436. package/utils/isLocalhost.js.map +0 -1
  437. package/utils/isPrerendering.d.ts +0 -1
  438. package/utils/isPrerendering.js +0 -5
  439. package/utils/isPrerendering.js.map +0 -1
  440. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.svg +0 -0
package/App.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
- import type { RouteProps } from "@webiny/react-router";
3
- import type { GenericComponent, Decorator, DecoratorsCollection } from "@webiny/react-composition";
2
+ import { Decorator, DecoratorsCollection, GenericComponent } from "@webiny/react-composition";
4
3
  interface State {
5
- plugins: JSX.Element[];
4
+ plugins: React.JSX.Element[];
6
5
  providers: Decorator<GenericComponent<ProviderProps>>[];
7
6
  }
8
7
  interface AppContext extends State {
@@ -12,8 +11,8 @@ interface AppContext extends State {
12
11
  declare const AppContext: React.Context<AppContext | undefined>;
13
12
  export declare const useApp: () => AppContext;
14
13
  export interface AppProps {
15
- debounceRender?: number;
16
- routes?: Array<RouteProps>;
14
+ routes?: Array<any>;
15
+ plugins?: any[];
17
16
  providers?: Array<Decorator<GenericComponent<ProviderProps>>>;
18
17
  decorators?: DecoratorsCollection;
19
18
  children?: React.ReactNode | React.ReactNode[];
@@ -21,6 +20,6 @@ export interface AppProps {
21
20
  interface ProviderProps {
22
21
  children: React.ReactNode;
23
22
  }
24
- export declare const AppBase: ({ debounceRender, routes, providers, children }: AppProps) => React.JSX.Element;
23
+ export declare const AppBase: React.MemoExoticComponent<({ routes, plugins, providers, children }: AppProps) => React.JSX.Element>;
25
24
  export declare const App: ({ decorators, ...props }: AppProps) => React.JSX.Element;
26
25
  export {};
package/App.js CHANGED
@@ -1,95 +1,82 @@
1
- import React, { createContext, useContext, useMemo, useState, useCallback } from "react";
2
- import { BrowserRouter, Route } from "@webiny/react-router";
1
+ import react, { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
3
2
  import { CompositionProvider, compose } from "@webiny/react-composition";
4
- import { Routes as SortRoutes } from "./core/Routes";
5
- import { DebounceRender } from "./core/DebounceRender";
6
- import { PluginsProvider } from "./core/Plugins";
7
- import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig";
8
- import { AppContainer } from "./AppContainer";
9
- const AppContext = /*#__PURE__*/createContext(undefined);
3
+ import { PluginsProvider } from "./core/Plugins.js";
4
+ import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig.js";
5
+ import { AppContainer } from "./AppContainer.js";
6
+ import { RouteContent } from "./presentation/router/components/RouteContent.js";
7
+ import { useRouter } from "./router.js";
8
+ const AppContext = /*#__PURE__*/ createContext(void 0);
10
9
  AppContext.displayName = "AppContext";
11
- export const useApp = () => {
12
- const appContext = useContext(AppContext);
13
- if (!appContext) {
14
- throw Error(`AppContext provider was not found. Are you using the "useApp()" hook in the right place?`);
15
- }
16
- return appContext;
10
+ const useApp = ()=>{
11
+ const appContext = useContext(AppContext);
12
+ if (!appContext) throw Error('AppContext provider was not found. Are you using the "useApp()" hook in the right place?');
13
+ return appContext;
17
14
  };
18
- export const AppBase = ({
19
- debounceRender = 50,
20
- routes = [],
21
- providers = [],
22
- children
23
- }) => {
24
- const [state, setState] = useState({
25
- plugins: [],
26
- providers
27
- });
28
- const addProvider = useCallback(component => {
29
- setState(state => {
30
- if (state.providers.findIndex(m => m === component) > -1) {
31
- return state;
32
- }
33
- return {
34
- ...state,
35
- providers: [...state.providers, component]
36
- };
15
+ const AppBase = /*#__PURE__*/ react.memo(({ routes = [], plugins = [], providers = [], children })=>{
16
+ const [state, setState] = useState({
17
+ plugins,
18
+ providers
37
19
  });
38
- }, []);
39
- const addPlugin = useCallback(element => {
40
- setState(state => {
41
- return {
42
- ...state,
43
- plugins: [...state.plugins, element]
44
- };
45
- });
46
- }, []);
47
- const appContext = useMemo(() => ({
48
- ...state,
49
- addProvider,
50
- addPlugin
51
- }), [state]);
52
- const AppRouter = useMemo(() => {
53
- return function AppRouter() {
54
- const routerConfig = useRouterConfig();
55
- const combinedRoutes = [...routes, ...routerConfig.routes].map(r => {
56
- return /*#__PURE__*/React.createElement(Route, {
57
- path: r.path,
58
- element: r.element,
59
- key: r.path
20
+ const addProvider = useCallback((component)=>{
21
+ setState((state)=>{
22
+ if (state.providers.findIndex((m)=>m === component) > -1) return state;
23
+ return {
24
+ ...state,
25
+ providers: [
26
+ ...state.providers,
27
+ component
28
+ ]
29
+ };
60
30
  });
61
- });
62
- return /*#__PURE__*/React.createElement(SortRoutes, {
63
- key: routes.length,
64
- routes: combinedRoutes
65
- });
66
- };
67
- }, [routes]);
68
- const Providers = useMemo(() => {
69
- return compose(...(state.providers || []))(({
70
- children
71
- }) => {
72
- return /*#__PURE__*/React.createElement(DebounceRender, {
73
- wait: debounceRender
74
- }, children);
75
- });
76
- }, [state.providers.length]);
77
- Providers.displayName = "Providers";
78
- return /*#__PURE__*/React.createElement(AppContext.Provider, {
79
- value: appContext
80
- }, children, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(BrowserRouter, null, /*#__PURE__*/React.createElement(Providers, null, /*#__PURE__*/React.createElement(PluginsProvider, null, state.plugins), /*#__PURE__*/React.createElement(DebounceRender, {
81
- wait: debounceRender
82
- }, /*#__PURE__*/React.createElement(RouterWithConfig, null, /*#__PURE__*/React.createElement(AppRouter, null)))))));
83
- };
84
- export const App = ({
85
- decorators,
86
- ...props
87
- }) => {
88
- return /*#__PURE__*/React.createElement(CompositionProvider, {
89
- decorators: decorators
90
- }, /*#__PURE__*/React.createElement(AppBase, Object.assign({
91
- decorators: decorators
92
- }, props)));
93
- };
31
+ }, []);
32
+ const addPlugin = useCallback((element)=>{
33
+ setState((state)=>({
34
+ ...state,
35
+ plugins: [
36
+ ...state.plugins,
37
+ element
38
+ ]
39
+ }));
40
+ }, []);
41
+ const appContext = useMemo(()=>({
42
+ ...state,
43
+ addProvider,
44
+ addPlugin
45
+ }), [
46
+ state
47
+ ]);
48
+ const AppRouter = useMemo(()=>function() {
49
+ const router = useRouter();
50
+ const routerConfig = useRouterConfig();
51
+ const routesFromConfig = routerConfig.routes;
52
+ const combinedRoutes = [
53
+ ...routes,
54
+ ...routesFromConfig
55
+ ];
56
+ useEffect(()=>{
57
+ router.setRoutes(combinedRoutes);
58
+ }, [
59
+ combinedRoutes.length
60
+ ]);
61
+ return null;
62
+ }, []);
63
+ const Providers = useMemo(()=>/*#__PURE__*/ react.memo(compose(...state.providers || [])(({ children })=>/*#__PURE__*/ react.createElement(react.Fragment, null, children))), [
64
+ state.providers.length
65
+ ]);
66
+ Providers.displayName = "Providers";
67
+ return /*#__PURE__*/ react.createElement(AppContext.Provider, {
68
+ value: appContext
69
+ }, children, /*#__PURE__*/ react.createElement(AppContainer, null, /*#__PURE__*/ react.createElement(Providers, null, /*#__PURE__*/ react.createElement(PluginsProvider, null, state.plugins.map((plugin, index)=>/*#__PURE__*/ react.createElement(Fragment, {
70
+ key: index
71
+ }, plugin))), /*#__PURE__*/ react.createElement(RouterWithConfig, null, /*#__PURE__*/ react.createElement(AppRouter, null), /*#__PURE__*/ react.createElement(RouteContent, null)))));
72
+ });
73
+ AppBase.displayName = "AppBase";
74
+ const App = ({ decorators, ...props })=>/*#__PURE__*/ react.createElement(CompositionProvider, {
75
+ decorators: decorators
76
+ }, /*#__PURE__*/ react.createElement(AppBase, {
77
+ decorators: decorators,
78
+ ...props
79
+ }));
80
+ export { App, AppBase, useApp };
94
81
 
95
82
  //# sourceMappingURL=App.js.map
package/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","useMemo","useState","useCallback","BrowserRouter","Route","CompositionProvider","compose","Routes","SortRoutes","DebounceRender","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","debounceRender","routes","providers","children","state","setState","plugins","addProvider","component","findIndex","m","addPlugin","element","AppRouter","routerConfig","combinedRoutes","map","r","createElement","path","key","length","Providers","wait","Provider","value","App","decorators","props","Object","assign"],"sources":["App.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo, useState, useCallback } from \"react\";\nimport type { RouteProps } from \"@webiny/react-router\";\nimport { BrowserRouter, Route } from \"@webiny/react-router\";\nimport type { GenericComponent, Decorator, DecoratorsCollection } from \"@webiny/react-composition\";\nimport { CompositionProvider, compose } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig\";\nimport { AppContainer } from \"./AppContainer\";\n\ninterface State {\n plugins: JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n debounceRender?: number;\n routes?: Array<RouteProps>;\n providers?: Array<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = ({\n debounceRender = 50,\n routes = [],\n providers = [],\n children\n}: AppProps) => {\n const [state, setState] = useState<State>({\n plugins: [],\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback((element: JSX.Element) => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routerConfig = useRouterConfig();\n const combinedRoutes = [...routes, ...routerConfig.routes].map(r => {\n return <Route path={r.path} element={r.element} key={r.path} />;\n });\n\n return <SortRoutes key={routes.length} routes={combinedRoutes} />;\n };\n }, [routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <DebounceRender wait={debounceRender}>{children}</DebounceRender>;\n });\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <RouterWithConfig>\n <AppRouter />\n </RouterWithConfig>\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </AppContainer>\n </AppContext.Provider>\n );\n};\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"App.js","sources":["../src/App.tsx"],"sourcesContent":["import React, {\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState\n} from \"react\";\nimport {\n compose,\n CompositionProvider,\n Decorator,\n DecoratorsCollection,\n GenericComponent\n} from \"@webiny/react-composition\";\nimport { PluginsProvider } from \"./core/Plugins.js\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig.js\";\nimport { AppContainer } from \"./AppContainer.js\";\nimport { RouteContent } from \"~/presentation/router/components/RouteContent.js\";\nimport { useRouter } from \"~/router.js\";\n\ninterface State {\n plugins: React.JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n routes?: Array<any>;\n plugins?: any[];\n providers?: Array<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = React.memo(\n ({ routes = [], plugins = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n plugins,\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback((element: React.JSX.Element) => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const router = useRouter();\n const routerConfig = useRouterConfig();\n const routesFromConfig = routerConfig.routes;\n const combinedRoutes = [...routes, ...routesFromConfig];\n\n useEffect(() => {\n router.setRoutes(combinedRoutes);\n }, [combinedRoutes.length]);\n\n return null;\n };\n }, []);\n\n const Providers = useMemo(() => {\n return React.memo(\n compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <>{children}</>;\n })\n );\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <Providers>\n <PluginsProvider>\n {state.plugins.map((plugin, index) => (\n <Fragment key={index}>{plugin}</Fragment>\n ))}\n </PluginsProvider>\n <RouterWithConfig>\n <AppRouter />\n <RouteContent />\n </RouterWithConfig>\n </Providers>\n </AppContainer>\n </AppContext.Provider>\n );\n }\n);\n\nAppBase.displayName = \"AppBase\";\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"names":["AppContext","createContext","undefined","useApp","appContext","useContext","Error","AppBase","React","routes","plugins","providers","children","state","setState","useState","addProvider","useCallback","component","m","addPlugin","element","useMemo","AppRouter","router","useRouter","routerConfig","useRouterConfig","routesFromConfig","combinedRoutes","useEffect","Providers","compose","AppContainer","PluginsProvider","plugin","index","Fragment","RouterWithConfig","RouteContent","App","decorators","props","CompositionProvider"],"mappings":";;;;;;;AAgCA,MAAMA,aAAa,WAAHA,GAAGC,cAAsCC;AAEzDF,WAAW,WAAW,GAAG;AAElB,MAAMG,SAAS;IAClB,MAAMC,aAAaC,WAAWL;IAC9B,IAAI,CAACI,YACD,MAAME,MACF;IAGR,OAAOF;AACX;AAgBO,MAAMG,UAAU,WAAHA,GAAGC,MAAAA,IAAU,CAC7B,CAAC,EAAEC,SAAS,EAAE,EAAEC,UAAU,EAAE,EAAEC,YAAY,EAAE,EAAEC,QAAQ,EAAY;IAC9D,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAgB;QACtCL;QACAC;IACJ;IAEA,MAAMK,cAAcC,YAAY,CAACC;QAC7BJ,SAASD,CAAAA;YACL,IAAIA,MAAM,SAAS,CAAC,SAAS,CAACM,CAAAA,IAAKA,MAAMD,aAAa,IAClD,OAAOL;YAGX,OAAO;gBACH,GAAGA,KAAK;gBACR,WAAW;uBAAIA,MAAM,SAAS;oBAAEK;iBAAU;YAC9C;QACJ;IACJ,GAAG,EAAE;IAEL,MAAME,YAAYH,YAAY,CAACI;QAC3BP,SAASD,CAAAA,QACE;gBACH,GAAGA,KAAK;gBACR,SAAS;uBAAIA,MAAM,OAAO;oBAAEQ;iBAAQ;YACxC;IAER,GAAG,EAAE;IAEL,MAAMjB,aAAakB,QACf,IAAO;YACH,GAAGT,KAAK;YACRG;YACAI;QACJ,IACA;QAACP;KAAM;IAGX,MAAMU,YAAYD,QAAQ,IACf;YACH,MAAME,SAASC;YACf,MAAMC,eAAeC;YACrB,MAAMC,mBAAmBF,aAAa,MAAM;YAC5C,MAAMG,iBAAiB;mBAAIpB;mBAAWmB;aAAiB;YAEvDE,UAAU;gBACNN,OAAO,SAAS,CAACK;YACrB,GAAG;gBAACA,eAAe,MAAM;aAAC;YAE1B,OAAO;QACX,GACD,EAAE;IAEL,MAAME,YAAYT,QAAQ,IACf,WAAP,GAAOd,MAAAA,IAAU,CACbwB,WAAYnB,MAAM,SAAS,IAAI,EAAE,EAAG,CAAC,EAAED,QAAQ,EAAiB,GACrD,WAAP,GAAO,0CAAGA,aAGnB;QAACC,MAAM,SAAS,CAAC,MAAM;KAAC;IAE3BkB,UAAU,WAAW,GAAG;IAExB,OAAO,WAAP,GACI,oBAAC/B,WAAW,QAAQ;QAAC,OAAOI;OACvBQ,UAAAA,WAAAA,GACD,oBAACqB,cAAYA,MAAAA,WAAAA,GACT,oBAACF,WAAAA,MAAAA,WAAAA,GACG,oBAACG,iBAAeA,MACXrB,MAAM,OAAO,CAAC,GAAG,CAAC,CAACsB,QAAQC,QAAAA,WAAAA,GACxB,oBAACC,UAAQA;YAAC,KAAKD;WAAQD,WAAAA,WAAAA,GAG/B,oBAACG,kBAAgBA,MAAAA,WAAAA,GACb,oBAACf,WAAAA,OAAAA,WAAAA,GACD,oBAACgB,cAAYA;AAMrC;AAGJhC,QAAQ,WAAW,GAAG;AAEf,MAAMiC,MAAM,CAAC,EAAEC,UAAU,EAAE,GAAGC,OAAiB,GAC3C,WAAP,GACI,oBAACC,qBAAmBA;QAAC,YAAYF;qBAC7B,oBAAClC,SAAOA;QAAC,YAAYkC;QAAa,GAAGC,KAAK"}
package/AppContainer.js CHANGED
@@ -1,9 +1,6 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import { makeDecoratable } from "@webiny/react-composition";
3
- export const AppContainer = makeDecoratable("AppContainer", ({
4
- children
5
- }) => {
6
- return /*#__PURE__*/React.createElement(React.Fragment, null, children);
7
- });
3
+ const AppContainer = makeDecoratable("AppContainer", ({ children })=>/*#__PURE__*/ react.createElement(react.Fragment, null, children));
4
+ export { AppContainer };
8
5
 
9
6
  //# sourceMappingURL=AppContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","makeDecoratable","AppContainer","children","createElement","Fragment"],"sources":["AppContainer.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface AppContentProps {\n children: React.ReactNode;\n}\n\nexport const AppContainer = makeDecoratable(\"AppContainer\", ({ children }: AppContentProps) => {\n return <>{children}</>;\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAM3D,OAAO,MAAMC,YAAY,GAAGD,eAAe,CAAC,cAAc,EAAE,CAAC;EAAEE;AAA0B,CAAC,KAAK;EAC3F,oBAAOH,KAAA,CAAAI,aAAA,CAAAJ,KAAA,CAAAK,QAAA,QAAGF,QAAW,CAAC;AAC1B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AppContainer.js","sources":["../src/AppContainer.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface AppContentProps {\n children: React.ReactNode;\n}\n\nexport const AppContainer = makeDecoratable(\"AppContainer\", ({ children }: AppContentProps) => {\n return <>{children}</>;\n});\n"],"names":["AppContainer","makeDecoratable","children"],"mappings":";;AAOO,MAAMA,eAAeC,gBAAgB,gBAAgB,CAAC,EAAEC,QAAQ,EAAmB,GAC/E,WAAP,GAAO,0CAAGA"}
package/README.md CHANGED
@@ -1,19 +1,11 @@
1
1
  # @webiny/app
2
- [![](https://img.shields.io/npm/dw/@webiny/app.svg)](https://www.npmjs.com/package/@webiny/app)
3
- [![](https://img.shields.io/npm/v/@webiny/app.svg)](https://www.npmjs.com/package/@webiny/app)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
6
2
 
7
- The base package for building Webiny and React powered web apps.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
8
6
 
9
- For more information, please visit [the official docs](https://docs.webiny.com/docs/webiny/introduction).
10
-
11
- ## Install
12
- ```
13
- npm install --save @webiny/app
14
- ```
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
15
8
 
16
- Or if you prefer yarn:
17
- ```
18
- yarn add @webiny/app
19
- ```
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- import type { ImageProps } from "../types";
1
+ import type { ImageProps } from "../types.js";
3
2
  export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -1,23 +1,17 @@
1
1
  import invariant from "invariant";
2
2
  import { plugins } from "@webiny/plugins";
3
- import get from "lodash/get";
4
- export const Image = ({
5
- preset: presetName,
6
- ...props
7
- }) => {
8
- const plugin = plugins.byName("image-component");
9
- if (!plugin) {
10
- throw new Error(`Image component plugin (type "image-component") not defined.`);
11
- }
12
- if (presetName) {
13
- const preset = get(plugin, `presets.${presetName}`);
14
- invariant(preset, `Transform preset "${presetName}" not found.`);
15
- props.transform = preset;
16
- }
17
- if (props.transform) {
18
- props.src = plugin.getImageSrc(props);
19
- }
20
- return plugin.render(props);
3
+ import get from "lodash/get.js";
4
+ const Image = ({ preset: presetName, ...props })=>{
5
+ const plugin = plugins.byName("image-component");
6
+ if (!plugin) throw new Error('Image component plugin (type "image-component") not defined.');
7
+ if (presetName) {
8
+ const preset = get(plugin, `presets.${presetName}`);
9
+ invariant(preset, `Transform preset "${presetName}" not found.`);
10
+ props.transform = preset;
11
+ }
12
+ if (props.transform) props.src = plugin.getImageSrc(props);
13
+ return plugin.render(props);
21
14
  };
15
+ export { Image };
22
16
 
23
17
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,YAAY;AAG5B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"components/Image.js","sources":["../../src/components/Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get.js\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types.js\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"names":["Image","presetName","props","plugin","plugins","Error","preset","get","invariant"],"mappings":";;;AAKO,MAAMA,QAAQ,CAAC,EAAE,QAAQC,UAAU,EAAE,GAAGC,OAAmB;IAC9D,MAAMC,SAASC,QAAQ,MAAM,CAAuB;IACpD,IAAI,CAACD,QACD,MAAM,IAAIE,MAAM;IAGpB,IAAIJ,YAAY;QACZ,MAAMK,SAASC,IAAIJ,QAAQ,CAAC,QAAQ,EAAEF,YAAY;QAClDO,UAAUF,QAAQ,CAAC,kBAAkB,EAAEL,WAAW,YAAY,CAAC;QAC/DC,MAAM,SAAS,GAAGI;IACtB;IAEA,IAAIJ,MAAM,SAAS,EACfA,MAAM,GAAG,GAAGC,OAAO,WAAW,CAACD;IAGnC,OAAOC,OAAO,MAAM,CAACD;AACzB"}
@@ -1,2 +1 @@
1
- export { Image } from "./Image";
2
- export { Routes } from "./Routes";
1
+ export { Image } from "./Image.js";
@@ -1,4 +1 @@
1
- export { Image } from "./Image";
2
- export { Routes } from "./Routes";
3
-
4
- //# sourceMappingURL=index.js.map
1
+ export { Image } from "./Image.js";
@@ -1,29 +1,28 @@
1
1
  import React from "react";
2
+ import type { Route as BaseRoute } from "../../router.js";
2
3
  export interface RouteProps {
3
- name: string;
4
- path: string;
5
- exact?: boolean;
4
+ route: BaseRoute<any>;
6
5
  element: React.ReactElement;
7
6
  remove?: boolean;
8
7
  before?: string;
9
8
  after?: string;
10
9
  }
11
- export type RouteConfig = Pick<RouteProps, "name" | "path" | "element">;
12
- export declare const Route: (({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element) & {
13
- original: ({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element;
10
+ export type RouteConfig = Pick<RouteProps, "route" | "element">;
11
+ export declare const Route: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
12
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
14
13
  originalName: string;
15
14
  displayName: string;
16
15
  } & {
17
- original: (({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element) & {
18
- original: ({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element;
16
+ original: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
17
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
19
18
  originalName: string;
20
19
  displayName: string;
21
20
  };
22
21
  originalName: string;
23
22
  displayName: string;
24
23
  } & {
25
- createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element) & {
26
- original: ({ name, path, element, exact, remove, before, after }: RouteProps) => React.JSX.Element;
24
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
25
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
27
26
  originalName: string;
28
27
  displayName: string;
29
28
  }>) => (props: unknown) => React.JSX.Element;
@@ -1,42 +1,28 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import { makeDecoratable } from "@webiny/react-composition";
3
3
  import { Property, useIdGenerator } from "@webiny/react-properties";
4
- export const Route = makeDecoratable("Route", ({
5
- name,
6
- path,
7
- element,
8
- exact,
9
- remove,
10
- before,
11
- after
12
- }) => {
13
- const getId = useIdGenerator("Route");
14
- const placeAfter = after !== undefined ? getId(after) : undefined;
15
- const placeBefore = before !== undefined ? getId(before) : undefined;
16
- return /*#__PURE__*/React.createElement(Property, {
17
- id: getId(name),
18
- name: "routes",
19
- remove: remove,
20
- array: true,
21
- before: placeBefore,
22
- after: placeAfter
23
- }, /*#__PURE__*/React.createElement(Property, {
24
- id: getId(name, "name"),
25
- name: "name",
26
- value: name
27
- }), /*#__PURE__*/React.createElement(Property, {
28
- id: getId(name, "path"),
29
- name: "path",
30
- value: path
31
- }), /*#__PURE__*/React.createElement(Property, {
32
- id: getId(name, "exact"),
33
- name: "exact",
34
- value: exact
35
- }), /*#__PURE__*/React.createElement(Property, {
36
- id: getId(name, "element"),
37
- name: "element",
38
- value: element
39
- }));
4
+ const Route = makeDecoratable("Route", ({ route, element, remove, before, after })=>{
5
+ const name = route.name;
6
+ const getId = useIdGenerator("Route");
7
+ const placeAfter = void 0 !== after ? getId(after) : void 0;
8
+ const placeBefore = void 0 !== before ? getId(before) : void 0;
9
+ return /*#__PURE__*/ react.createElement(Property, {
10
+ id: getId(name),
11
+ name: "routes",
12
+ remove: remove,
13
+ array: true,
14
+ before: placeBefore,
15
+ after: placeAfter
16
+ }, /*#__PURE__*/ react.createElement(Property, {
17
+ id: getId(name, "route"),
18
+ name: "route",
19
+ value: route
20
+ }), /*#__PURE__*/ react.createElement(Property, {
21
+ id: getId(name, "element"),
22
+ name: "element",
23
+ value: element
24
+ }));
40
25
  });
26
+ export { Route };
41
27
 
42
28
  //# sourceMappingURL=Route.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","makeDecoratable","Property","useIdGenerator","Route","name","path","element","exact","remove","before","after","getId","placeAfter","undefined","placeBefore","createElement","id","array","value"],"sources":["Route.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\n\nexport interface RouteProps {\n name: string;\n path: string;\n exact?: boolean;\n element: React.ReactElement;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport type RouteConfig = Pick<RouteProps, \"name\" | \"path\" | \"element\">;\n\nexport const Route = makeDecoratable(\n \"Route\",\n ({ name, path, element, exact, remove, before, after }: RouteProps) => {\n const getId = useIdGenerator(\"Route\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property\n id={getId(name)}\n name={\"routes\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"name\")} name={\"name\"} value={name} />\n <Property id={getId(name, \"path\")} name={\"path\"} value={path} />\n <Property id={getId(name, \"exact\")} name={\"exact\"} value={exact} />\n <Property id={getId(name, \"element\")} name={\"element\"} value={element} />\n </Property>\n );\n }\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,QAAQ,EAAEC,cAAc,QAAQ,0BAA0B;AAcnE,OAAO,MAAMC,KAAK,GAAGH,eAAe,CAChC,OAAO,EACP,CAAC;EAAEI,IAAI;EAAEC,IAAI;EAAEC,OAAO;EAAEC,KAAK;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EACnE,MAAMC,KAAK,GAAGT,cAAc,CAAC,OAAO,CAAC;EAErC,MAAMU,UAAU,GAAGF,KAAK,KAAKG,SAAS,GAAGF,KAAK,CAACD,KAAK,CAAC,GAAGG,SAAS;EACjE,MAAMC,WAAW,GAAGL,MAAM,KAAKI,SAAS,GAAGF,KAAK,CAACF,MAAM,CAAC,GAAGI,SAAS;EAEpE,oBACId,KAAA,CAAAgB,aAAA,CAACd,QAAQ;IACLe,EAAE,EAAEL,KAAK,CAACP,IAAI,CAAE;IAChBA,IAAI,EAAE,QAAS;IACfI,MAAM,EAAEA,MAAO;IACfS,KAAK,EAAE,IAAK;IACZR,MAAM,EAAEK,WAAY;IACpBJ,KAAK,EAAEE;EAAW,gBAElBb,KAAA,CAAAgB,aAAA,CAACd,QAAQ;IAACe,EAAE,EAAEL,KAAK,CAACP,IAAI,EAAE,MAAM,CAAE;IAACA,IAAI,EAAE,MAAO;IAACc,KAAK,EAAEd;EAAK,CAAE,CAAC,eAChEL,KAAA,CAAAgB,aAAA,CAACd,QAAQ;IAACe,EAAE,EAAEL,KAAK,CAACP,IAAI,EAAE,MAAM,CAAE;IAACA,IAAI,EAAE,MAAO;IAACc,KAAK,EAAEb;EAAK,CAAE,CAAC,eAChEN,KAAA,CAAAgB,aAAA,CAACd,QAAQ;IAACe,EAAE,EAAEL,KAAK,CAACP,IAAI,EAAE,OAAO,CAAE;IAACA,IAAI,EAAE,OAAQ;IAACc,KAAK,EAAEX;EAAM,CAAE,CAAC,eACnER,KAAA,CAAAgB,aAAA,CAACd,QAAQ;IAACe,EAAE,EAAEL,KAAK,CAACP,IAAI,EAAE,SAAS,CAAE;IAACA,IAAI,EAAE,SAAU;IAACc,KAAK,EAAEZ;EAAQ,CAAE,CAClE,CAAC;AAEnB,CACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"config/RouterConfig/Route.js","sources":["../../../src/config/RouterConfig/Route.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\nimport type { Route as BaseRoute } from \"~/router.js\";\n\nexport interface RouteProps {\n route: BaseRoute<any>;\n element: React.ReactElement;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport type RouteConfig = Pick<RouteProps, \"route\" | \"element\">;\n\nexport const Route = makeDecoratable(\n \"Route\",\n ({ route, element, remove, before, after }: RouteProps) => {\n const name = route.name;\n\n const getId = useIdGenerator(\"Route\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property\n id={getId(name)}\n name={\"routes\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"route\")} name={\"route\"} value={route} />\n <Property id={getId(name, \"element\")} name={\"element\"} value={element} />\n </Property>\n );\n }\n);\n"],"names":["Route","makeDecoratable","route","element","remove","before","after","name","getId","useIdGenerator","placeAfter","undefined","placeBefore","Property"],"mappings":";;;AAeO,MAAMA,QAAQC,gBACjB,SACA,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAc;IAClD,MAAMC,OAAOL,MAAM,IAAI;IAEvB,MAAMM,QAAQC,eAAe;IAE7B,MAAMC,aAAaJ,AAAUK,WAAVL,QAAsBE,MAAMF,SAASK;IACxD,MAAMC,cAAcP,AAAWM,WAAXN,SAAuBG,MAAMH,UAAUM;IAE3D,OAAO,WAAP,GACI,oBAACE,UAAQA;QACL,IAAIL,MAAMD;QACV,MAAM;QACN,QAAQH;QACR,OAAO;QACP,QAAQQ;QACR,OAAOF;qBAEP,oBAACG,UAAQA;QAAC,IAAIL,MAAMD,MAAM;QAAU,MAAM;QAAS,OAAOL;sBAC1D,oBAACW,UAAQA;QAAC,IAAIL,MAAMD,MAAM;QAAY,MAAM;QAAW,OAAOJ;;AAG1E"}
@@ -1,32 +1,29 @@
1
- /// <reference types="react" />
2
- import { type RouteConfig } from "./RouterConfig/Route";
3
- export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => import("react").JSX.Element) & {
1
+ import { type RouteConfig } from "./RouterConfig/Route.js";
2
+ export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element) & {
4
3
  displayName: string;
5
4
  };
6
5
  export declare const useRouterConfig: () => {
7
6
  routes: RouteConfig[];
8
7
  };
9
- export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => import("react").JSX.Element) & {
10
- Route: (({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element) & {
11
- original: ({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element;
8
+ export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
9
+ Route: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
10
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
12
11
  originalName: string;
13
12
  displayName: string;
14
13
  } & {
15
- original: (({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element) & {
16
- original: ({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element;
14
+ original: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
15
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
17
16
  originalName: string;
18
17
  displayName: string;
19
18
  };
20
19
  originalName: string;
21
20
  displayName: string;
22
21
  } & {
23
- createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element) & {
24
- original: ({ name, path, element, exact, remove, before, after }: import("./RouterConfig/Route").RouteProps) => import("react").JSX.Element;
22
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
23
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
25
24
  originalName: string;
26
25
  displayName: string;
27
- }>) => (props: unknown) => import("react").JSX.Element;
28
- };
29
- useRouterConfig: () => {
30
- routes: RouteConfig[];
26
+ }>) => (props: unknown) => React.JSX.Element;
31
27
  };
28
+ useRouterConfig: typeof useRouterConfig;
32
29
  };
@@ -1,18 +1,19 @@
1
1
  import { createConfigurableComponent } from "@webiny/react-properties";
2
- import { Route } from "./RouterConfig/Route";
2
+ import { Route } from "./RouterConfig/Route.js";
3
3
  const base = createConfigurableComponent("RouterConfig");
4
- export const RouterWithConfig = Object.assign(base.WithConfig, {
5
- displayName: "RouterWithConfig"
4
+ const RouterWithConfig = Object.assign(base.WithConfig, {
5
+ displayName: "RouterWithConfig"
6
6
  });
7
- export const useRouterConfig = () => {
8
- const baseConfig = base.useConfig();
9
- return {
10
- routes: baseConfig.routes ?? []
11
- };
7
+ const useRouterConfig = ()=>{
8
+ const baseConfig = base.useConfig();
9
+ return {
10
+ routes: baseConfig.routes ?? []
11
+ };
12
12
  };
13
- export const RouterConfig = Object.assign(base.Config, {
14
- Route,
15
- useRouterConfig
13
+ const RouterConfig = Object.assign(base.Config, {
14
+ Route: Route,
15
+ useRouterConfig: useRouterConfig
16
16
  });
17
+ export { RouterConfig, RouterWithConfig, useRouterConfig };
17
18
 
18
19
  //# sourceMappingURL=RouterConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createConfigurableComponent","Route","base","RouterWithConfig","Object","assign","WithConfig","displayName","useRouterConfig","baseConfig","useConfig","routes","RouterConfig","Config"],"sources":["RouterConfig.tsx"],"sourcesContent":["import { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Route, type RouteConfig } from \"./RouterConfig/Route\";\n\nconst base = createConfigurableComponent<RouterConfig>(\"RouterConfig\");\n\nexport const RouterWithConfig = Object.assign(base.WithConfig, {\n displayName: \"RouterWithConfig\"\n});\n\ninterface RouterConfig {\n routes: RouteConfig[];\n}\n\nexport const useRouterConfig = () => {\n const baseConfig = base.useConfig();\n\n return {\n routes: baseConfig.routes ?? []\n };\n};\n\nexport const RouterConfig = Object.assign(base.Config, {\n Route,\n useRouterConfig\n});\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,KAAK;AAEd,MAAMC,IAAI,GAAGF,2BAA2B,CAAe,cAAc,CAAC;AAEtE,OAAO,MAAMG,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,UAAU,EAAE;EAC3DC,WAAW,EAAE;AACjB,CAAC,CAAC;AAMF,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACjC,MAAMC,UAAU,GAAGP,IAAI,CAACQ,SAAS,CAAC,CAAC;EAEnC,OAAO;IACHC,MAAM,EAAEF,UAAU,CAACE,MAAM,IAAI;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,YAAY,GAAGR,MAAM,CAACC,MAAM,CAACH,IAAI,CAACW,MAAM,EAAE;EACnDZ,KAAK;EACLO;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"config/RouterConfig.js","sources":["../../src/config/RouterConfig.tsx"],"sourcesContent":["import { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Route, type RouteConfig } from \"./RouterConfig/Route.js\";\n\nconst base = createConfigurableComponent<RouterConfig>(\"RouterConfig\");\n\nexport const RouterWithConfig = Object.assign(base.WithConfig, {\n displayName: \"RouterWithConfig\"\n});\n\ninterface RouterConfig {\n routes: RouteConfig[];\n}\n\nexport const useRouterConfig = () => {\n const baseConfig = base.useConfig();\n\n return {\n routes: baseConfig.routes ?? []\n };\n};\n\nexport const RouterConfig = Object.assign(base.Config, {\n Route,\n useRouterConfig\n});\n"],"names":["base","createConfigurableComponent","RouterWithConfig","Object","useRouterConfig","baseConfig","RouterConfig","Route"],"mappings":";;AAGA,MAAMA,OAAOC,4BAA0C;AAEhD,MAAMC,mBAAmBC,OAAO,MAAM,CAACH,KAAK,UAAU,EAAE;IAC3D,aAAa;AACjB;AAMO,MAAMI,kBAAkB;IAC3B,MAAMC,aAAaL,KAAK,SAAS;IAEjC,OAAO;QACH,QAAQK,WAAW,MAAM,IAAI,EAAE;IACnC;AACJ;AAEO,MAAMC,eAAeH,OAAO,MAAM,CAACH,KAAK,MAAM,EAAE;IACnDO,OAAKA;IACLH,iBAAAA;AACJ"}