Jalpiβs responsive model is deliberately small: two configurable max-width breakpoints, one sibling style map per breakpoint, and one visibility flag set. Everything responsive in the plugin reduces to those three things.
Breakpoints#
| Breakpoint | Style map | Media query | Default |
|---|---|---|---|
| Desktop | styles | none β base rules | β |
| Tablet | tabletStyles | @media(max-width: {tablet}px) | 1024 |
| Mobile | mobileStyles | @media(max-width: {mobile}px) | 767 |
Values come from jalpi_settings_breakpoints and are read once in Jalpi_Renderer::compile_css(). They are max-width queries, so the model is desktop-first: mobile rules override tablet rules, which override the base.
Sibling maps, not merged maps#
tabletStyles and mobileStyles are sparse. They contain only the properties actually overridden, and maybe_add_responsive_rules() emits a rule only when the map is non-empty:
if ( ! empty( $tablet_styles ) ) {
$css = $this->styles_to_css( $tablet_styles );
if ( $css ) { $this->tablet_css_rules[] = "{$selector}{{$css}}"; }
}The same sparse-sibling pattern is reused three more times: DesignToken.tabletValue / mobileValue, JalpiClass.tabletStyles / mobileStyles, and InteractionRule.responsive.
Selectors#
The selector for responsive rules is chosen by node type:
$selector = match ( $type ) {
'section' => '.jalpi-section.jalpi-' . $id,
'container' => '.jalpi-container.jalpi-' . $id,
'column' => '.jalpi-column.jalpi-' . $id,
default => '.jalpi-el.jalpi-' . $id,
};Buttons get a second rule: their outerPadding* keys are emitted against .jalpi-outer-{id}, the wrapper div produced by wrap_outer_padding().
The stacking-column rule#
Columns carry explicit percentage widths, which normally beat a responsive rule at equal specificity. So when a Containerβs tabletStyles.flexDirection or mobileStyles.flexDirection is column or column-reverse, the renderer emits an extra rule for each child Column:
.jalpi-column.jalpi-{childId} {
width: 100% !important;
max-width: 100% !important;
flex-basis: 100% !important;
}This is the only place the renderer emits !important for layout, and it exists specifically to make columns stack.
Per-device visibility#
node.hideOn is { desktop?, tablet?, mobile? }, all booleans, normalised by sanitize_node(). Each true flag emits a display:none rule into the matching accumulator β desktop without a media query, tablet and mobile with !important inside theirs.
This hides the element visually and from layout, but the markup is still in the DOM and still indexable. It is a display switch, not a conditional render.
Fluid values#
For sizing that should scale continuously rather than step at a breakpoint, sanitize_dimension() accepts clamp(), min() and max() β but only when built from plain numeric lengths:
clamp(1.5rem, 4vw, 3rem) β accepted
clamp(1rem, calc(2vw + 1rem), 3rem) β rejected β calc() not allowed
clamp(1rem, var(--x), 3rem) β rejected β var() not allowedThe accepted value is re-assembled from the matched numeric tokens rather than passed through, so only validated text reaches the stylesheet. Accepted units: %, px, em, rem, vw, vh, dvh, svh, lvh, ch, ex.
Source
Files
includes/class-jalpi-renderer.php includes/class-jalpi-sanitizer.php admin/editor/src/components/panels/PropertiesPanel.tsx includes/class-jalpi-settings.php
Classes
Jalpi_Renderer Jalpi_Sanitizer Jalpi_Settings
Functions
maybe_add_responsive_rules compile_css sanitize_dimension
Last updated: November 2026