@valbuild/react 0.57.0 → 0.58.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 (46) hide show
  1. package/dist/{ValProvider-8ec03a73.esm.js → ValProvider-47b779dc.esm.js} +3 -2
  2. package/dist/{ValProvider-6a12fd8e.browser.esm.js → ValProvider-48e6e607.browser.esm.js} +3 -2
  3. package/dist/ValProvider-5b6a05e9.cjs.js +7 -0
  4. package/dist/{ValProvider-c7d7067b.cjs.prod.js → ValProvider-5b6a05e9.cjs.prod.js} +4 -3
  5. package/dist/{ValProvider-ecf57703.worker.esm.js → ValProvider-7c2a7439.worker.esm.js} +3 -2
  6. package/dist/{ValProvider-1009cb51.cjs.dev.js → ValProvider-87161e66.cjs.dev.js} +4 -3
  7. package/dist/{ValUI-891df000.cjs.dev.js → ValUI-1922d8db.cjs.dev.js} +3 -2
  8. package/dist/ValUI-23e2422b.cjs.js +7 -0
  9. package/dist/{ValUI-323cc3ff.cjs.prod.js → ValUI-23e2422b.cjs.prod.js} +3 -2
  10. package/dist/{ValUI-b82ca977.browser.esm.js → ValUI-7d39a3f6.browser.esm.js} +3 -2
  11. package/dist/{ValUI-29f95099.worker.esm.js → ValUI-84a9cc93.worker.esm.js} +3 -2
  12. package/dist/{ValUI-04c66635.esm.js → ValUI-8775ef5c.esm.js} +3 -2
  13. package/dist/declarations/src/internal/ValRichText.d.ts +67 -14
  14. package/dist/{slicedToArray-a9d0d9cd.cjs.dev.js → slicedToArray-11a666de.cjs.dev.js} +3 -17
  15. package/dist/{slicedToArray-331bebbb.esm.js → slicedToArray-1dc7d2d6.esm.js} +3 -16
  16. package/dist/{slicedToArray-d4c4a4ed.worker.esm.js → slicedToArray-7b69258f.browser.esm.js} +3 -16
  17. package/dist/{slicedToArray-a2a426c7.cjs.prod.js → slicedToArray-c405fbf0.cjs.prod.js} +3 -17
  18. package/dist/{slicedToArray-85f6bb43.browser.esm.js → slicedToArray-e7da2c5e.worker.esm.js} +3 -16
  19. package/dist/unsupportedIterableToArray-42309462.cjs.prod.js +19 -0
  20. package/dist/unsupportedIterableToArray-50359a05.worker.esm.js +16 -0
  21. package/dist/unsupportedIterableToArray-7c30dadf.esm.js +16 -0
  22. package/dist/unsupportedIterableToArray-ac28611a.cjs.dev.js +19 -0
  23. package/dist/unsupportedIterableToArray-cce3cb41.browser.esm.js +16 -0
  24. package/internal/dist/valbuild-react-internal.browser.esm.js +110 -131
  25. package/internal/dist/valbuild-react-internal.cjs.dev.js +110 -131
  26. package/internal/dist/valbuild-react-internal.cjs.prod.js +110 -131
  27. package/internal/dist/valbuild-react-internal.esm.js +110 -131
  28. package/internal/dist/valbuild-react-internal.worker.esm.js +110 -131
  29. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +2 -1
  30. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +2 -1
  31. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +2 -1
  32. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +2 -1
  33. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +2 -1
  34. package/jsx-runtime/dist/valbuild-react-jsx-runtime.browser.esm.js +2 -1
  35. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.dev.js +2 -1
  36. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.prod.js +2 -1
  37. package/jsx-runtime/dist/valbuild-react-jsx-runtime.esm.js +2 -1
  38. package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +2 -1
  39. package/package.json +4 -4
  40. package/stega/dist/valbuild-react-stega.browser.esm.js +2 -1
  41. package/stega/dist/valbuild-react-stega.cjs.dev.js +2 -1
  42. package/stega/dist/valbuild-react-stega.cjs.prod.js +2 -1
  43. package/stega/dist/valbuild-react-stega.esm.js +2 -1
  44. package/stega/dist/valbuild-react-stega.worker.esm.js +2 -1
  45. package/dist/ValProvider-c7d7067b.cjs.js +0 -7
  46. package/dist/ValUI-323cc3ff.cjs.js +0 -7
@@ -2,7 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('../../dist/ValProvider-c7d7067b.cjs.prod.js');
5
+ var ValProvider = require('../../dist/ValProvider-5b6a05e9.cjs.prod.js');
6
+ var unsupportedIterableToArray = require('../../dist/unsupportedIterableToArray-42309462.cjs.prod.js');
6
7
  var React = require('react');
7
8
  var ReactJSXRuntime = require('react/jsx-runtime');
8
9
 
@@ -10,146 +11,124 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
10
11
 
11
12
  var React__default = /*#__PURE__*/_interopDefault(React);
