@storyblok/react 4.3.5 → 4.3.6
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/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/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/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/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.6",
|
|
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": [
|