@makeswift/runtime 0.0.0-25251c0 → 0.0.0-41fecbb

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 (78) hide show
  1. package/dist/actions.cjs.js +5 -0
  2. package/dist/actions.cjs.js.map +1 -1
  3. package/dist/actions.es.js +5 -1
  4. package/dist/actions.es.js.map +1 -1
  5. package/dist/components.cjs.js +10 -1
  6. package/dist/components.cjs.js.map +1 -1
  7. package/dist/components.es.js +3 -2
  8. package/dist/components.es.js.map +1 -1
  9. package/dist/control-serialization.cjs.js +4 -1
  10. package/dist/control-serialization.cjs.js.map +1 -1
  11. package/dist/control-serialization.es.js +4 -1
  12. package/dist/control-serialization.es.js.map +1 -1
  13. package/dist/descriptors.cjs.js +1 -0
  14. package/dist/descriptors.cjs.js.map +1 -1
  15. package/dist/descriptors.es.js +1 -1
  16. package/dist/descriptors.es.js.map +1 -1
  17. package/dist/main.cjs.js +1 -0
  18. package/dist/main.cjs.js.map +1 -1
  19. package/dist/main.es.js +1 -1
  20. package/dist/next.cjs.js +23 -7
  21. package/dist/next.cjs.js.map +1 -1
  22. package/dist/next.es.js +25 -9
  23. package/dist/next.es.js.map +1 -1
  24. package/dist/react-builder-preview.cjs.js +3 -0
  25. package/dist/react-builder-preview.cjs.js.map +1 -1
  26. package/dist/react-builder-preview.es.js +4 -1
  27. package/dist/react-builder-preview.es.js.map +1 -1
  28. package/dist/react-page.cjs.js +1 -1
  29. package/dist/react-page.cjs.js.map +1 -1
  30. package/dist/react-page.es.js +2 -2
  31. package/dist/react-page.es.js.map +1 -1
  32. package/dist/react.cjs.js +2 -1
  33. package/dist/react.cjs.js.map +1 -1
  34. package/dist/react.cjs2.js +276 -83
  35. package/dist/react.cjs2.js.map +1 -1
  36. package/dist/react.es.js +2 -1
  37. package/dist/react.es.js.map +1 -1
  38. package/dist/react.es2.js +266 -82
  39. package/dist/react.es2.js.map +1 -1
  40. package/dist/types/api/react.d.ts +22 -4
  41. package/dist/types/api/react.d.ts.map +1 -1
  42. package/dist/types/builder/serialization/control-serialization.d.ts +17 -11
  43. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -1
  44. package/dist/types/components/builtin/Video/Video.d.ts +15 -0
  45. package/dist/types/components/builtin/Video/Video.d.ts.map +1 -0
  46. package/dist/types/components/builtin/Video/index.d.ts +2 -0
  47. package/dist/types/components/builtin/Video/index.d.ts.map +1 -0
  48. package/dist/types/components/builtin/index.d.ts.map +1 -1
  49. package/dist/types/components/index.d.ts +1 -0
  50. package/dist/types/components/index.d.ts.map +1 -1
  51. package/dist/types/components/utils/placeholders.d.ts +7 -0
  52. package/dist/types/components/utils/placeholders.d.ts.map +1 -1
  53. package/dist/types/index.d.ts +1 -1
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/dist/types/next.d.ts +3 -3
  56. package/dist/types/next.d.ts.map +1 -1
  57. package/dist/types/prop-controllers/descriptors.d.ts +5 -4
  58. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  59. package/dist/types/prop-controllers/index.d.ts +1 -1
  60. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  61. package/dist/types/runtimes/react.d.ts +3 -3
  62. package/dist/types/runtimes/react.d.ts.map +1 -1
  63. package/dist/types/state/actions.d.ts +9 -1
  64. package/dist/types/state/actions.d.ts.map +1 -1
  65. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/types/components/builtin/Form/prop-controllers.d.ts +0 -1
  68. package/dist/types/components/builtin/Form/prop-controllers.d.ts.map +0 -1
  69. package/dist/types/components/hooks/useTableWorkspace.d.ts +0 -14
  70. package/dist/types/components/hooks/useTableWorkspace.d.ts.map +0 -1
  71. package/dist/types/components/utils/layout.d.ts +0 -16
  72. package/dist/types/components/utils/layout.d.ts.map +0 -1
  73. package/dist/types/components/utils/pollAnimationFrame.d.ts +0 -2
  74. package/dist/types/components/utils/pollAnimationFrame.d.ts.map +0 -1
  75. package/dist/types/components/utils/pollElementLayout.d.ts +0 -8
  76. package/dist/types/components/utils/pollElementLayout.d.ts.map +0 -1
  77. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts +0 -4
  78. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts.map +0 -1
