@elenajs/components 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/dist/button.css +1 -85
- package/dist/button.d.ts +0 -2
- package/dist/button.js +1 -1
- package/dist/button.js.map +1 -1
- package/dist/custom-elements.d.ts +4 -66
- package/dist/custom-elements.json +7 -362
- package/dist/elena-6kltq0mt.js +2 -0
- package/dist/elena-6kltq0mt.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/stack.css +1 -15
- package/dist/stack.js +1 -1
- package/package.json +4 -4
- package/dist/avatar.d.ts +0 -9
- package/dist/avatar.js +0 -4
- package/dist/avatar.js.map +0 -1
- package/dist/elena-Bvw5aqmt.js +0 -2
- package/dist/elena-Bvw5aqmt.js.map +0 -1
- package/dist/input.css +0 -101
- package/dist/input.d.ts +0 -30
- package/dist/input.js +0 -2
- package/dist/input.js.map +0 -1
package/dist/bundle.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
elena-button{--elena-button-bg
|
|
1
|
+
@scope (elena-button){:scope{--elena-button-bg:#463630;--elena-button-text:#fff;--elena-button-font:sans-serif;--elena-button-radius:10rem;all:unset;display:inline-block;border-radius:var(--elena-button-radius)}button{all:unset;display:inline-flex}:scope:not([hydrated]),button{background:var(--elena-button-bg);color:var(--elena-button-text);font-family:var(--elena-button-font);border-radius:var(--elena-button-radius);appearance:none;user-select:none;font-size:1rem;font-weight:700;padding:0.75rem 1.25rem;cursor:pointer}:scope:hover{opacity:0.8}:scope:active{opacity:0.6}:scope:focus-within{outline:2px solid #f95b1f;outline-offset:2px}:scope[disabled]{--elena-button-bg:#2b1c15;--elena-button-text:#fff;--elena-button-border:#2b1c15;opacity:0.3;pointer-events:none}:scope[variant="primary"]{--elena-button-bg:#f95b1f}:scope[variant="danger"]{--elena-button-bg:#f91f1f}}@scope (elena-stack){:scope{all:unset;display:flex;justify-content:flex-start;align-items:flex-start;flex-flow:column wrap;flex-direction:column;gap:0.5rem}:scope[direction="row"]{flex-direction:row}}
|
package/dist/bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,n){if(t="boolean"===e&&"boolean"!=typeof t?null!==t:t,!n)return t;if("toAttribute"===n)switch(e){case"object":case"array":return null===t?null:JSON.stringify(t);case"boolean":return t?"":null;case"number":return null===t?null:t;default:return""===t?null:t}else switch(e){case"object":case"array":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn("░█ [ELENA]: Invalid JSON for prop, received: "+t),null}case"boolean":return t;case"number":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn("░█ [ELENA]: Cannot sync attributes to a null element.")}let n=class extends Event{constructor(e,t){super(e,{bubbles:!0,composed:!0,...t})}};function s(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(e).replace(/[&<>"']/g,e=>t[e])}function r(e,...t){const n=e.reduce((e,n,r)=>{const i=t[r];return e+n+(i&&i.__raw?String(i):s(String(i??"")))},"");return{__raw:!0,strings:e,values:t,toString:()=>n}}const i=new WeakMap;function
|
|
1
|
+
function e(e,t,n){if(t="boolean"===e&&"boolean"!=typeof t?null!==t:t,!n)return t;if("toAttribute"===n)switch(e){case"object":case"array":return null===t?null:JSON.stringify(t);case"boolean":return t?"":null;case"number":return null===t?null:t;default:return""===t?null:t}else switch(e){case"object":case"array":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn("░█ [ELENA]: Invalid JSON for prop, received: "+t),null}case"boolean":return t;case"number":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn("░█ [ELENA]: Cannot sync attributes to a null element.")}let n=class extends Event{constructor(e,t){super(e,{bubbles:!0,composed:!0,...t})}};function s(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(e).replace(/[&<>"']/g,e=>t[e])}function r(e,...t){const n=e.reduce((e,n,r)=>{const i=t[r];return e+n+(i&&i.__raw?String(i):s(String(i??"")))},"");return{__raw:!0,strings:e,values:t,toString:()=>n}}const i=new WeakMap;function o(e,t,n){(function(e,t,n){if(e._tplStrings!==t||!e._tplParts)return!1;let r=!1;for(let t=0;t<n.length;t++){const i=n[t],o=i&&i.__raw,l=o?String(i):s(String(i??""));if(l!==e._tplValues[t])if(e._tplValues[t]=l,o)r=!0;else{const n=e._tplParts[t];n?n.textContent=String(i??""):r=!0}}return!r})(e,t,n)||function(e,t,n){const r=n.map(e=>e&&e.__raw?String(e):s(String(e??"")));let o=i.get(t);o||(o=Array.from(t,e=>e.replace(/\n\s*/g," ")),i.set(t,o));const l=o.reduce((e,t,n)=>e+t+(r[n]??""),"").replace(/>\s+</g,"><").replace(/>\s+/g,">").replace(/\s+</g,"<").trim();(function(e,t){e?e.replaceChildren(e.ownerDocument.createRange().createContextualFragment(t)):console.warn("░█ [ELENA]: Cannot render to a null element.")})(e,l),e._tplStrings=t,e._tplValues=r,e._tplParts=function(e,t){const n=new Array(t.length),s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r,i=0;for(;(r=s.nextNode())&&i<t.length;)r.textContent===t[i]&&(n[i]=r,i++);return n}(e,r)}(e,t,n)}function l(s,r){const i=r&&r.element?/^[a-z][a-z0-9-]*$/i.test(r.element)?e=>e.getElementsByClassName(r.element)[0]:e=>e.querySelector(r.element):e=>e.firstElementChild;class l extends s{element=null;attributeChangedCallback(t,n,s){"text"!==t?(function(t,n,s,r){if(s!==r){const s=typeof t[n];"undefined"===s&&console.warn(`░█ [ELENA]: Prop "${n}" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const i=e(s,r,"toProp");t[n]=i}}(this,t,n,s),this._hydrated&&n!==s&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=s??""}static get observedAttributes(){return[...r&&r.props?r.props:[],"text"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&o(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=i(this),this.element||(r&&r.element&&console.warn("░█ [ELENA]: No element found, using firstElementChild as fallback."),this.element=this.firstElementChild))}_flushProps(){if(this._props){const n=!(!r||!r.element);for(const[s,r]of this._props){const i=e(typeof r,r,"toAttribute");t(this,s,i),n&&t(this.element,s,i)}}}_delegateEvents(){!this._events&&r&&r.events&&(this.element?(this._events=!0,r.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn("░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector."))}updated(){this._hydrated||(this._hydrated=!0,this.setAttribute("hydrated",""))}disconnectedCallback(){this._events&&(this._events=!1,r.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){r.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new n(e.type,{cancelable:!0})))}get text(){return this._text??""}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return r&&r.props?.length&&(r.props.includes("text")&&console.warn('░█ [ELENA]: "text" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),function(n,s,r=!0){for(const i of s)Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(i):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(i))return;if(this._props.set(i,n),!this.isConnected)return;const s=e(typeof n,n,"toAttribute");t(this,i,s),r&&this.element&&t(this.element,i,s)}})}(l.prototype,r.props,!(!r||!r.element))),r&&r.tagName&&(l._tagName=r.tagName),l.define=function(){this._tagName?function(e,t){"undefined"!=typeof window&&"customElements"in window&&(window.customElements.get(e)||window.customElements.define(e,t))}(this._tagName,this):console.warn("░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.")},l}const a={tagName:"elena-button",props:["label","variant","disabled","name","value","type"],events:["click","focus","blur"]};class c extends(l(HTMLElement,a)){constructor(){super(),this.variant="default",this.disabled=!1,this.name="",this.value="",this.type="button"}render(){return r`<button>${this.text}</button>`}}c.define();const u={tagName:"elena-stack",props:["direction"]};class h extends(l(HTMLElement,u)){constructor(){super(),this.direction="column"}}h.define();export{c as Button,h as Stack};
|
|
2
2
|
//# sourceMappingURL=bundle.js.map
|
package/dist/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sources":["../../core/dist/props.js","../../core/dist/events.js","../../core/dist/utils.js","../../core/dist/render.js","../../core/dist/elena.js","../src/button/button.js","../src/input/input.js","../src/stack/stack.js"],"sourcesContent":["function e(e,t,n){if(t=\"boolean\"===e&&\"boolean\"!=typeof t?null!==t:t,!n)return t;if(\"toAttribute\"===n)switch(e){case\"object\":case\"array\":return null===t?null:JSON.stringify(t);case\"boolean\":return t?\"\":null;case\"number\":return null===t?null:t;default:return\"\"===t?null:t}else switch(e){case\"object\":case\"array\":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn(\"░█ [ELENA]: Invalid JSON for prop, received: \"+t),null}case\"boolean\":return t;case\"number\":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn(\"░█ [ELENA]: Cannot sync attributes to a null element.\")}function n(n,r,o=!0){for(const s of r)Object.defineProperty(n,s,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(s):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(s))return;if(this._props.set(s,n),!this.isConnected)return;const r=e(typeof n,n,\"toAttribute\");t(this,s,r),o&&this.element&&t(this.element,s,r)}})}function r(t,n,r,o){if(r!==o){const r=typeof t[n];\"undefined\"===r&&console.warn(`░█ [ELENA]: Prop \"${n}\" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const s=e(r,o,\"toProp\");t[n]=s}}export{e as getPropValue,r as getProps,n as setProps,t as syncAttribute};\n//# sourceMappingURL=props.js.map\n","class e extends Event{constructor(e,s){super(e,{bubbles:!0,composed:!0,...s})}}export{e as ElenaEvent};\n//# sourceMappingURL=events.js.map\n","function n(n,t){\"undefined\"!=typeof window&&\"customElements\"in window&&(window.customElements.get(n)||window.customElements.define(n,t))}function t(n){const t={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\",\"'\":\"'\"};return String(n).replace(/[&<>\"']/g,n=>t[n])}function e(n,...e){const o=n.reduce((n,o,r)=>{const i=e[r];return n+o+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>o}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing};\n//# sourceMappingURL=utils.js.map\n","import{escapeHtml as t}from\"./utils.js\";const e=new WeakMap;function n(n,l,o){(function(e,n,r){if(e._tplStrings!==n||!e._tplParts)return!1;let l=!1;for(let n=0;n<r.length;n++){const o=r[n],a=o&&o.__raw,c=a?String(o):t(String(o??\"\"));if(c!==e._tplValues[n])if(e._tplValues[n]=c,a)l=!0;else{const t=e._tplParts[n];t?t.textContent=String(o??\"\"):l=!0}}return!l})(n,l,o)||function(n,l,o){const a=o.map(e=>e&&e.__raw?String(e):t(String(e??\"\")));let c=e.get(l);c||(c=Array.from(l,t=>t.replace(/\\n\\s*/g,\" \")),e.set(l,c));const s=c.reduce((t,e,n)=>t+e+(a[n]??\"\"),\"\").replace(/>\\s+</g,\"><\").replace(/>\\s+/g,\">\").replace(/\\s+</g,\"<\").trim();r(n,s),n._tplStrings=l,n._tplValues=a,n._tplParts=function(t,e){const n=new Array(e.length),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let l,o=0;for(;(l=r.nextNode())&&o<e.length;)l.textContent===e[o]&&(n[o]=l,o++);return n}(n,a)}(n,l,o)}function r(t,e){t?t.replaceChildren(t.ownerDocument.createRange().createContextualFragment(e)):console.warn(\"░█ [ELENA]: Cannot render to a null element.\")}export{r as renderHtml,n as renderTemplate};\n//# sourceMappingURL=render.js.map\n","import{setProps as e,getProps as t,getPropValue as s,syncAttribute as n}from\"./props.js\";import{ElenaEvent as i}from\"./events.js\";import{defineElement as r}from\"./utils.js\";export{html,nothing}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,l){const a=l&&l.element?/^[a-z][a-z0-9-]*$/i.test(l.element)?e=>e.getElementsByClassName(l.element)[0]:e=>e.querySelector(l.element):e=>e.firstElementChild;class d extends o{element=null;attributeChangedCallback(e,s,n){\"text\"!==e?(t(this,e,s,n),this._hydrated&&s!==n&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=n??\"\"}static get observedAttributes(){return[...l&&l.props?l.props:[],\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&h(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=a(this),this.element||(l&&l.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props){const e=!(!l||!l.element);for(const[t,i]of this._props){const r=s(typeof i,i,\"toAttribute\");n(this,t,r),e&&n(this.element,t,r)}}}_delegateEvents(){!this._events&&l&&l.events&&(this.element?(this._events=!0,l.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn(\"░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector.\"))}updated(){this._hydrated||(this._hydrated=!0,this.classList.add(\"elena-hydrated\"))}disconnectedCallback(){this._events&&(this._events=!1,l.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){l.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new i(e.type,{cancelable:!0})))}get text(){return this._text??\"\"}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return l&&l.props?.length&&(l.props.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(d.prototype,l.props,!(!l||!l.element))),l&&l.tagName&&(d._tagName=l.tagName),d.define=function(){this._tagName?r(this._tagName,this):console.warn(\"░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.\")},d}export{o as Elena};\n//# sourceMappingURL=elena.js.map\n","import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\"label\", \"variant\", \"size\", \"disabled\", \"name\", \"value\", \"type\"],\n events: [\"click\", \"focus\", \"blur\"],\n element: \".elena-button\",\n};\n\n/**\n * Button component is used for interface actions.\n *\n * @displayName Button\n * @status alpha\n *\n * @event click - Programmatically fire click on the component.\n * @event focus - Programmatically move focus to the component.\n * @event blur - Programmatically remove focus from the component.\n *\n * @cssprop [--elena-button-color-text] - Controls the color of the text.\n * @cssprop [--elena-button-color-bg] - Controls the color of the background.\n * @cssprop [--elena-button-color-border] - Controls the color of the border.\n * @cssprop [--elena-button-radius] - Controls the radius of the component.\n */\nexport default class Button extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The style variant of the button.\n *\n * @attribute\n * @type {\"default\" | \"primary\" | \"danger\"}\n */\n this.variant = \"default\";\n\n /**\n * The size of the button.\n *\n * @attribute\n * @type {\"sm\" | \"md\" | \"lg\"}\n */\n this.size = \"md\";\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {Boolean}\n */\n this.disabled = false;\n\n /**\n * The name used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.name = \"\";\n\n /**\n * The value used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.value = \"\";\n\n /**\n * The type of the button.\n *\n * @attribute\n * @type {\"submit\" | \"reset\" | \"button\"}\n */\n this.type = \"button\";\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n return html`<button class=\"elena-button\">${this.text}</button>`;\n }\n}\n\n/**\n * Register the web component\n */\nButton.define();\n","import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-input\",\n props: [\"size\", \"disabled\", \"name\", \"value\", \"type\", \"label\", \"error\", \"placeholder\"],\n events: [\"click\", \"focus\", \"blur\"],\n element: \".elena-input\",\n};\n\n/**\n * The description of the component goes here.\n *\n * @displayName Input\n * @status alpha\n *\n * @event click - Programmatically fire click on the component.\n * @event focus - Programmatically move focus to the component.\n * @event blur - Programmatically remove focus from the component.\n *\n * @cssprop [--elena-input-color-text] - Controls the color of the text.\n * @cssprop [--elena-input-color-bg] - Controls the color of the background.\n * @cssprop [--elena-input-color-border] - Controls the color of the border.\n * @cssprop [--elena-input-radius] - Controls the radius of the component.\n */\nexport default class Input extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The size of the input.\n *\n * @attribute\n * @type {\"sm\" | \"md\" | \"lg\"}\n */\n this.size = \"md\";\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {Boolean}\n */\n this.disabled = false;\n\n /**\n * The name used to identify the input in forms.\n *\n * @attribute\n * @type {string}\n */\n this.name = \"\";\n\n /**\n * The label for the input\n *\n * @attribute\n * @type {string}\n */\n this.label = \"\";\n\n /**\n * The value used to identify the input in forms.\n *\n * @attribute\n * @type {string}\n */\n this.value = \"\";\n\n /**\n * The placeholder text for the input.\n *\n * @attribute\n * @type {string}\n */\n this.placeholder = \"\";\n\n /**\n * The type of the input\n *\n * @attribute\n * @type {\"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\" | \"unit\" | \"button\"}\n */\n this.type = \"text\";\n\n /**\n * The error to display\n *\n * @attribute\n * @type {string}\n */\n this.error = \"\";\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n return html`\n <label for=\"input\">${this.label}</label>\n <div class=\"elena-input-container\">\n <span class=\"elena-input-start\"></span>\n <input\n id=\"input\"\n class=\"elena-input\"\n />\n <span class=\"elena-input-end\"></span>\n </div>\n ${this.error ? html`<div class=\"elena-error\" role=\"alert\">${this.error}</div>` : \"\"}\n `;\n }\n}\n\n/**\n * Register the web component\n */\nInput.define();\n","import { Elena } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-stack\",\n props: [\"direction\"],\n};\n\n/**\n * Stack component manages layout of immediate children\n * with optional spacing between each child.\n *\n * @displayName Stack\n * @slot - The stacked content\n * @status alpha\n */\nexport default class Stack extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The direction of the stack.\n *\n * @attribute\n * @type {\"column\" | \"row\"}\n */\n this.direction = \"column\";\n }\n}\n\n/**\n * Register the web component\n */\nStack.define();\n"],"names":["e","t","n","JSON","stringify","parse","console","warn","removeAttribute","setAttribute","e$2","Event","constructor","s","super","bubbles","composed","String","replace","o","reduce","r","i","__raw","strings","values","toString","WeakMap","l","_tplStrings","_tplParts","length","a","c","_tplValues","textContent","map","get","Array","from","set","trim","replaceChildren","ownerDocument","createRange","createContextualFragment","document","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","element","test","getElementsByClassName","querySelector","firstElementChild","d","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","props","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","_events","events","forEach","addEventListener","classList","add","disconnectedCallback","removeEventListener","handleEvent","includes","type","stopPropagation","dispatchEvent","cancelable","Object","defineProperty","configurable","enumerable","Map","isConnected","prototype","tagName","_tagName","define","window","customElements","options","Button","Elena","HTMLElement","variant","size","disabled","name","value","html","Input","label","placeholder","error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AQJ,CAAI,yCAAyCrD,KAAKyD,cAAgB,IAErF,EAMFH,EAAMb,SCnHN,MAAMG,EAAU,CACdL,QAAS,cACTjC,MAAO,CAAC,cAWK,MAAMoD,UAAcZ,EAAMC,YAAaH,IACpD,WAAA1F,GACEE,QAQA4C,KAAK2D,UAAY,QACnB,EAMFD,EAAMjB"}
|
|
1
|
+
{"version":3,"file":"bundle.js","sources":["../../core/dist/props.js","../../core/dist/events.js","../../core/dist/utils.js","../../core/dist/render.js","../../core/dist/elena.js","../src/button/button.js","../src/stack/stack.js"],"sourcesContent":["function e(e,t,n){if(t=\"boolean\"===e&&\"boolean\"!=typeof t?null!==t:t,!n)return t;if(\"toAttribute\"===n)switch(e){case\"object\":case\"array\":return null===t?null:JSON.stringify(t);case\"boolean\":return t?\"\":null;case\"number\":return null===t?null:t;default:return\"\"===t?null:t}else switch(e){case\"object\":case\"array\":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn(\"░█ [ELENA]: Invalid JSON for prop, received: \"+t),null}case\"boolean\":return t;case\"number\":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn(\"░█ [ELENA]: Cannot sync attributes to a null element.\")}function n(n,r,o=!0){for(const s of r)Object.defineProperty(n,s,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(s):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(s))return;if(this._props.set(s,n),!this.isConnected)return;const r=e(typeof n,n,\"toAttribute\");t(this,s,r),o&&this.element&&t(this.element,s,r)}})}function r(t,n,r,o){if(r!==o){const r=typeof t[n];\"undefined\"===r&&console.warn(`░█ [ELENA]: Prop \"${n}\" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const s=e(r,o,\"toProp\");t[n]=s}}export{e as getPropValue,r as getProps,n as setProps,t as syncAttribute};\n//# sourceMappingURL=props.js.map\n","class e extends Event{constructor(e,s){super(e,{bubbles:!0,composed:!0,...s})}}export{e as ElenaEvent};\n//# sourceMappingURL=events.js.map\n","function n(n,t){\"undefined\"!=typeof window&&\"customElements\"in window&&(window.customElements.get(n)||window.customElements.define(n,t))}function t(n){const t={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\",\"'\":\"'\"};return String(n).replace(/[&<>\"']/g,n=>t[n])}function e(n,...e){const o=n.reduce((n,o,r)=>{const i=e[r];return n+o+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>o}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing};\n//# sourceMappingURL=utils.js.map\n","import{escapeHtml as t}from\"./utils.js\";const e=new WeakMap;function n(n,l,o){(function(e,n,r){if(e._tplStrings!==n||!e._tplParts)return!1;let l=!1;for(let n=0;n<r.length;n++){const o=r[n],a=o&&o.__raw,c=a?String(o):t(String(o??\"\"));if(c!==e._tplValues[n])if(e._tplValues[n]=c,a)l=!0;else{const t=e._tplParts[n];t?t.textContent=String(o??\"\"):l=!0}}return!l})(n,l,o)||function(n,l,o){const a=o.map(e=>e&&e.__raw?String(e):t(String(e??\"\")));let c=e.get(l);c||(c=Array.from(l,t=>t.replace(/\\n\\s*/g,\" \")),e.set(l,c));const s=c.reduce((t,e,n)=>t+e+(a[n]??\"\"),\"\").replace(/>\\s+</g,\"><\").replace(/>\\s+/g,\">\").replace(/\\s+</g,\"<\").trim();r(n,s),n._tplStrings=l,n._tplValues=a,n._tplParts=function(t,e){const n=new Array(e.length),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let l,o=0;for(;(l=r.nextNode())&&o<e.length;)l.textContent===e[o]&&(n[o]=l,o++);return n}(n,a)}(n,l,o)}function r(t,e){t?t.replaceChildren(t.ownerDocument.createRange().createContextualFragment(e)):console.warn(\"░█ [ELENA]: Cannot render to a null element.\")}export{r as renderHtml,n as renderTemplate};\n//# sourceMappingURL=render.js.map\n","import{setProps as e,getProps as t,getPropValue as s,syncAttribute as n}from\"./props.js\";import{ElenaEvent as i}from\"./events.js\";import{defineElement as r}from\"./utils.js\";export{html,nothing}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,l){const a=l&&l.element?/^[a-z][a-z0-9-]*$/i.test(l.element)?e=>e.getElementsByClassName(l.element)[0]:e=>e.querySelector(l.element):e=>e.firstElementChild;class d extends o{element=null;attributeChangedCallback(e,s,n){\"text\"!==e?(t(this,e,s,n),this._hydrated&&s!==n&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=n??\"\"}static get observedAttributes(){return[...l&&l.props?l.props:[],\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&h(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=a(this),this.element||(l&&l.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props){const e=!(!l||!l.element);for(const[t,i]of this._props){const r=s(typeof i,i,\"toAttribute\");n(this,t,r),e&&n(this.element,t,r)}}}_delegateEvents(){!this._events&&l&&l.events&&(this.element?(this._events=!0,l.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn(\"░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector.\"))}updated(){this._hydrated||(this._hydrated=!0,this.setAttribute(\"hydrated\",\"\"))}disconnectedCallback(){this._events&&(this._events=!1,l.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){l.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new i(e.type,{cancelable:!0})))}get text(){return this._text??\"\"}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return l&&l.props?.length&&(l.props.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(d.prototype,l.props,!(!l||!l.element))),l&&l.tagName&&(d._tagName=l.tagName),d.define=function(){this._tagName?r(this._tagName,this):console.warn(\"░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.\")},d}export{o as Elena};\n//# sourceMappingURL=elena.js.map\n","import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\"label\", \"variant\", \"disabled\", \"name\", \"value\", \"type\"],\n events: [\"click\", \"focus\", \"blur\"],\n};\n\n/**\n * Button component is used for interface actions.\n *\n * @displayName Button\n * @status alpha\n *\n * @event click - Programmatically fire click on the component.\n * @event focus - Programmatically move focus to the component.\n * @event blur - Programmatically remove focus from the component.\n *\n * @cssprop [--elena-button-text] - Overrides the default text color.\n * @cssprop [--elena-button-bg] - Overrides the default background color.\n * @cssprop [--elena-button-font] - Overrides the default font family.\n * @cssprop [--elena-button-radius] - Overrides the default border radius.\n */\nexport default class Button extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The style variant of the button.\n *\n * @attribute\n * @type {\"default\" | \"primary\" | \"danger\"}\n */\n this.variant = \"default\";\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {Boolean}\n */\n this.disabled = false;\n\n /**\n * The name used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.name = \"\";\n\n /**\n * The value used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.value = \"\";\n\n /**\n * The type of the button.\n *\n * @attribute\n * @type {\"submit\" | \"reset\" | \"button\"}\n */\n this.type = \"button\";\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n return html`<button>${this.text}</button>`;\n }\n}\n\n/**\n * Register the web component\n */\nButton.define();\n","import { Elena } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-stack\",\n props: [\"direction\"],\n};\n\n/**\n * Stack component manages layout of immediate children\n * with optional spacing between each child.\n *\n * @displayName Stack\n * @slot - The stacked content\n * @status alpha\n */\nexport default class Stack extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The direction of the stack.\n *\n * @attribute\n * @type {\"column\" | \"row\"}\n */\n this.direction = \"column\";\n }\n}\n\n/**\n * Register the web component\n */\nStack.define();\n"],"names":["e","t","n","JSON","stringify","parse","console","warn","removeAttribute","setAttribute","e$2","Event","constructor","s","super","bubbles","composed","String","replace","o","reduce","r","i","__raw","strings","values","toString","WeakMap","l","_tplStrings","_tplParts","length","a","c","_tplValues","textContent","map","get","Array","from","set","trim","replaceChildren","ownerDocument","createRange","createContextualFragment","document","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","element","test","getElementsByClassName","querySelector","firstElementChild","d","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","props","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","_events","events","forEach","addEventListener","disconnectedCallback","removeEventListener","handleEvent","includes","type","stopPropagation","dispatchEvent","cancelable","Object","defineProperty","configurable","enumerable","Map","isConnected","prototype","tagName","_tagName","define","window","customElements","options","Button","Elena","HTMLElement","variant","disabled","name","value","html","Stack","direction"],"mappings":"AAAA,SAASA,EAAEA,EAAEC,EAAEC,GAAG,GAAGD,EAAE,YAAYD,GAAG,kBAAkBC,EAAE,OAAOA,EAAEA,GAAGC,EAAE,OAAOD,EAAE,GAAG,gBAAgBC,EAAE,OAAOF,GAAG,IAAI,SAAS,IAAI,QAAQ,OAAO,OAAOC,EAAE,KAAKE,KAAKC,UAAUH,GAAG,IAAI,UAAU,OAAOA,EAAE,GAAG,KAAK,IAAI,SAAS,OAAO,OAAOA,EAAE,KAAKA,EAAE,QAAQ,MAAM,KAAKA,EAAE,KAAKA,OAAO,OAAOD,GAAG,IAAI,SAAS,IAAI,QAAQ,IAAIC,EAAE,O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Q,QAAS,QACzDa,OAAQ,CAAC,QAAS,QAAS,SAkBd,MAAMwB,UAAeC,EAAMC,YAAaH,IACrD,WAAAxF,GACEE,QAQA4C,KAAK8C,QAAU,UAQf9C,KAAK+C,UAAW,EAQhB/C,KAAKgD,KAAO,GAQZhD,KAAKiD,MAAQ,GAQbjD,KAAK0B,KAAO,QACd,CAOA,MAAAnB,GACE,OAAO2C,CAAI,WAAWlD,KAAKI,eAC7B,EAMFuC,EAAOJ,SC/EP,MAAMG,EAAU,CACdL,QAAS,cACT/B,MAAO,CAAC,cAWK,MAAM6C,UAAcP,EAAMC,YAAaH,IACpD,WAAAxF,GACEE,QAQA4C,KAAKoD,UAAY,QACnB,EAMFD,EAAMZ"}
|
package/dist/button.css
CHANGED
|
@@ -1,85 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/ ELENA BUTTON
|
|
3
|
-
/ --------------------------------------------- */
|
|
4
|
-
|
|
5
|
-
elena-button {
|
|
6
|
-
/* Public CSS Custom Properties */
|
|
7
|
-
--elena-button-bg: transparent;
|
|
8
|
-
--elena-button-text: #333;
|
|
9
|
-
--elena-button-border: #f19c77;
|
|
10
|
-
--elena-button-radius: 10rem;
|
|
11
|
-
--elena-button-font: sans-serif;
|
|
12
|
-
|
|
13
|
-
all: initial;
|
|
14
|
-
display: inline-block;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
elena-button .elena-button {
|
|
18
|
-
all: initial;
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* For overall visual styles, we want to target both
|
|
24
|
-
* non-hydrated element and the internal button element
|
|
25
|
-
* with the same styles. This way the element will look
|
|
26
|
-
* the same before & after client side hydration.
|
|
27
|
-
*/
|
|
28
|
-
:is(elena-button:not(.elena-hydrated), .elena-button) {
|
|
29
|
-
-webkit-appearance: none;
|
|
30
|
-
appearance: none;
|
|
31
|
-
-webkit-user-select: none;
|
|
32
|
-
user-select: none;
|
|
33
|
-
background: var(--elena-button-bg);
|
|
34
|
-
color: var(--elena-button-text);
|
|
35
|
-
border-radius: var(--elena-button-radius);
|
|
36
|
-
border: 2px solid var(--elena-button-border);
|
|
37
|
-
font-family: var(--elena-button-font);
|
|
38
|
-
font-size: 1rem;
|
|
39
|
-
font-weight: 700;
|
|
40
|
-
padding: 0.75rem 1.25rem;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
:is(elena-button:not(.elena-hydrated))::after {
|
|
45
|
-
content: attr(label);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* ---------------------------------------------
|
|
49
|
-
/ EXAMPLE STATES
|
|
50
|
-
/ --------------------------------------------- */
|
|
51
|
-
|
|
52
|
-
elena-button:hover {
|
|
53
|
-
opacity: 0.8;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
elena-button:active {
|
|
57
|
-
opacity: 0.6;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
elena-button:focus-within {
|
|
61
|
-
box-shadow: 0 0 0 3px red;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
elena-button[disabled] {
|
|
65
|
-
--elena-button-bg: #2b1c15;
|
|
66
|
-
--elena-button-text: #fff;
|
|
67
|
-
--elena-button-border: #2b1c15;
|
|
68
|
-
|
|
69
|
-
opacity: 0.3;
|
|
70
|
-
pointer-events: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* ---------------------------------------------
|
|
74
|
-
/ EXAMPLE VARIANTS
|
|
75
|
-
/ --------------------------------------------- */
|
|
76
|
-
|
|
77
|
-
elena-button[variant="primary"] {
|
|
78
|
-
--elena-button-bg: #f19c77;
|
|
79
|
-
--elena-button-text: #2b1c15;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
elena-button[variant="danger"] {
|
|
83
|
-
--elena-button-text: red;
|
|
84
|
-
--elena-button-border: red;
|
|
85
|
-
}
|
|
1
|
+
@scope (elena-button){:scope{--elena-button-bg:#463630;--elena-button-text:#fff;--elena-button-font:sans-serif;--elena-button-radius:10rem;all:unset;display:inline-block;border-radius:var(--elena-button-radius)}button{all:unset;display:inline-flex}:scope:not([hydrated]),button{background:var(--elena-button-bg);color:var(--elena-button-text);font-family:var(--elena-button-font);border-radius:var(--elena-button-radius);appearance:none;user-select:none;font-size:1rem;font-weight:700;padding:0.75rem 1.25rem;cursor:pointer}:scope:hover{opacity:0.8}:scope:active{opacity:0.6}:scope:focus-within{outline:2px solid #f95b1f;outline-offset:2px}:scope[disabled]{--elena-button-bg:#2b1c15;--elena-button-text:#fff;--elena-button-border:#2b1c15;opacity:0.3;pointer-events:none}:scope[variant="primary"]{--elena-button-bg:#f95b1f}:scope[variant="danger"]{--elena-button-bg:#f91f1f}}
|
package/dist/button.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ export type { ButtonProps } from './custom-elements.js';
|
|
|
3
3
|
declare class Button extends HTMLElement {
|
|
4
4
|
/** The style variant of the button. */
|
|
5
5
|
variant?: "default" | "primary" | "danger";
|
|
6
|
-
/** The size of the button. */
|
|
7
|
-
size?: "sm" | "md" | "lg";
|
|
8
6
|
/** Makes the component disabled. */
|
|
9
7
|
disabled?: Boolean;
|
|
10
8
|
/** The name used to identify the button in forms. */
|
package/dist/button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as
|
|
1
|
+
import{o as t,e}from"./elena-6kltq0mt.js";const a={tagName:"elena-button",props:["label","variant","disabled","name","value","type"],events:["click","focus","blur"]};class s extends(t(HTMLElement,a)){constructor(){super(),this.variant="default",this.disabled=!1,this.name="",this.value="",this.type="button"}render(){return e`<button>${this.text}</button>`}}s.define();export{s as default};
|
|
2
2
|
//# sourceMappingURL=button.js.map
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../src/button/button.js"],"sourcesContent":["import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\"label\", \"variant\", \"
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../src/button/button.js"],"sourcesContent":["import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\"label\", \"variant\", \"disabled\", \"name\", \"value\", \"type\"],\n events: [\"click\", \"focus\", \"blur\"],\n};\n\n/**\n * Button component is used for interface actions.\n *\n * @displayName Button\n * @status alpha\n *\n * @event click - Programmatically fire click on the component.\n * @event focus - Programmatically move focus to the component.\n * @event blur - Programmatically remove focus from the component.\n *\n * @cssprop [--elena-button-text] - Overrides the default text color.\n * @cssprop [--elena-button-bg] - Overrides the default background color.\n * @cssprop [--elena-button-font] - Overrides the default font family.\n * @cssprop [--elena-button-radius] - Overrides the default border radius.\n */\nexport default class Button extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The style variant of the button.\n *\n * @attribute\n * @type {\"default\" | \"primary\" | \"danger\"}\n */\n this.variant = \"default\";\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {Boolean}\n */\n this.disabled = false;\n\n /**\n * The name used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.name = \"\";\n\n /**\n * The value used to identify the button in forms.\n *\n * @attribute\n * @type {string}\n */\n this.value = \"\";\n\n /**\n * The type of the button.\n *\n * @attribute\n * @type {\"submit\" | \"reset\" | \"button\"}\n */\n this.type = \"button\";\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n return html`<button>${this.text}</button>`;\n }\n}\n\n/**\n * Register the web component\n */\nButton.define();\n"],"names":["options","tagName","props","events","Button","Elena","HTMLElement","constructor","super","this","variant","disabled","name","value","type","render","html","text","define"],"mappings":"0CAEA,MAAMA,EAAU,CACdC,QAAS,eACTC,MAAO,CAAC,QAAS,UAAW,WAAY,OAAQ,QAAS,QACzDC,OAAQ,CAAC,QAAS,QAAS,SAkBd,MAAMC,UAAeC,EAAMC,YAAaN,IACrD,WAAAO,GACEC,QAQAC,KAAKC,QAAU,UAQfD,KAAKE,UAAW,EAQhBF,KAAKG,KAAO,GAQZH,KAAKI,MAAQ,GAQbJ,KAAKK,KAAO,QACd,CAOA,MAAAC,GACE,OAAOC,CAAI,WAAWP,KAAKQ,eAC7B,EAMFb,EAAOc"}
|
|
@@ -60,18 +60,9 @@ type BaseProps = {
|
|
|
60
60
|
|
|
61
61
|
type BaseEvents = {};
|
|
62
62
|
|
|
63
|
-
export type AvatarProps = {
|
|
64
|
-
/** The text content of the element, captured from light DOM before the first render. */
|
|
65
|
-
text?: string;
|
|
66
|
-
/** */
|
|
67
|
-
state?: string;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
63
|
export type ButtonProps = {
|
|
71
64
|
/** The style variant of the button. */
|
|
72
65
|
variant?: "default" | "primary" | "danger";
|
|
73
|
-
/** The size of the button. */
|
|
74
|
-
size?: "sm" | "md" | "lg";
|
|
75
66
|
/** Makes the component disabled. */
|
|
76
67
|
disabled?: Boolean;
|
|
77
68
|
/** The name used to identify the button in forms. */
|
|
@@ -91,34 +82,6 @@ export type ButtonProps = {
|
|
|
91
82
|
onblur?: (e: CustomEvent<never>) => void;
|
|
92
83
|
};
|
|
93
84
|
|
|
94
|
-
export type InputProps = {
|
|
95
|
-
/** The size of the input. */
|
|
96
|
-
size?: "sm" | "md" | "lg";
|
|
97
|
-
/** Makes the component disabled. */
|
|
98
|
-
disabled?: Boolean;
|
|
99
|
-
/** The name used to identify the input in forms. */
|
|
100
|
-
name?: string;
|
|
101
|
-
/** The label for the input */
|
|
102
|
-
label?: string;
|
|
103
|
-
/** The value used to identify the input in forms. */
|
|
104
|
-
value?: string;
|
|
105
|
-
/** The placeholder text for the input. */
|
|
106
|
-
placeholder?: string;
|
|
107
|
-
/** The type of the input */
|
|
108
|
-
type?: "text" | "email" | "password" | "tel" | "url" | "search" | "number" | "unit" | "button";
|
|
109
|
-
/** The error to display */
|
|
110
|
-
error?: string;
|
|
111
|
-
/** The text content of the element, captured from light DOM before the first render. */
|
|
112
|
-
text?: string;
|
|
113
|
-
|
|
114
|
-
/** Programmatically fire click on the component. */
|
|
115
|
-
onclick?: (e: CustomEvent<never>) => void;
|
|
116
|
-
/** Programmatically move focus to the component. */
|
|
117
|
-
onfocus?: (e: CustomEvent<never>) => void;
|
|
118
|
-
/** Programmatically remove focus from the component. */
|
|
119
|
-
onblur?: (e: CustomEvent<never>) => void;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
85
|
export type StackProps = {
|
|
123
86
|
/** The direction of the stack. */
|
|
124
87
|
direction?: "column" | "row";
|
|
@@ -127,13 +90,6 @@ export type StackProps = {
|
|
|
127
90
|
};
|
|
128
91
|
|
|
129
92
|
export type CustomElements = {
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
* ---
|
|
133
|
-
*
|
|
134
|
-
*/
|
|
135
|
-
"elena-avatar": Partial<AvatarProps & BaseProps & BaseEvents>;
|
|
136
|
-
|
|
137
93
|
/**
|
|
138
94
|
* Button component is used for interface actions.
|
|
139
95
|
* ---
|
|
@@ -145,31 +101,13 @@ export type CustomElements = {
|
|
|
145
101
|
* - **blur** - Programmatically remove focus from the component.
|
|
146
102
|
*
|
|
147
103
|
* ### **CSS Properties:**
|
|
148
|
-
* - **--elena-button-
|
|
149
|
-
* - **--elena-button-
|
|
150
|
-
* - **--elena-button-
|
|
151
|
-
* - **--elena-button-radius** -
|
|
104
|
+
* - **--elena-button-text** - Overrides the default text color. _(default: undefined)_
|
|
105
|
+
* - **--elena-button-bg** - Overrides the default background color. _(default: undefined)_
|
|
106
|
+
* - **--elena-button-font** - Overrides the default font family. _(default: undefined)_
|
|
107
|
+
* - **--elena-button-radius** - Overrides the default border radius. _(default: undefined)_
|
|
152
108
|
*/
|
|
153
109
|
"elena-button": Partial<ButtonProps & BaseProps & BaseEvents>;
|
|
154
110
|
|
|
155
|
-
/**
|
|
156
|
-
* The description of the component goes here.
|
|
157
|
-
* ---
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* ### **Events:**
|
|
161
|
-
* - **click** - Programmatically fire click on the component.
|
|
162
|
-
* - **focus** - Programmatically move focus to the component.
|
|
163
|
-
* - **blur** - Programmatically remove focus from the component.
|
|
164
|
-
*
|
|
165
|
-
* ### **CSS Properties:**
|
|
166
|
-
* - **--elena-input-color-text** - Controls the color of the text. _(default: undefined)_
|
|
167
|
-
* - **--elena-input-color-bg** - Controls the color of the background. _(default: undefined)_
|
|
168
|
-
* - **--elena-input-color-border** - Controls the color of the border. _(default: undefined)_
|
|
169
|
-
* - **--elena-input-radius** - Controls the radius of the component. _(default: undefined)_
|
|
170
|
-
*/
|
|
171
|
-
"elena-input": Partial<InputProps & BaseProps & BaseEvents>;
|
|
172
|
-
|
|
173
111
|
/**
|
|
174
112
|
* Stack component manages layout of immediate children
|
|
175
113
|
* with optional spacing between each child.
|
|
@@ -15,14 +15,6 @@
|
|
|
15
15
|
"module": "./button/button.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
"kind": "js",
|
|
20
|
-
"name": "Input",
|
|
21
|
-
"declaration": {
|
|
22
|
-
"name": "default",
|
|
23
|
-
"module": "./input/input.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
18
|
{
|
|
27
19
|
"kind": "js",
|
|
28
20
|
"name": "Stack",
|
|
@@ -33,87 +25,6 @@
|
|
|
33
25
|
}
|
|
34
26
|
]
|
|
35
27
|
},
|
|
36
|
-
{
|
|
37
|
-
"kind": "javascript-module",
|
|
38
|
-
"path": "src/avatar/avatar.js",
|
|
39
|
-
"declarations": [
|
|
40
|
-
{
|
|
41
|
-
"kind": "class",
|
|
42
|
-
"description": "",
|
|
43
|
-
"name": "Avatar",
|
|
44
|
-
"members": [
|
|
45
|
-
{
|
|
46
|
-
"kind": "method",
|
|
47
|
-
"name": "renderImage"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"kind": "method",
|
|
51
|
-
"name": "renderFallback"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"kind": "method",
|
|
55
|
-
"name": "render"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"kind": "field",
|
|
59
|
-
"name": "state",
|
|
60
|
-
"type": {
|
|
61
|
-
"text": "string"
|
|
62
|
-
},
|
|
63
|
-
"default": "\"initial\""
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"kind": "field",
|
|
67
|
-
"name": "text",
|
|
68
|
-
"type": {
|
|
69
|
-
"text": "string"
|
|
70
|
-
},
|
|
71
|
-
"description": "The text content of the element, captured from light DOM before the first render.",
|
|
72
|
-
"attribute": "text"
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
"mixins": [
|
|
76
|
-
{
|
|
77
|
-
"name": "Elena",
|
|
78
|
-
"package": "@elenajs/core"
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"superclass": {
|
|
82
|
-
"name": "HTMLElement"
|
|
83
|
-
},
|
|
84
|
-
"tagName": "elena-avatar",
|
|
85
|
-
"attributes": [
|
|
86
|
-
{
|
|
87
|
-
"name": "text",
|
|
88
|
-
"fieldName": "text",
|
|
89
|
-
"type": {
|
|
90
|
-
"text": "string"
|
|
91
|
-
},
|
|
92
|
-
"description": "The text content of the element, captured from light DOM before the first render."
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"customElement": true
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"exports": [
|
|
99
|
-
{
|
|
100
|
-
"kind": "js",
|
|
101
|
-
"name": "default",
|
|
102
|
-
"declaration": {
|
|
103
|
-
"name": "Avatar",
|
|
104
|
-
"module": "src/avatar/avatar.js"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"kind": "custom-element-definition",
|
|
109
|
-
"name": "elena-avatar",
|
|
110
|
-
"declaration": {
|
|
111
|
-
"name": "Avatar",
|
|
112
|
-
"module": "src/avatar/avatar.js"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
28
|
{
|
|
118
29
|
"kind": "javascript-module",
|
|
119
30
|
"path": "src/button/button.js",
|
|
@@ -124,19 +35,19 @@
|
|
|
124
35
|
"name": "Button",
|
|
125
36
|
"cssProperties": [
|
|
126
37
|
{
|
|
127
|
-
"description": "
|
|
128
|
-
"name": "--elena-button-
|
|
38
|
+
"description": "Overrides the default text color.",
|
|
39
|
+
"name": "--elena-button-text"
|
|
129
40
|
},
|
|
130
41
|
{
|
|
131
|
-
"description": "
|
|
132
|
-
"name": "--elena-button-
|
|
42
|
+
"description": "Overrides the default background color.",
|
|
43
|
+
"name": "--elena-button-bg"
|
|
133
44
|
},
|
|
134
45
|
{
|
|
135
|
-
"description": "
|
|
136
|
-
"name": "--elena-button-
|
|
46
|
+
"description": "Overrides the default font family.",
|
|
47
|
+
"name": "--elena-button-font"
|
|
137
48
|
},
|
|
138
49
|
{
|
|
139
|
-
"description": "
|
|
50
|
+
"description": "Overrides the default border radius.",
|
|
140
51
|
"name": "--elena-button-radius"
|
|
141
52
|
}
|
|
142
53
|
],
|
|
@@ -151,16 +62,6 @@
|
|
|
151
62
|
"default": "\"default\"",
|
|
152
63
|
"attribute": "variant"
|
|
153
64
|
},
|
|
154
|
-
{
|
|
155
|
-
"kind": "field",
|
|
156
|
-
"name": "size",
|
|
157
|
-
"type": {
|
|
158
|
-
"text": "\"sm\" | \"md\" | \"lg\""
|
|
159
|
-
},
|
|
160
|
-
"description": "The size of the button.",
|
|
161
|
-
"default": "\"md\"",
|
|
162
|
-
"attribute": "size"
|
|
163
|
-
},
|
|
164
65
|
{
|
|
165
66
|
"kind": "field",
|
|
166
67
|
"name": "disabled",
|
|
@@ -235,15 +136,6 @@
|
|
|
235
136
|
"default": "\"default\"",
|
|
236
137
|
"fieldName": "variant"
|
|
237
138
|
},
|
|
238
|
-
{
|
|
239
|
-
"name": "size",
|
|
240
|
-
"type": {
|
|
241
|
-
"text": "\"sm\" | \"md\" | \"lg\""
|
|
242
|
-
},
|
|
243
|
-
"description": "The size of the button.",
|
|
244
|
-
"default": "\"md\"",
|
|
245
|
-
"fieldName": "size"
|
|
246
|
-
},
|
|
247
139
|
{
|
|
248
140
|
"name": "disabled",
|
|
249
141
|
"type": {
|
|
@@ -323,253 +215,6 @@
|
|
|
323
215
|
}
|
|
324
216
|
]
|
|
325
217
|
},
|
|
326
|
-
{
|
|
327
|
-
"kind": "javascript-module",
|
|
328
|
-
"path": "src/input/input.js",
|
|
329
|
-
"declarations": [
|
|
330
|
-
{
|
|
331
|
-
"kind": "class",
|
|
332
|
-
"description": "The description of the component goes here.",
|
|
333
|
-
"name": "Input",
|
|
334
|
-
"cssProperties": [
|
|
335
|
-
{
|
|
336
|
-
"description": "Controls the color of the text.",
|
|
337
|
-
"name": "--elena-input-color-text"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
"description": "Controls the color of the background.",
|
|
341
|
-
"name": "--elena-input-color-bg"
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"description": "Controls the color of the border.",
|
|
345
|
-
"name": "--elena-input-color-border"
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"description": "Controls the radius of the component.",
|
|
349
|
-
"name": "--elena-input-radius"
|
|
350
|
-
}
|
|
351
|
-
],
|
|
352
|
-
"members": [
|
|
353
|
-
{
|
|
354
|
-
"kind": "field",
|
|
355
|
-
"name": "size",
|
|
356
|
-
"type": {
|
|
357
|
-
"text": "\"sm\" | \"md\" | \"lg\""
|
|
358
|
-
},
|
|
359
|
-
"description": "The size of the input.",
|
|
360
|
-
"default": "\"md\"",
|
|
361
|
-
"attribute": "size"
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
"kind": "field",
|
|
365
|
-
"name": "disabled",
|
|
366
|
-
"type": {
|
|
367
|
-
"text": "Boolean"
|
|
368
|
-
},
|
|
369
|
-
"description": "Makes the component disabled.",
|
|
370
|
-
"default": "false",
|
|
371
|
-
"attribute": "disabled"
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"kind": "field",
|
|
375
|
-
"name": "name",
|
|
376
|
-
"type": {
|
|
377
|
-
"text": "string"
|
|
378
|
-
},
|
|
379
|
-
"description": "The name used to identify the input in forms.",
|
|
380
|
-
"default": "\"\"",
|
|
381
|
-
"attribute": "name"
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
"kind": "field",
|
|
385
|
-
"name": "label",
|
|
386
|
-
"type": {
|
|
387
|
-
"text": "string"
|
|
388
|
-
},
|
|
389
|
-
"description": "The label for the input",
|
|
390
|
-
"default": "\"\"",
|
|
391
|
-
"attribute": "label"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"kind": "field",
|
|
395
|
-
"name": "value",
|
|
396
|
-
"type": {
|
|
397
|
-
"text": "string"
|
|
398
|
-
},
|
|
399
|
-
"description": "The value used to identify the input in forms.",
|
|
400
|
-
"default": "\"\"",
|
|
401
|
-
"attribute": "value"
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
"kind": "field",
|
|
405
|
-
"name": "placeholder",
|
|
406
|
-
"type": {
|
|
407
|
-
"text": "string"
|
|
408
|
-
},
|
|
409
|
-
"description": "The placeholder text for the input.",
|
|
410
|
-
"default": "\"\"",
|
|
411
|
-
"attribute": "placeholder"
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
"kind": "field",
|
|
415
|
-
"name": "type",
|
|
416
|
-
"type": {
|
|
417
|
-
"text": "\"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\" | \"unit\" | \"button\""
|
|
418
|
-
},
|
|
419
|
-
"description": "The type of the input",
|
|
420
|
-
"default": "\"text\"",
|
|
421
|
-
"attribute": "type"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"kind": "field",
|
|
425
|
-
"name": "error",
|
|
426
|
-
"type": {
|
|
427
|
-
"text": "string"
|
|
428
|
-
},
|
|
429
|
-
"description": "The error to display",
|
|
430
|
-
"default": "\"\"",
|
|
431
|
-
"attribute": "error"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
"kind": "field",
|
|
435
|
-
"name": "text",
|
|
436
|
-
"type": {
|
|
437
|
-
"text": "string"
|
|
438
|
-
},
|
|
439
|
-
"description": "The text content of the element, captured from light DOM before the first render.",
|
|
440
|
-
"attribute": "text"
|
|
441
|
-
}
|
|
442
|
-
],
|
|
443
|
-
"events": [
|
|
444
|
-
{
|
|
445
|
-
"description": "Programmatically fire click on the component.",
|
|
446
|
-
"name": "click"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
"description": "Programmatically move focus to the component.",
|
|
450
|
-
"name": "focus"
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
"description": "Programmatically remove focus from the component.",
|
|
454
|
-
"name": "blur"
|
|
455
|
-
}
|
|
456
|
-
],
|
|
457
|
-
"attributes": [
|
|
458
|
-
{
|
|
459
|
-
"name": "size",
|
|
460
|
-
"type": {
|
|
461
|
-
"text": "\"sm\" | \"md\" | \"lg\""
|
|
462
|
-
},
|
|
463
|
-
"description": "The size of the input.",
|
|
464
|
-
"default": "\"md\"",
|
|
465
|
-
"fieldName": "size"
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
"name": "disabled",
|
|
469
|
-
"type": {
|
|
470
|
-
"text": "Boolean"
|
|
471
|
-
},
|
|
472
|
-
"description": "Makes the component disabled.",
|
|
473
|
-
"default": "false",
|
|
474
|
-
"fieldName": "disabled"
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
"name": "name",
|
|
478
|
-
"type": {
|
|
479
|
-
"text": "string"
|
|
480
|
-
},
|
|
481
|
-
"description": "The name used to identify the input in forms.",
|
|
482
|
-
"default": "\"\"",
|
|
483
|
-
"fieldName": "name"
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
"name": "label",
|
|
487
|
-
"type": {
|
|
488
|
-
"text": "string"
|
|
489
|
-
},
|
|
490
|
-
"description": "The label for the input",
|
|
491
|
-
"default": "\"\"",
|
|
492
|
-
"fieldName": "label"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
"name": "value",
|
|
496
|
-
"type": {
|
|
497
|
-
"text": "string"
|
|
498
|
-
},
|
|
499
|
-
"description": "The value used to identify the input in forms.",
|
|
500
|
-
"default": "\"\"",
|
|
501
|
-
"fieldName": "value"
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
"name": "placeholder",
|
|
505
|
-
"type": {
|
|
506
|
-
"text": "string"
|
|
507
|
-
},
|
|
508
|
-
"description": "The placeholder text for the input.",
|
|
509
|
-
"default": "\"\"",
|
|
510
|
-
"fieldName": "placeholder"
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
"name": "type",
|
|
514
|
-
"type": {
|
|
515
|
-
"text": "\"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\" | \"unit\" | \"button\""
|
|
516
|
-
},
|
|
517
|
-
"description": "The type of the input",
|
|
518
|
-
"default": "\"text\"",
|
|
519
|
-
"fieldName": "type"
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
"name": "error",
|
|
523
|
-
"type": {
|
|
524
|
-
"text": "string"
|
|
525
|
-
},
|
|
526
|
-
"description": "The error to display",
|
|
527
|
-
"default": "\"\"",
|
|
528
|
-
"fieldName": "error"
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
"name": "text",
|
|
532
|
-
"fieldName": "text",
|
|
533
|
-
"type": {
|
|
534
|
-
"text": "string"
|
|
535
|
-
},
|
|
536
|
-
"description": "The text content of the element, captured from light DOM before the first render."
|
|
537
|
-
}
|
|
538
|
-
],
|
|
539
|
-
"mixins": [
|
|
540
|
-
{
|
|
541
|
-
"name": "Elena",
|
|
542
|
-
"package": "@elenajs/core"
|
|
543
|
-
}
|
|
544
|
-
],
|
|
545
|
-
"superclass": {
|
|
546
|
-
"name": "HTMLElement"
|
|
547
|
-
},
|
|
548
|
-
"tagName": "elena-input",
|
|
549
|
-
"status": "alpha",
|
|
550
|
-
"displayName": "Input",
|
|
551
|
-
"customElement": true
|
|
552
|
-
}
|
|
553
|
-
],
|
|
554
|
-
"exports": [
|
|
555
|
-
{
|
|
556
|
-
"kind": "js",
|
|
557
|
-
"name": "default",
|
|
558
|
-
"declaration": {
|
|
559
|
-
"name": "Input",
|
|
560
|
-
"module": "src/input/input.js"
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
"kind": "custom-element-definition",
|
|
565
|
-
"name": "elena-input",
|
|
566
|
-
"declaration": {
|
|
567
|
-
"name": "Input",
|
|
568
|
-
"module": "src/input/input.js"
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
]
|
|
572
|
-
},
|
|
573
218
|
{
|
|
574
219
|
"kind": "javascript-module",
|
|
575
220
|
"path": "src/stack/stack.js",
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t,n){if(t="boolean"===e&&"boolean"!=typeof t?null!==t:t,!n)return t;if("toAttribute"===n)switch(e){case"object":case"array":return null===t?null:JSON.stringify(t);case"boolean":return t?"":null;case"number":return null===t?null:t;default:return""===t?null:t}else switch(e){case"object":case"array":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn("░█ [ELENA]: Invalid JSON for prop, received: "+t),null}case"boolean":return t;case"number":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn("░█ [ELENA]: Cannot sync attributes to a null element.")}let n=class extends Event{constructor(e,t){super(e,{bubbles:!0,composed:!0,...t})}};function s(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(e).replace(/[&<>"']/g,e=>t[e])}function r(e,...t){const n=e.reduce((e,n,r)=>{const i=t[r];return e+n+(i&&i.__raw?String(i):s(String(i??"")))},"");return{__raw:!0,strings:e,values:t,toString:()=>n}}const i=new WeakMap;function o(e,t,n){(function(e,t,n){if(e._tplStrings!==t||!e._tplParts)return!1;let r=!1;for(let t=0;t<n.length;t++){const i=n[t],o=i&&i.__raw,l=o?String(i):s(String(i??""));if(l!==e._tplValues[t])if(e._tplValues[t]=l,o)r=!0;else{const n=e._tplParts[t];n?n.textContent=String(i??""):r=!0}}return!r})(e,t,n)||function(e,t,n){const r=n.map(e=>e&&e.__raw?String(e):s(String(e??"")));let o=i.get(t);o||(o=Array.from(t,e=>e.replace(/\n\s*/g," ")),i.set(t,o));const l=o.reduce((e,t,n)=>e+t+(r[n]??""),"").replace(/>\s+</g,"><").replace(/>\s+/g,">").replace(/\s+</g,"<").trim();(function(e,t){e?e.replaceChildren(e.ownerDocument.createRange().createContextualFragment(t)):console.warn("░█ [ELENA]: Cannot render to a null element.")})(e,l),e._tplStrings=t,e._tplValues=r,e._tplParts=function(e,t){const n=new Array(t.length),s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r,i=0;for(;(r=s.nextNode())&&i<t.length;)r.textContent===t[i]&&(n[i]=r,i++);return n}(e,r)}(e,t,n)}function l(s,r){const i=r&&r.element?/^[a-z][a-z0-9-]*$/i.test(r.element)?e=>e.getElementsByClassName(r.element)[0]:e=>e.querySelector(r.element):e=>e.firstElementChild;class l extends s{element=null;attributeChangedCallback(t,n,s){"text"!==t?(function(t,n,s,r){if(s!==r){const s=typeof t[n];"undefined"===s&&console.warn(`░█ [ELENA]: Prop "${n}" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const i=e(s,r,"toProp");t[n]=i}}(this,t,n,s),this._hydrated&&n!==s&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=s??""}static get observedAttributes(){return[...r&&r.props?r.props:[],"text"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&o(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=i(this),this.element||(r&&r.element&&console.warn("░█ [ELENA]: No element found, using firstElementChild as fallback."),this.element=this.firstElementChild))}_flushProps(){if(this._props){const n=!(!r||!r.element);for(const[s,r]of this._props){const i=e(typeof r,r,"toAttribute");t(this,s,i),n&&t(this.element,s,i)}}}_delegateEvents(){!this._events&&r&&r.events&&(this.element?(this._events=!0,r.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn("░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector."))}updated(){this._hydrated||(this._hydrated=!0,this.setAttribute("hydrated",""))}disconnectedCallback(){this._events&&(this._events=!1,r.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){r.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new n(e.type,{cancelable:!0})))}get text(){return this._text??""}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return r&&r.props?.length&&(r.props.includes("text")&&console.warn('░█ [ELENA]: "text" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),function(n,s,r=!0){for(const i of s)Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(i):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(i))return;if(this._props.set(i,n),!this.isConnected)return;const s=e(typeof n,n,"toAttribute");t(this,i,s),r&&this.element&&t(this.element,i,s)}})}(l.prototype,r.props,!(!r||!r.element))),r&&r.tagName&&(l._tagName=r.tagName),l.define=function(){this._tagName?function(e,t){"undefined"!=typeof window&&"customElements"in window&&(window.customElements.get(e)||window.customElements.define(e,t))}(this._tagName,this):console.warn("░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.")},l}export{r as e,l as o};
|
|
2
|
+
//# sourceMappingURL=elena-6kltq0mt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elena-6kltq0mt.js","sources":["../../core/dist/props.js","../../core/dist/events.js","../../core/dist/utils.js","../../core/dist/render.js","../../core/dist/elena.js"],"sourcesContent":["function e(e,t,n){if(t=\"boolean\"===e&&\"boolean\"!=typeof t?null!==t:t,!n)return t;if(\"toAttribute\"===n)switch(e){case\"object\":case\"array\":return null===t?null:JSON.stringify(t);case\"boolean\":return t?\"\":null;case\"number\":return null===t?null:t;default:return\"\"===t?null:t}else switch(e){case\"object\":case\"array\":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn(\"░█ [ELENA]: Invalid JSON for prop, received: \"+t),null}case\"boolean\":return t;case\"number\":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn(\"░█ [ELENA]: Cannot sync attributes to a null element.\")}function n(n,r,o=!0){for(const s of r)Object.defineProperty(n,s,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(s):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(s))return;if(this._props.set(s,n),!this.isConnected)return;const r=e(typeof n,n,\"toAttribute\");t(this,s,r),o&&this.element&&t(this.element,s,r)}})}function r(t,n,r,o){if(r!==o){const r=typeof t[n];\"undefined\"===r&&console.warn(`░█ [ELENA]: Prop \"${n}\" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const s=e(r,o,\"toProp\");t[n]=s}}export{e as getPropValue,r as getProps,n as setProps,t as syncAttribute};\n//# sourceMappingURL=props.js.map\n","class e extends Event{constructor(e,s){super(e,{bubbles:!0,composed:!0,...s})}}export{e as ElenaEvent};\n//# sourceMappingURL=events.js.map\n","function n(n,t){\"undefined\"!=typeof window&&\"customElements\"in window&&(window.customElements.get(n)||window.customElements.define(n,t))}function t(n){const t={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\",\"'\":\"'\"};return String(n).replace(/[&<>\"']/g,n=>t[n])}function e(n,...e){const o=n.reduce((n,o,r)=>{const i=e[r];return n+o+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>o}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing};\n//# sourceMappingURL=utils.js.map\n","import{escapeHtml as t}from\"./utils.js\";const e=new WeakMap;function n(n,l,o){(function(e,n,r){if(e._tplStrings!==n||!e._tplParts)return!1;let l=!1;for(let n=0;n<r.length;n++){const o=r[n],a=o&&o.__raw,c=a?String(o):t(String(o??\"\"));if(c!==e._tplValues[n])if(e._tplValues[n]=c,a)l=!0;else{const t=e._tplParts[n];t?t.textContent=String(o??\"\"):l=!0}}return!l})(n,l,o)||function(n,l,o){const a=o.map(e=>e&&e.__raw?String(e):t(String(e??\"\")));let c=e.get(l);c||(c=Array.from(l,t=>t.replace(/\\n\\s*/g,\" \")),e.set(l,c));const s=c.reduce((t,e,n)=>t+e+(a[n]??\"\"),\"\").replace(/>\\s+</g,\"><\").replace(/>\\s+/g,\">\").replace(/\\s+</g,\"<\").trim();r(n,s),n._tplStrings=l,n._tplValues=a,n._tplParts=function(t,e){const n=new Array(e.length),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let l,o=0;for(;(l=r.nextNode())&&o<e.length;)l.textContent===e[o]&&(n[o]=l,o++);return n}(n,a)}(n,l,o)}function r(t,e){t?t.replaceChildren(t.ownerDocument.createRange().createContextualFragment(e)):console.warn(\"░█ [ELENA]: Cannot render to a null element.\")}export{r as renderHtml,n as renderTemplate};\n//# sourceMappingURL=render.js.map\n","import{setProps as e,getProps as t,getPropValue as s,syncAttribute as n}from\"./props.js\";import{ElenaEvent as i}from\"./events.js\";import{defineElement as r}from\"./utils.js\";export{html,nothing}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,l){const a=l&&l.element?/^[a-z][a-z0-9-]*$/i.test(l.element)?e=>e.getElementsByClassName(l.element)[0]:e=>e.querySelector(l.element):e=>e.firstElementChild;class d extends o{element=null;attributeChangedCallback(e,s,n){\"text\"!==e?(t(this,e,s,n),this._hydrated&&s!==n&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=n??\"\"}static get observedAttributes(){return[...l&&l.props?l.props:[],\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&h(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=a(this),this.element||(l&&l.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props){const e=!(!l||!l.element);for(const[t,i]of this._props){const r=s(typeof i,i,\"toAttribute\");n(this,t,r),e&&n(this.element,t,r)}}}_delegateEvents(){!this._events&&l&&l.events&&(this.element?(this._events=!0,l.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn(\"░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector.\"))}updated(){this._hydrated||(this._hydrated=!0,this.setAttribute(\"hydrated\",\"\"))}disconnectedCallback(){this._events&&(this._events=!1,l.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){l.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new i(e.type,{cancelable:!0})))}get text(){return this._text??\"\"}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return l&&l.props?.length&&(l.props.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(d.prototype,l.props,!(!l||!l.element))),l&&l.tagName&&(d._tagName=l.tagName),d.define=function(){this._tagName?r(this._tagName,this):console.warn(\"░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.\")},d}export{o as Elena};\n//# sourceMappingURL=elena.js.map\n"],"names":["e","t","n","JSON","stringify","parse","console","warn","removeAttribute","setAttribute","e$2","Event","constructor","s","super","bubbles","composed","String","replace","o","reduce","r","i","__raw","strings","values","toString","WeakMap","l","_tplStrings","_tplParts","length","a","c","_tplValues","textContent","map","get","Array","from","set","trim","replaceChildren","ownerDocument","createRange","createContextualFragment","document","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","element","test","getElementsByClassName","querySelector","firstElementChild","d","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","props","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","_events","events","forEach","addEventListener","disconnectedCallback","removeEventListener","handleEvent","includes","type","stopPropagation","dispatchEvent","cancelable","Object","defineProperty","configurable","enumerable","Map","isConnected","prototype","tagName","_tagName","define","window","customElements"],"mappings":"AAAA,SAASA,EAAEA,EAAEC,EAAEC,GAAG,GAAGD,EAAE,YAAYD,GAAG,kBAAkBC,EAAE,OAAOA,EAAEA,GAAGC,EAAE,OAAOD,EAAE,GAAG,gBAAgBC,EAAE,OAAOF,GAAG,IAAI,SAAS,IAAI,QAAQ,OAAO,OAAOC,EAAE,KAAKE,KAAKC,UAAUH,GAAG,IAAI,UAAU,OAAOA,EAAE,GAAG,KAAK,IAAI,SAAS,OAAO,OAAOA,EAAE,KAAKA,EAAE,QAAQ,MAAM,KAAKA,EAAE,KAAKA,OAAO,OAAOD,GAAG,IAAI,SAAS,IAAI,QAAQ,IAAIC,EAAE,OAAOA,EAAE,IAAI,OAAOE,KAAKE,MAAMJ,EAAE,CAAC,MAAM,OAAOK,QAAQC,KAAK,gDAAgDN,GAAG,IAAI,CAAC,IAAI,UAAU,OAAOA,EAAE,IAAI,SAAS,OAAO,OAAOA,GAAGA,EAAEA,EAAE,QAAQ,OAAOA,EAAE,CAAC,SAASA,EAAED,EAAEC,EAAEC,GAAGF,EAAE,OAAOE,EAAEF,EAA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F,GAAE,GAAI,IAAI,MAAMN,KAAKQ,EAAEmE,OAAOC,eAAevF,EAAEW,EAAE,CAAC6E,cAAa,EAAGC,YAAW,EAAG,GAAAtD,GAAM,OAAOqB,KAAKiB,OAAOjB,KAAKiB,OAAOtC,IAAIxB,QAAG,CAAM,EAAE,GAAA2B,CAAItC,GAAG,GAAGwD,KAAKiB,SAASjB,KAAKiB,OAAO,IAAIiB,KAAK1F,IAAIwD,KAAKiB,OAAOtC,IAAIxB,GAAG,OAAO,GAAG6C,KAAKiB,OAAOnC,IAAI3B,EAAEX,IAAIwD,KAAKmC,YAAY,OAAO,MAAMxE,EAAErB,SAASE,EAAEA,EAAE,eAAeD,EAAEyD,KAAK7C,EAAEQ,GAAGF,GAAGuC,KAAKP,SAASlD,EAAEyD,KAAKP,QAAQtC,EAAEQ,EAAE,GAAG,CIAy8CrB,CAAEwD,EAAEsC,UAAUlE,EAAEoC,SAASpC,IAAIA,EAAEuB,WAAWvB,GAAGA,EAAEmE,UAAUvC,EAAEwC,SAASpE,EAAEmE,SAASvC,EAAEyC,OAAO,WAAWvC,KAAKsC,SFA/hF,SAAW9F,EAAED,GAAG,oBAAoBiG,QAAQ,mBAAmBA,SAASA,OAAOC,eAAe9D,IAAInC,IAAIgG,OAAOC,eAAeF,OAAO/F,EAAED,GAAG,CEAg6EoB,CAAEqC,KAAKsC,SAAStC,MAAMpD,QAAQC,KAAK,4GAA4G,EAAEiD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as Button}from"./button.js";export{default as
|
|
1
|
+
export{default as Button}from"./button.js";export{default as Stack}from"./stack.js";import"./elena-6kltq0mt.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/stack.css
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/ ELENA STACK
|
|
3
|
-
/ --------------------------------------------- */
|
|
4
|
-
|
|
5
|
-
elena-stack {
|
|
6
|
-
display: flex;
|
|
7
|
-
justify-content: flex-start;
|
|
8
|
-
align-items: flex-start;
|
|
9
|
-
flex-flow: column wrap;
|
|
10
|
-
gap: 0.5rem;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
elena-stack[direction="row"] {
|
|
14
|
-
flex-direction: row;
|
|
15
|
-
}
|
|
1
|
+
@scope (elena-stack){:scope{all:unset;display:flex;justify-content:flex-start;align-items:flex-start;flex-flow:column wrap;flex-direction:column;gap:0.5rem}:scope[direction="row"]{flex-direction:row}}
|
package/dist/stack.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./elena-
|
|
1
|
+
import{o as e}from"./elena-6kltq0mt.js";const t={tagName:"elena-stack",props:["direction"]};class s extends(e(HTMLElement,t)){constructor(){super(),this.direction="column"}}s.define();export{s as default};
|
|
2
2
|
//# sourceMappingURL=stack.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elenajs/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Elena component library demonstrating how to build progressive web components.",
|
|
5
5
|
"author": "Elena <hi@elenajs.com>",
|
|
6
6
|
"homepage": "https://elenajs.com/",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"clean": "rm -rf dist/"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@elenajs/core": "^0.
|
|
36
|
+
"@elenajs/core": "^0.9.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@elenajs/bundler": "^0.
|
|
39
|
+
"@elenajs/bundler": "^0.3.0",
|
|
40
40
|
"@web/dev-server": "0.4.6"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "323fcac2e1d15f81e7b4a039357c1f2e3e8f3030"
|
|
43
43
|
}
|
package/dist/avatar.d.ts
DELETED
package/dist/avatar.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e,e as a,a as t}from"./elena-Bvw5aqmt.js";const n={props:["icon","state"],tagName:"elena-avatar",element:".elena-avatar"};class s extends(e(HTMLElement,n)){constructor(){super(),this.state="initial"}renderImage(){return a`<img class="elena-image" src="..">`}renderFallback(){return a`
|
|
2
|
-
${this.icon?a`<elena-icon name="${this.icon}"></elena-icon>`:a`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27"></svg>`}
|
|
3
|
-
`}render(){return a`<div class="elena-avatar">${"initial"!==this.state?this.renderImage():t} ${"loaded"!==this.state?this.renderFallback():t}</div>`}}s.define();export{s as default};
|
|
4
|
-
//# sourceMappingURL=avatar.js.map
|
package/dist/avatar.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sources":["../src/avatar/avatar.js"],"sourcesContent":["import { Elena, html, nothing } from \"@elenajs/core\";\n\nconst options = {\n props: [\"icon\", \"state\"],\n tagName: \"elena-avatar\",\n element: \".elena-avatar\",\n};\n\nexport default class Avatar extends Elena(HTMLElement, options) {\n constructor() {\n super();\n this.state = \"initial\";\n }\n\n renderImage() {\n return html`<img class=\"elena-image\" src=\"..\" />`;\n }\n\n renderFallback() {\n return html`\n ${this.icon\n ? html`<elena-icon name=\"${this.icon}\"></elena-icon>`\n : html`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 27 27\"></svg>`}\n `;\n }\n\n render() {\n return html`\n <div class=\"elena-avatar\">\n ${this.state !== \"initial\" ? this.renderImage() : nothing}\n ${this.state !== \"loaded\" ? this.renderFallback() : nothing}\n </div>\n `;\n }\n}\n\n/**\n * Register the web component\n */\nAvatar.define();\n"],"names":["options","props","tagName","element","Avatar","Elena","HTMLElement","constructor","super","this","state","renderImage","html","renderFallback","icon","render","nothing","define"],"mappings":"sDAEA,MAAMA,EAAU,CACdC,MAAO,CAAC,OAAQ,SAChBC,QAAS,eACTC,QAAS,iBAGI,MAAMC,UAAeC,EAAMC,YAAaN,IACrD,WAAAO,GACEC,QACAC,KAAKC,MAAQ,SACf,CAEA,WAAAC,GACE,OAAOC,CAAI,oCACb,CAEA,cAAAC,GACE,OAAOD,CAAI;QACPH,KAAKK,KACHF,CAAI,qBAAqBH,KAAKK,sBAC9BF,CAAI;KAEZ,CAEA,MAAAG,GACE,OAAOH,CAAI,6BAEU,YAAfH,KAAKC,MAAsBD,KAAKE,cAAgBK,KACjC,WAAfP,KAAKC,MAAqBD,KAAKI,iBAAmBG,SAG1D,EAMFZ,EAAOa"}
|
package/dist/elena-Bvw5aqmt.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e,t,n){if(t="boolean"===e&&"boolean"!=typeof t?null!==t:t,!n)return t;if("toAttribute"===n)switch(e){case"object":case"array":return null===t?null:JSON.stringify(t);case"boolean":return t?"":null;case"number":return null===t?null:t;default:return""===t?null:t}else switch(e){case"object":case"array":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn("░█ [ELENA]: Invalid JSON for prop, received: "+t),null}case"boolean":return t;case"number":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn("░█ [ELENA]: Cannot sync attributes to a null element.")}let n=class extends Event{constructor(e,t){super(e,{bubbles:!0,composed:!0,...t})}};function s(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(e).replace(/[&<>"']/g,e=>t[e])}function r(e,...t){const n=e.reduce((e,n,r)=>{const i=t[r];return e+n+(i&&i.__raw?String(i):s(String(i??"")))},"");return{__raw:!0,strings:e,values:t,toString:()=>n}}const i={__raw:!0,toString:()=>""},o=new WeakMap;function l(e,t,n){(function(e,t,n){if(e._tplStrings!==t||!e._tplParts)return!1;let r=!1;for(let t=0;t<n.length;t++){const i=n[t],o=i&&i.__raw,l=o?String(i):s(String(i??""));if(l!==e._tplValues[t])if(e._tplValues[t]=l,o)r=!0;else{const n=e._tplParts[t];n?n.textContent=String(i??""):r=!0}}return!r})(e,t,n)||function(e,t,n){const r=n.map(e=>e&&e.__raw?String(e):s(String(e??"")));let i=o.get(t);i||(i=Array.from(t,e=>e.replace(/\n\s*/g," ")),o.set(t,i));const l=i.reduce((e,t,n)=>e+t+(r[n]??""),"").replace(/>\s+</g,"><").replace(/>\s+/g,">").replace(/\s+</g,"<").trim();(function(e,t){e?e.replaceChildren(e.ownerDocument.createRange().createContextualFragment(t)):console.warn("░█ [ELENA]: Cannot render to a null element.")})(e,l),e._tplStrings=t,e._tplValues=r,e._tplParts=function(e,t){const n=new Array(t.length),s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r,i=0;for(;(r=s.nextNode())&&i<t.length;)r.textContent===t[i]&&(n[i]=r,i++);return n}(e,r)}(e,t,n)}function a(s,r){const i=r&&r.element?/^[a-z][a-z0-9-]*$/i.test(r.element)?e=>e.getElementsByClassName(r.element)[0]:e=>e.querySelector(r.element):e=>e.firstElementChild;class o extends s{element=null;attributeChangedCallback(t,n,s){"text"!==t?(function(t,n,s,r){if(s!==r){const s=typeof t[n];"undefined"===s&&console.warn(`░█ [ELENA]: Prop "${n}" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const i=e(s,r,"toProp");t[n]=i}}(this,t,n,s),this._hydrated&&n!==s&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=s??""}static get observedAttributes(){return[...r&&r.props?r.props:[],"text"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&l(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=i(this),this.element||(r&&r.element&&console.warn("░█ [ELENA]: No element found, using firstElementChild as fallback."),this.element=this.firstElementChild))}_flushProps(){if(this._props){const n=!(!r||!r.element);for(const[s,r]of this._props){const i=e(typeof r,r,"toAttribute");t(this,s,i),n&&t(this.element,s,i)}}}_delegateEvents(){!this._events&&r&&r.events&&(this.element?(this._events=!0,r.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn("░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector."))}updated(){this._hydrated||(this._hydrated=!0,this.classList.add("elena-hydrated"))}disconnectedCallback(){this._events&&(this._events=!1,r.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){r.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new n(e.type,{cancelable:!0})))}get text(){return this._text??""}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return r&&r.props?.length&&(r.props.includes("text")&&console.warn('░█ [ELENA]: "text" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),function(n,s,r=!0){for(const i of s)Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(i):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(i))return;if(this._props.set(i,n),!this.isConnected)return;const s=e(typeof n,n,"toAttribute");t(this,i,s),r&&this.element&&t(this.element,i,s)}})}(o.prototype,r.props,!(!r||!r.element))),r&&r.tagName&&(o._tagName=r.tagName),o.define=function(){this._tagName?function(e,t){"undefined"!=typeof window&&"customElements"in window&&(window.customElements.get(e)||window.customElements.define(e,t))}(this._tagName,this):console.warn("░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.")},o}export{i as a,r as e,a as o};
|
|
2
|
-
//# sourceMappingURL=elena-Bvw5aqmt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elena-Bvw5aqmt.js","sources":["../../core/dist/props.js","../../core/dist/events.js","../../core/dist/utils.js","../../core/dist/render.js","../../core/dist/elena.js"],"sourcesContent":["function e(e,t,n){if(t=\"boolean\"===e&&\"boolean\"!=typeof t?null!==t:t,!n)return t;if(\"toAttribute\"===n)switch(e){case\"object\":case\"array\":return null===t?null:JSON.stringify(t);case\"boolean\":return t?\"\":null;case\"number\":return null===t?null:t;default:return\"\"===t?null:t}else switch(e){case\"object\":case\"array\":if(!t)return t;try{return JSON.parse(t)}catch{return console.warn(\"░█ [ELENA]: Invalid JSON for prop, received: \"+t),null}case\"boolean\":return t;case\"number\":return null!==t?+t:t;default:return t}}function t(e,t,n){e?null===n?e.removeAttribute(t):e.setAttribute(t,n):console.warn(\"░█ [ELENA]: Cannot sync attributes to a null element.\")}function n(n,r,o=!0){for(const s of r)Object.defineProperty(n,s,{configurable:!0,enumerable:!0,get(){return this._props?this._props.get(s):void 0},set(n){if(this._props||(this._props=new Map),n===this._props.get(s))return;if(this._props.set(s,n),!this.isConnected)return;const r=e(typeof n,n,\"toAttribute\");t(this,s,r),o&&this.element&&t(this.element,s,r)}})}function r(t,n,r,o){if(r!==o){const r=typeof t[n];\"undefined\"===r&&console.warn(`░█ [ELENA]: Prop \"${n}\" has no default value. Set a default in the constructor so Elena can infer the correct type.`);const s=e(r,o,\"toProp\");t[n]=s}}export{e as getPropValue,r as getProps,n as setProps,t as syncAttribute};\n//# sourceMappingURL=props.js.map\n","class e extends Event{constructor(e,s){super(e,{bubbles:!0,composed:!0,...s})}}export{e as ElenaEvent};\n//# sourceMappingURL=events.js.map\n","function n(n,t){\"undefined\"!=typeof window&&\"customElements\"in window&&(window.customElements.get(n)||window.customElements.define(n,t))}function t(n){const t={\"&\":\"&\",\"<\":\"<\",\">\":\">\",'\"':\""\",\"'\":\"'\"};return String(n).replace(/[&<>\"']/g,n=>t[n])}function e(n,...e){const o=n.reduce((n,o,r)=>{const i=e[r];return n+o+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>o}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing};\n//# sourceMappingURL=utils.js.map\n","import{escapeHtml as t}from\"./utils.js\";const e=new WeakMap;function n(n,l,o){(function(e,n,r){if(e._tplStrings!==n||!e._tplParts)return!1;let l=!1;for(let n=0;n<r.length;n++){const o=r[n],a=o&&o.__raw,c=a?String(o):t(String(o??\"\"));if(c!==e._tplValues[n])if(e._tplValues[n]=c,a)l=!0;else{const t=e._tplParts[n];t?t.textContent=String(o??\"\"):l=!0}}return!l})(n,l,o)||function(n,l,o){const a=o.map(e=>e&&e.__raw?String(e):t(String(e??\"\")));let c=e.get(l);c||(c=Array.from(l,t=>t.replace(/\\n\\s*/g,\" \")),e.set(l,c));const s=c.reduce((t,e,n)=>t+e+(a[n]??\"\"),\"\").replace(/>\\s+</g,\"><\").replace(/>\\s+/g,\">\").replace(/\\s+</g,\"<\").trim();r(n,s),n._tplStrings=l,n._tplValues=a,n._tplParts=function(t,e){const n=new Array(e.length),r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let l,o=0;for(;(l=r.nextNode())&&o<e.length;)l.textContent===e[o]&&(n[o]=l,o++);return n}(n,a)}(n,l,o)}function r(t,e){t?t.replaceChildren(t.ownerDocument.createRange().createContextualFragment(e)):console.warn(\"░█ [ELENA]: Cannot render to a null element.\")}export{r as renderHtml,n as renderTemplate};\n//# sourceMappingURL=render.js.map\n","import{setProps as e,getProps as t,getPropValue as s,syncAttribute as n}from\"./props.js\";import{ElenaEvent as i}from\"./events.js\";import{defineElement as r}from\"./utils.js\";export{html,nothing}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,l){const a=l&&l.element?/^[a-z][a-z0-9-]*$/i.test(l.element)?e=>e.getElementsByClassName(l.element)[0]:e=>e.querySelector(l.element):e=>e.firstElementChild;class d extends o{element=null;attributeChangedCallback(e,s,n){\"text\"!==e?(t(this,e,s,n),this._hydrated&&s!==n&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)):this.text=n??\"\"}static get observedAttributes(){return[...l&&l.props?l.props:[],\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&h(this,e.strings,e.values)}connectedCallback(){this._captureText(),this._applyRender(),this._resolveInnerElement(),this._flushProps(),this._delegateEvents(),this.updated()}_captureText(){if(!this._hydrated&&!this._text){const e=this.textContent.trim();e?this.text=e:queueMicrotask(()=>{this._text||(this.text=this.textContent.trim())})}}_resolveInnerElement(){this.element||(this.element=a(this),this.element||(l&&l.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props){const e=!(!l||!l.element);for(const[t,i]of this._props){const r=s(typeof i,i,\"toAttribute\");n(this,t,r),e&&n(this.element,t,r)}}}_delegateEvents(){!this._events&&l&&l.events&&(this.element?(this._events=!0,l.events?.forEach(e=>{this.element.addEventListener(e,this),this[e]=(...t)=>this.element[e](...t)})):console.warn(\"░█ [ELENA]: Cannot delegate events, no inner element found. Ensure the component renders an element or check your element selector.\"))}updated(){this._hydrated||(this._hydrated=!0,this.classList.add(\"elena-hydrated\"))}disconnectedCallback(){this._events&&(this._events=!1,l.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){l.events?.includes(e.type)&&(e.stopPropagation(),this.dispatchEvent(new i(e.type,{cancelable:!0})))}get text(){return this._text??\"\"}set text(e){const t=this._text;this._text=e,this._hydrated&&t!==e&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}}return l&&l.props?.length&&(l.props.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(d.prototype,l.props,!(!l||!l.element))),l&&l.tagName&&(d._tagName=l.tagName),d.define=function(){this._tagName?r(this._tagName,this):console.warn(\"░█ [ELENA]: define() called without a tagName. Set tagName in your Elena options to register the element.\")},d}export{o as Elena};\n//# sourceMappingURL=elena.js.map\n"],"names":["e","t","n","JSON","stringify","parse","console","warn","removeAttribute","setAttribute","e$2","Event","constructor","s","super","bubbles","composed","String","replace","o","reduce","r","i","__raw","strings","values","toString","WeakMap","l","_tplStrings","_tplParts","length","a","c","_tplValues","textContent","map","get","Array","from","set","trim","replaceChildren","ownerDocument","createRange","createContextualFragment","document","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","element","test","getElementsByClassName","querySelector","firstElementChild","d","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","props","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","_events","events","forEach","addEventListener","classList","add","disconnectedCallback","removeEventListener","handleEvent","includes","type","stopPropagation","dispatchEvent","cancelable","Object","defineProperty","configurable","enumerable","Map","isConnected","prototype","tagName","_tagName","define","window","customElements"],"mappings":"AAAA,SAASA,EAAEA,EAAEC,EAAEC,GAAG,GAAGD,EAAE,YAAYD,GAAG,kBAAkBC,EAAE,OAAOA,EAAEA,GAAGC,EAAE,OAAOD,EAAE,GAAG,gBAAgBC,EAAE,OAAOF,GAAG,IAAI,SAAS,IAAI,QAAQ,OAAO,OAAOC,EAAE,KAAKE,KAAKC,UAAUH,GAAG,IAAI,UAAU,OAAOA,EAAE,GAAG,KAAK,IAAI,SAAS,OAAO,OAAOA,EAAE,KAAKA,EAAE,QAAQ,MAAM,KAAKA,EAAE,KAAKA,OAAO,OAAOD,GAAG,IAAI,SAAS,IAAI,QAAQ,IAAIC,EAAE,OAAOA,EAAE,IAAI,OAAOE,KAAKE,MAAMJ,EAAE,CAAC,MAAM,OAAOK,QAAQC,KAAK,gDAAgDN,GAAG,IAAI,CAAC,IAAI,UAAU,OAAOA,EAAE,IAAI,SAAS,OAAO,OAAOA,GAAGA,EAAEA,EAAE,QAAQ,OAAOA,EAAE,CAAC,SAASA,EAAED,EAAEC,EAAEC,GAAGF,EAAE,OAAOE,EAAEF,EAAEQ,gBAAgBP,GAAGD,EAAES,aAAaR,EAAEC,GAAGI,QAAQC,KAAK,wDAAwD,CCAvoB,IAAAG,EAAA,cAAgBC,MAAM,WAAAC,C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,CAAC+E,cAAa,EAAGC,YAAW,EAAG,GAAAxD,GAAM,OAAOqB,KAAKiB,OAAOjB,KAAKiB,OAAOtC,IAAIxB,QAAG,CAAM,EAAE,GAAA2B,CAAItC,GAAG,GAAGwD,KAAKiB,SAASjB,KAAKiB,OAAO,IAAImB,KAAK5F,IAAIwD,KAAKiB,OAAOtC,IAAIxB,GAAG,OAAO,GAAG6C,KAAKiB,OAAOnC,IAAI3B,EAAEX,IAAIwD,KAAKqC,YAAY,OAAO,MAAM1E,EAAErB,SAASE,EAAEA,EAAE,eAAeD,EAAEyD,KAAK7C,EAAEQ,GAAGF,GAAGuC,KAAKP,SAASlD,EAAEyD,KAAKP,QAAQtC,EAAEQ,EAAE,GAAG,CIA68CrB,CAAEwD,EAAEwC,UAAUpE,EAAEoC,SAASpC,IAAIA,EAAEuB,WAAWvB,GAAGA,EAAEqE,UAAUzC,EAAE0C,SAAStE,EAAEqE,SAASzC,EAAE2C,OAAO,WAAWzC,KAAKwC,SFAniF,SAAWhG,EAAED,GAAG,oBAAoBmG,QAAQ,mBAAmBA,SAASA,OAAOC,eAAehE,IAAInC,IAAIkG,OAAOC,eAAeF,OAAOjG,EAAED,GAAG,CEAo6EoB,CAAEqC,KAAKwC,SAASxC,MAAMpD,QAAQC,KAAK,4GAA4G,EAAEiD,CAAC"}
|
package/dist/input.css
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/* ---------------------------------------------
|
|
2
|
-
/ ELENA input
|
|
3
|
-
/ --------------------------------------------- */
|
|
4
|
-
|
|
5
|
-
elena-input {
|
|
6
|
-
/* Public CSS Custom Properties */
|
|
7
|
-
--elena-input-bg: transparent;
|
|
8
|
-
--elena-input-text: #333;
|
|
9
|
-
--elena-input-border: #333;
|
|
10
|
-
--elena-input-radius: 4px;
|
|
11
|
-
--elena-input-font: sans-serif;
|
|
12
|
-
|
|
13
|
-
all: unset;
|
|
14
|
-
min-inline-size: 300px;
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
display: inline-block;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
gap: 5px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* For overall visual styles, we want to target both
|
|
23
|
-
* non-hydrated element and the internal input element
|
|
24
|
-
* with the same styles. This way the element will look
|
|
25
|
-
* the same before & after client side hydration.
|
|
26
|
-
*/
|
|
27
|
-
:is(elena-input:not(.elena-hydrated), .elena-input) {
|
|
28
|
-
-webkit-appearance: none;
|
|
29
|
-
appearance: none;
|
|
30
|
-
display: inline-flex;
|
|
31
|
-
-webkit-user-select: none;
|
|
32
|
-
user-select: none;
|
|
33
|
-
line-height: 1;
|
|
34
|
-
block-size: 3rem;
|
|
35
|
-
background: var(--elena-input-bg);
|
|
36
|
-
color: var(--elena-input-text);
|
|
37
|
-
border-radius: var(--elena-input-radius);
|
|
38
|
-
border: 1px solid var(--elena-input-border);
|
|
39
|
-
font-family: var(--elena-input-font);
|
|
40
|
-
font-weight: 700;
|
|
41
|
-
padding: 0.75rem 1.25rem;
|
|
42
|
-
cursor: text;
|
|
43
|
-
position: relative;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
elena-input:not(.elena-hydrated) {
|
|
47
|
-
margin-block-start: 1.82rem;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
elena-input:not(.elena-hydrated)::before {
|
|
51
|
-
content: attr(label);
|
|
52
|
-
position: absolute;
|
|
53
|
-
font-weight: 700;
|
|
54
|
-
top: -1.78rem;
|
|
55
|
-
left: -1px;
|
|
56
|
-
display: block;
|
|
57
|
-
inline-size: 100%;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
elena-input:not(.elena-hydrated)::after {
|
|
61
|
-
content: attr(placeholder);
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
block-size: 100%;
|
|
65
|
-
color: #aaa;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
elena-input .elena-input {
|
|
69
|
-
font-size: 100%;
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
inline-size: 100%;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
elena-input label {
|
|
75
|
-
font-weight: 700;
|
|
76
|
-
display: block;
|
|
77
|
-
block-size: 1.5rem;
|
|
78
|
-
margin: 0;
|
|
79
|
-
inline-size: 100%;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.elena-input-container {
|
|
83
|
-
inline-size: 100%;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
elena-input input:focus {
|
|
87
|
-
box-shadow: 0 0 0 1px red;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
elena-input input::placeholder {
|
|
91
|
-
opacity: 1;
|
|
92
|
-
color: #aaa;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
elena-input[error] {
|
|
96
|
-
--elena-input-border: red;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
elena-input .elena-error {
|
|
100
|
-
color: red;
|
|
101
|
-
}
|
package/dist/input.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type { InputProps } from './custom-elements.js';
|
|
2
|
-
|
|
3
|
-
declare class Input extends HTMLElement {
|
|
4
|
-
/** The size of the input. */
|
|
5
|
-
size?: "sm" | "md" | "lg";
|
|
6
|
-
/** Makes the component disabled. */
|
|
7
|
-
disabled?: Boolean;
|
|
8
|
-
/** The name used to identify the input in forms. */
|
|
9
|
-
name?: string;
|
|
10
|
-
/** The label for the input */
|
|
11
|
-
label?: string;
|
|
12
|
-
/** The value used to identify the input in forms. */
|
|
13
|
-
value?: string;
|
|
14
|
-
/** The placeholder text for the input. */
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
/** The type of the input */
|
|
17
|
-
type?: "text" | "email" | "password" | "tel" | "url" | "search" | "number" | "unit" | "button";
|
|
18
|
-
/** The error to display */
|
|
19
|
-
error?: string;
|
|
20
|
-
/** The text content of the element, captured from light DOM before the first render. */
|
|
21
|
-
text?: string;
|
|
22
|
-
/** Programmatically fire click on the component. */
|
|
23
|
-
onclick?: (e: CustomEvent<never>) => void;
|
|
24
|
-
/** Programmatically move focus to the component. */
|
|
25
|
-
onfocus?: (e: CustomEvent<never>) => void;
|
|
26
|
-
/** Programmatically remove focus from the component. */
|
|
27
|
-
onblur?: (e: CustomEvent<never>) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default Input;
|
package/dist/input.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e,e as s}from"./elena-Bvw5aqmt.js";const t={tagName:"elena-input",props:["size","disabled","name","value","type","label","error","placeholder"],events:["click","focus","blur"],element:".elena-input"};class l extends(e(HTMLElement,t)){constructor(){super(),this.size="md",this.disabled=!1,this.name="",this.label="",this.value="",this.placeholder="",this.type="text",this.error=""}render(){return s`<label for="input">${this.label}</label><div class="elena-input-container"><span class="elena-input-start"></span> <input id="input" class="elena-input"> <span class="elena-input-end"></span></div>${this.error?s`<div class="elena-error" role="alert">${this.error}</div>`:""}`}}l.define();export{l as default};
|
|
2
|
-
//# sourceMappingURL=input.js.map
|
package/dist/input.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../src/input/input.js"],"sourcesContent":["import { Elena, html } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-input\",\n props: [\"size\", \"disabled\", \"name\", \"value\", \"type\", \"label\", \"error\", \"placeholder\"],\n events: [\"click\", \"focus\", \"blur\"],\n element: \".elena-input\",\n};\n\n/**\n * The description of the component goes here.\n *\n * @displayName Input\n * @status alpha\n *\n * @event click - Programmatically fire click on the component.\n * @event focus - Programmatically move focus to the component.\n * @event blur - Programmatically remove focus from the component.\n *\n * @cssprop [--elena-input-color-text] - Controls the color of the text.\n * @cssprop [--elena-input-color-bg] - Controls the color of the background.\n * @cssprop [--elena-input-color-border] - Controls the color of the border.\n * @cssprop [--elena-input-radius] - Controls the radius of the component.\n */\nexport default class Input extends Elena(HTMLElement, options) {\n constructor() {\n super();\n\n /**\n * The size of the input.\n *\n * @attribute\n * @type {\"sm\" | \"md\" | \"lg\"}\n */\n this.size = \"md\";\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {Boolean}\n */\n this.disabled = false;\n\n /**\n * The name used to identify the input in forms.\n *\n * @attribute\n * @type {string}\n */\n this.name = \"\";\n\n /**\n * The label for the input\n *\n * @attribute\n * @type {string}\n */\n this.label = \"\";\n\n /**\n * The value used to identify the input in forms.\n *\n * @attribute\n * @type {string}\n */\n this.value = \"\";\n\n /**\n * The placeholder text for the input.\n *\n * @attribute\n * @type {string}\n */\n this.placeholder = \"\";\n\n /**\n * The type of the input\n *\n * @attribute\n * @type {\"text\" | \"email\" | \"password\" | \"tel\" | \"url\" | \"search\" | \"number\" | \"unit\" | \"button\"}\n */\n this.type = \"text\";\n\n /**\n * The error to display\n *\n * @attribute\n * @type {string}\n */\n this.error = \"\";\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n return html`\n <label for=\"input\">${this.label}</label>\n <div class=\"elena-input-container\">\n <span class=\"elena-input-start\"></span>\n <input\n id=\"input\"\n class=\"elena-input\"\n />\n <span class=\"elena-input-end\"></span>\n </div>\n ${this.error ? html`<div class=\"elena-error\" role=\"alert\">${this.error}</div>` : \"\"}\n `;\n }\n}\n\n/**\n * Register the web component\n */\nInput.define();\n"],"names":["options","tagName","props","events","element","Input","Elena","HTMLElement","constructor","super","this","size","disabled","name","label","value","placeholder","type","error","render","html","define"],"mappings":"+CAEA,MAAMA,EAAU,CACdC,QAAS,cACTC,MAAO,CAAC,OAAQ,WAAY,OAAQ,QAAS,OAAQ,QAAS,QAAS,eACvEC,OAAQ,CAAC,QAAS,QAAS,QAC3BC,QAAS,gBAkBI,MAAMC,UAAcC,EAAMC,YAAaP,IACpD,WAAAQ,GACEC,QAQAC,KAAKC,KAAO,KAQZD,KAAKE,UAAW,EAQhBF,KAAKG,KAAO,GAQZH,KAAKI,MAAQ,GAQbJ,KAAKK,MAAQ,GAQbL,KAAKM,YAAc,GAQnBN,KAAKO,KAAO,OAQZP,KAAKQ,MAAQ,EACf,CAOA,MAAAC,GACE,OAAOC,CAAI,sBACYV,KAAKI,6KASxBJ,KAAKQ,MAAQE,CAAI,yCAAyCV,KAAKQ,cAAgB,IAErF,EAMFb,EAAMgB"}
|