@trenoxxious/n-components 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -103,6 +103,8 @@ b {
103
103
  }
104
104
 
105
105
  .socials-dash {
106
+ opacity: 1;
107
+ transition: opacity 1s ease-in-out;
106
108
  position: fixed;
107
109
  display: flex;
108
110
  align-items: center;
@@ -113,6 +115,10 @@ b {
113
115
  z-index: 10;
114
116
  }
115
117
 
118
+ .hide {
119
+ opacity: 0;
120
+ }
121
+
116
122
  .sec {
117
123
  margin-top: 15px;
118
124
  margin-bottom: 15px;
@@ -221,8 +227,15 @@ b {
221
227
  }
222
228
 
223
229
  pre {
230
+ padding: 0.5rem !important;
231
+ text-wrap: nowrap;
224
232
  text-align: left;
225
233
  margin-left: 25px;
234
+ overflow-x: auto;
235
+ }
236
+
237
+ code {
238
+ text-wrap: nowrap;
226
239
  }
227
240
 
228
241
  .code span {
@@ -407,6 +420,10 @@ pre {
407
420
  margin: 0 2%;
408
421
  }
409
422
 
423
+ .components-grid-full {
424
+ margin: 0 2%;
425
+ }
426
+
410
427
  header h1 {
411
428
  font-size: 3.0rem;
412
429
  -webkit-text-stroke-width: 1px;
@@ -421,4 +438,8 @@ pre {
421
438
  .component-header h3 {
422
439
  text-align: center;
423
440
  }
441
+
442
+ .button-grid-4 {
443
+ grid-template-columns: repeat(1, 1fr);
444
+ }
424
445
  }
package/dist/index.html CHANGED
@@ -195,15 +195,22 @@
195
195
  </div>
196
196
  </div>
197
197
  <script>
198
- const copyImportButton = document.getElementById('copy-import');
199
198
  const currentVersionDisplay = document.getElementById('current-version');
200
199
  const currentVersionNum = '1.0.12';
201
200
 
202
- copyImportButton.addEventListener('click', () => {
203
- navigator.clipboard.writeText(`\<script src=\"https://unpkg.com/@trenoxxious/n-components@latest/dist/n-components.umd.js\">\<\/script\>`);
204
- });
205
-
206
201
  currentVersionDisplay.innerText = currentVersionNum;
202
+
203
+ window.addEventListener('scroll', () => {
204
+ if (window.scrollY > 10) {
205
+ if (document.querySelector('.socials-dash')) {
206
+ document.querySelector('.socials-dash').classList.add('hide');
207
+ }
208
+ } else {
209
+ if (document.querySelector('.socials-dash')) {
210
+ document.querySelector('.socials-dash').classList.remove('hide');
211
+ }
212
+ }
213
+ });
207
214
  </script>
208
215
  </body>
209
216
 
@@ -720,13 +720,14 @@ var NButton = class extends i {
720
720
  NButton = __decorate([t("n-button")], NButton);
721
721
  var NCopy = class extends i {
722
722
  constructor(...x) {
723
- super(...x), this.position = "block", this.dark = !1, this.copy = "", this.background = "", this.id = "", this.name = "", this.disabled = !1, this.ariaLabel = "", this.ariaDescribedby = "", this.ariaPressed = "";
723
+ super(...x), this.position = "block", this.dark = !1, this.copy = "", this.background = "", this.size = "small", this.id = "", this.name = "", this.disabled = !1, this.ariaLabel = "", this.ariaDescribedby = "", this.ariaPressed = "";
724
724
  }
725
725
  static #e = this.properties = {
726
726
  dark: { type: Boolean },
727
727
  copy: { type: String },
728
728
  position: { type: String },
729
729
  background: { type: String },
730
+ size: { type: String },
730
731
  id: { type: String },
731
732
  style: { type: String },
732
733
  name: { type: String },
@@ -747,8 +748,6 @@ var NCopy = class extends i {
747
748
  static #t = this.styles = i$1`
748
749
  .copy-button {
749
750
  display: block;
750
- width: 18px;
751
- height: 18px;
752
751
  cursor: pointer;
753
752
  user-select: none;
754
753
  padding: 4px;
@@ -760,35 +759,35 @@ var NCopy = class extends i {
760
759
  }
761
760
  `;
762
761
  render() {
763
- let x = "";
764
- switch (this.position) {
762
+ let x = "16px", j = "";
763
+ switch (this.size === "medium" ? x = "24px" : this.size === "large" && (x = "32px"), this.position) {
765
764
  case "top right":
766
- x = "position: absolute; top: 0; right: 0;";
765
+ j = "position: absolute; top: 0; right: 0;";
767
766
  break;
768
767
  case "bottom right":
769
- x = "position: absolute; bottom: 0; right: 0;";
768
+ j = "position: absolute; bottom: 0; right: 0;";
770
769
  break;
771
770
  case "top left":
772
- x = "position: absolute; top: 0; left: 0;";
771
+ j = "position: absolute; top: 0; left: 0;";
773
772
  break;
774
773
  case "bottom left":
775
- x = "position: absolute; bottom: 0; left: 0;";
774
+ j = "position: absolute; bottom: 0; left: 0;";
776
775
  break;
777
776
  case "top":
778
- x = "position: absolute; top: 0; right: 50%; transform: translateX(-50%);";
777
+ j = "position: absolute; top: 0; right: 50%; transform: translateX(-50%);";
779
778
  break;
780
779
  case "bottom":
781
- x = "position: absolute; bottom: 0; right: 50%; transform: translateX(-50%);";
780
+ j = "position: absolute; bottom: 0; right: 50%; transform: translateX(-50%);";
782
781
  break;
783
782
  case "left":
784
- x = "position: absolute; left: 0; top: 50%; transform: translateY(-50%);";
783
+ j = "position: absolute; left: 0; top: 50%; transform: translateY(-50%);";
785
784
  break;
786
785
  case "right":
787
- x = "position: absolute; right: 0; top: 50%; transform: translateY(-50%);";
786
+ j = "position: absolute; right: 0; top: 50%; transform: translateY(-50%);";
788
787
  break;
789
788
  case "block":
790
789
  default:
791
- x = "position: unset;";
790
+ j = "position: unset;";
792
791
  break;
793
792
  }
794
793
  return b`<div
@@ -801,7 +800,7 @@ var NCopy = class extends i {
801
800
  aria-describedby="${this.ariaDescribedby || ""}"
802
801
  aria-pressed="${this.ariaPressed || ""}"
803
802
  class="copy-button"
804
- style="${x}${this.background === "" ? "" : ` background: ${this.background};`}${this.style ? ` ${this.style}` : ""}">
803
+ style="${j}${` width: ${x}; height: ${x};`}${this.background === "" ? "" : ` background: ${this.background};`}${this.style ? ` ${this.style}` : ""}">
805
804
  <svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="${this.dark ? "white" : "black"}">
806
805
  <path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/>
807
806
  </svg>
@@ -139,11 +139,9 @@
139
139
  class="${this.variant}${this.background||this.borderColor?` custom-color`:``}${this.dontPunch?` dont-punch`:``}${this.thin&&!this.thick?` thin`:this.thick?` thick`:``}${this.outlineOnly?` outline-only`:``}${this.scaleOnHover?` scale-hover`:``}${this.rounded&&!this.sharp?` rounded`:this.sharp?` sharp`:``} animation-${this.animation}"
140
140
  style="${e?`color: ${e}; `:``}${t&&!this.outlineOnly?`background: ${t}; `:``}${t&&!n?`border: 1px solid color-mix(in hsl, ${t} 100%, white 10%); `:n?`border: 1px solid ${n}; `:``}${r?`color: ${r}; `:``}${this.style}">
141
141
  <slot></slot>
142
- </button>`}};Q=Z([X(`n-button`)],Q);var $=class extends Y{constructor(...e){super(...e),this.position=`block`,this.dark=!1,this.copy=``,this.background=``,this.id=``,this.name=``,this.disabled=!1,this.ariaLabel=``,this.ariaDescribedby=``,this.ariaPressed=``}static#e=this.properties={dark:{type:Boolean},copy:{type:String},position:{type:String},background:{type:String},id:{type:String},style:{type:String},name:{type:String},disabled:{type:Boolean},ariaLabel:{type:String,attribute:`aria-label`},ariaDescribedby:{type:String,attribute:`aria-describedby`},ariaPressed:{type:String,attribute:`aria-pressed`}};static#t=this.styles=s`
142
+ </button>`}};Q=Z([X(`n-button`)],Q);var $=class extends Y{constructor(...e){super(...e),this.position=`block`,this.dark=!1,this.copy=``,this.background=``,this.size=`small`,this.id=``,this.name=``,this.disabled=!1,this.ariaLabel=``,this.ariaDescribedby=``,this.ariaPressed=``}static#e=this.properties={dark:{type:Boolean},copy:{type:String},position:{type:String},background:{type:String},size:{type:String},id:{type:String},style:{type:String},name:{type:String},disabled:{type:Boolean},ariaLabel:{type:String,attribute:`aria-label`},ariaDescribedby:{type:String,attribute:`aria-describedby`},ariaPressed:{type:String,attribute:`aria-pressed`}};static#t=this.styles=s`
143
143
  .copy-button {
144
144
  display: block;
145
- width: 18px;
146
- height: 18px;
147
145
  cursor: pointer;
148
146
  user-select: none;
149
147
  padding: 4px;
@@ -153,7 +151,7 @@
153
151
  .copy-button:active {
154
152
  scale: 0.90;
155
153
  }
156
- `;render(){let e=``;switch(this.position){case`top right`:e=`position: absolute; top: 0; right: 0;`;break;case`bottom right`:e=`position: absolute; bottom: 0; right: 0;`;break;case`top left`:e=`position: absolute; top: 0; left: 0;`;break;case`bottom left`:e=`position: absolute; bottom: 0; left: 0;`;break;case`top`:e=`position: absolute; top: 0; right: 50%; transform: translateX(-50%);`;break;case`bottom`:e=`position: absolute; bottom: 0; right: 50%; transform: translateX(-50%);`;break;case`left`:e=`position: absolute; left: 0; top: 50%; transform: translateY(-50%);`;break;case`right`:e=`position: absolute; right: 0; top: 50%; transform: translateY(-50%);`;break;case`block`:default:e=`position: unset;`;break}return R`<div
154
+ `;render(){let e=`16px`,t=``;switch(this.size===`medium`?e=`24px`:this.size===`large`&&(e=`32px`),this.position){case`top right`:t=`position: absolute; top: 0; right: 0;`;break;case`bottom right`:t=`position: absolute; bottom: 0; right: 0;`;break;case`top left`:t=`position: absolute; top: 0; left: 0;`;break;case`bottom left`:t=`position: absolute; bottom: 0; left: 0;`;break;case`top`:t=`position: absolute; top: 0; right: 50%; transform: translateX(-50%);`;break;case`bottom`:t=`position: absolute; bottom: 0; right: 50%; transform: translateX(-50%);`;break;case`left`:t=`position: absolute; left: 0; top: 50%; transform: translateY(-50%);`;break;case`right`:t=`position: absolute; right: 0; top: 50%; transform: translateY(-50%);`;break;case`block`:default:t=`position: unset;`;break}return R`<div
157
155
  ?disabled="${this.disabled}"
158
156
  id="${this.id||``}"
159
157
  @click="${this.handleCopy}"
@@ -163,7 +161,7 @@
163
161
  aria-describedby="${this.ariaDescribedby||``}"
164
162
  aria-pressed="${this.ariaPressed||``}"
165
163
  class="copy-button"
166
- style="${e}${this.background===``?``:` background: ${this.background};`}${this.style?` ${this.style}`:``}">
164
+ style="${t}${` width: ${e}; height: ${e};`}${this.background===``?``:` background: ${this.background};`}${this.style?` ${this.style}`:``}">
167
165
  <svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px" fill="${this.dark?`white`:`black`}">
168
166
  <path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/>
169
167
  </svg>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@trenoxxious/n-components",
3
3
  "description": "Customizable components for use with vanilla HTML, Javascript and CSS.",
4
4
  "private": false,
5
- "version": "1.0.12",
5
+ "version": "1.0.14",
6
6
  "repository": "github:Trenoxxious/n-components",
7
7
  "keywords": [
8
8
  "web-components",
@@ -15,6 +15,7 @@
15
15
  "exports": {
16
16
  ".": "./dist/n-components.js"
17
17
  },
18
+ "readme": "../README.md",
18
19
  "scripts": {
19
20
  "dev": "vite",
20
21
  "build": "tsc && vite build",
package/README.md DELETED
@@ -1,24 +0,0 @@
1
- # n-components
2
- Simple web components for use with *static* vanilla HTML, JS and CSS websites.
3
-
4
- To use, import with `<script src="https://unpkg.com/@trenoxxious/n-components@latest/dist/n-components.umd.js"></script>` in your HTML `<head>`.
5
-
6
- ## Buttons
7
- **An n-component button element is called using `<n-button></n-button>` in any HTML document/context.**
8
-
9
- There are several options for n-button components, including:
10
- | Variable | Description | Default | Accepts |
11
- | -------- | -------- | -------- | -------- |
12
- | ***variant*** | Changes the main color theme of the button. | normal | normal, info, success, warning, alert |
13
- | ***dontPunch*** | Does not scale down when clicked if this is set to true. | false | true, false |
14
- | ***scaleOnHover*** | Will scale when hovered if this is set to true. | false | true, false |
15
- | ***outlineOnly*** | Will only show the outline of the button if this is set to true. | false | true, false |
16
- | ***animation*** | Sets the animation speed of most button animations. | normal | fast, normal, slow, very-slow |
17
- | ***thick*** | Sets the padding high on the button. | false | true, false |
18
- | ***thin*** | Sets the padding low on the button. | false | true, false |
19
- | ***dark*** | Sets the button text to white. | false | true, false |
20
- | ***background*** | Sets the button's background. | null | Any CSS-valid background |
21
- | ***borderColor*** | Sets the button's border color. | null | Any CSS-valid color string |
22
- | ***textColor*** | Sets the button's text color. | null | Any CSS-valid color string |
23
- | ***rounded*** | Rounds the button corners a little more. | false | true, false |
24
- | ***sharp*** | Sharpens the button corners. | false | true, false |