Add command palette entity selector for all editor dropdowns

Replace plain <select> dropdowns with a searchable command palette modal
for 16 entity selectors across 6 editors (targets, streams, CSS sources,
value sources, audio sources, pattern templates). Unified EntityPalette
singleton + EntitySelect wrapper in core/entity-palette.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 00:17:44 +03:00
parent b4d89e271d
commit 6fc0e20e1d
12 changed files with 657 additions and 7 deletions
@@ -21,6 +21,9 @@ import { showToast, showConfirm } from '../core/ui.js';
import { Modal } from '../core/modal.js';
import { getPictureSourceIcon, ICON_PATTERN_TEMPLATE, ICON_CLONE, ICON_EDIT } from '../core/icons.js';
import { wrapCard } from '../core/card-colors.js';
import { EntitySelect } from '../core/entity-palette.js';
let _patternBgEntitySelect = null;
class PatternTemplateModal extends Modal {
constructor() {
@@ -88,6 +91,20 @@ export async function showPatternTemplateEditor(templateId = null, cloneData = n
bgSelect.appendChild(opt);
});
// Entity palette for background source
if (_patternBgEntitySelect) _patternBgEntitySelect.destroy();
if (sources.length > 0) {
_patternBgEntitySelect = new EntitySelect({
target: bgSelect,
getItems: () => sources.map(s => ({
value: s.id,
label: s.name,
icon: getPictureSourceIcon(s.stream_type),
})),
placeholder: t('palette.search'),
});
}
setPatternEditorBgImage(null);
setPatternEditorSelectedIdx(-1);
setPatternCanvasDragMode(null);