@makeswift/runtime 0.26.2 → 0.26.3-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 (236) hide show
  1. package/dist/cjs/api-handler/handlers/manifest.js +1 -1
  2. package/dist/cjs/client/index.js +3 -3
  3. package/dist/cjs/components/builtin/Button/Button.js.map +1 -1
  4. package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
  5. package/dist/cjs/components/builtin/Embed/Embed.js +3 -1
  6. package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
  7. package/dist/cjs/components/builtin/Form/components/Field/components/Label/index.js.map +1 -1
  8. package/dist/cjs/components/builtin/Form/components/Field/components/PlaceholderTableField/index.js.map +1 -1
  9. package/dist/cjs/components/builtin/Form/components/Field/index.js.map +1 -1
  10. package/dist/cjs/components/builtin/Form/components/Placeholder/index.js.map +1 -1
  11. package/dist/cjs/components/builtin/Form/components/Spinner/index.js.map +1 -1
  12. package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
  13. package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  14. package/dist/cjs/components/builtin/Navigation/components/LinksPlaceholder/index.js.map +1 -1
  15. package/dist/cjs/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  16. package/dist/cjs/components/builtin/Navigation/components/MobileMenu/index.js.map +1 -1
  17. package/dist/cjs/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.js.map +1 -1
  18. package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
  19. package/dist/cjs/components/shared/BackgroundsContainer/components/Backgrounds/index.js.map +1 -1
  20. package/dist/cjs/components/shared/BackgroundsContainer/components/Parallax/index.js.map +1 -1
  21. package/dist/cjs/controls/rich-text-v2/plugin.js.map +1 -1
  22. package/dist/cjs/next/components/framework-provider/pages-router/HeadSnippet.js.map +1 -1
  23. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js +2 -3
  24. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  25. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js +102 -0
  26. package/dist/cjs/next/components/tests/makeswift-component/fixtures.js.map +1 -0
  27. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js +6 -6
  28. package/dist/cjs/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  29. package/dist/cjs/next/testing/page-rendering.js +3 -3
  30. package/dist/cjs/next/testing/page-rendering.js.map +1 -1
  31. package/dist/cjs/runtimes/react/components/Document.js.map +1 -1
  32. package/dist/cjs/runtimes/react/components/DocumentRoot.js.map +1 -1
  33. package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
  34. package/dist/cjs/runtimes/react/components/ElementData.js +2 -2
  35. package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
  36. package/dist/cjs/runtimes/react/components/ElementReference.js.map +1 -1
  37. package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
  38. package/dist/cjs/runtimes/react/components/LiveProvider.js.map +1 -1
  39. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js +2 -2
  40. package/dist/cjs/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  41. package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +1 -1
  42. package/dist/cjs/runtimes/react/components/activity-with-fallback.js +54 -0
  43. package/dist/cjs/runtimes/react/components/activity-with-fallback.js.map +1 -0
  44. package/dist/cjs/runtimes/react/components/page/HeadSnippet.js.map +1 -1
  45. package/dist/cjs/runtimes/react/components/page/Page.js.map +1 -1
  46. package/dist/cjs/runtimes/react/components/page/PageHead.js.map +1 -1
  47. package/dist/cjs/runtimes/react/components/page/head-tags.js.map +1 -1
  48. package/dist/cjs/runtimes/react/components/page/index.js +2 -1
  49. package/dist/cjs/runtimes/react/components/page/index.js.map +1 -1
  50. package/dist/cjs/runtimes/react/components/render-hook.js.map +1 -1
  51. package/dist/cjs/runtimes/react/controls/control.js.map +1 -1
  52. package/dist/cjs/runtimes/react/controls/group.js.map +1 -1
  53. package/dist/cjs/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.js.map +1 -1
  54. package/dist/cjs/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js.map +1 -1
  55. package/dist/cjs/runtimes/react/controls/slot.js.map +1 -1
  56. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  57. package/dist/cjs/runtimes/react/find-dom-node.js +2 -0
  58. package/dist/cjs/runtimes/react/find-dom-node.js.map +1 -1
  59. package/dist/cjs/runtimes/react/hooks/makeswift-api.js +2 -2
  60. package/dist/cjs/runtimes/react/hooks/makeswift-api.js.map +1 -1
  61. package/dist/cjs/runtimes/react/legacy-controls.js.map +1 -1
  62. package/dist/cjs/runtimes/react/lib/react-dom.js +2 -1
  63. package/dist/cjs/runtimes/react/lib/react-dom.js.map +1 -1
  64. package/dist/cjs/runtimes/react/react-runtime-core.js +6 -0
  65. package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
  66. package/dist/cjs/runtimes/react/use-global-style.js +1 -1
  67. package/dist/cjs/runtimes/react/use-global-style.js.map +1 -1
  68. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  69. package/dist/esm/client/index.js +3 -3
  70. package/dist/esm/components/builtin/Button/Button.js.map +1 -1
  71. package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
  72. package/dist/esm/components/builtin/Embed/Embed.js +3 -1
  73. package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
  74. package/dist/esm/components/builtin/Form/components/Field/components/Label/index.js.map +1 -1
  75. package/dist/esm/components/builtin/Form/components/Field/components/PlaceholderTableField/index.js.map +1 -1
  76. package/dist/esm/components/builtin/Form/components/Field/index.js.map +1 -1
  77. package/dist/esm/components/builtin/Form/components/Placeholder/index.js.map +1 -1
  78. package/dist/esm/components/builtin/Form/components/Spinner/index.js.map +1 -1
  79. package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
  80. package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  81. package/dist/esm/components/builtin/Navigation/components/LinksPlaceholder/index.js.map +1 -1
  82. package/dist/esm/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  83. package/dist/esm/components/builtin/Navigation/components/MobileMenu/index.js.map +1 -1
  84. package/dist/esm/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.js.map +1 -1
  85. package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
  86. package/dist/esm/components/shared/BackgroundsContainer/components/Backgrounds/index.js.map +1 -1
  87. package/dist/esm/components/shared/BackgroundsContainer/components/Parallax/index.js.map +1 -1
  88. package/dist/esm/controls/rich-text-v2/plugin.js.map +1 -1
  89. package/dist/esm/next/components/framework-provider/pages-router/HeadSnippet.js.map +1 -1
  90. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js +1 -2
  91. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  92. package/dist/esm/next/components/tests/makeswift-component/fixtures.js +61 -0
  93. package/dist/esm/next/components/tests/makeswift-component/fixtures.js.map +1 -0
  94. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js +1 -1
  95. package/dist/esm/next/components/tests/prop-controllers/page-prop-controller.js.map +1 -1
  96. package/dist/esm/next/testing/page-rendering.js +1 -1
  97. package/dist/esm/next/testing/page-rendering.js.map +1 -1
  98. package/dist/esm/runtimes/react/components/Document.js.map +1 -1
  99. package/dist/esm/runtimes/react/components/DocumentRoot.js.map +1 -1
  100. package/dist/esm/runtimes/react/components/Element.js.map +1 -1
  101. package/dist/esm/runtimes/react/components/ElementData.js +3 -3
  102. package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
  103. package/dist/esm/runtimes/react/components/ElementReference.js.map +1 -1
  104. package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
  105. package/dist/esm/runtimes/react/components/LiveProvider.js.map +1 -1
  106. package/dist/esm/runtimes/react/components/MakeswiftComponent.js +3 -3
  107. package/dist/esm/runtimes/react/components/MakeswiftComponent.js.map +1 -1
  108. package/dist/esm/runtimes/react/components/PreviewProvider.js.map +1 -1
  109. package/dist/esm/runtimes/react/components/activity-with-fallback.js +19 -0
  110. package/dist/esm/runtimes/react/components/activity-with-fallback.js.map +1 -0
  111. package/dist/esm/runtimes/react/components/page/HeadSnippet.js.map +1 -1
  112. package/dist/esm/runtimes/react/components/page/Page.js.map +1 -1
  113. package/dist/esm/runtimes/react/components/page/PageHead.js.map +1 -1
  114. package/dist/esm/runtimes/react/components/page/head-tags.js.map +1 -1
  115. package/dist/esm/runtimes/react/components/page/index.js +3 -2
  116. package/dist/esm/runtimes/react/components/page/index.js.map +1 -1
  117. package/dist/esm/runtimes/react/components/render-hook.js.map +1 -1
  118. package/dist/esm/runtimes/react/controls/control.js.map +1 -1
  119. package/dist/esm/runtimes/react/controls/group.js.map +1 -1
  120. package/dist/esm/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.js.map +1 -1
  121. package/dist/esm/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js.map +1 -1
  122. package/dist/esm/runtimes/react/controls/slot.js.map +1 -1
  123. package/dist/esm/runtimes/react/controls.js.map +1 -1
  124. package/dist/esm/runtimes/react/find-dom-node.js +2 -0
  125. package/dist/esm/runtimes/react/find-dom-node.js.map +1 -1
  126. package/dist/esm/runtimes/react/hooks/makeswift-api.js +2 -2
  127. package/dist/esm/runtimes/react/hooks/makeswift-api.js.map +1 -1
  128. package/dist/esm/runtimes/react/legacy-controls.js.map +1 -1
  129. package/dist/esm/runtimes/react/lib/react-dom.js +2 -1
  130. package/dist/esm/runtimes/react/lib/react-dom.js.map +1 -1
  131. package/dist/esm/runtimes/react/react-runtime-core.js +6 -0
  132. package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
  133. package/dist/esm/runtimes/react/use-global-style.js +1 -1
  134. package/dist/esm/runtimes/react/use-global-style.js.map +1 -1
  135. package/dist/types/components/builtin/Button/Button.d.ts +2 -2
  136. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  137. package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  138. package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
  139. package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts +2 -2
  140. package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
  141. package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts +2 -1
  142. package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts.map +1 -1
  143. package/dist/types/components/builtin/Form/components/Field/index.d.ts +2 -1
  144. package/dist/types/components/builtin/Form/components/Field/index.d.ts.map +1 -1
  145. package/dist/types/components/builtin/Form/components/Spinner/index.d.ts +2 -1
  146. package/dist/types/components/builtin/Form/components/Spinner/index.d.ts.map +1 -1
  147. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts +2 -2
  148. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  149. package/dist/types/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts +2 -1
  150. package/dist/types/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts.map +1 -1
  151. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +2 -2
  152. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  153. package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts +2 -1
  154. package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  155. package/dist/types/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts +2 -1
  156. package/dist/types/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts.map +1 -1
  157. package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts +2 -1
  158. package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
  159. package/dist/types/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts +2 -1
  160. package/dist/types/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts.map +1 -1
  161. package/dist/types/components/shared/BackgroundsContainer/components/Parallax/index.d.ts +1 -1
  162. package/dist/types/components/shared/BackgroundsContainer/components/Parallax/index.d.ts.map +1 -1
  163. package/dist/types/components/shared/ErrorBoundary.d.ts +1 -1
  164. package/dist/types/controls/rich-text-v2/plugin.d.ts +7 -7
  165. package/dist/types/controls/rich-text-v2/plugin.d.ts.map +1 -1
  166. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts.map +1 -1
  167. package/dist/types/next/components/tests/global-element-rendering.test.d.ts +1 -1
  168. package/dist/types/next/components/tests/global-element-rendering.test.d.ts.map +1 -1
  169. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts +27 -0
  170. package/dist/types/next/components/tests/makeswift-component/fixtures.d.ts.map +1 -0
  171. package/dist/types/next/components/tests/{makeswift-component-rendering.test.d.ts → makeswift-component/rendering.react18.test.d.ts} +1 -1
  172. package/dist/types/next/components/tests/makeswift-component/rendering.react18.test.d.ts.map +1 -0
  173. package/dist/types/next/components/tests/makeswift-component/rendering.test.d.ts +3 -0
  174. package/dist/types/next/components/tests/makeswift-component/rendering.test.d.ts.map +1 -0
  175. package/dist/types/next/testing/page-rendering.d.ts.map +1 -1
  176. package/dist/types/runtimes/react/components/Document.d.ts +1 -1
  177. package/dist/types/runtimes/react/components/Document.d.ts.map +1 -1
  178. package/dist/types/runtimes/react/components/DocumentRoot.d.ts +1 -1
  179. package/dist/types/runtimes/react/components/DocumentRoot.d.ts.map +1 -1
  180. package/dist/types/runtimes/react/components/Element.d.ts +1 -1
  181. package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
  182. package/dist/types/runtimes/react/components/ElementData.d.ts +1 -1
  183. package/dist/types/runtimes/react/components/ElementData.d.ts.map +1 -1
  184. package/dist/types/runtimes/react/components/ElementReference.d.ts +1 -1
  185. package/dist/types/runtimes/react/components/ElementReference.d.ts.map +1 -1
  186. package/dist/types/runtimes/react/components/LiveProvider.d.ts +2 -2
  187. package/dist/types/runtimes/react/components/LiveProvider.d.ts.map +1 -1
  188. package/dist/types/runtimes/react/components/MakeswiftComponent.d.ts.map +1 -1
  189. package/dist/types/runtimes/react/components/PreviewProvider.d.ts +2 -2
  190. package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  191. package/dist/types/runtimes/react/components/activity-with-fallback.d.ts +13 -0
  192. package/dist/types/runtimes/react/components/activity-with-fallback.d.ts.map +1 -0
  193. package/dist/types/runtimes/react/components/page/HeadSnippet.d.ts +2 -1
  194. package/dist/types/runtimes/react/components/page/HeadSnippet.d.ts.map +1 -1
  195. package/dist/types/runtimes/react/components/page/Page.d.ts +2 -1
  196. package/dist/types/runtimes/react/components/page/Page.d.ts.map +1 -1
  197. package/dist/types/runtimes/react/components/page/PageHead.d.ts +2 -1
  198. package/dist/types/runtimes/react/components/page/PageHead.d.ts.map +1 -1
  199. package/dist/types/runtimes/react/components/page/head-tags.d.ts.map +1 -1
  200. package/dist/types/runtimes/react/components/page/index.d.ts.map +1 -1
  201. package/dist/types/runtimes/react/components/render-hook.d.ts +3 -2
  202. package/dist/types/runtimes/react/components/render-hook.d.ts.map +1 -1
  203. package/dist/types/runtimes/react/controls/control.d.ts +3 -2
  204. package/dist/types/runtimes/react/controls/control.d.ts.map +1 -1
  205. package/dist/types/runtimes/react/controls/group.d.ts +3 -2
  206. package/dist/types/runtimes/react/controls/group.d.ts.map +1 -1
  207. package/dist/types/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
  208. package/dist/types/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
  209. package/dist/types/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +2 -1
  210. package/dist/types/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  211. package/dist/types/runtimes/react/controls/slot.d.ts +2 -2
  212. package/dist/types/runtimes/react/controls/slot.d.ts.map +1 -1
  213. package/dist/types/runtimes/react/controls.d.ts +3 -2
  214. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  215. package/dist/types/runtimes/react/find-dom-node.d.ts.map +1 -1
  216. package/dist/types/runtimes/react/legacy-controls.d.ts +2 -1
  217. package/dist/types/runtimes/react/legacy-controls.d.ts.map +1 -1
  218. package/dist/types/runtimes/react/lib/react-dom.d.ts.map +1 -1
  219. package/dist/types/runtimes/react/react-runtime-core.d.ts +5 -0
  220. package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
  221. package/dist/types/slate/BlockPlugin/index.d.ts +2 -2
  222. package/dist/types/slate/InlineModePlugin/index.d.ts +2 -2
  223. package/dist/types/slate/InlinePlugin/index.d.ts +2 -2
  224. package/dist/types/slate/LinkPlugin/index.d.ts +2 -2
  225. package/dist/types/slate/TextAlignPlugin/index.d.ts +2 -2
  226. package/dist/types/slate/TypographyPlugin/index.d.ts +2 -2
  227. package/dist/types/slate/test-helpers/editor-v1.d.ts +1 -0
  228. package/dist/types/slate/test-helpers/editor-v1.d.ts.map +1 -1
  229. package/dist/types/slate/test-helpers/editor-v2-inline.d.ts +1 -0
  230. package/dist/types/slate/test-helpers/editor-v2-inline.d.ts.map +1 -1
  231. package/dist/types/slate/test-helpers/editor-v2.d.ts +1 -0
  232. package/dist/types/slate/test-helpers/editor-v2.d.ts.map +1 -1
  233. package/dist/types/slate/test-helpers/test-elements.d.ts +1 -1
  234. package/dist/types/slate/test-helpers/test-elements.d.ts.map +1 -1
  235. package/package.json +9 -6
  236. package/dist/types/next/components/tests/makeswift-component-rendering.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/Form/components/Placeholder/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref } from 'react'\n\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nfunction Label() {\n return (\n <div\n className={useStyle({\n maxWidth: 120,\n minWidth: 60,\n height: 8,\n borderRadius: 2,\n backgroundColor: '#a1a8c2',\n opacity: 0.4,\n marginBottom: 8,\n })}\n />\n )\n}\n\nfunction Input() {\n return (\n <div\n className={useStyle({\n minWidth: 80,\n height: 32,\n borderRadius: 4,\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: '#a1a8c2',\n opacity: 0.4,\n })}\n />\n )\n}\n\nfunction Button() {\n return (\n <div\n className={useStyle({\n minWidth: 140,\n height: 32,\n borderRadius: 4,\n backgroundColor: '#a1a8c2',\n opacity: 0.4,\n })}\n />\n )\n}\n\ntype Props = {\n className?: string\n width?: string\n margin?: string\n}\n\nexport default forwardRef(function Placeholder(\n { className, width, margin }: Props,\n ref: Ref<HTMLDivElement>,\n): JSX.Element {\n return (\n <div\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column' }),\n width,\n margin,\n className,\n )}\n >\n <div style={{ display: 'flex', flexDirection: 'column', marginBottom: 16 }}>\n <Label />\n <Input />\n </div>\n <div style={{ display: 'flex', flexDirection: 'column', marginBottom: 16 }}>\n <Label />\n <Input />\n </div>\n <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-end' }}>\n <Button />\n </div>\n </div>\n )\n})\n"],"mappings":"AAOI,cAgEE,YAhEF;AAPJ,SAAS,UAAU;AACnB,SAAS,kBAAuB;AAEhC,SAAS,gBAAgB;AAEzB,SAAS,QAAQ;AACf,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,SAAS;AAAA,QACT,cAAc;AAAA,MAChB,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,QAAQ;AACf,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,aAAa;AAAA,QACb,aAAa;AAAA,QACb,aAAa;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,SAAS;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAQA,IAAO,sBAAQ,WAAW,SAAS,YACjC,EAAE,WAAW,OAAO,OAAO,GAC3B,KACa;AACb,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,QAAQ,eAAe,SAAS,CAAC;AAAA,QACrD;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,cAAc,GAAG,GACvE;AAAA,8BAAC,SAAM;AAAA,UACP,oBAAC,SAAM;AAAA,WACT;AAAA,QACA,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,cAAc,GAAG,GACvE;AAAA,8BAAC,SAAM;AAAA,UACP,oBAAC,SAAM;AAAA,WACT;AAAA,QACA,oBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,gBAAgB,WAAW,GACjF,8BAAC,UAAO,GACV;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/Form/components/Placeholder/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, ReactNode } from 'react'\n\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nfunction Label() {\n return (\n <div\n className={useStyle({\n maxWidth: 120,\n minWidth: 60,\n height: 8,\n borderRadius: 2,\n backgroundColor: '#a1a8c2',\n opacity: 0.4,\n marginBottom: 8,\n })}\n />\n )\n}\n\nfunction Input() {\n return (\n <div\n className={useStyle({\n minWidth: 80,\n height: 32,\n borderRadius: 4,\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: '#a1a8c2',\n opacity: 0.4,\n })}\n />\n )\n}\n\nfunction Button() {\n return (\n <div\n className={useStyle({\n minWidth: 140,\n height: 32,\n borderRadius: 4,\n backgroundColor: '#a1a8c2',\n opacity: 0.4,\n })}\n />\n )\n}\n\ntype Props = {\n className?: string\n width?: string\n margin?: string\n}\n\nexport default forwardRef(function Placeholder(\n { className, width, margin }: Props,\n ref: Ref<HTMLDivElement>,\n): ReactNode {\n return (\n <div\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column' }),\n width,\n margin,\n className,\n )}\n >\n <div style={{ display: 'flex', flexDirection: 'column', marginBottom: 16 }}>\n <Label />\n <Input />\n </div>\n <div style={{ display: 'flex', flexDirection: 'column', marginBottom: 16 }}>\n <Label />\n <Input />\n </div>\n <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-end' }}>\n <Button />\n </div>\n </div>\n )\n})\n"],"mappings":"AAOI,cAgEE,YAhEF;AAPJ,SAAS,UAAU;AACnB,SAAS,kBAAkC;AAE3C,SAAS,gBAAgB;AAEzB,SAAS,QAAQ;AACf,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,SAAS;AAAA,QACT,cAAc;AAAA,MAChB,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,QAAQ;AACf,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,aAAa;AAAA,QACb,aAAa;AAAA,QACb,aAAa;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,SAAS;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAQA,IAAO,sBAAQ,WAAW,SAAS,YACjC,EAAE,WAAW,OAAO,OAAO,GAC3B,KACW;AACX,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,QAAQ,eAAe,SAAS,CAAC;AAAA,QACrD;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,cAAc,GAAG,GACvE;AAAA,8BAAC,SAAM;AAAA,UACP,oBAAC,SAAM;AAAA,WACT;AAAA,QACA,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,cAAc,GAAG,GACvE;AAAA,8BAAC,SAAM;AAAA,UACP,oBAAC,SAAM;AAAA,WACT;AAAA,QACA,oBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,gBAAgB,WAAW,GACjF,8BAAC,UAAO,GACV;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/Form/components/Spinner/index.tsx"],"sourcesContent":["import { keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Spinner20 } from '../../../../icons/Spinner20'\n\nconst spin = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n`\n\nexport default function Spinner(): JSX.Element {\n return (\n <Spinner20\n className={useStyle({\n display: 'inline-flex',\n animation: `${spin} 1s linear infinite`,\n stroke: 'currentColor',\n })}\n />\n )\n}\n"],"mappings":"AAeI;AAfJ,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASE,SAAR,UAAwC;AAC7C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,SAAS;AAAA,QACT,WAAW,GAAG,IAAI;AAAA,QAClB,QAAQ;AAAA,MACV,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/Form/components/Spinner/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport { keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { Spinner20 } from '../../../../icons/Spinner20'\n\nconst spin = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n`\n\nexport default function Spinner(): ReactNode {\n return (\n <Spinner20\n className={useStyle({\n display: 'inline-flex',\n animation: `${spin} 1s linear infinite`,\n stroke: 'currentColor',\n })}\n />\n )\n}\n"],"mappings":"AAgBI;AAfJ,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASE,SAAR,UAAsC;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,SAAS;AAAA,QACT,WAAW,GAAG,IAAI;AAAA,QAClB,QAAQ;AAAA,MACV,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1 +1 @@
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 type ImageData,\n type LinkData,\n type NavigationButtonData,\n type NavigationLinksData,\n type ResponsiveGapData,\n type ResponsiveLengthData,\n type ResponsiveIconRadioGroupValue,\n type ResponsiveTextStyleData,\n type ResponsiveValue,\n type ResponsiveSelectValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color, type ResponsiveColor } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\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?: string\n links?: NavigationLinksData\n linkTextStyle?: ResponsiveTextStyleData\n showLogo?: boolean\n logoFile?: ImageData\n logoWidth?: ResponsiveLengthData\n logoAltText?: string\n logoLink?: LinkData\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: ResponsiveGapData\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 = NavigationButtonData['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":";AAkEI,cAwKU,YAxKV;AAhEJ,SAAiD,YAAY,gBAAgB;AAE7E,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AAevB,SAAS,qBAAqB;AAC9B,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;A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,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, ReactNode } 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 type ImageData,\n type LinkData,\n type NavigationButtonData,\n type NavigationLinksData,\n type ResponsiveGapData,\n type ResponsiveLengthData,\n type ResponsiveIconRadioGroupValue,\n type ResponsiveTextStyleData,\n type ResponsiveValue,\n type ResponsiveSelectValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color, type ResponsiveColor } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\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?: string\n links?: NavigationLinksData\n linkTextStyle?: ResponsiveTextStyleData\n showLogo?: boolean\n logoFile?: ImageData\n logoWidth?: ResponsiveLengthData\n logoAltText?: string\n logoLink?: LinkData\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: ResponsiveGapData\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 = NavigationButtonData['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): ReactNode {\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":";AAkEI,cAwKU,YAxKV;AAhEJ,SAAiD,YAAY,gBAA2B;AAExF,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB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,MAEC;AAAA,qBAAa,QACZ;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,MAAM;AAAA,YACN,MAAM;AAAA,YACN;AAAA,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 +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 { 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, ResponsiveColorData, ResponsiveTextStyleData } 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?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\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?: ResponsiveColorData\n color?: ResponsiveColorData\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":"AAgCI,cAqKM,YArKN;AA+KM;AA/MV,SAAiD,YAAY,QAAQ,gBAAgB;AAErF,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS,YAAY;AACrB,OAAO,YAAY;AACnB,SAAS,iCAAiC;AAC1C,SAAS,IAAI,iBAAiB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,oB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aAC3C,UAAU,QAAQ,aAAa,sBACjC;AACA,kBAAY,OAAO;AAAA,IACrB,OAAO;AACL,kBAAY,MAAM;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE,qBAAC,qBAAkB,KAAK,WACtB;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,WAAW,mBAAmB,SAAS;AAAA,QACvC,OAAO,mBAAmB,KAAK;AAAA,QAE/B,+BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAClD;AAAA,8BAAC,UAAK,OAAO,EAAE,aAAa,EAAE,GAAI,iBAAM;AAAA,UACxC,qBAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GACzD;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;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, ReactNode } from 'react'\n\nimport { CaretDown8 } from '../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../icons/ChevronDown8'\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, ResponsiveColorData, ResponsiveTextStyleData } 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?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\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?: ResponsiveColorData\n color?: ResponsiveColorData\n}\n\nexport default function DropDownButton({\n label,\n caret = 'caret',\n links = [],\n textColor,\n color,\n ...restOfProps\n}: Props): ReactNode {\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":"AAgCI,cAqKM,YArKN;AA+KM;AA/MV,SAAiD,YAAY,QAAQ,gBAA2B;AAEhG,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,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;AAG3D,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,U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AAA,QACJ,WAAW,mBAAmB,SAAS;AAAA,QACvC,OAAO,mBAAmB,KAAK;AAAA,QAE/B,+BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAClD;AAAA,8BAAC,UAAK,OAAO,EAAE,aAAa,EAAE,GAAI,iBAAM;AAAA,UACxC,qBAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GACzD;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;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 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/LinksPlaceholder/index.tsx"],"sourcesContent":["import { ResponsiveLengthData } from '@makeswift/prop-controllers'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport GutterContainer from '../../../../shared/GutterContainer'\n\ntype PlaceholderLinkProps = {\n width: number\n button?: boolean\n}\n\nfunction PlaceholderLink({ width, button }: PlaceholderLinkProps) {\n return (\n <div\n className={useStyle({\n width,\n height: button === true ? 32 : 8,\n backgroundColor: '#a1a8c2',\n borderRadius: button === true ? 6 : 2,\n opacity: 0.4,\n })}\n />\n )\n}\n\ntype Props = { gutter?: ResponsiveLengthData }\n\nconst links = [{ width: 50 }, { width: 70 }, { width: 60 }, { width: 80, button: true }]\n\nexport default function LinksPlaceholder({ gutter }: Props): JSX.Element {\n return (\n <>\n {links.map((link, i) => (\n <GutterContainer key={i} gutter={gutter} first={i === 0} last={i === links.length - 1}>\n <PlaceholderLink {...link} />\n </GutterContainer>\n ))}\n </>\n )\n}\n"],"mappings":"AAWI,SAkBA,UAlBA;AAVJ,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAO5B,SAAS,gBAAgB,EAAE,OAAO,OAAO,GAAyB;AAChE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB;AAAA,QACA,QAAQ,WAAW,OAAO,KAAK;AAAA,QAC/B,iBAAiB;AAAA,QACjB,cAAc,WAAW,OAAO,IAAI;AAAA,QACpC,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAIA,MAAM,QAAQ,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,IAAI,QAAQ,KAAK,CAAC;AAExE,SAAR,iBAAkC,EAAE,OAAO,GAAuB;AACvE,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,MAChB,oBAAC,mBAAwB,QAAgB,OAAO,MAAM,GAAG,MAAM,MAAM,MAAM,SAAS,GAClF,8BAAC,mBAAiB,GAAG,MAAM,KADP,CAEtB,CACD,GACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/LinksPlaceholder/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport { ResponsiveLengthData } from '@makeswift/prop-controllers'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport GutterContainer from '../../../../shared/GutterContainer'\n\ntype PlaceholderLinkProps = {\n width: number\n button?: boolean\n}\n\nfunction PlaceholderLink({ width, button }: PlaceholderLinkProps) {\n return (\n <div\n className={useStyle({\n width,\n height: button === true ? 32 : 8,\n backgroundColor: '#a1a8c2',\n borderRadius: button === true ? 6 : 2,\n opacity: 0.4,\n })}\n />\n )\n}\n\ntype Props = { gutter?: ResponsiveLengthData }\n\nconst links = [{ width: 50 }, { width: 70 }, { width: 60 }, { width: 80, button: true }]\n\nexport default function LinksPlaceholder({ gutter }: Props): ReactNode {\n return (\n <>\n {links.map((link, i) => (\n <GutterContainer key={i} gutter={gutter} first={i === 0} last={i === links.length - 1}>\n <PlaceholderLink {...link} />\n </GutterContainer>\n ))}\n </>\n )\n}\n"],"mappings":"AAYI,SAkBA,UAlBA;AAVJ,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAO5B,SAAS,gBAAgB,EAAE,OAAO,OAAO,GAAyB;AAChE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB;AAAA,QACA,QAAQ,WAAW,OAAO,KAAK;AAAA,QAC/B,iBAAiB;AAAA,QACjB,cAAc,WAAW,OAAO,IAAI;AAAA,QACpC,SAAS;AAAA,MACX,CAAC;AAAA;AAAA,EACH;AAEJ;AAIA,MAAM,QAAQ,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAAE,OAAO,IAAI,QAAQ,KAAK,CAAC;AAExE,SAAR,iBAAkC,EAAE,OAAO,GAAqB;AACrE,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,MAChB,oBAAC,mBAAwB,QAAgB,OAAO,MAAM,GAAG,MAAM,MAAM,MAAM,SAAS,GAClF,8BAAC,mBAAiB,GAAG,MAAM,KADP,CAEtB,CACD,GACH;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useState } from 'react'\n\nimport { LinkData, ResponsiveColorData, ResponsiveTextStyleData } 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?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\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?: ResponsiveColorData\n color?: ResponsiveColorData\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":"AA+BI,SA2FQ,UA3FR,KA2FQ,YA3FR;AAsGM;AArIV,SAAmC,gBAAgB;AAInD,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,UAAU,SAAS,EAAE,CAAC;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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, ReactNode } from 'react'\n\nimport { LinkData, ResponsiveColorData, ResponsiveTextStyleData } 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?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\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?: ResponsiveColorData\n color?: ResponsiveColorData\n}\n\nexport default function MobileDropDownButton({\n label,\n caret,\n links = [],\n onClose = () => {},\n color,\n textColor,\n ...restOfProps\n}: Props): ReactNode {\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":"AA+BI,SA2FQ,UA3FR,KA2FQ,YA3FR;AAsGM;AArIV,SAAmC,gBAA2B;AAI9D,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,UAAU,SAAS,EAAE,CAAC;AAAA,QACjF;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;AASA,SAAS,WAAW,EAAE,WAAW,GAAG,YAAY,GAAoB;AAClE,SAAO,oBAAC,UAAQ,GAAG,aAAa,WAAW,GAAG,SAAS,EAAE,QAAQ,QAAQ,CAAC,GAAG,SAAS,GAAG;AAC3F;AAWA,SAAS,aAAa,EAAE,OAAO,WAAW,WAAW,GAAG,YAAY,GAAsB;AACxF,QAAM,YAAY,mBAAmB,KAAK;AAE1C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,YAA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KACF;AAEJ;","names":["color"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/MobileMenu/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, Fragment } from 'react'\n\nimport { ColorValue as Color } from '../../../../utils/types'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { Times16 } from '../../../../icons/Times16'\n\nimport Button from '../../../Button'\nimport DropDownButton from './components/MobileDropDownButton'\nimport { useResponsiveColor } from '../../../../hooks'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle } from '../../../../utils/responsive-style'\nimport { type ResponsiveColor } from '../../../../utils/types'\nimport {\n type NavigationButtonData,\n type NavigationLinksData,\n type ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\ntype NavigationButtonProps = NavigationButtonData['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction ButtonLink({\n className,\n textColor,\n color,\n ...restOfProps\n}: NavigationButtonProps): JSX.Element {\n return (\n <Button\n {...restOfProps}\n className={cx(useStyle({ margin: '8px 0' }), className)}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n className?: string\n animation?: ResponsiveValue<'coverRight' | 'coverLeft'>\n backgroundColor?: ResponsiveValue<Color> | null\n open: boolean\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nfunction Container({\n className,\n animation,\n backgroundColor,\n open,\n ...restOfProps\n}: ContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n position: 'fixed',\n flexDirection: 'column',\n width: '100%',\n padding: '40px 15px',\n transition: 'transform 300ms ease-in-out',\n overflowY: 'auto',\n zIndex: 9999,\n maxWidth: 575,\n }),\n useStyle(\n useResponsiveStyle(\n [animation, backgroundColor] as const,\n ([animation, backgroundColor]) => {\n if (animation == null) return { display: 'none' }\n\n return {\n display: 'flex',\n backgroundColor: backgroundColor == null ? 'black' : colorToString(backgroundColor),\n transform: open\n ? `translate3d(0,0,0)`\n : `translate3d(${{ coverRight: '', coverLeft: '-' }[animation]}100%, 0, 0)`,\n ...{\n coverRight: { top: 0, bottom: 0, right: 0 },\n coverLeft: { top: 0, bottom: 0, left: 0 },\n }[animation],\n }\n },\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype CloseIconContainerBaseProps = {\n className?: string\n color?: ResponsiveColor | null\n}\n\ntype CloseIconContainerProps = CloseIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof CloseIconContainerBaseProps>\n\nfunction CloseIconContainer({ className, color, ...restOfProps }: CloseIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n position: 'absolute',\n top: 15,\n right: 15,\n padding: 0,\n border: 0,\n outline: 0,\n background: 'none',\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle([color] as const, ([color]) => ({\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n })),\n ),\n className,\n )}\n />\n )\n}\n\ntype Props = {\n animation?: ResponsiveValue<'coverRight' | 'coverLeft'>\n backgroundColor?: ResponsiveColor | null\n closeIconColor?: ResponsiveColor | null\n links?: NavigationLinksData\n onClose?: () => unknown\n open?: boolean\n}\n\nexport default function MobileMenu({\n animation,\n backgroundColor,\n open = false,\n closeIconColor,\n links = [],\n onClose = () => {},\n}: Props): JSX.Element {\n return (\n <Container animation={animation} backgroundColor={backgroundColor} open={open}>\n <CloseIconContainer color={closeIconColor} onClick={onClose}>\n <Times16 />\n </CloseIconContainer>\n <div\n style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0 }}\n >\n {links.map(link => (\n <Fragment key={link.id}>\n {link.type === 'button' && (\n <ButtonLink {...link.payload} onClick={onClose}>\n {link.payload.label}\n </ButtonLink>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload}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Ac,oBAAC,kBAAgB,GAAG,KAAK,SAAS,SAAkB;AAAA,aANpE,KAAK,EAOpB,CACD;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;","names":["animation","backgroundColor","color"]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/MobileMenu/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, Fragment, ReactNode } from 'react'\n\nimport { ColorValue as Color } from '../../../../utils/types'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { Times16 } from '../../../../icons/Times16'\n\nimport Button from '../../../Button'\nimport DropDownButton from './components/MobileDropDownButton'\nimport { useResponsiveColor } from '../../../../hooks'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle } from '../../../../utils/responsive-style'\nimport { type ResponsiveColor } from '../../../../utils/types'\nimport {\n type NavigationButtonData,\n type NavigationLinksData,\n type ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\ntype NavigationButtonProps = NavigationButtonData['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction ButtonLink({\n className,\n textColor,\n color,\n ...restOfProps\n}: NavigationButtonProps): ReactNode {\n return (\n <Button\n {...restOfProps}\n className={cx(useStyle({ margin: '8px 0' }), className)}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n className?: string\n animation?: ResponsiveValue<'coverRight' | 'coverLeft'>\n backgroundColor?: ResponsiveValue<Color> | null\n open: boolean\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nfunction Container({\n className,\n animation,\n backgroundColor,\n open,\n ...restOfProps\n}: ContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n position: 'fixed',\n flexDirection: 'column',\n width: '100%',\n padding: '40px 15px',\n transition: 'transform 300ms ease-in-out',\n overflowY: 'auto',\n zIndex: 9999,\n maxWidth: 575,\n }),\n useStyle(\n useResponsiveStyle(\n [animation, backgroundColor] as const,\n ([animation, backgroundColor]) => {\n if (animation == null) return { display: 'none' }\n\n return {\n display: 'flex',\n backgroundColor: backgroundColor == null ? 'black' : colorToString(backgroundColor),\n transform: open\n ? `translate3d(0,0,0)`\n : `translate3d(${{ coverRight: '', coverLeft: '-' }[animation]}100%, 0, 0)`,\n ...{\n coverRight: { top: 0, bottom: 0, right: 0 },\n coverLeft: { top: 0, bottom: 0, left: 0 },\n }[animation],\n }\n },\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype CloseIconContainerBaseProps = {\n className?: string\n color?: ResponsiveColor | null\n}\n\ntype CloseIconContainerProps = CloseIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof CloseIconContainerBaseProps>\n\nfunction CloseIconContainer({ className, color, ...restOfProps }: CloseIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n position: 'absolute',\n top: 15,\n right: 15,\n padding: 0,\n border: 0,\n outline: 0,\n background: 'none',\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle([color] as const, ([color]) => ({\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n })),\n ),\n className,\n )}\n />\n )\n}\n\ntype Props = {\n animation?: ResponsiveValue<'coverRight' | 'coverLeft'>\n backgroundColor?: ResponsiveColor | null\n closeIconColor?: ResponsiveColor | null\n links?: NavigationLinksData\n onClose?: () => unknown\n open?: boolean\n}\n\nexport default function MobileMenu({\n animation,\n backgroundColor,\n open = false,\n closeIconColor,\n links = [],\n onClose = () => {},\n}: Props): ReactNode {\n return (\n <Container animation={animation} backgroundColor={backgroundColor} open={open}>\n <CloseIconContainer color={closeIconColor} onClick={onClose}>\n <Times16 />\n </CloseIconContainer>\n <div\n style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0 }}\n >\n {links.map(link => (\n <Fragment key={link.id}>\n {link.type === 'button' && (\n <ButtonLink {...link.payload} onClick={onClose}>\n {link.payload.label}\n </ButtonLink>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} onClose={onClose} />}\n </Fragment>\n ))}\n </div>\n </Container>\n )\n}\n"],"mappings":"AA6BI,cA8HM,YA9HN;AA7BJ,SAAmC,gBAA2B;AAG9D,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAExB,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AAWnC,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAqC;AACnC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,SAAS,EAAE,QAAQ,QAAQ,CAAC,GAAG,SAAS;AAAA,MACtD,WAAW,mBAAmB,SAAS;AAAA,MACvC,OAAO,mBAAmB,KAAK;AAAA;AAAA,EACjC;AAEJ;AAYA,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,SAAS;AAAA,UACP,UAAU;AAAA,UACV,eAAe;AAAA,UACf,OAAO;AAAA,UACP,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,WAAW;AAAA,UACX,QAAQ;AAAA,UACR,UAAU;AAAA,QACZ,CAAC;AAAA,QACD;AAAA,UACE;AAAA,YACE,CAAC,WAAW,eAAe;AAAA,YAC3B,CAAC,CAACA,YAAWC,gBAAe,MAAM;AAChC,kBAAID,cAAa;AAAM,uBAAO,EAAE,SAAS,OAAO;AAEhD,qBAAO;AAAA,gBACL,SAAS;AAAA,gBACT,iBAAiBC,oBAAmB,OAAO,UAAU,cAAcA,gBAAe;AAAA,gBAClF,WA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K,SAAS,YACb,oBAAC,cAAY,GAAG,KAAK,SAAS,SAAS,SACpC,eAAK,QAAQ,OAChB;AAAA,UAED,KAAK,SAAS,cAAc,oBAAC,kBAAgB,GAAG,KAAK,SAAS,SAAkB;AAAA,aANpE,KAAK,EAOpB,CACD;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;","names":["animation","backgroundColor","color"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.tsx"],"sourcesContent":["import { LengthData, ResponsiveValue } from '@makeswift/prop-controllers'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nimport GutterContainer from '../../../../shared/GutterContainer'\n\nconst links = [{ id: '1' }, { id: '2' }, { id: '3' }]\n\ntype Props = { gutter?: ResponsiveValue<LengthData> }\n\nexport default function SocialLinksPlaceholder({ gutter }: Props): JSX.Element {\n return (\n <>\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 <PlaceholderLink />\n </GutterContainer>\n ))}\n </>\n )\n}\n\nfunction PlaceholderLink() {\n return (\n <div\n className={useStyle({\n width: 44,\n height: 44,\n borderRadius: '50%',\n backgroundColor: 'rgba(161, 168, 194, 0.4)',\n })}\n />\n )\n}\n"],"mappings":"AAWI,mBAQM,WARN;AAVJ,SAAS,gBAAgB;AAEzB,OAAO,qBAAqB;AAE5B,MAAM,QAAQ,CAAC,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,CAAC;AAIrC,SAAR,uBAAwC,EAAE,OAAO,GAAuB;AAC7E,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,MAChB;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA,OAAO,MAAM;AAAA,MACb,MAAM,MAAM,MAAM,SAAS;AAAA,MAE3B,8BAAC,mBAAgB;AAAA;AAAA,IALZ,KAAK;AAAA,EAMZ,CACD,GACH;AAEJ;AAEA,SAAS,kBAAkB;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport { LengthData, ResponsiveValue } from '@makeswift/prop-controllers'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nimport GutterContainer from '../../../../shared/GutterContainer'\n\nconst links = [{ id: '1' }, { id: '2' }, { id: '3' }]\n\ntype Props = { gutter?: ResponsiveValue<LengthData> }\n\nexport default function SocialLinksPlaceholder({ gutter }: Props): ReactNode {\n return (\n <>\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 <PlaceholderLink />\n </GutterContainer>\n ))}\n </>\n )\n}\n\nfunction PlaceholderLink() {\n return (\n <div\n className={useStyle({\n width: 44,\n height: 44,\n borderRadius: '50%',\n backgroundColor: 'rgba(161, 168, 194, 0.4)',\n })}\n />\n )\n}\n"],"mappings":"AAYI,mBAQM,WARN;AAVJ,SAAS,gBAAgB;AAEzB,OAAO,qBAAqB;AAE5B,MAAM,QAAQ,CAAC,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,CAAC;AAIrC,SAAR,uBAAwC,EAAE,OAAO,GAAqB;AAC3E,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,MAChB;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA,OAAO,MAAM;AAAA,MACb,MAAM,MAAM,MAAM,SAAS;AAAA,MAE3B,8BAAC,mBAAgB;AAAA;AAAA,IALZ,KAAK;AAAA,EAMZ,CACD,GACH;AAEJ;AAEA,SAAS,kBAAkB;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB,CAAC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { useState, useRef, ComponentPropsWithoutRef, ForwardedRef, forwardRef } from 'react'\n\nimport { ReactPlayer } from '../../../react-player'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\n\nconst Container = forwardRef(function Container(\n { className, ...restOfProps }: ComponentPropsWithoutRef<'div'>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n overflow: 'hidden',\n }),\n className,\n )}\n />\n )\n})\n\nfunction Mask({\n backgroundColor,\n visible,\n}: {\n backgroundColor: string | undefined\n visible: boolean\n}) {\n return (\n <div\n className={useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background: backgroundColor,\n opacity: visible ? 1 : 0,\n transition: 'opacity 1s',\n })}\n />\n )\n}\n\nconst getScale = (element: HTMLElement, aspectRatio: number, zoom: number) => {\n const { offsetWidth: width, offsetHeight: height } = element\n const computedAspectRatio = width / height\n\n return Math.max(aspectRatio / computedAspectRatio, computedAspectRatio / aspectRatio) * zoom\n}\n\ntype Props = {\n url?: string\n aspectRatio?: number\n zoom?: number\n opacity?: number\n maskColor?: string\n}\n\nexport default function BackgroundVideo({\n url = '',\n aspectRatio = 16 / 9,\n zoom = 1,\n maskColor,\n opacity,\n}: Props): JSX.Element {\n const [ready, setReady] = useState(false)\n const [scale, setScale] = useState(1)\n const container = useRef<HTMLDivElement>(null)\n\n useIsomorphicLayoutEffect(() => {\n const { current: containerEl } = container\n\n if (!containerEl) return undefined\n\n const { defaultView } = containerEl.ownerDocument\n const handleResize = () => setScale(getScale(containerEl, aspectRatio, zoom))\n\n handleResize()\n\n defaultView!.addEventListener('resize', handleResize)\n\n return () => defaultView!.removeEventListener('resize', handleResize)\n }, [aspectRatio, zoom])\n\n if (!ReactPlayer.canPlay(url)) return <></>\n\n return (\n <Container ref={container}>\n {container.current && (\n <ReactPlayer\n url={url}\n config={{\n vimeo: { playerOptions: { background: true } },\n youtube: {\n playerVars: {\n origin: container.current.ownerDocument.defaultView?.location.origin,\n },\n },\n wistia: {\n options: {\n endVideoBehavior: 'loop',\n playbackRateControl: false,\n playbar: false,\n playButton: false,\n volumeControl: false,\n fullscreenButton: false,\n muted: true,\n },\n },\n }}\n playing\n loop\n muted\n playsinline={true}\n controls={false}\n onReady={() => setReady(true)}\n style={{\n transform: `scale3d(${scale}, ${scale}, 1)`,\n opacity,\n }}\n width=\"100%\"\n height=\"100%\"\n />\n )}\n <Mask backgroundColor={maskColor} visible={!ready} />\n </Container>\n )\n}\n"],"mappings":"AAaI,SAmFoC,UAnFpC,KAsFA,YAtFA;AAbJ,SAAS,UAAU;AACnB,SAAS,UAAU,QAAgD,kBAAkB;AAErF,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAEzB,SAAS,iCAAiC;AAE1C,MAAM,YAAY,WAAW,SAASA,WACpC,EAAE,WAAW,GAAG,YAAY,GAC5B,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,QACT,SAAS;AAAA,UACP,UAAU;AAAA,UACV,KAAK;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,eAAe;AAAA,UACf,UAAU;AAAA,QACZ,CAAC;AAAA,QACD;AAAA,MACF;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AQ;AAAA,UACN,OAAO,EAAE,eAAe,EAAE,YAAY,KAAK,EAAE;AAAA,UAC7C,SAAS;AAAA,YACP,YAAY;AAAA,cACV,QAAQ,UAAU,QAAQ,cAAc,aAAa,SAAS;AAAA,YAChE;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,YACN,SAAS;AAAA,cACP,kBAAkB;AAAA,cAClB,qBAAqB;AAAA,cACrB,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,eAAe;AAAA,cACf,kBAAkB;AAAA,cAClB,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAO;AAAA,QACP,MAAI;AAAA,QACJ,OAAK;AAAA,QACL,aAAa;AAAA,QACb,UAAU;AAAA,QACV,SAAS,MAAM,SAAS,IAAI;AAAA,QAC5B,OAAO;AAAA,UACL,WAAW,WAAW,KAAK,KAAK,KAAK;AAAA,UACrC;AAAA,QACF;AAAA,QACA,OAAM;AAAA,QACN,QAAO;AAAA;AAAA,IACT;AAAA,IAEF,oBAAC,QAAK,iBAAiB,WAAW,SAAS,CAAC,OAAO;AAAA,KACrD;AAEJ;","names":["Container"]}
1
+ {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { useState, useRef, ComponentPropsWithoutRef, ForwardedRef, forwardRef, ReactNode } from 'react'\n\nimport { ReactPlayer } from '../../../react-player'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\n\nconst Container = forwardRef(function Container(\n { className, ...restOfProps }: ComponentPropsWithoutRef<'div'>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n overflow: 'hidden',\n }),\n className,\n )}\n />\n )\n})\n\nfunction Mask({\n backgroundColor,\n visible,\n}: {\n backgroundColor: string | undefined\n visible: boolean\n}) {\n return (\n <div\n className={useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background: backgroundColor,\n opacity: visible ? 1 : 0,\n transition: 'opacity 1s',\n })}\n />\n )\n}\n\nconst getScale = (element: HTMLElement, aspectRatio: number, zoom: number) => {\n const { offsetWidth: width, offsetHeight: height } = element\n const computedAspectRatio = width / height\n\n return Math.max(aspectRatio / computedAspectRatio, computedAspectRatio / aspectRatio) * zoom\n}\n\ntype Props = {\n url?: string\n aspectRatio?: number\n zoom?: number\n opacity?: number\n maskColor?: string\n}\n\nexport default function BackgroundVideo({\n url = '',\n aspectRatio = 16 / 9,\n zoom = 1,\n maskColor,\n opacity,\n}: Props): ReactNode {\n const [ready, setReady] = useState(false)\n const [scale, setScale] = useState(1)\n const container = useRef<HTMLDivElement>(null)\n\n useIsomorphicLayoutEffect(() => {\n const { current: containerEl } = container\n\n if (!containerEl) return undefined\n\n const { defaultView } = containerEl.ownerDocument\n const handleResize = () => setScale(getScale(containerEl, aspectRatio, zoom))\n\n handleResize()\n\n defaultView!.addEventListener('resize', handleResize)\n\n return () => defaultView!.removeEventListener('resize', handleResize)\n }, [aspectRatio, zoom])\n\n if (!ReactPlayer.canPlay(url)) return <></>\n\n return (\n <Container ref={container}>\n {container.current && (\n <ReactPlayer\n url={url}\n config={{\n vimeo: { playerOptions: { background: true } },\n youtube: {\n playerVars: {\n origin: container.current.ownerDocument.defaultView?.location.origin,\n },\n },\n wistia: {\n options: {\n endVideoBehavior: 'loop',\n playbackRateControl: false,\n playbar: false,\n playButton: false,\n volumeControl: false,\n fullscreenButton: false,\n muted: true,\n },\n },\n }}\n playing\n loop\n muted\n playsinline={true}\n controls={false}\n onReady={() => setReady(true)}\n style={{\n transform: `scale3d(${scale}, ${scale}, 1)`,\n opacity,\n }}\n width=\"100%\"\n height=\"100%\"\n />\n )}\n <Mask backgroundColor={mask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1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/Backgrounds/index.tsx"],"sourcesContent":["import { BackgroundsPropControllerValue, BackgroundsData } from '../../../../hooks'\nimport { type ResponsiveValue } from '@makeswift/controls'\nimport { ColorValue as Color } from '../../../../utils/types'\nimport { colorToString } from '../../../../utils/colorToString'\nimport Parallax from '../Parallax'\nimport BackgroundVideo from '../BackgroundVideo'\nimport { type CSSObject } from '@emotion/serialize'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle } from '../../../../utils/responsive-style'\nimport { useFrameworkContext } from '../../../../../runtimes/react/components/hooks/use-framework-context'\n\nfunction getColor(color: Color | null | undefined) {\n if (color == null) return 'black'\n\n if (color.swatch == null) {\n return colorToString({ ...color, swatch: { hue: 0, saturation: 0, lightness: 0 } })\n }\n\n return colorToString(color)\n}\n\ntype GradientStop = { color: Color | null | undefined; location: number }\n\nconst getStopsStyle = (stops: GradientStop[]) =>\n stops.map(({ color, location }) => `${getColor(color)} ${location}%`).join(',')\n\nconst absoluteFillStyle: CSSObject = {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n}\n\nconst containerStyle: CSSObject = {\n ...absoluteFillStyle,\n borderRadius: 'inherit',\n}\n\ntype Props = { backgrounds: BackgroundsPropControllerValue | null | undefined }\n\nexport default function Backgrounds({ backgrounds }: Props): JSX.Element {\n if (backgrounds == null) return <></>\n\n return (\n <>\n {backgrounds.map(({ value, deviceId }) => {\n const visibility = backgrounds.map(v => ({\n deviceId: v.deviceId,\n value: v.deviceId === deviceId,\n }))\n\n return <BackgroundDeviceLayer key={deviceId} layer={value} visibility={visibility} />\n })}\n </>\n )\n}\n\ntype BackgroundLayerProps = {\n layer: BackgroundsData\n visibility: ResponsiveValue<boolean>\n}\n\nfunction BackgroundDeviceLayer({ layer, visibility }: BackgroundLayerProps) {\n const visibilityStyle = useResponsiveStyle([visibility], ([v]) => ({\n display: v === true ? 'block' : 'none',\n }))\n\n return (\n <div className={useStyle({ ...containerStyle, ...visibilityStyle, overflow: 'hidden' })}>\n {[...layer].reverse().map(bg => {\n if (bg.type === 'color') {\n return <ColorBackground key={bg.id} color={getColor(bg.payload)} />\n }\n\n if (bg.type === 'image' && bg.payload) {\n return <ImageBackground {...bg.payload} key={bg.id} />\n }\n\n if (bg.type === 'gradient' && bg.payload) {\n return (\n <GradientBackground\n {...bg.payload}\n key={bg.id}\n gradient={getStopsStyle(bg.payload.stops)}\n />\n )\n }\n\n if (bg.type === 'video' && bg.payload) {\n return (\n <VideoBackground\n {...bg.payload}\n key={bg.id}\n maskColor={getColor(bg.payload.maskColor)}\n />\n )\n }\n\n return null\n })}\n </div>\n )\n}\n\ntype ColorBackgroundProps = { color: string }\n\nfunction ColorBackground({ color }: ColorBackgroundProps) {\n return <div className={useStyle({ ...containerStyle, backgroundColor: color })} />\n}\n\nconst ImageBackgroundRepeat = {\n NoRepeat: 'no-repeat',\n RepeatX: 'repeat-x',\n RepeatY: 'repeat-y',\n Repeat: 'repeat',\n} as const\n\ntype ImageBackgroundRepeat = (typeof ImageBackgroundRepeat)[keyof typeof ImageBackgroundRepeat]\n\nconst ImageBackgroundSize = {\n Cover: 'cover',\n Contain: 'contain',\n Auto: 'auto',\n} as const\n\ntype ImageBackgroundSize = (typeof ImageBackgroundSize)[keyof typeof ImageBackgroundSize]\n\ntype ImageBackgroundProps = {\n publicUrl?: string\n position: { x: number; y: number }\n repeat?: ImageBackgroundRepeat\n size?: ImageBackgroundSize\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nfunction ImageBackground({\n publicUrl,\n position,\n repeat = ImageBackgroundRepeat.NoRepeat,\n size = ImageBackgroundSize.Cover,\n opacity,\n parallax,\n priority,\n}: ImageBackgroundProps) {\n const backgroundPosition = `${position.x}% ${position.y}%`\n const containerClassName = useStyle(containerStyle)\n const { Image } = useFrameworkContext()\n\n if (repeat === 'no-repeat' && size !== 'auto' && publicUrl != null) {\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div {...getParallaxProps({ style: { opacity, overflow: 'hidden' } })}>\n <Image\n src={publicUrl}\n alt={''}\n fill\n sizes=\"100vw\"\n style={{\n objectPosition: backgroundPosition,\n objectFit: size,\n }}\n priority={priority}\n />\n </div>\n )}\n </Parallax>\n )\n }\n\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div\n className={containerClassName}\n {...getParallaxProps({\n style: {\n backgroundImage: publicUrl != null ? `url('${publicUrl}')` : undefined,\n backgroundPosition,\n backgroundRepeat: repeat,\n backgroundSize: size,\n opacity,\n },\n })}\n />\n )}\n </Parallax>\n )\n}\n\ntype GradientBackgroundProps = {\n gradient: string\n angle?: number\n isRadial?: boolean\n}\n\nfunction GradientBackground({\n gradient,\n isRadial = false,\n angle = Math.PI,\n}: GradientBackgroundProps) {\n return (\n <div\n className={useStyle({\n ...containerStyle,\n background: isRadial\n ? `radial-gradient(${gradient})`\n : `linear-gradient(${angle}rad, ${gradient})`,\n })}\n />\n )\n}\n\nconst BackgroundVideoAspectRatio = {\n Wide: 'wide',\n Standard: 'standard',\n} as const\n\ntype BackgroundVideoAspectRatio =\n (typeof BackgroundVideoAspectRatio)[keyof typeof BackgroundVideoAspectRatio]\n\nfunction getAspectRatio(aspectRatio: BackgroundVideoAspectRatio | null | undefined): number {\n switch (aspectRatio) {\n case 'wide':\n return 16 / 9\n\n case 'standard':\n return 4 / 3\n\n default:\n return 16 / 9\n }\n}\n\ntype VideoBackgroundProps = {\n url?: string\n aspectRatio?: BackgroundVideoAspectRatio\n maskColor: string\n zoom?: number\n opacity?: number\n parallax?: number\n}\n\nfunction VideoBackground({\n url,\n aspectRatio,\n maskColor,\n zoom,\n opacity,\n parallax,\n}: VideoBackgroundProps) {\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div {...getParallaxProps({ className: useStyle(containerStyle) })}>\n <BackgroundVideo\n url={url}\n zoom={zoom}\n opacity={opacity}\n aspectRatio={getAspectRatio(aspectRat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aAAO,KAAK;AAAA,IAEd,KAAK;AACH,aAAO,IAAI;AAAA,IAEb;AACE,aAAO,KAAK;AAAA,EAChB;AACF;AAWA,SAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,SACE,oBAAC,YAAS,UAAU,UACjB,gCACC,oBAAC,SAAK,GAAG,iBAAiB,EAAE,WAAW,SAAS,cAAc,EAAE,CAAC,GAC/D;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,eAAe,WAAW;AAAA,MACvC;AAAA;AAAA,EACF,GACF,GAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/Backgrounds/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport { BackgroundsPropControllerValue, BackgroundsData } from '../../../../hooks'\nimport { type ResponsiveValue } from '@makeswift/controls'\nimport { ColorValue as Color } from '../../../../utils/types'\nimport { colorToString } from '../../../../utils/colorToString'\nimport Parallax from '../Parallax'\nimport BackgroundVideo from '../BackgroundVideo'\nimport { type CSSObject } from '@emotion/serialize'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle } from '../../../../utils/responsive-style'\nimport { useFrameworkContext } from '../../../../../runtimes/react/components/hooks/use-framework-context'\n\nfunction getColor(color: Color | null | undefined) {\n if (color == null) return 'black'\n\n if (color.swatch == null) {\n return colorToString({ ...color, swatch: { hue: 0, saturation: 0, lightness: 0 } })\n }\n\n return colorToString(color)\n}\n\ntype GradientStop = { color: Color | null | undefined; location: number }\n\nconst getStopsStyle = (stops: GradientStop[]) =>\n stops.map(({ color, location }) => `${getColor(color)} ${location}%`).join(',')\n\nconst absoluteFillStyle: CSSObject = {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n}\n\nconst containerStyle: CSSObject = {\n ...absoluteFillStyle,\n borderRadius: 'inherit',\n}\n\ntype Props = { backgrounds: BackgroundsPropControllerValue | null | undefined }\n\nexport default function Backgrounds({ backgrounds }: Props): ReactNode {\n if (backgrounds == null) return <></>\n\n return (\n <>\n {backgrounds.map(({ value, deviceId }) => {\n const visibility = backgrounds.map(v => ({\n deviceId: v.deviceId,\n value: v.deviceId === deviceId,\n }))\n\n return <BackgroundDeviceLayer key={deviceId} layer={value} visibility={visibility} />\n })}\n </>\n )\n}\n\ntype BackgroundLayerProps = {\n layer: BackgroundsData\n visibility: ResponsiveValue<boolean>\n}\n\nfunction BackgroundDeviceLayer({ layer, visibility }: BackgroundLayerProps) {\n const visibilityStyle = useResponsiveStyle([visibility], ([v]) => ({\n display: v === true ? 'block' : 'none',\n }))\n\n return (\n <div className={useStyle({ ...containerStyle, ...visibilityStyle, overflow: 'hidden' })}>\n {[...layer].reverse().map(bg => {\n if (bg.type === 'color') {\n return <ColorBackground key={bg.id} color={getColor(bg.payload)} />\n }\n\n if (bg.type === 'image' && bg.payload) {\n return <ImageBackground {...bg.payload} key={bg.id} />\n }\n\n if (bg.type === 'gradient' && bg.payload) {\n return (\n <GradientBackground\n {...bg.payload}\n key={bg.id}\n gradient={getStopsStyle(bg.payload.stops)}\n />\n )\n }\n\n if (bg.type === 'video' && bg.payload) {\n return (\n <VideoBackground\n {...bg.payload}\n key={bg.id}\n maskColor={getColor(bg.payload.maskColor)}\n />\n )\n }\n\n return null\n })}\n </div>\n )\n}\n\ntype ColorBackgroundProps = { color: string }\n\nfunction ColorBackground({ color }: ColorBackgroundProps) {\n return <div className={useStyle({ ...containerStyle, backgroundColor: color })} />\n}\n\nconst ImageBackgroundRepeat = {\n NoRepeat: 'no-repeat',\n RepeatX: 'repeat-x',\n RepeatY: 'repeat-y',\n Repeat: 'repeat',\n} as const\n\ntype ImageBackgroundRepeat = (typeof ImageBackgroundRepeat)[keyof typeof ImageBackgroundRepeat]\n\nconst ImageBackgroundSize = {\n Cover: 'cover',\n Contain: 'contain',\n Auto: 'auto',\n} as const\n\ntype ImageBackgroundSize = (typeof ImageBackgroundSize)[keyof typeof ImageBackgroundSize]\n\ntype ImageBackgroundProps = {\n publicUrl?: string\n position: { x: number; y: number }\n repeat?: ImageBackgroundRepeat\n size?: ImageBackgroundSize\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nfunction ImageBackground({\n publicUrl,\n position,\n repeat = ImageBackgroundRepeat.NoRepeat,\n size = ImageBackgroundSize.Cover,\n opacity,\n parallax,\n priority,\n}: ImageBackgroundProps) {\n const backgroundPosition = `${position.x}% ${position.y}%`\n const containerClassName = useStyle(containerStyle)\n const { Image } = useFrameworkContext()\n\n if (repeat === 'no-repeat' && size !== 'auto' && publicUrl != null) {\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div {...getParallaxProps({ style: { opacity, overflow: 'hidden' } })}>\n <Image\n src={publicUrl}\n alt={''}\n fill\n sizes=\"100vw\"\n style={{\n objectPosition: backgroundPosition,\n objectFit: size,\n }}\n priority={priority}\n />\n </div>\n )}\n </Parallax>\n )\n }\n\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div\n className={containerClassName}\n {...getParallaxProps({\n style: {\n backgroundImage: publicUrl != null ? `url('${publicUrl}')` : undefined,\n backgroundPosition,\n backgroundRepeat: repeat,\n backgroundSize: size,\n opacity,\n },\n })}\n />\n )}\n </Parallax>\n )\n}\n\ntype GradientBackgroundProps = {\n gradient: string\n angle?: number\n isRadial?: boolean\n}\n\nfunction GradientBackground({\n gradient,\n isRadial = false,\n angle = Math.PI,\n}: GradientBackgroundProps) {\n return (\n <div\n className={useStyle({\n ...containerStyle,\n background: isRadial\n ? `radial-gradient(${gradient})`\n : `linear-gradient(${angle}rad, ${gradient})`,\n })}\n />\n )\n}\n\nconst BackgroundVideoAspectRatio = {\n Wide: 'wide',\n Standard: 'standard',\n} as const\n\ntype BackgroundVideoAspectRatio =\n (typeof BackgroundVideoAspectRatio)[keyof typeof BackgroundVideoAspectRatio]\n\nfunction getAspectRatio(aspectRatio: BackgroundVideoAspectRatio | null | undefined): number {\n switch (aspectRatio) {\n case 'wide':\n return 16 / 9\n\n case 'standard':\n return 4 / 3\n\n default:\n return 16 / 9\n }\n}\n\ntype VideoBackgroundProps = {\n url?: string\n aspectRatio?: BackgroundVideoAspectRatio\n maskColor: string\n zoom?: number\n opacity?: number\n parallax?: number\n}\n\nfunction VideoBackground({\n url,\n aspectRatio,\n maskColor,\n zoom,\n opacity,\n parallax,\n}: VideoBackgroundProps) {\n return (\n <Parallax strength={parallax}>\n {getParallaxProps => (\n <div {...getParallaxProps({ className: useStyle(containerStyle) })}>\n <BackgroundVideo\n url={url}\n zoom={zoom}\n opacity={opacity}\n aspectRatio={getAspectRatio(aspectRatio)}\n maskColor={maskColor}\n />\n </div>\n )}\n </Parallax>\n )\n}\n"],"mappings":"AA2CkC;AAkCjB;AAzEjB,SAAS,qBAAqB;AAC9B,OAAO,cAAc;AACrB,OAAO,qBAAqB;AAE5B,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAEpC,SAAS,SAAS,OAAiC;AACjD,MAAI,SAAS;AAAM,WAAO;AAE1B,MAAI,MAAM,UAAU,MAAM;AACxB,WAAO,cAAc,EAAE,GAAG,OAAO,QAAQ,EAAE,KAAK,GAAG,YAAY,GAAG,WAAW,EAAE,EAAE,CAAC;AAAA,EACpF;AAEA,SAAO,cAAc,KAAK;AAC5B;AAIA,MAAM,gBAAgB,CAAC,UACrB,MAAM,IAAI,CAAC,EAAE,OAAO,SAAS,MAAM,GAAG,SAAS,KAAK,CAAC,IAAI,QAAQ,GAAG,EAAE,KAAK,GAAG;AAEhF,MAAM,oBAA+B;AAAA,EACnC,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AAEA,MAAM,iBAA4B;AAAA,EAChC,GAAG;AAAA,EACH,cAAc;AAChB;AAIe,SAAR,YAA6B,EAAE,YAAY,GAAq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;AAAA,MACF,CAAC;AAAA;AAAA,EACH,GAEJ;AAEJ;AAQA,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA,WAAW;AAAA,EACX,QAAQ,KAAK;AACf,GAA4B;AAC1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,SAAS;AAAA,QAClB,GAAG;AAAA,QACH,YAAY,WACR,mBAAmB,QAAQ,MAC3B,mBAAmB,KAAK,QAAQ,QAAQ;AAAA,MAC9C,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,MAAM,6BAA6B;AAAA,EACjC,MAAM;AAAA,EACN,UAAU;AACZ;AAKA,SAAS,eAAe,aAAoE;AAC1F,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO,KAAK;AAAA,IAEd,KAAK;AACH,aAAO,IAAI;AAAA,IAEb;AACE,aAAO,KAAK;AAAA,EAChB;AACF;AAWA,SAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,SACE,oBAAC,YAAS,UAAU,UACjB,gCACC,oBAAC,SAAK,GAAG,iBAAiB,EAAE,WAAW,SAAS,cAAc,EAAE,CAAC,GAC/D;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,eAAe,WAAW;AAAA,MACvC;AAAA;AAAA,EACF,GACF,GAEJ;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/Parallax/index.tsx"],"sourcesContent":["import { useState, useRef, useCallback, ReactNode, CSSProperties } from 'react'\nimport clamp from '../../../../../utils/clamp'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\n\nfunction isScrollable(element: HTMLElement) {\n const { overflow, overflowY, overflowX } =\n element.ownerDocument.defaultView!.getComputedStyle(element)\n\n return /(auto|scroll)/.test(overflow + overflowX + overflowY)\n}\n\nfunction getScrollParent(element: HTMLElement): HTMLElement {\n const { parentElement } = element\n\n if (!element || !parentElement) return element\n\n if (isScrollable(element)) return element\n\n return getScrollParent(parentElement)\n}\n\ntype Props = {\n strength: number | null | undefined\n children: (\n getParallaxProps: <P extends { style?: CSSProperties; [key: string]: unknown }>(props: P) => P,\n ) => ReactNode\n}\n\nexport default function Parallax({ strength, children, ...rest }: Props): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const [containerScrollTop, setContainerScrollTop] = useState(strength == null ? 0 : strength)\n const lastScrollParentScrollTop = useRef(0)\n\n useIsomorphicLayoutEffect(() => {\n if (!container.current || strength == null || strength === 0) return undefined\n\n const containerDocument = container.current.ownerDocument\n const scrollParent = getScrollParent(container.current)\n const eventTarget =\n containerDocument.documentElement === scrollParent\n ? containerDocument.defaultView!\n : scrollParent\n\n lastScrollParentScrollTop.current = scrollParent.scrollTop\n setContainerScrollTop(strength)\n\n function handleScroll() {\n containerDocument.defaultView!.requestAnimationFrame(() => {\n if (!container.current) return\n\n const { top: containerTop, bottom: containerBottom } =\n container.current.getBoundingClientRect()\n const { top: scrollParentTop, bottom: scrollParentBottom } =\n scrollParent === containerDocument.documentElement\n ? { top: 0, bottom: containerDocument.defaultView!.innerHeight }\n : scrollParent.getBoundingClientRect()\n const { scrollTop: scrollParentScrollTop } =\n scrollParent === containerDocument.documentElement\n ? { scrollTop: containerDocument.defaultView!.pageYOffset }\n : scrollParent\n const scrollParentHeight = scrollParentBottom - scrollParentTop\n const scrollParentScrollDelta = scrollParentScrollTop - lastScrollParentScrollTop.current\n\n lastScrollParentScrollTop.current = scrollParentScrollTop\n\n setContainerScrollTop(scrollTop => {\n const isContainerVisible =\n containerTop < scrollParentTop + scrollParentHeight && containerBottom > scrollParentTop\n const containerScrollRemaining =\n scrollParentScrollDelta > 0 ? 2 * strength! - scrollTop : scrollTop\n const scrollParentScrollRemaining =\n scrollParentScrollDelta > 0\n ? scrollParentTop + containerBottom\n : scrollParentHeight - containerTop\n const parallaxRatio = containerScrollRemaining / scrollParentScrollRemaining\n const containerScrollDelta = isContainerVisible\n ? parallaxRatio * scrollParentScrollDelta\n : 0\n\n return clamp(0, scrollTop + containerScrollDelta, strength! * 2)\n })\n })\n }\n\n eventTarget.addEventListener('scroll', handleScroll)\n\n return () => eventTarget.removeEventListener('scroll', handleScroll)\n }, [strength])\n\n const getProps = useCallback(\n ({ style, ...restOfChildrenProps }: any) => ({\n ...restOfChildrenProps,\n style: {\n ...style,\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n ...(strength == null || strength === 0\n ? {}\n : {\n top: -strength,\n bottom: -strength,\n transform: `translate3d(0, ${containerScrollTop - strength}px, 0)`,\n }),\n },\n }),\n [strength, containerScrollTop],\n )\n\n return (\n <div\n {...rest}\n ref={container}\n style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n >\n {children(getProps)}\n </div>\n )\n}\n"],"mappings":"AAgHI;AAhHJ,SAAS,UAAU,QAAQ,mBAA6C;AACxE,OAAO,WAAW;AAClB,SAAS,iCAAiC;AAE1C,SAAS,aAAa,SAAsB;AAC1C,QAAM,EAAE,UAAU,WAAW,UAAU,IACrC,QAAQ,cAAc,YAAa,iBAAiB,OAAO;AAE7D,SAAO,gBAAgB,KAAK,WAAW,YAAY,SAAS;AAC9D;AAEA,SAAS,gBAAgB,SAAmC;AAC1D,QAAM,EAAE,cAAc,IAAI;AAE1B,MAAI,CAAC,WAAW,CAAC;AAAe,WAAO;AAEvC,MAAI,aAAa,OAAO;AAAG,WAAO;AAElC,SAAO,gBAAgB,aAAa;AACtC;AASe,SAAR,SAA0B,EAAE,UAAU,UAAU,GAAG,KAAK,GAAuB;AACpF,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAAS,YAAY,OAAO,IAAI,QAAQ;AAC5F,QAAM,4BAA4B,OAAO,CAAC;AAE1C,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU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O,GAAG,oBAAoB,OAAY;AAAA,MAC3C,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG;AAAA,QACH,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,QACP,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,GAAI,YAAY,QAAQ,aAAa,IACjC,CAAC,IACD;AAAA,UACE,KAAK,CAAC;AAAA,UACN,QAAQ,CAAC;AAAA,UACT,WAAW,kBAAkB,qBAAqB,QAAQ;AAAA,QAC5D;AAAA,MACN;AAAA,IACF;AAAA,IACA,CAAC,UAAU,kBAAkB;AAAA,EAC/B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,EAAE;AAAA,MAEnE,mBAAS,QAAQ;AAAA;AAAA,EACpB;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/Parallax/index.tsx"],"sourcesContent":["import { useState, useRef, useCallback, ReactNode, CSSProperties } from 'react'\nimport clamp from '../../../../../utils/clamp'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\n\nfunction isScrollable(element: HTMLElement) {\n const { overflow, overflowY, overflowX } =\n element.ownerDocument.defaultView!.getComputedStyle(element)\n\n return /(auto|scroll)/.test(overflow + overflowX + overflowY)\n}\n\nfunction getScrollParent(element: HTMLElement): HTMLElement {\n const { parentElement } = element\n\n if (!element || !parentElement) return element\n\n if (isScrollable(element)) return element\n\n return getScrollParent(parentElement)\n}\n\ntype Props = {\n strength: number | null | undefined\n children: (\n getParallaxProps: <P extends { style?: CSSProperties; [key: string]: unknown }>(props: P) => P,\n ) => ReactNode\n}\n\nexport default function Parallax({ strength, children, ...rest }: Props): ReactNode {\n const container = useRef<HTMLDivElement>(null)\n const [containerScrollTop, setContainerScrollTop] = useState(strength == null ? 0 : strength)\n const lastScrollParentScrollTop = useRef(0)\n\n useIsomorphicLayoutEffect(() => {\n if (!container.current || strength == null || strength === 0) return undefined\n\n const containerDocument = container.current.ownerDocument\n const scrollParent = getScrollParent(container.current)\n const eventTarget =\n containerDocument.documentElement === scrollParent\n ? containerDocument.defaultView!\n : scrollParent\n\n lastScrollParentScrollTop.current = scrollParent.scrollTop\n setContainerScrollTop(strength)\n\n function handleScroll() {\n containerDocument.defaultView!.requestAnimationFrame(() => {\n if (!container.current) return\n\n const { top: containerTop, bottom: containerBottom } =\n container.current.getBoundingClientRect()\n const { top: scrollParentTop, bottom: scrollParentBottom } =\n scrollParent === containerDocument.documentElement\n ? { top: 0, bottom: containerDocument.defaultView!.innerHeight }\n : scrollParent.getBoundingClientRect()\n const { scrollTop: scrollParentScrollTop } =\n scrollParent === containerDocument.documentElement\n ? { scrollTop: containerDocument.defaultView!.pageYOffset }\n : scrollParent\n const scrollParentHeight = scrollParentBottom - scrollParentTop\n const scrollParentScrollDelta = scrollParentScrollTop - lastScrollParentScrollTop.current\n\n lastScrollParentScrollTop.current = scrollParentScrollTop\n\n setContainerScrollTop(scrollTop => {\n const isContainerVisible =\n containerTop < scrollParentTop + scrollParentHeight && containerBottom > scrollParentTop\n const containerScrollRemaining =\n scrollParentScrollDelta > 0 ? 2 * strength! - scrollTop : scrollTop\n const scrollParentScrollRemaining =\n scrollParentScrollDelta > 0\n ? scrollParentTop + containerBottom\n : scrollParentHeight - containerTop\n const parallaxRatio = containerScrollRemaining / scrollParentScrollRemaining\n const containerScrollDelta = isContainerVisible\n ? parallaxRatio * scrollParentScrollDelta\n : 0\n\n return clamp(0, scrollTop + containerScrollDelta, strength! * 2)\n })\n })\n }\n\n eventTarget.addEventListener('scroll', handleScroll)\n\n return () => eventTarget.removeEventListener('scroll', handleScroll)\n }, [strength])\n\n const getProps = useCallback(\n ({ style, ...restOfChildrenProps }: any) => ({\n ...restOfChildrenProps,\n style: {\n ...style,\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n ...(strength == null || strength === 0\n ? {}\n : {\n top: -strength,\n bottom: -strength,\n transform: `translate3d(0, ${containerScrollTop - strength}px, 0)`,\n }),\n },\n }),\n [strength, containerScrollTop],\n )\n\n return (\n <div\n {...rest}\n ref={container}\n style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n >\n {children(getProps)}\n </div>\n )\n}\n"],"mappings":"AAgHI;AAhHJ,SAAS,UAAU,QAAQ,mBAA6C;AACxE,OAAO,WAAW;AAClB,SAAS,iCAAiC;AAE1C,SAAS,aAAa,SAAsB;AAC1C,QAAM,EAAE,UAAU,WAAW,UAAU,IACrC,QAAQ,cAAc,YAAa,iBAAiB,OAAO;AAE7D,SAAO,gBAAgB,KAAK,WAAW,YAAY,SAAS;AAC9D;AAEA,SAAS,gBAAgB,SAAmC;AAC1D,QAAM,EAAE,cAAc,IAAI;AAE1B,MAAI,CAAC,WAAW,CAAC;AAAe,WAAO;AAEvC,MAAI,aAAa,OAAO;AAAG,WAAO;AAElC,SAAO,gBAAgB,aAAa;AACtC;AASe,SAAR,SAA0B,EAAE,UAAU,UAAU,GAAG,KAAK,GAAqB;AAClF,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAAS,YAAY,OAAO,IAAI,QAAQ;AAC5F,QAAM,4BAA4B,OAAO,CAAC;AAE1C,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU,WAAW,YAAY,QAAQ,aAAa;AAAG,aAAO;AAErE,UAAM,oBAAoB,UAAU,QAAQ;AAC5C,UAAM,eAAe,gBAAgB,UAAU,OAAO;AACtD,UAAM,cACJ,kBAAkB,oBAAoB,eAClC,kBAAkB,cAClB;AAEN,8BAA0B,UAAU,aAAa;AACjD,0BAAsB,QAAQ;AAE9B,aAAS,eAAe;AACtB,wBAAkB,YAAa,sBAAsB,MAAM;AACzD,YAAI,CAAC,UAAU;AAAS;AAExB,cAAM,EAAE,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AA,MACN;AAAA,IACF;AAAA,IACA,CAAC,UAAU,kBAAkB;AAAA,EAC/B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,EAAE;AAAA,MAEnE,mBAAS,QAAQ;AAAA;AAAA,EACpB;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/controls/rich-text-v2/plugin.ts"],"sourcesContent":["import { type KeyboardEvent } from 'react'\nimport { type Editor } from 'slate'\nimport { type RenderElementProps, type RenderLeafProps } from 'slate-react'\nimport { ControlDefinition, type Data, type RichTextPluginControl } from '@makeswift/controls'\n\nexport type RenderElement = (props: RenderElementProps) => JSX.Element\nexport type RenderLeaf = (props: RenderLeafProps) => JSX.Element\n\nexport type RichTextV2Plugin<C extends RichTextPluginControl = RichTextPluginControl> = {\n control?: C\n withPlugin?(editor: Editor): Editor\n onKeyDown?(event: KeyboardEvent, editor: Editor): void\n renderElement?: (\n renderElement: RenderElement,\n value: any,\n ) => (props: RenderElementProps) => JSX.Element\n renderLeaf?: (renderLeaf: RenderLeaf, value: any) => (props: RenderLeafProps) => JSX.Element\n}\n\nexport function Plugin<Def extends ControlDefinition, ValueType extends Data>({\n control,\n withPlugin,\n onKeyDown,\n renderElement,\n renderLeaf,\n}: RichTextV2Plugin<RichTextPluginControl<Def, ValueType>>) {\n return { control, withPlugin, onKeyDown, renderElement, renderLeaf }\n}\n"],"mappings":"AAmBO,SAAS,OAA8D;AAAA,EAC5E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA4D;AAC1D,SAAO,EAAE,SAAS,YAAY,WAAW,eAAe,WAAW;AACrE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/controls/rich-text-v2/plugin.ts"],"sourcesContent":["import { type KeyboardEvent, ReactNode } from 'react'\nimport { type Editor } from 'slate'\nimport { type RenderElementProps, type RenderLeafProps } from 'slate-react'\nimport { ControlDefinition, type Data, type RichTextPluginControl } from '@makeswift/controls'\n\nexport type RenderElement = (props: RenderElementProps) => ReactNode\nexport type RenderLeaf = (props: RenderLeafProps) => ReactNode\n\nexport type RichTextV2Plugin<C extends RichTextPluginControl = RichTextPluginControl> = {\n control?: C\n withPlugin?(editor: Editor): Editor\n onKeyDown?(event: KeyboardEvent, editor: Editor): void\n renderElement?: (\n renderElement: RenderElement,\n value: any,\n ) => (props: RenderElementProps) => ReactNode\n renderLeaf?: (renderLeaf: RenderLeaf, value: any) => (props: RenderLeafProps) => ReactNode\n}\n\nexport function Plugin<Def extends ControlDefinition, ValueType extends Data>({\n control,\n withPlugin,\n onKeyDown,\n renderElement,\n renderLeaf,\n}: RichTextV2Plugin<RichTextPluginControl<Def, ValueType>>) {\n return { control, withPlugin, onKeyDown, renderElement, renderLeaf }\n}\n"],"mappings":"AAmBO,SAAS,OAA8D;AAAA,EAC5E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA4D;AAC1D,SAAO,EAAE,SAAS,YAAY,WAAW,eAAe,WAAW;AACrE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/next/components/framework-provider/pages-router/HeadSnippet.tsx"],"sourcesContent":["import { type ReactElement, useEffect, isValidElement } from 'react'\n\nimport Head from 'next/head'\nimport Script from 'next/script'\n\nimport { type Snippet } from '../../../../client'\n\nimport {\n snippetToElements,\n getSnippetElementsFromDOM,\n cleanUpSnippet,\n} from '../../../../runtimes/react/components/page/HeadSnippet'\n\nconst isScriptElement = (element: string | JSX.Element): element is ReactElement<any, 'script'> =>\n isValidElement(element) && element.type === 'script'\n\nexport function HeadSnippet({ snippet }: { snippet: Snippet }) {\n useEffect(() => {\n return () => {\n const snippetElements = getSnippetElementsFromDOM(snippet)\n if (snippetElements.length > 0) return\n cleanUpSnippet(snippet)\n }\n }, [snippet])\n\n const headSnippetElements = snippetToElements(snippet)\n\n return (\n <>\n {headSnippetElements.map((element, i) =>\n isScriptElement(element) ? (\n <Script key={element.key} {...element.props} strategy=\"beforeInteractive\" />\n ) : (\n <Head key={isValidElement(element) ? element.key : i}>{element}</Head>\n ),\n )}\n </>\n )\n}\n"],"mappings":"AA4BI,mBAGM,WAHN;AA5BJ,SAA4B,WAAW,sBAAsB;AAE7D,OAAO,UAAU;AACjB,OAAO,YAAY;AAInB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAkB,CAAC,YACvB,eAAe,OAAO,KAAK,QAAQ,SAAS;AAEvC,SAAS,YAAY,EAAE,QAAQ,GAAyB;AAC7D,YAAU,MAAM;AACd,WAAO,MAAM;AACX,YAAM,kBAAkB,0BAA0B,OAAO;AACzD,UAAI,gBAAgB,SAAS;AAAG;AAChC,qBAAe,OAAO;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,sBAAsB,kBAAkB,OAAO;AAErD,SACE,gCACG,8BAAoB;AAAA,IAAI,CAAC,SAAS,MACjC,gBAAgB,OAAO,IACrB,oBAAC,UAA0B,GAAG,QAAQ,OAAO,UAAS,uBAAzC,QAAQ,GAAqD,IAE1E,oBAAC,QAAsD,qBAA5C,eAAe,OAAO,IAAI,QAAQ,MAAM,CAAY;AAAA,EAEnE,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/next/components/framework-provider/pages-router/HeadSnippet.tsx"],"sourcesContent":["import { type ReactElement, useEffect, isValidElement, ReactNode } from 'react'\n\nimport Head from 'next/head'\nimport Script from 'next/script'\n\nimport { type Snippet } from '../../../../client'\n\nimport {\n snippetToElements,\n getSnippetElementsFromDOM,\n cleanUpSnippet,\n} from '../../../../runtimes/react/components/page/HeadSnippet'\n\nconst isScriptElement = (element: string | ReactNode): element is ReactElement<any, 'script'> =>\n isValidElement(element) && element.type === 'script'\n\nexport function HeadSnippet({ snippet }: { snippet: Snippet }) {\n useEffect(() => {\n return () => {\n const snippetElements = getSnippetElementsFromDOM(snippet)\n if (snippetElements.length > 0) return\n cleanUpSnippet(snippet)\n }\n }, [snippet])\n\n const headSnippetElements = snippetToElements(snippet)\n\n return (\n <>\n {headSnippetElements.map((element, i) =>\n isScriptElement(element) ? (\n <Script key={element.key} {...element.props} strategy=\"beforeInteractive\" />\n ) : (\n <Head key={isValidElement(element) ? element.key : i}>{element}</Head>\n ),\n )}\n </>\n )\n}\n"],"mappings":"AA4BI,mBAGM,WAHN;AA5BJ,SAA4B,WAAW,sBAAiC;AAExE,OAAO,UAAU;AACjB,OAAO,YAAY;AAInB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAkB,CAAC,YACvB,eAAe,OAAO,KAAK,QAAQ,SAAS;AAEvC,SAAS,YAAY,EAAE,QAAQ,GAAyB;AAC7D,YAAU,MAAM;AACd,WAAO,MAAM;AACX,YAAM,kBAAkB,0BAA0B,OAAO;AACzD,UAAI,gBAAgB,SAAS;AAAG;AAChC,qBAAe,OAAO;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,sBAAsB,kBAAkB,OAAO;AAErD,SACE,gCACG,8BAAoB;AAAA,IAAI,CAAC,SAAS,MACjC,gBAAgB,OAAO,IACrB,oBAAC,UAA0B,GAAG,QAAQ,OAAO,UAAS,uBAAzC,QAAQ,GAAqD,IAE1E,oBAAC,QAAsD,qBAA5C,eAAe,OAAO,IAAI,QAAQ,MAAM,CAAY;AAAA,EAEnE,GACF;AAEJ;","names":[]}
@@ -1,8 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Fragment, forwardRef, useRef, isValidElement } from "react";
2
+ import { Fragment, forwardRef, useRef, isValidElement, act } from "react";
3
3
  import { renderToReadableStream } from "react-dom/server";
