@storyblok/astro 6.0.2 → 6.1.0-alpha.2

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.
@@ -1,15 +1,14 @@
1
1
  ---
2
- import components from "virtual:storyblok-components";
3
- import options from "virtual:storyblok-options";
4
- import { toCamelCase } from "@storyblok/astro";
5
- import type { SbBlokData } from "@storyblok/js";
6
- import type { AstroComponentFactory } from "astro/runtime/server/index.js";
2
+ import components from 'virtual:storyblok-components';
3
+ import options from 'virtual:storyblok-options';
4
+ import { toCamelCase } from '@storyblok/astro';
5
+ import type { SbBlokData } from '@storyblok/js';
6
+ import type { AstroComponentFactory } from 'astro/runtime/server/index.js';
7
7
 
8
8
  export interface Props {
9
9
  blok: SbBlokData;
10
10
  [prop: string]: unknown;
11
11
  }
12
-
13
12
  const { blok, ...props } = Astro.props;
14
13
 
15
14
  if (!blok) {
@@ -24,16 +23,14 @@ if (!blok) {
24
23
  let key = toCamelCase(blok.component as string);
25
24
 
26
25
  const componentFound: boolean = key in components;
27
-
28
26
  let Component: AstroComponentFactory;
29
-
30
27
  if (!componentFound) {
31
28
  if (!options.enableFallbackComponent)
32
29
  throw new Error(
33
30
  `Component could not be found for blok "${blok.component}"! Is it defined in astro.config.mjs?`
34
31
  );
35
32
  else {
36
- Component = components["FallbackComponent"];
33
+ Component = components['FallbackComponent'];
37
34
  }
38
35
  } else {
39
36
  Component = components[key];
@@ -0,0 +1,11 @@
1
+ import { Loader } from 'astro/loaders';
2
+ import { ISbConfig, ISbStoriesParams } from '@storyblok/js';
3
+ interface StoryblokLoaderConfig {
4
+ accessToken: string;
5
+ version: 'draft' | 'published';
6
+ useCustomApi?: boolean;
7
+ apiOptions?: ISbConfig;
8
+ storiesParams?: ISbStoriesParams;
9
+ }
10
+ export declare function storyblokLoader(config: StoryblokLoaderConfig): Loader;
11
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { default as storyblokIntegration } from './lib/storyblok-integration';
2
+ export { storyblokLoader } from './content-loader/storyblokLoader';
2
3
  export { getLiveStory, renderRichText, useStoryblokApi } from './lib/helpers';
4
+ export type { IntegrationOptions } from './lib/storyblok-integration';
3
5
  export { handleStoryblokMessage } from './live-preview/handleStoryblokMessage';
4
6
  export * from './types';
5
7
  export { toCamelCase } from './utils/toCamelCase';
6
- export { loadStoryblokBridge, RichTextResolver, RichTextSchema, storyblokEditable, } from '@storyblok/js';
7
8
  export { storyblokIntegration as storyblok };
9
+ export { loadStoryblokBridge, RichTextResolver, RichTextSchema, storyblokEditable, } from '@storyblok/js';