@makeswift/runtime 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.cjs.js +2 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +2 -3
- package/dist/components.es.js.map +1 -1
- package/dist/index.cjs.js +25 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +23 -33
- package/dist/index.es.js.map +1 -1
- package/dist/next.cjs.js +23 -15
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +25 -17
- package/dist/next.es.js.map +1 -1
- package/dist/react-builder-preview.cjs.js +2 -3
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +3 -4
- package/dist/react-builder-preview.es.js.map +1 -1
- package/dist/react.cjs.js +2 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +2 -3
- package/dist/react.es.js.map +1 -1
- package/dist/types/api/react.d.ts +2 -3
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts.map +1 -1
- package/dist/types/next.d.ts +8 -4
- package/dist/types/next.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/style.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -43,9 +43,6 @@ import { f as registerComponentHandleEffect, g as mountComponentEffect, h as reg
|
|
|
43
43
|
import styled, { css, keyframes, createGlobalStyle } from "styled-components";
|
|
44
44
|
import { useReducedMotion, useAnimation, motion } from "framer-motion";
|
|
45
45
|
import { cx, css as css$1, cache } from "@emotion/css";
|
|
46
|
-
import { getDataFromTree } from "@apollo/client/react/ssr";
|
|
47
|
-
import { KeyUtils, Value } from "slate";
|
|
48
|
-
import uuid from "uuid/v4";
|
|
49
46
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
50
47
|
import parse$1 from "html-react-parser";
|
|
51
48
|
import Head from "next/head";
|
|
@@ -55,11 +52,13 @@ import scrollIntoView from "scroll-into-view-if-needed";
|
|
|
55
52
|
import NextLink from "next/link";
|
|
56
53
|
import { useGesture } from "react-use-gesture";
|
|
57
54
|
import { wrap } from "@popmotion/popcorn";
|
|
55
|
+
import uuid from "uuid/v4";
|
|
58
56
|
import NextImage from "next/image";
|
|
59
57
|
import { Field as Field$1, getIn, Formik } from "formik";
|
|
60
58
|
import { p as parse, c as createBox, g as getBox } from "./box-models.es.js";
|
|
61
59
|
import { normalize } from "polished";
|
|
62
60
|
import ReactPlayer from "react-player";
|
|
61
|
+
import { Value } from "slate";
|
|
63
62
|
import Hotkeys from "slate-hotkeys";
|
|
64
63
|
import ipsum from "corporate-ipsum";
|
|
65
64
|
import { isHotkey } from "is-hotkey";
|
|
@@ -306,9 +305,13 @@ const typePolicies = {
|
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
307
|
};
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
const isServer$1 = typeof window === "undefined";
|
|
309
|
+
let globalApolloClient = null;
|
|
310
|
+
function garbageCollectGlobalCacheData() {
|
|
311
|
+
globalApolloClient = null;
|
|
312
|
+
}
|
|
313
|
+
function getGlobalCacheData() {
|
|
314
|
+
return globalApolloClient == null ? void 0 : globalApolloClient.cache.extract();
|
|
312
315
|
}
|
|
313
316
|
function createApolloClient({
|
|
314
317
|
uri,
|
|
@@ -321,7 +324,8 @@ function createApolloClient({
|
|
|
321
324
|
cache2.restore(cacheData);
|
|
322
325
|
return new ApolloClient({
|
|
323
326
|
uri,
|
|
324
|
-
cache: cache2
|
|
327
|
+
cache: cache2,
|
|
328
|
+
ssrMode: isServer$1
|
|
325
329
|
});
|
|
326
330
|
}
|
|
327
331
|
class MakeswiftClient {
|
|
@@ -330,25 +334,14 @@ class MakeswiftClient {
|
|
|
330
334
|
cacheData
|
|
331
335
|
}) {
|
|
332
336
|
__publicField(this, "apolloClient");
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
value: true,
|
|
342
|
-
children: /* @__PURE__ */ jsx(RuntimeProvider, {
|
|
343
|
-
client: this,
|
|
344
|
-
rootElements: /* @__PURE__ */ new Map([[id, element]]),
|
|
345
|
-
children: /* @__PURE__ */ jsx(DocumentReference, {
|
|
346
|
-
documentReference: createDocumentReference(id)
|
|
347
|
-
})
|
|
348
|
-
})
|
|
349
|
-
}));
|
|
350
|
-
KeyUtils.resetGenerator();
|
|
351
|
-
return this.apolloClient.cache.extract();
|
|
337
|
+
if (globalApolloClient == null)
|
|
338
|
+
globalApolloClient = createApolloClient({
|
|
339
|
+
uri,
|
|
340
|
+
cacheData
|
|
341
|
+
});
|
|
342
|
+
else if (cacheData != null)
|
|
343
|
+
globalApolloClient.cache.restore(cacheData);
|
|
344
|
+
this.apolloClient = globalApolloClient;
|
|
352
345
|
}
|
|
353
346
|
updateCacheData(cacheData) {
|
|
354
347
|
this.apolloClient.cache.restore(cacheData);
|
|
@@ -1367,9 +1360,6 @@ const BackgroundsContainer$1 = styled(Container$c)`
|
|
|
1367
1360
|
function Backgrounds({
|
|
1368
1361
|
backgrounds
|
|
1369
1362
|
}) {
|
|
1370
|
-
const isPrefetching = useIsPrefetching();
|
|
1371
|
-
if (isPrefetching)
|
|
1372
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1373
1363
|
if (backgrounds == null)
|
|
1374
1364
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1375
1365
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
@@ -2349,7 +2339,6 @@ const ImageComponent = forwardRef(function Image2({
|
|
|
2349
2339
|
const dataDimensions = (fileData == null ? void 0 : fileData.publicUrl) ? fileData == null ? void 0 : fileData.dimensions : placeholder2.dimensions;
|
|
2350
2340
|
const [measuredDimensions, setMeasuredDimensions] = useState(null);
|
|
2351
2341
|
const isInBuilder = useIsInBuilder();
|
|
2352
|
-
const isPrefetching = useIsPrefetching();
|
|
2353
2342
|
useEffect(() => {
|
|
2354
2343
|
if (dataDimensions)
|
|
2355
2344
|
return;
|
|
@@ -2370,8 +2359,6 @@ const ImageComponent = forwardRef(function Image2({
|
|
|
2370
2359
|
if (!dimensions)
|
|
2371
2360
|
return null;
|
|
2372
2361
|
const widthClass = css$1(responsiveWidth(width, `${dimensions.width}px`));
|
|
2373
|
-
if (isPrefetching)
|
|
2374
|
-
return null;
|
|
2375
2362
|
return /* @__PURE__ */ jsx(ImageContainer, {
|
|
2376
2363
|
as: link ? Link : "div",
|
|
2377
2364
|
link,
|
|
@@ -8516,8 +8503,11 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
8516
8503
|
}
|
|
8517
8504
|
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
8518
8505
|
const useInsertionEffect = (_ea = React[useInsertionEffectSpecifier]) != null ? _ea : React.useLayoutEffect;
|
|
8506
|
+
const isServer = typeof window === "undefined";
|
|
8519
8507
|
function useFormattedStyle(styleControlData, controlDefinition) {
|
|
8520
8508
|
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
8509
|
+
if (isServer)
|
|
8510
|
+
return css$1(style);
|
|
8521
8511
|
const serialized = serializeStyles([style], cache.registered);
|
|
8522
8512
|
useInsertionEffect(() => {
|
|
8523
8513
|
insertStyles(cache, serialized, false);
|
|
@@ -9018,5 +9008,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
|
9018
9008
|
document: document2
|
|
9019
9009
|
});
|
|
9020
9010
|
}));
|
|
9021
|
-
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, useResponsiveColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P, PAGE_SNIPPETS_QUERY as Q, RuntimeProvider as R, SocialLinks as S, Text as T, SITE_FONTS_QUERY as U, Page2 as V,
|
|
9011
|
+
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, useResponsiveColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P, PAGE_SNIPPETS_QUERY as Q, RuntimeProvider as R, SocialLinks as S, Text as T, SITE_FONTS_QUERY as U, Page2 as V, garbageCollectGlobalCacheData as W, getGlobalCacheData as X, MakeswiftClient as Y, deepEqual as Z, 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 };
|
|
9022
9012
|
//# sourceMappingURL=index.es.js.map
|