@storyblok/react 3.0.15 → 4.2.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/LICENSE +21 -0
- package/README.md +61 -105
- package/dist/client.js +2 -1
- package/dist/client.mjs +1 -0
- package/dist/common/client.d.ts +3 -0
- package/dist/common/client.d.ts.map +1 -0
- package/dist/{types/common → common}/index.d.ts +2 -1
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/storyblok-component.d.ts +7 -0
- package/dist/common/storyblok-component.d.ts.map +1 -0
- package/dist/common.js +1 -0
- package/dist/common.mjs +35 -0
- package/dist/{types/index.d.ts → index.d.ts} +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +4 -4
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.mjs +9 -0
- package/dist/jsx-runtime2.js +1 -0
- package/dist/jsx-runtime2.mjs +4 -0
- package/dist/live-edit-update-action.js +2 -0
- package/dist/live-edit-update-action.mjs +15 -0
- package/dist/live-editing.js +2 -0
- package/dist/live-editing.mjs +19 -0
- package/dist/react-jsx-runtime.development.js +23 -0
- package/dist/react-jsx-runtime.development.mjs +609 -0
- package/dist/react-jsx-runtime.development2.js +1 -0
- package/dist/react-jsx-runtime.development2.mjs +4 -0
- package/dist/react-jsx-runtime.production.min.js +10 -0
- package/dist/react-jsx-runtime.production.min.mjs +29 -0
- package/dist/react-jsx-runtime.production.min2.js +1 -0
- package/dist/react-jsx-runtime.production.min2.mjs +4 -0
- package/dist/rsc/common.d.ts +12 -0
- package/dist/rsc/common.d.ts.map +1 -0
- package/dist/rsc/index.d.ts +3 -0
- package/dist/rsc/index.d.ts.map +1 -0
- package/dist/rsc/live-edit-update-action.d.ts +5 -0
- package/dist/rsc/live-edit-update-action.d.ts.map +1 -0
- package/dist/rsc/live-editing.d.ts +6 -0
- package/dist/rsc/live-editing.d.ts.map +1 -0
- package/dist/rsc/server-component.d.ts +7 -0
- package/dist/rsc/server-component.d.ts.map +1 -0
- package/dist/rsc/story.d.ts +8 -0
- package/dist/rsc/story.d.ts.map +1 -0
- package/dist/rsc.js +1 -1
- package/dist/rsc.mjs +21 -24
- package/dist/server-component.js +1 -0
- package/dist/server-component.mjs +29 -0
- package/dist/story.js +1 -2
- package/dist/story.mjs +26 -7
- package/dist/storyblok-component.js +1 -1
- package/dist/storyblok-component.mjs +20 -14
- package/dist/storyblok-js.js +24 -24
- package/dist/storyblok-js.mjs +373 -354
- package/dist/{types/types.d.ts → types.d.ts} +2 -1
- package/dist/types.d.ts.map +1 -0
- package/package.json +52 -44
- package/dist/bridge-loader.js +0 -2
- package/dist/bridge-loader.mjs +0 -11
- package/dist/types/bridge-loader.d.ts +0 -8
- package/dist/types/common/client.d.ts +0 -2
- package/dist/types/common/storyblok-component.d.ts +0 -8
- package/dist/types/rsc/index.d.ts +0 -4
- package/dist/types/story.d.ts +0 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Storyblok GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -222,7 +222,7 @@ export async function fetchData() {
|
|
|
222
222
|
}
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
## Next.js using App Router
|
|
225
|
+
## Next.js using App Router
|
|
226
226
|
|
|
227
227
|
The components in the `app` directory are by default React Server Side Components, which limits the reactivity. You can enable Storyblok Visual Editor's live editing with React Server Components by rendering them inside a wrapper (`StoryblokPovider`) on the client. The SDK allows you to take full advantage of the Live Editing, but the use of Server Side Components is partial, which will be still better than the older Next.js approach performance-wise. The next section explains about how to use complete server side approach.
|
|
228
228
|
|
|
@@ -230,16 +230,30 @@ The components in the `app` directory are by default React Server Side Component
|
|
|
230
230
|
|
|
231
231
|
### 1. Initialize
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
Create a new file `lib/storyblok.js` and initialize the SDK. Make sure you export the `getStoryblokApi` function, which is an instance of [storyblok-js-client](https://github.com/storyblok/storyblok-js-client) that is shared by client and server components.
|
|
234
234
|
|
|
235
235
|
```js
|
|
236
|
-
|
|
237
|
-
import
|
|
236
|
+
// lib/storyblok.js
|
|
237
|
+
import Page from '@/components/Page';
|
|
238
|
+
import Teaser from '@/components/Teaser';
|
|
239
|
+
import { apiPlugin, storyblokInit } from '@storyblok/react/rsc';
|
|
238
240
|
|
|
239
|
-
storyblokInit({
|
|
241
|
+
export const getStoryblokApi = storyblokInit({
|
|
240
242
|
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
241
243
|
use: [apiPlugin],
|
|
242
|
-
|
|
244
|
+
components: {
|
|
245
|
+
teaser: Teaser,
|
|
246
|
+
page: Page,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
In `app/layout.jsx`, wrap your whole app using a `StoryblokProvider` component (this provider is created in the next step) :
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
// app/layout.jsx
|
|
255
|
+
import { apiPlugin, storyblokInit } from '@storyblok/react/rsc'
|
|
256
|
+
import StoryblokProvider from '../components/StoryblokProvider'
|
|
243
257
|
|
|
244
258
|
export default function RootLayout({ children }) {
|
|
245
259
|
return (
|
|
@@ -254,55 +268,44 @@ export default function RootLayout({ children }) {
|
|
|
254
268
|
|
|
255
269
|
### 2. Create StoryblokProvider and Import your Storyblok Components
|
|
256
270
|
|
|
257
|
-
Create the `components/StoryblokProvider.jsx` file. Re-initalize the connection with Storyblok (this time, on the client) using `
|
|
271
|
+
Create the `components/StoryblokProvider.jsx` file. Re-initalize the connection with Storyblok (this time, on the client) using the `getStoryblokApi` function imported from the `lib/storyblok` file. This will enable the client-side compoenents to interact with the Storyblok API, including the Visual Editor.
|
|
258
272
|
|
|
259
273
|
```js
|
|
260
|
-
|
|
261
|
-
'use client'
|
|
262
|
-
import { apiPlugin, storyblokInit } from '@storyblok/react/rsc'
|
|
274
|
+
// components/StoryblokProvider.jsx
|
|
275
|
+
'use client';
|
|
263
276
|
|
|
264
|
-
|
|
265
|
-
import Page from '../components/Page'
|
|
266
|
-
import Teaser from '../components/Teaser'
|
|
267
|
-
|
|
268
|
-
/** 3. Initialize it as usual */
|
|
269
|
-
storyblokInit({
|
|
270
|
-
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
271
|
-
use: [apiPlugin],
|
|
272
|
-
components: {
|
|
273
|
-
teaser: Teaser,
|
|
274
|
-
page: Page,
|
|
275
|
-
},
|
|
276
|
-
})
|
|
277
|
+
import { getStoryblokApi } from '@/lib/storyblok';
|
|
277
278
|
|
|
278
279
|
export default function StoryblokProvider({ children }) {
|
|
279
|
-
|
|
280
|
+
getStoryblokApi();
|
|
281
|
+
return children;
|
|
280
282
|
}
|
|
281
283
|
```
|
|
282
284
|
|
|
283
|
-
> Note: it's necessary to re-initialize here as well, as to enable the live editing experience inside the Visual Editor you need to initialize the lib universally (client + server).
|
|
284
|
-
|
|
285
285
|
### 3. Fetch Content and Render Components
|
|
286
286
|
|
|
287
|
-
The `getStoryblokApi` function
|
|
288
|
-
You can render the content of your route with the `StoryblokStory` component, which will automatically handle the Visual Editor live events when editing the story. In `app/page.jsx`, use them as follows:
|
|
287
|
+
The `getStoryblokApi` function can now be used inside your Story components to fetch the data from Storyblok. In `app/page.jsx`, use it as follows:
|
|
289
288
|
|
|
290
289
|
```js
|
|
291
|
-
import {
|
|
290
|
+
import { StoryblokClient, ISbStoriesParams } from '@storyblok/react';
|
|
291
|
+
import { StoryblokStory } from '@storyblok/react/rsc';
|
|
292
|
+
import { getStoryblokApi } from '@/lib/storyblok'; // Remember to import from the local file
|
|
292
293
|
|
|
293
294
|
export default async function Home() {
|
|
294
|
-
const { data } = await fetchData()
|
|
295
|
+
const { data } = await fetchData();
|
|
295
296
|
|
|
296
297
|
return (
|
|
297
298
|
<div>
|
|
298
299
|
<StoryblokStory story={data.story} />
|
|
299
300
|
</div>
|
|
300
|
-
)
|
|
301
|
+
);
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
export async function fetchData() {
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
let sbParams: ISbStoriesParams = { version: 'draft' };
|
|
306
|
+
|
|
307
|
+
const storyblokApi: StoryblokClient = getStoryblokApi();
|
|
308
|
+
return storyblokApi.get(`cdn/stories/home`, sbParams);
|
|
306
309
|
}
|
|
307
310
|
```
|
|
308
311
|
|
|
@@ -314,84 +317,27 @@ const bridgeOptions = { resolveRelations: ['article.author'] }
|
|
|
314
317
|
<StoryblokStory story={data.story} bridgeOptions={bridgeOptions} />
|
|
315
318
|
```
|
|
316
319
|
|
|
317
|
-
>
|
|
318
|
-
|
|
319
|
-
To try this setup, take a look at the [Next 13 Live Editing Playground](https://github.com/arorachakit/storyblok-react/tree/main/playground-next13-live-editing) in this repo.
|
|
320
|
-
|
|
321
|
-
## Next.js using App Router - Full React Server Components
|
|
322
|
-
|
|
323
|
-
If you want to use the Next.js `app` directory approach, and React Server Components exclusively with everything on the server side, follow this approach.
|
|
324
|
-
|
|
325
|
-
> The SDK has a special module for RSC. Always import `@storyblok/react/rsc` while using Server Components.
|
|
326
|
-
|
|
327
|
-
**Limitation** - Real-time editing won't work if all the components are rendered on the server. Although, you can see the changes applied in the Visual Editor whenever you save or publish the changes applied to the story.
|
|
328
|
-
|
|
329
|
-
### 1. Initialize and Import your Storyblok Components
|
|
330
|
-
|
|
331
|
-
The initialzation remains the same here as well. Please refer to the above section about "Initialization" for more information about `storyblokInit` function.
|
|
332
|
-
In `app/layout.jsx`, call the `storyblokInit` function and use the new `StoryblokBridgeLoader` component to set up the Storyblok bridge. This Bridge Loader can be imported from `@storyblok/react/bridge-loader`:
|
|
333
|
-
|
|
334
|
-
```js
|
|
335
|
-
import { storyblokInit, apiPlugin, StoryblokBridgeLoader } from "@storyblok/react/rsc";
|
|
336
|
-
|
|
337
|
-
import Page from "../components/Page";
|
|
338
|
-
import Teaser from "../components/Teaser";
|
|
339
|
-
|
|
340
|
-
storyblokInit({
|
|
341
|
-
accessToken: "YOUR_ACCESS_TOKEN",
|
|
342
|
-
use: [apiPlugin],
|
|
343
|
-
components: {
|
|
344
|
-
teaser: Teaser,
|
|
345
|
-
page: Page,
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
export default RootLayout(({ children }) => {
|
|
350
|
-
const bridgeOptions = { resolveRelations: ["article.author"] };
|
|
351
|
-
|
|
352
|
-
return (
|
|
353
|
-
<html lang="en">
|
|
354
|
-
<body>{children}</body>
|
|
355
|
-
<StoryblokBridgeLoader options={bridgeOptions} />
|
|
356
|
-
</html>
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
As the name says, `StoryblokBridgeLoader` loads the bridge on the client. It helps you see the dotted lines and allows you to still click on the components inside the Visual Editor to open their schema. You can pass the bridge options using the `options` prop.
|
|
362
|
-
|
|
363
|
-
### 2. Fetch Content and Render Components
|
|
364
|
-
|
|
365
|
-
The `getStoryblokApi` function, is an instance of [storyblok-js-client](https://github.com/storyblok/storyblok-js-client) can be used to fetch the data from the Storyblok API. This is imported from `@storyblok/react/rsc`.
|
|
366
|
-
Go to the route you want to fetch data from and use it as follows:
|
|
320
|
+
> [!IMPORTANT]
|
|
321
|
+
> When you render components, you must use `StoryblokServerComponent` exported from `@storyblok/react/rsc` instead of `StoryblokComponent`, even when you declare a client component with `"use client"`. This is because the components are always rendered on the server side.
|
|
367
322
|
|
|
368
|
-
```
|
|
369
|
-
import {
|
|
370
|
-
|
|
371
|
-
export default async function Home() {
|
|
372
|
-
const { data } = await fetchData()
|
|
323
|
+
```jsx
|
|
324
|
+
import { storyblokEditable, StoryblokServerComponent } from '@storyblok/react/rsc';
|
|
373
325
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
</div>
|
|
382
|
-
)
|
|
383
|
-
}
|
|
326
|
+
const Page = ({ blok }) => (
|
|
327
|
+
<main {...storyblokEditable(blok)}>
|
|
328
|
+
{blok.body.map(nestedBlok => (
|
|
329
|
+
<StoryblokServerComponent blok={nestedBlok} key={nestedBlok._uid} />
|
|
330
|
+
))}
|
|
331
|
+
</main>
|
|
332
|
+
);
|
|
384
333
|
|
|
385
|
-
export
|
|
386
|
-
const storyblokApi = getStoryblokApi()
|
|
387
|
-
return storyblokApi.get(`cdn/stories/home`, { version: 'draft' })
|
|
388
|
-
}
|
|
334
|
+
export default Page;
|
|
389
335
|
```
|
|
390
336
|
|
|
391
|
-
>
|
|
337
|
+
> [!NOTE]
|
|
338
|
+
> To use this approach (with `getStoryblokApi`), you need to include the `apiPlugin` module when calling `storyblokInit` function. If you don't use `apiPlugin`, you can use your preferred method or function to fetch your data.
|
|
392
339
|
|
|
393
|
-
|
|
394
|
-
To try it, take a look at the [Next 13 RSC Playground](https://github.com/arorachakit/storyblok-react/tree/main/playground-next13-rsc) in this repo.
|
|
340
|
+
To try this setup, take a look at the [Next 13 Live Editing Playground](https://github.com/storyblok/storyblok-react/tree/main/playground/next13) in this repo.
|
|
395
341
|
|
|
396
342
|
## Next.js using Pages Router
|
|
397
343
|
|
|
@@ -708,3 +654,13 @@ By using these techniques, you can ensure that only the necessary components and
|
|
|
708
654
|
|
|
709
655
|
Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react).
|
|
710
656
|
This project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
|
|
657
|
+
|
|
658
|
+
Please run `simple-git-hooks` after cloning the repository to enable the pre-commit hooks.
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
pnpm simple-git-hook
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
## License
|
|
665
|
+
|
|
666
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
package/dist/client.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),b=require("./storyblok-js.js"),f=(e=null,u={})=>{const[d,s]=r.useState(e),o=(e==null?void 0:e.internalId)??(e==null?void 0:e.id)??0,t=typeof window<"u"&&typeof window.storyblokRegisterEvent<"u";return r.useEffect(()=>{s(e),!(!t||!e)&&b.registerStoryblokBridge(o,c=>s(c),u)},[e]),d};exports.useStoryblokState=f;
|
package/dist/client.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,eAAO,MAAM,iBAAiB,EAAE,kBAyB/B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '
|
|
1
|
+
import type { SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '@/types';
|
|
2
2
|
export declare const useStoryblokApi: () => StoryblokClient;
|
|
3
3
|
export declare const setComponents: (newComponentsMap: SbReactComponentsMap) => SbReactComponentsMap;
|
|
4
4
|
export declare const getComponent: (componentKey: string) => false | import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>;
|
|
@@ -9,3 +9,4 @@ export * from '../types';
|
|
|
9
9
|
export { useStoryblokApi as getStoryblokApi };
|
|
10
10
|
export { default as StoryblokComponent } from './storyblok-component';
|
|
11
11
|
export { apiPlugin, loadStoryblokBridge, registerStoryblokBridge, renderRichText, RichTextResolver, RichTextSchema, storyblokEditable, useStoryblokBridge, } from '@storyblok/js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,eAAe,QAAO,eAQlC,CAAC;AAEF,eAAO,MAAM,aAAa,qBAAsB,oBAAoB,yBAGnE,CAAC;AAEF,eAAO,MAAM,YAAY,iBAAkB,MAAM,0FAOhD,CAAC;AAEF,eAAO,MAAM,0BAA0B,eAAgC,CAAC;AACxE,eAAO,MAAM,0BAA0B,qFAAgC,CAAC;AAExE,eAAO,MAAM,aAAa,mBAAmB,iBAAiB,SAO7D,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SbBlokData } from '@/types';
|
|
2
|
+
interface StoryblokComponentProps {
|
|
3
|
+
blok: SbBlokData;
|
|
4
|
+
}
|
|
5
|
+
declare const StoryblokComponent: import("react").ForwardRefExoticComponent<StoryblokComponentProps & import("react").RefAttributes<HTMLElement>>;
|
|
6
|
+
export default StoryblokComponent;
|
|
7
|
+
//# sourceMappingURL=storyblok-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storyblok-component.d.ts","sourceRoot":"","sources":["../../src/common/storyblok-component.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,UAAU,uBAAuB;IAC/B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,QAAA,MAAM,kBAAkB,iHAuCvB,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
|
package/dist/common.js
ADDED
|
@@ -0,0 +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),m=()=>l,u=()=>s,g=(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=u;exports.getEnableFallbackComponent=m;exports.getStoryblokApi=a;exports.setComponents=c;exports.storyblokInit=g;exports.useStoryblokApi=a;
|
package/dist/common.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { storyblokInit as a } from "./storyblok-js.mjs";
|
|
2
|
+
import { RichTextResolver as g, RichTextSchema as C, apiPlugin as d, loadStoryblokBridge as S, registerStoryblokBridge as h, renderRichText as x, storyblokEditable as F, registerStoryblokBridge as A } from "./storyblok-js.mjs";
|
|
3
|
+
import { default as R } from "./server-component.mjs";
|
|
4
|
+
let e = null;
|
|
5
|
+
const r = /* @__PURE__ */ new Map();
|
|
6
|
+
let n = !1, l = null;
|
|
7
|
+
globalThis.storyCache = /* @__PURE__ */ new Map();
|
|
8
|
+
const i = () => (e || console.error(
|
|
9
|
+
"You can't use getStoryblokApi if you're not loading apiPlugin."
|
|
10
|
+
), e), c = (o) => (Object.entries(o).forEach(([t, s]) => {
|
|
11
|
+
r.set(t, s);
|
|
12
|
+
}), r), k = (o) => r.has(o) ? r.get(o) : (console.error(`Component ${o} doesn't exist.`), !1), m = () => n, p = () => l, u = (o = {}) => {
|
|
13
|
+
if (e)
|
|
14
|
+
return () => e;
|
|
15
|
+
const { storyblokApi: t } = a(o);
|
|
16
|
+
return e = t, o.components && c(o.components), n = o.enableFallbackComponent, l = o.customFallbackComponent, () => t;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
g as RichTextResolver,
|
|
20
|
+
C as RichTextSchema,
|
|
21
|
+
R as StoryblokServerComponent,
|
|
22
|
+
d as apiPlugin,
|
|
23
|
+
k as getComponent,
|
|
24
|
+
p as getCustomFallbackComponent,
|
|
25
|
+
m as getEnableFallbackComponent,
|
|
26
|
+
i as getStoryblokApi,
|
|
27
|
+
S as loadStoryblokBridge,
|
|
28
|
+
h as registerStoryblokBridge,
|
|
29
|
+
x as renderRichText,
|
|
30
|
+
c as setComponents,
|
|
31
|
+
F as storyblokEditable,
|
|
32
|
+
u as storyblokInit,
|
|
33
|
+
i as useStoryblokApi,
|
|
34
|
+
A as useStoryblokBridge
|
|
35
|
+
};
|
|
@@ -2,5 +2,6 @@ import type { ISbStoriesParams, ISbStoryData, StoryblokBridgeConfigV2 } from './
|
|
|
2
2
|
export declare const useStoryblok: (slug: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<import("@storyblok/js").StoryblokComponentType<string> & {
|
|
3
3
|
[index: string]: any;
|
|
4
4
|
}>;
|
|
5
|
-
export * from './common';
|
|
6
5
|
export * from './common/client';
|
|
6
|
+
export * from './common/index';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,YAAY,SACjB,MAAM,eACA,gBAAgB,kBACb,uBAAuB;;EAgDvC,CAAC;AAEF,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
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.js"),o=require("./index2.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),e=require("./storyblok-js.js"),o=require("./index2.js"),c=require("./client.js"),S=require("./storyblok-component.js"),d=(s,r={},t={})=>{const[u,i]=y.useState({}),a=typeof window<"u"&&typeof window.storyblokRegisterEvent<"u",n=o.useStoryblokApi();return y.useEffect(()=>{if(!n){console.error("You can't use useStoryblok if you're not loading apiPlugin.");return}async function b(){const{data:l}=await n.get(`cdn/stories/${s}`,r);i(l.story),a&&l.story.id&&e.registerStoryblokBridge(l.story.id,k=>i(k),t)}b()},[s,JSON.stringify(r),n]),n?(t.resolveRelations=t.resolveRelations??r.resolve_relations,t.resolveLinks=t.resolveLinks??r.resolve_links,u):null};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.getCustomFallbackComponent=o.getCustomFallbackComponent;exports.getEnableFallbackComponent=o.getEnableFallbackComponent;exports.getStoryblokApi=o.useStoryblokApi;exports.setComponents=o.setComponents;exports.storyblokInit=o.storyblokInit;exports.useStoryblokApi=o.useStoryblokApi;exports.useStoryblokState=c.useStoryblokState;exports.StoryblokComponent=S;exports.useStoryblok=d;
|
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { registerStoryblokBridge as k } from "./storyblok-js.mjs";
|
|
|
3
3
|
import { RichTextResolver as v, RichTextSchema as x, apiPlugin as R, loadStoryblokBridge as C, renderRichText as w, storyblokEditable as B } from "./storyblok-js.mjs";
|
|
4
4
|
import { useStoryblokApi as c } from "./index2.mjs";
|
|
5
5
|
import { getComponent as h, getCustomFallbackComponent as A, getEnableFallbackComponent as T, setComponents as F, storyblokInit as I } from "./index2.mjs";
|
|
6
|
-
import { useStoryblokState as
|
|
7
|
-
import { default as
|
|
6
|
+
import { useStoryblokState as P } from "./client.mjs";
|
|
7
|
+
import { default as q } from "./storyblok-component.mjs";
|
|
8
8
|
const b = (s, e = {}, o = {}) => {
|
|
9
9
|
const [l, n] = f({}), i = typeof window < "u" && typeof window.storyblokRegisterEvent < "u", t = c();
|
|
10
10
|
return u(() => {
|
|
@@ -31,7 +31,7 @@ const b = (s, e = {}, o = {}) => {
|
|
|
31
31
|
export {
|
|
32
32
|
v as RichTextResolver,
|
|
33
33
|
x as RichTextSchema,
|
|
34
|
-
|
|
34
|
+
q as StoryblokComponent,
|
|
35
35
|
R as apiPlugin,
|
|
36
36
|
h as getComponent,
|
|
37
37
|
A as getCustomFallbackComponent,
|
|
@@ -46,5 +46,5 @@ export {
|
|
|
46
46
|
b as useStoryblok,
|
|
47
47
|
c as useStoryblokApi,
|
|
48
48
|
k as useStoryblokBridge,
|
|
49
|
-
|
|
49
|
+
P as useStoryblokState
|
|
50
50
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime2.js"),r=require("./react-jsx-runtime.production.min.js"),t=require("./react-jsx-runtime.development.js");process.env.NODE_ENV==="production"?e.__module.exports=r.__require():e.__module.exports=t.__require();var o=e.__module.exports;exports.jsxRuntimeExports=o;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { __module as e } from "./jsx-runtime2.mjs";
|
|
3
|
+
import { __require as r } from "./react-jsx-runtime.production.min.mjs";
|
|
4
|
+
import { __require as o } from "./react-jsx-runtime.development.mjs";
|
|
5
|
+
process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o();
|
|
6
|
+
var m = e.exports;
|
|
7
|
+
export {
|
|
8
|
+
m as j
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
"use strict";var n=Object.create;var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var p=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of d(t))!s.call(e,r)&&r!==i&&a(e,r,{get:()=>t[r],enumerable:!(o=c(t,r))||o.enumerable});return e};var v=(e,t,i)=>(i=e!=null?n(l(e)):{},p(t||!e||!e.__esModule?a(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function u({story:e,pathToRevalidate:t}){if(!e||!t)return console.error("liveEditUpdateAction: story or pathToRevalidate is not provided");if(globalThis.storyCache.set(e.uuid,e),process.env.NEXT_RUNTIME)try{const{revalidatePath:i}=await import("next/cache");i(t)}catch(i){console.error("liveEditUpdateAction: error while revalidating path",i)}}exports.liveEditUpdateAction=u;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
async function r({ story: e, pathToRevalidate: i }) {
|
|
3
|
+
if (!e || !i)
|
|
4
|
+
return console.error("liveEditUpdateAction: story or pathToRevalidate is not provided");
|
|
5
|
+
if (globalThis.storyCache.set(e.uuid, e), process.env.NEXT_RUNTIME)
|
|
6
|
+
try {
|
|
7
|
+
const { revalidatePath: t } = await import("next/cache");
|
|
8
|
+
t(i);
|
|
9
|
+
} catch (t) {
|
|
10
|
+
console.error("liveEditUpdateAction: error while revalidating path", t);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
r as liveEditUpdateAction
|
|
15
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";const l=require("./storyblok-js.js"),n=require("react"),o=require("./live-edit-update-action.js"),u=({story:e=null,bridgeOptions:t={}})=>{if(typeof window>"u")return null;const r=i=>{i&&n.startTransition(()=>{o.liveEditUpdateAction({story:i,pathToRevalidate:window.location.pathname})})},d=(e==null?void 0:e.internalId)??(e==null?void 0:e.id)??0;return n.useEffect(()=>{l.registerStoryblokBridge(d,i=>r(i),t)},[]),null};module.exports=u;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerStoryblokBridge as d } from "./storyblok-js.mjs";
|
|
3
|
+
import { useEffect as l, startTransition as o } from "react";
|
|
4
|
+
import { liveEditUpdateAction as r } from "./live-edit-update-action.mjs";
|
|
5
|
+
const m = ({ story: n = null, bridgeOptions: i = {} }) => {
|
|
6
|
+
if (typeof window > "u")
|
|
7
|
+
return null;
|
|
8
|
+
const t = (e) => {
|
|
9
|
+
e && o(() => {
|
|
10
|
+
r({ story: e, pathToRevalidate: window.location.pathname });
|
|
11
|
+
});
|
|
12
|
+
}, a = (n == null ? void 0 : n.internalId) ?? (n == null ? void 0 : n.id) ?? 0;
|
|
13
|
+
return l(() => {
|
|
14
|
+
d(a, (e) => t(e), i);
|
|
15
|
+
}, []), null;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
m as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./react-jsx-runtime.development2.js"),or=require("react");/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.development.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Ee;function ur(){return Ee||(Ee=1,process.env.NODE_ENV!=="production"&&function(){var _e=or,x=Symbol.for("react.element"),Re=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),G=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),me=Symbol.for("react.offscreen"),J=Symbol.iterator,Te="@@iterator";function Se(e){if(e===null||typeof e!="object")return null;var r=J&&e[J]||e[Te];return typeof r=="function"?r:null}var h=_e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ce("error",e,t)}}function Ce(e,r,t){{var n=h.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var u=t.map(function(i){return String(i)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var Oe=!1,Pe=!1,we=!1,je=!1,ke=!1,z;z=Symbol.for("react.module.reference");function xe(e){return!!(typeof e=="string"||typeof e=="function"||e===S||e===K||ke||e===B||e===A||e===D||je||e===me||Oe||Pe||we||typeof e=="object"&&e!==null&&(e.$$typeof===F||e.$$typeof===O||e.$$typeof===N||e.$$typeof===G||e.$$typeof===C||e.$$typeof===z||e.getModuleId!==void 0))}function Ae(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function X(e){return e.displayName||"Context"}function p(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case Re:return"Portal";case K:return"Profiler";case B:return"StrictMode";case A:return"Suspense";case D:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case G:var r=e;return X(r)+".Consumer";case N:var t=e;return X(t._context)+".Provider";case C:return Ae(e,e.render,"ForwardRef");case O:var n=e.displayName||null;return n!==null?n:p(e.type)||"Memo";case F:{var o=e,u=o._payload,i=o._init;try{return p(i(u))}catch{return null}}}return null}var g=Object.assign,_=0,H,Z,Q,ee,re,te,ne;function ae(){}ae.__reactDisabledLog=!0;function De(){{if(_===0){H=console.log,Z=console.info,Q=console.warn,ee=console.error,re=console.group,te=console.groupCollapsed,ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ae,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}_++}}function Fe(){{if(_--,_===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:g({},e,{value:H}),info:g({},e,{value:Z}),warn:g({},e,{value:Q}),error:g({},e,{value:ee}),group:g({},e,{value:re}),groupCollapsed:g({},e,{value:te}),groupEnd:g({},e,{value:ne})})}_<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=h.ReactCurrentDispatcher,W;function P(e,r,t){{if(W===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);W=n&&n[1]||""}return`
|
|
11
|
+
`+W+e}}var $=!1,w;{var Ie=typeof WeakMap=="function"?WeakMap:Map;w=new Ie}function ie(e,r){if(!e||$)return"";{var t=w.get(e);if(t!==void 0)return t}var n;$=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=I.current,I.current=null,De();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(v){n=v}Reflect.construct(e,[],i)}else{try{i.call()}catch(v){n=v}e.call(i.prototype)}}else{try{throw Error()}catch(v){n=v}e()}}catch(v){if(v&&n&&typeof v.stack=="string"){for(var a=v.stack.split(`
|
|
12
|
+
`),c=n.stack.split(`
|
|
13
|
+
`),s=a.length-1,l=c.length-1;s>=1&&l>=0&&a[s]!==c[l];)l--;for(;s>=1&&l>=0;s--,l--)if(a[s]!==c[l]){if(s!==1||l!==1)do if(s--,l--,l<0||a[s]!==c[l]){var d=`
|
|
14
|
+
`+a[s].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),typeof e=="function"&&w.set(e,d),d}while(s>=1&&l>=0);break}}}finally{$=!1,I.current=u,Fe(),Error.prepareStackTrace=o}var E=e?e.displayName||e.name:"",b=E?P(E):"";return typeof e=="function"&&w.set(e,b),b}function We(e,r,t){return ie(e,!1)}function $e(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function j(e,r,t){if(e==null)return"";if(typeof e=="function")return ie(e,$e(e));if(typeof e=="string")return P(e);switch(e){case A:return P("Suspense");case D:return P("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case C:return We(e.render);case O:return j(e.type,r,t);case F:{var n=e,o=n._payload,u=n._init;try{return j(u(o),r,t)}catch{}}}return""}var R=Object.prototype.hasOwnProperty,oe={},ue=h.ReactDebugCurrentFrame;function k(e){if(e){var r=e._owner,t=j(e.type,e._source,r?r.type:null);ue.setExtraStackFrame(t)}else ue.setExtraStackFrame(null)}function Ye(e,r,t,n,o){{var u=Function.call.bind(R);for(var i in e)if(u(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var c=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(k(o),f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),k(null)),a instanceof Error&&!(a.message in oe)&&(oe[a.message]=!0,k(o),f("Failed %s type: %s",t,a.message),k(null))}}}var Me=Array.isArray;function Y(e){return Me(e)}function Ve(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Le(e){try{return se(e),!1}catch{return!0}}function se(e){return""+e}function le(e){if(Le(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(e)),se(e)}var m=h.ReactCurrentOwner,Ue={key:!0,ref:!0,__self:!0,__source:!0},fe,ce,M;M={};function qe(e){if(R.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Be(e){if(R.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ke(e,r){if(typeof e.ref=="string"&&m.current&&r&&m.current.stateNode!==r){var t=p(m.current.type);M[t]||(f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',p(m.current.type),e.ref),M[t]=!0)}}function Ne(e,r){{var t=function(){fe||(fe=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function Ge(e,r){{var t=function(){ce||(ce=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Je=function(e,r,t,n,o,u,i){var a={$$typeof:x,type:e,key:r,ref:t,props:i,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ze(e,r,t,n,o){{var u,i={},a=null,c=null;t!==void 0&&(le(t),a=""+t),Be(r)&&(le(r.key),a=""+r.key),qe(r)&&(c=r.ref,Ke(r,o));for(u in r)R.call(r,u)&&!Ue.hasOwnProperty(u)&&(i[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)i[u]===void 0&&(i[u]=s[u])}if(a||c){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&Ne(i,l),c&&Ge(i,l)}return Je(e,a,c,o,n,m.current,i)}}var V=h.ReactCurrentOwner,ve=h.ReactDebugCurrentFrame;function y(e){if(e){var r=e._owner,t=j(e.type,e._source,r?r.type:null);ve.setExtraStackFrame(t)}else ve.setExtraStackFrame(null)}var L;L=!1;function U(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}function de(){{if(V.current){var e=p(V.current.type);if(e)return`
|
|
15
|
+
|
|
16
|
+
Check the render method of \``+e+"`."}return""}}function Xe(e){return""}var pe={};function He(e){{var r=de();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
17
|
+
|
|
18
|
+
Check the top-level render call using <`+t+">.")}return r}}function ge(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=He(r);if(pe[t])return;pe[t]=!0;var n="";e&&e._owner&&e._owner!==V.current&&(n=" It was passed a child from "+p(e._owner.type)+"."),y(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),y(null)}}function be(e,r){{if(typeof e!="object")return;if(Y(e))for(var t=0;t<e.length;t++){var n=e[t];U(n)&&ge(n,r)}else if(U(e))e._store&&(e._store.validated=!0);else if(e){var o=Se(e);if(typeof o=="function"&&o!==e.entries)for(var u=o.call(e),i;!(i=u.next()).done;)U(i.value)&&ge(i.value,r)}}}function Ze(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===C||r.$$typeof===O))t=r.propTypes;else return;if(t){var n=p(r);Ye(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!L){L=!0;var o=p(r);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Qe(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){y(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),y(null);break}}e.ref!==null&&(y(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),y(null))}}var he={};function ye(e,r,t,n,o,u){{var i=xe(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var c=Xe();c?a+=c:a+=de();var s;e===null?s="null":Y(e)?s="array":e!==void 0&&e.$$typeof===x?(s="<"+(p(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var l=ze(e,r,t,o,u);if(l==null)return l;if(i){var d=r.children;if(d!==void 0)if(n)if(Y(d)){for(var E=0;E<d.length;E++)be(d[E],e);Object.freeze&&Object.freeze(d)}else f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else be(d,e)}if(R.call(r,"key")){var b=p(e),v=Object.keys(r).filter(function(ir){return ir!=="key"}),q=v.length>0?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}";if(!he[b+q]){var ar=v.length>0?"{"+v.join(": ..., ")+": ...}":"{}";f(`A props object containing a "key" prop is being spread into JSX:
|
|
19
|
+
let props = %s;
|
|
20
|
+
<%s {...props} />
|
|
21
|
+
React keys must be passed directly to JSX without using spread:
|
|
22
|
+
let props = %s;
|
|
23
|
+
<%s key={someKey} {...props} />`,q,b,ar,b),he[b+q]=!0}}return e===S?Qe(l):Ze(l),l}}function er(e,r,t){return ye(e,r,t,!0)}function rr(e,r,t){return ye(e,r,t,!1)}var tr=rr,nr=er;T.__exports.Fragment=S,T.__exports.jsx=tr,T.__exports.jsxs=nr}()),T.__exports}exports.__require=ur;
|