@storyblok/react 5.4.9 → 5.4.10
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/utils.js +1 -1
- package/dist/utils.mjs +50 -26
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");function f(e){return e.replace(/-([a-z])/g,o=>o[1].toUpperCase())}function m(e){return e.split(";").reduce((o,i)=>{let[t,n]=i.split(":");return t=t==null?void 0:t.trim(),n=n==null?void 0:n.trim(),t&&n&&(o[f(t)]=n),o},{})}function c(e){if(Array.isArray(e))return e.map(r=>c(r));const o={allowfullscreen:"allowFullScreen",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",charset:"charSet",class:"className",colspan:"colSpan",colwidth:"colWidth",contenteditable:"contentEditable",crossorigin:"crossOrigin",enctype:"encType",for:"htmlFor",formnovalidate:"formNoValidate",frameborder:"frameBorder",inputmode:"inputMode",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",minlength:"minLength",novalidate:"noValidate",playsinline:"playsInline",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",srcset:"srcSet",tabindex:"tabIndex",targetAttr:"targetattr",usemap:"useMap"},i=Object.keys(e.props).reduce((r,a)=>{let s=e.props[a];a==="style"&&typeof s=="string"&&(s=m(s));const u=o[a]||a;return r[u]=s,r},{});i.key=e.key;const t=d.Children.map(e.props.children,r=>typeof r=="string"?r:c(r));return d.createElement(e.type,i,t)}const l=()=>typeof window<"u",g=()=>typeof window>"u",w=()=>l()&&typeof window.storyblokRegisterEvent<"u",p=()=>l()&&window.self!==window.top,y=()=>l()&&p()&&window.location.search.includes("_storyblok");exports.convertAttributesInElement=c;exports.isBridgeLoaded=w;exports.isBrowser=l;exports.isIframe=p;exports.isServer=g;exports.isVisualEditor=y;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,37 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
import c from "react";
|
|
2
|
+
function u(e) {
|
|
3
|
+
return e.replace(/-([a-z])/g, (o) => o[1].toUpperCase());
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
let [
|
|
8
|
-
return
|
|
5
|
+
function f(e) {
|
|
6
|
+
return e.split(";").reduce((o, i) => {
|
|
7
|
+
let [t, n] = i.split(":");
|
|
8
|
+
return t = t == null ? void 0 : t.trim(), n = n == null ? void 0 : n.trim(), t && n && (o[u(t)] = n), o;
|
|
9
9
|
}, {});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
if (Array.isArray(
|
|
13
|
-
return
|
|
11
|
+
function p(e) {
|
|
12
|
+
if (Array.isArray(e))
|
|
13
|
+
return e.map((r) => p(r));
|
|
14
14
|
const o = {
|
|
15
|
+
allowfullscreen: "allowFullScreen",
|
|
16
|
+
autocomplete: "autoComplete",
|
|
17
|
+
autofocus: "autoFocus",
|
|
18
|
+
autoplay: "autoPlay",
|
|
19
|
+
charset: "charSet",
|
|
15
20
|
class: "className",
|
|
21
|
+
colspan: "colSpan",
|
|
22
|
+
colwidth: "colWidth",
|
|
23
|
+
contenteditable: "contentEditable",
|
|
24
|
+
crossorigin: "crossOrigin",
|
|
25
|
+
enctype: "encType",
|
|
16
26
|
for: "htmlFor",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
formnovalidate: "formNoValidate",
|
|
28
|
+
frameborder: "frameBorder",
|
|
29
|
+
inputmode: "inputMode",
|
|
30
|
+
marginheight: "marginHeight",
|
|
31
|
+
marginwidth: "marginWidth",
|
|
32
|
+
maxlength: "maxLength",
|
|
33
|
+
minlength: "minLength",
|
|
34
|
+
novalidate: "noValidate",
|
|
35
|
+
playsinline: "playsInline",
|
|
36
|
+
readonly: "readOnly",
|
|
37
|
+
referrerpolicy: "referrerPolicy",
|
|
38
|
+
rowspan: "rowSpan",
|
|
39
|
+
srcset: "srcSet",
|
|
40
|
+
tabindex: "tabIndex",
|
|
41
|
+
targetAttr: "targetattr",
|
|
42
|
+
usemap: "useMap"
|
|
43
|
+
}, i = Object.keys(e.props).reduce((r, a) => {
|
|
44
|
+
let s = e.props[a];
|
|
45
|
+
a === "style" && typeof s == "string" && (s = f(s));
|
|
46
|
+
const d = o[a] || a;
|
|
47
|
+
return r[d] = s, r;
|
|
24
48
|
}, {});
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
return
|
|
49
|
+
i.key = e.key;
|
|
50
|
+
const t = c.Children.map(e.props.children, (r) => typeof r == "string" ? r : p(r));
|
|
51
|
+
return c.createElement(e.type, i, t);
|
|
28
52
|
}
|
|
29
|
-
const
|
|
53
|
+
const l = () => typeof window < "u", y = () => typeof window > "u", g = () => l() && typeof window.storyblokRegisterEvent < "u", m = () => l() && window.self !== window.top, h = () => l() && m() && window.location.search.includes("_storyblok");
|
|
30
54
|
export {
|
|
31
|
-
|
|
55
|
+
p as convertAttributesInElement,
|
|
32
56
|
g as isBridgeLoaded,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
l as isBrowser,
|
|
58
|
+
m as isIframe,
|
|
59
|
+
y as isServer,
|
|
60
|
+
h as isVisualEditor
|
|
37
61
|
};
|