From 4b1582f351408c65e19b349bcb6e2b7cc51e44b5 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Fri, 28 Apr 2017 16:04:43 +0200 Subject: [PATCH 0001/1348] fix node tty Readstream, WriteStream --- types/node/index.d.ts | 4 ++-- types/node/v4/index.d.ts | 4 ++-- types/node/v6/index.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 0f2a6e663e..afbbbc958f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3721,12 +3721,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index f9d804c7eb..6e5bbda6de 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -2210,12 +2210,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 0c1796368e..efcb1863e2 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -3641,12 +3641,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; From 046be2f1e10d63ad05e3999bf3d5b6feb194095a Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Fri, 28 Apr 2017 16:06:59 +0200 Subject: [PATCH 0002/1348] fix node v0 tty Readstream, WriteStream --- types/node/v0/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index f57066c97e..acc8b1ee54 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -1861,11 +1861,11 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; } From 3f654b8a0fb811516753c9bd1e5d6238f01e3a4e Mon Sep 17 00:00:00 2001 From: yushulx Date: Tue, 2 May 2017 14:09:16 +0800 Subject: [PATCH 0003/1348] Dynamic Web TWAIN --- types/dwt/dwt-tests.ts | 107 ++ types/dwt/index.d.ts | 3457 +++++++++++++++++++++++++++++++++++++++ types/dwt/tsconfig.json | 22 + 3 files changed, 3586 insertions(+) create mode 100644 types/dwt/dwt-tests.ts create mode 100644 types/dwt/index.d.ts create mode 100644 types/dwt/tsconfig.json diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts new file mode 100644 index 0000000000..70e68e015f --- /dev/null +++ b/types/dwt/dwt-tests.ts @@ -0,0 +1,107 @@ +function dwtOnReady() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' + if (DWObject) { + var count = DWObject.SourceCount; + if(count == 0) + { + DWObject.CloseSourceManager(); + DWObject.ImageCaptureDriverType = 0; + DWObject.OpenSourceManager(); + count = DWObject.SourceCount; + } + } +} + +function acquireImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + var OnAcquireImageSuccess, OnAcquireImageFailure; + OnAcquireImageSuccess = OnAcquireImageFailure = function (){ + DWObject.CloseSource(); + }; + + DWObject.SelectSourceByIndex(0); //Use method SelectSourceByIndex to avoid the 'Select Source' dialog + DWObject.OpenSource(); + DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan. + DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure); + } +} + +function registerEvent() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + // The event OnPostTransfer fires after each image is scanned and transferred + DWObject.RegisterEvent("OnPostTransfer", function () {}); + + // The event OnPostLoad fires after the images from a local directory have been loaded into the control + DWObject.RegisterEvent("OnPostLoad", function () {}); + + // The event OnMouseClick fires when the mouse clicks on an image on Dynamic Web TWAIN viewer + DWObject.RegisterEvent("OnMouseClick", function () {}); + + // The event OnTopImageInTheViewChanged fires when the top image currently displayed in the viewer changes + DWObject.RegisterEvent("OnTopImageInTheViewChanged", function (index: number) { + DWObject.CurrentImageIndexInBuffer = index; + }); + } +} + +function editImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.Mirror(DWObject.CurrentImageIndexInBuffer); + + if (DWObject.HowManyImagesInBuffer > 0) + DWObject.Flip(DWObject.CurrentImageIndexInBuffer); + } +} + +function showImageEditor() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.ShowImageEditor(); + } +} + +function saveImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer); + DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer); + DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode, errorString) => {}); + DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode, errorString) => {}); + } +} + +function updateLargeViewer() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + let DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer'); + if (DWObject) { + DWObject.CopyToClipboard(DWObject.CurrentImageIndexInBuffer); // Copy the current image in the thumbnail to clipboard in DIB format. + DWObjectLargeViewer.LoadDibFromClipboard(); // Load the image from Clipboard into the large viewer. + } +} + +function uploadImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.HTTPPort = 80; + DWObject.IfSSL = false; + DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode, errorString) => {}); + } +} + +function downloadImage() { + let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + if (DWObject) { + DWObject.HTTPPort = 80; + DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode, errorString) => {}); + } +} \ No newline at end of file diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts new file mode 100644 index 0000000000..eda4725dfa --- /dev/null +++ b/types/dwt/index.d.ts @@ -0,0 +1,3457 @@ +/*! +* Dynamsoft WebTwain JavaScript Intellisense +* Product: Dynamsoft Web Twain +* Web Site: http://www.dynamsoft.com +* +* Copyright 2017, Dynamsoft Corporation +* Author: Dynamsoft Support Team +* Version: 12.3 +*/ + +/** + * @namespace Dynamsoft + */ +declare namespace Dynamsoft { + namespace WebTwainEnv { + function GetWebTwain (cid: string) : WebTwain; + function RegisterEvent(event: string, fn: () => void): void; + } +} + +/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */ +declare enum EnumDWT_PixelType { + TWPT_BW = 0, + TWPT_GRAY = 1, + TWPT_RGB = 2, + TWPT_PALLETE = 3, + TWPT_CMY = 4, + TWPT_CMYK = 5, + TWPT_YUV = 6, + TWPT_YUVK = 7, + TWPT_CIEXYZ = 8, + TWPT_LAB = 9, + TWPT_SRGB = 10, + TWPT_SCRGB = 11, + TWPT_INFRARED = 16 +} + +declare enum EnumDWT_BorderStyle { + /** No border. */ + TWBS_NONE = 0, + /** Flat border. */ + TWBS_SINGLEFLAT = 1, + /** 3D border. */ + TWBS_SINGLE3D = 2 +} + +/** For query the operation that are supported by the data source on a capability . + * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT + */ +declare enum EnumDWT_MessageType { + TWQC_GET = 1, + TWQC_SET = 2, + TWQC_GETDEFAULT = 4, + TWQC_GETCURRENT = 8, + TWQC_RESET = 16 +} + +/** Capabilities */ +declare enum EnumDWT_Cap { + /** Nothing. */ + CAP_NONE = 0, + /** The application is willing to accept this number of images. */ + CAP_XFERCOUNT = 1, + /** Allows the application and Source to identify which compression schemes they have in + * common for Buffered Memory and File transfers. + * Note for File transfers: + * Since only certain file formats support compression, this capability must be negotiated after + * setting the desired file format with ICAP_IMAGEFILEFORMAT. + */ + ICAP_COMPRESSION = 256, + /** The type of pixel data that a Source is capable of acquiring (for example, black and white, gray, RGB, etc.). */ + ICAP_PIXELTYPE = 257, + /** Unless a quantity is dimensionless or uses a specified unit of measure, ICAP_UNITS determines + * the unit of measure for all quantities. + */ + ICAP_UNITS = 258, + /** Allows the application and Source to identify which transfer mechanisms the source supports. */ + ICAP_XFERMECH = 259, + /** The name or other identifying information about the Author of the image. It may include a copyright string. */ + CAP_AUTHOR = 4096, + /** A general note about the acquired image. */ + CAP_CAPTION = 4097, + /** If TRUE, Source must acquire data from the document feeder acquire area and other feeder + * capabilities can be used. If FALSE, Source must acquire data from the non-feeder acquire area + * and no other feeder capabilities can be used. + */ + CAP_FEEDERENABLED = 4098, + /** Reflect whether there are documents loaded in the Source's feeder. */ + CAP_FEEDERLOADED = 4099, + /** The date and time the image was acquired. + * Stored in the form "YYYY/MM/DD HH:mm:SS.sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_TIMEDATE = 4100, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPS = 4101, + /** Allows the application and Source to negotiate capabilities to be used in States 5 and 6. */ + CAP_EXTENDEDCAPS = 4102, + /** If TRUE, the Source will automatically feed the next page from the document feeder after the + * number of frames negotiated for capture from each page are acquired. CAP_FEEDERENABLED + * must be TRUE to use this capability. + */ + CAP_AUTOFEED = 4103, + /** If TRUE, the Source will eject the current page being acquired from and will leave the feeder + * acquire area empty. + * If CAP_AUTOFEED is TRUE, a fresh page will be advanced. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_CLEARPAGE = 4104, + /** If TRUE, the Source will eject the current page and advance the next page in the document feeder + * into the feeder acquire area. + * If CAP_AUTOFEED is TRUE, the same action just described will occur and CAP_AUTOFEED will + * remain active. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_FEEDPAGE = 4105, + /** If TRUE, the Source will return the current page to the input side of the document feeder and + * feed the last page from the output side of the feeder back into the acquisition area. + * If CAP_AUTOFEED is TRUE, automatic feeding will continue after all negotiated frames from this + * page are acquired. + * CAP_FEEDERENABLED must equal TRUE to use this capability. + * This capability must have been negotiated as an extended capability to be used in States 5 and 6. + */ + CAP_REWINDPAGE = 4106, + /** If TRUE, the Source will display a progress indicator during acquisition and transfer, regardless + * of whether the Source's user interface is active. If FALSE, the progress indicator will be + * suppressed if the Source's user interface is inactive. + * The Source will continue to display device-specific instructions and error messages even with + * the Source user interface and progress indicators turned off. + */ + CAP_INDICATORS = 4107, + /** Returns a list of all the capabilities for which the Source will answer inquiries. Does not indicate + * which capabilities the Source will allow to be set by the application. Some capabilities can only + * be set if certain setup work has been done so the Source cannot globally answer which + * capabilities are "set-able." + */ + CAP_SUPPORTEDCAPSEXT = 4108, + /** This capability determines whether the device has a paper sensor that can detect documents on the ADF or Flatbed. */ + CAP_PAPERDETECTABLE = 4109, + /** If TRUE, indicates that this Source supports acquisition with the UI disabled; i.e., + * TW_USERINTERFACE's ShowUI field can be set to FALSE. If FALSE, indicates that this Source + * can only support acquisition with the UI enabled. + */ + CAP_UICONTROLLABLE = 4110, + /** If TRUE, the physical hardware (e.g., scanner, digital camera, image database, etc.) that + * represents the image source is attached, powered on, and communicating. + */ + CAP_DEVICEONLINE = 4111, + /** This capability is intended to boost the performance of a Source. The fundamental assumption + * behind AutoScan is that the device is able to capture the number of images indicated by the + * value of CAP_XFERCOUNT without waiting for the Application to request the image transfers. + * This is only possible if the device has internal buffers capable of caching the images it captures. + * The default behavior is undefined, because some high volume devices are incapable of anything + * but CAP_AUTOSCAN being equal to TRUE. However, if a Source supports FALSE, it should use it + * as the mandatory default, since this best describes the behavior of pre-1.8 TWAIN Applications. + */ + CAP_AUTOSCAN = 4112, + /** Allows an application to request the delivery of thumbnail representations for the set of images + * that are to be delivered. + * Setting CAP_THUMBNAILSENABLED to TRUE turns on thumbnail mode. Images transferred + * thereafter will be sent at thumbnail size (exact thumbnail size is determined by the Data Source). + * Setting this capability to FALSE turns thumbnail mode off and returns full size images. + */ + CAP_THUMBNAILSENABLED = 4113, + /** This indicates whether the scanner supports duplex. If so, it further indicates whether one-path + * or two-path duplex is supported. + */ + CAP_DUPLEX = 4114, + /** The user can set the duplex option to be TRUE or FALSE. If TRUE, the scanner scans both sides + * of a paper; otherwise, the scanner will scan only one side of the image. + */ + CAP_DUPLEXENABLED = 4115, + /** Allows an application to query a source to see if it implements the new user interface settings dialog. */ + CAP_ENABLEDSUIONLY = 4116, + CAP_CUSTOMDSDATA = 4117, + /** Allows the application to specify the starting endorser / imprinter number. All other endorser/ + * imprinter properties should be handled through the data source's user interface. + * The user can set the starting number for the endorser. + */ + CAP_ENDORSER = 4118, + /** Turns specific audible alarms on and off. */ + CAP_ALARMS = 4120, + /** The volume of a device's audible alarm. Note that this control affects the volume of all alarms; + * no specific volume control for individual types of alarms is provided. + */ + CAP_ALARMVOLUME = 4121, + /** The number of images to automatically capture. This does not refer to the number of images to + * be sent to the Application, use CAP_XFERCOUNT for that. + */ + CAP_AUTOMATICCAPTURE = 4122, + /** For automatic capture, this value selects the number of milliseconds before the first picture is to + * be taken, or the first image is to be scanned. + */ + CAP_TIMEBEFOREFIRSTCAPTURE = 4123, + /** For automatic capture, this value selects the milliseconds to wait between pictures taken, or images scanned. */ + CAP_TIMEBETWEENCAPTURES = 4124, + /** CapGet() reports the presence of data in the scanner's buffers. CapSet() with a value of TWCB_CLEAR immediately clears the buffers. */ + CAP_CLEARBUFFERS = 4125, + /** Describes the number of pages that the scanner can buffer when CAP_AUTOSCAN is enabled. */ + CAP_MAXBATCHBUFFERS = 4126, + /** The date and time of the device's clock. + * Managed in the form "YYYY/MM/DD HH:mm:SS:sss" where YYYY is the year, MM is the + * numerical month, DD is the numerical day, HH is the hour, mm is the minute, SS is the second, + * and sss is the millisecond. + */ + CAP_DEVICETIMEDATE = 4127, + /** CapGet() reports the kinds of power available to the device. CapGetCurrent() reports the current power supply in use. */ + CAP_POWERSUPPLY = 4128, + /** This capability queries the Source for UI support for preview mode. If TRUE, the Source supports preview UI. */ + CAP_CAMERAPREVIEWUI = 4129, + /** A string containing the serial number of the currently selected device in the Source. Multiple + * devices may all report the same serial number. + */ + CAP_SERIALNUMBER = 4132, + /** CapGet() returns the current list of available printer devices, along with the one currently being used for negotiation. + * CapSet() selects the current device for negotiation, and optionally constrains the list. + * Top/Bottom refers to duplex devices, and indicates if the printer is writing on the top or the bottom of the sheet of paper. + * Simplex devices use the top settings. Before/After indicates whether printing occurs before or after the sheet of paper has been scanned. + */ + CAP_PRINTER = 4134, + /** Turns the current CAP_PRINTER device on or off. */ + CAP_PRINTERENABLED = 4135, + /** The User can set the starting number for the current CAP_PRINTER device. */ + CAP_PRINTERINDEX = 4136, + /** Specifies the appropriate current CAP_PRINTER device mode. + * Note: + * • TWPM_SINGLESTRING specifies that the printed text will consist of a single string. + * • TWPM _MULTISTRING specifies that the printed text will consist of an enumerated list of + * strings to be printed in order. + * • TWPM _COMPOUNDSTRING specifies that the printed string will consist of a compound of a + * String followed by a value followed by a suffix string. + */ + CAP_PRINTERMODE = 4137, + /** Specifies the string(s) that are to be used in the string component when the current + * CAP_PRINTER device is enabled. + */ + CAP_PRINTERSTRING = 4138, + /** Specifies the string that shall be used as the current CAP_PRINTER device's suffix. */ + CAP_PRINTERSUFFIX = 4139, + /** Allows Application and Source to identify which languages they have in common for the exchange of string data, + * and to select the language of the internal UI. Since the TWLG_xxxx codes include language and country data, there is no separate + * capability for selecting the country. + */ + CAP_LANGUAGE = 4140, + /** Helps the Application determine any special actions it may need to take when negotiating + * frames with the Source. Allowed values are listed in . + * TWFA_NONE: The alignment is free-floating. Applications should assume + * that the origin for frames is on the left. + * TWFA_LEFT: The alignment is to the left. + * TWFA_CENTER: The alignment is centered. This means that the paper will + * be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate + * any frames with a left offset of zero. + * TWFA_RIGHT: The alignment is to the right. + */ + CAP_FEEDERALIGNMENT = 4141, + /** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page. + * TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page. + */ + CAP_FEEDERORDER = 4142, + /** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring + * multiple images of the same page without changes to the physical registration of that page. + */ + CAP_REACQUIREALLOWED = 4144, + /** The minutes of battery power remaining to the device. */ + CAP_BATTERYMINUTES = 4146, + /** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */ + CAP_BATTERYPERCENTAGE = 4147, + /** Added 1.91 */ + CAP_CAMERASIDE = 4148, + /** Added 1.91 */ + CAP_SEGMENTED = 4149, + /** Added 2.0 */ + CAP_CAMERAENABLED = 4150, + /** Added 2.0 */ + CAP_CAMERAORDER = 4151, + /** Added 2.0 */ + CAP_MICRENABLED = 4152, + /** Added 2.0 */ + CAP_FEEDERPREP = 4153, + /** Added 2.0 */ + CAP_FEEDERPOCKET = 4154, + /** Added 2.1 */ + CAP_AUTOMATICSENSEMEDIUM = 4155, + /** Added 2.1 */ + CAP_CUSTOMINTERFACEGUID = 4156, + /** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */ + ICAP_AUTOBRIGHT = 4352, + /** The brightness values available within the Source. */ + ICAP_BRIGHTNESS = 4353, + /** The contrast values available within the Source. */ + ICAP_CONTRAST = 4355, + /** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */ + ICAP_CUSTHALFTONE = 4356, + /** Specifies the exposure time used to capture the image, in seconds. */ + ICAP_EXPOSURETIME = 4357, + /** Describes the color characteristic of the subtractive filter applied to the image data. Multiple + * filters may be applied to a single acquisition. + */ + ICAP_FILTER = 4358, + /** Specifies whether or not the image was acquired using a flash. */ + ICAP_FLASHUSED = 4359, + /** Gamma correction value for the image data. */ + ICAP_GAMMA = 4360, + /** A list of names of the halftone patterns available within the Source. */ + ICAP_HALFTONES = 4361, + /** Specifies which value in an image should be interpreted as the lightest "highlight." All values + * "lighter" than this value will be clipped to this value. Whether lighter values are smaller or + * larger can be determined by examining the Current value of ICAP_PIXELFLAVOR. + */ + ICAP_HIGHLIGHT = 4362, + /** Informs the application which file formats the Source can generate (CapGet()). Tells the Source which file formats the application can handle (CapSet()). + * TWFF_TIFF Used for document + * TWFF_PICT Native Macintosh + * TWFF_BMP Native Microsoft + * TWFF_XBM Used for document + * TWFF_JFIF Wrapper for JPEG + * TWFF_FPX FlashPix, used with digital + * TWFF_TIFFMULTI Multi-page TIFF files + * TWFF_PNG An image format standard intended for use on the web, replaces GIF + * TWFF_SPIFF A standard from JPEG, intended to replace JFIF, also supports JBIG + * TWFF_EXIF File format for use with digital cameras. + */ + ICAP_IMAGEFILEFORMAT = 4364, + /** TRUE means the lamp is currently, or should be set to ON. Sources may not support CapSet() operations. */ + ICAP_LAMPSTATE = 4365, + /** Describes the general color characteristic of the light source used to acquire the image. */ + ICAP_LIGHTSOURCE = 4366, + /** Defines which edge of the "paper" the image's "top" is aligned with. This information is used to adjust the frames to match the + * scanning orientation of the paper. For instance, if an ICAP_SUPPORTEDSIZE of TWSS_ISOA4 has been negotiated, + * and ICAP_ORIENTATION is set to TWOR_LANDSCAPE, then the Source must rotate the frame it downloads to the scanner to reflect the + * orientation of the paper. Please note that setting ICAP_ORIENTATION does not affect the values reported by ICAP_FRAMES; + * it just causes the Source to use them in a different way. The upper-left of the image is defined as the location where both the primary and + * secondary scans originate. (The X axis is the primary scan direction and the Y axis is the secondary scan direction.) + * For a flatbed scanner, the light bar moves in the secondary scan direction. For a handheld scanner, the scanner is drug in the + * secondary scan direction. For a digital camera, the secondary direction is the vertical axis when the viewed image is considered upright. + */ + ICAP_ORIENTATION = 4368, + /** The maximum physical width (X-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALWIDTH = 4369, + /** The maximum physical height (Y-axis) the Source can acquire (measured in units of ICAP_UNITS). */ + ICAP_PHYSICALHEIGHT = 4370, + /** Specifies which value in an image should be interpreted as the darkest "shadow." All values + * "darker" than this value will be clipped to this value. + */ + ICAP_SHADOW = 4371, + /** The list of frames the Source will acquire on each page. */ + ICAP_FRAMES = 4372, + /** The native optical resolution along the X-axis of the device being controlled by the Source. Most + * devices will respond with a single value (TW_ONEVALUE). + * This is NOT a list of all resolutions that can be generated by the device. Rather, this is the + * resolution of the device's optics. Measured in units of pixels per unit as defined by + * ICAP_UNITS (pixels per TWUN_PIXELS yields dimensionless data). + */ + ICAP_XNATIVERESOLUTION = 4374, + /** The native optical resolution along the Y-axis of the device being controlled by the Source. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). + */ + ICAP_YNATIVERESOLUTION = 4375, + /** All the X-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_XRESOLUTION = 4376, + /** All the Y-axis resolutions the Source can provide. + * Measured in units of pixels per unit as defined by ICAP_UNITS (pixels per TWUN_PIXELS + * yields dimensionless data). That is, when the units are TWUN_PIXELS, both + * ICAP_XRESOLUTION and ICAP_YRESOLUTION shall report 1 pixel/pixel. Some data sources + * like to report the actual number of pixels that the device reports, but that response is more + * appropriate in ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. + */ + ICAP_YRESOLUTION = 4377, + /** The maximum number of frames the Source can provide or the application can accept per page. + * This is a bounding capability only. It does not establish current or future behavior. + */ + ICAP_MAXFRAMES = 4378, + /** This is used with buffered memory transfers. If TRUE, Source can provide application with tiled image data. */ + ICAP_TILES = 4379, + /** Specifies how the bytes in an image are filled by the Source. TWBO_MSBFIRST indicates that the leftmost bit in the byte (usually bit 7) is + * the byte's Most Significant Bit. + */ + ICAP_BITORDER = 4380, + /** Used for CCITT Group 3 2-dimensional compression. The 'K' factor indicates how often the + * new compression baseline should be re-established. A value of 2 or 4 is common in facsimile + * communication. A value of zero in this field will indicate an infinite K factor—the baseline is + * only calculated at the beginning of the transfer. + */ + ICAP_CCITTKFACTOR = 4381, + /** Describes whether the image was captured transmissively or reflectively. */ + ICAP_LIGHTPATH = 4382, + /** Sense of the pixel whose numeric value is zero (minimum data value). */ + ICAP_PIXELFLAVOR = 4383, + /** Allows the application and Source to identify which color data formats are available. There are + * two options, "planar" and "chunky." + */ + ICAP_PLANARCHUNKY = 4384, + /** How the Source can/should rotate the scanned image data prior to transfer. This doesn't use + * ICAP_UNITS. It is always measured in degrees. Any applied value is additive with any + * rotation specified in ICAP_ORIENTATION. + */ + ICAP_ROTATION = 4385, + /** For devices that support fixed frame sizes. + * Defined sizes match typical page sizes. This specifies the size(s) the Source can/should use to acquire image data. + */ + ICAP_SUPPORTEDSIZES = 4386, + /** Specifies the dividing line between black and white. This is the value the Source will use to + * threshold, if needed, when ICAP_PIXELTYPE:TWPT_BW. + * The value is normalized so there are no units of measure associated with this ICAP. + */ + ICAP_THRESHOLD = 4387, + /** All the X-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. */ + ICAP_XSCALING = 4388, + /** All the Y-axis scaling values available. A value of '1.0' is equivalent to 100% scaling. Do not use values less than or equal to zero. + * There are no units inherent with this data as it is normalized to 1.0 being "unscaled." + */ + ICAP_YSCALING = 4389, + /** Used for CCITT data compression only. Indicates the bit order representation of the stored compressed codes. */ + ICAP_BITORDERCODES = 4390, + /** Used only for CCITT data compression. Specifies whether the compressed codes' pixel "sense" + * will be inverted from the Current value of ICAP_PIXELFLAVOR prior to transfer. + */ + ICAP_PIXELFLAVORCODES = 4391, + /** Allows the application and Source to agree upon a common set of color descriptors that are + * made available by the Source. This ICAP is only useful for JPEG-compressed buffered memory image transfers. + */ + ICAP_JPEGPIXELTYPE = 4392, + /** Used only with CCITT data compression. Specifies the minimum number of words of compressed codes (compressed data) to be transmitted per line. */ + ICAP_TIMEFILL = 4394, + /** Specifies the pixel bit depths for the Current value of ICAP_PIXELTYPE. For example, when + * using ICAP_PIXELTYPE:TWPT_GRAY, this capability specifies whether this is 8-bit gray or 4-bit gray. + * This depth applies to all the data channels (for instance, the R, G, and B channels will all have + * this same bit depth for RGB data). + */ + ICAP_BITDEPTH = 4395, + /** Specifies the Reduction Method the Source should use to reduce the bit depth of the data. Most + * commonly used with ICAP_PIXELTYPE:TWPT_BW to reduce gray data to black and white. + */ + ICAP_BITDEPTHREDUCTION = 4396, + /** If TRUE the Source will issue a MSG_XFERREADY before starting the scan. + * Note: The Source may need to scan the image before initiating the transfer. This is the case if + * the scanned image is rotated or merged with another scanned image. + */ + ICAP_UNDEFINEDIMAGESIZE = 4397, + /** Allows the application to query the data source to see if it supports extended image attribute capabilities, + * such as Barcode Recognition, Shaded Area Detection and Removal, Skew detection and Removal, and so on. + */ + ICAP_EXTIMAGEINFO = 4399, + /** Allows the source to define the minimum height (Y-axis) that the source can acquire. */ + ICAP_MINIMUMHEIGHT = 4400, + /** Allows the source to define theminimum width (X-axis) that the source can acquire. */ + ICAP_MINIMUMWIDTH = 4401, + /** Use this capability to have the Source discard blank images. The Application never sees these + * images during the scanning session. + * TWBP_DISABLE – this must be the default state for the Source. It indicates that all images will + * be delivered to the Application, none of them will be discarded. + * TWBP_AUTO – if this is used, then the Source will decide if an image is blank or not and discard + * as appropriate. + * If the specified value is a positive number in the range 0 to 231–1, then this capability will use it + * as the byte size cutoff point to identify which images are to be discarded. If the size of the image + * is less than or equal to this value, then it will be discarded. If the size of the image is greater + * than this value, then it will be kept so that it can be transferred to the Application. + */ + ICAP_AUTODISCARDBLANKPAGES = 4404, + /** Flip rotation is used to properly orient images that flip orientation every other image. + * TWFR_BOOK The images to be scanned are viewed in book form, flipping each page from left to right or right to left. + * TWFR_FANFOLD The images to be scanned are viewed in fanfold paper style, flipping each page up or down. + */ + ICAP_FLIPROTATION = 4406, + /** Turns bar code detection on and off. */ + ICAP_BARCODEDETECTIONENABLED = 4407, + /** Provides a list of bar code types that can be detected by the current Data Source. */ + ICAP_SUPPORTEDBARCODETYPES = 4408, + /** The maximum number of supported search priorities. */ + ICAP_BARCODEMAXSEARCHPRIORITIES = 4409, + /** A prioritized list of bar code types dictating the order in which bar codes will be sought. */ + ICAP_BARCODESEARCHPRIORITIES = 4410, + /** Restricts bar code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_BARCODESEARCHMODE = 4411, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_BARCODEMAXRETRIES = 4412, + /** Restricts the total time spent on searching for a bar code on each page. */ + ICAP_BARCODETIMEOUT = 4413, + /** When used with CapGet(), returns all camera supported lens zooming range. */ + ICAP_ZOOMFACTOR = 4414, + /** Turns patch code detection on and off. */ + ICAP_PATCHCODEDETECTIONENABLED = 4415, + /** A list of patch code types that may be detected by the current Data Source. */ + ICAP_SUPPORTEDPATCHCODETYPES = 4416, + /** The maximum number of supported search priorities. */ + ICAP_PATCHCODEMAXSEARCHPRIORITIES = 4417, + /** A prioritized list of patch code types dictating the order in which patch codes will be sought. */ + ICAP_PATCHCODESEARCHPRIORITIES = 4418, + /** Restricts patch code searching to certain orientations, or prioritizes one orientation over the other. */ + ICAP_PATCHCODESEARCHMODE = 4419, + /** Restricts the number of times a search will be retried if none are found on each page. */ + ICAP_PATCHCODEMAXRETRIES = 4420, + /** Restricts the total time spent on searching for a patch code on each page. */ + ICAP_PATCHCODETIMEOUT = 4421, + /** For devices that support flash. CapSet() selects the flash to be used (if any). CapGet() reports the current setting. + * This capability replaces ICAP_FLASHUSED, which is only able to negotiate the flash being on or off. + */ + ICAP_FLASHUSED2 = 4422, + /** For devices that support image enhancement filtering. This capability selects the algorithm used to improve the quality of the image. */ + ICAP_IMAGEFILTER = 4423, + /** For devices that support noise filtering. This capability selects the algorithm used to remove noise. */ + ICAP_NOISEFILTER = 4424, + /** Overscan is used to scan outside of the boundaries described by ICAP_FRAMES, and is used to help acquire image data that + * may be lost because of skewing. + * This is primarily of use for transport scanners which rely on edge detection to begin scanning. + * If overscan is supported, then the device is capable of scanning in the inter-document gap to get the skewed image information. + */ + ICAP_OVERSCAN = 4425, + /** Turns automatic border detection on and off. */ + ICAP_AUTOMATICBORDERDETECTION = 4432, + /** Turns automatic deskew correction on and off. */ + ICAP_AUTOMATICDESKEW = 4433, + /** When TRUE this capability depends on intelligent features within the Source to automatically + * rotate the image to the correct position. + */ + ICAP_AUTOMATICROTATE = 4434, + /** Added 1.9 */ + ICAP_JPEGQUALITY = 4435, + /** Added 1.91 */ + ICAP_FEEDERTYPE = 4436, + /** Added 1.91 */ + ICAP_ICCPROFILE = 4437, + /** Added 2.0 */ + ICAP_AUTOSIZE = 4438, + /** Added 2.1 */ + ICAP_AUTOMATICCROPUSESFRAME = 4439, + /** Added 2.1 */ + ICAP_AUTOMATICLENGTHDETECTION = 4440, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORENABLED = 4441, + /** Added 2.1 */ + ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE = 4442, + /** Added 2.1 */ + ICAP_COLORMANAGEMENTENABLED = 4443, + /** Added 2.1 */ + ICAP_IMAGEMERGE = 4444, + /** Added 2.1 */ + ICAP_IMAGEMERGEHEIGHTTHRESHOLD = 4445, + /** Added 2.1 */ + ICAP_SUPPORTEDEXTIMAGEINFO = 4446 +} + +/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. + * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities = + * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION. + */ +declare enum EnumDWT_CapType { + /** Nothing. */ + TWON_NONE = 0, + /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and + * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS + * capability, would use this type of container. + */ + TWON_ARRAY = 3, + /** This is the most general type because it defines a list of values from which the Current Value can be chosen. + * The values do not progress uniformly through a range and there is not a consistent step size between the values. + * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600). + */ + TWON_ENUMERATION = 4, + /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. + * For example, a capability that indicates the presence of a document feeder could be of this type. + */ + TWON_ONEVALUE = 5, + /** Many capabilities allow users to select their current value from a range of regularly spaced values. + * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values. + * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600). + */ + TWON_RANGE = 6 +} + +/** ICAP_XFERMECH values. */ +declare enum EnumDWT_TransferMode { + /** Native transfers require the data to be transferred to a single large block of RAM. Therefore, + * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully. + */ + TWSX_NATIVE = 0, + /** Disk File Mode Transfers. */ + TWSX_FILE = 1, + /** Buffered Memory Mode Transfers. */ + TWSX_MEMORY = 2, + /** added 1.91 */ + //TWSX_MEMFILE = 4 +} + +/** ICAP_IMAGEFILEFORMAT values. */ +declare enum EnumDWT_FileFormat { + /** Used for document imaging. Tagged Image File Format */ + TWFF_TIFF = 0, + /** Native Macintosh format. Macintosh PICT */ + TWFF_PICT = 1, + /** Native Microsoft format. Windows Bitmap */ + TWFF_BMP = 2, + /** Used for document imaging. X-Windows Bitmap */ + TWFF_XBM = 3, + /** Wrapper for JPEG images. JPEG File Interchange Format */ + TWFF_JFIF = 4, + /** FlashPix, used with digital cameras. Flash Pix */ + TWFF_FPX = 5, + /** Multi-page TIFF files. Multi-page tiff file */ + TWFF_TIFFMULTI = 6, + /** An image format standard intended for use on the web, replaces GIF. */ + TWFF_PNG = 7, + /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */ + TWFF_SPIFF = 8, + /** File format for use with digital cameras. */ + TWFF_EXIF = 9, + /** A file format from Adobe. 1.91 NB: this is not PDF/A */ + TWFF_PDF = 10, + /** A file format from the Joint Photographic Experts Group. 1.91 */ + TWFF_JP2 = 11, + /** 1.91 */ + TWFF_JPN = 12, + /** 1.91 */ + TWFF_JPX = 13, + /** A file format from LizardTech. 1.91 */ + TWFF_DEJAVU = 14, + /** A file format from Adobe. 2.0 */ + TWFF_PDFA = 15, + /** 2.1 Adobe PDF/A, Version 2 */ + TWFF_PDFA2 = 16 +} + + +/** TIFF file compression type. */ +declare enum EnumDWT_TIFFCompressionType { + /** Auto mode. */ + TIFF_AUTO = 0, + /** Dump mode. */ + TIFF_NONE = 1, + /** CCITT modified Huffman RLE. */ + TIFF_RLE = 2, + /** CCITT Group 3 fax encoding. */ + TIFF_FAX3 = 3, + /** CCITT T.4 (TIFF 6 name). */ + TIFF_T4 = 3, + /** CCITT Group 4 fax encoding */ + TIFF_FAX4 = 4, + /** CCITT T.6 (TIFF 6 name). */ + TIFF_T6 = 4, + /** Lempel Ziv and Welch */ + TIFF_LZW = 5, + TIFF_JPEG = 7, + TIFF_PACKBITS = 32773 +} + +/** The method to do interpolation. */ +declare enum EnumDWT_InterpolationMethod { + IM_NEARESTNEIGHBOUR = 1, + IM_BILINEAR = 2, + IM_BICUBIC = 3, + IM_BESTQUALITY = 5 +} + +/** Image type */ +declare enum EnumDWT_ImageType { + /** Native Microsoft format. */ + IT_BMP = 0, + /** JPEG format. */ + IT_JPG = 1, + /** Tagged Image File Format. */ + IT_TIF = 2, + /** An image format standard intended for use on the web, replaces GIF. */ + IT_PNG = 3, + /** A file format from Adobe. */ + IT_PDF = 4, + IT_ALL = 5 +} + +/** PDF file compression type. */ +declare enum EnumDWT_PDFCompressionType { + /** Auto mode. */ + PDF_AUTO = 0, + /** CCITT Group 3 fax encoding. */ + PDF_FAX3 = 1, + /** CCITT Group 4 fax encoding */ + PDF_FAX4 = 2, + /** Lempel Ziv and Welch */ + PDF_LZW = 3, + /** CCITT modified Huffman RLE. */ + PDF_RLE = 4, + PDF_JPEG = 5 +}; + +declare enum EnumDWT_ShowMode { + /** Activates the window and displays it in its current size and position. */ + SW_ACTIVE = 0, + /** Maximizes the window */ + SW_MAX = 1, + /** Minimize the window */ + SW_MIN = 2, + /** Close the latest opened editor window */ + SW_CLOSE = 3, + /** Check whether a window exists */ + SW_IFLIVE = 4 +} + +/** The kind of data stored in the container. */ +declare enum EnumDWT_CapValueType { + TWTY_INT8 = 0, + /** Means Item is a TW_INT16 */ + TWTY_INT16 = 1, + /** Means Item is a TW_INT32 */ + TWTY_INT32 = 2, + /** Means Item is a TW_UINT8 */ + TWTY_UINT8 = 3, + /** Means Item is a TW_UINT16 */ + TWTY_UINT16 = 4, + /** Means Item is a TW_int */ + TWTY_int = 5, + /** Means Item is a TW_BOOL */ + TWTY_BOOL = 6, + /** Means Item is a TW_FIX32 */ + TWTY_FIX32 = 7, + /** Means Item is a TW_FRAME */ + TWTY_FRAME = 8, + /** Means Item is a TW_STR32 */ + TWTY_STR32 = 9, + /** Means Item is a TW_STR64 */ + TWTY_STR64 = 10, + /** Means Item is a TW_STR128 */ + TWTY_STR128 = 11, + /** Means Item is a TW_STR255 */ + TWTY_STR255 = 12 +} + +/** ICAP_UNITS values. */ +declare enum EnumDWT_UnitType { + TWUN_INCHES = 0, + TWUN_CENTIMETERS = 1, + TWUN_PICAS = 2, + TWUN_POINTS = 3, + TWUN_TWIPS = 4, + TWUN_PIXELS = 5, + TWUN_MILLIMETERS = 6 +} + +/** ICAP_DUPLEX values. */ +declare enum EnumDWT_DUPLEX { + TWDX_NONE = 0, + TWDX_1PASSDUPLEX = 1, + TWDX_2PASSDUPLEX = 2 +} + +/** CAP_LANGUAGE values. */ +declare enum EnumDWT_CapLanguage { + /** Danish */ + TWLG_DAN = 0, + /** Dutch */ + TWLG_DUT = 1, + /** International English */ + TWLG_ENG = 2, + /** French Canadian */ + TWLG_FCF = 3, + /** Finnish */ + TWLG_FIN = 4, + /** French */ + TWLG_FRN = 5, + /** German */ + TWLG_GER = 6, + /** Icelandic */ + TWLG_ICE = 7, + /** Italian */ + TWLG_ITN = 8, + /** Norwegian */ + TWLG_NOR = 9, + /** Portuguese */ + TWLG_POR = 10, + /** Spanish */ + TWLG_SPA = 11, + /** Swedish */ + TWLG_SWE = 12, + /** U.S. English */ + TWLG_USA = 13, + /** Added for 1.8 */ + TWLG_USERLOCALE = -1, + TWLG_AFRIKAANS = 14, + TWLG_ALBANIA = 15, + TWLG_ARABIC = 16, + TWLG_ARABIC_ALGERIA = 17, + TWLG_ARABIC_BAHRAIN = 18, + TWLG_ARABIC_EGYPT = 19, + TWLG_ARABIC_IRAQ = 20, + TWLG_ARABIC_JORDAN = 21, + TWLG_ARABIC_KUWAIT = 22, + TWLG_ARABIC_LEBANON = 23, + TWLG_ARABIC_LIBYA = 24, + TWLG_ARABIC_MOROCCO = 25, + TWLG_ARABIC_OMAN = 26, + TWLG_ARABIC_QATAR = 27, + TWLG_ARABIC_SAUDIARABIA = 28, + TWLG_ARABIC_SYRIA = 29, + TWLG_ARABIC_TUNISIA = 30, + /** United Arabic Emirates */ + TWLG_ARABIC_UAE = 31, + TWLG_ARABIC_YEMEN = 32, + TWLG_BASQUE = 33, + TWLG_BYELORUSSIAN = 34, + TWLG_BULGARIAN = 35, + TWLG_CATALAN = 36, + TWLG_CHINESE = 37, + TWLG_CHINESE_HONGKONG = 38, + /** People's Republic of China */ + TWLG_CHINESE_PRC = 39, + TWLG_CHINESE_SINGAPORE = 40, + TWLG_CHINESE_SIMPLIFIED = 41, + TWLG_CHINESE_TAIWAN = 42, + TWLG_CHINESE_TRADITIONAL = 43, + TWLG_CROATIA = 44, + TWLG_CZECH = 45, + TWLG_DANISH = 0, + TWLG_DUTCH = 1, + TWLG_DUTCH_BELGIAN = 46, + TWLG_ENGLISH = 2, + TWLG_ENGLISH_AUSTRALIAN = 47, + TWLG_ENGLISH_CANADIAN = 48, + TWLG_ENGLISH_IRELAND = 49, + TWLG_ENGLISH_NEWZEALAND = 50, + TWLG_ENGLISH_SOUTHAFRICA = 51, + TWLG_ENGLISH_UK = 52, + TWLG_ENGLISH_USA = 13, + TWLG_ESTONIAN = 53, + TWLG_FAEROESE = 54, + TWLG_FARSI = 55, + TWLG_FINNISH = 4, + TWLG_FRENCH = 5, + TWLG_FRENCH_BELGIAN = 56, + TWLG_FRENCH_CANADIAN = 3, + TWLG_FRENCH_LUXEMBOURG = 57, + TWLG_FRENCH_SWISS = 58, + TWLG_GERMAN = 6, + TWLG_GERMAN_AUSTRIAN = 59, + TWLG_GERMAN_LUXEMBOURG = 60, + TWLG_GERMAN_LIECHTENSTEIN = 61, + TWLG_GERMAN_SWISS = 62, + TWLG_GREEK = 63, + TWLG_HEBREW = 64, + TWLG_HUNGARIAN = 65, + TWLG_ICELANDIC = 7, + TWLG_INDONESIAN = 66, + TWLG_ITALIAN = 8, + TWLG_ITALIAN_SWISS = 67, + TWLG_JAPANESE = 68, + TWLG_KOREAN = 69, + TWLG_KOREAN_JOHAB = 70, + TWLG_LATVIAN = 71, + TWLG_LITHUANIAN = 72, + TWLG_NORWEGIAN = 9, + TWLG_NORWEGIAN_BOKMAL = 73, + TWLG_NORWEGIAN_NYNORSK = 74, + TWLG_POLISH = 75, + TWLG_PORTUGUESE = 10, + TWLG_PORTUGUESE_BRAZIL = 76, + TWLG_ROMANIAN = 77, + TWLG_RUSSIAN = 78, + TWLG_SERBIAN_LATIN = 79, + TWLG_SLOVAK = 80, + TWLG_SLOVENIAN = 81, + TWLG_SPANISH = 11, + TWLG_SPANISH_MEXICAN = 82, + TWLG_SPANISH_MODERN = 83, + TWLG_SWEDISH = 12, + TWLG_THAI = 84, + TWLG_TURKISH = 85, + TWLG_UKRANIAN = 86, + /** More stuff added for 1.8 */ + TWLG_ASSAMESE = 87, + TWLG_BENGALI = 88, + TWLG_BIHARI = 89, + TWLG_BODO = 90, + TWLG_DOGRI = 91, + TWLG_GUJARATI = 92, + TWLG_HARYANVI = 93, + TWLG_HINDI = 94, + TWLG_KANNADA = 95, + TWLG_KASHMIRI = 96, + TWLG_MALAYALAM = 97, + TWLG_MARATHI = 98, + TWLG_MARWARI = 99, + TWLG_MEGHALAYAN = 100, + TWLG_MIZO = 101, + TWLG_NAGA = 102, + TWLG_ORISSI = 103, + TWLG_PUNJABI = 104, + TWLG_PUSHTU = 105, + TWLG_SERBIAN_CYRILLIC = 106, + TWLG_SIKKIMI = 107, + TWLG_SWEDISH_FINLAND = 108, + TWLG_TAMIL = 109, + TWLG_TELUGU = 110, + TWLG_TRIPURI = 111, + TWLG_URDU = 112, + TWLG_VIETNAMESE = 113 +} + +/** TWAIN Supported sizes. */ +declare enum EnumDWT_CapSupportedSizes { + /** 0 */ + TWSS_NONE = 0, + /** 1 */ + TWSS_A4LETTER = 1, + /** 2 */ + TWSS_B5LETTER = 2, + /** 3 */ + TWSS_USLETTER = 3, + /** 4 */ + TWSS_USLEGAL = 4, + /** Added 1.5 + * 5 + */ + TWSS_A5 = 5, + /** 6 */ + TWSS_B4 = 6, + /** 7 */ + TWSS_B6 = 7, + /** Added 1.7 + * 9 + */ + TWSS_USLEDGER = 9, + /** 10 */ + TWSS_USEXECUTIVE = 10, + /** 11 */ + TWSS_A3 = 11, + /** 12 */ + TWSS_B3 = 12, + /** 13 */ + TWSS_A6 = 13, + /** 14 */ + TWSS_C4 = 14, + /** 15 */ + TWSS_C5 = 15, + /** 16 */ + TWSS_C6 = 16, + /** Added 1.8 + * 17 + */ + TWSS_4A0 = 17, + /** 18 */ + TWSS_2A0 = 18, + /** 19 */ + TWSS_A0 = 19, + /** 20 */ + TWSS_A1 = 20, + /** 21 */ + TWSS_A2 = 21, + /** 1 */ + TWSS_A4 = 1, + /** 22 */ + TWSS_A7 = 22, + /** 23 */ + TWSS_A8 = 23, + /** 24 */ + TWSS_A9 = 24, + /** 25 */ + TWSS_A10 = 25, + /** 26 */ + TWSS_ISOB0 = 26, + /** 27 */ + TWSS_ISOB1 = 27, + /** 28 */ + TWSS_ISOB2 = 28, + /** 12 */ + TWSS_ISOB3 = 12, + /** 6 */ + TWSS_ISOB4 = 6, + /** 29 */ + TWSS_ISOB5 = 29, + /** 7 */ + TWSS_ISOB6 = 7, + /** 30 */ + TWSS_ISOB7 = 30, + /** 31 */ + TWSS_ISOB8 = 31, + /** 32 */ + TWSS_ISOB9 = 32, + /** 33 */ + TWSS_ISOB10 = 33, + /** 34 */ + TWSS_JISB0 = 34, + /** 35 */ + TWSS_JISB1 = 35, + /** 36 */ + TWSS_JISB2 = 36, + /** 37 */ + TWSS_JISB3 = 37, + /** 38 */ + TWSS_JISB4 = 38, + /** 2 */ + TWSS_JISB5 = 2, + /** 39 */ + TWSS_JISB6 = 39, + /** 40 */ + TWSS_JISB7 = 40, + /** 41 */ + TWSS_JISB8 = 41, + /** 41 */ + TWSS_JISB9 = 42, + /** 43 */ + TWSS_JISB10 = 43, + /** 44 */ + TWSS_C0 = 44, + /** 45 */ + TWSS_C1 = 45, + /** 46 */ + TWSS_C2 = 46, + /** 47 */ + TWSS_C3 = 47, + /** 48 */ + TWSS_C7 = 48, + /** 49 */ + TWSS_C8 = 49, + /** 50 */ + TWSS_C9 = 50, + /** 51 */ + TWSS_C10 = 51, + /** 52 */ + TWSS_USSTATEMENT = 52, + /** 53 */ + TWSS_BUSINESSCARD = 53, + /** 54. Added 2.1 */ + TWSS_MAXSIZE = 54 +} + + +/** CAP_FEEDERALIGNMENT values. */ +declare enum EnumDWT_CapFeederAlignment { + /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ + TWFA_NONE = 0, + /** The alignment is to the left. */ + TWFA_LEFT = 1, + /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the + * device. If this is set, then the Application should calculate any frames with a left offset of zero. + */ + TWFA_CENTER = 2, + /** The alignment is to the right. */ + TWFA_RIGHT = 3 +} +/** CAP_FEEDERORDER values. */ +declare enum EnumDWT_CapFeederOrder { + /** The feeder starts with the top of the first page. */ + TWFO_FIRSTPAGEFIRST = 0, + /** The feeder starts with the top of the last page. */ + TWFO_LASTPAGEFIRST = 1 +}; + +/** CAP_PRINTER values. */ +declare enum EnumDWT_CapPrinter { + TWPR_IMPRINTERTOPBEFORE = 0, + TWPR_IMPRINTERTOPAFTER = 1, + TWPR_IMPRINTERBOTTOMBEFORE = 2, + TWPR_IMPRINTERBOTTOMAFTER = 3, + TWPR_ENDORSERTOPBEFORE = 4, + TWPR_ENDORSERTOPAFTER = 5, + TWPR_ENDORSERBOTTOMBEFORE = 6, + TWPR_ENDORSERBOTTOMAFTER = 7 +}; +/** CAP_PRINTERMODE values. */ +declare enum EnumDWT_CapPrinterMode { + /** Specifies that the printed text will consist of a single string. */ + TWPM_SINGLESTRING = 0, + /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */ + TWPM_MULTISTRING = 1, + /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ + TWPM_COMPOUNDSTRING = 2 +}; +/** ICAP_BITDEPTHREDUCTION values. */ +declare enum EnumDWT_CapBitdepthReduction { + TWBR_THRESHOLD = 0, + TWBR_HALFTONE = 1, + TWBR_CUSTHALFTONE = 2, + TWBR_DIFFUSION = 3 +}; +/** ICAP_BITORDER values. */ +declare enum EnumDWT_CapBitOrder { + TWBO_LSBFIRST = 0, + /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ + TWBO_MSBFIRST = 1 +}; +/** ICAP_FILTER values. */ +declare enum EnumDWT_CapFilterType { + TWFT_RED = 0, + TWFT_GREEN = 1, + TWFT_BLUE = 2, + TWFT_NONE = 3, + TWFT_WHITE = 4, + TWFT_CYAN = 5, + TWFT_MAGENTA = 6, + TWFT_YELLOW = 7, + TWFT_BLACK = 8 +}; +/** ICAP_FLASHUSED2 values. */ +declare enum EnumDWT_CapFlash { + TWFL_NONE = 0, + TWFL_OFF = 1, + TWFL_ON = 2, + TWFL_AUTO = 3, + TWFL_REDEYE = 4 +}; +/** ICAP_FLIPROTATION values. */ +declare enum EnumDWT_CapFlipRotation { + /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ + TWFR_BOOK = 0, + /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ + TWFR_FANFOLD = 1 +}; +/** ICAP_IMAGEFILTER values. */ +declare enum EnumDWT_CapImageFilter { + TWIF_NONE = 0, + TWIF_AUTO = 1, + /** Good for halftone images. */ + TWIF_LOWPASS = 2, + /** Good for improving text. */ + TWIF_BANDPASS = 3, + /** Good for improving fine lines. */ + TWIF_HIGHPASS = 4, + TWIF_TEXT = 3, + TWIF_FINELINE = 4 +}; +/** ICAP_LIGHTPATH values. */ +declare enum EnumDWT_CapLightPath { + TWLP_REFLECTIVE = 0, + TWLP_TRANSMISSIVE = 1 +}; +/** ICAP_LIGHTSOURCE values. */ +declare enum EnumDWT_CapLightSource { + TWLS_RED = 0, + TWLS_GREEN = 1, + TWLS_BLUE = 2, + TWLS_NONE = 3, + TWLS_WHITE = 4, + TWLS_UV = 5, + TWLS_IR = 6 +}; +/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ +declare enum EnumDWT_MagType { + /** Added 2.0 */ + TWMD_MICR = 0, + /** added 2.1 */ + TWMD_RAW = 1, + /** added 2.1 */ + TWMD_INVALID = 2 +}; +/** ICAP_NOISEFILTER values. */ +declare enum EnumDWT_CapNoiseFilter { + TWNF_NONE = 0, + TWNF_AUTO = 1, + TWNF_LONEPIXEL = 2, + TWNF_MAJORITYRULE = 3 +}; + +/** ICAP_ORIENTATION values. */ +declare enum EnumDWT_CapORientation { + TWOR_ROT0 = 0, + TWOR_ROT90 = 1, + TWOR_ROT180 = 2, + TWOR_ROT270 = 3, + TWOR_PORTRAIT = 0, + TWOR_LANDSCAPE = 3, + /** 2.0 */ + TWOR_AUTO = 4, + /** 2.0 */ + TWOR_AUTOTEXT = 5, + /** 2.0 */ + TWOR_AUTOPICTURE = 6 +}; +/** ICAP_OVERSCAN values. */ +declare enum EnumDWT_CapOverscan { + TWOV_NONE = 0, + TWOV_AUTO = 1, + TWOV_TOPBOTTOM = 2, + TWOV_LEFTRIGHT = 3, + TWOV_ALL = 4 +}; +/** ICAP_PIXELFLAVOR values. */ +declare enum EnumDWT_CapPixelFlavor { + /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ + TWPF_CHOCOLATE = 0, + /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ + TWPF_VANILLA = 1 +}; + +/** ICAP_PLANARCHUNKY values. */ +declare enum EnumDWT_CapPlanarChunky { + TWPC_CHUNKY = 0, + TWPC_PLANAR = 1 +}; + +/** Data source status. */ +declare enum EnumDWT_DataSourceStatus { + /** Indicate the data source is closed. */ + TWDSS_CLOSED = 0, + /** Indicate the data source is opened. */ + TWDSS_OPENED = 1, + /** Indicate the data source is enabled. */ + TWDSS_ENABLED = 2, + /** Indicate the data source is acquiring image. */ + TWDSS_ACQUIRING = 3 +}; + +/** Fit window type */ +declare enum EnumDWT_FitWindowType { + /** Fit the image to the width and height of the window */ + enumFitWindow = 0, + /** Fit the image to the height of the window */ + enumFitWindowHeight = 1, + /** Fit the image to the width of the window */ + enumFitWindowWidth = 2 +}; + +declare enum EnumDWT_UploadDataFormat { + Binary = 0, + Base64 = 1 +}; + + +declare enum EnumDWT_MouseShape { + Default = 0, + Hand = 1, + Crosshair = 2, + Zoom = 3 +}; + +/** + * @class + */ +// properties (get/set) / sync functions +interface WebTwain { + + /** + * Returns or sets whether multi-page selection is supported. + * @type {bool} + */ + AllowMultiSelect: boolean; + + /** + * [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE. + * @type {bool} + */ + AllowPluginAuthentication: boolean; + + /** + * [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false. + * @type {bool} + */ + AsyncMode: boolean; + + /** + * Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + BackgroundColor: number; + + /** + * Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + BackgroundFillColor: number; + + /** + * [Deprecated.] Returns the number of barcode detected in an image. + * @type {int} + */ + BarcodeCount: number; + + /** + * Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property. + * @type {short} + */ + BitDepth: number; + + /** + * Returns the current deviation of the pixels in the image. + * @type {float} + */ + BlankImageCurrentStdDev: number; + + /** + * Returns or sets the standard deviation of the pixels in the image. + * @type {float} + */ + BlankImageMaxStdDev: number; + + /** + * Returns or sets the dividing line between black and white. The default value is 128. + * @type {int} + */ + BlankImageThreshold: number; + + /** + * [Deprecated.] Returns or sets the border style. + * @type {EnumDWT_BorderStyle} + */ + BorderStyle: EnumDWT_BorderStyle; + + /** + * Returns or sets the brightness values available within the Source. This is a runtime property. + * @type {float} + */ + Brightness: number; + + /** + * [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning. + * @type {int} + */ + BrokerProcessType: number; + + /** + * Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk. + * @type {int} + */ + BufferMemoryLimit: number; + + /** + * Specifies the capabiltiy to be negotiated. This is a runtime property. + * @type {EnumDWT_Cap} + */ + Capability: EnumDWT_Cap; + + /** + * Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {int} + */ + CapCurrentIndex: number; + + /** + * Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapCurrentValue: number; + + /** + * Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property. + * @type {int} + */ + CapDefaultIndex: number; + + /** + * Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property. + * @type {double} + */ + CapDefaultValue: number; + + /** + * Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapMaxValue: number; + + /** + * Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapMinValue: number; + + /** + * [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property. + * @type {int} + */ + CapNumItems: number; + + /** + * [Deprecated.] Replaced by GetCapItemsString method and SetCapItemsString method. + * @type {string} + */ + CapItemsString: string; + + /** + * Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property. + * @type {double} + */ + CapStepSize: number; + + /** + * Sets or returns the type of capability container used to exchange capability information between application and source. This is a runtime property. + * @type {EnumDWT_CapType} + */ + CapType: EnumDWT_CapType; + + /** + * Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {double} + */ + CapValue: number; + + /** + * Sets or returns the string value for a capability when the value of the CapType property is TWON_ONEVALUE. This is a runtime property. + * @type {string} + */ + CapValueString: string; + + /** + * Sets or returns the value type for reading the value of a capability. This is a runtime property. + * @type {short} + */ + CapValueType: number; + + /** + * Returns or sets the contrast values available within the Source. This is a runtime property. + * @type {float} + */ + Contrast: number; + + /** + * Sets or returns the product name string for the application identity. + * @type {string} + */ + ProductName: string; + + /** + * Returns or sets current index of image in buffer. This is a runtime property. + * @type {short} + */ + CurrentImageIndexInBuffer: number; + + /** + * Returns the device name of current source. This is a runtime, read-only property. + * @type {string} + */ + CurrentSourceName: string; + + /** + * Returns the value indicating the data source status. This is a runtime, read-only property. + * @type {int} + */ + DataSourceStatus: number; + + /** + * Returns the device name of default source. This is a runtime, read-only property. + * @type {string} + */ + DefaultSourceName: string; + + /** + * Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property. + * @type {int} + */ + Duplex: number; + + /** + * [Deprecated.] Returns or sets whether the user can zoom image using hot key. + * @type {bool} + */ + EnableInteractiveZoom: boolean; + + /** + * Returns the error code. This is a runtime, read-only property. + * @type {int} + */ + ErrorCode: number; + + /** + * Returns the error string. This is a runtime, read-only property. + * @type {string} + */ + ErrorString: string; + + /** + * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {EnumDWT_FitWindowType} + */ + FitWindowType: EnumDWT_FitWindowType; + + /** + * Returns or sets the password used to log into the FTP server. + * @type {string} + */ + FTPPassword: string; + + /** + * Returns or sets the port number of the FTP server. + * @type {int} + */ + FTPPort: number; + + /** + * Returns or sets the user name used to log into the FTP server. + * @type {string} + */ + FTPUserName: string; + + /** + * Returns how many images are in buffer. This is a runtime, read-only property. + * @type {short} + */ + HowManyImagesInBuffer: number; + + /** + * Specifies the field name of uploaded image through POST. + * @type {string} + */ + HttpFieldNameOfUploadedImage: string; + + /** + * [Deprecated.] Sets or returns the password used to log into the HTTP server. + * @type {string} + */ + HTTPPassword: string; + + /** + * Returns or sets the port number of the HTTP server. + * @type {int} + */ + HTTPPort: number; + + /** + * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property. + * @type {string} + */ + HTTPPostResponseString: string; + + /** + * [Deprecated.] Returns or sets the user name used to log into the HTTP server. + * @type {string} + */ + HTTPUserName: string; + + /** + * Returns or sets whether the feature of disk caching is enabled. + * @type {bool} + */ + IfAllowLocalCache: boolean; + + /** + * Returns or sets whether insert or append new scanned images. + * @type {bool} + */ + IfAppendImage: boolean; + + /** + * Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property. + * @type {bool} + */ + IfAutoBright: boolean; + + /** + * Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx. + * @type {bool} + */ + IfAutoDiscardBlankpages: boolean; + + /** + * Returns or sets whether the Source enable automatic document feeding process. This is a runtime property. + * @type {bool} + */ + IfAutoFeed: boolean; + + /** + * Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual. + * @type {bool} + */ + IfAutomaticBorderDetection: boolean; + + /** + * Turns automatic skew correction on and off. + * @type {bool} + */ + IfAutomaticDeskew: boolean; + + /** + * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property. + * @type {bool} + */ + IfAutoScan: boolean; + + /** + * Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE. + * @type {bool} + */ + IfDisableSourceAfterAcquire: boolean; + + /** + * Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property. + * @type {bool} + */ + IfDuplexEnabled: boolean; + + /** + * Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property. + * @type {bool} + */ + IfFeederEnabled: boolean; + + /** + * Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property. + * @type {bool} + */ + IfFeederLoaded: boolean; + + /** + * Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode. + * @type {bool} + */ + IfFitWindow: boolean; + + /** + * [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE. + * @type {bool} + */ + IfModalUI: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images. + * @type {bool} + */ + IfOpenImageWithGDIPlus: boolean; + + /** + * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property. + * @type {bool} + */ + IfPaperDetectable: boolean; + + /** + * Returns or sets whether FTP passive mode is enabled. + * @type {bool} + */ + IfPASVMode: boolean; + + /** + * [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE. + * @type {bool} + */ + IfScanInNewThread: boolean; + + /** + * Sets or returns whether to show the cancel dialog when uploading images to server. + * @type {bool} + */ + IfShowCancelDialogWhenImageTransfer: boolean; + + /** + * Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder. + * @type {bool} + */ + IfShowFileDialog: boolean; + + /** + * Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property. + * @type {bool} + */ + IfShowIndicator: boolean; + + /** + * [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface. + * @type {bool} + */ + IfShowPrintUI: boolean; + + /** + * Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property. + * @type {bool} + */ + IfShowProgressBar: boolean; + + /** + * Returns or sets whether the Source displays the User Interface. + * @type {bool} + */ + IfShowUI: boolean; + + /** + * Returns or sets whether SSL is used when uploading or downloading images. + * @type {bool} + */ + IfSSL: boolean; + + /** + * Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE. + * @type {bool} + */ + IfTiffMultiPage: boolean; + + /** + * Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property. + * @type {bool} + */ + IfUIControllable: boolean; + + /** + * Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices. + * @type {bool} + */ + IfUseTwainDSM: boolean; + + /** + * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images + * @type {bool} + */ + IfAutoScroll: boolean; + + /** + * [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property. + * @type {short} + */ + ImageBitsPerPixel: number; + + /** + * Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only. + * @type {int} + */ + ImageCaptureDriverType: number; + + /** + * [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor. + * @type {bool} + */ + ImageEditorIfEnableEnumerator: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is a modal window. + * @type {bool} + */ + ImageEditorIfModal: boolean; + + /** + * [Deprecated.] Returns or sets whether the Image Editor is read-only. + * @type {bool} + */ + ImageEditorIfReadonly: boolean; + + /** + * [Deprecated.] Returns or sets the title of Image Editor window. + * @type {string} + */ + ImageEditorWindowTitle: string; + + /** + * Returns the document number of the current image. This is a runtime, read-only property. + * @type {int} + */ + ImageLayoutDocumentNumber: number; + + /** + * Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property. + * @type {float} + */ + ImageLayoutFrameBottom: number; + + /** + * Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameLeft: number; + + /** + * Returns the frame number of the current image. This is a runtime, read-only property. + * @type {int} + */ + ImageLayoutFrameNumber: number; + + /** + * Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameRight: number; + + /** + * Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property. + * @type {float} + */ + ImageLayoutFrameTop: number; + + /** + * Returns the page number of the current image. This is a runtime, read-only property. + * @type {Long} + */ + ImageLayoutPageNumber: number; + + /** + * [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property. + * @type {int} + */ + ImageLength: number; + + /** + * Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN. + * @type {short} + */ + ImageMargin: number; + + /** + * Returns the pixel type of the current image. This is a runtime, read-only property. Please note the property is only valid in OnPreTransfer and OnPostTransfer event. + * @type {EnumDWT_PixelType} + */ + ImagePixelType: EnumDWT_PixelType; + + /** + * [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property. + * @type {int} + */ + ImageWidth: number; + + /** + * [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property. + * @type {float} + */ + ImageXResolution: number; + + /** + * [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property. + * @type {float} + */ + ImageYResolution: number; + + /** + * Returns or sets the quality of JPEG files and PDF files using JPEG compression. + * @type {short} + */ + JPEGQuality: number; + + /** + * Returns or sets the log level for debugging. + * @type {short} + */ + LogLevel: number; + + /** + * Return the magnetic data if the scanner support magnetic data recognition. + * @type {string} + */ + MagData: string; + + /** + * Return the magnetic type if the scanner support magnetic data recognition. + * @type {short} + */ + MagType: number; + + /** + * Sets or returns the manufacture string for the application identity. + * @type {string} + */ + Manufacturer: string; + + /** + * Returns or sets the maximum number of images can be held in buffer. + * @type {short} + */ + MaxImagesInBuffer: number; + + /** + * [Deprecated.] Returns or sets how many threads can be used when you upload files through POST. + * @type {int} + */ + MaxInternetTransferThreads: number; + + /** + * Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document. + * @type {int} + */ + MaxUploadImageSize: number; + + /** + * Returns or sets the shape of the mouse. + * @type {bool} + */ + MouseShape: boolean; + + /** + * Returns the X co-ordinate of the mouse. This is a runtime property. + * @type {int} + */ + MouseX: number; + + /** + * Returns the Y co-ordinate of the mouse. This is a runtime property. + * @type {int} + */ + MouseY: number; + + /** + * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property. + * @type {short} + */ + PageSize: number; + + /** + * Returns or sets the name of the person who creates the PDF document. + * @type {string} + */ + PDFAuthor: string; + + /** + * Returns or sets the compression type of PDF files. This is a runtime property. + * @type {EnumDWT_PDFCompressionType} + */ + PDFCompressionType: EnumDWT_PDFCompressionType; + + /** + * Returns or sets the date when the PDF document is created. + * @type {string} + */ + PDFCreationDate: string; + + /** + * Returns or sets the name of the application that created the original document, if the PDF document is converted from another form. + * @type {string} + */ + PDFCreator: string; + + /** + * Returns or sets the keywords associated with the PDF document. + * @type {string} + */ + PDFKeywords: string; + + /** + * Returns or sets the date when the PDF document is last modified. + * @type {string} + */ + PDFModifiedDate: string; + + /** + * Returns or sets the name of the application that converted the PDF document from its native. + * @type {string} + */ + PDFProducer: string; + + /** + * Returns or sets the subject of the PDF document. + * @type {string} + */ + PDFSubject: string; + + /** + * Returns or sets the title of the PDF document. + * @type {string} + */ + PDFTitle: string; + + /** + * Returns or sets the value of the PDF version. + * @type {string} + */ + PDFVersion: string; + + /** + * Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property. + * @type {short} + */ + PendingXfers: number; + + /** + * Returns or sets the pixel flavor for acquired images. This is a runtime property. + * @type {short} + */ + PixelFlavor: number; + + /** + * Returns or sets the pixel type of current data source. This is a runtime property. Using this property after calling OpenSource() method and before calling AcquireImage(). + * @type {EnumDWT_PixelType} + */ + PixelType: EnumDWT_PixelType; + + /** + * Sets or returns the product family string for the application identity. + * @type {string} + */ + ProductFamily: string; + + /** + * Sets the product key. A product key is generated in Licensing Tool which is intalled with Dynamic Web TWAIN. Each product key corresponds with a license. + * @type {string} + */ + ProductKey: string; + + /** + * [Deprecated.] Returns or sets the name of the proxy server. + * @type {string} + */ + ProxyServer: string; + + /** + * Returns or sets the current resolution for acquired images. This is a runtime property. + * @type {float} + */ + Resolution: number; + + /** + * Returns or sets how many scanned images are selected. + * @type {short} + */ + SelectedImagesCount: number; + + /** + * Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value. + * @type {int} + */ + SelectionImageBorderColor: number; + + /** + * Specifies a fixed aspect ratio to be used for selecting an area. + * @type {float} + */ + SelectionRectAspectRatio: number; + + /** + * Returns how many sources are installed in the system. This is a runtime, read-only property. + * @type {int} + */ + SourceCount: number; + + /** + * [Deprecated.] Replaced by GetSourceNameItems method. + * @type {string} + */ + SourceNameItems: string; + + /** + * [Deprecated.] + * @type {string} + */ + GetSourceNames: string; + + /** + * Returns or sets the compression type of TIFF files. This is a runtime property. + * @type {EnumDWT_TIFFCompressionType} + */ + TIFFCompressionType: EnumDWT_TIFFCompressionType; + + /** + * Sets or returns the transfer mode. + * @type {EnumDWT_TransferMode} + */ + TransferMode: EnumDWT_TransferMode; + + /** + * Returns or sets the unit of measure. This is a runtime property. + * @type {short} + */ + Unit: number; + + /** + * Sets or returns the version info string for the application identity. + * @type {string} + */ + VersionInfo: string; + + /** + * Returns and sets the number of images you are willing to transfer per session. This is a runtime property. + * @type {short} + */ + XferCount: number; + + /** + * Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1. + * @type {float} + */ + Zoom: number; + + /** + * Binds a specified function to an event, so that the function gets called whenever the event fires. + * @method WebTwain#RegisterEvent + * @param {string} name the name of the event that the function is bound to. + * @param {object} evt specifies the function to call when event fires. + * @return {bool} + */ + RegisterEvent(name: string, evt: object): boolean; + + // --- SCAN start -- + + /** + * Cancels all pending transfers. + * @method WebTwain#CancelAllPendingTransfers + * @return {bool} + */ + CancelAllPendingTransfers(): boolean; + + /** + * Closes Data Source. + * @method WebTwain#CloseSource + * @return {bool} + */ + CloseSource(): boolean; + + /** + * Closes and unloads Data Source Manager. + * @method WebTwain#CloseSourceManager + * @return {bool} + */ + CloseSourceManager(): boolean; + + /** + * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed. + * @method WebTwain#DisableSource + * @return {bool} + */ + DisableSource(): boolean; + + /** + * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE. + * @method WebTwain#FeedPage + * @return {bool} + */ + FeedPage(): boolean; + + /** + * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc. + * @method WebTwain#GetDeviceType + * @return {int} + */ + GetDeviceType(): number; + + /** + * Get the source name according to the source index. + * @method WebTwain#GetSourceNameItems + * @param {short} index int index. Index is 0-based and can not be greater than SourceCount property. + * @return {string} + */ + GetSourceNameItems(index: number): string; + + /** + * Loads the specified Source into main memory and causes its initialization, + * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is + * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source. + * @method WebTwain#OpenSource + * @return {bool} + */ + OpenSource(): boolean; + + /** + * Loads and opens Data Source Manager. + * @method WebTwain#OpenSourceManager + * @return {bool} + */ + OpenSourceManager(): boolean; + + /** + * Reverts the current image layout to the Data Source's default. + * @method WebTwain#ResetImageLayout + * @return {bool} + */ + ResetImageLayout(): boolean; + + /** + * Sets the Source to return the current page to the input side of the document feeder and + * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE. + * @method WebTwain#RewindPage + * @return {bool} + */ + RewindPage(): boolean; + + /** + * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI) + * so that user can choose which Data Source to be the current Source. + * @method WebTwain#SelectSource + * @return {bool} + */ + SelectSource(): boolean; + + /** + * Selects the index-the source in SourceNameItems property as the current source. + * @method WebTwain#SelectSourceByIndex + * @param {short} index It is the index of SourceNameItems property. + * @return {bool} + */ + SelectSourceByIndex(index: number): boolean; + + /** + * Sets file name and file format information used in File Transfer Mode. + * @method WebTwain#SetFileXferInfo + * @param {string} fileName the name of the file to be used in transfer. + * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image. + * @return {bool} + */ + SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean; + + /** + * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source. + * @method WebTwain#SetImageLayout + * @param {float} left specifies the floating point number for the left side of the image layout rectangle. + * @param {float} top specifies the floating point number for the top side of the image layout rectangle. + * @param {float} right specifies the floating point number for the right side of the image layout rectangle. + * @param {float} bottom specifies the floating point number for the bottom side of the image layout rectangle. + * @return {bool} + */ + SetImageLayout(left: number, top: number, right: number, bottom: number): boolean; + + /** + * Clears all the web forms which are used for image uploading. + * @method WebTwain#ClearAllHTTPFormField + * @return {bool} + */ + ClearAllHTTPFormField(): boolean; + + /** + * Clears the content of all custom tiff tags. + * @method WebTwain#ClearTiffCustomTag + * @return {void} + */ + ClearTiffCustomTag(): void; + + /** + * Check whether a certain file exists on the local disk. + * @method WebTwain#FileExists + * @param {string} localFile specifies the absolute path of the local file. + * @return {bool} + */ + FileExists(localFile: string): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownload + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly download a file from the FTP server to local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPDownloadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {string} localFile specify a full path to store the file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the FTP server. + * @method WebTwain#FTPDownloadEx + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server. + * @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server. + * @method WebTwain#FTPUpload + * @param {string} FTPServer the name of the FTP server. + * @param {short} sImageIndex specifies the index of the image in the buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific file to the FTP server without loading it into Dynamic Web TWAIN. + * @method WebTwain#FTPUploadDirectly + * @param {string} FTPServer the name of the FTP server. + * @param {string} localFile specify the the full path of a local file. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the FTP server as a specified image format. + * @method WebTwain#FTPUploadEx + * @param {string} FTPServer the name of the FTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAllAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAllAsPDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page PDF. + * @method WebTwain#FTPUploadAsMultiPagePDF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in buffer to the FTP server as Multi-Page TIFF. + * @method WebTwain#FTPUploadAsMultiPageTIFF + * @param {string} FTPServer the name of the FTP server. + * @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownload + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPDownloadDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server. + * @param {string} localFile specify the location to store the downloaded file. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Downloads an image from the HTTP server. + * @method WebTwain#HTTPDownloadEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Download an image from the server using a HTTP Post call. + * @method WebTwain#HTTPDownloadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info) + * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPost + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPostDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file . + * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the file to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method. + * @method WebTwain#HTTPUploadThroughPostEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPostAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp". + * @param {string} fileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure. + * @return {bool} + */ + HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + + /** + * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. + * @method WebTwain#HTTPUploadThroughPutDirectly + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} localFile specifies the path of a local file. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPut + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method. + * @method WebTwain#HTTPUploadThroughPutEx + * @param {string} HTTPServer the name of the HTTP server. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadAllThroughPutAsPDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF. + * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF + * @param {string} HTTPServer the name of the HTTP server. + * @param {string} RemoteFileName the name of the image to be uploaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Configures how segmented upload is done. + * @method WebTwain#SetUploadSegment + * @param {int} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked. + * @param {int} moduleSize specifies the size of each segment (in KB). + * @return {bool} + */ + SetUploadSegment (segmentUploadThreshold: number, moduleSize: number): boolean; + + /** + * Uploads the images specified by the indices to the HTTP server. + * @method WebTwain#HTTPUpload + * @param {string} url the url where the images are sent in a POST request. + * @param {Array} indices indices specifies which images are to be uploaded. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded. + * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + HTTPUpload (url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN. + * @method WebTwain#LoadDibFromClipboard + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImage + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads an image into the Dynamic Web TWAIN. + * @method WebTwain#LoadImageEx + * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk. + * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Loads image from a base64 byte array with the specified file format. + * @method WebTwain#LoadImageFromBase64Binary + * @param {string} bry specifies the base64 string data. + * @param {EnumDWT_ImageType} lImageType specifies the file format. + * @return {bool} + */ + LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType): boolean; + + /** + * [Deprecated.] Loads image from a byte array with the specified file format. + * @method WebTwain#LoadImageFromBytes + * @param {int} lBufferSize Specifies the buffer size. + * @param {Array} buffer A byte array of the image data. + * @param {EnumDWT_ImageType} lImageType Specifies the file format. + * @return {bool} + */ + LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean; + + /** + * Saves all images in buffer as a MultiPage TIFF file. + * @method WebTwain#SaveAllAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves all images in buffer as a Multi-Page PDF file. + * @method WebTwain#SaveAllAsPDF + * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the image of a specified index in buffer as a BMP file. + * @method WebTwain#SaveAsBMP + * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsBMP(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a JPEG file. + * @method WebTwain#SaveAsJPEG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsJPEG(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a PDF file. + * @method WebTwain#SaveAsPDF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsPDF(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a PNG file. + * @method WebTwain#SaveAsPNG + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsPNG(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the image of a specified index in buffer as a TIFF file. + * @method WebTwain#SaveAsTIFF + * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk. + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SaveAsTIFF(localFile: string, sImageIndex: number): boolean; + + /** + * Saves the selected images in buffer as a Multipage PDF file. + * @method WebTwain#SaveSelectedImagesAsMultiPagePDF + * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer as a Multipage TIFF file. + * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF + * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk. + * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess. + * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Saves the selected images in buffer to base64 string. + * @method WebTwain#SaveSelectedImagesToBase64Binary + * @return {string} + */ + SaveSelectedImagesToBase64Binary(): string; + + /** + * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format. + * @method WebTwain#SaveSelectedImagesToBytes + * @param {int} bufferSize specified the buffer size. + * @param {Array} buffer A byte array of the image data. + * @return {int} + */ + SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number; + + /** + * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST. + * @method WebTwain#SetCookie + * @param {string} cookie the cookie on current page. + * @return {void} + */ + SetCookie(cookie: string): void; + + /** + * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images. + * @method WebTwain#SetHTTPFormField + * @param {string} FieldName specifies the name of a text field in web form. + * @param {string} FieldValue specifies the value of a text field in web form. + * @return {bool} + */ + SetHTTPFormField(FieldName: string, FieldValue: string): boolean; + + /** + * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64. + * @method WebTwain#SetTiffCustomTag + * @param {int} tag specifies the tag identifier. The value should be between 600 and 700. + * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it. + * @param {bool} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text. + * @return {bool} + */ + SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean; + + /** + * Show save file dialog or show open file dialog. + * @method WebTwain#ShowFileDialog + * @param {bool} SaveDialog True -- show save file dialog, False -- show open file dialog. + * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically. + * @param {int} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based. + * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended. + * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms. + * @param {bool} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file. + * @param {bool} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file. + * @param {int} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless. + * @return {bool} + */ + ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean; + + /** + * Gets information of the capability specified by the Capability property. + * @method WebTwain#CapGet + * @return {bool} + */ + CapGet(): boolean; + + /** + * Returns the Source's current Value for the specified capability. + * @method WebTwain#CapGetCurrent + * @return {bool} + */ + CapGetCurrent(): boolean; + + /** + * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value. + * @method WebTwain#CapGetDefault + * @return {bool} + */ + CapGetDefault(): boolean; + + /** + * Returns the value of the bottom-most edge of the specified frame. + * @method WebTwain#CapGetFrameBottom + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameBottom(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameLeft + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameLeft(index: number): number; + + /** + * Returns the value (in Unit) of the left-most edge of the specified frame. + * @method WebTwain#CapGetFrameRight + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameRight(index: number): number; + + /** + * Returns the value (in Unit) of the top-most edge of the specified frame. + * @method WebTwain#CapGetFrameTop + * @param {short} index specifies the value of which frame to get. The index is 0-based. + * @return {float} + */ + CapGetFrameTop(index: number): number; + + /** + * Queries whether the Source supports a particular operation on the capability. + * @method WebTwain#CapIfSupported + * @param {EnumDWT_MessageType} messageType specifies the type of capability operation. + * @return {bool} + */ + CapIfSupported(messageType: EnumDWT_MessageType): boolean; + + /** + * Changes the Current Value of the capability specified by Capability property back to its power-on value. + * @method WebTwain#CapReset + * @return {bool} + */ + CapReset(): boolean; + + /** + * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property. + * @method WebTwain#CapSet + * @return {bool} + */ + CapSet(): boolean; + + /** + * Sets the values of the specified frame. + * @method WebTwain#CapSetFrame + * @param {short} index specifies the values of which frame to set. The index is 0-based. + * @param {float} left the value (in Unit) of the left-most edge of the specified frame. + * @param {float} top the value (in Unit) of the top-most edge of the specified frame. + * @param {float} right the value (in Unit) of the right-most edge of the specified frame. + * @param {float} bottom the value (in Unit) of the bottom-most edge of the specified frame. + * @return {bool} + */ + CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItems + * @param {int} index Index is 0-based. It is the index of the cap item. + * @return {double} + */ + GetCapItems(index: number): number; + + /** + * Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#GetCapItemsString + * @param {int} index Index is 0-based. It is the index of the cap item. + * @return {string} + */ + GetCapItemsString(index: number): string; + + /** + * Set the value of the specified cap item. + * @method WebTwain#SetCapItems + * @param {int} index Index is 0-based. It is the index of the cap item. + * @param {double} newVal The Double type of CapItems property is used to present Double, Single(float), Long, int and even boolean types. For string type, please use CapItemsstring property. + * @return {void} + */ + SetCapItems(index: number, newVal: number): void; + + /** + * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. + * @method WebTwain#SetCapItemsString + * @param {int} index Index is 0-based. It is the index of the cap item. + * @param {string} newVal The new value to be set. + * @return {void} + */ + SetCapItemsString(index: number, newVal: string): void; + // --- SCAN end -- + + + + + + + + // --- View & Edit start -- + + /** + * Add text on an image. + * @method WebTwain#AddText + * @param {short} sImageIndex the index of the image that you want to add text to. + * @param {int} x the x coordinate for the text. + * @param {int} y the y coordinate for the text. + * @param {string} text the content of the text that you want to add. + * @param {int} txtColor the color for the text. + * @param {int} backgroundColor the background color. + * @param {float} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter. + * @param {float} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1 + * @return {bool} + */ + AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean; + + /** + * Create the font for adding text using the method AddText. + * @method WebTwain#CreateTextFont + * @param {int} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size. + * @param {int} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference. + * @param {int} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis. + * @param {int} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up. + * @param {int} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used. + * @param {short} italic Specifies an italic font if set to TRUE. + * @param {short} underline Specifies an underlined font if set to TRUE. + * @param {short} strikeOut A strikeout font if set to TRUE. + * @param {short} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font. + * @param {short} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch. + * @param {short} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. + * @param {short} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font. + * @param {short} pitchAndFamily The pitch and family of the font. + * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character. + * @return {bool} + */ + CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean; + + /** + * Copies the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CopyToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + CopyToClipboard(sImageIndex: number): boolean; + + /** + * Clears the specified area of a specified image, and fill the area with the fill color. + * @method WebTwain#Erase + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Returns the pixel bit depth of the selected image. + * @method WebTwain#GetImageBitDepth + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {short} + */ + GetImageBitDepth(sImageIndex: number): number; + + /** + * Returns the width (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageWidth + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {int} + */ + GetImageWidth(sImageIndex: number): number; + + /** + * Returns the height (pixels) of the selected image. This is a read-only property. + * @method WebTwain#GetImageHeight + * @param {short} sImageIndex specifies the index of image. The index is 0-based. + * @return {int} + */ + GetImageHeight(sImageIndex: number): number; + + /** + * Returns the file size of the new image resized from the image of a specified index in buffer. + * @method WebTwain#GetImageSize + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} iWidth specifies the pixel width of the new image. + * @param {int} iHeight specifies the pixel height of the new image. + * @return {double} + */ + GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number; + + /** + * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer. + * @method WebTwain#GetImageSizeWithSpecifiedType + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {short} sImageType specifies the type of an image file.. + * @return {int} + */ + GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number; + + /** + * Return the horizontal resolution of the specified image. + * @method WebTwain#GetImageXResolution + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {int} + */ + GetImageXResolution(sImageIndex: number): number; + + /** + * Return the vertical resolution of the specified image. + * @method WebTwain#GetImageYResolution + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {int} + */ + GetImageYResolution(sImageIndex: number): number; + + /** + * Returns the index of the selected image. + * @method WebTwain#GetSelectedImageIndex + * @param {short} sSelectedIndex specifies the index of the selected image. + * @return {short} + */ + GetSelectedImageIndex(sSelectedIndex: number): number; + + + /** + * You can use the method to select images programatically which is ususally done by mouse clicking. + * @method WebTwain#SetSelectedImageIndex + * @param {short} sSelectedIndex this is the index of an array that holds the indices of selected images. + * @param {short} newVal specifies the index of an image that you want to select. + * @return {void} + */ + SetSelectedImageIndex(selectedIndex: number, newVal: number): void; + + /** + * Pre-calculate the file size of the local image file that is saved from the selected images in buffer. + * @method WebTwain#GetSelectedImagesSize + * @param {int} iImageType specifies the type of an image file. + * @return {int} + */ + GetSelectedImagesSize(iImageType: number): number; + + /** + * Check the skew angle of an image by its index in buffer. + * @method WebTwain#GetSkewAngle + * @param {short} sImageIndex the index of the image in the buffer. + * @return {double} + */ + GetSkewAngle(sImageIndex: number): number; + + /** + * Check the skew angle of a rectangular part of an image by its index in buffer. + * @method WebTwain#GetSkewAngleEx + * @param {short} sImageIndex the index of the image in the buffer. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {double} + */ + GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number; + + /** + * [Deprecated.] Detects whether a certain area on an image is blank. + * @method WebTwain#IsBlankImageEx + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {bool} bFuzzyMatch specifies whether use fuzzy matching when detecting. + * @return {bool} + */ + IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean; + + /** + * Mirrors the image of a specified index in buffer. + * @method WebTwain#Mirror + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + Mirror(sImageIndex: number): boolean; + + /** + * Decorates image of a specified index in buffer with rectangles of transparent color. + * @method WebTwain#OverlayRectangle + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @param {int} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red. + * @param {float} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent. + * @return {bool} + */ + OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean; + + /** + * Removes all images in buffer. + * @method WebTwain#RemoveAllImages + * @return {void} + */ + RemoveAllImages(): void; + + /** + * Removes selected images in buffer. + * @method WebTwain#RemoveAllSelectedImages + * @return {bool} + */ + RemoveAllSelectedImages(): boolean; + + /** + * Removes the image of a specified index in buffer. + * @method WebTwain#RemoveImage + * @param {short} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based. + * @return {bool} + */ + RemoveImage(sImageIndexToBeDeleted: number): boolean; + + // Image Operate + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#Rotate + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {float} fAngle Specifies the rotation angle. + * @param {bool} bKeepSize Keep size or not. + * @return {bool} + */ + Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean; + + /** + * Rotates the image of a specified index in buffer by specified angle. + * @method WebTwain#RotateEx + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {float} fAngle Specifies the rotation angle. + * @param {bool} bKeepSize Keep size or not. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise. + * @method WebTwain#RotateLeft + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + RotateLeft(sImageIndex: number): boolean; + + /** + * Rotates the image of a specified index in buffer by 90 degrees clockwise. + * @method WebTwain#RotateRight + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + RotateRight(sImageIndex: number): boolean; + + /** + * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately. + * @method WebTwain#ChangeImageSize + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} iNewWidth specifies the pixel width of the new image. + * @param {int} iNewHeight specifies the pixel height of the new image. + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Flips the image of a specified index in buffer. + * @method WebTwain#Flip + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + Flip(sImageIndex: number): boolean; + + /** + * Crops the image of a specified index in buffer. + * @method WebTwain#Crop + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Crops the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CropToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image data in the specified area to the system clipboard in DIB format. + * @method WebTwain#CutFrameToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle. + * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle. + * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle. + * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle. + * @return {bool} + */ + CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + /** + * Cuts the image of a specified index in buffer to clipboard in DIB format. + * @method WebTwain#CutToClipboard + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + CutToClipboard(sImageIndex: number): boolean; + + /** + * Change the DPI (dots per inch) for the specified image. + * @method WebTwain#SetDPI + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} xResolution The horizontal resolution. + * @param {int} yResolution The vertical resolution. + * @param {bool} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true). + * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation. + * @return {bool} + */ + SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean; + + /** + * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN. + * @method WebTwain#SetViewMode + * @param {short} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN. + * @param {short} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN.. + * @return {void} + */ + SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void; + + /** + * Moves a specified image. + * @method WebTwain#MoveImage + * @param {short} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based. + * @param {short} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based. + * @return {bool} + */ + MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean; + + /** + * Switchs two images of specified indices in buffer. + * @method WebTwain#SwitchImage + * @param {short} sImageIndex1 specifies the index of image in buffer. The index is 0-based. + * @param {short} sImageIndex2 specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean; + + /** + * Shows the GUI of Image Printer. + * @method WebTwain#Print + * @return {bool} + */ + Print(): boolean; + // --- View & Edit end -- + + + + // --- Upload & Save end -- + + // --- Others --- + /** + * Shows the GUI of Image Editor. + * @method WebTwain#ShowImageEditor + * @return {bool} + */ + ShowImageEditor(): boolean; + + /** + * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires. + * @method WebTwain#UnregisterEvent + * @param {string} name the name of the event. + * @param {object} evt specified the function to be unbound. + * @return {bool} + */ + UnregisterEvent(name: string, evt: object): boolean; + // --- Others end --- + + /** + * Enables the source to accept image. + * @method WebTwain#EnableSource + * @return {bool} + */ + EnableSource(): boolean; + + + + /** + * Displays the source's built-in interface to acquire image. + * @method WebTwain#AcquireImage + * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + // start from 10.0 + /** + * Change the width of an image in buffer. + * @method WebTwain#SetImageWidth + * @param {short} sImageIndex specifies which image you'd like to change. + * @param {int} iNewWidth specifies how wide you'd like to change the image. + * @return {bool} + */ + SetImageWidth(sImageIndex: number, iNewWidth: number): boolean; + + // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64 + /** + * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSDataEx + * @param {string} value the input string which is encoded with base64. + * @return {bool} + */ + SetCustomDSDataEx(value: string): boolean; + + // Set custom DS data, load data from the specified file + /** + * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile. + * @method WebTwain#SetCustomDSData + * @param {string} fileName the absolute path of the file where the custom data source data is stored. + * @return {bool} + */ + SetCustomDSData(fileName: string): boolean; + + // Get custom DS data, and returned string is encoded with base64 + /** + * Gets custom DS data, the returned string is base64 encoded. + * @method WebTwain#GetCustomDSDataEx + * @return {string} + */ + GetCustomDSDataEx(): string; + + // Get custom DS data, and save the data to the specified file + /** + * Gets custom DS data and save the data in a specified file. + * @method WebTwain#GetCustomDSData + * @param {string} fileName the path of the file used for storing custom DS data. + * @return {bool} + */ + GetCustomDSData(fileName: string): boolean; + + /** + * Changes the bitdepth of a specified image. + * @method WebTwain#ChangeBitDepth + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {short} sBitDepth specifies the target bit depth. + * @param {bool} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time. + * @return {bool} + */ + ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean; + + /** + * Changes a specified image to gray scale. + * @method WebTwain#ConvertToGrayScale + * @param {short} sIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + ConvertToGrayScale(sIndex: number): boolean; + + /** + * [Deprecated.] Shows the GUI of Image Editor with custom settings. + * @method WebTwain#ShowImageEditorEx + * @param {int} x specifies the new position of the left top corner of the window. + * @param {int} y specifies the new position of the left top corner of the window. + * @param {int} cx specifies the width of the window. + * @param {int} cy specifies the height of the window. + * @param {int} nCmdShow specifices how the window should be shown. + * @return {bool} + */ + ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean; + + /** + * [Deprecated.] Detects whether an image is blank. + * @method WebTwain#IsBlankImage + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + IsBlankImage(sImageIndex: number): boolean; + + /** + * Detects whether a specific image is blank. + * @method WebTwain#IsBlankImageExpress + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @return {bool} + */ + IsBlankImageExpress(sImageIndex: number): boolean; + + /** + * [Deprecated.] Detects whether a specific image is blank. + * @method WebTwain#GetBarcodeInfo + * @param {int} barcodeInfoType Defined in TWAIN Specification. + * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. + * @return {object} + */ + GetBarcodeInfo(barcodeInfoType: number, barcodeIndex: number): object; + + /** + * [Deprecated.] Gets the content from a specified barcode. + * @method WebTwain#GetBarcodeText + * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based. + * @return {bool} + */ + GetBarcodeText(barcodeIndex: number): boolean; + + /** + * Sets the default source to use. It's only valid when IfUseTWAINDSM is set to true. + * @method WebTwain#SetDefaultSource + * @param {short} sImageIndex specifies the index of the default source. The index is 0-based. + * @return {bool} + */ + SetDefaultSource(sImageIndex: number): boolean; + + /** + * Draws a rectangle on the viewer which represents the selected area. + * @method WebTwain#SetSelectedImageArea + * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based. + * @param {int} left The X axis of the left border. + * @param {int} top The Y axis of the top border. + * @param {int} right The X axis of the right border. + * @param {int} bottom The Y axis of the bottom border. + * @return {bool} + */ + SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; + + + /** + * Converts the images specified by the indices to base64. + * @method WebTwain#ConvertToBase64 + * @param {Array} indices indices specifies which images are to be converted to base64. + * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64. + * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess. + * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure. + * @return {bool} + */ + ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; + + /** + * Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio. + * @method WebTwain#GetImageURL + * @param {short} index the index of the image. + * @param {int} iWidth the width of the image. + * @param {int} iHeight the height of the image. + * @return {string} + */ + GetImageURL(index: number, iWidth: number, iHeight: number): string; + + /** + * Sets a header for the current HTTP Post request. + * @method WebTwain#SetHTTPHeader + * @param {string} key the key of the header. + * @param {string} value the value of the header. + * @return {bool} + */ + SetHTTPHeader(key: string, value: string): boolean; +} \ No newline at end of file diff --git a/types/dwt/tsconfig.json b/types/dwt/tsconfig.json new file mode 100644 index 0000000000..5ff27b3787 --- /dev/null +++ b/types/dwt/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dwt-tests.ts" + ] +} \ No newline at end of file From 757802c4b2054a7f612dbb0b7ee66ecdc9845e66 Mon Sep 17 00:00:00 2001 From: yushulx Date: Tue, 2 May 2017 14:53:00 +0800 Subject: [PATCH 0004/1348] Added Header --- types/dwt/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index eda4725dfa..dcb1397c0f 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,4 +1,9 @@ -/*! +// Type definitions for dwt 12.3.0 +// Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx +// Definitions by: Xiao Ling +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*! * Dynamsoft WebTwain JavaScript Intellisense * Product: Dynamsoft Web Twain * Web Site: http://www.dynamsoft.com From 03240567675bf9a75115f77fc53b718a24a17aa4 Mon Sep 17 00:00:00 2001 From: yushulx Date: Tue, 2 May 2017 15:13:31 +0800 Subject: [PATCH 0005/1348] Update --- types/dwt/dwt-tests.ts | 8 +++--- types/dwt/index.d.ts | 58 +++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 70e68e015f..531e78e418 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -75,8 +75,8 @@ function saveImage() { if (DWObject) { DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer); DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer); - DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode, errorString) => {}); - DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode, errorString) => {}); + DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", () => {}, (errorCode: number, errorString: string) => {}); + DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", () => {}, (errorCode: number, errorString: string) => {}); } } @@ -94,7 +94,7 @@ function uploadImage() { if (DWObject) { DWObject.HTTPPort = 80; DWObject.IfSSL = false; - DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode, errorString) => {}); + DWObject.HTTPUploadThroughPost("www.dynamsoft.com", DWObject.CurrentImageIndexInBuffer, "upload", "tmp.jpg", () => {}, (errorCode: number, errorString: string) => {}); } } @@ -102,6 +102,6 @@ function downloadImage() { let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.HTTPPort = 80; - DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode, errorString) => {}); + DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {}); } } \ No newline at end of file diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index dcb1397c0f..8be78d4af4 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -699,7 +699,7 @@ declare enum EnumDWT_PDFCompressionType { /** CCITT modified Huffman RLE. */ PDF_RLE = 4, PDF_JPEG = 5 -}; +} declare enum EnumDWT_ShowMode { /** Activates the window and displays it in its current size and position. */ @@ -1060,7 +1060,7 @@ declare enum EnumDWT_CapFeederOrder { TWFO_FIRSTPAGEFIRST = 0, /** The feeder starts with the top of the last page. */ TWFO_LASTPAGEFIRST = 1 -}; +} /** CAP_PRINTER values. */ declare enum EnumDWT_CapPrinter { @@ -1072,7 +1072,8 @@ declare enum EnumDWT_CapPrinter { TWPR_ENDORSERTOPAFTER = 5, TWPR_ENDORSERBOTTOMBEFORE = 6, TWPR_ENDORSERBOTTOMAFTER = 7 -}; +} + /** CAP_PRINTERMODE values. */ declare enum EnumDWT_CapPrinterMode { /** Specifies that the printed text will consist of a single string. */ @@ -1081,20 +1082,23 @@ declare enum EnumDWT_CapPrinterMode { TWPM_MULTISTRING = 1, /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */ TWPM_COMPOUNDSTRING = 2 -}; +} + /** ICAP_BITDEPTHREDUCTION values. */ declare enum EnumDWT_CapBitdepthReduction { TWBR_THRESHOLD = 0, TWBR_HALFTONE = 1, TWBR_CUSTHALFTONE = 2, TWBR_DIFFUSION = 3 -}; +} + /** ICAP_BITORDER values. */ declare enum EnumDWT_CapBitOrder { TWBO_LSBFIRST = 0, /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */ TWBO_MSBFIRST = 1 -}; +} + /** ICAP_FILTER values. */ declare enum EnumDWT_CapFilterType { TWFT_RED = 0, @@ -1106,7 +1110,8 @@ declare enum EnumDWT_CapFilterType { TWFT_MAGENTA = 6, TWFT_YELLOW = 7, TWFT_BLACK = 8 -}; +} + /** ICAP_FLASHUSED2 values. */ declare enum EnumDWT_CapFlash { TWFL_NONE = 0, @@ -1114,14 +1119,16 @@ declare enum EnumDWT_CapFlash { TWFL_ON = 2, TWFL_AUTO = 3, TWFL_REDEYE = 4 -}; +} + /** ICAP_FLIPROTATION values. */ declare enum EnumDWT_CapFlipRotation { /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */ TWFR_BOOK = 0, /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */ TWFR_FANFOLD = 1 -}; +} + /** ICAP_IMAGEFILTER values. */ declare enum EnumDWT_CapImageFilter { TWIF_NONE = 0, @@ -1134,12 +1141,14 @@ declare enum EnumDWT_CapImageFilter { TWIF_HIGHPASS = 4, TWIF_TEXT = 3, TWIF_FINELINE = 4 -}; +} + /** ICAP_LIGHTPATH values. */ declare enum EnumDWT_CapLightPath { TWLP_REFLECTIVE = 0, TWLP_TRANSMISSIVE = 1 -}; +} + /** ICAP_LIGHTSOURCE values. */ declare enum EnumDWT_CapLightSource { TWLS_RED = 0, @@ -1149,7 +1158,8 @@ declare enum EnumDWT_CapLightSource { TWLS_WHITE = 4, TWLS_UV = 5, TWLS_IR = 6 -}; +} + /** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */ declare enum EnumDWT_MagType { /** Added 2.0 */ @@ -1158,14 +1168,15 @@ declare enum EnumDWT_MagType { TWMD_RAW = 1, /** added 2.1 */ TWMD_INVALID = 2 -}; +} + /** ICAP_NOISEFILTER values. */ declare enum EnumDWT_CapNoiseFilter { TWNF_NONE = 0, TWNF_AUTO = 1, TWNF_LONEPIXEL = 2, TWNF_MAJORITYRULE = 3 -}; +} /** ICAP_ORIENTATION values. */ declare enum EnumDWT_CapORientation { @@ -1181,7 +1192,8 @@ declare enum EnumDWT_CapORientation { TWOR_AUTOTEXT = 5, /** 2.0 */ TWOR_AUTOPICTURE = 6 -}; +} + /** ICAP_OVERSCAN values. */ declare enum EnumDWT_CapOverscan { TWOV_NONE = 0, @@ -1189,20 +1201,21 @@ declare enum EnumDWT_CapOverscan { TWOV_TOPBOTTOM = 2, TWOV_LEFTRIGHT = 3, TWOV_ALL = 4 -}; +} + /** ICAP_PIXELFLAVOR values. */ declare enum EnumDWT_CapPixelFlavor { /** Zero pixel represents darkest shade. zero pixel represents darkest shade */ TWPF_CHOCOLATE = 0, /** Zero pixel represents lightest shade. zero pixel represents lightest shade */ TWPF_VANILLA = 1 -}; +} /** ICAP_PLANARCHUNKY values. */ declare enum EnumDWT_CapPlanarChunky { TWPC_CHUNKY = 0, TWPC_PLANAR = 1 -}; +} /** Data source status. */ declare enum EnumDWT_DataSourceStatus { @@ -1214,7 +1227,7 @@ declare enum EnumDWT_DataSourceStatus { TWDSS_ENABLED = 2, /** Indicate the data source is acquiring image. */ TWDSS_ACQUIRING = 3 -}; +} /** Fit window type */ declare enum EnumDWT_FitWindowType { @@ -1224,20 +1237,19 @@ declare enum EnumDWT_FitWindowType { enumFitWindowHeight = 1, /** Fit the image to the width of the window */ enumFitWindowWidth = 2 -}; +} declare enum EnumDWT_UploadDataFormat { Binary = 0, Base64 = 1 -}; - +} declare enum EnumDWT_MouseShape { Default = 0, Hand = 1, Crosshair = 2, Zoom = 3 -}; +} /** * @class From 92f1eb1638b29c6cc3aad3f62e799ff9137a0403 Mon Sep 17 00:00:00 2001 From: yushulx Date: Tue, 2 May 2017 15:29:05 +0800 Subject: [PATCH 0006/1348] strip BOM --- types/dwt/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 8be78d4af4..9fb5cb65fd 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dwt 12.3.0 +// Type definitions for dwt 12.3.0 // Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx // Definitions by: Xiao Ling // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 6ed27bf03f461ac35acba7333f9e31f5f317d361 Mon Sep 17 00:00:00 2001 From: yushulx Date: Tue, 2 May 2017 15:41:58 +0800 Subject: [PATCH 0007/1348] Fixed type error. Added typescript version. --- types/dwt/dwt-tests.ts | 7 +------ types/dwt/index.d.ts | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 531e78e418..1c4bde2f06 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -15,15 +15,10 @@ function dwtOnReady() { function acquireImage() { let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { - var OnAcquireImageSuccess, OnAcquireImageFailure; - OnAcquireImageSuccess = OnAcquireImageFailure = function (){ - DWObject.CloseSource(); - }; - DWObject.SelectSourceByIndex(0); //Use method SelectSourceByIndex to avoid the 'Select Source' dialog DWObject.OpenSource(); DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan. - DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure); + DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource();}); } } diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 9fb5cb65fd..92095b1eae 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx // Definitions by: Xiao Ling // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /*! * Dynamsoft WebTwain JavaScript Intellisense From b87bce1967999f180b0c982495eef0077439672c Mon Sep 17 00:00:00 2001 From: yushulx Date: Wed, 3 May 2017 08:27:02 +0800 Subject: [PATCH 0008/1348] Added tslint.json --- types/dwt/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/dwt/tslint.json diff --git a/types/dwt/tslint.json b/types/dwt/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dwt/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e039b174b810aa99c062e684901d2981cbc23fef Mon Sep 17 00:00:00 2001 From: yushulx Date: Wed, 3 May 2017 11:02:16 +0800 Subject: [PATCH 0009/1348] Updated tslint.json --- types/dwt/dwt-tests.ts | 13 ++++++------- types/dwt/index.d.ts | 26 +++++--------------------- types/dwt/tslint.json | 10 +++++++++- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 1c4bde2f06..4b201cf33d 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -1,9 +1,8 @@ function dwtOnReady() { let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' if (DWObject) { - var count = DWObject.SourceCount; - if(count == 0) - { + let count = DWObject.SourceCount; + if (count === 0) { DWObject.CloseSourceManager(); DWObject.ImageCaptureDriverType = 0; DWObject.OpenSourceManager(); @@ -15,10 +14,10 @@ function dwtOnReady() { function acquireImage() { let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { - DWObject.SelectSourceByIndex(0); //Use method SelectSourceByIndex to avoid the 'Select Source' dialog + DWObject.SelectSourceByIndex(0); // Use method SelectSourceByIndex to avoid the 'Select Source' dialog DWObject.OpenSource(); - DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan. - DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource();}); + DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan. + DWObject.AcquireImage({}, () => {}, (errorCode: number, errorString: string) => {DWObject.CloseSource(); }); } } @@ -99,4 +98,4 @@ function downloadImage() { DWObject.HTTPPort = 80; DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {}); } -} \ No newline at end of file +} diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts index 92095b1eae..9198ba80bf 100644 --- a/types/dwt/index.d.ts +++ b/types/dwt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dwt 12.3.0 +// Type definitions for dwt 12.3 // Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx // Definitions by: Xiao Ling // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,12 +14,12 @@ * Version: 12.3 */ -/** +/** * @namespace Dynamsoft */ declare namespace Dynamsoft { namespace WebTwainEnv { - function GetWebTwain (cid: string) : WebTwain; + function GetWebTwain (cid: string): WebTwain; function RegisterEvent(event: string, fn: () => void): void; } } @@ -600,7 +600,7 @@ declare enum EnumDWT_TransferMode { /** Buffered Memory Mode Transfers. */ TWSX_MEMORY = 2, /** added 1.91 */ - //TWSX_MEMFILE = 4 + TWSX_MEMFILE = 4 } /** ICAP_IMAGEFILEFORMAT values. */ @@ -641,7 +641,6 @@ declare enum EnumDWT_FileFormat { TWFF_PDFA2 = 16 } - /** TIFF file compression type. */ declare enum EnumDWT_TIFFCompressionType { /** Auto mode. */ @@ -1041,7 +1040,6 @@ declare enum EnumDWT_CapSupportedSizes { TWSS_MAXSIZE = 54 } - /** CAP_FEEDERALIGNMENT values. */ declare enum EnumDWT_CapFeederAlignment { /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */ @@ -1257,7 +1255,6 @@ declare enum EnumDWT_MouseShape { */ // properties (get/set) / sync functions interface WebTwain { - /** * Returns or sets whether multi-page selection is supported. * @type {bool} @@ -2481,7 +2478,6 @@ interface WebTwain { */ HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean; - /** * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN. * @method WebTwain#HTTPUploadThroughPutDirectly @@ -2899,12 +2895,6 @@ interface WebTwain { SetCapItemsString(index: number, newVal: string): void; // --- SCAN end -- - - - - - - // --- View & Edit start -- /** @@ -3030,7 +3020,6 @@ interface WebTwain { */ GetSelectedImageIndex(sSelectedIndex: number): number; - /** * You can use the method to select images programatically which is ususally done by mouse clicking. * @method WebTwain#SetSelectedImageIndex @@ -3273,8 +3262,6 @@ interface WebTwain { Print(): boolean; // --- View & Edit end -- - - // --- Upload & Save end -- // --- Others --- @@ -3302,8 +3289,6 @@ interface WebTwain { */ EnableSource(): boolean; - - /** * Displays the source's built-in interface to acquire image. * @method WebTwain#AcquireImage @@ -3442,7 +3427,6 @@ interface WebTwain { */ SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean; - /** * Converts the images specified by the indices to base64. * @method WebTwain#ConvertToBase64 @@ -3472,4 +3456,4 @@ interface WebTwain { * @return {bool} */ SetHTTPHeader(key: string, value: string): boolean; -} \ No newline at end of file +} diff --git a/types/dwt/tslint.json b/types/dwt/tslint.json index 3db14f85ea..acce7c8a0b 100644 --- a/types/dwt/tslint.json +++ b/types/dwt/tslint.json @@ -1 +1,9 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": [false], + "no-trailing-whitespace": false, + "space-before-function-paren": false, + "only-arrow-functions": [false] + } +} From e3a835a4dc33c942eb5b01c52af8fc2d394435ed Mon Sep 17 00:00:00 2001 From: Flavio Torres Date: Tue, 26 Sep 2017 23:52:20 -0300 Subject: [PATCH 0010/1348] Parse.Relation.add and Parse.Relation.remove can accept a Array of Parse.Object --- types/parse/index.d.ts | 4 ++-- types/parse/parse-tests.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 82194e65a2..ee79e94955 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -280,13 +280,13 @@ declare namespace Parse { constructor(parent?: S, key?: string); //Adds a Parse.Object or an array of Parse.Objects to the relation. - add(object: T): void; + add(object: T | Array): void; // Returns a Parse.Query that is limited to objects in this relation. query(): Query; // Removes a Parse.Object or an array of Parse.Objects from this relation. - remove(object: T): void; + remove(object: T | Array): void; } /** diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 76440e46d3..eba5adc91b 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -227,7 +227,15 @@ function test_analytics() { } function test_relation() { + var game1 = new Game(); + var game2 = new Game(); + new Parse.User().relation("games").query().find().then((g: Game[]) => { }); + new Parse.User().relation("games").add(game1) + new Parse.User().relation("games").add([game1, game2]) + + new Parse.User().relation("games").remove(game1) + new Parse.User().relation("games").remove([game1, game2]) } function test_user_acl_roles() { From 60af25b105bdd2b1040366153a14d01502abea3a Mon Sep 17 00:00:00 2001 From: bobby77 Date: Tue, 26 Dec 2017 16:02:27 +0100 Subject: [PATCH 0011/1348] Update index.d.ts Changed error in "transform" and "inverseTransform" return type: Point instead of Matrix (L307) Changed error in clone parameters : object instead of boolean (L1358-1360) --- types/paper/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 64d961ed10..2c78fd6e6d 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -290,7 +290,7 @@ declare module paper { * Transforms a point and returns the result. * @param point - the point to be transformed */ - transform(point: Point): Matrix; + transform(point: Point): Point; /** * Transforms an array of coordinates by this matrix and stores the results into the destination array, which is also returned. @@ -304,7 +304,7 @@ declare module paper { * Inverse transforms a point and returns the result. * @param point - the point to be transformed */ - inverseTransform(point: Point): Matrix; + inverseTransform(point: Point): Point; /** * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. @@ -1353,9 +1353,11 @@ declare module paper { /** * Clones the item within the same project and places the copy above the item. - * @param insert [optional] - specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options [optional] - object with 2 parameters + * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * deep: specifies whether the item’s children should also be cloned — default: true */ - clone(insert?: boolean): Item; + clone(options?: any): Item; /** * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. From 0868ebcbccd557c22955e6568c00c82fad15734a Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 10:39:36 -0500 Subject: [PATCH 0012/1348] Update type to include OnDragStart OnDragEnter OnDrop --- types/rc-tree/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 8091b2edd5..793a10bd6f 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -149,6 +149,12 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; + /* + * On Drag Start Called + */ + onDragStart?: Function; + onDragEnter?: Function; + onDrop?: Function; } export default class Tree extends Component { } From d3a97d4d25dc243a44f45d3f0356b83cca50df43 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:00:58 -0500 Subject: [PATCH 0013/1348] Update onDrag types with Data Interfaces --- types/rc-tree/index.d.ts | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 793a10bd6f..4db24c2410 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,6 +58,24 @@ export interface SelectData { event: "select"; } +interface OnDragStartData { + event: Event, + node: TreeNode +} + +interface OnDragEnterData { + event: Event; + node: TreeNode; + expandedKeys: string[]; +} + +interface OnDropData { + event: Event; + node: TreeNode; + dragNode: TreeNode; + dragNodesKeys: string[]; +} + export interface TreeProps extends Props { /** * additional css class of root dom node @@ -149,12 +167,18 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; - /* - * On Drag Start Called + /** + * Event on Drag Start */ - onDragStart?: Function; - onDragEnter?: Function; - onDrop?: Function; + onDragStart?: (props: OnDragStartData) => void; + /** + * Event on Drag Enter + */ + onDragEnter?: (props: OnDragEnterData) => void; + /** + * Event on Drag Drop + */ + onDrop?: (props: OnDropData) => void; } export default class Tree extends Component { } From 82a4eba664eba92c8090deec3322399b9b8e246e Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:07:31 -0500 Subject: [PATCH 0014/1348] Fix comma interface to semicolon --- types/rc-tree/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 4db24c2410..df3db12c15 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -59,8 +59,8 @@ export interface SelectData { } interface OnDragStartData { - event: Event, - node: TreeNode + event: Event; + node: TreeNode; } interface OnDragEnterData { From 9a5a154ff88ff68bac20d27c19344a290fecd0ab Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:17:34 -0500 Subject: [PATCH 0015/1348] export onDrag interfaces --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index df3db12c15..103bd60adf 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,18 +58,18 @@ export interface SelectData { event: "select"; } -interface OnDragStartData { +export interface OnDragStartData { event: Event; node: TreeNode; } -interface OnDragEnterData { +export interface OnDragEnterData { event: Event; node: TreeNode; expandedKeys: string[]; } -interface OnDropData { +export interface OnDropData { event: Event; node: TreeNode; dragNode: TreeNode; From 448e451dc1a188d80dea97e21184d4c4d90bea47 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:26:02 -0500 Subject: [PATCH 0016/1348] align asteriks for onDrag properties --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 103bd60adf..a8e5780b97 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -169,15 +169,15 @@ export interface TreeProps extends Props { draggable?: boolean; /** * Event on Drag Start - */ + */ onDragStart?: (props: OnDragStartData) => void; /** * Event on Drag Enter - */ + */ onDragEnter?: (props: OnDragEnterData) => void; /** * Event on Drag Drop - */ + */ onDrop?: (props: OnDropData) => void; } From e100608648cb0e61cee3b059c737076fe5a794e4 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:34:21 -0500 Subject: [PATCH 0017/1348] lowercase letters --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index a8e5780b97..4dc789824d 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -168,15 +168,15 @@ export interface TreeProps extends Props { */ draggable?: boolean; /** - * Event on Drag Start + * event on drag start */ onDragStart?: (props: OnDragStartData) => void; /** - * Event on Drag Enter + * event on drag enter */ onDragEnter?: (props: OnDragEnterData) => void; /** - * Event on Drag Drop + * event on drag drop */ onDrop?: (props: OnDropData) => void; } From c3dd0698c4e817274466f89f90e781b25db6a6d2 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 15:45:17 -0500 Subject: [PATCH 0018/1348] add onDrag tests --- types/rc-tree/rc-tree-tests.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index c57866284f..290e3658cc 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; +import { TreeNode as TreeNodeInterface } from './index.d.ts'; interface Props { keys: string[]; @@ -43,6 +44,18 @@ export class Demo extends React.Component { onCheck(checkedKeys: string[], info: CheckData) { console.log('onCheck', checkedKeys, info); } + + onDragStart(params: {event: Event, node: TreeNodeInterface}) { + console.log('onDragStart', params.event, params.node); + } + + OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { + console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); + } + + OnDropData(params: {event: Event, node: TreeNode, dragNode: TreeNode, dragNodesKeys: string[]}) { + console.log('OnDropData', params.event, params.node, params.dragNode, params.dragNodesKeys); + } onEdit() { setTimeout(() => { @@ -73,6 +86,8 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} + onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} + OnDragEnterData={this.OnDragEnterData} > From 311b5961e8076626358650a17168cd624fe101a0 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 16:09:53 -0500 Subject: [PATCH 0019/1348] OnDropData in Tree Prop --- types/rc-tree/rc-tree-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index 290e3658cc..ff73beda86 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -87,7 +87,7 @@ export class Demo extends React.Component { defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} - OnDragEnterData={this.OnDragEnterData} + OnDropData={this.OnDropData} > From ac4424f5a3d88ec14293c7c94abb2b9c3491ac28 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 2 Jan 2018 23:28:50 -0800 Subject: [PATCH 0020/1348] Fix lint failures --- types/rc-tree/rc-tree-tests.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index ff73beda86..2d5f0426ed 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; -import { TreeNode as TreeNodeInterface } from './index.d.ts'; +import { TreeNode as TreeNodeInterface } from './index'; interface Props { keys: string[]; @@ -44,15 +44,15 @@ export class Demo extends React.Component { onCheck(checkedKeys: string[], info: CheckData) { console.log('onCheck', checkedKeys, info); } - + onDragStart(params: {event: Event, node: TreeNodeInterface}) { console.log('onDragStart', params.event, params.node); } - + OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); } - + OnDropData(params: {event: Event, node: TreeNode, dragNode: TreeNode, dragNodesKeys: string[]}) { console.log('OnDropData', params.event, params.node, params.dragNode, params.dragNodesKeys); } @@ -86,7 +86,7 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} - onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} + onDragStart={this.onDragStart} OnDragEnter={this.OnDragEnterData} OnDropData={this.OnDropData} > From 4e6d6e05532f82ea79e28e9c79ef0103b12866b8 Mon Sep 17 00:00:00 2001 From: Georg Kaspar Date: Wed, 3 Jan 2018 15:46:00 +0100 Subject: [PATCH 0021/1348] Added Control.Locate class Control.Locate class was added to type definitions in order to access functions in ts. --- types/leaflet.locatecontrol/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts index 35c88be5be..3ed9c7968a 100644 --- a/types/leaflet.locatecontrol/index.d.ts +++ b/types/leaflet.locatecontrol/index.d.ts @@ -8,6 +8,12 @@ import * as L from 'leaflet'; declare module 'leaflet' { namespace Control { + class Locate extends Control { + onAdd(map: Map): HTMLElement; + start(): void; + stop(): void; + setView():void; + } interface LocateOptions { position?: string; layer?: Layer; @@ -40,6 +46,6 @@ declare module 'leaflet' { /** * Creates a Leaflet.Locate control */ - function locate(options?: Control.LocateOptions): Control; + function locate(options?: Control.LocateOptions): Control.Locate; } } From 26d39cd9cf9cd16765f560cbe02b873ba5ba41a1 Mon Sep 17 00:00:00 2001 From: Flavio Torres Date: Tue, 9 Jan 2018 09:04:19 -0200 Subject: [PATCH 0022/1348] Parse.Object set and save methods can receive a object as parameter --- types/parse/index.d.ts | 8 +++++--- types/parse/parse-tests.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 8afefce1d5..0042e1d9e6 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -98,11 +98,11 @@ declare namespace Parse { reject(error: any): void; resolve(result: any): void; then(resolvedCallback: (...values: T[]) => IPromise, - rejectedCallback?: (reason: any) => IPromise): IPromise; + rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, - rejectedCallback?: (reason: any) => IPromise): IPromise; + rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, - rejectedCallback?: (reason: any) => U): IPromise; + rejectedCallback?: (reason: any) => U): IPromise; } interface Pointer { @@ -373,7 +373,9 @@ declare namespace Parse { remove(attr: string, item: any): any; save(attrs?: { [key: string]: any } | null, options?: Object.SaveOptions): Promise; save(key: string, value: any, options?: Object.SaveOptions): Promise; + save(attrs: object, options?: Object.SaveOptions): Promise; set(key: string, value: any, options?: Object.SetOptions): boolean; + set(attrs: object, options?: Object.SetOptions): boolean; setACL(acl: ACL, options?: SuccessFailureOptions): boolean; toPointer(): Pointer; unset(attr: string, options?: any): any; diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index dbfa82fa3f..2c122a295c 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -57,6 +57,12 @@ function test_object() { gameScore.set("cheatMode", false); + // Setting attrs using object + gameScore.set({ + level: '10', + difficult: 15 + }); + const score = gameScore.get("score"); const playerName = gameScore.get("playerName"); const cheatMode = gameScore.get("cheatMode"); @@ -274,6 +280,7 @@ function test_user_acl_roles() { game.setACL(new Parse.ACL(Parse.User.current())); game.save().then((game: Game) => { }); game.save(null, { useMasterKey: true }); + game.save({ score: '10' }, { useMasterKey: true }); const groupACL = new Parse.ACL(); @@ -366,7 +373,7 @@ function test_cloud_functions() { }); Parse.Cloud.beforeDelete('MyCustomClass', (request: Parse.Cloud.BeforeDeleteRequest, - response: Parse.Cloud.BeforeDeleteResponse) => { + response: Parse.Cloud.BeforeDeleteResponse) => { // result }); From 8656d6391434e77b76a5af0d8105922ca1029650 Mon Sep 17 00:00:00 2001 From: Flavio Torres Date: Tue, 9 Jan 2018 09:31:21 -0200 Subject: [PATCH 0023/1348] Parse.User signup method options fix --- types/parse/index.d.ts | 9 +++++++-- types/parse/parse-tests.ts | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 0042e1d9e6..1973c8938b 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -31,6 +31,11 @@ declare namespace Parse { interface SuccessFailureOptions extends SuccessOption, ErrorOption { } + interface SignUpOptions { + useMasterKey?: boolean; + installationId?: string; + } + interface SessionTokenOption { sessionToken?: string; } @@ -741,7 +746,7 @@ declare namespace Parse { class User extends Object { static current(): User | undefined; - static signUp(username: string, password: string, attrs: any, options?: SuccessFailureOptions): Promise; + static signUp(username: string, password: string, attrs: any, options?: SignUpOptions): Promise; static logIn(username: string, password: string, options?: SuccessFailureOptions): Promise; static logOut(): Promise; static allowCustomUserClass(isAllowed: boolean): void; @@ -749,7 +754,7 @@ declare namespace Parse { static requestPasswordReset(email: string, options?: SuccessFailureOptions): Promise; static extend(protoProps?: any, classProps?: any): any; - signUp(attrs: any, options?: SuccessFailureOptions): Promise; + signUp(attrs: any, options?: SignUpOptions): Promise; logIn(options?: SuccessFailureOptions): Promise; authenticated(): boolean; isCurrent(): boolean; diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 2c122a295c..87194ba02c 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -252,6 +252,14 @@ function test_relation() { new Parse.User().relation("games").remove([game1, game2]) } +function test_user() { + const user = new Parse.User(); + user.set("username", "my name"); + user.set("password", "my pass"); + user.set("email", "email@example.com"); + user.signUp(null, { useMasterKey: true }); +} + function test_user_acl_roles() { const user = new Parse.User(); From 07c172e5f6dec507f25824c2821f1ad2a81fbfc8 Mon Sep 17 00:00:00 2001 From: dominuskernel Date: Wed, 10 Jan 2018 11:51:11 +0100 Subject: [PATCH 0024/1348] fix style code error --- types/navigo/index.d.ts | 7 ++++--- types/navigo/navigo-tests.ts | 14 +++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index 660e44dad7..73131a9d72 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -2,9 +2,10 @@ // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -type Keys = string -type State = {[k in Keys]: any} +type Keys = string; +type State = {[k in Keys]: any}; type Params = State; interface NavigoHooks { @@ -46,7 +47,7 @@ declare class Navigo { resolve(currentURL?: string): boolean; link(path: string): string; - + lastRouteResolved(): {url: string, query: string}; disableIfAPINotAvailable(): void; diff --git a/types/navigo/navigo-tests.ts b/types/navigo/navigo-tests.ts index a59bf3cfab..1aeb645ce8 100644 --- a/types/navigo/navigo-tests.ts +++ b/types/navigo/navigo-tests.ts @@ -1,14 +1,22 @@ import Navigo = require("navigo"); +type Keys = string; +type State = {[k in Keys]: any}; +type Params = State; + const root = null; const useHash = false; let router = new Navigo(root, useHash); +const before = (done: (suppress?: boolean) => void, params: Params) => done(); + +const after = (params: Params) => params; + router.hooks({ - before: function(done, params) { //do something }, - after: function(params) { //do something } - }); + before, + after +}); router .on('/products/list', () => { From 9774da216ac3232d85878f50ad4fc232782feeca Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Wed, 10 Jan 2018 17:54:09 +0530 Subject: [PATCH 0025/1348] 15.4.20 added --- types/ej.web.all/ej.web.all-tests.ts | 231 +++-- types/ej.web.all/index.d.ts | 1195 +++++++++++++++++++++++--- 2 files changed, 1235 insertions(+), 191 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index 678754d5d4..5ab573f418 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,11 +1,4 @@ -interface Window { - kanbanData: any; - themeVarient: string; - themeStyle: string; - themeColor: string; -} - -module AccordionComponent { +module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { width: "100%", @@ -47,18 +40,20 @@ module AutocompleteComponent{ "Triumph Spitfire", "Toyota 2000GT", "Volvo P1800", "Volkswagen Shirako" ]; - $(function () { - var autocompleteInstance =new ej.Autocomplete($("#selectCar"), { + $(function () { + var autocompleteInstance =new ej.Autocomplete($("#selectCar"), { width: "100%", watermarkText: "Select a car", dataSource: carList, enableAutoFill: true, showPopupButton: true, multiSelectMode: "delimiter" - }); + }); }); } + + module Barcodecomponent { $(function () { var barcodesample = new ej.datavisualization.Barcode($("#Barcode"), { @@ -67,13 +62,13 @@ module Barcodecomponent { }); } + module Bulletgraphcomponent { $(function () { var bulletsample = new ej.datavisualization.BulletGraph($("#BulletGraph"), { isResponsive: true, load: function () { var sender = $("#BulletGraph").data("ejBulletGraph"); - var theme: string; var bulletTheme = window.themeStyle + window.themeColor + window.themeVarient; if (bulletTheme) { switch (bulletTheme) { @@ -127,6 +122,7 @@ module Bulletgraphcomponent { }); } + module ButtonComponent { $(function () { var basicButton = new ej.Button($("#buttonnormal"), { @@ -173,7 +169,6 @@ module ButtonComponent { } module ChartComponent { - var theme = "???"; $(function () { var chartsample = new ej.datavisualization.Chart($("#Chart"), { primaryXAxis: { @@ -185,7 +180,7 @@ module ChartComponent { range: { min: 25, max: 50, interval: 5 }, labelFormat: "{value}%", title: { text: "Efficiency" }, - + }, commonSeriesOptions: { @@ -200,28 +195,28 @@ module ChartComponent { }, visible: true }, - border : {width: 2} - }, - series: + border : {width: 2} + }, + series: [ { - points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },{ x: 2007, y: 26 }, { x: 2008, y: 27 }, - { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], + points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },{ x: 2007, y: 26 }, { x: 2008, y: 27 }, + { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], name: 'India' - }, + }, { - points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },{ x: 2007, y: 30 }, { x: 2008, y: 36 }, - { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], + points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },{ x: 2007, y: 30 }, { x: 2008, y: 36 }, + { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], name: 'Germany' }, { - points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 },{ x: 2007, y: 34 }, { x: 2008, y: 41 }, - { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], + points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 },{ x: 2007, y: 34 }, { x: 2008, y: 41 }, + { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], name: 'England' - }, + }, { - points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 },{ x: 2007, y: 40 }, { x: 2008, y: 44 }, - { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], + points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 },{ x: 2007, y: 40 }, { x: 2008, y: 44 }, + { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], name: 'France' } ], @@ -251,6 +246,7 @@ module ChartComponent { model.primaryYAxis.labelIntersectAction = "rotate45"; model.primaryYAxis.edgeLabelPlacement = "hide"; } + var theme = window.themeStyle + window.themeColor + window.themeVarient; if (theme) { switch (theme) { case "flatdark": @@ -287,12 +283,13 @@ module ChartComponent { theme = "flatlight"; break; } - sender.model.theme = theme; + sender.model.theme = theme; } }, title: { text: 'Efficiency of oil-fired power production' }, size: { height: "600" }, - legend: { visible: true} + legend: { visible: true}, + load:"loadTheme" }); }); } @@ -343,7 +340,7 @@ module circulargaugecomponent { backgroundColor: "#f5b43f", border: { color: "#f5b43f" } }] - }] + }] }); }); } @@ -356,6 +353,24 @@ module ColorPickerComponent { }); } +module ComboBoxComponent{ + var BikeList = [ + { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, + { empid: "bk4", text: "Discover" }, { empid: "bk5", text: "Dazzler" }, { empid: "bk6", text: "Flame" }, + { empid: "bk7", text: "Fazzer" }, { empid: "bk8", text: "FZ-S" }, { empid: "bk9", text: "Pulsar" }, + { empid: "bk10", text: "Shine" }, { empid: "bk11", text: "R15" }, { empid: "bk12", text: "Unicorn" } + ]; + $(function () { + var comboboxInstance =new ej.ComboBox($("#selectCar"), { + width: "100%", + placeholder: "Select a Bike", + fields: { text: "text", value: "empid" }, + dataSource: BikeList, + autofill: true + }); + }); +} + module DatePickerComponent { $(function () { var dateSample = new ej.DatePicker($("#datepick"), { @@ -427,7 +442,7 @@ $(function () { createConnector({ name: "connector6", sourceNode: "Project", targetNode: "Resources", labels: [createLabel({ "text": "No" })] }) ] }); - + }); function createNode(option: ej.datavisualization.Diagram.Node) { @@ -474,6 +489,7 @@ module DialogComponent { }); } + module digitalgaugecomponent { $(function () { var digitalgaugesample = new ej.datavisualization.DigitalGauge($("#DigitalGauge"), { @@ -497,6 +513,7 @@ module digitalgaugecomponent { } + module DropDownListComponent { var BikeList = [ { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, @@ -513,12 +530,12 @@ module DropDownListComponent { enableFilterSearch: true, caseSensitiveSearch: true, enableIncrementalSearch: true, - enablePopupResize: true, + enablePopupResize: true, delimiterChar: ";", multiSelectMode: ej.MultiSelectMode.Delimiter, maxPopupHeight: "300px", - minPopupHeight: "150px", - maxPopupWidth: "500px", + minPopupHeight: "150px", + maxPopupWidth: "500px", minPopupWidth: "350px", showCheckbox: true, showRoundedCorner: true @@ -528,6 +545,7 @@ module DropDownListComponent { } + module ExplorerComponent { $(function () { var file = new ej.FileExplorer($("#fileExplorer"), { @@ -541,13 +559,14 @@ module ExplorerComponent { }); } + module GanttComponent { $(function () { var ganttInstance = new ej.Gantt($("#GanttContainer"), { dataSource: (window).projectData, allowColumnResize: true, allowSorting: true, - allowSelection: true, + allowSelection: true, enableContextMenu: true, taskIdMapping: "taskID", allowDragAndDrop: true, @@ -588,7 +607,7 @@ module GanttComponent { treeColumnIndex: 1, isResponsive: true, }); -}); +}); } module GridComponent { @@ -626,7 +645,7 @@ module GridComponent { }); } -var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fl�temysost"] +var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fløtemysost"] var itemSource: any[] = []; for (var i = 0; i < columns.length; i++) { for (var j = 0; j < 6; j++) { @@ -671,6 +690,10 @@ $(function () { }); }); +declare var window:myWindow; +export interface myWindow extends Window{ +kanbanData:any; +} module KanbanComponent { $(function () { var sample = new ej.Kanban($("#Kanban"), { @@ -693,6 +716,7 @@ module KanbanComponent { }); } + module lineargaugecomponent { $(function () { var linearsample = new ej.datavisualization.LinearGauge($("#LinearGauge"), { @@ -716,11 +740,12 @@ module lineargaugecomponent { backgroundColor: "#E94649", border: { color: "#E94649" }, startWidth: 4, endWidth: 4 }] - }] + }] }); }); } + module ListBoxComponent { $(function () { var listboxInstance = new ej.ListBox($("#selectcar"), { @@ -732,7 +757,7 @@ module ListBoxComponent { module ListviewComponent { $(function () { var listviewInstance = new ej.ListView($("#defaultlistview"), { - enableCheckMark: true, + enableCheckMark: true, width: 400 }); }); @@ -773,7 +798,7 @@ var world_map= { "type": "Feature", "properties": { "admin": "Switzerland", "name": "Switzerland", "continent": "Europe" }, "geometry": { "type": "Polygon", "coordinates": [[[9.594226108446346, 47.525058091820256], [9.632931756232974, 47.347601223329974], [9.479969516649019, 47.102809963563367], [9.932448357796657, 46.920728054382948], [10.442701450246627, 46.893546250997424], [10.36337812667861, 46.483571275409851], [9.922836541390378, 46.314899400409182], [9.182881707403054, 46.440214748716976], [8.966305779667804, 46.036931871111186], [8.489952426801322, 46.005150865251672], [8.316629672894377, 46.163642483090847], [7.755992058959832, 45.824490057959302], [7.273850945676655, 45.776947740250769], [6.843592970414504, 45.991146552100595], [6.500099724970424, 46.429672756529428], [6.022609490593537, 46.272989813820466], [6.037388950229, 46.725778713561859], [6.768713820023605, 47.287708238303686], [6.736571079138058, 47.541801255882838], [7.192202182655505, 47.449765529971003], [7.466759067422228, 47.620581976911794], [8.31730146651415, 47.613579820336255], [8.522611932009765, 47.830827541691285], [9.594226108446346, 47.525058091820256]]] } }, { "type": "Feature", "properties": { "admin": "Chile", "name": "Chile", "continent": "South America" }, "geometry": { "type": "MultiPolygon", "coordinates": [[[[-68.634010227583147, -52.636370458874353], [-68.633349999999879, -54.8695], [-67.56244, -54.87001], [-66.95992, -54.89681], [-67.291029999999878, -55.30124], [-68.148629999999841, -55.61183], [-68.639990810811796, -55.580017999086877], [-69.2321, -55.49906], [-69.95809, -55.19843], [-71.00568, -55.05383], [-72.2639, -54.49514], [-73.2852, -53.957519999999874], [-74.66253, -52.83749], [-73.8381, -53.04743], [-72.43418, -53.7154], [-71.10773, -54.07433], [-70.591779999999787, -53.61583], [-70.26748, -52.93123], [-69.345649999999878, -52.5183], [-68.634010227583147, -52.636370458874353]]], [[[-68.219913092711224, -21.49434661223183], [-67.828179897722634, -22.872918796482178], [-67.106673550063604, -22.735924574476392], [-66.985233934177629, -22.986348565362825], [-67.328442959244128, -24.025303236590908], [-68.417652960876111, -24.518554782816874], [-68.386001146097342, -26.185016371365229], [-68.594799770772667, -26.50690886811126], [-68.295541551370391, -26.899339694935787], [-69.001234910748266, -27.521213881136127], [-69.656130337183143, -28.459141127233686], [-70.013550381129861, -29.367922865518544], [-69.919008348251921, -30.336339206668306], [-70.535068935819439, -31.365010267870279], [-70.074399380153622, -33.09120981214803], [-69.814776984319209, -33.273886000299839], [-69.817309129501453, -34.193571465798279], [-70.388049485949082, -35.169687595359441], [-70.364769253201658, -36.005088799789931], [-71.121880662709771, -36.65812387466233], [-71.118625047475419, -37.576827487947192], [-70.814664272734703, -38.552995293940732], [-71.413516608349042, -38.916022230791107], [-71.680761277946445, -39.808164157878061], [-71.915734015577542, -40.832339369470716], [-71.746803758415453, -42.051386407235988], [-72.148898078078517, -42.254888197601375], [-71.915423956983901, -43.408564548517404], [-71.464056159130493, -43.787611179378324], [-71.793622606071935, -44.207172133156099], [-71.329800788036195, -44.407521661151677], [-71.222778896759721, -44.784242852559409], [-71.659315558545316, -44.973688653341434], [-71.552009446891233, -45.560732924177117], [-71.917258470330196, -46.884838148791786], [-72.44735531278026, -47.738532810253517], [-72.331160854771937, -48.244238376661819], [-72.648247443314929, -48.878618259476774], [-73.415435757120022, -49.318436374712952], [-73.328050910114456, -50.378785088909865], [-72.975746832964617, -50.741450290734299], [-72.309973517532342, -50.677009779666342], [-72.329403856074023, -51.425956312872394], [-71.914803839796321, -52.009022305865912], [-69.498362189396076, -52.142760912637236], [-68.571545376241332, -52.299443855346247], [-69.461284349226617, -52.291950772663924], [-69.94277950710611, -52.537930590373243], [-70.8451016913545, -52.899200528525711], [-71.006332160105217, -53.833252042201345], [-71.429794684520928, -53.856454760300373], [-72.557942877884855, -53.531410001184447], [-73.702756720662862, -52.835069268607249], [-73.702756720662862, -52.835070076051487], [-74.946763475225154, -52.262753588419017], [-75.260026007778507, -51.62935475037321], [-74.976632453089806, -51.043395684615675], [-75.47975419788348, -50.378371677451547], [-75.608015102831942, -48.673772881871784], [-75.182769741502128, -47.711919447623153], [-74.126580980104677, -46.939253431995084], [-75.644395311165439, -46.647643324572016], [-74.69215369332305, -45.76397633238097], [-74.351709357384252, -44.10304412208788], [-73.240356004515192, -44.454960625995611], [-72.717803921179765, -42.383355808278985], [-73.388899909138232, -42.117532240569567], [-73.701335618774834, -43.365776462579738], [-74.33194312203257, -43.224958184584395], [-74.017957119427152, -41.794812920906828], [-73.677099372029943, -39.942212823243111], [-73.217592536090663, -39.258688653318508], [-73.505559455037044, -38.282882582351064], [-73.588060879191076, -37.156284681956016], [-73.166717088499283, -37.123780206044351], [-72.553136969681717, -35.508840020491022], [-71.861732143832555, -33.909092706031522], [-71.438450486929895, -32.418899428030819], [-71.668720669222424, -30.920644626592516], [-71.370082567007714, -30.095682061484997], [-71.48989437527645, -28.861442152625909], [-70.905123867461569, -27.640379734001193], [-70.724953986275963, -25.705924167587209], [-70.403965827095035, -23.628996677344542], [-70.091245897080668, -21.393319187101223], [-70.164419725205974, -19.756468194256183], [-70.372572394477714, -18.347975355708879], [-69.858443569605797, -18.092693780187027], [-69.590423753523979, -17.580011895419286], [-69.100246955019401, -18.260125420812653], [-68.966818406841824, -18.981683444904089], [-68.442225104430918, -19.405068454671419], [-68.757167121033703, -20.37265797290447], [-68.219913092711224, -21.49434661223183]]]] } }, { "type": "Feature", "properties": { "admin": "China", "name": "China", "continent": "Asia" }, "geometry": { "type": "MultiPolygon", "coordinates": [[[[110.339187860151526, 18.678395087147603], [109.475209588663702, 18.19770091396861], [108.655207961056135, 18.507681993071397], [108.626217482540426, 19.367887885001974], [109.119055617308007, 19.821038519769385], [110.211598748822837, 20.101253973872073], [110.786550734502228, 20.077534491450077], [111.01005130416462, 19.695929877190732], [110.570646600386794, 19.255879218009305], [110.339187860151526, 18.678395087147603]]], [[[127.657407261262378, 49.760270494172929], [129.397817824420429, 49.440600084015429], [130.58229332898236, 48.729687404976112], [130.987281528853828, 47.790132351261391], [132.506671991099495, 47.788969631534876], [133.373595819228001, 48.183441677434914], [135.026311476786702, 48.478229885443902], [134.500813836810607, 47.578439846377833], [134.112362095272601, 47.212467352886719], [133.76964399631288, 46.116926988299056], [133.097126906466428, 45.14406647397216], [131.883454217659562, 45.32116160743643], [131.025212030156069, 44.967953192721573], [131.288555129115537, 44.111519680348252], [131.144687941614848, 42.929989732426932], [130.633866408409801, 42.903014634770543], [130.640015903852429, 42.39500946712527], [129.994267205933227, 42.985386867843793], [129.596668735879462, 42.424981797854592], [128.05221520397231, 41.994284572917984], [128.208433058790717, 41.466771552082534], [127.343782993683021, 41.503151760415953], [126.869083286649854, 41.816569322266155], [126.18204511932943, 41.107336127276362], [125.079941847840587, 40.569823716792449], [124.265624627785314, 39.928493353834135], [122.86757042856101, 39.637787583976255], [122.131387974130917, 39.170451768544623], [121.054554478032856, 38.89747101496291], [121.585994907722466, 39.360853583324136], [121.376757033372641, 39.750261338859524], [122.168595005381007, 40.422442531896046], [121.640358514493528, 40.946389878903304], [120.768628778161954, 40.593388169917596], [119.639602085449056, 39.898055935214209], [119.023463983233015, 39.252333075511096], [118.042748651197897, 39.204273993479674], [117.532702264477052, 38.73763580988409], [118.05969852098967, 38.061475531561051], [118.878149855628351, 37.897325344385898], [118.911636183753501, 37.448463853498723], [119.702802362142037, 37.156388658185072], [120.823457472823648, 37.870427761377968], [121.711258579597938, 37.481123358707165], [122.357937453298462, 37.454484157860684], [122.519994744965814, 36.930614325501828], [121.104163853033029, 36.651329047180432], [120.63700890511457, 36.111439520811125], [119.66456180224607, 35.609790554337728], [119.151208123858567, 34.909859117160458], [120.227524855633717, 34.360331936168613], [120.620369093916565, 33.37672272392512], [121.229014113450219, 32.460318711877186], [121.908145786630044, 31.692174384074683], [121.891919386890336, 30.949351508095098], [121.264257440273298, 30.676267401648712], [121.503519321784722, 30.14291494396425], [122.092113885589086, 29.832520453403156], [121.93842817595305, 29.018022365834803], [121.684438511238469, 28.225512600206677], [121.125661248866436, 28.135673122667178], [120.395473260582307, 27.053206895449385], [119.585496860839555, 25.740780544532605], [118.656871372554519, 24.547390855400234], [117.281606479970833, 23.624501451099714], [115.890735304835118, 22.782873236578094], [114.763827345846209, 22.668074042241663], [114.152546828265656, 22.223760077396204], [113.806779819800752, 22.548339748621423], [113.241077915501592, 22.051367499270462], [111.843592157032447, 21.550493679281512], [110.78546552942413, 21.39714386645533], [110.444039341271662, 20.34103261970639], [109.88986128137357, 20.282457383703441], [109.627655063924635, 21.008227037026725], [109.864488153118316, 21.395050970947516], [108.522812941524421, 21.715212307211821], [108.050180291782979, 21.552379869060101], [107.043420037872636, 21.8118989120299], [106.567273390735352, 22.21820486092474], [106.725403273548466, 22.794267889898375], [105.811247186305209, 22.976892401617899], [105.329209425886631, 23.352063300056976], [104.476858351664475, 22.819150092046918], [103.504514601660503, 22.703756618739217], [102.706992222100155, 22.708795070887696], [102.170435825613552, 22.464753119389336], [101.652017856861576, 22.318198757409554], [101.803119744882906, 21.174366766845051], [101.27002566936001, 21.201651923095167], [101.180005324307558, 21.436572984294052], [101.150032993578236, 21.849984442629015], [100.416537713627349, 21.558839423096654], [99.983489211021549, 21.742936713136451], [99.240898878987196, 22.118314317304559], [99.53199222208741, 22.949038804612591], [98.898749220782804, 23.142722072842581], [98.66026248575578, 24.063286037690002], [97.604719679762027, 23.897404690033049], [97.724609002679131, 25.083637193293036], [98.671838006589212, 25.91870250091349], [98.712093947344556, 26.743535874940243], [98.682690057370507, 27.508812160750658], [98.246230910233351, 27.747221381129172], [97.91198774616943, 28.335945136014367], [97.327113885490007, 28.261582749946339], [96.248833449287829, 28.411030992134467], [96.586590610747521, 28.830979519154361], [96.117678664131006, 29.452802028922513], [95.404802280664626, 29.031716620392157], [94.565990431702929, 29.27743805593996], [93.413347609432662, 28.640629380807233], [92.503118931043616, 27.896876329046442], [91.696656528696693, 27.771741848251615], [91.258853794319876, 28.040614325466343], [90.730513950567797, 28.064953925075738], [90.015828891971182, 28.296438503527177], [89.475810174521158, 28.042758897406365], [88.814248488320573, 27.299315904239389], [88.730325962278528, 28.086864732367552], [88.120440708369941, 27.876541652939572], [86.954517043000635, 27.974261786403524], [85.823319940131526, 28.203575954698742], [85.011638218123053, 28.642773952747369], [84.23457970575015, 28.839893703724691], [83.89899295444674, 29.320226141877633], [83.337115106137176, 29.463731594352193], [82.327512648450877, 30.115268052688204], [81.525804477874786, 30.422716986608659], [81.111256138029276, 30.183480943313402], [79.721366815107118, 30.882714748654728], [78.738894484374001, 31.515906073527045], [78.458446486326025, 32.61816437431272], [79.176128777995544, 32.483779812137747], [79.208891636068543, 32.994394639613738], [78.811086460285722, 33.506198025032397], [78.912268914713209, 34.321936346975768], [77.83745079947461, 35.494009507787794], [76.192848341785705, 35.89840342868785], [75.896897414050173, 36.666806138651872], [75.158027785140987, 37.133030910789152], [74.980002475895404, 37.419990139305888], [74.829985792952144, 37.990007025701445], [74.864815708316783, 38.378846340481587], [74.25751427602269, 38.606506862943476], [73.928852166646394, 38.505815334622717], [73.675379266254836, 39.431236884105566], [73.960013055318427, 39.660008449861714], [73.822243686828315, 39.893973497063136], [74.776862420556043, 40.366425279291619], [75.467827996730719, 40.56207225194867], [76.526368035797432, 40.427946071935132], [76.90448449087711, 41.066485907549648], [78.187196893226044, 41.185315863604799], [78.543660923175253, 41.582242540038713], [80.119430373051401, 42.12394074153822], [80.259990268885318, 42.34999929459908], [80.180150180994374, 42.920067857426844], [80.866206496101213, 43.180362046881008], [79.966106398441426, 44.917516994804622], [81.947070753918084, 45.317027492853143], [82.458925815769035, 45.539649563166499], [83.180483839860543, 47.330031236350735], [85.164290399113213, 47.000955715516099], [85.720483839870667, 47.452969468773077], [85.76823286330837, 48.455750637396896], [86.59877648310335, 48.549181626980605], [87.359970330762692, 49.214980780629148], [87.751264276076668, 49.297197984405464], [88.013832228551678, 48.599462795600594], [88.854297723346747, 48.069081732773007], [90.280825636763893, 47.693549099307901], [90.970809360724957, 46.88814606382293], [90.585768263718307, 45.719716091487491], [90.945539585334316, 45.286073309910243], [92.133890822318222, 45.115075995456429], [93.480733677141316, 44.97547211362], [94.688928664125356, 44.352331854828456], [95.306875441471504, 44.241330878265458], [95.762454868556688, 43.319449164394619], [96.349395786527808, 42.725635280928643], [97.451757440177971, 42.74888967546007], [99.515817498779995, 42.524691473961688], [100.845865513108279, 42.663804429691417], [101.833040399179936, 42.51487295182627], [103.312278273534787, 41.907468166667613], [104.522281935649005, 41.90834666601662], [104.964993931093431, 41.597409572916334], [106.129315627061658, 42.134327704428891], [107.744772576937976, 42.481515814781908], [109.243595819131428, 42.519446316084149], [110.412103306115299, 42.871233628911014], [111.129682244920218, 43.406834011400171], [111.82958784388137, 43.743118394539486], [111.667737257943202, 44.073175767587706], [111.348376906379428, 44.457441718110047], [111.87330610560025, 45.102079372735112], [112.436062453258842, 45.01164561622425], [113.463906691544196, 44.808893134127111], [114.46033165899604, 45.339816799493875], [115.985096470200133, 45.727235012386004], [116.717868280098855, 46.38820241961524], [117.421701287914246, 46.67273285581421], [118.874325799638711, 46.805412095723646], [119.663269891438745, 46.692679958678944], [119.772823927897562, 47.048058783550132], [118.866574334794947, 47.747060044946195], [118.064142694166719, 48.06673045510373], [117.295507440257438, 47.697709052107385], [116.308952671373234, 47.853410142602812], [115.742837355615734, 47.726544501326273], [115.485282017073018, 48.135382595403442], [116.191802199367601, 49.134598090199056], [116.67880089728618, 49.888531399121398], [117.879244419426371, 49.510983384796944], [119.288460728025839, 50.142882798862033], [119.279365675942358, 50.582907619827282], [120.182049595216924, 51.64356639261802], [120.738191359541972, 51.964115302124547], [120.725789015791975, 52.516226304730814], [120.177088657716865, 52.753886216841195], [121.003084751470226, 53.251401068731226], [122.245747918792858, 53.431725979213681], [123.571506789240843, 53.458804429734627], [125.068211297710434, 53.161044826868832], [125.946348911646169, 52.792798570356936], [126.564399041856959, 51.784255479532689], [126.939156528837657, 51.353894151405896], [127.287455682484904, 50.739797268265434], [127.657407261262378, 49.760270494172929]]]] } }, - { "type": "Feature", "properties": { "admin": "Ivory Coast", "name": "C�te d'Ivoire", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[-2.856125047202397, 4.994475816259508], [-3.311084357100071, 4.984295559098014], [-4.008819545904941, 5.179813340674314], [-4.64991736491791, 5.168263658057084], [-5.834496222344525, 4.993700669775135], [-6.528769090185845, 4.705087795425015], [-7.518941209330434, 4.338288479017307], [-7.712159389669749, 4.364565944837721], [-7.63536821128403, 5.188159084489455], [-7.53971513511176, 5.313345241716517], [-7.570152553731686, 5.707352199725903], [-7.993692592795879, 6.126189683451541], [-8.311347622094017, 6.193033148621081], [-8.602880214868618, 6.467564195171659], [-8.385451626000572, 6.911800645368742], [-8.485445522485348, 7.395207831243068], [-8.439298468448696, 7.686042792181736], [-8.280703497744936, 7.687179673692156], [-8.221792364932197, 8.123328762235571], [-8.299048631208562, 8.316443589710302], [-8.203498907900878, 8.455453192575446], [-7.832100389019186, 8.575704250518625], [-8.079113735374348, 9.376223863152033], [-8.309616461612249, 9.789531968622439], [-8.22933712404682, 10.129020290563897], [-8.029943610048617, 10.206534939001711], [-7.89958980959237, 10.297382106970824], [-7.622759161804808, 10.147236232946792], [-6.850506557635057, 10.138993841996237], [-6.666460944027547, 10.430810655148447], [-6.493965013037267, 10.411302801958268], [-6.205222947606429, 10.524060777219132], [-6.050452032892266, 10.096360785355442], [-5.816926235365286, 10.222554633012191], [-5.404341599946973, 10.370736802609144], [-4.954653286143098, 10.152713934769732], [-4.779883592131966, 9.821984768101741], [-4.330246954760383, 9.610834865757139], [-3.980449184576684, 9.862344061721698], [-3.511898972986272, 9.900326239456216], [-2.827496303712706, 9.642460842319775], [-2.56218950032624, 8.219627793811481], [-2.983584967450326, 7.379704901555511], [-3.244370083011261, 6.2504715031135], [-2.810701463217839, 5.389051215024109], [-2.856125047202397, 4.994475816259508]]] } }, + { "type": "Feature", "properties": { "admin": "Ivory Coast", "name": "Côte d'Ivoire", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[-2.856125047202397, 4.994475816259508], [-3.311084357100071, 4.984295559098014], [-4.008819545904941, 5.179813340674314], [-4.64991736491791, 5.168263658057084], [-5.834496222344525, 4.993700669775135], [-6.528769090185845, 4.705087795425015], [-7.518941209330434, 4.338288479017307], [-7.712159389669749, 4.364565944837721], [-7.63536821128403, 5.188159084489455], [-7.53971513511176, 5.313345241716517], [-7.570152553731686, 5.707352199725903], [-7.993692592795879, 6.126189683451541], [-8.311347622094017, 6.193033148621081], [-8.602880214868618, 6.467564195171659], [-8.385451626000572, 6.911800645368742], [-8.485445522485348, 7.395207831243068], [-8.439298468448696, 7.686042792181736], [-8.280703497744936, 7.687179673692156], [-8.221792364932197, 8.123328762235571], [-8.299048631208562, 8.316443589710302], [-8.203498907900878, 8.455453192575446], [-7.832100389019186, 8.575704250518625], [-8.079113735374348, 9.376223863152033], [-8.309616461612249, 9.789531968622439], [-8.22933712404682, 10.129020290563897], [-8.029943610048617, 10.206534939001711], [-7.89958980959237, 10.297382106970824], [-7.622759161804808, 10.147236232946792], [-6.850506557635057, 10.138993841996237], [-6.666460944027547, 10.430810655148447], [-6.493965013037267, 10.411302801958268], [-6.205222947606429, 10.524060777219132], [-6.050452032892266, 10.096360785355442], [-5.816926235365286, 10.222554633012191], [-5.404341599946973, 10.370736802609144], [-4.954653286143098, 10.152713934769732], [-4.779883592131966, 9.821984768101741], [-4.330246954760383, 9.610834865757139], [-3.980449184576684, 9.862344061721698], [-3.511898972986272, 9.900326239456216], [-2.827496303712706, 9.642460842319775], [-2.56218950032624, 8.219627793811481], [-2.983584967450326, 7.379704901555511], [-3.244370083011261, 6.2504715031135], [-2.810701463217839, 5.389051215024109], [-2.856125047202397, 4.994475816259508]]] } }, { "type": "Feature", "properties": { "admin": "Cameroon", "name": "Cameroon", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[13.07582238124675, 2.267097072759014], [12.951333855855605, 2.321615708826939], [12.359380323952218, 2.19281220133945], [11.751665480199787, 2.326757513839993], [11.276449008843711, 2.261050930180871], [9.649158155972627, 2.283866075037735], [9.795195753629455, 3.073404445809117], [9.404366896205998, 3.734526882335202], [8.948115675501068, 3.904128933117135], [8.744923943729416, 4.352215277519959], [8.488815545290889, 4.495617377129917], [8.500287713259693, 4.771982937026847], [8.757532993208626, 5.47966583904791], [9.233162876023043, 6.444490668153334], [9.522705926154398, 6.453482367372116], [10.118276808318255, 7.038769639509879], [10.497375115611417, 7.055357774275562], [11.058787876030349, 6.644426784690593], [11.745774366918509, 6.981382961449753], [11.839308709366801, 7.397042344589434], [12.063946160539556, 7.799808457872301], [12.218872104550597, 8.305824082874322], [12.753671502339214, 8.717762762888993], [12.955467970438971, 9.417771714714702], [13.1675997249971, 9.64062632897341], [13.308676385153914, 10.160362046748926], [13.572949659894558, 10.798565985553564], [14.415378859116682, 11.572368882692071], [14.468192172918974, 11.90475169519341], [14.57717776862253, 12.085360826053501], [14.181336297266792, 12.483656927943112], [14.213530714584634, 12.802035427293344], [14.495787387762842, 12.859396267137326], [14.893385857816522, 12.219047756392582], [14.960151808337598, 11.555574042197222], [14.923564894274955, 10.891325181517471], [15.467872755605269, 9.982336737503429], [14.909353875394713, 9.99212942142273], [14.627200555081057, 9.920919297724536], [14.171466098699025, 10.021378282099928], [13.954218377344002, 9.549494940626685], [14.544466586981766, 8.965861314322266], [14.979995558337688, 8.796104234243471], [15.120865512765331, 8.382150173369423], [15.436091749745765, 7.692812404811971], [15.279460483469107, 7.421924546737968], [14.776545444404572, 6.408498033062044], [14.536560092841111, 6.22695872642069], [14.459407179429345, 5.451760565610299], [14.558935988023501, 5.03059764243153], [14.478372430080466, 4.732605495620446], [14.950953403389658, 4.21038930909492], [15.036219516671249, 3.851367295747123], [15.405395948964379, 3.335300604664339], [15.862732374747479, 3.013537298998982], [15.907380812247649, 2.557389431158612], [16.01285241055535, 2.267639675298084], [15.940918816805061, 1.727672634280295], [15.14634199388524, 1.964014797367184], [14.337812534246577, 2.22787466064949], [13.07582238124675, 2.267097072759014]]] } }, { "type": "Feature", "properties": { "admin": "Democratic Republic of the Congo", "name": "Dem. Rep. Congo", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[30.833859897593801, 3.50916596111034], [30.773346795380036, 2.339883327642127], [31.174149204235807, 2.204465236821263], [30.852670118948048, 1.849396470543809], [30.468507521290292, 1.58380544677972], [30.086153598762703, 1.062312730306288], [29.875778842902488, 0.597379868976304], [29.819503208136634, -0.205310153813372], [29.587837762172164, -0.58740569417948], [29.579466180140876, -1.341313164885626], [29.29188683443661, -1.620055840667987], [29.254834832483336, -2.215109958508911], [29.117478875451546, -2.292211195488384], [29.02492638521678, -2.839257907730157], [29.276383904749046, -3.293907159034063], [29.339997592900342, -4.499983412294092], [29.519986606572925, -5.419978936386313], [29.41999271008816, -5.939998874539432], [29.620032179490003, -6.520015150583424], [30.199996779101692, -7.079980970898161], [30.740015496551781, -8.340007419470913], [30.34608605319081, -8.238256524288216], [29.002912225060467, -8.40703175215347], [28.734866570762495, -8.526559340044576], [28.449871046672818, -9.164918308146083], [28.673681674928922, -9.605924981324931], [28.496069777141763, -10.789883721564044], [28.372253045370421, -11.793646742401389], [28.642417433392346, -11.971568698782312], [29.341547885869087, -12.36074391037241], [29.616001417771223, -12.178894545137307], [29.699613885219485, -13.257226657771827], [28.934285922976834, -13.248958428605132], [28.52356163912102, -12.698604424696679], [28.15510867687998, -12.272480564017894], [27.38879886242378, -12.132747491100663], [27.164419793412456, -11.608748467661071], [26.55308759939961, -11.924439792532125], [25.752309604604726, -11.784965101776356], [25.418118116973197, -11.330935967659958], [24.783169793402948, -11.238693536018962], [24.314516228947948, -11.262826429899269], [24.257155389103982, -10.951992689663655], [23.912215203555714, -10.926826267137512], [23.456790805767433, -10.867863457892481], [22.837345411884733, -11.017621758674329], [22.402798292742371, -10.99307545333569], [22.155268182064304, -11.084801120653768], [22.208753289486388, -9.894796237836507], [21.87518191904234, -9.523707777548564], [21.801801385187897, -8.908706556842978], [21.949130893652036, -8.305900974158275], [21.746455926203303, -7.920084730667147], [21.728110792739695, -7.2908724910813], [20.514748162526498, -7.299605808138629], [20.601822950938292, -6.93931772219968], [20.091621534920645, -6.943090101756993], [20.037723016040214, -7.116361179231644], [19.417502475673157, -7.155428562044297], [19.166613396896107, -7.738183688999753], [19.016751743249664, -7.988245944860132], [18.464175652752683, -7.847014255406442], [18.134221632569048, -7.98767750410492], [17.472970004962232, -8.068551120641699], [17.089995965247166, -7.545688978712525], [16.860190870845198, -7.222297865429984], [16.573179965896141, -6.622644545115087], [16.326528354567042, -5.877470391466267], [13.375597364971892, -5.864241224799548], [13.02486941900696, -5.984388929878157], [12.735171339578695, -5.965682061388497], [12.322431674863507, -6.100092461779658], [12.182336866920249, -5.789930515163837], [12.436688266660866, -5.684303887559245], [12.468004184629734, -5.248361504745003], [12.631611769265788, -4.991271254092935], [12.995517205465173, -4.781103203961883], [13.258240187237044, -4.882957452009165], [13.600234816144676, -4.500138441590969], [14.144956088933295, -4.510008640158715], [14.209034864975219, -4.793092136253597], [14.582603794013179, -4.970238946150139], [15.170991652088441, -4.3435071753143], [15.753540073314749, -3.855164890156096], [16.006289503654298, -3.535132744972528], [15.972803175529149, -2.712392266453612], [16.407091912510051, -1.740927015798682], [16.86530683764212, -1.225816338713287], [17.523716261472853, -0.743830254726987], [17.638644646889983, -0.424831638189246], [17.663552687254676, -0.058083998213817], [17.826540154703245, 0.288923244626105], [17.774191928791563, 0.855658677571085], [17.89883548347958, 1.741831976728278], [18.09427575040743, 2.365721543788055], [18.39379235197114, 2.90044342692822], [18.453065219809925, 3.504385891123348], [18.542982211997778, 4.201785183118317], [18.932312452884755, 4.709506130385973], [19.467783644293146, 5.031527818212779], [20.290679152108932, 4.691677761245287], [20.927591180106273, 4.322785549329736], [21.659122755630019, 4.224341945813719], [22.405123732195531, 4.02916006104732], [22.704123569436284, 4.633050848810156], [22.841479526468103, 4.710126247573483], [23.297213982850135, 4.609693101414221], [24.41053104014625, 5.108784084489129], [24.805028924262409, 4.897246608902349], [25.128833449003274, 4.927244777847789], [25.278798455514302, 5.170408229997191], [25.650455356557465, 5.256087754737123], [26.402760857862535, 5.150874538590869], [27.044065382604703, 5.127852688004835], [27.374226108517483, 5.233944403500059], [27.979977247842807, 4.408413397637373], [28.428993768026906, 4.287154649264493], [28.696677687298795, 4.455077215996936], [29.159078403446497, 4.38926727947323], [29.715995314256013, 4.600804755060024], [29.953500197069467, 4.173699042167683], [30.833859897593801, 3.50916596111034]]] } }, { "type": "Feature", "properties": { "admin": "Republic of Congo", "name": "Congo", "continent": "Africa" }, "geometry": { "type": "Polygon", "coordinates": [[[12.995517205465173, -4.781103203961883], [12.620759718484491, -4.438023369976135], [12.318607618873923, -4.606230157086187], [11.914963006242086, -5.037986748884789], [11.093772820691923, -3.978826592630546], [11.855121697648114, -3.42687061932105], [11.478038771214299, -2.765618991714241], [11.820963575903189, -2.514161472181982], [12.495702752338159, -2.391688327650242], [12.575284458067639, -1.948511244315134], [13.109618767965626, -2.428740329603513], [13.992407260807706, -2.470804945489099], [14.299210239324564, -1.998275648612213], [14.425455763413593, -1.333406670744971], [14.316418491277741, -0.552627455247048], [13.843320753645653, 0.038757635901149], [14.276265903386953, 1.196929836426619], [14.026668735417214, 1.395677395021153], [13.282631463278816, 1.31418366129688], [13.003113641012074, 1.830896307783319], [13.07582238124675, 2.267097072759014], [14.337812534246577, 2.22787466064949], [15.14634199388524, 1.964014797367184], [15.940918816805061, 1.727672634280295], [16.01285241055535, 2.267639675298084], [16.537058139724135, 3.198254706226278], [17.133042433346297, 3.728196519379451], [17.809900343505259, 3.560196437998569], [18.453065219809925, 3.504385891123348], [18.39379235197114, 2.90044342692822], [18.09427575040743, 2.365721543788055], [17.89883548347958, 1.741831976728278], [17.774191928791563, 0.855658677571085], [17.826540154703245, 0.288923244626105], [17.663552687254676, -0.058083998213817], [17.638644646889983, -0.424831638189246], [17.523716261472853, -0.743830254726987], [16.86530683764212, -1.225816338713287], [16.407091912510051, -1.740927015798682], [15.972803175529149, -2.712392266453612], [16.006289503654298, -3.535132744972528], [15.753540073314749, -3.855164890156096], [15.170991652088441, -4.3435071753143], [14.582603794013179, -4.970238946150139], [14.209034864975219, -4.793092136253597], [14.144956088933295, -4.510008640158715], [13.600234816144676, -4.500138441590969], [13.258240187237044, -4.882957452009165], [12.995517205465173, -4.781103203961883]]] } }, @@ -964,6 +989,7 @@ module mapcomponenet { } + module MenuComponent { $(function () { var sample = new ej.Menu($("#syncfusionProducts"),{ @@ -987,6 +1013,10 @@ module MenuComponent { } + + + + module NavigationDrawerComponent { $(function () { var navigationdrawerInstance = new ej.NavigationDrawer($("#navpane"), { @@ -1021,7 +1051,7 @@ module PivotChartOlap { $(function () { var sample = new ej.PivotChart($("#PivotChart"),{ dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", + data: "http://bi.syncfusion.com/olap/msmdpump.dll", catalog: "Adventure Works DW 2008 SE", cube: "Adventure Works", rows: [ @@ -1053,11 +1083,13 @@ module PivotChartOlap { size: { height: "460px", width: "100%" }, primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, primaryYAxis: { title: { text: "Internet Sales Amount" } }, - legend: { visible: true, rowCount: 2 } + legend: { visible: true, rowCount: 2 }, + load:"loadTheme" }); }); } + var pivot_dataset = [ { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, @@ -1125,7 +1157,8 @@ module PivotChartRelational { }, size: { height: "460px", width: "100%" }, primaryYAxis: { title: { text: "Amount" } }, - legend: { visible: true } + legend: { visible: true }, + load:"loadTheme" }); }); } @@ -1185,7 +1218,7 @@ module PivotGaugeOlap { length: 120, width: 7 }, - { + { type: "marker", markerType: "diamond", distanceFromScale: 5, @@ -1214,7 +1247,7 @@ module PivotGaugeOlap { distanceFromScale: -5, backgroundColor: "#fc0606", border: { color: "#fc0606" } - }, + }, { distanceFromScale: -5 }], @@ -1232,9 +1265,10 @@ module PivotGaugeOlap { }] }] }); - }); + }); } + var pivot_dataset = [ { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, @@ -1304,7 +1338,7 @@ module PivotGaugeRelational { length: 120, width: 7 }, - { + { type: "marker", markerType: "diamond", distanceFromScale: 5, @@ -1333,7 +1367,7 @@ module PivotGaugeRelational { distanceFromScale: -5, backgroundColor: "#fc0606", border: { color: "#fc0606" } - }, + }, { distanceFromScale: -5 }], @@ -1351,7 +1385,7 @@ module PivotGaugeRelational { }] }] }); - }); + }); } module PivotGridOlap { @@ -1384,7 +1418,7 @@ module PivotGridOlap { ], filters:[] }, - enableGroupingBar: true, + enableGroupingBar: true, pivotTableFieldListID:"PivotSchemaDesigner" }); $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); @@ -1433,7 +1467,7 @@ module PivotGridRelational { fieldCaption: "State" } ], - columns: + columns: [{ fieldName: "Product", fieldCaption: "Product" @@ -1451,10 +1485,10 @@ module PivotGridRelational { ], filters:[] }, - enableGroupingBar: true, + enableGroupingBar: true, pivotTableFieldListID:"PivotSchemaDesigner" }); - $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); + $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); }); } @@ -1508,6 +1542,7 @@ module ProgressBarComponent { } + declare var rteObj: any; declare var data: any; var radialEle = $('#defaultradialmenu'), action = 0, forRedo = 0; @@ -1551,6 +1586,7 @@ module RadialMenuComponent { }); } + function bold(e: any) { rteObj = rteEle.data("ejRTE"); @@ -1726,7 +1762,7 @@ module RatingComponent { shapeWidth: 25, showTooltip: true }); - + var sample2 = new ej.Rating($("#halfRating"),{ precision: ej.Rating.Precision.Half, value: 3.5, @@ -1757,7 +1793,7 @@ module RatingComponent { shapeHeight: 25, shapeWidth: 25, showTooltip: true - }); + }); }); } @@ -1786,7 +1822,7 @@ module RibbonComponent { toolTip: "Pin the Ribbon" }, applicationTab: { - type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } + type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } }, tabs: [{ id: "home", text: "HOME", groups: [{ @@ -1868,7 +1904,7 @@ module RibbonComponent { width: 60, isBig: false } - }] + }] }, { text: "Font", alignType: "rows", content: [{ @@ -2169,7 +2205,7 @@ module RibbonComponent { groups: [{ id: "zoomin", text: "Zoom In", - toolTip: "Zoom In", + toolTip: "Zoom In", buttonSettings: { width: 58, click: "onClick", @@ -2181,7 +2217,7 @@ module RibbonComponent { { id: "zoomout", text: "Zoom Out", - toolTip: "Zoom Out", + toolTip: "Zoom Out", buttonSettings: { width: 70, click: "onClick", @@ -2193,7 +2229,7 @@ module RibbonComponent { { id: "fullscreen", text: "Full Screen", - toolTip: "Full Screen", + toolTip: "Full Screen", buttonSettings: { width: 73, click: "onClick", @@ -2436,7 +2472,7 @@ module RibbonComponent { } ] } - ], + ], create: function createControl(args) { var ribbon = $("#defaultRibbon").data("ejRibbon"); $("#fontcolor").ejColorPicker({ value: "#FFFF00", modelType: "palette", cssClass: "e-ribbon", toolIcon: "e-fontcoloricon", select: colorHandler }); @@ -2448,7 +2484,7 @@ module RibbonComponent { function colorHandler(args:any) { (this._id.indexOf("fillcolor") != -1) ? $("#contenteditor").css('background-color', args.value) : document.execCommand('forecolor', false, args.value); } -function onClick(args: any) { +function onClick(args) { var val, prop = args.text; val = (ej.isNullOrUndefined(args.model.text)) ? args.model.activeText : args.model.text; if (action1.indexOf(val) != -1) @@ -2464,6 +2500,7 @@ function onClick(args: any) { } + module RotatorComponent { $(function () { var rotatorInstance = new ej.Rotator($("#sliderContent"), { @@ -2621,7 +2658,7 @@ module ScheduleComponent { } }); }); -} +} module ScrollerComponent { $(function () { @@ -2631,9 +2668,7 @@ module ScrollerComponent { }); $(window).bind('resize', function () { scrollerSample.refresh(); - }); - - }); + }); }); } module SignatureComponent { @@ -2664,6 +2699,8 @@ module SliderComponent { } + + module linesparkline { $(function () { @@ -2791,6 +2828,8 @@ module piesparkline4 { }); } + + module SplitterComponent { $(function () { @@ -2822,7 +2861,7 @@ $(function () { pdfUrl: (window).baseurl + "api/Spreadsheet/PdfExport" }, sheets: [{ rangeSettings: [{ dataSource: (window).defaultData, startCell: "A1" }] }], - loadComplete: () => { + loadComplete: () => { var spreadsheet = $("#basicSpreadsheet").data("ejSpreadsheet"), xlFormat = spreadsheet.XLFormat; if (!(spreadsheet).isImport) { spreadsheet.setWidthToColumns([140, 128, 105, 100, 100, 110, 120, 120, 100]); @@ -2843,13 +2882,13 @@ var default_data: Array = [ { Category : "Employees", Country : "USA", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 70 }, { Category : "Employees", Country : "USA", JobDescription : "Management", EmployeesCount : 40 }, { Category : "Employees", Country : "USA", JobDescription : "Accounts", EmployeesCount : 60 }, - + { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 43 }, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 125}, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 60 }, { Category : "Employees", Country : "India", JobDescription : "HR Executives", EmployeesCount : 70 }, { Category : "Employees", Country : "India", JobDescription : "Accounts", EmployeesCount : 45 }, - + { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Executive", EmployeesCount : 30 }, { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Analyst", EmployeesCount : 40 }, { Category : "Employees", Country : "Germany", JobDescription : "Marketing", EmployeesCount : 50 }, @@ -2858,13 +2897,13 @@ var default_data: Array = [ { Category : "Employees", Country : "Germany", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, { Category : "Employees", Country : "Germany", JobDescription : "Management", EmployeesCount : 33 }, { Category : "Employees", Country : "Germany", JobDescription : "Accounts", EmployeesCount : 55 }, - + { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 45 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 96 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 55 }, { Category : "Employees", Country : "UK", JobDescription : "HR Executives", EmployeesCount : 60 }, { Category : "Employees", Country : "UK", JobDescription: "Accounts", EmployeesCount: 30 }, - + { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 40 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 65 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, @@ -2874,7 +2913,7 @@ var default_data: Array = [ module sunburstcomponent { $(function () { var sunburstsample = new ej.SunburstChart($("#Sunburst"), { - valueMemberPath: "EmployeesCount", + valueMemberPath: "EmployeesCount", levels: [ {groupMemberPath: "Country"}, {groupMemberPath: "JobDescription"}, @@ -2899,7 +2938,8 @@ module sunburstcomponent { }, title:{text:"Employees Count"}, zoomSettings:{enable:false}, - legend:{visible:true,position:'top'} + legend:{visible:true,position:'top'}, + load:"loadTheme" }); }); } @@ -2918,7 +2958,8 @@ module TabComponent { } module TagCloudComponent { - + + var websiteCollection = [ { text: "Google", url: "http://www.google.com", frequency: 12 }, { text: "All Things Digital", url: "http://allthingsd.com/", frequency: 3 }, @@ -2949,7 +2990,7 @@ module TagCloudComponent { text: "text", url: "url", frequency: "frequency" } }); - + }); } @@ -2985,6 +3026,8 @@ module EditorComponent { }); } + + module TileViewComponent { $(function () { var tile1 = new ej.Tile($("#tile1"), { @@ -2994,38 +3037,38 @@ module TileViewComponent { imageUrl:'content/images/tile/windows/people_1.png' }); var tile2 = new ej.Tile($("#tile2"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/alerts.png', - + imageUrl:'content/images/tile/windows/alerts.png', + }); var tile3 = new ej.Tile($("#tile3"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/bing.png', + imageUrl:'content/images/tile/windows/bing.png', }); var tile4 = new ej.Tile($("#tile4"), { tileSize:"small", - imageUrl:'content/images/tile/windows/camera.png', + imageUrl:'content/images/tile/windows/camera.png', }); var tile5 = new ej.Tile($("#tile5"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/messages.png', + imageUrl:'content/images/tile/windows/messages.png', }); var tile6 = new ej.Tile($("#tile6"), { - imagePosition:"center", + imagePosition:"center", tileSize:"medium", - imageUrl:'content/images/tile/windows/games.png', + imageUrl:'content/images/tile/windows/games.png', caption:{text:"Play"} }); - var tile7 = new ej.Tile($("#tile7"), { + var tile7 = new ej.Tile($("#tile7"), { tileSize:"medium", imageUrl:'content/images/tile/windows/map.png', caption:{text:"Maps"} }); var tile8 = new ej.Tile($("#tile8"), { - imagePosition:"fill", + imagePosition:"fill", tileSize:"wide", imageUrl:'content/images/tile/windows/sports.png', caption:{text:"Sports"} @@ -3062,7 +3105,6 @@ module TileViewComponent { }); }); } - module TimePickerComponent { $(function () { var timeSample = new ej.TimePicker($("#timepick"), { @@ -3072,13 +3114,13 @@ module TimePickerComponent { } module ToolbarComponent { - + $(function () { var sample = new ej.Toolbar($("#editingToolbar"),{ width: "100%", cssClass: "gradient-lime", enableSeparator: true, - + isResponsive: true, orientation: ej.Orientation.Horizontal, showRoundedCorner: true @@ -3088,7 +3130,7 @@ module ToolbarComponent { } module TooltipComponent { - + $(function () { var sample1 = new ej.Tooltip($("#link1"),{ @@ -3181,7 +3223,8 @@ module TreeGridComponent { isResponsive: true, }); }); -} +} + var population_data: Array = [ { Continent: "Asia", Country: "Indonesia", Growth: 3, Population: 237641326 }, @@ -3221,6 +3264,8 @@ module treemapcomponent { }); } + + module TreeViewComponent { $(function () { var tree = new ej.TreeView($("#treeView"), { @@ -3233,7 +3278,7 @@ module TreeViewComponent { } module UploadboxComponent { - + $(function () { var sample = new ej.Uploadbox($("#UploadDefault"),{ saveUrl: (window).baseurl + "api/uploadbox/Save", diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index f1aec6bc64..bf6d488f6f 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ej.web.all 15.4 +// Type definitions for ej.web.all 15.4 // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,10 +6,9 @@ /// - /*! * filename: ej.web.all.d.ts -* version : 15.4.0.17 +* version : 15.4.0.20 * Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing @@ -94,12 +93,12 @@ declare namespace ej { function avg(json: any, filedName: string): any; function getGuid(prefix: string): number; function group(jsonArray: any, field: string, agg: string, level: number, groupDs: string): any; - function isJson(jsonData: string): string; + function isJSON(jsonData: string): string; function max(jsonArray: any, fieldName?: string, comparer?: string): any; function min(jsonArray: any, fieldName: string, comparer: string): any; function merge(first: string, second: string): any; function mergeshort(jsonArray: any, fieldName: string, comparer: string): any; - function parseJson(jsonText: string): string; + function parseJSON(jsonText: string): string; function parseTable(table: number, headerOption: string, headerRowIndex: string): any; function select(jsonArray: any, fields: string): any; function setTransition(): boolean; @@ -2477,6 +2476,10 @@ declare namespace ej { */ stringFormat?: string; + /** This property allows user to search text for any number of fields in the suggestion list without modifying the selected text format. + */ + searchColumnIndices?: any[]; + /** Field and Header Text collections can be defined and customized through columns field. */ columns?: MultiColumnSettingsColumn[]; @@ -4592,8 +4595,8 @@ declare namespace ej { toolIcon?: string; /** This property allows to define the customized text or content to displayed when mouse over the following elements. This property also allows to use the culture values. - * @Default {{ switcher: Switcher, addbutton: Add Color, basic: Basic, monochrome: Mono Chrome, flatcolors: Flat Color, seawolf: Sea Wolf, webcolors: Web Colors, sandy: Sandy, - * pinkshades: Pink Shades, misty: Misty, citrus: Citrus, vintage: Vintage, moonlight: Moon Light, candycrush: Candy Crush, currentcolor: Current Color, selectedcolor: Selected + * @Default {{ switcher: Switcher, addButton: Add Color, basic: Basic, monoChrome: Mono Chrome, flatColors: Flat Color, seaWolf: Sea Wolf, webColors: Web Colors, sandy: Sandy, + * pinkShades: Pink Shades, misty: Misty, citrus: Citrus, vintage: Vintage, moonLight: Moon Light, candyCrush: Candy Crush, currentColor: Current Color, selectedColor: Selected * Color }} */ tooltipText?: TooltipText; @@ -4749,7 +4752,7 @@ declare namespace ej { /** Sets the tooltip text for the add button. */ - addbutton?: string; + addButton?: string; /** Sets the tooltip text for the basic preset. */ @@ -4757,19 +4760,19 @@ declare namespace ej { /** Sets the tooltip text for the mono chrome preset. */ - monochrome?: string; + monoChrome?: string; /** Sets the tooltip text for the flat colors preset. */ - flatcolors?: string; + flatColors?: string; /** Sets the tooltip text for the sea wolf preset. */ - seawolf?: string; + seaWolf?: string; /** Sets the tooltip text for the web colors preset. */ - webcolors?: string; + webColors?: string; /** Sets the tooltip text for the sandy preset. */ @@ -4777,7 +4780,7 @@ declare namespace ej { /** Sets the tooltip text for the pink shades preset. */ - pinkshades?: string; + pinkShades?: string; /** Sets the tooltip text for the misty preset. */ @@ -4793,19 +4796,19 @@ declare namespace ej { /** Sets the tooltip text for the moon light preset. */ - moonlight?: string; + moonLight?: string; /** Sets the tooltip text for the candy crush preset. */ - candycrush?: string; + candyCrush?: string; /** Sets the tooltip text for the current color area. */ - currentcolor?: string; + currentColor?: string; /** Sets the tooltip text for the selected color area. */ - selectedcolor?: string; + selectedColor?: string; } enum ModelType { @@ -7751,7 +7754,7 @@ declare namespace ej { */ enableRTL?: boolean; - /** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set 'showHeader' as true since the favicon will be displayed in the dialog + /** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set showHeader as true since the favicon will be displayed in the dialog * header. */ faviconCSS?: string; @@ -8489,6 +8492,11 @@ declare namespace ej { */ enableSorting?: boolean; + /** The property is used to determine whether the popup list is generated dynamically. + * @Default {false} + */ + loadOnDemand?: boolean; + /** Specifies the mapping fields for the data items of the DropDownList. * @Default {null} */ @@ -10888,7 +10896,7 @@ declare namespace ej { /** Fires when keydown in mask edit textbox control. */ - keydown?(e: KeydownEventArgs): void; + onKeyDown?(e: OnKeyDownEventArgs): void; /** Fires when key press in mask edit textbox control. */ @@ -10896,7 +10904,7 @@ declare namespace ej { /** Fires when keyup in mask edit textbox control. */ - keyup?(e: KeyupEventArgs): void; + keyUp?(e: KeyUpEventArgs): void; /** Fires when mouse out in mask edit textbox control. */ @@ -11006,7 +11014,7 @@ declare namespace ej { unmaskedValue?: string; } - export interface KeydownEventArgs { + export interface OnKeyDownEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -11052,7 +11060,7 @@ declare namespace ej { unmaskedValue?: string; } - export interface KeyupEventArgs { + export interface KeyUpEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -11185,9 +11193,10 @@ declare namespace ej { hide(): void; /** Hides the specific items in Menu control. + * @param {string|any[]} ItemID of the Menu item to be hidden * @returns {void} */ - hideItems(): void; + hideItems(itemID: string|any[]): void; /** Insert the menu item as child of target node. * @param {any} Information about Menu item. @@ -11226,9 +11235,10 @@ declare namespace ej { show(locationX: number, locationY: number, targetElement: any, event: any): void; /** Show the specific items in Menu control. + * @param {string|any[]} ItemID of the Menu item to be shown * @returns {void} */ - showItems(): void; + showItems(itemID: string|any[]): void; } export namespace Menu { @@ -11692,6 +11702,26 @@ declare namespace ej { */ gotoPage(pageIndex: number): void; + /** goToFirstPage() helps to navigate to the first page of the pager. + * @returns {void} + */ + goToFirstPage(): void; + + /** goToNextPage() helps to navigate to the next page to the current page of the pager. + * @returns {void} + */ + goToNextPage(): void; + + /** goToLastPage() helps to navigate to the Last page of the pager. + * @returns {void} + */ + goToLastPage(): void; + + /** goToPrevPage() helps to navigate to the previous page to the current page of the pager. + * @returns {void} + */ + goToPrevPage(): void; + /** refreshPager() helps to refresh the model value of pager control. * @returns {void} */ @@ -11710,6 +11740,15 @@ declare namespace ej { */ currentPage?: number; + /** Sets the root CSS class, which can be used for customization of pager control. + */ + cssClass?: string; + + /** Enable or disable the Pager control. + * @Default {true} + */ + enabled?: boolean; + /** Gets or sets a value that indicates whether to display the external Message in Pager. * @Default {false} */ @@ -11729,6 +11768,11 @@ declare namespace ej { */ externalMessage?: string; + /** Enables or disables responsive support for the Pager control items on window resize. + * @Default {false} + */ + isResponsive?: boolean; + /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to * a particular country or region. * @Default {en-US} @@ -11751,6 +11795,15 @@ declare namespace ej { */ pageSizeList?: any[]; + /** Indicates the pageSizeMessage to be displayed in Pager when pageSizeList API is defined. + */ + pageSizeMessage?: String; + + /** Template option allows to customize UI appearance of the ejPager by defining their own page layout. + * @Default {null} + */ + template?: string; + /** Get or sets a value of total number of pages in the pager. The totalPages value is calculated based on page size and total records. * @Default {null} */ @@ -11769,6 +11822,22 @@ declare namespace ej { /** Triggered when pager numeric item is clicked in pager control. */ click?(e: ClickEventArgs): void; + + /** Triggers when the current page value of the Pager control is changed. + */ + change?(e: ChangeEventArgs): void; + + /** Triggered when Pager control is successfully created. + */ + create?(e: CreateEventArgs): void; + + /** Triggered when Pager control is successfully destroyed. + */ + destroy?(e: DestroyEventArgs): void; + + /** Triggered when a value is selected in the pageSizeList dropdown. + */ + pageSizeSelected?(e: PageSizeSelectedEventArgs): void; } export interface ClickEventArgs { @@ -11793,6 +11862,70 @@ declare namespace ej { */ event?: any; } + + export interface ChangeEventArgs { + + /** Returns the current page index. + */ + currentPage?: number; + + /** Returns the pager model. + */ + model?: any; + + /** Returns the name of event + */ + type?: string; + + /** Returns current action event type and its target. + */ + event?: any; + } + + export interface CreateEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the pager model. + */ + model?: any; + + /** Returns the name of event + */ + type?: string; + } + + export interface DestroyEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the pager model. + */ + model?: any; + + /** Returns the name of event + */ + type?: string; + } + + export interface PageSizeSelectedEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the pager model. + */ + model?: any; + + /** Returns the name of event + */ + type?: string; + } } class Print extends ej.Widget { @@ -13988,6 +14121,11 @@ declare namespace ej { */ allowDragAndDrop?: boolean; + /** Gets or sets a value that indicates whether to enable drag and drop behavior between Kanban controls. + * @Default {false} + */ + allowExternalDragAndDrop?: boolean; + /** To enable or disable the title of the card. * @Default {false} */ @@ -14157,6 +14295,11 @@ declare namespace ej { */ locale?: string; + /** Gets or sets a value that indicates whether to render kanban columns using without data source. + * @Default {false} + */ + showColumnWhenEmpty?: boolean; + /** Triggered for every Kanban action before its starts. */ actionBegin?(e: ActionBeginEventArgs): void; @@ -15199,6 +15342,10 @@ declare namespace ej { * @Default {Object} */ colorMapping?: any; + + /** This specifies the Kanban card to drop into particular target element. + */ + externalDropTarget?: string; } export interface CustomToolbarItem { @@ -17639,6 +17786,11 @@ declare namespace ej { */ enableRTL?: boolean; + /** Specifies HTML element string to replace the existing expand/collapse icons. + * @Default {null} + */ + expanderTemplate?: string; + /** Specify height for splitter control. * @Default {null} */ @@ -17673,6 +17825,10 @@ declare namespace ej { */ beforeExpandCollapse?(e: BeforeExpandCollapseEventArgs): void; + /** Triggered when we click on the template icon. (Note: This will work only when expanderTemplate is defined.) + */ + clickOnExpander?(e: ClickOnExpanderEventArgs): void; + /** Fires when splitter control pane has been created. */ create?(e: CreateEventArgs): void; @@ -17717,6 +17873,25 @@ declare namespace ej { type?: string; } + export interface ClickOnExpanderEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the splitter model. + */ + model?: ej.Splitter.Model; + + /** returns the name of the event. + */ + type?: string; + + /** returns the target element from which click action is triggered. + */ + targetElement?: any; + } + export interface CreateEventArgs { /** if the event should be canceled; otherwise, false. @@ -23235,6 +23410,10 @@ declare namespace ej { */ rowDrop?(e: RowDropEventArgs): void; + /** Triggered while hover the grid row. + */ + rowHover?(e: RowHoverEventArgs): void; + /** Triggered when refresh the template column elements in the Grid. */ templateRefresh?(e: TemplateRefreshEventArgs): void; @@ -24484,7 +24663,7 @@ declare namespace ej { /** Method to merge the header cells. */ - headerCellMerge?(): void; + headerCellMerge?(startIndex:number,count:number): void /** Returns the column headers. */ @@ -25099,6 +25278,25 @@ declare namespace ej { droppedRecords?: any; } + export interface RowHoverEventArgs { + + /** Returns the hovered row. + */ + row?: any; + + /** Returns the hovered row index. + */ + rowIndex?: any; + + /** Returns the hovered record details + */ + rowData?: any; + + /** Returns the hovered row cell + */ + cell?: any; + } + export interface TemplateRefreshEventArgs { /** Returns the cancel option value. @@ -28277,7 +28475,7 @@ declare namespace ej { enableColumnResizing?: boolean; /** Allows the user to fit the width of the column based on its maximum text width. - * @Default {false} + * @Default {true} */ resizeColumnsToFit?: boolean; @@ -28763,7 +28961,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -28862,7 +29060,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -28931,7 +29129,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -30266,7 +30464,7 @@ declare namespace ej { */ analysisMode?: ej.Pivot.AnalysisMode|string; - /** Allows the user to set the specific chart type for PivotChart inside PivotClient widget. + /** Allows the user to set the specific Chart type for PivotChart inside PivotClient widget. * @Default {ej.PivotChart.ChartTypes.Column} */ chartType?: ej.PivotChart.ChartTypes|string; @@ -30311,6 +30509,11 @@ declare namespace ej { */ showUniqueNameOnPivotButton?: boolean; + /** Allows user to load the saved report collection from the database. + * @Default {false} + */ + showReportCollection?: boolean; + /** Enables the splitter option for resizing the elements inside the control. * @Default {false} */ @@ -30336,7 +30539,7 @@ declare namespace ej { */ enablePaging?: boolean; - /** Allows the user to include the PivotTreeMap component as one of the chart types. + /** Allows the user to include the PivotTreeMap component as one of the Chart types. * @Default {false} */ enablePivotTreeMap?: boolean; @@ -30450,6 +30653,18 @@ declare namespace ej { */ treeMapLoad?(e: TreeMapLoadEventArgs): void; + /** Triggers on clicking any value cell in PivotGrid. + */ + valueCellHyperlinkClick?(e: ValueCellHyperlinkClickEventArgs): void; + + /** Triggers when clicking on any Chart series points in the PivotChart. + */ + pointRegionClick?(e: PointRegionClickEventArgs): void; + + /** Triggers before Chart label rendering in the PivotChart. + */ + axesLabelRendering?(e: AxesLabelRenderingEventArgs): void; + /** Triggers while clicking value cells in PivotGrid. */ drillThrough?(e: DrillThroughEventArgs): void; @@ -30562,9 +30777,9 @@ declare namespace ej { export interface SchemaLoadEventArgs { - /** returns the HTML element of PivotSchemaDesigner control. + /** returns the current action of PivotSchemaDesigner control. */ - element?: any; + action?: string; } export interface TreeMapLoadEventArgs { @@ -30582,6 +30797,59 @@ declare namespace ej { element?: any; } + export interface ValueCellHyperlinkClickEventArgs { + + /** returns the current action of PivotClient control. + */ + type?: string; + + /** returns the clicked cell information. + */ + args?: any; + + /** returns the custom object bounds with PivotClient control. + */ + customerObject?: any; + + /** returns the HTML element of PivotGrid control. + */ + element?: any; + + /** returns the model object bound with PivotClient control. + */ + model?: any; + } + + export interface PointRegionClickEventArgs { + + /** returns the current action of PivotClient control. + */ + type?: string; + + /** returns the clicked Chart series points information. + */ + data?: any; + + /** returns the model object bound with PivotClient control. + */ + model?: any; + } + + export interface AxesLabelRenderingEventArgs { + + /** returns the current action of PivotClient control. + */ + type?: string; + + /** returns the Chart label information. + */ + data?: any; + + /** returns the model object bound with PivotClient control. + */ + model?: any; + } + export interface DrillThroughEventArgs { /** return the JSON records of the generated cells on drill-through operation. @@ -30708,7 +30976,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -30803,7 +31071,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -30868,7 +31136,7 @@ declare namespace ej { */ format?: string; - /** This property sets type of display of date. + /** This property is set to display the formatted values with format types in PivotGrid. */ formatString?: string; @@ -32161,6 +32429,14 @@ declare namespace ej { */ exportSchedule(action: string, serverEvent: string, id: string|number): void; + /** Exports the appointments from the Schedule control and saves it in a Excel file. + * @param {string} It refers the controller action name to redirect. (For MVC) + * @param {string} It refers the server event name.(For ASP) + * @param {boolean} Indicates whether to export all the appointments including or excluding the individual occurrences of the recurrence appointments. + * @returns {void} + */ + exportToExcel(action: string, serverEvent: string, type: boolean): void; + /** Searches and filters the appointments from appointment list of Schedule control. * @param {any[]} Holds array of one or more conditional objects for filtering the appointments based on it. * @returns {any[]} @@ -34088,13 +34364,6 @@ declare namespace ej { */ addRecord(data: any, rowPosition: string): void; - /** To select cell based on the cell and row index dynamically. - * @param {any[]} array of cell indexes to be select - * @param {boolean} Defines that we need to preserve the previously selected cells of not - * @returns {void} - */ - selectCells(Indexes: any[], preservePreviousSelectedCell: boolean): void; - /** Positions the splitter by the specified column index. * @param {number} Set the splitter position based on column index. * @returns {void} @@ -34178,6 +34447,19 @@ declare namespace ej { */ saveEdit(): void; + /** To select cell based on the cell and row index dynamically. + * @param {any[]} array of cell indexes to be select + * @param {boolean} Defines that we need to preserve the previously selected cells of not + * @returns {void} + */ + selectCells(Indexes: any[], preservePreviousSelectedCell: boolean): void; + + /** To select multiple rows dynamically. + * @param {any[]} array of row indexes to select + * @returns {void} + */ + selectMultipleRows(rowIndexes: any[]): void; + /** To search an item with search string provided at the run time * @param {string} you can pass a text to search in Gantt Control. * @returns {void} @@ -34195,6 +34477,13 @@ declare namespace ej { * @returns {void} */ showColumn(headerText: string): void; + + /** To change an existing Gantt ID by new ID value dynamically + * @param {number} you can pass an existing ID value to be change + * @param {number} you can pass a new ID value to be change + * @returns {void} + */ + updateTaskId(currentId: number, newId: number): void; } export namespace Gantt { @@ -35653,6 +35942,11 @@ declare namespace ej { * @Default {ej.Gantt.RowPosition.BelowSelectedRow} */ rowPosition?: ej.Gantt.RowPosition|string; + + /** Enable or disable the confirmation dialog while deleting the record. + * @Default {false} + */ + showDeleteConfirmDialog?: boolean; } export interface Holiday { @@ -36159,6 +36453,11 @@ declare namespace ej { */ zoomFactor?: number; + /** Specifies the token for authorizing reporting service url to process the reports. + * @Default {empty} + */ + serviceAuthorizationToken?: string; + /** Fires when the report viewer is destroyed successfully.If you want to perform any operation after destroying the reportviewer control,you can make use of the destroy event. */ destroy?(e: DestroyEventArgs): void; @@ -36933,6 +37232,11 @@ declare namespace ej { */ allowSorting?: boolean; + /** Enables or disables the toolbar searching in TreeGrid. + * @Default {false} + */ + allowSearching?: boolean; + /** Enables/disables pagination of rows in TreeGrid * @Default {false} */ @@ -37128,6 +37432,10 @@ declare namespace ej { */ stackedHeaderRows?: StackedHeaderRow[]; + /** Specifies the toolbar searching customizations. + */ + searchSettings?: SearchSettings; + /** Specifies the visibility of summary row * @Default {false} */ @@ -37194,10 +37502,6 @@ declare namespace ej { */ collapsing?(e: CollapsingEventArgs): void; - /** Triggered while clicking a row, even when allowSelection property is disabled. - */ - recordClick?(e: RecordClickEventArgs): void; - /** Triggered when you start to drag a column */ columnDragStart?(e: ColumnDragStartEventArgs): void; @@ -37294,6 +37598,14 @@ declare namespace ej { */ rowSelecting?(e: RowSelectingEventArgs): void; + /** Triggered while clicking a row, even when allowSelection property is disabled. + */ + recordClick?(e: RecordClickEventArgs): void; + + /** Triggered during record double click action, even when allowSelection property is disabled. + */ + recordDoubleClick?(e: RecordDoubleClickEventArgs): void; + /** Triggered when toolbar item is clicked in TreeGrid. */ toolbarClick?(e: ToolbarClickEventArgs): void; @@ -37461,37 +37773,6 @@ declare namespace ej { expanded?: boolean; } - export interface RecordClickEventArgs { - - /** Returns the cancel option value. - */ - cancel?: boolean; - - /** Returns the element of clicked cell. - */ - cell?: any; - - /** Returns the index of the clicked cell. - */ - cellIndex?: number; - - /** Returns the data of clicked cell. - */ - cellValue?: any; - - /** Returns the element of the clicked row. - */ - row?: any; - - /** Returns the index of the clicked row. - */ - rowIndex?: number; - - /** Returns the column name of the clicked cell. - */ - columnName?: string; - } - export interface ColumnDragStartEventArgs { /** Returns the cancel option value. @@ -37937,6 +38218,10 @@ declare namespace ej { */ draggedRowIndex?: number; + /** Returns the drop position details such as insertAbove,insertBelow,insertAsChild and invalidPosition + */ + dropPosition?: string; + /** Returns the row on which we are dragging. */ targetRow?: any; @@ -38160,6 +38445,68 @@ declare namespace ej { previousTreeGridRow?: any; } + export interface RecordClickEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the element of clicked cell. + */ + cell?: any; + + /** Returns the index of the clicked cell. + */ + cellIndex?: number; + + /** Returns the data of clicked cell. + */ + cellValue?: any; + + /** Returns the element of the clicked row. + */ + row?: any; + + /** Returns the index of the clicked row. + */ + rowIndex?: number; + + /** Returns the column name of the clicked cell. + */ + columnName?: string; + } + + export interface RecordDoubleClickEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the element of clicked cell. + */ + cell?: any; + + /** Returns the index of the clicked cell. + */ + cellIndex?: number; + + /** Returns the data of clicked cell. + */ + cellValue?: any; + + /** Returns the element of the clicked row. + */ + row?: any; + + /** Returns the index of the clicked row. + */ + rowIndex?: number; + + /** Returns the column name of the clicked cell. + */ + columnName?: string; + } + export interface ToolbarClickEventArgs { /** Returns the cancel option value. @@ -38255,6 +38602,11 @@ declare namespace ej { */ filterEditType?: ej.TreeGrid.EditingType|string; + /** Gets or sets a value to render either excel or menu filtering in TreeGrid column filtering. + * @Default {null} + */ + filterType?: ej.TreeGrid.FilterType|string; + /** Header text of the column. * @Default {null} */ @@ -38420,6 +38772,11 @@ declare namespace ej { * @Default {null} */ dialogEditorTemplateID?: string; + + /** Enable or disable the confirmation dialog while deleting the record. + * @Default {false} + */ + showDeleteConfirmDialog?: boolean; } export interface ColumnResizeSettings { @@ -38465,6 +38822,21 @@ declare namespace ej { * @Default {[]} */ filteredColumns?: FilterSettingsFilteredColumn[]; + + /** Gets or sets a value that indicates the maximum number of filter choices that can be showed in the excel styled filter menu. + * @Default {1000} + */ + maxFilterChoice?: number; + + /** Gets or sets a value that indicates to perform the filter operation with case sensitive in excel styled filter menu mode. + * @Default {false} + */ + enableCaseSensitivity?: boolean; + + /** Enables or disables the ability to filter the columns with empty, null and undefined values. + * @Default {true} + */ + enableComplexBlankFilter?: boolean; } export interface PageSettings { @@ -38576,6 +38948,28 @@ declare namespace ej { stackedHeaderColumns?: StackedHeaderRowsStackedHeaderColumn[]; } + export interface SearchSettings { + + /** Default Value + * @Default {[]} + */ + fields?: any[]; + + /** Default Value + */ + key?: string; + + /** Specifies the operator for the search key words in toolbar searching. + * @Default {contains} + */ + operator?: string; + + /** Default Value + * @Default {true} + */ + ignoreCase?: boolean; + } + export interface SummaryRowsSummaryColumn { /** Specifies the summary type to perform calculations in a corresponding summary column. See summaryType. @@ -38703,6 +39097,16 @@ declare namespace ej { } + enum FilterType { + + ///Specifies the filter type as menu. + Menu, + + ///Specifies the filter type as excel. + Excel + } + + enum UnboundType { ///Unbound type to perform edit action @@ -38794,16 +39198,6 @@ declare namespace ej { } - enum FilterType { - - ///Enables the filterbar filtering - FilterBar, - - ///Enables the menu filtering - Menu - } - - enum PageSizeMode { ///To count all the parent and child records. @@ -40585,6 +40979,11 @@ declare namespace ej { */ addNewSheet(): void; + /** This method is used to blank the workbook in Spreadsheet. + * @returns {void} + */ + blankWorkbook(): void; + /** It is used to clear all the data and format in the specified range of cells in Spreadsheet. * @param {string|any[]} Optional. If range is specified, then it will clear all content in the specified range else it will use the current selected range. * @returns {void} @@ -40707,6 +41106,15 @@ declare namespace ej { */ getAutoFillElem(): HTMLElement; + /** This method is used to get the alpha range of the given index in Spreadsheet. + * @param {number} Pass the start row index. + * @param {number} Pass the start column index. + * @param {number} Pass the end row index. + * @param {number} Pass the end column index. + * @returns {String} + */ + getAlphaRange(sRIndex: number, sCIndex: number, eRIndex: number, eCIndex: number): String; + /** This method is used to get the cell element based on specified row and column index in the Spreadsheet. * @param {number} Pass the row index. * @param {number} Pass the column index. @@ -40739,6 +41147,12 @@ declare namespace ej { */ getHyperlink(cell: HTMLElement): any; + /** This method is used to get the keys from the given object in Spreadsheet. + * @param {any} Pass the Object + * @returns {any[]} + */ + getObjectKeys(obj: any): any[]; + /** This method is used to get all cell elements in the specified range. * @param {string} Pass the range that you want to get the cells. * @param {number} Pass the index of the sheet. @@ -40753,6 +41167,14 @@ declare namespace ej { */ getRangeData(options?: any): any[]; + /** This method is used to get the data as object in the specified range. + * @param {any} Pass the start cell. + * @param {any} Pass the end cell. + * @param {boolean} Optional. Pass {{'`true`' | markdownify}}, if you want to skip the hidden rows. + * @returns {any} + */ + getRangeDataAsObject(startcell: any, endcell: any, skipHiddenRow?: boolean): any; + /** This method is used to get the range indices array based on the specified alpha range in Spreadsheet. * @param {string} Pass the alpha range that you want to get range indices. * @returns {any[]} @@ -41432,6 +41854,12 @@ declare namespace ej { */ editCell(rowIdx: number, colIdx: number, oldData: boolean): void; + /** This method is used to get the column index with specified field value in Spreadsheet. + * @param {string} Pass the column field value + * @returns {void} + */ + getColumnIndexByField(field: string): void; + /** This method is used to get the property value of particular cell, based on the row and column index in the Spreadsheet. * @param {number} Pass the row index to get the property value. * @param {number} Pass the column index to get the property value. @@ -41473,6 +41901,15 @@ declare namespace ej { * @returns {void} */ updateCellValue(cellIdx: any, val: string|number, formatClass: string, sheetIdx: number): void; + + /** This method is used to update a particular cell value and its format in the Spreadsheet. + * @param {string} Pass the range. + * @param {string|number} Pass the cell value. + * @param {string} Pass the class name to update format. + * @param {number} Pass sheet index. + * @returns {void} + */ + updateValue(aRange: string, val: string|number, formatClass: string, sheetIdx: number): void; } export interface XLExport { @@ -41517,6 +41954,20 @@ declare namespace ej { */ addFontFamily(fontName: string): void; + /** This method is used to add the new custom cell style in spreadsheet. + * @param {string} Pass the style name. + * @param {any} Pass the format object. + * @returns {void} + */ + addNewCustomStyle(styleName: string, options: any): void; + + /** This method is used to apply the custom cell style in the specified range. + * @param {string} Pass the style name. + * @param {string} Pass the range to applied. + * @returns {void} + */ + applyCustomCellStyle(styleName: string, range: string): void; + /** This method is used to convert table range to normal range. * @param {any} Pass the sheet index and table id. * @returns {void} @@ -41530,6 +41981,12 @@ declare namespace ej { */ createTable(tableObject: any, range: string|any[]): string; + /** This method is used to delete the added custom cell style in spreadsheet. + * @param {string} Pass the cell style name + * @returns {void} + */ + deleteCustomStyle(styleName: string): void; + /** This method is used to set format style and values in a cell or range of cells. * @param {any} Pass the formatObject which contains style, type, format, groupSeparator and decimalPlaces. * @param {string} Pass the range to format cells. @@ -41537,6 +41994,46 @@ declare namespace ej { */ format(formatObj: any, range: string): void; + /** This method is used to get the border from hashcode in the Spreadsheet. + * @param {string} Pass the border hashcode. + * @param {boolean} Optional. pass `true` to get the complete border object + * @returns {any} + */ + getBorderFromHashCode(code: string, isComplete: boolean): any; + + /** This method is used to get the format class in spreadsheet. + * @param {string} Pass the style name. + * @param {boolean} Optional. Pass true to get the border class. + * @returns {void} + */ + getFormatClass(classname: string, isborder: boolean): void; + + /** This method is used to get the format from the given hashcode in spreadsheet. + * @param {string} Pass the hashcode. + * @returns {void} + */ + getFormatFromHashCode(hashCode: string): void; + + /** This method is used to get the hashcode from the given style object in spreadsheet. + * @param {any} Pass the style object that you want to get the hashcode. + * @returns {void} + */ + getFormatHashCode(style: any): void; + + /** This method is used to get the format as array from the given specified range in spreadsheet. + * @param {string} Pass the range. + * @returns {void} + */ + getHashCodeClassAsArray(range: string): void; + + /** This method is used to modify the added custom cell style in spreadsheet. + * @param {string} pass the old style name + * @param {any} pass the format object to be modified + * @param {string} pass the new style name + * @returns {void} + */ + modifyCustomStyle(oldStyleName: string, options: any, newStyleName: string): void; + /** This method is used to remove the font from the Ribbon font family dropdown. * @param {string} Font name which needs to remove from the font family drop down. * @returns {void} @@ -45967,6 +46464,470 @@ declare namespace ej { } } + class ComboBox extends ej.Widget { + static fn: ComboBox; + constructor(element: JQuery | Element, options?: ComboBox.Model); + static Locale: any; + model: ComboBox.Model; + defaults: ComboBox.Model; + + /** Adds a new item to the popup list. By default, new item appends to the list as the last item, but you can insert based on the index parameter. + * @returns {void} + */ + addItem(): void; + + /** Sets the focus to the component for interaction. + * @returns {void} + */ + focusIn(): void; + + /** Moves the focus from the component if the component is already focused. + * @returns {void} + */ + focusOut(): void; + + /** Gets the data object that matches the given value. + * @returns {any} + */ + getDataByValue(): any; + + /** Gets all the list items bound on this component. + * @returns {Element[]} + */ + getItems(): Element[]; + + /** Hides the popup if it is in open state. + * @returns {void} + */ + hidePopup(): void; + + /** Opens the popup that displays the list of items. + * @returns {void} + */ + showPopup(): void; + } + export namespace ComboBox { + + export interface Model { + + /** Accepts the template and assigns it to the popup list content of the component when the data fetch request from the remote server fails. + * @Default {The Request Failed} + */ + actionFailureTemplate?: string; + + /** Specifies whether the component allows user defined value which does not exist in data source. + * @Default {true} + */ + allowCustom?: boolean; + + /** When allowFiltering is set to true, show the filter bar (search box) of the component. The filter action retrieves matched items through the filtering event based on the + * characters typed in the search TextBox. If no match is found, the value of the noRecordsTemplate property will be displayed. + * @Default {false} + */ + allowFiltering?: boolean; + + /** Specifies whether suggest a first matched item in input when searching. No action happens when no matches found. + * @Default {false} + */ + autofill?: boolean; + + /** Sets CSS classes to the root element of the component that helps customize the UI styles. + * @Default {null} + */ + cssClass?: string; + + /** Accepts the list items either through local or remote service and binds it to the component. It can be an array of JSON objects or an instance of DataManager. + * @Default {[]} + */ + dataSource?: any|any[]; + + /** When set to true, enables RTL mode of the component that displays the content in the right-to-left direction. + * @Default {false} + */ + enableRtl?: boolean; + + /** Specifies a value that indicates whether the component is enabled or not. + * @Default {true} + */ + enabled?: boolean; + + /** The fields property maps the columns of the data table and binds the data to the component. + */ + fields?: Fields; + + /** Accepts the template design and assigns it to the footer container of the popup list. + * @Default {null} + */ + footerTemplate?: string; + + /** Accepts the template design and assigns it to the group headers present in the popup list. + * @Default {null} + */ + groupTemplate?: string; + + /** Accepts the template design and assigns it to the header container of the popup list. + * @Default {null} + */ + headerTemplate?: string; + + /** Allows additional HTML attributes such as title, name, etc., and accepts n number of attributes in a key-value pair format. + * @Default {{}} + */ + htmlAttributes?: any; + + /** Gets or sets the index of the selected item in the component. + * @Default {null} + */ + index?: number; + + /** Accepts the template design and assigns it to each list item present in the popup. + * @Default {null} + */ + itemTemplate?: string; + + /** Overrides the global culture and localization value for this component. Default global culture is 'en-US'. + * @Default {en-US} + */ + locale?: string; + + /** Accepts the template design and assigns it to popup list of component when no data is available on the component. + * @Default {No Records Found} + */ + noRecordsTemplate?: string; + + /** Accepts the value to be displayed as a watermark text on the component input. + * @Default {null} + */ + placeholder?: string; + + /** Specifies the height of the popup list. + * @Default {300px} + */ + popupHeight?: string|number; + + /** Specifies the width of the popup list. By default, the popup width sets based on the width of the component. + * @Default {100%} + */ + popupWidth?: string|number; + + /** The query to retrieve the data from the data source. + * @Default {null} + */ + query?: ej.Query; + + /** When set to true, the user interactions on the component are disabled. + * @Default {false} + */ + readonly?: boolean; + + /** Specifies whether to show or hide the clear button. When the clear button is clicked, value, text, and index properties are reset to null. + * @Default {true} + */ + showClearButton?: boolean; + + /** Specifies the sortOrder to sort the data source. The available type of sort orders are + * @Default {ej.SortOrder.None} + */ + sortOrder?: ej.ComboBox.SortOrder|string; + + /** Gets or sets the display text of the selected item in the component. + * @Default {null} + */ + text?: string; + + /** Gets or sets the value of the selected item in the component. + * @Default {null} + */ + value?: number|string; + + /** Specifies the width of the component. By default, the component width sets based on the width of its parent container. You can also set the width in pixel values. + * @Default {100%} + */ + width?: number|string; + + /** Triggers before fetching data from the remote server. + */ + actionBegin?(e: ActionBeginEventArgs): void; + + /** Triggers after data is fetched successfully from the remote server. + */ + actionComplete?(e: ActionCompleteEventArgs): void; + + /** Triggers when the data fetch request from the remote server fails. + */ + actionFailure?(e: ActionFailureEventArgs): void; + + /** Triggers when an item in a popup is selected or when the model value is changed. + */ + change?(e: ChangeEventArgs): void; + + /** Triggers when the popup is closed. + */ + close?(e: CloseEventArgs): void; + + /** Triggers when ComboBox widget is created. + */ + create?(e: CreateEventArgs): void; + + /** Triggers on set a custom value to this component. + */ + customValueSpecifier?(e: CustomValueSpecifierEventArgs): void; + + /** Triggers on typing a character in the component. + */ + filtering?(e: FilteringEventArgs): void; + + /** Triggers when the component is focused. + */ + focus?(e: FocusEventArgs): void; + + /** Triggers after the suggestion list is opened. + */ + open?(e: OpenEventArgs): void; + + /** Triggers when an item in the popup is selected. + */ + select?(e: SelectEventArgs): void; + } + + export interface ActionBeginEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the ComboBox model + */ + model?: any; + + /** returns the name of the event + */ + type?: string; + } + + export interface ActionCompleteEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the Autocomplete model + */ + model?: any; + + /** Returns the query for data retrieval from the Database + */ + e?: any; + + /** returns the name of the event + */ + type?: string; + } + + export interface ActionFailureEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the error message + */ + e?: any; + + /** returns the Autocomplete model + */ + model?: any; + + /** returns the name of the event + */ + type?: string; + } + + export interface ChangeEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: boolean; + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + + /** Value of the combobox textbox. + */ + value?: string|number; + + /** Li element of the selected item. + */ + Item?: any; + + /** Event argument. + */ + e?: any; + + /** value of the interaction + */ + isInteracted?: boolean; + } + + export interface CloseEventArgs { + + /** Element of the combobox popup list + */ + popup?: any; + } + + export interface CreateEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: boolean; + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + } + + export interface CustomValueSpecifierEventArgs { + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + + /** text of the combobox. + */ + text?: string; + } + + export interface FilteringEventArgs { + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + + /** text of the combobox. + */ + text?: string; + + /** Function used to update the filtering value. + */ + updateData?: any; + } + + export interface FocusEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: boolean; + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + } + + export interface OpenEventArgs { + + /** Element of the combobox popup list + */ + popup?: any; + } + + export interface SelectEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: boolean; + + /** Instance of the combobox model object. + */ + model?: ej.ComboBox.Model; + + /** Name of the event. + */ + type?: string; + + /** Value of the combobox textbox. + */ + value?: string|number; + + /** Text of the selected item. + */ + text?: string; + + /** Data object of the selected item. + */ + itemData?: ej.ComboBox.Model; + + /** Li element of the selected item. + */ + Item?: any; + + /** Event argument. + */ + e?: any; + + /** value of the interaction + */ + isInteracted?: boolean; + } + + export interface Fields { + + /** Used to group the popup list items. + * @Default {null} + */ + groupBy?: string; + + /** Defines class for the item. + * @Default {null} + */ + iconCss?: string; + + /** Defines the specific field name which contains unique values for the list items. + * @Default {null} + */ + value?: string; + + /** Defines the specific field name in the data source to load the popup list with data. + * @Default {null} + */ + text?: string; + } + + enum SortOrder { + + ///The data source is not sorting. + None, + + ///The data source is sorting with ascending order. + Ascending, + + ///The data source is sorting with descending order. + Descending + } + + } + } declare namespace ej.datavisualization { class SymbolPalette extends ej.Widget { @@ -64066,7 +65027,7 @@ declare namespace ej.datavisualization { historyManager?: HistoryManager; /** Defines the type of the rendering mode of label. - * @Default {Html} + * @Default {HTML} */ labelRenderingMode?: ej.datavisualization.Diagram.LabelRenderingMode|string; @@ -65424,6 +66385,10 @@ declare namespace ej.datavisualization { */ borderWidth?: number; + /** This property allows you to customize sourceDecorator appearance using user-defined CSS. + */ + cssClass?: string; + /** Sets the fill color of the source decorator * @Default {black} */ @@ -65469,6 +66434,10 @@ declare namespace ej.datavisualization { */ borderColor?: string; + /** This property allows you to customize targetDecorator appearance using user-defined CSS. + */ + cssClass?: string; + /** Sets the color with which the decorator will be filled * @Default {black} */ @@ -65516,7 +66485,7 @@ declare namespace ej.datavisualization { */ cornerRadius?: number; - /** Configures the styles of shapes + /** This property allows you to customize connectors appearance using user-defined CSS. */ cssClass?: string; @@ -66213,6 +67182,11 @@ declare namespace ej.datavisualization { */ stops?: any[]; + /** Defines the type of gradient + * @Default {linear} + */ + type?: string; + /** Defines the left most position(relative to node) of the rectangular region that needs to be painted * @Default {0} */ @@ -66236,6 +67210,11 @@ declare namespace ej.datavisualization { export interface NodesGradientRadialGradient { + /** Defines the type of gradient + * @Default {radial} + */ + type?: string; + /** Defines the position of the outermost circle * @Default {0} */ @@ -66350,6 +67329,10 @@ declare namespace ej.datavisualization { */ borderWidth?: number; + /** This property allows you to customize labels appearance using user-defined CSS. + */ + cssClass?: string; + /** Enables or disables the default behaviors of the label. * @Default {ej.datavisualization.Diagram.LabelConstraints.None} */ @@ -66429,6 +67412,10 @@ declare namespace ej.datavisualization { */ rotateAngle?: number; + /** Sets the id of svg/html templates. Applicable, if the node's label is HTML or native. + */ + templateId?: string; + /** Defines the label text */ text?: string; @@ -66471,6 +67458,10 @@ declare namespace ej.datavisualization { export interface NodesLane { + /** This property allows you to customize lanes appearance using user-defined CSS. + */ + cssClass?: string; + /** Defines the width of lane * @Default {0} */ @@ -66623,6 +67614,10 @@ declare namespace ej.datavisualization { */ constraints?: ej.datavisualization.Diagram.PortConstraints|string; + /** This property allows you to customize ports appearance using user-defined CSS. + */ + cssClass?: string; + /** Sets the fill color of the port * @Default {white} */ @@ -66865,7 +67860,7 @@ declare namespace ej.datavisualization { */ cornerRadius?: number; - /** Configures the styles of shapes + /** This property allows you to customize nodes appearance using user-defined CSS. */ cssClass?: string; @@ -67982,10 +68977,10 @@ declare namespace ej.datavisualization { } namespace Diagram { enum LabelRenderingMode { - //Sets the labelRenderingMode as Html - Html, - //Sets the labelRenderingMode as Svg - Svg, + //Sets the labelRenderingMode as HTML + HTML, + //Sets the labelRenderingMode as SVG + SVG, } } namespace Diagram { @@ -68094,7 +69089,7 @@ declare namespace ej.datavisualization { PointerEvents, //Enables contrast between clean edges for the node over rendering speed and geometric precision CrispEdges, - //Enables all node constraints + //Enables default node interactions such as select,delete,drag,rotate,resize,connect,inheritCrispEdges and inheritTooltip Default, } } @@ -68458,8 +69453,8 @@ declare namespace ej.datavisualization { Text, //Used to specify node type as Image Image, - //Used to specify node type as Html - Html, + //Used to specify node type as HTML + HTML, //Used to specify node type as Native Native, //Used to specify node type as Basic @@ -71150,6 +72145,9 @@ interface JQuery { ejColorPicker(options?: ej.ColorPicker.Model): JQuery; ejColorPicker(memberName: any, value?: any, param?: any): any; + ejComboBox(options?: ej.ComboBox.Model): JQuery; + ejComboBox(memberName: any, value?: any, param?: any): any; + ejDatePicker(options?: ej.DatePicker.Model): JQuery; ejDatePicker(memberName: any, value?: any, param?: any): any; @@ -71378,6 +72376,7 @@ interface JQuery { data(key: "ejCheckBox"): ej.CheckBox; data(key: "ejCircularGauge"): ej.datavisualization.CircularGauge; data(key: "ejColorPicker"): ej.ColorPicker; + data(key: "ejComboBox"): ej.ComboBox; data(key: "ejDatePicker"): ej.DatePicker; data(key: "ejDateRangePicker"): ej.DateRangePicker; data(key: "ejDateTimePicker"): ej.DateTimePicker; From af970ce0943dcf7b7fc3668bee48968f449fc2df Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Wed, 10 Jan 2018 18:20:11 +0530 Subject: [PATCH 0026/1348] BOM Error Fixed --- types/ej.web.all/ej.web.all-tests.ts | 2 +- types/ej.web.all/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index 5ab573f418..9fac6f2349 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,4 +1,4 @@ -module AccordionComponent { +module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { width: "100%", diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index bf6d488f6f..c4443b3e70 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ej.web.all 15.4 +// Type definitions for ej.web.all 15.4 // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From dcb830efc73c5b1be97255f7a1d751e7c2c157b9 Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Wed, 10 Jan 2018 19:10:36 +0530 Subject: [PATCH 0027/1348] Lint Error Fixed --- types/ej.web.all/ej.web.all-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index 9fac6f2349..25aab5c06f 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,3 +1,4 @@ +/* tslint:disable */ module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { From 39d8663e2074c15d3bed4b7a1d117ed6ac98b753 Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Wed, 10 Jan 2018 19:18:10 +0530 Subject: [PATCH 0028/1348] Lint Errors Fixed --- types/ej.web.all/ej.web.all-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index 25aab5c06f..9fac6f2349 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,4 +1,3 @@ -/* tslint:disable */ module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { From 1f57a359838901288bc2a816df015f38d273ce7c Mon Sep 17 00:00:00 2001 From: KonstantinKai Date: Fri, 12 Jan 2018 15:59:59 +0200 Subject: [PATCH 0029/1348] in progress --- types/expo/expo-tests.tsx | 81 ++++++- types/expo/index.d.ts | 499 ++++++++++++++++++++++++++++++++------ 2 files changed, 498 insertions(+), 82 deletions(-) diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 386cb41b04..df401ae8e5 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -36,7 +36,7 @@ Amplitude.setUserProperties({key: 1}); Amplitude.clearUserProperties(); Amplitude.logEvent('name'); Amplitude.logEventWithProperties('event', {key: 'value'}); -Amplitude.setGroup('type', {key: 'value'}); +Amplitude.setGroup('type', ['value']); const asset = Asset.fromModule(1); asset.downloadAsync(); @@ -82,8 +82,83 @@ Audio.setAudioModeAsync({ allowsRecordingIOS: true }); Audio.setIsEnabledAsync(true); + +Audio.INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS === 0; +Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX === 1; +Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS === 2; + +Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX === 1; +Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS === 2; + +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_DEFAULT === 0; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_THREE_GPP === 1; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4 === 2; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB === 3; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_WB === 4; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADIF === 5; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS === 6; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_RTP_AVP === 7; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG2TS === 8; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM === 9; + +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_DEFAULT === 0; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB === 1; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_WB === 2; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC === 3; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_HE_AAC === 4; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC_ELD === 5; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS === 6; + +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_LINEARPCM === 'lpcm'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AC3 === 'ac-3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_60958AC3 === 'cac3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLEIMA4 === 'ima4'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC === 'aac '; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4CELP === 'celp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC === 'hvxc'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4TWINVQ === 'twvq'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE3 === 'MAC3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE6 === 'MAC6'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ULAW === 'ulaw'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ALAW === 'alaw'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN === 'QDMC'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN2 === 'QDM2'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QUALCOMM === 'Qclp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER1 === '.mp1'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER2 === '.mp2'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3 === '.mp3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLELOSSLESS === 'alac'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE === 'aach'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_LD === 'aacl'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD === 'aace'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_SBR === 'aacf'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_V2 === 'aacg'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE_V2 === 'aacp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_SPATIAL === 'aacs'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR === 'samr'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR_WB === 'sawb'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AUDIBLE === 'AUDB'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ILBC === 'ilbc'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_DVIINTELIMA === 0x6d730011; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MICROSOFTGSM === 0x6d730031; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AES3 === 'aes3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ENHANCEDAC3 === 'ec-3'; + +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MIN === 0; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_LOW === 0x20; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM === 0x40; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH === 0x60; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX === 0x7f; + +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT === 0; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE === 1; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED === 2; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE === 3; + +Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY; +Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY; async () => { - const result = await Audio.Sound.create('uri', { + const result = await Audio.Sound.create({uri: 'uri'}, { volume: 0.5, rate: 0.6 }, null, true); @@ -99,7 +174,7 @@ async () => { } const _status = await sound.getStatusAsync(); - await sound.loadAsync('uri'); + await sound.loadAsync({uri: 'uri'}); }; () => ( diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 89acb6ac10..0ec21968b2 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/expo/expo-sdk // Definitions by: Konstantin Kai // Martynas Kadiša +// Jan Aagaard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -28,9 +29,7 @@ export type FloatFromZeroToOne = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0 export type BarCodeReadCallback = (params: { type: string; data: string; }) => void; export type Md5 = string; -/** - * Accelerometer - */ +/** Access the device accelerometer sensor(s) to respond to changes in acceleration in 3d space. */ export namespace Accelerometer { interface AccelerometerObject { x: Axis; @@ -38,27 +37,63 @@ export namespace Accelerometer { z: Axis; } + /** + * Subscribe for updates to the accelerometer. + * @param listener A callback that is invoked when an accelerometer update is available. When invoked, the listener is provided a single argumument that is an object containing keys x, y, z. + * @returns An EventSubscription object that you can call remove() on when you would like to unsubscribe the listener. + */ function addListener(listener: (obj: AccelerometerObject) => any): EventSubscription; + + /** Remove all listeners. */ function removeAllListeners(): void; + + /** + * Subscribe for updates to the accelerometer. + * @param intervalMs Desired interval in milliseconds between accelerometer updates. + */ function setUpdateInterval(intervalMs: number): void; } /** - * Amplitude + * Provides access to Amplitude mobile analytics which basically lets you log various events to the Cloud. This module wraps Amplitude’s iOS and Android SDKs. + * + * Note: Session tracking may not work correctly when running Experiences in the main Expo app. It will work correctly if you create a standalone app. */ export namespace Amplitude { + /** Initializes Amplitude with your Amplitude API key. */ function initialize(apiKey: string): void; + + /** Assign a user ID to the current user. If you don’t have a system for user IDs you don’t need to call this. */ function setUserId(userId: string): void; + + /** Set properties for the current user. */ function setUserProperties(userProperties: HashMap): void; + + /** Clear properties set by `setUserProperties()`. */ function clearUserProperties(): void; + + /** Log an event to Amplitude. */ function logEvent(eventName: string): void; - function logEventWithProperties(eventName: string, properties: HashMap): void; - function setGroup(groupType: string, groupNames: HashMap): void; + + /** Log an event to Amplitude with custom properties. */ + function logEventWithProperties( + eventName: string, + + /** A map of custom properties. */ + properties: HashMap + ): void; + + /** Add the current user to a group. */ + function setGroup( + /** The group name, e.g. `'sports'`. */ + groupType: string, + + /** An array of group names, e.g. `['tennis', 'soccer']`. */ + groupNames: string[] + ): void; } -/** - * Asset - */ +/** This module provides an interface to Expo’s asset system. An asset is any file that lives alongside the source code of your app that the app needs at runtime. Examples include images, fonts and sounds. Expo’s asset system integrates with React Native’s, so that you can refer to files with require('path/to/file'). This is how you refer to static image files in React Native for use in an Image component, for example. */ export class Asset { constructor({ name, type, hash, uri, width, height }: { name: string; @@ -68,21 +103,40 @@ export class Asset { width?: number; height?: number; }); + + /** The MD5 hash of the asset’s data. */ + hash: Md5; + + /** The name of the asset file without the extension. Also without the part from @ onward in the filename (used to specify scale factor for images). */ name: string; + + /** The extension of the asset filename. */ type: string; - hash: string; + + /** A URI that points to the asset’s data on the remote server. When running the published version of your app, this refers to the the location on Expo’s asset server where Expo has stored your asset. When running the app from XDE during development, this URI points to XDE’s server running on your computer and the asset is served directly from your computer. */ uri: string; localUri: string; + + /** If the asset is an image, the width of the image data divided by the scale factor. The scale factor is the number after `@` in the filename, or `1` if not present. */ width?: number; + + /** If the asset is an image, the height of the image data divided by the scale factor. The scale factor is the number after `@` in the filename, or `1` if not present. */ height?: number; downloading: boolean; downloaded: boolean; downloadCallbacks: Array<{ resolve: () => any, reject: (e?: any) => any }>; + /** Downloads the asset data to a local file in the device’s cache directory. Once the returned promise is fulfilled without error, the localUri field of this asset points to a local file containing the asset data. The asset is only downloaded if an up-to-date local file for the asset isn’t already present due to an earlier download. */ downloadAsync(): Promise; + /** Returns the `Expo.Asset` instance representing an asset given its module. */ static fromModule(module: RequireSource): Asset; + + /** + * A helper that wraps `Expo.Asset.fromModule(module).downloadAsync` for convenience. + * @param moduleIds An array of `require('path/to/file')`. Can also be just one module without an Array. + */ static loadAsync(module: RequireSource[] | RequireSource): Promise; } @@ -114,6 +168,8 @@ export namespace AuthSession { export type PlaybackStatus = { isLoaded: false; androidImplementation?: string; + + /** Populated exactly once when an error forces the object to unload. */ error?: string; } | { isLoaded: true; @@ -131,6 +187,8 @@ export type PlaybackStatus = { volume: number; isMuted: boolean; isLooping: boolean; + + /** True exactly once when the track plays to finish. */ didJustFinish: boolean; }; @@ -146,38 +204,241 @@ export interface PlaybackStatusToSet { isLooping?: boolean; } -export type Source = string | RequireSource | Asset; +export type PlaybackSource = RequireSource | { uri: string } | Asset; export class PlaybackObject { - loadAsync(source: Source, initialStatus?: PlaybackStatusToSet, downloadFirst?: boolean): Promise; - unloadAsync(): Promise; - getStatusAsync(): Promise; - setOnPlaybackStatusUpdate(onPlaybackStatusUpdate: (status: PlaybackStatus) => void): void; - setStatusAsync(status: PlaybackStatusToSet): Promise; - playAsync(): Promise; - playFromPositionAsync(positionMillis: number): Promise; - pauseAsync(): Promise; - stopAsync(): Promise; - setPositionAsync(positionMillis: number): Promise; - setRateAsync(rate: number, shouldCorrectPitch: boolean): Promise; - setVolumeAsync(volume: number): Promise; - setIsMutedAsync(isMuted: boolean): Promise; - setIsLoopingAsync(isLooping: boolean): Promise; - setProgressUpdateIntervalAsync(progressUpdateIntervalMillis: number): Promise; + /** + * Gets the `PlaybackStatus` of the `playbackObject`. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject`. + */ + getStatusAsync(): Promise + + /** + * Loads the media from source into memory and prepares it for playing. This must be called before calling setStatusAsync() or any of the convenience set status methods. This method can only be called if the playbackObject is in an unloaded state. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once it is loaded, or rejects if loading failed. The `Promise` will also reject if the `playbackObject` was already loaded. See below for details on `PlaybackStatus`. + */ + loadAsync( + /** + * The source of the media. The following forms are supported: + * - A dictionary of the form `{ uri: 'http://path/to/file' }` with a network URL pointing to a media file on the web. + * - `require('path/to/file')` for a media file asset in the source code directory. + * - An `Expo.Asset object` for a media file asset. + */ + source: PlaybackSource, + + /** The initial intended `PlaybackStatusToSet` of the `playbackObject`, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. See below for details on `PlaybackStatusToSet` and the default initial playback status. */ + initialStatus?: PlaybackStatusToSet, + + /** If set to `true`, the system will attempt to download the resource to the device before loading. This value defaults to true. Note that at the moment, this will only work for sources of the form `require('path/to/file')` or `Expo.Asset` objects. */ + downloadFirst?: boolean + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false })`. */ + pauseAsync(): Promise + + /** + * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true })`. + * + * Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the `isPlaying` and `isBuffering` properties of the `PlaybackStatus`. + */ + playAsync(): Promise + + /** + * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true, positionMillis: millis })`. + * + * Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the isPlaying and `isBuffering` properties of the `PlaybackStatus`. + */ + playFromPositionAsync( + /** The desired position of playback in milliseconds. */ + positionMillis: number, + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis, seekMillisToleranceBefore: toleranceMillisBefore, seekMillisToleranceAfter: toleranceMillisAfter })`. The tolerances are used only on iOS. */ + tolerances?: { + toleranceMillisBefore: number, + toleranceMillisAfter: number + } + ): Promise + + /** + * Replays the item. When using `playFromPositionAsync(0)` the item is seeked to the position at `0` ms. On iOS this method uses internal implementation of the player and is able to play the item from the beginning immediately. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once the new status has been set successfully, or rejects if setting the new status failed. + */ + replayAsync( + /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ + status: PlaybackStatusToSet + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ isLooping: value })`. */ + setIsLoopingAsync( + /** A boolean describing if the media should play once (`false`) or loop indefinitely (`true`). */ + isLooping: boolean + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ isMuted: value })`. */ + setIsMutedAsync( + /** A boolean describing if the audio of this media should be muted. */ + isMuted: boolean + ): Promise + + /** + * Sets a function to be called regularly with the `PlaybackStatus` of the `playbackObject`. See below for details on `PlaybackStatus` and an example use case of this function. + * + * `onPlaybackStatusUpdate` will be called whenever a call to the API for this `playbackObject` completes (such as `setStatusAsync()`, `getStatusAsync()`, or `unloadAsync()`), and will also be called at regular intervals while the media is in the loaded state. Set `progressUpdateIntervalMillis` via `setStatusAsync()` or `setProgressUpdateIntervalAsync()` to modify the interval with which `onPlaybackStatusUpdate` is called while loaded. + */ + setOnPlaybackStatusUpdate( + /** A function taking a single parameter `PlaybackStatus`. */ + onPlaybackStatusUpdate?: (status: PlaybackStatus) => void + ): void + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis })`. */ + setPositionAsync( + positionMillis: number, + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis, seekMillisToleranceBefore: toleranceMillisBefore, seekMillisToleranceAfter: toleranceMillisAfter })`. The tolerances are used only on iOS. */ + tolerances?: { + toleranceMillisBefore: number, + toleranceMillisAfter: number + } + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ progressUpdateIntervalMillis: millis })`. */ + setProgressUpdateIntervalAsync( + /** The new minimum interval in milliseconds between calls of `onPlaybackStatusUpdate`. */ + progressUpdateIntervalMillis: number + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ rate: value, shouldCorrectPitch: shouldCorrectPitch })`. */ + setRateAsync( + /** The desired playback rate of the media. This value must be between `0.0` and `32.0`. Only available on Android API version 23 and later and iOS. */ + rate: number, + + /** A boolean describing if we should correct the pitch for a changed rate. If set to `true`, the pitch of the audio will be corrected (so a rate different than `1.0` will timestretch the audio). */ + shouldCorrectPitch: boolean + ): Promise + + /** Sets a new `PlaybackStatusToSet` on the `playbackObject`. This method can only be called if the media has been loaded. Return a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once the new status has been set successfully, or rejects if setting the new status failed. */ + setStatusAsync( + /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ + status: PlaybackStatusToSet + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ volume: value })`. */ + setVolumeAsync( + /** A number between `0.0` (silence) and `1.0` (maximum volume). */ + volume: number + ): Promise + + /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false, positionMillis: 0 })`. */ + stopAsync(): Promise + + /** + * Unloads the media from memory. `loadAsync()` must be called again in order to be able to play the media. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once it is unloaded, or rejects if unloading failed. See below for details on `PlaybackStatus`. + */ + unloadAsync(): Promise } +/** + * Provides basic sample playback and recording. + * + * Note that Expo does not yet support backgrounding, so audio is not available to play in the background of your experience. Audio also automatically stops if headphones / bluetooth audio devices are disconnected. + */ export namespace Audio { - enum InterruptionModeIOS { + enum InterruptionModeIos { + /** This is the default option. If this option is set, your experience’s audio is mixed with audio playing in background apps. */ INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS = 0, + + /** If this option is set, your experience’s audio interrupts audio from other apps. */ INTERRUPTION_MODE_IOS_DO_NOT_MIX = 1, + + /** If this option is set, your experience’s audio lowers the volume ("ducks") of audio from other apps while your audio plays. */ INTERRUPTION_MODE_IOS_DUCK_OTHERS = 2 } + const INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS: 0; + const INTERRUPTION_MODE_IOS_DO_NOT_MIX: 1; + const INTERRUPTION_MODE_IOS_DUCK_OTHERS: 2; + enum InterruptionModeAndroid { + /** If this option is set, your experience’s audio interrupts audio from other apps. */ INTERRUPTION_MODE_ANDROID_DO_NOT_MIX = 1, + + /** This is the default option. If this option is set, your experience’s audio lowers the volume ("ducks") of audio from other apps while your audio plays. */ INTERRUPTION_MODE_ANDROID_DUCK_OTHERS = 2 } + const INTERRUPTION_MODE_ANDROID_DO_NOT_MIX: 1; + const INTERRUPTION_MODE_ANDROID_DUCK_OTHERS: 2; + + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_DEFAULT: 0; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_THREE_GPP: 1; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4: 2; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB: 3; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_WB: 4; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADIF: 5; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS: 6; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_RTP_AVP: 7; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG2TS: 8; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM: 9; + + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_DEFAULT: 0; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB: 1; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_WB: 2; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC: 3; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_HE_AAC: 4; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC_ELD: 5; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS: 6; + + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_LINEARPCM: 'lpcm'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AC3: 'ac-3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_60958AC3: 'cac3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLEIMA4: 'ima4'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC: 'aac '; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4CELP: 'celp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC: 'hvxc'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4TWINVQ: 'twvq'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE3: 'MAC3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE6: 'MAC6'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ULAW: 'ulaw'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ALAW: 'alaw'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN: 'QDMC'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN2: 'QDM2'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QUALCOMM: 'Qclp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER1: '.mp1'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER2: '.mp2'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3: '.mp3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLELOSSLESS: 'alac'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE: 'aach'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_LD: 'aacl'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD: 'aace'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_SBR: 'aacf'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_V2: 'aacg'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE_V2: 'aacp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_SPATIAL: 'aacs'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR: 'samr'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR_WB: 'sawb'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AUDIBLE: 'AUDB'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ILBC: 'ilbc'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_DVIINTELIMA: 0x6d730011; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MICROSOFTGSM: 0x6d730031; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AES3: 'aes3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ENHANCEDAC3: 'ec-3'; + + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MIN: 0; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_LOW: 0x20; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM: 0x40; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH: 0x60; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX: 0x7f; + + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT: 0; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE: 1; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED: 2; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE: 3 + type RecordingStatus = { canRecord: false, isDoneRecording: false @@ -191,27 +452,8 @@ export namespace Audio { durationMillis: number }; - interface AudioMode { - playsInSilentModeIOS: boolean; - allowsRecordingIOS: boolean; - interruptionModeIOS: InterruptionModeIOS; - shouldDuckAndroid: boolean; - interruptionModeAndroid: InterruptionModeAndroid; - } - - function setIsEnabledAsync(value: boolean): Promise; - function setAudioModeAsync(mode: AudioMode): Promise; - - class Sound extends PlaybackObject { - constructor(); - - static create( - source: Source, - initialStatus?: PlaybackStatusToSet, - onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null, - downloadFirst?: boolean - ): Promise<{ sound: Sound, status: PlaybackStatus }>; - } + const RECORDING_OPTIONS_PRESET_HIGH_QUALITY: RecordingOptions + const RECORDING_OPTIONS_PRESET_LOW_QUALITY: RecordingOptions interface RecordingOptions { android: { @@ -238,19 +480,112 @@ export namespace Audio { }; } + interface AudioMode { + /** Boolean selecting if your experience’s audio should play in silent mode on iOS. This value defaults to `false`. */ + playsInSilentModeIOS: boolean; + + /** Boolean selecting if recording is enabled on iOS. This value defaults to `false`. NOTE: when this flag is set to true, playback may be routed to the phone receiver instead of to the speaker. */ + allowsRecordingIOS: boolean; + + /** Enum selecting how your experience’s audio should interact with the audio from other apps on iOS. */ + interruptionModeIOS: InterruptionModeIos; + + /** Boolean selecting if your experience’s audio should automatically be lowered in volume ("duck") if audio from another app interrupts your experience. This value defaults to true. If false, audio from other apps will pause your audio. */ + shouldDuckAndroid: boolean; + + /** an enum selecting how your experience’s audio should interact with the audio from other apps on Android: */ + interruptionModeAndroid: InterruptionModeAndroid; + } + + function setIsEnabledAsync(value: boolean): Promise; + function setAudioModeAsync(mode: AudioMode): Promise; + + /** This class represents a sound corresponding to an Asset or URL. */ + class Sound extends PlaybackObject { + constructor(); + + /** + * Creates and loads a sound from source, with optional `initialStatus`, `onPlaybackStatusUpdate`, and `downloadFirst`. + * + * @returns A `Promise` that is rejected if creation failed, or fulfilled with the following dictionary if creation succeeded: + * - `sound`: The newly created and loaded Sound object. + * - `status`: The PlaybackStatus of the Sound object. See the AV documentation for further information. + */ + static create( + /** + * The source of the sound. The following forms are supported: + * + * - A dictionary of the form `{ uri: 'http://path/to/file' }` with a network URL pointing to an audio file on the web. + * - `require('path/to/file')` for an audio file asset in the source code directory. + * - An `Expo.Asset` object for an audio file asset. + */ + source: PlaybackSource, + + /** The initial intended PlaybackStatusToSet of the sound, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. */ + initialStatus?: PlaybackStatusToSet, + + /** A function taking a single parameter PlaybackStatus. This value defaults to `null` if no parameter is passed. */ + onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null, + + /** If set to true, the system will attempt to download the resource to the device before loading. This value defaults to `true`. Note that at the moment, this will only work for `source`s of the form `require('path/to/file')` or `Asset` objects. */ + downloadFirst?: boolean + ): Promise<{ sound: Sound, status: PlaybackStatus }>; + + + } + class Recording { constructor(); - getStatusAsync(): Promise; - setOnRecordingStatusUpdate(onRecordingStatusUpdate: (status: RecordingStatus) => void): void; - setProgressUpdateInterval(miliss: number): void; - prepareToRecordAsync(options: Recording): Promise; - isPreparedToRecord(): boolean; - startAsync(): Promise; - pauseAsync(): Promise; - stopAndUnloadAsync(): Promise; - getURI(): string | undefined; - createNewLoadedSound(initialStatus: PlaybackStatusToSet, onPlaybackStatusUpdate: (status: PlaybackStatus) => void): Promise<{ sound: Sound, status: PlaybackStatus }>; + /** Gets the `status` of the `Recording`. */ + getStatusAsync(): Promise + + /** Sets a function to be called regularly with the `status` of the `Recording`. */ + setOnRecordingStatusUpdate(onRecordingStatusUpdate?: (status: RecordingStatus) => void): void + + /** Sets the interval with which onRecordingStatusUpdate is called while the recording can record. This value defaults to 500 milliseconds. */ + setProgressUpdateInterval(progressUpdateIntervalMillis: number): void + + /** Loads the recorder into memory and prepares it for recording. This must be called before calling `startAsync()`. This method can only be called if the `Recording` instance has never yet been prepared. */ + prepareToRecordAsync( + /** Options for the recording, including sample rate, bitrate, channels, format, encoder, and extension. If no options are passed to `prepareToRecordAsync()`, the recorder will be created with options `Expo.Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY`. */ + options?: RecordingOptions + ): Promise + + /** Begins recording. This method can only be called if the `Recording` has been prepared. */ + startAsync(): Promise + + /** + * Pauses recording. This method can only be called if the Recording has been prepared. + * + * NOTE: This is only available on Android API version 24 and later. + */ + pauseAsync(): Promise + + /** Stops the recording and deallocates the recorder from memory. This reverts the Recording instance to an unprepared state, and another Recording instance must be created in order to record again. This method can only be called if the `Recording` has been prepared. */ + stopAndUnloadAsync(): Promise + + /** + * Gets the local URI of the Recording. Note that this will only succeed once the Recording is prepared to record. + * + * @returns A string with the local URI of the `Recording`, or `null` if the `Recording` is not prepared to record. + */ + getURI(): string | null | undefined + + /** + * Creates and loads a new `Sound` object to play back the `Recording`. Note that this will only succeed once the `Recording` is done recording (once `stopAndUnloadAsync()` has been called). + * + * @returns A Promise that is rejected if creation failed, or fulfilled with the following dictionary if creation succeeded: + * - `sound`: the newly created and loaded Sound object. + * - `status`: the PlaybackStatus of the Sound object. + */ + createNewLoadedSound( + /** The initial intended `PlaybackStatusToSet` of the sound, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. */ + initialStatus?: PlaybackStatusToSet, + + /** A function taking a single parameter `PlaybackStatus`. This value defaults to `null` if no parameter is passed. */ + onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null + ): Promise<{ sound: Sound, status: PlaybackStatus }> } } @@ -281,7 +616,7 @@ export interface FullscreenUpdateEvent { } export interface VideoProps { - source?: Source | null; + source?: PlaybackSource | null; posterSource?: URISource | RequireSource; resizeMode?: ResizeModeContain | ResizeModeCover | ResizeModeStretch; @@ -328,19 +663,28 @@ export class Video extends Component { static IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS: FullscreenUpdateVariants.IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS; } -/** - * AppLoading - */ -export type AppLoadingProperties = { +/** The following props are recommended, but optional for the sake of backwards compatibility (they were introduced in SDK21). If you do not provide any props, you are responsible for coordinating loading assets, handling errors, and updating state to unmount the `AppLoading` component. */ +export type AppLoadingProps = { + /** A `function` that returns a `Promise`. The `Promise` should resolve when the app is done loading data and assets. */ startAsync: () => Promise; + + /** Required if you provide `startAsync`. Called when `startAsync` resolves or rejects. This should be used to set state and unmount the `AppLoading` component. */ onFinish: () => void; + + /** If `startAsync` throws an error, it is caught and passed into the function provided to `onError`. */ onError?: (error: Error) => void; } | { startAsync: null; onFinish: null; onError?: null; }; -export class AppLoading extends Component { } + +/** + * A React component that tells Expo to keep the app loading screen open if it is the first and only component rendered in your app. When it is removed, the loading screen will disappear and your app will be visible. + * + * This is incredibly useful to let you download and cache fonts, logo and icon images and other assets that you want to be sure the user has on their device for an optimal experience before rendering they start using the app. + */ +export class AppLoading extends Component { } /** * BarCodeScanner @@ -376,10 +720,8 @@ export namespace Brightness { /** * Camera */ -export interface TakePictureOptions { +interface PictureOptions { quality?: number; - base64?: boolean; - exif?: boolean; } export interface PictureResponse { uri: string; @@ -388,19 +730,18 @@ export interface PictureResponse { exif: string; base64: string; } -export interface RecordOptions { - quality?: string; +export interface RecordingOptions { + quality?: string | number; maxDuration?: number; maxFileSize?: number; - mute?: boolean; } export class CameraObject { - takePictureAsync(options: TakePictureOptions): Promise; - recordAsync(options: RecordOptions): Promise<{ uri: string; }>; + takePictureAsync(options: PictureOptions): Promise; + recordAsync(options: RecordingOptions): Promise<{ uri: string; }>; stopRecording(): void; getSupportedRatiosAsync(): Promise; // Android only } -export interface CameraProperties extends ViewProperties { +export interface CameraProps extends ViewProperties { flashMode?: string | number; type?: string | number; ratio?: string; @@ -414,7 +755,7 @@ export interface CameraProperties extends ViewProperties { onBarCodeRead?: BarCodeReadCallback; ref?: Ref; } -export interface CameraConstants { +interface CameraConstants { readonly Type: string; readonly FlashMode: string; readonly AutoFocus: string; @@ -422,7 +763,7 @@ export interface CameraConstants { readonly VideoQuality: string; readonly BarCodeType: string; } -export class Camera extends Component { +export class Camera extends Component { static readonly Constants: CameraConstants; } @@ -1600,7 +1941,7 @@ export namespace FaceDetector { x: Axis; y: Axis; } - interface Face { + interface FaceFeature { bounds: { size: { width: number; @@ -1626,7 +1967,7 @@ export namespace FaceDetector { rollAngle?: number; } interface DetectFaceResult { - faces: Face[]; + faces: FaceFeature[]; image: { uri: string; width: number; @@ -1652,11 +1993,11 @@ export namespace FaceDetector { const Constants: _Constants; - interface Options { + interface DetectionOptions { mode?: keyof Mode; detectLandmarks?: keyof Landmarks; runClassifications?: keyof Classifications; } - function detectFaces(uri: string, options?: Options): Promise; + function detectFaces(uri: string, options?: DetectionOptions): Promise; } From 37e7e7d86b8484429c825910f50820293d39a5a6 Mon Sep 17 00:00:00 2001 From: KonstantinKai Date: Fri, 12 Jan 2018 16:37:05 +0200 Subject: [PATCH 0030/1348] in progress 2 --- types/expo/index.d.ts | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 0ec21968b2..cb991ae6df 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -43,7 +43,7 @@ export namespace Accelerometer { * @returns An EventSubscription object that you can call remove() on when you would like to unsubscribe the listener. */ function addListener(listener: (obj: AccelerometerObject) => any): EventSubscription; - + /** Remove all listeners. */ function removeAllListeners(): void; @@ -65,13 +65,13 @@ export namespace Amplitude { /** Assign a user ID to the current user. If you don’t have a system for user IDs you don’t need to call this. */ function setUserId(userId: string): void; - + /** Set properties for the current user. */ function setUserProperties(userProperties: HashMap): void; - + /** Clear properties set by `setUserProperties()`. */ function clearUserProperties(): void; - + /** Log an event to Amplitude. */ function logEvent(eventName: string): void; @@ -82,7 +82,7 @@ export namespace Amplitude { /** A map of custom properties. */ properties: HashMap ): void; - + /** Add the current user to a group. */ function setGroup( /** The group name, e.g. `'sports'`. */ @@ -93,7 +93,14 @@ export namespace Amplitude { ): void; } -/** This module provides an interface to Expo’s asset system. An asset is any file that lives alongside the source code of your app that the app needs at runtime. Examples include images, fonts and sounds. Expo’s asset system integrates with React Native’s, so that you can refer to files with require('path/to/file'). This is how you refer to static image files in React Native for use in an Image component, for example. */ +/* + * This module provides an interface to Expo’s asset system. + * An asset is any file that lives alongside the source code of your app that the app needs at runtime. + * Examples include images, fonts and sounds. + * Expo’s asset system integrates with React Native’s, + * so that you can refer to files with require('path/to/file'). + * This is how you refer to static image files in React Native for use in an Image component, for example. + */ export class Asset { constructor({ name, type, hash, uri, width, height }: { name: string; @@ -113,7 +120,13 @@ export class Asset { /** The extension of the asset filename. */ type: string; - /** A URI that points to the asset’s data on the remote server. When running the published version of your app, this refers to the the location on Expo’s asset server where Expo has stored your asset. When running the app from XDE during development, this URI points to XDE’s server running on your computer and the asset is served directly from your computer. */ + /* + * A URI that points to the asset’s data on the remote server. + * When running the published version of your app, + * this refers to the the location on Expo’s asset server where Expo has stored your asset. + * When running the app from XDE during development, + * this URI points to XDE’s server running on your computer and the asset is served directly from your computer. + */ uri: string; localUri: string; From 981bf1e3e6218ced9e8e80cdeda00bbce765537e Mon Sep 17 00:00:00 2001 From: KonstantinKai Date: Fri, 12 Jan 2018 17:17:34 +0200 Subject: [PATCH 0031/1348] in progress 3 --- types/expo/index.d.ts | 151 ++++++++++++++++++++++------------------- types/expo/tslint.json | 9 ++- 2 files changed, 89 insertions(+), 71 deletions(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index cb991ae6df..cbb6515a52 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -17,17 +17,17 @@ import { ImageRequireSource } from 'react-native'; -export type URISource = ImageURISource; -export type RequireSource = ImageRequireSource; -export type ResizeModeContain = 'contain'; -export type ResizeModeCover = 'cover'; -export type ResizeModeStretch = 'stretch'; -export type Orientation = 'portrait' | 'landscape'; -export type Axis = number; -export interface HashMap { [key: string]: any; } -export type FloatFromZeroToOne = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; -export type BarCodeReadCallback = (params: { type: string; data: string; }) => void; -export type Md5 = string; +type URISource = ImageURISource; +type RequireSource = ImageRequireSource; +type ResizeModeContain = 'contain'; +type ResizeModeCover = 'cover'; +type ResizeModeStretch = 'stretch'; +type Orientation = 'portrait' | 'landscape'; +type Axis = number; +interface HashMap { [key: string]: any; } +type FloatFromZeroToOne = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; +type BarCodeReadCallback = (params: { type: string; data: string; }) => void; +type Md5 = string; /** Access the device accelerometer sensor(s) to respond to changes in acceleration in 3d space. */ export namespace Accelerometer { @@ -93,14 +93,7 @@ export namespace Amplitude { ): void; } -/* - * This module provides an interface to Expo’s asset system. - * An asset is any file that lives alongside the source code of your app that the app needs at runtime. - * Examples include images, fonts and sounds. - * Expo’s asset system integrates with React Native’s, - * so that you can refer to files with require('path/to/file'). - * This is how you refer to static image files in React Native for use in an Image component, for example. - */ + /** This module provides an interface to Expo’s asset system. An asset is any file that lives alongside the source code of your app that the app needs at runtime. Examples include images, fonts and sounds. Expo’s asset system integrates with React Native’s, so that you can refer to files with require('path/to/file'). This is how you refer to static image files in React Native for use in an Image component, for example. */ export class Asset { constructor({ name, type, hash, uri, width, height }: { name: string; @@ -120,13 +113,7 @@ export class Asset { /** The extension of the asset filename. */ type: string; - /* - * A URI that points to the asset’s data on the remote server. - * When running the published version of your app, - * this refers to the the location on Expo’s asset server where Expo has stored your asset. - * When running the app from XDE during development, - * this URI points to XDE’s server running on your computer and the asset is served directly from your computer. - */ + /** A URI that points to the asset’s data on the remote server. When running the published version of your app, this refers to the the location on Expo’s asset server where Expo has stored your asset. When running the app from XDE during development, this URI points to XDE’s server running on your computer and the asset is served directly from your computer. */ uri: string; localUri: string; @@ -225,7 +212,7 @@ export class PlaybackObject { * * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject`. */ - getStatusAsync(): Promise + getStatusAsync(): Promise; /** * Loads the media from source into memory and prepares it for playing. This must be called before calling setStatusAsync() or any of the convenience set status methods. This method can only be called if the playbackObject is in an unloaded state. @@ -246,17 +233,17 @@ export class PlaybackObject { /** If set to `true`, the system will attempt to download the resource to the device before loading. This value defaults to true. Note that at the moment, this will only work for sources of the form `require('path/to/file')` or `Expo.Asset` objects. */ downloadFirst?: boolean - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false })`. */ - pauseAsync(): Promise + pauseAsync(): Promise; /** * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true })`. * * Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the `isPlaying` and `isBuffering` properties of the `PlaybackStatus`. */ - playAsync(): Promise + playAsync(): Promise; /** * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true, positionMillis: millis })`. @@ -272,7 +259,7 @@ export class PlaybackObject { toleranceMillisBefore: number, toleranceMillisAfter: number } - ): Promise + ): Promise; /** * Replays the item. When using `playFromPositionAsync(0)` the item is seeked to the position at `0` ms. On iOS this method uses internal implementation of the player and is able to play the item from the beginning immediately. @@ -282,19 +269,19 @@ export class PlaybackObject { replayAsync( /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ status: PlaybackStatusToSet - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ isLooping: value })`. */ setIsLoopingAsync( /** A boolean describing if the media should play once (`false`) or loop indefinitely (`true`). */ isLooping: boolean - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ isMuted: value })`. */ setIsMutedAsync( /** A boolean describing if the audio of this media should be muted. */ isMuted: boolean - ): Promise + ): Promise; /** * Sets a function to be called regularly with the `PlaybackStatus` of the `playbackObject`. See below for details on `PlaybackStatus` and an example use case of this function. @@ -304,7 +291,7 @@ export class PlaybackObject { setOnPlaybackStatusUpdate( /** A function taking a single parameter `PlaybackStatus`. */ onPlaybackStatusUpdate?: (status: PlaybackStatus) => void - ): void + ): void; /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis })`. */ setPositionAsync( @@ -315,13 +302,13 @@ export class PlaybackObject { toleranceMillisBefore: number, toleranceMillisAfter: number } - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ progressUpdateIntervalMillis: millis })`. */ setProgressUpdateIntervalAsync( /** The new minimum interval in milliseconds between calls of `onPlaybackStatusUpdate`. */ progressUpdateIntervalMillis: number - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ rate: value, shouldCorrectPitch: shouldCorrectPitch })`. */ setRateAsync( @@ -330,29 +317,29 @@ export class PlaybackObject { /** A boolean describing if we should correct the pitch for a changed rate. If set to `true`, the pitch of the audio will be corrected (so a rate different than `1.0` will timestretch the audio). */ shouldCorrectPitch: boolean - ): Promise + ): Promise; /** Sets a new `PlaybackStatusToSet` on the `playbackObject`. This method can only be called if the media has been loaded. Return a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once the new status has been set successfully, or rejects if setting the new status failed. */ setStatusAsync( /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ status: PlaybackStatusToSet - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ volume: value })`. */ setVolumeAsync( /** A number between `0.0` (silence) and `1.0` (maximum volume). */ volume: number - ): Promise + ): Promise; /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false, positionMillis: 0 })`. */ - stopAsync(): Promise + stopAsync(): Promise; /** * Unloads the media from memory. `loadAsync()` must be called again in order to be able to play the media. * * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once it is unloaded, or rejects if unloading failed. See below for details on `PlaybackStatus`. */ - unloadAsync(): Promise + unloadAsync(): Promise; } /** @@ -450,7 +437,7 @@ export namespace Audio { const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT: 0; const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE: 1; const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED: 2; - const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE: 3 + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE: 3; type RecordingStatus = { canRecord: false, @@ -465,8 +452,8 @@ export namespace Audio { durationMillis: number }; - const RECORDING_OPTIONS_PRESET_HIGH_QUALITY: RecordingOptions - const RECORDING_OPTIONS_PRESET_LOW_QUALITY: RecordingOptions + const RECORDING_OPTIONS_PRESET_HIGH_QUALITY: RecordingOptions; + const RECORDING_OPTIONS_PRESET_LOW_QUALITY: RecordingOptions; interface RecordingOptions { android: { @@ -496,7 +483,7 @@ export namespace Audio { interface AudioMode { /** Boolean selecting if your experience’s audio should play in silent mode on iOS. This value defaults to `false`. */ playsInSilentModeIOS: boolean; - + /** Boolean selecting if recording is enabled on iOS. This value defaults to `false`. NOTE: when this flag is set to true, playback may be routed to the phone receiver instead of to the speaker. */ allowsRecordingIOS: boolean; @@ -539,51 +526,49 @@ export namespace Audio { /** A function taking a single parameter PlaybackStatus. This value defaults to `null` if no parameter is passed. */ onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null, - + /** If set to true, the system will attempt to download the resource to the device before loading. This value defaults to `true`. Note that at the moment, this will only work for `source`s of the form `require('path/to/file')` or `Asset` objects. */ downloadFirst?: boolean ): Promise<{ sound: Sound, status: PlaybackStatus }>; - - } class Recording { constructor(); /** Gets the `status` of the `Recording`. */ - getStatusAsync(): Promise + getStatusAsync(): Promise; /** Sets a function to be called regularly with the `status` of the `Recording`. */ - setOnRecordingStatusUpdate(onRecordingStatusUpdate?: (status: RecordingStatus) => void): void + setOnRecordingStatusUpdate(onRecordingStatusUpdate?: (status: RecordingStatus) => void): void; /** Sets the interval with which onRecordingStatusUpdate is called while the recording can record. This value defaults to 500 milliseconds. */ - setProgressUpdateInterval(progressUpdateIntervalMillis: number): void + setProgressUpdateInterval(progressUpdateIntervalMillis: number): void; /** Loads the recorder into memory and prepares it for recording. This must be called before calling `startAsync()`. This method can only be called if the `Recording` instance has never yet been prepared. */ prepareToRecordAsync( /** Options for the recording, including sample rate, bitrate, channels, format, encoder, and extension. If no options are passed to `prepareToRecordAsync()`, the recorder will be created with options `Expo.Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY`. */ options?: RecordingOptions - ): Promise + ): Promise; /** Begins recording. This method can only be called if the `Recording` has been prepared. */ - startAsync(): Promise + startAsync(): Promise; /** * Pauses recording. This method can only be called if the Recording has been prepared. * * NOTE: This is only available on Android API version 24 and later. */ - pauseAsync(): Promise + pauseAsync(): Promise; /** Stops the recording and deallocates the recorder from memory. This reverts the Recording instance to an unprepared state, and another Recording instance must be created in order to record again. This method can only be called if the `Recording` has been prepared. */ - stopAndUnloadAsync(): Promise + stopAndUnloadAsync(): Promise; /** * Gets the local URI of the Recording. Note that this will only succeed once the Recording is prepared to record. * * @returns A string with the local URI of the `Recording`, or `null` if the `Recording` is not prepared to record. */ - getURI(): string | null | undefined + getURI(): string | null | undefined; /** * Creates and loads a new `Sound` object to play back the `Recording`. Note that this will only succeed once the `Recording` is done recording (once `stopAndUnloadAsync()` has been called). @@ -598,7 +583,7 @@ export namespace Audio { /** A function taking a single parameter `PlaybackStatus`. This value defaults to `null` if no parameter is passed. */ onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null - ): Promise<{ sound: Sound, status: PlaybackStatus }> + ): Promise<{ sound: Sound, status: PlaybackStatus }>; } } @@ -1230,15 +1215,31 @@ export namespace FileSystem { } } -/** - * Fingerprint - */ +/** Use TouchID/FaceID (iOS) or the Fingerprint API (Android) to authenticate the user with a fingerprint scan. */ export namespace Fingerprint { - type FingerprintAuthenticationResult = { success: true } | { success: false, error: string }; + type FingerprintAuthenticationResult = { + success: true + } | { + success: false, + /** Error code in the case where authentication fails. */ + error: string + }; + + /** Determine whether the Fingerprint scanner is available on the device. */ function hasHardwareAsync(): Promise; + + /** Determine whether the device has saved fingerprints to use for authentication. */ function isEnrolledAsync(): Promise; + + /** + * Attempts to authenticate via Fingerprint. Android: When using the fingerprint module on Android, you need to provide a UI component to prompt the user to scan their fingerprint, as the OS has no default alert for it. + * + * @param promptMessage A message that is shown alongside the TouchID/FaceID prompt. (iOS only) + */ function authenticateAsync(promptMessageIOS?: string): Promise; + + /** Cancels the fingerprint authentication flow. (Android only) */ function cancelAuthenticate(): void; } @@ -1298,9 +1299,7 @@ export namespace Google { function logInAsync(config: LogInConfig): Promise; } -/** - * Gyroscope - */ +/** Access the device gyroscope sensor to respond to changes in rotation in 3d space. */ export namespace Gyroscope { interface GyroscopeObject { x: Axis; @@ -1308,8 +1307,13 @@ export namespace Gyroscope { z: Axis; } + /** A callback that is invoked when an gyroscope update is available. */ function addListener(listener: (obj: GyroscopeObject) => any): EventSubscription; + + /** Remove all listeners. */ function removeAllListeners(): void; + + /** Subscribe for updates to the gyroscope. */ function setUpdateInterval(intervalMs: number): void; } @@ -1894,17 +1898,24 @@ export function takeSnapshotAsync( } ): Promise; -/** - * Util - */ +/** Helpful utility functions that don’t fit anywhere else, including some localization and internationalization methods. */ export namespace Util { - function getCurrentDeviceCountryAsync(): Promise; + /** Returns the current device country code. */ + function getCurrentDeviceCountryAsync(): Promise; + + /** Returns the current device locale as a string. */ function getCurrentLocaleAsync(): Promise; + + /** Returns the current device time zone name. */ function getCurrentTimeZoneAsync(): Promise; + + /** Reloads the current experience. This will fetch and load the newest available JavaScript supported by the device’s Expo environment. This is useful for triggering an update of your experience if you have published a new version. */ function reload(): void; + + /** _Android only_. Invokes a callback when a new version of your app is successfully downloaded in the background. */ function addNewVersionListenerExperimental(listener: (event: { manifest: object; - }) => void): { remove(): void; }; // Android only + }) => void): { remove(): void; }; } /** diff --git a/types/expo/tslint.json b/types/expo/tslint.json index 3db14f85ea..b88d2896cb 100644 --- a/types/expo/tslint.json +++ b/types/expo/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false, + "void-return": false, + "max-line-length": false + } +} From b8bfd366985160f8a369903dba972c40b2a17ab8 Mon Sep 17 00:00:00 2001 From: KonstantinKai Date: Fri, 12 Jan 2018 17:28:58 +0200 Subject: [PATCH 0032/1348] in progress 4 --- types/expo/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index cbb6515a52..9d64337918 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -115,6 +115,8 @@ export class Asset { /** A URI that points to the asset’s data on the remote server. When running the published version of your app, this refers to the the location on Expo’s asset server where Expo has stored your asset. When running the app from XDE during development, this URI points to XDE’s server running on your computer and the asset is served directly from your computer. */ uri: string; + + /** If the asset has been downloaded (by calling `downloadAsync()`), the `file://` URI pointing to the local file on the device that contains the asset data. */ localUri: string; /** If the asset is an image, the width of the image data divided by the scale factor. The scale factor is the number after `@` in the filename, or `1` if not present. */ From 40bd25bd96834f880ebb43014555b5543ace9406 Mon Sep 17 00:00:00 2001 From: Carsten Schumann Date: Sat, 13 Jan 2018 14:59:44 +0100 Subject: [PATCH 0033/1348] Added missing parameter format Paper.path also accepts an array of commands instead of a path string. Example: paper.path([ ["M", 5, 10], ["l", 15, 2], ["h", 30], ["Z"] ]); --- types/snapsvg/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index ff0e9d09a9..539036b36c 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -279,6 +279,7 @@ declare namespace Snap { 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; + path(pathSpec:(string | number)[][]):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; From af1e2b71dc65036ef79b70f3bfc53a94c51a1dc1 Mon Sep 17 00:00:00 2001 From: dominuskernel Date: Sun, 14 Jan 2018 18:35:25 +0100 Subject: [PATCH 0034/1348] add methods types to Navigo and update the version --- types/navigo/index.d.ts | 10 +++++++--- types/navigo/navigo-tests.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index 73131a9d72..bb4681dd56 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for navigo 4.0 +// Type definitions for navigo 6.0 // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -20,7 +20,7 @@ interface GenericHooks { after?(params?: Params): void; } -type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses(parametersObj: any): void }; +type RouteHandler = ((params: Params, query: string) => void) | { as: string; uses(params: Params, query: string): void }; declare class Navigo { /** @@ -44,6 +44,8 @@ declare class Navigo { generate(path: string, params?: any): string; + getLinkPath(link: any): any; + resolve(currentURL?: string): boolean; link(path: string): string; @@ -52,9 +54,11 @@ declare class Navigo { disableIfAPINotAvailable(): void; + historyAPIUpdateMethod(method?: string): void; + hooks(hooks: GenericHooks): void; - pause(): void; + pause(change?: boolean): void; resume(): void; diff --git a/types/navigo/navigo-tests.ts b/types/navigo/navigo-tests.ts index 1aeb645ce8..b702df93c8 100644 --- a/types/navigo/navigo-tests.ts +++ b/types/navigo/navigo-tests.ts @@ -56,7 +56,7 @@ router .resolve(); router - .on('/user/:id/:action', (params: { id: string; action: string }) => { + .on('/user/:id/:action', (params: Params) => { // If we have http://site.com/user/42/save as a url then // params.id = 42 // params.action = save @@ -64,7 +64,7 @@ router .resolve(); router - .on('/user/:id/:action', (params: { id: string; action: string }, query: string) => { + .on('/user/:id/:action', (params: Params, query: string) => { // If we have http://site.com/user/42/save?answer=42 as a url then // params.id = 42 // params.action = save @@ -117,6 +117,11 @@ router.pause(); router.navigate('/en/products'); router.resume(); // or .pause(false) +router.pause(); +router.historyAPIUpdateMethod('replaceState'); +router.disableIfAPINotAvailable(); +router.resume(); + router.on( '/user/edit', () => { From d095efb7a653267e49cb0ed451d866b9226bc5cc Mon Sep 17 00:00:00 2001 From: dominuskernel Date: Mon, 15 Jan 2018 02:22:11 +0100 Subject: [PATCH 0035/1348] add type for off method --- Abandonando | 0 Añadiendo | 0 Comprimiendo | 0 Generando | 0 types/navigo/index.d.ts | 2 ++ types/navigo/navigo-tests.ts | 5 +++++ 6 files changed, 7 insertions(+) create mode 100644 Abandonando create mode 100644 Añadiendo create mode 100644 Comprimiendo create mode 100644 Generando diff --git a/Abandonando b/Abandonando new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Añadiendo b/Añadiendo new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Comprimiendo b/Comprimiendo new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Generando b/Generando new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index bb4681dd56..053192b7ec 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -36,6 +36,8 @@ declare class Navigo { on(rootHandler: RouteHandler, hooks?: NavigoHooks): Navigo; + off(handler: { [key: string]: RouteHandler }): void; + notFound(handler: ((query: string) => void), hooks?: NavigoHooks): void; navigate(path: string, absolute?: boolean): void; diff --git a/types/navigo/navigo-tests.ts b/types/navigo/navigo-tests.ts index b702df93c8..d0c162702b 100644 --- a/types/navigo/navigo-tests.ts +++ b/types/navigo/navigo-tests.ts @@ -120,6 +120,11 @@ router.resume(); // or .pause(false) router.pause(); router.historyAPIUpdateMethod('replaceState'); router.disableIfAPINotAvailable(); +router.off({ + '/trip/:number': { + as: 'trip', uses: (params, query) => {} + } +}); router.resume(); router.on( From 23525e579310d8b6327f17320c7d6f4e278c8919 Mon Sep 17 00:00:00 2001 From: dominuskernel Date: Mon, 15 Jan 2018 12:22:28 +0100 Subject: [PATCH 0036/1348] change the off method types --- types/navigo/index.d.ts | 2 +- types/navigo/navigo-tests.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index 053192b7ec..58af71a564 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -36,7 +36,7 @@ declare class Navigo { on(rootHandler: RouteHandler, hooks?: NavigoHooks): Navigo; - off(handler: { [key: string]: RouteHandler }): void; + off(location: string, handler: RouteHandler): void; notFound(handler: ((query: string) => void), hooks?: NavigoHooks): void; diff --git a/types/navigo/navigo-tests.ts b/types/navigo/navigo-tests.ts index d0c162702b..b3094c053f 100644 --- a/types/navigo/navigo-tests.ts +++ b/types/navigo/navigo-tests.ts @@ -120,11 +120,7 @@ router.resume(); // or .pause(false) router.pause(); router.historyAPIUpdateMethod('replaceState'); router.disableIfAPINotAvailable(); -router.off({ - '/trip/:number': { - as: 'trip', uses: (params, query) => {} - } -}); +router.off('/trip/:number', { as: 'trip', uses: (params, query) => {}}); router.resume(); router.on( From 71342f54728f77708666588d78521b7431939168 Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Tue, 16 Jan 2018 15:53:04 +0530 Subject: [PATCH 0037/1348] Lint Error has been fixed --- types/ej.web.all/ej.web.all-tests.ts | 724 +++++++++++++-------------- 1 file changed, 362 insertions(+), 362 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index 9fac6f2349..d2d711fbed 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -18,37 +18,37 @@ module AccordionComponent { }); } -module AutocompleteComponent{ +module AutocompleteComponent { var carList = [ - "Audi S6", "Austin-Healey", "Alfa Romeo", "Aston Martin", - "BMW 7", "Bentley Mulsanne", "Bugatti Veyron", - "Chevrolet Camaro", "Cadillac", - "Duesenberg J", "Dodge Sprinter", - "Elantra", "Excavator", - "Ford Boss 302", "Ferrari 360", "Ford Thunderbird", - "GAZ Siber", - "Honda S2000", "Hyundai Santro", - "Isuzu Swift", "Infiniti Skyline", - "Jaguar XJS", - "Kia Sedona EX", "Koenigsegg Agera", - "Lotus Esprit", "Lamborghini Diablo", - "Mercedes-Benz", "Mercury Coupe", "Maruti Alto 800", - "Nissan Qashqai", - "Oldsmobile S98", "Opel Superboss", - "Porsche 356", "Pontiac Sunbird", - "Scion SRS/SC/SD", "Saab Sportcombi", "Subaru Sambar", "Suzuki Swift", - "Triumph Spitfire", "Toyota 2000GT", - "Volvo P1800", "Volkswagen Shirako" - ]; - $(function () { - var autocompleteInstance =new ej.Autocomplete($("#selectCar"), { + "Audi S6", "Austin-Healey", "Alfa Romeo", "Aston Martin", + "BMW 7", "Bentley Mulsanne", "Bugatti Veyron", + "Chevrolet Camaro", "Cadillac", + "Duesenberg J", "Dodge Sprinter", + "Elantra", "Excavator", + "Ford Boss 302", "Ferrari 360", "Ford Thunderbird", + "GAZ Siber", + "Honda S2000", "Hyundai Santro", + "Isuzu Swift", "Infiniti Skyline", + "Jaguar XJS", + "Kia Sedona EX", "Koenigsegg Agera", + "Lotus Esprit", "Lamborghini Diablo", + "Mercedes-Benz", "Mercury Coupe", "Maruti Alto 800", + "Nissan Qashqai", + "Oldsmobile S98", "Opel Superboss", + "Porsche 356", "Pontiac Sunbird", + "Scion SRS/SC/SD", "Saab Sportcombi", "Subaru Sambar", "Suzuki Swift", + "Triumph Spitfire", "Toyota 2000GT", + "Volvo P1800", "Volkswagen Shirako" + ]; + $(function () { + var autocompleteInstance = new ej.Autocomplete($("#selectCar"), { width: "100%", watermarkText: "Select a car", dataSource: carList, enableAutoFill: true, showPopupButton: true, multiSelectMode: "delimiter" - }); + }); }); } @@ -69,7 +69,7 @@ module Bulletgraphcomponent { isResponsive: true, load: function () { var sender = $("#BulletGraph").data("ejBulletGraph"); - var bulletTheme = window.themeStyle + window.themeColor + window.themeVarient; + var bulletTheme = (window).themeStyle + (window).themeColor + (window).themeVarient; if (bulletTheme) { switch (bulletTheme) { case "flatdark": @@ -82,17 +82,17 @@ module Bulletgraphcomponent { case "gradientsaffrondark": case "flathigh-contrast-01dark": case "flathigh-contrast-02dark": - theme = "flatdark"; + bulletTheme = "flatdark"; break; case "flatoffice-365light": case "flatmateriallight": - theme = "material"; + bulletTheme = "material"; break; default: - theme = "flatlight"; + bulletTheme = "flatlight"; break; } - sender.model.theme = theme; + sender.model.theme = bulletTheme; } }, @@ -246,7 +246,7 @@ module ChartComponent { model.primaryYAxis.labelIntersectAction = "rotate45"; model.primaryYAxis.edgeLabelPlacement = "hide"; } - var theme = window.themeStyle + window.themeColor + window.themeVarient; + var theme = (window).themeStyle + (window).themeColor + (window).themeVarient; if (theme) { switch (theme) { case "flatdark": @@ -288,9 +288,9 @@ module ChartComponent { }, title: { text: 'Efficiency of oil-fired power production' }, size: { height: "600" }, - legend: { visible: true}, - load:"loadTheme" + legend: { visible: true}, }); + chartsample.model.load="loadTheme"; }); } @@ -559,57 +559,55 @@ module ExplorerComponent { }); } - module GanttComponent { - $(function () { - var ganttInstance = new ej.Gantt($("#GanttContainer"), { - dataSource: (window).projectData, - allowColumnResize: true, - allowSorting: true, - allowSelection: true, - enableContextMenu: true, - taskIdMapping: "taskID", - allowDragAndDrop: true, - taskNameMapping: "taskName", - startDateMapping: "startDate", - showColumnChooser: true, - showColumnOptions: true, - progressMapping: "progress", - durationMapping: "duration", - endDateMapping: "endDate", - childMapping: "subtasks", - scheduleStartDate: "02/01/2014", - scheduleEndDate: "04/09/2014", - //Resources mapping - resourceInfoMapping: "resourceId", - resourceNameMapping: "resourceName", - resourceIdMapping: "resourceId", - resources: (window).projectResources, - predecessorMapping: "predecessor", - showResourceNames: true, - toolbarSettings: { - showToolbar: true, - toolbarItems: ["add","edit","delete","update","cancel","indent","outdent","expandAll","collapseAll","search"] - }, - editSettings: { - allowEditing: true, - allowAdding: true, - allowDeleting: true, - allowIndent: true, - editMode: "cellEditing" - }, - sizeSettings: { - width: "100%", - height: "100%" - }, - dragTooltip: { showTooltip: true }, - showGridCellTooltip: true, - treeColumnIndex: 1, - isResponsive: true, + $(function () { + var ganttInstance = new ej.Gantt($("#GanttContainer"), { + dataSource: (window).projectData, + allowColumnResize: true, + allowSorting: true, + allowSelection: true, + enableContextMenu: true, + taskIdMapping: "taskID", + allowDragAndDrop: true, + taskNameMapping: "taskName", + startDateMapping: "startDate", + showColumnChooser: true, + showColumnOptions: true, + progressMapping: "progress", + durationMapping: "duration", + endDateMapping: "endDate", + childMapping: "subtasks", + scheduleStartDate: "02/01/2017", + scheduleEndDate: "04/09/2017", + //Resources mapping + resourceInfoMapping: "resourceId", + resourceNameMapping: "resourceName", + resourceIdMapping: "resourceId", + resources: (window).projectResources, + predecessorMapping: "predecessor", + showResourceNames: true, + toolbarSettings: { + showToolbar: true, + toolbarItems: ["add", "edit", "delete", "update", "cancel", "indent", "outdent", "expandAll", "collapseAll", "search"] + }, + editSettings: { + allowEditing: true, + allowAdding: true, + allowDeleting: true, + allowIndent: true, + editMode: "cellEditing" + }, + sizeSettings: { + width: "100%", + height: "100%" + }, + dragTooltip: { showTooltip: true }, + showGridCellTooltip: true, + treeColumnIndex: 1, + isResponsive: true, + }); }); -}); } - module GridComponent { $(function () { var gridInstance = new ej.Grid($("#Grid"), { @@ -716,7 +714,6 @@ module KanbanComponent { }); } - module lineargaugecomponent { $(function () { var linearsample = new ej.datavisualization.LinearGauge($("#LinearGauge"), { @@ -740,12 +737,15 @@ module lineargaugecomponent { backgroundColor: "#E94649", border: { color: "#E94649" }, startWidth: 4, endWidth: 4 }] - }] + }] }); }); } - + + + + module ListBoxComponent { $(function () { var listboxInstance = new ej.ListBox($("#selectcar"), { @@ -757,7 +757,7 @@ module ListBoxComponent { module ListviewComponent { $(function () { var listviewInstance = new ej.ListView($("#defaultlistview"), { - enableCheckMark: true, + enableCheckMark: true, width: 400 }); }); @@ -1049,43 +1049,43 @@ module PDFViewerComponent { module PivotChartOlap { $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ + var sample = new ej.PivotChart($("#PivotChart"), { dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]" - } - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]" - } - ], - axis: "columns" - } - ], - filters:[] - }, - isResponsive: true,zooming:{enableScrollbar: true}, - commonSeriesOptions: { - type: "column" - }, - size: { height: "460px", width: "100%" }, - primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, - primaryYAxis: { title: { text: "Internet Sales Amount" } }, - legend: { visible: true, rowCount: 2 }, - load:"loadTheme" + data: "http://bi.syncfusion.com/olap/msmdpump.dll", + catalog: "Adventure Works DW 2008 SE", + cube: "Adventure Works", + rows: [ + { + fieldName: "[Date].[Fiscal]" + } + ], + columns: [ + { + fieldName: "[Customer].[Customer Geography]" + } + ], + values: [ + { + measures: [ + { + fieldName: "[Measures].[Internet Sales Amount]" + } + ], + axis: "columns" + } + ], + filters: [] + }, + isResponsive: true, zooming: { enableScrollbar: true }, + commonSeriesOptions: { + type: "column" + }, + size: { height: "460px", width: "100%" }, + primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, + primaryYAxis: { title: { text: "Internet Sales Amount" } }, + legend: { visible: true, rowCount: 2 }, }); + sample.model.load = "loadTheme"; }); } @@ -1120,46 +1120,46 @@ var pivot_dataset = [ module PivotChartRelational { $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ + var sample = new ej.PivotChart($("#PivotChart"), { dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - }, - { - fieldName: "Date", - fieldCaption: "Date" - } - ], - columns: [ - { - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - } - ], - filters:[] - }, - isResponsive: true,zooming:{enableScrollbar: true}, - commonSeriesOptions: { - type: "column" - }, - size: { height: "460px", width: "100%" }, - primaryYAxis: { title: { text: "Amount" } }, - legend: { visible: true }, - load:"loadTheme" + data: pivot_dataset, + rows: [ + { + fieldName: "Country", + fieldCaption: "Country" + }, + { + fieldName: "State", + fieldCaption: "State" + }, + { + fieldName: "Date", + fieldCaption: "Date" + } + ], + columns: [ + { + fieldName: "Product", + fieldCaption: "Product" + } + ], + values: [ + { + fieldName: "Amount", + fieldCaption: "Amount" + } + ], + filters: [] + }, + isResponsive: true, zooming: { enableScrollbar: true }, + commonSeriesOptions: { + type: "column" + }, + size: { height: "460px", width: "100%" }, + primaryYAxis: { title: { text: "Amount" } }, + legend: { visible: true }, }); + sample.model.load = "loadTheme"; }); } @@ -1298,128 +1298,128 @@ var pivot_dataset = [ module PivotGaugeRelational { $(function () { - var sample = new ej.PivotGauge($("#PivotGauge"),{ + var sample = new ej.PivotGauge($("#PivotGauge"), { dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - }, - { - fieldName: "State", - } - ], - columns: [ - { - fieldName: "Product", - } - ], + data: pivot_dataset, + rows: [ + { + fieldName: "Country", + }, + { + fieldName: "State", + } + ], + columns: [ + { + fieldName: "Product", + } + ], values: [ - { - fieldName: "Amount", - }, - { - fieldName: "Quantity", - } - ] - }, + { + fieldName: "Amount", + }, + { + fieldName: "Quantity", + } + ] + }, enableTooltip: true, isResponsive: true, labelFormatSettings: { decimalPlaces: 2 }, - scales: [{ - showRanges: true, - radius: 150, showScaleBar: true, size: 1, + scales: [{ + showRanges: true, + radius: 150, showScaleBar: true, size: 1, border: { - width: 0.5 - }, - showIndicators: true, showLabels: true, - pointers: [{ - showBackNeedle: true, - backNeedleLength: 20, - length: 120, - width: 7 + width: 0.5 }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], + showIndicators: true, showLabels: true, + pointers: [{ + showBackNeedle: true, + backNeedleLength: 20, + length: 120, + width: 7 + }, + { + type: "marker", + markerType: "diamond", + distanceFromScale: 5, + placement: "center", + backgroundColor: "#29A4D9", + length: 25, + width: 15 + }], ticks: [{ - type: "major", + type: "major", distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, - { - type: "minor", - height: 6, - width: 1, - distanceFromScale: 2, - color: "#8c8c8c" - }], + height: 16, + width: 1, color: "#8c8c8c" + }, + { + type: "minor", + height: 6, + width: 1, + distanceFromScale: 2, + color: "#8c8c8c" + }], labels: [{ color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -5, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -5 }], - customLabels: [{ - position: { x: 180, y: 290 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" + ranges: [{ + distanceFromScale: -5, + backgroundColor: "#fc0606", + border: { color: "#fc0606" } }, - { - position: { x: 180, y: 320 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" + { + distanceFromScale: -5 + }], + customLabels: [{ + position: { x: 180, y: 290 }, + font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" }, - { - position: { x: 180, y: 150 }, - font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }] + { + position: { x: 180, y: 320 }, + font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" + }, + { + position: { x: 180, y: 150 }, + font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" + }] }] }); - }); + }); } module PivotGridOlap { $(function () { - var sample = new ej.PivotGrid($("#PivotGrid"),{ + var sample = new ej.PivotGrid($("#PivotGrid"), { dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]" - } - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]", - } - ], - axis: "columns" - } - ], - filters:[] - }, - enableGroupingBar: true, - pivotTableFieldListID:"PivotSchemaDesigner" + data: "http://bi.syncfusion.com/olap/msmdpump.dll", + catalog: "Adventure Works DW 2008 SE", + cube: "Adventure Works", + rows: [ + { + fieldName: "[Date].[Fiscal]" + } + ], + columns: [ + { + fieldName: "[Customer].[Customer Geography]" + } + ], + values: [ + { + measures: [ + { + fieldName: "[Measures].[Internet Sales Amount]", + } + ], + axis: "columns" + } + ], + filters: [] + }, + enableGroupingBar: true, + pivotTableFieldListID: "PivotSchemaDesigner" }); $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); }); @@ -1454,41 +1454,41 @@ var pivot_dataset = [ module PivotGridRelational { $(function () { - var sample = new ej.PivotGrid($("#PivotGrid"),{ + var sample = new ej.PivotGrid($("#PivotGrid"), { dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - } - ], - columns: - [{ - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - }, - { - fieldName: "Quantity", - fieldCaption: "Quantity" - } - ], - filters:[] - }, - enableGroupingBar: true, - pivotTableFieldListID:"PivotSchemaDesigner" + data: pivot_dataset, + rows: [ + { + fieldName: "Country", + fieldCaption: "Country" + }, + { + fieldName: "State", + fieldCaption: "State" + } + ], + columns: + [{ + fieldName: "Product", + fieldCaption: "Product" + } + ], + values: [ + { + fieldName: "Amount", + fieldCaption: "Amount" + }, + { + fieldName: "Quantity", + fieldCaption: "Quantity" + } + ], + filters: [] + }, + enableGroupingBar: true, + pivotTableFieldListID: "PivotSchemaDesigner" }); - $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); + $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); }); } @@ -1655,7 +1655,7 @@ module rangecomponent { }, loaded: function () { var sender = $("#RangeNavigator").data("ejRangeNavigator"); - var theme = window.themeStyle + window.themeColor + window.themeVarient; + var theme = (window).themeStyle + (window).themeColor + (window).themeVarient; if (theme) { switch (theme) { case "flatazurelight": @@ -1747,7 +1747,7 @@ function GetData() { module RatingComponent { $(function () { - var sample1 = new ej.Rating($("#fullRating"),{ + var sample1 = new ej.Rating($("#fullRating"), { value: 4, precision: ej.Rating.Precision.Full, allowReset: true, @@ -1762,8 +1762,8 @@ module RatingComponent { shapeWidth: 25, showTooltip: true }); - - var sample2 = new ej.Rating($("#halfRating"),{ + + var sample2 = new ej.Rating($("#halfRating"), { precision: ej.Rating.Precision.Half, value: 3.5, allowReset: true, @@ -1779,7 +1779,7 @@ module RatingComponent { showTooltip: true }); - var sample3 = new ej.Rating($("#exactRating"),{ + var sample3 = new ej.Rating($("#exactRating"), { precision: ej.Rating.Precision.Exact, value: 3.7, allowReset: true, @@ -1793,7 +1793,7 @@ module RatingComponent { shapeHeight: 25, shapeWidth: 25, showTooltip: true - }); + }); }); } @@ -1822,7 +1822,7 @@ module RibbonComponent { toolTip: "Pin the Ribbon" }, applicationTab: { - type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } + type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } }, tabs: [{ id: "home", text: "HOME", groups: [{ @@ -1846,7 +1846,7 @@ module RibbonComponent { } }] }, - { + { text: "Clipboard", alignType: ej.Ribbon.AlignType.Columns, content: [{ groups: [{ id: "paste", @@ -1868,8 +1868,8 @@ module RibbonComponent { height: 70 } }, - { - groups: [{ + { + groups: [{ id: "cut", text: "Cut", toolTip: "Cut", @@ -1899,14 +1899,14 @@ module RibbonComponent { prefixIcon: "e-icon e-ribbon clearAll" } }], - defaults: { + defaults: { type: "button", width: 60, isBig: false } - }] - }, - { + }] + }, + { text: "Font", alignType: "rows", content: [{ groups: [{ id: "fontfamily", @@ -2205,7 +2205,7 @@ module RibbonComponent { groups: [{ id: "zoomin", text: "Zoom In", - toolTip: "Zoom In", + toolTip: "Zoom In", buttonSettings: { width: 58, click: "onClick", @@ -2217,7 +2217,7 @@ module RibbonComponent { { id: "zoomout", text: "Zoom Out", - toolTip: "Zoom Out", + toolTip: "Zoom Out", buttonSettings: { width: 70, click: "onClick", @@ -2229,7 +2229,7 @@ module RibbonComponent { { id: "fullscreen", text: "Full Screen", - toolTip: "Full Screen", + toolTip: "Full Screen", buttonSettings: { width: 73, click: "onClick", @@ -2245,7 +2245,7 @@ module RibbonComponent { } }] }] - },{ + }, { id: "insert", text: "INSERT", groups: [{ text: "Tables", alignType: ej.Ribbon.AlignType.Columns, content: [{ groups: [{ @@ -2390,7 +2390,7 @@ module RibbonComponent { } ], defaults: { - type: "button", + type: "button", width: 70, height: 70 } @@ -2472,8 +2472,8 @@ module RibbonComponent { } ] } - ], - create: function createControl(args) { + ], + create: function createControl(args: any) { var ribbon = $("#defaultRibbon").data("ejRibbon"); $("#fontcolor").ejColorPicker({ value: "#FFFF00", modelType: "palette", cssClass: "e-ribbon", toolIcon: "e-fontcoloricon", select: colorHandler }); $("#fillcolor").ejColorPicker({ value: "#FF0000", modelType: "palette", cssClass: "e-ribbon", toolIcon: "e-fillcoloricon", select: colorHandler }); @@ -2658,7 +2658,7 @@ module ScheduleComponent { } }); }); -} +} module ScrollerComponent { $(function () { @@ -2828,7 +2828,6 @@ module piesparkline4 { }); } - module SplitterComponent { @@ -2846,6 +2845,7 @@ module SplitterComponent { }); } + module SpreadsheetComponent { $(function () { var sample = new ej.Spreadsheet($("#basicSpreadsheet"), { @@ -2861,7 +2861,7 @@ $(function () { pdfUrl: (window).baseurl + "api/Spreadsheet/PdfExport" }, sheets: [{ rangeSettings: [{ dataSource: (window).defaultData, startCell: "A1" }] }], - loadComplete: () => { + loadComplete:() => { var spreadsheet = $("#basicSpreadsheet").data("ejSpreadsheet"), xlFormat = spreadsheet.XLFormat; if (!(spreadsheet).isImport) { spreadsheet.setWidthToColumns([140, 128, 105, 100, 100, 110, 120, 120, 100]); @@ -2882,13 +2882,13 @@ var default_data: Array = [ { Category : "Employees", Country : "USA", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 70 }, { Category : "Employees", Country : "USA", JobDescription : "Management", EmployeesCount : 40 }, { Category : "Employees", Country : "USA", JobDescription : "Accounts", EmployeesCount : 60 }, - + { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 43 }, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 125}, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 60 }, { Category : "Employees", Country : "India", JobDescription : "HR Executives", EmployeesCount : 70 }, { Category : "Employees", Country : "India", JobDescription : "Accounts", EmployeesCount : 45 }, - + { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Executive", EmployeesCount : 30 }, { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Analyst", EmployeesCount : 40 }, { Category : "Employees", Country : "Germany", JobDescription : "Marketing", EmployeesCount : 50 }, @@ -2897,7 +2897,7 @@ var default_data: Array = [ { Category : "Employees", Country : "Germany", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, { Category : "Employees", Country : "Germany", JobDescription : "Management", EmployeesCount : 33 }, { Category : "Employees", Country : "Germany", JobDescription : "Accounts", EmployeesCount : 55 }, - + { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 45 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 96 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 55 }, @@ -2913,22 +2913,22 @@ var default_data: Array = [ module sunburstcomponent { $(function () { var sunburstsample = new ej.SunburstChart($("#Sunburst"), { - valueMemberPath: "EmployeesCount", + valueMemberPath: "EmployeesCount", levels: [ - {groupMemberPath: "Country"}, - {groupMemberPath: "JobDescription"}, - {groupMemberPath: "JobGroup"}, - {groupMemberPath: "JobRole"} + { groupMemberPath: "Country" }, + { groupMemberPath: "JobDescription" }, + { groupMemberPath: "JobGroup" }, + { groupMemberPath: "JobRole" } ], dataSource: default_data, - dataLabelSettings:{visible:true}, - tooltip:{visible:false}, - enableAnimation:false, - size:{height:"600"}, - innerRadius:0.2, + dataLabelSettings: { visible: true }, + tooltip: { visible: false }, + enableAnimation: false, + size: { height: "600" }, + innerRadius: 0.2, load: function () { var sender = $("#Sunburst").data("ejSunburstChart"); - var SunBurstTheme = window.themeStyle + window.themeColor + window.themeVarient; + var SunBurstTheme = (window).themeStyle + (window).themeColor + (window).themeVarient; SunBurstTheme = SunBurstTheme.toString(); if (SunBurstTheme.indexOf("dark") > -1 || SunBurstTheme.indexOf("contrast") > -1) SunBurstTheme = "flatdark"; @@ -2936,11 +2936,11 @@ module sunburstcomponent { SunBurstTheme = "flatlight"; sender.model.theme = SunBurstTheme; }, - title:{text:"Employees Count"}, - zoomSettings:{enable:false}, - legend:{visible:true,position:'top'}, - load:"loadTheme" + title: { text: "Employees Count" }, + zoomSettings: { enable: false }, + legend: { visible: true, position: 'top' }, }); + sunburstsample.model.load = "loadTheme"; }); } @@ -3051,27 +3051,27 @@ module TileViewComponent { tileSize:"small", imageUrl:'content/images/tile/windows/camera.png', }); - var tile5 = new ej.Tile($("#tile5"), { - imagePosition:"center", - tileSize:"small", - imageUrl:'content/images/tile/windows/messages.png', + var tile5 = new ej.Tile($("#tile5"), { + imagePosition: "center", + tileSize: "small", + imageUrl: 'content/images/tile/windows/messages.png', }); - var tile6 = new ej.Tile($("#tile6"), { - imagePosition:"center", - tileSize:"medium", - imageUrl:'content/images/tile/windows/games.png', - caption:{text:"Play"} + var tile6 = new ej.Tile($("#tile6"), { + imagePosition: "center", + tileSize: "medium", + imageUrl: 'content/images/tile/windows/games.png', + caption: { text: "Play" } }); - var tile7 = new ej.Tile($("#tile7"), { - tileSize:"medium", - imageUrl:'content/images/tile/windows/map.png', - caption:{text:"Maps"} + var tile7 = new ej.Tile($("#tile7"), { + tileSize: "medium", + imageUrl: 'content/images/tile/windows/map.png', + caption: { text: "Maps" } }); - var tile8 = new ej.Tile($("#tile8"), { - imagePosition:"fill", - tileSize:"wide", - imageUrl:'content/images/tile/windows/sports.png', - caption:{text:"Sports"} + var tile8 = new ej.Tile($("#tile8"), { + imagePosition: "fill", + tileSize: "wide", + imageUrl: 'content/images/tile/windows/sports.png', + caption: { text: "Sports" } }); var tile9 = new ej.Tile($("#tile9"), { imagePosition:"fill", @@ -3114,13 +3114,13 @@ module TimePickerComponent { } module ToolbarComponent { - + $(function () { - var sample = new ej.Toolbar($("#editingToolbar"),{ + var sample = new ej.Toolbar($("#editingToolbar"), { width: "100%", cssClass: "gradient-lime", enableSeparator: true, - + isResponsive: true, orientation: ej.Orientation.Horizontal, showRoundedCorner: true @@ -3130,10 +3130,10 @@ module ToolbarComponent { } module TooltipComponent { - + $(function () { - var sample1 = new ej.Tooltip($("#link1"),{ + var sample1 = new ej.Tooltip($("#link1"), { content: "ECMAScript (or ES) is a trademarked scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262.", associate: "mousefollow", autoCloseTimeout: 5000, @@ -3143,7 +3143,7 @@ module TooltipComponent { showShadow: true }); - var sample2 = new ej.Tooltip($("#link2"),{ + var sample2 = new ej.Tooltip($("#link2"), { content: "The World Wide Web (WWW) is an information space where documents and other web resources are identified by URLs, interlinked by hypertext links, and can be accessed via the Internet.", position: { stem: { @@ -3162,7 +3162,7 @@ module TooltipComponent { showShadow: true }); - var sample3 = new ej.Tooltip($("#link3"),{ + var sample3 = new ej.Tooltip($("#link3"), { content: 'Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic.', position: { stem: { @@ -3223,7 +3223,7 @@ module TreeGridComponent { isResponsive: true, }); }); -} +} var population_data: Array = [ @@ -3264,7 +3264,7 @@ module treemapcomponent { }); } - + module TreeViewComponent { $(function () { @@ -3278,9 +3278,9 @@ module TreeViewComponent { } module UploadboxComponent { - + $(function () { - var sample = new ej.Uploadbox($("#UploadDefault"),{ + var sample = new ej.Uploadbox($("#UploadDefault"), { saveUrl: (window).baseurl + "api/uploadbox/Save", removeUrl: (window).baseurl + "api/uploadbox/Remove", buttonText: { From d6911fcd631a18f20094de3d70c658fe1c61aca6 Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Tue, 16 Jan 2018 16:27:23 +0530 Subject: [PATCH 0038/1348] Lint Error resolved. --- types/ej.web.all/ej.web.all-tests.ts | 148 +++++++++++++-------------- 1 file changed, 73 insertions(+), 75 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index d2d711fbed..cf656fc20b 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -180,12 +180,12 @@ module ChartComponent { range: { min: 25, max: 50, interval: 5 }, labelFormat: "{value}%", title: { text: "Efficiency" }, - + }, commonSeriesOptions: - { + { type: 'line', enableAnimation: true, - tooltip:{ visible :true, template:'Tooltip'}, + tooltip: { visible: true, template: 'Tooltip' }, marker: { shape: 'circle', @@ -195,30 +195,30 @@ module ChartComponent { }, visible: true }, - border : {width: 2} - }, - series: - [ - { - points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },{ x: 2007, y: 26 }, { x: 2008, y: 27 }, - { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], - name: 'India' - }, + border: { width: 2 } + }, + series: + [ { - points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },{ x: 2007, y: 30 }, { x: 2008, y: 36 }, - { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], - name: 'Germany' + points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 }, { x: 2007, y: 26 }, { x: 2008, y: 27 }, + { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], + name: 'India' }, - { - points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 },{ x: 2007, y: 34 }, { x: 2008, y: 41 }, - { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], - name: 'England' - }, { - points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 },{ x: 2007, y: 40 }, { x: 2008, y: 44 }, - { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], - name: 'France' - } + points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 }, { x: 2007, y: 30 }, { x: 2008, y: 36 }, + { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], + name: 'Germany' + }, + { + points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 }, { x: 2007, y: 34 }, { x: 2008, y: 41 }, + { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], + name: 'England' + }, + { + points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 }, { x: 2007, y: 40 }, { x: 2008, y: 44 }, + { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], + name: 'France' + } ], isResponsive: true, load: function () { @@ -283,14 +283,13 @@ module ChartComponent { theme = "flatlight"; break; } - sender.model.theme = theme; + sender.model.theme = theme; } }, title: { text: 'Efficiency of oil-fired power production' }, size: { height: "600" }, - legend: { visible: true}, + legend: { visible: true }, }); - chartsample.model.load="loadTheme"; }); } @@ -340,7 +339,7 @@ module circulargaugecomponent { backgroundColor: "#f5b43f", border: { color: "#f5b43f" } }] - }] + }] }); }); } @@ -353,21 +352,21 @@ module ColorPickerComponent { }); } -module ComboBoxComponent{ +module ComboBoxComponent { var BikeList = [ { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, { empid: "bk4", text: "Discover" }, { empid: "bk5", text: "Dazzler" }, { empid: "bk6", text: "Flame" }, { empid: "bk7", text: "Fazzer" }, { empid: "bk8", text: "FZ-S" }, { empid: "bk9", text: "Pulsar" }, { empid: "bk10", text: "Shine" }, { empid: "bk11", text: "R15" }, { empid: "bk12", text: "Unicorn" } ]; - $(function () { - var comboboxInstance =new ej.ComboBox($("#selectCar"), { + $(function () { + var comboboxInstance = new ej.ComboBox($("#selectCar"), { width: "100%", placeholder: "Select a Bike", - fields: { text: "text", value: "empid" }, + fields: { text: "text", value: "empid" }, dataSource: BikeList, autofill: true - }); + }); }); } @@ -428,7 +427,8 @@ $(function () { }), createNode({ name: "Project", width: 150, height: 100, offsetX: 300, offsetY: 430, labels: [createLabel({ "text": "Find Project \nmanager" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Decision }), createNode({ - name: "End", width: 150, height: 60, offsetX: 300, offsetY: 555, labels: [createLabel({ "text": "Implement and Deliver" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Process }), + name: "End", width: 150, height: 60, offsetX: 300, offsetY: 555, labels: [createLabel({ "text": "Implement and Deliver" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Process + }), createNode({ name: "Decision", width: 250, height: 60, offsetX: 550, offsetY: 60, labels: [createLabel({ "text": "Decision Process for new software ideas" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Card, fillColor: "#858585", borderColor: "#858585" }), createNode({ name: "Reject", width: 150, height: 60, offsetX: 550, offsetY: 285, labels: [createLabel({ "text": "Reject and write report" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Process }), createNode({ name: "Resources", width: 150, height: 60, offsetX: 550, offsetY: 430, labels: [createLabel({ "text": "Hire new resources" })], type: "flow", shape: ej.datavisualization.Diagram.FlowShapes.Process }) @@ -442,7 +442,7 @@ $(function () { createConnector({ name: "connector6", sourceNode: "Project", targetNode: "Resources", labels: [createLabel({ "text": "No" })] }) ] }); - + }); function createNode(option: ej.datavisualization.Diagram.Node) { @@ -513,7 +513,7 @@ module digitalgaugecomponent { } - + module DropDownListComponent { var BikeList = [ { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, @@ -530,12 +530,12 @@ module DropDownListComponent { enableFilterSearch: true, caseSensitiveSearch: true, enableIncrementalSearch: true, - enablePopupResize: true, + enablePopupResize: true, delimiterChar: ";", multiSelectMode: ej.MultiSelectMode.Delimiter, maxPopupHeight: "300px", - minPopupHeight: "150px", - maxPopupWidth: "500px", + minPopupHeight: "150px", + maxPopupWidth: "500px", minPopupWidth: "350px", showCheckbox: true, showRoundedCorner: true @@ -1085,7 +1085,6 @@ module PivotChartOlap { primaryYAxis: { title: { text: "Internet Sales Amount" } }, legend: { visible: true, rowCount: 2 }, }); - sample.model.load = "loadTheme"; }); } @@ -1159,7 +1158,6 @@ module PivotChartRelational { primaryYAxis: { title: { text: "Amount" } }, legend: { visible: true }, }); - sample.model.load = "loadTheme"; }); } @@ -1218,15 +1216,15 @@ module PivotGaugeOlap { length: 120, width: 7 }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], + { + type: "marker", + markerType: "diamond", + distanceFromScale: 5, + placement: "center", + backgroundColor: "#29A4D9", + length: 25, + width: 15 + }], ticks: [{ type: "major", distanceFromScale: 2, @@ -1247,7 +1245,7 @@ module PivotGaugeOlap { distanceFromScale: -5, backgroundColor: "#fc0606", border: { color: "#fc0606" } - }, + }, { distanceFromScale: -5 }], @@ -1265,7 +1263,7 @@ module PivotGaugeOlap { }] }] }); - }); + }); } @@ -2484,7 +2482,7 @@ module RibbonComponent { function colorHandler(args:any) { (this._id.indexOf("fillcolor") != -1) ? $("#contenteditor").css('background-color', args.value) : document.execCommand('forecolor', false, args.value); } -function onClick(args) { +function onClick(args: any) { var val, prop = args.text; val = (ej.isNullOrUndefined(args.model.text)) ? args.model.activeText : args.model.text; if (action1.indexOf(val) != -1) @@ -2861,14 +2859,15 @@ $(function () { pdfUrl: (window).baseurl + "api/Spreadsheet/PdfExport" }, sheets: [{ rangeSettings: [{ dataSource: (window).defaultData, startCell: "A1" }] }], - loadComplete:() => { - var spreadsheet = $("#basicSpreadsheet").data("ejSpreadsheet"), xlFormat = spreadsheet.XLFormat; - if (!(spreadsheet).isImport) { - spreadsheet.setWidthToColumns([140, 128, 105, 100, 100, 110, 120, 120, 100]); - xlFormat.format({ "style": { "font-weight": "bold" } }, "A1:H1"); - xlFormat.format({ "type": "currency" }, "E2:H11"); - spreadsheet.XLRibbon.updateRibbonIcons(); - }} + loadComplete: () => { + var spreadsheet = $("#basicSpreadsheet").data("ejSpreadsheet"), xlFormat = spreadsheet.XLFormat; + if (!(spreadsheet).isImport) { + spreadsheet.setWidthToColumns([140, 128, 105, 100, 100, 110, 120, 120, 100]); + xlFormat.format({ "style": { "font-weight": "bold" } }, "A1:H1"); + xlFormat.format({ "type": "currency" }, "E2:H11"); + spreadsheet.XLRibbon.updateRibbonIcons(); + } + } }); }); } @@ -2903,7 +2902,7 @@ var default_data: Array = [ { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 55 }, { Category : "Employees", Country : "UK", JobDescription : "HR Executives", EmployeesCount : 60 }, { Category : "Employees", Country : "UK", JobDescription: "Accounts", EmployeesCount: 30 }, - + { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 40 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 65 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, @@ -2940,7 +2939,6 @@ module sunburstcomponent { zoomSettings: { enable: false }, legend: { visible: true, position: 'top' }, }); - sunburstsample.model.load = "loadTheme"; }); } @@ -3036,20 +3034,20 @@ module TileViewComponent { tileSize:"medium", imageUrl:'content/images/tile/windows/people_1.png' }); - var tile2 = new ej.Tile($("#tile2"), { - imagePosition:"center", - tileSize:"small", - imageUrl:'content/images/tile/windows/alerts.png', - + var tile2 = new ej.Tile($("#tile2"), { + imagePosition: "center", + tileSize: "small", + imageUrl: 'content/images/tile/windows/alerts.png', + }); - var tile3 = new ej.Tile($("#tile3"), { - imagePosition:"center", - tileSize:"small", - imageUrl:'content/images/tile/windows/bing.png', + var tile3 = new ej.Tile($("#tile3"), { + imagePosition: "center", + tileSize: "small", + imageUrl: 'content/images/tile/windows/bing.png', }); - var tile4 = new ej.Tile($("#tile4"), { - tileSize:"small", - imageUrl:'content/images/tile/windows/camera.png', + var tile4 = new ej.Tile($("#tile4"), { + tileSize: "small", + imageUrl: 'content/images/tile/windows/camera.png', }); var tile5 = new ej.Tile($("#tile5"), { imagePosition: "center", From c27b6a3a26d1a72d579d07b35c603c61655f4edf Mon Sep 17 00:00:00 2001 From: Syncfusion-JavaScript Date: Tue, 16 Jan 2018 16:40:29 +0530 Subject: [PATCH 0039/1348] Lint Error Resolved --- types/ej.web.all/ej.web.all-tests.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index cf656fc20b..9ccc1ca9f9 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -2956,8 +2956,6 @@ module TabComponent { } module TagCloudComponent { - - var websiteCollection = [ { text: "Google", url: "http://www.google.com", frequency: 12 }, { text: "All Things Digital", url: "http://allthingsd.com/", frequency: 3 }, @@ -2988,7 +2986,6 @@ module TagCloudComponent { text: "text", url: "url", frequency: "frequency" } }); - }); } From 38d5845a1e870110a612d642879b8177b482013b Mon Sep 17 00:00:00 2001 From: foxmicha Date: Tue, 16 Jan 2018 09:32:07 -0500 Subject: [PATCH 0040/1348] Update React-Native Modal prop typings Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/facebook/react-native/blob/master/Libraries/Modal/Modal.js#L161 Additional info: Just like the onShow optional prop, the Modal's onOrientationChange prop can capture a NativeSyntheticEvent at the time of the hardware change. This allows the developer to determine if the orientation change was to the landscape or portrait style and react accordingly. --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 7368241a9e..86cd2c59f4 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -4363,7 +4363,7 @@ export interface ModalProperties { * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation. * @platform ios */ - onOrientationChange?: () => void; + onOrientationChange?: (event?: NativeSyntheticEvent) => void; /** * The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed. * @platform ios From 534e06cf2df2d7da00fea92e91bb54b385ca3691 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 07:32:55 -0800 Subject: [PATCH 0041/1348] xterm: Provides its own types (#22869) --- notNeededPackages.json | 6 ++ types/xterm/index.d.ts | 96 --------------------------- types/xterm/tsconfig.json | 24 ------- types/xterm/tslint.json | 79 ----------------------- types/xterm/xterm-tests.ts | 129 ------------------------------------- 5 files changed, 6 insertions(+), 328 deletions(-) delete mode 100644 types/xterm/index.d.ts delete mode 100644 types/xterm/tsconfig.json delete mode 100644 types/xterm/tslint.json delete mode 100644 types/xterm/xterm-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 8f3270392f..b193a7fa83 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1530,6 +1530,12 @@ "sourceRepoURL": "github.com/node-xmpp/node-xmpp/", "asOfVersion": "1.2.0" }, + { + "libraryName": "xterm.js", + "typingsPackageName": "xterm", + "sourceRepoURL": "https://github.com/sourcelair/xterm.js/", + "asOfVersion": "3.0.0" + }, { "libraryName": "zetapush-js", "typingsPackageName": "zetapush-js", diff --git a/types/xterm/index.d.ts b/types/xterm/index.d.ts deleted file mode 100644 index 37bc104747..0000000000 --- a/types/xterm/index.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -// Type definitions for xterm.js 2.0.1 -// Project: https://github.com/sourcelair/xterm.js/ -// Definitions by: Steven Silvester -// Lucian Buzzo -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** - * Typing for an xterm terminal object. - */ -interface Xterm { - - cols: number; - - rows: number; - - options: Xterm.IOptions; - - element: HTMLElement; - - textarea: HTMLElement; - - attachCustomKeydownHandler(callback: (event: KeyboardEvent) => boolean): void; - - blur(): void; - - clear(): void; - - destroy(): void; - - focus(): void; - - getOption(key: string): any; - - on(event: string, callback: (...args: any[]) => void): void; - - off(event: string, callback: (...args: any[]) => void): void; - - open(parent: HTMLElement, focus?: boolean): void; - - refresh(start: number, end: number, queue?: boolean): void; - - reset(): void; - - resize(x: number, y: number): void; - - scrollDisp(n: number): void; - - setOption(key: string, value: any): void; - - write(text: string): void; - - writeln(text: string): void; - - fit?(): void; -} - - -interface XtermConstructor { - new (options?: Xterm.IOptions): Xterm; - (options?: Xterm.IOptions): Xterm; -} - - -/** - * A terminal options. - */ -declare namespace Xterm { - interface IOptions { - colors?: string[]; - - theme?: string; - - convertEol?: boolean; - - termName?: string; - - geometry?: number[]; - - cursorBlink?: boolean; - - visualBell?: boolean; - - popOnBell?: boolean; - - scrollback?: number; - - debug?: boolean; - - cancelEvents?: boolean; - } -} - - -declare var Xterm: XtermConstructor; -export = Xterm; -export as namespace Xterm; diff --git a/types/xterm/tsconfig.json b/types/xterm/tsconfig.json deleted file mode 100644 index 3d75f99636..0000000000 --- a/types/xterm/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "xterm-tests.ts" - ] -} \ No newline at end of file diff --git a/types/xterm/tslint.json b/types/xterm/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/xterm/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/xterm/xterm-tests.ts b/types/xterm/xterm-tests.ts deleted file mode 100644 index 238cbcc8be..0000000000 --- a/types/xterm/xterm-tests.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as Terminal from 'xterm'; - -declare var fetch: any; - -var term: Terminal, - protocol: any, - socketURL: string, - socket: WebSocket, - pid: number, - charWidth: number, - charHeight: number; - -var terminalContainer = document.getElementById('terminal-container'), - optionElements = { - cursorBlink: document.querySelector('#option-cursor-blink') - }, - colsElement = document.getElementById('cols') as any, - rowsElement = document.getElementById('rows') as any; - -function setTerminalSize () { - var cols = parseInt(colsElement.value), - rows = parseInt(rowsElement.value), - width = (cols * charWidth).toString() + 'px', - height = (rows * charHeight).toString() + 'px'; - - terminalContainer.style.width = width; - terminalContainer.style.height = height; - term.resize(cols, rows); -} - -colsElement.addEventListener('change', setTerminalSize); -rowsElement.addEventListener('change', setTerminalSize); - -optionElements.cursorBlink.addEventListener('change', createTerminal); - -createTerminal(); - -function createTerminal() { - // Clean terminal - while (terminalContainer.children.length) { - terminalContainer.removeChild(terminalContainer.children[0]); - } - term = new Terminal({ - cursorBlink: (optionElements.cursorBlink as any).checked - }); - term.on('resize', function (size: any) { - if (!pid) { - return; - } - var cols = size.cols, - rows = size.rows, - url = '/terminals/' + pid + '/size?cols=' + cols + '&rows=' + rows; - - fetch(url, {method: 'POST'}); - }); - protocol = (location.protocol === 'https:') ? 'wss://' : 'ws://'; - socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/'; - - term.open(terminalContainer); - // term.fit(); - - var cols = 20, - rows = 30; - - colsElement.value = cols; - rowsElement.value = rows; - - fetch('/terminals?cols=' + cols + '&rows=' + rows, {method: 'POST'}).then(function (res: any) { - - charWidth = Math.ceil(term.element.offsetWidth / cols); - charHeight = Math.ceil(term.element.offsetHeight / rows); - - res.text().then(function (pid: number) { - (window as any).pid = pid; - socketURL += pid; - socket = new WebSocket(socketURL); - socket.onopen = runRealTerminal; - socket.onclose = runFakeTerminal; - socket.onerror = runFakeTerminal; - }); - }); -} - - -function runRealTerminal() { - //term.attach(socket); - //term._initialized = true; -} - -function runFakeTerminal() { - // if (term._initialized) { - // return; - // } - - // term._initialized = true; - - var shellprompt = '$ '; - - // term.prompt = function () { - // term.write('\r\n' + shellprompt); - // }; - - term.writeln('Welcome to xterm.js'); - term.writeln('This is a local terminal emulation, without a real terminal in the back-end.'); - term.writeln('Type some keys and commands to play around.'); - term.writeln(''); - // term.prompt(); - - term.on('key', function (key, ev) { - var printable = ( - !ev.altKey && !ev.altGraphKey && !ev.ctrlKey && !ev.metaKey - ); - - if (ev.keyCode == 13) { - // term.prompt(); - } else if (ev.keyCode == 8) { - // Do not delete the prompt - // if (term.x > 2) { - // term.write('\b \b'); - // } - } else if (printable) { - term.write(key); - } - }); - - term.on('paste', function (data, ev) { - term.write(data); - }); -} From da70da196d612d94d8aab226a6bce40e6622b383 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 07:51:02 -0800 Subject: [PATCH 0042/1348] node-waves: Provides its own types (#22866) --- notNeededPackages.json | 6 +++ types/node-waves/index.d.ts | 66 ---------------------------- types/node-waves/node-waves-tests.ts | 9 ---- types/node-waves/tsconfig.json | 24 ---------- types/node-waves/tslint.json | 1 - 5 files changed, 6 insertions(+), 100 deletions(-) delete mode 100644 types/node-waves/index.d.ts delete mode 100644 types/node-waves/node-waves-tests.ts delete mode 100644 types/node-waves/tsconfig.json delete mode 100644 types/node-waves/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index b193a7fa83..87fa95e11c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -912,6 +912,12 @@ "sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme", "asOfVersion": "2.15.0" }, + { + "libraryName": "node-waves", + "typingsPackageName": "node-waves", + "sourceRepoURL": "http://fian.my.id/Waves", + "asOfVersion": "0.7.6" + }, { "libraryName": "Normalizr", "typingsPackageName": "normalizr", diff --git a/types/node-waves/index.d.ts b/types/node-waves/index.d.ts deleted file mode 100644 index fd2cb4937c..0000000000 --- a/types/node-waves/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Type definitions for node-waves 0.7 -// Project: http://fian.my.id/Waves -// Definitions by: Stephen Lautier -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export type ElementTarget = string | Element | Element[]; - -export interface WavesConfig { - /** - * Determines how long the waves effect duration (in milliseconds). - * - */ - duration?: number; - - /** - * Delay amount to show waves effect on touch and hide the effect if user scrolls. - * Set to 0 to disable delay (in milliseconds). - * - */ - delay?: number; -} - -export interface RippleOptions { - /** - * Specify how long to wait between starting and stopping the ripple. - * - */ - wait?: number | null; - - /** - * Specify the position inside the element. - * - */ - position?: { - x: number; - y: number; - } | null; -} - -/** - * Initializes waves with an optional config. - */ -export function init(config?: WavesConfig): void; - -/** - * Attach ripple effect by adding `.waves-effect` to HTML element. - * Make sure you call `init` to activate the ripple. - * - * @param elements elements to target. - * @param classes classes to add. - */ -export function attach(elements: ElementTarget, classes?: string | string[]): void; - -/** - * Creates a ripple effect in HTML element programmatically. - * @param elements elements to target (must have `.waves-effect` already applied, ideally via `attach`). - * @param options specify how long to wait between starting and stopping the ripple, and it's position inside the element. - */ -export function ripple(elements: ElementTarget, options?: RippleOptions): void; - -/** - * Removes all ripples from inside an element immediately. - * - * @param elements elements to remove ripples from. - */ -export function calm(elements: ElementTarget): void; diff --git a/types/node-waves/node-waves-tests.ts b/types/node-waves/node-waves-tests.ts deleted file mode 100644 index b9eac6682e..0000000000 --- a/types/node-waves/node-waves-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { init, ripple, attach, calm } from "node-waves"; - -init({ delay: 300 }); - -attach("button", "waves-light"); - -ripple(".box", { wait: null }); - -calm(".box"); diff --git a/types/node-waves/tsconfig.json b/types/node-waves/tsconfig.json deleted file mode 100644 index 06ed81e135..0000000000 --- a/types/node-waves/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "node-waves-tests.ts" - ] -} \ No newline at end of file diff --git a/types/node-waves/tslint.json b/types/node-waves/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/node-waves/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From f261270cfc1f40d902dab43b0447a78ca8e99ce6 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 08:28:37 -0800 Subject: [PATCH 0043/1348] linq4js: Provides its own types (#22864) --- notNeededPackages.json | 6 + types/linq4js/index.d.ts | 308 --------------------------------- types/linq4js/linq4js-tests.ts | 13 -- types/linq4js/tsconfig.json | 24 --- types/linq4js/tslint.json | 9 - 5 files changed, 6 insertions(+), 354 deletions(-) delete mode 100644 types/linq4js/index.d.ts delete mode 100644 types/linq4js/linq4js-tests.ts delete mode 100644 types/linq4js/tsconfig.json delete mode 100644 types/linq4js/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 87fa95e11c..40f80ddba1 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -798,6 +798,12 @@ "sourceRepoURL": "https://linqjs.codeplex.com/", "asOfVersion": "2.2.33" }, + { + "libraryName": "Linq4JS", + "typingsPackageName": "linq4js", + "sourceRepoURL": "https://github.com/morrisjdev/Linq4JS", + "asOfVersion": "2.1.8" + }, { "libraryName": "LinqSharp", "typingsPackageName": "linqsharp", diff --git a/types/linq4js/index.d.ts b/types/linq4js/index.d.ts deleted file mode 100644 index 8721040314..0000000000 --- a/types/linq4js/index.d.ts +++ /dev/null @@ -1,308 +0,0 @@ -// Type definitions for Linq4JS 2.1 -// Project: https://github.com/morrisjdev/Linq4JS -// Definitions by: Morris Janatzek -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Array { - Order: Linq4JS.OrderEntry[]; - GroupValue: any; - /** - * Executes actions defined in the command-string - * @param command The command-string for execution - */ - Evaluate(command: string): any; - /** - * Creates a copy of the array - */ - Clone(): T[]; - /** - * Gets the index of the first item found by a filter - * @param filter A function (or function-string) that returns a boolean when matching element was found - */ - FindIndex(filter: ((item: T) => boolean) | string): number; - /** - * Gets the index of the last item found by a filter - * @param filter A function (or function-string) that returns a boolean when matching element was found - */ - FindLastIndex(filter: ((item: T) => boolean) | string): number; - /** - * Gets the item with the index - * @param index Item index - */ - Get(index: number): T; - /** - * Executes a method for each item in the array - * @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops. - */ - ForEach(action: ((item: T, index?: number) => boolean | any) | string): T[]; - /** - * Updates an object in the array - * @param object The object to update - * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array - */ - Update(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; - /** - * Updates objects in the array - * @param objects The array of objects to update - * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array - */ - UpdateRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; - /** - * Removes an object from the array - * @param object The object to remove - * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array - */ - Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; - /** - * Removes objects from the array - * @param objects The array of objects to remove - * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array - */ - RemoveRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; - /** - * Adds an object to the array - * @param object The object to add - * @param generateId Auto-generate a property to identify object in later processes - */ - Add(object: T, generateId?: boolean): T[]; - /** - * Adds objects to the array - * @param objects The array of objects to add - */ - AddRange(objects: T[], generateId?: boolean): T[]; - /** - * Inserts an entry at a specific position - * @param object The object to insert - * @param index The position to insert - */ - Insert(object: T, index: number): T[]; - /** - * Searches for all items in array that match the given filter - * @param filter A function (or function-string) that returns a boolean when matching element was found - */ - Where(filter: ((item: T, index?: number) => boolean) | string): T[]; - /** - * Takes items in a specific range - * @param start The start position - * @param length The number of elements to take - */ - Range(start: number, length: number): T[]; - /** - * Repeats an object in the array - * @param object The object to repeat - * @param count The count of repeats - */ - Repeat(object: T, count: number): T[]; - /** - * Returns the length of the array - * @param filter If set the function returns count of elements matched by the condition - */ - Count(filter?: ((item: T) => boolean) | string): number; - /** - * Tests if all items in the array match the condition - * @param filter A function (or function-string) that returns a boolean when matching element was found - */ - All(filter: ((item: T) => boolean) | string): boolean; - /** - * Tests if any item is in the array - * @param filter If set the function tests if any item in the array matches the condition - */ - Any(filter?: ((item: T) => boolean) | string): boolean; - /** - * Returns the first item of the array - Throws an exception if no item was found - * @param filter If set the function returns the first item that matches the filter - */ - First(filter?: ((item: T) => boolean) | string): T; - /** - * Returns the first item of the array - returns `null` if no suitable item was found - * @param filter If set the function returns the first item that matches the filter - */ - FirstOrDefault(filter?: ((item: T) => boolean) | string): (T | null); - /** - * Returns the last item of the array - Throws an exception if no item was found - * @param filter If set the function returns the last item that matches the filter - */ - Last(filter?: ((item: T) => boolean) | string): T; - /** - * Returns the last item of the array - returns `null` if no suitable item was found - * @param filter If set the function returns the last item that matches the filter - */ - LastOrDefault(filter?: ((item: T) => boolean) | string): (T | null); - /** - * Select the properties for a new array - * @param selector A function (or a function-string) that returns a new object - */ - Select(selector: ((item: T) => any) | string): any[]; - /** - * Limits the number of entries taken - * @param count The count of elements taken - */ - Take(count: number): T[]; - /** - * Takes entries as long as a condition is true - * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets thrown are taken - * @param initial A initial-function (or function-string) that gets executed once at the start of the loop - * @param after A function that gets executed after every element-iteration after the condition-function was evaluated - */ - TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): T[]; - /** - * Skips entries - * @param count The count of elements skipped - */ - Skip(count: number): T[]; - /** - * Orders array by property or value in ascending direction - * @param valueSelector The selector-function (or function-string) that selects the property for sorting - */ - OrderBy(valueSelector: ((item: T) => any) | string): T[]; - /** - * Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending - * @param valueSelector The selector-function (or function-string) that selects the property for sorting - */ - ThenBy(valueSelector: ((item: T) => any) | string): T[]; - /** - * Orders array by property or value in descending direction - * @param valueSelector The selector-function (or function-string) that selects the property for sorting - */ - OrderByDescending(valueSelector: ((item: T) => any) | string): T[]; - /** - * Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending - * @param valueSelector The selector-function (or function-string) that selects the property for sorting - */ - ThenByDescending(valueSelector: ((item: T) => any) | string): T[]; - /** - * Returns the smallest element in array - * @param valueSelector The selector-function (or function-string) that selects the property for comparison - */ - Min(valueSelector?: ((item: T) => any) | string): (T | null); - /** - * Returns the greates element in array - * @param valueSelector The selector-function (or function-string) that selects the property for comparison - */ - Max(valueSelector?: ((item: T) => any) | string): (T | null); - /** - * Groups array by property - * @param selector The selector-function (or function-string) that selects the property for grouping - */ - GroupBy(selector: ((item: T) => any) | string): T[][]; - /** - * Moves an item from one index to another - * @param oldIndex The current position of the item - * @param newIndex The new position of the item - */ - Move(oldIndex: number, newIndex: number): T[]; - /** - * Makes all values unique - * @param valueSelector A selector-function (or function-string) to select property for comparison and distinction - */ - Distinct(valueSelector?: ((item: T) => any) | string): T[]; - /** - * Tests if array contains specific object - * @param object The object to test for - */ - Contains(object: T): boolean; - /** - * Combines two arrays - * @param array The array to combine - */ - Concat(array: T[]): T[]; - /** - * Combines two arrays but only applies values that are in both arrays - * @param array The array to combine - */ - Intersect(array: T[]): T[]; - /** - * Joins the entries by a given char - * @param character The character for joining - * @param selector A selector-function (or function-string) to select property for joining - */ - Join(character: string, selector?: ((item: T) => any) | string): string; - /** - * Combines the entries using a custom function - * @param method A function (or function-string) for aggregation - * @param startVal The value to start aggregation - */ - Aggregate(method: ((result: any, item: T) => any) | string, startVal?: any): string; - /** - * Reverses the array - */ - Reverse(): T[]; - /** - * Computes the average of the elements - * @param selector A selector-function (or function-string) to select property for average computing - * @param filter If set the function computes the average of elements that match the filter - */ - Average(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; - /** - * Computes the sum of the elements - * @param selector A selector-function (or function-string) to select property for adding - * @param filter If set the function computes the sum of elements that match the filter - */ - Sum(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; - /** - * Compares to sequences of objects - * @param array The array to compare - */ - SequenceEqual(array: T[]): boolean; - /** - * Combines the entries of two arrays using a custom function - * @param array The array to combine - * @param result The function (or function-string) to combine elements - */ - Zip(array: X[], result: ((first: T, second: X) => any) | string): any[]; - /** - * Combines two arrays without duplicates - * @param array The array to combine - */ - Union(array: T[]): T[]; - /** - * Converts the array to a dictionary - * @param keySelector The selector-function (or function-string) to select property for key - * @param valueSelector A selector-function (or function-string) to select property for value - */ - ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any; -} - -declare namespace Linq4JS { - class GeneratedEntity { - _GeneratedId_: number; - Id: number; - } - - class EvaluateCommand { - Command: string; - SplitRegex: RegExp[]; - Finder: RegExp[]; - constructor(command: string, ...identifier: string[]); - } - class EvaluateCommandResult { - Command: string; - DynamicFunction: string; - constructor(cmd: string, fn: string); - } - - class Helper { - private static ConvertStringFunction(functionString, noAutoReturn?, noBracketReplace?); - static ConvertFunction(testFunction: string | T, noAutoReturn?: boolean, noBracketReplace?: boolean): T; - static OrderCompareFunction(valueSelector: (item: T) => any, a: T, b: T, invert: boolean): number; - static SplitCommand(command: string): string[]; - static MatchCommand(cmd: string): EvaluateCommandResult; - static Commands: EvaluateCommand[]; - } - - class OrderEntry { - Direction: OrderDirection; - ValueSelector: (item: any) => any; - constructor(_direction: OrderDirection, _valueSelector: (item: any) => any); - } - enum OrderDirection { - Ascending = 0, - Descending = 1, - } - - class SelectEntry { - property: string; - name: string; - constructor(n: string, p: string); - } -} diff --git a/types/linq4js/linq4js-tests.ts b/types/linq4js/linq4js-tests.ts deleted file mode 100644 index 42e43ab324..0000000000 --- a/types/linq4js/linq4js-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import "linq4js"; - -const array: string[] = ["test", "test2", "test3", "test4", "test5"]; - -array - .Add("test6") - .Remove("test3") - .Insert("test3", 2) - .Distinct() - .OrderBy(x => x) - .OrderByDescending(x => x) - .Select(x => x.length) - .Average(); diff --git a/types/linq4js/tsconfig.json b/types/linq4js/tsconfig.json deleted file mode 100644 index 3479566f16..0000000000 --- a/types/linq4js/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "files": [ - "index.d.ts", - "linq4js-tests.ts" - ], - "compilerOptions": { - "module": "commonjs", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "target": "es6", - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "lib": [ - "es6" - ], - "noEmit": true, - "forceConsistentCasingInFileNames": true - } -} \ No newline at end of file diff --git a/types/linq4js/tslint.json b/types/linq4js/tslint.json deleted file mode 100644 index bb491510c7..0000000000 --- a/types/linq4js/tslint.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "no-any-union": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false - } -} From ba0c1cdfaf8a733571f99ca48be8d3d80c14adb0 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 08:41:32 -0800 Subject: [PATCH 0044/1348] localforage-cordovasqlitedriver: Provides its own types (#22863) * localforage-cordovasqlitedriver: Provides its own types * remove 'module' from libraryName --- notNeededPackages.json | 6 +++ .../index.d.ts | 9 ---- .../localforage-cordovasqlitedriver-tests.ts | 53 ------------------- .../package.json | 6 --- .../tsconfig.json | 24 --------- .../tslint.json | 1 - 6 files changed, 6 insertions(+), 93 deletions(-) delete mode 100644 types/localforage-cordovasqlitedriver/index.d.ts delete mode 100644 types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts delete mode 100644 types/localforage-cordovasqlitedriver/package.json delete mode 100644 types/localforage-cordovasqlitedriver/tsconfig.json delete mode 100644 types/localforage-cordovasqlitedriver/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 40f80ddba1..174861630d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -816,6 +816,12 @@ "sourceRepoURL": "https://github.com/localForage/localForage", "asOfVersion": "0.0.34" }, + { + "libraryName": "localforage-cordovasqlitedriver", + "typingsPackageName": "localforage-cordovasqlitedriver", + "sourceRepoURL": "https://github.com/thgreasi/localForage-cordovaSQLiteDriver", + "asOfVersion": "1.5.0" + }, { "libraryName": "lodash-decorators", "typingsPackageName": "lodash-decorators", diff --git a/types/localforage-cordovasqlitedriver/index.d.ts b/types/localforage-cordovasqlitedriver/index.d.ts deleted file mode 100644 index 7c415d3f42..0000000000 --- a/types/localforage-cordovasqlitedriver/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for localforage-cordovasqlitedriver module 1.0 -// Project: https://github.com/thgreasi/localForage-cordovaSQLiteDriver -// Definitions by: Thodoris Greasidis -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare var cordovaSQLiteDriver: LocalForageDriver; -export = cordovaSQLiteDriver; diff --git a/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts b/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts deleted file mode 100644 index 22b550da0b..0000000000 --- a/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts +++ /dev/null @@ -1,53 +0,0 @@ -declare const cordovaSQLiteDriver: LocalForageDriver; - -() => { - const driverName: string = cordovaSQLiteDriver._driver; - - const config = { - driver: driverName, - name: 'localforage' - }; - - cordovaSQLiteDriver._initStorage(config); - - cordovaSQLiteDriver.clear((err: any) => { - const newError: any = err; - }); - - cordovaSQLiteDriver.length((err: any, num: number) => { - const newError: any = err; - const newNumber: number = num; - }); - - cordovaSQLiteDriver.key(0, (err: any, value: string) => { - const newError: any = err; - const newValue: string = value; - }); - - cordovaSQLiteDriver.keys((err: any, keys: string[]) => { - const newError: any = err; - const newArray: string[] = keys; - }); - - cordovaSQLiteDriver.getItem("key", (err: any, str: string) => { - const newError: any = err; - const newStr: string = str; - }); - - cordovaSQLiteDriver.setItem("key", "value", (err: any, str: string) => { - const newError: any = err; - const newStr: string = str; - }); - - cordovaSQLiteDriver.setItem("key", "value", (str: string) => { - const newStr: string = str; - }); - - cordovaSQLiteDriver.removeItem("key", (err: any) => { - const newError: any = err; - }); - - cordovaSQLiteDriver.removeItem("key", (err: any) => { - const newError: any = err; - }); -}; diff --git a/types/localforage-cordovasqlitedriver/package.json b/types/localforage-cordovasqlitedriver/package.json deleted file mode 100644 index 9ef28aa765..0000000000 --- a/types/localforage-cordovasqlitedriver/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "localforage": "^1.5.0" - } -} diff --git a/types/localforage-cordovasqlitedriver/tsconfig.json b/types/localforage-cordovasqlitedriver/tsconfig.json deleted file mode 100644 index 8e2874eaa8..0000000000 --- a/types/localforage-cordovasqlitedriver/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "localforage-cordovasqlitedriver-tests.ts" - ] -} \ No newline at end of file diff --git a/types/localforage-cordovasqlitedriver/tslint.json b/types/localforage-cordovasqlitedriver/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/localforage-cordovasqlitedriver/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From ceebbf5a7aae8c9b8164b810c913e8fc4286cadd Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 08:55:59 -0800 Subject: [PATCH 0045/1348] chai: Remove false `reference types` comment (#22968) --- types/chai/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 70bc0f2b67..925c7198f0 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -11,8 +11,6 @@ // Satana Charuwichitratana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// - declare namespace Chai { interface ChaiStatic { expect: ExpectStatic; From 5ba5faa1def1550d152d5699ff5a82b672332195 Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Tue, 16 Jan 2018 10:41:33 -0700 Subject: [PATCH 0046/1348] [@types/request] Lint fix. (#22874) I had two PRs merge close together that caused the build to fail. - #22809 fixed a bug - #22821 removed all the overrides from `tslint.json` Unfortunately, the former ended up with a couple lint issues. ``` ./types/request/index.d.ts ERROR: 64:20 unified-signatures This overload and the one on line 63 can be combined into one signature taking `string | RequiredUriUrl & TOptions`. ./types/request/request-tests.ts ERROR: 10:5 prefer-const Identifier 'value' is never reassigned; use 'const' instead of 'let'. ``` --- types/request/index.d.ts | 5 ++--- types/request/request-tests.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index a21d0c7f46..7362c18d49 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -60,8 +60,7 @@ declare namespace request { delete(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest; initParams(uri: string, options?: TOptions, callback?: RequestCallback): RequiredUriUrl & TOptions; - initParams(uri: string, callback?: RequestCallback): RequiredUriUrl & TOptions; - initParams(options: RequiredUriUrl & TOptions, callback?: RequestCallback): RequiredUriUrl & TOptions; + initParams(uriOrOpts: string | RequiredUriUrl & TOptions, callback?: RequestCallback): RequiredUriUrl & TOptions; forever(agentOptions: any, optionsArg: any): TRequest; jar(store?: any): CookieJar; @@ -249,7 +248,7 @@ declare namespace request { multipart(multipart: RequestPart[]): Request; json(val: any): Request; aws(opts: AWSOptions, now?: boolean): Request; - auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request; + auth(username: string, password: string, sendImmediately?: boolean, bearer?: string): Request; oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 102e4001b5..aac1566eaa 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -7,7 +7,7 @@ import request = require('request'); import stream = require('stream'); import urlModule = require('url'); -let value: any; +const value: any = 'value'; let str: string; let strOrUndef: string | undefined; let strOrTrueOrUndef: string | true | undefined; From ea7a1a732a54ca2cd8e00143acef7166c95dabf3 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 16 Jan 2018 11:12:35 -0800 Subject: [PATCH 0047/1348] assertion-error: Provides its own types (#22861) --- notNeededPackages.json | 6 ++ .../assertion-error/assertion-error-tests.ts | 14 ---- types/assertion-error/index.d.ts | 14 ---- types/assertion-error/tsconfig.json | 23 ------ types/assertion-error/tslint.json | 79 ------------------- 5 files changed, 6 insertions(+), 130 deletions(-) delete mode 100644 types/assertion-error/assertion-error-tests.ts delete mode 100644 types/assertion-error/index.d.ts delete mode 100644 types/assertion-error/tsconfig.json delete mode 100644 types/assertion-error/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 174861630d..a698b68ff3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -78,6 +78,12 @@ "sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating", "asOfVersion": "0.4.0" }, + { + "libraryName": "assertion-error", + "typingsPackageName": "assertion-error", + "sourceRepoURL": "https://github.com/chaijs/assertion-error", + "asOfVersion": "1.1.0" + }, { "libraryName": "asyncblock", "typingsPackageName": "asyncblock", diff --git a/types/assertion-error/assertion-error-tests.ts b/types/assertion-error/assertion-error-tests.ts deleted file mode 100644 index 96eb520f1c..0000000000 --- a/types/assertion-error/assertion-error-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ - -import AssertionError = require('assertion-error'); - -var e: AssertionError; -var str: string; - -function foo () { - -} - -e = new AssertionError(str); -e = new AssertionError(str, {a:1, b:2}); -e = new AssertionError(str, {a:1, b:2}, foo); - diff --git a/types/assertion-error/index.d.ts b/types/assertion-error/index.d.ts deleted file mode 100644 index 8663df799d..0000000000 --- a/types/assertion-error/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Type definitions for assertion-error 1.0.0 -// Project: https://github.com/chaijs/assertion-error -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare class AssertionError implements Error { - constructor(message: string, props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; -} -export = AssertionError; diff --git a/types/assertion-error/tsconfig.json b/types/assertion-error/tsconfig.json deleted file mode 100644 index ebe9144d0b..0000000000 --- a/types/assertion-error/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "assertion-error-tests.ts" - ] -} \ No newline at end of file diff --git a/types/assertion-error/tslint.json b/types/assertion-error/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/assertion-error/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 619403ecc7d3045921ebf50a5f296ef133ff24a2 Mon Sep 17 00:00:00 2001 From: dominuskernel Date: Tue, 16 Jan 2018 23:55:33 +0100 Subject: [PATCH 0048/1348] change to the las navigo version 7.0.0 --- types/navigo/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index 58af71a564..68d374449b 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for navigo 6.0 +// Type definitions for navigo 7.0 // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From a56225abf7ba642002cc334dd44da0dddcb8da62 Mon Sep 17 00:00:00 2001 From: Maksim Karelov Date: Wed, 17 Jan 2018 18:35:53 +0300 Subject: [PATCH 0049/1348] [ismobilejs] Fix isMobile typings and tests (#22824) * Fix isMobile typings and tests * Fix isMobile export --- types/ismobilejs/index.d.ts | 80 ++++++++++++++++------------ types/ismobilejs/ismobilejs-tests.ts | 19 +++++++ types/ismobilejs/tsconfig.json | 4 +- 3 files changed, 69 insertions(+), 34 deletions(-) diff --git a/types/ismobilejs/index.d.ts b/types/ismobilejs/index.d.ts index c0f7c4ec8b..18eee7ea1a 100644 --- a/types/ismobilejs/index.d.ts +++ b/types/ismobilejs/index.d.ts @@ -3,41 +3,55 @@ // Definitions by: Maksim Karelov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export const any: boolean; -export const phone: boolean; -export const tablet: boolean; -export const seven_inch: boolean; +interface Apple { + phone: boolean; + ipod: boolean; + tablet: boolean; + device: boolean; +} -export const apple: { - phone: boolean; - ipod: boolean; - tablet: boolean; - device: boolean; -}; +interface Android { + phone: boolean; + tablet: boolean; + device: boolean; +} -export const android: { - phone: boolean; - tablet: boolean; - device: boolean; -}; +interface Amazon { + phone: boolean; + tablet: boolean; + device: boolean; +} -export const amazon: { - phone: boolean; - tablet: boolean; - device: boolean; -}; +interface Windows { + phone: boolean; + tablet: boolean; + device: boolean; +} -export const windows: { - phone: boolean; - tablet: boolean; - device: boolean; -}; +interface Other { + blackberry_10: boolean; + blackberry: boolean; + opera: boolean; + firefox: boolean; + chrome: boolean; + device: boolean; +} -export const other: { - blackberry_10: boolean; - blackberry: boolean; - opera: boolean; - firefox: boolean; - chrome: boolean; - device: boolean; -}; +interface IsMobile { + any: boolean; + phone: boolean; + tablet: boolean; + seven_inch: boolean; + + apple: Apple; + android: Android; + amazon: Amazon; + windows: Windows; + other: Other; + + (userAgent?: string): IsMobile; +} + +declare const isMobile: IsMobile; + +export = isMobile; diff --git a/types/ismobilejs/ismobilejs-tests.ts b/types/ismobilejs/ismobilejs-tests.ts index e69de29bb2..d53c674da9 100644 --- a/types/ismobilejs/ismobilejs-tests.ts +++ b/types/ismobilejs/ismobilejs-tests.ts @@ -0,0 +1,19 @@ +import * as isMobile from 'ismobilejs'; + +const MOZILLA_ANDROID_UA = 'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'; +const MOZILLA_IPHONE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4'; + +const CHROME_ANDROID_UA = 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.66 Mobile Safari/537.36'; +const CHROME_IPHONE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1'; + +// $ExpectType boolean +isMobile(MOZILLA_ANDROID_UA).android.phone; +// $ExpectType boolean +isMobile(MOZILLA_IPHONE_UA).apple.phone; + +// $ExpectType boolean +isMobile(CHROME_ANDROID_UA).android.phone; +// $ExpectType boolean +isMobile(CHROME_IPHONE_UA).apple.phone; + +console.log(isMobile.apple); diff --git a/types/ismobilejs/tsconfig.json b/types/ismobilejs/tsconfig.json index 3e3a1071d3..ae9975d94e 100644 --- a/types/ismobilejs/tsconfig.json +++ b/types/ismobilejs/tsconfig.json @@ -2,11 +2,13 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 5244cc0eccd558871890e97bd136dbcdfedc0787 Mon Sep 17 00:00:00 2001 From: Michael Zlatkovsky Date: Wed, 17 Jan 2018 07:40:06 -0800 Subject: [PATCH 0050/1348] Update maintainers list of office-js (#22972) --- types/office-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e24b6c4a2c..d974bf45f7 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Office.js // Project: http://dev.office.com -// Definitions by: OfficeDev , Lance Austin +// Definitions by: OfficeDev , Lance Austin , Michael Zlatkovsky , Kim Brandl , Ricky Kirkham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* From 3524ae0be3b53ddd80da9562393fb8ef01d4cdfc Mon Sep 17 00:00:00 2001 From: Bryan Hughes Date: Wed, 17 Jan 2018 10:40:29 -0500 Subject: [PATCH 0051/1348] Adds type definitions for raspi-gpio, raspi-i2c, raspi-led, raspi-onewire, raspi-pwm, raspi-serial, raspi-soft-pwm (#22898) * Added peripheral classes from the raspi.js suite. * Refactored type names to match style guide --- types/raspi-gpio/index.d.ts | 31 +++++++++++++++ types/raspi-gpio/raspi-gpio-tests.ts | 24 ++++++++++++ types/raspi-gpio/tsconfig.json | 23 +++++++++++ types/raspi-gpio/tslint.json | 1 + types/raspi-i2c/index.d.ts | 35 +++++++++++++++++ types/raspi-i2c/raspi-i2c-tests.ts | 38 +++++++++++++++++++ types/raspi-i2c/tsconfig.json | 23 +++++++++++ types/raspi-i2c/tslint.json | 1 + types/raspi-led/index.d.ts | 15 ++++++++ types/raspi-led/raspi-led-tests.ts | 7 ++++ types/raspi-led/tsconfig.json | 23 +++++++++++ types/raspi-led/tslint.json | 1 + types/raspi-onewire/index.d.ts | 17 +++++++++ types/raspi-onewire/raspi-onewire-tests.ts | 7 ++++ types/raspi-onewire/tsconfig.json | 23 +++++++++++ types/raspi-onewire/tslint.json | 1 + types/raspi-pwm/index.d.ts | 22 +++++++++++ types/raspi-pwm/raspi-pwm-tests.ts | 15 ++++++++ types/raspi-pwm/tsconfig.json | 23 +++++++++++ types/raspi-pwm/tslint.json | 1 + types/raspi-serial/index.d.ts | 40 ++++++++++++++++++++ types/raspi-serial/raspi-serial-tests.ts | 34 +++++++++++++++++ types/raspi-serial/tsconfig.json | 23 +++++++++++ types/raspi-serial/tslint.json | 1 + types/raspi-soft-pwm/index.d.ts | 23 +++++++++++ types/raspi-soft-pwm/raspi-soft-pwm-tests.ts | 16 ++++++++ types/raspi-soft-pwm/tsconfig.json | 23 +++++++++++ types/raspi-soft-pwm/tslint.json | 1 + 28 files changed, 492 insertions(+) create mode 100644 types/raspi-gpio/index.d.ts create mode 100644 types/raspi-gpio/raspi-gpio-tests.ts create mode 100644 types/raspi-gpio/tsconfig.json create mode 100644 types/raspi-gpio/tslint.json create mode 100644 types/raspi-i2c/index.d.ts create mode 100644 types/raspi-i2c/raspi-i2c-tests.ts create mode 100644 types/raspi-i2c/tsconfig.json create mode 100644 types/raspi-i2c/tslint.json create mode 100644 types/raspi-led/index.d.ts create mode 100644 types/raspi-led/raspi-led-tests.ts create mode 100644 types/raspi-led/tsconfig.json create mode 100644 types/raspi-led/tslint.json create mode 100644 types/raspi-onewire/index.d.ts create mode 100644 types/raspi-onewire/raspi-onewire-tests.ts create mode 100644 types/raspi-onewire/tsconfig.json create mode 100644 types/raspi-onewire/tslint.json create mode 100644 types/raspi-pwm/index.d.ts create mode 100644 types/raspi-pwm/raspi-pwm-tests.ts create mode 100644 types/raspi-pwm/tsconfig.json create mode 100644 types/raspi-pwm/tslint.json create mode 100644 types/raspi-serial/index.d.ts create mode 100644 types/raspi-serial/raspi-serial-tests.ts create mode 100644 types/raspi-serial/tsconfig.json create mode 100644 types/raspi-serial/tslint.json create mode 100644 types/raspi-soft-pwm/index.d.ts create mode 100644 types/raspi-soft-pwm/raspi-soft-pwm-tests.ts create mode 100644 types/raspi-soft-pwm/tsconfig.json create mode 100644 types/raspi-soft-pwm/tslint.json diff --git a/types/raspi-gpio/index.d.ts b/types/raspi-gpio/index.d.ts new file mode 100644 index 0000000000..4daf607b87 --- /dev/null +++ b/types/raspi-gpio/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for raspi-gpio 5.0 +// Project: https://github.com/nebrius/raspi-gpio +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { Peripheral } from 'raspi-peripheral'; +export interface Config { + pin: number | string; + pullResistor?: number; +} +export const LOW = 0; +export const HIGH = 1; +export const PULL_NONE: number; +export const PULL_DOWN: number; +export const PULL_UP: number; +export class DigitalOutput extends Peripheral { + private _output; + private _currentValue; + readonly value: number; + constructor(config: number | string | Config); + write(value: number): void; +} +export class DigitalInput extends Peripheral { + private _input; + private _currentValue; + readonly value: number; + constructor(config: number | string | Config); + destroy(): void; + read(): number; +} diff --git a/types/raspi-gpio/raspi-gpio-tests.ts b/types/raspi-gpio/raspi-gpio-tests.ts new file mode 100644 index 0000000000..0f672497da --- /dev/null +++ b/types/raspi-gpio/raspi-gpio-tests.ts @@ -0,0 +1,24 @@ +import { DigitalInput, DigitalOutput, Config, LOW, HIGH, PULL_UP, PULL_DOWN, PULL_NONE } from 'raspi-gpio'; + +const inputConfig: Config = { + pin: 'P1-3', + pullResistor: PULL_UP +}; +const input = new DigitalInput(inputConfig); +input.read(); +input.value; + +new DigitalInput({ + pin: 'P1-3', + pullResistor: PULL_DOWN +}); + +new DigitalInput({ + pin: 'P1-3', + pullResistor: PULL_NONE +}); + +const output = new DigitalOutput('P1-5'); +output.write(LOW); +output.write(HIGH); +output.value; diff --git a/types/raspi-gpio/tsconfig.json b/types/raspi-gpio/tsconfig.json new file mode 100644 index 0000000000..480f995bc6 --- /dev/null +++ b/types/raspi-gpio/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-gpio-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-gpio/tslint.json b/types/raspi-gpio/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-gpio/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-i2c/index.d.ts b/types/raspi-i2c/index.d.ts new file mode 100644 index 0000000000..ce71190055 --- /dev/null +++ b/types/raspi-i2c/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for raspi-i2c 6.1 +// Project: https://github.com/nebrius/raspi-i2c +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// +import { Peripheral } from 'raspi-peripheral'; +export type ReadCallback = (err: null | Error | string, data: null | Buffer | number) => void; +export type WriteCallback = (err: null | Error | string) => void; +export class I2C extends Peripheral { + private _devices; + constructor(); + destroy(): void; + private _getDevice(address); + read(address: number, length: number, cb: ReadCallback): void; + read(address: number, register: number, length: number, cb: ReadCallback): void; + readSync(address: number, registerOrLength: number | undefined, length?: number): Buffer; + readByte(address: number, cb: ReadCallback): void; + readByte(address: number, register: number, cb: ReadCallback): void; + readByteSync(address: number, register?: number): number; + readWord(address: number, cb: ReadCallback): void; + readWord(address: number, register: number, cb: ReadCallback): void; + readWordSync(address: number, register?: number): number; + write(address: number, buffer: Buffer, cb?: WriteCallback): void; + write(address: number, register: number, buffer: Buffer, cb?: WriteCallback): void; + writeSync(address: number, buffer: Buffer): void; + writeSync(address: number, register: number, buffer: Buffer): void; + writeByte(address: number, byte: number, cb?: WriteCallback): void; + writeByte(address: number, register: number, byte: number, cb?: WriteCallback): void; + writeByteSync(address: number, registerOrByte: number, byte?: number): void; + writeWord(address: number, word: number, cb?: WriteCallback): void; + writeWord(address: number, register: number, word: number, cb?: WriteCallback): void; + writeWordSync(address: number, registerOrWord: number, word?: number): void; +} diff --git a/types/raspi-i2c/raspi-i2c-tests.ts b/types/raspi-i2c/raspi-i2c-tests.ts new file mode 100644 index 0000000000..8473c8c247 --- /dev/null +++ b/types/raspi-i2c/raspi-i2c-tests.ts @@ -0,0 +1,38 @@ +import { I2C } from 'raspi-i2c'; + +const i2c = new I2C(); + +i2c.read(1, 1, (err, data) => {}); +i2c.read(1, 1, 1, (err, data) => {}); + +i2c.readSync(1, 1); +i2c.readSync(1, 1, 1); + +i2c.readByte(1, (err, data) => {}); +i2c.readByte(1, 1, (err, data) => {}); + +i2c.readByteSync(1); +i2c.readByteSync(1, 1); + +i2c.readWord(1, (err, data) => {}); +i2c.readWord(1, 1, (err, data) => {}); + +const buf = Buffer.alloc(1); + +i2c.write(1, buf, (err) => {}); +i2c.write(1, 1, buf, (err) => {}); + +i2c.writeSync(1, buf); +i2c.writeSync(1, 1, buf); + +i2c.writeByte(1, 1, (err) => {}); +i2c.writeByte(1, 1, 1, (err) => {}); + +i2c.writeByteSync(1, 1); +i2c.writeByteSync(1, 1, 1); + +i2c.writeWord(1, 1, (err) => {}); +i2c.writeWord(1, 1, 1, (err) => {}); + +i2c.writeWordSync(1, 1); +i2c.writeWordSync(1, 1, 1); diff --git a/types/raspi-i2c/tsconfig.json b/types/raspi-i2c/tsconfig.json new file mode 100644 index 0000000000..4e201f4496 --- /dev/null +++ b/types/raspi-i2c/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-i2c-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-i2c/tslint.json b/types/raspi-i2c/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-i2c/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-led/index.d.ts b/types/raspi-led/index.d.ts new file mode 100644 index 0000000000..1c060bb347 --- /dev/null +++ b/types/raspi-led/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for raspi-led 2.0 +// Project: https://github.com/nebrius/raspi-led +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { Peripheral } from 'raspi-peripheral'; +export const OFF = 0; +export const ON = 1; +export class LED extends Peripheral { + constructor(); + hasLed(): boolean; + read(): 0 | 1; + write(value: 0 | 1): void; +} diff --git a/types/raspi-led/raspi-led-tests.ts b/types/raspi-led/raspi-led-tests.ts new file mode 100644 index 0000000000..7da1a09761 --- /dev/null +++ b/types/raspi-led/raspi-led-tests.ts @@ -0,0 +1,7 @@ +import { OFF, ON, LED } from 'raspi-led'; + +const led = new LED(); +led.hasLed(); +led.read(); +led.write(OFF); +led.write(ON); diff --git a/types/raspi-led/tsconfig.json b/types/raspi-led/tsconfig.json new file mode 100644 index 0000000000..7e9d3a0fcc --- /dev/null +++ b/types/raspi-led/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-led-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-led/tslint.json b/types/raspi-led/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-led/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-onewire/index.d.ts b/types/raspi-onewire/index.d.ts new file mode 100644 index 0000000000..168b4576b1 --- /dev/null +++ b/types/raspi-onewire/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for raspi-onewire 1.0 +// Project: https://github.com/nebrius/raspi-onewire +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// +import { Peripheral } from 'raspi-peripheral'; +export class OneWire extends Peripheral { + private _deviceIdMapping; + constructor(); + private _convertIDToMappingKey(deviceID); + private _getNameFromID(deviceID); + searchForDevices(cb: (readErr: string | Error | undefined, devices: number[][] | undefined) => void): void; + read(deviceID: number[], numBytesToRead: number, cb: (err: string | Error | undefined, data: Buffer | undefined) => void): void; + readAllAvailable(deviceID: number[], cb: (err: string | Error | undefined, data: Buffer | undefined) => void): void; +} diff --git a/types/raspi-onewire/raspi-onewire-tests.ts b/types/raspi-onewire/raspi-onewire-tests.ts new file mode 100644 index 0000000000..1f24b21f4b --- /dev/null +++ b/types/raspi-onewire/raspi-onewire-tests.ts @@ -0,0 +1,7 @@ +import { OneWire } from 'raspi-onewire'; + +const oneWire = new OneWire(); + +oneWire.searchForDevices((err, devices) => {}); +oneWire.read([ 1, 2 ], 1, (err, data) => {}); +oneWire.readAllAvailable([ 1, 2 ], (err, data) => {}); diff --git a/types/raspi-onewire/tsconfig.json b/types/raspi-onewire/tsconfig.json new file mode 100644 index 0000000000..d7df314b58 --- /dev/null +++ b/types/raspi-onewire/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-onewire-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-onewire/tslint.json b/types/raspi-onewire/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-onewire/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-pwm/index.d.ts b/types/raspi-pwm/index.d.ts new file mode 100644 index 0000000000..42c122c75d --- /dev/null +++ b/types/raspi-pwm/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for raspi-pwm 5.0 +// Project: https://github.com/nebrius/raspi-pwm +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { Peripheral } from 'raspi-peripheral'; +export interface Config { + pin?: number | string; + frequency?: number; +} +export class PWM extends Peripheral { + private _frequencyValue; + private _dutyCycleValue; + private _pwmPort; + private _pwm; + readonly frequency: number; + readonly dutyCycle: number; + constructor(config?: number | string | Config); + destroy(): void; + write(dutyCycle: number): void; +} diff --git a/types/raspi-pwm/raspi-pwm-tests.ts b/types/raspi-pwm/raspi-pwm-tests.ts new file mode 100644 index 0000000000..3b4bf7ef3a --- /dev/null +++ b/types/raspi-pwm/raspi-pwm-tests.ts @@ -0,0 +1,15 @@ +import { Config, PWM } from 'raspi-pwm'; + +const config: Config = { + pin: 'P1-3', + frequency: 1 +}; + +new PWM(); +new PWM(1); +new PWM('P1-3'); +const pwm = new PWM(config); + +pwm.write(1); +pwm.frequency; +pwm.dutyCycle; diff --git a/types/raspi-pwm/tsconfig.json b/types/raspi-pwm/tsconfig.json new file mode 100644 index 0000000000..5e38158098 --- /dev/null +++ b/types/raspi-pwm/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-pwm-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-pwm/tslint.json b/types/raspi-pwm/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-pwm/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-serial/index.d.ts b/types/raspi-serial/index.d.ts new file mode 100644 index 0000000000..033c0682c3 --- /dev/null +++ b/types/raspi-serial/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for raspi-serial 4.0 +// Project: https://github.com/nebrius/raspi-serial +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// +import { Peripheral } from 'raspi-peripheral'; +export const PARITY_NONE = "none"; +export const PARITY_EVEN = "even"; +export const PARITY_ODD = "odd"; +export const PARITY_MARK = "mark"; +export const PARITY_SPACE = "space"; +export const DEFAULT_PORT = "/dev/ttyAMA0"; +export interface Options { + portId?: string; + baudRate?: 115200 | 57600 | 38400 | 19200 | 9600 | 4800 | 2400 | 1800 | 1200 | 600 | 300 | 200 | 150 | 134 | 110 | 75 | 50 | number; + dataBits?: 8 | 7 | 6 | 5; + stopBits?: 1 | 2; + parity?: 'none' | 'even' | 'mark' | 'odd' | 'space'; +} +export type Callback = () => void; +export type ErrorCallback = (err: Error | string) => void; +export class Serial extends Peripheral { + private _portId; + private _options; + private _portInstance; + private _isOpen; + constructor({ portId, baudRate, dataBits, stopBits, parity }?: Options); + readonly port: string; + readonly baudRate: number; + readonly dataBits: number; + readonly stopBits: number; + readonly parity: string; + destroy(): void; + open(cb?: Callback): void; + close(cb?: ErrorCallback): void; + write(data: Buffer | string, cb?: Callback): void; + flush(cb?: ErrorCallback): void; +} diff --git a/types/raspi-serial/raspi-serial-tests.ts b/types/raspi-serial/raspi-serial-tests.ts new file mode 100644 index 0000000000..176c6e1370 --- /dev/null +++ b/types/raspi-serial/raspi-serial-tests.ts @@ -0,0 +1,34 @@ +import { + PARITY_NONE, + PARITY_EVEN, + PARITY_ODD, + PARITY_MARK, + PARITY_SPACE, + DEFAULT_PORT, + Options, + Serial +} from 'raspi-serial'; + +let options: Options = {}; +options = { + parity: PARITY_EVEN +}; +options = { + parity: PARITY_ODD +}; +options = { + parity: PARITY_MARK +}; +options = { + parity: PARITY_SPACE +}; +options = { + portId: DEFAULT_PORT, + baudRate: 9600, + dataBits: 8, + stopBits: 1, + parity: PARITY_NONE +}; + +new Serial(); +const serial = new Serial(options); diff --git a/types/raspi-serial/tsconfig.json b/types/raspi-serial/tsconfig.json new file mode 100644 index 0000000000..c2a6058397 --- /dev/null +++ b/types/raspi-serial/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-serial-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-serial/tslint.json b/types/raspi-serial/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-serial/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/raspi-soft-pwm/index.d.ts b/types/raspi-soft-pwm/index.d.ts new file mode 100644 index 0000000000..098cf9aff7 --- /dev/null +++ b/types/raspi-soft-pwm/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for raspi-soft-pwm 4.0 +// Project: https://github.com/nebrius/raspi-soft-pwm +// Definitions by: Bryan Hughes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { Peripheral } from 'raspi-peripheral'; +export interface Config { + pin: number | string; + frequency?: number; + range?: number; +} +export class SoftPWM extends Peripheral { + private _pwm; + private _frequency; + private _range; + private _dutyCycle; + readonly frequency: number; + readonly range: number; + readonly dutyCycle: number; + constructor(config: number | string | Config); + write(dutyCycle: number): void; +} diff --git a/types/raspi-soft-pwm/raspi-soft-pwm-tests.ts b/types/raspi-soft-pwm/raspi-soft-pwm-tests.ts new file mode 100644 index 0000000000..6cefe9a706 --- /dev/null +++ b/types/raspi-soft-pwm/raspi-soft-pwm-tests.ts @@ -0,0 +1,16 @@ +import { Config, SoftPWM } from 'raspi-soft-pwm'; + +const config: Config = { + pin: 'P1-3', + frequency: 1, + range: 1 +}; + +new SoftPWM(1); +new SoftPWM('P1-3'); +const pwm = new SoftPWM(config); + +pwm.write(1); +pwm.frequency; +pwm.dutyCycle; +pwm.range; diff --git a/types/raspi-soft-pwm/tsconfig.json b/types/raspi-soft-pwm/tsconfig.json new file mode 100644 index 0000000000..aab55c4028 --- /dev/null +++ b/types/raspi-soft-pwm/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "raspi-soft-pwm-tests.ts" + ] +} \ No newline at end of file diff --git a/types/raspi-soft-pwm/tslint.json b/types/raspi-soft-pwm/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/raspi-soft-pwm/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 8c4e4a9985f4b74c39b67bfb1088443da971a605 Mon Sep 17 00:00:00 2001 From: Dima Sabanin Date: Wed, 17 Jan 2018 12:28:37 -0500 Subject: [PATCH 0052/1348] [nano] Support for db/_find API with Mango query language. (#22833) * Support for db/_find API with Mango query language. * Clean up for linter. --- types/nano/index.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++ types/nano/nano-tests.ts | 36 +++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 152954190d..7fafa72382 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -261,6 +261,8 @@ declare namespace nano { params: DocumentViewParams, callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/database/find.html#db-find + find(query: MangoQuery, callback?: Callback>): Request; server: ServerScope; } @@ -1044,6 +1046,91 @@ declare namespace nano { // Current update sequence for the database update_seq: any; } + + type MangoValue = number | string | Date | boolean; + + // http://docs.couchdb.org/en/latest/api/database/find.html#selector-syntax + interface MangoSelector { + [key: string]: MangoSelector | MangoValue | MangoValue[]; + } + + // http://docs.couchdb.org/en/latest/api/database/find.html#sort-syntax + type SortOrder = string | string[] | { [key: string]: 'asc' | 'desc' }; + + interface MangoQuery { + // JSON object describing criteria used to select documents. + selector: MangoSelector; + + // Maximum number of results returned. Default is 25. + limit?: number; + + // Skip the first 'n' results, where 'n' is the value specified. + skip?: number; + + // JSON array following sort syntax. + sort?: SortOrder[]; + + // JSON array specifying which fields of each object should be returned. If it is omitted, + // the entire object is returned. + // http://docs.couchdb.org/en/latest/api/database/find.html#filtering-fields + fields?: string[]; + + // Instruct a query to use a specific index. + // Specified either as "" or ["", ""]. + use_index?: string | [string, string]; + + // Read quorum needed for the result. This defaults to 1. + r?: number; + + // A string that enables you to specify which page of results you require. Used for paging through result sets. + bookmark?: string; + + // Whether to update the index prior to returning the result. Default is true. + update?: boolean; + + // Whether or not the view results should be returned from a “stable” set of shards. + stable?: boolean; + + // Combination of update = false and stable = true options.Possible options: "ok", false (default). + stale?: 'ok' | false; + + // Include execution statistics in the query response. Optional, default: false. + execution_stats?: boolean; + } + + interface MangoResponse { + // Array of documents matching the search. In each matching document, the fields specified in + // the fields part of the request body are listed, along with their values. + docs: D[]; + + // A string that enables you to specify which page of results you require. Used for paging through result sets. + bookmark?: string; + + // Execution warnings + warning?: string; + + // Basic execution statistics for a specific request. + execution_stats?: MangoExecutionStats; + } + + // http://docs.couchdb.org/en/latest/api/database/find.html#execution-statistics + interface MangoExecutionStats { + // Number of index keys examined. Currently always 0. + total_keys_examined: number; + + // Number of documents fetched from the database / index, equivalent to using include_docs = true in a view. + total_docs_examined: number; + + // Number of documents fetched from the database using an out - of - band document fetch. + // This is only non - zero when read quorum > 1 is specified in the query parameters. + total_quorum_docs_examined: number; + + // Number of results returned from the query. + results_returned: number; + + // Total execution time in milliseconds as measured by the database. + execution_time_ms: number; + } } export = nano; diff --git a/types/nano/nano-tests.ts b/types/nano/nano-tests.ts index d38f54bae2..4f13e90f43 100644 --- a/types/nano/nano-tests.ts +++ b/types/nano/nano-tests.ts @@ -118,6 +118,42 @@ mydb.show( ); mydb.replicate("database_replica", (error: any) => {}); +const req = mydb.find({ + selector: { + userId: 1234, + name: 'Paul', + status: { $ne: 'suspended' }, + age: { $gt: 69 }, + building: { + number: { + $in: [101, 203, 205] + } + } + }, + skip: 10, + limit: 1, + use_index: "user_index_doc", + fields: ['name', 'age'], + sort: [{ age: 'desc' }, { name: 'asc' }], + r: 2, + stale: 'ok', + execution_stats: true +}, (resp: nano.MangoResponse, error: any) => { + for (const doc of resp.docs) { + console.log(doc.name); + } + + if (resp.warning) { + console.error(resp.warning); + } + + if (resp.execution_stats) { + console.log(`Execution time: ${resp.execution_stats.execution_time_ms} ms.`); + } +}); + +req.abort(); + /* * Attachments */ From 1eab1479b5ce1969a15608e29531593aa2a41c81 Mon Sep 17 00:00:00 2001 From: dyst5422 Date: Wed, 17 Jan 2018 09:37:03 -0800 Subject: [PATCH 0053/1348] [graphql]: Update to 0.12.x (#22980) * [graphql]: Update to 0.12.x * Changed TypeExtensionNode from TypeExtensionDefinitionNode * Changed some commas to semicolons. --- types/graphql/index.d.ts | 3 +- types/graphql/language/ast.d.ts | 203 ++++++++++++++++++++++++------ types/graphql/language/kinds.d.ts | 6 + 3 files changed, 174 insertions(+), 38 deletions(-) diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 4bca573210..5e8b2f6bd1 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql 0.11 +// Type definitions for graphql 0.12 // Project: https://www.npmjs.com/package/graphql // Definitions by: TonyYang // Caleb Meredith @@ -10,6 +10,7 @@ // Hagai Cohen // Ricardo Portugal // Tim Griesser +// Dylan Stewart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index f4bc343ed2..24344fe904 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -31,6 +31,34 @@ export interface Location { source: Source; } +/** + * Represents the different kinds of tokens in a GraphQL document. + * This type is not inlined in `Token` to fix syntax highlighting on GitHub + * *only*. + */ +type TokenKind = + | '' + | '' + | '!' + | '$' + | '(' + | ')' + | '...' + | ':' + | '=' + | '@' + | '[' + | ']' + | '{' + | '|' + | '}' + | 'Name' + | 'Int' + | 'Float' + | 'String' + | 'BlockString' + | 'Comment'; + /** * Represents a range of characters represented by a lexical token * within a Source. @@ -39,27 +67,7 @@ export interface Token { /** * The kind of Token. */ - kind: - | '' - | '' - | '!' - | '$' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '|' - | '}' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'Comment'; + kind: TokenKind; /** * The character offset at which this Node begins. @@ -134,9 +142,62 @@ export type ASTNode = | EnumTypeDefinitionNode | EnumValueDefinitionNode | InputObjectTypeDefinitionNode - | TypeExtensionDefinitionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode | DirectiveDefinitionNode; +/** + * Utility type listing all nodes indexed by their kind. + */ +export interface ASTKindToNode { + Name: NameNode; + Document: DocumentNode; + OperationDefinition: OperationDefinitionNode; + VariableDefinition: VariableDefinitionNode; + Variable: VariableNode; + SelectionSet: SelectionSetNode; + Field: FieldNode; + Argument: ArgumentNode; + FragmentSpread: FragmentSpreadNode; + InlineFragment: InlineFragmentNode; + FragmentDefinition: FragmentDefinitionNode; + IntValue: IntValueNode; + FloatValue: FloatValueNode; + StringValue: StringValueNode; + BooleanValue: BooleanValueNode; + NullValue: NullValueNode; + EnumValue: EnumValueNode; + ListValue: ListValueNode; + ObjectValue: ObjectValueNode; + ObjectField: ObjectFieldNode; + Directive: DirectiveNode; + NamedType: NamedTypeNode; + ListType: ListTypeNode; + NonNullType: NonNullTypeNode; + SchemaDefinition: SchemaDefinitionNode; + OperationTypeDefinition: OperationTypeDefinitionNode; + ScalarTypeDefinition: ScalarTypeDefinitionNode; + ObjectTypeDefinition: ObjectTypeDefinitionNode; + FieldDefinition: FieldDefinitionNode; + InputValueDefinition: InputValueDefinitionNode; + InterfaceTypeDefinition: InterfaceTypeDefinitionNode; + UnionTypeDefinition: UnionTypeDefinitionNode; + EnumTypeDefinition: EnumTypeDefinitionNode; + EnumValueDefinition: EnumValueDefinitionNode; + InputObjectTypeDefinition: InputObjectTypeDefinitionNode; + ScalarTypeExtension: ScalarTypeExtensionNode; + ObjectTypeExtension: ObjectTypeExtensionNode; + InterfaceTypeExtension: InterfaceTypeExtensionNode; + UnionTypeExtension: UnionTypeExtensionNode; + EnumTypeExtension: EnumTypeExtensionNode; + InputObjectTypeExtension: InputObjectTypeExtensionNode; + DirectiveDefinition: DirectiveDefinitionNode; +} + // Name export interface NameNode { @@ -154,9 +215,12 @@ export interface DocumentNode { } export type DefinitionNode = - | OperationDefinitionNode - | FragmentDefinitionNode - | TypeSystemDefinitionNode; // experimental non-spec addition. + | ExecutableDefinitionNode + | TypeSystemDefinitionNode; // experimental non-spec addition. + +export type ExecutableDefinitionNode = + | OperationDefinitionNode + | FragmentDefinitionNode; export interface OperationDefinitionNode { kind: 'OperationDefinition'; @@ -192,9 +256,9 @@ export interface SelectionSetNode { } export type SelectionNode = - | FieldNode - | FragmentSpreadNode - | InlineFragmentNode; + | FieldNode + | FragmentSpreadNode + | InlineFragmentNode; export interface FieldNode { kind: 'Field'; @@ -234,6 +298,9 @@ export interface FragmentDefinitionNode { kind: 'FragmentDefinition'; loc?: Location; name: NameNode; + // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + variableDefinitions?: VariableDefinitionNode[]; typeCondition: NamedTypeNode; directives?: DirectiveNode[]; selectionSet: SelectionSetNode; @@ -318,9 +385,9 @@ export interface DirectiveNode { // Type Reference export type TypeNode = - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode; + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode; export interface NamedTypeNode { kind: 'NamedType'; @@ -345,7 +412,7 @@ export interface NonNullTypeNode { export type TypeSystemDefinitionNode = | SchemaDefinitionNode | TypeDefinitionNode - | TypeExtensionDefinitionNode + | TypeExtensionNode | DirectiveDefinitionNode; export interface SchemaDefinitionNode { @@ -373,6 +440,7 @@ export type TypeDefinitionNode = export interface ScalarTypeDefinitionNode { kind: 'ScalarTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; } @@ -380,6 +448,7 @@ export interface ScalarTypeDefinitionNode { export interface ObjectTypeDefinitionNode { kind: 'ObjectTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; interfaces?: NamedTypeNode[]; directives?: DirectiveNode[]; @@ -389,6 +458,7 @@ export interface ObjectTypeDefinitionNode { export interface FieldDefinitionNode { kind: 'FieldDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; arguments: InputValueDefinitionNode[]; type: TypeNode; @@ -398,6 +468,7 @@ export interface FieldDefinitionNode { export interface InputValueDefinitionNode { kind: 'InputValueDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; type: TypeNode; defaultValue?: ValueNode; @@ -407,6 +478,7 @@ export interface InputValueDefinitionNode { export interface InterfaceTypeDefinitionNode { kind: 'InterfaceTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; fields: FieldDefinitionNode[]; @@ -415,6 +487,7 @@ export interface InterfaceTypeDefinitionNode { export interface UnionTypeDefinitionNode { kind: 'UnionTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; types: NamedTypeNode[]; @@ -423,6 +496,7 @@ export interface UnionTypeDefinitionNode { export interface EnumTypeDefinitionNode { kind: 'EnumTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; values: EnumValueDefinitionNode[]; @@ -431,6 +505,7 @@ export interface EnumTypeDefinitionNode { export interface EnumValueDefinitionNode { kind: 'EnumValueDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; } @@ -438,20 +513,74 @@ export interface EnumValueDefinitionNode { export interface InputObjectTypeDefinitionNode { kind: 'InputObjectTypeDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; directives?: DirectiveNode[]; fields: InputValueDefinitionNode[]; } -export interface TypeExtensionDefinitionNode { - kind: 'TypeExtensionDefinition'; - loc?: Location; - definition: ObjectTypeDefinitionNode; -} +export type TypeExtensionNode = + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; + +export type ScalarTypeExtensionNode = { + kind: 'ScalarTypeExtension', + loc?: Location, + name: NameNode, + directives?: DirectiveNode[], +}; + +export type ObjectTypeExtensionNode = { + kind: 'ObjectTypeExtension', + loc?: Location, + name: NameNode, + interfaces?: NamedTypeNode[], + directives?: DirectiveNode[], + fields?: FieldDefinitionNode[], +}; + +export type InterfaceTypeExtensionNode = { + kind: 'InterfaceTypeExtension', + loc?: Location, + name: NameNode, + directives?: DirectiveNode[], + fields?: FieldDefinitionNode[], +}; + +export type UnionTypeExtensionNode = { + kind: 'UnionTypeExtension', + loc?: Location, + name: NameNode, + directives?: DirectiveNode[], + types?: NamedTypeNode[], +}; + +export type EnumTypeExtensionNode = { + kind: 'EnumTypeExtension', + loc?: Location, + name: NameNode, + directives?: DirectiveNode[], + values?: EnumValueDefinitionNode[], +}; + +export type InputObjectTypeExtensionNode = { + kind: 'InputObjectTypeExtension', + loc?: Location, + name: NameNode, + directives?: DirectiveNode[], + fields?: InputValueDefinitionNode[], +}; + +// Directive Definitions export interface DirectiveDefinitionNode { kind: 'DirectiveDefinition'; loc?: Location; + description?: StringValueNode; name: NameNode; arguments?: InputValueDefinitionNode[]; locations: NameNode[]; diff --git a/types/graphql/language/kinds.d.ts b/types/graphql/language/kinds.d.ts index 626d350818..f92826f891 100644 --- a/types/graphql/language/kinds.d.ts +++ b/types/graphql/language/kinds.d.ts @@ -60,6 +60,12 @@ export const INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition'; // Type Extensions export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition'; +export const SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension'; +export const OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension'; +export const INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension'; +export const UNION_TYPE_EXTENSION: 'UnionTypeExtension'; +export const ENUM_TYPE_EXTENSION: 'EnumTypeExtension'; +export const INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'; // Directive Definitions From 39b90ab686fe177c763d995047a688e1612e6f46 Mon Sep 17 00:00:00 2001 From: Nikita Moshensky Date: Wed, 17 Jan 2018 19:37:58 +0200 Subject: [PATCH 0054/1348] [ramda] fix path() return type according to documentation (#22963) * [ramda] fix path() return type * add tests --- types/ramda/index.d.ts | 4 ++-- types/ramda/ramda-tests.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 869fa0154e..37444ad500 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1253,8 +1253,8 @@ declare namespace R { /** * Retrieve the value at a given path. */ - path(path: Path, obj: any): T; - path(path: Path): (obj: any) => T; + path(path: Path, obj: any): T | undefined; + path(path: Path): (obj: any) => T | undefined; /** * Determines whether a nested path on an object has a specific value, diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index a90263c0f8..71f8723f9a 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1856,6 +1856,9 @@ class Rectangle { R.path(testPath, testObj); // => 2 R.path(testPath)(testObj); // => 2 + + R.path(['a', 'b'])({c: {b: 2}}); // => undefined + R.path(['a', 'b'], {c: {b: 2}}); // => undefined }; () => { From 93c2e07a9ba22325970b5c568a769c5a2607bb82 Mon Sep 17 00:00:00 2001 From: Benjamin Lowry Date: Thu, 18 Jan 2018 01:40:16 +0800 Subject: [PATCH 0055/1348] Fix Expo AuthSession returnUrl to be optional as per documentation (#22984) --- types/expo/expo-tests.tsx | 4 ++++ types/expo/index.d.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 386cb41b04..9c9cfc979e 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -73,6 +73,10 @@ AuthSession.startAsync({ break; } }); +AuthSession.startAsync({ + authUrl: 'url1', + returnUrl: undefined +}); Audio.setAudioModeAsync({ shouldDuckAndroid: false, diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 89acb6ac10..c9c0ca88f3 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -90,7 +90,7 @@ export class Asset { * AuthSession */ export namespace AuthSession { - function startAsync(options: { authUrl: string; returnUrl: string; }): Promise<{ + function startAsync(options: { authUrl: string; returnUrl?: string; }): Promise<{ type: 'cancel'; } | { type: 'dismissed'; From d4fac01ad6fe6de72355cf31fba4b8d0c1422a83 Mon Sep 17 00:00:00 2001 From: mad-mike Date: Wed, 17 Jan 2018 18:41:59 +0100 Subject: [PATCH 0056/1348] [p-queue] Update to version 2.3 (#22955) * [p-queue] Update to version 2.3 * Apply hints from tslint --- types/p-queue/index.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts index 3cc6acef53..a3d4608bce 100644 --- a/types/p-queue/index.d.ts +++ b/types/p-queue/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for p-queue 1.1 +// Type definitions for p-queue 2.3 // Project: https://github.com/sindresorhus/p-queue#readme // Definitions by: BendingBender // Evan Shortiss @@ -10,12 +10,21 @@ export = PQueue; declare class PQueue { size: number; pending: number; + isPaused: boolean; constructor(opts?: PQueue.Options); add(fn: PQueue.Task, opts?: O): Promise; - onEmpty(): Promise; + addAll(fns: Array>, opts?: O): Promise; + + pause(): void; + + start(): void; + + onEmpty(): Promise; + + onIdle(): Promise; clear(): void; } @@ -38,8 +47,9 @@ declare namespace PQueue { } interface Options { - queueClass?: QueueClassConstructor; concurrency?: number; + autoStart?: boolean; + queueClass?: QueueClassConstructor; } interface DefaultAddOptions { From c1ebcacdb973c28ac16759ae0dac625a4013b9a6 Mon Sep 17 00:00:00 2001 From: John Marinelli Date: Wed, 17 Jan 2018 18:42:48 +0100 Subject: [PATCH 0057/1348] Replace Vector3 with Vector2 for lathe geometry type, edit tests (#22895) --- types/three/test/webgl/webgl_geometries.ts | 6 +++--- types/three/three-core.d.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/three/test/webgl/webgl_geometries.ts b/types/three/test/webgl/webgl_geometries.ts index 89e0af480c..32ab4270b4 100644 --- a/types/three/test/webgl/webgl_geometries.ts +++ b/types/three/test/webgl/webgl_geometries.ts @@ -76,11 +76,11 @@ // - var points: THREE.Vector3[] = []; + var points: THREE.Vector2[] = []; for (var i = 0; i < 50; i++) { - points.push(new THREE.Vector3(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, 0, (i - 5) * 2)); + points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, 0)); } @@ -165,4 +165,4 @@ } -} \ No newline at end of file +} diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 880a150a06..06bb1e02d0 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6644,10 +6644,10 @@ export class IcosahedronGeometry extends PolyhedronGeometry { } export class LatheBufferGeometry extends BufferGeometry { - constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + constructor(points: Vector2[], segments?: number, phiStart?: number, phiLength?: number); parameters: { - points: Vector3[]; + points: Vector2[]; segments: number; phiStart: number; phiLength: number; @@ -6655,10 +6655,10 @@ export class LatheBufferGeometry extends BufferGeometry { } export class LatheGeometry extends Geometry { - constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + constructor(points: Vector2[], segments?: number, phiStart?: number, phiLength?: number); parameters: { - points: Vector3[]; + points: Vector2[]; segments: number; phiStart: number; phiLength: number; From 16937e5e2872d7c3161d462428227a2ace1e5763 Mon Sep 17 00:00:00 2001 From: Nikola Vidic Date: Wed, 17 Jan 2018 18:43:45 +0100 Subject: [PATCH 0058/1348] [sequelize] Update addColumn and removeColumn (#22965) * [sequelize] Update addColumn and removeColumn * update squelize-tests.ts --- types/sequelize/index.d.ts | 10 ++++++---- types/sequelize/sequelize-tests.ts | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 2db7dcfe11..6bc7c06dff 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -9,6 +9,7 @@ // Nick Mueller // Philippe D'Alva // Carven Zhang +// Nikola Vidic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1332,8 +1333,8 @@ declare namespace sequelize { */ keyType?: DataTypeAbstract; /** - * A string to represent the name of the field to use as the key for an 1 to many association in the source table. - * + * A string to represent the name of the field to use as the key for an 1 to many association in the source table. + * * @see http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-hasMany * @see https://github.com/sequelize/sequelize/blob/b4fd46426db9cdbb97074bea121203d565e4195d/lib/associations/has-many.js#L81 */ @@ -4192,13 +4193,14 @@ declare namespace sequelize { /** * Adds a new column to a table */ - addColumn(table: string, key: string, attribute: DefineAttributeColumnOptions | DataTypeAbstract, + addColumn(tableName: string | { tableName?: string, schema?: string }, key: string, attribute: DefineAttributeColumnOptions | DataTypeAbstract, options?: QueryInterfaceOptions): Promise; /** * Removes a column from a table */ - removeColumn(table: string, attribute: string, options?: QueryInterfaceOptions): Promise; + removeColumn(tableName: string | { tableName?: string, schema?: string }, attribute: string, + options?: QueryInterfaceOptions): Promise; /** * Changes a column diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 29e9252fe4..e32ae0b008 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1144,6 +1144,9 @@ queryInterface.createTable( 'users', { id : { type : Sequelize.INTEGER, primaryK queryInterface.createTable( 'level', { id : { type : Sequelize.INTEGER, primaryKey : true, autoIncrement : true } } ); queryInterface.addColumn( 'users', 'someEnum', Sequelize.ENUM( 'value1', 'value2', 'value3' ) ); queryInterface.addColumn( 'users', 'so', { type : Sequelize.ENUM, values : ['value1', 'value2', 'value3'] } ); +queryInterface.addColumn({tableName:'users', schema:'test'}, 'enum',{ type : Sequelize.ENUM, values : ['value1', 'value2', 'value3'] }); +queryInterface.removeColumn('users','so'); +queryInterface.removeColumn({tableName:'users', schema:'test'},'enum'); queryInterface.createTable( 'hosts', { id : { type : Sequelize.INTEGER, From 71ca70ae88ed000ad73e997d299ee266c6db8716 Mon Sep 17 00:00:00 2001 From: Johannes Walleboom Date: Wed, 17 Jan 2018 18:44:24 +0100 Subject: [PATCH 0059/1348] Type fix for checkOrigin (#22925) checkOrigin can also be an array of allowed origins. --- types/iframe-resizer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/iframe-resizer/index.d.ts b/types/iframe-resizer/index.d.ts index 8d65629da6..70d9c1d4f3 100644 --- a/types/iframe-resizer/index.d.ts +++ b/types/iframe-resizer/index.d.ts @@ -37,7 +37,7 @@ export interface IFrameOptions { * If your iFrame navigates between different domains, ports or protocols; then you will need to * provide an array of URLs or disable this option. */ - checkOrigin?: boolean; + checkOrigin?: boolean | string[]; /** * When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled. */ From cc668c2e386ef56a1e2d50811c873481df6787bb Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Wed, 17 Jan 2018 10:44:51 -0700 Subject: [PATCH 0060/1348] [@types/caseless] Add Httpified interface. (#22935) To allow importing libs to extend the interface. Objects passed into `caseless.httpify` are extended with these methods. --- types/caseless/caseless-tests.ts | 19 ++++++++++++++++++- types/caseless/index.d.ts | 10 ++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/types/caseless/caseless-tests.ts b/types/caseless/caseless-tests.ts index 2fb16afaad..57eaae605e 100644 --- a/types/caseless/caseless-tests.ts +++ b/types/caseless/caseless-tests.ts @@ -1,4 +1,4 @@ -import caseless, { Caseless, httpify } from "caseless"; +import caseless, { Caseless, httpify, Httpified } from "caseless"; new Caseless(); // $ExpectError @@ -38,3 +38,20 @@ httpify({}, 1); // $ExpectError httpify({}, "2"); // $ExpectError httpify({}, {}); // $ExpectType Caseless + +const request: Httpified = {}; // $ExpectError + +request.setHeader({}); // $ExpectType void +request.setHeader('foo', 'bar'); // $ExpectType string | false +request.setHeader('foo', 'bar', false); // $ExpectType string | false +request.setHeader('foo', new Date()); // $ExpectType string | false +request.setHeader(10, 'bar'); // $ExpectError + +request.getHeader('foo'); // $ExpectType any +request.getHeader(10); // $ExpectError + +request.hasHeader('foo'); // $ExpectType string | false +request.hasHeader(10); // $ExpectError + +request.removeHeader('foo'); // $ExpectType boolean +request.headers = {}; diff --git a/types/caseless/index.d.ts b/types/caseless/index.d.ts index db295a8f89..9b19f8a150 100644 --- a/types/caseless/index.d.ts +++ b/types/caseless/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for caseless 0.12 // Project: https://github.com/mikeal/caseless // Definitions by: downace +// Matt R. Wilson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,6 +18,15 @@ export interface Caseless { del(name: KeyType): boolean; } +export interface Httpified { + headers: RawDict; + setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + setHeader(dict: RawDict): void; + hasHeader(name: KeyType): KeyType | false; + getHeader(name: KeyType): ValueType | undefined; + removeHeader(name: KeyType): boolean; +} + export function httpify(resp: object, headers: RawDict): Caseless; declare function caseless(dict?: RawDict): Caseless; From f1c07c65abc162426a3e4442e52b475d7490f79d Mon Sep 17 00:00:00 2001 From: kuhlebrock Date: Wed, 17 Jan 2018 18:45:20 +0100 Subject: [PATCH 0061/1348] Add resize.auto as an optional property to ChartConfiguration (#22956) --- types/c3/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 96ecc8c488..322adce77d 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -61,6 +61,13 @@ export interface ChartConfiguration { left?: number; }; + resize?: { + /** + * Indicate if the chart should automatically get resized when the window gets resized. + */ + auto?: boolean; + }; + color?: { /** * Set custom color pattern. From 5076877fc78d994cd6afc440ff0c3afa489e15f7 Mon Sep 17 00:00:00 2001 From: Damian Osipiuk Date: Wed, 17 Jan 2018 18:46:24 +0100 Subject: [PATCH 0062/1348] react-jsonschema-form: Fixed typo in ArrayFieldTemplateProps definition (#22951) --- types/react-jsonschema-form/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts index e6ad7c52ab..785ee072e9 100644 --- a/types/react-jsonschema-form/index.d.ts +++ b/types/react-jsonschema-form/index.d.ts @@ -122,7 +122,7 @@ declare module "react-jsonschema-form" { export type ArrayFieldTemplateProps = { DescriptionField: object; TitleField: object; - candAdd: boolean; + canAdd: boolean; className: string; disabled: boolean; idSchema: IdSchema; From 17d8fcc76fc92969b0df61397dfef10ff2189c7c Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Wed, 17 Jan 2018 18:46:52 +0100 Subject: [PATCH 0063/1348] Add id to mongodb gridfs upload streams (#22930) As seen in http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream: ```js var uploadStream = bucket.openUploadStream('test.dat'); var license = fs.readFileSync('./LICENSE'); var id = uploadStream.id; ``` The resulting stream from `openUploadStream` *has* an id. --- types/mongodb/index.d.ts | 12 ++++++++---- types/mongodb/v2/index.d.ts | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index ae52d70e14..7fcbecf754 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -31,7 +31,7 @@ export class MongoClient extends EventEmitter { static connect(uri: string, callback: MongoCallback): void; static connect(uri: string, options?: MongoClientOptions): Promise; static connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void; - /** + /** * @deprecated * http://mongodb.github.io/node-mongodb-native/3.0/api/MongoClient.html#connect */ @@ -830,7 +830,7 @@ export interface CollectionAggregationOptions { collation?: Object; comment?: string session?: ClientSession; - + } /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertMany */ @@ -1353,7 +1353,7 @@ export class GridFSBucket { /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openUploadStream */ openUploadStream(filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#openUploadStreamWithId */ - openUploadStreamWithId(id: string | number | Object, filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; + openUploadStreamWithId(id: GridFSBucketWriteStreamId, filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; /** http://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucket.html#rename */ rename(id: ObjectID, filename: string, callback?: GridFSBucketErrorCallback): void; } @@ -1391,6 +1391,7 @@ export interface GridFSBucketOpenUploadStreamOptions { /** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketReadStream.html */ export class GridFSBucketReadStream extends Readable { + id: ObjectID; constructor(chunks: Collection, files: Collection, readPreference: Object, filter: Object, options?: GridFSBucketReadStreamOptions); } @@ -1404,14 +1405,17 @@ export interface GridFSBucketReadStreamOptions { /** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketWriteStream.html */ export class GridFSBucketWriteStream extends Writable { + id: GridFSBucketWriteStreamId; constructor(bucket: GridFSBucket, filename: string, options?: GridFSBucketWriteStreamOptions); } /** https://mongodb.github.io/node-mongodb-native/3.0/api/GridFSBucketWriteStream.html */ export interface GridFSBucketWriteStreamOptions { - id?: string | number | Object, + id?: GridFSBucketWriteStreamId, chunkSizeBytes?: number, w?: number, wtimeout?: number, j?: number } + +type GridFSBucketWriteStreamId = string | number | Object | ObjectID; diff --git a/types/mongodb/v2/index.d.ts b/types/mongodb/v2/index.d.ts index 6cf21c04b9..ec3e3965ba 100644 --- a/types/mongodb/v2/index.d.ts +++ b/types/mongodb/v2/index.d.ts @@ -1371,7 +1371,7 @@ export class GridFSBucket { // http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStream openUploadStream(filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; // http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#openUploadStreamWithId - openUploadStreamWithId(id: string | number | Object, filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; + openUploadStreamWithId(id: GridFSBucketWriteStreamId, filename: string, options?: GridFSBucketOpenUploadStreamOptions): GridFSBucketWriteStream; // http://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucket.html#rename rename(id: ObjectID, filename: string, callback?: GridFSBucketErrorCallback): void; } @@ -1409,6 +1409,7 @@ export interface GridFSBucketOpenUploadStreamOptions { // https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html export class GridFSBucketReadStream extends Readable { + id: ObjectID; constructor(chunks: Collection, files: Collection, readPreference: Object, filter: Object, options?: GridFSBucketReadStreamOptions); } @@ -1422,14 +1423,17 @@ export interface GridFSBucketReadStreamOptions { // https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html export class GridFSBucketWriteStream extends Writable { + id: GridFSBucketWriteStreamId; constructor(bucket: GridFSBucket, filename: string, options?: GridFSBucketWriteStreamOptions); } // https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketWriteStream.html export interface GridFSBucketWriteStreamOptions { - id?: string | number | Object, + id?: GridFSBucketWriteStreamId, chunkSizeBytes?: number, w?: number, wtimeout?: number, j?: number } + +type GridFSBucketWriteStreamId = string | number | Object | ObjectID; From c2ce00278b94aa3c7b36be5a2030518c963c6106 Mon Sep 17 00:00:00 2001 From: Spencer Elliott Date: Wed, 17 Jan 2018 09:47:22 -0800 Subject: [PATCH 0064/1348] Define webpack.ProgressPlugin handler with all 5 arguments (#22936) webpack can pass up to 5 arguments to the progress handler: https://github.com/webpack/webpack/blob/b545b519b2024e3f8be3041385bd326bf5d24449/lib/ProgressPlugin.js#L41-L46 For example, simple-progress-webpack-plugin uses all 5 arguments: https://github.com/dominique-mueller/simple-progress-webpack-plugin/blob/246f4795968d49a8b9ecf05ff3f38a100519ac93/logger/verbose-logger.js#L23 --- types/webpack/index.d.ts | 3 ++- types/webpack/webpack-tests.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 18eed1cc7a..db8bb35c72 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -8,6 +8,7 @@ // Jonathan Creamer // Ahmed T. Ali // Alan Agius +// Spencer Elliott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -853,7 +854,7 @@ declare namespace webpack { } class ProgressPlugin extends Plugin { - constructor(options?: (percentage: number, msg: string) => void); + constructor(options?: (percentage: number, msg: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => void); } class EnvironmentPlugin extends Plugin { diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 0816416c2c..becaa20dd6 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -453,6 +453,7 @@ plugin = new webpack.LoaderOptionsPlugin({ plugin = new webpack.EnvironmentPlugin(['a', 'b']); plugin = new webpack.EnvironmentPlugin({ a: true, b: 'c' }); plugin = new webpack.ProgressPlugin((percent: number, message: string) => { }); +plugin = new webpack.ProgressPlugin((percent: number, message: string, moduleProgress?: string, activeModules?: string, moduleName?: string) => { }); plugin = new webpack.HashedModuleIdsPlugin(); plugin = new webpack.HashedModuleIdsPlugin({ hashFunction: 'sha256', From ce95a260e0ce1120bd5393de0a985f53b8d0ab3a Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 17 Jan 2018 10:48:17 -0700 Subject: [PATCH 0065/1348] =?UTF-8?q?Ember=20Feature=20Flags:=20use=20inte?= =?UTF-8?q?rface=20to=20support=20merging=20user-defined=20pr=E2=80=A6=20(?= =?UTF-8?q?#22927)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ember Feature Flags: use interface to support merging user-defined props. * Fix test file name. * Inline (in-file?) `assertType` for ember-feature-flags. --- .../ember-feature-flags-tests.ts | 17 +++++++++++++++-- types/ember-feature-flags/index.d.ts | 2 +- types/ember-feature-flags/tslint.json | 7 ++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/types/ember-feature-flags/ember-feature-flags-tests.ts b/types/ember-feature-flags/ember-feature-flags-tests.ts index 063aeea927..bfcfaae62e 100644 --- a/types/ember-feature-flags/ember-feature-flags-tests.ts +++ b/types/ember-feature-flags/ember-feature-flags-tests.ts @@ -1,14 +1,27 @@ import Features from 'ember-feature-flags'; import 'ember-feature-flags/tests/helpers/with-feature'; +/** Static assertion that `value` has type `T` */ +// Disable tslint here b/c the generic is used to let us do a type coercion and +// validate that coercion works for the type value "passed into" the function. +// tslint:disable-next-line:no-unnecessary-generics +export declare function assertType(value: T): void; + +declare module 'ember-feature-flags' { + export default interface Features { + someFeature: boolean; + } +} + // https://www.npmjs.com/package/ember-feature-flags#withfeature declare var features: Features; features.isEnabled('new-billing-plans'); // $ExpectType boolean features.enable('newHomepage'); // $ExpectType void features.disable('newHomepage'); // $ExpectType void const setup = { - "new-billing-plans": true, - "new-homepage": false + 'new-billing-plans': true, + 'new-homepage': false }; features.setup(setup); // $ExpectType void withFeature('new-homepage'); // $ExpectType void +assertType(features.get('someFeature')); diff --git a/types/ember-feature-flags/index.d.ts b/types/ember-feature-flags/index.d.ts index 8aec1a6f0a..94b443afae 100644 --- a/types/ember-feature-flags/index.d.ts +++ b/types/ember-feature-flags/index.d.ts @@ -7,7 +7,7 @@ import Ember from 'ember'; // https://github.com/kategengler/ember-feature-flags/blob/v3.0.0/addon/services/features.js#L5 -export default class Features extends Ember.Service { +export default interface Features extends Ember.Service { setup(features: { [key: string]: boolean }): void; enable(feature: string): void; disable(feature: string): void; diff --git a/types/ember-feature-flags/tslint.json b/types/ember-feature-flags/tslint.json index 3db14f85ea..4c4fc86ace 100644 --- a/types/ember-feature-flags/tslint.json +++ b/types/ember-feature-flags/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false + } +} From 1df22278c5d2e33a82ea353cdd890743bb7de604 Mon Sep 17 00:00:00 2001 From: Garanzha Dmitriy Date: Wed, 17 Jan 2018 19:49:13 +0200 Subject: [PATCH 0066/1348] @types/nock Multiple set cookie. (#22921) --- types/nock/index.d.ts | 3 ++- types/nock/nock-tests.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/nock/index.d.ts b/types/nock/index.d.ts index 8c6e4f2faf..91037b8e54 100644 --- a/types/nock/index.d.ts +++ b/types/nock/index.d.ts @@ -4,6 +4,7 @@ // Horiuchi_H // afharo // Matt R. Wilson +// Garanzha Dmitriy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -34,7 +35,7 @@ declare namespace nock { export var back: NockBack; - type HttpHeaders = { [key: string]: string | { (req: any, res: any, body: string): any; }; }; + type HttpHeaders = { [key: string]: string | string[] | { (req: any, res: any, body: string): any; }; }; type InterceptFunction = ( uri: string | RegExp | { (uri: string): boolean; }, requestBody?: string | RegExp | { (body: any): boolean; } | any, diff --git a/types/nock/nock-tests.ts b/types/nock/nock-tests.ts index 180c7a9c63..e81e3fd096 100644 --- a/types/nock/nock-tests.ts +++ b/types/nock/nock-tests.ts @@ -368,6 +368,12 @@ var scope = nock('http://www.headdy.com') 'X-My-Headers': 'My Header value' }); +var scope = nock('http://www.headdy.com') + .get('/') + .reply(200, 'Hello World!', { + 'X-My-Headers': ['My Header value 1', 'My Header value 2'] + }); + var scope = nock('http://www.headdy.com') .get('/') .reply(200, 'Hello World!', { From 2e11609c20806ceae986969f92ea340cf77aabf3 Mon Sep 17 00:00:00 2001 From: spacejack Date: Wed, 17 Jan 2018 12:49:36 -0500 Subject: [PATCH 0067/1348] Add WebVRManager, ArrayCamera support (#22900) --- types/three/test/webvr/webvr.ts | 13 +++++++++++++ types/three/three-core.d.ts | 19 +++++++++++++++++++ types/three/tsconfig.json | 5 +++-- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 types/three/test/webvr/webvr.ts diff --git a/types/three/test/webvr/webvr.ts b/types/three/test/webvr/webvr.ts new file mode 100644 index 0000000000..e831e493ee --- /dev/null +++ b/types/three/test/webvr/webvr.ts @@ -0,0 +1,13 @@ +// WebVRManager support + +() => { + const renderer = new THREE.WebGLRenderer(); + renderer.vr.enabled = true; + const camera = new THREE.PerspectiveCamera(); + const vrCamera = renderer.vr.getCamera(camera); + const display: VRDisplay = renderer.vr.getDevice(); + renderer.vr.setDevice(display); + const obj = new THREE.Object3D(); + renderer.vr.setPoseTarget(obj); + renderer.vr.dispose(); +} diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 06bb1e02d0..a2c4b05544 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -656,6 +656,13 @@ export class StereoCamera extends Camera { update(camera: PerspectiveCamera): void; } +export class ArrayCamera extends PerspectiveCamera { + constructor(cameras?: PerspectiveCamera[]); + + cameras: PerspectiveCamera[]; + isArrayCamera: true; +} + // Core /////////////////////////////////////////////////////////////////////////////////////////////// /** @@ -5134,6 +5141,8 @@ export class WebGLRenderer implements Renderer { state: WebGLState; allocTextureUnit: any; + vr: WebVRManager; + /** * Return the WebGL context. */ @@ -7077,3 +7086,13 @@ export class MorphBlendMesh extends Mesh { stopAnimation(name: string): void; update(delta: number): void; } + +export interface WebVRManager { + enabled: boolean; + getDevice(): VRDisplay | null; + setDevice(device: VRDisplay | null): void; + setPoseTarget(object: Object3D | null): void; + getCamera(camera: PerspectiveCamera): PerspectiveCamera | ArrayCamera; + submitFrame(): void; + dispose(): void; +} diff --git a/types/three/tsconfig.json b/types/three/tsconfig.json index 1e615b65b1..4faf2d0b0c 100644 --- a/types/three/tsconfig.json +++ b/types/three/tsconfig.json @@ -54,6 +54,7 @@ "test/examples/controls/vrcontrols.ts", "test/examples/ctm/ctmloader.ts", "test/examples/octree.ts", - "test/examples/loaders/webgl_loader_obj_mtl.ts" + "test/examples/loaders/webgl_loader_obj_mtl.ts", + "test/webvr/webvr.ts" ] -} \ No newline at end of file +} From f2435def782ea259f0e8b04d5c82ba6972c25b38 Mon Sep 17 00:00:00 2001 From: ManeeshSharma17 Date: Wed, 17 Jan 2018 23:20:02 +0530 Subject: [PATCH 0068/1348] fix(types): add col to CountOptions and FindOptions interface (#22914) * fix(types): add col to CountOptions and FindOptions interface Added missing property 'col' in CountOptions and FindOptions interface. * Added missing property 'col' in CountOptions and FindOptions interface in v3 * added testcase * remove col attribute from FindOptions * Removed whitespaces --- types/sequelize/index.d.ts | 6 +++++- types/sequelize/sequelize-tests.ts | 1 + types/sequelize/v3/index.d.ts | 5 +++++ types/sequelize/v3/sequelize-tests.ts | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 6bc7c06dff..f94d95ec26 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3322,7 +3322,6 @@ declare namespace sequelize { */ group?: string | string[] | Object; - /** * Apply DISTINCT(col) for FindAndCount(all) */ @@ -3356,6 +3355,11 @@ declare namespace sequelize { */ include?: Array | IncludeOptions>; + /** + * Apply column on which COUNT() should be applied + */ + col?: string; + /** * Apply COUNT(DISTINCT(col)) */ diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index e32ae0b008..0f329171e7 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -980,6 +980,7 @@ User.count( { include : [{ model : User, required : false }] } ); User.count( { distinct : true, include : [{ model : User, required : false }] } ); User.count( { attributes : ['data'], group : ['data'] } ); User.count( { where : { access_level : { gt : 5 } } } ); +User.count( { col: 'title', distinct: true, where : { access_level : { gt : 5 } } } ); User.findAndCountAll( { offset : 5, limit : 1, include : [User, { model : User, as : 'a' }] } ); diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index d777303d94..9453a8473d 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -3243,6 +3243,11 @@ declare namespace sequelize { */ include?: Array | IncludeOptions>; + /** + * Apply column on which COUNT() should be applied + */ + col?: string; + /** * Apply COUNT(DISTINCT(col)) */ diff --git a/types/sequelize/v3/sequelize-tests.ts b/types/sequelize/v3/sequelize-tests.ts index 4a3ba51753..b575271867 100644 --- a/types/sequelize/v3/sequelize-tests.ts +++ b/types/sequelize/v3/sequelize-tests.ts @@ -930,6 +930,7 @@ User.count( { include : [{ model : User, required : false }] } ); User.count( { distinct : true, include : [{ model : User, required : false }] } ); User.count( { attributes : ['data'], group : ['data'] } ); User.count( { where : { access_level : { gt : 5 } } } ); +User.count( { col: 'title', distinct: true, where : { access_level : { gt : 5 } } } ); User.findAndCountAll( { offset : 5, limit : 1, include : [User, { model : User, as : 'a' }] } ); From 3a501549c269956d8dc6140654daef09fb1f0ef9 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Wed, 17 Jan 2018 09:50:17 -0800 Subject: [PATCH 0069/1348] read-pkg-up: fix return value (#22928) --- types/read-pkg-up/index.d.ts | 8 ++++---- types/read-pkg-up/read-pkg-up-tests.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/types/read-pkg-up/index.d.ts b/types/read-pkg-up/index.d.ts index bdfd304827..9a7e689577 100644 --- a/types/read-pkg-up/index.d.ts +++ b/types/read-pkg-up/index.d.ts @@ -7,8 +7,8 @@ import normalize = require('normalize-package-data'); declare namespace ReadPkgUp { - function sync(options: Options & {normalize: false}): {[k: string]: any}; - function sync(options?: Options): normalize.Package; + function sync(options: Options & {normalize: false}): {path: string, pkg: {[k: string]: any}}; + function sync(options?: Options): {path: string, pkg: Package}; interface Options { /** @@ -28,7 +28,7 @@ declare namespace ReadPkgUp { type Package = normalize.Package; } -declare function ReadPkgUp(options: ReadPkgUp.Options & {normalize: false}): Promise<{[k: string]: any}>; -declare function ReadPkgUp(options?: ReadPkgUp.Options): Promise; +declare function ReadPkgUp(options: ReadPkgUp.Options & {normalize: false}): Promise<{path: string, pkg: {[k: string]: any}}>; +declare function ReadPkgUp(options?: ReadPkgUp.Options): Promise<{path: string, pkg: normalize.Package}>; export = ReadPkgUp; diff --git a/types/read-pkg-up/read-pkg-up-tests.ts b/types/read-pkg-up/read-pkg-up-tests.ts index 32943d57bb..f8d54daaf6 100644 --- a/types/read-pkg-up/read-pkg-up-tests.ts +++ b/types/read-pkg-up/read-pkg-up-tests.ts @@ -1,8 +1,8 @@ import ReadPkgUp = require('read-pkg-up'); -ReadPkgUp().then(pkg => pkg.name); // $ExpectType Promise -ReadPkgUp({cwd: '.', normalize: true}).then(pkg => pkg.name); // $ExpectType Promise -ReadPkgUp({cwd: '.', normalize: false}).then(pkg => pkg['name']); // $ExpectType Promise -ReadPkgUp.sync().name; // $ExpectType string -ReadPkgUp.sync({cwd: '.', normalize: true}).name; // $ExpectType string -ReadPkgUp.sync({cwd: '.', normalize: false})['name']; // $ExpectType any +ReadPkgUp().then(pkg => pkg.pkg.name); // $ExpectType Promise +ReadPkgUp({cwd: '.', normalize: true}).then(pkg => pkg.pkg.name); // $ExpectType Promise +ReadPkgUp({cwd: '.', normalize: false}).then(pkg => pkg.pkg['name']); // $ExpectType Promise +ReadPkgUp.sync().pkg.name; // $ExpectType string +ReadPkgUp.sync({cwd: '.', normalize: true}).pkg.name; // $ExpectType string +ReadPkgUp.sync({cwd: '.', normalize: false}).pkg['name']; // $ExpectType any From 6af5b8d3a5332ae9fa961f3354c4b47f5b64f1ce Mon Sep 17 00:00:00 2001 From: Rob Moran Date: Wed, 17 Jan 2018 17:51:17 +0000 Subject: [PATCH 0070/1348] Added correct flag type to Interface.release() in usb package (#22832) * Added correct flag type to Interface.release() in usb package * Update Interface.release() to outline both ways of calling it * Added missing fields, fixed the bMaxPacketSize0 field name and highlighted the params are optional in InEndpoint.startPoll() * Add undocumented descriptor fields --- types/usb/index.d.ts | 13 +++++++++++-- types/usb/usb-tests.ts | 28 ++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/types/usb/index.d.ts b/types/usb/index.d.ts index 5e24e16bac..7d3a5d8c89 100644 --- a/types/usb/index.d.ts +++ b/types/usb/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-usb 1.1 // Project: https://github.com/tessel/node-usb // Definitions by: Eric Brody +// Rob Moran // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -14,6 +15,8 @@ export class Device { portNumbers: number[]; deviceDescriptor: DeviceDescriptor; configDescriptor: ConfigDescriptor; + allConfigDescriptors: ConfigDescriptor[]; + parent: Device; interfaces: Interface[]; __open(): void; @@ -35,7 +38,7 @@ export class DeviceDescriptor { bDeviceClass: number; bDeviceSubClass: number; bDeviceProtocol: number; - bMaxPacketSize: number; + bMaxPacketSize0: number; idVendor: number; idProduct: number; bcdDevice: number; @@ -55,14 +58,18 @@ export class ConfigDescriptor { bmAttributes: number; bMaxPower: number; extra: Buffer; + interfaces: InterfaceDescriptor[][]; } export class Interface { + interface: number; + altSetting: number; descriptor: InterfaceDescriptor; endpoints: Endpoint[]; constructor(device: Device, id: number); claim(): void; - release(closeEndpoints?: (err?: string) => void, cb?: (err?: string) => void): void; + release(cb?: (err?: string) => void): void; + release(closeEndpoints?: boolean, cb?: (err?: string) => void): void; isKernelDriverActive(): boolean; detachKernelDriver(): number; attachKernelDriver(): number; @@ -81,6 +88,7 @@ export class InterfaceDescriptor { bInterfaceProtocol: number; iInterface: number; extra: Buffer; + endpoints: EndpointDescriptor[]; } export interface Endpoint extends EventEmitter { @@ -120,6 +128,7 @@ export class EndpointDescriptor { bInterval: number; bRefresh: number; bSynchAddress: number; + extra: Buffer; } export function findByIds(vid: number, pid: number): Device; diff --git a/types/usb/usb-tests.ts b/types/usb/usb-tests.ts index 53b214460e..44701c655b 100644 --- a/types/usb/usb-tests.ts +++ b/types/usb/usb-tests.ts @@ -25,7 +25,7 @@ deviceDesc.bcdUSB = 1; deviceDesc.bDeviceClass = 1; deviceDesc.bDeviceSubClass = 1; deviceDesc.bDeviceProtocol = 1; -deviceDesc.bMaxPacketSize = 1; +deviceDesc.bMaxPacketSize0 = 1; deviceDesc.idVendor = 1; deviceDesc.idProduct = 1; deviceDesc.bcdDevice = 1; @@ -51,16 +51,37 @@ configDesc.extra = new Buffer([]); const deviceInterface: usb.Interface = device.interface(1); device.interfaces = [deviceInterface]; +device.parent = device; +device.configDescriptor = configDesc; +device.allConfigDescriptors = [configDesc]; const iface = new usb.Interface(device, 1); +iface.interface = 1; +iface.altSetting = 0; iface.claim(); -iface.release((error: string) => null, (error: string) => null); +iface.release((error: string) => null); +iface.release(false, (error: string) => null); const kernelActive: boolean = iface.isKernelDriverActive(); const detachKernel: number = iface.detachKernelDriver(); const attachKernel: number = iface.attachKernelDriver(); iface.setAltSetting(1, (error: string) => null); +const ifaceDesc: usb.InterfaceDescriptor = new usb.InterfaceDescriptor(); + +ifaceDesc.bLength = 1; +ifaceDesc.bDescriptorType = 1; +ifaceDesc.bInterfaceNumber = 1; +ifaceDesc.bAlternateSetting = 1; +ifaceDesc.bNumEndpoints = 1; +ifaceDesc.bInterfaceClass = 1; +ifaceDesc.bInterfaceSubClass = 1; +ifaceDesc.bInterfaceProtocol = 1; +ifaceDesc.iInterface = 1; +ifaceDesc.extra = new Buffer([]); + +iface.descriptor = ifaceDesc; + const endpointDesc: usb.EndpointDescriptor = new usb.EndpointDescriptor(); endpointDesc.bLength = 1; @@ -71,6 +92,7 @@ endpointDesc.wMaxPacketSize = 1; endpointDesc.bInterval = 1; endpointDesc.bRefresh = 1; endpointDesc.bSynchAddress = 1; +endpointDesc.extra = new Buffer([]); const ifaceInEndpoint: usb.Endpoint = iface.endpoint(1) as usb.InEndpoint; const ifaceOutEndpoint: usb.Endpoint = iface.endpoint(1) as usb.OutEndpoint; @@ -98,6 +120,8 @@ inEndpoint.on("error", (err) => null); const xferOutEndpoint: usb.OutEndpoint = outEndpoint.transfer(new Buffer([]), (error: string) => null); outEndpoint.transferWithZLP(new Buffer([]), (error: string) => null); +iface.endpoints = [inEndpoint, outEndpoint]; + const findByDevice: usb.Device = usb.findByIds(1, 1); usb.on("hey", (device: usb.Device) => null); const deviceList: usb.Device[] = usb.getDeviceList(); From 2037b3b9baf6be00bc9a33c0837e16160af0e7ef Mon Sep 17 00:00:00 2001 From: Charles-Philippe Clermont Date: Wed, 17 Jan 2018 12:51:52 -0500 Subject: [PATCH 0071/1348] propEq with one argument returns a curried function (#22923) --- types/ramda/index.d.ts | 14 ++++++-------- types/ramda/ramda-tests.ts | 7 +++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 37444ad500..ccd73c53d3 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1487,14 +1487,12 @@ declare namespace R { * value according to strict equality (`===`). Most likely used to * filter a list. */ - // propEq(name: string, val: T, obj: {[index:string]: T}): boolean; - // propEq(name: string, val: T, obj: {[index:number]: T}): boolean; - propEq(name: string, val: T, obj: any): boolean; - // propEq(name: number, val: T, obj: any): boolean; - propEq(name: string, val: T): (obj: any) => boolean; - // propEq(name: number, val: T): (obj: any) => boolean; - propEq(name: string): (val: T, obj: any) => boolean; - // propEq(name: number): (val: T, obj: any) => boolean; + propEq(name: string | number, val: T, obj: any): boolean; + propEq(name: string | number, val: T): (obj: any) => boolean; + propEq(name: string | number): { + (val: T, obj: any): boolean; + (val: T): (obj: any) => boolean; + }; /** * Returns true if the specified object property is of the given type; false otherwise. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 71f8723f9a..e6433df004 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -583,6 +583,13 @@ R.times(i, 5); R.filter(isFamous, users); // => [ user1 ] }; +() => { + const coll = [{ type: 'BUY' }, { type: 'SELL' }, { type: 'BUY' }]; + const typeIs = R.propEq('type'); + const isBuy = typeIs('BUY'); + R.filter(isBuy, coll); // [{ type: 'BUY' }, { type: 'BUY' }] +}; + () => { const xs: { [key: string]: string } = {a: "1", b: "0"}; R.propEq("a", "1", xs); // => true From 8b902e076f7cea92ed98deac36104c4b93ee580f Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 17 Jan 2018 10:52:29 -0700 Subject: [PATCH 0072/1348] Add ember-data error types; Ember.ViewUtils.isSimpleClick. (#22924) --- types/ember-data/index.d.ts | 20 ++++--- types/ember-data/test/error.ts | 106 +++++++++++++++++++++++++++++++++ types/ember-data/tsconfig.json | 3 +- types/ember/index.d.ts | 6 +- types/ember/test/route.ts | 8 +++ types/ember/test/view-utils.ts | 5 ++ types/ember/tsconfig.json | 3 +- 7 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 types/ember-data/test/error.ts create mode 100644 types/ember/test/view-utils.ts diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 0ec24fae41..a59ab4de97 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -208,7 +208,7 @@ declare module "ember-data" { * subclasses are used to indicate specific error states. The following * subclasses are provided: */ - class AdapterError {} + class AdapterError extends Ember.Object {} /** * A `DS.InvalidError` is used by an adapter to signal the external API * was unable to process a request because the content was not @@ -218,27 +218,29 @@ declare module "ember-data" { * transition to the `invalid` state and the errors will be set to the * `errors` property on the record. */ - class InvalidError {} + class InvalidError extends AdapterError { + constructor(errors: any[]); + } /** * A `DS.TimeoutError` is used by an adapter to signal that a request * to the external API has timed out. I.e. no response was received from * the external API within an allowed time period. */ - class TimeoutError {} + class TimeoutError extends AdapterError {} /** * A `DS.AbortError` is used by an adapter to signal that a request to * the external API was aborted. For example, this can occur if the user * navigates away from the current page after a request to the external API * has been initiated but before a response has been received. */ - class AbortError {} + class AbortError extends AdapterError {} /** * A `DS.UnauthorizedError` equates to a HTTP `401 Unauthorized` response * status. It is used by an adapter to signal that a request to the external * API was rejected because authorization is required and has failed or has not * yet been provided. */ - class UnauthorizedError {} + class UnauthorizedError extends AdapterError {} /** * A `DS.ForbiddenError` equates to a HTTP `403 Forbidden` response status. * It is used by an adapter to signal that a request to the external API was @@ -246,13 +248,13 @@ declare module "ember-data" { * provided and is valid, then the authenticated user does not have the * necessary permissions for the request. */ - class ForbiddenError {} + class ForbiddenError extends AdapterError {} /** * A `DS.NotFoundError` equates to a HTTP `404 Not Found` response status. * It is used by an adapter to signal that a request to the external API * was rejected because the resource could not be found on the API. */ - class NotFoundError {} + class NotFoundError extends AdapterError {} /** * A `DS.ConflictError` equates to a HTTP `409 Conflict` response status. * It is used by an adapter to indicate that the request could not be processed @@ -260,13 +262,13 @@ declare module "ember-data" { * creating a record with a client generated id but that id is already known * to the external API. */ - class ConflictError {} + class ConflictError extends AdapterError {} /** * A `DS.ServerError` equates to a HTTP `500 Internal Server Error` response * status. It is used by the adapter to indicate that a request has failed * because of an error in the external API. */ - class ServerError {} + class ServerError extends AdapterError {} /** * Holds validation errors for a given record, organized by attribute names. */ diff --git a/types/ember-data/test/error.ts b/types/ember-data/test/error.ts new file mode 100644 index 0000000000..b8b65ca967 --- /dev/null +++ b/types/ember-data/test/error.ts @@ -0,0 +1,106 @@ +import Ember from 'ember'; +import DS from 'ember-data'; +import { assertType } from './lib/assert'; + +const { AdapterError } = DS; + +// https://emberjs.com/api/ember-data/2.16/classes/DS.AdapterError +const MaintenanceError = DS.AdapterError.extend({ + message: 'Down for maintenance.', +}); +const maintenanceError = new MaintenanceError(); +assertType(maintenanceError); + +// https://emberjs.com/api/ember-data/2.16/classes/DS.InvalidError +const anInvalidError = new DS.InvalidError([ + { + detail: 'Must be unique', + source: { pointer: '/data/attributes/title' }, + }, + { + detail: 'Must not be blank', + source: { pointer: '/data/attributes/content' }, + }, +]); + +// https://emberjs.com/api/ember-data/2.16/classes/DS.TimeoutError +const { TimeoutError } = DS; +const timedOut = Ember.Route.extend({ + actions: { + error(error: any, transition: any) { + if (error instanceof TimeoutError) { + // alert the user + alert('Are you still connected to the internet?'); + return; + } + + // ...other error handling logic + }, + }, +}); + +// This is technically private, but publicly exposed for APIs to use. We just +// check that it is a proper subclass of `AdapterError`. +// https://emberjs.com/api/ember-data/2.16/classes/DS.AbortError +// https://github.com/emberjs/data/blob/v2.16.0/addon/-private/adapters/errors.js#L206-L216 +const { AbortError } = DS; +assertType(AbortError); + +// https://emberjs.com/api/ember-data/2.16/classes/DS.UnauthorizedError +const { UnauthorizedError } = DS; +assertType(UnauthorizedError); +const unauthorized = Ember.Route.extend({ + actions: { + error(error: any, transition: any) { + if (error instanceof UnauthorizedError) { + // go to the sign in route + this.transitionTo('login'); + return; + } + + // ...other error handling logic + }, + }, +}); + +// This is technically private, but publicly exposed for APIs to use. We just +// check that it is a proper subclass of `AdapterError`. +// https://emberjs.com/api/ember-data/2.16/classes/DS.ForbiddenError +// https://github.com/emberjs/data/blob/v2.16.0/addon/-private/adapters/errors.js#L253-L263 +const { ForbiddenError } = DS; +assertType(ForbiddenError); + +// https://emberjs.com/api/ember-data/2.16/classes/DS.NotFoundError +const { NotFoundError } = DS; +assertType(NotFoundError); +const notFound = Ember.Route.extend({ + model(params: { post_id: string }): any { + return this.get('store').findRecord('post', params.post_id); + }, + + actions: { + error(error: any, transition: any): any { + if (error instanceof NotFoundError) { + // redirect to a list of all posts instead + this.transitionTo('posts'); + } else { + // otherwise let the error bubble + return true; + } + }, + }, +}); + +// This is technically private, but publicly exposed for APIs to use. We just +// check that it is a proper subclass of `AdapterError`. +// https://emberjs.com/api/ember-data/2.16/classes/DS.ConflictError +// https://github.com/emberjs/data/blob/v2.16.0/addon/-private/adapters/errors.js#L303-L313 +const { ConflictError } = DS; +assertType(ConflictError); + +// This is technically private, but publicly exposed for APIs to use. We just +// check that it is a proper subclass of `AdapterError`. +// https://emberjs.com/api/ember-data/2.16/classes/DS.ServerError +// https://github.com/emberjs/data/blob/v2.16.0/addon/-private/adapters/errors.js#L315-L323 +const { ServerError } = DS; +assertType(ServerError); diff --git a/types/ember-data/tsconfig.json b/types/ember-data/tsconfig.json index 5f7c297ec7..15f77391aa 100644 --- a/types/ember-data/tsconfig.json +++ b/types/ember-data/tsconfig.json @@ -28,6 +28,7 @@ "test/has-many.ts", "test/belongs-to.ts", "test/record-reference.ts", - "test/injections.ts" + "test/injections.ts", + "test/error.ts" ] } diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 238e895e34..91f78a402b 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1846,7 +1846,7 @@ declare module 'ember' { be useful, for instance, for retrieving async code from the server that is required to enter a route. */ - beforeModel(transition: Transition): Rsvp.Promise; + beforeModel(transition: Transition): any; /** * Returns the controller for a particular route or name. @@ -2207,7 +2207,9 @@ declare module 'ember' { actionContext: any; } const ViewTargetActionSupport: Mixin; - const ViewUtils: {}; // TODO: define interface + const ViewUtils: { + isSimpleClick(event: Event): boolean; + }; // FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js const RSVP: typeof Rsvp; diff --git a/types/ember/test/route.ts b/types/ember/test/route.ts index 22193bd88d..fad5bbc634 100755 --- a/types/ember/test/route.ts +++ b/types/ember/test/route.ts @@ -85,3 +85,11 @@ Route.extend({ this.controllerFor('application').set('model', model); }, }); + +class RouteUsingClass extends Route.extend({ + randomProperty: 'the .extend + extends bit type-checks properly', +}) { + beforeModel(this: RouteUsingClass) { + return 'beforeModel can return anything, not just promises'; + } +} diff --git a/types/ember/test/view-utils.ts b/types/ember/test/view-utils.ts new file mode 100644 index 0000000000..a3613064eb --- /dev/null +++ b/types/ember/test/view-utils.ts @@ -0,0 +1,5 @@ +import Ember from 'ember'; +import { assertType } from './lib/assert'; + +const { ViewUtils: { isSimpleClick } } = Ember; +assertType(isSimpleClick(new Event('wat'))); diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index c0aab2e780..98d2623024 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -44,6 +44,7 @@ "test/run.ts", "test/test.ts", "test/controller.ts", - "test/route.ts" + "test/route.ts", + "test/view-utils.ts" ] } From 6fe41fe2e72992ce874addcfa3dde803bca5910d Mon Sep 17 00:00:00 2001 From: Alec Winograd Date: Wed, 17 Jan 2018 18:52:58 +0100 Subject: [PATCH 0073/1348] [react-navigation] refine type for createNavigationContainer (#22922) --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 3418004b60..bcef405be9 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -693,7 +693,7 @@ export function createNavigator( */ export function createNavigationContainer( Component: NavigationNavigator -): React.Component; +): NavigationContainer; /** * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS */ From a025cb184bfdf01f8c697306c3f1848d59efa14d Mon Sep 17 00:00:00 2001 From: smhxx Date: Wed, 17 Jan 2018 11:55:29 -0600 Subject: [PATCH 0074/1348] atom: fix type of Task.send()'s message parameter (#22907) * atom: fix type of Task.send()'s message parameter * atom: disallow undefined message argument to Task.send() * atom: remove unnecessary linter comment * atom: allow nested arrays to be passed to Task.send() --- types/atom/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 53fa8d5749..a261661144 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -4810,7 +4810,8 @@ export class Task { * Throws an error if this task has already been terminated or if sending a * message to the child process fails. */ - send(message: string): void; + // tslint:disable-next-line:no-any + send(message: string | number | boolean | object | null | any[]): void; /** Call a function when an event is emitted by the child process. */ // tslint:disable-next-line:no-any From be285f96bfb0c24733af51c50d85b352e1816aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Niclas=20Str=C3=BCwer?= Date: Wed, 17 Jan 2018 18:55:43 +0100 Subject: [PATCH 0075/1348] step() option in animate function is optional. examples in cytoscape js docu (http://js.cytoscape.org/#cy.animate) use animate without step parameter. (#22916) --- types/cytoscape/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index bf3439324b..ad0c8de371 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Fabian Schmidt and Fred Eisele // Shenghan Gao // Yuri Pereira Constante +// Jan-Niclas Struewer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Translation from Objects in help to Typescript interface. @@ -900,7 +901,7 @@ declare namespace cytoscape { /** complete - A function to call when the animation is done. */ complete?(): void; /** step - A function to call each time the animation steps. */ - step(): void; + step?(): void; } interface AnimationOptions extends AnimateOptionsCommon { /** queue - A transition-timing-function easing style string that shapes the animation progress curve. */ From bb6a407de4c7c05e5e85270e751962cdccda7eec Mon Sep 17 00:00:00 2001 From: SagarFargade <35451543+SagarFargade@users.noreply.github.com> Date: Wed, 17 Jan 2018 23:25:58 +0530 Subject: [PATCH 0076/1348] Add Alignment and Hide Default Launcher Options for intercom-web (#22920) * Add Alignrment and Hide Default Launcher Options Added Alignment and Hide default launcher options for intercom settings. * Fixed build errors Added Semicolon instaed of comma. --- types/intercom-web/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/intercom-web/index.d.ts b/types/intercom-web/index.d.ts index 1eb038bd07..a0b4e71015 100755 --- a/types/intercom-web/index.d.ts +++ b/types/intercom-web/index.d.ts @@ -8,9 +8,11 @@ declare namespace Intercom_ { interface IntercomSettings { + alignment?: string; app_id?: string; email?: string; created_at?: number; + hide_default_launcher?: boolean; name?: string; user_id?: string; user_hash?: string; From 2c7e6c4f0916cd5b980152a0be918ee5eb244bbc Mon Sep 17 00:00:00 2001 From: smhxx Date: Wed, 17 Jan 2018 11:57:04 -0600 Subject: [PATCH 0077/1348] atom: fix return type of LinterProvider.lint() (#22904) --- types/atom/linter/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/atom/linter/index.d.ts b/types/atom/linter/index.d.ts index bf085d9859..79fc397ab8 100644 --- a/types/atom/linter/index.d.ts +++ b/types/atom/linter/index.d.ts @@ -78,5 +78,5 @@ export interface LinterProvider { scope: "file"|"project"; lintsOnChange: boolean; grammarScopes: string[]; - lint(textEditor: TextEditor): Message[]|void|Promise; + lint(textEditor: TextEditor): Message[]|null|Promise; } From 6faad9d19989039cc3ab4e053d97028780cc7e9b Mon Sep 17 00:00:00 2001 From: Niklas Wulf Date: Wed, 17 Jan 2018 18:57:36 +0100 Subject: [PATCH 0078/1348] [boom] isBoom is a type-guard (#22918) Instead of just returning boolean, the `isBoom` function can and should be a type-guard, which enables the obvious benefits. --- types/boom/boom-tests.ts | 6 ++++++ types/boom/index.d.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index f989128b4e..4d133b2545 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -144,6 +144,12 @@ const isBoomError = new Boom.Boom('test') Boom.isBoom(isBoomError); +const maybeBoom = new Boom.Boom('test'); +if(Boom.isBoom(maybeBoom)) { + // isBoom is a type guard that allows accessing these properties: + maybeBoom.output.headers; +} + // constructor const constructorError: Boom.Boom = new Boom.Boom('test'); diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index 89ca580561..ed48f181cf 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -86,7 +86,7 @@ declare namespace Boom { * Identifies whether an error is a Boom object. Same as calling instanceof Boom. * @param error the error object to identify. */ - export function isBoom(error: Error): boolean + export function isBoom(error: Error): error is Boom // 4xx /** From a27b24d877838cd785df91bc52b3a5a1c3f40a19 Mon Sep 17 00:00:00 2001 From: smhxx Date: Wed, 17 Jan 2018 11:58:00 -0600 Subject: [PATCH 0079/1348] resolve: fix signature of callback type (#22911) --- types/resolve/index.d.ts | 12 +++++++++--- types/resolve/resolve-tests.ts | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/types/resolve/index.d.ts b/types/resolve/index.d.ts index fd3bf8272b..11a46b97a3 100644 --- a/types/resolve/index.d.ts +++ b/types/resolve/index.d.ts @@ -6,13 +6,19 @@ /// +interface PackageMeta { + name: string; + version: string; + [key: string]: any; +} + /** * Callback invoked when resolving asynchronously * * @param error * @param resolved Absolute path to resolved identifier */ -type resolveCallback = (err: Error, resolved?: string) => void; +type resolveCallback = (err: Error | null, resolved?: string, pkg?: PackageMeta) => void; /** * Callback invoked when checking if a file exists @@ -20,7 +26,7 @@ type resolveCallback = (err: Error, resolved?: string) => void; * @param error * @param isFile If the given file exists */ -type isFileCallback = (err: Error, isFile?: boolean) => void; +type isFileCallback = (err: Error | null, isFile?: boolean) => void; /** * Callback invoked when reading a file @@ -28,7 +34,7 @@ type isFileCallback = (err: Error, isFile?: boolean) => void; * @param error * @param isFile If the given file exists */ -type readFileCallback = (err: Error, file?: Buffer) => void; +type readFileCallback = (err: Error | null, file?: Buffer) => void; /** * Asynchronously resolve the module path string id into cb(err, res [, pkg]), where pkg (if defined) is the data from package.json diff --git a/types/resolve/resolve-tests.ts b/types/resolve/resolve-tests.ts index c4b89feb46..28dae63c82 100644 --- a/types/resolve/resolve-tests.ts +++ b/types/resolve/resolve-tests.ts @@ -2,12 +2,13 @@ import * as fs from 'fs'; import * as resolve from 'resolve'; function test_basic_async() { - resolve('typescript', function(error, resolved) { + resolve('typescript', function(error, resolved, pkg) { if (error) { console.error(error.message); return; } console.log(resolved); + console.log(pkg.version); }); } @@ -41,12 +42,13 @@ function test_options_async() { } }); } - }, function(error, resolved) { + }, function(error, resolved, pkg) { if (error) { console.error(error.message); return; } console.log(resolved); + console.log(pkg.version); }); } From c4e95181211121b238d73cff6b585566b0d0fab0 Mon Sep 17 00:00:00 2001 From: Derek Wickern Date: Wed, 17 Jan 2018 09:59:14 -0800 Subject: [PATCH 0080/1348] ember: allow get/set with dynamic key (#22905) --- types/ember/index.d.ts | 6 ++++++ types/ember/test/observable.ts | 18 ++++++++++++++++++ types/ember/tslint.json | 7 +++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 91f78a402b..61bdcb9828 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3057,10 +3057,12 @@ declare module 'ember' { obj: ComputedProperties, list: K[] ): Pick; + function getProperties(obj: T, list: K[]): Pick; // for dynamic K function getProperties( obj: ComputedProperties, ...list: K[] ): Pick; + function getProperties(obj: T, ...list: K[]): Pick; // for dynamic K /** * A value is blank if it is empty or a whitespace string. */ @@ -3145,6 +3147,7 @@ declare module 'ember' { * object implements the `unknownProperty` method then that will be invoked. */ function get(obj: ComputedProperties, key: K): T[K]; + function get(obj: T, key: K): T[K]; // for dynamic K /** * Retrieves the value of a property from an Object, or a default value in the * case that the property returns `undefined`. @@ -3154,6 +3157,7 @@ declare module 'ember' { key: K, defaultValue: T[K] ): T[K]; + function getWithDefault(obj: T, key: K, defaultValue: T[K]): T[K]; // for dynamic K /** * Sets the value of a property on an object, respecting computed properties * and notifying observers and other listeners of the change. If the @@ -3165,6 +3169,7 @@ declare module 'ember' { key: K, value: V ): V; + function set(obj: T, key: K, value: V): V; // for dynamic K /** * Error-tolerant form of `Ember.set`. Will not blow up if any part of the * chain is `undefined`, `null`, or destroyed. @@ -3179,6 +3184,7 @@ declare module 'ember' { obj: ComputedProperties, hash: Pick ): Pick; + function setProperties(obj: T, hash: Pick): Pick; // for dynamic K /** * Detects when a specific package of Ember (e.g. 'Ember.Application') * has fully loaded and is available for extension. diff --git a/types/ember/test/observable.ts b/types/ember/test/observable.ts index 680b6decf7..cf871807b2 100755 --- a/types/ember/test/observable.ts +++ b/types/ember/test/observable.ts @@ -86,3 +86,21 @@ function testSetProperties() { assertType<{ name: string, capitalized: string }>(person.setProperties({ name: 'Joe', capitalized: 'JOE' })); assertType<{ name: string, age: number }>(Ember.setProperties(pojo, { name: 'Joe', age: 35 })); } + +function testDynamic() { + const obj: any = {}; + const dynamicKey: string = 'dummy'; // tslint:disable-line:no-inferrable-types + + assertType(Ember.get(obj, 'dummy')); + assertType(Ember.get(obj, dynamicKey)); + assertType(Ember.getWithDefault(obj, 'dummy', 'default')); + assertType(Ember.getWithDefault(obj, dynamicKey, 'default')); + assertType<{ dummy: any }>(Ember.getProperties(obj, 'dummy')); + assertType<{ dummy: any }>(Ember.getProperties(obj, [ 'dummy' ])); + assertType(Ember.getProperties(obj, dynamicKey)); + assertType(Ember.getProperties(obj, [ dynamicKey ])); + assertType(Ember.set(obj, 'dummy', 'value')); + assertType(Ember.set(obj, dynamicKey, 'value')); + assertType<{ dummy: string }>(Ember.setProperties(obj, { dummy: 'value '})); + assertType(Ember.setProperties(obj, { [dynamicKey]: 'value' })); +} diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 35e8f3768a..7069614893 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -23,7 +23,10 @@ "no-void-expression": false, "only-arrow-functions": false, "no-submodule-imports": false, - - "no-unnecessary-class": false + + "no-unnecessary-class": false, + + // false positives + "unified-signatures": false } } From 4dda217e4691c01bbda0931b492a197805e69e84 Mon Sep 17 00:00:00 2001 From: Thomas Sawkins Date: Thu, 18 Jan 2018 04:59:31 +1100 Subject: [PATCH 0081/1348] add missing NavigationAction consts (#22903) --- types/react-navigation/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index bcef405be9..7c70bb660c 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -613,6 +613,13 @@ export const TabBarBottom: React.ComponentClass; * NavigationActions */ export namespace NavigationActions { + const BACK: 'Navigation/BACK'; + const INIT: 'Navigation/INIT'; + const NAVIGATE: 'Navigation/NAVIGATE'; + const RESET: 'Navigation/RESET'; + const SET_PARAMS: 'Navigation/SET_PARAMS'; + const URI: 'Navigation/URI'; + function init(options?: NavigationInitActionPayload): NavigationInitAction; function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction; function reset(options: NavigationResetActionPayload): NavigationResetAction; From 9658b51e04cfd39a602f31d9a46d759ec15bfd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Fr=C3=BCchtenicht?= Date: Wed, 17 Jan 2018 18:59:47 +0100 Subject: [PATCH 0082/1348] [@types/rpio] Allow null as callback value for poll() (#22891) * [@types/rpio] Fix poll parameter to accept null As written in the `poll` function documentation the `cb` parameter should accept null as a value. * Update rpio-tests.ts * Add myself as contributor --- types/rpio/index.d.ts | 3 ++- types/rpio/rpio-tests.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/rpio/index.d.ts b/types/rpio/index.d.ts index c04202baf8..c5a33eb831 100644 --- a/types/rpio/index.d.ts +++ b/types/rpio/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-rpio // Project: https://github.com/jperkin/node-rpio // Definitions by: Dominik Palo +// Hannes Früchtenicht // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -129,7 +130,7 @@ interface Rpio { * @param cb * @param direction */ - poll(pin: number, cb: RPIO.CallbackFunction, direction?: number): void; + poll(pin: number, cb: RPIO.CallbackFunction | null, direction?: number): void; /** * Reset pin to INPUT and clear any pullup/pulldown resistors and poll events. diff --git a/types/rpio/rpio-tests.ts b/types/rpio/rpio-tests.ts index 9faa692e76..149851bbd0 100644 --- a/types/rpio/rpio-tests.ts +++ b/types/rpio/rpio-tests.ts @@ -61,6 +61,8 @@ function regular_button(pin: number) rpio.poll(11, regular_button); rpio.poll(12, nuke_button, rpio.POLL_HIGH); +rpio.poll(12, null, rpio.POLL_HIGH); + rpio.close(11); rpio.i2cBegin(); From dc50262033de1e66e28be30e08262dce7bc24c56 Mon Sep 17 00:00:00 2001 From: Jonathan Alvarez-Gutierrez Date: Wed, 17 Jan 2018 13:00:09 -0500 Subject: [PATCH 0083/1348] Update Polyhedron Geometries in "three" (#22889) * Add PolyhedronBufferGeometry and subclasses Added PolyhedronBufferGeometry and the four BufferGeometries subclassing it (TetrahedronBufferGeometry, OctahedronBufferGeometry, DodecahedronBufferGeometry, and IcosahedronBufferGeometry). * Fix constructors for PolyhedronGeometry subclasses The PolyhedronGeometry subclasses all have optional parameters for their constructor, but not all the type definitions were in line on this. --- types/three/three-core.d.ts | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index a2c4b05544..c3401a7737 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6621,9 +6621,13 @@ export class ConeBufferGeometry extends BufferGeometry { export class ConeGeometry extends CylinderGeometry { constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); } + +export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} export class DodecahedronGeometry extends Geometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); parameters: { radius: number; @@ -6648,8 +6652,12 @@ export class ExtrudeGeometry extends Geometry { addShape(shape: Shape, options?: any): void; } +export class IcosahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} + export class IcosahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); } export class LatheBufferGeometry extends BufferGeometry { @@ -6673,9 +6681,13 @@ export class LatheGeometry extends Geometry { phiLength: number; }; } + +export class OctahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} export class OctahedronGeometry extends PolyhedronGeometry { - constructor(radius: number, detail: number); + constructor(radius?: number, detail?: number); } export class ParametricGeometry extends Geometry { @@ -6709,6 +6721,17 @@ export class PlaneGeometry extends Geometry { heightSegments: number; }; } + +export class PolyhedronBufferGeometry extends BufferGeometry { + constructor(vertices: number[], indices: number[], radius: number, detail: number); + + parameters: { + vertices: number[]; + indices: number[]; + radius: number; + detail: number; + } +} export class PolyhedronGeometry extends Geometry { constructor(vertices: number[], indices: number[], radius?: number, detail?: number); @@ -6797,6 +6820,10 @@ export class SphereGeometry extends Geometry { thetaLength: number; }; } + +export class TetrahedronBufferGeometry extends PolyhedronBufferGeometry { + constructor(radius?: number, detail?: number); +} export class TetrahedronGeometry extends PolyhedronGeometry { constructor(radius?: number, detail?: number); From 008daf5924ad65b8180f6d89b453cc921d25c6ff Mon Sep 17 00:00:00 2001 From: JB Nizet Date: Wed, 17 Jan 2018 19:00:59 +0100 Subject: [PATCH 0084/1348] luxon: fix two typos, and make constants readonly (#22877) the constants should be readonly, since the original source code has getters, but no setters for these constants (see https://github.com/moment/luxon/blob/master/src/datetime.js#L1715-L1850) --- types/luxon/index.d.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index c8ce226220..811768915b 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -61,26 +61,26 @@ declare module 'luxon' { }; class DateTime { - static DATETIME_FULL: DateTimeFormatOptions; - static DATETIME_FULL_WITH_SECONDS: DateTimeFormatOptions; - static DATEIME_HUGE: DateTimeFormatOptions; - static DATEIME_HUGE_WITH_SECONDS: DateTimeFormatOptions; - static DATETIME_MED: DateTimeFormatOptions; - static DATETIME_MED_WITH_SECONDS: DateTimeFormatOptions; - static DATETIME_SHORT: DateTimeFormatOptions; - static DATETIME_SHORT_WITH_SECONDS: DateTimeFormatOptions; - static DATE_FULL: DateTimeFormatOptions; - static DATE_HUGE: DateTimeFormatOptions; - static DATE_MED: DateTimeFormatOptions; - static DATE_SHORT: DateTimeFormatOptions; - static TIME_24_SIMPLE: DateTimeFormatOptions; - static TIME_24_WITH_LONG_OFFSET: DateTimeFormatOptions; - static TIME_24_WITH_SECONDS: DateTimeFormatOptions; - static TIME_24_WITH_SHORT_OFFSET: DateTimeFormatOptions; - static TIME_SIMPLE: DateTimeFormatOptions; - static TIME_WITH_LONG_OFFSET: DateTimeFormatOptions; - static TIME_WITH_SECONDS: DateTimeFormatOptions; - static TIME_WITH_SHORT_OFFSET: DateTimeFormatOptions; + static readonly DATETIME_FULL: DateTimeFormatOptions; + static readonly DATETIME_FULL_WITH_SECONDS: DateTimeFormatOptions; + static readonly DATETIME_HUGE: DateTimeFormatOptions; + static readonly DATETIME_HUGE_WITH_SECONDS: DateTimeFormatOptions; + static readonly DATETIME_MED: DateTimeFormatOptions; + static readonly DATETIME_MED_WITH_SECONDS: DateTimeFormatOptions; + static readonly DATETIME_SHORT: DateTimeFormatOptions; + static readonly DATETIME_SHORT_WITH_SECONDS: DateTimeFormatOptions; + static readonly DATE_FULL: DateTimeFormatOptions; + static readonly DATE_HUGE: DateTimeFormatOptions; + static readonly DATE_MED: DateTimeFormatOptions; + static readonly DATE_SHORT: DateTimeFormatOptions; + static readonly TIME_24_SIMPLE: DateTimeFormatOptions; + static readonly TIME_24_WITH_LONG_OFFSET: DateTimeFormatOptions; + static readonly TIME_24_WITH_SECONDS: DateTimeFormatOptions; + static readonly TIME_24_WITH_SHORT_OFFSET: DateTimeFormatOptions; + static readonly TIME_SIMPLE: DateTimeFormatOptions; + static readonly TIME_WITH_LONG_OFFSET: DateTimeFormatOptions; + static readonly TIME_WITH_SECONDS: DateTimeFormatOptions; + static readonly TIME_WITH_SHORT_OFFSET: DateTimeFormatOptions; static fromHTTP(text: string, options?: DateTimeOptions): DateTime; static fromISO(text: string, options?: DateTimeOptions): DateTime; static fromJSDate( From cf941e095cbc7417320f88855481b25ce89a03a5 Mon Sep 17 00:00:00 2001 From: JB Nizet Date: Wed, 17 Jan 2018 19:01:33 +0100 Subject: [PATCH 0085/1348] luxon: add changes introduced from versions 0.2.10 to 0.3.0 (#22880) --- types/luxon/index.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 811768915b..327fe15ade 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -10,6 +10,10 @@ declare module 'luxon' { type DateTimeFormatOptions = Intl.DateTimeFormatOptions; type ZoneOptions = { + keepLocalTime?: boolean; + /** + * @deprecated since 0.2.12. Use keepLocalTime instead + */ keepCalendarTime?: boolean; }; @@ -94,11 +98,27 @@ declare module 'luxon' { options?: DateTimeOptions ): DateTime; static fromSQL(text: string, options?: DateTimeOptions): DateTime; + static fromFormat( + text: string, + format: string, + opts?: DateTimeOptions + ): DateTime; + static fromFormatExplain( + text: string, + format: string, + opts?: DateTimeOptions + ): object; + /** + * @deprecated since 0.3.0. Use fromFormat instead + */ static fromString( text: string, format: string, options?: DateTimeOptions ): DateTime; + /** + * @deprecated 0.3.0. Use fromFormatExplain instead + */ static fromStringExplain( text: string, format: string, From a04b55e68045dab7c60e58530690237474c94d65 Mon Sep 17 00:00:00 2001 From: Thomas Sawkins Date: Thu, 18 Jan 2018 05:02:12 +1100 Subject: [PATCH 0086/1348] update index.d.ts & update tests (#22795) --- types/react-native-push-notification/index.d.ts | 4 +++- .../react-native-push-notification-tests.ts | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/react-native-push-notification/index.d.ts b/types/react-native-push-notification/index.d.ts index 1f8c89b512..1c1577d7c1 100644 --- a/types/react-native-push-notification/index.d.ts +++ b/types/react-native-push-notification/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-native-push-notification 3.0 // Project: https://github.com/zo0r/react-native-push-notification#readme // Definitions by: Paito Anderson +// Tom Sawkins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -18,6 +19,7 @@ export interface PushNotification { badge: number; alert: object; sound: string; + finish: (fetchResult: string) => void; } export class PushNotificationOptions { @@ -77,7 +79,7 @@ export interface PushNotification { cancelAllLocalNotifications(): void; setApplicationIconBadgeNumber(badgeCount: number): void; getApplicationIconBadgeNumber(callback: (badgeCount: number) => void): void; - popInitialNotification(): Promise; + popInitialNotification(callback: (notification: PushNotification | null) => void): void; abandonPermissions(): void; checkPermissions(callback: (permissions: PushNotificationPermissions) => void): void; registerNotificationActions(actions: string[]): void; diff --git a/types/react-native-push-notification/react-native-push-notification-tests.ts b/types/react-native-push-notification/react-native-push-notification-tests.ts index f23ab07ef1..c28779b855 100644 --- a/types/react-native-push-notification/react-native-push-notification-tests.ts +++ b/types/react-native-push-notification/react-native-push-notification-tests.ts @@ -1,7 +1,9 @@ import PushNotification from 'react-native-push-notification'; PushNotification.configure({ - onNotification: (notification) => {}, + onNotification: (notification) => { + notification.finish("UIBackgroundFetchResultNoData"); + }, onRegister: (token) => {}, senderID: 'XXX', popInitialNotification: false, @@ -18,7 +20,7 @@ PushNotification.cancelLocalNotifications = (details) => {}; PushNotification.cancelAllLocalNotifications(); PushNotification.setApplicationIconBadgeNumber(1); PushNotification.getApplicationIconBadgeNumber((badgeCount) => {}); -PushNotification.popInitialNotification(); +PushNotification.popInitialNotification((notification) => {}); PushNotification.checkPermissions((checkPermissions) => {}); PushNotification.abandonPermissions(); PushNotification.registerNotificationActions(['Accept', 'Reject', 'Yes', 'No']); From 08812a10047bef428a2609f2ef7cd7563cb153e8 Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Wed, 17 Jan 2018 19:02:42 +0100 Subject: [PATCH 0087/1348] add html attributes to redux-first-router-link (#22870) --- types/redux-first-router-link/index.d.ts | 21 +++---------------- .../redux-first-router-link-tests.tsx | 15 +++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/types/redux-first-router-link/index.d.ts b/types/redux-first-router-link/index.d.ts index c74bdd530b..1136751129 100644 --- a/types/redux-first-router-link/index.d.ts +++ b/types/redux-first-router-link/index.d.ts @@ -9,8 +9,6 @@ import { Location } from 'redux-first-router'; export type To = string | string[] | object; -export type OnClick = false | ((e: React.MouseEvent) => void); - export interface Match

{ params: P; isExact: boolean; @@ -18,14 +16,12 @@ export interface Match

{ url: string; } -export interface LinkProps { +// Unfortunately we can't pass `HTMLAnchorElement` since the `tagName` attribute allows you to use other tags than anchor. +export interface LinkProps extends React.HTMLAttributes { to: To; redirect?: boolean; replace?: boolean; tagName?: string; - children?: React.ReactNode; - onPress?: OnClick; - onClick?: OnClick; down?: boolean; shouldDispatch?: boolean; target?: string; @@ -33,18 +29,7 @@ export interface LinkProps { export default class Link extends React.Component {} -export interface NavLinkProps { - to: To; - redirect?: boolean; - replace?: boolean; - children?: React.ReactNode; - onPress?: OnClick; - onClick?: OnClick; - down?: boolean; - shouldDispatch?: boolean; - target?: string; - className?: string; - style?: React.CSSProperties; +export interface NavLinkProps extends LinkProps { activeClassName?: string; activeStyle?: React.CSSProperties; ariaCurrent?: string; diff --git a/types/redux-first-router-link/redux-first-router-link-tests.tsx b/types/redux-first-router-link/redux-first-router-link-tests.tsx index 01889e5fe1..86f36c14e3 100644 --- a/types/redux-first-router-link/redux-first-router-link-tests.tsx +++ b/types/redux-first-router-link/redux-first-router-link-tests.tsx @@ -17,6 +17,16 @@ export default () => { { /* as an action object (RECOMMENDED APPROACH SO YOU CAN CHANGE ALL URLs FROM YOUR ROUTESMAP): */ } FP + Home + { isActive={(match, location) => (location.payload as Payload).category === 'redux-first-router'} > Redux First Router + + Nav link with class ); }; From 80046ef1ee7217967026fe61041d84d3ee2ac4ae Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Wed, 17 Jan 2018 19:03:42 +0100 Subject: [PATCH 0088/1348] @types/redux-first-router: Improve StateGetter and RouteThunk by including State (#22611) * Improve State typing across entire definition * Fix suggested changes on thunk function * Fix dispatch definitons * Revert storeEnhcancer change --- types/redux-first-router/index.d.ts | 106 +++++++++--------- .../redux-first-router-tests.ts | 54 +++++++-- 2 files changed, 99 insertions(+), 61 deletions(-) diff --git a/types/redux-first-router/index.d.ts b/types/redux-first-router/index.d.ts index 22dce972c4..750f8438b6 100644 --- a/types/redux-first-router/index.d.ts +++ b/types/redux-first-router/index.d.ts @@ -18,28 +18,28 @@ import { History } from 'history'; export type Nullable = T | null | undefined; -export type StateGetter = () => object; +export type StateGetter = () => TState; export type RouteString = string; -export type RouteThunk = ( +export type RouteThunk = ( dispatch: Dispatch, - getState: StateGetter + getState: StateGetter, ) => any | Promise; -export type RouteObject = TKeys & { +export type RouteObject = TKeys & { capitalizedWords?: boolean; navKey?: string; path: string; - thunk?: RouteThunk; + thunk?: RouteThunk; fromPath?(path: string, key?: string): string; toPath?(param: string, key?: string): string; }; -export type Route = RouteString | RouteObject; +export type Route = RouteString | RouteObject; -export interface RoutesMap { - [key: string]: Route; +export interface RoutesMap { + [key: string]: Route; } export interface ReceivedAction { @@ -77,7 +77,7 @@ export interface Location { search?: string; } -export interface LocationState { +export interface LocationState { pathname: string; type: string; payload: Payload; @@ -86,7 +86,7 @@ export interface LocationState { prev: Location; kind: Nullable; history: Nullable; - routesMap: RoutesMap; + routesMap: RoutesMap; hasSSR?: boolean; } @@ -138,70 +138,70 @@ export type Listener = ( export type ScrollBehavior = object; -export interface Router { +export interface Router { getStateForActionOriginal( action: object, - state: Nullable - ): Nullable; + state: Nullable + ): Nullable; getStateForAction( action: object, - state: Nullable - ): Nullable; + state: Nullable + ): Nullable; getPathAndParamsForState( - state: object + state: TState ): { path: Nullable; params: Nullable }; getActionForPathAndParams(path: string): Nullable; } -export interface Navigator { - router: Router; +export interface Navigator { + router: Router; } -export interface Navigators { - [key: string]: Navigator; +export interface Navigators { + [key: string]: Navigator; } -export type SelectLocationState = (state: object) => LocationState; -export type SelectTitleState = (state: object) => string; +export type SelectLocationState = (state: TState) => LocationState; +export type SelectTitleState = (state: TState) => string; export interface QuerySerializer { stringify(params: Params): string; parse(queryString: string): object; } -export interface NavigatorsConfig { - navigators: Navigators; - patchNavigators(navigators: Navigators): void; +export interface NavigatorsConfig { + navigators: Navigators; + patchNavigators(navigators: Navigators): void; actionToNavigation( - navigators: Navigators, + navigators: Navigators, action: object, // TODO check this navigationAction: Nullable, - route: Nullable + route: Nullable> ): object; navigationToAction( - navigators: Navigators, - store: Store, - routesMap: RoutesMap, + navigators: Navigators, + store: Store, + routesMap: RoutesMap, action: object ): { - action: object; - navigationAction: Nullable; - }; + action: object; + navigationAction: Nullable; + }; } -export interface Options { - title?: string | SelectTitleState; - location?: string | SelectLocationState; +export interface Options { + title?: string | SelectTitleState; + location?: string | SelectLocationState; notFoundPath?: string; scrollTop?: boolean; - onBeforeChange?(dispatch: Dispatch, getState: StateGetter): void; - onAfterChange?(dispatch: Dispatch, getState: StateGetter): void; - onBackNext?(dispatch: Dispatch, getState: StateGetter): void; + onBeforeChange?(dispatch: Dispatch, getState: StateGetter): void; + onAfterChange?(dispatch: Dispatch, getState: StateGetter): void; + onBackNext?(dispatch: Dispatch, getState: StateGetter): void; restoreScroll?(history: History): ScrollBehavior; initialDispatch?: boolean; querySerializer?: QuerySerializer; - navigators?: NavigatorsConfig; + navigators?: NavigatorsConfig; } export type Params = object; @@ -211,9 +211,9 @@ export type ScrollUpdater = (performedByUser: boolean) => void; export const NOT_FOUND: '@@redux-first-router/NOT_FOUND'; -export function actionToPath( +export function actionToPath( action: ReceivedAction, - routesMap: RoutesMap, + routesMap: RoutesMap, querySerializer?: QuerySerializer ): string; @@ -225,17 +225,17 @@ export function canGoBack(): boolean; export function canGoForward(): boolean; -export function connectRoutes( +export function connectRoutes( history: History, - routesMap: RoutesMap, - options?: Options + routesMap: RoutesMap, + options?: Options ): { - reducer: Reducer; - middleware: Middleware; - thunk(store: Store): Promise>; - enhancer: GenericStoreEnhancer; - initialDispatch?(): void; -}; + reducer: Reducer>; + middleware: Middleware; + thunk(store: Store): Promise>>; + enhancer: GenericStoreEnhancer; + initialDispatch?(): void; + }; export function go(n: number): void; @@ -247,9 +247,9 @@ export function next(): void; export function nextPath(): string | void; -export function pathToAction( +export function pathToAction( pathname: string, - routesMap: RoutesMap + routesMap: RoutesMap ): ReceivedAction; export function prevPath(): string | void; diff --git a/types/redux-first-router/redux-first-router-tests.ts b/types/redux-first-router/redux-first-router-tests.ts index 3c9e69a82e..3168db6ed8 100644 --- a/types/redux-first-router/redux-first-router-tests.ts +++ b/types/redux-first-router/redux-first-router-tests.ts @@ -18,21 +18,36 @@ import { compose, Action, GenericStoreEnhancer, - StoreEnhancerStoreCreator + StoreEnhancerStoreCreator, + combineReducers } from 'redux'; import { History } from 'history'; declare var console: any; declare var history: History; -type State = LocationState; +interface Keys { + role: string; +} +interface State { + location: LocationState; + stale: boolean; +} type StoreCreator = StoreEnhancerStoreCreator; -const routesMap: RoutesMap<{ role: string }> = { +const routesMap: RoutesMap = { HOME: '/', ADMIN: { path: '/admin', role: 'admin' + }, + STATUS: { + path: '/status', + role: 'user', + thunk: (dispatch, getState) => { + dispatch; // $ExpectType Dispatch + getState; // $ExpectType StateGetter + } } }; @@ -40,10 +55,23 @@ const { reducer, middleware, enhancer, - initialDispatch + initialDispatch, + thunk, } = connectRoutes(history, routesMap, { - initialDispatch: false -}); + initialDispatch: false, + onBeforeChange: (dispatch, getState) => { + dispatch; // $ExpectType Dispatch + getState; // $ExpectType StateGetter + }, + location: state => { + const locationState = state.location; // $ExpectType LocationState + return locationState; + }, + title: state => { + const title = state.location.pathname; // $ExpectType string + return title; + } + }); const dumbMiddleware: Middleware = store => next => action => next(action); @@ -54,7 +82,15 @@ const storeEnhancer = compose( composedMiddleware ); -const store = createStore(reducer, storeEnhancer); +const combined = combineReducers({ location: reducer }); + +const store = createStore(combined, storeEnhancer); + +// Test that `thunk()` has correct state types now that `store` is defined +thunk(store) + .then((t) => { + t = t!; // $ExpectType RouteThunk + }); const receivedAction: ReceivedAction = { type: 'HOME', @@ -73,5 +109,7 @@ const action: ReduxFirstRouterAction = { }; redirect(action); // $ExpectType Action -// $ExpectType Store +// $ExpectType Store store; + +store.getState().location.routesMap; // $ExpectType RoutesMap From dfcd4cdeb091ee8bff49c8c82da22c0f0f462f0c Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 Jan 2018 19:04:24 +0100 Subject: [PATCH 0089/1348] feat: remove `rollup` types (#22876) --- notNeededPackages.json | 6 + .../package.json | 2 +- types/rollup/index.d.ts | 220 ------------------ types/rollup/rollup-tests.ts | 174 -------------- types/rollup/tsconfig.json | 24 -- types/rollup/tslint.json | 6 - 6 files changed, 7 insertions(+), 425 deletions(-) rename types/{rollup => rollup-plugin-json}/package.json (63%) delete mode 100644 types/rollup/index.d.ts delete mode 100644 types/rollup/rollup-tests.ts delete mode 100644 types/rollup/tsconfig.json delete mode 100644 types/rollup/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index a698b68ff3..0da7de39e9 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1218,6 +1218,12 @@ "sourceRepoURL": "https://github.com/EnoF/rest-io", "asOfVersion": "4.1.0" }, + { + "libraryName": "rollup", + "typingsPackageName": "rollup", + "sourceRepoURL": "https://github.com/rollup/rollup", + "asOfVersion": "0.54.0" + }, { "libraryName": "route-recognizer", "typingsPackageName": "route-recognizer", diff --git a/types/rollup/package.json b/types/rollup-plugin-json/package.json similarity index 63% rename from types/rollup/package.json rename to types/rollup-plugin-json/package.json index 100334a89f..60161a270c 100644 --- a/types/rollup/package.json +++ b/types/rollup-plugin-json/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "source-map": "^0.6.1" + "rollup": "^0.54.0" } } diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts deleted file mode 100644 index fcd5f799c3..0000000000 --- a/types/rollup/index.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -// Type definitions for rollup 0.51 -// Project: https://github.com/rollup/rollup -// Definitions by: Philipp A. , Christian Svensson -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { RawSourceMap } from 'source-map' -import * as acorn from 'acorn' - -export type Format = 'amd' | 'cjs' | 'es' | 'iife' | 'umd' -export const VERSION: string - -export interface SourceMap extends RawSourceMap { - toString(): string - toUrl(): string -} - -// https://github.com/rollup/rollup/wiki/JavaScript-API -export interface Warning { - code: string - message: string - loc?: { file: string, line: number, column: number } - frame?: string -} - -export interface BundleOptions { - /** The format of the generated bundle. */ - format: Format - /** What export mode to use. Defaults to auto, which guesses your intentions based on what the `entry` module exports. */ - exports?: 'auto' | 'default' | 'named' | 'none' - /** An ID to use for AMD/UMD bundles. */ - moduleId?: string - /** The name to use for the module for UMD/IIFE bundles (required for bundles with exports). */ - name?: string - /** Mapping of IDs → global variable names. Used for UMD/IIFE bundles. */ - globals?: ((id: string) => string) | { [id: string]: string } - /** - * Function that takes an ID and returns a path, or Object of id: path pairs. - * Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN. - */ - paths?: ((id: string) => string) | { [id: string]: string } - /** - * The indent string to use, for formats that require code to be indented (AMD, IIFE, UMD). - * Can also be false (no indent), or true (the default – auto-indent) - */ - indent?: string | boolean - /** - * Whether or not to add an 'interop block'. By default (interop: true). - * For safety's sake, Rollup will assign any external dependencies' default exports to a separate variable if it's necessary to distinguish between default and named exports. - * This generally only applies if your external dependencies were transpiled (for example with Babel) – if you're sure you don't need it, you can save a few bytes with interop: false. - */ - interop?: boolean - /** A string to prepend to the bundle. */ - banner?: string - /** A string to append to the bundle. */ - footer?: string - /** A string prepended to the code inside of the format-specific wrapper */ - intro?: string - /** A string appended to the code inside of the format-specific wrapper */ - outro?: string - /** - * Whether to include the 'use strict' pragma at the top of generated non-ES6 bundles. - * Strictly-speaking (geddit?), ES6 modules are always in strict mode, so you shouldn't disable this without good reason. - */ - strict?: boolean -} - -export interface GenerateOptions extends BundleOptions { - /** Whether to generate a sourcemap. If true, the return value from `bundle.generate(...)` will include a map property */ - sourcemap?: boolean - /** - * The location of the generated bundle. If this is an absolute path, all the sources paths in the sourcemap will be relative to it. - * The map.file property is the basename of sourcemapFile, as the location of the sourcemap is assumed to be adjacent to the bundle. - */ - sourcemapFile?: string -} - -export interface WriteOptions extends BundleOptions { - /** The file to write to. If `options.sourcemap === true`, two files will be created – `file` and `file + '.map`. */ - file: string - /** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting file as a data URI. */ - sourcemap?: boolean | 'inline' - /** This option is unnecessary, as it defaults to the value of file. */ - sourcemapFile?: string -} - -export interface Bundle { - /** Generate bundled code as an object */ - generate(options: GenerateOptions): Promise<{ code: string, map: SourceMap | null }> - /** writes the file (and accompanying sourcemap file, if appropriate) to the file system. */ - write(options: WriteOptions): Promise -} - -export interface Options { - /** The bundle's entry point (e.g. your `main.js` or `app.js` or `index.js`) */ - input: string - /** A previous bundle. Use it to speed up subsequent bundles :) */ - cache?: Bundle - /** - * Function that returns if an ID is external or array of IDs of modules that should remain external to the bundle. - * The IDs should be either the name of an external dependency or a resolved ID (like an absolute path to a file) - */ - external?: ((id: string) => boolean) | string[] - /** Function that will intercept warning messages. If not supplied, warnings will be deduplicated and printed to the console. */ - onwarn?(warning: Warning): void - /** Array of plugin objects or a single plugin object */ - plugins?: Plugin | Plugin[] - /** - * Whether or not to apply tree-shaking. (Default: true) - * It's recommended that you omit this option, unless you discover a bug caused by the tree-shaking algorithm in which case use treeshake: false once you've filed an issue! - */ - treeshake?: boolean - /** Any options that should be passed through to Acorn. */ - acorn?: acorn.Options - /** By default, the context of a module – i.e., the value of `this` at the top level – is `undefined`. In rare cases you might need to change this to something else, like `'window'`. */ - context?: any - /** Same as `options.context`, but per-module. */ - moduleContext?: ((id: string) => any) | { [id: string]: any } - /** Adds support for very old environments like IE8, at the cost of some extra code. */ - legacy?: boolean -} - -export interface ConfigFileOptions extends Options { - output: WriteOptions | WriteOptions[] -} - -// https://github.com/rollup/rollup/wiki/Plugins#creating-plugins -export interface Plugin { - /** The name of the plugin, for use in error messages and warnings */ - name?: string - /** A function that replaces or manipulates the options object passed to rollup.rollup */ - options?(options: Options): Options - /** A custom loader. Returning null or undefined defers to other load functions (and eventually the default behavior of loading from the file system). */ - load?(id: string): string | null | undefined - /** - * Custom resolver (useful for e.g. locating third-party dependencies). - * Returning null or undefined defers to other resolveId functions (and eventually the default resolution behavior); - * returning any other falsy value signals that importee should be treated as an external module and not included in the bundle. - */ - resolveId?(importee: string, importer: string | undefined): string | null | undefined | false | 0 | '' - /** A module transformer function */ - transform?(this: TransformContext, source: string, id: string): TransformResult | Promise - /** A bundle transformer function */ - transformBundle?(source: string, options: { format: Format }): TransformResult | Promise - /** Function hook called when bundle.generate() is being executed. */ - ongenerate?(options: GenerateOptions, bundle: Bundle): void - /** Function hook called when bundle.write() is being executed, after the file has been written to disk. */ - onwrite?(options: WriteOptions, bundle: Bundle): void - /** A function for generating intro text */ - intro?(): string - /** A function for generating outro text */ - outro?(): string - /** Prepend to the bundle. */ - banner?: string | (() => string) - /** Apppend to the bundle. */ - footer?: string | (() => string) -} - -// See https://github.com/rollup/rollup/wiki/Plugins#warnings-and-errors -export interface TransformContext { - /** Emit warnings to Rollup which will be logged during bundling */ - warn(message: string | { message: string }, pos?: number | { line: number, column: number }): void - /** Emit an error, which will abort the bundling process */ - error(message: string | { message: string }, pos?: number | { line: number, column: number }): void -} - -export type TransformResult = string | null | undefined | { code: string, map: SourceMap } - -/** Returns a Promise that resolves with a bundle */ -export function rollup(options: Options): Promise - -export interface WatchOptions extends ConfigFileOptions { - watch?: { - /** - * If set to true, will use chokidar for file watching (requires installation). - * If set to object, the settings are passed on to chokidar - */ - chokidar?: boolean | { [key: string]: any }; - /** Limit the file-watching to certain files, e.g. 'src/**' */ - include?: string; - /** Prevent files from being watched, e.g. 'node_modules/**' */ - exclude?: string; - } -} - -export interface StartEvent { - code: 'START' -} -export interface EndEvent { - code: 'END' -} -export interface ErrorEvent { - code: 'ERROR' - error: Error -} -export interface FatalEvent { - code: 'FATAL' - error: Error -} -export interface BundleStartEvent { - code: 'BUNDLE_START' - input: string - output: string[] -} -export interface BundleEndEvent { - code: 'BUNDLE_END' - input: string - output: string[] - duration: number -} -export type WatchEvent = StartEvent | EndEvent | ErrorEvent | FatalEvent | BundleStartEvent | BundleEndEvent - -export class Watcher { - /** Listen to the events that are emitted by rollup during watching */ - on(type: 'event', callback: (e: WatchEvent) => void): void - /** Stop watching for file changes */ - close(): void -} - -/** Starts rollup in watch mode. Returns a watcher instance for closing or listening to events */ -export function watch(options: WatchOptions): Watcher diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts deleted file mode 100644 index e2b18d6109..0000000000 --- a/types/rollup/rollup-tests.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { rollup, watch, Bundle, Plugin, ConfigFileOptions } from 'rollup' - -declare const console: { log(...messages: any[]): void, warn(message: string): void } - -let cache: Bundle | undefined -const plugin: Plugin = { - name: 'test-plugin', - resolveId(importee, importer) { - if (importer === undefined) { - return 'custom/entry/point.js' - } - return importer.trim() - }, - transform(source, id) { - if (id === 'rxjs') { - this.error(new Error(`Don't import this directly`)) - return null - } - const indexOfQuote = source.indexOf('"') - if (indexOfQuote >= 0) { - this.warn(`Prefer ' over " for strings`, indexOfQuote) - return undefined - } - if (id === 'foo') { - return Promise.resolve(source) - } - return source - }, - transformBundle(source, options) { - if (options.format === 'iife') { - return `window.nonModule = true\n${source}` - } else if (options.format === 'cjs') { - return null - } - if (options.format !== 'es') { - return Promise.resolve(source) - } - return undefined - } -} - -async function main() { - const bundle = await rollup({ - input: 'main.js', - external: ['external-module'], - plugins: [plugin], - onwarn: ({ code, frame, loc, message }) => { - if (loc) { - const { file, line, column } = loc - console.log(`[${code}] - ${file}(${line},${column}): ${message}`) - } else { - console.log(`[${code}] - ${message}`) - } - - if (frame) console.warn(frame) - }, - cache, - }) - - const bundle2 = await rollup({ - input: 'main.js', - external: id => /^rxjs/.test(id), - plugins: plugin - }) - - const { code, map } = await bundle.generate({ - format: 'cjs', - indent: false, - sourcemap: true, - }) - - console.log(code, map) - - cache = bundle - - await bundle.write({ - format: 'cjs', - file: 'bundle.js', - name: 'myLib', - interop: false, - globals: { - jquery: '$', - lodash: '_', - }, - banner: '/* Banner */', - footer: '/* Footer */', - intro: 'var ENV = "production";', - outro: 'var VERSION = "1.0.0";', - indent: ' ', - sourcemap: 'inline', - sourcemapFile: 'bundle.js.map', - strict: true, - }) - - await bundle.write({ - format: 'cjs', - file: 'bundle.js', - name: 'myLib', - interop: false, - globals: (x: string) => x.replace("", "/"), - banner: '/* Banner */', - footer: '/* Footer */', - intro: 'var ENV = "production";', - outro: 'var VERSION = "1.0.0";', - indent: ' ', - sourcemap: 'inline', - sourcemapFile: 'bundle.js.map', - strict: true, - }) - - const watcher = watch({ - input: 'main.js', - output: { - file: 'bundle.js', - format: 'es' - }, - watch: { - chokidar: true - } - }) - - watcher.on('event', e => { - switch (e.code) { - case 'START': - console.log(`We're rolling!`) - return - case 'END': - console.log(`We're all rolled up!`) - return - case 'ERROR': - case 'FATAL': - console.log(e.error.message) - return - case 'BUNDLE_START': - console.log(`Bundling: ${e.input}`) - return - case 'BUNDLE_END': - console.log(`Bundling: ${e.input}`) - return - } - - assertNever(e) - }) - - watcher.close() -} - -main() - -export const defaultConfig: ConfigFileOptions = { - input: 'main.js', - output: { - file: 'bundle.js', - format: 'iife', - } -} - -export const multiConfig: ConfigFileOptions = { - input: 'main.js', - output: [ - { - file: 'bundle.esm.js', - format: 'es', - }, - { - file: 'bundle.cjs.js', - format: 'cjs', - } - ] -} - -function assertNever(nope: never) { - throw new Error('Oh no!') -} diff --git a/types/rollup/tsconfig.json b/types/rollup/tsconfig.json deleted file mode 100644 index 2fad31b1b1..0000000000 --- a/types/rollup/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "rollup-tests.ts" - ] -} \ No newline at end of file diff --git a/types/rollup/tslint.json b/types/rollup/tslint.json deleted file mode 100644 index ba7f6bc7ae..0000000000 --- a/types/rollup/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "semicolon": [true, "never"] - } -} From 6127769a30c4308b5f0105270349c79045232497 Mon Sep 17 00:00:00 2001 From: daniel tea Date: Wed, 17 Jan 2018 10:04:41 -0800 Subject: [PATCH 0090/1348] material-ui: Add dropDownMenuProps to SelectField (#22857) --- types/material-ui/index.d.ts | 1 + types/material-ui/material-ui-tests.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 08a18a752b..32410592ab 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1409,6 +1409,7 @@ declare namespace __MaterialUI { // is the element that get the 'other' properties autoWidth?: boolean; disabled?: boolean; + dropDownMenuProps?: Menus.DropDownMenuProps; errorStyle?: React.CSSProperties; errorText?: React.ReactNode; floatingLabelFixed?: boolean; diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index 316a14b78a..b01613cd8c 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -5508,6 +5508,31 @@ class SelectFieldExampleSelectionRenderer extends Component<{}, {values?: string } } +class SelectFieldExampleDropDownMenu extends Component<{}, {value?: number}> { + constructor(props) { + super(props); + this.state = {value: null}; + } + + handleChange = (event, index, value) => this.setState({value}); + + render() { + return ( + + + + + + ); + } +} + // "http://www.material-ui.com/#/components/slider" const SliderExampleSimple = () => (
From 4d594ddb559113487cd0d1a5633f1baeb3b8f958 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Wed, 17 Jan 2018 19:05:28 +0100 Subject: [PATCH 0091/1348] fixed connection types in auth0 (#22843) --- types/auth0/index.d.ts | 86 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 15 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 479bf70c03..609c1ecf0d 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0 2.6 +// Type definitions for auth0 2.7 // Project: https://github.com/auth0/node-auth0 // Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -99,7 +99,6 @@ export interface Rule { order?: number; } - export interface Client { /** * The name of the client. @@ -257,6 +256,66 @@ export interface CreateClientGrant { scope: string[]; } +export type Strategy = + 'ad' | 'adfs' | 'amazon' | 'dropbox' | 'bitbucket' | 'aol' | 'auth0-adldap' | 'auth0-oidc' | + 'auth0' | 'baidu' | 'bitly' | 'box' | 'custom' | 'daccount' | 'dwolla' | 'email' | + 'evernote-sandbox' | 'evernote' | 'exact' | 'facebook' | 'fitbit' | 'flickr' | 'github' | + 'google-apps' | 'google-oauth2' | 'guardian' | 'instagram' | 'ip' | 'linkedin' | 'miicard' | + 'oauth1' | 'oauth2' | 'office365' | 'paypal' | 'paypal-sandbox' | 'pingfederate' | + 'planningcenter' | 'renren' | 'salesforce-community' | 'salesforce-sandbox' | 'salesforce' | + 'samlp' | 'sharepoint' | 'shopify' | 'sms' | 'soundcloud' | 'thecity-sandbox' | 'thecity' | + 'thirtysevensignals' | 'twitter' | 'untappd' | 'vkontakte' | 'waad' | 'weibo' | 'windowslive' | + 'wordpress' | 'yahoo' | 'yammer' | 'yandex'; + +export interface UpdateConnection { + options?: any; + /** + * The identifiers of the clients for which the connection is to + * be enabled. If the array is empty or the property is not + * specified, no clients are enabled. + */ + enabled_clients?: string[]; + /** + * Defines the realms for which the connection will be used + * (ie: email domains). If the array is empty or the property is + * not specified, the connection name will be added as realm. + */ + realms?: string[]; + metadata?: any; + /** + * True if the connection is domain level. + */ + is_domain_connection?: boolean; +} + +export interface Connection extends UpdateConnection { + /** + * The connection's identifier. + */ + id?: string; + /** + * The name of the connection. + */ + name?: string; + /** + * The type of the connection, related to the identity provider. + */ + strategy?: Strategy; +} + +export interface CreateConnection extends UpdateConnection { + /** + * The name of the connection. Must start and end with an + * alphanumeric character and can only contain alphanumeric + * characters and '-'. Max length 128. + */ + name: string; + /** + * The identity provider identifier for the connection. + */ + strategy: Strategy; +} + export interface User { email?: string; email_verified?: boolean; @@ -488,23 +547,20 @@ export class ManagementClient { getClientInfo(): ClientInfo; // Connections - getConnections(): Promise; - getConnections(cb: (err: Error, data: any) => void): void; + getConnections(): Promise; + getConnections(cb: (err: Error, connections: Connection[]) => void): void; - createConnection(data: ObjectWithId): Promise; - createConnection(data: ObjectWithId, cb: (err: Error, data: any) => void): void; + createConnection(data: CreateConnection): Promise; + createConnection(data: CreateConnection, cb: (err: Error, connection: Connection) => void): void; - getConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - getConnection(params: ObjectWithId): Promise; + getConnection(params: ObjectWithId, cb: (err: Error, connection: Connection) => void): void; + getConnection(params: ObjectWithId): Promise; - deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - deleteConnection(params: ObjectWithId): Promise; + deleteConnection(params: ObjectWithId, cb: (err: Error) => void): void; + deleteConnection(params: ObjectWithId): Promise; - deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void; - deleteConnection(params: ObjectWithId): Promise; - - updateConnection(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void; - updateConnection(params: ObjectWithId, data: Data): Promise; + updateConnection(params: ObjectWithId, data: UpdateConnection, cb: (err: Error, connection: Connection) => void): void; + updateConnection(params: ObjectWithId, data: UpdateConnection): Promise; // Clients From ea600ecad45db552ff93d5765973cf89e33f30dd Mon Sep 17 00:00:00 2001 From: "Juan J. Jimenez-Anca" Date: Wed, 17 Jan 2018 18:07:42 +0000 Subject: [PATCH 0092/1348] group in namespaces in order type create() environments (#22813) * first sanctuary types * group in namespaces in order type create() environments --- types/sanctuary/index.d.ts | 712 ++++++++++++----------------- types/sanctuary/sanctuary-tests.ts | 5 +- 2 files changed, 295 insertions(+), 422 deletions(-) diff --git a/types/sanctuary/index.d.ts b/types/sanctuary/index.d.ts index 78ec3bfd71..0d61fe22aa 100644 --- a/types/sanctuary/index.d.ts +++ b/types/sanctuary/index.d.ts @@ -4,449 +4,319 @@ // Juan J. Jimenez-Anca // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export type Nullable = A | null; +declare var S: Sanctuary.Environment; +export = S; +export as namespace S; -export type Pair = [A, B]; +type Nullable = A | null; -export type Thunk = () => A; +type Pair = [A, B]; -export type Fn = (a: A) => B; -export type Fn2 = (a: A) => (b: B) => C; -export type Fn3 = (a: A) => (b: B) => (c: C) => D; -export type Fn4 = (a: A) => (b: B) => (c: C) => (d: D) => E; -export type Fn5 = (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => F; -export type Fn2_ = (a: A, b: B) => C; -export type Fn3_ = (a: A, b: B, c: C) => D; -export type Fn4_ = (a: A, b: B, c: C, d: D) => E; -export type Fn5_ = (a: A, b: B, c: C, d: D, e: E) => F; +type Thunk = () => A; -export type Predicate = (a: A) => boolean; +type Fn = (a: A) => B; +type Fn2 = (a: A) => (b: B) => C; +type Fn3 = (a: A) => (b: B) => (c: C) => D; +type Fn4 = (a: A) => (b: B) => (c: C) => (d: D) => E; +type Fn5 = (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => F; +type Fn2_ = (a: A, b: B) => C; +type Fn3_ = (a: A, b: B, c: C) => D; +type Fn4_ = (a: A, b: B, c: C, d: D) => E; +type Fn5_ = (a: A, b: B, c: C, d: D, e: E) => F; -export interface StrMap { [k: string]: A; } +type Predicate = (a: A) => boolean; -export interface Maybe { +interface StrMap { [k: string]: A; } + +interface Maybe { constructor: { '@@type': 'sanctuary/Maybe'; }; } -export interface Either { +interface Either { constructor: { '@@type': 'sanctuary/Either'; }; } -export type ValidNumber = number; -export type FiniteNumber = number; -export type NonZeroFiniteNumber = number; -export type Integer = number; -export type NonNegativeInteger = number; - -export interface TypeRep {} - -export interface Setoid {} -export interface Ord extends Setoid {} -export interface Semigroupoid {} -export interface Category extends Semigroupoid {} -export interface Semigroup {} -export interface Monoid extends Semigroup {} -export interface Functor {} -export interface Bifunctor extends Functor {} -export interface Profunctor extends Functor {} -export interface Apply extends Functor {} -export interface Applicative extends Apply {} -export interface Chain extends Apply {} -export interface ChainRec extends Chain {} -export interface Monad extends Applicative, Chain {} -export interface Alt extends Functor {} -export interface Plus extends Alt {} -export interface Alternative extends Applicative, Plus {} -export interface Foldable {} -export interface Traversable extends Functor, Foldable {} -export interface Extend extends Functor {} -export interface Comonad extends Extend {} -export interface Contravariant {} - -export const Maybe: TypeRep; -export const Nothing: Maybe; -export function Just(x: A): Maybe; - -export const Either: TypeRep; -export function Left(x: A): Either; -export function Right(x: A): Either; - -// TODO: Specify return type -export function create(opts: {checkTypes: boolean, env: any[]}): {}; - -export const env: any[]; - -// Classify -export function type(x: any): { - namespace: Maybe - name: string - version: NonNegativeInteger -}; - -export function is(typeRep: TypeRep): (x: any) => boolean; - -// Showable -export function toString(x: any): string; - -// Fantasy Land -export function equals(x: Setoid): (y: Setoid) => boolean; - -export function lt (x: Ord): (y: Ord) => boolean; -export function lte(x: Ord): (y: Ord) => boolean; -export function gt (x: Ord): (y: Ord) => boolean; -export function gte(x: Ord): (y: Ord) => boolean; - -export function min(x: Ord): (y: Ord) => A; -export function max(x: Ord): (y: Ord) => A; - -export function id(p: TypeRep): Fn | Category; - -export function concat(x: Semigroup): (y: Semigroup) => Semigroup; -export function concat(x: A[]): (y: A[]) => A[]; -export function concat(x: StrMap): (y: StrMap) => StrMap; -export function concat(x: string): (y: string) => string; - -export function empty(p: TypeRep): Monoid; - -export function map(p: Fn): { - (q: Fn): Fn; - (q: A[]): B[]; - (q: StrMap): StrMap; - (q: Functor): Functor; -}; - -export function bimap(p: Fn): (q: Fn) => (r: Bifunctor) => Bifunctor; - -export function promap(p: Fn): (q: Fn) => { - (r: Fn): Fn; - (r: Profunctor): Profunctor; -}; - -export function alt(x: Alt): (y: Alt) => Alt; - -export function zero(p: TypeRep): Plus; - -export function reduce(p: Fn2): (q: B) => (r: A[] | StrMap | Maybe | Either | Foldable) => B; - -export function traverse(typeRep: TypeRep): (f: Fn>) => (traversable: Traversable) => Applicative>; - -export function sequence(typeRep: TypeRep): (traversable: Traversable>) => Applicative>; - -export function ap(p: Apply>): (q: Apply) => Apply; - -export function lift2(f: Fn2): { - (x: Fn): (y: Fn) => Fn; - (x: Apply): (y: Apply) => Apply; -}; - -export function lift3(f: Fn3): { - (x: Fn): (y: Fn) => (z: Fn) => Fn; - (x: Apply): (y: Apply) => (z: Apply) => Apply; -}; - -export function apFirst (x: Apply): (y: Apply) => Apply; -export function apSecond(x: Apply): (y: Apply) => Apply; - -export function of(typeRep: TypeRep): (x: A) => Fn; -export function of(typeRep: TypeRep): (x: A) => Applicative; - -export function chain(f: Fn2): (chain_: Fn) => Fn; -export function chain(f: Fn >): (chain_: Chain) => Chain; - -export function join(chain_: Fn2): Fn; -export function join(chain_: A[][]): A[]; -export function join(chain_: Maybe>): Maybe; -export function join(chain_: Chain>): Chain; - -export function chainRec(typeRep: TypeRep): { - (f: Fn2>): (x: A) => Fn; - (f: Fn >>): (x: A) => ChainRec; -}; - -export function extend(f: Fn, B>): (extend_: Extend) => Extend; - -export function extract(comonad: Comonad): A; - -export function contramap(f: Fn): { - (contravariant: Fn): Fn; - (contravariant: Contravariant): Contravariant; -}; - -export function filter (pred: Predicate): { - (m: A[]): A[]; - (m: Foldable): Foldable; -}; - -export function filterM(pred: Predicate): { - (m: A[]): A[]; - (m: Foldable): Foldable; -}; - -export function takeWhile(pred: Predicate): (foldable: Foldable) => Foldable; -export function dropWhile(pred: Predicate): (foldable: Foldable) => Foldable; - -// Combinator -export function I(x: A): A; - -export function K(x: A): (y: any) => A; - -export function T(x: A): (f: Fn) => B; - -// Function -export function curry2(f: Fn2_): Fn2; - -export function curry3(f: Fn3_): Fn3; - -export function curry4(f: Fn4_): Fn4; - -export function curry5(f: Fn5_): Fn5; - -export function flip(f: Fn2): Fn2; - -// Composition -export function compose(f: Fn): (g: Fn) => Fn; -export function compose(x: Semigroupoid): (y: Semigroupoid) => Semigroupoid; - -export function pipe(fs: [Fn]): (x: A) => B; -export function pipe(fs: [Fn, Fn]): (x: A) => C; -export function pipe(fs: [Fn, Fn, Fn]): (x: A) => D; -export function pipe(fs: [Fn, Fn, Fn, Fn]): (x: A) => E; -export function pipe(fs: [Fn, Fn, Fn, Fn, Fn]): (x: A) => F; -export function pipe(fs: Array>): (x: any) => any; - -export function on(p: Fn2): (q: Fn) => (r: A) => Fn; - -// TODO: Maybe -export function isNothing(p: Maybe): boolean; - -export function isJust(p: Maybe): boolean; - -export function fromMaybe(p: A): (q: Maybe) => A; - -export function fromMaybe_(p: Thunk): (q: Maybe) => A; - -export function maybeToNullable(p: Maybe): Nullable; - -export function toMaybe(p: A | null | undefined): Maybe; - -export function maybe(p: B): (q: Fn) => (r: Maybe) => B; - -export function maybe_(p: Thunk): (q: Fn) => (r: Maybe) => B; - -export function justs(p: Array>): A[]; - -export function mapMaybe(p: Fn>): (q: A[]) => A[]; - -export function encase(p: Fn): Fn>; - -export function encase2(p: Fn2): Fn2>; - -export function encase3(p: Fn3): Fn3>; - -export function maybeToEither(p: A): (q: Maybe) => Either; - -// TODO: Either -export function isLeft(p: Either): boolean; - -export function isRight(p: Either): boolean; - -export function fromEither(p: B): (q: Either) => B; - -export function toEither(p: A): (q: B | null | undefined) => Either; - -export function either(p: Fn): (q: Fn) => (r: Either) => C; - -export function lefts(p: Array>): A[]; - -export function rights(p: Array>): B[]; - -export function tagBy(p: Predicate): (q: A) => Either; - -export function encaseEither(p: Fn): (q: Fn) => Fn>; - -export function encaseEither2(p: Fn): (q: Fn2) => Fn2>; - -export function encaseEither3(p: Fn): (q: Fn3) => Fn3>; - -export function eitherToMaybe(p: Either): Maybe; - -// Logic -export function and(p: boolean): (q: boolean) => boolean; - -export function or(p: boolean): (q: boolean) => boolean; - -export function not(p: boolean): boolean; - -export function complement(p: Predicate): Predicate; - -export function ifElse(p: Predicate): (q: Fn) => (r: Fn) => Fn; - -export function when(p: Predicate): (q: Fn) => Fn; - -export function unless(p: Predicate): (q: Fn) => Fn; - -export function allPass(p: Array>): Predicate; - -export function anyPass(p: Array>): Predicate; - -// List -export interface ListToMaybeList { +type ValidNumber = number; +type FiniteNumber = number; +type NonZeroFiniteNumber = number; +type Integer = number; +type NonNegativeInteger = number; + +interface TypeRep {} + +interface Setoid {} +interface Ord extends Setoid {} +interface Semigroupoid {} +interface Category extends Semigroupoid {} +interface Semigroup {} +interface Monoid extends Semigroup {} +interface Functor {} +interface Bifunctor extends Functor {} +interface Profunctor extends Functor {} +interface Apply extends Functor {} +interface Applicative extends Apply {} +interface Chain extends Apply {} +interface ChainRec extends Chain {} +interface Monad extends Applicative, Chain {} +interface Alt extends Functor {} +interface Plus extends Alt {} +interface Alternative extends Applicative, Plus {} +interface Foldable {} +interface Traversable extends Functor, Foldable {} +interface Extend extends Functor {} +interface Comonad extends Extend {} +interface Contravariant {} + +interface ListToMaybeList { (xs: string): Maybe; (xs: A[]): Maybe; } -export function slice(p: Integer): (q: Integer) => ListToMaybeList; - -export function at(p: Integer): { - (q: string): Maybe; - (q: A[]): Maybe; -}; - -export function head(xs: string): Maybe; -export function head(xs: A[]): Maybe; - -export function last(xs: string): Maybe; -export function last(xs: A[]): Maybe; - -export function tail(xs: string): Maybe; -export function tail(xs: A[]): Maybe; - -export function init(xs: string): Maybe; -export function init(xs: A[]): Maybe; - -export function take(n: Integer): ListToMaybeList; - -export function takeLast(n: Integer): ListToMaybeList; - -export function drop(n: Integer): ListToMaybeList; - -export function dropLast(n: Integer): ListToMaybeList; - -// Array -// TODO: Fantasyland overloads, non-curried versions -export function append(x: A): { - (xs: A[]): A[]; - (xs: Applicative): Applicative; -}; - -export function prepend(x: A): { - (xs: A[]): A[]; - (xs: Applicative): Applicative; -}; - -export function joinWith(p: string): (q: string[]) => string; - -export function elem(p: A): (q: Foldable | StrMap | A[]) => boolean; - -export function find(p: Predicate): (q: A[] | StrMap | Foldable) => Maybe; - -export function pluck(key: string): (xs: Functor) => Functor; - -export function unfoldr(f: Fn>>): (x: B) => A[]; - -export function range(from: Integer): (to: Integer) => Integer[]; - -export function groupBy(f: Fn2): (xs: A[]) => A[][]; - -export function reverse(foldable: A[]): A[]; -export function reverse(foldable: Foldable): Foldable; - -export function sort(foldable: A[]): A[]; -export function sort(foldable: Foldable): Foldable; - -export function sortBy(f: Fn>): { - (foldable: A[]): A[]; - (foldable: Foldable): Foldable; -}; - -// Object -export function prop(p: string): (q: any) => any; - -export function props(p: string[]): (q: any) => any; - -export function get(p: Predicate): (q: string) => (r: any) => Maybe; - -export function gets(p: Predicate): (q: string[]) => (r: any) => Maybe; - -// StrMap -export function keys(p: StrMap): string[]; - -export function values(p: StrMap): A[]; - -export function pairs(p: StrMap): Array>; - -// Number -export function negate(n: ValidNumber): ValidNumber; - -export function add(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - -export function sum(p: Foldable | FiniteNumber[]): FiniteNumber; - -export function sub(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - -export function mult(x: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - -export function product(p: Foldable | FiniteNumber[]): FiniteNumber; - -export function div(p: NonZeroFiniteNumber): (q: FiniteNumber) => FiniteNumber; - -export function pow(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; - -export function mean(p: Foldable | FiniteNumber[]): Maybe; - -// Integer -export function even(n: Integer): boolean; - -export function odd(n: Integer): boolean; - -// Parse -export function parseDate(s: string): Maybe; - -export function parseFloat(s: string): Maybe; - -export function parseInt(p: Integer): (q: string) => Maybe; - -export function parseJson(p: Predicate): (q: string) => Maybe; - -// RegExp -export function regex(p: string): (q: string) => RegExp; - -export function regexEscape(s: string): string; - -export function test(pattern: RegExp): Predicate; - -export interface MatchObj { +interface MatchObj { match: string; groups: Array>; } -export function match(pattern: RegExp): (q: string) => Array>; +declare namespace Sanctuary { + interface Static { + Maybe: TypeRep; + Nothing: Maybe; + Just(x: A): Maybe; + Either: TypeRep; + Left(x: A): Either; + Right(x: A): Either; + // Classify + type(x: any): { + namespace: Maybe + name: string + version: NonNegativeInteger + }; + is(typeRep: TypeRep): (x: any) => boolean; + // Showable + toString(x: any): string; + // Fantasy Land + equals(x: Setoid): (y: Setoid) => boolean; + lt (x: Ord): (y: Ord) => boolean; + lte(x: Ord): (y: Ord) => boolean; + gt (x: Ord): (y: Ord) => boolean; + gte(x: Ord): (y: Ord) => boolean; + min(x: Ord): (y: Ord) => A; + max(x: Ord): (y: Ord) => A; + id(p: TypeRep): Fn | Category; + concat(x: Semigroup): (y: Semigroup) => Semigroup; + concat(x: A[]): (y: A[]) => A[]; + concat(x: StrMap): (y: StrMap) => StrMap; + concat(x: string): (y: string) => string; + empty(p: TypeRep): Monoid; + map(p: Fn): { + (q: Fn): Fn; + (q: A[]): B[]; + (q: StrMap): StrMap; + (q: Functor): Functor; + }; + bimap(p: Fn): (q: Fn) => (r: Bifunctor) => Bifunctor; + promap(p: Fn): (q: Fn) => { + (r: Fn): Fn; + (r: Profunctor): Profunctor; + }; + alt(x: Alt): (y: Alt) => Alt; + zero(p: TypeRep): Plus; + reduce(p: Fn2): (q: B) => (r: A[] | StrMap | Maybe | Either | Foldable) => B; + traverse(typeRep: TypeRep): (f: Fn>) => (traversable: Traversable) => Applicative>; + sequence(typeRep: TypeRep): (traversable: Traversable>) => Applicative>; + ap(p: Apply>): (q: Apply) => Apply; + lift2(f: Fn2): { + (x: Fn): (y: Fn) => Fn; + (x: Apply): (y: Apply) => Apply; + }; + lift3(f: Fn3): { + (x: Fn): (y: Fn) => (z: Fn) => Fn; + (x: Apply): (y: Apply) => (z: Apply) => Apply; + }; + apFirst (x: Apply): (y: Apply) => Apply; + apSecond(x: Apply): (y: Apply) => Apply; + of(typeRep: TypeRep): (x: A) => Fn; + of(typeRep: TypeRep): (x: A) => Applicative; + chain(f: Fn2): (chain_: Fn) => Fn; + chain(f: Fn >): (chain_: Chain) => Chain; + join(chain_: Fn2): Fn; + join(chain_: A[][]): A[]; + join(chain_: Maybe>): Maybe; + join(chain_: Chain>): Chain; + chainRec(typeRep: TypeRep): { + (f: Fn2>): (x: A) => Fn; + (f: Fn >>): (x: A) => ChainRec; + }; + extend(f: Fn, B>): (extend_: Extend) => Extend; + extract(comonad: Comonad): A; + contramap(f: Fn): { + (contravariant: Fn): Fn; + (contravariant: Contravariant): Contravariant; + }; + filter (pred: Predicate): { + (m: A[]): A[]; + (m: Foldable): Foldable; + }; + filterM(pred: Predicate): { + (m: A[]): A[]; + (m: Foldable): Foldable; + }; + takeWhile(pred: Predicate): (foldable: Foldable) => Foldable; + dropWhile(pred: Predicate): (foldable: Foldable) => Foldable; + // Combinator + I(x: A): A; + K(x: A): (y: any) => A; + T(x: A): (f: Fn) => B; + // Function + curry2(f: Fn2_): Fn2; + curry3(f: Fn3_): Fn3; + curry4(f: Fn4_): Fn4; + curry5(f: Fn5_): Fn5; + flip(f: Fn2): Fn2; + // Composition + compose(f: Fn): (g: Fn) => Fn; + compose(x: Semigroupoid): (y: Semigroupoid) => Semigroupoid; + pipe(fs: [Fn]): (x: A) => B; + pipe(fs: [Fn, Fn]): (x: A) => C; + pipe(fs: [Fn, Fn, Fn]): (x: A) => D; + pipe(fs: [Fn, Fn, Fn, Fn]): (x: A) => E; + pipe(fs: [Fn, Fn, Fn, Fn, Fn]): (x: A) => F; + pipe(fs: Array>): (x: any) => any; + on(p: Fn2): (q: Fn) => (r: A) => Fn; + // TODO: Maybe + isNothing(p: Maybe): boolean; + isJust(p: Maybe): boolean; + fromMaybe(p: A): (q: Maybe) => A; + fromMaybe_(p: Thunk): (q: Maybe) => A; + maybeToNullable(p: Maybe): Nullable; + toMaybe(p: A | null | undefined): Maybe; + maybe(p: B): (q: Fn) => (r: Maybe) => B; + maybe_(p: Thunk): (q: Fn) => (r: Maybe) => B; + justs(p: Array>): A[]; + mapMaybe(p: Fn>): (q: A[]) => A[]; + encase(p: Fn): Fn>; + encase2(p: Fn2): Fn2>; + encase3(p: Fn3): Fn3>; + maybeToEither(p: A): (q: Maybe) => Either; + // TODO: Either + isLeft(p: Either): boolean; + isRight(p: Either): boolean; + fromEither(p: B): (q: Either) => B; + toEither(p: A): (q: B | null | undefined) => Either; + either(p: Fn): (q: Fn) => (r: Either) => C; + lefts(p: Array>): A[]; + rights(p: Array>): B[]; + tagBy(p: Predicate): (q: A) => Either; + encaseEither(p: Fn): (q: Fn) => Fn>; + encaseEither2(p: Fn): (q: Fn2) => Fn2>; + encaseEither3(p: Fn): (q: Fn3) => Fn3>; + eitherToMaybe(p: Either): Maybe; + // Logic + and(p: boolean): (q: boolean) => boolean; + or(p: boolean): (q: boolean) => boolean; + not(p: boolean): boolean; + complement(p: Predicate): Predicate; + ifElse(p: Predicate): (q: Fn) => (r: Fn) => Fn; + when(p: Predicate): (q: Fn) => Fn; + unless(p: Predicate): (q: Fn) => Fn; + allPass(p: Array>): Predicate; + anyPass(p: Array>): Predicate; + // List + slice(p: Integer): (q: Integer) => ListToMaybeList; + at(p: Integer): { + (q: string): Maybe; + (q: A[]): Maybe; + }; + head(xs: string): Maybe; + head(xs: A[]): Maybe; + last(xs: string): Maybe; + last(xs: A[]): Maybe; + tail(xs: string): Maybe; + tail(xs: A[]): Maybe; + init(xs: string): Maybe; + init(xs: A[]): Maybe; + take(n: Integer): ListToMaybeList; + takeLast(n: Integer): ListToMaybeList; + drop(n: Integer): ListToMaybeList; + dropLast(n: Integer): ListToMaybeList; + // Array + // TODO: Fantasyland overloads, non-curried versions + append(x: A): { + (xs: A[]): A[]; + (xs: Applicative): Applicative; + }; + prepend(x: A): { + (xs: A[]): A[]; + (xs: Applicative): Applicative; + }; + joinWith(p: string): (q: string[]) => string; + elem(p: A): (q: Foldable | StrMap | A[]) => boolean; + find(p: Predicate): (q: A[] | StrMap | Foldable) => Maybe; + pluck(key: string): (xs: Functor) => Functor; + unfoldr(f: Fn>>): (x: B) => A[]; + range(from: Integer): (to: Integer) => Integer[]; + groupBy(f: Fn2): (xs: A[]) => A[][]; + reverse(foldable: A[]): A[]; + reverse(foldable: Foldable): Foldable; + sort(foldable: A[]): A[]; + sort(foldable: Foldable): Foldable; + sortBy(f: Fn>): { + (foldable: A[]): A[]; + (foldable: Foldable): Foldable; + }; + // Object + prop(p: string): (q: any) => any; + props(p: string[]): (q: any) => any; + get(p: Predicate): (q: string) => (r: any) => Maybe; + gets(p: Predicate): (q: string[]) => (r: any) => Maybe; + // StrMap + keys(p: StrMap): string[]; + values(p: StrMap): A[]; + pairs(p: StrMap): Array>; + // Number + negate(n: ValidNumber): ValidNumber; + add(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; + sum(p: Foldable | FiniteNumber[]): FiniteNumber; + sub(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; + mult(x: FiniteNumber): (q: FiniteNumber) => FiniteNumber; + product(p: Foldable | FiniteNumber[]): FiniteNumber; + div(p: NonZeroFiniteNumber): (q: FiniteNumber) => FiniteNumber; + pow(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; + mean(p: Foldable | FiniteNumber[]): Maybe; + // Integer + even(n: Integer): boolean; + odd(n: Integer): boolean; + // Parse + parseDate(s: string): Maybe; + parseFloat(s: string): Maybe; + parseInt(p: Integer): (q: string) => Maybe; + parseJson(p: Predicate): (q: string) => Maybe; + // RegExp + regex(p: string): (q: string) => RegExp; + regexEscape(s: string): string; + test(pattern: RegExp): Predicate; + match(pattern: RegExp): (q: string) => Array>; + matchAll(pattern: RegExp): (q: string) => MatchObj[]; + // String + toUpper(s: string): string; + toLower(s: string): string; + trim(s: string): string; + stripPrefix(prefix: string): (q: string) => Maybe; + stripSuffix(suffix: string): (q: string) => Maybe; + words(s: string): string[]; + unwords(xs: string[]): string; + lines(s: string): string[]; + unlines(xs: string[]): string; + splitOn(separator: string): (q: string) => string[]; + splitOnRegex(pattern: RegExp): (q: string) => string[]; + } -export function matchAll(pattern: RegExp): (q: string) => MatchObj[]; - -// String -export function toUpper(s: string): string; - -export function toLower(s: string): string; - -export function trim(s: string): string; - -export function stripPrefix(prefix: string): (q: string) => Maybe; - -export function stripSuffix(suffix: string): (q: string) => Maybe; - -export function words(s: string): string[]; - -export function unwords(xs: string[]): string; - -export function lines(s: string): string[]; - -export function unlines(xs: string[]): string; - -export function splitOn(separator: string): (q: string) => string[]; - -export function splitOnRegex(pattern: RegExp): (q: string) => string[]; + interface Environment extends Static { + env: any[]; + create(opts: {checkTypes: boolean, env: any[]}): Static; + } +} diff --git a/types/sanctuary/sanctuary-tests.ts b/types/sanctuary/sanctuary-tests.ts index 76c5bb9c7e..663811935c 100644 --- a/types/sanctuary/sanctuary-tests.ts +++ b/types/sanctuary/sanctuary-tests.ts @@ -1,6 +1,9 @@ /// ; -import * as S from "sanctuary"; import * as assert from "assert"; +import { create, env } from "sanctuary"; + +const checkTypes = process.env["NODE_ENV"] !== "production"; +const S = create({checkTypes, env}); assert.equal(S.map(S.concat('@'))(['foo', 'bar', 'baz']), ["@foo", "@bar", "@baz"]); assert.equal(S.reduce(S.add)(0)([1, 2, 3, 4, 5]), 15); From 91ad6517321b4e40f58d92e51379f24045305a61 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Wed, 17 Jan 2018 19:09:36 +0100 Subject: [PATCH 0093/1348] feat(skatejs): add skatejs library types (#22006) * feat(skatejs) add skatejs types - fix(skatejs): udpate tsconfig and fix imports in tests - fix(skatejs): make test pass - feat(skatejs): update to latest api's and add more tests - refactor(skatejs): remove tsx extension as skate is not using VDom at all - fix(skatejs): fix ts next strict errors - ci(skatejs): explicitly use files cause include is not allowed - refactor(skatejs): rename tests folder to test - fix(skatejs): don't use strict within tsconfig - fix(skatejs): fix lint errors - fix(skatejs): use standard dtslint rules without overrides * fix(skatejs): downgrade required TS version * refactor(skatejs): improve PropOptions interface by making it generic * ci(skatejs): mitigate failing build --- types/skatejs/api.d.ts | 72 +++++++++++ types/skatejs/index.d.ts | 28 +++++ types/skatejs/test/components/custom-base.ts | 4 + .../skatejs/test/components/no-shadow-root.ts | 116 ++++++++++++++++++ .../skatejs/test/components/props-set-get.ts | 58 +++++++++ .../test/components/with-custom-base.ts | 43 +++++++ types/skatejs/test/mixins/with-children.ts | 10 ++ types/skatejs/test/mixins/with-component.ts | 41 +++++++ types/skatejs/test/mixins/with-context.ts | 87 +++++++++++++ types/skatejs/test/mixins/with-lifecycle.ts | 19 +++ types/skatejs/test/mixins/with-renderer.ts | 20 +++ types/skatejs/test/mixins/with-update.ts | 37 ++++++ types/skatejs/test/renderers/custom.ts | 21 ++++ types/skatejs/test/renderers/default.ts | 16 +++ types/skatejs/test/utils/define.ts | 12 ++ types/skatejs/test/utils/emit.ts | 18 +++ types/skatejs/test/utils/link.ts | 34 +++++ types/skatejs/test/utils/name.ts | 16 +++ types/skatejs/test/utils/shadow.ts | 7 ++ types/skatejs/tsconfig.json | 42 +++++++ types/skatejs/tslint.json | 3 + types/skatejs/types.d.ts | 112 +++++++++++++++++ 22 files changed, 816 insertions(+) create mode 100644 types/skatejs/api.d.ts create mode 100644 types/skatejs/index.d.ts create mode 100644 types/skatejs/test/components/custom-base.ts create mode 100644 types/skatejs/test/components/no-shadow-root.ts create mode 100644 types/skatejs/test/components/props-set-get.ts create mode 100644 types/skatejs/test/components/with-custom-base.ts create mode 100644 types/skatejs/test/mixins/with-children.ts create mode 100644 types/skatejs/test/mixins/with-component.ts create mode 100644 types/skatejs/test/mixins/with-context.ts create mode 100644 types/skatejs/test/mixins/with-lifecycle.ts create mode 100644 types/skatejs/test/mixins/with-renderer.ts create mode 100644 types/skatejs/test/mixins/with-update.ts create mode 100644 types/skatejs/test/renderers/custom.ts create mode 100644 types/skatejs/test/renderers/default.ts create mode 100644 types/skatejs/test/utils/define.ts create mode 100644 types/skatejs/test/utils/emit.ts create mode 100644 types/skatejs/test/utils/link.ts create mode 100644 types/skatejs/test/utils/name.ts create mode 100644 types/skatejs/test/utils/shadow.ts create mode 100644 types/skatejs/tsconfig.json create mode 100644 types/skatejs/tslint.json create mode 100644 types/skatejs/types.d.ts diff --git a/types/skatejs/api.d.ts b/types/skatejs/api.d.ts new file mode 100644 index 0000000000..4115404608 --- /dev/null +++ b/types/skatejs/api.d.ts @@ -0,0 +1,72 @@ +import { + ComposedCustomEvent, + Constructor, + CustomElement, + HTMLElementClass, + EventOptions, + PropOptions, + WithChildren, + WithRenderer, + WithUpdate, + WithComponent, + WithLifecycle, + WithContext, + Mixed +} from './types'; + +/** + * The define() function is syntactic sugar on top of customElements.define() + * that allows you to specify a static is property on your constructor that is the name of the component, + * or omit it altogether. + */ +export const define: (ctor: T) => T; + +/** + * Emits an Event on elem that is composed, bubbles and is cancelable by default. + * The return value of emit() is the same as dispatchEvent(). + */ +export function emit(elem: EventTarget | HTMLElementClass, eventName: string, eventOptions?: EventOptions): boolean; + +export function link(elem: CustomElement, target?: string): (e: ComposedCustomEvent) => void; + +export const props: Readonly<{ + any: PropOptions & PropertyDecorator; + array: PropOptions & PropertyDecorator; + boolean: PropOptions & PropertyDecorator; + number: PropOptions & PropertyDecorator; + object: PropOptions & PropertyDecorator; + string: PropOptions & PropertyDecorator; +}>; + +export const prop: (ops?: PropOptions) => PropertyDecorator & PropOptions; + +export const shadow: (elem: CustomElement | HTMLElement) => ShadowRoot; + +export const name: (componentName?: string) => string; + +// Mixins +export function withComponent = Constructor>( + Base?: T +): typeof WithComponent; + +export function withComponent< + P = Mixed, + S = Mixed, + C = void, + T extends Constructor = Constructor +>(Base?: T): Constructor> & T; +export function withUpdate

= Constructor>( + Base?: T +): Constructor> & T; +export function withRenderer = Constructor>( + Base?: T +): Constructor> & T; +export function withContext = Constructor>( + Base?: T +): Constructor> & T; +export function withLifecycle = Constructor>( + Base?: T +): Constructor & T; +export function withChildren = Constructor>( + Base?: T +): Constructor & T; diff --git a/types/skatejs/index.d.ts b/types/skatejs/index.d.ts new file mode 100644 index 0000000000..71066da4b5 --- /dev/null +++ b/types/skatejs/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for skatejs 5.0 +// Project: https://github.com/skatejs/skatejs +// Definitions by: Martin Hochel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export as namespace skate; + +// Public API: mixins +export { withComponent, withLifecycle, withContext, withChildren, withUpdate, withRenderer } from './api'; + +// Public API: utils +export { prop, props, link, define, emit, shadow, name } from './api'; + +// Public types ( Unfortunately TS doesn't have Opaque Types like Flow ) +export { + Constructor, + CustomElement, + ComponentProps, + PropOptions, + Renderer, + WithComponent, + WithLifecycle, + WithContext, + WithChildren, + WithUpdate, + WithRenderer +} from './types'; diff --git a/types/skatejs/test/components/custom-base.ts b/types/skatejs/test/components/custom-base.ts new file mode 100644 index 0000000000..36b8a55813 --- /dev/null +++ b/types/skatejs/test/components/custom-base.ts @@ -0,0 +1,4 @@ +import { withComponent, WithComponent } from 'skatejs'; + +export const ButtonComponent = withComponent(HTMLButtonElement); +export const InputComponent = withComponent(HTMLInputElement); diff --git a/types/skatejs/test/components/no-shadow-root.ts b/types/skatejs/test/components/no-shadow-root.ts new file mode 100644 index 0000000000..5b7cee16e5 --- /dev/null +++ b/types/skatejs/test/components/no-shadow-root.ts @@ -0,0 +1,116 @@ +import { + define, + Renderer, + WithRenderer, + WithUpdate, + withComponent, + withRenderer, + withChildren, + withUpdate, + WithComponent, + Constructor, + CustomElement +} from 'skatejs'; + +// custom class definition needed to get Generics support for custom mixin composition +interface CustomComponentBase

extends WithUpdate, WithRenderer {} +declare class CustomComponentBase

extends HTMLElement {} + +// Explicitly defined renderer mixin interface type +export interface CustomRenderer extends HTMLElement, Renderer { + renderer(shadowRoot: HTMLElement, render: () => string): void; +} + +export const withCustomRendererAsString = ( + Base = HTMLElement +) => { + class CustomRendererAsString extends Base implements Renderer { + renderer(shadowRoot: HTMLElement, render: () => string): void { + // erease content && re-render + shadowRoot.innerHTML = render(); + } + } + return CustomRendererAsString; +}; + +const customWithComponent = (Base = HTMLElement): typeof WithComponent => + withChildren(withUpdate(withRenderer(Base))) as any; + +const MComponent = customWithComponent(withCustomRendererAsString()); +const MComponent2 = withChildren(withUpdate(withRenderer(withCustomRendererAsString()))); +const MComponent3 = withRenderer(withUpdate(withCustomRendererAsString())) as typeof CustomComponentBase; + +export const Component = withComponent(withCustomRendererAsString()); +// @TODO this doesn't work :( I though this will extend base def and will restrict renderCallback return type +// interface Component

{ +// renderCallback(props?: P): string; +// } + +// tslint:disable-next-line interface-over-type-literal +export type Props = { greet: string }; +// tslint:disable-next-line interface-over-type-literal +export type State = { count: number }; + +class Mo extends MComponent { + foo() { + this.props.greet; + this.state.count; + } +} + +class Mo2 extends MComponent2 { + props: Props; + foo() { + this.props.greet; + } +} + +class Mo3 extends MComponent3 { + foo() { + this.props.greet; + this.state.count; + + // Following will error out, thanks TS ! immutable all the things + // this.props = {greet:'Martin'} + // this.props.greet = Martin' + + // update state + this.state = { count: this.state.count + 1 }; + + // Following will error out, thanks TS ! nope prop is not defined on state ;) + // this.state = {count: this.state.count+1, nope: false} + } +} + +export class Shadowless

extends Component { + get renderRoot() { + return this; + } +} +export class MyComponent extends Component { + static readonly is = 'my-cmp'; + get renderRoot() { + return this; + } + render() { + return ` +

+

Hello World

+
+ `; + } +} +define(MyComponent); + +export class NoShadowCmp extends Shadowless { + static readonly is = 'my-noshadow-cmp'; + render() { + return ` +
+

Hello World ${this.props.greet}

+
how much is the fish? ${this.state.count}
+
+ `; + } +} +define(NoShadowCmp); diff --git a/types/skatejs/test/components/props-set-get.ts b/types/skatejs/test/components/props-set-get.ts new file mode 100644 index 0000000000..bf478d37ef --- /dev/null +++ b/types/skatejs/test/components/props-set-get.ts @@ -0,0 +1,58 @@ +import { withComponent, props, define, PropOptions, WithComponent } from 'skatejs'; + +export const Component = withComponent(); + +// tslint:disable-next-line interface-over-type-literal +export type Props = { + myArray: string[]; + myBoolean: boolean; +}; +// tslint:disable-next-line interface-over-type-literal +export type State = Props; + +export class MyComponent extends Component { + static readonly is = 'my-cmp'; + static readonly props = { + myArray: props.array, + myBoolean: props.boolean + }; + myBoolean = false; + myArray: string[] = []; + private someNonPublicApiProp = 'Who are you?'; + + private readonly button = document.createElement('button'); + + render() { + this.button.textContent = 'Hello World'; + return this.appendChild(this.button); + } + connected() { + this.button.addEventListener('click', this._changeState); + } + disconnected() { + this.button.removeEventListener('click', this._changeState); + } + + private readonly _changeState = (event: MouseEvent) => { + // as Props casting is needed as there is absolutely no way how to differently create + // type definitions for setter and getter + // tslint:disable-next-line no-object-literal-type-assertion + this.state = { myBoolean: true } as State; + // or just directly + this.myBoolean = true; + + console.log(this.props); // { myArray: [], myBoolean: true } + + // tslint:disable-next-line no-object-literal-type-assertion + this.state = { myArray: ['hello'] } as State; + // or just directly + this.myArray = ['hello']; + + console.log(this.props); // { myArray: ['hello'], myBoolean: true } + + // this will not trigger re-render + this.someNonPublicApiProp = 'Im David'; + } +} + +export default define(MyComponent); diff --git a/types/skatejs/test/components/with-custom-base.ts b/types/skatejs/test/components/with-custom-base.ts new file mode 100644 index 0000000000..f4c89afb4a --- /dev/null +++ b/types/skatejs/test/components/with-custom-base.ts @@ -0,0 +1,43 @@ +import { define } from 'skatejs'; + +import { ButtonComponent, InputComponent } from './custom-base'; + +// tslint:disable-next-line interface-over-type-literal +export type ButtonProps = { + raised?: boolean; +}; + +export class MaterialButton extends ButtonComponent { + static readonly props = { + raised: '' + }; + + type?: string; + foo() { + this.props.raised; + + console.log( + // we have to explicitly define HTMLBUttonProps as TS doesn't support Generic mixins ye https://github.com/Microsoft/TypeScript/pull/13743#issuecomment-277716812t + this.type + ); + } + // now our MaterialButton has all