mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Merge branch 'master' into momentLongDate
Conflicts: moment/moment-node.d.ts
This commit is contained in:
@@ -16,7 +16,7 @@ Include a line like this:
|
||||
|
||||
## Contributions
|
||||
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
|
||||
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped.
|
||||
|
||||
|
||||
Vendored
+288
-80
@@ -178,15 +178,15 @@ declare module AmCharts {
|
||||
/** You can trigger the animation of the pie chart. */
|
||||
animateAgain();
|
||||
/** You can trigger the click on a slice from outside. index - the number of a slice or Slice object. */
|
||||
clickSlice(index);
|
||||
clickSlice(index: number);
|
||||
/** Hides slice. index - the number of a slice or Slice object. */
|
||||
hideSlice(index);
|
||||
hideSlice(index: number);
|
||||
/** You can simulate roll-out of a slice from outside. index - the number of a slice or Slice object. */
|
||||
rollOutSlice(index);
|
||||
rollOutSlice(index: number);
|
||||
/** You can simulate roll-over a slice from outside. index - the number of a slice or Slice object. */
|
||||
rollOverSlice(index);
|
||||
rollOverSlice(index: number);
|
||||
/** Shows slice. index - the number of a slice or Slice object. */
|
||||
showSlice(index);
|
||||
showSlice(index: number);
|
||||
|
||||
/** Adds event listener of the type "clickSlice" or "pullInSlice" or "pullOutSlice" to the object.
|
||||
@param type Always "clickSlice" or "pullInSlice" or "pullOutSlice".
|
||||
@@ -311,22 +311,32 @@ declare module AmCharts {
|
||||
|
||||
If you do not set properties such as dashLength, lineAlpha, lineColor, etc - values of the axis are used.*/
|
||||
class Guide {
|
||||
/** If you set it to true, the guide will be displayed above the graphs. */
|
||||
above: boolean;
|
||||
/** Radar chart only. Specifies angle at which guide should start. Affects only fills, not lines. */
|
||||
angle: number;
|
||||
/** Baloon fill color. */
|
||||
balloonColor: string;
|
||||
/** The text which will be displayed if the user rolls-over the guide. */
|
||||
balloonText: string;
|
||||
/** Specifies if label should be bold or not. */
|
||||
boldLabel: boolean;
|
||||
/** Category of the guide (in case the guide is for category axis). */
|
||||
category: string;
|
||||
/** Dash length. */
|
||||
dashLength: number;
|
||||
/** Date of the guide (in case the guide is for category axis and parseDates is set to true). */
|
||||
date: Date;
|
||||
/** Works if a guide is added to CategoryAxis and this axis is non-date-based. If you set it to true, the guide will start (or be placed, if it's not a fill) on the beginning of the category cell and will end at the end of toCategory cell. */
|
||||
expand: boolean;
|
||||
/** Fill opacity. Value range is 0 - 1. */
|
||||
fillAlpha: number;
|
||||
/** Fill color. */
|
||||
fillColor: string;
|
||||
/** Font size of guide label. */
|
||||
fontSize: string;
|
||||
/** Unique id of a Guide. You don't need to set it, unless you want to. */
|
||||
id: string;
|
||||
/** Specifies whether label should be placed inside or outside plot area. */
|
||||
inside: boolean;
|
||||
/** The label which will be displayed near the guide. */
|
||||
@@ -339,6 +349,8 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
lineColor: string;
|
||||
/** Line thickness. */
|
||||
lineThickness: number;
|
||||
/** Position of guide label. Possible values are "left" or "right" for horizontal axis and "top" or "bottom" for vertical axis. */
|
||||
position: string;
|
||||
/** Tick length. */
|
||||
tickLength: number;
|
||||
/** Radar chart only. Specifies angle at which guide should end. Affects only fills, not lines. */
|
||||
@@ -351,6 +363,8 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
toValue: number;
|
||||
/** Value of the guide (in case the guide is for value axis). */
|
||||
value: number;
|
||||
/** Value axis of a guide. As you can add guides directly to the chart, you might need to specify which which value axis should be used. */
|
||||
valueAxis: ValueAxis;
|
||||
}
|
||||
/** ImagesSettings is a class which holds common settings of all MapImage objects. */
|
||||
class ImagesSettings {
|
||||
@@ -381,7 +395,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Font size of a label.
|
||||
@default 11
|
||||
*/
|
||||
labelFontSize: number;
|
||||
labelfontSize: string;
|
||||
/** Position of the label. Allowed values are: left, right, top, bottom and middle. right */
|
||||
labelPosition: string;
|
||||
/** Label roll-over color. #00CC00 */
|
||||
@@ -546,7 +560,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Hides event bullets. */
|
||||
hideStockEvents();
|
||||
/** Removes event listener from the object. */
|
||||
removeListener(obj, type, handler);
|
||||
removeListener(obj: any, type: string, handler: any);
|
||||
/** Removes panel from the stock chart. Requires stockChart.validateNow() method to be called after this action. */
|
||||
removePanel(panel: StockPanel);
|
||||
/** Shows event bullets. */
|
||||
@@ -556,7 +570,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Method which forces the stock chart to rebuild. Should be called after properties are changed. */
|
||||
validateNow();
|
||||
/** Zooms chart to specified dates. startDate, endDate - Date objects. */
|
||||
zoom(startDate, endDate);
|
||||
zoom(startDate: Date, endDate: Date);
|
||||
/** Zooms out the chart. */
|
||||
zoomOut();
|
||||
|
||||
@@ -716,7 +730,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
*/
|
||||
equalWidths: boolean;
|
||||
/** Font size. Will use chart's font size if not set. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Horizontal space between legend item and left/right border. */
|
||||
horizontalGap: number;
|
||||
/** The text which will be displayed in the legend. Tag [[title]] will be replaced with the title of the graph. [[title]] */
|
||||
@@ -886,8 +900,17 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** AmChart is a base class of all charts. It can not be instantiated explicitly. AmCoordinateChart, AmPieChart and AmMap extend AmChart class. */
|
||||
class AmChart {
|
||||
/** used when constructing a chart with a theme */
|
||||
constructor(theme: any);
|
||||
/** Background color. You should set backgroundAlpha to >0 value in order background to be visible. We recommend setting background color directly on a chart's DIV instead of using this property. #FFFFFF */
|
||||
constructor(theme?: any);
|
||||
/** Specifies, if class names should be added to chart elements. */
|
||||
addClassNames: boolean;
|
||||
/** Array of Labels. Example of label object, with all possible properties:
|
||||
{"x": 20, "y": 20, "text": "this is label", "align": "left", "size": 12, "color": "#CC0000", "alpha": 1, "rotation": 0, "bold": true, "url": "http://www.amcharts.com"} */
|
||||
allLabels: Label[];
|
||||
/** Set this to false if you don't want chart to resize itself whenever its parent container size changes. */
|
||||
autoResize: boolean;
|
||||
/** Opacity of background. Set it to >0 value if you want backgroundColor to work. However we recommend changing div's background-color style for changing background color. */
|
||||
backgroundAlpha: number;
|
||||
/** Background color. You should set backgroundAlpha to >0 value in order background to be visible. We recommend setting background color directly on a chart's DIV instead of using this property. #FFFFFF */
|
||||
backgroundColor: string;
|
||||
/** The chart creates AmBalloon class itself. If you want to customize balloon, get balloon instance using this property, and then change balloon's properties. AmBalloon */
|
||||
balloon: AmBalloon;
|
||||
@@ -895,32 +918,83 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
borderAlpha: number;
|
||||
/** Color of chart's border. You should set borderAlpha >0 in order border to be visible. We recommend setting border color directly on a chart's DIV instead of using this property. #000000 */
|
||||
borderColor: string;
|
||||
/** This prefix is added to all class names which are added to all visual elements of a chart in case addClassNames is set to true. */
|
||||
classNamePrefix: string;
|
||||
/** Text color. #000000 */
|
||||
color: string;
|
||||
/** Non-commercial version only. Specifies position of link to amCharts site. Allowed values are: top-left, top-right, bottom-left and bottom-right.
|
||||
@default 'top-left'
|
||||
*/
|
||||
creditsPosition: string;
|
||||
/** Array of data objects, for example: [{country:"US", value:524},{country:"UK", value:624},{country:"Lithuania", value:824}]. You can have any number of fields and use any field names. In case of AmMap, data provider should be MapData object. */
|
||||
dataProvider: any[];
|
||||
/** Decimal separator.
|
||||
@Default . */
|
||||
decimalSeparator: string;
|
||||
/** Using this property you can add any additional information to SVG, like SVG filters or clip paths. The structure of this object should be identical to XML structure of a object you are adding, only in JSON format. */
|
||||
defs: any;
|
||||
/** Export config. Specifies how export to image/data export/print/annotate menu will look and behave. You can find a lot of examples in amcharts/plugins/export folder. */
|
||||
export: ExportSettings;
|
||||
/** Font family. Verdana */
|
||||
fontFamily: string;
|
||||
/** Font size.
|
||||
@default 11
|
||||
*/
|
||||
fontSize: number;
|
||||
/** Height of a chart. "100%" means the chart's height will be equal to it's container's (DIV) height and will resize if height of the container changes. Set a number instead of percents if your chart's size needs to be fixed.
|
||||
@default 1
|
||||
fontSize: string;
|
||||
/** If you set this to true, the lines of the chart will be distorted and will produce hand-drawn effect. Try to adjust chart.handDrawScatter and chart.handDrawThickness properties for a more scattered result.
|
||||
@Default false
|
||||
*/
|
||||
height: any;
|
||||
handDrawn: boolean;
|
||||
/** Defines by how many pixels hand-drawn line (when handDrawn is set to true) will fluctuate.
|
||||
@Default 2
|
||||
*/
|
||||
handDrawScatter: number;
|
||||
/** Defines by how many pixels line thickness will fluctuate (when handDrawn is set to true).
|
||||
@Default 1
|
||||
*/
|
||||
handDrawThickness: number;
|
||||
/** Time, in milliseconds after which balloon is hidden if the user rolls-out of the object. Might be useful for AmMap to avoid balloon flickering while moving mouse over the areas. Note, this is not duration of fade-out. Duration of fade-out is set in AmBalloon class.
|
||||
@Default 150
|
||||
*/
|
||||
hideBalloonTime: number;
|
||||
/** Legend of a chart. */
|
||||
legend: AmLegend;
|
||||
/** Reference to the div of the legend. */
|
||||
legendDiv: HTMLElement;
|
||||
/** Object with precision, decimalSeparator and thousandsSeparator set which will be used for number formatting. Precision set to -1 means that values won't be rounded. {precision:-1, decimalSeparator:'.', thousandsSeparator:','} */
|
||||
numberFormatter: Object;
|
||||
/** You can add listeners of events using this property. Example: listeners = [{"event":"dataUpdated", "method":handleEvent}]; */
|
||||
listerns: Object[];
|
||||
/** This setting affects touch-screen devices only. If a chart is on a page, and panEventsEnabled are set to true, the page won't move if the user touches the chart first. If a chart is big enough and occupies all the screen of your touch device, the user won’t be able to move the page at all. That's why the default value is "false". If you think that selecting/panning the chart or moving/pinching the map is a primary purpose of your users, you should set panEventsEnabled to true. */
|
||||
panEventsEnabled: boolean;
|
||||
/** Object with precision, decimalSeparator and thousandsSeparator set which will be used for formatting percent values. {precision:2, decimalSeparator:'.', thousandsSeparator:','} */
|
||||
percentFormatter: Object;
|
||||
/** Specifies absolute or relative path to amCharts files, i.e. "amcharts/". (where all .js files are located)
|
||||
If relative URLs are used, they will be relative to the current web page, displaying the chart.
|
||||
You can also set path globally, using global JavaScript variable AmCharts_path. If this variable is set, and "path" is not set in chart config, the chart will assume the path from the global variable. This allows setting amCharts path globally. I.e.:
|
||||
var AmCharts_path = "/libs/amcharts/";
|
||||
"path" parameter will be used by the charts to locate it's files, like images, plugins or patterns.*/
|
||||
path: string;
|
||||
/** Specifies path to the folder where images like resize grips, lens and similar are.
|
||||
IMPORTANT: Since V3.14.12, you should use "path" to point to amCharts directory instead. The "pathToImages" will be automatically set and does not need to be in the chart config, unless you keep your images separately from other amCharts files. */
|
||||
pathToImages: string;
|
||||
/** Precision of percent values. -1 means percent values won't be rounded at all and show as they are.
|
||||
@default 2
|
||||
*/
|
||||
percentPrecision: number;
|
||||
/** Precision of values. -1 means values won't be rounded at all and show as they are.
|
||||
@Default 1*/
|
||||
precision: number;
|
||||
/** Prefixes which are used to make big numbers shorter: 2M instead of 2000000, etc. Prefixes are used on value axes and in the legend. To enable prefixes, set usePrefixes property to true. [{number:1e+3,prefix:"k"},{number:1e+6,prefix:"M"},{number:1e+9,prefix:"G"},{number:1e+12,prefix:"T"},{number:1e+15,prefix:"P"},{number:1e+18,prefix:"E"},{number:1e+21,prefix:"Z"},{number:1e+24,prefix:"Y"}] */
|
||||
prefixesOfBigNumbers: any[];
|
||||
/** Prefixes which are used to make small numbers shorter: 2μ instead of 0.000002, etc. Prefixes are used on value axes and in the legend. To enable prefixes, set usePrefixes property to true. [{number:1e-24, prefix:"y"},{number:1e-21, prefix:"z"},{number:1e-18, prefix:"a"},{number:1e-15, prefix:"f"},{number:1e-12, prefix:"p"},{number:1e-9, prefix:"n"},{number:1e-6, prefix:"μ"},{number:1e-3, prefix:"m"}] */
|
||||
prefixesOfSmallNumbers: any[];
|
||||
/** Theme of a chart. Config files of themes can be found in amcharts/themes/ folder. More info about using themes. */
|
||||
theme: string;
|
||||
/** Thousands separator.
|
||||
@default .
|
||||
*/
|
||||
thousandsSeparator: string;
|
||||
/** Array of Title objects. */
|
||||
titles: Title[];
|
||||
/** Type of a chart. Required when creating chart using JSON. Possible types are: serial, pie, xy, radar, funnel, gauge, map, stock. */
|
||||
type: string;
|
||||
/** If true, prefixes will be used for big and small numbers. You can set arrays of prefixes via prefixesOfSmallNumbers and prefixesOfBigNumbers properties. */
|
||||
usePrefixes: boolean;
|
||||
/** Read-only. Indicates current version of a script. */
|
||||
@@ -938,7 +1012,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
bold - specifies if text is bold (true/false),
|
||||
url - url
|
||||
*/
|
||||
addLabel(x: number, y: number, text: string, align: string, size, color: string, rotation, alpha: number, bold: boolean, url: string);
|
||||
addLabel(x: number, y: number, text: string, align: string, size: number, color: string, rotation: number, alpha: number, bold: boolean, url: string);
|
||||
/** Adds a legend to the chart.
|
||||
By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter.
|
||||
(NOTE: This method will not work on StockPanel.)
|
||||
@@ -955,7 +1029,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
addLegend(legend: AmLegend, legendDiv: HTMLElement);
|
||||
|
||||
/** Adds title to the top of the chart. Pie, Radar positions are updated so that they won't overlap. Plot area of Serial/XY chart is also updated unless autoMargins property is set to false. You can add any number of titles - each of them will be placed in a new line. To remove titles, simply clear titles array: chart.titles = []; and call chart.validateNow() method. text - text of a title size - font size color - title color alpha - title opacity bold - boolean value indicating if title should be bold. */
|
||||
addTitle(text, size, color, alpha, bold);
|
||||
addTitle(text: string, size: number, color: string, alpha: number, bold: boolean);
|
||||
/** Clears the chart area, intervals, etc. */
|
||||
clear();
|
||||
/** Removes all labels added to the chart. */
|
||||
@@ -996,34 +1070,22 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** AmCoordinateChart is a base class of AmRectangularChart. It can not be instantiated explicitly. */
|
||||
|
||||
class AmCoordinateChart extends AmChart {
|
||||
/** Read-only. Array, holding processed chart's data. */
|
||||
chartData: Object[];
|
||||
/** Specifies the colors of the graphs if the lineColor of a graph is not set.
|
||||
It there are more graphs then colors in this array, the chart picks random color.
|
||||
@default ['#FF6600', '#FCD202', '#B0DE09', '#0D8ECF', '#2A0CD0', '#CD0D74', '#CC0000', '#00CC00', '#0000CC', '#DDDDDD', '#999999', '#333333', '#990000'] */
|
||||
colors: any[];
|
||||
colors: string[];
|
||||
/** The array of graphs belonging to this chart.
|
||||
To add/remove graph use addGraph/removeGraph methods instead of adding/removing graphs directly to array.
|
||||
*/
|
||||
graphs: any[];
|
||||
/** The opacity of plot area's border.
|
||||
Value range is 0 - 1.
|
||||
graphs: AmGraph[];
|
||||
/** Specifies if grid should be drawn above the graphs or below. Will not work properly with 3D charts.
|
||||
@default false
|
||||
*/
|
||||
plotAreaBorderAlpha: number;
|
||||
/** The color of the plot area's border.
|
||||
Note, the it is invisible by default, as plotAreaBorderAlpha default value is 0.
|
||||
Set it to a value higher than 0 to make it visible.
|
||||
@default #000000
|
||||
*/
|
||||
plotAreaBorderColor: string;
|
||||
/** Opacity of plot area.
|
||||
Plural form is used to keep the same property names as our Flex charts'.
|
||||
Flex charts can accept array of numbers to generate gradients.
|
||||
Although you can set array here, only first value of this array will be used.
|
||||
*/
|
||||
plotAreaFillAlphas: number;
|
||||
/** You can set both one color if you need a solid color or array of colors to generate gradients, for example: ["#000000", "#0000CC"]
|
||||
@default #FFFFFF
|
||||
*/
|
||||
plotAreaFillColors: any;
|
||||
gridAboveGraphs: boolean;
|
||||
/** Instead of adding guides to the axes, you can push all of them to this array. In case guide has category or date defined, it will automatically will be assigned to the category axis. Otherwise to first value axis, unless you specify a different valueAxis for the guide. */
|
||||
guides: Guide[];
|
||||
/** Specifies whether the animation should be sequenced or all objects should appear at once.
|
||||
@default true
|
||||
*/
|
||||
@@ -1053,6 +1115,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Adds a graph to the chart.
|
||||
*/
|
||||
addGraph(graph: AmGraph);
|
||||
/** Adds a legend to the chart. By default, you don't need to create div for your legend, however if you want it to be positioned in some different way, you can create div anywhere you want and pass id or reference to your div as a second parameter. (NOTE: This method will not work on StockPanel.) */
|
||||
/** Adds value axis to the chart.
|
||||
One value axis is created automatically, so if you don't want to change anything or add more value axes, you don't need to add it.
|
||||
*/
|
||||
@@ -1186,16 +1249,16 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
startOnAxis: boolean;
|
||||
|
||||
/** Number returns coordinate of a category. Works only if parseDates is false. If parseDates is true, use dateToCoordinate method. category - String */
|
||||
categoryToCoordinate(category);
|
||||
categoryToCoordinate(category: string);
|
||||
|
||||
/** date - Date object Returns Date of the coordinate, in case parseDates is set to true and equalSpacing is set to false. coordinate - Number */
|
||||
coordinateToDate(coordinate);
|
||||
coordinateToDate(coordinate: number);
|
||||
|
||||
/** Number Returns coordinate of the date, in case parseDates is set to true. if parseDates is false, use categoryToCoordinate method. date - Date object */
|
||||
dateToCoordinate(date);
|
||||
dateToCoordinate(date: Date);
|
||||
|
||||
/** Number Returns index of the category which is most close to specified coordinate. x - coordinate */
|
||||
xToIndex(x);
|
||||
xToIndex(x: number);
|
||||
}
|
||||
|
||||
/** ChartScrollbar class displays chart scrollbar. Supported by AmSerialChart and AmXYChart.
|
||||
@@ -1269,7 +1332,9 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
|
||||
/** AmRectangularChart is a base class of AmSerialChart and AmXYChart. It can not be instantiated explicitly.*/
|
||||
class AmRectangularChart extends AmCoordinateChart {
|
||||
/** The angle of the 3D part of plot area. This creates a 3D effect (if the "depth3D" is > 0). */
|
||||
/** The angle of the 3D part of plot area. This creates a 3D effect (if the "depth3D" is > 0).
|
||||
@default 0
|
||||
*/
|
||||
angle: number;
|
||||
/** Space left from axis labels/title to the chart's outside border, if autoMargins set to true.
|
||||
@default 10
|
||||
@@ -1279,11 +1344,12 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
@default true
|
||||
*/
|
||||
autoMargins: boolean;
|
||||
/** Chart cursor. */
|
||||
/** Cursor of a chart. */
|
||||
chartCursor: ChartCursor;
|
||||
/** Chart scrollbar. */
|
||||
chartScrollbar: ChartScrollbar;
|
||||
/** The depth of the 3D part of plot area. This creates a 3D effect (if the "angle" is > 0). */
|
||||
/** The depth of the 3D part of plot area. This creates a 3D effect (if the "angle" is > 0).
|
||||
@default 0*/
|
||||
depth3D: number;
|
||||
/** Number of pixels between the container's bottom border and plot area. This space can be used for bottom axis' values. If autoMargin is true and bottom side has axis, this property is ignored.
|
||||
@default 20
|
||||
@@ -1297,18 +1363,66 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
@default 20
|
||||
*/
|
||||
marginRight: number;
|
||||
/** Flag which should be set to false if you need margins to be recalculated on next chart.validateNow() call. */
|
||||
/** Flag which should be set to false if you need margins to be recalculated on next chart.validateNow() call.
|
||||
@default false
|
||||
*/
|
||||
marginsUpdated: boolean;
|
||||
/** Number of pixels between the container's top border and plot area. This space can be used for top axis' values. If autoMargin is true and top side has axis, this property is ignored.
|
||||
@default 20
|
||||
*/
|
||||
marginTop: number;
|
||||
/** The opacity of plot area's border. Value range is 0 - 1.
|
||||
@default 0
|
||||
*/
|
||||
plotAreaBorderAlpha: number;
|
||||
/** The color of the plot area's border. Note, the it is invisible by default, as plotAreaBorderAlpha default value is 0. Set it to a value higher than 0 to make it visible.
|
||||
@default '#000000'*/
|
||||
plotAreaBorderColor: string;
|
||||
/** Opacity of plot area. Plural form is used to keep the same property names as our Flex charts'. Flex charts can accept array of numbers to generate gradients. Although you can set array here, only first value of this array will be used.
|
||||
@default 0
|
||||
*/
|
||||
plotAreaFillAlphas: number;
|
||||
/** You can set both one color if you need a solid color or array of colors to generate gradients, for example: ["#000000", "#0000CC"]
|
||||
@default '#FFFFFF'
|
||||
*/
|
||||
plotAreaFillColors: any;
|
||||
/** If you are using gradients to fill the plot area, you can use this property to set gradient angle. The only allowed values are horizontal and vertical: 0, 90, 180, 270.
|
||||
@default 0
|
||||
*/
|
||||
plotAreaGradientAngle: number;
|
||||
/** Array of trend lines added to a chart. You can add trend lines to a chart using this array or access already existing trend lines */
|
||||
trendLines: any[];
|
||||
/** It's a simple object containing information about zoom-out button. Other available properties of this object are fontSize and color. color specifies text color of a button. {backgroundColor:'#b2e1ff',backgroundAlpha:1} */
|
||||
zoomOutButton: Object;
|
||||
trendLines: TrendLine[];
|
||||
/** Opacity of zoom-out button background.
|
||||
@default 0
|
||||
*/
|
||||
zoomOutButtonAlpha: number;
|
||||
/** Zoom-out button background color.
|
||||
@default '#e5e5e5'
|
||||
*/
|
||||
zoomOutButtonColor: string;
|
||||
/** Name of zoom-out button image. In the images folder there is another lens image, called lensWhite.png. You might want to have white lens when background is dark. Or you can simply use your own image.
|
||||
@default lens.png
|
||||
*/
|
||||
zoomOutButtonImage: string;
|
||||
/** Size of zoom-out button image
|
||||
@default: 17
|
||||
*/
|
||||
zoomOutButtonImageSize: number;
|
||||
/** Padding around the text and image.
|
||||
@default: 8
|
||||
*/
|
||||
zoomOutButtonPadding: number;
|
||||
/** Opacity of zoom-out button background when mouse is over it.
|
||||
@default: 1
|
||||
*/
|
||||
zoomOutButtonRollOverAlpha: number;
|
||||
/** Text in the zoom-out button. Show all */
|
||||
zoomOutText: string;
|
||||
|
||||
/** Adds a ChartCursor object to a chart */
|
||||
addChartCursor(cursor: ChartCursor);
|
||||
/** Adds a ChartScrollbar to a chart */
|
||||
addChartScrollbar(scrollbar: ChartScrollbar);
|
||||
/** Adds a TrendLine to a chart.
|
||||
You should call chart.validateNow() after this method is called in order the trend line to be visible. */
|
||||
addTrendLine(trendLine: TrendLine);
|
||||
@@ -1318,7 +1432,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
removeChartScrollbar();
|
||||
/** Removes a trend line from a chart.
|
||||
You should call chart.validateNow() in order the changes to be visible. */
|
||||
removeTrendLine;
|
||||
removeTrendLine(trendLine: TrendLine);
|
||||
}
|
||||
|
||||
/* Trend lines are straight lines indicating trends, might also be used for some different purposes. Can be used by Serial and XY charts. To add/remove trend line, use chart.addTrendLine(trendLine)/chart.removeTrendLine(trendLine) methods or simply pass array of trend lines: chart.trendLines = [trendLine1, trendLine2].
|
||||
@@ -1395,7 +1509,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Hides cursor. */
|
||||
hideCursor();
|
||||
/** You can force cursor to appear at specified cateogry or date. */
|
||||
showCursorAt(category);
|
||||
showCursorAt(category: string);
|
||||
/** Adds event listener of the type "changed" to the object.
|
||||
@param type Always "changed".
|
||||
@param handler Dispatched when cursor position is changed. "index" is a series index over which chart cursors currently is. "zooming" specifies if user is currently zooming (is selecting) the chart. mostCloseGraph property is set only when oneBalloonOnly is set to true.*/
|
||||
@@ -1439,20 +1553,26 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
chart.write("chartdiv");
|
||||
*/
|
||||
class AmSerialChart extends AmRectangularChart {
|
||||
/** Read-only. Chart creates category axis itself. If you want to change some properties, you should get this axis from the chart and set properties to this object. */
|
||||
/** Date format of the graph balloon (if chart parses dates and you don't use chartCursor).
|
||||
@default 'MMM DD, YYYY'
|
||||
*/
|
||||
balloonDateFormat: string;
|
||||
/** Read-only. Chart creates category axis itself. If you want to change some properties, you should get this axis from the chart and set properties to this object. */
|
||||
categoryAxis: CategoryAxis;
|
||||
/** Category field name tells the chart the name of the field in your dataProvider object which will be used for category axis values. */
|
||||
categoryField: string;
|
||||
/** Read-only. Array of SerialDataItem objects generated from dataProvider. */
|
||||
chartData: any[];
|
||||
/** The gap in pixels between two columns of the same category.
|
||||
@default 5
|
||||
*/
|
||||
columnSpacing: number;
|
||||
/** Relative width of columns. Value range is 0 - 1. 0.8 */
|
||||
/** Space between 3D stacked columns.
|
||||
@default 0
|
||||
*/
|
||||
columnSpacing3D: number;
|
||||
/** Relative width of columns. Value range is 0 - 1.
|
||||
@default 0.8
|
||||
*/
|
||||
columnWidth: number;
|
||||
/** Array holding chart's data. */
|
||||
dataProvider: any[];
|
||||
/** Read-only. If category axis parses dates endDate indicates date to which the chart is currently displayed. */
|
||||
endDate: Date;
|
||||
/** Read-only. Category index to which the chart is currently displayed. */
|
||||
@@ -1461,8 +1581,14 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
maxSelectedSeries: number;
|
||||
/** The longest time span allowed to select (in milliseconds) for example, 259200000 will limit selection to 3 days. */
|
||||
maxSelectedTime: number;
|
||||
/** The shortest time span allowed to select (in milliseconds) for example, 1000 will limit selection to 1 second. */
|
||||
/** The shortest time span allowed to select (in milliseconds) for example, 1000 will limit selection to 1 second.
|
||||
@default 0
|
||||
*/
|
||||
minSelectedTime: number;
|
||||
/** Specifies if scrolling of a chart with mouse wheel is enabled. If you press shift while rotating mouse wheel, the chart will zoom-in/out. */
|
||||
mouseWheelScrollEnabled: boolean;
|
||||
/** Specifies if zooming of a chart with mouse wheel is enabled. If you press shift while rotating mouse wheel, the chart will scroll. */
|
||||
mouseWheelZoomEnabled: boolean;
|
||||
/** If you set this to true, the chart will be rotated by 90 degrees (the columns will become bars). */
|
||||
rotate: boolean;
|
||||
/** Read-only. If category axis parses dates startDate indicates date from which the chart is currently displayed. */
|
||||
@@ -1475,15 +1601,15 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
zoomOutOnDataUpdate: boolean;
|
||||
|
||||
/** Number Returns index of the specified category value. value - series (category value) which index you want to find. */
|
||||
getCategoryIndexByValue(value);
|
||||
getCategoryIndexByValue(value: number);
|
||||
/** Zooms out, charts shows all available data. */
|
||||
zoomOut();
|
||||
/** Zooms the chart by the value of the category axis. start - category value, String \\ end - category value, String */
|
||||
zoomToCategoryValues(start, end);
|
||||
zoomToCategoryValues(start: Date, end: Date);
|
||||
/** Zooms the chart from one date to another. start - start date, Date object \\ end - end date, Date object */
|
||||
zoomToDates(start, end);
|
||||
zoomToDates(start: Date, end: Date);
|
||||
/** Zooms the chart by the index of the category. start - start index, Number \\ end - end index, Number */
|
||||
zoomToIndexes(start, end);
|
||||
zoomToIndexes(start: Date, end: Date);
|
||||
}
|
||||
|
||||
class PeriodSelector {
|
||||
@@ -1522,7 +1648,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
.
|
||||
@param handler - Dispatched when dates in period selector input fields are changed or user clicks on one of the predefined period buttons. */
|
||||
|
||||
addListener(type, handler: (e: {
|
||||
addListener(type: string, handler: (e: {
|
||||
/** Always: "changed" */
|
||||
|
||||
type: string;
|
||||
@@ -1695,6 +1821,31 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
urlTarget: string;
|
||||
}
|
||||
|
||||
/** Creates a label on the chart which can be placed anywhere, multiple can be assigned. */
|
||||
class Label {
|
||||
/** @Default 'left' */
|
||||
align: string;
|
||||
/** @Default 1 */
|
||||
alpha: number;
|
||||
/** Specifies if label is bold or not. */
|
||||
bold: boolean;
|
||||
/** Color of a label */
|
||||
color: string;
|
||||
/** Unique id of a Label. You don't need to set it, unless you want to. */
|
||||
id: string;
|
||||
/** Rotation angle. */
|
||||
rotation: number;
|
||||
/** Text size */
|
||||
size: number;
|
||||
/** Text of a label */
|
||||
text: string;
|
||||
/** URL which will be access if user clicks on a label. */
|
||||
url: string;
|
||||
/** X position of a label. */
|
||||
x: number|string;
|
||||
/** y position of a label. */
|
||||
y: number|string;
|
||||
}
|
||||
/** Common settings of legends. If you change a property after the chart is initialized, you should call stockChart.validateNow() method in order for it to work. If there is no default value specified, default value of StockLegend class will be used. */
|
||||
class LegendSettings {
|
||||
/** Alignment of legend entries. Possible values are: "left", "right" and "center". */
|
||||
@@ -1807,7 +1958,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Balloon background color. Usually balloon background color is set by the chart. Only if "adjustBorderColor" is "true" this color will be used. #CC0000 */
|
||||
fillColor: string;
|
||||
/** Size of text in the balloon. Chart's fontSize is used by default. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Horizontal padding of the balloon.
|
||||
@default 8
|
||||
3*/
|
||||
@@ -1865,7 +2016,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Fill color. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills. */
|
||||
fillColor: string;
|
||||
/** Text size. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Opacity of grid lines. */
|
||||
gridAlpha: number;
|
||||
/** Color of grid lines. */
|
||||
@@ -1945,7 +2096,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
*/
|
||||
enabled: boolean;
|
||||
/** Font size. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Specifies which graph will be displayed in the scrollbar. */
|
||||
graph: AmGraph;
|
||||
/** Graph fill opacity. */
|
||||
@@ -2004,6 +2155,8 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
alphaField: string;
|
||||
/** Value balloon color. Will use graph or data item color if not set. */
|
||||
balloonColor: string;
|
||||
/** If you set some function, the graph will call it and pass GraphDataItem and AmGraph object to it. This function should return a string which will be displayed in a balloon. */
|
||||
balloonFunction(graphDataItem: GraphDataItem, amGraph: AmGraph): string;
|
||||
/** Balloon text. You can use tags like [[value]], [[description]], [[percents]], [[open]], [[category]] [[value]] */
|
||||
balloonText: string;
|
||||
/** Specifies if the line graph should be placed behind column graphs */
|
||||
@@ -2069,7 +2222,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** You can set another graph here and if fillAlpha is >0, the area from this graph to fillToGraph will be filled (instead of filling the area to the X axis). */
|
||||
fillToGraph: AmGraph;
|
||||
/** Size of value labels text. Will use chart's fontSize if not set. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Orientation of the gradient fills (only for "column" graph type). Possible values are "vertical" and "horizontal". vertical */
|
||||
gradientOrientation: string;
|
||||
/** Specifies whether the graph is hidden. Do not use this to show/hide the graph, use hideGraph(graph) and showGraph(graph) methods instead. */
|
||||
@@ -2193,7 +2346,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Fill color. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills. #FFFFFF */
|
||||
fillColor: string;
|
||||
/** Size of value labels text. Will use chart's fontSize if not set. */
|
||||
fontSize: number;
|
||||
fontSize: string;
|
||||
/** Opacity of grid lines. 0.2 */
|
||||
gridAlpha: number;
|
||||
/** Color of grid lines. #000000 */
|
||||
@@ -2247,7 +2400,7 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Color of axis title. Will use text color of chart if not set any. */
|
||||
titleColor: string;
|
||||
/** Font size of axis title. Will use font size of chart plus two pixels if not set any. */
|
||||
titleFontSize: number;
|
||||
titlefontSize: string;
|
||||
|
||||
/** Adds guide to the axis. */
|
||||
addGuide(guide:Guide);
|
||||
@@ -2269,24 +2422,43 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
durationUnits: Object;
|
||||
/** Radar chart only. Possible values are: "polygons" and "circles". Set "circles" for polar charts. polygons */
|
||||
gridType: string;
|
||||
/** Unique id of value axis. It is not required to set it, unless you need to tell the graph which exact value axis it should use. */
|
||||
id: string;
|
||||
/** Specifies whether guide values should be included when calculating min and max of the axis. */
|
||||
includeGuidesInMinMax: boolean;
|
||||
/** If true, the axis will include hidden graphs when calculating min and max values. */
|
||||
includeHidden: boolean;
|
||||
/** Specifies whether values on axis can only be integers or both integers and doubles. */
|
||||
integersOnly: boolean;
|
||||
/** You can use this function to format Value axis labels. This function is called and these parameters are passed: labelFunction(value, valueText, valueAxis);
|
||||
Where value is numeric value, valueText is formatted string and valueAxis is a reference to valueAxis object.
|
||||
|
||||
If axis type is "date", labelFunction will pass different arguments:
|
||||
labelFunction(valueText, date, valueAxis)
|
||||
|
||||
Your function should return string.*/
|
||||
labelFunction(value: number, valueText: string, valueAxis: ValueAxis): string;
|
||||
labelFunction(valueText: string, data: Date, valueAxis: ValueAxis): string;
|
||||
/** Specifies if this value axis' scale should be logarithmic. */
|
||||
logarithmic: boolean;
|
||||
/** Read-only. Maximum value of the axis. */
|
||||
max: number;
|
||||
/** If you don't want max value to be calculated by the chart, set it using this property. This value might still be adjusted so that it would be possible to draw grid at rounded intervals. */
|
||||
maximum: number;
|
||||
/** If your value axis is date-based, you can specify maximum date of the axis. Can be set as date object, timestamp number or string if dataDateFormat is set. */
|
||||
maximumData: Date;
|
||||
/** Read-only. Minimum value of the axis. */
|
||||
min: number;
|
||||
/** If you don't want min value to be calculated by the chart, set it using this property. This value might still be adjusted so that it would be possible to draw grid at rounded intervals. */
|
||||
minimum: number;
|
||||
/** If your value axis is date-based, you can specify minimum date of the axis. Can be set as date object, timestamp number or string if dataDateFormat is set. */
|
||||
minimumDate: Date;
|
||||
/** If set value axis scale (min and max numbers) will be multiplied by it. I.e. if set to 1.2 the scope of values will increase by 20%. */
|
||||
minMaxMultiplier: number;
|
||||
/** Works with radar charts only. If you set it to “middle”, labels and data points will be placed in the middle between axes. */
|
||||
pointPosition: string;
|
||||
/** Possible values are: "top", "bottom", "left", "right". If axis is vertical, default position is "left". If axis is horizontal, default position is "bottom". */
|
||||
position: string;
|
||||
/** Precision (number of decimals) of values. */
|
||||
precision: number;
|
||||
/** Radar chart only. Specifies if categories (axes' titles) should be displayed near axes)
|
||||
@@ -2301,10 +2473,22 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
stackType: string;
|
||||
/** Read-only. Value difference between two grid lines. */
|
||||
step: number;
|
||||
/** If you set minimum and maximum for your axis, chart adjusts them so that grid would start and end on the beginning and end of plot area and grid would be at equal intervals. If you set strictMinMax to true, the chart will not adjust minimum and maximum of value axis. */
|
||||
strictMinMax: boolean;
|
||||
/** In case you synchronize one value axis with another, you need to set the synchronization multiplier. Use synchronizeWithAxis method to set with which axis it should be synced. */
|
||||
synchronizationMultiplier: number;
|
||||
/** One value axis can be synchronized with another value axis. You can use both reference to your axis or id of the axis here. You should set synchronizationMultiplyer in order for this to work. */
|
||||
synchronizeWith: ValueAxis;
|
||||
/** If this value axis is stacked and has columns, setting valueAxis.totalText = "[[total]]" will make it to display total value above the most-top column. */
|
||||
totalText: string;
|
||||
/** Color of total text. */
|
||||
totalTextColor: string;
|
||||
/** Distance from data point to total text. */
|
||||
totalTextOffset: number;
|
||||
/** This allows you to have logarithmic value axis and have zero values in the data. You must set it to >0 value in order to work. */
|
||||
treatZeroAs: number;
|
||||
/** Type of value axis. If your values in data provider are dates and you want this axis to show dates instead of numbers, set it to "date". */
|
||||
type: string;
|
||||
/** Unit which will be added to the value label. */
|
||||
unit: string;
|
||||
/** Position of the unit. Possible values are "left" and "right". right */
|
||||
@@ -2314,20 +2498,23 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** If true, values will always be formatted using scientific notation (5e+8, 5e-8...) Otherwise only values bigger then 1e+21 and smaller then 1e-7 will be displayed in scientific notation. */
|
||||
useScientificNotation: boolean;
|
||||
|
||||
/** Adds guide to the axis. */
|
||||
addGuide(guide: Guide);
|
||||
/** Adds event listener to the object. type - string like 'axisChanged' (should be listed in 'events' section of this class or classes which extend this class). handler - function which is called when event happens */
|
||||
addListener(type, handler);
|
||||
addListener(type: string, handler: any);
|
||||
/** Number, - value of coordinate. Returns value of the coordinate. coordinate - y or x coordinate, in pixels. */
|
||||
coordinateToValue(coordinate);
|
||||
coordinateToValue(coordinate: number);
|
||||
/** Number - coordinate Returns coordinate of the value in pixels. value - Number */
|
||||
getCoordinate(value);
|
||||
|
||||
getCoordinate(value: number);
|
||||
/** Removes guide from the axis.*/
|
||||
removeGuide(guide: Guide);
|
||||
/** Removes event listener from the object. */
|
||||
removeListener(obj, type, handler);
|
||||
removeListener(obj: any, type: string, handler: any);
|
||||
|
||||
/** One value axis can be synchronized with another value axis. You should set synchronizationMultiplyer in order for this to work. */
|
||||
synchronizeWithAxis(axis:ValueAxis);
|
||||
/** XY Chart only. Zooms-in the axis to the provided values. */
|
||||
zoomToValues(startValue, endValue);
|
||||
zoomToValues(startValue: number, endValue: number);
|
||||
|
||||
/** Adds event listener of the type "axisZoomed" to the object.
|
||||
@param type Always "axisZoomed".
|
||||
@@ -2347,4 +2534,25 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
|
||||
/** Removes event listener from chart object. */
|
||||
removeListener(chart: AmChart, type: string, handler: any);
|
||||
}
|
||||
}
|
||||
|
||||
class Title {
|
||||
/** @default 1 */
|
||||
alpha: number;
|
||||
/** Specifies if the tile is bold or not.
|
||||
@default false*/
|
||||
bold: boolean;
|
||||
/** Text color of a title. */
|
||||
color: string;
|
||||
/** Unique id of a Title. You don't need to set it, unless you want to. */
|
||||
id: string;
|
||||
/** Text size */
|
||||
size: number;
|
||||
/** Text of a label */
|
||||
text: string;
|
||||
}
|
||||
class ExportSettings {
|
||||
enabled: boolean;
|
||||
libs: Object;
|
||||
menu: Object;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/// <reference path="./analytics-node.d.ts" />
|
||||
|
||||
var analytics: AnalyticsNode.Analytics;
|
||||
import Analytics = require("analytics-node");
|
||||
|
||||
function testConfig(): void {
|
||||
analytics = new Analytics('YOUR_WRITE_KEY', {
|
||||
flushAt: 20,
|
||||
flushAfter: 10000
|
||||
});
|
||||
}
|
||||
|
||||
function testIdentify(): void {
|
||||
analytics.identify({
|
||||
userId: '019mr8mf4r',
|
||||
traits: {
|
||||
name: 'Michael Bolton',
|
||||
email: 'mbolton@initech.com',
|
||||
plan: 'Enterprise',
|
||||
friends: 42
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testTrack(): void {
|
||||
analytics.track({
|
||||
userId: '019mr8mf4r',
|
||||
event: 'Purchased an Item',
|
||||
properties: {
|
||||
revenue: 39.95,
|
||||
shippingMethod: '2-day'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testPage(): void {
|
||||
analytics.page({
|
||||
userId: '019mr8mf4r',
|
||||
category: 'Docs',
|
||||
name: 'Node.js Library',
|
||||
properties: {
|
||||
url: 'https://segment.com/docs/libraries/node',
|
||||
path: '/docs/libraries/node/',
|
||||
title: 'Node.js Library - Segment',
|
||||
referrer: 'https://github.com/segmentio/analytics-node'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testAlias(): void {
|
||||
// the anonymous user does actions ...
|
||||
analytics.track({ userId: 'anonymous_user', event: 'Anonymous Event' })
|
||||
// the anonymous user signs up and is aliased
|
||||
analytics.alias({ previousId: 'anonymous_user', userId: 'identified@gmail.com' })
|
||||
// the identified user is identified
|
||||
analytics.identify({ userId: 'identified@gmail.com', traits: { plan: 'Free' } })
|
||||
// the identified user does actions ...
|
||||
analytics.track({ userId: 'identified@gmail.com', event: 'Identified Action' })
|
||||
}
|
||||
|
||||
function testGroup(): void {
|
||||
analytics.group({
|
||||
userId: '019mr8mf4r',
|
||||
groupId: '56',
|
||||
traits: {
|
||||
name: 'Initech',
|
||||
description: 'Accounting Software'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testIntegrations(): void {
|
||||
analytics.track({
|
||||
event: 'Upgraded Membershipt',
|
||||
userId: '97234974',
|
||||
integrations: {
|
||||
'All': false,
|
||||
'Vero': true,
|
||||
'Google Analytics': false
|
||||
}
|
||||
});
|
||||
}
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// Type definitions for Segment's analytics.js for Node.js
|
||||
// Project: https://segment.com/docs/libraries/node/
|
||||
// Definitions by: Andrew Fong <https://github.com/fongandrew>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module AnalyticsNode {
|
||||
|
||||
interface Integrations {
|
||||
[index: string]: boolean;
|
||||
}
|
||||
|
||||
export class Analytics {
|
||||
constructor(writeKey: string, opts?: {
|
||||
flushAt?: number,
|
||||
flushAfter?: number
|
||||
});
|
||||
|
||||
/* The identify method lets you tie a user to their actions and record
|
||||
traits about them. */
|
||||
identify(message: {
|
||||
userId: string | number;
|
||||
traits?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
integrations?: Integrations;
|
||||
}): Analytics;
|
||||
|
||||
/* The track method lets you record the actions your users perform. */
|
||||
track(message: {
|
||||
userId: string | number;
|
||||
event: string;
|
||||
properties?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
integrations?: Integrations;
|
||||
}): Analytics;
|
||||
|
||||
/* The page method lets you record page views on your website, along with
|
||||
optional extra information about the page being viewed. */
|
||||
page(message: {
|
||||
userId: string | number;
|
||||
category?: string;
|
||||
name?: string;
|
||||
properties?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
integrations?: Integrations;
|
||||
}): Analytics;
|
||||
|
||||
/* alias is how you associate one identity with another. */
|
||||
alias(message: {
|
||||
previousId: string | number;
|
||||
userId: string | number;
|
||||
integrations?: Integrations;
|
||||
}): Analytics;
|
||||
|
||||
/* Group calls can be used to associate individual users with shared
|
||||
accounts or companies. */
|
||||
group(message: {
|
||||
userId: string | number;
|
||||
groupId: string | number;
|
||||
traits?: Object;
|
||||
context?: Object;
|
||||
timestamp?: Date;
|
||||
anonymous_id?: string | number;
|
||||
integrations?: Integrations;
|
||||
}): Analytics;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "analytics-node" {
|
||||
export = AnalyticsNode.Analytics;
|
||||
}
|
||||
+4
-1
@@ -26,9 +26,12 @@ declare module angular.growl {
|
||||
disableCountDown?: boolean;
|
||||
disableIcons?: boolean;
|
||||
disableCloseButton?: boolean;
|
||||
referenceId?: number;
|
||||
onclose?: Function;
|
||||
onopen?: Function;
|
||||
position?: string;
|
||||
referenceId?: number;
|
||||
translateMessage?: boolean;
|
||||
variables?: { [variable: string]: any; };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ declare module OData {
|
||||
url?: string;
|
||||
method?: string;
|
||||
};
|
||||
isodatav4?: boolean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,13 @@ myApp.config((
|
||||
$scope.items = ["A", "List", "Of", "Items"];
|
||||
}
|
||||
})
|
||||
.state('state1.list', {
|
||||
url: "/list",
|
||||
templateUrl: "partials/state1.list.html",
|
||||
controller: ['$scope', function ($scope: MyAppScope) {
|
||||
$scope.items = ["A", "List", "Of", "Items"];
|
||||
}]
|
||||
})
|
||||
.state('state2', {
|
||||
url: "/state2",
|
||||
templateUrl: "partials/state2.html"
|
||||
@@ -173,7 +180,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
this.$state.get("myState");
|
||||
this.$state.get();
|
||||
this.$state.reload();
|
||||
|
||||
|
||||
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
|
||||
if (this.$state.transition) {
|
||||
var transitionPromise: ng.IPromise<{}> = this.$state.transition;
|
||||
@@ -187,7 +194,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
// transition ended (success or failure)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Accesses the currently resolved values for the current state
|
||||
// http://stackoverflow.com/questions/28026620/is-there-a-way-to-access-resolved-state-dependencies-besides-injecting-them-into/28027023#28027023
|
||||
var resolvedValues = this.$state.$current.locals.globals;
|
||||
|
||||
+15
-15
@@ -26,24 +26,24 @@ declare module angular.ui {
|
||||
/**
|
||||
* Function, returns HTML content string
|
||||
*/
|
||||
templateProvider?: Function | Array<any>;
|
||||
templateProvider?: Function | Array<string|Function>;
|
||||
/**
|
||||
* A controller paired to the state. Function OR name as String
|
||||
* A controller paired to the state. Function, annotated array or name as String
|
||||
*/
|
||||
controller?: Function | string;
|
||||
controller?: Function|string|Array<string|Function>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* Function (injectable), returns the actual controller function or string.
|
||||
*/
|
||||
controllerProvider?: Function;
|
||||
|
||||
controllerProvider?: Function|Array<string|Function>;
|
||||
|
||||
/**
|
||||
* Specifies the parent state of this state
|
||||
*/
|
||||
parent?: string | IState
|
||||
|
||||
|
||||
resolve?: {};
|
||||
parent?: string | IState;
|
||||
|
||||
|
||||
resolve?: { [name:string]: any };
|
||||
/**
|
||||
* A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed.
|
||||
*/
|
||||
@@ -55,18 +55,18 @@ declare module angular.ui {
|
||||
/**
|
||||
* Use the views property to set up multiple views. If you don't need multiple views within a single state this property is not needed. Tip: remember that often nested views are more useful and powerful than multiple sibling views.
|
||||
*/
|
||||
views?: {};
|
||||
views?: { [name:string]: IState };
|
||||
abstract?: boolean;
|
||||
/**
|
||||
* Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onEnter?: Function|(string|Function)[];
|
||||
onEnter?: Function|Array<string|Function>;
|
||||
/**
|
||||
* Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onExit?: Function|(string|Function)[];
|
||||
onExit?: Function|Array<string|Function>;
|
||||
/**
|
||||
* Arbitrary data object, useful for custom configuration.
|
||||
*/
|
||||
@@ -245,13 +245,13 @@ declare module angular.ui {
|
||||
/** A param object, e.g. {sectionId: section.id)}, that you'd like to test against the current active state. */
|
||||
params: IStateParamsService;
|
||||
reload(): void;
|
||||
|
||||
|
||||
/** Currently pending transition. A promise that'll resolve or reject. */
|
||||
transition: ng.IPromise<{}>;
|
||||
|
||||
|
||||
$current: IResolvedState;
|
||||
}
|
||||
|
||||
|
||||
interface IResolvedState {
|
||||
locals: {
|
||||
/**
|
||||
|
||||
+17106
File diff suppressed because it is too large
Load Diff
+17105
File diff suppressed because it is too large
Load Diff
@@ -24,13 +24,13 @@ Cmp.annotations = [
|
||||
}),
|
||||
Directive({
|
||||
selector: '[tooltip]',
|
||||
properties: [
|
||||
inputs: [
|
||||
'text: tooltip'
|
||||
],
|
||||
host: {
|
||||
'(onmouseenter)': 'onMouseEnter()',
|
||||
'(onmouseleave)': 'onMouseLeave()'
|
||||
}
|
||||
outputs: [
|
||||
'(mouseenter):onMouseEnter()',
|
||||
'(mouseleave):onMouseLeave()'
|
||||
]
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
Vendored
+13550
-8659
File diff suppressed because it is too large
Load Diff
Vendored
+1310
File diff suppressed because it is too large
Load Diff
Vendored
+1310
File diff suppressed because it is too large
Load Diff
Vendored
+829
-526
File diff suppressed because it is too large
Load Diff
Vendored
+1330
File diff suppressed because it is too large
Load Diff
Vendored
+1330
File diff suppressed because it is too large
Load Diff
Vendored
+995
-403
File diff suppressed because it is too large
Load Diff
+408
@@ -0,0 +1,408 @@
|
||||
// Type definitions for Angular v2.0.0-local_sha.f77234e
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/test_lib depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2.d.ts"/>
|
||||
///<reference path="../jasmine/jasmine.d.ts"/>
|
||||
|
||||
|
||||
|
||||
declare module ngTestLib {
|
||||
/**
|
||||
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
||||
* // some code that uses `dep` and `object`
|
||||
* // ...
|
||||
* }));
|
||||
*
|
||||
* it('...', inject([AClass, AsyncTestCompleter], (object, async) => {
|
||||
* object.doSomething().then(() => {
|
||||
* expect(...);
|
||||
* async.done();
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Notes:
|
||||
* - injecting an `AsyncTestCompleter` allow completing async tests - this is the equivalent of
|
||||
* adding a `done` parameter in Jasmine,
|
||||
* - inject is currently a function because of some Traceur limitation the syntax should eventually
|
||||
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
||||
*
|
||||
* @param {Array} tokens
|
||||
* @param {Function} fn
|
||||
* @return {FunctionWithParamTokens}
|
||||
*/
|
||||
function inject(tokens: any[], fn: Function): FunctionWithParamTokens;
|
||||
|
||||
|
||||
|
||||
var proxy: ClassDecorator;
|
||||
|
||||
|
||||
|
||||
var afterEach: Function;
|
||||
|
||||
|
||||
|
||||
type SyncTestFn = () => void
|
||||
|
||||
|
||||
interface NgMatchers extends jasmine.Matchers {
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
|
||||
toEqual(expected: any): boolean;
|
||||
|
||||
toBePromise(): boolean;
|
||||
|
||||
toBeAnInstanceOf(expected: any): boolean;
|
||||
|
||||
toHaveText(expected: any): boolean;
|
||||
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
|
||||
toImplement(expected: any): boolean;
|
||||
|
||||
toContainError(expected: any): boolean;
|
||||
|
||||
toThrowErrorWith(expectedMessage: any): boolean;
|
||||
|
||||
not: NgMatchers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var expect: (actual: any) => NgMatchers;
|
||||
|
||||
|
||||
|
||||
class AsyncTestCompleter {
|
||||
|
||||
constructor(_done: Function);
|
||||
|
||||
done(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function describe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function ddescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function xdescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
* The given function must return a list of DI bindings.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* beforeEachBindings(() => [
|
||||
* bind(Compiler).toClass(MockCompiler),
|
||||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
function beforeEachBindings(fn: any): void;
|
||||
|
||||
|
||||
|
||||
function it(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function xit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function iit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
interface GuinessCompatibleSpy extends jasmine.Spy {
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.returnValue, all calls to the function will return a specific
|
||||
* value.
|
||||
*/
|
||||
andReturn(val: any): void;
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied
|
||||
* function.
|
||||
*/
|
||||
andCallFake(fn: Function): GuinessCompatibleSpy;
|
||||
|
||||
/**
|
||||
* removes all recorded calls
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SpyObject {
|
||||
|
||||
constructor(type?: any);
|
||||
|
||||
static stub(object?: any, config?: any, overrides?: any): void;
|
||||
|
||||
noSuchMethod(args: any): void;
|
||||
|
||||
spy(name: any): void;
|
||||
|
||||
prop(name: any, value: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isInInnerZone(): boolean;
|
||||
|
||||
|
||||
|
||||
interface RootTestComponent {
|
||||
|
||||
debugElement: ng.DebugElement;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a RootTestComponent for use in component level tests.
|
||||
*/
|
||||
class TestComponentBuilder {
|
||||
|
||||
constructor(_injector: ng.Injector);
|
||||
|
||||
/**
|
||||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ng.ViewMetadata} are preserved.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {string} html
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideTemplate(componentType: ng.Type, template: string): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides a component's {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {view} View
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideView(componentType: ng.Type, view: ng.ViewMetadata): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides the directives from the component {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {ng.Type} from
|
||||
* @param {ng.Type} to
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideDirective(componentType: ng.Type, from: ng.Type, to: ng.Type): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideViewBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Builds and returns a RootTestComponent.
|
||||
*
|
||||
* @return {Promise<RootTestComponent>}
|
||||
*/
|
||||
createAsync(rootComponentType: ng.Type): Promise<RootTestComponent>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createTestInjector(bindings: Array<ng.Type | ng.Binding | any[]>): ng.Injector;
|
||||
|
||||
|
||||
|
||||
class FunctionWithParamTokens {
|
||||
|
||||
constructor(_tokens: any[], _fn: Function);
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: ng.Injector): any;
|
||||
|
||||
hasToken(token: any): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception will be thrown.
|
||||
*
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
function fakeAsync(fn: Function): Function;
|
||||
|
||||
|
||||
|
||||
function clearPendingTimers(): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer callback
|
||||
* has been executed.
|
||||
*
|
||||
* @param {number} millis Number of millisecond, defaults to 0
|
||||
*/
|
||||
function tick(millis?: number): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
function flushMicrotasks(): void;
|
||||
|
||||
|
||||
|
||||
class Log {
|
||||
|
||||
constructor();
|
||||
|
||||
add(value: any): void;
|
||||
|
||||
fn(value: any): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
result(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class BrowserDetection {
|
||||
|
||||
constructor(ua: string);
|
||||
|
||||
isFirefox: boolean;
|
||||
|
||||
isAndroid: boolean;
|
||||
|
||||
isEdge: boolean;
|
||||
|
||||
isIE: boolean;
|
||||
|
||||
isWebkit: boolean;
|
||||
|
||||
isIOS7: boolean;
|
||||
|
||||
isSlow: boolean;
|
||||
|
||||
supportsIntlApi: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var browserDetection: BrowserDetection;
|
||||
|
||||
|
||||
|
||||
function dispatchEvent(element: any, eventType: any): void;
|
||||
|
||||
|
||||
|
||||
function el(html: string): HTMLElement;
|
||||
|
||||
|
||||
|
||||
function containsRegexp(input: string): RegExp;
|
||||
|
||||
|
||||
|
||||
function normalizeCSS(css: string): string;
|
||||
|
||||
|
||||
|
||||
function stringifyElement(el: any): string;
|
||||
|
||||
|
||||
|
||||
var RootTestComponent: ng.InjectableReference;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/test_lib" {
|
||||
export = ngTestLib;
|
||||
}
|
||||
|
||||
|
||||
+408
@@ -0,0 +1,408 @@
|
||||
// Type definitions for Angular v2.0.0-local_sha.7d5c3eb
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/test_lib depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2.d.ts"/>
|
||||
///<reference path="../jasmine/jasmine.d.ts"/>
|
||||
|
||||
|
||||
|
||||
declare module ngTestLib {
|
||||
/**
|
||||
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
||||
* // some code that uses `dep` and `object`
|
||||
* // ...
|
||||
* }));
|
||||
*
|
||||
* it('...', inject([AClass, AsyncTestCompleter], (object, async) => {
|
||||
* object.doSomething().then(() => {
|
||||
* expect(...);
|
||||
* async.done();
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Notes:
|
||||
* - injecting an `AsyncTestCompleter` allow completing async tests - this is the equivalent of
|
||||
* adding a `done` parameter in Jasmine,
|
||||
* - inject is currently a function because of some Traceur limitation the syntax should eventually
|
||||
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
||||
*
|
||||
* @param {Array} tokens
|
||||
* @param {Function} fn
|
||||
* @return {FunctionWithParamTokens}
|
||||
*/
|
||||
function inject(tokens: any[], fn: Function): FunctionWithParamTokens;
|
||||
|
||||
|
||||
|
||||
var proxy: ClassDecorator;
|
||||
|
||||
|
||||
|
||||
var afterEach: Function;
|
||||
|
||||
|
||||
|
||||
type SyncTestFn = () => void
|
||||
|
||||
|
||||
interface NgMatchers extends jasmine.Matchers {
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
|
||||
toEqual(expected: any): boolean;
|
||||
|
||||
toBePromise(): boolean;
|
||||
|
||||
toBeAnInstanceOf(expected: any): boolean;
|
||||
|
||||
toHaveText(expected: any): boolean;
|
||||
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
|
||||
toImplement(expected: any): boolean;
|
||||
|
||||
toContainError(expected: any): boolean;
|
||||
|
||||
toThrowErrorWith(expectedMessage: any): boolean;
|
||||
|
||||
not: NgMatchers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var expect: (actual: any) => NgMatchers;
|
||||
|
||||
|
||||
|
||||
class AsyncTestCompleter {
|
||||
|
||||
constructor(_done: Function);
|
||||
|
||||
done(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function describe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function ddescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function xdescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
* The given function must return a list of DI bindings.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* beforeEachBindings(() => [
|
||||
* bind(Compiler).toClass(MockCompiler),
|
||||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
function beforeEachBindings(fn: any): void;
|
||||
|
||||
|
||||
|
||||
function it(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function xit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function iit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
interface GuinessCompatibleSpy extends jasmine.Spy {
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.returnValue, all calls to the function will return a specific
|
||||
* value.
|
||||
*/
|
||||
andReturn(val: any): void;
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied
|
||||
* function.
|
||||
*/
|
||||
andCallFake(fn: Function): GuinessCompatibleSpy;
|
||||
|
||||
/**
|
||||
* removes all recorded calls
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SpyObject {
|
||||
|
||||
constructor(type?: any);
|
||||
|
||||
static stub(object?: any, config?: any, overrides?: any): void;
|
||||
|
||||
noSuchMethod(args: any): void;
|
||||
|
||||
spy(name: any): void;
|
||||
|
||||
prop(name: any, value: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isInInnerZone(): boolean;
|
||||
|
||||
|
||||
|
||||
interface RootTestComponent {
|
||||
|
||||
debugElement: ng.DebugElement;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a RootTestComponent for use in component level tests.
|
||||
*/
|
||||
class TestComponentBuilder {
|
||||
|
||||
constructor(_injector: ng.Injector);
|
||||
|
||||
/**
|
||||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ng.ViewMetadata} are preserved.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {string} html
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideTemplate(componentType: ng.Type, template: string): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides a component's {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {view} View
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideView(componentType: ng.Type, view: ng.ViewMetadata): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides the directives from the component {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {ng.Type} from
|
||||
* @param {ng.Type} to
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideDirective(componentType: ng.Type, from: ng.Type, to: ng.Type): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideViewBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Builds and returns a RootTestComponent.
|
||||
*
|
||||
* @return {Promise<RootTestComponent>}
|
||||
*/
|
||||
createAsync(rootComponentType: ng.Type): Promise<RootTestComponent>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createTestInjector(bindings: Array<ng.Type | ng.Binding | any[]>): ng.Injector;
|
||||
|
||||
|
||||
|
||||
class FunctionWithParamTokens {
|
||||
|
||||
constructor(_tokens: any[], _fn: Function);
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: ng.Injector): any;
|
||||
|
||||
hasToken(token: any): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception will be thrown.
|
||||
*
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
function fakeAsync(fn: Function): Function;
|
||||
|
||||
|
||||
|
||||
function clearPendingTimers(): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer callback
|
||||
* has been executed.
|
||||
*
|
||||
* @param {number} millis Number of millisecond, defaults to 0
|
||||
*/
|
||||
function tick(millis?: number): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
function flushMicrotasks(): void;
|
||||
|
||||
|
||||
|
||||
class Log {
|
||||
|
||||
constructor();
|
||||
|
||||
add(value: any): void;
|
||||
|
||||
fn(value: any): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
result(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class BrowserDetection {
|
||||
|
||||
constructor(ua: string);
|
||||
|
||||
isFirefox: boolean;
|
||||
|
||||
isAndroid: boolean;
|
||||
|
||||
isEdge: boolean;
|
||||
|
||||
isIE: boolean;
|
||||
|
||||
isWebkit: boolean;
|
||||
|
||||
isIOS7: boolean;
|
||||
|
||||
isSlow: boolean;
|
||||
|
||||
supportsIntlApi: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var browserDetection: BrowserDetection;
|
||||
|
||||
|
||||
|
||||
function dispatchEvent(element: any, eventType: any): void;
|
||||
|
||||
|
||||
|
||||
function el(html: string): HTMLElement;
|
||||
|
||||
|
||||
|
||||
function containsRegexp(input: string): RegExp;
|
||||
|
||||
|
||||
|
||||
function normalizeCSS(css: string): string;
|
||||
|
||||
|
||||
|
||||
function stringifyElement(el: any): string;
|
||||
|
||||
|
||||
|
||||
var RootTestComponent: ng.InjectableReference;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/test_lib" {
|
||||
export = ngTestLib;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+408
@@ -0,0 +1,408 @@
|
||||
// Type definitions for Angular v2.0.0-local_sha.7d5c3eb
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/test_lib depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2.d.ts"/>
|
||||
///<reference path="../jasmine/jasmine.d.ts"/>
|
||||
|
||||
|
||||
|
||||
declare module ngTestLib {
|
||||
/**
|
||||
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
||||
* // some code that uses `dep` and `object`
|
||||
* // ...
|
||||
* }));
|
||||
*
|
||||
* it('...', inject([AClass, AsyncTestCompleter], (object, async) => {
|
||||
* object.doSomething().then(() => {
|
||||
* expect(...);
|
||||
* async.done();
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Notes:
|
||||
* - injecting an `AsyncTestCompleter` allow completing async tests - this is the equivalent of
|
||||
* adding a `done` parameter in Jasmine,
|
||||
* - inject is currently a function because of some Traceur limitation the syntax should eventually
|
||||
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
||||
*
|
||||
* @param {Array} tokens
|
||||
* @param {Function} fn
|
||||
* @return {FunctionWithParamTokens}
|
||||
*/
|
||||
function inject(tokens: any[], fn: Function): FunctionWithParamTokens;
|
||||
|
||||
|
||||
|
||||
var proxy: ClassDecorator;
|
||||
|
||||
|
||||
|
||||
var afterEach: Function;
|
||||
|
||||
|
||||
|
||||
type SyncTestFn = () => void
|
||||
|
||||
|
||||
interface NgMatchers extends jasmine.Matchers {
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
|
||||
toEqual(expected: any): boolean;
|
||||
|
||||
toBePromise(): boolean;
|
||||
|
||||
toBeAnInstanceOf(expected: any): boolean;
|
||||
|
||||
toHaveText(expected: any): boolean;
|
||||
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
|
||||
toImplement(expected: any): boolean;
|
||||
|
||||
toContainError(expected: any): boolean;
|
||||
|
||||
toThrowErrorWith(expectedMessage: any): boolean;
|
||||
|
||||
not: NgMatchers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var expect: (actual: any) => NgMatchers;
|
||||
|
||||
|
||||
|
||||
class AsyncTestCompleter {
|
||||
|
||||
constructor(_done: Function);
|
||||
|
||||
done(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function describe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function ddescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function xdescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
* The given function must return a list of DI bindings.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* beforeEachBindings(() => [
|
||||
* bind(Compiler).toClass(MockCompiler),
|
||||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
function beforeEachBindings(fn: any): void;
|
||||
|
||||
|
||||
|
||||
function it(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function xit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function iit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
interface GuinessCompatibleSpy extends jasmine.Spy {
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.returnValue, all calls to the function will return a specific
|
||||
* value.
|
||||
*/
|
||||
andReturn(val: any): void;
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied
|
||||
* function.
|
||||
*/
|
||||
andCallFake(fn: Function): GuinessCompatibleSpy;
|
||||
|
||||
/**
|
||||
* removes all recorded calls
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SpyObject {
|
||||
|
||||
constructor(type?: any);
|
||||
|
||||
static stub(object?: any, config?: any, overrides?: any): void;
|
||||
|
||||
noSuchMethod(args: any): void;
|
||||
|
||||
spy(name: any): void;
|
||||
|
||||
prop(name: any, value: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isInInnerZone(): boolean;
|
||||
|
||||
|
||||
|
||||
interface RootTestComponent {
|
||||
|
||||
debugElement: ng.DebugElement;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a RootTestComponent for use in component level tests.
|
||||
*/
|
||||
class TestComponentBuilder {
|
||||
|
||||
constructor(_injector: ng.Injector);
|
||||
|
||||
/**
|
||||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ng.ViewMetadata} are preserved.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {string} html
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideTemplate(componentType: ng.Type, template: string): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides a component's {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {view} View
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideView(componentType: ng.Type, view: ng.ViewMetadata): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides the directives from the component {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {ng.Type} from
|
||||
* @param {ng.Type} to
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideDirective(componentType: ng.Type, from: ng.Type, to: ng.Type): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideViewBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Builds and returns a RootTestComponent.
|
||||
*
|
||||
* @return {Promise<RootTestComponent>}
|
||||
*/
|
||||
createAsync(rootComponentType: ng.Type): Promise<RootTestComponent>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createTestInjector(bindings: Array<ng.Type | ng.Binding | any[]>): ng.Injector;
|
||||
|
||||
|
||||
|
||||
class FunctionWithParamTokens {
|
||||
|
||||
constructor(_tokens: any[], _fn: Function);
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: ng.Injector): any;
|
||||
|
||||
hasToken(token: any): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception will be thrown.
|
||||
*
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
function fakeAsync(fn: Function): Function;
|
||||
|
||||
|
||||
|
||||
function clearPendingTimers(): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer callback
|
||||
* has been executed.
|
||||
*
|
||||
* @param {number} millis Number of millisecond, defaults to 0
|
||||
*/
|
||||
function tick(millis?: number): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
function flushMicrotasks(): void;
|
||||
|
||||
|
||||
|
||||
class Log {
|
||||
|
||||
constructor();
|
||||
|
||||
add(value: any): void;
|
||||
|
||||
fn(value: any): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
result(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class BrowserDetection {
|
||||
|
||||
constructor(ua: string);
|
||||
|
||||
isFirefox: boolean;
|
||||
|
||||
isAndroid: boolean;
|
||||
|
||||
isEdge: boolean;
|
||||
|
||||
isIE: boolean;
|
||||
|
||||
isWebkit: boolean;
|
||||
|
||||
isIOS7: boolean;
|
||||
|
||||
isSlow: boolean;
|
||||
|
||||
supportsIntlApi: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var browserDetection: BrowserDetection;
|
||||
|
||||
|
||||
|
||||
function dispatchEvent(element: any, eventType: any): void;
|
||||
|
||||
|
||||
|
||||
function el(html: string): HTMLElement;
|
||||
|
||||
|
||||
|
||||
function containsRegexp(input: string): RegExp;
|
||||
|
||||
|
||||
|
||||
function normalizeCSS(css: string): string;
|
||||
|
||||
|
||||
|
||||
function stringifyElement(el: any): string;
|
||||
|
||||
|
||||
|
||||
var RootTestComponent: ng.InjectableReference;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/test_lib" {
|
||||
export = ngTestLib;
|
||||
}
|
||||
|
||||
|
||||
+135
-16
@@ -296,6 +296,17 @@ module TestQ {
|
||||
result = $q.reject('');
|
||||
}
|
||||
|
||||
// $q.resolve
|
||||
{
|
||||
let result: angular.IPromise<void>;
|
||||
result = $q.resolve();
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.resolve<TResult>(tResult);
|
||||
result = $q.resolve<TResult>(promiseTResult);
|
||||
}
|
||||
|
||||
// $q.when
|
||||
{
|
||||
let result: angular.IPromise<void>;
|
||||
@@ -387,35 +398,47 @@ module TestPromise {
|
||||
|
||||
var tresult: TResult;
|
||||
var tresultPromise: ng.IPromise<TResult>;
|
||||
|
||||
var tresultHttpPromise: ng.IHttpPromise<TResult>;
|
||||
|
||||
var tother: TOther;
|
||||
var totherPromise: ng.IPromise<TOther>;
|
||||
|
||||
var totherHttpPromise: ng.IHttpPromise<TOther>;
|
||||
|
||||
var promise: angular.IPromise<TResult>;
|
||||
|
||||
// promise.then
|
||||
result = <angular.IPromise<any>>promise.then((result) => any);
|
||||
result = <angular.IPromise<any>>promise.then((result) => any, (any) => any);
|
||||
result = <angular.IPromise<any>>promise.then((result) => any, (any) => any, (any) => any);
|
||||
|
||||
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result, (any) => any);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result, (any) => any, (any) => any);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => tresultPromise);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => tresultPromise, (any) => any);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => tresultPromise, (any) => any, (any) => any);
|
||||
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise, (any) => any);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise, (any) => any, (any) => any);
|
||||
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother, (any) => any);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother, (any) => any, (any) => any);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => totherPromise);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => totherPromise, (any) => any);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => totherPromise, (any) => any, (any) => any);
|
||||
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise, (any) => any);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise, (any) => any, (any) => any);
|
||||
|
||||
// promise.catch
|
||||
result = <angular.IPromise<any>>promise.catch((err) => any);
|
||||
result = <angular.IPromise<TResult>>promise.catch((err) => tresult);
|
||||
result = <angular.IPromise<TResult>>promise.catch((err) => tresultPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.catch((err) => tresultHttpPromise);
|
||||
result = <angular.IPromise<TOther>>promise.catch((err) => tother);
|
||||
result = <angular.IPromise<TOther>>promise.catch((err) => totherPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.catch((err) => totherHttpPromise);
|
||||
|
||||
// promise.finally
|
||||
result = <angular.IPromise<TResult>>promise.finally(() => any);
|
||||
@@ -484,7 +507,7 @@ function test_IAttributes(attributes: ng.IAttributes){
|
||||
}
|
||||
|
||||
test_IAttributes({
|
||||
$normalize: function (classVal){},
|
||||
$normalize: function (classVal){ return "foo" },
|
||||
$addClass: function (classVal){},
|
||||
$removeClass: function(classVal){},
|
||||
$set: function(key, value){},
|
||||
@@ -934,18 +957,114 @@ function NgModelControllerTyping() {
|
||||
};
|
||||
}
|
||||
|
||||
function ngFilterTyping() {
|
||||
var $filter: angular.IFilterService;
|
||||
var $filter: angular.IFilterService;
|
||||
|
||||
function testFilter() {
|
||||
|
||||
var items: string[];
|
||||
|
||||
$filter("name")(items, "test");
|
||||
$filter("name")(items, {name: "test"});
|
||||
$filter("name")(items, (val, index, array) => {
|
||||
return array;
|
||||
$filter("filter")(items, "test");
|
||||
$filter("filter")(items, {name: "test"});
|
||||
$filter("filter")(items, (val, index, array) => {
|
||||
return true;
|
||||
});
|
||||
$filter("name")(items, (val, index, array) => {
|
||||
return array;
|
||||
$filter("filter")(items, (val, index, array) => {
|
||||
return true;
|
||||
}, (actual, expected) => {
|
||||
return actual == expected;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function testCurrency() {
|
||||
$filter("currency")(126);
|
||||
$filter("currency")(126, "$", 2);
|
||||
}
|
||||
|
||||
function testNumber() {
|
||||
$filter("number")(167);
|
||||
$filter("number")(167, 2);
|
||||
}
|
||||
|
||||
function testDate() {
|
||||
$filter("date")(new Date());
|
||||
$filter("date")(new Date(), 'yyyyMMdd');
|
||||
$filter("date")(new Date(), 'yyyyMMdd', '+0430');
|
||||
}
|
||||
|
||||
function testJson() {
|
||||
var json: string = $filter("json")({test:true}, 2);
|
||||
}
|
||||
|
||||
function testLowercase() {
|
||||
var lower: string = $filter("lowercase")('test');
|
||||
}
|
||||
|
||||
function testUppercase() {
|
||||
var lower: string = $filter("uppercase")('test');
|
||||
}
|
||||
|
||||
function testLimitTo() {
|
||||
var limitTo = $filter("limitTo");
|
||||
var filtered: number[] = $filter("limitTo")([1,2,3], 5);
|
||||
filtered = $filter("limitTo")([1,2,3], 5, 2);
|
||||
|
||||
var filteredString: string = $filter("limitTo")("124", 4);
|
||||
filteredString = $filter("limitTo")(124, 4);
|
||||
}
|
||||
|
||||
function testOrderBy() {
|
||||
var filtered: number[] = $filter("orderBy")([1,2,3], "test");
|
||||
filtered = $filter("orderBy")([1,2,3], "test", true);
|
||||
filtered = $filter("orderBy")([1,2,3], ['prop1', 'prop2']);
|
||||
filtered = $filter("orderBy")([1,2,3], (val: number) => 1);
|
||||
var filtered2: string[] = $filter("orderBy")(["1","2","3"], (val: string) => 1);
|
||||
filtered2 = $filter("orderBy")(["1","2","3"], [
|
||||
(val: string) => 1,
|
||||
(val: string) => 2
|
||||
]);
|
||||
}
|
||||
|
||||
function testDynamicFilter() {
|
||||
// Test with separate variables
|
||||
var dateFilter = $filter("date");
|
||||
var myDate = new Date();
|
||||
dateFilter(myDate , "EEE, MMM d");
|
||||
|
||||
// Test with dynamic name
|
||||
var filterName = 'date';
|
||||
var dynDateFilter = $filter<ng.IFilterDate>(filterName);
|
||||
dynDateFilter(new Date());
|
||||
}
|
||||
|
||||
interface MyCustomFilter {
|
||||
(value: string): string;
|
||||
}
|
||||
|
||||
function testCustomFilter() {
|
||||
var filterCustom = $filter<MyCustomFilter>('custom');
|
||||
var filtered: string = filterCustom("test");
|
||||
}
|
||||
|
||||
function parseTyping() {
|
||||
var $parse: angular.IParseService;
|
||||
var compiledExp = $parse('a.b.c');
|
||||
if (compiledExp.constant) {
|
||||
return compiledExp({});
|
||||
} else if (compiledExp.literal) {
|
||||
return compiledExp({}, {a: {b: {c: 42}}});
|
||||
}
|
||||
}
|
||||
|
||||
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
|
||||
if (mode === 'debug') {
|
||||
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
|
||||
$provide.decorator('$rootScope', function($delegate: ng.IRootScopeService) {
|
||||
$delegate['debug'] = true;
|
||||
});
|
||||
}, 'debug-helpers'], {
|
||||
debugInfoEnabled: true
|
||||
});
|
||||
}
|
||||
return angular.bootstrap(element, ['main'], {
|
||||
debugInfoEnabled: false
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+127
-141
@@ -41,6 +41,7 @@ declare module angular {
|
||||
|
||||
interface IAngularBootstrapConfig {
|
||||
strictDi?: boolean;
|
||||
debugInfoEnabled?: boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -56,132 +57,11 @@ declare module angular {
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* function that will be invoked by the injector as a config block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
* @param element DOM element which is the root of angular application.
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
|
||||
/**
|
||||
* Creates a deep copy of source, which should be an object or an array.
|
||||
@@ -426,7 +306,7 @@ declare module angular {
|
||||
*
|
||||
* For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives
|
||||
*/
|
||||
$normalize(name: string): void;
|
||||
$normalize(name: string): string;
|
||||
|
||||
/**
|
||||
* Adds the CSS class value specified by the classVal parameter to the
|
||||
@@ -674,7 +554,7 @@ declare module angular {
|
||||
*/
|
||||
$odd: boolean;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface IAngularEvent {
|
||||
/**
|
||||
@@ -776,31 +656,127 @@ declare module angular {
|
||||
* see https://docs.angularjs.org/api/ng/service/$filter
|
||||
*/
|
||||
interface IFilterService {
|
||||
(name: 'filter'): IFilterFilter;
|
||||
(name: 'currency'): IFilterCurrency;
|
||||
(name: 'number'): IFilterNumber;
|
||||
(name: 'date'): IFilterDate;
|
||||
(name: 'json'): IFilterJson;
|
||||
(name: 'lowercase'): IFilterLowercase;
|
||||
(name: 'uppercase'): IFilterUppercase;
|
||||
(name: 'limitTo'): IFilterLimitTo;
|
||||
(name: 'orderBy'): IFilterOrderBy;
|
||||
/**
|
||||
* Usage:
|
||||
* $filter(name);
|
||||
*
|
||||
* @param name Name of the filter function to retrieve
|
||||
*/
|
||||
(name: string): IFilterFunc;
|
||||
<T>(name: string): T;
|
||||
}
|
||||
|
||||
interface IFilterFunc {
|
||||
<T>(array: T[], expression: string | IFilterPatternObject | IFilterPredicateFunc<T>, comparator?: IFilterComparatorFunc<T>|boolean): T[];
|
||||
|
||||
interface IFilterFilter {
|
||||
<T>(array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc<T>, comparator?: IFilterFilterComparatorFunc<T>|boolean): T[];
|
||||
}
|
||||
|
||||
interface IFilterPatternObject {
|
||||
[name: string]: string;
|
||||
|
||||
interface IFilterFilterPatternObject {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
interface IFilterPredicateFunc<T> {
|
||||
(value: T, index: number, array: T[]): T[];
|
||||
|
||||
interface IFilterFilterPredicateFunc<T> {
|
||||
(value: T, index: number, array: T[]): boolean;
|
||||
}
|
||||
|
||||
interface IFilterComparatorFunc<T> {
|
||||
|
||||
interface IFilterFilterComparatorFunc<T> {
|
||||
(actual: T, expected: T): boolean;
|
||||
}
|
||||
|
||||
interface IFilterCurrency {
|
||||
/**
|
||||
* Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used.
|
||||
* @param amount Input to filter.
|
||||
* @param symbol Currency symbol or identifier to be displayed.
|
||||
* @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
|
||||
* @return Formatted number
|
||||
*/
|
||||
(amount: number, symbol?: string, fractionSize?: number): string;
|
||||
}
|
||||
|
||||
interface IFilterNumber {
|
||||
/**
|
||||
* Formats a number as text.
|
||||
* @param number Number to format.
|
||||
* @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3.
|
||||
* @return Number rounded to decimalPlaces and places a “,” after each third digit.
|
||||
*/
|
||||
(value: number|string, fractionSize?: number|string): string;
|
||||
}
|
||||
|
||||
interface IFilterDate {
|
||||
/**
|
||||
* Formats date to a string based on the requested format.
|
||||
*
|
||||
* @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone.
|
||||
* @param format Formatting rules (see Description). If not specified, mediumDate is used.
|
||||
* @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used.
|
||||
* @return Formatted string or the input if input is not recognized as date/millis.
|
||||
*/
|
||||
(date: Date | number | string, format?: string, timezone?: string): string;
|
||||
}
|
||||
|
||||
interface IFilterJson {
|
||||
/**
|
||||
* Allows you to convert a JavaScript object into JSON string.
|
||||
* @param object Any JavaScript object (including arrays and primitive types) to filter.
|
||||
* @param spacing The number of spaces to use per indentation, defaults to 2.
|
||||
* @return JSON string.
|
||||
*/
|
||||
(object: any, spacing?: number): string;
|
||||
}
|
||||
|
||||
interface IFilterLowercase {
|
||||
/**
|
||||
* Converts string to lowercase.
|
||||
*/
|
||||
(value: string): string;
|
||||
}
|
||||
|
||||
interface IFilterUppercase {
|
||||
/**
|
||||
* Converts string to uppercase.
|
||||
*/
|
||||
(value: string): string;
|
||||
}
|
||||
|
||||
interface IFilterLimitTo {
|
||||
/**
|
||||
* Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit.
|
||||
* @param input Source array to be limited.
|
||||
* @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged.
|
||||
* @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0.
|
||||
* @return A new sub-array of length limit or less if input array had less than limit elements.
|
||||
*/
|
||||
<T>(input: T[], limit: string|number, begin?: string|number): T[];
|
||||
/**
|
||||
* Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string.
|
||||
* @param input Source string or number to be limited.
|
||||
* @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged.
|
||||
* @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0.
|
||||
* @return A new substring of length limit or less if input had less than limit elements.
|
||||
*/
|
||||
(input: string|number, limit: string|number, begin?: string|number): string;
|
||||
}
|
||||
|
||||
interface IFilterOrderBy {
|
||||
/**
|
||||
* Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings.
|
||||
* @param array The array to sort.
|
||||
* @param expression A predicate to be used by the comparator to determine the order of elements.
|
||||
* @param reverse Reverse the order of the array.
|
||||
* @return Reverse the order of the array.
|
||||
*/
|
||||
<T>(array: T[], expression: string|string[]|((value: T) => any)|((value: T) => any)[], reverse?: boolean): T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* $filterProvider - $filter - provider in module ng
|
||||
*
|
||||
@@ -910,6 +886,9 @@ declare module angular {
|
||||
interface ICompiledExpression {
|
||||
(context: any, locals?: any): any;
|
||||
|
||||
literal: boolean;
|
||||
constant: boolean;
|
||||
|
||||
// If value is not provided, undefined is gonna be used since the implementation
|
||||
// does not check the parameter. Let's force a value for consistency. If consumer
|
||||
// whants to undefine it, pass the undefined value explicitly.
|
||||
@@ -1052,12 +1031,20 @@ declare module angular {
|
||||
*
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
resolve<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*/
|
||||
resolve(): IPromise<void>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*/
|
||||
when(): IPromise<void>;
|
||||
}
|
||||
|
||||
@@ -1067,12 +1054,12 @@ declare module angular {
|
||||
* The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned
|
||||
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
|
||||
*/
|
||||
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>|IPromise<TResult>|TResult|IPromise<void>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
|
||||
/**
|
||||
* Shorthand for promise.then(null, errorCallback)
|
||||
*/
|
||||
catch<TResult>(onRejected: (reason: any) => IHttpPromise<TResult>|IPromise<TResult>|TResult): IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>;
|
||||
|
||||
/**
|
||||
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
|
||||
@@ -1400,7 +1387,6 @@ declare module angular {
|
||||
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
|
||||
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
|
||||
error(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
|
||||
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>|TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
|
||||
}
|
||||
|
||||
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
||||
|
||||
@@ -16,3 +16,13 @@ axios<Repository>({
|
||||
method: HttpMethod[HttpMethod.GET],
|
||||
headers: {},
|
||||
}).then(r => console.log("ID:" + r.data.id + " Name: " + r.data.name));
|
||||
|
||||
axios.post("http://example.com/", {}, {
|
||||
transformRequest: (data: any) => data
|
||||
});
|
||||
|
||||
axios.post("http://example.com/", {}, {
|
||||
transformRequest: [
|
||||
(data: any) => data
|
||||
]
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ declare module Axios {
|
||||
* This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
|
||||
* The last function in the array must return a string or an ArrayBuffer
|
||||
*/
|
||||
transformRequest?: <U>(data:T) => U;
|
||||
transformRequest?: (<U>(data:T) => U)|[<U>(data:T) => U];
|
||||
|
||||
/**
|
||||
* change the response data to be made before it is passed to then/catch
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="basic-auth.d.ts" />
|
||||
|
||||
import auth = require('basic-auth');
|
||||
|
||||
auth(null);
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for basic-auth
|
||||
// Project: https://github.com/jshttp/basic-auth
|
||||
// Definitions by: Clément Bourgeois <https://github.com/moonpyk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module BasicAuth {
|
||||
export interface BasicAuthResult {
|
||||
name:string;
|
||||
pass:string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "basic-auth" {
|
||||
function auth(req: Express.Request): BasicAuth.BasicAuthResult;
|
||||
|
||||
export = auth;
|
||||
}
|
||||
@@ -48,6 +48,10 @@ declare module BootstrapV3DatetimePicker {
|
||||
direction?: string;
|
||||
sideBySide?: boolean;
|
||||
daysOfWeekDisabled?: Array<any>;
|
||||
calendarWeeks?: boolean;
|
||||
format?: string | boolean;
|
||||
locale?: string;
|
||||
showTodayButton?: boolean;
|
||||
}
|
||||
|
||||
interface Datetimepicker {
|
||||
@@ -97,4 +101,4 @@ interface JQuery {
|
||||
on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery;
|
||||
|
||||
data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -857,7 +857,7 @@ declare module breeze {
|
||||
tag: Object;
|
||||
static defaultInstance: SaveOptions;
|
||||
|
||||
constructor(config?: { allowConcurrentSaves?: boolean; });
|
||||
constructor(config?: { allowConcurrentSaves?: boolean; resourceName?: string; dataService?: DataService; tag?: any});
|
||||
|
||||
setAsDefault(): SaveOptions;
|
||||
using(config: SaveOptionsConfiguration): SaveOptions;
|
||||
|
||||
Vendored
+1
-1
@@ -182,7 +182,7 @@ declare module Chartist {
|
||||
labelOffset?: {
|
||||
x?: number;
|
||||
y?: number;
|
||||
},
|
||||
};
|
||||
showLabel?: boolean;
|
||||
showGrid?: boolean;
|
||||
labelInterpolationFnc?: Function;
|
||||
|
||||
Vendored
+8
@@ -228,6 +228,14 @@ declare module CodeMirror {
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { line, ch } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { line: number, ch: number }, margin?: number): void;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { from, to } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { from: CodeMirror.Position, to: CodeMirror.Position }, margin: number): void;
|
||||
|
||||
/** Returns an { left , top , bottom } object containing the coordinates of the cursor position.
|
||||
If mode is "local" , they will be relative to the top-left corner of the editable document.
|
||||
If it is "page" or not given, they are relative to the top-left corner of the page.
|
||||
|
||||
Vendored
+31
-9
@@ -5,15 +5,6 @@
|
||||
|
||||
declare module CometD {
|
||||
|
||||
var onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
|
||||
|
||||
function init(options: ConfigurationOptions): void;
|
||||
|
||||
function addListener(channel: string, listener: (message: any) => void): void;
|
||||
function removeListener(listener: (message: any) => void): void;
|
||||
|
||||
function publish(channel: string, message: any): void;
|
||||
|
||||
interface ConfigurationOptions {
|
||||
url: string;
|
||||
logLevel?: string;
|
||||
@@ -26,4 +17,35 @@ declare module CometD {
|
||||
appendMessageTypeToURL?: boolean;
|
||||
autoBatch?: boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface CometD {
|
||||
|
||||
onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
|
||||
|
||||
init(options: CometD.ConfigurationOptions): void;
|
||||
|
||||
configure(config: CometD.ConfigurationOptions): void;
|
||||
|
||||
addListener(channel: string, listener: (message: any) => void): void;
|
||||
removeListener(listener: (message: any) => void): void;
|
||||
|
||||
clearListeners(): void;
|
||||
|
||||
clearSubscriptions(): void;
|
||||
|
||||
handshake(handshake_params: any): void;
|
||||
|
||||
publish(channel: string, message: any): void;
|
||||
|
||||
|
||||
disconnect(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface JQueryStatic {
|
||||
cometd: CometD;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="connect-mongo.d.ts" />
|
||||
|
||||
import * as express from 'express';
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as session from 'express-session';
|
||||
import * as connectMongo from 'connect-mongo';
|
||||
import * as mongodb from 'mongodb';
|
||||
|
||||
var app = express();
|
||||
|
||||
/// Create MongoStore
|
||||
var MongoStore = connectMongo(session);
|
||||
|
||||
/// Use MongoStore
|
||||
|
||||
// MongoUrlOptions
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({url: 'mongodb://localhost/test'})
|
||||
}));
|
||||
|
||||
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({
|
||||
url: 'mongodb://localhost/test',
|
||||
collection: "test-sessions",
|
||||
ttl: 30 * 24 * 60 * 60 // = 30 days
|
||||
})
|
||||
}));
|
||||
|
||||
// MongooseConnectionOptions
|
||||
mongoose.connect('mongodb://localhost/test')
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({mongooseConnection: mongoose.connection})
|
||||
}));
|
||||
|
||||
// NativeMongoOptions
|
||||
var Db = mongodb.Db
|
||||
var Server = mongodb.Server
|
||||
var mongoDb = new Db('test', new Server('localhost', 27017));
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({db: mongoDb})
|
||||
}));
|
||||
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
// Type definitions for connect-mongo
|
||||
// Project: https://github.com/kcbanner/connect-mongo
|
||||
// Definitions by: Mizuki Yamamoto <https://github.com/Syati>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="../mongodb/mongodb.d.ts" />
|
||||
/// <reference path="../express-session/express-session.d.ts" />
|
||||
|
||||
declare module "connect-mongo" {
|
||||
import * as express from 'express';
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongodb from 'mongodb';
|
||||
import * as session from 'express-session';
|
||||
|
||||
function connectMongo(connect: (options?: session.SessionOptions) => express.RequestHandler): connectMongo.MongoStoreFactory;
|
||||
|
||||
module connectMongo {
|
||||
|
||||
export interface DefaultOptions{
|
||||
/**
|
||||
* The hostname of the database you are connecting to.
|
||||
* (Default: '127.0.0.1')
|
||||
*/
|
||||
host?: string;
|
||||
|
||||
/**
|
||||
* The port number to connect to.
|
||||
* (Default: 27017)
|
||||
*/
|
||||
port?: string;
|
||||
|
||||
/**
|
||||
* (Default: false)
|
||||
*/
|
||||
autoReconnect?: boolean;
|
||||
|
||||
/**
|
||||
* (Default: true)
|
||||
*/
|
||||
ssl?: boolean;
|
||||
|
||||
/**
|
||||
* (Default: 1)
|
||||
*/
|
||||
w?: number;
|
||||
|
||||
/**
|
||||
* The colletion of the database you are connecting to.
|
||||
* (Default: sessions)
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Serialize sessions using JSON.stringify and deserialize them with JSON.parse.
|
||||
* (Default: true)
|
||||
*/
|
||||
stringify?: boolean;
|
||||
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
hash?: boolean;
|
||||
|
||||
/**
|
||||
* Default: 14 days (60 * 60 * 24 * 14)
|
||||
*/
|
||||
ttl?: number;
|
||||
|
||||
/**
|
||||
* Automatically remove expired sessions.
|
||||
* (Default: 'native')
|
||||
*/
|
||||
autoRemove?: string;
|
||||
|
||||
/**
|
||||
* (Default: 10)
|
||||
*/
|
||||
autoRemoveInterval?: number;
|
||||
}
|
||||
|
||||
export interface MongoUrlOptions extends DefaultOptions {
|
||||
url: string;
|
||||
mongoOptions?: mongoose.ConnectionOptions;
|
||||
}
|
||||
|
||||
export interface MogooseConnectionOptions extends DefaultOptions {
|
||||
mongooseConnection: mongoose.Connection;
|
||||
}
|
||||
|
||||
export interface NaitiveMongoOptions extends DefaultOptions {
|
||||
db: mongodb.Db;
|
||||
}
|
||||
|
||||
export interface MongoStoreFactory {
|
||||
new (options: MongoUrlOptions): MongoStore;
|
||||
new (options: MogooseConnectionOptions): MongoStore;
|
||||
new (options: NaitiveMongoOptions): MongoStore;
|
||||
}
|
||||
|
||||
export class MongoStore implements session.Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback: (err: any) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback: (err: any) => void) => void;
|
||||
touch: (sid: string, session: Express.Session, callback:(err: any) => void) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = connectMongo;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/// <reference path="cordova-plugin-ouralabs.d.ts" />
|
||||
|
||||
var traceLevel: number = OuralabsPlugin.LogLevel.TRACE;
|
||||
var debugLevel: number = OuralabsPlugin.LogLevel.DEBUG;
|
||||
var infoLevel: number = OuralabsPlugin.LogLevel.INFO;
|
||||
var warnLevel: number = OuralabsPlugin.LogLevel.WARN;
|
||||
var errorLevel: number = OuralabsPlugin.LogLevel.ERROR;
|
||||
var fatalLevel: number = OuralabsPlugin.LogLevel.FATAL;
|
||||
|
||||
OuralabsPlugin.init("a");
|
||||
OuralabsPlugin.init("a", () => {});
|
||||
OuralabsPlugin.init("a", () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.setAttributes("a");
|
||||
OuralabsPlugin.setAttributes("a", "b");
|
||||
OuralabsPlugin.setAttributes("a", "b", "c");
|
||||
OuralabsPlugin.setAttributes("a", null, "c");
|
||||
OuralabsPlugin.setAttributes("a", "b", "c");
|
||||
OuralabsPlugin.setAttributes("a", "b", "c", () => {});
|
||||
OuralabsPlugin.setAttributes("a", "b", "c", () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.setLogToBrowserConsole(true);
|
||||
|
||||
OuralabsPlugin.setHookBrowserConsole(true);
|
||||
|
||||
OuralabsPlugin.logTrace("a", "b");
|
||||
OuralabsPlugin.logTrace("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logTrace("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logTrace("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logTrace("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.logDebug("a", "b");
|
||||
OuralabsPlugin.logDebug("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logDebug("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logDebug("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logDebug("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.logInfo("a", "b");
|
||||
OuralabsPlugin.logInfo("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logInfo("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logInfo("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logInfo("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.logWarn("a", "b");
|
||||
OuralabsPlugin.logWarn("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logWarn("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logWarn("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logWarn("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.logError("a", "b");
|
||||
OuralabsPlugin.logError("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logError("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logError("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logError("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.logFatal("a", "b");
|
||||
OuralabsPlugin.logFatal("a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.logFatal("a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.logFatal("a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.logFatal("a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.TRACE, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.TRACE, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.TRACE, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.TRACE, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.TRACE, "a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.DEBUG, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.DEBUG, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.DEBUG, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.DEBUG, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.DEBUG, "a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.INFO, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.INFO, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.INFO, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.INFO, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.INFO, "a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.WARN, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.WARN, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.WARN, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.WARN, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.WARN, "a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.ERROR, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.ERROR, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.ERROR, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.ERROR, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.ERROR, "a", "b", null, () => {}, (error: string) => {});
|
||||
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.FATAL, "a", "b");
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.FATAL, "a", "b", { "whoa": "yep" });
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.FATAL, "a", "b", { "whoa": "yep" }, () => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.FATAL, "a", "b", { "whoa": "yep" }, () => {}, (error: string) => {});
|
||||
OuralabsPlugin.log(OuralabsPlugin.LogLevel.FATAL, "a", "b", null, () => {}, (error: string) => {});
|
||||
@@ -0,0 +1,139 @@
|
||||
// Type definitions for cordova-plugin-ouralabs 1.1.0
|
||||
// Project: https://github.com/Justin-Credible/cordova-plugin-ouralabs
|
||||
// Definitions by: Justin Unterreiner <https://github.com/Justin-Credible>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module OuralabsPlugin {
|
||||
|
||||
interface OuralabsStatic {
|
||||
|
||||
/**
|
||||
* Log levels designate the severity of the log; used with the log() function.
|
||||
* Log levels are ordered from least severe to most severe.
|
||||
*/
|
||||
LogLevel: {
|
||||
TRACE: number,
|
||||
DEBUG: number,
|
||||
INFO: number,
|
||||
WARN: number,
|
||||
ERROR: number,
|
||||
FATAL: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the Ourlabs plugin with the given channel ID string value.
|
||||
* You can obtain your channel ID from the Ouralabs dashboard.
|
||||
*
|
||||
* @param channelId The ID of the channel that logs will be written to.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
init(channelId: string, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Used to ensure values logged via the plugin are also displayed in the browser's console.
|
||||
*
|
||||
* @param enable True to enable logs to show up in the browser's console, false to disable.
|
||||
*/
|
||||
setLogToBrowserConsole(enable: boolean): void;
|
||||
|
||||
/**
|
||||
* Used to enable hooking of the browser's console logging functions (eg console.log,
|
||||
* console.error, etc) to ensure that these logs get logged via Ouralabs.
|
||||
*
|
||||
* @param enable True to enable hooking of the console log functions, false to disable.
|
||||
*/
|
||||
setHookBrowserConsole(enable: boolean): void;
|
||||
|
||||
/**
|
||||
* Allows setting of the three arbitrary attribute values that are stored with the device information.
|
||||
*
|
||||
* @param [string] attribute1 - The (optional) attribute value to set for the first attribute.
|
||||
* @param [string] attribute2 - The (optional) attribute value to set for the first attribute.
|
||||
* @param [string] attribute3 - The (optional) attribute value to set for the first attribute.
|
||||
* @param [function] successCallback - The success callback for this asynchronous function.
|
||||
* @param [function] failureCallback - The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
setAttributes(attribute1?: string, attribute2?: string, attribute3?: string, successCallback?: () => void, errorCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level TRACE with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logTrace(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level DEBUG with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logDebug(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level INFO with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logInfo(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level WARN with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logWarn(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level ERROR with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logError(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a log message of level FATAL with the given information.
|
||||
*
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
logFatal(tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
|
||||
/**
|
||||
* Logs a message with the given information.
|
||||
*
|
||||
* @param logLevel The level of the log; see OuralabsPlugin.LogLevels for possible values.
|
||||
* @param tag The tag for the log entry.
|
||||
* @param message The body of the log message.
|
||||
* @param metadata An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.
|
||||
* @param successCallback The success callback for this asynchronous function.
|
||||
* @param failureCallback The failure callback for this asynchronous function; receives an error string.
|
||||
*/
|
||||
log(logLevel: number, tag: string, message: string, metadata?: any, successCallback?: () => void, failureCallback?: (error: string) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var OuralabsPlugin: OuralabsPlugin.OuralabsStatic;
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="express-route-fs.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import routeFs = require('express-route-fs');
|
||||
|
||||
var app = express();
|
||||
|
||||
routeFs(app);
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for express-route-fs v0.1.0
|
||||
// Project: https://github.com/kripod/express-route-fs
|
||||
// Definitions by: Kristóf Poduszló <https://github.com/kripod>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "express-route-fs" {
|
||||
/**
|
||||
Sets up file system-based routing in Express.
|
||||
@param {Object} app Express application object.
|
||||
@param {Object[]} [options] Options for setting up routes.
|
||||
*/
|
||||
function routeFs(app: any, options?: any): void;
|
||||
export = routeFs;
|
||||
}
|
||||
Vendored
+8
-8
@@ -65,23 +65,23 @@ interface FirebaseDataSnapshot {
|
||||
|
||||
interface FirebaseOnDisconnect {
|
||||
/**
|
||||
* Ensures the data at this location is set to the specified value when the client is disconnected
|
||||
* Ensures the data at this location is set to the specified value when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
set(value: any, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Ensures the data at this location is set to the specified value and priority when the client is disconnected
|
||||
* Ensures the data at this location is set to the specified value and priority when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void;
|
||||
setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Writes the enumerated children at this Firebase location when the client is disconnected
|
||||
* Writes the enumerated children at this Firebase location when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
update(value: Object, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Ensures the data at this location is deleted when the client is disconnected
|
||||
* Ensures the data at this location is deleted when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
remove(onComplete?: (error: any) => void): void;
|
||||
@@ -127,13 +127,13 @@ interface FirebaseQuery {
|
||||
*/
|
||||
limit(limit: number): FirebaseQuery;
|
||||
/**
|
||||
* Creates a Query with the specified starting point.
|
||||
* Creates a Query with the specified starting point.
|
||||
* The generated Query includes children which match the specified starting point.
|
||||
*/
|
||||
startAt(value: string, key?: string): FirebaseQuery;
|
||||
startAt(value: number, key?: string): FirebaseQuery;
|
||||
/**
|
||||
* Creates a Query with the specified ending point.
|
||||
* Creates a Query with the specified ending point.
|
||||
* The generated Query includes children which match the specified ending point.
|
||||
*/
|
||||
endAt(value: string, key?: string): FirebaseQuery;
|
||||
@@ -263,7 +263,7 @@ interface Firebase extends FirebaseQuery {
|
||||
/**
|
||||
* Creates a new user account using an email / password combination.
|
||||
*/
|
||||
createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
|
||||
createUser(credentials: FirebaseCredentials, onComplete: (error: any, userData: any) => void): void;
|
||||
/**
|
||||
* Updates the email associated with an email / password user account.
|
||||
*/
|
||||
@@ -298,7 +298,7 @@ interface FirebaseStatic {
|
||||
|
||||
ServerValue: {
|
||||
/**
|
||||
* A placeholder value for auto-populating the current timestamp
|
||||
* A placeholder value for auto-populating the current timestamp
|
||||
* (time since the Unix epoch, in milliseconds) by the Firebase servers.
|
||||
*/
|
||||
TIMESTAMP: any;
|
||||
|
||||
Vendored
+2
-2
@@ -30,7 +30,7 @@ interface HighstockNavigatorOptions {
|
||||
|
||||
interface RangeSelectorButton {
|
||||
type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
|
||||
count: number;
|
||||
count?: number;
|
||||
text: string;
|
||||
dataGrouping?: any; //not sure how this works
|
||||
}
|
||||
@@ -117,4 +117,4 @@ interface JQuery {
|
||||
highcharts(type: string): HighchartsChartObject;
|
||||
highcharts(type: string, options: HighchartsOptions): JQuery;
|
||||
highcharts(type: string, options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/// <reference path="hystrixjs.d.ts" />
|
||||
/// <reference path="../q/Q.d.ts"/>
|
||||
|
||||
import hystrixjs = require('hystrixjs');
|
||||
import q = require('q');
|
||||
|
||||
var commandFactory = hystrixjs.commandFactory;
|
||||
|
||||
var command = commandFactory
|
||||
.getOrCreate('testCommand', 'testGroup')
|
||||
.circuitBreakerSleepWindowInMilliseconds(5000)
|
||||
.errorHandler((error) => {
|
||||
return false;
|
||||
})
|
||||
.timeout(3000)
|
||||
.circuitBreakerRequestVolumeThreshold(10)
|
||||
.requestVolumeRejectionThreshold(10)
|
||||
.circuitBreakerForceOpened(true)
|
||||
.circuitBreakerForceClosed(false)
|
||||
.statisticalWindowNumberOfBuckets(10)
|
||||
.statisticalWindowLength(10)
|
||||
.percentileWindowNumberOfBuckets(10)
|
||||
.percentileWindowLength(60)
|
||||
.circuitBreakerErrorThresholdPercentage(30)
|
||||
.fallbackTo((error) => {
|
||||
return q.resolve('fallback');
|
||||
})
|
||||
.run((args) => {
|
||||
return q.resolve(args);
|
||||
})
|
||||
.build();
|
||||
|
||||
command.execute('something').then((result) => {
|
||||
console.log(result);
|
||||
})
|
||||
|
||||
commandFactory.resetCache();
|
||||
|
||||
var metricsFactory = hystrixjs.metricsFactory;
|
||||
|
||||
var metrics = metricsFactory.getOrCreate({
|
||||
commandKey: 'metricsKey',
|
||||
commandGroup: 'metricsGroup'
|
||||
})
|
||||
metrics.markSuccess();
|
||||
metrics.markFailure();
|
||||
metrics.markRejected();
|
||||
metrics.markTimeout();
|
||||
metrics.incrementExecutionCount();
|
||||
metrics.decrementExecutionCount();
|
||||
metrics.getCurrentExecutionCount();
|
||||
metrics.addExecutionTime(3000);
|
||||
metrics.getRollingCount("FAILURE");
|
||||
var healthcounts = metrics.getHealthCounts();
|
||||
console.log(healthcounts.totalCount);
|
||||
console.log(healthcounts.errorCount);
|
||||
console.log(healthcounts.errorPercentage);
|
||||
|
||||
metricsFactory.resetCache();
|
||||
|
||||
metricsFactory.getAllMetrics().map((metrics) => {
|
||||
console.log(metrics.getCurrentExecutionCount());
|
||||
});
|
||||
|
||||
var hystrixConfig = hystrixjs.hystrixConfig;
|
||||
console.log(hystrixConfig.metricsPercentileWindowBuckets());
|
||||
console.log(hystrixConfig.circuitBreakerForceClosed());
|
||||
console.log(hystrixConfig.circuitBreakerForceOpened());
|
||||
console.log(hystrixConfig.circuitBreakerSleepWindowInMilliseconds());
|
||||
console.log(hystrixConfig.circuitBreakerErrorThresholdPercentage());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThreshold());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThresholdForceOverride());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThresholdOverride());
|
||||
console.log(hystrixConfig.executionTimeoutInMilliseconds());
|
||||
console.log(hystrixConfig.metricsStatisticalWindowBuckets());
|
||||
console.log(hystrixConfig.metricsStatisticalWindowInMilliseconds());
|
||||
console.log(hystrixConfig.metricsPercentileWindowInMilliseconds());
|
||||
console.log(hystrixConfig.requestVolumeRejectionThreshold());
|
||||
console.log(hystrixConfig.resetProperties());
|
||||
console.log(hystrixConfig.init({}));
|
||||
|
||||
var hystrixSSEStream = hystrixjs.hystrixSSEStream;
|
||||
|
||||
hystrixSSEStream.toObservable().subscribe((result) => {
|
||||
console.log(result);
|
||||
})
|
||||
Vendored
+148
@@ -0,0 +1,148 @@
|
||||
// Type definitions for dragula v2.1.2
|
||||
// Project: https://bitbucket.org/igor_sechyn/hystrixjs
|
||||
// Definitions by: Igor Sechyn <https://github.com/igorsechyn/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../q/Q.d.ts"/>
|
||||
///<reference path="../rx/rx.d.ts"/>
|
||||
|
||||
declare module HystrixJS {
|
||||
|
||||
interface HystrixProperties {
|
||||
"hystrix.force.circuit.open"?: boolean,
|
||||
"hystrix.force.circuit.closed"?: boolean,
|
||||
"hystrix.circuit.sleepWindowInMilliseconds"?:number,
|
||||
"hystrix.circuit.errorThresholdPercentage"?: number,
|
||||
"hystrix.circuit.volumeThreshold"?:number,
|
||||
"hystrix.circuit.volumeThreshold.forceOverride"?: boolean,
|
||||
"hystrix.circuit.volumeThreshold.override"?: number,
|
||||
"hystrix.execution.timeoutInMilliseconds"?: number,
|
||||
"hystrix.metrics.statistical.window.timeInMilliseconds"?: number,
|
||||
"hystrix.metrics.statistical.window.bucketsNumber"?: number,
|
||||
"hystrix.metrics.percentile.window.timeInMilliseconds"?: number,
|
||||
"hystrix.metrics.percentile.window.bucketsNumber"?: number,
|
||||
"hystrix.request.volume.rejectionThreshold"?: number
|
||||
}
|
||||
|
||||
interface HystrixConfig {
|
||||
metricsPercentileWindowBuckets(): number;
|
||||
circuitBreakerForceClosed(): boolean;
|
||||
circuitBreakerForceOpened(): boolean;
|
||||
circuitBreakerSleepWindowInMilliseconds(): number;
|
||||
circuitBreakerErrorThresholdPercentage(): number;
|
||||
circuitBreakerRequestVolumeThreshold(): number;
|
||||
circuitBreakerRequestVolumeThresholdForceOverride(): boolean;
|
||||
circuitBreakerRequestVolumeThresholdOverride(): number;
|
||||
executionTimeoutInMilliseconds(): number;
|
||||
metricsStatisticalWindowBuckets(): number;
|
||||
metricsStatisticalWindowInMilliseconds(): number;
|
||||
metricsPercentileWindowInMilliseconds(): number;
|
||||
metricsPercentileWindowBuckets(): number;
|
||||
requestVolumeRejectionThreshold(): number;
|
||||
resetProperties(): void;
|
||||
init(properties: HystrixProperties): void;
|
||||
}
|
||||
|
||||
interface Command {
|
||||
execute(...args: any[]): Q.Promise<any>;
|
||||
}
|
||||
|
||||
interface CommandBuilder {
|
||||
circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilder;
|
||||
errorHandler(value: (error: any) => boolean): CommandBuilder;
|
||||
timeout(value: number): CommandBuilder;
|
||||
circuitBreakerRequestVolumeThreshold(value: number): CommandBuilder;
|
||||
requestVolumeRejectionThreshold(value: number): CommandBuilder;
|
||||
circuitBreakerForceOpened(value: boolean): CommandBuilder;
|
||||
circuitBreakerForceClosed(value: boolean): CommandBuilder;
|
||||
statisticalWindowNumberOfBuckets(value: number): CommandBuilder;
|
||||
statisticalWindowLength(value: number): CommandBuilder;
|
||||
percentileWindowNumberOfBuckets(value: number): CommandBuilder;
|
||||
percentileWindowLength(value: number): CommandBuilder;
|
||||
circuitBreakerErrorThresholdPercentage(value: number): CommandBuilder;
|
||||
run(value: (args: any) => Q.Promise<any>): CommandBuilder;
|
||||
fallbackTo(value: (...args: any[]) => Q.Promise<any>): CommandBuilder;
|
||||
context(value: any): CommandBuilder;
|
||||
build(): Command;
|
||||
}
|
||||
|
||||
interface CommandFactory {
|
||||
getOrCreate(commandKey: string, commandGroup?: string): CommandBuilder;
|
||||
resetCache(): void;
|
||||
}
|
||||
|
||||
interface HealthCounts {
|
||||
totalCount: number;
|
||||
errorCount: number;
|
||||
errorPercentage: number;
|
||||
}
|
||||
|
||||
interface CommandMetrics {
|
||||
markSuccess(): void;
|
||||
markRejected(): void;
|
||||
markFailure(): void;
|
||||
markTimeout(): void;
|
||||
markShortCircuited(): void;
|
||||
incrementExecutionCount(): void;
|
||||
decrementExecutionCount(): void;
|
||||
getCurrentExecutionCount(): number;
|
||||
addExecutionTime(value: number): void;
|
||||
getRollingCount(type: any): number;
|
||||
getExecutionTime(percentile: any): number;
|
||||
getHealthCounts(): HealthCounts;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface MetricsProperties {
|
||||
commandKey: string,
|
||||
commandGroup: string,
|
||||
statisticalWindowTimeInMilliSeconds?: number,
|
||||
statisticalWindowNumberOfBuckets?: number,
|
||||
percentileWindowTimeInMilliSeconds?: number,
|
||||
percentileWindowNumberOfBuckets?: number
|
||||
}
|
||||
|
||||
interface MetricsFactory {
|
||||
getOrCreate(config: MetricsProperties): CommandMetrics;
|
||||
resetCache(): void;
|
||||
getAllMetrics(): Array<CommandMetrics>;
|
||||
}
|
||||
|
||||
interface CirctuiBreakerConfig {
|
||||
circuitBreakerSleepWindowInMilliseconds: number,
|
||||
commandKey: string,
|
||||
circuitBreakerErrorThresholdPercentage: number,
|
||||
circuitBreakerRequestVolumeThreshold: number,
|
||||
commandGroup: string,
|
||||
circuitBreakerForceClosed: boolean,
|
||||
circuitBreakerForceOpened: boolean
|
||||
}
|
||||
|
||||
interface CircuitBreaker {
|
||||
allowRequest(): boolean;
|
||||
allowSingleTest(): boolean;
|
||||
isOpen(): boolean;
|
||||
markSuccess(): void;
|
||||
}
|
||||
|
||||
interface CircuitFactory {
|
||||
getOrCreate(config: CirctuiBreakerConfig): CircuitBreaker;
|
||||
getCache(): Array<CircuitBreaker>;
|
||||
resetCache(): void;
|
||||
}
|
||||
|
||||
interface HystrixSSEStream {
|
||||
toObservable(): Rx.Observable<any>
|
||||
}
|
||||
}
|
||||
declare var hystrixjs: {
|
||||
commandFactory: HystrixJS.CommandFactory,
|
||||
metricsFactory: HystrixJS.MetricsFactory,
|
||||
circuitFactory: HystrixJS.CircuitFactory,
|
||||
hystrixSSEStream: HystrixJS.HystrixSSEStream,
|
||||
hystrixConfig: HystrixJS.HystrixConfig
|
||||
};
|
||||
|
||||
declare module "hystrixjs" {
|
||||
export = hystrixjs;
|
||||
}
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for joi v4.6.0
|
||||
// Project: https://github.com/spumko/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Laurence Dougal Myers <https://github.com/laurence-myers>, Christopher Glantschnig <https://github.com/cglantschnig>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// TODO express type of Schema in a type-parameter (.default, .valid, .example etc)
|
||||
@@ -120,7 +120,7 @@ declare module 'joi' {
|
||||
cidr?: string
|
||||
}
|
||||
|
||||
export interface ValidationError {
|
||||
export interface ValidationError extends Error {
|
||||
message: string;
|
||||
details: ValidationErrorItem[];
|
||||
simple(): string;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery-cropbox.d.ts"/>
|
||||
|
||||
var cropboxWithDefaultSettings = $("#element").cropbox();
|
||||
|
||||
var cropboxOptions: jQueryCropBox.CropboxOptions = {
|
||||
height: 500,
|
||||
zoom: 5,
|
||||
width: 0.5,
|
||||
};
|
||||
|
||||
var cropboxWithOptions = $("#element").cropbox(cropboxOptions);
|
||||
|
||||
cropboxWithOptions.zoomIn();
|
||||
cropboxWithOptions.zoomOut();
|
||||
cropboxWithOptions.zoom(50);
|
||||
|
||||
var cropDragOption: jQueryCropBox.CropboxDragOptions = {
|
||||
startX: 10,
|
||||
startY: 0,
|
||||
dx: 100,
|
||||
dy: 100
|
||||
};
|
||||
|
||||
cropboxWithOptions.drag(cropDragOption);
|
||||
|
||||
var cropboxSetCropOption: jQueryCropBox.CropboxSetCropOptions = {
|
||||
cropX: 10,
|
||||
cropY: 10,
|
||||
cropW: 50,
|
||||
cropH: 50
|
||||
};
|
||||
|
||||
cropboxWithOptions.setCrop(cropboxSetCropOption);
|
||||
|
||||
cropboxWithOptions.update();
|
||||
cropboxWithOptions.getDataURL();
|
||||
cropboxWithOptions.getBlob();
|
||||
cropboxWithOptions.remove();
|
||||
Vendored
+115
@@ -0,0 +1,115 @@
|
||||
// Type definitions for jQuery cropbox
|
||||
// Project: https://github.com/acornejo/jquery-cropbox
|
||||
// Definitions by: Per Kastman <https://github.com/PerKastman/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module jQueryCropBox {
|
||||
|
||||
enum ShowControls {
|
||||
never,
|
||||
always,
|
||||
hover,
|
||||
auto
|
||||
}
|
||||
|
||||
interface CropboxArea {
|
||||
cropX: number;
|
||||
cropY: number;
|
||||
cropW: number;
|
||||
cropH: number;
|
||||
}
|
||||
|
||||
interface CropboxOptions {
|
||||
/**
|
||||
* Width in pixels of the cropping window
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* Height in pixels of the cropping window
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* Number of incremental zoom steps. With the default of 10, you have to click the zoom-in button 9 times to reach 100%.
|
||||
*/
|
||||
zoom?: number;
|
||||
/**
|
||||
* Maximum zoom value. With the default of 1.0 users can't zoom beyond the maximum image resolution.
|
||||
*/
|
||||
maxZoom?: number;
|
||||
/**
|
||||
* If not null, this is the entire html block that should appear on hover over the image for instructions and/or buttons (could include the zoom in/out buttons for example). If null, the default html block is used which has the text "Click to drag" and the zoom in/out buttons. Use false to disable controls.
|
||||
*/
|
||||
controls?: any;
|
||||
/**
|
||||
* Set the initial cropping area
|
||||
*/
|
||||
result?: CropboxArea;
|
||||
/**
|
||||
* This flag is used to determine when to display the controls. Never, always and hover do exactly what you would expect (never show them, always show them, show them on hover). The auto flag is the same as the hover flag, except that on mobile devices it always shows the controls (since there is no hover event).
|
||||
*/
|
||||
showControls?: ShowControls
|
||||
}
|
||||
|
||||
interface CropboxDragOptions {
|
||||
startX: number,
|
||||
startY: number,
|
||||
dx: number,
|
||||
dy: number
|
||||
}
|
||||
|
||||
interface CropboxSetCropOptions {
|
||||
cropX: number,
|
||||
cropY: number,
|
||||
cropW: number,
|
||||
cropH: number
|
||||
}
|
||||
|
||||
interface Cropbox {
|
||||
/**
|
||||
* Increase image zoom level by one step
|
||||
*/
|
||||
zoomIn(): void;
|
||||
/**
|
||||
* Decrease image zoom level by one step
|
||||
*/
|
||||
zoomOut(): void;
|
||||
/**
|
||||
* Set zoom leevl to a value between 0 and 1. Need to call update to reflect the changes.
|
||||
*/
|
||||
zoom(percent: number): void;
|
||||
/**
|
||||
* Simulate image dragging, starting from (startX,startY) and moving a delta of (dx,dy). Need to call update to reflect the changes.
|
||||
*/
|
||||
drag(options: CropboxDragOptions): void;
|
||||
/**
|
||||
* Set crop window.
|
||||
*/
|
||||
setCrop(options: CropboxSetCropOptions): void;
|
||||
/**
|
||||
* Update the cropped result (must call after zoom and drag).
|
||||
*/
|
||||
update(): void;
|
||||
/**
|
||||
* Generate a URL for the cropped image on the client (requires HTML5 compliant browser).
|
||||
*/
|
||||
getDataURL(): string;
|
||||
/**
|
||||
* Generate a Blob with the cropped image (requires HTML5 compliant browser).
|
||||
*/
|
||||
getBlob(): any;
|
||||
/**
|
||||
* Remove the cropbox functionality from the image.
|
||||
*/
|
||||
remove(): void;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery-timeentry.d.ts"/>
|
||||
|
||||
var selector = '#example';
|
||||
|
||||
// basic
|
||||
$(selector).timeEntry();
|
||||
|
||||
var options: ITimeEntryOptions = {};
|
||||
options.show24Hours = true;
|
||||
options.showSeconds = true;
|
||||
options.unlimitedHours = true;
|
||||
options.separator = '!';
|
||||
options.ampmPrefix = 'x';
|
||||
options.ampmNames = ['am','pm'];
|
||||
options.appendText = 'foo';
|
||||
options.timeSteps = [1,1,1];
|
||||
options.initialField = 0;
|
||||
options.noSeparatorEntry = false;
|
||||
options.tabToExit = true;
|
||||
options.useMouseWheel = false;
|
||||
|
||||
options.defaultTime = new Date(0, 0, 0, 11, 30, 0);
|
||||
options.defaultTime = '11:30AM';
|
||||
options.defaultTime= +20;
|
||||
options.defaultTime= '!+2h +30m';
|
||||
|
||||
options.minTime = new Date(0, 0, 0, 8, 30, 0);
|
||||
options.minTime = '08:30AM';
|
||||
options.minTime = -15;
|
||||
options.minTime = '-1h -10m';
|
||||
|
||||
options.maxTime = new Date(0, 0, 0, 17, 30, 0);
|
||||
options.maxTime = '05:30pM';
|
||||
options.maxTime = +30;
|
||||
options.maxTime = '+20h +10s';
|
||||
|
||||
options.spinnerImage = 'foo.png';
|
||||
options.spinnerSize = [1, 2, 3];
|
||||
|
||||
options.spinnerBigImage = 'big.png';
|
||||
options.spinnerBigSize = [4, 5, 6];
|
||||
|
||||
options.spinnerIncDecOnly = true;
|
||||
options.spinnerTexts = ['Now', 'Prev', 'Next', 'incr', 'decr'];
|
||||
options.spinnerRepeat = [500, 250];
|
||||
|
||||
options.beforeShow = (input: any): void => {
|
||||
console.log(input.id);
|
||||
};
|
||||
options.beforeSetTime = (oldTime: Date, newTime: Date, minTime: Date, maxTime: Date): Date => {
|
||||
return newTime;
|
||||
};
|
||||
|
||||
$(selector).timeEntry(options);
|
||||
|
||||
// functions by name
|
||||
$(selector).timeEntry('option', {show24Hours: true});
|
||||
$(selector).timeEntry('option', 'show24Hours', true);
|
||||
|
||||
// global settings
|
||||
$.timeEntry.setDefaults(options);
|
||||
var fr: ITimeEntryRegionalOptions = $.timeEntry.regionalOptions['fr'];
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
// Type definitions for jQuery-timeentry.js 2.0.1
|
||||
// Project: https://github.com/kbwood/timeentry
|
||||
// Definitions by: Mark Nadig <https://github.com/marknadig>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface ITimeEntryRegionalOptions {
|
||||
/**
|
||||
* Indicate whether to use 12-hour (false) or 24-hour (true) time. This is one of the regional settings fields.
|
||||
*
|
||||
* default: False
|
||||
*/
|
||||
show24Hours?: boolean;
|
||||
/**
|
||||
* The separator between time portions. This is one of the regional settings fields.
|
||||
*
|
||||
* default: ':'
|
||||
*/
|
||||
separator?: string;
|
||||
/**
|
||||
* The text that separates the time from the AM and PM indicators. This is one of the regional settings fields.
|
||||
*
|
||||
* default: ''
|
||||
*/
|
||||
ampmPrefix?: string;
|
||||
/**
|
||||
* The AM and PM display text. This is one of the regional settings fields.
|
||||
*
|
||||
* default: ['AM','PM']
|
||||
*/
|
||||
ampmNames?: string[];
|
||||
/**
|
||||
* The tooltip text for the spinner buttons. This is one of the regional settings fields.
|
||||
*
|
||||
* default: ['Now', 'Previous field', 'Next field', 'Increment', 'Decrement']
|
||||
*/
|
||||
spinnerTexts?: string[];
|
||||
}
|
||||
|
||||
interface ITimeEntryOptions extends ITimeEntryRegionalOptions {
|
||||
/**
|
||||
* Indicate whether or not the seconds part of the time should be displayed.
|
||||
*
|
||||
* default: False
|
||||
*/
|
||||
showSeconds?: boolean;
|
||||
/**
|
||||
* Indicate whether to restrict hours to just those in one day (false) or to allow for any value for hours (true).
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
unlimitedHours?: boolean;
|
||||
/**
|
||||
* Add content to display after each time field. This may contain HTML markup.
|
||||
*
|
||||
* default: ''
|
||||
*/
|
||||
appendText?: string;
|
||||
/**
|
||||
* The increment/decrement values for each of the time portions - hours, minutes, and seconds.
|
||||
* Use this to constrain the portions, e.g. [1, 15, 0] restricts the times to quarter hours.
|
||||
*
|
||||
* default: [1,1,1]
|
||||
*/
|
||||
timeSteps?: number[];
|
||||
/**
|
||||
* The number of the portion of the time field to highlight initially.
|
||||
* Use 0 for hours, 1 for minutes, etc., or null for the user selection.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
initialField?: number;
|
||||
/**
|
||||
* Set to true to allow direct entry of a time from the keyboard without needing to type separators,
|
||||
* i.e. the field moves on after two digits.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
noSeparatorEntry?: boolean;
|
||||
/**
|
||||
* true to have the tab key exit this field and move to the next one, or false to have the tab key step
|
||||
* through the date subfields.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
tabToExit?: boolean;
|
||||
/**
|
||||
* Set to true to use the mouse wheel for increment/decrement if possible, or false to never use it.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
useMouseWheel?: boolean;
|
||||
/**
|
||||
* The default time to show when no other value has been entered. This may be a Date object
|
||||
* (but the year/month/day values are ignored), a string in the current time format, a numeric
|
||||
* value as seconds offset from now, or a string value indicating a number and units, e.g. '+2h'.
|
||||
* In the latter case, use 'h' for hours, 'm' for minutes, or 's' for seconds. Letters may be upper
|
||||
* or lower case. Multiple offsets may be combined into one setting, e.g. '-2h -20m'. Prefix with '!'
|
||||
* to prevent a wrap around into another day. Leave as null to default to the current time.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
defaultTime?: Date | number | string;
|
||||
/**
|
||||
* The minimum time that may be selected, or null for no limit. See defaultTime for a description
|
||||
* of the possible formats. Use an array of number for hours, minutes, seconds in conjunction with unlimitedHours.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
minTime?: Date | number | number[] | string;
|
||||
/**
|
||||
* The maximum time that may be selected, or null for no limit. See defaultTime for a description of the possible
|
||||
* formats. Use an array of number for hours, minutes, seconds in conjunction with unlimitedHours.
|
||||
*
|
||||
* Note that the maxTime may be set to less than the minTime in which case the entered time is restricted to
|
||||
* the period between the minimum and the maximum on the "next day".
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
maxTime?: Date | number | number[] | string;
|
||||
/**
|
||||
* The URL for the spinner images to use, or '' for no spinner. The file must contain seven images horizontally
|
||||
* for the normal view, then for each "button" pressed (now, previous, next, increment, and decrement), and,
|
||||
* finally, the disabled view.
|
||||
*
|
||||
* default: 'spinnerDefault.png'
|
||||
*/
|
||||
spinnerImage?: string;
|
||||
/**
|
||||
* The dimensions of the spinner image for determining which "button" was clicked. The first two values are the
|
||||
* width and height of the individual images, the third is the size of the central button for setting the current
|
||||
* time, or 0 for no central button.
|
||||
*
|
||||
* default: [20, 20, 8]
|
||||
*/
|
||||
spinnerSize?: number[];
|
||||
/**
|
||||
* The URL for an expanded spinner image to use, or '' for no expansion. The layout is the same as for
|
||||
* spinnerImage but should be a larger size. The expanded spinner appears when the user hovers over the
|
||||
* original spinner and disappears when they move off it.
|
||||
*
|
||||
* default: ''
|
||||
*/
|
||||
spinnerBigImage?: string;
|
||||
/**
|
||||
* The dimensions of the expanded spinner image for determining which "button" was clicked. The first two values
|
||||
* are the width and height of the individual images, the third is the size of the central button for setting the
|
||||
* current time, or 0 for no central button.
|
||||
*
|
||||
* default: [40, 40, 16]
|
||||
*/
|
||||
spinnerBigSize?: number[];
|
||||
/**
|
||||
* Set to true to have only the increment and decrement buttons on the spinner, or false for all the buttons.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
spinnerIncDecOnly?: boolean;
|
||||
/**
|
||||
* The times in milliseconds for the auto-repeat feature on the increment and decrement spinner buttons.
|
||||
* The first value is the initial delay and the second one is the subsequent delay. Hold the mouse button down
|
||||
* on these spinner buttons to trigger this feature. Use [0, 0] to disable the auto-repeat.
|
||||
*
|
||||
* default: [500, 250]
|
||||
*/
|
||||
spinnerRepeat?: number[];
|
||||
/**
|
||||
* A function that accepts an input field and returns a settings object containing new settings for the time
|
||||
* entry for this field. For example, you can use it to set up a time range wherein both fields restrict the
|
||||
* possible values of the other field. this refers to the input field as well. Leave as null for no per-field
|
||||
* customisation.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
beforeShow?: Function;
|
||||
/**
|
||||
* A function that accepts the old and new times, and minimum and maximum times, and returns an updated time.
|
||||
* This refers to the associated input field. This call is made just before the time is updated into the field
|
||||
* allowing for additional restrictions to be applied. Leave as null for no additional restrictions.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
beforeSetTime?: Function;
|
||||
}
|
||||
|
||||
interface ITimeEntry {
|
||||
/**
|
||||
* initialize TimeEntry plugin
|
||||
*/
|
||||
(configOrFnName?: ITimeEntryOptions | string, nameOrOption?: any, value?: any): any; // functions accessed with string key :/
|
||||
}
|
||||
|
||||
interface ITimeEntryLocales {
|
||||
[index: string]: ITimeEntryRegionalOptions;
|
||||
}
|
||||
|
||||
interface ITimeEntryStatic {
|
||||
regionalOptions: ITimeEntryLocales;
|
||||
setDefaults(settings: ITimeEntryOptions): void;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* initialize TimeEntry plugin
|
||||
*/
|
||||
timeEntry: ITimeEntry;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
timeEntry: ITimeEntryStatic;
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
/// <reference path="jquery.soap.d.ts"/>
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/',
|
||||
method: 'helloWorld',
|
||||
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
// if you want to have the response as JSON use soapResponse.toJSON();
|
||||
// or soapResponse.toString() to get XML string
|
||||
// or soapResponse.toXML() to get XML DOM
|
||||
},
|
||||
error: function(SOAPResponse) {
|
||||
// show error
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/', //endpoint address for the service
|
||||
method: 'helloWorld', // service operation name
|
||||
// 1) will be appended to url if appendMethodToURL=true
|
||||
// 2) will be used for request element name when building xml from JSON 'params' (unless 'elementName' is provided)
|
||||
// 3) will be used to set SOAPAction request header if no SOAPAction is specified
|
||||
appendMethodToURL: true, // method name will be appended to URL defaults to true
|
||||
SOAPAction: 'action', // manually set the Request Header 'SOAPAction', defaults to the method specified above (optional)
|
||||
soap12: false, // use SOAP 1.2 namespace and HTTP headers - default to false
|
||||
context: document.body, // Used to set this in beforeSend, success, error and data callback functions
|
||||
|
||||
// addional headers and namespaces
|
||||
envAttributes: { // additional attributes (like namespaces) for the Envelope:
|
||||
'xmlns:another': 'http://anotherNamespace.com/'
|
||||
},
|
||||
HTTPHeaders: { // additional http headers send with the $.ajax call, will be given to $.ajax({ headers: })
|
||||
'Authorization': 'Basic ' + btoa('user:pass')
|
||||
},
|
||||
|
||||
//data can be XML DOM, XML String, JSON or a function
|
||||
data: { // JSON structure used to build request XML - SHOULD be coupled with ('namespaceQualifier' AND 'namespaceURL') AND ('method' OR 'elementName')
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
|
||||
//these options ONLY apply when the request XML is going to be built from JSON 'params'
|
||||
namespaceQualifier: 'myns', // used as namespace prefix for all elements in request (optional)
|
||||
namespaceURL: 'urn://service.my.server.com', // namespace url added to parent request element (optional)
|
||||
noPrefix: false, // set to true if you don't want the namespaceQualifier to be the prefix for the nodes in params. defaults to false (optional)
|
||||
elementName: 'requestElementName', // override 'method' as outer element (optional)
|
||||
|
||||
//callback functions
|
||||
beforeSend: function(SOAPEnvelope) { }, // callback function - SOAPEnvelope object is passed back prior to ajax call (optional)
|
||||
success: function(SOAPResponse) { }, // callback function to handle successful return (optional)
|
||||
error: function(SOAPResponse) { }, // callback function to handle fault return (optional)
|
||||
statusCode: { // callback functions based on statusCode
|
||||
404: function() {
|
||||
console.log('404 Not Found')
|
||||
},
|
||||
200: function() {
|
||||
console.log('200 OK')
|
||||
}
|
||||
},
|
||||
|
||||
// WS-Security
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
},
|
||||
|
||||
// debugging
|
||||
enableLogging: false // to enable the local log function set to true, defaults to false (optional)
|
||||
})
|
||||
|
||||
$.soap({
|
||||
|
||||
}).done(function(data, textStatus, jqXHR) {
|
||||
// do stuff on success here...
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
// do stuff on error here...
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com',
|
||||
error: function(soapResponse) {
|
||||
// show error
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'doSomethingElse',
|
||||
data: {},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
url: 'http://another.server.com/anotherService',
|
||||
method: 'helloWorld',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
},
|
||||
error: function(soapResponse) {
|
||||
alert('that other server might be down...')
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
// other parameters..
|
||||
|
||||
// WS-Security
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
}
|
||||
});
|
||||
|
||||
var username = 'foo';
|
||||
var password = 'bar';
|
||||
|
||||
$.soap({
|
||||
// other parameters...
|
||||
|
||||
HTTPHeaders: {
|
||||
Authorization: 'Basic ' + btoa(username + ':' + password)
|
||||
}
|
||||
});
|
||||
|
||||
// jquery.soap/doc/options.md
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem',
|
||||
appendMethodToURL: false
|
||||
})
|
||||
|
||||
$.soap({
|
||||
beforeSend: function(SOAPEnvelope) {
|
||||
console.log(SOAPEnvelope.toString());
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
context: document.body,
|
||||
success: function(SOAPResponse) {
|
||||
console.log(this);
|
||||
}
|
||||
});
|
||||
|
||||
var xml =
|
||||
['<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">',
|
||||
'<soap:Body>',
|
||||
'<requestNode>',
|
||||
'</requestNode>',
|
||||
'</soap:Body>',
|
||||
'</soap:Envelope>'];
|
||||
|
||||
$.soap({
|
||||
data: xml.join('')
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'requestNode',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
envAttributes: {
|
||||
'xmlns:another': 'http://anotherNamespace.com/'
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
elementName: 'requestNode'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
enableLogging: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
error: function(SOAPResponse) {
|
||||
console.log(SOAPResponse.toString())
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
HTTPHeaders: {
|
||||
'Authorization': 'Basic ' + btoa('user:pass')
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com',
|
||||
noPrefix: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
request: function(SOAPEnvelope) {
|
||||
console.log(SOAPEnvelope.toString());
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
soap12: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem',
|
||||
SOAPAction: 'getAnItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
SOAPHeader: {
|
||||
test: [1, 2, 3]
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
statusCode: {
|
||||
404: function() {
|
||||
console.log('404 Not Found')
|
||||
},
|
||||
200: function() {
|
||||
console.log('200 OK')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
success: function(SOAPResponse) {
|
||||
console.log(SOAPResponse.toString());
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
}
|
||||
})
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// Type definitions for jQuery.SOAP 1.6.7
|
||||
// Project: https://github.com/doedje/jquery.soap
|
||||
// Definitions by: Roland Greim <https://github.com/tigerxy>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module JQuerySOAP {
|
||||
interface SOAPEnvelope {
|
||||
attributes: Object
|
||||
bodies: Array<SOAPObject>
|
||||
headers: Array<SOAPObject>
|
||||
prefix: string
|
||||
soapConfig: any
|
||||
typeOf: string
|
||||
addAttribute(name: String, value: string): void
|
||||
addAttribute(name: String, value: number): void
|
||||
addBody(soapObject: SOAPObject): void
|
||||
addHeader(soapObject: SOAPObject): void
|
||||
addNamespace(name: String, uri: string): void
|
||||
toString(): string
|
||||
send(options: Options): void
|
||||
}
|
||||
interface SOAPResponse {
|
||||
toJSON(): any
|
||||
toString(): String
|
||||
toXML(): XMLDocument
|
||||
}
|
||||
|
||||
interface SOAPObject {
|
||||
attributes: Object
|
||||
children: Array<SOAPObject>
|
||||
name: string
|
||||
ns: Object
|
||||
_parent: SOAPObject
|
||||
value: any
|
||||
typeOf: string
|
||||
addNamespace(name: String, url: string): void
|
||||
addParameter(name: String, value: string): void
|
||||
addParameter(name: String, value: number): void
|
||||
appendChild(soapObject: SOAPObject): SOAPObject
|
||||
attr(name: string, value: string): Object
|
||||
attr(name: string, value: number): Object
|
||||
end(): SOAPObject
|
||||
find(name: string): SOAPObject
|
||||
hasChildren(): boolean
|
||||
newChild(name: string): SOAPObject
|
||||
parent(): SOAPObject
|
||||
toString(): string
|
||||
val(value: string): SOAPObject
|
||||
val(value: number): SOAPObject
|
||||
}
|
||||
interface Options {
|
||||
appendMethodToURL?: boolean;
|
||||
async?: boolean;
|
||||
beforeSend?: (SOAPEnvelope: SOAPEnvelope) => void;
|
||||
context?: any;
|
||||
data?: Object;
|
||||
envAttributes?: any;
|
||||
elementName?: string;
|
||||
enableLogging?: boolean;
|
||||
error?: (SOAPResponse: SOAPResponse) => void;
|
||||
HTTPHeaders?: Object;
|
||||
method?: string;
|
||||
namespaceQualifier?: string;
|
||||
namespaceURL?: string;
|
||||
noPrefix?: boolean;
|
||||
request?: (SOAPEnvelope: SOAPEnvelope) => void;
|
||||
soap12?: boolean;
|
||||
SOAPAction?: string;
|
||||
SOAPHeader?: Object;
|
||||
statusCode?: Object;
|
||||
success?: (SOAPResponse: SOAPResponse) => void;
|
||||
url?: string;
|
||||
wss?: Object;
|
||||
}
|
||||
interface SOAP {
|
||||
(options?: Options): JQueryXHR;
|
||||
}
|
||||
}
|
||||
interface JQueryStatic {
|
||||
soap: JQuerySOAP.SOAP;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="md5.d.ts" />
|
||||
|
||||
md5('Message to hash');
|
||||
md5('');
|
||||
md5('中文');
|
||||
md5([]);
|
||||
md5(new Uint8Array([]));
|
||||
|
||||
$.md5('message');
|
||||
$.md5('Message to hash');
|
||||
$.md5('');
|
||||
$.md5('中文');
|
||||
$.md5([]);
|
||||
$.md5(new Uint8Array([]));
|
||||
|
||||
'message'.md5('Message to hash');
|
||||
'message'.md5('');
|
||||
'message'.md5('中文');
|
||||
'message'.md5([]);
|
||||
'message'.md5(new Uint8Array([]));
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for js-md5 v0.3.0
|
||||
// Project: https://github.com/emn178/js-md5
|
||||
// Definitions by: Roland Greim <https://github.com/tigerxy>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface md5 {
|
||||
(value: string): string;
|
||||
(value: Array<any>): string;
|
||||
(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface String {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
declare var md5: md5;
|
||||
Vendored
+62
-7
@@ -3,7 +3,13 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../node/node.d.ts' />
|
||||
/// <reference path='../jquery/jquery.d.ts' />
|
||||
|
||||
declare module "jsdom" {
|
||||
|
||||
import EventEmitter = NodeJS.EventEmitter;
|
||||
|
||||
/**
|
||||
* The do-what-I-mean API.
|
||||
*
|
||||
@@ -26,6 +32,51 @@ declare module "jsdom" {
|
||||
export function env(urlOrHtml: string, config: Config, callback?: Callback): void;
|
||||
export function env(config: Config, callback?: Callback): void;
|
||||
|
||||
export function serializeDocument(doc: Document): string;
|
||||
|
||||
export interface VirtualConsole extends EventEmitter {
|
||||
sendTo(console: Console): VirtualConsole;
|
||||
}
|
||||
|
||||
export interface VirtualConsoleOptions {
|
||||
}
|
||||
|
||||
export interface WindowProperties {
|
||||
parsingMode?: string; // html, xml, auto, undefined
|
||||
contentType?: string;
|
||||
parser?: any;
|
||||
url?: string;
|
||||
referrer?: string;
|
||||
cookieJar?: CookieJar;
|
||||
cookie?: string;
|
||||
resourceLoader?: any;
|
||||
deferClose?: boolean;
|
||||
concurrentNodeIterators?: number;
|
||||
virtualConsole?: VirtualConsole;
|
||||
created?: (something: any, window: Window) => any;
|
||||
features?: FeatureOptions;
|
||||
top?: Window;
|
||||
}
|
||||
|
||||
// tough-cookie
|
||||
export interface CookieJar {
|
||||
|
||||
}
|
||||
|
||||
export function createVirtualConsole(options?: VirtualConsoleOptions): VirtualConsole;
|
||||
export function getVirtualConsole(window: Window): VirtualConsole;
|
||||
export function createCookieJar(): CookieJar;
|
||||
export function nodeLocation(node: Node): any;
|
||||
export function reconfigureWindow(window: Window, newProps: WindowProperties): void;
|
||||
|
||||
export function jQueryify(window: Window, jqueryUrl: string, callback: (window: Window, jquery: JQuery) => any): void;
|
||||
|
||||
export var debugMode: boolean;
|
||||
|
||||
export interface DocumentWithParentWindow extends Document {
|
||||
parentWindow: Window;
|
||||
}
|
||||
|
||||
/**
|
||||
* The jsdom.jsdom method does less things automatically; it takes in only HTML source, and does not let you to
|
||||
* separately supply script that it will inject and execute. It just gives you back a document object,
|
||||
@@ -37,12 +88,14 @@ declare module "jsdom" {
|
||||
* equivalent to what a browser will give if you open up an empty .html file.
|
||||
* @param options see the explanation of the config object above.
|
||||
*/
|
||||
export function jsdom(markup: string, config?: Config): Document;
|
||||
export function jsdom(markup: string, config?: Config): DocumentWithParentWindow;
|
||||
|
||||
/**
|
||||
* Before creating any documents, you can modify the defaults for all future documents:
|
||||
*/
|
||||
export var defaultDocumentFeatures: FeatureOptions;
|
||||
export var availableDocumentFeatures: FeatureOptions;
|
||||
export var defaultDocumentFeatures: FeatureOptions;
|
||||
export var applyDocumentFeatures: FeatureOptions;
|
||||
|
||||
export interface Callback {
|
||||
(errors: Error[], window: Window): any;
|
||||
@@ -54,7 +107,7 @@ declare module "jsdom" {
|
||||
* Allowed: ["script", "img", "css", "frame", "iframe", "link"] or false
|
||||
* Default for jsdom.env: false
|
||||
*/
|
||||
FetchExternalResources?: any;
|
||||
FetchExternalResources?: string[] | boolean;
|
||||
|
||||
/**
|
||||
* Enables/disables JavaScript execution
|
||||
@@ -62,7 +115,7 @@ declare module "jsdom" {
|
||||
* Allowed: ["script"] or false,
|
||||
* Default for jsdom.env: false
|
||||
*/
|
||||
ProcessExternalResources?: any;
|
||||
ProcessExternalResources?: string[] | boolean;
|
||||
|
||||
/**
|
||||
* Filters resource downloading and processing to disallow those matching the given regular expression
|
||||
@@ -70,7 +123,7 @@ declare module "jsdom" {
|
||||
* Allowed: /url to be skipped/ or false
|
||||
* Example: /http:\/\/example.org/js/bad\.js/
|
||||
*/
|
||||
SkipExternalResources?: any;
|
||||
SkipExternalResources?: string | boolean;
|
||||
}
|
||||
|
||||
export interface EnvDocument {
|
||||
@@ -112,7 +165,7 @@ declare module "jsdom" {
|
||||
/**
|
||||
* a custom cookie jar, if desired; see mikeal/request documentation.
|
||||
*/
|
||||
jar?: any;
|
||||
jar?: CookieJar;
|
||||
/**
|
||||
* either "auto", "html", or "xml". The default is "auto", which uses HTML behavior unless config.url responds with an XML Content-Type, or config.file contains a filename ending in .xml or .xhtml. Setting to "xml" will attempt to parse the document as an XHTML document. (jsdom is currently only OK at doing that.)
|
||||
*/
|
||||
@@ -123,6 +176,8 @@ declare module "jsdom" {
|
||||
*/
|
||||
features?: FeatureOptions;
|
||||
|
||||
virtualConsole?: VirtualConsole;
|
||||
|
||||
/**
|
||||
* Now that you know about created and loaded, you can see that done is essentially both of them smashed together:
|
||||
* If window creation succeeds and no <script>s cause errors, then errors will be null, and window will be usable.
|
||||
@@ -140,4 +195,4 @@ declare module "jsdom" {
|
||||
*/
|
||||
created?: (error: Error, window: Window) => void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+8
-1
@@ -5,13 +5,18 @@
|
||||
|
||||
|
||||
interface KnockoutSubscribableFunctions<T> {
|
||||
[key: string]: KnockoutBindingHandler;
|
||||
|
||||
notifySubscribers(valueToWrite?: T, event?: string): void;
|
||||
}
|
||||
|
||||
interface KnockoutComputedFunctions<T> {
|
||||
[key: string]: KnockoutBindingHandler;
|
||||
}
|
||||
|
||||
interface KnockoutObservableFunctions<T> {
|
||||
[key: string]: KnockoutBindingHandler;
|
||||
|
||||
equalityComparer(a: any, b: any): boolean;
|
||||
}
|
||||
|
||||
@@ -30,6 +35,8 @@ interface KnockoutObservableArrayFunctions<T> {
|
||||
sort(compareFunction: (left: T, right: T) => number): void;
|
||||
|
||||
// Ko specific
|
||||
[key: string]: KnockoutBindingHandler;
|
||||
|
||||
replace(oldItem: T, newItem: T): void;
|
||||
|
||||
remove(item: T): T[];
|
||||
@@ -261,7 +268,7 @@ interface KnockoutUtils {
|
||||
|
||||
compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
|
||||
|
||||
arrayForEach<T>(array: T[], action: (item: T) => void): void;
|
||||
arrayForEach<T>(array: T[], action: (item: T, index: number) => void): void;
|
||||
|
||||
arrayIndexOf<T>(array: T[], item: T): number;
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -42,7 +42,7 @@ declare module "libxmljs" {
|
||||
name():string;
|
||||
name(newName:string):void;
|
||||
text():string;
|
||||
attr(name:string):string;
|
||||
attr(name:string):Attribute;
|
||||
attr(attr:Attribute):void;
|
||||
attr(attrObject:{[key:string]:string;}):void;
|
||||
attrs():Attribute[];
|
||||
@@ -59,8 +59,9 @@ declare module "libxmljs" {
|
||||
addPrevSibling(siblingNode:Element):Element;
|
||||
find(xpath:string):Element[];
|
||||
find(xpath:string, ns_uri:string):Element[];
|
||||
get(xpath:string, ns_uri:string):Element;
|
||||
find(xpath:string, namespaces:{[key:string]:string;}):Element[];
|
||||
get(xpath:string):Element;
|
||||
get(xpath:string, ns_uri:string):Element;
|
||||
get(xpath:string, ns_uri:{[key:string]:string;}):Element;
|
||||
defineNamespace(href:string):Namespace;
|
||||
defineNamespace(prefix:string, href:string):Namespace;
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
/// <reference path="lodash-decorators.d.ts" />
|
||||
/// <reference path="../lodash/lodash.d.ts" />
|
||||
|
||||
//
|
||||
// With Arguments
|
||||
//
|
||||
|
||||
import { after, debounce, memoize, curry } from 'lodash-decorators'
|
||||
|
||||
class Person {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName: string, lastName: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
@after(3)
|
||||
@debounce(100)
|
||||
getFullName(): string {
|
||||
return `${this.firstName} ${this.lastName}`
|
||||
}
|
||||
|
||||
@curry(2)
|
||||
@memoize()
|
||||
doSomeHeavyProcessing(arg1: any, arg2: any) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Without Arguments
|
||||
//
|
||||
|
||||
import { tap } from 'lodash-decorators'
|
||||
|
||||
class Person2 {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName?: string, lastName?: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
@once
|
||||
getFullName(): string {
|
||||
return `${this.firstName} ${this.lastName}`
|
||||
}
|
||||
|
||||
@tap
|
||||
popIt(list: number[]): void {
|
||||
list.pop();
|
||||
}
|
||||
}
|
||||
|
||||
const person2 = new Person2();
|
||||
|
||||
person2.popIt([1, 2, 3]); //=> [1, 2]
|
||||
|
||||
//
|
||||
// Partials
|
||||
//
|
||||
|
||||
import { partial, wrap } from 'lodash-decorators'
|
||||
|
||||
class Person3 {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName?: string, lastName?: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
getName(type: string) {
|
||||
return type === 'firstName' ? this.firstName : this.lastName
|
||||
}
|
||||
|
||||
@partial('getName', 'firstName')
|
||||
getFirstName(): string { return null; }
|
||||
|
||||
@partial('getName', null)
|
||||
getLastName(): string { return null; }
|
||||
|
||||
@wrap('getName')
|
||||
getUpperCaseName(fn: () => string): string {
|
||||
return fn().toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
//by .d.ts author: a workaround to ensure type
|
||||
interface Person3Ex extends Person3 {
|
||||
getUpperCaseName(): string;
|
||||
}
|
||||
|
||||
const person3 = new Person3('Joe', 'Smith') as Person3Ex;
|
||||
|
||||
person3.getFirstName(); // 'Joe'
|
||||
person3.getLastName(); // 'Smith'
|
||||
person3.getUpperCaseName(); // JOE SMITH
|
||||
|
||||
//
|
||||
// Composition
|
||||
//
|
||||
|
||||
//import { kebabCase } from 'lodash';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
class Person4 {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName?: string, lastName?: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return `${this.firstName} ${this.lastName}`;
|
||||
}
|
||||
|
||||
@compose(_.kebabCase, 'getName')
|
||||
logName(name: string): void {
|
||||
console.log(name);
|
||||
}
|
||||
}
|
||||
|
||||
//by .d.ts author: a workaround to ensure type
|
||||
interface Person4Ex extends Person4 {
|
||||
logName(): void;
|
||||
}
|
||||
|
||||
const person4 = new Person4('Joe', 'Smith') as Person4Ex;
|
||||
|
||||
person4.logName(); // joe-smith
|
||||
|
||||
//
|
||||
// Instance Decorators
|
||||
//
|
||||
|
||||
class Person5 {
|
||||
|
||||
@curry(2) // <= prototype decorator
|
||||
@debounce(100) // <= instance decorator
|
||||
getName() {} //=> Throws an error. (╯°□°)╯︵ ┻━┻
|
||||
|
||||
@debounce(100) // <= instance decorator
|
||||
@curry(2) // <= prototype decorator
|
||||
getName2() {} //=> All is well :)
|
||||
}
|
||||
|
||||
//
|
||||
// Getters and Setters
|
||||
//
|
||||
|
||||
import { once, compose } from 'lodash-decorators'
|
||||
|
||||
function alwaysArray(value: string|string[]): string[] {
|
||||
return Array.isArray(value) ? value : _.isUndefined(value) ? [] : [value];
|
||||
}
|
||||
|
||||
class Person6 {
|
||||
constructor() {}
|
||||
private nameList: string[];
|
||||
|
||||
//TODO: So far, TypeScript doesn't allow to put multiple decoratoes on set/get accessors.
|
||||
// see https://github.com/Microsoft/TypeScript/issues/2249#issuecomment-141684146
|
||||
//@once.get
|
||||
get names(): string[] {
|
||||
//MEMO: Resolve type inconsistency
|
||||
return [this.nameList.join(' ')];
|
||||
//MEMO: Original expression in repo
|
||||
//return this.nameList.join(' ');
|
||||
}
|
||||
|
||||
@compose.set(alwaysArray)
|
||||
set names(names: string[]) {
|
||||
this.nameList = names;
|
||||
}
|
||||
}
|
||||
|
||||
//by .d.ts author: a workaround to ensure type
|
||||
interface Person6Alt {
|
||||
names: string[]|string;
|
||||
}
|
||||
|
||||
const person6 = new Person6();
|
||||
|
||||
// nameList will always be an array.
|
||||
person6.names = undefined; //=> []
|
||||
(person6 as Person6Alt).names = 'Joe'; //=> ['Joe']
|
||||
person6.names = ['Jim']; //=> ['Jim']
|
||||
|
||||
//
|
||||
// Bind
|
||||
//
|
||||
|
||||
import { bind } from 'lodash-decorators'
|
||||
|
||||
class Person7 {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName: string, lastName: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
@bind()
|
||||
getName(): string {
|
||||
return `${this.firstName} ${this.lastName}`;
|
||||
}
|
||||
|
||||
// It can also function as a partial
|
||||
@bind('Joe')
|
||||
getUpperCaseName(name: string): string {
|
||||
return name.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
//by .d.ts author: a workaround to ensure type
|
||||
interface Person7Ex extends Person7 {
|
||||
getUpperCaseName(): string;
|
||||
}
|
||||
|
||||
const person7 = new Person7('Joe', 'Smith') as Person7Ex;
|
||||
|
||||
person7.getName.call(null); // Joe Smith
|
||||
person7.getUpperCaseName(); // JOE
|
||||
|
||||
|
||||
import { bindAll } from 'lodash-decorators'
|
||||
|
||||
@bindAll()
|
||||
class Person8 {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
constructor(firstName: string, lastName: string) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
getName() {
|
||||
return `${this.firstName} ${this.lastName}`;
|
||||
}
|
||||
}
|
||||
|
||||
const person8 = new Person8('Joe', 'Smith');
|
||||
|
||||
person8.getName.call(null); // Joe Smith
|
||||
|
||||
//
|
||||
// Forcing Decorator on Prototype
|
||||
//
|
||||
|
||||
import { throttle } from 'lodash-decorators';
|
||||
|
||||
class Person9 {
|
||||
@throttle(1000)
|
||||
doStuff() {}
|
||||
|
||||
@throttle.proto(1000)
|
||||
doStuffMore() {}
|
||||
}
|
||||
|
||||
const person9_1 = new Person9();
|
||||
const person9_2 = new Person9();
|
||||
|
||||
person9_1.doStuff(); //=> Both are called
|
||||
person9_2.doStuff();
|
||||
|
||||
person9_1.doStuffMore();
|
||||
person9_2.doStuffMore();
|
||||
|
||||
// Only one of these methods is actual invoked because throttle is applied to the prototype method
|
||||
// and not the instance method.
|
||||
|
||||
//
|
||||
// Extensions
|
||||
//
|
||||
|
||||
import { deprecated } from 'lodash-decorators/extensions'
|
||||
|
||||
// This is applied globally.
|
||||
deprecated.methodAction = fn => console.log(`Don't use ${fn.name}!`);
|
||||
|
||||
@deprecated
|
||||
class Person10 {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
class OtherPerson {
|
||||
@deprecated
|
||||
fn() {}
|
||||
}
|
||||
|
||||
let person10 = new Person10(); //=> Warning!
|
||||
|
||||
let otherPerson = new OtherPerson();
|
||||
otherPerson.fn(); //=> Don't use fn!
|
||||
|
||||
|
||||
//
|
||||
// https://github.com/steelsojka/lodash-decorators/tree/master/src/extensions
|
||||
//
|
||||
|
||||
import { Writable, ReturnsArg } from 'lodash-decorators/extensions';
|
||||
|
||||
class Person11 {
|
||||
constructor() {}
|
||||
|
||||
@Writable(false)
|
||||
getName() {}
|
||||
|
||||
@ReturnsArg(1)
|
||||
doSomething(x: any, y: any, z: any) {
|
||||
// Do something here
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// https://github.com/steelsojka/lodash-decorators/tree/master/src/validate
|
||||
//
|
||||
|
||||
import { Validate } from 'lodash-decorators/validate';
|
||||
|
||||
class Person12 {
|
||||
name: string;
|
||||
constructor() {}
|
||||
|
||||
@Validate(_.isString)
|
||||
setName(name: any) {
|
||||
this.name = name as string;
|
||||
}
|
||||
}
|
||||
|
||||
class Person13 {
|
||||
name: string;
|
||||
age: number;
|
||||
constructor() {}
|
||||
|
||||
@Validate(
|
||||
_.isString,
|
||||
[_.isNumber, _.partial(_.lt, 10) as ((_: any) => boolean)]
|
||||
)
|
||||
setData(name: any, age: any) {
|
||||
this.name = name as string;
|
||||
this.age = age as number;
|
||||
}
|
||||
}
|
||||
|
||||
const person13 = new Person13();
|
||||
|
||||
person13.setData('test', 5); //=> TypeError
|
||||
person13.setData('test', 12); //=> Valid
|
||||
|
||||
|
||||
//
|
||||
// Additional typings
|
||||
//
|
||||
|
||||
import { validateReturn } from 'lodash-decorators/validate';
|
||||
|
||||
class Calc {
|
||||
@validateReturn((c: number) => c > 0)
|
||||
add(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
@validateReturn<number>([c => c > 0])
|
||||
mul(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
--experimentalDecorators --noImplicitAny --target ES5
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
// Type definitions for lodash-decorators 1.0.5
|
||||
// Project: https://github.com/steelsojka/lodash-decorators
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../lodash/lodash.d.ts"/>
|
||||
|
||||
|
||||
declare module "lodash-decorators" {
|
||||
// Originally copied from ../node_modules/typescript/lib/lib.es6.d.ts
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
}
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
}
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface TypedMethodDecorator<TFunction extends Function> {
|
||||
(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<TFunction>): TypedPropertyDescriptor<TFunction> | void;
|
||||
}
|
||||
|
||||
export interface MethodDecoratorWithAccessor extends MethodDecorator, Accessor<MethodDecorator> {
|
||||
}
|
||||
|
||||
export interface Accessor<T> {
|
||||
set: T;
|
||||
get: T;
|
||||
proto: T;
|
||||
}
|
||||
|
||||
export interface DebounceDecorator {
|
||||
(wait: number, options?: _.DebounceSettings): MethodDecorator;
|
||||
}
|
||||
export interface ThrottleDecorator {
|
||||
(wait: number, options?: _.ThrottleSettings): MethodDecorator;
|
||||
}
|
||||
export interface MemoizeDecorator {
|
||||
(resolver?: Function): MethodDecorator;
|
||||
}
|
||||
export interface AfterDecorator {
|
||||
(n: number): MethodDecorator;
|
||||
}
|
||||
export interface BeforeDecorator {
|
||||
(n: number): MethodDecorator;
|
||||
}
|
||||
export interface AryDecorator {
|
||||
(n: number): MethodDecorator;
|
||||
}
|
||||
export interface CurryDecorator {
|
||||
(arity?: number): MethodDecorator;
|
||||
}
|
||||
export interface CurryRightDecorator {
|
||||
(arity?: number): MethodDecorator;
|
||||
}
|
||||
export interface RestParamDecorator {
|
||||
(start?: number): MethodDecorator;
|
||||
}
|
||||
export interface PartialDecorator {
|
||||
(func: Function|string, ...args: any[]): MethodDecorator;
|
||||
}
|
||||
export interface WrapDecorator {
|
||||
(wrapper: ((func: Function, ...args: any[]) => any)|string): MethodDecorator;
|
||||
}
|
||||
export interface ComposeDecorator {
|
||||
(...funcs: (Function|string)[]): MethodDecorator;
|
||||
}
|
||||
export interface DelayDecorator {
|
||||
(wait: number, ...args: any[]): MethodDecorator;
|
||||
}
|
||||
export interface DeferDecorator {
|
||||
(...args: any[]): MethodDecorator;
|
||||
}
|
||||
export interface BindDecorator {
|
||||
(): TypedMethodDecorator<(<R>() => R)>;
|
||||
<T1>(param1?: T1):
|
||||
TypedMethodDecorator<(<R>(param1: T1) => R)>;
|
||||
<T1, T2>(param1?: T1, param2?: T2):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2) => R)>;
|
||||
<T1, T2, T3>(param1?: T1, param2?: T2, param3?: T3):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3) => R)>;
|
||||
<T1, T2, T3, T4>(param1?: T1, param2?: T2, param3?: T3, param4?: T4):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4) => R)>;
|
||||
<T1, T2, T3, T4, T5>(param1?: T1, param2?: T2, param3?: T3, param4?: T4, param5?: T5):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4, param5: T5) => R)>;
|
||||
<T1, T2, T3, T4, T5, T6>(param1?: T1, param2?: T2, param3?: T3, param4?: T4, param5?: T5, param6?: T6):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4, param5: T5, param6: T6) => R)>;
|
||||
}
|
||||
export interface BindAllDecorator {
|
||||
(...methodNames: string[]): ClassDecorator;
|
||||
}
|
||||
export interface ModArgsDecorator {
|
||||
(...transforms: Function[]): MethodDecorator;
|
||||
}
|
||||
|
||||
export const debounce: DebounceDecorator & Accessor<DebounceDecorator>;
|
||||
export const Debounce: DebounceDecorator & Accessor<DebounceDecorator>;
|
||||
|
||||
export const throttle: ThrottleDecorator & Accessor<ThrottleDecorator>;
|
||||
export const Throttle: ThrottleDecorator & Accessor<ThrottleDecorator>;
|
||||
|
||||
export const memoize: MemoizeDecorator & Accessor<MemoizeDecorator>;
|
||||
export const Memoize: MemoizeDecorator & Accessor<MemoizeDecorator>;
|
||||
|
||||
export const after: AfterDecorator & Accessor<AfterDecorator>;
|
||||
export const After: AfterDecorator & Accessor<AfterDecorator>;
|
||||
|
||||
export const before: BeforeDecorator & Accessor<BeforeDecorator>;
|
||||
export const Before: BeforeDecorator & Accessor<BeforeDecorator>;
|
||||
|
||||
export const ary: AryDecorator & Accessor<AryDecorator>;
|
||||
export const Ary: AryDecorator & Accessor<AryDecorator>;
|
||||
|
||||
export const curry: CurryDecorator & Accessor<CurryDecorator>;
|
||||
export const Curry: CurryDecorator & Accessor<CurryDecorator>;
|
||||
|
||||
export const curryRight: CurryRightDecorator & Accessor<CurryRightDecorator>;
|
||||
export const CurryRight: CurryRightDecorator & Accessor<CurryRightDecorator>;
|
||||
|
||||
export const restParam: RestParamDecorator & Accessor<RestParamDecorator>;
|
||||
export const RestParam: RestParamDecorator & Accessor<RestParamDecorator>;
|
||||
|
||||
export const partial: PartialDecorator & Accessor<PartialDecorator>;
|
||||
export const Partial: PartialDecorator & Accessor<PartialDecorator>;
|
||||
|
||||
export const partialRight: PartialDecorator & Accessor<PartialDecorator>;
|
||||
export const PartialRight: PartialDecorator & Accessor<PartialDecorator>;
|
||||
|
||||
export const wrap: WrapDecorator & Accessor<WrapDecorator>;
|
||||
export const Wrap: WrapDecorator & Accessor<WrapDecorator>;
|
||||
|
||||
export const compose: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
export const Compose: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
|
||||
export const flow: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
export const Flow: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
|
||||
export const flowRight: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
export const FlowRight: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
|
||||
export const backflow: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
export const Backflow: ComposeDecorator & Accessor<ComposeDecorator>;
|
||||
|
||||
export const delay: DelayDecorator & Accessor<DelayDecorator>;
|
||||
export const Delay: DelayDecorator & Accessor<DelayDecorator>;
|
||||
|
||||
export const defer: DeferDecorator & Accessor<DeferDecorator>;
|
||||
export const Defer: DeferDecorator & Accessor<DeferDecorator>;
|
||||
|
||||
export const bind: BindDecorator & Accessor<BindDecorator>;
|
||||
export const Bind: BindDecorator & Accessor<BindDecorator>;
|
||||
|
||||
export const bindAll: BindAllDecorator;
|
||||
export const BindAll: BindAllDecorator;
|
||||
|
||||
export const modArgs: ModArgsDecorator & Accessor<ModArgsDecorator>;
|
||||
export const ModArgs: ModArgsDecorator & Accessor<ModArgsDecorator>;
|
||||
|
||||
export const once: MethodDecoratorWithAccessor;
|
||||
export const Once: MethodDecoratorWithAccessor;
|
||||
|
||||
export const spread: MethodDecoratorWithAccessor;
|
||||
export const Spread: MethodDecoratorWithAccessor;
|
||||
|
||||
export const rearg: MethodDecoratorWithAccessor;
|
||||
export const Rearg: MethodDecoratorWithAccessor;
|
||||
|
||||
export const negate: MethodDecoratorWithAccessor;
|
||||
export const Negate: MethodDecoratorWithAccessor;
|
||||
|
||||
export const tap: MethodDecoratorWithAccessor;
|
||||
export const Tap: MethodDecoratorWithAccessor;
|
||||
}
|
||||
|
||||
declare module "lodash-decorators/extensions" {
|
||||
// Originally copied from ../node_modules/typescript/lib/lib.es6.d.ts
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
}
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
}
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface DeprecatedDecorator extends MethodDecorator, ClassDecorator {
|
||||
methodAction(fn: Function & { name: string }): void;
|
||||
}
|
||||
|
||||
export const deprecated: DeprecatedDecorator;
|
||||
export const Deprecated: DeprecatedDecorator;
|
||||
|
||||
export const writable: (writable?: boolean) => MethodDecorator;
|
||||
export const Writable: (writable?: boolean) => MethodDecorator;
|
||||
|
||||
export const configurable: (configurable?: boolean) => MethodDecorator;
|
||||
export const Configurable: (configurable?: boolean) => MethodDecorator;
|
||||
|
||||
export const returnsArg: (index?: number) => MethodDecorator;
|
||||
export const ReturnsArg: (index?: number) => MethodDecorator;
|
||||
|
||||
export const enumerable: (enumerable?: boolean) => MethodDecorator;
|
||||
export const Enumerable: (enumerable?: boolean) => MethodDecorator;
|
||||
|
||||
export const nonenumerable: MethodDecorator;
|
||||
export const Nonenumerable: MethodDecorator;
|
||||
|
||||
export const nonconfigurable: MethodDecorator;
|
||||
export const Nonconfigurable: MethodDecorator;
|
||||
|
||||
export const readonly: MethodDecorator;
|
||||
export const Readonly: MethodDecorator;
|
||||
}
|
||||
|
||||
declare module "lodash-decorators/validate" {
|
||||
// Originally copied from ../node_modules/typescript/lib/lib.es6.d.ts
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
}
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
}
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface TypedMethodDecorator<TFunction extends Function> {
|
||||
(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<TFunction>): TypedPropertyDescriptor<TFunction> | void;
|
||||
}
|
||||
|
||||
export interface Predicate<T> {
|
||||
(t: T): boolean;
|
||||
}
|
||||
type Predicates<T> = Predicate<T>|Predicate<T>[];
|
||||
|
||||
export interface ValidateDecorator {
|
||||
<T1>(p1: Predicates<T1>):
|
||||
TypedMethodDecorator<(<R>(param1: T1) => R)>;
|
||||
<T1, T2>(p1: Predicates<T1>, p2?: Predicates<T2>):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2) => R)>;
|
||||
<T1, T2, T3>(p1: Predicates<T1>, p2?: Predicates<T2>, p3?: Predicates<T3>):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3) => R)>;
|
||||
<T1, T2, T3, T4>(p1: Predicates<T1>, p2?: Predicates<T2>, p3?: Predicates<T3>, p4?: Predicates<T4>):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4) => R)>;
|
||||
<T1, T2, T3, T4, T5>(p1: Predicates<T1>, p2?: Predicates<T2>, p3?: Predicates<T3>, p4?: Predicates<T4>, p5?: Predicates<T5>):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4, param5: T5) => R)>;
|
||||
<T1, T2, T3, T4, T5, T6>(p1: Predicates<T1>, p2?: Predicates<T2>, p3?: Predicates<T3>, p4?: Predicates<T4>, p5?: Predicates<T5>, p6?: Predicates<T6>):
|
||||
TypedMethodDecorator<(<R>(param1: T1, param2: T2, param3: T3, param4: T4, param5: T5, param6: T6) => R)>;
|
||||
}
|
||||
|
||||
export interface ValidateReturnDecorator {
|
||||
<R>(p1: Predicates<R>): TypedMethodDecorator<((...args: any[]) => R)>;
|
||||
}
|
||||
|
||||
export const validate: ValidateDecorator;
|
||||
export const Validate: ValidateDecorator;
|
||||
|
||||
export const validateReturn: ValidateReturnDecorator;
|
||||
export const ValidateReturn: ValidateReturnDecorator;
|
||||
}
|
||||
+412
-51
@@ -174,8 +174,18 @@ module TestChunk {
|
||||
result = _(list).chunk<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
// _.compact
|
||||
module TestCompact {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.compact<TResult>();
|
||||
result = _.compact<TResult>(array);
|
||||
result = _.compact<TResult>(list);
|
||||
result = _<TResult>(array).compact().value();
|
||||
result = _(list).compact<TResult>().value();
|
||||
}
|
||||
|
||||
// _.difference
|
||||
{
|
||||
@@ -251,18 +261,77 @@ result = <_.List<string>>_.fill<string>(testFillList, 'a', 0, 3);
|
||||
result = <number[]>_(testFillArray).fill<number>(0, 0, 3).value();
|
||||
result = <_.List<number>>_(testFillList).fill<number>(0, 0, 3).value();
|
||||
|
||||
// _.findIndex
|
||||
module TestFindIndex {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: number;
|
||||
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], function (f) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple' });
|
||||
result = _.findIndex<TResult>(array);
|
||||
result = _.findIndex<TResult>(array, predicateFn);
|
||||
result = _.findIndex<TResult>(array, predicateFn, any);
|
||||
result = _.findIndex<TResult>(array, '');
|
||||
result = _.findIndex<TResult>(array, '', any);
|
||||
result = _.findIndex<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], function (f: string) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findLastIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple' });
|
||||
result = _.findIndex<TResult>(list);
|
||||
result = _.findIndex<TResult>(list, predicateFn);
|
||||
result = _.findIndex<TResult>(list, predicateFn, any);
|
||||
result = _.findIndex<TResult>(list, '');
|
||||
result = _.findIndex<TResult>(list, '', any);
|
||||
result = _.findIndex<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).findIndex();
|
||||
result = _<TResult>(array).findIndex(predicateFn);
|
||||
result = _<TResult>(array).findIndex(predicateFn, any);
|
||||
result = _<TResult>(array).findIndex('');
|
||||
result = _<TResult>(array).findIndex('', any);
|
||||
result = _<TResult>(array).findIndex<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).findIndex();
|
||||
result = _(list).findIndex<TResult>(predicateFn);
|
||||
result = _(list).findIndex<TResult>(predicateFn, any);
|
||||
result = _(list).findIndex('');
|
||||
result = _(list).findIndex('', any);
|
||||
result = _(list).findIndex<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.findLastIndex
|
||||
module TestFindLastIndex {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: number;
|
||||
|
||||
result = _.findLastIndex<TResult>(array);
|
||||
result = _.findLastIndex<TResult>(array, predicateFn);
|
||||
result = _.findLastIndex<TResult>(array, predicateFn, any);
|
||||
result = _.findLastIndex<TResult>(array, '');
|
||||
result = _.findLastIndex<TResult>(array, '', any);
|
||||
result = _.findLastIndex<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.findLastIndex<TResult>(list);
|
||||
result = _.findLastIndex<TResult>(list, predicateFn);
|
||||
result = _.findLastIndex<TResult>(list, predicateFn, any);
|
||||
result = _.findLastIndex<TResult>(list, '');
|
||||
result = _.findLastIndex<TResult>(list, '', any);
|
||||
result = _.findLastIndex<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).findLastIndex();
|
||||
result = _<TResult>(array).findLastIndex(predicateFn);
|
||||
result = _<TResult>(array).findLastIndex(predicateFn, any);
|
||||
result = _<TResult>(array).findLastIndex('');
|
||||
result = _<TResult>(array).findLastIndex('', any);
|
||||
result = _<TResult>(array).findLastIndex<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).findLastIndex();
|
||||
result = _(list).findLastIndex<TResult>(predicateFn);
|
||||
result = _(list).findLastIndex<TResult>(predicateFn, any);
|
||||
result = _(list).findLastIndex('');
|
||||
result = _(list).findLastIndex('', any);
|
||||
result = _(list).findLastIndex<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.first
|
||||
module TestFirst {
|
||||
@@ -275,14 +344,10 @@ module TestFirst {
|
||||
result = _(list).first<TResult>();
|
||||
}
|
||||
|
||||
result = <number[]>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.takeWhile([1, 2, 3], (num) => num < 3);
|
||||
result = <boolean[]>_.takeWhile(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.takeWhile(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_([1, 2, 3]).take().value();
|
||||
result = <number[]>_([1, 2, 3]).take(2).value();
|
||||
result = <number[]>_([1, 2, 3]).takeWhile(function (num) {
|
||||
return num < 3;
|
||||
}).value();
|
||||
@@ -317,9 +382,25 @@ module TestHead {
|
||||
result = _(list).head<TResult>();
|
||||
}
|
||||
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
// _.indexOf
|
||||
module TestIndexOf {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let value: TResult;
|
||||
let result: number;
|
||||
result = _.indexOf<TResult>(array, value);
|
||||
result = _.indexOf<TResult>(array, value, true);
|
||||
result = _.indexOf<TResult>(array, value, 42);
|
||||
result = _.indexOf<TResult>(list, value);
|
||||
result = _.indexOf<TResult>(list, value, true);
|
||||
result = _.indexOf<TResult>(list, value, 42);
|
||||
result = _(array).indexOf(value);
|
||||
result = _(array).indexOf(value, true);
|
||||
result = _(array).indexOf(value, 42);
|
||||
result = _(list).indexOf<TResult>(value);
|
||||
result = _(list).indexOf<TResult>(value, true);
|
||||
result = _(list).indexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
//_.initial
|
||||
{
|
||||
@@ -345,11 +426,41 @@ result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
}
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number>_([1, 2, 3]).last();
|
||||
// _.last
|
||||
module TestLast {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult;
|
||||
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = _.last<TResult>(array);
|
||||
result = _.last<TResult>(list);
|
||||
result = _<TResult>(array).last();
|
||||
result = _(list).last<TResult>();
|
||||
}
|
||||
|
||||
// _.lastIndexOf
|
||||
module TestLastIndexOf {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let value: TResult;
|
||||
let result: number;
|
||||
|
||||
result = _.lastIndexOf<TResult>(array, value);
|
||||
result = _.lastIndexOf<TResult>(array, value, true);
|
||||
result = _.lastIndexOf<TResult>(array, value, 42);
|
||||
|
||||
result = _.lastIndexOf<TResult>(list, value);
|
||||
result = _.lastIndexOf<TResult>(list, value, true);
|
||||
result = _.lastIndexOf<TResult>(list, value, 42);
|
||||
|
||||
result = _(array).lastIndexOf(value);
|
||||
result = _(array).lastIndexOf(value, true);
|
||||
result = _(array).lastIndexOf(value, 42);
|
||||
|
||||
result = _(list).lastIndexOf<TResult>(value);
|
||||
result = _(list).lastIndexOf<TResult>(value, true);
|
||||
result = _(list).lastIndexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
// _.pull
|
||||
{
|
||||
@@ -411,10 +522,41 @@ result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]
|
||||
result = <_.Dictionary<any>>_.object([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).object();
|
||||
|
||||
result = <number[]>_.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; });
|
||||
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable' });
|
||||
var typedResult: IFoodType[] = _.remove([ <IFoodType>{ name: 'apple' }, <IFoodType>{ name: 'orange' }], <IFoodType>{ name: 'orange' });
|
||||
// _.remove
|
||||
module TestRemove {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.remove<TResult>(array);
|
||||
result = _.remove<TResult>(array, predicateFn);
|
||||
result = _.remove<TResult>(array, predicateFn, any);
|
||||
result = _.remove<TResult>(array, '');
|
||||
result = _.remove<TResult>(array, '', any);
|
||||
result = _.remove<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.remove<TResult>(list);
|
||||
result = _.remove<TResult>(list, predicateFn);
|
||||
result = _.remove<TResult>(list, predicateFn, any);
|
||||
result = _.remove<TResult>(list, '');
|
||||
result = _.remove<TResult>(list, '', any);
|
||||
result = _.remove<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).remove().value();
|
||||
result = _<TResult>(array).remove(predicateFn).value();
|
||||
result = _<TResult>(array).remove(predicateFn, any).value();
|
||||
result = _<TResult>(array).remove('').value();
|
||||
result = _<TResult>(array).remove('', any).value();
|
||||
result = _<TResult>(array).remove<{a: number}>({a: 42}).value();
|
||||
|
||||
result = _(list).remove<TResult>().value();
|
||||
result = _(list).remove<TResult>(predicateFn).value();
|
||||
result = _(list).remove<TResult>(predicateFn, any).value();
|
||||
result = _(list).remove<TResult>('').value();
|
||||
result = _(list).remove<TResult>('', any).value();
|
||||
result = _(list).remove<{a: number}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
// _.slice
|
||||
{
|
||||
@@ -440,6 +582,21 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
// _.take
|
||||
module TestTake {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.take<TResult>(array);
|
||||
result = _.take<TResult>(array, 42);
|
||||
result = _.take<TResult>(list);
|
||||
result = _.take<TResult>(list, 42);
|
||||
result = _(array).take().value();
|
||||
result = _(array).take(42).value();
|
||||
result = _(list).take<TResult>().value();
|
||||
result = _(list).take<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.takeRight
|
||||
{
|
||||
let testTakeRightArray: TResult[];
|
||||
@@ -455,6 +612,42 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
result = _(testTakeRightList).takeRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.takeRightWhile
|
||||
module TestTakeRightWhile {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.takeRightWhile<TResult>(array);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn);
|
||||
result = _.takeRightWhile<TResult>(array, predicateFn, any);
|
||||
result = _.takeRightWhile<TResult>(array, '')
|
||||
result = _.takeRightWhile<TResult>(array, '', any);
|
||||
result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.takeRightWhile<TResult>(list);
|
||||
result = _.takeRightWhile<TResult>(list, predicateFn);
|
||||
result = _.takeRightWhile<TResult>(list, predicateFn, any);
|
||||
result = _.takeRightWhile<TResult>(list, '')
|
||||
result = _.takeRightWhile<TResult>(list, '', any);
|
||||
result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42});
|
||||
|
||||
result = _(array).takeRightWhile().value();
|
||||
result = _(array).takeRightWhile(predicateFn).value();
|
||||
result = _(array).takeRightWhile(predicateFn, any).value();
|
||||
result = _(array).takeRightWhile('').value();
|
||||
result = _(array).takeRightWhile('', any).value();
|
||||
result = _(array).takeRightWhile<{a: number;}>({a: 42}).value();
|
||||
|
||||
result = _(list).takeRightWhile<TResult>().value();
|
||||
result = _(list).takeRightWhile<TResult>(predicateFn).value();
|
||||
result = _(list).takeRightWhile<TResult>(predicateFn, any).value();
|
||||
result = _(list).takeRightWhile<TResult>('').value();
|
||||
result = _(list).takeRightWhile<TResult>('', any).value();
|
||||
result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number[]>_([1, 2, 3]).union([101, 2, 1, 10], [2, 1]).value();
|
||||
@@ -533,21 +726,29 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v
|
||||
}
|
||||
|
||||
// _.xor
|
||||
var testXorArray: number[];
|
||||
var testXorList: _.List<number>;
|
||||
result = <number[]>_.xor<number>();
|
||||
result = <number[]>_.xor<number>(testXorArray);
|
||||
result = <number[]>_.xor<number>(testXorArray, testXorArray);
|
||||
result = <number[]>_.xor<number>(testXorArray, testXorArray, testXorArray);
|
||||
result = <number[]>_.xor<number>(testXorList);
|
||||
result = <number[]>_.xor<number>(testXorList, testXorList);
|
||||
result = <number[]>_.xor<number>(testXorList, testXorList, testXorList);
|
||||
result = <number[]>(_(testXorArray).xor().value());
|
||||
result = <number[]>(_(testXorArray).xor(testXorArray).value());
|
||||
result = <number[]>(_(testXorArray).xor(testXorArray, testXorArray).value());
|
||||
result = <number[]>(_(testXorList).xor().value());
|
||||
result = <number[]>(_(testXorList).xor(testXorList).value());
|
||||
result = <number[]>(_(testXorList).xor(testXorList, testXorList).value());
|
||||
module TestXor {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.xor<TResult>();
|
||||
|
||||
result = _.xor<TResult>(array);
|
||||
result = _.xor<TResult>(array, list);
|
||||
result = _.xor<TResult>(array, list, array);
|
||||
|
||||
result = _.xor<TResult>(list);
|
||||
result = _.xor<TResult>(list, array);
|
||||
result = _.xor<TResult>(list, array, list);
|
||||
|
||||
result = _(array).xor().value();
|
||||
result = _(array).xor(list).value();
|
||||
result = _(array).xor(list, array).value();
|
||||
|
||||
result = _(list).xor<TResult>().value();
|
||||
result = _(list).xor<TResult>(array).value();
|
||||
result = _(list).xor<TResult>(array, list).value();
|
||||
}
|
||||
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
@@ -650,6 +851,54 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
|
||||
* Collection *
|
||||
**************/
|
||||
|
||||
// _.all
|
||||
module TestAll {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let dictionary: _.Dictionary<TResult>;
|
||||
|
||||
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => boolean;
|
||||
|
||||
let result: boolean;
|
||||
|
||||
result = _.all<TResult>(array);
|
||||
result = _.all<TResult>(array, listIterator);
|
||||
result = _.all<TResult>(array, listIterator, any);
|
||||
result = _.all<TResult>(array, '');
|
||||
result = _.all<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.all<TResult>(list);
|
||||
result = _.all<TResult>(list, listIterator);
|
||||
result = _.all<TResult>(list, listIterator, any);
|
||||
result = _.all<TResult>(list, '');
|
||||
result = _.all<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _.all<TResult>(dictionary);
|
||||
result = _.all<TResult>(dictionary, dictionaryIterator);
|
||||
result = _.all<TResult>(dictionary, dictionaryIterator, any);
|
||||
result = _.all<TResult>(dictionary, '');
|
||||
result = _.all<{a: number}, TResult>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).all();
|
||||
result = _(array).all(listIterator);
|
||||
result = _(array).all(listIterator, any);
|
||||
result = _(array).all('');
|
||||
result = _(array).all<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).all<TResult>();
|
||||
result = _(list).all<TResult>(listIterator);
|
||||
result = _(list).all<TResult>(listIterator, any);
|
||||
result = _(list).all('');
|
||||
result = _(list).all<{a: number}>({a: 42});
|
||||
|
||||
result = _(dictionary).all<TResult>();
|
||||
result = _(dictionary).all<TResult>(dictionaryIterator);
|
||||
result = _(dictionary).all<TResult>(dictionaryIterator, any);
|
||||
result = _(dictionary).all('');
|
||||
result = _(dictionary).all<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.at
|
||||
{
|
||||
let testAtArray: TResult[];
|
||||
@@ -747,13 +996,53 @@ result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
|
||||
|
||||
result = <boolean>_.every([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.every(stoogesAges, 'age');
|
||||
result = <boolean>_.every(stoogesAges, { 'age': 50 });
|
||||
// _.every
|
||||
module TestEvery {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let dictionary: _.Dictionary<TResult>;
|
||||
|
||||
result = <boolean>_.all([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.all(stoogesAges, 'age');
|
||||
result = <boolean>_.all(stoogesAges, { 'age': 50 });
|
||||
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => boolean;
|
||||
|
||||
let result: boolean;
|
||||
|
||||
result = _.every<TResult>(array);
|
||||
result = _.every<TResult>(array, listIterator);
|
||||
result = _.every<TResult>(array, listIterator, any);
|
||||
result = _.every<TResult>(array, '');
|
||||
result = _.every<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.every<TResult>(list);
|
||||
result = _.every<TResult>(list, listIterator);
|
||||
result = _.every<TResult>(list, listIterator, any);
|
||||
result = _.every<TResult>(list, '');
|
||||
result = _.every<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _.every<TResult>(dictionary);
|
||||
result = _.every<TResult>(dictionary, dictionaryIterator);
|
||||
result = _.every<TResult>(dictionary, dictionaryIterator, any);
|
||||
result = _.every<TResult>(dictionary, '');
|
||||
result = _.every<{a: number}, TResult>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).every();
|
||||
result = _(array).every(listIterator);
|
||||
result = _(array).every(listIterator, any);
|
||||
result = _(array).every('');
|
||||
result = _(array).every<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).every<TResult>();
|
||||
result = _(list).every<TResult>(listIterator);
|
||||
result = _(list).every<TResult>(listIterator, any);
|
||||
result = _(list).every('');
|
||||
result = _(list).every<{a: number}>({a: 42});
|
||||
|
||||
result = _(dictionary).every<TResult>();
|
||||
result = _(dictionary).every<TResult>(dictionaryIterator);
|
||||
result = _(dictionary).every<TResult>(dictionaryIterator, any);
|
||||
result = _(dictionary).every('');
|
||||
result = _(dictionary).every<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
result = <number[]>_.filter([1, 2, 3, 4, 5, 6]);
|
||||
result = <number[]>_.filter([1, 2, 3, 4, 5, 6], function (num) { return num % 2 == 0; });
|
||||
@@ -1766,9 +2055,46 @@ var TestDefaultsDeepSource = {'user': {'name': 'fred', 'age': 36}};
|
||||
result = <DefaultsDeepResult>_.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource);
|
||||
result = <DefaultsDeepResult>_(TestDefaultsDeepObject).defaultsDeep<DefaultsDeepResult>(TestDefaultsDeepSource).value();
|
||||
|
||||
result = <string>_.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function (num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
// _.findKey
|
||||
module TestFindKey {
|
||||
let result: string;
|
||||
|
||||
{
|
||||
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''});
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''}, predicateFn);
|
||||
result = _.findKey<{a: string;}>({a: ''}, predicateFn, any);
|
||||
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''}, '');
|
||||
result = _.findKey<{a: string;}>({a: ''}, '', any);
|
||||
|
||||
result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42});
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey();
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).findKey(predicateFn, any);
|
||||
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey('');
|
||||
result = _<{a: string;}>({a: ''}).findKey('', any);
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let predicateFn: (value: string, key?: string, collection?: _.Dictionary<string>) => boolean;
|
||||
|
||||
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn);
|
||||
result = _.findKey<string, {a: string;}>({a: ''}, predicateFn, any);
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).findKey<string>(predicateFn, any);
|
||||
}
|
||||
}
|
||||
|
||||
result = <string>_.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function (num) {
|
||||
return num % 2 == 1;
|
||||
@@ -2412,6 +2738,41 @@ result = <() => {}>_({}).constant<{}>();
|
||||
result = _({}).iteratee(any).value();
|
||||
}
|
||||
|
||||
// _.matches
|
||||
module TestMatches {
|
||||
let source: TResult;
|
||||
|
||||
{
|
||||
let result: (value: any) => boolean;
|
||||
result = _.matches<TResult>(source);
|
||||
result = _(source).matches().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: (value: TResult) => boolean;
|
||||
result = _.matches<TResult, TResult>(source);
|
||||
result = _(source).matches<TResult>().value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.matchesProperty
|
||||
module TestMatches {
|
||||
let path: {toString(): string;}|{toString(): string;}[];
|
||||
let source: TResult;
|
||||
|
||||
{
|
||||
let result: (value: any) => boolean;
|
||||
result = _.matchesProperty<TResult>(path, source);
|
||||
result = _(path).matchesProperty<TResult>(source).value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: (value: TResult) => boolean;
|
||||
result = _.matchesProperty<TResult, TResult>(path, source);
|
||||
result = _(path).matchesProperty<TResult, TResult>(source).value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.method
|
||||
class TestMethod {
|
||||
a = {
|
||||
|
||||
Vendored
+775
-416
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="markitup.d.ts" />
|
||||
|
||||
// https://github.com/markitup/1.x/blob/master/markitup/sets/default/set.js
|
||||
var mySettings = {
|
||||
onShiftEnter: {
|
||||
keepDefault: false,
|
||||
replaceWith: '<br />\n'
|
||||
},
|
||||
onCtrlEnter: {
|
||||
keepDefault: false,
|
||||
openWith: '\n<p>',
|
||||
closeWith: '</p>'
|
||||
},
|
||||
onTab: {
|
||||
keepDefault: false,
|
||||
replaceWith: ' '
|
||||
},
|
||||
markupSet: [
|
||||
{
|
||||
name: 'Bold',
|
||||
key: 'B',
|
||||
openWith: '(!(<strong>|!|<b>)!)',
|
||||
closeWith: '(!(</strong>|!|</b>)!)'
|
||||
},
|
||||
{
|
||||
name: 'Italic',
|
||||
key: 'I',
|
||||
openWith: '(!(<em>|!|<i>)!)',
|
||||
closeWith: '(!(</em>|!|</i>)!)'
|
||||
},
|
||||
{
|
||||
name: 'Stroke through',
|
||||
key: 'S',
|
||||
openWith: '<del>',
|
||||
closeWith: '</del>'
|
||||
},
|
||||
{separator: '---------------'},
|
||||
{
|
||||
name: 'Bulleted List',
|
||||
openWith: ' <li>',
|
||||
closeWith: '</li>',
|
||||
multiline: true,
|
||||
openBlockWith: '<ul>\n',
|
||||
closeBlockWith: '\n</ul>'
|
||||
},
|
||||
{
|
||||
name: 'Numeric List',
|
||||
openWith: ' <li>',
|
||||
closeWith: '</li>',
|
||||
multiline: true,
|
||||
openBlockWith: '<ol>\n',
|
||||
closeBlockWith: '\n</ol>'
|
||||
},
|
||||
{
|
||||
separator: '---------------'
|
||||
},
|
||||
{
|
||||
name: 'Picture',
|
||||
key: 'P',
|
||||
replaceWith: '<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />'
|
||||
},
|
||||
{
|
||||
name: 'Link',
|
||||
key: 'L',
|
||||
openWith: '<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>',
|
||||
closeWith: '</a>',
|
||||
placeHolder: 'Your text to link...'
|
||||
},
|
||||
{
|
||||
separator: '---------------'
|
||||
},
|
||||
{
|
||||
name: 'Clean',
|
||||
className: 'clean',
|
||||
replaceWith: (markitup: MarkItUp.MarkupSet): string => {
|
||||
return markitup.selection.replace(/<(.*?)>/g, "")
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Preview',
|
||||
className: 'preview',
|
||||
call: 'preview'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// http://markitup.jaysalvat.com/documentation/
|
||||
$('#markItUp').markItUp(mySettings);
|
||||
Vendored
+237
@@ -0,0 +1,237 @@
|
||||
// Type definitions for markitup 1.x
|
||||
// Project: https://github.com/markitup/1.x
|
||||
// Definitions by: drillbits <https://github.com/drillbits>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module MarkItUp {
|
||||
interface Options {
|
||||
/**
|
||||
* Apply a specific className to the wrapping Div. Useful to prevent CSS conflicts between instances.
|
||||
*/
|
||||
nameSpace?: string;
|
||||
|
||||
/**
|
||||
* Enable/Disable the handle to resize the editor.
|
||||
*/
|
||||
resizeHandle?: boolean;
|
||||
|
||||
/**
|
||||
* Display the preview in a popup window with comma-separated list of specs. If empty or false, the preview will be displayed in the built-in iFrame preview.
|
||||
*/
|
||||
previewInWindow?: string;
|
||||
|
||||
/**
|
||||
* AutoRefresh the preview iFrame or window when the editor is used.
|
||||
*/
|
||||
previewAutoRefresh?: boolean;
|
||||
|
||||
/**
|
||||
* You can set the path of your own parser to preview markup languages other than html. If this property is set, the built-in preview will be overridden by your own preview script.
|
||||
* Use ~/ for markItUp! root.
|
||||
*/
|
||||
previewParserPath?: string;
|
||||
|
||||
/**
|
||||
* Name of the var posted with the editor content to the parser defined above.
|
||||
*
|
||||
* default: 'data'
|
||||
*/
|
||||
previewParserVar?: string;
|
||||
|
||||
/**
|
||||
* Path to the Html preview template.
|
||||
* Use ~/ for markItUp! root.
|
||||
*
|
||||
* default: '~/templates/preview.html'
|
||||
*/
|
||||
previewTemplatePath?: string;
|
||||
|
||||
/**
|
||||
* Parse the content with the javascript parser of your choice before passing it to the preview.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
previewParser?: boolean;
|
||||
|
||||
/**
|
||||
* Position of the Built-in preview before or after the main textarea.
|
||||
* 'before'|'after'
|
||||
*
|
||||
* default: 'after'
|
||||
*/
|
||||
previewPosition?: string;
|
||||
|
||||
/**
|
||||
* Define what to do when Enter key is pressed.
|
||||
*/
|
||||
onEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Ctrl+Enter keys are pressed.
|
||||
*/
|
||||
onCtrlEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Shift+Enter keys are pressed.
|
||||
*/
|
||||
onShiftEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Tab key is pressed. Warning, this key is also used to jump at the end of a new inserted markup.
|
||||
*/
|
||||
onTab?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Function to be called before any markup insertion.
|
||||
*/
|
||||
beforeInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called after any markup insertion.
|
||||
*/
|
||||
afterInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Note that most of the settings below are used by the engine for all insertion calls ($.markItUp( {} ), onEnter, onShiftEnter, onCtrlEnter, onTab) except exclusive button properties marked by
|
||||
*/
|
||||
markupSet?: MarkupSet[];
|
||||
}
|
||||
|
||||
interface MarkupSet {
|
||||
/**
|
||||
* Button name
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Classname to be applied to this very button.
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* Shortcut key to be applied to the button. Ctrl+key trigger the action of a button.
|
||||
*/
|
||||
key?: string;
|
||||
|
||||
/**
|
||||
* Markup to be added before selection. Accepts functions.
|
||||
*/
|
||||
openWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Markup to be added after selection. Accepts functions.
|
||||
*/
|
||||
closeWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added in place of the cursor or selection. Accepts functions.
|
||||
*/
|
||||
replaceWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added before a whole block. Accepts functions.
|
||||
*/
|
||||
openBlockWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added after a whole block. Accepts functions.
|
||||
*/
|
||||
closeBlockWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Set whether the tags has to be inserted at each line or on the whole selected block.
|
||||
*/
|
||||
multiline?: boolean;
|
||||
|
||||
/**
|
||||
* Placeholder text to be inserted if no text is selected by the user.
|
||||
*/
|
||||
placeHolder?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Function to be called just before a markup insertion. If a global beforeInsert callback is already defined this function is fired just after.
|
||||
*/
|
||||
beforeInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called just after a markup insertion. If a global afterInsert callback is already defined this function is fired before.
|
||||
*/
|
||||
afterInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called before a multiline markup insertion.
|
||||
*/
|
||||
beforeMultiInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called after a multiline markup insertion.
|
||||
*/
|
||||
afterMultiInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Open a dropdown menu with another button set.
|
||||
*/
|
||||
dropMenu?: MarkupSet[];
|
||||
|
||||
/**
|
||||
* Keep (true) or not (false) the default behaviour of the key.
|
||||
*/
|
||||
keepDefault?: boolean;
|
||||
|
||||
/**
|
||||
* Returns the selection.
|
||||
*/
|
||||
selection?: string;
|
||||
|
||||
/**
|
||||
* Returns the textarea object.
|
||||
*/
|
||||
textarea?: HTMLElement;
|
||||
|
||||
/**
|
||||
* Returns the position of the selection.
|
||||
*/
|
||||
caretPosition?: number;
|
||||
|
||||
/**
|
||||
* Returns the position of the scrollbar.
|
||||
*/
|
||||
scrollPosition?: number;
|
||||
|
||||
/**
|
||||
* If a multi-line edition is trigged (Ctrl + Shift + click). This property return the number of the line being processed.
|
||||
*/
|
||||
line?: number;
|
||||
|
||||
/**
|
||||
* Returns true if the Control key is pressed when the callback is fired.
|
||||
*/
|
||||
ctrlKey?: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the Shift key is pressed when the callback is fired.
|
||||
*/
|
||||
shiftKey?: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the Alt key is pressed when the callback is fired.
|
||||
*/
|
||||
altKey?: boolean;
|
||||
}
|
||||
|
||||
interface Static {
|
||||
(): JQuery;
|
||||
(settings: Options): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
markItUp: MarkItUp.Static;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
markItUp(settings?: MarkItUp.Options): JQuery;
|
||||
markItUpRemove(): JQuery;
|
||||
}
|
||||
@@ -0,0 +1,476 @@
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='material-ui-0.11.1.d.ts' />
|
||||
|
||||
import * as React from "react/addons";
|
||||
import mui = require("material-ui");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
import IconButton = require("material-ui/lib/icon-button");
|
||||
import FlatButton = require("material-ui/lib/flat-button");
|
||||
import Avatar = require("material-ui/lib/avatar");
|
||||
import FontIcon = require("material-ui/lib/font-icon");
|
||||
import Typography = require("material-ui/lib/styles/typography");
|
||||
import RaisedButton = require("material-ui/lib/raised-button");
|
||||
import FloatingActionButton = require("material-ui/lib/floating-action-button");
|
||||
import Card = require("material-ui/lib/card/card");
|
||||
import CardHeader = require("material-ui/lib/card/card-header");
|
||||
import CardText = require("material-ui/lib/card/card-text");
|
||||
import CardActions = require("material-ui/lib/card/card-actions");
|
||||
import Dialog = require("material-ui/lib/dialog");
|
||||
import DropDownMenu = require("material-ui/lib/drop-down-menu");
|
||||
import RadioButtonGroup = require("material-ui/lib/radio-button-group");
|
||||
import RadioButton = require("material-ui/lib/radio-button");
|
||||
import Toggle = require("material-ui/lib/toggle");
|
||||
import TextField = require("material-ui/lib/text-field");
|
||||
import SelectField = require("material-ui/lib/select-field");
|
||||
import IconMenu = require("material-ui/lib/menus/icon-menu");
|
||||
import Menu = require('material-ui/lib/menus/menu');
|
||||
import MenuItem = require('material-ui/lib/menus/menu-item');
|
||||
import MenuDivider = require('material-ui/lib/menus/menu-divider');
|
||||
|
||||
import NavigationClose = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/navigation/close", but they aren't defined yet.
|
||||
import FileFolder = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/file/folder", but they aren't defined yet.
|
||||
import ToggleStar = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star", but they aren't defined yet.
|
||||
import ActionGrade = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/action/grade", but they aren't defined yet.
|
||||
import ToggleStarBorder = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star-border", but they aren't defined yet.
|
||||
import ArrowDropRight = require("material-ui/lib/svg-icon"); // TODO: Should actually import the actual "material-ui/lib/svg-icons/toggle/star-border", but they aren't defined yet.
|
||||
|
||||
class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin {
|
||||
|
||||
// injected with mixin
|
||||
linkState: <T>(key: string) => React.ReactLink<T>;
|
||||
dialog: mui.Dialog;
|
||||
//dialog2: Dialog; // can't get type directly from require("material-ui/lib/dialog");
|
||||
|
||||
private touchTapEventHandler(e: __MaterialUI.TouchTapEvent) {
|
||||
this.dialog.show();
|
||||
//this.dialog2.show();
|
||||
}
|
||||
private formEventHandler(e: React.FormEvent) {
|
||||
}
|
||||
private selectFieldChangeHandler(e: __MaterialUI.TouchTapEvent, si: number, mi: any) {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
// "http://material-ui.com/#/customization/themes"
|
||||
let ThemeManager = new mui.Styles.ThemeManager();
|
||||
ThemeManager.setTheme(ThemeManager.types.LIGHT);
|
||||
ThemeManager.setTheme(ThemeManager.types.DARK);
|
||||
let muiTheme = ThemeManager.getCurrentTheme();
|
||||
ThemeManager.setComponentThemes({
|
||||
toggle: {
|
||||
thumbOnColor: "#00bcd4",
|
||||
trackOnColor: "LightCyan",
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/customization/inline-styles"
|
||||
let Checkbox = mui.Checkbox;
|
||||
let element: React.ReactElement<any>;
|
||||
element = <Checkbox
|
||||
id="checkboxId1"
|
||||
name="checkboxName1"
|
||||
value="checkboxValue1"
|
||||
label="went for a run today"
|
||||
style={{
|
||||
width: '50%',
|
||||
margin: '0 auto'
|
||||
}}
|
||||
iconStyle={{
|
||||
fill: '#FF4081'
|
||||
}}/>
|
||||
element = React.createElement<__MaterialUI.CheckboxProps>(Checkbox, {
|
||||
id: "checkboxId1", name: "checkboxName1", value: "checkboxValue1", label: "went for a run today", style: {
|
||||
width: '50%',
|
||||
margin: '0 auto'
|
||||
}, iconStyle: {
|
||||
fill: '#FF4081'
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/customization/colors"
|
||||
ThemeManager.setComponentThemes({
|
||||
toggle: {
|
||||
thumbOnColor: Colors.cyan200,
|
||||
thumbOffColor: Colors.grey400,
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/components/appbar"
|
||||
element = <AppBar
|
||||
title="Title"
|
||||
iconClassNameRight="muidocs-icon-navigation-expand-more" />
|
||||
element = <AppBar
|
||||
title="Title"
|
||||
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
|
||||
iconElementRight={<FlatButton label="Save" />} />;
|
||||
|
||||
// "http://material-ui.com/#/components/avatars"
|
||||
//image avatar
|
||||
element = <Avatar src="images/uxceo-128.jpg" />;
|
||||
//SvgIcon avatar
|
||||
element = <Avatar icon={<FileFolder />} />;
|
||||
//SvgIcon avatar with custom colors
|
||||
element = <Avatar
|
||||
icon={<FileFolder />}
|
||||
color={Colors.orange200}
|
||||
backgroundColor={Colors.pink400} />;
|
||||
//FontIcon avatar
|
||||
element = <Avatar
|
||||
icon={
|
||||
<FontIcon className="muidocs-icon-communication-voicemail" />
|
||||
} />;
|
||||
//FontIcon avatar with custom colors
|
||||
element = <Avatar
|
||||
icon={<FontIcon className="muidocs-icon-communication-voicemail" />}
|
||||
color={Colors.blue300}
|
||||
backgroundColor={Colors.indigo900} />;
|
||||
//Letter avatar
|
||||
element = <Avatar>A</Avatar>;
|
||||
//Letter avatar with custom colors
|
||||
element = <Avatar
|
||||
color={Colors.deepOrange300}
|
||||
backgroundColor={Colors.purple500}>
|
||||
</Avatar>
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/buttons"
|
||||
element = <FlatButton linkButton={true} href="https://github.com/callemall/material-ui" secondary={true} label="GitHub">
|
||||
<FontIcon style={{ color: Typography.textFullWhite }} className="muidocs-icon-custom-github"/>
|
||||
</FlatButton>;
|
||||
element = <RaisedButton linkButton={true} href="https://github.com/callemall/material-ui" secondary={true} label="GitHub">
|
||||
<FontIcon style={{ color: Typography.textFullWhite }} className="muidocs-icon-custom-github"/>
|
||||
</RaisedButton>;
|
||||
element = <FloatingActionButton secondary={true} mini={true} linkButton={true}
|
||||
href="https://github.com/callemall/material-ui" >
|
||||
<ToggleStar />
|
||||
</FloatingActionButton>;
|
||||
|
||||
// "http://material-ui.com/#/components/cards"
|
||||
element = <Card initiallyExpanded={true}>
|
||||
<CardHeader
|
||||
title="Title"
|
||||
subtitle="Subtitle"
|
||||
avatar={<Avatar style={{ color: 'red' }}>A</Avatar>}
|
||||
showExpandableButton={true}>
|
||||
</CardHeader>
|
||||
<CardText expandable={true}>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
</CardText>
|
||||
<CardActions expandable={true}>
|
||||
<FlatButton label="Action1"/>
|
||||
<FlatButton label="Action2"/>
|
||||
</CardActions>
|
||||
<CardText expandable={true}>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
</CardText>
|
||||
</Card>;
|
||||
|
||||
// "http://material-ui.com/#/components/date-picker"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/dialog"
|
||||
let standardActions = [
|
||||
{ text: 'Cancel' },
|
||||
{ text: 'Submit', onTouchTap: this.touchTapEventHandler, ref: 'submit' }
|
||||
];
|
||||
|
||||
element = <Dialog
|
||||
title="Dialog With Standard Actions"
|
||||
actions={standardActions}
|
||||
actionFocus="submit"
|
||||
modal={true}>
|
||||
The actions in this window are created from the json that's passed in.
|
||||
</Dialog>;
|
||||
|
||||
//Custom Actions
|
||||
let customActions = [
|
||||
<FlatButton
|
||||
label="Cancel"
|
||||
secondary={true}
|
||||
onTouchTap={this.touchTapEventHandler} />,
|
||||
<FlatButton
|
||||
label="Submit"
|
||||
primary={true}
|
||||
onTouchTap={this.touchTapEventHandler} />
|
||||
];
|
||||
|
||||
element = <Dialog
|
||||
title="Dialog With Custom Actions"
|
||||
actions={customActions}
|
||||
modal={false}
|
||||
autoDetectWindowHeight={true}
|
||||
autoScrollBodyContent={true}>
|
||||
The actions in this window were passed in as an array of react objects.
|
||||
</Dialog>;
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/dropdown-menu"
|
||||
let menuItems = [
|
||||
{ payload: '1', text: 'Never' },
|
||||
{ payload: '2', text: 'Every Night' },
|
||||
{ payload: '3', text: 'Weeknights' },
|
||||
{ payload: '4', text: 'Weekends' },
|
||||
{ payload: '5', text: 'Weekly' },
|
||||
];
|
||||
element = <DropDownMenu menuItems={menuItems} />;
|
||||
|
||||
// "http://material-ui.com/#/components/icons"
|
||||
element = <FontIcon className= "material-icons" color= { Colors.red500 } > home</FontIcon>;
|
||||
|
||||
// "http://material-ui.com/#/components/icon-buttons"
|
||||
//Method 1: muidocs-icon-github is defined in a style sheet.
|
||||
element = <IconButton iconClassName="muidocs-icon-custom-github" tooltip="GitHub"/>;
|
||||
//Method 2: ActionGrade is a component created using mui.SvgIcon.
|
||||
element = <IconButton tooltip= "Star" touch= { true}>
|
||||
<ActionGrade/>
|
||||
</IconButton >;
|
||||
//Method 3: Manually creating a mui.FontIcon component within IconButton
|
||||
element = <IconButton tooltip= "Sort" disabled= {true}>
|
||||
<FontIcon className="muidocs-icon-custom-sort"/>
|
||||
</IconButton>;
|
||||
//Method 4: Using Google material-icons
|
||||
element = <IconButton iconClassName="material-icons" tooltipPosition="bottom-center"
|
||||
tooltip="Sky">settings_system_daydream</IconButton>;
|
||||
|
||||
// "http://material-ui.com/#/components/icon-menus"
|
||||
element = <IconMenu iconButtonElement={<IconButton />}>
|
||||
<MenuItem primaryText="Refresh" />
|
||||
<MenuItem primaryText="Send feedback" />
|
||||
<MenuItem primaryText="Settings" />
|
||||
<MenuItem primaryText="Help" />
|
||||
<MenuItem primaryText="Sign out" />
|
||||
</IconMenu>;
|
||||
|
||||
// "http://material-ui.com/#/components/left-nav"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/lists"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/menus"
|
||||
element = <Menu>
|
||||
<MenuItem primaryText="Maps" />
|
||||
<MenuItem primaryText="Books" />
|
||||
<MenuItem primaryText="Flights" />
|
||||
<MenuItem primaryText="Apps" />
|
||||
</Menu>;
|
||||
element = <Menu desktop={true} width={320}>
|
||||
<MenuItem primaryText="Bold" secondaryText="⌘B" />
|
||||
<MenuItem primaryText="Italic" secondaryText="⌘I" />
|
||||
<MenuItem primaryText="Underline" secondaryText="⌘U" />
|
||||
<MenuItem primaryText="Strikethrough" secondaryText="Alt+Shift+5" />
|
||||
<MenuItem primaryText="Superscript" secondaryText="⌘." />
|
||||
<MenuItem primaryText="Subscript" secondaryText="⌘," />
|
||||
<MenuDivider />
|
||||
<MenuItem primaryText="Paragraph styles" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Align" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Line spacing" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="Numbered list" rightIcon={<ArrowDropRight />} />
|
||||
<MenuItem primaryText="List options" rightIcon={<ArrowDropRight />} />
|
||||
<MenuDivider />
|
||||
<MenuItem primaryText="Clear formatting" secondaryText="⌘/" />
|
||||
</Menu>;
|
||||
|
||||
// "http://material-ui.com/#/components/paper"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/progress"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/refresh-indicator"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/sliders"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/switches"
|
||||
element = <Checkbox
|
||||
name="checkboxName2"
|
||||
value="checkboxValue2"
|
||||
label="fed the dog"
|
||||
defaultChecked={true}/>;
|
||||
element = <Checkbox
|
||||
name = "checkboxName3"
|
||||
value = "checkboxValue3"
|
||||
label = "built a house on the moon"
|
||||
disabled = {true}/>;
|
||||
element = <Checkbox
|
||||
name="checkboxName4"
|
||||
value="checkboxValue4"
|
||||
checkedIcon={<ToggleStar />}
|
||||
unCheckedIcon={<ToggleStarBorder />}
|
||||
label="custom icon" />;
|
||||
|
||||
element = <RadioButtonGroup name="shipSpeed" defaultSelected="not_light">
|
||||
<RadioButton
|
||||
value="light"
|
||||
label="prepare for light speed"
|
||||
style={{ marginBottom: 16 }} />;
|
||||
<RadioButton
|
||||
value="not_light"
|
||||
label="light speed too slow"
|
||||
style={{ marginBottom: 16 }}/>;
|
||||
<RadioButton
|
||||
value="ludicrous"
|
||||
label="go to ludicrous speed"
|
||||
style={{ marginBottom: 16 }}
|
||||
disabled={true}/>
|
||||
</RadioButtonGroup>;
|
||||
|
||||
element = <Toggle
|
||||
name="toggleName1"
|
||||
value="toggleValue1"
|
||||
label="activate thrusters"/>;
|
||||
|
||||
element = <Toggle
|
||||
name = "toggleName2"
|
||||
value = "toggleValue2"
|
||||
label = "auto-pilot"
|
||||
defaultToggled = { true}/>;
|
||||
|
||||
element = <Toggle
|
||||
name="toggleName3"
|
||||
value="toggleValue3"
|
||||
label="initiate self-destruct sequence"
|
||||
disabled={true}/>;
|
||||
|
||||
// "http://material-ui.com/#/components/snackbar"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/table"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/tabs"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/text-fields"
|
||||
element = <TextField
|
||||
hintText="Hint Text" />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
defaultValue="Default Value" />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
value = { "value" }
|
||||
underlineStyle = {{ borderColor: Colors.green500 }}
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Custom Underline Focus Color"
|
||||
underlineFocusStyle={{ borderColor: Colors.amber900 }} />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
valueLink = { this.linkState<string>('valueLinkValue') } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text (MultiLine)"
|
||||
multiLine={true} />;
|
||||
element = <TextField
|
||||
hintText = "The hint text can be as long as you want, it will wrap."
|
||||
multiLine = { true} />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
errorText="The error text can be as long as you want, it will wrap." />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
errorText = { "error text" }
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text (custom error color)"
|
||||
errorText={"error text"}
|
||||
errorStyle={{ color: 'orange' }}
|
||||
onChange={ this.formEventHandler }
|
||||
defaultValue="Custom error color" />;
|
||||
element = <TextField
|
||||
hintText = "Disabled Hint Text"
|
||||
disabled = { true} />;
|
||||
element = <TextField
|
||||
hintText="Disabled Hint Text"
|
||||
disabled={true}
|
||||
defaultValue="Disabled With Value" />;
|
||||
|
||||
//Select Fields
|
||||
let arbitraryArrayMenuItems = [
|
||||
{
|
||||
id: 0,
|
||||
name: "zero",
|
||||
},
|
||||
];
|
||||
element = <SelectField
|
||||
value = { 0 }
|
||||
onChange = { this.selectFieldChangeHandler }
|
||||
hintText = "Hint Text"
|
||||
menuItems = { menuItems } />;
|
||||
element = <SelectField
|
||||
valueLink={this.linkState('selectValueLinkValue') }
|
||||
floatingLabelText="Float Label Text"
|
||||
valueMember="id"
|
||||
displayMember="name"
|
||||
menuItems={arbitraryArrayMenuItems} />;
|
||||
element = <SelectField
|
||||
valueLink = { this.linkState('selectValueLinkValue2') }
|
||||
floatingLabelText = "Float Custom Label Text"
|
||||
floatingLabelStyle = {{ color: "red" }}
|
||||
valueMember = "id"
|
||||
displayMember = "name"
|
||||
menuItems = { arbitraryArrayMenuItems } />;
|
||||
element = <SelectField
|
||||
value={0}
|
||||
onChange={ this.selectFieldChangeHandler }
|
||||
menuItems={arbitraryArrayMenuItems} />;
|
||||
|
||||
//Floating Hint Text Labels
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
floatingLabelText = "Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
defaultValue="Default Value"
|
||||
floatingLabelText="Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
value = { "value" }
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
floatingLabelText="Floating Label Text"
|
||||
valueLink={this.linkState<string>('floatingValueLinkValue') } />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text (MultiLine)"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
multiLine = { true} />;
|
||||
element = <TextField
|
||||
hintText="Hint Text"
|
||||
errorText={"floating text"}
|
||||
floatingLabelText="Floating Label Text"
|
||||
onChange={this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText = "Hint Text"
|
||||
errorText = { "error text" }
|
||||
defaultValue = "abc"
|
||||
floatingLabelText = "Floating Label Text"
|
||||
onChange = { this.formEventHandler } />;
|
||||
element = <TextField
|
||||
hintText="Disabled Hint Text"
|
||||
disabled={true}
|
||||
floatingLabelText="Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText = "Disabled Hint Text"
|
||||
disabled = { true}
|
||||
defaultValue = "Disabled With Value"
|
||||
floatingLabelText = "Floating Label Text" />;
|
||||
element = <TextField
|
||||
hintText="Password Field"
|
||||
floatingLabelText="Password"
|
||||
type="password" />;
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/time-picker"
|
||||
|
||||
|
||||
// "http://material-ui.com/#/components/toolbars"
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
+2096
File diff suppressed because it is too large
Load Diff
@@ -54,14 +54,13 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
render() {
|
||||
|
||||
// "http://material-ui.com/#/customization/themes"
|
||||
let ThemeManager = new mui.Styles.ThemeManager();
|
||||
ThemeManager.setTheme(ThemeManager.types.LIGHT);
|
||||
ThemeManager.setTheme(ThemeManager.types.DARK);
|
||||
let muiTheme = ThemeManager.getCurrentTheme();
|
||||
ThemeManager.setComponentThemes({
|
||||
toggle: {
|
||||
thumbOnColor: "#00bcd4",
|
||||
trackOnColor: "LightCyan",
|
||||
let ThemeManager = mui.Styles.ThemeManager;
|
||||
let muiTheme: mui.Styles.MuiTheme = ThemeManager.getMuiTheme({
|
||||
palette: {
|
||||
accent1Color: Colors.cyan100
|
||||
},
|
||||
spacing: {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,14 +88,6 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/customization/colors"
|
||||
ThemeManager.setComponentThemes({
|
||||
toggle: {
|
||||
thumbOnColor: Colors.cyan200,
|
||||
thumbOffColor: Colors.grey400,
|
||||
}
|
||||
});
|
||||
|
||||
// "http://material-ui.com/#/components/appbar"
|
||||
element = <AppBar
|
||||
title="Title"
|
||||
|
||||
Vendored
+120
-51
@@ -1,4 +1,4 @@
|
||||
// Type definitions for material-ui v0.11.1
|
||||
// Type definitions for material-ui v0.12.1
|
||||
// Project: https://github.com/callemall/material-ui
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -72,7 +72,7 @@ declare module "material-ui" {
|
||||
export import TableHeaderColumn = __MaterialUI.Table.TableHeaderColumn; // require('material-ui/lib/table/table-header-column');
|
||||
export import TableRow = __MaterialUI.Table.TableRow; // require('material-ui/lib/table/table-row');
|
||||
export import TableRowColumn = __MaterialUI.Table.TableRowColumn; // require('material-ui/lib/table/table-row-column');
|
||||
export import Theme = __MaterialUI.Theme; // require('material-ui/lib/theme');
|
||||
export import ThemeWrapper = __MaterialUI.ThemeWrapper; // require('material-ui/lib/theme-wrapper');
|
||||
export import Toggle = __MaterialUI.Toggle; // require('material-ui/lib/toggle');
|
||||
export import TimePicker = __MaterialUI.TimePicker; // require('material-ui/lib/time-picker');
|
||||
export import TextField = __MaterialUI.TextField; // require('material-ui/lib/text-field');
|
||||
@@ -319,7 +319,7 @@ declare namespace __MaterialUI {
|
||||
minDate?: Date;
|
||||
mode?: string;
|
||||
onDismiss?: () => void;
|
||||
|
||||
|
||||
// e is always null
|
||||
onChange?: (e: any, d: Date) => void;
|
||||
|
||||
@@ -350,6 +350,7 @@ declare namespace __MaterialUI {
|
||||
}
|
||||
|
||||
export interface DialogAction {
|
||||
id?: string;
|
||||
text: string;
|
||||
ref?: string;
|
||||
|
||||
@@ -654,7 +655,7 @@ declare namespace __MaterialUI {
|
||||
export class Overlay extends React.Component<OverlayProps, {}> {
|
||||
}
|
||||
|
||||
interface PaperProps extends React.Props<Paper> {
|
||||
interface PaperProps extends React.HTMLAttributesBase<Paper> {
|
||||
circle?: boolean;
|
||||
rounded?: boolean;
|
||||
transitionEnabled?: boolean;
|
||||
@@ -672,7 +673,7 @@ declare namespace __MaterialUI {
|
||||
labelPosition?: string;
|
||||
style?: React.CSSProperties;
|
||||
value?: string;
|
||||
|
||||
|
||||
onCheck?: (e: React.FormEvent, selected: string) => void;
|
||||
}
|
||||
export class RadioButton extends React.Component<RadioButtonProps, {}> {
|
||||
@@ -843,23 +844,29 @@ declare namespace __MaterialUI {
|
||||
desktopToolbarHeight?: number;
|
||||
}
|
||||
interface ThemePalette {
|
||||
primary1Color?: string,
|
||||
primary2Color?: string,
|
||||
primary3Color?: string,
|
||||
accent1Color?: string,
|
||||
accent2Color?: string,
|
||||
accent3Color?: string,
|
||||
textColor?: string,
|
||||
canvasColor?: string,
|
||||
borderColor?: string,
|
||||
disabledColor?: string
|
||||
primary1Color?: string;
|
||||
primary2Color?: string;
|
||||
primary3Color?: string;
|
||||
accent1Color?: string;
|
||||
accent2Color?: string;
|
||||
accent3Color?: string;
|
||||
textColor?: string;
|
||||
canvasColor?: string;
|
||||
borderColor?: string;
|
||||
disabledColor?: string;
|
||||
alternateTextColor?: string;
|
||||
}
|
||||
interface Theme {
|
||||
interface MuiTheme {
|
||||
rawTheme: RawTheme;
|
||||
static: boolean;
|
||||
appBar?: {
|
||||
color?: string,
|
||||
textColor?: string,
|
||||
height?: number
|
||||
},
|
||||
avatar?: {
|
||||
borderColor?: string;
|
||||
}
|
||||
button?: {
|
||||
height?: number,
|
||||
minWidth?: number,
|
||||
@@ -900,10 +907,16 @@ declare namespace __MaterialUI {
|
||||
disabledColor?: string,
|
||||
disabledTextColor?: string
|
||||
},
|
||||
inkBar?: {
|
||||
backgroundColor?: string;
|
||||
},
|
||||
leftNav?: {
|
||||
width?: number,
|
||||
color?: string,
|
||||
},
|
||||
listItem?: {
|
||||
nestedLevelDepth?: number;
|
||||
},
|
||||
menu?: {
|
||||
backgroundColor?: string,
|
||||
containerBackgroundColor?: string,
|
||||
@@ -943,6 +956,10 @@ declare namespace __MaterialUI {
|
||||
disabledColor?: string,
|
||||
disabledTextColor?: string
|
||||
},
|
||||
refreshIndicator?: {
|
||||
strokeColor?: string;
|
||||
loadingStrokeColor?: string;
|
||||
};
|
||||
slider?: {
|
||||
trackSize?: number,
|
||||
trackColor?: string,
|
||||
@@ -960,6 +977,38 @@ declare namespace __MaterialUI {
|
||||
backgroundColor?: string,
|
||||
actionColor?: string,
|
||||
},
|
||||
table?: {
|
||||
backgroundColor?: string;
|
||||
};
|
||||
tableHeader?: {
|
||||
borderColor?: string;
|
||||
};
|
||||
tableHeaderColumn?: {
|
||||
textColor?: string;
|
||||
};
|
||||
tableFooter?: {
|
||||
borderColor?: string;
|
||||
textColor?: string;
|
||||
};
|
||||
tableRow?: {
|
||||
hoverColor?: string;
|
||||
stripeColor?: string;
|
||||
selectedColor?: string;
|
||||
textColor?: string;
|
||||
borderColor?: string;
|
||||
};
|
||||
tableRowColumn?: {
|
||||
height?: number;
|
||||
spacing?: number;
|
||||
};
|
||||
timePicker?: {
|
||||
color?: string;
|
||||
textColor?: string;
|
||||
accentColor?: string;
|
||||
clockColor?: string;
|
||||
selectColor?: string;
|
||||
selectTextColor?: string;
|
||||
};
|
||||
toggle?: {
|
||||
thumbOnColor?: string,
|
||||
thumbOffColor?: string,
|
||||
@@ -979,36 +1028,38 @@ declare namespace __MaterialUI {
|
||||
iconColor?: string,
|
||||
separatorColor?: string,
|
||||
menuHoverColor?: string,
|
||||
}
|
||||
}
|
||||
interface CustomTheme {
|
||||
spacing?: Spacing;
|
||||
contentFontFamily?: string;
|
||||
getPalette(): ThemePalette;
|
||||
getComponentThemes(palette: ThemePalette, spacing: Spacing): Theme;
|
||||
}
|
||||
|
||||
export class ThemeManager {
|
||||
static: boolean;
|
||||
spacing: Spacing;
|
||||
palette: ThemePalette;
|
||||
component: Theme;
|
||||
contentFontFamily: string;
|
||||
template: CustomTheme;
|
||||
types: {
|
||||
LIGHT: CustomTheme;
|
||||
DARK: CustomTheme;
|
||||
};
|
||||
|
||||
getCurrentTheme(): ThemeManager;
|
||||
setContentFontFamily(newContentFontFamily: string): void;
|
||||
setTheme(newTheme: CustomTheme): void;
|
||||
setSpacing(newSpacing: Spacing): void;
|
||||
setPalette(newPalette: ThemePalette): void;
|
||||
setComponentThemes(overrides: Theme): void;
|
||||
setIsRtl(isRtl: boolean): void;
|
||||
tabs?: {
|
||||
backgroundColor?: string;
|
||||
};
|
||||
textField?: {
|
||||
textColor?: string;
|
||||
hintColor?: string;
|
||||
floatingLabelColor?: string;
|
||||
disabledTextColor?: string;
|
||||
errorColor?: string;
|
||||
focusColor?: string;
|
||||
backgroundColor?: string;
|
||||
borderColor?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface RawTheme {
|
||||
spacing: Spacing;
|
||||
fontFamily?: string;
|
||||
palette: ThemePalette;
|
||||
}
|
||||
|
||||
export function ThemeDecorator(muiTheme: Styles.MuiTheme): <P>(Component: React.ComponentClass<P>) => React.ComponentClass<P>;
|
||||
|
||||
interface ThemeManager {
|
||||
getMuiTheme(rawTheme: RawTheme): MuiTheme;
|
||||
modifyRawThemeSpacing(muiTheme: MuiTheme, newSpacing: Spacing): MuiTheme;
|
||||
modifyRawThemePalette(muiTheme: MuiTheme, newPaletteKeys: ThemePalette): MuiTheme;
|
||||
modifyRawThemeFontFamily(muiTheme: MuiTheme, newFontFamily: string): MuiTheme;
|
||||
}
|
||||
export var ThemeManager: ThemeManager;
|
||||
|
||||
interface Transitions {
|
||||
easeOut(duration?: string, property?: string | string[], delay?: string, easeFunction?: string): string;
|
||||
create(duration?: string, property?: string, delay?: string, easeFunction?: string): string;
|
||||
@@ -1034,6 +1085,9 @@ declare namespace __MaterialUI {
|
||||
fontStyleButtonFontSize: number;
|
||||
}
|
||||
export var Typography: Typography;
|
||||
|
||||
export var DarkRawTheme: RawTheme;
|
||||
export var LightRawTheme: RawTheme;
|
||||
}
|
||||
|
||||
interface SnackbarProps extends React.Props<Snackbar> {
|
||||
@@ -1054,7 +1108,7 @@ declare namespace __MaterialUI {
|
||||
value?: string;
|
||||
selected?: boolean;
|
||||
width?: string;
|
||||
|
||||
|
||||
// Called by Tabs component
|
||||
onActive?: (tab: Tab) => void;
|
||||
|
||||
@@ -1167,11 +1221,10 @@ declare namespace __MaterialUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface ThemeProps extends React.Props<Theme> {
|
||||
theme: Styles.CustomTheme;
|
||||
interface ThemeWrapperProps extends React.Props<ThemeWrapper> {
|
||||
theme: Styles.MuiTheme;
|
||||
}
|
||||
export class Theme extends React.Component<ThemeProps, {}> {
|
||||
static theme(customTheme: Styles.CustomTheme): <P>(Component: React.ComponentClass<P>) => React.ComponentClass<P>;
|
||||
export class ThemeWrapper extends React.Component<ThemeWrapperProps, {}> {
|
||||
}
|
||||
|
||||
interface ToggleProps extends CommonEnhancedSwitchProps<Toggle> {
|
||||
@@ -1256,7 +1309,7 @@ declare namespace __MaterialUI {
|
||||
export class ToolbarSeparator extends React.Component<ToolbarSeparatorProps, {}> {
|
||||
}
|
||||
|
||||
interface ToolbarTitleProps extends React.Props<ToolbarTitle> {
|
||||
interface ToolbarTitleProps extends React.HTMLAttributesBase<ToolbarTitle> {
|
||||
text?: string;
|
||||
}
|
||||
export class ToolbarTitle extends React.Component<ToolbarTitleProps, {}> {
|
||||
@@ -1632,6 +1685,9 @@ declare module 'material-ui/lib/styles/' {
|
||||
export import ThemeManager = __MaterialUI.Styles.ThemeManager; // require('material-ui/lib/styles/theme-manager');
|
||||
export import Transitions = __MaterialUI.Styles.Transitions; // require('material-ui/lib/styles/transitions');
|
||||
export import Typography = __MaterialUI.Styles.Typography; // require('material-ui/lib/styles/typography');
|
||||
export import LightRawTheme = __MaterialUI.Styles.LightRawTheme; // require('material-ui/lib/styles/raw-themes/light-raw-theme'),
|
||||
export import DarkRawTheme = __MaterialUI.Styles.DarkRawTheme; // require('material-ui/lib/styles/raw-themes/dark-raw-theme'),
|
||||
export import ThemeDecorator = __MaterialUI.Styles.ThemeDecorator; //require('material-ui/lib/styles/theme-decorator');
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/styles/auto-prefix' {
|
||||
@@ -1655,6 +1711,19 @@ declare module 'material-ui/lib/styles/typography' {
|
||||
export = __MaterialUI.Styles.Typography;
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/styles/raw-themes/light-raw-theme' {
|
||||
export = __MaterialUI.Styles.LightRawTheme;
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/styles/raw-themes/dark-raw-theme' {
|
||||
export = __MaterialUI.Styles.DarkRawTheme;
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/styles/theme-decorator' {
|
||||
export = __MaterialUI.Styles.ThemeDecorator;
|
||||
}
|
||||
|
||||
|
||||
declare module 'material-ui/lib/snackbar' {
|
||||
export = __MaterialUI.Snackbar;
|
||||
}
|
||||
@@ -1695,8 +1764,8 @@ declare module 'material-ui/lib/table/table-row-column' {
|
||||
export = __MaterialUI.Table.TableRowColumn;
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/theme' {
|
||||
export = __MaterialUI.Theme;
|
||||
declare module 'material-ui/lib/theme-wrapper' {
|
||||
export = __MaterialUI.ThemeWrapper;
|
||||
}
|
||||
|
||||
declare module 'material-ui/lib/toggle' {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="./mendixmodelsdk.d.ts"/>
|
||||
|
||||
import {domainmodels, IModel, ModelSdkClient} from "mendixmodelsdk";
|
||||
|
||||
|
||||
// This doesn't do anything useful, just for testing typings...
|
||||
|
||||
const client: ModelSdkClient = new ModelSdkClient({
|
||||
credentials: {
|
||||
username: "username",
|
||||
apikey: "apikey"
|
||||
}
|
||||
});
|
||||
|
||||
client.createWorkingCopy({
|
||||
name: "workingCopy",
|
||||
template: "test.mpk"
|
||||
}, (model:IModel) => {
|
||||
client.openWorkingCopy(model.id, (model:IModel) => {
|
||||
var domainModel:domainmodels.IDomainModel = model.allDomainModels()[0];
|
||||
domainModel.load((d:domainmodels.DomainModel) => {});
|
||||
|
||||
domainModel = model.root.modules[0].domainModel;
|
||||
var entity:domainmodels.IEntity = model.findEntityByQualifiedName("x.y");
|
||||
model.exportMpk("test.mpk", () => {}, (err) => {})
|
||||
}, (err) => {});
|
||||
}, (err) => {});
|
||||
@@ -0,0 +1 @@
|
||||
-m commonjs -t es5
|
||||
Vendored
+12718
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -576,7 +576,7 @@ declare module Mongo {
|
||||
|
||||
var ObjectID: ObjectIDStatic;
|
||||
interface ObjectIDStatic {
|
||||
new(hexString: string): ObjectID;
|
||||
new(hexString?: string): ObjectID;
|
||||
}
|
||||
interface ObjectID {
|
||||
}
|
||||
|
||||
Vendored
+17
-20
@@ -6,7 +6,6 @@
|
||||
declare module moment {
|
||||
|
||||
interface MomentInput {
|
||||
|
||||
/** Year */
|
||||
years?: number;
|
||||
/** Year */
|
||||
@@ -21,6 +20,13 @@ declare module moment {
|
||||
/** Month */
|
||||
M?: number;
|
||||
|
||||
/** Week */
|
||||
weeks?: number;
|
||||
/** Week */
|
||||
week?: number;
|
||||
/** Week */
|
||||
w?: number;
|
||||
|
||||
/** Day/Date */
|
||||
days?: number;
|
||||
/** Day/Date */
|
||||
@@ -57,11 +63,9 @@ declare module moment {
|
||||
millisecond?: number;
|
||||
/** Millisecond */
|
||||
ms?: number;
|
||||
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
|
||||
humanize(withSuffix?: boolean): string;
|
||||
|
||||
as(units: string): number;
|
||||
@@ -97,11 +101,9 @@ declare module moment {
|
||||
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
@@ -180,6 +182,7 @@ declare module moment {
|
||||
|
||||
calendar(): string;
|
||||
calendar(start: Moment): string;
|
||||
calendar(start: Moment, formats: MomentCalendar): string;
|
||||
|
||||
clone(): Moment;
|
||||
|
||||
@@ -246,6 +249,7 @@ declare module moment {
|
||||
|
||||
from(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
to(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
toNow(withoutPrefix?: boolean): string;
|
||||
|
||||
diff(b: Moment): number;
|
||||
diff(b: Moment, unitOfTime: string): number;
|
||||
@@ -299,18 +303,17 @@ declare module moment {
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
|
||||
}
|
||||
|
||||
type formatFunction = () => string;
|
||||
|
||||
interface MomentCalendar {
|
||||
|
||||
lastDay: any;
|
||||
sameDay: any;
|
||||
nextDay: any;
|
||||
lastWeek: any;
|
||||
nextWeek: any;
|
||||
sameElse: any;
|
||||
|
||||
lastDay?: string | formatFunction;
|
||||
sameDay?: string | formatFunction;
|
||||
nextDay?: string | formatFunction;
|
||||
lastWeek?: string | formatFunction;
|
||||
nextWeek?: string | formatFunction;
|
||||
sameElse?: string | formatFunction;
|
||||
}
|
||||
|
||||
interface BaseMomentLanguage {
|
||||
@@ -337,7 +340,6 @@ declare module moment {
|
||||
}
|
||||
|
||||
interface MomentLongDateFormat {
|
||||
|
||||
L: string;
|
||||
LL: string;
|
||||
LLL: string;
|
||||
@@ -350,11 +352,9 @@ declare module moment {
|
||||
llll?: string;
|
||||
lt?: string;
|
||||
lts?: string;
|
||||
|
||||
}
|
||||
|
||||
interface MomentRelativeTime {
|
||||
|
||||
future: any;
|
||||
past: any;
|
||||
s: any;
|
||||
@@ -368,11 +368,9 @@ declare module moment {
|
||||
MM: any;
|
||||
y: any;
|
||||
yy: any;
|
||||
|
||||
}
|
||||
|
||||
interface MomentStatic {
|
||||
|
||||
version: string;
|
||||
fn: Moment;
|
||||
|
||||
@@ -470,7 +468,6 @@ declare module moment {
|
||||
ISO_8601(): void;
|
||||
|
||||
defaultFormat: string;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ class DialogTestController {
|
||||
name: "login-popup"
|
||||
});
|
||||
|
||||
loginDialog.closePromise.then((result) => {
|
||||
var val: any = result.value;
|
||||
});
|
||||
|
||||
if (loginDialog.id === "login-popup") {
|
||||
loginDialog.close("closing");
|
||||
}
|
||||
@@ -49,4 +53,4 @@ app.config((ngDialogProvider: angular.dialog.IDialogProvider) => {
|
||||
className: "flat-ui"
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+10
-5
@@ -26,14 +26,19 @@ declare module angular.dialog {
|
||||
interface IDialogOpenResult {
|
||||
id: string;
|
||||
close: (value?: string) => void;
|
||||
closePromise: IPromise<void>;
|
||||
closePromise: IPromise<IDialogClosePromise>;
|
||||
}
|
||||
|
||||
interface IDialogClosePromise {
|
||||
id: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
interface IDialogProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Default options for the dialogs.
|
||||
* @param defaultOptions
|
||||
* @returns {}
|
||||
* @param defaultOptions
|
||||
* @returns {}
|
||||
*/
|
||||
setDefaults(defaultOptions: IDialogOptions): void;
|
||||
}
|
||||
@@ -44,7 +49,7 @@ declare module angular.dialog {
|
||||
interface IDialogScope extends angular.IScope {
|
||||
/**
|
||||
* This allows you to close dialog straight from handler in a popup element.
|
||||
* @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog.
|
||||
* @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog.
|
||||
* For dialogs opened with the openConfirm() method the value is used as the reject reason.
|
||||
*/
|
||||
closeThisDialog(value?: any): void;
|
||||
@@ -102,4 +107,4 @@ declare module angular.dialog {
|
||||
*/
|
||||
scope?: ng.IScope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="node-config-manager.d.ts" />
|
||||
|
||||
import cfgManager = require('node-config-manager');
|
||||
var options = {
|
||||
configDir: './config',
|
||||
env: 'test',
|
||||
camelCase: true
|
||||
};
|
||||
|
||||
cfgManager.init(options);
|
||||
cfgManager.addConfig('db')
|
||||
.addConfig('logger');
|
||||
|
||||
var appCfgByGetConfig = cfgManager.getConfig('app');
|
||||
|
||||
cfgManager.set('configDir', './config')
|
||||
.set('camelCase', true);
|
||||
|
||||
console.log(cfgManager.get('env'));
|
||||
cfgManager.removeConfig('app')
|
||||
.removeConfig('logger');
|
||||
|
||||
console.log(cfgManager.count());
|
||||
|
||||
var appCfgByMethod = cfgManager.method.App();
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for node-config-manager 1.0.2
|
||||
// Project: https://www.npmjs.com/package/node-config-manager
|
||||
// Definitions by: TANAKA Koichi <https://gitnub.com/mugeso/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "node-config-manager" {
|
||||
interface Options {
|
||||
configDir: string;
|
||||
env: string;
|
||||
camelCase: boolean;
|
||||
}
|
||||
|
||||
interface ConfigManager {
|
||||
init(options: Options): ConfigManager;
|
||||
set(key: string, value: string|boolean): ConfigManager;
|
||||
get(key: string): string|boolean;
|
||||
addConfig(configName: string): ConfigManager;
|
||||
getConfig(configName: string): any;
|
||||
removeConfig(configName: string): ConfigManager;
|
||||
count(): number;
|
||||
method: any;
|
||||
}
|
||||
|
||||
var cfgManager: ConfigManager;
|
||||
export = cfgManager;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="node-validator.d.ts"/>
|
||||
|
||||
import { run, isObject, isString, isIsoDate, isArray } from 'node-validator';
|
||||
|
||||
let checkChild = isObject()
|
||||
.withRequired('prop', isString({ regex: /^[abc]+$/ }));
|
||||
|
||||
let check = isObject()
|
||||
.withRequired('_id', isString({ regex: /^[abc]+$/ }))
|
||||
.withOptional('date', isIsoDate())
|
||||
.withOptional('children', isArray(checkChild, {min: 1}));
|
||||
|
||||
let toValidate = {
|
||||
_id: 'abababa',
|
||||
date: '2013-10-24',
|
||||
children: [{
|
||||
prop: 'zxzx'
|
||||
}]
|
||||
};
|
||||
|
||||
run(check, toValidate, function(errorCount, errors) {
|
||||
|
||||
});
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
// Type definitions for node-validator
|
||||
// Project: https://www.npmjs.com/package/node-validator
|
||||
// Definitions by: Ken Gorab <https://github.com/kengorab>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ValidatorOptions {
|
||||
interface IsStringOptions {
|
||||
regex?: RegExp,
|
||||
message?: String
|
||||
}
|
||||
|
||||
interface IsNumberOptions {
|
||||
min?: Number,
|
||||
max?: Number
|
||||
}
|
||||
|
||||
interface IsDateOptions {
|
||||
format?: String,
|
||||
message?: String
|
||||
}
|
||||
|
||||
type Options = IsStringOptions | IsNumberOptions | IsDateOptions;
|
||||
}
|
||||
|
||||
declare module Validator {
|
||||
type ValidateFn = (value: any, onError: (message: String, childName: String, childValie: any) => void) => void;
|
||||
|
||||
interface Validatable {
|
||||
validate: ValidateFn
|
||||
}
|
||||
|
||||
interface IsObjectValidator extends Validatable {
|
||||
withRequired: (name: String, validator: Validatable) => IsObjectValidator,
|
||||
withOptional: (name: String, validator: Validatable) => IsObjectValidator,
|
||||
custom: (customValidator: Validatable) => IsObjectValidator,
|
||||
validate: ValidateFn
|
||||
}
|
||||
|
||||
function express(validator: Validatable): any;
|
||||
function bodyValidator(validator: Validatable): any;
|
||||
function expressParams(validator: Validatable): any;
|
||||
function paramsValidator(validator: Validatable): any;
|
||||
function expressQuery(validator: Validatable): any;
|
||||
function queryValidator(validator: Validatable): any;
|
||||
|
||||
function run(validator: Validatable, value: any, callback: (errorCount: Number, errors: Array<any>) => void): void;
|
||||
|
||||
function isObject(): IsObjectValidator;
|
||||
function isString(options?: ValidatorOptions.IsStringOptions): Validatable;
|
||||
function isStringOrNull(options?: ValidatorOptions.IsStringOptions): Validatable;
|
||||
function isBoolean(): Validatable;
|
||||
function isNumber(options?: ValidatorOptions.IsNumberOptions): Validatable;
|
||||
function isInteger(options?: ValidatorOptions.IsNumberOptions): Validatable;
|
||||
function isDate(options?: ValidatorOptions.IsDateOptions): Validatable;
|
||||
function isIsoDate(options?: ValidatorOptions.IsDateOptions): Validatable;
|
||||
function isIsoDateTime(options?: ValidatorOptions.IsDateOptions): Validatable;
|
||||
|
||||
function isArray(validator?: Validatable, options?: ValidatorOptions.Options): Validatable;
|
||||
function isAnyObject(): IsObjectValidator;
|
||||
}
|
||||
|
||||
declare module 'node-validator' {
|
||||
export = Validator;
|
||||
}
|
||||
Vendored
+1
@@ -1244,6 +1244,7 @@ declare module "stream" {
|
||||
export interface WritableOptions {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
objectMode?: boolean;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
|
||||
Vendored
+2
@@ -1097,6 +1097,7 @@ declare module "crypto" {
|
||||
interface Verify extends NodeJS.WritableStream {
|
||||
update(data: any): void;
|
||||
verify(object: string, signature: string, signature_format?: string): boolean;
|
||||
objectMode?: boolean;
|
||||
}
|
||||
export function createDiffieHellman(prime_length: number): DiffieHellman;
|
||||
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
|
||||
@@ -1151,6 +1152,7 @@ declare module "stream" {
|
||||
export interface WritableOptions {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
objectMode?: boolean;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
|
||||
Vendored
+5
-10
@@ -1310,21 +1310,15 @@ declare module "fs" {
|
||||
export function createReadStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
bufferSize?: number;
|
||||
}): ReadStream;
|
||||
export function createReadStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: string;
|
||||
mode?: string;
|
||||
bufferSize?: number;
|
||||
autoClose?: boolean;
|
||||
}): ReadStream;
|
||||
export function createWriteStream(path: string, options?: {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
string?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
}): WriteStream;
|
||||
}
|
||||
|
||||
@@ -1693,6 +1687,7 @@ declare module "stream" {
|
||||
export interface WritableOptions {
|
||||
highWaterMark?: number;
|
||||
decodeStrings?: boolean;
|
||||
objectMode?: boolean;
|
||||
}
|
||||
|
||||
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/// <reference path="obelisk.js.d.ts"/>
|
||||
|
||||
function test_brick() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-demo');
|
||||
|
||||
var point = new obelisk.Point(500, 20);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
var color = new obelisk.SideColor().getByInnerColor(obelisk.ColorPattern.PINK);
|
||||
var dimension = new obelisk.BrickDimension(300, 400);
|
||||
var brick = new obelisk.Brick(dimension, color);
|
||||
|
||||
pixelView.renderObject(brick);
|
||||
var p3D = new obelisk.Point3D(20, 20, 0);
|
||||
pixelView.renderObject(brick, p3D);
|
||||
}
|
||||
|
||||
function test_cube() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-demo');
|
||||
|
||||
var point = new obelisk.Point(500, 240);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
var dimension = new obelisk.CubeDimension(120, 200, 60);
|
||||
var color = new obelisk.CubeColor().getByHorizontalColor(obelisk.ColorPattern.GRAY);
|
||||
var cube = new obelisk.Cube(dimension, color, false);
|
||||
pixelView.renderObject(cube);
|
||||
}
|
||||
|
||||
function test_pyramid() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-demo');
|
||||
|
||||
var point = new obelisk.Point(500, 240);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
var dimension = new obelisk.PyramidDimension(120);
|
||||
var color = new obelisk.PyramidColor().getByRightColor(obelisk.ColorPattern.YELLOW);
|
||||
var pyramid = new obelisk.Pyramid(dimension, color);
|
||||
pixelView.renderObject(pyramid);
|
||||
}
|
||||
|
||||
function test_side() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-demo');
|
||||
|
||||
var point = new obelisk.Point(500, 200);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
var colorX = new obelisk.SideColor().getByInnerColor(obelisk.ColorPattern.PINK);
|
||||
var colorY = new obelisk.SideColor().getByInnerColor(obelisk.ColorPattern.GRASS_GREEN);
|
||||
var dimensionX = new obelisk.SideXDimension(300, 100);
|
||||
var dimensionY = new obelisk.SideYDimension(300, 100);
|
||||
var sideX = new obelisk.SideX(dimensionX, colorX);
|
||||
var sideY = new obelisk.SideY(dimensionY, colorY);
|
||||
|
||||
pixelView.renderObject(sideX);
|
||||
|
||||
var p3DY = new obelisk.Point3D(0, 30, 0);
|
||||
pixelView.renderObject(sideY, p3DY);
|
||||
}
|
||||
|
||||
function test_slope() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-demo');
|
||||
|
||||
var point = new obelisk.Point(550, 50);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
var colorBrick = new obelisk.SideColor().getByInnerColor(obelisk.ColorPattern.GRAY);
|
||||
var dimension = new obelisk.BrickDimension(150, 400);
|
||||
var brick = new obelisk.Brick(dimension, colorBrick);
|
||||
|
||||
pixelView.renderObject(brick);
|
||||
|
||||
var color = new obelisk.SlopeColor().getByHorizontalColor(obelisk.ColorPattern.GRAY);
|
||||
|
||||
var dimensionNorth = new obelisk.SlopeDimension(50, 40);
|
||||
var dimensionEast = new obelisk.SlopeDimension(40, 50);
|
||||
var dimensionSouth = new obelisk.SlopeDimension(50, 40);
|
||||
var dimensionWest = new obelisk.SlopeDimension(40, 50);
|
||||
|
||||
var slopeNorth = new obelisk.SlopeNorth(dimensionNorth, color, false);
|
||||
var slopeEast = new obelisk.SlopeEast(dimensionEast, color);
|
||||
var slopeSouth = new obelisk.SlopeSouth(dimensionSouth, color);
|
||||
var slopeWest = new obelisk.SlopeWest(dimensionWest, color);
|
||||
|
||||
var p3dNorth = new obelisk.Point3D(50, 50, 0);
|
||||
var p3dEast = new obelisk.Point3D(50, 200, 0);
|
||||
var p3dSouth = new obelisk.Point3D(50, 125, 0);
|
||||
var p3dWest = new obelisk.Point3D(50, 275, 0);
|
||||
|
||||
pixelView.renderObject(slopeNorth, p3dNorth);
|
||||
pixelView.renderObject(slopeSouth, p3dSouth);
|
||||
pixelView.renderObject(slopeEast, p3dEast);
|
||||
pixelView.renderObject(slopeWest, p3dWest);
|
||||
|
||||
pixelView.clear();
|
||||
}
|
||||
|
||||
function test_gif_rendering() {
|
||||
var WIDTH = 64;
|
||||
var HEIGHT = 28;
|
||||
|
||||
var img = <HTMLCanvasElement>document.getElementById('animation');
|
||||
var ctx = <CanvasRenderingContext2D>document.createElement('canvas').getContext("2d");
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas-uncle');
|
||||
|
||||
var stack: any[] = [];
|
||||
var size = 8;
|
||||
var point = new obelisk.Point(50, 120);
|
||||
var pixelView = new obelisk.PixelView(canvas, point);
|
||||
|
||||
function draw() {
|
||||
ctx.drawImage(img, 0, 0, WIDTH, HEIGHT);
|
||||
var imgData = ctx.getImageData(0, 0, WIDTH, HEIGHT);
|
||||
pixelView.clear();
|
||||
for (var y = HEIGHT - 1; y >= 0; y--) {
|
||||
for (var x = 0; x < WIDTH - 1; x++) {
|
||||
var pixelColor = obelisk.CanvasTool.getPixel(imgData, x, y);
|
||||
if (pixelColor !== 0xFFFFFF) {
|
||||
var cube: obelisk.Cube;
|
||||
var flag = false;
|
||||
for (var i in stack) {
|
||||
if (stack[i][1] === pixelColor) {
|
||||
cube = stack[i][0];
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
var fixedColor = obelisk.ColorGeom.applyBrightness(pixelColor, 50);
|
||||
var color = new obelisk.CubeColor().getByHorizontalColor(fixedColor);
|
||||
var dimension = new obelisk.CubeDimension(size, size + 2, size);
|
||||
cube = new obelisk.Cube(dimension, color, false);
|
||||
stack.push([cube, pixelColor]);
|
||||
}
|
||||
var p3d = new obelisk.Point3D(x * (size - 2), 0, (HEIGHT - 1 - y) * (size));
|
||||
pixelView.renderObject(cube, p3d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
window.setInterval(draw, 50);
|
||||
|
||||
var canvasFloor = <HTMLCanvasElement>document.getElementById('canvas-floor');
|
||||
var pixelViewFloor = new obelisk.PixelView(canvasFloor, point);
|
||||
var floorDimension = new obelisk.CubeDimension((size - 2) * (WIDTH + 2), (size - 2) * 9, size);
|
||||
var floor = new obelisk.Cube(floorDimension, new obelisk.CubeColor(), false);
|
||||
pixelViewFloor.renderObject(floor, new obelisk.Point3D(-20, -30, 0));
|
||||
}
|
||||
Vendored
+228
@@ -0,0 +1,228 @@
|
||||
// Type definitions for obelisk.js v1.1.0
|
||||
// Project: https://github.com/nosir/obelisk.js/
|
||||
// Definitions by: Brian Drupieski <https://github.com/bdrupieski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module obelisk {
|
||||
|
||||
export var version: string;
|
||||
export var author: string;
|
||||
|
||||
export class Matrix {
|
||||
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
|
||||
|
||||
a: number;
|
||||
b: number;
|
||||
c: number;
|
||||
d: number;
|
||||
tx: number;
|
||||
ty: number;
|
||||
}
|
||||
|
||||
export class Point {
|
||||
constructor(x?: number, y?: number);
|
||||
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export class Point3D {
|
||||
constructor(x?: number, y?: number, z?: number);
|
||||
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
|
||||
toGlobalCoordinates(offset?: obelisk.Point): obelisk.Point;
|
||||
}
|
||||
|
||||
export class ColorGeom {
|
||||
static get32(color: number): number;
|
||||
static applyBrightness(color: number, brightness: number, highlight?: boolean): number;
|
||||
}
|
||||
|
||||
export class ColorPattern {
|
||||
static GRASS_GREEN: number;
|
||||
static YELLOW: number;
|
||||
static WINE_RED: number;
|
||||
static PINK: number;
|
||||
static PURPLE: number;
|
||||
static BLUE: number;
|
||||
static GRAY: number;
|
||||
static BLACK: number;
|
||||
static FINE_COLORS: number[];
|
||||
|
||||
static getRandomComfortableColor(): number;
|
||||
}
|
||||
|
||||
export class CanvasTool {
|
||||
static getPixel(imageData: ImageData, x: number, y: number): number;
|
||||
}
|
||||
|
||||
export class CanvasManager {
|
||||
static defaultCanvas: HTMLCanvasElement;
|
||||
|
||||
static getDefaultCanvas(): HTMLCanvasElement;
|
||||
static getNewCanvas(): HTMLCanvasElement;
|
||||
}
|
||||
|
||||
export class AbstractColor {
|
||||
constructor();
|
||||
|
||||
inner: number;
|
||||
border: number;
|
||||
borderHighlight: number;
|
||||
left: number;
|
||||
right: number;
|
||||
horizontal: number;
|
||||
leftSlope: number;
|
||||
rightSlope: number;
|
||||
}
|
||||
|
||||
export class CubeColor extends AbstractColor {
|
||||
constructor(border?: number, borderHighlight?: number, left?: number, right?: number, horizontal?: number);
|
||||
|
||||
BRIGHTNESS_GAIN: number;
|
||||
|
||||
getByHorizontalColor(horizontal: number): CubeColor;
|
||||
}
|
||||
|
||||
export class PyramidColor extends AbstractColor {
|
||||
constructor(border?: number, borderHighlight?: number, left?: number, right?: number);
|
||||
|
||||
BRIGHTNESS_GAIN: number;
|
||||
|
||||
getByRightColor(horizontal: number): PyramidColor;
|
||||
}
|
||||
|
||||
export class SideColor extends AbstractColor {
|
||||
constructor(border?: number, inner?: number);
|
||||
|
||||
BRIGHTNESS_GAIN: number;
|
||||
|
||||
getByInnerColor(inner: number): SideColor;
|
||||
}
|
||||
|
||||
export class SlopeColor extends AbstractColor {
|
||||
constructor(border?: number, borderHighlight?: number, left?: number, right?: number, leftSlope?: number, rightSlope?: number);
|
||||
|
||||
BRIGHTNESS_GAIN: number;
|
||||
|
||||
getByHorizontalColor(horizontal: number): SlopeColor;
|
||||
}
|
||||
|
||||
export class AbstractDimension {
|
||||
constructor();
|
||||
|
||||
xAxis: number;
|
||||
yAxis: number;
|
||||
zAxis: number;
|
||||
tall: boolean;
|
||||
}
|
||||
|
||||
export class BrickDimension extends AbstractDimension {
|
||||
constructor(xAxis?: number, yAxis?: number);
|
||||
}
|
||||
|
||||
export class CubeDimension extends AbstractDimension {
|
||||
constructor(xAxis?: number, yAxis?: number, zAxis?: number);
|
||||
}
|
||||
|
||||
export class PyramidDimension extends AbstractDimension {
|
||||
constructor(axis?: number, tall?: boolean);
|
||||
}
|
||||
|
||||
export class SideXDimension extends AbstractDimension {
|
||||
constructor(xAxis?: number, zAxis?: number);
|
||||
}
|
||||
|
||||
export class SideYDimension extends AbstractDimension {
|
||||
constructor(yAxis?: number, zAxis?: number);
|
||||
}
|
||||
|
||||
export class SlopeDimension extends AbstractDimension {
|
||||
constructor(xAxis?: number, yAxis?: number);
|
||||
}
|
||||
|
||||
export class BitmapData {
|
||||
constructor(w: number, h: number, useDefaultCanvas?: boolean);
|
||||
|
||||
imageData: ImageData;
|
||||
canvas: HTMLCanvasElement;
|
||||
context : CanvasRenderingContext2D;
|
||||
|
||||
setPixel(posX: number, posY: number, color: number): void;
|
||||
setPixelByIndex(index: number, color: number): void;
|
||||
checkPixelAvailable(x: number, y: number): boolean;
|
||||
floodFill(posX: number, posY: number, color: number): void;
|
||||
}
|
||||
|
||||
export class PixelObject {
|
||||
constructor(primitive: AbstractPrimitive, point3D?: Point3D);
|
||||
|
||||
x: number;
|
||||
y: number;
|
||||
canvas: HTMLCanvasElement;
|
||||
}
|
||||
|
||||
export class PixelView {
|
||||
constructor(canvas: HTMLCanvasElement, point?: Point);
|
||||
|
||||
canvas: HTMLCanvasElement;
|
||||
context: CanvasRenderingContext2D;
|
||||
point: Point;
|
||||
|
||||
renderObject(primitive: AbstractPrimitive, point3D?: Point3D): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export class AbstractPrimitive {
|
||||
constructor();
|
||||
|
||||
canvas: HTMLCanvasElement;
|
||||
w: number;
|
||||
h: number;
|
||||
dimension: AbstractDimension;
|
||||
color: AbstractColor;
|
||||
border: boolean;
|
||||
bitmapData: BitmapData;
|
||||
useDefaultCanvas: boolean;
|
||||
matrix: Matrix;
|
||||
}
|
||||
|
||||
export class Brick extends AbstractPrimitive {
|
||||
constructor(dimension?: BrickDimension, color?: SideColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class Cube extends AbstractPrimitive {
|
||||
constructor(dimension?: CubeDimension, color?: CubeColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class Pyramid extends AbstractPrimitive {
|
||||
constructor(dimension?: PyramidDimension, color?: PyramidColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SideX extends AbstractPrimitive {
|
||||
constructor(dimension?: SideXDimension, color?: SideColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SideY extends AbstractPrimitive {
|
||||
constructor(dimension?: SideYDimension, color?: SideColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SlopeEast extends AbstractPrimitive {
|
||||
constructor(dimension?: SlopeDimension, color?: SlopeColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SlopeNorth extends AbstractPrimitive {
|
||||
constructor(dimension?: SlopeDimension, color?: SlopeColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SlopeSouth extends AbstractPrimitive {
|
||||
constructor(dimension?: SlopeDimension, color?: SlopeColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
|
||||
export class SlopeWest extends AbstractPrimitive {
|
||||
constructor(dimension?: SlopeDimension, color?: SlopeColor, border?: boolean, useDefaultCanvas?: boolean);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="./power-assert.d.ts" />
|
||||
|
||||
import assert = require("power-assert");
|
||||
import assert from "power-assert";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -9,7 +9,7 @@
|
||||
/// <reference path="../power-assert-formatter/power-assert-formatter.d.ts" />
|
||||
|
||||
declare function assert(value:any, message?:string):void;
|
||||
declare module assert {
|
||||
declare namespace assert {
|
||||
export class AssertionError implements Error {
|
||||
name:string;
|
||||
message:string;
|
||||
@@ -62,5 +62,5 @@ declare module assert {
|
||||
}
|
||||
|
||||
declare module "power-assert" {
|
||||
export = assert;
|
||||
export default assert;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,898 @@
|
||||
// React-Bootstrap Test
|
||||
// ================================================================================
|
||||
///<reference path="react-bootstrap.d.ts"/>
|
||||
///<reference path="../react/react.d.ts"/>
|
||||
|
||||
// Imports
|
||||
// --------------------------------------------------------------------------------
|
||||
import * as React from 'react';
|
||||
import { Component, CSSProperties } from 'react';
|
||||
import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput } from 'react-bootstrap';
|
||||
|
||||
|
||||
export class ReactBootstrapTest extends Component<any, any> {
|
||||
callback() {
|
||||
alert('Callback: ' + JSON.stringify(arguments));
|
||||
}
|
||||
|
||||
public render() {
|
||||
let style: CSSProperties = { padding: '50px' };
|
||||
let tooltip = (<Tooltip><strong>Holy guacamole!</strong> Check this info.</Tooltip>);
|
||||
|
||||
const innerGlyphicon = <Glyphicon glyph='music' />;
|
||||
const innerButton = <Button>Before</Button>;
|
||||
const innerDropdown = (
|
||||
<DropdownButton title='Action' id='input-dropdown-addon'>
|
||||
<MenuItem key='1'>Item</MenuItem>
|
||||
</DropdownButton>
|
||||
);
|
||||
const innerRadio = <input type='radio' aria-label='...' />;
|
||||
const innerCheckbox = <input type='checkbox' aria-label='...' />;
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<Button>Default</Button>
|
||||
<Button bsStyle='primary'>Primary</Button>
|
||||
<Button bsStyle='success'>Success</Button>
|
||||
<Button bsStyle='info'>Info</Button>
|
||||
<Button bsStyle='warning'>Warning</Button>
|
||||
<Button bsStyle='danger'>Danger</Button>
|
||||
<Button bsStyle='link'>Link</Button>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<Button bsStyle='primary' bsSize='large'>Large button</Button>
|
||||
<Button bsSize='large'>Large button</Button>
|
||||
</ButtonToolbar>
|
||||
<ButtonToolbar>
|
||||
<Button bsStyle='primary'>Default button</Button>
|
||||
<Button>Default button</Button>
|
||||
</ButtonToolbar>
|
||||
<ButtonToolbar>
|
||||
<Button bsStyle='primary' bsSize='small'>Small button</Button>
|
||||
<Button bsSize='small'>Small button</Button>
|
||||
</ButtonToolbar>
|
||||
<ButtonToolbar>
|
||||
<Button bsStyle='primary' bsSize='xsmall'>Extra small button</Button>
|
||||
<Button bsSize='xsmall'>Extra small button</Button>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Well>
|
||||
<Button bsStyle='primary' bsSize='large' block>Block level button</Button>
|
||||
<Button bsSize='large' block>Block level button</Button>
|
||||
</Well>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<Button bsStyle='primary' bsSize='large' active>Primary button</Button>
|
||||
<Button bsSize='large' active>Button</Button>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<Button href='#'>Link</Button>
|
||||
<Button>Button</Button>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
|
||||
<div style={style}>
|
||||
<ButtonGroup>
|
||||
<Button>Left</Button>
|
||||
<Button>Middle</Button>
|
||||
<Button>Right</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
|
||||
|
||||
<div style={style as CSSProperties}>
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup>
|
||||
<Button>1</Button>
|
||||
<Button>2</Button>
|
||||
<Button>3</Button>
|
||||
<Button>4</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button>5</Button>
|
||||
<Button>6</Button>
|
||||
<Button>7</Button>
|
||||
</ButtonGroup>
|
||||
<ButtonGroup>
|
||||
<Button>8</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
// TODO: Start here
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup bsSize='large'>
|
||||
<Button>Left</Button>
|
||||
<Button>Middle</Button>
|
||||
<Button>Right</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup>
|
||||
<Button>Left</Button>
|
||||
<Button>Middle</Button>
|
||||
<Button>Right</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup bsSize='small'>
|
||||
<Button>Left</Button>
|
||||
<Button>Middle</Button>
|
||||
<Button>Right</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup bsSize='xsmall'>
|
||||
<Button>Left</Button>
|
||||
<Button>Middle</Button>
|
||||
<Button>Right</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonGroup vertical>
|
||||
<Button>Button</Button>
|
||||
<Button>Button</Button>
|
||||
<DropdownButton title='Dropdown' id='bg-vertical-dropdown-1'>
|
||||
<MenuItem eventKey='1'>Dropdown link</MenuItem>
|
||||
<MenuItem eventKey='2'>Dropdown link</MenuItem>
|
||||
</DropdownButton>
|
||||
<Button>Button</Button>
|
||||
<Button>Button</Button>
|
||||
<DropdownButton title='Dropdown' id='bg-vertical-dropdown-2'>
|
||||
<MenuItem eventKey='1'>Dropdown link</MenuItem>
|
||||
<MenuItem eventKey='2'>Dropdown link</MenuItem>
|
||||
</DropdownButton>
|
||||
<DropdownButton title='Dropdown' id='bg-vertical-dropdown-3'>
|
||||
<MenuItem eventKey='1'>Dropdown link</MenuItem>
|
||||
<MenuItem eventKey='2'>Dropdown link</MenuItem>
|
||||
</DropdownButton>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<DropdownButton bsStyle={'default'} title={'hello'} key={0} id={0}>
|
||||
<MenuItem eventKey='1'>Action</MenuItem>
|
||||
<MenuItem eventKey='2'>Another action</MenuItem>
|
||||
<MenuItem eventKey='3' active>Active Item</MenuItem>
|
||||
<MenuItem divider />
|
||||
<MenuItem eventKey='4'>Separated link</MenuItem>
|
||||
</DropdownButton>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div className="clearfix">
|
||||
<ul className="dropdown-menu open">
|
||||
<MenuItem header>Header</MenuItem>
|
||||
<MenuItem>link</MenuItem>
|
||||
<MenuItem divider/>
|
||||
<MenuItem header>Header</MenuItem>
|
||||
<MenuItem>link</MenuItem>
|
||||
<MenuItem disabled>disabled</MenuItem>
|
||||
<MenuItem title="See? I have a title.">
|
||||
link with title
|
||||
</MenuItem>
|
||||
<MenuItem eventKey={1} href="#someHref" onSelect={this.callback}>
|
||||
link that alerts
|
||||
</MenuItem>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Panel onClick={this.callback}>
|
||||
Basic panel example
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Panel header='Panel heading without title'>
|
||||
Panel content
|
||||
</Panel>
|
||||
<Panel header='Header'>
|
||||
Panel content
|
||||
</Panel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Panel footer='Panel footer'>
|
||||
Panel content
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Panel header='Header'>
|
||||
Panel content
|
||||
</Panel>
|
||||
|
||||
<Panel header='Header' bsStyle='primary'>
|
||||
Panel content
|
||||
</Panel>
|
||||
|
||||
<Panel header='Header' bsStyle='success'>
|
||||
Panel content
|
||||
</Panel>
|
||||
|
||||
<Panel header='Header' bsStyle='info'>
|
||||
Panel content
|
||||
</Panel>
|
||||
|
||||
<Panel header='Header' bsStyle='warning'>
|
||||
Panel content
|
||||
</Panel>
|
||||
|
||||
<Panel header='Header' bsStyle='danger'>
|
||||
Panel content
|
||||
</Panel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Panel collapsible defaultExpanded header='Panel heading'>
|
||||
Some default panel content here.
|
||||
<ListGroup fill>
|
||||
<ListGroupItem>Item 1</ListGroupItem>
|
||||
<ListGroupItem>Item 2</ListGroupItem>
|
||||
<ListGroupItem>…</ListGroupItem>
|
||||
</ListGroup>
|
||||
Some more panel content here.
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Accordion>
|
||||
<Panel header='Collapsible Group Item #1' eventKey='1'>
|
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer
|
||||
farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
||||
</Panel>
|
||||
<Panel header='Collapsible Group Item #2' eventKey='2'>
|
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer
|
||||
farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
||||
</Panel>
|
||||
<Panel header='Collapsible Group Item #3' eventKey='3'>
|
||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer
|
||||
farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
||||
</Panel>
|
||||
</Accordion>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div className='static-modal'>
|
||||
<Modal.Dialog>
|
||||
<Modal.Header>
|
||||
<Modal.Title>Modal title</Modal.Title>
|
||||
</Modal.Header>
|
||||
|
||||
<Modal.Body>
|
||||
One fine body...
|
||||
</Modal.Body>
|
||||
|
||||
<Modal.Footer>
|
||||
<Button>Close</Button>
|
||||
<Button bsStyle='primary'>Save changes</Button>
|
||||
</Modal.Footer>
|
||||
|
||||
</Modal.Dialog>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style} className="static-tooltip">
|
||||
<div>
|
||||
<Tooltip placement="right" className="in">
|
||||
Tooltip right
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip placement="top" className="in">
|
||||
Tooltip top
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip placement="left" className="in">
|
||||
Tooltip left
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip placement="bottom" className="in">
|
||||
Tooltip bottom
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<OverlayTrigger placement='left' overlay={tooltip}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
|
||||
<OverlayTrigger placement='top' overlay={tooltip}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
|
||||
<OverlayTrigger placement='bottom' overlay={tooltip}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
|
||||
<OverlayTrigger placement='right' overlay={tooltip}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div style={{ height: 120, position: 'relative' } as CSSProperties}>
|
||||
<Popover placement='right' positionLeft={200} positionTop={50} title='Popover right'>
|
||||
And here's some <strong>amazing</strong> content. It's very engaging. right?
|
||||
</Popover>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<OverlayTrigger trigger='click' placement='left' overlay={<Popover title='Popover left'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='click' placement='top' overlay={<Popover title='Popover top'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='click' placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='click' placement='right' overlay={<Popover title='Popover right'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Holy guacamole!</Button>
|
||||
</OverlayTrigger>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ButtonToolbar>
|
||||
<OverlayTrigger trigger='click' placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Click</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='hover' placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Hover</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='focus' placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Focus</Button>
|
||||
</OverlayTrigger>
|
||||
<OverlayTrigger trigger='click' rootClose placement='bottom' overlay={<Popover title='Popover bottom'><strong>Holy guacamole!</strong> Check this info.</Popover>}>
|
||||
<Button bsStyle='default'>Click + rootClose</Button>
|
||||
</OverlayTrigger>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ProgressBar now={60} />
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ProgressBar now={60} label='%(percent)s%' />
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<ProgressBar bsStyle='success' now={40} />
|
||||
<ProgressBar bsStyle='info' now={20} />
|
||||
<ProgressBar bsStyle='warning' now={60} />
|
||||
<ProgressBar bsStyle='danger' now={80} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<ProgressBar striped bsStyle='success' now={40} />
|
||||
<ProgressBar striped bsStyle='info' now={20} />
|
||||
<ProgressBar striped bsStyle='warning' now={60} />
|
||||
<ProgressBar striped bsStyle='danger' now={80} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ProgressBar active now={45} />
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ProgressBar>
|
||||
<ProgressBar striped bsStyle='success' now={35} key={1} />
|
||||
<ProgressBar bsStyle='warning' now={20} key={2} />
|
||||
<ProgressBar active bsStyle='danger' now={10} key={3} />
|
||||
</ProgressBar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Nav bsStyle='pills' activeKey={1} onSelect={this.callback}>
|
||||
<NavItem eventKey={1} href='/home'>NavItem 1 content</NavItem>
|
||||
<NavItem eventKey={2} title='Item'>NavItem 2 content</NavItem>
|
||||
<NavItem eventKey={3} disabled>NavItem 3 content</NavItem>
|
||||
</Nav>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Nav bsStyle='pills' stacked activeKey={1} onSelect={this.callback}>
|
||||
<NavItem eventKey={1} href='/home'>NavItem 1 content</NavItem>
|
||||
<NavItem eventKey={2} title='Item'>NavItem 2 content</NavItem>
|
||||
<NavItem eventKey={3} disabled>NavItem 3 content</NavItem>
|
||||
</Nav>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Nav bsStyle='tabs' justified activeKey={1} onSelect={this.callback}>
|
||||
<NavItem eventKey={1} href='/home'>NavItem 1 content</NavItem>
|
||||
<NavItem eventKey={2} title='Item'>NavItem 2 content</NavItem>
|
||||
<NavItem eventKey={3} disabled>NavItem 3 content</NavItem>
|
||||
</Nav>
|
||||
<br />
|
||||
<Nav bsStyle='pills' justified activeKey={1} onSelect={this.callback}>
|
||||
<NavItem eventKey={1} href='/home'>NavItem 1 content</NavItem>
|
||||
<NavItem eventKey={2} title='Item'>NavItem 2 content</NavItem>
|
||||
<NavItem eventKey={3} disabled>NavItem 3 content</NavItem>
|
||||
</Nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Navbar brand='React-Bootstrap'>
|
||||
<Nav>
|
||||
<NavItem eventKey={1} href='#'>Link</NavItem>
|
||||
<NavItem eventKey={2} href='#'>Link</NavItem>
|
||||
<NavDropdown eventKey={3} title='Dropdown' id='basic-nav-dropdown'>
|
||||
<MenuItem eventKey='1'>Action</MenuItem>
|
||||
<MenuItem eventKey='2'>Another action</MenuItem>
|
||||
<MenuItem eventKey='3'>Something else here</MenuItem>
|
||||
<MenuItem divider />
|
||||
<MenuItem eventKey='4'>Separated link</MenuItem>
|
||||
</NavDropdown>
|
||||
</Nav>
|
||||
</Navbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Navbar brand='React-Bootstrap' inverse toggleNavKey={0}>
|
||||
<Nav right eventKey={0}> {/* This is the eventKey referenced */}
|
||||
<NavItem eventKey={1} href='#'>Link</NavItem>
|
||||
<NavItem eventKey={2} href='#'>Link</NavItem>
|
||||
</Nav>
|
||||
</Navbar>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Pager>
|
||||
<PageItem href='#'>Previous</PageItem>
|
||||
<PageItem href='#'>Next</PageItem>
|
||||
</Pager>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Tabs defaultActiveKey={1} animation={false}>
|
||||
<Tab eventKey={1} title='Tab 1'>Tab 1 content</Tab>
|
||||
<Tab eventKey={2} title='Tab 2'>Tab 2 content</Tab>
|
||||
<Tab eventKey={3} title='Tab 3' disabled>Tab 3 content</Tab>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Pager>
|
||||
<PageItem href='#'>Previous</PageItem>
|
||||
<PageItem href='#'>Next</PageItem>
|
||||
</Pager>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Pager>
|
||||
<PageItem previous href='#'>← Previous Page</PageItem>
|
||||
<PageItem next href='#'>Next Page →</PageItem>
|
||||
</Pager>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Pager>
|
||||
<PageItem previous href='#'>← Previous</PageItem>
|
||||
<PageItem disabled next href='#'>Next →</PageItem>
|
||||
</Pager>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Pagination
|
||||
bsSize='large'
|
||||
items={10}
|
||||
activePage={1}
|
||||
onSelect={this.callback} />
|
||||
<br />
|
||||
<Pagination
|
||||
bsSize='medium'
|
||||
items={10}
|
||||
activePage={1}
|
||||
onSelect={this.callback} />
|
||||
<br />
|
||||
|
||||
<Pagination
|
||||
bsSize='small'
|
||||
items={10}
|
||||
activePage={1}
|
||||
onSelect={this.callback} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Alert bsStyle='warning'>
|
||||
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
|
||||
</Alert>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Carousel>
|
||||
<CarouselItem>
|
||||
<img width={900} height={500} alt='900x500' src='carousel.png'/>
|
||||
<div className='carousel-caption'>
|
||||
<h3>First slide label</h3>
|
||||
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
<CarouselItem>
|
||||
<img width={900} height={500} alt='900x500' src='carousel.png'/>
|
||||
<div className='carousel-caption'>
|
||||
<h3>Second slide label</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
<CarouselItem>
|
||||
<img width={900} height={500} alt='900x500' src='carousel.png'/>
|
||||
<div className='carousel-caption'>
|
||||
<h3>Third slide label</h3>
|
||||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
|
||||
</div>
|
||||
</CarouselItem>
|
||||
</Carousel>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Grid>
|
||||
<Row className='show-grid'>
|
||||
<Col xs={12} md={8}><code><{'Col xs={12} md={8}'} /></code></Col>
|
||||
<Col xs={6} md={4}><code><{'Col xs={6} md={4}'} /></code></Col>
|
||||
</Row>
|
||||
|
||||
<Row className='show-grid'>
|
||||
<Col xs={6} md={4}><code><{'Col xs={6} md={4}'} /></code></Col>
|
||||
<Col xs={6} md={4}><code><{'Col xs={6} md={4}'} /></code></Col>
|
||||
<Col xs={6} md={4}><code><{'Col xs={6} md={4}'} /></code></Col>
|
||||
</Row>
|
||||
|
||||
<Row className='show-grid'>
|
||||
<Col xs={6} xsOffset={6}><code><{'Col xs={6} xsOffset={6}'} /></code></Col>
|
||||
</Row>
|
||||
|
||||
<Row className='show-grid'>
|
||||
<Col md={6} mdPush={6}><code><{'Col md={6} mdPush={6}'} /></code></Col>
|
||||
<Col md={6} mdPull={6}><code><{'Col md={6} mdPull={6}'} /></code></Col>
|
||||
</Row>
|
||||
</Grid>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Grid>
|
||||
<Row>
|
||||
<Col xs={6} md={3}>
|
||||
<Thumbnail href='#' alt='171x180' src='thumbnail.png' />
|
||||
</Col>
|
||||
<Col xs={6} md={3}>
|
||||
<Thumbnail href='#' alt='171x180' src='thumbnail.png' />
|
||||
</Col>
|
||||
<Col xs={6} md={3}>
|
||||
<Thumbnail href='#' alt='171x180' src='thumbnail.png' />
|
||||
</Col>
|
||||
</Row>
|
||||
</Grid>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ListGroup>
|
||||
<ListGroupItem>Item 1</ListGroupItem>
|
||||
<ListGroupItem>Item 2</ListGroupItem>
|
||||
<ListGroupItem>...</ListGroupItem>
|
||||
</ListGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ListGroup>
|
||||
<ListGroupItem href='#link1'>Link 1</ListGroupItem>
|
||||
<ListGroupItem href='#link2'>Link 2</ListGroupItem>
|
||||
<ListGroupItem onClick={this.callback}>
|
||||
Trigger an alert
|
||||
</ListGroupItem>
|
||||
</ListGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ListGroup>
|
||||
<ListGroupItem href='#' active>Link 1</ListGroupItem>
|
||||
<ListGroupItem href='#'>Link 2</ListGroupItem>
|
||||
<ListGroupItem href='#' disabled>Link 3</ListGroupItem>
|
||||
</ListGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ListGroup>
|
||||
<ListGroupItem bsStyle='success'>Success</ListGroupItem>
|
||||
<ListGroupItem bsStyle='info'>Info</ListGroupItem>
|
||||
<ListGroupItem bsStyle='warning'>Warning</ListGroupItem>
|
||||
<ListGroupItem bsStyle='danger'>Danger</ListGroupItem>
|
||||
</ListGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<ListGroup>
|
||||
<ListGroupItem header='Heading 1'>Some body text</ListGroupItem>
|
||||
<ListGroupItem header='Heading 2' href='#'>Linked item</ListGroupItem>
|
||||
<ListGroupItem header='Heading 3' bsStyle='danger'>Danger styling</ListGroupItem>
|
||||
</ListGroup>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<h1>Label <Label>New</Label></h1>
|
||||
<h2>Label <Label>New</Label></h2>
|
||||
<h3>Label <Label>New</Label></h3>
|
||||
<h4>Label <Label>New</Label></h4>
|
||||
<h5>Label <Label>New</Label></h5>
|
||||
<p>Label <Label>New</Label></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Label bsStyle='default'>Default</Label>
|
||||
<Label bsStyle='primary'>Primary</Label>
|
||||
<Label bsStyle='success'>Success</Label>
|
||||
<Label bsStyle='info'>Info</Label>
|
||||
<Label bsStyle='warning'>Warning</Label>
|
||||
<Label bsStyle='danger'>Danger</Label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<p>Badges <Badge>42</Badge></p>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Jumbotron>
|
||||
<h1>Hello, world!</h1>
|
||||
<p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
|
||||
<p><Button bsStyle='primary'>Learn more</Button></p>
|
||||
</Jumbotron>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<PageHeader>Example page header <small>Subtext for header</small></PageHeader>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Well>Look I'm in a well!</Well>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<Well bsSize='large'>Look I'm in a large well!</Well>
|
||||
<Well bsSize='small'>Look I'm in a small well!</Well>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup>
|
||||
<Button><Glyphicon glyph='align-left' /></Button>
|
||||
<Button><Glyphicon glyph='align-center' /></Button>
|
||||
<Button><Glyphicon glyph='align-right' /></Button>
|
||||
<Button><Glyphicon glyph='align-justify' /></Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
<ButtonToolbar>
|
||||
<ButtonGroup>
|
||||
<Button bsSize='large'><Glyphicon glyph='star' /> Star</Button>
|
||||
<Button><Glyphicon glyph='star' /> Star</Button>
|
||||
<Button bsSize='small'><Glyphicon glyph='star' /> Star</Button>
|
||||
<Button bsSize='xsmall'><Glyphicon glyph='star' /> Star</Button>
|
||||
</ButtonGroup>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Table striped bordered condensed hover>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Username</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Mark</td>
|
||||
<td>Otto</td>
|
||||
<td>@mdo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>Jacob</td>
|
||||
<td>Thornton</td>
|
||||
<td>@fat</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td colSpan={2}>Larry the Bird</td>
|
||||
<td>@twitter</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Table responsive>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
<th>Table heading</th>
|
||||
<th>Table heading</th>
|
||||
<th>Table heading</th>
|
||||
<th>Table heading</th>
|
||||
<th>Table heading</th>
|
||||
<th>Table heading</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
<td>Table cell</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Input type='text'
|
||||
value="hello"
|
||||
placeholder='Enter text'
|
||||
label='Working example with validation'
|
||||
help='Validation is based on string length.'
|
||||
bsStyle="success"
|
||||
hasFeedback
|
||||
ref='input'
|
||||
groupClassName='group-class'
|
||||
labelClassName='label-class'
|
||||
onChange={this.callback} />
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form>
|
||||
<Input type='text' label='Text' placeholder='Enter text' />
|
||||
<Input type='email' label='Email Address' placeholder='Enter email' />
|
||||
<Input type='password' label='Password' />
|
||||
<Input type='file' label='File' help='[Optional] Block level help text' />
|
||||
<Input type='checkbox' label='Checkbox' checked readOnly />
|
||||
<Input type='radio' label='Radio' checked readOnly />
|
||||
<Input type='select' label='Select' placeholder='select'>
|
||||
<option value='select'>select</option>
|
||||
<option value='other'>...</option>
|
||||
</Input>
|
||||
<Input type='select' label='Multiple Select' multiple>
|
||||
<option value='select'>select (multiple)</option>
|
||||
<option value='other'>...</option>
|
||||
</Input>
|
||||
<Input type='textarea' label='Text Area' placeholder='textarea' />
|
||||
<ButtonInput value='Button Input' />
|
||||
<ButtonInput type='reset' value='Reset Button' />
|
||||
<ButtonInput type='submit' value='Submit Button' />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form>
|
||||
<Input type="text" ref="input" onChange={this.callback} />
|
||||
<ButtonInput bsSize="small">Child Text</ButtonInput>
|
||||
<ButtonInput type="reset" bsStyle="primary" onClick={this.callback} />
|
||||
<ButtonInput type="submit" value="Submit Your Input" bsStyle="success" bsSize="large" disabled={false} />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form>
|
||||
<Input type='text' addonBefore='@' />
|
||||
<Input type='text' addonAfter='.00' />
|
||||
<Input type='text' addonBefore='$' addonAfter='.00' />
|
||||
<Input type='text' addonAfter={innerGlyphicon} />
|
||||
<Input type='text' buttonBefore={innerButton} />
|
||||
<Input type='text' buttonAfter={innerDropdown} />
|
||||
<Input type='text' addonBefore={innerRadio} />
|
||||
<Input type='text' addonBefore={innerCheckbox} />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form>
|
||||
<Input type='text' bsSize="large" placeholder='Large text' />
|
||||
<Input type='text' bsSize="medium" placeholder='Normal text' />
|
||||
<Input type='text' bsSize="small" placeholder='Small text' />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form>
|
||||
<Input type='text' bsStyle='success' label='Success' hasFeedback />
|
||||
<Input type='text' bsStyle='warning' label='Warning' hasFeedback />
|
||||
<Input type='text' bsStyle='error' label='Error' hasFeedback />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<form className='form-horizontal'>
|
||||
<Input type='text' label='Text' labelClassName='col-xs-2' wrapperClassName='col-xs-10' />
|
||||
<Input type='textarea' label='Textarea' labelClassName='col-xs-2' wrapperClassName='col-xs-10' />
|
||||
<Input type='checkbox' label='Checkbox' wrapperClassName='col-xs-offset-2 col-xs-10' help='Offset is applied to wrapper.' />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<Input label='Input wrapper' help='Use this when you need something other than the available input types.' wrapperClassName='wrapper'>
|
||||
<Row>
|
||||
<Col xs={6}>
|
||||
<input type='text' className='form-control' />
|
||||
</Col>
|
||||
<Col xs={6}>
|
||||
<input type='text' className='form-control' />
|
||||
</Col>
|
||||
</Row>
|
||||
</Input>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Vendored
+908
@@ -0,0 +1,908 @@
|
||||
// Type definitions for react-bootstrap
|
||||
// Project: https://github.com/react-bootstrap/react-bootstrap
|
||||
// Definitions by: Walker Burgin <https://github.com/walkerburgin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../react/react.d.ts"/>
|
||||
///<reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
declare module "react-bootstrap" {
|
||||
// Import React
|
||||
import React = require("react");
|
||||
|
||||
|
||||
// <Button />
|
||||
// ----------------------------------------
|
||||
interface ButtonProps {
|
||||
|
||||
// Optional
|
||||
active?: boolean;
|
||||
disabled?: boolean;
|
||||
block?: boolean;
|
||||
bsStyle?: string;
|
||||
bsSize?: string;
|
||||
navItem?: boolean;
|
||||
navDropdown?: boolean;
|
||||
componentClass?: string;
|
||||
href?: string;
|
||||
onClick?: Function; // Add more specific type
|
||||
target?: string;
|
||||
type?: string;
|
||||
}
|
||||
interface Button extends React.ReactElement<ButtonProps> { }
|
||||
interface ButtonClass extends React.ComponentClass<ButtonProps> { }
|
||||
var Button: ButtonClass;
|
||||
|
||||
|
||||
// <ButtonToolbar />
|
||||
// ----------------------------------------
|
||||
interface ButtonToolbarProps {
|
||||
|
||||
// Optional
|
||||
block?: boolean;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
justified?: boolean;
|
||||
vertical?: boolean;
|
||||
}
|
||||
interface ButtonToolbar extends React.ReactElement<ButtonToolbarProps> { }
|
||||
interface ButtonToolbarClass extends React.ComponentClass<ButtonToolbarProps> { }
|
||||
var ButtonToolbar: ButtonToolbarClass;
|
||||
|
||||
// <ButtonGroup />
|
||||
// ----------------------------------------
|
||||
interface ButtonGroupProps {
|
||||
// Optional
|
||||
block?: boolean;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
justified?: boolean;
|
||||
vertical?: boolean;
|
||||
}
|
||||
interface ButtonGroup extends React.ReactElement<ButtonGroupProps> { }
|
||||
interface ButtonGroupClass extends React.ComponentClass<ButtonGroupProps> { }
|
||||
var ButtonGroup: ButtonGroupClass;
|
||||
|
||||
|
||||
// <DropdownButton />
|
||||
// ----------------------------------------
|
||||
interface DropdownButtonProps {
|
||||
bsStyle?: string;
|
||||
bsSize?: string;
|
||||
buttonClassName?: string;
|
||||
children?: any; // TODO: Add more specific type
|
||||
className?: string;
|
||||
dropup?: boolean;
|
||||
href?: string;
|
||||
id?: string | number;
|
||||
key?: any; // TODO: Add more specific type
|
||||
navItem?: boolean;
|
||||
noCaret?: boolean;
|
||||
onClick?: Function; // TODO: Add more specifc type
|
||||
onSelect?: Function; // TODO: Add more specific type
|
||||
pullRight?: boolean;
|
||||
title?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface DropdownButton extends React.ReactElement<DropdownButtonProps> { }
|
||||
interface DropdownButtonClass extends React.ComponentClass<DropdownButtonProps> { }
|
||||
var DropdownButton: DropdownButtonClass;
|
||||
|
||||
|
||||
// <SplitButton />
|
||||
// ----------------------------------------
|
||||
interface SplitButtonProps {
|
||||
bsStyle?: string;
|
||||
bsSize?: string;
|
||||
children?: any; // TODO: Add more specific type
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
dropdownTitle?: any; // TODO: Add more specific type
|
||||
dropup?: boolean;
|
||||
href?: string;
|
||||
id?: string;
|
||||
onClick?: Function; // TODO: Add more specific type
|
||||
onSelect?: Function; // TODO: Add more specific type
|
||||
pullRight?: boolean;
|
||||
target?: string;
|
||||
title?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface SplitButton extends React.ReactElement<SplitButtonProps> { }
|
||||
interface SplitButtonClass extends React.ComponentClass<SplitButtonProps> { }
|
||||
var SplitButton: SplitButtonClass;
|
||||
|
||||
|
||||
// <MenuItem />
|
||||
// ----------------------------------------
|
||||
interface MenuItemProps {
|
||||
active?: boolean;
|
||||
disabled?: boolean;
|
||||
divider?: boolean;
|
||||
eventKey?: any;
|
||||
header?: boolean;
|
||||
href?: string;
|
||||
key?: any;
|
||||
onSelect?: Function;
|
||||
target?: string;
|
||||
title?: string;
|
||||
}
|
||||
interface MenuItem extends React.ReactElement<MenuItemProps> { }
|
||||
interface MenuItemClass extends React.ComponentClass<MenuItemProps> { }
|
||||
var MenuItem: MenuItemClass;
|
||||
|
||||
|
||||
// <Panel />
|
||||
// ----------------------------------------
|
||||
interface PanelProps {
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
collapsible?: boolean;
|
||||
defaultExpanded?: boolean;
|
||||
eventKey?: any;
|
||||
expanded?: boolean;
|
||||
footer?: any; // TODO: Add more specific type
|
||||
header?: any; // TODO: Add more specific type
|
||||
id?: string;
|
||||
onSelect?: Function; // TODO: Add more specific type
|
||||
onClick?: Function; // TODO: Add more specific type
|
||||
}
|
||||
interface Panel extends React.ReactElement<PanelProps> { }
|
||||
interface PanelClass extends React.ComponentClass<PanelProps> { }
|
||||
var Panel: PanelClass;
|
||||
|
||||
|
||||
// <Accordion />
|
||||
// ----------------------------------------
|
||||
interface AccordionProps {
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
collapsible?: boolean;
|
||||
defaultExpanded?: boolean;
|
||||
eventKey?: any;
|
||||
expanded?: boolean;
|
||||
footer?: any; // TODO: Add more specific type
|
||||
header?: any; // TODO: Add more specific type
|
||||
id?: string;
|
||||
onSelect?: Function; // TODO: Add more specific type
|
||||
}
|
||||
interface Accordion extends React.ReactElement<AccordionProps> { }
|
||||
interface AccordionClass extends React.ComponentClass<AccordionProps> { }
|
||||
var Accordion: AccordionClass;
|
||||
|
||||
|
||||
// <PanelGroup />
|
||||
// ----------------------------------------
|
||||
interface PanelGroupProps {
|
||||
accordion?: boolean;
|
||||
activeKey?: any;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
children?: any;
|
||||
className?: string;
|
||||
defaultActiveKey?: any;
|
||||
onSelect?: Function;
|
||||
}
|
||||
interface PanelGroup extends React.ReactElement<PanelGroupProps> { }
|
||||
interface PanelGroupClass extends React.ComponentClass<PanelGroupProps> { }
|
||||
var PanelGroup: PanelGroupClass;
|
||||
|
||||
|
||||
// <Modal.Dialog />
|
||||
// ----------------------------------------
|
||||
interface ModalDialogProps {
|
||||
// TODO: Add more specific type
|
||||
}
|
||||
interface ModalDialog extends React.ReactElement<ModalDialogProps> { }
|
||||
interface ModalDialogClass extends React.ComponentClass<ModalHeaderProps> { }
|
||||
|
||||
|
||||
// <Modal.Header />
|
||||
// ----------------------------------------
|
||||
interface ModalHeaderProps {
|
||||
closeButton?: boolean;
|
||||
modalClassName?: string;
|
||||
onHide?: Function;
|
||||
// undefined?: string;
|
||||
}
|
||||
interface ModalHeader extends React.ReactElement<ModalHeaderProps> { }
|
||||
interface ModalHeaderClass extends React.ComponentClass<ModalHeaderProps> { }
|
||||
|
||||
|
||||
// <Modal.Title/>
|
||||
// ----------------------------------------
|
||||
interface ModalTitleProps {
|
||||
modalClassName?: string;
|
||||
}
|
||||
interface ModalTitle extends React.ReactElement<ModalTitleProps> { }
|
||||
interface ModalTitleClass extends React.ComponentClass<ModalTitleProps> { }
|
||||
|
||||
|
||||
// <Modal.Body />
|
||||
// ----------------------------------------
|
||||
interface ModalBodyProps {
|
||||
modalClassName?: string;
|
||||
}
|
||||
interface ModalBody extends React.ReactElement<ModalBodyProps> { }
|
||||
interface ModalBodyClass extends React.ComponentClass<ModalBodyProps> { }
|
||||
|
||||
|
||||
// <Modal.Footer />
|
||||
// ----------------------------------------
|
||||
interface ModalFooterProps {
|
||||
modalClassName?: string;
|
||||
}
|
||||
interface ModalFooter extends React.ReactElement<ModalFooterProps> { }
|
||||
interface ModalFooterClass extends React.ComponentClass<ModalFooterProps> { }
|
||||
|
||||
|
||||
// <Modal />
|
||||
// ----------------------------------------
|
||||
interface ModalProps {
|
||||
// Required
|
||||
onHide: Function;
|
||||
|
||||
// Optional
|
||||
animation?: boolean;
|
||||
autoFocus?: boolean;
|
||||
backdrop?: boolean|string;
|
||||
bsSize?: string;
|
||||
container?: any; // TODO: Add more specific type
|
||||
dialogClassName?: string;
|
||||
dialogComponent?: any; // TODO: Add more specific type
|
||||
enforceFocus?: boolean;
|
||||
keyboard?: boolean;
|
||||
}
|
||||
interface Modal extends React.ReactElement<ModalProps> { }
|
||||
interface ModalClass extends React.ComponentClass<ModalProps> {
|
||||
Header: ModalHeaderClass;
|
||||
Title: ModalTitleClass;
|
||||
Body: ModalBodyClass;
|
||||
Footer: ModalFooterClass;
|
||||
Dialog: ModalDialogClass;
|
||||
}
|
||||
var Modal: ModalClass;
|
||||
|
||||
|
||||
// <OverlayTrigger />
|
||||
// ----------------------------------------
|
||||
interface OverlayTriggerProps {
|
||||
// Required
|
||||
overlay: any; // TODO: Add more specific type
|
||||
|
||||
// Optional
|
||||
animation?: any; // TODO: Add more specific type
|
||||
container?: any; // TODO: Add more specific type
|
||||
containerPadding?: number;
|
||||
defaultOverlayShown?: boolean;
|
||||
delay?: number;
|
||||
delayHide?: number;
|
||||
delayShow?: number;
|
||||
onEnter?: Function;
|
||||
onEntered?: Function;
|
||||
onEntering?: Function;
|
||||
onExit?: Function;
|
||||
onExited?: Function;
|
||||
onExiting?: Function;
|
||||
placement?: string;
|
||||
rootClose?: boolean;
|
||||
trigger?: string;
|
||||
}
|
||||
interface OverlayTrigger extends React.ReactElement<OverlayTriggerProps> { }
|
||||
interface OverlayTriggerClass extends React.ComponentClass<OverlayTriggerProps> { }
|
||||
var OverlayTrigger: OverlayTriggerClass;
|
||||
|
||||
|
||||
// <Tooltip />
|
||||
// ----------------------------------------
|
||||
interface TooltipProps {
|
||||
// Optional
|
||||
arrowOffsetLeft?: number | string;
|
||||
arrowOffsetTop?: number | string;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
className?: string;
|
||||
id?: string;
|
||||
placement?: string;
|
||||
positionLeft?: number;
|
||||
positionTop?: number;
|
||||
title?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Tooltip extends React.ReactElement<TooltipProps> { }
|
||||
interface TooltipClass extends React.ComponentClass<TooltipProps> { }
|
||||
var Tooltip: TooltipClass;
|
||||
|
||||
|
||||
// <Popover/>
|
||||
// ----------------------------------------
|
||||
interface PopoverProps {
|
||||
// Optional
|
||||
arrowOffsetLeft?: number | string;
|
||||
arrowOffsetTop?: number | string;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
id?: string;
|
||||
placement?: string;
|
||||
positionLeft?: number;
|
||||
positionTop?: number;
|
||||
title: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Popover extends React.ReactElement<PopoverProps> { }
|
||||
interface PopoverClass extends React.ComponentClass<PopoverProps> { }
|
||||
var Popover: PopoverClass;
|
||||
|
||||
|
||||
// <Overlay />
|
||||
// ----------------------------------------
|
||||
interface OverlayProps {
|
||||
// Optional
|
||||
animation?: any; // TODO: Add more specific type
|
||||
container?: any; // TODO: Add more specific type
|
||||
containerPadding?: number; // TODO: Add more specific type
|
||||
onEnter?: Function;
|
||||
onEntered?: Function;
|
||||
onEntering?: Function;
|
||||
onExit?: Function;
|
||||
onExited?: Function;
|
||||
onExiting?: Function;
|
||||
onHide?: Function;
|
||||
placement?: string;
|
||||
rootClose?: boolean;
|
||||
show?: boolean;
|
||||
target?: Function;
|
||||
}
|
||||
interface Overlay extends React.ReactElement<OverlayProps> { }
|
||||
interface OverlayClass extends React.ComponentClass<OverlayProps> { }
|
||||
var Overlay: OverlayClass;
|
||||
|
||||
|
||||
// <ProgressBar />
|
||||
// ----------------------------------------
|
||||
interface ProgressBarProps {
|
||||
// Optional
|
||||
active?: boolean;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
children?: any; // TODO: Add more specific type
|
||||
className?: string;
|
||||
interpolatedClass?: any; // TODO: Add more specific type
|
||||
label?: any; // TODO: Add more specific type
|
||||
key?: number; // TODO: Add more specific type
|
||||
max?: number;
|
||||
min?: number;
|
||||
now?: number;
|
||||
srOnly?: boolean;
|
||||
striped?: boolean;
|
||||
}
|
||||
interface ProgressBar extends React.ReactElement<ProgressBarProps> { }
|
||||
interface ProgressBarClass extends React.ComponentClass<ProgressBarProps> { }
|
||||
var ProgressBar: ProgressBarClass;
|
||||
|
||||
|
||||
// <Nav />
|
||||
// ----------------------------------------
|
||||
// TODO: This one turned into a union of two different types
|
||||
interface NavProps {
|
||||
// Optional
|
||||
activeHref?: string;
|
||||
activeKey?: any;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
className?: string;
|
||||
collapsible?: boolean;
|
||||
eventKey?: any;
|
||||
expanded?: boolean;
|
||||
id?: string;
|
||||
justified?: boolean;
|
||||
navbar?: boolean;
|
||||
onSelect?: Function;
|
||||
pullRight?: boolean;
|
||||
right?: boolean;
|
||||
stacked?: boolean;
|
||||
ulClassName?: string;
|
||||
ulId?: string;
|
||||
}
|
||||
interface Nav extends React.ReactElement<NavProps> { }
|
||||
interface NavClass extends React.ComponentClass<NavProps> { }
|
||||
var Nav: NavClass;
|
||||
|
||||
|
||||
// <NavItem />
|
||||
// ----------------------------------------
|
||||
interface NavItemProps {
|
||||
active?: boolean;
|
||||
brand?: any; // TODO: Add more specific type
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
defaultNavExpanded?: boolean;
|
||||
disabled?: boolean;
|
||||
eventKey?: any;
|
||||
fixedBottom?: boolean;
|
||||
fixedTop?: boolean;
|
||||
fluid?: boolean;
|
||||
href?: string;
|
||||
inverse?: boolean;
|
||||
linkId?: string;
|
||||
navExpanded?: boolean;
|
||||
onSelect?: Function;
|
||||
onToggle?: Function;
|
||||
role?: string;
|
||||
staticTop?: boolean;
|
||||
target?: string;
|
||||
title?: string;
|
||||
toggleButton?: any; // TODO: Add more specific type
|
||||
toggleNavKey?: string | number;
|
||||
}
|
||||
interface NavItem extends React.ReactElement<NavItemProps> { }
|
||||
interface NavItemClass extends React.ComponentClass<NavItemProps> { }
|
||||
var NavItem: NavItemClass;
|
||||
|
||||
|
||||
// <Navbar />
|
||||
// ----------------------------------------
|
||||
interface NavbarProps {
|
||||
brand?: any; // TODO: Add more specific type
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
defaultNavExpanded?: boolean;
|
||||
fixedBottom?: boolean;
|
||||
fixedTop?: boolean;
|
||||
fluid?: boolean;
|
||||
inverse?: boolean;
|
||||
navExpanded?: boolean;
|
||||
onToggle?: Function;
|
||||
role?: string;
|
||||
staticTop?: boolean;
|
||||
toggleButton?: any; // TODO: Add more specific type
|
||||
toggleNavKey?: string | number;
|
||||
}
|
||||
interface Navbar extends React.ReactElement<NavbarProps> { }
|
||||
interface NavbarClass extends React.ComponentClass<NavbarProps> { }
|
||||
var Navbar: NavbarClass;
|
||||
|
||||
|
||||
// <NavDropdown />
|
||||
// ----------------------------------------
|
||||
interface NavDropdownProps {
|
||||
eventKey?: any;
|
||||
title?: string;
|
||||
id?: string;
|
||||
}
|
||||
interface NavDropdown extends React.ReactElement<NavDropdownProps> { }
|
||||
interface NavDropdownClass extends React.ComponentClass<NavDropdownProps> { }
|
||||
var NavDropdown: NavDropdownClass;
|
||||
|
||||
|
||||
// <Tabs />
|
||||
// ----------------------------------------
|
||||
interface TabsProps {
|
||||
activeKey?: any;
|
||||
animation?: boolean;
|
||||
bsStyle?: string;
|
||||
defaultActiveKey?: any;
|
||||
id?: string | number;
|
||||
onSelect?: Function;
|
||||
paneWidth?: any; // TODO: Add more specific type
|
||||
position?: string;
|
||||
tabWidth?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Tabs extends React.ReactElement<TabsProps> { }
|
||||
interface TabsClass extends React.ComponentClass<TabsProps> { }
|
||||
var Tabs: TabsClass;
|
||||
|
||||
|
||||
// <Tab />
|
||||
// ----------------------------------------
|
||||
interface TabProps {
|
||||
animation?: boolean;
|
||||
disabled?: boolean;
|
||||
eventKey?: any; // TODO: Add more specific type
|
||||
title?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Tab extends React.ReactElement<TabProps> { }
|
||||
interface TabClass extends React.ComponentClass<TabProps> { }
|
||||
var Tab: TabClass;
|
||||
|
||||
|
||||
// <Pager />
|
||||
// ----------------------------------------
|
||||
interface PagerProps {
|
||||
onSelect?: Function;
|
||||
}
|
||||
interface Pager extends React.ReactElement<PagerProps> { }
|
||||
interface PagerClass extends React.ComponentClass<PagerProps> { }
|
||||
var Pager: PagerClass;
|
||||
|
||||
|
||||
// <PageItem />
|
||||
// ----------------------------------------
|
||||
interface PageItemProps {
|
||||
disabled?: boolean;
|
||||
eventKey?: any;
|
||||
href?: string;
|
||||
next?: boolean;
|
||||
onSelect?: Function;
|
||||
previous?: boolean;
|
||||
target?: string;
|
||||
title?: string;
|
||||
}
|
||||
interface PageItem extends React.ReactElement<PageItemProps> { }
|
||||
interface PageItemClass extends React.ComponentClass<PageItemProps> { }
|
||||
var PageItem: PageItemClass;
|
||||
|
||||
|
||||
// <Pagination />
|
||||
// ----------------------------------------
|
||||
interface PaginationProps {
|
||||
activePage?: number;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
buttonComponentClass?: any; // TODO: Add more specific type
|
||||
ellipsis?: boolean;
|
||||
first?: boolean;
|
||||
items?: number;
|
||||
last?: boolean;
|
||||
maxButtons?: number;
|
||||
next?: boolean;
|
||||
onSelect?: Function;
|
||||
prev?: boolean;
|
||||
}
|
||||
interface Pagination extends React.ReactElement<PaginationProps> { }
|
||||
interface PaginationClass extends React.ComponentClass<PaginationProps> { }
|
||||
var Pagination: PaginationClass;
|
||||
|
||||
|
||||
// <Alert />
|
||||
// ----------------------------------------
|
||||
interface AlertProps {
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
closeLabel?: string;
|
||||
dismissAfter?: number;
|
||||
onDismiss?: Function;
|
||||
}
|
||||
interface Alert extends React.ReactElement<AlertProps> { }
|
||||
interface AlertClass extends React.ComponentClass<AlertProps> { }
|
||||
var Alert: AlertClass;
|
||||
|
||||
|
||||
// <Carousel />
|
||||
// ----------------------------------------
|
||||
interface CarouselProps {
|
||||
activeIndex?: number;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
controls?: boolean;
|
||||
defaultActiveIndex?: number;
|
||||
direction?: string;
|
||||
indicators?: boolean;
|
||||
interval?: number;
|
||||
nextIcon?: any; // TODO: Add more specific type
|
||||
onSelect?: Function;
|
||||
onSlideEnd?: Function;
|
||||
pauseOnHover?: boolean;
|
||||
prevIcon?: any; // TODO: Add more specific type
|
||||
slide?: boolean;
|
||||
wrap?: boolean;
|
||||
}
|
||||
interface Carousel extends React.ReactElement<CarouselProps> { }
|
||||
interface CarouselClass extends React.ComponentClass<CarouselProps> { }
|
||||
var Carousel: CarouselClass;
|
||||
|
||||
|
||||
// <CarouselItem />
|
||||
// ----------------------------------------
|
||||
interface CarouselItemProps {
|
||||
active?: boolean;
|
||||
animtateIn?: boolean;
|
||||
animateOut?: boolean;
|
||||
caption?: any; // TODO: Add more specific type
|
||||
direction?: string;
|
||||
index?: number;
|
||||
onAnimateOutEnd?: Function;
|
||||
}
|
||||
interface CarouselItem extends React.ReactElement<CarouselItemProps> { }
|
||||
interface CarouselItemClass extends React.ComponentClass<CarouselItemProps> { }
|
||||
var CarouselItem: CarouselItemClass;
|
||||
|
||||
|
||||
// <Grid />
|
||||
// ----------------------------------------
|
||||
interface GridProps {
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
fluid?: boolean;
|
||||
}
|
||||
interface Grid extends React.ReactElement<GridProps> { }
|
||||
interface GridClass extends React.ComponentClass<GridProps> { }
|
||||
var Grid: GridClass;
|
||||
|
||||
|
||||
// <Row />
|
||||
// ----------------------------------------
|
||||
interface RowProps {
|
||||
className?: string;
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Row extends React.ReactElement<RowProps> { }
|
||||
interface RowClass extends React.ComponentClass<RowProps> { }
|
||||
var Row: RowClass;
|
||||
|
||||
|
||||
// <Col />
|
||||
// ----------------------------------------
|
||||
interface ColProps {
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
lg?: number;
|
||||
lgOffset?: number;
|
||||
lgPull?: number;
|
||||
lgPush?: number;
|
||||
md?: number;
|
||||
mdOffset?: number;
|
||||
mdPull?: number;
|
||||
mdPush?: number;
|
||||
sm?: number;
|
||||
smOffset?: number;
|
||||
smPull?: number;
|
||||
smPush?: number;
|
||||
xs?: number;
|
||||
xsOffset?: number;
|
||||
xsPull?: number;
|
||||
xsPush?: number;
|
||||
}
|
||||
interface Col extends React.ReactElement<ColProps> { }
|
||||
interface ColClass extends React.ComponentClass<ColProps> { }
|
||||
var Col: ColClass;
|
||||
|
||||
|
||||
// <Thumbnail />
|
||||
// ----------------------------------------
|
||||
interface ThumbnailProps {
|
||||
alt?: string;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
href?: string;
|
||||
src?: string;
|
||||
}
|
||||
interface Thumbnail extends React.ReactElement<ThumbnailProps> { }
|
||||
interface ThumbnailClass extends React.ComponentClass<ThumbnailProps> { }
|
||||
var Thumbnail: ThumbnailClass;
|
||||
|
||||
|
||||
// <ListGroup />
|
||||
// ----------------------------------------
|
||||
interface ListGroupProps {
|
||||
className?: string;
|
||||
id?: string | number;
|
||||
fill?: boolean; // TODO: Add more specific type
|
||||
}
|
||||
interface ListGroup extends React.ReactElement<ListGroupProps> { }
|
||||
interface ListGroupClass extends React.ComponentClass<ListGroupProps> { }
|
||||
var ListGroup: ListGroupClass;
|
||||
|
||||
|
||||
// <ListGroupItem />
|
||||
// ----------------------------------------
|
||||
interface ListGroupItemProps {
|
||||
active?: any;
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
className?: string;
|
||||
disabled?: any;
|
||||
eventKey?: any;
|
||||
header?: any; // TODO: Add more specific type
|
||||
href?: string;
|
||||
key?: any; // TODO: Add more specific type
|
||||
listItem?: boolean;
|
||||
onClick?: Function; // TODO: Add more specific type
|
||||
target?: string;
|
||||
}
|
||||
interface ListGroupItem extends React.ReactElement<ListGroupItemProps> { }
|
||||
interface ListGroupItemClass extends React.ComponentClass<ListGroupItemProps> { }
|
||||
var ListGroupItem: ListGroupItemClass;
|
||||
|
||||
|
||||
// <Label />
|
||||
// ----------------------------------------
|
||||
interface LabelProps {
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
}
|
||||
interface Label extends React.ReactElement<LabelProps> { }
|
||||
interface LabelClass extends React.ComponentClass<LabelProps> { }
|
||||
var Label: LabelClass;
|
||||
|
||||
|
||||
// <Badge />
|
||||
// ----------------------------------------
|
||||
interface BadgeProps {
|
||||
pullRight?: boolean;
|
||||
}
|
||||
interface Badge extends React.ReactElement<BadgeProps> { }
|
||||
interface BadgeClass extends React.ComponentClass<BadgeProps> { }
|
||||
var Badge: BadgeClass;
|
||||
|
||||
|
||||
// <Jumbotron />
|
||||
// ----------------------------------------
|
||||
interface JumbotronProps {
|
||||
componentClass?: any; // TODO: Add more specific type
|
||||
}
|
||||
interface Jumbotron extends React.ReactElement<JumbotronProps> { }
|
||||
interface JumbotronClass extends React.ComponentClass<JumbotronProps> { }
|
||||
var Jumbotron: JumbotronClass;
|
||||
|
||||
|
||||
// <PageHeader />
|
||||
// ----------------------------------------
|
||||
interface PageHeaderProps {
|
||||
// No props
|
||||
}
|
||||
interface PageHeader extends React.ReactElement<PageHeaderProps> { }
|
||||
interface PageHeaderClass extends React.ComponentClass<PageHeaderProps> { }
|
||||
var PageHeader: PageHeaderClass;
|
||||
|
||||
|
||||
// <Well />
|
||||
// ----------------------------------------
|
||||
interface WellProps {
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
}
|
||||
interface Well extends React.ReactElement<WellProps> { }
|
||||
interface WellClass extends React.ComponentClass<WellProps> { }
|
||||
var Well: WellClass;
|
||||
|
||||
|
||||
// <Glyphicon />
|
||||
// ----------------------------------------
|
||||
interface GlyphiconProps {
|
||||
// Required
|
||||
glyph: string;
|
||||
}
|
||||
interface Glyphicon extends React.ReactElement<GlyphiconProps> { }
|
||||
interface GlyphiconClass extends React.ComponentClass<GlyphiconProps> { }
|
||||
var Glyphicon: GlyphiconClass;
|
||||
|
||||
|
||||
// <Table />
|
||||
// ----------------------------------------
|
||||
interface TableProps {
|
||||
bordered?: boolean;
|
||||
condensed?: boolean;
|
||||
hover?: boolean;
|
||||
responsive?: boolean;
|
||||
striped?: boolean;
|
||||
}
|
||||
interface Table extends React.ReactElement<TableProps> { }
|
||||
interface TableClass extends React.ComponentClass<TableProps> { }
|
||||
var Table: TableClass;
|
||||
|
||||
|
||||
// <Input />
|
||||
// ----------------------------------------
|
||||
interface InputProps {
|
||||
addonAfter?: any; // TODO: Add more specific type
|
||||
addonBefore?: any; // TODO: Add more specific type
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
buttonAfter?: any; // TODO: Add more specific type
|
||||
buttonBefore?: any; // TODO: Add more specific type
|
||||
checked?: boolean;
|
||||
disabled?: boolean;
|
||||
feedbackIcon?: any; // TODO: Add more specific type
|
||||
groupClassName?: string;
|
||||
hasFeedback?: boolean;
|
||||
help?: any; // TODO: Add more specific type
|
||||
id?: string | number;
|
||||
label?: any; // TODO: Add more specific type
|
||||
labelClassName?: string;
|
||||
multiple?: boolean;
|
||||
placeholder?: string;
|
||||
ref?: string;
|
||||
readOnly?: boolean;
|
||||
type?: string;
|
||||
onChange?: Function; // TODO: Add more specific type
|
||||
onKeyDown?: Function; // TODO: Add more specific type
|
||||
onKeyUp?: Function; // TODO: Add more specific type
|
||||
onKeyPress?: Function; // TODO: Add more specific type
|
||||
value?: any; // TODO: Add more specific type
|
||||
wrapperClassName?: string;
|
||||
}
|
||||
interface Input extends React.ReactElement<InputProps> { }
|
||||
interface InputClass extends React.ComponentClass<InputProps> { }
|
||||
var Input: InputClass;
|
||||
|
||||
|
||||
// <ButtonInput />
|
||||
// ----------------------------------------
|
||||
interface ButtonInputProps {
|
||||
addonAfter?: any; // TODO: Add more specific type
|
||||
addonBefore?: any; // TODO: Add more specific type
|
||||
bsSize?: string;
|
||||
bsStyle?: string;
|
||||
buttonAfter?: any; // TODO: Add more specific type
|
||||
buttonBefore?: any; // TODO: Add more specific type
|
||||
disabled?: boolean;
|
||||
feedbackIcon?: any; // TODO: Add more specific type
|
||||
groupClassName?: string;
|
||||
hasFeedback?: boolean;
|
||||
help?: any; // TODO: Add more specific type
|
||||
id?: string | number;
|
||||
label?: any; // TODO: Add more specific type
|
||||
labelClassName?: string;
|
||||
multiple?: boolean;
|
||||
onClick?: Function; // TODO: Add more specific type
|
||||
type?: string;
|
||||
value?: any; // TODO: Add more specific type
|
||||
wrapperClassName?: string;
|
||||
}
|
||||
interface ButtonInput extends React.ReactElement<ButtonInputProps> { }
|
||||
interface ButtonInputClass extends React.ComponentClass<ButtonInputProps> { }
|
||||
var ButtonInput: ButtonInputClass;
|
||||
|
||||
|
||||
// TODO: FormControls.Static
|
||||
|
||||
|
||||
// <Portal />
|
||||
// ----------------------------------------
|
||||
interface PortalProps {
|
||||
dimension?: string | Function;
|
||||
getDimensionValue?: Function;
|
||||
in?: boolean;
|
||||
onEnter?: Function;
|
||||
onEntered?: Function;
|
||||
onEntering?: Function;
|
||||
onExit?: Function;
|
||||
onExited?: Function;
|
||||
onExiting?: Function;
|
||||
role?: string;
|
||||
timeout?: number;
|
||||
transitionAppear?: boolean;
|
||||
unmountOnExit?: boolean;
|
||||
}
|
||||
interface Portal extends React.ReactElement<PortalProps> { }
|
||||
interface PortalClass extends React.ComponentClass<PortalProps> { }
|
||||
var Portal: PortalClass;
|
||||
|
||||
|
||||
// <Position />
|
||||
// ----------------------------------------
|
||||
interface PositionProps {
|
||||
dimension?: string | Function;
|
||||
getDimensionValue?: Function;
|
||||
in?: boolean;
|
||||
onEnter?: Function;
|
||||
onEntered?: Function;
|
||||
onEntering?: Function;
|
||||
onExit?: Function;
|
||||
onExited?: Function;
|
||||
onExiting?: Function;
|
||||
role?: string;
|
||||
timeout?: number;
|
||||
transitionAppear?: boolean;
|
||||
unmountOnExit?: boolean;
|
||||
}
|
||||
interface Position extends React.ReactElement<PositionProps> { }
|
||||
interface PositionClass extends React.ComponentClass<PositionProps> { }
|
||||
var Position: PositionClass;
|
||||
|
||||
|
||||
// <Fade />
|
||||
// ----------------------------------------
|
||||
interface FadeProps {
|
||||
in?: boolean;
|
||||
onEnter?: Function;
|
||||
onEntered?: Function;
|
||||
onEntering?: Function;
|
||||
onExit?: Function;
|
||||
onExited?: Function;
|
||||
onExiting?: Function;
|
||||
timeout?: number;
|
||||
transitionAppear?: boolean;
|
||||
unmountOnExit?: boolean;
|
||||
}
|
||||
interface Fade extends React.ReactElement<FadeProps> { }
|
||||
interface FadeClass extends React.ComponentClass<FadeProps> { }
|
||||
var Fade: FadeClass;
|
||||
}
|
||||
@@ -81,6 +81,8 @@ module Knight {
|
||||
}
|
||||
|
||||
export class Knight extends React.Component<KnightP, {}> {
|
||||
static defaultProps: KnightP;
|
||||
|
||||
static create = React.createFactory(Knight);
|
||||
|
||||
componentDidMount() {
|
||||
@@ -154,6 +156,8 @@ module BoardSquare {
|
||||
}
|
||||
|
||||
export class BoardSquare extends React.Component<BoardSquareP, {}> {
|
||||
static defaultProps: BoardSquareP;
|
||||
|
||||
private _renderOverlay = (color: string) => {
|
||||
return r.div({
|
||||
style: {
|
||||
|
||||
@@ -84,6 +84,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
static childContextTypes: React.ValidationMap<ChildContext> = {
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
getChildContext() {
|
||||
|
||||
Vendored
+8
-3
@@ -85,14 +85,19 @@ declare namespace __React {
|
||||
// Reat.addons.update
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface UpdateSpec {
|
||||
interface UpdateSpecCommand {
|
||||
$set?: any;
|
||||
$merge?: {};
|
||||
$apply?(value: any): any;
|
||||
// [key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpec {
|
||||
interface UpdateSpecPath {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
|
||||
@@ -82,6 +82,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
getChildContext() {
|
||||
|
||||
Vendored
+20
-5
@@ -132,6 +132,11 @@ declare namespace __React {
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> implements ComponentLifecycle<P, S> {
|
||||
static propTypes: ValidationMap<any>;
|
||||
static contextTypes: ValidationMap<any>;
|
||||
static childContextTypes: ValidationMap<any>;
|
||||
static defaultProps: Props<any>;
|
||||
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
@@ -371,7 +376,7 @@ declare namespace __React {
|
||||
onTouchStart?: TouchEventHandler;
|
||||
onScroll?: UIEventHandler;
|
||||
onWheel?: WheelEventHandler;
|
||||
|
||||
|
||||
className?: string;
|
||||
id?: string;
|
||||
|
||||
@@ -935,6 +940,11 @@ declare module "react/addons" {
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> implements ComponentLifecycle<P, S> {
|
||||
static propTypes: ValidationMap<any>;
|
||||
static contextTypes: ValidationMap<any>;
|
||||
static childContextTypes: ValidationMap<any>;
|
||||
static defaultProps: Props<any>;
|
||||
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
@@ -1603,7 +1613,7 @@ declare module "react/addons" {
|
||||
item(index: number): Touch;
|
||||
identifiedTouch(identifier: number): Touch;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// React.addons
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -1681,14 +1691,19 @@ declare module "react/addons" {
|
||||
// Reat.addons.update
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface UpdateSpec {
|
||||
interface UpdateSpecCommand {
|
||||
$set?: any;
|
||||
$merge?: {};
|
||||
$apply?(value: any): any;
|
||||
// [key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpec {
|
||||
interface UpdateSpecPath {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/// <reference path="redux-thunk.d.ts" />
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
import { createStore, applyMiddleware, Store, Dispatch } from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import { ThunkInterface } from 'redux-thunk';
|
||||
import { Promise } from 'es6-promise';
|
||||
|
||||
declare var rootReducer: Function;
|
||||
declare var fetch: any;
|
||||
|
||||
// create a store that has redux-thunk middleware enabled
|
||||
const createStoreWithMiddleware = applyMiddleware(
|
||||
thunk
|
||||
)(createStore);
|
||||
|
||||
const store: Store = createStoreWithMiddleware(rootReducer);
|
||||
|
||||
function fetchSecretSauce() {
|
||||
return fetch('https://www.google.com/search?q=secret+sauce');
|
||||
}
|
||||
|
||||
// These are the normal action creators you have seen so far.
|
||||
// The actions they return can be dispatched without any middleware.
|
||||
// However, they only express “facts” and not the “async flow”.
|
||||
|
||||
function makeASandwich(forPerson: any, secretSauce?: any): any {
|
||||
return {
|
||||
type: 'MAKE_SANDWICH',
|
||||
forPerson,
|
||||
secretSauce
|
||||
};
|
||||
}
|
||||
|
||||
function apologize(fromPerson: any, toPerson?: any, error?: any): any {
|
||||
return {
|
||||
type: 'APOLOGIZE',
|
||||
fromPerson,
|
||||
toPerson,
|
||||
error
|
||||
};
|
||||
}
|
||||
|
||||
function withdrawMoney(amount: number): any {
|
||||
return {
|
||||
type: 'WITHDRAW',
|
||||
amount
|
||||
};
|
||||
}
|
||||
|
||||
// Even without middleware, you can dispatch an action:
|
||||
store.dispatch(withdrawMoney(100));
|
||||
|
||||
// But what do you do when you need to start an asynchronous action,
|
||||
// such as an API call, or a router transition?
|
||||
|
||||
// Meet thunks.
|
||||
// A thunk is a function that returns a function.
|
||||
// This is a thunk.
|
||||
|
||||
function makeASandwichWithSecretSauce(forPerson: any): ThunkInterface {
|
||||
|
||||
// Invert control!
|
||||
// Return a function that accepts `dispatch` so we can dispatch later.
|
||||
// Thunk middleware knows how to turn thunk async actions into actions.
|
||||
|
||||
return function (dispatch: Dispatch): any {
|
||||
return fetchSecretSauce().then(
|
||||
(sauce: any) => dispatch(makeASandwich(forPerson, sauce)),
|
||||
(error: any) => dispatch(apologize('The Sandwich Shop', forPerson, error))
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
// Thunk middleware lets me dispatch thunk async actions
|
||||
// as if they were actions!
|
||||
|
||||
store.dispatch(
|
||||
makeASandwichWithSecretSauce('Me')
|
||||
);
|
||||
|
||||
// It even takes care to return the thunk’s return value
|
||||
// from the dispatch, so I can chain Promises as long as I return them.
|
||||
|
||||
store.dispatch(
|
||||
makeASandwichWithSecretSauce('My wife')
|
||||
).then(() => {
|
||||
console.log('Done!');
|
||||
});
|
||||
|
||||
// In fact I can write action creators that dispatch
|
||||
// actions and async actions from other action creators,
|
||||
// and I can build my control flow with Promises.
|
||||
|
||||
function makeSandwichesForEverybody(): ThunkInterface {
|
||||
return function (dispatch: Dispatch, getState: () => any): any {
|
||||
if (!getState().sandwiches.isShopOpen) {
|
||||
|
||||
// You don’t have to return Promises, but it’s a handy convention
|
||||
// so the caller can always call .then() on async dispatch result.
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// We can dispatch both plain object actions and other thunks,
|
||||
// which lets us compose the asynchronous actions in a single flow.
|
||||
|
||||
return dispatch(
|
||||
makeASandwichWithSecretSauce('My Grandma')
|
||||
).then(() =>
|
||||
Promise.all([
|
||||
dispatch(makeASandwichWithSecretSauce('Me')),
|
||||
dispatch(makeASandwichWithSecretSauce('My wife'))
|
||||
])
|
||||
).then(() =>
|
||||
dispatch(makeASandwichWithSecretSauce('Our kids'))
|
||||
).then(() =>
|
||||
dispatch(getState().myMoney > 42 ?
|
||||
withdrawMoney(42) :
|
||||
apologize('Me', 'The Sandwich Shop')
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for redux-thunk
|
||||
// Project: https://github.com/gaearon/redux-thunk
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
|
||||
declare module "redux-thunk" {
|
||||
import { Middleware, Dispatch } from 'redux';
|
||||
|
||||
export interface Thunk extends Middleware { }
|
||||
|
||||
export interface ThunkInterface {
|
||||
<T>(dispatch: Dispatch, getState?: () => T): any;
|
||||
}
|
||||
|
||||
var thunk: Thunk;
|
||||
|
||||
export default thunk;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -264,6 +264,7 @@ declare module Sinon {
|
||||
fakeHTTPMethods: boolean;
|
||||
getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string;
|
||||
requests: SinonFakeXMLHttpRequest[];
|
||||
respondImmediately: boolean;
|
||||
|
||||
// Methods
|
||||
respondWith(body: string): void;
|
||||
|
||||
Vendored
+97
-47
@@ -217,7 +217,7 @@ declare module Slick {
|
||||
* @extends Slick.NonDataItem
|
||||
* @constructor
|
||||
*/
|
||||
export class Group<T, R> extends NonDataRow {
|
||||
export class Group<T extends SlickData> extends NonDataRow {
|
||||
|
||||
constructor();
|
||||
|
||||
@@ -240,7 +240,7 @@ declare module Slick {
|
||||
* @property value
|
||||
* @type {Object}
|
||||
*/
|
||||
public value: T;
|
||||
public value: any;
|
||||
|
||||
/***
|
||||
* Formatted display value of the group.
|
||||
@@ -261,21 +261,21 @@ declare module Slick {
|
||||
* @property totals
|
||||
* @type {GroupTotals}
|
||||
*/
|
||||
public totals: GroupTotals<T, R>;
|
||||
public totals: GroupTotals<T>;
|
||||
|
||||
/**
|
||||
* Rows that are part of the group.
|
||||
* @property rows
|
||||
* @type {Array}
|
||||
*/
|
||||
public rows: R[];
|
||||
public rows: T[];
|
||||
|
||||
/**
|
||||
* Sub-groups that are part of the group.
|
||||
* @property groups
|
||||
* @type {Array}
|
||||
*/
|
||||
public groups: Group<T, R>[];
|
||||
public groups: Group<T>[];
|
||||
|
||||
/**
|
||||
* A unique key used to identify the group. This key can be used in calls to DataView
|
||||
@@ -292,7 +292,7 @@ declare module Slick {
|
||||
* @param group {Group} Group instance to compare to.
|
||||
* todo: this is on the prototype (NonDataRow()) instance, not Group, maybe doesn't matter?
|
||||
*/
|
||||
public equals(group: Group<T, R>): boolean;
|
||||
public equals(group: Group<T>): boolean;
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -304,7 +304,7 @@ declare module Slick {
|
||||
* @extends Slick.NonDataItem
|
||||
* @constructor
|
||||
*/
|
||||
export class GroupTotals<T, R> extends NonDataRow {
|
||||
export class GroupTotals<T> extends NonDataRow {
|
||||
|
||||
constructor();
|
||||
|
||||
@@ -313,7 +313,7 @@ declare module Slick {
|
||||
* @param group
|
||||
* @type {Group}
|
||||
*/
|
||||
public group: Group<T, R>;
|
||||
public group: Group<T>;
|
||||
|
||||
}
|
||||
|
||||
@@ -690,14 +690,86 @@ declare module Slick {
|
||||
}
|
||||
|
||||
export interface DataProvider<T extends SlickData> {
|
||||
getItem(index: number): T;
|
||||
/**
|
||||
* Returns the number of data items in the set.
|
||||
*/
|
||||
getLength(): number;
|
||||
|
||||
/**
|
||||
* Returns the item at a given index.
|
||||
* @param index
|
||||
*/
|
||||
getItem(index: number): T;
|
||||
|
||||
/**
|
||||
* Returns the metadata for the item at a given index (optional).
|
||||
* @param index
|
||||
*/
|
||||
getItemMetadata?(index: number): RowMetadata<T>;
|
||||
}
|
||||
|
||||
export interface SlickData {
|
||||
// todo ? might be able to leave as empty
|
||||
}
|
||||
|
||||
export interface RowMetadata<T> {
|
||||
/**
|
||||
* One or more (space-separated) CSS classes to be added to the entire row.
|
||||
*/
|
||||
cssClasses?: string;
|
||||
|
||||
/**
|
||||
* Whether or not any cells in the row can be set as "active".
|
||||
*/
|
||||
focusable?: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not a row or any cells in it can be selected.
|
||||
*/
|
||||
selectable?: boolean;
|
||||
|
||||
/**
|
||||
* Metadata related to individual columns
|
||||
*/
|
||||
columns?: {
|
||||
/**
|
||||
* Metadata indexed by column id
|
||||
*/
|
||||
[index: string]: ColumnMetadata<T>;
|
||||
/**
|
||||
* Metadata indexed by column index
|
||||
*/
|
||||
[index: number]: ColumnMetadata<T>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ColumnMetadata<T extends SlickData> {
|
||||
/**
|
||||
* Whether or not a cell can be set as "active".
|
||||
*/
|
||||
focusable?: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not a cell can be selected.
|
||||
*/
|
||||
selectable?: boolean;
|
||||
|
||||
/**
|
||||
* A custom cell formatter.
|
||||
*/
|
||||
formatter?: Formatter<T>;
|
||||
|
||||
/**
|
||||
* A custom cell editor.
|
||||
*/
|
||||
editor?: Slick.Editors.Editor<T>;
|
||||
|
||||
/**
|
||||
* Number of columns this cell will span. Can also contain "*" to indicate that the cell should span the rest of the row.
|
||||
*/
|
||||
colspan?: number|string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecting cells in SlickGrid is handled by a selection model.
|
||||
* Selection models are controllers responsible for handling user interactions and notifying subscribers of the changes in the selection. Selection is represented as an array of Slick.Range objects.
|
||||
@@ -1489,8 +1561,7 @@ declare module Slick {
|
||||
public fastSort(field: string, ascending: boolean): void;
|
||||
public fastSort(field: Function, ascending: boolean): void; // todo: typeof(field), should be the same callback as Array.sort
|
||||
public reSort(): void;
|
||||
public setGrouping(groupingInfos: GroupingOptions<T>[]): void;
|
||||
public setGrouping(groupingInfo: GroupingOptions<T>): void;
|
||||
public setGrouping(groupingInfos: GroupingOptions<T> | GroupingOptions<T>[]): void;
|
||||
public getGrouping(): GroupingOptions<T>[];
|
||||
|
||||
/**
|
||||
@@ -1528,7 +1599,7 @@ declare module Slick {
|
||||
* the 'high' setGrouping.
|
||||
*/
|
||||
public expandGroup(...varArgs: string[]): void;
|
||||
public getGroups(): Group<T, any>[];
|
||||
public getGroups(): Group<T>[];
|
||||
public getIdxById(id: string): number;
|
||||
public getRowById(id: string): number;
|
||||
public getItemById(id: any): T;
|
||||
@@ -1546,7 +1617,7 @@ declare module Slick {
|
||||
|
||||
public getLength(): number;
|
||||
public getItem(index: number): T;
|
||||
public getItemMetadata(index?: number): TotalsRowMetadata<T>;
|
||||
public getItemMetadata(index: number): RowMetadata<T>;
|
||||
|
||||
public onRowCountChanged: Slick.Event<OnRowCountChangedEventData>;
|
||||
public onRowsChanged: Slick.Event<OnRowsChangedEventData>;
|
||||
@@ -1554,16 +1625,16 @@ declare module Slick {
|
||||
}
|
||||
|
||||
export interface GroupingOptions<T> {
|
||||
getter: Function; // todo
|
||||
formatter: Formatter<T>;
|
||||
comparer: (a:any, b:any) => any; // todo
|
||||
predefinedValues: any[]; // todo
|
||||
aggregators: Aggregators.Aggregator<T>[];
|
||||
aggregateEmpty: boolean;
|
||||
aggregateCollapsed: boolean;
|
||||
aggregateChildGroups: boolean;
|
||||
collapsed: boolean;
|
||||
displayTotalsRow: boolean;
|
||||
getter?: ((item?: T) => any) | string;
|
||||
formatter?: (item?: T) => string;
|
||||
comparer?: (a: Group<T>, b: Group<T>) => number;
|
||||
predefinedValues?: any[]; // todo
|
||||
aggregators?: Aggregators.Aggregator<T>[];
|
||||
aggregateEmpty?: boolean;
|
||||
aggregateCollapsed?: boolean;
|
||||
aggregateChildGroups?: boolean;
|
||||
collapsed?: boolean;
|
||||
displayTotalsRow?: boolean;
|
||||
}
|
||||
|
||||
export interface PagingOptions {
|
||||
@@ -1596,7 +1667,7 @@ declare module Slick {
|
||||
public field: string;
|
||||
public init(): void;
|
||||
public accumulate(item: T): void;
|
||||
public storeResult(groupTotals: GroupTotals<T, any>): void; // todo "R"
|
||||
public storeResult(groupTotals: GroupTotals<T>): void;
|
||||
}
|
||||
|
||||
export class Avg<T> extends Aggregator<T> {
|
||||
@@ -1633,29 +1704,8 @@ declare module Slick {
|
||||
export class GroupItemMetadataProvider<T extends Slick.SlickData> {
|
||||
public init(): void;
|
||||
public destroy(): void;
|
||||
public getGroupRowMetadata(): GroupRowMetadata<T>;
|
||||
public getTotalsRowMetadata(): TotalsRowMetadata<T>;
|
||||
}
|
||||
|
||||
export interface GroupRowMetadata<T extends Slick.SlickData> {
|
||||
selectable: boolean;
|
||||
focusable: boolean;
|
||||
cssClasses: string;
|
||||
columns: {
|
||||
0: {
|
||||
colspan: string;
|
||||
formatter: Formatter<T>;
|
||||
editor: Slick.Editors.Editor<T>;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export interface TotalsRowMetadata<T extends Slick.SlickData> {
|
||||
selectable: boolean;
|
||||
focusable: boolean;
|
||||
cssClasses: string;
|
||||
formatter: Formatter<T>;
|
||||
editor: Slick.Editors.Editor<T>;
|
||||
public getGroupRowMetadata(item?: Group<T>): RowMetadata<T>;
|
||||
public getTotalsRowMetadata(item?: GroupTotals<T>): RowMetadata<T>;
|
||||
}
|
||||
|
||||
export interface GroupItemMetadataProviderOptions {
|
||||
|
||||
Vendored
+82
-67
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Snap-SVG 0.3
|
||||
// Type definitions for Snap-SVG 0.4.1
|
||||
// Project: https://github.com/adobe-webplatform/Snap.svg
|
||||
// Definitions by: Lars Klein <https://github.com/lhk>
|
||||
// Definitions by: Lars Klein <https://github.com/lhk>, Mattanja Kern <https://github.com/mattanja>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function mina(a:number, A:number, b:number, B:number, get:Function, set:Function, easing?:(num:number)=>number):mina.AnimationDescriptor;
|
||||
@@ -13,7 +13,8 @@ declare module mina {
|
||||
status: Function;
|
||||
stop: Function;
|
||||
}
|
||||
export interface AnimationDescriptor{
|
||||
|
||||
export interface AnimationDescriptor {
|
||||
id: string;
|
||||
start: number;
|
||||
end: number;
|
||||
@@ -53,13 +54,12 @@ declare function Snap(query:string):Snap.Paper;
|
||||
declare function Snap(DOM:SVGElement):Snap.Paper;
|
||||
|
||||
declare module Snap {
|
||||
|
||||
export var filter:Filter;
|
||||
export var path:Path;
|
||||
|
||||
|
||||
export function Matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix;
|
||||
export function Matrix(svgMatrix:SVGMatrix):Matrix;
|
||||
|
||||
|
||||
export function ajax(url:string,postData:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,postData:Object,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
@@ -72,10 +72,10 @@ declare module Snap {
|
||||
export function select(query:string):Snap.Element;
|
||||
export function selectAll(query:string):any;
|
||||
export function snapTo(values:Array<number>,value:number,tolerance?:number):number;
|
||||
|
||||
|
||||
export function animate(from:number|number[],to:number|number[],updater:(n:number)=>void,duration:number,easing?:(num:number)=>number,callback?:()=>void):mina.MinaAnimation;
|
||||
export function animation(attr:Object,duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Animation;
|
||||
|
||||
|
||||
export function color(clr:string):RGBHSB;
|
||||
export function getRGB(color:string):RGB;
|
||||
export function hsb(h:number,s:number,b:number):HSB;
|
||||
@@ -89,27 +89,39 @@ declare module Snap {
|
||||
export function angle(x1:number,y1:number,x2:number,y2:number,x3?:number,y3?:number):number;
|
||||
export function rad(deg:number):number;
|
||||
export function deg(rad:number):number;
|
||||
|
||||
export function sin(angle: number): number;
|
||||
export function cos(angle: number): number;
|
||||
export function tan(angle: number): number;
|
||||
export function asin(angle: number): number;
|
||||
export function acos(angle: number): number;
|
||||
export function atan(angle: number): number;
|
||||
export function atan2(angle: number): number;
|
||||
|
||||
export function len(x1: number, y1: number, x2: number, y2: number): number;
|
||||
export function len2(x1: number, y1: number, x2: number, y2: number): number;
|
||||
|
||||
export function parse(svg:string):Fragment;
|
||||
export function parsePathString(pathString:string):Array<any>;
|
||||
export function parsePathString(pathString:Array<string>):Array<any>;
|
||||
export function parseTransformString(TString:string):Array<any>;
|
||||
export function parseTransformString(TString:Array<string>):Array<any>;
|
||||
|
||||
export interface RGB{
|
||||
|
||||
export function closest(x: number, y: number, X: number, Y: number): boolean;
|
||||
|
||||
export interface RGB {
|
||||
r:number;
|
||||
g:number;
|
||||
b:number;
|
||||
hex:string;
|
||||
}
|
||||
|
||||
export interface HSB{
|
||||
|
||||
export interface HSB {
|
||||
h:number;
|
||||
s:number;
|
||||
b:number;
|
||||
}
|
||||
|
||||
export interface RGBHSB{
|
||||
|
||||
export interface RGBHSB {
|
||||
r:number;
|
||||
g:number;
|
||||
b:number;
|
||||
@@ -120,14 +132,14 @@ declare module Snap {
|
||||
v:number;
|
||||
l:number;
|
||||
}
|
||||
|
||||
export interface HSL{
|
||||
|
||||
export interface HSL {
|
||||
h:number;
|
||||
s:number;
|
||||
l:number;
|
||||
}
|
||||
|
||||
export interface BBox{
|
||||
|
||||
export interface BBox {
|
||||
cx:number;
|
||||
cy:number;
|
||||
h:number;
|
||||
@@ -144,7 +156,7 @@ declare module Snap {
|
||||
y2:number;
|
||||
y:number;
|
||||
}
|
||||
|
||||
|
||||
export interface TransformationDescriptor {
|
||||
string: string;
|
||||
globalMatrix: Snap.Matrix;
|
||||
@@ -154,7 +166,8 @@ declare module Snap {
|
||||
local: string;
|
||||
toString(): string;
|
||||
}
|
||||
export interface Animation{
|
||||
|
||||
export interface Animation {
|
||||
attr:{[attr:string]:string|number|boolean|any};
|
||||
duration:number;
|
||||
easing?:(num:number)=>number;
|
||||
@@ -165,16 +178,19 @@ declare module Snap {
|
||||
add(el:Snap.Element):Snap.Element;
|
||||
addClass(value:string):Snap.Element;
|
||||
after(el:Snap.Element):Snap.Element;
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
|
||||
align(el: Snap.Element, way: string):Snap.Element;
|
||||
animate(animation:any):Snap.Element;
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
|
||||
append(el:Snap.Element):Snap.Element;
|
||||
appendTo(el:Snap.Element):Snap.Element;
|
||||
asPX(attr:string,value?:string):number; //TODO: check what is really returned
|
||||
attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
|
||||
attr(param:string):string;
|
||||
attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
|
||||
before(el:Snap.Element):Snap.Element;
|
||||
children(): Snap.Element[];
|
||||
clone():Snap.Element;
|
||||
data(key:string,value?:any):any;
|
||||
getAlign(el: Snap.Element, way: string): string;
|
||||
getBBox():BBox;
|
||||
getPointAtLength(length:number):{x:number, y:number, alpha:number};
|
||||
getSubpath(from:number,to:number):string;
|
||||
@@ -195,20 +211,20 @@ declare module Snap {
|
||||
removeClass(value:string):Snap.Element;
|
||||
removeData(key?:string):Snap.Element;
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query: string): Snap.Set;
|
||||
selectAll(): Snap.Set;
|
||||
stop():Snap.Element;
|
||||
toDefs():Snap.Element;
|
||||
toJSON(): any;
|
||||
toggleClass(value:string,flag:boolean):Snap.Element;
|
||||
toPattern(x:number,y:number,width:number,height:number):Object;
|
||||
toPattern(x:string,y:string,width:string,height:string):Object;
|
||||
toString():string;
|
||||
toggleClass(value:string,flag:boolean):Snap.Element;
|
||||
transform(tstr:string):Snap.Element;
|
||||
transform(): TransformationDescriptor;
|
||||
transform(tstr:string):Snap.Element;
|
||||
type:string;
|
||||
use():Object;
|
||||
|
||||
|
||||
selectAll(): Snap.Set;
|
||||
selectAll(query: string): Snap.Set;
|
||||
|
||||
click(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
dblclick(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
mousedown(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
@@ -220,7 +236,7 @@ declare module Snap {
|
||||
touchmove(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
touchend(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
touchcancel(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
|
||||
|
||||
unclick(handler?: (event: MouseEvent) => void): Snap.Element;
|
||||
undblclick(handler: (event: MouseEvent) => void): Snap.Element;
|
||||
unmousedown(handler: (event: MouseEvent) => void): Snap.Element;
|
||||
@@ -236,9 +252,9 @@ declare module Snap {
|
||||
hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, inThisArg?: any, outThisArg?: any): Snap.Element;
|
||||
unhover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void): Snap.Element;
|
||||
|
||||
|
||||
drag():Snap.Element;
|
||||
drag(onMove: (dx: number, dy: number, event: MouseEvent) => void,
|
||||
drag(onMove: (dx: number, dy: number, x: number, y: number, event: MouseEvent) => void,
|
||||
onStart: (x: number, y: number, event: MouseEvent) => void,
|
||||
onEnd: (event: MouseEvent) => void,
|
||||
moveThisArg?: any,
|
||||
@@ -249,15 +265,14 @@ declare module Snap {
|
||||
onStart: (x: number, y: number, event: MouseEvent) => void,
|
||||
onEnd: (event: MouseEvent) => void): Snap.Element;
|
||||
}
|
||||
|
||||
|
||||
export interface Fragment {
|
||||
//TODO: The documentation says that selectAll returns a set, but the getting started guide
|
||||
// uses .attr on the returned object. That's not supported by a set
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query ?:string):Snap.Set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface Matrix {
|
||||
add(a:number,b:number,c:number,d:number,e:number,f:number):Matrix;
|
||||
add(matrix:Matrix):Matrix;
|
||||
@@ -267,13 +282,13 @@ declare module Snap {
|
||||
rotate(a:number,x?:number,y?:number):Matrix;
|
||||
scale(x:number,y?:number,cx?:number,cy?:number):Matrix;
|
||||
split():ExplicitTransform;
|
||||
toTransformString():string;
|
||||
toTransformString():string;
|
||||
translate(x:number,y:number):Matrix;
|
||||
x(x:number,y:number):number;
|
||||
y(x:number,y:number):number;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface ExplicitTransform {
|
||||
dx: number;
|
||||
dy: number;
|
||||
@@ -283,32 +298,32 @@ declare module Snap {
|
||||
rotate: number;
|
||||
isSimple: boolean;
|
||||
}
|
||||
|
||||
interface Paper extends Snap.Element {
|
||||
|
||||
clear():void;
|
||||
el(name:string, attr:Object):Snap.Element;
|
||||
filter(filstr:string):Snap.Element;
|
||||
gradient(gradient:string):any;
|
||||
g(varargs?:any):any;
|
||||
group(...els:any[]):any;
|
||||
mask(varargs:any):Object;
|
||||
ptrn(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
svg(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
toString():string;
|
||||
use(id?:string):Object;
|
||||
use(id?:Snap.Element):Object;
|
||||
|
||||
circle(x:number,y:number,r:number):Snap.Element;
|
||||
ellipse(x:number,y:number,rx:number,ry:number):Snap.Element;
|
||||
image(src:string,x:number,y:number,width:number,height:number):Snap.Element;
|
||||
line(x1:number,y1:number,x2:number,y2:number):Snap.Element;
|
||||
path(pathString?:string):Snap.Element;
|
||||
polygon(varargs:any[]):Snap.Element;
|
||||
polyline(varargs:any[]):Snap.Element;
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string|number):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string|number>):Snap.Element;
|
||||
interface Paper extends Snap.Element {
|
||||
clear():void;
|
||||
el(name:string, attr:Object):Snap.Element;
|
||||
filter(filstr:string):Snap.Element;
|
||||
gradient(gradient:string):any;
|
||||
g(varargs?:any):any;
|
||||
group(...els:any[]):any;
|
||||
mask(varargs:any):Object;
|
||||
ptrn(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
svg(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
toDataUrl(): string;
|
||||
toString():string;
|
||||
use(id?:string):Object;
|
||||
use(id?:Snap.Element):Object;
|
||||
|
||||
circle(x:number,y:number,r:number):Snap.Element;
|
||||
ellipse(x:number,y:number,rx:number,ry:number):Snap.Element;
|
||||
image(src:string,x:number,y:number,width:number,height:number):Snap.Element;
|
||||
line(x1:number,y1:number,x2:number,y2:number):Snap.Element;
|
||||
path(pathString?:string):Snap.Element;
|
||||
polygon(varargs:any[]):Snap.Element;
|
||||
polyline(varargs:any[]):Snap.Element;
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string|number):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string|number>):Snap.Element;
|
||||
}
|
||||
|
||||
export interface Set {
|
||||
@@ -327,7 +342,7 @@ declare module Snap {
|
||||
push(els:Snap.Element[]):Snap.Element;
|
||||
splice(index:number,count:number,insertion?:Object[]):Snap.Element[];
|
||||
}
|
||||
|
||||
|
||||
interface Filter {
|
||||
blur(x:number,y?:number):string;
|
||||
brightness(amount:number):string;
|
||||
@@ -339,9 +354,9 @@ declare module Snap {
|
||||
sepia(amount:number):string;
|
||||
shadow(dx: number, dy: number, blur: number, color: string, opacity: number): string;
|
||||
shadow(dx: number, dy: number, color: string, opacity: number): string;
|
||||
shadow(dx: number, dy: number, opacity: number): string;
|
||||
shadow(dx: number, dy: number, opacity: number): string;
|
||||
}
|
||||
|
||||
|
||||
interface Path {
|
||||
bezierBBox(...args:number[]):BBox;
|
||||
bezierBBox(bez:Array<number>):BBox;
|
||||
@@ -363,7 +378,7 @@ declare module Snap {
|
||||
toCubic(pathString:Array<string>):Array<any>;
|
||||
toRelative(path:string):Array<any>;
|
||||
}
|
||||
|
||||
|
||||
interface IntersectionDot{
|
||||
x:number,
|
||||
y:number,
|
||||
|
||||
Vendored
+1
-1
@@ -687,7 +687,7 @@ declare module SocketIO {
|
||||
* Removes all event listeners on this object
|
||||
* @return This Socket
|
||||
*/
|
||||
removeAllListeners(): Socket;
|
||||
removeAllListeners( event?: string ): Socket;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of listeners this instance can have
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/// <reference path="./sockjs-client.d.ts" />
|
||||
|
||||
import * as SockJS from 'sockjs-client';
|
||||
import BaseEvent = __SockJSClient.BaseEvent;
|
||||
import SockJSClass = __SockJSClient.SockJSClass;
|
||||
|
||||
let sockJs: SockJSClass;
|
||||
|
||||
sockJs = new SockJS('url');
|
||||
sockJs = SockJS('url');
|
||||
sockJs = SockJS('url', null, {
|
||||
server: '1233445',
|
||||
sessionId: 23,
|
||||
transports: 'websocket'
|
||||
});
|
||||
sockJs = SockJS('url', null, {
|
||||
sessionId: () => 'SID',
|
||||
transports: ['websocket', 'eventsource']
|
||||
});
|
||||
|
||||
let listener = (e: BaseEvent) => e;
|
||||
let listenerObj = {
|
||||
handleEvent: (e: BaseEvent) => e
|
||||
};
|
||||
|
||||
sockJs.addEventListener('onopen', listener);
|
||||
sockJs.addEventListener('onclose', listener, true);
|
||||
sockJs.addEventListener('onopen', listenerObj);
|
||||
sockJs.addEventListener('onclose', listenerObj, true);
|
||||
|
||||
sockJs.removeEventListener('onopen', listener);
|
||||
sockJs.removeEventListener('onclose', listener, true);
|
||||
sockJs.removeEventListener('onopen', listenerObj);
|
||||
sockJs.removeEventListener('onclose', listenerObj, true);
|
||||
|
||||
sockJs.onopen = e => console.log(e);
|
||||
sockJs.onmessage = e => console.log(e.data);
|
||||
sockJs.onclose = e => console.log(e.code, e.reason, e.wasClean);
|
||||
|
||||
let testStates = SockJS.CONNECTING !== -1 && SockJS.OPEN !== -1 &&
|
||||
SockJS.CLOSING !== -1 && SockJS.CLOSED !== -1;
|
||||
|
||||
sockJs.send('send');
|
||||
sockJs.send({x: 1});
|
||||
|
||||
sockJs.close(100, 'reason');
|
||||
sockJs.close(200);
|
||||
sockJs.close();
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for sockjs-client 1.0.3
|
||||
// Project: https://github.com/sockjs/sockjs-client
|
||||
// Definitions by: Emil Ivanov <https://github.com/vladev>, Alexander Rusakov <https://github.com/arusakov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare namespace __SockJSClient {
|
||||
interface BaseEvent {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface OpenEvent extends BaseEvent {}
|
||||
|
||||
interface CloseEvent extends BaseEvent {
|
||||
code: number;
|
||||
reason: string;
|
||||
wasClean: boolean;
|
||||
}
|
||||
|
||||
interface MessageEvent extends BaseEvent {
|
||||
data: string;
|
||||
}
|
||||
|
||||
interface SessionGenerator {
|
||||
(): string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
server?: string;
|
||||
sessionId?: number | SessionGenerator;
|
||||
transports?: string | string[]
|
||||
}
|
||||
|
||||
enum State {
|
||||
CONNECTING = 0, OPEN, CLOSING, CLOSED
|
||||
}
|
||||
|
||||
interface SockJSClass extends EventTarget {
|
||||
readyState: State;
|
||||
protocol: string;
|
||||
url: string;
|
||||
onopen: (e: OpenEvent) => any;
|
||||
onclose: (e: CloseEvent) => any;
|
||||
onmessage: (e: MessageEvent) => any;
|
||||
send(data: any): void;
|
||||
close(code?: number, reason?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'sockjs-client' {
|
||||
import SockJSClass = __SockJSClient.SockJSClass;
|
||||
import Options = __SockJSClient.Options;
|
||||
import State = __SockJSClient.State;
|
||||
|
||||
var SockJS: {
|
||||
new(url: string, _reserved?: any, options?: Options): SockJSClass;
|
||||
(url: string, _reserved?: any, options?: Options): SockJSClass;
|
||||
prototype: SockJSClass;
|
||||
CONNECTING: State;
|
||||
OPEN: State;
|
||||
CLOSING: State;
|
||||
CLOSED: State;
|
||||
};
|
||||
|
||||
export = SockJS;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ function testSourceMapConsumer() {
|
||||
version: 'foo',
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
sourcesContent: 'foo',
|
||||
sourcesContent: ['foo'],
|
||||
mappings: 'foo'
|
||||
});
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user