+
{text}
{/if}
@@ -30,6 +35,7 @@
diff --git a/packages/client/src/components/preview/IndicatorSet.svelte b/packages/client/src/components/preview/IndicatorSet.svelte
index 957c7d7bef..012aa7e470 100644
--- a/packages/client/src/components/preview/IndicatorSet.svelte
+++ b/packages/client/src/components/preview/IndicatorSet.svelte
@@ -7,6 +7,7 @@
export let color
export let transition
export let zIndex
+ export let prefix = null
let indicators = []
let interval
@@ -51,6 +52,9 @@
const parents = document.getElementsByClassName(componentId)
if (parents.length) {
text = parents[0].dataset.name
+ if (prefix) {
+ text = `${prefix} ${text}`
+ }
}
// Batch reads to minimize reflow
diff --git a/packages/client/src/components/preview/SettingsBar.svelte b/packages/client/src/components/preview/SettingsBar.svelte
index 3581d4f5f8..43c77ef1e6 100644
--- a/packages/client/src/components/preview/SettingsBar.svelte
+++ b/packages/client/src/components/preview/SettingsBar.svelte
@@ -16,7 +16,7 @@
let measured = false
$: definition = $builderStore.selectedComponentDefinition
- $: showBar = definition?.showSettingsBar
+ $: showBar = definition?.showSettingsBar && !$builderStore.isDragging
$: settings = definition?.settings?.filter(setting => setting.showInBar) ?? []
const updatePosition = () => {
diff --git a/packages/client/src/stores/builder.js b/packages/client/src/stores/builder.js
index 3f36af1d06..0d738e4a11 100644
--- a/packages/client/src/stores/builder.js
+++ b/packages/client/src/stores/builder.js
@@ -23,6 +23,7 @@ const createBuilderStore = () => {
theme: null,
customTheme: null,
previewDevice: "desktop",
+ isDragging: false,
}
const writableStore = writable(initialState)
const derivedStore = derived(writableStore, $state => {
@@ -64,13 +65,24 @@ const createBuilderStore = () => {
dispatchEvent("preview-loaded")
},
setSelectedPath: path => {
- console.log("set to ")
- console.log(path)
writableStore.update(state => {
state.selectedPath = path
return state
})
},
+ moveComponent: (componentId, destinationComponentId, mode) => {
+ dispatchEvent("move-component", {
+ componentId,
+ destinationComponentId,
+ mode,
+ })
+ },
+ setDragging: dragging => {
+ writableStore.update(state => {
+ state.isDragging = dragging
+ return state
+ })
+ },
}
return {
...writableStore,
diff --git a/packages/client/src/utils/styleable.js b/packages/client/src/utils/styleable.js
index d9925af91a..6a2562fb48 100644
--- a/packages/client/src/utils/styleable.js
+++ b/packages/client/src/utils/styleable.js
@@ -23,10 +23,14 @@ export const styleable = (node, styles = {}) => {
let applyHoverStyles
let selectComponent
+ // Allow dragging if required
+ const parent = node.closest(".component")
+ if (parent && parent.classList.contains("draggable")) {
+ node.setAttribute("draggable", true)
+ }
+
// Creates event listeners and applies initial styles
const setupStyles = (newStyles = {}) => {
- // Use empty state styles as base styles if required, but let them, get
- // overridden by any user specified styles
let baseStyles = {}
if (newStyles.empty) {
baseStyles.border = "2px dashed var(--spectrum-global-color-gray-600)"
@@ -45,7 +49,6 @@ export const styleable = (node, styles = {}) => {
// Applies a style string to a DOM node
const applyStyles = styleString => {
node.style = styleString
- node.dataset.componentId = componentId
}
// Applies the "normal" style definition