12
13
 
13
- /* eslint-disable @typescript-eslint/ban-types */
14
+ function _arrayWithoutHoles(arr) {
15
+ if (Array.isArray(arr)) return unsupportedIterableToArray._arrayLikeToArray(arr);
16
+ }
17
+
18
+ function _iterableToArray(iter) {
19
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
20
+ }
21
+
22
+ function _nonIterableSpread() {
23
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24
+ }
25
+
26
+ function _toConsumableArray(arr) {
27
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || unsupportedIterableToArray._unsupportedIterableToArray(arr) || _nonIterableSpread();
28
+ }
29
+
30
+ /**
31
+ * Render RichText as HTML
32
+ *
33
+ * @example
34
+ * const content = useVal(contentVal);
35
+ * return <ValRichText>{content.myRichText}</ValRichText>
36
+ *
37
+ * @example
38
+ * const content = useVal(contentVal);
39
+ * return (
40
+ * <ValRichText
41
+ * theme={{
42
+ * h1: 'text-4xl font-bold',
43
+ * }}>
44
+ * {content.myRichText}
45
+ * </ValRichText>
46
+ * );
47
+ *
48
+ *
49
+ * @example
50
+ * const content = useVal(contentVal);
51
+ * return (
52
+ * <ValRichText
53
+ * theme={{
54
+ * h1: 'text-4xl font-bold',
55
+ * img: 'rounded',
56
+ * }}
57
+ * transform={(node, className) => {
58
+ * if (node.tag === 'img') {
59
+ * return <Image className={className} src={node.src} alt={node.alt || ""} width={node.metadata?.width} height={node.metadata?.height} />
60
+ * }
61
+ * }}>
62
+ * {content.myRichText}
63
+ * </ValRichText>
64
+ * );
65
+ *
66
+ * @param
67
+ * @returns
68
+ */
14
69
  function ValRichText(_ref) {
15
- var theme = _ref.theme,
70
+ var children = _ref.children,
16
71
  className = _ref.className,
17
- children = _ref.children;
72
+ style = _ref.style,
73
+ theme = _ref.theme,
74
+ transform = _ref.transform;
18
75
  var root = children;
19
- function withRenderTag(clazz, current) {
20
- var renderClass = theme === null || theme === void 0 ? void 0 : theme[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 === null || theme === void 0 ? void 0 : theme[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)
76
+ function build(child, key) {
77
+ if (typeof child === "string") {
78
+ var transformed = transform && transform(child, []);
79
+ if (transformed !== undefined) {
80
+ return transformed;
81
+ }
82
+ return child;
83
+ }
84
+ var className = classNameOfTag(child.tag, "classes" in child ? child.classes : [], theme);
85
+ var children = "children" in child ?
86
+ // Why do this? We get a very weird error in NextJS 14.0.4 if we do not
87
+ // Error: Cannot access Image.prototype on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.
88
+ // https://github.com/vercel/next.js/issues/52415
89
+ child.children.length === 1 ? build(child.children[0]) : child.children.map(build) : null;
90
+ if (transform) {
91
+ var _transformed = transform(child, children !== null && children !== void 0 ? children : [], className);
92
+ if (_transformed !== undefined) {
93
+ return _transformed;
94
+ }
95
+ }
96
+ var tag = child.tag; // one of: "img" | "a" | "ul" | "ol" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "br" | "p" | "li" | "span"
97
+ return /*#__PURE__*/React__default["default"].createElement(tag, {
98
+ key: key === null || key === void 0 ? void 0 : key.toString(),
99
+ className: className,
100
+ children: children
145
101
  });
146
102
  }
147
103
  return /*#__PURE__*/ReactJSXRuntime.jsx("div", {
148
104
  className: className,
105
+ style: style,
149
106
  "data-val-path": root.valPath,
150
- children: root.children.map(toReact)
107
+ children: root.children.map(build)
151
108
  });
152
109
  }
110
+ function classNameOfTag(tag, clazz, theme) {
111
+ var thisTagClassName = null;
112
+ if (theme && tag in theme) {
113
+ var _theme$tag;
114
+ thisTagClassName = (_theme$tag = theme[tag]) !== null && _theme$tag !== void 0 ? _theme$tag : null;
115
+ }
116
+ return [].concat(_toConsumableArray(thisTagClassName ? [thisTagClassName] : []), _toConsumableArray(clazz.map(function (style) {
117
+ if (theme &&
118
+ // not need on type-level, but defensive on runtime:
119
+ typeof style === "string") {
120
+ if (style === "line-through") {
121
+ if ("lineThrough" in theme) {
122
+ return theme["lineThrough"];
123
+ }
124
+ }
125
+ if (style !== "line-through" && style in theme) {
126
+ return theme[style];
127
+ }
128
+ }
129
+ return clazz;
130
+ }))).join(" ");
131
+ }
153
132
 
154
133
  Object.defineProperty(exports, 'ValProvider', {
155
134
  enumerable: true,
@@ -1,146 +1,125 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-8ec03a73.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-47b779dc.esm.js';
2
+ import { a as _arrayLikeToArray, _ as _unsupportedIterableToArray } from '../../dist/unsupportedIterableToArray-7c30dadf.esm.js';
2
3
  import React from 'react';
3
4
  import { jsx } from 'react/jsx-runtime';
4
5
 
5
- /* eslint-disable @typescript-eslint/ban-types */
6
+ function _arrayWithoutHoles(arr) {
7
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ }
9
+
10
+ function _iterableToArray(iter) {
11
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
12
+ }
13
+
14
+ function _nonIterableSpread() {
15
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16
+ }
17
+
18
+ function _toConsumableArray(arr) {
19
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
20
+ }
21
+
22
+ /**
23
+ * Render RichText as HTML
24
+ *
25
+ * @example
26
+ * const content = useVal(contentVal);
27
+ * return <ValRichText>{content.myRichText}</ValRichText>
28
+ *
29
+ * @example
30
+ * const content = useVal(contentVal);
31
+ * return (
32
+ * <ValRichText
33
+ * theme={{
34
+ * h1: 'text-4xl font-bold',
35
+ * }}>
36
+ * {content.myRichText}
37
+ * </ValRichText>
38
+ * );
39
+ *
40
+ *
41
+ * @example
42
+ * const content = useVal(contentVal);
43
+ * return (
44
+ * <ValRichText
45
+ * theme={{
46
+ * h1: 'text-4xl font-bold',
47
+ * img: 'rounded',
48
+ * }}
49
+ * transform={(node, className) => {
50
+ * if (node.tag === 'img') {
51
+ * return <Image className={className} src={node.src} alt={node.alt || ""} width={node.metadata?.width} height={node.metadata?.height} />
52
+ * }
53
+ * }}>
54
+ * {content.myRichText}
55
+ * </ValRichText>
56
+ * );
57
+ *
58
+ * @param
59
+ * @returns
60
+ */
6
61
  function ValRichText(_ref) {
7
- var theme = _ref.theme,
62
+ var children = _ref.children,
8
63
  className = _ref.className,
9
- children = _ref.children;
64
+ style = _ref.style,
65
+ theme = _ref.theme,
66
+ transform = _ref.transform;
10
67
  var root = children;
11
- function withRenderTag(clazz, current) {
12
- var renderClass = theme === null || theme === void 0 ? void 0 : theme[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 === null || theme === void 0 ? void 0 : theme[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)
68
+ function build(child, key) {
69
+ if (typeof child === "string") {
70
+ var transformed = transform && transform(child, []);
71
+ if (transformed !== undefined) {
72
+ return transformed;
73
+ }
74
+ return child;
75
+ }
76
+ var className = classNameOfTag(child.tag, "classes" in child ? child.classes : [], theme);
77
+ var children = "children" in child ?
78
+ // Why do this? We get a very weird error in NextJS 14.0.4 if we do not
79
+ // Error: Cannot access Image.prototype on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.
80
+ // https://github.com/vercel/next.js/issues/52415
81
+ child.children.length === 1 ? build(child.children[0]) : child.children.map(build) : null;
82
+ if (transform) {
83
+ var _transformed = transform(child, children !== null && children !== void 0 ? children : [], className);
84
+ if (_transformed !== undefined) {
85
+ return _transformed;
86
+ }
87
+ }
88
+ var tag = child.tag; // one of: "img" | "a" | "ul" | "ol" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "br" | "p" | "li" | "span"
89
+ return /*#__PURE__*/React.createElement(tag, {
90
+ key: key === null || key === void 0 ? void 0 : key.toString(),
91
+ className: className,
92
+ children: children
137
93
  });
138
94
  }
139
95
  return /*#__PURE__*/jsx("div", {
140
96
  className: className,
97
+ style: style,
141
98
  "data-val-path": root.valPath,
142
- children: root.children.map(toReact)
99
+ children: root.children.map(build)
143
100
  });
144
101
  }
102
+ function classNameOfTag(tag, clazz, theme) {
103
+ var thisTagClassName = null;
104
+ if (theme && tag in theme) {
105
+ var _theme$tag;
106
+ thisTagClassName = (_theme$tag = theme[tag]) !== null && _theme$tag !== void 0 ? _theme$tag : null;
107
+ }
108
+ return [].concat(_toConsumableArray(thisTagClassName ? [thisTagClassName] : []), _toConsumableArray(clazz.map(function (style) {
109
+ if (theme &&
110
+ // not need on type-level, but defensive on runtime:
111
+ typeof style === "string") {
112
+ if (style === "line-through") {
113
+ if ("lineThrough" in theme) {
114
+ return theme["lineThrough"];
115
+ }
116
+ }
117
+ if (style !== "line-through" && style in theme) {
118
+ return theme[style];
119
+ }
120
+ }
121
+ return clazz;
122
+ }))).join(" ");
123
+ }
145
124
 
146
125
  export { ValRichText };