@jinntec/jinntap 1.21.5 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- class r extends HTMLElement {
1
+ class l extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.duration = 3e3, this.stickyDuration = 3e4;
4
4
  }
5
5
  static get observedAttributes() {
6
6
  return ["duration"];
7
7
  }
8
- attributeChangedCallback(t, s, i) {
8
+ attributeChangedCallback(t, a, i) {
9
9
  t === "duration" && (this.duration = parseInt(i) || 3e3);
10
10
  }
11
11
  connectedCallback() {
@@ -28,7 +28,7 @@ class r extends HTMLElement {
28
28
  padding: 12px 24px;
29
29
  margin: 8px 0;
30
30
  border-radius: 4px;
31
- color: white;
31
+ color: var(--jinn-toast-color, #F0F0F0);
32
32
  opacity: 0;
33
33
  transform: translateY(20px);
34
34
  transition: opacity 0.3s, transform 0.3s;
@@ -92,23 +92,28 @@ class r extends HTMLElement {
92
92
  }
93
93
  setupEventListeners() {
94
94
  document.addEventListener("jinn-toast", (t) => {
95
- this.showToast(t.detail.message, t.detail.type || "info", t.detail.sticky || !1);
95
+ this.showToast(
96
+ t.detail.message,
97
+ t.detail.type || "info",
98
+ t.detail.nohtml || !1,
99
+ t.detail.sticky || !1
100
+ );
96
101
  });
97
102
  }
98
- showToast(t, s, i = !1) {
103
+ showToast(t, a, i = !1, e = !1) {
99
104
  const n = document.createElement("div");
100
- n.className = `jinn-toast ${s} ${i ? "sticky" : ""}`;
101
- const e = () => {
105
+ n.className = `jinn-toast ${a} ${e ? "sticky" : ""}`;
106
+ const s = () => {
102
107
  n.classList.remove("show"), setTimeout(() => {
103
- a.removeChild(n);
108
+ r.removeChild(n);
104
109
  }, 300);
105
110
  };
106
111
  if (typeof t == "string")
107
- n.innerHTML = t;
112
+ i ? n.textContent = t : n.innerHTML = t;
108
113
  else if (t instanceof Node)
109
114
  n.appendChild(t);
110
115
  else if (typeof t == "function") {
111
- const o = t(e);
116
+ const o = t(s);
112
117
  if (o instanceof Node)
113
118
  n.appendChild(o);
114
119
  else {
@@ -119,20 +124,20 @@ class r extends HTMLElement {
119
124
  console.warn("Invalid message type for toast. Expected string, Node, or function.");
120
125
  return;
121
126
  }
122
- if (i) {
127
+ if (e) {
123
128
  const o = document.createElement("button");
124
129
  o.className = "close-button", o.innerHTML = `
125
130
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
126
131
  <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
127
132
  </svg>
128
- `, o.addEventListener("click", e), n.appendChild(o);
133
+ `, o.addEventListener("click", s), n.appendChild(o);
129
134
  }
130
- const a = this.querySelector(".jinn-toast-container");
131
- a.appendChild(n), n.offsetHeight, n.classList.add("show"), i || setTimeout(e, this.duration);
135
+ const r = this.querySelector(".jinn-toast-container");
136
+ r.appendChild(n), n.offsetHeight, n.classList.add("show"), e || setTimeout(s, this.duration);
132
137
  }
133
138
  }
134
- customElements.define("jinn-toast", r);
139
+ customElements.define("jinn-toast", l);
135
140
  export {
136
- r as JinnToast
141
+ l as JinnToast
137
142
  };
138
143
  //# sourceMappingURL=jinn-toast.es.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/jinntap",
3
- "version": "1.21.5",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",