diff --git a/components/css/main.css b/components/css/main.css index 9536427..a1950a4 100644 --- a/components/css/main.css +++ b/components/css/main.css @@ -17,10 +17,9 @@ html, body { body { --accent-color: #4d2588; --text-color: 17, 17, 17; - --text-color-light: 100, 100, 100; --foreground-color: 255, 255, 255; --background-color: #F6f6f6; - --error-color: red; + --danger-color: red; color: rgba(var(--text-color), 1); background: var(--background-color); } @@ -31,44 +30,12 @@ body[data-theme=dark] { --text-color-light: 170, 170, 170; --foreground-color: 20, 20, 20; --background-color: #0a0a0a; - --error-color: rgb(255, 106, 106); -} - -.full-bleed { - grid-column: 1/4; -} - -.h1 { - font-size: 2.5rem; -} - -.h2 { - font-size: 2rem; -} - -.h3 { - font-size: 1.4rem; -} - -.h4 { - font-size: 1rem; -} - -.h5 { - font-size: 0.8rem; -} - -.uppercase { - text-transform: uppercase; -} - -.capitalize { - text-transform: capitalize; + --danger-color: rgb(255, 106, 106); } p { font-size: 0.8; - max-width: 75ch; + max-width: 65ch; line-height: 1.7; margin-bottom: 1.5rem; color: rgba(var(--text-color), 0.8); @@ -146,6 +113,38 @@ ul { hyphens: auto; } +.full-bleed { + grid-column: 1/4; +} + +.h1 { + font-size: 2.5rem; +} + +.h2 { + font-size: 2rem; +} + +.h3 { + font-size: 1.4rem; +} + +.h4 { + font-size: 1rem; +} + +.h5 { + font-size: 0.8rem; +} + +.uppercase { + text-transform: uppercase; +} + +.capitalize { + text-transform: capitalize; +} + .flex { display: flex; } @@ -381,11 +380,10 @@ pre { } code { - font-family: "Roboto Mono", monospace; - border-radius: 0.2rem; + border-radius: 0.3rem; font-weight: 400; padding: 0.2rem 0.4rem; - background: rgba(var(--text-color), 0.04); + background: rgba(var(--text-color), 0.1); } code > * { @@ -500,6 +498,8 @@ sm-tab-header { ol { padding: 0.6rem 1rem; + max-width: 75ch; + margin-bottom: 3rem; } ol li { margin-bottom: 1rem; @@ -511,6 +511,15 @@ ol li::first-letter { text-transform: capitalize; } +strong.important { + display: flex; + padding: 0.5rem; + margin: 0.5rem 0; + border-radius: 0.3rem; + color: rgba(0, 0, 0, 0.8); + background-color: khaki; +} + #total_components_count { font-size: 4rem; } @@ -574,6 +583,10 @@ ol li::first-letter { grid-column: 2/3; } + .page__title { + font-size: 2rem; + } + #overview_page { display: grid; gap: 1.5rem; diff --git a/components/css/main.min.css b/components/css/main.min.css index b8640a7..d207a38 100644 --- a/components/css/main.min.css +++ b/components/css/main.min.css @@ -1 +1 @@ -.weight-400,code{font-weight:400}.hide,.ripple{pointer-events:none}.list,ul{list-style:none}*{padding:0;margin:0;box-sizing:border-box;font-family:Roboto,sans-serif}code,code>*{font-family:"Roboto Mono",monospace}:root{font-size:clamp(1rem,1.2vmax,3rem)}body,html{height:100%;scroll-behavior:smooth}body{--accent-color:#4d2588;--text-color:17,17,17;--text-color-light:100,100,100;--foreground-color:255,255,255;--background-color:#F6f6f6;--error-color:red;color:rgba(var(--text-color),1);background:var(--background-color)}body[data-theme=dark]{--accent-color:#976dd6;--text-color:240,240,240;--text-color-light:170,170,170;--foreground-color:20,20,20;--background-color:#0a0a0a;--error-color:rgb(255, 106, 106)}.full-bleed{grid-column:1/4}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.uppercase{text-transform:uppercase}.capitalize,.list__item,h2,ol li::first-letter{text-transform:capitalize}p{font-size:.8;max-width:75ch;line-height:1.7;margin-bottom:1.5rem;color:rgba(var(--text-color),.8)}p:not(:last-of-type){margin-bottom:1rem}img{object-fit:cover}a{color:inherit;text-decoration:none}a:focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color),1) inset}button{display:inline-flex;border:none;background-color:inherit}a:any-link:focus-visible{outline:solid rgba(var(--text-color),1)}sm-button{--border-radius:0.3rem}.hide{opacity:0}.hide-completely{display:none!important}.no-transformations{transform:none!important}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.breakable{overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.flex{display:flex}.grid{display:grid}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.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}.align-start{align-items:flex-start}.align-center{align-items:center}.text-center{text-align:center}.justify-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.button__icon--right,.comp-checkbox__title{margin-left:.5rem}.align-self-center{align-self:center}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color),.8)}.weight-500{font-weight:500}.ripple{position:absolute;border-radius:50%;transform:scale(0);background:rgba(var(--text-color),.16)}.interact,.theme-switcher{position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent}code,pre{background:rgba(var(--text-color),.04)}.interact{overflow:hidden}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.icon{width:1.5rem;height:1.5rem;fill:rgba(var(--text-color),.9)}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.theme-switcher{justify-self:flex-end;width:1.5rem;height:1.5rem}.card,.list{flex-direction:column}.theme-switcher .icon{position:absolute;transition:transform .6s}.theme-switcher__checkbox{display:none}.theme-switcher__checkbox:checked~.moon-icon{transform:scale(0) rotate(90deg)}.theme-switcher__checkbox:not(:checked)~.sun-icon{transform:scale(0) rotate(-90deg)}code .str,pre .str{color:#65B042}code .kwd,pre .kwd{color:#E28964}code .com,pre .com{color:#AEAEAE;font-style:italic}code .typ,pre .typ{color:#4395ff}code .lit,pre .lit{color:#1a76c2}code .pln,code .pun,pre .pln,pre .pun{color:rgba(var(--text-color),.8)}code .tag,pre .tag{color:#22863a}code .atn,pre .atn{color:#005cc5}code .atv,pre .atv{color:var(--accent-color)}code .dec,pre .dec{color:#3387CC}pre{max-width:100%;margin:1rem 0;padding:0 1.5rem;overflow-x:auto;font-size:.9rem;white-space:pre-line;border-radius:.5rem}code{border-radius:.2rem;padding:.2rem .4rem}pre code{line-height:1.4;border-radius:none;background:0 0;width:100%}h1,h2,h3,h4.h5{font-family:Poppins,sans-serif}h2{margin:3rem 0 1rem}h2:first-of-type{margin-top:1rem}main{display:grid;height:100%}.card,.list,.list__item,.page{display:flex}#main_header{padding:.5rem 1.5rem;border-bottom:1px solid rgba(var(--text-color),.1)}#side_nav_button{padding:.5rem;margin-left:-.5rem}#backdrop{position:fixed;z-index:4;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5)}#side_nav,.right{max-height:100%;overflow-y:auto;padding-bottom:3rem}#side_nav h4,.right{padding:1.5rem}#side_nav h4{font-size:.9rem;letter-spacing:.08em;text-transform:uppercase}.right h1{margin-bottom:1.5rem}.list{margin-bottom:.8rem}ol li,sm-carousel{margin-bottom:1rem}.list__item{padding:.8rem 1.5rem}.list__item--active{color:var(--accent-color);background:rgba(var(--text-color),.06)}.card{margin-right:1rem;border-radius:.4rem;padding:1.5rem;min-width:min(24rem,80%);background-color:rgba(var(--text-color),.06)}sm-tab-header{margin-bottom:1.5rem}.page{flex-direction:column;padding-bottom:3rem}ol{padding:.6rem 1rem}ol li:last-of-type{margin-bottom:0}#total_components_count{font-size:4rem}#components_selection_list{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));padding:1.5rem 0 3rem}@media screen and (max-width:640px){main{grid-template-rows:auto 1fr;grid-template-columns:1fr}#side_nav{display:flex;flex-direction:column;position:fixed;z-index:5;height:100%;width:calc(100% - 4rem);transition:transform .3s;background-color:rgba(var(--foreground-color),1);box-shadow:.5rem 0 2rem rgba(0,0,0,.1)}#side_nav:not(.reveal){transform:translateX(-100%)}.reveal{transform:none}}@media screen and (min-width:640px){#main_header{padding:1rem 1.5rem;grid-area:main-header}#side_nav_button{display:none}main{grid-template-columns:14rem minmax(0,1fr);grid-template-areas:"main-header main-header" ". ."}.right{display:grid;grid-template-columns:1fr 90% 1fr}.right>*{grid-column:2/3}#overview_page{display:grid;gap:1.5rem;grid-template-columns:1fr auto}#overview_page>div:first-of-type{grid-column:2/3;text-align:right}#overview_page>div:nth-of-type(2){grid-row:1/2}}@media (any-hover:hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color),.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color),.5)}.list__item:hover{background:rgba(var(--text-color),.1);cursor:pointer}} \ No newline at end of file +.hide,.ripple{pointer-events:none}.list,ul{list-style:none}*{padding:0;margin:0;box-sizing:border-box;font-family:Roboto,sans-serif}:root{font-size:clamp(1rem,1.2vmax,3rem)}body,html{height:100%;scroll-behavior:smooth}body{--accent-color:#4d2588;--text-color:17,17,17;--foreground-color:255,255,255;--background-color:#F6f6f6;--danger-color:red;color:rgba(var(--text-color),1);background:var(--background-color)}body[data-theme=dark]{--accent-color:#976dd6;--text-color:240,240,240;--text-color-light:170,170,170;--foreground-color:20,20,20;--background-color:#0a0a0a;--danger-color:rgb(255, 106, 106)}p{font-size:.8;max-width:65ch;line-height:1.7;margin-bottom:1.5rem;color:rgba(var(--text-color),.8)}p:not(:last-of-type){margin-bottom:1rem}img{object-fit:cover}a{color:inherit;text-decoration:none}a:focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color),1) inset}button{display:inline-flex;border:none;background-color:inherit}a:any-link:focus-visible{outline:solid rgba(var(--text-color),1)}sm-button{--border-radius:0.3rem}.hide{opacity:0}.hide-completely{display:none!important}.no-transformations{transform:none!important}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.breakable{overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.full-bleed{grid-column:1/4}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.uppercase{text-transform:uppercase}.capitalize,.list__item,h2,ol li::first-letter{text-transform:capitalize}.flex{display:flex}.grid{display:grid}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.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}.align-start{align-items:flex-start}.align-center{align-items:center}.text-center{text-align:center}.justify-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-center{align-self:center}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color),.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.ripple{position:absolute;border-radius:50%;transform:scale(0);background:rgba(var(--text-color),.16)}.interact,.theme-switcher{position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent}.interact{overflow:hidden}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.icon{width:1.5rem;height:1.5rem;fill:rgba(var(--text-color),.9)}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.button__icon--right{margin-left:.5rem}.theme-switcher{justify-self:flex-end;width:1.5rem;height:1.5rem}.card,.list{flex-direction:column}.theme-switcher .icon{position:absolute;transition:transform .6s}.theme-switcher__checkbox{display:none}.theme-switcher__checkbox:checked~.moon-icon{transform:scale(0) rotate(90deg)}.theme-switcher__checkbox:not(:checked)~.sun-icon{transform:scale(0) rotate(-90deg)}code .str,pre .str{color:#65B042}code .kwd,pre .kwd{color:#E28964}code .com,pre .com{color:#AEAEAE;font-style:italic}code .typ,pre .typ{color:#4395ff}code .lit,pre .lit{color:#1a76c2}code .pln,code .pun,pre .pln,pre .pun{color:rgba(var(--text-color),.8)}code .tag,pre .tag{color:#22863a}code .atn,pre .atn{color:#005cc5}code .atv,pre .atv{color:var(--accent-color)}code .dec,pre .dec{color:#3387CC}pre{max-width:100%;margin:1rem 0;padding:0 1.5rem;overflow-x:auto;font-size:.9rem;white-space:pre-line;border-radius:.5rem;background:rgba(var(--text-color),.04)}code{border-radius:.3rem;font-weight:400;padding:.2rem .4rem;background:rgba(var(--text-color),.1)}code>*{font-family:"Roboto Mono",monospace}pre code{line-height:1.4;border-radius:none;background:0 0;width:100%}h1,h2,h3,h4.h5{font-family:Poppins,sans-serif}h2{margin:3rem 0 1rem}h2:first-of-type{margin-top:1rem}main{display:grid;height:100%}.card,.list,.list__item,.page,strong.important{display:flex}#main_header{padding:.5rem 1.5rem;border-bottom:1px solid rgba(var(--text-color),.1)}#side_nav_button{padding:.5rem;margin-left:-.5rem}#backdrop{position:fixed;z-index:4;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5)}#side_nav,.right{max-height:100%;overflow-y:auto;padding-bottom:3rem}#side_nav h4,.right{padding:1.5rem}#side_nav h4{font-size:.9rem;letter-spacing:.08em;text-transform:uppercase}.right h1{margin-bottom:1.5rem}.list{margin-bottom:.8rem}ol li,sm-carousel{margin-bottom:1rem}.list__item{padding:.8rem 1.5rem}.list__item--active{color:var(--accent-color);background:rgba(var(--text-color),.06)}.card{margin-right:1rem;border-radius:.4rem;padding:1.5rem;min-width:min(24rem,80%);background-color:rgba(var(--text-color),.06)}sm-tab-header{margin-bottom:1.5rem}.page{flex-direction:column;padding-bottom:3rem}ol{padding:.6rem 1rem;max-width:75ch;margin-bottom:3rem}ol li:last-of-type{margin-bottom:0}strong.important{padding:.5rem;margin:.5rem 0;border-radius:.3rem;color:rgba(0,0,0,.8);background-color:khaki}#total_components_count{font-size:4rem}#components_selection_list{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));padding:1.5rem 0 3rem}.comp-checkbox__title{margin-left:.5rem}@media screen and (max-width:640px){main{grid-template-rows:auto 1fr;grid-template-columns:1fr}#side_nav{display:flex;flex-direction:column;position:fixed;z-index:5;height:100%;width:calc(100% - 4rem);transition:transform .3s;background-color:rgba(var(--foreground-color),1);box-shadow:.5rem 0 2rem rgba(0,0,0,.1)}#side_nav:not(.reveal){transform:translateX(-100%)}.reveal{transform:none}}@media screen and (min-width:640px){#main_header{padding:1rem 1.5rem;grid-area:main-header}#side_nav_button{display:none}main{grid-template-columns:14rem minmax(0,1fr);grid-template-areas:"main-header main-header" ". ."}.right{display:grid;grid-template-columns:1fr 90% 1fr}.right>*{grid-column:2/3}.page__title{font-size:2rem}#overview_page{display:grid;gap:1.5rem;grid-template-columns:1fr auto}#overview_page>div:first-of-type{grid-column:2/3;text-align:right}#overview_page>div:nth-of-type(2){grid-row:1/2}}@media (any-hover:hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color),.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color),.5)}.list__item:hover{background:rgba(var(--text-color),.1);cursor:pointer}} \ No newline at end of file diff --git a/components/css/main.scss b/components/css/main.scss index 3d5dc29..6fff9b5 100644 --- a/components/css/main.scss +++ b/components/css/main.scss @@ -14,10 +14,9 @@ html, body{ body { --accent-color: #4d2588; --text-color: 17, 17, 17; - --text-color-light: 100, 100, 100; --foreground-color: 255, 255, 255; --background-color: #F6f6f6; - --error-color: red; + --danger-color: red; color: rgba(var(--text-color), 1); background: var(--background-color); } @@ -27,37 +26,11 @@ body[data-theme='dark']{ --text-color-light: 170, 170, 170; --foreground-color: 20, 20, 20; --background-color: #0a0a0a; - --error-color: rgb(255, 106, 106); + --danger-color: rgb(255, 106, 106); } -.full-bleed{ - grid-column: 1/4; -} -.h1{ - font-size: 2.5rem; -} -.h2{ - font-size: 2rem; -} -.h3{ - font-size: 1.4rem; -} -.h4{ - font-size: 1rem; -} -.h5{ - font-size: 0.8rem; -} - -.uppercase{ - text-transform: uppercase; -} -.capitalize{ - text-transform: capitalize; -} - p { font-size: 0.8; - max-width: 75ch; + max-width: 65ch; line-height: 1.7; margin-bottom: 1.5rem; color: rgba(var(--text-color), 0.8); @@ -124,6 +97,31 @@ ul{ -webkit-hyphens: auto; hyphens: auto; } +.full-bleed{ + grid-column: 1/4; +} +.h1{ + font-size: 2.5rem; +} +.h2{ + font-size: 2rem; +} +.h3{ + font-size: 1.4rem; +} +.h4{ + font-size: 1rem; +} +.h5{ + font-size: 0.8rem; +} + +.uppercase{ + text-transform: uppercase; +} +.capitalize{ + text-transform: capitalize; +} .flex{ display: flex; } @@ -286,11 +284,10 @@ pre{ background: rgba(var(--text-color), .04); } code{ - font-family: 'Roboto Mono', monospace; - border-radius: 0.2rem; + border-radius: 0.3rem; font-weight: 400; padding: 0.2rem 0.4rem; - background: rgba(var(--text-color), .04); + background: rgba(var(--text-color), .1); } code > *{ font-family: 'Roboto Mono', monospace; @@ -391,6 +388,8 @@ sm-tab-header{ } ol{ padding: 0.6rem 1rem; + max-width: 75ch; + margin-bottom: 3rem; li{ margin-bottom: 1rem; &:last-of-type{ @@ -401,6 +400,14 @@ ol{ } } } +strong.important{ + display: flex; + padding: 0.5rem; + margin: 0.5rem 0; + border-radius: 0.3rem; + color: rgba(0,0,0, 0.8); + background-color: khaki; +} #total_components_count{ font-size: 4rem; } @@ -455,6 +462,9 @@ ol{ grid-column: 2/3; } } + .page__title{ + font-size: 2rem; + } #overview_page{ display: grid; gap: 1.5rem; diff --git a/components/dist/button.js b/components/dist/button.js index bdb925a..1adb003 100644 --- a/components/dist/button.js +++ b/components/dist/button.js @@ -11,6 +11,11 @@ smButton.innerHTML = ` display: -webkit-inline-box; display: -ms-inline-flexbox; display: inline-flex; + --accent-color: #4d2588; + --text-color: 17, 17, 17; + --foreground-color: 255, 255, 255; + --background-color: #F6f6f6; + --danger-color: red; --padding: 0.6rem 1.2rem; --border-radius: 0.3rem; --background: rgba(var(--text-color), 0.1); diff --git a/components/dist/button.min.js b/components/dist/button.min.js index a824f4a..566aa98 100644 --- a/components/dist/button.min.js +++ b/components/dist/button.min.js @@ -1 +1 @@ -const smButton=document.createElement("template");smButton.innerHTML="\n\n",customElements.define("sm-button",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smButton.content.cloneNode(!0))}get disabled(){return this.isDisabled}set disabled(n){n&&!this.isDisabled?(this.isDisabled=!0,this.setAttribute("disabled",""),this.button.removeAttribute("tabindex")):!n&&this.isDisabled&&(this.isDisabled=!1,this.removeAttribute("disabled"))}dispatch(){this.isDisabled?this.dispatchEvent(new CustomEvent("disabled",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("clicked",{bubbles:!0,composed:!0}))}connectedCallback(){this.isDisabled=!1,this.button=this.shadowRoot.querySelector(".button"),this.hasAttribute("disabled")&&!this.isDisabled&&(this.isDisabled=!0),this.addEventListener("click",n=>{this.dispatch()})}}); \ No newline at end of file +const smButton=document.createElement("template");smButton.innerHTML="\n\n",customElements.define("sm-button",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smButton.content.cloneNode(!0))}get disabled(){return this.isDisabled}set disabled(n){n&&!this.isDisabled?(this.isDisabled=!0,this.setAttribute("disabled",""),this.button.removeAttribute("tabindex")):!n&&this.isDisabled&&(this.isDisabled=!1,this.removeAttribute("disabled"))}dispatch(){this.isDisabled?this.dispatchEvent(new CustomEvent("disabled",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("clicked",{bubbles:!0,composed:!0}))}connectedCallback(){this.isDisabled=!1,this.button=this.shadowRoot.querySelector(".button"),this.hasAttribute("disabled")&&!this.isDisabled&&(this.isDisabled=!0),this.addEventListener("click",n=>{this.dispatch()})}}); \ No newline at end of file diff --git a/components/dist/carousel.js b/components/dist/carousel.js index b03b561..75730a0 100644 --- a/components/dist/carousel.js +++ b/components/dist/carousel.js @@ -11,6 +11,11 @@ smCarousel.innerHTML = ` display: -webkit-box; display: -ms-flexbox; display: flex; + --accent-color: #4d2588; + --text-color: 17, 17, 17; + --foreground-color: 255, 255, 255; + --background-color: #F6f6f6; + --danger-color: red; --arrow-left: 1rem; --arrow-right: 1rem; --arrow-top: auto; diff --git a/components/dist/carousel.min.js b/components/dist/carousel.min.js index 58c4643..a52d866 100644 --- a/components/dist/carousel.min.js +++ b/components/dist/carousel.min.js @@ -1 +1 @@ -const smCarousel=document.createElement("template");smCarousel.innerHTML='\n\n
${n}
\n `,i&&(e.classList.add("pinned"),a+='\n \n '),e.innerHTML=a,e}push(n,t={}){const i=this.createNotification(n,t);this.notificationPanel.append(i),i.animate([{transform:"translateY(1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions)}removeNotification(n){n.animate([{transform:"none",opacity:"1"},{transform:"translateY(0.5rem)",opacity:"0"}],this.animationOptions).onfinish=(()=>{n.remove()})}clearAll(){Array.from(this.notificationPanel.children).forEach(n=>{this.removeNotification(n)})}connectedCallback(){this.notificationPanel.addEventListener("click",n=>{n.target.closest(".close")&&this.removeNotification(n.target.closest(".notification"))});const n=new MutationObserver(n=>{n.forEach(n=>{"childList"===n.type&&n.addedNodes.length&&!n.addedNodes[0].classList.contains("pinned")&&setTimeout(()=>{this.removeNotification(n.addedNodes[0])},5e3)})});n.observe(this.notificationPanel,{childList:!0})}}); \ No newline at end of file +const smNotifications=document.createElement("template");smNotifications.innerHTML='\n\n\n',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)}createNotification(n,o){const{pinned:t=!1,icon:i=""}=o,e=document.createElement("div");e.classList.add("notification");let a="";return a+=`\n${n}
\n `,t&&(e.classList.add("pinned"),a+='\n \n '),e.innerHTML=a,e}push(n,o={}){const t=this.createNotification(n,o);this.notificationPanel.append(t),t.animate([{transform:"translateY(1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions)}removeNotification(n){n.animate([{transform:"none",opacity:"1"},{transform:"translateY(0.5rem)",opacity:"0"}],this.animationOptions).onfinish=(()=>{n.remove()})}clearAll(){Array.from(this.notificationPanel.children).forEach(n=>{this.removeNotification(n)})}connectedCallback(){this.notificationPanel.addEventListener("click",n=>{n.target.closest(".close")&&this.removeNotification(n.target.closest(".notification"))});const n=new MutationObserver(n=>{n.forEach(n=>{"childList"===n.type&&n.addedNodes.length&&!n.addedNodes[0].classList.contains("pinned")&&setTimeout(()=>{this.removeNotification(n.addedNodes[0])},5e3)})});n.observe(this.notificationPanel,{childList:!0})}}); \ No newline at end of file diff --git a/components/dist/popup.js b/components/dist/popup.js index bf61994..6cbe3d3 100644 --- a/components/dist/popup.js +++ b/components/dist/popup.js @@ -12,6 +12,11 @@ smPopup.innerHTML = ` display: -ms-grid; display: grid; z-index: 10; + --accent-color: #4d2588; + --text-color: 17, 17, 17; + --foreground-color: 255, 255, 255; + --background-color: #F6f6f6; + --danger-color: red; --width: 100%; --height: auto; --min-width: auto; diff --git a/components/dist/popup.min.js b/components/dist/popup.min.js index b87e394..66b746b 100644 --- a/components/dist/popup.min.js +++ b/components/dist/popup.min.js @@ -1 +1 @@ -const smPopup=document.createElement("template");smPopup.innerHTML='\n\n\n',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.resumeScrolling=this.resumeScrolling.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.movePopup=this.movePopup.bind(this)}get open(){return this.isOpen}resumeScrolling(){const t=document.body.style.top;window.scrollTo(0,-1*parseInt(t||"0")),setTimeout(()=>{document.body.style.overflow="auto",document.body.style.top="initial"},300)}show(t,e){return e&&(this.popupStack=e),this.popupStack&&!this.hasAttribute("open")&&(this.popupStack.push({popup:this,permission:t}),this.popupStack.items.length>1&&this.popupStack.items[this.popupStack.items.length-2].popup.classList.add("stacked"),this.dispatchEvent(new CustomEvent("popupopened",{bubbles:!0,detail:{popup:this,popupStack:this.popupStack}})),this.setAttribute("open",""),this.pinned=t,this.isOpen=!0),this.popupContainer.classList.remove("hide"),this.popup.style.transform="none",document.body.style.overflow="hidden",document.body.style.top=`-${window.scrollY}px`,this.popupStack}hide(){window.innerWidth<640?this.popup.style.transform="translateY(100%)":this.popup.style.transform="translateY(3rem)",this.popupContainer.classList.add("hide"),this.removeAttribute("open"),void 0!==this.popupStack?(this.popupStack.pop(),this.popupStack.items.length?this.popupStack.items[this.popupStack.items.length-1].popup.classList.remove("stacked"):this.resumeScrolling()):this.resumeScrolling(),this.inputFields.length&&setTimeout(()=>{this.inputFields.forEach(t=>{"radio"!==t.type&&"SM-CHECKBOX"!==t.tagName||(t.checked=!1),"SM-INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&"SM-TEXTAREA"!==t.tagName||(t.value="")})},300),setTimeout(()=>{this.dispatchEvent(new CustomEvent("popupclosed",{bubbles:!0,detail:{popup:this,popupStack:this.popupStack}})),this.isOpen=!1},300)}handleTouchStart(t){this.touchStartY=t.changedTouches[0].clientY,this.popup.style.transition="transform 0.1s",this.touchStartTime=t.timeStamp}handleTouchMove(t){this.touchStartY- These components are based on HTML5 custom elements API. This is an attempt to unify UI - development - patterns and - elements that are used multiple times throughout any general web app.It uses 'sm' namespace for - all - components. So every - component tag starts with 'sm-' +
+ Component-based design is the cornerstone of the modern UI development process. With rise of more UI frameworks every day, the web platform has a serious issue of fragmentation and portability.
- They can replace some older UI elements like <select>
- <input>
- <checkbox> <button>
- But also more modern additions like popups(modals), tabs and many more.
+ Web components to the rescue! This is the collection of web components (WC here forward) that we use at RanchiMall.especially since we are a framework-less development environment so this was a logical choice.
- Some of the components have some cool tricks under their sleeves like custom events and - variantions. - They allow developers to access more information about component or simply react to whatever - state - change happen to them. - We will go more in-depth about all the variantions and customs events related to each event as - we go - further. + Just download the components you like, link them with a script tag and drop it in HTML done!.
+