@valbuild/next 0.85.0 → 0.85.1
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/client/dist/valbuild-next-client.cjs.dev.js +27 -5
- package/client/dist/valbuild-next-client.cjs.prod.js +27 -5
- package/client/dist/valbuild-next-client.esm.js +26 -4
- package/dist/ValApp-0ded607c.cjs.dev.js +133 -0
- package/dist/ValApp-489d97dc.esm.js +125 -0
- package/dist/ValApp-b10c2084.cjs.js +7 -0
- package/dist/ValApp-b10c2084.cjs.prod.js +133 -0
- package/dist/{ValNextProvider-25f1f5c9.esm.js → ValNextProvider-10c232b6.esm.js} +80 -44
- package/dist/ValNextProvider-7042b86d.cjs.js +7 -0
- package/dist/{ValNextProvider-a618d775.cjs.prod.js → ValNextProvider-7042b86d.cjs.prod.js} +80 -44
- package/dist/{ValNextProvider-c7952bdc.cjs.dev.js → ValNextProvider-726026f9.cjs.dev.js} +80 -44
- package/dist/cssUtils-9c11102f.cjs.dev.js +41 -0
- package/dist/cssUtils-b5651c03.esm.js +32 -0
- package/dist/cssUtils-d97a757c.cjs.prod.js +41 -0
- package/dist/declarations/src/ValApp.d.ts +1 -1
- package/dist/declarations/src/client/initValClient.d.ts +2 -0
- package/dist/declarations/src/rsc/initValRsc.d.ts +9 -0
- package/dist/{initValRouteFromVal-4e6253bf.esm.js → routeFromVal-248c62f1.esm.js} +17 -4
- package/dist/{initValRouteFromVal-0f4f2d39.cjs.prod.js → routeFromVal-a317debc.cjs.prod.js} +17 -3
- package/dist/{initValRouteFromVal-65dd1262.cjs.dev.js → routeFromVal-a3987ae3.cjs.dev.js} +17 -3
- package/dist/valbuild-next.cjs.dev.js +2 -2
- package/dist/valbuild-next.cjs.prod.js +2 -2
- package/dist/valbuild-next.esm.js +2 -2
- package/package.json +6 -6
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +134 -46
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +134 -46
- package/rsc/dist/valbuild-next-rsc.esm.js +133 -45
- package/dist/ValApp-0efa0e5d.cjs.dev.js +0 -63
- package/dist/ValApp-3ab62a2b.esm.js +0 -55
- package/dist/ValApp-a808cf89.cjs.js +0 -7
- package/dist/ValApp-a808cf89.cjs.prod.js +0 -63
- package/dist/ValNextProvider-a618d775.cjs.js +0 -7
- package/dist/useRemoteConfigSender-02451801.esm.js +0 -70
- package/dist/useRemoteConfigSender-3ea2fe91.cjs.prod.js +0 -76
- package/dist/useRemoteConfigSender-c78b81c5.cjs.dev.js +0 -76
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import { ValExternalStore, ValOverlayProvider } from './ValOverlayContext-6635a4d7.esm.js';
|
|
10
10
|
import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
11
11
|
import { createValClient } from '@valbuild/shared/internal';
|
|
12
|
-
import { u as
|
|
12
|
+
import { p as prefixStyles, u as useConfigStorageSave, v as valPrefixedClass, c as cn } from './cssUtils-b5651c03.esm.js';
|
|
13
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
14
|
import './unsupportedIterableToArray-5baabfdc.esm.js';
|
|
15
15
|
|
|
@@ -28,8 +28,8 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
28
28
|
}, []);
|
|
29
29
|
var _React$useState = React.useState(),
|
|
30
30
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
mountOverlay = _React$useState2[0],
|
|
32
|
+
setMountOverlay = _React$useState2[1];
|
|
33
33
|
var _React$useState3 = React.useState(null),
|
|
34
34
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
35
35
|
draftMode = _React$useState4[0],
|
|
@@ -37,7 +37,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
37
37
|
var _React$useState5 = React.useState(false),
|
|
38
38
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
39
39
|
spaReady = _React$useState6[0],
|
|
40
|
-
setSpaReady = _React$useState6[1];
|
|
40
|
+
setSpaReady = _React$useState6[1]; // TODO: consider removing spaReady - it is not used? If we remove, clean up the custom events that send the message too...
|
|
41
41
|
var router = useRouter();
|
|
42
42
|
var _React$useTransition = React.useTransition(),
|
|
43
43
|
_React$useTransition2 = _slicedToArray(_React$useTransition, 2),
|
|
@@ -47,20 +47,20 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
47
47
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
48
48
|
iframeSrc = _React$useState8[0],
|
|
49
49
|
setIframeSrc = _React$useState8[1];
|
|
50
|
-
useConsoleLogEnableVal(
|
|
50
|
+
useConsoleLogEnableVal(mountOverlay);
|
|
51
51
|
React.useEffect(function () {
|
|
52
52
|
if (location.search === "?message_onready=true") {
|
|
53
53
|
console.warn("Val is verifying draft mode...");
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
if (isValStudioPath(location.pathname)) {
|
|
57
|
-
|
|
57
|
+
setMountOverlay(false);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
setMountOverlay(document.cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
|
|
61
61
|
}, []);
|
|
62
62
|
React.useEffect(function () {
|
|
63
|
-
if (!
|
|
63
|
+
if (!mountOverlay) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
var interval = setInterval(function () {
|
|
@@ -76,9 +76,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
76
76
|
return function () {
|
|
77
77
|
clearInterval(interval);
|
|
78
78
|
};
|
|
79
|
-
}, [
|
|
79
|
+
}, [mountOverlay, props.disableRefresh]);
|
|
80
80
|
React.useEffect(function () {
|
|
81
|
-
if (!
|
|
81
|
+
if (!mountOverlay) {
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
if (draftMode === null) {
|
|
@@ -119,14 +119,14 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
119
119
|
return function () {
|
|
120
120
|
window.removeEventListener("val-overlay-provider", valProviderOverlayListener);
|
|
121
121
|
};
|
|
122
|
-
}, [
|
|
122
|
+
}, [mountOverlay, draftMode]);
|
|
123
123
|
var pollDraftStatIdRef = React.useRef(0);
|
|
124
124
|
React.useEffect(function () {
|
|
125
|
-
//
|
|
125
|
+
// continuous polling to check for updates:
|
|
126
126
|
|
|
127
127
|
var timeout;
|
|
128
128
|
function pollCurrentDraftMode() {
|
|
129
|
-
if (!
|
|
129
|
+
if (!mountOverlay) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
window.dispatchEvent(new CustomEvent("val-overlay-spa", {
|
|
@@ -173,9 +173,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
173
173
|
return function () {
|
|
174
174
|
clearTimeout(timeout);
|
|
175
175
|
};
|
|
176
|
-
}, [
|
|
176
|
+
}, [mountOverlay, iframeSrc]);
|
|
177
177
|
React.useEffect(function () {
|
|
178
|
-
if (!
|
|
178
|
+
if (!mountOverlay) {
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
window.dispatchEvent(new CustomEvent("val-overlay-spa", {
|
|
@@ -184,9 +184,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
184
184
|
value: draftMode
|
|
185
185
|
}
|
|
186
186
|
}));
|
|
187
|
-
}, [
|
|
187
|
+
}, [mountOverlay, draftMode, spaReady]);
|
|
188
188
|
React.useEffect(function () {
|
|
189
|
-
if (!
|
|
189
|
+
if (!mountOverlay) {
|
|
190
190
|
SET_AUTO_TAG_JSX_ENABLED(false);
|
|
191
191
|
} else {
|
|
192
192
|
if (draftMode) {
|
|
@@ -219,9 +219,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
}, [
|
|
222
|
+
}, [mountOverlay, draftMode, props.disableRefresh]);
|
|
223
223
|
React.useEffect(function () {
|
|
224
|
-
if (!
|
|
224
|
+
if (!mountOverlay) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
var listener = function listener(event) {
|
|
@@ -233,7 +233,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
233
233
|
return function () {
|
|
234
234
|
window.removeEventListener("message", listener);
|
|
235
235
|
};
|
|
236
|
-
}, [
|
|
236
|
+
}, [mountOverlay]);
|
|
237
237
|
var _React$useState9 = React.useState(null),
|
|
238
238
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
239
239
|
dropZone = _React$useState10[0],
|
|
@@ -246,38 +246,64 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
246
246
|
setDropZone("val-menu-right-center");
|
|
247
247
|
}
|
|
248
248
|
}, []);
|
|
249
|
-
|
|
249
|
+
useConfigStorageSave(props.config);
|
|
250
|
+
var _React$useState11 = React.useState(false),
|
|
251
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
252
|
+
spaLoaded = _React$useState12[0],
|
|
253
|
+
setSpaLoaded = _React$useState12[1];
|
|
254
|
+
var commonStyles = React.useMemo(function () {
|
|
255
|
+
return {
|
|
256
|
+
"backdrop-blur": "backdrop-filter: blur(10px);",
|
|
257
|
+
"text-white": "color: white;",
|
|
258
|
+
"bg-black": "background: black;",
|
|
259
|
+
rounded: "border-radius: 0.25rem;",
|
|
260
|
+
fixed: "position: fixed;",
|
|
261
|
+
"bottom-4": "bottom: 1rem;",
|
|
262
|
+
"right-12": "right: 3rem;",
|
|
263
|
+
"right-16": "right: 4rem;",
|
|
264
|
+
"p-4": "padding: 1rem;",
|
|
265
|
+
"p-2": "padding: 0.5rem;",
|
|
266
|
+
"p-1": "padding: 0.25rem;",
|
|
267
|
+
flex: "display: flex;",
|
|
268
|
+
"items-center": "align-items: center;",
|
|
269
|
+
"justify-center": "justify-content: center;"
|
|
270
|
+
};
|
|
271
|
+
}, [valPrefixedClass]);
|
|
250
272
|
return /*#__PURE__*/jsxs(ValOverlayProvider, {
|
|
251
273
|
draftMode: draftMode,
|
|
252
274
|
store: valStore,
|
|
253
|
-
children: [props.children,
|
|
275
|
+
children: [props.children, dropZone !== null && !spaLoaded && mountOverlay && /*#__PURE__*/jsxs(React.Fragment, {
|
|
254
276
|
children: [/*#__PURE__*/jsx("style", {
|
|
255
|
-
children: "\n".concat(positionStyles, "\n.
|
|
277
|
+
children: "\n".concat(positionStyles, "\n").concat(prefixStyles(commonStyles), "\n.").concat(valPrefixedClass, "animate-spin {\n animation: ").concat(valPrefixedClass, "spin 2s linear infinite;\n}\n@keyframes ").concat(valPrefixedClass, "spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}")
|
|
256
278
|
}), /*#__PURE__*/jsx("div", {
|
|
257
|
-
className: getPositionClassName(dropZone)
|
|
279
|
+
className: "".concat(getPositionClassName(dropZone), " ").concat(cn(["p-4"])),
|
|
258
280
|
children: /*#__PURE__*/jsx("div", {
|
|
259
|
-
className: "flex justify-center items-center p-2 text-white bg-black rounded backdrop-blur",
|
|
281
|
+
className: "".concat(cn(["flex", "justify-center", "items-center", "p-2"]), " ") + "".concat(cn(["text-white", "bg-black", "rounded", "backdrop-blur"])),
|
|
260
282
|
children: /*#__PURE__*/jsx(Clock, {
|
|
261
|
-
className: "animate-spin",
|
|
283
|
+
className: "".concat(cn(["animate-spin"])),
|
|
262
284
|
size: 16
|
|
263
285
|
})
|
|
264
286
|
})
|
|
265
287
|
})]
|
|
266
|
-
}),
|
|
288
|
+
}), mountOverlay && /*#__PURE__*/jsxs(React.Fragment, {
|
|
267
289
|
children: [/*#__PURE__*/jsx(Script, {
|
|
268
290
|
type: "module",
|
|
269
291
|
src: "".concat(route, "/static").concat(VERSION ? "/".concat(VERSION) : "").concat(VAL_APP_PATH),
|
|
270
|
-
crossOrigin: "anonymous"
|
|
292
|
+
crossOrigin: "anonymous",
|
|
293
|
+
onLoad: function onLoad() {
|
|
294
|
+
setSpaLoaded(true);
|
|
295
|
+
}
|
|
271
296
|
}), /*#__PURE__*/jsx("div", {
|
|
272
297
|
id: VAL_OVERLAY_ID
|
|
273
298
|
})]
|
|
274
|
-
}),
|
|
299
|
+
}), mountOverlay && iframeSrc && /*#__PURE__*/jsx("iframe", {
|
|
300
|
+
loading: "eager",
|
|
275
301
|
style: {
|
|
276
|
-
top:
|
|
277
|
-
left:
|
|
302
|
+
top: 10,
|
|
303
|
+
left: 10,
|
|
278
304
|
position: "absolute",
|
|
279
|
-
width:
|
|
280
|
-
height:
|
|
305
|
+
width: 1000,
|
|
306
|
+
height: 1000
|
|
281
307
|
},
|
|
282
308
|
src: iframeSrc
|
|
283
309
|
}, iframeSrc)]
|
|
@@ -290,28 +316,38 @@ function useConsoleLogEnableVal(showOverlay) {
|
|
|
290
316
|
}
|
|
291
317
|
}, [showOverlay]);
|
|
292
318
|
}
|
|
293
|
-
var positionStyles =
|
|
319
|
+
var positionStyles = prefixStyles({
|
|
320
|
+
"left-0": "left: 0;",
|
|
321
|
+
"top-0": "top: 0;",
|
|
322
|
+
"left-1/2": "left: 50%;",
|
|
323
|
+
"top-1/2": "top: 50%;",
|
|
324
|
+
"-translate-y-1/2": "transform: translateY(-50%);",
|
|
325
|
+
"-translate-x-1/2": "transform: translateX(-50%);",
|
|
326
|
+
"right-0": "right: 0;",
|
|
327
|
+
"bottom-0": "bottom: 0;"
|
|
328
|
+
});
|
|
329
|
+
|
|
294
330
|
// This is a copy of the function from the ValMenu component.
|
|
295
331
|
function getPositionClassName(dropZone) {
|
|
296
|
-
var className = "fixed transform";
|
|
332
|
+
var className = cn(["fixed", "transform"]);
|
|
297
333
|
if (dropZone === "val-menu-left-top") {
|
|
298
|
-
className += " left-0 top-0";
|
|
334
|
+
className += " ".concat(cn(["left-0", "top-0"]));
|
|
299
335
|
} else if (dropZone === "val-menu-left-center") {
|
|
300
|
-
className += " left-0 top-1/2 -translate-y-1/2";
|
|
336
|
+
className += " ".concat(cn(["left-0", "top-1/2", "-translate-y-1/2"]));
|
|
301
337
|
} else if (dropZone === "val-menu-left-bottom") {
|
|
302
|
-
className += " left-0 bottom-0";
|
|
338
|
+
className += " ".concat(cn(["left-0", "bottom-0"]));
|
|
303
339
|
} else if (dropZone === "val-menu-center-top") {
|
|
304
|
-
className += " left-1/2 -translate-x-1/2 top-0";
|
|
340
|
+
className += " ".concat(cn(["left-1/2", "-translate-x-1/2", "top-0"]));
|
|
305
341
|
} else if (dropZone === "val-menu-center-bottom") {
|
|
306
|
-
className += " left-1/2 -translate-x-1/2 bottom-0";
|
|
342
|
+
className += " ".concat(cn(["left-1/2", "-translate-x-1/2", "bottom-0"]));
|
|
307
343
|
} else if (dropZone === "val-menu-right-top") {
|
|
308
|
-
className += " right-0 top-0";
|
|
344
|
+
className += " ".concat(cn(["right-0", "top-0"]));
|
|
309
345
|
} else if (dropZone === "val-menu-right-center") {
|
|
310
|
-
className += " right-0 top-1/2 -translate-y-1/2";
|
|
346
|
+
className += " ".concat(cn(["right-0", "top-1/2", "-translate-y-1/2"]));
|
|
311
347
|
} else if (dropZone === "val-menu-right-bottom") {
|
|
312
|
-
className += " right-0 bottom-0";
|
|
348
|
+
className += " ".concat(cn(["right-0", "bottom-0"]));
|
|
313
349
|
} else {
|
|
314
|
-
className += " right-0 bottom-0";
|
|
350
|
+
className += " ".concat(cn(["right-0", "bottom-0"]));
|
|
315
351
|
}
|
|
316
352
|
return className;
|
|
317
353
|
}
|
|
@@ -13,7 +13,7 @@ var React = require('react');
|
|
|
13
13
|
var ValOverlayContext = require('./ValOverlayContext-942f1294.cjs.prod.js');
|
|
14
14
|
var stega = require('@valbuild/react/stega');
|
|
15
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
|
-
var
|
|
16
|
+
var cssUtils = require('./cssUtils-d97a757c.cjs.prod.js');
|
|
17
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
18
18
|
require('./unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
19
19
|
|
|
@@ -37,8 +37,8 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
37
37
|
}, []);
|
|
38
38
|
var _React$useState = React__default["default"].useState(),
|
|
39
39
|
_React$useState2 = slicedToArray._slicedToArray(_React$useState, 2),
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
mountOverlay = _React$useState2[0],
|
|
41
|
+
setMountOverlay = _React$useState2[1];
|
|
42
42
|
var _React$useState3 = React__default["default"].useState(null),
|
|
43
43
|
_React$useState4 = slicedToArray._slicedToArray(_React$useState3, 2),
|
|
44
44
|
draftMode = _React$useState4[0],
|
|
@@ -46,7 +46,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
46
46
|
var _React$useState5 = React__default["default"].useState(false),
|
|
47
47
|
_React$useState6 = slicedToArray._slicedToArray(_React$useState5, 2),
|
|
48
48
|
spaReady = _React$useState6[0],
|
|
49
|
-
setSpaReady = _React$useState6[1];
|
|
49
|
+
setSpaReady = _React$useState6[1]; // TODO: consider removing spaReady - it is not used? If we remove, clean up the custom events that send the message too...
|
|
50
50
|
var router = navigation.useRouter();
|
|
51
51
|
var _React$useTransition = React__default["default"].useTransition(),
|
|
52
52
|
_React$useTransition2 = slicedToArray._slicedToArray(_React$useTransition, 2),
|
|
@@ -56,20 +56,20 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
56
56
|
_React$useState8 = slicedToArray._slicedToArray(_React$useState7, 2),
|
|
57
57
|
iframeSrc = _React$useState8[0],
|
|
58
58
|
setIframeSrc = _React$useState8[1];
|
|
59
|
-
useConsoleLogEnableVal(
|
|
59
|
+
useConsoleLogEnableVal(mountOverlay);
|
|
60
60
|
React__default["default"].useEffect(function () {
|
|
61
61
|
if (location.search === "?message_onready=true") {
|
|
62
62
|
console.warn("Val is verifying draft mode...");
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (isValStudioPath(location.pathname)) {
|
|
66
|
-
|
|
66
|
+
setMountOverlay(false);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
setMountOverlay(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
|
|
70
70
|
}, []);
|
|
71
71
|
React__default["default"].useEffect(function () {
|
|
72
|
-
if (!
|
|
72
|
+
if (!mountOverlay) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
var interval = setInterval(function () {
|
|
@@ -85,9 +85,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
85
85
|
return function () {
|
|
86
86
|
clearInterval(interval);
|
|
87
87
|
};
|
|
88
|
-
}, [
|
|
88
|
+
}, [mountOverlay, props.disableRefresh]);
|
|
89
89
|
React__default["default"].useEffect(function () {
|
|
90
|
-
if (!
|
|
90
|
+
if (!mountOverlay) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
if (draftMode === null) {
|
|
@@ -128,14 +128,14 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
128
128
|
return function () {
|
|
129
129
|
window.removeEventListener("val-overlay-provider", valProviderOverlayListener);
|
|
130
130
|
};
|
|
131
|
-
}, [
|
|
131
|
+
}, [mountOverlay, draftMode]);
|
|
132
132
|
var pollDraftStatIdRef = React__default["default"].useRef(0);
|
|
133
133
|
React__default["default"].useEffect(function () {
|
|
134
|
-
//
|
|
134
|
+
// continuous polling to check for updates:
|
|
135
135
|
|
|
136
136
|
var timeout;
|
|
137
137
|
function pollCurrentDraftMode() {
|
|
138
|
-
if (!
|
|
138
|
+
if (!mountOverlay) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
window.dispatchEvent(new CustomEvent("val-overlay-spa", {
|
|
@@ -182,9 +182,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
182
182
|
return function () {
|
|
183
183
|
clearTimeout(timeout);
|
|
184
184
|
};
|
|
185
|
-
}, [
|
|
185
|
+
}, [mountOverlay, iframeSrc]);
|
|
186
186
|
React__default["default"].useEffect(function () {
|
|
187
|
-
if (!
|
|
187
|
+
if (!mountOverlay) {
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
window.dispatchEvent(new CustomEvent("val-overlay-spa", {
|
|
@@ -193,9 +193,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
193
193
|
value: draftMode
|
|
194
194
|
}
|
|
195
195
|
}));
|
|
196
|
-
}, [
|
|
196
|
+
}, [mountOverlay, draftMode, spaReady]);
|
|
197
197
|
React__default["default"].useEffect(function () {
|
|
198
|
-
if (!
|
|
198
|
+
if (!mountOverlay) {
|
|
199
199
|
stega.SET_AUTO_TAG_JSX_ENABLED(false);
|
|
200
200
|
} else {
|
|
201
201
|
if (draftMode) {
|
|
@@ -228,9 +228,9 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
}, [
|
|
231
|
+
}, [mountOverlay, draftMode, props.disableRefresh]);
|
|
232
232
|
React__default["default"].useEffect(function () {
|
|
233
|
-
if (!
|
|
233
|
+
if (!mountOverlay) {
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
var listener = function listener(event) {
|
|
@@ -242,7 +242,7 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
242
242
|
return function () {
|
|
243
243
|
window.removeEventListener("message", listener);
|
|
244
244
|
};
|
|
245
|
-
}, [
|
|
245
|
+
}, [mountOverlay]);
|
|
246
246
|
var _React$useState9 = React__default["default"].useState(null),
|
|
247
247
|
_React$useState10 = slicedToArray._slicedToArray(_React$useState9, 2),
|
|
248
248
|
dropZone = _React$useState10[0],
|
|
@@ -255,38 +255,64 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
255
255
|
setDropZone("val-menu-right-center");
|
|
256
256
|
}
|
|
257
257
|
}, []);
|
|
258
|
-
|
|
258
|
+
cssUtils.useConfigStorageSave(props.config);
|
|
259
|
+
var _React$useState11 = React__default["default"].useState(false),
|
|
260
|
+
_React$useState12 = slicedToArray._slicedToArray(_React$useState11, 2),
|
|
261
|
+
spaLoaded = _React$useState12[0],
|
|
262
|
+
setSpaLoaded = _React$useState12[1];
|
|
263
|
+
var commonStyles = React__default["default"].useMemo(function () {
|
|
264
|
+
return {
|
|
265
|
+
"backdrop-blur": "backdrop-filter: blur(10px);",
|
|
266
|
+
"text-white": "color: white;",
|
|
267
|
+
"bg-black": "background: black;",
|
|
268
|
+
rounded: "border-radius: 0.25rem;",
|
|
269
|
+
fixed: "position: fixed;",
|
|
270
|
+
"bottom-4": "bottom: 1rem;",
|
|
271
|
+
"right-12": "right: 3rem;",
|
|
272
|
+
"right-16": "right: 4rem;",
|
|
273
|
+
"p-4": "padding: 1rem;",
|
|
274
|
+
"p-2": "padding: 0.5rem;",
|
|
275
|
+
"p-1": "padding: 0.25rem;",
|
|
276
|
+
flex: "display: flex;",
|
|
277
|
+
"items-center": "align-items: center;",
|
|
278
|
+
"justify-center": "justify-content: center;"
|
|
279
|
+
};
|
|
280
|
+
}, [cssUtils.valPrefixedClass]);
|
|
259
281
|
return /*#__PURE__*/jsxRuntime.jsxs(ValOverlayContext.ValOverlayProvider, {
|
|
260
282
|
draftMode: draftMode,
|
|
261
283
|
store: valStore,
|
|
262
|
-
children: [props.children,
|
|
284
|
+
children: [props.children, dropZone !== null && !spaLoaded && mountOverlay && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
263
285
|
children: [/*#__PURE__*/jsxRuntime.jsx("style", {
|
|
264
|
-
children: "\n".concat(positionStyles, "\n.
|
|
286
|
+
children: "\n".concat(positionStyles, "\n").concat(cssUtils.prefixStyles(commonStyles), "\n.").concat(cssUtils.valPrefixedClass, "animate-spin {\n animation: ").concat(cssUtils.valPrefixedClass, "spin 2s linear infinite;\n}\n@keyframes ").concat(cssUtils.valPrefixedClass, "spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}")
|
|
265
287
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
266
|
-
className: getPositionClassName(dropZone)
|
|
288
|
+
className: "".concat(getPositionClassName(dropZone), " ").concat(cssUtils.cn(["p-4"])),
|
|
267
289
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
268
|
-
className: "flex justify-center items-center p-2 text-white bg-black rounded backdrop-blur",
|
|
290
|
+
className: "".concat(cssUtils.cn(["flex", "justify-center", "items-center", "p-2"]), " ") + "".concat(cssUtils.cn(["text-white", "bg-black", "rounded", "backdrop-blur"])),
|
|
269
291
|
children: /*#__PURE__*/jsxRuntime.jsx(Clock, {
|
|
270
|
-
className: "animate-spin",
|
|
292
|
+
className: "".concat(cssUtils.cn(["animate-spin"])),
|
|
271
293
|
size: 16
|
|
272
294
|
})
|
|
273
295
|
})
|
|
274
296
|
})]
|
|
275
|
-
}),
|
|
297
|
+
}), mountOverlay && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
276
298
|
children: [/*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
|
|
277
299
|
type: "module",
|
|
278
300
|
src: "".concat(route, "/static").concat(ui.VERSION ? "/".concat(ui.VERSION) : "").concat(ui.VAL_APP_PATH),
|
|
279
|
-
crossOrigin: "anonymous"
|
|
301
|
+
crossOrigin: "anonymous",
|
|
302
|
+
onLoad: function onLoad() {
|
|
303
|
+
setSpaLoaded(true);
|
|
304
|
+
}
|
|
280
305
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
281
306
|
id: ui.VAL_OVERLAY_ID
|
|
282
307
|
})]
|
|
283
|
-
}),
|
|
308
|
+
}), mountOverlay && iframeSrc && /*#__PURE__*/jsxRuntime.jsx("iframe", {
|
|
309
|
+
loading: "eager",
|
|
284
310
|
style: {
|
|
285
|
-
top:
|
|
286
|
-
left:
|
|
311
|
+
top: 10,
|
|
312
|
+
left: 10,
|
|
287
313
|
position: "absolute",
|
|
288
|
-
width:
|
|
289
|
-
height:
|
|
314
|
+
width: 1000,
|
|
315
|
+
height: 1000
|
|
290
316
|
},
|
|
291
317
|
src: iframeSrc
|
|
292
318
|
}, iframeSrc)]
|
|
@@ -299,28 +325,38 @@ function useConsoleLogEnableVal(showOverlay) {
|
|
|
299
325
|
}
|
|
300
326
|
}, [showOverlay]);
|
|
301
327
|
}
|
|
302
|
-
var positionStyles =
|
|
328
|
+
var positionStyles = cssUtils.prefixStyles({
|
|
329
|
+
"left-0": "left: 0;",
|
|
330
|
+
"top-0": "top: 0;",
|
|
331
|
+
"left-1/2": "left: 50%;",
|
|
332
|
+
"top-1/2": "top: 50%;",
|
|
333
|
+
"-translate-y-1/2": "transform: translateY(-50%);",
|
|
334
|
+
"-translate-x-1/2": "transform: translateX(-50%);",
|
|
335
|
+
"right-0": "right: 0;",
|
|
336
|
+
"bottom-0": "bottom: 0;"
|
|
337
|
+
});
|
|
338
|
+
|
|
303
339
|
// This is a copy of the function from the ValMenu component.
|
|
304
340
|
function getPositionClassName(dropZone) {
|
|
305
|
-
var className = "fixed transform";
|
|
341
|
+
var className = cssUtils.cn(["fixed", "transform"]);
|
|
306
342
|
if (dropZone === "val-menu-left-top") {
|
|
307
|
-
className += " left-0 top-0";
|
|
343
|
+
className += " ".concat(cssUtils.cn(["left-0", "top-0"]));
|
|
308
344
|
} else if (dropZone === "val-menu-left-center") {
|
|
309
|
-
className += " left-0 top-1/2 -translate-y-1/2";
|
|
345
|
+
className += " ".concat(cssUtils.cn(["left-0", "top-1/2", "-translate-y-1/2"]));
|
|
310
346
|
} else if (dropZone === "val-menu-left-bottom") {
|
|
311
|
-
className += " left-0 bottom-0";
|
|
347
|
+
className += " ".concat(cssUtils.cn(["left-0", "bottom-0"]));
|
|
312
348
|
} else if (dropZone === "val-menu-center-top") {
|
|
313
|
-
className += " left-1/2 -translate-x-1/2 top-0";
|
|
349
|
+
className += " ".concat(cssUtils.cn(["left-1/2", "-translate-x-1/2", "top-0"]));
|
|
314
350
|
} else if (dropZone === "val-menu-center-bottom") {
|
|
315
|
-
className += " left-1/2 -translate-x-1/2 bottom-0";
|
|
351
|
+
className += " ".concat(cssUtils.cn(["left-1/2", "-translate-x-1/2", "bottom-0"]));
|
|
316
352
|
} else if (dropZone === "val-menu-right-top") {
|
|
317
|
-
className += " right-0 top-0";
|
|
353
|
+
className += " ".concat(cssUtils.cn(["right-0", "top-0"]));
|
|
318
354
|
} else if (dropZone === "val-menu-right-center") {
|
|
319
|
-
className += " right-0 top-1/2 -translate-y-1/2";
|
|
355
|
+
className += " ".concat(cssUtils.cn(["right-0", "top-1/2", "-translate-y-1/2"]));
|
|
320
356
|
} else if (dropZone === "val-menu-right-bottom") {
|
|
321
|
-
className += " right-0 bottom-0";
|
|
357
|
+
className += " ".concat(cssUtils.cn(["right-0", "bottom-0"]));
|
|
322
358
|
} else {
|
|
323
|
-
className += " right-0 bottom-0";
|
|
359
|
+
className += " ".concat(cssUtils.cn(["right-0", "bottom-0"]));
|
|
324
360
|
}
|
|
325
361
|
return className;
|
|
326
362
|
}
|