package/dist/react.es2.js CHANGED
@@ -29,25 +29,30 @@ 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";
41
47
  import { p as parse, c as createBox, g as getBox } from "./box-models.es.js";
42
48
  import NextImage from "next/image";
43
49
  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";
50
+ 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
51
  import ColorHelper from "color";
46
52
  import scrollIntoView from "scroll-into-view-if-needed";
47
53
  import NextLink from "next/link";
48
54
  import { useGesture } from "react-use-gesture";
49
55
  import { wrap } from "@popmotion/popcorn";
50
- import uuid from "uuid/v4";
51
56
  import { Field as Field$1, getIn, Formik } from "formik";
52
57
  import { normalize } from "polished";
53
58
  import { Value } from "slate";
@@ -205,20 +210,126 @@ const TABLE_BY_ID = gql`
205
210
  function isNonNullable(value) {
206
211
  return value != null;
207
212
  }
213
+ const typePolicies = {
214
+ Query: {
215
+ fields: {
216
+ swatches(existingData, {
217
+ args,
218
+ toReference
219
+ }) {
220
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
221
+ __typename: "Swatch",
222
+ id
223
+ }, true));
224
+ },
225
+ file(existingData, {
226
+ args,
227
+ toReference
228
+ }) {
229
+ return existingData != null ? existingData : toReference({
230
+ __typename: "File",
231
+ id: args == null ? void 0 : args.id
232
+ }, true);
233
+ },
234
+ files(existingData, {
235
+ args,
236
+ toReference
237
+ }) {
238
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
239
+ __typename: "File",
240
+ id
241
+ }, true));
242
+ },
243
+ typographies(existingData, {
244
+ args,
245
+ toReference
246
+ }) {
247
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
248
+ __typename: "Typography",
249
+ id
250
+ }, true));
251
+ },
252
+ pagePathnamesById(existingData, {
253
+ args,
254
+ toReference
255
+ }) {
256
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
257
+ __typename: "PagePathnameSlice",
258
+ id
259
+ }, true));
260
+ },
261
+ globalElement(existingData, {
262
+ args,
263
+ toReference
264
+ }) {
265
+ return existingData != null ? existingData : toReference({
266
+ __typename: "GlobalElement",
267
+ id: args == null ? void 0 : args.id
268
+ }, true);
269
+ },
270
+ table(existingData, {
271
+ args,
272
+ toReference
273
+ }) {
274
+ return existingData != null ? existingData : toReference({
275
+ __typename: "Table",
276
+ id: args == null ? void 0 : args.id
277
+ }, true);
278
+ }
279
+ }
280
+ }
281
+ };
282
+ function createApolloClient({
283
+ uri,
284
+ cacheData
285
+ }) {
286
+ const cache = new InMemoryCache({
287
+ typePolicies
288
+ });
289
+ if (cacheData)
290
+ cache.restore(cacheData);
291
+ return new ApolloClient({
292
+ uri,
293
+ cache
294
+ });
295
+ }
296
+ class MakeswiftClient {
297
+ constructor({
298
+ uri,
299
+ cacheData
300
+ }) {
301
+ __publicField(this, "apolloClient");
302
+ this.apolloClient = createApolloClient({
303
+ uri,
304
+ cacheData
305
+ });
306
+ }
307
+ async prefetch(element) {
308
+ const id = uuid();
309
+ await getDataFromTree(/* @__PURE__ */ jsx(RuntimeProvider, {
310
+ client: this,
311
+ defaultRootElements: /* @__PURE__ */ new Map([[id, element]]),
312
+ children: /* @__PURE__ */ jsx(DocumentReference, {
313
+ documentReference: createDocumentReference(id)
314
+ })
315
+ }));
316
+ return this.apolloClient.cache.extract();
317
+ }
318
+ }
208
319
  const Context$2 = createContext(void 0);
209
320
  function useQuery(query, options) {
210
321
  const client = useContext(Context$2);
211
322
  return useQuery$1(query, __spreadValues({
212
- client
323
+ client: client == null ? void 0 : client.apolloClient
213
324
  }, options));
214
325
  }
215
326
  function useMutation(mutation, options) {
216
327
  const client = useContext(Context$2);
217
328
  return useMutation$1(mutation, __spreadValues({
218
- client
329
+ client: client == null ? void 0 : client.apolloClient
219
330
  }, options));
220
331
  }
221
- function ApolloProvider({
332
+ function MakeswiftProvider({
222
333
  client,
223
334
  children
224
335
  }) {
@@ -1073,7 +1184,7 @@ function Parallax(_g2) {
1073
1184
  children: children(getProps)
1074
1185
  }));
1075
1186
  }
1076
- const Container$c = styled.div`
1187
+ const Container$d = styled.div`
1077
1188
  position: absolute;
1078
1189
  top: 0;
1079
1190
  left: 0;
@@ -1127,7 +1238,7 @@ function BackgroundVideo({
1127
1238
  }, [aspectRatio, zoom]);
1128
1239
  if (!ReactPlayer.canPlay(url))
1129
1240
  return /* @__PURE__ */ jsx(Fragment, {});
1130
- return /* @__PURE__ */ jsxs(Container$c, {
1241
+ return /* @__PURE__ */ jsxs(Container$d, {
1131
1242
  ref: container,
1132
1243
  children: [container.current && /* @__PURE__ */ jsx(ReactPlayer, {
1133
1244
  url,
@@ -1206,10 +1317,10 @@ const AbsoluteFill = styled.div`
1206
1317
  right: 0;
