{ }
interface JQuery {
- pickadate(options?: pickadateOptions): HTMLInputElement;
- pickatime(options?: pickatimeOptions): HTMLInputElement;
+ pickadate(methodName: "picker"): DatePickerObject;
+ pickadate(methodName: string): any;
+ pickadate(options?: pickadateOptions): JQuery;
+
+ pickatime(methodName: "picker"): TimePickerObject;
+ pickatime(methodName: string): any;
+ pickatime(options?: pickatimeOptions): JQuery;
}
-interface HTMLInputElement {
- pickadate(picker: string): DatePickerObject;
- pickatime(picker: string): TimePickerObject;
-}
diff --git a/jquery.window/jquery.window-tests.ts b/jquery.window/jquery.window-tests.ts
new file mode 100644
index 000000000..0b5fa7e83
--- /dev/null
+++ b/jquery.window/jquery.window-tests.ts
@@ -0,0 +1,139 @@
+///
+///
+
+function example_1() {
+ $.window({
+ title: "Cyclops Studio",
+ url: "http://apps.fstoke.me/"
+ });
+}
+
+function example_2() {
+ $.window({
+ showModal: true,
+ modalOpacity: 0.5,
+ icon: "http://www.fstoke.me/favicon.ico",
+ title: "Professional JavaScript for Web Developers",
+ content: $("#window_block2").html(), // load window_block2 html content
+ footerContent: "
This is a nice plugin :^)"
+ });
+};
+
+function example_3() {
+ // prepare customerized static attributes, see static attributes
+ // Note: you should call this method before starting to create window instances, or windows might display wrong.
+ $.window.prepare({
+ dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom'
+ animationSpeed: 200, // set animation speed
+ minWinLong: 180 // set minimized window long dimension width in pixel
+ });
+
+ // limit window within body
+ $.window({
+ icon: 'http://www.fstoke.me/favicon.ico',
+ title: "This window only can be dragged within body boundary",
+ content: "I only can be dragged within body element." +
+ "
Really? Really? You can try it... :)
",
+ checkBoundary: true,
+ x: 80,
+ y: 80
+ });
+
+ // limit window within a element
+ $("#my_boundary_panel").window({
+ icon: 'http://mail.google.com/favicon.ico',
+ title: "This window only can be dragged within its parent element",
+ content: "I only can be dragged within my boss...@@
",
+ checkBoundary: true,
+ width: 200,
+ height: 160,
+ maxWidth: 400,
+ maxHeight: 300,
+ x: 80,
+ y: 80
+ });
+
+ // assign the dock area
+ $.window.prepare({
+ dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom'
+ dockArea: $('#myDockArea'), // set the dock area
+ animationSpeed: 200, // set animation speed
+ minWinLong: 180 // set minimized window long dimension width in pixel
+ });
+}
+
+function example_4() {
+ $.window({
+ title: "Un-draggable & Un-resizable Window",
+ content: "I can't be dragged...
" +
+ "I can't be resized too...
Of course, maximize and minimize are also disabled...
" +
+ "So... What can I do? I only can be closed. @_@
",
+ draggable: false,
+ resizable: false,
+ maximizable: false,
+ minimizable: false,
+ showModal: true
+ });
+}
+
+function example_5() {
+ var log = console.log;
+ $.window({
+ title: "complext window",
+ content: $("#window_block5").html(), // load window_block5 html content
+ x: 150, // the x-axis value on screen, if -1 means put on screen center
+ y: 100, // the y-axis value on screen, if -1 means put on screen center
+ width: 600, // window width
+ height: 300, // window height
+ minWidth: 200, // the minimum width, if -1 means no checking
+ minHeight: 100, // the minimum height, if -1 means no checking
+ maxWidth: 700, // the minimum width, if -1 means no checking
+ maxHeight: 400, // the minimum height, if -1 means no checking
+ scrollable: false, // a boolean flag to show scroll bar or not
+ onOpen: (wnd: JQueryWindow.Window) => { // a callback function while container is added into body
+ alert('open');
+ },
+ onShow: (wnd: JQueryWindow.Window) => { // a callback function while whole window display routine is finished
+ alert('show');
+ },
+ onClose: (wnd: JQueryWindow.Window) => { // a callback function while user click close button
+ alert('close');
+ },
+ onSelect: (wnd: JQueryWindow.Window) => { // a callback function while user select the window
+ log('select');
+ },
+ onUnselect: (wnd: JQueryWindow.Window) => { // a callback function while window unselected
+ log('unelect');
+ },
+ onDrag: (wnd: JQueryWindow.Window) => { // a callback function while window is going to drag
+ log('drag');
+ },
+ afterDrag: (wnd: JQueryWindow.Window) => { // a callback function after window dragged
+ log('after dragged');
+ },
+ onResize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to resize
+ log('resize');
+ },
+ afterResize: (wnd: JQueryWindow.Window) => { // a callback function after window resized
+ log('after resized');
+ },
+ onMinimize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to minimize
+ log('minimize');
+ },
+ afterMinimize: (wnd: JQueryWindow.Window) => { // a callback function after window minimized
+ log('after minimized');
+ },
+ onMaximize: (wnd: JQueryWindow.Window) => { // a callback function while window is going to maximize
+ log('maximize');
+ },
+ afterMaximize: (wnd: JQueryWindow.Window) => { // a callback function after window maximized
+ log('after maximized');
+ },
+ onCascade: (wnd: JQueryWindow.Window) => { // a callback function while window is going to cascade
+ log('cascade');
+ },
+ afterCascade: (wnd: JQueryWindow.Window) => { // a callback function after window cascaded
+ log('after cascaded');
+ }
+ });
+}
\ No newline at end of file
diff --git a/jquery.window/jquery.window.d.ts b/jquery.window/jquery.window.d.ts
new file mode 100644
index 000000000..8fb4bbc81
--- /dev/null
+++ b/jquery.window/jquery.window.d.ts
@@ -0,0 +1,460 @@
+// Type definitions for Window plugin for jQuery 5.0.4
+// Project: http://fstoke.me/jquery/window/
+// Definitions by: Ryan Graham
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module JQueryWindow {
+ // Instance methods
+ interface Window {
+ /**
+ get window id
+ **/
+ getWindowId(): string;
+ /**
+ get window container's parent panel, it's a jQuery object
+ **/
+ getCaller(): JQuery;
+ /**
+ get window container panel, it's a jQuery object
+ **/
+ getContainer(): JQuery;
+ /**
+ get window header panel, it's a jQuery object
+ **/
+ getHeader(): JQuery;
+ /**
+ get window frame panel, it's a jQuery object
+ **/
+ getFrame(): JQuery;
+ /**
+ get window footer panel, it's a jQuery object
+ **/
+ getFooter(): JQuery;
+ /**
+ set current window as screen center
+ **/
+ alignCenter(): void;
+ /**
+ set current window as horizontal center
+ **/
+ alignHorizontalCenter(): void;
+ /**
+ set current window as vertical center
+ **/
+ alignVerticalCenter(): void;
+ /**
+ select current window, it will increase the original z-index value with 2
+ **/
+ select(): void;
+ /**
+ unselect current window, it will set the z-index as original options.z
+ **/
+ unselect(): void;
+ /**
+ move current window to target position or shift it by passed distance
+ **/
+ move(x: number, y: number, bShift: boolean): void;
+ /**
+ resize current window to target width/height
+ **/
+ resize(width: number, height: number): void;
+ /**
+ maximize current window
+ **/
+ maximize(): void;
+ /**
+ minimize current window
+ **/
+ minimize(): void;
+ /**
+ restore current window, it could be maximized or cascade status
+ **/
+ restore(): void;
+ /**
+ close current window
+ **/
+ close(quiet: boolean): void;
+ /**
+ hide current window
+ **/
+ hide(): void;
+ /**
+ show current window
+ **/
+ show(): void;
+ /**
+ change window title
+ **/
+ setTitle(title: string): void;
+ /**
+ change iframe url
+ **/
+ setUrl(url: string): void;
+ /**
+ change frame content
+ **/
+ setContent(content: string|JQuery|HTMLElement): void;
+ /**
+ change footer content
+ **/
+ setFooterContent(content: string|JQuery|HTMLElement): void;
+ /**
+ get window title text
+ **/
+ getTitle(): string;
+ /**
+ get url string
+ **/
+ getUrl(): string;
+ /**
+ get frame html content
+ **/
+ getContent(): string;
+ /**
+ get footer html content
+ **/
+ getFooterContent(): string;
+ /**
+ get window maximized status
+ **/
+ isMaximized(): boolean;
+ /**
+ get window minmized status
+ **/
+ isMinimized(): boolean;
+ /**
+ get window selected status
+ **/
+ isSelected(): boolean;
+ /**
+ set window icon
+ **/
+ setIcon(iconUrl: string): void;
+ /**
+ show window icon
+ **/
+ showIcon(): void;
+ /**
+ hide window icon
+ **/
+ hideIcon(): void;
+ }
+
+ // Static methods
+ interface Static {
+ (options: WindowOptions): JQueryWindow.Window;
+ /**
+ initialize with customerized static setting attributes
+ **/
+ prepare(options?: StaticOptions): void;
+ /**
+ close all created windows
+ **/
+ closeAll(quiet?: boolean): void;
+ /**
+ hide all created windows
+ **/
+ hideAll(): void;
+ /**
+ show all created windows
+ **/
+ showAll(): void;
+ /**
+ return all created windows instance
+ **/
+ getAll(): Array;
+ /**
+ get the window instance by passed window id
+ **/
+ getWindow(windowId: string): JQueryWindow.Window;
+ /**
+ get the selected window instance
+ **/
+ getSelectedWindow(): JQueryWindow.Window;
+ }
+
+ // Static options
+ interface StaticOptions {
+ /**
+ the direction of minimized window dock at. the available values are [left, right, top, bottom]
+ **/
+ dock?: string;
+ /**
+ the area which the windows will dock at
+ **/
+ dockArea?: JQuery|HTMLElement;
+ /**
+ the speed of animations: maximize, minimize, restore, shift, in milliseconds
+ **/
+ animationSpeed?: number;
+ /**
+ the narrow dimension of minimized window
+ **/
+ minWinNarrow?: number;
+ /**
+ the long dimension of minimized window
+ **/
+ minWinLong?: number;
+ /**
+ to handle browser scrollbar when window status changed(maximize, minimize, cascade)
+ **/
+ handleScrollbar?: boolean;
+ /**
+ to decide show log in firebug, IE8, chrome console
+ **/
+ showLog?: boolean;
+ }
+
+ // Instance options
+ interface WindowOptions {
+ /**
+ an icon image url string. if this attribute is given, it will force to replace the original favicon of remote page on window. or you can set it as null to hide icon.
+ **/
+ icon?: string;
+ /**
+ the title text of window
+ **/
+ title: string;
+ /**
+ the target url of iframe ready to load.
+ **/
+ url?: string;
+ /**
+ this attribute only works when url is null. when passing a jquery object or a element, it will clone the original one to append.
+ **/
+ content?: string|JQuery|HTMLElement;
+ /**
+ same as content attribute, but it's put on footer panel.
+ **/
+ footerContent?: string|JQuery|HTMLElement;
+ /**
+ container extra class
+ **/
+ containerClass?: string;
+ /**
+ header extra class
+ **/
+ headerClass?: string;
+ /**
+ frame extra class
+ **/
+ frameClass?: string;
+ /**
+ footer extra class
+ **/
+ footerClass?: string;
+ /**
+ selected header extra class
+ **/
+ selectedHeaderClass?: string;
+ /**
+ the x-axis value on screen(or caller element), if -1 means put on screen(or caller element) center
+ **/
+ x?: number;
+ /**
+ the y-axis value on screen(or caller element), if -1 means put on screen(or caller element) center
+ **/
+ y?: number;
+ /**
+ the css z-index value
+ **/
+ z?: number;
+ /**
+ window width
+ **/
+ width?: number;
+ /**
+ window height
+ **/
+ height?: number;
+ /**
+ the minimum width, if -1 means no checking
+ **/
+ minWidth?: number;
+ /**
+ the minimum height, if -1 means no checking
+ **/
+ minHeight?: number;
+ /**
+ the maximum width, if -1 means no checking
+ **/
+ maxWidth?: number;
+ /**
+ the maximum height, if -1 means no checking
+ **/
+ maxHeight?: number;
+ /**
+ to control show modal on background
+ **/
+ showModal?: boolean;
+ /**
+ the opacity of modal dialog
+ **/
+ modalOpacity?: number;
+ /**
+ to control show footer panel
+ **/
+ showFooter?: boolean;
+ /**
+ to control display window as round corner
+ **/
+ showRoundCorner?: boolean;
+ /**
+ to control window closable
+ **/
+ closable?: boolean;
+ /**
+ to control window minimizable
+ **/
+ minimizable?: boolean;
+ /**
+ to control window maximizable
+ **/
+ maximizable?: boolean;
+ /**
+ to control window with remote url could be bookmarked
+ **/
+ bookmarkable?: boolean;
+ /**
+ to control window draggable
+ **/
+ draggable?: boolean;
+ /**
+ to control window resizable
+ **/
+ resizable?: boolean;
+ /**
+ to show scroll bar or not
+ **/
+ scrollable?: boolean;
+ /**
+ to check window dialog overflow html body or caller element
+ **/
+ checkBoundary?: boolean;
+ /**
+ to limit window only can be dragged within browser window. this attribute only works when checkBoundary is true and caller is null.
+ **/
+ withinBrowserWindow?: boolean;
+ /**
+ to describe the customized button display and callback function
+ **/
+ custBtns?: Array;
+ /**
+ a callback function while container is added into body
+ **/
+ onOpen?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while whole window display routine is finished
+ **/
+ onShow?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while user click close button
+ **/
+ onClose?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while user select the window
+ **/
+ onSelect?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window unselected
+ **/
+ onUnselect?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window is going to drag
+ **/
+ onDrag?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function after window dragged
+ **/
+ afterDrag?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window is going to resize
+ **/
+ onResize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function after window resized
+ **/
+ afterResize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window is going to minimize
+ **/
+ onMinimize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function after window minimized
+ **/
+ afterMinimize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window is going to maximize
+ **/
+ onMaximize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function after window maximized
+ **/
+ afterMaximize?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while window is going to cascade
+ **/
+ onCascade?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function after window cascaded
+ **/
+ afterCascade?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while iframe ready to connect remoting url. this attribute only works while url attribute is given
+ **/
+ onIframeStart?: (wnd: JQueryWindow.Window) => void;
+ /**
+ a callback function while iframe load finished. this attribute only works while url attribute is given
+ **/
+ onIframeEnd?: (wnd: JQueryWindow.Window) => void;
+ /**
+ if null means no check, or pass a string to show warning message while iframe is going to redirect current top page
+ **/
+ iframeRedirectCheckMsg?: string;
+ /**
+ random the new created window position, it only works when options x,y value both are -1
+ **/
+ createRandomOffset?: { x: number; y: number };
+ }
+
+ // Button definition
+ interface Button {
+ /**
+
+ **/
+ id: string;
+ /**
+
+ **/
+ title?: string;
+ /**
+
+ **/
+ clazz?: string;
+ /**
+
+ **/
+ style?: string;
+ /**
+
+ **/
+ image: string;
+ /**
+
+ **/
+ callback: (btn: JQueryWindow.Button, wnd: JQueryWindow.Window) => void;
+ }
+
+}
+
+// Register with JQuery instance
+interface JQuery {
+ window(options: JQueryWindow.WindowOptions): JQueryWindow.Window;
+}
+
+// Register with JQuery static
+interface JQueryStatic {
+ window: JQueryWindow.Static;
+}
\ No newline at end of file
diff --git a/jsonpath/jsonpath-tests.ts b/jsonpath/jsonpath-tests.ts
new file mode 100644
index 000000000..d7fd50868
--- /dev/null
+++ b/jsonpath/jsonpath-tests.ts
@@ -0,0 +1,55 @@
+///
+
+import jp = require('jsonpath');
+
+var data: any;
+
+/**
+ * jp.query(obj, pathExpression)
+ * Find elements in obj matching pathExpression. Returns an array of elements that satisfy the provided JSONPath expression, or an empty array if none were matched.
+ */
+var authors = jp.query(data, '$..author');
+
+/**
+ * jp.paths(obj, pathExpression)
+ * Find elements in obj matching pathExpression. Returns an array of element paths that satisfy the provided JSONPath expression. Each path is itself an array of keys representing the location within obj of the matching element.
+ */
+var paths = jp.paths(data, '$..author');
+
+/**
+ * jp.nodes(obj, pathExpression)
+ * Find elements and their corresponding paths in obj matching pathExpression. Returns an array of node objects where each node has a path containing an array of keys representing the location within obj, and a value pointing to the matched element.
+ */
+var nodes = jp.nodes(data, '$..author');
+
+/**
+ * jp.value(obj, pathExpression, [newValue])
+ * Returns the value of the first element matching pathExpression. If newValue is provided, sets the value of the first matching element and returns the new value.
+ */
+var value = jp.value(data, '$.store..price');
+jp.value(data, '$.store..price', 12.5);
+
+/**
+ * jp.parent(obj, pathExpression)
+ * Returns the parent of the first matching element.
+ */
+var parent = jp.parent(data, '$.store..price');
+
+/**
+ * jp.apply(obj, pathExpression, fn)
+ * Runs the supplied function fn on each matching element, and replaces each matching element with the return value from the function. The function accepts the value of the matching element as its only parameter. Returns matching nodes with their updated values.
+ */
+var nodes = jp.apply(data, '$..author', (value: string) => { return value.toUpperCase() });
+
+/**
+ * jp.parse(pathExpression)
+ * Parse the provided JSONPath expression into path components and their associated operations.
+ */
+var path = jp.parse('$..author');
+
+/**
+ * jp.stringify(path)
+ * Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by jp.nodes for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by jp.parse.
+ */
+var pathExpression = jp.stringify(['$', 'store', 'book', 0, 'author']);
+
diff --git a/jsonpath/jsonpath.d.ts b/jsonpath/jsonpath.d.ts
new file mode 100644
index 000000000..db5322017
--- /dev/null
+++ b/jsonpath/jsonpath.d.ts
@@ -0,0 +1,21 @@
+// Type definitions for jsonpath 0.1.3
+// Project: https://www.npmjs.org/package/jsonpath
+// Definitions by: Hiroki Horiuchi
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module "jsonpath" {
+
+ type PathComponent = string|number;
+
+ export function query(obj: any, pathExpression: string): any[];
+ export function paths(obj: any, pathExpression: string): PathComponent[][];
+ export function nodes(obj: any, pathExpression: string): { path: PathComponent[]; value: any; }[];
+ export function value(obj: any, pathExpression: string): any;
+ export function value(obj: any, pathExpression: string, newValue: any): any;
+ export function parent(obj: any, pathExpression: string): any;
+ export function apply(obj: any, pathExpression: string, fn: (x: any) => any): { path: PathComponent[]; value: any; }[];
+ export function parse(pathExpression: string): any[];
+ export function stringify(path: PathComponent[]): string;
+
+}
+
diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts
index 1708a9d10..a1e92ef71 100644
--- a/leaflet/leaflet.d.ts
+++ b/leaflet/leaflet.d.ts
@@ -1573,6 +1573,26 @@ declare module L {
*/
getSouthEast(): LatLng;
+ /**
+ * Returns the west longitude in degrees of the bounds.
+ */
+ getWest(): number;
+
+ /**
+ * Returns the east longitude in degrees of the bounds.
+ */
+ getEast(): number;
+
+ /**
+ * Returns the north latitude in degrees of the bounds.
+ */
+ getNorth(): number;
+
+ /**
+ * Returns the south latitude in degrees of the bounds.
+ */
+ getSouth(): number;
+
/**
* Returns the center point of the bounds.
*/
diff --git a/less-middleware/less-middleware-tests.ts b/less-middleware/less-middleware-tests.ts
new file mode 100644
index 000000000..0a84203b6
--- /dev/null
+++ b/less-middleware/less-middleware-tests.ts
@@ -0,0 +1,28 @@
+///
+
+import express = require('express');
+import lessMiddleware = require('less-middleware');
+var app = express();
+
+app.use(lessMiddleware('public', {
+ cacheFile: null,
+ debug: false,
+ dest: 'dest',
+ force: false,
+ once: false,
+ pathRoot: 'root',
+ postprocess: {
+ css: function(css, req) { return css; },
+ },
+ preprocess: {
+ less: function(src, req) { return src; },
+ path: function(pathname, req) { return pathname; },
+ importPaths: function(paths, req) { return paths; }
+ },
+ render: {
+ compress: 'auto',
+ yuicompress: false,
+ paths: ['foo', 'bar']
+ },
+ storeCss: function(css, req, next) {},
+}));
diff --git a/less-middleware/less-middleware.d.ts b/less-middleware/less-middleware.d.ts
new file mode 100644
index 000000000..ee0e0069d
--- /dev/null
+++ b/less-middleware/less-middleware.d.ts
@@ -0,0 +1,108 @@
+// Type definitions for less-middleware 2.0.1
+// Project: https://github.com/emberfeather/less.js-middleware
+// Definitions by: Federico Bond
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+/* =================== USAGE ===================
+
+ import lessMiddleware = require('less-middleware');
+ app.use(lessMiddleware(source, options));
+
+ =============================================== */
+
+///
+
+declare module "less-middleware" {
+ import express = require('express');
+
+ /**
+ * Middleware created to allow processing of Less files for Connect JS framework
+ * and by extension the Express JS framework
+ */
+ function lessMiddleware(source: string, options?: {
+ /**
+ * Show more verbose logging?
+ */
+ debug?: boolean;
+
+ /**
+ * Destination directory to output the compiled .css files.
+ */
+ dest?: string;
+
+ /**
+ * Always re-compile less files on each request.
+ */
+ force?: boolean;
+
+ /**
+ * Only recompile once after each server restart.
+ * Useful for reducing disk i/o on production.
+ */
+ once?: boolean;
+
+ /**
+ * Common root of the source and destination.
+ * It is prepended to both the source and destination before being used.
+ */
+ pathRoot?: string;
+
+ /**
+ * Object containing functions relevant to preprocessing data.
+ */
+ postprocess?: {
+
+ /**
+ * Function that modifies the compiled css output before being stored.
+ */
+ css?(css: string, req: express.Request): string;
+ };
+
+ /**
+ * Object containing functions relevant to preprocessing data.
+ */
+ preprocess?: {
+
+ /**
+ * Function that modifies the raw less output before being parsed and compiled.
+ */
+ less?(css: string, req: express.Request): string;
+
+ /**
+ * Function that modifies the less pathname before being loaded from the filesystem.
+ */
+ path?(pathname: string, req: express.Request): string;
+
+ /**
+ * Function that modifies the import paths used by the less parser per request.
+ */
+ importPaths?(paths: string[], req: express.Request): string[];
+ };
+
+ /**
+ * Options for the less render.
+ */
+ render?: {
+
+ compress?: string;
+ yuicompress?: boolean;
+ paths?: string[];
+ };
+
+ /**
+ * Function that is in charge of storing the css in the filesystem.
+ */
+ storeCss?(pathname: string, css: string, req: express.Request, next: Function): void;
+
+ /**
+ * Path to a JSON file that will be used to cache less data across server restarts.
+ * This can greatly speed up initial load time after a server restart - if the less
+ * files haven't changed and the css files still exist, specifying this option will
+ * mean that the less files don't need to be recompiled after a server restart.
+ */
+ cacheFile?: string;
+
+ }): express.RequestHandler;
+
+ export = lessMiddleware;
+}
diff --git a/less/less-tests.ts b/less/less-tests.ts
index a984306ee..589250d0b 100644
--- a/less/less-tests.ts
+++ b/less/less-tests.ts
@@ -2,33 +2,12 @@
import less = require("less");
-declare var __dirname: string;
-
-less.render('.class { width: (1 + 1) }', (e, css) => console.log(css));
-
-var parser: less.Parser = new less.Parser;
-
-parser.parse('.class { width: (1 + 1) }', function (err, tree) {
- if (err) return console.error(err);
- tree.toCSS();
+less.render(".class { width: (1 + 1) }").then((output) => {
+ console.log(output.css);
});
-var parser2 = new less.Parser({
- paths: ['.', './lib'],
- filename: 'style.less'
+less.render("fail").then((output) => {
+ throw new Error("promise should have been rejected");
+}, (error: Less.RenderError) => {
+ console.log("rejected as expected on line number " + error.line);
});
-
-parser2.parse('.class { width: (1 + 1) }', (e, tree) => tree.toCSS({ compress: true }));
-
-var lessParser = new less.Parser({
- paths: [__dirname],
- filename: "out.less"
-});
-
-lessParser.parse('.class { width: (1 + 1) }', function (err, tree) {
- tree.rules.forEach(function (rule) {
- if (rule.path) {
- console.log(rule.path);
- }
- });
-});
\ No newline at end of file
diff --git a/less/less.d.ts b/less/less.d.ts
index 4c096525d..f329dd48e 100644
--- a/less/less.d.ts
+++ b/less/less.d.ts
@@ -1,556 +1,85 @@
// Type definitions for LESS
// Project: http://lesscss.org/
-// Definitions by: AndrewGaspar
+// Definitions by: Tom Hasner
// Definitions: https://github.com/borisyankov/DefinitelyTyped
-declare module less {
- class LessError {
- constructor(e: Error, env);
+declare module Less {
+ // Promise definitions from ../es6-promise/es6-promise.d.ts
+ interface Thenable {
+ then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable;
+ }
- type: any;
- message: string;
+ class Promise implements Thenable {
+ constructor(callback: (resolve : (value?: R | Thenable) => void, reject: (error?: any) => void) => void);
+
+ then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise;
+
+ catch(onRejected?: (error: any) => U | Thenable): Promise;
+
+ finally(finallyCallback: () => any): Promise;
+ }
+
+ interface RootFileInfo {
filename: string;
- index;
- line: number;
- callLine: number;
- callExtract;
- stack;
- column;
- extract: any[];
+ relativeUrls: boolean;
+ rootpath: string;
+ currentDirectory: string;
+ entryPath: string;
+ rootFilename: string;
+ }
+
+ class PluginManager {
+ constructor(less: LessStatic);
+ }
+
+ interface Plugin {
+ install: (less: LessStatic, pluginManager: PluginManager) => void;
+ }
+
+ interface SourceMapOption {
+ sourceMapURL: string;
+ sourceMapBasepath: string;
+ sourceMapRootpath: string;
+ outputSourceFiles: boolean;
+ sourceMapFileInline: boolean;
}
interface Options {
- contents?;
- rootpath?: string;
- files?;
- paths?: string[];
- mime?: string;
+ sourceMap?: SourceMapOption;
filename?: string;
- optimization?: number;
- dumpLineNumbers?: boolean;
- strictImports?;
- entryPath?: string;
- relativeUrls?;
- errback? (path: string, paths: string[], callback: Function, env: Options);
- frames?;
- compress?: boolean;
+ plugins: Plugin[];
+ rootFileInfo?: RootFileInfo;
}
- export module tree {
- export module mixin { // TODO
- export class Call {
-
- }
-
- export class Definition extends Ruleset {
-
- }
- }
-
- export module functions {
- export function rgb(r: number, g: number, b: number): Color;
- export function rgba(r: number, g: number, b: number, a: number): Color;
- export function hsl(h: number, s?: number, l?: number): Color;
- export function hsla(h: number, s?: number, l?: number, a?: number): Color;
- export function hsv(h: number, s: number, v: number): Color;
- export function hsva(h: number, s: number, v: number, a: number): Color;
- export function hue(color: Color): Dimension;
- export function saturation(color: Color): Dimension;
- export function lightness(color: Color): Dimension;
- export function red(color: Color): Dimension;
- export function green(color: Color): Dimension;
- export function blue(color: Color): Dimension;
- export function alpha(color: Color): Dimension;
- export function luma(color: Color): Dimension;
- export function saturate(color: Color, amount: IValuableNumber): Color;
- export function desaturate(color: Color, amount: IValuableNumber): Color;
- export function lighten(color: Color, amount: IValuableNumber): Color;
- export function darken(color: Color, amount: IValuableNumber): Color;
- export function fadein(color: Color, amount: IValuableNumber): Color;
- export function fadeout(color: Color, amount: IValuableNumber): Color;
- export function fade(color: Color, amount: IValuableNumber): Color;
- export function spin(color: Color, amount: IValuableNumber): Color;
- export function mix(color1: Color, color2: Color, weight: Dimension): Color;
- export function greyscale(color: Color): Color;
- export function contrast(color: Color, dark?: Color, light?: Color, threshold?: IValuableNumber): Color;
- export function contrast(color: Color, dark?: Color, light?: Color, threshold?: number): Color;
- export function e(str: string): Anonymous;
- export function e(str: JavaScript): Anonymous;
- export function escape(str: IValuableString): Anonymous;
- export function unit(val: IValuableNumber, unit?: ICSSable): Dimension;
- export function round(n: Dimension, f?: IValuableNumber): Dimension;
- export function round(n: number, f?: IValuableNumber): number;
- export function ceil(n: number): number;
- export function ceil(n: Dimension): Dimension;
- export function floor(n: number): number;
- export function floor(n: Dimension): Dimension;
- export function argb(color: Color): Anonymous;
- export function percentage(n: IValuableNumber): Dimension;
- export function color(n: Quoted): Color;
- export function iscolor(n): Keyword;
- export function isnumber(n): Keyword;
- export function isstring(n): Keyword;
- export function iskeyword(n): Keyword;
- export function isurl(n): Keyword;
- export function ispixel(n): Keyword;
- export function ispercentage(n): Keyword;
- export function isem(n): Keyword;
- export function multiply(color1: Color, color2: Color): Color;
- export function screen(color1: Color, color2: Color): Color;
- export function overlay(color1: Color, color2: Color): Color;
- export function softlight(color1: Color, color2: Color): Color;
- export function hardlight(color1: Color, color2: Color): Color;
- export function difference(color1: Color, color2: Color): Color;
- export function exclusion(color1: Color, color2: Color): Color;
- export function average(color1: Color, color2: Color): Color;
- export function negation(color1: Color, color2: Color): Color;
- export function tint(color: Color, amount: Dimension): Color;
- export function shade(color: Color, amount: Dimension): Color;
- }
-
- export var colors: any; // Could be module - got lazy
-
- interface HasDebugInfo {
- debugInfo: DebugInfo;
- }
-
- interface DebugInfo {
- lineNumber;
- fileName: string;
- }
-
- interface HSL {
- h: number;
- s: number;
- l: number;
- a: number;
- }
-
- interface DebugInfoFunction {
- (env: Options, ctx: HasDebugInfo): string;
- asComment(ctx: HasDebugInfo): string;
- asMediaQuery(ctx: HasDebugInfo): string;
- }
-
- interface RuleContainer {
- [name: string]: Rule;
- }
-
- interface ICSSable {
- toCSS(ctx?, env?: Options): string;
- }
-
- interface IEvalable {
- eval(env: Options): IEvalable;
- }
-
- interface IInjectable extends ICSSable, IEvalable {}
-
- interface IOperable {
- operate(op: Operation, other: IOperable): IOperable;
- }
-
- interface IComparable {
- compare(x: IComparable): number;
- }
-
- interface IColorable {
- toColor(): Color;
- }
-
- interface IValuableNumber {
- value: number;
- }
-
- interface IValuableString {
- value: string;
- }
-
- export class Color implements IOperable, IInjectable, IComparable {
- constructor(rgb: string, a: number);
- constructor(rgb: number[], a: number);
-
- rgb: number[];
- alpha: number;
- eval(): Color;
- toCSS(): string;
- operate(op: Operation, other: Color): Color;
- operate(op: Operation, other: IColorable): Color;
- toHSL(): HSL;
- toARGB(): string;
- compare(x: Color): number;
- }
-
- export class Directive implements IInjectable {
- constructor(name, value);
-
- name;
- value: ICSSable;
- ruleset: Ruleset;
-
- toCSS(ctx?, env?: Options): string;
- eval(env: Options): Directive;
-
- variable(name);
- find();
- rulesets();
- }
-
- export class Operation implements IEvalable {
- constructor(op, operands);
-
- op: string;
- operands: IEvalable;
-
- eval(env: Options): IEvalable;
-
- operate(op: string, a: number, b: number): number;
- }
-
- export class Dimension implements IColorable, IInjectable, IOperable, IComparable {
- constructor(value: number, unit: string);
-
- value: number;
- unit: string;
-
- eval(): Dimension;
- toColor(): Color;
- toCSS(): string;
- operate(op: Operation, other: Dimension): Dimension;
- compare(other: IComparable): number;
- }
-
- export class Keyword implements IInjectable, IComparable {
- constructor(value: string);
-
- value: string;
-
- eval(): Keyword;
- toCSS(): string;
- compare(other: IComparable): number;
-
- static True: Keyword;
- static False: Keyword;
- }
-
- export class Variable implements IEvalable {
- constructor(name: string, index, file: string);
-
- name: string;
- index;
- file: string;
-
- eval(env: Options): IEvalable;
- }
-
- export class AbstractRuleset implements IEvalable {
- selectors: Selector[];
- rules: any[];
- strictImports;
-
- eval(env: Options): Ruleset;
- evalImports(env: Options): void;
- makeImportant(): Ruleset;
- matchArgs(args: any): boolean;
- resetCache(): void;
- variables(): RuleContainer;
- variable(): Rule;
- rulesets(): Ruleset[];
- find(selector: Selector, self: Rule): Rule[];
- joinSelectors(paths: string[], context: any[][], selectors: Selector[]): void;
- joinSelector(paths: string[], context: any[][], selector: Selector): void;
- mergeElementsOnToSelectors(elements: Element[], selectors: Selector[]): void;
- }
-
- export class Ruleset extends AbstractRuleset {
- constructor(selectors: Selector[], rules: Rule[], strictImports);
-
- toCSS(context?: any[][], env?: Options): string;
- }
-
- export class Element implements IInjectable {
- constructor(combinator: Combinator, value, index);
-
- combinator: Combinator;
- value;
- index;
-
- eval(env: Options): Element;
- toCSS(env?: Options): string;
- }
-
- export class Combinator implements ICSSable {
- constructor(value: string);
-
- value: string;
-
- toCSS(env?: Options): string;
- }
-
- export class Selector implements IInjectable {
- constructor(elements: Element[]);
-
- match(other: Selector): boolean;
- eval(env: Options): Selector;
- toCSS(env?: Options): string;
- }
-
- export class Quoted implements IInjectable, IComparable {
- constructor(str: string, content: string, escaped: boolean, i);
-
- escaped: boolean;
- value: string;
- quote: string;
- index;
-
- toCSS(): string;
- eval(env: Options): Quoted;
- compare(x: IComparable): number;
- }
-
- export class Expression implements IInjectable {
- constructor(value: IEvalable[]);
-
- value: IEvalable[];
-
- eval(env: Options): IEvalable;
- toCSS(env?: Options): string;
- }
-
- export class Rule implements IInjectable {
- constructor(name: string, value?: Value, important?: string, index?, inline?: boolean);
-
- name: string;
- value: Value;
- important: string;
- index;
- inline: boolean;
-
- toCSS(env?: Options): string;
- eval(context): Rule;
-
- makeImportant(): Rule;
- }
-
- export class Shorthand implements IInjectable {
- constructor(a: ICSSable, b: ICSSable);
-
- a: ICSSable;
- b: ICSSable;
-
- toCSS(env?: Options): string;
- eval(): Shorthand;
- }
-
- export class Call implements IInjectable {
- constructor(name: string, args: IEvalable[], index, filename: string);
-
- name: string;
- args: IEvalable[];
- index;
- filename: string;
-
- eval(env: Options): IEvalable;
- toCSS(env?: Options): string;
- }
-
- export class URL implements IInjectable {
- constructor(val, rootpath: string);
-
- value;
- rootpath: string;
-
- toCSS(): string;
- eval(ctx): URL;
- }
-
- export class Alpha implements IInjectable {
- constructor(val);
-
- value;
-
- toCSS(): string;
- eval(env: Options): Alpha;
- }
-
- export class Import implements IInjectable {
- constructor(path, imports, features: ICSSable, once: boolean, index, rootpath);
-
- once: boolean;
- index;
- features: ICSSable;
- rootpath;
- path: string;
- css: boolean;
-
- toCSS(env?: Options): string;
- eval(env: Options): IEvalable;
- }
-
- export class Comment implements IInjectable {
- constructor(value: string, silent);
-
- value: string;
- silent: boolean;
-
- toCSS(env?: Options): string;
- eval(): Comment;
- }
-
- export class Anonymous implements IInjectable, IComparable {
- constructor(value: string);
-
- value: string;
-
- toCSS(): string;
- eval(): Anonymous;
- compare(x): number;
- }
-
- export class Value implements IInjectable {
- constructor(value: IEvalable[]);
-
- value: IEvalable[];
- is: string;
-
- eval(env: Options): IEvalable;
- toCSS(env?: Options): string;
- }
-
- export class JavaScript implements IEvalable {
- constructor(expression: string, index, escaped: boolean);
-
- escaped: boolean;
- expression: string;
- index;
-
- eval(env: Options): IEvalable;
- }
-
- export class Assignment implements IInjectable {
- constructor(key: string, val);
- constructor(key: string, val: ICSSable);
- constructor(key: string, val: IEvalable);
-
- key: string;
- value;
-
- toCSS(): string;
- eval(env: Options): Assignment;
- }
-
- export class Condition {
- constructor(op: string, l, r, i, negate: boolean);
-
- op: string;
- lvalue;
- rvalue;
- index;
- negate: boolean;
-
- eval(env: Options): boolean;
- }
-
- export class Paren implements IInjectable {
- constructor(node: IInjectable);
- value: IInjectable;
-
- toCSS(env?: Options): string;
- eval(env: Options): Paren;
- }
-
- export class Media implements IInjectable {
- constructor(value, features);
-
- selectors: Selector[];
- features: Value;
- ruleset: Ruleset;
-
- toCSS(ctx?, env?: Options): string;
- eval(env: Options): IEvalable;
-
- variable(name): Rule;
- rulesets(): Ruleset[];
- find(selector: Selector, self: Rule): Rule[];
-
- emptySelectors(): Selector[];
- evalTop(env: Options): IEvalable;
- evalNested(env: Options): Ruleset;
- permute(arr: any[]): any[];
- bubbleSelectors(selectors: Selector[]): void;
- }
-
- export class Ratio implements IInjectable {
- constructor(value: string);
-
- value: string;
-
- toCSS(env?: Options): string;
- eval(): Ratio;
- }
-
- export class UnicodeDescriptor implements IInjectable {
- constructor(value: string);
-
- value: string;
-
- toCSS(env?: Options): string;
- eval(): UnicodeDescriptor;
- }
-
- export class Attribute implements IInjectable {
- constructor(value: string);
-
- value: string;
-
- toCSS(env?: Options): string;
- genCSS(env: Options, output): string;
- eval(): Attribute;
- }
-
- export var debugInfo: DebugInfoFunction;
- export function find(obj: any[], fun: Function): any;
- export function jsify(obj: any): string;
- export function operate(op: string, a: number, b: number): number;
-
- export var True: Keyword;
- export var False: Keyword;
+ interface RenderError {
+ column: number;
+ extract: string[];
+ filename: string;
+ index: number;
+ line: number;
+ message: string;
+ type: string;
}
- class ParserNode extends tree.AbstractRuleset {
- toCSS(): string;
- toCSS(options: { compress: boolean; }, variables?): string;
+ interface RenderOutput {
+ css: string;
+ map: string;
+ imports: string[];
}
+}
- export class Parser {
- constructor(env?: Options);
+interface LessStatic {
+ render(input: string, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void;
+ render(input: string, options: Less.Options, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void;
- imports: {
- paths: string[];
- queue: string[];
- files;
- contents;
- mime: string;
- error;
- push(path: string, callback: (e, root, imported) => void);
- }; // TODO
+ render(input: string): Less.Promise;
+ render(input: string, options: Less.Options): Less.Promise;
- parse: (str: string, callback: (error: LessError, root: ParserNode) => void ) => void;
-
- parsers: { // Major TODO
- };
- }
-
- export function render(input: string, callback: (e, css: string) => void): void;
- export function render(input: string, options: Options,
- callback: (e, css: string) => void): void;
-
- export function formatError(ctx, options: { color: boolean; }): string;
- export function writeError(ctx, options: { color: boolean; }): void;
-
- export var version: number[];
+ version: number[];
}
declare module "less" {
- export = less;
+ export = less;
}
+
+declare var less: LessStatic;
diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts
index 46c11ebf6..10900315f 100644
--- a/lodash/lodash-tests.ts
+++ b/lodash/lodash-tests.ts
@@ -139,6 +139,15 @@ result = <_.Dictionary>_(<{ [index: string]: string; }>{ 'key1': 'test1'
// /*************
// * Arrays *
// *************/
+result = _.chunk([1, '2', '3', false]);
+result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk();
+result = _.chunk([1, '2', '3', false], 2);
+result = <_.LoDashArrayWrapper>_([1, '2', '3', false]).chunk(2);
+result = _.chunk([1, 2, 3, 4]);
+result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk();
+result = _.chunk([1, 2, 3, 4], 2);
+result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).chunk(2);
+
result = _.compact([0, 1, false, 2, '', 3]);
result = <_.LoDashArrayWrapper>_([0, 1, false, 2, '', 3]).compact();
diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts
index 426162e2e..01238b769 100644
--- a/lodash/lodash.d.ts
+++ b/lodash/lodash.d.ts
@@ -17,7 +17,7 @@ declare module _ {
* explicitly included in the build.
*
* The chainable wrapper functions are:
- * after, assign, bind, bindAll, bindKey, chain, compact, compose, concat, countBy,
+ * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy,
* createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten,
* forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy,
* indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min,
@@ -254,6 +254,30 @@ declare module _ {
/*********
* Arrays *
**********/
+
+ //_.chunk
+ interface LoDashStatic {
+ /**
+ * Creates an array of elements split into groups the length of size. If collection can’t be
+ * split evenly, the final chunk will be the remaining elements.
+ * @param array The array to process.
+ * @param size The length of each chunk.
+ * @return Returns the new array containing chunks.
+ **/
+ chunk(array: Array, size?: number): T[][];
+
+ /**
+ * @see _.chunk
+ **/
+ chunk(array: List, size?: number): T[][];
+ }
+
+ interface LoDashArrayWrapper {
+ /**
+ * @see _.chunk
+ **/
+ chunk(size?: number): LoDashArrayWrapper;
+ }
//_.compact
interface LoDashStatic {
@@ -5745,6 +5769,18 @@ declare module _ {
**/
isEmpty(value: any): boolean;
}
+
+ //_.isError
+ interface LoDashStatic {
+ /**
+ * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError,
+ * or URIError object.
+ * @param value The value to check.
+ * @return True if value is an error object, else false.
+ */
+ isError(value: any): boolean;
+ }
+
//_.isEqual
interface LoDashStatic {
diff --git a/lory.js/lory.js-tests.ts b/lory.js/lory.js-tests.ts
new file mode 100644
index 000000000..4247dceca
--- /dev/null
+++ b/lory.js/lory.js-tests.ts
@@ -0,0 +1,62 @@
+///
+
+(function() {
+ var elm = document.querySelector('.js-foo');
+ var elm2 = document.querySelector('.js-bar');
+ var elm3 = document.querySelector('.js-baz');
+ var elm4 = document.querySelector('.js-foobar');
+
+ //////////////////////////////////////////////////
+ // Init
+ //////////////////////////////////////////////////
+
+ lory(elm);
+
+ // with options
+ lory(elm2, {
+ slidesToScroll: 1,
+ slideSpeed: 300,
+ rewindSpeed: 600,
+ snapBackSpeed: 200,
+ ease: 'ease',
+ rewind: true,
+ infinite: false
+ });
+
+ // with callbacks
+ lory(elm3, {
+ beforeInit: () => { },
+ afterInit: () => { },
+ beforePrev: () => { return 1; },
+ beforeNext: () => { return false; },
+ beforeTouch: () => { return ''; },
+ beforeResize: () => { }
+ });
+
+ // with options & callbacks
+ lory(elm4, {
+ slidesToScroll: 1,
+ slideSpeed: 300,
+ rewindSpeed: 600,
+ snapBackSpeed: 200,
+ ease: 'ease',
+ rewind: true,
+ infinite: 4,
+ beforeInit: () => { return function() { console.log('foo') }; },
+ afterInit: () => { return [0, 1]; },
+ beforePrev: () => { },
+ beforeNext: () => { },
+ beforeTouch: () => { },
+ beforeResize: () => { return {}; }
+ });
+
+ //////////////////////////////////////////////////
+ // Public API
+ //////////////////////////////////////////////////
+
+ lory.setup();
+ lory.prev();
+ lory.next();
+ lory.reset();
+ lory.slideTo(1);
+}());
diff --git a/lory.js/lory.js.d.ts b/lory.js/lory.js.d.ts
new file mode 100644
index 000000000..4dc7860d8
--- /dev/null
+++ b/lory.js/lory.js.d.ts
@@ -0,0 +1,110 @@
+// Type definitions for lory 0.4.3
+// Project: https://github.com/meandmax/lory/
+// Definitions by: kubosho
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare var lory: LoryStatic;
+
+interface LoryStatic {
+ (element: Element, options?: LoryOptions): LoryStatic;
+
+ /**
+ * slides to the previous slide.
+ */
+ prev(): void;
+
+ /**
+ * slides to the next slide.
+ */
+ next(): void;
+
+ /**
+ * slides to the index given as an argument.
+ */
+ slideTo(index: number): void;
+
+ /**
+ * binds eventlisteners, merging default and user options, setup the slides based on DOM (called once during initialisation). Call setup if DOM or user options have changed or eventlisteners needs to be rebinded.
+ */
+ setup(): void;
+
+ /**
+ * sets the slider back to the starting position and resets the current index (called on resize event).
+ */
+ reset(): void;
+}
+
+interface LoryOptions {
+ //////////////////////////////////////////////////
+ // Options
+ //////////////////////////////////////////////////
+
+ /**
+ * slides scrolled at once (default: 1).
+ */
+ slidesToScroll?: number;
+
+ /**
+ * time in milliseconds for the animation of a valid slide attempt (default: 300).
+ */
+ slideSpeed?: number;
+
+ /**
+ * time in milliseconds for the animation of the rewind after the last slide (default: 600).
+ */
+ rewindSpeed?: number;
+
+ /**
+ * time for the snapBack of the slider if the slide attempt was not valid (default: 200).
+ */
+ snapBackSpeed?: number;
+
+ /**
+ * cubic bezier easing functions: http://easings.net/de (default: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)').
+ */
+ ease?: string;
+
+ /**
+ * if slider reached the last slide, with next click the slider goes back to the startindex (default: false).
+ */
+ rewind?: boolean;
+
+ /**
+ * like carousel, works with multiple slides (default: false). (do not combine with rewind)
+ */
+ infinite?: boolean | number;
+
+ //////////////////////////////////////////////////
+ // Callbacks
+ //////////////////////////////////////////////////
+
+ /**
+ * executed before initialisation (first in setup function)
+ */
+ beforeInit?: () => T;
+
+ /**
+ * executed after initialisation (end of setup function)
+ */
+ afterInit?: () => T;
+
+ /**
+ * executed on click of prev controls (prev function)
+ */
+ beforePrev?: () => T;
+
+ /**
+ * executed on click of next controls (next function)
+ */
+ beforeNext?: () => T;
+
+ /**
+ * executed on touch attempt (touchstart)
+ */
+ beforeTouch?: () => T;
+
+ /**
+ * executed on every resize event
+ */
+ beforeResize?: () => T;
+}
diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts
index ee528b666..2b9b25635 100644
--- a/marionette/marionette.d.ts
+++ b/marionette/marionette.d.ts
@@ -38,7 +38,7 @@ declare module Backbone {
include(value: any): boolean;
initial(): View;
initial(n: number): View[];
- invoke(methodName: string, arguments?: any[]): any;
+ invoke(methodName: string, args?: any[]): any;
isEmpty(object: any): boolean;
last(): View;
last(n: number): View[];
@@ -533,7 +533,7 @@ declare module Marionette {
* Calls the method named by methodName on each value in the collection. Any extra
* arguments passed to invoke will be forwarded on to the method invocation.
*/
- invoke(methodName: string, arguments?: any[]): any;
+ invoke(methodName: string, args?: any[]): any;
/**
* Returns true if the RegionManager contains no regions.
diff --git a/meteor/README.md b/meteor/README.md
index ae8178f2c..8f93e1816 100644
--- a/meteor/README.md
+++ b/meteor/README.md
@@ -1,6 +1,6 @@
# Meteor Type Definitions
-These are the definitions for version 1.0.3.1 of Meteor.
+These are the definitions for version 1.1.0.1 of Meteor.
Although these definitions can be downloaded separately for use, the recommended way to use these definitions in a Meteor application is by installing the
[typescript-libs](https://atmospherejs.com/meteortypescript/typescript-libs) Meteor smart package from atmosphere. The smart package contains TypeScript
@@ -16,25 +16,21 @@ to generate the official [Meteor docs] (http://docs.meteor.com/).
## Usage
-1. If you are using the smart package, add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The
-definitions can be found somewhere deep within `/.meteor/...`. The following will probably work:
+1. Add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The definitions can be found somewhere
+deep within `/.meteor/...`. The following will probably work:
$ ln -s ../.meteor/local/build/programs/server/assets/packages/meteortypescript_typescript-libs/definitions package_defs
-
If the definitions can't be found within the .meteor directory, you will have to manually pull down the definitions from github and add them to your project:
- If you are just using the *meteor.d.ts* file from this source, you can just add the file to any directory in your project (e.g. ".typescript" or "lib").
-
2. Install the [Typescript compiler for Meteor](https://github.com/meteor-typescript/meteor-typescript-compiler) or an [IDE which can transpile TypeScript to JavaScript](#transpiling-typescript).
3. From the typescript files, add references. Reference the definition files with a single line:
/// (substitute path in your project)
-
Or you can reference definition files individually:
-
+
/// (substitue path in your project)
///
///
@@ -46,26 +42,28 @@ definitions can be found somewhere deep within `/.meteor/...`.
### References
-Try to stay away from referencing *file.ts*, rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file. Compilation will
-be much faster and code cleaner - it's always better to split definition from implemention.
+Meteor code can run on the client and the server, for this reason you should try to stay away from referencing *file.ts* directly: you may get unexpected results.
+Rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file.
+
+Compilation will be much faster and code cleaner - it's always better to split definition from implementation anyways.
### Templates
-When specifying template *helpers*, *events*, and functions for *created*, *rendered*, and *destroyed*, you will need to use a "bracket notation" instead of the "dot notation":
+With the exception of the **body** and **head** templates, Meteor's Template dot notation cannot be used (ie. *Template.mytemplate*). Thanks to Typescript static typing checks, you will need to used the *bracket notation* to access the Template.
- Template['myTemplateName']['helpers']({
+
+ Template['myTemplateName'].helpers({
foo: function () {
return Session.get("foo");
}
});
- Template['myTemplateName']['rendered'] = function ( ) { ... }
+ Template['myTemplateName'].rendered = function ( ) { ... }
+
-This is because TypeScript enforces typing and it will throw an error saying "myTemplateName" does not exist when using the dot notation.
+### Form fields
-### Accessing a Form field
-
-Trying to read a form field value? use `(evt.target).value`.
+Form fields typically need to be casted to . For instance to read a form field value, use `(evt.target).value`.
### Global variables
@@ -77,7 +75,7 @@ Preface any global variable declarations with a TypeScript "declare var" stateme
### Collections
-The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the
+The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the
additional benefit of succinctly documenting collection schema definitions (that are actually enforced).
To define collections, you will need to create an interface representing the collection and then declare a Collection type variable with that interface type (as a generic):
@@ -113,7 +111,7 @@ for all of you custom definitions. e.g. contents of ".typescript/custom_defs/cu
///
///
///
-
+
## Transpiling TypeScript
@@ -132,4 +130,4 @@ Then, within WebStorm, go to Preferences -> File Watchers -> "+" symbol and add
Last option, is to compile code from the command line. With node and the typescript compiler installed:
- $ tsc *.ts
\ No newline at end of file
+ $ tsc *.ts
diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts
index e4c5b9066..ec2ad3b81 100644
--- a/meteor/meteor-tests.ts
+++ b/meteor/meteor-tests.ts
@@ -8,21 +8,15 @@
/*********************************** Begin setup for tests ******************************/
-
-// A developer must declare a var Template like this in a separate file to use this TypeScript type definition file
-//interface ITemplate {
-// adminDashboard: Meteor.Template;
-// chat: Meteor.Template;
-//}
-//declare var Template: ITemplate;
-
var Rooms = new Mongo.Collection('rooms');
var Messages = new Mongo.Collection('messages');
-var Monkeys = new Mongo.Collection('monkeys');
-var x = new Mongo.Collection('x');
-var y = new Mongo.Collection('y');
-
-var check = function(str1, str2) {};
+interface MonkeyDAO {
+ _id: string;
+ name: string;
+}
+var Monkeys = new Mongo.Collection('monkeys');
+//var x = new Mongo.Collection('x');
+//var y = new Mongo.Collection('y');
/********************************** End setup for tests *********************************/
@@ -98,8 +92,8 @@ Tracker.autorun(function () {
});
console.log("Current room has " +
- Counts.find(Session.get("roomId")).count +
- " messages.");
+Counts.find(Session.get("roomId")).count +
+" messages.");
/**
* From Publish and Subscribe, Meteor.subscribe section
@@ -124,7 +118,7 @@ Meteor.methods({
var you_want_to_throw_an_error = true;
if (you_want_to_throw_an_error)
- throw new Meteor.Error("404", "Can't find my pants");
+ throw new Meteor.Error("404", "Can't find my pants");
return "some return value";
},
@@ -146,15 +140,15 @@ var result = Meteor.call('foo', 1, 2);
// DA: I added the "var" keyword in there
interface ChatroomsDAO {
- _id?: string;
+ _id?: string;
}
interface MessagesDAO {
- _id?: string;
+ _id?: string;
}
var Chatrooms = new Mongo.Collection("chatrooms");
Messages = new Mongo.Collection("messages");
-var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch();
+var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch();
Messages.insert({text: "Hello, world!"});
@@ -171,10 +165,10 @@ Posts.insert({title: "Hello world", body: "First post"});
* since there is already a Collection constructor with a different signature
*
var Scratchpad = new Mongo.Collection;
-for (var i = 0; i < 10; i++)
- Scratchpad.insert({number: i * 2});
-assert(Scratchpad.find({number: {$lt: 9}}).count() === 5);
-**/
+ for (var i = 0; i < 10; i++)
+ Scratchpad.insert({number: i * 2});
+ assert(Scratchpad.find({number: {$lt: 9}}).count() === 5);
+ **/
var Animal = function (doc) {
// _.extend(this, doc);
@@ -185,11 +179,16 @@ Animal.prototype = {
makeNoise: function () {
console.log(this.sound);
}
+};
+
+
+interface AnimalDAO {
+ _id: string;
+ makeNoise: () => void;
}
-
// Define a Collection that uses Animal as its document
-var Animals = new Mongo.Collection("Animals", {
+var Animals = new Mongo.Collection("Animals", {
transform: function (doc) { return new Animal(doc); }
});
@@ -225,8 +224,8 @@ Template['adminDashboard'].events({
Meteor.methods({
declareWinners: function () {
Players.update({score: {$gt: 10}},
- {$addToSet: {badges: "Winner"}},
- {multi: true});
+ {$addToSet: {badges: "Winner"}},
+ {multi: true});
}
});
@@ -348,7 +347,7 @@ Session.equals("key", value);
*/
Meteor.publish("userData", function () {
return Meteor.users.find({_id: this.userId},
- {fields: {'other': 1, 'things': 1}});
+ {fields: {'other': 1, 'things': 1}});
});
Meteor.users.deny({update: function () { return true; }});
@@ -412,8 +411,8 @@ Accounts.emailTemplates.enrollAccount.subject = function (user) {
};
Accounts.emailTemplates.enrollAccount.text = function (user, url) {
return "You have been selected to participate in building a better future!"
- + " To activate your account, simply click the link below:\n\n"
- + url;
+ + " To activate your account, simply click the link below:\n\n"
+ + url;
};
/**
@@ -424,6 +423,36 @@ Template['adminDashboard'].helpers({
return Session.get("foo");
}
});
+Template['newTemplate'].helpers({
+ helperName: function () {
+ }
+});
+
+Template['newTemplate'].created = function () {
+
+};
+
+Template['newTemplate'].rendered = function () {
+
+};
+
+Template['newTemplate'].destroyed = function () {
+
+};
+
+Template['newTemplate'].events({
+ 'click .something': function (event) {
+ }
+});
+
+Template.registerHelper('testHelper', function() {
+ return 'tester';
+});
+
+var instance = Template.instance();
+var data = Template.currentData();
+var data = Template.parentData(1);
+var body = Template.body;
/**
* From Match section
@@ -481,10 +510,9 @@ Tracker.autorun(function (c) {
* From Deps, Deps.Computation
*/
if (Tracker.active) {
- Tracker.onInvalidate(function () {
- x.destroy();
- y.finalize();
- });
+ Tracker.onInvalidate(function () {
+ console.log('invalidated');
+ });
}
/**
@@ -494,15 +522,15 @@ var weather = "sunny";
var weatherDep = new Tracker.Dependency;
var getWeather = function () {
- weatherDep.depend();
- return weather;
+ weatherDep.depend();
+ return weather;
};
var setWeather = function (w) {
- weather = w;
- // (could add logic here to only call changed()
- // if the new value is different from the old)
- weatherDep.changed();
+ weather = w;
+ // (could add logic here to only call changed()
+ // if the new value is different from the old)
+ weatherDep.changed();
};
/**
@@ -512,7 +540,7 @@ Meteor.methods({checkTwitter: function (userId) {
check(userId, String);
this.unblock();
var result = HTTP.call("GET", "http://api.twitter.com/xyz",
- {params: {user: userId}});
+ {params: {user: userId}});
if (result.statusCode === 200)
return true
return false;
@@ -520,12 +548,12 @@ Meteor.methods({checkTwitter: function (userId) {
HTTP.call("POST", "http://api.twitter.com/xyz",
- {data: {some: "json", stuff: 1}},
- function (error, result) {
- if (result.statusCode === 200) {
- Session.set("twizzled", true);
- }
- });
+ {data: {some: "json", stuff: 1}},
+ function (error, result) {
+ if (result.statusCode === 200) {
+ Session.set("twizzled", true);
+ }
+ });
/**
* From Email, Email.send section
@@ -542,9 +570,9 @@ Meteor.methods({
// In your client code: asynchronously send an email
Meteor.call('sendEmail',
- 'alice@example.com',
- 'Hello from Meteor!',
- 'This is a test of Email.send.');
+ 'alice@example.com',
+ 'Hello from Meteor!',
+ 'This is a test of Email.send.');
var testTemplate = new Blaze.Template();
var testView = new Blaze.View();
@@ -562,8 +590,8 @@ Blaze.toHTMLWithData(testTemplate, function() {});
Blaze.toHTMLWithData(testView, {test: 1});
Blaze.toHTMLWithData(testView, function() {});
-var reactiveVar1 = new ReactiveVar('test value');
-var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; });
+var reactiveVar1 = new ReactiveVar('test value');
+var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; });
var varValue: string = reactiveVar1.get();
reactiveVar1.set('new value');
\ No newline at end of file
diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts
index e64547096..4118fbe06 100644
--- a/meteor/meteor.d.ts
+++ b/meteor/meteor.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Meteor 1.0.3.1
+// Type definitions for Meteor 1.1.0.1
// Project: http://www.meteor.com/
// Definitions by: Dave Allen
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -7,344 +7,419 @@
* These are the modules and interfaces that can't be automatically generated from the Meteor data.js file
*/
-interface EJSON extends JSON {}
-interface TemplateStatic {
- new(): Template;
- [templateName: string]: Meteor.TemplatePage;
+interface EJSONable {
+ [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSON.CustomType;
}
+interface JSONable {
+ [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
+}
+interface EJSON extends EJSONable {}
declare module Match {
- var Any;
- var String;
- var Integer;
- var Boolean;
- var undefined;
- //function null(); // not allowed in TypeScript
- var Object;
- function Optional(pattern):boolean;
- function ObjectIncluding(dico):boolean;
- function OneOf(...patterns);
- function Where(condition);
+ var Any;
+ var String;
+ var Integer;
+ var Boolean;
+ var undefined;
+ //function null(); // not allowed in TypeScript
+ var Object;
+ function Optional(pattern):boolean;
+ function ObjectIncluding(dico):boolean;
+ function OneOf(...patterns);
+ function Where(condition);
}
declare module Meteor {
- //interface EJSONObject extends Object {}
+ /** Start definitions for Template **/
+ interface Event {
+ type:string;
+ target:HTMLElement;
+ currentTarget:HTMLElement;
+ which: number;
+ stopPropagation():void;
+ stopImmediatePropagation():void;
+ preventDefault():void;
+ isPropagationStopped():boolean;
+ isImmediatePropagationStopped():boolean;
+ isDefaultPrevented():boolean;
+ }
- /** Start definitions for Template **/
- // DA: "Template" needs to support these functions:
- // Template..rendered
- // Template..created
- // Template..destroyed
- // Template..helpers
- // Template..events
- // and
- // Template.currentData
- // Template.parentData, etc.
+ interface EventHandlerFunction extends Function {
+ (event?:Meteor.Event):void;
+ }
- interface Event {
- type:string;
- target:HTMLElement;
- currentTarget:HTMLElement;
- which: number;
- stopPropagation():void;
- stopImmediatePropagation():void;
- preventDefault():void;
- isPropagationStopped():boolean;
- isImmediatePropagationStopped():boolean;
- isDefaultPrevented():boolean;
- }
+ interface EventMap {
+ [id:string]:Meteor.EventHandlerFunction;
+ }
+ /** End definitions for Template **/
- interface EventHandlerFunction extends Function {
- (event?:Meteor.Event):any;
- }
+ interface LoginWithExternalServiceOptions {
+ requestPermissions?: string[];
+ requestOfflineToken?: Boolean;
+ forceApprovalPrompt?: Boolean;
+ userEmail?: string;
+ loginStyle?: string;
+ }
- interface EventMap {
- [id:string]:Meteor.EventHandlerFunction;
- }
+ function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- interface TemplatePage {
- rendered: Function;
- created: Function;
- destroyed: Function;
- events(eventMap:Meteor.EventMap): void;
- helpers(helpers:{[id:string]: any}): void;
- }
- /** End definitions for Template **/
+ interface UserEmail {
+ address:string;
+ verified:boolean;
+ }
- interface LoginWithExternalServiceOptions {
- requestPermissions?: string[];
- requestOfflineToken?: Boolean;
- forceApprovalPrompt?: Boolean;
- userEmail?: string;
- loginStyle?: string;
- }
+ interface User {
+ _id?:string;
+ username?:string;
+ emails?:Meteor.UserEmail[];
+ createdAt?: number;
+ profile?: any;
+ services?: any;
+ }
- function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
- function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
+ interface SubscriptionHandle {
+ stop(): void;
+ ready(): boolean;
+ }
- interface UserEmail {
- address:string;
- verified:boolean;
- }
+ interface Tinytest {
+ add(name:string, func:Function);
+ addAsync(name:string, func:Function);
+ }
- interface User {
- _id?:string;
- username?:string;
- emails?:Meteor.UserEmail[];
- createdAt?: number;
- profile?: any;
- services?: any;
- }
+ enum StatusEnum {
+ connected,
+ connecting,
+ failed,
+ waiting,
+ offline
+ }
- interface SubscriptionHandle {
- stop(): void;
- ready(): boolean;
- }
+ interface LiveQueryHandle {
+ stop(): void;
+ }
- interface Tinytest {
- add(name:string, func:Function);
- addAsync(name:string, func:Function);
- }
+ interface EmailFields {
+ subject?: Function;
+ text?: Function;
+ }
- enum StatusEnum {
- connected,
- connecting,
- failed,
- waiting,
- offline
- }
+ interface EmailTemplates {
+ from: string;
+ siteName: string;
+ resetPassword: Meteor.EmailFields;
+ enrollAccount: Meteor.EmailFields;
+ verifyEmail: Meteor.EmailFields;
+ }
- interface LiveQueryHandle {
- stop(): void;
- }
+ interface Error {
+ error: number;
+ reason?: string;
+ details?: string;
+ }
- interface EmailFields {
- subject?: Function;
- text?: Function;
- }
-
- interface EmailTemplates {
- from: string;
- siteName: string;
- resetPassword: Meteor.EmailFields;
- enrollAccount: Meteor.EmailFields;
- verifyEmail: Meteor.EmailFields;
- }
-
- interface Error {
- error: number;
- reason?: string;
- details?: string;
- }
-
- interface Connection {
- id: string;
- close: Function;
- onClose: Function;
- clientAddress: string;
- httpHeaders: Object;
- }
+ interface Connection {
+ id: string;
+ close: Function;
+ onClose: Function;
+ clientAddress: string;
+ httpHeaders: Object;
+ }
}
declare module Mongo {
- interface Selector extends Object {}
- interface Modifier {}
- interface SortSpecifier {}
- interface FieldSpecifier {
- [id: string]: Number;
- }
- enum IdGenerationEnum {
- STRING,
- MONGO
- }
- interface AllowDenyOptions {
- insert?: (userId:string, doc) => boolean;
- update?: (userId, doc, fieldNames, modifier) => boolean;
- remove?: (userId, doc) => boolean;
- fetch?: string[];
- transform?: Function;
- }
+ interface Selector extends Object {}
+ interface Modifier {}
+ interface SortSpecifier {}
+ interface FieldSpecifier {
+ [id: string]: Number;
+ }
+ enum IdGenerationEnum {
+ STRING,
+ MONGO
+ }
+ interface AllowDenyOptions {
+ insert?: (userId:string, doc) => boolean;
+ update?: (userId, doc, fieldNames, modifier) => boolean;
+ remove?: (userId, doc) => boolean;
+ fetch?: string[];
+ transform?: Function;
+ }
}
declare module HTTP {
- interface HTTPRequest {
- content?:string;
- data?:any;
- query?:string;
- params?:{[id:string]:string};
- auth?:string;
- headers?:{[id:string]:string};
- timeout?:number;
- followRedirects?:boolean;
- }
- interface HTTPResponse {
- statusCode:number;
- content:string;
- // response is not always json
- data:any;
- headers:{[id:string]:string};
- }
+ interface HTTPRequest {
+ content?:string;
+ data?:any;
+ query?:string;
+ params?:{[id:string]:string};
+ auth?:string;
+ headers?:{[id:string]:string};
+ timeout?:number;
+ followRedirects?:boolean;
+ }
+
+ interface HTTPResponse {
+ statusCode?:number;
+ headers?:{[id:string]: string};
+ content?:string;
+ data?:any;
+ }
+
+ function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?:Function):HTTP.HTTPResponse;
+ function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
+ function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
+ function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
+ function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
+
}
declare module Email {
- interface EmailMessage {
- from: string;
- to: any; // string or string[]
- cc?: any; // string or string[]
- bcc?: any; // string or string[]
- replyTo?: any; // string or string[]
- subject: string;
- text?: string;
- html?: string;
- headers?: {[id: string]: string};
- }
+ interface EmailMessage {
+ from: string;
+ to: any; // string or string[]
+ cc?: any; // string or string[]
+ bcc?: any; // string or string[]
+ replyTo?: any; // string or string[]
+ subject: string;
+ text?: string;
+ html?: string;
+ headers?: {[id: string]: string};
+ }
}
declare module DDP {
- interface DDPStatic {
- subscribe(name, ...rest);
- call(method:string, ...parameters):void;
- apply(method:string, ...parameters):void;
- methods(IMeteorMethodsDictionary);
- status():DDPStatus;
- reconnect();
- disconnect();
- onReconnect();
- }
+ interface DDPStatic {
+ subscribe(name, ...rest);
+ call(method:string, ...parameters):void;
+ apply(method:string, ...parameters):void;
+ methods(IMeteorMethodsDictionary);
+ status():DDPStatus;
+ reconnect();
+ disconnect();
+ onReconnect();
+ }
- interface DDPStatus {
- connected: boolean;
- status: Meteor.StatusEnum;
- retryCount: number;
- //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime()
- retryTime?: number;
- reason?: string;
- }
+ interface DDPStatus {
+ connected: boolean;
+ status: Meteor.StatusEnum;
+ retryCount: number;
+ //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime()
+ retryTime?: number;
+ reason?: string;
+ }
}
declare module Random {
- function id(numberOfChars?: number): string;
- function secret(numberOfChars?: number): string;
- function fraction():number;
- function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length
- function choice(array:any[]):string; // @param array, @return a random element in array
- function choice(str:string):string; // @param str, @return a random char in str
+ function id(numberOfChars?: number): string;
+ function secret(numberOfChars?: number): string;
+ function fraction():number;
+ function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length
+ function choice(array:any[]):string; // @param array, @return a random element in array
+ function choice(str:string):string; // @param str, @return a random char in str
}
declare module Blaze {
- interface View {
- name: string;
- parentView: Blaze.View;
- isCreated: boolean;
- isRendered: boolean;
- isDestroyed: boolean;
- renderCount: number;
- autorun(runFunc: Function): void;
- onViewCreated(func: Function): void;
- onViewReady(func: Function): void;
- onViewDestroyed(func: Function): void;
- firstNode(): Node;
- lastNode(): Node;
- template: Blaze.Template;
- templateInstance(): any;
- }
- interface Template {
- viewName: string;
- renderFunction: Function;
- constructView(): Blaze.View;
- }
+ interface View {
+ name: string;
+ parentView: Blaze.View;
+ isCreated: boolean;
+ isRendered: boolean;
+ isDestroyed: boolean;
+ renderCount: number;
+ autorun(runFunc: Function): void;
+ onViewCreated(func: Function): void;
+ onViewReady(func: Function): void;
+ onViewDestroyed(func: Function): void;
+ firstNode(): Node;
+ lastNode(): Node;
+ template: Blaze.Template;
+ templateInstance(): any;
+ }
+ interface Template {
+ viewName: string;
+ renderFunction: Function;
+ constructView(): Blaze.View;
+ }
}
+declare module BrowserPolicy {
+
+ interface framing {
+ disallow():void;
+ restrictToOrigin(origin:string):void;
+ allowAll():void;
+ }
+ interface content {
+ allowEval():void;
+ allowInlineStyles():void;
+ allowInlineScripts():void;
+ allowSameOriginForAll():void;
+ allowDataUrlForAll():void;
+ allowOriginForAll(origin:string):void;
+ allowImageOrigin(origin:string):void;
+ allowFrameOrigin(origin:string):void;
+ allowContentTypeSniffing():void;
+ allowAllContentOrigin():void;
+ allowAllContentDataUrl():void;
+ allowAllContentSameOrigin():void;
+
+ disallowAll():void;
+ disallowInlineStyles():void;
+ disallowEval():void;
+ disallowInlineScripts():void;
+ disallowFont():void;
+ disallowObject():void;
+ disallowAllContent():void;
+ //TODO: add the basic content types
+ // allowOrigin(origin)
+ // allowDataUrl()
+ // allowSameOrigin()
+ // disallow()
+ }
+}
+
+declare module Tracker {
+ export var ComputationFunction: (computation: Tracker.Computation) => void;
+
+}
+
+declare var IterationCallback: (doc: T, index: number, cursor: Mongo.Cursor) => void;
+
/**
* These modules and interfaces are automatically generated from the Meteor api.js file
*/
declare module Accounts {
- var ui: {
- config(options: {
- requestPermissions?: Object;
- requestOfflineToken?: Object;
- forceApprovalPrompt?: Object;
- passwordSignupFields?: string;
- }): void;
- };
- var emailTemplates: Meteor.EmailTemplates;
+ function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
function config(options: {
- sendVerificationEmail?: boolean;
- forbidClientAccountCreation?: Boolean;
- restrictCreationByEmailDomain?: string | Function;
- loginExpirationInDays?: number;
- oauthSecretKey?: string;
- }): void;
- function validateLoginAttempt(func: Function): {stop: Function};
- function onLogin(func: Function): {stop: Function};
- function onLoginFailure(func: Function): {stop: Function};
+ sendVerificationEmail?: boolean;
+ forbidClientAccountCreation?: boolean;
+ restrictCreationByEmailDomain?: string | Function;
+ loginExpirationInDays?: number;
+ oauthSecretKey?: string;
+ }): void;
+ function createUser(options: {
+ username?: string;
+ email?: string;
+ password?: string;
+ profile?: Object;
+ }, callback?: Function): string;
+ var emailTemplates: Meteor.EmailTemplates;
+ function forgotPassword(options: {
+ email?: string;
+ }, callback?: Function): void;
function onCreateUser(func: Function): void;
- function validateNewUser(func: Function): void;
- function onResetPasswordLink(callback: Function): void;
function onEmailVerificationLink(callback: Function): void;
function onEnrollmentLink(callback: Function): void;
- function createUser(options: {
- username?: string;
- email?: string;
- password?: string;
- profile?: Object;
- }, callback?: Function): string;
- function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
- function forgotPassword(options: {
- email?: string;
- }, callback?: Function): void;
+ function onLogin(func: Function): {stop: Function};
+ function onLoginFailure(func: Function): {stop: Function};
+ function onResetPasswordLink(callback: Function): void;
function resetPassword(token: string, newPassword: string, callback?: Function): void;
- function verifyEmail(token: string, callback?: Function): void;
- function setPassword(userId: string, newPassword: string): void;
- function sendResetPasswordEmail(userId: string, email?: string): void;
function sendEnrollmentEmail(userId: string, email?: string): void;
+ function sendResetPasswordEmail(userId: string, email?: string): void;
function sendVerificationEmail(userId: string, email?: string): void;
+ function setPassword(userId: string, newPassword: string, options?: {
+ logout?: Object;
+ }): void;
+ var ui: {
+ config(options: {
+ requestPermissions?: Object;
+ requestOfflineToken?: Object;
+ forceApprovalPrompt?: Object;
+ passwordSignupFields?: string;
+ }): void;
+ };
+ function validateLoginAttempt(func: Function): {stop: Function};
+ function validateNewUser(func: Function): void;
+ function verifyEmail(token: string, callback?: Function): void;
+}
+
+declare module App {
+ function accessRule(domainRule: string, options?: {
+ launchExternal?: boolean;
+ }); /** TODO: add return value **/
+function configurePlugin(pluginName: string, config: Object): void;
+ function icons(icons: Object): void;
+ function info(options: {
+ id?: string;
+ version?: string;
+ name?: string;
+ description?: string;
+ author?: string;
+ email?: string;
+ website?: string;
+ }): void;
+ function launchScreens(launchScreens: Object): void;
+ function setPreference(name: string, value: string): void;
+}
+
+declare module Assets {
+ function getBinary(assetPath: string, asyncCallback?: Function): EJSON;
+ function getText(assetPath: string, asyncCallback?: Function): string;
}
declare module Blaze {
- var currentView: Blaze.View;
- function With(data: Object | Function, contentFunc: Function): Blaze.View;
- function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View;
- function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View;
function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View;
- function isTemplate(value: any): boolean;
- function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View;
- function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View;
- function remove(renderedView: Blaze.View): void;
- function toHTML(templateOrView: Template | Blaze.View): string;
- function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string;
- function getData(elementOrView?: HTMLElement | Blaze.View): Object;
- function getView(element?: HTMLElement): Blaze.View;
- function Template(viewName?: string, renderFunction?: Function): void;
- interface Template{
+ function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View;
+ var Template: TemplateStatic;
+ interface TemplateStatic {
+ new(viewName?: string, renderFunction?: Function): Template;
+ // It should be [templateName: string]: TemplateInstance but this is not possible -- user will need to cast to TemplateInstance
+ [templateName: string]: any | Template; // added "any" to make it work
+ head: Template;
+ find(selector:string):Blaze.Template;
+ findAll(selector:string):Blaze.Template[];
+ $:any;
+ }
+ interface Template {
}
- function TemplateInstance(view: Blaze.View): void;
- interface TemplateInstance{
+ var TemplateInstance: TemplateInstanceStatic;
+ interface TemplateInstanceStatic {
+ new(view: Blaze.View): TemplateInstance;
+ }
+ interface TemplateInstance {
+ $(selector: string): any;
+ autorun(runFunc: Function): Object;
data: Object;
- view: Object;
+ find(selector?: string): Blaze.TemplateInstance;
+ findAll(selector: string): Blaze.TemplateInstance[];
firstNode: Object;
lastNode: Object;
- $(selector: string): Node[];
- findAll(selector: string): HTMLElement[];
- find(selector?: string): HTMLElement;
- autorun(runFunc: Function): Object;
+ subscribe(name: string, ...args): Meteor.SubscriptionHandle;
+ subscriptionsReady(): boolean;
+ view: Object;
}
- function View(name?: string, renderFunction?: Function): void;
- interface View{
+ function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View;
+ var View: ViewStatic;
+ interface ViewStatic {
+ new(name?: string, renderFunction?: Function): View;
+ }
+ interface View {
}
+ function With(data: Object | Function, contentFunc: Function): Blaze.View;
+ var currentView: Blaze.View;
+ function getData(elementOrView?: HTMLElement | Blaze.View): Object;
+ function getView(element?: HTMLElement): Blaze.View;
+ function isTemplate(value: any): boolean;
+ function remove(renderedView: Blaze.View): void;
+ function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View;
+ function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View;
+ function toHTML(templateOrView: Template | Blaze.View): string;
+ function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string;
}
-declare module Match {
- function test(value: any, pattern: any): boolean;
+declare module Cordova {
+ function depends(dependencies:{[id:string]:string}): void;
}
declare module DDP {
@@ -352,330 +427,355 @@ declare module DDP {
}
declare module EJSON {
- var newBinary: any;
- function addType(name: string, factory: Function): void;
- function toJSONValue(val: EJSON): JSON;
- function fromJSONValue(val: JSON): any;
- function stringify(val: EJSON, options?: {
- indent?: boolean | number | string;
- canonical?: Boolean;
- }): string;
- function parse(str: string): EJSON;
- function isBinary(x: Object): boolean;
- function equals(a: EJSON, b: EJSON, options?: {
- keyOrderSensitive?: boolean;
- }): boolean;
- function clone