@@ -106,73 +106,6 @@ Or if you prefer to go old-school javascript and a CDN:
106
106
</head >
107
107
```
108
108
109
- ### New from ` v0.4 `
110
-
111
- #### Supporting Multiple Toast Containers
112
-
113
- It's now easy to send toasts to different container targets within your app. For example:
114
-
115
- ``` html
116
- <script >
117
- import { SvelteToast , toast } from ' @zerodevx/svelte-toast'
118
-
119
- // Sends a toast to default toast container
120
- toast .push (' Yo!' )
121
-
122
- // Sends a toast to "new" toast container
123
- toast .push (' Hey!' , { target: ' new' })
124
- </script >
125
-
126
- <style >
127
- .wrap {
128
- --toastContainerTop : 0.5rem ;
129
- --toastContainerRight : 2rem ;
130
- --toastContainerBottom : auto ;
131
- --toastContainerLeft : 2rem ;
132
- --toastWidth : 100% ;
133
- font-size : 0.875rem ;
134
- ...
135
- }
136
- </style >
137
-
138
- <!-- Default toast container -->
139
- <SvelteToast />
140
-
141
- <!-- Another toast container -->
142
- <div class =" wrap" >
143
- <!-- Declare container with a unique `target` name -->
144
- <SvelteToast target =" new" options ={{ duration: 8000, intro: { y: -64 } }} />
145
- </div >
146
- ```
147
-
148
- #### Removing Multiple Toasts
149
-
150
- ` pop() ` now accepts a filter function.
151
-
152
- ``` js
153
- // Remove all toasts from "new" container
154
- toast .pop (i => i .target !== ' new' )
155
-
156
- // Or remove ALL active toasts from ALL containers
157
- toast .pop (0 )
158
- ```
159
-
160
- #### Accepts Object as First Param
161
-
162
- ` push() ` and ` set() ` can also take an object as its first parameter.
163
-
164
- ``` js
165
- let id = toast .push (' Yo!' , { duration: 2000 })
166
-
167
- // is semantically equivalent to
168
- id = toast .push ({ msg: ' Yo!' , duration: 2000 })
169
-
170
- toast .set (id, { msg: ' Waddup!' })
171
-
172
- // is semantically equivalent to
173
- toast .set ({ id, msg: ' Waddup!' })
174
- ```
175
-
176
109
## Theming
177
110
178
111
In general, use CSS variables - the following (self-explanatory) vars are exposed:
@@ -305,6 +238,73 @@ In Vanilla JS, simply apply your styles to the `._toastMsg` class:
305
238
}
306
239
```
307
240
241
+ ### New from ` v0.4 `
242
+
243
+ #### Supporting Multiple Toast Containers
244
+
245
+ It's now easy to send toasts to different container targets within your app. For example:
246
+
247
+ ``` html
248
+ <script >
249
+ import { SvelteToast , toast } from ' @zerodevx/svelte-toast'
250
+
251
+ // Sends a toast to default toast container
252
+ toast .push (' Yo!' )
253
+
254
+ // Sends a toast to "new" toast container
255
+ toast .push (' Hey!' , { target: ' new' })
256
+ </script >
257
+
258
+ <style >
259
+ .wrap {
260
+ --toastContainerTop : 0.5rem ;
261
+ --toastContainerRight : 2rem ;
262
+ --toastContainerBottom : auto ;
263
+ --toastContainerLeft : 2rem ;
264
+ --toastWidth : 100% ;
265
+ font-size : 0.875rem ;
266
+ ...
267
+ }
268
+ </style >
269
+
270
+ <!-- Default toast container -->
271
+ <SvelteToast />
272
+
273
+ <!-- Another toast container -->
274
+ <div class =" wrap" >
275
+ <!-- Declare container with a unique `target` name -->
276
+ <SvelteToast target =" new" options ={{ duration: 8000, intro: { y: -64 } }} />
277
+ </div >
278
+ ```
279
+
280
+ #### Removing Multiple Toasts
281
+
282
+ ` pop() ` now accepts a filter function.
283
+
284
+ ``` js
285
+ // Remove all toasts from "new" container
286
+ toast .pop (i => i .target !== ' new' )
287
+
288
+ // Or remove ALL active toasts from ALL containers
289
+ toast .pop (0 )
290
+ ```
291
+
292
+ #### Accepts Object as First Param
293
+
294
+ ` push() ` and ` set() ` can also take an object as its first parameter.
295
+
296
+ ``` js
297
+ let id = toast .push (' Yo!' , { duration: 2000 })
298
+
299
+ // is semantically equivalent to
300
+ id = toast .push ({ msg: ' Yo!' , duration: 2000 })
301
+
302
+ toast .set (id, { msg: ' Waddup!' })
303
+
304
+ // is semantically equivalent to
305
+ toast .set ({ id, msg: ' Waddup!' })
306
+ ```
307
+
308
308
## Options
309
309
310
310
``` js
@@ -330,7 +330,7 @@ toast.set(id, { options })
330
330
331
331
## Development
332
332
333
- Standard Github [ contributing workflow] ( https://gist.github.com/Chaser324/ce0505fbed06b947d962 ) applies.
333
+ Standard Github [ contribution workflow] ( https://gist.github.com/Chaser324/ce0505fbed06b947d962 ) applies.
334
334
335
335
### Tests
336
336
0 commit comments