@valbuild/react 0.13.4 → 0.14.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 (63) hide show
  1. package/README.md +11 -0
  2. package/dist/{ValProvider-07551558.esm.js → ValProvider-2eb6c2f2.esm.js} +3 -33
  3. package/dist/ValProvider-74eef393.cjs.js +7 -0
  4. package/dist/{ValProvider-d8fe7dc4.cjs.prod.js → ValProvider-74eef393.cjs.prod.js} +6 -37
  5. package/dist/{ValProvider-11be7088.browser.esm.js → ValProvider-c677e164.browser.esm.js} +3 -33
  6. package/dist/{ValProvider-50aa4ba8.worker.esm.js → ValProvider-cb5a2161.worker.esm.js} +1 -31
  7. package/dist/{ValProvider-7b9d888e.cjs.dev.js → ValProvider-f647e355.cjs.dev.js} +6 -37
  8. package/dist/{ValUI-5e993a19.cjs.prod.js → ValUI-0c2671a7.cjs.prod.js} +12 -28
  9. package/dist/{ValUI-ac6ae690.cjs.dev.js → ValUI-334ef1d0.cjs.dev.js} +12 -28
  10. package/dist/{ValUI-4844450a.browser.esm.js → ValUI-bb1d1ed6.browser.esm.js} +11 -27
  11. package/dist/{ValUI-599818da.esm.js → ValUI-bf82178a.esm.js} +11 -27
  12. package/dist/declarations/src/ValProvider.d.ts +2 -2
  13. package/dist/declarations/src/ValRichText.d.ts +5 -0
  14. package/dist/declarations/src/ValStore.d.ts +1 -1
  15. package/dist/declarations/src/index.d.ts +3 -2
  16. package/dist/declarations/src/jsx-runtime.d.ts +1 -1
  17. package/dist/declarations/src/stega/autoTagJSX.d.ts +1 -0
  18. package/dist/declarations/src/stega/fetchVal.d.ts +3 -0
  19. package/dist/declarations/src/stega/hooks/useVal.d.ts +3 -0
  20. package/dist/declarations/src/stega/index.d.ts +4 -0
  21. package/dist/declarations/src/stega/stegaEncode.d.ts +24 -0
  22. package/dist/defineProperty-12b5bd29.esm.js +32 -0
  23. package/dist/defineProperty-36ed93cd.cjs.prod.js +35 -0
  24. package/dist/defineProperty-a4bf59bc.worker.esm.js +32 -0
  25. package/dist/defineProperty-c82a49b0.cjs.dev.js +35 -0
  26. package/dist/defineProperty-f319cb47.browser.esm.js +32 -0
  27. package/dist/objectSpread2-30cc2856.browser.esm.js +25 -0
  28. package/dist/objectSpread2-61fbd9a9.cjs.dev.js +27 -0
  29. package/dist/objectSpread2-7b752a35.cjs.prod.js +27 -0
  30. package/dist/objectSpread2-d5a1fe1c.esm.js +25 -0
  31. package/dist/valbuild-react.browser.esm.js +138 -2
  32. package/dist/valbuild-react.cjs.dev.js +142 -1
  33. package/dist/valbuild-react.cjs.prod.js +142 -1
  34. package/dist/valbuild-react.esm.js +138 -2
  35. package/dist/valbuild-react.worker.esm.js +138 -2
  36. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +2 -2
  37. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +5 -5
  38. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +5 -5
  39. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +2 -2
  40. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +2 -2
  41. package/package.json +14 -4
  42. package/src/ShadowRoot.tsx +8 -4
  43. package/src/ValRichText.tsx +177 -0
  44. package/src/index.ts +2 -3
  45. package/src/stega/autoTagJSX.ts +80 -0
  46. package/src/stega/fetchVal.ts +16 -0
  47. package/src/stega/hooks/useVal.ts +14 -0
  48. package/src/stega/index.ts +5 -0
  49. package/src/stega/stegaEncode.ts +84 -0
  50. package/stega/README.md +3 -0
  51. package/stega/dist/valbuild-react-stega.browser.esm.js +126 -0
  52. package/stega/dist/valbuild-react-stega.cjs.d.ts +2 -0
  53. package/stega/dist/valbuild-react-stega.cjs.d.ts.map +1 -0
  54. package/stega/dist/valbuild-react-stega.cjs.dev.js +138 -0
  55. package/stega/dist/valbuild-react-stega.cjs.js +7 -0
  56. package/stega/dist/valbuild-react-stega.cjs.prod.js +138 -0
  57. package/stega/dist/valbuild-react-stega.esm.js +126 -0
  58. package/stega/dist/valbuild-react-stega.worker.esm.js +147 -0
  59. package/stega/package.json +7 -0
  60. package/dist/ValProvider-d8fe7dc4.cjs.js +0 -7
  61. package/dist/declarations/src/AuthStatus.d.ts +0 -6
  62. package/dist/declarations/src/ShadowRoot.d.ts +0 -4
  63. package/dist/declarations/src/ValUI.d.ts +0 -8
