Skip to content

Commit

Permalink
feat: adapt naming convention type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Aug 27, 2024
1 parent 4cd21d5 commit 29aaed0
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 56 deletions.
8 changes: 4 additions & 4 deletions lib/components/StoryblokRichText.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<script setup lang="ts">
import type { VNode } from "vue";
import type { SbRichTextNode } from "@storyblok/js";
import type { StoryblokRichTextNode } from "@storyblok/js";
import { useStoryblokRichText } from "../composables/useStoryblokRichText";
import type { SbRichTextProps } from "../types";
import type { StoryblokRichTextProps } from "../types";
const props = defineProps<SbRichTextProps>();
const props = defineProps<StoryblokRichTextProps>();
const { render } = useStoryblokRichText({
resolvers: props.resolvers ?? {},
});
const root = () => render(props.doc as SbRichTextNode<VNode>);
const root = () => render(props.doc as StoryblokRichTextNode<VNode>);
</script>

<template>
Expand Down
14 changes: 7 additions & 7 deletions lib/composables/useStoryblokRichText.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { VNode } from "vue";
import { createTextVNode, h } from "vue";
import type {
SbRichTextNode,
SbRichTextNodeResolver,
newSbRichTextOptions,
StoryblokRichTextNode,
StoryblokRichTextNodeResolver,
StoryblokRichTextOptions,
} from "@storyblok/js";
import { BlockTypes, richTextResolver } from "@storyblok/js";
import StoryblokComponent from "../StoryblokComponent.vue";

const componentResolver: SbRichTextNodeResolver<VNode> = (
node: SbRichTextNode<VNode>
const componentResolver: StoryblokRichTextNodeResolver<VNode> = (
node: StoryblokRichTextNode<VNode>
): VNode => {
return h(
StoryblokComponent,
Expand All @@ -21,8 +21,8 @@ const componentResolver: SbRichTextNodeResolver<VNode> = (
);
};

export function useStoryblokRichText(options: newSbRichTextOptions<VNode>) {
const mergedOptions: newSbRichTextOptions<VNode> = {
export function useStoryblokRichText(options: StoryblokRichTextOptions<VNode>) {
const mergedOptions: StoryblokRichTextOptions<VNode> = {
renderFn: h,
textFn: createTextVNode,
resolvers: {
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"prepublishOnly": "npm run build && cp ../README.md ./"
},
"dependencies": {
"@storyblok/js": "^3.1.0-next.2"
"@storyblok/js": "^3.1.0"
},
"devDependencies": {
"@babel/core": "^7.24.7",
Expand Down
24 changes: 12 additions & 12 deletions lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SbBlokData, SbSDKOptions } from "@storyblok/js";
import type StoryblokComponent from "./StoryblokComponent.vue";
import type {
SbRichTextDocumentNode,
SbRichTextResolvers,
StoryblokRichTextDocumentNode,
StoryblokRichTextResolvers,
} from "@storyblok/js";
import type { VNode } from "vue";

Expand Down Expand Up @@ -33,19 +33,19 @@ export type {
ISbAlternateObject,
ISbStoriesParams,
ISbStoryParams,
ISbRichtext,
IStoryblokRichtext,
SbBlokData,
SbBlokKeyDataTypes,
SbSDKOptions,
StoryblokBridgeConfigV2,
StoryblokBridgeV2,
StoryblokClient,
SbRichTextDocumentNode,
SbRichTextNodeTypes,
SbRichTextNode,
SbRichTextResolvers,
SbRichTextNodeResolver,
SbRichTextImageOptimizationOptions,
StoryblokRichTextDocumentNode,
StoryblokRichTextNodeTypes,
StoryblokRichTextNode,
StoryblokRichTextResolvers,
StoryblokRichTextNodeResolver,
StoryblokRichTextImageOptimizationOptions,
} from "@storyblok/js";

export interface SbVueSDKOptions extends SbSDKOptions {
Expand All @@ -63,7 +63,7 @@ export interface SbComponentProps {
blok: SbBlokData;
}

export interface SbRichTextProps {
doc: SbRichTextDocumentNode;
resolvers?: SbRichTextResolvers<VNode>;
export interface StoryblokRichTextProps {
doc: StoryblokRichTextDocumentNode;
resolvers?: StoryblokRichTextResolvers<VNode>;
}
62 changes: 30 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29aaed0

Please sign in to comment.