@valbuild/react 0.58.0 → 0.59.0

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 (40) hide show
  1. package/dist/ValProvider-09e313e2.worker.esm.js +87 -0
  2. package/dist/ValProvider-461fa48b.cjs.js +7 -0
  3. package/dist/ValProvider-461fa48b.cjs.prod.js +115 -0
  4. package/dist/ValProvider-a3b1e699.esm.js +92 -0
  5. package/dist/ValProvider-b34afe68.browser.esm.js +92 -0
  6. package/dist/ValProvider-d17e4d13.cjs.dev.js +121 -0
  7. package/dist/ValUI-1922d8db.cjs.dev.js +1 -1
  8. package/dist/ValUI-23e2422b.cjs.prod.js +1 -1
  9. package/dist/ValUI-7d39a3f6.browser.esm.js +1 -1
  10. package/dist/ValUI-84a9cc93.worker.esm.js +1 -1
  11. package/dist/ValUI-8775ef5c.esm.js +1 -1
  12. package/dist/declarations/src/internal/ValProvider.d.ts +1 -1
  13. package/dist/toConsumableArray-0a75a603.worker.esm.js +19 -0
  14. package/dist/toConsumableArray-0ccd58b7.esm.js +19 -0
  15. package/dist/toConsumableArray-5a71fbb3.browser.esm.js +19 -0
  16. package/dist/toConsumableArray-b2d28ffa.cjs.dev.js +21 -0
  17. package/dist/toConsumableArray-b5e3b83f.cjs.prod.js +21 -0
  18. package/internal/dist/valbuild-react-internal.browser.esm.js +3 -18
  19. package/internal/dist/valbuild-react-internal.cjs.dev.js +4 -19
  20. package/internal/dist/valbuild-react-internal.cjs.prod.js +4 -19
  21. package/internal/dist/valbuild-react-internal.esm.js +3 -18
  22. package/internal/dist/valbuild-react-internal.worker.esm.js +3 -18
  23. package/package.json +4 -4
  24. package/stega/dist/valbuild-react-stega.browser.esm.js +52 -6
  25. package/stega/dist/valbuild-react-stega.cjs.dev.js +53 -7
  26. package/stega/dist/valbuild-react-stega.cjs.prod.js +53 -7
  27. package/stega/dist/valbuild-react-stega.esm.js +52 -6
  28. package/stega/dist/valbuild-react-stega.worker.esm.js +52 -6
  29. package/dist/ValProvider-47b779dc.esm.js +0 -689
  30. package/dist/ValProvider-48e6e607.browser.esm.js +0 -689
  31. package/dist/ValProvider-5b6a05e9.cjs.js +0 -7
  32. package/dist/ValProvider-5b6a05e9.cjs.prod.js +0 -712
  33. package/dist/ValProvider-7c2a7439.worker.esm.js +0 -684
  34. package/dist/ValProvider-87161e66.cjs.dev.js +0 -718
  35. package/dist/declarations/src/internal/ValStore.d.ts +0 -16
  36. package/dist/defineProperty-6ed7deb7.browser.esm.js +0 -32
  37. package/dist/defineProperty-82fbeafc.worker.esm.js +0 -32
  38. package/dist/defineProperty-9bf3d0c0.esm.js +0 -32
  39. package/dist/defineProperty-c84f9aba.cjs.dev.js +0 -35
  40. package/dist/defineProperty-f8fe5660.cjs.prod.js +0 -35
