= ({ selectedId, nodePr
/>
-
Padding
+
Padding{dot(PADDING_KEYS)}
= ({ selectedId, nodePr
{/* Box model + border/effects + animation/visibility rollout */}
Margin{dot(MARGIN_KEYS)}>}
value={{ top: style.marginTop as string, right: style.marginRight as string, bottom: style.marginBottom as string, left: style.marginLeft as string }}
onChange={(side: SpacingSide, v: string) => setPropStyleContinuous(`margin${capitalize(side)}`, v)}
/>
diff --git a/craft/src/panels/right/styles/ContainerStylePanel.tsx b/craft/src/panels/right/styles/ContainerStylePanel.tsx
index c55fa22..a82987f 100644
--- a/craft/src/panels/right/styles/ContainerStylePanel.tsx
+++ b/craft/src/panels/right/styles/ContainerStylePanel.tsx
@@ -1,5 +1,4 @@
import React, { CSSProperties } from 'react';
-import { useEditor } from '@craftjs/core';
import {
BG_COLORS,
RADIUS_PRESETS,
@@ -15,8 +14,11 @@ import {
inputStyle,
sectionGap,
useNodeProp,
- continuousSetProp,
} from './shared';
+import { useResolvedStyle } from './responsive-panel';
+import { OverrideDot } from './OverrideDot';
+import { useDevice } from '../../../state/DeviceContext';
+import { resolveStyleForDevice, withoutOverride } from '../../../utils/responsive-style';
import { BoxModelSection, BorderEffectsSection, AnimVisSection } from './containerBoxModel';
// Vertical Alignment options shown to the user identically regardless of
@@ -32,10 +34,11 @@ const VERTICAL_ALIGN_OPTIONS: { label: string; value: string }[] = [
/* ---------- CONTAINER / SECTION / COLUMNS ---------- */
export const ContainerStylePanel: React.FC = ({ selectedId, nodeProps }) => {
- const style: CSSProperties = nodeProps.style || {};
+ const style: CSSProperties = useResolvedStyle(nodeProps);
+ const dot = (key: string | readonly string[]) => ;
+ const { device } = useDevice();
- const { actions } = useEditor();
- const { setProp, setPropStyle, setProps, setPropContinuous, setPropStyleContinuous } = useNodeProp(selectedId);
+ const { setProp, setPropStyle, setProps, setPropContinuous, setPropStyleContinuous, setPropStylesContinuous } = useNodeProp(selectedId);
// ColumnLayout only ever carries `columns`/`split` props -- Container and
// Section never set them -- so checking either alone distinguishes the
@@ -43,12 +46,19 @@ export const ContainerStylePanel: React.FC = ({ selectedId, nod
// column heights) from the flex-COLUMN case (Container/Section, which
// vertically center/position their OWN content via justify-content,
// paired with a Min Height control so centering is meaningful).
- const setPropStylesContinuous = (patch: Record, controlKey: string) =>
- continuousSetProp(actions, selectedId, controlKey, (p: any) => { p.style = { ...p.style, ...patch }; });
-
const isColumns = nodeProps.columns !== undefined || nodeProps.split !== undefined;
const vAlignKey = isColumns ? 'alignItems' : 'justifyContent';
+ // "Stack on this device" (Columns, tablet/mobile only): a flexDirection
+ // override. Turning it off removes this device's override; if the columns
+ // would still inherit a stack (mobile under a stacked tablet), it writes
+ // 'row' instead so the toggle really un-stacks this device.
+ const stacked = style.flexDirection === 'column';
+ const inheritsStack =
+ device !== 'desktop' &&
+ resolveStyleForDevice(withoutOverride(nodeProps, device, 'flexDirection'), device).flexDirection === 'column';
+ const toggleStack = () => setPropStyle('flexDirection', stacked ? (inheritsStack ? 'row' : '') : 'column');
+
return (
<>
{nodeProps.cssId !== undefined && (
@@ -99,7 +109,7 @@ export const ContainerStylePanel: React.FC = ({ selectedId, nod
/>
-
Alignment
+
Alignment{dot('textAlign')}
{(['left', 'center', 'right', 'justify'] as const).map((a) => (
-
Vertical Alignment
+
Vertical Alignment{dot(vAlignKey)}
setPropStyle(vAlignKey, v)}
/>
+ {isColumns && device !== 'desktop' && (
+
+ Columns Layout{dot('flexDirection')}
+
+
+ )}
{!isColumns && (
-
Min Height
+
Min Height{dot('minHeight')}
setPropStyleContinuous('minHeight', v)}
@@ -134,7 +153,7 @@ export const ContainerStylePanel: React.FC = ({ selectedId, nod
)}
{/* Box model + border/effects + animation/visibility rollout */}
-
+
>
diff --git a/craft/src/panels/right/styles/FormStylePanel.tsx b/craft/src/panels/right/styles/FormStylePanel.tsx
index 6905b16..17380eb 100644
--- a/craft/src/panels/right/styles/FormStylePanel.tsx
+++ b/craft/src/panels/right/styles/FormStylePanel.tsx
@@ -28,6 +28,8 @@ import {
useNodeProp,
continuousSetProp,
} from './shared';
+import { useResolvedStyle, MARGIN_KEYS, PADDING_KEYS } from './responsive-panel';
+import { OverrideDot } from './OverrideDot';
/* The full sanitizeInputType (utils/escape.ts) allowlist, plus the two
fake "types" (textarea/select) that take their own ContactForm render
@@ -175,7 +177,10 @@ export const FormStylePanel: React.FC = ({ selectedId, nodeProp
const { actions } = useEditor();
const { setProp, setPropStyle, setProps, setPropContinuous, setPropStyleContinuous } = useNodeProp(selectedId);
- const style = nodeProps.style || {};
+ // Effective value for the current device (#45): the setters write
+ // tablet/mobile overrides, so the fields must read them back.
+ const style = useResolvedStyle(nodeProps) as Record;
+ const dot = (key: string | readonly string[]) => ;
// ContactForm only: FormContainer/SubscribeForm have no destinationType prop,
// so their relay controls stay exactly as they were.
const isWebhook = nodeProps.destinationType === 'webhook';
@@ -484,7 +489,7 @@ export const FormStylePanel: React.FC = ({ selectedId, nodeProp
setPropStyle('backgroundColor', v)} />
-
Padding
+
Padding{dot(PADDING_KEYS)}
setPropStyle('padding', v)} />
@@ -498,12 +503,12 @@ export const FormStylePanel: React.FC = ({ selectedId, nodeProp
they all spread `style` onto their root element. */}
Margin{dot(MARGIN_KEYS)}>}
value={{ top: style.marginTop, right: style.marginRight, bottom: style.marginBottom, left: style.marginLeft }}
onChange={(side, v) => setPropStyleContinuous(`margin${SPACING_SIDE_KEYS.find((s) => s.side === side)!.suffix}`, v)}
/>
Padding (per side){dot(PADDING_KEYS)}>}
value={{ top: style.paddingTop, right: style.paddingRight, bottom: style.paddingBottom, left: style.paddingLeft }}
onChange={(side, v) => setPropStyleContinuous(`padding${SPACING_SIDE_KEYS.find((s) => s.side === side)!.suffix}`, v)}
/>
diff --git a/craft/src/panels/right/styles/GenericPropsEditor.tsx b/craft/src/panels/right/styles/GenericPropsEditor.tsx
index 8cd48b4..f056f3b 100644
--- a/craft/src/panels/right/styles/GenericPropsEditor.tsx
+++ b/craft/src/panels/right/styles/GenericPropsEditor.tsx
@@ -16,6 +16,8 @@ import {
sectionGap,
useNodeProp,
} from './shared';
+import { useResolvedStyle, PADDING_KEYS } from './responsive-panel';
+import { OverrideDot } from './OverrideDot';
import { ArrayItemFieldsEditor } from './ArrayItemFields';
import { HtmlCodeField } from './HtmlCodeField';
@@ -35,7 +37,10 @@ export const GenericPropsEditor: React.FC<{ selectedId: string; nodeProps: Recor
const stringProps = allProps.filter(([key, val]) => typeof val === 'string' && !/color/i.test(key));
const arrayProps = allProps.filter(([_, val]) => Array.isArray(val));
- const style = nodeProps.style || {};
+ // Effective value for the current device (#45): the setters write
+ // tablet/mobile overrides, so the fields must read them back.
+ const style = useResolvedStyle(nodeProps) as Record;
+ const dot = (key: string | readonly string[]) => ;
const hasCodeProp = typeof nodeProps.code === 'string';
return (
@@ -117,11 +122,11 @@ export const GenericPropsEditor: React.FC<{ selectedId: string; nodeProps: Recor
setStyleValue('color', v)} />
-
Padding
+
Padding{dot(PADDING_KEYS)}
setStyleValue('padding', v)} />
-
Text Alignment
+
Text Alignment{dot('textAlign')}
{(['left', 'center', 'right'] as const).map((a) => (
{/* Box model + animation/visibility rollout */}
-
+
>
diff --git a/craft/src/panels/right/styles/MediaStylePanel.tsx b/craft/src/panels/right/styles/MediaStylePanel.tsx
index 372d1b8..edc98ff 100644
--- a/craft/src/panels/right/styles/MediaStylePanel.tsx
+++ b/craft/src/panels/right/styles/MediaStylePanel.tsx
@@ -21,6 +21,8 @@ import {
useNodeProp,
continuousSetProp,
} from './shared';
+import { useResolvedStyle } from './responsive-panel';
+import { OverrideDot } from './OverrideDot';
import { AssetPicker } from '../../../ui/AssetPicker';
import { BoxModelSection, BorderEffectsSection, AnimVisSection } from './mediaBoxModel';
@@ -36,7 +38,8 @@ export const MediaStylePanel: React.FC
= ({ selectedId, nodePro
const { actions } = useEditor();
const { setProp, setPropStyle, setProps, setPropContinuous, setPropStyleContinuous, setPropStyles } = useNodeProp(selectedId);
- const style = nodeProps.style || {};
+ const style = useResolvedStyle(nodeProps);
+ const dot = (key: string | readonly string[]) => ;
// Same crop-fills-by-default + no stale-height-conflict treatment as
// ImageStylePanel (see there for the full rationale): applying a ratio
@@ -72,7 +75,7 @@ export const MediaStylePanel: React.FC = ({ selectedId, nodePro
{nodeProps.videoUrl !== undefined && (
<>
Width{dot('width')}>}
value={(style.width as string) || ''}
onChange={(v) => setPropStyleContinuous('width', v)}
/>
@@ -276,7 +279,7 @@ export const MediaStylePanel: React.FC = ({ selectedId, nodePro
{/* Box model + animation/visibility rollout (Video/Gallery/Map/Slider
all carry these props now, so it's safe to render unconditionally). */}
-
+
>
diff --git a/craft/src/panels/right/styles/OverrideDot.tsx b/craft/src/panels/right/styles/OverrideDot.tsx
new file mode 100644
index 0000000..1cadf29
--- /dev/null
+++ b/craft/src/panels/right/styles/OverrideDot.tsx
@@ -0,0 +1,48 @@
+import React from 'react';
+import { useOverrideState } from './responsive-panel';
+
+const DEVICE_NAME = { desktop: 'Desktop', tablet: 'Tablet', mobile: 'Mobile' } as const;
+
+export interface OverrideDotProps {
+ nodeProps: Record;
+ selectedId: string;
+ /** One style key, or a group shown as one dot (e.g. all four margin sides). */
+ styleKey: string | readonly string[];
+}
+
+/**
+ * Per-device marker next to a field label (#45). On tablet/mobile:
+ * - filled dot = this device has its own value; click resets it (one undo step);
+ * - hollow dot = the field follows the larger device, so an edit here
+ * creates a device-specific value.
+ * Nothing on desktop, nor for keys that are never per-device (colours...).
+ */
+export const OverrideDot: React.FC = ({ nodeProps, selectedId, styleKey }) => {
+ const { overridden, inherited, device, resetsTo, reset } = useOverrideState(nodeProps, styleKey, selectedId);
+ if (device === 'desktop') return null;
+ const name = DEVICE_NAME[device];
+ if (overridden) {
+ const title = `${name} override - click to reset to ${resetsTo}`;
+ return (
+
-
Padding
+
Padding{dot(PADDING_KEYS)}
setPropStyle('padding', v)} />
-
Text Alignment
+
Text Alignment{dot('textAlign')}
{(['left', 'center', 'right'] as const).map((a) => (
-
Padding
+
Padding{dot(PADDING_KEYS)}
setPropStyle('padding', v)} />
@@ -262,7 +267,7 @@ export const SocialStylePanel: React.FC
= ({ selectedId, nodePr
{/* Box model: margin, padding (per-side), border, shadow, opacity */}
Margin{dot(MARGIN_KEYS)}>}
value={{
top: style.marginTop as string, right: style.marginRight as string,
bottom: style.marginBottom as string, left: style.marginLeft as string,
@@ -270,7 +275,7 @@ export const SocialStylePanel: React.FC = ({ selectedId, nodePr
onChange={(side, v) => setPropStyleContinuous(`margin${capSide(side)}`, v)}
/>
Padding{dot(PADDING_KEYS)}>}
value={{
top: style.paddingTop as string, right: style.paddingRight as string,
bottom: style.paddingBottom as string, left: style.paddingLeft as string,
diff --git a/craft/src/panels/right/styles/TextStylePanel.tsx b/craft/src/panels/right/styles/TextStylePanel.tsx
index 7a980c2..2151847 100644
--- a/craft/src/panels/right/styles/TextStylePanel.tsx
+++ b/craft/src/panels/right/styles/TextStylePanel.tsx
@@ -26,6 +26,8 @@ import {
labelStyle,
useNodeProp,
} from './shared';
+import { useResolvedStyle, MARGIN_KEYS, PADDING_KEYS } from './responsive-panel';
+import { OverrideDot } from './OverrideDot';
/* Text-transform is a small fixed enum with no natural home in the shared
foundation presets (constants/presets.ts is import-only for this
@@ -61,7 +63,8 @@ function opacityPercent(v: unknown): number {
/* ---------- TEXT ---------- */
export const TextStylePanel: React.FC = ({ selectedId, nodeProps }) => {
- const style: CSSProperties = nodeProps.style || {};
+ const style: CSSProperties = useResolvedStyle(nodeProps);
+ const dot = (key: string | readonly string[]) => ;
const { setProp, setPropStyle, setProps, setPropStyleContinuous } = useNodeProp(selectedId);
@@ -87,7 +90,7 @@ export const TextStylePanel: React.FC = ({ selectedId, nodeProp
/>
-
Text Size
+
Text Size{dot('fontSize')}
= ({ selectedId, nodeProp
/>
-
Line Height
+
Line Height{dot('lineHeight')}
= ({ selectedId, nodeProp
/>
-
Letter Spacing
+
Letter Spacing{dot('letterSpacing')}
= ({ selectedId, nodeProp
/>
-
Alignment
+
Alignment{dot('textAlign')}
{(['left', 'center', 'right', 'justify'] as const).map((a) => (