Skip to content

Commit 3914cbe

Browse files
committed
Allow exportLVGL-based widgets in LVGL mode
Permit widgets that provide an exportLVGL translator to be used in LVGL mode in addition to native lvgl_* widgets and input controls. Update AppStateFacade to consider plugin.exportLVGL (function) when checking compatibility, and adjust widget_palette logic and explanation to include plugin?.exportLVGL. This enables non-native widgets that can be translated to LVGL to appear and be used in LVGL mode.
1 parent a9d9675 commit 3914cbe

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

custom_components/esphome_designer/frontend/js/core/stores/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,10 @@ class AppStateFacade {
791791
if (mode === 'oepl') return !!plugin.exportOEPL;
792792
if (mode === 'opendisplay') return !!plugin.exportOpenDisplay;
793793
if (mode === 'lvgl') {
794-
// Strict Isolation: Only permit native LVGL widgets
795-
return w.type && w.type.startsWith('lvgl_');
794+
// LVGL mode: permit native LVGL widgets OR widgets with exportLVGL translation
795+
const isNativeLVGL = w.type && w.type.startsWith('lvgl_');
796+
const hasLVGLExport = typeof plugin.exportLVGL === 'function';
797+
return isNativeLVGL || hasLVGLExport;
796798
}
797799
if (mode === 'direct') {
798800
// Direct mode uses display.lambda. Compatible if it has 'export' method

custom_components/esphome_designer/frontend/js/ui/widget_palette.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,14 @@ export async function renderWidgetPalette(containerId) {
389389
isCompatible = hasExport && !isExcludedCategory && !isExcludedWidget;
390390
explanation = `Not supported in ${currentMode === 'oepl' ? 'OpenEpaperLink' : 'OpenDisplay'} mode`;
391391
} else if (currentMode === 'lvgl') {
392-
// CRITICAL ARCHITECTURAL NOTE: LVGL mode is strictly restricted to native LVGL objects
393-
// and essential input/navigation controls to prevent mixing incompatible
394-
// lambda-based rendering with the LVGL stack.
392+
// LVGL mode: Permit native LVGL objects, translatable widgets (with exportLVGL),
393+
// and essential input/navigation controls.
395394
const isLvglNative = widget.type.startsWith('lvgl_');
396395
const isInputCategory = (category.id === 'inputs');
396+
const hasLVGLExport = typeof plugin?.exportLVGL === 'function';
397397

398-
isCompatible = isLvglNative || isInputCategory;
399-
explanation = 'Only native LVGL widgets and input controls supported in LVGL mode';
398+
isCompatible = isLvglNative || isInputCategory || hasLVGLExport;
399+
explanation = 'Widget not compatible with LVGL mode';
400400
} else if (currentMode === 'direct') {
401401
// Direct mode is display.lambda.
402402
// Compatible if it has 'export' method AND is not strictly for another protocol (LVGL/OEPL).

0 commit comments

Comments
 (0)