@@ -0,0 +1,87 @@
1
+ 'use client';
2
+ import { _ as _slicedToArray } from './slicedToArray-e7da2c5e.worker.esm.js';
3
+ import { useMemo, useState, useEffect, lazy } from 'react';
4
+ import { ValApi, Internal } from '@valbuild/core';
5
+ import { ValStore } from '@valbuild/shared/internal';
6
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
+ import './unsupportedIterableToArray-50359a05.worker.esm.js';
8
+
9
+ var useValStore = function useValStore() {
10
+ {
11
+ return undefined;
12
+ }
13
+ };
14
+ var useValApi = function useValApi() {
15
+ {
16
+ return undefined;
17
+ }
18
+ };
19
+ var ValContext = undefined;
20
+ var ValUI = /*#__PURE__*/lazy(function () {
21
+ return import('./ValUI-84a9cc93.worker.esm.js');
22
+ });
23
+ function ValProvider(_ref) {
24
+ var children = _ref.children,
25
+ onSubmit = _ref.onSubmit;
26
+ var host = "/api/val";
27
+ var api = useMemo(function () {
28
+ return new ValApi(host);
29
+ }, [host]);
30
+ var store = useMemo(function () {
31
+ return new ValStore(api);
32
+ }, [api]);
33
+ var _useState = useState(false),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ isClient = _useState2[0],
36
+ setIsClient = _useState2[1];
37
+ var _useState3 = useState(),
38
+ _useState4 = _slicedToArray(_useState3, 2),
39
+ enabled = _useState4[0],
40
+ setEnabled = _useState4[1];
41
+ useEffect(function () {
42
+ setIsClient(true);
43
+ try {
44
+ var _document$cookie, _document$cookie2;
45
+ var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
46
+ if (valEnabled) {
47
+ setEnabled(true);
48
+ }
49
+ var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
50
+ if (valDisabled) {
51
+ setEnabled(false);
52
+ }
53
+ // If we are in development and Val is not enabled or disabled, enable Val
54
+ if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
55
+ window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
56
+ }
57
+ } catch (e) {
58
+ console.warn("Could not read Val enabled state", e);
59
+ }
60
+ }, []);
61
+ if (isClient && !enabled) {
62
+ if (!api) {
63
+ console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
64
+ } else {
65
+ if (process.env.NODE_ENV === "development") {
66
+ console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
67
+ }
68
+ }
69
+ }
70
+ if (!isClient || !enabled || !store || !api || !ValContext) {
71
+ return /*#__PURE__*/jsx(Fragment, {
72
+ children: children
73
+ });
74
+ }
75
+ return /*#__PURE__*/jsxs(ValContext.Provider, {
76
+ value: {
77
+ valApi: api,
78
+ valStore: store
79
+ },
80
+ children: [children, /*#__PURE__*/jsx(ValUI, {
81
+ host: host,
82
+ onSubmit: onSubmit
83
+ })]
84
+ });
85
+ }
86
+
87
+ export { ValContext, ValProvider, useValApi, useValStore };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValProvider-461fa48b.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValProvider-461fa48b.cjs.dev.js");
7
+ }
@@ -0,0 +1,115 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var slicedToArray = require('./slicedToArray-c405fbf0.cjs.prod.js');
7
+ var React = require('react');
8
+ var core = require('@valbuild/core');
9
+ var internal = require('@valbuild/shared/internal');
10
+ var ReactJSXRuntime = require('react/jsx-runtime');
11
+ require('./unsupportedIterableToArray-42309462.cjs.prod.js');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n["default"] = e;
30
+ return Object.freeze(n);
31
+ }
32
+
33
+ var React__default = /*#__PURE__*/_interopDefault(React);
34
+
35
+ var useValStore = function useValStore() {
36
+ if (!ValContext) {
37
+ return undefined;
38
+ }
39
+ return React.useContext(ValContext).valStore;
40
+ };
41
+ var useValApi = function useValApi() {
42
+ if (!ValContext) {
43
+ return undefined;
44
+ }
45
+ return React.useContext(ValContext).valApi;
46
+ };
47
+ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["default"].createContext({
48
+ valStore: undefined,
49
+ valApi: undefined
50
+ }) : undefined;
51
+ var ValUI = /*#__PURE__*/React.lazy(function () {
52
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-23e2422b.cjs.prod.js')); });
53
+ });
54
+ function ValProvider(_ref) {
55
+ var children = _ref.children,
56
+ onSubmit = _ref.onSubmit;
57
+ var host = "/api/val";
58
+ var api = React.useMemo(function () {
59
+ return new core.ValApi(host);
60
+ }, [host]);
61
+ var store = React.useMemo(function () {
62
+ return new internal.ValStore(api);
63
+ }, [api]);
64
+ var _useState = React.useState(false),
65
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
66
+ isClient = _useState2[0],
67
+ setIsClient = _useState2[1];
68
+ var _useState3 = React.useState(),
69
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
70
+ enabled = _useState4[0],
71
+ setEnabled = _useState4[1];
72
+ React.useEffect(function () {
73
+ setIsClient(true);
74
+ try {
75
+ var _document$cookie, _document$cookie2;
76
+ var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
77
+ if (valEnabled) {
78
+ setEnabled(true);
79
+ }
80
+ var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
81
+ if (valDisabled) {
82
+ setEnabled(false);
83
+ }
84
+ // If we are in development and Val is not enabled or disabled, enable Val
85
+ if ( "production" === "development" && !valEnabled && !valDisabled) ;
86
+ } catch (e) {
87
+ console.warn("Could not read Val enabled state", e);
88
+ }
89
+ }, []);
90
+ if (isClient && !enabled) {
91
+ if (!api) {
92
+ console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
93
+ }
94
+ }
95
+ if (!isClient || !enabled || !store || !api || !ValContext) {
96
+ return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
97
+ children: children
98
+ });
99
+ }
100
+ return /*#__PURE__*/ReactJSXRuntime.jsxs(ValContext.Provider, {
101
+ value: {
102
+ valApi: api,
103
+ valStore: store
104
+ },
105
+ children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {
106
+ host: host,
107
+ onSubmit: onSubmit
108
+ })]
109
+ });
110
+ }
111
+
112
+ exports.ValContext = ValContext;
113
+ exports.ValProvider = ValProvider;
114
+ exports.useValApi = useValApi;
115
+ exports.useValStore = useValStore;
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ import { _ as _slicedToArray } from './slicedToArray-1dc7d2d6.esm.js';
3
+ import React, { useContext, useMemo, useState, useEffect, lazy } from 'react';
4
+ import { ValApi, Internal } from '@valbuild/core';
5
+ import { ValStore } from '@valbuild/shared/internal';
6
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
+ import './unsupportedIterableToArray-7c30dadf.esm.js';
8
+
9
+ var useValStore = function useValStore() {
10
+ if (!ValContext) {
11
+ return undefined;
12
+ }
13
+ return useContext(ValContext).valStore;
14
+ };
15
+ var useValApi = function useValApi() {
16
+ if (!ValContext) {
17
+ return undefined;
18
+ }
19
+ return useContext(ValContext).valApi;
20
+ };
21
+ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React.createContext({
22
+ valStore: undefined,
23
+ valApi: undefined
24
+ }) : undefined;
25
+ var ValUI = /*#__PURE__*/lazy(function () {
26
+ return import('./ValUI-8775ef5c.esm.js');
27
+ });
28
+ function ValProvider(_ref) {
29
+ var children = _ref.children,
30
+ onSubmit = _ref.onSubmit;
31
+ var host = "/api/val";
32
+ var api = useMemo(function () {
33
+ return new ValApi(host);
34
+ }, [host]);
35
+ var store = useMemo(function () {
36
+ return new ValStore(api);
37
+ }, [api]);
38
+ var _useState = useState(false),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ isClient = _useState2[0],
41
+ setIsClient = _useState2[1];
42
+ var _useState3 = useState(),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ enabled = _useState4[0],
45
+ setEnabled = _useState4[1];
46
+ useEffect(function () {
47
+ setIsClient(true);
48
+ try {
49
+ var _document$cookie, _document$cookie2;
50
+ var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
51
+ if (valEnabled) {
52
+ setEnabled(true);
53
+ }
54
+ var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
55
+ if (valDisabled) {
56
+ setEnabled(false);
57
+ }
58
+ // If we are in development and Val is not enabled or disabled, enable Val
59
+ if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
60
+ window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
61
+ }
62
+ } catch (e) {
63
+ console.warn("Could not read Val enabled state", e);
64
+ }
65
+ }, []);
66
+ if (isClient && !enabled) {
67
+ if (!api) {
68
+ console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
69
+ } else {
70
+ if (process.env.NODE_ENV === "development") {
71
+ console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
72
+ }
73
+ }
74
+ }
75
+ if (!isClient || !enabled || !store || !api || !ValContext) {
76
+ return /*#__PURE__*/jsx(Fragment, {
77
+ children: children
78
+ });
79
+ }
80
+ return /*#__PURE__*/jsxs(ValContext.Provider, {
81
+ value: {
82
+ valApi: api,
83
+ valStore: store
84
+ },
85
+ children: [children, /*#__PURE__*/jsx(ValUI, {
86
+ host: host,
87
+ onSubmit: onSubmit
88
+ })]
89
+ });
90
+ }
91
+
92
+ export { ValContext, ValProvider, useValApi, useValStore };
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ import { _ as _slicedToArray } from './slicedToArray-7b69258f.browser.esm.js';
3
+ import React, { useContext, useMemo, useState, useEffect, lazy } from 'react';
4
+ import { ValApi, Internal } from '@valbuild/core';
5
+ import { ValStore } from '@valbuild/shared/internal';
6
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
+ import './unsupportedIterableToArray-cce3cb41.browser.esm.js';
8
+
9
+ var useValStore = function useValStore() {
10
+ if (!ValContext) {
11
+ return undefined;
12
+ }
13
+ return useContext(ValContext).valStore;
14
+ };
15
+ var useValApi = function useValApi() {
16
+ if (!ValContext) {
17
+ return undefined;
18
+ }
19
+ return useContext(ValContext).valApi;
20
+ };
21
+ var ValContext = /*#__PURE__*/React.createContext({
22
+ valStore: undefined,
23
+ valApi: undefined
24
+ }) ;
25
+ var ValUI = /*#__PURE__*/lazy(function () {
26
+ return import('./ValUI-7d39a3f6.browser.esm.js');
27
+ });
28
+ function ValProvider(_ref) {
29
+ var children = _ref.children,
30
+ onSubmit = _ref.onSubmit;
31
+ var host = "/api/val";
32
+ var api = useMemo(function () {
33
+ return new ValApi(host);
34
+ }, [host]);
35
+ var store = useMemo(function () {
36
+ return new ValStore(api);
37
+ }, [api]);
38
+ var _useState = useState(false),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ isClient = _useState2[0],
41
+ setIsClient = _useState2[1];
42
+ var _useState3 = useState(),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ enabled = _useState4[0],
45
+ setEnabled = _useState4[1];
46
+ useEffect(function () {
47
+ setIsClient(true);
48
+ try {
49
+ var _document$cookie, _document$cookie2;
50
+ var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
51
+ if (valEnabled) {
52
+ setEnabled(true);
53
+ }
54
+ var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
55
+ if (valDisabled) {
56
+ setEnabled(false);
57
+ }
58
+ // If we are in development and Val is not enabled or disabled, enable Val
59
+ if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
60
+ window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
61
+ }
62
+ } catch (e) {
63
+ console.warn("Could not read Val enabled state", e);
64
+ }
65
+ }, []);
66
+ if (isClient && !enabled) {
67
+ if (!api) {
68
+ console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
69
+ } else {
70
+ if (process.env.NODE_ENV === "development") {
71
+ console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
72
+ }
73
+ }
74
+ }
75
+ if (!isClient || !enabled || !store || !api || !ValContext) {
76
+ return /*#__PURE__*/jsx(Fragment, {
77
+ children: children
78
+ });
79
+ }
80
+ return /*#__PURE__*/jsxs(ValContext.Provider, {
81
+ value: {
82
+ valApi: api,
83
+ valStore: store
84
+ },
85
+ children: [children, /*#__PURE__*/jsx(ValUI, {
86
+ host: host,
87
+ onSubmit: onSubmit
88
+ })]
89
+ });
90
+ }
91
+
92
+ export { ValContext, ValProvider, useValApi, useValStore };
@@ -0,0 +1,121 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var slicedToArray = require('./slicedToArray-11a666de.cjs.dev.js');
7
+ var React = require('react');
8
+ var core = require('@valbuild/core');
9
+ var internal = require('@valbuild/shared/internal');
10
+ var ReactJSXRuntime = require('react/jsx-runtime');
11
+ require('./unsupportedIterableToArray-ac28611a.cjs.dev.js');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n["default"] = e;
30
+ return Object.freeze(n);
31
+ }
32
+
33
+ var React__default = /*#__PURE__*/_interopDefault(React);
34
+
35
+ var useValStore = function useValStore() {
36
+ if (!ValContext) {
37
+ return undefined;
38
+ }
39
+ return React.useContext(ValContext).valStore;
40
+ };
41
+ var useValApi = function useValApi() {
42
+ if (!ValContext) {
43
+ return undefined;
44
+ }
45
+ return React.useContext(ValContext).valApi;
46
+ };
47
+ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["default"].createContext({
48
+ valStore: undefined,
49
+ valApi: undefined
50
+ }) : undefined;
51
+ var ValUI = /*#__PURE__*/React.lazy(function () {
52
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-1922d8db.cjs.dev.js')); });
53
+ });
54
+ function ValProvider(_ref) {
55
+ var children = _ref.children,
56
+ onSubmit = _ref.onSubmit;
57
+ var host = "/api/val";
58
+ var api = React.useMemo(function () {
59
+ return new core.ValApi(host);
60
+ }, [host]);
61
+ var store = React.useMemo(function () {
62
+ return new internal.ValStore(api);
63
+ }, [api]);
64
+ var _useState = React.useState(false),
65
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
66
+ isClient = _useState2[0],
67
+ setIsClient = _useState2[1];
68
+ var _useState3 = React.useState(),
69
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
70
+ enabled = _useState4[0],
71
+ setEnabled = _useState4[1];
72
+ React.useEffect(function () {
73
+ setIsClient(true);
74
+ try {
75
+ var _document$cookie, _document$cookie2;
76
+ var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
77
+ if (valEnabled) {
78
+ setEnabled(true);
79
+ }
80
+ var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
81
+ if (valDisabled) {
82
+ setEnabled(false);
83
+ }
84
+ // If we are in development and Val is not enabled or disabled, enable Val
85
+ if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
86
+ window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
87
+ }
88
+ } catch (e) {
89
+ console.warn("Could not read Val enabled state", e);
90
+ }
91
+ }, []);
92
+ if (isClient && !enabled) {
93
+ if (!api) {
94
+ console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
95
+ } else {
96
+ if (process.env.NODE_ENV === "development") {
97
+ console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
98
+ }
99
+ }
100
+ }
101
+ if (!isClient || !enabled || !store || !api || !ValContext) {
102
+ return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
103
+ children: children
104
+ });
105
+ }
106
+ return /*#__PURE__*/ReactJSXRuntime.jsxs(ValContext.Provider, {
107
+ value: {
108
+ valApi: api,
109
+ valStore: store
110
+ },
111
+ children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {
112
+ host: host,
113
+ onSubmit: onSubmit
114
+ })]
115
+ });
116
+ }
117
+
118
+ exports.ValContext = ValContext;
119
+ exports.ValProvider = ValProvider;
120
+ exports.useValApi = useValApi;
121
+ exports.useValStore = useValStore;
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-11a666de.cjs.dev.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-87161e66.cjs.dev.js');
11
+ var ValProvider = require('./ValProvider-d17e4d13.cjs.dev.js');
12
12
  require('./unsupportedIterableToArray-ac28611a.cjs.dev.js');
