@elenajs/components 0.14.0 → 0.16.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/README.md +183 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +4 -1
- package/dist/bundle.js.map +1 -1
- package/dist/button.css +1 -1
- package/dist/button.d.ts +15 -1
- package/dist/button.js +4 -1
- package/dist/button.js.map +1 -1
- package/dist/custom-elements.d.ts +15 -1
- package/dist/custom-elements.json +135 -2
- package/dist/elena-5JTA2VdO.js +2 -0
- package/dist/elena-5JTA2VdO.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/stack.css +1 -1
- package/dist/stack.js +1 -1
- package/package.json +12 -7
- package/dist/elena-A7IX5lSC.js +0 -2
- package/dist/elena-A7IX5lSC.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://elenajs.com/img/elena-dark.png" alt="Elena" width="201" height="230">
|
|
4
|
+
</source>
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://elenajs.com/img/elena.png" alt="Elena" width="201" height="230">
|
|
6
|
+
</source>
|
|
7
|
+
<img src="https://elenajs.com/img/elena.png" alt="Elena" width="201" height="230">
|
|
8
|
+
</picture>
|
|
9
|
+
|
|
10
|
+
### Elena component library demonstrating how to build Progressive Web Components.
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
<a href="https://arielsalminen.com"><img src="https://img.shields.io/badge/creator-@arielle-F95B1F" alt="Creator @arielle"/></a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@elenajs/components"><img src="https://img.shields.io/npm/v/@elenajs/components.svg" alt="Latest version on npm" /></a>
|
|
16
|
+
<a href="https://github.com/getelena/elena/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="Elena is released under the MIT license." /></a>
|
|
17
|
+
<a href="https://github.com/getelena/elena/actions/workflows/tests.yml"><img src="https://github.com/getelena/elena/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<br/>
|
|
22
|
+
|
|
23
|
+
<p align="center"><strong>@elenajs/components</strong> is an example Progressive Web Component library built with <a href="https://elenajs.com">Elena</a>. It demonstrates Elena’s component patterns and ships with a <a href="https://custom-elements-manifest.open-wc.org/">Custom Elements Manifest</a>, TypeScript declarations, and individual CSS files for each component.</p>
|
|
24
|
+
|
|
25
|
+
<br/>
|
|
26
|
+
|
|
27
|
+
> [!WARNING]
|
|
28
|
+
> Please note that `@elenajs/components` is in active development and the APIs may change without notice.
|
|
29
|
+
|
|
30
|
+
<br/>
|
|
31
|
+
|
|
32
|
+
## Table of contents
|
|
33
|
+
|
|
34
|
+
- **[Install](#install)**
|
|
35
|
+
- **[Usage](#usage)**
|
|
36
|
+
- **[Import all components](#import-all-components)**
|
|
37
|
+
- **[Import individual components](#import-individual-components)**
|
|
38
|
+
- **[Import styles](#import-styles)**
|
|
39
|
+
- **[Available components](#available-components)**
|
|
40
|
+
- **[Button](#button)**
|
|
41
|
+
- **[Stack](#stack)**
|
|
42
|
+
- **[TypeScript](#typescript)**
|
|
43
|
+
- **[Development](#development)**
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install @elenajs/components
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
### Import all components
|
|
54
|
+
|
|
55
|
+
Import the full bundle to register all components at once:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import "@elenajs/components";
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Import individual components
|
|
62
|
+
|
|
63
|
+
Import only the components you need for better tree-shaking:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import "@elenajs/components/dist/button.js";
|
|
67
|
+
import "@elenajs/components/dist/stack.js";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Import styles
|
|
71
|
+
|
|
72
|
+
Each component ships with a matching CSS file. Import the full bundle or individual files:
|
|
73
|
+
|
|
74
|
+
```css
|
|
75
|
+
/* All component styles */
|
|
76
|
+
@import "@elenajs/components/dist/bundle.css";
|
|
77
|
+
|
|
78
|
+
/* Or individual styles */
|
|
79
|
+
@import "@elenajs/components/dist/button.css";
|
|
80
|
+
@import "@elenajs/components/dist/stack.css";
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Available components
|
|
84
|
+
|
|
85
|
+
### Button
|
|
86
|
+
|
|
87
|
+
A **Primitive Component** that renders its own `<button>` element with built-in event delegation and variant styling.
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<elena-button>Click me</elena-button>
|
|
91
|
+
<elena-button variant="primary">Save</elena-button>
|
|
92
|
+
<elena-button variant="danger">Delete</elena-button>
|
|
93
|
+
<elena-button disabled>Disabled</elena-button>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Props
|
|
97
|
+
|
|
98
|
+
| Prop | Type | Default | Description |
|
|
99
|
+
| ---------- | ------------------------------------ | ----------- | ----------------------------------------------- |
|
|
100
|
+
| `variant` | `"default" \| "primary" \| "danger"` | `"default"` | The style variant of the button. |
|
|
101
|
+
| `disabled` | `Boolean` | `false` | Makes the component disabled. |
|
|
102
|
+
| `name` | `string` | `""` | The name used to identify the button in forms. |
|
|
103
|
+
| `value` | `string` | `""` | The value used to identify the button in forms. |
|
|
104
|
+
| `type` | `"submit" \| "reset" \| "button"` | `"button"` | The type of the button. |
|
|
105
|
+
|
|
106
|
+
#### Events
|
|
107
|
+
|
|
108
|
+
| Event | Description |
|
|
109
|
+
| ------- | ------------------------------------- |
|
|
110
|
+
| `click` | Fires when the button is clicked. |
|
|
111
|
+
| `focus` | Fires when the button receives focus. |
|
|
112
|
+
| `blur` | Fires when the button loses focus. |
|
|
113
|
+
|
|
114
|
+
#### CSS custom properties
|
|
115
|
+
|
|
116
|
+
| Property | Description |
|
|
117
|
+
| ----------------------- | --------------------------------------- |
|
|
118
|
+
| `--elena-button-text` | Overrides the default text color. |
|
|
119
|
+
| `--elena-button-bg` | Overrides the default background color. |
|
|
120
|
+
| `--elena-button-font` | Overrides the default font family. |
|
|
121
|
+
| `--elena-button-radius` | Overrides the default border radius. |
|
|
122
|
+
|
|
123
|
+
### Stack
|
|
124
|
+
|
|
125
|
+
A **Composite Component** that manages flexbox layout of its children with optional spacing.
|
|
126
|
+
|
|
127
|
+
```html
|
|
128
|
+
<elena-stack>
|
|
129
|
+
<elena-button>First</elena-button>
|
|
130
|
+
<elena-button>Second</elena-button>
|
|
131
|
+
</elena-stack>
|
|
132
|
+
|
|
133
|
+
<elena-stack direction="row">
|
|
134
|
+
<elena-button>Left</elena-button>
|
|
135
|
+
<elena-button>Right</elena-button>
|
|
136
|
+
</elena-stack>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Props
|
|
140
|
+
|
|
141
|
+
| Prop | Type | Default | Description |
|
|
142
|
+
| ----------- | ------------------- | ---------- | ---------------------------------- |
|
|
143
|
+
| `direction` | `"column" \| "row"` | `"column"` | The direction of the stack layout. |
|
|
144
|
+
|
|
145
|
+
## TypeScript
|
|
146
|
+
|
|
147
|
+
The package ships with TypeScript declarations for JSX integration. To get type checking in your framework:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
// types.d.ts
|
|
151
|
+
import type { CustomElements } from "@elenajs/components";
|
|
152
|
+
|
|
153
|
+
type ElenaIntrinsicElements = {
|
|
154
|
+
[K in keyof CustomElements]: CustomElements[K] & {
|
|
155
|
+
onClick?: (e: MouseEvent) => void;
|
|
156
|
+
onFocus?: (e: FocusEvent) => void;
|
|
157
|
+
onBlur?: (e: FocusEvent) => void;
|
|
158
|
+
children?: React.ReactNode;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
declare module "react" {
|
|
163
|
+
namespace JSX {
|
|
164
|
+
interface IntrinsicElements extends ElenaIntrinsicElements {}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Development
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
pnpm start # Launch dev server with live reload
|
|
173
|
+
pnpm build # Build to dist/ (via elena build)
|
|
174
|
+
pnpm clean # Remove dist/
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
|
180
|
+
|
|
181
|
+
## Copyright
|
|
182
|
+
|
|
183
|
+
Copyright © 2026 [Ariel Salminen](https://arielsalminen.com)
|
package/dist/bundle.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@scope(elena-button){:scope
|
|
1
|
+
@scope(elena-button){:scope,:not(svg,path),:before,:after{all:unset}:scope{--elena-button-bg:#eaecf0;--elena-button-text:#172b4d;--elena-button-border:#eaecf0;--elena-button-font:system-ui, sans-serif;--elena-button-font-size:15px;--elena-button-font-weight:500;--elena-button-radius:6px;--elena-button-focus:#5a44d4;all:unset;border-radius:var(--elena-button-radius);transition:background-color .2s,filter .2s;display:inline-block}:scope:not([hydrated]),.elena-button{-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box;touch-action:manipulation;font-family:inherit;font-weight:var(--elena-button-font-weight);font-family:var(--elena-button-font);font-size:var(--elena-button-font-size);block-size:calc(var(--elena-button-font) * 4);min-block-size:calc(var(--elena-button-font) * 4);color:var(--elena-button-text);background:var(--elena-button-bg);border:2px solid var(--elena-button-border);border-radius:var(--elena-button-radius);text-align:center;justify-content:center;align-items:center;gap:.375rem;padding:.5em 1.1em .55em;line-height:1.3;display:inline-flex}.elena-icon{inline-size:var(--elena-button-font-size);block-size:var(--elena-button-font-size);fill:currentColor;margin-block:.15rem;margin-inline:-.3rem;display:inline-flex;transform:translateZ(0)}span+.elena-icon{margin-inline:0 -.3rem}svg{block-size:100%;inline-size:100%;display:block}:scope[icon]:not([hydrated]):after{content:"";background:var(--elena-button-text);border-radius:var(--elena-button-radius);opacity:.2;width:var(--elena-button-font-size);height:var(--elena-button-font-size);margin-block:.15rem;margin-inline:0 -.3rem;display:inline-block}:scope[icon]:not([hydrated]):empty:after{margin-inline:-.3rem}:scope:hover{filter:brightness(.9)}:scope:active{opacity:.9;transition:none;transform:translateY(1px)}:scope:focus-within{box-shadow:0 0 0 1px #fff, 0 0 0 3px var(--elena-button-focus);outline:none;transition:none}:scope[disabled]{--elena-button-text:#a8b0bd;--elena-button-bg:#f3f4f6;--elena-button-border:#f3f4f6;pointer-events:none}:scope[variant=primary]{--elena-button-bg:#5a44d4;--elena-button-border:#5a44d4;--elena-button-text:#fff}:scope[variant=danger]{--elena-button-bg:#d44444;--elena-button-border:#d44444;--elena-button-text:#fff}:scope[variant=danger]:focus-within{--elena-button-focus:#d44444}:scope[variant=outline]{--elena-button-bg:transparent;--elena-button-text:#172b4d;--elena-button-border:#172b4d}:scope[size=sm]{--elena-button-font-size:12px}:scope:not([hydrated])[size=sm],:scope[size=sm] .elena-button{padding-block:.3em .35em}:scope[size=lg]{--elena-button-font-size:18px}:scope:not([hydrated])[size=lg],:scope[size=lg] .elena-button{padding-block:.6em .65em}:scope[expand],:scope[expand] .elena-button{inline-size:100%}}@scope(elena-stack){:scope{flex-flow:column wrap;justify-content:flex-start;align-items:flex-start;gap:.5rem;display:flex}:scope[direction=row]{flex-direction:row}}
|
package/dist/bundle.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
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],
|
|
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:()=>""},a=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],a=i&&i.__raw,o=a?String(i):s(String(i??""));if(o!==e._tplValues[t])if(e._tplValues[t]=o,a)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=a.get(t);i||(i=Array.from(t,e=>e.replace(/\n\s*/g," ")),a.set(t,i));const o=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,o),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,a=r&&r.props?r.props:[],l=[],h=new Set;for(const e of a)"string"==typeof e?l.push(e):(l.push(e.name),!1===e.reflect&&h.add(e.name));class c 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[...l,"text"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&(o(this,e.strings,e.values),this._hydrated&&(this.element=i(this)))}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)for(const[n,s]of this._props){if(h.has(n))continue;t(this,n,e(typeof s,s,"toAttribute"))}}_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 l.length&&(l.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){for(const i of s){const s=!r||!r.has(i);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)&&(this._props.set(i,n),this.isConnected))if(s){const s=e(typeof n,n,"toAttribute");t(this,i,s)}else this._hydrated&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}})}}(c.prototype,l,h)),r&&r.tagName&&(c._tagName=r.tagName),c.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.")},c}const h={tagName:"elena-button",props:["variant","size","expand","disabled","label","href","target","download","name","value","type",{name:"icon",reflect:!1}],events:["click","focus","blur"]};class c extends(l(HTMLElement,h)){constructor(){super(),this.variant="default",this.size="md",this.expand=!1,this.disabled=!1,this.label="",this.href="",this.target="_self",this.download=!1,this.name="",this.value="",this.type="button",this.icon=""}renderButton(e){return r`<button class="elena-button" type="${this.type}" ${this.name?r`name="${this.name}"`:i} ${this.value?r`value="${this.value}"`:i} ${this.disabled?"disabled":i} ${this.label?r`aria-label="${this.label}"`:i}>${e}</button>`}renderLink(e){return r`<a class="elena-button" href="${this.href}" target="${this.target}" ${this.download?"download":i} ${this.label?r`aria-label="${this.label}"`:i}>${e}</a>`}render(){const e=this.icon?function(e){return{__raw:!0,toString:()=>e??""}}(`<span class="elena-icon">${this.icon}</span>`):i,t=r`
|
|
2
|
+
${this.text?r`<span>${this.text}</span>`:i}
|
|
3
|
+
${e}
|
|
4
|
+
`;return this.href?this.renderLink(t):this.renderButton(t)}}c.define();const u={tagName:"elena-stack",props:["direction"]};class d extends(l(HTMLElement,u)){constructor(){super(),this.direction="column"}}d.define();export{c as Button,d as Stack};
|
|
2
5
|
//# 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/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&&this.element&&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: [\"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,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,CAAYZ,EAAEa,GAAGC,MAAMd,EAAE,CAACe,SAAQ,EAAGC,UAAS,KAAMH,GAAG,GCA4D,SAASZ,EAAEC,GAAG,MAAMD,EAAE,CAAC,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,IAAI,SAAS,IAAI,SAAS,OAAOgB,OAAOf,GAAGgB,QAAQ,WAAWhB,GAAGD,EAAEC,GAAG,CAAC,SAASF,EAAEE,KAAKF,GAAG,MAAMmB,EAAEjB,EAAEkB,OAAO,CAAClB,EAAEiB,EAAEE,KAAK,MAAMC,EAAEtB,EAAEqB,GAAG,OAAOnB,EAAEi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AAEyD,KAAKP,QAAQtC,EAAEQ,EAAE,GAAG,CIAu9CrB,CAAEwD,EAAEsC,UAAUlE,EAAEoC,SAASpC,IAAIA,EAAEuB,WAAWvB,GAAGA,EAAEmE,UAAUvC,EAAEwC,SAASpE,EAAEmE,SAASvC,EAAEyC,OAAO,WAAWvC,KAAKsC,SFA7iF,SAAW9F,EAAED,GAAG,oBAAoBiG,QAAQ,mBAAmBA,SAASA,OAAOC,eAAe9D,IAAInC,IAAIgG,OAAOC,eAAeF,OAAO/F,EAAED,GAAG,CEA86EoB,CAAEqC,KAAKsC,SAAStC,MAAMpD,QAAQC,KAAK,4GAA4G,EAAEiD,CAAC,CCExsF,MAAM4C,EAAU,CACdL,QAAS,eACT/B,MAAO,CAAC,UAAW,WAAY,OAAQ,QAAS,QAChDa,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"}
|
|
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){for(const s of r){const r=!o||!o.has(s);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)&&(this._props.set(s,n),this.isConnected))if(r){const r=e(typeof n,n,\"toAttribute\");t(this,s,r)}else this._hydrated&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}})}}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 r=n.reduce((n,r,o)=>{const i=e[o];return n+r+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>r}}function r(n){return{__raw:!0,toString:()=>n??\"\"}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing,r as unsafeHTML};\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,unsafeHTML}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,a){const l=a&&a.element?/^[a-z][a-z0-9-]*$/i.test(a.element)?e=>e.getElementsByClassName(a.element)[0]:e=>e.querySelector(a.element):e=>e.firstElementChild,d=a&&a.props?a.props:[],m=[],p=new Set;for(const e of d)\"string\"==typeof e?m.push(e):(m.push(e.name),!1===e.reflect&&p.add(e.name));class c 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[...m,\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&(h(this,e.strings,e.values),this._hydrated&&(this.element=l(this)))}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=l(this),this.element||(a&&a.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props)for(const[e,t]of this._props){if(p.has(e))continue;const i=s(typeof t,t,\"toAttribute\");n(this,e,i)}}_delegateEvents(){!this._events&&a&&a.events&&(this.element?(this._events=!0,a.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,a.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){a.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 m.length&&(m.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(c.prototype,m,p)),a&&a.tagName&&(c._tagName=a.tagName),c.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.\")},c}export{o as Elena};\n//# sourceMappingURL=elena.js.map\n","import { Elena, html, unsafeHTML, nothing } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\n \"variant\",\n \"size\",\n \"expand\",\n \"disabled\",\n \"label\",\n \"href\",\n \"target\",\n \"download\",\n \"name\",\n \"value\",\n \"type\",\n { name: \"icon\", reflect: false },\n ],\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\" | \"outline\"}\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 button fit its container.\n *\n * @attribute\n * @type {boolean}\n */\n this.expand = false;\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {boolean}\n */\n this.disabled = false;\n\n /**\n * Sets aria-label for the inner button.\n *\n * @attribute\n * @type {string}\n */\n this.label = \"\";\n\n /**\n * Renders the button as a link and sets a href for it.\n *\n * @attribute\n * @type {string}\n */\n this.href = \"\";\n\n /**\n * Defines where to open the linked URL.\n *\n * @attribute\n * @type {\"_self\" | \"_blank\" | \"_parent\" | \"_top\"}\n */\n this.target = \"_self\";\n\n /**\n * Trigger a file download instead of a page visit.\n *\n * @attribute\n * @type {boolean}\n */\n this.download = 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 * An SVG icon to display inside the button.\n *\n * @attribute\n * @type {string}\n */\n this.icon = \"\";\n }\n\n /**\n * Renders a button: <button>.\n *\n * @internal\n */\n renderButton(template) {\n return html`\n <button\n class=\"elena-button\"\n type=\"${this.type}\"\n ${this.name ? html`name=\"${this.name}\"` : nothing}\n ${this.value ? html`value=\"${this.value}\"` : nothing}\n ${this.disabled ? \"disabled\" : nothing}\n ${this.label ? html`aria-label=\"${this.label}\"` : nothing}\n >\n ${template}\n </button>\n `;\n }\n\n /**\n * Renders a link: <a href=\"#\">.\n *\n * @internal\n */\n renderLink(template) {\n return html`\n <a\n class=\"elena-button\"\n href=\"${this.href}\"\n target=\"${this.target}\"\n ${this.download ? \"download\" : nothing}\n ${this.label ? html`aria-label=\"${this.label}\"` : nothing}\n >\n ${template}\n </a>\n `;\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n const icon = this.icon ? unsafeHTML(`<span class=\"elena-icon\">${this.icon}</span>`) : nothing;\n const markup = html`\n ${this.text ? html`<span>${this.text}</span>` : nothing}\n ${icon}\n `;\n\n return this.href ? this.renderLink(markup) : this.renderButton(markup);\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","r","reduce","o","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","props","m","p","Set","push","name","reflect","add","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","has","_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","size","expand","disabled","label","href","target","download","value","icon","renderButton","template","html","nothing","renderLink","unsafeHTML","markup","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,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,wD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,GACEE,QAQAoD,KAAKgE,UAAY,QACnB,EAMFD,EAAMxB"}
|
package/dist/button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@scope(elena-button){:scope
|
|
1
|
+
@scope(elena-button){:scope,:not(svg,path),:before,:after{all:unset}:scope{--elena-button-bg:#eaecf0;--elena-button-text:#172b4d;--elena-button-border:#eaecf0;--elena-button-font:system-ui, sans-serif;--elena-button-font-size:15px;--elena-button-font-weight:500;--elena-button-radius:6px;--elena-button-focus:#5a44d4;all:unset;border-radius:var(--elena-button-radius);transition:background-color .2s,filter .2s;display:inline-block}:scope:not([hydrated]),.elena-button{-webkit-user-select:none;user-select:none;cursor:pointer;box-sizing:border-box;touch-action:manipulation;font-family:inherit;font-weight:var(--elena-button-font-weight);font-family:var(--elena-button-font);font-size:var(--elena-button-font-size);block-size:calc(var(--elena-button-font) * 4);min-block-size:calc(var(--elena-button-font) * 4);color:var(--elena-button-text);background:var(--elena-button-bg);border:2px solid var(--elena-button-border);border-radius:var(--elena-button-radius);text-align:center;justify-content:center;align-items:center;gap:.375rem;padding:.5em 1.1em .55em;line-height:1.3;display:inline-flex}.elena-icon{inline-size:var(--elena-button-font-size);block-size:var(--elena-button-font-size);fill:currentColor;margin-block:.15rem;margin-inline:-.3rem;display:inline-flex;transform:translateZ(0)}span+.elena-icon{margin-inline:0 -.3rem}svg{block-size:100%;inline-size:100%;display:block}:scope[icon]:not([hydrated]):after{content:"";background:var(--elena-button-text);border-radius:var(--elena-button-radius);opacity:.2;width:var(--elena-button-font-size);height:var(--elena-button-font-size);margin-block:.15rem;margin-inline:0 -.3rem;display:inline-block}:scope[icon]:not([hydrated]):empty:after{margin-inline:-.3rem}:scope:hover{filter:brightness(.9)}:scope:active{opacity:.9;transition:none;transform:translateY(1px)}:scope:focus-within{box-shadow:0 0 0 1px #fff, 0 0 0 3px var(--elena-button-focus);outline:none;transition:none}:scope[disabled]{--elena-button-text:#a8b0bd;--elena-button-bg:#f3f4f6;--elena-button-border:#f3f4f6;pointer-events:none}:scope[variant=primary]{--elena-button-bg:#5a44d4;--elena-button-border:#5a44d4;--elena-button-text:#fff}:scope[variant=danger]{--elena-button-bg:#d44444;--elena-button-border:#d44444;--elena-button-text:#fff}:scope[variant=danger]:focus-within{--elena-button-focus:#d44444}:scope[variant=outline]{--elena-button-bg:transparent;--elena-button-text:#172b4d;--elena-button-border:#172b4d}:scope[size=sm]{--elena-button-font-size:12px}:scope:not([hydrated])[size=sm],:scope[size=sm] .elena-button{padding-block:.3em .35em}:scope[size=lg]{--elena-button-font-size:18px}:scope:not([hydrated])[size=lg],:scope[size=lg] .elena-button{padding-block:.6em .65em}:scope[expand],:scope[expand] .elena-button{inline-size:100%}}
|
package/dist/button.d.ts
CHANGED
|
@@ -2,15 +2,29 @@ export type { ButtonProps } from './custom-elements.js';
|
|
|
2
2
|
|
|
3
3
|
declare class Button extends HTMLElement {
|
|
4
4
|
/** The style variant of the button. */
|
|
5
|
-
variant?: "default" | "primary" | "danger";
|
|
5
|
+
variant?: "default" | "primary" | "danger" | "outline";
|
|
6
|
+
/** The size of the button. */
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
/** Makes the button fit its container. */
|
|
9
|
+
expand?: boolean;
|
|
6
10
|
/** Makes the component disabled. */
|
|
7
11
|
disabled?: boolean;
|
|
12
|
+
/** Sets aria-label for the inner button. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Renders the button as a link and sets a href for it. */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** Defines where to open the linked URL. */
|
|
17
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
18
|
+
/** Trigger a file download instead of a page visit. */
|
|
19
|
+
download?: boolean;
|
|
8
20
|
/** The name used to identify the button in forms. */
|
|
9
21
|
name?: string;
|
|
10
22
|
/** The value used to identify the button in forms. */
|
|
11
23
|
value?: string;
|
|
12
24
|
/** The type of the button. */
|
|
13
25
|
type?: "submit" | "reset" | "button";
|
|
26
|
+
/** An SVG icon to display inside the button. */
|
|
27
|
+
icon?: string;
|
|
14
28
|
/** The text content of the element, captured from light DOM before the first render. */
|
|
15
29
|
text?: string;
|
|
16
30
|
/** Programmatically fire click on the component. */
|
package/dist/button.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import{o as t,e}from"./elena-
|
|
1
|
+
import{o as t,a as e,e as a,r as s}from"./elena-5JTA2VdO.js";const n={tagName:"elena-button",props:["variant","size","expand","disabled","label","href","target","download","name","value","type",{name:"icon",reflect:!1}],events:["click","focus","blur"]};class i extends(t(HTMLElement,n)){constructor(){super(),this.variant="default",this.size="md",this.expand=!1,this.disabled=!1,this.label="",this.href="",this.target="_self",this.download=!1,this.name="",this.value="",this.type="button",this.icon=""}renderButton(t){return a`<button class="elena-button" type="${this.type}" ${this.name?a`name="${this.name}"`:e} ${this.value?a`value="${this.value}"`:e} ${this.disabled?"disabled":e} ${this.label?a`aria-label="${this.label}"`:e}>${t}</button>`}renderLink(t){return a`<a class="elena-button" href="${this.href}" target="${this.target}" ${this.download?"download":e} ${this.label?a`aria-label="${this.label}"`:e}>${t}</a>`}render(){const t=this.icon?s(`<span class="elena-icon">${this.icon}</span>`):e,n=a`
|
|
2
|
+
${this.text?a`<span>${this.text}</span>`:e}
|
|
3
|
+
${t}
|
|
4
|
+
`;return this.href?this.renderLink(n):this.renderButton(n)}}i.define();export{i as default};
|
|
2
5
|
//# 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: [\"variant\"
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../src/button/button.js"],"sourcesContent":["import { Elena, html, unsafeHTML, nothing } from \"@elenajs/core\";\n\nconst options = {\n tagName: \"elena-button\",\n props: [\n \"variant\",\n \"size\",\n \"expand\",\n \"disabled\",\n \"label\",\n \"href\",\n \"target\",\n \"download\",\n \"name\",\n \"value\",\n \"type\",\n { name: \"icon\", reflect: false },\n ],\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\" | \"outline\"}\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 button fit its container.\n *\n * @attribute\n * @type {boolean}\n */\n this.expand = false;\n\n /**\n * Makes the component disabled.\n *\n * @attribute\n * @type {boolean}\n */\n this.disabled = false;\n\n /**\n * Sets aria-label for the inner button.\n *\n * @attribute\n * @type {string}\n */\n this.label = \"\";\n\n /**\n * Renders the button as a link and sets a href for it.\n *\n * @attribute\n * @type {string}\n */\n this.href = \"\";\n\n /**\n * Defines where to open the linked URL.\n *\n * @attribute\n * @type {\"_self\" | \"_blank\" | \"_parent\" | \"_top\"}\n */\n this.target = \"_self\";\n\n /**\n * Trigger a file download instead of a page visit.\n *\n * @attribute\n * @type {boolean}\n */\n this.download = 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 * An SVG icon to display inside the button.\n *\n * @attribute\n * @type {string}\n */\n this.icon = \"\";\n }\n\n /**\n * Renders a button: <button>.\n *\n * @internal\n */\n renderButton(template) {\n return html`\n <button\n class=\"elena-button\"\n type=\"${this.type}\"\n ${this.name ? html`name=\"${this.name}\"` : nothing}\n ${this.value ? html`value=\"${this.value}\"` : nothing}\n ${this.disabled ? \"disabled\" : nothing}\n ${this.label ? html`aria-label=\"${this.label}\"` : nothing}\n >\n ${template}\n </button>\n `;\n }\n\n /**\n * Renders a link: <a href=\"#\">.\n *\n * @internal\n */\n renderLink(template) {\n return html`\n <a\n class=\"elena-button\"\n href=\"${this.href}\"\n target=\"${this.target}\"\n ${this.download ? \"download\" : nothing}\n ${this.label ? html`aria-label=\"${this.label}\"` : nothing}\n >\n ${template}\n </a>\n `;\n }\n\n /**\n * Renders the template.\n *\n * @internal\n */\n render() {\n const icon = this.icon ? unsafeHTML(`<span class=\"elena-icon\">${this.icon}</span>`) : nothing;\n const markup = html`\n ${this.text ? html`<span>${this.text}</span>` : nothing}\n ${icon}\n `;\n\n return this.href ? this.renderLink(markup) : this.renderButton(markup);\n }\n}\n\n/**\n * Register the web component\n */\nButton.define();\n"],"names":["options","tagName","props","name","reflect","events","Button","Elena","HTMLElement","constructor","super","this","variant","size","expand","disabled","label","href","target","download","value","type","icon","renderButton","template","html","nothing","renderLink","render","unsafeHTML","markup","text","define"],"mappings":"6DAEA,MAAMA,EAAU,CACdC,QAAS,eACTC,MAAO,CACL,UACA,OACA,SACA,WACA,QACA,OACA,SACA,WACA,OACA,QACA,OACA,CAAEC,KAAM,OAAQC,SAAS,IAE3BC,OAAQ,CAAC,QAAS,QAAS,SAkBd,MAAMC,UAAeC,EAAMC,YAAaR,IACrD,WAAAS,GACEC,QAQAC,KAAKC,QAAU,UAQfD,KAAKE,KAAO,KAQZF,KAAKG,QAAS,EAQdH,KAAKI,UAAW,EAQhBJ,KAAKK,MAAQ,GAQbL,KAAKM,KAAO,GAQZN,KAAKO,OAAS,QAQdP,KAAKQ,UAAW,EAQhBR,KAAKR,KAAO,GAQZQ,KAAKS,MAAQ,GAQbT,KAAKU,KAAO,SAQZV,KAAKW,KAAO,EACd,CAOA,YAAAC,CAAaC,GACX,OAAOC,CAAI,sCAGCd,KAAKU,SACXV,KAAKR,KAAOsB,CAAI,SAASd,KAAKR,QAAUuB,KACxCf,KAAKS,MAAQK,CAAI,UAAUd,KAAKS,SAAWM,KAC3Cf,KAAKI,SAAW,WAAaW,KAC7Bf,KAAKK,MAAQS,CAAI,eAAed,KAAKK,SAAWU,KAEhDF,YAGR,CAOA,UAAAG,CAAWH,GACT,OAAOC,CAAI,iCAGCd,KAAKM,iBACHN,KAAKO,WACbP,KAAKQ,SAAW,WAAaO,KAC7Bf,KAAKK,MAAQS,CAAI,eAAed,KAAKK,SAAWU,KAEhDF,OAGR,CAOA,MAAAI,GACE,MAAMN,EAAOX,KAAKW,KAAOO,EAAW,4BAA4BlB,KAAKW,eAAiBI,EAChFI,EAASL,CAAI;QACfd,KAAKoB,KAAON,CAAI,SAASd,KAAKoB,cAAgBL;QAC9CJ;MAGJ,OAAOX,KAAKM,KAAON,KAAKgB,WAAWG,GAAUnB,KAAKY,aAAaO,EACjE,EAMFxB,EAAO0B"}
|
|
@@ -62,15 +62,29 @@ type BaseEvents = {};
|
|
|
62
62
|
|
|
63
63
|
export type ButtonProps = {
|
|
64
64
|
/** The style variant of the button. */
|
|
65
|
-
variant?: "default" | "primary" | "danger";
|
|
65
|
+
variant?: "default" | "primary" | "danger" | "outline";
|
|
66
|
+
/** The size of the button. */
|
|
67
|
+
size?: "sm" | "md" | "lg";
|
|
68
|
+
/** Makes the button fit its container. */
|
|
69
|
+
expand?: boolean;
|
|
66
70
|
/** Makes the component disabled. */
|
|
67
71
|
disabled?: boolean;
|
|
72
|
+
/** Sets aria-label for the inner button. */
|
|
73
|
+
label?: string;
|
|
74
|
+
/** Renders the button as a link and sets a href for it. */
|
|
75
|
+
href?: string;
|
|
76
|
+
/** Defines where to open the linked URL. */
|
|
77
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
78
|
+
/** Trigger a file download instead of a page visit. */
|
|
79
|
+
download?: boolean;
|
|
68
80
|
/** The name used to identify the button in forms. */
|
|
69
81
|
name?: string;
|
|
70
82
|
/** The value used to identify the button in forms. */
|
|
71
83
|
value?: string;
|
|
72
84
|
/** The type of the button. */
|
|
73
85
|
type?: "submit" | "reset" | "button";
|
|
86
|
+
/** An SVG icon to display inside the button. */
|
|
87
|
+
icon?: string;
|
|
74
88
|
/** The text content of the element, captured from light DOM before the first render. */
|
|
75
89
|
text?: string;
|
|
76
90
|
|
|
@@ -56,12 +56,32 @@
|
|
|
56
56
|
"kind": "field",
|
|
57
57
|
"name": "variant",
|
|
58
58
|
"type": {
|
|
59
|
-
"text": "\"default\" | \"primary\" | \"danger\""
|
|
59
|
+
"text": "\"default\" | \"primary\" | \"danger\" | \"outline\""
|
|
60
60
|
},
|
|
61
61
|
"description": "The style variant of the button.",
|
|
62
62
|
"default": "\"default\"",
|
|
63
63
|
"attribute": "variant"
|
|
64
64
|
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "field",
|
|
67
|
+
"name": "size",
|
|
68
|
+
"type": {
|
|
69
|
+
"text": "\"sm\" | \"md\" | \"lg\""
|
|
70
|
+
},
|
|
71
|
+
"description": "The size of the button.",
|
|
72
|
+
"default": "\"md\"",
|
|
73
|
+
"attribute": "size"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"kind": "field",
|
|
77
|
+
"name": "expand",
|
|
78
|
+
"type": {
|
|
79
|
+
"text": "boolean"
|
|
80
|
+
},
|
|
81
|
+
"description": "Makes the button fit its container.",
|
|
82
|
+
"default": "false",
|
|
83
|
+
"attribute": "expand"
|
|
84
|
+
},
|
|
65
85
|
{
|
|
66
86
|
"kind": "field",
|
|
67
87
|
"name": "disabled",
|
|
@@ -72,6 +92,46 @@
|
|
|
72
92
|
"default": "false",
|
|
73
93
|
"attribute": "disabled"
|
|
74
94
|
},
|
|
95
|
+
{
|
|
96
|
+
"kind": "field",
|
|
97
|
+
"name": "label",
|
|
98
|
+
"type": {
|
|
99
|
+
"text": "string"
|
|
100
|
+
},
|
|
101
|
+
"description": "Sets aria-label for the inner button.",
|
|
102
|
+
"default": "\"\"",
|
|
103
|
+
"attribute": "label"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"kind": "field",
|
|
107
|
+
"name": "href",
|
|
108
|
+
"type": {
|
|
109
|
+
"text": "string"
|
|
110
|
+
},
|
|
111
|
+
"description": "Renders the button as a link and sets a href for it.",
|
|
112
|
+
"default": "\"\"",
|
|
113
|
+
"attribute": "href"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "field",
|
|
117
|
+
"name": "target",
|
|
118
|
+
"type": {
|
|
119
|
+
"text": "\"_self\" | \"_blank\" | \"_parent\" | \"_top\""
|
|
120
|
+
},
|
|
121
|
+
"description": "Defines where to open the linked URL.",
|
|
122
|
+
"default": "\"_self\"",
|
|
123
|
+
"attribute": "target"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"kind": "field",
|
|
127
|
+
"name": "download",
|
|
128
|
+
"type": {
|
|
129
|
+
"text": "boolean"
|
|
130
|
+
},
|
|
131
|
+
"description": "Trigger a file download instead of a page visit.",
|
|
132
|
+
"default": "false",
|
|
133
|
+
"attribute": "download"
|
|
134
|
+
},
|
|
75
135
|
{
|
|
76
136
|
"kind": "field",
|
|
77
137
|
"name": "name",
|
|
@@ -102,6 +162,16 @@
|
|
|
102
162
|
"default": "\"button\"",
|
|
103
163
|
"attribute": "type"
|
|
104
164
|
},
|
|
165
|
+
{
|
|
166
|
+
"kind": "field",
|
|
167
|
+
"name": "icon",
|
|
168
|
+
"type": {
|
|
169
|
+
"text": "string"
|
|
170
|
+
},
|
|
171
|
+
"description": "An SVG icon to display inside the button.",
|
|
172
|
+
"default": "\"\"",
|
|
173
|
+
"attribute": "icon"
|
|
174
|
+
},
|
|
105
175
|
{
|
|
106
176
|
"kind": "field",
|
|
107
177
|
"name": "text",
|
|
@@ -130,12 +200,30 @@
|
|
|
130
200
|
{
|
|
131
201
|
"name": "variant",
|
|
132
202
|
"type": {
|
|
133
|
-
"text": "\"default\" | \"primary\" | \"danger\""
|
|
203
|
+
"text": "\"default\" | \"primary\" | \"danger\" | \"outline\""
|
|
134
204
|
},
|
|
135
205
|
"description": "The style variant of the button.",
|
|
136
206
|
"default": "\"default\"",
|
|
137
207
|
"fieldName": "variant"
|
|
138
208
|
},
|
|
209
|
+
{
|
|
210
|
+
"name": "size",
|
|
211
|
+
"type": {
|
|
212
|
+
"text": "\"sm\" | \"md\" | \"lg\""
|
|
213
|
+
},
|
|
214
|
+
"description": "The size of the button.",
|
|
215
|
+
"default": "\"md\"",
|
|
216
|
+
"fieldName": "size"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "expand",
|
|
220
|
+
"type": {
|
|
221
|
+
"text": "boolean"
|
|
222
|
+
},
|
|
223
|
+
"description": "Makes the button fit its container.",
|
|
224
|
+
"default": "false",
|
|
225
|
+
"fieldName": "expand"
|
|
226
|
+
},
|
|
139
227
|
{
|
|
140
228
|
"name": "disabled",
|
|
141
229
|
"type": {
|
|
@@ -145,6 +233,42 @@
|
|
|
145
233
|
"default": "false",
|
|
146
234
|
"fieldName": "disabled"
|
|
147
235
|
},
|
|
236
|
+
{
|
|
237
|
+
"name": "label",
|
|
238
|
+
"type": {
|
|
239
|
+
"text": "string"
|
|
240
|
+
},
|
|
241
|
+
"description": "Sets aria-label for the inner button.",
|
|
242
|
+
"default": "\"\"",
|
|
243
|
+
"fieldName": "label"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "href",
|
|
247
|
+
"type": {
|
|
248
|
+
"text": "string"
|
|
249
|
+
},
|
|
250
|
+
"description": "Renders the button as a link and sets a href for it.",
|
|
251
|
+
"default": "\"\"",
|
|
252
|
+
"fieldName": "href"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"name": "target",
|
|
256
|
+
"type": {
|
|
257
|
+
"text": "\"_self\" | \"_blank\" | \"_parent\" | \"_top\""
|
|
258
|
+
},
|
|
259
|
+
"description": "Defines where to open the linked URL.",
|
|
260
|
+
"default": "\"_self\"",
|
|
261
|
+
"fieldName": "target"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "download",
|
|
265
|
+
"type": {
|
|
266
|
+
"text": "boolean"
|
|
267
|
+
},
|
|
268
|
+
"description": "Trigger a file download instead of a page visit.",
|
|
269
|
+
"default": "false",
|
|
270
|
+
"fieldName": "download"
|
|
271
|
+
},
|
|
148
272
|
{
|
|
149
273
|
"name": "name",
|
|
150
274
|
"type": {
|
|
@@ -172,6 +296,15 @@
|
|
|
172
296
|
"default": "\"button\"",
|
|
173
297
|
"fieldName": "type"
|
|
174
298
|
},
|
|
299
|
+
{
|
|
300
|
+
"name": "icon",
|
|
301
|
+
"type": {
|
|
302
|
+
"text": "string"
|
|
303
|
+
},
|
|
304
|
+
"description": "An SVG icon to display inside the button.",
|
|
305
|
+
"default": "\"\"",
|
|
306
|
+
"fieldName": "icon"
|
|
307
|
+
},
|
|
175
308
|
{
|
|
176
309
|
"name": "text",
|
|
177
310
|
"fieldName": "text",
|
|
@@ -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}}function i(e){return{__raw:!0,toString:()=>e??""}}const o={__raw:!0,toString:()=>""},a=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,a=o?String(i):s(String(i??""));if(a!==e._tplValues[t])if(e._tplValues[t]=a,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=a.get(t);i||(i=Array.from(t,e=>e.replace(/\n\s*/g," ")),a.set(t,i));const o=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,o),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 c(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,o=r&&r.props?r.props:[],a=[],c=new Set;for(const e of o)"string"==typeof e?a.push(e):(a.push(e.name),!1===e.reflect&&c.add(e.name));class u 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[...a,"text"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&(l(this,e.strings,e.values),this._hydrated&&(this.element=i(this)))}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)for(const[n,s]of this._props){if(c.has(n))continue;t(this,n,e(typeof s,s,"toAttribute"))}}_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 a.length&&(a.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){for(const i of s){const s=!r||!r.has(i);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)&&(this._props.set(i,n),this.isConnected))if(s){const s=e(typeof n,n,"toAttribute");t(this,i,s)}else this._hydrated&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}})}}(u.prototype,a,c)),r&&r.tagName&&(u._tagName=r.tagName),u.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.")},u}export{o as a,r as e,c as o,i as r};
|
|
2
|
+
//# sourceMappingURL=elena-5JTA2VdO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elena-5JTA2VdO.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){for(const s of r){const r=!o||!o.has(s);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)&&(this._props.set(s,n),this.isConnected))if(r){const r=e(typeof n,n,\"toAttribute\");t(this,s,r)}else this._hydrated&&!this._isRendering&&(this._isRendering=!0,this._applyRender(),this._isRendering=!1)}})}}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 r=n.reduce((n,r,o)=>{const i=e[o];return n+r+(i&&i.__raw?String(i):t(String(i??\"\")))},\"\");return{__raw:!0,strings:n,values:e,toString:()=>r}}function r(n){return{__raw:!0,toString:()=>n??\"\"}}const o={__raw:!0,toString:()=>\"\"};export{n as defineElement,t as escapeHtml,e as html,o as nothing,r as unsafeHTML};\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,unsafeHTML}from\"./utils.js\";import{renderTemplate as h}from\"./render.js\";function o(o,a){const l=a&&a.element?/^[a-z][a-z0-9-]*$/i.test(a.element)?e=>e.getElementsByClassName(a.element)[0]:e=>e.querySelector(a.element):e=>e.firstElementChild,d=a&&a.props?a.props:[],m=[],p=new Set;for(const e of d)\"string\"==typeof e?m.push(e):(m.push(e.name),!1===e.reflect&&p.add(e.name));class c 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[...m,\"text\"]}render(){}_applyRender(){const e=this.render();e&&e.strings&&(h(this,e.strings,e.values),this._hydrated&&(this.element=l(this)))}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=l(this),this.element||(a&&a.element&&console.warn(\"░█ [ELENA]: No element found, using firstElementChild as fallback.\"),this.element=this.firstElementChild))}_flushProps(){if(this._props)for(const[e,t]of this._props){if(p.has(e))continue;const i=s(typeof t,t,\"toAttribute\");n(this,e,i)}}_delegateEvents(){!this._events&&a&&a.events&&(this.element?(this._events=!0,a.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,a.events?.forEach(e=>{this.element?.removeEventListener(e,this)}))}handleEvent(e){a.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 m.length&&(m.includes(\"text\")&&console.warn('░█ [ELENA]: \"text\" is a reserved property. Rename your prop to avoid overriding the built-in text content feature.'),e(c.prototype,m,p)),a&&a.tagName&&(c._tagName=a.tagName),c.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.\")},c}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","r","reduce","o","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","props","m","p","Set","push","name","reflect","add","attributeChangedCallback","this","_hydrated","_isRendering","_applyRender","text","observedAttributes","render","h","connectedCallback","_captureText","_resolveInnerElement","_flushProps","_delegateEvents","updated","_text","queueMicrotask","_props","has","_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,kB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IAAI3B,EAAEX,GAAGgE,KAAKmC,aAAa,GAAGlF,EAAE,CAAC,MAAMA,EAAEnB,SAASE,EAAEA,EAAE,eAAeD,EAAEiE,KAAKrD,EAAEM,EAAE,MAAM+C,KAAKC,YAAYD,KAAKE,eAAeF,KAAKE,cAAa,EAAGF,KAAKG,eAAeH,KAAKE,cAAa,EAAG,GAAG,CAAC,CIA++CpE,CAAEiC,EAAEqE,UAAU5C,EAAEC,IAAI3B,GAAGA,EAAEuE,UAAUtE,EAAEuE,SAASxE,EAAEuE,SAAStE,EAAEwE,OAAO,WAAWvC,KAAKsC,SFA/nF,SAAWtG,EAAED,GAAG,oBAAoByG,QAAQ,mBAAmBA,SAASA,OAAOC,eAAetE,IAAInC,IAAIwG,OAAOC,eAAeF,OAAOvG,EAAED,GAAG,CEAggFkB,CAAE+C,KAAKsC,SAAStC,MAAM5D,QAAQC,KAAK,4GAA4G,EAAE0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as Button}from"./button.js";export{default as Stack}from"./stack.js";import"./elena-
|
|
1
|
+
export{default as Button}from"./button.js";export{default as Stack}from"./stack.js";import"./elena-5JTA2VdO.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/stack.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@scope(elena-stack){:scope
|
|
1
|
+
@scope(elena-stack){:scope{flex-flow:column wrap;justify-content:flex-start;align-items:flex-start;gap:.5rem;display:flex}: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-5JTA2VdO.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.16.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/",
|
|
@@ -28,16 +28,21 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"prebuild": "npm run -s clean",
|
|
31
|
-
"start": "web-dev-server --node-resolve --app-index index.html --open --watch",
|
|
31
|
+
"start": "concurrently -k -n build,serve \"nodemon --watch src -e js,css --exec elena\" \"web-dev-server --node-resolve --app-index index.html --open --watch\"",
|
|
32
32
|
"build": "elena",
|
|
33
|
-
"clean": "rm -rf dist/"
|
|
33
|
+
"clean": "rm -rf dist/",
|
|
34
|
+
"test": "vitest run"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@elenajs/core": "^0.
|
|
37
|
+
"@elenajs/core": "^0.14.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@elenajs/bundler": "^0.
|
|
40
|
-
"@web/dev-server": "0.4.6"
|
|
40
|
+
"@elenajs/bundler": "^0.8.0",
|
|
41
|
+
"@web/dev-server": "0.4.6",
|
|
42
|
+
"concurrently": "9.1.2",
|
|
43
|
+
"happy-dom": "20.7.0",
|
|
44
|
+
"nodemon": "3.1.10",
|
|
45
|
+
"vitest": "4.0.18"
|
|
41
46
|
},
|
|
42
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "c181af0625f691a95a5cb1ef9adb0d7f2c796eae"
|
|
43
48
|
}
|
package/dist/elena-A7IX5lSC.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=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&&this.element&&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-A7IX5lSC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elena-A7IX5lSC.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&&this.element&&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,g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