Initial ts conversion
This commit is contained in:
parent
66491fe3ca
commit
ea597c90fc
|
@ -1,7 +1,7 @@
|
|||
import { get } from "svelte/store"
|
||||
import { BudiStore } from "../BudiStore"
|
||||
import { PreviewDevice } from "@budibase/types"
|
||||
|
||||
type PreviewDevice = "desktop" | "tablet" | "mobile"
|
||||
type PreviewEventHandler = (name: string, payload?: any) => void
|
||||
type ComponentContext = Record<string, any>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { getContext, onDestroy, onMount, setContext } from "svelte"
|
||||
import { builderStore } from "stores/builder.js"
|
||||
import { builderStore } from "@/stores/builder"
|
||||
import { blockStore } from "stores/blocks"
|
||||
|
||||
const component = getContext("component")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import Field from "./Field.svelte"
|
||||
import { CoreDropzone, ProgressCircle, Helpers } from "@budibase/bbui"
|
||||
import { getContext, onMount, onDestroy } from "svelte"
|
||||
import { builderStore } from "stores/builder.js"
|
||||
import { builderStore } from "@/stores/builder"
|
||||
import { processStringSync } from "@budibase/string-templates"
|
||||
|
||||
export let datasourceId
|
||||
|
|
|
@ -2,9 +2,29 @@ import { writable, get } from "svelte/store"
|
|||
import { API } from "api"
|
||||
import { devToolsStore } from "./devTools.js"
|
||||
import { eventStore } from "./events.js"
|
||||
import { PreviewDevice } from "@budibase/types"
|
||||
|
||||
interface BuilderStore {
|
||||
inBuilder: boolean
|
||||
screen: string | null
|
||||
selectedComponentId: string | null
|
||||
editMode: boolean
|
||||
previewId: string | null
|
||||
theme: string | null
|
||||
customTheme: string | null
|
||||
previewDevice: PreviewDevice
|
||||
navigation: string | null
|
||||
hiddenComponentIds: []
|
||||
usedPlugins: string | null
|
||||
eventResolvers: {}
|
||||
metadata: string | null
|
||||
snippets: string | null
|
||||
componentErrors: {}
|
||||
layout: null
|
||||
}
|
||||
|
||||
const createBuilderStore = () => {
|
||||
const initialState = {
|
||||
const initialState: BuilderStore = {
|
||||
inBuilder: false,
|
||||
screen: null,
|
||||
selectedComponentId: null,
|
||||
|
@ -26,7 +46,7 @@ const createBuilderStore = () => {
|
|||
}
|
||||
const store = writable(initialState)
|
||||
const actions = {
|
||||
selectComponent: id => {
|
||||
selectComponent: (id: string) => {
|
||||
if (id === get(store).selectedComponentId) {
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue