@valbuild/react 0.12.0 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ValProvider-52f2fa13.esm.js +731 -0
- package/dist/ValProvider-7364ec46.cjs.dev.js +746 -0
- package/dist/ValProvider-a45a47b9.worker.esm.js +726 -0
- package/dist/ValProvider-c7a8476b.browser.esm.js +731 -0
- package/dist/ValProvider-e1d5ffbe.cjs.js +7 -0
- package/dist/ValProvider-e1d5ffbe.cjs.prod.js +746 -0
- package/dist/ValUI-0fbdafd4.cjs.prod.js +398 -0
- package/dist/ValUI-371e9bf4.cjs.dev.js +398 -0
- package/dist/ValUI-51404232.browser.esm.js +396 -0
- package/dist/ValUI-9a3eb570.esm.js +396 -0
- package/dist/declarations/src/AuthStatus.d.ts +6 -0
- package/dist/declarations/src/ShadowRoot.d.ts +4 -0
- package/dist/declarations/src/ValProvider.d.ts +1 -1
- package/dist/declarations/src/ValProviderWrapper.d.ts +3 -0
- package/dist/declarations/src/ValUI.d.ts +8 -0
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/{slicedToArray-0ead6329.cjs.dev.js → slicedToArray-0eb0bcdb.cjs.prod.js} +3 -17
- package/dist/{slicedToArray-bf9b195a.worker.esm.js → slicedToArray-1a246338.browser.esm.js} +3 -16
- package/dist/{slicedToArray-236143cd.browser.esm.js → slicedToArray-9e7d1407.worker.esm.js} +3 -16
- package/dist/{slicedToArray-57b117df.cjs.prod.js → slicedToArray-b7cf26e0.cjs.dev.js} +3 -17
- package/dist/{slicedToArray-390fde8c.esm.js → slicedToArray-d846e1d2.esm.js} +3 -16
- package/dist/unsupportedIterableToArray-51bb61c2.esm.js +16 -0
- package/dist/unsupportedIterableToArray-738344ef.worker.esm.js +16 -0
- package/dist/unsupportedIterableToArray-9e97e24a.cjs.dev.js +18 -0
- package/dist/unsupportedIterableToArray-afbea1dd.cjs.prod.js +18 -0
- package/dist/unsupportedIterableToArray-d3087ed5.browser.esm.js +16 -0
- package/dist/valbuild-react.browser.esm.js +9 -1083
- package/dist/valbuild-react.cjs.dev.js +24 -1074
- package/dist/valbuild-react.cjs.prod.js +24 -1074
- package/dist/valbuild-react.esm.js +13 -1079
- package/dist/valbuild-react.worker.esm.js +13 -1079
- package/jest.config.js +5 -0
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +2 -1
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +2 -1
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +2 -1
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +2 -1
- package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +2 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.browser.esm.js +2 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.dev.js +2 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.prod.js +2 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.esm.js +2 -1
- package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +2 -1
- package/package.json +9 -6
- package/src/AuthStatus.tsx +13 -0
- package/src/ShadowRoot.tsx +32 -0
- package/src/ValApi.ts +65 -0
- package/src/ValProvider.tsx +51 -0
- package/src/ValProviderWrapper.tsx +15 -0
- package/src/ValRichText.tsx +141 -0
- package/src/ValStore.ts +62 -0
- package/src/ValUI.tsx +353 -0
- package/src/assets.ts +124 -0
- package/src/hooks/useVal.test.tsx +57 -0
- package/src/hooks/useVal.ts +35 -0
- package/src/index.ts +6 -0
- package/src/jsx-dev-runtime.js +47 -0
- package/src/jsx-namespace.d.ts +46 -0
- package/src/jsx-runtime.d.ts +1 -0
- package/src/jsx-runtime.dev.d.ts +1 -0
- package/src/jsx-runtime.js +52 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
import { Internal } from "@valbuild/core";
|
2
|
+
import * as ReactJSXRuntime from "react/jsx-runtime";
|
3
|
+
export * from "react/jsx-runtime";
|
4
|
+
|
5
|
+
const isIntrinsicElement = (type) => {
|
6
|
+
// TODO: think this is not correct, but good enough for now?
|
7
|
+
return typeof type === "string";
|
8
|
+
};
|
9
|
+
|
10
|
+
const devalProps = (type, props) => {
|
11
|
+
const valSources = [];
|
12
|
+
|
13
|
+
if (isIntrinsicElement(type)) {
|
14
|
+
for (const [key, value] of Object.entries(props)) {
|
15
|
+
if (typeof value === "object" && value !== null && "val" in value) {
|
16
|
+
const valPath = Internal.getValPath(value);
|
17
|
+
if (valPath) {
|
18
|
+
valSources.push(valPath);
|
19
|
+
if (typeof value.val === "string" || value.val === null) {
|
20
|
+
props[key] = value.val;
|
21
|
+
} else {
|
22
|
+
throw Error("TODO: unhandled value type");
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
if (valSources.length > 0) {
|
30
|
+
props["data-val-path"] = valSources.join(",");
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
34
|
+
export function jsx(type, props, key) {
|
35
|
+
// console.log("jsx", type, props, key);
|
36
|
+
|
37
|
+
devalProps(type, props);
|
38
|
+
|
39
|
+
return ReactJSXRuntime.jsx(type, props, key);
|
40
|
+
}
|
41
|
+
|
42
|
+
export function jsxs(type, props, key) {
|
43
|
+
// console.log("jsxs", type, props, key);
|
44
|
+
|
45
|
+
if (key === "key") {
|
46
|
+
console.log("jsxDEV", type, props, key, self);
|
47
|
+
}
|
48
|
+
|
49
|
+
devalProps(type, props);
|
50
|
+
|
51
|
+
return ReactJSXRuntime.jsxs(type, props, key);
|
52
|
+
}
|