@webiny/app 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9

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 (389) hide show
  1. package/App.d.ts +25 -0
  2. package/App.js +82 -0
  3. package/App.js.map +1 -0
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +6 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -77
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -0
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
  14. package/components/Image.d.ts +2 -3
  15. package/components/Image.js +15 -41
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -21
  19. package/config/RouterConfig/Route.d.ts +29 -0
  20. package/config/RouterConfig/Route.js +28 -0
  21. package/config/RouterConfig/Route.js.map +1 -0
  22. package/config/RouterConfig.d.ts +31 -0
  23. package/config/RouterConfig.js +19 -0
  24. package/config/RouterConfig.js.map +1 -0
  25. package/config.d.ts +1 -1
  26. package/config.js +20 -29
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.d.ts +4 -8
  29. package/contexts/Ui/index.js +27 -89
  30. package/contexts/Ui/index.js.map +1 -1
  31. package/core/Plugin.d.ts +8 -0
  32. package/core/Plugin.js +12 -0
  33. package/core/Plugin.js.map +1 -0
  34. package/core/Plugins.d.ts +15 -0
  35. package/core/Plugins.js +21 -0
  36. package/core/Plugins.js.map +1 -0
  37. package/core/Provider.d.ts +8 -0
  38. package/core/Provider.js +10 -0
  39. package/core/Provider.js.map +1 -0
  40. package/core/createProvider.d.ts +10 -0
  41. package/core/createProvider.js +6 -0
  42. package/core/createProvider.js.map +1 -0
  43. package/core/createProviderPlugin.d.ts +8 -0
  44. package/core/createProviderPlugin.js +12 -0
  45. package/core/createProviderPlugin.js.map +1 -0
  46. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  47. package/errors/AuthenticationErrorEvent.js +13 -0
  48. package/errors/AuthenticationErrorEvent.js.map +1 -0
  49. package/errors/NetworkErrorEvent.d.ts +15 -0
  50. package/errors/NetworkErrorEvent.js +13 -0
  51. package/errors/NetworkErrorEvent.js.map +1 -0
  52. package/errors/abstractions.d.ts +12 -0
  53. package/errors/abstractions.js +6 -0
  54. package/errors/abstractions.js.map +1 -0
  55. package/errors/index.d.ts +6 -0
  56. package/errors/index.js +3 -0
  57. package/exports/admin/env-config.d.ts +2 -0
  58. package/exports/admin/env-config.js +2 -0
  59. package/exports/admin/graphql-client.d.ts +1 -0
  60. package/exports/admin/graphql-client.js +1 -0
  61. package/exports/admin/local-storage.d.ts +2 -0
  62. package/exports/admin/local-storage.js +2 -0
  63. package/exports/admin/router.d.ts +5 -0
  64. package/exports/admin/router.js +5 -0
  65. package/exports/admin/security.d.ts +1 -0
  66. package/exports/admin/security.js +1 -0
  67. package/exports/admin.d.ts +7 -0
  68. package/exports/admin.js +7 -0
  69. package/features/envConfig/EnvConfig.d.ts +7 -0
  70. package/features/envConfig/EnvConfig.js +16 -0
  71. package/features/envConfig/EnvConfig.js.map +1 -0
  72. package/features/envConfig/abstractions.d.ts +28 -0
  73. package/features/envConfig/abstractions.js +5 -0
  74. package/features/envConfig/abstractions.js.map +1 -0
  75. package/features/envConfig/feature.d.ts +17 -0
  76. package/features/envConfig/feature.js +15 -0
  77. package/features/envConfig/feature.js.map +1 -0
  78. package/features/envConfig/index.d.ts +1 -0
  79. package/features/envConfig/index.js +1 -0
  80. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  81. package/features/eventPublisher/EventPublisher.js +19 -0
  82. package/features/eventPublisher/EventPublisher.js.map +1 -0
  83. package/features/eventPublisher/abstractions.d.ts +18 -0
  84. package/features/eventPublisher/abstractions.js +12 -0
  85. package/features/eventPublisher/abstractions.js.map +1 -0
  86. package/features/eventPublisher/feature.d.ts +3 -0
  87. package/features/eventPublisher/feature.js +17 -0
  88. package/features/eventPublisher/feature.js.map +1 -0
  89. package/features/eventPublisher/index.d.ts +3 -0
  90. package/features/eventPublisher/index.js +2 -0
  91. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  92. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  93. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  94. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  95. package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
  96. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  97. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  98. package/features/graphqlClient/FetchGraphQLClient.js +51 -0
  99. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  100. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  101. package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
  102. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  103. package/features/graphqlClient/RequestValue.d.ts +21 -0
  104. package/features/graphqlClient/RequestValue.js +46 -0
  105. package/features/graphqlClient/RequestValue.js.map +1 -0
  106. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  107. package/features/graphqlClient/RetryGraphQLClient.js +45 -0
  108. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  109. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  110. package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
  111. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  112. package/features/graphqlClient/abstractions.d.ts +18 -0
  113. package/features/graphqlClient/abstractions.js +5 -0
  114. package/features/graphqlClient/abstractions.js.map +1 -0
  115. package/features/graphqlClient/feature.d.ts +6 -0
  116. package/features/graphqlClient/feature.js +25 -0
  117. package/features/graphqlClient/feature.js.map +1 -0
  118. package/features/graphqlClient/index.d.ts +1 -0
  119. package/features/graphqlClient/index.js +1 -0
  120. package/features/graphqlClient/types.d.ts +5 -0
  121. package/features/graphqlClient/types.js +0 -0
  122. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  123. package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
  124. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  125. package/features/localStorage/LocalStorage.d.ts +12 -0
  126. package/features/localStorage/LocalStorage.js +34 -0
  127. package/features/localStorage/LocalStorage.js.map +1 -0
  128. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  129. package/features/localStorage/LocalStorageRepository.js +82 -0
  130. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  131. package/features/localStorage/abstractions.d.ts +48 -0
  132. package/features/localStorage/abstractions.js +8 -0
  133. package/features/localStorage/abstractions.js.map +1 -0
  134. package/features/localStorage/feature.d.ts +12 -0
  135. package/features/localStorage/feature.js +23 -0
  136. package/features/localStorage/feature.js.map +1 -0
  137. package/features/localStorage/index.d.ts +1 -0
  138. package/features/localStorage/index.js +1 -0
  139. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  140. package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
  141. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  142. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  143. package/features/mainGraphQLClient/abstractions.js +5 -0
  144. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  145. package/features/mainGraphQLClient/feature.d.ts +3 -0
  146. package/features/mainGraphQLClient/feature.js +17 -0
  147. package/features/mainGraphQLClient/feature.js.map +1 -0
  148. package/features/mainGraphQLClient/index.d.ts +1 -0
  149. package/features/mainGraphQLClient/index.js +1 -0
  150. package/features/router/HistoryRouterGateway.d.ts +22 -0
  151. package/features/router/HistoryRouterGateway.js +88 -0
  152. package/features/router/HistoryRouterGateway.js.map +1 -0
  153. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  154. package/features/router/HistoryRouterGateway.test.js +195 -0
  155. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  156. package/features/router/Route.d.ts +19 -0
  157. package/features/router/Route.js +43 -0
  158. package/features/router/Route.js.map +1 -0
  159. package/features/router/RouteUrl.d.ts +85 -0
  160. package/features/router/RouteUrl.js +99 -0
  161. package/features/router/RouteUrl.js.map +1 -0
  162. package/features/router/Router.d.ts +45 -0
  163. package/features/router/Router.js +72 -0
  164. package/features/router/Router.js.map +1 -0
  165. package/features/router/RouterPresenter.d.ts +21 -0
  166. package/features/router/RouterPresenter.js +52 -0
  167. package/features/router/RouterPresenter.js.map +1 -0
  168. package/features/router/RouterRepository.d.ts +30 -0
  169. package/features/router/RouterRepository.js +117 -0
  170. package/features/router/RouterRepository.js.map +1 -0
  171. package/features/router/RouterRepository.test.d.ts +1 -0
  172. package/features/router/RouterRepository.test.js +138 -0
  173. package/features/router/RouterRepository.test.js.map +1 -0
  174. package/features/router/abstractions.d.ts +81 -0
  175. package/features/router/abstractions.js +7 -0
  176. package/features/router/abstractions.js.map +1 -0
  177. package/features/router/feature.d.ts +4 -0
  178. package/features/router/feature.js +19 -0
  179. package/features/router/feature.js.map +1 -0
  180. package/features/router/index.d.ts +2 -0
  181. package/features/router/index.js +1 -0
  182. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  183. package/helpers/InterfaceGenerator/date.js +0 -0
  184. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  185. package/helpers/InterfaceGenerator/id.js +0 -0
  186. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  187. package/helpers/InterfaceGenerator/identity.js +0 -0
  188. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  189. package/helpers/InterfaceGenerator/index.js +0 -0
  190. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  191. package/helpers/InterfaceGenerator/numeric.js +0 -0
  192. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  193. package/helpers/InterfaceGenerator/truthful.js +0 -0
  194. package/hooks/useAutocomplete/index.d.ts +1 -1
  195. package/hooks/useAutocomplete/index.js +1 -13
  196. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  197. package/hooks/useAutocomplete/useAutocomplete.js +15 -36
  198. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  199. package/hooks/useDataList/functions/getData.js +4 -15
  200. package/hooks/useDataList/functions/getData.js.map +1 -1
  201. package/hooks/useDataList/functions/getError.js +4 -15
  202. package/hooks/useDataList/functions/getError.js.map +1 -1
  203. package/hooks/useDataList/functions/getMeta.js +4 -15
  204. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  205. package/hooks/useDataList/functions/index.d.ts +3 -3
  206. package/hooks/useDataList/functions/index.js +3 -31
  207. package/hooks/useDataList/functions/searchDataByKey.js +10 -26
  208. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  209. package/hooks/useDataList/index.d.ts +1 -1
  210. package/hooks/useDataList/index.js +1 -13
  211. package/hooks/useDataList/useDataList.d.ts +2 -3
  212. package/hooks/useDataList/useDataList.js +139 -205
  213. package/hooks/useDataList/useDataList.js.map +1 -1
  214. package/hooks/useDataList/utils/index.d.ts +1 -2
  215. package/hooks/useDataList/utils/index.js +1 -23
  216. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
  217. package/hooks/useDataList/utils/prepareLoadListParams.js +26 -45
  218. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  219. package/hooks/useHandler.js +14 -19
  220. package/hooks/useHandler.js.map +1 -1
  221. package/hooks/useHandlers.d.ts +3 -3
  222. package/hooks/useHandlers.js +19 -28
  223. package/hooks/useHandlers.js.map +1 -1
  224. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  225. package/hooks/useRegisterLegacyPlugin.js +12 -0
  226. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  227. package/hooks/useUi.d.ts +1 -1
  228. package/hooks/useUi.js +5 -15
  229. package/hooks/useUi.js.map +1 -1
  230. package/i18n/i18n.js +11 -21
  231. package/i18n/i18n.js.map +1 -1
  232. package/i18n/index.d.ts +1 -1
  233. package/i18n/index.js +1 -15
  234. package/index.d.ts +25 -4
  235. package/index.js +23 -37
  236. package/package.json +38 -38
  237. package/plugins/AddQuerySelectionPlugin.d.ts +10 -3
  238. package/plugins/AddQuerySelectionPlugin.js +43 -128
  239. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  240. package/plugins/ApolloCacheObjectIdPlugin.js +15 -51
  241. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  242. package/plugins/ApolloDynamicLink.d.ts +3 -2
  243. package/plugins/ApolloDynamicLink.js +24 -78
  244. package/plugins/ApolloDynamicLink.js.map +1 -1
  245. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  246. package/plugins/ApolloLinkPlugin.js +21 -61
  247. package/plugins/ApolloLinkPlugin.js.map +1 -1
  248. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  249. package/plugins/ConsoleLinkPlugin.js +20 -59
  250. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  251. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  252. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +47 -95
  253. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  254. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  255. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +27 -0
  256. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  257. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  258. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +23 -0
  259. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  260. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -5
  261. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -20
  262. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  263. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  264. package/plugins/NetworkErrorLinkPlugin/Typography.js +13 -0
  265. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  266. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
  267. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
  268. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  269. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +13 -36
  270. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  271. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  272. package/plugins/NetworkErrorLinkPlugin.js +51 -63
  273. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  274. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  275. package/plugins/OmitTypenameLinkPlugin.js +12 -51
  276. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  277. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -8
  278. package/plugins/TenantHeaderLinkPlugin.js +25 -82
  279. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  280. package/plugins/components/Image.d.ts +6 -0
  281. package/plugins/components/Image.js +12 -0
  282. package/plugins/components/Image.js.map +1 -0
  283. package/plugins/image.d.ts +1 -1
  284. package/plugins/image.js +97 -175
  285. package/plugins/image.js.map +1 -1
  286. package/plugins/index.d.ts +5 -5
  287. package/plugins/index.js +38 -106
  288. package/plugins/index.js.map +1 -1
  289. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  290. package/presentation/envConfig/useEnvConfig.js +9 -0
  291. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  292. package/presentation/localStorage/index.d.ts +3 -0
  293. package/presentation/localStorage/index.js +3 -0
  294. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  295. package/presentation/localStorage/useLocalStorage.js +15 -0
  296. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  297. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  298. package/presentation/localStorage/useLocalStorageValue.js +22 -0
  299. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  300. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  301. package/presentation/localStorage/useLocalStorageValues.js +32 -0
  302. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  303. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  304. package/presentation/router/RouteElementRegistry.js +29 -0
  305. package/presentation/router/RouteElementRegistry.js.map +1 -0
  306. package/presentation/router/abstractions.d.ts +13 -0
  307. package/presentation/router/abstractions.js +5 -0
  308. package/presentation/router/abstractions.js.map +1 -0
  309. package/presentation/router/components/Redirect.d.ts +14 -0
  310. package/presentation/router/components/Redirect.js +13 -0
  311. package/presentation/router/components/Redirect.js.map +1 -0
  312. package/presentation/router/components/RouteContent.d.ts +2 -0
  313. package/presentation/router/components/RouteContent.js +20 -0
  314. package/presentation/router/components/RouteContent.js.map +1 -0
  315. package/presentation/router/components/RouteLink.d.ts +50 -0
  316. package/presentation/router/components/RouteLink.js +17 -0
  317. package/presentation/router/components/RouteLink.js.map +1 -0
  318. package/presentation/router/components/SimpleLink.d.ts +44 -0
  319. package/presentation/router/components/SimpleLink.js +24 -0
  320. package/presentation/router/components/SimpleLink.js.map +1 -0
  321. package/presentation/router/hooks/useRoute.d.ts +6 -0
  322. package/presentation/router/hooks/useRoute.js +22 -0
  323. package/presentation/router/hooks/useRoute.js.map +1 -0
  324. package/presentation/router/hooks/useRouter.d.ts +11 -0
  325. package/presentation/router/hooks/useRouter.js +29 -0
  326. package/presentation/router/hooks/useRouter.js.map +1 -0
  327. package/presentation/router/index.d.ts +4 -0
  328. package/presentation/router/index.js +3 -0
  329. package/presentation/router/types.d.ts +5 -0
  330. package/presentation/router/types.js +0 -0
  331. package/renderApp.d.ts +2 -0
  332. package/renderApp.js +10 -0
  333. package/renderApp.js.map +1 -0
  334. package/router.d.ts +5 -0
  335. package/router.js +5 -0
  336. package/rslib-runtime.js +14 -0
  337. package/rslib-runtime.js.map +1 -0
  338. package/shared/di/DiContainerProvider.d.ts +8 -0
  339. package/shared/di/DiContainerProvider.js +13 -0
  340. package/shared/di/DiContainerProvider.js.map +1 -0
  341. package/shared/di/createFeature.d.ts +11 -0
  342. package/shared/di/createFeature.js +10 -0
  343. package/shared/di/createFeature.js.map +1 -0
  344. package/shared/di/useFeature.d.ts +2 -0
  345. package/shared/di/useFeature.js +12 -0
  346. package/shared/di/useFeature.js.map +1 -0
  347. package/static/svg/close_24px.33adaadc.svg +1 -0
  348. package/types.d.ts +30 -30
  349. package/types.js +0 -13
  350. package/utils/createGenericContext.d.ts +13 -0
  351. package/utils/createGenericContext.js +21 -0
  352. package/utils/createGenericContext.js.map +1 -0
  353. package/utils/createHashing.d.ts +2 -0
  354. package/utils/createHashing.js +15 -0
  355. package/utils/createHashing.js.map +1 -0
  356. package/utils/index.d.ts +2 -0
  357. package/utils/index.js +2 -0
  358. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  359. package/utils/legacyPluginToReactComponent.js +15 -0
  360. package/utils/legacyPluginToReactComponent.js.map +1 -0
  361. package/components/Routes.d.ts +0 -2
  362. package/components/Routes.js +0 -49
  363. package/components/Routes.js.map +0 -1
  364. package/components/View.d.ts +0 -8
  365. package/components/View.js +0 -41
  366. package/components/View.js.map +0 -1
  367. package/components/index.js.map +0 -1
  368. package/hooks/useAutocomplete/index.js.map +0 -1
  369. package/hooks/useDataList/functions/index.js.map +0 -1
  370. package/hooks/useDataList/index.js.map +0 -1
  371. package/hooks/useDataList/utils/index.js.map +0 -1
  372. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  373. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -31
  374. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  375. package/hooks/useDataList/utils/types.d.ts +0 -34
  376. package/hooks/useDataList/utils/types.js +0 -5
  377. package/hooks/useDataList/utils/types.js.map +0 -1
  378. package/i18n/index.js.map +0 -1
  379. package/index.js.map +0 -1
  380. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -15
  381. package/plugins/LocaleHeaderLinkPlugin.js +0 -77
  382. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  383. package/plugins/RoutePlugin.d.ts +0 -12
  384. package/plugins/RoutePlugin.js +0 -53
  385. package/plugins/RoutePlugin.js.map +0 -1
  386. package/plugins/ViewPlugin.d.ts +0 -14
  387. package/plugins/ViewPlugin.js +0 -58
  388. package/plugins/ViewPlugin.js.map +0 -1
  389. package/types.js.map +0 -1
