budibase/packages/client/src/store/builder.js

27 lines
530 B
JavaScript
Raw Normal View History

import { writable } from "svelte/store"
const createBuilderStore = () => {
const initialState = {
inBuilder: false,
layout: null,
screen: null,
selectedComponentId: null,
previewId: null,
previewType: null,
}
const store = writable(initialState)
const actions = {
selectComponent: id => {
window.dispatchEvent(
new CustomEvent("bb-select-component", { detail: id })
)
},
}
return {
...store,
actions,
}
}
export const builderStore = createBuilderStore()