@makeswift/runtime 0.14.5 → 0.16.0-canary.0

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 (472) hide show
  1. package/dist/cjs/api/react.js +3 -17
  2. package/dist/cjs/api/react.js.map +1 -1
  3. package/dist/cjs/api/resource-types.js +24 -0
  4. package/dist/cjs/api/resource-types.js.map +1 -0
  5. package/dist/cjs/builder/serialization/control-serialization.js +3 -2
  6. package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
  7. package/dist/cjs/components/builtin/Box/Box.js +1 -0
  8. package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
  9. package/dist/cjs/components/builtin/Box/animations.js +1 -0
  10. package/dist/cjs/components/builtin/Box/animations.js.map +1 -1
  11. package/dist/cjs/components/builtin/Box/register.js +2 -3
  12. package/dist/cjs/components/builtin/Box/register.js.map +1 -1
  13. package/dist/cjs/components/builtin/Button/Button.js.map +1 -1
  14. package/dist/cjs/components/builtin/Button/register.js +15 -15
  15. package/dist/cjs/components/builtin/Button/register.js.map +1 -1
  16. package/dist/cjs/components/builtin/Carousel/Carousel.js +1 -0
  17. package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
  18. package/dist/cjs/components/builtin/Carousel/register.js +2 -3
  19. package/dist/cjs/components/builtin/Carousel/register.js.map +1 -1
  20. package/dist/cjs/components/builtin/Countdown/Countdown.js +1 -0
  21. package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
  22. package/dist/cjs/components/builtin/Countdown/register.js +2 -3
  23. package/dist/cjs/components/builtin/Countdown/register.js.map +1 -1
  24. package/dist/cjs/components/builtin/Divider/register.js +2 -3
  25. package/dist/cjs/components/builtin/Divider/register.js.map +1 -1
  26. package/dist/cjs/components/builtin/Embed/Embed.js +1 -0
  27. package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
  28. package/dist/cjs/components/builtin/Embed/register.js +2 -3
  29. package/dist/cjs/components/builtin/Embed/register.js.map +1 -1
  30. package/dist/cjs/components/builtin/Form/Form.js +3 -2
  31. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  32. package/dist/cjs/components/builtin/Form/context/FormContext.js +1 -0
  33. package/dist/cjs/components/builtin/Form/context/FormContext.js.map +1 -1
  34. package/dist/cjs/components/builtin/Form/register.js +4 -4
  35. package/dist/cjs/components/builtin/Form/register.js.map +1 -1
  36. package/dist/cjs/components/builtin/Image/Image.js +1 -0
  37. package/dist/cjs/components/builtin/Image/Image.js.map +1 -1
  38. package/dist/cjs/components/builtin/Image/register.js +4 -4
  39. package/dist/cjs/components/builtin/Image/register.js.map +1 -1
  40. package/dist/cjs/components/builtin/Navigation/Navigation.js +1 -0
  41. package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
  42. package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  43. package/dist/cjs/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  44. package/dist/cjs/components/builtin/Navigation/register.js +4 -4
  45. package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
  46. package/dist/cjs/components/builtin/Root/register.js +2 -3
  47. package/dist/cjs/components/builtin/Root/register.js.map +1 -1
  48. package/dist/cjs/components/builtin/SocialLinks/register.js +2 -3
  49. package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
  50. package/dist/cjs/components/builtin/Text/register.js +2 -3
  51. package/dist/cjs/components/builtin/Text/register.js.map +1 -1
  52. package/dist/cjs/components/builtin/Video/Video.js +1 -0
  53. package/dist/cjs/components/builtin/Video/Video.js.map +1 -1
  54. package/dist/cjs/components/builtin/Video/register.js +2 -3
  55. package/dist/cjs/components/builtin/Video/register.js.map +1 -1
  56. package/dist/cjs/components/hooks/index.js +3 -1
  57. package/dist/cjs/components/hooks/index.js.map +1 -1
  58. package/dist/cjs/components/hooks/usePageSnippets.js +93 -0
  59. package/dist/cjs/components/hooks/usePageSnippets.js.map +1 -0
  60. package/dist/cjs/components/hooks/usePropControllerLinkData.js +34 -0
  61. package/dist/cjs/components/hooks/usePropControllerLinkData.js.map +1 -0
  62. package/dist/cjs/components/hooks/useRouterLocaleSync.js +49 -0
  63. package/dist/cjs/components/hooks/useRouterLocaleSync.js.map +1 -0
  64. package/dist/cjs/components/page/BodySnippet.js +1 -1
  65. package/dist/cjs/components/page/BodySnippet.js.map +1 -1
  66. package/dist/cjs/components/page/HeadSnippet.js +134 -0
  67. package/dist/cjs/components/page/HeadSnippet.js.map +1 -0
  68. package/dist/cjs/components/page/Page.js +9 -178
  69. package/dist/cjs/components/page/Page.js.map +1 -1
  70. package/dist/cjs/components/page/PageHead.js +109 -0
  71. package/dist/cjs/components/page/PageHead.js.map +1 -0
  72. package/dist/cjs/components/shared/BackgroundsContainer/index.js +1 -0
  73. package/dist/cjs/components/shared/BackgroundsContainer/index.js.map +1 -1
  74. package/dist/cjs/components/shared/Link/index.js +5 -1
  75. package/dist/cjs/components/shared/Link/index.js.map +1 -1
  76. package/dist/cjs/controls/control.js +2 -1
  77. package/dist/cjs/controls/control.js.map +1 -1
  78. package/dist/cjs/controls/rich-text/introspection.js +2 -9
  79. package/dist/cjs/controls/rich-text/introspection.js.map +1 -1
  80. package/dist/cjs/index.js +0 -2
  81. package/dist/cjs/index.js.map +1 -1
  82. package/dist/cjs/next/api-handler/handlers/element-tree.js +17 -8
  83. package/dist/cjs/next/api-handler/handlers/element-tree.js.map +1 -1
  84. package/dist/cjs/next/api-handler/handlers/fonts.js +7 -2
  85. package/dist/cjs/next/api-handler/handlers/fonts.js.map +1 -1
  86. package/dist/cjs/next/api-handler/handlers/manifest.js +20 -8
  87. package/dist/cjs/next/api-handler/handlers/manifest.js.map +1 -1
  88. package/dist/cjs/next/api-handler/handlers/merge-translated-data.js +17 -6
  89. package/dist/cjs/next/api-handler/handlers/merge-translated-data.js.map +1 -1
  90. package/dist/cjs/next/api-handler/handlers/proxy-draft-mode.js +69 -0
  91. package/dist/cjs/next/api-handler/handlers/proxy-draft-mode.js.map +1 -0
  92. package/dist/cjs/next/api-handler/handlers/proxy-preview-mode.js +55 -44
  93. package/dist/cjs/next/api-handler/handlers/proxy-preview-mode.js.map +1 -1
  94. package/dist/cjs/next/api-handler/handlers/revalidate.js +27 -16
  95. package/dist/cjs/next/api-handler/handlers/revalidate.js.map +1 -1
  96. package/dist/cjs/next/api-handler/handlers/translatable-data.js +16 -5
  97. package/dist/cjs/next/api-handler/handlers/translatable-data.js.map +1 -1
  98. package/dist/cjs/next/api-handler/index.js +68 -34
  99. package/dist/cjs/next/api-handler/index.js.map +1 -1
  100. package/dist/cjs/next/client.js +3 -2
  101. package/dist/cjs/next/client.js.map +1 -1
  102. package/dist/cjs/next/components/head-tags.js +77 -0
  103. package/dist/cjs/next/components/head-tags.js.map +1 -0
  104. package/dist/cjs/next/components/page.js +56 -0
  105. package/dist/cjs/next/components/page.js.map +1 -0
  106. package/dist/cjs/next/context/makeswift-host-api-client.js +46 -0
  107. package/dist/cjs/next/context/makeswift-host-api-client.js.map +1 -0
  108. package/dist/cjs/next/context/react-runtime.js +44 -0
  109. package/dist/cjs/next/context/react-runtime.js.map +1 -0
  110. package/dist/cjs/next/draft-mode/draft-mode-script.js +123 -0
  111. package/dist/cjs/next/draft-mode/draft-mode-script.js.map +1 -0
  112. package/dist/cjs/next/draft-mode/index.js +56 -0
  113. package/dist/cjs/next/draft-mode/index.js.map +1 -0
  114. package/dist/cjs/next/hooks/use-is-pages-router.js +37 -0
  115. package/dist/cjs/next/hooks/use-is-pages-router.js.map +1 -0
  116. package/dist/cjs/next/index.js +10 -36
  117. package/dist/cjs/next/index.js.map +1 -1
  118. package/dist/cjs/next/preview-mode.js +4 -2
  119. package/dist/cjs/next/preview-mode.js.map +1 -1
  120. package/dist/cjs/next/root-style-registry.js +90 -0
  121. package/dist/cjs/next/root-style-registry.js.map +1 -0
  122. package/dist/cjs/next/server.js +8 -2
  123. package/dist/cjs/next/server.js.map +1 -1
  124. package/dist/cjs/prop-controllers/copy/navigation-links.js +2 -2
  125. package/dist/cjs/prop-controllers/copy/navigation-links.js.map +1 -1
  126. package/dist/cjs/prop-controllers/copy.js +4 -3
  127. package/dist/cjs/prop-controllers/copy.js.map +1 -1
  128. package/dist/cjs/prop-controllers/descriptors.js +0 -6
  129. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  130. package/dist/cjs/prop-controllers/index.js.map +1 -1
  131. package/dist/cjs/prop-controllers/introspection.js +3 -10
  132. package/dist/cjs/prop-controllers/introspection.js.map +1 -1
  133. package/dist/cjs/runtimes/react/components/Element.js +1 -0
  134. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  135. package/dist/cjs/runtimes/react/components/LiveProvider.js +6 -13
  136. package/dist/cjs/runtimes/react/components/LiveProvider.js.map +1 -1
  137. package/dist/cjs/runtimes/react/components/PreviewProvider.js +6 -8
  138. package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +1 -1
  139. package/dist/cjs/runtimes/react/components/RuntimeProvider.js +3 -3
  140. package/dist/cjs/runtimes/react/components/RuntimeProvider.js.map +1 -1
  141. package/dist/cjs/runtimes/react/controls/link.js +1 -1
  142. package/dist/cjs/runtimes/react/controls/link.js.map +1 -1
  143. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -4
  144. package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  145. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js +4 -11
  146. package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  147. package/dist/cjs/runtimes/react/controls.js +11 -0
  148. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  149. package/dist/cjs/runtimes/react/hooks/makeswift-api.js +11 -10
  150. package/dist/cjs/runtimes/react/hooks/makeswift-api.js.map +1 -1
  151. package/dist/cjs/runtimes/react/hooks/use-document-key.js +1 -0
  152. package/dist/cjs/runtimes/react/hooks/use-document-key.js.map +1 -1
  153. package/dist/cjs/runtimes/react/hooks/use-page-id.js +1 -0
  154. package/dist/cjs/runtimes/react/hooks/use-page-id.js.map +1 -1
  155. package/dist/cjs/runtimes/react/hooks/use-store.js +1 -0
  156. package/dist/cjs/runtimes/react/hooks/use-store.js.map +1 -1
  157. package/dist/cjs/runtimes/react/use-global-style.js +15 -10
  158. package/dist/cjs/runtimes/react/use-global-style.js.map +1 -1
  159. package/dist/cjs/runtimes/react/use-style.js +7 -6
  160. package/dist/cjs/runtimes/react/use-style.js.map +1 -1
  161. package/dist/cjs/state/actions.js +0 -25
  162. package/dist/cjs/state/actions.js.map +1 -1
  163. package/dist/cjs/state/react-builder-preview.js +1 -24
  164. package/dist/cjs/state/react-builder-preview.js.map +1 -1
  165. package/dist/esm/api/react.js +2 -14
  166. package/dist/esm/api/react.js.map +1 -1
  167. package/dist/esm/api/resource-types.js +8 -0
  168. package/dist/esm/api/resource-types.js.map +1 -0
  169. package/dist/esm/builder/serialization/control-serialization.js +5 -2
  170. package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
  171. package/dist/esm/components/builtin/Box/Box.js +1 -0
  172. package/dist/esm/components/builtin/Box/Box.js.map +1 -1
  173. package/dist/esm/components/builtin/Box/animations.js +1 -0
  174. package/dist/esm/components/builtin/Box/animations.js.map +1 -1
  175. package/dist/esm/components/builtin/Box/register.js +2 -3
  176. package/dist/esm/components/builtin/Box/register.js.map +1 -1
  177. package/dist/esm/components/builtin/Button/Button.js.map +1 -1
  178. package/dist/esm/components/builtin/Button/register.js +4 -4
  179. package/dist/esm/components/builtin/Button/register.js.map +1 -1
  180. package/dist/esm/components/builtin/Carousel/Carousel.js +1 -0
  181. package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
  182. package/dist/esm/components/builtin/Carousel/register.js +2 -3
  183. package/dist/esm/components/builtin/Carousel/register.js.map +1 -1
  184. package/dist/esm/components/builtin/Countdown/Countdown.js +1 -0
  185. package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
  186. package/dist/esm/components/builtin/Countdown/register.js +2 -3
  187. package/dist/esm/components/builtin/Countdown/register.js.map +1 -1
  188. package/dist/esm/components/builtin/Divider/register.js +2 -3
  189. package/dist/esm/components/builtin/Divider/register.js.map +1 -1
  190. package/dist/esm/components/builtin/Embed/Embed.js +1 -0
  191. package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
  192. package/dist/esm/components/builtin/Embed/register.js +2 -3
  193. package/dist/esm/components/builtin/Embed/register.js.map +1 -1
  194. package/dist/esm/components/builtin/Form/Form.js +3 -2
  195. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  196. package/dist/esm/components/builtin/Form/context/FormContext.js +1 -0
  197. package/dist/esm/components/builtin/Form/context/FormContext.js.map +1 -1
  198. package/dist/esm/components/builtin/Form/register.js +4 -4
  199. package/dist/esm/components/builtin/Form/register.js.map +1 -1
  200. package/dist/esm/components/builtin/Image/Image.js +1 -0
  201. package/dist/esm/components/builtin/Image/Image.js.map +1 -1
  202. package/dist/esm/components/builtin/Image/register.js +4 -4
  203. package/dist/esm/components/builtin/Image/register.js.map +1 -1
  204. package/dist/esm/components/builtin/Navigation/Navigation.js +1 -0
  205. package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
  206. package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  207. package/dist/esm/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  208. package/dist/esm/components/builtin/Navigation/register.js +4 -4
  209. package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
  210. package/dist/esm/components/builtin/Root/register.js +2 -3
  211. package/dist/esm/components/builtin/Root/register.js.map +1 -1
  212. package/dist/esm/components/builtin/SocialLinks/register.js +2 -3
  213. package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
  214. package/dist/esm/components/builtin/Text/register.js +2 -3
  215. package/dist/esm/components/builtin/Text/register.js.map +1 -1
  216. package/dist/esm/components/builtin/Video/Video.js +1 -0
  217. package/dist/esm/components/builtin/Video/Video.js.map +1 -1
  218. package/dist/esm/components/builtin/Video/register.js +2 -3
  219. package/dist/esm/components/builtin/Video/register.js.map +1 -1
  220. package/dist/esm/components/hooks/index.js +1 -0
  221. package/dist/esm/components/hooks/index.js.map +1 -1
  222. package/dist/esm/components/hooks/usePageSnippets.js +59 -0
  223. package/dist/esm/components/hooks/usePageSnippets.js.map +1 -0
  224. package/dist/esm/components/hooks/usePropControllerLinkData.js +12 -0
  225. package/dist/esm/components/hooks/usePropControllerLinkData.js.map +1 -0
  226. package/dist/esm/components/hooks/useRouterLocaleSync.js +25 -0
  227. package/dist/esm/components/hooks/useRouterLocaleSync.js.map +1 -0
  228. package/dist/esm/components/page/BodySnippet.js +1 -1
  229. package/dist/esm/components/page/BodySnippet.js.map +1 -1
  230. package/dist/esm/components/page/HeadSnippet.js +100 -0
  231. package/dist/esm/components/page/HeadSnippet.js.map +1 -0
  232. package/dist/esm/components/page/Page.js +7 -166
  233. package/dist/esm/components/page/Page.js.map +1 -1
  234. package/dist/esm/components/page/PageHead.js +85 -0
  235. package/dist/esm/components/page/PageHead.js.map +1 -0
  236. package/dist/esm/components/shared/BackgroundsContainer/index.js +1 -0
  237. package/dist/esm/components/shared/BackgroundsContainer/index.js.map +1 -1
  238. package/dist/esm/components/shared/Link/index.js +5 -1
  239. package/dist/esm/components/shared/Link/index.js.map +1 -1
  240. package/dist/esm/controls/control.js +2 -1
  241. package/dist/esm/controls/control.js.map +1 -1
  242. package/dist/esm/controls/rich-text/introspection.js +2 -9
  243. package/dist/esm/controls/rich-text/introspection.js.map +1 -1
  244. package/dist/esm/index.js +0 -2
  245. package/dist/esm/index.js.map +1 -1
  246. package/dist/esm/next/api-handler/handlers/element-tree.js +17 -8
  247. package/dist/esm/next/api-handler/handlers/element-tree.js.map +1 -1
  248. package/dist/esm/next/api-handler/handlers/fonts.js +7 -2
  249. package/dist/esm/next/api-handler/handlers/fonts.js.map +1 -1
  250. package/dist/esm/next/api-handler/handlers/manifest.js +20 -8
  251. package/dist/esm/next/api-handler/handlers/manifest.js.map +1 -1
  252. package/dist/esm/next/api-handler/handlers/merge-translated-data.js +17 -6
  253. package/dist/esm/next/api-handler/handlers/merge-translated-data.js.map +1 -1
  254. package/dist/esm/next/api-handler/handlers/proxy-draft-mode.js +49 -0
  255. package/dist/esm/next/api-handler/handlers/proxy-draft-mode.js.map +1 -0
  256. package/dist/esm/next/api-handler/handlers/proxy-preview-mode.js +55 -44
  257. package/dist/esm/next/api-handler/handlers/proxy-preview-mode.js.map +1 -1
  258. package/dist/esm/next/api-handler/handlers/revalidate.js +27 -16
  259. package/dist/esm/next/api-handler/handlers/revalidate.js.map +1 -1
  260. package/dist/esm/next/api-handler/handlers/translatable-data.js +16 -5
  261. package/dist/esm/next/api-handler/handlers/translatable-data.js.map +1 -1
  262. package/dist/esm/next/api-handler/index.js +68 -34
  263. package/dist/esm/next/api-handler/index.js.map +1 -1
  264. package/dist/esm/next/client.js +3 -2
  265. package/dist/esm/next/client.js.map +1 -1
  266. package/dist/esm/next/components/head-tags.js +40 -0
  267. package/dist/esm/next/components/head-tags.js.map +1 -0
  268. package/dist/esm/next/components/page.js +32 -0
  269. package/dist/esm/next/components/page.js.map +1 -0
  270. package/dist/esm/next/context/makeswift-host-api-client.js +21 -0
  271. package/dist/esm/next/context/makeswift-host-api-client.js.map +1 -0
  272. package/dist/esm/next/context/react-runtime.js +19 -0
  273. package/dist/esm/next/context/react-runtime.js.map +1 -0
  274. package/dist/esm/next/draft-mode/draft-mode-script.js +99 -0
  275. package/dist/esm/next/draft-mode/draft-mode-script.js.map +1 -0
  276. package/dist/esm/next/draft-mode/index.js +30 -0
  277. package/dist/esm/next/draft-mode/index.js.map +1 -0
  278. package/dist/esm/next/hooks/use-is-pages-router.js +13 -0
  279. package/dist/esm/next/hooks/use-is-pages-router.js.map +1 -0
  280. package/dist/esm/next/index.js +5 -32
  281. package/dist/esm/next/index.js.map +1 -1
  282. package/dist/esm/next/preview-mode.js +2 -1
  283. package/dist/esm/next/preview-mode.js.map +1 -1
  284. package/dist/esm/next/root-style-registry.js +55 -0
  285. package/dist/esm/next/root-style-registry.js.map +1 -0
  286. package/dist/esm/next/server.js +5 -1
  287. package/dist/esm/next/server.js.map +1 -1
  288. package/dist/esm/prop-controllers/copy/navigation-links.js +2 -2
  289. package/dist/esm/prop-controllers/copy/navigation-links.js.map +1 -1
  290. package/dist/esm/prop-controllers/copy.js +4 -3
  291. package/dist/esm/prop-controllers/copy.js.map +1 -1
  292. package/dist/esm/prop-controllers/descriptors.js +0 -5
  293. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  294. package/dist/esm/prop-controllers/index.js.map +1 -1
  295. package/dist/esm/prop-controllers/introspection.js +6 -10
  296. package/dist/esm/prop-controllers/introspection.js.map +1 -1
  297. package/dist/esm/runtimes/react/components/Element.js +1 -0
  298. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  299. package/dist/esm/runtimes/react/components/LiveProvider.js +6 -13
  300. package/dist/esm/runtimes/react/components/LiveProvider.js.map +1 -1
  301. package/dist/esm/runtimes/react/components/PreviewProvider.js +6 -8
  302. package/dist/esm/runtimes/react/components/PreviewProvider.js.map +1 -1
  303. package/dist/esm/runtimes/react/components/RuntimeProvider.js +3 -3
  304. package/dist/esm/runtimes/react/components/RuntimeProvider.js.map +1 -1
  305. package/dist/esm/runtimes/react/controls/link.js +1 -1
  306. package/dist/esm/runtimes/react/controls/link.js.map +1 -1
  307. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +3 -5
  308. package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
  309. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js +4 -11
  310. package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
  311. package/dist/esm/runtimes/react/controls.js +13 -1
  312. package/dist/esm/runtimes/react/controls.js.map +1 -1
  313. package/dist/esm/runtimes/react/hooks/makeswift-api.js +11 -10
  314. package/dist/esm/runtimes/react/hooks/makeswift-api.js.map +1 -1
  315. package/dist/esm/runtimes/react/hooks/use-document-key.js +1 -0
  316. package/dist/esm/runtimes/react/hooks/use-document-key.js.map +1 -1
  317. package/dist/esm/runtimes/react/hooks/use-page-id.js +1 -0
  318. package/dist/esm/runtimes/react/hooks/use-page-id.js.map +1 -1
  319. package/dist/esm/runtimes/react/hooks/use-store.js +1 -0
  320. package/dist/esm/runtimes/react/hooks/use-store.js.map +1 -1
  321. package/dist/esm/runtimes/react/use-global-style.js +8 -3
  322. package/dist/esm/runtimes/react/use-global-style.js.map +1 -1
  323. package/dist/esm/runtimes/react/use-style.js +2 -1
  324. package/dist/esm/runtimes/react/use-style.js.map +1 -1
  325. package/dist/esm/state/actions.js +0 -22
  326. package/dist/esm/state/actions.js.map +1 -1
  327. package/dist/esm/state/react-builder-preview.js +2 -28
  328. package/dist/esm/state/react-builder-preview.js.map +1 -1
  329. package/dist/types/api/react.d.ts +1 -9
  330. package/dist/types/api/react.d.ts.map +1 -1
  331. package/dist/types/api/resource-types.d.ts +20 -0
  332. package/dist/types/api/resource-types.d.ts.map +1 -0
  333. package/dist/types/builder/serialization/control-serialization.d.ts +9 -8
  334. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  335. package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
  336. package/dist/types/components/builtin/Box/animations.d.ts.map +1 -1
  337. package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
  338. package/dist/types/components/builtin/Button/Button.d.ts +3 -2
  339. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  340. package/dist/types/components/builtin/Button/register.d.ts.map +1 -1
  341. package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  342. package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -1
  343. package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
  344. package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
  345. package/dist/types/components/builtin/Divider/register.d.ts.map +1 -1
  346. package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
  347. package/dist/types/components/builtin/Embed/register.d.ts.map +1 -1
  348. package/dist/types/components/builtin/Form/Form.d.ts +3 -2
  349. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  350. package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  351. package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -1
  352. package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
  353. package/dist/types/components/builtin/Image/Image.d.ts +3 -2
  354. package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
  355. package/dist/types/components/builtin/Image/register.d.ts.map +1 -1
  356. package/dist/types/components/builtin/Navigation/Navigation.d.ts +3 -2
  357. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  358. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts +3 -2
  359. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  360. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +3 -2
  361. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  362. package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
  363. package/dist/types/components/builtin/Root/register.d.ts.map +1 -1
  364. package/dist/types/components/builtin/SocialLinks/register.d.ts.map +1 -1
  365. package/dist/types/components/builtin/Text/register.d.ts.map +1 -1
  366. package/dist/types/components/builtin/Video/Video.d.ts.map +1 -1
  367. package/dist/types/components/builtin/Video/register.d.ts.map +1 -1
  368. package/dist/types/components/hooks/index.d.ts +1 -0
  369. package/dist/types/components/hooks/index.d.ts.map +1 -1
  370. package/dist/types/components/hooks/usePageSnippets.d.ts +36 -0
  371. package/dist/types/components/hooks/usePageSnippets.d.ts.map +1 -0
  372. package/dist/types/components/hooks/usePropControllerLinkData.d.ts +3 -0
  373. package/dist/types/components/hooks/usePropControllerLinkData.d.ts.map +1 -0
  374. package/dist/types/components/hooks/useRouterLocaleSync.d.ts +2 -0
  375. package/dist/types/components/hooks/useRouterLocaleSync.d.ts.map +1 -0
  376. package/dist/types/components/page/BodySnippet.d.ts.map +1 -1
  377. package/dist/types/components/page/HeadSnippet.d.ts +7 -0
  378. package/dist/types/components/page/HeadSnippet.d.ts.map +1 -0
  379. package/dist/types/components/page/Page.d.ts.map +1 -1
  380. package/dist/types/components/page/PageHead.d.ts +8 -0
  381. package/dist/types/components/page/PageHead.d.ts.map +1 -0
  382. package/dist/types/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
  383. package/dist/types/components/shared/Link/index.d.ts +1 -1
  384. package/dist/types/components/shared/Link/index.d.ts.map +1 -1
  385. package/dist/types/controls/control.d.ts.map +1 -1
  386. package/dist/types/controls/rich-text/introspection.d.ts.map +1 -1
  387. package/dist/types/index.d.ts +1 -1
  388. package/dist/types/index.d.ts.map +1 -1
  389. package/dist/types/next/api-handler/handlers/element-tree.d.ts +9 -1
  390. package/dist/types/next/api-handler/handlers/element-tree.d.ts.map +1 -1
  391. package/dist/types/next/api-handler/handlers/fonts.d.ts +10 -1
  392. package/dist/types/next/api-handler/handlers/fonts.d.ts.map +1 -1
  393. package/dist/types/next/api-handler/handlers/manifest.d.ts +9 -0
  394. package/dist/types/next/api-handler/handlers/manifest.d.ts.map +1 -1
  395. package/dist/types/next/api-handler/handlers/merge-translated-data.d.ts +7 -0
  396. package/dist/types/next/api-handler/handlers/merge-translated-data.d.ts.map +1 -1
  397. package/dist/types/next/api-handler/handlers/proxy-draft-mode.d.ts +20 -0
  398. package/dist/types/next/api-handler/handlers/proxy-draft-mode.d.ts.map +1 -0
  399. package/dist/types/next/api-handler/handlers/proxy-preview-mode.d.ts +14 -2
  400. package/dist/types/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
  401. package/dist/types/next/api-handler/handlers/revalidate.d.ts +9 -0
  402. package/dist/types/next/api-handler/handlers/revalidate.d.ts.map +1 -1
  403. package/dist/types/next/api-handler/handlers/translatable-data.d.ts +7 -0
  404. package/dist/types/next/api-handler/handlers/translatable-data.d.ts.map +1 -1
  405. package/dist/types/next/api-handler/index.d.ts +11 -3
  406. package/dist/types/next/api-handler/index.d.ts.map +1 -1
  407. package/dist/types/next/client.d.ts.map +1 -1
  408. package/dist/types/next/components/head-tags.d.ts +19 -0
  409. package/dist/types/next/components/head-tags.d.ts.map +1 -0
  410. package/dist/types/next/components/page.d.ts +7 -0
  411. package/dist/types/next/components/page.d.ts.map +1 -0
  412. package/dist/types/next/context/makeswift-host-api-client.d.ts +8 -0
  413. package/dist/types/next/context/makeswift-host-api-client.d.ts.map +1 -0
  414. package/dist/types/next/context/react-runtime.d.ts +8 -0
  415. package/dist/types/next/context/react-runtime.d.ts.map +1 -0
  416. package/dist/types/next/draft-mode/draft-mode-script.d.ts +6 -0
  417. package/dist/types/next/draft-mode/draft-mode-script.d.ts.map +1 -0
  418. package/dist/types/next/draft-mode/index.d.ts +15 -0
  419. package/dist/types/next/draft-mode/index.d.ts.map +1 -0
  420. package/dist/types/next/hooks/use-is-pages-router.d.ts +2 -0
  421. package/dist/types/next/hooks/use-is-pages-router.d.ts.map +1 -0
  422. package/dist/types/next/index.d.ts +4 -9
  423. package/dist/types/next/index.d.ts.map +1 -1
  424. package/dist/types/next/preview-mode.d.ts +1 -1
  425. package/dist/types/next/preview-mode.d.ts.map +1 -1
  426. package/dist/types/next/root-style-registry.d.ts +7 -0
  427. package/dist/types/next/root-style-registry.d.ts.map +1 -0
  428. package/dist/types/next/server.d.ts +2 -0
  429. package/dist/types/next/server.d.ts.map +1 -1
  430. package/dist/types/prop-controllers/copy/navigation-links.d.ts.map +1 -1
  431. package/dist/types/prop-controllers/copy.d.ts.map +1 -1
  432. package/dist/types/prop-controllers/descriptors.d.ts +7 -66
  433. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  434. package/dist/types/prop-controllers/index.d.ts +2 -1
  435. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  436. package/dist/types/prop-controllers/introspection.d.ts.map +1 -1
  437. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  438. package/dist/types/runtimes/react/components/LiveProvider.d.ts +3 -5
  439. package/dist/types/runtimes/react/components/LiveProvider.d.ts.map +1 -1
  440. package/dist/types/runtimes/react/components/PreviewProvider.d.ts +3 -5
  441. package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  442. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts +2 -2
  443. package/dist/types/runtimes/react/components/RuntimeProvider.d.ts.map +1 -1
  444. package/dist/types/runtimes/react/controls/link.d.ts.map +1 -1
  445. package/dist/types/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -1
  446. package/dist/types/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  447. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  448. package/dist/types/runtimes/react/hooks/makeswift-api.d.ts +2 -1
  449. package/dist/types/runtimes/react/hooks/makeswift-api.d.ts.map +1 -1
  450. package/dist/types/runtimes/react/hooks/use-document-key.d.ts.map +1 -1
  451. package/dist/types/runtimes/react/hooks/use-page-id.d.ts.map +1 -1
  452. package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
  453. package/dist/types/runtimes/react/use-global-style.d.ts.map +1 -1
  454. package/dist/types/runtimes/react/use-style.d.ts.map +1 -1
  455. package/dist/types/state/actions.d.ts +1 -19
  456. package/dist/types/state/actions.d.ts.map +1 -1
  457. package/dist/types/state/react-builder-preview.d.ts +3 -3
  458. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  459. package/next/plugin/package.json +1 -0
  460. package/package.json +7 -10
  461. package/dist/cjs/next/dynamic.js +0 -52
  462. package/dist/cjs/next/dynamic.js.map +0 -1
  463. package/dist/cjs/prop-controllers/copy/link.js +0 -63
  464. package/dist/cjs/prop-controllers/copy/link.js.map +0 -1
  465. package/dist/esm/next/dynamic.js +0 -31
  466. package/dist/esm/next/dynamic.js.map +0 -1
  467. package/dist/esm/prop-controllers/copy/link.js +0 -39
  468. package/dist/esm/prop-controllers/copy/link.js.map +0 -1
  469. package/dist/types/next/dynamic.d.ts +0 -13
  470. package/dist/types/next/dynamic.d.ts.map +0 -1
  471. package/dist/types/prop-controllers/copy/link.d.ts +0 -4
  472. package/dist/types/prop-controllers/copy/link.d.ts.map +0 -1
