@storyblok/react 4.3.3 → 4.3.5
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/README.md +2 -2
- package/dist/richtext.js +1 -1
- package/dist/richtext.mjs +4 -4
- package/dist/storyblok-js.js +2 -2
- package/dist/storyblok-js.mjs +207 -207
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +51 -18
- package/package.json +3 -3
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4D1B;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,CA+CxI"}
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),d={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'"," ":" ","©":"©","®":"®","°":"°","±":"±","¶":"¶","·":"·","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","…":"…"};function c(r){return r.replace(/&[#\w]+;/g,t=>{if(t.startsWith("&#")){const e=t.slice(2,-1);return e.startsWith("x")?String.fromCharCode(Number.parseInt(e.slice(1),16)):String.fromCharCode(Number.parseInt(e,10))}return d[t]||t})}function f(r){return r.replace(/-([a-z])/g,t=>t[1].toUpperCase())}function g(r){return r.split(";").reduce((t,e)=>{let[n,o]=e.split(":");return n=n==null?void 0:n.trim(),o=o==null?void 0:o.trim(),n&&o&&(t[f(n)]=o),t},{})}function p(r){if(Array.isArray(r))return r.map(s=>p(s));if(!a.isValidElement(r))return typeof r=="string"?c(r):r;const t={class:"className",for:"htmlFor",targetAttr:"targetattr"},e=Object.keys(r.props).reduce((s,i)=>{let u=r.props[i];i==="style"&&typeof u=="string"&&(u=g(u));const l=t[i]||i;return s[l]=u,s},{});e.key=r.key;const n=a.Children.map(r.props.children,s=>typeof s=="string"?c(s):p(s));return a.createElement(r.type,e,n)}exports.convertAttributesInElement=p;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,32 +1,65 @@
|
|
|
1
|
-
import
|
|
1
|
+
import p from "react";
|
|
2
|
+
const d = {
|
|
3
|
+
"&": "&",
|
|
4
|
+
"<": "<",
|
|
5
|
+
">": ">",
|
|
6
|
+
""": '"',
|
|
7
|
+
"'": "'",
|
|
8
|
+
"'": "'",
|
|
9
|
+
" ": " ",
|
|
10
|
+
"©": "©",
|
|
11
|
+
"®": "®",
|
|
12
|
+
"°": "°",
|
|
13
|
+
"±": "±",
|
|
14
|
+
"¶": "¶",
|
|
15
|
+
"·": "·",
|
|
16
|
+
"–": "–",
|
|
17
|
+
"—": "—",
|
|
18
|
+
"‘": "‘",
|
|
19
|
+
"’": "’",
|
|
20
|
+
"‚": "‚",
|
|
21
|
+
"“": "“",
|
|
22
|
+
"”": "”",
|
|
23
|
+
"„": "„",
|
|
24
|
+
"…": "…"
|
|
25
|
+
};
|
|
26
|
+
function u(r) {
|
|
27
|
+
return r.replace(/&[#\w]+;/g, (t) => {
|
|
28
|
+
if (t.startsWith("&#")) {
|
|
29
|
+
const e = t.slice(2, -1);
|
|
30
|
+
return e.startsWith("x") ? String.fromCharCode(Number.parseInt(e.slice(1), 16)) : String.fromCharCode(Number.parseInt(e, 10));
|
|
31
|
+
}
|
|
32
|
+
return d[t] || t;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
2
35
|
function l(r) {
|
|
3
|
-
return r.replace(/-([a-z])/g, (
|
|
36
|
+
return r.replace(/-([a-z])/g, (t) => t[1].toUpperCase());
|
|
4
37
|
}
|
|
5
|
-
function
|
|
6
|
-
return r.split(";").reduce((
|
|
7
|
-
let [
|
|
8
|
-
return
|
|
38
|
+
function m(r) {
|
|
39
|
+
return r.split(";").reduce((t, e) => {
|
|
40
|
+
let [o, n] = e.split(":");
|
|
41
|
+
return o = o == null ? void 0 : o.trim(), n = n == null ? void 0 : n.trim(), o && n && (t[l(o)] = n), t;
|
|
9
42
|
}, {});
|
|
10
43
|
}
|
|
11
44
|
function c(r) {
|
|
12
45
|
if (Array.isArray(r))
|
|
13
|
-
return r.map((
|
|
14
|
-
if (!
|
|
15
|
-
return r;
|
|
16
|
-
const
|
|
46
|
+
return r.map((s) => c(s));
|
|
47
|
+
if (!p.isValidElement(r))
|
|
48
|
+
return typeof r == "string" ? u(r) : r;
|
|
49
|
+
const t = {
|
|
17
50
|
class: "className",
|
|
18
51
|
for: "htmlFor",
|
|
19
52
|
targetAttr: "targetattr"
|
|
20
53
|
// Add more attribute conversions here as needed
|
|
21
|
-
},
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return
|
|
54
|
+
}, e = Object.keys(r.props).reduce((s, i) => {
|
|
55
|
+
let a = r.props[i];
|
|
56
|
+
i === "style" && typeof a == "string" && (a = m(a));
|
|
57
|
+
const f = t[i] || i;
|
|
58
|
+
return s[f] = a, s;
|
|
26
59
|
}, {});
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
return
|
|
60
|
+
e.key = r.key;
|
|
61
|
+
const o = p.Children.map(r.props.children, (s) => typeof s == "string" ? u(s) : c(s));
|
|
62
|
+
return p.createElement(r.type, e, o);
|
|
30
63
|
}
|
|
31
64
|
export {
|
|
32
65
|
c as convertAttributesInElement
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"packageManager": "pnpm@9.15.1",
|
|
7
7
|
"description": "SDK to integrate Storyblok into your project using React.",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-dom": "^17 || ^18 || ^19"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@storyblok/js": "3.2.
|
|
61
|
+
"@storyblok/js": "3.2.2"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/core": "^7.26.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"simple-git-hooks": "^2.11.1",
|
|
84
84
|
"start-server-and-test": "^2.0.9",
|
|
85
85
|
"typescript": "5.6.3",
|
|
86
|
-
"vite": "^
|
|
86
|
+
"vite": "^5.4.13",
|
|
87
87
|
"vite-plugin-dts": "^4.4.0",
|
|
88
88
|
"vitest": "^2.1.8"
|
|
89
89
|
},
|