1import { 2 getBasePath 3} from "./chunks/chunk.3Y6SB6QS.js"; 4import "./chunks/chunk.LKA3TPUC.js"; 5 6// src/shoelace-autoloader.ts 7var observer = new MutationObserver((mutations) => { 8 for (const { addedNodes } of mutations) { 9 for (const node of addedNodes) { 10 if (node.nodeType === Node.ELEMENT_NODE) { 11 discover(node); 12 } 13 } 14 } 15}); 16async function discover(root) { 17 const rootTagName = root instanceof Element ? root.tagName.toLowerCase() : ""; 18 const rootIsCustomElement = rootTagName == null ? void 0 : rootTagName.includes("-"); 19 const tags = [...root.querySelectorAll(":not(:defined)")].map((el) => el.tagName.toLowerCase()).filter((tag) => tag.startsWith("sl-")); 20 if (rootIsCustomElement && !customElements.get(rootTagName)) { 21 tags.push(rootTagName); 22 } 23 const tagsToRegister = [...new Set(tags)]; 24 await Promise.allSettled(tagsToRegister.map((tagName) => register(tagName))); 25} 26function register(tagName) { 27 const tagWithoutPrefix = tagName.replace(/^sl-/i, ""); 28 const path = getBasePath(`components/${tagWithoutPrefix}/${tagWithoutPrefix}.js`); 29 if (customElements.get(tagName)) { 30 return Promise.resolve(); 31 } 32 return new Promise((resolve, reject) => { 33 import(path).then(() => resolve()).catch(() => reject(new Error(`Unable to autoload <${tagName}> from ${path}`))); 34 }); 35} 36discover(document.body); 37observer.observe(document.documentElement, { subtree: true, childList: true }); 38export { 39 discover 40};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.