@@ -1,13 +1,13 @@
1
- import dynamic from "next/dynamic";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
3
1
  import { Props } from "../../../prop-controllers";
4
2
  import { findBreakpointOverride, getBaseBreakpoint } from "../../../state/modules/breakpoints";
5
3
  import { MakeswiftComponentType } from "../constants";
6
4
  import { Alignments, Contrasts, Shapes, Sizes } from "./context/FormContext";
7
5
  import { ComponentIcon } from "../../../state/modules/components-meta";
6
+ import { lazy } from "react";
7
+ import { Link } from "@makeswift/prop-controllers";
8
8
  function registerComponent(runtime) {
9
9
  return runtime.registerComponent(
10
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Form")))),
10
+ lazy(() => import("./Form")),
11
11
  {
12
12
  type: MakeswiftComponentType.Form,
13
13
  label: "Form",
@@ -16,7 +16,7 @@ function registerComponent(runtime) {
16
16
  id: Props.ElementID(),
17
17
  tableId: Props.Table(),
18
18
  fields: Props.TableFormFields(),
19
- submitLink: Props.Link((props) => ({
19
+ submitLink: Link((props) => ({
20
20
  label: "Redirect to",
21
21
  // TODO: This option is hardcoded. We should import it from LinkPanelOptions
22
22
  options: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Form/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\n\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props, ResponsiveValue } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { Alignments, Contrast, Contrasts, Shapes, Sizes } from './context/FormContext'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Form')))),\n {\n type: MakeswiftComponentType.Form,\n label: 'Form',\n icon: ComponentIcon.Form,\n props: {\n id: Props.ElementID(),\n tableId: Props.Table(),\n fields: Props.TableFormFields(),\n submitLink: Props.Link(props => ({\n label: 'Redirect to',\n // TODO: This option is hardcoded. We should import it from LinkPanelOptions\n options: [\n { value: 'OPEN_PAGE', label: 'Open page' },\n { value: 'OPEN_URL', label: 'Open URL' },\n ],\n hidden: props.tableId == null,\n })),\n gap: Props.GapY(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Gap',\n defaultValue: { value: 0, unit: 'px' },\n hidden: props.tableId == null,\n })),\n shape: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Shape',\n options: [\n { label: 'Pill', value: Shapes.PILL, icon: 'ButtonPill16' },\n { label: 'Rounded', value: Shapes.ROUNDED, icon: 'ButtonRounded16' },\n { label: 'Square', value: Shapes.SQUARE, icon: 'ButtonSquare16' },\n ],\n defaultValue: Shapes.ROUNDED,\n hidden: props.tableId == null,\n })),\n size: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Size',\n options: [\n { label: 'Small', value: Sizes.SMALL, icon: 'SizeSmall16' },\n { label: 'Medium', value: Sizes.MEDIUM, icon: 'SizeMedium16' },\n { label: 'Large', value: Sizes.LARGE, icon: 'SizeLarge16' },\n ],\n defaultValue: Sizes.MEDIUM,\n hidden: props?.tableId == null,\n })),\n contrast: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Color',\n options: [\n { label: 'Light mode', value: Contrasts.LIGHT, icon: 'Sun16' },\n { label: 'Dark mode', value: Contrasts.DARK, icon: 'Moon16' },\n ],\n defaultValue: Contrasts.LIGHT,\n hidden: props.tableId == null,\n })),\n labelTextStyle: Props.TextStyle({ label: 'Label text style' }),\n labelTextColor: Props.ResponsiveColor((props, device) => {\n const hidden = props.tableId == null\n const responsiveContrast = props.contrast as ResponsiveValue<Contrast>\n const contrast = findBreakpointOverride<Contrast>(\n runtime.getBreakpoints(),\n responsiveContrast,\n device,\n )\n\n return {\n hidden,\n label: 'Label text color',\n placeholder:\n contrast?.value === Contrasts.DARK ? 'rgba(255,255,255,0.95)' : 'rgba(0,0,0,0.8)',\n }\n }),\n submitTextStyle: Props.TextStyle({ label: 'Button text style' }),\n brandColor: Props.ResponsiveColor(props => ({\n label: 'Button color',\n placeholder: 'black',\n hidden: props.tableId == null,\n // TODO: Add hideAlphaSlider\n })),\n submitTextColor: Props.ResponsiveColor(props => ({\n label: 'Button text color',\n placeholder: 'white',\n hidden: props.tableId == null,\n })),\n submitLabel: Props.TextInput(props => ({\n label: 'Button label',\n placeholder: 'Submit',\n hidden: props.tableId == null,\n })),\n submitVariant: Props.ResponsiveSelect(props => ({\n label: 'Button style',\n options: [\n { value: 'flat', label: 'Flat' },\n { value: 'outline', label: 'Outline' },\n { value: 'shadow', label: 'Floating' },\n { value: 'clear', label: 'Clear' },\n { value: 'blocky', label: 'Blocky' },\n { value: 'bubbly', label: 'Bubbly' },\n { value: 'skewed', label: 'Skewed' },\n ],\n defaultValue: 'flat',\n hidden: props.tableId == null,\n })),\n submitWidth: Props.ResponsiveLength(props => ({\n label: 'Button width',\n hidden: props.tableId == null,\n // TODO: Add placeholder: { value: 'auto' }\n })),\n submitAlignment: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Button alignment',\n options: [\n { label: 'Left', value: Alignments.LEFT, icon: 'AlignLeft16' },\n { label: 'Center', value: Alignments.CENTER, icon: 'AlignCenter16' },\n { label: 'Right', value: Alignments.RIGHT, icon: 'AlignRight16' },\n ],\n defaultValue: Alignments.CENTER,\n hidden: props.tableId == null,\n })),\n width: Props.Width({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 550, unit: 'px' },\n },\n ],\n defaultValue: { value: 100, unit: '%' },\n format: Props.Width.Format.ClassName,\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAEpB,SAAS,6BAA6B;AACtC,SAAS,aAA8B;AAEvC,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,YAAsB,WAAW,QAAQ,aAAa;AAC/D,SAAS,qBAAqB;AAEvB,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,IACrE;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,SAAS,MAAM,MAAM;AAAA,QACrB,QAAQ,MAAM,gBAAgB;AAAA,QAC9B,YAAY,MAAM,KAAK,YAAU;AAAA,UAC/B,OAAO;AAAA;AAAA,UAEP,SAAS;AAAA,YACP,EAAE,OAAO,aAAa,OAAO,YAAY;AAAA,YACzC,EAAE,OAAO,YAAY,OAAO,WAAW;AAAA,UACzC;AAAA,UACA,QAAQ,MAAM,WAAW;AAAA,QAC3B,EAAE;AAAA,QACF,KAAK,MAAM,KAAK,YAAU;AAAA,UACxB,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,YACjC;AAAA,UACF;AAAA,UACA,OAAO;AAAA,UACP,cAAc,EAAE,OAAO,GAAG,MAAM,KAAK;AAAA,UACrC,QAAQ,MAAM,WAAW;AAAA,QAC3B,EAAE;AAAA,QACF,OAAO,MAAM,yBAAyB,YAAU;AAAA,UAC9C,OAAO;AAAA,UACP,SAAS;AAAA,YACP,EAAE,OAAO,QAAQ,OAAO,OAA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MAAM,eAAe;AAAA,UAClE;AAAA,UACA,cAAc,WAAW;AAAA,UACzB,QAAQ,MAAM,WAAW;AAAA,QAC3B,EAAE;AAAA,QACF,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,YAClC;AAAA,UACF;AAAA,UACA,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,UACtC,QAAQ,MAAM,MAAM,OAAO;AAAA,QAC7B,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Form/register.ts"],"sourcesContent":["import { Props, ResponsiveValue } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { Alignments, Contrast, Contrasts, Shapes, Sizes } from './context/FormContext'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport { Link } from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Form')),\n {\n type: MakeswiftComponentType.Form,\n label: 'Form',\n icon: ComponentIcon.Form,\n props: {\n id: Props.ElementID(),\n tableId: Props.Table(),\n fields: Props.TableFormFields(),\n submitLink: Link(props => ({\n label: 'Redirect to',\n // TODO: This option is hardcoded. We should import it from LinkPanelOptions\n options: [\n { value: 'OPEN_PAGE', label: 'Open page' },\n { value: 'OPEN_URL', label: 'Open URL' },\n ],\n hidden: props.tableId == null,\n })),\n gap: Props.GapY(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Gap',\n defaultValue: { value: 0, unit: 'px' },\n hidden: props.tableId == null,\n })),\n shape: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Shape',\n options: [\n { label: 'Pill', value: Shapes.PILL, icon: 'ButtonPill16' },\n { label: 'Rounded', value: Shapes.ROUNDED, icon: 'ButtonRounded16' },\n { label: 'Square', value: Shapes.SQUARE, icon: 'ButtonSquare16' },\n ],\n defaultValue: Shapes.ROUNDED,\n hidden: props.tableId == null,\n })),\n size: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Size',\n options: [\n { label: 'Small', value: Sizes.SMALL, icon: 'SizeSmall16' },\n { label: 'Medium', value: Sizes.MEDIUM, icon: 'SizeMedium16' },\n { label: 'Large', value: Sizes.LARGE, icon: 'SizeLarge16' },\n ],\n defaultValue: Sizes.MEDIUM,\n hidden: props?.tableId == null,\n })),\n contrast: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Color',\n options: [\n { label: 'Light mode', value: Contrasts.LIGHT, icon: 'Sun16' },\n { label: 'Dark mode', value: Contrasts.DARK, icon: 'Moon16' },\n ],\n defaultValue: Contrasts.LIGHT,\n hidden: props.tableId == null,\n })),\n labelTextStyle: Props.TextStyle({ label: 'Label text style' }),\n labelTextColor: Props.ResponsiveColor((props, device) => {\n const hidden = props.tableId == null\n const responsiveContrast = props.contrast as ResponsiveValue<Contrast>\n const contrast = findBreakpointOverride<Contrast>(\n runtime.getBreakpoints(),\n responsiveContrast,\n device,\n )\n\n return {\n hidden,\n label: 'Label text color',\n placeholder:\n contrast?.value === Contrasts.DARK ? 'rgba(255,255,255,0.95)' : 'rgba(0,0,0,0.8)',\n }\n }),\n submitTextStyle: Props.TextStyle({ label: 'Button text style' }),\n brandColor: Props.ResponsiveColor(props => ({\n label: 'Button color',\n placeholder: 'black',\n hidden: props.tableId == null,\n // TODO: Add hideAlphaSlider\n })),\n submitTextColor: Props.ResponsiveColor(props => ({\n label: 'Button text color',\n placeholder: 'white',\n hidden: props.tableId == null,\n })),\n submitLabel: Props.TextInput(props => ({\n label: 'Button label',\n placeholder: 'Submit',\n hidden: props.tableId == null,\n })),\n submitVariant: Props.ResponsiveSelect(props => ({\n label: 'Button style',\n options: [\n { value: 'flat', label: 'Flat' },\n { value: 'outline', label: 'Outline' },\n { value: 'shadow', label: 'Floating' },\n { value: 'clear', label: 'Clear' },\n { value: 'blocky', label: 'Blocky' },\n { value: 'bubbly', label: 'Bubbly' },\n { value: 'skewed', label: 'Skewed' },\n ],\n defaultValue: 'flat',\n hidden: props.tableId == null,\n })),\n submitWidth: Props.ResponsiveLength(props => ({\n label: 'Button width',\n hidden: props.tableId == null,\n // TODO: Add placeholder: { value: 'auto' }\n })),\n submitAlignment: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Button alignment',\n options: [\n { label: 'Left', value: Alignments.LEFT, icon: 'AlignLeft16' },\n { label: 'Center', value: Alignments.CENTER, icon: 'AlignCenter16' },\n { label: 'Right', value: Alignments.RIGHT, icon: 'AlignRight16' },\n ],\n defaultValue: Alignments.CENTER,\n hidden: props.tableId == null,\n })),\n width: Props.Width({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 550, unit: 'px' },\n },\n ],\n defaultValue: { value: 100, unit: '%' },\n format: Props.Width.Format.ClassName,\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAA8B;AAEvC,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,YAAsB,WAAW,QAAQ,aAAa;AAC/D,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,QAAQ,CAAC;AAAA,IAC3B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,c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ACF;AACF;","names":[]}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { useState, useEffect, forwardRef } from "react";