4
4
  import { JSDOM } from "jsdom";
5
- import { act } from "react-dom/test-utils";
6
5
  import { render, screen } from "@testing-library/react";
7
6
  import "@testing-library/jest-dom";
8
7
  import { ServerInsertedHTMLContext } from "next/navigation";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"sourcesContent":["import { type ReactNode, Fragment, forwardRef, useRef, isValidElement } from 'react'\nimport { renderToReadableStream } from 'react-dom/server'\nimport { JSDOM } from 'jsdom'\nimport { act } from 'react-dom/test-utils'\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\nimport { ServerInsertedHTMLContext } from 'next/navigation'\n\nimport { type Data, type ValueType, type DataType, ControlDefinition } from '@makeswift/controls'\n\nimport { type CacheData } from '../../../../api/react'\nimport { ElementData } from '../../../../state/react-page'\nimport { ReactRuntime } from '../../../../react'\nimport { MakeswiftComponent } from '../../../../runtimes/react/components/MakeswiftComponent'\nimport { Page } from '../../page'\nimport { isServer } from '../../../../utils/is-server'\nimport * as Testing from '../../../testing'\n\nconst ROOT_ID = '00000000-0000-0000-0000-000000000000'\nconst ELEMENT_ID = '11111111-1111-1111-1111-111111111111'\n\nconst renderProp = (prop: any) =>\n prop === undefined ? 'undefined' : isValidElement(prop) ? prop : JSON.stringify(prop)\n\nconst propSnapshot = (prop: HTMLElement | null) =>\n prop?.childElementCount ? prop.childNodes : parseStringifiedProp(prop?.textContent ?? '')\n\nconst parseStringifiedProp = (prop: string) => (prop === 'undefined' ? undefined : JSON.parse(prop))\n\nasync function streamToString(stream: ReadableStream) {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n\n let result = ''\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n result += decoder.decode(value, { stream: true })\n }\n\n return result\n}\n\nasync function renderToString(element: ReactNode) {\n return await streamToString(await renderToReadableStream(element))\n}\n\nasync function serverSideRender(children: ReactNode) {\n // wrap the children in a context provider to capture server-inserted HTML, see\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/server-inserted-html.tsx\n const serverInsertedCallbacks: (() => React.ReactNode)[] = []\n\n const elementTree = (\n <ServerInsertedHTMLContext.Provider value={handler => serverInsertedCallbacks.push(handler)}>\n {children}\n </ServerInsertedHTMLContext.Provider>\n )\n\n const elementsHTML = await renderToString(elementTree)\n\n const serverInsertedNodes = serverInsertedCallbacks.map((callback, index) => (\n <Fragment key={'__next_server_inserted__' + index}>{callback()}</Fragment>\n ))\n\n const headHTML = await renderToString(serverInsertedNodes)\n\n const dom = new JSDOM(\n `<!DOCTYPE html><head>${headHTML}</head><body><div id=\"root\">${elementsHTML}</div></body></div>`,\n {\n runScripts: 'dangerously',\n },\n )\n\n return dom.window.document\n}\n\nexport async function testPageControlPropRendering<D extends ControlDefinition>(\n controlDefinition: D,\n {\n toData,\n value,\n locale,\n cacheData,\n expectedRenders,\n registerComponents,\n action,\n rootElements = [],\n }: {\n toData?: (value: ValueType<D>) => DataType<D>\n value: ValueType<D> | undefined\n locale?: string | null\n cacheData?: Partial<CacheData>\n expectedRenders?: number\n registerComponents?: (runtime: ReactRuntime) => void\n action?: (element: HTMLElement) => Promise<void>\n rootElements?: ElementData[]\n },\n) {\n // Arrange\n const controlData: DataType<D> | Data =\n value !== undefined ? (toData ? toData(value) : controlDefinition.toData(value)) : undefined\n\n const testComponentMeta = {\n type: 'TestComponent',\n label: 'Test Component',\n }\n\n const testId = 'test-id'\n const renderCountTestId = 'render-count-test-id'\n const elementData: ElementData = {\n key: ELEMENT_ID,\n type: testComponentMeta.type,\n props: {\n propKey: controlData,\n },\n }\n\n const runtime = new ReactRuntime()\n registerComponents?.(runtime)\n\n // Act\n runtime.registerComponent(\n forwardRef<HTMLDivElement, { propKey?: any }>(({ propKey }, ref) => {\n const renderCount = useRef(0)\n ++renderCount.current\n\n return (\n <div ref={ref}>\n <div data-testid={renderCountTestId}>{renderCount.current}</div>\n <div data-testid={testId}>{renderProp(propKey)}</div>\n </div>\n )\n }),\n {\n ...testComponentMeta,\n props: {\n propKey: controlDefinition as any,\n },\n },\n )\n\n const testElementTree = (component: ReactNode) => (\n <Testing.ReactProvider runtime={runtime}>{component}</Testing.ReactProvider>\n )\n\n if (!isServer()) {\n const rootElementData: ElementData = Testing.createRootComponent(\n [elementData, ...rootElements],\n ROOT_ID,\n )\n\n const snapshot = Testing.createMakeswiftPageSnapshot(rootElementData, { locale, cacheData })\n\n // Assert\n await act(async () => render(testElementTree(<Page snapshot={snapshot} />)))\n\n if (action) {\n await act(async () => {\n await action(screen.getByTestId(testId))\n })\n }\n\n expect(snapshot).toMatchSnapshot('snapshot')\n expect(propSnapshot(screen.getByTestId(testId))).toMatchSnapshot('resolvedValue')\n\n if (expectedRenders != null) {\n expect(Number(screen.getByTestId(renderCountTestId).textContent)).toBe(expectedRenders)\n }\n } else {\n // test server-side rendering using a component snapshot\n console.assert(action == null)\n console.assert(rootElements.length === 0)\n\n const snapshot = Testing.createMakeswiftComponentSnapshot(elementData, { locale, cacheData })\n const elementTree = testElementTree(\n <MakeswiftComponent snapshot={snapshot} {...testComponentMeta} />,\n )\n\n const document = await serverSideRender(elementTree)\n const getByTestId = (id: string): HTMLElement | null =>\n document.querySelector(`[data-testid=\"${id}\"]`)\n\n expect(propSnapshot(getByTestId(testId))).toMatchSnapshot('resolvedValue')\n expect([...document.querySelectorAll('style')].map(n => n.textContent)).toMatchSnapshot(\n 'component styles',\n )\n expect(Number(getByTestId(renderCountTestId)?.textContent)).toBe(1)\n }\n}\n"],"mappings":"AAsDI,cA0EI,YA1EJ;AAtDJ,SAAyB,UAAU,YAAY,QAAQ,sBAAsB;AAC7E,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AAC/B,OAAO;AACP,SAAS,iCAAiC;AAM1C,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,YAAY,aAAa;AAEzB,MAAM,UAAU;AAChB,MAAM,aAAa;AAEnB,MAAM,aAAa,CAAC,SAClB,SAAS,SAAY,cAAc,eAAe,IAAI,IAAI,OA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AAM;AAC3B,aAAO,OAAO,OAAO,YAAY,iBAAiB,EAAE,WAAW,CAAC,EAAE,KAAK,eAAe;AAAA,IACxF;AAAA,EACF,OAAO;AAEL,YAAQ,OAAO,UAAU,IAAI;AAC7B,YAAQ,OAAO,aAAa,WAAW,CAAC;AAExC,UAAM,WAAW,QAAQ,iCAAiC,aAAa,EAAE,QAAQ,UAAU,CAAC;AAC5F,UAAM,cAAc;AAAA,MAClB,oBAAC,sBAAmB,UAAqB,GAAG,mBAAmB;AAAA,IACjE;AAEA,UAAM,WAAW,MAAM,iBAAiB,WAAW;AACnD,UAAM,cAAc,CAAC,OACnB,SAAS,cAAc,iBAAiB,EAAE,IAAI;AAEhD,WAAO,aAAa,YAAY,MAAM,CAAC,CAAC,EAAE,gBAAgB,eAAe;AACzE,WAAO,CAAC,GAAG,SAAS,iBAAiB,OAAO,CAAC,EAAE,IAAI,OAAK,EAAE,WAAW,CAAC,EAAE;AAAA,MACtE;AAAA,IACF;AACA,WAAO,OAAO,YAAY,iBAAiB,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;AAAA,EACpE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"sourcesContent":["import { type ReactNode, Fragment, forwardRef, useRef, isValidElement, act } from 'react';\nimport { renderToReadableStream } from 'react-dom/server'\nimport { JSDOM } from 'jsdom'\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\nimport { ServerInsertedHTMLContext } from 'next/navigation'\n\nimport { type Data, type ValueType, type DataType, ControlDefinition } from '@makeswift/controls'\n\nimport { type CacheData } from '../../../../api/react'\nimport { ElementData } from '../../../../state/react-page'\nimport { ReactRuntime } from '../../../../react'\nimport { MakeswiftComponent } from '../../../../runtimes/react/components/MakeswiftComponent'\nimport { Page } from '../../page'\nimport { isServer } from '../../../../utils/is-server'\nimport * as Testing from '../../../testing'\n\nconst ROOT_ID = '00000000-0000-0000-0000-000000000000'\nconst ELEMENT_ID = '11111111-1111-1111-1111-111111111111'\n\nconst renderProp = (prop: any) =>\n prop === undefined ? 'undefined' : isValidElement(prop) ? prop : JSON.stringify(prop)\n\nconst propSnapshot = (prop: HTMLElement | null) =>\n prop?.childElementCount ? prop.childNodes : parseStringifiedProp(prop?.textContent ?? '')\n\nconst parseStringifiedProp = (prop: string) => (prop === 'undefined' ? undefined : JSON.parse(prop))\n\nasync function streamToString(stream: ReadableStream) {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n\n let result = ''\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n result += decoder.decode(value, { stream: true })\n }\n\n return result\n}\n\nasync function renderToString(element: ReactNode) {\n return await streamToString(await renderToReadableStream(element))\n}\n\nasync function serverSideRender(children: ReactNode) {\n // wrap the children in a context provider to capture server-inserted HTML, see\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/server-inserted-html.tsx\n const serverInsertedCallbacks: (() => React.ReactNode)[] = []\n\n const elementTree = (\n <ServerInsertedHTMLContext.Provider value={handler => serverInsertedCallbacks.push(handler)}>\n {children}\n </ServerInsertedHTMLContext.Provider>\n )\n\n const elementsHTML = await renderToString(elementTree)\n\n const serverInsertedNodes = serverInsertedCallbacks.map((callback, index) => (\n <Fragment key={'__next_server_inserted__' + index}>{callback()}</Fragment>\n ))\n\n const headHTML = await renderToString(serverInsertedNodes)\n\n const dom = new JSDOM(\n `<!DOCTYPE html><head>${headHTML}</head><body><div id=\"root\">${elementsHTML}</div></body></div>`,\n {\n runScripts: 'dangerously',\n },\n )\n\n return dom.window.document\n}\n\nexport async function testPageControlPropRendering<D extends ControlDefinition>(\n controlDefinition: D,\n {\n toData,\n value,\n locale,\n cacheData,\n expectedRenders,\n registerComponents,\n action,\n rootElements = [],\n }: {\n toData?: (value: ValueType<D>) => DataType<D>\n value: ValueType<D> | undefined\n locale?: string | null\n cacheData?: Partial<CacheData>\n expectedRenders?: number\n registerComponents?: (runtime: ReactRuntime) => void\n action?: (element: HTMLElement) => Promise<void>\n rootElements?: ElementData[]\n },\n) {\n // Arrange\n const controlData: DataType<D> | Data =\n value !== undefined ? (toData ? toData(value) : controlDefinition.toData(value)) : undefined\n\n const testComponentMeta = {\n type: 'TestComponent',\n label: 'Test Component',\n }\n\n const testId = 'test-id'\n const renderCountTestId = 'render-count-test-id'\n const elementData: ElementData = {\n key: ELEMENT_ID,\n type: testComponentMeta.type,\n props: {\n propKey: controlData,\n },\n }\n\n const runtime = new ReactRuntime()\n registerComponents?.(runtime)\n\n // Act\n runtime.registerComponent(\n forwardRef<HTMLDivElement, { propKey?: any }>(({ propKey }, ref) => {\n const renderCount = useRef(0)\n ++renderCount.current\n\n return (\n <div ref={ref}>\n <div data-testid={renderCountTestId}>{renderCount.current}</div>\n <div data-testid={testId}>{renderProp(propKey)}</div>\n </div>\n )\n }),\n {\n ...testComponentMeta,\n props: {\n propKey: controlDefinition as any,\n },\n },\n )\n\n const testElementTree = (component: ReactNode) => (\n <Testing.ReactProvider runtime={runtime}>{component}</Testing.ReactProvider>\n )\n\n if (!isServer()) {\n const rootElementData: ElementData = Testing.createRootComponent(\n [elementData, ...rootElements],\n ROOT_ID,\n )\n\n const snapshot = Testing.createMakeswiftPageSnapshot(rootElementData, { locale, cacheData })\n\n // Assert\n await act(async () => render(testElementTree(<Page snapshot={snapshot} />)))\n\n if (action) {\n await act(async () => {\n await action(screen.getByTestId(testId))\n })\n }\n\n expect(snapshot).toMatchSnapshot('snapshot')\n expect(propSnapshot(screen.getByTestId(testId))).toMatchSnapshot('resolvedValue')\n\n if (expectedRenders != null) {\n expect(Number(screen.getByTestId(renderCountTestId).textContent)).toBe(expectedRenders)\n }\n } else {\n // test server-side rendering using a component snapshot\n console.assert(action == null)\n console.assert(rootElements.length === 0)\n\n const snapshot = Testing.createMakeswiftComponentSnapshot(elementData, { locale, cacheData })\n const elementTree = testElementTree(\n <MakeswiftComponent snapshot={snapshot} {...testComponentMeta} />,\n )\n\n const document = await serverSideRender(elementTree)\n const getByTestId = (id: string): HTMLElement | null =>\n document.querySelector(`[data-testid=\"${id}\"]`)\n\n expect(propSnapshot(getByTestId(testId))).toMatchSnapshot('resolvedValue')\n expect([...document.querySelectorAll('style')].map(n => n.textContent)).toMatchSnapshot(\n 'component styles',\n )\n expect(Number(getByTestId(renderCountTestId)?.textContent)).toBe(1)\n }\n}\n"],"mappings":"AAqDI,cA0EI,YA1EJ;AArDJ,SAAyB,UAAU,YAAY,QAAQ,gBAAgB,WAAW;AAClF,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,QAAQ,cAAc;AAC/B,OAAO;AACP,SAAS,iCAAiC;AAM1C,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,YAAY,aAAa;AAEzB,MAAM,UAAU;AAChB,MAAM,aAAa;AAEnB,MAAM,aAAa,CAAC,SAClB,SAAS,SAAY,cAAc,eAAe,IAAI,IAAI,OAAO,KAAK,UAAU,IAAI;AAEtF,MAAM,eAAe,CAAC,SACpB,MAAM,oBAAoB,KAAK,aAAa,qBAAqB,MAAM,eAAe,EAAE;AAE1F,MAAM,uBAAuB,CAAC,SAAkB,SAAS,cAAc,SAAY,KAAK,MAAM,IAAI;AAElG,eAAe,eAAe,QAAwB;AACpD,QAAM,SAAS,OAAO,UAAU;AAChC,QAAM,UAAU,IAAI,YAAY;AAEhC,MAAI,SAAS;AAEb,SAAO,MAAM;AACX,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,QAAI;AAAM;AACV,cAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;AAEA,eAAe,eAAe,SAAoB;AAChD,SAAO,MAAM,eAAe,MAAM,uBAAuB,OAAO,CAAC;AACnE;AAEA,eAAe,iBAAiB,UAAqB;AAGnD,QAAM,0BAAqD,CAAC;AAE5D,QAAM,cACJ,oBAAC,0BAA0B,UAA1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iB,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;AAAA,EACpE;AACF;","names":[]}
@@ -0,0 +1,61 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Suspense, act } from "react";
3
+ import { render } from "@testing-library/react";
4
+ import { ReactRuntime } from "../../../../react";
5
+ import * as Testing from "../../../testing";
6
+ import { MakeswiftComponent } from "../../../../runtimes/react/components/MakeswiftComponent";
7
+ import { Checkbox, TextInput } from "@makeswift/controls";
8
+ const CustomComponentType = "CustomComponent";
9
+ const componentId = "component-id";
10
+ const containerId = "container-id";
11
+ const fallbackId = "fallback-id";
12
+ function CustomComponent({ text, suspend }) {
13
+ if (suspend) {
14
+ throw new Promise(() => {
15
+ });
16
+ }
17
+ return /* @__PURE__ */ jsx("div", { "data-testid": componentId, children: text });
18
+ }
19
+ function CustomComponentWithFallback(props) {
20
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { "data-testid": fallbackId, children: "Loading..." }), children: /* @__PURE__ */ jsx(CustomComponent, { ...props }) });
21
+ }
22
+ const elementData = (props) => ({
23
+ type: CustomComponentType,
24
+ key: "0000-0000-0000-0000",
25
+ props
26
+ });
27
+ async function renderComponentSnapshot(snapshot, component = CustomComponent, { builtinSuspense } = {}) {
28
+ const runtime = new ReactRuntime();
29
+ runtime.registerComponent(component, {
30
+ type: CustomComponentType,
31
+ label: "Custom Component",
32
+ builtinSuspense,
33
+ props: {
34
+ text: TextInput({ defaultValue: "Default Text" }),
35
+ suspend: Checkbox({ defaultValue: false, label: "Suspend" })
36
+ }
37
+ });
38
+ await act(
39
+ async () => render(
40
+ /* @__PURE__ */ jsx(Testing.ReactProvider, { runtime, siteVersion: null, children: /* @__PURE__ */ jsx("div", { "data-testid": containerId, children: /* @__PURE__ */ jsx(
41
+ MakeswiftComponent,
42
+ {
43
+ label: "Embedded Component",
44
+ type: CustomComponentType,
45
+ snapshot
46
+ }
47
+ ) }) })
48
+ )
49
+ );
50
+ }
51
+ export {
52
+ CustomComponent,
53
+ CustomComponentType,
54
+ CustomComponentWithFallback,
55
+ componentId,
56
+ containerId,
57
+ elementData,
58
+ fallbackId,
59
+ renderComponentSnapshot
60
+ };
61
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/next/components/tests/makeswift-component/fixtures.tsx"],"sourcesContent":["import { Suspense, act } from 'react'\nimport { render } from '@testing-library/react'\n\nimport { ReactRuntime } from '../../../../react'\nimport * as Testing from '../../../testing'\nimport { MakeswiftComponent } from '../../../../runtimes/react/components/MakeswiftComponent'\nimport { type MakeswiftComponentSnapshot } from '../../../../client'\n\nimport { Checkbox, TextInput } from '@makeswift/controls'\nimport { ComponentType } from '../../../../state/react-page'\n\nexport const CustomComponentType = 'CustomComponent'\nexport const componentId = 'component-id'\nexport const containerId = 'container-id'\nexport const fallbackId = 'fallback-id'\n\nexport type ComponentProps = {\n text: string\n suspend: boolean\n}\n\nexport function CustomComponent({ text, suspend }: ComponentProps) {\n if (suspend) {\n throw new Promise(() => {}) // suspend indefinitely\n }\n\n return <div data-testid={componentId}>{text}</div>\n}\n\nexport function CustomComponentWithFallback(props: ComponentProps) {\n return (\n <Suspense fallback={<div data-testid={fallbackId}>Loading...</div>}>\n <CustomComponent {...props} />\n </Suspense>\n )\n}\n\nexport const elementData = (props: { text: string; suspend?: boolean }) => ({\n type: CustomComponentType,\n key: '0000-0000-0000-0000',\n props,\n})\n\nexport async function renderComponentSnapshot(\n snapshot: MakeswiftComponentSnapshot,\n component: ComponentType<ComponentProps> = CustomComponent,\n { builtinSuspense }: { builtinSuspense?: boolean } = {},\n) {\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component, {\n type: CustomComponentType,\n label: 'Custom Component',\n builtinSuspense,\n props: {\n text: TextInput({ defaultValue: 'Default Text' }),\n suspend: Checkbox({ defaultValue: false, label: 'Suspend' }),\n },\n })\n\n await act(async () =>\n render(\n <Testing.ReactProvider runtime={runtime} siteVersion={null}>\n <div data-testid={containerId}>\n <MakeswiftComponent\n label=\"Embedded Component\"\n type={CustomComponentType}\n snapshot={snapshot}\n />\n </div>\n </Testing.ReactProvider>,\n ),\n )\n}\n"],"mappings":"AA0BS;AA1BT,SAAS,UAAU,WAAW;AAC9B,SAAS,cAAc;AAEvB,SAAS,oBAAoB;AAC7B,YAAY,aAAa;AACzB,SAAS,0BAA0B;AAGnC,SAAS,UAAU,iBAAiB;AAG7B,MAAM,sBAAsB;AAC5B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,aAAa;AAOnB,SAAS,gBAAgB,EAAE,MAAM,QAAQ,GAAmB;AACjE,MAAI,SAAS;AACX,UAAM,IAAI,QAAQ,MAAM;AAAA,IAAC,CAAC;AAAA,EAC5B;AAEA,SAAO,oBAAC,SAAI,eAAa,aAAc,gBAAK;AAC9C;AAEO,SAAS,4BAA4B,OAAuB;AACjE,SACE,oBAAC,YAAS,UAAU,oBAAC,SAAI,eAAa,YAAY,wBAAU,GAC1D,8BAAC,mBAAiB,GAAG,OAAO,GAC9B;AAEJ;AAEO,MAAM,cAAc,CAAC,WAAgD;AAAA,EAC1E,MAAM;AAAA,EACN,KAAK;AAAA,EACL;AACF;AAEA,eAAsB,wBACpB,UACA,YAA2C,iBAC3C,EAAE,gBAAgB,IAAmC,CAAC,GACtD;AACA,QAAM,UAAU,IAAI,aAAa;AAEjC,UAAQ,kBAAkB,WAAW;AAAA,IACnC,MAAM;AAAA,IACN,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACL,MAAM,UAAU,EAAE,cAAc,eAAe,CAAC;AAAA,MAChD,SAAS,SAAS,EAAE,cAAc,OAAO,OAAO,UAAU,CAAC;AAAA,IAC7D;AAAA,EACF,CAAC;AAED,QAAM;AAAA,IAAI,YACR;AAAA,MACE,oBAAC,QAAQ,eAAR,EAAsB,SAAkB,aAAa,MACpD,8BAAC,SAAI,eAAa,aAChB;AAAA,QAAC;AAAA;AAAA,UACC,OAAM;AAAA,UACN,MAAM;AAAA,UACN;AAAA;AAAA,MACF,GACF,GACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -6,7 +6,7 @@ import {
6
6
  } from "@makeswift/prop-controllers";
7
7
  import { randomUUID } from "crypto";
8
8
  import { Page } from "../../page";
9
- import { act } from "react-dom/test-utils";
9
+ import { act } from "react";
10
10
  import { ReactRuntime } from "../../../../react";
11
11
  import * as Testing from "../../../testing";
12
12
  const pagePropControllerTest = (propDef, value, component, assert, options) => describe("Page", () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/next/components/tests/prop-controllers/page-prop-controller.tsx"],"sourcesContent":["/** @jest-environment jsdom */\n\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\n\nimport {\n type OptionsType,\n Types,\n type Descriptor,\n type PropDef,\n type Value,\n} from '@makeswift/prop-controllers'\n\nimport { type ElementData, type ComponentType } from '../../../../state/react-page'\nimport { randomUUID } from 'crypto'\n\nimport { Page } from '../../page'\nimport { act } from 'react-dom/test-utils'\nimport { ReactRuntime } from '../../../../react'\nimport * as Testing from '../../../testing'\n\nexport const pagePropControllerTest = <\n P extends PropDef & ((options?: any) => any),\n C extends ComponentType<{ propKey: Value<P> | undefined }>,\n>(\n propDef: P,\n value: Value<typeof propDef>,\n component: (testId: string) => C,\n assert: (element: HTMLElement) => void,\n options?: OptionsType<P>,\n) =>\n describe('Page', () => {\n test(`can render ${propDef.type} v0 data`, async () => {\n // Arrange\n const descriptorV0: Descriptor<typeof propDef> = {\n type: propDef.type,\n options,\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n\n const elementData: ElementData = Testing.createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, descriptorV0),\n },\n },\n ])\n const snapshot = Testing.createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(options),\n },\n })\n\n await act(async () =>\n render(\n <Testing.ReactProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </Testing.ReactProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n\n test(`can render ${propDef.type} v1 data`, async () => {\n // Arrange\n const gapXDefinitionV1: Descriptor<typeof propDef> = {\n type: Types.GapX,\n version: 1,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n const elementData: ElementData = Testing.createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, gapXDefinitionV1),\n },\n },\n ])\n const snapshot = Testing.createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(options),\n },\n })\n\n await act(async () =>\n render(\n <Testing.ReactProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </Testing.ReactProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n })\n"],"mappings":"AAiEY;AA/DZ,SAAS,QAAQ,cAAc;AAC/B,OAAO;AAEP;AAAA,EAEE;AAAA,OAIK;AAGP,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,oBAAoB;AAC7B,YAAY,aAAa;AAElB,MAAM,yBAAyB,CAIpC,SACA,OACA,WACA,QACA,YAEA,SAAS,QAAQ,MAAM;AACrB,OAAK,cAAc,QAAQ,IAAI,YAAY,YAAY;AAErD,UAAM,eAA2C;AAAA,MAC/C,MAAM,QAAQ;AAAA,MACd;AAAA,IACF;AAEA,UAAM,oBAAoB;AAC1B,UAAM,SAAS;AAEf,UAAM,cAA2B,QAAQ,oBAAoB;AAAA,MAC3D;AAAA,QACE,KAAK,WAAW;AAAA,QAChB,MAAM;AAAA,QACN,OAAO;AAAA,UACL,SAAS,QAAQ,WAAW,OAAO,YAAY;AAAA,QACjD;AAAA,MACF;AAA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/prop-controllers/page-prop-controller.tsx"],"sourcesContent":["/** @jest-environment jsdom */\n\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\n\nimport {\n type OptionsType,\n Types,\n type Descriptor,\n type PropDef,\n type Value,\n} from '@makeswift/prop-controllers'\n\nimport { type ElementData, type ComponentType } from '../../../../state/react-page'\nimport { randomUUID } from 'crypto'\n\nimport { Page } from '../../page'\nimport { act } from \"react\";\nimport { ReactRuntime } from '../../../../react'\nimport * as Testing from '../../../testing'\n\nexport const pagePropControllerTest = <\n P extends PropDef & ((options?: any) => any),\n C extends ComponentType<{ propKey: Value<P> | undefined }>,\n>(\n propDef: P,\n value: Value<typeof propDef>,\n component: (testId: string) => C,\n assert: (element: HTMLElement) => void,\n options?: OptionsType<P>,\n) =>\n describe('Page', () => {\n test(`can render ${propDef.type} v0 data`, async () => {\n // Arrange\n const descriptorV0: Descriptor<typeof propDef> = {\n type: propDef.type,\n options,\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n\n const elementData: ElementData = Testing.createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, descriptorV0),\n },\n },\n ])\n const snapshot = Testing.createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(options),\n },\n })\n\n await act(async () =>\n render(\n <Testing.ReactProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </Testing.ReactProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n\n test(`can render ${propDef.type} v1 data`, async () => {\n // Arrange\n const gapXDefinitionV1: Descriptor<typeof propDef> = {\n type: Types.GapX,\n version: 1,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n const elementData: ElementData = Testing.createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, gapXDefinitionV1),\n },\n },\n ])\n const snapshot = Testing.createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(options),\n },\n })\n\n await act(async () =>\n render(\n <Testing.ReactProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </Testing.ReactProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n })\n"],"mappings":"AAiEY;AA/DZ,SAAS,QAAQ,cAAc;AAC/B,OAAO;AAEP;AAAA,EAEE;AAAA,OAIK;AAGP,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,oBAAoB;AAC7B,YAAY,aAAa;AAElB,MAAM,yBAAyB,CAIpC,SACA,OACA,WACA,QACA,YAEA,SAAS,QAAQ,MAAM;AACrB,OAAK,cAAc,QAAQ,IAAI,YAAY,YAAY;AAErD,UAAM,eAA2C;AAAA,MAC/C,MAAM,QAAQ;AAAA,MACd;AAAA,IACF;AAEA,UAAM,oBAAoB;AAC1B,UAAM,SAAS;AAEf,UAAM,cAA2B,QAAQ,oBAAoB;AAAA,MAC3D;AAAA,QACE,KAAK,WAAW;AAAA,QAChB,MAAM;AAAA,QACN,OAAO;AAAA,UACL,SAAS,QAAQ,WAAW,OAAO,YAAY;AAAA,QACjD;AAAA,MACF;AAAA,IACF,CAAC;AACD,UAAM,WAAW,QAAQ,4BAA4B,WAAW;AAChE,UAAM,UAAU,IAAI,aAAa;AAEjC,YAAQ,kBAAkB,UAAU,MAAM,GAAG;AAAA,MAC3C,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,QACL,SAAS,QAAQ,OAAO;AAAA,MAC1B;AAAA,IACF,CAAC;AAED,UAAM;AAAA,MAAI,YACR;AAAA,QACE,oBAAC,QAAQ,eAAR,EAAsB,SACrB,8BAAC,QAAK,UAAoB,GAC5B;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,YAA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