mirror of
https://gh.wpcy.net/https://github.com/elementor/elementor.git
synced 2026-04-20 12:23:54 +08:00
## 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 |
||
|---|---|---|
| .. | ||
| adapters | ||
| classes | ||
| import-export-customization | ||
| prop-types | ||
| services | ||
| storage | ||
| transformers | ||
| utils | ||
| hooks.php | ||
| module.php | ||