@makeswift/runtime 0.18.0-canary.3 → 0.18.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 +2 -2
- package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
- package/dist/cjs/components/builtin/Button/register.js +1 -1
- package/dist/cjs/components/builtin/Button/register.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/cjs/components/builtin/Countdown/register.js +4 -4
- package/dist/cjs/components/builtin/Countdown/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/Image/Image.js.map +1 -1
- package/dist/cjs/components/builtin/Image/register.js +13 -14
- package/dist/cjs/components/builtin/Image/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/SocialLinks/register.js +16 -6
- package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/cjs/components/hooks/useTextInputPropControllerData.js +32 -0
- package/dist/cjs/components/hooks/useTextInputPropControllerData.js.map +1 -0
- package/dist/cjs/controls/control.js +2 -3
- 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/descriptors.js +2 -50
- package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
- package/dist/cjs/prop-controllers/index.js +2 -7
- package/dist/cjs/prop-controllers/index.js.map +1 -1
- package/dist/cjs/runtimes/react/controls.js +26 -0
- package/dist/cjs/runtimes/react/controls.js.map +1 -1
- package/dist/esm/builder/serialization/control-serialization.js +2 -2
- package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
- package/dist/esm/components/builtin/Button/register.js +2 -1
- package/dist/esm/components/builtin/Button/register.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
- package/dist/esm/components/builtin/Countdown/register.js +5 -4
- package/dist/esm/components/builtin/Countdown/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/Image/Image.js.map +1 -1
- package/dist/esm/components/builtin/Image/register.js +5 -4
- package/dist/esm/components/builtin/Image/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/SocialLinks/register.js +25 -7
- package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
- package/dist/esm/components/hooks/useTextInputPropControllerData.js +10 -0
- package/dist/esm/components/hooks/useTextInputPropControllerData.js.map +1 -0
- package/dist/esm/controls/control.js +2 -3
- 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/descriptors.js +1 -44
- package/dist/esm/prop-controllers/descriptors.js.map +1 -1
- package/dist/esm/prop-controllers/index.js +1 -4
- package/dist/esm/prop-controllers/index.js.map +1 -1
- package/dist/esm/runtimes/react/controls.js +36 -2
- package/dist/esm/runtimes/react/controls.js.map +1 -1
- package/dist/types/builder/serialization/control-serialization.d.ts +5 -4
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
- package/dist/types/components/builtin/Button/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/Countdown.d.ts +5 -5
- 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/Form/Form.d.ts +2 -2
- 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/Image/Image.d.ts +2 -3
- package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/components/builtin/Image/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/Navigation.d.ts +2 -2
- 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/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/components/hooks/useTextInputPropControllerData.d.ts +3 -0
- package/dist/types/components/hooks/useTextInputPropControllerData.d.ts.map +1 -0
- package/dist/types/controls/control.d.ts.map +1 -1
- package/dist/types/next/components/tests/page-responsive-opacity-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-responsive-opacity-prop-controller.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-social-links-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-social-links-prop-controller.test.d.ts.map +1 -0
- package/dist/types/next/components/tests/page-text-input-prop-controller.test.d.ts +3 -0
- package/dist/types/next/components/tests/page-text-input-prop-controller.test.d.ts.map +1 -0
- package/dist/types/prop-controllers/descriptors.d.ts +8 -75
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/prop-controllers/index.d.ts +1 -2
- package/dist/types/prop-controllers/index.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Form/register.ts"],"sourcesContent":["import { Props, ResponsiveSelectValue } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { Alignments, Contrast, Contrasts, Shapes, Sizes } from './context/FormContext'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ElementID,\n GapY,\n Link,\n Margin,\n ResponsiveColor,\n ResponsiveLength,\n Table,\n TableFormFields,\n TextStyle,\n Width,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Form')),\n {\n type: MakeswiftComponentType.Form,\n label: 'Form',\n icon: ComponentIcon.Form,\n props: {\n id: ElementID(),\n tableId: Table(),\n fields: TableFormFields(),\n submitLink: Link(props => ({\n label: 'Redirect to',\n // TODO: This option is hardcoded. We should import it from LinkPanelOptions\n options: [\n { value: 'OPEN_PAGE', label: 'Open page' },\n { value: 'OPEN_URL', label: 'Open URL' },\n ],\n hidden: props.tableId == null,\n })),\n gap: GapY(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Gap',\n defaultValue: { value: 0, unit: 'px' },\n hidden: props.tableId == null,\n })),\n shape: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Shape',\n options: [\n { label: 'Pill', value: Shapes.PILL, icon: 'ButtonPill16' },\n { label: 'Rounded', value: Shapes.ROUNDED, icon: 'ButtonRounded16' },\n { label: 'Square', value: Shapes.SQUARE, icon: 'ButtonSquare16' },\n ],\n defaultValue: Shapes.ROUNDED,\n hidden: props.tableId == null,\n })),\n size: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Size',\n options: [\n { label: 'Small', value: Sizes.SMALL, icon: 'SizeSmall16' },\n { label: 'Medium', value: Sizes.MEDIUM, icon: 'SizeMedium16' },\n { label: 'Large', value: Sizes.LARGE, icon: 'SizeLarge16' },\n ],\n defaultValue: Sizes.MEDIUM,\n hidden: props?.tableId == null,\n })),\n contrast: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Color',\n options: [\n { label: 'Light mode', value: Contrasts.LIGHT, icon: 'Sun16' },\n { label: 'Dark mode', value: Contrasts.DARK, icon: 'Moon16' },\n ],\n defaultValue: Contrasts.LIGHT,\n hidden: props.tableId == null,\n })),\n labelTextStyle: TextStyle({ label: 'Label text style' }),\n labelTextColor: ResponsiveColor((props, device) => {\n const hidden = props.tableId == null\n const responsiveContrast = props.contrast as ResponsiveSelectValue<Contrast> | undefined\n const contrast = findBreakpointOverride<Contrast>(\n runtime.getBreakpoints(),\n responsiveContrast,\n device,\n )\n\n return {\n hidden,\n label: 'Label text color',\n placeholder:\n contrast?.value === Contrasts.DARK ? 'rgba(255,255,255,0.95)' : 'rgba(0,0,0,0.8)',\n }\n }),\n submitTextStyle: TextStyle({ label: 'Button text style' }),\n brandColor: ResponsiveColor(props => ({\n label: 'Button color',\n placeholder: 'black',\n hidden: props.tableId == null,\n // TODO: Add hideAlphaSlider\n })),\n submitTextColor: ResponsiveColor(props => ({\n label: 'Button text color',\n placeholder: 'white',\n hidden: props.tableId == null,\n })),\n submitLabel:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Form/register.ts"],"sourcesContent":["import { Props, ResponsiveSelectValue } from '../../../prop-controllers'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { Alignments, Contrast, Contrasts, Shapes, Sizes } from './context/FormContext'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ElementID,\n GapY,\n Link,\n Margin,\n ResponsiveColor,\n ResponsiveLength,\n Table,\n TableFormFields,\n TextInput,\n TextStyle,\n Width,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Form')),\n {\n type: MakeswiftComponentType.Form,\n label: 'Form',\n icon: ComponentIcon.Form,\n props: {\n id: ElementID(),\n tableId: Table(),\n fields: TableFormFields(),\n submitLink: Link(props => ({\n label: 'Redirect to',\n // TODO: This option is hardcoded. We should import it from LinkPanelOptions\n options: [\n { value: 'OPEN_PAGE', label: 'Open page' },\n { value: 'OPEN_URL', label: 'Open URL' },\n ],\n hidden: props.tableId == null,\n })),\n gap: GapY(props => ({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Gap',\n defaultValue: { value: 0, unit: 'px' },\n hidden: props.tableId == null,\n })),\n shape: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Shape',\n options: [\n { label: 'Pill', value: Shapes.PILL, icon: 'ButtonPill16' },\n { label: 'Rounded', value: Shapes.ROUNDED, icon: 'ButtonRounded16' },\n { label: 'Square', value: Shapes.SQUARE, icon: 'ButtonSquare16' },\n ],\n defaultValue: Shapes.ROUNDED,\n hidden: props.tableId == null,\n })),\n size: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Size',\n options: [\n { label: 'Small', value: Sizes.SMALL, icon: 'SizeSmall16' },\n { label: 'Medium', value: Sizes.MEDIUM, icon: 'SizeMedium16' },\n { label: 'Large', value: Sizes.LARGE, icon: 'SizeLarge16' },\n ],\n defaultValue: Sizes.MEDIUM,\n hidden: props?.tableId == null,\n })),\n contrast: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Color',\n options: [\n { label: 'Light mode', value: Contrasts.LIGHT, icon: 'Sun16' },\n { label: 'Dark mode', value: Contrasts.DARK, icon: 'Moon16' },\n ],\n defaultValue: Contrasts.LIGHT,\n hidden: props.tableId == null,\n })),\n labelTextStyle: TextStyle({ label: 'Label text style' }),\n labelTextColor: ResponsiveColor((props, device) => {\n const hidden = props.tableId == null\n const responsiveContrast = props.contrast as ResponsiveSelectValue<Contrast> | undefined\n const contrast = findBreakpointOverride<Contrast>(\n runtime.getBreakpoints(),\n responsiveContrast,\n device,\n )\n\n return {\n hidden,\n label: 'Label text color',\n placeholder:\n contrast?.value === Contrasts.DARK ? 'rgba(255,255,255,0.95)' : 'rgba(0,0,0,0.8)',\n }\n }),\n submitTextStyle: TextStyle({ label: 'Button text style' }),\n brandColor: ResponsiveColor(props => ({\n label: 'Button color',\n placeholder: 'black',\n hidden: props.tableId == null,\n // TODO: Add hideAlphaSlider\n })),\n submitTextColor: ResponsiveColor(props => ({\n label: 'Button text color',\n placeholder: 'white',\n hidden: props.tableId == null,\n })),\n submitLabel: TextInput(props => ({\n label: 'Button label',\n placeholder: 'Submit',\n hidden: props.tableId == null,\n })),\n submitVariant: Props.ResponsiveSelect(props => ({\n label: 'Button style',\n options: [\n { value: 'flat', label: 'Flat' },\n { value: 'outline', label: 'Outline' },\n { value: 'shadow', label: 'Floating' },\n { value: 'clear', label: 'Clear' },\n { value: 'blocky', label: 'Blocky' },\n { value: 'bubbly', label: 'Bubbly' },\n { value: 'skewed', label: 'Skewed' },\n ],\n defaultValue: 'flat',\n hidden: props.tableId == null,\n })),\n submitWidth: ResponsiveLength(props => ({\n label: 'Button width',\n hidden: props.tableId == null,\n // TODO: Add placeholder: { value: 'auto' }\n })),\n submitAlignment: Props.ResponsiveIconRadioGroup(props => ({\n label: 'Button alignment',\n options: [\n { label: 'Left', value: Alignments.LEFT, icon: 'AlignLeft16' },\n { label: 'Center', value: Alignments.CENTER, icon: 'AlignCenter16' },\n { label: 'Right', value: Alignments.RIGHT, icon: 'AlignRight16' },\n ],\n defaultValue: Alignments.CENTER,\n hidden: props.tableId == null,\n })),\n width: Width({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 550, unit: 'px' },\n },\n ],\n defaultValue: { value: 100, unit: '%' },\n format: Width.Format.ClassName,\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6C;AAE7C,yBAA0D;AAC1D,uBAAuC;AACvC,yBAA+D;AAC/D,6BAA8B;AAC9B,IAAAA,gBAAqB;AACr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,+BAAM,OAAO;AAAA,QACvB,CAAC;AAAA,QACD,YAAQ,iCAAO,EAAE,QAAQ,gCAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":["import_react","import_prop_controllers"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Image/Image.tsx"],"sourcesContent":["'use client'\n\nimport { useState, useEffect, Ref, forwardRef } from 'react'\nimport NextImage from 'next/image'\nimport type NextLegacyImageType from 'next/legacy/image'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Image/Image.tsx"],"sourcesContent":["'use client'\n\nimport { useState, useEffect, Ref, forwardRef } from 'react'\nimport NextImage from 'next/image'\nimport type NextLegacyImageType from 'next/legacy/image'\n\nimport {\n LinkData,\n ResponsiveLengthData,\n ImageData,\n ResponsiveOpacityValue,\n} from '@makeswift/prop-controllers'\nimport { Breakpoints, findBreakpointOverride } from '../../../state/modules/breakpoints'\nimport { placeholders } from '../../utils/placeholders'\nimport { Link } from '../../shared/Link'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveWidth } from '../../utils/responsive-style'\nimport { useFile } from '../../../runtimes/react/hooks/makeswift-api'\nimport { major as nextMajorVersion } from '../../../next/next-version'\nimport { useBreakpoints } from '../../../runtimes/react'\nimport { match, P } from 'ts-pattern'\n\nconst NextLegacyImage = NextImage as typeof NextLegacyImageType\n\ntype Props = {\n id?: string\n file?: ImageData\n altText?: string\n link?: LinkData\n width?: ResponsiveLengthData\n margin?: string\n padding?: string\n border?: string\n borderRadius?: string\n boxShadow?: string\n opacity?: ResponsiveOpacityValue\n placeholder?: { src: string; dimensions: { width: number; height: number } }\n className?: string\n priority?: boolean\n}\n\nfunction loadImage(src: string): Promise<HTMLImageElement> {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image()\n\n image.onload = () => resolve(image)\n image.onerror = reject\n image.src = src\n })\n}\n\nfunction imageSizes(breakpoints: Breakpoints, width?: Props['width']): string {\n const baseDevice = breakpoints.find(breakpoint => breakpoint.maxWidth == null)\n const baseWidth = baseDevice && width && findBreakpointOverride(breakpoints, width, baseDevice.id)\n const baseWidthSize =\n baseWidth == null || baseWidth.value.unit !== 'px' ? '100vw' : `${baseWidth.value.value}px`\n\n return breakpoints\n .map(breakpoint => {\n const override = findBreakpointOverride(breakpoints, width, breakpoint.id)\n\n if (override == null || breakpoint.maxWidth == null || override.value.unit !== 'px') {\n return null\n }\n\n return `(max-width: ${breakpoint.maxWidth}px) ${Math.min(\n breakpoint.maxWidth,\n override.value.value,\n )}px`\n })\n .filter((size): size is NonNullable<typeof size> => size != null)\n .reduce((sourceSizes, sourceSize) => `${sourceSize}, ${sourceSizes}`, baseWidthSize)\n}\n\ntype Dimensions = {\n width: number\n height: number\n}\n\nconst ImageComponent = forwardRef(function Image(\n {\n id,\n width,\n margin,\n padding,\n file,\n border,\n borderRadius,\n altText,\n link,\n opacity,\n boxShadow,\n placeholder = placeholders.image,\n className,\n priority,\n }: Props,\n ref: Ref<HTMLAnchorElement & HTMLDivElement>,\n) {\n const fileId = match(file)\n .with(P.string, v => v)\n .with({ type: 'makeswift-file', version: 1 }, v => v.id)\n .otherwise(() => null)\n const fileData = useFile(fileId)\n const imageSrc = match([file, fileData])\n .with([P.any, P.not(P.nullish)], ([, fileData]) => fileData.publicUrl)\n .with([{ type: 'external-file', version: 1 }, P.any], ([file]) => file.url)\n .otherwise(() => placeholder.src)\n const dataDimensions = match([file, fileData, imageSrc])\n .with(\n [{ type: 'external-file', version: 1, width: P.number, height: P.number }, P.any, P.any],\n ([externalFile]) => ({ width: externalFile.width, height: externalFile.height }),\n )\n .with([P.any, P.not(P.nullish), P.any], ([, data]) => data.dimensions)\n .with([P.any, P.any, placeholder.src], () => placeholder.dimensions)\n .otherwise(() => null)\n const [measuredDimensions, setMeasuredDimensions] = useState<Dimensions | null>(null)\n const breakpoints = useBreakpoints()\n\n useEffect(() => {\n if (dataDimensions) return\n\n let cleanedUp = false\n\n loadImage(imageSrc)\n .then(image => {\n if (!cleanedUp) {\n setMeasuredDimensions({ width: image.naturalWidth, height: image.naturalHeight })\n }\n })\n .catch(console.error)\n\n return () => {\n cleanedUp = true\n }\n }, [dataDimensions, imageSrc])\n\n const dimensions = dataDimensions ?? measuredDimensions\n const Container = link ? Link : 'div'\n const containerClassName = cx(\n useStyle({ lineHeight: 0, overflow: 'hidden' }),\n useStyle(useResponsiveWidth(width, dimensions?.width)),\n useStyle(useResponsiveStyle([opacity] as const, ([opacity = 1]) => ({ opacity }))),\n margin,\n padding,\n border,\n borderRadius,\n boxShadow,\n className,\n )\n\n if (!dimensions) return null\n\n return (\n <Container link={link} ref={ref} id={id} className={containerClassName}>\n {nextMajorVersion < 13 ? (\n <NextLegacyImage\n layout=\"responsive\"\n src={imageSrc}\n sizes={imageSizes(breakpoints, width)}\n alt={altText}\n width={dimensions.width}\n height={dimensions.height}\n priority={priority}\n />\n ) : (\n <NextImage\n src={imageSrc}\n priority={priority}\n sizes={imageSizes(breakpoints, width)}\n alt={altText ?? ''}\n width={dimensions.width}\n height={dimensions.height}\n style={{\n width: '100%',\n height: 'auto',\n }}\n />\n )}\n </Container>\n )\n})\n\nexport default ImageComponent\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4JQ;AA1JR,mBAAqD;AACrD,mBAAsB;AAStB,yBAAoD;AACpD,0BAA6B;AAC7B,kBAAqB;AACrB,iBAAmB;AACnB,uBAAyB;AACzB,8BAAuD;AACvD,2BAAwB;AACxB,0BAA0C;AAC1C,IAAAA,gBAA+B;AAC/B,wBAAyB;AAEzB,MAAM,kBAAkB,aAAAC;AAmBxB,SAAS,UAAU,KAAwC;AACzD,SAAO,IAAI,QAA0B,CAAC,SAAS,WAAW;AACxD,UAAM,QAAQ,IAAI,MAAM;AAExB,UAAM,SAAS,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AY,GAAG,UAAU,SAAS,CAAC;AAAA,QAC9C,+BAAS,4CAAmB,OAAO,YAAY,KAAK,CAAC;AAAA,QACrD,+BAAS,4CAAmB,CAAC,OAAO,GAAY,CAAC,CAACC,WAAU,CAAC,OAAO,EAAE,SAAAA,SAAQ,EAAE,CAAC;AAAA,IACjF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,MAAI,CAAC;AAAY,WAAO;AAExB,SACE,4CAAC,aAAU,MAAY,KAAU,IAAQ,WAAW,oBACjD,8BAAAC,QAAmB,KAClB;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAO,WAAW,aAAa,KAAK;AAAA,MACpC,KAAK;AAAA,MACL,OAAO,WAAW;AAAA,MAClB,QAAQ,WAAW;AAAA,MACnB;AAAA;AAAA,EACF,IAEA;AAAA,IAAC,aAAAL;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,OAAO,WAAW,aAAa,KAAK;AAAA,MACpC,KAAK,WAAW;AAAA,MAChB,OAAO,WAAW;AAAA,MAClB,QAAQ,WAAW;AAAA,MACnB,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA;AAAA,EACF,GAEJ;AAEJ,CAAC;AAED,IAAO,gBAAQ;","names":["import_react","NextImage","Image","fileData","file","opacity","nextMajorVersion"]}
|
|
@@ -32,9 +32,8 @@ __export(register_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(register_exports);
|
|
34
34
|
var import_react = require("react");
|
|
35
|
-
var import_prop_controllers = require("../../../prop-controllers");
|
|
36
35
|
var import_constants = require("../constants");
|
|
37
|
-
var
|
|
36
|
+
var import_prop_controllers = require("@makeswift/prop-controllers");
|
|
38
37
|
function registerComponent(runtime) {
|
|
39
38
|
return runtime.registerComponent(
|
|
40
39
|
(0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("./Image")))),
|
|
@@ -42,18 +41,18 @@ function registerComponent(runtime) {
|
|
|
42
41
|
type: import_constants.MakeswiftComponentType.Image,
|
|
43
42
|
label: "Image",
|
|
44
43
|
props: {
|
|
45
|
-
id: (0,
|
|
46
|
-
file: (0,
|
|
47
|
-
altText: import_prop_controllers.
|
|
48
|
-
link: (0,
|
|
49
|
-
width: (0,
|
|
50
|
-
margin: (0,
|
|
51
|
-
padding: (0,
|
|
52
|
-
border: (0,
|
|
53
|
-
borderRadius: (0,
|
|
54
|
-
boxShadow: (0,
|
|
55
|
-
opacity: import_prop_controllers.
|
|
56
|
-
priority: (0,
|
|
44
|
+
id: (0, import_prop_controllers.ElementID)(),
|
|
45
|
+
file: (0, import_prop_controllers.Image)(),
|
|
46
|
+
altText: (0, import_prop_controllers.TextInput)({ label: "Alt text" }),
|
|
47
|
+
link: (0, import_prop_controllers.Link)({ label: "On click" }),
|
|
48
|
+
width: (0, import_prop_controllers.Width)(),
|
|
49
|
+
margin: (0, import_prop_controllers.Margin)({ format: import_prop_controllers.Margin.Format.ClassName }),
|
|
50
|
+
padding: (0, import_prop_controllers.Padding)({ format: import_prop_controllers.Padding.Format.ClassName }),
|
|
51
|
+
border: (0, import_prop_controllers.Border)({ format: import_prop_controllers.Border.Format.ClassName }),
|
|
52
|
+
borderRadius: (0, import_prop_controllers.BorderRadius)({ format: import_prop_controllers.BorderRadius.Format.ClassName }),
|
|
53
|
+
boxShadow: (0, import_prop_controllers.Shadows)({ format: import_prop_controllers.Shadows.Format.ClassName }),
|
|
54
|
+
opacity: (0, import_prop_controllers.ResponsiveOpacity)(),
|
|
55
|
+
priority: (0, import_prop_controllers.Checkbox)({ label: "Priority" })
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Image/register.ts"],"sourcesContent":["import { lazy } from 'react'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Image/register.ts"],"sourcesContent":["import { lazy } from 'react'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { MakeswiftComponentType } from '../constants'\nimport {\n Border,\n Link,\n Shadows,\n Checkbox,\n BorderRadius,\n Margin,\n Padding,\n Width,\n ElementID,\n Image,\n ResponsiveOpacity,\n TextInput,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Image')),\n {\n type: MakeswiftComponentType.Image,\n label: 'Image',\n props: {\n id: ElementID(),\n file: Image(),\n altText: TextInput({ label: 'Alt text' }),\n link: Link({ label: 'On click' }),\n width: Width(),\n margin: Margin({ format: Margin.Format.ClassName }),\n padding: Padding({ format: Padding.Format.ClassName }),\n border: Border({ format: Border.Format.ClassName }),\n borderRadius: BorderRadius({ format: BorderRadius.Format.ClassName }),\n boxShadow: Shadows({ format: Shadows.Format.ClassName }),\n opacity: ResponsiveOpacity(),\n priority: Checkbox({ label: 'Priority' }),\n },\n },\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqB;AAErB,uBAAuC;AACvC,8BAaO;AAEA,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,QACb,mBAAK,MAAM,6CAAO,SAAS,GAAC;AAAA,IAC5B;AAAA,MACE,MAAM,wCAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,OAAO;AAAA,QACL,QAAI,mCAAU;AAAA,QACd,UAAM,+BAAM;AAAA,QACZ,aAAS,mCAAU,EAAE,OAAO,WAAW,CAAC;AAAA,QACxC,UAAM,8BAAK,EAAE,OAAO,WAAW,CAAC;AAAA,QAChC,WAAO,+BAAM;AAAA,QACb,YAAQ,gCAAO,EAAE,QAAQ,+BAAO,OAAO,UAAU,CAAC;AAAA,QAClD,aAAS,iCAAQ,EAAE,QAAQ,gCAAQ,OAAO,UAAU,CAAC;AAAA,QACrD,YAAQ,gCAAO,EAAE,QAAQ,+BAAO,OAAO,UAAU,CAAC;AAAA,QAClD,kBAAc,sCAAa,EAAE,QAAQ,qCAAa,OAAO,UAAU,CAAC;AAAA,QACpE,eAAW,iCAAQ,EAAE,QAAQ,gCAAQ,OAAO,UAAU,CAAC;AAAA,QACvD,aAAS,2CAAkB;AAAA,QAC3B,cAAU,kCAAS,EAAE,OAAO,WAAW,CAAC;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Navigation/Navigation.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useState } from 'react'\n\nimport { MobileMenu28 } from '../../icons/MobileMenu28'\n\nimport GutterContainer from '../../shared/GutterContainer'\nimport Image from '../Image'\nimport Button from '../Button'\nimport LinksPlaceholder from './components/LinksPlaceholder'\nimport DropDownButton from './components/DropDownButton'\nimport MobileMenu from './components/MobileMenu'\nimport {\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n TextInputValue,\n} from '../../../prop-controllers/descriptors'\nimport {\n ImageData,\n LinkData,\n NavigationButtonData,\n NavigationLinksData,\n ResponsiveGapData,\n ResponsiveLengthData,\n ResponsiveTextStyleData,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: string\n links?: NavigationLinksData\n linkTextStyle?: ResponsiveTextStyleData\n showLogo?: boolean\n logoFile?: ImageData\n logoWidth?: ResponsiveLengthData\n logoAltText?: TextInputValue\n logoLink?: LinkData\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: ResponsiveGapData\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonData['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsEI;AApEJ,mBAA6E;AAE7E,0BAA6B;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,oBAAmB;AACnB,8BAA6B;AAC7B,4BAA2B;AAC3B,wBAAuB;AAkBvB,2BAA8B;AAE9B,mBAAmC;AACnC,iBAAmB;AACnB,8BAA2D;AAC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AAAA,YACT,MAAM;AAAA,YACN,MAAM;AAAA,YACN;AAAA,YACA,OAAO;AAAA;AAAA,QACT;AAAA,QAEF,6CAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,UAAU,GAAG,gBAAgB,WAAW,GACrE;AAAA,sDAAC,kBAAe,WAAsB,qBACnC,gBAAM,SAAS,IACd,MAAM,IAAI,CAAC,MAAM,MACf;AAAA,YAAC,uBAAAC;AAAA,YAAA;AAAA,cAEC;AAAA,cACA,OAAO,MAAM;AAAA,cACb,MAAM,MAAM,MAAM,SAAS;AAAA,cAE1B;AAAA,qBAAK,SAAS,YACb,4CAAC,oBAAkB,GAAG,KAAK,SAAU,eAAK,QAAQ,OAAM;AAAA,gBAEzD,KAAK,SAAS,cAAc,4CAAC,sBAAAC,SAAA,EAAgB,GAAG,KAAK,SAAS;AAAA;AAAA;AAAA,YAR1D,KAAK;AAAA,UASZ,CACD,IAED,4CAAC,wBAAAC,SAAA,EAAiB,QAAgB,GAEtC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,cACA,SAAS,MAAM,UAAU,IAAI;AAAA,cAE7B,sDAAC,oCAAa;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,cACX,iBAAiB;AAAA,cACjB,gBAAgB;AAAA,cAChB;AAAA,cACA,SAAS,MAAM,UAAU,KAAK;AAAA,cAC9B,MAAM;AAAA;AAAA,UACR;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,qBAAQ;","names":["Container","gutter","alignment","mobileMenuAnimation","color","Button","Navigation","Image","GutterContainer","DropDownButton","LinksPlaceholder","MobileMenu"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Navigation/Navigation.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useState } from 'react'\n\nimport { MobileMenu28 } from '../../icons/MobileMenu28'\n\nimport GutterContainer from '../../shared/GutterContainer'\nimport Image from '../Image'\nimport Button from '../Button'\nimport LinksPlaceholder from './components/LinksPlaceholder'\nimport DropDownButton from './components/DropDownButton'\nimport MobileMenu from './components/MobileMenu'\nimport {\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectValue,\n} from '../../../prop-controllers/descriptors'\nimport {\n ImageData,\n LinkData,\n NavigationButtonData,\n NavigationLinksData,\n ResponsiveGapData,\n ResponsiveLengthData,\n ResponsiveTextStyleData,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\n\nimport { ColorValue as Color } from '../../utils/types'\nimport { colorToString } from '../../utils/colorToString'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useResponsiveColor } from '../../hooks'\nimport { cx } from '@emotion/css'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../utils/responsive-style'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n id?: string\n links?: NavigationLinksData\n linkTextStyle?: ResponsiveTextStyleData\n showLogo?: boolean\n logoFile?: ImageData\n logoWidth?: ResponsiveLengthData\n logoAltText?: string\n logoLink?: LinkData\n alignment?: ResponsiveIconRadioGroupValue<'flex-start' | 'center' | 'flex-end'>\n gutter?: ResponsiveGapData\n mobileMenuAnimation?: ResponsiveSelectValue<'coverRight' | 'coverLeft'>\n mobileMenuOpenIconColor?: ResponsiveColor | null\n mobileMenuCloseIconColor?: ResponsiveColor | null\n mobileMenuBackgroundColor?: ResponsiveColor | null\n width?: string\n margin?: string\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n textStyle: Props['linkTextStyle']\n gutter: Props['gutter']\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'nav'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n { className, width, margin, textStyle, gutter, ...restOfProps }: ContainerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n return (\n <nav\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex', alignItems: 'center' }),\n width,\n margin,\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([gutter] as const, ([gutter = { value: 0, unit: 'px' }]) => ({\n gap: `${gutter.value}${gutter.unit}`,\n })),\n ),\n className,\n )}\n />\n )\n})\n\ntype LinksContainerBaseProps = {\n alignment: Props['alignment']\n mobileMenuAnimation: Props['mobileMenuAnimation']\n}\n\ntype LinksContainerProps = LinksContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof LinksContainerBaseProps>\n\nfunction LinksContainer({\n className,\n alignment,\n mobileMenuAnimation,\n ...restOfProps\n}: LinksContainerProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n }),\n useStyle(\n useResponsiveStyle(\n [alignment, mobileMenuAnimation] as const,\n ([alignment = 'flex-end', mobileMenuAnimation]) => ({\n display: mobileMenuAnimation == null ? 'flex' : 'none',\n justifyContent: alignment,\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype OpenIconContainerBaseProps = {\n mobileMenuAnimation: Props['mobileMenuAnimation']\n alignment: Props['alignment']\n color: ResponsiveValue<Color> | null | undefined\n}\n\ntype OpenIconContainerProps = OpenIconContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'button'>, keyof OpenIconContainerBaseProps>\n\nfunction OpenIconContainer({\n className,\n mobileMenuAnimation,\n alignment,\n color,\n ...restOfProps\n}: OpenIconContainerProps) {\n return (\n <button\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'none',\n flexGrow: 1,\n alignItems: 'center',\n background: 'none',\n outline: 0,\n border: 0,\n padding: 0,\n fill: 'currentcolor',\n }),\n useStyle(\n useResponsiveStyle(\n [mobileMenuAnimation, alignment, color] as const,\n ([mobileMenuAnimation, alignment = 'flex-end', color]) => ({\n display: mobileMenuAnimation == null ? 'none' : 'flex',\n justifyContent: alignment,\n color: color == null ? 'rgba(161, 168, 194, 0.5)' : colorToString(color),\n }),\n ),\n ),\n className,\n )}\n />\n )\n}\n\ntype NavigationButtonProps = NavigationButtonData['payload'] &\n Omit<ComponentPropsWithoutRef<typeof Button>, 'color' | 'textColor'>\n\nfunction NavigationButton(props: NavigationButtonProps): JSX.Element {\n const { textColor, color, ...restOfProps } = props\n\n return (\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n />\n )\n}\n\nconst placeholder = {\n src: \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A\",\n dimensions: { width: 93, height: 36 },\n}\n\nconst Navigation = forwardRef<HTMLDivElement, Props>(function Navigation(\n {\n id,\n links = [],\n linkTextStyle,\n showLogo,\n logoFile,\n logoWidth,\n logoAltText,\n logoLink,\n alignment,\n gutter,\n mobileMenuAnimation,\n mobileMenuOpenIconColor,\n mobileMenuCloseIconColor,\n mobileMenuBackgroundColor,\n width,\n margin,\n },\n ref,\n) {\n const [isOpen, setIsOpen] = useState(false)\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n textStyle={linkTextStyle}\n gutter={gutter}\n >\n {showLogo === true && (\n <Image\n altText={logoAltText}\n file={logoFile}\n link={logoLink}\n placeholder={placeholder}\n width={logoWidth}\n />\n )}\n <div style={{ display: 'flex', flexGrow: 1, justifyContent: 'flex-end' }}>\n <LinksContainer alignment={alignment} mobileMenuAnimation={mobileMenuAnimation}>\n {links.length > 0 ? (\n links.map((link, i) => (\n <GutterContainer\n key={link.id}\n gutter={gutter}\n first={i === 0}\n last={i === links.length - 1}\n >\n {link.type === 'button' && (\n <NavigationButton {...link.payload}>{link.payload.label}</NavigationButton>\n )}\n {link.type === 'dropdown' && <DropDownButton {...link.payload} />}\n </GutterContainer>\n ))\n ) : (\n <LinksPlaceholder gutter={gutter} />\n )}\n </LinksContainer>\n <OpenIconContainer\n alignment={alignment}\n color={mobileMenuOpenIconColor}\n mobileMenuAnimation={mobileMenuAnimation}\n onClick={() => setIsOpen(true)}\n >\n <MobileMenu28 />\n </OpenIconContainer>\n <MobileMenu\n animation={mobileMenuAnimation}\n backgroundColor={mobileMenuBackgroundColor}\n closeIconColor={mobileMenuCloseIconColor}\n links={links}\n onClose={() => setIsOpen(false)}\n open={isOpen}\n />\n </div>\n </Container>\n )\n})\n\nexport default Navigation\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqEI;AAnEJ,mBAA6E;AAE7E,0BAA6B;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,oBAAmB;AACnB,8BAA6B;AAC7B,4BAA2B;AAC3B,wBAAuB;AAiBvB,2BAA8B;AAE9B,mBAAmC;AACnC,iBAAmB;AACnB,8BAA2D;AAC3D,uBAAyB;AA+BzB,MAAM,gBAAY,yBAAW,SAASA,WACpC,EAAE,WAAW,OAAO,QAAQ,WAAW,QAAQ,GAAG,YAAY,GAC9D,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,eAAW;AAAA,YACT,2BAAS,EAAE,SAAS,QAAQ,YAAY,SAAS,CAAC;AAAA,QAClD;AAAA,QACA;AAAA,YACA,+BAAS,gDAAuB,SAAS,CAAC;AAAA,YAC1C;AAAA,cACE,4CAAmB,CAAC,MAAM,GAAY,CAAC,CAACC,UAAS,EAAE,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO;AAAA,YAC9E,KAAK,GAAGA,QAAO,KAAK,GAAGA,QAAO,IAAI;AAAA,UACpC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AAA,EAAgB,GAAG,KAAK,SAAS;AAAA;AAAA;AAAA,YAR1D,KAAK;AAAA,UASZ,CACD,IAED,4CAAC,wBAAAC,SAAA,EAAiB,QAAgB,GAEtC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,cACA,SAAS,MAAM,UAAU,IAAI;AAAA,cAE7B,sDAAC,oCAAa;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,cACX,iBAAiB;AAAA,cACjB,gBAAgB;AAAA,cAChB;AAAA,cACA,SAAS,MAAM,UAAU,KAAK;AAAA,cAC9B,MAAM;AAAA;AAAA,UACR;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,qBAAQ;","names":["Container","gutter","alignment","mobileMenuAnimation","color","Button","Navigation","Image","GutterContainer","DropDownButton","LinksPlaceholder","MobileMenu"]}
|
|
@@ -84,7 +84,7 @@ function registerComponent(runtime) {
|
|
|
84
84
|
import_prop_controllers2.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
|
|
85
85
|
) === false
|
|
86
86
|
})),
|
|
87
|
-
logoAltText:
|
|
87
|
+
logoAltText: (0, import_prop_controllers2.TextInput)((props) => ({
|
|
88
88
|
label: "Logo alt text",
|
|
89
89
|
hidden: (0, import_prop_controllers2.getCheckboxPropControllerDataBoolean)(
|
|
90
90
|
import_prop_controllers2.checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ControlDataTypeKey,\n Checkbox,\n Link,\n ResponsiveColor,\n ResponsiveLength,\n ResponsiveLengthPropControllerDataV1Type,\n checkboxPropControllerDataSchema,\n getCheckboxPropControllerDataBoolean,\n Margin,\n Width,\n TextStyle,\n NavigationLinks,\n NavigationLinksData,\n GapX,\n ElementID,\n Image,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Navigation')),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: ElementID(),\n links: NavigationLinks(),\n linkTextStyle: TextStyle(props => {\n const links = props.links as NavigationLinksData | undefined\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Image(props => ({\n label: 'Logo',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoWidth: ResponsiveLength(props => ({\n // TODO(miguel): We're manually constructing the data here but should be using a factory\n // function instead. This is because the factory function currently expects a definition\n // but we don't have one to pass here. Perhaps we should make the factory function not\n // require the definition and use the latest version when a definition isn't provided.\n preset: {\n [ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type,\n value: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n },\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoAltText:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { ResponsiveSelectValue } from '../../../prop-controllers/descriptors'\nimport { ReactRuntime } from '../../../runtimes/react'\nimport { findBreakpointOverride, getBaseBreakpoint } from '../../../state/modules/breakpoints'\nimport { MakeswiftComponentType } from '../constants'\nimport { ComponentIcon } from '../../../state/modules/components-meta'\nimport { lazy } from 'react'\nimport {\n ControlDataTypeKey,\n Checkbox,\n Link,\n ResponsiveColor,\n ResponsiveLength,\n ResponsiveLengthPropControllerDataV1Type,\n checkboxPropControllerDataSchema,\n getCheckboxPropControllerDataBoolean,\n Margin,\n Width,\n TextStyle,\n NavigationLinks,\n NavigationLinksData,\n GapX,\n ElementID,\n Image,\n TextInput,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n return runtime.registerComponent(\n lazy(() => import('./Navigation')),\n {\n type: MakeswiftComponentType.Navigation,\n label: 'Navigation',\n icon: ComponentIcon.Navigation,\n props: {\n id: ElementID(),\n links: NavigationLinks(),\n linkTextStyle: TextStyle(props => {\n const links = props.links as NavigationLinksData | undefined\n\n return {\n label: 'Link text style',\n hidden: links == null || links.length === 0,\n }\n }),\n showLogo: Checkbox({ preset: true, label: 'Show logo' }),\n logoFile: Image(props => ({\n label: 'Logo',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoWidth: ResponsiveLength(props => ({\n // TODO(miguel): We're manually constructing the data here but should be using a factory\n // function instead. This is because the factory function currently expects a definition\n // but we don't have one to pass here. Perhaps we should make the factory function not\n // require the definition and use the latest version when a definition isn't provided.\n preset: {\n [ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type,\n value: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 100, unit: 'px' },\n },\n ],\n },\n label: 'Logo width',\n min: 0,\n max: 1000,\n // TODO: This is hardcoded value, import it from LengthInputOptions\n options: [{ value: 'px', label: 'Pixels', icon: 'Px16' }],\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoAltText: TextInput(props => ({\n label: 'Logo alt text',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoLink: Link(props => ({\n label: 'Logo on click',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAsB;AAGtB,yBAA0D;AAC1D,uBAAuC;AACvC,6BAA8B;AAC9B,IAAAA,gBAAqB;AACrB,IAAAC,2BAkBO;AAEA,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,QACb,oBAAK,MAAM,6CAAO,cAAc,GAAC;AAAA,IACjC;AAAA,MACE,MAAM,wCAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,qCAAc;AAAA,MACpB,OAAO;AAAA,QACL,QAAI,oCAAU;AAAA,QACd,WAAO,0CAAgB;AAAA,QACvB,mBAAe,oCAAU,WAAS;AAChC,gBAAM,QAAQ,MAAM;AAEpB,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,QAAQ,SAAS,QAAQ,MAAM,WAAW;AAAA,UAC5C;AAAA,QACF,CAAC;AAAA,QACD,cAAU,mCAAS,EAAE,QAAQ,MAAM,OAAO,YAAY,CAAC;AAAA,QACvD,cAAU,gCAAM,YAAU;AAAA,UACxB,OAAO;AAAA,UACP,YACE;AAAA,YACE,0DAAiC,SAAS,EAAE,MAAM,MAAS,EAAE,MAAM,MAAM,QAAQ;AAAA,UACnF,MAAM;AAAA,QACV,EAAE;AAAA,QACF,eAAW,2CAAiB,YAAU;AAAA;AAAA;AAAA;A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EAAE,QAAQ,gCAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":["import_react","import_prop_controllers"]}
|
|
@@ -46,7 +46,7 @@ function registerComponent(runtime) {
|
|
|
46
46
|
icon: import_components_meta.ComponentIcon.SocialLinks,
|
|
47
47
|
props: {
|
|
48
48
|
id: (0, import_prop_controllers2.ElementID)(),
|
|
49
|
-
links:
|
|
49
|
+
links: (0, import_prop_controllers2.SocialLinks)({
|
|
50
50
|
preset: {
|
|
51
51
|
links: [
|
|
52
52
|
{
|
|
@@ -66,7 +66,9 @@ function registerComponent(runtime) {
|
|
|
66
66
|
}
|
|
67
67
|
}),
|
|
68
68
|
shape: import_prop_controllers.Props.ResponsiveIconRadioGroup((props) => {
|
|
69
|
-
const links =
|
|
69
|
+
const links = (0, import_prop_controllers2.getSocialLinksPropControllerDataSocialLinksData)(
|
|
70
|
+
props.links
|
|
71
|
+
);
|
|
70
72
|
return {
|
|
71
73
|
label: "Shape",
|
|
72
74
|
options: [
|
|
@@ -80,7 +82,9 @@ function registerComponent(runtime) {
|
|
|
80
82
|
};
|
|
81
83
|
}),
|
|
82
84
|
size: import_prop_controllers.Props.ResponsiveIconRadioGroup((props) => {
|
|
83
|
-
const links =
|
|
85
|
+
const links = (0, import_prop_controllers2.getSocialLinksPropControllerDataSocialLinksData)(
|
|
86
|
+
props.links
|
|
87
|
+
);
|
|
84
88
|
return {
|
|
85
89
|
label: "Size",
|
|
86
90
|
options: [
|
|
@@ -93,7 +97,9 @@ function registerComponent(runtime) {
|
|
|
93
97
|
};
|
|
94
98
|
}),
|
|
95
99
|
hoverStyle: import_prop_controllers.Props.ResponsiveSelect((props) => {
|
|
96
|
-
const links =
|
|
100
|
+
const links = (0, import_prop_controllers2.getSocialLinksPropControllerDataSocialLinksData)(
|
|
101
|
+
props.links
|
|
102
|
+
);
|
|
97
103
|
const hidden = links == null || links.links.length === 0;
|
|
98
104
|
return {
|
|
99
105
|
label: "On hover",
|
|
@@ -109,7 +115,9 @@ function registerComponent(runtime) {
|
|
|
109
115
|
};
|
|
110
116
|
}),
|
|
111
117
|
fill: (0, import_prop_controllers2.ResponsiveColor)((props) => {
|
|
112
|
-
const links =
|
|
118
|
+
const links = (0, import_prop_controllers2.getSocialLinksPropControllerDataSocialLinksData)(
|
|
119
|
+
props.links
|
|
120
|
+
);
|
|
113
121
|
const hidden = links == null || links.links.length === 0;
|
|
114
122
|
return {
|
|
115
123
|
label: "Icon color",
|
|
@@ -117,7 +125,9 @@ function registerComponent(runtime) {
|
|
|
117
125
|
};
|
|
118
126
|
}),
|
|
119
127
|
backgroundColor: (0, import_prop_controllers2.ResponsiveColor)((props) => {
|
|
120
|
-
const links =
|
|
128
|
+
const links = (0, import_prop_controllers2.getSocialLinksPropControllerDataSocialLinksData)(
|
|
129
|
+
props.links
|
|
130
|
+
);
|
|
121
131
|
const hidden = links == null || links.links.length === 0;
|
|
122
132
|
return {
|
|
123
133
|
label: "Shape color",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\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 {\n ElementID,\n GapX,\n Margin,\n ResponsiveColor,\n SocialLinks,\n SocialLinksPropControllerData,\n Width,\n getSocialLinksPropControllerDataSocialLinksData,\n} 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: ElementID(),\n links: 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 = getSocialLinksPropControllerDataSocialLinksData(\n props.links as SocialLinksPropControllerData | undefined,\n )\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 = getSocialLinksPropControllerDataSocialLinksData(\n props.links as SocialLinksPropControllerData | undefined,\n )\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 = getSocialLinksPropControllerDataSocialLinksData(\n props.links as SocialLinksPropControllerData | undefined,\n )\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 = getSocialLinksPropControllerDataSocialLinksData(\n props.links as SocialLinksPropControllerData | undefined,\n )\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 = getSocialLinksPropControllerDataSocialLinksData(\n props.links as SocialLinksPropControllerData | undefined,\n )\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;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAsB;AAEtB,yBAAkC;AAClC,uBAAuC;AACvC,6BAA8B;AAC9B,IAAAA,gBAAqB;AACrB,IAAAC,2BASO;AAEA,SAAS,kBAAkB,SAAuB;AACvD,SAAO,QAAQ;AAAA,QACb,oBAAK,MAAM,6CAAO,eAAe,GAAC;AAAA,IAClC;AAAA,MACE,MAAM,wCAAuB;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM,qCAAc;AAAA,MACpB,OAAO;AAAA,QACL,QAAI,oCAAU;AAAA,QACd,WAAO,sCAAY;AAAA,UACjB,QAAQ;AAAA,YACN,OAAO;A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AO,IAAI,MAAM,KAAK;AAAA,YACjC;AAAA,UACF;AAAA,UACA,OAAO;AAAA,UACP,KAAK;AAAA,UACL,KAAK;AAAA,UACL,MAAM;AAAA,UACN,cAAc,EAAE,OAAO,GAAG,MAAM,KAAK;AAAA,QACvC,CAAC;AAAA,QACD,WAAO,gCAAM;AAAA,UACX,QAAQ,+BAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,YAAQ,iCAAO;AAAA,UACb,QAAQ,gCAAO,OAAO;AAAA,UACtB,QAAQ;AAAA,YACN;AAAA,cACE,cAAU,sCAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACnC,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["import_react","import_prop_controllers"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useTextInputPropControllerData_exports = {};
|
|
20
|
+
__export(useTextInputPropControllerData_exports, {
|
|
21
|
+
useTextInputPropControllerData: () => useTextInputPropControllerData
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useTextInputPropControllerData_exports);
|
|
24
|
+
var import_prop_controllers = require("@makeswift/prop-controllers");
|
|
25
|
+
function useTextInputPropControllerData(data) {
|
|
26
|
+
return (0, import_prop_controllers.getTextInputPropControllerDataString)(data);
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
useTextInputPropControllerData
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=useTextInputPropControllerData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/hooks/useTextInputPropControllerData.ts"],"sourcesContent":["import {\n TextInputPropControllerData,\n getTextInputPropControllerDataString,\n} from '@makeswift/prop-controllers'\n\nexport function useTextInputPropControllerData(\n data: TextInputPropControllerData | undefined,\n): string | undefined {\n return getTextInputPropControllerDataString(data)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAGO;AAEA,SAAS,+BACd,MACoB;AACpB,aAAO,8DAAqC,IAAI;AAClD;","names":[]}
|
|
@@ -30,7 +30,6 @@ var import_list = require("./list");
|
|
|
30
30
|
var import_shape = require("./shape");
|
|
31
31
|
var import_style = require("./style");
|
|
32
32
|
var import_slot = require("./slot");
|
|
33
|
-
var import_descriptors = require("../prop-controllers/descriptors");
|
|
34
33
|
var import_prop_controllers = require("@makeswift/prop-controllers");
|
|
35
34
|
var import_copy = require("../prop-controllers/copy");
|
|
36
35
|
var import_rich_text = require("./rich-text");
|
|
@@ -90,7 +89,7 @@ function merge(definition, a, b = a, context) {
|
|
|
90
89
|
}
|
|
91
90
|
function getTranslatableData(definition, data) {
|
|
92
91
|
switch (definition.type) {
|
|
93
|
-
case
|
|
92
|
+
case import_prop_controllers.Types.TextInput:
|
|
94
93
|
case import_prop_controllers.Types.TextArea:
|
|
95
94
|
case import_controls.TextInputControlType:
|
|
96
95
|
case import_controls.TextAreaControlType:
|
|
@@ -116,7 +115,7 @@ function mergeTranslatedData(definition, data, translatedData, context) {
|
|
|
116
115
|
if (data == null)
|
|
117
116
|
return data;
|
|
118
117
|
switch (definition.type) {
|
|
119
|
-
case
|
|
118
|
+
case import_prop_controllers.Types.TextInput:
|
|
120
119
|
case import_prop_controllers.Types.TextArea:
|
|
121
120
|
case import_controls.TextInputControlType:
|
|
122
121
|
case import_controls.TextAreaControlType:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/control.ts"],"sourcesContent":["import {\n ColorControlData,\n ColorControlDefinition,\n ColorControlType,\n TextInputControlData,\n TextInputControlDefinition,\n TextInputControlType,\n TextAreaControlData,\n TextAreaControlDefinition,\n TextAreaControlType,\n CheckboxControlData,\n CheckboxControlDefinition,\n NumberControlData,\n NumberControlDefinition,\n ComboboxControlData,\n ComboboxControlDefinition,\n IconRadioGroupControlData,\n IconRadioGroupControlDefinition,\n ImageControlType,\n ImageControlData,\n ImageControlDefinition,\n LinkControlData,\n LinkControlDefinition,\n LinkControlType,\n copyColorData,\n copyLinkData,\n} from '@makeswift/controls'\n\nimport { copyImageData } from './image'\nimport {\n ListControlData,\n ListControlDefinition,\n copyListData,\n ListControlType,\n getListTranslatableData,\n mergeListTranslatedData,\n ListControlTranslationDto,\n} from './list'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport {\n ShapeControlData,\n ShapeControlDefinition,\n copyShapeData,\n ShapeControlType,\n getShapeTranslatableData,\n mergeShapeTranslatedData,\n ShapeControlTranslationDto,\n} from './shape'\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 { Descriptor, Types } from '../prop-controllers/descriptors'\nimport {\n GridPropControllerData,\n Types as PropControllerTypes,\n mergeGridPropControllerTranslatedData,\n} 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 { DELETED_PROP_CONTROLLER_TYPES, 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 { TypographyControlData, TypographyControlDefinition } from './typography'\nimport {\n RichTextV2ControlTranslationDto,\n getRichTextV2TranslatableData,\n mergeRichTextV2TranslatedData,\n} from './rich-text-v2/translation'\nimport { IndexSignatureHack } from '../utils/index-signature-hack'\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 PropControllerTypes.Backgrounds:\n case PropControllerTypes.Grid:\n case PropControllerTypes.NavigationLinks:\n case PropControllerTypes.Link:\n case PropControllerTypes.Shadows:\n case PropControllerTypes.Image:\n case PropControllerTypes.Images:\n case PropControllerTypes.ResponsiveColor:\n case PropControllerTypes.TableFormFields:\n case PropControllerTypes.Table:\n case PropControllerTypes.Border:\n case PropControllerTypes.ElementID:\n return propControllerCopy(definition, value, context)\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\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 PropControllerTypes.Grid:\n return mergeGridPropControllerTranslatedData(data as GridPropControllerData, 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,\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;AAAM,eAAO;AAEnC,iBAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,iBAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,iBAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","names":["import_prop_controllers","import_copy","PropControllerTypes","propControllerCopy"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/control.ts"],"sourcesContent":["import {\n ColorControlData,\n ColorControlDefinition,\n ColorControlType,\n TextInputControlData,\n TextInputControlDefinition,\n TextInputControlType,\n TextAreaControlData,\n TextAreaControlDefinition,\n TextAreaControlType,\n CheckboxControlData,\n CheckboxControlDefinition,\n NumberControlData,\n NumberControlDefinition,\n ComboboxControlData,\n ComboboxControlDefinition,\n IconRadioGroupControlData,\n IconRadioGroupControlDefinition,\n ImageControlType,\n ImageControlData,\n ImageControlDefinition,\n LinkControlData,\n LinkControlDefinition,\n LinkControlType,\n copyColorData,\n copyLinkData,\n} from '@makeswift/controls'\n\nimport { copyImageData } from './image'\nimport {\n ListControlData,\n ListControlDefinition,\n copyListData,\n ListControlType,\n getListTranslatableData,\n mergeListTranslatedData,\n ListControlTranslationDto,\n} from './list'\nimport { SelectControlData, SelectControlDefinition } from './select'\nimport {\n ShapeControlData,\n ShapeControlDefinition,\n copyShapeData,\n ShapeControlType,\n getShapeTranslatableData,\n mergeShapeTranslatedData,\n ShapeControlTranslationDto,\n} from './shape'\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 { Descriptor } from '../prop-controllers/descriptors'\nimport {\n GridPropControllerData,\n Types as PropControllerTypes,\n mergeGridPropControllerTranslatedData,\n} 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 { DELETED_PROP_CONTROLLER_TYPES, 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 { TypographyControlData, TypographyControlDefinition } from './typography'\nimport {\n RichTextV2ControlTranslationDto,\n getRichTextV2TranslatableData,\n mergeRichTextV2TranslatedData,\n} from './rich-text-v2/translation'\nimport { IndexSignatureHack } from '../utils/index-signature-hack'\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 PropControllerTypes.Backgrounds:\n case PropControllerTypes.Grid:\n case PropControllerTypes.NavigationLinks:\n case PropControllerTypes.Link:\n case PropControllerTypes.Shadows:\n case PropControllerTypes.Image:\n case PropControllerTypes.Images:\n case PropControllerTypes.ResponsiveColor:\n case PropControllerTypes.TableFormFields:\n case PropControllerTypes.Table:\n case PropControllerTypes.Border:\n case PropControllerTypes.ElementID:\n return propControllerCopy(definition, value, context)\n case DELETED_PROP_CONTROLLER_TYPES.RichText:\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 PropControllerTypes.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 PropControllerTypes.TextInput:\n case PropControllerTypes.TextArea:\n case TextInputControlType:\n case TextAreaControlType:\n if (translatedData == null) return data\n\n return translatedData\n\n case PropControllerTypes.Grid:\n return mergeGridPropControllerTranslatedData(data as GridPropControllerData, 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBA0BO;AAEP,mBAA8B;AAC9B,kBAQO;AAE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;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF,KAAK;AACH,UAAI,kBAAkB;AAAM,eAAO;AAEnC,iBAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","names":["import_prop_controllers","import_copy","PropControllerTypes","propControllerCopy"]}
|
|
@@ -36,7 +36,7 @@ async function handler(...args) {
|
|
|
36
36
|
const supportsPreviewMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
|
|
37
37
|
const supportsDraftMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
|
|
38
38
|
const body = {
|
|
39
|
-
version: "0.18.0-canary.
|
|
39
|
+
version: "0.18.0-canary.5",
|
|
40
40
|
previewMode: supportsPreviewMode,
|
|
41
41
|
draftMode: supportsDraftMode,
|
|
42
42
|
interactionMode: true,
|
|
@@ -19,74 +19,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var descriptors_exports = {};
|
|
20
20
|
__export(descriptors_exports, {
|
|
21
21
|
ResponsiveIconRadioGroup: () => ResponsiveIconRadioGroup,
|
|
22
|
-
ResponsiveOpacity: () => ResponsiveOpacity,
|
|
23
22
|
ResponsiveSelect: () => ResponsiveSelect,
|
|
24
|
-
|
|
25
|
-
TextInput: () => TextInput,
|
|
26
|
-
Types: () => Types,
|
|
27
|
-
socialLinkTypesV0: () => socialLinkTypesV0,
|
|
28
|
-
socialLinkTypesV1: () => socialLinkTypesV1
|
|
23
|
+
Types: () => Types
|
|
29
24
|
});
|
|
30
25
|
module.exports = __toCommonJS(descriptors_exports);
|
|
31
26
|
var import_style2 = require("../controls/style");
|
|
32
27
|
const Types = {
|
|
33
28
|
ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
|
|
34
|
-
ResponsiveOpacity: "ResponsiveOpacity",
|
|
35
29
|
ResponsiveSelect: "ResponsiveSelect",
|
|
36
|
-
SocialLinks: "SocialLinks",
|
|
37
|
-
TextInput: "TextInput",
|
|
38
30
|
Style: import_style2.StyleControlType
|
|
39
31
|
};
|
|
40
32
|
function ResponsiveIconRadioGroup(options) {
|
|
41
33
|
return { type: Types.ResponsiveIconRadioGroup, options };
|
|
42
34
|
}
|
|
43
|
-
function ResponsiveOpacity(options = {}) {
|
|
44
|
-
return { type: Types.ResponsiveOpacity, options };
|
|
45
|
-
}
|
|
46
35
|
function ResponsiveSelect(options) {
|
|
47
36
|
return { type: Types.ResponsiveSelect, options };
|
|
48
37
|
}
|
|
49
|
-
const socialLinkTypesV0 = [
|
|
50
|
-
"angellist",
|
|
51
|
-
"codepen",
|
|
52
|
-
"discord",
|
|
53
|
-
"dribbble",
|
|
54
|
-
"facebook",
|
|
55
|
-
"github",
|
|
56
|
-
"instagram",
|
|
57
|
-
"linkedin",
|
|
58
|
-
"medium",
|
|
59
|
-
"pinterest",
|
|
60
|
-
"reddit",
|
|
61
|
-
"rss",
|
|
62
|
-
"snapchat",
|
|
63
|
-
"soundcloud",
|
|
64
|
-
"spotify",
|
|
65
|
-
"telegram",
|
|
66
|
-
"tumblr",
|
|
67
|
-
"twitch",
|
|
68
|
-
"twitter",
|
|
69
|
-
"vimeo",
|
|
70
|
-
"whatsapp",
|
|
71
|
-
"yelp",
|
|
72
|
-
"youtube"
|
|
73
|
-
];
|
|
74
|
-
const socialLinkTypesV1 = [...socialLinkTypesV0, "x", "slack"];
|
|
75
|
-
function SocialLinks(options = {}) {
|
|
76
|
-
return { type: Types.SocialLinks, options, version: 1 };
|
|
77
|
-
}
|
|
78
|
-
function TextInput(options = {}) {
|
|
79
|
-
return { type: Types.TextInput, options };
|
|
80
|
-
}
|
|
81
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
39
|
0 && (module.exports = {
|
|
83
40
|
ResponsiveIconRadioGroup,
|
|
84
|
-
ResponsiveOpacity,
|
|
85
41
|
ResponsiveSelect,
|
|
86
|
-
|
|
87
|
-
TextInput,
|
|
88
|
-
Types,
|
|
89
|
-
socialLinkTypesV0,
|
|
90
|
-
socialLinkTypesV1
|
|
42
|
+
Types
|
|
91
43
|
});
|
|
92
44
|
//# sourceMappingURL=descriptors.js.map
|