@valbuild/react 0.28.0 → 0.29.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.
- package/dist/{ValProvider-4b3dcddd.cjs.prod.js → ValProviderInternal-11c45b39.cjs.prod.js} +8 -31
- package/dist/ValProviderInternal-4491e75a.worker.esm.js +17 -0
- package/dist/{ValProvider-f27d153f.worker.esm.js → ValProviderInternal-955b2ced.esm.js} +9 -14
- package/dist/{ValProvider-7be3721e.cjs.dev.js → ValProviderInternal-f1bbfabb.cjs.dev.js} +8 -31
- package/dist/{ValProvider-772ad108.browser.esm.js → ValProviderInternal-fed8d4f2.browser.esm.js} +7 -14
- package/dist/{ValUI-a93bea98.worker.esm.js → ValUI-14d84602.worker.esm.js} +9 -6
- package/dist/{ValUI-1bebc456.browser.esm.js → ValUI-3aefbfd7.browser.esm.js} +8 -3
- package/dist/{ValUI-2dc20794.esm.js → ValUI-8e4092a8.esm.js} +8 -3
- package/dist/{ValUI-968a38fb.cjs.dev.js → ValUI-a5ff7b4f.cjs.dev.js} +10 -5
- package/dist/ValUI-c636bbdd.cjs.js +7 -0
- package/dist/{ValUI-702583bb.cjs.prod.js → ValUI-c636bbdd.cjs.prod.js} +10 -5
- package/dist/declarations/src/ValProvider.d.ts +2 -13
- package/dist/declarations/src/ValProviderInternal.d.ts +15 -0
- package/dist/declarations/src/ValRichText.d.ts +3 -2
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/{slicedToArray-4510c35a.worker.esm.js → slicedToArray-5b9980b8.worker.esm.js} +1 -1
- package/dist/valbuild-react.browser.esm.js +22 -4
- package/dist/valbuild-react.cjs.dev.js +22 -4
- package/dist/valbuild-react.cjs.prod.js +22 -4
- package/dist/valbuild-react.esm.js +22 -4
- package/dist/valbuild-react.worker.esm.js +13 -6
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +1 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +1 -1
- package/package.json +3 -3
- package/stega/dist/valbuild-react-stega.worker.esm.js +32 -2
- package/dist/ValProvider-ecdd4b68.esm.js +0 -618
- package/dist/ValUI-702583bb.cjs.js +0 -7
- package/dist/defineProperty-18559492.worker.esm.js +0 -32
@@ -5,29 +5,13 @@ var slicedToArray = require('./slicedToArray-1fc98f25.cjs.prod.js');
|
|
5
5
|
var defineProperty = require('./defineProperty-36ed93cd.cjs.prod.js');
|
6
6
|
var fp = require('@valbuild/core/fp');
|
7
7
|
var core = require('@valbuild/core');
|
8
|
+
var ValUI = require('./ValUI-c636bbdd.cjs.prod.js');
|
8
9
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
9
10
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
11
12
|
|
12
|
-
function _interopNamespace(e) {
|
13
|
-
if (e && e.__esModule) return e;
|
14
|
-
var n = Object.create(null);
|
15
|
-
if (e) {
|
16
|
-
Object.keys(e).forEach(function (k) {
|
17
|
-
if (k !== 'default') {
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
20
|
-
enumerable: true,
|
21
|
-
get: function () { return e[k]; }
|
22
|
-
});
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}
|
26
|
-
n["default"] = e;
|
27
|
-
return Object.freeze(n);
|
28
|
-
}
|
29
|
-
|
30
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
14
|
+
var ValUI__default = /*#__PURE__*/_interopDefault(ValUI);
|
31
15
|
|
32
16
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
33
17
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
@@ -603,7 +587,6 @@ function createSubscriberId(moduleIds) {
|
|
603
587
|
return moduleIds.slice().sort().join("&");
|
604
588
|
}
|
605
589
|
|
606
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
607
590
|
function useValStore() {
|
608
591
|
return React.useContext(ValContext).valStore;
|
609
592
|
}
|
@@ -611,17 +594,10 @@ function useValApi() {
|
|
611
594
|
return React.useContext(ValContext).valApi;
|
612
595
|
}
|
613
596
|
var ValContext = /*#__PURE__*/React__default["default"].createContext({
|
614
|
-
|
615
|
-
|
616
|
-
},
|
617
|
-
get valApi() {
|
618
|
-
throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
|
619
|
-
}
|
597
|
+
valStore: undefined,
|
598
|
+
valApi: undefined
|
620
599
|
});
|
621
|
-
|
622
|
-
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-702583bb.cjs.prod.js')); });
|
623
|
-
}) : null;
|
624
|
-
function ValProvider(_ref) {
|
600
|
+
function ValProviderInternal(_ref) {
|
625
601
|
var children = _ref.children;
|
626
602
|
var host = "/api/val";
|
627
603
|
var valApi = React.useMemo(function () {
|
@@ -635,10 +611,11 @@ function ValProvider(_ref) {
|
|
635
611
|
valApi: valApi,
|
636
612
|
valStore: valStore
|
637
613
|
},
|
638
|
-
children: [children,
|
614
|
+
children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI__default["default"], {})]
|
639
615
|
});
|
640
616
|
}
|
641
617
|
|
642
|
-
exports.
|
618
|
+
exports.ValContext = ValContext;
|
619
|
+
exports["default"] = ValProviderInternal;
|
643
620
|
exports.useValApi = useValApi;
|
644
621
|
exports.useValStore = useValStore;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import '@valbuild/core';
|
3
|
+
import './ValUI-14d84602.worker.esm.js';
|
4
|
+
import 'react/jsx-runtime';
|
5
|
+
|
6
|
+
function useValStore() {
|
7
|
+
return useContext(ValContext).valStore;
|
8
|
+
}
|
9
|
+
function useValApi() {
|
10
|
+
return useContext(ValContext).valApi;
|
11
|
+
}
|
12
|
+
var ValContext = /*#__PURE__*/React.createContext({
|
13
|
+
valStore: undefined,
|
14
|
+
valApi: undefined
|
15
|
+
});
|
16
|
+
|
17
|
+
export { useValApi as a, useValStore as u };
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
2
|
-
import { _ as _unsupportedIterableToArray, a as _slicedToArray } from './slicedToArray-
|
3
|
-
import { _ as _toPropertyKey, a as _defineProperty } from './defineProperty-
|
2
|
+
import { _ as _unsupportedIterableToArray, a as _slicedToArray } from './slicedToArray-5418adeb.esm.js';
|
3
|
+
import { _ as _toPropertyKey, a as _defineProperty } from './defineProperty-b209a901.esm.js';
|
4
4
|
import { result } from '@valbuild/core/fp';
|
5
5
|
import { ValApi } from '@valbuild/core';
|
6
|
-
import
|
6
|
+
import ValUI from './ValUI-8e4092a8.esm.js';
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
7
8
|
|
8
9
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
9
10
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
@@ -579,7 +580,6 @@ function createSubscriberId(moduleIds) {
|
|
579
580
|
return moduleIds.slice().sort().join("&");
|
580
581
|
}
|
581
582
|
|
582
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
583
583
|
function useValStore() {
|
584
584
|
return useContext(ValContext).valStore;
|
585
585
|
}
|
@@ -587,15 +587,10 @@ function useValApi() {
|
|
587
587
|
return useContext(ValContext).valApi;
|
588
588
|
}
|
589
589
|
var ValContext = /*#__PURE__*/React.createContext({
|
590
|
-
|
591
|
-
|
592
|
-
},
|
593
|
-
get valApi() {
|
594
|
-
throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
|
595
|
-
}
|
590
|
+
valStore: undefined,
|
591
|
+
valApi: undefined
|
596
592
|
});
|
597
|
-
|
598
|
-
function ValProvider(_ref) {
|
593
|
+
function ValProviderInternal(_ref) {
|
599
594
|
var children = _ref.children;
|
600
595
|
var host = "/api/val";
|
601
596
|
var valApi = useMemo(function () {
|
@@ -609,8 +604,8 @@ function ValProvider(_ref) {
|
|
609
604
|
valApi: valApi,
|
610
605
|
valStore: valStore
|
611
606
|
},
|
612
|
-
children: [children, ValUI ]
|
607
|
+
children: [children, /*#__PURE__*/jsx(ValUI, {})]
|
613
608
|
});
|
614
609
|
}
|
615
610
|
|
616
|
-
export {
|
611
|
+
export { ValContext, ValProviderInternal as default, useValApi, useValStore };
|
@@ -5,29 +5,13 @@ var slicedToArray = require('./slicedToArray-fb0bef7d.cjs.dev.js');
|
|
5
5
|
var defineProperty = require('./defineProperty-c82a49b0.cjs.dev.js');
|
6
6
|
var fp = require('@valbuild/core/fp');
|
7
7
|
var core = require('@valbuild/core');
|
8
|
+
var ValUI = require('./ValUI-a5ff7b4f.cjs.dev.js');
|
8
9
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
9
10
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
11
12
|
|
12
|
-
function _interopNamespace(e) {
|
13
|
-
if (e && e.__esModule) return e;
|
14
|
-
var n = Object.create(null);
|
15
|
-
if (e) {
|
16
|
-
Object.keys(e).forEach(function (k) {
|
17
|
-
if (k !== 'default') {
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
20
|
-
enumerable: true,
|
21
|
-
get: function () { return e[k]; }
|
22
|
-
});
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}
|
26
|
-
n["default"] = e;
|
27
|
-
return Object.freeze(n);
|
28
|
-
}
|
29
|
-
|
30
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
14
|
+
var ValUI__default = /*#__PURE__*/_interopDefault(ValUI);
|
31
15
|
|
32
16
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
33
17
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
@@ -603,7 +587,6 @@ function createSubscriberId(moduleIds) {
|
|
603
587
|
return moduleIds.slice().sort().join("&");
|
604
588
|
}
|
605
589
|
|
606
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
607
590
|
function useValStore() {
|
608
591
|
return React.useContext(ValContext).valStore;
|
609
592
|
}
|
@@ -611,17 +594,10 @@ function useValApi() {
|
|
611
594
|
return React.useContext(ValContext).valApi;
|
612
595
|
}
|
613
596
|
var ValContext = /*#__PURE__*/React__default["default"].createContext({
|
614
|
-
|
615
|
-
|
616
|
-
},
|
617
|
-
get valApi() {
|
618
|
-
throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
|
619
|
-
}
|
597
|
+
valStore: undefined,
|
598
|
+
valApi: undefined
|
620
599
|
});
|
621
|
-
|
622
|
-
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-968a38fb.cjs.dev.js')); });
|
623
|
-
}) : null;
|
624
|
-
function ValProvider(_ref) {
|
600
|
+
function ValProviderInternal(_ref) {
|
625
601
|
var children = _ref.children;
|
626
602
|
var host = "/api/val";
|
627
603
|
var valApi = React.useMemo(function () {
|
@@ -635,10 +611,11 @@ function ValProvider(_ref) {
|
|
635
611
|
valApi: valApi,
|
636
612
|
valStore: valStore
|
637
613
|
},
|
638
|
-
children: [children,
|
614
|
+
children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI__default["default"], {})]
|
639
615
|
});
|
640
616
|
}
|
641
617
|
|
642
|
-
exports.
|
618
|
+
exports.ValContext = ValContext;
|
619
|
+
exports["default"] = ValProviderInternal;
|
643
620
|
exports.useValApi = useValApi;
|
644
621
|
exports.useValStore = useValStore;
|
package/dist/{ValProvider-772ad108.browser.esm.js → ValProviderInternal-fed8d4f2.browser.esm.js}
RENAMED
@@ -1,8 +1,9 @@
|
|
1
|
-
import React, { useContext, useMemo
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
2
2
|
import { _ as _unsupportedIterableToArray, a as _slicedToArray } from './slicedToArray-964e1994.browser.esm.js';
|
3
3
|
import { _ as _toPropertyKey, a as _defineProperty } from './defineProperty-034d0378.browser.esm.js';
|
4
4
|
import { result } from '@valbuild/core/fp';
|
5
5
|
import { ValApi } from '@valbuild/core';
|
6
|
+
import ValUI from './ValUI-3aefbfd7.browser.esm.js';
|
6
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
7
8
|
|
8
9
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
@@ -579,7 +580,6 @@ function createSubscriberId(moduleIds) {
|
|
579
580
|
return moduleIds.slice().sort().join("&");
|
580
581
|
}
|
581
582
|
|
582
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
583
583
|
function useValStore() {
|
584
584
|
return useContext(ValContext).valStore;
|
585
585
|
}
|
@@ -587,17 +587,10 @@ function useValApi() {
|
|
587
587
|
return useContext(ValContext).valApi;
|
588
588
|
}
|
589
589
|
var ValContext = /*#__PURE__*/React.createContext({
|
590
|
-
|
591
|
-
|
592
|
-
},
|
593
|
-
get valApi() {
|
594
|
-
throw Error("Val context not found. Ensure components are wrapped by ValProvider!");
|
595
|
-
}
|
590
|
+
valStore: undefined,
|
591
|
+
valApi: undefined
|
596
592
|
});
|
597
|
-
|
598
|
-
return import('./ValUI-1bebc456.browser.esm.js');
|
599
|
-
}) ;
|
600
|
-
function ValProvider(_ref) {
|
593
|
+
function ValProviderInternal(_ref) {
|
601
594
|
var children = _ref.children;
|
602
595
|
var host = "/api/val";
|
603
596
|
var valApi = useMemo(function () {
|
@@ -611,8 +604,8 @@ function ValProvider(_ref) {
|
|
611
604
|
valApi: valApi,
|
612
605
|
valStore: valStore
|
613
606
|
},
|
614
|
-
children: [children,
|
607
|
+
children: [children, /*#__PURE__*/jsx(ValUI, {})]
|
615
608
|
});
|
616
609
|
}
|
617
610
|
|
618
|
-
export {
|
611
|
+
export { ValContext, ValProviderInternal as default, useValApi, useValStore };
|
@@ -1,13 +1,12 @@
|
|
1
1
|
'use client';
|
2
|
-
import {
|
2
|
+
import { _ as _slicedToArray } from './slicedToArray-5b9980b8.worker.esm.js';
|
3
3
|
import { Internal } from '@valbuild/core';
|
4
4
|
import { Style, ValOverlay } from '@valbuild/ui';
|
5
5
|
import { useRef, useState, useLayoutEffect, useEffect } from 'react';
|
6
6
|
import { createPortal } from 'react-dom';
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import { a as useValApi, u as useValStore } from './
|
9
|
-
import './
|
10
|
-
import '@valbuild/core/fp';
|
8
|
+
import { a as useValApi, u as useValStore } from './ValProviderInternal-4491e75a.worker.esm.js';
|
9
|
+
import './ValUI-14d84602.worker.esm.js';
|
11
10
|
|
12
11
|
function ShadowContent(_ref) {
|
13
12
|
var root = _ref.root,
|
@@ -79,9 +78,13 @@ function ValUI() {
|
|
79
78
|
}
|
80
79
|
}, []);
|
81
80
|
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
82
|
-
|
81
|
+
if (!api) {
|
82
|
+
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
83
|
+
} else {
|
84
|
+
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."));
|
85
|
+
}
|
83
86
|
}
|
84
|
-
if (!isClient || !enabled) {
|
87
|
+
if (!isClient || !enabled || !store || !api) {
|
85
88
|
return null;
|
86
89
|
}
|
87
90
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -5,9 +5,10 @@ import { Style, ValOverlay } from '@valbuild/ui';
|
|
5
5
|
import { useRef, useState, useLayoutEffect, useEffect } from 'react';
|
6
6
|
import { createPortal } from 'react-dom';
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import {
|
8
|
+
import { useValApi, useValStore } from './ValProviderInternal-fed8d4f2.browser.esm.js';
|
9
9
|
import './defineProperty-034d0378.browser.esm.js';
|
10
10
|
import '@valbuild/core/fp';
|
11
|
+
import './ValUI-3aefbfd7.browser.esm.js';
|
11
12
|
|
12
13
|
function ShadowContent(_ref) {
|
13
14
|
var root = _ref.root,
|
@@ -79,9 +80,13 @@ function ValUI() {
|
|
79
80
|
}
|
80
81
|
}, []);
|
81
82
|
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
82
|
-
|
83
|
+
if (!api) {
|
84
|
+
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
85
|
+
} else {
|
86
|
+
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."));
|
87
|
+
}
|
83
88
|
}
|
84
|
-
if (!isClient || !enabled) {
|
89
|
+
if (!isClient || !enabled || !store || !api) {
|
85
90
|
return null;
|
86
91
|
}
|
87
92
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -5,9 +5,10 @@ import { Style, ValOverlay } from '@valbuild/ui';
|
|
5
5
|
import { useRef, useState, useLayoutEffect, useEffect } from 'react';
|
6
6
|
import { createPortal } from 'react-dom';
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import {
|
8
|
+
import { useValApi, useValStore } from './ValProviderInternal-955b2ced.esm.js';
|
9
9
|
import './defineProperty-b209a901.esm.js';
|
10
10
|
import '@valbuild/core/fp';
|
11
|
+
import './ValUI-8e4092a8.esm.js';
|
11
12
|
|
12
13
|
function ShadowContent(_ref) {
|
13
14
|
var root = _ref.root,
|
@@ -79,9 +80,13 @@ function ValUI() {
|
|
79
80
|
}
|
80
81
|
}, []);
|
81
82
|
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
82
|
-
|
83
|
+
if (!api) {
|
84
|
+
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
85
|
+
} else {
|
86
|
+
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."));
|
87
|
+
}
|
83
88
|
}
|
84
|
-
if (!isClient || !enabled) {
|
89
|
+
if (!isClient || !enabled || !store || !api) {
|
85
90
|
return null;
|
86
91
|
}
|
87
92
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -9,9 +9,10 @@ var ui = require('@valbuild/ui');
|
|
9
9
|
var React = require('react');
|
10
10
|
var reactDom = require('react-dom');
|
11
11
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
12
|
-
var
|
12
|
+
var ValProviderInternal = require('./ValProviderInternal-f1bbfabb.cjs.dev.js');
|
13
13
|
require('./defineProperty-c82a49b0.cjs.dev.js');
|
14
14
|
require('@valbuild/core/fp');
|
15
|
+
require('./ValUI-a5ff7b4f.cjs.dev.js');
|
15
16
|
|
16
17
|
function ShadowContent(_ref) {
|
17
18
|
var root = _ref.root,
|
@@ -63,8 +64,8 @@ function ValUI() {
|
|
63
64
|
_useState6 = slicedToArray._slicedToArray(_useState5, 2);
|
64
65
|
_useState6[0];
|
65
66
|
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
66
|
-
var api =
|
67
|
-
var store =
|
67
|
+
var api = ValProviderInternal.useValApi();
|
68
|
+
var store = ValProviderInternal.useValStore();
|
68
69
|
React.useEffect(function () {
|
69
70
|
setIsClient(true);
|
70
71
|
try {
|
@@ -83,9 +84,13 @@ function ValUI() {
|
|
83
84
|
}
|
84
85
|
}, []);
|
85
86
|
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
86
|
-
|
87
|
+
if (!api) {
|
88
|
+
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
89
|
+
} else {
|
90
|
+
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."));
|
91
|
+
}
|
87
92
|
}
|
88
|
-
if (!isClient || !enabled) {
|
93
|
+
if (!isClient || !enabled || !store || !api) {
|
89
94
|
return null;
|
90
95
|
}
|
91
96
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
@@ -9,9 +9,10 @@ var ui = require('@valbuild/ui');
|
|
9
9
|
var React = require('react');
|
10
10
|
var reactDom = require('react-dom');
|
11
11
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
12
|
-
var
|
12
|
+
var ValProviderInternal = require('./ValProviderInternal-11c45b39.cjs.prod.js');
|
13
13
|
require('./defineProperty-36ed93cd.cjs.prod.js');
|
14
14
|
require('@valbuild/core/fp');
|
15
|
+
require('./ValUI-c636bbdd.cjs.prod.js');
|
15
16
|
|
16
17
|
function ShadowContent(_ref) {
|
17
18
|
var root = _ref.root,
|
@@ -63,8 +64,8 @@ function ValUI() {
|
|
63
64
|
_useState6 = slicedToArray._slicedToArray(_useState5, 2);
|
64
65
|
_useState6[0];
|
65
66
|
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
66
|
-
var api =
|
67
|
-
var store =
|
67
|
+
var api = ValProviderInternal.useValApi();
|
68
|
+
var store = ValProviderInternal.useValStore();
|
68
69
|
React.useEffect(function () {
|
69
70
|
setIsClient(true);
|
70
71
|
try {
|
@@ -83,9 +84,13 @@ function ValUI() {
|
|
83
84
|
}
|
84
85
|
}, []);
|
85
86
|
if (isClient && !enabled && "production" === "development") {
|
86
|
-
|
87
|
+
if (!api) {
|
88
|
+
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
89
|
+
} else {
|
90
|
+
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."));
|
91
|
+
}
|
87
92
|
}
|
88
|
-
if (!isClient || !enabled) {
|
93
|
+
if (!isClient || !enabled || !store || !api) {
|
89
94
|
return null;
|
90
95
|
}
|
91
96
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
@@ -1,14 +1,3 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
import { ValApi } from "@valbuild/core";
|
4
|
-
export declare function useValStore(): ValStore;
|
5
|
-
export declare function useValApi(): ValApi;
|
6
|
-
export type ValContext = {
|
7
|
-
readonly valStore: ValStore;
|
8
|
-
readonly valApi: ValApi;
|
9
|
-
};
|
10
|
-
export declare const ValContext: React.Context<ValContext>;
|
11
|
-
export type ValProviderProps = {
|
12
|
-
children?: React.ReactNode;
|
13
|
-
};
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { ValProviderProps } from "./ValProviderInternal.js";
|
14
3
|
export declare function ValProvider({ children }: ValProviderProps): JSX.Element;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { ValStore } from "./ValStore.js";
|
3
|
+
import { ValApi } from "@valbuild/core";
|
4
|
+
export declare function useValStore(): ValStore | undefined;
|
5
|
+
export declare function useValApi(): ValApi | undefined;
|
6
|
+
export type ValContext = {
|
7
|
+
readonly valStore?: ValStore;
|
8
|
+
readonly valApi?: ValApi;
|
9
|
+
};
|
10
|
+
export declare const ValContext: React.Context<ValContext>;
|
11
|
+
export type ValProviderProps = {
|
12
|
+
children?: React.ReactNode;
|
13
|
+
};
|
14
|
+
declare function ValProviderInternal({ children }: ValProviderProps): JSX.Element;
|
15
|
+
export default ValProviderInternal;
|
@@ -14,8 +14,9 @@ type ThemeOptions<O extends RichTextOptions> = {
|
|
14
14
|
[Key in Classes & keyof O as O[Key] extends true ? Key : never]: string;
|
15
15
|
};
|
16
16
|
};
|
17
|
-
export declare function ValRichText<O extends RichTextOptions>({ theme, children, }: {
|
18
|
-
theme
|
17
|
+
export declare function ValRichText<O extends RichTextOptions>({ theme, className, children, }: {
|
18
|
+
theme?: ThemeOptions<O>;
|
19
|
+
className?: string;
|
19
20
|
children: RichText<O>;
|
20
21
|
}): JSX.Element;
|
21
22
|
export {};
|
@@ -53,4 +53,4 @@ function _slicedToArray(arr, i) {
|
|
53
53
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
54
54
|
}
|
55
55
|
|
56
|
-
export {
|
56
|
+
export { _slicedToArray as _ };
|
@@ -1,14 +1,31 @@
|
|
1
|
-
export {
|
2
|
-
import React from 'react';
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
1
|
+
export { useValApi, useValStore } from './ValProviderInternal-fed8d4f2.browser.esm.js';
|
2
|
+
import React, { lazy } from 'react';
|
3
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
4
4
|
import './slicedToArray-964e1994.browser.esm.js';
|
5
5
|
import './defineProperty-034d0378.browser.esm.js';
|
6
6
|
import '@valbuild/core/fp';
|
7
7
|
import '@valbuild/core';
|
8
|
+
import './ValUI-3aefbfd7.browser.esm.js';
|
9
|
+
|
10
|
+
var ValProviderInternal = /*#__PURE__*/lazy(function () {
|
11
|
+
return import('./ValProviderInternal-fed8d4f2.browser.esm.js');
|
12
|
+
}) ;
|
13
|
+
function ValProvider(_ref) {
|
14
|
+
var children = _ref.children;
|
15
|
+
if (ValProviderInternal) {
|
16
|
+
return /*#__PURE__*/jsx(ValProviderInternal, {
|
17
|
+
children: children
|
18
|
+
});
|
19
|
+
}
|
20
|
+
return /*#__PURE__*/jsx(Fragment, {
|
21
|
+
children: children
|
22
|
+
});
|
23
|
+
}
|
8
24
|
|
9
25
|
/* eslint-disable @typescript-eslint/ban-types */
|
10
26
|
function ValRichText(_ref) {
|
11
27
|
var theme = _ref.theme,
|
28
|
+
className = _ref.className,
|
12
29
|
children = _ref.children;
|
13
30
|
var root = children;
|
14
31
|
function withRenderTag(clazz, current) {
|
@@ -140,9 +157,10 @@ function ValRichText(_ref) {
|
|
140
157
|
});
|
141
158
|
}
|
142
159
|
return /*#__PURE__*/jsx("div", {
|
160
|
+
className: className,
|
143
161
|
"data-val-path": root.valPath,
|
144
162
|
children: root.children.map(toReact)
|
145
163
|
});
|
146
164
|
}
|
147
165
|
|
148
|
-
export { ValRichText };
|
166
|
+
export { ValProvider, ValRichText };
|
@@ -2,21 +2,38 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var
|
5
|
+
var ValProviderInternal$1 = require('./ValProviderInternal-f1bbfabb.cjs.dev.js');
|
6
6
|
var React = require('react');
|
7
7
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
8
8
|
require('./slicedToArray-fb0bef7d.cjs.dev.js');
|
9
9
|
require('./defineProperty-c82a49b0.cjs.dev.js');
|
10
10
|
require('@valbuild/core/fp');
|
11
11
|
require('@valbuild/core');
|
12
|
+
require('./ValUI-a5ff7b4f.cjs.dev.js');
|
12
13
|
|
13
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
14
15
|
|
15
16
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
16
17
|
|
18
|
+
var ValProviderInternal = typeof window !== "undefined" ? /*#__PURE__*/React.lazy(function () {
|
19
|
+
return Promise.resolve().then(function () { return require('./ValProviderInternal-f1bbfabb.cjs.dev.js'); });
|
20
|
+
}) : null;
|
21
|
+
function ValProvider(_ref) {
|
22
|
+
var children = _ref.children;
|
23
|
+
if (ValProviderInternal) {
|
24
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx(ValProviderInternal, {
|
25
|
+
children: children
|
26
|
+
});
|
27
|
+
}
|
28
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
29
|
+
children: children
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
17
33
|
/* eslint-disable @typescript-eslint/ban-types */
|
18
34
|
function ValRichText(_ref) {
|
19
35
|
var theme = _ref.theme,
|
36
|
+
className = _ref.className,
|
20
37
|
children = _ref.children;
|
21
38
|
var root = children;
|
22
39
|
function withRenderTag(clazz, current) {
|
@@ -148,12 +165,13 @@ function ValRichText(_ref) {
|
|
148
165
|
});
|
149
166
|
}
|
150
167
|
return /*#__PURE__*/ReactJSXRuntime.jsx("div", {
|
168
|
+
className: className,
|
151
169
|
"data-val-path": root.valPath,
|
152
170
|
children: root.children.map(toReact)
|
153
171
|
});
|
154
172
|
}
|
155
173
|
|
156
|
-
exports.
|
157
|
-
exports.
|
158
|
-
exports.
|
174
|
+
exports.useValApi = ValProviderInternal$1.useValApi;
|
175
|
+
exports.useValStore = ValProviderInternal$1.useValStore;
|
176
|
+
exports.ValProvider = ValProvider;
|
159
177
|
exports.ValRichText = ValRichText;
|