@makeswift/runtime 0.5.0 → 0.5.2
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/Box.cjs.js +30 -270
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +29 -269
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +1 -1
- package/dist/Button.es.js +2 -2
- package/dist/Carousel.cjs.js +3 -4
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +2 -3
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.es.js +1 -1
- package/dist/Embed.cjs.js +2 -1
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +2 -2
- package/dist/Image.cjs.js +1 -1
- package/dist/Image.es.js +2 -2
- package/dist/LiveProvider.es.js +1 -1
- package/dist/Navigation.cjs.js +4 -3
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +4 -3
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.es.js +1 -1
- package/dist/Root.cjs.js +5 -5
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +3 -3
- package/dist/SocialLinks.cjs.js +2 -2
- package/dist/SocialLinks.es.js +3 -3
- package/dist/Text.cjs.js +1 -1
- package/dist/Text.es.js +2 -2
- package/dist/Video.es.js +1 -1
- package/dist/api.cjs.js +11 -20
- package/dist/api.cjs.js.map +1 -1
- package/dist/api.es.js +11 -20
- package/dist/api.es.js.map +1 -1
- package/dist/components.cjs.js +10 -9
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +9 -8
- package/dist/components.es.js.map +1 -1
- package/dist/index.cjs.js +73 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +711 -92
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +107 -20
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +59 -0
- package/dist/index.cjs4.js.map +1 -0
- package/dist/index.es.js +74 -43
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +708 -93
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es3.js +103 -21
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +58 -0
- package/dist/index.es4.js.map +1 -0
- package/dist/next.es.js +1 -1
- package/dist/types/src/api/graphql/documents/fragments.d.ts +7 -1
- package/dist/types/src/api/graphql/documents/fragments.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/Box.d.ts +18 -26
- package/dist/types/src/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Box/animations.d.ts +13 -60
- package/dist/types/src/components/builtin/Box/animations.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/hooks/useMediaQuery.d.ts +1 -1
- package/dist/types/src/components/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts +1 -254
- package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/shared/grid-item.d.ts +9 -6
- package/dist/types/src/components/shared/grid-item.d.ts.map +1 -1
- package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
- package/dist/useIsomorphicLayoutEffect.cjs.js +6 -0
- package/dist/useIsomorphicLayoutEffect.cjs.js.map +1 -0
- package/dist/useIsomorphicLayoutEffect.es.js +5 -0
- package/dist/useIsomorphicLayoutEffect.es.js.map +1 -0
- package/package.json +1 -1
- package/dist/grid-item.cjs.js +0 -603
- package/dist/grid-item.cjs.js.map +0 -1
- package/dist/grid-item.es.js +0 -595
- package/dist/grid-item.es.js.map +0 -1
- package/dist/useMediaQuery.cjs.js +0 -26
- package/dist/useMediaQuery.cjs.js.map +0 -1
- package/dist/useMediaQuery.es.js +0 -25
- package/dist/useMediaQuery.es.js.map +0 -1
package/dist/grid-item.cjs.js
DELETED
|
@@ -1,603 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
var css = require("@emotion/css");
|
|
34
|
-
var framerMotion = require("framer-motion");
|
|
35
|
-
var React = require("react");
|
|
36
|
-
var next = require("./index.cjs.js");
|
|
37
|
-
var reactPage = require("./react-page.cjs.js");
|
|
38
|
-
require("./slot.cjs.js");
|
|
39
|
-
require("use-sync-external-store/shim");
|
|
40
|
-
var NextImage = require("next/image");
|
|
41
|
-
var jsxRuntime = require("react/jsx-runtime");
|
|
42
|
-
var ReactPlayer = require("react-player");
|
|
43
|
-
var nextVersion = require("./next-version.cjs.js");
|
|
44
|
-
function _interopDefaultLegacy(e) {
|
|
45
|
-
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
46
|
-
}
|
|
47
|
-
var NextImage__default = /* @__PURE__ */ _interopDefaultLegacy(NextImage);
|
|
48
|
-
var ReactPlayer__default = /* @__PURE__ */ _interopDefaultLegacy(ReactPlayer);
|
|
49
|
-
function useBackgrounds(value) {
|
|
50
|
-
const fileIds = reactPage.getBackgroundsFileIds(value);
|
|
51
|
-
const files = next.useFiles(fileIds);
|
|
52
|
-
const swatchIds = reactPage.getBackgroundsSwatchIds(value);
|
|
53
|
-
const swatches = next.useSwatches(swatchIds);
|
|
54
|
-
return React.useMemo(() => {
|
|
55
|
-
if (value == null)
|
|
56
|
-
return null;
|
|
57
|
-
return value.map((_a) => {
|
|
58
|
-
var _b = _a, { value: backgrounds } = _b, restOfValue = __objRest(_b, ["value"]);
|
|
59
|
-
return __spreadProps(__spreadValues({}, restOfValue), {
|
|
60
|
-
value: backgrounds.map((bg) => {
|
|
61
|
-
if (bg.type === "image" && bg.payload != null && bg.payload.imageId != null) {
|
|
62
|
-
const _a2 = bg.payload, { imageId } = _a2, restOfPayload = __objRest(_a2, ["imageId"]);
|
|
63
|
-
const file = files.find((f) => f && f.id === imageId);
|
|
64
|
-
return file && {
|
|
65
|
-
id: bg.id,
|
|
66
|
-
type: "image",
|
|
67
|
-
payload: __spreadProps(__spreadValues({}, restOfPayload), {
|
|
68
|
-
publicUrl: file.publicUrl,
|
|
69
|
-
dimensions: file.dimensions
|
|
70
|
-
})
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (bg.type === "color" && bg.payload != null) {
|
|
74
|
-
const { swatchId, alpha } = bg.payload;
|
|
75
|
-
const swatch = swatches.filter(reactPage.isNonNullable).find((s) => s && s.id === swatchId);
|
|
76
|
-
return { id: bg.id, type: "color", payload: { swatch, alpha } };
|
|
77
|
-
}
|
|
78
|
-
if (bg.type === "gradient" && bg.payload != null && bg.payload.stops.length > 0) {
|
|
79
|
-
return {
|
|
80
|
-
id: bg.id,
|
|
81
|
-
type: "gradient",
|
|
82
|
-
payload: {
|
|
83
|
-
angle: bg.payload.angle,
|
|
84
|
-
isRadial: bg.payload.isRadial,
|
|
85
|
-
stops: bg.payload.stops.map((_b2) => {
|
|
86
|
-
var _c = _b2, { color } = _c, restOfStop = __objRest(_c, ["color"]);
|
|
87
|
-
return __spreadProps(__spreadValues({}, restOfStop), {
|
|
88
|
-
color: color && {
|
|
89
|
-
swatch: swatches.filter(reactPage.isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
90
|
-
alpha: color.alpha
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (bg.type === "video" && bg.payload != null) {
|
|
98
|
-
const _d = bg.payload, { maskColor } = _d, restOfPayload = __objRest(_d, ["maskColor"]);
|
|
99
|
-
const swatch = maskColor && swatches.find((s) => s && s.id === maskColor.swatchId);
|
|
100
|
-
return {
|
|
101
|
-
id: bg.id,
|
|
102
|
-
type: "video",
|
|
103
|
-
payload: __spreadProps(__spreadValues({}, restOfPayload), {
|
|
104
|
-
maskColor: swatch && maskColor && { swatch, alpha: maskColor.alpha }
|
|
105
|
-
})
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return null;
|
|
109
|
-
}).filter(reactPage.isNonNullable)
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}, [files, swatches, value]);
|
|
113
|
-
}
|
|
114
|
-
const clamp = (min, val, max) => Math.min(Math.max(min, val), max);
|
|
115
|
-
function isScrollable(element) {
|
|
116
|
-
const {
|
|
117
|
-
overflow,
|
|
118
|
-
overflowY,
|
|
119
|
-
overflowX
|
|
120
|
-
} = element.ownerDocument.defaultView.getComputedStyle(element);
|
|
121
|
-
return /(auto|scroll)/.test(overflow + overflowX + overflowY);
|
|
122
|
-
}
|
|
123
|
-
function getScrollParent(element) {
|
|
124
|
-
const {
|
|
125
|
-
parentElement
|
|
126
|
-
} = element;
|
|
127
|
-
if (!element || !parentElement)
|
|
128
|
-
return element;
|
|
129
|
-
if (isScrollable(element))
|
|
130
|
-
return element;
|
|
131
|
-
return getScrollParent(parentElement);
|
|
132
|
-
}
|
|
133
|
-
function Parallax(_a) {
|
|
134
|
-
var _b = _a, {
|
|
135
|
-
strength,
|
|
136
|
-
children
|
|
137
|
-
} = _b, rest = __objRest(_b, [
|
|
138
|
-
"strength",
|
|
139
|
-
"children"
|
|
140
|
-
]);
|
|
141
|
-
const container = React.useRef(null);
|
|
142
|
-
const [containerScrollTop, setContainerScrollTop] = React.useState(strength == null ? 0 : strength);
|
|
143
|
-
const lastScrollParentScrollTop = React.useRef(0);
|
|
144
|
-
next.useIsomorphicLayoutEffect(() => {
|
|
145
|
-
if (!container.current || strength == null || strength === 0)
|
|
146
|
-
return void 0;
|
|
147
|
-
const containerDocument = container.current.ownerDocument;
|
|
148
|
-
const scrollParent = getScrollParent(container.current);
|
|
149
|
-
const eventTarget = containerDocument.documentElement === scrollParent ? containerDocument.defaultView : scrollParent;
|
|
150
|
-
lastScrollParentScrollTop.current = scrollParent.scrollTop;
|
|
151
|
-
setContainerScrollTop(strength);
|
|
152
|
-
function handleScroll() {
|
|
153
|
-
containerDocument.defaultView.requestAnimationFrame(() => {
|
|
154
|
-
if (!container.current)
|
|
155
|
-
return;
|
|
156
|
-
const {
|
|
157
|
-
top: containerTop,
|
|
158
|
-
bottom: containerBottom
|
|
159
|
-
} = container.current.getBoundingClientRect();
|
|
160
|
-
const {
|
|
161
|
-
top: scrollParentTop,
|
|
162
|
-
bottom: scrollParentBottom
|
|
163
|
-
} = scrollParent === containerDocument.documentElement ? {
|
|
164
|
-
top: 0,
|
|
165
|
-
bottom: containerDocument.defaultView.innerHeight
|
|
166
|
-
} : scrollParent.getBoundingClientRect();
|
|
167
|
-
const {
|
|
168
|
-
scrollTop: scrollParentScrollTop
|
|
169
|
-
} = scrollParent === containerDocument.documentElement ? {
|
|
170
|
-
scrollTop: containerDocument.defaultView.pageYOffset
|
|
171
|
-
} : scrollParent;
|
|
172
|
-
const scrollParentHeight = scrollParentBottom - scrollParentTop;
|
|
173
|
-
const scrollParentScrollDelta = scrollParentScrollTop - lastScrollParentScrollTop.current;
|
|
174
|
-
lastScrollParentScrollTop.current = scrollParentScrollTop;
|
|
175
|
-
setContainerScrollTop((scrollTop) => {
|
|
176
|
-
const isContainerVisible = containerTop < scrollParentTop + scrollParentHeight && containerBottom > scrollParentTop;
|
|
177
|
-
const containerScrollRemaining = scrollParentScrollDelta > 0 ? 2 * strength - scrollTop : scrollTop;
|
|
178
|
-
const scrollParentScrollRemaining = scrollParentScrollDelta > 0 ? scrollParentTop + containerBottom : scrollParentHeight - containerTop;
|
|
179
|
-
const parallaxRatio = containerScrollRemaining / scrollParentScrollRemaining;
|
|
180
|
-
const containerScrollDelta = isContainerVisible ? parallaxRatio * scrollParentScrollDelta : 0;
|
|
181
|
-
return clamp(0, scrollTop + containerScrollDelta, strength * 2);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
eventTarget.addEventListener("scroll", handleScroll);
|
|
186
|
-
return () => eventTarget.removeEventListener("scroll", handleScroll);
|
|
187
|
-
}, [strength]);
|
|
188
|
-
const getProps = React.useCallback((_a2) => {
|
|
189
|
-
var _b2 = _a2, {
|
|
190
|
-
style
|
|
191
|
-
} = _b2, restOfChildrenProps = __objRest(_b2, [
|
|
192
|
-
"style"
|
|
193
|
-
]);
|
|
194
|
-
return __spreadProps(__spreadValues({}, restOfChildrenProps), {
|
|
195
|
-
style: __spreadValues(__spreadProps(__spreadValues({}, style), {
|
|
196
|
-
position: "absolute",
|
|
197
|
-
left: 0,
|
|
198
|
-
right: 0,
|
|
199
|
-
top: 0,
|
|
200
|
-
bottom: 0
|
|
201
|
-
}), strength == null || strength === 0 ? {} : {
|
|
202
|
-
top: -strength,
|
|
203
|
-
bottom: -strength,
|
|
204
|
-
transform: `translate3d(0, ${containerScrollTop - strength}px, 0)`
|
|
205
|
-
})
|
|
206
|
-
});
|
|
207
|
-
}, [strength, containerScrollTop]);
|
|
208
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({}, rest), {
|
|
209
|
-
ref: container,
|
|
210
|
-
style: {
|
|
211
|
-
position: "absolute",
|
|
212
|
-
top: 0,
|
|
213
|
-
left: 0,
|
|
214
|
-
right: 0,
|
|
215
|
-
bottom: 0
|
|
216
|
-
},
|
|
217
|
-
children: children(getProps)
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
const Container = React.forwardRef(function Container2(_c, ref) {
|
|
221
|
-
var _d = _c, {
|
|
222
|
-
className
|
|
223
|
-
} = _d, restOfProps = __objRest(_d, [
|
|
224
|
-
"className"
|
|
225
|
-
]);
|
|
226
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({}, restOfProps), {
|
|
227
|
-
ref,
|
|
228
|
-
className: css.cx(next.useStyle({
|
|
229
|
-
position: "absolute",
|
|
230
|
-
top: 0,
|
|
231
|
-
left: 0,
|
|
232
|
-
right: 0,
|
|
233
|
-
bottom: 0,
|
|
234
|
-
pointerEvents: "none",
|
|
235
|
-
overflow: "hidden"
|
|
236
|
-
}), className)
|
|
237
|
-
}));
|
|
238
|
-
});
|
|
239
|
-
function Mask({
|
|
240
|
-
backgroundColor,
|
|
241
|
-
visible
|
|
242
|
-
}) {
|
|
243
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
244
|
-
className: next.useStyle({
|
|
245
|
-
position: "absolute",
|
|
246
|
-
top: 0,
|
|
247
|
-
left: 0,
|
|
248
|
-
right: 0,
|
|
249
|
-
bottom: 0,
|
|
250
|
-
background: backgroundColor,
|
|
251
|
-
opacity: visible ? 1 : 0,
|
|
252
|
-
transition: "opacity 1s"
|
|
253
|
-
})
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
const getScale = (element, aspectRatio, zoom) => {
|
|
257
|
-
const {
|
|
258
|
-
offsetWidth: width,
|
|
259
|
-
offsetHeight: height
|
|
260
|
-
} = element;
|
|
261
|
-
const computedAspectRatio = width / height;
|
|
262
|
-
return Math.max(aspectRatio / computedAspectRatio, computedAspectRatio / aspectRatio) * zoom;
|
|
263
|
-
};
|
|
264
|
-
function BackgroundVideo({
|
|
265
|
-
url = "",
|
|
266
|
-
aspectRatio = 16 / 9,
|
|
267
|
-
zoom = 1,
|
|
268
|
-
maskColor,
|
|
269
|
-
opacity
|
|
270
|
-
}) {
|
|
271
|
-
var _a;
|
|
272
|
-
const [ready, setReady] = React.useState(false);
|
|
273
|
-
const [scale, setScale] = React.useState(1);
|
|
274
|
-
const container = React.useRef(null);
|
|
275
|
-
next.useIsomorphicLayoutEffect(() => {
|
|
276
|
-
const {
|
|
277
|
-
current: containerEl
|
|
278
|
-
} = container;
|
|
279
|
-
if (!containerEl)
|
|
280
|
-
return void 0;
|
|
281
|
-
const {
|
|
282
|
-
defaultView
|
|
283
|
-
} = containerEl.ownerDocument;
|
|
284
|
-
const handleResize = () => setScale(getScale(containerEl, aspectRatio, zoom));
|
|
285
|
-
handleResize();
|
|
286
|
-
defaultView.addEventListener("resize", handleResize);
|
|
287
|
-
return () => defaultView.removeEventListener("resize", handleResize);
|
|
288
|
-
}, [aspectRatio, zoom]);
|
|
289
|
-
if (!ReactPlayer__default["default"].canPlay(url))
|
|
290
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
291
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Container, {
|
|
292
|
-
ref: container,
|
|
293
|
-
children: [container.current && /* @__PURE__ */ jsxRuntime.jsx(ReactPlayer__default["default"], {
|
|
294
|
-
url,
|
|
295
|
-
config: {
|
|
296
|
-
vimeo: {
|
|
297
|
-
playerOptions: {
|
|
298
|
-
background: true
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
youtube: {
|
|
302
|
-
playerVars: {
|
|
303
|
-
origin: (_a = container.current.ownerDocument.defaultView) == null ? void 0 : _a.location.origin
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
wistia: {
|
|
307
|
-
options: {
|
|
308
|
-
endVideoBehavior: "loop",
|
|
309
|
-
playbackRateControl: false,
|
|
310
|
-
playbar: false,
|
|
311
|
-
playButton: false,
|
|
312
|
-
volumeControl: false,
|
|
313
|
-
fullscreenButton: false,
|
|
314
|
-
muted: true
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
playing: true,
|
|
319
|
-
loop: true,
|
|
320
|
-
muted: true,
|
|
321
|
-
controls: false,
|
|
322
|
-
onReady: () => setReady(true),
|
|
323
|
-
style: {
|
|
324
|
-
transform: `scale3d(${scale}, ${scale}, 1)`,
|
|
325
|
-
opacity
|
|
326
|
-
},
|
|
327
|
-
width: "100%",
|
|
328
|
-
height: "100%"
|
|
329
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(Mask, {
|
|
330
|
-
backgroundColor: maskColor,
|
|
331
|
-
visible: !ready
|
|
332
|
-
})]
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
const NextLegacyImage = NextImage__default["default"];
|
|
336
|
-
function getColor(color) {
|
|
337
|
-
if (color == null)
|
|
338
|
-
return "black";
|
|
339
|
-
if (color.swatch == null) {
|
|
340
|
-
return next.colorToString(__spreadProps(__spreadValues({}, color), {
|
|
341
|
-
swatch: {
|
|
342
|
-
hue: 0,
|
|
343
|
-
saturation: 0,
|
|
344
|
-
lightness: 0
|
|
345
|
-
}
|
|
346
|
-
}));
|
|
347
|
-
}
|
|
348
|
-
return next.colorToString(color);
|
|
349
|
-
}
|
|
350
|
-
const getStopsStyle = (stops) => stops.map(({
|
|
351
|
-
color,
|
|
352
|
-
location
|
|
353
|
-
}) => `${getColor(color)} ${location}%`).join(",");
|
|
354
|
-
const absoluteFillStyle = {
|
|
355
|
-
position: "absolute",
|
|
356
|
-
top: 0,
|
|
357
|
-
right: 0,
|
|
358
|
-
bottom: 0,
|
|
359
|
-
left: 0
|
|
360
|
-
};
|
|
361
|
-
const containerStyle = __spreadProps(__spreadValues({}, absoluteFillStyle), {
|
|
362
|
-
borderRadius: "inherit"
|
|
363
|
-
});
|
|
364
|
-
function Backgrounds({
|
|
365
|
-
backgrounds
|
|
366
|
-
}) {
|
|
367
|
-
if (backgrounds == null)
|
|
368
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
369
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
370
|
-
children: backgrounds.map(({
|
|
371
|
-
value,
|
|
372
|
-
deviceId
|
|
373
|
-
}) => {
|
|
374
|
-
const visibility = backgrounds.map((v) => ({
|
|
375
|
-
deviceId: v.deviceId,
|
|
376
|
-
value: v.deviceId === deviceId
|
|
377
|
-
}));
|
|
378
|
-
return /* @__PURE__ */ jsxRuntime.jsx(BackgroundDeviceLayer, {
|
|
379
|
-
layer: value,
|
|
380
|
-
visibility
|
|
381
|
-
}, deviceId);
|
|
382
|
-
})
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
function BackgroundDeviceLayer({
|
|
386
|
-
layer,
|
|
387
|
-
visibility
|
|
388
|
-
}) {
|
|
389
|
-
const visibilityStyle = next.responsiveStyle([visibility], ([v]) => ({
|
|
390
|
-
display: v === true ? "block" : "none"
|
|
391
|
-
}));
|
|
392
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
393
|
-
className: next.useStyle(__spreadProps(__spreadValues(__spreadValues({}, containerStyle), visibilityStyle), {
|
|
394
|
-
overflow: "hidden"
|
|
395
|
-
})),
|
|
396
|
-
children: [...layer].reverse().map((bg) => {
|
|
397
|
-
if (bg.type === "color") {
|
|
398
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ColorBackground, {
|
|
399
|
-
color: getColor(bg.payload)
|
|
400
|
-
}, bg.id);
|
|
401
|
-
}
|
|
402
|
-
if (bg.type === "image" && bg.payload) {
|
|
403
|
-
return /* @__PURE__ */ React.createElement(ImageBackground, __spreadProps(__spreadValues({}, bg.payload), {
|
|
404
|
-
key: bg.id
|
|
405
|
-
}));
|
|
406
|
-
}
|
|
407
|
-
if (bg.type === "gradient" && bg.payload) {
|
|
408
|
-
return /* @__PURE__ */ React.createElement(GradientBackground, __spreadProps(__spreadValues({}, bg.payload), {
|
|
409
|
-
key: bg.id,
|
|
410
|
-
gradient: getStopsStyle(bg.payload.stops)
|
|
411
|
-
}));
|
|
412
|
-
}
|
|
413
|
-
if (bg.type === "video" && bg.payload) {
|
|
414
|
-
return /* @__PURE__ */ React.createElement(VideoBackground, __spreadProps(__spreadValues({}, bg.payload), {
|
|
415
|
-
key: bg.id,
|
|
416
|
-
maskColor: getColor(bg.payload.maskColor)
|
|
417
|
-
}));
|
|
418
|
-
}
|
|
419
|
-
return null;
|
|
420
|
-
})
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
function ColorBackground({
|
|
424
|
-
color
|
|
425
|
-
}) {
|
|
426
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
427
|
-
className: next.useStyle(__spreadProps(__spreadValues({}, containerStyle), {
|
|
428
|
-
backgroundColor: color
|
|
429
|
-
}))
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
const ImageBackgroundRepeat = {
|
|
433
|
-
NoRepeat: "no-repeat",
|
|
434
|
-
RepeatX: "repeat-x",
|
|
435
|
-
RepeatY: "repeat-y",
|
|
436
|
-
Repeat: "repeat"
|
|
437
|
-
};
|
|
438
|
-
const ImageBackgroundSize = {
|
|
439
|
-
Cover: "cover",
|
|
440
|
-
Contain: "contain",
|
|
441
|
-
Auto: "auto"
|
|
442
|
-
};
|
|
443
|
-
function ImageBackground({
|
|
444
|
-
publicUrl,
|
|
445
|
-
position,
|
|
446
|
-
repeat = ImageBackgroundRepeat.NoRepeat,
|
|
447
|
-
size = ImageBackgroundSize.Cover,
|
|
448
|
-
opacity,
|
|
449
|
-
parallax
|
|
450
|
-
}) {
|
|
451
|
-
const backgroundPosition = `${position.x}% ${position.y}%`;
|
|
452
|
-
const containerClassName = next.useStyle(containerStyle);
|
|
453
|
-
if (repeat === "no-repeat" && size !== "auto" && publicUrl != null) {
|
|
454
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
|
|
455
|
-
strength: parallax,
|
|
456
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({}, getParallaxProps({
|
|
457
|
-
style: {
|
|
458
|
-
opacity,
|
|
459
|
-
overflow: "hidden"
|
|
460
|
-
}
|
|
461
|
-
})), {
|
|
462
|
-
children: nextVersion.major < 13 ? /* @__PURE__ */ jsxRuntime.jsx(NextLegacyImage, {
|
|
463
|
-
src: publicUrl,
|
|
464
|
-
layout: "fill",
|
|
465
|
-
objectPosition: backgroundPosition,
|
|
466
|
-
objectFit: size
|
|
467
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx(NextImage__default["default"], {
|
|
468
|
-
src: publicUrl,
|
|
469
|
-
alt: "",
|
|
470
|
-
fill: true,
|
|
471
|
-
sizes: "100vw",
|
|
472
|
-
style: {
|
|
473
|
-
objectPosition: backgroundPosition,
|
|
474
|
-
objectFit: size
|
|
475
|
-
}
|
|
476
|
-
})
|
|
477
|
-
}))
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
|
|
481
|
-
strength: parallax,
|
|
482
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx("div", __spreadValues({
|
|
483
|
-
className: containerClassName
|
|
484
|
-
}, getParallaxProps({
|
|
485
|
-
style: {
|
|
486
|
-
backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
|
|
487
|
-
backgroundPosition,
|
|
488
|
-
backgroundRepeat: repeat,
|
|
489
|
-
backgroundSize: size,
|
|
490
|
-
opacity
|
|
491
|
-
}
|
|
492
|
-
})))
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
function GradientBackground({
|
|
496
|
-
gradient,
|
|
497
|
-
isRadial = false,
|
|
498
|
-
angle = Math.PI
|
|
499
|
-
}) {
|
|
500
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
501
|
-
className: next.useStyle(__spreadProps(__spreadValues({}, containerStyle), {
|
|
502
|
-
background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
|
|
503
|
-
}))
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
function getAspectRatio(aspectRatio) {
|
|
507
|
-
switch (aspectRatio) {
|
|
508
|
-
case "wide":
|
|
509
|
-
return 16 / 9;
|
|
510
|
-
case "standard":
|
|
511
|
-
return 4 / 3;
|
|
512
|
-
default:
|
|
513
|
-
return 16 / 9;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function VideoBackground({
|
|
517
|
-
url,
|
|
518
|
-
aspectRatio,
|
|
519
|
-
maskColor,
|
|
520
|
-
zoom,
|
|
521
|
-
opacity,
|
|
522
|
-
parallax
|
|
523
|
-
}) {
|
|
524
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
|
|
525
|
-
strength: parallax,
|
|
526
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({}, getParallaxProps({
|
|
527
|
-
className: next.useStyle(containerStyle)
|
|
528
|
-
})), {
|
|
529
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(BackgroundVideo, {
|
|
530
|
-
url,
|
|
531
|
-
zoom,
|
|
532
|
-
opacity,
|
|
533
|
-
aspectRatio: getAspectRatio(aspectRatio),
|
|
534
|
-
maskColor
|
|
535
|
-
})
|
|
536
|
-
}))
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
var BackgroundsContainer = React.forwardRef(function BackgroundsContainer2(_e, ref) {
|
|
540
|
-
var _f = _e, {
|
|
541
|
-
hasAnimations = false,
|
|
542
|
-
backgrounds,
|
|
543
|
-
children,
|
|
544
|
-
className
|
|
545
|
-
} = _f, restOfProps = __objRest(_f, [
|
|
546
|
-
"hasAnimations",
|
|
547
|
-
"backgrounds",
|
|
548
|
-
"children",
|
|
549
|
-
"className"
|
|
550
|
-
]);
|
|
551
|
-
const [handle, setHandle] = React.useState(null);
|
|
552
|
-
const Component = hasAnimations ? framerMotion.motion.div : "div";
|
|
553
|
-
React.useImperativeHandle(ref, () => handle, [handle]);
|
|
554
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Component, __spreadProps(__spreadValues({}, restOfProps), {
|
|
555
|
-
ref: setHandle,
|
|
556
|
-
className: css.cx(next.useStyle({
|
|
557
|
-
position: "relative",
|
|
558
|
-
width: "100%",
|
|
559
|
-
margin: "0 auto",
|
|
560
|
-
"> *": {
|
|
561
|
-
borderRadius: "inherit",
|
|
562
|
-
height: "inherit"
|
|
563
|
-
},
|
|
564
|
-
"> :last-child": {
|
|
565
|
-
position: "relative"
|
|
566
|
-
}
|
|
567
|
-
}), className),
|
|
568
|
-
children: [/* @__PURE__ */ jsxRuntime.jsx(Backgrounds, {
|
|
569
|
-
backgrounds: useBackgrounds(backgrounds)
|
|
570
|
-
}), React.Children.only(children)]
|
|
571
|
-
}));
|
|
572
|
-
});
|
|
573
|
-
function GridItem(_g) {
|
|
574
|
-
var _h = _g, {
|
|
575
|
-
as,
|
|
576
|
-
grid,
|
|
577
|
-
index,
|
|
578
|
-
columnGap,
|
|
579
|
-
rowGap,
|
|
580
|
-
className
|
|
581
|
-
} = _h, restOfProps = __objRest(_h, [
|
|
582
|
-
"as",
|
|
583
|
-
"grid",
|
|
584
|
-
"index",
|
|
585
|
-
"columnGap",
|
|
586
|
-
"rowGap",
|
|
587
|
-
"className"
|
|
588
|
-
]);
|
|
589
|
-
const gridItemClassName = next.useStyle(next.responsiveGridItem({
|
|
590
|
-
grid,
|
|
591
|
-
index,
|
|
592
|
-
columnGap,
|
|
593
|
-
rowGap
|
|
594
|
-
}));
|
|
595
|
-
const Component = as != null ? as : "div";
|
|
596
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, __spreadProps(__spreadValues({}, restOfProps), {
|
|
597
|
-
className: css.cx(gridItemClassName, className)
|
|
598
|
-
}));
|
|
599
|
-
}
|
|
600
|
-
exports.BackgroundsContainer = BackgroundsContainer;
|
|
601
|
-
exports.GridItem = GridItem;
|
|
602
|
-
exports.useBackgrounds = useBackgrounds;
|
|
603
|
-
//# sourceMappingURL=grid-item.cjs.js.map
|