@makeswift/runtime 0.16.0-canary.2 → 0.16.0-canary.3

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 (80) hide show
  1. package/dist/cjs/builder/serialization/control-serialization.js +2 -2
  2. package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
  3. package/dist/cjs/components/builtin/Button/Button.js.map +1 -1
  4. package/dist/cjs/components/builtin/Button/register.js +1 -1
  5. package/dist/cjs/components/builtin/Button/register.js.map +1 -1
  6. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  7. package/dist/cjs/components/builtin/Form/context/FormContext.js.map +1 -1
  8. package/dist/cjs/components/builtin/Form/register.js +2 -2
  9. package/dist/cjs/components/builtin/Form/register.js.map +1 -1
  10. package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
  11. package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  12. package/dist/cjs/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  13. package/dist/cjs/components/builtin/Navigation/register.js +1 -1
  14. package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
  15. package/dist/cjs/components/builtin/Text/Text.js +4 -3
  16. package/dist/cjs/components/builtin/Text/Text.js.map +1 -1
  17. package/dist/cjs/components/hooks/useTextStylePropControllerData.js +34 -0
  18. package/dist/cjs/components/hooks/useTextStylePropControllerData.js.map +1 -0
  19. package/dist/cjs/components/utils/responsive-style.js.map +1 -1
  20. package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
  21. package/dist/cjs/prop-controllers/descriptors.js +0 -6
  22. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  23. package/dist/cjs/prop-controllers/index.js.map +1 -1
  24. package/dist/cjs/runtimes/react/controls.js +11 -0
  25. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  26. package/dist/esm/builder/serialization/control-serialization.js +2 -2
  27. package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
  28. package/dist/esm/components/builtin/Button/Button.js.map +1 -1
  29. package/dist/esm/components/builtin/Button/register.js +2 -2
  30. package/dist/esm/components/builtin/Button/register.js.map +1 -1
  31. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  32. package/dist/esm/components/builtin/Form/context/FormContext.js.map +1 -1
  33. package/dist/esm/components/builtin/Form/register.js +3 -2
  34. package/dist/esm/components/builtin/Form/register.js.map +1 -1
  35. package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
  36. package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
  37. package/dist/esm/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.js.map +1 -1
  38. package/dist/esm/components/builtin/Navigation/register.js +3 -2
  39. package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
  40. package/dist/esm/components/builtin/Text/Text.js +4 -3
  41. package/dist/esm/components/builtin/Text/Text.js.map +1 -1
  42. package/dist/esm/components/hooks/useTextStylePropControllerData.js +12 -0
  43. package/dist/esm/components/hooks/useTextStylePropControllerData.js.map +1 -0
  44. package/dist/esm/components/utils/responsive-style.js.map +1 -1
  45. package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
  46. package/dist/esm/prop-controllers/descriptors.js +0 -5
  47. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  48. package/dist/esm/prop-controllers/index.js.map +1 -1
  49. package/dist/esm/runtimes/react/controls.js +11 -0
  50. package/dist/esm/runtimes/react/controls.js.map +1 -1
  51. package/dist/types/builder/serialization/control-serialization.d.ts +7 -7
  52. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  53. package/dist/types/components/builtin/Button/Button.d.ts +3 -3
  54. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  55. package/dist/types/components/builtin/Form/Form.d.ts +4 -4
  56. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  57. package/dist/types/components/builtin/Form/context/FormContext.d.ts +2 -3
  58. package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -1
  59. package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
  60. package/dist/types/components/builtin/Navigation/Navigation.d.ts +3 -3
  61. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  62. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts +2 -3
  63. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  64. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +2 -3
  65. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  66. package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
  67. package/dist/types/components/builtin/Text/Text.d.ts +2 -1
  68. package/dist/types/components/builtin/Text/Text.d.ts.map +1 -1
  69. package/dist/types/components/hooks/useTextStylePropControllerData.d.ts +3 -0
  70. package/dist/types/components/hooks/useTextStylePropControllerData.d.ts.map +1 -0
  71. package/dist/types/components/utils/responsive-style.d.ts +2 -3
  72. package/dist/types/components/utils/responsive-style.d.ts.map +1 -1
  73. package/dist/types/next/components/tests/page-text-style-prop-controller.test.d.ts +3 -0
  74. package/dist/types/next/components/tests/page-text-style-prop-controller.test.d.ts.map +1 -0
  75. package/dist/types/prop-controllers/descriptors.d.ts +7 -32
  76. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  77. package/dist/types/prop-controllers/index.d.ts +1 -1
  78. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  79. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  80. package/package.json +2 -2
