feat(sacred-valley): card factory, registry ordering, view skeleton
Adds the Plan 6 card framework: svCard() chrome factory, pure orderCards() ordering helper with unit tests, three stub card modules (clock/weather/host-perf), and rewrites sacred_valley.js with the two-band layout that mounts ordered cards. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2
public/views/cards/clock.js
Normal file
2
public/views/cards/clock.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// temporary stub — filled in Task 5
|
||||
export default { id: 'clock', title: 'Clock', size: 's', mount() {}, start() {}, stop() {} };
|
||||
2
public/views/cards/host_perf.js
Normal file
2
public/views/cards/host_perf.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// temporary stub — filled in Task 9
|
||||
export default { id: 'host-perf', title: 'Host Perf', size: 'm', mount() {}, start() {}, stop() {} };
|
||||
14
public/views/cards/registry.js
Normal file
14
public/views/cards/registry.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// Pure ordering logic (kept DOM-free so it is unit-testable). The card MODULES
|
||||
// themselves are imported by sacred_valley.js, which passes their defs here.
|
||||
export function orderCards(defs, layout = { card_order: [], hidden: [] }) {
|
||||
const byId = new Map(defs.map(d => [d.id, d]));
|
||||
const hidden = new Set(layout.hidden || []);
|
||||
const out = [];
|
||||
for (const id of layout.card_order || []) {
|
||||
if (byId.has(id) && !hidden.has(id)) { out.push(byId.get(id)); byId.delete(id); }
|
||||
}
|
||||
for (const d of defs) {
|
||||
if (byId.has(d.id) && !hidden.has(d.id)) out.push(d);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
2
public/views/cards/weather.js
Normal file
2
public/views/cards/weather.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// temporary stub — filled in Task 7
|
||||
export default { id: 'weather', title: 'Weather', size: 's', mount() {}, start() {}, stop() {} };
|
||||
Reference in New Issue
Block a user