@valbuild/react 0.30.0 → 0.32.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/{ValProviderInternal-06aa7448.esm.js → ValProvider-0620664e.esm.js} +68 -17
- package/dist/{ValProviderInternal-4c19d576.browser.esm.js → ValProvider-14179159.browser.esm.js} +67 -16
- package/dist/{ValProviderInternal-2faf106c.cjs.dev.js → ValProvider-7513c6ec.cjs.dev.js} +85 -17
- package/dist/ValProvider-b2e83d12.cjs.js +7 -0
- package/dist/{ValProviderInternal-172144ad.cjs.prod.js → ValProvider-b2e83d12.cjs.prod.js} +85 -17
- package/dist/{ValProviderInternal-5a5100ab.worker.esm.js → ValProvider-d46ec16a.worker.esm.js} +67 -21
- package/dist/{ValUI-ab7ef83f.cjs.dev.js → ValUI-33562b10.cjs.dev.js} +5 -43
- package/dist/{ValUI-b8544437.worker.esm.js → ValUI-3b9f6c17.worker.esm.js} +4 -42
- package/dist/{ValUI-9a231a97.esm.js → ValUI-4ba5efea.esm.js} +4 -42
- package/dist/{ValUI-697700f4.browser.esm.js → ValUI-75338157.browser.esm.js} +4 -42
- package/dist/ValUI-8ea90ec3.cjs.js +7 -0
- package/dist/{ValUI-46395962.cjs.prod.js → ValUI-8ea90ec3.cjs.prod.js} +5 -43
- package/dist/declarations/src/index.d.ts +11 -3
- package/dist/declarations/src/internal/ValProvider.d.ts +16 -0
- package/dist/declarations/src/internal/index.d.ts +2 -0
- package/dist/declarations/src/stega/stegaEncode.d.ts +1 -1
- package/dist/valbuild-react.browser.esm.js +11 -160
- package/dist/valbuild-react.cjs.d.ts +1 -0
- package/dist/valbuild-react.cjs.dev.js +12 -192
- package/dist/valbuild-react.cjs.prod.js +12 -192
- package/dist/valbuild-react.esm.js +11 -160
- package/dist/valbuild-react.worker.esm.js +11 -152
- package/internal/dist/valbuild-react-internal.browser.esm.js +146 -0
- package/internal/dist/valbuild-react-internal.cjs.d.ts +2 -0
- package/internal/dist/valbuild-react-internal.cjs.d.ts.map +1 -0
- package/internal/dist/valbuild-react-internal.cjs.dev.js +166 -0
- package/internal/dist/valbuild-react-internal.cjs.js +7 -0
- package/internal/dist/valbuild-react-internal.cjs.prod.js +166 -0
- package/internal/dist/valbuild-react-internal.esm.js +146 -0
- package/internal/dist/valbuild-react-internal.worker.esm.js +146 -0
- package/internal/package.json +7 -0
- package/package.json +15 -5
- package/dist/ValProviderInternal-172144ad.cjs.js +0 -7
- package/dist/ValUI-46395962.cjs.js +0 -7
- package/dist/declarations/src/ValProvider.d.ts +0 -3
- package/dist/declarations/src/ValProviderInternal.d.ts +0 -15
- /package/dist/declarations/src/{ValRichText.d.ts → internal/ValRichText.d.ts} +0 -0
- /package/dist/declarations/src/{ValStore.d.ts → internal/ValStore.d.ts} +0 -0
@@ -3,13 +3,12 @@
|
|
3
3
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
5
5
|
|
6
|
-
var slicedToArray = require('./slicedToArray-a9d0d9cd.cjs.dev.js');
|
7
|
-
var core = require('@valbuild/core');
|
8
6
|
var ui = require('@valbuild/ui');
|
7
|
+
var slicedToArray = require('./slicedToArray-a9d0d9cd.cjs.dev.js');
|
9
8
|
var React = require('react');
|
10
9
|
var reactDom = require('react-dom');
|
11
10
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
12
|
-
var
|
11
|
+
var ValProvider = require('./ValProvider-7513c6ec.cjs.dev.js');
|
13
12
|
|
14
13
|
function ShadowContent(_ref) {
|
15
14
|
var root = _ref.root,
|
@@ -48,46 +47,9 @@ var ShadowRoot = function ShadowRoot(_ref2) {
|
|
48
47
|
};
|
49
48
|
|
50
49
|
function ValUI() {
|
51
|
-
var
|
52
|
-
|
53
|
-
|
54
|
-
setIsClient = _useState2[1];
|
55
|
-
var _useState3 = React.useState(false),
|
56
|
-
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
57
|
-
enabled = _useState4[0],
|
58
|
-
setEnabled = _useState4[1];
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
60
|
-
var _useState5 = React.useState(false),
|
61
|
-
_useState6 = slicedToArray._slicedToArray(_useState5, 2);
|
62
|
-
_useState6[0];
|
63
|
-
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
64
|
-
var api = ValProviderInternal.useValApi();
|
65
|
-
var store = ValProviderInternal.useValStore();
|
66
|
-
React.useEffect(function () {
|
67
|
-
setIsClient(true);
|
68
|
-
try {
|
69
|
-
var _document$cookie;
|
70
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
71
|
-
setEnabled(valEnabled);
|
72
|
-
} catch (e) {
|
73
|
-
console.warn("Could not read Val enabled state", e);
|
74
|
-
}
|
75
|
-
try {
|
76
|
-
var _document$cookie2;
|
77
|
-
var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
|
78
|
-
setDraftMode(valDraftMode);
|
79
|
-
} catch (e) {
|
80
|
-
console.warn("Could not read Val draft mode", e);
|
81
|
-
}
|
82
|
-
}, []);
|
83
|
-
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
84
|
-
if (!api) {
|
85
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
86
|
-
} else {
|
87
|
-
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."));
|
88
|
-
}
|
89
|
-
}
|
90
|
-
if (!isClient || !enabled || !store || !api) {
|
50
|
+
var api = ValProvider.useValApi();
|
51
|
+
var store = ValProvider.useValStore();
|
52
|
+
if (!api || !store) {
|
91
53
|
return null;
|
92
54
|
}
|
93
55
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
@@ -1,11 +1,10 @@
|
|
1
1
|
'use client';
|
2
|
-
import { _ as _slicedToArray } from './slicedToArray-d4c4a4ed.worker.esm.js';
|
3
|
-
import { Internal } from '@valbuild/core';
|
4
2
|
import { Style, ValOverlay } from '@valbuild/ui';
|
5
|
-
import {
|
3
|
+
import { _ as _slicedToArray } from './slicedToArray-d4c4a4ed.worker.esm.js';
|
4
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
6
5
|
import { createPortal } from 'react-dom';
|
7
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import { useValApi, useValStore } from './
|
7
|
+
import { useValApi, useValStore } from './ValProvider-d46ec16a.worker.esm.js';
|
9
8
|
|
10
9
|
function ShadowContent(_ref) {
|
11
10
|
var root = _ref.root,
|
@@ -44,46 +43,9 @@ var ShadowRoot = function ShadowRoot(_ref2) {
|
|
44
43
|
};
|
45
44
|
|
46
45
|
function ValUI() {
|
47
|
-
var _useState = useState(false),
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
49
|
-
isClient = _useState2[0],
|
50
|
-
setIsClient = _useState2[1];
|
51
|
-
var _useState3 = useState(false),
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
53
|
-
enabled = _useState4[0],
|
54
|
-
setEnabled = _useState4[1];
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
56
|
-
var _useState5 = useState(false),
|
57
|
-
_useState6 = _slicedToArray(_useState5, 2);
|
58
|
-
_useState6[0];
|
59
|
-
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
60
46
|
var api = useValApi();
|
61
47
|
var store = useValStore();
|
62
|
-
|
63
|
-
setIsClient(true);
|
64
|
-
try {
|
65
|
-
var _document$cookie;
|
66
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
67
|
-
setEnabled(valEnabled);
|
68
|
-
} catch (e) {
|
69
|
-
console.warn("Could not read Val enabled state", e);
|
70
|
-
}
|
71
|
-
try {
|
72
|
-
var _document$cookie2;
|
73
|
-
var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
|
74
|
-
setDraftMode(valDraftMode);
|
75
|
-
} catch (e) {
|
76
|
-
console.warn("Could not read Val draft mode", e);
|
77
|
-
}
|
78
|
-
}, []);
|
79
|
-
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
80
|
-
if (!api) {
|
81
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
82
|
-
} else {
|
83
|
-
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."));
|
84
|
-
}
|
85
|
-
}
|
86
|
-
if (!isClient || !enabled || !store || !api) {
|
48
|
+
if (!api || !store) {
|
87
49
|
return null;
|
88
50
|
}
|
89
51
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -1,11 +1,10 @@
|
|
1
1
|
'use client';
|
2
|
-
import { _ as _slicedToArray } from './slicedToArray-331bebbb.esm.js';
|
3
|
-
import { Internal } from '@valbuild/core';
|
4
2
|
import { Style, ValOverlay } from '@valbuild/ui';
|
5
|
-
import {
|
3
|
+
import { _ as _slicedToArray } from './slicedToArray-331bebbb.esm.js';
|
4
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
6
5
|
import { createPortal } from 'react-dom';
|
7
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import { useValApi, useValStore } from './
|
7
|
+
import { useValApi, useValStore } from './ValProvider-0620664e.esm.js';
|
9
8
|
|
10
9
|
function ShadowContent(_ref) {
|
11
10
|
var root = _ref.root,
|
@@ -44,46 +43,9 @@ var ShadowRoot = function ShadowRoot(_ref2) {
|
|
44
43
|
};
|
45
44
|
|
46
45
|
function ValUI() {
|
47
|
-
var _useState = useState(false),
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
49
|
-
isClient = _useState2[0],
|
50
|
-
setIsClient = _useState2[1];
|
51
|
-
var _useState3 = useState(false),
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
53
|
-
enabled = _useState4[0],
|
54
|
-
setEnabled = _useState4[1];
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
56
|
-
var _useState5 = useState(false),
|
57
|
-
_useState6 = _slicedToArray(_useState5, 2);
|
58
|
-
_useState6[0];
|
59
|
-
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
60
46
|
var api = useValApi();
|
61
47
|
var store = useValStore();
|
62
|
-
|
63
|
-
setIsClient(true);
|
64
|
-
try {
|
65
|
-
var _document$cookie;
|
66
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
67
|
-
setEnabled(valEnabled);
|
68
|
-
} catch (e) {
|
69
|
-
console.warn("Could not read Val enabled state", e);
|
70
|
-
}
|
71
|
-
try {
|
72
|
-
var _document$cookie2;
|
73
|
-
var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
|
74
|
-
setDraftMode(valDraftMode);
|
75
|
-
} catch (e) {
|
76
|
-
console.warn("Could not read Val draft mode", e);
|
77
|
-
}
|
78
|
-
}, []);
|
79
|
-
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
80
|
-
if (!api) {
|
81
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
82
|
-
} else {
|
83
|
-
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."));
|
84
|
-
}
|
85
|
-
}
|
86
|
-
if (!isClient || !enabled || !store || !api) {
|
48
|
+
if (!api || !store) {
|
87
49
|
return null;
|
88
50
|
}
|
89
51
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -1,11 +1,10 @@
|
|
1
1
|
'use client';
|
2
|
-
import { _ as _slicedToArray } from './slicedToArray-85f6bb43.browser.esm.js';
|
3
|
-
import { Internal } from '@valbuild/core';
|
4
2
|
import { Style, ValOverlay } from '@valbuild/ui';
|
5
|
-
import {
|
3
|
+
import { _ as _slicedToArray } from './slicedToArray-85f6bb43.browser.esm.js';
|
4
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
6
5
|
import { createPortal } from 'react-dom';
|
7
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
8
|
-
import { useValApi, useValStore } from './
|
7
|
+
import { useValApi, useValStore } from './ValProvider-14179159.browser.esm.js';
|
9
8
|
|
10
9
|
function ShadowContent(_ref) {
|
11
10
|
var root = _ref.root,
|
@@ -44,46 +43,9 @@ var ShadowRoot = function ShadowRoot(_ref2) {
|
|
44
43
|
};
|
45
44
|
|
46
45
|
function ValUI() {
|
47
|
-
var _useState = useState(false),
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
49
|
-
isClient = _useState2[0],
|
50
|
-
setIsClient = _useState2[1];
|
51
|
-
var _useState3 = useState(false),
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
53
|
-
enabled = _useState4[0],
|
54
|
-
setEnabled = _useState4[1];
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
56
|
-
var _useState5 = useState(false),
|
57
|
-
_useState6 = _slicedToArray(_useState5, 2);
|
58
|
-
_useState6[0];
|
59
|
-
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
60
46
|
var api = useValApi();
|
61
47
|
var store = useValStore();
|
62
|
-
|
63
|
-
setIsClient(true);
|
64
|
-
try {
|
65
|
-
var _document$cookie;
|
66
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
67
|
-
setEnabled(valEnabled);
|
68
|
-
} catch (e) {
|
69
|
-
console.warn("Could not read Val enabled state", e);
|
70
|
-
}
|
71
|
-
try {
|
72
|
-
var _document$cookie2;
|
73
|
-
var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
|
74
|
-
setDraftMode(valDraftMode);
|
75
|
-
} catch (e) {
|
76
|
-
console.warn("Could not read Val draft mode", e);
|
77
|
-
}
|
78
|
-
}, []);
|
79
|
-
if (isClient && !enabled && process.env.NODE_ENV === "development") {
|
80
|
-
if (!api) {
|
81
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
82
|
-
} else {
|
83
|
-
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."));
|
84
|
-
}
|
85
|
-
}
|
86
|
-
if (!isClient || !enabled || !store || !api) {
|
48
|
+
if (!api || !store) {
|
87
49
|
return null;
|
88
50
|
}
|
89
51
|
return /*#__PURE__*/jsx(Fragment, {
|
@@ -3,13 +3,12 @@
|
|
3
3
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
5
5
|
|
6
|
-
var slicedToArray = require('./slicedToArray-a2a426c7.cjs.prod.js');
|
7
|
-
var core = require('@valbuild/core');
|
8
6
|
var ui = require('@valbuild/ui');
|
7
|
+
var slicedToArray = require('./slicedToArray-a2a426c7.cjs.prod.js');
|
9
8
|
var React = require('react');
|
10
9
|
var reactDom = require('react-dom');
|
11
10
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
12
|
-
var
|
11
|
+
var ValProvider = require('./ValProvider-b2e83d12.cjs.prod.js');
|
13
12
|
|
14
13
|
function ShadowContent(_ref) {
|
15
14
|
var root = _ref.root,
|
@@ -48,46 +47,9 @@ var ShadowRoot = function ShadowRoot(_ref2) {
|
|
48
47
|
};
|
49
48
|
|
50
49
|
function ValUI() {
|
51
|
-
var
|
52
|
-
|
53
|
-
|
54
|
-
setIsClient = _useState2[1];
|
55
|
-
var _useState3 = React.useState(false),
|
56
|
-
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
57
|
-
enabled = _useState4[0],
|
58
|
-
setEnabled = _useState4[1];
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
60
|
-
var _useState5 = React.useState(false),
|
61
|
-
_useState6 = slicedToArray._slicedToArray(_useState5, 2);
|
62
|
-
_useState6[0];
|
63
|
-
var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
|
64
|
-
var api = ValProviderInternal.useValApi();
|
65
|
-
var store = ValProviderInternal.useValStore();
|
66
|
-
React.useEffect(function () {
|
67
|
-
setIsClient(true);
|
68
|
-
try {
|
69
|
-
var _document$cookie;
|
70
|
-
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
71
|
-
setEnabled(valEnabled);
|
72
|
-
} catch (e) {
|
73
|
-
console.warn("Could not read Val enabled state", e);
|
74
|
-
}
|
75
|
-
try {
|
76
|
-
var _document$cookie2;
|
77
|
-
var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
|
78
|
-
setDraftMode(valDraftMode);
|
79
|
-
} catch (e) {
|
80
|
-
console.warn("Could not read Val draft mode", e);
|
81
|
-
}
|
82
|
-
}, []);
|
83
|
-
if (isClient && !enabled && "production" === "development") {
|
84
|
-
if (!api) {
|
85
|
-
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
86
|
-
} else {
|
87
|
-
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."));
|
88
|
-
}
|
89
|
-
}
|
90
|
-
if (!isClient || !enabled || !store || !api) {
|
50
|
+
var api = ValProvider.useValApi();
|
51
|
+
var store = ValProvider.useValStore();
|
52
|
+
if (!api || !store) {
|
91
53
|
return null;
|
92
54
|
}
|
93
55
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
@@ -1,3 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/**
|
2
|
+
* Val React **internal** bindings.
|
3
|
+
*
|
4
|
+
* @remarks
|
5
|
+
* This package includes only internal entry points and is used only by internal packages.
|
6
|
+
* Use the valbuild package corresponding to your meta-framework instead of this package.
|
7
|
+
*
|
8
|
+
* @packageDocumentation
|
9
|
+
*/
|
10
|
+
declare const _default: {};
|
11
|
+
export default _default;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { ValStore } from "./ValStore.js";
|
3
|
+
import { ValApi } from "@valbuild/core";
|
4
|
+
export declare const useValStore: () => ValStore | undefined;
|
5
|
+
export type UseValStore = typeof useValStore;
|
6
|
+
export declare const useValApi: () => ValApi | undefined;
|
7
|
+
export type UseValApi = typeof useValApi;
|
8
|
+
export type ValContext = {
|
9
|
+
readonly valStore?: ValStore;
|
10
|
+
readonly valApi?: ValApi;
|
11
|
+
};
|
12
|
+
export declare const ValContext: React.Context<ValContext> | undefined;
|
13
|
+
export type ValProviderProps = {
|
14
|
+
children?: React.ReactNode;
|
15
|
+
};
|
16
|
+
export declare function ValProvider({ children }: ValProviderProps): JSX.Element;
|
@@ -2,7 +2,7 @@ import { Json, RichTextSource, RichText } from "@valbuild/core";
|
|
2
2
|
import { FileSource, Source, SourceObject } from "@valbuild/core";
|
3
3
|
import { JsonPrimitive } from "@valbuild/core";
|
4
4
|
import { SourceArray } from "@valbuild/core";
|
5
|
-
import { RawString } from "@valbuild/core
|
5
|
+
import { RawString } from "@valbuild/core";
|
6
6
|
declare const brand: unique symbol;
|
7
7
|
/**
|
8
8
|
* ValEncodedString is a string that is encoded using steganography.
|
@@ -1,161 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/**
|
2
|
+
* Val React **internal** bindings.
|
3
|
+
*
|
4
|
+
* @remarks
|
5
|
+
* This package includes only internal entry points and is used only by internal packages.
|
6
|
+
* Use the valbuild package corresponding to your meta-framework instead of this package.
|
7
|
+
*
|
8
|
+
* @packageDocumentation
|
9
|
+
*/
|
10
|
+
var index = {};
|
4
11
|
|
5
|
-
|
6
|
-
return import('./ValProviderInternal-4c19d576.browser.esm.js');
|
7
|
-
}) ;
|
8
|
-
function ValProvider(_ref) {
|
9
|
-
var children = _ref.children;
|
10
|
-
if (ValProviderInternal) {
|
11
|
-
return /*#__PURE__*/jsx(ValProviderInternal, {
|
12
|
-
children: children
|
13
|
-
});
|
14
|
-
}
|
15
|
-
return /*#__PURE__*/jsx(Fragment, {
|
16
|
-
children: children
|
17
|
-
});
|
18
|
-
}
|
19
|
-
|
20
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
21
|
-
function ValRichText(_ref) {
|
22
|
-
var theme = _ref.theme,
|
23
|
-
className = _ref.className,
|
24
|
-
children = _ref.children;
|
25
|
-
var root = children;
|
26
|
-
function withRenderTag(clazz, current) {
|
27
|
-
var renderClass = theme.tags[clazz];
|
28
|
-
if (renderClass && current) {
|
29
|
-
return [current, renderClass].join(" ");
|
30
|
-
}
|
31
|
-
if (renderClass) {
|
32
|
-
return renderClass;
|
33
|
-
}
|
34
|
-
return current;
|
35
|
-
}
|
36
|
-
function withRenderClass(clazz, current) {
|
37
|
-
var renderClass = theme.classes[clazz];
|
38
|
-
if (renderClass && current) {
|
39
|
-
return [current, renderClass].join(" ");
|
40
|
-
}
|
41
|
-
if (renderClass) {
|
42
|
-
return renderClass;
|
43
|
-
}
|
44
|
-
return current;
|
45
|
-
}
|
46
|
-
function toReact(node, key) {
|
47
|
-
var _anyNode$class, _anyNode$children;
|
48
|
-
if (typeof node === "string") {
|
49
|
-
return node;
|
50
|
-
}
|
51
|
-
if (node.tag === "p") {
|
52
|
-
return /*#__PURE__*/jsx("p", {
|
53
|
-
className: withRenderTag("p"),
|
54
|
-
children: node.children.map(toReact)
|
55
|
-
}, key);
|
56
|
-
}
|
57
|
-
if (node.tag === "img") {
|
58
|
-
return /*#__PURE__*/jsx("img", {
|
59
|
-
className: withRenderTag("img"),
|
60
|
-
src: node.src
|
61
|
-
}, key);
|
62
|
-
}
|
63
|
-
if (node.tag === "ul") {
|
64
|
-
return /*#__PURE__*/jsx("ul", {
|
65
|
-
className: withRenderTag("ul"),
|
66
|
-
children: node.children.map(toReact)
|
67
|
-
}, key);
|
68
|
-
}
|
69
|
-
if (node.tag === "ol") {
|
70
|
-
return /*#__PURE__*/jsx("ol", {
|
71
|
-
className: withRenderTag("ol"),
|
72
|
-
children: node.children.map(toReact)
|
73
|
-
}, key);
|
74
|
-
}
|
75
|
-
if (node.tag === "li") {
|
76
|
-
return /*#__PURE__*/jsx("li", {
|
77
|
-
className: withRenderTag("li"),
|
78
|
-
children: node.children.map(toReact)
|
79
|
-
}, key);
|
80
|
-
}
|
81
|
-
if (node.tag === "span") {
|
82
|
-
return /*#__PURE__*/jsx("span", {
|
83
|
-
className: node.classes.map(function (nodeClass) {
|
84
|
-
switch (nodeClass) {
|
85
|
-
case "bold":
|
86
|
-
return withRenderClass("bold");
|
87
|
-
case "line-through":
|
88
|
-
return withRenderClass("lineThrough");
|
89
|
-
case "italic":
|
90
|
-
return withRenderClass("italic");
|
91
|
-
}
|
92
|
-
}).join(" "),
|
93
|
-
children: node.children.map(toReact)
|
94
|
-
}, key);
|
95
|
-
}
|
96
|
-
if (node.tag === "h1") {
|
97
|
-
return /*#__PURE__*/jsx("h1", {
|
98
|
-
className: withRenderTag("h1"),
|
99
|
-
children: node.children.map(toReact)
|
100
|
-
}, key);
|
101
|
-
}
|
102
|
-
if (node.tag === "h2") {
|
103
|
-
return /*#__PURE__*/jsx("h2", {
|
104
|
-
className: withRenderTag("h2"),
|
105
|
-
children: node.children.map(toReact)
|
106
|
-
}, key);
|
107
|
-
}
|
108
|
-
if (node.tag === "h3") {
|
109
|
-
return /*#__PURE__*/jsx("h3", {
|
110
|
-
className: withRenderTag("h3"),
|
111
|
-
children: node.children.map(toReact)
|
112
|
-
}, key);
|
113
|
-
}
|
114
|
-
if (node.tag === "h4") {
|
115
|
-
return /*#__PURE__*/jsx("h4", {
|
116
|
-
className: withRenderTag("h4"),
|
117
|
-
children: node.children.map(toReact)
|
118
|
-
}, key);
|
119
|
-
}
|
120
|
-
if (node.tag === "h5") {
|
121
|
-
return /*#__PURE__*/jsx("h5", {
|
122
|
-
className: withRenderTag("h5"),
|
123
|
-
children: node.children.map(toReact)
|
124
|
-
}, key);
|
125
|
-
}
|
126
|
-
if (node.tag === "h6") {
|
127
|
-
return /*#__PURE__*/jsx("h6", {
|
128
|
-
className: withRenderTag("h6"),
|
129
|
-
children: node.children.map(toReact)
|
130
|
-
}, key);
|
131
|
-
}
|
132
|
-
if (node.tag === "br") {
|
133
|
-
return /*#__PURE__*/jsx("br", {}, key);
|
134
|
-
}
|
135
|
-
if (node.tag === "a") {
|
136
|
-
return /*#__PURE__*/jsx("a", {
|
137
|
-
href: node.href,
|
138
|
-
children: node.children.map(toReact)
|
139
|
-
}, key);
|
140
|
-
}
|
141
|
-
console.error("Unknown tag", node.tag);
|
142
|
-
var _exhaustiveCheck = node.tag;
|
143
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
144
|
-
var anyNode = _exhaustiveCheck;
|
145
|
-
if (!(anyNode !== null && anyNode !== void 0 && anyNode.tag)) {
|
146
|
-
return null;
|
147
|
-
}
|
148
|
-
return /*#__PURE__*/React.createElement(anyNode.tag, {
|
149
|
-
key: key,
|
150
|
-
className: (_anyNode$class = anyNode["class"]) === null || _anyNode$class === void 0 ? void 0 : _anyNode$class.join(" "),
|
151
|
-
children: (_anyNode$children = anyNode.children) === null || _anyNode$children === void 0 ? void 0 : _anyNode$children.map(toReact)
|
152
|
-
});
|
153
|
-
}
|
154
|
-
return /*#__PURE__*/jsx("div", {
|
155
|
-
className: className,
|
156
|
-
"data-val-path": root.valPath,
|
157
|
-
children: root.children.map(toReact)
|
158
|
-
});
|
159
|
-
}
|
160
|
-
|
161
|
-
export { ValProvider, ValRichText };
|
12
|
+
export { index as default };
|