1207
1318
  bottom: 0;
1208
1319
  `;
1209
- const Container$b = styled(AbsoluteFill)`
1320
+ const Container$c = styled(AbsoluteFill)`
1210
1321
  border-radius: inherit;
1211
1322
  `;
1212
- const BackgroundsContainer$1 = styled(Container$b)`
1323
+ const BackgroundsContainer$1 = styled(Container$c)`
1213
1324
  overflow: hidden;
1214
1325
  ${(p) => cssMediaRules([p.visibility], ([visibility]) => css`
1215
1326
  display: ${visibility === true ? "block" : "none"};
@@ -1233,7 +1344,7 @@ function Backgrounds({
1233
1344
  visibility,
1234
1345
  children: [...value].reverse().map((bg) => {
1235
1346
  if (bg.type === "color") {
1236
- return /* @__PURE__ */ jsx(Container$b, {
1347
+ return /* @__PURE__ */ jsx(Container$c, {
1237
1348
  style: {
1238
1349
  backgroundColor: getColor(bg.payload)
1239
1350
  }
@@ -1269,7 +1380,7 @@ function Backgrounds({
1269
1380
  }
1270
1381
  return /* @__PURE__ */ jsx(Parallax, {
1271
1382
  strength: parallax,
1272
- children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$b, __spreadValues({}, getParallaxProps({
1383
+ children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadValues({}, getParallaxProps({
1273
1384
  style: {
1274
1385
  backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
1275
1386
  backgroundPosition,
@@ -1287,7 +1398,7 @@ function Backgrounds({
1287
1398
  isRadial
1288
1399
  } = bg.payload;
1289
1400
  const gradient = `${getStopsStyle(stops)}`;
1290
- return /* @__PURE__ */ jsx(Container$b, {
1401
+ return /* @__PURE__ */ jsx(Container$c, {
1291
1402
  style: {
1292
1403
  background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
1293
1404
  }
@@ -1304,7 +1415,7 @@ function Backgrounds({
1304
1415
  } = bg.payload;
1305
1416
  return /* @__PURE__ */ jsx(Parallax, {
1306
1417
  strength: parallax,
1307
- children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$b, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1418
+ children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1308
1419
  children: /* @__PURE__ */ jsx(BackgroundVideo, {
1309
1420
  url,
1310
1421
  zoom,
@@ -1500,7 +1611,7 @@ const Box = forwardRef(function Box2({
1500
1611
  })
1501
1612
  }, key == null ? void 0 : key.container);
1502
1613
  });
1503
- function registerComponent$b(runtime) {
1614
+ function registerComponent$c(runtime) {
1504
1615
  return runtime.registerComponent(Box, {
1505
1616
  type: "./components/Box/index.js",
1506
1617
  label: "Box",
@@ -1998,7 +2109,7 @@ const Button$1 = forwardRef(function Button2(_m, ref) {
1998
2109
  children: children == null ? "Button Text" : children
1999
2110
  }));
2000
2111
  });
2001
- function registerComponent$a(runtime) {
2112
+ function registerComponent$b(runtime) {
2002
2113
  return runtime.registerComponent(Button$1, {
2003
2114
  type: "./components/Button/index.js",
2004
2115
  label: "Button",
@@ -2094,6 +2205,10 @@ const placeholders = {
2094
2205
  image: {
2095
2206
  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
2207
  dimensions: { width: 360, height: 240 }
2208
+ },
2209
+ video: {
2210
+ 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",
2211
+ dimensions: { width: 712, height: 400 }
2097
2212
  }
2098
2213
  };
2099
2214
  function loadImage(src) {
@@ -2199,7 +2314,7 @@ const ImageComponent = forwardRef(function Image2({
2199
2314
  })
2200
2315
  });
2201
2316
  });
2202
- function registerComponent$9(runtime) {
2317
+ function registerComponent$a(runtime) {
2203
2318
  return runtime.registerComponent(ImageComponent, {
2204
2319
  type: "./components/Image/index.js",
2205
2320
  label: "Image",
@@ -2248,7 +2363,7 @@ const RightChevron = () => /* @__PURE__ */ jsx("svg", {
2248
2363
  strokeWidth: "2"
2249
2364
  })
2250
2365
  });
2251
- const Container$a = styled.div`
2366
+ const Container$b = styled.div`
2252
2367
  position: relative;
2253
2368
  height: 100%;
2254
2369
  `;
@@ -2548,7 +2663,7 @@ const Carousel = forwardRef(function Carousel2({
2548
2663
  break;
2549
2664
  }
2550
2665
  },
2551
- children: [/* @__PURE__ */ jsxs(Container$a, {
2666
+ children: [/* @__PURE__ */ jsxs(Container$b, {
2552
2667
  children: [/* @__PURE__ */ jsx(ClipMask, {
2553
2668
  children: /* @__PURE__ */ jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
2554
2669
  animate: animation,
@@ -2624,7 +2739,7 @@ const Carousel = forwardRef(function Carousel2({
2624
2739
  })]
2625
2740
  });
2626
2741
  });
2627
- function registerComponent$8(runtime) {
2742
+ function registerComponent$9(runtime) {
2628
2743
  return runtime.registerComponent(Carousel, {
2629
2744
  type: "./components/Carousel/index.js",
2630
2745
  label: "Carousel",
@@ -2751,7 +2866,7 @@ const Segment = styled.div`
2751
2866
  flex: 1;
2752
2867
  text-align: center;
2753
2868
  `;
2754
- const Container$9 = styled.div`
2869
+ const Container$a = styled.div`
2755
2870
  display: flex;
2756
2871
  ${cssWidth("560px")}
2757
2872
  ${cssMargin()}
@@ -2991,7 +3106,7 @@ const Countdown = forwardRef(function Countdown2({
2991
3106
  }, 1e3);
2992
3107
  return () => clearInterval(intervalId);
2993
3108
  }, [date]);
2994
- return /* @__PURE__ */ jsxs(Container$9, {
3109
+ return /* @__PURE__ */ jsxs(Container$a, {
2995
3110
  ref,
2996
3111
  id,
2997
3112
  width,
@@ -3040,7 +3155,7 @@ const Countdown = forwardRef(function Countdown2({
3040
3155
  })]
3041
3156
  });
3042
3157
  });
3043
- function registerComponent$7(runtime) {
3158
+ function registerComponent$8(runtime) {
3044
3159
  return runtime.registerComponent(Countdown, {
3045
3160
  type: "./components/Countdown/index.js",
3046
3161
  label: "Countdown",
@@ -3176,7 +3291,7 @@ const IE11MinHeightContainer = styled.div`
3176
3291
  ${cssWidth()}
3177
3292
  ${cssMargin()}
3178
3293
  `;
3179
- const Container$8 = styled.div`
3294
+ const Container$9 = styled.div`
3180
3295
  display: flex;
3181
3296
  flex-direction: column;
3182
3297
  justify-content: center;
@@ -3235,7 +3350,7 @@ const Divider = forwardRef(function Divider2({
3235
3350
  id,
3236
3351
  width,
3237
3352
  margin,
3238
- children: /* @__PURE__ */ jsx(Container$8, {
3353
+ children: /* @__PURE__ */ jsx(Container$9, {
3239
3354
  children: /* @__PURE__ */ jsx(Line, {
3240
3355
  variant,
3241
3356
  thickness,
@@ -3244,7 +3359,7 @@ const Divider = forwardRef(function Divider2({
3244
3359
  })
3245
3360
  });
3246
3361
  });
3247
- function registerComponent$6(runtime) {
3362
+ function registerComponent$7(runtime) {
3248
3363
  return runtime.registerComponent(Divider, {
3249
3364
  type: "./components/Divider/index.js",
3250
3365
  label: "Divider",
@@ -3294,7 +3409,7 @@ function registerComponent$6(runtime) {
3294
3409
  }
3295
3410
  });
3296
3411
  }
3297
- const Container$7 = styled.div`
3412
+ const Container$8 = styled.div`
3298
3413
  min-height: 15px;
3299
3414
  ${cssWidth()}
3300
3415
  ${cssMargin()}
@@ -3374,7 +3489,7 @@ const Embed = forwardRef(function Embed2({
3374
3489
  }, [container, html]);
3375
3490
  if (shouldRender === false)
3376
3491
  return null;
3377
- return /* @__PURE__ */ jsx(Container$7, {
3492
+ return /* @__PURE__ */ jsx(Container$8, {
3378
3493
  ref: setContainer,
3379
3494
  id,
3380
3495
  margin,
@@ -3384,7 +3499,7 @@ const Embed = forwardRef(function Embed2({
3384
3499
  }
3385
3500
  });
3386
3501
  });
3387
- function registerComponent$5(runtime) {
3502
+ function registerComponent$6(runtime) {
3388
3503
  return runtime.registerComponent(Embed, {
3389
3504
  type: "./components/Embed/index.js",
3390
3505
  label: "Embed",
@@ -3606,7 +3721,7 @@ var Input$2 = forwardRef(function Input(_o, ref) {
3606
3721
  brandColor
3607
3722
  }));
3608
3723
  });
3609
- const Container$6 = styled.div`
3724
+ const Container$7 = styled.div`
3610
3725
  display: flex;
3611
3726
  flex-direction: column;
3612
3727
  ${cssWidth()};
@@ -3641,7 +3756,7 @@ var Placeholder$1 = forwardRef(function Placeholder2({
3641
3756
  width,
3642
3757
  margin
3643
3758
  }, ref) {
3644
- return /* @__PURE__ */ jsxs(Container$6, {
3759
+ return /* @__PURE__ */ jsxs(Container$7, {
3645
3760
  ref,
3646
3761
  width,
3647
3762
  margin,
@@ -3808,7 +3923,7 @@ function getCheckmarkColor$1({
3808
3923
  l
3809
3924
  }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
3810
3925
  }
3811
- const Container$5 = styled.div`
3926
+ const Container$6 = styled.div`
3812
3927
  position: relative;
3813
3928
  ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
3814
3929
  height: ${getSizeHeight(size)}px;
@@ -3928,7 +4043,7 @@ var Checkbox = forwardRef(function Checkbox2(_w, ref) {
3928
4043
  contrast,
3929
4044
  brandColor
3930
4045
  } = useFormContext();
3931
- return /* @__PURE__ */ jsxs(Container$5, {
4046
+ return /* @__PURE__ */ jsxs(Container$6, {
3932
4047
  size,
3933
4048
  children: [/* @__PURE__ */ jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
3934
4049
  type: "checkbox",
@@ -4071,7 +4186,7 @@ function getCheckmarkColor({
4071
4186
  l
4072
4187
  }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
4073
4188
  }
4074
- const Container$4 = styled.div`
4189
+ const Container$5 = styled.div`
4075
4190
  position: relative;
4076
4191
  ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
4077
4192
  height: ${getSizeHeight(size)}px;
@@ -4184,7 +4299,7 @@ var RadioButton = forwardRef(function RadioButton2(_C, ref) {
4184
4299
  contrast,
4185
4300
  brandColor
4186
4301
  } = useFormContext();
4187
- return /* @__PURE__ */ jsxs(Container$4, {
4302
+ return /* @__PURE__ */ jsxs(Container$5, {
4188
4303
  size,
4189
4304
  children: [/* @__PURE__ */ jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
4190
4305
  ref,
@@ -4256,7 +4371,7 @@ var TableColumnRadioButtonGroup = forwardRef(function TableColumnRadioButtonGrou
4256
4371
  }, option.id))]
4257
4372
  });
4258
4373
  });
4259
- const Container$3 = styled.div`
4374
+ const Container$4 = styled.div`
4260
4375
  ${cssField()}
4261
4376
  display: flex;
4262
4377
  align-items: center;
@@ -4321,7 +4436,7 @@ var TableColumnSingleSelect = forwardRef(function TableColumnSingleSelect2(_G, r
4321
4436
  children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
4322
4437
  htmlFor: id,
4323
4438
  children: label
4324
- }), /* @__PURE__ */ jsxs(Container$3, {
4439
+ }), /* @__PURE__ */ jsxs(Container$4, {
4325
4440
  error,
4326
4441
  shape,
4327
4442
  size,
@@ -5014,7 +5129,7 @@ const Form = forwardRef(function Form2({
5014
5129
  })
5015
5130
  });
5016
5131
  });
5017
- function registerComponent$4(runtime) {
5132
+ function registerComponent$5(runtime) {
5018
5133
  return runtime.registerComponent(Form, {
5019
5134
  type: "./components/Form/index.js",
5020
5135
  label: "Form",
@@ -5574,7 +5689,7 @@ function MobileDropDownButton(_Y) {
5574
5689
  const ButtonLink = styled(Button$1)`
5575
5690
  margin: 8px 0;
5576
5691
  `;
5577
- const Container$2 = styled.div`
5692
+ const Container$3 = styled.div`
5578
5693
  position: fixed;
5579
5694
  flex-direction: column;
5580
5695
  width: 100%;
@@ -5628,7 +5743,7 @@ function MobileMenu({
5628
5743
  onClose = () => {
5629
5744
  }
5630
5745
  }) {
5631
- return /* @__PURE__ */ jsxs(Container$2, {
5746
+ return /* @__PURE__ */ jsxs(Container$3, {
5632
5747
  animation,
5633
5748
  backgroundColor: useColor(backgroundColor),
5634
5749
  open,
@@ -5654,7 +5769,7 @@ function MobileMenu({
5654
5769
  })]
5655
5770
  });
5656
5771
  }
5657
- const Container$1 = styled.nav`
5772
+ const Container$2 = styled.nav`
5658
5773
  display: flex;
5659
5774
  align-items: center;
5660
5775
  ${cssWidth()}
@@ -5711,7 +5826,7 @@ const Navigation = forwardRef(function Navigation2({
5711
5826
  margin
5712
5827
  }, ref) {
5713
5828
  const [isOpen, setIsOpen] = useState(false);
5714
- return /* @__PURE__ */ jsxs(Container$1, {
5829
+ return /* @__PURE__ */ jsxs(Container$2, {
5715
5830
  ref,
5716
5831
  id,
5717
5832
  margin,
@@ -5759,7 +5874,7 @@ const Navigation = forwardRef(function Navigation2({
5759
5874
  })]
5760
5875
  });
5761
5876
  });
5762
- function registerComponent$3(runtime) {
5877
+ function registerComponent$4(runtime) {
5763
5878
  return runtime.registerComponent(Navigation, {
5764
5879
  type: "./components/Navigation/index.js",
5765
5880
  label: "Navigation",
@@ -5936,7 +6051,7 @@ const Root = forwardRef(function Page2({
5936
6051
  })]
5937
6052
  });
5938
6053
  });
5939
- function registerComponent$2(runtime) {
6054
+ function registerComponent$3(runtime) {
5940
6055
  return runtime.registerComponent(Root, {
5941
6056
  type: "./components/Root/index.js",
5942
6057
  label: "Page",
@@ -6613,7 +6728,7 @@ function SocialLinksPlaceholder({
6613
6728
  }, link.id))
6614
6729
  });
6615
6730
  }
6616
- const Container = styled.div`
6731
+ const Container$1 = styled.div`
6617
6732
  display: flex;
6618
6733
  flex-direction: row;
6619
6734
  flex-wrap: wrap;
@@ -6697,7 +6812,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
6697
6812
  }, ref) {
6698
6813
  const fillData = useColor(fill);
6699
6814
  const backgroundColorData = useColor(backgroundColor);
6700
- return /* @__PURE__ */ jsx(Container, {
6815
+ return /* @__PURE__ */ jsx(Container$1, {
6701
6816
  ref,
6702
6817
  id,
6703
6818
  alignment,
@@ -6733,7 +6848,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
6733
6848
  })
6734
6849
  });
6735
6850
  });
6736
- function registerComponent$1(runtime) {
6851
+ function registerComponent$2(runtime) {
6737
6852
  return runtime.registerComponent(SocialLinks, {
6738
6853
  type: "./components/SocialLinks/index.js",
6739
6854
  label: "Social Links",
@@ -7270,7 +7385,7 @@ const Text = forwardRef(function Text2({
7270
7385
  onKeyDown: handleKeyDown
7271
7386
  });
7272
7387
  });
7273
- function registerComponent(runtime) {
7388
+ function registerComponent$1(runtime) {
7274
7389
  return runtime.registerComponent(Text, {
7275
7390
  type: "./components/Text/index.js",
7276
7391
  label: "Text",
@@ -7348,19 +7463,103 @@ function registerComponent(runtime) {
7348
7463
  }
7349
7464
  });
7350
7465
  }
7466
+ const Container = styled.div`
7467
+ display: flex;
7468
+ flex-direction: column;
7469
+ overflow: hidden;
7470
+ ${cssWidth("560px")}
7471
+ ${cssMargin()}
7472
+ ${cssBorderRadius()}
7473
+ `;
7474
+ const ASPECT_RATIO = 16 / 9;
7475
+ const Video = forwardRef(function Video2({
7476
+ id,
7477
+ video,
7478
+ width,
7479
+ margin,
7480
+ borderRadius
7481
+ }, ref) {
7482
+ const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url);
7483
+ return /* @__PURE__ */ jsx(Container, {
7484
+ ref,
7485
+ id,
7486
+ width,
7487
+ margin,
7488
+ borderRadius,
7489
+ children: /* @__PURE__ */ jsx("div", {
7490
+ style: {
7491
+ position: "relative",
7492
+ paddingTop: `${100 / ASPECT_RATIO}%`
7493
+ },
7494
+ children: /* @__PURE__ */ jsx("div", {
7495
+ style: {
7496
+ position: "absolute",
7497
+ top: 0,
7498
+ left: 0,
7499
+ right: 0,
7500
+ bottom: 0
7501
+ },
7502
+ children: canPlayUrl === true ? /* @__PURE__ */ jsx(ReactPlayer, __spreadProps(__spreadValues({}, video), {
7503
+ width: "100%",
7504
+ height: "100%",
7505
+ config: {
7506
+ vimeo: {
7507
+ playerOptions: {
7508
+ background: video != null && !video.controls
7509
+ }
7510
+ },
7511
+ wistia: {
7512
+ options: {
7513
+ endVideoBehavior: video != null && video.loop === true ? "loop" : "default"
7514
+ }
7515
+ }
7516
+ }
7517
+ })) : /* @__PURE__ */ jsx("img", {
7518
+ width: "100%",
7519
+ src: placeholders.video.src,
7520
+ alt: "Video Placeholder"
7521
+ })
7522
+ })
7523
+ })
7524
+ });
7525
+ });
7526
+ function registerComponent(runtime) {
7527
+ return runtime.registerComponent(Video, {
7528
+ type: "./components/Video/index.js",
7529
+ label: "Video",
7530
+ icon: "Video40",
7531
+ props: {
7532
+ id: ElementID(),
7533
+ video: Video$1({
7534
+ preset: {
7535
+ controls: true
7536
+ }
7537
+ }),
7538
+ width: Width({
7539
+ defaultValue: {
7540
+ value: 560,
7541
+ unit: "px"
7542
+ }
7543
+ }),
7544
+ margin: Margin(),
7545
+ borderRadius: BorderRadius()
7546
+ }
7547
+ });
7548
+ }
7351
7549
  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);
7550
+ const unregisterBoxComponent = registerComponent$c(runtime);
7551
+ const unregisterButtonComponent = registerComponent$b(runtime);
7552
+ const unregisterCarouselComponent = registerComponent$9(runtime);
7553
+ const unregisterCountdownComponent = registerComponent$8(runtime);
7554
+ const unregisterDividerComponent = registerComponent$7(runtime);
7555
+ const unregisterEmbedComponent = registerComponent$6(runtime);
7556
+ const unregisterFormComponent = registerComponent$5(runtime);
7557
+ const unregisterImageComponent = registerComponent$a(runtime);
7558
+ const unregisterNavigationComponent = registerComponent$4(runtime);
7559
+ const unregisterRootComponent = registerComponent$3(runtime);
7560
+ const unregisterSocialLinksComponent = registerComponent$2(runtime);
7561
+ const unregisterTextComponent = registerComponent$1(runtime);
7562
+ const unregisterVideoComponent = registerComponent(runtime);
7364
7563
  return () => {
7365
7564
  unregisterBoxComponent();
7366
7565
  unregisterButtonComponent();
@@ -7374,6 +7573,8 @@ function registerBuiltinComponents(runtime) {
7374
7573
  unregisterRootComponent();
7375
7574
  unregisterSocialLinksComponent();
7376
7575
  unregisterTextComponent();
7576
+ unregisterTextComponent();
7577
+ unregisterVideoComponent();
7377
7578
  };
7378
7579
  }
7379
7580
  const contextDefaultValue = configureStore();
@@ -7402,10 +7603,9 @@ function createReactRuntime(store) {
7402
7603
  const ReactRuntime = createReactRuntime(contextDefaultValue);
7403
7604
  const Context = createContext(contextDefaultValue);
7404
7605
  function RuntimeProvider({
7606
+ client,
7405
7607
  children,
7406
- defaultRootElements,
7407
- registerComponents,
7408
- makeswiftApiEndpoint
7608
+ defaultRootElements
7409
7609
  }) {
7410
7610
  const [store, setStore] = useState(() => {
7411
7611
  const store2 = configureStore({
@@ -7414,27 +7614,11 @@ function RuntimeProvider({
7414
7614
  });
7415
7615
  const runtime = createReactRuntime(store2);
7416
7616
  registerBuiltinComponents(runtime);
7417
- registerComponents == null ? void 0 : registerComponents(runtime);
7418
7617
  return store2;
7419
7618
  });
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
7619
  useEffect(() => {
7433
7620
  return registerBuiltinComponents(createReactRuntime(store));
7434
7621
  }, [store]);
7435
- useEffect(() => {
7436
- return registerComponents == null ? void 0 : registerComponents(createReactRuntime(store));
7437
- }, [store, registerComponents]);
7438
7622
  useEffect(() => {
7439
7623
  const isInBuilder = window.parent !== window;
7440
7624
  if (isInBuilder)
@@ -7443,7 +7627,7 @@ function RuntimeProvider({
7443
7627
  const ReactBuilderPreview = await import("./react-builder-preview.es.js");
7444
7628
  setStore((store2) => ReactBuilderPreview.configureStore({
7445
7629
  preloadedState: store2.getState(),
7446
- client
7630
+ client: client.apolloClient
7447
7631
  }));
7448
7632
  }
7449
7633
  }, [client]);
@@ -7470,7 +7654,7 @@ function RuntimeProvider({
7470
7654
  }, []);
7471
7655
  return /* @__PURE__ */ jsx(Context.Provider, {
7472
7656
  value: store,
7473
- children: /* @__PURE__ */ jsx(ApolloProvider, {
7657
+ children: /* @__PURE__ */ jsx(MakeswiftProvider, {
7474
7658
  client,
7475
7659
  children
7476
7660
  })
@@ -7652,5 +7836,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
7652
7836
  document
7653
7837
  });
7654
7838
  }));
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 };
7839
+ 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
7840
  //# sourceMappingURL=react.es2.js.map