@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
@@ -1,153 +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
|
-
var children = _ref.children;
|
7
|
-
return /*#__PURE__*/jsx(Fragment, {
|
8
|
-
children: children
|
9
|
-
});
|
10
|
-
}
|
11
|
-
|
12
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
13
|
-
function ValRichText(_ref) {
|
14
|
-
var theme = _ref.theme,
|
15
|
-
className = _ref.className,
|
16
|
-
children = _ref.children;
|
17
|
-
var root = children;
|
18
|
-
function withRenderTag(clazz, current) {
|
19
|
-
var renderClass = theme.tags[clazz];
|
20
|
-
if (renderClass && current) {
|
21
|
-
return [current, renderClass].join(" ");
|
22
|
-
}
|
23
|
-
if (renderClass) {
|
24
|
-
return renderClass;
|
25
|
-
}
|
26
|
-
return current;
|
27
|
-
}
|
28
|
-
function withRenderClass(clazz, current) {
|
29
|
-
var renderClass = theme.classes[clazz];
|
30
|
-
if (renderClass && current) {
|
31
|
-
return [current, renderClass].join(" ");
|
32
|
-
}
|
33
|
-
if (renderClass) {
|
34
|
-
return renderClass;
|
35
|
-
}
|
36
|
-
return current;
|
37
|
-
}
|
38
|
-
function toReact(node, key) {
|
39
|
-
var _anyNode$class, _anyNode$children;
|
40
|
-
if (typeof node === "string") {
|
41
|
-
return node;
|
42
|
-
}
|
43
|
-
if (node.tag === "p") {
|
44
|
-
return /*#__PURE__*/jsx("p", {
|
45
|
-
className: withRenderTag("p"),
|
46
|
-
children: node.children.map(toReact)
|
47
|
-
}, key);
|
48
|
-
}
|
49
|
-
if (node.tag === "img") {
|
50
|
-
return /*#__PURE__*/jsx("img", {
|
51
|
-
className: withRenderTag("img"),
|
52
|
-
src: node.src
|
53
|
-
}, key);
|
54
|
-
}
|
55
|
-
if (node.tag === "ul") {
|
56
|
-
return /*#__PURE__*/jsx("ul", {
|
57
|
-
className: withRenderTag("ul"),
|
58
|
-
children: node.children.map(toReact)
|
59
|
-
}, key);
|
60
|
-
}
|
61
|
-
if (node.tag === "ol") {
|
62
|
-
return /*#__PURE__*/jsx("ol", {
|
63
|
-
className: withRenderTag("ol"),
|
64
|
-
children: node.children.map(toReact)
|
65
|
-
}, key);
|
66
|
-
}
|
67
|
-
if (node.tag === "li") {
|
68
|
-
return /*#__PURE__*/jsx("li", {
|
69
|
-
className: withRenderTag("li"),
|
70
|
-
children: node.children.map(toReact)
|
71
|
-
}, key);
|
72
|
-
}
|
73
|
-
if (node.tag === "span") {
|
74
|
-
return /*#__PURE__*/jsx("span", {
|
75
|
-
className: node.classes.map(function (nodeClass) {
|
76
|
-
switch (nodeClass) {
|
77
|
-
case "bold":
|
78
|
-
return withRenderClass("bold");
|
79
|
-
case "line-through":
|
80
|
-
return withRenderClass("lineThrough");
|
81
|
-
case "italic":
|
82
|
-
return withRenderClass("italic");
|
83
|
-
}
|
84
|
-
}).join(" "),
|
85
|
-
children: node.children.map(toReact)
|
86
|
-
}, key);
|
87
|
-
}
|
88
|
-
if (node.tag === "h1") {
|
89
|
-
return /*#__PURE__*/jsx("h1", {
|
90
|
-
className: withRenderTag("h1"),
|
91
|
-
children: node.children.map(toReact)
|
92
|
-
}, key);
|
93
|
-
}
|
94
|
-
if (node.tag === "h2") {
|
95
|
-
return /*#__PURE__*/jsx("h2", {
|
96
|
-
className: withRenderTag("h2"),
|
97
|
-
children: node.children.map(toReact)
|
98
|
-
}, key);
|
99
|
-
}
|
100
|
-
if (node.tag === "h3") {
|
101
|
-
return /*#__PURE__*/jsx("h3", {
|
102
|
-
className: withRenderTag("h3"),
|
103
|
-
children: node.children.map(toReact)
|
104
|
-
}, key);
|
105
|
-
}
|
106
|
-
if (node.tag === "h4") {
|
107
|
-
return /*#__PURE__*/jsx("h4", {
|
108
|
-
className: withRenderTag("h4"),
|
109
|
-
children: node.children.map(toReact)
|
110
|
-
}, key);
|
111
|
-
}
|
112
|
-
if (node.tag === "h5") {
|
113
|
-
return /*#__PURE__*/jsx("h5", {
|
114
|
-
className: withRenderTag("h5"),
|
115
|
-
children: node.children.map(toReact)
|
116
|
-
}, key);
|
117
|
-
}
|
118
|
-
if (node.tag === "h6") {
|
119
|
-
return /*#__PURE__*/jsx("h6", {
|
120
|
-
className: withRenderTag("h6"),
|
121
|
-
children: node.children.map(toReact)
|
122
|
-
}, key);
|
123
|
-
}
|
124
|
-
if (node.tag === "br") {
|
125
|
-
return /*#__PURE__*/jsx("br", {}, key);
|
126
|
-
}
|
127
|
-
if (node.tag === "a") {
|
128
|
-
return /*#__PURE__*/jsx("a", {
|
129
|
-
href: node.href,
|
130
|
-
children: node.children.map(toReact)
|
131
|
-
}, key);
|
132
|
-
}
|
133
|
-
console.error("Unknown tag", node.tag);
|
134
|
-
var _exhaustiveCheck = node.tag;
|
135
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
136
|
-
var anyNode = _exhaustiveCheck;
|
137
|
-
if (!(anyNode !== null && anyNode !== void 0 && anyNode.tag)) {
|
138
|
-
return null;
|
139
|
-
}
|
140
|
-
return /*#__PURE__*/React.createElement(anyNode.tag, {
|
141
|
-
key: key,
|
142
|
-
className: (_anyNode$class = anyNode["class"]) === null || _anyNode$class === void 0 ? void 0 : _anyNode$class.join(" "),
|
143
|
-
children: (_anyNode$children = anyNode.children) === null || _anyNode$children === void 0 ? void 0 : _anyNode$children.map(toReact)
|
144
|
-
});
|
145
|
-
}
|
146
|
-
return /*#__PURE__*/jsx("div", {
|
147
|
-
className: className,
|
148
|
-
"data-val-path": root.valPath,
|
149
|
-
children: root.children.map(toReact)
|
150
|
-
});
|
151
|
-
}
|
152
|
-
|
153
|
-
export { ValProvider, ValRichText };
|
12
|
+
export { index as default };
|
@@ -0,0 +1,146 @@
|
|
1
|
+
export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-14179159.browser.esm.js';
|
2
|
+
import React from 'react';
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
4
|
+
|
5
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
6
|
+
function ValRichText(_ref) {
|
7
|
+
var theme = _ref.theme,
|
8
|
+
className = _ref.className,
|
9
|
+
children = _ref.children;
|
10
|
+
var root = children;
|
11
|
+
function withRenderTag(clazz, current) {
|
12
|
+
var renderClass = theme.tags[clazz];
|
13
|
+
if (renderClass && current) {
|
14
|
+
return [current, renderClass].join(" ");
|
15
|
+
}
|
16
|
+
if (renderClass) {
|
17
|
+
return renderClass;
|
18
|
+
}
|
19
|
+
return current;
|
20
|
+
}
|
21
|
+
function withRenderClass(clazz, current) {
|
22
|
+
var renderClass = theme.classes[clazz];
|
23
|
+
if (renderClass && current) {
|
24
|
+
return [current, renderClass].join(" ");
|
25
|
+
}
|
26
|
+
if (renderClass) {
|
27
|
+
return renderClass;
|
28
|
+
}
|
29
|
+
return current;
|
30
|
+
}
|
31
|
+
function toReact(node, key) {
|
32
|
+
var _anyNode$class, _anyNode$children;
|
33
|
+
if (typeof node === "string") {
|
34
|
+
return node;
|
35
|
+
}
|
36
|
+
if (node.tag === "p") {
|
37
|
+
return /*#__PURE__*/jsx("p", {
|
38
|
+
className: withRenderTag("p"),
|
39
|
+
children: node.children.map(toReact)
|
40
|
+
}, key);
|
41
|
+
}
|
42
|
+
if (node.tag === "img") {
|
43
|
+
return /*#__PURE__*/jsx("img", {
|
44
|
+
className: withRenderTag("img"),
|
45
|
+
src: node.src
|
46
|
+
}, key);
|
47
|
+
}
|
48
|
+
if (node.tag === "ul") {
|
49
|
+
return /*#__PURE__*/jsx("ul", {
|
50
|
+
className: withRenderTag("ul"),
|
51
|
+
children: node.children.map(toReact)
|
52
|
+
}, key);
|
53
|
+
}
|
54
|
+
if (node.tag === "ol") {
|
55
|
+
return /*#__PURE__*/jsx("ol", {
|
56
|
+
className: withRenderTag("ol"),
|
57
|
+
children: node.children.map(toReact)
|
58
|
+
}, key);
|
59
|
+
}
|
60
|
+
if (node.tag === "li") {
|
61
|
+
return /*#__PURE__*/jsx("li", {
|
62
|
+
className: withRenderTag("li"),
|
63
|
+
children: node.children.map(toReact)
|
64
|
+
}, key);
|
65
|
+
}
|
66
|
+
if (node.tag === "span") {
|
67
|
+
return /*#__PURE__*/jsx("span", {
|
68
|
+
className: node.classes.map(function (nodeClass) {
|
69
|
+
switch (nodeClass) {
|
70
|
+
case "bold":
|
71
|
+
return withRenderClass("bold");
|
72
|
+
case "line-through":
|
73
|
+
return withRenderClass("lineThrough");
|
74
|
+
case "italic":
|
75
|
+
return withRenderClass("italic");
|
76
|
+
}
|
77
|
+
}).join(" "),
|
78
|
+
children: node.children.map(toReact)
|
79
|
+
}, key);
|
80
|
+
}
|
81
|
+
if (node.tag === "h1") {
|
82
|
+
return /*#__PURE__*/jsx("h1", {
|
83
|
+
className: withRenderTag("h1"),
|
84
|
+
children: node.children.map(toReact)
|
85
|
+
}, key);
|
86
|
+
}
|
87
|
+
if (node.tag === "h2") {
|
88
|
+
return /*#__PURE__*/jsx("h2", {
|
89
|
+
className: withRenderTag("h2"),
|
90
|
+
children: node.children.map(toReact)
|
91
|
+
}, key);
|
92
|
+
}
|
93
|
+
if (node.tag === "h3") {
|
94
|
+
return /*#__PURE__*/jsx("h3", {
|
95
|
+
className: withRenderTag("h3"),
|
96
|
+
children: node.children.map(toReact)
|
97
|
+
}, key);
|
98
|
+
}
|
99
|
+
if (node.tag === "h4") {
|
100
|
+
return /*#__PURE__*/jsx("h4", {
|
101
|
+
className: withRenderTag("h4"),
|
102
|
+
children: node.children.map(toReact)
|
103
|
+
}, key);
|
104
|
+
}
|
105
|
+
if (node.tag === "h5") {
|
106
|
+
return /*#__PURE__*/jsx("h5", {
|
107
|
+
className: withRenderTag("h5"),
|
108
|
+
children: node.children.map(toReact)
|
109
|
+
}, key);
|
110
|
+
}
|
111
|
+
if (node.tag === "h6") {
|
112
|
+
return /*#__PURE__*/jsx("h6", {
|
113
|
+
className: withRenderTag("h6"),
|
114
|
+
children: node.children.map(toReact)
|
115
|
+
}, key);
|
116
|
+
}
|
117
|
+
if (node.tag === "br") {
|
118
|
+
return /*#__PURE__*/jsx("br", {}, key);
|
119
|
+
}
|
120
|
+
if (node.tag === "a") {
|
121
|
+
return /*#__PURE__*/jsx("a", {
|
122
|
+
href: node.href,
|
123
|
+
children: node.children.map(toReact)
|
124
|
+
}, key);
|
125
|
+
}
|
126
|
+
console.error("Unknown tag", node.tag);
|
127
|
+
var _exhaustiveCheck = node.tag;
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
129
|
+
var anyNode = _exhaustiveCheck;
|
130
|
+
if (!(anyNode !== null && anyNode !== void 0 && anyNode.tag)) {
|
131
|
+
return null;
|
132
|
+
}
|
133
|
+
return /*#__PURE__*/React.createElement(anyNode.tag, {
|
134
|
+
key: key,
|
135
|
+
className: (_anyNode$class = anyNode["class"]) === null || _anyNode$class === void 0 ? void 0 : _anyNode$class.join(" "),
|
136
|
+
children: (_anyNode$children = anyNode.children) === null || _anyNode$children === void 0 ? void 0 : _anyNode$children.map(toReact)
|
137
|
+
});
|
138
|
+
}
|
139
|
+
return /*#__PURE__*/jsx("div", {
|
140
|
+
className: className,
|
141
|
+
"data-val-path": root.valPath,
|
142
|
+
children: root.children.map(toReact)
|
143
|
+
});
|
144
|
+
}
|
145
|
+
|
146
|
+
export { ValRichText };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"valbuild-react-internal.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/internal/index.d.ts"],"names":[],"mappings":"AAAA"}
|
@@ -0,0 +1,166 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var ValProvider = require('../../dist/ValProvider-7513c6ec.cjs.dev.js');
|
6
|
+
var React = require('react');
|
7
|
+
var ReactJSXRuntime = require('react/jsx-runtime');
|
8
|
+
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
10
|
+
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
12
|
+
|
13
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
14
|
+
function ValRichText(_ref) {
|
15
|
+
var theme = _ref.theme,
|
16
|
+
className = _ref.className,
|
17
|
+
children = _ref.children;
|
18
|
+
var root = children;
|
19
|
+
function withRenderTag(clazz, current) {
|
20
|
+
var renderClass = theme.tags[clazz];
|
21
|
+
if (renderClass && current) {
|
22
|
+
return [current, renderClass].join(" ");
|
23
|
+
}
|
24
|
+
if (renderClass) {
|
25
|
+
return renderClass;
|
26
|
+
}
|
27
|
+
return current;
|
28
|
+
}
|
29
|
+
function withRenderClass(clazz, current) {
|
30
|
+
var renderClass = theme.classes[clazz];
|
31
|
+
if (renderClass && current) {
|
32
|
+
return [current, renderClass].join(" ");
|
33
|
+
}
|
34
|
+
if (renderClass) {
|
35
|
+
return renderClass;
|
36
|
+
}
|
37
|
+
return current;
|
38
|
+
}
|
39
|
+
function toReact(node, key) {
|
40
|
+
var _anyNode$class, _anyNode$children;
|
41
|
+
if (typeof node === "string") {
|
42
|
+
return node;
|
43
|
+
}
|
44
|
+
if (node.tag === "p") {
|
45
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("p", {
|
46
|
+
className: withRenderTag("p"),
|
47
|
+
children: node.children.map(toReact)
|
48
|
+
}, key);
|
49
|
+
}
|
50
|
+
if (node.tag === "img") {
|
51
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("img", {
|
52
|
+
className: withRenderTag("img"),
|
53
|
+
src: node.src
|
54
|
+
}, key);
|
55
|
+
}
|
56
|
+
if (node.tag === "ul") {
|
57
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("ul", {
|
58
|
+
className: withRenderTag("ul"),
|
59
|
+
children: node.children.map(toReact)
|
60
|
+
}, key);
|
61
|
+
}
|
62
|
+
if (node.tag === "ol") {
|
63
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("ol", {
|
64
|
+
className: withRenderTag("ol"),
|
65
|
+
children: node.children.map(toReact)
|
66
|
+
}, key);
|
67
|
+
}
|
68
|
+
if (node.tag === "li") {
|
69
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("li", {
|
70
|
+
className: withRenderTag("li"),
|
71
|
+
children: node.children.map(toReact)
|
72
|
+
}, key);
|
73
|
+
}
|
74
|
+
if (node.tag === "span") {
|
75
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("span", {
|
76
|
+
className: node.classes.map(function (nodeClass) {
|
77
|
+
switch (nodeClass) {
|
78
|
+
case "bold":
|
79
|
+
return withRenderClass("bold");
|
80
|
+
case "line-through":
|
81
|
+
return withRenderClass("lineThrough");
|
82
|
+
case "italic":
|
83
|
+
return withRenderClass("italic");
|
84
|
+
}
|
85
|
+
}).join(" "),
|
86
|
+
children: node.children.map(toReact)
|
87
|
+
}, key);
|
88
|
+
}
|
89
|
+
if (node.tag === "h1") {
|
90
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h1", {
|
91
|
+
className: withRenderTag("h1"),
|
92
|
+
children: node.children.map(toReact)
|
93
|
+
}, key);
|
94
|
+
}
|
95
|
+
if (node.tag === "h2") {
|
96
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h2", {
|
97
|
+
className: withRenderTag("h2"),
|
98
|
+
children: node.children.map(toReact)
|
99
|
+
}, key);
|
100
|
+
}
|
101
|
+
if (node.tag === "h3") {
|
102
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h3", {
|
103
|
+
className: withRenderTag("h3"),
|
104
|
+
children: node.children.map(toReact)
|
105
|
+
}, key);
|
106
|
+
}
|
107
|
+
if (node.tag === "h4") {
|
108
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h4", {
|
109
|
+
className: withRenderTag("h4"),
|
110
|
+
children: node.children.map(toReact)
|
111
|
+
}, key);
|
112
|
+
}
|
113
|
+
if (node.tag === "h5") {
|
114
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h5", {
|
115
|
+
className: withRenderTag("h5"),
|
116
|
+
children: node.children.map(toReact)
|
117
|
+
}, key);
|
118
|
+
}
|
119
|
+
if (node.tag === "h6") {
|
120
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h6", {
|
121
|
+
className: withRenderTag("h6"),
|
122
|
+
children: node.children.map(toReact)
|
123
|
+
}, key);
|
124
|
+
}
|
125
|
+
if (node.tag === "br") {
|
126
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("br", {}, key);
|
127
|
+
}
|
128
|
+
if (node.tag === "a") {
|
129
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("a", {
|
130
|
+
href: node.href,
|
131
|
+
children: node.children.map(toReact)
|
132
|
+
}, key);
|
133
|
+
}
|
134
|
+
console.error("Unknown tag", node.tag);
|
135
|
+
var _exhaustiveCheck = node.tag;
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
137
|
+
var anyNode = _exhaustiveCheck;
|
138
|
+
if (!(anyNode !== null && anyNode !== void 0 && anyNode.tag)) {
|
139
|
+
return null;
|
140
|
+
}
|
141
|
+
return /*#__PURE__*/React__default["default"].createElement(anyNode.tag, {
|
142
|
+
key: key,
|
143
|
+
className: (_anyNode$class = anyNode["class"]) === null || _anyNode$class === void 0 ? void 0 : _anyNode$class.join(" "),
|
144
|
+
children: (_anyNode$children = anyNode.children) === null || _anyNode$children === void 0 ? void 0 : _anyNode$children.map(toReact)
|
145
|
+
});
|
146
|
+
}
|
147
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("div", {
|
148
|
+
className: className,
|
149
|
+
"data-val-path": root.valPath,
|
150
|
+
children: root.children.map(toReact)
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
Object.defineProperty(exports, 'ValProvider', {
|
155
|
+
enumerable: true,
|
156
|
+
get: function () { return ValProvider.ValProvider; }
|
157
|
+
});
|
158
|
+
Object.defineProperty(exports, 'useValApi', {
|
159
|
+
enumerable: true,
|
160
|
+
get: function () { return ValProvider.useValApi; }
|
161
|
+
});
|
162
|
+
Object.defineProperty(exports, 'useValStore', {
|
163
|
+
enumerable: true,
|
164
|
+
get: function () { return ValProvider.useValStore; }
|
165
|
+
});
|
166
|
+
exports.ValRichText = ValRichText;
|
@@ -0,0 +1,166 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var ValProvider = require('../../dist/ValProvider-b2e83d12.cjs.prod.js');
|
6
|
+
var React = require('react');
|
7
|
+
var ReactJSXRuntime = require('react/jsx-runtime');
|
8
|
+
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
10
|
+
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
12
|
+
|
13
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
14
|
+
function ValRichText(_ref) {
|
15
|
+
var theme = _ref.theme,
|
16
|
+
className = _ref.className,
|
17
|
+
children = _ref.children;
|
18
|
+
var root = children;
|
19
|
+
function withRenderTag(clazz, current) {
|
20
|
+
var renderClass = theme.tags[clazz];
|
21
|
+
if (renderClass && current) {
|
22
|
+
return [current, renderClass].join(" ");
|
23
|
+
}
|
24
|
+
if (renderClass) {
|
25
|
+
return renderClass;
|
26
|
+
}
|
27
|
+
return current;
|
28
|
+
}
|
29
|
+
function withRenderClass(clazz, current) {
|
30
|
+
var renderClass = theme.classes[clazz];
|
31
|
+
if (renderClass && current) {
|
32
|
+
return [current, renderClass].join(" ");
|
33
|
+
}
|
34
|
+
if (renderClass) {
|
35
|
+
return renderClass;
|
36
|
+
}
|
37
|
+
return current;
|
38
|
+
}
|
39
|
+
function toReact(node, key) {
|
40
|
+
var _anyNode$class, _anyNode$children;
|
41
|
+
if (typeof node === "string") {
|
42
|
+
return node;
|
43
|
+
}
|
44
|
+
if (node.tag === "p") {
|
45
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("p", {
|
46
|
+
className: withRenderTag("p"),
|
47
|
+
children: node.children.map(toReact)
|
48
|
+
}, key);
|
49
|
+
}
|
50
|
+
if (node.tag === "img") {
|
51
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("img", {
|
52
|
+
className: withRenderTag("img"),
|
53
|
+
src: node.src
|
54
|
+
}, key);
|
55
|
+
}
|
56
|
+
if (node.tag === "ul") {
|
57
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("ul", {
|
58
|
+
className: withRenderTag("ul"),
|
59
|
+
children: node.children.map(toReact)
|
60
|
+
}, key);
|
61
|
+
}
|
62
|
+
if (node.tag === "ol") {
|
63
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("ol", {
|
64
|
+
className: withRenderTag("ol"),
|
65
|
+
children: node.children.map(toReact)
|
66
|
+
}, key);
|
67
|
+
}
|
68
|
+
if (node.tag === "li") {
|
69
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("li", {
|
70
|
+
className: withRenderTag("li"),
|
71
|
+
children: node.children.map(toReact)
|
72
|
+
}, key);
|
73
|
+
}
|
74
|
+
if (node.tag === "span") {
|
75
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("span", {
|
76
|
+
className: node.classes.map(function (nodeClass) {
|
77
|
+
switch (nodeClass) {
|
78
|
+
case "bold":
|
79
|
+
return withRenderClass("bold");
|
80
|
+
case "line-through":
|
81
|
+
return withRenderClass("lineThrough");
|
82
|
+
case "italic":
|
83
|
+
return withRenderClass("italic");
|
84
|
+
}
|
85
|
+
}).join(" "),
|
86
|
+
children: node.children.map(toReact)
|
87
|
+
}, key);
|
88
|
+
}
|
89
|
+
if (node.tag === "h1") {
|
90
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h1", {
|
91
|
+
className: withRenderTag("h1"),
|
92
|
+
children: node.children.map(toReact)
|
93
|
+
}, key);
|
94
|
+
}
|
95
|
+
if (node.tag === "h2") {
|
96
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h2", {
|
97
|
+
className: withRenderTag("h2"),
|
98
|
+
children: node.children.map(toReact)
|
99
|
+
}, key);
|
100
|
+
}
|
101
|
+
if (node.tag === "h3") {
|
102
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h3", {
|
103
|
+
className: withRenderTag("h3"),
|
104
|
+
children: node.children.map(toReact)
|
105
|
+
}, key);
|
106
|
+
}
|
107
|
+
if (node.tag === "h4") {
|
108
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h4", {
|
109
|
+
className: withRenderTag("h4"),
|
110
|
+
children: node.children.map(toReact)
|
111
|
+
}, key);
|
112
|
+
}
|
113
|
+
if (node.tag === "h5") {
|
114
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h5", {
|
115
|
+
className: withRenderTag("h5"),
|
116
|
+
children: node.children.map(toReact)
|
117
|
+
}, key);
|
118
|
+
}
|
119
|
+
if (node.tag === "h6") {
|
120
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("h6", {
|
121
|
+
className: withRenderTag("h6"),
|
122
|
+
children: node.children.map(toReact)
|
123
|
+
}, key);
|
124
|
+
}
|
125
|
+
if (node.tag === "br") {
|
126
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("br", {}, key);
|
127
|
+
}
|
128
|
+
if (node.tag === "a") {
|
129
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("a", {
|
130
|
+
href: node.href,
|
131
|
+
children: node.children.map(toReact)
|
132
|
+
}, key);
|
133
|
+
}
|
134
|
+
console.error("Unknown tag", node.tag);
|
135
|
+
var _exhaustiveCheck = node.tag;
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
137
|
+
var anyNode = _exhaustiveCheck;
|
138
|
+
if (!(anyNode !== null && anyNode !== void 0 && anyNode.tag)) {
|
139
|
+
return null;
|
140
|
+
}
|
141
|
+
return /*#__PURE__*/React__default["default"].createElement(anyNode.tag, {
|
142
|
+
key: key,
|
143
|
+
className: (_anyNode$class = anyNode["class"]) === null || _anyNode$class === void 0 ? void 0 : _anyNode$class.join(" "),
|
144
|
+
children: (_anyNode$children = anyNode.children) === null || _anyNode$children === void 0 ? void 0 : _anyNode$children.map(toReact)
|
145
|
+
});
|
146
|
+
}
|
147
|
+
return /*#__PURE__*/ReactJSXRuntime.jsx("div", {
|
148
|
+
className: className,
|
149
|
+
"data-val-path": root.valPath,
|
150
|
+
children: root.children.map(toReact)
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
Object.defineProperty(exports, 'ValProvider', {
|
155
|
+
enumerable: true,
|
156
|
+
get: function () { return ValProvider.ValProvider; }
|
157
|
+
});
|
158
|
+
Object.defineProperty(exports, 'useValApi', {
|
159
|
+
enumerable: true,
|
160
|
+
get: function () { return ValProvider.useValApi; }
|
161
|
+
});
|
162
|
+
Object.defineProperty(exports, 'useValStore', {
|
163
|
+
enumerable: true,
|
164
|
+
get: function () { return ValProvider.useValStore; }
|
165
|
+
});
|
166
|
+
exports.ValRichText = ValRichText;
|