@webiny/app 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (403) hide show
  1. package/App.d.ts +5 -6
  2. package/App.js +26 -32
  3. package/App.js.map +1 -1
  4. package/README.md +7 -15
  5. package/apollo-client/InMemoryCache.js +2 -2
  6. package/apollo-client/InMemoryCache.js.map +1 -1
  7. package/components/Image.d.ts +1 -2
  8. package/components/Image.js +1 -1
  9. package/components/Image.js.map +1 -1
  10. package/components/index.d.ts +1 -2
  11. package/components/index.js +1 -2
  12. package/components/index.js.map +1 -1
  13. package/config/RouterConfig/Route.d.ts +9 -10
  14. package/config/RouterConfig/Route.js +5 -14
  15. package/config/RouterConfig/Route.js.map +1 -1
  16. package/config/RouterConfig.d.ts +10 -11
  17. package/config/RouterConfig.js +1 -1
  18. package/config/RouterConfig.js.map +1 -1
  19. package/contexts/Ui/index.js.map +1 -1
  20. package/core/Plugin.d.ts +1 -1
  21. package/core/Plugin.js +2 -2
  22. package/core/Plugin.js.map +1 -1
  23. package/core/Plugins.d.ts +2 -2
  24. package/core/Plugins.js +5 -4
  25. package/core/Plugins.js.map +1 -1
  26. package/core/Provider.d.ts +1 -1
  27. package/core/Provider.js +1 -1
  28. package/core/Provider.js.map +1 -1
  29. package/core/createProviderPlugin.js +1 -1
  30. package/core/createProviderPlugin.js.map +1 -1
  31. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  32. package/errors/AuthenticationErrorEvent.js +10 -0
  33. package/errors/AuthenticationErrorEvent.js.map +1 -0
  34. package/errors/NetworkErrorEvent.d.ts +15 -0
  35. package/errors/NetworkErrorEvent.js +10 -0
  36. package/errors/NetworkErrorEvent.js.map +1 -0
  37. package/errors/abstractions.d.ts +12 -0
  38. package/errors/abstractions.js +5 -0
  39. package/errors/abstractions.js.map +1 -0
  40. package/errors/index.d.ts +6 -0
  41. package/errors/index.js +6 -0
  42. package/errors/index.js.map +1 -0
  43. package/exports/admin/env-config.d.ts +2 -0
  44. package/exports/admin/env-config.js +4 -0
  45. package/exports/admin/env-config.js.map +1 -0
  46. package/exports/admin/graphql-client.d.ts +1 -0
  47. package/exports/admin/graphql-client.js +3 -0
  48. package/exports/admin/graphql-client.js.map +1 -0
  49. package/exports/admin/local-storage.d.ts +2 -0
  50. package/exports/admin/local-storage.js +4 -0
  51. package/exports/admin/local-storage.js.map +1 -0
  52. package/exports/admin/router.d.ts +5 -0
  53. package/exports/admin/router.js +7 -0
  54. package/exports/admin/router.js.map +1 -0
  55. package/exports/admin/security.d.ts +1 -0
  56. package/exports/admin/security.js +3 -0
  57. package/exports/admin/security.js.map +1 -0
  58. package/exports/admin.d.ts +7 -0
  59. package/exports/admin.js +9 -0
  60. package/exports/admin.js.map +1 -0
  61. package/features/envConfig/EnvConfig.d.ts +7 -0
  62. package/features/envConfig/EnvConfig.js +17 -0
  63. package/features/envConfig/EnvConfig.js.map +1 -0
  64. package/features/envConfig/abstractions.d.ts +28 -0
  65. package/features/envConfig/abstractions.js +4 -0
  66. package/features/envConfig/abstractions.js.map +1 -0
  67. package/features/envConfig/feature.d.ts +17 -0
  68. package/features/envConfig/feature.js +14 -0
  69. package/features/envConfig/feature.js.map +1 -0
  70. package/features/envConfig/index.d.ts +1 -0
  71. package/features/envConfig/index.js +3 -0
  72. package/features/envConfig/index.js.map +1 -0
  73. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  74. package/features/eventPublisher/EventPublisher.js +27 -0
  75. package/features/eventPublisher/EventPublisher.js.map +1 -0
  76. package/features/eventPublisher/abstractions.d.ts +18 -0
  77. package/features/eventPublisher/abstractions.js +14 -0
  78. package/features/eventPublisher/abstractions.js.map +1 -0
  79. package/features/eventPublisher/feature.d.ts +3 -0
  80. package/features/eventPublisher/feature.js +16 -0
  81. package/features/eventPublisher/feature.js.map +1 -0
  82. package/features/eventPublisher/index.d.ts +3 -0
  83. package/features/eventPublisher/index.js +4 -0
  84. package/features/eventPublisher/index.js.map +1 -0
  85. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  86. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  87. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  88. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  89. package/features/graphqlClient/BatchingGraphQLClient.js +163 -0
  90. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  91. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  92. package/features/graphqlClient/FetchGraphQLClient.js +58 -0
  93. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  94. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  95. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  96. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  97. package/features/graphqlClient/RequestValue.d.ts +21 -0
  98. package/features/graphqlClient/RequestValue.js +45 -0
  99. package/features/graphqlClient/RequestValue.js.map +1 -0
  100. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  101. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  102. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  103. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  104. package/features/graphqlClient/__tests__/GraphQLClient.test.js +370 -0
  105. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  106. package/features/graphqlClient/abstractions.d.ts +18 -0
  107. package/features/graphqlClient/abstractions.js +4 -0
  108. package/features/graphqlClient/abstractions.js.map +1 -0
  109. package/features/graphqlClient/feature.d.ts +6 -0
  110. package/features/graphqlClient/feature.js +31 -0
  111. package/features/graphqlClient/feature.js.map +1 -0
  112. package/features/graphqlClient/index.d.ts +1 -0
  113. package/features/graphqlClient/index.js +3 -0
  114. package/features/graphqlClient/index.js.map +1 -0
  115. package/features/graphqlClient/types.d.ts +5 -0
  116. package/features/graphqlClient/types.js.map +1 -0
  117. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  118. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  119. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  120. package/features/localStorage/LocalStorage.d.ts +12 -0
  121. package/features/localStorage/LocalStorage.js +31 -0
  122. package/features/localStorage/LocalStorage.js.map +1 -0
  123. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  124. package/features/localStorage/LocalStorageRepository.js +95 -0
  125. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  126. package/features/localStorage/abstractions.d.ts +48 -0
  127. package/features/localStorage/abstractions.js +19 -0
  128. package/features/localStorage/abstractions.js.map +1 -0
  129. package/features/localStorage/feature.d.ts +12 -0
  130. package/features/localStorage/feature.js +34 -0
  131. package/features/localStorage/feature.js.map +1 -0
  132. package/features/localStorage/index.d.ts +1 -0
  133. package/features/localStorage/index.js +3 -0
  134. package/features/localStorage/index.js.map +1 -0
  135. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  136. package/features/mainGraphQLClient/MainGraphQLClient.js +23 -0
  137. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  138. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  139. package/features/mainGraphQLClient/abstractions.js +4 -0
  140. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  141. package/features/mainGraphQLClient/feature.d.ts +3 -0
  142. package/features/mainGraphQLClient/feature.js +16 -0
  143. package/features/mainGraphQLClient/feature.js.map +1 -0
  144. package/features/mainGraphQLClient/index.d.ts +1 -0
  145. package/features/mainGraphQLClient/index.js +3 -0
  146. package/features/mainGraphQLClient/index.js.map +1 -0
  147. package/features/router/HistoryRouterGateway.d.ts +22 -0
  148. package/features/router/HistoryRouterGateway.js +118 -0
  149. package/features/router/HistoryRouterGateway.js.map +1 -0
  150. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  151. package/features/router/HistoryRouterGateway.test.js +204 -0
  152. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  153. package/features/router/Route.d.ts +19 -0
  154. package/features/router/Route.js +59 -0
  155. package/features/router/Route.js.map +1 -0
  156. package/features/router/RouteUrl.d.ts +85 -0
  157. package/features/router/RouteUrl.js +232 -0
  158. package/features/router/RouteUrl.js.map +1 -0
  159. package/features/router/Router.d.ts +45 -0
  160. package/features/router/Router.js +129 -0
  161. package/features/router/Router.js.map +1 -0
  162. package/features/router/RouterPresenter.d.ts +21 -0
  163. package/features/router/RouterPresenter.js +57 -0
  164. package/features/router/RouterPresenter.js.map +1 -0
  165. package/features/router/RouterRepository.d.ts +30 -0
  166. package/features/router/RouterRepository.js +125 -0
  167. package/features/router/RouterRepository.js.map +1 -0
  168. package/features/router/RouterRepository.test.d.ts +1 -0
  169. package/features/router/RouterRepository.test.js +169 -0
  170. package/features/router/RouterRepository.test.js.map +1 -0
  171. package/features/router/abstractions.d.ts +81 -0
  172. package/features/router/abstractions.js +17 -0
  173. package/features/router/abstractions.js.map +1 -0
  174. package/features/router/feature.d.ts +4 -0
  175. package/features/router/feature.js +18 -0
  176. package/features/router/feature.js.map +1 -0
  177. package/features/router/index.d.ts +2 -0
  178. package/features/router/index.js +3 -0
  179. package/features/router/index.js.map +1 -0
  180. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  181. package/helpers/InterfaceGenerator/date.js +3 -0
  182. package/helpers/InterfaceGenerator/date.js.map +1 -0
  183. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  184. package/helpers/InterfaceGenerator/id.js +3 -0
  185. package/helpers/InterfaceGenerator/id.js.map +1 -0
  186. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  187. package/helpers/InterfaceGenerator/identity.js +3 -0
  188. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  189. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  190. package/helpers/InterfaceGenerator/index.js +3 -0
  191. package/helpers/InterfaceGenerator/index.js.map +1 -0
  192. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  193. package/helpers/InterfaceGenerator/numeric.js +3 -0
  194. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  195. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  196. package/helpers/InterfaceGenerator/truthful.js +3 -0
  197. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  198. package/hooks/useAutocomplete/index.d.ts +1 -1
  199. package/hooks/useAutocomplete/index.js +1 -1
  200. package/hooks/useAutocomplete/index.js.map +1 -1
  201. package/hooks/useAutocomplete/useAutocomplete.js +3 -6
  202. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  203. package/hooks/useDataList/functions/getData.js +1 -1
  204. package/hooks/useDataList/functions/getData.js.map +1 -1
  205. package/hooks/useDataList/functions/getError.js +1 -1
  206. package/hooks/useDataList/functions/getError.js.map +1 -1
  207. package/hooks/useDataList/functions/getMeta.js +1 -1
  208. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  209. package/hooks/useDataList/functions/index.d.ts +3 -3
  210. package/hooks/useDataList/functions/index.js +3 -3
  211. package/hooks/useDataList/functions/index.js.map +1 -1
  212. package/hooks/useDataList/index.d.ts +1 -1
  213. package/hooks/useDataList/index.js +1 -1
  214. package/hooks/useDataList/index.js.map +1 -1
  215. package/hooks/useDataList/useDataList.d.ts +0 -1
  216. package/hooks/useDataList/useDataList.js +6 -26
  217. package/hooks/useDataList/useDataList.js.map +1 -1
  218. package/hooks/useDataList/utils/index.d.ts +1 -2
  219. package/hooks/useDataList/utils/index.js +1 -2
  220. package/hooks/useDataList/utils/index.js.map +1 -1
  221. package/hooks/useDataList/utils/prepareLoadListParams.js +1 -1
  222. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  223. package/hooks/useHandlers.js.map +1 -1
  224. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  225. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  226. package/hooks/useUi.d.ts +1 -1
  227. package/hooks/useUi.js +1 -1
  228. package/hooks/useUi.js.map +1 -1
  229. package/i18n/index.d.ts +1 -1
  230. package/i18n/index.js +1 -1
  231. package/i18n/index.js.map +1 -1
  232. package/index.d.ts +23 -15
  233. package/index.js +22 -14
  234. package/index.js.map +1 -1
  235. package/package.json +33 -28
  236. package/plugins/AddQuerySelectionPlugin.d.ts +1 -1
  237. package/plugins/AddQuerySelectionPlugin.js +1 -1
  238. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  239. package/plugins/ApolloDynamicLink.d.ts +1 -1
  240. package/plugins/ApolloDynamicLink.js.map +1 -1
  241. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  242. package/plugins/ConsoleLinkPlugin.js +1 -1
  243. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  244. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  245. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +15 -26
  246. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  247. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  248. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  249. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  250. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  251. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  252. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  253. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  254. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -3
  255. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  256. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  257. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  258. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  259. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  260. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +4 -13
  261. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  262. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  263. package/plugins/NetworkErrorLinkPlugin.js +47 -7
  264. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  265. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  266. package/plugins/OmitTypenameLinkPlugin.js +1 -1
  267. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  268. package/plugins/TenantHeaderLinkPlugin.d.ts +2 -2
  269. package/plugins/TenantHeaderLinkPlugin.js +2 -4
  270. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  271. package/plugins/components/Image.d.ts +6 -0
  272. package/plugins/components/Image.js +19 -0
  273. package/plugins/components/Image.js.map +1 -0
  274. package/plugins/image.d.ts +1 -1
  275. package/plugins/image.js +2 -2
  276. package/plugins/image.js.map +1 -1
  277. package/plugins/index.d.ts +3 -3
  278. package/plugins/index.js +1 -1
  279. package/plugins/index.js.map +1 -1
  280. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  281. package/presentation/envConfig/useEnvConfig.js +13 -0
  282. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  283. package/presentation/localStorage/index.d.ts +3 -0
  284. package/presentation/localStorage/index.js +5 -0
  285. package/presentation/localStorage/index.js.map +1 -0
  286. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  287. package/presentation/localStorage/useLocalStorage.js +21 -0
  288. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  289. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  290. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  291. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  292. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  293. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  294. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  295. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  296. package/presentation/router/RouteElementRegistry.js +32 -0
  297. package/presentation/router/RouteElementRegistry.js.map +1 -0
  298. package/presentation/router/abstractions.d.ts +13 -0
  299. package/presentation/router/abstractions.js +4 -0
  300. package/presentation/router/abstractions.js.map +1 -0
  301. package/presentation/router/components/Redirect.d.ts +14 -0
  302. package/presentation/router/components/Redirect.js +15 -0
  303. package/presentation/router/components/Redirect.js.map +1 -0
  304. package/presentation/router/components/RouteContent.d.ts +2 -0
  305. package/presentation/router/components/RouteContent.js +23 -0
  306. package/presentation/router/components/RouteContent.js.map +1 -0
  307. package/presentation/router/components/RouteLink.d.ts +50 -0
  308. package/presentation/router/components/RouteLink.js +22 -0
  309. package/presentation/router/components/RouteLink.js.map +1 -0
  310. package/presentation/router/components/SimpleLink.d.ts +44 -0
  311. package/presentation/router/components/SimpleLink.js +30 -0
  312. package/presentation/router/components/SimpleLink.js.map +1 -0
  313. package/presentation/router/hooks/useRoute.d.ts +6 -0
  314. package/presentation/router/hooks/useRoute.js +30 -0
  315. package/presentation/router/hooks/useRoute.js.map +1 -0
  316. package/presentation/router/hooks/useRouter.d.ts +11 -0
  317. package/presentation/router/hooks/useRouter.js +30 -0
  318. package/presentation/router/hooks/useRouter.js.map +1 -0
  319. package/presentation/router/index.d.ts +4 -0
  320. package/presentation/router/index.js +5 -0
  321. package/presentation/router/index.js.map +1 -0
  322. package/presentation/router/types.d.ts +5 -0
  323. package/presentation/router/types.js +3 -0
  324. package/presentation/router/types.js.map +1 -0
  325. package/react-butterfiles/Files.js +3 -3
  326. package/react-butterfiles/Files.js.map +1 -1
  327. package/react-butterfiles/file.todo +1 -0
  328. package/react-butterfiles/index.d.ts +1 -1
  329. package/react-butterfiles/index.js +1 -1
  330. package/react-butterfiles/index.js.map +1 -1
  331. package/renderApp.d.ts +1 -1
  332. package/renderApp.js.map +1 -1
  333. package/router.d.ts +5 -0
  334. package/router.js +8 -0
  335. package/router.js.map +1 -0
  336. package/shared/di/DiContainerProvider.d.ts +8 -0
  337. package/shared/di/DiContainerProvider.js +17 -0
  338. package/shared/di/DiContainerProvider.js.map +1 -0
  339. package/shared/di/createFeature.d.ts +11 -0
  340. package/shared/di/createFeature.js +11 -0
  341. package/shared/di/createFeature.js.map +1 -0
  342. package/shared/di/useFeature.d.ts +2 -0
  343. package/shared/di/useFeature.js +8 -0
  344. package/shared/di/useFeature.js.map +1 -0
  345. package/types.d.ts +7 -4
  346. package/types.js +1 -12
  347. package/types.js.map +1 -1
  348. package/utils/index.d.ts +2 -10
  349. package/utils/index.js +2 -10
  350. package/utils/index.js.map +1 -1
  351. package/utils/legacyPluginToReactComponent.js +1 -1
  352. package/utils/legacyPluginToReactComponent.js.map +1 -1
  353. package/components/Routes.d.ts +0 -2
  354. package/components/Routes.js +0 -36
  355. package/components/Routes.js.map +0 -1
  356. package/components/View.d.ts +0 -8
  357. package/components/View.js +0 -19
  358. package/components/View.js.map +0 -1
  359. package/core/DebounceRender.d.ts +0 -12
  360. package/core/DebounceRender.js +0 -31
  361. package/core/DebounceRender.js.map +0 -1
  362. package/core/Routes.d.ts +0 -6
  363. package/core/Routes.js +0 -34
  364. package/core/Routes.js.map +0 -1
  365. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  366. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
  367. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  368. package/hooks/useDataList/utils/types.d.ts +0 -40
  369. package/hooks/useDataList/utils/types.js.map +0 -1
  370. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  371. package/plugins/LocaleHeaderLinkPlugin.js +0 -32
  372. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  373. package/plugins/RoutePlugin.d.ts +0 -12
  374. package/plugins/RoutePlugin.js +0 -16
  375. package/plugins/RoutePlugin.js.map +0 -1
  376. package/plugins/ViewPlugin.d.ts +0 -14
  377. package/plugins/ViewPlugin.js +0 -19
  378. package/plugins/ViewPlugin.js.map +0 -1
  379. package/utils/getApiUrl.d.ts +0 -1
  380. package/utils/getApiUrl.js +0 -5
  381. package/utils/getApiUrl.js.map +0 -1
  382. package/utils/getGqlApiUrl.d.ts +0 -1
  383. package/utils/getGqlApiUrl.js +0 -6
  384. package/utils/getGqlApiUrl.js.map +0 -1
  385. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  386. package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
  387. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  388. package/utils/getLocaleCode.d.ts +0 -6
  389. package/utils/getLocaleCode.js +0 -33
  390. package/utils/getLocaleCode.js.map +0 -1
  391. package/utils/getPrerenderId.d.ts +0 -6
  392. package/utils/getPrerenderId.js +0 -5
  393. package/utils/getPrerenderId.js.map +0 -1
  394. package/utils/getTenantId.d.ts +0 -6
  395. package/utils/getTenantId.js +0 -45
  396. package/utils/getTenantId.js.map +0 -1
  397. package/utils/isLocalhost.d.ts +0 -1
  398. package/utils/isLocalhost.js +0 -7
  399. package/utils/isLocalhost.js.map +0 -1
  400. package/utils/isPrerendering.d.ts +0 -1
  401. package/utils/isPrerendering.js +0 -5
  402. package/utils/isPrerendering.js.map +0 -1
  403. /package/{hooks/useDataList/utils → features/graphqlClient}/types.js +0 -0
