diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts index ba5e0fb9f..88d68cb19 100644 --- a/arcgis-js-api/arcgis-js-api.d.ts +++ b/arcgis-js-api/arcgis-js-api.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript v3.14 +// Type definitions for ArcGIS API for JavaScript v3.15 // Project: http://js.arcgis.com // Definitions by: Esri // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -146,7 +146,7 @@ declare module "esri" { /** Class attribute to set for the layer's node. */ className?: string; /** Lists which levels to draw. */ - displayLevels?: number; + displayLevels?: number[]; /** An array of objects that define areas where a tiled map service should not display tiles. */ exclusionAreas?: any[]; /** Id to assign to the layer. */ @@ -157,7 +157,7 @@ declare module "esri" { opacity?: number; /** Refresh interval of the layer in minutes. */ refreshInterval?: number; - /** When true, tile resampling is enabled. */ + /** The purpose of resampling is to enlarge the image and fill in at the levels where there are no tiles available. */ resampling?: boolean; /** Number of levels beyond the last level where tiles are available. */ resamplingTolerance?: number; @@ -215,6 +215,8 @@ declare module "esri" { opacity?: number; /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ subDomains?: string[]; + /** The URL template used to retrieve the tiles. */ + templateUrl?: string; /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ tileInfo?: TileInfo; /** Define additional tile server domains for the layer. */ @@ -307,19 +309,15 @@ declare module "esri" { export interface ClassedColorSliderOptions { /** Data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; /** Handle identified by its index value within the stops array. */ primaryHandle?: number; @@ -333,61 +331,51 @@ declare module "esri" { showLabels?: boolean; /** Displays ticks on slider when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; } export interface ClassedSizeSliderOptions { - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of slider ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; - /** Displays the histogram when true. */ + /** Indicates whether to display the histogram. */ showHistogram?: boolean; /** Displays labels when true. */ showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics?: any; - /** Indicates whether to use a circle or line-based ClassedSizeSlider. */ - symbol?: any; } export interface ColorInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ colorInfo: any; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization Type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of widget ramp in pixels. */ rampWidth?: number; @@ -397,13 +385,15 @@ declare module "esri" { showHistogram?: boolean; /** Displays labels when set to true. */ showLabels?: boolean; - /** Displays ticks when set to true. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels?: boolean | string; + /** Displays tick marks when set to true. */ showTicks?: boolean; /** Displays transparent background when set to true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Object containing additional options. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface ColorPickerOptions { @@ -655,8 +645,6 @@ declare module "esri" { traffic?: boolean; /** The traffic layer used for real-time traffic. */ trafficLayer?: ArcGISDynamicMapServiceLayer; - /** An example of when to use this is when working with a proxied ArcGIS Online route service item with stored credentials. */ - travelModesServiceUrl?: string; } export interface DissolveBoundariesOptions { /** The URL to the GPServer used to execute an analysis job. */ @@ -718,7 +706,7 @@ declare module "esri" { /** Specifies whether users can add new vertices. */ allowAddVertices?: boolean; /** Specifies whether users can delete vertices. */ - allowDeletevertices?: boolean; + allowDeleteVertices?: boolean; /** Line symbol used to draw the guild lines, displayed when moving vertices. */ ghostLineSymbol?: LineSymbol; /** Marker symbol used to display the insertable vertices. */ @@ -859,8 +847,14 @@ declare module "esri" { cellNavigation?: boolean; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions?: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick?: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection?: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; + /** Reference to the 'Options' drop-down menu. */ + gridMenu?: any; /** Columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields?: string[]; /** A reference to the Map. */ @@ -1173,8 +1167,12 @@ declare module "esri" { map: Map; /** Indicates whether to remove underscores from the layer title. */ removeUnderscores?: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend?: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider?: boolean; /** Indicates whether to show sublayers in the list of layers. */ - subLayers?: boolean; + showSubLayers?: boolean; /** The CSS class selector used to uniquely style the widget. */ theme?: string; /** Indicates whether to show the LayerList widget. */ @@ -1455,19 +1453,19 @@ declare module "esri" { export interface OpacitySliderOptions { /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ opacityInfo: any; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1479,9 +1477,9 @@ declare module "esri" { showTicks?: boolean; /** Displays the transparent background when true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Additional options for slider customization. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface OpenStreetMapLayerOptions { @@ -1699,7 +1697,7 @@ declare module "esri" { minimum: number; /** Bottom label for the slider. */ minLabel?: string; - /** **CHECK THIS: Is it num of dec places? - Accuracy of the data (related to rounding). */ + /** Accuracy of the data (related to rounding). */ precision?: number; /** Primary handle identified by its index value within the related infos array (color, size, break). */ primaryHandle?: number; @@ -1737,9 +1735,11 @@ declare module "esri" { activeSourceIndex?: number | string; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap?: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder?: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate?: boolean; - /** Indicates whether to automatically select the first result. */ + /** Indicates whether to automatically select the first geocoded result (not the first suggestion). */ autoSelect?: boolean; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode?: boolean; @@ -1749,6 +1749,8 @@ declare module "esri" { enableInfoWindow?: boolean; /** Indicates whether to enable showing a label for the geometry.The default value is false. */ enableLabel?: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll?: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu?: boolean; /** Indicates whether or not to enable suggest on the widget. */ @@ -1765,7 +1767,7 @@ declare module "esri" { infoTemplate?: InfoTemplate; /** The text symbol for the label graphic. */ labelSymbol?: TextSymbol; - /** The default distance specified in meters used to reverse geocode, (if not specified by source).The default value is 1500. */ + /** The default distance specified in meters used to reverse geocode, (if not specified by source). */ locationToAddressDistance?: number; /** Reference to the map. */ map?: Map; @@ -1791,23 +1793,19 @@ declare module "esri" { zoomScale?: number; } export interface SizeInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1817,11 +1815,11 @@ declare module "esri" { showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Data map containing renderer information. */ + /** Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; - /** The symbol used with the widget. */ + /** The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ symbol: Symbol; /** Additional options to customize slider. */ zoomOptions?: any; @@ -1969,10 +1967,12 @@ declare module "esri" { sumWithinLayer: FeatureLayer; } export interface SymbolStylerOptions { + /** Added at v. */ + portal?: string | any; /** Self response of Portal used as symbol provider. */ - portalSelf: string; + portalSelf?: any; /** URL to Portal used as symbol provider. */ - portalUrl: string; + portalUrl?: string; } export interface TemplatePickerOptions { /** Number of visible columns. */ @@ -2062,6 +2062,18 @@ declare module "esri" { /** A predefined style. */ style?: string; } + export interface VectorTileLayerOptions { + /** Lists which levels of the layer to draw. */ + displayLevels?: number[]; + /** Maximum visible scale for the layer. */ + maxScale?: number; + /** Minimum visible scale for the layer. */ + minScale?: number; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Visibility of the layer. */ + visible?: boolean; + } export interface VisibleScaleRangeSliderOptions { /** Layer used to determine the suggested scale range and set the minScale, maxScale values. */ layer: FeatureLayer; @@ -2275,7 +2287,7 @@ declare module "esri/IdentityManager" { /** Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. */ dialog: any; /** - * When accessing secure resources via Oauth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. + * When accessing secure resources via OAuth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. * @param handlerFunction When called, the function passed to setOAuthRedirectionHandler receives an object containing the redirection properties. */ setOAuthRedirectionHandler(handlerFunction: Function): void; @@ -2391,7 +2403,7 @@ declare module "esri/IdentityManagerBase" { /** Return properties of this object in JSON. */ toJson(): any; /** Fired when a credential is created. */ - on(type: "credential-create", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + on(type: "credential-create", listener: (event: { credential: Credential; target: IdentityManagerBase }) => void): esri.Handle; /** Fired when all credentials are destroyed. */ on(type: "credentials-destroy", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -2675,7 +2687,7 @@ declare module "esri/arcgis/OAuthInfo" { minTimeUntilExpiration: number; /** Set to true to show the OAuth sign in page in a popup window. */ popup: boolean; - /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + /** Applicable if working with the popup user-login workflow. */ popupCallbackUrl: string; /** The window features passed to window.open(). */ popupWindowFeatures: string; @@ -2886,7 +2898,7 @@ declare module "esri/arcgis/Portal" { /** The date the group was last modified. */ modified: Date; /** The username of the group's owner. */ - owner: Portal; + owner: string; /** The portal for the group. */ portal: Portal; /** A short summary that describes the group. */ @@ -3062,7 +3074,7 @@ declare module "esri/arcgis/Portal" { * Retrieve all the items in the specified folder. * @param folderId The id of the folder that contains the items to retrieve. */ - getItems(folderId: string): any; + getItems(folderId?: string): any; /** Get information about any notifications for the portal user. */ getNotifications(): any; /** Access the tag objects that have been created by the portal user. */ @@ -3087,6 +3099,11 @@ declare module "esri/arcgis/utils" { * @param itemId The itemId for a publicly shared ArcGIS.com item. */ getItem(itemId: string): any; + /** + * Can be used with LayerList widget to get the layers list to be passed into the constructor. + * @param createMapResponse The object created from the resolved promise returned by createMap(). + */ + getLayerList(createMapResponse: any): any[]; /** * Can be used with esri.dijit.Legend to get the layerInfos list to be passed into the Legend constructor. * @param createMapResponse Object returned by .createMap() in the .then() callback. @@ -3422,37 +3439,35 @@ declare module "esri/dijit/ClassedColorSlider" { /** A widget to assist with managing a renderer used for visualizing features by their class and color. */ class ClassedColorSlider extends RendererSlider { - /** Required */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ + /** Optional: The width of the histogram in pixels. */ histogramWidth: boolean; - /** Optional */ + /** Read Only. */ maxValue: number; - /** Optional */ + /** Read Only. */ minValue: number; - /** Optional */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ - showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedColorSlider widget. @@ -3464,7 +3479,7 @@ declare module "esri/dijit/ClassedColorSlider" { startup(): void; /** Fires when the ClassedColorSlider widget properties change. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ClassedColorSlider changes. */ + /** Fires when minValue or maxValue of the ClassedColorSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle; /** Fires when a ClassedColorSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; @@ -3479,35 +3494,35 @@ declare module "esri/dijit/ClassedSizeSlider" { /** A widget to assist with managing a renderer for visualizing features by varying classes and size. */ class ClassedSizeSlider extends RendererSlider { - /** Required. */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Read Only. */ maxValue: number; - /** Optional. */ + /** Read Only. */ minValue: number; - /** Optional. */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: Handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. @@ -3517,7 +3532,7 @@ declare module "esri/dijit/ClassedSizeSlider" { constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node | string); /** Fires when ClassedSizeSlider changes. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue changes in ClassedSizeSlider. */ + /** Fires when minValue or maxValue of the ClassedSizeSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle; /** Fires when a ClassedSizeSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; @@ -3532,39 +3547,41 @@ declare module "esri/dijit/ColorInfoSlider" { /** A widget to assist with managing a renderer for visualizing features based upon colors. */ class ColorInfoSlider extends RendererSlider { - /** Optional */ + /** The classification method used for the ColorInfoSlider. */ classificationMethod: string; - /** Required: Example colorInfo: colorRenderer.renderer.visualVariables[0]. */ + /** Required: The data map containing renderer information. */ colorInfo: any; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ - histogramWidth: boolean; - /** Optional */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; /** Optional */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display handles. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels: boolean | string; + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display a transparent background. */ showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. @@ -3576,10 +3593,12 @@ declare module "esri/dijit/ColorInfoSlider" { startup(): void; /** Fires when ColorInfoSlider changes. */ on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ColorInfoSlider changes. */ + /** Fires when minValue or maxValue of the ColorInfoSlider changes. */ on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle; /** Fires when a ColorInfoSlider handle is moved. */ - on(type: "handle-value-change", listener: (event: { target: ColorInfoSlider }) => void): esri.Handle; + on(type: "handle-value-change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: ColorInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = ColorInfoSlider; @@ -3765,6 +3784,8 @@ declare module "esri/dijit/ElevationProfile" { measureUnits: string; /** The polyline input geometry used to create the elevation profile. */ profileGeometry: Geometry; + /** The title of the resulting elevation profile. */ + title: string; /** * Create a new ElevationProfile widget using the given DOM node. * @param options See options table below for the full descriptions of the properties needed for this object. @@ -3781,6 +3802,8 @@ declare module "esri/dijit/ElevationProfile" { on(type: "clear-profile", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the widget has fully loaded. */ on(type: "load", listener: (event: { target: ElevationProfile }) => void): esri.Handle; + /** Fires when the title of the elevation profile is changed */ + on(type: "title-changed", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the elevation profile is updated. */ on(type: "update-profile", listener: (event: { profileResults: any; target: ElevationProfile }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -3793,7 +3816,7 @@ declare module "esri/dijit/FeatureTable" { import FeatureLayer = require("esri/layers/FeatureLayer"); import Map = require("esri/map"); - /** (Currently in beta) Creates an instance of the FeatureTable widget within the provided DOM node. */ + /** Creates an instance of the FeatureTable widget within the provided DOM node. */ class FeatureTable { /** An optional dGrid property. */ allowSelectAll: boolean; @@ -3805,10 +3828,16 @@ declare module "esri/dijit/FeatureTable" { dataStore: any; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; /** Reference to the dGrid. */ grid: any; + /** Reference to the 'Options' drop-down menu. */ + gridMenu: any; /** Optional columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields: string[]; /** A reference to the primary key used by the dataStore to differentiate columns. */ @@ -4004,15 +4033,15 @@ declare module "esri/dijit/HeatmapSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); - /** A widget to assist in managing properties of a HeatmapRenderer. */ + /** A widget to assist in obtaining values for managing and setting properties on a HeatmapRenderer. */ class HeatmapSlider extends RendererSlider { /** Required. */ colorStops: any; /** Required. */ handles: number[]; - /** Optional. */ + /** Optional, absolute maximum value of the slider.NOTE: This value overrides statistics' max property. */ maxValue: number; - /** Optional. */ + /** Optional, absolute minimum value of the slider.NOTE: This value overrides statistics' min property. */ minValue: number; /** Optional */ rampWidth: number; @@ -4127,6 +4156,7 @@ declare module "esri/dijit/ImageServiceMeasure" { import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol"); import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import ImageServiceMeasureTool = require("esri/toolbars/ImageServiceMeasureTool"); /** This widget allows you to perform measurements on image services. */ class ImageServiceMeasure { @@ -4136,6 +4166,8 @@ declare module "esri/dijit/ImageServiceMeasure" { lineSymbol: SimpleLineSymbol; /** Symbol to be used when drawing a point. */ markerSymbol: SimpleMarkerSymbol; + /** The instance of ImageServiceMeasureTool associated with this widget. */ + measureToolbar: ImageServiceMeasureTool; /** * Creates an instance of the ImageServiceMeasure widget. * @param params An Object containing constructor options. @@ -4294,8 +4326,12 @@ declare module "esri/dijit/LayerList" { map: Map; /** Indicates whether to remove underscores from the layer title */ removeUnderscores: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider: boolean; /** Indicates whether to show sublayers in the list of layers. */ - sublayers: boolean; + showSubLayers: boolean; /** CSS Class for uniquely styling the widget. */ theme: string; /** Indicates whether to show the widget. */ @@ -4314,7 +4350,7 @@ declare module "esri/dijit/LayerList" { startup(): void; /** Fired when the LayerList widget has fully loaded. */ on(type: "load", listener: (event: { target: LayerList }) => void): esri.Handle; - /** Fired when refresh is called on the LabelList widget. */ + /** Fired when refresh() is called on the widget. */ on(type: "refresh", listener: (event: { target: LayerList }) => void): esri.Handle; /** Fired when the layer is toggled on/off within the widget. */ on(type: "toggle", listener: (event: { layerIndex: number; subLayerIndex: number; visible: boolean; target: LayerList }) => void): esri.Handle; @@ -4622,33 +4658,35 @@ declare module "esri/dijit/OpacitySlider" { /** A widget to assist with managing opacity with a renderer. */ class OpacitySlider extends RendererSlider { - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional: */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Required. */ + /** Required: The data map containing renderer information. */ opacityInfo: any; - /** Optional */ + /** Optional: The handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display slider tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display the transparent background. */ showTransparentBackground: boolean; - /** Optional. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional. */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. @@ -4658,10 +4696,12 @@ declare module "esri/dijit/OpacitySlider" { constructor(params: esri.OpacitySliderOptions, srcNodeRef: Node | string); /** Fires when OpacitySlider changes. */ on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of OpacitySlider changes. */ + /** Fires when minValue or maxValue of the OpacitySlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; /** Fires when an OpacitySlider handle is moved. */ on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: OpacitySlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = OpacitySlider; @@ -4985,7 +5025,7 @@ declare module "esri/dijit/RendererSlider" { showLabels: boolean | string[]; /** Toggle for showing the horizontal line indicators from the center of the handle. */ showTicks: boolean; - /** Handle positions represented as numbers that fall between minimum and maximum. */ + /** Required: Handle positions represented as numbers that fall between minimum and maximum. */ values: number[]; /** * Creates a new RendererSlider widget. @@ -5044,10 +5084,14 @@ declare module "esri/dijit/Search" { activeSourceIndex: number; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate: boolean; - /** Indicates whether to automatically select and zoom to the first geocoded result. */ + /** Indicates whether to automatically select the first geocoded result. */ autoSelect: boolean; + /** (Read-only), the default source used for the Search widget. */ + defaultSource: any; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode: boolean; /** Show the selected feature on the map using a default symbol determined by the source's geometry type. */ @@ -5056,6 +5100,8 @@ declare module "esri/dijit/Search" { enableInfoWindow: boolean; /** Indicates whether to enable showing a label for the geometry. */ enableLabel: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu: boolean; /** Enable suggestions for the widget. */ @@ -5150,8 +5196,8 @@ declare module "esri/dijit/Search" { /** Finalizes the creation of the Search widget. */ startup(): void; /** - * Performs a suggest() request on the active Locator. - * @param value The string value used to suggest() on an active Locator. + * Performs a suggest() request on the active Locator or feature layer. + * @param value The string value used to suggest() on an active locator or feature layer. */ suggest(value?: string): any; /** Fired when the widget's text input loses focus. */ @@ -5176,39 +5222,44 @@ declare module "esri/dijit/Search" { declare module "esri/dijit/SizeInfoSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + /** A widget to assist with managing size with a renderer. */ class SizeInfoSlider extends RendererSlider { - /** Optional. */ + /** Optional, the classification method used for the SizeInfoSlider. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of the histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Optional. */ + /** Optional, indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display the slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display the slider tick marks. */ showTicks: boolean; - /** Required. */ + /** Required: Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; - /** Optional. */ + /** Required: The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ + symbol: SimpleMarkerSymbol | SimpleLineSymbol; + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new SizeInfoSlider widget. @@ -5220,10 +5271,12 @@ declare module "esri/dijit/SizeInfoSlider" { startup(): void; /** Fires when the SizeInfoSlider properties change. */ on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of SizeInfoSlider change. */ + /** Fires when minValue or maxValue of the SizeInfoSlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; /** Fires when a SizeInfoSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: SizeInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = SizeInfoSlider; @@ -6730,7 +6783,7 @@ declare module "esri/dijit/geoenrichment/DataBrowser" { export = DataBrowser; } -declare module "esri/dijit/geoenrichment/InfoGraphic" { +declare module "esri/dijit/geoenrichment/Infographic" { import esri = require("esri"); import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); import RingBuffer = require("esri/tasks/geoenrichment/RingBuffer"); @@ -7451,13 +7504,13 @@ declare module "esri/geometry/geometryEngine" { import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); - /** (Currently in beta) A client-side geometry engine. */ + /** A client-side geometry engine. */ var geometryEngine: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; @@ -7495,7 +7548,7 @@ declare module "esri/geometry/geometryEngine" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Unit for the maximum segment length. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; /** @@ -7514,7 +7567,7 @@ declare module "esri/geometry/geometryEngine" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): number; /** @@ -7545,27 +7598,34 @@ declare module "esri/geometry/geometryEngine" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit A unit for maximum deviation. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): Geometry; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): number; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; + /** + * Returns a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): Geometry; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): number; /** @@ -7609,7 +7669,7 @@ declare module "esri/geometry/geometryEngine" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7624,13 +7684,13 @@ declare module "esri/geometry/geometryEngine" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): number; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): number; /** @@ -7685,14 +7745,15 @@ declare module "esri/geometry/geometryEngineAsync" { import Polyline = require("esri/geometry/Polyline"); import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); + import Polygon = require("esri/geometry/Polygon"); - /** (Currently in beta) A client-side asynchronous geometry engine. */ + /** A client-side asynchronous geometry engine. */ var geometryEngineAsync: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; @@ -7730,7 +7791,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Defaults to the units of the input geometries. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): any; /** @@ -7749,7 +7810,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): any; /** @@ -7780,27 +7841,34 @@ declare module "esri/geometry/geometryEngineAsync" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit Defaults to the units of the input geometries. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): any; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): any; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; + /** + * Resolves to a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): any; /** @@ -7844,7 +7912,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7859,13 +7927,13 @@ declare module "esri/geometry/geometryEngineAsync" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): any; /** @@ -9219,7 +9287,7 @@ declare module "esri/layers/FeatureLayer" { */ setAutoGeneralize(enable: boolean): FeatureLayer; /** - * Set's the definition expression for the FeatureLayer. + * Sets the definition expression for the FeatureLayer. * @param expression The definition expression to apply. */ setDefinitionExpression(expression: string): FeatureLayer; @@ -9275,7 +9343,7 @@ declare module "esri/layers/FeatureLayer" { */ setScaleRange(minScale: number, maxScale: number): void; /** - * Set's the selection symbol for the feature layer. + * Sets the selection symbol for the feature layer. * @param symbol Symbol for the current selection. */ setSelectionSymbol(symbol: Symbol): FeatureLayer; @@ -9285,7 +9353,7 @@ declare module "esri/layers/FeatureLayer" { */ setShowLabels(showLabels: boolean): void; /** - * Set's the time definition for the feature layer. + * Sets the time definition for the feature layer. * @param definition The new time extent used to filter the layer. */ setTimeDefinition(definition: TimeExtent): FeatureLayer; @@ -9458,6 +9526,8 @@ declare module "esri/layers/GeoRSSLayer" { items: Graphic[]; /** The name of the layer. */ name: string; + /** The publicly accessible URL to a GeoRSS file. */ + url: string; /** * Creates a new GeoRSSLayer object. * @param url URL to the GeoRSS resource. @@ -9805,10 +9875,14 @@ declare module "esri/layers/LOD" { declare module "esri/layers/LabelClass" { import TextSymbol = require("esri/symbols/TextSymbol"); - /** LabelClass defines the styles of labels for ArcGISDynamicMapServiceLayer. */ + /** Use label classes to restrict labels to certain features or to specify different label fields, symbols, scale ranges, label priorities, and sets of label placement options for different groups of labels. */ class LabelClass { + /** An array of objects representing field information to label. */ + fieldInfos: any[]; /** Adjusts the formatting of labels. */ labelExpression: string; + /** Use this when working with FeatureLayer layer types. */ + labelExpressionInfo: any; /** The position of the label. */ labelPlacement: string; /** The maximum scale to show labels. */ @@ -9824,7 +9898,7 @@ declare module "esri/layers/LabelClass" { /** A where clause determining which features are labeled. */ where: string; /** - * Create a LabelClass, in order to be added to layerDrawingOption.labelingInfo. + * Creates a label class, used for formatting parameters, symbols, date, etc. * @param json Various options to configure this LabelClass. */ constructor(json?: Object); @@ -9840,7 +9914,7 @@ declare module "esri/layers/LabelLayer" { import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer"); - /** The LabelLayer inherits from the graphics layer and can be used to display texts and symbols on map. */ + /** NOTE: Deprecated as of version 3.14, read below for additional information on the suggested method of labeling. */ class LabelLayer extends GraphicsLayer { /** * Creates a new Label layer. @@ -10248,6 +10322,8 @@ declare module "esri/layers/RasterLayer" { /** The RasterLayer is used to display image services. */ class RasterLayer extends Layer { + /** A function that takes a pixelData object as input, processes it, and returns it. */ + pixelFilter: Function; /** * Creates a new RasterLayer object. * @param url URL to the ArcGIS Server REST resource that represents a raster layer service. @@ -10262,6 +10338,11 @@ declare module "esri/layers/RasterLayer" { * @param doNotRefresh Use true to avoid refreshing the layer; false to refresh it. */ setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Sets a pixelFilter on the layer. + * @param pixelFilter The function defining the PixelFilter to set on the layer. + */ + setPixelFilter(pixelFilter: Function): void; /** * Determines if the layer will update its content based on the map's current time extent. * @param use Use true to update the layer's content based on the map's current time extent. @@ -10495,16 +10576,55 @@ declare module "esri/layers/TimeInfo" { } declare module "esri/layers/TimeReference" { - /** TimeReference contains information about how the time was measured. */ + /** TimeReference contains read-only information about how the time was captured when the data was created. */ class TimeReference { - /** Indicates whether the time reference respects daylight savings time. */ + /** A read-only property that indicates whether the time reference takes into account daylight savings time. */ respectsDaylightSaving: boolean; - /** The time zone information associated with the time reference. */ + /** The time zone in which the data was captured. */ timeZone: string; } export = TimeReference; } +declare module "esri/layers/VectorTileLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** A VectorTileLayer accesses cached tiles of data and renders it in vector format. */ + class VectorTileLayer extends Layer { + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The spatial reference of the layer. */ + spatialReference: SpatialReference; + /** The style object of the service with fully qualified URLs for glyphs and sprite. */ + style: any; + /** Contains information about the tiling scheme for the layer. */ + tileInfo: TileInfo; + /** The URL to the vector tile service or style JSON that will be used to draw the layer. */ + url: string; + /** + * Create a new VectorTileLayer object. + * @param url The URL to the vector tile service or style JSON that will be used to draw the layer. + * @param options Optional parameters. + */ + constructor(url: string | any, options?: esri.VectorTileLayerOptions); + /** + * Changes the style properties used to render the layers. + * @param styleUrl A url to a JSON file containing the stylesheet information to render the layer. + */ + setStyle(styleUrl: string | any): void; + /** Fires when the style is changed on the layer. */ + on(type: "style-change", listener: (event: { style: any; target: VectorTileLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VectorTileLayer; +} + declare module "esri/layers/WFSLayer" { import esri = require("esri"); import Field = require("esri/layers/Field"); @@ -10513,7 +10633,7 @@ declare module "esri/layers/WFSLayer" { import InfoTemplate = require("esri/InfoTemplate"); import Renderer = require("esri/renderers/Renderer"); - /** (Currently in beta)A layer for OGC Web Feature Services (WFS). */ + /** (Currently in beta) A layer for OGC Web Feature Services (WFS). */ class WFSLayer { /** An array of fields in the layer. */ fields: Field[]; @@ -11262,6 +11382,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { id: string; /** Read-only: Indicates if the last query failed and the data source is in a broken state. */ isBroken: boolean; + /** Read-only: The mapWidgetId of the data source. */ + mapWidgetId: string; /** Read-only: The name of the data source. */ name: string; /** Read-only: The name of the object id field. */ @@ -11279,6 +11401,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { * @param query The query object to apply. */ executeQuery(query: Query): any; + /** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */ + getAdvancedQueryCapabilities(): any; /** Retrieve the associated data source that supports selection. */ getAssociatedSelectionDataSourceProxy(): any; /** Get the associated popupInfo for the data source if any available. */ @@ -11334,8 +11458,8 @@ declare module "esri/opsdashboard/ExtensionBase" { static POLYLINE: any; /** Read-only: Indicates if the host application is the Windows Operations Dashboard. */ isNative: boolean; - /** Get the collection of data sources from the host application. */ - getDataSourceProxies(): any; + /** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */ + portalUrl: string; /** Get the collection of data sources from the host application. */ getDataSourceProxies(): any; /** Get the data source corresponding to the data source id from the host application. */ @@ -11386,6 +11510,8 @@ declare module "esri/opsdashboard/ExtensionConfigurationBase" { /** ExtensionConfigurationBase is a base class used by all the extension configuration proxies. */ class ExtensionConfigurationBase extends ExtensionBase { + /** The object that will store the Widget/MapTool/FeatureAction configuration. */ + config: any; /** Indicates that the configuration is ready to be persisted or not. */ readyToPersistConfig: boolean; } @@ -11467,10 +11593,10 @@ declare module "esri/opsdashboard/GraphicsLayerProxy" { */ addOrUpdateGraphic(graphic: Graphic): void; /** - * Update a graphic in the host graphics layer with a new version. - * @param graphic The graphic to update in the host graphics layer. + * Update graphics in the host graphics layer with a new version. + * @param graphics The graphics to update in the host graphics layer. */ - addOrUpdateGraphics(graphic: Graphic): void; + addOrUpdateGraphics(graphics: Graphic[]): void; /** Removes all the graphics from the host graphics layer. */ clear(): void; /** @@ -11625,8 +11751,6 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { /** WidgetConfigurationProxy is a class used to provide the configuration user experience for an operations dashboard extension widget. */ class WidgetConfigurationProxy extends ExtensionConfigurationBase { - /** The object that will store the widget configuration. */ - config: any; /** * Called by the host application when the user has changed the selected data source in the data source selector. * @param dataSourceProxy The selected data source. @@ -11639,7 +11763,7 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { */ getDataSourceConfig(dataSourceProxyOrDataSourceId: DataSourceProxy | string): any; /** - * Called by the host application when the user has changed the slected map widget in the map widget selector. + * Called by the host application when the user has changed the selected map widget in the map widget selector. * @param mapWidgetProxy The selected map widget. */ mapWidgetSelectionChanged(mapWidgetProxy: MapWidgetProxy): void; @@ -11897,7 +12021,7 @@ declare module "esri/renderers/BlendRenderer" { import esri = require("esri"); import Symbol = require("esri/symbols/Symbol"); - /** (Currently in beta) BlendRenderer allows you to easily identify a predominant attribute among two or more competing attributes in a feature. */ + /** (Currently in beta) BlendRenderer allows you to easily identify the predominant attribute among two or more competing attributes of a feature and visualizes the strength of that predominance using blended colors. */ class BlendRenderer { /** This determines how colors are blended together. */ blendMode: string; @@ -12129,7 +12253,7 @@ declare module "esri/renderers/Renderer" { import Color = require("esri/Color"); import Symbol = require("esri/symbols/Symbol"); - /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, and TemporalRenderer used with a GraphicsLayer and FeatureLayer. */ + /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, TemporalRenderer, HeatmapRenderer, and VectorFieldRenderer used with a GraphicsLayer and FeatureLayer. */ class Renderer { /** An object defining a color ramp used to render the layer. */ colorInfo: any; @@ -12188,11 +12312,14 @@ declare module "esri/renderers/Renderer" { * @param info An object with the same properties as rotationInfo. */ setRotationInfo(info: any): Renderer; - /** Set size info of the renderer to modify the symbol size based on data value. */ - setSizeInfo(): Renderer; + /** + * Set size info of the renderer to modify the symbol size based on data value. + * @param info An object with the same properties as sizeInfo. + */ + setSizeInfo(info: any): Renderer; /** * Sets the renderer with the specified visualVariables. - * @param visualParams The specified visualVariables. + * @param visualParams The specified visualVariables. */ setVisualVariables(visualParams: any[]): void; /** Converts object to its ArcGIS Server JSON representation. */ @@ -12503,6 +12630,11 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createClassedSizeRenderer(params: any): any; + /** + * Creates an object defining a color ramp used to render a layer. + * @param params See the object specifications table below for the structure of the params object. + */ + createColorInfo(params: any): any; /** * Creates a renderer for visualizing features using colors. * @param params See the object specifications table below for the structure of the params object. @@ -12518,6 +12650,16 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createOpacityInfo(params: any): any; + /** + * Creates a renderer for identifying features by their color. + * @param params See the Object Specifications table below for the structure of the params object. + */ + createPredominanceRenderer(params: any): any; + /** + * Defines the size of the symbol where feature size is proportional to data value. + * @param params See the object specifications table below for the structure of the params object. + */ + createSizeInfo(params: any): any; /** * Creates a renderer for visualizing features by varying their size based on data. * @param params See the object specifications table below for the structure of the params object. @@ -13113,6 +13255,10 @@ declare module "esri/symbols/TextSymbol" { decoration: string; /** Font for displaying text. */ font: Font; + /** The halo color used for the text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloColor: Color; + /** The size (in pixel units) used if setting a halo on a text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloSize: number; /** Horizontal alignment of the text with respect to the graphic. */ horizontalAlignment: string; /** Determines whether to adjust the spacing between characters in the text string. */ @@ -13164,6 +13310,16 @@ declare module "esri/symbols/TextSymbol" { * @param font Text font. */ setFont(font: Font): TextSymbol; + /** + * Sets a halo color for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param color The color used for the text symbol halo. + */ + setHaloColor(color: Color): TextSymbol; + /** + * Sets the size of the halo (in pixels) used for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param size The size (in pixels) of the text symbol halo. + */ + setHaloSize(size: number): TextSymbol; /** * Updates the horizontal alignment of the text symbol. * @param alignment Horizontal alignment of the text with respect to the graphic. @@ -13658,6 +13814,8 @@ declare module "esri/tasks/FindParameters" { contains: boolean; /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ dynamicLayerInfos: DynamicLayerInfo[]; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ layerDefinitions: string[]; /** The layers to perform the find operation on. */ @@ -13731,26 +13889,26 @@ declare module "esri/tasks/FindTask" { declare module "esri/tasks/GPMessage" { /** Represents a message generated during the execution of a geoprocessing task. */ class GPMessage { - /** esriJobMessageTypeAbort */ + /** esriJobMessageTypeAbort - Indicates the job has aborted. */ static TYPE_ABORT: any; - /** esriGPMessageTypeEmpty */ + /** esriJobMessageTypeEmpty - Indicates the task returned an empty result. */ static TYPE_EMPTY: any; - /** esriGPMessageTypeError */ + /** esriJobMessageTypeError - Indicates an error was returned during the execution of the job. */ static TYPE_ERROR: any; - /** esriGPMessageTypeInformative */ + /** esriJobMessageTypeInformative - Indicates the message is informative. */ static TYPE_INFORMATIVE: any; - /** TBA */ + /** esriJobMessageTypeProcessDefinition */ static TYPE_PROCESS_DEFINITION: any; - /** TBA */ + /** esriJobMessageTypeProcessStart - Indicates the GP process has started. */ static TYPE_PROCESS_START: any; - /** TBA */ + /** esriJobMessageTypeProcessStop - Indicates the GP process has stopped. */ static TYPE_PROCESS_STOP: any; - /** esriGPMessageTypeWarning */ + /** esriJobMessageTypeWarning - Indicates the message is a warning. */ static TYPE_WARNING: any; /** A description of the geoprocessing message. */ description: string; /** The geoprocessing message type. */ - type: number; + type: string; } export = GPMessage; } @@ -14127,7 +14285,7 @@ declare module "esri/tasks/Geoprocessor" { * @param callback The function to call when the method has completed. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - checkJobStatus(jobId: string, callback?: Function, errback?: Function): void; + checkJobStatus(jobId: string, callback?: Function, errback?: Function): any; /** * Sends a request to the server to execute a synchronous GP task. * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. @@ -14187,7 +14345,7 @@ declare module "esri/tasks/Geoprocessor" { * @param statusCallback Checks the current status of the job. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): void; + submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): any; /** Fires when an error occurs when executing the task. */ on(type: "error", listener: (event: { error: Error; target: Geoprocessor }) => void): esri.Handle; /** Fires when a synchronous GP task is completed. */ @@ -14231,6 +14389,8 @@ declare module "esri/tasks/IdentifyParameters" { dynamicLayerInfos: DynamicLayerInfo[]; /** The geometry used to select features during Identify. */ geometry: Geometry; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Height of the map currently being viewed in pixels. */ height: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ @@ -14403,6 +14563,28 @@ declare module "esri/tasks/ImageServiceMeasureParameters" { /** Defines parameters for the ImageServiceMeasureTask. */ class ImageServiceMeasureParameters { + /** Calculates the area and perimeter of given geometry. */ + static OPERATION_AREA_PERIMETER: any; + /** Calculates the area and perimeter of the given geometry using the DEM defined by the service to refine the calculation. */ + static OPERATION_AREA_PERIMETER_3D: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure. */ + static OPERATION_BASE_TOP: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_BASE_TOP_SHADOW: any; + /** Calculates the centroid of a given area. */ + static OPERATION_CENTROID: any; + /** Calculates the centroid of a given area, using the DEM defined by the service to refine the calculation. */ + static OPERATION_CENTROID_3D: any; + /** Calculates the distance and azimuth angle between two points. */ + static OPERATION_DISTANCE_ANGLE: any; + /** Calculates the distance and azimuth angle between two points using the DEM defined by the service to refine the calculation. */ + static OPERATION_DISTANCE_ANGLE_3D: any; + /** Measures the location of a given point. */ + static OPERATION_POINT: any; + /** Measures the location of a given point, using the DEM defined by the service to refine the calculation. */ + static OPERATION_POINT_3D: any; + /** Calculates the height of a structure by measuring from the top of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_TOP_TOP_SHADOW: any; /** The angular unit in which directions of line segments will be calculated. */ angularUnit: string; /** The area unit in which areas of polygons will be calculated. */ @@ -14613,6 +14795,8 @@ declare module "esri/tasks/ParameterValue" { class ParameterValue { /** Specifies the type of data for the parameter. */ dataType: string; + /** The name of the output parameter as defined by the geoprocessing task in the Services Directory. */ + paramName: string; /** The value of the parameter. */ value: any; } @@ -14707,7 +14891,7 @@ declare module "esri/tasks/ProjectParameters" { geometries: Geometry[]; /** The spatial reference to which you are projecting the geometries. */ outSR: SpatialReference; - /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transfomation to be applied on the projected geometries. */ + /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transformation to be applied on the projected geometries. */ transformation: any; /** Indicates whether to transform forward or not. */ transformForward: boolean; @@ -15331,6 +15515,8 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { executeJob(parameters: BatchValidationParameters): any; /** Retrieves all adhoc jobs from the server and returns an array of BatchValidationJob with the information. */ getAdhocJobsList(): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Fetches Batch Validation Job details. * @param jobId Job Id of the batch validation job. @@ -15373,19 +15559,21 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { /** Fires when the executeJob method is complete. */ on(type: "execute-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getAdhocJobsList method is complete. */ - on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobDetails method is complete. */ on(type: "get-job-details", listener: (event: { jobDetails: BatchValidationJob; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobExecutionDetails method is complete. */ on(type: "get-job-execution-details", listener: (event: { jobInfo: BatchValidationJobInfo; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobIds method is complete. */ - on(type: "get-job-ids", listener: (event: { adhocJobs: any[]; scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-job-ids", listener: (event: { adhocJobs: string[]; scheduledJobs: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getScheduledJobsList method is complete. */ - on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the scheduleJob method is complete. */ on(type: "schedule-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -15435,6 +15623,8 @@ declare module "esri/tasks/datareviewer/DashboardTask" { * @param sessionOptions Session properties to be used to create the session. */ createReviewerSession(sessionName: string, sessionOptions: SessionOptions): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** Requests Dashboard results field names. */ getDashboardFieldNames(): any; /** @@ -15453,14 +15643,16 @@ declare module "esri/tasks/datareviewer/DashboardTask" { on(type: "create-reviewer-sessions", listener: (event: { reviewerSession: ReviewerSession; target: DashboardTask }) => void): esri.Handle; /** Fires when an error occurs during a DashboardTask method execution. */ on(type: "error", listener: (event: { error: Error; target: DashboardTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardFieldNames method is complete. */ - on(type: "get-dashboard-field-names", listener: (event: { fieldNames: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-dashboard-field-names", listener: (event: { fieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardResults method is complete. */ on(type: "get-dashboard-results", listener: (event: { dashboardResult: DashboardResult; target: DashboardTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: DashboardTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = DashboardTask; @@ -15542,8 +15734,8 @@ declare module "esri/tasks/datareviewer/ReviewerFilters" { } declare module "esri/tasks/datareviewer/ReviewerLifecycle" { - /** The ReviewerLifecycle class specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ - class ReviewerLifecycle { + /** The ReviewerLifecycle object specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ + var ReviewerLifecycle: { /** Acceptable lifecycleStatus code = 4 belongs to Verification Phase. */ ACCEPTABLE: number; /** Code for Correction Phase. */ @@ -15600,7 +15792,7 @@ declare module "esri/tasks/datareviewer/ReviewerLifecycle" { * @param lifecycleStatus The lifecycle status code. */ toLifecycleStatusString(lifecycleStatus: number): string; - } + }; export = ReviewerLifecycle; } @@ -15614,6 +15806,7 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { import Geometry = require("esri/geometry/Geometry"); import ReviewerSession = require("esri/tasks/datareviewer/ReviewerSession"); import FeatureSet = require("esri/tasks/FeatureSet"); + import FeatureEditResult = require("esri/layers/FeatureEditResult"); /** ReviewerResults allows access to the reviewer workspace. */ class ReviewerResultsTask { @@ -15633,6 +15826,8 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param batchRunIds Array of batchRunIds used to get batch run details. */ getBatchRunDetails(batchRunIds: any[]): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Utility operation that returns a where clause given a set of input filters. * @param filters An instance of ReviewerFilters used to create a layer definition. @@ -15646,8 +15841,10 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param filters Instance of ReviewerFilters used to query reviewer results. */ getResults(getResultsQueryParameters: GetResultsQueryParameters, filters?: ReviewerFilters): any; + /** Retrieves a list of field names that can be used to fetch or query results from reviewer workspace. */ + getResultsFieldNames(): string[]; /** Extracts the MapServer url from the full ArcGIS Data Reviewer for Server SOE url. */ - getReviewerMapServerUrl(): any; + getReviewerMapServerUrl(): string; /** Returns an array of sessions in a Reviewer workspace. */ getReviewerSessions(): any; /** @@ -15676,16 +15873,18 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { on(type: "error", listener: (event: { error: Error; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getBatchRunDetails method is complete. */ on(type: "get-batch-run-details", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLayerDefinition method is complete. */ on(type: "get-layer-definition", listener: (event: { whereClause: string; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getResults method is complete. */ on(type: "get-results", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the updateLifecycleStatus method is complete. */ - on(type: "update-lifecycle-status", listener: (event: { featureEditResults: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "update-lifecycle-status", listener: (event: { featureEditResults: FeatureEditResult[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeFeatureAsResult method is complete. */ on(type: "write-feature-as-result", listener: (event: { success: boolean; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeResult method is complete. */ diff --git a/bluebird/bluebird-1.0.d.ts b/bluebird/bluebird-1.0.d.ts index db9dd0dd2..b8287e57c 100644 --- a/bluebird/bluebird-1.0.d.ts +++ b/bluebird/bluebird-1.0.d.ts @@ -394,7 +394,7 @@ declare class Promise implements Promise.Thenable { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object): Object; + static promisifyAll(target: Object): any; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 9b55578ef..da3b9902a 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -421,7 +421,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): Object; + static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; /** diff --git a/codemirror/codemirror-showhint.d.ts b/codemirror/codemirror-showhint.d.ts index 48a904a3b..8b620a414 100644 --- a/codemirror/codemirror-showhint.d.ts +++ b/codemirror/codemirror-showhint.d.ts @@ -41,9 +41,7 @@ declare module CodeMirror { off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; } - /** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/ interface Doc { - state: any; showHint: (options: ShowHintOptions) => void; } diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 2ca58c702..3fb29e425 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -390,6 +390,9 @@ declare module CodeMirror { The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ + state: any; } interface EditorFromTextArea extends Editor { @@ -589,6 +592,8 @@ declare module CodeMirror { /** The reverse of posFromIndex. */ indexFromPos(object: CodeMirror.Position): number; + /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ + state: any; } interface LineHandle { diff --git a/graham_scan/graham_scan.d.ts b/graham_scan/graham_scan.d.ts index 617df2e7e..dbc30517b 100644 --- a/graham_scan/graham_scan.d.ts +++ b/graham_scan/graham_scan.d.ts @@ -6,3 +6,7 @@ declare class ConvexHullGrahamScan { addPoint(x: number, y: number): void; getHull(): {x: number, y: number}[]; } + +declare module 'graham_scan' { + export = ConvexHullGrahamScan; +} diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 9a0aa510a..54dc7e9ae 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -7,6 +7,8 @@ declare module Handlebars { export function registerHelper(name: string, fn: Function, inverse?: boolean): void; export function registerPartial(name: string, str: any): void; + export function unregisterHelper(name: string): void; + export function unregisterPartial(name: string): void; export function K(): void; export function createFrame(object: any): any; export function Exception(message: string): void; diff --git a/hopscotch/hopscotch-tests.ts b/hopscotch/hopscotch-tests.ts new file mode 100644 index 000000000..52d021395 --- /dev/null +++ b/hopscotch/hopscotch-tests.ts @@ -0,0 +1,55 @@ +/// + +var tourDefinition = { + id: 'intro-tour', + steps: [ + { + target: '.popupTarget', + placement: 'bottom', + title: 'A tour step', + content: 'A tour message' + }, + { + target: [".aSelector"], + placement: 'bottom', + + yOffset: 10, + width: 400, + xOffset: -420, + arrowOffset: 380 + }, + { + target: '.domainPatterns form', + placement: 'right', + title: 'A question?', + content: "Hello!", + onShow: function () { } + }, + { + target: '.home-button', + placement: 'left', + title: "Let's get started", + content: "Content", + + multipage: true, + nextOnTargetClick: true, + showNextButton: false + }, + { + target: '.buttons', + placement: 'top', + + title: 'Another title', + content: "A message", + + showNextButton: false, + nextOnTargetClick: true, + onShow: function () { } + } + ], + skipIfNoElement: false, + onClose: function () { }, + onEnd: function () { } +}; + +hopscotch.startTour(tourDefinition); diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts new file mode 100644 index 000000000..e7f7be6e9 --- /dev/null +++ b/hopscotch/hopscotch.d.ts @@ -0,0 +1,45 @@ +// Type definitions for Hopscotch v0.2.5 +// Project: http://linkedin.github.io/hopscotch/ +// Definitions by: Tim Perry +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface TourDefinition { + id: string; + steps: StepDefinition[]; + + skipIfNoElement: boolean; + + onEnd: () => void; + onClose: () => void; +} + +interface StepDefinition { + placement: string; + target: string | HTMLElement | Array + + title?: string; + content?: string; + + xOffset?: number; + yOffset?: number; + arrowOffset?: number; + + height?: number; + width?: number; + + multipage?: boolean; + showNextButton?: boolean; + nextOnTargetClick?: boolean; + + onShow?: () => void; +} + +interface HopscotchStatic { + startTour(tour: TourDefinition, stepNum?: number): void; +} + +declare var hopscotch: HopscotchStatic; + +declare module "hopscotch" { + export = hopscotch; +} diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts index b8e8126ae..0ec5938f5 100644 --- a/intro.js/intro.js-tests.ts +++ b/intro.js/intro.js-tests.ts @@ -3,6 +3,8 @@ var intro = introJs(); intro.setOption('doneLabel', 'Next page'); +intro.setOption('overlayOpacity', 50); +intro.setOption('showProgress', true); intro.setOptions({ steps: [ { diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts index 15a73f517..6763124ba 100644 --- a/intro.js/intro.js.d.ts +++ b/intro.js/intro.js.d.ts @@ -1,20 +1,13 @@ -// Type definitions for intro.js 1.0.0 +// Type definitions for intro.js 1.1.1 // Project: https://github.com/usablica/intro.js // Definitions by: Maxime Fabre // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module IntroJs { - enum Positions { - top, - left, - right, - bottom - } - interface Step { intro: string; - element?: string|HTMLElement; - position?: string|Positions; + element?: string|HTMLElement|Element; + position?: string; } interface Options { @@ -49,7 +42,7 @@ declare module IntroJs { refresh(): IntroJs; - setOption(option: string, value: string|number): IntroJs; + setOption(option: string, value: string|number|boolean): IntroJs; setOptions(options: Options): IntroJs; onexit(callback: Function): IntroJs; diff --git a/jssha/jssha-1.6.0-tests.ts b/jssha/jssha-1.6.0-tests.ts new file mode 100755 index 000000000..67e1ec026 --- /dev/null +++ b/jssha/jssha-1.6.0-tests.ts @@ -0,0 +1,15 @@ +/// +/// + +var imported = require("jssha"); + +var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8"); +var shaObj2 = new imported("This is a Test", "TEXT"); + +var hash1:string = shaObj2.getHash("SHA-512", "HEX"); +var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2); +var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"}); + +var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"}; +var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX"); +var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format); diff --git a/jssha/jssha-1.6.0.d.ts b/jssha/jssha-1.6.0.d.ts new file mode 100755 index 000000000..b6dcef80f --- /dev/null +++ b/jssha/jssha-1.6.0.d.ts @@ -0,0 +1,65 @@ +// Type definitions for jsSHA-1.6.0 +// Project: https://github.com/Caligatio/jsSHA +// Definitions by: David Li +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module jsSHA { + export interface OutputFormatOptions { + outputUpper? : boolean; + b64Pad? : string; + } + + export interface jsSHA { + /** + * jsSHA is the workhorse of the library. Instantiate it with the string to + * be hashed as the parameter + * + * @constructor + * @this {jsSHA} + * @param {string} srcString The string to be hashed + * @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES + * @param {string=} encoding The text encoding to use to encode the source + * string + */ + new (srcString:string, inputFormat:string, encoding?:string):jsSHA; + + /** + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {number=} numRounds The number of rounds of hashing to be + * executed + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the desired HMAC of the string specified at instantiation + * using the key and variant parameter + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} outputFormat The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string; + } +} + +declare var jsSHA: jsSHA.jsSHA; +declare module 'jssha' { + export = jsSHA; +} diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts old mode 100755 new mode 100644 index 8d6eec5a6..f6e0f96b4 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-tests.ts @@ -1,15 +1,49 @@ /// /// -var imported = require("jssha"); +import imported = require("jssha"); -var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8"); -var shaObj2 = new imported("This is a Test", "TEXT"); +// constructor +let shaObj1:jsSHA.jsSHA = new imported("SHA-512", "TEXT"); +let shaObj2:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { }); +let shaObj3:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8" }); +let shaObj4:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { numRounds: 1 }); +let shaObj5:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8", numRounds: 1 }); -var hash1:string = shaObj2.getHash("SHA-512", "HEX"); -var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2); -var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"}); +// setHMACKey +shaObj1.setHMACKey("key", "TEXT"); +shaObj2.setHMACKey("key", "TEXT", { }); +shaObj3.setHMACKey("key", "TEXT", { encoding: "UTF8" }); -var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"}; -var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX"); -var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format); +// update +shaObj1.update("This is a test"); + +// getHash +let hash1:string = shaObj4.getHash("HEX"); +let hash2:string = shaObj4.getHash("HEX", {}); +let hash3:string = shaObj4.getHash("HEX", { b64Pad: "=" }); +let hash4:string = shaObj4.getHash("HEX", { outputUpper: true }); +let hash5:string = shaObj4.getHash("HEX", { outputUpper: true, b64Pad: '=' }); + +// getHMAC +let hmac1:string = shaObj1.getHMAC("HEX"); +let hmac2:string = shaObj1.getHMAC("HEX", {}); +let hmac3:string = shaObj1.getHMAC("HEX", { b64Pad: "=" }); +let hmac4:string = shaObj1.getHMAC("HEX", { outputUpper: true }); +let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); + + +// examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md) +{ + var shaObj = new imported("SHA-512", "TEXT"); + shaObj.update("This is a test"); + var hash = shaObj.getHash("HEX"); +} + + +{ + let shaObj = new imported("SHA-256", "TEXT"); + shaObj.setHMACKey("abc", "TEXT"); + shaObj.update("This is a test"); + let hmac = shaObj.getHMAC("HEX"); +} \ No newline at end of file diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts old mode 100755 new mode 100644 index 1c75c3862..6dc4f65d3 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -1,13 +1,22 @@ // Type definitions for jsSHA // Project: https://github.com/Caligatio/jsSHA -// Definitions by: David Li -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: David Li , Tobias Kahlert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module jsSHA { + + export interface EncodingOptions { + encoding? : string; + } + + export interface Options extends EncodingOptions { + numRounds? : number; + } + export interface OutputFormatOptions { - outputUpper : boolean; - b64Pad : string; + outputUpper? : boolean; + b64Pad? : string; } export interface jsSHA { @@ -15,51 +24,62 @@ declare module jsSHA { * jsSHA is the workhorse of the library. Instantiate it with the string to * be hashed as the parameter * - * @constructor - * @this {jsSHA} - * @param {string} srcString The string to be hashed - * @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES - * @param {string=} encoding The text encoding to use to encode the source - * string + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256, + * SHA-384, or SHA-512) + * @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES + * @param {{encoding: (string|undefined), numRounds: (string|undefined)}=} + * options Optional values */ - new (srcString:string, inputFormat:string, encoding?:string):jsSHA; + new (variant:string, inputFormat:string, options?:Options):jsSHA; /** - * Returns the desired SHA hash of the string specified at instantiation - * using the specified parameters - * - * @param {string} variant The desired SHA variant (SHA-1, SHA-224, - * SHA-256, SHA-384, or SHA-512) - * @param {string} format The desired output formatting (B64, HEX, or BYTES) - * @param {number=} numRounds The number of rounds of hashing to be - * executed - * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts - * Hash list of output formatting options - * @return {string} The string representation of the hash in the format - * specified - */ - getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string; + * Sets the HMAC key for an eventual getHMAC call. Must be called + * immediately after jsSHA object instantiation + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {{encoding : (string|undefined)}=} encodingOpts Associative array + * of input format options + */ + setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void; + + /** + * Takes strString and hashes as many blocks as possible. Stores the + * rest for either a future update or getHash call. + * + * @param {string} srcString The string to be hashed + */ + update(srcString:string):void; + /** - * Returns the desired HMAC of the string specified at instantiation - * using the key and variant parameter - * - * @param {string} key The key used to calculate the HMAC - * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES - * @param {string} variant The desired SHA variant (SHA-1, SHA-224, - * SHA-256, SHA-384, or SHA-512) - * @param {string} outputFormat The desired output formatting - * (B64, HEX, or BYTES) - * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts - * associative array of output formatting options - * @return {string} The string representation of the hash in the format - * specified - */ - getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string; + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * outputFormatOpts Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(format:string, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the the HMAC in the specified format using the key given by + * a previous setHMACKey call. + * + * @param {string} format The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * outputFormatOpts associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(format:string, outputFormatOpts?:OutputFormatOptions):string; } } -declare var jsSHA: jsSHA.jsSHA; declare module 'jssha' { + var jsSHA: jsSHA.jsSHA; export = jsSHA; -} +} \ No newline at end of file diff --git a/lazy.js/lazy.js-tests.ts b/lazy.js/lazy.js-tests.ts index 5e45ccf13..57d1ef37e 100644 --- a/lazy.js/lazy.js-tests.ts +++ b/lazy.js/lazy.js-tests.ts @@ -28,6 +28,7 @@ var anyObjectSeq: LazyJS.ObjectLikeSequence; var fooAsyncSeq: LazyJS.AsyncSequence; var strSequence: LazyJS.Sequence; +var anySequence: LazyJS.Sequence; var stringSeq: LazyJS.StringLikeSequence; var obj: Object; @@ -44,7 +45,6 @@ function fnCallback(): void { } function fnErrorCallback(error: any): void { - } function fnValueCallback(value: Foo): void { @@ -108,8 +108,8 @@ fooSequence = fooSequence.dropWhile(fnTestCallback); fooSequence = fooSequence.each(fnValueCallback); bool = fooSequence.every(fnTestCallback); fooSequence = fooSequence.filter(fnTestCallback); -fooSequence = fooSequence.find(fnTestCallback); -fooSequence = fooSequence.findWhere(obj); +foo = fooSequence.find(fnTestCallback); +foo = fooSequence.findWhere(obj); x = fooSequence.first(); fooSequence = fooSequence.first(num); @@ -134,7 +134,7 @@ foo = fooSequence.max(); foo = fooSequence.max(fnNumberCallback); foo = fooSequence.min(); foo = fooSequence.min(fnNumberCallback); -fooSequence = fooSequence.pluck(str); +anySequence = fooSequence.pluck(str); bar = fooSequence.reduce(fnMemoCallback); bar = fooSequence.reduce(fnMemoCallback, bar); bar = fooSequence.reduceRight(fnMemoCallback, bar); @@ -152,8 +152,8 @@ fooSequence = fooSequence.sortBy(str, bool); fooSequence = fooSequence.sortBy(fnNumberCallback); fooSequence = fooSequence.sortBy(fnNumberCallback, bool); fooSequence = fooSequence.sortedIndex(foo); -fooSequence = fooSequence.sum(); -fooSequence = fooSequence.sum(fnNumberCallback); +foo = fooSequence.sum(); +foo = fooSequence.sum(fnNumberCallback); fooSequence = fooSequence.takeWhile(fnTestCallback); fooSequence = fooSequence.union(fooArr); fooSequence = fooSequence.uniq(); diff --git a/lazy.js/lazy.js.d.ts b/lazy.js/lazy.js.d.ts index 02cf1833b..55406d5c5 100644 --- a/lazy.js/lazy.js.d.ts +++ b/lazy.js/lazy.js.d.ts @@ -135,8 +135,8 @@ declare module LazyJS { dropWhile(predicateFn: TestCallback): Sequence; every(predicateFn: TestCallback): boolean; filter(predicateFn: TestCallback): Sequence; - find(predicateFn: TestCallback): Sequence; - findWhere(properties: Object): Sequence; + find(predicateFn: TestCallback): T; + findWhere(properties: Object): T; flatten(): Sequence; groupBy(keyFn: GetKeyCallback): ObjectLikeSequence; @@ -150,7 +150,7 @@ declare module LazyJS { max(valueFn?: NumberCallback): T; min(valueFn?: NumberCallback): T; none(valueFn?: TestCallback): boolean; - pluck(propertyName: string): Sequence; + pluck(propertyName: string): Sequence; reduce(aggregatorFn: MemoCallback, memo?: U): U; reduceRight(aggregatorFn: MemoCallback, memo: U): U; reject(predicateFn: TestCallback): Sequence; @@ -162,7 +162,7 @@ declare module LazyJS { sortBy(sortFn: NumberCallback, descending?: boolean): Sequence; sortedIndex(value: T): Sequence; size(): number; - sum(valueFn?: NumberCallback): Sequence; + sum(valueFn?: NumberCallback): T; takeWhile(predicateFn: TestCallback): Sequence; union(var_args: T[]): Sequence; uniq(): Sequence; diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a872..ce60da779 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1315,17 +1315,86 @@ module TestSortedIndex { // _.sortedLastIndex module TestSortedLastIndex { - result = _.sortedLastIndex([20, 30, 50], 40); - result = _.sortedLastIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - var sortedLastIndexDict: { wordToNumber: { [idx: string]: number } } = { - 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - }; - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return sortedLastIndexDict.wordToNumber[word]; - }); - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return this.wordToNumber[word]; - }, sortedLastIndexDict); + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndex('', ''); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + + result = _.sortedLastIndex(array, value); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex(array, value, ''); + result = _.sortedLastIndex(array, value, {a: 42}); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndex(list, value); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex(list, value, ''); + result = _.sortedLastIndex(list, value, {a: 42}); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndex(''); + result = _('').sortedLastIndex('', stringIterator); + result = _('').sortedLastIndex('', stringIterator, any); + + result = _(array).sortedLastIndex(value); + result = _(array).sortedLastIndex(value, arrayIterator); + result = _(array).sortedLastIndex(value, arrayIterator, any); + result = _(array).sortedLastIndex(value, ''); + result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndex(value); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex(value, ''); + result = _(list).sortedLastIndex(value, {a: 42}); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndex(''); + result = _('').chain().sortedLastIndex('', stringIterator); + result = _('').chain().sortedLastIndex('', stringIterator, any); + + result = _(array).chain().sortedLastIndex(value); + result = _(array).chain().sortedLastIndex(value, arrayIterator); + result = _(array).chain().sortedLastIndex(value, arrayIterator, any); + result = _(array).chain().sortedLastIndex(value, ''); + result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndex(value); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex(value, ''); + result = _(list).chain().sortedLastIndex(value, {a: 42}); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } } // _.tail @@ -5397,12 +5466,25 @@ result = _({}).isMatch({}, testIsMatchCustiomizerFn); result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); // _.isNaN -result = _.isNaN(NaN); -result = _.isNaN(new Number(NaN)); -result = _.isNaN(undefined); -result = _(NaN).isNaN(); -result = _(new Number(NaN)).isNaN(); -result = _(undefined).isNaN(); +module TestIsNaN { + { + let result: boolean; + + result = _.isNaN(any); + + result = _(1).isNaN(); + result = _([]).isNaN(); + result = _({}).isNaN(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNaN(); + result = _([]).chain().isNaN(); + result = _({}).chain().isNaN(); + } +} // _.isNative result = _.isNative(Array.prototype.push); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443..801b66be9 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2156,71 +2156,222 @@ declare module _ { //_.sortedLastIndex interface LoDashStatic { /** - * Uses a binary search to determine the highest index at which a value should be inserted - * into a given sorted array in order to maintain the sort order of the array. If a callback - * is provided it will be executed for value and each element of array to compute their sort - * ranking. The callback is bound to thisArg and invoked with one argument; (value). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The sorted list. - * @param value The value to determine its index within `list`. - * @param callback Iterator to compute the sort ranking of each value, optional. - * @return The index at which value should be inserted into array. - **/ - sortedLastIndex( - array: Array, - value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; - - /** - * @see _.sortedLastIndex - **/ + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ sortedLastIndex( array: List, value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ - sortedLastIndex( - array: Array, - value: T, - pluckValue: string): number; - - /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - pluckValue: string): number; + iteratee?: (x: T) => any, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ - sortedLastIndex( - array: Array, + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, value: T, - whereValue: W): number; + iteratee: string + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - whereValue: W): number; + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; } //_.tail @@ -9272,7 +9423,9 @@ declare module _ { interface LoDashStatic { /** * Checks if value is NaN. + * * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * * @param value The value to check. * @return Returns true if value is NaN, else false. */ @@ -9286,6 +9439,13 @@ declare module _ { isNaN(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + //_.isNative interface LoDashStatic { /** diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 0165dee1f..84fdad401 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -6,6 +6,7 @@ import * as React from "react"; import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import Checkbox = require("material-ui/lib/checkbox"); import Colors = require("material-ui/lib/styles/colors"); +import Spacing = require("material-ui/lib/styles/spacing"); import AppBar = require("material-ui/lib/app-bar"); import Badge = require("material-ui/lib/badge"); import IconButton = require("material-ui/lib/icon-button"); @@ -47,7 +48,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps; type MuiTheme = __MaterialUI.Styles.MuiTheme; type TouchTapEvent = __MaterialUI.TouchTapEvent; -class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin { +interface MaterialUiTestsState { + showDialogStandardActions: boolean; + showDialogCustomActions: boolean; + showDialogScrollable: boolean; +} + +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin { // injected with mixin linkState: (key: string) => React.ReactLink; @@ -60,6 +67,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta } private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) { } + private handleRequestClose(buttonClicked: boolean) { + } render() { @@ -193,7 +202,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta title="Dialog With Standard Actions" actions={standardActions} actionFocus="submit" - modal={true}> + open={this.state.showDialogStandardActions} + onRequestClose={this.handleRequestClose}> The actions in this window are created from the json that's passed in. ; @@ -212,12 +222,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = + open={this.state.showDialogCustomActions} + onRequestClose={this.handleRequestClose}> The actions in this window were passed in as an array of react objects. ; + element = +
+ Really long content +
+
; + // "http://material-ui.com/#/components/dropdown-menu" let menuItems = [ @@ -488,7 +509,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = ; + cellHeight={200} + style={{ color: 'red' }} />; element = implements React.LinkedSta titlePosition="top" titleBackground="rgba(0, 0, 0, 0.4)" cols={2} - rows={1} > + rows={1} + style={{ color: 'red' }}>

