@storyblok/react 4.3.6 → 4.4.1
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/index.mjs +8 -8
- package/dist/richtext.d.ts.map +1 -1
- package/dist/richtext.js +1 -1
- package/dist/richtext.mjs +11 -8
- package/dist/storyblok-js.js +2 -2
- package/dist/storyblok-js.mjs +326 -324
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +16 -51
- 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;AAkB1B;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,CAsCxI"}
|
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 p=require("react");function l(t){return t.replace(/-([a-z])/g,o=>o[1].toUpperCase())}function f(t){return t.split(";").reduce((o,s)=>{let[r,n]=s.split(":");return r=r==null?void 0:r.trim(),n=n==null?void 0:n.trim(),r&&n&&(o[l(r)]=n),o},{})}function c(t){if(Array.isArray(t))return t.map(e=>c(e));const o={class:"className",for:"htmlFor",targetAttr:"targetattr"},s=Object.keys(t.props).reduce((e,i)=>{let a=t.props[i];i==="style"&&typeof a=="string"&&(a=f(a));const u=o[i]||i;return e[u]=a,e},{});s.key=t.key;const r=p.Children.map(t.props.children,e=>typeof e=="string"?e:c(e));return p.createElement(t.type,s,r)}exports.convertAttributesInElement=c;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,65 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
-
});
|
|
1
|
+
import i from "react";
|
|
2
|
+
function f(r) {
|
|
3
|
+
return r.replace(/-([a-z])/g, (o) => o[1].toUpperCase());
|
|
34
4
|
}
|
|
35
5
|
function l(r) {
|
|
36
|
-
return r.
|
|
37
|
-
|
|
38
|
-
|
|
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;
|
|
6
|
+
return r.split(";").reduce((o, p) => {
|
|
7
|
+
let [t, n] = p.split(":");
|
|
8
|
+
return t = t == null ? void 0 : t.trim(), n = n == null ? void 0 : n.trim(), t && n && (o[f(t)] = n), o;
|
|
42
9
|
}, {});
|
|
43
10
|
}
|
|
44
11
|
function c(r) {
|
|
45
12
|
if (Array.isArray(r))
|
|
46
|
-
return r.map((
|
|
47
|
-
|
|
48
|
-
return typeof r == "string" ? u(r) : r;
|
|
49
|
-
const t = {
|
|
13
|
+
return r.map((e) => c(e));
|
|
14
|
+
const o = {
|
|
50
15
|
class: "className",
|
|
51
16
|
for: "htmlFor",
|
|
52
17
|
targetAttr: "targetattr"
|
|
53
18
|
// Add more attribute conversions here as needed
|
|
54
|
-
},
|
|
55
|
-
let a = r.props[
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
return
|
|
19
|
+
}, p = Object.keys(r.props).reduce((e, s) => {
|
|
20
|
+
let a = r.props[s];
|
|
21
|
+
s === "style" && typeof a == "string" && (a = l(a));
|
|
22
|
+
const u = o[s] || s;
|
|
23
|
+
return e[u] = a, e;
|
|
59
24
|
}, {});
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
return
|
|
25
|
+
p.key = r.key;
|
|
26
|
+
const t = i.Children.map(r.props.children, (e) => typeof e == "string" ? e : c(e));
|
|
27
|
+
return i.createElement(r.type, p, t);
|
|
63
28
|
}
|
|
64
29
|
export {
|
|
65
30
|
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.
|
|
4
|
+
"version": "4.4.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"packageManager": "pnpm@10.2.0",
|
|
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.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/core": "^7.26.7",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@cypress/vite-dev-server": "^5.2.1",
|
|
70
70
|
"@storyblok/eslint-config": "^0.3.0",
|
|
71
71
|
"@tsconfig/recommended": "^1.0.8",
|
|
72
|
-
"@types/node": "^
|
|
72
|
+
"@types/node": "^20.17.18",
|
|
73
73
|
"@types/react": "18.3.12",
|
|
74
74
|
"@vitejs/plugin-react": "^4.3.4",
|
|
75
75
|
"babel-jest": "^29.7.0",
|