@makeswift/runtime 0.18.0-canary.4 → 0.18.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/cjs/builder/serialization/control-serialization.js +6 -20
  2. package/dist/cjs/builder/serialization/control-serialization.js.map +1 -1
  3. package/dist/cjs/components/builtin/Box/animations.js.map +1 -1
  4. package/dist/cjs/components/builtin/Box/register.js +5 -3
  5. package/dist/cjs/components/builtin/Box/register.js.map +1 -1
  6. package/dist/cjs/components/builtin/Button/Button.js.map +1 -1
  7. package/dist/cjs/components/builtin/Button/register.js +5 -3
  8. package/dist/cjs/components/builtin/Button/register.js.map +1 -1
  9. package/dist/cjs/components/builtin/Carousel/register.js +3 -1
  10. package/dist/cjs/components/builtin/Carousel/register.js.map +1 -1
  11. package/dist/cjs/components/builtin/Countdown/Countdown.js.map +1 -1
  12. package/dist/cjs/components/builtin/Countdown/register.js +4 -4
  13. package/dist/cjs/components/builtin/Countdown/register.js.map +1 -1
  14. package/dist/cjs/components/builtin/Divider/Divider.js.map +1 -1
  15. package/dist/cjs/components/builtin/Divider/register.js +8 -9
  16. package/dist/cjs/components/builtin/Divider/register.js.map +1 -1
  17. package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
  18. package/dist/cjs/components/builtin/Form/register.js +5 -3
  19. package/dist/cjs/components/builtin/Form/register.js.map +1 -1
  20. package/dist/cjs/components/builtin/Image/Image.js.map +1 -1
  21. package/dist/cjs/components/builtin/Image/register.js +13 -14
  22. package/dist/cjs/components/builtin/Image/register.js.map +1 -1
  23. package/dist/cjs/components/builtin/Navigation/Navigation.js.map +1 -1
  24. package/dist/cjs/components/builtin/Navigation/register.js +11 -23
  25. package/dist/cjs/components/builtin/Navigation/register.js.map +1 -1
  26. package/dist/cjs/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
  27. package/dist/cjs/components/builtin/SocialLinks/register.js +17 -7
  28. package/dist/cjs/components/builtin/SocialLinks/register.js.map +1 -1
  29. package/dist/cjs/components/hooks/useTextInputPropControllerData.js +32 -0
  30. package/dist/cjs/components/hooks/useTextInputPropControllerData.js.map +1 -0
  31. package/dist/cjs/controls/control.js +2 -3
  32. package/dist/cjs/controls/control.js.map +1 -1
  33. package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
  34. package/dist/cjs/next/components/tests/page-prop-controller.js.map +1 -1
  35. package/dist/cjs/prop-controllers/descriptors.js +2 -50
  36. package/dist/cjs/prop-controllers/descriptors.js.map +1 -1
  37. package/dist/cjs/prop-controllers/index.js +2 -7
  38. package/dist/cjs/prop-controllers/index.js.map +1 -1
  39. package/dist/cjs/runtimes/react/controls.js +16 -0
  40. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  41. package/dist/esm/builder/serialization/control-serialization.js +6 -20
  42. package/dist/esm/builder/serialization/control-serialization.js.map +1 -1
  43. package/dist/esm/components/builtin/Box/animations.js.map +1 -1
  44. package/dist/esm/components/builtin/Box/register.js +6 -3
  45. package/dist/esm/components/builtin/Box/register.js.map +1 -1
  46. package/dist/esm/components/builtin/Button/Button.js.map +1 -1
  47. package/dist/esm/components/builtin/Button/register.js +7 -3
  48. package/dist/esm/components/builtin/Button/register.js.map +1 -1
  49. package/dist/esm/components/builtin/Carousel/register.js +3 -1
  50. package/dist/esm/components/builtin/Carousel/register.js.map +1 -1
  51. package/dist/esm/components/builtin/Countdown/Countdown.js.map +1 -1
  52. package/dist/esm/components/builtin/Countdown/register.js +5 -4
  53. package/dist/esm/components/builtin/Countdown/register.js.map +1 -1
  54. package/dist/esm/components/builtin/Divider/Divider.js.map +1 -1
  55. package/dist/esm/components/builtin/Divider/register.js +2 -2
  56. package/dist/esm/components/builtin/Divider/register.js.map +1 -1
  57. package/dist/esm/components/builtin/Form/Form.js.map +1 -1
  58. package/dist/esm/components/builtin/Form/register.js +7 -3
  59. package/dist/esm/components/builtin/Form/register.js.map +1 -1
  60. package/dist/esm/components/builtin/Image/Image.js.map +1 -1
  61. package/dist/esm/components/builtin/Image/register.js +3 -3
  62. package/dist/esm/components/builtin/Image/register.js.map +1 -1
  63. package/dist/esm/components/builtin/Navigation/Navigation.js.map +1 -1
  64. package/dist/esm/components/builtin/Navigation/register.js +14 -24
  65. package/dist/esm/components/builtin/Navigation/register.js.map +1 -1
  66. package/dist/esm/components/builtin/SocialLinks/SocialLinks.js.map +1 -1
  67. package/dist/esm/components/builtin/SocialLinks/register.js +27 -8
  68. package/dist/esm/components/builtin/SocialLinks/register.js.map +1 -1
  69. package/dist/esm/components/hooks/useTextInputPropControllerData.js +10 -0
  70. package/dist/esm/components/hooks/useTextInputPropControllerData.js.map +1 -0
  71. package/dist/esm/controls/control.js +2 -3
  72. package/dist/esm/controls/control.js.map +1 -1
  73. package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
  74. package/dist/esm/next/components/tests/page-prop-controller.js.map +1 -1
  75. package/dist/esm/prop-controllers/descriptors.js +1 -44
  76. package/dist/esm/prop-controllers/descriptors.js.map +1 -1
  77. package/dist/esm/prop-controllers/index.js +1 -4
  78. package/dist/esm/prop-controllers/index.js.map +1 -1
  79. package/dist/esm/runtimes/react/controls.js +25 -2
  80. package/dist/esm/runtimes/react/controls.js.map +1 -1
  81. package/dist/types/builder/serialization/control-serialization.d.ts +9 -23
  82. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  83. package/dist/types/components/builtin/Box/animations.d.ts +2 -2
  84. package/dist/types/components/builtin/Box/animations.d.ts.map +1 -1
  85. package/dist/types/components/builtin/Box/register.d.ts.map +1 -1
  86. package/dist/types/components/builtin/Button/Button.d.ts +2 -2
  87. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  88. package/dist/types/components/builtin/Button/register.d.ts.map +1 -1
  89. package/dist/types/components/builtin/Countdown/Countdown.d.ts +5 -5
  90. package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
  91. package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
  92. package/dist/types/components/builtin/Divider/Divider.d.ts +1 -2
  93. package/dist/types/components/builtin/Divider/Divider.d.ts.map +1 -1
  94. package/dist/types/components/builtin/Divider/register.d.ts.map +1 -1
  95. package/dist/types/components/builtin/Form/Form.d.ts +3 -3
  96. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  97. package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
  98. package/dist/types/components/builtin/Image/Image.d.ts +1 -2
  99. package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
  100. package/dist/types/components/builtin/Image/register.d.ts.map +1 -1
  101. package/dist/types/components/builtin/Navigation/Navigation.d.ts +3 -3
  102. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  103. package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
  104. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts +2 -2
  105. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
  106. package/dist/types/components/builtin/SocialLinks/register.d.ts.map +1 -1
  107. package/dist/types/components/hooks/useTextInputPropControllerData.d.ts +3 -0
  108. package/dist/types/components/hooks/useTextInputPropControllerData.d.ts.map +1 -0
  109. package/dist/types/controls/control.d.ts.map +1 -1
  110. package/dist/types/next/components/tests/page-prop-controller.d.ts +2 -2
  111. package/dist/types/next/components/tests/page-prop-controller.d.ts.map +1 -1
  112. package/dist/types/next/components/tests/page-social-links-prop-controller.test.d.ts +3 -0
  113. package/dist/types/next/components/tests/page-social-links-prop-controller.test.d.ts.map +1 -0
  114. package/dist/types/next/components/tests/page-text-input-prop-controller.test.d.ts +3 -0
  115. package/dist/types/next/components/tests/page-text-input-prop-controller.test.d.ts.map +1 -0
  116. package/dist/types/prop-controllers/descriptors.d.ts +8 -86
  117. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  118. package/dist/types/prop-controllers/index.d.ts +1 -2
  119. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  120. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  121. package/package.json +3 -3
