/**
* THE MINI MILU CUSTOM ELEMENT (v1.0)
* Usage:
*/
class MiluProfile extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' }); // Creates a private scope for styles
}
connectedCallback() {
const username = this.getAttribute('username') || "Voyager";
const shells = parseInt(this.getAttribute('shells')) || 0;
const isFounder = this.hasAttribute('founder');
const rank = this.calculateRank(shells);
this.shadowRoot.innerHTML = `
ðŠķ
${username}
${isFounder ? 'CHIEF' : 'VGR'}-${Math.floor(Math.random() * 9000 + 1000)} âĒ ${shells} ð
${rank}
`;
}
calculateRank(s) {
if (s >= 500) return "High Tide Merchant ð";
if (s >= 100) return "Shoreline Gatherer ð";
return "Driftwood Voyager ðŠĩ";
}
}
// Register the custom tag
customElements.define('milu-profile', MiluProfile);