@storyblok/react 2.2.0 → 2.3.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/README.md +6 -7
- package/dist/bridge-loader.js +2 -0
- package/dist/bridge-loader.mjs +11 -0
- package/dist/client.js +1 -0
- package/dist/client.mjs +18 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +48 -0
- package/dist/index2.js +1 -0
- package/dist/index2.mjs +26 -0
- package/dist/rsc.js +1 -0
- package/dist/rsc.mjs +23 -0
- package/dist/story.js +2 -0
- package/dist/story.mjs +10 -0
- package/dist/storyblok-component.js +1 -0
- package/dist/storyblok-component.mjs +16 -0
- package/dist/storyblok-js.js +24 -0
- package/dist/storyblok-js.mjs +866 -0
- package/dist/types/rsc/index.d.ts +2 -0
- package/package.json +18 -18
- package/dist/client-0cdf4d8e.js +0 -1
- package/dist/client-798eb80c.mjs +0 -22
- package/dist/index-364d653e.js +0 -1
- package/dist/index-4af66cd0.mjs +0 -51
- package/dist/storyblok-js-5db94779.js +0 -1
- package/dist/storyblok-js-5fd880b4.mjs +0 -858
- package/dist/storyblok-react.js +0 -1
- package/dist/storyblok-react.mjs +0 -53
- package/dist/storyblok-react2.js +0 -1
- package/dist/storyblok-react2.mjs +0 -19
- package/dist/storyblok-react3.js +0 -1
- package/dist/storyblok-react3.mjs +0 -17
- package/dist/storyblok-react4.js +0 -1
- package/dist/storyblok-react4.mjs +0 -17
package/dist/storyblok-react.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=require("./storyblok-js-5db94779.js"),t=require("./index-364d653e.js"),r=require("./client-0cdf4d8e.js");exports.RichTextResolver=o.y,exports.RichTextSchema=o.ie,exports.apiPlugin=o.ce,exports.loadStoryblokBridge=o.ge,exports.registerStoryblokBridge=o.ue,exports.renderRichText=o.de,exports.storyblokEditable=o.he,exports.useStoryblokBridge=o.ue,exports.StoryblokComponent=t.StoryblokComponent,exports.getComponent=t.getComponent,exports.getStoryblokApi=t.useStoryblokApi,exports.setComponents=t.setComponents,exports.storyblokInit=t.storyblokInit,exports.useStoryblokApi=t.useStoryblokApi,exports.useStoryblokState=r.useStoryblokState,exports.useStoryblok=(r,s={},i={})=>{const n=t.useStoryblokApi();if(!n)return console.error("You can't use useStoryblok if you're not loading apiPlugin."),null;let[l,p]=e.useState({});const u="undefined"!=typeof window&&void 0!==window.storyblokRegisterEvent;return e.useEffect((()=>{!async function(){const{data:e}=await n.get(`cdn/stories/${r}`,s);p(e.story),u&&e.story.id&&o.ue(e.story.id,(e=>p(e)),i)}()}),[r,JSON.stringify(s)]),l};
|
package/dist/storyblok-react.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
import { u as ue } from "./storyblok-js-5fd880b4.mjs";
|
|
3
|
-
import { y, i, c, g, d, h } from "./storyblok-js-5fd880b4.mjs";
|
|
4
|
-
import { u as useStoryblokApi } from "./index-4af66cd0.mjs";
|
|
5
|
-
import { S, g as g2, s, a } from "./index-4af66cd0.mjs";
|
|
6
|
-
import { u } from "./client-798eb80c.mjs";
|
|
7
|
-
const useStoryblok = (slug, apiOptions = {}, bridgeOptions = {}) => {
|
|
8
|
-
const storyblokApiInstance = useStoryblokApi();
|
|
9
|
-
if (!storyblokApiInstance) {
|
|
10
|
-
console.error(
|
|
11
|
-
"You can't use useStoryblok if you're not loading apiPlugin."
|
|
12
|
-
);
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
let [story, setStory] = useState({});
|
|
16
|
-
const isBridgeEnable = typeof window !== "undefined" && typeof window.storyblokRegisterEvent !== "undefined";
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
async function initStory() {
|
|
19
|
-
const { data } = await storyblokApiInstance.get(
|
|
20
|
-
`cdn/stories/${slug}`,
|
|
21
|
-
apiOptions
|
|
22
|
-
);
|
|
23
|
-
setStory(data.story);
|
|
24
|
-
if (isBridgeEnable && data.story.id) {
|
|
25
|
-
ue(
|
|
26
|
-
data.story.id,
|
|
27
|
-
(story2) => setStory(story2),
|
|
28
|
-
bridgeOptions
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
initStory();
|
|
33
|
-
}, [slug, JSON.stringify(apiOptions)]);
|
|
34
|
-
return story;
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
y as RichTextResolver,
|
|
38
|
-
i as RichTextSchema,
|
|
39
|
-
S as StoryblokComponent,
|
|
40
|
-
c as apiPlugin,
|
|
41
|
-
g2 as getComponent,
|
|
42
|
-
useStoryblokApi as getStoryblokApi,
|
|
43
|
-
g as loadStoryblokBridge,
|
|
44
|
-
ue as registerStoryblokBridge,
|
|
45
|
-
d as renderRichText,
|
|
46
|
-
s as setComponents,
|
|
47
|
-
h as storyblokEditable,
|
|
48
|
-
a as storyblokInit,
|
|
49
|
-
useStoryblok,
|
|
50
|
-
useStoryblokApi,
|
|
51
|
-
ue as useStoryblokBridge,
|
|
52
|
-
u as useStoryblokState
|
|
53
|
-
};
|
package/dist/storyblok-react2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-364d653e.js"),o=require("./storyblok-js-5db94779.js");require("react"),exports.StoryblokComponent=e.StoryblokComponent,exports.getComponent=e.getComponent,exports.getStoryblokApi=e.useStoryblokApi,exports.setComponents=e.setComponents,exports.storyblokInit=e.storyblokInit,exports.useStoryblokApi=e.useStoryblokApi,exports.RichTextResolver=o.y,exports.RichTextSchema=o.ie,exports.apiPlugin=o.ce,exports.loadStoryblokBridge=o.ge,exports.registerStoryblokBridge=o.ue,exports.renderRichText=o.de,exports.storyblokEditable=o.he,exports.useStoryblokBridge=o.ue;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { S, g, u, s, a, u as u2 } from "./index-4af66cd0.mjs";
|
|
2
|
-
import { y, i, c, g as g2, u as u3, d, h, u as u4 } from "./storyblok-js-5fd880b4.mjs";
|
|
3
|
-
import "react";
|
|
4
|
-
export {
|
|
5
|
-
y as RichTextResolver,
|
|
6
|
-
i as RichTextSchema,
|
|
7
|
-
S as StoryblokComponent,
|
|
8
|
-
c as apiPlugin,
|
|
9
|
-
g as getComponent,
|
|
10
|
-
u as getStoryblokApi,
|
|
11
|
-
g2 as loadStoryblokBridge,
|
|
12
|
-
u3 as registerStoryblokBridge,
|
|
13
|
-
d as renderRichText,
|
|
14
|
-
s as setComponents,
|
|
15
|
-
h as storyblokEditable,
|
|
16
|
-
a as storyblokInit,
|
|
17
|
-
u2 as useStoryblokApi,
|
|
18
|
-
u4 as useStoryblokBridge
|
|
19
|
-
};
|
package/dist/storyblok-react3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";"use client";const e=require("react"),o=require("./storyblok-js-5db94779.js");module.exports=({options:t})=>((async e=>{await o.ge(),new window.StoryblokBridge(e).on(["published","change"],(()=>{window.location.reload()}))})(t),e.createElement(e.Fragment,null));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { g as ge } from "./storyblok-js-5fd880b4.mjs";
|
|
4
|
-
const setBridge = async (options) => {
|
|
5
|
-
await ge();
|
|
6
|
-
const sbBridge = new window.StoryblokBridge(options);
|
|
7
|
-
sbBridge.on(["published", "change"], () => {
|
|
8
|
-
window.location.reload();
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
const StoryblokBridgeLoader = ({ options }) => {
|
|
12
|
-
setBridge(options);
|
|
13
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
StoryblokBridgeLoader as default
|
|
17
|
-
};
|
package/dist/storyblok-react4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";"use client";const e=require("react"),t=require("./client-0cdf4d8e.js"),r=require("./index-364d653e.js");require("./storyblok-js-5db94779.js");const o=e.forwardRef((({story:o,bridgeOptions:n,...s},c)=>("string"==typeof o.content&&(o.content=JSON.parse(o.content)),o=t.useStoryblokState(o,n),e.createElement(r.StoryblokComponent,{ref:c,blok:o.content,...s}))));module.exports=o;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { forwardRef } from "react";
|
|
3
|
-
import { u as useStoryblokState } from "./client-798eb80c.mjs";
|
|
4
|
-
import { S as StoryblokComponent } from "./index-4af66cd0.mjs";
|
|
5
|
-
import "./storyblok-js-5fd880b4.mjs";
|
|
6
|
-
const StoryblokStory = forwardRef(
|
|
7
|
-
({ story, bridgeOptions, ...restProps }, ref) => {
|
|
8
|
-
if (typeof story.content === "string") {
|
|
9
|
-
story.content = JSON.parse(story.content);
|
|
10
|
-
}
|
|
11
|
-
story = useStoryblokState(story, bridgeOptions);
|
|
12
|
-
return /* @__PURE__ */ React.createElement(StoryblokComponent, { ref, blok: story.content, ...restProps });
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
export {
|
|
16
|
-
StoryblokStory as default
|
|
17
|
-
};
|