package/plugins/image.js CHANGED
@@ -1,184 +1,106 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _Image = require("@webiny/ui/Image");
17
-
18
- var _excluded = ["transform", "srcSet"];
19
- var SUPPORTED_IMAGE_RESIZE_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];
20
- /**
21
- * Width of the image should not be just any random number. For optimization reasons,
22
- * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).
23
- */
24
-
25
- var getSupportedImageResizeWidth = function getSupportedImageResizeWidth(width) {
26
- var output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];
27
- var i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;
28
-
29
- while (i >= 0) {
30
- if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
31
- output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
32
- break;
33
- }
34
-
35
- if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
36
- // Use next larger width. If there isn't any, use current.
37
- output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];
38
-
39
- if (!output) {
40
- output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
41
- }
42
-
43
- break;
1
+ import react from "react";
2
+ import { Image } from "./components/Image.js";
3
+ const SUPPORTED_IMAGE_RESIZE_WIDTHS = [
4
+ 128,
5
+ 384,
6
+ 640,
7
+ 750,
8
+ 828,
9
+ 1080,
10
+ 1200,
11
+ 1920,
12
+ 2048,
13
+ 3840
14
+ ];
15
+ const getSupportedImageResizeWidth = (width)=>{
16
+ let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];
17
+ let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;
18
+ while(i >= 0){
19
+ if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
20
+ output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
21
+ break;
22
+ }
23
+ if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
24
+ output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];
25
+ if (!output) output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
26
+ break;
27
+ }
28
+ i--;
44
29
  }
