diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 6d7cad1cd0..dc995d611c 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -17,7 +17,13 @@ export const getBindableProperties = (asset, componentId) => { const contextBindings = getContextBindings(asset, componentId) const userBindings = getUserBindings() const urlBindings = getUrlBindings(asset) - return [...contextBindings, ...userBindings, ...urlBindings] + const deviceBindings = getDeviceBindings() + return [ + ...deviceBindings, + ...urlBindings, + ...contextBindings, + ...userBindings, + ] } /** @@ -221,6 +227,27 @@ const getUserBindings = () => { return bindings } +/** + * Gets all device bindings that are globally available. + */ +const getDeviceBindings = () => { + let bindings = [] + if (get(store).clientFeatures?.deviceAwareness) { + const safeDevice = makePropSafe("device") + bindings.push({ + type: "context", + runtimeBinding: `${safeDevice}.${makePropSafe("mobile")}`, + readableBinding: `Device.Mobile`, + }) + bindings.push({ + type: "context", + runtimeBinding: `${safeDevice}.${makePropSafe("tablet")}`, + readableBinding: `Device.Tablet`, + }) + } + return bindings +} + /** * Gets all bindable properties from URL parameters. */ diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 3339ea07d6..1924ae07a2 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -35,6 +35,7 @@ const INITIAL_FRONTEND_STATE = { clientFeatures: { spectrumThemes: false, intelligentLoading: false, + deviceAwareness: false, }, currentFrontEndType: "none", selectedScreenId: "", diff --git a/packages/builder/src/components/common/bindings/BindingPanel.svelte b/packages/builder/src/components/common/bindings/BindingPanel.svelte index 6290bd2a3d..fdf708dc4e 100644 --- a/packages/builder/src/components/common/bindings/BindingPanel.svelte +++ b/packages/builder/src/components/common/bindings/BindingPanel.svelte @@ -38,7 +38,7 @@ {#if filteredColumns?.length}
-
Columns
+
Bindable Values