@@ -0,0 +1,6 @@
1
+ import { LocalStorage } from "../../features/localStorage/index.js";
2
+ /**
3
+ * Returns the LocalStorage instance from DI.
4
+ * Useful when you want to call service methods imperatively inside components.
5
+ */
6
+ export declare function useLocalStorage(): LocalStorage.Interface;
@@ -0,0 +1,21 @@
1
+ import { LocalStorageFeature } from "../../features/localStorage/feature.js";
2
+ import { useFeature } from "../../shared/di/useFeature.js";
3
+
4
+ /**
5
+ * Returns the LocalStorage instance from DI.
6
+ * Useful when you want to call service methods imperatively inside components.
7
+ */
8
+ export function useLocalStorage() {
9
+ const {
10
+ localStorageService
11
+ } = useFeature(LocalStorageFeature);
12
+ return {
13
+ get: localStorageService.get.bind(localStorageService),
14
+ set: localStorageService.set.bind(localStorageService),
15
+ remove: localStorageService.remove.bind(localStorageService),
16
+ clear: localStorageService.clear.bind(localStorageService),
17
+ keys: localStorageService.keys.bind(localStorageService)
18
+ };
19
+ }
20
+
21
+ //# sourceMappingURL=useLocalStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LocalStorageFeature","useFeature","useLocalStorage","localStorageService","get","bind","set","remove","clear","keys"],"sources":["useLocalStorage.ts"],"sourcesContent":["import { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { LocalStorage } from \"~/features/localStorage/index.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\n/**\n * Returns the LocalStorage instance from DI.\n * Useful when you want to call service methods imperatively inside components.\n */\nexport function useLocalStorage(): LocalStorage.Interface {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n return {\n get: localStorageService.get.bind(localStorageService),\n set: localStorageService.set.bind(localStorageService),\n remove: localStorageService.remove.bind(localStorageService),\n clear: localStorageService.clear.bind(localStorageService),\n keys: localStorageService.keys.bind(localStorageService)\n };\n}\n"],"mappings":"AAAA,SAASA,mBAAmB;AAE5B,SAASC,UAAU;;AAEnB;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAA,EAA2B;EACtD,MAAM;IAAEC;EAAoB,CAAC,GAAGF,UAAU,CAACD,mBAAmB,CAAC;EAE/D,OAAO;IACHI,GAAG,EAAED,mBAAmB,CAACC,GAAG,CAACC,IAAI,CAACF,mBAAmB,CAAC;IACtDG,GAAG,EAAEH,mBAAmB,CAACG,GAAG,CAACD,IAAI,CAACF,mBAAmB,CAAC;IACtDI,MAAM,EAAEJ,mBAAmB,CAACI,MAAM,CAACF,IAAI,CAACF,mBAAmB,CAAC;IAC5DK,KAAK,EAAEL,mBAAmB,CAACK,KAAK,CAACH,IAAI,CAACF,mBAAmB,CAAC;IAC1DM,IAAI,EAAEN,mBAAmB,CAACM,IAAI,CAACJ,IAAI,CAACF,mBAAmB;EAC3D,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare function useLocalStorageValue<T = string>(key: string): T | undefined;
@@ -0,0 +1,20 @@
1
+ import { useEffect, useState } from "react";
2
+ import { autorun } from "mobx";
3
+ import { LocalStorageFeature } from "../../features/localStorage/feature.js";
4
+ import { useFeature } from "../../shared/di/useFeature.js";
5
+ export function useLocalStorageValue(key) {
6
+ const {
7
+ localStorageService
8
+ } = useFeature(LocalStorageFeature);
9
+ const [value, setValue] = useState(() => localStorageService.get(key));
10
+ useEffect(() => {
11
+ const dispose = autorun(() => {
12
+ const value = localStorageService.get(key);
13
+ setValue(value);
14
+ });
15
+ return () => dispose();
16
+ }, [localStorageService, key]);
17
+ return value;
18
+ }
19
+
20
+ //# sourceMappingURL=useLocalStorageValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","autorun","LocalStorageFeature","useFeature","useLocalStorageValue","key","localStorageService","value","setValue","get","dispose"],"sources":["useLocalStorageValue.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { autorun } from \"mobx\";\nimport { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\nexport function useLocalStorageValue<T = string>(key: string): T | undefined {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n const [value, setValue] = useState<T | undefined>(() => localStorageService.get<T>(key));\n\n useEffect(() => {\n const dispose = autorun(() => {\n const value = localStorageService.get<T>(key);\n setValue(value);\n });\n return () => dispose();\n }, [localStorageService, key]);\n\n return value;\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,OAAO,QAAQ,MAAM;AAC9B,SAASC,mBAAmB;AAC5B,SAASC,UAAU;AAEnB,OAAO,SAASC,oBAAoBA,CAAaC,GAAW,EAAiB;EACzE,MAAM;IAAEC;EAAoB,CAAC,GAAGH,UAAU,CAACD,mBAAmB,CAAC;EAE/D,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAgB,MAAMM,mBAAmB,CAACG,GAAG,CAAIJ,GAAG,CAAC,CAAC;EAExFN,SAAS,CAAC,MAAM;IACZ,MAAMW,OAAO,GAAGT,OAAO,CAAC,MAAM;MAC1B,MAAMM,KAAK,GAAGD,mBAAmB,CAACG,GAAG,CAAIJ,GAAG,CAAC;MAC7CG,QAAQ,CAACD,KAAK,CAAC;IACnB,CAAC,CAAC;IACF,OAAO,MAAMG,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACJ,mBAAmB,EAAED,GAAG,CAAC,CAAC;EAE9B,OAAOE,KAAK;AAChB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Observes multiple keys in LocalStorage and returns an object of { key: value }.
3
+ * Re-renders when any of the observed keys change.
4
+ */
5
+ export declare function useLocalStorageValues<T extends Record<string, any>>(keys: (keyof T & string)[]): Partial<T>;
@@ -0,0 +1,39 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import { autorun } from "mobx";
3
+ import isEqual from "lodash/isEqual.js";
4
+ import { LocalStorageFeature } from "../../features/localStorage/feature.js";
5
+ import { useFeature } from "../../shared/di/useFeature.js";
6
+
7
+ /**
8
+ * Observes multiple keys in LocalStorage and returns an object of { key: value }.
9
+ * Re-renders when any of the observed keys change.
10
+ */
11
+ export function useLocalStorageValues(keys) {
12
+ const {
13
+ localStorageService
14
+ } = useFeature(LocalStorageFeature);
15
+ const [values, setValues] = useState(() => {
16
+ const initial = {};
17
+ for (const key of keys) {
18
+ initial[key] = localStorageService.get(key);
19
+ }
20
+ return initial;
21
+ });
22
+ const valuesRef = useRef(values);
23
+ useEffect(() => {
24
+ const dispose = autorun(() => {
25
+ const snapshot = {};
26
+ for (const key of keys) {
27
+ snapshot[key] = localStorageService.get(key);
28
+ }
29
+ if (!isEqual(snapshot, valuesRef.current)) {
30
+ setValues(snapshot);
31
+ valuesRef.current = snapshot;
32
+ }
33
+ });
34
+ return () => dispose();
35
+ }, [localStorageService, keys.join(",")]);
36
+ return values;
37
+ }
38
+
39
+ //# sourceMappingURL=useLocalStorageValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useState","autorun","isEqual","LocalStorageFeature","useFeature","useLocalStorageValues","keys","localStorageService","values","setValues","initial","key","get","valuesRef","dispose","snapshot","current","join"],"sources":["useLocalStorageValues.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { autorun } from \"mobx\";\nimport isEqual from \"lodash/isEqual.js\";\nimport { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\n/**\n * Observes multiple keys in LocalStorage and returns an object of { key: value }.\n * Re-renders when any of the observed keys change.\n */\nexport function useLocalStorageValues<T extends Record<string, any>>(\n keys: (keyof T & string)[]\n): Partial<T> {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n const [values, setValues] = useState<Partial<T>>(() => {\n const initial: Partial<T> = {};\n for (const key of keys) {\n initial[key] = localStorageService.get<any>(key);\n }\n return initial;\n });\n\n const valuesRef = useRef(values);\n\n useEffect(() => {\n const dispose = autorun(() => {\n const snapshot: Partial<T> = {};\n for (const key of keys) {\n snapshot[key] = localStorageService.get<any>(key);\n }\n\n if (!isEqual(snapshot, valuesRef.current)) {\n setValues(snapshot);\n valuesRef.current = snapshot;\n }\n });\n return () => dispose();\n }, [localStorageService, keys.join(\",\")]);\n\n return values;\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,OAAO,QAAQ,MAAM;AAC9B,OAAOC,OAAO,MAAM,mBAAmB;AACvC,SAASC,mBAAmB;AAC5B,SAASC,UAAU;;AAEnB;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACjCC,IAA0B,EAChB;EACV,MAAM;IAAEC;EAAoB,CAAC,GAAGH,UAAU,CAACD,mBAAmB,CAAC;EAE/D,MAAM,CAACK,MAAM,EAAEC,SAAS,CAAC,GAAGT,QAAQ,CAAa,MAAM;IACnD,MAAMU,OAAmB,GAAG,CAAC,CAAC;IAC9B,KAAK,MAAMC,GAAG,IAAIL,IAAI,EAAE;MACpBI,OAAO,CAACC,GAAG,CAAC,GAAGJ,mBAAmB,CAACK,GAAG,CAAMD,GAAG,CAAC;IACpD;IACA,OAAOD,OAAO;EAClB,CAAC,CAAC;EAEF,MAAMG,SAAS,GAAGd,MAAM,CAACS,MAAM,CAAC;EAEhCV,SAAS,CAAC,MAAM;IACZ,MAAMgB,OAAO,GAAGb,OAAO,CAAC,MAAM;MAC1B,MAAMc,QAAoB,GAAG,CAAC,CAAC;MAC/B,KAAK,MAAMJ,GAAG,IAAIL,IAAI,EAAE;QACpBS,QAAQ,CAACJ,GAAG,CAAC,GAAGJ,mBAAmB,CAACK,GAAG,CAAMD,GAAG,CAAC;MACrD;MAEA,IAAI,CAACT,OAAO,CAACa,QAAQ,EAAEF,SAAS,CAACG,OAAO,CAAC,EAAE;QACvCP,SAAS,CAACM,QAAQ,CAAC;QACnBF,SAAS,CAACG,OAAO,GAAGD,QAAQ;MAChC;IACJ,CAAC,CAAC;IACF,OAAO,MAAMD,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,mBAAmB,EAAED,IAAI,CAACW,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;EAEzC,OAAOT,MAAM;AACjB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ declare class RouteElementRegistryImplementation {
3
+ private readonly elements;
4
+ /** Register a React element for a given route. */
5
+ register(routeName: string, element: React.ReactNode): void;
6
+ /** Get the element for a matched route by name. */
7
+ getElement(routeName: string): React.ReactNode | null;
8
+ /** Clear all registered elements. Useful in tests or hot reloads. */
9
+ clear(): void;
10
+ /** List all registered route names. */
11
+ list(): string[];
12
+ }
13
+ export declare const DefaultRouteElementRegistry: import("@webiny/di").Implementation<typeof RouteElementRegistryImplementation>;
14
+ export {};
@@ -0,0 +1,32 @@
1
+ import { createImplementation } from "@webiny/di";
2
+ import { RouteElementRegistry } from "./abstractions.js";
3
+ class RouteElementRegistryImplementation {
4
+ elements = new Map();
5
+
6
+ /** Register a React element for a given route. */
7
+ register(routeName, element) {
8
+ this.elements.set(routeName, element);
9
+ }
10
+
11
+ /** Get the element for a matched route by name. */
12
+ getElement(routeName) {
13
+ return this.elements.get(routeName) ?? null;
14
+ }
15
+
16
+ /** Clear all registered elements. Useful in tests or hot reloads. */
17
+ clear() {
18
+ this.elements.clear();
19
+ }
20
+
21
+ /** List all registered route names. */
22
+ list() {
23
+ return [...this.elements.keys()];
24
+ }
25
+ }
26
+ export const DefaultRouteElementRegistry = createImplementation({
27
+ implementation: RouteElementRegistryImplementation,
28
+ abstraction: RouteElementRegistry,
29
+ dependencies: []
30
+ });
31
+
32
+ //# sourceMappingURL=RouteElementRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createImplementation","RouteElementRegistry","RouteElementRegistryImplementation","elements","Map","register","routeName","element","set","getElement","get","clear","list","keys","DefaultRouteElementRegistry","implementation","abstraction","dependencies"],"sources":["RouteElementRegistry.ts"],"sourcesContent":["import React from \"react\";\nimport { createImplementation } from \"@webiny/di\";\nimport { RouteElementRegistry } from \"./abstractions.js\";\n\nclass RouteElementRegistryImplementation {\n private readonly elements = new Map<string, React.ReactNode>();\n\n /** Register a React element for a given route. */\n register(routeName: string, element: React.ReactNode): void {\n this.elements.set(routeName, element);\n }\n\n /** Get the element for a matched route by name. */\n getElement(routeName: string): React.ReactNode | null {\n return this.elements.get(routeName) ?? null;\n }\n\n /** Clear all registered elements. Useful in tests or hot reloads. */\n clear(): void {\n this.elements.clear();\n }\n\n /** List all registered route names. */\n list(): string[] {\n return [...this.elements.keys()];\n }\n}\n\nexport const DefaultRouteElementRegistry = createImplementation({\n implementation: RouteElementRegistryImplementation,\n abstraction: RouteElementRegistry,\n dependencies: []\n});\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,oBAAoB;AAE7B,MAAMC,kCAAkC,CAAC;EACpBC,QAAQ,GAAG,IAAIC,GAAG,CAA0B,CAAC;;EAE9D;EACAC,QAAQA,CAACC,SAAiB,EAAEC,OAAwB,EAAQ;IACxD,IAAI,CAACJ,QAAQ,CAACK,GAAG,CAACF,SAAS,EAAEC,OAAO,CAAC;EACzC;;EAEA;EACAE,UAAUA,CAACH,SAAiB,EAA0B;IAClD,OAAO,IAAI,CAACH,QAAQ,CAACO,GAAG,CAACJ,SAAS,CAAC,IAAI,IAAI;EAC/C;;EAEA;EACAK,KAAKA,CAAA,EAAS;IACV,IAAI,CAACR,QAAQ,CAACQ,KAAK,CAAC,CAAC;EACzB;;EAEA;EACAC,IAAIA,CAAA,EAAa;IACb,OAAO,CAAC,GAAG,IAAI,CAACT,QAAQ,CAACU,IAAI,CAAC,CAAC,CAAC;EACpC;AACJ;AAEA,OAAO,MAAMC,2BAA2B,GAAGd,oBAAoB,CAAC;EAC5De,cAAc,EAAEb,kCAAkC;EAClDc,WAAW,EAAEf,oBAAoB;EACjCgB,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { Abstraction } from "@webiny/di";
3
+ interface IRouteElementRegistry {
4
+ register(name: string, element: React.ReactElement): void;
5
+ getElement(routeName: string): React.ReactNode | null;
6
+ clear(): void;
7
+ list(): string[];
8
+ }
9
+ export declare const RouteElementRegistry: Abstraction<IRouteElementRegistry>;
10
+ export declare namespace RouteElementRegistry {
11
+ type Interface = IRouteElementRegistry;
12
+ }
13
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ export const RouteElementRegistry = new Abstraction("RouteElementRegistry");
3
+
4
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Abstraction","RouteElementRegistry"],"sources":["abstractions.ts"],"sourcesContent":["import React from \"react\";\nimport { Abstraction } from \"@webiny/di\";\n\ninterface IRouteElementRegistry {\n register(name: string, element: React.ReactElement): void;\n getElement(routeName: string): React.ReactNode | null;\n clear(): void;\n list(): string[];\n}\n\nexport const RouteElementRegistry = new Abstraction<IRouteElementRegistry>(\"RouteElementRegistry\");\n\nexport namespace RouteElementRegistry {\n export type Interface = IRouteElementRegistry;\n}\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,YAAY;AASxC,OAAO,MAAMC,oBAAoB,GAAG,IAAID,WAAW,CAAwB,sBAAsB,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { Route, RouteParamsDefinition, RouteParamsInfer } from "../../../features/router/Route.js";
2
+ import type { RequiredKeysOf } from "type-fest";
3
+ export type RedirectProps<TParams extends RouteParamsDefinition | undefined> = [
4
+ TParams extends RouteParamsDefinition ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never ? {
5
+ route: Route<TParams>;
6
+ params?: RouteParamsInfer<TParams>;
7
+ } : {
8
+ route: Route<TParams>;
9
+ params: RouteParamsInfer<TParams>;
10
+ } : {
11
+ route: Route<TParams>;
12
+ }
13
+ ][0];
14
+ export declare const RedirectComponent: <TParams extends RouteParamsDefinition | undefined>(props: RedirectProps<TParams>) => null;
@@ -0,0 +1,15 @@
1
+ import { useEffect } from "react";
2
+ import { useRouter } from "../../../router.js";
3
+ export const RedirectComponent = props => {
4
+ const router = useRouter();
5
+ const {
6
+ route,
7
+ ...rest
8
+ } = props;
9
+ useEffect(() => {
10
+ router.goToRoute(route, rest.params);
11
+ }, []);
12
+ return null;
13
+ };
14
+
15
+ //# sourceMappingURL=Redirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRouter","RedirectComponent","props","router","route","rest","goToRoute","params"],"sources":["Redirect.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"~/features/router/Route.js\";\nimport { useRouter } from \"~/router.js\";\nimport type { RequiredKeysOf } from \"type-fest\";\n\nexport type RedirectProps<TParams extends RouteParamsDefinition | undefined> = [\n TParams extends RouteParamsDefinition\n ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never\n ? { route: Route<TParams>; params?: RouteParamsInfer<TParams> }\n : { route: Route<TParams>; params: RouteParamsInfer<TParams> }\n : { route: Route<TParams> }\n][0];\n\nexport const RedirectComponent = <TParams extends RouteParamsDefinition | undefined>(\n props: RedirectProps<TParams>\n) => {\n const router = useRouter();\n const { route, ...rest } = props as any;\n\n useEffect(() => {\n router.goToRoute(route, rest.params);\n }, []);\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,SAAS;AAWlB,OAAO,MAAMC,iBAAiB,GAC1BC,KAA6B,IAC5B;EACD,MAAMC,MAAM,GAAGH,SAAS,CAAC,CAAC;EAC1B,MAAM;IAAEI,KAAK;IAAE,GAAGC;EAAK,CAAC,GAAGH,KAAY;EAEvCH,SAAS,CAAC,MAAM;IACZI,MAAM,CAACG,SAAS,CAACF,KAAK,EAAEC,IAAI,CAACE,MAAM,CAAC;EACxC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const RouteContent: () => React.JSX.Element | null;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { DevToolsSection } from "@webiny/react-properties";
3
+ import { RouteElementRegistry, useRoute } from "../index.js";
4
+ import { useContainer } from "../../../shared/di/DiContainerProvider.js";
5
+ export const RouteContent = () => {
6
+ const {
7
+ route
8
+ } = useRoute();
9
+ const container = useContainer();
10
+ const elementRegistry = container.resolve(RouteElementRegistry);
11
+ if (!route) {
12
+ return null;
13
+ }
14
+ const element = elementRegistry.getElement(route.name);
15
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DevToolsSection, {
16
+ name: "Current Route",
17
+ group: "Router",
18
+ data: route,
19
+ views: "raw"
20
+ }), element ?? null);
21
+ };
22
+
23
+ //# sourceMappingURL=RouteContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","DevToolsSection","RouteElementRegistry","useRoute","useContainer","RouteContent","route","container","elementRegistry","resolve","element","getElement","name","createElement","Fragment","group","data","views"],"sources":["RouteContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { DevToolsSection } from \"@webiny/react-properties\";\nimport { RouteElementRegistry, useRoute } from \"~/presentation/router/index.js\";\nimport { useContainer } from \"~/shared/di/DiContainerProvider.js\";\n\nexport const RouteContent = () => {\n const { route } = useRoute();\n const container = useContainer();\n const elementRegistry = container.resolve(RouteElementRegistry);\n\n if (!route) {\n return null;\n }\n\n const element = elementRegistry.getElement(route.name);\n\n return (\n <>\n <DevToolsSection name={\"Current Route\"} group={\"Router\"} data={route} views={\"raw\"} />\n {element ?? null}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,oBAAoB,EAAEC,QAAQ;AACvC,SAASC,YAAY;AAErB,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAGH,QAAQ,CAAC,CAAC;EAC5B,MAAMI,SAAS,GAAGH,YAAY,CAAC,CAAC;EAChC,MAAMI,eAAe,GAAGD,SAAS,CAACE,OAAO,CAACP,oBAAoB,CAAC;EAE/D,IAAI,CAACI,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EAEA,MAAMI,OAAO,GAAGF,eAAe,CAACG,UAAU,CAACL,KAAK,CAACM,IAAI,CAAC;EAEtD,oBACIZ,KAAA,CAAAa,aAAA,CAAAb,KAAA,CAAAc,QAAA,qBACId,KAAA,CAAAa,aAAA,CAACZ,eAAe;IAACW,IAAI,EAAE,eAAgB;IAACG,KAAK,EAAE,QAAS;IAACC,IAAI,EAAEV,KAAM;IAACW,KAAK,EAAE;EAAM,CAAE,CAAC,EACrFP,OAAO,IAAI,IACd,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import type { Route, RouteParamsDefinition, RouteParamsInfer } from "../../../features/router/Route.js";
3
+ type BaseAnchorAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">;
4
+ export type RouteLinkProps<TParams extends RouteParamsDefinition | undefined> = [
5
+ TParams extends RouteParamsDefinition ? {
6
+ route: Route<TParams>;
7
+ params: RouteParamsInfer<TParams>;
8
+ } : {
9
+ route: Route<TParams>;
10
+ }
11
+ ][0] & BaseAnchorAttributes;
12
+ export declare const RouteLink: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
13
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
14
+ originalName: string;
15
+ displayName: string;
16
+ } & {
17
+ original: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
18
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
19
+ originalName: string;
20
+ displayName: string;
21
+ };
22
+ originalName: string;
23
+ displayName: string;
24
+ } & {
25
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
26
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
27
+ originalName: string;
28
+ displayName: string;
29
+ }>) => (props: unknown) => React.JSX.Element;
30
+ };
31
+ export declare const RouteLinkComponent: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
32
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
33
+ originalName: string;
34
+ displayName: string;
35
+ } & {
36
+ original: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
37
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
38
+ originalName: string;
39
+ displayName: string;
40
+ };
41
+ originalName: string;
42
+ displayName: string;
43
+ } & {
44
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
45
+ original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
46
+ originalName: string;
47
+ displayName: string;
48
+ }>) => (props: unknown) => React.JSX.Element;
49
+ };
50
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { makeDecoratable } from "@webiny/react-composition";
3
+ import { SimpleLink } from "./SimpleLink.js";
4
+ import { useRouter } from "../../../router.js";
5
+
6
+ // The props are generic over the Route's schema.
7
+
8
+ export const RouteLink = makeDecoratable("RouteLink", props => {
9
+ const router = useRouter();
10
+ const {
11
+ children,
12
+ route,
13
+ ...rest
14
+ } = props;
15
+ const href = rest.params ? router.getLink(route, rest.params) : router.getLink(route);
16
+ return /*#__PURE__*/React.createElement(SimpleLink, Object.assign({
17
+ to: href
18
+ }, rest), children);
19
+ });
20
+ export const RouteLinkComponent = RouteLink;
21
+
22
+ //# sourceMappingURL=RouteLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","makeDecoratable","SimpleLink","useRouter","RouteLink","props","router","children","route","rest","href","params","getLink","createElement","Object","assign","to","RouteLinkComponent"],"sources":["RouteLink.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"~/features/router/Route.js\";\nimport { SimpleLink } from \"./SimpleLink.js\";\nimport { useRouter } from \"~/router.js\";\n\ntype BaseAnchorAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\">;\n\n// The props are generic over the Route's schema.\nexport type RouteLinkProps<TParams extends RouteParamsDefinition | undefined> = [\n TParams extends RouteParamsDefinition\n ? {\n route: Route<TParams>;\n params: RouteParamsInfer<TParams>;\n }\n : { route: Route<TParams> }\n][0] &\n BaseAnchorAttributes;\n\nexport const RouteLink = makeDecoratable(\n \"RouteLink\",\n <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => {\n const router = useRouter();\n\n const { children, route, ...rest } = props as any;\n\n const href = rest.params ? router.getLink(route!, rest.params) : router.getLink(route!);\n\n return (\n <SimpleLink to={href} {...rest}>\n {children}\n </SimpleLink>\n );\n }\n);\n\nexport const RouteLinkComponent = RouteLink;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,SAASC,UAAU;AACnB,SAASC,SAAS;;AAIlB;;AAWA,OAAO,MAAMC,SAAS,GAAGH,eAAe,CACpC,WAAW,EACyCI,KAA8B,IAAK;EACnF,MAAMC,MAAM,GAAGH,SAAS,CAAC,CAAC;EAE1B,MAAM;IAAEI,QAAQ;IAAEC,KAAK;IAAE,GAAGC;EAAK,CAAC,GAAGJ,KAAY;EAEjD,MAAMK,IAAI,GAAGD,IAAI,CAACE,MAAM,GAAGL,MAAM,CAACM,OAAO,CAACJ,KAAK,EAAGC,IAAI,CAACE,MAAM,CAAC,GAAGL,MAAM,CAACM,OAAO,CAACJ,KAAM,CAAC;EAEvF,oBACIR,KAAA,CAAAa,aAAA,CAACX,UAAU,EAAAY,MAAA,CAAAC,MAAA;IAACC,EAAE,EAAEN;EAAK,GAAKD,IAAI,GACzBF,QACO,CAAC;AAErB,CACJ,CAAC;AAED,OAAO,MAAMU,kBAAkB,GAAGb,SAAS","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ type BaseAnchorAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">;
3
+ export type SimpleLinkProps = BaseAnchorAttributes & {
4
+ to: string;
5
+ };
6
+ export declare const SimpleLink: (({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
7
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
8
+ originalName: string;
9
+ displayName: string;
10
+ } & {
11
+ original: (({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
12
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
13
+ originalName: string;
14
+ displayName: string;
15
+ };
16
+ originalName: string;
17
+ displayName: string;
18
+ } & {
19
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
20
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
21
+ originalName: string;
22
+ displayName: string;
23
+ }>) => (props: unknown) => React.JSX.Element;
24
+ };
25
+ export declare const LinkComponent: (({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
26
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
27
+ originalName: string;
28
+ displayName: string;
29
+ } & {
30
+ original: (({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
31
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
32
+ originalName: string;
33
+ displayName: string;
34
+ };
35
+ originalName: string;
36
+ displayName: string;
37
+ } & {
38
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element) & {
39
+ original: ({ children, to, ...rest }: SimpleLinkProps) => React.JSX.Element;
40
+ originalName: string;
41
+ displayName: string;
42
+ }>) => (props: unknown) => React.JSX.Element;
43
+ };
44
+ export {};
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { makeDecoratable } from "@webiny/react-composition";
3
+ import { RouterGateway } from "../../../features/router/abstractions.js";
4
+ import { useContainer } from "../../../shared/di/DiContainerProvider.js";
5
+ export const SimpleLink = makeDecoratable("SimpleLink", ({
6
+ children,
7
+ to,
8
+ ...rest
9
+ }) => {
10
+ const container = useContainer();
11
+ const routerGateway = container.resolve(RouterGateway);
12
+ const handleClick = event => {
13
+ // Respect cmd+click / ctrl+click / middle click → open in new tab
14
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey || rest.target === "_blank") {
15
+ return;
16
+ }
17
+ event.preventDefault();
18
+ routerGateway.pushState(to);
19
+ };
20
+ const onClick = rest.onClick ?? handleClick;
21
+ return /*#__PURE__*/React.createElement("a", Object.assign({
22
+ href: to,
23
+ rel: "noreferrer noopener"
24
+ }, rest, {
25
+ onClick: onClick
26
+ }), children);
27
+ });
28
+ export const LinkComponent = SimpleLink;
29
+
30
+ //# sourceMappingURL=SimpleLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","makeDecoratable","RouterGateway","useContainer","SimpleLink","children","to","rest","container","routerGateway","resolve","handleClick","event","defaultPrevented","button","metaKey","altKey","ctrlKey","shiftKey","target","preventDefault","pushState","onClick","createElement","Object","assign","href","rel","LinkComponent"],"sources":["SimpleLink.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { RouterGateway } from \"~/features/router/abstractions.js\";\nimport { useContainer } from \"~/shared/di/DiContainerProvider.js\";\n\ntype BaseAnchorAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\">;\n\nexport type SimpleLinkProps = BaseAnchorAttributes & {\n to: string;\n};\n\nexport const SimpleLink = makeDecoratable(\n \"SimpleLink\",\n ({ children, to, ...rest }: SimpleLinkProps) => {\n const container = useContainer();\n\n const routerGateway = container.resolve(RouterGateway);\n\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n // Respect cmd+click / ctrl+click / middle click → open in new tab\n if (\n event.defaultPrevented ||\n event.button !== 0 ||\n event.metaKey ||\n event.altKey ||\n event.ctrlKey ||\n event.shiftKey ||\n rest.target === \"_blank\"\n ) {\n return;\n }\n\n event.preventDefault();\n routerGateway.pushState(to);\n };\n\n const onClick = rest.onClick ?? handleClick;\n\n return (\n <a href={to} rel=\"noreferrer noopener\" {...rest} onClick={onClick}>\n {children}\n </a>\n );\n }\n);\n\nexport const LinkComponent = SimpleLink;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,aAAa;AACtB,SAASC,YAAY;AAQrB,OAAO,MAAMC,UAAU,GAAGH,eAAe,CACrC,YAAY,EACZ,CAAC;EAAEI,QAAQ;EAAEC,EAAE;EAAE,GAAGC;AAAsB,CAAC,KAAK;EAC5C,MAAMC,SAAS,GAAGL,YAAY,CAAC,CAAC;EAEhC,MAAMM,aAAa,GAAGD,SAAS,CAACE,OAAO,CAACR,aAAa,CAAC;EAEtD,MAAMS,WAAW,GAAIC,KAA0C,IAAK;IAChE;IACA,IACIA,KAAK,CAACC,gBAAgB,IACtBD,KAAK,CAACE,MAAM,KAAK,CAAC,IAClBF,KAAK,CAACG,OAAO,IACbH,KAAK,CAACI,MAAM,IACZJ,KAAK,CAACK,OAAO,IACbL,KAAK,CAACM,QAAQ,IACdX,IAAI,CAACY,MAAM,KAAK,QAAQ,EAC1B;MACE;IACJ;IAEAP,KAAK,CAACQ,cAAc,CAAC,CAAC;IACtBX,aAAa,CAACY,SAAS,CAACf,EAAE,CAAC;EAC/B,CAAC;EAED,MAAMgB,OAAO,GAAGf,IAAI,CAACe,OAAO,IAAIX,WAAW;EAE3C,oBACIX,KAAA,CAAAuB,aAAA,MAAAC,MAAA,CAAAC,MAAA;IAAGC,IAAI,EAAEpB,EAAG;IAACqB,GAAG,EAAC;EAAqB,GAAKpB,IAAI;IAAEe,OAAO,EAAEA;EAAQ,IAC7DjB,QACF,CAAC;AAEZ,CACJ,CAAC;AAED,OAAO,MAAMuB,aAAa,GAAGxB,UAAU","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { Route, RouteParamsDefinition, RouteParamsInfer } from "../../../features/router/Route.js";
2
+ import { MatchedRoute } from "../../../features/router/abstractions.js";
3
+ export declare function useRoute<TParams extends RouteParamsDefinition | undefined = undefined>(route?: Route<TParams>): {
4
+ route: MatchedRoute<TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined>;
5
+ setRouteParams: <T extends Record<string, any>>(cb: (params: T) => T) => void;
6
+ };
@@ -0,0 +1,30 @@
1
+ import { useEffect, useState } from "react";
2
+ import { autorun } from "mobx";
3
+ import { RouterFeature } from "../../../features/router/feature.js";
4
+ import { useFeature } from "../../../shared/di/useFeature.js";
5
+ export function useRoute(
6
+ // oxlint-disable-next-line typescript/no-unused-vars
7
+ route) {
8
+ const {
9
+ presenter
10
+ } = useFeature(RouterFeature);
11
+ const [currentRoute, setCurrentRoute] = useState(presenter.vm.currentRoute);
12
+ useEffect(() => {
13
+ autorun(() => {
14
+ const route = presenter.vm.currentRoute;
15
+ if (!route) {
16
+ return;
17
+ }
18
+ setCurrentRoute(route);
19
+ });
20
+ }, []);
21
+
22
+ // TODO: add validation (the requested route must match the current route)
23
+
24
+ return {
25
+ route: currentRoute,
26
+ setRouteParams: presenter.setRouteParams.bind(presenter)
27
+ };
28
+ }
29
+
30
+ //# sourceMappingURL=useRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","autorun","RouterFeature","useFeature","useRoute","route","presenter","currentRoute","setCurrentRoute","vm","setRouteParams","bind"],"sources":["useRoute.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { autorun } from \"mobx\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"~/features/router/Route.js\";\nimport { MatchedRoute } from \"~/features/router/abstractions.js\";\nimport { RouterFeature } from \"~/features/router/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\nexport function useRoute<TParams extends RouteParamsDefinition | undefined = undefined>(\n // oxlint-disable-next-line typescript/no-unused-vars\n route?: Route<TParams>\n) {\n const { presenter } = useFeature(RouterFeature);\n const [currentRoute, setCurrentRoute] = useState<MatchedRoute | undefined>(\n presenter.vm.currentRoute\n );\n\n useEffect(() => {\n autorun(() => {\n const route = presenter.vm.currentRoute;\n\n if (!route) {\n return;\n }\n\n setCurrentRoute(route);\n });\n }, []);\n\n // TODO: add validation (the requested route must match the current route)\n\n return {\n route: currentRoute as MatchedRoute<\n TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n >,\n setRouteParams: presenter.setRouteParams.bind(presenter)\n };\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,OAAO,QAAQ,MAAM;AAG9B,SAASC,aAAa;AACtB,SAASC,UAAU;AAEnB,OAAO,SAASC,QAAQA;AACpB;AACAC,KAAsB,EACxB;EACE,MAAM;IAAEC;EAAU,CAAC,GAAGH,UAAU,CAACD,aAAa,CAAC;EAC/C,MAAM,CAACK,YAAY,EAAEC,eAAe,CAAC,GAAGR,QAAQ,CAC5CM,SAAS,CAACG,EAAE,CAACF,YACjB,CAAC;EAEDR,SAAS,CAAC,MAAM;IACZE,OAAO,CAAC,MAAM;MACV,MAAMI,KAAK,GAAGC,SAAS,CAACG,EAAE,CAACF,YAAY;MAEvC,IAAI,CAACF,KAAK,EAAE;QACR;MACJ;MAEAG,eAAe,CAACH,KAAK,CAAC;IAC1B,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;;EAEN;;EAEA,OAAO;IACHA,KAAK,EAAEE,YAEN;IACDG,cAAc,EAAEJ,SAAS,CAACI,cAAc,CAACC,IAAI,CAACL,SAAS;EAC3D,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { type ReactRoute } from "../../../presentation/router/index.js";
2
+ export declare const useRouter: () => {
3
+ goToRoute: <TParams extends import("../../../features/router/Route").RouteParamsDefinition | undefined>(route: import("../../..").Route<TParams>, ...args: import("../../../features/router/abstractions").RouteParamsArgs<TParams>) => void;
4
+ getLink: <TParams extends import("../../../features/router/Route").RouteParamsDefinition | undefined>(route: import("../../..").Route<TParams>, ...args: import("../../../features/router/abstractions").RouteParamsArgs<TParams>) => string;
5
+ addTransitionGuard: (config: import("../../../features/router").RouteTransitionGuardConfig) => import("../../../features/router").GuardDisposer;
6
+ isTransitionBlocked: () => boolean;
7
+ unblockTransition: () => void;
8
+ confirmTransition: () => void;
9
+ cancelTransition: () => void;
10
+ setRoutes: (routes: ReactRoute[]) => void;
11
+ };
@@ -0,0 +1,30 @@
1
+ import { RouteElementRegistry } from "../index.js";
2
+ import { RouterFeature } from "../../../features/router/feature.js";
3
+ import { useFeature } from "../../../shared/di/useFeature.js";
4
+ import { useContainer } from "../../../shared/di/DiContainerProvider.js";
5
+ export const useRouter = () => {
6
+ const {
7
+ presenter
8
+ } = useFeature(RouterFeature);
9
+ const container = useContainer();
10
+ const registry = container.resolve(RouteElementRegistry);
11
+ return {
12
+ goToRoute: presenter.goToRoute.bind(presenter),
13
+ getLink: presenter.getLink.bind(presenter),
14
+ addTransitionGuard: presenter.addTransitionGuard.bind(presenter),
15
+ isTransitionBlocked: presenter.isTransitionBlocked.bind(presenter),
16
+ unblockTransition: presenter.unblockTransition.bind(presenter),
17
+ confirmTransition: presenter.confirmTransition.bind(presenter),
18
+ cancelTransition: presenter.cancelTransition.bind(presenter),
19
+ setRoutes: routes => {
20
+ const cleanRoutes = [];
21
+ for (const route of routes) {
22
+ cleanRoutes.push(route.route);
23
+ registry.register(route.route.name, route.element);
24
+ }
25
+ presenter.bootstrap(cleanRoutes);
26
+ }
27
+ };
28
+ };
29
+
30
+ //# sourceMappingURL=useRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RouteElementRegistry","RouterFeature","useFeature","useContainer","useRouter","presenter","container","registry","resolve","goToRoute","bind","getLink","addTransitionGuard","isTransitionBlocked","unblockTransition","confirmTransition","cancelTransition","setRoutes","routes","cleanRoutes","route","push","register","name","element","bootstrap"],"sources":["useRouter.ts"],"sourcesContent":["import { type ReactRoute, RouteElementRegistry } from \"~/presentation/router/index.js\";\nimport { RouterFeature } from \"~/features/router/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\nimport { useContainer } from \"~/shared/di/DiContainerProvider.js\";\n\nexport const useRouter = () => {\n const { presenter } = useFeature(RouterFeature);\n const container = useContainer();\n const registry = container.resolve(RouteElementRegistry);\n\n return {\n goToRoute: presenter.goToRoute.bind(presenter),\n getLink: presenter.getLink.bind(presenter),\n addTransitionGuard: presenter.addTransitionGuard.bind(presenter),\n isTransitionBlocked: presenter.isTransitionBlocked.bind(presenter),\n unblockTransition: presenter.unblockTransition.bind(presenter),\n confirmTransition: presenter.confirmTransition.bind(presenter),\n cancelTransition: presenter.cancelTransition.bind(presenter),\n setRoutes: (routes: ReactRoute[]) => {\n const cleanRoutes = [];\n\n for (const route of routes) {\n cleanRoutes.push(route.route);\n registry.register(route.route.name, route.element);\n }\n\n presenter.bootstrap(cleanRoutes);\n }\n };\n};\n"],"mappings":"AAAA,SAA0BA,oBAAoB;AAC9C,SAASC,aAAa;AACtB,SAASC,UAAU;AACnB,SAASC,YAAY;AAErB,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC3B,MAAM;IAAEC;EAAU,CAAC,GAAGH,UAAU,CAACD,aAAa,CAAC;EAC/C,MAAMK,SAAS,GAAGH,YAAY,CAAC,CAAC;EAChC,MAAMI,QAAQ,GAAGD,SAAS,CAACE,OAAO,CAACR,oBAAoB,CAAC;EAExD,OAAO;IACHS,SAAS,EAAEJ,SAAS,CAACI,SAAS,CAACC,IAAI,CAACL,SAAS,CAAC;IAC9CM,OAAO,EAAEN,SAAS,CAACM,OAAO,CAACD,IAAI,CAACL,SAAS,CAAC;IAC1CO,kBAAkB,EAAEP,SAAS,CAACO,kBAAkB,CAACF,IAAI,CAACL,SAAS,CAAC;IAChEQ,mBAAmB,EAAER,SAAS,CAACQ,mBAAmB,CAACH,IAAI,CAACL,SAAS,CAAC;IAClES,iBAAiB,EAAET,SAAS,CAACS,iBAAiB,CAACJ,IAAI,CAACL,SAAS,CAAC;IAC9DU,iBAAiB,EAAEV,SAAS,CAACU,iBAAiB,CAACL,IAAI,CAACL,SAAS,CAAC;IAC9DW,gBAAgB,EAAEX,SAAS,CAACW,gBAAgB,CAACN,IAAI,CAACL,SAAS,CAAC;IAC5DY,SAAS,EAAGC,MAAoB,IAAK;MACjC,MAAMC,WAAW,GAAG,EAAE;MAEtB,KAAK,MAAMC,KAAK,IAAIF,MAAM,EAAE;QACxBC,WAAW,CAACE,IAAI,CAACD,KAAK,CAACA,KAAK,CAAC;QAC7Bb,QAAQ,CAACe,QAAQ,CAACF,KAAK,CAACA,KAAK,CAACG,IAAI,EAAEH,KAAK,CAACI,OAAO,CAAC;MACtD;MAEAnB,SAAS,CAACoB,SAAS,CAACN,WAAW,CAAC;IACpC;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export { useRouter } from "./hooks/useRouter.js";
2
+ export { useRoute } from "./hooks/useRoute.js";
3
+ export { RouteElementRegistry } from "./abstractions.js";
4
+ export type { ReactRoute } from "./types.js";
@@ -0,0 +1,5 @@
1
+ export { useRouter } from "./hooks/useRouter.js";
2
+ export { useRoute } from "./hooks/useRoute.js";
3
+ export { RouteElementRegistry } from "./abstractions.js";
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRouter","useRoute","RouteElementRegistry"],"sources":["index.ts"],"sourcesContent":["export { useRouter } from \"./hooks/useRouter.js\";\nexport { useRoute } from \"./hooks/useRoute.js\";\nexport { RouteElementRegistry } from \"./abstractions.js\";\nexport type { ReactRoute } from \"./types.js\";\n"],"mappings":"AAAA,SAASA,SAAS;AAClB,SAASC,QAAQ;AACjB,SAASC,oBAAoB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import type { Route } from "../../features/router/Route.js";
2
+ export type ReactRoute = {
3
+ route: Route<any>;
4
+ element: React.JSX.Element;
5
+ };
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { Route } from \"~/features/router/Route.js\";\n\nexport type ReactRoute = {\n route: Route<any>;\n element: React.JSX.Element;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import bytes from "bytes";
3
- import minimatch from "minimatch";
4
- import { readFileContent } from "./utils/readFileContent";
5
- import { generateId } from "./utils/generateId";
3
+ import { minimatch } from "minimatch";
4
+ import { readFileContent } from "./utils/readFileContent.js";
5
+ import { generateId } from "./utils/generateId.js";
6
6
  export class Files extends React.Component {
7
7
  static defaultProps = {
8
8
  accept: [],