@valbuild/react 0.43.1 → 0.45.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.js +7 -0
- package/dist/{ValProvider-8d8e3678.cjs.prod.js → ValProvider-1bf1d7e4.cjs.prod.js} +12 -6
- package/dist/{ValProvider-9a2431d9.browser.esm.js → ValProvider-36edbac3.browser.esm.js} +17 -5
- package/dist/{ValProvider-387a3070.cjs.dev.js → ValProvider-3f3f21ba.cjs.dev.js} +17 -5
- package/dist/{ValProvider-52a0ce49.esm.js → ValProvider-87475f3a.esm.js} +17 -5
- package/dist/{ValProvider-e21d3e7d.worker.esm.js → ValProvider-a29fe950.worker.esm.js} +17 -5
- package/dist/ValUI-0f2e6b7d.cjs.prod.js +1 -1
- package/dist/ValUI-3fac1b71.worker.esm.js +1 -1
- package/dist/ValUI-4d8bf402.browser.esm.js +1 -1
- package/dist/ValUI-d0e6ed41.esm.js +1 -1
- package/dist/ValUI-ec9857f2.cjs.dev.js +1 -1
- 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/internal/dist/valbuild-react-internal.browser.esm.js +1 -1
- package/internal/dist/valbuild-react-internal.cjs.dev.js +1 -1
- package/internal/dist/valbuild-react-internal.cjs.prod.js +1 -1
- package/internal/dist/valbuild-react-internal.esm.js +1 -1
- package/internal/dist/valbuild-react-internal.worker.esm.js +1 -1
- 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/ValProvider-8d8e3678.cjs.js +0 -7
@@ -662,25 +662,31 @@ function ValProvider(_ref) {
|
|
662
662
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
663
663
|
isClient = _useState2[0],
|
664
664
|
setIsClient = _useState2[1];
|
665
|
-
var _useState3 = React.useState(
|
665
|
+
var _useState3 = React.useState(),
|
666
666
|
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
667
667
|
enabled = _useState4[0],
|
668
668
|
setEnabled = _useState4[1];
|
669
669
|
React.useEffect(function () {
|
670
670
|
setIsClient(true);
|
671
671
|
try {
|
672
|
-
var _document$cookie;
|
672
|
+
var _document$cookie, _document$cookie2;
|
673
673
|
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
674
|
-
|
674
|
+
if (valEnabled) {
|
675
|
+
setEnabled(true);
|
676
|
+
}
|
677
|
+
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
678
|
+
if (valDisabled) {
|
679
|
+
setEnabled(false);
|
680
|
+
}
|
681
|
+
// If we are in development and Val is not enabled or disabled, enable Val
|
682
|
+
if ( "production" === "development" && !valEnabled && !valDisabled) ;
|
675
683
|
} catch (e) {
|
676
684
|
console.warn("Could not read Val enabled state", e);
|
677
685
|
}
|
678
686
|
}, []);
|
679
|
-
if (isClient && !enabled
|
687
|
+
if (isClient && !enabled) {
|
680
688
|
if (!api) {
|
681
689
|
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
682
|
-
} else {
|
683
|
-
console.log("Val is disabled. Enable it by going here ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
|
684
690
|
}
|
685
691
|
}
|
686
692
|
if (!isClient || !enabled || !store || !api || !ValContext) {
|
@@ -636,25 +636,37 @@ function ValProvider(_ref) {
|
|
636
636
|
_useState2 = _slicedToArray(_useState, 2),
|
637
637
|
isClient = _useState2[0],
|
638
638
|
setIsClient = _useState2[1];
|
639
|
-
var _useState3 = useState(
|
639
|
+
var _useState3 = useState(),
|
640
640
|
_useState4 = _slicedToArray(_useState3, 2),
|
641
641
|
enabled = _useState4[0],
|
642
642
|
setEnabled = _useState4[1];
|
643
643
|
useEffect(function () {
|
644
644
|
setIsClient(true);
|
645
645
|
try {
|
646
|
-
var _document$cookie;
|
646
|
+
var _document$cookie, _document$cookie2;
|
647
647
|
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
648
|
-
|
648
|
+
if (valEnabled) {
|
649
|
+
setEnabled(true);
|
650
|
+
}
|
651
|
+
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
652
|
+
if (valDisabled) {
|
653
|
+
setEnabled(false);
|
654
|
+
}
|
655
|
+
// If we are in development and Val is not enabled or disabled, enable Val
|
656
|
+
if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
|
657
|
+
window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
|
658
|
+
}
|
649
659
|
} catch (e) {
|
650
660
|
console.warn("Could not read Val enabled state", e);
|
651
661
|
}
|
652
662
|
}, []);
|
653
|
-
if (isClient && !enabled
|
663
|
+
if (isClient && !enabled) {
|
654
664
|
if (!api) {
|
655
665
|
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
656
666
|
} else {
|
657
|
-
|
667
|
+
if (process.env.NODE_ENV === "development") {
|
668
|
+
console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
|
669
|
+
}
|
658
670
|
}
|
659
671
|
}
|
660
672
|
if (!isClient || !enabled || !store || !api || !ValContext) {
|
@@ -662,25 +662,37 @@ function ValProvider(_ref) {
|
|
662
662
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
663
663
|
isClient = _useState2[0],
|
664
664
|
setIsClient = _useState2[1];
|
665
|
-
var _useState3 = React.useState(
|
665
|
+
var _useState3 = React.useState(),
|
666
666
|
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
667
667
|
enabled = _useState4[0],
|
668
668
|
setEnabled = _useState4[1];
|
669
669
|
React.useEffect(function () {
|
670
670
|
setIsClient(true);
|
671
671
|
try {
|
672
|
-
var _document$cookie;
|
672
|
+
var _document$cookie, _document$cookie2;
|
673
673
|
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
674
|
-
|
674
|
+
if (valEnabled) {
|
675
|
+
setEnabled(true);
|
676
|
+
}
|
677
|
+
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
678
|
+
if (valDisabled) {
|
679
|
+
setEnabled(false);
|
680
|
+
}
|
681
|
+
// If we are in development and Val is not enabled or disabled, enable Val
|
682
|
+
if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
|
683
|
+
window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
|
684
|
+
}
|
675
685
|
} catch (e) {
|
676
686
|
console.warn("Could not read Val enabled state", e);
|
677
687
|
}
|
678
688
|
}, []);
|
679
|
-
if (isClient && !enabled
|
689
|
+
if (isClient && !enabled) {
|
680
690
|
if (!api) {
|
681
691
|
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
682
692
|
} else {
|
683
|
-
|
693
|
+
if (process.env.NODE_ENV === "development") {
|
694
|
+
console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
|
695
|
+
}
|
684
696
|
}
|
685
697
|
}
|
686
698
|
if (!isClient || !enabled || !store || !api || !ValContext) {
|
@@ -636,25 +636,37 @@ function ValProvider(_ref) {
|
|
636
636
|
_useState2 = _slicedToArray(_useState, 2),
|
637
637
|
isClient = _useState2[0],
|
638
638
|
setIsClient = _useState2[1];
|
639
|
-
var _useState3 = useState(
|
639
|
+
var _useState3 = useState(),
|
640
640
|
_useState4 = _slicedToArray(_useState3, 2),
|
641
641
|
enabled = _useState4[0],
|
642
642
|
setEnabled = _useState4[1];
|
643
643
|
useEffect(function () {
|
644
644
|
setIsClient(true);
|
645
645
|
try {
|
646
|
-
var _document$cookie;
|
646
|
+
var _document$cookie, _document$cookie2;
|
647
647
|
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
648
|
-
|
648
|
+
if (valEnabled) {
|
649
|
+
setEnabled(true);
|
650
|
+
}
|
651
|
+
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
652
|
+
if (valDisabled) {
|
653
|
+
setEnabled(false);
|
654
|
+
}
|
655
|
+
// If we are in development and Val is not enabled or disabled, enable Val
|
656
|
+
if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
|
657
|
+
window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
|
658
|
+
}
|
649
659
|
} catch (e) {
|
650
660
|
console.warn("Could not read Val enabled state", e);
|
651
661
|
}
|
652
662
|
}, []);
|
653
|
-
if (isClient && !enabled
|
663
|
+
if (isClient && !enabled) {
|
654
664
|
if (!api) {
|
655
665
|
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
656
666
|
} else {
|
657
|
-
|
667
|
+
if (process.env.NODE_ENV === "development") {
|
668
|
+
console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
|
669
|
+
}
|
658
670
|
}
|
659
671
|
}
|
660
672
|
if (!isClient || !enabled || !store || !api || !ValContext) {
|
@@ -631,25 +631,37 @@ function ValProvider(_ref) {
|
|
631
631
|
_useState2 = _slicedToArray(_useState, 2),
|
632
632
|
isClient = _useState2[0],
|
633
633
|
setIsClient = _useState2[1];
|
634
|
-
var _useState3 = useState(
|
634
|
+
var _useState3 = useState(),
|
635
635
|
_useState4 = _slicedToArray(_useState3, 2),
|
636
636
|
enabled = _useState4[0],
|
637
637
|
setEnabled = _useState4[1];
|
638
638
|
useEffect(function () {
|
639
639
|
setIsClient(true);
|
640
640
|
try {
|
641
|
-
var _document$cookie;
|
641
|
+
var _document$cookie, _document$cookie2;
|
642
642
|
var valEnabled = (_document$cookie = document.cookie) === null || _document$cookie === void 0 ? void 0 : _document$cookie.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=true"));
|
643
|
-
|
643
|
+
if (valEnabled) {
|
644
|
+
setEnabled(true);
|
645
|
+
}
|
646
|
+
var valDisabled = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_ENABLE_COOKIE_NAME, "=false"));
|
647
|
+
if (valDisabled) {
|
648
|
+
setEnabled(false);
|
649
|
+
}
|
650
|
+
// If we are in development and Val is not enabled or disabled, enable Val
|
651
|
+
if (process.env.NODE_ENV === "development" && !valEnabled && !valDisabled) {
|
652
|
+
window.location.href = "".concat(window.origin).concat(host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href));
|
653
|
+
}
|
644
654
|
} catch (e) {
|
645
655
|
console.warn("Could not read Val enabled state", e);
|
646
656
|
}
|
647
657
|
}, []);
|
648
|
-
if (isClient && !enabled
|
658
|
+
if (isClient && !enabled) {
|
649
659
|
if (!api) {
|
650
660
|
console.warn("Val does not seem to be configured properly! Please check that you have wrapper your root layout (or _app) with the ValProvider.");
|
651
661
|
} else {
|
652
|
-
|
662
|
+
if (process.env.NODE_ENV === "development") {
|
663
|
+
console.log("Val is disabled. Enable it by going here: ".concat(window.origin).concat(api.host, "/enable?redirect_to=").concat(encodeURIComponent(window.location.href), ". NOTE: this message appears because NODE_ENV is set to development."));
|
664
|
+
}
|
653
665
|
}
|
654
666
|
}
|
655
667
|
if (!isClient || !enabled || !store || !api || !ValContext) {
|
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a2a426c7.cjs.prod.js');
|
|
8
8
|
var React = require('react');
|
9
9
|
var reactDom = require('react-dom');
|
10
10
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
11
|
-
var ValProvider = require('./ValProvider-
|
11
|
+
var ValProvider = require('./ValProvider-1bf1d7e4.cjs.prod.js');
|
12
12
|
|
13
13
|
function ShadowContent(_ref) {
|
14
14
|
var root = _ref.root,
|
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-d4c4a4ed.worker.esm.js';
|
|
4
4
|
import { useRef, useState, useLayoutEffect } from 'react';
|
5
5
|
import { createPortal } from 'react-dom';
|
6
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
7
|
-
import { useValApi, useValStore } from './ValProvider-
|
7
|
+
import { useValApi, useValStore } from './ValProvider-a29fe950.worker.esm.js';
|
8
8
|
|
9
9
|
function ShadowContent(_ref) {
|
10
10
|
var root = _ref.root,
|
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-85f6bb43.browser.esm.js';
|
|
4
4
|
import { useRef, useState, useLayoutEffect } from 'react';
|
5
5
|
import { createPortal } from 'react-dom';
|
6
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
7
|
-
import { useValApi, useValStore } from './ValProvider-
|
7
|
+
import { useValApi, useValStore } from './ValProvider-36edbac3.browser.esm.js';
|
8
8
|
|
9
9
|
function ShadowContent(_ref) {
|
10
10
|
var root = _ref.root,
|
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-331bebbb.esm.js';
|
|
4
4
|
import { useRef, useState, useLayoutEffect } from 'react';
|
5
5
|
import { createPortal } from 'react-dom';
|
6
6
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
7
|
-
import { useValApi, useValStore } from './ValProvider-
|
7
|
+
import { useValApi, useValStore } from './ValProvider-87475f3a.esm.js';
|
8
8
|
|
9
9
|
function ShadowContent(_ref) {
|
10
10
|
var root = _ref.root,
|
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a9d0d9cd.cjs.dev.js');
|
|
8
8
|
var React = require('react');
|
9
9
|
var reactDom = require('react-dom');
|
10
10
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
11
|
-
var ValProvider = require('./ValProvider-
|
11
|
+
var ValProvider = require('./ValProvider-3f3f21ba.cjs.dev.js');
|
12
12
|
|
13
13
|
function ShadowContent(_ref) {
|
14
14
|
var root = _ref.root,
|
@@ -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: {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-
|
1
|
+
export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-36edbac3.browser.esm.js';
|
2
2
|
import React from 'react';
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
4
4
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ValProvider = require('../../dist/ValProvider-
|
5
|
+
var ValProvider = require('../../dist/ValProvider-3f3f21ba.cjs.dev.js');
|
6
6
|
var React = require('react');
|
7
7
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var ValProvider = require('../../dist/ValProvider-
|
5
|
+
var ValProvider = require('../../dist/ValProvider-1bf1d7e4.cjs.prod.js');
|
6
6
|
var React = require('react');
|
7
7
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
8
8
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-
|
1
|
+
export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-a29fe950.worker.esm.js';
|
2
2
|
import React from 'react';
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
4
4
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@valbuild/react",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.45.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.45.0",
|
13
|
+
"@valbuild/shared": "~0.45.0",
|
14
|
+
"@valbuild/ui": "~0.45.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)] = 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)] = 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)] = 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)] = 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)] = 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 };
|