18
packages/models/src/features/blocks/bubbles/audio.ts
Normal file
18
packages/models/src/features/blocks/bubbles/audio.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema, BubbleBlockType } from '../shared'
|
||||
|
||||
export const audioBubbleContentSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
})
|
||||
|
||||
export const audioBubbleBlockSchema = blockBaseSchema.and(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.AUDIO]),
|
||||
content: audioBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export const defaultAudioBubbleContent = {}
|
||||
|
||||
export type AudioBubbleBlock = z.infer<typeof audioBubbleBlockSchema>
|
||||
export type AudioBubbleContent = z.infer<typeof audioBubbleContentSchema>
|
@ -1,4 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import { audioBubbleBlockSchema, audioBubbleContentSchema } from './audio'
|
||||
import { embedBubbleContentSchema, embedBubbleBlockSchema } from './embed'
|
||||
import { imageBubbleContentSchema, imageBubbleBlockSchema } from './image'
|
||||
import { textBubbleContentSchema, textBubbleBlockSchema } from './text'
|
||||
@ -8,11 +9,13 @@ export const bubbleBlockContentSchema = textBubbleContentSchema
|
||||
.or(imageBubbleContentSchema)
|
||||
.or(videoBubbleContentSchema)
|
||||
.or(embedBubbleContentSchema)
|
||||
.or(audioBubbleContentSchema)
|
||||
|
||||
export const bubbleBlockSchema = textBubbleBlockSchema
|
||||
.or(imageBubbleBlockSchema)
|
||||
.or(videoBubbleBlockSchema)
|
||||
.or(embedBubbleBlockSchema)
|
||||
.or(audioBubbleBlockSchema)
|
||||
|
||||
export type BubbleBlock = z.infer<typeof bubbleBlockSchema>
|
||||
export type BubbleBlockContent = z.infer<typeof bubbleBlockContentSchema>
|
||||
|
@ -3,3 +3,4 @@ export * from './text'
|
||||
export * from './image'
|
||||
export * from './video'
|
||||
export * from './embed'
|
||||
export * from './audio'
|
||||
|
@ -28,6 +28,7 @@ export enum BubbleBlockType {
|
||||
IMAGE = 'image',
|
||||
VIDEO = 'video',
|
||||
EMBED = 'embed',
|
||||
AUDIO = 'audio',
|
||||
}
|
||||
|
||||
export enum InputBlockType {
|
||||
|
Reference in New Issue
Block a user