@valbuild/next 0.84.3 → 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.
Files changed (35) hide show
  1. package/client/dist/valbuild-next-client.cjs.dev.js +28 -6
  2. package/client/dist/valbuild-next-client.cjs.prod.js +28 -6
  3. package/client/dist/valbuild-next-client.esm.js +27 -5
  4. package/dist/ValApp-0ded607c.cjs.dev.js +133 -0
  5. package/dist/ValApp-489d97dc.esm.js +125 -0
  6. package/dist/ValApp-b10c2084.cjs.js +7 -0
  7. package/dist/ValApp-b10c2084.cjs.prod.js +133 -0
  8. package/dist/{ValNextProvider-25f1f5c9.esm.js → ValNextProvider-10c232b6.esm.js} +80 -44
  9. package/dist/ValNextProvider-7042b86d.cjs.js +7 -0
  10. package/dist/{ValNextProvider-a618d775.cjs.prod.js → ValNextProvider-7042b86d.cjs.prod.js} +80 -44
  11. package/dist/{ValNextProvider-c7952bdc.cjs.dev.js → ValNextProvider-726026f9.cjs.dev.js} +80 -44
  12. package/dist/cssUtils-9c11102f.cjs.dev.js +41 -0
  13. package/dist/cssUtils-b5651c03.esm.js +32 -0
  14. package/dist/cssUtils-d97a757c.cjs.prod.js +41 -0
  15. package/dist/declarations/src/ValApp.d.ts +1 -1
  16. package/dist/declarations/src/client/initValClient.d.ts +2 -0
  17. package/dist/declarations/src/rsc/initValRsc.d.ts +9 -0
  18. package/dist/{initValRouteFromVal-4e6253bf.esm.js → routeFromVal-248c62f1.esm.js} +17 -4
  19. package/dist/{initValRouteFromVal-0f4f2d39.cjs.prod.js → routeFromVal-a317debc.cjs.prod.js} +17 -3
  20. package/dist/{initValRouteFromVal-65dd1262.cjs.dev.js → routeFromVal-a3987ae3.cjs.dev.js} +17 -3
  21. package/dist/valbuild-next.cjs.dev.js +2 -2
  22. package/dist/valbuild-next.cjs.prod.js +2 -2
  23. package/dist/valbuild-next.esm.js +2 -2
  24. package/package.json +6 -6
  25. package/rsc/dist/valbuild-next-rsc.cjs.dev.js +134 -46
  26. package/rsc/dist/valbuild-next-rsc.cjs.prod.js +134 -46
  27. package/rsc/dist/valbuild-next-rsc.esm.js +133 -45
  28. package/dist/ValApp-0efa0e5d.cjs.dev.js +0 -63
  29. package/dist/ValApp-3ab62a2b.esm.js +0 -55
  30. package/dist/ValApp-a808cf89.cjs.js +0 -7
  31. package/dist/ValApp-a808cf89.cjs.prod.js +0 -63
  32. package/dist/ValNextProvider-a618d775.cjs.js +0 -7
  33. package/dist/useRemoteConfigSender-02451801.esm.js +0 -70
  34. package/dist/useRemoteConfigSender-3ea2fe91.cjs.prod.js +0 -76
  35. package/dist/useRemoteConfigSender-c78b81c5.cjs.dev.js +0 -76
@@ -13,7 +13,7 @@ var React = require('react');
13
13
  var ValOverlayContext = require('./ValOverlayContext-c82a4507.cjs.dev.js');
14
14
  var stega = require('@valbuild/react/stega');
15
15
  var internal = require('@valbuild/shared/internal');
16
- var useRemoteConfigSender = require('./useRemoteConfigSender-c78b81c5.cjs.dev.js');
16
+ var cssUtils = require('./cssUtils-9c11102f.cjs.dev.js');
17
17
  var jsxRuntime = require('react/jsx-runtime');
18
18
  require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.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
- showOverlay = _React$useState2[0],
41
- setShowOverlay = _React$useState2[1];
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(showOverlay);
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
- setShowOverlay(false);
66
+ setMountOverlay(false);
67
67
  return;
68
68
  }