3
4
  import NextImage from "next/image";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Image/Image.tsx"],"sourcesContent":["import { useState, useEffect, Ref, forwardRef } from 'react'\nimport NextImage from 'next/image'\nimport type NextLegacyImageType from 'next/legacy/image'\n\nimport {\n ElementIDValue,\n ImageValue,\n LinkValue,\n ResponsiveOpacityValue,\n TextInputValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { Breakpoints, findBreakpointOverride } from '../../../state/modules/breakpoints'\nimport { placeholders } from '../../utils/placeholders'\nimport { Link } from '../../shared/Link'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveWidth } from '../../utils/responsive-style'\nimport { useFile } from '../../../runtimes/react/hooks/makeswift-api'\nimport { major as nextMajorVersion } from '../../../next/next-version'\nimport { useBreakpoints } from '../../../runtimes/react'\nimport { match, P } from 'ts-pattern'\n\nconst NextLegacyImage = NextImage as typeof NextLegacyImageType\n\ntype Props = {\n id?: ElementIDValue\n file?: ImageValue\n altText?: TextInputValue\n link?: LinkValue\n width?: WidthValue\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n opacity?: ResponsiveOpacityValue\n placeholder?: { src: string; dimensions: { width: number; height: number } }\n className?: string\n priority?: boolean\n}\n\nfunction loadImage(src: string): Promise<HTMLImageElement> {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image()\n\n image.onload = () => resolve(image)\n image.onerror = reject\n image.src = src\n })\n}\n\nfunction imageSizes(breakpoints: Breakpoints, width?: Props['width']): string {\n const baseDevice = breakpoints.find(breakpoint => breakpoint.maxWidth == null)\n const baseWidth = baseDevice && width && findBreakpointOverride(breakpoints, width, baseDevice.id)\n const baseWidthSize =\n baseWidth == null || baseWidth.value.unit !== 'px' ? '100vw' : `${baseWidth.value.value}px`\n\n return breakpoints\n .map(breakpoint => {\n const override = findBreakpointOverride(breakpoints, width, breakpoint.id)\n\n if (override == null || breakpoint.maxWidth == null || override.value.unit !== 'px') {\n return null\n }\n\n return `(max-width: ${breakpoint.maxWidth}px) ${Math.min(\n breakpoint.maxWidth,\n override.value.value,\n )}px`\n })\n .filter((size): size is NonNullable<typeof size> => size != null)\n .reduce((sourceSizes, sourceSize) => `${sourceSize}, ${sourceSizes}`, baseWidthSize)\n}\n\ntype Dimensions = {\n width: number\n height: number\n}\n\nconst ImageComponent = forwardRef(function Image(\n {\n id,\n width,\n margin,\n padding,\n file,\n border,\n borderRadius,\n altText,\n link,\n opacity,\n boxShadow,\n placeholder = placeholders.image,\n className,\n priority,\n }: Props,\n ref: Ref<HTMLAnchorElement & HTMLDivElement>,\n) {\n const fileId = match(file)\n .with(P.string, v => v)\n .with({ type: 'makeswift-file', version: 1 }, v => v.id)\n .otherwise(() => null)\n const fileData = useFile(fileId)\n const imageSrc = match([file, fileData])\n .with([P.any, P.not(P.nullish)], ([, fileData]) => fileData.publicUrl)\n .with([{ type: 'external-file', version: 1 }, P.any], ([file]) => file.url)\n .otherwise(() => placeholder.src)\n const dataDimensions = match([file, fileData, imageSrc])\n .with(\n [{ type: 'external-file', version: 1, width: P.number, height: P.number }, P.any, P.any],\n ([externalFile]) => ({ width: externalFile.width, height: externalFile.height }),\n )\n .with([P.any, P.not(P.nullish), P.any], ([, data]) => data.dimensions)\n .with([P.any, P.any, placeholder.src], () => placeholder.dimensions)\n .otherwise(() => null)\n const [measuredDimensions, setMeasuredDimensions] = useState<Dimensions | null>(null)\n const breakpoints = useBreakpoints()\n\n useEffect(() => {\n if (dataDimensions) return\n\n let cleanedUp = false\n\n loadImage(imageSrc)\n .then(image => {\n if (!cleanedUp) {\n setMeasuredDimensions({ width: image.naturalWidth, height: image.naturalHeight })\n }\n })\n .catch(console.error)\n\n return () => {\n cleanedUp = true\n }\n }, [dataDimensions, imageSrc])\n\n const dimensions = dataDimensions ?? measuredDimensions\n const Container = link ? Link : 'div'\n const containerClassName = cx(\n useStyle({ lineHeight: 0, overflow: 'hidden' }),\n useStyle(useResponsiveWidth(width, dimensions?.width)),\n useStyle(useResponsiveStyle([opacity] as const, ([opacity = 1]) => ({ opacity }))),\n margin,\n padding,\n border,\n borderRadius,\n boxShadow,\n className,\n )\n\n if (!dimensions) return null\n\n return (\n <Container link={link} ref={ref} id={id} className={containerClassName}>\n {nextMajorVersion < 13 ? (\n <NextLegacyImage\n layout=\"responsive\"\n src={imageSrc}\n sizes={imageSizes(breakpoints, width)}\n alt={altText}\n width={dimensions.width}\n height={dimensions.height}\n priority={priority}\n />\n ) : (\n <NextImage\n src={imageSrc}\n priority={priority}\n sizes={imageSizes(breakpoints, width)}\n alt={altText ?? ''}\n width={dimensions.width}\n height={dimensions.height}\n style={{\n width: '100%',\n height: 'auto',\n }}\n />\n )}\n </Container>\n )\n})\n\nexport default ImageComponent\n"],"mappings":"AA4JQ;AA5JR,SAAS,UAAU,WAAgB,kBAAkB;AACrD,OAAO,eAAe;AAWtB,SAAsB,8BAA8B;AACpD,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,eAAe;AACxB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAC/B,SAAS,OAAO,SAAS;AAEzB,MAAM,kBAAkB;AAmBxB,SAAS,UAAU,KAAwC;AACzD,SAAO,IAAI,QAA0B,CAAC,SAAS,WAAW;AACxD,UAAM,QAAQ,IAAI,MAAM;AAExB,UAAM,SAAS,MAAM,QAAQ,KAAK;AAClC,UAAM,UAAU;AAChB,UAAM,MAAM;AAAA,EACd,CAAC;AACH;AAEA,SAAS,WAAW,aAA0B,OAAgC;AAC5E,QAAM,aAAa,YAAY,KAAK,gBAAc,WAAW,YAAY,IAAI;AAC7E,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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,MAAI,CAAC;AAAY,WAAO;AAExB,SACE,oBAAC,aAAU,MAAY,KAAU,IAAQ,WAAW,oBACjD,6BAAmB,KAClB;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAO,WAAW,aAAa,KAAK;AAAA,MACpC,KAAK;AAAA,MACL,OAAO,WAAW;AAAA,MAClB,QAAQ,WAAW;AAAA,MACnB;AAAA;AAAA,EACF,IAEA;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,OAAO,WAAW,aAAa,KAAK;AAAA,MACpC,KAAK,WAAW;AAAA,MAChB,OAAO,WAAW;AAAA,MAClB,QAAQ,WAAW;AAAA,MACnB,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA;AAAA,EACF,GAEJ;AAEJ,CAAC;AAED,IAAO,gBAAQ;","names":["Image","fileData","file","opacity"]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Image/Image.tsx"],"sourcesContent":["'use client'\n\nimport { useState, useEffect, Ref, forwardRef } from 'react'\nimport NextImage from 'next/image'\nimport type NextLegacyImageType from 'next/legacy/image'\n\nimport {\n ElementIDValue,\n ImageValue,\n ResponsiveOpacityValue,\n TextInputValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { LinkPropControllerValue } from '@makeswift/prop-controllers'\nimport { Breakpoints, findBreakpointOverride } from '../../../state/modules/breakpoints'\nimport { placeholders } from '../../utils/placeholders'\nimport { Link } from '../../shared/Link'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveWidth } from '../../utils/responsive-style'\nimport { useFile } from '../../../runtimes/react/hooks/makeswift-api'\nimport { major as nextMajorVersion } from '../../../next/next-version'\nimport { useBreakpoints } from '../../../runtimes/react'\nimport { match, P } from 'ts-pattern'\n\nconst NextLegacyImage = NextImage as typeof NextLegacyImageType\n\ntype Props = {\n id?: ElementIDValue\n file?: ImageValue\n altText?: TextInputValue\n link?: LinkPropControllerValue\n width?: WidthValue\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n opacity?: ResponsiveOpacityValue\n placeholder?: { src: string; dimensions: { width: number; height: number } }\n className?: string\n priority?: boolean\n}\n\nfunction loadImage(src: string): Promise<HTMLImageElement> {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image()\n\n image.onload = () => resolve(image)\n image.onerror = reject\n image.src = src\n })\n}\n\nfunction imageSizes(breakpoints: Breakpoints, width?: Props['width']): string {\n const baseDevice = breakpoints.find(breakpoint => breakpoint.maxWidth == null)\n const baseWidth = baseDevice && width && findBreakpointOverride(breakpoints, width, baseDevice.id)\n const baseWidthSize =\n baseWidth == null || baseWidth.value.unit !== 'px' ? '100vw' : `${baseWidth.value.value}px`\n\n return breakpoints\n .map(breakpoint => {\n const override = findBreakpointOverride(breakpoints, width, breakpoint.id)\n\n if (override == null || breakpoint.maxWidth == null || override.value.unit !== 'px') {\n return null\n }\n\n return `(max-width: ${breakpoint.maxWidth}px) ${Math.min(\n breakpoint.maxWidth,\n override.value.value,\n )}px`\n })\n .filter((size): size is NonNullable<typeof size> => size != null)\n .reduce((sourceSizes, sourceSize) => `${sourceSize}, ${sourceSizes}`, baseWidthSize)\n}\n\ntype Dimensions = {\n width: number\n height: number\n}\n\nconst ImageComponent = forwardRef(function Image(\n {\n id,\n width,\n margin,\n padding,\n file,\n border,\n borderRadius,\n altText,\n link,\n opacity,\n boxShadow,\n placeholder = placeholders.image,\n className,\n priority,\n }: Props,\n ref: Ref<HTMLAnchorElement & HTMLDivElement>,\n) {\n const fileId = match(file)\n .with(P.string, v => v)\n .with({ type: 'makeswift-file', version: 1 }, v => v.id)\n .otherwise(() => null)\n const fileData = useFile(fileId)\n const imageSrc = match([file, fileData])\n .with([P.any, P.not(P.nullish)], ([, fileData]) => fileData.publicUrl)\n .with([{ type: 'external-file', version: 1 }, P.any], ([file]) => file.url)\n .otherwise(() => placeholder.src)\n const dataDimensions = match([file, fileData, imageSrc])\n .with(\n [{ type: 'external-file', version: 1, width: P.number, height: P.number }, P.any, P.any],\n ([externalFile]) => ({ width: externalFile.width, height: externalFile.height }),\n )\n .with([P.any, P.not(P.nullish), P.any], ([, data]) => data.dimensions)\n .with([P.any, P.any, placeholder.src], () => placeholder.dimensions)\n .otherwise(() => null)\n const [measuredDimensions, setMeasuredDimensions] = useState<Dimensions | null>(null)\n const breakpoints = useBreakpoints()\n\n useEffect(() => {\n if (dataDimensions) return\n\n let cleanedUp = false\n\n loadImage(imageSrc)\n .then(image => {\n if (!cleanedUp) {\n setMeasuredDimensions({ width: image.naturalWidth, height: image.naturalHeight })\n }\n })\n .catch(console.error)\n\n return () => {\n cleanedUp = true\n }\n }, [dataDimensions, imageSrc])\n\n const dimensions = dataDimensions ?? measuredDimensions\n const Container = link ? Link : 'div'\n const containerClassName = cx(\n useStyle({ lineHeight: 0, overflow: 'hidden' }),\n useStyle(useResponsiveWidth(width, dimensions?.width)),\n useStyle(useResponsiveStyle([opacity] as const, ([opacity = 1]) => ({ opacity }))),\n margin,\n padding,\n border,\n borderRadius,\n boxShadow,\n className,\n )\n\n if (!dimensions) return null\n\n return (\n <Container link={link} ref={ref} id={id} className={containerClassName}>\n {nextMajorVersion < 13 ? (\n <NextLegacyImage\n layout=\"responsive\"\n src={imageSrc}\n sizes={imageSizes(breakpoints, width)}\n alt={altText}\n width={dimensions.width}\n height={dimensions.height}\n priority={priority}\n />\n ) : (\n <NextImage\n src={imageSrc}\n priority={priority}\n sizes={imageSizes(breakpoints, width)}\n alt={altText ?? ''}\n width={dimensions.width}\n height={dimensions.height}\n style={{\n width: '100%',\n height: 'auto',\n }}\n />\n )}\n </Container>\n )\n})\n\nexport default ImageComponent\n"],"mappings":";AA8JQ;AA5JR,SAAS,UAAU,WAAgB,kBAAkB;AACrD,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";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
1
+ import { lazy } from "react";
3
2
  import { Props } from "../../../prop-controllers";
4
3
  import { MakeswiftComponentType } from "../constants";
4
+ import { Link } from "@makeswift/prop-controllers";
5
5
  function registerComponent(runtime) {
6
6
  return runtime.registerComponent(
7
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Image")))),
7
+ lazy(() => import("./Image")),
8
8
  {
9
9
  type: MakeswiftComponentType.Image,
10
10
  label: "Image",
@@ -12,7 +12,7 @@ function registerComponent(runtime) {
12
12
  id: Props.ElementID(),
13
13
  file: Props.Image(),
14
14
  altText: Props.TextInput({ label: "Alt text" }),
15
- link: Props.Link({ label: "On click" }),
15
+ link: Link({ label: "On click" }),
16
16
  width: Props.Width(),
17
17
  margin: Props.Margin({ format: Props.Margin.Format.ClassName }),
18
18
  padding: Props.Padding({ format: Props.Padding.Format.ClassName }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Image/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Image')))),\n {\n type: MakeswiftComponentType.Image,\n label: 'Image',\n props: {\n id: Props.ElementID(),\n file: Props.Image(),\n altText: Props.TextInput({ label: 'Alt text' }),\n link: Props.Link({ label: 'On click' }),\n width: Props.Width(),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n padding: Props.Padding({ format: Props.Padding.Format.ClassName }),\n border: Props.Border({ format: Props.Border.Format.ClassName }),\n borderRadius: Props.BorderRadius({ format: Props.BorderRadius.Format.ClassName }),\n boxShadow: Props.Shadows({ format: Props.Shadows.Format.ClassName }),\n opacity: Props.ResponsiveOpacity(),\n priority: Props.Checkbox({ label: 'Priority' }),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AACpB,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AAEhC,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC;AAAA,IACtE;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,MAAM,MAAM,MAAM;AAAA,QAClB,SAAS,MAAM,UAAU,EAAE,OAAO,WAAW,CAAC;AAAA,QAC9C,MAAM,MAAM,KAAK,EAAE,OAAO,WAAW,CAAC;AAAA,QACtC,OAAO,MAAM,MAAM;AAAA,QACnB,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,SAAS,MAAM,QAAQ,EAAE,QAAQ,MAAM,QAAQ,OAAO,UAAU,CAAC;AAAA,QACjE,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,cAAc,MAAM,aAAa,EAAE,QAAQ,MAAM,aAAa,OAAO,UAAU,CAAC;AAAA,QAChF,WAAW,MAAM,QAAQ,EAAE,QAAQ,MAAM,QAAQ,OAAO,UAAU,CAAC;AAAA,QACnE,SAAS,MAAM,kBAAkB;AAAA,QACjC,UAAU,MAAM,SAAS,EAAE,OAAO,WAAW,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Image/register.ts"],"sourcesContent":["import { lazy } from 'react'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport { Link } from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Image')),\n {\n type: MakeswiftComponentType.Image,\n label: 'Image',\n props: {\n id: Props.ElementID(),\n file: Props.Image(),\n altText: Props.TextInput({ label: 'Alt text' }),\n link: Link({ label: 'On click' }),\n width: Props.Width(),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n padding: Props.Padding({ format: Props.Padding.Format.ClassName }),\n border: Props.Border({ format: Props.Border.Format.ClassName }),\n borderRadius: Props.BorderRadius({ format: Props.BorderRadius.Format.ClassName }),\n boxShadow: Props.Shadows({ format: Props.Shadows.Format.ClassName }),\n opacity: Props.ResponsiveOpacity(),\n priority: Props.Checkbox({ label: 'Priority' }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,SAAS,CAAC;AAAA,IAC5B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,MAAM,MAAM,MAAM;AAAA,QAClB,SAAS,MAAM,UAAU,EAAE,OAAO,WAAW,CAAC;AAAA,QAC9C,MAAM,KAAK,EAAE,OAAO,WAAW,CAAC;AAAA,QAChC,OAAO,MAAM,MAAM;AAAA,QACnB,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,SAAS,MAAM,QAAQ,EAAE,QAAQ,MAAM,QAAQ,OAAO,UAAU,CAAC;AAAA,QACjE,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,cAAc,MAAM,aAAa,EAAE,QAAQ,MAAM,aAAa,OAAO,UAAU,CAAC;AAAA,QAChF,WAAW,MAAM,QAAQ,EAAE,QAAQ,MAAM,QAAQ,OAAO,UAAU,CAAC;AAAA,QACnE,SAAS,MAAM,kBAAkB;AAAA,QACjC,UAAU,MAAM,SAAS,EAAE,OAAO,WAAW,CAAC;AAAA,MAChD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { forwardRef, useState } from "react";
3
4
  import { MobileMenu28 } from "../../icons/MobileMenu28";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Navigation/Navigation.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useState } from 'react'\n\nimport { MobileMenu28 } from '../../icons/MobileMenu28'\n\nimport GutterContainer from '../../shared/GutterContainer'\nimport Image from '../Image'\nimport Button from '../Button'\nimport LinksPlaceholder from './components/LinksPlaceholder'\nimport DropDownButton from './components/DropDownButton'\nimport MobileMenu from './components/MobileMenu'\nimport {\n ResponsiveValue,\n CheckboxValue,\n ElementIDValue,\n GapXValue,\n ImageValue,\n LinkValue,\n NavigationLinksValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveLengthValue,\n ResponsiveSelectValue,\n TextInputValue,\n TextStyleValue,\n NavigationButton as NavigationButtonValue,\n} from '../../../prop-controllers/descriptors'\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: ElementIDValue\n links?: NavigationLinksValue\n linkTextStyle?: TextStyleValue\n showLogo?: CheckboxValue\n logoFile?: ImageValue\n logoWidth?: ResponsiveLengthValue\n logoAltText?: TextInputValue\n logoLink?: LinkValue\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: GapXValue\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonValue['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":"AAmEI,cAwKU,YAxKV;AAnEJ,SAAiD,YAAY,gBAAgB;AAE7E,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AAiBvB,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,gBAA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AA,YACA,OAAO;AAAA;AAAA,QACT;AAAA,QAEF,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,UAAU,GAAG,gBAAgB,WAAW,GACrE;AAAA,8BAAC,kBAAe,WAAsB,qBACnC,gBAAM,SAAS,IACd,MAAM,IAAI,CAAC,MAAM,MACf;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA,OAAO,MAAM;AAAA,cACb,MAAM,MAAM,MAAM,SAAS;AAAA,cAE1B;AAAA,qBAAK,SAAS,YACb,oBAAC,oBAAkB,GAAG,KAAK,SAAU,eAAK,QAAQ,OAAM;AAAA,gBAEzD,KAAK,SAAS,cAAc,oBAAC,kBAAgB,GAAG,KAAK,SAAS;AAAA;AAAA;AAAA,YAR1D,KAAK;AAAA,UASZ,CACD,IAED,oBAAC,oBAAiB,QAAgB,GAEtC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,cACA,SAAS,MAAM,UAAU,IAAI;AAAA,cAE7B,8BAAC,gBAAa;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX,iBAAiB;AAAA,cACjB,gBAAgB;AAAA,cAChB;AAAA,cACA,SAAS,MAAM,UAAU,KAAK;AAAA,cAC9B,MAAM;AAAA;AAAA,UACR;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,qBAAQ;","names":["Container","gutter","alignment","mobileMenuAnimation","color","Navigation"]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Navigation/Navigation.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useState } from 'react'\n\nimport { MobileMenu28 } from '../../icons/MobileMenu28'\n\nimport GutterContainer from '../../shared/GutterContainer'\nimport Image from '../Image'\nimport Button from '../Button'\nimport LinksPlaceholder from './components/LinksPlaceholder'\nimport DropDownButton from './components/DropDownButton'\nimport MobileMenu from './components/MobileMenu'\nimport {\n ResponsiveValue,\n CheckboxValue,\n ElementIDValue,\n GapXValue,\n ImageValue,\n NavigationLinksValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveLengthValue,\n ResponsiveSelectValue,\n TextInputValue,\n TextStyleValue,\n NavigationButton as NavigationButtonValue,\n} from '../../../prop-controllers/descriptors'\nimport { LinkPropControllerValue } from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: ElementIDValue\n links?: NavigationLinksValue\n linkTextStyle?: TextStyleValue\n showLogo?: CheckboxValue\n logoFile?: ImageValue\n logoWidth?: ResponsiveLengthValue\n logoAltText?: TextInputValue\n logoLink?: LinkPropControllerValue\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: GapXValue\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonValue['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":";AAsEI,cAwKU,YAxKV;AApEJ,SAAiD,YAAY,gBAAgB;AAE7E,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AAkBvB,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,gBAAgB;AA+BzB,MAAM,YAAY,WAAW,SAASA,WACpC,EAAE,WAAW,OAAO,QAAQ,WAAW,QAAQ,GAAG,YAAY,GAC9D,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,QAAQ,YAAY,SAAS,CAAC;AAAA,QAClD;AAAA,QACA;AAAA,QACA,SAAS,uBAAuB,SAAS,CAAC;AAAA,QAC1C;AAAA,UACE,mBAAmB,CAAC,MAAM,GAAY,CAAC,CAACC,UAAS,EAAE,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO;AAAA,YAC9E,KAAK,GAAGA,QAAO,KAAK,GAAGA,QAAO,IAAI;AAAA,UACpC,EAAE;AAAA,QACJ;AAAA,QACA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,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AA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,cACA,SAAS,MAAM,UAAU,IAAI;AAAA,cAE7B,8BAAC,gBAAa;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,cACX,iBAAiB;AAAA,cACjB,gBAAgB;AAAA,cAChB;AAAA,cACA,SAAS,MAAM,UAAU,KAAK;AAAA,cAC9B,MAAM;AAAA;AAAA,UACR;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,qBAAQ;","names":["Container","gutter","alignment","mobileMenuAnimation","color","Navigation"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useRef, useState } from 'react'\n\nimport { CaretDown8 } from '../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../icons/ChevronDown8'\nimport {\n ResponsiveColorValue,\n TextStyleValue,\n LinkValue,\n} from '../../../../../prop-controllers/descriptors'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../hooks'\n\nimport { Link } from '../../../../shared/Link'\nimport Button from '../../../Button'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\nimport { cx, keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../../../utils/responsive-style'\n\nconst DROP_DOWN_MENU_WIDTH = 200\n\ntype Position = 'left' | 'right'\n\nconst DROP_DOWN_MENU_CLASS_NAME = 'drop-down-menu'\n\ntype DropDownMenuBaseProps = {\n position: Position\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, position, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n DROP_DOWN_MENU_CLASS_NAME,\n useStyle({\n position: 'absolute',\n top: '100%',\n left: position === 'left' ? 0 : 'auto',\n right: position === 'right' ? 0 : 'auto',\n background: '#fff',\n margin: 0,\n padding: '8px 0',\n borderRadius: 4,\n boxShadow: '0 3px 10px rgba(0, 0, 0, 0.15)',\n width: DROP_DOWN_MENU_WIDTH,\n zIndex: 99,\n listStyle: 'none',\n overflow: 'hidden',\n transformOrigin: '50% 0',\n willChange: 'transform, opacity',\n transformStyle: 'preserve-3d',\n display: 'none',\n }),\n className,\n )}\n />\n )\n}\n\nconst dropIn = keyframes`\n 0% {\n opacity: 0;\n transform: rotateX(-20deg);\n }\n 100% {\n opacity: 1;\n transform: none;\n }\n`\n\ntype DropDownContainerProps = ComponentPropsWithoutRef<'div'>\n\nconst DropDownContainer = forwardRef(function DropDownContainer(\n { className, ...restOfProps }: DropDownContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'relative',\n [`&:hover .${DROP_DOWN_MENU_CLASS_NAME}`]: {\n display: 'block',\n animation: `${dropIn} 0.25s`,\n },\n }),\n className,\n )}\n />\n )\n})\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorValue\n textStyle?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ className, color, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n backgroundColor: 'transparent',\n transition: 'background-color 0.2s',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData, textStyle] as const, ([color, textStyle = {}]) => {\n const fontSize = textStyle.fontSize || { value: 14, unit: 'px' }\n const fontWeight = textStyle.fontWeight == null ? 'normal' : textStyle.fontWeight\n const fontStyle = textStyle.fontStyle || []\n const letterSpacing = textStyle.letterSpacing == null ? null : textStyle.letterSpacing\n const textTransform = textStyle.textTransform || []\n\n return {\n color: color == null ? 'black' : colorToString(color),\n fontSize: `${fontSize.value}${fontSize.unit}`,\n fontWeight,\n fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',\n letterSpacing: letterSpacing == null ? 'normal' : `${letterSpacing}px`,\n textTransform: textTransform.includes('uppercase') ? 'uppercase' : 'none',\n }\n }),\n ),\n useStyle({\n '&:hover': {\n backgroundColor: 'rgba(0, 0, 0, 0.04)',\n },\n }),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n caret?: 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkValue\n label: string\n }\n }>\n textColor?: ResponsiveColorValue\n color?: ResponsiveColorValue\n}\n\nexport default function DropDownButton({\n label,\n caret = 'caret',\n links = [],\n textColor,\n color,\n ...restOfProps\n}: Props): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const [position, setPosition] = useState<Position>('left')\n\n useIsomorphicLayoutEffect(() => {\n if (\n container.current &&\n container.current.ownerDocument.defaultView!.innerWidth <\n container.current.offsetLeft + DROP_DOWN_MENU_WIDTH\n ) {\n setPosition('right')\n } else {\n setPosition('left')\n }\n }, [setPosition])\n\n return (\n <DropDownContainer ref={container}>\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </span>\n </div>\n </Button>\n <DropDownMenu position={position}>\n {links.map(({ id, payload }) => (\n <DropDownItem {...payload} key={id}>\n {payload.label}\n </DropDownItem>\n ))}\n </DropDownMenu>\n </DropDownContainer>\n )\n}\n"],"mappings":"AAoCI,cAqKM,YArKN;AA+KM;AAnNV,SAAiD,YAAY,QAAQ,gBAAgB;AAErF,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAM7B,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS,YAAY;AACrB,OAAO,YAAY;AACnB,SAAS,iCAAiC;AAC1C,SAAS,IAAI,iBAAiB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB,8BAA8B;AAE3D,MAAM,uBAAuB;AAI7B,MAAM,4BAA4B;AASlC,SAAS,aAAa,EAAE,WAAW,UAAU,GAAG,YAAY,GAAsB;AAChF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT;AAAA,QACA,SAAS;AAAA,UACP,UAAU;AAAA,UACV,KAAK;AAAA,UACL,MAAM,aAAa,SAAS,IAAI;AAAA,UAChC,OAAO,aAAa,UAAU,IAAI;AAAA,UAClC,YAAY;AAAA,UACZ,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,cAAc;AAAA,UACd,WAAW;AAAA,UACX,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,UAAU;AAAA,UACV,iBAAiB;AAAA,UACjB,YAAY;AAAA,UACZ,gBAAgB;AAAA,UAChB,SAAS;AAAA,QACX,CAAC;AAAA,QACD;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AAEA,MAAM,SAAS;AAAA;AAAA;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C7C;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,gBAAa,UACX,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,8BAAC,gBAAc,GAAG,SAAS,KAAK,MAC7B,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["DropDownContainer","color","textStyle"]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useRef, useState } from 'react'\n\nimport { CaretDown8 } from '../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../icons/ChevronDown8'\nimport { ResponsiveColorValue, TextStyleValue } from '../../../../../prop-controllers/descriptors'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../hooks'\n\nimport { Link } from '../../../../shared/Link'\nimport Button from '../../../Button'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\nimport { cx, keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../../../utils/responsive-style'\nimport { LinkData } from '@makeswift/prop-controllers'\n\nconst DROP_DOWN_MENU_WIDTH = 200\n\ntype Position = 'left' | 'right'\n\nconst DROP_DOWN_MENU_CLASS_NAME = 'drop-down-menu'\n\ntype DropDownMenuBaseProps = {\n position: Position\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, position, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n DROP_DOWN_MENU_CLASS_NAME,\n useStyle({\n position: 'absolute',\n top: '100%',\n left: position === 'left' ? 0 : 'auto',\n right: position === 'right' ? 0 : 'auto',\n background: '#fff',\n margin: 0,\n padding: '8px 0',\n borderRadius: 4,\n boxShadow: '0 3px 10px rgba(0, 0, 0, 0.15)',\n width: DROP_DOWN_MENU_WIDTH,\n zIndex: 99,\n listStyle: 'none',\n overflow: 'hidden',\n transformOrigin: '50% 0',\n willChange: 'transform, opacity',\n transformStyle: 'preserve-3d',\n display: 'none',\n }),\n className,\n )}\n />\n )\n}\n\nconst dropIn = keyframes`\n 0% {\n opacity: 0;\n transform: rotateX(-20deg);\n }\n 100% {\n opacity: 1;\n transform: none;\n }\n`\n\ntype DropDownContainerProps = ComponentPropsWithoutRef<'div'>\n\nconst DropDownContainer = forwardRef(function DropDownContainer(\n { className, ...restOfProps }: DropDownContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'relative',\n [`&:hover .${DROP_DOWN_MENU_CLASS_NAME}`]: {\n display: 'block',\n animation: `${dropIn} 0.25s`,\n },\n }),\n className,\n )}\n />\n )\n})\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorValue\n textStyle?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ className, color, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n backgroundColor: 'transparent',\n transition: 'background-color 0.2s',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData, textStyle] as const, ([color, textStyle = {}]) => {\n const fontSize = textStyle.fontSize || { value: 14, unit: 'px' }\n const fontWeight = textStyle.fontWeight == null ? 'normal' : textStyle.fontWeight\n const fontStyle = textStyle.fontStyle || []\n const letterSpacing = textStyle.letterSpacing == null ? null : textStyle.letterSpacing\n const textTransform = textStyle.textTransform || []\n\n return {\n color: color == null ? 'black' : colorToString(color),\n fontSize: `${fontSize.value}${fontSize.unit}`,\n fontWeight,\n fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',\n letterSpacing: letterSpacing == null ? 'normal' : `${letterSpacing}px`,\n textTransform: textTransform.includes('uppercase') ? 'uppercase' : 'none',\n }\n }),\n ),\n useStyle({\n '&:hover': {\n backgroundColor: 'rgba(0, 0, 0, 0.04)',\n },\n }),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n caret?: 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n textColor?: ResponsiveColorValue\n color?: ResponsiveColorValue\n}\n\nexport default function DropDownButton({\n label,\n caret = 'caret',\n links = [],\n textColor,\n color,\n ...restOfProps\n}: Props): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const [position, setPosition] = useState<Position>('left')\n\n useIsomorphicLayoutEffect(() => {\n if (\n container.current &&\n container.current.ownerDocument.defaultView!.innerWidth <\n container.current.offsetLeft + DROP_DOWN_MENU_WIDTH\n ) {\n setPosition('right')\n } else {\n setPosition('left')\n }\n }, [setPosition])\n\n return (\n <DropDownContainer ref={container}>\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </span>\n </div>\n </Button>\n <DropDownMenu position={position}>\n {links.map(({ id, payload }) => (\n <DropDownItem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","textStyle"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useState } from 'react'\n\nimport {\n ResponsiveColorValue,\n TextStyleValue,\n LinkValue,\n} from '../../../../../../../prop-controllers/descriptors'\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../../../hooks'\n\nimport { CaretDown8 } from '../../../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../../../icons/ChevronDown8'\n\nimport { Link } from '../../../../../../shared/Link'\nimport Button from '../../../../../Button'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../../../../../runtimes/react/use-style'\nimport {\n useResponsiveStyle,\n useResponsiveTextStyle,\n} from '../../../../../../utils/responsive-style'\n\ntype DropDownMenuBaseProps = {\n className?: string\n open: boolean\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, open, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({ display: open ? 'flex' : 'none', flexDirection: 'column', padding: 8 }),\n className,\n )}\n />\n )\n}\n\ntype ButtonLinkBaseProps = {\n className?: string\n}\n\ntype ButtonLinkProps = ButtonLinkBaseProps &\n Omit<ComponentPropsWithoutRef<typeof Button>, keyof ButtonLinkBaseProps>\n\nfunction ButtonLink({ className, ...restOfProps }: ButtonLinkProps) {\n return <Button {...restOfProps} className={cx(useStyle({ margin: '8px 0' }), className)} />\n}\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorValue\n textStyle?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ color, className, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData] as const, ([color]) => ({\n color: color == null ? 'black' : colorToString(color),\n })),\n ),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkValue\n label: string\n }\n }>\n onClose?: () => unknown\n caret?: string\n textColor?: ResponsiveColorValue\n color?: ResponsiveColorValue\n}\n\nexport default function MobileDropDownButton({\n label,\n caret,\n links = [],\n onClose = () => {},\n color,\n textColor,\n ...restOfProps\n}: Props): JSX.Element {\n const [isOpen, setIsOpen] = useState(false)\n return (\n <>\n <ButtonLink\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n onPointerDown={() => setIsOpen(prev => !prev)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n <>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </>\n </span>\n </div>\n </ButtonLink>\n <DropDownMenu open={isOpen}>\n {links.map(({ id, payload }) => (\n <DropDownItem {...payload} key={id} onClick={onClose}>\n {payload.label}\n </DropDownItem>\n ))}\n </DropDownMenu>\n </>\n )\n}\n"],"mappings":"AAkCI,SA2FQ,UA3FR,KA2FQ,YA3FR;AAsGM;AAxIV,SAAmC,gBAAgB;AAOnD,SAAS,qBAAqB;AAC9B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B;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,WAAW,mBAAmB,SAAS;AAAA,QACvC,OAAO,mBAAmB,KAAK;AAAA,QAC/B,eAAe,MAAM,UAAU,UAAQ,CAAC,IAAI;AAAA,QAE5C,+BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAClD;AAAA,8BAAC,UAAK,OAAO,EAAE,aAAa,EAAE,GAAI,iBAAM;AAAA,UACxC,oBAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GAC1D,2CACG;AAAA,sBAAU,WAAW,oBAAC,cAAW;AAAA,YACjC,UAAU,UAAU,oBAAC,SAAM;AAAA,YAC3B,UAAU,gBAAgB,oBAAC,cAAW;AAAA,YACtC,UAAU,kBAAkB,oBAAC,gBAAa;AAAA,aAC7C,GACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,gBAAa,MAAM,QACjB,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,8BAAC,gBAAc,GAAG,SAAS,KAAK,IAAI,SAAS,WAC1C,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["color"]}
1
+ {"version":3,"sources":["../../../../../../../../../src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useState } from 'react'\n\nimport {\n ResponsiveColorValue,\n TextStyleValue,\n} from '../../../../../../../prop-controllers/descriptors'\nimport { LinkData } from '@makeswift/prop-controllers'\n\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../../../hooks'\n\nimport { CaretDown8 } from '../../../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../../../icons/ChevronDown8'\n\nimport { Link } from '../../../../../../shared/Link'\nimport Button from '../../../../../Button'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../../../../../runtimes/react/use-style'\nimport {\n useResponsiveStyle,\n useResponsiveTextStyle,\n} from '../../../../../../utils/responsive-style'\n\ntype DropDownMenuBaseProps = {\n className?: string\n open: boolean\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, open, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({ display: open ? 'flex' : 'none', flexDirection: 'column', padding: 8 }),\n className,\n )}\n />\n )\n}\n\ntype ButtonLinkBaseProps = {\n className?: string\n}\n\ntype ButtonLinkProps = ButtonLinkBaseProps &\n Omit<ComponentPropsWithoutRef<typeof Button>, keyof ButtonLinkBaseProps>\n\nfunction ButtonLink({ className, ...restOfProps }: ButtonLinkProps) {\n return <Button {...restOfProps} className={cx(useStyle({ margin: '8px 0' }), className)} />\n}\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorValue\n textStyle?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ color, className, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData] as const, ([color]) => ({\n color: color == null ? 'black' : colorToString(color),\n })),\n ),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n onClose?: () => unknown\n caret?: string\n textColor?: ResponsiveColorValue\n color?: ResponsiveColorValue\n}\n\nexport default function MobileDropDownButton({\n label,\n caret,\n links = [],\n onClose = () => {},\n color,\n textColor,\n ...restOfProps\n}: Props): JSX.Element {\n const [isOpen, setIsOpen] = useState(false)\n return (\n <>\n <ButtonLink\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n onPointerDown={() => setIsOpen(prev => !prev)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n <>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </>\n </span>\n </div>\n </ButtonLink>\n <DropDownMenu open={isOpen}>\n {links.map(({ id, payload }) => (\n <DropDownItem {...payload} key={id} onClick={onClose}>\n {payload.label}\n </DropDownItem>\n ))}\n </DropDownMenu>\n </>\n )\n}\n"],"mappings":"AAmCI,SA2FQ,UA3FR,KA2FQ,YA3FR;AAsGM;AAzIV,SAAmC,gBAAgB;AAQnD,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAE7B,SAAS,YAAY;AACrB,OAAO,YAAY;AACnB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAUP,SAAS,aAAa,EAAE,WAAW,MAAM,GAAG,YAAY,GAAsB;AAC5E,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,OAAO,SAAS,QAAQ,eAAe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BAAM;AAAA,UACxC,oBAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GAC1D,2CACG;AAAA,sBAAU,WAAW,oBAAC,cAAW;AAAA,YACjC,UAAU,UAAU,oBAAC,SAAM;AAAA,YAC3B,UAAU,gBAAgB,oBAAC,cAAW;AAAA,YACtC,UAAU,kBAAkB,oBAAC,gBAAa;AAAA,aAC7C,GACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,gBAAa,MAAM,QACjB,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,8BAAC,gBAAc,GAAG,SAAS,KAAK,IAAI,SAAS,WAC1C,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["color"]}
@@ -1,12 +1,12 @@
1
- import dynamic from "next/dynamic";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
3
1
  import { Props } from "../../../prop-controllers";
4
2
  import { findBreakpointOverride, getBaseBreakpoint } from "../../../state/modules/breakpoints";
5
3
  import { MakeswiftComponentType } from "../constants";
6
4
  import { ComponentIcon } from "../../../state/modules/components-meta";
5
+ import { lazy } from "react";
6
+ import { Link } from "@makeswift/prop-controllers";
7
7
  function registerComponent(runtime) {
8
8
  return runtime.registerComponent(
9
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Navigation")))),
9
+ lazy(() => import("./Navigation")),
10
10
  {
11
11
  type: MakeswiftComponentType.Navigation,
12
12
  label: "Navigation",
@@ -44,7 +44,7 @@ function registerComponent(runtime) {
44
44
  label: "Logo alt text",
45
45
  hidden: props.showLogo === false
46
46
  })),
47
- logoLink: Props.Link((props) => ({
47
+ logoLink: Link((props) => ({
48
48
  label: "Logo on click",
49
49
  hidden: props.showLogo === false
50
50
  })),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props } from '../../../prop-controllers'\nimport { NavigationLinksValue, ResponsiveValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Navigation')))),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: Props.ElementID(),\n links: Props.NavigationLinks(),\n linkTextStyle: Props.TextStyle(props => {\n const links = props.links as NavigationLinksValue\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Props.Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Props.Image(props => ({\n label: 'Logo',\n hidden: props.showLogo === false,\n })),\n logoWidth: Props.ResponsiveLength(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden: props.showLogo === false,\n })),\n logoAltText: Props.TextInput(props => ({\n label: 'Logo alt text',\n hidden: props.showLogo === false,\n })),\n logoLink: Props.Link(props => ({\n label: 'Logo on click',\n hidden: props.showLogo === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AACpB,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAGtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEvB,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,cAAc,CAAC,CAAC,CAAC;AAAA,IAC3E;AAAA,MACE,MAAM,uBA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A,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { NavigationLinksValue, ResponsiveValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport { Link } from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Navigation')),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: Props.ElementID(),\n links: Props.NavigationLinks(),\n linkTextStyle: Props.TextStyle(props => {\n const links = props.links as NavigationLinksValue\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Props.Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Props.Image(props => ({\n label: 'Logo',\n hidden: props.showLogo === false,\n })),\n logoWidth: Props.ResponsiveLength(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden: props.showLogo === false,\n })),\n logoAltText: Props.TextInput(props => ({\n label: 'Logo alt text',\n hidden: props.showLogo === false,\n })),\n logoLink: Link(props => ({\n label: 'Logo on click',\n hidden: props.showLogo === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: Props.ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as ResponsiveValue<string>\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,cAAc,CAAC;AAAA,IACjC;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,gBAAgB;AAAA,QAC7B,eAAe,MAAM,UAAU,WAAS;AACtC,gBAAM,QAAQ,MAAM;AAEpB,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ,SAAS,QAAQ,MAAM,WAAW;AAAA,UAC5C;AAAA,QACF,CAAC;AAAA,QACD,UAAU,MAAM,SAAS,EAAE,QAAQ,MAAM,OAAO,YAAY,CAAC;AAAA,QAC7D,UAAU,MAAM,MAAM,YAAU;AAAA,UAC9B,OAAO;AAAA,UACP,QAAQ,MAAM,aAAa;AAAA,QAC7B,EAAE;AAAA,QACF,WAAW,MAAM,iBAAiB,YAAU;AAAA,UAC1C,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,YAClC;AAAA,UACF;AAAA,UACA,OAAO;AAAA,UACP,KAAK;AAAA,UACL,KAAK;AAAA;AAAA,UAEL,SAAS,CAAC,EAAE,OAAO,MAAM,OAAO,UAAU,MAAM,OAAO,CAAC;AAAA,UACxD,QAAQ,MAAM,aAAa;A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AA,QACF,CAAC;AAAA,QACD,0BAA0B,MAAM,gBAAgB,CAAC,OAAO,WAAW;AACjE,gBAAM,sBAAsB,MAAM;AAClC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,2BAA2B,MAAM,gBAAgB,CAAC,OAAO,WAAW;AAClE,gBAAM,sBAAsB,MAAM;AAClC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +1,9 @@
1
- import dynamic from "next/dynamic";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
3
1
  import { Props } from "../../../prop-controllers";
4
2
  import { MakeswiftComponentType } from "../constants";
3
+ import { lazy } from "react";
5
4
  function registerComponent(runtime) {
6
5
  return runtime.registerComponent(
7
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Root")))),
6
+ lazy(() => import("./Root")),
8
7
  {
9
8
  type: MakeswiftComponentType.Root,
10
9
  label: "Page",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Root/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\n\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../react'\nimport { MakeswiftComponentType } from '../constants'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Root')))),\n {\n type: MakeswiftComponentType.Root,\n label: 'Page',\n hidden: true,\n props: {\n children: Props.Grid(),\n backgrounds: Props.Backgrounds(),\n rowGap: Props.GapY(),\n columnGap: Props.GapX(),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAEpB,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AAEhC,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,IACrE;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,QACL,UAAU,MAAM,KAAK;AAAA,QACrB,aAAa,MAAM,YAAY;AAAA,QAC/B,QAAQ,MAAM,KAAK;AAAA,QACnB,WAAW,MAAM,KAAK;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Root/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../react'\nimport { MakeswiftComponentType } from '../constants'\nimport { lazy } from 'react'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Root')),\n {\n type: MakeswiftComponentType.Root,\n label: 'Page',\n hidden: true,\n props: {\n children: Props.Grid(),\n backgrounds: Props.Backgrounds(),\n rowGap: Props.GapY(),\n columnGap: Props.GapX(),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,QAAQ,CAAC;AAAA,IAC3B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,QACL,UAAU,MAAM,KAAK;AAAA,QACrB,aAAa,MAAM,YAAY;AAAA,QAC/B,QAAQ,MAAM,KAAK;AAAA,QACnB,WAAW,MAAM,KAAK;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,12 +1,11 @@
1
- import dynamic from "next/dynamic";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
3
1
  import { Props } from "../../../prop-controllers";
4
2
  import { getBaseBreakpoint } from "../../../state/modules/breakpoints";
5
3
  import { MakeswiftComponentType } from "../constants";
6
4
  import { ComponentIcon } from "../../../state/modules/components-meta";
5
+ import { lazy } from "react";
7
6
  function registerComponent(runtime) {
8
7
  return runtime.registerComponent(
9
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./SocialLinks")))),
8
+ lazy(() => import("./SocialLinks")),
10
9
  {
11
10
  type: MakeswiftComponentType.SocialLinks,
12
11
  label: "Social Links",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\n\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props } from '../../../prop-controllers'\nimport { SocialLinksValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./SocialLinks')))),\n {\n type: MakeswiftComponentType.SocialLinks,\n label: 'Social Links',\n icon: ComponentIcon.SocialLinks,\n props: {\n id: Props.ElementID(),\n links: Props.SocialLinks({\n preset: {\n links: [\n {\n id: 'facebook',\n payload: { type: 'facebook', url: 'https://www.facebook.com' },\n },\n {\n id: 'instagram',\n payload: { type: 'instagram', url: 'https://www.instagram.com' },\n },\n {\n id: 'twitter',\n payload: { type: 'twitter', url: 'https://www.twitter.com' },\n },\n ],\n openInNewTab: false,\n },\n }),\n shape: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue\n\n return {\n label: 'Shape',\n options: [\n { label: 'Naked', value: 'naked', icon: 'Star16' },\n { label: 'Circle', value: 'circle', icon: 'StarCircle16' },\n { label: 'Rounded', value: 'rounded', icon: 'StarRoundedSquare16' },\n { label: 'Square', value: 'square', icon: 'StarSquare16' },\n ],\n defaultValue: 'naked',\n hidden: links == null || links.links.length === 0,\n }\n }),\n size: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue\n\n return {\n label: 'Size',\n options: [\n { label: 'Small', value: 'small', icon: 'SizeSmall16' },\n { label: 'Medium', value: 'medium', icon: 'SizeMedium16' },\n { label: 'Large', value: 'large', icon: 'SizeLarge16' },\n ],\n defaultValue: 'medium',\n hidden: links == null || links.links.length === 0,\n }\n }),\n hoverStyle: Props.ResponsiveSelect(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'On hover',\n options: [\n { value: 'none', label: 'None' },\n { value: 'grow', label: 'Grow' },\n { value: 'shrink', label: 'Shrink' },\n { value: 'fade', label: 'Fade' },\n ],\n defaultValue: 'none',\n labelOrientation: 'horizontal',\n hidden,\n }\n }),\n fill: Props.ResponsiveColor(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Icon color',\n hidden,\n }\n }),\n backgroundColor: Props.ResponsiveColor(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Shape color',\n hidden,\n }\n }),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'flex-start', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'center', value: 'center', icon: 'AlignCenter16' },\n { label: 'flex-end', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'center',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({\n format: Props.Margin.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n marginTop: { value: 10, unit: 'px' },\n marginRight: 'auto',\n marginBottom: { value: 10, unit: 'px' },\n marginLeft: 'auto',\n },\n },\n ],\n }),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAEpB,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAGtB,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEvB,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,eAAe,CAAC,CAAC,CAAC;AAAA,IAC5E;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,YAAY;AAAA,UACvB,QAAQ;AAAA,YACN,OAAO;AAAA,cACL;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,YAAY,KAAK,2BAA2B;AAAA,cAC/D;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,aAAa,KAAK,4BAA4B;AAAA,cACjE;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE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,OAAO;AAAA,UACnB,QAAQ,MAAM,OAAO,OAAO;AAAA,UAC5B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACnC,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { SocialLinksValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./SocialLinks')),\n {\n type: MakeswiftComponentType.SocialLinks,\n label: 'Social Links',\n icon: ComponentIcon.SocialLinks,\n props: {\n id: Props.ElementID(),\n links: Props.SocialLinks({\n preset: {\n links: [\n {\n id: 'facebook',\n payload: { type: 'facebook', url: 'https://www.facebook.com' },\n },\n {\n id: 'instagram',\n payload: { type: 'instagram', url: 'https://www.instagram.com' },\n },\n {\n id: 'twitter',\n payload: { type: 'twitter', url: 'https://www.twitter.com' },\n },\n ],\n openInNewTab: false,\n },\n }),\n shape: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue\n\n return {\n label: 'Shape',\n options: [\n { label: 'Naked', value: 'naked', icon: 'Star16' },\n { label: 'Circle', value: 'circle', icon: 'StarCircle16' },\n { label: 'Rounded', value: 'rounded', icon: 'StarRoundedSquare16' },\n { label: 'Square', value: 'square', icon: 'StarSquare16' },\n ],\n defaultValue: 'naked',\n hidden: links == null || links.links.length === 0,\n }\n }),\n size: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue\n\n return {\n label: 'Size',\n options: [\n { label: 'Small', value: 'small', icon: 'SizeSmall16' },\n { label: 'Medium', value: 'medium', icon: 'SizeMedium16' },\n { label: 'Large', value: 'large', icon: 'SizeLarge16' },\n ],\n defaultValue: 'medium',\n hidden: links == null || links.links.length === 0,\n }\n }),\n hoverStyle: Props.ResponsiveSelect(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'On hover',\n options: [\n { value: 'none', label: 'None' },\n { value: 'grow', label: 'Grow' },\n { value: 'shrink', label: 'Shrink' },\n { value: 'fade', label: 'Fade' },\n ],\n defaultValue: 'none',\n labelOrientation: 'horizontal',\n hidden,\n }\n }),\n fill: Props.ResponsiveColor(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Icon color',\n hidden,\n }\n }),\n backgroundColor: Props.ResponsiveColor(props => {\n const links = props.links as SocialLinksValue\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Shape color',\n hidden,\n }\n }),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'flex-start', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'center', value: 'center', icon: 'AlignCenter16' },\n { label: 'flex-end', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'center',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({\n format: Props.Margin.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n marginTop: { value: 10, unit: 'px' },\n marginRight: 'auto',\n marginBottom: { value: 10, unit: 'px' },\n marginLeft: 'auto',\n },\n },\n ],\n }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,eAAe,CAAC;AAAA,IAClC;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,YAAY;AAAA,UACvB,QAAQ;AAAA,YACN,OAAO;AAAA,cACL;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,YAAY,KAAK,2BAA2B;AAAA,cAC/D;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,aAAa,KAAK,4BAA4B;AAAA,cACjE;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,WAAW,KAAK,0BAA0B;AAAA,cAC7D;AAAA,YACF;AAAA,YACA,cAAc;AAAA,UAChB;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM,yBAAyB,WAAS;AAC7C,gBAAM,QAAQ,MAAM;AAEpB,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,SAAS;AAAA,cACP,EAAE,OAAO,SAAS,OAAO,SAAS,MAAM,SAAS;AAAA,cACjD,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe;AAAA,cACzD,EAAE,OAAO,WAAW,OAAO,WAAW,MAAM,sBAAsB;AAAA,cAClE,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe;AAAA,YAC3D;AAAA,YACA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ACP;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,WAAW,MAAM,yBAAyB;AAAA,UACxC,OAAO;AAAA,UACP,SAAS;AAAA,YACP,EAAE,OAAO,cAAc,OAAO,cAAc,MAAM,cAAc;AAAA,YAChE,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,gBAAgB;AAAA,YAC1D,EAAE,OAAO,YAAY,OAAO,YAAY,MAAM,eAAe;AAAA,UAC/D;AAAA,UACA,cAAc;AAAA,QAChB,CAAC;AAAA,QACD,QAAQ,MAAM,KAAK;AAAA,UACjB,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,YACjC;AAAA,UACF;AAAA,UACA,OAAO;AAAA,UACP,KAAK;AAAA,UACL,KAAK;AAAA,UACL,MAAM;AAAA,UACN,cAAc,EAAE,OAAO,GAAG,MAAM,KAAK;AAAA,QACvC,CAAC;AAAA,QACD,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO;AAAA,UACnB,QAAQ,MAAM,OAAO,OAAO;AAAA,UAC5B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACnC,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -2,11 +2,10 @@ import { Props } from "../../../prop-controllers";
2
2
  import { MakeswiftComponentType } from "../constants";
3
3
  import { getBaseBreakpoint } from "../../../state/modules/breakpoints";
4
4
  import { RichText } from "../../../controls/rich-text-v2/rich-text-v2";
5
- import { forwardNextDynamicRef } from "../../../next/dynamic";
6
- import dynamic from "next/dynamic";
5
+ import { lazy } from "react";
7
6
  function registerComponent(runtime) {
8
7
  return runtime.registerComponent(
9
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Text")))),
8
+ lazy(() => import("./Text")),
10
9
  {
11
10
  type: MakeswiftComponentType.Text,
12
11
  label: "Text",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Text/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { RichText } from '../../../controls/rich-text-v2/rich-text-v2'\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport dynamic from 'next/dynamic'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Text')))),\n {\n type: MakeswiftComponentType.Text,\n label: 'Text',\n props: {\n id: Props.ElementID(),\n text: RichText(),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 700, unit: 'px' },\n },\n ],\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({\n format: Props.Margin.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n marginTop: null,\n marginRight: 'auto',\n marginBottom: { value: 20, unit: 'px' },\n marginLeft: 'auto',\n },\n },\n ],\n }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,6BAA6B;AACtC,OAAO,aAAa;AAEb,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;AAAA,IACrE;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,MAAM,SAAS;AAAA,QACf,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,YAClC;AAAA,UACF;AAAA,UACA,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO;AAAA,UACnB,QAAQ,MAAM,OAAO,OAAO;AAAA,UAC5B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW;AAAA,gBACX,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Text/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { RichText } from '../../../controls/rich-text-v2/rich-text-v2'\nimport { lazy } from 'react'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Text')),\n {\n type: MakeswiftComponentType.Text,\n label: 'Text',\n props: {\n id: Props.ElementID(),\n text: RichText(),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 700, unit: 'px' },\n },\n ],\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Props.Margin({\n format: Props.Margin.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n marginTop: null,\n marginRight: 'auto',\n marginBottom: { value: 20, unit: 'px' },\n marginLeft: 'auto',\n },\n },\n ],\n }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,QAAQ,CAAC;AAAA,IAC3B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,MAAM,SAAS;AAAA,QACf,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,YAClC;AAAA,UACF;AAAA,UACA,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO;AAAA,UACnB,QAAQ,MAAM,OAAO,OAAO;AAAA,UAC5B,QAAQ;AAAA,YACN;AAAA,cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW;AAAA,gBACX,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { cx } from "@emotion/css";
3
4
  import { forwardRef, useEffect, useState } from "react";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.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AM,KAAK,KAAI,qBAAoB,GAE3E,GACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,gBAAQ;","names":["Video"]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Video/Video.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"mappings":";AAgDY;AA9CZ,SAAS,UAAU;AACnB,SAAS,YAA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1
- import dynamic from "next/dynamic";
2
- import { forwardNextDynamicRef } from "../../../next/dynamic";
3
1
  import { Props } from "../../../prop-controllers";
4
2
  import { MakeswiftComponentType } from "../constants";
5
3
  import { ComponentIcon } from "../../../state/modules/components-meta";
4
+ import { lazy } from "react";
6
5
  function registerComponent(runtime) {
7
6
  return runtime.registerComponent(
8
- forwardNextDynamicRef((patch) => dynamic(() => patch(import("./Video")))),
7
+ lazy(() => import("./Video")),
9
8
  {
10
9
  type: MakeswiftComponentType.Video,
11
10
  label: "Video",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Video/register.ts"],"sourcesContent":["import dynamic from 'next/dynamic'\n\nimport { forwardNextDynamicRef } from '../../../next/dynamic'\nimport { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n forwardNextDynamicRef(patch => dynamic(() => patch(import('./Video')))),\n {\n type: MakeswiftComponentType.Video,\n label: 'Video',\n icon: ComponentIcon.Video,\n props: {\n id: Props.ElementID(),\n video: Props.Video({ preset: { controls: true } }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 560, unit: 'px' },\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n borderRadius: Props.BorderRadius({ format: Props.BorderRadius.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAEpB,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEvB,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,sBAAsB,WAAS,QAAQ,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC;AAAA,IACtE;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,MAAM,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE,CAAC;AAAA,QACjD,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,cAAc,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,QACzC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,cAAc,MAAM,aAAa,EAAE,QAAQ,MAAM,aAAa,OAAO,UAAU,CAAC;AAAA,MAClF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Video/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Video')),\n {\n type: MakeswiftComponentType.Video,\n label: 'Video',\n icon: ComponentIcon.Video,\n props: {\n id: Props.ElementID(),\n video: Props.Video({ preset: { controls: true } }),\n width: Props.Width({\n format: Props.Width.Format.ClassName,\n defaultValue: { value: 560, unit: 'px' },\n }),\n margin: Props.Margin({ format: Props.Margin.Format.ClassName }),\n borderRadius: Props.BorderRadius({ format: Props.BorderRadius.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAEd,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,SAAS,CAAC;AAAA,IAC5B;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,MAAM,EAAE,QAAQ,EAAE,UAAU,KAAK,EAAE,CAAC;AAAA,QACjD,OAAO,MAAM,MAAM;AAAA,UACjB,QAAQ,MAAM,MAAM,OAAO;AAAA,UAC3B,cAAc,EAAE,OAAO,KAAK,MAAM,KAAK;AAAA,QACzC,CAAC;AAAA,QACD,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;AAAA,QAC9D,cAAc,MAAM,aAAa,EAAE,QAAQ,MAAM,aAAa,OAAO,UAAU,CAAC;AAAA,MAClF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -3,4 +3,5 @@ export * from "./useBorder";
3
3
  export * from "./useBoxShadow";
4
4
  export * from "./useResponsiveColor";
5
5
  export * from "./useMediaQuery";
6
+ export * from "./usePropControllerLinkData";
6
7
  //# sourceMappingURL=index.js.map