dopaminejs 3.5.0 → 3.6.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # dopaminejs
2
2
 
3
- > Progression mechanics for web apps. XP, levels, achievements, and timezone-correct daily streaks, with the particles and sound to make them land.
3
+ > Gamification for any website. XP, levels, achievements and timezone-correct daily streaks, with confetti, particles and sound.
4
4
 
5
- Zero runtime dependencies. Works with any framework.
5
+ Zero runtime dependencies. Works with any framework, or with no build step through the script tag build (3.4.0 and later, see the repository README).
6
6
 
7
7
  ```bash
8
8
  npm install dopaminejs
@@ -124,6 +124,17 @@ To put the card on the left, set `--dopamine-toast-right: auto` as well. With bo
124
124
 
125
125
  Cards show one at a time. A second unlock waits until the first has left, so its announcement and confetti come later too.
126
126
 
127
+ ## Celebrate a moment
128
+
129
+ ```javascript
130
+ import { celebrate } from 'dopaminejs/celebrate';
131
+
132
+ celebrate('complete', { title: 'Lesson 3 done', target: button });
133
+ celebrate('certificate', { parts: dopamine.parts }); // through a host
134
+ ```
135
+
136
+ Shows a toast, fires confetti and plays a sound, with or without `createDopamine()`. Presets: `complete`, `milestone`, `streak`, `certificate`. Options: `title`, `body`, `icon`, `target` (confetti starts at its centre), `sound` (a key, or `false`) and `parts`. With reduced motion on there is no confetti. A part the host does not have is skipped, with no standalone fallback. `destroyCelebrations()` removes what the standalone route made. Not in the script tag build.
137
+
127
138
  ## Cleanup
128
139
 
129
140
  Everything that touches the DOM can be torn down: