@3r1s_s/erisui 1.0.5
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/LICENSE +201 -0
- package/README.md +81 -0
- package/dist/erisui.css +1 -0
- package/dist/erisui.js +1060 -0
- package/dist/erisui.mjs +1694 -0
- package/package.json +30 -0
package/dist/erisui.js
ADDED
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
(function(p,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(p=typeof globalThis<"u"?globalThis:p||self,g(p.eui={}))})(this,(function(p){"use strict";class g extends HTMLElement{static get observedAttributes(){return["size","border-radius","name","color"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
2
|
+
<style>
|
|
3
|
+
:host {
|
|
4
|
+
aspect-ratio: 1 / 1;
|
|
5
|
+
width: fit-content;
|
|
6
|
+
|
|
7
|
+
user-select: none;
|
|
8
|
+
-webkit-user-select: none;
|
|
9
|
+
-webkit-user-drag: none;
|
|
10
|
+
-webkit-user-modify: none;
|
|
11
|
+
-webkit-highlight: none;
|
|
12
|
+
-webkit-tap-highlight-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.avatar {
|
|
16
|
+
width: 32px;
|
|
17
|
+
height: 100%;
|
|
18
|
+
aspect-ratio: 1 / 1;
|
|
19
|
+
|
|
20
|
+
border-radius: var(--border-radius, 50%);
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
box-shadow: inset 0 0 0 1px #ffffff25;
|
|
23
|
+
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
background-color: #000;
|
|
28
|
+
color: #fff;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
font-size: 1.2rem;
|
|
31
|
+
text-transform: uppercase;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
::slotted(img) {
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
border-radius: var(--border-radius, 50%);
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
<div class="avatar">
|
|
43
|
+
<slot></slot>
|
|
44
|
+
<span id="initials"></span>
|
|
45
|
+
</div>
|
|
46
|
+
`}connectedCallback(){this.avatar=this.shadowRoot.querySelector(".avatar"),this.initials=this.shadowRoot.querySelector("#initials");const t=this.shadowRoot.querySelector("slot"),i=t&&t.assignedNodes().length>0;if(i){const e=t.assignedNodes()[0];e&&e.tagName==="IMG"&&(this.initials.style.display="none",this.avatar.style.backgroundColor="transparent")}else this.hasAttribute("color")&&(this.avatar.style.backgroundColor=this.getAttribute("color"));if(this.hasAttribute("color")&&(this.avatar.style.backgroundColor=this.getAttribute("color")),this.hasAttribute("size")){const e=this.getAttribute("size");this.avatar.style.width=e+"px",this.avatar.style.height=e+"px",this.initials.style.fontSize=e/2+"px"}if(this.hasAttribute("border-radius")&&(this.avatar.style.borderRadius=this.getAttribute("border-radius")+"px"),this.hasAttribute("name")&&(this.avatar.title=this.getAttribute("name")),!i&&this.hasAttribute("name")){const r=this.getAttribute("name").trim().split(/\s+/);let s="";r.length===1?s=r[0][0]||"":s=(r[0][0]||"")+(r[r.length-1][0]||""),this.initials.textContent=s.toUpperCase()}}}customElements.define("eui-avatar",g);const k=new Map;class C extends HTMLElement{static get observedAttributes(){return["name","width","height"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(t,i,e){i!==e&&this.render()}async render(){const t=this.getAttribute("name");if(!t)return;let i=k.get(t);if(!i)try{const a=await fetch(`/icons/${t}.svg`);if(a.ok)i=await a.text(),k.set(t,i);else{console.error(`Icon "${t}" not found`),this.shadowRoot.innerHTML='<span style="color:red;">?</span>';return}}catch(a){console.error(`Error loading icon "${t}":`,a),this.shadowRoot.innerHTML='<span style="color:red;">?</span>';return}const e=document.createElement("template");e.innerHTML=i.trim();const r=e.content.cloneNode(!0),s=r.firstElementChild;if(s&&s.style){const a=this.getAttribute("width"),l=this.getAttribute("height");a&&s.setAttribute("width",a),l&&s.setAttribute("height",l),s.style.display="block"}this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(r)}}customElements.define("eui-icon",C);class L extends HTMLElement{static get observedAttributes(){return["label","value","id","type","filled"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
47
|
+
<style>
|
|
48
|
+
.form {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: 12px;
|
|
52
|
+
width: 100%;
|
|
53
|
+
max-width: 300px;
|
|
54
|
+
margin: 0.75rem 0;
|
|
55
|
+
position: relative;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.form-input {
|
|
59
|
+
padding: 5px 10px;
|
|
60
|
+
border-radius: 5px;
|
|
61
|
+
width: 100%;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
font-size: 1em;
|
|
64
|
+
font-family: inherit;
|
|
65
|
+
height: 52px;
|
|
66
|
+
background: var(--app-100, #111);
|
|
67
|
+
outline: none;
|
|
68
|
+
border: 1px solid var(--app-300, #2196F3);
|
|
69
|
+
caret-color: var(--app-text);
|
|
70
|
+
color: var(--app-text);
|
|
71
|
+
transition: border .15s ease-out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.filled.form .form-input {
|
|
75
|
+
background: var(--app-200, #222);
|
|
76
|
+
padding-bottom: 0;
|
|
77
|
+
padding-top: 0.6rem;
|
|
78
|
+
border: none;
|
|
79
|
+
border-bottom-left-radius: 0;
|
|
80
|
+
border-bottom-right-radius: 0;
|
|
81
|
+
border-bottom: 1px solid var(--app-300, #333);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.form-input:focus {
|
|
85
|
+
border: 1px solid var(--app-blue, #2196F3);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.filled.form .form-input:focus {
|
|
89
|
+
border-bottom: 2.5px solid var(--app-blue, #2196F3);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.form {
|
|
93
|
+
--form-inactive-top: 14.5px;
|
|
94
|
+
--form-inactive-left: 6px;
|
|
95
|
+
|
|
96
|
+
--form-active-top: -10px;
|
|
97
|
+
--form-active-left: 5px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.filled.form {
|
|
101
|
+
--form-active-top: 3px;
|
|
102
|
+
--form-active-left: 6px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.form label {
|
|
106
|
+
transition: all .15s ease-out;
|
|
107
|
+
color: var(--app-400, #999);
|
|
108
|
+
background: var(--app-100, #111);
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
display: block;
|
|
111
|
+
padding: 0 .25rem;
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: var(--form-inactive-left);
|
|
114
|
+
top: var(--form-inactive-top);
|
|
115
|
+
border-radius: 5px;
|
|
116
|
+
width: fit-content;
|
|
117
|
+
|
|
118
|
+
user-select: none;
|
|
119
|
+
-webkit-user-select: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.filled.form label {
|
|
123
|
+
background: transparent;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.form-input:focus+label,
|
|
127
|
+
.form-input:not(:placeholder-shown)+label,
|
|
128
|
+
.form-input.filled+label,
|
|
129
|
+
.form.always-active label {
|
|
130
|
+
top: var(--form-active-top);
|
|
131
|
+
left: var(--form-active-left);
|
|
132
|
+
font-size: .75em;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.form-input:focus+label {
|
|
136
|
+
font-weight: 600;
|
|
137
|
+
color: var(--app-blue, #2196F3);
|
|
138
|
+
width: auto;
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
141
|
+
|
|
142
|
+
<div class="form">
|
|
143
|
+
<input class="form-input" placeholder=" ">
|
|
144
|
+
<label></label>
|
|
145
|
+
</div>
|
|
146
|
+
`}connectedCallback(){this.form=this.shadowRoot.querySelector(".form"),this.inputEl=this.shadowRoot.querySelector(".form-input"),this.labelEl=this.shadowRoot.querySelector("label"),this.hasAttribute("value")&&(this.inputEl.value=this.getAttribute("value")),this.hasAttribute("id")&&(this.inputEl.id=this.getAttribute("id")),this.hasAttribute("label")&&(this.labelEl.textContent=this.getAttribute("label")),this.hasAttribute("type")&&(this.inputEl.type=this.getAttribute("type")),this.hasAttribute("filled")&&this.form.classList.add("filled"),this.inputEl.addEventListener("input",()=>{this.setAttribute("value",this.inputEl.value)})}attributeChangedCallback(t,i,e){if(!(!this.inputEl||!this.labelEl))switch(t){case"value":this.inputEl.value!==e&&(this.inputEl.value=e);break;case"id":this.inputEl.id=e;break;case"label":this.labelEl.textContent=e;break}}get value(){return this.inputEl.value}set value(t){this.setAttribute("value",t)}}customElements.define("eui-input",L);class T extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
147
|
+
<style>
|
|
148
|
+
.loader {
|
|
149
|
+
width: 24px;
|
|
150
|
+
height: 24px;
|
|
151
|
+
display: inline-block;
|
|
152
|
+
position: relative;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.loader-icon {
|
|
156
|
+
stroke: var(--app-accent, #2196F3);
|
|
157
|
+
fill: none;
|
|
158
|
+
stroke-width: 2px;
|
|
159
|
+
stroke-linecap: round;
|
|
160
|
+
transform-origin: 50% 50%;
|
|
161
|
+
transform: rotate(-90deg);
|
|
162
|
+
transition: all 0.2s ease-in-out 0s;
|
|
163
|
+
animation: 2s linear 0s infinite normal none running loader-spin;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.loader-icon {
|
|
167
|
+
stroke: var(--app-text, #F2F3F6);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@keyframes loader-spin {
|
|
171
|
+
0% {
|
|
172
|
+
stroke-dasharray: 0.01px, 43.97px;
|
|
173
|
+
transform: rotate(0deg)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
50% {
|
|
177
|
+
stroke-dasharray: 21.99px, 21.99px;
|
|
178
|
+
transform: rotate(450deg)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
100% {
|
|
182
|
+
stroke-dasharray: 0.01px, 43.97px;
|
|
183
|
+
transform: rotate(1080deg)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
187
|
+
|
|
188
|
+
<span class="loader animate">
|
|
189
|
+
<svg viewBox="0 0 16 16"><circle class="loader-icon" cx="8px" cy="8px" r="7px"></circle></svg>
|
|
190
|
+
</span>
|
|
191
|
+
`}}customElements.define("eui-loader",T);class M extends HTMLElement{static get observedAttributes(){return["value","intermediate","id"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
192
|
+
<style>
|
|
193
|
+
.progressbar {
|
|
194
|
+
width: 100%;
|
|
195
|
+
height: 5px;
|
|
196
|
+
overflow: hidden;
|
|
197
|
+
position: relative;
|
|
198
|
+
background: var(--app-300, #333);
|
|
199
|
+
border-radius: 4px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.progress {
|
|
203
|
+
display: block;
|
|
204
|
+
height: 100%;
|
|
205
|
+
background: var(--app-accent, #2196F3);
|
|
206
|
+
border-radius: 4px;
|
|
207
|
+
transition: width 0.3s ease-in-out;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.progress.intermediate {
|
|
211
|
+
height: 100%;
|
|
212
|
+
transform-origin: 0% 50%;
|
|
213
|
+
transition-property: background;
|
|
214
|
+
animation: progressbar-indeterminate 1s infinite linear;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@keyframes progressbar-indeterminate {
|
|
218
|
+
0% {
|
|
219
|
+
transform: translateX(0) scaleX(0)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
40% {
|
|
223
|
+
transform: translateX(0) scaleX(0.5)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
100% {
|
|
227
|
+
transform: translateX(100%) scaleX(0.3)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
</style>
|
|
231
|
+
|
|
232
|
+
<div class="progressbar">
|
|
233
|
+
<span class="progress"></span>
|
|
234
|
+
</div>
|
|
235
|
+
`}set value(t){this.setAttribute("value",t)}attributeChangedCallback(){this.connectedCallback()}connectedCallback(){const t=this.shadowRoot.querySelector(".progress");this.hasAttribute("id")&&(this.progress.id=this.getAttribute("id")),this.hasAttribute("intermediate")&&t.classList.add("intermediate"),this.hasAttribute("value")&&(t.style.width=this.getAttribute("value")+"%")}}customElements.define("eui-progressbar",M);const m={is:{iPhone:/iPhone/.test(navigator.userAgent),iPad:/iPad/.test(navigator.userAgent),iOS:/iPhone|iPad|iPod/.test(navigator.userAgent),android:/Android/.test(navigator.userAgent),mobile:/Mobi|Android/i.test(navigator.userAgent)},prefers:{language:navigator.language||navigator.userLanguage,reducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches,reducedTransparency:window.matchMedia("(prefers-reduced-transparency: reduce)").matches},supports:{share:typeof navigator.share=="function",directDownload:"download"in document.createElement("a"),haptics:"vibrate"in navigator||"Vibrate"in window||typeof window.navigator.vibrate=="function"},userAgent:navigator.userAgent},z=Object.freeze(Object.defineProperty({__proto__:null,device:m},Symbol.toStringTag,{value:"Module"}));function R(){try{const o=document.createElement("label");o.ariaHidden="true",o.style.display="none";const t=document.createElement("input");t.type="checkbox",t.setAttribute("switch",""),o.appendChild(t),document.head.appendChild(o),o.click(),document.head.removeChild(o)}catch{}}function v(o){m.supports.haptics?navigator.vibrate(o||50):m.is.iPhone&&R()}const $=Object.freeze(Object.defineProperty({__proto__:null,haptic:v},Symbol.toStringTag,{value:"Module"})),E=(()=>{let o={},t;try{o=JSON.parse(localStorage.getItem(t)||"{}")}catch(i){console.error(i)}return{get(i){return o[i]},set(i,e){o[i]=e,localStorage.setItem(t,JSON.stringify(o))},delete(i){delete o[i],localStorage.setItem(t,JSON.stringify(o))},all(){return o},clear(){o={},localStorage.setItem(t,JSON.stringify(o))},name(i){t=i;try{o=JSON.parse(localStorage.getItem(t)||"{}")}catch(e){console.error(e)}},settings:{get(i){return o&&o.settings&&o.settings[i]},set(i,e){o.settings||(o.settings={}),o.settings[i]=e,localStorage.setItem(t,JSON.stringify(o))},delete(i){o.settings&&(delete o.settings[i],localStorage.setItem(t,JSON.stringify(o)))},all(){return o.settings||{}},clear(){o.settings&&(o.settings={},localStorage.setItem(t,JSON.stringify(o)))}}}})(),A=E.settings,H=Object.freeze(Object.defineProperty({__proto__:null,settings:A,storage:E},Symbol.toStringTag,{value:"Module"}));class _ extends HTMLElement{static get observedAttributes(){return["selected"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
236
|
+
<style>
|
|
237
|
+
.switch {
|
|
238
|
+
background-color: var(--app-200);
|
|
239
|
+
border-radius: 16px;
|
|
240
|
+
|
|
241
|
+
box-shadow: inset 0px 0px 0px 2px var(--app-400);
|
|
242
|
+
width: 52px;
|
|
243
|
+
height: 32px;
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
justify-content: center;
|
|
247
|
+
cursor: pointer;
|
|
248
|
+
position: relative;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.switch.selected {
|
|
252
|
+
background-color: #B8C4FF;
|
|
253
|
+
box-shadow: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.handle {
|
|
257
|
+
width: 16px;
|
|
258
|
+
height: 16px;
|
|
259
|
+
border-radius: 50%;
|
|
260
|
+
background-color: var(--app-900);
|
|
261
|
+
margin-inline-start: 0;
|
|
262
|
+
margin-inline-end: calc(52px - 32px);
|
|
263
|
+
|
|
264
|
+
transition: margin 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
|
|
265
|
+
width 250ms cubic-bezier(0.2, 0, 0, 1),
|
|
266
|
+
height 250ms cubic-bezier(0.2, 0, 0, 1);
|
|
267
|
+
|
|
268
|
+
pointer-events: none;
|
|
269
|
+
user-select: none;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.switch.selected .handle {
|
|
273
|
+
background-color: #5F7AFF;
|
|
274
|
+
margin-inline-start: calc(52px - 32px);
|
|
275
|
+
margin-inline-end: 0;
|
|
276
|
+
width: 24px;
|
|
277
|
+
height: 24px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.switch:active .handle {
|
|
281
|
+
width: 28px;
|
|
282
|
+
height: 28px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
input {
|
|
286
|
+
appearance: none;
|
|
287
|
+
opacity: 0;
|
|
288
|
+
height: max(100%, var(--eui-switch-touch-target-size, 48px));
|
|
289
|
+
width: max(100%, var(--eui-switch-touch-target-size, 48px));
|
|
290
|
+
position: absolute;
|
|
291
|
+
margin: 0;
|
|
292
|
+
cursor: inherit;
|
|
293
|
+
top: 50%;
|
|
294
|
+
left: 50%;
|
|
295
|
+
transform: translate(-50%, -50%);
|
|
296
|
+
z-index: 2;
|
|
297
|
+
}
|
|
298
|
+
</style>
|
|
299
|
+
|
|
300
|
+
<div class="switch">
|
|
301
|
+
<input type="checkbox" role="switch">
|
|
302
|
+
<span class="handle"></span>
|
|
303
|
+
</div>
|
|
304
|
+
`}connectedCallback(){this.inputEl=this.shadowRoot.querySelector("input"),this.switchEl=this.shadowRoot.querySelector(".switch"),this.updateFromAttribute(),this.switchEl.addEventListener("click",()=>this.toggle())}toggle(){this.selected=!this.selected,v()}updateFromAttribute(){const t=this.hasAttribute("selected");this.inputEl.checked=t,this.switchEl.classList.toggle("selected",t)}attributeChangedCallback(t,i,e){t==="selected"&&this.inputEl&&this.updateFromAttribute()}get selected(){return this.hasAttribute("selected")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}}customElements.define("eui-switch",_);class I extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML=`
|
|
305
|
+
<style>
|
|
306
|
+
:host {
|
|
307
|
+
display: inline-flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
gap: 4px;
|
|
310
|
+
padding: 4px 8px;
|
|
311
|
+
border-radius: 8px;
|
|
312
|
+
border: 2px solid var(--app-400);
|
|
313
|
+
font-weight: 500;
|
|
314
|
+
font-size: 1rem;
|
|
315
|
+
position: relative;
|
|
316
|
+
color: var(--app-text);
|
|
317
|
+
overflow: hidden;
|
|
318
|
+
z-index: 1;
|
|
319
|
+
|
|
320
|
+
user-select: none;
|
|
321
|
+
-webkit-user-select: none;
|
|
322
|
+
-webkit-user-drag: none;
|
|
323
|
+
-webkit-user-modify: none;
|
|
324
|
+
-webkit-highlight: none;
|
|
325
|
+
-webkit-tap-highlight-color: transparent;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.ripple {
|
|
329
|
+
position: absolute;
|
|
330
|
+
border-radius: 50%;
|
|
331
|
+
transform: scale(0);
|
|
332
|
+
filter: blur(4px);
|
|
333
|
+
opacity: 0.2;
|
|
334
|
+
animation: ripple 600ms linear;
|
|
335
|
+
background-color: var(--app-400);
|
|
336
|
+
pointer-events: none;
|
|
337
|
+
z-index: -1;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
@keyframes ripple {
|
|
341
|
+
to {
|
|
342
|
+
transform: scale(4);
|
|
343
|
+
opacity: 0;
|
|
344
|
+
filter: blur(10px);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
</style>
|
|
348
|
+
<slot></slot>
|
|
349
|
+
`,this.addEventListener("pointerdown",t=>{const i=document.createElement("span"),e=t.currentTarget,r=Math.max(e.offsetWidth,e.offsetHeight);i.classList.add("ripple"),i.style.left=t.clientX-e.getBoundingClientRect().left-r/2+"px",i.style.top=t.clientY-e.getBoundingClientRect().top-r/2+"px",i.style.width=r+"px",i.style.height=r+"px",this.shadowRoot.appendChild(i),setTimeout(()=>{i.remove()},600)})}}customElements.define("eui-chip",I);const f="",x=(()=>{const o=[];function t(n,d){const h=[],b=n.replace(/:([^/]+)/g,(w,y)=>(h.push(y),"([^/]+)")).replace(/\//g,"\\/"),u=new RegExp(`^${f}${b}$`);o.push({regex:u,paramNames:h,renderFn:d})}function i(n){for(const{regex:d,paramNames:h,renderFn:b}of o){const u=n.match(d);if(u){const w={};return h.forEach((y,K)=>{w[y]=decodeURIComponent(u[K+1])}),{renderFn:b,params:w}}}return null}function e(n,d=!0){n.startsWith(f)||(n=f+(n.startsWith("/")?"":"/")+n);const h=n.split(/[?#]/)[0];if(h===window.location.pathname&&n.includes("#")){d&&history.pushState({},"",n);const u="#"+n.split("#")[1];r(u);return}const b=i(h);if(b)if(d&&history.pushState({},"",n),b.renderFn(b.params),window.dispatchEvent(new CustomEvent("route-changed",{detail:{path:n}})),n.includes("#")){const u="#"+n.split("#")[1];setTimeout(()=>r(u),100)}else{const u=document.getElementById("main");u&&u.scrollTo(0,0)}else s?(d&&history.pushState({},"",n),s()):console.warn(`No route found for ${h}`)}function r(n){if(n)try{const d=document.querySelector(n);d&&d.scrollIntoView({behavior:"smooth"})}catch{console.warn("Invalid hash:",n)}}let s=null;function a(n){s=n}function l(){history.back()}function c(){return window.location.pathname.replace(f,"")||"/"}return window.addEventListener("popstate",()=>{const n=window.location.pathname+window.location.search+window.location.hash;e(n,!1)}),window.addEventListener("click",n=>{if(n.button!==0||n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)return;const d=n.target.closest("a");if(!d||d.hasAttribute("download")||d.getAttribute("target")==="_blank")return;const h=d.getAttribute("href");if(!(!h||h.startsWith("http")&&!h.startsWith(window.location.origin))){if(n.preventDefault(),h.startsWith("#")){history.pushState({},"",h),r(h);return}e(h)}}),{add:t,navigate:e,back:l,location:c,setNotFound:a}})();async function F(o){try{const t=document.getElementById("main");t.classList.add("fade-out"),await new Promise(e=>setTimeout(e,200));const i=await fetch(`/src/pages/${o}.html`).then(e=>e.text());t.innerHTML=i,t.classList.remove("fade-out"),t.classList.add("fade-in"),window.location.hash?setTimeout(()=>{try{const e=document.querySelector(window.location.hash);e&&e.scrollIntoView({behavior:"smooth"})}catch{}},100):t&&t.scrollTo(0,0),setTimeout(()=>{t.classList.remove("fade-in")},200)}catch(t){console.error("Page load failed:",t)}}class q extends HTMLElement{static get observedAttributes(){return["path","icon","label","badge","active","avatar-src","avatar-name"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.hasRendered||(this.render(),this.setupEventListeners(),this.hasRendered=!0),this.updateContent(),this.addEventListener("click",this.handleClick)}disconnectedCallback(){this.removeEventListener("click",this.handleClick)}attributeChangedCallback(t,i,e){if(i!==e&&this.hasRendered){if(t==="active")return;this.updateContent()}}handleClick=()=>{const t=this.getAttribute("path");t&&x.navigate(t)};setupEventListeners(){this.addEventListener("pointerdown",t=>{const i=document.createElement("span"),e=t.currentTarget,r=e.getBoundingClientRect(),s=Math.max(e.offsetWidth,e.offsetHeight),a=s/2;i.classList.add("ripple"),i.style.width=`${s}px`,i.style.height=`${s}px`,i.style.left=`${t.clientX-r.left-a}px`,i.style.top=`${t.clientY-r.top-a}px`,this.shadowRoot.appendChild(i),i.addEventListener("animationend",()=>{i.remove()})})}updateContent(){const t=this.getAttribute("icon"),i=this.getAttribute("avatar-src"),e=this.getAttribute("avatar-name"),r=this.getAttribute("label")||"",s=this.getAttribute("badge"),a=this.shadowRoot.querySelector(".badge");if(s)if(a)a.textContent=s;else{const n=document.createElement("span");n.className="badge",n.textContent=s,this.shadowRoot.appendChild(n)}else a&&a.remove();const l=this.shadowRoot.querySelector("slot[name='icon']");if(l)if(i||e){let n='<eui-avatar size="24"';e&&(n+=` name="${e}"`),n+=">",i&&(n+=`<img src="${i}" alt="${e||"Avatar"}" />`),n+="</eui-avatar>",l.innerHTML=n}else{const n=l.querySelector("eui-icon");t&&n?n.getAttribute("name")!==t&&n.setAttribute("name",t):t?l.innerHTML=`<eui-icon width="24" height="24" name="${t}"></eui-icon>`:l.innerHTML=""}const c=this.shadowRoot.querySelector(".label");c&&(c.textContent=r)}render(){this.shadowRoot.innerHTML=`
|
|
350
|
+
<style>
|
|
351
|
+
:host {
|
|
352
|
+
position: relative;
|
|
353
|
+
overflow: hidden;
|
|
354
|
+
z-index: 1;
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
height: 50px;
|
|
358
|
+
width: 100%;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
border-radius: 100px;
|
|
361
|
+
justify-content: flex-start;
|
|
362
|
+
padding: 0 1rem;
|
|
363
|
+
box-sizing: border-box;
|
|
364
|
+
transition: background-color 0.2s cubic-bezier(.4, 0, .2, 1), transform 0.2s cubic-bezier(.4, 0, .2, 1);
|
|
365
|
+
user-select: none;
|
|
366
|
+
-webkit-user-select: none;
|
|
367
|
+
color: var(--app-text);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
:host(:hover) {
|
|
371
|
+
background-color: var(--app-300);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:host(:focus-visible) {
|
|
375
|
+
outline: 2px solid var(--app-link);
|
|
376
|
+
outline-offset: 2px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
:host([active]) {
|
|
380
|
+
background-color: color-mix(in srgb, var(--app-link) 25%, transparent 100%);
|
|
381
|
+
color: var(--app-link);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
:host([active]) .label {
|
|
385
|
+
font-weight: 600;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.icon-container {
|
|
389
|
+
display: flex;
|
|
390
|
+
align-items: center;
|
|
391
|
+
justify-content: center;
|
|
392
|
+
width: 28px;
|
|
393
|
+
height: 28px;
|
|
394
|
+
flex-shrink: 0;
|
|
395
|
+
border-radius: 100px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
:host([active]) .icon-container eui-avatar {
|
|
399
|
+
outline: 2px solid var(--app-link);
|
|
400
|
+
outline-offset: 1px;
|
|
401
|
+
border-radius: 50%;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.label {
|
|
405
|
+
opacity: var(--nav-item-label-opacity, 0);
|
|
406
|
+
margin-left: 1rem;
|
|
407
|
+
display: block;
|
|
408
|
+
transition: opacity 0.1s ease;
|
|
409
|
+
white-space: nowrap;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.badge {
|
|
413
|
+
position: absolute;
|
|
414
|
+
top: 4px;
|
|
415
|
+
left: calc(32px + 2px);
|
|
416
|
+
width: 20px;
|
|
417
|
+
height: 20px;
|
|
418
|
+
border-radius: 50%;
|
|
419
|
+
background-color: var(--app-red);
|
|
420
|
+
color: var(--app-white);
|
|
421
|
+
display: flex;
|
|
422
|
+
align-items: center;
|
|
423
|
+
justify-content: center;
|
|
424
|
+
font-size: 14px;
|
|
425
|
+
font-weight: 600;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.ripple {
|
|
429
|
+
position: absolute;
|
|
430
|
+
border-radius: 50%;
|
|
431
|
+
transform: scale(0);
|
|
432
|
+
opacity: 0.2;
|
|
433
|
+
animation: ripple 600ms linear forwards;
|
|
434
|
+
background-color: currentColor;
|
|
435
|
+
pointer-events: none;
|
|
436
|
+
z-index: -1;
|
|
437
|
+
will-change: transform, opacity;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
@keyframes ripple {
|
|
441
|
+
to {
|
|
442
|
+
transform: scale(4);
|
|
443
|
+
opacity: 0;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
</style>
|
|
447
|
+
|
|
448
|
+
<div class="icon-container">
|
|
449
|
+
<slot name="icon">
|
|
450
|
+
<eui-icon width="24" height="24" name=""></eui-icon>
|
|
451
|
+
</slot>
|
|
452
|
+
</div>
|
|
453
|
+
<span class="label"></span>
|
|
454
|
+
`}}customElements.define("eui-nav-item",q);class j extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.updateActiveState(),window.addEventListener("popstate",()=>this.updateActiveState()),window.addEventListener("route-changed",()=>this.updateActiveState()),window.addEventListener("toggle-nav",()=>this.classList.toggle("expanded"))}render(){this.shadowRoot.innerHTML=`
|
|
455
|
+
<style>
|
|
456
|
+
:host {
|
|
457
|
+
position: fixed;
|
|
458
|
+
top: var(--titlebar-height, 65px);
|
|
459
|
+
left: 0;
|
|
460
|
+
height: calc(100% - var(--titlebar-height, 65px));
|
|
461
|
+
z-index: 100;
|
|
462
|
+
|
|
463
|
+
width: var(--nav-width, 75px);
|
|
464
|
+
transition: width 0.2s cubic-bezier(0.2, 0, 0, 1);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
:host(.expanded) {
|
|
468
|
+
width: var(--nav-expanded-width, 250px);
|
|
469
|
+
--nav-item-label-opacity: 1;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.app-nav-container {
|
|
473
|
+
width: 100%;
|
|
474
|
+
height: 100%;
|
|
475
|
+
box-sizing: border-box;
|
|
476
|
+
background-color: var(--app-200);
|
|
477
|
+
overflow-x: hidden;
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: column;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.nav-items {
|
|
483
|
+
display: flex;
|
|
484
|
+
flex-direction: column;
|
|
485
|
+
gap: 0.5rem;
|
|
486
|
+
padding: 0.5rem;
|
|
487
|
+
box-sizing: border-box;
|
|
488
|
+
overflow-y: auto;
|
|
489
|
+
overflow-x: hidden;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.menu-button {
|
|
493
|
+
border: none;
|
|
494
|
+
background-color: transparent;
|
|
495
|
+
cursor: pointer;
|
|
496
|
+
width: 42px;
|
|
497
|
+
height: 42px;
|
|
498
|
+
display: flex;
|
|
499
|
+
align-items: center;
|
|
500
|
+
justify-content: center;
|
|
501
|
+
box-sizing: border-box;
|
|
502
|
+
border-radius: 50%;
|
|
503
|
+
color: inherit;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.menu-button:hover {
|
|
507
|
+
background-color: var(--app-300);
|
|
508
|
+
box-shadow: 0 0 2px 0 #00000011;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.menu-button:active {
|
|
512
|
+
transform: scale(0.95);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.menu-button:focus-visible {
|
|
516
|
+
outline: 2px solid var(--app-link);
|
|
517
|
+
outline-offset: 2px;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
#skip_navigation_link {
|
|
521
|
+
position: fixed;
|
|
522
|
+
top: -100px;
|
|
523
|
+
left: -100px;
|
|
524
|
+
z-index: 1001;
|
|
525
|
+
width: 1px;
|
|
526
|
+
height: 1px;
|
|
527
|
+
overflow: hidden;
|
|
528
|
+
clip: rect(0, 0, 0, 0);
|
|
529
|
+
border: 0;
|
|
530
|
+
padding: 0;
|
|
531
|
+
margin: 0;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
#skip_navigation_link:focus {
|
|
535
|
+
top: 0;
|
|
536
|
+
left: 0;
|
|
537
|
+
overflow: visible;
|
|
538
|
+
clip: auto;
|
|
539
|
+
border: 1px dotted;
|
|
540
|
+
padding: 4px 8px;
|
|
541
|
+
margin: 4px;
|
|
542
|
+
width: 80px;
|
|
543
|
+
height: auto;
|
|
544
|
+
background-color: var(--app-link);
|
|
545
|
+
color: var(--app-white);
|
|
546
|
+
text-align: center;
|
|
547
|
+
}
|
|
548
|
+
</style>
|
|
549
|
+
|
|
550
|
+
<div class="app-nav-container">
|
|
551
|
+
<a href="#content" id="skip_navigation_link">Skip To Content</a>
|
|
552
|
+
<div class="nav-items">
|
|
553
|
+
${this.navItems.map(t=>{if(t.type==="divider")return'<div style="height: 1px; background: var(--app-300); margin: 0.5rem 0;"></div>';const i=t.avatar?.src||"",e=t.avatar?.name||"";return`<eui-nav-item path="${t.path}" icon="${t.icon}" avatar-src="${i}" avatar-name="${e}" label="${t.label}"></eui-nav-item>`}).join("")}
|
|
554
|
+
</div>
|
|
555
|
+
</div>
|
|
556
|
+
`}set navItems(t){this._navItems=t,this.render(),this.updateActiveState()}get navItems(){return this._navItems||[]}updateActiveState(t){t||(t=x.location()),t.startsWith("/")||(t="/"+t),this.shadowRoot.querySelectorAll("eui-nav-item").forEach(e=>{e.getAttribute("path")===t?e.setAttribute("active",""):e.removeAttribute("active")})}}customElements.define("eui-app-nav",j);class N extends HTMLElement{static get observedAttributes(){return["type","title","subtitle","img"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
557
|
+
<style>
|
|
558
|
+
:host {
|
|
559
|
+
border-radius: 24px;
|
|
560
|
+
background: var(--app-200, #111);
|
|
561
|
+
color: var(--app-text, #FFF);
|
|
562
|
+
overflow: hidden;
|
|
563
|
+
display: block;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.header {
|
|
567
|
+
min-height: 180px;
|
|
568
|
+
display: flex;
|
|
569
|
+
flex-direction: column;
|
|
570
|
+
justify-content: center;
|
|
571
|
+
padding: 48px;
|
|
572
|
+
box-sizing: border-box;
|
|
573
|
+
position: relative;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.hero {
|
|
577
|
+
min-height: 280px;
|
|
578
|
+
display: flex;
|
|
579
|
+
flex-direction: column;
|
|
580
|
+
justify-content: flex-end;
|
|
581
|
+
color: #fff;
|
|
582
|
+
background: #333;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.img {
|
|
586
|
+
position: absolute;
|
|
587
|
+
inset: 0;
|
|
588
|
+
background-size: cover;
|
|
589
|
+
background-position: center;
|
|
590
|
+
z-index: 0;
|
|
591
|
+
opacity: .5;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.content {
|
|
595
|
+
position: relative;
|
|
596
|
+
z-index: 1;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
h1 {
|
|
600
|
+
margin: 0 0 8px;
|
|
601
|
+
font-size: 3rem;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.large h1, .hero h1 {
|
|
605
|
+
font-size: 5.5rem;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.small h1 {
|
|
609
|
+
font-size: 2rem;
|
|
610
|
+
margin: 0;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.small p {
|
|
614
|
+
margin: 0;
|
|
615
|
+
}
|
|
616
|
+
</style>
|
|
617
|
+
|
|
618
|
+
<div class="header">
|
|
619
|
+
<div class="img"></div>
|
|
620
|
+
<div class="content">
|
|
621
|
+
<h1></h1>
|
|
622
|
+
<p></p>
|
|
623
|
+
</div>
|
|
624
|
+
</div>
|
|
625
|
+
`}connectedCallback(){this.hd=this.shadowRoot.querySelector(".header"),this.hasAttribute("type")&&this.hd.classList.add(this.getAttribute("type"))}attributeChangedCallback(t,i,e){const r=this.shadowRoot.querySelector("h1"),s=this.shadowRoot.querySelector("p"),a=this.shadowRoot.querySelector(".img");t==="title"&&(r.textContent=e),t==="subtitle"&&(s.textContent=e),t==="img"&&(a.style.backgroundImage=e?`url(${e})`:"")}}customElements.define("eui-header",N);class B extends HTMLElement{static get observedAttributes(){return["selected"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
|
|
626
|
+
<style>
|
|
627
|
+
:host {
|
|
628
|
+
display: block;
|
|
629
|
+
position: relative;
|
|
630
|
+
cursor: pointer;
|
|
631
|
+
width: 24px;
|
|
632
|
+
height: 24px;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.checkbox {
|
|
636
|
+
position: relative;
|
|
637
|
+
width: 24px;
|
|
638
|
+
height: 24px;
|
|
639
|
+
display: flex;
|
|
640
|
+
align-items: center;
|
|
641
|
+
justify-content: center;
|
|
642
|
+
border-radius: 4px;
|
|
643
|
+
box-shadow: inset 0px 0px 0px 2px var(--app-400);
|
|
644
|
+
|
|
645
|
+
color: #fff;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
.checkbox.selected, .checkbox.indeterminate {
|
|
649
|
+
background-color: var(--app-accent);
|
|
650
|
+
box-shadow: none;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
input {
|
|
654
|
+
appearance: none;
|
|
655
|
+
opacity: 0;
|
|
656
|
+
height: max(100%, var(--eui-switch-touch-target-size, 48px));
|
|
657
|
+
width: max(100%, var(--eui-switch-touch-target-size, 48px));
|
|
658
|
+
position: absolute;
|
|
659
|
+
margin: 0;
|
|
660
|
+
cursor: inherit;
|
|
661
|
+
top: 50%;
|
|
662
|
+
left: 50%;
|
|
663
|
+
transform: translate(-50%, -50%);
|
|
664
|
+
z-index: 2;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.mark.long {
|
|
668
|
+
height:2px;
|
|
669
|
+
transition-property:transform,width;
|
|
670
|
+
width:0px;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.mark.short {
|
|
674
|
+
height: 2px;
|
|
675
|
+
transition-property: transform,height;
|
|
676
|
+
width: 0px;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.mark {
|
|
680
|
+
fill: #fff;
|
|
681
|
+
transform: scaleY(-1) translate(7px, -14px) rotate(45deg);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.selected .mark.long {
|
|
685
|
+
animation-duration: 350ms;
|
|
686
|
+
animation-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
687
|
+
transition-duration: 350ms;
|
|
688
|
+
transition-timing-function: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.selected .mark.short {
|
|
692
|
+
width: 2px;
|
|
693
|
+
height: 5.6568542495px;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.selected .mark.long{
|
|
697
|
+
width: 11.313708499px;
|
|
698
|
+
}
|
|
699
|
+
</style>
|
|
700
|
+
|
|
701
|
+
<div class="checkbox">
|
|
702
|
+
<input type="checkbox" role="checkbox">
|
|
703
|
+
<svg class="icon" viewBox="0 0 18 18" aria-hidden="true">
|
|
704
|
+
<rect class="mark short"></rect>
|
|
705
|
+
<rect class="mark long"></rect>
|
|
706
|
+
</svg>
|
|
707
|
+
</div>
|
|
708
|
+
`}connectedCallback(){this.inputEl=this.shadowRoot.querySelector("input"),this.checkEl=this.shadowRoot.querySelector(".checkbox"),this.updateFromAttribute(),this.checkEl.addEventListener("click",()=>this.toggle())}toggle(){this.selected=!this.selected,v();const t=this.selected,i=this.dataset.setting;i&&A.set(i,t)}updateFromAttribute(){const t=this.hasAttribute("selected");this.inputEl.checked=t,this.checkEl.classList.toggle("selected",t)}attributeChangedCallback(t,i,e){t==="selected"&&this.inputEl&&this.updateFromAttribute()}get selected(){return this.hasAttribute("selected")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}}customElements.define("eui-checkbox",B);class O extends HTMLElement{static observedAttributes=["type","width","height","border-radius","icon","link","href"];constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render()}render(){const t=this.getAttribute("href"),i=t?"a":"button";this.shadowRoot.innerHTML=`
|
|
709
|
+
<style>
|
|
710
|
+
button, a {
|
|
711
|
+
display: flex;
|
|
712
|
+
justify-content: center;
|
|
713
|
+
align-items: center;
|
|
714
|
+
gap: 0.25rem;
|
|
715
|
+
padding: 0.5rem 1rem;
|
|
716
|
+
font-size: 1rem;
|
|
717
|
+
font-weight: 600;
|
|
718
|
+
font-family: inherit;
|
|
719
|
+
border-radius: 0.6rem;
|
|
720
|
+
border: none;
|
|
721
|
+
background: var(--app-300);
|
|
722
|
+
color: var(--app-text, #FFF);
|
|
723
|
+
cursor: pointer;
|
|
724
|
+
box-sizing: border-box;
|
|
725
|
+
text-decoration: none;
|
|
726
|
+
|
|
727
|
+
width: fit-content;
|
|
728
|
+
|
|
729
|
+
user-select: none;
|
|
730
|
+
-webkit-user-select: none;
|
|
731
|
+
-moz-user-select: none;
|
|
732
|
+
-ms-user-select: none;
|
|
733
|
+
|
|
734
|
+
transition: background 0.2s cubic-bezier(.2,0,0,1);
|
|
735
|
+
|
|
736
|
+
position: relative;
|
|
737
|
+
overflow: hidden;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
button:hover, a:hover {
|
|
741
|
+
background: var(--app-400);
|
|
742
|
+
text-decoration: none;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.light button, .light a {
|
|
746
|
+
background: var(--app-500);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
button.filled, a.filled {
|
|
750
|
+
background: var(--app-accent-100);
|
|
751
|
+
color: #fff;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
button.filled:hover, a.filled:hover {
|
|
755
|
+
background: var(--app-accent-50);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
button.outlined, a.outlined {
|
|
759
|
+
background: transparent;
|
|
760
|
+
box-shadow: inset 0 0 0 2px var(--app-400);
|
|
761
|
+
color: var(--app-accent-100);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
button.outlined:hover, a.outlined:hover {
|
|
765
|
+
background: var(--app-300);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
button.icon, a.icon {
|
|
769
|
+
padding: 0.5rem;
|
|
770
|
+
border-radius: 50%;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
button.transparent, a.transparent {
|
|
774
|
+
background: transparent;
|
|
775
|
+
color: var(--app-text);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
button.transparent:hover, a.transparent:hover {
|
|
779
|
+
background: var(--app-300);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
button:disabled, a[disabled] {
|
|
783
|
+
opacity: 0.5;
|
|
784
|
+
cursor: not-allowed;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
button.link, a.link {
|
|
788
|
+
text-decoration: none;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
.ripple {
|
|
792
|
+
position: absolute;
|
|
793
|
+
border-radius: 50%;
|
|
794
|
+
transform: scale(0);
|
|
795
|
+
opacity: 0.2;
|
|
796
|
+
animation: ripple 600ms linear forwards;
|
|
797
|
+
background-color: currentColor;
|
|
798
|
+
pointer-events: none;
|
|
799
|
+
z-index: 10;
|
|
800
|
+
will-change: transform, opacity;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
@keyframes ripple {
|
|
804
|
+
to {
|
|
805
|
+
transform: scale(4);
|
|
806
|
+
opacity: 0;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
</style>
|
|
811
|
+
<${i}>
|
|
812
|
+
<slot></slot>
|
|
813
|
+
</${i}>
|
|
814
|
+
`;const e=this.shadowRoot.querySelector(i);t&&e.setAttribute("href",t),this.hasAttribute("type")&&e.classList.add(this.getAttribute("type")),this.hasAttribute("icon")&&e.classList.add("icon"),this.hasAttribute("width")&&(e.style.width=this.getAttribute("width")+"px"),this.hasAttribute("height")&&(e.style.height=this.getAttribute("height")+"px"),this.hasAttribute("border-radius")&&(e.style.borderRadius=this.getAttribute("border-radius")+"px"),e.addEventListener("pointerdown",r=>{const s=document.createElement("span"),a=r.currentTarget,l=a.getBoundingClientRect(),c=Math.max(a.offsetWidth,a.offsetHeight),n=c/2;s.classList.add("ripple"),s.style.width=`${c}px`,s.style.height=`${c}px`,s.style.left=`${r.clientX-l.left-n}px`,s.style.top=`${r.clientY-l.top-n}px`,e.appendChild(s),s.addEventListener("animationend",()=>{s.remove()})})}}customElements.define("eui-button",O);class P extends HTMLElement{static get observedAttributes(){return["type","anchor"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.hd=this.shadowRoot.querySelector(".hd"),this.hasAttribute("type")&&this.hd.classList.add(this.getAttribute("type"))}render(){this.shadowRoot.innerHTML=`
|
|
815
|
+
<style>
|
|
816
|
+
:host {
|
|
817
|
+
display: block;
|
|
818
|
+
position: relative;
|
|
819
|
+
margin: 16px 0;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.hd {
|
|
823
|
+
font-size: 2.5rem;
|
|
824
|
+
font-weight: 600;
|
|
825
|
+
margin: 0;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.h2 {
|
|
829
|
+
font-size: 2rem;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.h3 {
|
|
833
|
+
font-size: 1.5rem;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.anchor {
|
|
837
|
+
position: absolute;
|
|
838
|
+
width: 100%;
|
|
839
|
+
height: 100%;
|
|
840
|
+
|
|
841
|
+
inset: 0;
|
|
842
|
+
inset-inline-start: -24px;
|
|
843
|
+
opacity: 0;
|
|
844
|
+
transition: opacity .25s var(--transition-function);
|
|
845
|
+
|
|
846
|
+
display: flex;
|
|
847
|
+
align-items: center;
|
|
848
|
+
|
|
849
|
+
text-decoration: none;
|
|
850
|
+
color: var(--app-accent);
|
|
851
|
+
font-size: 1.5rem;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.anchor:hover {
|
|
855
|
+
opacity: 1;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.anchor-hash {
|
|
859
|
+
margin-inline-end: 8px;
|
|
860
|
+
font-weight: 700;
|
|
861
|
+
}
|
|
862
|
+
</style>
|
|
863
|
+
|
|
864
|
+
<span class="hd">
|
|
865
|
+
<slot></slot>
|
|
866
|
+
</span>
|
|
867
|
+
${this.getAttribute("anchor")?`
|
|
868
|
+
<a class="anchor" href="#${this.getAttribute("anchor")}" id="${this.getAttribute("anchor")}">
|
|
869
|
+
<span class="anchor-hash">#</span>
|
|
870
|
+
</a>
|
|
871
|
+
`:""}
|
|
872
|
+
`}}customElements.define("eui-heading",P);function U(o){const e=Date.now()-o,r=Math.floor(e/1e3),s=Math.floor(r/60),a=Math.floor(s/60),l=Math.floor(a/24),c=Math.floor(l/30),n=Math.floor(c/12);return n>0?`${n}y`:c>0?`${c}mo`:l>0?`${l}d`:a>0?`${a}h`:s>0?`${s}m`:`${r}s`}function D(o){const e=Date.now()-o,r=Math.floor(e/1e3),s=Math.floor(r/60),a=Math.floor(s/60),l=Math.floor(a/24),c=Math.floor(l/30),n=Math.floor(c/12);return n>0?`${n} year${n>1?"s":""} ago`:c>0?`${c} month${c>1?"s":""} ago`:l>0?`${l} day${l>1?"s":""} ago`:a>0?`${a} hour${a>1?"s":""} ago`:s>0?`${s} minute${s>1?"s":""} ago`:`${r} second${r>1?"s":""} ago`}function X(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/`/g,"`").replace(/'/g,"'")}function S(o){const t=document.createElement("input");t.value=o,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}const W=Object.freeze(Object.defineProperty({__proto__:null,copystr:S,joinedAgo:D,sanitize:X,timeAgo:U},Symbol.toStringTag,{value:"Module"}));class J extends HTMLElement{static get observedAttributes(){return["copy","id","type"]}constructor(){super(),this.attachShadow({mode:"open"}),this._boundCopy=this._onCopy.bind(this),this._isRendered=!1}connectedCallback(){this._isRendered||(this.render(),this._isRendered=!0)}render(){const t=this.hasAttribute("copy");this.shadowRoot.innerHTML=`
|
|
873
|
+
<style>
|
|
874
|
+
:host {
|
|
875
|
+
position: relative;
|
|
876
|
+
display: block;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
pre {
|
|
880
|
+
padding: 20px;
|
|
881
|
+
background: var(--app-100);
|
|
882
|
+
border: 1px solid var(--app-300);
|
|
883
|
+
border-radius: 20px;
|
|
884
|
+
font-family: 'Reddit Mono', consolas;
|
|
885
|
+
overflow-x: auto;
|
|
886
|
+
line-height: 1.25;
|
|
887
|
+
white-space: pre;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
.copy {
|
|
891
|
+
position: absolute;
|
|
892
|
+
top: 8px;
|
|
893
|
+
right: 8px;
|
|
894
|
+
}
|
|
895
|
+
pre.g {
|
|
896
|
+
padding-right: 60px;
|
|
897
|
+
}
|
|
898
|
+
</style>
|
|
899
|
+
|
|
900
|
+
<eui-button class="copy" width="45" height="45" border-radius="100">
|
|
901
|
+
<eui-icon name="copy" width="24" height="24"></eui-icon>
|
|
902
|
+
</eui-button>
|
|
903
|
+
|
|
904
|
+
<pre class="${t?"g":""}"><code></code></pre>
|
|
905
|
+
`,this.copyBtn=this.shadowRoot.querySelector(".copy"),this.codeEl=this.shadowRoot.querySelector("code"),this.codeEl.textContent=this._getFormattedText(),t?this.copyBtn.addEventListener("click",this._boundCopy):this.copyBtn.style.display="none"}_getFormattedText(){let t=this.textContent||"";t=t.replace(/^\s*\n/,"").replace(/\n\s*$/,""),t=t.replace(/[ \t]+$/gm,"");const i=t.split(`
|
|
906
|
+
`),e=i.filter(s=>s.trim()).map(s=>s.match(/^\s*/)[0].length),r=e.length?Math.min(...e):0;return t=i.map(s=>s.slice(r)).join(`
|
|
907
|
+
`),t}_onCopy(){S(this._getFormattedText())}disconnectedCallback(){this.copyBtn&&this.copyBtn.removeEventListener("click",this._boundCopy)}}customElements.define("eui-code",J);class V extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.setupEventListeners()}static get observedAttributes(){return["name"]}attributeChangedCallback(t,i,e){t==="name"&&(this.render(),this.setupEventListeners())}setupEventListeners(){const t=this.shadowRoot.querySelector("#nav-toggle");t&&t.addEventListener("click",()=>{window.dispatchEvent(new CustomEvent("toggle-nav"))})}render(){const t=this.getAttribute("name")||"Title";this.shadowRoot.innerHTML=`
|
|
908
|
+
<style>
|
|
909
|
+
:host {
|
|
910
|
+
display: block;
|
|
911
|
+
width: 100%;
|
|
912
|
+
height: var(--titlebar-height, 65px);
|
|
913
|
+
background-color: var(--app-200);
|
|
914
|
+
flex-shrink: 0;
|
|
915
|
+
position: fixed;
|
|
916
|
+
top: 0;
|
|
917
|
+
left: 0;
|
|
918
|
+
z-index: 200;
|
|
919
|
+
box-sizing: border-box;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
.titlebar {
|
|
923
|
+
height: 100%;
|
|
924
|
+
display: flex;
|
|
925
|
+
align-items: center;
|
|
926
|
+
justify-content: space-between;
|
|
927
|
+
box-sizing: border-box;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
.left-section {
|
|
931
|
+
display: flex;
|
|
932
|
+
align-items: center;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.title {
|
|
936
|
+
font-size: 1.25rem;
|
|
937
|
+
font-weight: 400;
|
|
938
|
+
color: var(--app-text);
|
|
939
|
+
margin: 0;
|
|
940
|
+
user-select: none;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
.menu-button {
|
|
944
|
+
border: none;
|
|
945
|
+
background-color: transparent;
|
|
946
|
+
cursor: pointer;
|
|
947
|
+
width: 42px;
|
|
948
|
+
height: 42px;
|
|
949
|
+
display: flex;
|
|
950
|
+
align-items: center;
|
|
951
|
+
justify-content: center;
|
|
952
|
+
box-sizing: border-box;
|
|
953
|
+
border-radius: 50%;
|
|
954
|
+
color: inherit;
|
|
955
|
+
padding: 0;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
.menu-button:hover {
|
|
959
|
+
background-color: var(--app-300);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.menu-button:active {
|
|
963
|
+
transform: scale(0.95);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
.menu-button:focus-visible {
|
|
967
|
+
outline: 2px solid var(--app-link);
|
|
968
|
+
outline-offset: 2px;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
.right-section {
|
|
972
|
+
display: flex;
|
|
973
|
+
align-items: center;
|
|
974
|
+
padding-right: 1rem;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
.nav-section {
|
|
978
|
+
width: var(--nav-width, 75px);
|
|
979
|
+
|
|
980
|
+
display: flex;
|
|
981
|
+
align-items: center;
|
|
982
|
+
justify-content: center;
|
|
983
|
+
}
|
|
984
|
+
</style>
|
|
985
|
+
|
|
986
|
+
<div class="titlebar">
|
|
987
|
+
<div class="left-section">
|
|
988
|
+
<div class="nav-section">
|
|
989
|
+
<eui-button class="menu-button" id="nav-toggle" aria-label="Toggle Navigation" aria-expanded="false" aria-controls="nav-items" tabindex="0" type="transparent" border-radius="100">
|
|
990
|
+
<eui-icon width="24" height="24" name="menu"></eui-icon>
|
|
991
|
+
</eui-button>
|
|
992
|
+
</div>
|
|
993
|
+
<h2 class="title">${t}</h2>
|
|
994
|
+
</div>
|
|
995
|
+
<div class="right-section">
|
|
996
|
+
<slot></slot>
|
|
997
|
+
</div>
|
|
998
|
+
</div>
|
|
999
|
+
`}}customElements.define("eui-app-titlebar",V);class Y extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this._handleMouseDown=this._addRipple.bind(this)}connectedCallback(){this.render(),this.setupEventListeners()}static get observedAttributes(){return["elevated","interactive","ripple"]}attributeChangedCallback(t,i,e){i!==e&&t==="ripple"&&this.setupEventListeners()}setupEventListeners(){this.removeEventListener("mousedown",this._handleMouseDown),this.hasAttribute("ripple")&&this.addEventListener("mousedown",this._handleMouseDown)}_addRipple(t){const i=this.getBoundingClientRect(),e=document.createElement("span"),r=Math.max(i.width,i.height),s=r/2;e.style.width=e.style.height=`${r}px`,e.style.left=`${t.clientX-i.left-s}px`,e.style.top=`${t.clientY-i.top-s}px`,e.classList.add("ripple"),this.shadowRoot.querySelector(".surface").appendChild(e),e.addEventListener("animationend",()=>{e.remove()})}render(){this.shadowRoot.innerHTML=`
|
|
1000
|
+
<style>
|
|
1001
|
+
:host {
|
|
1002
|
+
display: block;
|
|
1003
|
+
border-radius: 12px;
|
|
1004
|
+
background-color: var(--app-200);
|
|
1005
|
+
transition: background-color 0.2s cubic-bezier(.4, 0, .2, 1),
|
|
1006
|
+
box-shadow 0.2s cubic-bezier(.4, 0, .2, 1);
|
|
1007
|
+
overflow: hidden;
|
|
1008
|
+
position: relative;
|
|
1009
|
+
height: auto;
|
|
1010
|
+
z-index: 1;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
:host([elevated]) {
|
|
1014
|
+
background-color: var(--app-100);
|
|
1015
|
+
box-shadow: inset 0 0 0 1px var(--app-300);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
:host([interactive]) {
|
|
1019
|
+
cursor: pointer;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
:host([interactive]:hover) {
|
|
1023
|
+
background-color: var(--app-300);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
:host([interactive][elevated]:hover) {
|
|
1027
|
+
background-color: var(--app-100);
|
|
1028
|
+
box-shadow: inset 0 0 0 1px var(--app-300), 0 4px 12px rgba(0,0,0,0.1);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
.surface {
|
|
1032
|
+
position: relative;
|
|
1033
|
+
z-index: 2;
|
|
1034
|
+
width: 100%;
|
|
1035
|
+
height: 100%;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
.ripple {
|
|
1039
|
+
position: absolute;
|
|
1040
|
+
border-radius: 50%;
|
|
1041
|
+
transform: scale(0);
|
|
1042
|
+
opacity: 0.2;
|
|
1043
|
+
animation: ripple 600ms linear forwards;
|
|
1044
|
+
background-color: currentColor;
|
|
1045
|
+
pointer-events: none;
|
|
1046
|
+
z-index: -1;
|
|
1047
|
+
will-change: transform, opacity;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
@keyframes ripple {
|
|
1051
|
+
to {
|
|
1052
|
+
transform: scale(4);
|
|
1053
|
+
opacity: 0;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
</style>
|
|
1057
|
+
<div class="surface">
|
|
1058
|
+
<slot></slot>
|
|
1059
|
+
</div>
|
|
1060
|
+
`}}customElements.define("eui-surface",Y),typeof window<"u"&&console.log("ErisUI loaded successfully"),p.device=z,p.haptics=$,p.loadPage=F,p.router=x,p.storage=H,p.utils=W,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|