schlechtenburg/packages/core/lib/blocks.ts

35 lines
576 B
TypeScript
Raw Normal View History

2020-12-30 01:32:46 +00:00
import { Component } from 'vue';
export interface BlockDefinition {
name: string;
getDefaultData: any;
edit: Component;
display: Component;
}
export interface BlockLibraryDefinition {
[name: string]: BlockDefinition;
}
2021-02-22 18:13:37 +00:00
export interface BlockProps {
2020-12-30 01:32:46 +00:00
blockId: string;
2021-02-22 18:13:37 +00:00
data: any;
2020-12-30 01:32:46 +00:00
}
2021-02-22 18:13:37 +00:00
export interface Block extends BlockProps {
2020-12-30 01:32:46 +00:00
name: string;
}
export const model = {
prop: 'block',
event: 'update',
};
export const blockProps = {
blockId: {
type: String,
default: () => `${+(new Date())}`,
},
data: { type: Object, default: () => ({}) },
};