Children are Required!

; diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index df6a088a7..2c59d5416 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.13.1 +// Type definitions for material-ui v0.13.4 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Oliver Herrmann // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -379,14 +379,18 @@ declare namespace __MaterialUI { openImmediately?: boolean; repositionOnUpdate?: boolean; title?: React.ReactNode; + defaultOpen?: boolean; + open?: boolean; onClickAway?: () => void; onDismiss?: () => void; onShow?: () => void; + onRequestClose?: (buttonClicked: boolean) => void; } export class Dialog extends React.Component { dismiss(): void; show(): void; + isOpen(): boolean; } interface DropDownIconProps extends React.Props { @@ -567,6 +571,7 @@ declare namespace __MaterialUI { nestedItems?: React.ReactElement[]; onKeyboardFocus?: React.FocusEventHandler; onNestedListToggle?: (item: ListItem) => void; + onClick?: React.MouseEventHandler; rightAvatar?: React.ReactElement; rightIcon?: React.ReactElement; rightIconButton?: React.ReactElement; @@ -870,6 +875,8 @@ declare namespace __MaterialUI { desktopSubheaderHeight?: number; desktopToolbarHeight?: number; } + export var Spacing: Spacing; + interface ThemePalette { primary1Color?: string; primary2Color?: string; @@ -1532,6 +1539,7 @@ declare namespace __MaterialUI { cols?: number; padding?: number; cellHeight?: number; + style?: React.CSSProperties; } export class GridList extends React.Component{ @@ -1547,6 +1555,7 @@ declare namespace __MaterialUI { cols?: number; rows?: number; rootClass?: string | __React.Component; + style?: React.CSSProperties; } export class GridTile extends React.Component{ diff --git a/ng-cordova/actionSheet-tests.ts b/ng-cordova/actionSheet-tests.ts new file mode 100644 index 000000000..07d105b54 --- /dev/null +++ b/ng-cordova/actionSheet-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/actionSheet/ + .controller('ThisCtrl', function($cordovaActionSheet: ngCordova.IActionSheetService) { + + var options = { + title: 'What do you want with this image?', + buttonLabels: ['Share via Facebook', 'Share via Twitter'], + addCancelButtonWithLabel: 'Cancel', + androidEnableCancelButton: true, + winphoneEnableCancelButton: true, + addDestructiveButtonWithLabel: 'Delete it' + }; + + document.addEventListener("deviceready", function() { + $cordovaActionSheet.show(options) + .then(function(btnIndex) { + var index: number = btnIndex; + }); + }, false); + }); +} diff --git a/ng-cordova/actionSheet.d.ts b/ng-cordova/actionSheet.d.ts new file mode 100644 index 000000000..1809d7fb0 --- /dev/null +++ b/ng-cordova/actionSheet.d.ts @@ -0,0 +1,22 @@ +// Type definitions for ngCordova Action Sheet plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IActionSheetService { + show(options: ShowOptions): ng.IPromise; + hide(): ng.IPromise; + } + + export interface ShowOptions { + title?: string; + buttonLabels?: string[]; + addCancelButtonWithLabel?: string; + addDestructiveButtonWithLabel?: string; + androidEnableCancelButton?: boolean; + winphoneEnableCancelButton?: boolean; + } +} diff --git a/ng-cordova/badge-tests.ts b/ng-cordova/badge-tests.ts new file mode 100644 index 000000000..854f66b39 --- /dev/null +++ b/ng-cordova/badge-tests.ts @@ -0,0 +1,59 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/badge/ + .controller('ThisCtrl', function($cordovaBadge: ngCordova.IBadgeService) { + + $cordovaBadge.hasPermission().then(function(yes) { + // You have permission + }, function(no) { + // You do not have permission + }); + + $cordovaBadge.set(3).then(function() { + // You have permission, badge set. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.get().then(function(badge) { + // You have permission, badge returned. + var badgeNo: number = badge; + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.clear().then(function() { + // You have permission, badge cleared. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.increase().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.increase(3).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.decrease().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.decrease(2).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + }); +} diff --git a/ng-cordova/badge.d.ts b/ng-cordova/badge.d.ts new file mode 100644 index 000000000..b73b3182c --- /dev/null +++ b/ng-cordova/badge.d.ts @@ -0,0 +1,18 @@ +// Type definitions for ngCordova badge plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IBadgeService { + hasPermission(): ng.IPromise; + promptForPermission(): ng.IPromise; + set(badge: number, callback?: Function, scope?: {}): ng.IPromise; + get(): ng.IPromise; + clear(callback?: Function, scope?: {}): ng.IPromise; + increase(count?: number, callback?: Function, scope?: {}): ng.IPromise; + decrease(count?: number, callback?: Function, scope?: {}): ng.IPromise; + } +} diff --git a/ng-cordova/file-tests.ts b/ng-cordova/file-tests.ts new file mode 100644 index 000000000..6a4297394 --- /dev/null +++ b/ng-cordova/file-tests.ts @@ -0,0 +1,184 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/file/ + .controller('MyCtrl', function($scope: ng.IScope, $cordovaFile: ngCordova.IFileService) { + + document.addEventListener('deviceready', function() { + + $cordovaFile.getFreeDiskSpace() + .then(function(success) { + // success in kilobytes + var freeSpace: number = success; + }, function(error) { + // error + }); + + + // CHECK + $cordovaFile.checkDir(cordova.file.dataDirectory, "dir/other_dir") + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + + $cordovaFile.checkFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // CREATE + $cordovaFile.createDir(cordova.file.dataDirectory, "new_dir", false) + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.createFile(cordova.file.dataDirectory, "new_file.txt", true) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // REMOVE + $cordovaFile.removeDir(cordova.file.dataDirectory, "some_dir") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + if (success.success) { + var fileResult: FileEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeRecursively(cordova.file.dataDirectory, "") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + + // WRITE + $cordovaFile.writeFile(cordova.file.dataDirectory, "file.txt", "text", true) + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + $cordovaFile.writeExistingFile(cordova.file.dataDirectory, "file.txt", "text") + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + + // READ + $cordovaFile.readAsText(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsDataURL(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsBinaryString(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsArrayBuffer(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var buffer: ArrayBuffer = success; + }, function(error) { + // error + }); + + + // MOVE + $cordovaFile.moveDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.moveFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // COPY + $cordovaFile.copyDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.copyFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory, "new_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + }); + + }); +} diff --git a/ng-cordova/file.d.ts b/ng-cordova/file.d.ts new file mode 100644 index 000000000..04f19080a --- /dev/null +++ b/ng-cordova/file.d.ts @@ -0,0 +1,51 @@ +// Type definitions for ngCordova file plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ngCordova { + export interface IFileService { + getFreeDiskSpace(): IFilePromise; + + checkDir(path: string, directory: string): IFilePromise; + checkFile(path: string, file: string): IFilePromise; + + createDir(path: string, directory: string, replace?: boolean): IFilePromise; + createFile(path: string, file: string, replace?: boolean): IFilePromise; + + removeDir(path: string, directory: string): IFilePromise>; + removeFile(path: string, file: string): IFilePromise>; + removeRecursively(path: string, directory: string): IFilePromise>; + + writeFile(path: string, file: string, text: string | Blob, replace?: boolean): IFilePromise; + writeExistingFile(path: string, file: string, text: string | Blob): IFilePromise; + + readAsText(path: string, file: string): ng.IPromise; + readAsDataURL(path: string, file: string): ng.IPromise; + readAsBinaryString(path: string, file: string): ng.IPromise; + readAsArrayBuffer(path: string, file: string): ng.IPromise; + + moveDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + moveFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + + copyDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + copyFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + } + + export interface IFilePromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + catch(onRejected: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileRemoveResult { + success: boolean; + fileRemoved: TEntry; + } + + export interface IFileError extends FileError { + message: string; + } +} diff --git a/ng-cordova/fileTransfer-tests.ts b/ng-cordova/fileTransfer-tests.ts new file mode 100644 index 000000000..0c188f239 --- /dev/null +++ b/ng-cordova/fileTransfer-tests.ts @@ -0,0 +1,53 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/fileTransfer/ + .controller('MyCtrl', function($scope: ng.IScope & { downloadProgress: number; }, $timeout: ng.ITimeoutService, $cordovaFileTransfer: ngCordova.IFileTransferService) { + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg"; + var targetPath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.download(url, targetPath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileEntry = result; + }, function(err) { + // Error + }, function(progress) { + $timeout(function() { + $scope.downloadProgress = (progress.loaded / progress.total) * 100; + }) + }); + + }, false); + + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/uploads"; + var filePath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.upload(url, filePath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileUploadResult = result; + }, function(err) { + // Error + }, function(progress) { + // constant progress updates + }); + + }, false); + }); +} diff --git a/ng-cordova/fileTransfer.d.ts b/ng-cordova/fileTransfer.d.ts new file mode 100644 index 000000000..838302e10 --- /dev/null +++ b/ng-cordova/fileTransfer.d.ts @@ -0,0 +1,30 @@ +// Type definitions for ngCordova file-transfer plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module ngCordova { + export interface IFileTransferService { + download(url: string, filePath: string, options?: IFileDownloadOptions, trustAllHosts?: boolean): IFileTransferPromise; + upload(url: string, filePath: string, options?: IFileUploadOptions, trustAllHosts?: boolean): IFileTransferPromise; + } + + export interface IFileTransferPromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise | TResult, notifyCallback?: (state: any) => any): ng.IPromise; + catch(onRejected: (error: FileTransferError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileDownloadOptions extends FileDownloadOptions { + encodeURI?: boolean; + timeout?: number; + } + + export interface IFileUploadOptions extends FileUploadOptions { + encodeURI?: boolean; + timeout?: number; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index 5f17dd706..791b61144 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -15,3 +15,7 @@ /// /// /// +/// +/// +/// +/// diff --git a/opn/opn-tests.ts b/opn/opn-tests.ts index 361725970..2b39f1950 100644 --- a/opn/opn-tests.ts +++ b/opn/opn-tests.ts @@ -1,10 +1,18 @@ /// -import opn = require('opn'); +import * as opn from "opn"; var errorCallback: (err: Error) => void; -opn('foo'); -opn('foo', 'bar'); -opn('foo', errorCallback); -opn('foo', 'bar', errorCallback); +opn("foo"); +opn("foo", errorCallback); + +opn("foo", { app: "bar" }); +opn("foo", { app: ["bar", "--arg"] }); +opn("foo", { app: "bar", wait: false }); +opn("foo", { app: ["bar", "--arg"] , wait: false}); + +opn("foo", { app: "bar" }, errorCallback); +opn("foo", { app: ["bar", "--arg"] }, errorCallback); +opn("foo", { app: "bar", wait: false }, errorCallback); +opn("foo", { app: ["bar", "--arg"], wait: false }, errorCallback); diff --git a/opn/opn.d.ts b/opn/opn.d.ts index 10a34ce60..6e6a5a178 100644 --- a/opn/opn.d.ts +++ b/opn/opn.d.ts @@ -1,10 +1,82 @@ -// Type definitions for opn 1.0.0 +// Type definitions for opn 3.0.2 // Project: https://github.com/sindresorhus/opn -// Definitions by: Shinnosuke Watanabe +// Definitions by: Shinnosuke Watanabe , +// Maxime LUCE // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module 'opn' { - function opn(target: string, callback?: (err: Error) => void): void; - function opn(target: string, app: string, callback?: (err: Error) => void): void; - export = opn; +/// + +declare namespace Opn { + export interface Options { + /** + * Wait for the opened app to exit before calling the `callback`. + * If `false` it's called immediately when opening the app. + * On Windows you have to explicitly specify an app for it to be able to wait. + */ + wait?: boolean; + + /** + * Specify the app to open the target with, or an array with the app and app arguments. + * The app name is platform dependent. Don't hard code it in reusable modules. + * Eg. Chrome is `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows. + */ + app?: string | string[]; + } +} + +declare module "opn" { + import * as cp from "child_process"; + + interface DefaultFunction { + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + */ + (target: string): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, callback: (err: Error) => void): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + */ + (target: string, options: Opn.Options): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, options: Opn.Options, callback: (err: Error) => void): cp.ChildProcess; + } + + const opn: DefaultFunction; + export = opn; } diff --git a/react-infinite/react-infinite-tests.tsx b/react-infinite/react-infinite-tests.tsx new file mode 100644 index 000000000..91a86abce --- /dev/null +++ b/react-infinite/react-infinite-tests.tsx @@ -0,0 +1,113 @@ +/// +/// + +import * as React from 'react'; +import Infinite = require('react-infinite'); + +class Test1 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test2 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test3 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test4 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +var ListItem = React.createClass<{key: number; num: number;}, {}>({ + render: function() { + return
+ List Item {this.props.num} +
; + } +}); + +var InfiniteList = React.createClass({ + getInitialState: function() { + return { + elements: this.buildElements(0, 20), + isInfiniteLoading: false + } + }, + + buildElements: function(start: number, end: number) { + var elements = [] as React.ReactElement[]; + for (var i = start; i < end; i++) { + elements.push() + } + return elements; + }, + + handleInfiniteLoad: function() { + var that = this; + this.setState({ + isInfiniteLoading: true + }); + setTimeout(function() { + var elemLength = that.state.elements.length, + newElements = that.buildElements(elemLength, elemLength + 1000); + that.setState({ + isInfiniteLoading: false, + elements: that.state.elements.concat(newElements) + }); + }, 2500); + }, + + elementInfiniteLoad: function() { + return
+ Loading... +
; + }, + + render: function() { + return + {this.state.elements} + ; + } +}); diff --git a/react-infinite/react-infinite.d.ts b/react-infinite/react-infinite.d.ts new file mode 100644 index 000000000..123883a0e --- /dev/null +++ b/react-infinite/react-infinite.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-infinite +// Project: https://github.com/seatgeek/react-infinite +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-infinite" { + import Infinite = ReactInfinite.Infinite; + export = Infinite; +} + +declare namespace ReactInfinite { + import React = __React; + + interface InfiniteProps extends React.Props { + elementHeight: number | number[]; + containerHeight?: number; + preloadBatchSize?: number | Object; + preloadAdditionalHeight?: number | Object; + handleScroll?: (node: React.ReactElement) => void; + infiniteLoadBeginBottomOffset?: number; + infiniteLoadBeginEdgeOffset?: number; + onInfiniteLoad?: () => void; + loadingSpinnerDelegate?: React.ReactElement; + isInfiniteLoading?: boolean; + timeScrollStateLastsForAfterUserScrolls?: number; + className?: string; + useWindowAsScrollContainer?: boolean; + displayBottomUpwards?: boolean; + } + + export class Infinite extends React.Component { + static containerHeightScaleFactor(n: number): any; + } +} diff --git a/stamplay-js-sdk/stamplay-js-sdk-tests.ts b/stamplay-js-sdk/stamplay-js-sdk-tests.ts index bfc229d49..88b6d713d 100644 --- a/stamplay-js-sdk/stamplay-js-sdk-tests.ts +++ b/stamplay-js-sdk/stamplay-js-sdk-tests.ts @@ -1,5 +1,5 @@ /// - +Stamplay.init('sample'); var userFn = Stamplay.User(); var user = new userFn.Model; var colTags = Stamplay.Cobject('tag'); diff --git a/stamplay-js-sdk/stamplay-js-sdk.d.ts b/stamplay-js-sdk/stamplay-js-sdk.d.ts index 154dc414e..ebd0d31b3 100644 --- a/stamplay-js-sdk/stamplay-js-sdk.d.ts +++ b/stamplay-js-sdk/stamplay-js-sdk.d.ts @@ -26,6 +26,7 @@ declare module Stamplay { } export interface StamplayStatic { + init(appId : string) : void; User() : IStamplayObject Cobject(object : string) : IStamplayObject } diff --git a/swig/swig.d.ts b/swig/swig.d.ts index 4f2b22123..5de872c10 100644 --- a/swig/swig.d.ts +++ b/swig/swig.d.ts @@ -28,7 +28,7 @@ declare module "swig" { compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string; render(source: string, options?: SwigOptions): string; renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void; - renderFile(pathName: string, locals?: any): string + renderFile(pathName: string, locals?: any): string; run(templateFn: Function, locals?: any, filePath?: string): string; invalidateCache(): void; @@ -155,4 +155,4 @@ declare module "swig" { export function renderFile(pathName: string, locals?: any): string export function run(templateFn: Function, locals?: any, filePath?: string): string; export function invalidateCache(): void; -} \ No newline at end of file +} diff --git a/zeroclipboard/zeroclipboard-1.x.x-tests.ts b/zeroclipboard/zeroclipboard-1.x.x-tests.ts new file mode 100644 index 000000000..e087561f6 --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x-tests.ts @@ -0,0 +1,158 @@ +/// +/// + +// main.js +var client = new ZeroClipboard( document.getElementById("copy-button"), { + moviePath: "/path/to/ZeroClipboard.swf" +} ); + +client.on( "load", function(client) { + // alert( "movie is loaded" ); + + client.on( "complete", function(client, args) { + // `this` is the element that was clicked + this.style.display = "none"; + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +ZeroClipboard.config( { moviePath: 'http://YOURSERVER/path/ZeroClipboard.swf' } ); + +var client = new ZeroClipboard(); + +var client = new ZeroClipboard($(".copy-button")); + +var _globalConfig = { + // NOTE: For versions >= v1.3.x and < v2.x, you must use `swfPath` by setting `moviePath`: + // `ZeroClipboard.config({ moviePath: ZeroClipboard.config("swfPath") });` + // URL to movie, relative to the page. Default value will be "ZeroClipboard.swf" under the + // same path as the ZeroClipboard JS file. + swfPath: "path/to/ZeroClipboard.swf", + + // SWF inbound scripting policy: page domains that the SWF should trust. (single string or array of strings) + trustedDomains: [window.location.host], + + // Include a "nocache" query parameter on requests for the SWF + cacheBust: true, + + // Forcibly set the hand cursor ("pointer") for all clipped elements + forceHandCursor: false, + + // The z-index used by the Flash object. Max value (32-bit): 2147483647 + zIndex: 999999999, + + // Debug enabled: send `console` messages with deprecation warnings, etc. + debug: true, + + // Sets the title of the `div` encapsulating the Flash object + title: 'div', + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.activate(...);` + // themselves instead of relying on our per-element `mouseover` handler + autoActivate: true, + + + /** @deprecated */ + // The class used to indicate that a clipped element is being hovered over + hoverClass: "zeroclipboard-is-hover", + + /** @deprecated */ + // The class used to indicate that a clipped element is active (is being clicked) + activeClass: "zeroclipboard-is-active", + + /** @deprecated */ + // DEPRECATED!!! Use `trustedDomains` instead! + // SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings) + trustedOrigins: ['origin'], + + /** @deprecated */ + // SWF outbound scripting policy. Possible values: "never", "sameDomain", "always" + allowScriptAccess: 'always', + + /** @deprecated */ + // Include a "nocache" query parameter on requests for the SWF + useNoCache: true, + + /** @deprecated */ + // URL to movie + moviePath: "ZeroClipboard.swf" +}; + +ZeroClipboard.config(_globalConfig); + +ZeroClipboard.config({ moviePath: "new/path" }); + +var client = new ZeroClipboard($("#d_clip_button"), { moviePath: "new/path" }); +client.on( 'dataRequested', function (client, args) { + client.setText( "Copy me!" ); + }); + +client.setText( "Copy me!" ); + +client.clip( document.getElementById('d_clip_button') ); + +var client = new ZeroClipboard( $("button#my-button") ); + +function my_load_handler() { + +} + +client.on( 'load', my_load_handler ); + +client.off( 'load', my_load_handler ); + +client.on( 'load', function ( client, args ) { + alert( "movie has loaded" ); +}); + +client.on( 'mouseover', function ( client, args ) { + alert( "mouse is over movie" ); +}); + +client.on( 'mouseout', function ( client, args ) { + alert( "mouse has left movie" ); +} ); + +client.on( 'mousedown', function ( client, args ) { + alert( "mouse button is down" ); +} ); + +client.on( 'mouseup', function ( client, args ) { + alert( "mouse button is up" ); +} ); + +client.on( 'complete', function ( client, args ) { + alert("Copied text to clipboard: " + args.text ); +} ); + +client.on( 'noflash', function ( client, args ) { + alert("You don't support flash"); +} ); + +client.on( 'wrongflash', function ( client, args ) { + alert("Your flash is too old " + args.flashVersion); +} ); + +client.on( 'dataRequested', function ( client, args ) { + client.setText( 'Copied to clipboard.' ); +} ); + +var client = new ZeroClipboard( $('.clip_button') ); + +client.on( 'load', function(client) { + // alert( "movie is loaded" ); + + client.on( 'datarequested', function(client) { + client.setText(this.innerHTML); + } ); + + client.on( 'complete', function(client, args) { + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +client.on( 'wrongflash noflash', function() { + ZeroClipboard.destroy(); +}); + +ZeroClipboard.config({ debug: false }); diff --git a/zeroclipboard/zeroclipboard-1.x.x.d.ts b/zeroclipboard/zeroclipboard-1.x.x.d.ts new file mode 100644 index 000000000..4305c18bc --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x.d.ts @@ -0,0 +1,79 @@ +// Type definitions for ZeroClipboard v1.x.x +// Project: https://github.com/jonrohan/ZeroClipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class ZeroClipboard { + constructor(elements?: Element | { [index: number]: Element }, options?: ZeroClipboardOptions); + + activate(element: Element): void; + setText(newText: string): void; + title(newTitle: string): void; + setSize(width: number, height: number): void; + version: string; + moviePath: string; + trustedDomains: any; + text: string; + hoverClass: string; + activeClass: string; + deactivate(): void; + ready: boolean; + reposition(): void; // returns false in some scenarios, but never returns true + on(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + off(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + clip(elements: Element | { [index: number]: Element }): void; + unclip(elements: Element | { [index: number]: Element }): void; + + + static config(options: ZeroClipboardOptions): void; + static destroy(): void; + static emit(eventName: string, args: any): void; +} + +interface ZeroClipboardOptions { + + /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ + autoActivate?: boolean; + + /** Include a "nocache" query parameter on requests for the SWF. */ + cacheBust?: boolean; + + /** Debug enabled: send console messages with deprecation warnings, etc. */ + debug?: boolean; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + forceHandCursor?: boolean; + + /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + moviePath?: string; + + /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + swfPath?: string; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + trustedDomains?: any; + + /** Sets the title of the div encapsulating the Flash object. */ + title?: string; + + /** The z-index used by the Flash object. */ + zIndex?: number; + + /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ + activeClass?: string; + + /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + hoverClass?: string; + + /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ + allowScriptAccess?: string; + + /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ + trustedOrigins?: any; + + /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ + useNoCache?: boolean; +} + +// Support AMD. +declare module "zeroclipboard" { export = ZeroClipboard; } diff --git a/zeroclipboard/zeroclipboard-tests.ts b/zeroclipboard/zeroclipboard-tests.ts new file mode 100644 index 000000000..26855210d --- /dev/null +++ b/zeroclipboard/zeroclipboard-tests.ts @@ -0,0 +1,542 @@ +/// +/// + +import ZeroClipboard = require("zeroclipboard"); +// import * as ZeroClipboard from "zeroclipboard"; + +namespace SimpleExample { + ZeroClipboard.config( { swfPath: "http://YOURSERVER/path/ZeroClipboard.swf" } ); + + let client = new ZeroClipboard(document.getElementById("copy-button")); + let client2 = new ZeroClipboard(jQuery('.copy-button')); + + client.on( "ready", function( readyEvent ) { + // alert( "ZeroClipboard SWF is ready!" ); + + client.on( "aftercopy", function( event ) { + this === client; + event.target === document.getElementById('el') + event.target.style.display = "none"; + alert("Copied text to clipboard: " + event.data["text/plain"] ); + }); + }); + + client.on( "copy", function (event) { + var clipboard = event.clipboardData; + clipboard.setData( "text/plain", "Copy me!" ); + clipboard.setData( "text/html", "Copy me!" ); + clipboard.setData( "application/rtf", "{\\rtf1\\ansi\n{\\b Copy me!}}" ); + }); + + ZeroClipboard.setData( "text/plain", "Copy me!" ); + + client.setText( "Copy me!" ); + + client.clip( document.getElementById("d_clip_button") ); + + var $client = new ZeroClipboard( $("button#my-button") ); + + function example() { + var client = new ZeroClipboard( $('.clip_button') ); + + client.on( 'ready', function(event) { + // console.log( 'movie is loaded' ); + + client.on( 'copy', function(event) { + event.clipboardData.setData('text/plain', event.target.innerHTML); + } ); + + client.on( 'aftercopy', function(event) { + console.log('Copied text to clipboard: ' + event.data['text/plain']); + } ); + } ); + + client.on( 'error', function(event) { + // console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message ); + ZeroClipboard.destroy(); + } ); + } + + ZeroClipboard.config({ + fixLineEndings: false + }); + + ZeroClipboard.config({ + forceEnhancedClipboard: true + }); + +} + +namespace Static { + var version:String = ZeroClipboard.version; + + var config = ZeroClipboard.config(); + + var swfPath:String = ZeroClipboard.config("swfPath"); + + ZeroClipboard.config({}); + + ZeroClipboard.destroy(); + + ZeroClipboard.setData("text/plain", "Blah"); + + ZeroClipboard.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + ZeroClipboard.clearData("text/plain"); + + var text:String = ZeroClipboard.getData("text/plain"); + + var dataObj = ZeroClipboard.getData(); + + ZeroClipboard.focus(document.getElementById("d_clip_button")); + + ZeroClipboard.blur(); + + var el = document.getElementById("d_clip_button"); + ZeroClipboard.focus(el); + var activeEl = ZeroClipboard.activeElement(); + activeEl === el; + + ZeroClipboard.state(); + + let b:boolean = ZeroClipboard.isFlashUnusable(); + + var listenerFn = function(e: Object) { var ZeroClipboard = this; /* ... */ }; + ZeroClipboard.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + ZeroClipboard.on("error", listenerObj); + + ZeroClipboard.on("ready error", function(e) { /* ... */ }); + + ZeroClipboard.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready", listenerFn); + ZeroClipboard.off("error", listenerObj); + + ZeroClipboard.off("ready error", listenerFn); + + ZeroClipboard.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready"); + + ZeroClipboard.off(); + + ZeroClipboard.emit("ready"); + ZeroClipboard.emit({ + type: "error", + name: "flash-disabled" + }); + + var pendingCopyData = ZeroClipboard.emit("copy"); + + var listener = ZeroClipboard.handlers("ready"); + + var listeners = ZeroClipboard.handlers(); + + var currentlyActivatedElementOrNull = document.getElementById('currentlyActivatedElementOrNull'); + var dataClipboardElementTargetOfCurrentlyActivatedElementOrNull = document.getElementById('dataClipboardElementTargetOfCurrentlyActivatedElementOrNull') + var flashSwfObjectRef = document.getElementById('flashSwfObjectRef') as HTMLObjectElement; + + ZeroClipboard.on("ready", function(e) { + e = { + type: "ready", + message: "Flash communication is established", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + version: "11.2.202", + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("beforecopy", function(e) { + e = { + type: "beforecopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("copy", function(e) { + e.clipboardData.setData('text/html','
'); + e.clipboardData.setData({'text/html':'
'}); + e = { + type: "copy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + clipboardData: { + setData: ZeroClipboard.setData, + clearData: ZeroClipboard.clearData + } + }; + }); + + + ZeroClipboard.on("aftercopy", function(e) { + e = { + type: "aftercopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("destroy", function(e) { + e = { + type: "destroy", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + } + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-disabled", + message: "Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-sandboxed", + message: "Attempting to run Flash in a sandboxed iframe, which is impossible", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-unavailable", + message: "Flash is unable to communicate bidirectionally with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-degraded", + message: "Flash is unable to preserve data fidelity when communicating with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-deactivated", + message: "Flash is too outdated for your browser and/or is configured as click-to-activate. This may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-overdue", + message: "Flash communication was established but NOT within the acceptable time limit", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "version-mismatch", + message: "ZeroClipboard JS version number does not match ZeroClipboard SWF version number", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + jsVersion: "2.2.1", + swfVersion: "2.2.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "clipboard-error", + message: "At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "config-mismatch", + message: "ZeroClipboard configuration does not match Flash's reality", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + property: "swfObjectId", + configuredValue: "my-zeroclipboard-object", + actualValue: "global-zeroclipboard-flash-bridge" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "swf-not-found", + message: "The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); +} + +namespace Instance { + var clippedEl = document.getElementById("d_clip_button"); + var client = new ZeroClipboard(clippedEl); + + client.setText("Blah"); + + client.setHtml("Blah"); + + client.setRichText("{\\rtf1\\ansi\n{\\b Blah}}"); + + client.setData("text/plain", "Blah"); + client.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + client.clearData("text/plain"); + client.clearData(); + + var text:String = client.getData("text/plain"); + var dataObj = client.getData(); + + client.clip(document.getElementById("d_clip_button")) + client.clip(document.querySelectorAll(".clip_button")); + client.clip(jQuery(".clip_button")); + + client.unclip(document.getElementById("d_clip_button")) + client.unclip(document.querySelectorAll(".clip_button")); + client.unclip(jQuery(".clip_button")); + client.unclip(); + + var els:HTMLElement[] = client.elements(); + + var listenerFn = function(e: Object) { var client = this; /* ... */ }; + client.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + client.on("error", listenerObj); + + client.on("ready error", function(e) { /* ... */ }); + + client.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready", listenerFn); + client.off("error", listenerObj); + + client.off("ready error", listenerFn); + + client.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready"); + + client.off(); + + client.emit("ready"); + client.emit({ + type: "error", + name: "flash-disabled" + }); + + var readyListeners = client.handlers("ready"); + + var listeners = client.handlers(); + + var client = new ZeroClipboard(); + client.on("ready", function(e) { + if (e.client === client && client === this) { + console.log("This client instance is ready!"); + } + }); +} + +namespace GlobalConfig { + var _globalConfig = { + + // SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" + // under the same path as the ZeroClipboard JS file. + swfPath: '_swfPath', + + // SWF inbound scripting policy: page domains that the SWF should trust. + // (single string, or array of strings) + trustedDomains: window.location.host ? [window.location.host] : [], + + // Include a "noCache" query parameter on requests for the SWF. + cacheBust: true, + + // Enable use of the fancy "Desktop" clipboard, even on Linux where it is + // known to suck. + forceEnhancedClipboard: false, + + // How many milliseconds to wait for the Flash SWF to load and respond before assuming that + // Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + // how long it takes to load the SWF, you can set this to `null`. + flashLoadTimeout: 30000, + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + // themselves instead of relying on our per-element `mouseover` handler. + autoActivate: true, + + // Bubble synthetic events in JavaScript after they are received by the Flash object. + bubbleEvents: true, + + // Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + fixLineEndings: true, + + // Sets the ID of the `div` encapsulating the Flash object. + // Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + containerId: "global-zeroclipboard-html-bridge", + + // Sets the class of the `div` encapsulating the Flash object. + containerClass: "global-zeroclipboard-container", + + // Sets the ID and name of the Flash `object` element. + // Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + swfObjectId: "global-zeroclipboard-flash-bridge", + + // The class used to indicate that a clipped element is being hovered over. + hoverClass: "zeroclipboard-is-hover", + + // The class used to indicate that a clipped element is active (is being clicked). + activeClass: "zeroclipboard-is-active", + + + + // Forcibly set the hand cursor ("pointer") for all clipped elements. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + forceHandCursor: false, + + // Sets the title of the `div` encapsulating the Flash object. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + title: 'title', + + // The z-index used by the Flash object. + // Max value (32-bit): 2147483647. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + zIndex: 999999999 + + }; + + ZeroClipboard.config(_globalConfig); + +} diff --git a/zeroclipboard/zeroclipboard.d.ts b/zeroclipboard/zeroclipboard.d.ts index 6db1ba180..2a192a71e 100644 --- a/zeroclipboard/zeroclipboard.d.ts +++ b/zeroclipboard/zeroclipboard.d.ts @@ -1,75 +1,505 @@ -// Type definitions for ZeroClipboard -// Project: https://github.com/jonrohan/ZeroClipboard -// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Type definitions for ZeroClipboard v2.x.x +// Project: https://github.com/zeroclipboard/zeroclipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class ZeroClipboard { - constructor(elements?: any, options?: ZeroClipboardOptions); - activate(element: any): void; - setText(newText: string): void; - title(newTitle: string): void; - setSize(width: number, height: number): void; +declare namespace ZC { + // Basic collection types for shorthands and interoperation + interface List { [index: number]: T; length: number; } + interface Dictionary { [key: string]: T; } + + // Generic version EventHandler containers. + // Mimicking native interfaces in lib.dom.d.ts of the same name. + interface EventListener { (ev: T): void; } + interface EventListenerObject { handleEvent(ev: T): void; } + type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + + export interface ZeroClipboardStatic extends ZeroClipboardCommon { + new(elements?: Element | List): ZeroClipboardClient; + + /** + * The version of the ZeroClipboard library being used, e.g. "2.0.0". + * @type {string} + */ version: string; - moviePath: string; - trustedDomains: any; - text: string; - hoverClass: string; - activeClass: string; + /** + * Get a copy of the active configuration for ZeroClipboard. + * @return {ZeroClipboardConfig} + */ + config(): ZeroClipboardConfig; + /** + * Get a copy of the actively configured value for this configuration property for ZeroClipboard. + * @param {string} propName + * @return {any} + */ + config(propName: string): any; + config(propName: "swfPath"): string; + config(propName: "trustedDomains"): string[]; + config(propName: "cacheBust"): boolean; + config(propName: "forceEnhancedClipboard"): boolean; + config(propName: "flashLoadTimeout"): number; + config(propName: "autoActivate"): boolean; + config(propName: "bubbleEvents"): boolean; + config(propName: "fixLineEndings"): boolean; + config(propName: "containerId"): string; + config(propName: "containerClass"): string; + config(propName: "swfObjectId"): string; + config(propName: "hoverClass"): string; + config(propName: "activeClass"): string; + config(propName: "forceHandCursor"): boolean; + config(propName: "title"): string; + config(propName: "zIndex"): number; + /** + * Set the active configuration for ZeroClipboard. Returns a copy of the updated active configuration. + * @param {ZeroClipboardConfig} config + * @return {ZeroClipboardConfig} + */ + config(config: ZeroClipboardConfig): ZeroClipboardConfig; + /** + * Create the Flash bridge SWF object. + * IMPORTANT: This method should be considered private. + * @private + */ + create(): void; + /** + * Emit the "destroy" event, remove all event handlers, and destroy the Flash bridge. + */ + destroy(): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @since 2.1.0 + */ + focus(element: Element): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @deprecated: The preferred method to use is focus but the alias activate is available for backward compatibility's sake. + */ + activate(element: Element): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @since 2.1.0 + */ + blur(): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @deprecated: The preferred method to use is blur but the alias deactivate is available for backward compatibility's sake. + */ deactivate(): void; - ready: boolean; - reposition(): void; // returns false in some scenarios, but never returns true - on(eventName: string, func: Function): void; - off(eventName: string, func: Function): void; - clip(elements: any): void; - unclip(elements: any): void; - static config(options: ZeroClipboardOptions): void; - static destroy(): void; - static emit(eventName: string, args: any): void; -} + /** + * Return the currently "activated" element that the Flash SWF object is in front of it. + * @return {HTMLElement} or {null} + */ + activeElement(): HTMLElement; + /** + * Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard. + * @return {Object} + */ + state(): Object; + /** + * Indicates if Flash Player is definitely unusable (disabled, outdated, unavailable, or deactivated). + * IMPORTANT: This method should be considered private. + * @return {boolean} + * @private + */ + isFlashUnusable(): boolean; + } -interface ZeroClipboardOptions { - /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ - autoActivate?: boolean; + interface ZeroClipboardClient extends ZeroClipboardCommon { + /** + * A unique identifier for this ZeroClipboard client instance. + * @type {string} + */ + id: string; + /** + * Remove all event handlers and unclip all clipped elements. + */ + destroy(): void; + /** + * Set the pending data of type "text/plain" for clipboard injection. + * @param {string} data + */ + setText(data: string): void; + /** + * Set the pending data of type "text/html" for clipboard injection. + * @param {string} data + */ + setHtml(data: string): void; + /** + * Set the pending data of type "application/rtf" for clipboard injection. + * @param {string} data + */ + setRichText(data: string): void; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + clip(elements: List): ZeroClipboardClient; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + clip(element: Element): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + unclip(elements: List): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + unclip(elements?: Element): ZeroClipboardClient; + /** + * Get all of the elements to which this client is clipped/registered. + * @return {HTMLElement[]} + */ + elements(): HTMLElement[]; + } - /** Include a "nocache" query parameter on requests for the SWF. */ - cacheBust?: boolean; + interface ZeroClipboardEvent { + client?: ZeroClipboardClient; + type: string; + target: HTMLElement; + relatedTarget: HTMLElement; + currentTarget: HTMLObjectElement; + timeStamp: number; + } - /** Debug enabled: send console messages with deprecation warnings, etc. */ - debug?: boolean; + interface ZeroClipboardReadyEvent extends ZeroClipboardEvent { + message: string; + version: string; + } - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - forceHandCursor?: boolean; + interface ZeroClipboardBeforeCopyEvent extends ZeroClipboardEvent { - /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ - moviePath?: string; + } - /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + interface ZeroClipboardCopyEvent extends ZeroClipboardEvent { + clipboardData: { + setData(format: string, data: string): void; + setData(data: Dictionary): void; + clearData(mimeType?: string): void; + }; + } + + interface ZeroClipboardAfterCopyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + errors: any[]; + } + + interface ZeroClipboardDestroyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + } + + interface ZeroClipboardErrorEvent extends ZeroClipboardEvent { + name: string; + message: string; + minimumVersion?: string; + version?: string; + jsVersion?: string; + swfVersion?: string; + property?: string; + configuredValue?: string; + actualValue?: string; + data?: Dictionary; + errors?: any[]; + } + + interface ZeroClipboardCommon { + /** + * Set the pending data of type format for clipboard injection. + * @param {string} format + * @param {string} data + */ + setData(format: string, data: string): void; + /** + * Set the pending data of various formats for clipboard injection. This particular function signature (passing in + * an Object) will implicitly clear out any existing pending data. + * @param {Dictionary} data + */ + setData(data: Dictionary): void; + /** + * Clear the pending data of type format for clipboard injection. + * @param {string} mimeType + */ + clearData(mimeType: string): void; + /** + * Clear the pending data of ALL formats for clipboard injection. + */ + clearData(): void; + /** + * Get the pending data of type format for clipboard injection. + * @param {string} format + * @return {string} + * @since 2.1.0 + */ + getData(format: string): string; + /** + * Get a copy of the pending data of ALL formats for clipboard injection. + * @return {Dictionary} + * @since 2.1.0 + */ + getData(): Dictionary; + /** + * Add a listener function/object for an eventType. If called as a client method will be within the client instance. + * @param {string} eventType + * @param {EventListener} listener + */ + on(eventType: string, listener: EventListenerOrEventListenerObject): void; + /** + * The ready event is fired when the Flash SWF completes loading and is ready for action. Please note that you need + * to set most configuration options [with ZeroClipboard.config(...)] before ZeroClipboard.create() is invoked. + * @param {"ready"} eventType + * @param {EventListener} listener + */ + on(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + /** + * On click, the Flash object will fire off a beforecopy event. This event is generally only used for "UI + * preparation" if you want to alter anything before the copy event fires. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before + * the "copy" event is triggered. + * @param {"beforecopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + /** + * On click (and after the beforecopy event), the Flash object will fire off a copy event. If the HTML object has + * data-clipboard-text or data-clipboard-target, then ZeroClipboard will take care of getting an initial set of + * data. It will then invoke any copy event handlers, in which you can call event.clipboardData.setData to set the + * text, which will complete the loop. + * IMPORTANT: If a handler of this event intends to modify the pending data for clipboard injection, it MUST + * operate synchronously in order to maintain the temporarily elevated permissions granted by the user's click + * event. The most common "gotcha" for this restriction is if someone wants to make an asynchronous XMLHttpRequest + * in response to the copy event to get the data to inject - this won't work; make it a synchronous XMLHttpRequest + * instead, or do the work in advance before the copy event is fired. + * @param {"copy"} eventType + * @param {EventListener} listener + */ + on(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + /** + * The aftercopy event is fired when the text is copied [or failed to copy] to the clipboard. + * @param {"aftercopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + /** + * The destroy event is fired when ZeroClipboard.destroy() is invoked. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before the + * destruction is complete. + * @param {"destroy"} eventType + * @param {EventListener} listener + */ + on(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + /** + * The error event is fired under a number of conditions, which will be detailed as sub-sections. Some consumers + * may not consider all error types to be critical, and thus ZeroClipboard does not take it upon itself to implode + * by calling ZeroClipboard.destroy() under error conditions. However, many consumers may want to do just that. + * @param {"error"} eventType + * @param {EventListener} listener + */ + on(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Add a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + on(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove a listener function/object for an eventType. + * @param {string} eventType + * @param {EventListener} listener + */ + off(eventType: string, listener: EventListenerOrEventListenerObject): void; + off(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + off(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Remove a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + off(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove ALL listener functions/objects for ALL registered event types. + */ + off(): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} eventType + * @return {any} + */ + emit(eventType: string): any; + emit(eventType: "ready"): void; + emit(eventType: "beforecopy"): void; + emit(eventType: "copy"): any; + emit(eventType: "aftercopy"): void; + emit(eventType: "destroy"): void; + emit(eventType: "error"): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} data + * @param {string} name + * @return {any} + */ + emit(data: {type: string, name: string}): any; + /** + * Retrieves a copy of the registered listener functions/objects for the given eventType. + * @param {string} eventType + * @return {EventListener} + */ + handlers(eventType: string): EventListenerOrEventListenerObject[]; + handlers(eventType: "ready"): EventListenerOrEventListenerObject[]; + handlers(eventType: "beforecopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "copy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "aftercopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "destroy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "error"): EventListenerOrEventListenerObject[]; + /** + * Retrieves a copy of the map of registered listener functions/objects for ALL event types. + * @return {Object} + */ + handlers(): { + ready?: EventListenerOrEventListenerObject[]; + beforecopy?: EventListenerOrEventListenerObject[]; + copy?: EventListenerOrEventListenerObject[]; + aftercopy?: EventListenerOrEventListenerObject[]; + destroy?: EventListenerOrEventListenerObject[]; + error?: EventListenerOrEventListenerObject[]; + }; + } + + interface ZeroClipboardConfig { + /** + * SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" under the same path as the ZeroClipboard JS file. + * @type {string} + */ swfPath?: string; - - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - trustedDomains?: any; - - /** Sets the title of the div encapsulating the Flash object. */ - title?: string; - - /** The z-index used by the Flash object. */ - zIndex?: number; - - /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ - activeClass?: string; - - /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + /** + * SWF inbound scripting policy: page domains that the SWF should trust. (single string, or array of strings) + * @type {SingleOrList} + */ + trustedDomains?: string[]; + /** + * Include a "noCache" query parameter on requests for the SWF. + * @type {boolean} + */ + cacheBust?: boolean; + /** + * Enable use of the fancy "Desktop" clipboard, even on Linux where it is known to suck. + * @type {boolean} + */ + forceEnhancedClipboard?: boolean; + /** + * How many milliseconds to wait for the Flash SWF to load and respond before assuming that + * Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + * how long it takes to load the SWF, you can set this to `null`. + * @type {number} + */ + flashLoadTimeout?: number; + /** + * Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + * themselves instead of relying on our per-element `mouseover` handler. + * @type {boolean} + */ + autoActivate?: boolean; + /** + * Bubble synthetic events in JavaScript after they are received by the Flash object. + * @type {boolean} + */ + bubbleEvents?: boolean; + /** + * Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + * @type {boolean} + */ + fixLineEndings?: boolean; + /** + * Sets the ID of the `div` encapsulating the Flash object. + * Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + * @type {string} + */ + containerId?: string; + /** + * Sets the class of the `div` encapsulating the Flash object. + * @type {string} + */ + containerClass?: string; + /** + * Sets the ID and name of the Flash `object` element. + * Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + * @type {string} + */ + swfObjectId?: string; + /** + * The class used to indicate that a clipped element is being hovered over. + * @type {string} + */ hoverClass?: string; - - /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ - allowScriptAccess?: string; - - /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ - trustedOrigins?: any; - - /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ - useNoCache?: boolean; + /** + * The class used to indicate that a clipped element is active (is being clicked). + * @type {string} + */ + activeClass?: string; + /** + * Forcibly set the hand cursor ("pointer") for all clipped elements. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {boolean} + */ + forceHandCursor?: boolean; + /** + * Sets the title of the `div` encapsulating the Flash object. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {string} + */ + title?: string; + /** + * The z-index used by the Flash object. + * Max value (32-bit): 2147483647. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {number} + */ + zIndex?: number; + } } -// Support AMD. -declare module "zeroclipboard" { export = ZeroClipboard; } +/** + * [ZeroClipboard description] + * @type {ZC.ZeroClipboardStatic} + */ +declare var ZeroClipboard: ZC.ZeroClipboardStatic; + +/** + * AMD and CommonJS module `zeroclipboard` + * @module + */ +declare module "zeroclipboard" { + export = ZeroClipboard; +}