Add component name formatters and grid-link navigation
Templates section: - Define JS formatter functions per template (e.g. resistor, capacitor) - First non-null result from any formatter is used as display name - Live preview in template editor against first component - Display names applied in component list, detail view, and inventory rows Grid navigation: - Grid-type inventory entries in component detail view show a '⊞' button to navigate directly to that grid's viewer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,28 @@ export function delete_source_image(id) {
|
||||
return store.delete(`s:${id}`);
|
||||
}
|
||||
|
||||
// --- Component templates ---
|
||||
|
||||
export function list_component_templates() {
|
||||
const result = [];
|
||||
for (const [key] of store.data.entries()) {
|
||||
if (key.startsWith('ct:')) result.push(store.get(key));
|
||||
}
|
||||
return result.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
export function get_component_template(id) {
|
||||
return store.get(`ct:${id}`) ?? null;
|
||||
}
|
||||
|
||||
export function set_component_template(tmpl) {
|
||||
store.set(`ct:${tmpl.id}`, tmpl);
|
||||
}
|
||||
|
||||
export function delete_component_template(id) {
|
||||
return store.delete(`ct:${id}`);
|
||||
}
|
||||
|
||||
// --- Grid images ---
|
||||
|
||||
export function list_grid_images() {
|
||||
|
||||
Reference in New Issue
Block a user