forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchui.d.ts
1261 lines (1068 loc) · 43.9 KB
/
chui.d.ts
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
// Type definitions for chui v3.8.10
// Project: https://github.com/chocolatechipui/chocolatechip-ui
// Definitions by: Robert Biggs <http://chocolatechip-ui.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
These TypeScript delcarations for ChocolateChip-UI contain interfaces for both jQuery and ChocolateChipJS. Depending on which library you are using, you will get the type interfaces appropriate for it.
*/
/**
* Interface for ChocolateChipJS.
*/
interface ChocolateChipStatic extends ChuiDetectors {
/**
* This method will concatenate strings or values as a cleaner alternative to using the '+' operator.
*
* @param string or number A comma separated series of strings to concatenate.
* @return string
*/
concat(...string: string[]): string;
/**
* This function replicates normal array iteration with the context first, followed by the index.
* Usage: $.forEach([1,2,3], function(ctx, idx) { console.log(ctx + "is: " + (idx + 1)) });
*
* @param obj An array-like object. This will usually be an array of HTML elements.
* @param callback A callback to execute with each iteration of the object.
* @param args Any extra arguments you wish to pass.
* @return void
*/
forEach<T>(obj: T[], callback: (ctx: T, idx?: number) => any, args?: any): any;
/**
* Alias for cross-platform events: pointerdown, MSPointerDown, touchstart and mousedown.
*/
eventStart: ChUIEventInterface;
/**
* Alias for cross-platform events: pointerup, MSPointerUp, touchend and mouseup.
*/
eventEnd: ChUIEventInterface;
/**
* Alias for cross-platform events: pointermove, MSPointerMove, touchmove and mousemove.
*/
eventMove: ChUIEventInterface;
/**
* Alias for cross-platform events: pointercancel, MSPointerCancel, touchcancel and mouseout.
*/
eventCancel: ChUIEventInterface;
/**
* Return the version of the current browser.
*
* @return string The current browser version.
*/
browserVersion(): number;
/**
* Hide the navigation bar, raising up the content below it.
*/
UIHideNavBar(): void;
/**
* If the navigation bar is hidden, show it, pushing down the content to make room.
*/
UIShowNavBar(): void;
/**
* Determine whether navigation is in progress or not.
*/
isNavigating: boolean;
/**
* Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array.
*
* param destination An id for the article to navigate to.
*/
UIGoToArticle(destination: string): void;
/**
* Go back to the previous article from whence you came. This resets the navigation history array.
*/
UIGoBack(): void;
/**
* Go back to the article indicated by the provided ID. This is for non-linear back navigation. This will reset the navigation history array to match the current state.
*/
UIGoBackToArticle(articleID: string): void;
/**
* Display a transparent screen over the UI. This takes an optional, decimal-based number for opacity: .5 for 50%.
*
* @param opacity The percentage of opacity for the screen.
*/
UIBlock(opacity?: number): void;
/**
* Remove the transparent screen covering the UI.
*/
UIUnblock(): void;
/**
* Create and show a Popup with title and message. Possible options: {id: "#myPopup", title: "My Popup",
* message: "Woohoo!", cancelButton: "Forget It!", contiueButton: "Whatever", callback: function() {console.log('Blah!');}, empty: false }.
*
* param options UIPopupOptions
*/
UIPopup(options: UIPopupOptions): void;
/**
* Create and show a Popover. Options: {id: "#myPopover", title: "Whatever", callback: function() {console.log('Blah!');}}.
*
* param options UIPopoverOptions
*/
UIPopover(options: UIPopoverOptions): void;
/**
* Close any currently visible popovers.
*/
UIPopoverClose(): void;
/**
* Create a segmented control: {id: "mySegments", className: "seggie", labels: ["one", "two","three"], selected: 1}
*
* param: options UICreateSegmentedOptions
*/
UICreateSegmented(options: UICreateSegmentedOptions): ChocolateChipElementArray;
/**
* Initialize a horiontal or vertical paging control. This uses a segmented control in the navigation bar with a class
* like "segmented paging horizontal" or "segmented paging vertical". It uses a single article with multiple sections to paginate.
*/
UIPaging(): void;
/**
* Creates a sheet. Minimum option is an id: {id : 'starTrek', listClass :'enterprise', background: 'transparent', handle: false }
*/
UISheet(options: UISheetOptions): void;
/**
* Show a sheet by passing this its ID.
*/
UIShowSheet(id?: string): void;
/**
* Hide any currently displayed sheets.
*/
UIHideSheet(): void;
/**
* The body tag wrapped and ready to use: $.body.css('background-color','orange')
*/
body: ChocolateChipElementArray;
/**
* An array of the navigation history. Do not manipulate this. For examination only. This is used by navigation lists, etc.
*/
UINavigationHistory: string[];
/**
* Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}}
*/
UISlideout: UISlideoutInterface;
/**
* Reset the value of the stepper to its defaults at initialization. Pass it a reference to the stepper to reset. It takes a stepper element: $("#myStepper").
*
* @param stepper A stepper to reset.
*/
UIResetStepper(stepper: ChocolateChipElementArray): void;
/**
* Create a switch control. Possible options: { id: '#myId', name: 'fruit.mango', state: 'on', value: 'Mango', checked: 'on', style: 'traditional', callback: function() { alert('hi');}}
*/
UICreateSwitch(options: UICreateSwitchOptions): void;
/**
* Creates a tabbar. On iOS this is at the bottom of the screen. On Android and Windows, it is at the top.
* Options: {id: 'mySpecialTabbar', tabs: 4, labels: ["Refresh", "Add", "Info", "Downloads", "Favorite"], icons: ["refresh", "add", "info", "downloads", "favorite"], selected: 2 }
*/
UITabbar(options: UITabbarOptions): void;
/**
* Create a search bar for an article. Options: { articleId: '#products', id: 'productSearch', placeholder: 'Find a product', results: 5 }
*/
UISearch(options: UISearchOptions): void;
/**
* Create and initialize a swipable carousel. Options: {target : '#myCarousel', panels: ['<p>stuff</p>','<p>more</p>'], loop: true, pagination: true }
*/
UISetupCarousel(options: UISetupCarouselOptions): void;
/**
* Bind the values of data-models to elements with data-controllers: <input id='myText' data-controller='input-value' type='text'></li><h3 data-model='input-value'></h3>.
* You can bind a single model to its controller by providing its name as the argument: $.UIBindData('input-value');
*
* @param controller A string indicating the controller whose value a model is bound to.
*/
UIBindData(controller?: string): void;
/**
* Unbind the values of data-models from their data-controllers.
* If you provide a controller name as the argument, only that controller will be unbound.
*
* @param controller A controller to unbind.
*/
UIUnBindData(controller?: string): void;
}
/**
* Interface for ChocolateChipJS Element Array.
*/
interface ChocolateChipElementArray {
/**
* Iterate over an Array object, executing a function for each matched element.
*/
forEach(func: (ctx: any, idx: number) => void): void;
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
*
* @param selector A string containing a selector expression to match elements against.
*/
iz(selector: string): ChocolateChipElementArray;
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
*
* @param elements One or more elements to match the current set of elements against.
*/
iz(element: any): ChocolateChipElementArray;
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
*
* @param selector A string containing a selector expression to match elements against.
*/
iznt(selector: string): ChocolateChipElementArray;
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
*
* @param elements One or more elements to match the current set of elements against.
*/
iznt(element: any): ChocolateChipElementArray;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param selector A string containing a selector expression to match elements against.
*/
haz(selector: string): ChocolateChipElementArray;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param element A DOM element to match elements against.
*/
haz(element: Element): ChocolateChipElementArray;
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
*
* @param selector A string containing a selector expression to match elements against.
*/
haznt(selector: string): ChocolateChipElementArray;
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
*
* @param element A DOM element to match elements against.
*/
haznt(element: Element): ChocolateChipElementArray;
/**
* Return any of the matched elements that have the given class.
*
* @param className The class name to search for.
*/
hazClass(className: string): ChocolateChipElementArray;
/**
* Return any of the matched elements that do not have the given class.
*
* @param className The class name to search for.
*/
hazntClass(className: string): ChocolateChipElementArray;
/**
* Return any of the matched elements that have the given attribute.
*
* @param className The class name to search for.
*/
hazAttr(attributeName: string): ChocolateChipElementArray;
/**
* Return any of the matched elements that do not have the given attribute.
*
* @param className The class name to search for.
*/
hazntAttr(attributeName: string): ChocolateChipElementArray;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
bind(eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic;
/**
* Remove a handler for an event from the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
unbind(eventType: string | ChUIEventInterface, handler?: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic;
/**
* Add a delegated event to listen for the provided event on the descendant elements.
*
* @param selector A string defining the descendant elements to listen on for the designated event.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered. The keyword "this" will refer
* to the element receiving the event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
delegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic;
/**
* Add a delegated event to listen for the provided event on the descendant elements.
*
* @param selector A string defining the descendant elements are listening for the event.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
undelegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic;
/**
* Add a handler to an event for elements. If a selector is provided as the second argument, this implements a delegated event.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param selector A string defining the descendant elements are listening for the event.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
on( eventType: string | ChUIEventInterface, selector: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic;
/**
* Remove a handler for an event from the elements. If the second argument is a selector, it tries to undelegate the event.
* If no arugments are provided, it removes all events from the element(s).
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param selector A string defining the descendant elements are listening for the event.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
off( eventType?: string | ChUIEventInterface, selector?: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic;
/**
*
*/
trigger(eventType: string | ChUIEventInterface): void;
/**
* Center an element to the screen.
*/
UICenter(): void;
/**
* Display a busy indicator. Posible options: {size: "100px", color: "#ff0000", position: "align-flush", duration: "2s"}.
*
* @param size The size as a string with length identifier: "40px".
* @param color The color for the busy indicator: "#ff0000".
* @param position Optional positioning, such as "align-flush".
* @param duration The time for the busy indicator to display: "500ms".
*/
UIBusy(options: UIBusyOptions): void;
/**
* Close the currently displayed Popup. This is executed on the popup: $('#myPopup').UIPopupClose().
*/
UIPopupClose(): void;
/**
* Initialize a segmented control. Options: {selected: 2, callback: function() {console.log('Blah');}}
*/
UISegmented(options: UISegmentedOptions): void;
/**
* This method allows the user to use a segmented control to toggle a set of panels. It is executed on the segmented control.
* The options id is the contain of the panels. The options callback is to execute when the user toggles a panel.
*/
UIPanelToggle(panelsContainer: string, callback: () => any): void;
/**
* Make a list editable. This can be enabling changing the order of list items, or deleting them, or both. Options: {editLabel: "Edit", doneLabel: "Done",
* deleteLabel: "Delete", callback: function() {alert('Bye bye!');}, deletable: true, movable: true}.
*/
UIEditList(options: UIEditListOptions): void;
/**
* Convert a simple list into a selection list. This converts the list into a radio button group, meaning only one can be selected at any time.
* You can name the radios buttons using the options name. Options: {name: "selectedNamesGroup", selected: 2, callback: function() {alert('hi');}}
*/
UISelectList(): void;
/**
* Create a stepper control by executing it on a span with the class "stepper". Possible options: {start: 0, end: 10, defaultValue: 3}.
*/
UIStepper(options: UIStepperOptions): void;
/**
* Initialize any existing switch controls: $('.switch').UISwitch();
*/
UISwitch(): void;
/**
* Execute this on a range control to initialize it.
*/
UIRange(): void;
}
/**
* Interface for jQuery
*/
interface JQueryStatic extends ChuiDetectors {
/**
* This method will concatenate strings or values as a cleaner alternative to using the '+' operator.
*
* @param string or number A comma separated series of strings to concatenate.
* @return string
*/
concat(...string: string[]): string;
/**
* This function replicates normal array iteration with the context first, followed by the index.
* Usage: $.forEach([1,2,3], function(ctx, idx) { console.log(ctx + "is: " + (idx + 1)) });
*
* @param obj An array-like object. This will usually be an array of HTML elements.
* @param callback A callback to execute with each iteration of the object.
* @param args Any extra arguments you wish to pass.
* @return void
*/
forEach<T>(obj: T[], callback: (ctx: T, idx?: number) => any, args?: any): any;
/**
* Alias for cross-platform events: pointerdown, MSPointerDown, touchstart and mousedown.
*/
eventStart: ChUIEventInterface;
/**
* Alias for cross-platform events: pointerup, MSPointerUp, touchend and mouseup.
*/
eventEnd: ChUIEventInterface;
/**
* Alias for cross-platform events: pointermove, MSPointerMove, touchmove and mousemove.
*/
eventMove: ChUIEventInterface;
/**
* Alias for cross-platform events: pointercancel, MSPointerCancel, touchcancel and mouseout.
*/
eventCancel: ChUIEventInterface;
/**
* Return the version of the current browser.
*/
browserVersion(): number;
/**
* Hide the navigation bar, raising up the content below it.
*/
UIHideNavBar(): void;
/**
* If the navigation bar is hidden, show it, pushing down the content to make room.
*/
UIShowNavBar(): void;
/**
* Determine whether navigation is in progress or not.
*/
isNavigating: boolean;
/**
* Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array.
*
* param destination An id for the article to navigate to.
*/
UIGoToArticle(destination: string): void;
/**
* Go back to the previous article from whence you came. This resets the navigation history array.
*/
UIGoBack(): void;
/**
* Go back to the article indicated by the provided ID. This is for non-linear back navigation. This will reset the navigation history array to match the current state.
*/
UIGoBackToArticle(articleID: string): void;
/**
* Display a transparent screen over the UI. This takes an optional, decimal-based number for opacity: .5 for 50%.
*
* @param opacity The percentage of opacity for the screen.
*/
UIBlock(opacity?: number): void;
/**
* Remove the transparent screen covering the UI.
*/
UIUnblock(): void;
/**
* Create and show a Popup with title and message. Possible options: {id: "#myPopup", title: "My Popup",
* message: "Woohoo!", cancelButton: "Forget It!", contiueButton: "Whatever", callback: function() {console.log('Blah!');}, empty: false }.
*
* param options UIPopupOptions
*/
UIPopup(options: UIPopupOptions): void;
/**
* Create and show a Popover. Options: {id: "#myPopover", title: "Whatever", callback: function() {console.log('Blah!');}}.
*
* param options UIPopoverOptions
*/
UIPopover(options: UIPopoverOptions): void;
/**
* Close any currently visible popovers.
*/
UIPopoverClose(): void;
/**
* Create a segmented control: {id: "mySegments", className: "seggie", labels: ["one", "two","three"], selected: 1}
*
* param: options UICreateSegmentedOptions
*/
UICreateSegmented(options: UICreateSegmentedOptions): JQuery;
/**
* Initialize a horiontal or vertical paging control. This uses a segmented control in the navigation bar with a class
* like "segmented paging horizontal" or "segmented paging vertical". It uses a single article with multiple sections to paginate.
*/
UIPaging(): void;
/**
* Creates a sheet. Minimum option is an id: {id : 'starTrek', listClass :'enterprise', background: 'transparent', handle: false }
*/
UISheet(options: UISheetOptions): void;
/**
* Show a sheet by passing this its ID.
*/
UIShowSheet(id: string): void;
/**
* Hide any currently displayed sheets.
*/
UIHideSheet(): void;
/**
* The body tag wrapped and ready to use: $.body.css('background-color','orange')
*/
body: JQuery;
/**
* An array of the navigation history. Do not manipulate this. For examination only. This is used by navigation lists, etc.
*/
UINavigationHistory: string[];
/**
* Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}}
*/
UISlideout: UISlideoutInterface;
/**
* Reset the value of the stepper to its defaults at initialization. Pass it a reference to the stepper to reset.
*/
UIResetStepper(stepper: JQuery): void;
/**
* Create a switch control. Possible options: { id: '#myId', name: 'fruit.mango', state: 'on', value: 'Mango', checked: 'on', style: 'traditional', callback: function() { alert('hi');}}
*/
UICreateSwitch(options: UICreateSwitchOptions): void;
/**
* Creates a tabbar. On iOS this is at the bottom of the screen. On Android and Windows, it is at the top.
* Options: {id: 'mySpecialTabbar', tabs: 4, labels: ["Refresh", "Add", "Info", "Downloads", "Favorite"], icons: ["refresh", "add", "info", "downloads", "favorite"], selected: 2 }
*/
UITabbar(options: UITabbarOptions): void;
/**
* Create a search bar for an article. Options: { articleId: '#products', id: 'productSearch', placeholder: 'Find a product', results: 5 }
*/
UISearch(options: UISearchOptions): void;
/**
* Create and initialize a swipable carousel. Options: {target : '#myCarousel', panels: ['<p>stuff</p>','<p>more</p>'], loop: true, pagination: true }
*/
UISetupCarousel(options: UISetupCarouselOptions): void;
/**
* Bind the values of data-models to elements with data-controllers: <input id='myText' data-controller='input-value' type='text'></li><h3 data-model='input-value'></h3>.
* You can bind a single model to its controller by providing its name as the argument: $.UIBindData('input-value');
*
* @param controller A string indicating the controller whose value a model is bound to.
*/
UIBindData(controller?: string): void;
/**
* Unbind the values of data-models from their data-controllers.
* If you provide a controller name as the argument, only that controller will be unbound.
*
* @param controller A controller to unbind.
*/
UIUnBindData(controller?: string): void;
}
/**
* Interface for jQuery
*/
interface JQuery {
/**
* Iterate over an Array object, executing a function for each matched element.
*/
//forEach(func: (ctx: any, idx: number) => void, JQuery: any): void;
forEach(callback: (ctx: Element, idx: number) => any): JQuery;
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
*
* @param selector A string containing a selector expression to match elements against.
*/
iz(selector: string): JQuery;
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
*
* @param elements One or more elements to match the current set of elements against.
*/
iz(element: any): JQuery;
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
*
* @param selector A string containing a selector expression to match elements against.
*/
iznt(selector: string): JQuery;
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
*
* @param elements One or more elements to match the current set of elements against.
*/
iznt(element: any): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param selector A string containing a selector expression to match elements against.
*/
haz(selector: string): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
*
* @param contained A DOM element to match elements against.
*/
haz(contained: Element): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
*
* @param selector A string containing a selector expression to match elements against.
*/
haznt(selector: string): JQuery;
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
*
* @param contained A DOM element to match elements against.
*/
haznt(contained: Element): JQuery;
/**
* Return any of the matched elements that have the given class.
*
* @param className The class name to search for.
*/
hazClass(className: string): JQuery;
/**
* Return any of the matched elements that do not have the given class.
*
* @param className The class name to search for.
*/
hazntClass(className: string): JQuery;
/**
* Return any of the matched elements that have the given attribute.
*
* @param className The class name to search for.
*/
hazAttr(attributeName: string): JQuery;
/**
* Return any of the matched elements that do not have the given attribute.
*
* @param className The class name to search for.
*/
hazntAttr(attributeName: string): JQuery;
/**
* Center an element to the screen.
*/
UICenter(): void;
/**
* Display a busy indicator. Posible options: {size: "100px", color: "#ff0000", position: "align-flush", duration: "2s"}.
*
* @param size The size as a string with length identifier: "40px".
* @param color The color for the busy indicator: "#ff0000".
* @param position Optional positioning, such as "align-flush".
* @param duration The time for the busy indicator to display: "500ms".
*/
UIBusy(options: UIBusyOptions): void;
/**
* Close the currently displayed Popup. This is executed on the popup: $('#myPopup').UIPopupClose().
*/
UIPopupClose(): void;
/**
* Initialize a segmented control. Options: {selected: 2, callback: function() {console.log('Blah');}}
*/
UISegmented(options: UISegmentedOptions): void;
/**
* This method allows the user to use a segmented control to toggle a set of panels. It is executed on the segmented control.
* The options id is the contain of the panels. The options callback is to execute when the user toggles a panel.
*/
UIPanelToggle(panelsContainer: string, callback: () => any): void;
/**
* Make a list editable. This can be enabling changing the order of list items, or deleting them, or both. Options: {editLabel: "Edit", doneLabel: "Done",
* deleteLabel: "Delete", callback: function() {alert('Bye bye!');}, deletable: true, movable: true}.
*/
UIEditList(options: UIEditListOptions): void;
/**
* Convert a simple list into a selection list. This converts the list into a radio button group, meaning only one can be selected at any time.
* You can name the radios buttons using the options name. Options: {name: "selectedNamesGroup", selected: 2, callback: function() {alert('hi');}}
*/
UISelectList(): void;
/**
* Create a stepper control by executing it on a span with the class "stepper". Possible options: {start: 0, end: 10, defaultValue: 3}.
*/
UIStepper(options: UIStepperOptions): void;
/**
* Initialize any existing switch controls: $('.switch').UISwitch();
*/
UISwitch(): void;
/**
* Execute this on a range control to initialize it.
*/
UIRange(): void;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string | ChUIEventInterface, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
*/
bind(eventType: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param eventData An object containing data that will be passed to the event handler.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string | ChUIEventInterface, eventData: any, preventBubble: boolean): JQuery;
/**
* Attach a handler to an event for the elements.
*
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
*/
bind(eventType: string | ChUIEventInterface, preventBubble: boolean): JQuery;
delegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery;
delegate(selector: any, eventType: string | ChUIEventInterface, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string | ChUIEventInterface, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
*/
on(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string | ChUIEventInterface, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string | ChUIEventInterface, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
on(events: string | ChUIEventInterface, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param data An object containing data that will be passed to the event handler.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string | ChUIEventInterface, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
one(events: string | ChUIEventInterface, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
*/
one(events: string | ChUIEventInterface, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Execute all handlers and behaviors attached to the matched elements for the given event type.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param extraParameters Additional parameters to pass along to the event handler.
*/
trigger(eventType: string | ChUIEventInterface, extraParameters?: any[]|Object): JQuery;
/**
* Execute all handlers attached to an element for an event.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param extraParameters An array of additional parameters to pass along to the event handler.
*/
triggerHandler(eventType: string | ChUIEventInterface, ...extraParameters: any[]): Object;
/**
* Remove a previously-attached event handler from the elements.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param handler The function that is to be no longer executed.
*/
unbind(eventType?: string | ChUIEventInterface, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove a previously-attached event handler from the elements.
*
* @param eventType A string containing a JavaScript event type, such as click or submit.
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
*/
unbind(eventType: string | ChUIEventInterface, fls: boolean): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*
* @param selector A selector which will be used to filter the event results.
* @param eventType A string containing a JavaScript event type, such as "click" or "keydown"
* @param handler A function to execute at the time the event is triggered.
*/
undelegate(selector: string | ChUIEventInterface, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
*
* @param selector A selector which will be used to filter the event results.
* @param events An object of one or more event types and previously bound functions to unbind from them.
*/
undelegate(selector: string | ChUIEventInterface, events: Object): JQuery;
}
interface UISetupCarouselOptions {
target: string;
panels: HTMLElement[] | JQuery;
loop?: boolean;
pagination?: boolean;
}
interface UISearchOptions {
articleId?: string;
id?: string;
placeholder?: string;
results?: number;
}
interface UITabbarOptions {
id?: string;
tabs: number;
labels: string[];
icons?: string[];
selected?: number;
}
interface UICreateSwitchOptions {
id?: string;
name?: string;
state?: string;
value?: string | number;
checked?: string;
style?: string;
callback?: () => any;
}
/**
* Interface for UISlideout.
*/
interface UISlideoutInterface {
/**
* Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}}
*/
(options: UISlideoutOptions): void;
/**
* Populates a slideout menu.