@mccustomapps/helaui 0.1.6 → 0.1.8
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 +36 -4
- package/dist/index.cjs +21 -20
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +21 -20
- package/dist/rain-background.css +21 -1
- package/package.json +1 -1
- package/src/assets/rain/builtinImages.ts +7 -6
- package/dist/assets/rain/builtinImages.ts +0 -7
package/README.md
CHANGED
|
@@ -207,22 +207,54 @@ const mandala = new SunMandala({ src: '/my-mandala.png' });
|
|
|
207
207
|
|
|
208
208
|
### RainBackground
|
|
209
209
|
|
|
210
|
-
An animated **tropical rain** background with
|
|
210
|
+
An animated **tropical rain** background with falling food/leaf sprites.
|
|
211
|
+
|
|
212
|
+
The sprites live in **`rain-background.css`**. Import that CSS in the same app that mounts `RainBackground` so the bundler (Vite, webpack, Next.js) can emit the PNG files.
|
|
211
213
|
|
|
212
214
|
```js
|
|
213
215
|
import { RainBackground } from '@mccustomapps/helaui';
|
|
214
216
|
import '@mccustomapps/helaui/rain-background.css';
|
|
215
217
|
|
|
216
218
|
const rain = new RainBackground();
|
|
217
|
-
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Next.js (App Router)** — run this in a Client Component. The CSS import is required; without it the drops animate but stay empty:
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
'use client';
|
|
225
|
+
|
|
226
|
+
import { useEffect } from 'react';
|
|
227
|
+
import { RainBackground } from '@mccustomapps/helaui';
|
|
228
|
+
import '@mccustomapps/helaui/rain-background.css';
|
|
229
|
+
|
|
230
|
+
export function HelaRain() {
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
const rain = new RainBackground();
|
|
233
|
+
return () => rain.destroy();
|
|
234
|
+
}, []);
|
|
235
|
+
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
218
238
|
```
|
|
219
239
|
|
|
220
240
|
**Options — `RainBackgroundOptions`**
|
|
221
241
|
|
|
222
242
|
| Option | Type | Default | Description |
|
|
223
243
|
|---|---|---|---|
|
|
224
|
-
| `images` | `string[]` | built-in set |
|
|
225
|
-
| `
|
|
244
|
+
| `images` | `string[]` | built-in set (`fritter`, `swirl`, `kokis`, `leaf`) | Sprite ids or image URLs |
|
|
245
|
+
| `density` | `number` | `28` | Number of particles |
|
|
246
|
+
| `minSize` / `maxSize` | `number` | `28` | Particle width in pixels |
|
|
247
|
+
| `minDuration` / `maxDuration` | `number` | `8` / `18` | Fall duration in seconds |
|
|
248
|
+
| `target` | `HTMLElement` | `document.body` | Mount container |
|
|
249
|
+
| `zIndex` | `number` | `0` | Stacking order |
|
|
250
|
+
|
|
251
|
+
To use your own files, put them in the Next.js `public/` folder and pass URLs:
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
new RainBackground({
|
|
255
|
+
images: ['/rain/fritter.png', '/rain/leaf.png'],
|
|
256
|
+
});
|
|
257
|
+
```
|
|
226
258
|
|
|
227
259
|
**Helpers**
|
|
228
260
|
|