@makeswift/runtime 0.16.0-canary.4 → 0.16.0-canary.5
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.
- package/dist/cjs/builder/serialization/control-serialization.js +11 -10
- package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
- package/dist/cjs/components/builtin/Box/Box.js.map +1 -1
- package/dist/cjs/components/builtin/Box/register.js +2 -2
- package/dist/cjs/components/builtin/Box/register.js.map +1 -1
- package/dist/cjs/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/cjs/components/builtin/Carousel/register.js +1 -1
- package/dist/cjs/components/builtin/Carousel/register.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/register.js +1 -1
- package/dist/cjs/components/builtin/Countdown/register.js.map +1 -1
- package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/cjs/components/builtin/Embed/register.js +1 -1
- package/dist/cjs/components/builtin/Embed/register.js.map +1 -1
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/components/builtin/Form/register.js +1 -1
- package/dist/cjs/components/builtin/Form/register.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/register.js +1 -1
- package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
- package/dist/cjs/components/builtin/Root/Root.js.map +1 -1
- package/dist/cjs/components/builtin/Root/register.js +6 -5
- package/dist/cjs/components/builtin/Root/register.js.map +1 -1
- package/dist/cjs/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
- package/dist/cjs/components/builtin/SocialLinks/register.js +1 -1
- package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/cjs/components/hooks/useGapXPropControllerData.js +34 -0
- package/dist/cjs/components/hooks/useGapXPropControllerData.js.map +1 -0
- package/dist/cjs/components/hooks/useGapYPropControllerData.js +34 -0
- package/dist/cjs/components/hooks/useGapYPropControllerData.js.map +1 -0
- package/dist/cjs/components/hooks/useTextAreaPropControllerData.js +34 -0
- package/dist/cjs/components/hooks/useTextAreaPropControllerData.js.map +1 -0
- package/dist/cjs/controls/control.js +2 -2
- package/dist/cjs/controls/control.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/prop-controllers/deleted.js +33 -0
- package/dist/cjs/prop-controllers/deleted.js.map +1 -0
- package/dist/cjs/prop-controllers/descriptors.js +0 -103
- package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
- package/dist/cjs/prop-controllers/index.js +3 -0
- package/dist/cjs/prop-controllers/index.js.map +1 -1
- package/dist/cjs/prop-controllers/introspection.js +0 -30
- package/dist/cjs/prop-controllers/introspection.js.map +1 -1
- package/dist/cjs/runtimes/react/components/PreviewProvider.js +4 -0
- package/dist/cjs/runtimes/react/components/PreviewProvider.js.map +1 -1
- package/dist/cjs/runtimes/react/controls.js +33 -0
- package/dist/cjs/runtimes/react/controls.js.map +1 -1
- package/dist/cjs/state/react-builder-preview.js +95 -38
- package/dist/cjs/state/react-builder-preview.js.map +1 -1
- package/dist/esm/builder/serialization/control-serialization.js +13 -10
- package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
- package/dist/esm/components/builtin/Box/Box.js.map +1 -1
- package/dist/esm/components/builtin/Box/register.js +4 -2
- package/dist/esm/components/builtin/Box/register.js.map +1 -1
- package/dist/esm/components/builtin/Carousel/Carousel.js.map +1 -1
- package/dist/esm/components/builtin/Carousel/register.js +9 -2
- package/dist/esm/components/builtin/Carousel/register.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/register.js +2 -1
- package/dist/esm/components/builtin/Countdown/register.js.map +1 -1
- package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/esm/components/builtin/Embed/register.js +2 -2
- package/dist/esm/components/builtin/Embed/register.js.map +1 -1
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/components/builtin/Form/register.js +2 -1
- package/dist/esm/components/builtin/Form/register.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/register.js +3 -2
- package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
- package/dist/esm/components/builtin/Root/Root.js.map +1 -1
- package/dist/esm/components/builtin/Root/register.js +3 -2
- package/dist/esm/components/builtin/Root/register.js.map +1 -1
- package/dist/esm/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
- package/dist/esm/components/builtin/SocialLinks/register.js +2 -2
- package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/esm/components/hooks/useGapXPropControllerData.js +12 -0
- package/dist/esm/components/hooks/useGapXPropControllerData.js.map +1 -0
- package/dist/esm/components/hooks/useGapYPropControllerData.js +12 -0
- package/dist/esm/components/hooks/useGapYPropControllerData.js.map +1 -0
- package/dist/esm/components/hooks/useTextAreaPropControllerData.js +12 -0
- package/dist/esm/components/hooks/useTextAreaPropControllerData.js.map +1 -0
- package/dist/esm/controls/control.js +2 -2
- package/dist/esm/controls/control.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/prop-controllers/deleted.js +9 -0
- package/dist/esm/prop-controllers/deleted.js.map +1 -0
- package/dist/esm/prop-controllers/descriptors.js +0 -91
- package/dist/esm/prop-controllers/descriptors.js.map +1 -1
- package/dist/esm/prop-controllers/index.js +2 -0
- package/dist/esm/prop-controllers/index.js.map +1 -1
- package/dist/esm/prop-controllers/introspection.js +0 -40
- package/dist/esm/prop-controllers/introspection.js.map +1 -1
- package/dist/esm/runtimes/react/components/PreviewProvider.js +4 -0
- package/dist/esm/runtimes/react/components/PreviewProvider.js.map +1 -1
- package/dist/esm/runtimes/react/controls.js +33 -0
- package/dist/esm/runtimes/react/controls.js.map +1 -1
- package/dist/esm/state/react-builder-preview.js +105 -45
- package/dist/esm/state/react-builder-preview.js.map +1 -1
- package/dist/types/api/graphql/documents/queries.d.ts +7 -7
- package/dist/types/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/builder/serialization/control-serialization.d.ts +24 -23
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/Box.d.ts +15 -3
- package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/Carousel.d.ts +3 -2
- package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/Countdown.d.ts +3 -3
- package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Embed/Embed.d.ts +2 -2
- package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts +3 -3
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/Navigation.d.ts +3 -3
- package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Root/Root.d.ts +4 -3
- package/dist/types/components/builtin/Root/Root.d.ts.map +1 -1
- package/dist/types/components/builtin/Root/register.d.ts.map +1 -1
- package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts +3 -2
- package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
- package/dist/types/components/hooks/useGapXPropControllerData.d.ts +3 -0
- package/dist/types/components/hooks/useGapXPropControllerData.d.ts.map +1 -0
- package/dist/types/components/hooks/useGapYPropControllerData.d.ts +3 -0
- package/dist/types/components/hooks/useGapYPropControllerData.d.ts.map +1 -0
- package/dist/types/components/hooks/useTextAreaPropControllerData.d.ts +3 -0
- package/dist/types/components/hooks/useTextAreaPropControllerData.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-gap-x-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-gap-x-prop-controller.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-gap-y-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-gap-y-prop-controller.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-text-area-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-text-area-prop-controller.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/deleted.d.ts +51 -0
- package/dist/types/prop-controllers/deleted.d.ts.map +1 -0
- package/dist/types/prop-controllers/descriptors.d.ts +9 -133
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/prop-controllers/index.d.ts +2 -1
- package/dist/types/prop-controllers/index.d.ts.map +1 -1
- package/dist/types/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts +11 -3
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/SocialLinks.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react'\n\nimport { Link } from '../../shared/Link'\nimport { colorToString } from '../../utils/colorToString'\nimport { ColorValue as Color } from '../../utils/types'\nimport { SocialLinksOptions, SocialLinksOptionType } from './options'\nimport GutterContainer from '../../shared/GutterContainer'\nimport SocialLinksPlaceholder from './components/SocialLinksPlaceholder'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/SocialLinks.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, Ref } from 'react'\n\nimport { Link } from '../../shared/Link'\nimport { colorToString } from '../../utils/colorToString'\nimport { ColorValue as Color } from '../../utils/types'\nimport { SocialLinksOptions, SocialLinksOptionType } from './options'\nimport GutterContainer from '../../shared/GutterContainer'\nimport SocialLinksPlaceholder from './components/SocialLinksPlaceholder'\nimport {\n ElementIDValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n} from '../../../prop-controllers/descriptors'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { ResponsiveGapData, ResponsiveValue } from '@makeswift/prop-controllers'\n\ntype Props = {\n id?: ElementIDValue\n links?: {\n links: { id: string; payload: { type: SocialLinksOptionType; url: string } }[]\n openInNewTab: boolean\n }\n shape?: ResponsiveIconRadioGroupValue<'naked' | 'circle' | 'rounded' | 'square'>\n size?: ResponsiveIconRadioGroupValue<'small' | 'medium' | 'large'>\n hoverStyle?: ResponsiveSelectValue<'none' | 'grow' | 'shrink' | 'fade'>\n fill?: ResponsiveColor | null\n backgroundColor?: ResponsiveColor | null\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: ResponsiveGapData\n width?: string\n margin?: string\n}\n\nconst SocialLinks = forwardRef(function SocialLinks(\n {\n id,\n links: { links, openInNewTab } = { links: [], openInNewTab: false },\n shape,\n size,\n hoverStyle,\n fill,\n backgroundColor,\n alignment,\n gutter,\n width,\n margin,\n }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'row', flexWrap: 'wrap' }),\n width,\n margin,\n useStyle(\n useResponsiveStyle([alignment] as const, ([alignment = 'center']) => ({\n justifyContent: alignment,\n })),\n ),\n )}\n >\n {links.length > 0 ? (\n links.map((link, i) => {\n const option = SocialLinksOptions.find(o => o.type === link.payload.type)\n\n if (option == null) return null\n\n return (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n <StyledLink\n backgroundColor={backgroundColor}\n brandColor={option.brandColor}\n fill={fill}\n hoverStyle={hoverStyle}\n link={{ type: 'OPEN_URL', payload: { url: link.payload.url, openInNewTab } }}\n shape={shape}\n size={size}\n >\n {option.icon}\n </StyledLink>\n </GutterContainer>\n )\n })\n ) : (\n <SocialLinksPlaceholder gutter={gutter} />\n )}\n </div>\n )\n})\n\nexport default SocialLinks\n\ntype StyledLinkProps = ComponentPropsWithoutRef<typeof Link> & {\n brandColor: string\n shape: Props['shape']\n size: Props['size']\n hoverStyle: Props['hoverStyle']\n fill: ResponsiveValue<Color> | null | undefined\n backgroundColor: ResponsiveValue<Color> | null | undefined\n}\n\nfunction StyledLink({\n className,\n brandColor,\n shape,\n size,\n hoverStyle,\n fill,\n backgroundColor,\n ...restOfProps\n}: StyledLinkProps) {\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n color: brandColor,\n transition: 'transform, opacity 0.18s',\n svg: { display: 'block' },\n }),\n useStyle(\n useResponsiveStyle(\n [shape, size, hoverStyle, fill, backgroundColor] as const,\n ([shape = 'naked', size = 'medium', hoverStyle = 'none', fill, backgroundColor]) => ({\n padding: shape === 'naked' ? 0 : { small: 10, medium: 12, large: 14 }[size],\n borderRadius: { circle: '50%', rounded: '8px', naked: 0, square: 0 }[shape],\n background:\n shape === 'naked'\n ? 'transparent'\n : backgroundColor == null\n ? 'currentColor'\n : colorToString(backgroundColor),\n\n ':hover': {\n none: {},\n grow: { transform: 'scale(1.1)' },\n shrink: { transform: 'scale(0.9)' },\n fade: { opacity: 0.65 },\n }[hoverStyle],\n\n svg: {\n fill:\n fill == null\n ? shape === 'naked' || backgroundColor != null\n ? 'currentColor'\n : 'white'\n : colorToString(fill),\n width: { small: 16, medium: 20, large: 24 }[size],\n height: { small: 16, medium: 20, large: 24 }[size],\n },\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n"],"mappings":"AAgFc;AAhFd,SAAmC,kBAAuB;AAE1D,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,SAAS,0BAAiD;AAC1D,OAAO,qBAAqB;AAC5B,OAAO,4BAA4B;AAOnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AAoBnC,MAAM,cAAc,WAAW,SAASA,aACtC;AAAA,EACE;AAAA,EACA,OAAO,EAAE,OAAO,aAAa,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,MAAM;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT,SAAS,EAAE,SAAS,QAAQ,eAAe,OAAO,UAAU,OAAO,CAAC;AAAA,QACpE;AAAA,QACA;AAAA,QACA;AAAA,UACE,mBAAmB,CAAC,SAAS,GAAY,CAAC,CAACC,aAAY,QAAQ,OAAO;AAAA,YACpE,gBAAgBA;AAAA,UAClB,EAAE;AAAA,QACJ;AAAA,MACF;AAAA,MAEC,gBAAM,SAAS,IACd,MAAM,IAAI,CAAC,MAAM,MAAM;AACrB,cAAM,SAAS,mBAAmB,KAAK,OAAK,EAAE,SAAS,KAAK,QAAQ,IAAI;AAExE,YAAI,UAAU;AAAM,iBAAO;AAE3B,eACE;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA,OAAO,MAAM;AAAA,YACb,MAAM,MAAM,MAAM,SAAS;AAAA,YAE3B;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA,YAAY,OAAO;AAAA,gBACnB;AAAA,gBACA;AAAA,gBACA,MAAM,EAAE,MAAM,YAAY,SAAS,EAAE,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D,KAAI;AAAA,gBACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,IAAI,OAAO,GAAG,EAAEF,KAAI;AAAA,gBAChD,QAAQ,EAAE,OAAO,IAAI,QAAQ,IAAI,OAAO,GAAG,EAAEA,KAAI;AAAA,cACnD;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,QACA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":["SocialLinks","alignment","shape","size","hoverStyle","fill","backgroundColor"]}
|
|
@@ -3,7 +3,7 @@ import { getBaseBreakpoint } from "../../../state/modules/breakpoints";
|
|
|
3
3
|
import { MakeswiftComponentType } from "../constants";
|
|
4
4
|
import { ComponentIcon } from "../../../state/modules/components-meta";
|
|
5
5
|
import { lazy } from "react";
|
|
6
|
-
import { Margin, ResponsiveColor, Width } from "@makeswift/prop-controllers";
|
|
6
|
+
import { GapX, Margin, ResponsiveColor, Width } from "@makeswift/prop-controllers";
|
|
7
7
|
function registerComponent(runtime) {
|
|
8
8
|
return runtime.registerComponent(
|
|
9
9
|
lazy(() => import("./SocialLinks")),
|
|
@@ -100,7 +100,7 @@ function registerComponent(runtime) {
|
|
|
100
100
|
],
|
|
101
101
|
defaultValue: "center"
|
|
102
102
|
}),
|
|
103
|
-
gutter:
|
|
103
|
+
gutter: GapX({
|
|
104
104
|
preset: [
|
|
105
105
|
{
|
|
106
106
|
deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { SocialLinksValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport { Margin, ResponsiveColor, Width } from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./SocialLinks')),\n {\n type: MakeswiftComponentType.SocialLinks,\n label: 'Social Links',\n icon: ComponentIcon.SocialLinks,\n props: {\n id: Props.ElementID(),\n links: Props.SocialLinks({\n preset: {\n links: [\n {\n id: 'facebook',\n payload: { type: 'facebook', url: 'https://www.facebook.com' },\n },\n {\n id: 'instagram',\n payload: { type: 'instagram', url: 'https://www.instagram.com' },\n },\n {\n id: 'twitter',\n payload: { type: 'twitter', url: 'https://www.twitter.com' },\n },\n ],\n openInNewTab: false,\n },\n }),\n shape: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue | undefined\n\n return {\n label: 'Shape',\n options: [\n { label: 'Naked', value: 'naked', icon: 'Star16' },\n { label: 'Circle', value: 'circle', icon: 'StarCircle16' },\n { label: 'Rounded', value: 'rounded', icon: 'StarRoundedSquare16' },\n { label: 'Square', value: 'square', icon: 'StarSquare16' },\n ],\n defaultValue: 'naked',\n hidden: links == null || links.links.length === 0,\n }\n }),\n size: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue | undefined\n\n return {\n label: 'Size',\n options: [\n { label: 'Small', value: 'small', icon: 'SizeSmall16' },\n { label: 'Medium', value: 'medium', icon: 'SizeMedium16' },\n { label: 'Large', value: 'large', icon: 'SizeLarge16' },\n ],\n defaultValue: 'medium',\n hidden: links == null || links.links.length === 0,\n }\n }),\n hoverStyle: Props.ResponsiveSelect(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'On hover',\n options: [\n { value: 'none', label: 'None' },\n { value: 'grow', label: 'Grow' },\n { value: 'shrink', label: 'Shrink' },\n { value: 'fade', label: 'Fade' },\n ],\n defaultValue: 'none',\n labelOrientation: 'horizontal',\n hidden,\n }\n }),\n fill: ResponsiveColor(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Icon color',\n hidden,\n }\n }),\n backgroundColor: ResponsiveColor(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Shape color',\n hidden,\n }\n }),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'flex-start', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'center', value: 'center', icon: 'AlignCenter16' },\n { label: 'flex-end', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'center',\n }),\n gutter:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { SocialLinksValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport { GapX, Margin, ResponsiveColor, Width } from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./SocialLinks')),\n {\n type: MakeswiftComponentType.SocialLinks,\n label: 'Social Links',\n icon: ComponentIcon.SocialLinks,\n props: {\n id: Props.ElementID(),\n links: Props.SocialLinks({\n preset: {\n links: [\n {\n id: 'facebook',\n payload: { type: 'facebook', url: 'https://www.facebook.com' },\n },\n {\n id: 'instagram',\n payload: { type: 'instagram', url: 'https://www.instagram.com' },\n },\n {\n id: 'twitter',\n payload: { type: 'twitter', url: 'https://www.twitter.com' },\n },\n ],\n openInNewTab: false,\n },\n }),\n shape: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue | undefined\n\n return {\n label: 'Shape',\n options: [\n { label: 'Naked', value: 'naked', icon: 'Star16' },\n { label: 'Circle', value: 'circle', icon: 'StarCircle16' },\n { label: 'Rounded', value: 'rounded', icon: 'StarRoundedSquare16' },\n { label: 'Square', value: 'square', icon: 'StarSquare16' },\n ],\n defaultValue: 'naked',\n hidden: links == null || links.links.length === 0,\n }\n }),\n size: Props.ResponsiveIconRadioGroup(props => {\n const links = props.links as SocialLinksValue | undefined\n\n return {\n label: 'Size',\n options: [\n { label: 'Small', value: 'small', icon: 'SizeSmall16' },\n { label: 'Medium', value: 'medium', icon: 'SizeMedium16' },\n { label: 'Large', value: 'large', icon: 'SizeLarge16' },\n ],\n defaultValue: 'medium',\n hidden: links == null || links.links.length === 0,\n }\n }),\n hoverStyle: Props.ResponsiveSelect(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'On hover',\n options: [\n { value: 'none', label: 'None' },\n { value: 'grow', label: 'Grow' },\n { value: 'shrink', label: 'Shrink' },\n { value: 'fade', label: 'Fade' },\n ],\n defaultValue: 'none',\n labelOrientation: 'horizontal',\n hidden,\n }\n }),\n fill: ResponsiveColor(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Icon color',\n hidden,\n }\n }),\n backgroundColor: ResponsiveColor(props => {\n const links = props.links as SocialLinksValue | undefined\n const hidden = links == null || links.links.length === 0\n\n return {\n label: 'Shape color',\n hidden,\n }\n }),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'flex-start', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'center', value: 'center', icon: 'AlignCenter16' },\n { label: 'flex-end', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'center',\n }),\n gutter: GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({\n format: Margin.Format.ClassName,\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: {\n marginTop: { value: 10, unit: 'px' },\n marginRight: 'auto',\n marginBottom: { value: 10, unit: 'px' },\n marginLeft: 'auto',\n },\n },\n ],\n }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,MAAM,QAAQ,iBAAiB,aAAa;AAE9C,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,IACb,KAAK,MAAM,OAAO,eAAe,CAAC;AAAA,IAClC;AAAA,MACE,MAAM,uBAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,cAAc;AAAA,MACpB,OAAO;AAAA,QACL,IAAI,MAAM,UAAU;AAAA,QACpB,OAAO,MAAM,YAAY;AAAA,UACvB,QAAQ;AAAA,YACN,OAAO;AAAA,cACL;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,YAAY,KAAK,2BAA2B;AAAA,cAC/D;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,aAAa,KAAK,4BAA4B;AAAA,cACjE;AAAA,cACA;AAAA,gBACE,IAAI;AAAA,gBACJ,SAAS,EAAE,MAAM,WAAW,KAAK,0BAA0B;AAAA,cAC7D;AAAA,YACF;AAAA,YACA,cAAc;AAAA,UAChB;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM,yBAAyB,WAAS;AAC7C,gBAAM,QAAQ,MAAM;AAEpB,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,SAAS;AAAA,cACP,EAAE,OAAO,SAAS,OAAO,SAAS,MAAM,SAAS;AAAA,cACjD,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe;AAAA,cACzD,EAAE,OAAO,WAAW,OAAO,WAAW,MAAM,sBAAsB;AAAA,cAClE,EAAE,OAAO,UAAU,OAAO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3
|
+
} from "@makeswift/prop-controllers";
|
|
4
|
+
function useGapXPropControllerData(data) {
|
|
5
|
+
if (data == null)
|
|
6
|
+
return data;
|
|
7
|
+
return getGapXPropControllerDataResponsiveGapData(data);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useGapXPropControllerData
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useGapXPropControllerData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useGapXPropControllerData.ts"],"sourcesContent":["import {\n GapXPropControllerData,\n ResponsiveGapData,\n getGapXPropControllerDataResponsiveGapData,\n} from '@makeswift/prop-controllers'\n\nexport function useGapXPropControllerData(\n data: GapXPropControllerData | undefined,\n): ResponsiveGapData | undefined {\n if (data == null) return data\n\n return getGapXPropControllerDataResponsiveGapData(data)\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,OACK;AAEA,SAAS,0BACd,MAC+B;AAC/B,MAAI,QAAQ;AAAM,WAAO;AAEzB,SAAO,2CAA2C,IAAI;AACxD;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGapYPropControllerDataResponsiveGapData
|
|
3
|
+
} from "@makeswift/prop-controllers";
|
|
4
|
+
function useGapYPropControllerData(data) {
|
|
5
|
+
if (data == null)
|
|
6
|
+
return data;
|
|
7
|
+
return getGapYPropControllerDataResponsiveGapData(data);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useGapYPropControllerData
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useGapYPropControllerData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useGapYPropControllerData.ts"],"sourcesContent":["import {\n GapYPropControllerData,\n ResponsiveGapData,\n getGapYPropControllerDataResponsiveGapData,\n} from '@makeswift/prop-controllers'\n\nexport function useGapYPropControllerData(\n data: GapYPropControllerData | undefined,\n): ResponsiveGapData | undefined {\n if (data == null) return data\n\n return getGapYPropControllerDataResponsiveGapData(data)\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,OACK;AAEA,SAAS,0BACd,MAC+B;AAC/B,MAAI,QAAQ;AAAM,WAAO;AAEzB,SAAO,2CAA2C,IAAI;AACxD;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTextAreaPropControllerDataString
|
|
3
|
+
} from "@makeswift/prop-controllers";
|
|
4
|
+
function useTextAreaPropControllerData(data) {
|
|
5
|
+
if (data == null)
|
|
6
|
+
return data;
|
|
7
|
+
return getTextAreaPropControllerDataString(data);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useTextAreaPropControllerData
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useTextAreaPropControllerData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useTextAreaPropControllerData.ts"],"sourcesContent":["import {\n TextAreaPropControllerData,\n getTextAreaPropControllerDataString,\n} from '@makeswift/prop-controllers'\n\nexport function useTextAreaPropControllerData(\n data: TextAreaPropControllerData | undefined,\n): string | undefined {\n if (data == null) return data\n\n return getTextAreaPropControllerDataString(data)\n}\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,OACK;AAEA,SAAS,8BACd,MACoB;AACpB,MAAI,QAAQ;AAAM,WAAO;AAEzB,SAAO,oCAAoC,IAAI;AACjD;","names":[]}
|
|
@@ -97,7 +97,7 @@ function merge(definition, a, b = a, context) {
|
|
|
97
97
|
function getTranslatableData(definition, data) {
|
|
98
98
|
switch (definition.type) {
|
|
99
99
|
case Types.TextInput:
|
|
100
|
-
case
|
|
100
|
+
case PropControllerTypes.TextArea:
|
|
101
101
|
case TextInputControlType:
|
|
102
102
|
case TextAreaControlType:
|
|
103
103
|
return data;
|
|
@@ -123,7 +123,7 @@ function mergeTranslatedData(definition, data, translatedData, context) {
|
|
|
123
123
|
return data;
|
|
124
124
|
switch (definition.type) {
|
|
125
125
|
case Types.TextInput:
|
|
126
|
-
case
|
|
126
|
+
case PropControllerTypes.TextArea:
|
|
127
127
|
case TextInputControlType:
|
|
128
128
|
case TextAreaControlType:
|
|
129
129
|
if (translatedData == null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/control.ts"],"sourcesContent":["import { CheckboxControlData, CheckboxControlDefinition } from './checkbox'\nimport { ColorControlData, ColorControlDefinition, ColorControlType, copyColorData } from './color'\nimport { ComboboxControlData, ComboboxControlDefinition } from './combobox'\nimport { ImageControlData, ImageControlDefinition, copyImageData, ImageControlType } from './image'\nimport { LinkControlData, LinkControlDefinition, copyLinkData, LinkControlType } from './link'\nimport {\n ListControlData,\n ListControlDefinition,\n copyListData,\n ListControlType,\n getListTranslatableData,\n mergeListTranslatedData,\n ListControlTranslationDto,\n} from './list'\nimport { NumberControlData, NumberControlDefinition } from './number'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport {\n ShapeControlData,\n ShapeControlDefinition,\n copyShapeData,\n ShapeControlType,\n getShapeTranslatableData,\n mergeShapeTranslatedData,\n ShapeControlTranslationDto,\n} from './shape'\nimport { TextAreaControlData, TextAreaControlDefinition, TextAreaControlType } from './text-area'\nimport {\n TextInputControlData,\n TextInputControlDefinition,\n TextInputControlType,\n} from './text-input'\nimport { copyStyleData, StyleControlData, StyleControlDefinition, StyleControlType } from './style'\nimport {\n copySlotData,\n mergeSlotControlTranslatedData,\n mergeSlotData,\n SlotControlData,\n SlotControlDefinition,\n SlotControlType,\n} from './slot'\n\nimport {\n Descriptor,\n GridValue,\n IndexSignatureHack,\n Types,\n mergeGridPropControllerTranslatedData,\n} from '../prop-controllers/descriptors'\nimport { Types as PropControllerTypes } from '@makeswift/prop-controllers'\nimport { copy as propControllerCopy } from '../prop-controllers/copy'\nimport { CopyContext, Data, MergeContext, MergeTranslatableDataContext } from '../state/react-page'\nimport {\n RichTextControlData,\n RichTextControlDefinition,\n RichTextControlType,\n copyRichTextData,\n richTextDTOtoDAO,\n} from './rich-text'\nimport { PropControllerDescriptor } from '../prop-controllers'\n\nimport { richTextV2DescendentsToData } from './rich-text-v2/dto'\nimport { copyRichTextV2Data } from './rich-text-v2/copy'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2ControlType,\n isRichTextV1Data,\n} from './rich-text-v2/rich-text-v2'\n\nimport { StyleV2ControlData, StyleV2ControlDefinition } from './style-v2'\nimport { IconRadioGroupControlData, IconRadioGroupControlDefinition } from './icon-radio-group'\nimport { TypographyControlData, TypographyControlDefinition } from './typography'\nimport {\n RichTextV2ControlTranslationDto,\n getRichTextV2TranslatableData,\n mergeRichTextV2TranslatedData,\n} from './rich-text-v2/translation'\n\nexport type ControlDefinition =\n | CheckboxControlDefinition\n | NumberControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition<any>\n | LinkControlDefinition\n | SlotControlDefinition\n | ShapeControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | TypographyControlDefinition\n\nexport type ControlDefinitionData<T extends ControlDefinition> = T extends CheckboxControlDefinition\n ? CheckboxControlData\n : T extends NumberControlDefinition\n ? NumberControlData\n : T extends TextInputControlDefinition\n ? TextInputControlData\n : T extends TextAreaControlDefinition\n ? TextAreaControlData\n : T extends SelectControlDefinition\n ? SelectControlData<T>\n : T extends ColorControlDefinition\n ? ColorControlData\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlData<T>\n : T extends ImageControlDefinition\n ? ImageControlData\n : T extends ComboboxControlDefinition\n ? ComboboxControlData<T>\n : T extends ShapeControlDefinition\n ? ShapeControlData<T>\n : T extends ListControlDefinition\n ? ListControlData<T>\n : T extends LinkControlDefinition\n ? LinkControlData\n : T extends RichTextControlDefinition\n ? IndexSignatureHack<RichTextControlData>\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlData\n : T extends StyleControlDefinition\n ? StyleControlData\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlData\n : T extends TypographyControlDefinition\n ? TypographyControlData\n : never\n\nexport function copy(definition: Descriptor | ControlDefinition, value: any, context: CopyContext) {\n switch (definition.type) {\n case Types.Backgrounds:\n case Types.Grid:\n case PropControllerTypes.NavigationLinks:\n case PropControllerTypes.Link:\n case PropControllerTypes.Shadows:\n case Types.Image:\n case Types.Images:\n case PropControllerTypes.ResponsiveColor:\n case Types.TableFormFields:\n case PropControllerTypes.Table:\n case PropControllerTypes.Border:\n case Types.RichText:\n case Types.ElementID:\n return propControllerCopy(definition, value, context)\n case RichTextControlType:\n return copyRichTextData(value, context)\n case RichTextV2ControlType:\n return copyRichTextV2Data(\n isRichTextV1Data(value) ? richTextV2DescendentsToData(richTextDTOtoDAO(value)) : value,\n context,\n )\n case ColorControlType:\n return copyColorData(value, context)\n case ImageControlType:\n return copyImageData(value, context)\n case LinkControlType:\n return copyLinkData(value, context)\n case ShapeControlType:\n return copyShapeData(definition, value, context)\n case ListControlType:\n return copyListData(definition, value, context)\n case StyleControlType:\n return copyStyleData(value, context)\n case SlotControlType:\n return copySlotData(value, context)\n default:\n return value\n }\n}\n\nexport function merge(\n definition: PropControllerDescriptor,\n a: Data,\n b: Data = a,\n context: MergeContext,\n): Data {\n switch (definition.type) {\n case SlotControlType:\n return mergeSlotData(a as SlotControlData, b as SlotControlData, context)\n\n default:\n return b\n }\n}\n\nexport function getTranslatableData(definition: Descriptor | ControlDefinition, data: Data): Data {\n switch (definition.type) {\n case Types.TextInput:\n case Types.TextArea:\n case TextInputControlType:\n case TextAreaControlType:\n return data\n\n case RichTextV2ControlType:\n const richTextData = data as RichTextV2ControlData | RichTextControlData\n\n if (isRichTextV1Data(richTextData)) return null\n\n return getRichTextV2TranslatableData(definition, richTextData as RichTextV2ControlData)\n\n case ListControlType:\n if (data == null) return null\n\n return getListTranslatableData(definition, data as ListControlData)\n\n case ShapeControlType:\n if (data == null) return null\n\n return getShapeTranslatableData(definition, data as ShapeControlData)\n\n default:\n return null\n }\n}\n\nexport function mergeTranslatedData(\n definition: PropControllerDescriptor,\n data: Data,\n translatedData: Data,\n context: MergeTranslatableDataContext,\n): Data {\n if (data == null) return data\n\n switch (definition.type) {\n case Types.TextInput:\n case Types.TextArea:\n case TextInputControlType:\n case TextAreaControlType:\n if (translatedData == null) return data\n\n return translatedData\n\n case Types.Grid:\n return mergeGridPropControllerTranslatedData(data as GridValue, context)\n\n case SlotControlType:\n return mergeSlotControlTranslatedData(data as SlotControlData, context)\n\n case RichTextV2ControlType:\n if (translatedData == null) return data\n\n return mergeRichTextV2TranslatedData(\n definition,\n data as RichTextV2ControlData,\n translatedData as RichTextV2ControlTranslationDto,\n )\n\n case ListControlType:\n if (translatedData == null) return data\n\n return mergeListTranslatedData(\n definition,\n data as ListControlData,\n translatedData as ListControlTranslationDto,\n context,\n )\n\n case ShapeControlType:\n if (translatedData == null) return data\n\n return mergeShapeTranslatedData(\n definition,\n data as ShapeControlData,\n translatedData as ShapeControlTranslationDto,\n context,\n )\n\n default:\n return data\n }\n}\n"],"mappings":"AACA,SAAmD,kBAAkB,qBAAqB;AAE1F,SAAmD,eAAe,wBAAwB;AAC1F,SAAiD,cAAc,uBAAuB;AACtF;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAyD,2BAA2B;AACpF;AAAA,EAGE;AAAA,OACK;AACP,SAAS,eAAyD,wBAAwB;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAEP;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,2BAA2B;AAC7C,SAAS,QAAQ,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;AAAA,EACX;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/control.ts"],"sourcesContent":["import { CheckboxControlData, CheckboxControlDefinition } from './checkbox'\nimport { ColorControlData, ColorControlDefinition, ColorControlType, copyColorData } from './color'\nimport { ComboboxControlData, ComboboxControlDefinition } from './combobox'\nimport { ImageControlData, ImageControlDefinition, copyImageData, ImageControlType } from './image'\nimport { LinkControlData, LinkControlDefinition, copyLinkData, LinkControlType } from './link'\nimport {\n ListControlData,\n ListControlDefinition,\n copyListData,\n ListControlType,\n getListTranslatableData,\n mergeListTranslatedData,\n ListControlTranslationDto,\n} from './list'\nimport { NumberControlData, NumberControlDefinition } from './number'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport {\n ShapeControlData,\n ShapeControlDefinition,\n copyShapeData,\n ShapeControlType,\n getShapeTranslatableData,\n mergeShapeTranslatedData,\n ShapeControlTranslationDto,\n} from './shape'\nimport { TextAreaControlData, TextAreaControlDefinition, TextAreaControlType } from './text-area'\nimport {\n TextInputControlData,\n TextInputControlDefinition,\n TextInputControlType,\n} from './text-input'\nimport { copyStyleData, StyleControlData, StyleControlDefinition, StyleControlType } from './style'\nimport {\n copySlotData,\n mergeSlotControlTranslatedData,\n mergeSlotData,\n SlotControlData,\n SlotControlDefinition,\n SlotControlType,\n} from './slot'\n\nimport {\n Descriptor,\n GridValue,\n IndexSignatureHack,\n Types,\n mergeGridPropControllerTranslatedData,\n} from '../prop-controllers/descriptors'\nimport { Types as PropControllerTypes } from '@makeswift/prop-controllers'\nimport { copy as propControllerCopy } from '../prop-controllers/copy'\nimport { CopyContext, Data, MergeContext, MergeTranslatableDataContext } from '../state/react-page'\nimport {\n RichTextControlData,\n RichTextControlDefinition,\n RichTextControlType,\n copyRichTextData,\n richTextDTOtoDAO,\n} from './rich-text'\nimport { PropControllerDescriptor } from '../prop-controllers'\n\nimport { richTextV2DescendentsToData } from './rich-text-v2/dto'\nimport { copyRichTextV2Data } from './rich-text-v2/copy'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2ControlType,\n isRichTextV1Data,\n} from './rich-text-v2/rich-text-v2'\n\nimport { StyleV2ControlData, StyleV2ControlDefinition } from './style-v2'\nimport { IconRadioGroupControlData, IconRadioGroupControlDefinition } from './icon-radio-group'\nimport { TypographyControlData, TypographyControlDefinition } from './typography'\nimport {\n RichTextV2ControlTranslationDto,\n getRichTextV2TranslatableData,\n mergeRichTextV2TranslatedData,\n} from './rich-text-v2/translation'\n\nexport type ControlDefinition =\n | CheckboxControlDefinition\n | NumberControlDefinition\n | TextInputControlDefinition\n | TextAreaControlDefinition\n | SelectControlDefinition\n | ColorControlDefinition\n | IconRadioGroupControlDefinition\n | ImageControlDefinition\n | ComboboxControlDefinition\n | ShapeControlDefinition\n | ListControlDefinition<any>\n | LinkControlDefinition\n | SlotControlDefinition\n | ShapeControlDefinition\n | RichTextControlDefinition\n | RichTextV2ControlDefinition\n | StyleControlDefinition\n | StyleV2ControlDefinition\n | TypographyControlDefinition\n\nexport type ControlDefinitionData<T extends ControlDefinition> = T extends CheckboxControlDefinition\n ? CheckboxControlData\n : T extends NumberControlDefinition\n ? NumberControlData\n : T extends TextInputControlDefinition\n ? TextInputControlData\n : T extends TextAreaControlDefinition\n ? TextAreaControlData\n : T extends SelectControlDefinition\n ? SelectControlData<T>\n : T extends ColorControlDefinition\n ? ColorControlData\n : T extends IconRadioGroupControlDefinition\n ? IconRadioGroupControlData<T>\n : T extends ImageControlDefinition\n ? ImageControlData\n : T extends ComboboxControlDefinition\n ? ComboboxControlData<T>\n : T extends ShapeControlDefinition\n ? ShapeControlData<T>\n : T extends ListControlDefinition\n ? ListControlData<T>\n : T extends LinkControlDefinition\n ? LinkControlData\n : T extends RichTextControlDefinition\n ? IndexSignatureHack<RichTextControlData>\n : T extends RichTextV2ControlDefinition\n ? RichTextV2ControlData\n : T extends StyleControlDefinition\n ? StyleControlData\n : T extends StyleV2ControlDefinition\n ? StyleV2ControlData\n : T extends TypographyControlDefinition\n ? TypographyControlData\n : never\n\nexport function copy(definition: Descriptor | ControlDefinition, value: any, context: CopyContext) {\n switch (definition.type) {\n case Types.Backgrounds:\n case Types.Grid:\n case PropControllerTypes.NavigationLinks:\n case PropControllerTypes.Link:\n case PropControllerTypes.Shadows:\n case Types.Image:\n case Types.Images:\n case PropControllerTypes.ResponsiveColor:\n case Types.TableFormFields:\n case PropControllerTypes.Table:\n case PropControllerTypes.Border:\n case Types.RichText:\n case Types.ElementID:\n return propControllerCopy(definition, value, context)\n case RichTextControlType:\n return copyRichTextData(value, context)\n case RichTextV2ControlType:\n return copyRichTextV2Data(\n isRichTextV1Data(value) ? richTextV2DescendentsToData(richTextDTOtoDAO(value)) : value,\n context,\n )\n case ColorControlType:\n return copyColorData(value, context)\n case ImageControlType:\n return copyImageData(value, context)\n case LinkControlType:\n return copyLinkData(value, context)\n case ShapeControlType:\n return copyShapeData(definition, value, context)\n case ListControlType:\n return copyListData(definition, value, context)\n case StyleControlType:\n return copyStyleData(value, context)\n case SlotControlType:\n return copySlotData(value, context)\n default:\n return value\n }\n}\n\nexport function merge(\n definition: PropControllerDescriptor,\n a: Data,\n b: Data = a,\n context: MergeContext,\n): Data {\n switch (definition.type) {\n case SlotControlType:\n return mergeSlotData(a as SlotControlData, b as SlotControlData, context)\n\n default:\n return b\n }\n}\n\nexport function getTranslatableData(definition: Descriptor | ControlDefinition, data: Data): Data {\n switch (definition.type) {\n case Types.TextInput:\n case PropControllerTypes.TextArea:\n case TextInputControlType:\n case TextAreaControlType:\n return data\n\n case RichTextV2ControlType:\n const richTextData = data as RichTextV2ControlData | RichTextControlData\n\n if (isRichTextV1Data(richTextData)) return null\n\n return getRichTextV2TranslatableData(definition, richTextData as RichTextV2ControlData)\n\n case ListControlType:\n if (data == null) return null\n\n return getListTranslatableData(definition, data as ListControlData)\n\n case ShapeControlType:\n if (data == null) return null\n\n return getShapeTranslatableData(definition, data as ShapeControlData)\n\n default:\n return null\n }\n}\n\nexport function mergeTranslatedData(\n definition: PropControllerDescriptor,\n data: Data,\n translatedData: Data,\n context: MergeTranslatableDataContext,\n): Data {\n if (data == null) return data\n\n switch (definition.type) {\n case Types.TextInput:\n case PropControllerTypes.TextArea:\n case TextInputControlType:\n case TextAreaControlType:\n if (translatedData == null) return data\n\n return translatedData\n\n case Types.Grid:\n return mergeGridPropControllerTranslatedData(data as GridValue, context)\n\n case SlotControlType:\n return mergeSlotControlTranslatedData(data as SlotControlData, context)\n\n case RichTextV2ControlType:\n if (translatedData == null) return data\n\n return mergeRichTextV2TranslatedData(\n definition,\n data as RichTextV2ControlData,\n translatedData as RichTextV2ControlTranslationDto,\n )\n\n case ListControlType:\n if (translatedData == null) return data\n\n return mergeListTranslatedData(\n definition,\n data as ListControlData,\n translatedData as ListControlTranslationDto,\n context,\n )\n\n case ShapeControlType:\n if (translatedData == null) return data\n\n return mergeShapeTranslatedData(\n definition,\n data as ShapeControlData,\n translatedData as ShapeControlTranslationDto,\n context,\n )\n\n default:\n return data\n }\n}\n"],"mappings":"AACA,SAAmD,kBAAkB,qBAAqB;AAE1F,SAAmD,eAAe,wBAAwB;AAC1F,SAAiD,cAAc,uBAAuB;AACtF;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAGP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAyD,2BAA2B;AACpF;AAAA,EAGE;AAAA,OACK;AACP,SAAS,eAAyD,wBAAwB;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAEP;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,2BAA2B;AAC7C,SAAS,QAAQ,0BAA0B;AAE3C;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,mCAAmC;AAC5C,SAAS,0BAA0B;AACnC;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAKP;AAAA,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K,MAAM;AAAA,IACX,KAAK,oBAAoB;AAAA,IACzB,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,YAAM,eAAe;AAErB,UAAI,iBAAiB,YAAY;AAAG,eAAO;AAE3C,aAAO,8BAA8B,YAAY,YAAqC;AAAA,IAExF,KAAK;AACH,UAAI,QAAQ;AAAM,eAAO;AAEzB,aAAO,wBAAwB,YAAY,IAAuB;AAAA,IAEpE,KAAK;AACH,UAAI,QAAQ;AAAM,eAAO;AAEzB,aAAO,yBAAyB,YAAY,IAAwB;AAAA,IAEtE;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,oBACd,YACA,MACA,gBACA,SACM;AACN,MAAI,QAAQ;AAAM,WAAO;AAEzB,UAAQ,WAAW,MAAM;AAAA,IACvB,KAAK,MAAM;AAAA,IACX,KAAK,oBAAoB;AAAA,IACzB,KAAK;AAAA,IACL,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,aAAO;AAAA,IAET,KAAK,MAAM;AACT,aAAO,sCAAsC,MAAmB,OAAO;AAAA,IAEzE,KAAK;AACH,aAAO,+BAA+B,MAAyB,OAAO;AAAA,IAExE,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","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.
|
|
16
|
+
version: "0.16.0-canary.5",
|
|
17
17
|
previewMode: supportsPreviewMode,
|
|
18
18
|
draftMode: supportsDraftMode,
|
|
19
19
|
interactionMode: true,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/deleted.ts"],"sourcesContent":["import { Data, DescriptorValueType, PanelDescriptor } from './descriptors'\n\nexport const DELETED_PROP_CONTROLLER_TYPES = {\n List: 'List',\n Shape: 'Shape',\n Typeahead: 'Typeahead',\n} as const\n\nexport type DeletedPropControllerDescriptor<T extends Data = Data> =\n | ListDescriptor<T extends ListValue ? T : ListValue>\n | ShapeDescriptor<T extends ShapeValue ? T : ShapeValue, any>\n | TypeaheadDescriptor<T extends TypeaheadValue ? T : TypeaheadValue>\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 DELETED_PROP_CONTROLLER_TYPES.List\n options: ListOptions<T extends ListValue<infer U> ? U : never>\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 DELETED_PROP_CONTROLLER_TYPES.Shape\n options: ShapeOptions<U>\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 DELETED_PROP_CONTROLLER_TYPES.Typeahead\n options: TypeaheadOptions<T extends TypeaheadValue<infer U> ? U : never>\n}\n"],"mappings":"AAEO,MAAM,gCAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AACb;","names":[]}
|
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
import { StyleControlType } from "../controls/style";
|
|
2
|
-
import {
|
|
3
|
-
getElementChildren,
|
|
4
|
-
getFileIds,
|
|
5
|
-
getPageIds,
|
|
6
|
-
getSwatchIds,
|
|
7
|
-
getTypographyIds
|
|
8
|
-
} from "./introspection";
|
|
9
2
|
const Types = {
|
|
10
3
|
Backgrounds: "Backgrounds",
|
|
11
4
|
ElementID: "ElementID",
|
|
12
|
-
GapX: "GapX",
|
|
13
|
-
GapY: "GapY",
|
|
14
5
|
Grid: "Grid",
|
|
15
6
|
Image: "Image",
|
|
16
7
|
Images: "Images",
|
|
17
|
-
List: "List",
|
|
18
8
|
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
19
9
|
ResponsiveNumber: "ResponsiveNumber",
|
|
20
10
|
ResponsiveOpacity: "ResponsiveOpacity",
|
|
21
11
|
ResponsiveSelect: "ResponsiveSelect",
|
|
22
12
|
RichText: "RichText",
|
|
23
|
-
Shape: "Shape",
|
|
24
13
|
SocialLinks: "SocialLinks",
|
|
25
14
|
TableFormFields: "TableFormFields",
|
|
26
|
-
Typeahead: "Typeahead",
|
|
27
|
-
TextArea: "TextArea",
|
|
28
15
|
TextInput: "TextInput",
|
|
29
16
|
Style: StyleControlType
|
|
30
17
|
};
|
|
@@ -34,12 +21,6 @@ function Backgrounds(options = {}) {
|
|
|
34
21
|
function ElementID(options = {}) {
|
|
35
22
|
return { type: Types.ElementID, options };
|
|
36
23
|
}
|
|
37
|
-
function GapX(options = {}) {
|
|
38
|
-
return { type: Types.GapX, options };
|
|
39
|
-
}
|
|
40
|
-
function GapY(options = {}) {
|
|
41
|
-
return { type: Types.GapY, options };
|
|
42
|
-
}
|
|
43
24
|
function Grid(options = {}) {
|
|
44
25
|
return { type: Types.Grid, options };
|
|
45
26
|
}
|
|
@@ -55,29 +36,6 @@ function Image(options = {}) {
|
|
|
55
36
|
function Images(options = {}) {
|
|
56
37
|
return { type: Types.Images, version: 1, options };
|
|
57
38
|
}
|
|
58
|
-
function List(options) {
|
|
59
|
-
return { type: Types.List, options };
|
|
60
|
-
}
|
|
61
|
-
function introspectListPropControllerData(descriptor, value, func) {
|
|
62
|
-
if (value == null)
|
|
63
|
-
return [];
|
|
64
|
-
return value.flatMap((item) => item.value ? func(descriptor.options.type, item.value) : []);
|
|
65
|
-
}
|
|
66
|
-
function getListPropControllerElementChildren(descriptor, value) {
|
|
67
|
-
return introspectListPropControllerData(descriptor, value, getElementChildren);
|
|
68
|
-
}
|
|
69
|
-
function getListPropControllerSwatchIds(descriptor, value) {
|
|
70
|
-
return introspectListPropControllerData(descriptor, value, getSwatchIds);
|
|
71
|
-
}
|
|
72
|
-
function getListPropControllerFileIds(descriptor, value) {
|
|
73
|
-
return introspectListPropControllerData(descriptor, value, getFileIds);
|
|
74
|
-
}
|
|
75
|
-
function getListPropControllerTypographyIds(descriptor, value) {
|
|
76
|
-
return introspectListPropControllerData(descriptor, value, getTypographyIds);
|
|
77
|
-
}
|
|
78
|
-
function getListPropControllerPageIds(descriptor, value) {
|
|
79
|
-
return introspectListPropControllerData(descriptor, value, getPageIds);
|
|
80
|
-
}
|
|
81
39
|
function ResponsiveIconRadioGroup(options) {
|
|
82
40
|
return { type: Types.ResponsiveIconRadioGroup, options };
|
|
83
41
|
}
|
|
@@ -93,31 +51,6 @@ function ResponsiveSelect(options) {
|
|
|
93
51
|
function RichText(options = {}) {
|
|
94
52
|
return { type: Types.RichText, options };
|
|
95
53
|
}
|
|
96
|
-
function Shape(options) {
|
|
97
|
-
return { type: Types.Shape, options };
|
|
98
|
-
}
|
|
99
|
-
function introspectShapePropControllerData(descriptor, value, func) {
|
|
100
|
-
if (value == null)
|
|
101
|
-
return [];
|
|
102
|
-
return Object.entries(descriptor.options.type).flatMap(
|
|
103
|
-
([key, definition]) => func(definition, value[key])
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
function getShapePropControllerElementChildren(descriptor, value) {
|
|
107
|
-
return introspectShapePropControllerData(descriptor, value, getElementChildren);
|
|
108
|
-
}
|
|
109
|
-
function getShapePropControllerFileIds(descriptor, value) {
|
|
110
|
-
return introspectShapePropControllerData(descriptor, value, getFileIds);
|
|
111
|
-
}
|
|
112
|
-
function getShapePropControllerTypographyIds(descriptor, value) {
|
|
113
|
-
return introspectShapePropControllerData(descriptor, value, getTypographyIds);
|
|
114
|
-
}
|
|
115
|
-
function getShapePropControllerPageIds(descriptor, value) {
|
|
116
|
-
return introspectShapePropControllerData(descriptor, value, getPageIds);
|
|
117
|
-
}
|
|
118
|
-
function getShapePropControllerSwatchIds(descriptor, value) {
|
|
119
|
-
return introspectShapePropControllerData(descriptor, value, getSwatchIds);
|
|
120
|
-
}
|
|
121
54
|
const socialLinkTypesV0 = [
|
|
122
55
|
"angellist",
|
|
123
56
|
"codepen",
|
|
@@ -150,48 +83,24 @@ function SocialLinks(options = {}) {
|
|
|
150
83
|
function TableFormFields(options = {}) {
|
|
151
84
|
return { type: Types.TableFormFields, options };
|
|
152
85
|
}
|
|
153
|
-
function Typeahead(options) {
|
|
154
|
-
return { type: Types.Typeahead, options };
|
|
155
|
-
}
|
|
156
|
-
function TextArea(options = {}) {
|
|
157
|
-
return { type: Types.TextArea, options };
|
|
158
|
-
}
|
|
159
86
|
function TextInput(options = {}) {
|
|
160
87
|
return { type: Types.TextInput, options };
|
|
161
88
|
}
|
|
162
89
|
export {
|
|
163
90
|
Backgrounds,
|
|
164
91
|
ElementID,
|
|
165
|
-
GapX,
|
|
166
|
-
GapY,
|
|
167
92
|
Grid,
|
|
168
93
|
Image,
|
|
169
94
|
Images,
|
|
170
|
-
List,
|
|
171
95
|
ResponsiveIconRadioGroup,
|
|
172
96
|
ResponsiveNumber,
|
|
173
97
|
ResponsiveOpacity,
|
|
174
98
|
ResponsiveSelect,
|
|
175
99
|
RichText,
|
|
176
|
-
Shape,
|
|
177
100
|
SocialLinks,
|
|
178
101
|
TableFormFields,
|
|
179
|
-
TextArea,
|
|
180
102
|
TextInput,
|
|
181
|
-
Typeahead,
|
|
182
103
|
Types,
|
|
183
|
-
getListPropControllerElementChildren,
|
|
184
|
-
getListPropControllerFileIds,
|
|
185
|
-
getListPropControllerPageIds,
|
|
186
|
-
getListPropControllerSwatchIds,
|
|
187
|
-
getListPropControllerTypographyIds,
|
|
188
|
-
getShapePropControllerElementChildren,
|
|
189
|
-
getShapePropControllerFileIds,
|
|
190
|
-
getShapePropControllerPageIds,
|
|
191
|
-
getShapePropControllerSwatchIds,
|
|
192
|
-
getShapePropControllerTypographyIds,
|
|
193
|
-
introspectListPropControllerData,
|
|
194
|
-
introspectShapePropControllerData,
|
|
195
104
|
mergeGridPropControllerTranslatedData,
|
|
196
105
|
socialLinkTypesV0,
|
|
197
106
|
socialLinkTypesV1
|
|
@@ -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 ResolveLinkPropControllerValue,\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 TextStyleDescriptor,\n ResolveTextStylePropControllerValue,\n NavigationLinksDescriptor,\n ResolveNavigationLinksPropControllerValue,\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 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\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 PropControllerTypes.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 ? ResolveLinkPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Link }>>\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.NavigationLinks\n ? ResolveNavigationLinksPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.NavigationLinks }>\n >\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;AAAA,EACA;AAAA,OACK;AAmFA,MAAM,QAAQ;AAAA,EACnB,aAAa;AAAA,E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F;AAEO,SAAS,sCACd,YACA,OACW;AACX,SAAO,kCAAkC,YAAY,OAAO,kBAAkB;AAChF;AAEO,SAAS,8BACd,YACA,OACU;AACV,SAAO,kCAAkC,YAAY,OAAO,UAAU;AACxE;AAEO,SAAS,oCACd,YACA,OACU;AACV,SAAO,kCAAkC,YAAY,OAAO,gBAAgB;AAC9E;AAEO,SAAS,8BACd,YACA,OACU;AACV,SAAO,kCAAkC,YAAY,OAAO,UAAU;AACxE;AAEO,SAAS,gCACd,YACA,OACU;AACV,SAAO,kCAAkC,YAAY,OAAO,YAAY;AAC1E;AAEO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,oBAAoB,CAAC,GAAG,mBAAmB,KAAK,OAAO;AA8B7D,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,SAAS,EAAE;AACxD;AA8BO,SAAS,gBAAgB,UAAkC,CAAC,GAA8B;AAC/F,SAAO,EAAE,MAAM,MAAM,iBAAiB,QAAQ;AAChD;AAwBO,SAAS,UACd,SACwC;AACxC,SAAO,EAAE,MAAM,MAAM,WAAW,QAAQ;AAC1C;AAeO,SAAS,SAAS,UAA2B,CAAC,GAAuB;AAC1E,SAAO,EAAE,MAAM,MAAM,UAAU,QAAQ;AACzC;AAeO,SAAS,UAAU,UAA4B,CAAC,GAAwB;AAC7E,SAAO,EAAE,MAAM,MAAM,WAAW,QAAQ;AAC1C;","names":[]}
|
|
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 BorderDescriptor,\n CheckboxDescriptor,\n LinkData,\n LinkDescriptor,\n ResolveLinkPropControllerValue,\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 TextStyleDescriptor,\n ResolveTextStylePropControllerValue,\n NavigationLinksDescriptor,\n ResolveNavigationLinksPropControllerValue,\n TextAreaDescriptor,\n ResolveTextAreaPropControllerValue,\n ResolveGapXPropControllerValue,\n GapXDescriptor,\n ResolveGapYPropControllerValue,\n GapYDescriptor,\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 Grid: 'Grid',\n Image: 'Image',\n Images: 'Images',\n ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveNumber: 'ResponsiveNumber',\n ResponsiveOpacity: 'ResponsiveOpacity',\n ResponsiveSelect: 'ResponsiveSelect',\n RichText: 'RichText',\n SocialLinks: 'SocialLinks',\n TableFormFields: 'TableFormFields',\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\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\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 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 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 | 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 | SocialLinksDescriptor<T>\n | TableDescriptor<T>\n | TableFormFieldsDescriptor<T>\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 PropControllerTypes.GapY\n | typeof PropControllerTypes.GapX\n | typeof PropControllerTypes.BorderRadius\n | typeof PropControllerTypes.Checkbox\n | typeof Types.TextInput\n | typeof PropControllerTypes.Link\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 PropControllerTypes.TextArea\n | typeof PropControllerTypes.Table\n | typeof Types.RichText\n | typeof Types.Image\n | typeof Types.ResponsiveOpacity\n | typeof Types.SocialLinks\n | typeof PropControllerTypes.Video\n | typeof PropControllerTypes.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.GapX\n ? ResolveGapXPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapX }>>\n : T['type'] extends typeof PropControllerTypes.GapY\n ? ResolveGapYPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapY }>>\n : T['type'] extends typeof PropControllerTypes.Link\n ? ResolveLinkPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Link }>>\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.NavigationLinks\n ? ResolveNavigationLinksPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.NavigationLinks }>\n >\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.TextArea\n ? ResolveTextAreaPropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextArea }>>\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;AA4H1B,MAAM,QAAQ;AAAA,EACnB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AA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;AACzC;AAEO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,oBAAoB,CAAC,GAAG,mBAAmB,KAAK,OAAO;AA8B7D,SAAS,YAAY,UAA8B,CAAC,GAA0B;AACnF,SAAO,EAAE,MAAM,MAAM,aAAa,SAAS,SAAS,EAAE;AACxD;AA8BO,SAAS,gBAAgB,UAAkC,CAAC,GAA8B;AAC/F,SAAO,EAAE,MAAM,MAAM,iBAAiB,QAAQ;AAChD;AAeO,SAAS,UAAU,UAA4B,CAAC,GAAwB;AAC7E,SAAO,EAAE,MAAM,MAAM,WAAW,QAAQ;AAC1C;","names":[]}
|
|
@@ -5,7 +5,9 @@ import * as Introspection from "./introspection";
|
|
|
5
5
|
import { copy } from "./copy/image";
|
|
6
6
|
import { copy as copy2 } from "./copy/images";
|
|
7
7
|
import { copy as copy3 } from "./copy/backgrounds";
|
|
8
|
+
import { DELETED_PROP_CONTROLLER_TYPES } from "./deleted";
|
|
8
9
|
export {
|
|
10
|
+
DELETED_PROP_CONTROLLER_TYPES,
|
|
9
11
|
Introspection,
|
|
10
12
|
Props,
|
|
11
13
|
RichTextPropControllerMessageType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/index.ts"],"sourcesContent":["export type {\n Data,\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/index.ts"],"sourcesContent":["export type {\n Data,\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n ResponsiveNumberDescriptor,\n ResponsiveNumberOptions,\n ResponsiveNumberValue,\n ResponsiveIconRadioGroupDescriptor,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectDescriptor,\n ResponsiveSelectValue,\n ImageDescriptor,\n ImageValue,\n ImageValueV0,\n ImageValueV1,\n ImagesDescriptor,\n ImagesValueV0Item,\n ImagesValueV1Item,\n ImagesValueItem,\n ImagesValue,\n ImageBackground,\n BackgroundsDescriptor,\n BackgroundImage,\n RichTextDescriptor,\n RichTextValue,\n TextInputDescriptor,\n TextInputValue,\n PanelDescriptor,\n PanelDescriptorType,\n PanelDescriptorValueType,\n SocialLinksDescriptor,\n SocialLinksValue,\n} from './descriptors'\nexport type {\n ResponsiveValueType,\n Device,\n DeviceOverride,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\nexport { socialLinkTypesV0, socialLinkTypesV1 } from './descriptors'\nexport * as Props from './descriptors'\nexport type {\n PropControllerMessage,\n RichTextPropControllerMessage,\n TableFormFieldsMessage,\n} from './instances'\nexport { RichTextPropControllerMessageType, TableFormFieldsMessageType } from './instances'\nexport * as Introspection from './introspection'\nexport { copy as imageCopy } from './copy/image'\nexport { copy as imagesCopy } from './copy/images'\nexport { copy as backgroundsCopy } from './copy/backgrounds'\nexport { DELETED_PROP_CONTROLLER_TYPES } from './deleted'\n"],"mappings":"AAuCA,SAAS,mBAAmB,yBAAyB;AACrD,YAAY,WAAW;AAMvB,SAAS,mCAAmC,kCAAkC;AAC9E,YAAY,mBAAmB;AAC/B,SAAiB,YAAiB;AAClC,SAAiB,QAARA,aAA0B;AACnC,SAAiB,QAARA,aAA+B;AACxC,SAAS,qCAAqC;","names":["copy"]}
|