45
-
46
- i--;
47
- }
48
-
49
- return output;
50
- };
51
-
52
- /**
53
- * Currently we only allow "width" as a transform option.
54
- * @param args
55
- */
56
- var sanitizeTransformArgs = function sanitizeTransformArgs(args) {
57
- var output = {};
58
-
59
- if (!args || args.width === undefined || args.width === null) {
60
30
  return output;
61
- }
62
-
63
- var width = parseInt(args.width);
64
-
65
- if (width > 0) {
66
- output.width = getSupportedImageResizeWidth(width);
67
- }
68
-
69
- return output;
70
31
  };
71
-
72
- var getSizes = function getSizes(width) {
73
- if (typeof width !== "string") {
74
- return undefined;
75
- } // Check if width was set as percentage, with "%" in the value.
76
-
77
-
78
- if (width.endsWith("%")) {
79
- return "".concat(parseInt(width), "vw");
80
- } // Check if width was set as viewport width, with "vw" in the value.
81
-
82
-
83
- if (width.endsWith("vw")) {
84
- return "".concat(parseInt(width), "vw");
85
- } // Check if width was set as relative, with "em" in the value.
86
-
87
-
88
- if (width.endsWith("em")) {
89
- return "".concat(parseInt(width), "em");
90
- }
91
-
92
- return undefined;
32
+ const sanitizeTransformArgs = (args)=>{
33
+ const output = {};
34
+ if (!args || void 0 === args.width || null === args.width) return output;
35
+ const width = parseInt(args.width);
36
+ if (width > 0) output.width = getSupportedImageResizeWidth(width);
37
+ return output;
93
38
  };
94
-
95
- var isFixedImageWidth = function isFixedImageWidth(width) {
96
- if (Number.isFinite(width)) {
97
- return true;
98
- }
99
-
100
- if (typeof width === "string" && width.endsWith("px")) {
101
- return true;
102
- }
103
-
104
- return false;
39
+ const getSizes = (width)=>{
40
+ if ("string" != typeof width) return;
41
+ if (width.endsWith("%")) return `${parseInt(width)}vw`;
42
+ if (width.endsWith("vw")) return `${parseInt(width)}vw`;
43
+ if (width.endsWith("em")) return `${parseInt(width)}em`;
105
44
  };
106
-
107
- var getSrcSetAutoSizes = function getSrcSetAutoSizes(max) {
108
- max = isFixedImageWidth(max) ? parseInt("" + max) : 2500;
109
- var maxWidth = getSupportedImageResizeWidth(max);
110
- return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter(function (supportedWidth) {
111
- return supportedWidth <= maxWidth;
112
- });
45
+ const isFixedImageWidth = (width)=>{
46
+ if (Number.isFinite(width)) return true;
47
+ if ("string" == typeof width && width.endsWith("px")) return true;
48
+ return false;
113
49
  };
114
-
115
- var convertTransformToQueryParams = function convertTransformToQueryParams(transform) {
116
- return Object.keys(transform).map(function (key) {
117
- return "".concat(key, "=").concat(transform[key]);
118
- }).join("&");
50
+ const getSrcSetAutoSizes = (max)=>{
51
+ max = isFixedImageWidth(max) ? parseInt("" + max) : 2500;
52
+ const maxWidth = getSupportedImageResizeWidth(max);
53
+ return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth)=>supportedWidth <= maxWidth);
119
54
  };
120
-
121
- var _default = function _default() {
122
- var imagePlugin = {
123
- name: "image-component",
124
- type: "image-component",
125
- presets: {
126
- avatar: {
127
- width: 300
128
- }
129
- },
130
- getImageSrc: function getImageSrc(props) {
131
- if (!props) {
132
- return "";
133
- }
134
-
135
- var src = props.src,
136
- transform = props.transform;
137
-
138
- if (!transform) {
139
- return src;
140
- }
141
-
142
- if (!src || src.startsWith("data:") || src.endsWith("svg")) {
143
- return src;
144
- }
145
-
146
- var sanitizedParams = sanitizeTransformArgs(transform);
147
- var params = convertTransformToQueryParams(sanitizedParams);
148
- return src + "?" + params;
149
- },
150
- render: function render(props) {
151
- var transform = props.transform,
152
- srcSetInitial = props.srcSet,
153
- imageProps = (0, _objectWithoutProperties2.default)(props, _excluded);
154
- var srcSet = srcSetInitial;
155
- var sizes;
156
- var src = imageProps.src;
157
-
158
- if (srcSet && srcSet === "auto") {
159
- srcSet = {}; // Check if image width was forced, and additionally if width was set as pixels, with "px" in the value.
160
-
161
- var forcedWidth = props.width || props.style && props.style.width;
162
- var srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);
163
- srcSetAutoWidths.forEach(function (width) {
164
- srcSet[width + "w"] = imagePlugin.getImageSrc({
165
- src: src,
166
- transform: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, transform), {}, {
167
- width: width
168
- })
169
- });
170
- });
171
- sizes = getSizes(forcedWidth);
172
- }
173
-
174
- return /*#__PURE__*/_react.default.createElement(_Image.Image, Object.assign({}, imageProps, {
175
- srcSet: srcSet,
176
- src: src,
177
- sizes: sizes
178
- }));
179
- }
180
- };
181
- return imagePlugin;
55
+ const convertTransformToQueryParams = (transform)=>Object.keys(transform).map((key)=>`${key}=${transform[key]}`).join("&");
56
+ const plugins_image = ()=>{
57
+ const imagePlugin = {
58
+ name: "image-component",
59
+ type: "image-component",
60
+ presets: {
61
+ avatar: {
62
+ width: 300
63
+ }
64
+ },
65
+ getImageSrc: (props)=>{
66
+ if (!props) return "";
67
+ const { src, transform } = props;
68
+ if (!transform) return src;
69
+ if (!src || src.startsWith("data:") || src.endsWith("svg")) return src;
70
+ const sanitizedParams = sanitizeTransformArgs(transform);
71
+ const params = convertTransformToQueryParams(sanitizedParams);
72
+ return src + "?" + params;
73
+ },
74
+ render (props) {
75
+ const { transform, srcSet: srcSetInitial, ...imageProps } = props;
76
+ let srcSet = srcSetInitial;
77
+ let sizes;
78
+ const src = imageProps.src;
79
+ if (srcSet && "auto" === srcSet) {
80
+ srcSet = {};
81
+ const forcedWidth = props.width || props.style && props.style.width;
82
+ const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);
83
+ srcSetAutoWidths.forEach((width)=>{
84
+ srcSet[width + "w"] = imagePlugin.getImageSrc({
85
+ src,
86
+ transform: {
87
+ ...transform,
88
+ width
89
+ }
90
+ });
91
+ });
92
+ sizes = getSizes(forcedWidth);
93
+ }
94
+ return /*#__PURE__*/ react.createElement(Image, {
95
+ ...imageProps,
96
+ srcSet: srcSet,
97
+ src: src,
98
+ sizes: sizes
99
+ });
100
+ }
101
+ };
102
+ return imagePlugin;
182
103
  };
