@warp-ds/elements 2.2.0-next.1 → 2.2.0-next.10

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.
Files changed (229) hide show
  1. package/README.md +27 -17
  2. package/dist/.storybook/utilities.d.ts +28 -0
  3. package/dist/api.js +1 -49
  4. package/dist/api.js.map +4 -4
  5. package/dist/custom-elements.json +4282 -0
  6. package/dist/index.css +2 -0
  7. package/dist/index.css.map +7 -0
  8. package/dist/index.js +4566 -6565
  9. package/dist/index.js.map +4 -4
  10. package/dist/packages/affix/affix.stories.d.ts +10 -0
  11. package/dist/packages/affix/affix.test.d.ts +1 -0
  12. package/dist/packages/affix/index.d.ts +52 -24
  13. package/dist/packages/affix/index.js +2571 -2240
  14. package/dist/packages/affix/index.js.map +4 -4
  15. package/dist/packages/affix/react.d.ts +2 -0
  16. package/dist/packages/affix/styles.d.ts +1 -0
  17. package/dist/packages/alert/alert.stories.d.ts +15 -0
  18. package/dist/packages/alert/alert.test.d.ts +1 -0
  19. package/dist/packages/alert/index.d.ts +27 -17
  20. package/dist/packages/alert/index.js +2568 -2446
  21. package/dist/packages/alert/index.js.map +4 -4
  22. package/dist/packages/alert/react.d.ts +2 -0
  23. package/dist/packages/alert/styles.d.ts +1 -0
  24. package/dist/packages/attention/attention.stories.d.ts +15 -0
  25. package/dist/packages/attention/attention.test.d.ts +1 -0
  26. package/dist/packages/attention/index.d.ts +62 -90
  27. package/dist/packages/attention/index.js +3497 -3984
  28. package/dist/packages/attention/index.js.map +4 -4
  29. package/dist/packages/attention/layout-styles.d.ts +1 -0
  30. package/dist/packages/attention/react.d.ts +1 -0
  31. package/dist/packages/attention/styles.d.ts +1 -0
  32. package/dist/packages/badge/badge.stories.d.ts +17 -0
  33. package/dist/packages/badge/badge.test.d.ts +1 -0
  34. package/dist/packages/badge/index.d.ts +17 -11
  35. package/dist/packages/badge/index.js +2550 -300
  36. package/dist/packages/badge/index.js.map +4 -4
  37. package/dist/packages/badge/react.d.ts +2 -0
  38. package/dist/packages/badge/styles.d.ts +1 -0
  39. package/dist/packages/box/box.stories.d.ts +14 -0
  40. package/dist/packages/box/box.test.d.ts +1 -0
  41. package/dist/packages/box/index.d.ts +22 -20
  42. package/dist/packages/box/index.js +2550 -304
  43. package/dist/packages/box/index.js.map +4 -4
  44. package/dist/packages/box/react.d.ts +2 -0
  45. package/dist/packages/box/slot.test.d.ts +1 -0
  46. package/dist/packages/box/styles.d.ts +1 -0
  47. package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
  48. package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
  49. package/dist/packages/breadcrumbs/index.d.ts +24 -16
  50. package/dist/packages/breadcrumbs/index.js +2511 -2051
  51. package/dist/packages/breadcrumbs/index.js.map +4 -4
  52. package/dist/packages/breadcrumbs/react.d.ts +2 -0
  53. package/dist/packages/breadcrumbs/styles.d.ts +1 -0
  54. package/dist/packages/button/button.stories.d.ts +21 -0
  55. package/dist/packages/button/button.test.d.ts +1 -0
  56. package/dist/packages/button/index.d.ts +111 -56
  57. package/dist/packages/button/index.js +2735 -2130
  58. package/dist/packages/button/index.js.map +4 -4
  59. package/dist/packages/button/react.d.ts +2 -0
  60. package/dist/packages/button/styles.d.ts +1 -0
  61. package/dist/packages/card/card.stories.d.ts +15 -0
  62. package/dist/packages/card/card.test.d.ts +1 -0
  63. package/dist/packages/card/index.d.ts +33 -16
  64. package/dist/packages/card/index.js +2530 -2078
  65. package/dist/packages/card/index.js.map +4 -4
  66. package/dist/packages/card/react.d.ts +2 -0
  67. package/dist/packages/card/styles.d.ts +1 -0
  68. package/dist/packages/datepicker/DatePicker.test.d.ts +1 -0
  69. package/dist/packages/datepicker/datepicker.d.ts +107 -0
  70. package/dist/packages/datepicker/datepicker.js +2929 -0
  71. package/dist/packages/datepicker/datepicker.js.map +7 -0
  72. package/dist/packages/datepicker/datepicker.stories.d.ts +11 -0
  73. package/dist/packages/datepicker/datepicker.test.d.ts +2 -0
  74. package/dist/packages/datepicker/index.d.ts +1 -0
  75. package/dist/packages/datepicker/index.js +2929 -0
  76. package/dist/packages/datepicker/index.js.map +7 -0
  77. package/dist/packages/datepicker/locales/da/messages.d.mts +1 -0
  78. package/dist/packages/datepicker/locales/en/messages.d.mts +1 -0
  79. package/dist/packages/datepicker/locales/fi/messages.d.mts +1 -0
  80. package/dist/packages/datepicker/locales/nb/messages.d.mts +1 -0
  81. package/dist/packages/datepicker/locales/sv/messages.d.mts +1 -0
  82. package/dist/packages/datepicker/react.d.ts +2 -0
  83. package/dist/packages/datepicker/styles/w-datepicker-calendar.styles.d.ts +1 -0
  84. package/dist/packages/datepicker/styles/w-datepicker-day.styles.d.ts +1 -0
  85. package/dist/packages/datepicker/styles/w-datepicker-month.styles.d.ts +1 -0
  86. package/dist/packages/datepicker/styles/w-datepicker.styles.d.ts +1 -0
  87. package/dist/packages/datepicker/utils.d.ts +13 -0
  88. package/dist/packages/dead-toggle/dead-toggle.stories.d.ts +10 -0
  89. package/dist/packages/dead-toggle/dead-toggle.test.d.ts +1 -0
  90. package/dist/packages/dead-toggle/index.d.ts +21 -0
  91. package/dist/packages/dead-toggle/index.js +2610 -0
  92. package/dist/packages/dead-toggle/index.js.map +7 -0
  93. package/dist/packages/dead-toggle/react.d.ts +2 -0
  94. package/dist/packages/expandable/expandable.stories.d.ts +19 -0
  95. package/dist/packages/expandable/expandable.test.d.ts +1 -0
  96. package/dist/packages/expandable/index.d.ts +55 -50
  97. package/dist/packages/expandable/index.js +2545 -2293
  98. package/dist/packages/expandable/index.js.map +4 -4
  99. package/dist/packages/expandable/react.d.ts +2 -0
  100. package/dist/packages/expandable/styles.d.ts +1 -0
  101. package/dist/packages/link/index.d.ts +39 -0
  102. package/dist/packages/link/index.js +2769 -0
  103. package/dist/packages/link/index.js.map +7 -0
  104. package/dist/packages/link/link.stories.d.ts +20 -0
  105. package/dist/packages/link/link.test.d.ts +1 -0
  106. package/dist/packages/link/react.d.ts +2 -0
  107. package/dist/packages/link/styles.d.ts +1 -0
  108. package/dist/packages/modal/index.d.ts +4 -5
  109. package/dist/packages/modal/index.js +2765 -2569
  110. package/dist/packages/modal/index.js.map +4 -4
  111. package/dist/packages/modal/modal-footer.d.ts +18 -11
  112. package/dist/packages/modal/modal-footer.js +2499 -0
  113. package/dist/packages/modal/modal-footer.js.map +7 -0
  114. package/dist/packages/modal/modal-header.d.ts +30 -31
  115. package/dist/packages/modal/modal-header.js +2700 -0
  116. package/dist/packages/modal/modal-header.js.map +7 -0
  117. package/dist/packages/modal/modal-main.d.ts +32 -31
  118. package/dist/packages/modal/modal-main.js +2681 -0
  119. package/dist/packages/modal/modal-main.js.map +7 -0
  120. package/dist/packages/modal/modal.stories.d.ts +19 -0
  121. package/dist/packages/modal/react.d.ts +4 -0
  122. package/dist/packages/modal/util.d.ts +7 -17
  123. package/dist/packages/pageindicator/index.d.ts +14 -0
  124. package/dist/packages/pageindicator/index.js +169 -0
  125. package/dist/packages/pageindicator/index.js.map +7 -0
  126. package/dist/packages/pageindicator/pageindicator.stories.d.ts +32 -0
  127. package/dist/packages/pageindicator/react.d.ts +2 -0
  128. package/dist/packages/pageindicator/style.d.ts +1 -0
  129. package/dist/packages/pagination/index.d.ts +37 -0
  130. package/dist/packages/pagination/index.js +2610 -0
  131. package/dist/packages/pagination/index.js.map +7 -0
  132. package/dist/packages/pagination/locales/da/messages.d.mts +1 -0
  133. package/dist/packages/pagination/locales/en/messages.d.mts +1 -0
  134. package/dist/packages/pagination/locales/fi/messages.d.mts +1 -0
  135. package/dist/packages/pagination/locales/nb/messages.d.mts +1 -0
  136. package/dist/packages/pagination/locales/sv/messages.d.mts +1 -0
  137. package/dist/packages/pagination/pagination.stories.d.ts +14 -0
  138. package/dist/packages/pagination/pagination.test.d.ts +1 -0
  139. package/dist/packages/pagination/react.d.ts +2 -0
  140. package/dist/packages/pagination/styles.d.ts +1 -0
  141. package/dist/packages/pill/index.d.ts +44 -23
  142. package/dist/packages/pill/index.js +2524 -2175
  143. package/dist/packages/pill/index.js.map +4 -4
  144. package/dist/packages/pill/pill.stories.d.ts +12 -0
  145. package/dist/packages/pill/pill.test.d.ts +1 -0
  146. package/dist/packages/pill/styles.d.ts +1 -0
  147. package/dist/packages/rip-and-tear-checkbox/checkbox.d.ts +64 -0
  148. package/dist/packages/rip-and-tear-checkbox/index.css +2 -0
  149. package/dist/packages/rip-and-tear-checkbox/index.css.map +7 -0
  150. package/dist/packages/rip-and-tear-checkbox/index.d.ts +6 -0
  151. package/dist/packages/rip-and-tear-checkbox/index.js +187 -0
  152. package/dist/packages/rip-and-tear-checkbox/index.js.map +7 -0
  153. package/dist/packages/rip-and-tear-radio/base-element.d.ts +46 -0
  154. package/dist/packages/rip-and-tear-radio/custom-error-validator.d.ts +6 -0
  155. package/dist/packages/rip-and-tear-radio/form-associated-element.d.ts +103 -0
  156. package/dist/packages/rip-and-tear-radio/index.css +2 -0
  157. package/dist/packages/rip-and-tear-radio/index.css.map +7 -0
  158. package/dist/packages/rip-and-tear-radio/index.d.ts +8 -0
  159. package/dist/packages/rip-and-tear-radio/index.js +157 -0
  160. package/dist/packages/rip-and-tear-radio/index.js.map +7 -0
  161. package/dist/packages/rip-and-tear-radio/invalid.d.ts +8 -0
  162. package/dist/packages/rip-and-tear-radio/math.d.ts +1 -0
  163. package/dist/packages/rip-and-tear-radio/radio-group.d.ts +72 -0
  164. package/dist/packages/rip-and-tear-radio/radio.d.ts +38 -0
  165. package/dist/packages/rip-and-tear-radio/required-validator.d.ts +11 -0
  166. package/dist/packages/rip-and-tear-radio/slot.d.ts +20 -0
  167. package/dist/packages/rip-and-tear-radio/watch.d.ts +26 -0
  168. package/dist/packages/select/index.d.ts +59 -48
  169. package/dist/packages/select/index.js +2565 -2236
  170. package/dist/packages/select/index.js.map +4 -4
  171. package/dist/packages/select/react.d.ts +2 -0
  172. package/dist/packages/select/select.stories.d.ts +10 -0
  173. package/dist/packages/select/select.test.d.ts +1 -0
  174. package/dist/packages/select/styles.d.ts +1 -0
  175. package/dist/packages/steps/index.d.ts +43 -0
  176. package/dist/packages/steps/index.js +2581 -0
  177. package/dist/packages/steps/index.js.map +7 -0
  178. package/dist/packages/steps/locales/da/messages.d.mts +1 -0
  179. package/dist/packages/steps/locales/en/messages.d.mts +1 -0
  180. package/dist/packages/steps/locales/fi/messages.d.mts +1 -0
  181. package/dist/packages/steps/locales/nb/messages.d.mts +1 -0
  182. package/dist/packages/steps/locales/sv/messages.d.mts +1 -0
  183. package/dist/packages/steps/react.d.ts +3 -0
  184. package/dist/packages/steps/steps.stories.d.ts +12 -0
  185. package/dist/packages/steps/styles.d.ts +1 -0
  186. package/dist/packages/styles.d.ts +2 -0
  187. package/dist/packages/switch/index.d.ts +20 -0
  188. package/dist/packages/switch/index.js +2564 -0
  189. package/dist/packages/switch/index.js.map +7 -0
  190. package/dist/packages/switch/react.d.ts +2 -0
  191. package/dist/packages/switch/styles.d.ts +1 -0
  192. package/dist/packages/switch/switch.stories.d.ts +9 -0
  193. package/dist/packages/tabs/index.d.ts +4 -0
  194. package/dist/packages/tabs/index.js +2579 -0
  195. package/dist/packages/tabs/index.js.map +7 -0
  196. package/dist/packages/tabs/react.d.ts +4 -0
  197. package/dist/packages/tabs/styles.d.ts +1 -0
  198. package/dist/packages/tabs/tab-panel.d.ts +20 -0
  199. package/dist/packages/tabs/tab.d.ts +23 -0
  200. package/dist/packages/tabs/tabs.d.ts +38 -0
  201. package/dist/packages/tabs/tabs.stories.d.ts +8 -0
  202. package/dist/packages/textfield/index.d.ts +72 -74
  203. package/dist/packages/textfield/index.js +2572 -413
  204. package/dist/packages/textfield/index.js.map +4 -4
  205. package/dist/packages/textfield/react.d.ts +2 -0
  206. package/dist/packages/textfield/styles.d.ts +1 -0
  207. package/dist/packages/textfield/textfield.stories.d.ts +17 -0
  208. package/dist/packages/textfield/textfield.test.d.ts +1 -0
  209. package/dist/packages/toast/api.d.ts +4 -45
  210. package/dist/packages/toast/index.d.ts +3 -0
  211. package/dist/packages/toast/index.js +2610 -2787
  212. package/dist/packages/toast/index.js.map +4 -4
  213. package/dist/packages/toast/styles.d.ts +1 -0
  214. package/dist/packages/toast/toast-container.d.ts +12 -63
  215. package/dist/packages/toast/toast.d.ts +34 -29
  216. package/dist/packages/toast/toast.stories.d.ts +12 -0
  217. package/dist/packages/toast/types.d.ts +15 -0
  218. package/dist/packages/utils/expand-transition.d.ts +3 -2
  219. package/dist/packages/utils/index.d.ts +1 -1
  220. package/dist/packages/utils/index.js +27 -0
  221. package/dist/packages/utils/index.js.map +7 -0
  222. package/dist/packages/utils/unstyled-heading.d.ts +4 -3
  223. package/dist/setup-tests.d.ts +1 -0
  224. package/dist/styles.css +1 -0
  225. package/dist/vscode.css-custom-data.json +6 -0
  226. package/dist/vscode.html-custom-data.json +421 -0
  227. package/dist/web-types.json +949 -0
  228. package/package.json +74 -25
  229. package/dist/index.d.ts +0 -18
