elementor/modules/variables
Mike Kokhanov c1b2cd7507
Internal: Filters and backdrop filters - variables support [ED-23508] (#35447)
## PR Checklist
<!-- 
Please check if your PR fulfills the following requirements:
**Filling out the template is required.** Any pull request that does not
include enough information to be reviewed in a timely manner may be
closed at the maintainers' discretion.
 -->
- [ ] The commit message follows our guidelines:
https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md


## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x" with no
spaces eg: [x]. -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## Summary

This PR can be summarized in the following changelog entry:

*

## Description
An explanation of what is done in this PR

*

## Test instructions
This PR can be tested by following these steps:

*

## Quality assurance

- [ ] I have tested this code to the best of my abilities
- [ ] I have added unittests to verify the code works as intended
- [ ] Docs have been added / updated (for bug fixes / features)

Fixes #

<!--start_gitstream_placeholder-->
###  PR Description
## 1. Problem & Context

ED-23508: Unblocking filters and backdrop-filters for variable
assignment. Previously blacklisted in the size-style schema, these CSS
properties now support both color and size variables, enabling theme
designers to use global values for blur, drop-shadow axes, and shadow
colors. This aligns filter controls with the existing variables system
used in box-shadow and backgrounds.

## 2. What Changed (Where)

- **`size-style-schema.php`**: Removed `filter` and `backdrop-filter`
from blacklist
- **`variables-repeater-item-slot.tsx`**: Added 3 new components to
render filter variables in repeater UI (`FilterDropShadowIconIndicator`,
`FilterDropShadowRepeaterLabel`, `FilterSingleSizeRepeaterLabel`);
replaced `<span>` with `<Box component="span">` across all labels
- **`repeater-injections.ts`**: Registered filter-specific icon/label
injections with conditions for drop-shadow color variables and size
variables; refactored arrow functions to named functions
- **`drop-shadow-item-label.tsx`**: Wrapped hardcoded `"Drop shadow:"`
with `__()` for i18n
- **Test files (3)**: Expanded coverage for filter variable resolution
in repeater controls; added mocking for `ColorIndicator` and
`service.variables`; verified blur, drop-shadow, and custom size
variable rendering

## 3. How It Works

When a filter or backdrop-filter prop contains a variable reference:

1. **Registration**: `filterRepeaterInjections()` hooks into repeater
item rendering via `injectIntoRepeaterItemIcon` and
`injectIntoRepeaterItemLabel`
2. **Condition checks**: For each repeater item, validates prop
structure (`cssFilterFunctionPropUtil.isValid`) then branches:
- Drop-shadow → checks for color variable in `args.color`, renders icon
+ axis labels
- Single-size filters (blur, saturate, etc.) → checks `args.value.size`
for variable, renders `func: value` label
3. **Variable resolution**: Components call `getVariable(id)` or
`sizeValue(prop)` to fetch resolved values from the global variables
registry
4. **Edge case**: `FilterSingleSizeRepeaterLabel` returns `null` for
drop-shadow to prevent duplicate labels (handled by dedicated
drop-shadow component)

No mermaid needed — this follows the existing box-shadow pattern with
type discrimination on `args`.

## 4. Risks

**Variable resolution timing**: Tests mock `service.variables`, but
production relies on registry initialization order. If filters render
before variables load, labels will show raw IDs. Mitigate by ensuring
variables service bootstraps before editor mounts (existing pattern
elsewhere, but verify in filters specifically).

**i18n performance**: `__()` call in `DropShadowItemLabel` runs
per-render. For large filter lists, consider memoization or extracting
to constant if React profiling shows hotspot.

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->


[ED-23508]:
https://elementor.atlassian.net/browse/ED-23508?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2026-04-19 14:11:54 +00:00
..
adapters Internal: Change variables limit to 1000 [ED-20171] (#34835) 2026-02-22 14:01:08 +02:00
classes Internal: Filters and backdrop filters - variables support [ED-23508] (#35447) 2026-04-19 14:11:54 +00:00
import-export-customization Fix: Class Import/Export with Existing Name Conflict [ED-23555] (#35313) 2026-03-30 12:26:40 +02:00
prop-types Internal: Introduce adapter for to convert string to prop type [ED-21605] (#33620) 2025-12-01 15:24:36 +02:00
services Fix: Name input does not auto-focus when creating a new variable [ED-23375] (#35172) 2026-03-17 16:11:55 +02:00
storage Internal: Change variables limit to 1000 [ED-20171] (#34835) 2026-02-22 14:01:08 +02:00
transformers Internal: Display user-defined variable names in css [ED-19291] (#31657) 2025-06-29 15:20:51 +03:00
utils Internal: Class & Vars template import [ED-22165] (#34501) 2026-03-12 11:18:01 +00:00
hooks.php Internal: Class & Vars template import [ED-22165] (#34501) 2026-03-12 11:18:01 +00:00
module.php Internal: Pro size variables - Panel - renew promotion [ED-21887] (#34570) 2026-02-04 16:02:56 +02:00