-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyaka.d.ts
More file actions
1951 lines (1602 loc) · 35.9 KB
/
Copy pathyaka.d.ts
File metadata and controls
1951 lines (1602 loc) · 35.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* YakaJS - Next-Gen JavaScript Library
* TypeScript definitions for YakaJS v1.0.0+
*
* @author Yaka-UI-Labs
* @license MIT
*/
// ==================== INTERFACES ====================
/**
* Validation rule for form fields
*/
export interface ValidationRule {
required?: boolean;
pattern?: RegExp;
min?: number;
max?: number;
message?: string;
requiredMessage?: string;
patternMessage?: string;
minMessage?: string;
maxMessage?: string;
}
/**
* Validation result
*/
export interface ValidationResult {
valid: boolean;
errors: Record<string, string[]>;
}
/**
* Draggable options
*/
export interface DraggableOptions {
onStart?: (event: Event) => void;
onDrag?: (event: Event) => void;
onEnd?: (event: Event) => void;
handle?: string;
containment?: string | HTMLElement;
axis?: 'x' | 'y';
grid?: [number, number];
}
/**
* Droppable options
*/
export interface DroppableOptions {
accept?: string;
onDrop?: (event: Event, draggable: HTMLElement) => void;
onOver?: (event: Event) => void;
onOut?: (event: Event) => void;
}
/**
* Resizable options
*/
export interface ResizableOptions {
handles?: Array<'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw'>;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
aspectRatio?: boolean;
onStart?: (event: Event) => void;
onResize?: (event: Event, dimensions: { width: number; height: number }) => void;
onEnd?: (event: Event) => void;
}
/**
* Sortable options
*/
export interface SortableOptions {
handle?: string;
onSort?: (event: Event, item: HTMLElement, oldIndex: number, newIndex: number) => void;
axis?: 'x' | 'y';
}
/**
* Selectable options
*/
export interface SelectableOptions {
filter?: string;
onSelect?: (elements: HTMLElement[]) => void;
}
/**
* Swipe handlers
*/
export interface SwipeHandlers {
left?: () => void;
right?: () => void;
up?: () => void;
down?: () => void;
}
/**
* AJAX options
*/
export interface AjaxOptions {
url: string;
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
data?: any;
headers?: Record<string, string>;
contentType?: string;
dataType?: 'json' | 'text' | 'html';
timeout?: number;
beforeSend?: (xhr: XMLHttpRequest) => void;
success?: (data: any, status: string, xhr: XMLHttpRequest) => void;
error?: (xhr: XMLHttpRequest, status: string, error: string) => void;
complete?: (xhr: XMLHttpRequest, status: string) => void;
}
/**
* Animation properties
*/
export interface AnimationProperties {
[property: string]: string | number;
}
/**
* Tooltip options
*/
export interface TooltipOptions {
position?: 'top' | 'bottom' | 'left' | 'right';
trigger?: 'hover' | 'click';
delay?: number;
}
/**
* Modal options
*/
export interface ModalOptions {
title?: string;
closeButton?: boolean;
backdrop?: boolean | 'static';
keyboard?: boolean;
onShow?: () => void;
onHide?: () => void;
}
/**
* Carousel options - Enhanced carousel with touch support and transitions
*/
export interface CarouselOptions {
auto?: boolean;
interval?: number;
showDots?: boolean;
showArrows?: boolean;
startIndex?: number;
transition?: 'fade' | 'slide' | 'none';
touch?: boolean;
onChange?: (index: number) => void;
}
/**
* Dropdown options
*/
export interface DropdownOptions {
trigger?: 'click' | 'hover';
position?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
}
/**
* Autocomplete options
*/
export interface AutocompleteOptions {
minLength?: number;
delay?: number;
onSelect?: (item: any) => void;
}
/**
* DataTable options
*/
export interface DataTableOptions {
columns?: Array<{ key: string; label: string; sortable?: boolean }>;
pagination?: boolean;
pageSize?: number;
sortable?: boolean;
searchable?: boolean;
}
/**
* Progress options
*/
export interface ProgressOptions {
animated?: boolean;
striped?: boolean;
label?: boolean;
}
/**
* Skeleton options
*/
export interface SkeletonOptions {
width?: string | number;
height?: string | number;
circle?: boolean;
count?: number;
}
/**
* Virtual scroll options
*/
export interface VirtualScrollOptions {
itemHeight: number;
buffer?: number;
container?: string | HTMLElement;
}
/**
* Cropper options
*/
export interface CropperOptions {
aspectRatio?: number;
viewMode?: number;
dragMode?: 'crop' | 'move' | 'none';
minCropBoxWidth?: number;
minCropBoxHeight?: number;
}
/**
* Rich editor options
*/
export interface RichEditorOptions {
toolbar?: string[];
placeholder?: string;
height?: number;
}
/**
* Loading state options
*/
export interface LoadingStateOptions {
text?: string;
spinner?: boolean;
disabled?: boolean;
}
/**
* WebSocket options
*/
export interface WebSocketOptions {
onOpen?: (event: Event) => void;
onMessage?: (event: MessageEvent) => void;
onError?: (event: Event) => void;
onClose?: (event: CloseEvent) => void;
reconnect?: boolean;
reconnectDelay?: number;
}
/**
* Retry options
*/
export interface RetryOptions {
retries?: number;
delay?: number;
backoff?: number;
}
/**
* Observer options
*/
export interface ObserverOptions {
root?: Element | null;
rootMargin?: string;
threshold?: number | number[];
}
/**
* Toast/Notification options
*/
export interface ToastOptions {
type?: 'success' | 'error' | 'warning' | 'info';
duration?: number;
position?: 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
}
/**
* Component options
*/
export interface ComponentOptions {
template?: string;
data?: () => any;
methods?: Record<string, Function>;
mounted?: () => void;
destroyed?: () => void;
}
/**
* Router configuration
*/
export interface RouteConfig {
path: string;
component?: Function | string;
beforeEnter?: (to: any, from: any, next: Function) => void;
}
/**
* State management options
*/
export interface StateOptions<T = any> {
state?: T;
mutations?: Record<string, Function>;
actions?: Record<string, Function>;
getters?: Record<string, Function>;
}
/**
* Chart data
*/
export interface ChartData {
labels: string[];
datasets: Array<{
label: string;
data: number[];
backgroundColor?: string | string[];
borderColor?: string | string[];
}>;
}
/**
* Chart options
*/
export interface ChartOptions {
type: 'line' | 'bar' | 'pie' | 'doughnut';
responsive?: boolean;
maintainAspectRatio?: boolean;
}
/**
* Cookie options
*/
export interface CookieOptions {
days?: number;
path?: string;
domain?: string;
secure?: boolean;
}
/**
* Share data
*/
export interface ShareData {
title?: string;
text?: string;
url?: string;
}
/**
* Position options
*/
export interface PositionOptions {
my?: string;
at?: string;
of?: string | HTMLElement;
collision?: 'flip' | 'fit' | 'flipfit' | 'none';
}
/**
* Mask options
*/
export interface MaskOptions {
placeholder?: string;
reverse?: boolean;
}
/**
* Honeypot options
*/
export interface HoneypotOptions {
fieldName?: string;
onSpam?: () => void;
}
/**
* Time ago options
*/
export interface TimeAgoOptions {
live?: boolean;
locale?: string;
}
/**
* Breadcrumb item
*/
export interface BreadcrumbItem {
label: string;
href?: string;
active?: boolean;
}
/**
* Pagination options
*/
export interface PaginationOptions {
total: number;
pageSize?: number;
current?: number;
onChange?: (page: number) => void;
}
/**
* Badge options
*/
export interface BadgeOptions {
variant?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
pill?: boolean;
}
/**
* Popover options
*/
export interface PopoverOptions extends TooltipOptions {
title?: string;
html?: boolean;
}
/**
* Stepper options
*/
export interface StepperOptions {
steps: Array<{ title: string; content?: string }>;
currentStep?: number;
onStepChange?: (step: number) => void;
}
/**
* Slider options - Enhanced range slider with advanced features
*/
export interface SliderOptions {
min?: number;
max?: number;
step?: number;
value?: number;
range?: boolean;
showTooltip?: boolean;
showValue?: boolean;
onChange?: (value: number | number[]) => void;
}
/**
* Lottie options
*/
export interface LottieOptions {
animationData: any;
loop?: boolean;
autoplay?: boolean;
}
/**
* Tilt options
*/
export interface TiltOptions {
maxTilt?: number;
perspective?: number;
scale?: number;
}
/**
* Transform 3D options
*/
export interface Transform3DOptions {
x?: number;
y?: number;
z?: number;
rotateX?: number;
rotateY?: number;
rotateZ?: number;
}
/**
* Particles options
*/
export interface ParticlesOptions {
count?: number;
speed?: number;
size?: number;
color?: string;
}
/**
* Video controls options
*/
export interface VideoControlsOptions {
controls?: boolean;
autoplay?: boolean;
loop?: boolean;
}
/**
* Button options
*/
export interface ButtonOptions {
variant?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
size?: 'sm' | 'md' | 'lg';
disabled?: boolean;
}
/**
* Fullpage options
*/
export interface FullpageOptions {
navigation?: boolean;
navigationPosition?: 'left' | 'right';
scrollingSpeed?: number;
}
// ==================== MAIN YAKA INTERFACE ====================
/**
* YakaJS main interface
*/
export interface Yaka {
/**
* Array of matched DOM elements
*/
elements: HTMLElement[];
// ==================== ITERATION ====================
/**
* Iterate over elements
*/
each(callback: (this: HTMLElement, index: number, element: HTMLElement) => void): this;
/**
* Get element(s) at index
*/
get(): HTMLElement[];
get(index: number): HTMLElement | undefined;
/**
* Get first element
*/
first(): Yaka;
/**
* Get last element
*/
last(): Yaka;
/**
* Get element at index
*/
eq(index: number): Yaka;
// ==================== CONTENT ====================
/**
* Get or set text content
*/
text(): string;
text(value: string): this;
/**
* Get or set HTML content
*/
html(): string;
html(value: string, sanitize?: boolean): this;
/**
* Get or set form value
*/
val(): string;
val(value: string): this;
// ==================== ATTRIBUTES ====================
/**
* Get or set attribute
*/
attr(name: string): string | undefined;
attr(name: string, value: string | number | boolean): this;
attr(attributes: Record<string, string | number | boolean>): this;
/**
* Remove attribute
*/
removeAttr(name: string): this;
/**
* Get or set data attribute
*/
data(key: string): any;
data(key: string, value: any): this;
// ==================== CSS & CLASSES ====================
/**
* Get or set CSS property
*/
css(property: string): string;
css(property: string, value: string | number): this;
css(properties: Record<string, string | number>): this;
/**
* Add CSS class with optional duration
*/
addClass(className: string, duration?: number): this;
/**
* Remove CSS class with optional duration
*/
removeClass(className: string, duration?: number): this;
/**
* Toggle CSS class with optional duration
*/
toggleClass(className: string, duration?: number): this;
/**
* Check if element has class
*/
hasClass(className: string): boolean;
/**
* Show element
*/
show(): this;
/**
* Hide element
*/
hide(): this;
// ==================== TRAVERSAL ====================
/**
* Find descendants
*/
find(selector: string): Yaka;
/**
* Filter elements
*/
filter(selector: string | ((index: number, element: HTMLElement) => boolean)): Yaka;
/**
* Find closest ancestor
*/
closest(selector: string): Yaka;
/**
* Check if matches selector
*/
is(selector: string): boolean;
/**
* Get parent element
*/
parent(): Yaka;
/**
* Get children
*/
children(selector?: string): Yaka;
/**
* Get siblings
*/
siblings(): Yaka;
/**
* Get next sibling
*/
next(): Yaka;
/**
* Get previous sibling
*/
prev(): Yaka;
// ==================== DOM MANIPULATION ====================
/**
* Append content
*/
append(content: string | HTMLElement | Yaka): this;
/**
* Prepend content
*/
prepend(content: string | HTMLElement | Yaka): this;
/**
* Insert after
*/
after(content: string | HTMLElement | Yaka): this;
/**
* Insert before
*/
before(content: string | HTMLElement | Yaka): this;
/**
* Empty element
*/
empty(): this;
/**
* Clone element
*/
clone(): Yaka;
/**
* Replace element
*/
replace(newContent: string | HTMLElement | Yaka): this;
/**
* Wrap element
*/
wrap(wrapper: string | HTMLElement): this;
/**
* Remove/detach element
*/
detach(): this;
// ==================== EVENTS ====================
/**
* Attach event handler
*/
on(event: string, handler: (event: Event) => void): this;
on(event: string, selector: string, handler: (event: Event) => void): this;
/**
* Remove event handler
*/
off(event: string, handler?: (event: Event) => void): this;
off(event: string, selector?: string, handler?: (event: Event) => void): this;
/**
* Attach one-time event handler
*/
once(event: string, handler: (event: Event) => void): this;
/**
* Trigger event
*/
trigger(event: string, data?: any): this;
/**
* Click event
*/
click(handler?: (event: MouseEvent) => void): this;
/**
* Submit event
*/
submit(handler?: (event: Event) => void): this;
/**
* Change event
*/
change(handler: (event: Event) => void): this;
/**
* Input event
*/
input(handler: (event: Event) => void): this;
/**
* Focus event
*/
focus(handler?: (event: FocusEvent) => void): this;
/**
* Blur event
*/
blur(handler: (event: FocusEvent) => void): this;
/**
* Hover event
*/
hover(handlerIn: (event: MouseEvent) => void, handlerOut?: (event: MouseEvent) => void): this;
/**
* Scroll event
*/
scroll(handler: (event: Event) => void): this;
/**
* Resize event
*/
resize(handler: (event: Event) => void): this;
/**
* Debounced event
*/
debounce(event: string, handler: (event: Event) => void, delay?: number): this;
/**
* Throttled event
*/
throttle(event: string, handler: (event: Event) => void, delay?: number): this;
// ==================== ANIMATIONS ====================
/**
* Animate properties
*/
animate(properties: AnimationProperties, duration?: number, easing?: string): this;
/**
* Fade in
*/
fadeIn(duration?: number): this;
/**
* Fade out
*/
fadeOut(duration?: number): this;
/**
* Slide down
*/
slideDown(duration?: number): this;
/**
* Slide up
*/
slideUp(duration?: number): this;
/**
* Pulse animation
*/
pulse(times?: number): this;
/**
* Shake animation
*/
shake(): this;
/**
* Bounce animation
*/
bounce(times?: number): this;
/**
* Flip animation
*/
flip(axis?: 'x' | 'y', duration?: number): this;
/**
* Zoom in animation
*/
zoomIn(duration?: number): this;
/**
* Zoom out animation
*/
zoomOut(duration?: number): this;
/**
* Rotate in animation
*/
rotateIn(duration?: number): this;
/**
* Rotate out animation
*/
rotateOut(duration?: number): this;
/**
* Rubber band animation
*/
rubberBand(): this;
/**
* Blur in animation
*/
blurIn(duration?: number): this;
/**
* Blur out animation
*/
blurOut(duration?: number): this;
/**
* Swing animation
*/
swing(): this;
/**
* Slide in from left
*/
slideInLeft(duration?: number): this;
/**
* Slide in from right
*/
slideInRight(duration?: number): this;
/**
* Slide in from up
*/
slideInUp(duration?: number): this;
/**
* Slide out to left
*/
slideOutLeft(duration?: number): this;
/**
* Slide out to right
*/
slideOutRight(duration?: number): this;
// ==================== INTERACTIVE ====================
/**
* Make element draggable
*/
draggable(options?: DraggableOptions): this;
/**
* Make element droppable
*/
droppable(options?: DroppableOptions): this;
/**
* Make list sortable
*/
sortable(options?: SortableOptions): this;
/**
* Make element resizable
*/
resizable(options?: ResizableOptions): this;
/**
* Make elements selectable
*/
selectable(options?: SelectableOptions): this;
/**
* Add swipe gestures
*/
swipe(handlers: SwipeHandlers): this;
// ==================== UI COMPONENTS ====================
/**
* Add tooltip
*/
tooltip(text: string, position?: 'top' | 'bottom' | 'left' | 'right'): this;
/**
* Create tabs
*/
tabs(): this;
/**
* Create accordion
*/
accordion(): this;
/**
* Create carousel
*/
carousel(options?: CarouselOptions): this;
/**
* Create dropdown
*/
dropdown(options?: DropdownOptions): this;
/**
* Create breadcrumb
*/
breadcrumb(items?: BreadcrumbItem[], options?: any): this;
/**
* Create pagination
*/
pagination(options?: PaginationOptions): this;
/**
* Create badge
*/
badge(text: string, options?: BadgeOptions): this;
/**
* Create popover
*/
popover(content: string, options?: PopoverOptions): this;
/**
* Create stepper
*/
stepper(options?: StepperOptions): this;
/**
* Create slider