@@ -2,8 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('./ValProvider-d8fe7dc4.cjs.prod.js');
5
+ var ValProvider = require('./ValProvider-74eef393.cjs.prod.js');
6
6
  var core = require('@valbuild/core');
7
+ var React = require('react');
8
+ var parse = require('style-to-object');
9
+ var ReactJSXRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
12
+
13
+ var parse__default = /*#__PURE__*/_interopDefault(parse);
7
14
 
8
15
  function useVal(selector, locale) {
9
16
  // const mod = selectable.getModule();
@@ -27,8 +34,142 @@ function useVal(selector, locale) {
27
34
  return core.Internal.getVal(selector, locale);
28
35
  }
29
36
 
37
+ function ValRichText(_ref) {
38
+ var children = _ref.children;
39
+ var root = children;
40
+ var path = root.valPath;
41
+ return /*#__PURE__*/ReactJSXRuntime.jsx("div", {
42
+ "data-val-path": path,
43
+ children: root.children.map(function (child, i) {
44
+ var childType = child.type;
45
+ var childPath = "".concat(path, ".").concat(i);
46
+ switch (childType) {
47
+ case "heading":
48
+ return /*#__PURE__*/ReactJSXRuntime.jsx(HeadingNodeComponent, {
49
+ path: childPath,
50
+ node: child
51
+ }, childPath);
52
+ case "paragraph":
53
+ return /*#__PURE__*/ReactJSXRuntime.jsx(ParagraphNodeComponent, {
54
+ path: childPath,
55
+ node: child
56
+ }, childPath);
57
+ case "list":
58
+ return /*#__PURE__*/ReactJSXRuntime.jsx(ListNodeComponent, {
59
+ path: childPath,
60
+ node: child
61
+ }, childPath);
62
+ default:
63
+ throw Error("Unknown root node type: " + childType);
64
+ }
65
+ })
66
+ });
67
+ }
68
+ function TextNodeComponent(_ref2) {
69
+ var _parse, _node$format;
70
+ var node = _ref2.node;
71
+ var styleProps = node.style ? (_parse = parse__default["default"](node.style)) !== null && _parse !== void 0 ? _parse : {} : {};
72
+ // TODO: Ugly! We should do this before serializing instead
73
+ if (styleProps["font-family"]) {
74
+ styleProps["fontFamily"] = styleProps["font-family"];
75
+ delete styleProps["font-family"];
76
+ }
77
+ if (styleProps["font-size"]) {
78
+ styleProps["fontSize"] = styleProps["font-size"];
79
+ delete styleProps["font-size"];
80
+ }
81
+ var bitmask = (_node$format = node.format) === null || _node$format === void 0 ? void 0 : _node$format.toString(2);
82
+ var bitmaskOffset = bitmask ? bitmask.length - 1 : 0;
83
+ function isBitOne(bit) {
84
+ if (!bitmask) {
85
+ return false;
86
+ }
87
+ return bitmask.length >= bitmaskOffset - bit && bitmask[bitmaskOffset - bit] === "1";
88
+ }
89
+ if (isBitOne(0)) {
90
+ styleProps["fontWeight"] = "bold";
91
+ }
92
+ if (isBitOne(1)) {
93
+ styleProps["fontStyle"] = "italic";
94
+ }
95
+ if (isBitOne(2)) {
96
+ if (!styleProps["textDecoration"]) {
97
+ styleProps["textDecoration"] = "line-through";
98
+ } else {
99
+ styleProps["textDecoration"] += " line-through";
100
+ }
101
+ }
102
+ if (isBitOne(3)) {
103
+ if (!styleProps["textDecoration"]) {
104
+ styleProps["textDecoration"] = "underline";
105
+ } else {
106
+ styleProps["textDecoration"] += " underline";
107
+ }
108
+ }
109
+ return /*#__PURE__*/ReactJSXRuntime.jsx("span", {
110
+ style: styleProps,
111
+ children: node.text
112
+ });
113
+ }
114
+ function HeadingNodeComponent(_ref3) {
115
+ var node = _ref3.node,
116
+ path = _ref3.path;
117
+ return /*#__PURE__*/React.createElement(node.tag, {}, node.children.map(function (child, i) {
118
+ var childPath = "".concat(path, ".").concat(i);
119
+ return /*#__PURE__*/ReactJSXRuntime.jsx(TextNodeComponent, {
120
+ node: child
121
+ }, childPath);
122
+ }));
123
+ }
124
+ function ParagraphNodeComponent(_ref4) {
125
+ var node = _ref4.node,
126
+ path = _ref4.path;
127
+ return /*#__PURE__*/ReactJSXRuntime.jsx("p", {
128
+ children: node.children.map(function (child, i) {
129
+ var childPath = "".concat(path, ".").concat(i);
130
+ switch (child.type) {
131
+ case "text":
132
+ return /*#__PURE__*/ReactJSXRuntime.jsx(TextNodeComponent, {
133
+ node: child
134
+ }, childPath);
135
+ default:
136
+ throw Error("Unknown paragraph node type: " + (child === null || child === void 0 ? void 0 : child.type));
137
+ }
138
+ })
139
+ });
140
+ }
141
+ function ListNodeComponent(_ref5) {
142
+ var node = _ref5.node,
143
+ path = _ref5.path;
144
+ return /*#__PURE__*/React.createElement(node.tag, {}, node.children.map(function (child, i) {
145
+ var childPath = "".concat(path, ".").concat(i);
146
+ return /*#__PURE__*/ReactJSXRuntime.jsx(ListItemComponent, {
147
+ path: childPath,
148
+ node: child
149
+ }, childPath);
150
+ }));
151
+ }
152
+ function ListItemComponent(_ref6) {
153
+ var node = _ref6.node,
154
+ path = _ref6.path;
155
+ return /*#__PURE__*/ReactJSXRuntime.jsx("li", {
156
+ children: node.children.map(function (child, i) {
157
+ var childPath = "".concat(path, ".").concat(i);
158
+ switch (child.type) {
159
+ case "text":
160
+ return /*#__PURE__*/ReactJSXRuntime.jsx(TextNodeComponent, {
161
+ node: child
162
+ }, childPath);
163
+ default:
164
+ throw Error("Unknown list item node type: " + (child === null || child === void 0 ? void 0 : child.type));
165
+ }
166
+ })
167
+ });
168
+ }
169
+
30
170
  Object.defineProperty(exports, 'ValProvider', {
31
171
  enumerable: true,
32
172
  get: function () { return ValProvider.ValProvider; }
33
173
  });
174
+ exports.ValRichText = ValRichText;
34
175
  exports.useVal = useVal;
@@ -1,5 +1,8 @@
1
- export { ValProvider } from './ValProvider-07551558.esm.js';
1
+ export { ValProvider } from './ValProvider-2eb6c2f2.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
+ import { createElement } from 'react';
4
+ import parse from 'style-to-object';
5
+ import { jsx } from 'react/jsx-runtime';
3
6
 
4
7
  function useVal(selector, locale) {
5
8
  // const mod = selectable.getModule();
@@ -23,4 +26,137 @@ function useVal(selector, locale) {
23
26
  return Internal.getVal(selector, locale);
24
27
  }
25
28
 
26
- export { useVal };
29
+ function ValRichText(_ref) {
30
+ var children = _ref.children;
31
+ var root = children;
32
+ var path = root.valPath;
33
+ return /*#__PURE__*/jsx("div", {
34
+ "data-val-path": path,
35
+ children: root.children.map(function (child, i) {
36
+ var childType = child.type;
37
+ var childPath = "".concat(path, ".").concat(i);
38
+ switch (childType) {
39
+ case "heading":
40
+ return /*#__PURE__*/jsx(HeadingNodeComponent, {
41
+ path: childPath,
42
+ node: child
43
+ }, childPath);
44
+ case "paragraph":
45
+ return /*#__PURE__*/jsx(ParagraphNodeComponent, {
46
+ path: childPath,
47
+ node: child
48
+ }, childPath);
49
+ case "list":
50
+ return /*#__PURE__*/jsx(ListNodeComponent, {
51
+ path: childPath,
52
+ node: child
53
+ }, childPath);
54
+ default:
55
+ throw Error("Unknown root node type: " + childType);
56
+ }
57
+ })
58
+ });
59
+ }
60
+ function TextNodeComponent(_ref2) {
61
+ var _parse, _node$format;
62
+ var node = _ref2.node;
63
+ var styleProps = node.style ? (_parse = parse(node.style)) !== null && _parse !== void 0 ? _parse : {} : {};
64
+ // TODO: Ugly! We should do this before serializing instead
65
+ if (styleProps["font-family"]) {
66
+ styleProps["fontFamily"] = styleProps["font-family"];
67
+ delete styleProps["font-family"];
68
+ }
69
+ if (styleProps["font-size"]) {
70
+ styleProps["fontSize"] = styleProps["font-size"];
71
+ delete styleProps["font-size"];
72
+ }
73
+ var bitmask = (_node$format = node.format) === null || _node$format === void 0 ? void 0 : _node$format.toString(2);
74
+ var bitmaskOffset = bitmask ? bitmask.length - 1 : 0;
75
+ function isBitOne(bit) {
76
+ if (!bitmask) {
77
+ return false;
78
+ }
79
+ return bitmask.length >= bitmaskOffset - bit && bitmask[bitmaskOffset - bit] === "1";
80
+ }
81
+ if (isBitOne(0)) {
82
+ styleProps["fontWeight"] = "bold";
83
+ }
84
+ if (isBitOne(1)) {
85
+ styleProps["fontStyle"] = "italic";
86
+ }
87
+ if (isBitOne(2)) {
88
+ if (!styleProps["textDecoration"]) {
89
+ styleProps["textDecoration"] = "line-through";
90
+ } else {
91
+ styleProps["textDecoration"] += " line-through";
92
+ }
93
+ }
94
+ if (isBitOne(3)) {
95
+ if (!styleProps["textDecoration"]) {
96
+ styleProps["textDecoration"] = "underline";
97
+ } else {
98
+ styleProps["textDecoration"] += " underline";
99
+ }
100
+ }
101
+ return /*#__PURE__*/jsx("span", {
102
+ style: styleProps,
103
+ children: node.text
104
+ });
105
+ }
106
+ function HeadingNodeComponent(_ref3) {
107
+ var node = _ref3.node,
108
+ path = _ref3.path;
109
+ return /*#__PURE__*/createElement(node.tag, {}, node.children.map(function (child, i) {
110
+ var childPath = "".concat(path, ".").concat(i);
111
+ return /*#__PURE__*/jsx(TextNodeComponent, {
112
+ node: child
113
+ }, childPath);
114
+ }));
115
+ }
116
+ function ParagraphNodeComponent(_ref4) {
117
+ var node = _ref4.node,
118
+ path = _ref4.path;
119
+ return /*#__PURE__*/jsx("p", {
120
+ children: node.children.map(function (child, i) {
121
+ var childPath = "".concat(path, ".").concat(i);
122
+ switch (child.type) {
123
+ case "text":
124
+ return /*#__PURE__*/jsx(TextNodeComponent, {
125
+ node: child
126
+ }, childPath);
127
+ default:
128
+ throw Error("Unknown paragraph node type: " + (child === null || child === void 0 ? void 0 : child.type));
129
+ }
130
+ })
131
+ });
132
+ }
133
+ function ListNodeComponent(_ref5) {
134
+ var node = _ref5.node,
135
+ path = _ref5.path;
136
+ return /*#__PURE__*/createElement(node.tag, {}, node.children.map(function (child, i) {
137
+ var childPath = "".concat(path, ".").concat(i);
138
+ return /*#__PURE__*/jsx(ListItemComponent, {
139
+ path: childPath,
140
+ node: child
141
+ }, childPath);
142
+ }));
143
+ }
144
+ function ListItemComponent(_ref6) {
145
+ var node = _ref6.node,
146
+ path = _ref6.path;
147
+ return /*#__PURE__*/jsx("li", {
148
+ children: node.children.map(function (child, i) {
149
+ var childPath = "".concat(path, ".").concat(i);
150
+ switch (child.type) {
151
+ case "text":
152
+ return /*#__PURE__*/jsx(TextNodeComponent, {
153
+ node: child
154
+ }, childPath);
155
+ default:
156
+ throw Error("Unknown list item node type: " + (child === null || child === void 0 ? void 0 : child.type));
157
+ }
158
+ })
159
+ });
160
+ }
161
+
162
+ export { ValRichText, useVal };
@@ -1,5 +1,8 @@
1
- export { ValProvider } from './ValProvider-50aa4ba8.worker.esm.js';
1
+ export { ValProvider } from './ValProvider-cb5a2161.worker.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
+ import { createElement } from 'react';
4
+ import parse from 'style-to-object';
5
+ import { jsx } from 'react/jsx-runtime';
3
6
 
4
7
  function useVal(selector, locale) {
5
8
  // const mod = selectable.getModule();
@@ -23,4 +26,137 @@ function useVal(selector, locale) {
23
26
  return Internal.getVal(selector, locale);
24
27
  }
25
28
 
26
- export { useVal };
29
+ function ValRichText(_ref) {
30
+ var children = _ref.children;
31
+ var root = children;
32
+ var path = root.valPath;
33
+ return /*#__PURE__*/jsx("div", {
34
+ "data-val-path": path,
35
+ children: root.children.map(function (child, i) {
36
+ var childType = child.type;
37
+ var childPath = "".concat(path, ".").concat(i);
38
+ switch (childType) {
39
+ case "heading":
40
+ return /*#__PURE__*/jsx(HeadingNodeComponent, {
41
+ path: childPath,
42
+ node: child
43
+ }, childPath);
44
+ case "paragraph":
45
+ return /*#__PURE__*/jsx(ParagraphNodeComponent, {
46
+ path: childPath,
47
+ node: child
48
+ }, childPath);
49
+ case "list":
50
+ return /*#__PURE__*/jsx(ListNodeComponent, {
51
+ path: childPath,
52
+ node: child
53
+ }, childPath);
54
+ default:
55
+ throw Error("Unknown root node type: " + childType);
56
+ }
57
+ })
58
+ });
59
+ }
60
+ function TextNodeComponent(_ref2) {
61
+ var _parse, _node$format;
62
+ var node = _ref2.node;
63
+ var styleProps = node.style ? (_parse = parse(node.style)) !== null && _parse !== void 0 ? _parse : {} : {};
64
+ // TODO: Ugly! We should do this before serializing instead
65
+ if (styleProps["font-family"]) {
66
+ styleProps["fontFamily"] = styleProps["font-family"];
67
+ delete styleProps["font-family"];
68
+ }
69
+ if (styleProps["font-size"]) {
70
+ styleProps["fontSize"] = styleProps["font-size"];
71
+ delete styleProps["font-size"];
72
+ }
73
+ var bitmask = (_node$format = node.format) === null || _node$format === void 0 ? void 0 : _node$format.toString(2);
74
+ var bitmaskOffset = bitmask ? bitmask.length - 1 : 0;
75
+ function isBitOne(bit) {
76
+ if (!bitmask) {
77
+ return false;
78
+ }
79
+ return bitmask.length >= bitmaskOffset - bit && bitmask[bitmaskOffset - bit] === "1";
80
+ }
81
+ if (isBitOne(0)) {
82
+ styleProps["fontWeight"] = "bold";
83
+ }
84
+ if (isBitOne(1)) {
85
+ styleProps["fontStyle"] = "italic";
86
+ }
87
+ if (isBitOne(2)) {
88
+ if (!styleProps["textDecoration"]) {
89
+ styleProps["textDecoration"] = "line-through";
90
+ } else {
91
+ styleProps["textDecoration"] += " line-through";
92
+ }
93
+ }
94
+ if (isBitOne(3)) {
95
+ if (!styleProps["textDecoration"]) {
96
+ styleProps["textDecoration"] = "underline";
97
+ } else {
98
+ styleProps["textDecoration"] += " underline";
99
+ }
100
+ }
101
+ return /*#__PURE__*/jsx("span", {
102
+ style: styleProps,
103
+ children: node.text
104
+ });
105
+ }
106
+ function HeadingNodeComponent(_ref3) {
107
+ var node = _ref3.node,
108
+ path = _ref3.path;
109
+ return /*#__PURE__*/createElement(node.tag, {}, node.children.map(function (child, i) {
110
+ var childPath = "".concat(path, ".").concat(i);
111
+ return /*#__PURE__*/jsx(TextNodeComponent, {
112
+ node: child
113
+ }, childPath);
114
+ }));
115
+ }
116
+ function ParagraphNodeComponent(_ref4) {
117
+ var node = _ref4.node,
118
+ path = _ref4.path;
119
+ return /*#__PURE__*/jsx("p", {
120
+ children: node.children.map(function (child, i) {
121
+ var childPath = "".concat(path, ".").concat(i);
122
+ switch (child.type) {
123
+ case "text":
124
+ return /*#__PURE__*/jsx(TextNodeComponent, {
125
+ node: child
126
+ }, childPath);
127
+ default:
128
+ throw Error("Unknown paragraph node type: " + (child === null || child === void 0 ? void 0 : child.type));
129
+ }
130
+ })
131
+ });
132
+ }
133
+ function ListNodeComponent(_ref5) {
134
+ var node = _ref5.node,
135
+ path = _ref5.path;
136
+ return /*#__PURE__*/createElement(node.tag, {}, node.children.map(function (child, i) {
137
+ var childPath = "".concat(path, ".").concat(i);
138
+ return /*#__PURE__*/jsx(ListItemComponent, {
139
+ path: childPath,
140
+ node: child
141
+ }, childPath);
142
+ }));
143
+ }
144
+ function ListItemComponent(_ref6) {
145
+ var node = _ref6.node,
146
+ path = _ref6.path;
147
+ return /*#__PURE__*/jsx("li", {
148
+ children: node.children.map(function (child, i) {
149
+ var childPath = "".concat(path, ".").concat(i);
150
+ switch (child.type) {
151
+ case "text":
152
+ return /*#__PURE__*/jsx(TextNodeComponent, {
153
+ node: child
154
+ }, childPath);
155
+ default:
156
+ throw Error("Unknown list item node type: " + (child === null || child === void 0 ? void 0 : child.type));
157
+ }
158
+ })
159
+ });
160
+ }
161
+
162
+ export { ValRichText, useVal };
@@ -1,6 +1,6 @@
1
1
  import { _ as _slicedToArray, a as _typeof } from '../../dist/slicedToArray-1a246338.browser.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
- import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
3
+ import * as jsxRuntimeDev from 'react/jsx-dev-runtime';
4
4
  export * from 'react/jsx-dev-runtime';
5
5
  import '../../dist/unsupportedIterableToArray-d3087ed5.browser.esm.js';
6
6
 
@@ -36,7 +36,7 @@ function jsxDEV(type, props, key, isStaticChildren, source, self) {
36
36
  // console.log("jsxDEV", type, props, key, isStaticChildren, source, self);
37
37
 
38
38
  devalProps(type, props);
39
- return ReactJSXRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
39
+ return jsxRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
40
40
  }
41
41
 
42
42
  export { jsxDEV };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var slicedToArray = require('../../dist/slicedToArray-b7cf26e0.cjs.dev.js');
6
6
  var core = require('@valbuild/core');
7
- var ReactJSXRuntimeDev = require('react/jsx-dev-runtime');
7
+ var jsxRuntimeDev = require('react/jsx-dev-runtime');
8
8
  require('../../dist/unsupportedIterableToArray-9e97e24a.cjs.dev.js');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
25
25
  return Object.freeze(n);
26
26
  }
27
27
 
28
- var ReactJSXRuntimeDev__namespace = /*#__PURE__*/_interopNamespace(ReactJSXRuntimeDev);
28
+ var jsxRuntimeDev__namespace = /*#__PURE__*/_interopNamespace(jsxRuntimeDev);
29
29
 
30
30
  var isIntrinsicElement = function isIntrinsicElement(type) {
31
31
  // TODO: think this is not correct, but good enough for now?
@@ -59,13 +59,13 @@ function jsxDEV(type, props, key, isStaticChildren, source, self) {
59
59
  // console.log("jsxDEV", type, props, key, isStaticChildren, source, self);
60
60
 
61
61
  devalProps(type, props);
62
- return ReactJSXRuntimeDev__namespace.jsxDEV(type, props, key, isStaticChildren, source, self);
62
+ return jsxRuntimeDev__namespace.jsxDEV(type, props, key, isStaticChildren, source, self);
63
63
  }
64
64
 
65
65
  exports.jsxDEV = jsxDEV;
66
- Object.keys(ReactJSXRuntimeDev).forEach(function (k) {
66
+ Object.keys(jsxRuntimeDev).forEach(function (k) {
67
67
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
68
68
  enumerable: true,
69
- get: function () { return ReactJSXRuntimeDev[k]; }
69
+ get: function () { return jsxRuntimeDev[k]; }
70
70
  });
71
71
  });
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var slicedToArray = require('../../dist/slicedToArray-0eb0bcdb.cjs.prod.js');
6
6
  var core = require('@valbuild/core');
7
- var ReactJSXRuntimeDev = require('react/jsx-dev-runtime');
7
+ var jsxRuntimeDev = require('react/jsx-dev-runtime');
8
8
  require('../../dist/unsupportedIterableToArray-afbea1dd.cjs.prod.js');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
25
25
  return Object.freeze(n);
26
26
  }
27
27
 
28
- var ReactJSXRuntimeDev__namespace = /*#__PURE__*/_interopNamespace(ReactJSXRuntimeDev);
28
+ var jsxRuntimeDev__namespace = /*#__PURE__*/_interopNamespace(jsxRuntimeDev);
29
29
 
30
30
  var isIntrinsicElement = function isIntrinsicElement(type) {
31
31
  // TODO: think this is not correct, but good enough for now?
@@ -59,13 +59,13 @@ function jsxDEV(type, props, key, isStaticChildren, source, self) {
59
59
  // console.log("jsxDEV", type, props, key, isStaticChildren, source, self);
60
60
 
61
61
  devalProps(type, props);
62
- return ReactJSXRuntimeDev__namespace.jsxDEV(type, props, key, isStaticChildren, source, self);
62
+ return jsxRuntimeDev__namespace.jsxDEV(type, props, key, isStaticChildren, source, self);
63
63
  }
64
64
 
65
65
  exports.jsxDEV = jsxDEV;
66
- Object.keys(ReactJSXRuntimeDev).forEach(function (k) {
66
+ Object.keys(jsxRuntimeDev).forEach(function (k) {
67
67
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
68
68
  enumerable: true,
69
- get: function () { return ReactJSXRuntimeDev[k]; }
69
+ get: function () { return jsxRuntimeDev[k]; }
70
70
  });
71
71
  });
@@ -1,6 +1,6 @@
1
1
  import { _ as _slicedToArray, a as _typeof } from '../../dist/slicedToArray-d846e1d2.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
- import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
3
+ import * as jsxRuntimeDev from 'react/jsx-dev-runtime';
4
4
  export * from 'react/jsx-dev-runtime';
5
5
  import '../../dist/unsupportedIterableToArray-51bb61c2.esm.js';
6
6
 
@@ -36,7 +36,7 @@ function jsxDEV(type, props, key, isStaticChildren, source, self) {
36
36
  // console.log("jsxDEV", type, props, key, isStaticChildren, source, self);
37
37
 
38
38
  devalProps(type, props);
39
- return ReactJSXRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
39
+ return jsxRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
40
40
  }
41
41
 
42
42
  export { jsxDEV };
@@ -1,6 +1,6 @@
1
1
  import { _ as _slicedToArray, a as _typeof } from '../../dist/slicedToArray-9e7d1407.worker.esm.js';
2
2
  import { Internal } from '@valbuild/core';
3
- import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
3
+ import * as jsxRuntimeDev from 'react/jsx-dev-runtime';
4
4
  export * from 'react/jsx-dev-runtime';
5
5
  import '../../dist/unsupportedIterableToArray-738344ef.worker.esm.js';
6
6
 
@@ -36,7 +36,7 @@ function jsxDEV(type, props, key, isStaticChildren, source, self) {
36
36
  // console.log("jsxDEV", type, props, key, isStaticChildren, source, self);
37
37
 
38
38
  devalProps(type, props);
39
- return ReactJSXRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
39
+ return jsxRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
40
40
  }
41
41
 
42
42
  export { jsxDEV };
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@valbuild/react",
3
- "version": "0.13.4",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
- "description": "Val - React",
5
+ "description": "Val - React internal helpers",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "typecheck": "tsc --noEmit",
9
9
  "test": "jest"
10
10
  },
11
11
  "dependencies": {
12
- "@valbuild/core": "~0.13.4",
12
+ "@valbuild/core": "~0.14.0",
13
13
  "@valbuild/ui": "~0.13.4",
14
+ "@vercel/stega": "^0.1.0",
14
15
  "base64-arraybuffer": "^1.0.2",
15
16
  "style-to-object": "^0.4.1"
16
17
  },
@@ -34,7 +35,8 @@
34
35
  "entrypoints": [
35
36
  "./index.ts",
36
37
  "./jsx-runtime.js",
37
- "./jsx-dev-runtime.js"
38
+ "./jsx-dev-runtime.js",
39
+ "./stega/index.ts"
38
40
  ],
39
41
  "exports": {
40
42
  "envConditions": [
@@ -68,6 +70,14 @@
68
70
  },
69
71
  "default": "./jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.js"
70
72
  },
73
+ "./stega": {
74
+ "module": {
75
+ "worker": "./stega/dist/valbuild-react-stega.worker.esm.js",
76
+ "browser": "./stega/dist/valbuild-react-stega.browser.esm.js",
77
+ "default": "./stega/dist/valbuild-react-stega.esm.js"
78
+ },
79
+ "default": "./stega/dist/valbuild-react-stega.cjs.js"
80
+ },
71
81
  "./jsx-dev-runtime": {
72
82
  "module": {
73
83
  "worker": "./jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js",
@@ -17,10 +17,14 @@ export const ShadowRoot = ({ children }: { children: React.ReactNode }) => {
17
17
 
18
18
  useLayoutEffect(() => {
19
19
  if (node.current) {
20
- const root = node.current.attachShadow({
21
- mode: "closed",
22
- });
23
- setRoot(root);
20
+ if (node.current.shadowRoot) {
21
+ setRoot(node.current.shadowRoot);
22
+ } else {
23
+ const root = node.current.attachShadow({
24
+ mode: "open",
25
+ });
26
+ setRoot(root);
27
+ }
24
28
  }
25
29
  }, []);
26
30