@makeswift/runtime 0.0.0-646104a → 0.0.0-76a2297

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 (96) hide show
  1. package/dist/Page.cjs.js +215 -0
  2. package/dist/Page.cjs.js.map +1 -0
  3. package/dist/Page.es.js +209 -0
  4. package/dist/Page.es.js.map +1 -0
  5. package/dist/actions.cjs.js +5 -0
  6. package/dist/actions.cjs.js.map +1 -1
  7. package/dist/actions.es.js +5 -1
  8. package/dist/actions.es.js.map +1 -1
  9. package/dist/components.cjs.js +14 -1
  10. package/dist/components.cjs.js.map +1 -1
  11. package/dist/components.es.js +6 -2
  12. package/dist/components.es.js.map +1 -1
  13. package/dist/control-serialization.cjs.js +61 -5
  14. package/dist/control-serialization.cjs.js.map +1 -1
  15. package/dist/control-serialization.es.js +61 -5
  16. package/dist/control-serialization.es.js.map +1 -1
  17. package/dist/descriptors.cjs.js +6 -0
  18. package/dist/descriptors.cjs.js.map +1 -1
  19. package/dist/descriptors.es.js +6 -1
  20. package/dist/descriptors.es.js.map +1 -1
  21. package/dist/main.cjs.js +1 -0
  22. package/dist/main.cjs.js.map +1 -1
  23. package/dist/main.es.js +1 -1
  24. package/dist/next.cjs.js +36 -17
  25. package/dist/next.cjs.js.map +1 -1
  26. package/dist/next.es.js +37 -18
  27. package/dist/next.es.js.map +1 -1
  28. package/dist/react-builder-preview.cjs.js +3 -0
  29. package/dist/react-builder-preview.cjs.js.map +1 -1
  30. package/dist/react-builder-preview.es.js +4 -1
  31. package/dist/react-builder-preview.es.js.map +1 -1
  32. package/dist/react-page.cjs.js +1 -1
  33. package/dist/react-page.cjs.js.map +1 -1
  34. package/dist/react-page.es.js +2 -2
  35. package/dist/react-page.es.js.map +1 -1
  36. package/dist/react.cjs.js +4 -1
  37. package/dist/react.cjs.js.map +1 -1
  38. package/dist/react.cjs2.js +278 -83
  39. package/dist/react.cjs2.js.map +1 -1
  40. package/dist/react.es.js +4 -1
  41. package/dist/react.es.js.map +1 -1
  42. package/dist/react.es2.js +268 -82
  43. package/dist/react.es2.js.map +1 -1
  44. package/dist/types/api/react.d.ts +22 -4
  45. package/dist/types/api/react.d.ts.map +1 -1
  46. package/dist/types/builder/serialization/control-serialization.d.ts +55 -7
  47. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  48. package/dist/types/components/builtin/Form/prop-controllers.d.ts +1 -0
  49. package/dist/types/components/builtin/Form/prop-controllers.d.ts.map +1 -0
  50. package/dist/types/components/builtin/Video/Video.d.ts +15 -0
  51. package/dist/types/components/builtin/Video/Video.d.ts.map +1 -0
  52. package/dist/types/components/builtin/Video/index.d.ts +2 -0
  53. package/dist/types/components/builtin/Video/index.d.ts.map +1 -0
  54. package/dist/types/components/builtin/Video/prop-controllers.d.ts +50 -0
  55. package/dist/types/components/builtin/Video/prop-controllers.d.ts.map +1 -0
  56. package/dist/types/components/builtin/index.d.ts.map +1 -1
  57. package/dist/types/components/hooks/useTableWorkspace.d.ts +14 -0
  58. package/dist/types/components/hooks/useTableWorkspace.d.ts.map +1 -0
  59. package/dist/types/components/index.d.ts +2 -0
  60. package/dist/types/components/index.d.ts.map +1 -1
  61. package/dist/types/components/page/BodySnippet.d.ts +7 -0
  62. package/dist/types/components/page/BodySnippet.d.ts.map +1 -0
  63. package/dist/types/components/page/Page.d.ts +45 -0
  64. package/dist/types/components/page/Page.d.ts.map +1 -0
  65. package/dist/types/components/page/index.d.ts +2 -0
  66. package/dist/types/components/page/index.d.ts.map +1 -0
  67. package/dist/types/components/utils/layout.d.ts +16 -0
  68. package/dist/types/components/utils/layout.d.ts.map +1 -0
  69. package/dist/types/components/utils/placeholders.d.ts +7 -0
  70. package/dist/types/components/utils/placeholders.d.ts.map +1 -1
  71. package/dist/types/components/utils/pollAnimationFrame.d.ts +2 -0
  72. package/dist/types/components/utils/pollAnimationFrame.d.ts.map +1 -0
  73. package/dist/types/components/utils/pollElementLayout.d.ts +8 -0
  74. package/dist/types/components/utils/pollElementLayout.d.ts.map +1 -0
  75. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts +4 -0
  76. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts.map +1 -0
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/index.d.ts.map +1 -1
  79. package/dist/types/next.d.ts +5 -4
  80. package/dist/types/next.d.ts.map +1 -1
  81. package/dist/types/prop-controllers/descriptors.d.ts +23 -5
  82. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  83. package/dist/types/prop-controllers/index.d.ts +1 -1
  84. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  85. package/dist/types/runtimes/page.d.ts +9 -0
  86. package/dist/types/runtimes/page.d.ts.map +1 -0
  87. package/dist/types/runtimes/react.d.ts +3 -3
  88. package/dist/types/runtimes/react.d.ts.map +1 -1
  89. package/dist/types/state/actions.d.ts +9 -1
  90. package/dist/types/state/actions.d.ts.map +1 -1
  91. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  92. package/dist/types/utils/get-redirect-match.d.ts +10 -0
  93. package/dist/types/utils/get-redirect-match.d.ts.map +1 -0
  94. package/dist/types/utils/get-redirect-match.test.d.ts +1 -0
  95. package/dist/types/utils/get-redirect-match.test.d.ts.map +1 -0
  96. package/package.json +2 -1