13
13
 
14
14
  function ShadowContent(_ref) {
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-c405fbf0.cjs.prod.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-5b6a05e9.cjs.prod.js');
11
+ var ValProvider = require('./ValProvider-461fa48b.cjs.prod.js');
12
12
  require('./unsupportedIterableToArray-42309462.cjs.prod.js');
13
13
 
14
14
  function ShadowContent(_ref) {
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-7b69258f.browser.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-48e6e607.browser.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-b34afe68.browser.esm.js';
8
8
  import './unsupportedIterableToArray-cce3cb41.browser.esm.js';
9
9
 
10
10
  function ShadowContent(_ref) {
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-e7da2c5e.worker.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-7c2a7439.worker.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-09e313e2.worker.esm.js';
8
8
  import './unsupportedIterableToArray-50359a05.worker.esm.js';
9
9
 
10
10
  function ShadowContent(_ref) {
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-1dc7d2d6.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-47b779dc.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-a3b1e699.esm.js';
8
8
  import './unsupportedIterableToArray-7c30dadf.esm.js';
9
9
 
10
10
  function ShadowContent(_ref) {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { ValStore } from "./ValStore.js";
3
2
  import { ValApi } from "@valbuild/core";
3
+ import { ValStore } from "@valbuild/shared/internal";
4
4
  export declare const useValStore: () => ValStore | undefined;
5
5
  export type UseValStore = typeof useValStore;
6
6
  export declare const useValApi: () => any;
@@ -0,0 +1,19 @@
1
+ import { a as _arrayLikeToArray, _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-50359a05.worker.esm.js';
2
+
3
+ function _arrayWithoutHoles(arr) {
4
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5
+ }
6
+
7
+ function _iterableToArray(iter) {
8
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9
+ }
10
+
11
+ function _nonIterableSpread() {
12
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13
+ }
14
+
15
+ function _toConsumableArray(arr) {
16
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
17
+ }
18
+
19
+ export { _toConsumableArray as _ };
@@ -0,0 +1,19 @@
1
+ import { a as _arrayLikeToArray, _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-7c30dadf.esm.js';
2
+
3
+ function _arrayWithoutHoles(arr) {
4
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5
+ }
6
+
7
+ function _iterableToArray(iter) {
8
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9
+ }
10
+
11
+ function _nonIterableSpread() {
12
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13
+ }
14
+
15
+ function _toConsumableArray(arr) {
16
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
17
+ }
18
+
19
+ export { _toConsumableArray as _ };
@@ -0,0 +1,19 @@
1
+ import { a as _arrayLikeToArray, _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-cce3cb41.browser.esm.js';
2
+
3
+ function _arrayWithoutHoles(arr) {
4
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5
+ }
6
+
7
+ function _iterableToArray(iter) {
8
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9
+ }
10
+
11
+ function _nonIterableSpread() {
12
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13
+ }
14
+
15
+ function _toConsumableArray(arr) {
16
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
17
+ }
18
+
19
+ export { _toConsumableArray as _ };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var unsupportedIterableToArray = require('./unsupportedIterableToArray-ac28611a.cjs.dev.js');
4
+
5
+ function _arrayWithoutHoles(arr) {
6
+ if (Array.isArray(arr)) return unsupportedIterableToArray._arrayLikeToArray(arr);
7
+ }
8
+
9
+ function _iterableToArray(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+
13
+ function _nonIterableSpread() {
14
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15
+ }
16
+
17
+ function _toConsumableArray(arr) {
18
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || unsupportedIterableToArray._unsupportedIterableToArray(arr) || _nonIterableSpread();
19
+ }
20
+
21
+ exports._toConsumableArray = _toConsumableArray;