@valbuild/react 0.60.5 → 0.60.7
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/declarations/src/stega/stegaDecodeString.d.ts +1 -1
- package/package.json +4 -4
- package/stega/dist/valbuild-react-stega.browser.esm.js +22 -6
- package/stega/dist/valbuild-react-stega.cjs.dev.js +22 -6
- package/stega/dist/valbuild-react-stega.cjs.prod.js +22 -6
- package/stega/dist/valbuild-react-stega.esm.js +22 -6
- package/stega/dist/valbuild-react-stega.worker.esm.js +22 -6
@@ -1 +1 @@
|
|
1
|
-
export declare function stegaDecodeString(encodedString:
|
1
|
+
export declare function stegaDecodeString(encodedString: unknown): string | undefined;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@valbuild/react",
|
3
|
-
"version": "0.60.
|
3
|
+
"version": "0.60.7",
|
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.60.
|
13
|
-
"@valbuild/shared": "~0.60.
|
14
|
-
"@valbuild/ui": "~0.60.
|
12
|
+
"@valbuild/core": "~0.60.7",
|
13
|
+
"@valbuild/shared": "~0.60.7",
|
14
|
+
"@valbuild/ui": "~0.60.7",
|
15
15
|
"@vercel/stega": "^0.1.0",
|
16
16
|
"base64-arraybuffer": "^1.0.2"
|
17
17
|
},
|
@@ -9,6 +9,7 @@ import { parseRichTextSource } from '@valbuild/shared/internal';
|
|
9
9
|
import '../../dist/unsupportedIterableToArray-cce3cb41.browser.esm.js';
|
10
10
|
|
11
11
|
function stegaDecodeString(encodedString) {
|
12
|
+
if (!encodedString || typeof encodedString !== "string") return;
|
12
13
|
var encodedBits = vercelStegaDecode(encodedString);
|
13
14
|
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
15
|
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
@@ -23,14 +24,29 @@ var isIntrinsicElement = function isIntrinsicElement(type) {
|
|
23
24
|
};
|
24
25
|
var addValPathIfFound = function addValPathIfFound(type, props) {
|
25
26
|
var valSources = [];
|
26
|
-
|
27
|
+
|
28
|
+
// skip auto-tagging fragments since we can't add attributes to them
|
29
|
+
if (type === Symbol["for"]("react.fragment")) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
function updateValSources(key, value, props, container) {
|
33
|
+
if (!key) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
// Prevent prototype pollution
|
37
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
38
|
+
console.error('Val: Could not auto tag. Reason: key is "__proto__" or "constructor" or "prototype".');
|
39
|
+
return;
|
40
|
+
}
|
27
41
|
var valPath = stegaDecodeString(value);
|
28
42
|
var attr = "data-val-attr-".concat(key.toString().toLowerCase());
|
29
43
|
if (valPath && !props[attr]) {
|
30
44
|
valSources.push(valPath);
|
31
45
|
var cleanValue = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
32
|
-
|
33
|
-
|
46
|
+
// we do Object.entries earlier over props so props that are arrays have string keys:
|
47
|
+
var numberOfKey = Number(key);
|
48
|
+
if (Array.isArray(container) && numberOfKey > -1) {
|
49
|
+
container[numberOfKey] = cleanValue;
|
34
50
|
} else if (typeof key === "string" && !Array.isArray(container)) {
|
35
51
|
container[key] = cleanValue;
|
36
52
|
} else {
|
@@ -45,7 +61,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
45
61
|
key = _Object$entries$_i[0],
|
46
62
|
value = _Object$entries$_i[1];
|
47
63
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
48
|
-
|
64
|
+
updateValSources(key, value, props, props);
|
49
65
|
} else if (_typeof(value) === "object" && value !== null) {
|
50
66
|
if (key === "style") {
|
51
67
|
for (var _i2 = 0, _Object$entries2 = Object.entries(value); _i2 < _Object$entries2.length; _i2++) {
|
@@ -53,7 +69,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
53
69
|
styleKey = _Object$entries2$_i[0],
|
54
70
|
styleValue = _Object$entries2$_i[1];
|
55
71
|
if (typeof styleValue === "string" && styleValue.match(VERCEL_STEGA_REGEX)) {
|
56
|
-
|
72
|
+
updateValSources(styleKey, styleValue, props, value);
|
57
73
|
}
|
58
74
|
}
|
59
75
|
} else if (value instanceof Array) {
|
@@ -62,7 +78,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
62
78
|
index = _Object$entries3$_i[0],
|
63
79
|
item = _Object$entries3$_i[1];
|
64
80
|
if (typeof item === "string" && item.match(VERCEL_STEGA_REGEX)) {
|
65
|
-
|
81
|
+
updateValSources(index, item, props, value);
|
66
82
|
}
|
67
83
|
}
|
68
84
|
}
|
@@ -19,6 +19,7 @@ var jsxRuntimeDev__default = /*#__PURE__*/_interopDefault(jsxRuntimeDev);
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
20
20
|
|
21
21
|
function stegaDecodeString(encodedString) {
|
22
|
+
if (!encodedString || typeof encodedString !== "string") return;
|
22
23
|
var encodedBits = stega.vercelStegaDecode(encodedString);
|
23
24
|
if (encodedBits && slicedToArray._typeof(encodedBits) === "object") {
|
24
25
|
if ("origin" in encodedBits && "data" in encodedBits && slicedToArray._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
@@ -33,14 +34,29 @@ var isIntrinsicElement = function isIntrinsicElement(type) {
|
|
33
34
|
};
|
34
35
|
var addValPathIfFound = function addValPathIfFound(type, props) {
|
35
36
|
var valSources = [];
|
36
|
-
|
37
|
+
|
38
|
+
// skip auto-tagging fragments since we can't add attributes to them
|
39
|
+
if (type === Symbol["for"]("react.fragment")) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
function updateValSources(key, value, props, container) {
|
43
|
+
if (!key) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
// Prevent prototype pollution
|
47
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
48
|
+
console.error('Val: Could not auto tag. Reason: key is "__proto__" or "constructor" or "prototype".');
|
49
|
+
return;
|
50
|
+
}
|
37
51
|
var valPath = stegaDecodeString(value);
|
38
52
|
var attr = "data-val-attr-".concat(key.toString().toLowerCase());
|
39
53
|
if (valPath && !props[attr]) {
|
40
54
|
valSources.push(valPath);
|
41
55
|
var cleanValue = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
42
|
-
|
43
|
-
|
56
|
+
// we do Object.entries earlier over props so props that are arrays have string keys:
|
57
|
+
var numberOfKey = Number(key);
|
58
|
+
if (Array.isArray(container) && numberOfKey > -1) {
|
59
|
+
container[numberOfKey] = cleanValue;
|
44
60
|
} else if (typeof key === "string" && !Array.isArray(container)) {
|
45
61
|
container[key] = cleanValue;
|
46
62
|
} else {
|
@@ -55,7 +71,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
55
71
|
key = _Object$entries$_i[0],
|
56
72
|
value = _Object$entries$_i[1];
|
57
73
|
if (typeof value === "string" && value.match(stega.VERCEL_STEGA_REGEX)) {
|
58
|
-
|
74
|
+
updateValSources(key, value, props, props);
|
59
75
|
} else if (slicedToArray._typeof(value) === "object" && value !== null) {
|
60
76
|
if (key === "style") {
|
61
77
|
for (var _i2 = 0, _Object$entries2 = Object.entries(value); _i2 < _Object$entries2.length; _i2++) {
|
@@ -63,7 +79,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
63
79
|
styleKey = _Object$entries2$_i[0],
|
64
80
|
styleValue = _Object$entries2$_i[1];
|
65
81
|
if (typeof styleValue === "string" && styleValue.match(stega.VERCEL_STEGA_REGEX)) {
|
66
|
-
|
82
|
+
updateValSources(styleKey, styleValue, props, value);
|
67
83
|
}
|
68
84
|
}
|
69
85
|
} else if (value instanceof Array) {
|
@@ -72,7 +88,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
72
88
|
index = _Object$entries3$_i[0],
|
73
89
|
item = _Object$entries3$_i[1];
|
74
90
|
if (typeof item === "string" && item.match(stega.VERCEL_STEGA_REGEX)) {
|
75
|
-
|
91
|
+
updateValSources(index, item, props, value);
|
76
92
|
}
|
77
93
|
}
|
78
94
|
}
|
@@ -19,6 +19,7 @@ var jsxRuntimeDev__default = /*#__PURE__*/_interopDefault(jsxRuntimeDev);
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
20
20
|
|
21
21
|
function stegaDecodeString(encodedString) {
|
22
|
+
if (!encodedString || typeof encodedString !== "string") return;
|
22
23
|
var encodedBits = stega.vercelStegaDecode(encodedString);
|
23
24
|
if (encodedBits && slicedToArray._typeof(encodedBits) === "object") {
|
24
25
|
if ("origin" in encodedBits && "data" in encodedBits && slicedToArray._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
@@ -33,14 +34,29 @@ var isIntrinsicElement = function isIntrinsicElement(type) {
|
|
33
34
|
};
|
34
35
|
var addValPathIfFound = function addValPathIfFound(type, props) {
|
35
36
|
var valSources = [];
|
36
|
-
|
37
|
+
|
38
|
+
// skip auto-tagging fragments since we can't add attributes to them
|
39
|
+
if (type === Symbol["for"]("react.fragment")) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
function updateValSources(key, value, props, container) {
|
43
|
+
if (!key) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
// Prevent prototype pollution
|
47
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
48
|
+
console.error('Val: Could not auto tag. Reason: key is "__proto__" or "constructor" or "prototype".');
|
49
|
+
return;
|
50
|
+
}
|
37
51
|
var valPath = stegaDecodeString(value);
|
38
52
|
var attr = "data-val-attr-".concat(key.toString().toLowerCase());
|
39
53
|
if (valPath && !props[attr]) {
|
40
54
|
valSources.push(valPath);
|
41
55
|
var cleanValue = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
|
42
|
-
|
43
|
-
|
56
|
+
// we do Object.entries earlier over props so props that are arrays have string keys:
|
57
|
+
var numberOfKey = Number(key);
|
58
|
+
if (Array.isArray(container) && numberOfKey > -1) {
|
59
|
+
container[numberOfKey] = cleanValue;
|
44
60
|
} else if (typeof key === "string" && !Array.isArray(container)) {
|
45
61
|
container[key] = cleanValue;
|
46
62
|
} else {
|
@@ -55,7 +71,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
55
71
|
key = _Object$entries$_i[0],
|
56
72
|
value = _Object$entries$_i[1];
|
57
73
|
if (typeof value === "string" && value.match(stega.VERCEL_STEGA_REGEX)) {
|
58
|
-
|
74
|
+
updateValSources(key, value, props, props);
|
59
75
|
} else if (slicedToArray._typeof(value) === "object" && value !== null) {
|
60
76
|
if (key === "style") {
|
61
77
|
for (var _i2 = 0, _Object$entries2 = Object.entries(value); _i2 < _Object$entries2.length; _i2++) {
|
@@ -63,7 +79,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
63
79
|
styleKey = _Object$entries2$_i[0],
|
64
80
|
styleValue = _Object$entries2$_i[1];
|
65
81
|
if (typeof styleValue === "string" && styleValue.match(stega.VERCEL_STEGA_REGEX)) {
|
66
|
-
|
82
|
+
updateValSources(styleKey, styleValue, props, value);
|
67
83
|
}
|
68
84
|
}
|
69
85
|
} else if (value instanceof Array) {
|
@@ -72,7 +88,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
72
88
|
index = _Object$entries3$_i[0],
|
73
89
|
item = _Object$entries3$_i[1];
|
74
90
|
if (typeof item === "string" && item.match(stega.VERCEL_STEGA_REGEX)) {
|
75
|
-
|
91
|
+
updateValSources(index, item, props, value);
|
76
92
|
}
|
77
93
|
}
|
78
94
|
}
|
@@ -9,6 +9,7 @@ import { parseRichTextSource } from '@valbuild/shared/internal';
|
|
9
9
|
import '../../dist/unsupportedIterableToArray-7c30dadf.esm.js';
|
10
10
|
|
11
11
|
function stegaDecodeString(encodedString) {
|
12
|
+
if (!encodedString || typeof encodedString !== "string") return;
|
12
13
|
var encodedBits = vercelStegaDecode(encodedString);
|
13
14
|
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
15
|
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
@@ -23,14 +24,29 @@ var isIntrinsicElement = function isIntrinsicElement(type) {
|
|
23
24
|
};
|
24
25
|
var addValPathIfFound = function addValPathIfFound(type, props) {
|
25
26
|
var valSources = [];
|
26
|
-
|
27
|
+
|
28
|
+
// skip auto-tagging fragments since we can't add attributes to them
|
29
|
+
if (type === Symbol["for"]("react.fragment")) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
function updateValSources(key, value, props, container) {
|
33
|
+
if (!key) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
// Prevent prototype pollution
|
37
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
38
|
+
console.error('Val: Could not auto tag. Reason: key is "__proto__" or "constructor" or "prototype".');
|
39
|
+
return;
|
40
|
+
}
|
27
41
|
var valPath = stegaDecodeString(value);
|
28
42
|
var attr = "data-val-attr-".concat(key.toString().toLowerCase());
|
29
43
|
if (valPath && !props[attr]) {
|
30
44
|
valSources.push(valPath);
|
31
45
|
var cleanValue = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
32
|
-
|
33
|
-
|
46
|
+
// we do Object.entries earlier over props so props that are arrays have string keys:
|
47
|
+
var numberOfKey = Number(key);
|
48
|
+
if (Array.isArray(container) && numberOfKey > -1) {
|
49
|
+
container[numberOfKey] = cleanValue;
|
34
50
|
} else if (typeof key === "string" && !Array.isArray(container)) {
|
35
51
|
container[key] = cleanValue;
|
36
52
|
} else {
|
@@ -45,7 +61,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
45
61
|
key = _Object$entries$_i[0],
|
46
62
|
value = _Object$entries$_i[1];
|
47
63
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
48
|
-
|
64
|
+
updateValSources(key, value, props, props);
|
49
65
|
} else if (_typeof(value) === "object" && value !== null) {
|
50
66
|
if (key === "style") {
|
51
67
|
for (var _i2 = 0, _Object$entries2 = Object.entries(value); _i2 < _Object$entries2.length; _i2++) {
|
@@ -53,7 +69,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
53
69
|
styleKey = _Object$entries2$_i[0],
|
54
70
|
styleValue = _Object$entries2$_i[1];
|
55
71
|
if (typeof styleValue === "string" && styleValue.match(VERCEL_STEGA_REGEX)) {
|
56
|
-
|
72
|
+
updateValSources(styleKey, styleValue, props, value);
|
57
73
|
}
|
58
74
|
}
|
59
75
|
} else if (value instanceof Array) {
|
@@ -62,7 +78,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
62
78
|
index = _Object$entries3$_i[0],
|
63
79
|
item = _Object$entries3$_i[1];
|
64
80
|
if (typeof item === "string" && item.match(VERCEL_STEGA_REGEX)) {
|
65
|
-
|
81
|
+
updateValSources(index, item, props, value);
|
66
82
|
}
|
67
83
|
}
|
68
84
|
}
|
@@ -9,6 +9,7 @@ import { parseRichTextSource } from '@valbuild/shared/internal';
|
|
9
9
|
import '../../dist/unsupportedIterableToArray-50359a05.worker.esm.js';
|
10
10
|
|
11
11
|
function stegaDecodeString(encodedString) {
|
12
|
+
if (!encodedString || typeof encodedString !== "string") return;
|
12
13
|
var encodedBits = vercelStegaDecode(encodedString);
|
13
14
|
if (encodedBits && _typeof(encodedBits) === "object") {
|
14
15
|
if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data && typeof encodedBits.data.valPath === "string") {
|
@@ -23,14 +24,29 @@ var isIntrinsicElement = function isIntrinsicElement(type) {
|
|
23
24
|
};
|
24
25
|
var addValPathIfFound = function addValPathIfFound(type, props) {
|
25
26
|
var valSources = [];
|
26
|
-
|
27
|
+
|
28
|
+
// skip auto-tagging fragments since we can't add attributes to them
|
29
|
+
if (type === Symbol["for"]("react.fragment")) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
function updateValSources(key, value, props, container) {
|
33
|
+
if (!key) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
// Prevent prototype pollution
|
37
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
38
|
+
console.error('Val: Could not auto tag. Reason: key is "__proto__" or "constructor" or "prototype".');
|
39
|
+
return;
|
40
|
+
}
|
27
41
|
var valPath = stegaDecodeString(value);
|
28
42
|
var attr = "data-val-attr-".concat(key.toString().toLowerCase());
|
29
43
|
if (valPath && !props[attr]) {
|
30
44
|
valSources.push(valPath);
|
31
45
|
var cleanValue = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
|
32
|
-
|
33
|
-
|
46
|
+
// we do Object.entries earlier over props so props that are arrays have string keys:
|
47
|
+
var numberOfKey = Number(key);
|
48
|
+
if (Array.isArray(container) && numberOfKey > -1) {
|
49
|
+
container[numberOfKey] = cleanValue;
|
34
50
|
} else if (typeof key === "string" && !Array.isArray(container)) {
|
35
51
|
container[key] = cleanValue;
|
36
52
|
} else {
|
@@ -45,7 +61,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
45
61
|
key = _Object$entries$_i[0],
|
46
62
|
value = _Object$entries$_i[1];
|
47
63
|
if (typeof value === "string" && value.match(VERCEL_STEGA_REGEX)) {
|
48
|
-
|
64
|
+
updateValSources(key, value, props, props);
|
49
65
|
} else if (_typeof(value) === "object" && value !== null) {
|
50
66
|
if (key === "style") {
|
51
67
|
for (var _i2 = 0, _Object$entries2 = Object.entries(value); _i2 < _Object$entries2.length; _i2++) {
|
@@ -53,7 +69,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
53
69
|
styleKey = _Object$entries2$_i[0],
|
54
70
|
styleValue = _Object$entries2$_i[1];
|
55
71
|
if (typeof styleValue === "string" && styleValue.match(VERCEL_STEGA_REGEX)) {
|
56
|
-
|
72
|
+
updateValSources(styleKey, styleValue, props, value);
|
57
73
|
}
|
58
74
|
}
|
59
75
|
} else if (value instanceof Array) {
|
@@ -62,7 +78,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
|
|
62
78
|
index = _Object$entries3$_i[0],
|
63
79
|
item = _Object$entries3$_i[1];
|
64
80
|
if (typeof item === "string" && item.match(VERCEL_STEGA_REGEX)) {
|
65
|
-
|
81
|
+
updateValSources(index, item, props, value);
|
66
82
|
}
|
67
83
|
}
|
68
84
|
}
|