package/dist/react.es2.js CHANGED
@@ -29,25 +29,32 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
+ var __publicField = (obj, key, value) => {
33
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
+ return value;
35
+ };
32
36
  import * as React from "react";
33
37
  import { forwardRef, createContext, useContext, useMemo, useState, useLayoutEffect, useCallback, useEffect, useRef, useImperativeHandle, Children, createElement, Fragment as Fragment$1, memo } from "react";
34
38
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
35
39
  import { gql, useQuery as useQuery$1, useMutation as useMutation$1, ApolloClient, InMemoryCache } from "@apollo/client";
36
- import { g as getIsInBuilder, a as configureStore, b as getElementId, d as getReactComponent, e as getDocument, i as isElementReference } from "./react-page.es.js";
40
+ import { a as createDocumentReference, g as getIsInBuilder, b as configureStore, d as getElementId, e as getReactComponent, f as getDocument, i as isElementReference } from "./react-page.es.js";
37
41
  import { f as registerComponentHandleEffect, g as mountComponentEffect, h as registerComponentEffect, j as registerReactComponentEffect } from "./actions.es.js";
38
42
  import styled, { css, keyframes, createGlobalStyle } from "styled-components";
39
43
  import { useReducedMotion, useAnimation, motion } from "framer-motion";
44
+ import { getDataFromTree } from "@apollo/client/react/ssr";
45
+ import uuid from "uuid/v4";
40
46
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
47
+ import "html-react-parser";
48
+ import "next/head";
41
49
  import { p as parse, c as createBox, g as getBox } from "./box-models.es.js";
42
50
  import NextImage from "next/image";
43
51
  import ReactPlayer from "react-player";
44
- import { E as ElementID, B as Backgrounds$1, W as Width, R as ResponsiveIconRadioGroup, M as Margin, P as Padding, a as Border, b as BorderRadius, S as Shadows, G as GapY, c as GapX, e as ResponsiveSelect, f as ResponsiveNumber, C as Checkbox$1, g as Grid$2, h as TextInput, L as Link$1, i as ResponsiveColor, j as TextStyle, I as Image$1, k as ResponsiveOpacity, l as Images, N as Number$1, D as Date$1, F as Font, m as ResponsiveLength, n as TextArea$1, o as Table, p as TableFormFields, q as NavigationLinks, r as SocialLinks$1, s as RichText } from "./descriptors.es.js";
52
+ import { E as ElementID, B as Backgrounds$1, W as Width, R as ResponsiveIconRadioGroup, M as Margin, P as Padding, a as Border, b as BorderRadius, S as Shadows, G as GapY, c as GapX, e as ResponsiveSelect, f as ResponsiveNumber, C as Checkbox$1, g as Grid$2, h as TextInput, L as Link$1, i as ResponsiveColor, j as TextStyle, I as Image$1, k as ResponsiveOpacity, l as Images, N as Number$1, D as Date$1, F as Font, m as ResponsiveLength, n as TextArea$1, o as Table, p as TableFormFields, q as NavigationLinks, r as SocialLinks$1, s as RichText, V as Video$1 } from "./descriptors.es.js";
45
53
  import ColorHelper from "color";
46
54
  import scrollIntoView from "scroll-into-view-if-needed";
47
55
  import NextLink from "next/link";
48
56
  import { useGesture } from "react-use-gesture";
49
57
  import { wrap } from "@popmotion/popcorn";
50
- import uuid from "uuid/v4";
51
58
  import { Field as Field$1, getIn, Formik } from "formik";
52
59
  import { normalize } from "polished";
53
60
  import { Value } from "slate";
