From 86e15b1d9d399b5ac2dddb3ac7e8458e8459aba6 Mon Sep 17 00:00:00 2001 From: Kamil Rojewski Date: Tue, 4 Apr 2017 14:19:40 +0200 Subject: [PATCH 001/506] Uint support --- types/flatbuffers/index.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/types/flatbuffers/index.d.ts b/types/flatbuffers/index.d.ts index e813ab461b..1342acdf15 100644 --- a/types/flatbuffers/index.d.ts +++ b/types/flatbuffers/index.d.ts @@ -498,24 +498,48 @@ declare namespace flatbuffers { */ writeInt8(offset: number, value: number): void; + /** + * @param {number} offset + * @param {number} value + */ + writeUint8(offset: number, value: number): void; + /** * @param {number} offset * @param {number} value */ writeInt16(offset: number, value: number): void; + /** + * @param {number} offset + * @param {number} value + */ + writeUint16(offset: number, value: number): void; + /** * @param {number} offset * @param {number} value */ writeInt32(offset: number, value: number): void; + /** + * @param {number} offset + * @param {number} value + */ + writeUint32(offset: number, value: number): void; + /** * @param {number} offset * @param {flatbuffers.Long} value */ writeInt64(offset: number, value: Long): void; + /** + * @param {number} offset + * @param {flatbuffers.Long} value + */ + writeUint64(offset: number, value: Long): void; + /** * @param {number} offset * @param {number} value From e5545e729bb7b6c76816800e9d39ccdd21b147fa Mon Sep 17 00:00:00 2001 From: "Andrew Stiegmann (stieg)" Date: Thu, 18 Jan 2018 15:56:13 -1000 Subject: [PATCH 002/506] Add `usePushEach` flag to Mongoose Schema Options In order for devs to be able to work around the issues described in https://github.com/Automattic/mongoose/issues/5574 we need to be able to supply the `usePushEach` flag to the Mongoose SchemaOptions. This options functionality is described in https://github.com/Automattic/mongoose/issues/4455 and is required for anyone who modifies arrays inline who is using Mongoose 4 and MongoDB 3.6+ Testing: Copied changes to local project and verified compilation worked. --- types/mongoose/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 3e676b499f..ee703de783 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -815,6 +815,8 @@ declare module "mongoose" { typeKey?: string; /** defaults to false */ useNestedStrict?: boolean; + /** defaults to false */ + usePushEach?: boolean; /** defaults to true */ validateBeforeSave?: boolean; /** defaults to "__v" */ From bd2218b6f6f1449636dbd32a5458c65be4ccb54b Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Mon, 12 Mar 2018 20:30:25 +1100 Subject: [PATCH 003/506] [WIP] Next.js Context Object type --- types/next/index.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..3ebcb9b395 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -6,11 +6,23 @@ // TypeScript Version: 2.6 /// +/// import * as http from "http"; import * as url from "url"; +import * as fetch from "isomorphic-unfetch"; declare namespace next { + interface NextContext { + pathname?: string; //path section of URL + query?: any; // meant to be an object - // query string section of URL parsed as an object + asPath?: string; // String of the actual path (including the query) shows in the browser + req?: http.IncomingMessage; //HTTP request object (server only) + res?: http.ServerResponse; //HTTP response object (server only) + jsonPageRes?: fetch.IsomorphicResponse; //Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response + err?: Error; //Error object if any error is encountered during the rendering + } + type UrlLike = url.UrlObject | url.Url; interface ServerConfig { From bcf98ec1f542feb91866a95818824960ec0c796f Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Mon, 12 Mar 2018 20:38:23 +1100 Subject: [PATCH 004/506] add self to receive update notifications --- types/next/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 3ebcb9b395..a6cf91ddc6 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD +// James Hegedus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 From 4b0b64bd58aa00102f3f081a84fcc695378257c8 Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Mon, 12 Mar 2018 20:43:21 +1100 Subject: [PATCH 005/506] fix some lint errors and answer qs from PR template --- types/next/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index a6cf91ddc6..77cea7062d 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for next 2.4 +// Type definitions for next 5.0 // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD @@ -7,21 +7,21 @@ // TypeScript Version: 2.6 /// -/// import * as http from "http"; import * as url from "url"; import * as fetch from "isomorphic-unfetch"; declare namespace next { + // <> interface NextContext { - pathname?: string; //path section of URL + pathname?: string; // path section of URL query?: any; // meant to be an object - // query string section of URL parsed as an object asPath?: string; // String of the actual path (including the query) shows in the browser - req?: http.IncomingMessage; //HTTP request object (server only) - res?: http.ServerResponse; //HTTP response object (server only) - jsonPageRes?: fetch.IsomorphicResponse; //Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response - err?: Error; //Error object if any error is encountered during the rendering + req?: http.IncomingMessage; // HTTP request object (server only) + res?: http.ServerResponse; // HTTP response object (server only) + jsonPageRes?: fetch.IsomorphicResponse; // Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response + err?: Error; // Error object if any error is encountered during the rendering } type UrlLike = url.UrlObject | url.Url; From ed99f72403ef6aacba6ffe81ab14f65ee74a91ee Mon Sep 17 00:00:00 2001 From: Craig Bruce Date: Fri, 23 Mar 2018 14:15:59 +1100 Subject: [PATCH 006/506] Initial commit of cast types --- .../cast.framework.breaks.d.ts | 110 + .../cast.framework.d.ts | 773 +++++++ .../cast.framework.events.d.ts | 421 ++++ .../cast.framework.messages.d.ts | 1777 +++++++++++++++++ .../cast.framework.system.d.ts | 177 ++ .../cast.framework.ui.d.ts | 194 ++ .../chromecast-caf-receiver-tests.ts | 66 + types/chromecast-caf-receiver/index.d.ts | 25 + types/chromecast-caf-receiver/tsconfig.json | 22 + types/chromecast-caf-receiver/tslint.json | 1 + 10 files changed, 3566 insertions(+) create mode 100644 types/chromecast-caf-receiver/cast.framework.breaks.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.events.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.messages.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.system.d.ts create mode 100644 types/chromecast-caf-receiver/cast.framework.ui.d.ts create mode 100644 types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts create mode 100644 types/chromecast-caf-receiver/index.d.ts create mode 100644 types/chromecast-caf-receiver/tsconfig.json create mode 100644 types/chromecast-caf-receiver/tslint.json diff --git a/types/chromecast-caf-receiver/cast.framework.breaks.d.ts b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts new file mode 100644 index 0000000000..4fed094a12 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.breaks.d.ts @@ -0,0 +1,110 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { Break, BreakClip } from './cast.framework.messages'; + +export = cast.framework.breaks; + +declare namespace cast.framework.breaks { + export class BreakSeekData { + constructor(seekFrom: number, seekTo: number, breaks: Break[]); + + /** + * List of breaks + */ + breaks: Break[]; + + /** + * Current playback time + */ + seekFrom: number; + + /** + * The time to seek to + */ + seekTo: number; + } + + /** Provide context information for break clip load interceptor. */ + export class BreakClipLoadInterceptorContext { + constructor(brk: Break); + + /** + * The container break for the break clip + */ + break: Break; + } + + /** Interface to manage breaks */ + export interface BreakManager { + /** + * Get current media break by id. + * @param {*} id + */ + getBreakById(id: string): Break; + + /** + * Get current media break clip by id + * @param {*} id + */ + getBreakClipById(id: string): BreakClip; + + /** Get current media break clips. */ + getBreakClips(): BreakClip[]; + + /** Get current media breaks. */ + getBreaks(): Break[]; + + /** Returns true if watched breaks should be played. */ + getPlayWatchedBreak(): boolean; + + /** + * Provide an interceptor to allow developer to insert more break clips or modify current break clip before a break is started. + * If interceptor is null it will reset the interceptor to default one. + * By default VAST fetching and parsing logic in default interceptor. + * So if customized interceptor is set by developer; + * the VAST logic will be overridden and developers should implement their own VAST fetching and parsing logic in the provided interceptor. + * @param {*} interceptor + */ + setBreakClipLoadInterceptor( + interceptor: ( + breakClip: BreakClip, + breakClipLoaderContext?: BreakClipLoadInterceptorContext + ) => void + ): void; + + /** + * Provide an interceptor for developer to specify what breaks they want to play after seek. + * @param {*} seekInterceptor + */ + setBreakSeekInterceptor( + seekInterceptor: (breakSeekData: BreakSeekData) => void + ): void; + + /** + * Set a flag to control if the watched client stitching break should be played. + * @param {*} playWatchedBreak + */ + setPlayWatchedBreak(playWatchedBreak: boolean): void; + + /** + * Provide an interceptor to modify VAST tracking URL before it is being sent to server. + * The input of the interceptor is a string of the tracking URL. + * The interceptor can either return a modified string of URL or a Promise of modified string of URL. + * The interceptor can also return null if you want to send the tracking URL by your own code instead of by CAF. + * @param {*} interceptor + */ + setVastTrackingInterceptor( + interceptor?: (trackingUrl: string) => void + ): void; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.d.ts b/types/chromecast-caf-receiver/cast.framework.d.ts new file mode 100644 index 0000000000..a22e9a24b9 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.d.ts @@ -0,0 +1,773 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { EventType } from './cast.framework.events'; +import { + PlayerState, + PlayStringId, + ErrorType, + ErrorReason, + IdleReason, + MessageType, + Track, + TextTrackStyle, + QueueItem, + LoadRequestData, + QueueData, + Break, + LiveSeekableRange, + MediaInformation, + ErrorData, + RequestData, +} from './cast.framework.messages'; +import { BreakManager } from './cast.framework.breaks'; +import { EventHandler, RequestHandler, BinaryHandler } from './cast'; +import { + ApplicationData, + Sender, + StandbyState, + SystemState, +} from './cast.framework.system'; + +export = cast.framework; + +declare namespace cast.framework { + export type LoggerLevel = + | 'DEBUG' + | 'VERBOSE' + | 'INFO' + | 'WARNING' + | 'ERROR' + | 'NONE'; + + export type ContentProtection = + | 'NONE' + | 'CLEARKEY' + | 'PLAYREADY' + | 'WIDEVINE'; + + /** + * Manages text tracks. + */ + export class TextTracksManager { + constructor(params: any); + + /** + * Adds text tracks to the list. + */ + addTracks(tracks: Track[]): void; + + /** + * Creates a text track. + */ + createTrack(): Track; + + /** + * Gets all active text ids. + */ + getActiveIds(): number[]; + + /** + * Gets all active text tracks. + */ + getActiveTracks(): Track[]; + + /** + * Returns the current text track style. + */ + getTextTracksStyle(): TextTrackStyle; + + /** + * Gets text track by id. + */ + getTrackById(id: number): Track; + + /** + * Returns all text tracks. + */ + getTracks(): Track[]; + + /** + * Gets text tracks by language. + */ + getTracksByLanguage(language: string): Track[]; + + /** + * Sets text tracks to be active by id. + */ + setActiveByIds(newIds: number[]): void; + + /** + * Sets text tracks to be active by language. + */ + setActiveByLanguage(language: string): void; + + /** + * Sets text track style. + */ + setTextTrackStyle(style: TextTrackStyle): void; + } + + /** + * QueueManager exposes several queue manipulation APIs to developers. + */ + export class QueueManager { + constructor(params: any); + + /** + * Returns the current queue item. + */ + getCurrentItem(): QueueItem; + + /** + * Returns the index of the current queue item. + */ + getCurrentItemIndex(): number; + + /** + * Returns the queue items. + */ + getItems(): QueueItem[]; + + /** + * Inserts items into the queue. + */ + insertItems(items: QueueItem[], insertBefore?: number): void; + + /** + * Removes items from the queue. + */ + removeItems(itemIds: number[]): void; + + /** + * Sets whether to limit the number of queue items to be reported in Media Status (default is true). + */ + setQueueStatusLimit(limitQueueItemsInStatus: boolean): void; + + /** + * Updates existing queue items by matching itemId. + */ + updateItems(items: QueueItem[]): void; + } + + /** + * Base implementation of a queue. + */ + export class QueueBase { + /** + * Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items; often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned. + */ + fetchItems( + itemId: number, + nextCount: number, + prevCount: number + ): QueueItem[] | Promise; + + /** + * Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver. If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media in the load request data. + */ + initialize(requestData: LoadRequestData): QueueData | Promise; + + /** + * Returns next items after the reference item; often the end of the current queue; called by the receiver MediaManager. + */ + nextItems(itemId?: number): QueueItem[] | Promise; + + /** + * Sets the current item with the itemId; called by the receiver MediaManager when it changes the current playing item. + */ + onCurrentItemIdChanged(itemId: number): void; + + /** + * A callback for informing the following items have been inserted into the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + */ + onItemsInserted(items: QueueItem[], insertBefore?: number): void; + + /** + * A callback for informing the following items have been removed from the receiver queue in this session. A cloud based implementation can optionally choose to update its queue based on the new information. + */ + onItemsRemoved(itemIds: number[]): void; + + /** + * Returns previous items before the reference item; often at the beginning of the queue; called by the receiver MediaManager. + */ + prevItems(itemId?: number): QueueItem[] | Promise; + + /** + * Shuffles the queue and returns new queue items. Returns null if the operation is not supported. + */ + shuffle(): QueueItem[] | Promise; + } + + /** + * Controls and monitors media playback. + */ + export class PlayerManager { + constructor(params: any); + + /** + * Adds an event listener for player event. + */ + addEventListener: ( + eventType: EventType | EventType[], + eventListener: EventHandler + ) => void; + + /** + * Sends a media status message to all senders (broadcast). Applications use this to send a custom state change. + */ + broadcastStatus( + includeMedia?: boolean, + requestId?: number, + customData?: any, + includeQueueItems?: boolean + ): void; + + /** + * + */ + getAudioTracksManager(): AudioTracksManager; + + /** + * Returns current time in sec in currently-playing break clip. + */ + getBreakClipCurrentTimeSec(): number; + + /** + * Returns duration in sec of currently-playing break clip. + */ + getBreakClipDurationSec(): number; + + /** + * Obtain the breaks (Ads) manager. + */ + getBreakManager(): BreakManager; + + /** + * Returns list of breaks. + */ + getBreaks(): Break[]; + + /** + * Gets current time in sec of current media. + */ + getCurrentTimeSec(): number; + + /** + * Gets duration in sec of currently playing media. + */ + getDurationSec(): number; + + /** + * Returns live seekable range with start and end time in seconds. The values are media time based. + */ + getLiveSeekableRange(): LiveSeekableRange; + + /** + * Gets media information of current media. + */ + getMediaInformation(): MediaInformation; + + /** + * Returns playback configuration. + */ + getPlaybackConfig(): PlaybackConfig; + + /** + * Returns current playback rate. + */ + getPlaybackRate(): number; + + /** + * Gets player state. + */ + getPlayerState(): PlayerState; + + /** + * Get the preferred playback rate. (Can be used on shutdown event to save latest preferred playback rate to a persistent storage; so it can be used in next session in the cast options). + */ + getPreferredPlaybackRate(): number; + + /** + * Get the preferred text track language. + */ + getPreferredTextLanguage(): string; + + /** + * Obtain QueueManager API. + */ + getQueueManager(): QueueManager; + + /** + * + */ + getTextTracksManager(): TextTracksManager; + + /** + * Loads media. + */ + load(loadRequest: LoadRequestData): Promise; + + /** + * Pauses currently playing media. + */ + pause(): void; + + /** + * Plays currently paused media. + */ + play(): void; + + /** + * Requests a text string to be played back locally on the receiver device. + */ + playString(stringId: PlayStringId, args?: string[]): Promise; + + /** + * Request Google Assistant to refresh the credentials. Only works if the original credentials came from the assistant. + */ + refreshCredentials(): Promise; + + /** + * Removes the event listener added for given player event. If event listener is not added; it will be ignored. + */ + removeEventListener( + eventType: EventType | EventType[], + eventListener: EventHandler + ): void; + + /** + * Seeks in current media. + */ + seek(seekTime: number): void; + + /** + * Sends an error to a specific sender + */ + sendError( + senderId: string, + requestId: number, + type: ErrorType, + reason?: ErrorReason, + customData?: any + ): void; + + /** + * Send local media request. + */ + sendLocalMediaRequest(request: RequestData): void; + + /** + * Sends a media status message to a specific sender. + */ + sendStatus( + senderId: string, + requestId: number, + includeMedia?: boolean, + customData?: any, + includeQueueItems?: boolean + ): void; + + /** + * Sets the IDLE reason. This allows applications that want to force the IDLE state to indicate the reason that made the player going to IDLE state (a custom error; for example). The idle reason will be sent in the next status message. NOTE: Most applications do not need to set this value; it is only needed if they want to make the player go to IDLE in special circumstances and the default idleReason does not reflect their intended behavior. + */ + setIdleReason(idleReason: IdleReason): void; + + /** + * Sets MediaElement to use. If Promise of MediaElement is set; media begins playback after Promise is resolved. + */ + setMediaElement(mediaElement: HTMLMediaElement): void; + + /** + * Sets media information. + */ + setMediaInformation( + mediaInformation: MediaInformation, + opt_broadcast?: boolean + ): void; + + /** + * Sets a handler to return or modify PlaybackConfig; for a specific load request. The handler paramaters are the load request data and default playback config for the receiver (provided in the context options). The handler should returns a modified playback config; or null to prevent the media from playing. The return value can be a promise to allow waiting for data from the server. + */ + setMediaPlaybackInfoHandler( + handler: ( + loadRequestData: LoadRequestData, + playbackConfig: PlaybackConfig + ) => void + ): void; + + /** + * Sets a handler to return the media url for a load request. This handler can be used to avoid having the media content url published as part of the media status. By default the media contentId is used as the content url. + */ + setMediaUrlResolver( + resolver: (loadRequestData: LoadRequestData) => void + ): void; + + /** + * Provide an interceptor of incoming and outgoing messages. The interceptor can update the request data; and return updated data; a promise of updated data if need to get more data from the server; or null if the request should not be handled. Note that if load message interceptor is provided; and no interceptor is provided for preload - the load interceptor will be called for preload messages. + */ + setMessageInterceptor( + type: MessageType, + interceptor: (requestData: RequestData) => Promise + ): void; + + /** + * Sets playback configuration on the PlayerManager. + */ + setPlaybackConfig(playbackConfig: PlaybackConfig): void; + + /** + * Set the preferred playback rate for follow up load or media items. The preferred playback rate will be updated automatically to the latest playback rate that was provided by a load request or explicit set of playback rate. + */ + setPreferredPlaybackRate(preferredPlaybackRate: number): void; + + /** + * Set the preferred text track language. The preferred text track language will be updated automatically to the latest enabled language by a load request or explicit change to text tracks. (Should be called only in idle state; and Will only apply to next loaded media). + */ + setPreferredTextLanguage(preferredTextLanguage: string): void; + + /** + * Stops currently playing media. + */ + stop(): void; + } + + /** + * Configuration to customize playback behavior. + */ + export class PlaybackConfig { + /** + * Duration of buffered media in seconds to start buffering. + */ + autoPauseDuration?: number; + + /** + * Duration of buffered media in seconds to start/resume playback after auto-paused due to buffering. + */ + autoResumeDuration?: number; + + /** + * Minimum number of buffered segments to start/resume playback. + */ + autoResumeNumberOfSegments?: number; + + /** + * A function to customize request to get a caption segment. + */ + captionsRequestHandler?: RequestHandler; + + /** + * Initial bandwidth in bits in per second. + */ + initialBandwidth?: number; + + /** + * Custom license data. + */ + licenseCustomData?: string; + + /** + * Handler to process license data. The handler is passed the license data; and returns the modified license data. + */ + licenseHandler?: BinaryHandler; + + /** + * A function to customize request to get a license. + */ + licenseRequestHandler?: RequestHandler; + + /** + * Url for acquiring the license. + */ + licenseUrl?: string; + + /** + * Handler to process manifest data. The handler is passed the manifest; and returns the modified manifest. + */ + manifestHandler?: (manifest: string) => string; + + /** + * A function to customize request to get a manifest. + */ + manifestRequestHandler?: RequestHandler; + + /** + * Preferred protection system to use for decrypting content. + */ + protectionSystem: ContentProtection; + + /** + * Handler to process segment data. The handler is passed the segment data; and returns the modified segment data. + */ + segmentHandler?: BinaryHandler; + + /** + * A function to customize request information to get a media segment. + */ + segmentRequestHandler?: RequestHandler; + + /** + * Maximum number of times to retry a network request for a segment. + */ + segmentRequestRetryLimit?: number; + } + /** + * HTTP(s) Request/Response information. + */ + export class NetworkRequestInfo { + /** + * The content of the request. Can be used to modify license request body. + */ + content: Uint8Array; + + /** + * An object containing properties that you would like to send in the header. + */ + headers: any; + + /** + * The URL requested. + */ + url: string; + + /** + * Indicates whether CORS Access-Control requests should be made using credentials such as cookies or authorization headers. + */ + withCredentials: boolean; + } + /** Cast receiver context options. All options are optionals. */ + export class CastReceiverOptions { + /** + * Optional map of custom messages namespaces to initialize and their types. + * Custom messages namespaces need to be initiated before the application started; + * so it is best to provide the namespaces in the receiver options. + * (The default type of a message bus is JSON; if not provided here). + */ + customNamespaces?: any; + + /** + * Sender id used for local requests. Default value is 'local'. + */ + localSenderId?: string; + + /** + * Maximum time in seconds before closing an idle sender connection. + * Setting this value enables a heartbeat message to keep the connection alive. + * Used to detect unresponsive senders faster than typical TCP timeouts. + * The minimum value is 5 seconds; there is no upper bound enforced but practically it's minutes before platform TCP timeouts come into play. + * Default value is 10 seconds. + */ + maxInactivity?: number; + + /** + * Optional media element to play content with. Default behavior is to use the first found media element in the page. + */ + mediaElement?: HTMLMediaElement; + + /** + * Optional playback configuration. + */ + playbackConfig?: PlaybackConfig; + + /** + * If this is true; the watched client stitching break will also be played. + */ + playWatchedBreak?: boolean; + + /** + * Preferred value for player playback rate. It is used if playback rate value is not provided in the load request. + */ + preferredPlaybackRate?: number; + + /** + * Preferred text track language. It is used if no active track is provided in the load request. + */ + preferredTextLanguage?: string; + + /** + * Optional queue implementation. + */ + queue?: QueueBase; + + /** + * Text that represents the application status. + * It should meet internationalization rules as may be displayed by the sender application. + */ + statusText?: string; + + /** + * A bitmask of media commands supported by the application. + * LOAD; PLAY; STOP; GET_STATUS must always be supported. + * If this value is not provided; then PAUSE; SEEK; STREAM_VOLUME; STREAM_MUTE are assumed to be supported too. + */ + supportedCommands?: number; + + /** + * Indicate that MPL should be used for DASH content. + */ + useLegacyDashSupport?: boolean; + + /** + * An integer used as an internal version number. + * This number is used only to distinguish between receiver releases and higher numbers do not necessarily have to represent newer releases. + */ + versionCode?: number; + } + + /** Manages loading of underlying libraries and initializes underlying cast receiver SDK. */ + export class CastReceiverContext { + /** Returns the CastReceiverContext singleton instance. */ + static getInstance(): CastReceiverContext; + + constructor(params: any); + + /** + * Sets message listener on custom message channel. + */ + addCustomMessageListener(namespace: string, listener: EventHandler): void; + + /** + * Add listener to cast system events. + */ + addEventListener(type: EventType, handler: EventHandler): void; + + /** + * Checks if the given media params of video or audio streams are supported by the platform. + */ + canDisplayType( + mimeType: string, + codecs?: string, + width?: number, + height?: number, + framerate?: number + ): boolean; + + /** + * Provides application information once the system is ready; otherwise it will be null. + */ + getApplicationData(): ApplicationData; + + /** + * Provides device capabilities information once the system is ready; otherwise it will be null. + * If an empty object is returned; the device does not expose any capabilities information. + */ + getDeviceCapabilities(): any; + + /** + * Get Player instance that can control and monitor media playback. + */ + getPlayerManager(): PlayerManager; + + /** + * Get a sender by sender id + */ + getSender(senderId: string): Sender; + + /** + * Gets a list of currently-connected senders. + */ + getSenders(): Sender[]; + + /** + * Reports if the cast application's HDMI input is in standby. + */ + getStandbyState(): StandbyState; + + /** + * Provides application information about the system state. + */ + getSystemState(): SystemState; + + /** + * Reports if the cast application is the HDMI active input. + */ + getVisibilityState(): VisibilityState; + + /** + * When the application calls start; the system will send the ready event to indicate + * that the application information is ready and the application can send messages as soon as there is one sender connected. + */ + isSystemReady(): boolean; + + /** + * Start loading player js. This can be used to start loading the players js code in early stage of starting the receiver before calling start. + * This function is a no-op if players were already loaded (start was called). + */ + loadPlayerLibraries(useLegacyDashSupport?: boolean): void; + + /** + * Remove a message listener on custom message channel. + */ + removeCustomMessageListener( + namespace: string, + listener: EventHandler + ): void; + + /** + * Remove listener to cast system events. + */ + removeEventListener(type: EventType, handler: EventHandler): void; + + /** + * Sends a message to a specific sender. + */ + sendCustomMessage(namespace: string, senderId: string, message: any): void; + + /** + * This function should be called in response to the feedbackstarted event if the application + * add debug state information to log in the feedback report. + * It takes in a parameter ‘message’ that is a string that represents the debug information that the application wants to log. + */ + sendFeedbackMessage(feedbackMessage: string): void; + + /** + * Sets the application state. The application should call this when its state changes. + * If undefined or set to an empty string; the value of the Application Name established during application + * registration is used for the application state by default. + */ + setApplicationState(statusText: string): void; + + /** + * Sets the receiver inactivity timeout. + * It is recommended to set the maximum inactivity value when calling Start and not changing it. + * This API is just provided for development/debugging purposes. + */ + setInactivityTimeout(maxInactivity: number): void; + + /** + * Sets the log verbosity level. + */ + setLoggerLevel(level: LoggerLevel): void; + + /** + * Initializes system manager and media manager; so that receiver app can receive requests from senders. + */ + start(options?: CastReceiverOptions): CastReceiverContext; + + /** + * Shutdown receiver application. + */ + stop(): void; + } + + /** Manages audio tracks. */ + export class AudioTracksManager { + constructor(params: any); + getActiveId(): number; + getActiveTrack(): Track; + getTrackById(id: number): Track; + getTracks(): Track[]; + getTracksByLanguage(language: string): Track[]; + setActiveById(id: number): void; + setActiveByLanguage(language: string): void; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.events.d.ts b/types/chromecast-caf-receiver/cast.framework.events.d.ts new file mode 100644 index 0000000000..c5e2e71771 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.events.d.ts @@ -0,0 +1,421 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { + RequestData, + MediaInformation, + Track, + MediaStatus, +} from './cast.framework.messages'; +export = cast.framework.events; + +declare namespace cast.framework.events { + export type EventType = + | 'ALL' + | 'ABORT' + | 'CAN_PLAY' + | 'CAN_PLAY_THROUGH' + | 'DURATION_CHANGE' + | 'EMPTIED' + | 'ENDED' + | 'LOADED_DATA' + | 'LOADED_METADATA' + | 'LOAD_START' + | 'PAUSE' + | 'PLAY' + | 'PLAYING' + | 'PROGRESS' + | 'RATE_CHANGE' + | 'SEEKED' + | 'SEEKING' + | 'STALLED' + | 'TIME_UPDATE' + | 'SUSPEND' + | 'WAITING' + | 'BITRATE_CHANGED' + | 'BREAK_STARTED' + | 'BREAK_ENDED' + | 'BREAK_CLIP_LOADING' + | 'BREAK_CLIP_STARTED' + | 'BREAK_CLIP_ENDED' + | 'BUFFERING' + | 'CACHE_LOADED' + | 'CACHE_HIT' + | 'CACHE_INSERTED' + | 'CLIP_STARTED' + | 'CLIP_ENDED' + | 'EMSG' + | 'ERROR' + | 'ID3' + | 'MEDIA_STATUS' + | 'MEDIA_FINISHED' + | 'PLAYER_PRELOADING' + | 'PLAYER_PRELOADING_CANCELLED' + | 'PLAYER_LOAD_COMPLETE' + | 'PLAYER_LOADING' + | 'SEGMENT_DOWNLOADED' + | 'REQUEST_SEEK' + | 'REQUEST_LOAD' + | 'REQUEST_STOP' + | 'REQUEST_PAUSE' + | 'REQUEST_PLAY' + | 'REQUEST_PLAY_AGAIN' + | 'REQUEST_PLAYBACK_RATE_CHANGE' + | 'REQUEST_SKIP_AD' + | 'REQUEST_VOLUME_CHANGE' + | 'REQUEST_EDIT_TRACKS_INFO' + | 'REQUEST_EDIT_AUDIO_TRACKS' + | 'REQUEST_SET_CREDENTIALS' + | 'REQUEST_LOAD_BY_ENTITY' + | 'REQUEST_USER_ACTION' + | 'REQUEST_DISPLAY_STATUS' + | 'REQUEST_CUSTOM_COMMAND' + | 'REQUEST_FOCUS_STATE' + | 'REQUEST_QUEUE_LOAD' + | 'REQUEST_QUEUE_INSERT' + | 'REQUEST_QUEUE_UPDATE' + | 'REQUEST_QUEUE_REMOVE' + | 'REQUEST_QUEUE_REORDER' + | 'REQUEST_QUEUE_GET_ITEM_RANGE' + | 'REQUEST_QUEUE_GET_ITEMS' + | 'REQUEST_QUEUE_GET_ITEM_IDS' + | 'REQUEST_PRECACHE'; + + export type DetailedErrorCode = + | 'MEDIA_UNKNOWN' + | 'MEDIA_ABORTED' + | 'MEDIA_DECODE' + | 'MEDIA_NETWORK' + | 'MEDIA_SRC_NOT_SUPPORTED' + | 'SOURCE_BUFFER_FAILURE' + | 'MEDIAKEYS_UNKNOWN' + | 'MEDIAKEYS_NETWORK' + | 'MEDIAKEYS_UNSUPPORTED' + | 'MEDIAKEYS_WEBCRYPTO' + | 'NETWORK_UNKNOWN' + | 'SEGMENT_NETWORK' + | 'HLS_NETWORK_MASTER_PLAYLIST' + | 'HLS_NETWORK_PLAYLIST' + | 'HLS_NETWORK_NO_KEY_RESPONSE' + | 'HLS_NETWORK_KEY_LOAD' + | 'HLS_NETWORK_INVALID_SEGMENT' + | 'HLS_SEGMENT_PARSING' + | 'DASH_NETWORK' + | 'DASH_NO_INIT' + | 'SMOOTH_NETWORK' + | 'SMOOTH_NO_MEDIA_DATA' + | 'MANIFEST_UNKNOWN' + | 'HLS_MANIFEST_MASTER' + | 'HLS_MANIFEST_PLAYLIST' + | 'DASH_MANIFEST_UNKNOWN' + | 'DASH_MANIFEST_NO_PERIODS' + | 'DASH_MANIFEST_NO_MIMETYPE' + | 'DASH_INVALID_SEGMENT_INFO' + | 'SMOOTH_MANIFEST' + | 'SEGMENT_UNKNOWN' + | 'TEXT_UNKNOWN' + | 'APP' + | 'BREAK_CLIP_LOADING_ERROR' + | 'BREAK_SEEK_INTERCEPTOR_ERROR' + | 'IMAGE_ERROR' + | 'LOAD_INTERRUPTED' + | 'GENERIC'; + + export type EndedReason = + | 'END_OF_STREAM' + | 'ERROR' + | 'STOPPED' + | 'INTERRUPTED' + | 'SKIPPED' + | 'BREAK_SWITCH'; + + /** + * Event data for @see{@link EventType.SEGMENT_DOWNLOADED} event. + */ + export class SegmentDownloadedEvent { + constructor(downloadTime?: number, size?: number); + + /** + * The time it took to download the segment; in milliseconds. + */ + downloadTime?: number; + + /** + * The number of bytes in the segment. + */ + size?: number; + } + + /** + * Event data for all events that represent requests made to the receiver. + */ + export class RequestEvent { + constructor(type: EventType, requestData?: RequestData, senderId?: string); + + /** + * The data that was sent with the request. + */ + requestData?: RequestData; + + /** + * The sender id the request came from. + */ + senderId?: string; + } + + /** + * Event data for @see{@link EventType.MEDIA_STATUS} event. + */ + export class MediaStatusEvent { + constructor(mediaStatus?: MediaStatus); + + /** + * The media status that was sent. + */ + mediaStatus?: MediaStatus; + } + /** + * Event data for pause events forwarded from the MediaElement. + */ + export class MediaPauseEvent { + constructor(currentMediaTime?: number, ended?: boolean); + + /** + * Indicate if the media ended (indicates the pause was fired due to stream reached the end). + */ + ended?: boolean; + } + /** + * Event data for @see{@link EventType.MEDIA_FINISHED} event. + */ + export class MediaFinishedEvent { + constructor(currentMediaTime?: number, endedReason?: EndedReason); + + /** + * The time when the media finished (in seconds). For an item in a queue; this value represents the time in the currently playing queue item ( where 0 means the queue item has just started). + */ + currentTime?: number; + + /** + * The reason the media finished. + */ + endedReason?: EndedReason; + } + /** + * Event data for all events forwarded from the MediaElement. + */ + export class MediaElementEvent { + constructor(type: EventType, currentMediaTime?: number); + + /** + * The time in the currently playing clip when the event was fired (in seconds). Undefined if playback has not started yet. + */ + currentMediaTime?: number; + } + /** + * Event data for all events pertaining to processing a load / preload request. made to the player. + */ + export class LoadEvent { + constructor(type: EventType, media?: MediaInformation); + + /** + * Information about the media being loaded. + */ + media: MediaInformation; + } + /** + * Event data for @see{@link EventType.INBAND_TRACK_ADDED} event. + */ + export class InbandTrackAddedEvent { + constructor(track: Track); + + /** + * Added track. + */ + track: Track; + } + + /** Event data for @see{@link EventType.ID3} event. */ + export class Id3Event { + constructor(segmentData: Uint8Array); + + /** + * The segment data. + */ + segmentData: Uint8Array; + } + /** + * Event data superclass for all events dispatched by @see{@link PlayerManager} + */ + export class Event { + constructor(type: EventType); + + /** + * Type of the event. + */ + type: EventType; + } + /** + * Event data for @see{@link EventType.EMSG} event. + */ + export class EmsgEvent { + constructor(emsgData: any); + + /** + * The time that the event ends (in presentation time). Undefined if using legacy Dash support. + */ + endTime: any; + + /** + * The duration of the event (in units of timescale). Undefined if using legacy Dash support. + */ + eventDuration: any; + + /** + * A field identifying this instance of the message. Undefined if using legacy Dash support. + */ + id: any; + + /** + * Body of the message. Undefined if using legacy Dash support. + */ + messageData: any; + + /** + * The offset that the event starts; relative to the start of the segment this is contained in (in units of timescale). Undefined if using legacy Dash support. + */ + presentationTimeDelta: any; + + /** + * Identifies the message scheme. Undefined if using legacy Dash support. + */ + schemeIdUri: any; + + /** + * The segment data. This is only defined if using legacy Dash support. + */ + segmentData: any; + + /** + * The time that the event starts (in presentation time). Undefined if using legacy Dash support. + */ + startTime: any; + + /** + * Provides the timescale; in ticks per second. Undefined if using legacy Dash support. + */ + timescale: any; + + /** + * Specifies the value for the event. Undefined if using legacy Dash support. + */ + value: any; + } + /** + * Event data for @see{@link EventType.CLIP_ENDED} event. + */ + export class ClipEndedEvent { + constructor(currentMediaTime: number, endedReason?: EndedReason); + + /** + * The time in media (in seconds) when clip ended. + */ + currentMediaTime: number; + + /** + * The reason the clip ended. + */ + endedReason?: EndedReason; + } + + /** + * Event data for @see{@link EventType.CACHE_LOADED} event. + */ + export class CacheLoadedEvent { + constructor(media?: MediaInformation); + + /** + * Information about the media being cached. + */ + media: MediaInformation; + } + + export class CacheItemEvent { + constructor(type: EventType, url: string); + + /** + * The URL of data fetched from cache + */ + url: string; + } + + export class BufferingEvent { + constructor(isBuffering: boolean); + + /** + * True if the player is entering a buffering state. + */ + isBuffering: boolean; + } + + export class BreaksEvent { + constructor( + type: EventType, + currentMediaTime?: number, + index?: number, + total?: number, + whenSkippable?: number, + endedReason?: EndedReason, + breakClipId?: string + ); + + /** + * The break clip's id. Refer to BreakClip.id + */ + breakClipId: string; + + /** + * The time in the currently playing media when the break event occurred. + */ + currentMediaTime: string; + + /** + * The reason the break clip ended. + */ + endedReason: EndedReason; + + /** + * Index of break clip; which starts from 1. + */ + index: number; + + /** + * Total number of break clips. + */ + total: number; + + /** + * When to skip current break clip in sec; after break clip begins to play. + */ + whenSkippable: number; + } + + /** + * Event data for @see {@link EventType.BITRATE_CHANGED} event. + */ + export class BitrateChangedEvent { + constructor(totalBitrate?: number); + + /** The bitrate of the media (audio and video) in bits per second. */ + totalBitrate: number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.messages.d.ts b/types/chromecast-caf-receiver/cast.framework.messages.d.ts new file mode 100644 index 0000000000..dc5c1ac07b --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.messages.d.ts @@ -0,0 +1,1777 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { DetailedErrorCode } from './cast.framework.events'; +export = cast.framework.messages; + +declare namespace cast.framework.messages { + export type UserAction = + | 'LIKE' + | 'DISLIKE' + | 'FOLLOW' + | 'UNFOLLOW' + | 'FLAG' + | 'SKIP_AD'; + + export type UserActionContext = + | 'UNKNOWN_CONTEXT' + | 'ALBUM' + | 'ARTIST' + | 'PLAYLIST' + | 'EPISODE' + | 'SERIES' + | 'MOVIE' + | 'CHANNEL' + | 'TEAM' + | 'PLAYER' + | 'COACH'; + + export type TextTrackType = + | 'SUBTITLES' + | 'CAPTIONS' + | 'DESCRIPTIONS' + | 'CHAPTERS' + | 'METADATA'; + + export type TextTrackWindowType = 'NONE' | 'NORMAL' | 'ROUNDED_CORNERS'; + + export type TrackType = 'TEXT' | 'AUDIO' | 'VIDEO'; + + export type TextTrackFontGenericFamily = + | 'SANS_SERIF' + | 'MONOSPACED_SANS_SERIF' + | 'SERIF' + | 'MONOSPACED_SERIF' + | 'CASUAL' + | 'CURSIVE' + | 'SMALL_CAPITALS'; + + export type TextTrackFontStyle = 'NORMAL' | 'BOLD' | 'BOLD_ITALIC' | 'ITALIC'; + + export type TextTrackEdgeType = + | 'NONE' + | 'OUTLINE' + | 'DROP_SHADOW' + | 'RAISED' + | 'DEPRESSED'; + + export type Command = + | 'PAUSE' + | 'SEEK' + | 'STREAM_VOLUME' + | 'STREAM_MUTE' + | 'ALL_BASIC_MEDIA' + | 'QUEUE_NEXT' + | 'QUEUE_PREV' + | 'QUEUE_SHUFFLE' + | 'SKIP_AD'; + + export type SeekResumeState = 'PLAYBACK_START' | 'PLAYBACK_PAUSE'; + + export type StreamingProtocolType = + | 'UNKNOWN' + | 'MPEG_DASH' + | 'HLS' + | 'SMOOTH_STREAMING'; + + export type StreamType = 'BUFFERED' | 'LIVE' | 'NONE'; + + export type FocusState = 'IN_FOCUS' | 'NOT_IN_FOCUS'; + + export type ExtendedPlayerState = 'LOADING'; + + export type ErrorType = + | 'INVALID_PLAYER_STATE' + | 'LOAD_FAILED' + | 'LOAD_CANCELLED' + | 'INVALID_REQUEST' + | 'ERROR'; + + export type ErrorReason = + | 'INVALID_COMMAND' + | 'INVALID_PARAMS' + | 'INVALID_MEDIA_SESSION_ID' + | 'SKIP_LIMIT_REACHED' + | 'NOT_SUPPORTED' + | 'LANGUAGE_NOT_SUPPORTED' + | 'END_OF_QUEUE' + | 'APP_ERROR' + | 'AUTHENTICATION_EXPIRED' + | 'PREMIUM_ACCOUNT_REQUIRED' + | 'CONCURRENT_STREAM_LIMIT' + | 'PARENTAL_CONTROL_RESTRICTED' + | 'NOT_AVAILABLE_IN_REGION' + | 'CONTENT_ALREADY_PLAYING' + | 'INVALID_REQUEST' + | 'GENERIC_LOAD_ERROR'; + + export type RepeatMode = + | 'REPEAT_OFF' + | 'REPEAT_ALL' + | 'REPEAT_SINGLE' + | 'REPEAT_ALL_AND_SHUFFLE'; + + export type IdleReason = 'CANCELLED' | 'INTERRUPTED' | 'FINISHED' | 'ERROR'; + + export type HlsSegmentFormat = 'AAC' | 'AC3' | 'MP3' | 'TS' | 'TS_AAC'; + + export type HdrType = 'SDR' | 'HDR' | 'DV'; + + export type PlayStringId = + | 'FREE_TRIAL_ABOUT_TO_EXPIRE' + | 'SUBSCRIPTION_ABOUT_TO_EXPIRE' + | 'STREAM_HIJACKED'; + + export type GetStatusOptions = 'NO_METADATA' | 'NO_QUEUE_ITEMS'; + + export type MessageType = + | 'MEDIA_STATUS' + | 'CLOUD_STATUS' + | 'QUEUE_CHANGE' + | 'QUEUE_ITEMS' + | 'QUEUE_ITEM_IDS' + | 'GET_STATUS' + | 'LOAD' + | 'PAUSE' + | 'STOP' + | 'PLAY' + | 'SKIP_AD' + | 'PLAY_AGAIN' + | 'SEEK' + | 'SET_PLAYBACK_RATE' + | 'SET_VOLUME' + | 'EDIT_TRACKS_INFO' + | 'EDIT_AUDIO_TRACKS' + | 'PRECACHE' + | 'PRELOAD' + | 'QUEUE_LOAD' + | 'QUEUE_INSERT' + | 'QUEUE_UPDATE' + | 'QUEUE_REMOVE' + | 'QUEUE_REORDER' + | 'QUEUE_NEXT' + | 'QUEUE_PREV' + | 'QUEUE_GET_ITEM_RANGE' + | 'QUEUE_GET_ITEMS' + | 'QUEUE_GET_ITEM_IDS' + | 'QUEUE_SHUFFLE' + | 'SET_CREDENTIALS' + | 'LOAD_BY_ENTITY' + | 'USER_ACTION' + | 'DISPLAY_STATUS' + | 'FOCUS_STATE' + | 'CUSTOM_COMMAND'; + + export type PlayerState = 'IDLE' | 'PLAYING' | 'PAUSED' | 'BUFFERING'; + + export type QueueChangeType = + | 'INSERT' + | 'REMOVE' + | 'ITEMS_CHANGE' + | 'UPDATE' + | 'NO_CHANGE'; + + export type QueueType = + | 'ALBUM' + | 'PLAYLIST' + | 'AUDIOBOOK' + | 'RADIO_STATION' + | 'PODCAST_SERIES' + | 'TV_SERIES' + | 'VIDEO_PLAYLIST' + | 'LIVE_TV' + | 'MOVIE'; + + export type MetadataType = + | 'GENERIC' + | 'MOVIE' + | 'TV_SHOW' + | 'MUSIC_TRACK' + | 'PHOTO'; + + /** + * RefreshCredentials request data. + */ + export interface RefreshCredentialsRequestData { } + + /** + * Media event SET_VOLUME request data. + */ + export interface VolumeRequestData extends RequestData { + /** + * The media stream volume + */ + volume?: Volume; + } + + /** + * Represents the volume of a media session stream. + */ + export interface Volume { + /** + * Value from 0 to 1 that represents the current stream volume level. + */ + level?: number; + + /** + * Whether the stream is muted. + */ + muted?: boolean; + } + + /** + * Video information such as video resolution and High Dynamic Range (HDR). + */ + export class VideoInformation { + constructor(width: number, height: number, hdrType: HdrType); + + /** + * + */ + width: number; + + /** + * + */ + height: number; + + /** + * + */ + hdrType: HdrType; + } + + /** + * VAST ad request configuration. + */ + export interface VastAdsRequest { + /** + * Specifies a VAST document to be used as the ads response instead of making a request via an ad tag url. This can be useful for debugging and other situations where a VAST response is already available. + */ + adsResponse?: string; + + /** + * URL for VAST file. + */ + adTagUrl?: string; + } + + /** + * UserAction request data. + */ + export interface UserActionRequestData { + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + + /** + * User action to be handled by the application. + */ + userAction?: UserAction; + + /** + * Optional context information for the user action. + */ + userActionContext?: UserActionContext; + } + + /** + * A TV episode media description. + */ + export interface TvShowMediaMetadata { + /** + * TV episode number. A positive integer. + */ + episode?: number; + + /** + * @deprecated use episode instead + */ + episodeNumber?: number; + + /** + * @deprecated use episode instead + */ + episodeTitle?: string; + + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images?: Image[]; + + /** + * ISO 8601 date when the episode originally aired; e.g. 2014-02-10. + */ + originalAirdate?: string; + + /** + * @deprecated use originalAirdate instead. + */ + releaseYear?: number; + + /** + * TV episode season. A positive integer. + */ + season?: number; + + /** + * @deprecated use season instead. + */ + seasonNumber?: number; + + /** + * TV series title. + */ + seriesTitle?: string; + + /** + * TV episode title. + */ + title?: string; + } + /** + * Describes track metadata information. + */ + export class Track { + constructor(trackId: number, trackType: TrackType); + + /** + * Custom data set by the receiver application. + */ + customData?: string; + + /** + * Language tag as per RFC 5646 (If subtype is “SUBTITLES” it is mandatory). + */ + language?: string; + + /** + * A descriptive; human readable name for the track. For example "Spanish". + */ + name?: string; + + /** + * For text tracks; the type of text track. + */ + subtype?: string; + + /** + * It can be the url of the track or any other identifier that allows the receiver to find the content (when the track is not inband or included in the manifest). For example it can be the url of a vtt file. + */ + trackContentId?: string; + + /** + * It represents the MIME type of the track content. For example if the track is a vtt file it will be ‘text/vtt’. This field is needed for out of band tracks; so it is usually provided if a trackContentId has also been provided. It is not mandatory if the receiver has a way to identify the content from the trackContentId; but recommended. The track content type; if provided; must be consistent with the track type. + */ + trackContentType?: string; + + /** + * Unique identifier of the track within the context of a MediaInformation object. + */ + trackId?: number; + + /** + * The type of track. + */ + type: TrackType; + } + /** + * Describes style information for a text track. + */ + export interface TextTrackStyle { + /** + * The background 32 bit RGBA color. The alpha channel should be used for transparent backgrounds. + */ + backgroundColor?: string; + + /** + * Custom data set by the receiver application. + */ + customData?: any; + + /** + * RGBA color for the edge; this value will be ignored if edgeType is NONE. + */ + edgeColor?: string; + + /** + * + */ + edgeType?: TextTrackEdgeType; + + /** + * If the font is not available in the receiver the fontGenericFamily will be used. + */ + fontFamily?: string; + + /** + * The text track generic family. + */ + fontGenericFamily?: TextTrackFontGenericFamily; + + /** + * The font scaling factor for the text track (the default is 1). + */ + fontScale?: number; + + /** + * The text track font style. + */ + fontStyle?: TextTrackFontStyle; + + /** + * The foreground 32 bit RGBA color. + */ + foregroundColor?: string; + + /** + * 32 bit RGBA color for the window. This value will be ignored if windowType is NONE. + */ + windowColor?: string; + + /** + * Rounded corner radius absolute value in pixels (px). This value will be ignored if windowType is not ROUNDED_CORNERS. + */ + windowRoundedCornerRadius?: number; + + /** + * The window concept is defined in CEA-608 and CEA-708. In WebVTT is called a region. + */ + windowType?: TextTrackWindowType; + } + + /** + * Media event playback rate request data. + */ + export interface SetPlaybackRateRequestData extends RequestData { + /** + * New playback rate (>0). + */ + playbackRate?: number; + + /** + * New playback rate relative to current playback rate. New rate will be the result of multiplying the current rate with the value. For example a value of 1.1 will increase rate by 10%. (Only used if the playbackRate value is not provided). + */ + relativePlaybackRate?: number; + } + + /** + * SetCredentials request data. + */ + export interface SetCredentialsRequestData { + /** + * Credentials to use by receiver. + */ + credentials?: string; + + /** + * If it is a response for refresh credentials; it will indicate the request id of the refresh credentials request. + */ + forRequestId?: number; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + } + + /** + * Media event SEEK request data. + */ + export interface SeekRequestData extends RequestData { + /** + * Seconds since beginning of content. + */ + currentTime?: number; + + /** + * Seconds relative to the current playback position. If this field is defined; the currentTime field will be ignored. + */ + relativeTime?: number; + + /** + * The playback state after a SEEK request. + */ + resumeState?: SeekResumeState; + } + + /** + * Provides seekable range in seconds. + */ + export class SeekableRange { + constructor(start?: number, end?: number); + + /** + * End of the seekable range in seconds. + */ + end?: number; + + /** + * Start of the seekable range in seconds. + */ + start?: number; + } + + /** + * Media event request data. + */ + export class RequestData { + constructor(type: MessageType); + + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + } + + /** + * Media event UPDATE queue request data. + */ + export interface QueueUpdateRequestData { + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * List of queue items to be updated. No reordering will happen; the items will retain the existing order. + */ + items?: QueueItem[]; + + /** + * Skip/Go back number of items with respect to the position of currentItem (it can be negative). If it is out of boundaries; the currentItem will be the next logical item in the queue wrapping around the boundaries. The new currentItem position will follow the rules of the queue repeat behavior. + */ + jump?: number; + + /** + * Behavior of the queue when all items have been played. + */ + repeatMode?: RepeatMode; + + /** + * Shuffle the queue items when the update is processed. After the queue items are shuffled; the item at the currentItem position will be loaded. + */ + shuffle?: boolean; + } + + /** + * Media event queue REORDER request data. + */ + export class QueueReorderRequestData extends RequestData { + constructor(itemIds: number[]); + + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * ID of the item that will be located immediately after the reordered list. If the ID is not found or it is not provided; the reordered list will be appended at the end of the existing list. + */ + insertBefore?: number; + + /** + * IDs of the items to be reordered; in the new order. Items not provided will keep their existing order. The provided list will be inserted at the position determined by insertBefore. For example: + + If insertBefore is not specified Existing queue: “A”;”D”;”G”;”H”;”B”;”E” itemIds: “D”;”H”;”B” New Order: “A”;”G”;”E”;“D”;”H”;”B” + + If insertBefore is “A” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “D”;”H”;”B”;“A”;”G”;”E” + + If insertBefore is “G” Existing queue: “A”;”D”;”G”;”H”;”B” itemIds: “D”;”H”;”B” New Order: “A”;“D”;”H”;”B”;”G”;”E” + */ + itemIds: number[]; + } + + /** + * Media event queue REMOVE request data. + */ + export class QueueRemoveRequestData extends RequestData { + constructor(itemIds: number[]); + + /** + * ID of the current media Item after the deletion (if not provided; the currentItem value will be the same as before the deletion; if it does not exist because it has been deleted; the currentItem will point to the next logical item in the list). + */ + currentItemId?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * IDs of queue items to be deleted. + */ + itemIds?: number[]; + } + /** + * Media event queue LOAD request data. + */ + export interface QueueLoadRequestData extends RequestData { + constructor(items: QueueItem[]): QueueLoadRequestData; + + /** + * Seconds (since the beginning of content) to start playback of the first item to be played. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user casts the item that was playing locally so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * Behavior of the queue when all items have been played. + */ + items: QueueItem[]; + + /** + * Id of the request; used to correlate request/response. + */ + repeatMode?: RepeatMode; + + /** + * The index of the item in the items array that must be the first currentItem (the item that will be played first). Note this is the index of the array (starts at 0) and not the itemId (as it is not known until the queue is created). If repeatMode is REPEAT_OFF playback will end when the last item in the array is played (elements before the startIndex will not be played). This may be useful for continuation scenarios where the user was already using the sender app and in the middle decides to cast. In this way the sender app does not need to map between the local and remote queue positions or saves one extra QUEUE_UPDATE request. + */ + startIndex?: number; + } + + /** + * Queue item information. Application developers may need to create a QueueItem to insert a queue element using InsertQueueItems. In this case they should not provide an itemId (as the actual itemId will be assigned when the item is inserted in the queue). This prevents ID collisions with items added from a sender app. + */ + export class QueueItem { + constructor(opt_itemId?: number); + + /** + * Array of Track trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds?: number[]; + + /** + * If the autoplay parameter is not specified or is true; the media player will begin playing the element in the queue when the item becomes the currentItem. + */ + autoplay?: boolean; + + /** + * The application can define any extra queue item information needed. + */ + customData?: any; + + /** + * Unique identifier of the item in the queue. The attribute is optional because for LOAD or INSERT should not be provided (as it will be assigned by the receiver when an item is first created/inserted). + */ + itemId?: number; + + /** + * Metadata (including contentId) of the playlist element. + */ + media?: MediaInformation; + + /** + * Playback duration of the item; if it is larger than the actual duration - startTime it will be ignored (default behavior). It can be negative; in such case the duration will be the actual asset duration minus the duration provided. It can be used for photo slideshows to control the duration the item should be presented or for live events to control the duration that the program should be played. It may be useful for autoplay scenarios to avoid displaying all the credits after an episode has ended. + */ + playbackDuration?: number; + + /** + * This parameter is a hint for the receiver to preload this media item before it is played. It allows for a smooth transition between items played from the queue. The time is expressed in seconds; relative to the beginning of this item playback (usually the end of the previous item playback). Only positive values are valid. For example; if the value is 10 seconds; this item will be preloaded 10 seconds before the previous item has finished. The receiver will try to honor this value but will not guarantee it; for example if the value is larger than the previous item duration the receiver may just preload this item shortly after the previous item has started playing (there will never be two items being preloaded in parallel). Also; if an item is inserted in the queue just after the currentItem and the time to preload is higher than the time left on the currentItem; the preload will just happen as soon as possible. + */ + preloadTime?: number; + + /** + * Seconds since beginning of content. If the content is live content; and startTime is not specified; the stream will start at the live position. + */ + startTime?: number; + } + + /** + * Media event queue INSERT request data. + */ + export class QueueInsertRequestData extends RequestData { + constructor(items: QueueItem[]); + + /** + * ID of the current media Item after the insertion (if not provided; the currentItem value will be the same as before the insertion). + */ + currentItemId?: number; + + /** + * Index (relative to the items array; starting with 0) of the new current media Item. For inserted items we use the index (similar to startIndex in QUEUE_LOAD) and not currentItemId; because the itemId is unknown until the items are inserted. If not provided; the currentItem value will be the same as before the insertion (unless currentItemId is provided). This param allows to make atomic the common use case of insert and play an item. + */ + currentItemIndex?: number; + + /** + * Seconds since the beginning of content to start playback of the current item. If provided; this value will take precedence over the startTime value provided at the QueueItem level but only the first time the item is played. This is to cover the common case where the user jumps to the middle of an item so the currentTime does not apply to the item permanently like the QueueItem startTime does. It avoids having to reset the startTime dynamically (that may not be possible if the phone has gone to sleep). + */ + currentTime?: number; + + /** + * ID of the item that will be located immediately after the inserted list. If the ID is not found or it is not provided; the list will be appended at the end of the existing list. + */ + insertBefore?: number; + + /** + * List of queue items. The itemId field of the items should be empty. It is sorted (first element will be played first). + */ + items: QueueItem[]; + } + + /** + * Represents a data message containing the full list of queue ids. + */ + export interface QueueIds { + /** + * List of queue item ids. + */ + itemIds?: number[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * + */ + type: MessageType; + } + + /** + * Queue data as part of the LOAD request. + */ + export class QueueData { + constructor( + id?: string, + name?: string, + description?: string, + repeatMode?: RepeatMode, + items?: QueueItem[], + startIndex?: number, + startTime?: number + ); + + /** + * Description of the queue. + */ + description?: string; + + /** + * Optional Queue entity id; provide Google Assistant deep link. + */ + entity?: string; + + /** + * Id of the queue. + */ + id?: string; + + /** + * Array of queue items. It is sorted (first element will be played first). + */ + items?: QueueItem[]; + + /** + * Name of the queue. + */ + name?: string; + + /** + * Queue type; e.g. album; playlist; radio station; tv series; etc. + */ + queueType?: QueueType; + + /** + * Continuous playback behavior of the queue. + */ + repeatMode?: RepeatMode; + + /** + * The index of the item in the queue that should be used to start playback first. + */ + startIndex?: number; + + /** + * Seconds (since the beginning of content) to start playback of the first item. + */ + startTime?: number; + } + + /** + * Represents a queue change message; such as insert; remove; and update. + */ + export interface QueueChange { + /** + * The actual queue change type. + */ + changeType?: QueueChangeType; + + /** + * The id to insert the list of itemIds before. + */ + insertBefore?: number; + + /** + * List of changed itemIds. + */ + itemIds?: number[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * The queue change sequence ID. Used to coordinate state sync between various senders and the receiver. + */ + sequenceNumber?: number; + + /** + * + */ + type: MessageType; + } + + /** + * Media event PRELOAD request data. + */ + export class PreloadRequestData implements LoadRequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + /** + * Optional user credentials. + */ + credentials?: string; + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + /** + * The media playback rate. + */ + playbackRate?: number; + /** + * Queue data. + */ + queueData: QueueData; + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + constructor(itemId: number); + + /** + * The ID of the queue item. + */ + itemId: number; + } + + /** + * Media event PRECACHE request data. (Some fields of the load request; like autoplay and queueData; are ignored). + */ + export class PrecacheRequestData implements LoadRequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + /** + * Optional user credentials. + */ + credentials?: string; + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + /** + * The media playback rate. + */ + playbackRate?: number; + /** + * Queue data. + */ + queueData: QueueData; + /** + * Application-specific data for this request. It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + /** + * Id of the media session that the request applies to. + */ + mediaSessionId?: number; + /** + * Id of the request; used to correlate request/response. + */ + requestId: number; + constructor(data?: string); + + /** + * Application precache data. + */ + precacheData?: string; + } + + /** + * PlayString request data. + */ + export class PlayStringRequestData { + constructor(stringId: PlayStringId, opt_arguments?: string[]); + + /** + * An optional array of string values to be filled into the text. + */ + arguments?: string[]; + + /** + * An identifier for the text to be played back. + */ + stringId: PlayStringId; + } + + /** + * A photo media description. + */ + export interface PhotoMediaMetadata { + /** + * Name of the photographer. + */ + artist?: string; + + /** + * ISO 8601 date and time the photo was taken; e.g. 2014-02-10T15:47:00Z. + */ + creationDateTime?: string; + + /** + * Photo height; in pixels. + */ + height?: number; + + /** + * Images associated with the content. Examples would include a photo thumbnail. + */ + images: Image[]; + + /** + * Latitude. + */ + latitude?: number; + + /** + * Location where the photo was taken. For example; "Seattle; Washington; USA". + */ + location?: string; + + /** + * Longitude. + */ + longitude?: number; + + /** + * Photo title. + */ + title?: string; + + /** + * Photo width; in pixels. + */ + width?: number; + } + + /** + * A music track media description. + */ + export interface MusicTrackMediaMetadata { + /** + * Album artist name. + */ + albumArtist?: string; + + /** + * Album name. + */ + albumName?: string; + + /** + * Track artist name. + */ + artist?: string; + + /** + * @deprecated: use @see{@link artist} instead + */ + artistName: string; + + /** + * Track composer name. + */ + composer?: string; + + /** + * Disc number. A positive integer. + */ + discNumber?: number; + + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date when the track was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + * @deprecated: Use @see{@link releaseDate} instead + */ + releaseYear?: string; + + /** + * Track name. + */ + songName?: string; + + /** + * Track title. + */ + title?: string; + + /** + * Track number in album. A positive integer. + */ + trackNumber?: number; + } + + /** + * A movie media description. + */ + export interface MovieMediaMetadata { + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date when the movie was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + * @deprecated: use @see{@link releaseDate} instead + */ + releaseYear?: number; + + /** + * Movie studio. + */ + studio?: string; + + /** + * Movie subtitle. + */ + subtitle?: string; + + /** + * Movie title. + */ + title?: string; + } + /** + * Represents the status of a media session. + */ + export interface MediaStatus { + /** + * List of IDs corresponding to the active tracks. + */ + activeTrackIds: number[]; + + /** + * Status of break; if receiver is playing break. This field will be defined only when receiver is playing break. + */ + breakStatus: BreakStatus; + + /** + * ID of this media item (the item that originated the status change). + */ + currentItemId?: number; + + /** + * The current playback position. + */ + currentTime: number; + + /** + * Application-specific media status. + */ + customData?: any; + + /** + * Extended media status information. + */ + extendedStatus: ExtendedMediaStatus; + + /** + * If the state is IDLE; the reason the player went to IDLE state. + */ + idleReason: IdleReason; + + /** + * List of media queue items. + */ + items: QueueItem[]; + + /** + * Seekable range of a live or event stream. It uses relative media time in seconds. It will be undefined for VOD streams. + */ + liveSeekableRange: LiveSeekableRange; + + /** + * ID of the media Item currently loading. If there is no item being loaded; it will be undefined. + */ + loadingItemId?: number; + + /** + * The media information. + */ + media: MediaInformation; + + /** + * Unique id for the session. + */ + mediaSessionId: number; + + /** + * The playback rate. + */ + playbackRate: number; + + /** + * The playback state. + */ + playerState: PlayerState; + + /** + * ID of the next Item; only available if it has been preloaded. Media items can be preloaded and cached temporarily in memory; so when they are loaded later on; the process is faster (as the media does not have to be fetched from the network). + */ + preloadedItemId?: number; + + /** + * Queue data. + */ + queueData: QueueData; + + /** + * The behavior of the queue when all items have been played. + */ + repeatMode: RepeatMode; + + /** + * The commands supported by this player. + */ + supportedMediaCommands: number; + + /** + * + */ + type: MessageType; + + /** + * The video information. + */ + videoInfo: VideoInformation; + + /** + * The current stream volume. + */ + volume: Volume; + } + /** + * Common media metadata used as part of MediaInformation + */ + export class MediaMetadata { + constructor(type: MetadataType); + + /** + * The type of metadata + */ + metadataType: MetadataType; + } + + /** + * Represents the media information. + */ + export interface MediaInformation { + /** + * Partial list of break clips that includes current break clip that receiver is playing or ones that receiver will play shortly after; instead of sending whole list of clips. This is to avoid overflow of MediaStatus message. + */ + breakClips: BreakClip[]; + + /** + * List of breaks. + */ + breaks: Break[]; + + /** + * Typically the url of the media. + */ + contentId: string; + + /** + * The content MIME type. + */ + contentType: string; + + /** + * Optional media url; to allow using contentId for real id. If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + */ + contentUrl?: string; + + /** + * Application-specific media information. + */ + customData?: any; + + /** + * The media duration. + */ + duration?: number; + + /** + * Optional Media entity; provide Google Assistant deep link. + */ + entity?: string; + + /** + * The format of the HLS media segment. + */ + hlsSegmentFormat: HlsSegmentFormat; + + /** + * The media metadata. + */ + metadata: MediaMetadata; + + /** + * The stream type. + */ + streamType: StreamType; + + /** + * The style of text track. + */ + textTrackStyle: TextTrackStyle; + + /** + * The media tracks. + */ + tracks: Track[]; + } + + /** + * Media event LOAD request data. + */ + export interface LoadRequestData extends RequestData { + /** + * Array of trackIds that are active. If the array is not provided; the default tracks will be active. + */ + activeTrackIds: number[]; + + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified;the media player implementation may choose to begin playback immediately. + */ + autoplay?: boolean; + + /** + * Optional user credentials. + */ + credentials?: string; + + /** + * Optional credentials type. The type 'cloud' is a reserved type used by load requests that were originated by voice assistant commands. + */ + credentialsType?: string; + + /** + * Seconds since beginning of content. If the content is live content; and currentTime is not specified; the stream will start at the live position. + */ + currentTime?: number; + + /** + * If the autoplay parameter is specified; the media player will begin playing the content when it is loaded. Even if autoplay is not specified; the media player implementation may choose to begin playback immediately. + */ + media: MediaInformation; + + /** + * The media playback rate. + */ + playbackRate?: number; + + /** + * Queue data. + */ + queueData: QueueData; + } + + /** + * LoadByEntity request data. + */ + export interface LoadByEntityRequestData { + /** + * Content entity information; typically represented by a stringified JSON object + */ + entity: string; + + /** + * Shuffle the items to play. + */ + shuffle?: boolean; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source?: string; + } + + /** + * Provides live seekable range with start and end time in seconds and two more attributes. + */ + export class LiveSeekableRange { + constructor( + start?: number, + end?: number, + isMovingWindow?: boolean, + isLiveDone?: boolean + ); + + /** + * A boolean value indicates whether a live stream is ended. If it is done; the end of live seekable range should stop updating. + */ + isLiveDone?: boolean; + + /** + * A boolean value indicates whether the live seekable range is a moving window. If false; it will be either a expanding range or a fixed range meaning live has ended. + */ + isMovingWindow?: boolean; + } + + /** + * Represents a data message containing item information for each requested ids. + */ + export interface ItemsInfo { + /** + * List of changed itemIds. + */ + items: QueueItem[]; + + /** + * The corresponding request id. + */ + requestId?: number; + + /** + * + */ + type: MessageType; + } + + /** + * An image that describes a receiver application or media item. + * This could be an application icon; cover art; or a thumbnail. + */ + export class Image { + constructor(url: string); + + /** + * The height of the image. + */ + height?: number; + + /** + * the URL to the image + */ + url: string; + + /** + * The width of the image + */ + width?: number; + } + /** Media event GET_STATUS request data. */ + export interface GetStatusRequestData extends RequestData { + /** + * The options of a GET_STATUS request. + */ + options: GetStatusOptions; + } + + /** + * Get items info request data. + */ + export interface GetItemsInfoRequestData extends RequestData { + constructor(itemIds: number[]): GetItemsInfoRequestData; + + /** + * List of item ids to be requested. + */ + itemIds: number[]; + } + /** + * A generic media description. + */ + export interface GenericMediaMetadata { + /** + * Content images. Examples would include cover art or a thumbnail of the currently playing media. + */ + images: Image[]; + + /** + * ISO 8601 date and/or time when the content was released; e.g. 2014-02-10. + */ + releaseDate?: string; + + /** + *@deprecated - use @see{@link releaseDate} instead + */ + releaseYear?: number; + + /** + * Content subtitle. + */ + subtitle?: string; + + /** + * Content title. + */ + title?: string; + } + + /** + * Focus state change message. + */ + export interface FocusStateRequestData { + /** + * The focus state of the app. + */ + state: FocusState; + } + + /** Fetch items request data. */ + export class FetchItemsRequestData extends RequestData { + constructor(itemId: number, nextCount: number, prevCount: number); + + /** + * ID of the reference media item for fetching more items. + */ + itemId: number; + + /** + * Number of items after the reference item to be fetched. + */ + nextCount: number; + + /** + * Number of items before the reference item to be fetched. + */ + prevCount: number; + } + + /** + * Extended media status information + */ + export class ExtendedMediaStatus { + constructor(playerState: MediaInformation, opt_media?: MediaInformation); + + /** + * + */ + media: MediaInformation; + + /** + * + */ + playerState: ExtendedPlayerState; + } + + /** Event data for @see{@link EventType.ERROR} event. */ + export class ErrorEvent { + constructor(detailedErrorCode?: DetailedErrorCode, error?: any); + /** + * An error code representing the cause of the error. + */ + detailedErrorCode?: DetailedErrorCode; + + /** + * The error object. + * This could be an Error object (e.g.; if an Error was thrown in an event handler) + * or an object with error information (e.g.; if the receiver received an invalid command). + */ + error?: any; + } + + export class ErrorData { + constructor(type: ErrorType); + + /** + * Application-specific data for this request. + * It enables the sender and receiver to easily extend the media protocol without having to use a new namespace with custom messages. + */ + customData?: any; + + /** + Id of the request; used to correlate request/response. + */ + requestId?: number; + } + + /** Media event EDIT_TRACKS_INFO request data. */ + export interface EditTracksInfoRequestData extends RequestData { + /** + * Array of the Track trackIds that should be active. + * If it is not provided; the active tracks will not change. + * If the array is empty; no track will be active. + */ + activeTrackIds?: number[]; + + /** + * Flag to enable or disable text tracks. + * If false it will disable all text tracks; + * if true it will enable the first text track; or the previous active text tracks. + * This flag is ignored if activeTrackIds or language is provided. + */ + enableTextTracks?: boolean; + + /** + * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * It allows receiver apps to use user saved preference instead of spoken language. + */ + isSuggestedLanguage?: boolean; + + /** + * Language for the tracks that should be active. The language field will take precedence over activeTrackIds if both are specified. + */ + language?: string; + + /** + * + */ + textTrackStyle?: TextTrackStyle; + } + + /** + * Media event EDIT_AUDIO_TRACKS request data. If language is not provided; the default audio track for the media will be enabled. + */ + export interface EditAudioTracksRequestData extends RequestData { + /** + * Indicates that the provided language was not explicit user request; but rather inferred from used language in voice query. + * It allows receiver apps to use user saved preference instead of spoken language. + */ + isSuggestedLanguage?: boolean; + + /** + * + */ + language?: string; + } + + /** DisplayStatus request data. */ + export interface DisplayStatusRequestData { + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source: string; + } + + /** CustomCommand request data. */ + export interface CustomCommandRequestData { + /** + * Custom Data; typically represented by a stringified JSON object. + */ + data: string; + + /** + * Optional request source. It contain the assistent query that initiate the request. + */ + source: string; + } + /** Cloud media status. Media status that is only sent to the cloud sender. */ + export class CloudMediaStatus { + constructor(); + } + + export class BreakStatus { + constructor(currentBreakTime: number, currentBreakClipTime: number); + + /** + * Id of current break clip. + */ + breakClipId: string; + + /** + * Id of current break. + */ + breakId: string; + + /** + * Time in sec elapsed after current break clip starts. + */ + currentBreakClipTime: number; + + /** + * Time in sec elapsed after current break starts. + */ + currentBreakTime: number; + + /** + * The time in sec when this break clip becomes skippable. + * 5 means that end user can skip this break clip after 5 seconds. + * If this field is not defined; it means that current break clip is not skippable. + */ + whenSkippable: number; + } + + /** + * Represents break clip (e.g. a clip of ad during ad break) + */ + export class BreakClip { + constructor(id: string); + + /** + * Url of page that sender will display; when end user clicks link on sender UI; while receiver is playing this clip. + */ + clickThroughUrl?: string; + /** + * Typically the url of the break media (playing on the receiver). + */ + contentId?: string; + /** + * The content MIME type. + */ + contentType?: string; + /** + * Optional break media url; to allow using contentId for real id. + * If contentUrl is provided; it will be used as media url; otherwise the contentId will be used as the media url. + */ + contentUrl?: string; + /** + * Application-specific break clip data. + */ + customData?: any; + /** + * Duration of break clip in sec. + */ + duration?: number; + /** + * The format of the HLS media segment. + */ + hlsSegmentFormat: HlsSegmentFormat; + /** + * Unique id of break clip. + */ + id: string; + /** + * Url of content that sender will display while receiver is playing this clip. + */ + posterUrl?: string; + /** + * Title of break clip. Sender might display this on its screen; if provided. + */ + title?: string; + /** + * VAST ad request configuration. Used if contentId or contentUrl is not provided. + */ + vastAdsRequest: VastAdsRequest; + /** + * The time in sec when this break clip becomes skippable. + * 5 means that end user can skip this break clip after 5 seconds. + * If this field is not defined; it means that current break clip is not skippable. + */ + whenSkippable?: number; + } + + /** Represents break (e.g. ad break) included in main video. */ + export class Break { + constructor(id: string, breakClipIds: string[], position: number); + /** + * List of ids of break clip that this break includes. + */ + breakClipIds: string[]; + /** + * Duration of break in sec. + */ + duration?: number; + /** + * Unique id of break. + */ + id: string; + /** + * If true; indicates this is embedded break in main stream. + */ + isEmbedded?: boolean; + /** + * Whether break is watched. + * Sender can change color of progress bar marker corresponding to this break once this field changes from false to true; + * denoting that the end-user already watched this break. + */ + isWatched: boolean; + /** + * Where the break is located inside main video. -1 represents the end of main video. + */ + position: number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.system.d.ts b/types/chromecast-caf-receiver/cast.framework.system.d.ts new file mode 100644 index 0000000000..1f465761b0 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.system.d.ts @@ -0,0 +1,177 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { EventType } from './cast.framework.events'; +export = cast.framework.system; + +declare namespace cast.framework.system { + export type SystemState = + | 'NOT_STARTED' + | 'STARTING_IN_BACKGROUND' + | 'STARTING' + | 'READY' + | 'STOPPING_IN_BACKGROUND' + | 'STOPPING'; + + export type StandbyState = 'STANDBY' | 'NOT_STANDBY' | 'UNKNOWN'; + + export type DisconnectReason = 'REQUESTED_BY_SENDER' | 'ERROR' | 'UNKNOWN'; + + /** + * Event dispatched by @see{@link CastReceiverManager} when the visibility of the application changes (HDMI input change; TV is turned off). + */ + export class VisibilityChangedEvent { + constructor(isVisible: boolean); + + /** + * Whether the Cast device is the active input or not. + */ + isVisible: boolean; + } + + /** + * Represents the system volume data. + */ + export interface SystemVolumeData { + /** + * The level (from 0.0 to 1.0) of the system volume. + */ + level: number; + + /** + * Whether the system volume is muted or not. + */ + muted: boolean; + } + /** + * Event dispatched by @see{CastReceiverManager} when the system volume changes. + */ + export class SystemVolumeChangedEvent extends Event { + constructor(volume: SystemVolumeData); + + /** + * The system volume data + */ + data: SystemVolumeData; + } + /** + * Event dispatched by @see{@link CastReceiverManager} when the TV enters/leaves the standby state. + */ + export class StandbyChangedEvent { + constructor(isStandby: boolean); + + /** + * + */ + isStandby: boolean; + } + /** + * Whether the TV is in standby or not. + */ + export interface ShutdownEvent extends Event {} + + /** + * Event dispatched by @see{@link CastReceiverManager} when a sender is disconnected. + */ + export class SenderDisconnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; + + /** + * The user agent of the sender. + */ + userAgent: string; + + /** + * The reason the sender was disconnected. + */ + reason?: DisconnectReason; + } + + /** + * Event dispatched by @see{@link CastReceiverManager} when a sender is connected. + */ + export class SenderConnectedEvent extends Event { + constructor(senderId: string, userAgent: string); + /** + * The ID of the sender connected. + */ + senderId: string; + + /** + * The user agent of the sender. + */ + userAgent: string; + } + + /** + * Represents the data of a connected sender device. + */ + export interface Sender { + /** + * The sender Id. + */ + id: string; + + /** + * Indicate the sender supports large messages (>64KB). + */ + largeMessageSupported?: boolean; + + /** + * The userAgent of the sender. + */ + userAgent?: string; + } + + /** + * Event dispatched by CastReceiverManager when the system is ready. + */ + export class ReadyEvent { + constructor(applicationData: ApplicationData); + + /** + * The application data + */ + data: ApplicationData; + } + + /** + * Event dispatched by @see{@link CastReceiverManager} when the system needs to update the restriction on maximum video resolution. + */ + export class MaxVideoResolutionChangedEvent extends Event { + constructor(height: number); + + /** + * Maximum video resolution requested by the system. The value of 0 means there is no restriction. + */ + height: number; + } + /** Event dispatched by @see{@link CastReceiverManager} when the systems starts to create feedback report. */ + export interface FeedbackStartedEvent extends Event {} + /** Event dispatched by @see{@link CastReceiverContext} which contains system information. */ + export class Event { + constructor(type: EventType, data?: any); + } + + /** Represents the data of the launched application. */ + export interface ApplicationData { + id(): string; + launchingSenderId(): string; + name(): string; + namespaces(): string[]; + sessionId(): number; + } +} diff --git a/types/chromecast-caf-receiver/cast.framework.ui.d.ts b/types/chromecast-caf-receiver/cast.framework.ui.d.ts new file mode 100644 index 0000000000..fbc61f56d0 --- /dev/null +++ b/types/chromecast-caf-receiver/cast.framework.ui.d.ts @@ -0,0 +1,194 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { PlayerDataEventType } from './cast.framework.ui'; +import { MediaMetadata } from './cast.framework.messages'; + +export = cast.framework.ui; + +declare namespace cast.framework.ui { + export type ContentType = 'VIDEO' | 'AUDIO' | 'IMAGE'; + + export type State = + | 'LAUNCHING' + | 'IDLE' + | 'LOADING' + | 'BUFFERING' + | 'PAUSED' + | 'PLAYING'; + + export type PlayerDataEventType = + | 'ANY_CHANGE' + | 'STATE_CHANGED' + | 'IS_SEEKING_CHANGED' + | 'DURATION_CHANGED' + | 'CURRENT_TIME_CHANGED' + | 'METADATA_CHANGED' + | 'TITLE_CHANGED' + | 'SUBTITLE_CHANGED' + | 'THUMBNAIL_URL_CHANGED' + | 'NEXT_TITLE_CHANGED' + | 'NEXT_SUBTITLE_CHANGED' + | 'NEXT_THUMBNAIL_URL_CHANGED' + | 'PRELOADING_NEXT_CHANGED' + | 'CONTENT_TYPE_CHANGED' + | 'IS_LIVE_CHANGED' + | 'BREAK_PERCENTAGE_POSITIONS_CHANGED' + | 'IS_PLAYING_BREAK_CHANGED' + | 'IS_BREAK_SKIPPABLE_CHANGED' + | 'WHEN_SKIPPABLE_CHANGED' + | 'NUMBER_BREAK_CLIPS_CHANGED' + | 'CURRENT_BREAK_CLIP_NUMBER_CHANGED' + | 'DISPLAY_STATUS_CHANGED'; + + /** + * Player data changed event. Provides the changed field (type); and new value. + */ + export class PlayerDataChangedEvent { + constructor(type: PlayerDataEventType, field: string, value: any); + + /** + * The field name that was changed. + */ + field: string; + + /** + * + */ + type: PlayerDataEventType; + + /** + * The new field value. + */ + value: any; + } + /** + * Player data binder. Bind a player data object to the player state. The player data will be updated to reflect correctly the current player state without firing any change event. + */ + export class PlayerDataBinder { + constructor(playerData: PlayerData | any); + + /** + * Add listener to player data changes. + */ + // addEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + + /** + * Remove listener to player data changes. + */ + // removeEventListener: (type: PlayerDataEventType; listener: PlayerDataChangedEventHandler); + } + /** + * Player data. Provide the player media and break state. + */ + export interface PlayerData { + /** + * Array of breaks positions in percentage. + */ + breakPercentagePositions: number[]; + + /** + * Content Type. + */ + contentType: ContentType; + + /** + * The number of the current playing break clip in the break. + */ + currentBreakClipNumber: number; + + /** + * Media current position in seconds; or break current position if playing break. + */ + currentTime: number; + + /** + * Whether the player metadata (ie: title; currentTime) should be displayed. This will be true if at least one field in the metadata should be displayed. In some cases; displayStatus will be true; but parts of the metadata should be hidden (ie: the media title while media is seeking). In these cases; additional css can be applied to hide those elements. For cases where the media is audio-only; this will almost always be true. In cases where the media is video; this will be true when: (1) the video is loading; buffering; or seeking (2) a play request was made in the last five seconds while media is already playing; (3) there is a request made to show the status in the last five seconds; or (4) the media was paused in the last five seconds. + */ + displayStatus: boolean; + + /** + * Media duration in seconds; Or break duration if playing break. + */ + duration: number; + + /** + * Indicate break clip can be skipped. + */ + isBreakSkippable: boolean; + + /** + * Indicate if the content is a live stream. + */ + isLive: boolean; + + /** + * Indicate that the receiver is playing a break. + */ + isPlayingBreak: boolean; + + /** + * Indicate the player is seeking (can be either during playing or pausing). + */ + isSeeking: boolean; + + /** + * Media metadata. + */ + metadata: MediaMetadata | any; + + /** + * Next Item subtitle. + */ + nextSubtitle: string; + + /** + * Next Item thumbnail url. + */ + nextThumbnailUrl: string; + + /** + * Next Item title. + */ + nextTitle: string; + + /** + * Number of break clips in current break. + */ + numberBreakClips: number; + + /** + * Flag to show/hide next item metadata. + */ + preloadingNext: boolean; + + /** + * Current player state. + */ + state: State; + + /** + * Content thumbnail url. + */ + thumbnailUrl: string; + + /** + * Content title. + */ + title: string; + + /** + * Provide the time a break is skipable - relative to current playback time. Undefined if not skippable. + */ + whenSkippable?: number; + } +} diff --git a/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts new file mode 100644 index 0000000000..a4f59bd985 --- /dev/null +++ b/types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts @@ -0,0 +1,66 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// +/// + +import { TextTracksManager } from "cast.framework"; +import { StandbyChangedEvent } from "cast.framework.system"; +import { PlayerData, ContentType } from "cast.framework.ui"; +import { BreakManager } from "cast.framework.breaks"; +import { MediaStatusEvent } from "cast.framework.events"; +import { Track, Break, MediaStatus, QueueData } from "cast.framework.messages"; + +const ct = ContentType.VIDEO; +// framework tests +const track = new Track(123, {}); +const ttm = new TextTracksManager({}); +ttm.addTracks(track); + +// $ExpectError +ttm.addTracks("should fail"); + +// system tests +const sce = new StandbyChangedEvent(true); +// $ExpectError +const wrongSce = new StandbyChangedEvent("error"); + +const result: boolean = sce.isStandby; +// $ExpectError +const failure: string = sce.isStandby; + +// ui tests +const pd = new PlayerData(); + +const cn: number = pd.currentBreakClipNumber; +// $ExpectError +const wrongCn: boolean = pd.currentBreakClipNumber; + +// breaks tests +const bm: BreakManager = new BreakManager(); +const brk1: Break = bm.getBreakById("123"); +// $ExpectError +const brk2: string = bm.getBreakById("123"); +// $ExpectError +const brk3: Break = bm.getBreakById(123); +// events tests + +const evt: MediaStatusEvent = new MediaStatusEvent(); +const ms: MediaStatus = evt.mediaStatus; +// $ExpectError +const ms: string = evt.mediaStatus; + +// messages tests +const qd = new QueueData("id", "name", "description", "mode"); +// $ExpectError +const wrongQd = new QueueData({}); +const name: string = qd.name; +// $ExpectError +const wrongName: number = qd.name; diff --git a/types/chromecast-caf-receiver/index.d.ts b/types/chromecast-caf-receiver/index.d.ts new file mode 100644 index 0000000000..5dc89456e6 --- /dev/null +++ b/types/chromecast-caf-receiver/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for chromecast-caf-receiver 3.x +// Project: https://developers.google.com/cast/docs/reference/caf_receiver/ +// Definitions by: Craig Bruce https://github.com/craigrbruce +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// +/// +/// +/// + +import { PlayerDataChangedEvent } from './cast.framework.ui'; +import { NetworkRequestInfo } from './cast.framework'; +import { Event } from './cast.framework.events'; + +export = cast; +declare namespace cast { + export type EventHandler = (event: Event) => void; + export type PlayerDataChangedEventHandler = ( + event: PlayerDataChangedEvent + ) => void; + export type RequestHandler = (request: NetworkRequestInfo) => void; + export type BinaryHandler = (data: Uint8Array) => Uint8Array; +} diff --git a/types/chromecast-caf-receiver/tsconfig.json b/types/chromecast-caf-receiver/tsconfig.json new file mode 100644 index 0000000000..5c13aa8765 --- /dev/null +++ b/types/chromecast-caf-receiver/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chromecast-caf-receiver-tests.ts" + ] +} diff --git a/types/chromecast-caf-receiver/tslint.json b/types/chromecast-caf-receiver/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chromecast-caf-receiver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 34026b93c0468e1428770d964bae94e56c1eee8c Mon Sep 17 00:00:00 2001 From: Kiyotoshi Ichikawa Date: Thu, 5 Apr 2018 13:03:08 -0400 Subject: [PATCH 007/506] [browser-sync] Type definition for Option type is missing many valid properties. Also appending tests to cover newly added properties/interfaces. --- types/browser-sync/browser-sync-tests.ts | 276 +++++++++++++++++++++-- types/browser-sync/index.d.ts | 147 +++++++++--- 2 files changed, 379 insertions(+), 44 deletions(-) diff --git a/types/browser-sync/browser-sync-tests.ts b/types/browser-sync/browser-sync-tests.ts index bcd829367a..613f8aee25 100644 --- a/types/browser-sync/browser-sync-tests.ts +++ b/types/browser-sync/browser-sync-tests.ts @@ -8,11 +8,98 @@ import browserSync = require("browser-sync"); })(); browserSync({ - server: { - baseDir: "./" + ui: true +}); + +browserSync({ + ui: { + port: 9000, + weinre: { + port: 9001 + } } }); +browserSync({ + files: "app/css/style.css" +}); + +browserSync({ + files: [ + "app/css/style.css", + "app/js/*.js" + ] +}); + +browserSync({ + files: [ + "app/css/style.css", + "!app/js/*.js" + ] +}); + +browserSync({ + files: [ + "wp-content/themes/**/*.css", + { + match: ["wp-content/themes/**/*.css"], + fn: function (event, file) { + /** Custom event handler **/ + } + } + ] +}); + +browserSync({ + watchEvents: [ + "change", + "add", + "unlink", + "addDir", + "unlinkDir" + ] +}); + +browserSync({ + watch: true +}); + +browserSync({ + ignore: [ + "app/js/*.js" + ] +}); + +browserSync({ + single: true +}); + +browserSync({ + watchOptions: { + ignoreInitial: true, + ignored: '*.txt' + }, + files: ['./app'] +}); + +browserSync({ + files: [ + { + match: ["wp-content/themes/**/*.php"], + fn: function (event, file) { + /** Custom event handler **/ + }, + options: { + ignored: '*.txt' + } + } + ] +}); + +browserSync({ + server: "app" +}); + // multiple base directory browserSync({ server: { @@ -20,6 +107,39 @@ browserSync({ } }); +browserSync({ + server: true +}); + +browserSync({ + server: { + baseDir: "./" + } +}); + +browserSync({ + server: { + baseDir: "./", + index: "index.htm" + } +}); + +browserSync({ + server: { + baseDir: "./", + directory: true + } +}); + +browserSync({ + server: { + baseDir: "app", + serveStaticOptions: { + extensions: ["html"] + } + } +}); + browserSync({ proxy: "yourlocal.dev" }); @@ -27,8 +147,8 @@ browserSync({ browserSync({ proxy: { target: "http://yourlocal.dev", - proxyReq: function(proxyReq) { - console.log(proxyReq); + proxyReq: function (proxyReq) { + console.log(proxyReq); } } }); @@ -37,7 +157,7 @@ browserSync({ proxy: { target: "http://yourlocal.dev", proxyReq: [ - function(proxyReq) { + function (proxyReq) { console.log(proxyReq); } ] @@ -47,7 +167,7 @@ browserSync({ browserSync({ proxy: { target: "http://yourlocal.dev", - proxyRes: function(proxyRes, req, res) { + proxyRes: function (proxyRes, req, res) { console.log(proxyRes); } } @@ -57,13 +177,137 @@ browserSync({ proxy: { target: "http://yourlocal.dev", proxyRes: [ - function(proxyRes, req, res) { + function (proxyRes, req, res) { console.log(proxyRes); } ] } }); +browserSync({ + proxy: "https://yourlocal.dev", + https: { + key: "./path/to/the/key/file.key", + cert: "./path/to/the/cert/file.cer" + } +}); + +browserSync({ + port: 3000 +}); + +browserSync({ + proxy: "http://yourlocal.dev", + serveStatic: ['.', './app/css'] +}); + +browserSync({ + proxy: "http://yourlocal.dev", + serveStatic: [{ + route: '/assets', + dir: 'tmp' + }] +}); + +browserSync({ + proxy: "http://yourlocal.dev", + serveStatic: [{ + route: ['/assets', '/content'], + dir: 'tmp' + }] +}); + +browserSync({ + proxy: "http://yourlocal.dev", + serveStatic: [{ + route: '/assets', + dir: ['./tmp', './app'] + }] +}); + +browserSync({ + serveStatic: ['.', './app', './temp'], + serveStaticOptions: { + extensions: ['html'] // pretty urls + } +}); + +browserSync({ + https: true +}); + +browserSync({ + server: "./app", + https: true +}); + +browserSync({ + server: "./app", + https: { + key: "./path/to/the/key/file.key", + cert: "./path/to/the/cert/file.cer" + } +}); + +browserSync({ + httpModule: "http2" +}); + +browserSync({ + ghostMode: { + clicks: true, + scroll: true, + forms: { + inputs: true, + submit: true, + toggles: true + } + }, + proxy: "https://yourlocal.dev" +}); + +/** + * Not testing a bunch because they are either only string or boolean types. + * ....Also just got lazy and tired of writing the simple ones. + */ + +browserSync({ + snippetOptions: { + + // Ignore all HTML files within the templates folder + blacklist: [ + "templates/*.html" + ], + // Provide a custom Regex for inserting the snippet. + rule: { + match: /<\/body>/i, + fn: function (snippet, match) { + return snippet + match; + } + } + } +}); + +browserSync({ + rewriteRules: [ + { + match: /Browsersync/g, + fn: function (req, res, match) { + return 'kittenz'; + } + } + ] +}); + +browserSync({ + rewriteRules: [ + { + match: /(cats|kitten[sz]) are mediocre/g, + replace: "$1 are excellent" + } + ] +}); + var config = { server: { baseDir: "./" @@ -84,13 +328,13 @@ browserSync(config, function (err, bs) { browserSync.reload(); // single file -browserSync.reload( "styles.css" ); +browserSync.reload("styles.css"); // multiple files -browserSync.reload( ["styles.css", "ie.css"] ); +browserSync.reload(["styles.css", "ie.css"]); // streams support -browserSync.reload( { stream: true } ); +browserSync.reload({ stream: true }); browserSync.notify("Compiling, please wait!"); @@ -143,19 +387,19 @@ browser.exit(); browser.stream(); // -- "once" option. -browser.stream({once: true}); +browser.stream({ once: true }); // -- "match" option (string). -browser.stream({match: "**/*.js"}); +browser.stream({ match: "**/*.js" }); // -- "match" option (RegExp). -browser.stream({match: /\.js$/}); +browser.stream({ match: /\.js$/ }); // -- "match" option (function). -browser.stream({match: (testString) => true}); +browser.stream({ match: (testString) => true }); // -- "match" option (array). -browser.stream({match: ["**/*.js", /\.js$/, (testString) => true]}); +browser.stream({ match: ["**/*.js", /\.js$/, (testString) => true] }); // -- Both options. -browser.stream({once: true, match: ["**/*.js", /\.js$/, (testString) => true]}); +browser.stream({ once: true, match: ["**/*.js", /\.js$/, (testString) => true] }); diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index b22054c367..3b97fc8616 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -1,16 +1,21 @@ // Type definitions for browser-sync // Project: http://www.browsersync.io/ -// Definitions by: Asana , Joe Skeen +// Definitions by: Asana , +// Joe Skeen // Thomas "Thasmo" Deinhamer +// Kiyotoshi Ichikawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// /// +/// import * as chokidar from "chokidar"; import * as fs from "fs"; import * as http from "http"; import * as mm from "micromatch"; +import { ServeStaticOptions } from "serve-static"; declare namespace browserSync { interface Options { @@ -20,7 +25,7 @@ declare namespace browserSync { * * port - Default: 3001 * weinre.port - Default: 8080 - * Note: requires at least version 2.0.0 + * Note: Requires at least version 2.0.0. */ ui?: UIOptions | boolean; /** @@ -29,20 +34,40 @@ declare namespace browserSync { * patterns. * Default: false */ - files?: string | (string | FileCallback)[]; + files?: string | (string | FileCallback | object)[]; + /** + * Specify which file events to respond to. + * Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir` + */ + watchEvents?: string[]; + /** + * Watch files automatically. + */ + watch?: boolean; + /** + * Patterns for any watchers to ignore. + * Anything provided here will end up inside 'watchOptions.ignored'. + */ + ignore?: string[]; + /** + * Serve an index.html file for all non-asset routes. + * Useful when using client-routers. + */ + single?: boolean; /** * File watching options that get passed along to Chokidar. Check their docs for available options * Default: undefined - * Note: requires at least version 2.6.0 + * Note: Requires at least version 2.6.0. */ watchOptions?: chokidar.WatchOptions; /** * Use the built-in static server for basic HTML/JS/CSS websites. * Default: false */ - server?: ServerOptions; + server?: string | boolean | string[] | ServerOptions; /** * Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site. + * Passing only a URL as a string equates to passing only target property of ProxyOptions type. * target - Default: undefined * ws - Default: undefined * middleware - Default: undefined @@ -50,25 +75,40 @@ declare namespace browserSync { * proxyRes - Default: undefined * proxyReq - Default: undefined */ - proxy?: string | boolean | ProxyOptions; + proxy?: string | ProxyOptions; /** * Use a specific port (instead of the one auto-detected by Browsersync) * Default: 3000 */ port?: number; + /** + * Functions or actual plugins used as middleware. + */ + middleware?: MiddlewareHandler | PerRouteMiddleware | (MiddlewareHandler | PerRouteMiddleware)[]; /** * Add additional directories from which static files should be served. * Should only be used in proxy or snippet mode. * Default: [] - * Note: requires at least version 2.8.0 + * Note: Requires at least version 2.8.0. */ - serveStatic?: string[]; + serveStatic?: (string | { route?: string | string[], dir?: string | string[]})[]; + /** + * Options that are passed to the serve-static middleware when you use the + * string[] syntax: eg: `serveStatic: ['./app']`. + * Please see [serve-static](https://github.com/expressjs/serve-static) for details. + */ + serveStaticOptions?: ServeStaticOptions; /** * Enable https for localhost development. - * Note - this is not needed for proxy option as it will be inferred from your target url. - * Note: requires at least version 1.3.0 + * Note: This may not be needed for proxy option as it will try to infer from your target url. + * Note: If privacy error is encountered please see HttpsOptions below, setting those will resolve. + * Note: Requires at least version 1.3.0. */ - https?: boolean; + https?: boolean | HttpsOptions; + /** + * Override http module to allow using 3rd party server modules (such as http2). + */ + httpModule?: string; /** * Clicks, Scrolls & Form inputs on any device will be mirrored to all others. * clicks - Default: true @@ -84,7 +124,7 @@ declare namespace browserSync { /** * Change the console logging prefix. Useful if you're creating your own project based on Browsersync * Default: BS - * Note: requires at least version 1.5.1 + * Note: Requires at least version 1.5.1. */ logPrefix?: string; /** @@ -100,19 +140,19 @@ declare namespace browserSync { /** * Log the snippet to the console when you're in snippet mode (no proxy/server) * Default: true - * Note: requires at least version 1.5.2 + * Note: Requires at least version 1.5.2. */ logSnippet?: boolean; /** * You can control how the snippet is injected onto each page via a custom regex + function. * You can also provide patterns for certain urls that should be ignored from the snippet injection. - * Note: requires at least version 2.0.0 + * Note: Requires at least version 2.0.0. */ snippetOptions?: SnippetOptions; /** * Add additional HTML rewriting rules. * Default: false - * Note: requires at least version 2.4.0 + * Note: Requires at least version 2.4.0. */ rewriteRules?: boolean | RewriteRules[]; /** @@ -139,7 +179,7 @@ declare namespace browserSync { /** * Add HTTP access control (CORS) headers to assets served by Browsersync. * Default: false - * Note: requires at least version 2.16.0 + * Note: Requires at least version 2.16.0. */ cors?: boolean; /** @@ -177,12 +217,12 @@ declare namespace browserSync { /** * Sync the scroll position of any element on the page. Add any amount of CSS selectors * Default: [] - * Note: requires at least version 2.9.0 + * Note: Requires at least version 2.9.0. */ scrollElements?: string[]; /** * Default: [] - * Note: requires at least version 2.9.0 + * Note: Requires at least version 2.9.0. * Sync the scroll position of any element on the page - where any scrolled element will cause * all others to match scroll position. This is helpful when a breakpoint alters which element * is actually scrolling @@ -197,13 +237,18 @@ declare namespace browserSync { /** * Restrict the frequency in which browser:reload events can be emitted to connected clients * Default: 0 - * Note: requires at least version 2.6.0 + * Note: Requires at least version 2.6.0. */ reloadDebounce?: number; + /** + * Emit only the first event during sequential time windows of a specified duration. + * Note: Requires at least version 2.13.0. + */ + reloadThrottle?: number; /** * User provided plugins * Default: [] - * Note: requires at least version 2.6.0 + * Note: Requires at least version 2.6.0. */ plugins?: any[]; /** @@ -224,6 +269,10 @@ declare namespace browserSync { * Override host detection if you know the correct IP to use */ host?: string; + /** + * Support environments where dynamic hostnames are not required (ie: electron). + */ + localOnly?: boolean; /** * Send file-change events to the browser * Default: true @@ -234,10 +283,16 @@ declare namespace browserSync { * Default: true */ timestamps?: boolean; + /** + * ¯\_(ツ)_/¯ + * Best guess, when ghostMode (or SocketIO?) is setup the events + * listed here will be emitted and able to hook into. + */ + clientEvents?: string[]; /** * Alter the script path for complete control over where the Browsersync Javascript is served * from. Whatever you return from this function will be used as the script path. - * Note: requires at least version 1.5.0 + * Note: Requires at least version 1.5.0. */ scriptPath?: (path: string) => string; /** @@ -248,10 +303,21 @@ declare namespace browserSync { * domain - Default: undefined * port - Default: undefined * clients.heartbeatTimeout - Default: 5000 - * Note: requires at least version 1.6.2 + * Note: Requires at least version 1.6.2. */ socket?: SocketOptions; - middleware?: MiddlewareHandler | PerRouteMiddleware | (MiddlewareHandler | PerRouteMiddleware)[]; + /** + * ¯\_(ツ)_/¯ + */ + tagNames?: TagNamesOptions; + /** + * ¯\_(ツ)_/¯ + */ + injectFileTypes?: string[]; + /** + * ¯\_(ツ)_/¯ + */ + excludeFileTypes?: string[]; } interface Hash { @@ -287,6 +353,7 @@ declare namespace browserSync { routes?: Hash; /** configure custom middleware */ middleware?: (MiddlewareHandler | PerRouteMiddleware)[]; + serveStaticOptions?: ServeStaticOptions } interface ProxyOptions { @@ -298,6 +365,11 @@ declare namespace browserSync { proxyReq?: ((res: http.ServerRequest) => any)[] | ((res: http.ServerRequest) => any); } + interface HttpsOptions { + key?: string; + cert?: string; + } + interface MiddlewareHandler { (req: http.IncomingMessage, res: http.ServerResponse, next: Function): any; } @@ -310,11 +382,17 @@ declare namespace browserSync { interface GhostOptions { clicks?: boolean; scroll?: boolean; - forms?: boolean; + forms?: boolean | { + submit?: boolean; + inputs?: boolean; + toggles?: boolean; + }; } interface SnippetOptions { - ignorePaths?: string; + async?: boolean, + whitelist?: string[], + blacklist?: string[], rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any }; } @@ -327,9 +405,22 @@ declare namespace browserSync { clients?: { heartbeatTimeout?: number; }; } + interface TagNamesOptions { + less?: string; + scss?: string; + css?: string; + jpg?: string; + jpeg?: string; + png?: string; + svg?: string; + gif?: string; + js?: string; + } + interface RewriteRules { match: RegExp; - fn: (match: string) => string; + replace?: string; + fn?: (req: http.IncomingMessage, res: http.ServerResponse, match: string) => string; } interface StreamOptions { @@ -342,7 +433,7 @@ declare namespace browserSync { * Start the Browsersync service. This will launch a server, proxy or start the snippet mode * depending on your use-case. */ - (config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance; + (config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance; /** * Create a Browsersync instance * @param name an identifier that can used for retrieval later @@ -367,7 +458,7 @@ declare namespace browserSync { * Start the Browsersync service. This will launch a server, proxy or start the snippet mode * depending on your use-case. */ - init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance; + init(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance; /** * Reload the browser * The reload method will inform all browsers about changed files and will either cause the browser From fde76994561dd7151f8b002fd646690c176e85a3 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Thu, 19 Apr 2018 23:42:02 -0400 Subject: [PATCH 008/506] Fix up next/router types * add name to index.ts * update tests --- types/next/index.d.ts | 1 + types/next/router.d.ts | 8 +++-- types/next/test/next-router-tests.tsx | 46 +++++++++++++-------------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..e0ec456724 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD +// Scott Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 181208518f..a5cfb42c90 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -9,7 +9,7 @@ export interface EventChangeOptions { } export type RouterCallback = () => void; -export interface SingletonRouter { +export interface RouterProps { readyCallbacks: RouterCallback[]; ready(cb: RouterCallback): void; @@ -53,8 +53,12 @@ export interface SingletonRouter { onRouteChangeError?(error: any, url: string): void; } +export interface SingletonRouter { + router: RouterProps; +} + export function withRouter( - Component: React.ComponentType, + Component: React.ComponentType, ): React.ComponentType; export const Singleton: SingletonRouter; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index fe82d6f0b2..7957f5e8a2 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -2,10 +2,10 @@ import Router, * as r from "next/router"; import * as React from "react"; import * as qs from "querystring"; -Router.readyCallbacks.push(() => { +Router.router.readyCallbacks.push(() => { console.log("I'll get called when the router initializes."); }); -Router.ready(() => { +Router.router.ready(() => { console.log( "I'll get called immediately if the router initializes, or when it eventually does.", ); @@ -13,8 +13,8 @@ Router.ready(() => { // Access readonly properties of the router. -Object.keys(Router.components).forEach(key => { - const c = Router.components[key]; +Object.keys(Router.router.components).forEach(key => { + const c = Router.router.components[key]; c.err.isAnAny; return ; @@ -26,51 +26,51 @@ function split(routeLike: string) { }); } -if (Router.asPath) { - split(Router.asPath); - split(Router.asPath); +if (Router.router.asPath) { + split(Router.router.asPath); + split(Router.router.asPath); } -split(Router.pathname); +split(Router.router.pathname); -const query = `?${qs.stringify(Router.query)}`; +const query = `?${qs.stringify(Router.router.query)}`; // Assign some callback methods. -Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); -Router.onRouteChangeStart = (url: string) => +Router.router.onAppUpdated = (nextRoute: string) => console.log(nextRoute); +Router.router.onRouteChangeStart = (url: string) => console.log("Route is starting to change.", url); -Router.onBeforeHistoryChange = (as: string) => +Router.router.onBeforeHistoryChange = (as: string) => console.log("History hasn't changed yet.", as); -Router.onRouteChangeComplete = (url: string) => +Router.router.onRouteChangeComplete = (url: string) => console.log("Route chaneg is complete.", url); -Router.onRouteChangeError = (err: any, url: string) => +Router.router.onRouteChangeError = (err: any, url: string) => console.log("Route is starting to change.", url, err); // Call methods on the router itself. -Router.reload("/route").then(() => console.log("route was reloaded")); -Router.back(); +Router.router.reload("/route").then(() => console.log("route was reloaded")); +Router.router.back(); -Router.push("/route").then((success: boolean) => +Router.router.push("/route").then((success: boolean) => console.log("route push success: ", success), ); -Router.push("/route", "/asRoute").then((success: boolean) => +Router.router.push("/route", "/asRoute").then((success: boolean) => console.log("route push success: ", success), ); -Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => +Router.router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) => console.log("route push success: ", success), ); -Router.replace("/route").then((success: boolean) => +Router.router.replace("/route").then((success: boolean) => console.log("route replace success: ", success), ); -Router.replace("/route", "/asRoute").then((success: boolean) => +Router.router.replace("/route", "/asRoute").then((success: boolean) => console.log("route replace success: ", success), ); -Router.replace("/route", "/asRoute", { +Router.router.replace("/route", "/asRoute", { shallow: false, }).then((success: boolean) => console.log("route replace success: ", success)); -Router.prefetch("/route").then(Component => { +Router.router.prefetch("/route").then(Component => { const element = ; }); From 107dce1caeeab4524dbe53e049f692dbd858eb5a Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Fri, 20 Apr 2018 19:19:50 -0400 Subject: [PATCH 009/506] Update SingletonRouter type to include ready and readyCallback funcs --- types/next/router.d.ts | 5 ++--- types/next/test/next-router-tests.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index a5cfb42c90..5a17bd2a53 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -10,9 +10,6 @@ export interface EventChangeOptions { export type RouterCallback = () => void; export interface RouterProps { - readyCallbacks: RouterCallback[]; - ready(cb: RouterCallback): void; - // router properties readonly components: { [key: string]: { Component: React.ComponentType; err: any }; @@ -55,6 +52,8 @@ export interface RouterProps { export interface SingletonRouter { router: RouterProps; + readyCallbacks: RouterCallback[]; + ready(cb: RouterCallback): void; } export function withRouter( diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 7957f5e8a2..822b9b8e6f 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -2,10 +2,10 @@ import Router, * as r from "next/router"; import * as React from "react"; import * as qs from "querystring"; -Router.router.readyCallbacks.push(() => { +Router.readyCallbacks.push(() => { console.log("I'll get called when the router initializes."); }); -Router.router.ready(() => { +Router.ready(() => { console.log( "I'll get called immediately if the router initializes, or when it eventually does.", ); From 55194a76e4854bca216f818098be7ebd5f5b8f67 Mon Sep 17 00:00:00 2001 From: Kiyotoshi Ichikawa Date: Wed, 25 Apr 2018 15:43:30 -0400 Subject: [PATCH 010/506] Updated types and appended some. The proxy.proxyRes property could be further expressed to take one or three parameters. Its previous representation was not correct according to the documentation and default configuration the package generates. Specified types for watchEvents, open, and logLevel options. Converted type Object references to object per recommended guidelines of DefinitelyTyped repo. Converted type Function references to arrow function. More SnippetOptions properties, defined FormsOptions under GhostOptions. Added and modified tests. --- types/browser-sync/browser-sync-tests.ts | 28 ++++++++++-- types/browser-sync/index.d.ts | 56 +++++++++++++++++------- 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/types/browser-sync/browser-sync-tests.ts b/types/browser-sync/browser-sync-tests.ts index 613f8aee25..c63cb0c862 100644 --- a/types/browser-sync/browser-sync-tests.ts +++ b/types/browser-sync/browser-sync-tests.ts @@ -167,8 +167,8 @@ browserSync({ browserSync({ proxy: { target: "http://yourlocal.dev", - proxyRes: function (proxyRes, req, res) { - console.log(proxyRes); + proxyRes: function (proxyResponse, req, res) { + console.log(proxyResponse); } } }); @@ -177,8 +177,28 @@ browserSync({ proxy: { target: "http://yourlocal.dev", proxyRes: [ - function (proxyRes, req, res) { - console.log(proxyRes); + function (proxyResponse, req, res) { + console.log(proxyResponse); + } + ] + } +}); + +browserSync({ + proxy: { + target: "http://yourlocal.dev", + proxyRes: function (res) { + console.log(res); + } + } +}); + +browserSync({ + proxy: { + target: "http://yourlocal.dev", + proxyRes: [ + function (res) { + console.log(res); } ] } diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 3b97fc8616..de0a457266 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -39,7 +39,7 @@ declare namespace browserSync { * Specify which file events to respond to. * Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir` */ - watchEvents?: string[]; + watchEvents?: WatchEvents | string[]; /** * Watch files automatically. */ @@ -72,7 +72,7 @@ declare namespace browserSync { * ws - Default: undefined * middleware - Default: undefined * reqHeaders - Default: undefined - * proxyRes - Default: undefined + * proxyRes - Default: undefined (http.ServerResponse if expecting single parameter) * proxyReq - Default: undefined */ proxy?: string | ProxyOptions; @@ -91,7 +91,7 @@ declare namespace browserSync { * Default: [] * Note: Requires at least version 2.8.0. */ - serveStatic?: (string | { route?: string | string[], dir?: string | string[]})[]; + serveStatic?: StaticOptions[] | string[]; /** * Options that are passed to the serve-static middleware when you use the * string[] syntax: eg: `serveStatic: ['./app']`. @@ -120,7 +120,7 @@ declare namespace browserSync { * Can be either "info", "debug", "warn", or "silent" * Default: info */ - logLevel?: string; + logLevel?: LogLevel; /** * Change the console logging prefix. Useful if you're creating your own project based on Browsersync * Default: BS @@ -170,7 +170,7 @@ declare namespace browserSync { * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set. * Can be true, local, external, ui, ui-external, tunnel or false */ - open?: string | boolean; + open?: OpenOptions | boolean; /** * The browser(s) to open * Default: default @@ -320,6 +320,12 @@ declare namespace browserSync { excludeFileTypes?: string[]; } + type WatchEvents = "add" | "change" | "unlink" | "addDir" | "unlinkDir"; + + type LogLevel = "info" | "debug" | "warn" | "silent"; + + type OpenOptions = "local" | "external" | "ui" | "ui-external" | "tunnel"; + interface Hash { [path: string]: T; } @@ -353,16 +359,21 @@ declare namespace browserSync { routes?: Hash; /** configure custom middleware */ middleware?: (MiddlewareHandler | PerRouteMiddleware)[]; - serveStaticOptions?: ServeStaticOptions + serveStaticOptions?: ServeStaticOptions; } interface ProxyOptions { target?: string; middleware?: MiddlewareHandler; ws?: boolean; - reqHeaders?: (config: any) => Hash; - proxyRes?: ((res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any)[] | ((res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any); - proxyReq?: ((res: http.ServerRequest) => any)[] | ((res: http.ServerRequest) => any); + reqHeaders?: (config: object) => Hash; + proxyRes?: ProxyResponseMiddleware | ProxyResponseMiddleware[]; + proxyReq?: ((res: http.ServerRequest) => void)[] | ((res: http.ServerRequest) => void); + error?: (err: NodeJS.ErrnoException, req: http.IncomingMessage, res: http.ServerResponse) => void; + } + + interface ProxyResponseMiddleware { + (proxyRes: http.ServerResponse | http.IncomingMessage, res: http.ServerResponse, req: http.IncomingMessage): void; } interface HttpsOptions { @@ -370,11 +381,17 @@ declare namespace browserSync { cert?: string; } + interface StaticOptions { + route: string | string[], + dir: string | string[] + } + interface MiddlewareHandler { - (req: http.IncomingMessage, res: http.ServerResponse, next: Function): any; + (req: http.IncomingMessage, res: http.ServerResponse, next: () => void): any; } interface PerRouteMiddleware { + id?: string; route: string; handle: MiddlewareHandler; } @@ -382,18 +399,23 @@ declare namespace browserSync { interface GhostOptions { clicks?: boolean; scroll?: boolean; - forms?: boolean | { - submit?: boolean; - inputs?: boolean; - toggles?: boolean; - }; + forms?: FormsOptions | boolean; + } + + interface FormsOptions { + inputs: boolean, + submit: boolean, + toggles: boolean } interface SnippetOptions { - async?: boolean, + async?: boolean; whitelist?: string[], blacklist?: string[], - rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any }; + rule?: { + match?: RegExp; + fn?: (snippet: string, match: string) => any + }; } interface SocketOptions { From 16fe1426ca2d73ae73299e0e6a9f76c3075a65ad Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Wed, 2 May 2018 00:29:28 +0700 Subject: [PATCH 011/506] [next] NextContext type adjustments * Add renderPage property to `NextContext` * `pathname`, `query`, and `asPath` is always defined * fixed object types, add proper JSDoc to context interface --- types/next/index.d.ts | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 77cea7062d..5ecfba20da 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -15,13 +15,28 @@ import * as fetch from "isomorphic-unfetch"; declare namespace next { // <> interface NextContext { - pathname?: string; // path section of URL - query?: any; // meant to be an object - // query string section of URL parsed as an object - asPath?: string; // String of the actual path (including the query) shows in the browser - req?: http.IncomingMessage; // HTTP request object (server only) - res?: http.ServerResponse; // HTTP response object (server only) - jsonPageRes?: fetch.IsomorphicResponse; // Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response - err?: Error; // Error object if any error is encountered during the rendering + /** path section of URL */ + pathname: string + /** query string section of URL parsed as an object */ + query: { + [key: string]: any + } + /** String of the actual path (including the query) shows in the browser */ + asPath: string + /** HTTP request object (server only) */ + req?: http.IncomingMessage + /** HTTP response object (server only) */ + res?: http.ServerResponse + /** Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response */ + jsonPageRes?: fetch.IsomorphicResponse + /** Error object if any error is encountered during the rendering */ + err?: Error + /** a callback that executes the actual React rendering logic (synchronously) */ + renderPage( + cb: (enhancer: () => JSX.Element) => React.ComponentType + ): { + [key: string]: any + } } type UrlLike = url.UrlObject | url.Url; From 6145af0a3acff432e4d24a5e90ec6125bce7f5b6 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Wed, 2 May 2018 00:34:12 +0700 Subject: [PATCH 012/506] [next] renderPage callback should be optional --- types/next/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 5ecfba20da..7f7c58140e 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -33,7 +33,7 @@ declare namespace next { err?: Error /** a callback that executes the actual React rendering logic (synchronously) */ renderPage( - cb: (enhancer: () => JSX.Element) => React.ComponentType + cb?: (enhancer: () => JSX.Element) => React.ComponentType ): { [key: string]: any } From 07de2cfd39a8da31d5013d77180ed45a72637ff1 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sat, 5 May 2018 00:34:47 +0700 Subject: [PATCH 013/506] [next] target next@6.0.0 `next@6.0.0` is out, so let's change the target version to it --- types/next/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 7f7c58140e..3abb22a2a4 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for next 5.0 +// Type definitions for next 6.0 // Project: https://github.com/zeit/next.js // Definitions by: Drew Hays // Brice BERNARD From 9bf9e4c95bbf8db44d08ce6a9aa01e726573758c Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 9 May 2018 15:11:26 +1000 Subject: [PATCH 014/506] Updated type definitions to 0.15.12 --- types/react-calendar-timeline/index.d.ts | 139 +++++++++++++---------- 1 file changed, 77 insertions(+), 62 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 69e5d037dc..649a301bb3 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -1,71 +1,86 @@ -// Type definitions for react-calendar-timeline v0.8.1 +// Type definitions for react-calendar-timeline v0.15.12 // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov +// Alex Maclean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 /// declare module "react-calendar-timeline" { - interface ReactCalendarTimeline { - groups: { - id: number; - title: any; // string | Element (React.ClassicComponentClass); - }[]; - items:{ - id: number; - group: number; - title?: any; // string | Element (React.ClassicComponentClass); - start_time: any; - end_time: any; - canMove?: boolean; - canResize?: boolean; - canChangeGroup?: boolean; - className?: string; - }[]; - keys?:{ - groupIdKey: string; - groupTitleKey: string; - itemIdKey: string; - itemTitleKey: string; - itemGroupKey: string; - itemTimeStartKey: string; - itemTimeEndKey: string; - }; - sidebarWidth?: number; - dragSnap?: number; - minResizeWidth?: number; - fixedHeader?: "fixed" | "none"; - zIndexStart?: number; - lineHeight?: number; - headerLabelGroupHeight?: number; - headerLabelHeight?: number; - itemHeightRatio?: number; - minZoom?: number; - maxZoom?: number; - canMove?: boolean; - canChangeGroup?: boolean; - canResize?: boolean; - useResizeHandle?: boolean; - stackItems?: boolean; - traditionalZoom?: boolean; - itemTouchSendsClick?: boolean; - onItemMove?(itemId:any, dragTime:any, newGroupOrder:any): any; - onItemResize?(itemId:any, newResizeEnd:any): any; - onItemSelect?(itemId:any): any; - onItemClick?(itemId:any): any; - onCanvasClick?(groupId:any, time:any, e:any): any; - onItemDoubleClick?(itemId:any): any; - moveResizeValidator?(action:any, itemId:any, time:any): any; - defaultTimeStart?: any; - defaultTimeEnd?: any; - visibleTimeStart?: number; - visibleTimeEnd?: number; - onTimeChange?(visibleTimeStart:any, visibleTimeEnd:any): any; - onTimeInit?(visibleTimeStart:any, visibleTimeEnd:any): any; - onBoundsChange?(canvasTimeStart:any, canvasTimeEnd:any): any; - children?: any; - } - let ReactCalendarTimeline : React.ClassicComponentClass; - export default ReactCalendarTimeline; + + export interface TimelineGroup { + id: number; + title: string | JSX.Element; + } + + export interface TimelineItem { + id: number; + group: number; + title?: string | JSX.Element; + start_time: any; + end_time: any; + canMove?: boolean; + canResize?: boolean; + canChangeGroup?: boolean; + className?: string; + } + + export interface TimelineContext { + visibletimeStart: number, + visibleTimeEnd: number, + timelineWidth: number + } + + export interface ReactCalendarTimelineProps { + groups: TimelineGroup[]; + items: TimelineItem[]; + keys?:{ + groupIdKey: string; + groupTitleKey: string; + itemIdKey: string; + itemTitleKey: string; + itemGroupKey: string; + itemTimeStartKey: string; + itemTimeEndKey: string; + }; + sidebarWidth?: number; + dragSnap?: number; + minResizeWidth?: number; + fixedHeader?: "fixed" | "none"; + zIndexStart?: number; + lineHeight?: number; + headerLabelGroupHeight?: number; + headerLabelHeight?: number; + itemHeightRatio?: number; + minZoom?: number; + maxZoom?: number; + canMove?: boolean; + canChangeGroup?: boolean; + canResize?: boolean; + useResizeHandle?: boolean; + stackItems?: boolean; + traditionalZoom?: boolean; + itemTouchSendsClick?: boolean; + onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; + onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; + onItemSelect?(itemId:number, e: any, time: number): any; + onItemClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onItemDoubleClick?(itemId:number, e: any, time: number): any; + moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; + defaultTimeStart?: any; + defaultTimeEnd?: any; + visibleTimeStart?: number; + visibleTimeEnd?: number; + onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; + onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; + onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + children?: any; + fullUpdate?: boolean; + itemRenderer?: (item: TimelineItem, context: TimelineContext) => JSX.Element; + groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => JSX.Element; + } + let ReactCalendarTimeline : React.ClassicComponentClass; + export default ReactCalendarTimeline; } From 449a5e2d87e20f1dc33944eee4debb473a15045d Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 9 May 2018 15:20:01 +0200 Subject: [PATCH 015/506] Add rolling rate limiter --- types/rolling-rate-limiter/index.d.ts | 38 +++++++++++++++++++ .../rolling-rate-limiter-tests.ts | 36 ++++++++++++++++++ types/rolling-rate-limiter/tsconfig.json | 23 +++++++++++ types/rolling-rate-limiter/tslint.json | 1 + 4 files changed, 98 insertions(+) create mode 100644 types/rolling-rate-limiter/index.d.ts create mode 100644 types/rolling-rate-limiter/rolling-rate-limiter-tests.ts create mode 100644 types/rolling-rate-limiter/tsconfig.json create mode 100644 types/rolling-rate-limiter/tslint.json diff --git a/types/rolling-rate-limiter/index.d.ts b/types/rolling-rate-limiter/index.d.ts new file mode 100644 index 0000000000..0de8235fc2 --- /dev/null +++ b/types/rolling-rate-limiter/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for rolling-rate-limiter 0.1 +// Project: https://github.com/peterkhayes/rolling-rate-limiter +// Definitions by: Jonas Lochmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = RollingRateLimiter; + +declare function RollingRateLimiter(options: RollingRateLimiter.InMemoryOptions): RollingRateLimiter.SyncOrAsyncLimiter; +declare function RollingRateLimiter(options: RollingRateLimiter.WithRedisOptions): RollingRateLimiter.AsyncLimiter; + +declare namespace RollingRateLimiter { + interface GeneralOptions { + interval: number; + maxInInterval: number; + minDifference?: number; + } + + interface RedisOptions { + redis: CompatibleRedisClient; + namespace?: string; + } + + interface CompatibleRedisClient { + multi: () => any; + } + + type InMemoryOptions = GeneralOptions; + type WithRedisOptions = GeneralOptions & RedisOptions; + + type AsyncLimiterWithToken = (token: string, callback: AsyncLimiterCallback) => void; + type AsyncLimiterWithoutToken = (callback: AsyncLimiterCallback) => void; + type AsyncLimiterCallback = (err: any, timeLeft: number, actionsLeft: number) => void; + type AsyncLimiter = AsyncLimiterWithToken & AsyncLimiterWithToken; + + type SyncLimiter = (token?: string) => number; + + type SyncOrAsyncLimiter = SyncLimiter & AsyncLimiter; +} diff --git a/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts b/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts new file mode 100644 index 0000000000..1318b8d425 --- /dev/null +++ b/types/rolling-rate-limiter/rolling-rate-limiter-tests.ts @@ -0,0 +1,36 @@ +import * as RateLimiter from 'rolling-rate-limiter'; + +/* + Setup: +*/ + +const limiter = RateLimiter({ + // in miliseconds + interval: 1000, + maxInInterval: 10, + // optional: the minimum time (in miliseconds) between any two actions + minDifference: 100 +}); + +/* + Action: +*/ + +function attemptAction(userId: string) { + // Argument should be a unique identifier for a user if one exists. + // If none is provided, the limiter will not differentiate between users. + const timeLeft = limiter(userId); + + if (timeLeft > 0) { + // limit was exceeded, action should not be allowed + // timeLeft is the number of ms until the next action will be allowed + // note that this can be treated as a boolean, since 0 is falsy + } else { + // limit was not exceeded, action should be allowed + } +} + +/* + Note that the in-memory version can also operate asynchronously. + The syntax is identical to the redis implementation below. +*/ diff --git a/types/rolling-rate-limiter/tsconfig.json b/types/rolling-rate-limiter/tsconfig.json new file mode 100644 index 0000000000..0b526f946e --- /dev/null +++ b/types/rolling-rate-limiter/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rolling-rate-limiter-tests.ts" + ] +} diff --git a/types/rolling-rate-limiter/tslint.json b/types/rolling-rate-limiter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rolling-rate-limiter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 173f530f62d5c5b3059db900a0a33cf504b447b8 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 14:04:08 +1000 Subject: [PATCH 016/506] Added missing api --- types/react-calendar-timeline/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 649a301bb3..013e652760 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -44,7 +44,11 @@ declare module "react-calendar-timeline" { itemTimeStartKey: string; itemTimeEndKey: string; }; + selected?: number[]; sidebarWidth?: number; + sidebarContent?: any; + rightSidebarWidth?: number; + rightSidebarContent?: any; dragSnap?: number; minResizeWidth?: number; fixedHeader?: "fixed" | "none"; From 5ba41a77899f4e665056ae17b2f8903e8af83a02 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Thu, 10 May 2018 06:05:11 +0200 Subject: [PATCH 017/506] rolling-rate-limiter: replace intersection by extending interface --- types/rolling-rate-limiter/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/rolling-rate-limiter/index.d.ts b/types/rolling-rate-limiter/index.d.ts index 0de8235fc2..c81c8304d7 100644 --- a/types/rolling-rate-limiter/index.d.ts +++ b/types/rolling-rate-limiter/index.d.ts @@ -15,7 +15,7 @@ declare namespace RollingRateLimiter { minDifference?: number; } - interface RedisOptions { + interface WithRedisOptions extends GeneralOptions { redis: CompatibleRedisClient; namespace?: string; } @@ -25,7 +25,6 @@ declare namespace RollingRateLimiter { } type InMemoryOptions = GeneralOptions; - type WithRedisOptions = GeneralOptions & RedisOptions; type AsyncLimiterWithToken = (token: string, callback: AsyncLimiterCallback) => void; type AsyncLimiterWithoutToken = (callback: AsyncLimiterCallback) => void; From 9f85c6e169398dea19dae58ca0702906ebef5bba Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 14:07:43 +1000 Subject: [PATCH 018/506] relaxed type safety --- types/react-calendar-timeline/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 013e652760..5726e08365 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -11,13 +11,13 @@ declare module "react-calendar-timeline" { export interface TimelineGroup { id: number; - title: string | JSX.Element; + title: any; } export interface TimelineItem { id: number; group: number; - title?: string | JSX.Element; + title?: any; start_time: any; end_time: any; canMove?: boolean; @@ -82,8 +82,8 @@ declare module "react-calendar-timeline" { onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (item: TimelineItem, context: TimelineContext) => JSX.Element; - groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => JSX.Element; + itemRenderer?: (item: TimelineItem, context: TimelineContext) => any; + groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => any; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From 1b2c3539da5e40fd5aa720909074139ad0e07ca1 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Thu, 10 May 2018 15:34:43 +1000 Subject: [PATCH 019/506] Added missing API. Fixed incorrect. --- types/react-calendar-timeline/index.d.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 5726e08365..86c79ca7ae 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -8,16 +8,16 @@ /// declare module "react-calendar-timeline" { - - export interface TimelineGroup { + + export interface TimelineGroup { id: number; - title: any; + title: React.ReactNode; } export interface TimelineItem { id: number; group: number; - title?: any; + title?: React.ReactNode; start_time: any; end_time: any; canMove?: boolean; @@ -51,18 +51,21 @@ declare module "react-calendar-timeline" { rightSidebarContent?: any; dragSnap?: number; minResizeWidth?: number; - fixedHeader?: "fixed" | "none"; - zIndexStart?: number; + stickyOffset?: number; + stickyHeader?: boolean; + headerRef?: any; lineHeight?: number; headerLabelGroupHeight?: number; headerLabelHeight?: number; itemHeightRatio?: number; minZoom?: number; maxZoom?: number; + clickTolerance?: number; canMove?: boolean; canChangeGroup?: boolean; canResize?: boolean; useResizeHandle?: boolean; + showCursorLine?: boolean; stackItems?: boolean; traditionalZoom?: boolean; itemTouchSendsClick?: boolean; @@ -70,8 +73,9 @@ declare module "react-calendar-timeline" { onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; onItemSelect?(itemId:number, e: any, time: number): any; onItemClick?(itemId:number, e: any, time: number): any; - onCanvasClick?(groupId:number, time:number, e:any): any; onItemDoubleClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onCanvasDoubleClick?(groupId:number, time:number, e:any): any; moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; defaultTimeStart?: any; defaultTimeEnd?: any; @@ -80,10 +84,12 @@ declare module "react-calendar-timeline" { onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (item: TimelineItem, context: TimelineContext) => any; - groupRenderer?: (group: TimelineGroup, isRightSidebar: boolean) => any; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From c5ac0628883e7dfbd78960289543df5831e10ec3 Mon Sep 17 00:00:00 2001 From: "skubarenko.andrey" Date: Tue, 8 May 2018 12:42:15 +0300 Subject: [PATCH 020/506] Add type definitions for the DevExpress Bootstrap ASP.NET Core Controls --- .../devexpress-aspnetcore-bootstrap-tests.ts | 13 + .../index.d.ts | 2495 +++++++++++++++++ .../tsconfig.json | 24 + .../tslint.json | 3 + 4 files changed, 2535 insertions(+) create mode 100644 types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts create mode 100644 types/devexpress-aspnetcore-bootstrap/index.d.ts create mode 100644 types/devexpress-aspnetcore-bootstrap/tsconfig.json create mode 100644 types/devexpress-aspnetcore-bootstrap/tslint.json diff --git a/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts b/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts new file mode 100644 index 0000000000..55eae3c27f --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/devexpress-aspnetcore-bootstrap-tests.ts @@ -0,0 +1,13 @@ +declare let button: DevExpress.AspNetCore.BootstrapButton; +button.on('click', e => {}); +button.doClick(); +button.once('click', e => {}); + +declare let accordion: DevExpress.AspNetCore.BootstrapAccordion; +accordion.on('init', e => {}); +const firstGroup = accordion.getGroup(0); +if (firstGroup) { + const groupText = firstGroup.getText(); + const item = firstGroup.getItemByName('item10'); + item && item.getEnabled(); +} diff --git a/types/devexpress-aspnetcore-bootstrap/index.d.ts b/types/devexpress-aspnetcore-bootstrap/index.d.ts new file mode 100644 index 0000000000..9422ccd2f7 --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/index.d.ts @@ -0,0 +1,2495 @@ +// Type definitions for DevExpress ASP.NET 181.3 +// Project: http://devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare namespace DevExpress.AspNetCore { + enum BootstrapSchedulerGroupType { + Date = "Date", + None = "None", + Resource = "Resource", + } + enum BootstrapSchedulerViewType { + Day = "Day", + WorkWeek = "WorkWeek", + Week = "Week", + Month = "Month", + Timeline = "Timeline", + FullWeek = "FullWeek", + Agenda = "Agenda", + } + enum BootstrapSchedulerAppointmentType { + Normal = "Normal", + Pattern = "Pattern", + Occurrence = "Occurrence", + ChangedOccurrence = "ChangedOccurrence", + DeletedOccurrence = "DeletedOccurrence", + } + enum BootstrapSchedulerRecurrenceRange { + NoEndDate = "NoEndDate", + OccurrenceCount = "OccurrenceCount", + EndByDate = "EndByDate", + } + enum BootstrapSchedulerRecurrenceType { + Daily = "Daily", + Weekly = "Weekly", + Monthly = "Monthly", + Yearly = "Yearly", + Hourly = "Hourly", + } + enum WeekDays { + Sunday = 1, + Monday = 2, + Tuesday = 4, + Wednesday = 8, + Thursday = 16, + Friday = 32, + Saturday = 64, + WeekendDays = 65, + WorkDays = 62, + EveryDay = 127, + } + enum WeekOfMonth { + None = 0, + First = 1, + Second = 2, + Third = 3, + Fourth = 4, + Last = 5, + } + enum BootstrapPopupControlCloseReason { + API = "API", + CloseButton = "CloseButton", + OuterMouseClick = "OuterMouseClick", + MouseOut = "MouseOut", + Escape = "Escape", + } + + const Utils: { + getControls: () => Control[]; + getSerializedEditorValuesInContainer: (containerOrId: string | HTMLElement, processInvisibleEditors?: boolean) => any; + getEditorValuesInContainer: (containerOrId: string | HTMLElement, processInvisibleEditors?: boolean) => any; + }; + + interface EventArgs { + readonly sender: Control; + } + + interface CancelEventArgs extends EventArgs { + cancel: boolean; + } + + interface BeginCallbackEventArgs extends EventArgs { + readonly command: string; + } + + interface ProcessingModeEventArgs extends EventArgs { + processOnServer: boolean; + } + + interface ProcessingModeCancelEventArgs extends ProcessingModeEventArgs { + cancel: boolean; + } + + interface GlobalBeginCallbackEventArgs extends BeginCallbackEventArgs { + readonly control: Control; + } + + interface EndCallbackEventArgs extends EventArgs { // tslint:disable-line:no-empty-interface + } + + interface GlobalEndCallbackEventArgs extends EndCallbackEventArgs { + readonly control: Control; + } + + interface CustomDataCallbackEventArgs extends EventArgs { + result: string; + } + + interface CallbackErrorEventArgs extends EventArgs { + handled: boolean; + message: string; + } + + interface GlobalCallbackErrorEventArgs extends CallbackErrorEventArgs { + readonly control: Control; + } + + interface EditValidationEventArgs extends EventArgs { + errorText: string; + isValid: boolean; + value: string; + } + + interface ValidationCompletedEventArgs extends EventArgs { + readonly container: any; + readonly firstInvalidControl: Control; + readonly firstVisibleInvalidControl: Control; + readonly invisibleControlsValidated: boolean; + isValid: boolean; + readonly validationGroup: string; + } + + interface EditClickEventArgs extends EventArgs { + readonly htmlElement: any; + readonly htmlEvent: any; + } + + interface EditKeyEventArgs extends EventArgs { + readonly htmlEvent: any; + } + + class Control { + protected readonly instance: any; + protected constructor(instance: any); + readonly name: string; + adjustControl(): void; + getHeight(): number; + getMainElement(): any; + getParentControl(): any; + getVisible(): boolean; + getWidth(): number; + inCallback(): boolean; + sendMessageToAssistiveTechnology(message: string): void; + setHeight(height: number): void; + setVisible(visible: boolean): void; + setWidth(width: number): void; + on(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; + off(): this; // tslint:disable-line:no-unnecessary-generics + off(eventName: K): this; // tslint:disable-line:unified-signatures no-unnecessary-generics + off(eventName: K, callback: (this: Control, args?: ControlEventMap[K]) => void): this; // tslint:disable-line:unified-signatures + } + interface ControlEventMap { + "init": EventArgs; + } + + class BootstrapClientEdit extends Control { + focus(): void; + getCaption(): string; + getEnabled(): boolean; + getErrorText(): string; + getInputElement(): any; + getIsValid(): boolean; + getReadOnly(): boolean; + getValue(): any; + setCaption(caption: string): void; + setEnabled(value: boolean): void; + setErrorText(errorText: string): void; + setIsValid(isValid: boolean): void; + setReadOnly(readOnly: boolean): void; + setValue(value: any): void; + validate(): void; + on(eventName: K, callback: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapClientEdit, args?: BootstrapClientEditEventMap[K]) => void): this; + } + interface BootstrapClientEditEventMap extends ControlEventMap { + "gotFocus": EventArgs; + "lostFocus": EventArgs; + "validation": EditValidationEventArgs; + "valueChanged": ProcessingModeEventArgs; + } + + interface AccordionItemEventArgs extends ProcessingModeEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + readonly item: BootstrapAccordionItem; + } + + interface AccordionGroupEventArgs extends EventArgs { + readonly group: BootstrapAccordionGroup; + } + + interface AccordionGroupCancelEventArgs extends ProcessingModeCancelEventArgs { + readonly group: BootstrapAccordionGroup; + } + + interface AccordionGroupClickEventArgs extends AccordionGroupCancelEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + } + + class BootstrapAccordion extends Control { + collapseAll(): void; + expandAll(): void; + getActiveGroup(): BootstrapAccordionGroup | null; + getGroup(index: number): BootstrapAccordionGroup | null; + getGroupByName(name: string): BootstrapAccordionGroup | null; + getGroupCount(): number; + getItemByName(name: string): BootstrapAccordionItem | null; + getSelectedItem(): BootstrapAccordionItem | null; + setActiveGroup(group: BootstrapAccordionGroup): void; + setSelectedItem(item: BootstrapAccordionItem): void; + on(eventName: K, callback: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapAccordion, args?: BootstrapAccordionEventMap[K]) => void): this; + } + interface BootstrapAccordionEventMap extends ControlEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "endCallback": EndCallbackEventArgs; + "expandedChanged": AccordionGroupEventArgs; + "expandedChanging": AccordionGroupCancelEventArgs; + "headerClick": AccordionGroupClickEventArgs; + "itemClick": AccordionItemEventArgs; + } + + class BootstrapAccordionGroup { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly navBar: BootstrapAccordion | null; + getEnabled(): boolean; + getExpanded(): boolean; + getHeaderBadgeIconCssClass(): string; + getHeaderBadgeText(): string; + getItem(index: number): BootstrapAccordionItem | null; + getItemByName(name: string): BootstrapAccordionItem | null; + getItemCount(): number; + getText(): string; + getVisible(): boolean; + setExpanded(value: boolean): void; + setHeaderBadgeIconCssClass(cssClass: string): void; + setHeaderBadgeText(text: string): void; + setText(text: string): void; + setVisible(value: boolean): void; + } + + class BootstrapAccordionItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly group: BootstrapAccordionGroup | null; + readonly index: number; + readonly name: string; + readonly navBar: BootstrapAccordion | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + class BootstrapBinaryImage extends BootstrapClientEdit { + clear(): void; + getUploadedFileName(): string; + getValue(): any; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + setSize(width: number, height: number): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapBinaryImage, args?: BootstrapBinaryImageEventMap[K]) => void): this; + } + interface BootstrapBinaryImageEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "click": EditClickEventArgs; + "endCallback": EndCallbackEventArgs; + } + + interface ButtonClickEventArgs extends ProcessingModeEventArgs { + readonly cancelEventAndBubble: boolean; + } + + class BootstrapButton extends Control { + doClick(): void; + focus(): void; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getChecked(): boolean; + getEnabled(): boolean; + getImageUrl(): string; + getText(): string; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setImageUrl(value: string): void; + setText(value: string): void; + on(eventName: K, callback: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapButton, args?: BootstrapButtonEventMap[K]) => void): this; + } + interface BootstrapButtonEventMap extends ControlEventMap { + "checkedChanged": ProcessingModeEventArgs; + "click": ButtonClickEventArgs; + "gotFocus": EventArgs; + "lostFocus": EventArgs; + } + + interface CalendarCustomDisabledDateEventArgs extends EventArgs { + readonly date: Date; + isDisabled: boolean; + } + + class BootstrapCalendar extends BootstrapClientEdit { + clearSelection(): void; + deselectDate(date: Date): void; + deselectRange(start: Date, end: Date): void; + getEnabled(): boolean; + getMaxDate(): Date; + getMinDate(): Date; + getSelectedDate(): Date; + getSelectedDates(): Date[]; + getVisibleDate(): Date; + isDateSelected(date: Date): boolean; + selectDate(date: Date): void; + selectRange(start: Date, end: Date): void; + setEnabled(enabled: boolean): void; + setMaxDate(date: Date): void; + setMinDate(date: Date): void; + setSelectedDate(date: Date): void; + setVisibleDate(date: Date): void; + on(eventName: K, callback: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCalendar, args?: BootstrapCalendarEventMap[K]) => void): this; + } + interface BootstrapCalendarEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "customDisabledDate": CalendarCustomDisabledDateEventArgs; + "endCallback": EndCallbackEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "selectionChanged": ProcessingModeEventArgs; + "visibleMonthChanged": ProcessingModeEventArgs; + } + + interface GridToolbarItemClickEventArgs extends ProcessingModeEventArgs { + readonly item: BootstrapMenuItem; + readonly toolbarIndex: number; + readonly toolbarName: string; + usePostBack: boolean; + } + + class BootstrapGridBase extends Control { + getToolbar(index: number): BootstrapMenu | null; + getToolbarByName(name: string): BootstrapMenu | null; + on(eventName: K, callback: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapGridBase, args?: BootstrapGridBaseEventMap[K]) => void): this; + } + interface BootstrapGridBaseEventMap extends ControlEventMap { + "toolbarItemClick": GridToolbarItemClickEventArgs; + } + + interface CardViewColumnCancelEventArgs extends CancelEventArgs { + readonly column: BootstrapCardViewColumn; + } + + interface CardViewCardFocusingEventArgs extends CancelEventArgs { + readonly htmlEvent: any; + readonly visibleIndex: number; + } + + interface CardViewCardClickEventArgs extends CancelEventArgs { + readonly htmlEvent: any; + readonly visibleIndex: number; + } + + interface CardViewCustomButtonEventArgs extends ProcessingModeEventArgs { + readonly buttonID: string; + readonly visibleIndex: number; + } + + interface CardViewSelectionEventArgs extends ProcessingModeEventArgs { + readonly isAllRecordsOnPage: boolean; + readonly isChangedOnServer: boolean; + readonly isSelected: boolean; + readonly visibleIndex: number; + } + + interface CardViewFocusEventArgs extends ProcessingModeEventArgs { + readonly isChangedOnServer: boolean; + } + + interface CardViewBatchEditStartEditingEventArgs extends CancelEventArgs { + readonly cardValues: any; + focusedColumn: BootstrapCardViewColumn; + readonly visibleIndex: number; + } + + interface CardViewBatchEditEndEditingEventArgs extends CancelEventArgs { + readonly cardValues: any; + readonly visibleIndex: number; + } + + interface CardViewBatchEditCardValidatingEventArgs extends EventArgs { + readonly validationInfo: any; + readonly visibleIndex: number; + } + + interface CardViewBatchEditConfirmShowingEventArgs extends CancelEventArgs { + readonly requestTriggerID: string; + } + + interface CardViewBatchEditTemplateCellFocusedEventArgs extends EventArgs { + readonly column: BootstrapCardViewColumn; + handled: boolean; + } + + interface CardViewBatchEditChangesSavingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface CardViewBatchEditChangesCancelingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface CardViewBatchEditCardInsertingEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface CardViewBatchEditCardDeletingEventArgs extends CancelEventArgs { + readonly cardValues: any; + readonly visibleIndex: number; + } + + interface CardViewFocusedCellChangingEventArgs extends CancelEventArgs { + readonly cellInfo: BootstrapCardViewCellInfo; + } + + class BootstrapCardView extends BootstrapGridBase { + readonly batchEditApi: BootstrapCardViewBatchEditApi | null; + addNewCard(): void; + applyFilter(filterExpression: string): void; + applySearchPanelFilter(value: string): void; + cancelEdit(): void; + clearFilter(): void; + closeFilterControl(): void; + deleteCard(visibleIndex: number): void; + deleteCardByKey(key: any): void; + focus(): void; + focusEditor(column: BootstrapCardViewColumn): void; + focusEditor(columnIndex: number): void; // tslint:disable-line:unified-signatures + focusEditor(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + getCardKey(visibleIndex: number): string; + getColumn(columnIndex: number): BootstrapCardViewColumn | null; + getColumnByField(columnFieldName: string): BootstrapCardViewColumn | null; + getColumnById(columnId: string): BootstrapCardViewColumn | null; + getColumnCount(): number; + getEditValue(column: BootstrapCardViewColumn): string; + getEditValue(columnIndex: number): string; // tslint:disable-line:unified-signatures + getEditValue(columnFieldNameOrId: string): string; // tslint:disable-line:unified-signatures unified-signatures + getEditor(column: BootstrapCardViewColumn): BootstrapClientEdit; + getEditor(columnIndex: number): BootstrapClientEdit; // tslint:disable-line:unified-signatures + getEditor(columnFieldNameOrId: string): BootstrapClientEdit; // tslint:disable-line:unified-signatures unified-signatures + getFocusedCardIndex(): number; + getFocusedCell(): BootstrapCardViewCellInfo | null; + getPageCount(): number; + getPageIndex(): number; + getPopupEditForm(): BootstrapPopupControl | null; + getSelectedCardCount(): number; + getSelectedKeysOnPage(): any[]; + getTopVisibleIndex(): number; + getVerticalScrollPosition(): number; + getVisibleCardsOnPage(): number; + gotoPage(pageIndex: number): void; + hideCustomizationWindow(): void; + isCardSelectedOnPage(visibleIndex: number): boolean; + isCustomizationWindowVisible(): boolean; + isEditing(): boolean; + isNewCardEditing(): boolean; + moveColumn(column: BootstrapCardViewColumn): void; + moveColumn(columnIndex: number): void; // tslint:disable-line:unified-signatures + moveColumn(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(column: BootstrapCardViewColumn, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures + moveColumn(columnIndex: number, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + moveColumn(column: BootstrapCardViewColumn, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures + moveColumn(columnIndex: number, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + moveColumn(columnFieldNameOrId: string, moveToColumnVisibleIndex: number, moveBefore: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + nextPage(): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + prevPage(): void; + refresh(): void; + selectAllCardsOnPage(): void; + selectCardOnPage(visibleIndex: number): void; + selectCardOnPage(visibleIndex: number, selected: boolean): void; // tslint:disable-line:unified-signatures + selectCards(): void; + selectCardsByKey(keys: any[]): void; + selectCardsByKey(key: any): void; // tslint:disable-line:unified-signatures + selectCardsByKey(keys: any[], selected: boolean): void; // tslint:disable-line:unified-signatures + selectCardsByKey(key: any, selected: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + setEditValue(column: BootstrapCardViewColumn, value: string): void; + setEditValue(columnIndex: number, value: string): void; // tslint:disable-line:unified-signatures + setEditValue(columnFieldNameOrId: string, value: string): void; // tslint:disable-line:unified-signatures unified-signatures + setFilterEnabled(isFilterEnabled: boolean): void; + setFocusedCardIndex(visibleIndex: number): void; + setFocusedCell(cardVisibleIndex: number, columnIndex: number): void; + setSearchPanelCustomEditor(editor: BootstrapClientEdit): void; + setVerticalScrollPosition(position: number): void; + showCustomizationWindow(): void; + showFilterControl(): void; + sortBy(column: BootstrapCardViewColumn): void; + sortBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapCardViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + startEditCard(visibleIndex: number): void; + startEditCardByKey(key: any): void; + unselectAllCardsOnPage(): void; + unselectCardOnPage(visibleIndex: number): void; + unselectCards(): void; + unselectCardsByKey(keys: any[]): void; + unselectCardsByKey(key: any): void; // tslint:disable-line:unified-signatures + unselectFilteredCards(): void; + updateEdit(): void; + on(eventName: K, callback: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCardView, args?: BootstrapCardViewEventMap[K]) => void): this; + } + interface BootstrapCardViewEventMap extends BootstrapGridBaseEventMap { + "batchEditCardDeleting": CardViewBatchEditCardDeletingEventArgs; + "batchEditCardInserting": CardViewBatchEditCardInsertingEventArgs; + "batchEditCardValidating": CardViewBatchEditCardValidatingEventArgs; + "batchEditChangesCanceling": CardViewBatchEditChangesCancelingEventArgs; + "batchEditChangesSaving": CardViewBatchEditChangesSavingEventArgs; + "batchEditConfirmShowing": CardViewBatchEditConfirmShowingEventArgs; + "batchEditEndEditing": CardViewBatchEditEndEditingEventArgs; + "batchEditStartEditing": CardViewBatchEditStartEditingEventArgs; + "batchEditTemplateCellFocused": CardViewBatchEditTemplateCellFocusedEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "cardClick": CardViewCardClickEventArgs; + "cardDblClick": CardViewCardClickEventArgs; + "cardFocusing": CardViewCardFocusingEventArgs; + "columnSorting": CardViewColumnCancelEventArgs; + "customButtonClick": CardViewCustomButtonEventArgs; + "customizationWindowCloseUp": EventArgs; + "endCallback": EndCallbackEventArgs; + "focusedCardChanged": CardViewFocusEventArgs; + "focusedCellChanging": CardViewFocusedCellChangingEventArgs; + "selectionChanged": CardViewSelectionEventArgs; + } + + class BootstrapCardViewBatchEditApi { + protected readonly instance: any; + protected constructor(instance: any); + addNewCard(): void; + deleteCard(visibleIndex: number): void; + deleteCardByKey(key: any): void; + getCardVisibleIndices(includeDeleted: boolean): number[]; + getDeletedCardIndices(): number[]; + getInsertedCardIndices(): number[]; + isDeletedCard(visibleIndex: number): boolean; + isNewCard(visibleIndex: number): boolean; + recoverCard(visibleIndex: number): void; + recoverCardByKey(key: any): void; + validateCard(visibleIndex: number): boolean; + validateCards(validateOnlyModified: boolean): boolean; + } + + class BootstrapCardViewColumn { + protected readonly instance: any; + protected constructor(instance: any); + } + + class BootstrapCardViewCellInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly cardVisibleIndex: number; + endEdit(): void; + getCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): any; + getCellValue(visibleIndex: number, columnFieldNameOrId: string, initial: boolean): any; + getColumnDisplayText(columnFieldNameOrId: string, value: any): string; + getEditCellInfo(): BootstrapCardViewCellInfo | null; + hasChanges(): boolean; + moveFocusBackward(): boolean; + moveFocusForward(): boolean; + resetChanges(visibleIndex: number): void; + resetChanges(visibleIndex: number, columnIndex: number): void; // tslint:disable-line:unified-signatures + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any): void; + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any, displayText: string, cancelCellHighlighting: boolean): void; + startEdit(visibleIndex: number, columnIndex: number): void; + } + + interface BootstrapChartEventArgsBase extends EventArgs { + readonly component: any; + readonly element: any; + } + + interface BootstrapChartErrorEventArgs extends BootstrapChartEventArgsBase { + readonly target: any; + } + + interface BootstrapChartElementActionEventArgs extends BootstrapChartEventArgsBase { + readonly target: any; + } + + interface BootstrapChartElementClickEventArgs extends BootstrapChartElementActionEventArgs { + readonly jQueryEvent: any; + } + + interface BootstrapChartExportEventArgs extends BootstrapChartEventArgsBase { + cancel: boolean; + readonly data: any; + readonly fileName: string; + readonly format: string; + } + + interface BootstrapChartOptionChangedEventArgs extends BootstrapChartEventArgsBase { + readonly fullName: string; + readonly name: string; + readonly previousValue: any; + readonly value: any; + } + + interface BootstrapChartZoomEndEventArgs extends BootstrapChartEventArgsBase { + readonly rangeEnd: any; + readonly rangeStart: any; + } + + class BootstrapChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapChart, args?: BootstrapChartEventMap[K]) => void): this; + } + interface BootstrapChartEventMap extends ControlEventMap { + "argumentAxisClick": BootstrapChartElementClickEventArgs; + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "seriesClick": BootstrapChartElementClickEventArgs; + "seriesHoverChanged": BootstrapChartElementActionEventArgs; + "seriesSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + "zoomEnd": BootstrapChartZoomEndEventArgs; + "zoomStart": BootstrapChartEventArgsBase; + } + + class BootstrapPolarChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPolarChart, args?: BootstrapPolarChartEventMap[K]) => void): this; + } + interface BootstrapPolarChartEventMap extends ControlEventMap { + "argumentAxisClick": BootstrapChartElementClickEventArgs; + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "seriesClick": BootstrapChartElementClickEventArgs; + "seriesHoverChanged": BootstrapChartElementActionEventArgs; + "seriesSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + } + + class BootstrapPieChart extends Control { + exportTo(format: string, fileName: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPieChart, args?: BootstrapPieChartEventMap[K]) => void): this; + } + interface BootstrapPieChartEventMap extends ControlEventMap { + "disposing": BootstrapChartEventArgsBase; + "done": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "legendClick": BootstrapChartElementClickEventArgs; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "pointClick": BootstrapChartElementClickEventArgs; + "pointHoverChanged": BootstrapChartElementActionEventArgs; + "pointSelectionChanged": BootstrapChartElementActionEventArgs; + "tooltipHidden": BootstrapChartElementActionEventArgs; + "tooltipShown": BootstrapChartElementActionEventArgs; + } + + class BootstrapCheckBox extends BootstrapClientEdit { + getCheckState(): string; + getChecked(): boolean; + getText(): string; + setCheckState(checkState: string): void; + setChecked(isChecked: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCheckBox, args?: BootstrapCheckBoxEventMap[K]) => void): this; + } + interface BootstrapCheckBoxEventMap extends BootstrapClientEditEventMap { + "checkedChanged": ProcessingModeEventArgs; + } + + class BootstrapRadioButton extends BootstrapClientEdit { + getCheckState(): string; + getChecked(): boolean; + getText(): string; + setCheckState(checkState: string): void; + setChecked(isChecked: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapRadioButton, args?: BootstrapRadioButtonEventMap[K]) => void): this; + } + interface BootstrapRadioButtonEventMap extends BootstrapClientEditEventMap { + "checkedChanged": ProcessingModeEventArgs; + } + + class BootstrapComboBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + adjustDropDownWindow(): void; + beginUpdate(): void; + clearItems(): void; + endUpdate(): void; + ensureDropDownLoaded(callbackFunction: any): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedItem(): BootstrapListBoxItem | null; + getText(): string; + hideDropDown(): void; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string, applyFilter: boolean): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapComboBox, args?: BootstrapComboBoxEventMap[K]) => void): this; + } + interface BootstrapComboBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "buttonClick": ButtonEditClickEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": EventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "dropDown": EventArgs; + "endCallback": EndCallbackEventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface ParseDateEventArgs extends EventArgs { + readonly date: Date; + readonly handled: boolean; + readonly value: string; + } + + class BootstrapDateEdit extends BootstrapClientEdit { + adjustDropDownWindow(): void; + getButtonVisible(number: number): boolean; + getCalendar(): BootstrapCalendar | null; + getCaretPosition(): number; + getDate(): Date; + getMaxDate(): Date; + getMinDate(): Date; + getRangeDayCount(): number; + getText(): string; + getTimeEdit(): BootstrapTimeEdit | null; + hideDropDown(): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setDate(date: Date): void; + setMaxDate(date: Date): void; + setMinDate(date: Date): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapDateEdit, args?: BootstrapDateEditEventMap[K]) => void): this; + } + interface BootstrapDateEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "calendarCustomDisabledDate": CalendarCustomDisabledDateEventArgs; + "closeUp": EventArgs; + "dateChanged": ProcessingModeEventArgs; + "dropDown": EventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "parseDate": ParseDateEventArgs; + "queryCloseUp": CancelEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapDropDownEdit extends BootstrapClientEdit { + adjustDropDownWindow(): void; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getKeyValue(): string; + getText(): string; + hideDropDown(): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setKeyValue(keyValue: string): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapDropDownEdit, args?: BootstrapDropDownEditEventMap[K]) => void): this; + } + interface BootstrapDropDownEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "closeUp": EventArgs; + "dropDown": EventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapFormLayout extends Control { + getItemByName(name: string): BootstrapFormLayoutItem | null; + on(eventName: K, callback: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapFormLayout, args?: BootstrapFormLayoutEventMap[K]) => void): this; + } + interface BootstrapFormLayoutEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapFormLayoutItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly formLayout: BootstrapFormLayout | null; + readonly name: string; + readonly parent: BootstrapFormLayoutItem | null; + getCaption(): string; + getItemByName(name: string): BootstrapFormLayoutItem | null; + getVisible(): boolean; + setCaption(caption: string): void; + setVisible(value: boolean): void; + } + + interface GridViewColumnCancelEventArgs extends CancelEventArgs { + readonly column: BootstrapGridViewColumn; + } + + interface GridViewColumnProcessingModeEventArgs extends ProcessingModeEventArgs { + readonly column: BootstrapGridViewColumn; + } + + interface GridViewRowCancelEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface GridViewSelectionEventArgs extends ProcessingModeEventArgs { + readonly isAllRecordsOnPage: boolean; + readonly isChangedOnServer: boolean; + readonly isSelected: boolean; + readonly visibleIndex: number; + } + + interface GridViewFocusEventArgs extends ProcessingModeEventArgs { + readonly isChangedOnServer: boolean; + } + + interface GridViewRowFocusingEventArgs extends GridViewRowCancelEventArgs { + readonly htmlEvent: any; + } + + interface GridViewRowClickEventArgs extends GridViewRowCancelEventArgs { + readonly htmlEvent: any; + } + + interface GridViewContextMenuEventArgs extends EventArgs { + readonly htmlEvent: any; + readonly index: number; + readonly menu: any; + readonly objectType: string; + showBrowserMenu: boolean; + } + + interface GridViewContextMenuItemClickEventArgs extends ProcessingModeEventArgs { + readonly elementIndex: number; + handled: boolean; + readonly item: BootstrapMenuItem; + readonly objectType: string; + usePostBack: boolean; + } + + interface GridViewCustomButtonEventArgs extends ProcessingModeEventArgs { + readonly buttonID: string; + readonly visibleIndex: number; + } + + interface GridViewColumnMovingEventArgs extends EventArgs { + allow: boolean; + readonly destinationColumn: BootstrapGridViewColumn; + readonly isDropBefore: boolean; + readonly isGroupPanel: boolean; + readonly sourceColumn: BootstrapGridViewColumn; + } + + interface GridViewBatchEditConfirmShowingEventArgs extends CancelEventArgs { + readonly requestTriggerID: string; + } + + interface GridViewBatchEditStartEditingEventArgs extends CancelEventArgs { + focusedColumn: BootstrapGridViewColumn; + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditEndEditingEventArgs extends CancelEventArgs { + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditRowValidatingEventArgs extends EventArgs { + readonly validationInfo: any; + readonly visibleIndex: number; + } + + interface GridViewBatchEditTemplateCellFocusedEventArgs extends EventArgs { + readonly column: BootstrapGridViewColumn; + handled: boolean; + } + + interface GridViewBatchEditChangesSavingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface GridViewBatchEditChangesCancelingEventArgs extends CancelEventArgs { + readonly deletedValues: any; + readonly insertedValues: any; + readonly updatedValues: any; + } + + interface GridViewBatchEditRowInsertingEventArgs extends CancelEventArgs { + readonly visibleIndex: number; + } + + interface GridViewBatchEditRowDeletingEventArgs extends CancelEventArgs { + readonly rowValues: any; + readonly visibleIndex: number; + } + + interface GridViewFocusedCellChangingEventArgs extends CancelEventArgs { + readonly cellInfo: BootstrapGridViewCellInfo; + } + + class BootstrapGridView extends BootstrapGridBase { + readonly batchEditApi: BootstrapGridViewBatchEditApi | null; + addNewRow(): void; + applyFilter(filterExpression: string): void; + applyOnClickRowFilter(): void; + applySearchPanelFilter(value: string): void; + autoFilterByColumn(column: BootstrapGridViewColumn, val: string): void; + autoFilterByColumn(columnIndex: number, val: string): void; // tslint:disable-line:unified-signatures + autoFilterByColumn(columnFieldNameOrId: string, val: string): void; // tslint:disable-line:unified-signatures unified-signatures + cancelEdit(): void; + clearFilter(): void; + closeFilterControl(): void; + collapseAll(): void; + collapseAllDetailRows(): void; + collapseDetailRow(visibleIndex: number): void; + collapseRow(visibleIndex: number): void; + collapseRow(visibleIndex: number, recursive: boolean): void; // tslint:disable-line:unified-signatures + deleteRow(visibleIndex: number): void; + deleteRowByKey(key: any): void; + expandAll(): void; + expandAllDetailRows(): void; + expandDetailRow(visibleIndex: number): void; + expandRow(visibleIndex: number): void; + expandRow(visibleIndex: number, recursive: boolean): void; // tslint:disable-line:unified-signatures + focus(): void; + focusEditor(column: BootstrapGridViewColumn): void; + focusEditor(columnIndex: number): void; // tslint:disable-line:unified-signatures + focusEditor(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + getAutoFilterEditor(column: BootstrapGridViewColumn): any; + getAutoFilterEditor(columnIndex: number): any; // tslint:disable-line:unified-signatures + getAutoFilterEditor(columnFieldNameOrId: string): any; // tslint:disable-line:unified-signatures unified-signatures + getColumn(columnIndex: number): BootstrapGridViewColumn | null; + getColumnByField(columnFieldName: string): BootstrapGridViewColumn | null; + getColumnById(columnId: string): BootstrapGridViewColumn | null; + getColumnCount(): number; + getColumnLayout(): any; + getEditValue(column: BootstrapGridViewColumn): string; + getEditValue(columnIndex: number): string; // tslint:disable-line:unified-signatures + getEditValue(columnFieldNameOrId: string): string; // tslint:disable-line:unified-signatures unified-signatures + getEditor(column: BootstrapGridViewColumn): BootstrapClientEdit; + getEditor(columnIndex: number): BootstrapClientEdit; // tslint:disable-line:unified-signatures + getEditor(columnFieldNameOrId: string): BootstrapClientEdit; // tslint:disable-line:unified-signatures unified-signatures + getFocusedCell(): BootstrapGridViewCellInfo | null; + getFocusedRowIndex(): number; + getHorizontalScrollPosition(): number; + getPageCount(): number; + getPageIndex(): number; + getPopupEditForm(): BootstrapPopupControl | null; + getRowIndicesVisibleInViewPort(includePartiallyVisible: boolean): number[]; + getRowKey(visibleIndex: number): string; + getSelectedKeysOnPage(): any[]; + getSelectedRowCount(): number; + getTopVisibleIndex(): number; + getVerticalScrollPosition(): number; + getVisibleRowsOnPage(): number; + gotoPage(pageIndex: number): void; + groupBy(column: BootstrapGridViewColumn): void; + groupBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + groupBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(column: BootstrapGridViewColumn, groupIndex: number): void; // tslint:disable-line:unified-signatures + groupBy(columnIndex: number, groupIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(columnFieldNameOrId: string, groupIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + groupBy(column: BootstrapGridViewColumn, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures + groupBy(columnIndex: number, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + groupBy(columnFieldNameOrId: string, groupIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + hideCustomizationWindow(): void; + isCustomizationWindowVisible(): boolean; + isDataRow(visibleIndex: number): boolean; + isEditing(): boolean; + isGroupRow(visibleIndex: number): boolean; + isGroupRowExpanded(visibleIndex: number): boolean; + isNewRowEditing(): boolean; + isRowSelectedOnPage(visibleIndex: number): boolean; + makeRowVisible(visibleIndex: number): void; + nextPage(): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + prevPage(): void; + refresh(): void; + selectAllRowsOnPage(): void; + selectRowOnPage(visibleIndex: number): void; + selectRowOnPage(visibleIndex: number, selected: boolean): void; // tslint:disable-line:unified-signatures + selectRows(): void; + selectRowsByKey(keys: any[]): void; + selectRowsByKey(key: any): void; // tslint:disable-line:unified-signatures + selectRowsByKey(keys: any[], selected: boolean): void; // tslint:disable-line:unified-signatures + selectRowsByKey(key: any, selected: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + setColumnLayout(columnLayout: any): void; + setEditValue(column: BootstrapGridViewColumn, value: string): void; + setEditValue(columnIndex: number, value: string): void; // tslint:disable-line:unified-signatures + setEditValue(columnFieldNameOrId: string, value: string): void; // tslint:disable-line:unified-signatures unified-signatures + setFilterEnabled(isFilterEnabled: boolean): void; + setFixedColumnScrollableRows(scrollableRowSettings: any): void; + setFocusedCell(rowVisibleIndex: number, columnIndex: number): void; + setFocusedRowIndex(visibleIndex: number): void; + setHorizontalScrollPosition(position: number): void; + setSearchPanelCustomEditor(editor: BootstrapClientEdit): void; + setVerticalScrollPosition(position: number): void; + showCustomizationDialog(): void; + showCustomizationWindow(): void; + showFilterControl(): void; + sortBy(column: BootstrapGridViewColumn): void; + sortBy(columnIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + sortBy(column: BootstrapGridViewColumn, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures + sortBy(columnIndex: number, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures + sortBy(columnFieldNameOrId: string, sortOrder: string, reset: boolean, sortIndex: number): void; // tslint:disable-line:unified-signatures unified-signatures unified-signatures + startEditRow(visibleIndex: number): void; + startEditRowByKey(key: any): void; + ungroup(column: BootstrapGridViewColumn): void; + ungroup(columnIndex: number): void; // tslint:disable-line:unified-signatures + ungroup(columnFieldNameOrId: string): void; // tslint:disable-line:unified-signatures unified-signatures + unselectAllRowsOnPage(): void; + unselectFilteredRows(): void; + unselectRowOnPage(visibleIndex: number): void; + unselectRows(): void; + unselectRowsByKey(keys: any[]): void; + unselectRowsByKey(key: any): void; // tslint:disable-line:unified-signatures + updateEdit(): void; + on(eventName: K, callback: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapGridView, args?: BootstrapGridViewEventMap[K]) => void): this; + } + interface BootstrapGridViewEventMap extends BootstrapGridBaseEventMap { + "batchEditChangesCanceling": GridViewBatchEditChangesCancelingEventArgs; + "batchEditChangesSaving": GridViewBatchEditChangesSavingEventArgs; + "batchEditConfirmShowing": GridViewBatchEditConfirmShowingEventArgs; + "batchEditEndEditing": GridViewBatchEditEndEditingEventArgs; + "batchEditRowDeleting": GridViewBatchEditRowDeletingEventArgs; + "batchEditRowInserting": GridViewBatchEditRowInsertingEventArgs; + "batchEditRowValidating": GridViewBatchEditRowValidatingEventArgs; + "batchEditStartEditing": GridViewBatchEditStartEditingEventArgs; + "batchEditTemplateCellFocused": GridViewBatchEditTemplateCellFocusedEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "columnGrouping": GridViewColumnCancelEventArgs; + "columnMoving": GridViewColumnMovingEventArgs; + "columnResized": GridViewColumnProcessingModeEventArgs; + "columnResizing": GridViewColumnCancelEventArgs; + "columnSorting": GridViewColumnCancelEventArgs; + "columnStartDragging": GridViewColumnCancelEventArgs; + "contextMenu": GridViewContextMenuEventArgs; + "contextMenuItemClick": GridViewContextMenuItemClickEventArgs; + "customButtonClick": GridViewCustomButtonEventArgs; + "customizationWindowCloseUp": EventArgs; + "detailRowCollapsing": GridViewRowCancelEventArgs; + "detailRowExpanding": GridViewRowCancelEventArgs; + "endCallback": EndCallbackEventArgs; + "focusedCellChanging": GridViewFocusedCellChangingEventArgs; + "focusedRowChanged": GridViewFocusEventArgs; + "rowClick": GridViewRowClickEventArgs; + "rowCollapsing": GridViewRowCancelEventArgs; + "rowDblClick": GridViewRowClickEventArgs; + "rowExpanding": GridViewRowCancelEventArgs; + "rowFocusing": GridViewRowFocusingEventArgs; + "selectionChanged": GridViewSelectionEventArgs; + } + + class BootstrapGridViewBatchEditApi { + protected readonly instance: any; + protected constructor(instance: any); + addNewRow(): void; + deleteRow(visibleIndex: number): void; + deleteRowByKey(key: any): void; + endEdit(): void; + getCellTextContainer(visibleIndex: number, columnFieldNameOrId: string): any; + getCellValue(visibleIndex: number, columnFieldNameOrId: string, initial: boolean): any; + getColumnDisplayText(columnFieldNameOrId: string, value: any): string; + getDeletedRowIndices(): number[]; + getEditCellInfo(): BootstrapGridViewCellInfo | null; + getInsertedRowIndices(): number[]; + getRowVisibleIndices(includeDeleted: boolean): number[]; + hasChanges(): boolean; + isDeletedRow(visibleIndex: number): boolean; + isNewRow(visibleIndex: number): boolean; + moveFocusBackward(): boolean; + moveFocusForward(): boolean; + recoverRow(visibleIndex: number): void; + recoverRowByKey(key: any): void; + resetChanges(visibleIndex: number): void; + resetChanges(visibleIndex: number, columnIndex: number): void; // tslint:disable-line:unified-signatures + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any): void; + setCellValue(visibleIndex: number, columnFieldNameOrId: string, value: any, displayText: string, cancelCellHighlighting: boolean): void; + startEdit(visibleIndex: number, columnIndex: number): void; + validateRow(visibleIndex: number): boolean; + validateRows(validateOnlyModified: boolean): boolean; + } + + class BootstrapGridViewColumn { + protected readonly instance: any; + protected constructor(instance: any); + readonly fieldName: string; + readonly index: number; + readonly name: string; + readonly visible: boolean; + } + + class BootstrapGridViewCellInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly rowVisibleIndex: number; + } + + class BootstrapHyperLink extends Control { + getBadgeIconCssClass(): string; + getBadgeText(): string; + getCaption(): string; + getEnabled(): boolean; + getNavigateUrl(): string; + getText(): string; + getValue(): any; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setCaption(caption: string): void; + setEnabled(value: boolean): void; + setNavigateUrl(url: string): void; + setText(text: string): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapHyperLink, args?: BootstrapHyperLinkEventMap[K]) => void): this; + } + interface BootstrapHyperLinkEventMap extends ControlEventMap { + "click": EditClickEventArgs; + } + + interface ListEditItemSelectedChangedEventArgs extends ProcessingModeEventArgs { + readonly index: number; + readonly isSelected: boolean; + } + + interface ListEditCustomHighlightingEventArgs extends EventArgs { + readonly filter: string; + highlighting: any; + } + + interface ListEditItemFilteringEventArgs extends EventArgs { + readonly filter: string; + isFit: boolean; + readonly item: BootstrapListBoxItem; + } + + class BootstrapListBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + beginUpdate(): void; + clearItems(): void; + endUpdate(): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedIndices(): number[]; + getSelectedItem(): BootstrapListBoxItem | null; + getSelectedItems(): BootstrapListBoxItem[]; + getSelectedValues(): any[]; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + selectAll(): void; + selectIndices(indices: number[]): void; + selectItems(items: BootstrapListBoxItem[]): void; + selectValues(values: any[]): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + unselectAll(): void; + unselectIndices(indices: number[]): void; + unselectItems(items: BootstrapListBoxItem[]): void; + unselectValues(values: any[]): void; + on(eventName: K, callback: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapListBox, args?: BootstrapListBoxEventMap[K]) => void): this; + } + interface BootstrapListBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "endCallback": EndCallbackEventArgs; + "itemDoubleClick": EventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + } + + class BootstrapListBoxItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly iconCssClass: string; + readonly imageUrl: string; + readonly index: number; + readonly listEditBase: BootstrapListBox | null; + readonly text: string; + readonly value: any; + getColumnText(columnIndex: number): string; + getColumnText(columnName: string): string; // tslint:disable-line:unified-signatures + getFieldText(fieldIndex: number): string; + getFieldText(fieldName: string): string; // tslint:disable-line:unified-signatures + } + + class BootstrapCheckBoxList extends BootstrapListBox { + getItem(index: number): BootstrapListBoxItem | null; + getItemCount(): number; + getSelectedIndices(): number[]; + getSelectedItems(): BootstrapListBoxItem[]; + getSelectedValues(): any[]; + selectAll(): void; + selectIndices(indices: number[]): void; + selectItems(items: BootstrapListBoxItem[]): void; + selectValues(values: any[]): void; + unselectAll(): void; + unselectIndices(indices: number[]): void; + unselectItems(items: BootstrapListBoxItem[]): void; + unselectValues(values: any[]): void; + on(eventName: K, callback: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapCheckBoxList, args?: BootstrapCheckBoxListEventMap[K]) => void): this; + } + interface BootstrapCheckBoxListEventMap extends BootstrapListBoxEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapRadioButtonList extends BootstrapListBox { + getItem(index: number): BootstrapListBoxItem | null; + getItemCount(): number; + on(eventName: K, callback: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapRadioButtonList, args?: BootstrapRadioButtonListEventMap[K]) => void): this; + } + interface BootstrapRadioButtonListEventMap extends BootstrapListBoxEventMap { // tslint:disable-line:no-empty-interface + } + + interface MenuItemEventArgs extends EventArgs { + readonly item: BootstrapMenuItem; + } + + interface MenuItemMouseEventArgs extends MenuItemEventArgs { // tslint:disable-line:no-empty-interface + } + + interface MenuItemClickEventArgs extends ProcessingModeEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + readonly item: BootstrapMenuItem; + } + + class BootstrapMenu extends Control { + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getItemCount(): number; + getOrientation(): string; + getRootItem(): BootstrapMenuItem | null; + getSelectedItem(): BootstrapMenuItem | null; + setOrientation(orientation: string): void; + setSelectedItem(item: BootstrapMenuItem): void; + on(eventName: K, callback: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapMenu, args?: BootstrapMenuEventMap[K]) => void): this; + } + interface BootstrapMenuEventMap extends ControlEventMap { + "closeUp": MenuItemEventArgs; + "itemClick": MenuItemClickEventArgs; + "itemMouseOut": MenuItemMouseEventArgs; + "itemMouseOver": MenuItemMouseEventArgs; + "popUp": MenuItemEventArgs; + } + + class BootstrapMenuItem { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly indexPath: string; + readonly menu: BootstrapMenu | null; + readonly name: string; + readonly parent: BootstrapMenuItem | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getChecked(): boolean; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getItemCount(): number; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + interface PopupWindowEventArgs extends EventArgs { + readonly window: BootstrapPopupWindow; + } + + interface PopupWindowCloseUpEventArgs extends PopupWindowEventArgs { + readonly closeReason: BootstrapPopupControlCloseReason; + } + + interface PopupWindowCancelEventArgs extends CancelEventArgs { + readonly closeReason: BootstrapPopupControlCloseReason; + readonly window: BootstrapPopupWindow; + } + + interface PopupWindowPinnedChangedEventArgs extends PopupWindowEventArgs { + readonly pinned: boolean; + } + + interface PopupWindowResizeEventArgs extends PopupWindowEventArgs { + readonly resizeState: number; + } + + class BootstrapPopupControl extends Control { + adjustSize(): void; + bringToFront(): void; + bringWindowToFront(window: BootstrapPopupWindow): void; + getCollapsed(): boolean; + getContentHeight(): number; + getContentHtml(): string; + getContentIFrame(): any; + getContentIFrameWindow(): any; + getContentUrl(): string; + getContentWidth(): number; + getCurrentPopupElement(): any; + getCurrentPopupElementIndex(): number; + getFooterImageUrl(): string; + getFooterNavigateUrl(): string; + getFooterText(): string; + getHeaderImageUrl(): string; + getHeaderNavigateUrl(): string; + getHeaderText(): string; + getMainElement(): any; + getMaximized(): boolean; + getPinned(): boolean; + getPopUpReasonMouseEvent(): any; + getWindow(index: number): BootstrapPopupWindow | null; + getWindowByName(name: string): BootstrapPopupWindow | null; + getWindowCollapsed(window: BootstrapPopupWindow): boolean; + getWindowContentHeight(window: BootstrapPopupWindow): number; + getWindowContentHtml(window: BootstrapPopupWindow): string; + getWindowContentIFrame(window: BootstrapPopupWindow): any; + getWindowContentUrl(window: BootstrapPopupWindow): string; + getWindowContentWidth(window: BootstrapPopupWindow): number; + getWindowCount(): number; + getWindowCurrentPopupElement(window: BootstrapPopupWindow): any; + getWindowCurrentPopupElementIndex(window: BootstrapPopupWindow): number; + getWindowHeight(window: BootstrapPopupWindow): number; + getWindowMaximized(window: BootstrapPopupWindow): boolean; + getWindowPinned(window: BootstrapPopupWindow): boolean; + getWindowPopUpReasonMouseEvent(window: BootstrapPopupWindow): any; + getWindowWidth(window: BootstrapPopupWindow): number; + hide(): void; + hideWindow(window: BootstrapPopupWindow): void; + isVisible(): boolean; + isWindowVisible(window: BootstrapPopupWindow): boolean; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + refreshContentUrl(): void; + refreshPopupElementConnection(): void; + refreshWindowContentUrl(window: BootstrapPopupWindow): void; + setAdaptiveMaxHeight(maxHeight: number): void; + setAdaptiveMaxHeight(maxHeight: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMaxWidth(maxWidth: number): void; + setAdaptiveMaxWidth(maxWidth: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMinHeight(minHeight: number): void; + setAdaptiveMinHeight(minHeight: string): void; // tslint:disable-line:unified-signatures + setAdaptiveMinWidth(minWidth: number): void; + setAdaptiveMinWidth(minWidth: string): void; // tslint:disable-line:unified-signatures + setCollapsed(value: boolean): void; + setContentHtml(html: string): void; + setContentUrl(url: string): void; + setFooterImageUrl(value: string): void; + setFooterNavigateUrl(value: string): void; + setFooterText(value: string): void; + setHeaderImageUrl(value: string): void; + setHeaderNavigateUrl(value: string): void; + setHeaderText(value: string): void; + setMaximized(value: boolean): void; + setPinned(value: boolean): void; + setPopupElementCssSelector(selector: string): void; + setPopupElementID(popupElementId: string): void; + setSize(width: number, height: number): void; + setWindowAdaptiveMaxHeight(window: BootstrapPopupWindow, maxHeight: number): void; + setWindowAdaptiveMaxHeight(window: BootstrapPopupWindow, maxHeight: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMaxWidth(window: BootstrapPopupWindow, maxWidth: number): void; + setWindowAdaptiveMaxWidth(window: BootstrapPopupWindow, maxWidth: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMinHeight(window: BootstrapPopupWindow, minHeight: number): void; + setWindowAdaptiveMinHeight(window: BootstrapPopupWindow, minHeight: string): void; // tslint:disable-line:unified-signatures + setWindowAdaptiveMinWidth(window: BootstrapPopupWindow, minWidth: number): void; + setWindowAdaptiveMinWidth(window: BootstrapPopupWindow, minWidth: string): void; // tslint:disable-line:unified-signatures + setWindowCollapsed(window: BootstrapPopupWindow, value: boolean): void; + setWindowContentHtml(window: BootstrapPopupWindow, html: string): void; + setWindowContentUrl(window: BootstrapPopupWindow, url: string): void; + setWindowMaximized(window: BootstrapPopupWindow, value: boolean): void; + setWindowPinned(window: BootstrapPopupWindow, value: boolean): void; + setWindowPopupElementID(window: BootstrapPopupWindow, popupElementId: string): void; + setWindowSize(window: BootstrapPopupWindow, width: number, height: number): void; + show(): void; + showAtElement(htmlElement: any): void; + showAtElementByID(id: string): void; + showAtPos(x: number, y: number): void; + showWindow(window: BootstrapPopupWindow): void; + showWindow(window: BootstrapPopupWindow, popupElementIndex: number): void; // tslint:disable-line:unified-signatures + showWindowAtElement(window: BootstrapPopupWindow, htmlElement: any): void; + showWindowAtElementByID(window: BootstrapPopupWindow, id: string): void; + showWindowAtPos(window: BootstrapPopupWindow, x: number, y: number): void; + stretchVertically(): void; + updatePosition(): void; + updatePositionAtElement(htmlElement: any): void; + updateWindowPosition(window: BootstrapPopupWindow): void; + updateWindowPositionAtElement(window: BootstrapPopupWindow, htmlElement: any): void; + windowStretchVertically(window: BootstrapPopupWindow): void; + on(eventName: K, callback: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPopupControl, args?: BootstrapPopupControlEventMap[K]) => void): this; + } + interface BootstrapPopupControlEventMap extends ControlEventMap { + "afterResizing": PopupWindowEventArgs; + "beforeResizing": PopupWindowEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": PopupWindowCloseUpEventArgs; + "closing": PopupWindowCancelEventArgs; + "endCallback": EndCallbackEventArgs; + "pinnedChanged": PopupWindowPinnedChangedEventArgs; + "popUp": PopupWindowEventArgs; + "resize": PopupWindowResizeEventArgs; + "shown": PopupWindowEventArgs; + } + + class BootstrapPopupWindow { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly popupControl: BootstrapPopupControl | null; + getFooterImageUrl(): string; + getFooterNavigateUrl(): string; + getFooterText(): string; + getHeaderImageUrl(): string; + getHeaderNavigateUrl(): string; + getHeaderText(): string; + setFooterImageUrl(value: string): void; + setFooterNavigateUrl(value: string): void; + setFooterText(value: string): void; + setHeaderImageUrl(value: string): void; + setHeaderNavigateUrl(value: string): void; + setHeaderText(value: string): void; + } + + class BootstrapPopupMenu extends BootstrapMenu { + getCurrentPopupElement(): any; + getCurrentPopupElementIndex(): number; + getItem(index: number): BootstrapMenuItem | null; + getItemByName(name: string): BootstrapMenuItem | null; + getRootItem(): BootstrapMenuItem | null; + getSelectedItem(): BootstrapMenuItem | null; + hide(): void; + refreshPopupElementConnection(): void; + setPopupElementCssSelector(selector: string): void; + setPopupElementID(popupElementId: string): void; + setSelectedItem(item: BootstrapMenuItem): void; + show(): void; + showAtElement(htmlElement: any): void; + showAtElementByID(id: string): void; + showAtPos(x: number, y: number): void; + on(eventName: K, callback: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPopupMenu, args?: BootstrapPopupMenuEventMap[K]) => void): this; + } + interface BootstrapPopupMenuEventMap extends BootstrapMenuEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapProgressBar extends Control { + getCaption(): string; + getDisplayText(): string; + getEnabled(): boolean; + getMaximum(): number; + getMinimum(): number; + getPercent(): number; + getPosition(): number; + getValue(): any; + setCaption(caption: string): void; + setCustomDisplayFormat(text: string): void; + setEnabled(value: boolean): void; + setMaximum(max: number): void; + setMinMaxValues(minValue: number, maxValue: number): void; + setMinimum(min: number): void; + setPosition(position: number): void; + setValue(value: any): void; + on(eventName: K, callback: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapProgressBar, args?: BootstrapProgressBarEventMap[K]) => void): this; + } + interface BootstrapProgressBarEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + interface ActiveViewChangingEventArgs extends EventArgs { + cancel: boolean; + readonly newView: BootstrapSchedulerViewType; + readonly oldView: BootstrapSchedulerViewType; + } + + interface AppointmentClickEventArgs extends EventArgs { + readonly appointmentId: string; + readonly handled: boolean; + readonly htmlElement: object; + } + + interface AppointmentDeletingEventArgs extends CancelEventArgs { + readonly appointmentIds: object[]; + } + + interface AppointmentDragEventArgs extends EventArgs { + allow: boolean; + readonly dragInformation: BootstrapSchedulerAppointmentDragInfo[]; + readonly mouseEvent: any; + } + + interface AppointmentDropEventArgs extends EventArgs { + readonly dragInformation: BootstrapSchedulerAppointmentDragInfo[]; + handled: boolean; + readonly operation: BootstrapSchedulerAppointmentOperation; + } + + interface AppointmentResizeEventArgs extends EventArgs { + readonly appointmentId: string; + handled: boolean; + readonly newInterval: BootstrapTimeInterval; + readonly oldInterval: BootstrapTimeInterval; + readonly operation: BootstrapSchedulerAppointmentOperation; + } + + interface AppointmentResizingEventArgs extends EventArgs { + allow: boolean; + readonly appointmentId: string; + readonly mouseEvent: any; + readonly newInterval: BootstrapTimeInterval; + readonly oldInterval: BootstrapTimeInterval; + } + + interface AppointmentToolTipShowingEventArgs extends CancelEventArgs { + readonly appointment: BootstrapSchedulerAppointment; + } + + interface AppointmentsSelectionEventArgs extends EventArgs { + readonly appointmentIds: string[]; + } + + interface CellClickEventArgs extends EventArgs { + readonly htmlElement: object; + readonly interval: BootstrapTimeInterval; + readonly resource: string; + } + + interface MenuItemClickedEventArgs extends EventArgs { + handled: boolean; + readonly itemName: string; + } + + interface MoreButtonClickedEventArgs extends ProcessingModeEventArgs { + handled: boolean; + readonly interval: BootstrapTimeInterval; + readonly resource: string; + readonly targetDateTime: Date; + } + + interface ShortcutEventArgs extends EventArgs { + readonly commandName: string; + readonly handled: boolean; + readonly htmlEvent: object; + } + + class BootstrapScheduler extends Control { + appointmentFormCancel(): void; + appointmentFormDelete(): void; + appointmentFormSave(): void; + changeFormContainer(container: any): void; + changePopupMenuContainer(container: any): void; + changeTimeZoneId(timeZoneId: string): void; + changeToolTipContainer(container: any): void; + deleteAppointment(apt: BootstrapSchedulerAppointment): void; + deselectAppointmentById(aptId: any): void; + getActiveViewType(): BootstrapSchedulerViewType; + getAllDayAreaHeight(): number; + getAppointmentById(id: any): BootstrapSchedulerAppointment | null; + getAppointmentProperties(aptId: number, propertyNames: string[], onCallBack: any): string[]; + getGroupType(): BootstrapSchedulerGroupType; + getResourceNavigatorVisible(): boolean; + getScrollAreaHeight(): number; + getSelectedAppointmentIds(): string[]; + getSelectedInterval(): BootstrapTimeInterval | null; + getSelectedResource(): string; + getToolbarVisible(): boolean; + getTopRowTime(viewType: BootstrapSchedulerViewType): number; + getVisibleAppointments(): BootstrapSchedulerAppointment[]; + getVisibleIntervals(): BootstrapTimeInterval[]; + goToDateFormApply(): void; + goToDateFormCancel(): void; + gotoDate(date: Date): void; + gotoToday(): void; + hideLoadingPanel(): void; + inplaceEditFormCancel(): void; + inplaceEditFormSave(): void; + inplaceEditFormShowMore(): void; + insertAppointment(apt: BootstrapSchedulerAppointment): void; + navigateBackward(): void; + navigateForward(): void; + performCallback(parameter: string): void; + refresh(): void; + refreshClientAppointmentProperties(clientAppointment: BootstrapSchedulerAppointment, propertyNames: string[], onCallBack: any): void; + reminderFormCancel(): void; + reminderFormDismiss(): void; + reminderFormDismissAll(): void; + reminderFormSnooze(): void; + selectAppointmentById(aptId: any): void; + selectAppointmentById(aptId: any, scrollToSelection: boolean): void; // tslint:disable-line:unified-signatures + setActiveViewType(value: BootstrapSchedulerViewType): void; + setAllDayAreaHeight(height: number): void; + setGroupType(value: BootstrapSchedulerGroupType): void; + setHeight(height: number): void; + setResourceNavigatorVisible(visible: boolean): void; + setSelection(interval: BootstrapTimeInterval): void; + setSelection(interval: BootstrapTimeInterval, resourceId: string): void; // tslint:disable-line:unified-signatures + setSelection(interval: BootstrapTimeInterval, resourceId: string, scrollToSelection: boolean): void; // tslint:disable-line:unified-signatures + setToolbarVisible(visible: boolean): void; + setTopRowTime(duration: number): void; + setTopRowTime(duration: number, viewType: BootstrapSchedulerViewType): void; // tslint:disable-line:unified-signatures + setVisibleResources(resourceIds: string[]): void; + showAppointmentFormByClientId(aptClientId: string): void; + showAppointmentFormByServerId(aptServerId: string): void; + showInplaceEditor(start: Date, end: Date): void; + showInplaceEditor(start: Date, end: Date, resourceId: string): void; // tslint:disable-line:unified-signatures + showLoadingPanel(): void; + showSelectionToolTip(x: number, y: number): void; + updateAppointment(apt: BootstrapSchedulerAppointment): void; + on(eventName: K, callback: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapScheduler, args?: BootstrapSchedulerEventMap[K]) => void): this; + } + interface BootstrapSchedulerEventMap extends ControlEventMap { + "activeViewChanged": EventArgs; + "activeViewChanging": ActiveViewChangingEventArgs; + "appointmentClick": AppointmentClickEventArgs; + "appointmentDeleting": AppointmentDeletingEventArgs; + "appointmentDoubleClick": AppointmentClickEventArgs; + "appointmentDrag": AppointmentDragEventArgs; + "appointmentDrop": AppointmentDropEventArgs; + "appointmentResize": AppointmentResizeEventArgs; + "appointmentResizing": AppointmentResizingEventArgs; + "appointmentToolTipShowing": AppointmentToolTipShowingEventArgs; + "appointmentsSelectionChanged": AppointmentsSelectionEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "cellClick": CellClickEventArgs; + "cellDoubleClick": CellClickEventArgs; + "endCallback": EndCallbackEventArgs; + "menuItemClicked": MenuItemClickedEventArgs; + "moreButtonClicked": MoreButtonClickedEventArgs; + "selectionChanged": EventArgs; + "selectionChanging": EventArgs; + "shortcut": ShortcutEventArgs; + "visibleIntervalChanged": EventArgs; + } + + class BootstrapTimeInterval { + protected readonly instance: any; + protected constructor(instance: any); + contains(interval: BootstrapTimeInterval): boolean; + equals(interval: BootstrapTimeInterval): boolean; + getAllDay(): boolean; + getDuration(): number; + getEnd(): Date; + getStart(): Date; + intersectsWith(interval: BootstrapTimeInterval): boolean; + intersectsWithExcludingBounds(interval: BootstrapTimeInterval): boolean; + setAllDay(allDayValue: boolean): void; + setDuration(value: number): void; + setEnd(value: Date): void; + setStart(value: Date): void; + } + + class BootstrapSchedulerAppointment { + protected readonly instance: any; + protected constructor(instance: any); + readonly appointmentId: string; + readonly appointmentType: BootstrapSchedulerAppointmentType; + readonly interval: BootstrapTimeInterval | null; + readonly labelIndex: number; + readonly resources: string[]; + readonly statusIndex: number; + addResource(resourceId: object): void; + getAllDay(): boolean; + getAppointmentType(): BootstrapSchedulerAppointmentType; + getDescription(): string; + getDuration(): number; + getEnd(): Date; + getId(): any; + getLabelId(): number; + getLocation(): string; + getRecurrenceInfo(): BootstrapSchedulerRecurrenceInfo | null; + getRecurrencePattern(): BootstrapSchedulerAppointment | null; + getResource(index: number): any; + getStart(): Date; + getStatusId(): number; + getSubject(): string; + setAllDay(allDay: boolean): void; + setAppointmentType(type: BootstrapSchedulerAppointmentType): void; + setDescription(description: string): void; + setDuration(duration: number): void; + setEnd(end: Date): void; + setId(id: any): void; + setLabelId(statusId: number): void; + setLocation(location: string): void; + setRecurrenceInfo(recurrenceInfo: BootstrapSchedulerRecurrenceInfo): void; + setStart(start: Date): void; + setStatusId(statusId: number): void; + setSubject(subject: string): void; + } + + class BootstrapSchedulerAppointmentDragInfo { + protected readonly instance: any; + protected constructor(instance: any); + readonly appointmentId: string; + readonly newInterval: BootstrapTimeInterval | null; + readonly oldInterval: BootstrapTimeInterval | null; + } + + class BootstrapSchedulerAppointmentOperation { + protected readonly instance: any; + protected constructor(instance: any); + apply(): void; + cancel(): void; + } + + class BootstrapSchedulerRecurrenceInfo { + protected readonly instance: any; + protected constructor(instance: any); + getDayNumber(): number; + getDuration(): number; + getEnd(): Date; + getMonth(): number; + getOccurrenceCount(): number; + getPeriodicity(): number; + getRange(): BootstrapSchedulerRecurrenceRange; + getRecurrenceType(): BootstrapSchedulerRecurrenceType; + getStart(): Date; + getWeekDays(): WeekDays; + getWeekOfMonth(): WeekOfMonth; + setDayNumber(dayNumber: number): void; + setDuration(duration: number): void; + setEnd(end: Date): void; + setMonth(month: number): void; + setOccurrenceCount(occurrenceCount: number): void; + setPeriodicity(periodicity: number): void; + setRange(range: BootstrapSchedulerRecurrenceRange): void; + setRecurrenceType(type: BootstrapSchedulerRecurrenceType): void; + setStart(start: Date): void; + setWeekDays(weekDays: WeekDays): void; + setWeekOfMonth(weekOfMonth: WeekOfMonth): void; + } + + class BootstrapSparkline extends Control { + exportTo(fileName: string, format: string): void; + getDataSource(): any; + getInstance(): any; + print(): void; + setDataSource(dataSource: any): void; + setOptions(options: any): void; + on(eventName: K, callback: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapSparkline, args?: BootstrapSparklineEventMap[K]) => void): this; + } + interface BootstrapSparklineEventMap extends ControlEventMap { + "disposing": BootstrapChartEventArgsBase; + "drawn": BootstrapChartEventArgsBase; + "exported": BootstrapChartEventArgsBase; + "exporting": BootstrapChartExportEventArgs; + "fileSaving": BootstrapChartExportEventArgs; + "incidentOccurred": BootstrapChartErrorEventArgs; + "init": BootstrapChartEventArgsBase; + "optionChanged": BootstrapChartOptionChangedEventArgs; + "tooltipHidden": BootstrapChartEventArgsBase; + "tooltipShown": BootstrapChartEventArgsBase; + } + + class BootstrapTimeEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getDate(): Date; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setDate(date: Date): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTimeEdit, args?: BootstrapTimeEditEventMap[K]) => void): this; + } + interface BootstrapTimeEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "dateChanged": ProcessingModeEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapSpinEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getMaxValue(): number; + getMinValue(): number; + getNumber(): number; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setMaxValue(value: number): void; + setMinValue(value: number): void; + setNumber(number: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + setValue(number: number): void; + on(eventName: K, callback: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapSpinEdit, args?: BootstrapSpinEditEventMap[K]) => void): this; + } + interface BootstrapSpinEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "numberChanged": ProcessingModeEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface TabControlTabEventArgs extends EventArgs { + readonly tab: BootstrapTab; + } + + interface TabControlTabCancelEventArgs extends ProcessingModeCancelEventArgs { + reloadContentOnCallback: boolean; + readonly tab: BootstrapTab; + } + + interface TabControlTabClickEventArgs extends TabControlTabCancelEventArgs { + readonly htmlElement: object; + readonly htmlEvent: object; + } + + class BootstrapTabControl extends Control { + adjustSize(): void; + getActiveTab(): BootstrapTab | null; + getActiveTabIndex(): number; + getTab(index: number): BootstrapTab | null; + getTabByName(name: string): BootstrapTab | null; + getTabCount(): number; + setActiveTab(tab: BootstrapTab): void; + setActiveTabIndex(index: number): void; + on(eventName: K, callback: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTabControl, args?: BootstrapTabControlEventMap[K]) => void): this; + } + interface BootstrapTabControlEventMap extends ControlEventMap { + "activeTabChanged": TabControlTabEventArgs; + "activeTabChanging": TabControlTabCancelEventArgs; + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "endCallback": EndCallbackEventArgs; + "tabClick": TabControlTabClickEventArgs; + } + + class BootstrapTab { + protected readonly instance: any; + protected constructor(instance: any); + readonly index: number; + readonly name: string; + readonly tabControl: BootstrapTabControl | null; + getActiveIconCssClass(): string; + getActiveImageUrl(): string; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getEnabled(): boolean; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getText(): string; + getVisible(): boolean; + setActiveIconCssClass(cssClass: string): void; + setActiveImageUrl(value: string): void; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setEnabled(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + } + + class BootstrapPageControl extends BootstrapTabControl { + getActiveTab(): BootstrapTab | null; + getTab(index: number): BootstrapTab | null; + getTabByName(name: string): BootstrapTab | null; + getTabContentHTML(tab: BootstrapTab): string; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + setActiveTab(tab: BootstrapTab): void; + setTabContentHTML(tab: BootstrapTab, html: string): void; + on(eventName: K, callback: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapPageControl, args?: BootstrapPageControlEventMap[K]) => void): this; + } + interface BootstrapPageControlEventMap extends BootstrapTabControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapTagBox extends BootstrapClientEdit { + addItem(texts: string[]): number; + addItem(text: string): number; // tslint:disable-line:unified-signatures + addItem(texts: string[], value: any): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any): number; // tslint:disable-line:unified-signatures unified-signatures + addItem(texts: string[], value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures + addItem(text: string, value: any, iconCssClass: string): number; // tslint:disable-line:unified-signatures unified-signatures + addItemCssClass(index: number, className: string): void; + addItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + addTag(text: string): void; + adjustDropDownWindow(): void; + beginUpdate(): void; + clearItems(): void; + clearTagCollection(): void; + endUpdate(): void; + ensureDropDownLoaded(callbackFunction: any): void; + findItemByText(text: string): BootstrapListBoxItem | null; + findItemByValue(value: any): BootstrapListBoxItem | null; + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getItem(index: number): BootstrapListBoxItem | null; + getItemBadgeIconCssClass(index: number): string; + getItemBadgeText(index: number): string; + getItemCount(): number; + getSelectedIndex(): number; + getSelectedItem(): BootstrapListBoxItem | null; + getTagCollection(): string[]; + getTagHtmlElement(index: number): any; + getTagIndexByText(text: string): number; + getTagRemoveButtonHtmlElement(index: number): any; + getTagTextHtmlElement(index: number): any; + getText(): string; + getValue(): string; + hideDropDown(): void; + insertItem(index: number, texts: string[]): void; + insertItem(index: number, text: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, texts: string[], value: any): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any): void; // tslint:disable-line:unified-signatures unified-signatures + insertItem(index: number, texts: string[], value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures + insertItem(index: number, text: string, value: any, iconCssClass: string): void; // tslint:disable-line:unified-signatures unified-signatures + isCustomTag(text: string, caseSensitive: boolean): boolean; + makeItemVisible(index: number): void; + performCallback(data: any): Promise; + performCallback(data: any, onSuccess: () => void): void; + removeItem(index: number): void; + removeItemCssClass(index: number, className: string): void; + removeItemTextCellCssClass(itemIndex: number, textCellIndex: number, className: string): void; + removeTag(index: number): void; + removeTagByText(text: string): void; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setItemBadgeIconCssClass(index: number, cssClass: string): void; + setItemBadgeText(index: number, text: string): void; + setItemHtml(index: number, html: string): void; + setItemTextCellHtml(itemIndex: number, textCellIndex: number, html: string): void; + setItemTextCellTooltip(itemIndex: number, textCellIndex: number, tooltip: string): void; + setItemTooltip(index: number, tooltip: string): void; + setSelectedIndex(index: number): void; + setSelectedItem(item: BootstrapListBoxItem): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setTagCollection(collection: string[]): void; + setText(text: string): void; + setValue(value: string): void; + showDropDown(): void; + on(eventName: K, callback: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTagBox, args?: BootstrapTagBoxEventMap[K]) => void): this; + } + interface BootstrapTagBoxEventMap extends BootstrapClientEditEventMap { + "beginCallback": BeginCallbackEventArgs; + "buttonClick": ButtonEditClickEventArgs; + "callbackError": CallbackErrorEventArgs; + "closeUp": EventArgs; + "customHighlighting": ListEditCustomHighlightingEventArgs; + "dropDown": EventArgs; + "endCallback": EndCallbackEventArgs; + "itemFiltering": ListEditItemFilteringEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "queryCloseUp": CancelEventArgs; + "selectedIndexChanged": ProcessingModeEventArgs; + "tagsChanged": EventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + interface ButtonEditClickEventArgs extends ProcessingModeEventArgs { + readonly buttonIndex: number; + } + + class BootstrapButtonEdit extends BootstrapClientEdit { + getButtonVisible(number: number): boolean; + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setButtonVisible(number: number, value: boolean): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapButtonEdit, args?: BootstrapButtonEditEventMap[K]) => void): this; + } + interface BootstrapButtonEditEventMap extends BootstrapClientEditEventMap { + "buttonClick": ButtonEditClickEventArgs; + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapMemo extends BootstrapClientEdit { + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapMemo, args?: BootstrapMemoEventMap[K]) => void): this; + } + interface BootstrapMemoEventMap extends BootstrapClientEditEventMap { + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapTextBox extends BootstrapClientEdit { + getCaretPosition(): number; + getText(): string; + selectAll(): void; + setCaretPosition(position: number): void; + setSelection(startPos: number, endPos: number, scrollToSelection: boolean): void; + setText(text: string): void; + on(eventName: K, callback: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTextBox, args?: BootstrapTextBoxEventMap[K]) => void): this; + } + interface BootstrapTextBoxEventMap extends BootstrapClientEditEventMap { + "keyDown": EditKeyEventArgs; + "keyPress": EditKeyEventArgs; + "keyUp": EditKeyEventArgs; + "textChanged": ProcessingModeEventArgs; + "userInput": EventArgs; + } + + class BootstrapToolbar extends BootstrapMenu { + on(eventName: K, callback: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapToolbar, args?: BootstrapToolbarEventMap[K]) => void): this; + } + interface BootstrapToolbarEventMap extends BootstrapMenuEventMap { // tslint:disable-line:no-empty-interface + } + + interface TreeViewNodeProcessingModeEventArgs extends ProcessingModeEventArgs { + readonly node: BootstrapTreeViewNode; + } + + interface TreeViewNodeClickEventArgs extends TreeViewNodeProcessingModeEventArgs { + readonly htmlElement: any; + readonly htmlEvent: any; + } + + interface TreeViewNodeEventArgs extends EventArgs { + readonly node: BootstrapTreeViewNode; + } + + interface TreeViewNodeCancelEventArgs extends ProcessingModeCancelEventArgs { + readonly node: BootstrapTreeViewNode; + } + + class BootstrapTreeView extends Control { + collapseAll(): void; + expandAll(): void; + getNode(index: number): BootstrapTreeViewNode | null; + getNodeByName(name: string): BootstrapTreeViewNode | null; + getNodeByText(text: string): BootstrapTreeViewNode | null; + getNodeCount(): number; + getRootNode(): BootstrapTreeViewNode | null; + getSelectedNode(): BootstrapTreeViewNode | null; + setSelectedNode(node: BootstrapTreeViewNode): void; + on(eventName: K, callback: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTreeView, args?: BootstrapTreeViewEventMap[K]) => void): this; + } + interface BootstrapTreeViewEventMap extends ControlEventMap { + "beginCallback": BeginCallbackEventArgs; + "callbackError": CallbackErrorEventArgs; + "checkedChanged": TreeViewNodeProcessingModeEventArgs; + "endCallback": EndCallbackEventArgs; + "expandedChanged": TreeViewNodeEventArgs; + "expandedChanging": TreeViewNodeCancelEventArgs; + "nodeClick": TreeViewNodeClickEventArgs; + } + + class BootstrapTreeViewNode extends Control { + readonly index: number; + readonly name: string; + readonly parent: BootstrapTreeViewNode | null; + readonly treeView: BootstrapTreeView | null; + getBadgeIconCssClass(): string; + getBadgeText(): string; + getCheckState(): string; + getChecked(): boolean; + getEnabled(): boolean; + getExpanded(): boolean; + getHtmlElement(): any; + getIconCssClass(): string; + getImageUrl(): string; + getNavigateUrl(): string; + getNode(index: number): BootstrapTreeViewNode | null; + getNodeByName(name: string): BootstrapTreeViewNode | null; + getNodeByText(text: string): BootstrapTreeViewNode | null; + getNodeCount(): number; + getText(): string; + getVisible(): boolean; + setBadgeIconCssClass(cssClass: string): void; + setBadgeText(text: string): void; + setChecked(value: boolean): void; + setEnabled(value: boolean): void; + setExpanded(value: boolean): void; + setIconCssClass(cssClass: string): void; + setImageUrl(value: string): void; + setNavigateUrl(value: string): void; + setText(value: string): void; + setVisible(value: boolean): void; + on(eventName: K, callback: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapTreeViewNode, args?: BootstrapTreeViewNodeEventMap[K]) => void): this; + } + interface BootstrapTreeViewNodeEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + interface UploadControlFilesUploadStartEventArgs extends EventArgs { + readonly cancel: boolean; + } + + interface UploadControlFileUploadCompleteEventArgs extends EventArgs { + readonly callbackData: string; + readonly errorText: string; + readonly inputIndex: number; + readonly isValid: boolean; + } + + interface UploadControlFilesUploadCompleteEventArgs extends EventArgs { + readonly callbackData: string; + readonly errorText: string; + } + + interface UploadControlTextChangedEventArgs extends EventArgs { + readonly inputIndex: number; + } + + interface UploadControlUploadingProgressChangedEventArgs extends EventArgs { + readonly currentFileContentLength: number; + readonly currentFileName: string; + readonly currentFileProgress: number; + readonly currentFileUploadedContentLength: number; + readonly fileCount: number; + readonly progress: number; + readonly totalContentLength: number; + readonly uploadedContentLength: number; + } + + interface UploadControlValidationErrorOccurredEventArgs extends EventArgs { + errorText: string; + readonly invalidFiles: BootstrapUploadControlInvalidFileInfo[]; + showAlert: boolean; + readonly validationSettings: BootstrapUploadControlValidationSettings; + } + + interface UploadControlDropZoneEnterEventArgs extends EventArgs { + readonly dropZone: any; + } + + interface UploadControlDropZoneLeaveEventArgs extends EventArgs { + readonly dropZone: any; + } + + class BootstrapUploadControl extends Control { + addFileInput(): void; + cancel(): void; + clearText(): void; + getAddButtonText(): string; + getEnabled(): boolean; + getFileInputCount(): number; + getSelectedFiles(inputIndex: number): BootstrapUploadControlFile[]; + getText(index: number): string; + getUploadButtonText(): string; + removeFileFromSelection(fileIndex: number): void; + removeFileFromSelection(file: BootstrapUploadControlFile): void; // tslint:disable-line:unified-signatures + removeFileInput(index: number): void; + setAddButtonText(text: string): void; + setDialogTriggerID(ids: string): void; + setEnabled(enabled: boolean): void; + setFileInputCount(count: number): void; + setUploadButtonText(text: string): void; + upload(): void; + on(eventName: K, callback: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControl, args?: BootstrapUploadControlEventMap[K]) => void): this; + } + interface BootstrapUploadControlEventMap extends ControlEventMap { + "dropZoneEnter": UploadControlDropZoneEnterEventArgs; + "dropZoneLeave": UploadControlDropZoneLeaveEventArgs; + "fileInputCountChanged": EventArgs; + "fileUploadComplete": UploadControlFileUploadCompleteEventArgs; + "filesUploadComplete": UploadControlFilesUploadCompleteEventArgs; + "filesUploadStart": UploadControlFilesUploadStartEventArgs; + "textChanged": UploadControlTextChangedEventArgs; + "uploadingProgressChanged": UploadControlUploadingProgressChangedEventArgs; + "validationErrorOccurred": UploadControlValidationErrorOccurredEventArgs; + } + + class BootstrapUploadControlFile extends Control { + readonly name: string; + readonly size: number; + readonly sourceFileObject: any; + on(eventName: K, callback: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControlFile, args?: BootstrapUploadControlFileEventMap[K]) => void): this; + } + interface BootstrapUploadControlFileEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapUploadControlInvalidFileInfo extends Control { + readonly fileName: string; + readonly fileSize: number; + on(eventName: K, callback: (this: BootstrapUploadControlInvalidFileInfo, args?: + BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + once(eventName: K, callback: (this: BootstrapUploadControlInvalidFileInfo, + args?: BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: BootstrapUploadControlInvalidFileInfo, + args?: BootstrapUploadControlInvalidFileInfoEventMap[K]) => void): this; + } + interface BootstrapUploadControlInvalidFileInfoEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } + + class BootstrapUploadControlValidationSettings extends Control { + readonly allowedFileExtensions: string[]; + readonly invalidFileNameCharacters: string[]; + readonly maxFileCount: number; + readonly maxFileSize: number; + on(eventName: K, callback: (this: BootstrapUploadControlValidationSettings, + args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + once(eventName: K, callback: (this: + BootstrapUploadControlValidationSettings, args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + off(eventName?: K, callback?: (this: + BootstrapUploadControlValidationSettings, args?: BootstrapUploadControlValidationSettingsEventMap[K]) => void): this; + } + interface BootstrapUploadControlValidationSettingsEventMap extends ControlEventMap { // tslint:disable-line:no-empty-interface + } +} diff --git a/types/devexpress-aspnetcore-bootstrap/tsconfig.json b/types/devexpress-aspnetcore-bootstrap/tsconfig.json new file mode 100644 index 0000000000..1131d37582 --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "devexpress-aspnetcore-bootstrap-tests.ts" + ] +} \ No newline at end of file diff --git a/types/devexpress-aspnetcore-bootstrap/tslint.json b/types/devexpress-aspnetcore-bootstrap/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/devexpress-aspnetcore-bootstrap/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From a47662329cfbdd2978f58a4591248069341c48df Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 22:38:21 +0700 Subject: [PATCH 021/506] Add NextStatelessComponent interface --- types/next/index.d.ts | 6 ++++++ types/next/test/next-component-tests.tsx | 26 ++++++++++++++++++++++++ types/next/tsconfig.json | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 types/next/test/next-component-tests.tsx diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 3abb22a2a4..52c34542ba 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Drew Hays // Brice BERNARD // James Hegedus +// Resi Respati // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -39,6 +40,11 @@ declare namespace next { } } + type NextSFC

= NextStatelessComponent

; + interface NextStatelessComponent

extends React.StatelessComponent

{ + getInitialProps?: (ctx: NextContext) => Promise; + } + type UrlLike = url.UrlObject | url.Url; interface ServerConfig { diff --git a/types/next/test/next-component-tests.tsx b/types/next/test/next-component-tests.tsx new file mode 100644 index 0000000000..33ecb6bc93 --- /dev/null +++ b/types/next/test/next-component-tests.tsx @@ -0,0 +1,26 @@ +import * as React from "react"; +import { NextStatelessComponent } from "next"; + +interface NextComponentProps { + example: string +} + +class ClassNext extends React.Component { + async getInitialProps() { + return { example: 'example' } + } + + render() { + return ( +

I'm a stateless component! {this.props.example}
+ ) + } +} + +const StatelessNext: NextStatelessComponent = ({ example }) => ( +
I'm a stateless component! {example}
+) + +StatelessNext.getInitialProps = async () => { + return { example: 'example' } +} diff --git a/types/next/tsconfig.json b/types/next/tsconfig.json index 48d3f0c8be..d22768e4a1 100644 --- a/types/next/tsconfig.json +++ b/types/next/tsconfig.json @@ -33,6 +33,7 @@ "test/next-document-tests.tsx", "test/next-link-tests.tsx", "test/next-dynamic-tests.tsx", - "test/next-router-tests.tsx" + "test/next-router-tests.tsx", + "test/next-component-tests.tsx" ] } From ba8d541851f904fba222022c449683fe5c3d6cff Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 22:42:03 +0700 Subject: [PATCH 022/506] [next] Use NodeResponse because of unfetch.IsomorphicResponse --- types/next/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 52c34542ba..d83b787b4a 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -11,7 +11,8 @@ import * as http from "http"; import * as url from "url"; -import * as fetch from "isomorphic-unfetch"; + +import { Response as NodeResponse } from "node-fetch"; declare namespace next { // <> @@ -29,7 +30,7 @@ declare namespace next { /** HTTP response object (server only) */ res?: http.ServerResponse /** Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response */ - jsonPageRes?: fetch.IsomorphicResponse + jsonPageRes?: NodeResponse /** Error object if any error is encountered during the rendering */ err?: Error /** a callback that executes the actual React rendering logic (synchronously) */ From 4dff7d985840fbe92101a8d5d3d8b5ccca9eb5f8 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 22:51:14 +0700 Subject: [PATCH 023/506] [next] Added typings for `next/app` --- types/next/app.d.ts | 10 ++++++++++ types/next/test/next-app-tests.tsx | 27 +++++++++++++++++++++++++++ types/next/tsconfig.json | 1 + 3 files changed, 38 insertions(+) create mode 100644 types/next/app.d.ts create mode 100644 types/next/test/next-app-tests.tsx diff --git a/types/next/app.d.ts b/types/next/app.d.ts new file mode 100644 index 0000000000..6d10d77af8 --- /dev/null +++ b/types/next/app.d.ts @@ -0,0 +1,10 @@ +import * as React from "react"; + +export interface AppComponentProps { + Component: React.ComponentType; + pageProps: any +} + +export class Container extends React.Component {} + +export default class App

extends React.Component

{} diff --git a/types/next/test/next-app-tests.tsx b/types/next/test/next-app-tests.tsx new file mode 100644 index 0000000000..3e7c56f87c --- /dev/null +++ b/types/next/test/next-app-tests.tsx @@ -0,0 +1,27 @@ +import * as React from "react"; +import App, { Container } from "next/app"; + +interface NextComponentProps { + example: string; +} + +class TestApp extends App { + static async getInitialProps({ Component, router, ctx }: any) { + let pageProps = {}; + + if (Component.getInitialProps) { + pageProps = await Component.getInitialProps(ctx); + } + + return { pageProps }; + } + + render() { + const { Component, pageProps } = this.props; + return ( + + + + ); + } +} diff --git a/types/next/tsconfig.json b/types/next/tsconfig.json index d22768e4a1..36aef39491 100644 --- a/types/next/tsconfig.json +++ b/types/next/tsconfig.json @@ -28,6 +28,7 @@ "router.d.ts", "config.d.ts", "test/next-tests.ts", + "test/next-app-tests.tsx", "test/next-error-tests.tsx", "test/next-head-tests.tsx", "test/next-document-tests.tsx", From 3c4579913defe15ac6bd51858f88dc17e7477d3f Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 23:03:41 +0700 Subject: [PATCH 024/506] [next] run dtslint --- types/next/index.d.ts | 21 ++++++++++++--------- types/next/test/next-component-tests.tsx | 12 ++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index d83b787b4a..939dc27bdb 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -15,30 +15,33 @@ import * as url from "url"; import { Response as NodeResponse } from "node-fetch"; declare namespace next { - // <> + /** + * Context object used in methods like `getInitialProps()` + * <> + */ interface NextContext { /** path section of URL */ - pathname: string + pathname: string; /** query string section of URL parsed as an object */ query: { [key: string]: any - } + }; /** String of the actual path (including the query) shows in the browser */ - asPath: string + asPath: string; /** HTTP request object (server only) */ - req?: http.IncomingMessage + req?: http.IncomingMessage; /** HTTP response object (server only) */ - res?: http.ServerResponse + res?: http.ServerResponse; /** Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response */ - jsonPageRes?: NodeResponse + jsonPageRes?: NodeResponse; /** Error object if any error is encountered during the rendering */ - err?: Error + err?: Error; /** a callback that executes the actual React rendering logic (synchronously) */ renderPage( cb?: (enhancer: () => JSX.Element) => React.ComponentType ): { [key: string]: any - } + }; } type NextSFC

= NextStatelessComponent

; diff --git a/types/next/test/next-component-tests.tsx b/types/next/test/next-component-tests.tsx index 33ecb6bc93..a6e870f8e2 100644 --- a/types/next/test/next-component-tests.tsx +++ b/types/next/test/next-component-tests.tsx @@ -2,25 +2,25 @@ import * as React from "react"; import { NextStatelessComponent } from "next"; interface NextComponentProps { - example: string + example: string; } class ClassNext extends React.Component { async getInitialProps() { - return { example: 'example' } + return { example: 'example' }; } render() { return (

I'm a stateless component! {this.props.example}
- ) + ); } } const StatelessNext: NextStatelessComponent = ({ example }) => (
I'm a stateless component! {example}
-) +); StatelessNext.getInitialProps = async () => { - return { example: 'example' } -} + return { example: 'example' }; +}; From 3c5384acca044e06c4e214cf5b113b139a95cb7c Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 23:12:07 +0700 Subject: [PATCH 025/506] [next] Added AppComponentContext type --- types/next/app.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/next/app.d.ts b/types/next/app.d.ts index 6d10d77af8..512c5f996f 100644 --- a/types/next/app.d.ts +++ b/types/next/app.d.ts @@ -1,10 +1,17 @@ import * as React from "react"; +import { NextContext } from "next"; export interface AppComponentProps { Component: React.ComponentType; pageProps: any } +export interface AppComponentContext { + Component: any; + router: any; // TODO: could be SingletonRouter? + ctx: NextContext; +} + export class Container extends React.Component {} export default class App

extends React.Component

{} From f3d3de950904a3e46137c31a222e1b2d4b4d4841 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 23:16:42 +0700 Subject: [PATCH 026/506] [next] include app.d.ts in bundle --- types/next/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/next/tsconfig.json b/types/next/tsconfig.json index 36aef39491..125953fcd6 100644 --- a/types/next/tsconfig.json +++ b/types/next/tsconfig.json @@ -20,6 +20,7 @@ }, "files": [ "index.d.ts", + "app.d.ts", "document.d.ts", "dynamic.d.ts", "error.d.ts", From 92db478980b2221b31f995a0658191902ba9bb4f Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Fri, 11 May 2018 23:17:40 +0700 Subject: [PATCH 027/506] [next] re-run dtslint --- types/next/app.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/next/app.d.ts b/types/next/app.d.ts index 512c5f996f..0296440ddb 100644 --- a/types/next/app.d.ts +++ b/types/next/app.d.ts @@ -1,9 +1,9 @@ import * as React from "react"; -import { NextContext } from "next"; +import { NextContext } from "."; export interface AppComponentProps { Component: React.ComponentType; - pageProps: any + pageProps: any; } export interface AppComponentContext { From 28b1367d70342534ff1bcd2ecedcc27b0da2f6d5 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sat, 12 May 2018 11:51:42 +0700 Subject: [PATCH 028/506] [next] fix tests (getInitialProps should be static) --- types/next/test/next-component-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/next/test/next-component-tests.tsx b/types/next/test/next-component-tests.tsx index a6e870f8e2..fefde092ea 100644 --- a/types/next/test/next-component-tests.tsx +++ b/types/next/test/next-component-tests.tsx @@ -6,7 +6,7 @@ interface NextComponentProps { } class ClassNext extends React.Component { - async getInitialProps() { + static async getInitialProps() { return { example: 'example' }; } From b4518ea734b64d0a486b07b8e5c68268834cc2f9 Mon Sep 17 00:00:00 2001 From: taoqf Date: Sat, 12 May 2018 15:30:51 +0800 Subject: [PATCH 029/506] upgrade jsreport-html-to-xlsx to 2.0 --- types/jsreport-html-to-xlsx/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/jsreport-html-to-xlsx/index.d.ts b/types/jsreport-html-to-xlsx/index.d.ts index 84b37480aa..83ac765c1f 100644 --- a/types/jsreport-html-to-xlsx/index.d.ts +++ b/types/jsreport-html-to-xlsx/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsreport-html-to-xlsx 1.4 +// Type definitions for jsreport-html-to-xlsx 2.0 // Project: https://github.com/jsreport/jsreport-html-to-xlsx // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,7 +8,9 @@ import { ExtensionDefinition } from 'jsreport-core'; import { Options as BaseOptions } from 'jsreport-xlsx'; declare module 'jsreport-core' { + type htmlEngine = 'phantom' | 'chrome'; interface Template { + htmlToXlsx: { htmlEngine: htmlEngine; }; recipe: 'html-to-xlsx' | string; } } From 92c29516cf7f91ffabe35199a411b46581038fef Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Mon, 14 May 2018 16:53:24 -0700 Subject: [PATCH 030/506] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 89 ++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 418525d38f..884cbacc06 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -8,6 +8,7 @@ // Kyle Kamperschroer // Kensuke Hoshikawa // Thomas Bruun +// Gal Talmor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -737,12 +738,17 @@ declare namespace Stripe { * charge if a partial refund was issued), positive integer or zero. */ amount_refunded: number; + + /** + * ID of the Connect application that created the charge. [Expandable] + */ + application?: string | null; /** * The application fee (if any) for the charge. See the Connect documentation * for details. [Expandable] */ - application_fee?: string | applicationFees.IApplicationFee; + application_fee?: string | applicationFees.IApplicationFee | null; /** * ID of the balance transaction that describes the impact of this charge on @@ -767,25 +773,33 @@ declare namespace Stripe { /** * ID of the customer this charge is for if one exists. [Expandable] */ - customer: string | customers.ICustomer; + customer: string | customers.ICustomer | null; description?: string; + /** + * The account (if any) the charge was made on behalf of, with an automatic + * transfer. See the [Connect documentation] + * for details. + * [Expandable] + */ + destination?: string | null; + /** * Details about the dispute if the charge has been disputed. */ - dispute?: disputes.IDispute; + dispute?: disputes.IDispute | null; /** * Error code explaining reason for charge failure if available (see the errors section for a list of * codes: https://stripe.com/docs/api#errors). */ - failure_code: string; + failure_code: string | null; /** * Message to user further explaining reason for charge failure if available. */ - failure_message: string; + failure_message: string | null; /** * Hash with information on fraud assessments for the charge. @@ -805,16 +819,30 @@ declare namespace Stripe { /** * ID of the invoice this charge is for if one exists. [Expandable] */ - invoice: string | invoices.IInvoice; + invoice: string | invoices.IInvoice | null; livemode: boolean; metadata: IMetadata; + /** + * The Stripe account ID for which these funds are intended. Automatically + * set if you use the destination parameter. For details, see [Creating + * Separate Charges and Transfers] + * . + */ + on_behalf_of?: string | null; + /** * ID of the order this charge is for if one exists. [Expandable] */ - order: string | orders.IOrder; + order: string | orders.IOrder | null; + + /** + * Details about whether the payment was accepted, and why. See + * understanding declines for details. [Expandable] + */ + outcome?: any; /** * true if the charge succeeded, or was successfully authorized for later capture. @@ -824,12 +852,12 @@ declare namespace Stripe { /** * This is the email address that the receipt for this charge was sent to. */ - receipt_email: string; + receipt_email: string | null; /** * This is the transaction number that appears on email receipts sent for this charge. */ - receipt_number: string; + receipt_number: string | null; /** * Whether or not the charge has been fully refunded. If the charge is only partially refunded, @@ -842,10 +870,15 @@ declare namespace Stripe { */ refunds: IChargeRefunds; + /** + * ID of the review associated with this charge if one exists. [Expandable] + */ + review?: string | null; + /** * Shipping information for the charge. */ - shipping?: IShippingInformation; + shipping?: IShippingInformation | null; /** * For most Stripe users, the source of every charge is a credit or debit card. @@ -858,13 +891,13 @@ declare namespace Stripe { * from another Stripe account. See the Connect documentation for details. * [Expandable] */ - source_transfer: string | transfers.ITransfer; + source_transfer: string | transfers.ITransfer | null; /** * Extra information about a charge. This will appear on your customer’s * credit card statement. */ - statement_descriptor: string; + statement_descriptor: string | null; /** * The status of the payment is either "succeeded", "pending", or "failed". @@ -875,7 +908,15 @@ declare namespace Stripe { * ID of the transfer to the destination account (only applicable if the * charge was created using the destination parameter). [Expandable] */ - transfer: string | transfers.ITransfer; + transfer?: string | transfers.ITransfer; + + /** + * A string that identifies this transaction as part of a group. + * See the [Connect documentation] + * + * for details. + */ + transfer_group?: string | null; } interface IChargeCreationOptions extends IDataOptionsWithMetadata { @@ -1056,7 +1097,7 @@ declare namespace Stripe { } } - interface IChargeRefunds extends IList, resources.ChargeRefunds { } + interface IChargeRefunds extends IList { } } namespace coupons { @@ -4086,7 +4127,7 @@ declare namespace Stripe { * in the card object if the card belongs to an account or recipient * instead. */ - customer?: string | customers.ICustomer; + customer?: string | customers.ICustomer | null; /** * Only applicable on accounts (not customers or recipients). This @@ -4120,7 +4161,7 @@ declare namespace Stripe { /** * The card number */ - number: string; + number?: string; /** * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. @@ -4134,20 +4175,20 @@ declare namespace Stripe { */ funding: "credit" | "debit" | "prepaid" | "unknown"; last4: string; - address_city: string; + address_city: string | null; /** * Billing address country, if provided when creating card */ - address_country: string; - address_line1: string; + address_country: string | null; + address_line1: string | null; /** * If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked. */ - address_line1_check: string; - address_line2: string; - address_state: string; + address_line1_check: string | null; + address_line2: string | null; + address_state: string | null; address_zip: string; /** @@ -4169,7 +4210,7 @@ declare namespace Stripe { /** * (For Apple Pay integrations only.) The last four digits of the device account number. */ - dynamic_last4: string; + dynamic_last4: string | null; /** * Cardholder name @@ -4188,7 +4229,7 @@ declare namespace Stripe { * If the card number is tokenized, this is the method that was * used. Can be "apple_pay" or "android_pay". */ - tokenization_method: "apple_pay" | "android_pay"; + tokenization_method: "apple_pay" | "android_pay" | null; } interface ICardUpdateOptions extends IDataOptionsWithMetadata { From 06caab2123387d471212f59a470754da1b8e3a46 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Mon, 14 May 2018 17:11:48 -0700 Subject: [PATCH 031/506] Fix stripe ICharge interface with missing fields and optional null values --- types/stripe/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 884cbacc06..496ae404f0 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1097,7 +1097,7 @@ declare namespace Stripe { } } - interface IChargeRefunds extends IList { } + interface IChargeRefunds extends IList, resources.ChargeRefunds { } } namespace coupons { @@ -5423,18 +5423,18 @@ declare namespace Stripe { * Once entirely refunded, a charge can't be refunded again. * This method will throw an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge. */ - create(data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - create(data: refunds.IRefundCreationOptions, response?: IResponseFn): Promise; - create(options: HeaderOptions, response?: IResponseFn): Promise; - create(response?: IResponseFn): Promise; + create?(data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + create?(data: refunds.IRefundCreationOptions, response?: IResponseFn): Promise; + create?(options: HeaderOptions, response?: IResponseFn): Promise; + create?(response?: IResponseFn): Promise; /** * Retrieves the details of an existing refund. */ - retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; - retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; - retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; - retrieve(id: string, response?: IResponseFn): Promise; + retrieve?(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve?(id: string, data: IDataOptions, response?: IResponseFn): Promise; + retrieve?(id: string, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve?(id: string, response?: IResponseFn): Promise; /** @@ -5443,18 +5443,18 @@ declare namespace Stripe { * * This request only accepts metadata as an argument. */ - update(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; - update(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; + update?(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; + update?(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; /** * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, * with the most recent refunds appearing first. * For convenience, the 10 most recent refunds are always available by default on the charge object. */ - list(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - list(data: refunds.IRefundListOptions, response?: IResponseFn>): Promise>; - list(options: HeaderOptions, response?: IResponseFn>): Promise>; - list(response?: IResponseFn>): Promise>; + list?(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + list?(data: refunds.IRefundListOptions, response?: IResponseFn>): Promise>; + list?(options: HeaderOptions, response?: IResponseFn>): Promise>; + list?(response?: IResponseFn>): Promise>; } class Coupons extends StripeResource { From 20d62b5477c55888a6e22e7a6e56cfe0d4101aa7 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 11:12:01 +1000 Subject: [PATCH 032/506] Fixed indentation --- types/react-calendar-timeline/index.d.ts | 118 +++++++++++------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 86c79ca7ae..26a3df52cd 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for react-calendar-timeline v0.15.12 // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov -// Alex Maclean +// Alex Maclean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -9,7 +9,7 @@ declare module "react-calendar-timeline" { - export interface TimelineGroup { + export interface TimelineGroup { id: number; title: React.ReactNode; } @@ -33,63 +33,63 @@ declare module "react-calendar-timeline" { } export interface ReactCalendarTimelineProps { - groups: TimelineGroup[]; - items: TimelineItem[]; - keys?:{ - groupIdKey: string; - groupTitleKey: string; - itemIdKey: string; - itemTitleKey: string; - itemGroupKey: string; - itemTimeStartKey: string; - itemTimeEndKey: string; - }; - selected?: number[]; - sidebarWidth?: number; - sidebarContent?: any; - rightSidebarWidth?: number; - rightSidebarContent?: any; - dragSnap?: number; - minResizeWidth?: number; - stickyOffset?: number; - stickyHeader?: boolean; - headerRef?: any; - lineHeight?: number; - headerLabelGroupHeight?: number; - headerLabelHeight?: number; - itemHeightRatio?: number; - minZoom?: number; - maxZoom?: number; - clickTolerance?: number; - canMove?: boolean; - canChangeGroup?: boolean; - canResize?: boolean; - useResizeHandle?: boolean; - showCursorLine?: boolean; - stackItems?: boolean; - traditionalZoom?: boolean; - itemTouchSendsClick?: boolean; - onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; - onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; - onItemSelect?(itemId:number, e: any, time: number): any; - onItemClick?(itemId:number, e: any, time: number): any; - onItemDoubleClick?(itemId:number, e: any, time: number): any; - onCanvasClick?(groupId:number, time:number, e:any): any; - onCanvasDoubleClick?(groupId:number, time:number, e:any): any; - moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; - defaultTimeStart?: any; - defaultTimeEnd?: any; - visibleTimeStart?: number; - visibleTimeEnd?: number; - onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; - onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; - onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; - onZoom?(timelineContext: TimelineContext): any; - children?: any; - fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; - minimumWidthForItemContentVisibility?: number; + groups: TimelineGroup[]; + items: TimelineItem[]; + keys?:{ + groupIdKey: string; + groupTitleKey: string; + itemIdKey: string; + itemTitleKey: string; + itemGroupKey: string; + itemTimeStartKey: string; + itemTimeEndKey: string; + }; + selected?: number[]; + sidebarWidth?: number; + sidebarContent?: any; + rightSidebarWidth?: number; + rightSidebarContent?: any; + dragSnap?: number; + minResizeWidth?: number; + stickyOffset?: number; + stickyHeader?: boolean; + headerRef?: any; + lineHeight?: number; + headerLabelGroupHeight?: number; + headerLabelHeight?: number; + itemHeightRatio?: number; + minZoom?: number; + maxZoom?: number; + clickTolerance?: number; + canMove?: boolean; + canChangeGroup?: boolean; + canResize?: boolean; + useResizeHandle?: boolean; + showCursorLine?: boolean; + stackItems?: boolean; + traditionalZoom?: boolean; + itemTouchSendsClick?: boolean; + onItemMove?(itemId:number, dragTime:number, newGroupOrder:number): any; + onItemResize?(itemId:number, newResizeEnd: number, edge: "left" | "right"): any; + onItemSelect?(itemId:number, e: any, time: number): any; + onItemClick?(itemId:number, e: any, time: number): any; + onItemDoubleClick?(itemId:number, e: any, time: number): any; + onCanvasClick?(groupId:number, time:number, e:any): any; + onCanvasDoubleClick?(groupId:number, time:number, e:any): any; + moveResizeValidator?(action:"move" | "resize", itemId:number, time:number, resizeEdge: "left" | "right"): any; + defaultTimeStart?: any; + defaultTimeEnd?: any; + visibleTimeStart?: number; + visibleTimeEnd?: number; + onTimeChange?(visibleTimeStart: number, visibleTimeEnd: number, updateScrollCanvas: (start: number, end: number) => void): any; + onTimeInit?(visibleTimeStart: number, visibleTimeEnd: number): any; + onBoundsChange?(canvasTimeStart: number, canvasTimeEnd: number): any; + onZoom?(timelineContext: TimelineContext): any; + children?: any; + fullUpdate?: boolean; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; export default ReactCalendarTimeline; From 6b80387511b4e4ab007305dd1f8bc3eafb397796 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 16:03:37 +1000 Subject: [PATCH 033/506] Fixed typing. --- types/react-calendar-timeline/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index 26a3df52cd..d5643d0e2a 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -87,8 +87,8 @@ declare module "react-calendar-timeline" { onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactNode; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactNode; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>;; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>;; minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; From 6d9d52c150e170c5a5f2ed01d04c2d93022bf73f Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Wed, 16 May 2018 16:29:00 +1000 Subject: [PATCH 034/506] Fat fingers. --- types/react-calendar-timeline/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index d5643d0e2a..8c523e68c6 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -87,8 +87,8 @@ declare module "react-calendar-timeline" { onZoom?(timelineContext: TimelineContext): any; children?: any; fullUpdate?: boolean; - itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>;; - groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>;; + itemRenderer?: (props: {item: TimelineItem, context: TimelineContext}) => React.ReactElement<{}>; + groupRenderer?: (props: {group: TimelineGroup, isRightSidebar: boolean}) => React.ReactElement<{}>; minimumWidthForItemContentVisibility?: number; } let ReactCalendarTimeline : React.ClassicComponentClass; From 4e412e57ededaa6382b402208ebcddf9a0b8a771 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:09:29 +0200 Subject: [PATCH 035/506] Typings for intl-locales-supported --- types/intl-locales-supported/index.d.ts | 6 +++++ .../intl-locales-supported-tests.ts | 4 ++++ types/intl-locales-supported/tsconfig.json | 23 +++++++++++++++++++ types/intl-locales-supported/tslint.json | 1 + 4 files changed, 34 insertions(+) create mode 100644 types/intl-locales-supported/index.d.ts create mode 100644 types/intl-locales-supported/intl-locales-supported-tests.ts create mode 100644 types/intl-locales-supported/tsconfig.json create mode 100644 types/intl-locales-supported/tslint.json diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts new file mode 100644 index 0000000000..1ad51f1f6c --- /dev/null +++ b/types/intl-locales-supported/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for intl-locales-supported 1.0 +// Project: https://github.com/yahoo/intl-locales-supported +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function areIntlLocalesSupported(locales: string | string[]): void; diff --git a/types/intl-locales-supported/intl-locales-supported-tests.ts b/types/intl-locales-supported/intl-locales-supported-tests.ts new file mode 100644 index 0000000000..dcddcd545d --- /dev/null +++ b/types/intl-locales-supported/intl-locales-supported-tests.ts @@ -0,0 +1,4 @@ +import areIntlLocalesSupported from "intl-locales-supported"; + +areIntlLocalesSupported("en-GB"); +areIntlLocalesSupported([ "en-GB", "en-US" ]); diff --git a/types/intl-locales-supported/tsconfig.json b/types/intl-locales-supported/tsconfig.json new file mode 100644 index 0000000000..f528331ae4 --- /dev/null +++ b/types/intl-locales-supported/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "intl-locales-supported-tests.ts" + ] +} diff --git a/types/intl-locales-supported/tslint.json b/types/intl-locales-supported/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intl-locales-supported/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0d02c685c52f6042f9189d9c498f7f551a0a6711 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:15:57 +0200 Subject: [PATCH 036/506] Update index.d.ts Update maintainer name --- types/intl-locales-supported/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/intl-locales-supported/index.d.ts b/types/intl-locales-supported/index.d.ts index 1ad51f1f6c..b156905fdf 100644 --- a/types/intl-locales-supported/index.d.ts +++ b/types/intl-locales-supported/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for intl-locales-supported 1.0 // Project: https://github.com/yahoo/intl-locales-supported -// Definitions by: My Self +// Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export default function areIntlLocalesSupported(locales: string | string[]): void; From 9d68e22a0c62fbd58869ab901ad09badf8eb6dcf Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Wed, 16 May 2018 21:57:28 +0700 Subject: [PATCH 037/506] [next] separate context objects for Document + fix tests --- types/next/document.d.ts | 13 +++++++++ types/next/index.d.ts | 6 ---- types/next/test/next-document-tests.tsx | 38 +++++++++++++++++++++---- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/types/next/document.d.ts b/types/next/document.d.ts index 4696819626..01344de7c8 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -1,4 +1,5 @@ import * as React from "react"; +import { NextContext } from "."; export interface DocumentProps { __NEXT_DATA__?: any; @@ -9,6 +10,18 @@ export interface DocumentProps { [key: string]: any; } +/** + * Context object used inside `Document` + */ +export interface NextDocumentContext extends NextContext { + /** A callback that executes the actual React rendering logic (synchronously) */ + renderPage( + cb?: (enhancer: () => JSX.Element) => React.ComponentType + ): { + [key: string]: any + }; +} + export class Head extends React.Component {} export class Main extends React.Component {} export class NextScript extends React.Component {} diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 939dc27bdb..6679420ba3 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -36,12 +36,6 @@ declare namespace next { jsonPageRes?: NodeResponse; /** Error object if any error is encountered during the rendering */ err?: Error; - /** a callback that executes the actual React rendering logic (synchronously) */ - renderPage( - cb?: (enhancer: () => JSX.Element) => React.ComponentType - ): { - [key: string]: any - }; } type NextSFC

= NextStatelessComponent

; diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index 0177d1d451..2b3257cd25 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -1,12 +1,40 @@ -import Document, * as document from "next/document"; +import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document'; import * as React from "react"; const results = ( - + - - - + +

+ ); + +const Wrapper: React.SFC = ({ children }) => {children}; + +export default class MyDocument extends Document { + static async getInitialProps({ renderPage }: NextDocumentContext) { + // Without callback + const page = renderPage(); + // With callback + const differentPage = renderPage(App => props => ); + const style = {}; + return { ...page, style }; + } + + render() { + return ( + + + My page +