@@ -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 ElementIDValue,\n GapXValue,\n ImageValue,\n NavigationLinksValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n TextInputValue,\n TextStyleValue,\n NavigationButton as NavigationButtonValue,\n} from '../../../prop-controllers/descriptors'\nimport {\n LinkPropControllerValue,\n ResponsiveLengthData,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: ElementIDValue\n links?: NavigationLinksValue\n linkTextStyle?: TextStyleValue\n showLogo?: boolean\n logoFile?: ImageValue\n logoWidth?: ResponsiveLengthData\n logoAltText?: TextInputValue\n logoLink?: LinkPropControllerValue\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: GapXValue\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonValue['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":";AAuEI,cAwKU,YAxKV;AArEJ,SAAiD,YAAY,gBAAgB;AAE7E,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AAmBvB,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,gBAAgB;AA+BzB,MAAM,YAAY,WAAW,SAASA,WACpC,EAAE,WAAW,OAAO,QAAQ,WAAW,QAAQ,GAAG,YAAY,GAC9D,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,QAAQ,YAAY,SAAS,CAAC;AAAA,QAClD;AAAA,QACA;AAAA,QACA,SAAS,uBAAuB,SAAS,CAAC;AAAA,QAC1C;AAAA,UACE,mBAAmB,CAAC,MAAM,GAAY,CAAC,CAACC,UAAS,EAAE,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO;AAAA,YAC9E,KAAK,GAAGA,QAAO,KAAK,GAAGA,QAAO,IAAI;AAAA,UACpC,EAAE;AAAA,QACJ;AA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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 } 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 ElementIDValue,\n GapXValue,\n ImageValue,\n NavigationLinksValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n TextInputValue,\n NavigationButton as NavigationButtonValue,\n} from '../../../prop-controllers/descriptors'\nimport {\n LinkPropControllerValue,\n ResponsiveLengthData,\n ResponsiveTextStyleData,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: ElementIDValue\n links?: NavigationLinksValue\n linkTextStyle?: ResponsiveTextStyleData\n showLogo?: boolean\n logoFile?: ImageValue\n logoWidth?: ResponsiveLengthData\n logoAltText?: TextInputValue\n logoLink?: LinkPropControllerValue\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: GapXValue\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonValue['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":";AAuEI,cAwKU,YAxKV;AArEJ,SAAiD,YAAY,gBAAgB;AAE7E,SAAS,oBAAoB;AAE7B,OAAO,qBAAqB;AAC5B,OA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AAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,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 { TextStyleValue } from '../../../../../prop-controllers/descriptors'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../hooks'\n\nimport { Link } from '../../../../shared/Link'\nimport Button from '../../../Button'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\nimport { cx, keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../../../utils/responsive-style'\nimport { LinkData, ResponsiveColorData } 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?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ className, color, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n backgroundColor: 'transparent',\n transition: 'background-color 0.2s',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData, textStyle] as const, ([color, textStyle = {}]) => {\n const fontSize = textStyle.fontSize || { value: 14, unit: 'px' }\n const fontWeight = textStyle.fontWeight == null ? 'normal' : textStyle.fontWeight\n const fontStyle = textStyle.fontStyle || []\n const letterSpacing = textStyle.letterSpacing == null ? null : textStyle.letterSpacing\n const textTransform = textStyle.textTransform || []\n\n return {\n color: color == null ? 'black' : colorToString(color),\n fontSize: `${fontSize.value}${fontSize.unit}`,\n fontWeight,\n fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',\n letterSpacing: letterSpacing == null ? 'normal' : `${letterSpacing}px`,\n textTransform: textTransform.includes('uppercase') ? 'uppercase' : 'none',\n }\n }),\n ),\n useStyle({\n '&:hover': {\n backgroundColor: 'rgba(0, 0, 0, 0.04)',\n },\n }),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n caret?: 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n textColor?: 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":"AAiCI,cAqKM,YArKN;AA+KM;AAhNV,SAAiD,YAAY,QAAQ,gBAAgB;AAErF,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAE7B,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS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M,CAAC,UAAU,WAAW,IAAI,SAAmB,MAAM;AAEzD,4BAA0B,MAAM;AAC9B,QACE,UAAU,WACV,UAAU,QAAQ,cAAc,YAAa,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 } 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,oBAAoB,8BAA8B;AAG3D,MAAM,uBAAuB;AAI7B,MAAM,4BAA4B;AASlC,SAAS,aAAa,EAAE,WAAW,UAAU,GAAG,YAAY,GAAsB;A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G,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 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useState } from 'react'\n\nimport { TextStyleValue } from '../../../../../../../prop-controllers/descriptors'\nimport { LinkData, ResponsiveColorData } 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?: TextStyleValue\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ color, className, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData] as const, ([color]) => ({\n color: color == null ? 'black' : colorToString(color),\n })),\n ),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n onClose?: () => unknown\n caret?: string\n textColor?: 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":"AAgCI,SA2FQ,UA3FR,KA2FQ,YA3FR;AAsGM;AAtIV,SAAmC,gBAAgB;AAKnD,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,GA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AA,YACjC,UAAU,UAAU,oBAAC,SAAM;AAAA,YAC3B,UAAU,gBAAgB,oBAAC,cAAW;AAAA,YACtC,UAAU,kBAAkB,oBAAC,gBAAa;AAAA,aAC7C,GACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,gBAAa,MAAM,QACjB,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,8BAAC,gBAAc,GAAG,SAAS,KAAK,IAAI,SAAS,WAC1C,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["color"]}
1
+ {"version":3,"sources":["../../../../../../../../../src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, useState } from 'react'\n\nimport { 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;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,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,OAAO;AAAA,QACT,CAAC;AAAA,QACD,SAAS,uBAAuB,SAAS,CAAC;AAAA,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,
15
15
  Margin,
16
- Width
16
+ Width,
17
+ TextStyle
17
18
  } from "@makeswift/prop-controllers";
18
19
  function registerComponent(runtime) {
19
20
  return runtime.registerComponent(
@@ -25,7 +26,7 @@ function registerComponent(runtime) {
25
26
  props: {
26
27
  id: Props.ElementID(),
27
28
  links: Props.NavigationLinks(),
28
- linkTextStyle: Props.TextStyle((props) => {
29
+ linkTextStyle: TextStyle((props) => {
29
30
  const links = props.links;
30
31
  return {
31
32
  label: "Link text style",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { NavigationLinksValue, ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ControlDataTypeKey,\n Checkbox,\n Link,\n ResponsiveColor,\n ResponsiveLength,\n ResponsiveLengthPropControllerDataV1Type,\n checkboxPropControllerDataSchema,\n getCheckboxPropControllerDataBoolean,\n Margin,\n Width,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Navigation')),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: Props.ElementID(),\n links: Props.NavigationLinks(),\n linkTextStyle: Props.TextStyle(props => {\n const links = props.links as NavigationLinksValue | undefined\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Props.Image(props => ({\n label: 'Logo',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoWidth: ResponsiveLength(props => ({\n // TODO(miguel): We're manually constructing the data here but should be using a factory\n // function instead. This is because the factory function currently expects a definition\n // but we don't have one to pass here. Perhaps we should make the factory function not\n // require the definition and use the latest version when a definition isn't provided.\n preset: {\n [ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type,\n value: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n },\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoAltText: Props.TextInput(props => ({\n label: 'Logo alt text',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoLink: Link(props => ({\n label: 'Logo on click',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,cAAc,CAAC;AAAA,IACjC;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,gBAAgB;AAAA,QAC7B,eAAe,MAAM,UA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;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,2BAA2B,gBAAgB,CAAC,OAAO,WAAW;AAC5D,gBAAM,sBAAsB,MAAM;AAGlC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM;AAAA,UACX,QAAQ,MAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,OAAO,EAAE,QAAQ,OAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { NavigationLinksValue, ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ControlDataTypeKey,\n Checkbox,\n Link,\n ResponsiveColor,\n ResponsiveLength,\n ResponsiveLengthPropControllerDataV1Type,\n checkboxPropControllerDataSchema,\n getCheckboxPropControllerDataBoolean,\n Margin,\n Width,\n TextStyle,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Navigation')),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: Props.ElementID(),\n links: Props.NavigationLinks(),\n linkTextStyle: TextStyle(props => {\n const links = props.links as NavigationLinksValue | undefined\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Props.Image(props => ({\n label: 'Logo',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoWidth: ResponsiveLength(props => ({\n // TODO(miguel): We're manually constructing the data here but should be using a factory\n // function instead. This is because the factory function currently expects a definition\n // but we don't have one to pass here. Perhaps we should make the factory function not\n // require the definition and use the latest version when a definition isn't provided.\n preset: {\n [ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type,\n value: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n },\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoAltText: Props.TextInput(props => ({\n label: 'Logo alt text',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoLink: Link(props => ({\n label: 'Logo on click',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: Props.GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAA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C;AAAA,QACD,0BAA0B,gBAAgB,CAAC,OAAO,WAAW;AAC3D,gBAAM,sBAAsB,MAAM;AAGlC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,2BAA2B,gBAAgB,CAAC,OAAO,WAAW;AAC5D,gBAAM,sBAAsB,MAAM;AAGlC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM;AAAA,UACX,QAAQ,MAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,OAAO,EAAE,QAAQ,OAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,8 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { cx } from "@emotion/css";
3
- function Text({ id, text, width, margin }) {
4
- return /* @__PURE__ */ jsx("div", { id, className: cx(width, margin), children: text });
5
- }
3
+ import { forwardRef } from "react";
4
+ const Text = forwardRef(({ id, text, width, margin }, ref) => {
5
+ return /* @__PURE__ */ jsx("div", { id, ref, className: cx(width, margin), children: text });
6
+ });
6
7
  var Text_default = Text;
7
8
  export {
8
9
  Text_default as default
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { RichTextV2ControlValue } from '../../../runtimes/react/controls/rich-text-v2'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextV2ControlValue\n width?: string\n margin?: string\n}\n\nfunction Text({ id, text, width, margin }: Props) {\n return (\n <div id={id} className={cx(width, margin)}>\n {text}\n </div>\n )\n}\n\nexport default Text\n"],"mappings":"AAaI;AAbJ,SAAS,UAAU;AAWnB,SAAS,KAAK,EAAE,IAAI,MAAM,OAAO,OAAO,GAAU;AAChD,SACE,oBAAC,SAAI,IAAQ,WAAW,GAAG,OAAO,MAAM,GACrC,gBACH;AAEJ;AAEA,IAAO,eAAQ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef } from 'react'\nimport { ElementIDValue } from '../../../prop-controllers/descriptors'\nimport { RichTextV2ControlValue } from '../../../runtimes/react/controls/rich-text-v2'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextV2ControlValue\n width?: string\n margin?: string\n}\n\nconst Text = forwardRef<HTMLDivElement, Props>(({ id, text, width, margin }, ref) => {\n return (\n <div id={id} ref={ref} className={cx(width, margin)}>\n {text}\n </div>\n )\n})\n\nexport default Text\n"],"mappings":"AAcI;AAdJ,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAW3B,MAAM,OAAO,WAAkC,CAAC,EAAE,IAAI,MAAM,OAAO,OAAO,GAAG,QAAQ;AACnF,SACE,oBAAC,SAAI,IAAQ,KAAU,WAAW,GAAG,OAAO,MAAM,GAC/C,gBACH;AAEJ,CAAC;AAED,IAAO,eAAQ;","names":[]}
@@ -0,0 +1,12 @@
1
+ import {
2
+ getTextStylePropControllerDataResponsiveTextStyleData
3
+ } from "@makeswift/prop-controllers";
4
+ function useTextStylePropControllerData(data) {
5
+ if (data == null)
6
+ return data;
7
+ return getTextStylePropControllerDataResponsiveTextStyleData(data);
8
+ }
9
+ export {
10
+ useTextStylePropControllerData
11
+ };
12
+ //# sourceMappingURL=useTextStylePropControllerData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/hooks/useTextStylePropControllerData.ts"],"sourcesContent":["import {\n ResponsiveTextStyleData,\n TextStylePropControllerData,\n getTextStylePropControllerDataResponsiveTextStyleData,\n} from '@makeswift/prop-controllers'\n\nexport function useTextStylePropControllerData(\n data: TextStylePropControllerData | undefined,\n): ResponsiveTextStyleData | undefined {\n if (data == null) return data\n\n return getTextStylePropControllerDataResponsiveTextStyleData(data)\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,OACK;AAEA,SAAS,+BACd,MACqC;AACrC,MAAI,QAAQ;AAAM,WAAO;AAEzB,SAAO,sDAAsD,IAAI;AACnE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/utils/responsive-style.ts"],"sourcesContent":["import { WidthProperty } from 'csstype'\nimport { CSSObject } from '@emotion/css'\nimport type {\n ResponsiveValueType as ExtractResponsiveValue,\n LengthData,\n ResponsiveBorderRadiusData,\n ResponsiveMarginData,\n ResponsivePaddingData,\n ResponsiveValue,\n ResponsiveLengthData,\n} from '@makeswift/prop-controllers'\n\nimport { TextStyleValue } from '../../prop-controllers/descriptors'\nimport {\n FallbackStrategy,\n getBreakpoint,\n getBreakpointMediaQuery,\n join as joinResponsiveValues,\n Breakpoints,\n} from '../../state/modules/breakpoints'\nimport { getIndexes } from './columns'\nimport { PaddingPropertyData, paddingPropertyDataToStyle } from '../../css/padding'\nimport { MarginPropertyData, marginPropertyDataToStyle } from '../../css/margin'\nimport { BorderRadiusPropertyData, borderRadiusPropertyDataToStyle } from '../../css/border-radius'\nimport { BorderPropertyData, borderPropertyDataToStyle } from '../../css/border'\nimport { BorderPropControllerData } from '../hooks/useBorder'\nimport { colorToString } from './colorToString'\nimport { BoxShadow, ResponsiveBoxShadow } from '../hooks'\nimport { useBreakpoints } from '../../runtimes/react'\nimport { DropFirst } from './drop-first'\n\nexport function responsiveStyle<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n join: (values: { [K in keyof A]: ExtractResponsiveValue<A[K]> | undefined }) => CSSObject,\n strategy?: FallbackStrategy<V>,\n): CSSObject {\n return joinResponsiveValues(breakpoints, responsiveValues, join, strategy).reduce(\n (acc, { deviceId, value }) => {\n const breakpoint = getBreakpoint(breakpoints, deviceId)\n const mediaQuery = getBreakpointMediaQuery(breakpoint)\n\n return {\n ...acc,\n [mediaQuery]: {\n ...(acc[mediaQuery] as CSSObject),\n ...value,\n },\n }\n },\n {} as CSSObject,\n )\n}\n\nexport function useResponsiveStyle<\n V,\n A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>,\n>(\n responsiveValues: A,\n join: (values: { [K in keyof A]: ExtractResponsiveValue<A[K]> | undefined }) => CSSObject,\n strategy?: FallbackStrategy<V>,\n): CSSObject {\n return responsiveStyle(useBreakpoints(), responsiveValues, join, strategy)\n}\n\nexport function responsiveWidth(\n breakpoints: Breakpoints,\n widthData: ResponsiveLengthData | undefined,\n defaultValue: LengthData | WidthProperty<string | number> = '100%',\n): CSSObject {\n return {\n maxWidth: '100%',\n ...responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({\n width: typeof width === 'object' ? `${width.value}${width.unit}` : width,\n })),\n }\n}\n\nexport function useResponsiveWidth(\n ...args: DropFirst<Parameters<typeof responsiveWidth>>\n): CSSObject {\n return responsiveWidth(useBreakpoints(), ...args)\n}\n\nexport function responsivePadding(\n breakpoints: Breakpoints,\n paddingData: ResponsivePaddingData | undefined,\n defaultValue: PaddingPropertyData = {} as PaddingPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [paddingData], ([padding = {} as PaddingPropertyData]) =>\n paddingPropertyDataToStyle(\n padding,\n Object.assign(\n { paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsivePadding(\n ...args: DropFirst<Parameters<typeof responsivePadding>>\n): CSSObject {\n return responsivePadding(useBreakpoints(), ...args)\n}\n\nexport function responsiveMargin(\n breakpoints: Breakpoints,\n marginData: ResponsiveMarginData | undefined,\n defaultValue: MarginPropertyData = {} as MarginPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [marginData], ([margin = {} as MarginPropertyData]) =>\n marginPropertyDataToStyle(\n margin,\n Object.assign(\n { marginTop: 0, marginRight: 'auto', marginBottom: 0, marginLeft: 'auto' },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsiveMargin(\n ...args: DropFirst<Parameters<typeof responsiveMargin>>\n): CSSObject {\n return responsiveMargin(useBreakpoints(), ...args)\n}\n\nexport function responsiveBorderRadius(\n breakpoints: Breakpoints,\n borderRadiusData: ResponsiveBorderRadiusData | undefined,\n defaultValue: BorderRadiusPropertyData = {} as BorderRadiusPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) =>\n borderRadiusPropertyDataToStyle(\n borderRadius,\n Object.assign(\n {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n borderBottomLeftRadius: 0,\n },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsiveBorderRadius(\n ...args: DropFirst<Parameters<typeof responsiveBorderRadius>>\n): CSSObject {\n return responsiveBorderRadius(useBreakpoints(), ...args)\n}\n\nexport function useResponsiveBorder(\n borderData: BorderPropControllerData | undefined,\n defaultValue: BorderPropertyData = {},\n): CSSObject {\n return useResponsiveStyle([borderData], ([border = {}]) =>\n borderPropertyDataToStyle(\n border,\n Object.assign(\n {\n borderTop: '0px solid black',\n borderRight: '0px solid black',\n borderBottom: '0px solid black',\n borderLeft: '0px solid black',\n },\n defaultValue,\n ),\n ),\n )\n}\n\nconst floor =\n (d: number) =>\n (v: number): number =>\n Math.floor(10 ** d * v) / 10 ** d\n\nexport function responsiveGridItem(\n breakpoints: Breakpoints,\n props: {\n grid: ResponsiveValue<{ spans: number[][]; count: number }>\n index: number\n columnGap?: ResponsiveValue<LengthData>\n rowGap?: ResponsiveValue<LengthData>\n },\n): CSSObject {\n return {\n display: 'flex',\n ...responsiveStyle(\n breakpoints,\n [props.grid, props.columnGap, props.rowGap] as const,\n ([\n { spans, count } = { spans: [[12]], count: 12 },\n columnGap = { value: 0, unit: 'px' },\n rowGap = { value: 0, unit: 'px' },\n ]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, props.index)\n const firstCol = columnIndex === 0\n const lastCol = columnIndex === spans[rowIndex].length - 1\n const span = spans[rowIndex][columnIndex]\n const fraction = floor(5)(span / count)\n const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`\n const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${\n columnGap.unit\n } / 2`\n const iePrecisionError = '0.01px'\n const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`\n const firstRow = rowIndex === 0\n const lastRow = rowIndex === spans.length - 1\n\n return span === 0\n ? { display: 'none' }\n : {\n flexBasis,\n minWidth: flexBasis,\n // NOTE: IE11 width breaks without max width\n // https://github.com/philipwalton/flexbugs/issues/3\n maxWidth: flexBasis,\n paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,\n paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,\n paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,\n paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,\n }\n },\n ),\n }\n}\n\nexport function useResponsiveGridItem(\n ...args: DropFirst<Parameters<typeof responsiveGridItem>>\n): CSSObject {\n return responsiveGridItem(useBreakpoints(), ...args)\n}\n\nconst getBoxShadow = (shadows: BoxShadow) =>\n shadows\n .map(\n ({ payload: { inset, offsetX, offsetY, blurRadius, spreadRadius, color } }) =>\n `${inset ? 'inset ' : ''}${offsetX.toFixed(1)}px ${offsetY.toFixed(\n 1,\n )}px ${blurRadius}px ${spreadRadius}px ${\n color != null ? colorToString(color) : 'rgba(0,0,0,0.2)'\n }`,\n )\n .filter(Boolean)\n .join()\n\nexport function responsiveShadow(\n breakpoints: Breakpoints,\n value: ResponsiveBoxShadow | undefined,\n): CSSObject {\n return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({\n boxShadow: getBoxShadow(shadow),\n }))\n}\n\nexport function useResponsiveShadow(\n ...args: DropFirst<Parameters<typeof responsiveShadow>>\n): CSSObject {\n return responsiveShadow(useBreakpoints(), ...args)\n}\n\nexport function responsiveTextStyle(\n breakpoints: Breakpoints,\n value: TextStyleValue | undefined,\n): CSSObject {\n return responsiveStyle(\n breakpoints,\n [value],\n ([\n textStyle = {\n fontFamily: null,\n letterSpacing: null,\n fontSize: null,\n fontWeight: null,\n textTransform: [],\n fontStyle: [],\n },\n ]) => {\n const {\n fontSize,\n fontWeight,\n fontStyle = [],\n textTransform = [],\n letterSpacing,\n fontFamily,\n } = textStyle\n\n return {\n ...(fontFamily == null ? {} : { fontFamily: `\"${fontFamily}\"` }),\n ...(fontWeight == null ? {} : { fontWeight }),\n ...(letterSpacing == null ? {} : { letterSpacing }),\n ...(fontSize == null ? {} : { fontSize: `${fontSize.value}${fontSize.unit}` }),\n ...(textTransform.includes('uppercase') ? { textTransform: 'uppercase' } : {}),\n ...(fontStyle.includes('italic') ? { fontStyle: 'italic' } : {}),\n }\n },\n )\n}\n\nexport function useResponsiveTextStyle(\n ...args: DropFirst<Parameters<typeof responsiveTextStyle>>\n): CSSObject {\n return responsiveTextStyle(useBreakpoints(), ...args)\n}\n"],"mappings":"AAaA;AAAA,EAEE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,OAEH;AACP,SAAS,kBAAkB;AAC3B,SAA8B,kCAAkC;AAChE,SAA6B,iCAAiC;AAC9D,SAAmC,uCAAuC;AAC1E,SAA6B,iCAAiC;AAE9D,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAGxB,SAAS,gBACd,aACA,kBACA,MACA,UACW;AACX,SAAO,qBAAqB,aAAa,kBAAkB,MAAM,QAAQ,EAAE;AAAA,IACzE,CAAC,KAAK,EAAE,UAAU,MAAM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,IAAI,EAAE,WAAW,SAAS,IAAI,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,0BACX,MACQ;AACX,SAAO,oBAAoB,eAAe,GAAG,GAAG,IAAI;AACtD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/utils/responsive-style.ts"],"sourcesContent":["import { WidthProperty } from 'csstype'\nimport { CSSObject } from '@emotion/css'\nimport type {\n ResponsiveValueType as ExtractResponsiveValue,\n LengthData,\n ResponsiveBorderRadiusData,\n ResponsiveMarginData,\n ResponsivePaddingData,\n ResponsiveValue,\n ResponsiveLengthData,\n ResponsiveTextStyleData,\n} from '@makeswift/prop-controllers'\n\nimport {\n FallbackStrategy,\n getBreakpoint,\n getBreakpointMediaQuery,\n join as joinResponsiveValues,\n Breakpoints,\n} from '../../state/modules/breakpoints'\nimport { getIndexes } from './columns'\nimport { PaddingPropertyData, paddingPropertyDataToStyle } from '../../css/padding'\nimport { MarginPropertyData, marginPropertyDataToStyle } from '../../css/margin'\nimport { BorderRadiusPropertyData, borderRadiusPropertyDataToStyle } from '../../css/border-radius'\nimport { BorderPropertyData, borderPropertyDataToStyle } from '../../css/border'\nimport { BorderPropControllerData } from '../hooks/useBorder'\nimport { colorToString } from './colorToString'\nimport { BoxShadow, ResponsiveBoxShadow } from '../hooks'\nimport { useBreakpoints } from '../../runtimes/react'\nimport { DropFirst } from './drop-first'\n\nexport function responsiveStyle<V, A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>>(\n breakpoints: Breakpoints,\n responsiveValues: A,\n join: (values: { [K in keyof A]: ExtractResponsiveValue<A[K]> | undefined }) => CSSObject,\n strategy?: FallbackStrategy<V>,\n): CSSObject {\n return joinResponsiveValues(breakpoints, responsiveValues, join, strategy).reduce(\n (acc, { deviceId, value }) => {\n const breakpoint = getBreakpoint(breakpoints, deviceId)\n const mediaQuery = getBreakpointMediaQuery(breakpoint)\n\n return {\n ...acc,\n [mediaQuery]: {\n ...(acc[mediaQuery] as CSSObject),\n ...value,\n },\n }\n },\n {} as CSSObject,\n )\n}\n\nexport function useResponsiveStyle<\n V,\n A extends ReadonlyArray<ResponsiveValue<V> | null | undefined>,\n>(\n responsiveValues: A,\n join: (values: { [K in keyof A]: ExtractResponsiveValue<A[K]> | undefined }) => CSSObject,\n strategy?: FallbackStrategy<V>,\n): CSSObject {\n return responsiveStyle(useBreakpoints(), responsiveValues, join, strategy)\n}\n\nexport function responsiveWidth(\n breakpoints: Breakpoints,\n widthData: ResponsiveLengthData | undefined,\n defaultValue: LengthData | WidthProperty<string | number> = '100%',\n): CSSObject {\n return {\n maxWidth: '100%',\n ...responsiveStyle(breakpoints, [widthData], ([width = defaultValue]) => ({\n width: typeof width === 'object' ? `${width.value}${width.unit}` : width,\n })),\n }\n}\n\nexport function useResponsiveWidth(\n ...args: DropFirst<Parameters<typeof responsiveWidth>>\n): CSSObject {\n return responsiveWidth(useBreakpoints(), ...args)\n}\n\nexport function responsivePadding(\n breakpoints: Breakpoints,\n paddingData: ResponsivePaddingData | undefined,\n defaultValue: PaddingPropertyData = {} as PaddingPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [paddingData], ([padding = {} as PaddingPropertyData]) =>\n paddingPropertyDataToStyle(\n padding,\n Object.assign(\n { paddingTop: 0, paddingRight: 0, paddingBottom: 0, paddingLeft: 0 },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsivePadding(\n ...args: DropFirst<Parameters<typeof responsivePadding>>\n): CSSObject {\n return responsivePadding(useBreakpoints(), ...args)\n}\n\nexport function responsiveMargin(\n breakpoints: Breakpoints,\n marginData: ResponsiveMarginData | undefined,\n defaultValue: MarginPropertyData = {} as MarginPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [marginData], ([margin = {} as MarginPropertyData]) =>\n marginPropertyDataToStyle(\n margin,\n Object.assign(\n { marginTop: 0, marginRight: 'auto', marginBottom: 0, marginLeft: 'auto' },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsiveMargin(\n ...args: DropFirst<Parameters<typeof responsiveMargin>>\n): CSSObject {\n return responsiveMargin(useBreakpoints(), ...args)\n}\n\nexport function responsiveBorderRadius(\n breakpoints: Breakpoints,\n borderRadiusData: ResponsiveBorderRadiusData | undefined,\n defaultValue: BorderRadiusPropertyData = {} as BorderRadiusPropertyData,\n): CSSObject {\n return responsiveStyle(breakpoints, [borderRadiusData], ([borderRadius = {}]) =>\n borderRadiusPropertyDataToStyle(\n borderRadius,\n Object.assign(\n {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n borderBottomLeftRadius: 0,\n },\n defaultValue,\n ),\n ),\n )\n}\n\nexport function useResponsiveBorderRadius(\n ...args: DropFirst<Parameters<typeof responsiveBorderRadius>>\n): CSSObject {\n return responsiveBorderRadius(useBreakpoints(), ...args)\n}\n\nexport function useResponsiveBorder(\n borderData: BorderPropControllerData | undefined,\n defaultValue: BorderPropertyData = {},\n): CSSObject {\n return useResponsiveStyle([borderData], ([border = {}]) =>\n borderPropertyDataToStyle(\n border,\n Object.assign(\n {\n borderTop: '0px solid black',\n borderRight: '0px solid black',\n borderBottom: '0px solid black',\n borderLeft: '0px solid black',\n },\n defaultValue,\n ),\n ),\n )\n}\n\nconst floor =\n (d: number) =>\n (v: number): number =>\n Math.floor(10 ** d * v) / 10 ** d\n\nexport function responsiveGridItem(\n breakpoints: Breakpoints,\n props: {\n grid: ResponsiveValue<{ spans: number[][]; count: number }>\n index: number\n columnGap?: ResponsiveValue<LengthData>\n rowGap?: ResponsiveValue<LengthData>\n },\n): CSSObject {\n return {\n display: 'flex',\n ...responsiveStyle(\n breakpoints,\n [props.grid, props.columnGap, props.rowGap] as const,\n ([\n { spans, count } = { spans: [[12]], count: 12 },\n columnGap = { value: 0, unit: 'px' },\n rowGap = { value: 0, unit: 'px' },\n ]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, props.index)\n const firstCol = columnIndex === 0\n const lastCol = columnIndex === spans[rowIndex].length - 1\n const span = spans[rowIndex][columnIndex]\n const fraction = floor(5)(span / count)\n const width = `${fraction} * (100% + ${columnGap.value}${columnGap.unit})`\n const excessWidth = `${Number(firstCol) + Number(lastCol)} * ${columnGap.value}${\n columnGap.unit\n } / 2`\n const iePrecisionError = '0.01px'\n const flexBasis = `calc(${width} - ${excessWidth} - ${iePrecisionError})`\n const firstRow = rowIndex === 0\n const lastRow = rowIndex === spans.length - 1\n\n return span === 0\n ? { display: 'none' }\n : {\n flexBasis,\n minWidth: flexBasis,\n // NOTE: IE11 width breaks without max width\n // https://github.com/philipwalton/flexbugs/issues/3\n maxWidth: flexBasis,\n paddingLeft: firstCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,\n paddingRight: lastCol ? 0 : `${columnGap.value / 2}${columnGap.unit}`,\n paddingTop: firstRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,\n paddingBottom: lastRow ? 0 : `${rowGap.value / 2}${rowGap.unit}`,\n }\n },\n ),\n }\n}\n\nexport function useResponsiveGridItem(\n ...args: DropFirst<Parameters<typeof responsiveGridItem>>\n): CSSObject {\n return responsiveGridItem(useBreakpoints(), ...args)\n}\n\nconst getBoxShadow = (shadows: BoxShadow) =>\n shadows\n .map(\n ({ payload: { inset, offsetX, offsetY, blurRadius, spreadRadius, color } }) =>\n `${inset ? 'inset ' : ''}${offsetX.toFixed(1)}px ${offsetY.toFixed(\n 1,\n )}px ${blurRadius}px ${spreadRadius}px ${\n color != null ? colorToString(color) : 'rgba(0,0,0,0.2)'\n }`,\n )\n .filter(Boolean)\n .join()\n\nexport function responsiveShadow(\n breakpoints: Breakpoints,\n value: ResponsiveBoxShadow | undefined,\n): CSSObject {\n return responsiveStyle(breakpoints, [value], ([shadow = []]) => ({\n boxShadow: getBoxShadow(shadow),\n }))\n}\n\nexport function useResponsiveShadow(\n ...args: DropFirst<Parameters<typeof responsiveShadow>>\n): CSSObject {\n return responsiveShadow(useBreakpoints(), ...args)\n}\n\nexport function responsiveTextStyle(\n breakpoints: Breakpoints,\n value: ResponsiveTextStyleData | undefined,\n): CSSObject {\n return responsiveStyle(\n breakpoints,\n [value],\n ([\n textStyle = {\n fontFamily: null,\n letterSpacing: null,\n fontSize: null,\n fontWeight: null,\n textTransform: [],\n fontStyle: [],\n },\n ]) => {\n const {\n fontSize,\n fontWeight,\n fontStyle = [],\n textTransform = [],\n letterSpacing,\n fontFamily,\n } = textStyle\n\n return {\n ...(fontFamily == null ? {} : { fontFamily: `\"${fontFamily}\"` }),\n ...(fontWeight == null ? {} : { fontWeight }),\n ...(letterSpacing == null ? {} : { letterSpacing }),\n ...(fontSize == null ? {} : { fontSize: `${fontSize.value}${fontSize.unit}` }),\n ...(textTransform.includes('uppercase') ? { textTransform: 'uppercase' } : {}),\n ...(fontStyle.includes('italic') ? { fontStyle: 'italic' } : {}),\n }\n },\n )\n}\n\nexport function useResponsiveTextStyle(\n ...args: DropFirst<Parameters<typeof responsiveTextStyle>>\n): CSSObject {\n return responsiveTextStyle(useBreakpoints(), ...args)\n}\n"],"mappings":"AAaA;AAAA,EAEE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,OAEH;AACP,SAAS,kBAAkB;AAC3B,SAA8B,kCAAkC;AAChE,SAA6B,iCAAiC;AAC9D,SAAmC,uCAAuC;AAC1E,SAA6B,iCAAiC;AAE9D,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAGxB,SAAS,gBACd,aACA,kBACA,MACA,UACW;AACX,SAAO,qBAAqB,aAAa,kBAAkB,MAAM,QAAQ,EAAE;AAAA,IACzE,CAAC,KAAK,EAAE,UAAU,MAAM,MAAM;AAC5B,YAAM,aAAa,cAAc,aAAa,QAAQ;AACtD,YAAM,aAAa,wBAAwB,UAAU;AAErD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,UAAU,GAAG;AAAA,UACZ,GAAI,IAAI,UAAU;AAAA,UAClB,GAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH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OACW;AACX,SAAO,gBAAgB,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;AAAA,IAC/D,WAAW,aAAa,MAAM;AAAA,EAChC,EAAE;AACJ;AAEO,SAAS,uBACX,MACQ;AACX,SAAO,iBAAiB,eAAe,GAAG,GAAG,IAAI;AACnD;AAEO,SAAS,oBACd,aACA,OACW;AACX,SAAO;AAAA,IACL;AAAA,IACA,CAAC,KAAK;AAAA,IACN,CAAC;AAAA,MACC,YAAY;AAAA,QACV,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,eAAe,CAAC;AAAA,QAChB,WAAW,CAAC;AAAA,MACd;AAAA,IACF,MAAM;AACJ,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,YAAY,CAAC;AAAA,QACb,gBAAgB,CAAC;AAAA,QACjB;AAAA,QACA;AAAA,MACF,IAAI;AAEJ,aAAO;AAAA,QACL,GAAI,cAAc,OAAO,CAAC,IAAI,EAAE,YAAY,IAAI,UAAU,IAAI;AAAA,QAC9D,GAAI,cAAc,OAAO,CAAC,IAAI,EAAE,WAAW;AAAA,QAC3C,GAAI,iBAAiB,OAAO,CAAC,IAAI,EAAE,cAAc;AAAA,QACjD,GAAI,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,KAAK,GAAG,SAAS,IAAI,GAAG;AAAA,QAC5E,GAAI,cAAc,SAAS,WAAW,IAAI,EAAE,eAAe,YAAY,IAAI,CAAC;AAAA,QAC5E,GAAI,UAAU,SAAS,QAAQ,IAAI,EAAE,WAAW,SAAS,IAAI,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,0BACX,MACQ;AACX,SAAO,oBAAoB,eAAe,GAAG,GAAG,IAAI;AACtD;","names":[]}
@@ -13,7 +13,7 @@ async function handler(...args) {
13
13
  const supportsPreviewMode = match(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
14
14
  const supportsDraftMode = match(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
15
15
  const body = {
16
- version: "0.16.0-canary.2",
16
+ version: "0.16.0-canary.3",
17
17
  previewMode: supportsPreviewMode,
18
18
  draftMode: supportsDraftMode,
19
19
  interactionMode: true,
@@ -27,7 +27,6 @@ const Types = {
27
27
  Typeahead: "Typeahead",
28
28
  TextArea: "TextArea",
29
29
  TextInput: "TextInput",
30
- TextStyle: "TextStyle",
31
30
  Style: StyleControlType
32
31
  };
33
32
  function Backgrounds(options = {}) {
@@ -164,9 +163,6 @@ function TextArea(options = {}) {
164
163
  function TextInput(options = {}) {
165
164
  return { type: Types.TextInput, options };
166
165
  }
167
- function TextStyle(options = {}) {
168
- return { type: Types.TextStyle, options };
169
- }
170
166
  export {
171
167
  Backgrounds,
172
168
  ElementID,
@@ -187,7 +183,6 @@ export {
187
183
  TableFormFields,
188
184
  TextArea,
189
185
  TextInput,
190
- TextStyle,
191
186
  Typeahead,
192
187
  Types,
193
188
  getListPropControllerElementChildren,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/prop-controllers/descriptors.ts"],"sourcesContent":["import { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Element, Data, MergeTranslatableDataContext } from '../state/react-page'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n StyleControlDefinition,\n RichTextV2ControlDefinition,\n StyleV2ControlDefinition,\n TypographyControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\nimport { RichTextControlDefinition, RichTextDTO } from '../controls/rich-text'\nimport { RichTextControlValue } from '../runtimes/react/controls/rich-text/rich-text'\nimport { RichTextV2ControlValue } from '../runtimes/react/controls/rich-text-v2'\nimport { StyleV2ControlFormattedValue } from '../runtimes/react/controls/style-v2'\nimport { IconRadioGroupControlDefinition } from '../controls/icon-radio-group'\nimport { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n getElementChildren,\n getFileIds,\n getPageIds,\n getSwatchIds,\n getTypographyIds,\n} from './introspection'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkData,\n LinkDescriptor,\n LinkPropControllerValue,\n Types as PropControllerTypes,\n ColorData as Color,\n ResponsiveValueType,\n ShadowsDescriptor,\n ResolveShadowsPropControllerValue,\n ResponsiveValue,\n Options,\n ResponsiveLengthDescriptor,\n ResolveResponsiveLengthPropControllerValue,\n NumberDescriptor,\n ResolveNumberPropControllerValue,\n ResponsiveColorDescriptor,\n ResolveCheckboxPropControllerValue,\n BorderRadiusDescriptor,\n ResolveBorderPropControllerValue,\n ResolveBorderRadiusPropControllerValue,\n DateDescriptor,\n ResolveDatePropControllerValue,\n FontDescriptor,\n ResolveFontPropControllerValue,\n VideoDescriptor,\n ResolveVideoPropControllerValue,\n TableDescriptor,\n ResolveTablePropControllerValue,\n MarginDescriptor,\n ResolveMarginPropControllerValue,\n PaddingDescriptor,\n ResolvePaddingPropControllerValue,\n WidthDescriptor,\n ResolveWidthPropControllerValue,\n} from '@makeswift/prop-controllers'\n\nexport type { Data }\n\n// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\ntype TextStyle = {\n fontFamily?: string | null | undefined\n letterSpacing: number | null | undefined\n fontSize: { value: number; unit: 'px' } | null | undefined\n fontWeight: number | null | undefined\n textTransform: 'uppercase'[]\n fontStyle: 'italic'[]\n}\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n ElementID: 'ElementID',\n GapX: 'GapX',\n GapY: 'GapY',\n Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n List: 'List',\n NavigationLinks: 'NavigationLinks',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n Shape: 'Shape',\n SocialLinks: 'SocialLinks',\n TableFormFields: 'TableFormFields',\n Typeahead: 'Typeahead',\n TextArea: 'TextArea',\n TextInput: 'TextInput',\n TextStyle: 'TextStyle',\n Style: StyleControlType,\n} as const\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImageV0 = {\n imageId: ImageValueV0\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\ntype BackgroundImageV1 = {\n version: 1\n image: ImageValueV1\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nexport type BackgroundImage = BackgroundImageV0 | BackgroundImageV1\n\ntype ImageBackgroundV0 = { type: 'image'; id: string; payload: BackgroundImageV0 }\n\ntype ImageBackgroundV1 = { type: 'image-v1'; id: string; payload: BackgroundImageV1 }\n\nexport type ImageBackground = ImageBackgroundV0 | ImageBackgroundV1\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\nexport type BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n version?: 1\n options: BackgroundsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, version: 1, options }\n}\n\nexport type ElementIDValue = string\n\ntype ElementIDOptions = Options<Record<string, never>>\n\ntype ElementIDDescriptor<_T = ElementIDValue> = {\n type: typeof Types.ElementID\n options: ElementIDOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ElementID(options: ElementIDOptions = {}): ElementIDDescriptor {\n return { type: Types.ElementID, options }\n}\n\nexport type GapXValue = ResponsiveValue<Gap>\n\nexport type GapXOptions = Options<{\n preset?: GapXValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}>\n\nexport type GapXDescriptor<_T = GapXValue> = { type: typeof Types.GapX; options: GapXOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function GapX(options: GapXOptions = {}): GapXDescriptor {\n return { type: Types.GapX, options }\n}\n\nexport type GapYValue = ResponsiveValue<Gap>\n\nexport type GapYOptions = Options<{\n preset?: GapYValue\n label?: string\n defaultValue?: Gap\n step?: number\n min?: number\n max?: number\n hidden?: boolean\n}>\n\nexport type GapYDescriptor<_T = GapYValue> = { type: typeof Types.GapY; options: GapYOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function GapY(options: GapYOptions = {}): GapYDescriptor {\n return { type: Types.GapY, options }\n}\n\ntype GridColumn = { count: number; spans: number[][] }\n\nexport type GridValue = { elements: Element[]; columns: ResponsiveValue<GridColumn> }\n\ntype GridOptions = Options<Record<string, never>>\n\ntype GridDescriptor<_T = GridValue> = { type: typeof Types.Grid; options: GridOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Grid(options: GridOptions = {}): GridDescriptor {\n return { type: Types.Grid, options }\n}\n\nexport function mergeGridPropControllerTranslatedData(\n data: GridValue,\n context: MergeTranslatableDataContext,\n) {\n return {\n ...data,\n elements: data.elements.map(element => context.mergeTranslatedData(element)),\n }\n}\n\nexport type ImageValueV0 = string\n\ntype ImageValueV1MakeswiftFile = {\n version: 1\n type: 'makeswift-file'\n id: string\n}\n\ntype ImageValueV1ExternalFile = {\n version: 1\n type: 'external-file'\n url: string\n width?: number | null\n height?: number | null\n}\n\nexport type ImageValueV1 = ImageValueV1MakeswiftFile | ImageValueV1ExternalFile\n\nexport type ImageValue = ImageValueV0 | ImageValueV1\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = {\n type: typeof Types.Image\n version?: 1\n options: ImageOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, version: 1, options }\n}\n\nexport type ImagesValueV0Item = {\n key: string\n props: {\n link?: LinkData\n file?: ImageValueV0\n altText?: string\n }\n}\n\nexport type ImagesValueV1Item = {\n key: string\n version: 1\n props: {\n link?: LinkData\n file?: ImageValueV1\n altText?: string\n }\n}\n\nexport type ImagesValueItem = ImagesValueV0Item | ImagesValueV1Item\n\nexport type ImagesValue = ImagesValueItem[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\nexport type ImagesDescriptor<_T = ImagesValue> = {\n type: typeof Types.Images\n version?: 1\n options: ImagesOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, version: 1, options }\n}\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof Types.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function List<T extends Data>(options: ListOptions<T>): ListDescriptor<ListValue<T>> {\n return { type: Types.List, options }\n}\n\nexport function introspectListPropControllerData<T>(\n descriptor: ListDescriptor,\n value: ListValue | undefined,\n func: (definition: Descriptor, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return value.flatMap(item => (item.value ? func(descriptor.options.type, item.value) : []))\n}\n\nexport function getListPropControllerElementChildren<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getElementChildren)\n}\n\nexport function getListPropControllerSwatchIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getSwatchIds)\n}\n\nexport function getListPropControllerFileIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getFileIds)\n}\n\nexport function getListPropControllerTypographyIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getTypographyIds)\n}\n\nexport function getListPropControllerPageIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getPageIds)\n}\n\ntype ButtonVariant = 'flat' | 'outline' | 'shadow' | 'clear' | 'blocky' | 'bubbly' | 'skewed'\n\ntype ButtonShape = 'pill' | 'rounded' | 'square'\n\ntype ButtonSize = 'small' | 'medium' | 'large'\n\nexport type NavigationButton = {\n id: string\n type: 'button'\n payload: {\n label: string\n link?: LinkData\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdownCaretType = 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n\ntype NavigationDropdownLink = {\n id: string\n payload: {\n label: string\n link?: LinkData\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\ntype NavigationDropdown = {\n id: string\n type: 'dropdown'\n payload: {\n label: string\n caret?: NavigationDropdownCaretType\n links?: NavigationDropdownLink[]\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyle>\n }\n}\n\nexport type NavigationLinksValue = (NavigationButton | NavigationDropdown)[]\n\ntype NavigationLinksOptions = Options<Record<string, never>>\n\ntype NavigationLinksDescriptor<_T = NavigationLinksValue> = {\n type: typeof Types.NavigationLinks\n options: NavigationLinksOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function NavigationLinks(options: NavigationLinksOptions = {}): NavigationLinksDescriptor {\n return { type: Types.NavigationLinks, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport type RichTextValue = IndexSignatureHack<RichTextDTO>\n\nexport type RichTextOptions = Options<{ preset?: RichTextValue }>\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof Types.RichText\n options: RichTextOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function RichText(options: RichTextOptions = {}): RichTextDescriptor {\n return { type: Types.RichText, options }\n}\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof Types.Shape\n options: ShapeOptions<U>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Shape<T extends Record<string, PanelDescriptor>>(\n options: ShapeOptions<T>,\n): ShapeDescriptor<{ [K in keyof T]?: DescriptorValueType<T[K]> }, T> {\n return { type: Types.Shape, options }\n}\n\nexport function introspectShapePropControllerData<T>(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n func: (definition: Descriptor, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return Object.entries(descriptor.options.type).flatMap(([key, definition]) =>\n func(definition, value[key]),\n )\n}\n\nexport function getShapePropControllerElementChildren(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): Element[] {\n return introspectShapePropControllerData(descriptor, value, getElementChildren)\n}\n\nexport function getShapePropControllerFileIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getFileIds)\n}\n\nexport function getShapePropControllerTypographyIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getTypographyIds)\n}\n\nexport function getShapePropControllerPageIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getPageIds)\n}\n\nexport function getShapePropControllerSwatchIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getSwatchIds)\n}\n\nexport const socialLinkTypesV0 = [\n 'angellist',\n 'codepen',\n 'discord',\n 'dribbble',\n 'facebook',\n 'github',\n 'instagram',\n 'linkedin',\n 'medium',\n 'pinterest',\n 'reddit',\n 'rss',\n 'snapchat',\n 'soundcloud',\n 'spotify',\n 'telegram',\n 'tumblr',\n 'twitch',\n 'twitter',\n 'vimeo',\n 'whatsapp',\n 'yelp',\n 'youtube',\n] as const\n\ntype SocialLinkTypeV0 = typeof socialLinkTypesV0[number]\n\nexport const socialLinkTypesV1 = [...socialLinkTypesV0, 'x', 'slack'] as const\n\ntype SocialLinkTypeV1 = typeof socialLinkTypesV1[number]\n\ntype SocialLinkV0 = { type: SocialLinkTypeV0; url: string }\n\ntype SocialLinkV1 = { type: SocialLinkTypeV1; url: string }\n\ntype SocialLinksLinkV0 = { id: string; payload: SocialLinkV0 }\n\ntype SocialLinksLinkV1 = { id: string; payload: SocialLinkV1 }\n\ntype SocialLinksValueV0 = { links: SocialLinksLinkV0[]; openInNewTab: boolean }\n\ntype SocialLinksValueV1 = { links: SocialLinksLinkV1[]; openInNewTab: boolean }\n\nexport type SocialLinksValue = SocialLinksValueV0 | SocialLinksValueV1\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValueV1 }>\n\nexport type SocialLinksDescriptor<_T = SocialLinksValueV1> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n version?: 1\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options, version: 1 }\n}\n\ntype TableFormField = {\n id: string\n tableColumnId: string\n label?: string\n placeholder?: string\n defaultValue?: string | boolean | string[]\n required?: boolean\n hidden?: boolean\n type?: 'select' | 'radio'\n hideLabel?: boolean\n autofill?: boolean\n}\n\ntype Grid = { count: number; spans: number[][] }\n\nexport type TableFormFieldsValue = { fields: TableFormField[]; grid: ResponsiveValue<Grid> }\n\ntype TableFormFieldsOptions = Options<{ preset?: TableFormFieldsValue }>\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsValue> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TableFormFields(options: TableFormFieldsOptions = {}): TableFormFieldsDescriptor {\n return { type: Types.TableFormFields, options }\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof Types.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Typeahead<T extends Data>(\n options: TypeaheadOptions<T>,\n): TypeaheadDescriptor<TypeaheadValue<T>> {\n return { type: Types.Typeahead, options }\n}\n\nexport type TextAreaValue = string\n\ntype TextAreaOptions = Options<{ preset?: TextAreaValue; label?: string; rows?: number }>\n\ntype TextAreaDescriptor<_T = TextAreaValue> = {\n type: typeof Types.TextArea\n options: TextAreaOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextArea(options: TextAreaOptions = {}): TextAreaDescriptor {\n return { type: Types.TextArea, options }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type TextStyleValue = ResponsiveValue<TextStyle>\n\nexport type TextStyleOptions = Options<{\n preset?: TextStyleValue\n label?: string\n hidden?: boolean\n}>\n\nexport type TextStyleDescriptor<_T = TextStyleValue> = {\n type: typeof Types.TextStyle\n options: TextStyleOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextStyle(options: TextStyleOptions = {}): TextStyleDescriptor {\n return { type: Types.TextStyle, options }\n}\n\nexport type Descriptor<T extends Data = Data> =\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | RichTextDescriptor<T>\n | ShadowsDescriptor<T>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | TypographyControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof PropControllerTypes.Margin\n | typeof PropControllerTypes.Padding\n | typeof PropControllerTypes.Shadows\n | typeof PropControllerTypes.Border\n | typeof Types.GapY\n | typeof Types.GapX\n | typeof PropControllerTypes.BorderRadius\n | typeof PropControllerTypes.Checkbox\n | typeof Types.TextInput\n | typeof PropControllerTypes.Link\n | typeof Types.List\n | typeof Types.Shape\n | typeof Types.ResponsiveSelect\n | typeof PropControllerTypes.ResponsiveColor\n | typeof Types.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof Types.TextArea\n | typeof PropControllerTypes.Table\n | typeof Types.Typeahead\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof PropControllerTypes.Video\n | typeof Types.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlValue<T>\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T extends RichTextControlDefinition\n ? RichTextControlValue\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends TypographyControlDefinition\n ? TypographyControlValue\n : T['type'] extends typeof PropControllerTypes.ResponsiveColor\n ? // TODO(miguel): We're not importing a resolver type from `@makeswift/prop-controllers` because\n // the resolved type is tightly coupled with the runtime (i.e., it's the result of an API call).\n // This means that we probably want to rethink how types are resolved and where that lives.\n ResponsiveColor | null | undefined\n : T['type'] extends typeof PropControllerTypes.Checkbox\n ? ResolveCheckboxPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Checkbox }>>\n : T['type'] extends typeof PropControllerTypes.Date\n ? ResolveDatePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Date }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.Link\n ? LinkPropControllerValue\n : T['type'] extends typeof PropControllerTypes.Width\n ? ResolveWidthPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Width }>>\n : T['type'] extends typeof PropControllerTypes.Padding\n ? ResolvePaddingPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Padding }>>\n : T['type'] extends typeof PropControllerTypes.Margin\n ? ResolveMarginPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Margin }>>\n : T['type'] extends typeof PropControllerTypes.BorderRadius\n ? ResolveBorderRadiusPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.BorderRadius }>\n >\n : T['type'] extends typeof PropControllerTypes.Shadows\n ? ResolveShadowsPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Shadows }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveLength\n ? ResolveResponsiveLengthPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.ResponsiveLength }>\n >\n : T['type'] extends typeof PropControllerTypes.Border\n ? ResolveBorderPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Border }>>\n : T['type'] extends typeof PropControllerTypes.Number\n ? ResolveNumberPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Number }>>\n : T['type'] extends typeof PropControllerTypes.Table\n ? ResolveTablePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Table }>>\n : T['type'] extends typeof PropControllerTypes.Video\n ? ResolveVideoPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Video }>>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n"],"mappings":"AAKA,SAAS,wBAAwB;AAoCjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAwFA,MAAM,QAAQ;AAAA,EACnB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,0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1
+ {"version":3,"sources":["../../../src/prop-controllers/descriptors.ts"],"sourcesContent":["import { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Element, Data, MergeTranslatableDataContext } from '../state/react-page'\nimport { NumberControlDefinition } from '../controls/number'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n CheckboxControlDefinition,\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\n TextAreaControlDefinition,\n TextInputControlDefinition,\n StyleControlDefinition,\n RichTextV2ControlDefinition,\n StyleV2ControlDefinition,\n TypographyControlDefinition,\n} from '../controls'\nimport { TextInputControlValue } from '../runtimes/react/controls/text-input'\nimport { TextAreaControlValue } from '../runtimes/react/controls/text-area'\nimport { ColorControlValue } from '../runtimes/react/controls/color'\nimport { SelectControlValue } from '../runtimes/react/controls/select'\nimport { CheckboxControlValue } from '../runtimes/react/controls/checkbox'\nimport { ResolveImageControlValue } from '../runtimes/react/controls/image'\nimport { ShapeControlValue } from '../runtimes/react/controls/shape'\nimport { ListControlValue } from '../runtimes/react/controls/list'\nimport { ComboboxControlValue } from '../runtimes/react/controls/combobox'\nimport { LinkControlValue } from '../runtimes/react/controls/link'\nimport { SlotControlValue } from '../runtimes/react/controls/slot'\nimport { RichTextControlDefinition, RichTextDTO } from '../controls/rich-text'\nimport { RichTextControlValue } from '../runtimes/react/controls/rich-text/rich-text'\nimport { RichTextV2ControlValue } from '../runtimes/react/controls/rich-text-v2'\nimport { StyleV2ControlFormattedValue } from '../runtimes/react/controls/style-v2'\nimport { IconRadioGroupControlDefinition } from '../controls/icon-radio-group'\nimport { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n getElementChildren,\n getFileIds,\n getPageIds,\n getSwatchIds,\n getTypographyIds,\n} from './introspection'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkData,\n LinkDescriptor,\n LinkPropControllerValue,\n Types as PropControllerTypes,\n ColorData as Color,\n ResponsiveValueType,\n ShadowsDescriptor,\n ResolveShadowsPropControllerValue,\n ResponsiveValue,\n Options,\n ResponsiveLengthDescriptor,\n ResolveResponsiveLengthPropControllerValue,\n NumberDescriptor,\n ResolveNumberPropControllerValue,\n ResponsiveColorDescriptor,\n ResolveCheckboxPropControllerValue,\n BorderRadiusDescriptor,\n ResolveBorderPropControllerValue,\n ResolveBorderRadiusPropControllerValue,\n DateDescriptor,\n ResolveDatePropControllerValue,\n FontDescriptor,\n ResolveFontPropControllerValue,\n VideoDescriptor,\n ResolveVideoPropControllerValue,\n TableDescriptor,\n ResolveTablePropControllerValue,\n MarginDescriptor,\n ResolveMarginPropControllerValue,\n PaddingDescriptor,\n ResolvePaddingPropControllerValue,\n WidthDescriptor,\n ResolveWidthPropControllerValue,\n TextStyleData,\n TextStyleDescriptor,\n ResolveTextStylePropControllerValue,\n} from '@makeswift/prop-controllers'\n\nexport type { Data }\n\n// See https://github.com/microsoft/TypeScript/issues/15300\nexport type IndexSignatureHack<T> = T extends Record<string, any>\n ? { [K in keyof T]: IndexSignatureHack<T[K]> }\n : T\n\ntype IconName =\n | 'HeightAuto16'\n | 'HeightMatch16'\n | 'VerticalAlignStart16'\n | 'VerticalAlignMiddle16'\n | 'VerticalAlignEnd16'\n | 'VerticalAlignSpaceBetween16'\n | 'ButtonPill16'\n | 'ButtonRounded16'\n | 'ButtonSquare16'\n | 'SizeSmall16'\n | 'SizeMedium16'\n | 'SizeLarge16'\n | 'ArrowInside16'\n | 'ArrowCenter16'\n | 'ArrowOutside16'\n | 'CountdownSolid16'\n | 'CountdownSolidSplit16'\n | 'CountdownOutline16'\n | 'CountdownOutlineSplit16'\n | 'CountdownNaked16'\n | 'Sun16'\n | 'Moon16'\n | 'AlignLeft16'\n | 'AlignCenter16'\n | 'AlignRight16'\n | 'Star16'\n | 'StarCircle16'\n | 'StarRoundedSquare16'\n | 'StarSquare16'\n\nexport type Gap = { value: number; unit: 'px' }\n\nexport const Types = {\n Backgrounds: 'Backgrounds',\n ElementID: 'ElementID',\n GapX: 'GapX',\n GapY: 'GapY',\n Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n List: 'List',\n NavigationLinks: 'NavigationLinks',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n Shape: 'Shape',\n SocialLinks: 'SocialLinks',\n TableFormFields: 'TableFormFields',\n Typeahead: 'Typeahead',\n TextArea: 'TextArea',\n TextInput: 'TextInput',\n Style: StyleControlType,\n} as const\n\ntype ColorBackground = { type: 'color'; id: string; payload: Color | null }\n\ntype GradientStop = { id: string; location: number; color: Color | null }\n\ntype Gradient = { angle?: number; isRadial?: boolean; stops: GradientStop[] }\n\ntype GradientBackground = { type: 'gradient'; id: string; payload: Gradient }\n\ntype BackgroundImagePosition = { x: number; y: number }\n\ntype BackgroundImageSize = 'cover' | 'contain' | 'auto'\n\ntype BackgroundImageRepeat = 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat'\n\ntype BackgroundImageV0 = {\n imageId: ImageValueV0\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\ntype BackgroundImageV1 = {\n version: 1\n image: ImageValueV1\n position: BackgroundImagePosition\n size?: BackgroundImageSize\n repeat?: BackgroundImageRepeat\n opacity?: number\n parallax?: number\n priority?: boolean\n}\n\nexport type BackgroundImage = BackgroundImageV0 | BackgroundImageV1\n\ntype ImageBackgroundV0 = { type: 'image'; id: string; payload: BackgroundImageV0 }\n\ntype ImageBackgroundV1 = { type: 'image-v1'; id: string; payload: BackgroundImageV1 }\n\nexport type ImageBackground = ImageBackgroundV0 | ImageBackgroundV1\n\ntype BackgroundVideoAspectRatio = 'wide' | 'standard'\n\ntype BackgroundVideo = {\n url?: string\n maskColor?: Color | null\n opacity?: number\n zoom?: number\n aspectRatio?: BackgroundVideoAspectRatio\n parallax?: number\n}\n\ntype VideoBackground = { type: 'video'; id: string; payload: BackgroundVideo }\n\ntype Background = ColorBackground | GradientBackground | ImageBackground | VideoBackground\n\nexport type BackgroundsValue = ResponsiveValue<Background[]>\n\ntype BackgroundsOptions = Options<Record<string, never>>\n\nexport type BackgroundsDescriptor<_T = BackgroundsValue> = {\n type: typeof Types.Backgrounds\n version?: 1\n options: BackgroundsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Backgrounds(options: BackgroundsOptions = {}): BackgroundsDescriptor {\n return { type: Types.Backgrounds, version: 1, options }\n}\n\nexport type ElementIDValue = string\n\ntype ElementIDOptions = Options<Record<string, never>>\n\ntype ElementIDDescriptor<_T = ElementIDValue> = {\n type: typeof Types.ElementID\n options: ElementIDOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ElementID(options: ElementIDOptions = {}): ElementIDDescriptor {\n return { type: Types.ElementID, options }\n}\n\nexport type GapXValue = ResponsiveValue<Gap>\n\nexport type GapXOptions = Options<{\n preset?: GapXValue\n label?: string\n defaultValue?: Gap\n min?: number\n max?: number\n step?: number\n hidden?: boolean\n}>\n\nexport type GapXDescriptor<_T = GapXValue> = { type: typeof Types.GapX; options: GapXOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function GapX(options: GapXOptions = {}): GapXDescriptor {\n return { type: Types.GapX, options }\n}\n\nexport type GapYValue = ResponsiveValue<Gap>\n\nexport type GapYOptions = Options<{\n preset?: GapYValue\n label?: string\n defaultValue?: Gap\n step?: number\n min?: number\n max?: number\n hidden?: boolean\n}>\n\nexport type GapYDescriptor<_T = GapYValue> = { type: typeof Types.GapY; options: GapYOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function GapY(options: GapYOptions = {}): GapYDescriptor {\n return { type: Types.GapY, options }\n}\n\ntype GridColumn = { count: number; spans: number[][] }\n\nexport type GridValue = { elements: Element[]; columns: ResponsiveValue<GridColumn> }\n\ntype GridOptions = Options<Record<string, never>>\n\ntype GridDescriptor<_T = GridValue> = { type: typeof Types.Grid; options: GridOptions }\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Grid(options: GridOptions = {}): GridDescriptor {\n return { type: Types.Grid, options }\n}\n\nexport function mergeGridPropControllerTranslatedData(\n data: GridValue,\n context: MergeTranslatableDataContext,\n) {\n return {\n ...data,\n elements: data.elements.map(element => context.mergeTranslatedData(element)),\n }\n}\n\nexport type ImageValueV0 = string\n\ntype ImageValueV1MakeswiftFile = {\n version: 1\n type: 'makeswift-file'\n id: string\n}\n\ntype ImageValueV1ExternalFile = {\n version: 1\n type: 'external-file'\n url: string\n width?: number | null\n height?: number | null\n}\n\nexport type ImageValueV1 = ImageValueV1MakeswiftFile | ImageValueV1ExternalFile\n\nexport type ImageValue = ImageValueV0 | ImageValueV1\n\nexport type ImageOptions = Options<{ label?: string; hidden?: boolean }>\n\nexport type ImageDescriptor<_T = ImageValue> = {\n type: typeof Types.Image\n version?: 1\n options: ImageOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Image(options: ImageOptions = {}): ImageDescriptor {\n return { type: Types.Image, version: 1, options }\n}\n\nexport type ImagesValueV0Item = {\n key: string\n props: {\n link?: LinkData\n file?: ImageValueV0\n altText?: string\n }\n}\n\nexport type ImagesValueV1Item = {\n key: string\n version: 1\n props: {\n link?: LinkData\n file?: ImageValueV1\n altText?: string\n }\n}\n\nexport type ImagesValueItem = ImagesValueV0Item | ImagesValueV1Item\n\nexport type ImagesValue = ImagesValueItem[]\n\ntype ImagesOptions = Options<{ preset?: ImagesValue }>\n\nexport type ImagesDescriptor<_T = ImagesValue> = {\n type: typeof Types.Images\n version?: 1\n options: ImagesOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Images(options: ImagesOptions = {}): ImagesDescriptor {\n return { type: Types.Images, version: 1, options }\n}\n\ntype ListValueItem<T extends Data> = { id: string; value?: T }\n\nexport type ListValue<T extends Data = Data> = ListValueItem<T>[]\n\nexport type ListOptions<T extends Data> = {\n type: PanelDescriptor<T>\n label?: string\n getItemLabel?: ((value: T | undefined) => string) | ((value: T | undefined) => Promise<string>)\n preset?: ListValue<T>\n defaultValue?: ListValue<T>\n}\n\nexport type ListDescriptor<T extends ListValue = ListValue> = {\n type: typeof Types.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function List<T extends Data>(options: ListOptions<T>): ListDescriptor<ListValue<T>> {\n return { type: Types.List, options }\n}\n\nexport function introspectListPropControllerData<T>(\n descriptor: ListDescriptor,\n value: ListValue | undefined,\n func: (definition: Descriptor, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return value.flatMap(item => (item.value ? func(descriptor.options.type, item.value) : []))\n}\n\nexport function getListPropControllerElementChildren<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getElementChildren)\n}\n\nexport function getListPropControllerSwatchIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getSwatchIds)\n}\n\nexport function getListPropControllerFileIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getFileIds)\n}\n\nexport function getListPropControllerTypographyIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getTypographyIds)\n}\n\nexport function getListPropControllerPageIds<T>(\n descriptor: ListDescriptor<T extends ListValue<Data> ? T : ListValue<Data>>,\n value: ListValue | undefined,\n) {\n return introspectListPropControllerData(descriptor, value, getPageIds)\n}\n\ntype ButtonVariant = 'flat' | 'outline' | 'shadow' | 'clear' | 'blocky' | 'bubbly' | 'skewed'\n\ntype ButtonShape = 'pill' | 'rounded' | 'square'\n\ntype ButtonSize = 'small' | 'medium' | 'large'\n\nexport type NavigationButton = {\n id: string\n type: 'button'\n payload: {\n label: string\n link?: LinkData\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyleData>\n }\n}\n\ntype NavigationDropdownCaretType = 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n\ntype NavigationDropdownLink = {\n id: string\n payload: {\n label: string\n link?: LinkData\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyleData>\n }\n}\n\ntype NavigationDropdown = {\n id: string\n type: 'dropdown'\n payload: {\n label: string\n caret?: NavigationDropdownCaretType\n links?: NavigationDropdownLink[]\n variant?: ResponsiveValue<ButtonVariant>\n shape?: ResponsiveValue<ButtonShape>\n size?: ResponsiveValue<ButtonSize>\n textColor?: ResponsiveValue<Color>\n color?: ResponsiveValue<Color>\n textStyle?: ResponsiveValue<TextStyleData>\n }\n}\n\nexport type NavigationLinksValue = (NavigationButton | NavigationDropdown)[]\n\ntype NavigationLinksOptions = Options<Record<string, never>>\n\ntype NavigationLinksDescriptor<_T = NavigationLinksValue> = {\n type: typeof Types.NavigationLinks\n options: NavigationLinksOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function NavigationLinks(options: NavigationLinksOptions = {}): NavigationLinksDescriptor {\n return { type: Types.NavigationLinks, options }\n}\n\nexport type IconRadioGroupOption<T extends string> = { value: T; label: string; icon: IconName }\n\nexport type ResponsiveIconRadioGroupValue<T extends string = string> = ResponsiveValue<T>\n\nexport type ResponsiveIconRadioGroupOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n options: IconRadioGroupOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> = ResponsiveIconRadioGroupValue<string>,\n> = {\n type: typeof Types.ResponsiveIconRadioGroup\n options: ResponsiveIconRadioGroupOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveIconRadioGroup<_T extends string, T extends _T, U extends T>(\n options: ResponsiveIconRadioGroupOptions<T, U>,\n): ResponsiveIconRadioGroupDescriptor<ResponsiveIconRadioGroupValue<T>> {\n return { type: Types.ResponsiveIconRadioGroup, options }\n}\n\nexport type ResponsiveNumberValue = ResponsiveValue<number>\n\nexport type ResponsiveNumberOptions = Options<{\n label?: string\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n hidden?: boolean\n}>\n\nexport type ResponsiveNumberDescriptor<_T = ResponsiveNumberValue> = {\n type: typeof Types.ResponsiveNumber\n options: ResponsiveNumberOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveNumber(\n options: ResponsiveNumberOptions = {},\n): ResponsiveNumberDescriptor {\n return { type: Types.ResponsiveNumber, options }\n}\n\nexport type ResponsiveOpacityValue = ResponsiveValue<number>\n\ntype ResponsiveOpacityOptions = Options<Record<string, never>>\n\ntype ResponsiveOpacityDescriptor<_T = ResponsiveOpacityValue> = {\n type: typeof Types.ResponsiveOpacity\n options: ResponsiveOpacityOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveOpacity(\n options: ResponsiveOpacityOptions = {},\n): ResponsiveOpacityDescriptor {\n return { type: Types.ResponsiveOpacity, options }\n}\n\nexport type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>\n\nexport type SelectLabelOrientation = 'vertical' | 'horizontal'\n\nexport type SelectOption<T extends string> = { value: T; label: string }\n\nexport type ResponsiveSelectOptions<T extends string = string, U extends T = T> = Options<{\n label?: string\n labelOrientation?: SelectLabelOrientation\n options: SelectOption<T>[]\n defaultValue?: U\n hidden?: boolean\n}>\n\nexport type ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> = ResponsiveSelectValue<string>,\n> = {\n type: typeof Types.ResponsiveSelect\n options: ResponsiveSelectOptions<ResponsiveValueType<T>>\n}\n\n// HACK(miguel): We have to use a layer of indirection with `_T` and `T` because otherwise the\n// values provided would undergo type widening. For some reason, the extra layer of indirection\n// reuslts in TypeScript not widening types. Note, this only happens when the returned value of this\n// function is passed to another as an argument, which is common with the `registerComponent` API.\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function ResponsiveSelect<_T extends string, T extends _T, U extends T>(\n options: ResponsiveSelectOptions<T, U>,\n): ResponsiveSelectDescriptor<ResponsiveSelectValue<T>> {\n return { type: Types.ResponsiveSelect, options }\n}\n\nexport type RichTextValue = IndexSignatureHack<RichTextDTO>\n\nexport type RichTextOptions = Options<{ preset?: RichTextValue }>\n\nexport type RichTextDescriptor<_T extends Data = RichTextValue> = {\n type: typeof Types.RichText\n options: RichTextOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function RichText(options: RichTextOptions = {}): RichTextDescriptor {\n return { type: Types.RichText, options }\n}\n\nexport type ShapeValue<T extends Data = Data> = Record<string, T>\n\ntype ShapeOptions<T extends Record<string, PanelDescriptor>> = {\n type: T\n preset?: { [K in keyof T]?: DescriptorValueType<T[K]> }\n}\n\nexport type ShapeDescriptor<\n _T extends Record<string, Data>,\n U extends Record<string, PanelDescriptor>,\n> = {\n type: typeof Types.Shape\n options: ShapeOptions<U>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Shape<T extends Record<string, PanelDescriptor>>(\n options: ShapeOptions<T>,\n): ShapeDescriptor<{ [K in keyof T]?: DescriptorValueType<T[K]> }, T> {\n return { type: Types.Shape, options }\n}\n\nexport function introspectShapePropControllerData<T>(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n func: (definition: Descriptor, data: Data) => T[],\n): T[] {\n if (value == null) return []\n\n return Object.entries(descriptor.options.type).flatMap(([key, definition]) =>\n func(definition, value[key]),\n )\n}\n\nexport function getShapePropControllerElementChildren(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): Element[] {\n return introspectShapePropControllerData(descriptor, value, getElementChildren)\n}\n\nexport function getShapePropControllerFileIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getFileIds)\n}\n\nexport function getShapePropControllerTypographyIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getTypographyIds)\n}\n\nexport function getShapePropControllerPageIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getPageIds)\n}\n\nexport function getShapePropControllerSwatchIds(\n descriptor: ShapeDescriptor<Record<string, Data>, Record<string, PanelDescriptor>>,\n value: ShapeValue | undefined,\n): string[] {\n return introspectShapePropControllerData(descriptor, value, getSwatchIds)\n}\n\nexport const socialLinkTypesV0 = [\n 'angellist',\n 'codepen',\n 'discord',\n 'dribbble',\n 'facebook',\n 'github',\n 'instagram',\n 'linkedin',\n 'medium',\n 'pinterest',\n 'reddit',\n 'rss',\n 'snapchat',\n 'soundcloud',\n 'spotify',\n 'telegram',\n 'tumblr',\n 'twitch',\n 'twitter',\n 'vimeo',\n 'whatsapp',\n 'yelp',\n 'youtube',\n] as const\n\ntype SocialLinkTypeV0 = typeof socialLinkTypesV0[number]\n\nexport const socialLinkTypesV1 = [...socialLinkTypesV0, 'x', 'slack'] as const\n\ntype SocialLinkTypeV1 = typeof socialLinkTypesV1[number]\n\ntype SocialLinkV0 = { type: SocialLinkTypeV0; url: string }\n\ntype SocialLinkV1 = { type: SocialLinkTypeV1; url: string }\n\ntype SocialLinksLinkV0 = { id: string; payload: SocialLinkV0 }\n\ntype SocialLinksLinkV1 = { id: string; payload: SocialLinkV1 }\n\ntype SocialLinksValueV0 = { links: SocialLinksLinkV0[]; openInNewTab: boolean }\n\ntype SocialLinksValueV1 = { links: SocialLinksLinkV1[]; openInNewTab: boolean }\n\nexport type SocialLinksValue = SocialLinksValueV0 | SocialLinksValueV1\n\ntype SocialLinksOptions = Options<{ preset?: SocialLinksValueV1 }>\n\nexport type SocialLinksDescriptor<_T = SocialLinksValueV1> = {\n type: typeof Types.SocialLinks\n options: SocialLinksOptions\n version?: 1\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function SocialLinks(options: SocialLinksOptions = {}): SocialLinksDescriptor {\n return { type: Types.SocialLinks, options, version: 1 }\n}\n\ntype TableFormField = {\n id: string\n tableColumnId: string\n label?: string\n placeholder?: string\n defaultValue?: string | boolean | string[]\n required?: boolean\n hidden?: boolean\n type?: 'select' | 'radio'\n hideLabel?: boolean\n autofill?: boolean\n}\n\ntype Grid = { count: number; spans: number[][] }\n\nexport type TableFormFieldsValue = { fields: TableFormField[]; grid: ResponsiveValue<Grid> }\n\ntype TableFormFieldsOptions = Options<{ preset?: TableFormFieldsValue }>\n\nexport type TableFormFieldsDescriptor<_T = TableFormFieldsValue> = {\n type: typeof Types.TableFormFields\n options: TableFormFieldsOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TableFormFields(options: TableFormFieldsOptions = {}): TableFormFieldsDescriptor {\n return { type: Types.TableFormFields, options }\n}\n\nexport type TypeaheadValue<T extends Data = Data> = {\n id: string\n label: string\n value: T\n}\n\nexport type TypeaheadOptions<T extends Data> = {\n getItems: (query: string) => Promise<TypeaheadValue<T>[]>\n label?: string\n preset?: TypeaheadValue<T>\n defaultValue?: TypeaheadValue<T>\n}\n\nexport type TypeaheadDescriptor<T extends TypeaheadValue = TypeaheadValue> = {\n type: typeof Types.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function Typeahead<T extends Data>(\n options: TypeaheadOptions<T>,\n): TypeaheadDescriptor<TypeaheadValue<T>> {\n return { type: Types.Typeahead, options }\n}\n\nexport type TextAreaValue = string\n\ntype TextAreaOptions = Options<{ preset?: TextAreaValue; label?: string; rows?: number }>\n\ntype TextAreaDescriptor<_T = TextAreaValue> = {\n type: typeof Types.TextArea\n options: TextAreaOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextArea(options: TextAreaOptions = {}): TextAreaDescriptor {\n return { type: Types.TextArea, options }\n}\n\nexport type TextInputValue = string\n\nexport type TextInputOptions = Options<{ label?: string; placeholder?: string; hidden?: boolean }>\n\nexport type TextInputDescriptor<_T = TextInputValue> = {\n type: typeof Types.TextInput\n options: TextInputOptions\n}\n\n/**\n * @deprecated Imports from `@makeswift/runtime/prop-controllers` are deprecated. Use\n * `@makeswift/runtime/controls` instead.\n */\nexport function TextInput(options: TextInputOptions = {}): TextInputDescriptor {\n return { type: Types.TextInput, options }\n}\n\nexport type Descriptor<T extends Data = Data> =\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | GapXDescriptor<T>\n | GapYDescriptor<T>\n | GridDescriptor<T>\n | ImageDescriptor<T>\n | ImagesDescriptor<T>\n | LinkDescriptor<T>\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | MarginDescriptor<T>\n | NavigationLinksDescriptor<T>\n | NumberDescriptor<T>\n | PaddingDescriptor<T>\n | ResponsiveColorDescriptor<T>\n | ResponsiveIconRadioGroupDescriptor<\n T extends ResponsiveIconRadioGroupValue<string> ? T : ResponsiveIconRadioGroupValue<string>\n >\n | ResponsiveLengthDescriptor<T>\n | ResponsiveNumberDescriptor<T>\n | ResponsiveOpacityDescriptor<T>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\n | RichTextDescriptor<T>\n | ShadowsDescriptor<T>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\n | TextAreaDescriptor<T>\n | TextInputDescriptor<T>\n | TextStyleDescriptor<T>\n | VideoDescriptor<T>\n | WidthDescriptor<T>\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | NumberControlDefinition\n | CheckboxControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition\n | LinkControlDefinition\n | SlotControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | TypographyControlDefinition\n\nexport type PanelDescriptorType =\n | typeof Types.Backgrounds\n | typeof Types.ResponsiveIconRadioGroup\n | typeof PropControllerTypes.Margin\n | typeof PropControllerTypes.Padding\n | typeof PropControllerTypes.Shadows\n | typeof PropControllerTypes.Border\n | typeof Types.GapY\n | typeof Types.GapX\n | typeof PropControllerTypes.BorderRadius\n | typeof PropControllerTypes.Checkbox\n | typeof Types.TextInput\n | typeof PropControllerTypes.Link\n | typeof Types.List\n | typeof Types.Shape\n | typeof Types.ResponsiveSelect\n | typeof PropControllerTypes.ResponsiveColor\n | typeof PropControllerTypes.TextStyle\n | typeof Types.Images\n | typeof Types.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof Types.TextArea\n | typeof PropControllerTypes.Table\n | typeof Types.Typeahead\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof PropControllerTypes.Video\n | typeof Types.NavigationLinks\n\nexport type PanelDescriptor<T extends Data = Data> = Extract<\n Descriptor<T>,\n { type: PanelDescriptorType }\n>\n\nexport type DescriptorValueType<T extends Descriptor> = T extends NumberControlDefinition\n ? NumberControlValue<T>\n : T extends CheckboxControlDefinition\n ? CheckboxControlValue<T>\n : T extends TextInputControlDefinition\n ? TextInputControlValue<T>\n : T extends TextAreaControlDefinition\n ? TextAreaControlValue<T>\n : T extends SelectControlDefinition\n ? SelectControlValue<T>\n : T extends ColorControlDefinition\n ? ColorControlValue<T>\n : T extends StyleControlDefinition\n ? StyleControlFormattedValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlValue<T>\n : T extends ImageControlDefinition\n ? ResolveImageControlValue<T>\n : T extends ComboboxControlDefinition\n ? ComboboxControlValue<T>\n : T extends ShapeControlDefinition\n ? ShapeControlValue<T>\n : T extends ListControlDefinition\n ? ListControlValue<T>\n : T extends LinkControlDefinition\n ? LinkControlValue<T>\n : T extends SlotControlDefinition\n ? SlotControlValue\n : T extends RichTextControlDefinition\n ? RichTextControlValue\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlValue\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlFormattedValue\n : T extends TypographyControlDefinition\n ? TypographyControlValue\n : T['type'] extends typeof PropControllerTypes.ResponsiveColor\n ? // TODO(miguel): We're not importing a resolver type from `@makeswift/prop-controllers` because\n // the resolved type is tightly coupled with the runtime (i.e., it's the result of an API call).\n // This means that we probably want to rethink how types are resolved and where that lives.\n ResponsiveColor | null | undefined\n : T['type'] extends typeof PropControllerTypes.Checkbox\n ? ResolveCheckboxPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Checkbox }>>\n : T['type'] extends typeof PropControllerTypes.Date\n ? ResolveDatePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Date }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.Link\n ? LinkPropControllerValue\n : T['type'] extends typeof PropControllerTypes.Width\n ? ResolveWidthPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Width }>>\n : T['type'] extends typeof PropControllerTypes.Padding\n ? ResolvePaddingPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Padding }>>\n : T['type'] extends typeof PropControllerTypes.Margin\n ? ResolveMarginPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Margin }>>\n : T['type'] extends typeof PropControllerTypes.BorderRadius\n ? ResolveBorderRadiusPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.BorderRadius }>\n >\n : T['type'] extends typeof PropControllerTypes.Shadows\n ? ResolveShadowsPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Shadows }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveLength\n ? ResolveResponsiveLengthPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.ResponsiveLength }>\n >\n : T['type'] extends typeof PropControllerTypes.Border\n ? ResolveBorderPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Border }>>\n : T['type'] extends typeof PropControllerTypes.Number\n ? ResolveNumberPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Number }>>\n : T['type'] extends typeof PropControllerTypes.Table\n ? ResolveTablePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Table }>>\n : T['type'] extends typeof PropControllerTypes.TextStyle\n ? ResolveTextStylePropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextStyle }>>\n : T['type'] extends typeof PropControllerTypes.Video\n ? ResolveVideoPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Video }>>\n : T extends Descriptor<infer U>\n ? U | undefined\n : never\n\nexport type PanelDescriptorValueType<T extends PanelDescriptor> = T extends PanelDescriptor<infer U>\n ? U\n : never\n"],"mappings":"AAKA,SAAS,wBAAwB;AAoCjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA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