@@ -205,20 +212,126 @@ const TABLE_BY_ID = gql`
205
212
  function isNonNullable(value) {
206
213
  return value != null;
207
214
  }
215
+ const typePolicies = {
216
+ Query: {
217
+ fields: {
218
+ swatches(existingData, {
219
+ args,
220
+ toReference
221
+ }) {
222
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
223
+ __typename: "Swatch",
224
+ id
225
+ }, true));
226
+ },
227
+ file(existingData, {
228
+ args,
229
+ toReference
230
+ }) {
231
+ return existingData != null ? existingData : toReference({
232
+ __typename: "File",
233
+ id: args == null ? void 0 : args.id
234
+ }, true);
235
+ },
236
+ files(existingData, {
237
+ args,
238
+ toReference
239
+ }) {
240
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
241
+ __typename: "File",
242
+ id
243
+ }, true));
244
+ },
245
+ typographies(existingData, {
246
+ args,
247
+ toReference
248
+ }) {
249
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
250
+ __typename: "Typography",
251
+ id
252
+ }, true));
253
+ },
254
+ pagePathnamesById(existingData, {
255
+ args,
256
+ toReference
257
+ }) {
258
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
259
+ __typename: "PagePathnameSlice",
260
+ id
261
+ }, true));
262
+ },
263
+ globalElement(existingData, {
264
+ args,
265
+ toReference
266
+ }) {
267
+ return existingData != null ? existingData : toReference({
268
+ __typename: "GlobalElement",
269
+ id: args == null ? void 0 : args.id
270
+ }, true);
271
+ },
272
+ table(existingData, {
273
+ args,
274
+ toReference
275
+ }) {
276
+ return existingData != null ? existingData : toReference({
277
+ __typename: "Table",
278
+ id: args == null ? void 0 : args.id
279
+ }, true);
280
+ }
281
+ }
282
+ }
283
+ };
284
+ function createApolloClient({
285
+ uri,
286
+ cacheData
287
+ }) {
288
+ const cache = new InMemoryCache({
289
+ typePolicies
290
+ });
291
+ if (cacheData)
292
+ cache.restore(cacheData);
293
+ return new ApolloClient({
294
+ uri,
295
+ cache
296
+ });
297
+ }
298
+ class MakeswiftClient {
299
+ constructor({
300
+ uri,
301
+ cacheData
302
+ }) {
303
+ __publicField(this, "apolloClient");
304
+ this.apolloClient = createApolloClient({
305
+ uri,
306
+ cacheData
307
+ });
308
+ }
309
+ async prefetch(element) {
310
+ const id = uuid();
311
+ await getDataFromTree(/* @__PURE__ */ jsx(RuntimeProvider, {
312
+ client: this,
313
+ defaultRootElements: /* @__PURE__ */ new Map([[id, element]]),
314
+ children: /* @__PURE__ */ jsx(DocumentReference, {
315
+ documentReference: createDocumentReference(id)
316
+ })
317
+ }));
318
+ return this.apolloClient.cache.extract();
319
+ }
320
+ }
208
321
  const Context$2 = createContext(void 0);
209
322
  function useQuery(query, options) {
210
323
  const client = useContext(Context$2);
211
324
  return useQuery$1(query, __spreadValues({
212
- client
325
+ client: client == null ? void 0 : client.apolloClient
213
326
  }, options));
214
327
  }
215
328
  function useMutation(mutation, options) {
216
329
  const client = useContext(Context$2);
217
330
  return useMutation$1(mutation, __spreadValues({
218
- client
331
+ client: client == null ? void 0 : client.apolloClient
219
332
  }, options));
220
333
  }
221
- function ApolloProvider({
334
+ function MakeswiftProvider({
222
335
  client,
223
336
  children
224
337
  }) {
@@ -1073,7 +1186,7 @@ function Parallax(_g2) {
1073
1186
  children: children(getProps)
1074
1187
  }));
1075
1188
  }
1076
- const Container$c = styled.div`
1189
+ const Container$d = styled.div`
1077
1190
  position: absolute;
1078
1191
  top: 0;
1079
1192
  left: 0;
@@ -1127,7 +1240,7 @@ function BackgroundVideo({
1127
1240
  }, [aspectRatio, zoom]);
1128
1241
  if (!ReactPlayer.canPlay(url))
1129
1242
  return /* @__PURE__ */ jsx(Fragment, {});
1130
- return /* @__PURE__ */ jsxs(Container$c, {
1243
+ return /* @__PURE__ */ jsxs(Container$d, {
1131
1244
  ref: container,
1132
1245
  children: [container.current && /* @__PURE__ */ jsx(ReactPlayer, {
1133
1246
  url,
@@ -1206,10 +1319,10 @@ const AbsoluteFill = styled.div`
1206
1319
  right: 0;
1207
1320
  bottom: 0;
1208
1321
  `;
1209
- const Container$b = styled(AbsoluteFill)`
1322
+ const Container$c = styled(AbsoluteFill)`
1210
1323
  border-radius: inherit;
1211
1324
  `;
1212
- const BackgroundsContainer$1 = styled(Container$b)`
1325
+ const BackgroundsContainer$1 = styled(Container$c)`
1213
1326
  overflow: hidden;