104
+ export default plugins_image;
183
105
 
184
- exports.default = _default;
106
+ //# sourceMappingURL=image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SUPPORTED_IMAGE_RESIZE_WIDTHS","getSupportedImageResizeWidth","width","output","i","length","sanitizeTransformArgs","args","undefined","parseInt","getSizes","endsWith","isFixedImageWidth","Number","isFinite","getSrcSetAutoSizes","max","maxWidth","filter","supportedWidth","convertTransformToQueryParams","transform","Object","keys","map","key","join","imagePlugin","name","type","presets","avatar","getImageSrc","props","src","startsWith","sanitizedParams","params","render","srcSetInitial","srcSet","imageProps","sizes","forcedWidth","style","srcSetAutoWidths","forEach"],"sources":["image.tsx"],"sourcesContent":["import React from \"react\";\nimport { Image } from \"@webiny/ui/Image\";\nimport { ImageComponentPlugin } from \"~/types\";\n\nconst SUPPORTED_IMAGE_RESIZE_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];\n\n/**\n * Width of the image should not be just any random number. For optimization reasons,\n * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).\n */\nconst getSupportedImageResizeWidth = (width: number) => {\n let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];\n let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;\n while (i >= 0) {\n if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n break;\n }\n\n if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n // Use next larger width. If there isn't any, use current.\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];\n if (!output) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n }\n break;\n }\n\n i--;\n }\n\n return output;\n};\n\ninterface SanitizeTransformArgsParams {\n width?: string;\n}\ninterface SanitizeTransformArgsResult {\n width?: number;\n}\n/**\n * Currently we only allow \"width\" as a transform option.\n * @param args\n */\nconst sanitizeTransformArgs = (args?: SanitizeTransformArgsParams): SanitizeTransformArgsResult => {\n const output: SanitizeTransformArgsResult = {};\n if (!args || args.width === undefined || args.width === null) {\n return output;\n }\n const width = parseInt(args.width);\n if (width > 0) {\n output.width = getSupportedImageResizeWidth(width);\n }\n\n return output;\n};\n\nconst getSizes = (width?: string | number): string | undefined => {\n if (typeof width !== \"string\") {\n return undefined;\n }\n // Check if width was set as percentage, with \"%\" in the value.\n if (width.endsWith(\"%\")) {\n return `${parseInt(width)}vw`;\n }\n // Check if width was set as viewport width, with \"vw\" in the value.\n if (width.endsWith(\"vw\")) {\n return `${parseInt(width)}vw`;\n }\n\n // Check if width was set as relative, with \"em\" in the value.\n if (width.endsWith(\"em\")) {\n return `${parseInt(width)}em`;\n }\n\n return undefined;\n};\n\nconst isFixedImageWidth = (width?: number | string) => {\n if (Number.isFinite(width)) {\n return true;\n }\n\n if (typeof width === \"string\" && width.endsWith(\"px\")) {\n return true;\n }\n return false;\n};\n\nconst getSrcSetAutoSizes = (max?: string | number) => {\n max = isFixedImageWidth(max) ? parseInt(\"\" + max) : 2500;\n const maxWidth = getSupportedImageResizeWidth(max);\n return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth: number) => {\n return supportedWidth <= maxWidth;\n });\n};\n\nconst convertTransformToQueryParams = (transform: Record<string, any>): string => {\n return Object.keys(transform)\n .map(key => `${key}=${transform[key]}`)\n .join(\"&\");\n};\n\nexport default () => {\n const imagePlugin: ImageComponentPlugin = {\n name: \"image-component\",\n type: \"image-component\",\n presets: {\n avatar: { width: 300 }\n },\n getImageSrc: (props?: Record<string, any>) => {\n if (!props) {\n return \"\";\n }\n\n const { src, transform } = props;\n if (!transform) {\n return src;\n }\n\n if (!src || src.startsWith(\"data:\") || src.endsWith(\"svg\")) {\n return src;\n }\n\n const sanitizedParams = sanitizeTransformArgs(transform);\n const params = convertTransformToQueryParams(sanitizedParams);\n return src + \"?\" + params;\n },\n render(props) {\n const { transform, srcSet: srcSetInitial, ...imageProps } = props;\n let srcSet: any = srcSetInitial;\n let sizes: string | undefined;\n const src = imageProps.src;\n if (srcSet && srcSet === \"auto\") {\n srcSet = {};\n\n // Check if image width was forced, and additionally if width was set as pixels, with \"px\" in the value.\n const forcedWidth = props.width || (props.style && props.style.width);\n const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);\n srcSetAutoWidths.forEach(width => {\n srcSet[width + \"w\"] = imagePlugin.getImageSrc({\n src,\n transform: { ...transform, width }\n });\n });\n sizes = getSizes(forcedWidth);\n }\n\n return <Image {...imageProps} srcSet={srcSet} src={src} sizes={sizes} />;\n }\n };\n\n return imagePlugin;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;AAGA,IAAMA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,CAD6B,CAG7B;;QACA,IAAMG,WAAW,GAAGV,KAAK,CAAC/B,KAAN,IAAgB+B,KAAK,CAACW,KAAN,IAAeX,KAAK,CAACW,KAAN,CAAY1C,KAA/D;QACA,IAAM2C,gBAAgB,GAAG9B,kBAAkB,CAAC4B,WAAD,CAA3C;QACAE,gBAAgB,CAACC,OAAjB,CAAyB,UAAA5C,KAAK,EAAI;UAC9BsC,MAAM,CAACtC,KAAK,GAAG,GAAT,CAAN,GAAsByB,WAAW,CAACK,WAAZ,CAAwB;YAC1CE,GAAG,EAAHA,GAD0C;YAE1Cb,SAAS,8DAAOA,SAAP;cAAkBnB,KAAK,EAALA;YAAlB;UAFiC,CAAxB,CAAtB;QAIH,CALD;QAMAwC,KAAK,GAAGhC,QAAQ,CAACiC,WAAD,CAAhB;MACH;;MAED,oBAAO,6BAAC,YAAD,oBAAWF,UAAX;QAAuB,MAAM,EAAED,MAA/B;QAAuC,GAAG,EAAEN,GAA5C;QAAiD,KAAK,EAAEQ;MAAxD,GAAP;IACH;EA7CqC,CAA1C;EAgDA,OAAOf,WAAP;AACH,C"}
1
+ {"version":3,"file":"plugins/image.js","sources":["../../src/plugins/image.tsx"],"sourcesContent":["import React from \"react\";\nimport { Image } from \"./components/Image.js\";\nimport type { ImageComponentPlugin } from \"~/types.js\";\n\nconst SUPPORTED_IMAGE_RESIZE_WIDTHS = [128, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840];\n\n/**\n * Width of the image should not be just any random number. For optimization reasons,\n * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).\n */\nconst getSupportedImageResizeWidth = (width: number) => {\n let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];\n let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;\n while (i >= 0) {\n if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n break;\n }\n\n if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n // Use next larger width. If there isn't any, use current.\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];\n if (!output) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n }\n break;\n }\n\n i--;\n }\n\n return output;\n};\n\ninterface SanitizeTransformArgsParams {\n width?: string;\n}\ninterface SanitizeTransformArgsResult {\n width?: number;\n}\n/**\n * Currently we only allow \"width\" as a transform option.\n * @param args\n */\nconst sanitizeTransformArgs = (args?: SanitizeTransformArgsParams): SanitizeTransformArgsResult => {\n const output: SanitizeTransformArgsResult = {};\n if (!args || args.width === undefined || args.width === null) {\n return output;\n }\n const width = parseInt(args.width);\n if (width > 0) {\n output.width = getSupportedImageResizeWidth(width);\n }\n\n return output;\n};\n\nconst getSizes = (width?: string | number): string | undefined => {\n if (typeof width !== \"string\") {\n return undefined;\n }\n // Check if width was set as percentage, with \"%\" in the value.\n if (width.endsWith(\"%\")) {\n return `${parseInt(width)}vw`;\n }\n // Check if width was set as viewport width, with \"vw\" in the value.\n if (width.endsWith(\"vw\")) {\n return `${parseInt(width)}vw`;\n }\n\n // Check if width was set as relative, with \"em\" in the value.\n if (width.endsWith(\"em\")) {\n return `${parseInt(width)}em`;\n }\n\n return undefined;\n};\n\nconst isFixedImageWidth = (width?: number | string) => {\n if (Number.isFinite(width)) {\n return true;\n }\n\n if (typeof width === \"string\" && width.endsWith(\"px\")) {\n return true;\n }\n return false;\n};\n\nconst getSrcSetAutoSizes = (max?: string | number) => {\n max = isFixedImageWidth(max) ? parseInt(\"\" + max) : 2500;\n const maxWidth = getSupportedImageResizeWidth(max);\n return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth: number) => {\n return supportedWidth <= maxWidth;\n });\n};\n\nconst convertTransformToQueryParams = (transform: Record<string, any>): string => {\n return Object.keys(transform)\n .map(key => `${key}=${transform[key]}`)\n .join(\"&\");\n};\n\nexport default () => {\n const imagePlugin: ImageComponentPlugin = {\n name: \"image-component\",\n type: \"image-component\",\n presets: {\n avatar: { width: 300 }\n },\n getImageSrc: (props?: Record<string, any>) => {\n if (!props) {\n return \"\";\n }\n\n const { src, transform } = props;\n if (!transform) {\n return src;\n }\n\n if (!src || src.startsWith(\"data:\") || src.endsWith(\"svg\")) {\n return src;\n }\n\n const sanitizedParams = sanitizeTransformArgs(transform);\n const params = convertTransformToQueryParams(sanitizedParams);\n return src + \"?\" + params;\n },\n render(props) {\n const { transform, srcSet: srcSetInitial, ...imageProps } = props;\n let srcSet: any = srcSetInitial;\n let sizes: string | undefined;\n const src = imageProps.src;\n if (srcSet && srcSet === \"auto\") {\n srcSet = {};\n\n // Check if image width was forced, and additionally if width was set as pixels, with \"px\" in the value.\n const forcedWidth = props.width || (props.style && props.style.width);\n const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);\n srcSetAutoWidths.forEach(width => {\n srcSet[width + \"w\"] = imagePlugin.getImageSrc({\n src,\n transform: { ...transform, width }\n });\n });\n sizes = getSizes(forcedWidth);\n }\n\n return <Image {...imageProps} srcSet={srcSet} src={src} sizes={sizes} />;\n }\n };\n\n return imagePlugin;\n};\n"],"names":["SUPPORTED_IMAGE_RESIZE_WIDTHS","getSupportedImageResizeWidth","width","output","i","sanitizeTransformArgs","args","undefined","parseInt","getSizes","isFixedImageWidth","Number","getSrcSetAutoSizes","max","maxWidth","supportedWidth","convertTransformToQueryParams","transform","Object","key","imagePlugin","props","src","sanitizedParams","params","srcSetInitial","imageProps","srcSet","sizes","forcedWidth","srcSetAutoWidths","Image"],"mappings":";;AAIA,MAAMA,gCAAgC;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAM;IAAM;IAAM;IAAM;CAAK;AAM7F,MAAMC,+BAA+B,CAACC;IAClC,IAAIC,SAASH,6BAA6B,CAAC,EAAE;IAC7C,IAAII,IAAIJ,8BAA8B,MAAM;IAC5C,MAAOI,KAAK,EAAG;QACX,IAAIF,UAAUF,6BAA6B,CAACI,EAAE,EAAE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from "./image";
1
+ import type { ReactNode } from "react";
2
+ import type { Plugin } from "@webiny/plugins/types.js";
3
+ import imagePlugin from "./image.js";
4
4
  export { imagePlugin };
5
- declare type RenderPluginOptions<T> = {
5
+ type RenderPluginOptions<T> = {
6
6
  wrapper?: boolean;
7
7
  fn?: string;
8
8
  filter?: (value: T, index: number, array: T[]) => boolean;
@@ -16,5 +16,5 @@ interface RenderPlugins {
16
16
  }
17
17
  export declare const renderPlugin: RenderPlugin;
18
18
  export declare const renderPlugins: RenderPlugins;
19
- declare const _default: (() => import("../types").ImageComponentPlugin)[];
19
+ declare const _default: (() => import("../types.js").ImageComponentPlugin)[];
20
20
  export default _default;
package/plugins/index.js CHANGED
@@ -1,110 +1,42 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- Object.defineProperty(exports, "imagePlugin", {
10
- enumerable: true,
11
- get: function get() {
12
- return _image.default;
13
- }
14
- });
15
- exports.renderPlugins = exports.renderPlugin = void 0;
16
-
17
- var _react = _interopRequireDefault(require("react"));
18
-
19
- var _warning = _interopRequireDefault(require("warning"));
20
-
21
- var _plugins = require("@webiny/plugins");
22
-
23
- var _image = _interopRequireDefault(require("./image"));
24
-
25
- var PluginComponent = function PluginComponent(props) {
26
- return props.children;
27
- };
28
-
29
- var PluginsComponent = function PluginsComponent(props) {
30
- return props.children;
31
- };
32
-
33
- var renderPlugin = function renderPlugin(name) {
34
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
36
- var _options$wrapper = options.wrapper,
37
- wrapper = _options$wrapper === void 0 ? true : _options$wrapper,
38
- _options$fn = options.fn,
39
- fn = _options$fn === void 0 ? "render" : _options$fn;
40
-
41
- var plugin = _plugins.plugins.byName(name);
42
-
43
- (0, _warning.default)(plugin, "No such plugin \"".concat(name, "\""));
44
-
45
- if (!plugin) {
46
- return null;
47
- }
48
-
49
- var content = plugin[fn](params);
50
-
51
- if (content) {
52
- return wrapper ? /*#__PURE__*/_react.default.createElement(PluginComponent, {
53
- key: plugin.name,
54
- name: name,
55
- params: params,
56
- fn: fn
57
- }, content) : /*#__PURE__*/_react.default.cloneElement(content, {
58
- key: plugin.name
1
+ import react from "react";
2
+ import warning from "warning";
3
+ import { plugins } from "@webiny/plugins";
4
+ import image_0 from "./image.js";
5
+ const PluginComponent = (props)=>props.children;
6
+ const PluginsComponent = (props)=>props.children;
7
+ const renderPlugin = (name, params = {}, options = {})=>{
8
+ const { wrapper = true, fn = "render" } = options;
9
+ const plugin = plugins.byName(name);
10
+ warning(plugin, `No such plugin "${name}"`);
11
+ if (!plugin) return null;
12
+ const content = plugin[fn](params);
13
+ if (content) return wrapper ? /*#__PURE__*/ react.createElement(PluginComponent, {
14
+ key: plugin.name,
15
+ name: name,
16
+ params: params,
17
+ fn: fn
18
+ }, content) : /*#__PURE__*/ react.cloneElement(content, {
19
+ key: plugin.name
59
20
  });
60
- }
61
-
62
- return null;
21
+ return null;
63
22
  };
64
-
65
- exports.renderPlugin = renderPlugin;
66
-
67
- var renderPlugins = function renderPlugins(type) {
68
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
69
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
70
- var _options$wrapper2 = options.wrapper,
71
- wrapper = _options$wrapper2 === void 0 ? true : _options$wrapper2,
72
- _options$fn2 = options.fn,
73
- fn = _options$fn2 === void 0 ? "render" : _options$fn2,
74
- _options$filter = options.filter,
75
- filter = _options$filter === void 0 ? function (v) {
76
- return v;
77
- } : _options$filter,
78
- reverse = options.reverse;
79
-
80
- var content = _plugins.plugins.byType(type).filter(function (pl) {
81
- /**
82
- * TODO @ts-refactor Problem with possibility of a different subtype.
83
- */
84
- // @ts-ignore
85
- return filter(pl);
86
- })
87
- /**
88
- * We cast as string because renderPlugin checks for the plugin.name
89
- */
90
- .map(function (plugin) {
91
- return renderPlugin(plugin.name, params, {
92
- wrapper: wrapper,
93
- fn: fn
94
- });
95
- }).filter(Boolean);
96
-
97
- if (reverse) {
98
- content.reverse();
99
- }
100
-
101
- return wrapper ? /*#__PURE__*/_react.default.createElement(PluginsComponent, {
102
- type: type,
103
- params: params,
104
- fn: fn
105
- }, content) : content;
23
+ const renderPlugins = (type, params = {}, options = {})=>{
24
+ const { wrapper = true, fn = "render", filter = (v)=>v, reverse } = options;
25
+ const content = plugins.byType(type).filter((pl)=>filter(pl)).map((plugin)=>renderPlugin(plugin.name, params, {
26
+ wrapper,
27
+ fn
28
+ })).filter(Boolean);
29
+ if (reverse) content.reverse();
30
+ return wrapper ? /*#__PURE__*/ react.createElement(PluginsComponent, {
31
+ type: type,
32
+ params: params,
33
+ fn: fn
34
+ }, content) : content;
106
35
  };
36
+ const src_plugins = [
37
+ image_0
38
+ ];
39
+ export default src_plugins;
40
+ export { image_0 as imagePlugin, renderPlugin, renderPlugins };
107
41
 
108
- exports.renderPlugins = renderPlugins;
109
- var _default = [_image.default];
110
- exports.default = _default;
42
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PluginComponent","props","children","PluginsComponent","renderPlugin","name","params","options","wrapper","fn","plugin","plugins","byName","warning","content","React","cloneElement","key","renderPlugins","type","filter","v","reverse","byType","pl","map","Boolean","imagePlugin"],"sources":["index.tsx"],"sourcesContent":["import React, { ReactNode } from \"react\";\nimport warning from \"warning\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport imagePlugin from \"./image\";\n\nexport { imagePlugin };\n\ntype RenderPluginOptions<T> = {\n wrapper?: boolean;\n fn?: string;\n filter?: (value: T, index: number, array: T[]) => boolean;\n reverse?: boolean;\n};\n\ninterface RenderPlugin {\n <T extends Plugin = Plugin>(name: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface RenderPlugins {\n <T extends Plugin = Plugin>(type: string, params?: any, options?: RenderPluginOptions<T>):\n | ReactNode\n | ReactNode[];\n}\n\ninterface PluginComponentProps {\n name: string;\n params: Record<string, any>;\n fn: string;\n}\nconst PluginComponent: React.FC<PluginComponentProps> = props => {\n return props.children as React.ReactElement;\n};\ninterface PluginsComponentProps {\n type: string;\n params: Record<string, any>;\n fn: string;\n}\nconst PluginsComponent: React.FC<PluginsComponentProps> = props => {\n return props.children as React.ReactElement;\n};\n\nexport const renderPlugin: RenderPlugin = (name, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\" } = options;\n\n const plugin = plugins.byName(name);\n warning(plugin, `No such plugin \"${name}\"`);\n\n if (!plugin) {\n return null;\n }\n\n const content = plugin[fn](params);\n if (content) {\n return wrapper ? (\n <PluginComponent key={plugin.name} name={name} params={params} fn={fn}>\n {content}\n </PluginComponent>\n ) : (\n React.cloneElement(content, { key: plugin.name })\n );\n }\n return null;\n};\n\nexport const renderPlugins: RenderPlugins = (type, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\", filter = v => v, reverse } = options;\n\n const content = plugins\n .byType(type)\n .filter(pl => {\n /**\n * TODO @ts-refactor Problem with possibility of a different subtype.\n */\n // @ts-ignore\n return filter(pl);\n })\n /**\n * We cast as string because renderPlugin checks for the plugin.name\n */\n .map(plugin => renderPlugin(plugin.name as string, params, { wrapper, fn }))\n .filter(Boolean);\n\n if (reverse) {\n content.reverse();\n }\n\n return wrapper ? (\n <PluginsComponent type={type} params={params} fn={fn}>\n {content}\n </PluginsComponent>\n ) : (\n content\n );\n};\n\nexport default [imagePlugin];\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AA4BA,IAAMA,eAA+C,GAAG,SAAlDA,eAAkD,CAAAC,KAAK,EAAI;EAC7D,OAAOA,KAAK,CAACC,QAAb;AACH,CAFD;;AAQA,IAAMC,gBAAiD,GAAG,SAApDA,gBAAoD,CAAAF,KAAK,EA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AAA,IAAuCA,MAAvC,gCAAgD,UAAAC,CAAC;IAAA,OAAIA,CAAJ;EAAA,CAAjD;EAAA,IAAwDC,OAAxD,GAAoEf,OAApE,CAAwDe,OAAxD;;EAEA,IAAMR,OAAO,GAAGH,gBAAA,CACXY,MADW,CACJJ,IADI,EAEXC,MAFW,CAEJ,UAAAI,EAAE,EAAI;IACV;AACZ;AACA;IACY;IACA,OAAOJ,MAAM,CAACI,EAAD,CAAb;EACH,CARW;EASZ;AACR;AACA;EAXoB,CAYXC,GAZW,CAYP,UAAAf,MAAM;IAAA,OAAIN,YAAY,CAACM,MAAM,CAACL,IAAR,EAAwBC,MAAxB,EAAgC;MAAEE,OAAO,EAAPA,OAAF;MAAWC,EAAE,EAAFA;IAAX,CAAhC,CAAhB;EAAA,CAZC,EAaXW,MAbW,CAaJM,OAbI,CAAhB;;EAeA,IAAIJ,OAAJ,EAAa;IACTR,OAAO,CAACQ,OAAR;EACH;;EAED,OAAOd,OAAO,gBACV,6BAAC,gBAAD;IAAkB,IAAI,EAAEW,IAAxB;IAA8B,MAAM,EAAEb,MAAtC;IAA8C,EAAE,EAAEG;EAAlD,GACKK,OADL,CADU,GAKVA,OALJ;AAOH,CA7BM;;;eA+BQ,CAACa,cAAD,C"}
1
+ {"version":3,"file":"plugins/index.js","sources":["../../src/plugins/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\nimport warning from \"warning\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport imagePlugin from \"./image.js\";\n\nexport { imagePlugin };\n\ntype RenderPluginOptions<T> = {\n wrapper?: boolean;\n fn?: string;\n filter?: (value: T, index: number, array: T[]) => boolean;\n reverse?: boolean;\n};\n\ninterface RenderPlugin {\n <T extends Plugin = Plugin>(\n name: string,\n params?: any,\n options?: RenderPluginOptions<T>\n ): ReactNode | ReactNode[];\n}\n\ninterface RenderPlugins {\n <T extends Plugin = Plugin>(\n type: string,\n params?: any,\n options?: RenderPluginOptions<T>\n ): ReactNode | ReactNode[];\n}\n\ninterface PluginComponentProps {\n name: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginComponent = (props: PluginComponentProps) => {\n return props.children as React.ReactElement;\n};\ninterface PluginsComponentProps {\n type: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginsComponent = (props: PluginsComponentProps) => {\n return props.children as React.ReactElement;\n};\n\nexport const renderPlugin: RenderPlugin = (name, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\" } = options;\n\n const plugin = plugins.byName(name);\n warning(plugin, `No such plugin \"${name}\"`);\n\n if (!plugin) {\n return null;\n }\n\n const content = plugin[fn](params);\n if (content) {\n return wrapper ? (\n <PluginComponent key={plugin.name} name={name} params={params} fn={fn}>\n {content}\n </PluginComponent>\n ) : (\n React.cloneElement(content, { key: plugin.name })\n );\n }\n return null;\n};\n\nexport const renderPlugins: RenderPlugins = (type, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\", filter = v => v, reverse } = options;\n\n const content = plugins\n .byType(type)\n .filter(pl => {\n /**\n * TODO @ts-refactor Problem with possibility of a different subtype.\n */\n // @ts-expect-error\n return filter(pl);\n })\n /**\n * We cast as string because renderPlugin checks for the plugin.name\n */\n .map(plugin => renderPlugin(plugin.name as string, params, { wrapper, fn }))\n .filter(Boolean);\n\n if (reverse) {\n content.reverse();\n }\n\n return wrapper ? (\n <PluginsComponent type={type} params={params} fn={fn}>\n {content}\n </PluginsComponent>\n ) : (\n content\n );\n};\n\nexport default [imagePlugin];\n"],"names":["PluginComponent","props","PluginsComponent","renderPlugin","name","params","options","wrapper","fn","plugin","plugins","warning","content","React","renderPlugins","type","filter","v","reverse","pl","Boolean","imagePlugin"],"mappings":";;;;AAsCA,MAAMA,kBAAkB,CAACC,QACdA,MAAM,QAAQ;AAQzB,MAAMC,mBAAmB,CAACD,QACfA,MAAM,QAAQ;AAGlB,MAAME,eAA6B,CAACC,MAAMC,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACtE,MAAM,EAAEC,UAAU,IAAI,EAAEC,KAAK,QAAQ,EAAE,GAAGF;IAE1C,MAAMG,SAASC,QAAQ,MAAM,CAACN;IAC9BO,QAAQF,QAAQ,CAAC,gBAAgB,EAAEL,KAAK,CAAC,CAAC;IAE1C,IAAI,CAACK,QACD,OAAO;IAGX,MAAMG,UAAUH,MAAM,CAACD,GAAG,CAACH;IAC3B,IAAIO,SACA,OAAOL,UAAU,WAAVA,GACH,oBAACP,iBAAeA;QAAC,KAAKS,OAAO,IAAI;QAAE,MAAML;QAAM,QAAQC;QAAQ,IAAIG;OAC9DI,WAAAA,WAAAA,GAGLC,MAAAA,YAAkB,CAACD,SAAS;QAAE,KAAKH,OAAO,IAAI;IAAC;IAGvD,OAAO;AACX;AAEO,MAAMK,gBAA+B,CAACC,MAAMV,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACxE,MAAM,EAAEC,UAAU,IAAI,EAAEC,KAAK,QAAQ,EAAEQ,SAASC,CAAAA,IAAKA,CAAC,EAAEC,OAAO,EAAE,GAAGZ;IAEpE,MAAMM,UAAUF,QAAAA,MACL,CAACK,MACP,MAAM,CAACI,CAAAA,KAKGH,OAAOG,KAKjB,GAAG,CAACV,CAAAA,SAAUN,aAAaM,OAAO,IAAI,EAAYJ,QAAQ;YAAEE;YAASC;QAAG,IACxE,MAAM,CAACY;IAEZ,IAAIF,SACAN,QAAQ,OAAO;IAGnB,OAAOL,UAAU,WAAVA,GACH,oBAACL,kBAAgBA;QAAC,MAAMa;QAAM,QAAQV;QAAQ,IAAIG;OAC7CI,WAGLA;AAER;AAEA,oBAAe;IAACS;CAAY"}
@@ -0,0 +1,6 @@
1
+ import { EnvConfig } from "../../features/envConfig/index.js";
2
+ /**
3
+ * Returns the EnvConfig instance from DI.
4
+ * Useful when you want to access EnvConfig inside components and hooks.
5
+ */
6
+ export declare function useEnvConfig(): EnvConfig.Config;
@@ -0,0 +1,9 @@
1
+ import { useFeature } from "../../shared/di/useFeature.js";
2
+ import { EnvConfigFeature } from "../../features/envConfig/feature.js";
3
+ function useEnvConfig() {
4
+ const envConfig = useFeature(EnvConfigFeature);
5
+ return envConfig.getAll();
6
+ }
7
+ export { useEnvConfig };
8
+
9
+ //# sourceMappingURL=useEnvConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/envConfig/useEnvConfig.js","sources":["../../../src/presentation/envConfig/useEnvConfig.ts"],"sourcesContent":["import { useFeature } from \"~/shared/di/useFeature.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\nimport { EnvConfigFeature } from \"~/features/envConfig/feature.js\";\n\n/**\n * Returns the EnvConfig instance from DI.\n * Useful when you want to access EnvConfig inside components and hooks.\n */\nexport function useEnvConfig(): EnvConfig.Config {\n const envConfig = useFeature(EnvConfigFeature);\n\n return envConfig.getAll();\n}\n"],"names":["useEnvConfig","envConfig","useFeature","EnvConfigFeature"],"mappings":";;AAQO,SAASA;IACZ,MAAMC,YAAYC,WAAWC;IAE7B,OAAOF,UAAU,MAAM;AAC3B"}
@@ -0,0 +1,3 @@
1
+ export { useLocalStorage } from "./useLocalStorage.js";
2
+ export { useLocalStorageValue } from "./useLocalStorageValue.js";
3
+ export { useLocalStorageValues } from "./useLocalStorageValues.js";
@@ -0,0 +1,3 @@
1
+ export { useLocalStorage } from "./useLocalStorage.js";
2
+ export { useLocalStorageValue } from "./useLocalStorageValue.js";
3
+ export { useLocalStorageValues } from "./useLocalStorageValues.js";
@@ -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,15 @@
1
+ import { LocalStorageFeature } from "../../features/localStorage/feature.js";
2
+ import { useFeature } from "../../shared/di/useFeature.js";
3
+ function useLocalStorage() {
4
+ const { localStorageService } = useFeature(LocalStorageFeature);
5
+ return {
6
+ get: localStorageService.get.bind(localStorageService),
7
+ set: localStorageService.set.bind(localStorageService),
8
+ remove: localStorageService.remove.bind(localStorageService),
9
+ clear: localStorageService.clear.bind(localStorageService),
10
+ keys: localStorageService.keys.bind(localStorageService)
11
+ };
12
+ }
13
+ export { useLocalStorage };
14
+
15
+ //# sourceMappingURL=useLocalStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation/localStorage/useLocalStorage.js","sources":["../../../src/presentation/localStorage/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"],"names":["useLocalStorage","localStorageService","useFeature","LocalStorageFeature"],"mappings":";;AAQO,SAASA;IACZ,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,WAAWC;IAE3C,OAAO;QACH,KAAKF,oBAAoB,GAAG,CAAC,IAAI,CAACA;QAClC,KAAKA,oBAAoB,GAAG,CAAC,IAAI,CAACA;QAClC,QAAQA,oBAAoB,MAAM,CAAC,IAAI,CAACA;QACxC,OAAOA,oBAAoB,KAAK,CAAC,IAAI,CAACA;QACtC,MAAMA,oBAAoB,IAAI,CAAC,IAAI,CAACA;IACxC;AACJ"}
@@ -0,0 +1 @@
1
+ export declare function useLocalStorageValue<T = string>(key: string): T | undefined;