32 lines
715 B
Svelte
32 lines
715 B
Svelte
<script>
|
|
import BindingPanel from "./BindingPanel.svelte"
|
|
import { snippetStore } from "stores/builder"
|
|
|
|
export let bindings = []
|
|
export let valid
|
|
export let value = ""
|
|
export let allowJS = false
|
|
export let context = null
|
|
|
|
$: enrichedBindings = enrichBindings(bindings)
|
|
|
|
// Ensure bindings have the correct properties
|
|
const enrichBindings = bindings => {
|
|
return bindings?.map(binding => ({
|
|
...binding,
|
|
readableBinding: binding.readableBinding || binding.label,
|
|
runtimeBinding: binding.runtimeBinding || binding.path,
|
|
}))
|
|
}
|
|
</script>
|
|
|
|
<BindingPanel
|
|
bind:valid
|
|
bindings={enrichedBindings}
|
|
snippets={$snippetStore}
|
|
{value}
|
|
{allowJS}
|
|
{context}
|
|
on:change
|
|
/>
|