kitzo 2.1.4 → 2.1.5

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.4/dist/kitzo.umd.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.5/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
@@ -1,7 +1,6 @@
1
1
  import React, { useRef, useLayoutEffect, useState, useEffect } from 'react';
2
2
 
3
- function toastStyles() {
4
- return `.toast-content,
3
+ const toastStyles = `.toast-content,
5
4
  .toast-content-bottom {
6
5
  font-size: 0.925rem;
7
6
  }
@@ -183,7 +182,6 @@ function toastStyles() {
183
182
  }
184
183
  }
185
184
  `;
186
- }
187
185
  const listeners = new Set();
188
186
  function addToast(toast) {
189
187
  listeners.forEach(callback => {
@@ -194,13 +192,13 @@ function subscribe(callback) {
194
192
  if (!document.getElementById('kitzo-react-toast-styles')) {
195
193
  const styleTag = document.createElement('style');
196
194
  styleTag.id = 'kitzo-react-toast-styles';
197
- styleTag.textContent = toastStyles();
195
+ styleTag.textContent = toastStyles;
198
196
  document.head.appendChild(styleTag);
199
197
  }
200
198
  listeners.add(callback);
201
199
  return () => listeners.delete(callback);
202
200
  }
203
- function baseToast(text = 'Toast message', options = {}) {
201
+ function toast(text = 'Toast message', options = {}) {
204
202
  const id = Date.now();
205
203
  options = Object.assign({
206
204
  duration: 2000,
@@ -214,7 +212,7 @@ function baseToast(text = 'Toast message', options = {}) {
214
212
  options
215
213
  });
216
214
  }
217
- baseToast.success = (text = 'Toast success', options = {}) => {
215
+ toast.success = (text = 'Toast success', options = {}) => {
218
216
  const id = Date.now();
219
217
  options = Object.assign({
220
218
  duration: 2000,
@@ -228,7 +226,7 @@ baseToast.success = (text = 'Toast success', options = {}) => {
228
226
  options
229
227
  });
230
228
  };
231
- baseToast.error = (text = 'Toast denied', options = {}) => {
229
+ toast.error = (text = 'Toast denied', options = {}) => {
232
230
  const id = Date.now();
233
231
  options = Object.assign({
234
232
  duration: 2000,
@@ -242,7 +240,7 @@ baseToast.error = (text = 'Toast denied', options = {}) => {
242
240
  options
243
241
  });
244
242
  };
245
- baseToast.promise = (callback, msgs = {}, options = {}) => {
243
+ toast.promise = (callback, msgs = {}, options = {}) => {
246
244
  const id = Date.now();
247
245
  options = Object.assign({
248
246
  duration: 2000,
@@ -283,7 +281,7 @@ baseToast.promise = (callback, msgs = {}, options = {}) => {
283
281
  return Promise.reject(normalizedError);
284
282
  });
285
283
  };
286
- baseToast.custom = (render, options = {}) => {
284
+ toast.custom = (render, options = {}) => {
287
285
  const id = Date.now();
288
286
  options = Object.assign({
289
287
  duration: 3000,
@@ -304,7 +302,6 @@ function dismiss(id, exitDelay) {
304
302
  exitDelay
305
303
  });
306
304
  }
307
- const toast = baseToast;
308
305
 
309
306
  function SuccessSvg() {
310
307
  return /*#__PURE__*/React.createElement("div", {
@@ -561,7 +558,7 @@ const tooltipStyles = `
561
558
  font-size: 0.875rem;
562
559
  background-color: hsl(0, 0%, 15%);
563
560
  color: hsl(0, 0%, 95%);
564
- padding-block: 8px;
561
+ padding-block: 6px;
565
562
  padding-inline: 10px;
566
563
  border-radius: 0.325rem;
567
564
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "A lightweight JavaScript UI micro-library.",
5
5
  "type": "module",
6
6
  "main": "./dist/kitzo.umd.js",