@storyblok/react 5.4.22 → 6.1.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/core/init.mjs +3 -3
- package/dist/core/richtext-hoc.js +1 -1
- package/dist/core/richtext-hoc.mjs +25 -35
- package/dist/index.d.ts +10 -9
- package/dist/index.js +1 -1
- package/dist/index.mjs +43 -41
- package/dist/rsc.d.ts +9 -8
- package/dist/rsc.js +1 -1
- package/dist/rsc.mjs +29 -27
- package/dist/server/server-storyblok-richtext-component.js +1 -1
- package/dist/server/server-storyblok-richtext-component.mjs +2 -2
- package/dist/ssr.d.ts +9 -8
- package/dist/ssr.js +1 -1
- package/dist/ssr.mjs +30 -28
- package/dist/storyblok-rich-text.js +1 -1
- package/dist/storyblok-rich-text.mjs +2 -2
- package/package.json +6 -7
package/dist/core/init.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { storyblokInit as n } from "@storyblok/js";
|
|
2
|
-
import {
|
|
2
|
+
import { setComponents as a, setEnableFallbackComponent as m, setCustomFallbackComponent as l, setStoryblokApiInstance as b, getStoryblokApiInstance as c } from "./state.mjs";
|
|
3
3
|
import { getComponent as f, getCustomFallbackComponent as p, getEnableFallbackComponent as y } from "./state.mjs";
|
|
4
4
|
const k = (o = {}) => {
|
|
5
5
|
const t = c();
|
|
6
6
|
if (t)
|
|
7
7
|
return () => t;
|
|
8
8
|
const { storyblokApi: e } = n(o);
|
|
9
|
-
return
|
|
9
|
+
return b(e), o.components && a(o.components), o.enableFallbackComponent !== void 0 && m(o.enableFallbackComponent), o.customFallbackComponent && l(o.customFallbackComponent), () => e;
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
f as getComponent,
|
|
13
13
|
p as getCustomFallbackComponent,
|
|
14
14
|
y as getEnableFallbackComponent,
|
|
15
|
-
|
|
15
|
+
a as setComponents,
|
|
16
16
|
k as storyblokInit
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),o=require("@storyblok/js");function m(c,{isServerContext:n=!1}={}){return function(r){const{tiptapExtensions:i,...s}=r,a={...n?r:{},renderFn:t.createElement,textFn:e=>t.createElement(t.Fragment,{key:Math.random().toString(36).substring(2,15)},e),keyedResolvers:!0,...n?{}:s,tiptapExtensions:{blok:o.ComponentBlok.configure({renderComponent:(e,u)=>{const l=u||(n?`fallback-key-${JSON.stringify(e)}`:void 0);return t.createElement(c,{blok:e,key:l})}}),...i}};return o.richTextResolver(a)}}exports.createRichTextHook=m;
|
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
isServerContext:
|
|
1
|
+
import t from "react";
|
|
2
|
+
import { ComponentBlok as l, richTextResolver as p } from "@storyblok/js";
|
|
3
|
+
function d(o, {
|
|
4
|
+
isServerContext: n = !1
|
|
5
5
|
} = {}) {
|
|
6
|
-
return function(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const a = ((n = e.attrs) == null ? void 0 : n.id) || (t ? `fallback-key-${JSON.stringify(e.attrs)}` : void 0);
|
|
12
|
-
return r.map(
|
|
13
|
-
(i, m) => s.createElement(c, {
|
|
14
|
-
blok: i,
|
|
15
|
-
key: `${a}-${m}`
|
|
16
|
-
})
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function k(c, {
|
|
21
|
-
isServerContext: t = !1
|
|
22
|
-
} = {}) {
|
|
23
|
-
return function(e) {
|
|
24
|
-
const r = y(c, { isServerContext: t }), { resolvers: a, ...o } = e, n = {
|
|
25
|
-
...t ? e : {},
|
|
26
|
-
renderFn: s.createElement,
|
|
27
|
-
textFn: (i) => s.createElement(s.Fragment, {
|
|
6
|
+
return function(r) {
|
|
7
|
+
const { tiptapExtensions: c, ...i } = r, s = {
|
|
8
|
+
...n ? r : {},
|
|
9
|
+
renderFn: t.createElement,
|
|
10
|
+
textFn: (e) => t.createElement(t.Fragment, {
|
|
28
11
|
key: Math.random().toString(36).substring(2, 15)
|
|
29
|
-
},
|
|
30
|
-
resolvers: {
|
|
31
|
-
[u.COMPONENT]: r,
|
|
32
|
-
...a
|
|
33
|
-
},
|
|
12
|
+
}, e),
|
|
34
13
|
keyedResolvers: !0,
|
|
35
|
-
...
|
|
14
|
+
...n ? {} : i,
|
|
15
|
+
tiptapExtensions: {
|
|
16
|
+
blok: l.configure({
|
|
17
|
+
renderComponent: (e, a) => {
|
|
18
|
+
const m = a || (n ? `fallback-key-${JSON.stringify(e)}` : void 0);
|
|
19
|
+
return t.createElement(o, {
|
|
20
|
+
blok: e,
|
|
21
|
+
key: m
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
...c
|
|
26
|
+
}
|
|
36
27
|
};
|
|
37
|
-
return
|
|
28
|
+
return p(s);
|
|
38
29
|
};
|
|
39
30
|
}
|
|
40
31
|
export {
|
|
41
|
-
|
|
42
|
-
k as createRichTextHook
|
|
32
|
+
d as createRichTextHook
|
|
43
33
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { apiPlugin } from '@storyblok/js';
|
|
2
2
|
import { ArrayFn } from '@storyblok/js';
|
|
3
|
+
import { asTag } from '@storyblok/js';
|
|
3
4
|
import { AsyncFn } from '@storyblok/js';
|
|
4
5
|
import { BlockTypes } from '@storyblok/js';
|
|
6
|
+
import { ComponentBlok } from '@storyblok/js';
|
|
5
7
|
import { default as default_2 } from 'react';
|
|
6
8
|
import { ForwardRefExoticComponent } from 'react';
|
|
7
9
|
import { ISbAlternateObject } from '@storyblok/js';
|
|
@@ -36,14 +38,13 @@ import { StoryblokBridgeV2 } from '@storyblok/js';
|
|
|
36
38
|
import { StoryblokClient } from '@storyblok/js';
|
|
37
39
|
import { StoryblokComponentType } from '@storyblok/js';
|
|
38
40
|
import { storyblokEditable } from '@storyblok/js';
|
|
41
|
+
import { StoryblokRichTextDocumentNode } from '@storyblok/richtext';
|
|
39
42
|
import { StoryblokRichTextImageOptimizationOptions } from '@storyblok/js';
|
|
40
43
|
import { StoryblokRichTextNode } from '@storyblok/js';
|
|
41
44
|
import { StoryblokRichTextNode as StoryblokRichTextNode_2 } from '@storyblok/richtext';
|
|
42
|
-
import { StoryblokRichTextNodeResolver } from '@storyblok/js';
|
|
43
45
|
import { StoryblokRichTextNodeTypes } from '@storyblok/js';
|
|
44
46
|
import { StoryblokRichTextOptions } from '@storyblok/js';
|
|
45
47
|
import { StoryblokRichTextOptions as StoryblokRichTextOptions_2 } from '@storyblok/richtext';
|
|
46
|
-
import { StoryblokRichTextResolvers } from '@storyblok/js';
|
|
47
48
|
import { TextTypes } from '@storyblok/js';
|
|
48
49
|
import { useStoryblokBridge } from '@storyblok/js';
|
|
49
50
|
|
|
@@ -51,10 +52,14 @@ export { apiPlugin }
|
|
|
51
52
|
|
|
52
53
|
export { ArrayFn }
|
|
53
54
|
|
|
55
|
+
export { asTag }
|
|
56
|
+
|
|
54
57
|
export { AsyncFn }
|
|
55
58
|
|
|
56
59
|
export { BlockTypes }
|
|
57
60
|
|
|
61
|
+
export { ComponentBlok }
|
|
62
|
+
|
|
58
63
|
/**
|
|
59
64
|
* Recursively converts HTML attributes in a React element tree to their JSX property names.
|
|
60
65
|
*
|
|
@@ -168,19 +173,15 @@ export { StoryblokRichTextImageOptimizationOptions }
|
|
|
168
173
|
|
|
169
174
|
export { StoryblokRichTextNode }
|
|
170
175
|
|
|
171
|
-
export { StoryblokRichTextNodeResolver }
|
|
172
|
-
|
|
173
176
|
export { StoryblokRichTextNodeTypes }
|
|
174
177
|
|
|
175
178
|
export { StoryblokRichTextOptions }
|
|
176
179
|
|
|
177
180
|
export declare interface StoryblokRichTextProps {
|
|
178
181
|
doc: StoryblokRichTextNode<default_2.ReactElement>;
|
|
179
|
-
|
|
182
|
+
tiptapExtensions?: StoryblokRichTextOptions<default_2.ReactElement>['tiptapExtensions'];
|
|
180
183
|
}
|
|
181
184
|
|
|
182
|
-
export { StoryblokRichTextResolvers }
|
|
183
|
-
|
|
184
185
|
export { TextTypes }
|
|
185
186
|
|
|
186
187
|
export declare type TUseStoryblokState = <T = void>(initialStory: ISbStoryData<T> | null, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<T> | null;
|
|
@@ -196,12 +197,12 @@ export { useStoryblokApi }
|
|
|
196
197
|
export { useStoryblokBridge }
|
|
197
198
|
|
|
198
199
|
export declare const useStoryblokRichText: (options: StoryblokRichTextOptions_2<React.ReactElement>) => {
|
|
199
|
-
render: (node: StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
200
|
+
render: (node: StoryblokRichTextDocumentNode | StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
200
201
|
};
|
|
201
202
|
|
|
202
203
|
/** @deprecated Use useStoryblokRichText instead */
|
|
203
204
|
export declare const useStoryblokRichTextResolver: (options: StoryblokRichTextOptions_2<React.ReactElement>) => {
|
|
204
|
-
render: (node: StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
205
|
+
render: (node: StoryblokRichTextDocumentNode | StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
205
206
|
};
|
|
206
207
|
|
|
207
208
|
export declare const useStoryblokState: TUseStoryblokState;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),e=require("@storyblok/js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),e=require("@storyblok/js"),S=require("./core/init.js"),l=require("./core/use-storyblok-api.js"),p=require("./core/storyblok-component.js"),m=require("./core/use-storyblok-state.js"),a=require("./richtext.js"),f=require("./storyblok-rich-text.js"),t=require("./utils.js"),s=require("./core/state.js"),T=(u,o={},r={})=>{const[c,b]=y.useState({}),k=typeof window<"u"&&typeof window.storyblokRegisterEvent<"u",n=l.getStoryblokApi();return y.useEffect(()=>{if(!n){console.error("You can't use useStoryblok if you're not loading apiPlugin.");return}async function d(){const{data:i}=await n.get(`cdn/stories/${u}`,o);b(i.story),k&&i.story.id&&e.registerStoryblokBridge(i.story.id,g=>b(g),r)}d()},[u,JSON.stringify(o),n]),n?(r.resolveRelations=r.resolveRelations??o.resolve_relations,r.resolveLinks=r.resolveLinks??o.resolve_links,c):null},R=a.useStoryblokRichText;Object.defineProperty(exports,"BlockTypes",{enumerable:!0,get:()=>e.BlockTypes});Object.defineProperty(exports,"ComponentBlok",{enumerable:!0,get:()=>e.ComponentBlok});Object.defineProperty(exports,"MarkTypes",{enumerable:!0,get:()=>e.MarkTypes});Object.defineProperty(exports,"TextTypes",{enumerable:!0,get:()=>e.TextTypes});Object.defineProperty(exports,"apiPlugin",{enumerable:!0,get:()=>e.apiPlugin});Object.defineProperty(exports,"asTag",{enumerable:!0,get:()=>e.asTag});Object.defineProperty(exports,"loadStoryblokBridge",{enumerable:!0,get:()=>e.loadStoryblokBridge});Object.defineProperty(exports,"registerStoryblokBridge",{enumerable:!0,get:()=>e.registerStoryblokBridge});Object.defineProperty(exports,"renderRichText",{enumerable:!0,get:()=>e.renderRichText});Object.defineProperty(exports,"richTextResolver",{enumerable:!0,get:()=>e.richTextResolver});Object.defineProperty(exports,"storyblokEditable",{enumerable:!0,get:()=>e.storyblokEditable});Object.defineProperty(exports,"useStoryblokBridge",{enumerable:!0,get:()=>e.useStoryblokBridge});exports.storyblokInit=S.storyblokInit;exports.getStoryblokApi=l.getStoryblokApi;exports.useStoryblokApi=l.getStoryblokApi;exports.StoryblokComponent=p;exports.useStoryblokState=m.useStoryblokState;exports.useStoryblokRichText=a.useStoryblokRichText;exports.StoryblokRichText=f;exports.convertAttributesInElement=t.convertAttributesInElement;exports.isBridgeLoaded=t.isBridgeLoaded;exports.isBrowser=t.isBrowser;exports.isIframe=t.isIframe;exports.isServer=t.isServer;exports.isVisualEditor=t.isVisualEditor;exports.getComponent=s.getComponent;exports.getCustomFallbackComponent=s.getCustomFallbackComponent;exports.getEnableFallbackComponent=s.getEnableFallbackComponent;exports.setComponents=s.setComponents;exports.useStoryblok=T;exports.useStoryblokRichTextResolver=R;
|
package/dist/index.mjs
CHANGED
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import { useState as f, useEffect as
|
|
2
|
-
import { registerStoryblokBridge as
|
|
3
|
-
import { BlockTypes as
|
|
4
|
-
import { storyblokInit as
|
|
5
|
-
import {
|
|
6
|
-
import { default as
|
|
7
|
-
import { useStoryblokState as
|
|
1
|
+
import { useState as f, useEffect as k } from "react";
|
|
2
|
+
import { registerStoryblokBridge as u } from "@storyblok/js";
|
|
3
|
+
import { BlockTypes as B, ComponentBlok as R, MarkTypes as C, TextTypes as E, apiPlugin as w, asTag as h, loadStoryblokBridge as A, registerStoryblokBridge as I, renderRichText as L, richTextResolver as F, storyblokEditable as P, useStoryblokBridge as _ } from "@storyblok/js";
|
|
4
|
+
import { storyblokInit as M } from "./core/init.mjs";
|
|
5
|
+
import { getStoryblokApi as m } from "./core/use-storyblok-api.mjs";
|
|
6
|
+
import { default as V } from "./core/storyblok-component.mjs";
|
|
7
|
+
import { useStoryblokState as $ } from "./core/use-storyblok-state.mjs";
|
|
8
8
|
import { useStoryblokRichText as c } from "./richtext.mjs";
|
|
9
|
-
import { default as
|
|
10
|
-
import { convertAttributesInElement as
|
|
11
|
-
import { getComponent as
|
|
12
|
-
const
|
|
9
|
+
import { default as q } from "./storyblok-rich-text.mjs";
|
|
10
|
+
import { convertAttributesInElement as D, isBridgeLoaded as G, isBrowser as H, isIframe as K, isServer as Q, isVisualEditor as U } from "./utils.mjs";
|
|
11
|
+
import { getComponent as X, getCustomFallbackComponent as Z, getEnableFallbackComponent as O, setComponents as oo } from "./core/state.mjs";
|
|
12
|
+
const g = (s, e = {}, o = {}) => {
|
|
13
13
|
const [n, l] = f({}), i = typeof window < "u" && typeof window.storyblokRegisterEvent < "u", t = m();
|
|
14
|
-
return
|
|
14
|
+
return k(() => {
|
|
15
15
|
if (!t) {
|
|
16
16
|
console.error(
|
|
17
17
|
"You can't use useStoryblok if you're not loading apiPlugin."
|
|
18
18
|
);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
async function
|
|
21
|
+
async function a() {
|
|
22
22
|
const { data: r } = await t.get(
|
|
23
23
|
`cdn/stories/${s}`,
|
|
24
24
|
e
|
|
25
25
|
);
|
|
26
|
-
l(r.story), i && r.story.id &&
|
|
26
|
+
l(r.story), i && r.story.id && u(
|
|
27
27
|
r.story.id,
|
|
28
|
-
(
|
|
28
|
+
(y) => l(y),
|
|
29
29
|
o
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
a();
|
|
33
33
|
}, [s, JSON.stringify(e), t]), t ? (o.resolveRelations = o.resolveRelations ?? e.resolve_relations, o.resolveLinks = o.resolveLinks ?? e.resolve_links, n) : null;
|
|
34
|
-
},
|
|
34
|
+
}, x = c;
|
|
35
35
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
B as BlockTypes,
|
|
37
|
+
R as ComponentBlok,
|
|
38
|
+
C as MarkTypes,
|
|
39
|
+
V as StoryblokComponent,
|
|
40
|
+
q as StoryblokRichText,
|
|
40
41
|
E as TextTypes,
|
|
41
42
|
w as apiPlugin,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
h as asTag,
|
|
44
|
+
D as convertAttributesInElement,
|
|
45
|
+
X as getComponent,
|
|
46
|
+
Z as getCustomFallbackComponent,
|
|
47
|
+
O as getEnableFallbackComponent,
|
|
46
48
|
m as getStoryblokApi,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
G as isBridgeLoaded,
|
|
50
|
+
H as isBrowser,
|
|
51
|
+
K as isIframe,
|
|
52
|
+
Q as isServer,
|
|
53
|
+
U as isVisualEditor,
|
|
54
|
+
A as loadStoryblokBridge,
|
|
55
|
+
I as registerStoryblokBridge,
|
|
56
|
+
L as renderRichText,
|
|
57
|
+
F as richTextResolver,
|
|
58
|
+
oo as setComponents,
|
|
59
|
+
P as storyblokEditable,
|
|
60
|
+
M as storyblokInit,
|
|
61
|
+
g as useStoryblok,
|
|
60
62
|
m as useStoryblokApi,
|
|
61
|
-
|
|
63
|
+
_ as useStoryblokBridge,
|
|
62
64
|
c as useStoryblokRichText,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
x as useStoryblokRichTextResolver,
|
|
66
|
+
$ as useStoryblokState
|
|
65
67
|
};
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { apiPlugin } from '@storyblok/js';
|
|
2
2
|
import { ArrayFn } from '@storyblok/js';
|
|
3
|
+
import { asTag } from '@storyblok/js';
|
|
3
4
|
import { AsyncFn } from '@storyblok/js';
|
|
4
5
|
import { BlockTypes } from '@storyblok/js';
|
|
6
|
+
import { ComponentBlok } from '@storyblok/js';
|
|
5
7
|
import { default as default_2 } from 'react';
|
|
6
8
|
import { ForwardRefExoticComponent } from 'react';
|
|
7
9
|
import { ISbAlternateObject } from '@storyblok/js';
|
|
@@ -35,14 +37,13 @@ import { StoryblokBridgeV2 } from '@storyblok/js';
|
|
|
35
37
|
import { StoryblokClient } from '@storyblok/js';
|
|
36
38
|
import { StoryblokComponentType } from '@storyblok/js';
|
|
37
39
|
import { storyblokEditable } from '@storyblok/js';
|
|
40
|
+
import { StoryblokRichTextDocumentNode } from '@storyblok/richtext';
|
|
38
41
|
import { StoryblokRichTextImageOptimizationOptions } from '@storyblok/js';
|
|
39
42
|
import { StoryblokRichTextNode } from '@storyblok/js';
|
|
40
43
|
import { StoryblokRichTextNode as StoryblokRichTextNode_2 } from '@storyblok/richtext';
|
|
41
|
-
import { StoryblokRichTextNodeResolver } from '@storyblok/js';
|
|
42
44
|
import { StoryblokRichTextNodeTypes } from '@storyblok/js';
|
|
43
45
|
import { StoryblokRichTextOptions } from '@storyblok/js';
|
|
44
46
|
import { StoryblokRichTextOptions as StoryblokRichTextOptions_2 } from '@storyblok/richtext';
|
|
45
|
-
import { StoryblokRichTextResolvers } from '@storyblok/js';
|
|
46
47
|
import { TextTypes } from '@storyblok/js';
|
|
47
48
|
import { useStoryblokBridge } from '@storyblok/js';
|
|
48
49
|
|
|
@@ -50,10 +51,14 @@ export { apiPlugin }
|
|
|
50
51
|
|
|
51
52
|
export { ArrayFn }
|
|
52
53
|
|
|
54
|
+
export { asTag }
|
|
55
|
+
|
|
53
56
|
export { AsyncFn }
|
|
54
57
|
|
|
55
58
|
export { BlockTypes }
|
|
56
59
|
|
|
60
|
+
export { ComponentBlok }
|
|
61
|
+
|
|
57
62
|
export declare const getComponent: (componentKey: string) => React.ElementType | false;
|
|
58
63
|
|
|
59
64
|
export declare const getCustomFallbackComponent: () => React.ElementType;
|
|
@@ -147,19 +152,15 @@ export { StoryblokRichTextImageOptimizationOptions }
|
|
|
147
152
|
|
|
148
153
|
export { StoryblokRichTextNode }
|
|
149
154
|
|
|
150
|
-
export { StoryblokRichTextNodeResolver }
|
|
151
|
-
|
|
152
155
|
export { StoryblokRichTextNodeTypes }
|
|
153
156
|
|
|
154
157
|
export { StoryblokRichTextOptions }
|
|
155
158
|
|
|
156
159
|
export declare interface StoryblokRichTextProps {
|
|
157
160
|
doc: StoryblokRichTextNode<default_2.ReactElement>;
|
|
158
|
-
|
|
161
|
+
tiptapExtensions?: StoryblokRichTextOptions<default_2.ReactElement>['tiptapExtensions'];
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
export { StoryblokRichTextResolvers }
|
|
162
|
-
|
|
163
164
|
export declare const StoryblokServerComponent: ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & RefAttributes<HTMLElement>>;
|
|
164
165
|
|
|
165
166
|
export declare const StoryblokServerRichText: default_2.ForwardRefExoticComponent<StoryblokRichTextProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -188,7 +189,7 @@ export declare type TUseStoryblokState = <T = void>(initialStory: ISbStoryData<T
|
|
|
188
189
|
export { useStoryblokBridge }
|
|
189
190
|
|
|
190
191
|
export declare const useStoryblokServerRichText: (options: StoryblokRichTextOptions_2<React.ReactElement>) => {
|
|
191
|
-
render: (node: StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
192
|
+
render: (node: StoryblokRichTextDocumentNode | StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
192
193
|
};
|
|
193
194
|
|
|
194
195
|
export { }
|
package/dist/rsc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./core/init.js"),o=require("./server/richtext.js"),n=require("./server/server-component.js"),i=require("./server/server-story.js"),l=require("./server/server-storyblok-richtext-component.js"),b=require("./rsc/live-editing.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./core/init.js"),o=require("./server/richtext.js"),n=require("./server/server-component.js"),i=require("./server/server-story.js"),l=require("./server/server-storyblok-richtext-component.js"),b=require("./rsc/live-editing.js"),u=require("./rsc/story.js"),e=require("@storyblok/js"),t=require("./core/state.js"),s=require("./core/use-storyblok-api.js");exports.storyblokInit=r.storyblokInit;exports.useStoryblokServerRichText=o.useStoryblokServerRichText;exports.StoryblokServerComponent=n;exports.StoryblokServerStory=i;exports.StoryblokServerRichText=l;exports.StoryblokLiveEditing=b;exports.StoryblokStory=u;Object.defineProperty(exports,"BlockTypes",{enumerable:!0,get:()=>e.BlockTypes});Object.defineProperty(exports,"ComponentBlok",{enumerable:!0,get:()=>e.ComponentBlok});Object.defineProperty(exports,"MarkTypes",{enumerable:!0,get:()=>e.MarkTypes});Object.defineProperty(exports,"TextTypes",{enumerable:!0,get:()=>e.TextTypes});Object.defineProperty(exports,"apiPlugin",{enumerable:!0,get:()=>e.apiPlugin});Object.defineProperty(exports,"asTag",{enumerable:!0,get:()=>e.asTag});Object.defineProperty(exports,"loadStoryblokBridge",{enumerable:!0,get:()=>e.loadStoryblokBridge});Object.defineProperty(exports,"registerStoryblokBridge",{enumerable:!0,get:()=>e.registerStoryblokBridge});Object.defineProperty(exports,"renderRichText",{enumerable:!0,get:()=>e.renderRichText});Object.defineProperty(exports,"richTextResolver",{enumerable:!0,get:()=>e.richTextResolver});Object.defineProperty(exports,"storyblokEditable",{enumerable:!0,get:()=>e.storyblokEditable});Object.defineProperty(exports,"useStoryblokBridge",{enumerable:!0,get:()=>e.useStoryblokBridge});exports.getComponent=t.getComponent;exports.getCustomFallbackComponent=t.getCustomFallbackComponent;exports.getEnableFallbackComponent=t.getEnableFallbackComponent;exports.setComponents=t.setComponents;exports.getStoryblokApi=s.getStoryblokApi;
|
package/dist/rsc.mjs
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { storyblokInit as r } from "./core/init.mjs";
|
|
2
2
|
import { useStoryblokServerRichText as l } from "./server/richtext.mjs";
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { BlockTypes as x,
|
|
9
|
-
import { getComponent as
|
|
10
|
-
import {
|
|
3
|
+
import { default as p } from "./server/server-component.mjs";
|
|
4
|
+
import { default as k } from "./server/server-story.mjs";
|
|
5
|
+
import { default as n } from "./server/server-storyblok-richtext-component.mjs";
|
|
6
|
+
import { default as b } from "./rsc/live-editing.mjs";
|
|
7
|
+
import { default as S } from "./rsc/story.mjs";
|
|
8
|
+
import { BlockTypes as x, ComponentBlok as d, MarkTypes as g, TextTypes as u, apiPlugin as T, asTag as c, loadStoryblokBridge as C, registerStoryblokBridge as v, renderRichText as B, richTextResolver as h, storyblokEditable as R, useStoryblokBridge as E } from "@storyblok/js";
|
|
9
|
+
import { getComponent as A, getCustomFallbackComponent as I, getEnableFallbackComponent as L, setComponents as M } from "./core/state.mjs";
|
|
10
|
+
import { getStoryblokApi as j } from "./core/use-storyblok-api.mjs";
|
|
11
11
|
export {
|
|
12
12
|
x as BlockTypes,
|
|
13
|
-
d as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
u as
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
h as
|
|
13
|
+
d as ComponentBlok,
|
|
14
|
+
g as MarkTypes,
|
|
15
|
+
b as StoryblokLiveEditing,
|
|
16
|
+
p as StoryblokServerComponent,
|
|
17
|
+
n as StoryblokServerRichText,
|
|
18
|
+
k as StoryblokServerStory,
|
|
19
|
+
S as StoryblokStory,
|
|
20
|
+
u as TextTypes,
|
|
21
|
+
T as apiPlugin,
|
|
22
|
+
c as asTag,
|
|
23
|
+
A as getComponent,
|
|
24
|
+
I as getCustomFallbackComponent,
|
|
25
|
+
L as getEnableFallbackComponent,
|
|
26
|
+
j as getStoryblokApi,
|
|
27
|
+
C as loadStoryblokBridge,
|
|
28
|
+
v as registerStoryblokBridge,
|
|
29
|
+
B as renderRichText,
|
|
30
|
+
h as richTextResolver,
|
|
31
|
+
M as setComponents,
|
|
32
|
+
R as storyblokEditable,
|
|
31
33
|
r as storyblokInit,
|
|
32
|
-
|
|
34
|
+
E as useStoryblokBridge,
|
|
33
35
|
l as useStoryblokServerRichText
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),i=require("react"),u=require("../utils.js"),l=require("./richtext.js"),x=i.forwardRef(({doc:t,
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),i=require("react"),u=require("../utils.js"),l=require("./richtext.js"),x=i.forwardRef(({doc:t,tiptapExtensions:e},r)=>{if(!t)return null;const{render:n}=l.useStoryblokServerRichText({tiptapExtensions:e}),s=n(t),o=u.convertAttributesInElement(s);return c.jsx("div",{ref:r,children:o})});module.exports=x;
|
|
@@ -3,11 +3,11 @@ import { forwardRef as f } from "react";
|
|
|
3
3
|
import { convertAttributesInElement as l } from "../utils.mjs";
|
|
4
4
|
import { useStoryblokServerRichText as s } from "./richtext.mjs";
|
|
5
5
|
const a = f(
|
|
6
|
-
({ doc: r,
|
|
6
|
+
({ doc: r, tiptapExtensions: t }, o) => {
|
|
7
7
|
if (!r)
|
|
8
8
|
return null;
|
|
9
9
|
const { render: e } = s({
|
|
10
|
-
|
|
10
|
+
tiptapExtensions: t
|
|
11
11
|
}), m = e(r), n = l(m);
|
|
12
12
|
return /* @__PURE__ */ i("div", { ref: o, children: n });
|
|
13
13
|
}
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { apiPlugin } from '@storyblok/js';
|
|
2
2
|
import { ArrayFn } from '@storyblok/js';
|
|
3
|
+
import { asTag } from '@storyblok/js';
|
|
3
4
|
import { AsyncFn } from '@storyblok/js';
|
|
4
5
|
import { BlockTypes } from '@storyblok/js';
|
|
6
|
+
import { ComponentBlok } from '@storyblok/js';
|
|
5
7
|
import { default as default_2 } from 'react';
|
|
6
8
|
import { ForwardRefExoticComponent } from 'react';
|
|
7
9
|
import { ISbAlternateObject } from '@storyblok/js';
|
|
@@ -35,14 +37,13 @@ import { StoryblokBridgeV2 } from '@storyblok/js';
|
|
|
35
37
|
import { StoryblokClient } from '@storyblok/js';
|
|
36
38
|
import { StoryblokComponentType } from '@storyblok/js';
|
|
37
39
|
import { storyblokEditable } from '@storyblok/js';
|
|
40
|
+
import { StoryblokRichTextDocumentNode } from '@storyblok/richtext';
|
|
38
41
|
import { StoryblokRichTextImageOptimizationOptions } from '@storyblok/js';
|
|
39
42
|
import { StoryblokRichTextNode } from '@storyblok/js';
|
|
40
43
|
import { StoryblokRichTextNode as StoryblokRichTextNode_2 } from '@storyblok/richtext';
|
|
41
|
-
import { StoryblokRichTextNodeResolver } from '@storyblok/js';
|
|
42
44
|
import { StoryblokRichTextNodeTypes } from '@storyblok/js';
|
|
43
45
|
import { StoryblokRichTextOptions } from '@storyblok/js';
|
|
44
46
|
import { StoryblokRichTextOptions as StoryblokRichTextOptions_2 } from '@storyblok/richtext';
|
|
45
|
-
import { StoryblokRichTextResolvers } from '@storyblok/js';
|
|
46
47
|
import { TextTypes } from '@storyblok/js';
|
|
47
48
|
import { useStoryblokBridge } from '@storyblok/js';
|
|
48
49
|
|
|
@@ -50,10 +51,14 @@ export { apiPlugin }
|
|
|
50
51
|
|
|
51
52
|
export { ArrayFn }
|
|
52
53
|
|
|
54
|
+
export { asTag }
|
|
55
|
+
|
|
53
56
|
export { AsyncFn }
|
|
54
57
|
|
|
55
58
|
export { BlockTypes }
|
|
56
59
|
|
|
60
|
+
export { ComponentBlok }
|
|
61
|
+
|
|
57
62
|
export declare const getComponent: (componentKey: string) => React.ElementType | false;
|
|
58
63
|
|
|
59
64
|
export declare const getCustomFallbackComponent: () => React.ElementType;
|
|
@@ -146,19 +151,15 @@ export { StoryblokRichTextImageOptimizationOptions }
|
|
|
146
151
|
|
|
147
152
|
export { StoryblokRichTextNode }
|
|
148
153
|
|
|
149
|
-
export { StoryblokRichTextNodeResolver }
|
|
150
|
-
|
|
151
154
|
export { StoryblokRichTextNodeTypes }
|
|
152
155
|
|
|
153
156
|
export { StoryblokRichTextOptions }
|
|
154
157
|
|
|
155
158
|
export declare interface StoryblokRichTextProps {
|
|
156
159
|
doc: StoryblokRichTextNode<default_2.ReactElement>;
|
|
157
|
-
|
|
160
|
+
tiptapExtensions?: StoryblokRichTextOptions<default_2.ReactElement>['tiptapExtensions'];
|
|
158
161
|
}
|
|
159
162
|
|
|
160
|
-
export { StoryblokRichTextResolvers }
|
|
161
|
-
|
|
162
163
|
export declare const StoryblokServerComponent: ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & RefAttributes<HTMLElement>>;
|
|
163
164
|
|
|
164
165
|
export declare const StoryblokServerRichText: default_2.ForwardRefExoticComponent<StoryblokRichTextProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
@@ -184,7 +185,7 @@ export { useStoryblokApi }
|
|
|
184
185
|
export { useStoryblokBridge }
|
|
185
186
|
|
|
186
187
|
export declare const useStoryblokServerRichText: (options: StoryblokRichTextOptions_2<React.ReactElement>) => {
|
|
187
|
-
render: (node: StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
188
|
+
render: (node: StoryblokRichTextDocumentNode | StoryblokRichTextNode_2<ReactNode>) => ReactNode;
|
|
188
189
|
};
|
|
189
190
|
|
|
190
191
|
export declare const useStoryblokState: TUseStoryblokState;
|
package/dist/ssr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./core/init.js"),r=require("./core/use-storyblok-api.js"),n=require("./core/storyblok-component.js"),l=require("./core/use-storyblok-state.js"),e=require("@storyblok/js"),b=require("./server/richtext.js"),i=require("./server/server-component.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./core/init.js"),r=require("./core/use-storyblok-api.js"),n=require("./core/storyblok-component.js"),l=require("./core/use-storyblok-state.js"),e=require("@storyblok/js"),b=require("./server/richtext.js"),i=require("./server/server-component.js"),u=require("./server/server-story.js"),s=require("./server/server-storyblok-richtext-component.js"),t=require("./core/state.js");exports.storyblokInit=o.storyblokInit;exports.getStoryblokApi=r.getStoryblokApi;exports.useStoryblokApi=r.getStoryblokApi;exports.StoryblokComponent=n;exports.useStoryblokState=l.useStoryblokState;Object.defineProperty(exports,"BlockTypes",{enumerable:!0,get:()=>e.BlockTypes});Object.defineProperty(exports,"ComponentBlok",{enumerable:!0,get:()=>e.ComponentBlok});Object.defineProperty(exports,"MarkTypes",{enumerable:!0,get:()=>e.MarkTypes});Object.defineProperty(exports,"TextTypes",{enumerable:!0,get:()=>e.TextTypes});Object.defineProperty(exports,"apiPlugin",{enumerable:!0,get:()=>e.apiPlugin});Object.defineProperty(exports,"asTag",{enumerable:!0,get:()=>e.asTag});Object.defineProperty(exports,"loadStoryblokBridge",{enumerable:!0,get:()=>e.loadStoryblokBridge});Object.defineProperty(exports,"registerStoryblokBridge",{enumerable:!0,get:()=>e.registerStoryblokBridge});Object.defineProperty(exports,"renderRichText",{enumerable:!0,get:()=>e.renderRichText});Object.defineProperty(exports,"richTextResolver",{enumerable:!0,get:()=>e.richTextResolver});Object.defineProperty(exports,"storyblokEditable",{enumerable:!0,get:()=>e.storyblokEditable});Object.defineProperty(exports,"useStoryblokBridge",{enumerable:!0,get:()=>e.useStoryblokBridge});exports.useStoryblokServerRichText=b.useStoryblokServerRichText;exports.StoryblokServerComponent=i;exports.StoryblokServerStory=u;exports.StoryblokServerRichText=s;exports.getComponent=t.getComponent;exports.getCustomFallbackComponent=t.getCustomFallbackComponent;exports.getEnableFallbackComponent=t.getEnableFallbackComponent;exports.setComponents=t.setComponents;
|
package/dist/ssr.mjs
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import { storyblokInit as r } from "./core/init.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { default as
|
|
4
|
-
import { useStoryblokState as
|
|
5
|
-
import { BlockTypes as
|
|
6
|
-
import { useStoryblokServerRichText as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
10
|
-
import { getComponent as
|
|
2
|
+
import { getStoryblokApi as l, getStoryblokApi as p } from "./core/use-storyblok-api.mjs";
|
|
3
|
+
import { default as s } from "./core/storyblok-component.mjs";
|
|
4
|
+
import { useStoryblokState as b } from "./core/use-storyblok-state.mjs";
|
|
5
|
+
import { BlockTypes as n, ComponentBlok as y, MarkTypes as S, TextTypes as i, apiPlugin as x, asTag as f, loadStoryblokBridge as g, registerStoryblokBridge as d, renderRichText as u, richTextResolver as T, storyblokEditable as C, useStoryblokBridge as c } from "@storyblok/js";
|
|
6
|
+
import { useStoryblokServerRichText as B } from "./server/richtext.mjs";
|
|
7
|
+
import { default as R } from "./server/server-component.mjs";
|
|
8
|
+
import { default as E } from "./server/server-story.mjs";
|
|
9
|
+
import { default as I } from "./server/server-storyblok-richtext-component.mjs";
|
|
10
|
+
import { getComponent as P, getCustomFallbackComponent as j, getEnableFallbackComponent as q, setComponents as w } from "./core/state.mjs";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
i as
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
P as
|
|
12
|
+
n as BlockTypes,
|
|
13
|
+
y as ComponentBlok,
|
|
14
|
+
S as MarkTypes,
|
|
15
|
+
s as StoryblokComponent,
|
|
16
|
+
R as StoryblokServerComponent,
|
|
17
|
+
I as StoryblokServerRichText,
|
|
18
|
+
E as StoryblokServerStory,
|
|
19
|
+
i as TextTypes,
|
|
20
|
+
x as apiPlugin,
|
|
21
|
+
f as asTag,
|
|
22
|
+
P as getComponent,
|
|
23
|
+
j as getCustomFallbackComponent,
|
|
24
|
+
q as getEnableFallbackComponent,
|
|
23
25
|
l as getStoryblokApi,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
g as loadStoryblokBridge,
|
|
27
|
+
d as registerStoryblokBridge,
|
|
26
28
|
u as renderRichText,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
T as richTextResolver,
|
|
30
|
+
w as setComponents,
|
|
31
|
+
C as storyblokEditable,
|
|
30
32
|
r as storyblokInit,
|
|
31
33
|
p as useStoryblokApi,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
c as useStoryblokBridge,
|
|
35
|
+
B as useStoryblokServerRichText,
|
|
36
|
+
b as useStoryblokState
|
|
35
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),i=require("react"),u=require("./utils.js"),l=require("./richtext.js"),x=i.forwardRef(({doc:t,
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),i=require("react"),u=require("./utils.js"),l=require("./richtext.js"),x=i.forwardRef(({doc:t,tiptapExtensions:e},r)=>{const{render:o}=l.useStoryblokRichText({tiptapExtensions:e}),s=o(t),c=u.convertAttributesInElement(s);return n.jsx("div",{ref:r,children:c})});module.exports=x;
|
|
@@ -3,9 +3,9 @@ import { forwardRef as c } from "react";
|
|
|
3
3
|
import { convertAttributesInElement as f } from "./utils.mjs";
|
|
4
4
|
import { useStoryblokRichText as s } from "./richtext.mjs";
|
|
5
5
|
const h = c(
|
|
6
|
-
({ doc: t,
|
|
6
|
+
({ doc: t, tiptapExtensions: r }, o) => {
|
|
7
7
|
const { render: e } = s({
|
|
8
|
-
|
|
8
|
+
tiptapExtensions: r
|
|
9
9
|
}), m = e(t), n = f(m);
|
|
10
10
|
return /* @__PURE__ */ i("div", { ref: o, children: n });
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.1.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "SDK to integrate Storyblok into your project using React.",
|
|
7
7
|
"author": "Storyblok",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@storyblok/js": "
|
|
52
|
+
"@storyblok/js": "5.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@babel/core": "^7.27.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@testing-library/jest-dom": "^6.6.3",
|
|
60
60
|
"@testing-library/react": "^16.3.0",
|
|
61
61
|
"@tsconfig/recommended": "^1.0.8",
|
|
62
|
-
"@types/node": "^
|
|
62
|
+
"@types/node": "^24.11.0",
|
|
63
63
|
"@types/react": "19.1.4",
|
|
64
64
|
"@vitejs/plugin-react": "^4.4.1",
|
|
65
65
|
"babel-jest": "^29.7.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vite": "^6.3.5",
|
|
77
77
|
"vite-plugin-dts": "^4.5.3",
|
|
78
78
|
"vitest": "^3.1.3",
|
|
79
|
-
"@storyblok/eslint-config": "0.
|
|
79
|
+
"@storyblok/eslint-config": "0.5.0"
|
|
80
80
|
},
|
|
81
81
|
"babel": {
|
|
82
82
|
"presets": [
|
|
@@ -107,9 +107,8 @@
|
|
|
107
107
|
"dev": "vite build --watch",
|
|
108
108
|
"build": "vite build",
|
|
109
109
|
"test:types": "tsc --noEmit --skipLibCheck",
|
|
110
|
-
"test": "pnpm run test:unit
|
|
111
|
-
"test:unit": "vitest",
|
|
112
|
-
"test:unit:ci": "vitest run",
|
|
110
|
+
"test": "pnpm run test:unit && pnpm run test:e2e-next-13 && pnpm run test:e2e-next-latest",
|
|
111
|
+
"test:unit": "vitest run",
|
|
113
112
|
"test:unit:ui": "vitest --ui",
|
|
114
113
|
"test:e2e-next-13": "start-server-and-test playground:next-13 http://localhost:3000/ cy:run",
|
|
115
114
|
"test:e2e-next-latest": "start-server-and-test playground:next-latest http://localhost:3000/ cy:run",
|