package/README.md CHANGED
@@ -38,7 +38,7 @@ This project builds both the whole Elements package and separate component packa
38
38
  ```js
39
39
  import '@warp-ds/elements';
40
40
  ```
41
- or a specific component:
41
+ or a specific component:
42
42
  ```js
43
43
  import '@warp-ds/elements/components/toast';
44
44
  ```
@@ -48,30 +48,40 @@ import '@warp-ds/elements/components/toast';
48
48
  For information on the components available in the package and how to use them,
49
49
  see the [Warp Design System documentation](https://warp-ds.github.io/tech-docs/).
50
50
 
51
- ## Releases
52
-
53
- This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/elements) and [Eik](https://assets.finn.no/pkg/@warp-ds/elements) using a `next` tag (e.g. `1.1.0-next.1`).
54
- Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
55
-
56
- ## Changelog
51
+ ### Editor integration
57
52
 
58
- Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
53
+ #### Visual Studio Code
59
54
 
60
- ## How to test component-classes locally
55
+ This module includes [Custom HTML and CSS data for Visual Studio Code](https://code.visualstudio.com/blogs/2020/02/24/custom-data-format).
61
56
 
62
- It is possible to test changes that have been made to component-classes from the [@warp-ds/css](https://github.com/warp-ds/css) package but that has not yet been published to Eik. You simply need to link the `@warp-ds/css` package in this repository and add `@unocss-placeholder` inside the static styles of the component that you want to test:
57
+ Add this to your `settings.json` and restart VS Code to get IntelliSense and inline documentation for Warp elements.
63
58
 
64
- ```js
65
- static styles = [
66
- css`
67
- @unocss-placeholder
68
- `,
59
+ ```json
60
+ {
61
+ "html.customData": [
62
+ "./node_modules/@warp-ds/elements/dist/vscode.html-custom-data.json"
63
+ ],
64
+ "css.customData": [
65
+ "./node_modules/@warp-ds/elements/dist/vscode.css-custom-data.json"
69
66
  ]
67
+ }
70
68
  ```
71
69
 
72
- Run `pnpm dev` to see the linked styles in action.
70
+ #### JetBrains products
71
+
72
+ We ship `web-types.json` which should get picked up automatically by JetBrains IDEA and similar products.
73
+
74
+ You should see code completions and inline docs for Warp elements when writing HTML.
73
75
 
74
- Once you have tested it locally, make sure to remove the `@unocss-placeholder` from the static styles before pushing any changes to the repository.
76
+
77
+ ## Releases
78
+
79
+ This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/elements) and [Eik](https://assets.finn.no/pkg/@warp-ds/elements) using a `next` tag (e.g. `1.1.0-next.1`).
80
+ Anyone needing to use the latest changes of this package can point to the `next` version while waiting for the stable release.
81
+
82
+ ## Changelog
83
+
84
+ Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.
75
85
 
76
86
  ## License
77
87
 
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Massages storybook args before being spread to HTML attributes.
3
+ *
4
+ * - Empty strings are treated as not set.
5
+ * - Boolean false don't get set.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { html } from 'lit';
10
+ * import { spread } from '@open-wc/lit-helpers';
11
+ * import { prespread } from '../../.storybook/utilities.js';
12
+ *
13
+ * type Args = {
14
+ * required: boolean;
15
+ * };
16
+ *
17
+ * const meta: Meta<Args> = {
18
+ * component: 'w-component',
19
+ * render(args) {
20
+ * return html`<w-component ${spread(prespread(args))}></w-component>`;
21
+ * },
22
+ * argTypes: {
23
+ * required: { type: 'boolean' },
24
+ * },
25
+ * };
26
+ * ```
27
+ */
28
+ export declare function prespread(args: Record<string, unknown>): Record<string, unknown>;
package/dist/api.js CHANGED
@@ -1,50 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
-
18
- // packages/utils/window-exists.js
19
- var windowExists = typeof window !== "undefined";
20
-
21
- // packages/toast/api.js
22
- function toast(message, options) {
23
- if (!windowExists) return;
24
- const toast2 = customElements.get("w-toast-container").init();
25
- const data = __spreadValues({
26
- id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),
27
- text: message,
28
- duration: 5e3,
29
- type: "success"
30
- }, options);
31
- toast2.set(data);
32
- return data;
33
- }
34
- function removeToast(id) {
35
- if (!windowExists) return;
36
- const toast2 = customElements.get("w-toast-container").init();
37
- return toast2.del(id);
38
- }
39
- function updateToast(id, options) {
40
- if (!windowExists) return;
41
- const toast2 = customElements.get("w-toast-container").init();
42
- toast2.set(__spreadValues(__spreadValues({}, toast2.get(id)), options));
43
- return toast2.get(id);
44
- }
45
- export {
46
- removeToast,
47
- toast,
48
- updateToast
49
- };
1
+ var e=typeof window!="undefined";function r(){return customElements.get("w-toast-container")}function p(t,o){if(!e)return;let n=r().init(),s={id:Date.now().toString(36)+Math.random().toString(36).slice(2,5),text:t,duration:5e3,type:"success",...o};return n.set(s),s}function u(t){return e?r().init().del(t):void 0}function c(t,o){if(!e)return;let n=r().init();return n.set({...n.get(t),...o}),n.get(t)}export{u as removeToast,p as toast,c as updateToast};
50
2
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../packages/utils/window-exists.js", "../packages/toast/api.js"],
4
- "sourcesContent": ["export const windowExists = typeof window !== 'undefined';\n", "import { windowExists } from '../utils/window-exists';\n\n/**\n * Toast helper function options\n * @typedef {Object} ToastOptions\n * @property {(number|string)} [id] Custom identifier\n * @property {('success'|'error'|'warning')} [type] Type of toast\n * @property {String} [text] The toast message. Only needed when updating text on existing toast\n * @property {(number|string)} [duration] Duration of toast in milliseconds. Defaults to 5000. For accessibility reasons, toasts should never be interactive and therefore need to auto remove. If you must disable auto remove, set duration to Number.POSITIVE_INFINITY.\n * @property {Boolean} [canclose] Whether the toast can be dismissed. Defaults to false. WARNING! For accessibility reasons, toasts should not be interactive and canclose should always be false. If the toast absolutely must be dismissable, set this to true.\n */\n\n/**\n * Creates a new toast\n * @param {String} message Message\n * @param {ToastOptions?} options Toast options\n * @returns {ToastOptions} Toast details\n */\nexport function toast(message, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n\n const data = {\n id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),\n text: message,\n duration: 5000,\n type: 'success',\n ...options,\n };\n\n toast.set(data);\n return data;\n}\n\n/**\n * Remove an existing toast\n * @param {String|Number} id Toast identifier\n * @return {Promise<Boolean>} Resolves to true if deleted, false if not found\n */\nexport function removeToast(id) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n return toast.del(id);\n}\n\n/**\n * Update an existing toast\n * @param {String|Number} id Toast identifier\n * @param {ToastOptions?} options Toast options\n * @returns {WarpToastContainer} Toast details\n */\nexport function updateToast(id, options) {\n if (!windowExists) return;\n const toast = customElements.get('w-toast-container').init();\n toast.set({ ...toast.get(id), ...options });\n return toast.get(id);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAO,IAAM,eAAe,OAAO,WAAW;;;ACkBvC,SAAS,MAAM,SAAS,SAAS;AACtC,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAE3D,QAAM,OAAO;AAAA,IACX,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC;AAAA,IACnE,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,KACH;AAGL,EAAAA,OAAM,IAAI,IAAI;AACd,SAAO;AACT;AAOO,SAAS,YAAY,IAAI;AAC9B,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,SAAOA,OAAM,IAAI,EAAE;AACrB;AAQO,SAAS,YAAY,IAAI,SAAS;AACvC,MAAI,CAAC,aAAc;AACnB,QAAMA,SAAQ,eAAe,IAAI,mBAAmB,EAAE,KAAK;AAC3D,EAAAA,OAAM,IAAI,kCAAKA,OAAM,IAAI,EAAE,IAAM,QAAS;AAC1C,SAAOA,OAAM,IAAI,EAAE;AACrB;",
6
- "names": ["toast"]
3
+ "sources": ["../packages/utils/window-exists.js", "../packages/toast/api.ts"],
4
+ "sourcesContent": ["export const windowExists = typeof window !== 'undefined';\n", "import { windowExists } from '../utils/window-exists';\n\nimport { WarpToastContainer } from './toast-container';\nimport type { ToastOptions, ToastInternal } from './types';\n\nfunction getToastContainer() {\n const container = customElements.get('w-toast-container');\n return container as typeof WarpToastContainer;\n}\n\n/**\n * Creates a new toast\n */\nexport function toast(message: string, options?: ToastOptions) {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n\n const data: ToastOptions = {\n id: Date.now().toString(36) + Math.random().toString(36).slice(2, 5),\n text: message,\n duration: 5000,\n type: 'success',\n ...options,\n };\n\n toast.set(data);\n return data;\n}\n\n/**\n * Remove an existing toast\n */\nexport function removeToast(id: string | number): Promise<boolean> | undefined {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n return toast.del(id);\n}\n\n/**\n * Update an existing toast\n */\nexport function updateToast(id: string | number, options?: ToastOptions): ToastInternal | undefined {\n if (!windowExists) return;\n\n const toast = getToastContainer().init() as WarpToastContainer;\n toast.set({ ...toast.get(id), ...options });\n return toast.get(id);\n}\n"],
5
+ "mappings": "AAAO,IAAMA,EAAe,OAAO,QAAW,YCK9C,SAASC,GAAoB,CAE3B,OADkB,eAAe,IAAI,mBAAmB,CAE1D,CAKO,SAASC,EAAMC,EAAiBC,EAAwB,CAC7D,GAAI,CAACC,EAAc,OAEnB,IAAMH,EAAQD,EAAkB,EAAE,KAAK,EAEjCK,EAAqB,CACzB,GAAI,KAAK,IAAI,EAAE,SAAS,EAAE,EAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,EACnE,KAAMH,EACN,SAAU,IACV,KAAM,UACN,GAAGC,CACL,EAEA,OAAAF,EAAM,IAAII,CAAI,EACPA,CACT,CAKO,SAASC,EAAYC,EAAmD,CAC7E,OAAKH,EAESJ,EAAkB,EAAE,KAAK,EAC1B,IAAIO,CAAE,EAHA,MAIrB,CAKO,SAASC,EAAYD,EAAqBJ,EAAmD,CAClG,GAAI,CAACC,EAAc,OAEnB,IAAMH,EAAQD,EAAkB,EAAE,KAAK,EACvC,OAAAC,EAAM,IAAI,CAAE,GAAGA,EAAM,IAAIM,CAAE,EAAG,GAAGJ,CAAQ,CAAC,EACnCF,EAAM,IAAIM,CAAE,CACrB",
6
+ "names": ["windowExists", "getToastContainer", "toast", "message", "options", "windowExists", "data", "removeToast", "id", "updateToast"]
7
7
  }