@storyblok/react 4.3.5 → 4.4.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/client.js +1 -1
- package/dist/client.mjs +11 -11
- package/dist/common.js +1 -1
- package/dist/common.mjs +10 -10
- package/dist/live-editing.js +1 -1
- package/dist/live-editing.mjs +12 -12
- package/dist/richtext.d.ts.map +1 -1
- package/dist/richtext.js +1 -1
- package/dist/richtext.mjs +11 -8
- package/dist/rsc/common.d.ts +4 -1
- package/dist/rsc/common.d.ts.map +1 -1
- package/dist/rsc/live-edit-update-action.d.ts +3 -2
- package/dist/rsc/live-edit-update-action.d.ts.map +1 -1
- package/dist/rsc/live-editing.d.ts +3 -2
- package/dist/rsc/live-editing.d.ts.map +1 -1
- package/dist/rsc/story.d.ts.map +1 -1
- package/dist/story.js +1 -1
- package/dist/story.mjs +10 -10
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +16 -51
- package/package.json +19 -14
package/dist/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),c=require("./storyblok-js.js"),b=(e=null,o={})=>{const[r,s]=t.useState(e),u=(e==null?void 0:e.id)??0,d=typeof window<"u"&&typeof window.storyblokRegisterEvent<"u";return t.useEffect(()=>{s(e),!(!d||!e)&&c.registerStoryblokBridge(u,n=>s(n),o)},[e]),r};exports.useStoryblokState=b;
|
package/dist/client.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { registerStoryblokBridge as
|
|
4
|
-
const
|
|
5
|
-
const [
|
|
6
|
-
return
|
|
7
|
-
s(e), !(!
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
2
|
+
import { useState as u, useEffect as n } from "react";
|
|
3
|
+
import { registerStoryblokBridge as c } from "./storyblok-js.mjs";
|
|
4
|
+
const g = (e = null, o = {}) => {
|
|
5
|
+
const [r, s] = u(e), d = (e == null ? void 0 : e.id) ?? 0, t = typeof window < "u" && typeof window.storyblokRegisterEvent < "u";
|
|
6
|
+
return n(() => {
|
|
7
|
+
s(e), !(!t || !e) && c(
|
|
8
|
+
d,
|
|
9
|
+
(f) => s(f),
|
|
10
|
+
o
|
|
11
11
|
);
|
|
12
|
-
}, [e]),
|
|
12
|
+
}, [e]), r;
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
g as useStoryblokState
|
|
16
16
|
};
|
package/dist/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./storyblok-js.js"),b=require("./server-component.js");let t=null;const n=new Map;let l=!1,s=null;globalThis.storyCache=new Map;const a=()=>(t||console.error("You can't use getStoryblokApi if you're not loading apiPlugin."),t),c=e=>(Object.entries(e).forEach(([r,i])=>{n.set(r,i)}),n),k=e=>n.has(e)?n.get(e):(console.error(`Component ${e} doesn't exist.`),!1),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./storyblok-js.js"),b=require("./server-component.js");let t=null;const n=new Map;let l=!1,s=null;globalThis.storyCache=globalThis.storyCache?globalThis.storyCache:new Map;const a=()=>(t||console.error("You can't use getStoryblokApi if you're not loading apiPlugin."),t),c=e=>(Object.entries(e).forEach(([r,i])=>{n.set(r,i)}),n),k=e=>n.has(e)?n.get(e):(console.error(`Component ${e} doesn't exist.`),!1),g=()=>l,m=()=>s,y=(e={})=>{if(t)return()=>t;const{storyblokApi:r}=o.storyblokInit(e);return t=r,e.components&&c(e.components),l=e.enableFallbackComponent,s=e.customFallbackComponent,()=>r};exports.RichTextResolver=o.RichTextResolver;exports.RichTextSchema=o.RichTextSchema;exports.apiPlugin=o.apiPlugin;exports.loadStoryblokBridge=o.loadStoryblokBridge;exports.registerStoryblokBridge=o.registerStoryblokBridge;exports.renderRichText=o.renderRichText;exports.storyblokEditable=o.storyblokEditable;exports.useStoryblokBridge=o.registerStoryblokBridge;exports.StoryblokServerComponent=b;exports.getComponent=k;exports.getCustomFallbackComponent=m;exports.getEnableFallbackComponent=g;exports.getStoryblokApi=a;exports.setComponents=c;exports.storyblokInit=y;exports.useStoryblokApi=a;
|
package/dist/common.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { storyblokInit as a } from "./storyblok-js.mjs";
|
|
2
|
-
import { RichTextResolver as
|
|
3
|
-
import { default as
|
|
2
|
+
import { RichTextResolver as C, RichTextSchema as f, apiPlugin as h, loadStoryblokBridge as d, registerStoryblokBridge as S, renderRichText as x, storyblokEditable as F, registerStoryblokBridge as T } from "./storyblok-js.mjs";
|
|
3
|
+
import { default as B } from "./server-component.mjs";
|
|
4
4
|
let e = null;
|
|
5
5
|
const r = /* @__PURE__ */ new Map();
|
|
6
6
|
let n = !1, l = null;
|
|
7
|
-
globalThis.storyCache = /* @__PURE__ */ new Map();
|
|
7
|
+
globalThis.storyCache = globalThis.storyCache ? globalThis.storyCache : /* @__PURE__ */ new Map();
|
|
8
8
|
const i = () => (e || console.error(
|
|
9
9
|
"You can't use getStoryblokApi if you're not loading apiPlugin."
|
|
10
10
|
), e), c = (o) => (Object.entries(o).forEach(([t, s]) => {
|
|
@@ -16,20 +16,20 @@ const i = () => (e || console.error(
|
|
|
16
16
|
return e = t, o.components && c(o.components), n = o.enableFallbackComponent, l = o.customFallbackComponent, () => t;
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
C as RichTextResolver,
|
|
20
|
+
f as RichTextSchema,
|
|
21
|
+
B as StoryblokServerComponent,
|
|
22
|
+
h as apiPlugin,
|
|
23
23
|
k as getComponent,
|
|
24
24
|
p as getCustomFallbackComponent,
|
|
25
25
|
m as getEnableFallbackComponent,
|
|
26
26
|
i as getStoryblokApi,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
d as loadStoryblokBridge,
|
|
28
|
+
S as registerStoryblokBridge,
|
|
29
29
|
x as renderRichText,
|
|
30
30
|
c as setComponents,
|
|
31
31
|
F as storyblokEditable,
|
|
32
32
|
u as storyblokInit,
|
|
33
33
|
i as useStoryblokApi,
|
|
34
|
-
|
|
34
|
+
T as useStoryblokBridge
|
|
35
35
|
};
|
package/dist/live-editing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const
|
|
2
|
+
"use strict";const s=require("./storyblok-js.js"),i=require("react"),d=require("./live-edit-update-action.js"),l=()=>typeof window>"u"?!1:typeof window.storyblokRegisterEvent<"u"&&window.location.search.includes("_storyblok"),u=({story:e=null,bridgeOptions:n={}})=>{if(!l())return null;const o=t=>{t&&i.startTransition(()=>{d.liveEditUpdateAction({story:t,pathToRevalidate:window.location.pathname})})},r=(e==null?void 0:e.id)??0;return i.useEffect(()=>{s.registerStoryblokBridge(r,t=>o(t),n)},[]),null};module.exports=u;
|
package/dist/live-editing.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { registerStoryblokBridge as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { liveEditUpdateAction as
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
2
|
+
import { registerStoryblokBridge as r } from "./storyblok-js.mjs";
|
|
3
|
+
import { useEffect as d, startTransition as l } from "react";
|
|
4
|
+
import { liveEditUpdateAction as a } from "./live-edit-update-action.mjs";
|
|
5
|
+
const s = () => typeof window > "u" ? !1 : typeof window.storyblokRegisterEvent < "u" && window.location.search.includes("_storyblok"), p = ({ story: e = null, bridgeOptions: i = {} }) => {
|
|
6
|
+
if (!s())
|
|
7
7
|
return null;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const n = (t) => {
|
|
9
|
+
t && l(() => {
|
|
10
|
+
a({ story: t, pathToRevalidate: window.location.pathname });
|
|
11
11
|
});
|
|
12
|
-
},
|
|
13
|
-
return
|
|
14
|
-
|
|
12
|
+
}, o = (e == null ? void 0 : e.id) ?? 0;
|
|
13
|
+
return d(() => {
|
|
14
|
+
r(o, (t) => n(t), i);
|
|
15
15
|
}, []), null;
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
p as default
|
|
19
19
|
};
|
package/dist/richtext.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richtext.d.ts","sourceRoot":"","sources":["../src/richtext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAGrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,YAAY,CAMrG;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,wBAAwB,CAAC,KAAK,CAAC,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"richtext.d.ts","sourceRoot":"","sources":["../src/richtext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAGrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,YAAY,CAMrG;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,wBAAwB,CAAC,KAAK,CAAC,YAAY,CAAC;;EActD"}
|
package/dist/richtext.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 o=require("react"),c=require("./storyblok-component.js"),n=require("./storyblok-js.js");function l(e){var t,s;const r=(t=e==null?void 0:e.attrs)==null?void 0:t.body;return o.createElement(c,{blok:Array.isArray(r)?r[0]:void 0,key:(s=e.attrs)==null?void 0:s.id})}function i(e){const r={renderFn:o.createElement,textFn:t=>o.createElement(o.Fragment,{key:Math.random().toString(36).substring(2,15)},t),resolvers:{[n.BlockTypes.COMPONENT]:l,...e.resolvers},keyedResolvers:!0};return n.richTextResolver(r)}exports.componentResolver=l;exports.useStoryblokRichTextResolver=i;
|
package/dist/richtext.mjs
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "react";
|
|
2
2
|
import n from "./storyblok-component.mjs";
|
|
3
|
-
import { BlockTypes as
|
|
3
|
+
import { BlockTypes as m, richTextResolver as a } from "./storyblok-js.mjs";
|
|
4
4
|
function i(e) {
|
|
5
|
-
var t,
|
|
5
|
+
var t, s;
|
|
6
6
|
const r = (t = e == null ? void 0 : e.attrs) == null ? void 0 : t.body;
|
|
7
|
-
return
|
|
7
|
+
return o.createElement(n, {
|
|
8
8
|
blok: Array.isArray(r) ? r[0] : void 0,
|
|
9
|
-
key: (
|
|
9
|
+
key: (s = e.attrs) == null ? void 0 : s.id
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
function p(e) {
|
|
13
13
|
const r = {
|
|
14
|
-
renderFn:
|
|
14
|
+
renderFn: o.createElement,
|
|
15
|
+
textFn: (t) => o.createElement(o.Fragment, {
|
|
16
|
+
key: Math.random().toString(36).substring(2, 15)
|
|
17
|
+
}, t),
|
|
15
18
|
resolvers: {
|
|
16
|
-
[
|
|
19
|
+
[m.COMPONENT]: i,
|
|
17
20
|
...e.resolvers
|
|
18
21
|
},
|
|
19
22
|
keyedResolvers: !0
|
|
20
23
|
};
|
|
21
|
-
return
|
|
24
|
+
return a(r);
|
|
22
25
|
}
|
|
23
26
|
export {
|
|
24
27
|
i as componentResolver,
|
package/dist/rsc/common.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '../types';
|
|
1
|
+
import { ISbStoryData, SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
var storyCache: Map<string, ISbStoryData>;
|
|
4
|
+
}
|
|
2
5
|
export declare const useStoryblokApi: () => StoryblokClient;
|
|
3
6
|
export declare const setComponents: (newComponentsMap: SbReactComponentsMap) => Map<string, import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
4
7
|
export declare const getComponent: (componentKey: string) => React.ElementType | false;
|
package/dist/rsc/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/rsc/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/rsc/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,SAAS,CAAC;AAOjB,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC3C;AAID,eAAO,MAAM,eAAe,QAAO,eAQlC,CAAC;AAEF,eAAO,MAAM,aAAa,qBAAsB,oBAAoB,+FAKnE,CAAC;AAEF,eAAO,MAAM,YAAY,iBAAkB,MAAM,KAAG,KAAK,CAAC,WAAW,GAAG,KAOvE,CAAC;AAEF,eAAO,MAAM,0BAA0B,eAAgC,CAAC;AACxE,eAAO,MAAM,0BAA0B,qFAAgC,CAAC;AAExE,eAAO,MAAM,aAAa,mBAAmB,iBAAiB,KAAQ,CAAC,MAAM,eAAe,CAe3F,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ISbStoryData } from '@storyblok/js';
|
|
1
2
|
export declare function liveEditUpdateAction({ story, pathToRevalidate }: {
|
|
2
|
-
story:
|
|
3
|
-
pathToRevalidate:
|
|
3
|
+
story: ISbStoryData;
|
|
4
|
+
pathToRevalidate: string;
|
|
4
5
|
}): Promise<void>;
|
|
5
6
|
//# sourceMappingURL=live-edit-update-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-edit-update-action.d.ts","sourceRoot":"","sources":["../../src/rsc/live-edit-update-action.ts"],"names":[],"mappings":"AAEA,wBAAsB,oBAAoB,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE
|
|
1
|
+
{"version":3,"file":"live-edit-update-action.d.ts","sourceRoot":"","sources":["../../src/rsc/live-edit-update-action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,wBAAsB,oBAAoB,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,iBAiBxH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ISbStoryData, StoryblokBridgeConfigV2 } from '@storyblok/js';
|
|
1
2
|
declare const StoryblokLiveEditing: ({ story, bridgeOptions }: {
|
|
2
|
-
story
|
|
3
|
-
bridgeOptions
|
|
3
|
+
story: ISbStoryData;
|
|
4
|
+
bridgeOptions: StoryblokBridgeConfigV2;
|
|
4
5
|
}) => any;
|
|
5
6
|
export default StoryblokLiveEditing;
|
|
6
7
|
//# sourceMappingURL=live-editing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-editing.d.ts","sourceRoot":"","sources":["../../src/rsc/live-editing.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-editing.d.ts","sourceRoot":"","sources":["../../src/rsc/live-editing.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAA2B,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAWzG,QAAA,MAAM,oBAAoB,6BAA0C;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,aAAa,EAAE,uBAAuB,CAAA;CAAE,QAoBlI,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
package/dist/rsc/story.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../src/rsc/story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIrE,UAAU,mBAAoB,SAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IAC5F,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC;AAED,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../src/rsc/story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIrE,UAAU,mBAAoB,SAAQ,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IAC5F,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC;AAED,QAAA,MAAM,cAAc,0HAmCnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/story.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),c=require("react");require("./common.js");const s=require("./live-editing.js"),l=require("./server-component.js"),u=c.forwardRef(({story:e,bridgeOptions:t,...o},n)=>{if(!e)return console.error("Please provide a 'story' property to the StoryblokServerComponent"),null;if(globalThis.storyCache.has(e.uuid)&&(e=globalThis.storyCache.get(e.uuid),globalThis.storyCache.delete(e.uuid)),typeof e.content=="string")try{e.content=JSON.parse(e.content)}catch(i){console.error("An error occurred while trying to parse the story content",i),e.content={}}return r.jsxs(r.Fragment,{children:[r.jsx(l,{ref:n,blok:e.content,...o}),r.jsx(s,{story:e,bridgeOptions:t})]})});module.exports=u;
|
package/dist/story.mjs
CHANGED
|
@@ -2,28 +2,28 @@ import { jsxs as l, Fragment as c, jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as a } from "react";
|
|
3
3
|
import "./common.mjs";
|
|
4
4
|
import p from "./live-editing.mjs";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
({ story:
|
|
8
|
-
if (!
|
|
5
|
+
import h from "./server-component.mjs";
|
|
6
|
+
const b = a(
|
|
7
|
+
({ story: e, bridgeOptions: r, ...t }, n) => {
|
|
8
|
+
if (!e)
|
|
9
9
|
return console.error(
|
|
10
10
|
"Please provide a 'story' property to the StoryblokServerComponent"
|
|
11
11
|
), null;
|
|
12
|
-
if (globalThis.storyCache.has(
|
|
12
|
+
if (globalThis.storyCache.has(e.uuid) && (e = globalThis.storyCache.get(e.uuid), globalThis.storyCache.delete(e.uuid)), typeof e.content == "string")
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
e.content = JSON.parse(e.content);
|
|
15
15
|
} catch (i) {
|
|
16
16
|
console.error(
|
|
17
17
|
"An error occurred while trying to parse the story content",
|
|
18
18
|
i
|
|
19
|
-
),
|
|
19
|
+
), e.content = {};
|
|
20
20
|
}
|
|
21
21
|
return /* @__PURE__ */ l(c, { children: [
|
|
22
|
-
/* @__PURE__ */ o(
|
|
23
|
-
/* @__PURE__ */ o(p, { story:
|
|
22
|
+
/* @__PURE__ */ o(h, { ref: n, blok: e.content, ...t }),
|
|
23
|
+
/* @__PURE__ */ o(p, { story: e, bridgeOptions: r })
|
|
24
24
|
] });
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
b as default
|
|
29
29
|
};
|
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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"private": false,
|
|
6
|
-
"packageManager": "pnpm@
|
|
6
|
+
"packageManager": "pnpm@10.2.0",
|
|
7
7
|
"description": "SDK to integrate Storyblok into your project using React.",
|
|
8
8
|
"author": "Storyblok",
|
|
9
9
|
"license": "MIT",
|
|
@@ -61,31 +61,36 @@
|
|
|
61
61
|
"@storyblok/js": "3.2.2"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.26.
|
|
65
|
-
"@babel/preset-env": "^7.26.
|
|
66
|
-
"@commitlint/cli": "^19.
|
|
67
|
-
"@commitlint/config-conventional": "^19.
|
|
64
|
+
"@babel/core": "^7.26.7",
|
|
65
|
+
"@babel/preset-env": "^7.26.7",
|
|
66
|
+
"@commitlint/cli": "^19.7.1",
|
|
67
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
68
68
|
"@cypress/react": "^8.0.2",
|
|
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": "^22.13.1",
|
|
73
73
|
"@types/react": "18.3.12",
|
|
74
74
|
"@vitejs/plugin-react": "^4.3.4",
|
|
75
75
|
"babel-jest": "^29.7.0",
|
|
76
76
|
"cypress": "^13.17.0",
|
|
77
|
-
"eslint": "^9.
|
|
77
|
+
"eslint": "^9.19.0",
|
|
78
78
|
"eslint-plugin-cypress": "^4.1.0",
|
|
79
|
-
"eslint-plugin-jest": "^28.
|
|
79
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
80
80
|
"react": "^18.3.1",
|
|
81
81
|
"react-dom": "^18.3.1",
|
|
82
82
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
83
83
|
"simple-git-hooks": "^2.11.1",
|
|
84
|
-
"start-server-and-test": "^2.0.
|
|
85
|
-
"typescript": "5.
|
|
86
|
-
"vite": "^
|
|
87
|
-
"vite-plugin-dts": "^4.
|
|
88
|
-
"vitest": "^
|
|
84
|
+
"start-server-and-test": "^2.0.10",
|
|
85
|
+
"typescript": "5.7.3",
|
|
86
|
+
"vite": "^6.1.0",
|
|
87
|
+
"vite-plugin-dts": "^4.5.0",
|
|
88
|
+
"vitest": "^3.0.5"
|
|
89
|
+
},
|
|
90
|
+
"pnpm": {
|
|
91
|
+
"onlyBuiltDependencies": [
|
|
92
|
+
"cypress"
|
|
93
|
+
]
|
|
89
94
|
},
|
|
90
95
|
"babel": {
|
|
91
96
|
"presets": [
|