Updated to 3.9.1.

New types for changes to navigation API.
This commit is contained in:
chocolatechipui@sourcebits.com 2015-08-26 12:18:28 -07:00
parent fa8d9683f3
commit 733d010a3f
3 changed files with 164 additions and 2 deletions

91
chui/chui-tests.js Normal file
View File

@ -0,0 +1,91 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="chui.d.ts"/>
$(function () {
/**
* Test static methods:
*/
var concatenatedText = $.concat("This", "is", "text", "to", "contatenate.");
$.forEach([1, 2, 3], function (ctx) {
return ctx;
});
$.forEach([1, 2, 3], function (ctx, idx) {
return idx;
});
var isiPhone = $.isiPhone;
var isAndroid = $.isAndroid;
var isWinPhone = $.isWinPhone;
$('li').on($.eventStart, function () {
return;
});
$('li').on($.eventEnd, function () {
return;
});
$('li').on($.eventMove, function () {
return;
});
$('li').on($.eventCancel, function () {
return;
});
var browserVersion = $.browserVersion();
$.UIHideNavBar();
$.UIShowNavBar();
$.UIGoToArticle("#main");
$.UIGoBack();
$.UIGoBackToArticle("#main");
$.UIEnableBrowserHashModification();
$.UIBlock();
$.UIBlock(.5);
$.UIUnblock();
$.UIPopup({ id: "myPopup", message: 'Hello!!!' });
$.UIPopup({ message: 'Hello!!!', title: "Whatever", callback: $.noop });
$.UIPopup({ message: 'Hello!!!', cancelButton: "Forget It!", continueButton: "OK" });
$.UIPopover({ id: "myPopover" });
$.UIPopover({ callback: function () { } });
$.UIPopover({ title: "Whatever" });
$.UIPopover({ id: "myPopover", callback: function () { }, title: "Whatever" });
$.UIPopoverClose();
$.UICreateSegmented({ id: "mySegmentedControl", labels: ['first', 'second', 'third'], selected: 0, className: "special" });
$.UIPaging();
$.UISheet({ id: "mySheet", listClass: "specialList", background: 'red', handle: false });
$.UIShowSheet("#mySheet");
$.UIHideSheet();
$.UISlideout({ dynamic: false, callback: $.noop });
var myStepper = $('#myStepper');
$.UIResetStepper(myStepper);
$.UICreateSwitch({ id: "mySwitch", value: 5, checked: "true", callback: $.noop });
$.UITabbar({ tabs: 3, labels: ["one", "two", "three"], selected: 2 });
$.UISearch({ articleId: "#main", placeholder: "Looking?", results: 10 });
var carouselPanels = $("<li>1</li><li>2</li><li>3</li>");
$.UISetupCarousel({ target: "#carousel", panels: carouselPanels });
$.UIBindData();
$.UIBindData("#myBoundData");
$.UIUnBindData();
$.UIUnBindData("#myBoundData");
/**
* Test plugin methods:
*/
$("li").forEach(function (ctx, idx) {
console.log(ctx.nodeName + ": " + idx);
});
$('li').iz(".selected").hide();
$('li').iznt(".selected").show();
$('li').haz("span").hide();
$('li').haznt("span").show();
$('li').hazClass(".selected").hide();
$('li').hazntClass(".selected").show();
$('li').hazAttr("disabled").hide();
$('li').hazntAttr("disabled").show();
$('#main').bind("singletap", function () {
return;
});
$('#main').UICenter();
$('#main').UIBusy({ size: "120px", color: "red", duration: "5000ms" });
$('#myPopup').UIPopupClose();
$('#mySegementedControl').UISegmented({ selected: 2, callback: $.noop });
$("#panelToggler").UIPanelToggle("#togglePanels", $.noop);
$('#editList').UIEditList({ callback: $.noop, deletable: false, movable: true });
$('#mySelectList').UISelectList();
$('#myStepper').UIStepper({ start: 1, end: 10, defaultValue: 5 });
$('#mySwitch').UISwitch();
$('#myRangeControl').UIRange();
});

View File

@ -37,6 +37,7 @@ $(function() {
$.UIGoToArticle("#main");
$.UIGoBack();
$.UIGoBackToArticle("#main");
$.UIEnableBrowserHashModification();
$.UIBlock();
$.UIBlock(.5);
$.UIUnblock();

74
chui/chui.d.ts vendored
View File

@ -1,8 +1,8 @@
// Type definitions for chui v3.9.0
// Type definitions for chui v3.9.1
// Project: https://github.com/chocolatechipui/chocolatechip-ui
// Definitions by: Robert Biggs <http://chocolatechip-ui.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// ChocolateChip-UI 3.9.0
// ChocolateChip-UI 3.9.1
/**
These TypeScript delcarations for ChocolateChip-UI contain interfaces for both ChocolateChipJS and jQuery. Depending on which library you are using, you will get the type interfaces appropriate for it.
*/
@ -89,6 +89,17 @@ interface ChocolateChipStatic {
*/
isNavigating: boolean;
/**
* Tell ChocolateChip-UI to not modify window hash during navigation.
* The default value is false.
*/
UIBrowserHashModification: boolean;
/**
* Method to tell ChocolateChip-UI to register navigation history on Window hash.
*/
UIEnableBrowserHashModification(): void;
/**
* Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array.
*
@ -784,6 +795,17 @@ interface JQueryStatic {
*/
isNavigating: boolean;
/**
* Tell ChocolateChip-UI to not modify window hash during navigation.
* The default value is false.
*/
UIBrowserHashModification: boolean;
/**
* Method to tell ChocolateChip-UI to register navigation history on Window hash.
*/
UIEnableBrowserHashModification(): void;
/**
* Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array.
*
@ -1014,6 +1036,54 @@ interface JQueryStatic {
*/
UIUnBindData(controller?: string): void;
/**
* Object used to store string templates and parsed templates.
*
* @param string A string defining the template.
* @param string A label used to access an object's properties in the template. If none is provided it defaults to "data": [[= data.name]].
* @return void
*/
templates: Object;
/**
* This method returns a parsed template.
*
*/
template: {
/**
* This method parses a string and an optoinal variable name and returns a parsed template in the form of a function. You can then pass this function data to get rendered nodes.
*
* @param template A string of markup to use as a template.
* @param variable An option name to use in the template. If it were "myData": [[= myData.name]]. Otherwise it defaults to "data": [[= data.name]].
* @return A function.
*/
(template: string, variable?: string): Function;
/**
* A method to repeated output a template.
*
* @param element The target container into which the content will be inserted.
* @param template A string of markup.
* @param data The iterable data the template will consume.
* @return void.
*/
repeater: (element: JQuery, template: string, data: any) => void;
/**
* A object that holds the reference to the controller for a repeater.
* This is used to cache the data that a repeater uses. After the repeater is rendered, the reference is deleted from this object.
*
*/
data: {
repeaterName?: any;
};
/**
* Use this value to output an index value in a template repeater.
*/
index: number;
};
}
/**