@@ -17,10 +17,18 @@ import {
17
17
  TextStyle,
18
18
  NavigationLinks,
19
19
  GapX,
20
+ ResponsiveSelect,
20
21
  ElementID,
21
- Image
22
+ Image,
23
+ TextInput
22
24
  } from "@makeswift/prop-controllers";
23
25
  function registerComponent(runtime) {
26
+ function isHiddenBasedOnMenuAnimation(props, deviceId) {
27
+ const mobileMenuAnimation = ResponsiveSelect.fromPropData(
28
+ props.mobileMenuAnimation
29
+ );
30
+ return !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, deviceId);
31
+ }
24
32
  return runtime.registerComponent(
25
33
  lazy(() => import("./Navigation")),
26
34
  {
@@ -67,7 +75,7 @@ function registerComponent(runtime) {
67
75
  checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
68
76
  ) === false
69
77
  })),
70
- logoAltText: Props.TextInput((props) => ({
78
+ logoAltText: TextInput((props) => ({
71
79
  label: "Logo alt text",
72
80
  hidden: getCheckboxPropControllerDataBoolean(
73
81
  checkboxPropControllerDataSchema.optional().catch(void 0).parse(props.showLogo)
@@ -101,7 +109,7 @@ function registerComponent(runtime) {
101
109
  step: 1,
102
110
  defaultValue: { value: 0, unit: "px" }
103
111
  }),
104
- mobileMenuAnimation: Props.ResponsiveSelect({
112
+ mobileMenuAnimation: ResponsiveSelect({
105
113
  label: "Mobile menu",
106
114
  options: [
107
115
  { value: "coverRight", label: "Cover from right" },
@@ -109,42 +117,24 @@ function registerComponent(runtime) {
109
117
  ]
110
118
  }),
111
119
  mobileMenuOpenIconColor: ResponsiveColor((props, device) => {
112
- const mobileMenuAnimation = props.mobileMenuAnimation;
113
- const hidden = !findBreakpointOverride(
114
- runtime.getBreakpoints(),
115
- mobileMenuAnimation,
116
- device
117
- );
118
120
  return {
119
121
  label: "Open icon color",
120
122
  placeholder: "rgba(161, 168, 194, 0.5)",
121
- hidden
123
+ hidden: isHiddenBasedOnMenuAnimation(props, device)
122
124
  };
123
125
  }),
124
126
  mobileMenuCloseIconColor: ResponsiveColor((props, device) => {
125
- const mobileMenuAnimation = props.mobileMenuAnimation;
126
- const hidden = !findBreakpointOverride(
127
- runtime.getBreakpoints(),
128
- mobileMenuAnimation,
129
- device
130
- );
131
127
  return {
132
128
  label: "Close icon color",
133
129
  placeholder: "rgba(161, 168, 194, 0.5)",
134
- hidden
130
+ hidden: isHiddenBasedOnMenuAnimation(props, device)
135
131
  };
136
132
  }),
137
133
  mobileMenuBackgroundColor: ResponsiveColor((props, device) => {
138
- const mobileMenuAnimation = props.mobileMenuAnimation;
139
- const hidden = !findBreakpointOverride(
140
- runtime.getBreakpoints(),
141
- mobileMenuAnimation,
142
- device
143
- );
144
134
  return {
145
135
  label: "Menu BG color",
146
136
  placeholder: "black",
147
- hidden
137
+ hidden: isHiddenBasedOnMenuAnimation(props, device)
148
138
  };
149
139
  }),
150
140
  width: Width({
@@ -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: Props.TextInput(props => ({\n label: 'Logo alt text',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n logoLink: Link(props => ({\n label: 'Logo on click',\n hidden:\n getCheckboxPropControllerDataBoolean(\n checkboxPropControllerDataSchema.optional().catch(undefined).parse(props.showLogo),\n ) === false,\n })),\n alignment: Props.ResponsiveIconRadioGroup({\n label: 'Alignment',\n options: [\n { label: 'Left', value: 'flex-start', icon: 'AlignLeft16' },\n { label: 'Center', value: 'center', icon: 'AlignCenter16' },\n { label: 'End', value: 'flex-end', icon: 'AlignRight16' },\n ],\n defaultValue: 'flex-end',\n }),\n gutter: GapX({\n preset: [\n {\n deviceId: getBaseBreakpoint(runtime.getBreakpoints()).id,\n value: { value: 10, unit: 'px' },\n },\n ],\n label: 'Link gap',\n min: 0,\n max: 100,\n step: 1,\n defaultValue: { value: 0, unit: 'px' },\n }),\n mobileMenuAnimation: Props.ResponsiveSelect({\n label: 'Mobile menu',\n options: [\n { value: 'coverRight', label: 'Cover from right' },\n { value: 'coverLeft', label: 'Cover from left' },\n ],\n }),\n mobileMenuOpenIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuCloseIconColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden,\n }\n }),\n mobileMenuBackgroundColor: ResponsiveColor((props, device) => {\n const mobileMenuAnimation = props.mobileMenuAnimation as\n | ResponsiveSelectValue<string>\n | undefined\n const hidden = !findBreakpointOverride(\n runtime.getBreakpoints(),\n mobileMenuAnimation,\n device,\n )\n\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden,\n }\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAGtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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BAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,0BAA0B,gBAAgB,CAAC,OAAO,WAAW;AAC3D,gBAAM,sBAAsB,MAAM;AAGlC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,2BAA2B,gBAAgB,CAAC,OAAO,WAAW;AAC5D,gBAAM,sBAAsB,MAAM;AAGlC,gBAAM,SAAS,CAAC;AAAA,YACd,QAAQ,eAAe;AAAA,YACvB;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb;AAAA,UACF;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM;AAAA,UACX,QAAQ,MAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,OAAO,EAAE,QAAQ,OAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/Navigation/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\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 ResponsiveSelect,\n ElementID,\n Image,\n TextInput,\n type PropData,\n} from '@makeswift/prop-controllers'\n\nexport function registerComponent(runtime: ReactRuntime) {\n function isHiddenBasedOnMenuAnimation(props: Record<string, unknown>, deviceId: string): boolean {\n const mobileMenuAnimation = ResponsiveSelect.fromPropData(\n props.mobileMenuAnimation as PropData<typeof ResponsiveSelect> | undefined,\n )\n\n return !findBreakpointOverride(runtime.getBreakpoints(), mobileMenuAnimation, deviceId)\n }\n\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: 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 return {\n label: 'Open icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden: isHiddenBasedOnMenuAnimation(props, device),\n }\n }),\n mobileMenuCloseIconColor: ResponsiveColor((props, device) => {\n return {\n label: 'Close icon color',\n placeholder: 'rgba(161, 168, 194, 0.5)',\n hidden: isHiddenBasedOnMenuAnimation(props, device),\n }\n }),\n mobileMenuBackgroundColor: ResponsiveColor((props, device) => {\n return {\n label: 'Menu BG color',\n placeholder: 'black',\n hidden: isHiddenBasedOnMenuAnimation(props, device),\n }\n }),\n width: Width({\n format: Width.Format.ClassName,\n defaultValue: { value: 100, unit: '%' },\n }),\n margin: Margin({ format: Margin.Format.ClassName }),\n },\n },\n )\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,wBAAwB,yBAAyB;AAC1D,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB;AAAA,EAC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O;AAAA,UACP,SAAS;AAAA,YACP,EAAE,OAAO,cAAc,OAAO,mBAAmB;AAAA,YACjD,EAAE,OAAO,aAAa,OAAO,kBAAkB;AAAA,UACjD;AAAA,QACF,CAAC;AAAA,QACD,yBAAyB,gBAAgB,CAAC,OAAO,WAAW;AAC1D,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb,QAAQ,6BAA6B,OAAO,MAAM;AAAA,UACpD;AAAA,QACF,CAAC;AAAA,QACD,0BAA0B,gBAAgB,CAAC,OAAO,WAAW;AAC3D,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb,QAAQ,6BAA6B,OAAO,MAAM;AAAA,UACpD;AAAA,QACF,CAAC;AAAA,QACD,2BAA2B,gBAAgB,CAAC,OAAO,WAAW;AAC5D,iBAAO;AAAA,YACL,OAAO;AAAA,YACP,aAAa;AAAA,YACb,QAAQ,6BAA6B,OAAO,MAAM;AAAA,UACpD;AAAA,QACF,CAAC;AAAA,QACD,OAAO,MAAM;AAAA,UACX,QAAQ,MAAM,OAAO;AAAA,UACrB,cAAc,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,QACxC,CAAC;AAAA,QACD,QAAQ,OAAO,EAAE,QAAQ,OAAO,OAAO,UAAU,CAAC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1 +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 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?: string\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":"AA+Ec;AA/Ed,SAAmC,kBAAuB;AAE1D,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,SAAS,0BAAiD;AAC1D,OAAO,qBAAqB;AAC5B,OAAO,4BAA4B;AAMnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,0BAA0B;AAoBnC,MAAM,cAAc,WAAW,SAASA,aACtC;AAAA,EACE;AA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AAG;AACL,GAAoB;AAClB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,SAAS;AAAA,UACP,SAAS;AAAA,UACT,OAAO;AAAA,UACP,YAAY;AAAA,UACZ,KAAK,EAAE,SAAS,QAAQ;AAAA,QAC1B,CAAC;AAAA,QACD;AAAA,UACE;AAAA,YACE,CAAC,OAAO,MAAM,YAAY,MAAM,eAAe;AAAA,YAC/C,CAAC,CAACC,SAAQ,SAASC,QAAO,UAAUC,cAAa,QAAQC,OAAMC,gBAAe,OAAO;AAAA,cACnF,SAASJ,WAAU,UAAU,IAAI,EAAE,OAAO,IAAI,QAAQ,IAAI,OAAO,GAAG,EAAEC,KAAI;AAAA,cAC1E,cAAc,EAAE,QAAQ,OAAO,SAAS,OAAO,OAAO,GAAG,QAAQ,EAAE,EAAED,MAAK;AAAA,cAC1E,YACEA,WAAU,UACN,gBACAI,oBAAmB,OACnB,iBACA,cAAcA,gBAAe;AAAA,cAEnC,UAAU;AAAA,gBACR,MAAM,CAAC;AAAA,gBACP,MAAM,EAAE,WAAW,aAAa;AAAA,gBAChC,QAAQ,EAAE,WAAW,aAAa;AAAA,gBAClC,MAAM,EAAE,SAAS,KAAK;AAAA,cACxB,EAAEF,WAAU;AAAA,cAEZ,KAAK;AAAA,gBACH,MACEC,SAAQ,OACJH,WAAU,WAAWI,oBAAmB,OACtC,iBACA,UACF,cAAcD,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"]}
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 { ResponsiveIconRadioGroupValue } 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 {\n type ResponsiveGapData,\n type ResponsiveValue,\n type ResponsiveSelectValue,\n} from '@makeswift/prop-controllers'\n\ntype Props = {\n id?: string\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 }[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BACxB,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,16 @@ 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 { ElementID, GapX, Margin, ResponsiveColor, Width } from "@makeswift/prop-controllers";
6
+ import {
7
+ ElementID,
8
+ GapX,
9
+ Margin,
10
+ ResponsiveColor,
11
+ ResponsiveSelect,
12
+ SocialLinks,
13
+ Width,
14
+ getSocialLinksPropControllerDataSocialLinksData
15
+ } from "@makeswift/prop-controllers";
7
16
  function registerComponent(runtime) {
8
17
  return runtime.registerComponent(
9
18
  lazy(() => import("./SocialLinks")),
@@ -13,7 +22,7 @@ function registerComponent(runtime) {
13
22
  icon: ComponentIcon.SocialLinks,
14
23
  props: {
15
24
  id: ElementID(),
16
- links: Props.SocialLinks({
25
+ links: SocialLinks({
17
26
  preset: {
18
27
  links: [
19
28
  {
@@ -33,7 +42,9 @@ function registerComponent(runtime) {
33
42
  }
34
43
  }),
35
44
  shape: Props.ResponsiveIconRadioGroup((props) => {
36
- const links = props.links;
45
+ const links = getSocialLinksPropControllerDataSocialLinksData(
46
+ props.links
47
+ );
37
48
  return {
38
49
  label: "Shape",
39
50
  options: [
@@ -47,7 +58,9 @@ function registerComponent(runtime) {
47
58
  };
48
59
  }),
49
60
  size: Props.ResponsiveIconRadioGroup((props) => {
50
- const links = props.links;
61
+ const links = getSocialLinksPropControllerDataSocialLinksData(
62
+ props.links
63
+ );
51
64
  return {
52
65
  label: "Size",
53
66
  options: [
@@ -59,8 +72,10 @@ function registerComponent(runtime) {
59
72
  hidden: links == null || links.links.length === 0
60
73
  };
61
74
  }),
62
- hoverStyle: Props.ResponsiveSelect((props) => {
63
- const links = props.links;
75
+ hoverStyle: ResponsiveSelect((props) => {
76
+ const links = getSocialLinksPropControllerDataSocialLinksData(
77
+ props.links
78
+ );
64
79
  const hidden = links == null || links.links.length === 0;
65
80
  return {
66
81
  label: "On hover",
@@ -76,7 +91,9 @@ function registerComponent(runtime) {
76
91
  };
77
92
  }),
78
93
  fill: ResponsiveColor((props) => {
79
- const links = props.links;
94
+ const links = getSocialLinksPropControllerDataSocialLinksData(
95
+ props.links
96
+ );
80
97
  const hidden = links == null || links.links.length === 0;
81
98
  return {
82
99
  label: "Icon color",
@@ -84,7 +101,9 @@ function registerComponent(runtime) {
84
101
  };
85
102
  }),
86
103
  backgroundColor: ResponsiveColor((props) => {
87
- const links = props.links;
104
+ const links = getSocialLinksPropControllerDataSocialLinksData(
105
+ props.links
106
+ );
88
107
  const hidden = links == null || links.links.length === 0;
89
108
  return {
90
109
  label: "Shape color",
@@ -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 { ElementID, 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: 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,WAAW,MAAM,QAAQ,iBAAiB,aAAa;AAEzD,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,UAAU;AAAA,QACd,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,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cACE,UAAU,kBAAkB,QAAQ,eAAe,CAAC,EAAE;AAAA,cACtD,OAAO;AAAA,gBACL,WAAW,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACnC,aAAa;AAAA,gBACb,cAAc,EAAE,OAAO,IAAI,MAAM,KAAK;AAAA,gBACtC,YAAY;AAAA,cACd;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/builtin/SocialLinks/register.ts"],"sourcesContent":["import { Props } from '../../../prop-controllers'\nimport { 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 ResponsiveSelect,\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: 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,SAAS,aAAa;AAEtB,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AAEA,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,UAAU;AAAA,QACd,OAAO,YAAY;AAAA,UACjB,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;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AQ,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":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ getTextInputPropControllerDataString
3
+ } from "@makeswift/prop-controllers";
4
+ function useTextInputPropControllerData(data) {
5
+ return getTextInputPropControllerDataString(data);
6
+ }
7
+ export {
8
+ useTextInputPropControllerData
9
+ };
10
+ //# 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,EAEE;AAAA,OACK;AAEA,SAAS,+BACd,MACoB;AACpB,SAAO,qCAAqC,IAAI;AAClD;","names":[]}
@@ -27,7 +27,6 @@ import {
27
27
  mergeSlotData,
28
28
  SlotControlType
29
29
  } from "./slot";
30
- import { Types } from "../prop-controllers/descriptors";
31
30
  import {
32
31
  Types as PropControllerTypes,
33
32
  mergeGridPropControllerTranslatedData
@@ -100,7 +99,7 @@ function merge(definition, a, b = a, context) {
100
99
  }
101
100
  function getTranslatableData(definition, data) {
102
101
  switch (definition.type) {
103
- case Types.TextInput:
102
+ case PropControllerTypes.TextInput:
104
103
  case PropControllerTypes.TextArea:
105
104
  case TextInputControlType:
106
105
  case TextAreaControlType:
@@ -126,7 +125,7 @@ function mergeTranslatedData(definition, data, translatedData, context) {
126
125
  if (data == null)
127
126
  return data;
128
127
  switch (definition.type) {
129
- case Types.TextInput:
128
+ case PropControllerTypes.TextInput:
130
129
  case PropControllerTypes.TextArea:
131
130
  case TextInputControlType:
132
131
  case 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,\n )\n\n default:\n return data\n }\n}\n"],"mappings":"AAAA;AAAA,EAGE;AAAA,EAGA;AAAA,EAGA;AAAA,EASA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAC9B;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,eAAyD,wBAAwB;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAEP,SAAqB,aAAa;AAClC;AAAA,EAEE,SAAS;AAAA,EACT;AAAA,O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;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IAEF;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
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,EAGE;AAAA,EAGA;AAAA,EAGA;AAAA,EASA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAC9B;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,eAAyD,wBAAwB;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AAGP;AAAA,EAEE,SAAS;AAAA,EACT;AAAA,OACK;AACP,SAAS,QAAQ,0BAA0B;AAE3C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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.18.0-canary.4",
16
+ version: "0.18.0-canary.6",
17
17
  previewMode: supportsPreviewMode,
18
18
  draftMode: supportsDraftMode,
19
19
  interactionMode: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/next/components/tests/page-prop-controller.tsx"],"sourcesContent":["/** @jest-environment jsdom */\n\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\n\nimport { Types, type Descriptor, type PropDef, type Value } from '@makeswift/prop-controllers'\n\nimport { type ElementData, type ComponentType } from '../../../state/react-page'\nimport { randomUUID } from 'crypto'\n\nimport { Page } from '../page'\nimport { act } from 'react-dom/test-utils'\nimport { ReactRuntimeProvider } from '../../context/react-runtime'\nimport { ReactRuntime } from '../../../react'\nimport {\n createMakeswiftPageSnapshot,\n createRootComponent,\n} from '../../../utils/tests/element-data-test-test'\n\nexport const pagePropControllerTest = <\n P extends PropDef,\n C extends ComponentType<{ propKey: Value<PropDef> | undefined }>,\n>(\n propDef: P,\n value: Value<typeof propDef>,\n component: (testId: string) => C,\n assert: (element: HTMLElement) => void,\n) =>\n describe('Page', () => {\n test(`can render ${propDef.type} v0 data`, async () => {\n // Arrange\n const descriptorV0: Descriptor<typeof propDef> = {\n type: propDef.type,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n\n const elementData: ElementData = createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, descriptorV0),\n },\n },\n ])\n const snapshot = createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(),\n },\n })\n\n await act(async () =>\n render(\n <ReactRuntimeProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </ReactRuntimeProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n\n test(`can render ${propDef.type} v1 data`, async () => {\n // Arrange\n const gapXDefinitionV1: Descriptor<typeof propDef> = {\n type: Types.GapX,\n version: 1,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n const elementData: ElementData = createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, gapXDefinitionV1),\n },\n },\n ])\n const snapshot = createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(),\n },\n })\n\n await act(async () =>\n render(\n <ReactRuntimeProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </ReactRuntimeProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n })\n"],"mappings":"AA8DY;AA5DZ,SAAS,QAAQ,cAAc;AAC/B,OAAO;AAEP,SAAS,aAAwD;AAGjE,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,yBAAyB,CAIpC,SACA,OACA,WACA,WAEA,SAAS,QAAQ,MAAM;AACrB,OAAK,cAAc,QAAQ,IAAI,YAAY,YAAY;AAErD,UAAM,eAA2C;AAAA,MAC/C,MAAM,QAAQ;AAAA,MACd,SAAS,CAAC;AAAA,IACZ;AAEA,UAAM,oBAAoB;AAC1B,UAAM,SAAS;AAEf,UAAM,cAA2B,oBAAoB;AAAA,MACnD;AAAA,QACE,KAAK,WAAW;AAAA,QAChB,MAAM;AAAA,QACN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../../../src/next/components/tests/page-prop-controller.tsx"],"sourcesContent":["/** @jest-environment jsdom */\n\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\n\nimport { Types, type Descriptor, type PropDef, type Value } from '@makeswift/prop-controllers'\n\nimport { type ElementData, type ComponentType } from '../../../state/react-page'\nimport { randomUUID } from 'crypto'\n\nimport { Page } from '../page'\nimport { act } from 'react-dom/test-utils'\nimport { ReactRuntimeProvider } from '../../context/react-runtime'\nimport { ReactRuntime } from '../../../react'\nimport {\n createMakeswiftPageSnapshot,\n createRootComponent,\n} from '../../../utils/tests/element-data-test-test'\n\nexport const pagePropControllerTest = <\n P extends PropDef & (() => any),\n C extends ComponentType<{ propKey: Value<P> | undefined }>,\n>(\n propDef: P,\n value: Value<typeof propDef>,\n component: (testId: string) => C,\n assert: (element: HTMLElement) => void,\n) =>\n describe('Page', () => {\n test(`can render ${propDef.type} v0 data`, async () => {\n // Arrange\n const descriptorV0: Descriptor<typeof propDef> = {\n type: propDef.type,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n\n const elementData: ElementData = createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, descriptorV0),\n },\n },\n ])\n const snapshot = createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(),\n },\n })\n\n await act(async () =>\n render(\n <ReactRuntimeProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </ReactRuntimeProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n\n test(`can render ${propDef.type} v1 data`, async () => {\n // Arrange\n const gapXDefinitionV1: Descriptor<typeof propDef> = {\n type: Types.GapX,\n version: 1,\n options: {},\n }\n\n const TestComponentType = 'TestComponent'\n const testId = 'test-id'\n const elementData: ElementData = createRootComponent([\n {\n key: randomUUID(),\n type: TestComponentType,\n props: {\n propKey: propDef.toPropData(value, gapXDefinitionV1),\n },\n },\n ])\n const snapshot = createMakeswiftPageSnapshot(elementData)\n const runtime = new ReactRuntime()\n\n runtime.registerComponent(component(testId), {\n type: TestComponentType,\n label: 'TestComponent',\n props: {\n propKey: propDef(),\n },\n })\n\n await act(async () =>\n render(\n <ReactRuntimeProvider runtime={runtime}>\n <Page snapshot={snapshot} />\n </ReactRuntimeProvider>,\n ),\n )\n\n assert(screen.getByTestId(testId))\n })\n })\n"],"mappings":"AA8DY;AA5DZ,SAAS,QAAQ,cAAc;AAC/B,OAAO;AAEP,SAAS,aAAwD;AAGjE,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,MAAM,yBAAyB,CAIpC,SACA,OACA,WACA,WAEA,SAAS,QAAQ,MAAM;AACrB,OAAK,cAAc,QAAQ,IAAI,YAAY,YAAY;AAErD,UAAM,eAA2C;AAAA,MAC/C,MAAM,QAAQ;AAAA,MACd,SAAS,CAAC;AAAA,IACZ;AAEA,UAAM,oBAAoB;AAC1B,UAAM,SAAS;AAEf,UAAM,cAA2B,oBAAoB;AAAA,MACnD;AAAA,QACE,KAAK,WAAW;AAAA,QAChB,MAAM;AAAA,QACN,OAAO;AAAA,UACL,SAAS,QAAQ,WAAW,OAAO,YAAY;AAAA,QACjD;AAAA,MACF;AAAA,IACF,CAAC;AACD,UAAM,WAAW,4BAA4B,WAAW;AACxD,UAAM,UAAU,IAAI,aAAa;AAEjC,YAAQ,kBAAkB,UAAU,MAAM,GAAG;AAAA,MAC3C,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,QACL,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF,CAAC;AAED,UAAM;AAAA,MAAI,YACR;AAAA,QACE,oBAAC,wBAAqB,SACpB,8BAAC,QAAK,UAAoB,GAC5B;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,YAAY,MAAM,CAAC;AAAA,EACnC,CAAC;AAED,OAAK,cAAc,QAAQ,IAAI,YAAY,YAAY;AAErD,UAAM,mBAA+C;AAAA,MACnD,MAAM,MAAM;AAAA,MACZ,SAAS;AAAA,MACT,SAAS,CAAC;AAAA,IACZ;AAEA,UAAM,oBAAoB;AAC1B,UAAM,SAAS;AACf,UAAM,cAA2B,oBAAoB;AAAA,MACnD;AAAA,QACE,KAAK,WAAW;AAAA,QAChB,MAAM;AAAA,QACN,OAAO;AAAA,UACL,SAAS,QAAQ,WAAW,OAAO,gBAAgB;AAAA,QACrD;AAAA,MACF;AAAA,IACF,CAAC;AACD,UAAM,WAAW,4BAA4B,WAAW;AACxD,UAAM,UAAU,IAAI,aAAa;AAEjC,YAAQ,kBAAkB,UAAU,MAAM,GAAG;AAAA,MAC3C,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,QACL,SAAS,QAAQ;AAAA,MACnB;AAAA,IACF,CAAC;AAED,UAAM;AAAA,MAAI,YACR;AAAA,QACE,oBAAC,wBAAqB,SACpB,8BAAC,QAAK,UAAoB,GAC5B;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,YAAY,MAAM,CAAC;AAAA,EACnC,CAAC;AACH,CAAC;","names":[]}
@@ -1,56 +1,13 @@
1
1
  import { StyleControlType } from "../controls/style";
2
2
  const Types = {
3
3
  ResponsiveIconRadioGroup: "ResponsiveIconRadioGroup",
4
- ResponsiveSelect: "ResponsiveSelect",
5
- SocialLinks: "SocialLinks",
6
- TextInput: "TextInput",
7
4
  Style: StyleControlType
8
5
  };
9
6
  function ResponsiveIconRadioGroup(options) {
10
7
  return { type: Types.ResponsiveIconRadioGroup, options };
11
8
  }
12
- function ResponsiveSelect(options) {
13
- return { type: Types.ResponsiveSelect, options };
14
- }
15
- const socialLinkTypesV0 = [
16
- "angellist",
17
- "codepen",
18
- "discord",
19
- "dribbble",
20
- "facebook",
21
- "github",
22
- "instagram",
23
- "linkedin",
24
- "medium",
25
- "pinterest",
26
- "reddit",
27
- "rss",
28
- "snapchat",
29
- "soundcloud",
30
- "spotify",
31
- "telegram",
32
- "tumblr",
33
- "twitch",
34
- "twitter",
35
- "vimeo",
36
- "whatsapp",
37
- "yelp",
38
- "youtube"
39
- ];
40
- const socialLinkTypesV1 = [...socialLinkTypesV0, "x", "slack"];
41
- function SocialLinks(options = {}) {
42
- return { type: Types.SocialLinks, options, version: 1 };
43
- }
44
- function TextInput(options = {}) {
45
- return { type: Types.TextInput, options };
46
- }
47
9
  export {
48
10
  ResponsiveIconRadioGroup,
49
- ResponsiveSelect,
50
- SocialLinks,
51
- TextInput,
52
- Types,
53
- socialLinkTypesV0,
54
- socialLinkTypesV1
11
+ Types
55
12
  };
56
13
  //# sourceMappingURL=descriptors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/prop-controllers/descriptors.ts"],"sourcesContent":["import {\n CheckboxControlDefinition,\n IconRadioGroupControlDefinition,\n NumberControlDefinition,\n TextInputControlDefinition,\n TextAreaControlDefinition,\n} from '@makeswift/controls'\nimport { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Data } from '../state/react-page'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\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 } 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 { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkDescriptor,\n ResolveLinkPropControllerValue,\n Types as PropControllerTypes,\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 GapX,\n ResponsiveNumber,\n ResolveGapYPropControllerValue,\n GapYDescriptor,\n ElementIDDescriptor,\n ResolveElementIDPropControllerValue,\n TableFormFieldsDescriptor,\n ResolveTableFormFieldsPropControllerValue,\n GridDescriptor,\n ResolveGridPropControllerValue,\n ImageDescriptor,\n ResolveImagePropControllerValue,\n ImagesDescriptor,\n ResolveImagesPropControllerValue,\n BackgroundsDescriptor,\n ResolveBackgroundsPropControllerValue,\n type Descriptor as PropDescriptor,\n type Value as PropValue,\n ResponsiveOpacity,\n} from '@makeswift/prop-controllers'\nimport { DeletedPropControllerDescriptor } from './deleted'\n\nexport type { Data }\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 ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n ResponsiveSelect: 'ResponsiveSelect',\n SocialLinks: 'SocialLinks',\n TextInput: 'TextInput',\n Style: StyleControlType,\n} as const\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 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 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\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 | DeletedPropControllerDescriptor<T>\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | PropDescriptor<typeof GapX>\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 | PropDescriptor<typeof ResponsiveNumber>\n | PropDescriptor<typeof ResponsiveOpacity>\n | ResponsiveSelectDescriptor<\n T extends ResponsiveSelectValue<string> ? T : ResponsiveSelectValue<string>\n >\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 PropControllerTypes.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 PropControllerTypes.Images\n | typeof PropControllerTypes.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof PropControllerTypes.TextArea\n | typeof PropControllerTypes.Table\n | typeof PropControllerTypes.Image\n | typeof PropControllerTypes.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.Backgrounds\n ? ResolveBackgroundsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.Backgrounds }>\n >\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.ElementID\n ? ResolveElementIDPropControllerValue<Extract<T, { type: typeof PropControllerTypes.ElementID }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.GapX\n ? PropValue<T> | undefined\n : T['type'] extends typeof PropControllerTypes.GapY\n ? ResolveGapYPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapY }>>\n : T['type'] extends typeof PropControllerTypes.Grid\n ? ResolveGridPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Grid }>>\n : T['type'] extends typeof PropControllerTypes.Image\n ? ResolveImagePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Image }>>\n : T['type'] extends typeof PropControllerTypes.Images\n ? ResolveImagesPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Images }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveNumber\n ? PropValue<T> | undefined\n : T['type'] extends typeof PropControllerTypes.ResponsiveOpacity\n ? PropValue<T> | undefined\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.TableFormFields\n ? ResolveTableFormFieldsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.TableFormFields }>\n >\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":"AAWA,SAAS,wBAAwB;AAiI1B,MAAM,QAAQ;AAAA,EACnB,0BAA0B;AAAA,EAC1B,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AACT;AA4BO,SAAS,yBACd,SACsE;AACtE,SAAO,EAAE,MAAM,MAAM,0BAA0B,QAAQ;AACzD;AA+BO,SAAS,iBACd,SACsD;AACtD,SAAO,EAAE,MAAM,MAAM,kBAAkB,QAAQ;AACjD;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;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 {\n CheckboxControlDefinition,\n IconRadioGroupControlDefinition,\n NumberControlDefinition,\n TextInputControlDefinition,\n TextAreaControlDefinition,\n} from '@makeswift/controls'\nimport { ResponsiveColor } from '../runtimes/react/controls'\nimport { StyleControlFormattedValue } from '../runtimes/react/controls/style'\nimport type { Data } from '../state/react-page'\nimport { NumberControlValue } from '../runtimes/react/controls/number'\nimport { StyleControlType } from '../controls/style'\nimport {\n ColorControlDefinition,\n ComboboxControlDefinition,\n ImageControlDefinition,\n LinkControlDefinition,\n ListControlDefinition,\n SelectControlDefinition,\n ShapeControlDefinition,\n SlotControlDefinition,\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 } 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 { IconRadioGroupControlValue } from '../runtimes/react/controls/icon-radio-group'\nimport { TypographyControlValue } from '../runtimes/react/controls/typography'\nimport {\n BorderDescriptor,\n CheckboxDescriptor,\n LinkDescriptor,\n ResolveLinkPropControllerValue,\n Types as PropControllerTypes,\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 GapX,\n ResponsiveNumber,\n ResponsiveSelect,\n ResolveGapYPropControllerValue,\n GapYDescriptor,\n ElementIDDescriptor,\n ResolveElementIDPropControllerValue,\n TableFormFieldsDescriptor,\n ResolveTableFormFieldsPropControllerValue,\n GridDescriptor,\n ResolveGridPropControllerValue,\n ImageDescriptor,\n ResolveImagePropControllerValue,\n ImagesDescriptor,\n ResolveImagesPropControllerValue,\n BackgroundsDescriptor,\n ResolveBackgroundsPropControllerValue,\n type Descriptor as PropDescriptor,\n type Value as PropValue,\n ResponsiveOpacity,\n ResolveSocialLinksPropControllerValue,\n SocialLinksDescriptor,\n TextInputDescriptor,\n ResolveTextInputPropControllerValue,\n} from '@makeswift/prop-controllers'\nimport { DeletedPropControllerDescriptor } from './deleted'\n\nexport type { Data }\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 ResponsiveIconRadioGroup: 'ResponsiveIconRadioGroup',\n Style: StyleControlType,\n} as const\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 Descriptor<T extends Data = Data> =\n | DeletedPropControllerDescriptor<T>\n | BackgroundsDescriptor<T>\n | BorderDescriptor<T>\n | BorderRadiusDescriptor<T>\n | CheckboxDescriptor<T>\n | DateDescriptor<T>\n | ElementIDDescriptor<T>\n | FontDescriptor<T>\n | PropDescriptor<typeof GapX>\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 | PropDescriptor<typeof ResponsiveNumber>\n | PropDescriptor<typeof ResponsiveOpacity>\n | PropDescriptor<typeof ResponsiveSelect>\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 PropControllerTypes.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 PropControllerTypes.TextInput\n | typeof PropControllerTypes.Link\n | typeof PropControllerTypes.ResponsiveSelect\n | typeof PropControllerTypes.ResponsiveColor\n | typeof PropControllerTypes.TextStyle\n | typeof PropControllerTypes.Images\n | typeof PropControllerTypes.ResponsiveNumber\n | typeof PropControllerTypes.Number\n | typeof PropControllerTypes.Date\n | typeof PropControllerTypes.Font\n | typeof PropControllerTypes.TextArea\n | typeof PropControllerTypes.Table\n | typeof PropControllerTypes.Image\n | typeof PropControllerTypes.ResponsiveOpacity\n | typeof PropControllerTypes.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.Backgrounds\n ? ResolveBackgroundsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.Backgrounds }>\n >\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.ElementID\n ? ResolveElementIDPropControllerValue<Extract<T, { type: typeof PropControllerTypes.ElementID }>>\n : T['type'] extends typeof PropControllerTypes.Font\n ? ResolveFontPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Font }>>\n : T['type'] extends typeof PropControllerTypes.GapX\n ? PropValue<T> | undefined\n : T['type'] extends typeof PropControllerTypes.GapY\n ? ResolveGapYPropControllerValue<Extract<T, { type: typeof PropControllerTypes.GapY }>>\n : T['type'] extends typeof PropControllerTypes.Grid\n ? ResolveGridPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Grid }>>\n : T['type'] extends typeof PropControllerTypes.Image\n ? ResolveImagePropControllerValue<Extract<T, { type: typeof PropControllerTypes.Image }>>\n : T['type'] extends typeof PropControllerTypes.Images\n ? ResolveImagesPropControllerValue<Extract<T, { type: typeof PropControllerTypes.Images }>>\n : T['type'] extends typeof PropControllerTypes.ResponsiveNumber\n ? PropValue<T> | undefined\n : T['type'] extends typeof PropControllerTypes.ResponsiveOpacity\n ? PropValue<T> | undefined\n : T['type'] extends typeof PropControllerTypes.ResponsiveSelect\n ? PropValue<T> | undefined\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.SocialLinks\n ? ResolveSocialLinksPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.SocialLinks }>\n >\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.TableFormFields\n ? ResolveTableFormFieldsPropControllerValue<\n Extract<T, { type: typeof PropControllerTypes.TableFormFields }>\n >\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.TextInput\n ? ResolveTextInputPropControllerValue<Extract<T, { type: typeof PropControllerTypes.TextInput }>>\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":"AAWA,SAAS,wBAAwB;AAsI1B,MAAM,QAAQ;AAAA,EACnB,0BAA0B;AAAA,EAC1B,OAAO;AACT;AA4BO,SAAS,yBACd,SACsE;AACtE,SAAO,EAAE,MAAM,MAAM,0BAA0B,QAAQ;AACzD;","names":[]}
@@ -1,4 +1,3 @@
1
- import { socialLinkTypesV0, socialLinkTypesV1 } from "./descriptors";
2
1
  import * as Props from "./descriptors";
3
2
  import { RichTextPropControllerMessageType, TableFormFieldsMessageType } from "./instances";
4
3
  import * as Introspection from "./introspection";
@@ -8,8 +7,6 @@ export {
8
7
  Introspection,
9
8
  Props,
10
9
  RichTextPropControllerMessageType,
11
- TableFormFieldsMessageType,
12
- socialLinkTypesV0,
13
- socialLinkTypesV1
10
+ TableFormFieldsMessageType
14
11
  };
15
12
  //# sourceMappingURL=index.js.map
@@ -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 ResponsiveIconRadioGroupDescriptor,\n ResponsiveIconRadioGroupValue,\n ResponsiveSelectDescriptor,\n ResponsiveSelectValue,\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 { DELETED_PROP_CONTROLLER_TYPES } from './deleted'\n"],"mappings":"AAsBA,SAAS,mBAAmB,yBAAyB;AACrD,YAAY,WAAW;AAMvB,SAAS,mCAAmC,kCAAkC;AAC9E,YAAY,mBAAmB;AAC/B,SAAS,qCAAqC;","names":[]}
1
+ {"version":3,"sources":["../../../src/prop-controllers/index.ts"],"sourcesContent":["export type {\n Data,\n Descriptor as PropControllerDescriptor,\n DescriptorValueType as PropControllerDescriptorValueType,\n ResponsiveIconRadioGroupDescriptor,\n ResponsiveIconRadioGroupValue,\n PanelDescriptor,\n PanelDescriptorType,\n PanelDescriptorValueType,\n} from './descriptors'\nexport type {\n ResponsiveValueType,\n Device,\n DeviceOverride,\n ResponsiveValue,\n} from '@makeswift/prop-controllers'\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 { DELETED_PROP_CONTROLLER_TYPES } from './deleted'\n"],"mappings":"AAgBA,YAAY,WAAW;AAMvB,SAAS,mCAAmC,kCAAkC;AAC9E,YAAY,mBAAmB;AAC/B,SAAS,qCAAqC;","names":[]}