feat: components
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Sonic theme component loader.
|
||||
* Scans the document for `sonic-*` custom elements and lazy-imports
|
||||
* only those component modules. See src/components/CLAUDE.md.
|
||||
*/
|
||||
const PREFIX = 'sonic-';
|
||||
const tags = new Set();
|
||||
document.querySelectorAll('*').forEach(el => {
|
||||
const t = el.tagName.toLowerCase();
|
||||
if (t.startsWith(PREFIX)) tags.add(t);
|
||||
});
|
||||
await Promise.all([...tags].map(t => {
|
||||
const name = t.slice(PREFIX.length);
|
||||
return import(`./components/${name}/${name}.mjs`);
|
||||
}));
|
||||
Reference in New Issue
Block a user