Refactor theme binding into device databindings fn
This commit is contained in:
parent
f7d0f98a45
commit
eb6269a0bb
|
@ -497,22 +497,33 @@ const getDeviceBindings = () => {
|
||||||
let bindings = []
|
let bindings = []
|
||||||
if (get(store).clientFeatures?.deviceAwareness) {
|
if (get(store).clientFeatures?.deviceAwareness) {
|
||||||
const safeDevice = makePropSafe("device")
|
const safeDevice = makePropSafe("device")
|
||||||
bindings.push({
|
|
||||||
type: "context",
|
bindings = [
|
||||||
runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`,
|
{
|
||||||
readableBinding: `Device.Mobile`,
|
type: "context",
|
||||||
category: "Device",
|
runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`,
|
||||||
icon: "DevicePhone",
|
readableBinding: `Device.Mobile`,
|
||||||
display: { type: "boolean", name: "mobile" },
|
category: "Device",
|
||||||
})
|
icon: "DevicePhone",
|
||||||
bindings.push({
|
display: { type: "boolean", name: "mobile" },
|
||||||
type: "context",
|
},
|
||||||
runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`,
|
{
|
||||||
readableBinding: `Device.Tablet`,
|
type: "context",
|
||||||
category: "Device",
|
runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`,
|
||||||
icon: "DevicePhone",
|
readableBinding: `Device.Tablet`,
|
||||||
display: { type: "boolean", name: "tablet" },
|
category: "Device",
|
||||||
})
|
icon: "DevicePhone",
|
||||||
|
display: { type: "boolean", name: "tablet" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "context",
|
||||||
|
runtimeBinding: `${safeDevice}.${makePropSafe("theme")}`,
|
||||||
|
readableBinding: `App.Theme`,
|
||||||
|
category: "Device",
|
||||||
|
icon: "DevicePhone",
|
||||||
|
display: { type: "string", name: "App Theme" },
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
return bindings
|
return bindings
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import Panel from "components/design/Panel.svelte"
|
import Panel from "components/design/Panel.svelte"
|
||||||
import {
|
import { store, selectedComponent, selectedScreen } from "builderStore"
|
||||||
store,
|
|
||||||
selectedComponent,
|
|
||||||
selectedScreen,
|
|
||||||
themeStore,
|
|
||||||
} from "builderStore"
|
|
||||||
import ComponentSettingsSection from "./ComponentSettingsSection.svelte"
|
import ComponentSettingsSection from "./ComponentSettingsSection.svelte"
|
||||||
import DesignSection from "./DesignSection.svelte"
|
import DesignSection from "./DesignSection.svelte"
|
||||||
import CustomStylesSection from "./CustomStylesSection.svelte"
|
import CustomStylesSection from "./CustomStylesSection.svelte"
|
||||||
|
@ -27,20 +22,6 @@
|
||||||
$store.selectedComponentId
|
$store.selectedComponentId
|
||||||
)
|
)
|
||||||
|
|
||||||
// frontend Constant Themes
|
|
||||||
$: globalBindings = [
|
|
||||||
...bindings,
|
|
||||||
{
|
|
||||||
type: "context",
|
|
||||||
runtimeBinding: `[device].[theme]`, //app.settings?
|
|
||||||
readableBinding: `App.Theme`,
|
|
||||||
category: "Settings",
|
|
||||||
icon: "Settings",
|
|
||||||
display: { type: "string", name: "Theme" },
|
|
||||||
},
|
|
||||||
]
|
|
||||||
$: console.log(globalBindings)
|
|
||||||
|
|
||||||
$: componentBindings = getComponentBindableProperties(
|
$: componentBindings = getComponentBindableProperties(
|
||||||
$selectedScreen,
|
$selectedScreen,
|
||||||
$store.selectedComponentId
|
$store.selectedComponentId
|
||||||
|
@ -78,28 +59,24 @@
|
||||||
<ComponentSettingsSection
|
<ComponentSettingsSection
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
bindings={globalBindings}
|
{bindings}
|
||||||
{componentBindings}
|
{componentBindings}
|
||||||
{isScreen}
|
{isScreen}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if section == "styles"}
|
{#if section == "styles"}
|
||||||
<DesignSection
|
<DesignSection {componentInstance} {componentDefinition} {bindings} />
|
||||||
{componentInstance}
|
|
||||||
{componentDefinition}
|
|
||||||
bindings={globalBindings}
|
|
||||||
/>
|
|
||||||
<CustomStylesSection
|
<CustomStylesSection
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
bindings={globalBindings}
|
{bindings}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if section == "conditions"}
|
{#if section == "conditions"}
|
||||||
<ConditionalUISection
|
<ConditionalUISection
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
bindings={globalBindings}
|
{bindings}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
$: theme = $themeStore.theme
|
$: theme = $themeStore.theme
|
||||||
$: baseTheme = $themeStore.baseTheme
|
|
||||||
|
|
||||||
$: data = {
|
$: data = {
|
||||||
mobile: width && width < tabletBreakpoint,
|
mobile: width && width < tabletBreakpoint,
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
theme,
|
theme,
|
||||||
baseTheme,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|
Loading…
Reference in New Issue