@storyblok/react 2.3.2 → 2.3.3
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.js +1 -1
- package/dist/index.mjs +37 -36
- package/package.json +1 -1
package/dist/index.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 y=require("react"),e=require("./storyblok-js.js"),o=require("./index2.js"),b=require("./client.js"),a=require("./storyblok-component.js"),d=(i,r={},t={})=>{const l=o.useStoryblokApi();if(!l)return console.error("You can't use useStoryblok if you're not loading apiPlugin."),null;let[u,n]=y.useState({});t.resolveRelations=t.resolveRelations??r.resolve_relations,t.resolveLinks=t.resolveLinks??r.resolve_links;const k=typeof window<"u"&&typeof window.storyblokRegisterEvent<"u";return y.useEffect(()=>{async function c(){const{data:s}=await l.get(`cdn/stories/${i}`,r);n(s.story),k&&s.story.id&&e.registerStoryblokBridge(s.story.id,S=>n(S),t)}c()},[i,JSON.stringify(r)]),u};exports.RichTextResolver=e.RichTextResolver;exports.RichTextSchema=e.RichTextSchema;exports.apiPlugin=e.apiPlugin;exports.loadStoryblokBridge=e.loadStoryblokBridge;exports.registerStoryblokBridge=e.registerStoryblokBridge;exports.renderRichText=e.renderRichText;exports.storyblokEditable=e.storyblokEditable;exports.useStoryblokBridge=e.registerStoryblokBridge;exports.getComponent=o.getComponent;exports.getStoryblokApi=o.useStoryblokApi;exports.setComponents=o.setComponents;exports.storyblokInit=o.storyblokInit;exports.useStoryblokApi=o.useStoryblokApi;exports.useStoryblokState=b.useStoryblokState;exports.StoryblokComponent=a;exports.useStoryblok=d;
|
package/dist/index.mjs
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { registerStoryblokBridge as
|
|
3
|
-
import { RichTextResolver as
|
|
4
|
-
import { useStoryblokApi as
|
|
5
|
-
import { getComponent as
|
|
6
|
-
import { useStoryblokState as
|
|
7
|
-
import { default as
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
1
|
+
import { useState as f, useEffect as u } from "react";
|
|
2
|
+
import { registerStoryblokBridge as k } from "./storyblok-js.mjs";
|
|
3
|
+
import { RichTextResolver as v, RichTextSchema as x, apiPlugin as R, loadStoryblokBridge as w, renderRichText as B, storyblokEditable as h } from "./storyblok-js.mjs";
|
|
4
|
+
import { useStoryblokApi as d } from "./index2.mjs";
|
|
5
|
+
import { getComponent as A, setComponents as C, storyblokInit as T } from "./index2.mjs";
|
|
6
|
+
import { useStoryblokState as L } from "./client.mjs";
|
|
7
|
+
import { default as _ } from "./storyblok-component.mjs";
|
|
8
|
+
const b = (r, e = {}, o = {}) => {
|
|
9
|
+
const s = d();
|
|
10
|
+
if (!s)
|
|
11
11
|
return console.error(
|
|
12
12
|
"You can't use useStoryblok if you're not loading apiPlugin."
|
|
13
13
|
), null;
|
|
14
|
-
let [
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
let [l, n] = f({});
|
|
15
|
+
o.resolveRelations = o.resolveRelations ?? e.resolve_relations, o.resolveLinks = o.resolveLinks ?? e.resolve_links;
|
|
16
|
+
const i = typeof window < "u" && typeof window.storyblokRegisterEvent < "u";
|
|
17
|
+
return u(() => {
|
|
17
18
|
async function y() {
|
|
18
|
-
const { data:
|
|
19
|
-
`cdn/stories/${
|
|
19
|
+
const { data: t } = await s.get(
|
|
20
|
+
`cdn/stories/${r}`,
|
|
20
21
|
e
|
|
21
22
|
);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(a) =>
|
|
25
|
-
|
|
23
|
+
n(t.story), i && t.story.id && k(
|
|
24
|
+
t.story.id,
|
|
25
|
+
(a) => n(a),
|
|
26
|
+
o
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
29
|
y();
|
|
29
|
-
}, [
|
|
30
|
+
}, [r, JSON.stringify(e)]), l;
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
v as RichTextResolver,
|
|
34
|
+
x as RichTextSchema,
|
|
35
|
+
_ as StoryblokComponent,
|
|
36
|
+
R as apiPlugin,
|
|
37
|
+
A as getComponent,
|
|
38
|
+
d as getStoryblokApi,
|
|
39
|
+
w as loadStoryblokBridge,
|
|
40
|
+
k as registerStoryblokBridge,
|
|
41
|
+
B as renderRichText,
|
|
42
|
+
C as setComponents,
|
|
43
|
+
h as storyblokEditable,
|
|
44
|
+
T as storyblokInit,
|
|
45
|
+
b as useStoryblok,
|
|
46
|
+
d as useStoryblokApi,
|
|
47
|
+
k as useStoryblokBridge,
|
|
48
|
+
L as useStoryblokState
|
|
48
49
|
};
|