1214
1327
  ${(p) => cssMediaRules([p.visibility], ([visibility]) => css`
1215
1328
  display: ${visibility === true ? "block" : "none"};
@@ -1233,7 +1346,7 @@ function Backgrounds({
1233
1346
  visibility,
1234
1347
  children: [...value].reverse().map((bg) => {
1235
1348
  if (bg.type === "color") {
1236
- return /* @__PURE__ */ jsx(Container$b, {
1349
+ return /* @__PURE__ */ jsx(Container$c, {
1237
1350
  style: {
1238
1351
  backgroundColor: getColor(bg.payload)
1239
1352
  }
@@ -1269,7 +1382,7 @@ function Backgrounds({
1269
1382
  }
1270
1383
  return /* @__PURE__ */ jsx(Parallax, {
1271
1384
  strength: parallax,
1272
- children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$b, __spreadValues({}, getParallaxProps({
1385
+ children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadValues({}, getParallaxProps({
1273
1386
  style: {
1274
1387
  backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
1275
1388
  backgroundPosition,
@@ -1287,7 +1400,7 @@ function Backgrounds({
1287
1400
  isRadial
1288
1401
  } = bg.payload;
1289
1402
  const gradient = `${getStopsStyle(stops)}`;
1290
- return /* @__PURE__ */ jsx(Container$b, {
1403
+ return /* @__PURE__ */ jsx(Container$c, {
1291
1404
  style: {
1292
1405
  background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
1293
1406
  }
@@ -1304,7 +1417,7 @@ function Backgrounds({
1304
1417
  } = bg.payload;
1305
1418
  return /* @__PURE__ */ jsx(Parallax, {
1306
1419
  strength: parallax,
1307
- children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$b, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1420
+ children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1308
1421
  children: /* @__PURE__ */ jsx(BackgroundVideo, {
1309
1422
  url,
1310
1423
  zoom,
@@ -1500,7 +1613,7 @@ const Box = forwardRef(function Box2({
1500
1613
  })
1501
1614
  }, key == null ? void 0 : key.container);
1502
1615
  });
1503
- function registerComponent$b(runtime) {
1616
+ function registerComponent$c(runtime) {
1504
1617
  return runtime.registerComponent(Box, {
1505
1618
  type: "./components/Box/index.js",
1506
1619
  label: "Box",
@@ -1998,7 +2111,7 @@ const Button$1 = forwardRef(function Button2(_m, ref) {
1998
2111
  children: children == null ? "Button Text" : children
1999
2112
  }));
2000
2113
  });
2001
- function registerComponent$a(runtime) {
2114
+ function registerComponent$b(runtime) {
2002
2115
  return runtime.registerComponent(Button$1, {
2003
2116
  type: "./components/Button/index.js",
2004
2117
  label: "Button",
@@ -2094,6 +2207,10 @@ const placeholders = {
2094
2207
  image: {
2095
2208
  src: "data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A",
2096
2209
  dimensions: { width: 360, height: 240 }
2210
+ },
2211
+ video: {
2212
+ src: "data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A",
2213
+ dimensions: { width: 712, height: 400 }
2097
2214
  }
2098
2215
  };
2099
2216
  function loadImage(src) {
@@ -2199,7 +2316,7 @@ const ImageComponent = forwardRef(function Image2({
2199
2316
  })
2200
2317
  });
2201
2318
  });
2202
- function registerComponent$9(runtime) {
2319
+ function registerComponent$a(runtime) {
2203
2320
  return runtime.registerComponent(ImageComponent, {
2204
2321
  type: "./components/Image/index.js",
2205
2322
  label: "Image",
@@ -2248,7 +2365,7 @@ const RightChevron = () => /* @__PURE__ */ jsx("svg", {
2248
2365
  strokeWidth: "2"
2249
2366
  })
2250
2367
  });
2251
- const Container$a = styled.div`
2368
+ const Container$b = styled.div`
2252
2369
  position: relative;
2253
2370
  height: 100%;
2254
2371
  `;
@@ -2548,7 +2665,7 @@ const Carousel = forwardRef(function Carousel2({
2548
2665
  break;
2549
2666
  }
2550
2667
  },
2551
- children: [/* @__PURE__ */ jsxs(Container$a, {
2668
+ children: [/* @__PURE__ */ jsxs(Container$b, {
2552
2669
  children: [/* @__PURE__ */ jsx(ClipMask, {
2553
2670
  children: /* @__PURE__ */ jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
2554
2671
  animate: animation,
@@ -2624,7 +2741,7 @@ const Carousel = forwardRef(function Carousel2({
2624
2741
  })]
2625
2742
  });
2626
2743
  });
2627
- function registerComponent$8(runtime) {
2744
+ function registerComponent$9(runtime) {
2628
2745
  return runtime.registerComponent(Carousel, {
2629
2746
  type: "./components/Carousel/index.js",
2630
2747
  label: "Carousel",
@@ -2751,7 +2868,7 @@ const Segment = styled.div`
2751
2868
  flex: 1;
2752
2869
  text-align: center;
2753
2870
  `;
2754
- const Container$9 = styled.div`
2871
+ const Container$a = styled.div`
2755
2872
  display: flex;
2756
2873
  ${cssWidth("560px")}
2757
2874
  ${cssMargin()}
@@ -2991,7 +3108,7 @@ const Countdown = forwardRef(function Countdown2({
2991
3108
  }, 1e3);
2992
3109
  return () => clearInterval(intervalId);
2993
3110
  }, [date]);
2994
- return /* @__PURE__ */ jsxs(Container$9, {
3111
+ return /* @__PURE__ */ jsxs(Container$a, {
2995
3112
  ref,
2996
3113
  id,
2997
3114
  width,
@@ -3040,7 +3157,7 @@ const Countdown = forwardRef(function Countdown2({
3040
3157
  })]
3041
3158
  });
3042
3159
  });
3043
- function registerComponent$7(runtime) {
3160
+ function registerComponent$8(runtime) {
3044
3161
  return runtime.registerComponent(Countdown, {
3045
3162
  type: "./components/Countdown/index.js",
3046
3163
  label: "Countdown",
@@ -3176,7 +3293,7 @@ const IE11MinHeightContainer = styled.div`
3176
3293
  ${cssWidth()}
3177
3294
  ${cssMargin()}
3178
3295
  `;
3179
- const Container$8 = styled.div`
3296
+ const Container$9 = styled.div`
3180
3297
  display: flex;
3181
3298
  flex-direction: column;
3182
3299
  justify-content: center;
@@ -3235,7 +3352,7 @@ const Divider = forwardRef(function Divider2({
3235
3352
  id,
3236
3353
  width,
3237
3354
  margin,
3238
- children: /* @__PURE__ */ jsx(Container$8, {
3355
+ children: /* @__PURE__ */ jsx(Container$9, {
3239
3356
  children: /* @__PURE__ */ jsx(Line, {
3240
3357
  variant,
3241
3358
  thickness,
@@ -3244,7 +3361,7 @@ const Divider = forwardRef(function Divider2({
3244
3361
  })
3245
3362
  });
3246
3363
  });
3247
- function registerComponent$6(runtime) {
3364
+ function registerComponent$7(runtime) {
3248
3365
  return runtime.registerComponent(Divider, {
3249
3366
  type: "./components/Divider/index.js",
3250
3367
  label: "Divider",
@@ -3294,7 +3411,7 @@ function registerComponent$6(runtime) {
3294
3411
  }
3295
3412
  });
3296
3413
  }
3297
- const Container$7 = styled.div`
3414
+ const Container$8 = styled.div`
3298
3415
  min-height: 15px;
3299
3416
  ${cssWidth()}
3300
3417
  ${cssMargin()}
@@ -3374,7 +3491,7 @@ const Embed = forwardRef(function Embed2({
3374
3491
  }, [container, html]);
3375
3492
  if (shouldRender === false)
3376
3493
  return null;
3377
- return /* @__PURE__ */ jsx(Container$7, {
3494
+ return /* @__PURE__ */ jsx(Container$8, {
3378
3495
  ref: setContainer,
3379
3496
  id,
3380
3497
  margin,
@@ -3384,7 +3501,7 @@ const Embed = forwardRef(function Embed2({
3384
3501
  }
3385
3502
  });
3386
3503
  });
3387
- function registerComponent$5(runtime) {
3504
+ function registerComponent$6(runtime) {
3388
3505
  return runtime.registerComponent(Embed, {
3389
3506
  type: "./components/Embed/index.js",
3390
3507
  label: "Embed",
@@ -3606,7 +3723,7 @@ var Input$2 = forwardRef(function Input(_o, ref) {
3606
3723
  brandColor
3607
3724
  }));
3608
3725
  });
3609
- const Container$6 = styled.div`
3726
+ const Container$7 = styled.div`
3610
3727
  display: flex;
3611
3728
  flex-direction: column;
3612
3729
  ${cssWidth()};
@@ -3641,7 +3758,7 @@ var Placeholder$1 = forwardRef(function Placeholder2({
3641
3758
  width,
3642
3759
  margin
3643
3760
  }, ref) {
3644
- return /* @__PURE__ */ jsxs(Container$6, {
3761
+ return /* @__PURE__ */ jsxs(Container$7, {
3645
3762
  ref,
3646
3763
  width,
3647
3764
  margin,
@@ -3808,7 +3925,7 @@ function getCheckmarkColor$1({
3808
3925
  l
3809
3926
  }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
3810
3927
  }
3811
- const Container$5 = styled.div`
3928
+ const Container$6 = styled.div`
3812
3929
  position: relative;
3813
3930
  ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
3814
3931
  height: ${getSizeHeight(size)}px;
@@ -3928,7 +4045,7 @@ var Checkbox = forwardRef(function Checkbox2(_w, ref) {
3928
4045
  contrast,
3929
4046
  brandColor
3930
4047
  } = useFormContext();
3931
- return /* @__PURE__ */ jsxs(Container$5, {
4048
+ return /* @__PURE__ */ jsxs(Container$6, {
3932
4049
  size,
3933
4050
  children: [/* @__PURE__ */ jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
3934
4051
  type: "checkbox",
@@ -4071,7 +4188,7 @@ function getCheckmarkColor({
4071
4188
  l
4072
4189
  }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
4073
4190
  }
4074
- const Container$4 = styled.div`
4191
+ const Container$5 = styled.div`
4075
4192
  position: relative;
4076
4193
  ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
4077
4194
  height: ${getSizeHeight(size)}px;
@@ -4184,7 +4301,7 @@ var RadioButton = forwardRef(function RadioButton2(_C, ref) {
4184
4301
  contrast,
4185
4302
  brandColor
4186
4303
  } = useFormContext();
4187
- return /* @__PURE__ */ jsxs(Container$4, {
4304
+ return /* @__PURE__ */ jsxs(Container$5, {
4188
4305
  size,
4189
4306
  children: [/* @__PURE__ */ jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
4190
4307
  ref,
@@ -4256,7 +4373,7 @@ var TableColumnRadioButtonGroup = forwardRef(function TableColumnRadioButtonGrou
4256
4373
  }, option.id))]
4257
4374
  });
4258
4375
  });
4259
- const Container$3 = styled.div`
4376
+ const Container$4 = styled.div`
4260
4377
  ${cssField()}
4261
4378
  display: flex;
4262
4379
  align-items: center;
@@ -4321,7 +4438,7 @@ var TableColumnSingleSelect = forwardRef(function TableColumnSingleSelect2(_G, r
4321
4438
  children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
4322
4439
  htmlFor: id,
4323
4440
  children: label
4324
- }), /* @__PURE__ */ jsxs(Container$3, {
4441
+ }), /* @__PURE__ */ jsxs(Container$4, {
4325
4442
  error,
4326
4443
  shape,
4327
4444
  size,
@@ -5014,7 +5131,7 @@ const Form = forwardRef(function Form2({
5014
5131
  })
5015
5132
  });
5016
5133
  });
5017
- function registerComponent$4(runtime) {
5134
+ function registerComponent$5(runtime) {
5018
5135
  return runtime.registerComponent(Form, {
5019
5136
  type: "./components/Form/index.js",
5020
5137
  label: "Form",
@@ -5574,7 +5691,7 @@ function MobileDropDownButton(_Y) {
5574
5691
  const ButtonLink = styled(Button$1)`
5575
5692
  margin: 8px 0;
5576
5693
  `;
5577
- const Container$2 = styled.div`
5694
+ const Container$3 = styled.div`
5578
5695
  position: fixed;
5579
5696
  flex-direction: column;
5580
5697
  width: 100%;
@@ -5628,7 +5745,7 @@ function MobileMenu({
5628
5745
  onClose = () => {
5629
5746
  }
5630
5747
  }) {
5631
- return /* @__PURE__ */ jsxs(Container$2, {
5748
+ return /* @__PURE__ */ jsxs(Container$3, {
5632
5749
  animation,
5633
5750
  backgroundColor: useColor(backgroundColor),
5634
5751
  open,
@@ -5654,7 +5771,7 @@ function MobileMenu({
5654
5771
  })]
5655
5772
  });
5656
5773
  }
5657
- const Container$1 = styled.nav`
5774
+ const Container$2 = styled.nav`
5658
5775
  display: flex;
5659
5776
  align-items: center;
5660
5777
  ${cssWidth()}
@@ -5711,7 +5828,7 @@ const Navigation = forwardRef(function Navigation2({
5711
5828
  margin
5712
5829
  }, ref) {
5713
5830
  const [isOpen, setIsOpen] = useState(false);
5714
- return /* @__PURE__ */ jsxs(Container$1, {
5831
+ return /* @__PURE__ */ jsxs(Container$2, {
5715
5832
  ref,
5716
5833
  id,
5717
5834
  margin,
@@ -5759,7 +5876,7 @@ const Navigation = forwardRef(function Navigation2({
5759
5876
  })]
5760
5877
  });
5761
5878
  });
5762
- function registerComponent$3(runtime) {
5879
+ function registerComponent$4(runtime) {
5763
5880
  return runtime.registerComponent(Navigation, {
5764
5881
  type: "./components/Navigation/index.js",
5765
5882
  label: "Navigation",
@@ -5936,7 +6053,7 @@ const Root = forwardRef(function Page2({
5936
6053
  })]
5937
6054
  });
5938
6055
  });
5939
- function registerComponent$2(runtime) {
6056
+ function registerComponent$3(runtime) {
5940
6057
  return runtime.registerComponent(Root, {
5941
6058
  type: "./components/Root/index.js",
5942
6059
  label: "Page",
@@ -6613,7 +6730,7 @@ function SocialLinksPlaceholder({
6613
6730
  }, link.id))
6614
6731
  });
6615
6732
  }
6616
- const Container = styled.div`
6733
+ const Container$1 = styled.div`
6617
6734
  display: flex;
6618
6735
  flex-direction: row;
6619
6736
  flex-wrap: wrap;
@@ -6697,7 +6814,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
6697
6814
  }, ref) {
6698
6815
  const fillData = useColor(fill);
6699
6816
  const backgroundColorData = useColor(backgroundColor);
6700
- return /* @__PURE__ */ jsx(Container, {
6817
+ return /* @__PURE__ */ jsx(Container$1, {
6701
6818
  ref,
6702
6819
  id,
6703
6820
  alignment,
@@ -6733,7 +6850,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
6733
6850
  })
6734
6851
  });
6735
6852
  });
6736
- function registerComponent$1(runtime) {
6853
+ function registerComponent$2(runtime) {
6737
6854
  return runtime.registerComponent(SocialLinks, {
6738
6855
  type: "./components/SocialLinks/index.js",
6739
6856
  label: "Social Links",
@@ -7270,7 +7387,7 @@ const Text = forwardRef(function Text2({
7270
7387
  onKeyDown: handleKeyDown
7271
7388
  });
7272
7389
  });
7273
- function registerComponent(runtime) {
7390
+ function registerComponent$1(runtime) {
7274
7391
  return runtime.registerComponent(Text, {
7275
7392
  type: "./components/Text/index.js",
7276
7393
  label: "Text",
@@ -7348,19 +7465,103 @@ function registerComponent(runtime) {
7348
7465
  }
7349
7466
  });
7350
7467
  }
7468
+ const Container = styled.div`
7469
+ display: flex;
7470
+ flex-direction: column;
7471
+ overflow: hidden;
7472
+ ${cssWidth("560px")}
7473
+ ${cssMargin()}
7474
+ ${cssBorderRadius()}
7475
+ `;
7476
+ const ASPECT_RATIO = 16 / 9;
7477
+ const Video = forwardRef(function Video2({
7478
+ id,
7479
+ video,
7480
+ width,
7481
+ margin,
7482
+ borderRadius
7483
+ }, ref) {
7484
+ const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url);
7485
+ return /* @__PURE__ */ jsx(Container, {
7486
+ ref,
7487
+ id,
7488
+ width,
7489
+ margin,
7490
+ borderRadius,
7491
+ children: /* @__PURE__ */ jsx("div", {
7492
+ style: {
7493
+ position: "relative",
7494
+ paddingTop: `${100 / ASPECT_RATIO}%`
7495
+ },
7496
+ children: /* @__PURE__ */ jsx("div", {
7497
+ style: {
7498
+ position: "absolute",
7499
+ top: 0,
7500
+ left: 0,
7501
+ right: 0,
7502
+ bottom: 0
7503
+ },
7504
+ children: canPlayUrl === true ? /* @__PURE__ */ jsx(ReactPlayer, __spreadProps(__spreadValues({}, video), {
7505
+ width: "100%",
7506
+ height: "100%",
7507
+ config: {
7508
+ vimeo: {
7509
+ playerOptions: {
7510
+ background: video != null && !video.controls
7511
+ }
7512
+ },
7513
+ wistia: {
7514
+ options: {
7515
+ endVideoBehavior: video != null && video.loop === true ? "loop" : "default"
7516
+ }
7517
+ }
7518
+ }
7519
+ })) : /* @__PURE__ */ jsx("img", {
7520
+ width: "100%",
7521
+ src: placeholders.video.src,
7522
+ alt: "Video Placeholder"
7523
+ })
7524
+ })
7525
+ })
7526
+ });
7527
+ });
7528
+ function registerComponent(runtime) {
7529
+ return runtime.registerComponent(Video, {
7530
+ type: "./components/Video/index.js",
7531
+ label: "Video",
7532
+ icon: "Video40",
7533
+ props: {
7534
+ id: ElementID(),
7535
+ video: Video$1({
7536
+ preset: {
7537
+ controls: true
7538
+ }
7539
+ }),
7540
+ width: Width({
7541
+ defaultValue: {
7542
+ value: 560,
7543
+ unit: "px"
7544
+ }
7545
+ }),
7546
+ margin: Margin(),
7547
+ borderRadius: BorderRadius()
7548
+ }
7549
+ });
7550
+ }
7351
7551
  function registerBuiltinComponents(runtime) {
7352
- const unregisterBoxComponent = registerComponent$b(runtime);
7353
- const unregisterButtonComponent = registerComponent$a(runtime);
7354
- const unregisterCarouselComponent = registerComponent$8(runtime);
7355
- const unregisterCountdownComponent = registerComponent$7(runtime);
7356
- const unregisterDividerComponent = registerComponent$6(runtime);
7357
- const unregisterEmbedComponent = registerComponent$5(runtime);
7358
- const unregisterFormComponent = registerComponent$4(runtime);
7359
- const unregisterImageComponent = registerComponent$9(runtime);
7360
- const unregisterNavigationComponent = registerComponent$3(runtime);
7361
- const unregisterRootComponent = registerComponent$2(runtime);
7362
- const unregisterSocialLinksComponent = registerComponent$1(runtime);
7363
- const unregisterTextComponent = registerComponent(runtime);
7552
+ const unregisterBoxComponent = registerComponent$c(runtime);
7553
+ const unregisterButtonComponent = registerComponent$b(runtime);
7554
+ const unregisterCarouselComponent = registerComponent$9(runtime);
7555
+ const unregisterCountdownComponent = registerComponent$8(runtime);
7556
+ const unregisterDividerComponent = registerComponent$7(runtime);
7557
+ const unregisterEmbedComponent = registerComponent$6(runtime);
7558
+ const unregisterFormComponent = registerComponent$5(runtime);
7559
+ const unregisterImageComponent = registerComponent$a(runtime);
7560
+ const unregisterNavigationComponent = registerComponent$4(runtime);
7561
+ const unregisterRootComponent = registerComponent$3(runtime);
7562
+ const unregisterSocialLinksComponent = registerComponent$2(runtime);
7563
+ const unregisterTextComponent = registerComponent$1(runtime);
7564
+ const unregisterVideoComponent = registerComponent(runtime);
7364
7565
  return () => {
7365
7566
  unregisterBoxComponent();
7366
7567
  unregisterButtonComponent();
@@ -7374,6 +7575,8 @@ function registerBuiltinComponents(runtime) {
7374
7575
  unregisterRootComponent();
7375
7576
  unregisterSocialLinksComponent();
7376
7577
  unregisterTextComponent();
7578
+ unregisterTextComponent();
7579
+ unregisterVideoComponent();
7377
7580
  };
7378
7581
  }
7379
7582
  const contextDefaultValue = configureStore();
@@ -7402,10 +7605,9 @@ function createReactRuntime(store) {
7402
7605
  const ReactRuntime = createReactRuntime(contextDefaultValue);
7403
7606
  const Context = createContext(contextDefaultValue);
7404
7607
  function RuntimeProvider({
7608
+ client,
7405
7609
  children,
7406
- defaultRootElements,
7407
- registerComponents,
7408
- makeswiftApiEndpoint
7610
+ defaultRootElements
7409
7611
  }) {
7410
7612
  const [store, setStore] = useState(() => {
7411
7613
  const store2 = configureStore({
@@ -7414,27 +7616,11 @@ function RuntimeProvider({
7414
7616
  });
7415
7617
  const runtime = createReactRuntime(store2);
7416
7618
  registerBuiltinComponents(runtime);
7417
- registerComponents == null ? void 0 : registerComponents(runtime);
7418
7619
  return store2;
7419
7620
  });
7420
- const [client, setClient] = useState(new ApolloClient({
7421
- uri: makeswiftApiEndpoint,
7422
- cache: new InMemoryCache()
7423
- }));
7424
- useEffect(() => {
7425
- setClient(({
7426
- cache
7427
- }) => new ApolloClient({
7428
- uri: makeswiftApiEndpoint,
7429
- cache
7430
- }));
7431
- }, [makeswiftApiEndpoint]);
7432
7621
  useEffect(() => {
7433
7622
  return registerBuiltinComponents(createReactRuntime(store));
7434
7623
  }, [store]);
7435
- useEffect(() => {
7436
- return registerComponents == null ? void 0 : registerComponents(createReactRuntime(store));
7437
- }, [store, registerComponents]);
7438
7624
  useEffect(() => {
7439
7625
  const isInBuilder = window.parent !== window;
7440
7626
  if (isInBuilder)
@@ -7443,7 +7629,7 @@ function RuntimeProvider({
7443
7629
  const ReactBuilderPreview = await import("./react-builder-preview.es.js");
7444
7630
  setStore((store2) => ReactBuilderPreview.configureStore({
7445
7631
  preloadedState: store2.getState(),
7446
- client
7632
+ client: client.apolloClient
7447
7633
  }));
7448
7634
  }
7449
7635
  }, [client]);
@@ -7470,7 +7656,7 @@ function RuntimeProvider({
7470
7656
  }, []);
7471
7657
  return /* @__PURE__ */ jsx(Context.Provider, {
7472
7658
  value: store,
7473
- children: /* @__PURE__ */ jsx(ApolloProvider, {
7659
+ children: /* @__PURE__ */ jsx(MakeswiftProvider, {
7474
7660
  client,
7475
7661
  children
7476
7662
  })
@@ -7652,5 +7838,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
7652
7838
  document
7653
7839
  });
7654
7840
  }));
7655
- export { Box as B, Carousel as C, DocumentReference as D, Element$1 as E, Form as F, ImageComponent as I, Navigation as N, PageProvider as P, RuntimeProvider as R, SocialLinks as S, Text as T, ReactRuntime as a, usePageId as b, Button$1 as c, Countdown as d, Divider as e, Embed as f, Root as g, registerComponent$b as h, DEFAULT_BOX_ANIMATE_TYPE as i, DEFAULT_BOX_ANIMATE_DELAY as j, DEFAULT_BOX_ANIMATE_DURATION as k, DEFAULT_ITEM_ANIMATE_TYPE as l, DEFAULT_ITEM_ANIMATE_DELAY as m, DEFAULT_ITEM_ANIMATE_DURATION as n, DEFAULT_ITEM_STAGGER_DURATION as o, cssMediaRules as p, cssWidth as q, registerBuiltinComponents as r, cssMargin as s, cssPadding as t, useIsInBuilder as u, cssBorder as v, cssBorderRadius as w, cssBoxShadow as x, cssGridItem as y, cssTextStyle as z };
7841
+ export { useBackgrounds as A, Box as B, Carousel as C, DocumentReference as D, Element$1 as E, Form as F, useBorder as G, useBoxShadow as H, ImageComponent as I, useColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P, MakeswiftClient as Q, RuntimeProvider as R, SocialLinks as S, Text as T, ReactRuntime as a, usePageId as b, Button$1 as c, Countdown as d, Divider as e, Embed as f, Root as g, registerComponent$c as h, DEFAULT_BOX_ANIMATE_TYPE as i, DEFAULT_BOX_ANIMATE_DELAY as j, DEFAULT_BOX_ANIMATE_DURATION as k, DEFAULT_ITEM_ANIMATE_TYPE as l, DEFAULT_ITEM_ANIMATE_DELAY as m, DEFAULT_ITEM_ANIMATE_DURATION as n, DEFAULT_ITEM_STAGGER_DURATION as o, cssMediaRules as p, cssWidth as q, registerBuiltinComponents as r, cssMargin as s, cssPadding as t, useIsInBuilder as u, cssBorder as v, cssBorderRadius as w, cssBoxShadow as x, cssGridItem as y, cssTextStyle as z };
7656
7842
  //# sourceMappingURL=react.es2.js.map