69
- setShowOverlay(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
69
+ setMountOverlay(document.cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true")));
70
70
  }, []);
71
71
  React__default["default"].useEffect(function () {
72
- if (!showOverlay) {
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
- }, [showOverlay, props.disableRefresh]);
88
+ }, [mountOverlay, props.disableRefresh]);
89
89
  React__default["default"].useEffect(function () {
90
- if (!showOverlay) {
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
- }, [showOverlay, draftMode]);
131
+ }, [mountOverlay, draftMode]);
132
132
  var pollDraftStatIdRef = React__default["default"].useRef(0);
133
133
  React__default["default"].useEffect(function () {
134
- // continous polling to check for updates:
134
+ // continuous polling to check for updates:
135
135
 
136
136
  var timeout;
137
137
  function pollCurrentDraftMode() {
138
- if (!showOverlay) {
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
- }, [showOverlay, iframeSrc]);
185
+ }, [mountOverlay, iframeSrc]);
186
186
  React__default["default"].useEffect(function () {
187
- if (!showOverlay) {
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
- }, [showOverlay, draftMode, spaReady]);
196
+ }, [mountOverlay, draftMode, spaReady]);
197
197
  React__default["default"].useEffect(function () {
198
- if (!showOverlay) {
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
- }, [showOverlay, draftMode, props.disableRefresh]);
231
+ }, [mountOverlay, draftMode, props.disableRefresh]);
232
232
  React__default["default"].useEffect(function () {
233
- if (!showOverlay) {
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
- }, [showOverlay]);
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
- useRemoteConfigSender.useRemoteConfigSender(props.config);
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, !spaReady && showOverlay && dropZone && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
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.backdrop-blur {\n backdrop-filter: blur(10px);\n}\n.text-white {\n color: white;\n}\n.bg-black {\n background: black;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.fixed {\n position: fixed;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.right-12 {\n right: 3rem;\n}\n.right-16 {\n right: 4rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.flex {\n display: flex;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.animate-spin {\n animation: spin 2s linear infinite;\n}\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\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) + " p-4",
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
- }), showOverlay && draftMode !== undefined && /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
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
- }), iframeSrc && draftMode !== null && showOverlay && /*#__PURE__*/jsxRuntime.jsx("iframe", {
308
+ }), mountOverlay && iframeSrc && /*#__PURE__*/jsxRuntime.jsx("iframe", {
309
+ loading: "eager",
284
310
  style: {
285
- top: 0,
286
- left: 0,
311
+ top: 10,
312
+ left: 10,
287
313
  position: "absolute",
288
- width: 0,
289
- height: 0
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 = "\n.left-0 {\n left: 0;\n}\n.top-0 {\n top: 0;\n}\n.left-1\\/2 {\n left: 50%;\n}\n.top-1\\/2 {\n top: 50%;\n}\n.-translate-y-1\\/2 {\n transform: translateY(-50%);\n}\n.-translate-x-1\\/2 {\n transform: translateX(-50%);\n}\n.right-0 {\n right: 0;\n}\n.bottom-0 {\n bottom: 0;\n}";
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
  }
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var internal = require('@valbuild/shared/internal');
4
+ var React = require('react');
5
+ var slicedToArray = require('./slicedToArray-44036a76.cjs.dev.js');
6
+ var core = require('@valbuild/core');
7
+ var ui = require('@valbuild/ui');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefault(React);
12
+
13
+ /*
14
+ * See the useConfig.tsx where the config is loaded from session storage
15
+ */
16
+ function useConfigStorageSave(config) {
17
+ React__default["default"].useEffect(function () {
18
+ sessionStorage.setItem(internal.VAL_CONFIG_SESSION_STORAGE_KEY, JSON.stringify(config));
19
+ }, [config]);
20
+ }
21
+
22
+ // All DOM element that are outside the Shadow DOM should use this class name prefix
23
+ var valPrefixedClass = "val-prefix-" + core.Internal.getSHA256Hash(new TextEncoder().encode(ui.VERSION || "")).slice(0, 8) + "-";
24
+ var prefixStyles = function prefixStyles(styles) {
25
+ return Object.entries(styles).map(function (_ref) {
26
+ var _ref2 = slicedToArray._slicedToArray(_ref, 2),
27
+ key = _ref2[0],
28
+ value = _ref2[1];
29
+ return ".".concat(valPrefixedClass).concat(key.replace(/\//g, "\\/"), " { ").concat(value, " }");
30
+ }).join("\n");
31
+ };
32
+ var cn = function cn(className) {
33
+ return className.map(function (c) {
34
+ return "".concat(valPrefixedClass).concat(c);
35
+ }).join(" ");
36
+ };
37
+
38
+ exports.cn = cn;
39
+ exports.prefixStyles = prefixStyles;
40
+ exports.useConfigStorageSave = useConfigStorageSave;
41
+ exports.valPrefixedClass = valPrefixedClass;
@@ -0,0 +1,32 @@
1
+ import { VAL_CONFIG_SESSION_STORAGE_KEY } from '@valbuild/shared/internal';
2
+ import React from 'react';
3
+ import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
4
+ import { Internal } from '@valbuild/core';
5
+ import { VERSION } from '@valbuild/ui';
6
+
7
+ /*
8
+ * See the useConfig.tsx where the config is loaded from session storage
9
+ */
10
+ function useConfigStorageSave(config) {
11
+ React.useEffect(function () {
12
+ sessionStorage.setItem(VAL_CONFIG_SESSION_STORAGE_KEY, JSON.stringify(config));
13
+ }, [config]);
14
+ }
15
+
16
+ // All DOM element that are outside the Shadow DOM should use this class name prefix
17
+ var valPrefixedClass = "val-prefix-" + Internal.getSHA256Hash(new TextEncoder().encode(VERSION || "")).slice(0, 8) + "-";
18
+ var prefixStyles = function prefixStyles(styles) {
19
+ return Object.entries(styles).map(function (_ref) {
20
+ var _ref2 = _slicedToArray(_ref, 2),
21
+ key = _ref2[0],
22
+ value = _ref2[1];
23
+ return ".".concat(valPrefixedClass).concat(key.replace(/\//g, "\\/"), " { ").concat(value, " }");
24
+ }).join("\n");
25
+ };
26
+ var cn = function cn(className) {
27
+ return className.map(function (c) {
28
+ return "".concat(valPrefixedClass).concat(c);
29
+ }).join(" ");
30
+ };
31
+
32
+ export { cn as c, prefixStyles as p, useConfigStorageSave as u, valPrefixedClass as v };
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var internal = require('@valbuild/shared/internal');
4
+ var React = require('react');
5
+ var slicedToArray = require('./slicedToArray-ce613de6.cjs.prod.js');
6
+ var core = require('@valbuild/core');
7
+ var ui = require('@valbuild/ui');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefault(React);
12
+
13
+ /*
14
+ * See the useConfig.tsx where the config is loaded from session storage
15
+ */
16
+ function useConfigStorageSave(config) {
17
+ React__default["default"].useEffect(function () {
18
+ sessionStorage.setItem(internal.VAL_CONFIG_SESSION_STORAGE_KEY, JSON.stringify(config));
19
+ }, [config]);
20
+ }
21
+
22
+ // All DOM element that are outside the Shadow DOM should use this class name prefix
23
+ var valPrefixedClass = "val-prefix-" + core.Internal.getSHA256Hash(new TextEncoder().encode(ui.VERSION || "")).slice(0, 8) + "-";
24
+ var prefixStyles = function prefixStyles(styles) {
25
+ return Object.entries(styles).map(function (_ref) {
26
+ var _ref2 = slicedToArray._slicedToArray(_ref, 2),
27
+ key = _ref2[0],
28
+ value = _ref2[1];
29
+ return ".".concat(valPrefixedClass).concat(key.replace(/\//g, "\\/"), " { ").concat(value, " }");
30
+ }).join("\n");
31
+ };
32
+ var cn = function cn(className) {
33
+ return className.map(function (c) {
34
+ return "".concat(valPrefixedClass).concat(c);
35
+ }).join(" ");
36
+ };
37
+
38
+ exports.cn = cn;
39
+ exports.prefixStyles = prefixStyles;
40
+ exports.useConfigStorageSave = useConfigStorageSave;
41
+ exports.valPrefixedClass = valPrefixedClass;
@@ -1,4 +1,4 @@
1
1
  import { ValConfig } from "@valbuild/core";
2
2
  export declare const ValApp: ({ config }: {
3
3
  config: ValConfig;
4
- }) => import("react/jsx-runtime").JSX.Element | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -5,8 +5,10 @@ export type UseValType<T extends SelectorSource> = SelectorOf<T> extends Generic
5
5
  declare function useValStega<T extends SelectorSource>(selector: T): UseValType<T>;
6
6
  type UseValRouteReturnType<T extends ValModule<GenericSelector<SourceObject>>> = T extends ValModule<infer S> ? S extends SourceObject ? StegaOfSource<NonNullable<S>[string]> | null : never : never;
7
7
  declare function useValRouteStega<T extends ValModule<GenericSelector<SourceObject>>>(selector: T, params: Record<string, string | string[]> | Promise<Record<string, string | string[]>>): UseValRouteReturnType<T>;
8
+ declare function useValRouteUrl<T extends ValModule<GenericSelector<SourceObject>>>(selector: T, params?: Record<string, string | string[]> | Promise<Record<string, string | string[]>>): string | null;
8
9
  export declare function initValClient(config: ValConfig): {
9
10
  useValStega: typeof useValStega;
10
11
  useValRouteStega: typeof useValRouteStega;
12
+ useValRouteUrl: typeof useValRouteUrl;
11
13
  };
12
14
  export {};
@@ -19,6 +19,14 @@ declare const initFetchValRouteStega: (config: ValConfig, valApiEndpoints: strin
19
19
  value: string;
20
20
  } | undefined;
21
21
  }>) => <T extends ValModule<GenericSelector<SourceObject, undefined>>>(selector: T, params: Promise<Record<string, string | string[]>> | Record<string, string | string[]> | unknown) => Promise<FetchValRouteReturnType<T>>;
22
+ declare const initFetchValRouteUrl: (config: ValConfig, valApiEndpoints: string, valServerPromise: Promise<ValServer>, isEnabled: () => Promise<boolean>, getHeaders: () => Promise<{
23
+ get(name: string): string | null;
24
+ }>, getCookies: () => Promise<{
25
+ get(name: string): {
26
+ name: string;
27
+ value: string;
28
+ } | undefined;
29
+ }>) => <T extends ValModule<GenericSelector<SourceObject, undefined>>>(selector: T, params?: Promise<Record<string, string | string[]>> | Record<string, string | string[]> | unknown) => Promise<string | null>;
22
30
  type ValNextRscConfig = {
23
31
  draftMode: typeof draftMode;
24
32
  headers: typeof headers;
@@ -27,5 +35,6 @@ type ValNextRscConfig = {
27
35
  export declare function initValRsc(config: ValConfig, valModules: ValModules, rscNextConfig: ValNextRscConfig): {
28
36
  fetchValStega: ReturnType<typeof initFetchValStega>;
29
37
  fetchValRouteStega: ReturnType<typeof initFetchValRouteStega>;
38
+ fetchValRouteUrl: ReturnType<typeof initFetchValRouteUrl>;
30
39
  };
31
40
  export {};
@@ -5,7 +5,7 @@ import { _ as _typeof } from './typeof-a1531d8f.esm.js';
5
5
  import { RecordSchema, Internal } from '@valbuild/core';
6
6
  import { getNextAppRouterSourceFolder, getPatternFromModuleFilePath, parseRoutePattern } from '@valbuild/shared/internal';
7
7
 
8
- function initValRouteFromVal(resolvedParams, methodName,
8
+ function getValRouteUrlFromVal(resolvedParams, methodName,
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  path,
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -59,7 +59,7 @@ val) {
59
59
  var parsedPattern = parseRoutePattern(pattern);
60
60
  var missingPatterns = [];
61
61
  var fullPathParts = [];
62
- var missingParamKeys = _objectSpread2({}, resolvedParams);
62
+ var missingParamKeys = _typeof(resolvedParams) === "object" && resolvedParams !== null && !Array.isArray(resolvedParams) ? _objectSpread2({}, resolvedParams) : {};
63
63
  var _iterator = _createForOfIteratorHelper(parsedPattern !== null && parsedPattern !== void 0 ? parsedPattern : []),
64
64
  _step;
65
65
  try {
@@ -124,11 +124,24 @@ val) {
124
124
  // though chances are that there's something wrong in the way ${methodName} is used
125
125
  }
126
126
  var fullPath = fullPathParts.join("/");
127
- var actualRoute = val["/".concat(fullPath)];
127
+ return "/".concat(fullPath);
128
+ }
129
+ function initValRouteFromVal(resolvedParams, methodName,
130
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
+ path,
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
+ schema,
134
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
+ val) {
136
+ var url = getValRouteUrlFromVal(resolvedParams, methodName, path, schema, val);
137
+ if (!url) {
138
+ return null;
139
+ }
140
+ var actualRoute = val[url];
128
141
  if (!actualRoute) {
129
142
  return null;
130
143
  }
131
144
  return actualRoute;
132
145
  }
133
146
 
134
- export { initValRouteFromVal as i };
147
+ export { getValRouteUrlFromVal as g, initValRouteFromVal as i };
@@ -7,7 +7,7 @@ var _typeof = require('./typeof-16428c61.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var internal = require('@valbuild/shared/internal');
9
9
 
10
- function initValRouteFromVal(resolvedParams, methodName,
10
+ function getValRouteUrlFromVal(resolvedParams, methodName,
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  path,
13
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -61,7 +61,7 @@ val) {
61
61
  var parsedPattern = internal.parseRoutePattern(pattern);
62
62
  var missingPatterns = [];
63
63
  var fullPathParts = [];
64
- var missingParamKeys = objectSpread2._objectSpread2({}, resolvedParams);
64
+ var missingParamKeys = _typeof._typeof(resolvedParams) === "object" && resolvedParams !== null && !Array.isArray(resolvedParams) ? objectSpread2._objectSpread2({}, resolvedParams) : {};
65
65
  var _iterator = createForOfIteratorHelper._createForOfIteratorHelper(parsedPattern !== null && parsedPattern !== void 0 ? parsedPattern : []),
66
66
  _step;
67
67
  try {
@@ -126,11 +126,25 @@ val) {
126
126
  // though chances are that there's something wrong in the way ${methodName} is used
127
127
  }
128
128
  var fullPath = fullPathParts.join("/");
129
- var actualRoute = val["/".concat(fullPath)];
129
+ return "/".concat(fullPath);
130
+ }
131
+ function initValRouteFromVal(resolvedParams, methodName,
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
+ path,
134
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
+ schema,
136
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
137
+ val) {
138
+ var url = getValRouteUrlFromVal(resolvedParams, methodName, path, schema, val);
139
+ if (!url) {
140
+ return null;
141
+ }
142
+ var actualRoute = val[url];
130
143
  if (!actualRoute) {
131
144
  return null;
132
145
  }
133
146
  return actualRoute;
134
147
  }
135
148
 
149
+ exports.getValRouteUrlFromVal = getValRouteUrlFromVal;
136
150
  exports.initValRouteFromVal = initValRouteFromVal;
@@ -7,7 +7,7 @@ var _typeof = require('./typeof-b568f48f.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var internal = require('@valbuild/shared/internal');
9
9
 
10
- function initValRouteFromVal(resolvedParams, methodName,
10
+ function getValRouteUrlFromVal(resolvedParams, methodName,
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  path,
13
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -61,7 +61,7 @@ val) {
61
61
  var parsedPattern = internal.parseRoutePattern(pattern);
62
62
  var missingPatterns = [];
63
63
  var fullPathParts = [];
64
- var missingParamKeys = objectSpread2._objectSpread2({}, resolvedParams);
64
+ var missingParamKeys = _typeof._typeof(resolvedParams) === "object" && resolvedParams !== null && !Array.isArray(resolvedParams) ? objectSpread2._objectSpread2({}, resolvedParams) : {};
65
65
  var _iterator = createForOfIteratorHelper._createForOfIteratorHelper(parsedPattern !== null && parsedPattern !== void 0 ? parsedPattern : []),
66
66
  _step;
67
67
  try {
@@ -126,11 +126,25 @@ val) {
126
126
  // though chances are that there's something wrong in the way ${methodName} is used
127
127
  }
128
128
  var fullPath = fullPathParts.join("/");
129
- var actualRoute = val["/".concat(fullPath)];
129
+ return "/".concat(fullPath);
130
+ }
131
+ function initValRouteFromVal(resolvedParams, methodName,
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
+ path,
134
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
+ schema,
136
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
137
+ val) {
138
+ var url = getValRouteUrlFromVal(resolvedParams, methodName, path, schema, val);
139
+ if (!url) {
140
+ return null;
141
+ }
142
+ var actualRoute = val[url];
130
143
  if (!actualRoute) {
131
144
  return null;
132
145
  }
133
146
  return actualRoute;
134
147
  }
135
148
 
149
+ exports.getValRouteUrlFromVal = getValRouteUrlFromVal;
136
150
  exports.initValRouteFromVal = initValRouteFromVal;
@@ -7,10 +7,10 @@ var objectSpread2 = require('./objectSpread2-792eb2c2.cjs.dev.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var internal = require('@valbuild/react/internal');
10
- var ValNextProvider = require('./ValNextProvider-c7952bdc.cjs.dev.js');
10
+ var ValNextProvider = require('./ValNextProvider-726026f9.cjs.dev.js');
11
11
  var NextImage = require('next/image');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
- var ValApp = require('./ValApp-0efa0e5d.cjs.dev.js');
13
+ var ValApp = require('./ValApp-0ded607c.cjs.dev.js');
14
14
  var version = require('./version-82faa1d0.cjs.dev.js');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -7,10 +7,10 @@ var objectSpread2 = require('./objectSpread2-3c87fb4f.cjs.prod.js');
7
7
  var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var internal = require('@valbuild/react/internal');
10
- var ValNextProvider = require('./ValNextProvider-a618d775.cjs.prod.js');
10
+ var ValNextProvider = require('./ValNextProvider-7042b86d.cjs.prod.js');
11
11
  var NextImage = require('next/image');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
- var ValApp = require('./ValApp-a808cf89.cjs.prod.js');
13
+ var ValApp = require('./ValApp-b10c2084.cjs.prod.js');
14
14
  var version = require('./version-a9a6a619.cjs.prod.js');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -6,10 +6,10 @@ export { core as expr };
6
6
  export { FILE_REF_PROP, GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
7
7
  import { stegaClean, stegaEncode, stegaDecodeString, autoTagJSX } from '@valbuild/react/stega';
8
8
  export { ValRichText } from '@valbuild/react/internal';
9
- import { ValNextProvider } from './ValNextProvider-25f1f5c9.esm.js';
9
+ import { ValNextProvider } from './ValNextProvider-10c232b6.esm.js';
10
10
  import NextImage from 'next/image';
11
11
  import { jsx } from 'react/jsx-runtime';
12
- export { ValApp } from './ValApp-3ab62a2b.esm.js';
12
+ export { ValApp } from './ValApp-489d97dc.esm.js';
13
13
  import { V as VERSION } from './version-98ec5c7a.esm.js';
14
14
 
15
15
  function raw(val) {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "next",
9
9
  "react"
10
10
  ],
11
- "version": "0.84.3",
11
+ "version": "0.85.1",
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
14
  "test": "jest"
@@ -45,11 +45,11 @@
45
45
  "exports": true
46
46
  },
47
47
  "dependencies": {
48
- "@valbuild/core": "~0.84.3",
49
- "@valbuild/react": "~0.84.3",
50
- "@valbuild/server": "~0.84.3",
51
- "@valbuild/shared": "~0.84.3",
52
- "@valbuild/ui": "~0.84.3",
48
+ "@valbuild/core": "~0.85.1",
49
+ "@valbuild/react": "~0.85.1",
50
+ "@valbuild/server": "~0.85.1",
51
+ "@valbuild/shared": "~0.85.1",
52
+ "@valbuild/ui": "~0.85.1",
53
53
  "client-only": "^0.0.1",
54
54
  "server-only": "^0.0.1"
55
55
  },