@fylib/animation 0.1.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,603 @@
1
+ import { animationEngine } from './engine';
2
+ const buttonAnimationsCss = `
3
+ .fy-anim-button-hover-soft:hover {
4
+ transform: translateY(-1px);
5
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
6
+ }
7
+
8
+ .fy-anim-button-hover-glow:hover {
9
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
10
+ }
11
+
12
+ .fy-anim-button-hover-lift:hover {
13
+ transform: translateY(-2px) scale(1.02);
14
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
15
+ }
16
+
17
+ .fy-anim-button-click-press:active {
18
+ transform: translateY(1px) scale(0.97);
19
+ }
20
+ `;
21
+ const layoutAnimationsCss = `
22
+ .fy-anim-layout-fade-in {
23
+ animation: fy-layout-fade-in 0.4s ease-out;
24
+ }
25
+
26
+ @keyframes fy-layout-fade-in {
27
+ from {
28
+ opacity: 0;
29
+ transform: translateY(8px);
30
+ }
31
+ to {
32
+ opacity: 1;
33
+ transform: translateY(0);
34
+ }
35
+ }
36
+ `;
37
+ const sidebarAnimationsCss = `
38
+ .fy-anim-sidebar-slide-in {
39
+ animation: fy-sidebar-slide-in 0.25s ease-out;
40
+ }
41
+
42
+ .fy-anim-sidebar-slide-out {
43
+ animation: fy-sidebar-slide-out 0.25s ease-in;
44
+ }
45
+
46
+ @keyframes fy-sidebar-slide-in {
47
+ from {
48
+ transform: translateX(-100%);
49
+ }
50
+ to {
51
+ transform: translateX(0);
52
+ }
53
+ }
54
+
55
+ @keyframes fy-sidebar-slide-out {
56
+ from {
57
+ transform: translateX(0);
58
+ }
59
+ to {
60
+ transform: translateX(-100%);
61
+ }
62
+ }
63
+ `;
64
+ const headerMenuAnimationsCss = `
65
+ .fy-anim-header-menu-dropdown-in {
66
+ animation: fy-header-menu-dropdown-in 0.25s ease-out;
67
+ }
68
+ .fy-anim-header-menu-dropdown-out {
69
+ animation: fy-header-menu-dropdown-out 0.25s ease-in;
70
+ }
71
+ @keyframes fy-header-menu-dropdown-in {
72
+ from { transform: translateY(-8px); opacity: 0; }
73
+ to { transform: translateY(0); opacity: 1; }
74
+ }
75
+ @keyframes fy-header-menu-dropdown-out {
76
+ from { transform: translateY(0); opacity: 1; }
77
+ to { transform: translateY(-8px); opacity: 0; }
78
+ }
79
+
80
+ .fy-anim-header-menu-macos-slide-in {
81
+ animation: fy-header-menu-macos-slide-in 0.3s ease-out;
82
+ }
83
+ .fy-anim-header-menu-macos-slide-out {
84
+ animation: fy-header-menu-macos-slide-out 0.26s ease-in;
85
+ }
86
+ @keyframes fy-header-menu-macos-slide-in {
87
+ from { transform: translateY(-16px); opacity: 0; }
88
+ to { transform: translateY(0); opacity: 1; }
89
+ }
90
+ @keyframes fy-header-menu-macos-slide-out {
91
+ from { transform: translateY(0); opacity: 1; }
92
+ to { transform: translateY(-16px); opacity: 0; }
93
+ }
94
+ `;
95
+ const inputAnimationsCss = `
96
+ .fy-anim-input-focus-glow:focus-within {
97
+ box-shadow: 0 0 0 2px rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.45);
98
+ border-color: rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.7);
99
+ }
100
+
101
+ .fy-anim-input-focus-soft:focus-within {
102
+ box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
103
+ }
104
+
105
+ .fy-anim-input-success-pulse {
106
+ animation: fy-input-success-pulse 0.4s ease-out;
107
+ }
108
+
109
+ .fy-anim-input-error-shake {
110
+ animation: fy-input-error-shake 0.3s ease-in-out;
111
+ }
112
+
113
+ @keyframes fy-input-success-pulse {
114
+ 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
115
+ 100% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
116
+ }
117
+
118
+ @keyframes fy-input-error-shake {
119
+ 0%, 100% { transform: translateX(0); }
120
+ 25% { transform: translateX(-2px); }
121
+ 75% { transform: translateX(2px); }
122
+ }
123
+ `;
124
+ const tableAnimationsCss = `
125
+ .fy-anim-table-fade-in {
126
+ animation: fy-table-fade-in 0.4s ease-out;
127
+ }
128
+
129
+ .fy-anim-table-row-enter {
130
+ animation: fy-table-row-enter 0.3s ease-out;
131
+ }
132
+
133
+ @keyframes fy-table-fade-in {
134
+ from { opacity: 0; transform: translateY(4px); }
135
+ to { opacity: 1; transform: translateY(0); }
136
+ }
137
+
138
+ @keyframes fy-table-row-enter {
139
+ from { opacity: 0; transform: translateX(-4px); }
140
+ to { opacity: 1; transform: translateX(0); }
141
+ }
142
+ `;
143
+ const cardAnimationsCss = `
144
+ .fy-anim-card-fade-in {
145
+ animation: fy-card-fade-in 0.4s ease-out;
146
+ }
147
+
148
+ @keyframes fy-card-fade-in {
149
+ from {
150
+ opacity: 0;
151
+ transform: translateY(4px);
152
+ }
153
+ to {
154
+ opacity: 1;
155
+ transform: translateY(0);
156
+ }
157
+ }
158
+ `;
159
+ const selectAnimationsCss = `
160
+ .fy-anim-select-focus-glow:focus-within {
161
+ box-shadow: 0 0 0 2px rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.45);
162
+ border-color: rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.7);
163
+ }
164
+
165
+ .fy-anim-select-focus-soft:focus-within {
166
+ box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
167
+ }
168
+
169
+ .fy-anim-select-success-pulse {
170
+ animation: fy-select-success-pulse 0.4s ease-out;
171
+ }
172
+
173
+ .fy-anim-select-error-shake {
174
+ animation: fy-select-error-shake 0.3s ease-in-out;
175
+ }
176
+
177
+ @keyframes fy-select-success-pulse {
178
+ 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
179
+ 100% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
180
+ }
181
+
182
+ @keyframes fy-select-error-shake {
183
+ 0%, 100% { transform: translateX(0); }
184
+ 25% { transform: translateX(-2px); }
185
+ 75% { transform: translateX(2px); }
186
+ }
187
+ `;
188
+ const macosAnimationsCss = `
189
+ .fy-anim-layout-macos-window-enter {
190
+ animation: fy-layout-macos-window-enter 0.45s ease-out;
191
+ }
192
+
193
+ @keyframes fy-layout-macos-window-enter {
194
+ 0% {
195
+ opacity: 0;
196
+ transform: translateY(-12px) scale(0.98);
197
+ }
198
+ 60% {
199
+ opacity: 1;
200
+ transform: translateY(2px) scale(1.01);
201
+ }
202
+ 100% {
203
+ opacity: 1;
204
+ transform: translateY(0) scale(1);
205
+ }
206
+ }
207
+
208
+ .fy-anim-sidebar-macos-slide-in {
209
+ animation: fy-sidebar-macos-slide-in 0.3s ease-out;
210
+ }
211
+
212
+ .fy-anim-sidebar-macos-slide-out {
213
+ animation: fy-sidebar-macos-slide-out 0.26s ease-in;
214
+ }
215
+
216
+ @keyframes fy-sidebar-macos-slide-in {
217
+ from {
218
+ transform: translateX(-16px);
219
+ opacity: 0;
220
+ }
221
+ to {
222
+ transform: translateX(0);
223
+ opacity: 1;
224
+ }
225
+ }
226
+
227
+ @keyframes fy-sidebar-macos-slide-out {
228
+ from {
229
+ transform: translateX(0);
230
+ opacity: 1;
231
+ }
232
+ to {
233
+ transform: translateX(-16px);
234
+ opacity: 0;
235
+ }
236
+ }
237
+
238
+ .fy-anim-input-focus-macos-glow:focus-within {
239
+ box-shadow: 0 0 0 2px rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.45);
240
+ border-color: rgba(var(--fy-colors-primary-rgb, 59,130,246), 0.8);
241
+ }
242
+
243
+ .fy-anim-input-success-macos-pulse {
244
+ animation: fy-input-success-macos-pulse 0.45s ease-out;
245
+ }
246
+
247
+ @keyframes fy-input-success-macos-pulse {
248
+ 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); }
249
+ 100% { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); }
250
+ }
251
+
252
+ .fy-anim-input-error-macos-shake {
253
+ animation: fy-input-error-macos-shake 0.35s ease-in-out;
254
+ }
255
+
256
+ @keyframes fy-input-error-macos-shake {
257
+ 0%, 100% { transform: translateX(0); }
258
+ 20% { transform: translateX(-3px); }
259
+ 40% { transform: translateX(3px); }
260
+ 60% { transform: translateX(-2px); }
261
+ 80% { transform: translateX(2px); }
262
+ }
263
+
264
+ .fy-anim-card-macos-fade-in {
265
+ animation: fy-card-macos-fade-in 0.45s ease-out;
266
+ }
267
+
268
+ @keyframes fy-card-macos-fade-in {
269
+ from {
270
+ opacity: 0;
271
+ transform: translateY(6px) scale(0.99);
272
+ }
273
+ to {
274
+ opacity: 1;
275
+ transform: translateY(0) scale(1);
276
+ }
277
+ }
278
+
279
+ .fy-anim-button-hover-macos-soft:hover {
280
+ transform: translateY(-1px);
281
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
282
+ }
283
+
284
+ .fy-anim-button-click-macos-press:active {
285
+ transform: translateY(1px) scale(0.97);
286
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
287
+ }
288
+ `;
289
+ const puffyAnimationsCss = `
290
+ .fy-anim-button-puffy-bounce:hover {
291
+ transform: scale(1.05);
292
+ box-shadow: 0 8px 25px rgba(255, 133, 162, 0.4);
293
+ }
294
+ .fy-anim-button-puffy-press:active {
295
+ transform: scale(0.95);
296
+ }
297
+ .fy-anim-card-puffy-float {
298
+ animation: fy-puffy-float 3s ease-in-out infinite;
299
+ }
300
+ .fy-anim-input-puffy-glow:focus-within {
301
+ box-shadow: 0 0 0 4px rgba(255, 133, 162, 0.25);
302
+ border-color: #ff85a2;
303
+ }
304
+ .fy-anim-puffy-sparkle {
305
+ animation: fy-puffy-sparkle 1.5s ease-in-out infinite;
306
+ background: linear-gradient(90deg, #ff4d6d, #ff85a2, #ff4d6d);
307
+ background-size: 200% auto;
308
+ }
309
+
310
+ @keyframes fy-puffy-float {
311
+ 0%, 100% { transform: translateY(0); }
312
+ 50% { transform: translateY(-6px); }
313
+ }
314
+ @keyframes fy-puffy-sparkle {
315
+ 0% { background-position: 0% center; opacity: 0.8; }
316
+ 50% { background-position: 100% center; opacity: 1; transform: scale(1.05); }
317
+ 100% { background-position: 0% center; opacity: 0.8; }
318
+ }
319
+ `;
320
+ const allAnimationsCss = `
321
+ ${buttonAnimationsCss}
322
+ ${layoutAnimationsCss}
323
+ ${sidebarAnimationsCss}
324
+ ${headerMenuAnimationsCss}
325
+ ${inputAnimationsCss}
326
+ ${tableAnimationsCss}
327
+ ${cardAnimationsCss}
328
+ ${selectAnimationsCss}
329
+ ${macosAnimationsCss}
330
+ ${puffyAnimationsCss}
331
+ `;
332
+ function injectCssOnce(id, css) {
333
+ if (typeof document === 'undefined')
334
+ return;
335
+ if (document.getElementById(id))
336
+ return;
337
+ const style = document.createElement('style');
338
+ style.id = id;
339
+ style.textContent = css;
340
+ document.head.appendChild(style);
341
+ }
342
+ injectCssOnce('fy-button-animations', buttonAnimationsCss);
343
+ injectCssOnce('fy-layout-animations', layoutAnimationsCss);
344
+ injectCssOnce('fy-sidebar-animations', sidebarAnimationsCss);
345
+ injectCssOnce('fy-header-menu-animations', headerMenuAnimationsCss);
346
+ injectCssOnce('fy-input-animations', inputAnimationsCss);
347
+ injectCssOnce('fy-card-animations', cardAnimationsCss);
348
+ injectCssOnce('fy-table-animations', tableAnimationsCss);
349
+ injectCssOnce('fy-macos-animations', macosAnimationsCss);
350
+ const modalAnimationsCss = `
351
+ .fy-anim-modal-fade-in {
352
+ animation: fy-modal-fade-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
353
+ }
354
+ .fy-anim-modal-fade-out {
355
+ animation: fy-modal-fade-out 0.22s cubic-bezier(0.4, 0, 1, 1);
356
+ }
357
+ @keyframes fy-modal-fade-in {
358
+ 0% {
359
+ opacity: 0;
360
+ transform: translate(-50%, -50%) scale(0.96);
361
+ }
362
+ 100% {
363
+ opacity: 1;
364
+ transform: translate(-50%, -50%) scale(1);
365
+ }
366
+ }
367
+ @keyframes fy-modal-fade-out {
368
+ 0% {
369
+ opacity: 1;
370
+ transform: translate(-50%, -50%) scale(1);
371
+ }
372
+ 100% {
373
+ opacity: 0;
374
+ transform: translate(-50%, -50%) scale(0.96);
375
+ }
376
+ }
377
+ `;
378
+ const dropdownAnimationsCss = `
379
+ .fy-anim-dropdown-in {
380
+ animation: fy-dropdown-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
381
+ transform-origin: top right;
382
+ }
383
+ .fy-anim-dropdown-out {
384
+ animation: fy-dropdown-out 0.2s cubic-bezier(0.4, 0, 1, 1);
385
+ transform-origin: top right;
386
+ }
387
+ @keyframes fy-dropdown-in {
388
+ from { opacity: 0; transform: scale(0.95) translateY(-8px); }
389
+ to { opacity: 1; transform: scale(1) translateY(0); }
390
+ }
391
+ @keyframes fy-dropdown-out {
392
+ from { opacity: 1; transform: scale(1) translateY(0); }
393
+ to { opacity: 0; transform: scale(0.95) translateY(-8px); }
394
+ }
395
+ `;
396
+ const accordionAnimationsCss = `
397
+ .fy-accordion__panel {
398
+ overflow: hidden;
399
+ transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, padding 0.3s ease;
400
+ }
401
+ .fy-anim-accordion-expand {
402
+ animation: fy-accordion-expand 0.3s ease-out;
403
+ }
404
+ .fy-anim-accordion-collapse {
405
+ animation: fy-accordion-collapse 0.25s ease-in;
406
+ }
407
+ @keyframes fy-accordion-expand {
408
+ from { opacity: 0; transform: translateY(-4px); }
409
+ to { opacity: 1; transform: translateY(0); }
410
+ }
411
+ @keyframes fy-accordion-collapse {
412
+ from { opacity: 1; transform: translateY(0); }
413
+ to { opacity: 0; transform: translateY(-4px); }
414
+ }
415
+ `;
416
+ injectCssOnce('fy-modal-animations', modalAnimationsCss);
417
+ injectCssOnce('fy-dropdown-animations', dropdownAnimationsCss);
418
+ injectCssOnce('fy-accordion-animations', accordionAnimationsCss);
419
+ animationEngine.registerAnimation({
420
+ name: 'button-hover-soft',
421
+ duration: 150,
422
+ easing: 'ease-out'
423
+ });
424
+ animationEngine.registerAnimation({
425
+ name: 'button-hover-glow',
426
+ duration: 150,
427
+ easing: 'ease-out'
428
+ });
429
+ animationEngine.registerAnimation({
430
+ name: 'button-hover-lift',
431
+ duration: 180,
432
+ easing: 'ease-out'
433
+ });
434
+ animationEngine.registerAnimation({
435
+ name: 'button-click-press',
436
+ duration: 120,
437
+ easing: 'ease-out'
438
+ });
439
+ animationEngine.registerAnimation({
440
+ name: 'button-click-ripple',
441
+ duration: 220,
442
+ easing: 'ease-out'
443
+ });
444
+ animationEngine.registerAnimation({
445
+ name: 'button-success-pulse',
446
+ duration: 300,
447
+ easing: 'ease-in-out'
448
+ });
449
+ animationEngine.registerAnimation({
450
+ name: 'button-error-shake',
451
+ duration: 300,
452
+ easing: 'ease-in-out'
453
+ });
454
+ animationEngine.registerAnimation({
455
+ name: 'layout-fade-in',
456
+ duration: 400,
457
+ easing: 'ease-out'
458
+ });
459
+ animationEngine.registerAnimation({
460
+ name: 'sidebar-slide-in',
461
+ duration: 250,
462
+ easing: 'ease-out'
463
+ });
464
+ animationEngine.registerAnimation({
465
+ name: 'sidebar-slide-out',
466
+ duration: 250,
467
+ easing: 'ease-in'
468
+ });
469
+ animationEngine.registerAnimation({
470
+ name: 'header-menu-dropdown-in',
471
+ duration: 250,
472
+ easing: 'ease-out'
473
+ });
474
+ animationEngine.registerAnimation({
475
+ name: 'header-menu-dropdown-out',
476
+ duration: 250,
477
+ easing: 'ease-in'
478
+ });
479
+ animationEngine.registerAnimation({
480
+ name: 'header-menu-macos-slide-in',
481
+ duration: 300,
482
+ easing: 'ease-out'
483
+ });
484
+ animationEngine.registerAnimation({
485
+ name: 'header-menu-macos-slide-out',
486
+ duration: 260,
487
+ easing: 'ease-in'
488
+ });
489
+ animationEngine.registerAnimation({
490
+ name: 'input-focus-glow',
491
+ duration: 200,
492
+ easing: 'ease-out'
493
+ });
494
+ animationEngine.registerAnimation({
495
+ name: 'input-focus-soft',
496
+ duration: 200,
497
+ easing: 'ease-out'
498
+ });
499
+ animationEngine.registerAnimation({
500
+ name: 'input-success-pulse',
501
+ duration: 400,
502
+ easing: 'ease-out'
503
+ });
504
+ animationEngine.registerAnimation({
505
+ name: 'input-error-shake',
506
+ duration: 300,
507
+ easing: 'ease-in-out'
508
+ });
509
+ animationEngine.registerAnimation({
510
+ name: 'card-fade-in',
511
+ duration: 400,
512
+ easing: 'ease-out'
513
+ });
514
+ animationEngine.registerAnimation({
515
+ name: 'layout-macos-window-enter',
516
+ duration: 450,
517
+ easing: 'ease-out'
518
+ });
519
+ animationEngine.registerAnimation({
520
+ name: 'sidebar-macos-slide-in',
521
+ duration: 300,
522
+ easing: 'ease-out'
523
+ });
524
+ animationEngine.registerAnimation({
525
+ name: 'sidebar-macos-slide-out',
526
+ duration: 260,
527
+ easing: 'ease-in'
528
+ });
529
+ animationEngine.registerAnimation({
530
+ name: 'input-focus-macos-glow',
531
+ duration: 220,
532
+ easing: 'ease-out'
533
+ });
534
+ animationEngine.registerAnimation({
535
+ name: 'input-success-macos-pulse',
536
+ duration: 450,
537
+ easing: 'ease-out'
538
+ });
539
+ animationEngine.registerAnimation({
540
+ name: 'input-error-macos-shake',
541
+ duration: 350,
542
+ easing: 'ease-in-out'
543
+ });
544
+ animationEngine.registerAnimation({
545
+ name: 'table-fade-in',
546
+ duration: 400,
547
+ easing: 'ease-out'
548
+ });
549
+ animationEngine.registerAnimation({
550
+ name: 'dropdown-in',
551
+ duration: 250,
552
+ easing: 'ease-out'
553
+ });
554
+ animationEngine.registerAnimation({
555
+ name: 'dropdown-out',
556
+ duration: 200,
557
+ easing: 'ease-in'
558
+ });
559
+ animationEngine.registerAnimation({
560
+ name: 'accordion-expand',
561
+ duration: 300,
562
+ easing: 'ease-out'
563
+ });
564
+ animationEngine.registerAnimation({
565
+ name: 'accordion-collapse',
566
+ duration: 250,
567
+ easing: 'ease-in'
568
+ });
569
+ animationEngine.registerAnimation({
570
+ name: 'table-row-enter',
571
+ duration: 300,
572
+ easing: 'ease-out'
573
+ });
574
+ animationEngine.registerAnimation({
575
+ name: 'table-macos-fade-in',
576
+ duration: 350,
577
+ easing: 'cubic-bezier(0.23, 1, 0.32, 1)'
578
+ });
579
+ animationEngine.registerAnimation({
580
+ name: 'card-macos-fade-in',
581
+ duration: 450,
582
+ easing: 'ease-out'
583
+ });
584
+ animationEngine.registerAnimation({
585
+ name: 'button-hover-macos-soft',
586
+ duration: 160,
587
+ easing: 'ease-out'
588
+ });
589
+ animationEngine.registerAnimation({
590
+ name: 'button-click-macos-press',
591
+ duration: 130,
592
+ easing: 'ease-out'
593
+ });
594
+ animationEngine.registerAnimation({
595
+ name: 'modal-fade-in',
596
+ duration: 280,
597
+ easing: 'cubic-bezier(0.22, 1, 0.36, 1)'
598
+ });
599
+ animationEngine.registerAnimation({
600
+ name: 'modal-fade-out',
601
+ duration: 220,
602
+ easing: 'cubic-bezier(0.4, 0, 1, 1)'
603
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { animationEngine } from '../engine';
2
+ animationEngine.registerEffect({ name: 'confetti', type: 'global' });
3
+ animationEngine.registerEffect({ name: 'hearts', type: 'global' });
4
+ animationEngine.registerEffect({ name: 'snow', type: 'global' });
5
+ animationEngine.registerEffect({ name: 'bubbles', type: 'global' });
6
+ animationEngine.registerEffect({ name: 'matrix', type: 'global' });
7
+ animationEngine.registerEffect({ name: 'particles', type: 'global' });
8
+ animationEngine.registerEffect({ name: 'stars', type: 'global' });
9
+ animationEngine.registerEffect({ name: 'aurora', type: 'global' });
10
+ animationEngine.registerEffect({ name: 'window-open', type: 'global' });
11
+ animationEngine.registerEffect({ name: 'sidebar-slide-in', type: 'global' });
12
+ animationEngine.registerEffect({ name: 'sidebar-slide-out', type: 'global' });
13
+ animationEngine.registerEffect({ name: 'window-macos-sheet-open', type: 'global' });
14
+ animationEngine.registerEffect({ name: 'window-macos-sheet-close', type: 'global' });
@@ -0,0 +1 @@
1
+ export type GlobalEffectName = 'confetti' | 'window-open' | 'sidebar-slide-in' | 'sidebar-slide-out';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { AnimationDefinition, EffectDefinition } from '@fylib/core';
2
+ export interface AnimationPlugin {
3
+ name: string;
4
+ onBeforeAnimation?(animation: AnimationDefinition): void;
5
+ onAfterAnimation?(animation: AnimationDefinition): void;
6
+ }
7
+ export interface GlobalEffectPlugin {
8
+ name: string;
9
+ renderEffect(effect: EffectDefinition): void;
10
+ }
11
+ export declare class AnimationEngine {
12
+ private animations;
13
+ private effects;
14
+ private animationPlugins;
15
+ private globalEffectPlugins;
16
+ registerAnimation(animation: AnimationDefinition): void;
17
+ registerEffect(effect: EffectDefinition): void;
18
+ registerAnimationPlugin(plugin: AnimationPlugin): void;
19
+ registerGlobalEffectPlugin(plugin: GlobalEffectPlugin): void;
20
+ playAnimation(name: string): void;
21
+ triggerEffect(name: string, params?: Record<string, any>): void;
22
+ }
23
+ export declare const animationEngine: AnimationEngine;
package/dist/engine.js ADDED
@@ -0,0 +1,40 @@
1
+ import { logger } from '@fylib/logger';
2
+ export class AnimationEngine {
3
+ constructor() {
4
+ this.animations = new Map();
5
+ this.effects = new Map();
6
+ this.animationPlugins = [];
7
+ this.globalEffectPlugins = [];
8
+ }
9
+ registerAnimation(animation) {
10
+ this.animations.set(animation.name, animation);
11
+ }
12
+ registerEffect(effect) {
13
+ this.effects.set(effect.name, effect);
14
+ }
15
+ registerAnimationPlugin(plugin) {
16
+ this.animationPlugins.push(plugin);
17
+ }
18
+ registerGlobalEffectPlugin(plugin) {
19
+ this.globalEffectPlugins.push(plugin);
20
+ }
21
+ playAnimation(name) {
22
+ const animation = this.animations.get(name);
23
+ if (!animation)
24
+ return;
25
+ this.animationPlugins.forEach(p => p.onBeforeAnimation?.(animation));
26
+ logger.debug('Animation', `Playing animation: ${name}`, animation);
27
+ // Implementation would go here (e.g., CSS injection or Web Animations API)
28
+ this.animationPlugins.forEach(p => p.onAfterAnimation?.(animation));
29
+ }
30
+ triggerEffect(name, params) {
31
+ const effect = this.effects.get(name);
32
+ if (!effect)
33
+ return;
34
+ if (effect.type === 'global') {
35
+ const mergedEffect = params ? { ...effect, params: { ...effect.params, ...params } } : effect;
36
+ this.globalEffectPlugins.forEach(p => p.renderEffect(mergedEffect));
37
+ }
38
+ }
39
+ }
40
+ export const animationEngine = new AnimationEngine();
@@ -0,0 +1,5 @@
1
+ import './default-animations';
2
+ import './effects/default-effects';
3
+ export * from './engine';
4
+ export * from './types';
5
+ export * from './effects';
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import './default-animations';
2
+ import './effects/default-effects';
3
+ export * from './engine';
4
+ export * from './types';
5
+ export * from './effects';
@@ -0,0 +1,17 @@
1
+ export type ButtonHoverAnimationName = 'button-hover-soft' | 'button-hover-glow' | 'button-hover-lift' | 'button-hover-macos-soft';
2
+ export type ButtonClickAnimationName = 'button-click-press' | 'button-click-ripple' | 'button-click-macos-press';
3
+ export type ButtonStateAnimationName = 'button-success-pulse' | 'button-error-shake' | 'button-success-macos-pulse' | 'button-error-macos-shake';
4
+ export interface ButtonComponentAnimationsConfig {
5
+ hover?: ButtonHoverAnimationName;
6
+ click?: ButtonClickAnimationName;
7
+ success?: ButtonStateAnimationName;
8
+ error?: ButtonStateAnimationName;
9
+ }
10
+ export type InputFocusAnimationName = 'input-focus-glow' | 'input-focus-soft' | 'input-focus-macos-glow';
11
+ export type InputStateAnimationName = 'input-success-pulse' | 'input-error-shake' | 'input-success-macos-pulse' | 'input-error-macos-shake';
12
+ export type LayoutAnimationName = 'layout-fade-in' | 'layout-macos-window-enter';
13
+ export type SidebarAnimationName = 'sidebar-slide-in' | 'sidebar-slide-out' | 'sidebar-macos-slide-in' | 'sidebar-macos-slide-out';
14
+ export type HeaderMenuAnimationName = 'header-menu-slide-in' | 'header-menu-slide-out' | 'header-menu-macos-slide-in' | 'header-menu-macos-slide-out';
15
+ export type CardAnimationName = 'card-fade-in' | 'card-macos-fade-in';
16
+ export type TableAnimationName = 'table-fade-in' | 'table-row-enter' | 'table-macos-fade-in';
17
+ export type ChartAnimationName = 'chart-fade-in' | 'chart-data-update';
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@fylib/animation",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "files": ["dist"],
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc -p tsconfig.json"
12
+ },
13
+ "dependencies": {
14
+ "@fylib/core": "workspace:*",
15
+ "@fylib/logger": "workspace:*"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "catalog:",
19
+ "@types/node": "catalog:"
20
+ }
21
+ }