Initial ts conversion

This commit is contained in:
Adria Navarro 2025-02-13 10:46:40 +01:00
parent 66491fe3ca
commit ea597c90fc
4 changed files with 25 additions and 5 deletions

View File

@ -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>

View File

@ -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")

View File

@ -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

View File

@ -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
}