@valbuild/react 0.44.0 → 0.46.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/ValProvider-1bf1d7e4.cjs.prod.js +1 -1
- package/dist/ValProvider-36edbac3.browser.esm.js +1 -1
- package/dist/ValProvider-3f3f21ba.cjs.dev.js +1 -1
- package/dist/ValProvider-87475f3a.esm.js +1 -1
- package/dist/ValProvider-a29fe950.worker.esm.js +1 -1
- package/dist/{ValUI-4d8bf402.browser.esm.js → ValUI-07905fec.browser.esm.js} +0 -6
- package/dist/{ValUI-3fac1b71.worker.esm.js → ValUI-15ad1f1e.worker.esm.js} +0 -6
- package/dist/ValUI-b98a0c8f.cjs.js +7 -0
- package/dist/{ValUI-0f2e6b7d.cjs.prod.js → ValUI-b98a0c8f.cjs.prod.js} +0 -6
- package/dist/{ValUI-ec9857f2.cjs.dev.js → ValUI-dd0484dc.cjs.dev.js} +0 -6
- package/dist/{ValUI-d0e6ed41.esm.js → ValUI-efe41d9a.esm.js} +0 -6
- package/dist/declarations/src/stega/index.d.ts +2 -0
- package/dist/declarations/src/stega/stegaDecodeString.d.ts +1 -0
- package/dist/declarations/src/stega/stegaEncode.d.ts +6 -4
- package/package.json +4 -4
- package/stega/dist/valbuild-react-stega.browser.esm.js +18 -13
- package/stega/dist/valbuild-react-stega.cjs.dev.js +17 -11
- package/stega/dist/valbuild-react-stega.cjs.prod.js +17 -11
- package/stega/dist/valbuild-react-stega.esm.js +18 -13
- package/stega/dist/valbuild-react-stega.worker.esm.js +18 -13
- package/dist/ValUI-0f2e6b7d.cjs.js +0 -7
@@ -646,7 +646,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
|
|
646
646
|
valApi: undefined
|
647
647
|
}) : undefined;
|
648
648
|
var ValUI = /*#__PURE__*/React.lazy(function () {
|
649
|
-
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-
|
649
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-b98a0c8f.cjs.prod.js')); });
|
650
650
|
});
|
651
651
|
function ValProvider(_ref) {
|
652
652
|
var children = _ref.children,
|
@@ -620,7 +620,7 @@ var ValContext = /*#__PURE__*/React.createContext({
|
|
620
620
|
valApi: undefined
|
621
621
|
}) ;
|
622
622
|
var ValUI = /*#__PURE__*/lazy(function () {
|
623
|
-
return import('./ValUI-
|
623
|
+
return import('./ValUI-07905fec.browser.esm.js');
|
624
624
|
});
|
625
625
|
function ValProvider(_ref) {
|
626
626
|
var children = _ref.children,
|
@@ -646,7 +646,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
|
|
646
646
|
valApi: undefined
|
647
647
|
}) : undefined;
|
648
648
|
var ValUI = /*#__PURE__*/React.lazy(function () {
|
649
|
-
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-
|
649
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-dd0484dc.cjs.dev.js')); });
|
650
650
|
});
|
651
651
|
function ValProvider(_ref) {
|
652
652
|
var children = _ref.children,
|
@@ -620,7 +620,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React.createContex
|
|
620
620
|
valApi: undefined
|
621
621
|
}) : undefined;
|
622
622
|
var ValUI = /*#__PURE__*/lazy(function () {
|
623
|
-
return import('./ValUI-
|
623
|
+
return import('./ValUI-efe41d9a.esm.js');
|
624
624
|
});
|
625
625
|
function ValProvider(_ref) {
|
626
626
|
var children = _ref.children,
|
@@ -615,7 +615,7 @@ var useValApi = function useValApi() {
|
|
615
615
|
};
|
616
616
|
var ValContext = undefined;
|
617
617
|
var ValUI = /*#__PURE__*/lazy(function () {
|
618
|
-
return import('./ValUI-
|
618
|
+
return import('./ValUI-15ad1f1e.worker.esm.js');
|
619
619
|
});
|
620
620
|
function ValProvider(_ref) {
|
621
621
|
var children = _ref.children,
|
@@ -50,12 +50,6 @@ function ValUI(props) {
|
|
50
50
|
}
|
51
51
|
return /*#__PURE__*/jsx(Fragment, {
|
52
52
|
children: /*#__PURE__*/jsxs(ShadowRoot, {
|
53
|
-
style: {
|
54
|
-
position: "absolute",
|
55
|
-
top: 0,
|
56
|
-
left: 0,
|
57
|
-
zIndex: 8999 // 1 less than the NextJS error z-index: 9000
|
58
|
-
},
|
59
53
|
children: [/*#__PURE__*/jsx("link", {
|
60
54
|
rel: "preconnect",
|
61
55
|
href: "https://fonts.googleapis.com"
|
@@ -50,12 +50,6 @@ function ValUI(props) {
|
|
50
50
|
}
|
51
51
|
return /*#__PURE__*/jsx(Fragment, {
|
52
52
|
children: /*#__PURE__*/jsxs(ShadowRoot, {
|
53
|
-
style: {
|
54
|
-
position: "absolute",
|
55
|
-
top: 0,
|
56
|
-
left: 0,
|
57
|
-
zIndex: 8999 // 1 less than the NextJS error z-index: 9000
|
58
|
-
},
|
59
53
|
children: [/*#__PURE__*/jsx("link", {
|
60
54
|
rel: "preconnect",
|
61
55
|
href: "https://fonts.googleapis.com"
|
@@ -54,12 +54,6 @@ function ValUI(props) {
|
|
54
54
|
}
|
55
55
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
56
56
|
children: /*#__PURE__*/ReactJSXRuntime.jsxs(ShadowRoot, {
|
57
|
-
style: {
|
58
|
-
position: "absolute",
|
59
|
-
top: 0,
|
60
|
-
left: 0,
|
61
|
-
zIndex: 8999 // 1 less than the NextJS error z-index: 9000
|
62
|
-
},
|
63
57
|
children: [/*#__PURE__*/ReactJSXRuntime.jsx("link", {
|
64
58
|
rel: "preconnect",
|
65
59
|
href: "https://fonts.googleapis.com"
|
@@ -54,12 +54,6 @@ function ValUI(props) {
|
|
54
54
|
}
|
55
55
|
return /*#__PURE__*/ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment, {
|
56
56
|
children: /*#__PURE__*/ReactJSXRuntime.jsxs(ShadowRoot, {
|
57
|
-
style: {
|
58
|
-
position: "absolute",
|
59
|
-
top: 0,
|
60
|
-
left: 0,
|
61
|
-
zIndex: 8999 // 1 less than the NextJS error z-index: 9000
|
62
|
-
},
|
63
57
|
children: [/*#__PURE__*/ReactJSXRuntime.jsx("link", {
|
64
58
|
rel: "preconnect",
|
65
59
|
href: "https://fonts.googleapis.com"
|
@@ -50,12 +50,6 @@ function ValUI(props) {
|
|
50
50
|
}
|
51
51
|
return /*#__PURE__*/jsx(Fragment, {
|
52
52
|
children: /*#__PURE__*/jsxs(ShadowRoot, {
|
53
|
-
style: {
|
54
|
-
position: "absolute",
|
55
|
-
top: 0,
|
56
|
-
left: 0,
|
57
|
-
zIndex: 8999 // 1 less than the NextJS error z-index: 9000
|
58
|
-
},
|
59
53
|
children: [/*#__PURE__*/jsx("link", {
|
60
54
|
rel: "preconnect",
|
61
55
|
href: "https://fonts.googleapis.com"
|
@@ -1,2 +1,4 @@
|
|
1
1
|
export { autoTagJSX } from "./autoTagJSX.js";
|
2
2
|
export { stegaEncode, getModuleIds, stegaClean, type ValEncodedString, type StegaOfSource, } from "./stegaEncode.js";
|
3
|
+
export { type Image } from "./stegaEncode.js";
|
4
|
+
export { stegaDecodeString } from "./stegaDecodeString.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function stegaDecodeString(encodedString: string): string | undefined;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Json, RichTextSource, RichText } from "@valbuild/core";
|
1
|
+
import { Json, RichTextSource, RichText, ImageMetadata } 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";
|
@@ -146,9 +146,11 @@ export type ValEncodedString = `${string}__VAL_ENCODED_STRING_INVISIBLE_CHARS` &
|
|
146
146
|
length: never;
|
147
147
|
[brand]: "ValEncodedString";
|
148
148
|
};
|
149
|
-
export type
|
150
|
-
url: ValEncodedString;
|
151
|
-
|
149
|
+
export type Image = {
|
150
|
+
readonly url: ValEncodedString;
|
151
|
+
readonly metadata?: ImageMetadata;
|
152
|
+
};
|
153
|
+
export type StegaOfSource<T extends Source> = Json extends T ? Json : T extends RichTextSource<infer O> ? RichText<O> : T extends FileSource<infer M> ? M extends ImageMetadata ? Image : T : T extends SourceObject ? {
|
152
154
|
[key in keyof T]: StegaOfSource<T[key]>;
|
153
155
|
} : T extends SourceArray ? StegaOfSource<T[number]>[] : T extends RawString ? string : string extends T ? ValEncodedString : T extends JsonPrimitive ? T : never;
|
154
156
|
export declare function stegaEncode(input: any, opts: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@valbuild/react",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.46.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "Val - React internal helpers",
|
6
6
|
"sideEffects": false,
|
@@ -9,9 +9,9 @@
|
|
9
9
|
"test": "jest"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"@valbuild/core": "~0.
|
13
|
-
"@valbuild/shared": "~0.
|
14
|
-
"@valbuild/ui": "~0.
|
12
|
+
"@valbuild/core": "~0.46.0",
|
13
|
+
"@valbuild/shared": "~0.46.0",
|
14
|
+
"@valbuild/ui": "~0.46.0",
|
15
15
|
"@vercel/stega": "^0.1.0",
|
16
16
|
"base64-arraybuffer": "^1.0.2",
|
17
17
|
"style-to-object": "^0.4.1"
|
@@ -3,11 +3,20 @@ import { _ as _typeof } from '../../dist/typeof-9915e135.browser.esm.js';
|
|
3
3
|
import ReactJSXRuntime__default from 'react/jsx-runtime';
|
4
4
|
import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
|
5
5
|
import React from 'react';
|
6
|
-
import {
|
6
|
+
import { vercelStegaDecode, VERCEL_STEGA_REGEX, vercelStegaSplit, vercelStegaCombine } from '@vercel/stega';
|
7
7
|
import { _ as _defineProperty } from '../../dist/defineProperty-f319cb47.browser.esm.js';
|
8
8
|
import { Internal, VAL_EXTENSION, FILE_REF_PROP } from '@valbuild/core';
|
9
9
|
import { parseRichTextSource } from '@valbuild/shared/internal';
|
10
10
|
|
11
|
+
function stegaDecodeString(encodedString) {
|
12
|
+
var encodedBits = vercelStegaDecode(encodedString);
|
13
|
+
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
|
+
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
15
|
+
return encodedBits.data.valPath;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
11
20
|
var isIntrinsicElement = function isIntrinsicElement(type) {
|
12
21
|
// TODO: think this is not correct, but good enough for now?
|
13
22
|
return typeof type === "string";
|
@@ -20,20 +29,16 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
20
29
|
key = _Object$entries$_i[0],
|
21
30
|
value = _Object$entries$_i[1];
|
22
31
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
23
|
-
var
|
24
|
-
|
25
|
-
if (
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
valSources.push(valPath);
|
30
|
-
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
31
|
-
props["data-val-attr-".concat(key.toLowerCase())] = valPath;
|
32
|
-
}
|
32
|
+
var valPath = stegaDecodeString(value);
|
33
|
+
var attr = "data-val-attr-".concat(key.toLowerCase());
|
34
|
+
if (valPath && !props[attr]) {
|
35
|
+
valSources.push(valPath);
|
36
|
+
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
37
|
+
props[attr] = valPath;
|
33
38
|
}
|
34
39
|
}
|
35
40
|
}
|
36
|
-
if (valSources.length > 0) {
|
41
|
+
if (valSources.length > 0 && !props["data-val-path"]) {
|
37
42
|
props["data-val-path"] = valSources.join(",");
|
38
43
|
}
|
39
44
|
}
|
@@ -285,4 +290,4 @@ function getModuleIds(input) {
|
|
285
290
|
return Array.from(modules);
|
286
291
|
}
|
287
292
|
|
288
|
-
export { autoTagJSX, getModuleIds, stegaClean, stegaEncode };
|
293
|
+
export { autoTagJSX, getModuleIds, stegaClean, stegaDecodeString, stegaEncode };
|
@@ -18,6 +18,15 @@ var ReactJSXRuntime__default = /*#__PURE__*/_interopDefault(ReactJSXRuntime);
|
|
18
18
|
var jsxRuntimeDev__default = /*#__PURE__*/_interopDefault(jsxRuntimeDev);
|
19
19
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
20
20
|
|
21
|
+
function stegaDecodeString(encodedString) {
|
22
|
+
var encodedBits = stega.vercelStegaDecode(encodedString);
|
23
|
+
if (encodedBits && _typeof._typeof(encodedBits) === "object") {
|
24
|
+
if ("origin" in encodedBits && "data" in encodedBits && _typeof._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
25
|
+
return encodedBits.data.valPath;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
21
30
|
var isIntrinsicElement = function isIntrinsicElement(type) {
|
22
31
|
// TODO: think this is not correct, but good enough for now?
|
23
32
|
return typeof type === "string";
|
@@ -30,20 +39,16 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
30
39
|
key = _Object$entries$_i[0],
|
31
40
|
value = _Object$entries$_i[1];
|
32
41
|
if (typeof value === "string" && value.match(stega.VERCEL_STEGA_REGEX)) {
|
33
|
-
var
|
34
|
-
|
35
|
-
if (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
valSources.push(valPath);
|
40
|
-
props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
41
|
-
props["data-val-attr-".concat(key.toLowerCase())] = valPath;
|
42
|
-
}
|
42
|
+
var valPath = stegaDecodeString(value);
|
43
|
+
var attr = "data-val-attr-".concat(key.toLowerCase());
|
44
|
+
if (valPath && !props[attr]) {
|
45
|
+
valSources.push(valPath);
|
46
|
+
props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
47
|
+
props[attr] = valPath;
|
43
48
|
}
|
44
49
|
}
|
45
50
|
}
|
46
|
-
if (valSources.length > 0) {
|
51
|
+
if (valSources.length > 0 && !props["data-val-path"]) {
|
47
52
|
props["data-val-path"] = valSources.join(",");
|
48
53
|
}
|
49
54
|
}
|
@@ -298,4 +303,5 @@ function getModuleIds(input) {
|
|
298
303
|
exports.autoTagJSX = autoTagJSX;
|
299
304
|
exports.getModuleIds = getModuleIds;
|
300
305
|
exports.stegaClean = stegaClean;
|
306
|
+
exports.stegaDecodeString = stegaDecodeString;
|
301
307
|
exports.stegaEncode = stegaEncode;
|
@@ -18,6 +18,15 @@ var ReactJSXRuntime__default = /*#__PURE__*/_interopDefault(ReactJSXRuntime);
|
|
18
18
|
var jsxRuntimeDev__default = /*#__PURE__*/_interopDefault(jsxRuntimeDev);
|
19
19
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
20
20
|
|
21
|
+
function stegaDecodeString(encodedString) {
|
22
|
+
var encodedBits = stega.vercelStegaDecode(encodedString);
|
23
|
+
if (encodedBits && _typeof._typeof(encodedBits) === "object") {
|
24
|
+
if ("origin" in encodedBits && "data" in encodedBits && _typeof._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
25
|
+
return encodedBits.data.valPath;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
21
30
|
var isIntrinsicElement = function isIntrinsicElement(type) {
|
22
31
|
// TODO: think this is not correct, but good enough for now?
|
23
32
|
return typeof type === "string";
|
@@ -30,20 +39,16 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
30
39
|
key = _Object$entries$_i[0],
|
31
40
|
value = _Object$entries$_i[1];
|
32
41
|
if (typeof value === "string" && value.match(stega.VERCEL_STEGA_REGEX)) {
|
33
|
-
var
|
34
|
-
|
35
|
-
if (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
valSources.push(valPath);
|
40
|
-
props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
41
|
-
props["data-val-attr-".concat(key.toLowerCase())] = valPath;
|
42
|
-
}
|
42
|
+
var valPath = stegaDecodeString(value);
|
43
|
+
var attr = "data-val-attr-".concat(key.toLowerCase());
|
44
|
+
if (valPath && !props[attr]) {
|
45
|
+
valSources.push(valPath);
|
46
|
+
props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
47
|
+
props[attr] = valPath;
|
43
48
|
}
|
44
49
|
}
|
45
50
|
}
|
46
|
-
if (valSources.length > 0) {
|
51
|
+
if (valSources.length > 0 && !props["data-val-path"]) {
|
47
52
|
props["data-val-path"] = valSources.join(",");
|
48
53
|
}
|
49
54
|
}
|
@@ -298,4 +303,5 @@ function getModuleIds(input) {
|
|
298
303
|
exports.autoTagJSX = autoTagJSX;
|
299
304
|
exports.getModuleIds = getModuleIds;
|
300
305
|
exports.stegaClean = stegaClean;
|
306
|
+
exports.stegaDecodeString = stegaDecodeString;
|
301
307
|
exports.stegaEncode = stegaEncode;
|
@@ -3,11 +3,20 @@ import { _ as _typeof } from '../../dist/typeof-a1531d8f.esm.js';
|
|
3
3
|
import ReactJSXRuntime__default from 'react/jsx-runtime';
|
4
4
|
import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
|
5
5
|
import React from 'react';
|
6
|
-
import {
|
6
|
+
import { vercelStegaDecode, VERCEL_STEGA_REGEX, vercelStegaSplit, vercelStegaCombine } from '@vercel/stega';
|
7
7
|
import { _ as _defineProperty } from '../../dist/defineProperty-12b5bd29.esm.js';
|
8
8
|
import { Internal, VAL_EXTENSION, FILE_REF_PROP } from '@valbuild/core';
|
9
9
|
import { parseRichTextSource } from '@valbuild/shared/internal';
|
10
10
|
|
11
|
+
function stegaDecodeString(encodedString) {
|
12
|
+
var encodedBits = vercelStegaDecode(encodedString);
|
13
|
+
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
|
+
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
15
|
+
return encodedBits.data.valPath;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
11
20
|
var isIntrinsicElement = function isIntrinsicElement(type) {
|
12
21
|
// TODO: think this is not correct, but good enough for now?
|
13
22
|
return typeof type === "string";
|
@@ -20,20 +29,16 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
20
29
|
key = _Object$entries$_i[0],
|
21
30
|
value = _Object$entries$_i[1];
|
22
31
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
23
|
-
var
|
24
|
-
|
25
|
-
if (
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
valSources.push(valPath);
|
30
|
-
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
31
|
-
props["data-val-attr-".concat(key.toLowerCase())] = valPath;
|
32
|
-
}
|
32
|
+
var valPath = stegaDecodeString(value);
|
33
|
+
var attr = "data-val-attr-".concat(key.toLowerCase());
|
34
|
+
if (valPath && !props[attr]) {
|
35
|
+
valSources.push(valPath);
|
36
|
+
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
37
|
+
props[attr] = valPath;
|
33
38
|
}
|
34
39
|
}
|
35
40
|
}
|
36
|
-
if (valSources.length > 0) {
|
41
|
+
if (valSources.length > 0 && !props["data-val-path"]) {
|
37
42
|
props["data-val-path"] = valSources.join(",");
|
38
43
|
}
|
39
44
|
}
|
@@ -285,4 +290,4 @@ function getModuleIds(input) {
|
|
285
290
|
return Array.from(modules);
|
286
291
|
}
|
287
292
|
|
288
|
-
export { autoTagJSX, getModuleIds, stegaClean, stegaEncode };
|
293
|
+
export { autoTagJSX, getModuleIds, stegaClean, stegaDecodeString, stegaEncode };
|
@@ -3,11 +3,20 @@ import { _ as _typeof } from '../../dist/typeof-e0c837cc.worker.esm.js';
|
|
3
3
|
import ReactJSXRuntime__default from 'react/jsx-runtime';
|
4
4
|
import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
|
5
5
|
import React from 'react';
|
6
|
-
import {
|
6
|
+
import { vercelStegaDecode, VERCEL_STEGA_REGEX, vercelStegaSplit, vercelStegaCombine } from '@vercel/stega';
|
7
7
|
import { _ as _defineProperty } from '../../dist/defineProperty-a4bf59bc.worker.esm.js';
|
8
8
|
import { Internal, VAL_EXTENSION, FILE_REF_PROP } from '@valbuild/core';
|
9
9
|
import { parseRichTextSource } from '@valbuild/shared/internal';
|
10
10
|
|
11
|
+
function stegaDecodeString(encodedString) {
|
12
|
+
var encodedBits = vercelStegaDecode(encodedString);
|
13
|
+
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
|
+
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
15
|
+
return encodedBits.data.valPath;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
11
20
|
var isIntrinsicElement = function isIntrinsicElement(type) {
|
12
21
|
// TODO: think this is not correct, but good enough for now?
|
13
22
|
return typeof type === "string";
|
@@ -20,20 +29,16 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
20
29
|
key = _Object$entries$_i[0],
|
21
30
|
value = _Object$entries$_i[1];
|
22
31
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
23
|
-
var
|
24
|
-
|
25
|
-
if (
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
valSources.push(valPath);
|
30
|
-
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
31
|
-
props["data-val-attr-".concat(key.toLowerCase())] = valPath;
|
32
|
-
}
|
32
|
+
var valPath = stegaDecodeString(value);
|
33
|
+
var attr = "data-val-attr-".concat(key.toLowerCase());
|
34
|
+
if (valPath && !props[attr]) {
|
35
|
+
valSources.push(valPath);
|
36
|
+
props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
37
|
+
props[attr] = valPath;
|
33
38
|
}
|
34
39
|
}
|
35
40
|
}
|
36
|
-
if (valSources.length > 0) {
|
41
|
+
if (valSources.length > 0 && !props["data-val-path"]) {
|
37
42
|
props["data-val-path"] = valSources.join(",");
|
38
43
|
}
|
39
44
|
}
|
@@ -285,4 +290,4 @@ function getModuleIds(input) {
|
|
285
290
|
return Array.from(modules);
|
286
291
|
}
|
287
292
|
|
288
|
-
export { autoTagJSX, getModuleIds, stegaClean, stegaEncode };
|
293
|
+
export { autoTagJSX, getModuleIds, stegaClean, stegaDecodeString, stegaEncode };
|