diff --git a/css/main.css b/css/main.css
index f8d906f..c45397e 100644
--- a/css/main.css
+++ b/css/main.css
@@ -119,7 +119,7 @@ button,
font-size: inherit;
font-weight: 500;
white-space: nowrap;
- padding: 0.8rem;
+ padding: 0.6rem 0.8rem;
border-radius: 0.3rem;
justify-content: center;
flex-shrink: 0;
@@ -899,6 +899,9 @@ theme-toggle {
padding: 0.8rem 1rem;
display: flex;
align-items: center;
+ color: rgba(var(--text-color), 0.9);
+ font-weight: 500;
+ font-size: 0.9rem;
cursor: pointer;
}
.suggestion:hover, .suggestion:active, .suggestion:focus {
@@ -1292,6 +1295,107 @@ theme-toggle {
display: none;
}
+#smart_contract_creation_popup {
+ --width: min(32rem, 100%);
+}
+#smart_contract_creation_popup::part(popup) {
+ view-transition-name: sc-popup;
+}
+#smart_contract_creation_popup fieldset {
+ padding: 0.5rem;
+ border-radius: 0.5rem;
+ border: solid 1px rgba(var(--text-color), 0.3);
+}
+#smart_contract_creation_popup fieldset legend {
+ padding: 0 0.5rem;
+}
+#smart_contract_creation_popup label {
+ padding: 0.3rem 0.5rem;
+}
+#smart_contract_creation_popup label:has(input:not(:disabled):not(:checked)) {
+ cursor: pointer;
+}
+#smart_contract_creation_popup input[type=radio] {
+ height: 1.1em;
+ width: 1.1em;
+ margin-right: 0.5rem;
+ accent-color: var(--accent-color);
+}
+
+::view-transition-group(sc-popup) {
+ -webkit-animation-duration: 0.3s;
+ animation-duration: 0.3s;
+}
+
+.smart-contract-template {
+ display: grid;
+ grid-template-areas: "heading arrow" "description arrow";
+ grid-template-columns: 1fr auto;
+ padding: max(1rem, 2vw);
+ border: solid 1px rgba(var(--text-color), 0.3);
+ border-radius: 0.5rem;
+ gap: 0.5rem;
+ text-align: start;
+ white-space: normal;
+ width: 100%;
+ justify-content: flex-start;
+}
+.smart-contract-template h4 {
+ grid-area: heading;
+}
+.smart-contract-template p {
+ grid-area: description;
+ font-weight: 400;
+ line-height: 1.3;
+ font-size: 0.9rem;
+ color: rgba(var(--text-color), 0.8);
+ text-transform: none;
+}
+.smart-contract-template .icon {
+ margin-top: auto;
+ grid-area: arrow;
+ border: solid 1px rgba(var(--text-color), 0.3);
+ border-radius: 3rem;
+ padding: 0.4rem;
+ height: 2rem;
+ width: 2rem;
+ fill: var(--accent-color);
+}
+
+.payee-address-wrapper {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ gap: 0.5rem;
+}
+.payee-address-wrapper:first-of-type {
+ grid-template-areas: "address" "share";
+}
+.payee-address-wrapper:not(:first-of-type) {
+ grid-template-areas: "address address" "share button";
+}
+.payee-address-wrapper .payee-address {
+ grid-area: address;
+}
+.payee-address-wrapper .payee-share {
+ grid-area: share;
+}
+.payee-address-wrapper .icon-only {
+ grid-area: button;
+}
+.payee-address-wrapper .icon-only {
+ height: 3.18rem;
+}
+
+.choice-wrapper {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ gap: 0.5rem;
+}
+.choice-wrapper .icon-only {
+ aspect-ratio: 1/1;
+ height: 3.18rem;
+}
+
@media only screen and (max-width: 640px) {
.hide-on-small {
display: none;
@@ -1361,6 +1465,16 @@ theme-toggle {
.transfer-step > :nth-child(3) {
flex: 1;
}
+ .payee-address-wrapper {
+ display: grid;
+ grid-template-columns: 1fr 8rem 3rem;
+ }
+ .payee-address-wrapper:first-of-type {
+ grid-template-areas: "address share share";
+ }
+ .payee-address-wrapper:not(:first-of-type) {
+ grid-template-areas: "address share button";
+ }
}
@media only screen and (min-width: 1280px) {
.margin,
diff --git a/css/main.min.css b/css/main.min.css
index 4090895..ec3db1f 100644
--- a/css/main.min.css
+++ b/css/main.min.css
@@ -1 +1 @@
-*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.5rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 34, 34, 34;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1)}body[data-theme=dark]{--accent-color: #92a2ff;--secondary-color: #d60739;--text-color: 200, 200, 200;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}h1,h2,h3,h4,h5,h6{letter-spacing:-0.01em;font-weight:700}p,strong{line-height:1.7;color:rgba(var(--text-color), 0.9);max-width:70ch}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}input[type=datetime-local]{width:100%;padding:.8rem .6rem;border:none;border-radius:.5rem;font-weight:500;font-family:inherit;font-size:inherit;color:inherit;background-color:rgba(var(--text-color), 0.06)}input[type=datetime-local]:focus{outline:none;box-shadow:0 0 0 .1rem var(--accent-color)}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:inherit;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.3rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.02);border:solid thin rgba(var(--text-color), 0.06)}.button--primary{color:rgba(var(--background-color), 1);background-color:var(--accent-color)}.button--primary .icon{fill:rgba(var(--background-color), 1)}.button--colored{color:var(--accent-color)}.button--colored .icon{fill:var(--accent-color)}.button--danger{background-color:rgba(255,115,115,.062745098);color:var(--danger-color)}.button--danger .icon{fill:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.3) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}button:disabled{opacity:.4;cursor:not-allowed;filter:saturate(0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;gap:1rem;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input{--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-chips{--gap: 0.3rem}sm-chip{position:relative;font-size:.9rem;--border-radius: 0.5rem;--padding: 0.5rem 0.8rem;--background: rgba(var(--text-color), 0.06);-webkit-user-select:none;-moz-user-select:none;user-select:none;font-weight:500}sm-chip[selected]{--background: var(--accent-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.interact{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-content-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.space-evenly{justify-content:space-evenly}.w-100{width:100%}.h-100{height:100%}.padding-block-1{padding-block:1rem}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-1{margin-right:1rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-top-1{margin-top:1rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.ws-pre-line{white-space:pre-line}.card{background-color:rgba(var(--foreground-color), 1);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.password-field label{display:flex;flex-shrink:0}.password-field label input:checked~.visible{display:none}.password-field label input:not(:checked)~.invisible{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1;width:100%}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-size:1.2rem;margin-bottom:1rem}#confirmation_popup .flex,#prompt_popup .flex{margin-top:1rem}.popup__header{position:relative;display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header>*{grid-row:1}.popup__header h3,.popup__header h4{grid-column:1/-1;justify-self:center;align-self:center}.popup__header__close{grid-column:1;margin-left:-1rem;justify-self:flex-start}section{position:relative}section .dark-background{display:grid;grid-template-rows:auto 1fr}ul[type=circle]{padding:1.5rem 2.5rem;list-style:circle}ul[type=circle] li{margin-bottom:1rem}ul[type=circle] li:last-of-type{margin-bottom:0}ul{list-style:none}.top-bottom-padding{padding:1.5rem 0}.margin,.page{margin:0 1rem}.page{display:flex;flex-direction:column}.card{padding:2rem 1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06);margin:1.5rem 0}.card h2{margin-bottom:1.5rem}.transaction-container{display:grid;margin-top:1.5rem;gap:.5rem}.label{text-transform:capitalize;font-size:.8rem;margin-bottom:.3rem;color:rgba(var(--text-color), 0.8);margin-top:1.5rem;font-weight:500}.label:first-of-type{margin-top:0}.label+*{font-weight:700}.header{justify-items:center;flex-direction:column}#homepage{padding-top:0}#first_section{display:grid}header.grid-2{margin-top:2rem}@-webkit-keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@-webkit-keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}@keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}#highlights{padding:1.5rem 0;display:grid;grid-template-columns:repeat(auto-fit, minmax(14rem, 1fr));gap:1.5rem}#highlights .highlight-item{opacity:0;display:flex;flex-direction:column;padding:1rem 1.5rem;border-left:.1rem solid rgba(var(--text-color), 0.2);--animation-duration: 0.3s}#highlights .highlight-item .label{margin-top:auto}#highlights .highlight-item h1{font-size:2rem;letter-spacing:.1rem;font-weight:500;text-transform:uppercase;overflow-wrap:break-word}#highlights .highlight-item:first-of-type{text-transform:uppercase}#highlights .highlight-item:nth-of-type(2){text-transform:capitalize}#highlights .highlight-item:first-of-type{-webkit-animation:flyInLeft var(--animation-duration) forwards;animation:flyInLeft var(--animation-duration) forwards}#highlights .highlight-item:nth-of-type(2){-webkit-animation:flyInLeft var(--animation-duration) .1s forwards;animation:flyInLeft var(--animation-duration) .1s forwards}#highlights .highlight-item:nth-of-type(3){-webkit-animation:flyInLeft var(--animation-duration) .2s forwards;animation:flyInLeft var(--animation-duration) .2s forwards}#highlights .highlight-item:last-of-type{-webkit-animation:flyInLeft var(--animation-duration) .3s forwards;animation:flyInLeft var(--animation-duration) .3s forwards}#main_header{display:grid;grid-template-columns:1fr auto;grid-template-areas:"search theme";margin-top:1rem;gap:1rem}#logo{grid-area:logo;color:inherit;margin-right:auto}.app-brand{display:flex;gap:.3rem;align-items:center}.app-brand .icon{height:1.7rem;width:1.7rem}.app-name__company{font-size:.8rem;font-weight:500;color:rgba(var(--text-color), 0.8)}theme-toggle{grid-area:theme;justify-self:end;align-self:center}#search_wrapper{grid-area:search;width:min(28rem,100%);position:relative}#main_search_field{width:100%;--min-height: 2.8rem;font-weight:500;border:solid thin rgba(var(--text-color), 0.3);border-radius:.5rem}#suggestions{position:absolute;top:100%;left:0;width:100%;background:rgba(var(--foreground-color), 1);border-radius:.5rem;z-index:1;overflow:hidden;max-height:0;transition:max-height .2s ease-in-out}#suggestions:not(:empty){margin-top:.3rem;max-height:20rem;overflow-y:auto;box-shadow:0 1rem 1.5rem rgba(0,0,0,.16);border:solid thin rgba(var(--text-color), 0.3)}.suggestion{padding:.8rem 1rem;display:flex;align-items:center;cursor:pointer}.suggestion:hover,.suggestion:active,.suggestion:focus{background:rgba(var(--text-color), 0.06);outline:none}.suggestion .address{font-size:.8rem;color:rgba(var(--text-color), 0.6);margin-left:auto}#page_header{padding:1rem 0;align-items:center}#page_header button{margin-left:-0.7rem}#page_header h3{text-transform:capitalize}.page{padding:0 0 1rem 0}.page h3.heading{text-transform:capitalize}.page>h3.heading{margin-top:2rem}.balance-card{display:flex;flex-direction:column;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' style='fill:none; stroke: %23ffffff08'%3E%3Ccircle cx='3.5' cy='3.5' r='2.12'/%3E%3Ccircle cx='5' cy='10' r='1'/%3E%3Ccircle cx='8.5' cy='4.5' r='1.5'/%3E%3Ccircle cx='6' cy='33' r='2'/%3E%3Ccircle cx='14' cy='29' r='1'/%3E%3Ccircle cx='9.5' cy='22.5' r='1.5'/%3E%3Ccircle cx='29.5' cy='17.5' r='4.5'/%3E%3Ccircle cx='22' cy='8' r='1'/%3E%3Ccircle cx='15.5' cy='12.5' r='2.5'/%3E%3Ccircle cx='27.5' cy='30.5' r='0.5'/%3E%3Ccircle cx='18.5' cy='35.5' r='2.5'/%3E%3Ccircle cx='32' cy='36' r='1'/%3E%3Ccircle cx='35' cy='25' r='1'/%3E%3Ccircle cx='23' cy='21' r='2'/%3E%3Ccircle cx='36.5' cy='1.5' r='0.5'/%3E%3Ccircle cx='30.5' cy='3.5' r='1.5'/%3E%3Ccircle cx='34.5' cy='6.5' r='1.5'/%3E%3C/svg%3E"),linear-gradient(135deg, rgb(77, 32, 167), rgb(33, 16, 110));background-size:cover;color:#fff;border-radius:.5rem;padding:max(1.5rem,3vw);margin-bottom:2rem}.balance-card h2,.balance-card h3,.balance-card h4,.balance-card h5{opacity:.8}.balance-card h3{font-size:1.5rem}.balance-card .label{color:#fff;opacity:.7}.choice,.status{padding:.5rem .8rem;border-radius:2rem;display:inline-flex;align-items:center;margin-bottom:.5rem;text-transform:capitalize;margin-right:auto}.choice-container{display:flex;flex-wrap:wrap}.choice{border:solid 1px rgba(var(--text-color), 0.2)}.choice:last-of-type{margin-bottom:0}.status{position:relative;display:flex;align-items:center;font-weight:700;font-size:.9rem;margin-bottom:.5rem;letter-spacing:.01em;padding:0}.status::before{content:"";width:.8rem;height:.8rem;border-radius:50%;margin-right:.5rem;display:inline-block}.status.active::before{background-color:var(--green)}.status.closed::before{background-color:var(--danger-color)}.address,.token,.hash,.contract,.block-height{cursor:pointer;color:var(--accent-color)}.address{text-transform:none !important;word-break:break-all}#winners_container{display:grid;gap:1rem}.contract-winner{display:grid;gap:.5rem 1rem;font-size:.95rem}#token_balance_list{display:flex;flex-wrap:wrap;gap:.5rem}.token-balance{display:flex;flex-direction:column;padding:1rem;background-color:rgba(0,0,0,.2);border-radius:.5rem;font-size:1.2rem}.transaction{display:grid;gap:1.5rem;padding:max(1rem,2vw);border-radius:.5rem;background-color:rgba(var(--foreground-color), 0.8)}.transaction .contract-info{align-items:flex-start;display:grid;gap:1.5rem;min-width:0}.transaction>.icon:first-of-type{fill:none;stroke:rgba(var(--text-color), 0.8);stroke-width:4;stroke-linecap:round;stroke-linejoin:round;overflow:visible;height:2.5rem;width:2.5rem;padding:.7rem;border-radius:1rem;background:rgba(var(--text-color), 0.1)}.transaction time{font-size:.9rem}.badge{font-size:.8rem;padding:.2rem .5rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.1);color:rgba(var(--text-color), 0.8)}.transfer-steps{display:flex;flex-direction:column;gap:1rem}.transfer-step{display:flex;flex-direction:column;gap:1rem 2rem;border:solid thin rgba(var(--text-color), 0.4);padding:.5rem 1rem;border-radius:.5rem}.transfer-step>:nth-child(2){width:auto;transform:rotate(90deg)}#loading{position:fixed;display:grid;top:0;left:0;bottom:0;right:0;place-content:center;justify-items:center;background:rgba(var(--foreground-color), 1);z-index:10;height:100dvh}#loading h4{margin-top:1.5rem}#all_blocks_page,#top_blocks_container{display:grid;grid-template-columns:repeat(auto-fit, minmax(20rem, 1fr));gap:1rem;margin-top:1rem}.block-card{grid-template-columns:5rem 1fr auto;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem}.block-card time{font-size:.8rem;color:rgba(var(--text-color), 0.8)}#token_balance_container{display:grid;gap:.5rem;margin-top:1.5rem}#token_balance_container .holder-balance{padding:1rem;border-radius:.5rem;background:rgba(var(--foreground-color), 1)}#error_page{padding:1.5rem 0}.view-wrapper{display:grid;align-items:flex-start}.view-wrapper>*{grid-area:1/1}.info-row{flex-direction:column;margin-bottom:1.3rem}#participant_container,#deposits_container{display:grid;gap:.5rem;background-color:rgba(0,0,0,0);padding:0}.participant,.deposit-card{flex-wrap:wrap;align-items:center;gap:2rem;background-color:rgba(var(--foreground-color), 1);padding:max(1rem,1.5vw);border-radius:.5rem}.participant .address,.deposit-card .address{min-width:12rem;flex:1}#transaction_page{display:grid;gap:3rem}#transaction_page .card{margin:0;min-width:12rem}.smart-contract-list{display:grid;gap:1rem;margin-top:1rem;grid-template-columns:repeat(auto-fill, minmax(18rem, 1fr))}.sc-card{display:flex;flex-direction:column;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:max(1rem,1.5vw);border-radius:.5rem}.sc-card__type{display:flex;font-size:.85rem;font-weight:500;margin-right:auto;align-items:center}.sc-card__type::before{content:"";display:block;width:.15rem;height:1em;border-radius:0 .5rem .5rem 0;margin-right:.5rem;background-color:var(--accent-color)}.sc-card__info-link{display:flex;align-items:center;font-weight:500;font-size:.9rem}.sc-card__info-link .icon{fill:var(--accent-color)}.sc-card .sc-card__actions{justify-content:flex-end;padding-top:1rem}.sc-card .sc-card__actions .button{background-color:rgba(0,0,0,0);border:solid 1px var(--accent-color);font-size:.9rem;padding:.5rem 1rem}.sc-card .badge{margin-right:auto}.involved-tokens li{padding:.2rem .5rem;border-radius:.2rem;background-color:rgba(var(--text-color), 0.06);font-size:.85rem;font-weight:500}.involved-tokens li a{color:rgba(var(--text-color), 0.8)}.involved-tokens li a:hover{text-decoration:underline}#filter_s_c_popup{--width: min(36rem, 100%)}#filter_s_c_popup__content{margin-bottom:1.5rem}.sc-filter{padding:.5rem .8rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.06);font-weight:500;font-size:.9rem}.sc-filter.selected{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}.sc-filter.selected:hover{background-color:var(--accent-color) !important}.sc-filter input{display:none}@media only screen and (max-width: 640px){.hide-on-small{display:none}}@media only screen and (min-width: 640px){sm-popup{--width: 24rem}.popup__header{padding:1rem 1.5rem 0 1.5rem}.margin,.page{margin:0 4vw}section header h1{font-size:2rem}#main_header{grid-template-areas:"logo theme"}#search_wrapper{grid-area:1/1/2/-1;margin:0 auto;max-width:calc(100% - 16rem)}#page_header{padding:1.5rem 0}.transaction{grid-template-columns:auto 1fr;contain-intrinsic-height:20rem}.transaction>.icon:first-of-type{grid-area:1/1/3/2}.contract-winner{grid-template-columns:2fr 1fr 1fr;align-items:center}#contract_info{-moz-columns:24rem auto;columns:24rem auto;-moz-column-gap:4rem;column-gap:4rem}.info-row{flex-direction:row;gap:.5rem}.info-row h5{min-width:11rem;margin-bottom:0;margin-top:.2rem !important}.transfer-step{align-items:center;flex-direction:row}.transfer-step>:nth-child(1){flex:1}.transfer-step>:nth-child(2){transform:none}.transfer-step>:nth-child(3){flex:1}}@media only screen and (min-width: 1280px){.margin,.page{margin:0 10vw}}@media(hover: hover){.hover{cursor:pointer}::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interact:not([disabled]){transition:background-color .3s}.interact:not([disabled]):hover{background-color:rgba(var(--text-color), 0.06)}.button:not([disabled]){transition:background-color .3s,filter .3s}.button:not([disabled]):hover{filter:contrast(2)}}
\ No newline at end of file
+*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.5rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 34, 34, 34;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1)}body[data-theme=dark]{--accent-color: #92a2ff;--secondary-color: #d60739;--text-color: 200, 200, 200;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}h1,h2,h3,h4,h5,h6{letter-spacing:-0.01em;font-weight:700}p,strong{line-height:1.7;color:rgba(var(--text-color), 0.9);max-width:70ch}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}input[type=datetime-local]{width:100%;padding:.8rem .6rem;border:none;border-radius:.5rem;font-weight:500;font-family:inherit;font-size:inherit;color:inherit;background-color:rgba(var(--text-color), 0.06)}input[type=datetime-local]:focus{outline:none;box-shadow:0 0 0 .1rem var(--accent-color)}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:inherit;font-weight:500;white-space:nowrap;padding:.6rem .8rem;border-radius:.3rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.02);border:solid thin rgba(var(--text-color), 0.06)}.button--primary{color:rgba(var(--background-color), 1);background-color:var(--accent-color)}.button--primary .icon{fill:rgba(var(--background-color), 1)}.button--colored{color:var(--accent-color)}.button--colored .icon{fill:var(--accent-color)}.button--danger{background-color:rgba(255,115,115,.062745098);color:var(--danger-color)}.button--danger .icon{fill:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.3) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}button:disabled{opacity:.4;cursor:not-allowed;filter:saturate(0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;gap:1rem;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input{--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-chips{--gap: 0.3rem}sm-chip{position:relative;font-size:.9rem;--border-radius: 0.5rem;--padding: 0.5rem 0.8rem;--background: rgba(var(--text-color), 0.06);-webkit-user-select:none;-moz-user-select:none;user-select:none;font-weight:500}sm-chip[selected]{--background: var(--accent-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.interact{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-content-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.space-evenly{justify-content:space-evenly}.w-100{width:100%}.h-100{height:100%}.padding-block-1{padding-block:1rem}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-1{margin-right:1rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-top-1{margin-top:1rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.ws-pre-line{white-space:pre-line}.card{background-color:rgba(var(--foreground-color), 1);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.password-field label{display:flex;flex-shrink:0}.password-field label input:checked~.visible{display:none}.password-field label input:not(:checked)~.invisible{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1;width:100%}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-size:1.2rem;margin-bottom:1rem}#confirmation_popup .flex,#prompt_popup .flex{margin-top:1rem}.popup__header{position:relative;display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header>*{grid-row:1}.popup__header h3,.popup__header h4{grid-column:1/-1;justify-self:center;align-self:center}.popup__header__close{grid-column:1;margin-left:-1rem;justify-self:flex-start}section{position:relative}section .dark-background{display:grid;grid-template-rows:auto 1fr}ul[type=circle]{padding:1.5rem 2.5rem;list-style:circle}ul[type=circle] li{margin-bottom:1rem}ul[type=circle] li:last-of-type{margin-bottom:0}ul{list-style:none}.top-bottom-padding{padding:1.5rem 0}.margin,.page{margin:0 1rem}.page{display:flex;flex-direction:column}.card{padding:2rem 1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06);margin:1.5rem 0}.card h2{margin-bottom:1.5rem}.transaction-container{display:grid;margin-top:1.5rem;gap:.5rem}.label{text-transform:capitalize;font-size:.8rem;margin-bottom:.3rem;color:rgba(var(--text-color), 0.8);margin-top:1.5rem;font-weight:500}.label:first-of-type{margin-top:0}.label+*{font-weight:700}.header{justify-items:center;flex-direction:column}#homepage{padding-top:0}#first_section{display:grid}header.grid-2{margin-top:2rem}@-webkit-keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@keyframes flyInLeft{from{opacity:0;transform:translateX(-0.5rem)}to{opacity:1;transform:none}}@-webkit-keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}@keyframes flyInRight{from{opacity:0;transform:translateX(0.5rem)}to{opacity:1;transform:none}}#highlights{padding:1.5rem 0;display:grid;grid-template-columns:repeat(auto-fit, minmax(14rem, 1fr));gap:1.5rem}#highlights .highlight-item{opacity:0;display:flex;flex-direction:column;padding:1rem 1.5rem;border-left:.1rem solid rgba(var(--text-color), 0.2);--animation-duration: 0.3s}#highlights .highlight-item .label{margin-top:auto}#highlights .highlight-item h1{font-size:2rem;letter-spacing:.1rem;font-weight:500;text-transform:uppercase;overflow-wrap:break-word}#highlights .highlight-item:first-of-type{text-transform:uppercase}#highlights .highlight-item:nth-of-type(2){text-transform:capitalize}#highlights .highlight-item:first-of-type{-webkit-animation:flyInLeft var(--animation-duration) forwards;animation:flyInLeft var(--animation-duration) forwards}#highlights .highlight-item:nth-of-type(2){-webkit-animation:flyInLeft var(--animation-duration) .1s forwards;animation:flyInLeft var(--animation-duration) .1s forwards}#highlights .highlight-item:nth-of-type(3){-webkit-animation:flyInLeft var(--animation-duration) .2s forwards;animation:flyInLeft var(--animation-duration) .2s forwards}#highlights .highlight-item:last-of-type{-webkit-animation:flyInLeft var(--animation-duration) .3s forwards;animation:flyInLeft var(--animation-duration) .3s forwards}#main_header{display:grid;grid-template-columns:1fr auto;grid-template-areas:"search theme";margin-top:1rem;gap:1rem}#logo{grid-area:logo;color:inherit;margin-right:auto}.app-brand{display:flex;gap:.3rem;align-items:center}.app-brand .icon{height:1.7rem;width:1.7rem}.app-name__company{font-size:.8rem;font-weight:500;color:rgba(var(--text-color), 0.8)}theme-toggle{grid-area:theme;justify-self:end;align-self:center}#search_wrapper{grid-area:search;width:min(28rem,100%);position:relative}#main_search_field{width:100%;--min-height: 2.8rem;font-weight:500;border:solid thin rgba(var(--text-color), 0.3);border-radius:.5rem}#suggestions{position:absolute;top:100%;left:0;width:100%;background:rgba(var(--foreground-color), 1);border-radius:.5rem;z-index:1;overflow:hidden;max-height:0;transition:max-height .2s ease-in-out}#suggestions:not(:empty){margin-top:.3rem;max-height:20rem;overflow-y:auto;box-shadow:0 1rem 1.5rem rgba(0,0,0,.16);border:solid thin rgba(var(--text-color), 0.3)}.suggestion{padding:.8rem 1rem;display:flex;align-items:center;color:rgba(var(--text-color), 0.9);font-weight:500;font-size:.9rem;cursor:pointer}.suggestion:hover,.suggestion:active,.suggestion:focus{background:rgba(var(--text-color), 0.06);outline:none}.suggestion .address{font-size:.8rem;color:rgba(var(--text-color), 0.6);margin-left:auto}#page_header{padding:1rem 0;align-items:center}#page_header button{margin-left:-0.7rem}#page_header h3{text-transform:capitalize}.page{padding:0 0 1rem 0}.page h3.heading{text-transform:capitalize}.page>h3.heading{margin-top:2rem}.balance-card{display:flex;flex-direction:column;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' style='fill:none; stroke: %23ffffff08'%3E%3Ccircle cx='3.5' cy='3.5' r='2.12'/%3E%3Ccircle cx='5' cy='10' r='1'/%3E%3Ccircle cx='8.5' cy='4.5' r='1.5'/%3E%3Ccircle cx='6' cy='33' r='2'/%3E%3Ccircle cx='14' cy='29' r='1'/%3E%3Ccircle cx='9.5' cy='22.5' r='1.5'/%3E%3Ccircle cx='29.5' cy='17.5' r='4.5'/%3E%3Ccircle cx='22' cy='8' r='1'/%3E%3Ccircle cx='15.5' cy='12.5' r='2.5'/%3E%3Ccircle cx='27.5' cy='30.5' r='0.5'/%3E%3Ccircle cx='18.5' cy='35.5' r='2.5'/%3E%3Ccircle cx='32' cy='36' r='1'/%3E%3Ccircle cx='35' cy='25' r='1'/%3E%3Ccircle cx='23' cy='21' r='2'/%3E%3Ccircle cx='36.5' cy='1.5' r='0.5'/%3E%3Ccircle cx='30.5' cy='3.5' r='1.5'/%3E%3Ccircle cx='34.5' cy='6.5' r='1.5'/%3E%3C/svg%3E"),linear-gradient(135deg, rgb(77, 32, 167), rgb(33, 16, 110));background-size:cover;color:#fff;border-radius:.5rem;padding:max(1.5rem,3vw);margin-bottom:2rem}.balance-card h2,.balance-card h3,.balance-card h4,.balance-card h5{opacity:.8}.balance-card h3{font-size:1.5rem}.balance-card .label{color:#fff;opacity:.7}.choice,.status{padding:.5rem .8rem;border-radius:2rem;display:inline-flex;align-items:center;margin-bottom:.5rem;text-transform:capitalize;margin-right:auto}.choice-container{display:flex;flex-wrap:wrap}.choice{border:solid 1px rgba(var(--text-color), 0.2)}.choice:last-of-type{margin-bottom:0}.status{position:relative;display:flex;align-items:center;font-weight:700;font-size:.9rem;margin-bottom:.5rem;letter-spacing:.01em;padding:0}.status::before{content:"";width:.8rem;height:.8rem;border-radius:50%;margin-right:.5rem;display:inline-block}.status.active::before{background-color:var(--green)}.status.closed::before{background-color:var(--danger-color)}.address,.token,.hash,.contract,.block-height{cursor:pointer;color:var(--accent-color)}.address{text-transform:none !important;word-break:break-all}#winners_container{display:grid;gap:1rem}.contract-winner{display:grid;gap:.5rem 1rem;font-size:.95rem}#token_balance_list{display:flex;flex-wrap:wrap;gap:.5rem}.token-balance{display:flex;flex-direction:column;padding:1rem;background-color:rgba(0,0,0,.2);border-radius:.5rem;font-size:1.2rem}.transaction{display:grid;gap:1.5rem;padding:max(1rem,2vw);border-radius:.5rem;background-color:rgba(var(--foreground-color), 0.8)}.transaction .contract-info{align-items:flex-start;display:grid;gap:1.5rem;min-width:0}.transaction>.icon:first-of-type{fill:none;stroke:rgba(var(--text-color), 0.8);stroke-width:4;stroke-linecap:round;stroke-linejoin:round;overflow:visible;height:2.5rem;width:2.5rem;padding:.7rem;border-radius:1rem;background:rgba(var(--text-color), 0.1)}.transaction time{font-size:.9rem}.badge{font-size:.8rem;padding:.2rem .5rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.1);color:rgba(var(--text-color), 0.8)}.transfer-steps{display:flex;flex-direction:column;gap:1rem}.transfer-step{display:flex;flex-direction:column;gap:1rem 2rem;border:solid thin rgba(var(--text-color), 0.4);padding:.5rem 1rem;border-radius:.5rem}.transfer-step>:nth-child(2){width:auto;transform:rotate(90deg)}#loading{position:fixed;display:grid;top:0;left:0;bottom:0;right:0;place-content:center;justify-items:center;background:rgba(var(--foreground-color), 1);z-index:10;height:100dvh}#loading h4{margin-top:1.5rem}#all_blocks_page,#top_blocks_container{display:grid;grid-template-columns:repeat(auto-fit, minmax(20rem, 1fr));gap:1rem;margin-top:1rem}.block-card{grid-template-columns:5rem 1fr auto;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem}.block-card time{font-size:.8rem;color:rgba(var(--text-color), 0.8)}#token_balance_container{display:grid;gap:.5rem;margin-top:1.5rem}#token_balance_container .holder-balance{padding:1rem;border-radius:.5rem;background:rgba(var(--foreground-color), 1)}#error_page{padding:1.5rem 0}.view-wrapper{display:grid;align-items:flex-start}.view-wrapper>*{grid-area:1/1}.info-row{flex-direction:column;margin-bottom:1.3rem}#participant_container,#deposits_container{display:grid;gap:.5rem;background-color:rgba(0,0,0,0);padding:0}.participant,.deposit-card{flex-wrap:wrap;align-items:center;gap:2rem;background-color:rgba(var(--foreground-color), 1);padding:max(1rem,1.5vw);border-radius:.5rem}.participant .address,.deposit-card .address{min-width:12rem;flex:1}#transaction_page{display:grid;gap:3rem}#transaction_page .card{margin:0;min-width:12rem}.smart-contract-list{display:grid;gap:1rem;margin-top:1rem;grid-template-columns:repeat(auto-fill, minmax(18rem, 1fr))}.sc-card{display:flex;flex-direction:column;gap:1rem;background-color:rgba(var(--foreground-color), 1);padding:max(1rem,1.5vw);border-radius:.5rem}.sc-card__type{display:flex;font-size:.85rem;font-weight:500;margin-right:auto;align-items:center}.sc-card__type::before{content:"";display:block;width:.15rem;height:1em;border-radius:0 .5rem .5rem 0;margin-right:.5rem;background-color:var(--accent-color)}.sc-card__info-link{display:flex;align-items:center;font-weight:500;font-size:.9rem}.sc-card__info-link .icon{fill:var(--accent-color)}.sc-card .sc-card__actions{justify-content:flex-end;padding-top:1rem}.sc-card .sc-card__actions .button{background-color:rgba(0,0,0,0);border:solid 1px var(--accent-color);font-size:.9rem;padding:.5rem 1rem}.sc-card .badge{margin-right:auto}.involved-tokens li{padding:.2rem .5rem;border-radius:.2rem;background-color:rgba(var(--text-color), 0.06);font-size:.85rem;font-weight:500}.involved-tokens li a{color:rgba(var(--text-color), 0.8)}.involved-tokens li a:hover{text-decoration:underline}#filter_s_c_popup{--width: min(36rem, 100%)}#filter_s_c_popup__content{margin-bottom:1.5rem}.sc-filter{padding:.5rem .8rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.06);font-weight:500;font-size:.9rem}.sc-filter.selected{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}.sc-filter.selected:hover{background-color:var(--accent-color) !important}.sc-filter input{display:none}#smart_contract_creation_popup{--width: min(32rem, 100%)}#smart_contract_creation_popup::part(popup){view-transition-name:sc-popup}#smart_contract_creation_popup fieldset{padding:.5rem;border-radius:.5rem;border:solid 1px rgba(var(--text-color), 0.3)}#smart_contract_creation_popup fieldset legend{padding:0 .5rem}#smart_contract_creation_popup label{padding:.3rem .5rem}#smart_contract_creation_popup label:has(input:not(:disabled):not(:checked)){cursor:pointer}#smart_contract_creation_popup input[type=radio]{height:1.1em;width:1.1em;margin-right:.5rem;accent-color:var(--accent-color)}::view-transition-group(sc-popup){-webkit-animation-duration:.3s;animation-duration:.3s}.smart-contract-template{display:grid;grid-template-areas:"heading arrow" "description arrow";grid-template-columns:1fr auto;padding:max(1rem,2vw);border:solid 1px rgba(var(--text-color), 0.3);border-radius:.5rem;gap:.5rem;text-align:start;white-space:normal;width:100%;justify-content:flex-start}.smart-contract-template h4{grid-area:heading}.smart-contract-template p{grid-area:description;font-weight:400;line-height:1.3;font-size:.9rem;color:rgba(var(--text-color), 0.8);text-transform:none}.smart-contract-template .icon{margin-top:auto;grid-area:arrow;border:solid 1px rgba(var(--text-color), 0.3);border-radius:3rem;padding:.4rem;height:2rem;width:2rem;fill:var(--accent-color)}.payee-address-wrapper{display:grid;grid-template-columns:1fr auto;gap:.5rem}.payee-address-wrapper:first-of-type{grid-template-areas:"address" "share"}.payee-address-wrapper:not(:first-of-type){grid-template-areas:"address address" "share button"}.payee-address-wrapper .payee-address{grid-area:address}.payee-address-wrapper .payee-share{grid-area:share}.payee-address-wrapper .icon-only{grid-area:button}.payee-address-wrapper .icon-only{height:3.18rem}.choice-wrapper{display:grid;grid-template-columns:1fr auto;gap:.5rem}.choice-wrapper .icon-only{aspect-ratio:1/1;height:3.18rem}@media only screen and (max-width: 640px){.hide-on-small{display:none}}@media only screen and (min-width: 640px){sm-popup{--width: 24rem}.popup__header{padding:1rem 1.5rem 0 1.5rem}.margin,.page{margin:0 4vw}section header h1{font-size:2rem}#main_header{grid-template-areas:"logo theme"}#search_wrapper{grid-area:1/1/2/-1;margin:0 auto;max-width:calc(100% - 16rem)}#page_header{padding:1.5rem 0}.transaction{grid-template-columns:auto 1fr;contain-intrinsic-height:20rem}.transaction>.icon:first-of-type{grid-area:1/1/3/2}.contract-winner{grid-template-columns:2fr 1fr 1fr;align-items:center}#contract_info{-moz-columns:24rem auto;columns:24rem auto;-moz-column-gap:4rem;column-gap:4rem}.info-row{flex-direction:row;gap:.5rem}.info-row h5{min-width:11rem;margin-bottom:0;margin-top:.2rem !important}.transfer-step{align-items:center;flex-direction:row}.transfer-step>:nth-child(1){flex:1}.transfer-step>:nth-child(2){transform:none}.transfer-step>:nth-child(3){flex:1}.payee-address-wrapper{display:grid;grid-template-columns:1fr 8rem 3rem}.payee-address-wrapper:first-of-type{grid-template-areas:"address share share"}.payee-address-wrapper:not(:first-of-type){grid-template-areas:"address share button"}}@media only screen and (min-width: 1280px){.margin,.page{margin:0 10vw}}@media(hover: hover){.hover{cursor:pointer}::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interact:not([disabled]){transition:background-color .3s}.interact:not([disabled]):hover{background-color:rgba(var(--text-color), 0.06)}.button:not([disabled]){transition:background-color .3s,filter .3s}.button:not([disabled]):hover{filter:contrast(2)}}
\ No newline at end of file
diff --git a/css/main.scss b/css/main.scss
index ef78874..8e47ce7 100644
--- a/css/main.scss
+++ b/css/main.scss
@@ -105,7 +105,7 @@ button,
font-size: inherit;
font-weight: 500;
white-space: nowrap;
- padding: 0.8rem;
+ padding: 0.6rem 0.8rem;
border-radius: 0.3rem;
justify-content: center;
flex-shrink: 0;
@@ -815,6 +815,9 @@ theme-toggle {
padding: 0.8rem 1rem;
display: flex;
align-items: center;
+ color: rgba(var(--text-color), 0.9);
+ font-weight: 500;
+ font-size: 0.9rem;
cursor: pointer;
&:hover,
&:active,
@@ -1192,6 +1195,102 @@ theme-toggle {
}
}
+#smart_contract_creation_popup {
+ --width: min(32rem, 100%);
+ &::part(popup) {
+ view-transition-name: sc-popup;
+ }
+ fieldset {
+ padding: 0.5rem;
+ border-radius: 0.5rem;
+ border: solid 1px rgba(var(--text-color), 0.3);
+ legend {
+ padding: 0 0.5rem;
+ }
+ }
+ label {
+ padding: 0.3rem 0.5rem;
+ &:has(input:not(:disabled):not(:checked)) {
+ cursor: pointer;
+ }
+ }
+ input[type="radio"] {
+ height: 1.1em;
+ width: 1.1em;
+ margin-right: 0.5rem;
+ accent-color: var(--accent-color);
+ }
+}
+::view-transition-group(sc-popup) {
+ animation-duration: 0.3s;
+}
+.smart-contract-template {
+ display: grid;
+ grid-template-areas: "heading arrow" "description arrow";
+ grid-template-columns: 1fr auto;
+ padding: max(1rem, 2vw);
+ border: solid 1px rgba(var(--text-color), 0.3);
+ border-radius: 0.5rem;
+ gap: 0.5rem;
+ text-align: start;
+ white-space: normal;
+ width: 100%;
+ justify-content: flex-start;
+ h4 {
+ grid-area: heading;
+ }
+ p {
+ grid-area: description;
+ font-weight: 400;
+ line-height: 1.3;
+ font-size: 0.9rem;
+ color: rgba(var(--text-color), 0.8);
+ text-transform: none;
+ }
+ .icon {
+ margin-top: auto;
+ grid-area: arrow;
+ border: solid 1px rgba(var(--text-color), 0.3);
+ border-radius: 3rem;
+ padding: 0.4rem;
+ height: 2rem;
+ width: 2rem;
+ fill: var(--accent-color);
+ }
+}
+
+.payee-address-wrapper {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ gap: 0.5rem;
+ &:first-of-type {
+ grid-template-areas: "address" "share";
+ }
+ &:not(:first-of-type) {
+ grid-template-areas: "address address" "share button";
+ }
+ .payee-address {
+ grid-area: address;
+ }
+ .payee-share {
+ grid-area: share;
+ }
+ .icon-only {
+ grid-area: button;
+ }
+ .icon-only {
+ height: 3.18rem;
+ }
+}
+.choice-wrapper {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ gap: 0.5rem;
+ .icon-only {
+ aspect-ratio: 1/1;
+ height: 3.18rem;
+ }
+}
@media only screen and (max-width: 640px) {
.hide-on-small {
display: none;
@@ -1265,6 +1364,16 @@ theme-toggle {
flex: 1;
}
}
+ .payee-address-wrapper {
+ display: grid;
+ grid-template-columns: 1fr 8rem 3rem;
+ &:first-of-type {
+ grid-template-areas: "address share share";
+ }
+ &:not(:first-of-type) {
+ grid-template-areas: "address share button";
+ }
+ }
}
@media only screen and (min-width: 1280px) {
.margin,
diff --git a/index.html b/index.html
index 673b150..7e43e52 100644
--- a/index.html
+++ b/index.html
@@ -21,6 +21,14 @@
Loading RanchiMall FLO Scout
@@ -102,6 +110,20 @@
+
diff --git a/scripts/components.min.js b/scripts/components.min.js
index 06506dd..60bb163 100644
--- a/scripts/components.min.js
+++ b/scripts/components.min.js
@@ -1,9 +1,10 @@
-// Components downloaded: chips,copy,form,input,notifications,popup,spinner,theme-toggle
-const smChips = document.createElement("template"); smChips.innerHTML = '
', customElements.define("sm-chips", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChips.content.cloneNode(!0)), this.chipsWrapper = this.shadowRoot.querySelector(".sm-chips"), this.coverLeft = this.shadowRoot.querySelector(".cover--left"), this.coverRight = this.shadowRoot.querySelector(".cover--right"), this.navButtonLeft = this.shadowRoot.querySelector(".nav-button--left"), this.navButtonRight = this.shadowRoot.querySelector(".nav-button--right"), this.slottedOptions = void 0, this._value = void 0, this.scrollDistance = 0, this.assignedElements = [], this.scrollLeft = this.scrollLeft.bind(this), this.scrollRight = this.scrollRight.bind(this), this.fireEvent = this.fireEvent.bind(this), this.setSelectedOption = this.setSelectedOption.bind(this) } get value() { return this._value } set value(t) { this.setSelectedOption(t) } scrollLeft() { this.chipsWrapper.scrollBy({ left: -this.scrollDistance, behavior: "smooth" }) } scrollRight() { this.chipsWrapper.scrollBy({ left: this.scrollDistance, behavior: "smooth" }) } setSelectedOption(t) { this._value !== t && (this._value = t, this.assignedElements.forEach(e => { e.value == t ? (e.setAttribute("selected", "true"), e.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" })) : e.removeAttribute("selected") })) } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this._value } })) } connectedCallback() { this.setAttribute("role", "listbox"); const t = this.shadowRoot.querySelector("slot"); t.addEventListener("slotchange", e => { n.disconnect(), i.disconnect(), this.observeSelf.disconnect(), clearTimeout(this.slotChangeTimeout), this.slotChangeTimeout = setTimeout(() => { this.assignedElements = t.assignedElements(), this.assignedElements.forEach(t => { t.hasAttribute("selected") && "true" === t.getAttribute("selected") && (this._value = t.value) }), this.observeSelf.observe(this) }, 0) }); const e = new ResizeObserver(t => { t.forEach(t => { if (t.contentBoxSize) { const e = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize; this.scrollDistance = .6 * e.inlineSize } else this.scrollDistance = .6 * t.contentRect.width }) }); e.observe(this), this.observeSelf = new IntersectionObserver((t, e) => { t.forEach(t => { t.isIntersecting && !this.hasAttribute("multiline") && this.assignedElements.length > 0 && (n.observe(this.assignedElements[0]), i.observe(this.assignedElements[this.assignedElements.length - 1]), e.unobserve(this)) }) }, { threshold: 1 }), this.chipsWrapper.addEventListener("option-clicked", t => { this._value !== t.target.value && (this.setSelectedOption(t.target.value), this.fireEvent()) }); const n = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonLeft.classList.add("hide"), this.coverLeft.classList.add("hide")) : (this.navButtonLeft.classList.remove("hide"), this.coverLeft.classList.remove("hide")) }) }, { threshold: 1, root: this }), i = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonRight.classList.add("hide"), this.coverRight.classList.add("hide")) : (this.navButtonRight.classList.remove("hide"), this.coverRight.classList.remove("hide")) }) }, { threshold: 1, root: this }); this.navButtonLeft.addEventListener("click", this.scrollLeft), this.navButtonRight.addEventListener("click", this.scrollRight) } disconnectedCallback() { this.navButtonLeft.removeEventListener("click", this.scrollLeft), this.navButtonRight.removeEventListener("click", this.scrollRight) } }); const smChip = document.createElement("template"); smChip.innerHTML = '
', customElements.define("sm-chip", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChip.content.cloneNode(!0)), this._value = void 0, this.radioButton = this.shadowRoot.querySelector("input"), this.fireEvent = this.fireEvent.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this) } get value() { return this._value } fireEvent() { this.dispatchEvent(new CustomEvent("option-clicked", { bubbles: !0, composed: !0, detail: { value: this._value } })) } handleKeyDown(t) { "Enter" !== t.key && "Space" !== t.key || this.fireEvent() } connectedCallback() { this.setAttribute("role", "option"), this.setAttribute("tabindex", "0"), this._value = this.getAttribute("value"), this.addEventListener("click", this.fireEvent), this.addEventListener("keydown", this.handleKeyDown) } disconnectedCallback() { this.removeEventListener("click", this.fireEvent), this.removeEventListener("keydown", this.handleKeyDown) } });
+// Components downloaded: chips,copy,form,input,notifications,popup,select,spinner,theme-toggle
+const smChips = document.createElement("template"); smChips.innerHTML = '
', customElements.define("sm-chips", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChips.content.cloneNode(!0)), this.chipsWrapper = this.shadowRoot.querySelector(".sm-chips"), this.coverLeft = this.shadowRoot.querySelector(".cover--left"), this.coverRight = this.shadowRoot.querySelector(".cover--right"), this.navButtonLeft = this.shadowRoot.querySelector(".nav-button--left"), this.navButtonRight = this.shadowRoot.querySelector(".nav-button--right"), this.slottedOptions = void 0, this._value = void 0, this.scrollDistance = 0, this.assignedElements = [], this.scrollLeft = this.scrollLeft.bind(this), this.scrollRight = this.scrollRight.bind(this), this.fireEvent = this.fireEvent.bind(this), this.setSelectedOption = this.setSelectedOption.bind(this) } get value() { return this._value } set value(t) { this.setSelectedOption(t) } scrollLeft() { this.chipsWrapper.scrollBy({ left: -this.scrollDistance, behavior: "smooth" }) } scrollRight() { this.chipsWrapper.scrollBy({ left: this.scrollDistance, behavior: "smooth" }) } setSelectedOption(t) { this._value !== t && (this._value = t, this.assignedElements.forEach(e => { e.value == t ? (e.setAttribute("selected", ""), e.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" })) : e.removeAttribute("selected") })) } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this._value } })) } connectedCallback() { this.setAttribute("role", "listbox"); const t = this.shadowRoot.querySelector("slot"); t.addEventListener("slotchange", e => { n.disconnect(), i.disconnect(), this.observeSelf.disconnect(), clearTimeout(this.slotChangeTimeout), this.slotChangeTimeout = setTimeout(() => { this.assignedElements = t.assignedElements(), this.assignedElements.forEach(t => { t.hasAttribute("selected") && (this._value = t.value) }), this.observeSelf.observe(this) }, 0) }); const e = new ResizeObserver(t => { t.forEach(t => { if (t.contentBoxSize) { const e = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize; this.scrollDistance = .6 * e.inlineSize } else this.scrollDistance = .6 * t.contentRect.width }) }); e.observe(this), this.observeSelf = new IntersectionObserver((t, e) => { t.forEach(t => { t.isIntersecting && !this.hasAttribute("multiline") && this.assignedElements.length > 0 && (n.observe(this.assignedElements[0]), i.observe(this.assignedElements[this.assignedElements.length - 1]), e.unobserve(this)) }) }, { threshold: 1 }), this.chipsWrapper.addEventListener("option-clicked", t => { this._value !== t.target.value && (this.setSelectedOption(t.target.value), this.fireEvent()) }); const n = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonLeft.classList.add("hide"), this.coverLeft.classList.add("hide")) : (this.navButtonLeft.classList.remove("hide"), this.coverLeft.classList.remove("hide")) }) }, { threshold: 1, root: this }), i = new IntersectionObserver(t => { t.forEach(t => { t.isIntersecting ? (this.navButtonRight.classList.add("hide"), this.coverRight.classList.add("hide")) : (this.navButtonRight.classList.remove("hide"), this.coverRight.classList.remove("hide")) }) }, { threshold: 1, root: this }); this.navButtonLeft.addEventListener("click", this.scrollLeft), this.navButtonRight.addEventListener("click", this.scrollRight) } disconnectedCallback() { this.navButtonLeft.removeEventListener("click", this.scrollLeft), this.navButtonRight.removeEventListener("click", this.scrollRight) } }); const smChip = document.createElement("template"); smChip.innerHTML = '
', customElements.define("sm-chip", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smChip.content.cloneNode(!0)), this._value = void 0, this.radioButton = this.shadowRoot.querySelector("input"), this.fireEvent = this.fireEvent.bind(this), this.handleKeyDown = this.handleKeyDown.bind(this) } get value() { return this._value } fireEvent() { this.dispatchEvent(new CustomEvent("option-clicked", { bubbles: !0, composed: !0, detail: { value: this._value } })) } handleKeyDown(t) { "Enter" !== t.key && "Space" !== t.key || this.fireEvent() } connectedCallback() { this.setAttribute("role", "option"), this.setAttribute("tabindex", "0"), this._value = this.getAttribute("value"), this.addEventListener("click", this.fireEvent), this.addEventListener("keydown", this.handleKeyDown) } disconnectedCallback() { this.removeEventListener("click", this.fireEvent), this.removeEventListener("keydown", this.handleKeyDown) } });
const smCopy = document.createElement("template"); smCopy.innerHTML = '
', customElements.define("sm-copy", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smCopy.content.cloneNode(!0)), this.copyContent = this.shadowRoot.querySelector(".copy-content"), this.copyButton = this.shadowRoot.querySelector(".copy-button"), this.copy = this.copy.bind(this) } static get observedAttributes() { return ["value"] } set value(t) { this.setAttribute("value", t) } get value() { return this.getAttribute("value") } fireEvent() { this.dispatchEvent(new CustomEvent("copy", { composed: !0, bubbles: !0, cancelable: !0 })) } copy() { navigator.clipboard.writeText(this.getAttribute("value")).then(t => this.fireEvent()).catch(t => console.error(t)) } connectedCallback() { this.copyButton.addEventListener("click", this.copy) } attributeChangedCallback(t, n, o) { if ("value" === t) { const t = this.copyContent.querySelector("slot"); if (!t) return; const n = t.assignedNodes(); n && n.length || (t.textContent = o) } } disconnectedCallback() { this.copyButton.removeEventListener("click", this.copy) } });
-const smForm = document.createElement("template"); smForm.innerHTML = '
', customElements.define("sm-form", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smForm.content.cloneNode(!0)), this.form = this.shadowRoot.querySelector("form"), this.invalidFieldsCount, this.skipSubmit = !1, this.isFormValid = void 0, this.supportedElements = "input, sm-input, sm-textarea, sm-checkbox, tags-input, file-input, sm-switch, sm-radio", this.formElements = [], this._requiredElements = [], this.debounce = this.debounce.bind(this), this._checkValidity = this._checkValidity.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.reset = this.reset.bind(this), this.elementsChanged = this.elementsChanged.bind(this) } static get observedAttributes() { return ["skip-submit"] } get validity() { return this.isFormValid } debounce(e, t) { let i = null; return (...s) => { window.clearTimeout(i), i = window.setTimeout((() => { e.apply(null, s) }), t) } } _checkValidity() { this.submitButton && 0 !== this._requiredElements.length && (this.invalidFieldsCount = 0, this._requiredElements.forEach((([e, t]) => { (!e.disabled && t && !e.isValid || !t && !e.checkValidity()) && this.invalidFieldsCount++ })), this.isFormValid !== (0 === this.invalidFieldsCount) && (this.isFormValid = 0 === this.invalidFieldsCount, this.dispatchEvent(new CustomEvent(this.isFormValid ? "valid" : "invalid", { bubbles: !0, composed: !0 })), this.skipSubmit || (this.submitButton.disabled = !this.isFormValid))) } handleKeydown(e) { if ("Enter" === e.key && e.target.tagName.includes("INPUT")) if (0 === this.invalidFieldsCount) this.submitButton && this.submitButton.click(), this.dispatchEvent(new CustomEvent("submit", { bubbles: !0, composed: !0 })); else for (const [e, t] of this._requiredElements) { if (t ? !e.isValid : !e.checkValidity()) { (e?.shadowRoot?.lastElementChild || e).animate([{ transform: "translateX(-1rem)" }, { transform: "translateX(1rem)" }, { transform: "translateX(-0.5rem)" }, { transform: "translateX(0.5rem)" }, { transform: "translateX(0)" }], { duration: 300, easing: "ease" }), t ? e.focusIn() : e.focus(); break } } } reset() { this.formElements.forEach((([e, t]) => { if (t) e.reset(); else switch (e.type) { case "checkbox": case "radio": e.checked = !1; break; default: e.value = "" } })), this._checkValidity() } elementsChanged() { this.formElements = [...this.querySelectorAll(this.supportedElements)].map((e => [e, e.tagName.includes("-")])), this._requiredElements = this.formElements.filter((([e]) => e.hasAttribute("required"))), this.submitButton = this.querySelector('[variant="primary"], [type="submit"]'), this.resetButton = this.querySelector('[type="reset"]'), this.resetButton && this.resetButton.addEventListener("click", this.reset), this._checkValidity() } connectedCallback() { const e = this.debounce(this.elementsChanged, 100); this.addEventListener("input", this.debounce(this._checkValidity, 100)), this.addEventListener("keydown", this.debounce(this.handleKeydown, 100)), this.shadowRoot.querySelector("slot").addEventListener("slotchange", e), this.mutationObserver = new MutationObserver((t => { t.forEach((t => { ("childList" === t.type && [...t.addedNodes].some((e => 1 === e.nodeType && e.querySelector(this.supportedElements))) || [...t.removedNodes].some((e => 1 === e.nodeType && e.querySelector(this.supportedElements)))) && e() })) })), this.mutationObserver.observe(this, { childList: !0, subtree: !0 }) } attributeChangedCallback(e, t, i) { "skip-submit" === e && (this.skipSubmit = null !== i) } disconnectedCallback() { this.removeEventListener("input", this.debounce(this._checkValidity, 100)), this.removeEventListener("keydown", this.debounce(this.handleKeydown, 100)), this.mutationObserver.disconnect() } });
-const smInput = document.createElement("template"); smInput.innerHTML = '
', customElements.define("sm-input", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smInput.content.cloneNode(!0)), this.inputParent = this.shadowRoot.querySelector(".input"), this.input = this.shadowRoot.querySelector("input"), this.clearBtn = this.shadowRoot.querySelector(".clear"), this.label = this.shadowRoot.querySelector(".label"), this.feedbackText = this.shadowRoot.querySelector(".feedback-text"), this.outerContainer = this.shadowRoot.querySelector(".outer-container"), this.optionList = this.shadowRoot.querySelector(".datalist"), this._helperText = "", this._errorText = "Invalid", this.isRequired = !1, this.datalist = [], this.validationFunction = void 0, this.reflectedAttributes = ["value", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "list", "autocomplete"], this.reset = this.reset.bind(this), this.clear = this.clear.bind(this), this.focusIn = this.focusIn.bind(this), this.focusOut = this.focusOut.bind(this), this.fireEvent = this.fireEvent.bind(this), this.checkInput = this.checkInput.bind(this), this.showError = this.showError.bind(this), this.allowOnlyNum = this.allowOnlyNum.bind(this), this.handleOptionClick = this.handleOptionClick.bind(this), this.handleInputNavigation = this.handleInputNavigation.bind(this), this.handleDatalistNavigation = this.handleDatalistNavigation.bind(this), this.handleFocus = this.handleFocus.bind(this), this.handleBlur = this.handleBlur.bind(this) } static get observedAttributes() { return ["value", "placeholder", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "helper-text", "error-text", "list"] } get value() { return this.input.value } set value(t) { t !== this.input.value && (this.input.value = t, this.checkInput()) } get placeholder() { return this.getAttribute("placeholder") } set placeholder(t) { this.setAttribute("placeholder", t) } get type() { return this.getAttribute("type") } set type(t) { this.setAttribute("type", t) } get validity() { return this.input.validity } get disabled() { return this.hasAttribute("disabled") } set disabled(t) { t ? (this.inputParent.classList.add("disabled"), this.setAttribute("disabled", "")) : (this.inputParent.classList.remove("disabled"), this.removeAttribute("disabled")) } get readOnly() { return this.hasAttribute("readonly") } set readOnly(t) { t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly") } set customValidation(t) { this.validationFunction = t } set errorText(t) { this._errorText = t } showError(t) { this.feedbackText.className = "feedback-text error", this.feedbackText.innerHTML = `
${t}` } set helperText(t) { this._helperText = t } get isValid() { if ("" !== this.input.value) { const t = this.input.checkValidity(); let e = { isValid: t, errorText: "" }; return this.validationFunction && (e = this.validationFunction(this.input.value)), t && e.isValid ? (this.feedbackText.className = "feedback-text success", this.feedbackText.textContent = "") : (e.errorText || this._errorText) && this.showError(e.errorText || this._errorText), t && e.isValid } } reset() { this.value = "" } clear() { this.value = "", this.input.focus(), this.fireEvent() } focusIn() { this.input.focus() } focusOut() { this.input.blur() } fireEvent() { let t = new Event("input", { bubbles: !0, cancelable: !0, composed: !0 }); this.dispatchEvent(t) } searchDatalist(t) { const e = this.datalist.filter(e => e.toLowerCase().includes(t.toLowerCase())); if (e.sort((e, n) => { const i = e.toLowerCase().indexOf(t.toLowerCase()), s = n.toLowerCase().indexOf(t.toLowerCase()); return i - s }), e.length) { if (this.optionList.children.length > e.length) { const t = this.optionList.children.length - e.length; for (let e = 0; e < t; e++)this.optionList.removeChild(this.optionList.lastChild) } e.forEach((t, e) => { if (this.optionList.children[e]) this.optionList.children[e].textContent = t; else { const e = document.createElement("li"); e.textContent = t, e.classList.add("datalist-item"), e.setAttribute("tabindex", "0"), this.optionList.appendChild(e) } }), this.optionList.classList.remove("hidden") } else this.optionList.classList.add("hidden") } checkInput(t) { this.hasAttribute("readonly") || ("" !== this.input.value ? this.clearBtn.classList.remove("hidden") : this.clearBtn.classList.add("hidden")), this.hasAttribute("placeholder") && "" !== this.getAttribute("placeholder").trim() && ("" !== this.input.value ? (this.animate ? this.inputParent.classList.add("animate-placeholder") : this.label.classList.add("hidden"), this.datalist.length && (this.searchTimeout && clearTimeout(this.searchTimeout), this.searchTimeout = setTimeout(() => { this.searchDatalist(this.input.value.trim()) }, 100))) : (this.animate ? this.inputParent.classList.remove("animate-placeholder") : this.label.classList.remove("hidden"), this.feedbackText.textContent = "", this.datalist.length && (this.optionList.innerHTML = "", this.optionList.classList.add("hidden")))) } allowOnlyNum(t) { 1 === t.key.length && (("." !== t.key || !t.target.value.includes(".") && 0 !== t.target.value.length) && ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."].includes(t.key) || t.preventDefault()) } handleOptionClick(t) { this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus() } handleInputNavigation(t) { "ArrowDown" === t.key ? (t.preventDefault(), this.optionList.children.length && this.optionList.children[0].focus()) : "ArrowUp" === t.key && (t.preventDefault(), this.optionList.children.length && this.optionList.children[this.optionList.children.length - 1].focus()) } handleDatalistNavigation(t) { "ArrowUp" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.previousElementSibling ? this.shadowRoot.activeElement.previousElementSibling.focus() : this.input.focus()) : "ArrowDown" === t.key ? (t.preventDefault(), this.shadowRoot.activeElement.nextElementSibling ? this.shadowRoot.activeElement.nextElementSibling.focus() : this.input.focus()) : "Enter" !== t.key && " " !== t.key || (t.preventDefault(), this.input.value = t.target.textContent, this.optionList.classList.add("hidden"), this.input.focus()) } handleFocus(t) { this.datalist.length && this.searchDatalist(this.input.value.trim()) } handleBlur(t) { this.datalist.length && this.optionList.classList.add("hidden") } connectedCallback() { this.animate = this.hasAttribute("animate"), this.setAttribute("role", "textbox"), this.input.addEventListener("input", this.checkInput), this.clearBtn.addEventListener("click", this.clear), this.datalist.length && (this.optionList.addEventListener("click", this.handleOptionClick), this.input.addEventListener("keydown", this.handleInputNavigation), this.optionList.addEventListener("keydown", this.handleDatalistNavigation)), this.input.addEventListener("focusin", this.handleFocus), this.addEventListener("focusout", this.handleBlur) } attributeChangedCallback(t, e, n) { if (e !== n) switch (this.reflectedAttributes.includes(t) && (this.hasAttribute(t) ? this.input.setAttribute(t, this.getAttribute(t) ? this.getAttribute(t) : "") : this.input.removeAttribute(t)), t) { case "placeholder": this.label.textContent = n, this.setAttribute("aria-label", n); break; case "value": this.checkInput(); break; case "type": this.hasAttribute("type") && "number" === this.getAttribute("type") ? (this.input.setAttribute("inputmode", "decimal"), this.input.addEventListener("keydown", this.allowOnlyNum)) : this.input.removeEventListener("keydown", this.allowOnlyNum); break; case "helper-text": this._helperText = n; break; case "error-text": this._errorText = n; break; case "required": this.isRequired = this.hasAttribute("required"), this.isRequired ? this.setAttribute("aria-required", "true") : this.setAttribute("aria-required", "false"); break; case "readonly": this.hasAttribute("readonly") ? this.inputParent.classList.add("readonly") : this.inputParent.classList.remove("readonly"); break; case "disabled": this.hasAttribute("disabled") ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled"); break; case "list": this.hasAttribute("list") && "" !== this.getAttribute("list").trim() && (this.datalist = this.getAttribute("list").split(",")) } } disconnectedCallback() { this.input.removeEventListener("input", this.checkInput), this.clearBtn.removeEventListener("click", this.clear), this.input.removeEventListener("keydown", this.allowOnlyNum), this.optionList.removeEventListener("click", this.handleOptionClick), this.input.removeEventListener("keydown", this.handleInputNavigation), this.optionList.removeEventListener("keydown", this.handleDatalistNavigation), this.input.removeEventListener("focusin", this.handleFocus), this.removeEventListener("focusout", this.handleBlur) } });
-const smNotifications = document.createElement("template"); smNotifications.innerHTML = "
", customElements.define("sm-notifications", class extends HTMLElement { constructor() { super(), this.shadow = this.attachShadow({ mode: "open" }).append(smNotifications.content.cloneNode(!0)), this.notificationPanel = this.shadowRoot.querySelector(".notification-panel"), this.animationOptions = { duration: 300, fill: "forwards", easing: "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }, this.push = this.push.bind(this), this.createNotification = this.createNotification.bind(this), this.removeNotification = this.removeNotification.bind(this), this.clearAll = this.clearAll.bind(this), this.remove = this.remove.bind(this), this.handleTouchMove = this.handleTouchMove.bind(this), this.startX = 0, this.currentX = 0, this.endX = 0, this.swipeDistance = 0, this.swipeDirection = "", this.swipeThreshold = 0, this.startTime = 0, this.swipeTime = 0, this.swipeTimeThreshold = 200, this.currentTarget = null, this.notificationTimeout = 5e3, this.mediaQuery = window.matchMedia("(min-width: 640px)"), this.handleOrientationChange = this.handleOrientationChange.bind(this), this.isBigViewport = !1 } set timeout(t) { isNaN(t) || (this.notificationTimeout = t) } randString(t) { let n = ""; const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let e = 0; e < t; e++)n += i.charAt(Math.floor(Math.random() * i.length)); return n } createNotification(t, n = {}) { const { pinned: i = !1, icon: e, action: o, timeout: a = this.notificationTimeout } = n, r = document.createElement("div"); return r.id = this.randString(8), r.className = `notification ${i ? "pinned" : ""}`, r.style.setProperty("--timeout", `${a}ms`), r.innerHTML = ` ${e ? `
${e}
` : ""}
${o ? `
` : ""}
`, o && r.querySelector(".action").addEventListener("click", o.callback), r.querySelector(".close").addEventListener("click", () => { this.removeNotification(r) }), i || setTimeout(() => { this.removeNotification(r, this.isBigViewport ? "left" : "top") }, a), r } push(t, n = {}) { const i = this.createNotification(t, n); return this.isBigViewport ? this.notificationPanel.append(i) : this.notificationPanel.prepend(i), i.scrollIntoView({ behavior: "smooth" }), this.notificationPanel.animate([{ transform: `translateY(${this.isBigViewport ? "" : "-"}${i.clientHeight}px)` }, { transform: "none" }], this.animationOptions), i.animate([{ transform: "translateY(-1rem)", opacity: "0" }, { transform: "none", opacity: "1" }], this.animationOptions).onfinish = (t => { t.target.commitStyles(), t.target.cancel() }), i.id } removeNotification(t, n = "left") { if (!t) return; const i = "left" === n || "top" === n ? "-" : "+"; this.isBigViewport || "top" !== n ? t.animate([{ transform: this.currentX ? `translateX(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateX(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = (() => { t.remove() }) : t.animate([{ transform: this.currentX ? `translateY(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateY(calc(${i}${Math.abs(this.currentX)}px ${i} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = (() => { t.remove() }) } remove(t) { const n = this.notificationPanel.querySelector(`#${t}`); n && this.removeNotification(n) } clearAll() { Array.from(this.notificationPanel.children).forEach(t => { this.removeNotification(t) }) } handleTouchMove(t) { this.currentX = t.touches[0].clientX - this.startX, this.currentTarget.style.transform = `translateX(${this.currentX}px)` } handleOrientationChange(t) { this.isBigViewport = t.matches, t.matches } connectedCallback() { this.handleOrientationChange(this.mediaQuery), this.mediaQuery.addEventListener("change", this.handleOrientationChange), this.notificationPanel.addEventListener("touchstart", t => { t.target.closest(".close") ? this.removeNotification(t.target.closest(".notification")) : t.target.closest(".notification") && (this.swipeThreshold = t.target.closest(".notification").getBoundingClientRect().width / 2, this.currentTarget = t.target.closest(".notification"), this.startTime = Date.now(), this.startX = t.touches[0].clientX, this.startY = t.touches[0].clientY, this.notificationPanel.addEventListener("touchmove", this.handleTouchMove, { passive: !0 })) }, { passive: !0 }), this.notificationPanel.addEventListener("touchend", t => { this.endX = t.changedTouches[0].clientX, this.endY = t.changedTouches[0].clientY, this.swipeDistance = Math.abs(this.endX - this.startX), this.swipeTime = Date.now() - this.startTime, this.endX > this.startX ? this.swipeDirection = "right" : this.swipeDirection = "left", this.swipeTime < this.swipeTimeThreshold ? this.swipeDistance > 50 && this.removeNotification(this.currentTarget, this.swipeDirection) : this.swipeDistance > this.swipeThreshold ? this.removeNotification(this.currentTarget, this.swipeDirection) : this.currentTarget.animate([{ transform: `translateX(${this.currentX}px)` }, { transform: "none" }], this.animationOptions).onfinish = (t => { t.target.commitStyles(), t.target.cancel() }), this.notificationPanel.removeEventListener("touchmove", this.handleTouchMove), this.currentX = 0 }) } disconnectedCallback() { mediaQueryList.removeEventListener("change", handleOrientationChange) } });
+const smForm = document.createElement("template"); smForm.innerHTML = '
', customElements.define("sm-form", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smForm.content.cloneNode(!0)), this.form = this.shadowRoot.querySelector("form"), this.invalidFieldsCount, this.skipSubmit = !1, this.isFormValid = void 0, this.supportedElements = "input, sm-input, sm-textarea, sm-checkbox, tags-input, file-input, sm-switch, sm-radio", this.formElements = [], this._requiredElements = [] } static get observedAttributes() { return ["skip-submit"] } get validity() { return this.isFormValid } debounce = (callback, wait) => { let timeoutId = null; return (...args) => { window.clearTimeout(timeoutId), timeoutId = window.setTimeout((() => { callback.apply(null, args) }), wait) } }; _checkValidity = () => { this.submitButton && 0 !== this._requiredElements.length && (this.invalidFieldsCount = 0, this._requiredElements.forEach((([elem, isWC]) => { (!elem.disabled && isWC && !elem.isValid || !isWC && !elem.checkValidity()) && this.invalidFieldsCount++ })), this.isFormValid !== (0 === this.invalidFieldsCount) && (this.isFormValid = 0 === this.invalidFieldsCount, this.dispatchEvent(new CustomEvent(this.isFormValid ? "valid" : "invalid", { bubbles: !0, composed: !0 })), this.skipSubmit || (this.submitButton.disabled = !this.isFormValid))) }; handleKeydown = e => { if ("Enter" === e.key && e.target.tagName.includes("INPUT")) if (0 === this.invalidFieldsCount) this.submitButton && this.submitButton.click(), this.dispatchEvent(new CustomEvent("submit", { bubbles: !0, composed: !0 })); else for (const [elem, isWC] of this._requiredElements) { if (isWC ? !elem.isValid : !elem.checkValidity()) { (elem?.shadowRoot?.lastElementChild || elem).animate([{ transform: "translateX(-1rem)" }, { transform: "translateX(1rem)" }, { transform: "translateX(-0.5rem)" }, { transform: "translateX(0.5rem)" }, { transform: "translateX(0)" }], { duration: 300, easing: "ease" }), isWC ? (elem.focusIn(), "SM-INPUT" === elem.tagName && "" === elem.value.trim() && elem.showError()) : elem.focus(); break } } }; reset = () => { this.formElements.forEach((([elem, isWC]) => { if (isWC) elem.reset(); else switch (elem.type) { case "checkbox": case "radio": elem.checked = !1; break; default: elem.value = "" } })), this._checkValidity() }; elementsChanged = () => { this.formElements = [...this.querySelectorAll(this.supportedElements)].map((elem => [elem, elem.tagName.includes("-")])), this._requiredElements = this.formElements.filter((([elem]) => elem.hasAttribute("required"))), this.submitButton = this.querySelector('[variant="primary"], [type="submit"]'), this.resetButton = this.querySelector('[type="reset"]'), this.resetButton && this.resetButton.addEventListener("click", this.reset), this._checkValidity() }; connectedCallback() { const updateFormDecedents = this.debounce(this.elementsChanged, 100); this.addEventListener("input", this.debounce(this._checkValidity, 100)), this.addEventListener("keydown", this.debounce(this.handleKeydown, 100)), this.shadowRoot.querySelector("slot").addEventListener("slotchange", updateFormDecedents), this.mutationObserver = new MutationObserver((mutations => { mutations.forEach((mutation => { ("childList" === mutation.type && [...mutation.addedNodes].some((node => 1 === node.nodeType && node.querySelector(this.supportedElements))) || [...mutation.removedNodes].some((node => 1 === node.nodeType && node.querySelector(this.supportedElements)))) && updateFormDecedents() })) })), this.mutationObserver.observe(this, { childList: !0, subtree: !0 }) } attributeChangedCallback(name, oldValue, newValue) { "skip-submit" === name && (this.skipSubmit = null !== newValue) } disconnectedCallback() { this.removeEventListener("input", this.debounce(this._checkValidity, 100)), this.removeEventListener("keydown", this.debounce(this.handleKeydown, 100)), this.mutationObserver.disconnect() } });
+const smInput = document.createElement("template"); smInput.innerHTML = '
', customElements.define("sm-input", class extends HTMLElement { #validationState = { validatedFor: void 0, isValid: !1, errorMessage: "Please fill out this field." }; constructor() { super(), this.attachShadow({ mode: "open" }).append(smInput.content.cloneNode(!0)), this.inputParent = this.shadowRoot.querySelector(".input"), this.input = this.shadowRoot.querySelector("input"), this.clearBtn = this.shadowRoot.querySelector(".clear"), this.label = this.shadowRoot.querySelector(".label"), this.feedbackText = this.shadowRoot.querySelector(".feedback-text"), this.outerContainer = this.shadowRoot.querySelector(".outer-container"), this.optionList = this.shadowRoot.querySelector(".datalist"), this._helperText = "", this.isRequired = !1, this.datalist = [], this.validationFunction = void 0, this.reflectedAttributes = ["value", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "list", "autocomplete"] } static get observedAttributes() { return ["value", "placeholder", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "helper-text", "error-text", "list"] } get value() { return this.input.value } set value(val) { val !== this.input.value && (this.input.value = val, this._value = val, this.checkInput()) } get placeholder() { return this.getAttribute("placeholder") } set placeholder(val) { this.setAttribute("placeholder", val) } get type() { return this.getAttribute("type") } set type(val) { this.setAttribute("type", val) } get validity() { return this.input.validity } get disabled() { return this.hasAttribute("disabled") } set disabled(value) { value ? (this.inputParent.classList.add("disabled"), this.setAttribute("disabled", "")) : (this.inputParent.classList.remove("disabled"), this.removeAttribute("disabled")) } get readOnly() { return this.hasAttribute("readonly") } set readOnly(value) { value ? this.setAttribute("readonly", "") : this.removeAttribute("readonly") } set customValidation(val) { val && (this.validationFunction = val) } set errorText(val) { this.#validationState.errorText = val } showError = (errorText = this.#validationState.errorText) => { this.feedbackText.className = "feedback-text error", this.feedbackText.innerHTML = `
${errorText}` }; set helperText(val) { this._helperText = val } get isValid() { if (this.#validationState.validatedFor === this.input.value) return this.#validationState.isValid; const _isValid = this.input.checkValidity(); let _validity = { isValid: !0, errorText: "" }; return this.validationFunction && (_validity = this.validationFunction(this.input.value)), _isValid && _validity.isValid ? (this.feedbackText.className = "feedback-text success", this.feedbackText.textContent = "") : "" !== this.value.trim() && (_validity.errorText || this.#validationState.errorText) && this.showError(_validity.errorText || this.#validationState.errorText), this.#validationState.validatedFor = this.input.value, this.#validationState.isValid = _isValid && _validity.isValid, this.#validationState.errorText = _validity.errorText || this.#validationState.errorText, this.#validationState.isValid } reset = () => { this.value = "" }; clear = () => { this.value = "", this.input.focus(), this.fireEvent() }; focusIn = () => { this.input.focus() }; focusOut = () => { this.input.blur() }; fireEvent = () => { let event = new Event("input", { bubbles: !0, cancelable: !0, composed: !0 }); this.dispatchEvent(event) }; searchDatalist = searchKey => { const filteredData = this.datalist.filter((item => item.toLowerCase().includes(searchKey.toLowerCase()))); if (filteredData.sort(((a, b) => a.toLowerCase().indexOf(searchKey.toLowerCase()) - b.toLowerCase().indexOf(searchKey.toLowerCase()))), filteredData.length) { if (this.optionList.children.length > filteredData.length) { const optionsToRemove = this.optionList.children.length - filteredData.length; for (let i = 0; i < optionsToRemove; i++)this.optionList.removeChild(this.optionList.lastChild) } filteredData.forEach(((item, index) => { if (this.optionList.children[index]) this.optionList.children[index].textContent = item; else { const option = document.createElement("li"); option.textContent = item, option.classList.add("datalist-item"), option.setAttribute("tabindex", "0"), this.optionList.appendChild(option) } })), this.optionList.classList.remove("hidden") } else this.optionList.classList.add("hidden") }; checkInput = e => { this.hasAttribute("readonly") || ("" !== this.input.value ? this.clearBtn.classList.remove("hidden") : this.clearBtn.classList.add("hidden")), this.hasAttribute("placeholder") && "" !== this.getAttribute("placeholder").trim() && ("" !== this.input.value ? (this.shouldAnimateLabel && this.inputParent.classList.add("animate-placeholder"), this.label.classList.toggle("hidden", !this.shouldAnimateLabel), this.datalist.length && (this.searchTimeout && clearTimeout(this.searchTimeout), this.searchTimeout = setTimeout((() => { this.searchDatalist(this.input.value.trim()) }), 100))) : (this.shouldAnimateLabel && this.inputParent.classList.remove("animate-placeholder"), this.label.classList.remove("hidden"), this.feedbackText.textContent = "", this.datalist.length && (this.optionList.innerHTML = "", this.optionList.classList.add("hidden")))) }; allowOnlyNum = e => { 1 === e.key.length && (("." !== e.key || !e.target.value.includes(".") && 0 !== e.target.value.length) && ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."].includes(e.key) || e.preventDefault()) }; handleOptionClick = e => { this.input.value = e.target.textContent, this.optionList.classList.add("hidden"), this.input.focus() }; handleInputNavigation = e => { "ArrowDown" === e.key ? (e.preventDefault(), this.optionList.children.length && this.optionList.children[0].focus()) : "ArrowUp" === e.key && (e.preventDefault(), this.optionList.children.length && this.optionList.children[this.optionList.children.length - 1].focus()) }; handleDatalistNavigation = e => { "ArrowUp" === e.key ? (e.preventDefault(), this.shadowRoot.activeElement.previousElementSibling ? this.shadowRoot.activeElement.previousElementSibling.focus() : this.input.focus()) : "ArrowDown" === e.key ? (e.preventDefault(), this.shadowRoot.activeElement.nextElementSibling ? this.shadowRoot.activeElement.nextElementSibling.focus() : this.input.focus()) : "Enter" !== e.key && " " !== e.key || (e.preventDefault(), this.input.value = e.target.textContent, this.optionList.classList.add("hidden"), this.input.focus()) }; handleFocus = e => { this.datalist.length && this.searchDatalist(this.input.value.trim()) }; handleBlur = e => { this.datalist.length && this.optionList.classList.add("hidden") }; connectedCallback() { const uuid = crypto.randomUUID(); if (this.input.id = uuid, this.label.htmlFor = uuid, this.shouldAnimateLabel = this.hasAttribute("animate"), this.shouldAnimateLabel && "" !== this.placeholder && this.value && (this.inputParent.classList.add("animate-placeholder"), this.label.classList.remove("hidden")), this.setAttribute("role", "textbox"), "smCompConfig" in window && smCompConfig["sm-input"]) { const config = smCompConfig["sm-input"].find((config => this.matches(config.selector))); this.customValidation = config?.customValidation } this.input.addEventListener("input", this.checkInput), this.clearBtn.addEventListener("click", this.clear), this.datalist.length && (this.optionList.addEventListener("click", this.handleOptionClick), this.input.addEventListener("keydown", this.handleInputNavigation), this.optionList.addEventListener("keydown", this.handleDatalistNavigation)), this.input.addEventListener("focusin", this.handleFocus), this.addEventListener("focusout", this.handleBlur) } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) switch (this.reflectedAttributes.includes(name) && (this.hasAttribute(name) ? this.input.setAttribute(name, this.getAttribute(name) ? this.getAttribute(name) : "") : this.input.removeAttribute(name)), name) { case "placeholder": this.label.textContent = newValue, this.setAttribute("aria-label", newValue); break; case "value": this.checkInput(); break; case "type": this.hasAttribute("type") && "number" === this.getAttribute("type") ? (this.input.setAttribute("inputmode", "decimal"), this.input.addEventListener("keydown", this.allowOnlyNum)) : this.input.removeEventListener("keydown", this.allowOnlyNum); break; case "helper-text": this._helperText = newValue; break; case "error-text": this.#validationState.errorText = newValue; break; case "required": this.isRequired = this.hasAttribute("required"), this.isRequired ? this.setAttribute("aria-required", "true") : this.setAttribute("aria-required", "false"); break; case "readonly": this.hasAttribute("readonly") ? this.inputParent.classList.add("readonly") : this.inputParent.classList.remove("readonly"); break; case "disabled": this.hasAttribute("disabled") ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled"); break; case "list": this.hasAttribute("list") && "" !== this.getAttribute("list").trim() && (this.datalist = this.getAttribute("list").split(",")) } } disconnectedCallback() { this.input.removeEventListener("input", this.checkInput), this.clearBtn.removeEventListener("click", this.clear), this.input.removeEventListener("keydown", this.allowOnlyNum), this.optionList.removeEventListener("click", this.handleOptionClick), this.input.removeEventListener("keydown", this.handleInputNavigation), this.optionList.removeEventListener("keydown", this.handleDatalistNavigation), this.input.removeEventListener("focusin", this.handleFocus), this.removeEventListener("focusout", this.handleBlur) } });
+const smNotifications = document.createElement("template"); smNotifications.innerHTML = "
", customElements.define("sm-notifications", class extends HTMLElement { constructor() { super(), this.shadow = this.attachShadow({ mode: "open" }).append(smNotifications.content.cloneNode(!0)), this.notificationPanel = this.shadowRoot.querySelector(".notification-panel"), this.animationOptions = { duration: 300, fill: "forwards", easing: "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }, this.push = this.push.bind(this), this.createNotification = this.createNotification.bind(this), this.removeNotification = this.removeNotification.bind(this), this.clearAll = this.clearAll.bind(this), this.remove = this.remove.bind(this), this.handleTouchMove = this.handleTouchMove.bind(this), this.startX = 0, this.currentX = 0, this.endX = 0, this.swipeDistance = 0, this.swipeDirection = "", this.swipeThreshold = 0, this.startTime = 0, this.swipeTime = 0, this.swipeTimeThreshold = 200, this.currentTarget = null, this.notificationTimeout = 5e3, this.mediaQuery = window.matchMedia("(min-width: 640px)"), this.handleOrientationChange = this.handleOrientationChange.bind(this), this.isBigViewport = !1 } set timeout(value) { isNaN(value) || (this.notificationTimeout = value) } randString(length) { let result = ""; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let i = 0; i < length; i++)result += characters.charAt(Math.floor(52 * Math.random())); return result } createNotification(message, options = {}) { const { pinned: pinned = !1, icon: icon, action: action, timeout: timeout = this.notificationTimeout } = options, notification = document.createElement("div"); return notification.id = this.randString(8), notification.className = "notification " + (pinned ? "pinned" : ""), notification.style.setProperty("--timeout", `${timeout}ms`), notification.innerHTML = ` ${icon ? `
${icon}
` : ""}
${action ? `
` : ""}
`, action && notification.querySelector(".action").addEventListener("click", action.callback), notification.querySelector(".close").addEventListener("click", (() => { this.removeNotification(notification) })), pinned || setTimeout((() => { this.removeNotification(notification, this.isBigViewport ? "left" : "top") }), timeout), notification } push(message, options = {}) { const notification = this.createNotification(message, options); return this.isBigViewport ? this.notificationPanel.append(notification) : this.notificationPanel.prepend(notification), notification.scrollIntoView({ behavior: "smooth" }), this.notificationPanel.animate([{ transform: `translateY(${this.isBigViewport ? "" : "-"}${notification.clientHeight}px)` }, { transform: "none" }], this.animationOptions), notification.animate([{ transform: "translateY(-1rem)", opacity: "0" }, { transform: "none", opacity: "1" }], this.animationOptions).onfinish = e => { e.target.commitStyles(), e.target.cancel() }, notification.id } removeNotification(notification, direction = "left") { if (!notification) return; const sign = "left" === direction || "top" === direction ? "-" : "+"; this.isBigViewport || "top" !== direction ? notification.animate([{ transform: this.currentX ? `translateX(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateX(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = () => { notification.remove() } : notification.animate([{ transform: this.currentX ? `translateY(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateY(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = () => { notification.remove() } } remove(id) { const notification = this.notificationPanel.querySelector(`#${id}`); notification && this.removeNotification(notification) } clearAll() { Array.from(this.notificationPanel.children).forEach((child => { this.removeNotification(child) })) } handleTouchMove(e) { this.currentX = e.touches[0].clientX - this.startX, this.currentTarget.style.transform = `translateX(${this.currentX}px)` } handleOrientationChange(e) { this.isBigViewport = e.matches, e.matches } connectedCallback() { this.handleOrientationChange(this.mediaQuery), this.mediaQuery.addEventListener("change", this.handleOrientationChange), this.notificationPanel.addEventListener("touchstart", (e => { e.target.closest(".close") ? this.removeNotification(e.target.closest(".notification")) : e.target.closest(".notification") && (this.swipeThreshold = e.target.closest(".notification").getBoundingClientRect().width / 2, this.currentTarget = e.target.closest(".notification"), this.startTime = Date.now(), this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY, this.notificationPanel.addEventListener("touchmove", this.handleTouchMove, { passive: !0 })) }), { passive: !0 }), this.notificationPanel.addEventListener("touchend", (e => { this.endX = e.changedTouches[0].clientX, this.endY = e.changedTouches[0].clientY, this.swipeDistance = Math.abs(this.endX - this.startX), this.swipeTime = Date.now() - this.startTime, this.endX > this.startX ? this.swipeDirection = "right" : this.swipeDirection = "left", this.swipeTime < this.swipeTimeThreshold ? this.swipeDistance > 50 && this.removeNotification(this.currentTarget, this.swipeDirection) : this.swipeDistance > this.swipeThreshold ? this.removeNotification(this.currentTarget, this.swipeDirection) : this.currentTarget.animate([{ transform: `translateX(${this.currentX}px)` }, { transform: "none" }], this.animationOptions).onfinish = e => { e.target.commitStyles(), e.target.cancel() }, this.notificationPanel.removeEventListener("touchmove", this.handleTouchMove), this.currentX = 0 })) } disconnectedCallback() { mediaQueryList.removeEventListener("change", handleOrientationChange) } });
class Stack { constructor() { this.items = [] } push(t) { this.items.push(t) } pop() { return 0 == this.items.length ? "Underflow" : this.items.pop() } peek() { return this.items[this.items.length - 1] } } const popupStack = new Stack, smPopup = document.createElement("template"); smPopup.innerHTML = ` `, customElements.define("sm-popup", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smPopup.content.cloneNode(!0)), this.allowClosing = !1, this.isOpen = !1, this.offset = 0, this.touchStartY = 0, this.touchEndY = 0, this.touchStartTime = 0, this.touchEndTime = 0, this.touchEndAnimation = void 0, this.focusable, this.autoFocus, this.mutationObserver, this.popupContainer = this.shadowRoot.querySelector(".popup-container"), this.backdrop = this.shadowRoot.querySelector(".backdrop"), this.dialogBox = this.shadowRoot.querySelector(".popup"), this.popupBodySlot = this.shadowRoot.querySelector(".popup-body slot"), this.popupHeader = this.shadowRoot.querySelector(".popup-top"), this.resumeScrolling = this.resumeScrolling.bind(this), this.setStateOpen = this.setStateOpen.bind(this), this.show = this.show.bind(this), this.hide = this.hide.bind(this), this.handleTouchStart = this.handleTouchStart.bind(this), this.handleTouchMove = this.handleTouchMove.bind(this), this.handleTouchEnd = this.handleTouchEnd.bind(this), this.detectFocus = this.detectFocus.bind(this), this.handleSoftDismiss = this.handleSoftDismiss.bind(this), this.debounce = this.debounce.bind(this) } static get observedAttributes() { return ["open"] } get open() { return this.isOpen } animateTo(t, e, i) { let s = t.animate(e, { ...i, fill: "both" }); return s.finished.then(() => { s.commitStyles(), s.cancel() }), s } resumeScrolling() { let t = document.body.style.top; window.scrollTo(0, -1 * parseInt(t || "0")), document.body.style.overflow = "", document.body.style.top = "initial" } setStateOpen() { if (!this.isOpen || this.offset) { let t = window.innerWidth > 640 ? "scale(1.1)" : `translateY(${this.offset ? `${this.offset}px` : "100%"})`; this.animateTo(this.dialogBox, [{ opacity: this.offset ? 1 : 0, transform: t }, { opacity: 1, transform: "none" },], { duration: 300, easing: "ease" }) } } show(t = {}) { let { pinned: e = !1, payload: i } = t; if (this.isOpen) return; let s = { duration: 300, easing: "ease" }; return this.payload = i, popupStack.push({ popup: this, permission: e }), popupStack.items.length > 1 && this.animateTo(popupStack.items[popupStack.items.length - 2].popup.shadowRoot.querySelector(".popup"), [{ transform: "none" }, { transform: window.innerWidth > 640 ? "scale(0.95)" : "translateY(-1.5rem)" },], s), this.popupContainer.classList.remove("hide"), this.offset || (this.backdrop.animate([{ opacity: 0 }, { opacity: 1 },], s).onfinish = () => { this.resolveOpen(this.payload) }, this.dispatchEvent(new CustomEvent("popupopened", { bubbles: !0, composed: !0, detail: { payload: this.payload } })), document.body.style.overflow = "hidden", document.body.style.top = `-${window.scrollY}px`), this.setStateOpen(), this.pinned = e, this.isOpen = !0, setTimeout(() => { let t = this.autoFocus || this.focusable?.[0] || this.dialogBox; t && (t.tagName.includes("-") ? t.focusIn() : t.focus()) }, 0), this.hasAttribute("open") || (this.setAttribute("open", ""), this.addEventListener("keydown", this.detectFocus), this.resizeObserver.observe(this), this.mutationObserver.observe(this, { attributes: !0, childList: !0, subtree: !0 }), this.popupHeader.addEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.addEventListener("mousedown", this.handleSoftDismiss)), { opened: new Promise(t => { this.resolveOpen = t }), closed: new Promise(t => { this.resolveClose = t }) } } hide(t = {}) { let { payload: e } = t, i = { duration: 150, easing: "ease" }; this.backdrop.animate([{ opacity: 1 }, { opacity: 0 }], i), this.animateTo(this.dialogBox, [{ opacity: 1, transform: window.innerWidth > 640 ? "none" : `translateY(${this.offset ? `${this.offset}px` : "0"})` }, { opacity: 0, transform: window.innerWidth > 640 ? "scale(1.1)" : "translateY(100%)" },], i).finished.finally(() => { this.popupContainer.classList.add("hide"), this.dialogBox.style = "", this.removeAttribute("open"), this.forms.length && this.forms.forEach(t => t.reset()), this.dispatchEvent(new CustomEvent("popupclosed", { bubbles: !0, composed: !0, detail: { payload: e || this.payload } })), this.resolveClose(e || this.payload), this.isOpen = !1 }), popupStack.pop(), popupStack.items.length ? this.animateTo(popupStack.items[popupStack.items.length - 1].popup.shadowRoot.querySelector(".popup"), [{ transform: window.innerWidth > 640 ? "scale(0.95)" : "translateY(-1.5rem)" }, { transform: "none" },], i) : this.resumeScrolling(), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.removeEventListener("keydown", this.detectFocus), this.popupHeader.removeEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.removeEventListener("mousedown", this.handleSoftDismiss) } handleTouchStart(t) { this.offset = 0, this.popupHeader.addEventListener("touchmove", this.handleTouchMove, { passive: !0 }), this.popupHeader.addEventListener("touchend", this.handleTouchEnd, { passive: !0 }), this.touchStartY = t.changedTouches[0].clientY, this.touchStartTime = t.timeStamp } handleTouchMove(t) { this.touchStartY < t.changedTouches[0].clientY && (this.offset = t.changedTouches[0].clientY - this.touchStartY, this.touchEndAnimation = window.requestAnimationFrame(() => { this.dialogBox.style.transform = `translateY(${this.offset}px)` })) } handleTouchEnd(t) { if (this.touchEndTime = t.timeStamp, cancelAnimationFrame(this.touchEndAnimation), this.touchEndY = t.changedTouches[0].clientY, this.threshold = .3 * this.dialogBox.getBoundingClientRect().height, this.touchEndTime - this.touchStartTime > 200) { if (this.touchEndY - this.touchStartY > this.threshold) { if (this.pinned) { this.setStateOpen(); return } this.hide() } else this.setStateOpen() } else if (this.touchEndY > this.touchStartY) { if (this.pinned) { this.setStateOpen(); return } this.hide() } this.popupHeader.removeEventListener("touchmove", this.handleTouchMove, { passive: !0 }), this.popupHeader.removeEventListener("touchend", this.handleTouchEnd, { passive: !0 }) } detectFocus(t) { if ("Tab" === t.key && this.focusable.length) { if (!this.firstFocusable) { for (let e = 0; e < this.focusable.length; e++)if (!this.focusable[e].disabled) { this.firstFocusable = this.focusable[e]; break } } if (!this.lastFocusable) { for (let i = this.focusable.length - 1; i >= 0; i--)if (!this.focusable[i].disabled) { this.lastFocusable = this.focusable[i]; break } } t.shiftKey && document.activeElement === this.firstFocusable ? (t.preventDefault(), this.lastFocusable.tagName.includes("SM-") ? this.lastFocusable.focusIn() : this.lastFocusable.focus()) : t.shiftKey || document.activeElement !== this.lastFocusable || (t.preventDefault(), this.firstFocusable.tagName.includes("SM-") ? this.firstFocusable.focusIn() : this.firstFocusable.focus()) } } updateFocusableList() { this.focusable = this.querySelectorAll('sm-button:not([disabled]), button:not([disabled]), [href], sm-input, input:not([readonly]), sm-select, select, sm-checkbox, sm-textarea, textarea, [tabindex]:not([tabindex="-1"])'), this.autoFocus = this.querySelector("[autofocus]"), this.firstFocusable = null, this.lastFocusable = null } handleSoftDismiss() { this.pinned ? this.dialogBox.animate([{ transform: "translateX(-1rem)" }, { transform: "translateX(1rem)" }, { transform: "translateX(-0.5rem)" }, { transform: "translateX(0.5rem)" }, { transform: "translateX(0)" },], { duration: 300, easing: "ease" }) : this.hide() } debounce(t, e) { let i = null; return (...s) => { window.clearTimeout(i), i = window.setTimeout(() => { t.apply(null, s) }, e) } } connectedCallback() { this.popupBodySlot.addEventListener("slotchange", this.debounce(() => { this.forms = this.querySelectorAll("sm-form"), this.updateFocusableList() }, 0)), this.resizeObserver = new ResizeObserver(t => { t.forEach(t => { if (t.contentBoxSize) { let e = Array.isArray(t.contentBoxSize) ? t.contentBoxSize[0] : t.contentBoxSize; this.threshold = .3 * e.blockSize.height } else this.threshold = .3 * t.contentRect.height }) }), this.mutationObserver = new MutationObserver(t => { this.updateFocusableList() }) } disconnectedCallback() { this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.removeEventListener("keydown", this.detectFocus), this.popupHeader.removeEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.removeEventListener("mousedown", this.handleSoftDismiss) } attributeChangedCallback(t) { "open" === t && this.hasAttribute("open") && this.show() } });
+const smSelect = document.createElement("template"); smSelect.innerHTML = '
', customElements.define("sm-select", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smSelect.content.cloneNode(!0)), this.focusIn = this.focusIn.bind(this), this.reset = this.reset.bind(this), this.open = this.open.bind(this), this.collapse = this.collapse.bind(this), this.toggle = this.toggle.bind(this), this.handleOptionsNavigation = this.handleOptionsNavigation.bind(this), this.handleOptionSelection = this.handleOptionSelection.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.handleClickOutside = this.handleClickOutside.bind(this), this.selectOption = this.selectOption.bind(this), this.debounce = this.debounce.bind(this), this.elementsChanged = this.elementsChanged.bind(this), this.availableOptions = [], this.previousOption, this.isOpen = !1, this.label = "", this.defaultSelected = "", this.isUnderViewport = !1, this.animationOptions = { duration: 300, fill: "forwards", easing: "ease" }, this.optionList = this.shadowRoot.querySelector(".options"), this.selection = this.shadowRoot.querySelector(".selection"), this.selectedOptionText = this.shadowRoot.querySelector(".selected-option-text") } static get observedAttributes() { return ["disabled", "label", "readonly"] } get value() { return this.getAttribute("value") } set value(t) { const e = this.availableOptions.find(e => e.getAttribute("value") === t); e ? (this.setAttribute("value", t), this.selectOption(e)) : console.warn(`There is no option with ${t} as value`) } debounce(t, e) { let n = null; return (...i) => { window.clearTimeout(n), n = window.setTimeout(() => { t.apply(null, i) }, e) } } reset(t = !0) { if (this.availableOptions[0] && this.previousOption !== this.availableOptions[0]) { const e = this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]; this.value = e.getAttribute("value"), t && this.fireEvent() } } selectOption(t) { this.previousOption !== t && (this.querySelectorAll("[selected").forEach(t => t.removeAttribute("selected")), this.selectedOptionText.textContent = `${this.label}${t.textContent}`, t.setAttribute("selected", ""), this.previousOption = t) } focusIn() { this.selection.focus() } open() { this.availableOptions.forEach(t => t.setAttribute("tabindex", 0)), this.optionList.classList.remove("hidden"), this.isUnderViewport = this.getBoundingClientRect().bottom + this.optionList.getBoundingClientRect().height > window.innerHeight, this.isUnderViewport ? this.setAttribute("isUnder", "") : this.removeAttribute("isUnder"), this.optionList.animate([{ transform: `translateY(${this.isUnderViewport ? "" : "-"}0.5rem)`, opacity: 0 }, { transform: "translateY(0)", opacity: 1 }], this.animationOptions), this.setAttribute("open", ""), this.style.zIndex = 1e3, (this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]).focus(), document.addEventListener("mousedown", this.handleClickOutside), this.isOpen = !0 } collapse() { this.removeAttribute("open"), this.optionList.animate([{ transform: "translateY(0)", opacity: 1 }, { transform: `translateY(${this.isUnderViewport ? "" : "-"}0.5rem)`, opacity: 0 }], this.animationOptions).onfinish = (() => { this.availableOptions.forEach(t => t.removeAttribute("tabindex")), document.removeEventListener("mousedown", this.handleClickOutside), this.optionList.classList.add("hidden"), this.isOpen = !1, this.style.zIndex = "auto" }) } toggle() { this.isOpen || this.hasAttribute("disabled") ? this.collapse() : this.open() } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this.value } })) } handleOptionsNavigation(t) { "ArrowUp" === t.key ? (t.preventDefault(), document.activeElement.previousElementSibling ? document.activeElement.previousElementSibling.focus() : this.availableOptions[this.availableOptions.length - 1].focus()) : "ArrowDown" === t.key && (t.preventDefault(), document.activeElement.nextElementSibling ? document.activeElement.nextElementSibling.focus() : this.availableOptions[0].focus()) } handleOptionSelection(t) { this.previousOption !== document.activeElement && (this.value = document.activeElement.getAttribute("value"), this.fireEvent()) } handleClick(t) { t.target === this ? this.toggle() : (this.handleOptionSelection(), this.collapse()) } handleKeydown(t) { t.target === this ? this.isOpen && "ArrowDown" === t.key ? (t.preventDefault(), (this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]).focus(), this.handleOptionSelection(t)) : " " === t.key && (t.preventDefault(), this.toggle()) : (this.handleOptionsNavigation(t), this.handleOptionSelection(t), ["Enter", " ", "Escape", "Tab"].includes(t.key) && (t.preventDefault(), this.collapse(), this.focusIn())) } handleClickOutside(t) { this.isOpen && !this.contains(t.target) && this.collapse() } elementsChanged() { this.availableOptions = [...this.querySelectorAll("sm-option")], this.reset(!1), this.defaultSelected = this.value } connectedCallback() { this.setAttribute("role", "listbox"), this.hasAttribute("disabled") || this.hasAttribute("readonly") || (this.selection.setAttribute("tabindex", "0"), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown)); const t = this.debounce(this.elementsChanged, 100); this.shadowRoot.querySelector("slot").addEventListener("slotchange", t), this.mutationObserver = new MutationObserver(e => { let n = !1; if (e.forEach(e => { switch (e.type) { case "childList": t(); break; case "attributes": n = !0 } }), n) { const t = this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]; this.selectedOptionText.textContent = `${this.label}${t.textContent}`, this.setAttribute("value", t.getAttribute("value")) } }), this.mutationObserver.observe(this, { subtree: !0, childList: !0, attributeFilter: ["selected"] }), new IntersectionObserver((t, e) => { t.forEach(t => { if (t.isIntersecting) { const t = this.selection.getBoundingClientRect().left; t < window.innerWidth / 2 ? this.setAttribute("align-select", "left") : this.setAttribute("align-select", "right") } }) }).observe(this) } disconnectedCallback() { this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown) } attributeChangedCallback(t) { "disabled" === t || "readonly" === t ? this.hasAttribute("disabled") || this.hasAttribute("readonly") ? (this.selection.removeAttribute("tabindex"), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown)) : (this.selection.setAttribute("tabindex", "0"), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown)) : "label" === t && (this.label = this.hasAttribute("label") ? `${this.getAttribute("label")} ` : "") } }); const smOption = document.createElement("template"); smOption.innerHTML = '
', customElements.define("sm-option", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smOption.content.cloneNode(!0)) } connectedCallback() { this.setAttribute("role", "option") } });
const spinner = document.createElement("template"); spinner.innerHTML = '
'; class SpinnerLoader extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(spinner.content.cloneNode(!0)) } } window.customElements.define("sm-spinner", SpinnerLoader);
const themeToggle = document.createElement("template"); themeToggle.innerHTML = '
'; class ThemeToggle extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(themeToggle.content.cloneNode(!0)), this.isChecked = !1, this.hasTheme = "light", this.toggleState = this.toggleState.bind(this), this.fireEvent = this.fireEvent.bind(this), this.handleThemeChange = this.handleThemeChange.bind(this) } static get observedAttributes() { return ["checked"] } daylight() { this.hasTheme = "light", document.body.dataset.theme = "light", this.setAttribute("aria-checked", "false") } nightlight() { this.hasTheme = "dark", document.body.dataset.theme = "dark", this.setAttribute("aria-checked", "true") } toggleState() { if (!document.startViewTransition) return this.toggleAttribute("checked"), void this.fireEvent(); document.startViewTransition(() => { this.toggleAttribute("checked"), this.fireEvent() }) } handleKeyDown(e) { " " === e.key && this.toggleState() } handleThemeChange(e) { e.detail.theme !== this.hasTheme && ("dark" === e.detail.theme ? this.setAttribute("checked", "") : this.removeAttribute("checked")) } fireEvent() { this.dispatchEvent(new CustomEvent("themechange", { bubbles: !0, composed: !0, detail: { theme: this.hasTheme } })) } connectedCallback() { this.setAttribute("role", "switch"), this.setAttribute("aria-label", "theme toggle"), "dark" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.nightlight(), this.setAttribute("checked", "")) : "light" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.daylight(), this.removeAttribute("checked")) : window.matchMedia("(prefers-color-scheme: dark)").matches ? (this.nightlight(), this.setAttribute("checked", "")) : (this.daylight(), this.removeAttribute("checked")), this.addEventListener("click", this.toggleState), this.addEventListener("keydown", this.handleKeyDown), document.addEventListener("themechange", this.handleThemeChange) } disconnectedCallback() { this.removeEventListener("click", this.toggleState), this.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("themechange", this.handleThemeChange) } attributeChangedCallback(e, t, n) { "checked" === e && (this.hasAttribute("checked") ? (this.nightlight(), localStorage.setItem(`${window.location.hostname}-theme`, "dark")) : (this.daylight(), localStorage.setItem(`${window.location.hostname}-theme`, "light"))) } } window.customElements.define("theme-toggle", ThemeToggle);
\ No newline at end of file