kitzo 2.1.3 → 2.1.4

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/README.md CHANGED
@@ -26,7 +26,7 @@ npm i kitzo
26
26
  or
27
27
 
28
28
  ```javascript
29
- <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.3/dist/kitzo.umd.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.4/dist/kitzo.umd.min.js"></script>
30
30
  ```
31
31
 
32
32
  > Vanilla: Attach this script tag in the html head tag and you are good to go.
package/dist/react.esm.js CHANGED
@@ -185,29 +185,28 @@ function toastStyles() {
185
185
  `;
186
186
  }
187
187
  const listeners = new Set();
188
- let isStyleAdded$1 = false;
189
188
  function addToast(toast) {
190
189
  listeners.forEach(callback => {
191
190
  callback(toast);
192
191
  });
193
192
  }
194
193
  function subscribe(callback) {
195
- if (!isStyleAdded$1) {
194
+ if (!document.getElementById('kitzo-react-toast-styles')) {
196
195
  const styleTag = document.createElement('style');
196
+ styleTag.id = 'kitzo-react-toast-styles';
197
197
  styleTag.textContent = toastStyles();
198
198
  document.head.appendChild(styleTag);
199
- isStyleAdded$1 = true;
200
199
  }
201
200
  listeners.add(callback);
202
201
  return () => listeners.delete(callback);
203
202
  }
204
- function toast(text = 'Toast message', options = {}) {
203
+ function baseToast(text = 'Toast message', options = {}) {
205
204
  const id = Date.now();
206
205
  options = Object.assign({
207
206
  duration: 2000,
208
207
  id,
209
208
  style: {},
210
- showIcon: true
209
+ showIcon: false
211
210
  }, options);
212
211
  addToast({
213
212
  type: 'success',
@@ -215,7 +214,7 @@ function toast(text = 'Toast message', options = {}) {
215
214
  options
216
215
  });
217
216
  }
218
- toast.success = (text = 'Toast success', options = {}) => {
217
+ baseToast.success = (text = 'Toast success', options = {}) => {
219
218
  const id = Date.now();
220
219
  options = Object.assign({
221
220
  duration: 2000,
@@ -229,7 +228,7 @@ toast.success = (text = 'Toast success', options = {}) => {
229
228
  options
230
229
  });
231
230
  };
232
- toast.error = (text = 'Toast denied', options = {}) => {
231
+ baseToast.error = (text = 'Toast denied', options = {}) => {
233
232
  const id = Date.now();
234
233
  options = Object.assign({
235
234
  duration: 2000,
@@ -243,7 +242,7 @@ toast.error = (text = 'Toast denied', options = {}) => {
243
242
  options
244
243
  });
245
244
  };
246
- toast.promise = (callback, msgs = {}, options = {}) => {
245
+ baseToast.promise = (callback, msgs = {}, options = {}) => {
247
246
  const id = Date.now();
248
247
  options = Object.assign({
249
248
  duration: 2000,
@@ -284,7 +283,7 @@ toast.promise = (callback, msgs = {}, options = {}) => {
284
283
  return Promise.reject(normalizedError);
285
284
  });
286
285
  };
287
- toast.custom = (render, options = {}) => {
286
+ baseToast.custom = (render, options = {}) => {
288
287
  const id = Date.now();
289
288
  options = Object.assign({
290
289
  duration: 3000,
@@ -305,6 +304,7 @@ function dismiss(id, exitDelay) {
305
304
  exitDelay
306
305
  });
307
306
  }
307
+ const toast = baseToast;
308
308
 
309
309
  function SuccessSvg() {
310
310
  return /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "A lightweight JavaScript UI micro-library.",
5
5
  "type": "module",
6
6
  "main": "./dist/kitzo.umd.js",