@zakkster/lite-tools 1.0.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 +457 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
# @zakkster/lite-tools
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@zakkster/lite-tools)
|
|
4
|
+
[](https://bundlephobia.com/result?p=@zakkster/lite-tools)
|
|
5
|
+
[](https://www.npmjs.com/package/@zakkster/lite-ui)
|
|
6
|
+
[](https://www.npmjs.com/package/@zakkster/lite-tools)
|
|
7
|
+

|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
The standard library for high-performance web presentation.
|
|
11
|
+
|
|
12
|
+
**Stop installing 500KB of frameworks just to make your website feel alive.** LiteTools gives you GSAP-level scroll reveals, Framer-level magnetic physics, Three.js-level particle engines, and Tailwind-level color generation in a single, tree-shakeable, zero-GC toolkit.
|
|
13
|
+
|
|
14
|
+
**[→ Live Recipes Gallery Demo](https://codepen.io/Zahari-Shinikchiev/full/qEarjVG)**
|
|
15
|
+
|
|
16
|
+
## Why LiteTools?
|
|
17
|
+
|
|
18
|
+
| Feature | LiteTools | lodash | GSAP | Framer Motion | p5.js |
|
|
19
|
+
|---|---|---|---|---|---|
|
|
20
|
+
| **Tree-Shakeable** | **Yes** | Partial | No | No | No |
|
|
21
|
+
| **Zero-GC Hot Path** | **Yes** | No | No | No | No |
|
|
22
|
+
| **Deterministic** | **Yes** | N/A | No | No | No |
|
|
23
|
+
| **OKLCH Color** | **Yes** | No | No | No | No |
|
|
24
|
+
| **SoA Particles** | **Yes** | No | No | No | No |
|
|
25
|
+
| **Scroll Reveals** | **Yes** | No | Plugin | Yes | No |
|
|
26
|
+
| **Spring Physics** | **Yes** | No | No | Yes | No |
|
|
27
|
+
| **Theme Generation** | **Yes** | No | No | No | No |
|
|
28
|
+
| **Bundle Size** | **Tiny** | Large | Large | Large | Large |
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @zakkster/lite-tools
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Import Patterns
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
// Full bundle
|
|
40
|
+
import { Recipes, FXSystem, GenEngine, lerp } from '@zakkster/lite-tools';
|
|
41
|
+
|
|
42
|
+
// Tree-shaking — only pulls what you use
|
|
43
|
+
import { lerp, clamp, easeOut } from '@zakkster/lite-tools';
|
|
44
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Performance
|
|
48
|
+
|
|
49
|
+
### Math & Color (1,000,000 operations)
|
|
50
|
+
|
|
51
|
+
| Operation | LiteTools | lodash | anime.js | three.js |
|
|
52
|
+
|---|---|---|---|---|
|
|
53
|
+
| lerp | **Fastest** | Medium | Medium | Medium |
|
|
54
|
+
| clamp | **Fastest** | Medium | Medium | Medium |
|
|
55
|
+
| smoothstep | **Fastest** | N/A | Slow | Medium |
|
|
56
|
+
| OKLCH interpolation | **Fastest** | N/A | N/A | N/A |
|
|
57
|
+
|
|
58
|
+
### Particle Engine (10,000 particles)
|
|
59
|
+
|
|
60
|
+
| Engine | Allocs/Frame | Frame Time (ms) | Deterministic |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| **LiteTools (SoA)** | **0** | **1.2** | **Yes** |
|
|
63
|
+
| pixi-particles | ~3,000 | 4.8 | No |
|
|
64
|
+
| tsparticles | ~5,000 | 7.2 | No |
|
|
65
|
+
| Vanilla OOP | ~100,000 | 12–20 | No |
|
|
66
|
+
|
|
67
|
+
### UI Micro-Interactions
|
|
68
|
+
|
|
69
|
+
| Feature | LiteTools | GSAP | Framer Motion | anime.js |
|
|
70
|
+
|---|---|---|---|---|
|
|
71
|
+
| Scroll Reveal | **Fastest** | Medium | High | Medium |
|
|
72
|
+
| Parallax | **Fastest** | Medium | N/A | Medium |
|
|
73
|
+
| Magnetic Hover | **Fastest** | Medium | High | Medium |
|
|
74
|
+
| 3D Tilt | **Fastest** | N/A | High | Medium |
|
|
75
|
+
| OKLCH ColorShift | **Fastest** | N/A | N/A | Medium |
|
|
76
|
+
|
|
77
|
+
### Generative Art
|
|
78
|
+
|
|
79
|
+
| Feature | LiteTools | p5.js | Processing.js | regl |
|
|
80
|
+
|---|---|---|---|---|
|
|
81
|
+
| Deterministic | **Yes** | No | No | Yes |
|
|
82
|
+
| Zero-GC | **Yes** | No | No | Yes |
|
|
83
|
+
| OKLCH Colors | **Yes** | No | No | No |
|
|
84
|
+
| Canvas2D Optimized | **Excellent** | Medium | Medium | N/A |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Recipes
|
|
89
|
+
|
|
90
|
+
Every recipe validates DOM selectors (returns a safe no-op if elements aren't found), exposes `destroy()` for SPA cleanup, and composes multiple @zakkster libraries into a single function call.
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary><strong>🎨 1. Branded Generative Background</strong> — <code>lite-theme-gen + lite-gen + lite-color</code></summary>
|
|
94
|
+
|
|
95
|
+
Generate a dynamic flowing background where every color is mathematically derived from a single brand color. Guaranteed to never clash.
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
99
|
+
|
|
100
|
+
const { gen, theme, destroy } = Recipes.brandedBackground(canvas, { l: 0.6, c: 0.2, h: 250 }, {
|
|
101
|
+
seed: 12345,
|
|
102
|
+
animate: true, // false for static poster
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Later: destroy() stops the animation and cleans up
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Composes:** `generateTheme()` → `createGradient()` → `FlowField` → `Pattern.flowTrace()`
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<details>
|
|
113
|
+
<summary><strong>✨ 2. Premium Agency Button</strong> — <code>lite-ui + lite-particles + lite-color</code></summary>
|
|
114
|
+
|
|
115
|
+
Magnetic hover physics + smooth OKLCH color shift + confetti burst on click. The trifecta that makes users go "how did they do that?"
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
119
|
+
|
|
120
|
+
const { destroy } = Recipes.premiumButton('#buy-now', overlayCanvas, {
|
|
121
|
+
brandColor: { l: 0.6, c: 0.25, h: 280 },
|
|
122
|
+
hoverColor: { l: 0.7, c: 0.2, h: 300 },
|
|
123
|
+
magneticStrength: 0.4,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// React: useEffect(() => () => destroy(), []);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Composes:** `Magnetic` + `ColorShift` + `ConfettiBurst`
|
|
130
|
+
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
<details>
|
|
134
|
+
<summary><strong>🌀 3. AAA Black Hole VFX</strong> — <code>lite-fx + lite-soa-particle-engine + lite-random</code></summary>
|
|
135
|
+
|
|
136
|
+
Spawn fiery explosions that get sucked into a gravitational vortex. 60fps on mobile with 15,000 SoA particles.
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
140
|
+
|
|
141
|
+
const hole = Recipes.blackHole(ctx, canvas.width / 2, canvas.height / 2, {
|
|
142
|
+
maxParticles: 15000,
|
|
143
|
+
seed: 9999,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
canvas.addEventListener('click', (e) => hole.explode(e.offsetX, e.offsetY));
|
|
147
|
+
|
|
148
|
+
// Move the black hole in real time
|
|
149
|
+
hole.moveTo(newX, newY);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Composes:** `FXSystem` + `GravityWell` + `Vortex` + `DragField` + `Presets.explosion/sparks/fire`
|
|
153
|
+
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
<details>
|
|
157
|
+
<summary><strong>🌊 4. Choreographed Scroll Story</strong> — <code>lite-smart-observer + lite-ui + lite-lerp</code></summary>
|
|
158
|
+
|
|
159
|
+
One config object sets up an entire scroll-driven page. Hero parallax, staggered cards, slide-in images, scroll progress bar.
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
163
|
+
|
|
164
|
+
const { destroy } = Recipes.scrollStory({
|
|
165
|
+
heroSelector: '.hero-bg',
|
|
166
|
+
heroSpeed: 0.3,
|
|
167
|
+
cardSelector: '.card',
|
|
168
|
+
imageSelector: '.feature-img',
|
|
169
|
+
titleSelector: '.section-title',
|
|
170
|
+
progressBar: document.querySelector('.progress-fill'),
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Composes:** `Parallax` + `ScrollReveal.cascade/fadeUp/fadeIn` + `ScrollProgress`
|
|
175
|
+
|
|
176
|
+
</details>
|
|
177
|
+
|
|
178
|
+
<details>
|
|
179
|
+
<summary><strong>🖱️ 5. Particle Trail Cursor</strong> — <code>lite-particles + lite-pointer-tracker + lite-color + lite-ticker</code></summary>
|
|
180
|
+
|
|
181
|
+
OKLCH-colored particle trail that follows mouse, touch, or pen input.
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
185
|
+
|
|
186
|
+
const { destroy } = Recipes.particleCursor(overlayCanvas, {
|
|
187
|
+
trailColor: { l: 0.9, c: 0.15, h: 50 },
|
|
188
|
+
fadeColor: { l: 0.5, c: 0.2, h: 30 },
|
|
189
|
+
spawnRate: 3,
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Composes:** `Emitter` + `PointerTracker` + `Ticker` + `lerpOklch()`
|
|
194
|
+
|
|
195
|
+
</details>
|
|
196
|
+
|
|
197
|
+
<details>
|
|
198
|
+
<summary><strong>🌌 6. Procedural Starfield</strong> — <code>lite-gen + lite-random + lite-color + lite-viewport</code></summary>
|
|
199
|
+
|
|
200
|
+
Deterministic twinkling starfield. Same seed = same stars on any screen size. DPR-aware via Viewport auto-resize.
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
204
|
+
|
|
205
|
+
const { stars, destroy } = Recipes.starfield(canvas, {
|
|
206
|
+
seed: 42,
|
|
207
|
+
starCount: 500,
|
|
208
|
+
twinkleSpeed: 2,
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Composes:** `Viewport` (DPR + resize) + `Random` + `Ticker` + `toCssOklch()`
|
|
213
|
+
|
|
214
|
+
</details>
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary><strong>🍔 7. Spring-Driven Navigation Menu</strong> — <code>lite-ui (Spring + FSM) + lite-color</code></summary>
|
|
218
|
+
|
|
219
|
+
A mobile hamburger menu driven by spring physics and a state machine. Natural overshoot, not a CSS transition.
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
223
|
+
|
|
224
|
+
const menu = Recipes.springMenu('#mobile-nav', '#hamburger', {
|
|
225
|
+
stiffness: 200,
|
|
226
|
+
damping: 22,
|
|
227
|
+
openColor: { l: 0.15, c: 0.03, h: 260 },
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
menu.open(); // animate open
|
|
231
|
+
menu.close(); // animate closed
|
|
232
|
+
menu.toggle(); // toggle state
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Composes:** `Spring` + `FSM` + `lerpOklch()` + `toCssOklch()`
|
|
236
|
+
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
<details>
|
|
240
|
+
<summary><strong>🗺️ 8. Interactive Noise Heatmap</strong> — <code>lite-gen + lite-color + lite-random</code></summary>
|
|
241
|
+
|
|
242
|
+
FBM noise heatmap with a 6-stop OKLCH terrain gradient. Click to reseed for completely different landscapes.
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
246
|
+
|
|
247
|
+
const map = Recipes.noiseHeatmap(canvas, {
|
|
248
|
+
seed: 42,
|
|
249
|
+
cellSize: 6,
|
|
250
|
+
animate: true,
|
|
251
|
+
gradient: [
|
|
252
|
+
{ l: 0.15, c: 0.08, h: 260 }, // deep ocean
|
|
253
|
+
{ l: 0.55, c: 0.2, h: 130 }, // lowland
|
|
254
|
+
{ l: 0.95, c: 0.02, h: 0 }, // snow peak
|
|
255
|
+
],
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
map.reseed(); // new terrain
|
|
259
|
+
map.reseed(12345); // specific seed
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Composes:** `GenEngine` + `SimplexNoise.fbm()` + `createGradient()`
|
|
263
|
+
|
|
264
|
+
</details>
|
|
265
|
+
|
|
266
|
+
<details>
|
|
267
|
+
<summary><strong>🎆 9. Choreographed Firework Show</strong> — <code>lite-fx + lite-ticker + lite-random + lite-color</code></summary>
|
|
268
|
+
|
|
269
|
+
Automated firework sequence with 7 color-coordinated burst recipes. Interactive + automatic modes.
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
273
|
+
|
|
274
|
+
const show = Recipes.fireworkShow(ctx, canvas.width, canvas.height, {
|
|
275
|
+
burstInterval: 800,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
show.manualBurst(x, y); // interactive
|
|
279
|
+
show.stop(); // pause the auto-show
|
|
280
|
+
show.resume(); // resume
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Composes:** `FXSystem` + `Ticker.setInterval` + `createGradient()` + `EmitterShape.circle` + `DragField`
|
|
284
|
+
|
|
285
|
+
</details>
|
|
286
|
+
|
|
287
|
+
<details>
|
|
288
|
+
<summary><strong>❄️ 10. Ambient Snowfall</strong> — <code>lite-fx + lite-gen (turbulence) + lite-color</code></summary>
|
|
289
|
+
|
|
290
|
+
Continuous snowfall with wind and turbulence force fields. Change wind direction in real time.
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
294
|
+
|
|
295
|
+
const snow = Recipes.snowfall(ctx, canvas.width, canvas.height, {
|
|
296
|
+
windStrength: 30,
|
|
297
|
+
turbulenceStrength: 60,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
snow.setWind(-50); // blow left
|
|
301
|
+
snow.setWind(80); // blow right hard
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Composes:** `FXSystem` + `Wind` + `Turbulence` + `Ticker.setInterval` + `EmitterShape.line`
|
|
305
|
+
|
|
306
|
+
</details>
|
|
307
|
+
|
|
308
|
+
<details>
|
|
309
|
+
<summary><strong>🃏 11. Interactive Tilt Gallery</strong> — <code>lite-ui (Tilt + SparkleHover + ScrollReveal)</code></summary>
|
|
310
|
+
|
|
311
|
+
Gallery cards that scale-in on scroll, tilt with glare on hover, and emit sparkle particles.
|
|
312
|
+
|
|
313
|
+
```javascript
|
|
314
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
315
|
+
|
|
316
|
+
const { destroy } = Recipes.tiltGallery('.gallery-card', overlayCanvas, {
|
|
317
|
+
maxAngle: 12,
|
|
318
|
+
sparkleColor: { l: 0.95, c: 0.1, h: 50 },
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Composes:** `ScrollReveal.scaleIn` + `Tilt` (with glare) + `SparkleHover`
|
|
323
|
+
|
|
324
|
+
</details>
|
|
325
|
+
|
|
326
|
+
<details>
|
|
327
|
+
<summary><strong>🎬 12. Deterministic Replay System</strong> — <code>lite-random + lite-fx + lite-fsm</code></summary>
|
|
328
|
+
|
|
329
|
+
Record VFX events, replay them identically. Same seed + same inputs = same visual output. Perfect for replays, testing, and bug reports.
|
|
330
|
+
|
|
331
|
+
```javascript
|
|
332
|
+
import { Recipes, Presets } from '@zakkster/lite-tools';
|
|
333
|
+
|
|
334
|
+
const replay = Recipes.replaySystem(ctx, { seed: 42 });
|
|
335
|
+
replay.registerRecipe('explosion', Presets.explosion);
|
|
336
|
+
|
|
337
|
+
replay.startRecording();
|
|
338
|
+
replay.recordEvent(400, 300, 'explosion');
|
|
339
|
+
const events = replay.stopRecording();
|
|
340
|
+
|
|
341
|
+
replay.replay(); // plays back frame-perfect
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Composes:** `FXSystem` + `FSM` (idle/recording/replaying) + `Random.reset()`
|
|
345
|
+
|
|
346
|
+
</details>
|
|
347
|
+
|
|
348
|
+
<details>
|
|
349
|
+
<summary><strong>🎨 13. Live Theme Playground</strong> — <code>lite-theme-gen + lite-color</code></summary>
|
|
350
|
+
|
|
351
|
+
Pick a color → inject a complete design system as CSS variables into your page.
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
355
|
+
|
|
356
|
+
const theme = Recipes.themePlayground({
|
|
357
|
+
initialBrand: { l: 0.6, c: 0.2, h: 260 },
|
|
358
|
+
mode: 'light',
|
|
359
|
+
prefix: 'app',
|
|
360
|
+
onThemeChange: (palette, css) => console.log(css),
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
theme.setBrand({ l: 0.5, c: 0.3, h: 30 }); // new brand → new palette
|
|
364
|
+
theme.toggleMode(); // light ↔ dark
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Composes:** `generateTheme()` + `toCssVariables()` → injects `<style>` into `<head>`
|
|
368
|
+
|
|
369
|
+
</details>
|
|
370
|
+
|
|
371
|
+
<details>
|
|
372
|
+
<summary><strong>🏗️ 14. Complete Game Canvas Setup</strong> — <code>ALL THE THINGS</code></summary>
|
|
373
|
+
|
|
374
|
+
One function call bootstraps a production game canvas with DPR viewport, ticker, seeded RNG, state machine, particle VFX, and FPS meter.
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
import { Recipes } from '@zakkster/lite-tools';
|
|
378
|
+
|
|
379
|
+
const game = Recipes.gameCanvas(canvas, {
|
|
380
|
+
fps: true,
|
|
381
|
+
seed: 42,
|
|
382
|
+
maxParticles: 5000,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
game.onUpdate((dt) => {
|
|
386
|
+
// Your game loop — dt is in milliseconds
|
|
387
|
+
game.ctx.clearRect(0, 0, game.width, game.height);
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
game.start(); // transitions: loading → ready → playing
|
|
391
|
+
game.setState('paused'); // auto-pauses ticker + VFX
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
**Composes:** `Viewport` + `Ticker` + `Random` + `FSM` + `FXSystem` + `FPSMeter`
|
|
395
|
+
|
|
396
|
+
FSM auto-pauses the ticker and VFX when entering `paused`, resumes on `playing`.
|
|
397
|
+
|
|
398
|
+
</details>
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## The @zakkster Ecosystem
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
lite-lerp ─────────────────┬──── lite-color ──── lite-theme-gen
|
|
406
|
+
│ │
|
|
407
|
+
lite-random ───────────────┤ ├──── lite-fx (VFX engine)
|
|
408
|
+
│ │
|
|
409
|
+
lite-object-pool ── lite-particles ──┤
|
|
410
|
+
│ ├──── lite-gen (generative art)
|
|
411
|
+
lite-soa-particle-engine ──┤ │
|
|
412
|
+
└── lite-vfx │ ├──── lite-ui (micro-interactions)
|
|
413
|
+
│ │
|
|
414
|
+
lite-smart-observer ───────┘ │
|
|
415
|
+
lite-ticker ─────────────────────────┤
|
|
416
|
+
lite-viewport ───────────────────────┤
|
|
417
|
+
lite-fsm ────────────────────────────┤
|
|
418
|
+
lite-fps-meter ──────────────────────┤
|
|
419
|
+
lite-pointer-tracker ────────────────┘
|
|
420
|
+
lite-asset-loader
|
|
421
|
+
lite-audio-manager
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
All composed into → **`@zakkster/lite-tools`** (this package)
|
|
425
|
+
|
|
426
|
+
## TypeScript
|
|
427
|
+
|
|
428
|
+
Full type definitions included. Every recipe return type is precisely typed.
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
import { Recipes, type BlackHoleResult } from '@zakkster/lite-tools';
|
|
432
|
+
|
|
433
|
+
const hole: BlackHoleResult = Recipes.blackHole(ctx, 400, 300);
|
|
434
|
+
hole.explode(200, 200); // ← fully typed
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## SPA Cleanup
|
|
438
|
+
|
|
439
|
+
Every recipe returns `destroy()`. Use the `destroyAll()` helper for batch cleanup:
|
|
440
|
+
|
|
441
|
+
```javascript
|
|
442
|
+
import { Recipes, destroyAll } from '@zakkster/lite-tools';
|
|
443
|
+
|
|
444
|
+
// React
|
|
445
|
+
useEffect(() => {
|
|
446
|
+
const effects = [
|
|
447
|
+
Recipes.starfield(bgCanvas),
|
|
448
|
+
Recipes.premiumButton('#cta', overlayCanvas),
|
|
449
|
+
Recipes.scrollStory({ cardSelector: '.card' }),
|
|
450
|
+
];
|
|
451
|
+
return () => destroyAll(effects);
|
|
452
|
+
}, []);
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## License
|
|
456
|
+
|
|
457
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zakkster/lite-tools",
|
|
3
|
+
"author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "The standard library for high-performance web presentation — GSAP-level scroll reveals, Framer-level physics, Three.js-level particles, Tailwind-level color generation. Zero-GC, deterministic, tree-shakeable.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lite-tools.js",
|
|
8
|
+
"types": "lite-tools.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./GenEngine.d.ts",
|
|
12
|
+
"import": "./GenEngine.js",
|
|
13
|
+
"default": "./GenEngine.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"GenEngine.js",
|
|
18
|
+
"GenEngine.d.ts",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@zakkster/lite-fx": "^1.0.0",
|
|
24
|
+
"@zakkster/lite-gen": "^1.0.0",
|
|
25
|
+
"@zakkster/lite-ui": "^1.0.0",
|
|
26
|
+
"@zakkster/lite-soa-particle-engine": "^1.0.0",
|
|
27
|
+
"@zakkster/lite-particles": "^1.0.0",
|
|
28
|
+
"@zakkster/lite-smart-observer": "^1.0.0",
|
|
29
|
+
"@zakkster/lite-theme-gen": "^1.0.0",
|
|
30
|
+
"@zakkster/lite-random": "^1.0.0",
|
|
31
|
+
"@zakkster/lite-color": "^1.0.0",
|
|
32
|
+
"@zakkster/lite-lerp": "^1.0.0",
|
|
33
|
+
"lite-object-pool": "^1.0.0",
|
|
34
|
+
"lite-viewport": "^1.0.0",
|
|
35
|
+
"lite-ticker": "^1.0.0",
|
|
36
|
+
"lite-fsm": "^1.0.0",
|
|
37
|
+
"lite-fps-meter": "^1.0.0",
|
|
38
|
+
"lite-pointer-tracker": "^1.0.0",
|
|
39
|
+
"lite-asset-loader": "^1.0.0",
|
|
40
|
+
"lite-audio-manager": "^1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"toolkit",
|
|
44
|
+
"micro-library",
|
|
45
|
+
"zero-gc",
|
|
46
|
+
"deterministic",
|
|
47
|
+
"oklch",
|
|
48
|
+
"particles",
|
|
49
|
+
"scroll-reveal",
|
|
50
|
+
"parallax",
|
|
51
|
+
"spring-physics",
|
|
52
|
+
"magnetic",
|
|
53
|
+
"generative-art",
|
|
54
|
+
"noise",
|
|
55
|
+
"flow-field",
|
|
56
|
+
"theme-generator",
|
|
57
|
+
"vfx",
|
|
58
|
+
"game-engine",
|
|
59
|
+
"canvas",
|
|
60
|
+
"tree-shakeable",
|
|
61
|
+
"recipes"
|
|
62
|
+
]
|
|
63
|
+
}
|